var $U=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var b0e=$U((ri,ii)=>{(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var bm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function yw(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ad={},JU={get exports(){return ad},set exports(n){ad=n}},rv={},z={},XU={get exports(){return z},set exports(n){z=n}},Et={};/** * @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 $d=Symbol.for("react.element"),KU=Symbol.for("react.portal"),YU=Symbol.for("react.fragment"),QU=Symbol.for("react.strict_mode"),qU=Symbol.for("react.profiler"),ZU=Symbol.for("react.provider"),e4=Symbol.for("react.context"),t4=Symbol.for("react.forward_ref"),n4=Symbol.for("react.suspense"),r4=Symbol.for("react.memo"),i4=Symbol.for("react.lazy"),oE=Symbol.iterator;function s4(n){return n===null||typeof n!="object"?null:(n=oE&&n[oE]||n["@@iterator"],typeof n=="function"?n:null)}var DB={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},FB=Object.assign,OB={};function of(n,e,t){this.props=n,this.context=e,this.refs=OB,this.updater=t||DB}of.prototype.isReactComponent={};of.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")};of.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function kB(){}kB.prototype=of.prototype;function xw(n,e,t){this.props=n,this.context=e,this.refs=OB,this.updater=t||DB}var _w=xw.prototype=new kB;_w.constructor=xw;FB(_w,of.prototype);_w.isPureReactComponent=!0;var aE=Array.isArray,NB=Object.prototype.hasOwnProperty,Sw={current:null},UB={key:!0,ref:!0,__self:!0,__source:!0};function GB(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)NB.call(e,r)&&!UB.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1>>1,ee=U[se];if(0>>1;sei(Me,j))yei(q,Me)?(U[se]=q,U[ye]=j,se=ye):(U[se]=Me,U[ie]=j,se=ie);else if(yei(q,j))U[se]=q,U[ye]=j,se=ye;else break e}}return $}function i(U,$){var j=U.sortIndex-$.sortIndex;return j!==0?j:U.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],u=[],h=1,d=null,p=3,m=!1,v=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(U){for(var $=t(u);$!==null;){if($.callback===null)r(u);else if($.startTime<=U)r(u),$.sortIndex=$.expirationTime,e(l,$);else break;$=t(u)}}function M(U){if(x=!1,S(U),!v)if(t(l)!==null)v=!0,re(C);else{var $=t(u);$!==null&&ue(M,$.startTime-U)}}function C(U,$){v=!1,x&&(x=!1,g(B),B=-1),m=!0;var j=p;try{for(S($),d=t(l);d!==null&&(!(d.expirationTime>$)||U&&!I());){var se=d.callback;if(typeof se=="function"){d.callback=null,p=d.priorityLevel;var ee=se(d.expirationTime<=$);$=n.unstable_now(),typeof ee=="function"?d.callback=ee:d===t(l)&&r(l),S($)}else r(l);d=t(l)}if(d!==null)var ne=!0;else{var ie=t(u);ie!==null&&ue(M,ie.startTime-$),ne=!1}return ne}finally{d=null,p=j,m=!1}}var P=!1,L=null,B=-1,E=5,R=-1;function I(){return!(n.unstable_now()-RU||125se?(U.sortIndex=j,e(u,U),t(l)===null&&U===t(u)&&(x?(g(B),B=-1):x=!0,ue(M,j-se))):(U.sortIndex=ee,e(l,U),v||m||(v=!0,re(C))),U},n.unstable_shouldYield=I,n.unstable_wrapCallback=function(U){var $=p;return function(){var j=p;p=$;try{return U.apply(this,arguments)}finally{p=j}}}})(VB);(function(n){n.exports=VB})(v4);/** * @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 WB=z,ai=e_;function Ae(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"),t_=Object.prototype.hasOwnProperty,y4=/^[: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]*$/,uE={},cE={};function x4(n){return t_.call(cE,n)?!0:t_.call(uE,n)?!1:y4.test(n)?cE[n]=!0:(uE[n]=!0,!1)}function _4(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 S4(n,e,t,r){if(e===null||typeof e>"u"||_4(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 Cr(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 nr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){nr[n]=new Cr(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];nr[e]=new Cr(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){nr[n]=new Cr(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){nr[n]=new Cr(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){nr[n]=new Cr(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){nr[n]=new Cr(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){nr[n]=new Cr(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){nr[n]=new Cr(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){nr[n]=new Cr(n,5,!1,n.toLowerCase(),null,!1,!1)});var Aw=/[\-:]([a-z])/g;function Mw(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(Aw,Mw);nr[e]=new Cr(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(Aw,Mw);nr[e]=new Cr(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(Aw,Mw);nr[e]=new Cr(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){nr[n]=new Cr(n,1,!1,n.toLowerCase(),null,!1,!1)});nr.xlinkHref=new Cr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){nr[n]=new Cr(n,1,!1,n.toLowerCase(),null,!0,!0)});function bw(n,e,t,r){var i=nr.hasOwnProperty(e)?nr[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{px=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?Th(n):""}function w4(n){switch(n.tag){case 5:return Th(n.type);case 16:return Th("Lazy");case 13:return Th("Suspense");case 19:return Th("SuspenseList");case 0:case 2:case 15:return n=mx(n.type,!1),n;case 11:return n=mx(n.type.render,!1),n;case 1:return n=mx(n.type,!0),n;default:return""}}function s_(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 lc:return"Fragment";case ac:return"Portal";case n_:return"Profiler";case Cw:return"StrictMode";case r_:return"Suspense";case i_:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case JB:return(n.displayName||"Context")+".Consumer";case $B:return(n._context.displayName||"Context")+".Provider";case Ew:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case Tw:return e=n.displayName||null,e!==null?e:s_(n.type)||"Memo";case Ko:e=n._payload,n=n._init;try{return s_(n(e))}catch{}}return null}function A4(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 s_(e);case 8:return e===Cw?"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 ya(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function KB(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function M4(n){var e=KB(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 Tm(n){n._valueTracker||(n._valueTracker=M4(n))}function YB(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=KB(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function f0(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 o_(n,e){var t=e.checked;return pn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function hE(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=ya(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 QB(n,e){e=e.checked,e!=null&&bw(n,"checked",e,!1)}function a_(n,e){QB(n,e);var t=ya(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")?l_(n,e.type,t):e.hasOwnProperty("defaultValue")&&l_(n,e.type,ya(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function dE(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 l_(n,e,t){(e!=="number"||f0(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var Ph=Array.isArray;function bc(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Pm.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function ud(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Uh={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},b4=["Webkit","ms","Moz","O"];Object.keys(Uh).forEach(function(n){b4.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Uh[e]=Uh[n]})});function tL(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Uh.hasOwnProperty(n)&&Uh[n]?(""+e).trim():e+"px"}function nL(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=tL(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var C4=pn({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 f_(n,e){if(e){if(C4[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ae(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ae(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ae(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ae(62))}}function h_(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 d_=null;function Pw(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var p_=null,Cc=null,Ec=null;function gE(n){if(n=Kd(n)){if(typeof p_!="function")throw Error(Ae(280));var e=n.stateNode;e&&(e=lv(e),p_(n.stateNode,n.type,e))}}function rL(n){Cc?Ec?Ec.push(n):Ec=[n]:Cc=n}function iL(){if(Cc){var n=Cc,e=Ec;if(Ec=Cc=null,gE(n),e)for(n=0;n>>=0,n===0?32:31-(k4(n)/N4|0)|0}var Rm=64,Bm=4194304;function Rh(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 m0(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=Rh(a):(s&=o,s!==0&&(r=Rh(s)))}else o=t&~i,o!==0?r=Rh(o):s!==0&&(r=Rh(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 Jd(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-ss(e),n[e]=t}function H4(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=zh),bE=String.fromCharCode(32),CE=!1;function ML(n,e){switch(n){case"keyup":return g5.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bL(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var uc=!1;function y5(n,e){switch(n){case"compositionend":return bL(e);case"keypress":return e.which!==32?null:(CE=!0,bE);case"textInput":return n=e.data,n===bE&&CE?null:n;default:return null}}function x5(n,e){if(uc)return n==="compositionend"||!kw&&ML(n,e)?(n=wL(),$g=Dw=ra=null,uc=!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=RE(t)}}function PL(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?PL(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function RL(){for(var n=window,e=f0();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=f0(n.document)}return e}function Nw(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 T5(n){var e=RL(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&PL(t.ownerDocument.documentElement,t)){if(r!==null&&Nw(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=BE(t,s);var o=BE(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,cc=null,__=null,Vh=null,S_=!1;function LE(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;S_||cc==null||cc!==f0(r)||(r=cc,"selectionStart"in r&&Nw(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}),Vh&&md(Vh,r)||(Vh=r,r=y0(__,"onSelect"),0dc||(n.current=E_[dc],E_[dc]=null,dc--)}function Xt(n,e){dc++,E_[dc]=n.current,n.current=e}var xa={},dr=Pa(xa),Nr=Pa(!1),Pl=xa;function Nc(n,e){var t=n.type.contextTypes;if(!t)return xa;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 Ur(n){return n=n.childContextTypes,n!=null}function _0(){en(Nr),en(dr)}function UE(n,e,t){if(dr.current!==xa)throw Error(Ae(168));Xt(dr,e),Xt(Nr,t)}function UL(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(Ae(108,A4(n)||"Unknown",i));return pn({},t,r)}function S0(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||xa,Pl=dr.current,Xt(dr,n),Xt(Nr,Nr.current),!0}function GE(n,e,t){var r=n.stateNode;if(!r)throw Error(Ae(169));t?(n=UL(n,e,Pl),r.__reactInternalMemoizedMergedChildContext=n,en(Nr),en(dr),Xt(dr,n)):en(Nr),Xt(Nr,t)}var eo=null,uv=!1,Px=!1;function GL(n){eo===null?eo=[n]:eo.push(n)}function G5(n){uv=!0,GL(n)}function Ra(){if(!Px&&eo!==null){Px=!0;var n=0,e=zt;try{var t=eo;for(zt=1;n>=o,i-=o,io=1<<32-ss(e)+i|t<B?(E=L,L=null):E=L.sibling;var R=p(g,L,S[B],M);if(R===null){L===null&&(L=E);break}n&&L&&R.alternate===null&&e(g,L),w=s(R,w,B),P===null?C=R:P.sibling=R,P=R,L=E}if(B===S.length)return t(g,L),sn&&nl(g,B),C;if(L===null){for(;BB?(E=L,L=null):E=L.sibling;var I=p(g,L,R.value,M);if(I===null){L===null&&(L=E);break}n&&L&&I.alternate===null&&e(g,L),w=s(I,w,B),P===null?C=I:P.sibling=I,P=I,L=E}if(R.done)return t(g,L),sn&&nl(g,B),C;if(L===null){for(;!R.done;B++,R=S.next())R=d(g,R.value,M),R!==null&&(w=s(R,w,B),P===null?C=R:P.sibling=R,P=R);return sn&&nl(g,B),C}for(L=r(g,L);!R.done;B++,R=S.next())R=m(L,g,B,R.value,M),R!==null&&(n&&R.alternate!==null&&L.delete(R.key===null?B:R.key),w=s(R,w,B),P===null?C=R:P.sibling=R,P=R);return n&&L.forEach(function(V){return e(g,V)}),sn&&nl(g,B),C}function _(g,w,S,M){if(typeof S=="object"&&S!==null&&S.type===lc&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case Em:e:{for(var C=S.key,P=w;P!==null;){if(P.key===C){if(C=S.type,C===lc){if(P.tag===7){t(g,P.sibling),w=i(P,S.props.children),w.return=g,g=w;break e}}else if(P.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===Ko&&JE(C)===P.type){t(g,P.sibling),w=i(P,S.props),w.ref=eh(g,P,S),w.return=g,g=w;break e}t(g,P);break}else e(g,P);P=P.sibling}S.type===lc?(w=wl(S.props.children,g.mode,M,S.key),w.return=g,g=w):(M=e0(S.type,S.key,S.props,null,g.mode,M),M.ref=eh(g,w,S),M.return=g,g=M)}return o(g);case ac:e:{for(P=S.key;w!==null;){if(w.key===P)if(w.tag===4&&w.stateNode.containerInfo===S.containerInfo&&w.stateNode.implementation===S.implementation){t(g,w.sibling),w=i(w,S.children||[]),w.return=g,g=w;break e}else{t(g,w);break}else e(g,w);w=w.sibling}w=kx(S,g.mode,M),w.return=g,g=w}return o(g);case Ko:return P=S._init,_(g,w,P(S._payload),M)}if(Ph(S))return v(g,w,S,M);if(Kf(S))return x(g,w,S,M);Nm(g,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,w!==null&&w.tag===6?(t(g,w.sibling),w=i(w,S),w.return=g,g=w):(t(g,w),w=Ox(S,g.mode,M),w.return=g,g=w),o(g)):t(g,w)}return _}var Gc=XL(!0),KL=XL(!1),Yd={},Ts=Pa(Yd),xd=Pa(Yd),_d=Pa(Yd);function pl(n){if(n===Yd)throw Error(Ae(174));return n}function Jw(n,e){switch(Xt(_d,e),Xt(xd,n),Xt(Ts,Yd),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:c_(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=c_(e,n)}en(Ts),Xt(Ts,e)}function zc(){en(Ts),en(xd),en(_d)}function YL(n){pl(_d.current);var e=pl(Ts.current),t=c_(e,n.type);e!==t&&(Xt(xd,n),Xt(Ts,t))}function Xw(n){xd.current===n&&(en(Ts),en(xd))}var cn=Pa(0);function E0(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 Rx=[];function Kw(){for(var n=0;nt?t:4,n(!0);var r=Bx.transition;Bx.transition={};try{n(!1),e()}finally{zt=t,Bx.transition=r}}function hI(){return Fi().memoizedState}function W5(n,e,t){var r=da(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},dI(n))pI(e,t);else if(t=WL(n,e,t,r),t!==null){var i=Ar();os(t,n,r,i),mI(t,e,r)}}function j5(n,e,t){var r=da(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(dI(n))pI(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,ls(a,o)){var l=e.interleaved;l===null?(i.next=i,jw(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=WL(n,e,i,r),t!==null&&(i=Ar(),os(t,n,r,i),mI(t,e,r))}}function dI(n){var e=n.alternate;return n===dn||e!==null&&e===dn}function pI(n,e){Wh=T0=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function mI(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,Bw(n,t)}}var P0={readContext:Di,useCallback:lr,useContext:lr,useEffect:lr,useImperativeHandle:lr,useInsertionEffect:lr,useLayoutEffect:lr,useMemo:lr,useReducer:lr,useRef:lr,useState:lr,useDebugValue:lr,useDeferredValue:lr,useTransition:lr,useMutableSource:lr,useSyncExternalStore:lr,useId:lr,unstable_isNewReconciler:!1},$5={readContext:Di,useCallback:function(n,e){return Ms().memoizedState=[n,e===void 0?null:e],n},useContext:Di,useEffect:KE,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Yg(4194308,4,aI.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Yg(4194308,4,n,e)},useInsertionEffect:function(n,e){return Yg(4,2,n,e)},useMemo:function(n,e){var t=Ms();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=Ms();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=W5.bind(null,dn,n),[r.memoizedState,n]},useRef:function(n){var e=Ms();return n={current:n},e.memoizedState=n},useState:XE,useDebugValue:eA,useDeferredValue:function(n){return Ms().memoizedState=n},useTransition:function(){var n=XE(!1),e=n[0];return n=V5.bind(null,n[1]),Ms().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=dn,i=Ms();if(sn){if(t===void 0)throw Error(Ae(407));t=t()}else{if(t=e(),Jn===null)throw Error(Ae(349));Bl&30||ZL(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,KE(tI.bind(null,r,s,n),[n]),r.flags|=2048,Ad(9,eI.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=Ms(),e=Jn.identifierPrefix;if(sn){var t=so,r=io;t=(r&~(1<<32-ss(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Sd++,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[Cs]=e,n[yd]=r,MI(n,e,!1,!1),e.stateNode=n;e:{switch(o=h_(t,r),t){case"dialog":Kt("cancel",n),Kt("close",n),i=r;break;case"iframe":case"object":case"embed":Kt("load",n),i=r;break;case"video":case"audio":for(i=0;iVc&&(e.flags|=128,r=!0,th(s,!1),e.lanes=4194304)}else{if(!r)if(n=E0(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),th(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!sn)return ur(e),null}else 2*wn()-s.renderingStartTime>Vc&&t!==1073741824&&(e.flags|=128,r=!0,th(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=wn(),e.sibling=null,t=cn.current,Xt(cn,r?t&1|2:t&1),e):(ur(e),null);case 22:case 23:return oA(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?qr&1073741824&&(ur(e),e.subtreeFlags&6&&(e.flags|=8192)):ur(e),null;case 24:return null;case 25:return null}throw Error(Ae(156,e.tag))}function eG(n,e){switch(Gw(e),e.tag){case 1:return Ur(e.type)&&_0(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return zc(),en(Nr),en(dr),Kw(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return Xw(e),null;case 13:if(en(cn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Ae(340));Uc()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return en(cn),null;case 4:return zc(),null;case 10:return Ww(e.type._context),null;case 22:case 23:return oA(),null;case 24:return null;default:return null}}var Gm=!1,hr=!1,tG=typeof WeakSet=="function"?WeakSet:Set,Oe=null;function vc(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){vn(n,e,r)}else t.current=null}function U_(n,e,t){try{t()}catch(r){vn(n,e,r)}}var iT=!1;function nG(n,e){if(w_=g0,n=RL(),Nw(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,u=0,h=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&&++u===i&&(a=o),p===s&&++h===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(A_={focusedElem:n,selectionRange:t},g0=!1,Oe=e;Oe!==null;)if(e=Oe,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Oe=n;else for(;Oe!==null;){e=Oe;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var x=v.memoizedProps,_=v.memoizedState,g=e.stateNode,w=g.getSnapshotBeforeUpdate(e.elementType===e.type?x:Zi(e.type,x),_);g.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ae(163))}}catch(M){vn(e,e.return,M)}if(n=e.sibling,n!==null){n.return=e.return,Oe=n;break}Oe=e.return}return v=iT,iT=!1,v}function jh(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&&U_(e,t,s)}i=i.next}while(i!==r)}}function hv(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 G_(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 EI(n){var e=n.alternate;e!==null&&(n.alternate=null,EI(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Cs],delete e[yd],delete e[C_],delete e[N5],delete e[U5])),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 TI(n){return n.tag===5||n.tag===3||n.tag===4}function sT(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||TI(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 z_(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=x0));else if(r!==4&&(n=n.child,n!==null))for(z_(n,e,t),n=n.sibling;n!==null;)z_(n,e,t),n=n.sibling}function H_(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(H_(n,e,t),n=n.sibling;n!==null;)H_(n,e,t),n=n.sibling}var qn=null,es=!1;function zo(n,e,t){for(t=t.child;t!==null;)PI(n,e,t),t=t.sibling}function PI(n,e,t){if(Es&&typeof Es.onCommitFiberUnmount=="function")try{Es.onCommitFiberUnmount(iv,t)}catch{}switch(t.tag){case 5:hr||vc(t,e);case 6:var r=qn,i=es;qn=null,zo(n,e,t),qn=r,es=i,qn!==null&&(es?(n=qn,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):qn.removeChild(t.stateNode));break;case 18:qn!==null&&(es?(n=qn,t=t.stateNode,n.nodeType===8?Tx(n.parentNode,t):n.nodeType===1&&Tx(n,t),dd(n)):Tx(qn,t.stateNode));break;case 4:r=qn,i=es,qn=t.stateNode.containerInfo,es=!0,zo(n,e,t),qn=r,es=i;break;case 0:case 11:case 14:case 15:if(!hr&&(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)&&U_(t,e,o),i=i.next}while(i!==r)}zo(n,e,t);break;case 1:if(!hr&&(vc(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){vn(t,e,a)}zo(n,e,t);break;case 21:zo(n,e,t);break;case 22:t.mode&1?(hr=(r=hr)||t.memoizedState!==null,zo(n,e,t),hr=r):zo(n,e,t);break;default:zo(n,e,t)}}function oT(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new tG),e.forEach(function(r){var i=fG.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Ji(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=wn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*iG(r/1960))-r,10n?16:n,ia===null)var r=!1;else{if(n=ia,ia=null,L0=0,It&6)throw Error(Ae(331));var i=It;for(It|=4,Oe=n.current;Oe!==null;){var s=Oe,o=s.child;if(Oe.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lwn()-iA?Sl(n,0):rA|=t),Gr(n,e)}function kI(n,e){e===0&&(n.mode&1?(e=Bm,Bm<<=1,!(Bm&130023424)&&(Bm=4194304)):e=1);var t=Ar();n=vo(n,e),n!==null&&(Jd(n,e,t),Gr(n,t))}function cG(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),kI(n,t)}function fG(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(Ae(314))}r!==null&&r.delete(e),kI(n,t)}var NI;NI=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Nr.current)kr=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return kr=!1,q5(n,e,t);kr=!!(n.flags&131072)}else kr=!1,sn&&e.flags&1048576&&zL(e,A0,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Qg(n,e),n=e.pendingProps;var i=Nc(e,dr.current);Pc(e,t),i=Qw(null,e,r,n,i,t);var s=qw();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,Ur(r)?(s=!0,S0(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,$w(e),i.updater=cv,e.stateNode=i,i._reactInternals=e,L_(e,r,n,t),e=F_(null,e,r,!0,s,t)):(e.tag=0,sn&&s&&Uw(e),Sr(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(Qg(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=dG(r),n=Zi(r,n),i){case 0:e=D_(null,e,r,n,t);break e;case 1:e=tT(null,e,r,n,t);break e;case 11:e=ZE(null,e,r,n,t);break e;case 14:e=eT(null,e,r,Zi(r.type,n),t);break e}throw Error(Ae(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Zi(r,i),D_(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Zi(r,i),tT(n,e,r,i,t);case 3:e:{if(SI(e),n===null)throw Error(Ae(387));r=e.pendingProps,s=e.memoizedState,i=s.element,jL(n,e),C0(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=Hc(Error(Ae(423)),e),e=nT(n,e,r,t,i);break e}else if(r!==i){i=Hc(Error(Ae(424)),e),e=nT(n,e,r,t,i);break e}else for(Zr=ca(e.stateNode.containerInfo.firstChild),si=e,sn=!0,ns=null,t=KL(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(Uc(),r===i){e=yo(n,e,t);break e}Sr(n,e,r,t)}e=e.child}return e;case 5:return YL(e),n===null&&P_(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,M_(r,i)?o=null:s!==null&&M_(r,s)&&(e.flags|=32),_I(n,e),Sr(n,e,o,t),e.child;case 6:return n===null&&P_(e),null;case 13:return wI(n,e,t);case 4:return Jw(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=Gc(e,null,r,t):Sr(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Zi(r,i),ZE(n,e,r,i,t);case 7:return Sr(n,e,e.pendingProps,t),e.child;case 8:return Sr(n,e,e.pendingProps.children,t),e.child;case 12:return Sr(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,Xt(M0,r._currentValue),r._currentValue=o,s!==null)if(ls(s.value,o)){if(s.children===i.children&&!Nr.current){e=yo(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=uo(-1,t&-t),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?l.next=l:(l.next=h.next,h.next=l),u.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),R_(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(Ae(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),R_(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}Sr(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Pc(e,t),i=Di(i),r=r(i),e.flags|=1,Sr(n,e,r,t),e.child;case 14:return r=e.type,i=Zi(r,e.pendingProps),i=Zi(r.type,i),eT(n,e,r,i,t);case 15:return yI(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Zi(r,i),Qg(n,e),e.tag=1,Ur(r)?(n=!0,S0(e)):n=!1,Pc(e,t),JL(e,r,i),L_(e,r,i,t),F_(null,e,r,!0,n,t);case 19:return AI(n,e,t);case 22:return xI(n,e,t)}throw Error(Ae(156,e.tag))};function UI(n,e){return fL(n,e)}function hG(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 Bi(n,e,t,r){return new hG(n,e,t,r)}function lA(n){return n=n.prototype,!(!n||!n.isReactComponent)}function dG(n){if(typeof n=="function")return lA(n)?1:0;if(n!=null){if(n=n.$$typeof,n===Ew)return 11;if(n===Tw)return 14}return 2}function pa(n,e){var t=n.alternate;return t===null?(t=Bi(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 e0(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")lA(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case lc:return wl(t.children,i,s,e);case Cw:o=8,i|=8;break;case n_:return n=Bi(12,t,e,i|2),n.elementType=n_,n.lanes=s,n;case r_:return n=Bi(13,t,e,i),n.elementType=r_,n.lanes=s,n;case i_:return n=Bi(19,t,e,i),n.elementType=i_,n.lanes=s,n;case XB:return pv(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case $B:o=10;break e;case JB:o=9;break e;case Ew:o=11;break e;case Tw:o=14;break e;case Ko:o=16,r=null;break e}throw Error(Ae(130,n==null?n:typeof n,""))}return e=Bi(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function wl(n,e,t,r){return n=Bi(7,n,r,e),n.lanes=t,n}function pv(n,e,t,r){return n=Bi(22,n,r,e),n.elementType=XB,n.lanes=t,n.stateNode={isHidden:!1},n}function Ox(n,e,t){return n=Bi(6,n,null,e),n.lanes=t,n}function kx(n,e,t){return e=Bi(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function pG(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=vx(0),this.expirationTimes=vx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vx(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function uA(n,e,t,r,i,s,o,a,l){return n=new pG(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Bi(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},$w(s),n}function mG(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=hi})(g4);var pT=Z1;q1.createRoot=pT.createRoot,q1.hydrateRoot=pT.hydrateRoot;/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT */const xv="151",_G={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},SG={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},VI=0,J_=1,WI=2,wG=3,jI=0,_v=1,Xh=2,ml=3,Is=0,Mr=1,Pi=2,AG=2,co=0,Al=1,X_=2,K_=3,Y_=4,$I=5,cl=100,JI=101,XI=102,Q_=103,q_=104,KI=200,YI=201,QI=202,qI=203,dA=204,pA=205,ZI=206,eD=207,tD=208,nD=209,rD=210,iD=0,sD=1,oD=2,F0=3,aD=4,lD=5,uD=6,cD=7,Qd=0,fD=1,hD=2,as=0,dD=1,pD=2,mD=3,mA=4,gD=5,Sv=300,xo=301,_a=302,Wc=303,bd=304,uf=306,Sa=1e3,er=1001,jc=1002,yn=1003,Cd=1004,MG=1004,Bc=1005,bG=1005,Zt=1006,wv=1007,CG=1007,Ds=1008,EG=1008,_o=1009,vD=1010,yD=1011,gA=1012,xD=1013,sa=1014,ei=1015,Li=1016,_D=1017,SD=1018,Ml=1020,wD=1021,Or=1023,AD=1024,MD=1025,ma=1026,Dl=1027,bD=1028,CD=1029,ED=1030,TD=1031,PD=1033,t0=33776,n0=33777,r0=33778,i0=33779,Z_=35840,eS=35841,tS=35842,nS=35843,RD=36196,rS=37492,iS=37496,sS=37808,oS=37809,aS=37810,lS=37811,uS=37812,cS=37813,fS=37814,hS=37815,dS=37816,pS=37817,mS=37818,gS=37819,vS=37820,yS=37821,s0=36492,BD=36283,xS=36284,_S=36285,SS=36286,LD=2200,ID=2201,DD=2202,$c=2300,Fl=2301,o0=2302,gl=2400,vl=2401,Ed=2402,Av=2500,vA=2501,TG=0,FD=1,yA=2,us=3e3,Ct=3001,OD=3200,kD=3201,Mo=0,ND=1,PG="",ts="srgb",Jc="srgb-linear",xA="display-p3",RG=0,a0=7680,BG=7681,LG=7682,IG=7683,DG=34055,FG=34056,OG=5386,kG=512,NG=513,UG=514,GG=515,zG=516,HG=517,VG=518,UD=519,Td=35044,WG=35048,jG=35040,$G=35045,JG=35049,XG=35041,KG=35046,YG=35050,QG=35042,qG="100",wS="300 es",O0=1035;class bo{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s>8&255]+cr[n>>16&255]+cr[n>>24&255]+"-"+cr[e&255]+cr[e>>8&255]+"-"+cr[e>>16&15|64]+cr[e>>24&255]+"-"+cr[t&63|128]+cr[t>>8&255]+"-"+cr[t>>16&255]+cr[t>>24&255]+cr[r&255]+cr[r>>8&255]+cr[r>>16&255]+cr[r>>24&255]).toLowerCase()}function xn(n,e,t){return Math.max(e,Math.min(t,n))}function _A(n,e){return(n%e+e)%e}function ZG(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function ez(n,e,t){return n!==e?(t-n)/(e-n):0}function Kh(n,e,t){return(1-t)*n+t*e}function tz(n,e,t,r){return Kh(n,e,1-Math.exp(-t*r))}function nz(n,e=1){return e-Math.abs(_A(n,e*2)-e)}function rz(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function iz(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function sz(n,e){return n+Math.floor(Math.random()*(e-n+1))}function oz(n,e){return n+Math.random()*(e-n)}function az(n){return n*(.5-Math.random())}function lz(n){n!==void 0&&(mT=n);let e=mT+=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 uz(n){return n*bl}function cz(n){return n*Xc}function AS(n){return(n&n-1)===0&&n!==0}function GD(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function zD(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function fz(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),u=s((e+r)/2),h=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*h,l*d,l*p,a*u);break;case"YZY":n.set(l*p,a*h,l*d,a*u);break;case"ZXZ":n.set(l*d,l*p,a*h,a*u);break;case"XZX":n.set(a*h,l*v,l*m,a*u);break;case"YXY":n.set(l*m,a*h,l*v,a*u);break;case"ZYZ":n.set(l*v,l*m,a*h,a*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ti(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function vt(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Lc={DEG2RAD:bl,RAD2DEG:Xc,generateUUID:oi,clamp:xn,euclideanModulo:_A,mapLinear:ZG,inverseLerp:ez,lerp:Kh,damp:tz,pingpong:nz,smoothstep:rz,smootherstep:iz,randInt:sz,randFloat:oz,randFloatSpread:az,seededRandom:lz,degToRad:uz,radToDeg:cz,isPowerOfTwo:AS,ceilPowerOfTwo:GD,floorPowerOfTwo:zD,setQuaternionFromProperEuler:fz,normalize:vt,denormalize:ti};class me{constructor(e=0,t=0){me.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(xn(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 At{constructor(){At.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,r,i,s,o,a,l,u){const h=this.elements;return h[0]=e,h[1]=i,h[2]=a,h[3]=t,h[4]=s,h[5]=l,h[6]=r,h[7]=o,h[8]=u,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],u=r[1],h=r[4],d=r[7],p=r[2],m=r[5],v=r[8],x=i[0],_=i[3],g=i[6],w=i[1],S=i[4],M=i[7],C=i[2],P=i[5],L=i[8];return s[0]=o*x+a*w+l*C,s[3]=o*_+a*S+l*P,s[6]=o*g+a*M+l*L,s[1]=u*x+h*w+d*C,s[4]=u*_+h*S+d*P,s[7]=u*g+h*M+d*L,s[2]=p*x+m*w+v*C,s[5]=p*_+m*S+v*P,s[8]=p*g+m*M+v*L,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],u=e[7],h=e[8];return t*o*h-t*a*u-r*s*h+r*a*l+i*s*u-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],u=e[7],h=e[8],d=h*o-a*u,p=a*l-h*s,m=u*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*u-h*r)*x,e[2]=(a*r-i*o)*x,e[3]=p*x,e[4]=(h*t-i*l)*x,e[5]=(i*s-a*t)*x,e[6]=m*x,e[7]=(r*l-u*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),u=Math.sin(s);return this.set(r*l,r*u,-r*(l*o+u*a)+o+e,-i*u,i*l,-i*(-u*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Nx.makeScale(e,t)),this}rotate(e){return this.premultiply(Nx.makeRotation(-e)),this}translate(e,t){return this.premultiply(Nx.makeTranslation(e,t)),this}makeTranslation(e,t){return 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 Nx=new At;function HD(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const hz={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function xc(n,e){return new hz[n](e)}function Pd(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Ic(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Ux(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const dz=new At().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),pz=new At().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function mz(n){return n.convertSRGBToLinear().applyMatrix3(pz)}function gz(n){return n.applyMatrix3(dz).convertLinearToSRGB()}const vz={[Jc]:n=>n,[ts]:n=>n.convertSRGBToLinear(),[xA]:mz},yz={[Jc]:n=>n,[ts]:n=>n.convertLinearToSRGB(),[xA]:gz},Lr={enabled:!1,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 Jc},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=vz[e],i=yz[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 gu;class SA{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{gu===void 0&&(gu=Pd("canvas")),gu.width=e.width,gu.height=e.height;const r=gu.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=gu}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=Pd("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!==Sv)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Sa:e.x=e.x-Math.floor(e.x);break;case er:e.x=e.x<0?0:1;break;case jc: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 Sa:e.y=e.y-Math.floor(e.y);break;case er:e.y=e.y<0?0:1;break;case jc: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)}}an.DEFAULT_IMAGE=null;an.DEFAULT_MAPPING=Sv;an.DEFAULT_ANISOTROPY=1;class Lt{constructor(e=0,t=0,r=0,i=1){Lt.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,u=l[0],h=l[4],d=l[8],p=l[1],m=l[5],v=l[9],x=l[2],_=l[6],g=l[10];if(Math.abs(h-p)<.01&&Math.abs(d-x)<.01&&Math.abs(v-_)<.01){if(Math.abs(h+p)<.1&&Math.abs(d+x)<.1&&Math.abs(v+_)<.1&&Math.abs(u+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const S=(u+1)/2,M=(m+1)/2,C=(g+1)/2,P=(h+p)/4,L=(d+x)/4,B=(v+_)/4;return S>M&&S>C?S<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(S),i=P/r,s=L/r):M>C?M<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(M),r=P/i,s=B/i):C<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(C),r=L/s,i=B/s),this.set(r,i,s,t),this}let w=Math.sqrt((_-v)*(_-v)+(d-x)*(d-x)+(p-h)*(p-h));return Math.abs(w)<.001&&(w=1),this.x=(_-v)/w,this.y=(d-x)/w,this.z=(p-h)/w,this.w=Math.acos((u+m+g-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const 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 li extends bo{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Lt(0,0,e,t),this.scissorTest=!1,this.viewport=new Lt(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new an(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),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:Zt,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.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 yl(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 Mv extends an{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=er,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class _z extends li{constructor(e=1,t=1,r=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new Mv(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class wA extends an{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=er,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Sz extends li{constructor(e=1,t=1,r=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new wA(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class wz extends li{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,S=1-g*g;if(S>Number.EPSILON){const C=Math.sqrt(S),P=Math.atan2(C,g*w);_=Math.sin(_*P)/C,a=Math.sin(a*P)/C}const M=a*w;if(l=l*_+p*M,u=u*_+m*M,h=h*_+v*M,d=d*_+x*M,_===1-a){const C=1/Math.sqrt(l*l+u*u+h*h+d*d);l*=C,u*=C,h*=C,d*=C}}e[t]=l,e[t+1]=u,e[t+2]=h,e[t+3]=d}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],u=r[i+2],h=r[i+3],d=s[o],p=s[o+1],m=s[o+2],v=s[o+3];return e[t]=a*v+h*d+l*m-u*p,e[t+1]=l*v+h*p+u*d-a*m,e[t+2]=u*v+h*m+a*p-l*d,e[t+3]=h*v-a*d-l*p-u*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,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,u=a(r/2),h=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*h*d+u*m*v,this._y=u*m*d-p*h*v,this._z=u*h*v+p*m*d,this._w=u*h*d-p*m*v;break;case"YXZ":this._x=p*h*d+u*m*v,this._y=u*m*d-p*h*v,this._z=u*h*v-p*m*d,this._w=u*h*d+p*m*v;break;case"ZXY":this._x=p*h*d-u*m*v,this._y=u*m*d+p*h*v,this._z=u*h*v+p*m*d,this._w=u*h*d-p*m*v;break;case"ZYX":this._x=p*h*d-u*m*v,this._y=u*m*d+p*h*v,this._z=u*h*v-p*m*d,this._w=u*h*d+p*m*v;break;case"YZX":this._x=p*h*d+u*m*v,this._y=u*m*d+p*h*v,this._z=u*h*v-p*m*d,this._w=u*h*d-p*m*v;break;case"XZY":this._x=p*h*d-u*m*v,this._y=u*m*d-p*h*v,this._z=u*h*v+p*m*d,this._w=u*h*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],u=t[2],h=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=(h-l)*m,this._y=(s-u)*m,this._z=(o-i)*m}else if(r>a&&r>d){const m=2*Math.sqrt(1+r-a-d);this._w=(h-l)/m,this._x=.25*m,this._y=(i+o)/m,this._z=(s+u)/m}else if(a>d){const m=2*Math.sqrt(1+a-r-d);this._w=(s-u)/m,this._x=(i+o)/m,this._y=.25*m,this._z=(l+h)/m}else{const m=2*Math.sqrt(1+d-r-a);this._w=(o-i)/m,this._x=(s+u)/m,this._y=(l+h)/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(xn(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,u=t._z,h=t._w;return this._x=r*h+o*a+i*u-s*l,this._y=i*h+o*l+s*a-r*u,this._z=s*h+o*u+r*l-i*a,this._w=o*h-r*a-i*l-s*u,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 u=Math.sqrt(l),h=Math.atan2(u,a),d=Math.sin((1-t)*h)/u,p=Math.sin(t*h)/u;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 F{constructor(e=0,t=0,r=0){F.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(gT.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(gT.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,u=l*t+o*i-a*r,h=l*r+a*t-s*i,d=l*i+s*r-o*t,p=-s*t-o*r-a*i;return this.x=u*l+p*-s+h*-a-d*-o,this.y=h*l+p*-o+d*-s-u*-a,this.z=d*l+p*-a+u*-o-h*-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 zx.copy(this).projectOnVector(e),this.sub(zx)}reflect(e){return this.sub(zx.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(xn(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 zx=new F,gT=new Xn;class Ni{constructor(e=new F(1/0,1/0,1/0),t=new F(-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,Ws),Ws.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(rh),Vm.subVectors(this.max,rh),yu.subVectors(e.a,rh),xu.subVectors(e.b,rh),_u.subVectors(e.c,rh),Ho.subVectors(xu,yu),Vo.subVectors(_u,xu),$a.subVectors(yu,_u);let t=[0,-Ho.z,Ho.y,0,-Vo.z,Vo.y,0,-$a.z,$a.y,Ho.z,0,-Ho.x,Vo.z,0,-Vo.x,$a.z,0,-$a.x,-Ho.y,Ho.x,0,-Vo.y,Vo.x,0,-$a.y,$a.x,0];return!Hx(t,yu,xu,_u,Vm)||(t=[1,0,0,0,1,0,0,0,1],!Hx(t,yu,xu,_u,Vm))?!1:(Wm.crossVectors(Ho,Vo),t=[Wm.x,Wm.y,Wm.z],Hx(t,yu,xu,_u,Vm))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ws).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ws).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:(Vs[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Vs[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Vs[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Vs[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Vs[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Vs[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Vs[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Vs[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Vs),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 Vs=[new F,new F,new F,new F,new F,new F,new F,new F],Ws=new F,vu=new Ni,yu=new F,xu=new F,_u=new F,Ho=new F,Vo=new F,$a=new F,rh=new F,Vm=new F,Wm=new F,Ja=new F;function Hx(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){Ja.fromArray(n,s);const a=i.x*Math.abs(Ja.x)+i.y*Math.abs(Ja.y)+i.z*Math.abs(Ja.z),l=e.dot(Ja),u=t.dot(Ja),h=r.dot(Ja);if(Math.max(-Math.max(l,u,h),Math.min(l,u,h))>a)return!1}return!0}const Az=new Ni,ih=new F,Vx=new F;class Ui{constructor(e=new F,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):Az.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;ih.subVectors(e,this.center);const t=ih.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(ih,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):(Vx.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ih.copy(e.center).add(Vx)),this.expandByPoint(ih.copy(e.center).sub(Vx))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const js=new F,Wx=new F,jm=new F,Wo=new F,jx=new F,$m=new F,$x=new F;class qd{constructor(e=new F,t=new F(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,js)),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=js.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(js.copy(this.origin).addScaledVector(this.direction,t),js.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){Wx.copy(e).add(t).multiplyScalar(.5),jm.copy(t).sub(e).normalize(),Wo.copy(this.origin).sub(Wx);const s=e.distanceTo(t)*.5,o=-this.direction.dot(jm),a=Wo.dot(this.direction),l=-Wo.dot(jm),u=Wo.lengthSq(),h=Math.abs(1-o*o);let d,p,m,v;if(h>0)if(d=o*l-a,p=o*a-l,v=s*h,d>=0)if(p>=-v)if(p<=v){const x=1/h;d*=x,p*=x,m=d*(d+o*p+2*a)+p*(o*d+p+2*l)+u}else p=s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+u;else p=-s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+u;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)+u):p<=v?(d=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+u):(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)+u);else p=o>0?-s:s,d=Math.max(0,-(o*p+a)),m=-d*d+p*(p+2*l)+u;return r&&r.copy(this.origin).addScaledVector(this.direction,d),i&&i.copy(Wx).addScaledVector(jm,p),m}intersectSphere(e,t){js.subVectors(e.center,this.origin);const r=js.dot(this.direction),i=js.dot(js)-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 u=1/this.direction.x,h=1/this.direction.y,d=1/this.direction.z,p=this.origin;return u>=0?(r=(e.min.x-p.x)*u,i=(e.max.x-p.x)*u):(r=(e.max.x-p.x)*u,i=(e.min.x-p.x)*u),h>=0?(s=(e.min.y-p.y)*h,o=(e.max.y-p.y)*h):(s=(e.max.y-p.y)*h,o=(e.min.y-p.y)*h),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,js)!==null}intersectTriangle(e,t,r,i,s){jx.subVectors(t,e),$m.subVectors(r,e),$x.crossVectors(jx,$m);let o=this.direction.dot($x),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Wo.subVectors(this.origin,e);const l=a*this.direction.dot($m.crossVectors(Wo,$m));if(l<0)return null;const u=a*this.direction.dot(jx.cross(Wo));if(u<0||l+u>o)return null;const h=-a*Wo.dot($x);return h<0?null:this.at(h/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 ot{constructor(){ot.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,r,i,s,o,a,l,u,h,d,p,m,v,x,_){const g=this.elements;return g[0]=e,g[4]=t,g[8]=r,g[12]=i,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=u,g[6]=h,g[10]=d,g[14]=p,g[3]=m,g[7]=v,g[11]=x,g[15]=_,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ot().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/Su.setFromMatrixColumn(e,0).length(),s=1/Su.setFromMatrixColumn(e,1).length(),o=1/Su.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),u=Math.sin(i),h=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const p=o*h,m=o*d,v=a*h,x=a*d;t[0]=l*h,t[4]=-l*d,t[8]=u,t[1]=m+v*u,t[5]=p-x*u,t[9]=-a*l,t[2]=x-p*u,t[6]=v+m*u,t[10]=o*l}else if(e.order==="YXZ"){const p=l*h,m=l*d,v=u*h,x=u*d;t[0]=p+x*a,t[4]=v*a-m,t[8]=o*u,t[1]=o*d,t[5]=o*h,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*h,m=l*d,v=u*h,x=u*d;t[0]=p-x*a,t[4]=-o*d,t[8]=v+m*a,t[1]=m+v*a,t[5]=o*h,t[9]=x-p*a,t[2]=-o*u,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*h,m=o*d,v=a*h,x=a*d;t[0]=l*h,t[4]=v*u-m,t[8]=p*u+x,t[1]=l*d,t[5]=x*u+p,t[9]=m*u-v,t[2]=-u,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*u,v=a*l,x=a*u;t[0]=l*h,t[4]=x-p*d,t[8]=v*d+m,t[1]=d,t[5]=o*h,t[9]=-a*h,t[2]=-u*h,t[6]=m*d+v,t[10]=p-x*d}else if(e.order==="XZY"){const p=o*l,m=o*u,v=a*l,x=a*u;t[0]=l*h,t[4]=-d,t[8]=u*h,t[1]=p*d+x,t[5]=o*h,t[9]=m*d-v,t[2]=v*d-m,t[6]=a*h,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(Mz,e,bz)}lookAt(e,t,r){const i=this.elements;return Kr.subVectors(e,t),Kr.lengthSq()===0&&(Kr.z=1),Kr.normalize(),jo.crossVectors(r,Kr),jo.lengthSq()===0&&(Math.abs(r.z)===1?Kr.x+=1e-4:Kr.z+=1e-4,Kr.normalize(),jo.crossVectors(r,Kr)),jo.normalize(),Jm.crossVectors(Kr,jo),i[0]=jo.x,i[4]=Jm.x,i[8]=Kr.x,i[1]=jo.y,i[5]=Jm.y,i[9]=Kr.y,i[2]=jo.z,i[6]=Jm.z,i[10]=Kr.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],u=r[12],h=r[1],d=r[5],p=r[9],m=r[13],v=r[2],x=r[6],_=r[10],g=r[14],w=r[3],S=r[7],M=r[11],C=r[15],P=i[0],L=i[4],B=i[8],E=i[12],R=i[1],I=i[5],V=i[9],H=i[13],W=i[2],J=i[6],re=i[10],ue=i[14],U=i[3],$=i[7],j=i[11],se=i[15];return s[0]=o*P+a*R+l*W+u*U,s[4]=o*L+a*I+l*J+u*$,s[8]=o*B+a*V+l*re+u*j,s[12]=o*E+a*H+l*ue+u*se,s[1]=h*P+d*R+p*W+m*U,s[5]=h*L+d*I+p*J+m*$,s[9]=h*B+d*V+p*re+m*j,s[13]=h*E+d*H+p*ue+m*se,s[2]=v*P+x*R+_*W+g*U,s[6]=v*L+x*I+_*J+g*$,s[10]=v*B+x*V+_*re+g*j,s[14]=v*E+x*H+_*ue+g*se,s[3]=w*P+S*R+M*W+C*U,s[7]=w*L+S*I+M*J+C*$,s[11]=w*B+S*V+M*re+C*j,s[15]=w*E+S*H+M*ue+C*se,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],u=e[13],h=e[2],d=e[6],p=e[10],m=e[14],v=e[3],x=e[7],_=e[11],g=e[15];return v*(+s*l*d-i*u*d-s*a*p+r*u*p+i*a*m-r*l*m)+x*(+t*l*m-t*u*p+s*o*p-i*o*m+i*u*h-s*l*h)+_*(+t*u*d-t*a*m-s*o*d+r*o*m+s*a*h-r*u*h)+g*(-i*a*h-t*l*d+t*a*p+i*o*d-r*o*p+r*l*h)}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],u=e[7],h=e[8],d=e[9],p=e[10],m=e[11],v=e[12],x=e[13],_=e[14],g=e[15],w=d*_*u-x*p*u+x*l*m-a*_*m-d*l*g+a*p*g,S=v*p*u-h*_*u-v*l*m+o*_*m+h*l*g-o*p*g,M=h*x*u-v*d*u+v*a*m-o*x*m-h*a*g+o*d*g,C=v*d*l-h*x*l-v*a*p+o*x*p+h*a*_-o*d*_,P=t*w+r*S+i*M+s*C;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const L=1/P;return e[0]=w*L,e[1]=(x*p*s-d*_*s-x*i*m+r*_*m+d*i*g-r*p*g)*L,e[2]=(a*_*s-x*l*s+x*i*u-r*_*u-a*i*g+r*l*g)*L,e[3]=(d*l*s-a*p*s-d*i*u+r*p*u+a*i*m-r*l*m)*L,e[4]=S*L,e[5]=(h*_*s-v*p*s+v*i*m-t*_*m-h*i*g+t*p*g)*L,e[6]=(v*l*s-o*_*s-v*i*u+t*_*u+o*i*g-t*l*g)*L,e[7]=(o*p*s-h*l*s+h*i*u-t*p*u-o*i*m+t*l*m)*L,e[8]=M*L,e[9]=(v*d*s-h*x*s-v*r*m+t*x*m+h*r*g-t*d*g)*L,e[10]=(o*x*s-v*a*s+v*r*u-t*x*u-o*r*g+t*a*g)*L,e[11]=(h*a*s-o*d*s-h*r*u+t*d*u+o*r*m-t*a*m)*L,e[12]=C*L,e[13]=(h*x*i-v*d*i+v*r*p-t*x*p-h*r*_+t*d*_)*L,e[14]=(v*a*i-o*x*i-v*r*l+t*x*l+o*r*_-t*a*_)*L,e[15]=(o*d*i-h*a*i+h*r*l-t*d*l-o*r*p+t*a*p)*L,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 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,u=s*o,h=s*a;return this.set(u*o+r,u*a-i*l,u*l+i*a,0,u*a+i*l,h*a+r,h*l-i*o,0,u*l-i*a,h*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,u=s+s,h=o+o,d=a+a,p=s*u,m=s*h,v=s*d,x=o*h,_=o*d,g=a*d,w=l*u,S=l*h,M=l*d,C=r.x,P=r.y,L=r.z;return i[0]=(1-(x+g))*C,i[1]=(m+M)*C,i[2]=(v-S)*C,i[3]=0,i[4]=(m-M)*P,i[5]=(1-(p+g))*P,i[6]=(_+w)*P,i[7]=0,i[8]=(v+S)*L,i[9]=(_-w)*L,i[10]=(1-(p+x))*L,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=Su.set(i[0],i[1],i[2]).length();const o=Su.set(i[4],i[5],i[6]).length(),a=Su.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],Xi.copy(this);const u=1/s,h=1/o,d=1/a;return Xi.elements[0]*=u,Xi.elements[1]*=u,Xi.elements[2]*=u,Xi.elements[4]*=h,Xi.elements[5]*=h,Xi.elements[6]*=h,Xi.elements[8]*=d,Xi.elements[9]*=d,Xi.elements[10]*=d,t.setFromRotationMatrix(Xi),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o){const a=this.elements,l=2*s/(t-e),u=2*s/(r-i),h=(t+e)/(t-e),d=(r+i)/(r-i),p=-(o+s)/(o-s),m=-2*o*s/(o-s);return a[0]=l,a[4]=0,a[8]=h,a[12]=0,a[1]=0,a[5]=u,a[9]=d,a[13]=0,a[2]=0,a[6]=0,a[10]=p,a[14]=m,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,r,i,s,o){const a=this.elements,l=1/(t-e),u=1/(r-i),h=1/(o-s),d=(t+e)*l,p=(r+i)*u,m=(o+s)*h;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-d,a[1]=0,a[5]=2*u,a[9]=0,a[13]=-p,a[2]=0,a[6]=0,a[10]=-2*h,a[14]=-m,a[3]=0,a[7]=0,a[11]=0,a[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 Su=new F,Xi=new ot,Mz=new F(0,0,0),bz=new F(1,1,1),jo=new F,Jm=new F,Kr=new F,vT=new ot,yT=new Xn;class Ba{constructor(e=0,t=0,r=0,i=Ba.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],u=i[5],h=i[9],d=i[2],p=i[6],m=i[10];switch(t){case"XYZ":this._y=Math.asin(xn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-h,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,u),this._z=0);break;case"YXZ":this._x=Math.asin(-xn(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(xn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-d,m),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-xn(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,u));break;case"YZX":this._z=Math.asin(xn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-h,u),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-xn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,u),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-h,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 vT.makeRotationFromQuaternion(e),this.setFromRotationMatrix(vT,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return yT.setFromEuler(this),this.setFromQuaternion(yT,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}}Ba.DEFAULT_ORDER="XYZ";class Cl{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(sh,e,Ez),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sh,Tz,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 u=0,h=l.length;u0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),u.length>0&&(r.textures=u),h.length>0&&(r.images=h),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 u in a){const h=a[u];delete h.metadata,l.push(h)}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.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){Ki.subVectors(i,t),Js.subVectors(r,t),Jx.subVectors(e,t);const o=Ki.dot(Ki),a=Ki.dot(Js),l=Ki.dot(Jx),u=Js.dot(Js),h=Js.dot(Jx),d=o*u-a*a;if(d===0)return s.set(-2,-1,-1);const p=1/d,m=(u*l-a*h)*p,v=(o*h-a*l)*p;return s.set(1-m-v,v,m)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,Xs),Xs.x>=0&&Xs.y>=0&&Xs.x+Xs.y<=1}static getUV(e,t,r,i,s,o,a,l){return Km===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Km=!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,Xs),l.setScalar(0),l.addScaledVector(s,Xs.x),l.addScaledVector(o,Xs.y),l.addScaledVector(a,Xs.z),l}static isFrontFacing(e,t,r,i){return Ki.subVectors(r,t),Js.subVectors(e,t),Ki.cross(Js).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 Ki.subVectors(this.c,this.b),Js.subVectors(this.a,this.b),Ki.cross(Js).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Fr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Fr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,s){return Km===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Km=!0),Fr.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}getInterpolation(e,t,r,i,s){return Fr.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Fr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Fr.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;Au.subVectors(i,r),Mu.subVectors(s,r),Xx.subVectors(e,r);const l=Au.dot(Xx),u=Mu.dot(Xx);if(l<=0&&u<=0)return t.copy(r);Kx.subVectors(e,i);const h=Au.dot(Kx),d=Mu.dot(Kx);if(h>=0&&d<=h)return t.copy(i);const p=l*d-h*u;if(p<=0&&l>=0&&h<=0)return o=l/(l-h),t.copy(r).addScaledVector(Au,o);Yx.subVectors(e,s);const m=Au.dot(Yx),v=Mu.dot(Yx);if(v>=0&&m<=v)return t.copy(s);const x=m*u-l*v;if(x<=0&&u>=0&&v<=0)return a=u/(u-v),t.copy(r).addScaledVector(Mu,a);const _=h*v-m*d;if(_<=0&&d-h>=0&&m-v>=0)return MT.subVectors(s,i),a=(d-h)/(d-h+(m-v)),t.copy(i).addScaledVector(MT,a);const g=1/(_+x+p);return o=x*g,a=p*g,t.copy(r).addScaledVector(Au,o).addScaledVector(Mu,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let Rz=0,Bn=class extends bo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Rz++}),this.uuid=oi(),this.name="",this.type="Material",this.blending=Al,this.side=Is,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=dA,this.blendDst=pA,this.blendEquation=cl,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=F0,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=UD,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=a0,this.stencilZFail=a0,this.stencilZPass=a0,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.5,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.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!==Al&&(r.blending=this.blending),this.side!==Is&&(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 VD={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},Yi={h:0,s:0,l:0},Ym={h:0,s:0,l:0};function Qx(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}class Ce{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&r===void 0?this.set(e):this.setRGB(e,t,r)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=ts){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Lr.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=Lr.workingColorSpace){return this.r=e,this.g=t,this.b=r,Lr.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=Lr.workingColorSpace){if(e=_A(e,1),t=xn(t,0,1),r=xn(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=Qx(o,s,e+1/3),this.g=Qx(o,s,e),this.b=Qx(o,s,e-1/3)}return Lr.toWorkingColorSpace(this,i),this}setStyle(e,t=ts){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 this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,Lr.toWorkingColorSpace(this,t),r(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,Lr.toWorkingColorSpace(this,t),r(s[4]),this;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)){const l=parseFloat(s[1])/360,u=parseFloat(s[2])/100,h=parseFloat(s[3])/100;return r(s[4]),this.setHSL(l,u,h,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=ts){const r=VD[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=Ic(e.r),this.g=Ic(e.g),this.b=Ic(e.b),this}copyLinearToSRGB(e){return this.r=Ux(e.r),this.g=Ux(e.g),this.b=Ux(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ts){return Lr.fromWorkingColorSpace(fr.copy(this),e),xn(fr.r*255,0,255)<<16^xn(fr.g*255,0,255)<<8^xn(fr.b*255,0,255)<<0}getHexString(e=ts){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Lr.workingColorSpace){Lr.fromWorkingColorSpace(fr.copy(this),t);const r=fr.r,i=fr.g,s=fr.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,u;const h=(a+o)/2;if(a===o)l=0,u=0;else{const d=o-a;switch(u=h<=.5?d/(o+a):d/(2-o-a),o){case r:l=(i-s)/d+(i>-u-14,r[l|256]=1024>>-u-14|32768,i[l]=-u-1,i[l|256]=-u-1):u<=15?(r[l]=u+15<<10,r[l|256]=u+15<<10|32768,i[l]=13,i[l|256]=13):u<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 u=l<<13,h=0;for(;!(u&8388608);)u<<=1,h-=8388608;u&=-8388609,h+=947912704,s[l]=u|h}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 Ir(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=xn(n,-65504,65504),to.floatView[0]=n;const e=to.uint32View[0],t=e>>23&511;return to.baseTable[t]+((e&8388607)>>to.shiftTable[t])}function Lh(n){const e=n>>10;return to.uint32View[0]=to.mantissaTable[to.offsetTable[e]+(n&1023)]+to.exponentTable[e],to.floatView[0]}const Ih={toHalfFloat:Ir,fromHalfFloat:Lh},En=new F,Qm=new me;class Nt{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=Td,this.updateRange={offset:0,count:-1},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}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 u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const l in r){const u=r[l];e.data.attributes[l]=u.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const u=this.morphAttributes[l],h=[];for(let d=0,p=u.length;d0&&(i[l]=h,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 u in i){const h=i[u];this.setAttribute(u,h.clone(t))}const s=e.morphAttributes;for(const u in s){const h=[],d=s[u];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))||(bT.copy(s).invert(),As.copy(e.ray).applyMatrix4(bT),r.boundingBox!==null&&As.intersectsBox(r.boundingBox)===!1))return;let o;const a=r.index,l=r.attributes.position,u=r.attributes.uv,h=r.attributes.uv2,d=r.attributes.normal,p=r.groups,m=r.drawRange;if(a!==null)if(Array.isArray(i))for(let v=0,x=p.length;vt.far?null:{distance:u,point:ig.clone(),object:n}}function sg(n,e,t,r,i,s,o,a,l,u){n.getVertexPosition(a,Cu),n.getVertexPosition(l,Eu),n.getVertexPosition(u,Tu);const h=Gz(n,e,t,r,Cu,Eu,Tu,rg);if(h){i&&(eg.fromBufferAttribute(i,a),tg.fromBufferAttribute(i,l),ng.fromBufferAttribute(i,u),h.uv=Fr.getInterpolation(rg,Cu,Eu,Tu,eg,tg,ng,new me)),s&&(eg.fromBufferAttribute(s,a),tg.fromBufferAttribute(s,l),ng.fromBufferAttribute(s,u),h.uv2=Fr.getInterpolation(rg,Cu,Eu,Tu,eg,tg,ng,new me)),o&&(ET.fromBufferAttribute(o,a),TT.fromBufferAttribute(o,l),PT.fromBufferAttribute(o,u),h.normal=Fr.getInterpolation(rg,Cu,Eu,Tu,ET,TT,PT,new F),h.normal.dot(r.direction)>0&&h.normal.multiplyScalar(-1));const d={a,b:l,c:u,normal:new F,materialIndex:0};Fr.getNormal(Cu,Eu,Tu,d.normal),h.face=d}return h}class La extends ht{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=[],u=[],h=[],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 Ge(u,3)),this.setAttribute("normal",new Ge(h,3)),this.setAttribute("uv",new Ge(d,2));function v(x,_,g,w,S,M,C,P,L,B,E){const R=M/L,I=C/B,V=M/2,H=C/2,W=P/2,J=L+1,re=B+1;let ue=0,U=0;const $=new F;for(let j=0;j0?1:-1,h.push($.x,$.y,$.z),d.push(ee/L),d.push(1-j/B),ue+=1}}for(let j=0;j0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;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 Zd extends Bt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ot,this.projectionMatrix=new ot,this.projectionMatrixInverse=new ot}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),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 Dn extends Zd{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=Xc*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(bl*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Xc*2*Math.atan(Math.tan(bl*.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(bl*.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,u=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/u,i*=o.width/l,r*=o.height/u}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,e,this.far),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 Pu=-90,Ru=1;class jD extends Bt{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r;const i=new Dn(Pu,Ru,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);const s=new Dn(Pu,Ru,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const o=new Dn(Pu,Ru,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new Dn(Pu,Ru,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const l=new Dn(Pu,Ru,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const u=new Dn(Pu,Ru,e,t);u.layers=this.layers,u.up.set(0,1,0),u.lookAt(0,0,-1),this.add(u)}update(e,t){this.parent===null&&this.updateMatrixWorld();const r=this.renderTarget,[i,s,o,a,l,u]=this.children,h=e.getRenderTarget(),d=e.toneMapping,p=e.xr.enabled;e.toneMapping=as,e.xr.enabled=!1;const m=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,i),e.setRenderTarget(r,1),e.render(t,s),e.setRenderTarget(r,2),e.render(t,o),e.setRenderTarget(r,3),e.render(t,a),e.setRenderTarget(r,4),e.render(t,l),r.texture.generateMipmaps=m,e.setRenderTarget(r,5),e.render(t,u),e.setRenderTarget(h),e.toneMapping=d,e.xr.enabled=p,r.texture.needsPMREMUpdate=!0}}class ep extends an{constructor(e,t,r,i,s,o,a,l,u,h){e=e!==void 0?e:[],t=t!==void 0?t:xo,super(e,t,r,i,s,o,a,l,u,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class CA extends li{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];this.texture=new ep(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Zt}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,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 La(5,5,5),s=new Oi({name:"CubemapFromEquirect",uniforms:Kc(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Mr,blending:co});s.uniforms.tEquirect.value=t;const o=new Rn(i,s),a=t.minFilter;return t.minFilter===Ds&&(t.minFilter=Zt),new jD(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 e1=new F,Wz=new F,jz=new At;class Qo{constructor(e=new F(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=e1.subVectors(r,t).cross(Wz.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(e1),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||jz.getNormalMatrix(e),i=this.coplanarPoint(e1).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 Xa=new Ui,og=new F;class bv{constructor(e=new Qo,t=new Qo,r=new Qo,i=new Qo,s=new Qo,o=new Qo){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){const t=this.planes,r=e.elements,i=r[0],s=r[1],o=r[2],a=r[3],l=r[4],u=r[5],h=r[6],d=r[7],p=r[8],m=r[9],v=r[10],x=r[11],_=r[12],g=r[13],w=r[14],S=r[15];return t[0].setComponents(a-i,d-l,x-p,S-_).normalize(),t[1].setComponents(a+i,d+l,x+p,S+_).normalize(),t[2].setComponents(a+s,d+u,x+m,S+g).normalize(),t[3].setComponents(a-s,d-u,x-m,S-g).normalize(),t[4].setComponents(a-o,d-h,x-v,S-w).normalize(),t[5].setComponents(a+o,d+h,x+v,S+w).normalize(),this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Xa.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Xa.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Xa)}intersectsSprite(e){return Xa.center.set(0,0,0),Xa.radius=.7071067811865476,Xa.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xa)}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,og.y=i.normal.y>0?e.max.y:e.min.y,og.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(og)<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 $D(){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 $z(n,e){const t=e.isWebGL2,r=new WeakMap;function i(u,h){const d=u.array,p=u.usage,m=n.createBuffer();n.bindBuffer(h,m),n.bufferData(h,d,p),u.onUploadCallback();let v;if(d instanceof Float32Array)v=5126;else if(d instanceof Uint16Array)if(u.isFloat16BufferAttribute)if(t)v=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else v=5123;else if(d instanceof Int16Array)v=5122;else if(d instanceof Uint32Array)v=5125;else if(d instanceof Int32Array)v=5124;else if(d instanceof Int8Array)v=5120;else if(d instanceof Uint8Array)v=5121;else if(d instanceof Uint8ClampedArray)v=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+d);return{buffer:m,type:v,bytesPerElement:d.BYTES_PER_ELEMENT,version:u.version}}function s(u,h,d){const p=h.array,m=h.updateRange;n.bindBuffer(d,u),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),h.onUploadCallback()}function o(u){return u.isInterleavedBufferAttribute&&(u=u.data),r.get(u)}function a(u){u.isInterleavedBufferAttribute&&(u=u.data);const h=r.get(u);h&&(n.deleteBuffer(h.buffer),r.delete(u))}function l(u,h){if(u.isGLBufferAttribute){const p=r.get(u);(!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`,sH=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,oH=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,aH=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,lH=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,uH=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,cH=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`,fH=`#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`,hH=`#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`,dH=`#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`,pH=`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`,mH=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,gH=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); #endif`,vH=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,yH=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,xH="gl_FragColor = linearToOutputTexel( gl_FragColor );",_H=`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 ); }`,SH=`#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`,wH=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,AH=`#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`,MH=`#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`,bH=`#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`,CH=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,EH=`#ifdef USE_FOG varying float vFogDepth; #endif`,TH=`#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`,PH=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,RH=`#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 }`,BH=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; #endif`,LH=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,IH=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularStrength = specularStrength;`,DH=`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`,FH=`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`,OH=`#if defined( USE_ENVMAP ) vec3 getIBLIrradiance( const in vec3 normal ) { #if defined( 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 ) { #if defined( 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 } #endif`,kH=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,NH=`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`,UH=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,GH=`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`,zH=`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`,HH=`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 }; 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_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 float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); float D = D_GGX( alpha, dotNH ); 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 ); }`,VH=` 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`,WH=`#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 ) radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); #endif #endif`,jH=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); #endif`,$H=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,JH=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,XH=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`,KH=`#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`,YH=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; #endif`,QH=`#ifdef USE_MAP uniform sampler2D map; #endif`,qH=`#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`,ZH=`#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`,e8=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; #endif`,t8=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,n8=`#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`,r8=`#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`,i8=`#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`,s8=`#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`,o8=`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 #ifdef USE_NORMALMAP_TANGENTSPACE #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;`,a8=`#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`,l8=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,u8=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,c8=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,f8=`#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 ) ) 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`,h8=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = geometryNormal; #endif`,d8=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); #endif`,p8=`#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`,m8=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,g8=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha + 0.1; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,v8=`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 ); }`,y8=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,x8=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,_8=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,S8=`#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`,w8=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; #endif`,A8=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,M8=`#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`,b8=`#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`,C8=`#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`,E8=`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; }`,T8=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,P8=`#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`,R8=`#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`,B8=`#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`,L8=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,I8=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,D8=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,F8=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return 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; }`,O8=`#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 transmission = 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, transmission.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); #endif`,k8=`#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, vec2 fullSize, 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; vec2 lodFudge = pow( 1.95, lod ) / fullSize; 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; vec2 fullSize = vec2( textureSize( sampler, 0 ) ); vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), fullSize, floor( lod ) ); vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), fullSize, 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 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( isinf( attenuationDistance ) ) { return radiance; } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance; } } 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 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); } #endif`,N8=`#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_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`,U8=`#ifdef USE_UV varying vec2 vUv; #endif #ifdef USE_UV2 attribute vec2 uv2; #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_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`,G8=`#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_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`,z8=`#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 H8=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,V8=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { vec4 texColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); #endif texColor.rgb *= backgroundIntensity; gl_FragColor = texColor; #include #include }`,W8=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,j8=`#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 }`,$8=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,J8=`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 }`,X8=`#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; }`,K8=`#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 }`,Y8=`#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; }`,Q8=`#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 ); }`,q8=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,Z8=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,e9=`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 }`,t9=`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 }`,n9=`#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 }`,r9=`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 }`,i9=`#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 }`,s9=`#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 }`,o9=`#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; }`,a9=`#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 }`,l9=`#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 }`,u9=`#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 }`,c9=`#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 }`,f9=`#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 }`,h9=`#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 }`,d9=`#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 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 }`,p9=`#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 }`,m9=`#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 }`,g9=`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 }`,v9=`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 }`,y9=`#include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include }`,x9=`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 }`,_9=`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 }`,S9=`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 }`,gt={alphamap_fragment:Jz,alphamap_pars_fragment:Xz,alphatest_fragment:Kz,alphatest_pars_fragment:Yz,aomap_fragment:Qz,aomap_pars_fragment:qz,begin_vertex:Zz,beginnormal_vertex:eH,bsdfs:tH,iridescence_fragment:nH,bumpmap_pars_fragment:rH,clipping_planes_fragment:iH,clipping_planes_pars_fragment:sH,clipping_planes_pars_vertex:oH,clipping_planes_vertex:aH,color_fragment:lH,color_pars_fragment:uH,color_pars_vertex:cH,color_vertex:fH,common:hH,cube_uv_reflection_fragment:dH,defaultnormal_vertex:pH,displacementmap_pars_vertex:mH,displacementmap_vertex:gH,emissivemap_fragment:vH,emissivemap_pars_fragment:yH,encodings_fragment:xH,encodings_pars_fragment:_H,envmap_fragment:SH,envmap_common_pars_fragment:wH,envmap_pars_fragment:AH,envmap_pars_vertex:MH,envmap_physical_pars_fragment:OH,envmap_vertex:bH,fog_vertex:CH,fog_pars_vertex:EH,fog_fragment:TH,fog_pars_fragment:PH,gradientmap_pars_fragment:RH,lightmap_fragment:BH,lightmap_pars_fragment:LH,lights_lambert_fragment:IH,lights_lambert_pars_fragment:DH,lights_pars_begin:FH,lights_toon_fragment:kH,lights_toon_pars_fragment:NH,lights_phong_fragment:UH,lights_phong_pars_fragment:GH,lights_physical_fragment:zH,lights_physical_pars_fragment:HH,lights_fragment_begin:VH,lights_fragment_maps:WH,lights_fragment_end:jH,logdepthbuf_fragment:$H,logdepthbuf_pars_fragment:JH,logdepthbuf_pars_vertex:XH,logdepthbuf_vertex:KH,map_fragment:YH,map_pars_fragment:QH,map_particle_fragment:qH,map_particle_pars_fragment:ZH,metalnessmap_fragment:e8,metalnessmap_pars_fragment:t8,morphcolor_vertex:n8,morphnormal_vertex:r8,morphtarget_pars_vertex:i8,morphtarget_vertex:s8,normal_fragment_begin:o8,normal_fragment_maps:a8,normal_pars_fragment:l8,normal_pars_vertex:u8,normal_vertex:c8,normalmap_pars_fragment:f8,clearcoat_normal_fragment_begin:h8,clearcoat_normal_fragment_maps:d8,clearcoat_pars_fragment:p8,iridescence_pars_fragment:m8,output_fragment:g8,packing:v8,premultiplied_alpha_fragment:y8,project_vertex:x8,dithering_fragment:_8,dithering_pars_fragment:S8,roughnessmap_fragment:w8,roughnessmap_pars_fragment:A8,shadowmap_pars_fragment:M8,shadowmap_pars_vertex:b8,shadowmap_vertex:C8,shadowmask_pars_fragment:E8,skinbase_vertex:T8,skinning_pars_vertex:P8,skinning_vertex:R8,skinnormal_vertex:B8,specularmap_fragment:L8,specularmap_pars_fragment:I8,tonemapping_fragment:D8,tonemapping_pars_fragment:F8,transmission_fragment:O8,transmission_pars_fragment:k8,uv_pars_fragment:N8,uv_pars_vertex:U8,uv_vertex:G8,worldpos_vertex:z8,background_vert:H8,background_frag:V8,backgroundCube_vert:W8,backgroundCube_frag:j8,cube_vert:$8,cube_frag:J8,depth_vert:X8,depth_frag:K8,distanceRGBA_vert:Y8,distanceRGBA_frag:Q8,equirect_vert:q8,equirect_frag:Z8,linedashed_vert:e9,linedashed_frag:t9,meshbasic_vert:n9,meshbasic_frag:r9,meshlambert_vert:i9,meshlambert_frag:s9,meshmatcap_vert:o9,meshmatcap_frag:a9,meshnormal_vert:l9,meshnormal_frag:u9,meshphong_vert:c9,meshphong_frag:f9,meshphysical_vert:h9,meshphysical_frag:d9,meshtoon_vert:p9,meshtoon_frag:m9,points_vert:g9,points_frag:v9,shadow_vert:y9,shadow_frag:x9,sprite_vert:_9,sprite_frag:S9},Te={common:{diffuse:{value:new Ce(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new At},alphaMap:{value:null},alphaMapTransform:{value:new At},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new At}},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 At}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new At}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new At},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new At},normalScale:{value:new me(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new At},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new At}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new At}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new At}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ce(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 Ce(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new At}},sprite:{diffuse:{value:new Ce(16777215)},opacity:{value:1},center:{value:new me(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new At},alphaMap:{value:null},alphaTest:{value:0}}},rs={basic:{uniforms:xr([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.fog]),vertexShader:gt.meshbasic_vert,fragmentShader:gt.meshbasic_frag},lambert:{uniforms:xr([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,Te.lights,{emissive:{value:new Ce(0)}}]),vertexShader:gt.meshlambert_vert,fragmentShader:gt.meshlambert_frag},phong:{uniforms:xr([Te.common,Te.specularmap,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,Te.lights,{emissive:{value:new Ce(0)},specular:{value:new Ce(1118481)},shininess:{value:30}}]),vertexShader:gt.meshphong_vert,fragmentShader:gt.meshphong_frag},standard:{uniforms:xr([Te.common,Te.envmap,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.roughnessmap,Te.metalnessmap,Te.fog,Te.lights,{emissive:{value:new Ce(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag},toon:{uniforms:xr([Te.common,Te.aomap,Te.lightmap,Te.emissivemap,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.gradientmap,Te.fog,Te.lights,{emissive:{value:new Ce(0)}}]),vertexShader:gt.meshtoon_vert,fragmentShader:gt.meshtoon_frag},matcap:{uniforms:xr([Te.common,Te.bumpmap,Te.normalmap,Te.displacementmap,Te.fog,{matcap:{value:null}}]),vertexShader:gt.meshmatcap_vert,fragmentShader:gt.meshmatcap_frag},points:{uniforms:xr([Te.points,Te.fog]),vertexShader:gt.points_vert,fragmentShader:gt.points_frag},dashed:{uniforms:xr([Te.common,Te.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:gt.linedashed_vert,fragmentShader:gt.linedashed_frag},depth:{uniforms:xr([Te.common,Te.displacementmap]),vertexShader:gt.depth_vert,fragmentShader:gt.depth_frag},normal:{uniforms:xr([Te.common,Te.bumpmap,Te.normalmap,Te.displacementmap,{opacity:{value:1}}]),vertexShader:gt.meshnormal_vert,fragmentShader:gt.meshnormal_frag},sprite:{uniforms:xr([Te.sprite,Te.fog]),vertexShader:gt.sprite_vert,fragmentShader:gt.sprite_frag},background:{uniforms:{uvTransform:{value:new At},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:gt.background_vert,fragmentShader:gt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:gt.backgroundCube_vert,fragmentShader:gt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:gt.cube_vert,fragmentShader:gt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:gt.equirect_vert,fragmentShader:gt.equirect_frag},distanceRGBA:{uniforms:xr([Te.common,Te.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:gt.distanceRGBA_vert,fragmentShader:gt.distanceRGBA_frag},shadow:{uniforms:xr([Te.lights,Te.fog,{color:{value:new Ce(0)},opacity:{value:1}}]),vertexShader:gt.shadow_vert,fragmentShader:gt.shadow_frag}};rs.physical={uniforms:xr([rs.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new At},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new At},clearcoatNormalScale:{value:new me(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new At},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new At},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new At},sheen:{value:0},sheenColor:{value:new Ce(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new At},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new At},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new At},transmissionSamplerSize:{value:new me},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new At},attenuationDistance:{value:0},attenuationColor:{value:new Ce(0)},specularColor:{value:new Ce(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new At},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new At}}]),vertexShader:gt.meshphysical_vert,fragmentShader:gt.meshphysical_frag};const ag={r:0,b:0,g:0};function w9(n,e,t,r,i,s,o){const a=new Ce(0);let l=s===!0?0:1,u,h,d=null,p=0,m=null;function v(_,g){let w=!1,S=g.isScene===!0?g.background:null;S&&S.isTexture&&(S=(g.backgroundBlurriness>0?t:e).get(S));const M=n.xr,C=M.getSession&&M.getSession();C&&C.environmentBlendMode==="additive"&&(S=null),S===null?x(a,l):S&&S.isColor&&(x(S,1),w=!0),(n.autoClear||w)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),S&&(S.isCubeTexture||S.mapping===uf)?(h===void 0&&(h=new Rn(new La(1,1,1),new Oi({name:"BackgroundCubeMaterial",uniforms:Kc(rs.backgroundCube.uniforms),vertexShader:rs.backgroundCube.vertexShader,fragmentShader:rs.backgroundCube.fragmentShader,side:Mr,depthTest:!1,depthWrite:!1,fog:!1})),h.geometry.deleteAttribute("normal"),h.geometry.deleteAttribute("uv"),h.onBeforeRender=function(P,L,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(h.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(h)),h.material.uniforms.envMap.value=S,h.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,h.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,h.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,h.material.toneMapped=S.encoding!==Ct,(d!==S||p!==S.version||m!==n.toneMapping)&&(h.material.needsUpdate=!0,d=S,p=S.version,m=n.toneMapping),h.layers.enableAll(),_.unshift(h,h.geometry,h.material,0,0,null)):S&&S.isTexture&&(u===void 0&&(u=new Rn(new cf(2,2),new Oi({name:"BackgroundMaterial",uniforms:Kc(rs.background.uniforms),vertexShader:rs.background.vertexShader,fragmentShader:rs.background.fragmentShader,side:Is,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(u)),u.material.uniforms.t2D.value=S,u.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,u.material.toneMapped=S.encoding!==Ct,S.matrixAutoUpdate===!0&&S.updateMatrix(),u.material.uniforms.uvTransform.value.copy(S.matrix),(d!==S||p!==S.version||m!==n.toneMapping)&&(u.material.needsUpdate=!0,d=S,p=S.version,m=n.toneMapping),u.layers.enableAll(),_.unshift(u,u.geometry,u.material,0,0,null))}function x(_,g){_.getRGB(ag,WD(n)),r.buffers.color.setClear(ag.r,ag.g,ag.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(_,g=1){a.set(_),l=g,x(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(_){l=_,x(a,l)},render:v}}function A9(n,e,t,r){const i=n.getParameter(34921),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||s!==null,a={},l=_(null);let u=l,h=!1;function d(W,J,re,ue,U){let $=!1;if(o){const j=x(ue,re,J);u!==j&&(u=j,m(u.object)),$=g(W,ue,re,U),$&&w(W,ue,re,U)}else{const j=J.wireframe===!0;(u.geometry!==ue.id||u.program!==re.id||u.wireframe!==j)&&(u.geometry=ue.id,u.program=re.id,u.wireframe=j,$=!0)}U!==null&&t.update(U,34963),($||h)&&(h=!1,B(W,J,re,ue),U!==null&&n.bindBuffer(34963,t.get(U).buffer))}function p(){return r.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(W){return r.isWebGL2?n.bindVertexArray(W):s.bindVertexArrayOES(W)}function v(W){return r.isWebGL2?n.deleteVertexArray(W):s.deleteVertexArrayOES(W)}function x(W,J,re){const ue=re.wireframe===!0;let U=a[W.id];U===void 0&&(U={},a[W.id]=U);let $=U[J.id];$===void 0&&($={},U[J.id]=$);let j=$[ue];return j===void 0&&(j=_(p()),$[ue]=j),j}function _(W){const J=[],re=[],ue=[];for(let U=0;U=0){const ie=U[ee];let Me=$[ee];if(Me===void 0&&(ee==="instanceMatrix"&&W.instanceMatrix&&(Me=W.instanceMatrix),ee==="instanceColor"&&W.instanceColor&&(Me=W.instanceColor)),ie===void 0||ie.attribute!==Me||Me&&ie.data!==Me.data)return!0;j++}return u.attributesNum!==j||u.index!==ue}function w(W,J,re,ue){const U={},$=J.attributes;let j=0;const se=re.getAttributes();for(const ee in se)if(se[ee].location>=0){let ie=$[ee];ie===void 0&&(ee==="instanceMatrix"&&W.instanceMatrix&&(ie=W.instanceMatrix),ee==="instanceColor"&&W.instanceColor&&(ie=W.instanceColor));const Me={};Me.attribute=ie,ie&&ie.data&&(Me.data=ie.data),U[ee]=Me,j++}u.attributes=U,u.attributesNum=j,u.index=ue}function S(){const W=u.newAttributes;for(let J=0,re=W.length;J=0){let ne=U[se];if(ne===void 0&&(se==="instanceMatrix"&&W.instanceMatrix&&(ne=W.instanceMatrix),se==="instanceColor"&&W.instanceColor&&(ne=W.instanceColor)),ne!==void 0){const ie=ne.normalized,Me=ne.itemSize,ye=t.get(ne);if(ye===void 0)continue;const q=ye.buffer,qe=ye.type,Je=ye.bytesPerElement;if(ne.isInterleavedBufferAttribute){const _e=ne.data,Pe=_e.stride,ge=ne.offset;if(_e.isInstancedInterleavedBuffer){for(let le=0;le0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";L="mediump"}return L==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const u=o||e.has("WEBGL_draw_buffers"),h=t.logarithmicDepthBuffer===!0,d=n.getParameter(34930),p=n.getParameter(35660),m=n.getParameter(3379),v=n.getParameter(34076),x=n.getParameter(34921),_=n.getParameter(36347),g=n.getParameter(36348),w=n.getParameter(36349),S=p>0,M=o||e.has("OES_texture_float"),C=S&&M,P=o?n.getParameter(36183):0;return{isWebGL2:o,drawBuffers:u,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:h,maxTextures:d,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:v,maxAttributes:x,maxVertexUniforms:_,maxVaryings:g,maxFragmentUniforms:w,vertexTextures:S,floatFragmentTextures:M,floatVertexTextures:C,maxSamples:P}}function C9(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new Qo,a=new At,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,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,p){t=h(d,p,0)},this.setState=function(d,p,m){const v=d.clippingPlanes,x=d.clipIntersection,_=d.clipShadows,g=n.get(d);if(!i||v===null||v.length===0||s&&!_)s?h(null):u();else{const w=s?0:r,S=w*4;let M=g.clippingState||null;l.value=M,M=h(v,p,S,m);for(let C=0;C!==S;++C)M[C]=t[C];g.clippingState=M,this.numIntersection=x?this.numPlanes:0,this.numPlanes+=w}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function h(d,p,m,v){const x=d!==null?d.length:0;let _=null;if(x!==0){if(_=l.value,v!==!0||_===null){const g=m+x*4,w=p.matrixWorldInverse;a.getNormalMatrix(w),(_===null||_.length0){const u=new CA(l.height/2);return u.fromEquirectangularTexture(n,o),e.set(o,u),o.addEventListener("dispose",i),t(u.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 ff extends Zd{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 u=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=u*this.view.offsetX,o=s+u*this.view.width,a-=h*this.view.offsetY,l=a-h*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far),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 _c=4,RT=[.125,.215,.35,.446,.526,.582],fl=20,t1=new ff,BT=new Ce;let n1=null;const il=(1+Math.sqrt(5))/2,Bu=1/il,LT=[new F(1,1,1),new F(-1,1,1),new F(1,1,-1),new F(-1,1,-1),new F(0,il,Bu),new F(0,il,-Bu),new F(Bu,0,il),new F(-Bu,0,il),new F(il,Bu,0),new F(-il,Bu,0)];class MS{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){n1=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=FT(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=DT(),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?S:0,S,S),h.setRenderTarget(i),x&&h.render(v,a),h.render(e,a)}v.geometry.dispose(),v.material.dispose(),h.toneMapping=p,h.autoClear=d,e.background=_}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===xo||e.mapping===_a;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=FT()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=DT());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new Rn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;lg(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,t1)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;ifl&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${_} samples when the maximum is set to ${fl}`);const g=[];let w=0;for(let L=0;LS-_c?i-S+_c:0),P=4*(this._cubeSize-M);lg(t,C,P,3*M,2*M),l.setRenderTarget(t),l.render(d,t1)}}function T9(n){const e=[],t=[],r=[];let i=n;const s=n-_c+1+RT.length;for(let o=0;on-_c?l=RT[o-n+_c-1]:o===0&&(l=0),r.push(l);const u=1/(a-2),h=-u,d=1+u,p=[h,h,d,h,d,d,h,h,d,d,h,d],m=6,v=6,x=3,_=2,g=1,w=new Float32Array(x*v*m),S=new Float32Array(_*v*m),M=new Float32Array(g*v*m);for(let P=0;P2?0:-1,E=[L,B,0,L+2/3,B,0,L+2/3,B+1,0,L,B,0,L+2/3,B+1,0,L,B+1,0];w.set(E,x*v*P),S.set(p,_*v*P);const R=[P,P,P,P,P,P];M.set(R,g*v*P)}const C=new ht;C.setAttribute("position",new Nt(w,x)),C.setAttribute("uv",new Nt(S,_)),C.setAttribute("faceIndex",new Nt(M,g)),e.push(C),i>_c&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function IT(n,e,t){const r=new li(n,e,t);return r.texture.mapping=uf,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function lg(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function P9(n,e,t){const r=new Float32Array(fl),i=new F(0,1,0);return new Oi({name:"SphericalGaussianBlur",defines:{n:fl,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:EA(),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:co,depthTest:!1,depthWrite:!1})}function DT(){return new Oi({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:EA(),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:co,depthTest:!1,depthWrite:!1})}function FT(){return new Oi({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:EA(),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:co,depthTest:!1,depthWrite:!1})}function EA(){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 R9(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,u=l===Wc||l===bd,h=l===xo||l===_a;if(u||h)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let d=e.get(a);return t===null&&(t=new MS(n)),d=u?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(u&&d&&d.height>0||h&&d&&i(d)){t===null&&(t=new MS(n));const p=u?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 u=6;for(let h=0;he.maxTextureSize&&(I=Math.ceil(R/e.maxTextureSize),R=e.maxTextureSize);const V=new Float32Array(R*I*4*x),H=new Mv(V,R,I,x);H.type=ei,H.needsUpdate=!0;const W=E*4;for(let re=0;re0)return n;const i=e*t;let s=OT[i];if(s===void 0&&(s=new Float32Array(i),OT[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 kn(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t":" "} ${a}: ${t[o]}`)}return r.join(` `)}function B6(n){switch(n){case us:return["Linear","( value )"];case Ct:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function VT(n,e,t){const r=n.getShaderParameter(e,35713),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+` `+R6(n.getShaderSource(e),o)}else return i}function L6(n,e){const t=B6(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function I6(n,e){let t;switch(e){case dD:t="Linear";break;case pD:t="Reinhard";break;case mD:t="OptimizedCineon";break;case mA:t="ACESFilmic";break;case gD:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function D6(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(Dh).join(` `)}function F6(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(` `)}function O6(n,e){const t={},r=n.getProgramParameter(e,35721);for(let i=0;i/gm;function bS(n){return n.replace(k6,N6)}function N6(n,e){const t=gt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return bS(t)}const U6=/#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 $T(n){return n.replace(U6,G6)}function G6(n,e,t,r){let i="";for(let s=parseInt(e);s0&&(_+=` `),g=[m,v].filter(Dh).join(` `),g.length>0&&(g+=` `)):(_=[JT(t),"#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 "+h:"",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.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.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.vertexUvs2?"#define USE_UV2":"",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.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_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(Dh).join(` `),g=[m,JT(t),"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",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.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.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs2?"#define USE_UV2":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==as?"#define TONE_MAPPING":"",t.toneMapping!==as?gt.tonemapping_pars_fragment:"",t.toneMapping!==as?I6("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",gt.encodings_pars_fragment,L6("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(Dh).join(` `)),o=bS(o),o=WT(o,t),o=jT(o,t),a=bS(a),a=WT(a,t),a=jT(a,t),o=$T(o),a=$T(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(w=`#version 300 es `,_=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+_,g=["#define varying in",t.glslVersion===wS?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===wS?"":"#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 S=w+_+o,M=w+g+a,C=HT(i,35633,S),P=HT(i,35632,M);if(i.attachShader(x,C),i.attachShader(x,P),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 E=i.getProgramInfoLog(x).trim(),R=i.getShaderInfoLog(C).trim(),I=i.getShaderInfoLog(P).trim();let V=!0,H=!0;if(i.getProgramParameter(x,35714)===!1)if(V=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,x,C,P);else{const W=VT(i,C,"vertex"),J=VT(i,P,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(x,35715)+` Program Info Log: `+E+` `+W+` `+J)}else E!==""?console.warn("THREE.WebGLProgram: Program Info Log:",E):(R===""||I==="")&&(H=!1);H&&(this.diagnostics={runnable:V,programLog:E,vertexShader:{log:R,prefix:_},fragmentShader:{log:I,prefix:g}})}i.deleteShader(C),i.deleteShader(P);let L;this.getUniforms=function(){return L===void 0&&(L=new l0(i,x)),L};let B;return this.getAttributes=function(){return B===void 0&&(B=O6(i,x)),B},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(x),this.program=void 0},this.name=t.shaderName,this.id=P6++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=C,this.fragmentShader=P,this}let J6=0;class X6{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 K6(e),t.set(e,r)),r}}class K6{constructor(e){this.id=J6++,this.code=e,this.usedTimes=0}}function Y6(n,e,t,r,i,s,o){const a=new Cl,l=new X6,u=[],h=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(E){return E===1?"uv2":"uv"}function _(E,R,I,V,H){const W=V.fog,J=H.geometry,re=E.isMeshStandardMaterial?V.environment:null,ue=(E.isMeshStandardMaterial?t:e).get(E.envMap||re),U=ue&&ue.mapping===uf?ue.image.height:null,$=v[E.type];E.precision!==null&&(m=i.getMaxPrecision(E.precision),m!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",m,"instead."));const j=J.morphAttributes.position||J.morphAttributes.normal||J.morphAttributes.color,se=j!==void 0?j.length:0;let ee=0;J.morphAttributes.position!==void 0&&(ee=1),J.morphAttributes.normal!==void 0&&(ee=2),J.morphAttributes.color!==void 0&&(ee=3);let ne,ie,Me,ye;if($){const De=rs[$];ne=De.vertexShader,ie=De.fragmentShader}else ne=E.vertexShader,ie=E.fragmentShader,l.update(E),Me=l.getVertexShaderID(E),ye=l.getFragmentShaderID(E);const q=n.getRenderTarget(),qe=H.isInstancedMesh===!0,Je=!!E.map,_e=!!E.matcap,Pe=!!ue,ge=!!E.aoMap,le=!!E.lightMap,ve=!!E.bumpMap,ke=!!E.normalMap,Re=!!E.displacementMap,Ze=!!E.emissiveMap,et=!!E.metalnessMap,Xe=!!E.roughnessMap,ut=E.clearcoat>0,Pt=E.iridescence>0,G=E.sheen>0,D=E.transmission>0,oe=ut&&!!E.clearcoatMap,xe=ut&&!!E.clearcoatNormalMap,we=ut&&!!E.clearcoatRoughnessMap,Be=Pt&&!!E.iridescenceMap,nt=Pt&&!!E.iridescenceThicknessMap,Fe=G&&!!E.sheenColorMap,de=G&&!!E.sheenRoughnessMap,ze=!!E.specularMap,Ke=!!E.specularColorMap,tt=!!E.specularIntensityMap,Ne=D&&!!E.transmissionMap,We=D&&!!E.thicknessMap,bt=!!E.gradientMap,kt=!!E.alphaMap,ln=E.alphaTest>0,X=!!E.extensions,he=!!J.attributes.uv2;return{isWebGL2:h,shaderID:$,shaderName:E.type,vertexShader:ne,fragmentShader:ie,defines:E.defines,customVertexShaderID:Me,customFragmentShaderID:ye,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:m,instancing:qe,instancingColor:qe&&H.instanceColor!==null,supportsVertexTextures:p,outputEncoding:q===null?n.outputEncoding:q.isXRRenderTarget===!0?q.texture.encoding:us,map:Je,matcap:_e,envMap:Pe,envMapMode:Pe&&ue.mapping,envMapCubeUVHeight:U,aoMap:ge,lightMap:le,bumpMap:ve,normalMap:ke,displacementMap:p&&Re,emissiveMap:Ze,normalMapObjectSpace:ke&&E.normalMapType===ND,normalMapTangentSpace:ke&&E.normalMapType===Mo,decodeVideoTexture:Je&&E.map.isVideoTexture===!0&&E.map.encoding===Ct,metalnessMap:et,roughnessMap:Xe,clearcoat:ut,clearcoatMap:oe,clearcoatNormalMap:xe,clearcoatRoughnessMap:we,iridescence:Pt,iridescenceMap:Be,iridescenceThicknessMap:nt,sheen:G,sheenColorMap:Fe,sheenRoughnessMap:de,specularMap:ze,specularColorMap:Ke,specularIntensityMap:tt,transmission:D,transmissionMap:Ne,thicknessMap:We,gradientMap:bt,opaque:E.transparent===!1&&E.blending===Al,alphaMap:kt,alphaTest:ln,combine:E.combine,mapUv:Je&&x(E.map.channel),aoMapUv:ge&&x(E.aoMap.channel),lightMapUv:le&&x(E.lightMap.channel),bumpMapUv:ve&&x(E.bumpMap.channel),normalMapUv:ke&&x(E.normalMap.channel),displacementMapUv:Re&&x(E.displacementMap.channel),emissiveMapUv:Ze&&x(E.emissiveMap.channel),metalnessMapUv:et&&x(E.metalnessMap.channel),roughnessMapUv:Xe&&x(E.roughnessMap.channel),clearcoatMapUv:oe&&x(E.clearcoatMap.channel),clearcoatNormalMapUv:xe&&x(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:we&&x(E.clearcoatRoughnessMap.channel),iridescenceMapUv:Be&&x(E.iridescenceMap.channel),iridescenceThicknessMapUv:nt&&x(E.iridescenceThicknessMap.channel),sheenColorMapUv:Fe&&x(E.sheenColorMap.channel),sheenRoughnessMapUv:de&&x(E.sheenRoughnessMap.channel),specularMapUv:ze&&x(E.specularMap.channel),specularColorMapUv:Ke&&x(E.specularColorMap.channel),specularIntensityMapUv:tt&&x(E.specularIntensityMap.channel),transmissionMapUv:Ne&&x(E.transmissionMap.channel),thicknessMapUv:We&&x(E.thicknessMap.channel),alphaMapUv:kt&&x(E.alphaMap.channel),vertexTangents:ke&&!!J.attributes.tangent,vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!J.attributes.color&&J.attributes.color.itemSize===4,vertexUvs2:he,pointsUvs:H.isPoints===!0&&!!J.attributes.uv&&(Je||kt),fog:!!W,useFog:E.fog===!0,fogExp2:W&&W.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:d,skinning:H.isSkinnedMesh===!0,morphTargets:J.morphAttributes.position!==void 0,morphNormals:J.morphAttributes.normal!==void 0,morphColors:J.morphAttributes.color!==void 0,morphTargetsCount:se,morphTextureStride:ee,numDirLights:R.directional.length,numPointLights:R.point.length,numSpotLights:R.spot.length,numSpotLightMaps:R.spotLightMap.length,numRectAreaLights:R.rectArea.length,numHemiLights:R.hemi.length,numDirLightShadows:R.directionalShadowMap.length,numPointLightShadows:R.pointShadowMap.length,numSpotLightShadows:R.spotShadowMap.length,numSpotLightShadowsWithMaps:R.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:E.dithering,shadowMapEnabled:n.shadowMap.enabled&&I.length>0,shadowMapType:n.shadowMap.type,toneMapping:E.toneMapped?n.toneMapping:as,useLegacyLights:n.useLegacyLights,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Pi,flipSided:E.side===Mr,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionDerivatives:X&&E.extensions.derivatives===!0,extensionFragDepth:X&&E.extensions.fragDepth===!0,extensionDrawBuffers:X&&E.extensions.drawBuffers===!0,extensionShaderTextureLOD:X&&E.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:h||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||r.has("EXT_shader_texture_lod"),customProgramCacheKey:E.customProgramCacheKey()}}function g(E){const R=[];if(E.shaderID?R.push(E.shaderID):(R.push(E.customVertexShaderID),R.push(E.customFragmentShaderID)),E.defines!==void 0)for(const I in E.defines)R.push(I),R.push(E.defines[I]);return E.isRawShaderMaterial===!1&&(w(R,E),S(R,E),R.push(n.outputEncoding)),R.push(E.customProgramCacheKey),R.join()}function w(E,R){E.push(R.precision),E.push(R.outputEncoding),E.push(R.envMapMode),E.push(R.envMapCubeUVHeight),E.push(R.mapUv),E.push(R.alphaMapUv),E.push(R.lightMapUv),E.push(R.aoMapUv),E.push(R.bumpMapUv),E.push(R.normalMapUv),E.push(R.displacementMapUv),E.push(R.emissiveMapUv),E.push(R.metalnessMapUv),E.push(R.roughnessMapUv),E.push(R.clearcoatMapUv),E.push(R.clearcoatNormalMapUv),E.push(R.clearcoatRoughnessMapUv),E.push(R.iridescenceMapUv),E.push(R.iridescenceThicknessMapUv),E.push(R.sheenColorMapUv),E.push(R.sheenRoughnessMapUv),E.push(R.specularMapUv),E.push(R.specularColorMapUv),E.push(R.specularIntensityMapUv),E.push(R.transmissionMapUv),E.push(R.thicknessMapUv),E.push(R.combine),E.push(R.fogExp2),E.push(R.sizeAttenuation),E.push(R.morphTargetsCount),E.push(R.morphAttributeCount),E.push(R.numDirLights),E.push(R.numPointLights),E.push(R.numSpotLights),E.push(R.numSpotLightMaps),E.push(R.numHemiLights),E.push(R.numRectAreaLights),E.push(R.numDirLightShadows),E.push(R.numPointLightShadows),E.push(R.numSpotLightShadows),E.push(R.numSpotLightShadowsWithMaps),E.push(R.shadowMapType),E.push(R.toneMapping),E.push(R.numClippingPlanes),E.push(R.numClipIntersection),E.push(R.depthPacking)}function S(E,R){a.disableAll(),R.isWebGL2&&a.enable(0),R.supportsVertexTextures&&a.enable(1),R.instancing&&a.enable(2),R.instancingColor&&a.enable(3),R.matcap&&a.enable(4),R.envMap&&a.enable(5),R.normalMapObjectSpace&&a.enable(6),R.normalMapTangentSpace&&a.enable(7),R.clearcoat&&a.enable(8),R.iridescence&&a.enable(9),R.alphaTest&&a.enable(10),R.vertexColors&&a.enable(11),R.vertexAlphas&&a.enable(12),R.vertexUvs2&&a.enable(13),R.vertexTangents&&a.enable(14),E.push(a.mask),a.disableAll(),R.fog&&a.enable(0),R.useFog&&a.enable(1),R.flatShading&&a.enable(2),R.logarithmicDepthBuffer&&a.enable(3),R.skinning&&a.enable(4),R.morphTargets&&a.enable(5),R.morphNormals&&a.enable(6),R.morphColors&&a.enable(7),R.premultipliedAlpha&&a.enable(8),R.shadowMapEnabled&&a.enable(9),R.useLegacyLights&&a.enable(10),R.doubleSided&&a.enable(11),R.flipSided&&a.enable(12),R.useDepthPacking&&a.enable(13),R.dithering&&a.enable(14),R.transmission&&a.enable(15),R.sheen&&a.enable(16),R.decodeVideoTexture&&a.enable(17),R.opaque&&a.enable(18),R.pointsUvs&&a.enable(19),E.push(a.mask)}function M(E){const R=v[E.type];let I;if(R){const V=rs[R];I=bA.clone(V.uniforms)}else I=E.uniforms;return I}function C(E,R){let I;for(let V=0,H=u.length;V0?r.push(g):m.transparent===!0?i.push(g):t.push(g)}function l(d,p,m,v,x,_){const g=o(d,p,m,v,x,_);m.transmission>0?r.unshift(g):m.transparent===!0?i.unshift(g):t.unshift(g)}function u(d,p){t.length>1&&t.sort(d||q6),r.length>1&&r.sort(p||XT),i.length>1&&i.sort(p||XT)}function h(){for(let d=e,p=n.length;d=s.length?(o=new KT,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function eV(){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 F,color:new Ce};break;case"SpotLight":t={position:new F,direction:new F,color:new Ce,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Ce,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Ce,groundColor:new Ce};break;case"RectAreaLight":t={color:new Ce,position:new F,halfWidth:new F,halfHeight:new F};break}return n[e.id]=t,t}}}function tV(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new me};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new me};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new me,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let nV=0;function rV(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function iV(n,e){const t=new eV,r=tV(),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 h=0;h<9;h++)i.probe.push(new F);const s=new F,o=new ot,a=new ot;function l(h,d){let p=0,m=0,v=0;for(let I=0;I<9;I++)i.probe[I].set(0,0,0);let x=0,_=0,g=0,w=0,S=0,M=0,C=0,P=0,L=0,B=0;h.sort(rV);const E=d===!0?Math.PI:1;for(let I=0,V=h.length;I0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Te.LTC_FLOAT_1,i.rectAreaLTC2=Te.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Te.LTC_HALF_1,i.rectAreaLTC2=Te.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 R=i.hash;(R.directionalLength!==x||R.pointLength!==_||R.spotLength!==g||R.rectAreaLength!==w||R.hemiLength!==S||R.numDirectionalShadows!==M||R.numPointShadows!==C||R.numSpotShadows!==P||R.numSpotMaps!==L)&&(i.directional.length=x,i.spot.length=g,i.rectArea.length=w,i.point.length=_,i.hemi.length=S,i.directionalShadow.length=M,i.directionalShadowMap.length=M,i.pointShadow.length=C,i.pointShadowMap.length=C,i.spotShadow.length=P,i.spotShadowMap.length=P,i.directionalShadowMatrix.length=M,i.pointShadowMatrix.length=C,i.spotLightMatrix.length=P+L-B,i.spotLightMap.length=L,i.numSpotLightShadowsWithMaps=B,R.directionalLength=x,R.pointLength=_,R.spotLength=g,R.rectAreaLength=w,R.hemiLength=S,R.numDirectionalShadows=M,R.numPointShadows=C,R.numSpotShadows=P,R.numSpotMaps=L,i.version=nV++)}function u(h,d){let p=0,m=0,v=0,x=0,_=0;const g=d.matrixWorldInverse;for(let w=0,S=h.length;w=a.length?(l=new YT(n,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class TA extends Bn{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=OD,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 PA extends Bn{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 oV=`void main() { gl_Position = vec4( position, 1.0 ); }`,aV=`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 lV(n,e,t){let r=new bv;const i=new me,s=new me,o=new Lt,a=new TA({depthPacking:kD}),l=new PA,u={},h=t.maxTextureSize,d={[Is]:Mr,[Mr]:Is,[Pi]:Pi},p=new Oi({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new me},radius:{value:4}},vertexShader:oV,fragmentShader:aV}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const v=new ht;v.setAttribute("position",new Nt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const x=new Rn(v,p),_=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=_v,this.render=function(M,C,P){if(_.enabled===!1||_.autoUpdate===!1&&_.needsUpdate===!1||M.length===0)return;const L=n.getRenderTarget(),B=n.getActiveCubeFace(),E=n.getActiveMipmapLevel(),R=n.state;R.setBlending(co),R.buffers.color.setClear(1,1,1,1),R.buffers.depth.setTest(!0),R.setScissorTest(!1);for(let I=0,V=M.length;Ih||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/J.x),i.x=s.x*J.x,W.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/J.y),i.y=s.y*J.y,W.mapSize.y=s.y)),W.map===null){const ue=this.type!==ml?{minFilter:yn,magFilter:yn}:{};W.map=new li(i.x,i.y,ue),W.map.texture.name=H.name+".shadowMap",W.camera.updateProjectionMatrix()}n.setRenderTarget(W.map),n.clear();const re=W.getViewportCount();for(let ue=0;ue0||C.map&&C.alphaTest>0){const R=B.uuid,I=C.uuid;let V=u[R];V===void 0&&(V={},u[R]=V);let H=V[I];H===void 0&&(H=B.clone(),V[I]=H),B=H}if(B.visible=C.visible,B.wireframe=C.wireframe,L===ml?B.side=C.shadowSide!==null?C.shadowSide:C.side:B.side=C.shadowSide!==null?C.shadowSide:d[C.side],B.alphaMap=C.alphaMap,B.alphaTest=C.alphaTest,B.map=C.map,B.clipShadows=C.clipShadows,B.clippingPlanes=C.clippingPlanes,B.clipIntersection=C.clipIntersection,B.displacementMap=C.displacementMap,B.displacementScale=C.displacementScale,B.displacementBias=C.displacementBias,B.wireframeLinewidth=C.wireframeLinewidth,B.linewidth=C.linewidth,P.isPointLight===!0&&B.isMeshDistanceMaterial===!0){const R=n.properties.get(B);R.light=P}return B}function S(M,C,P,L,B){if(M.visible===!1)return;if(M.layers.test(C.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&B===ml)&&(!M.frustumCulled||r.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,M.matrixWorld);const I=e.update(M),V=M.material;if(Array.isArray(V)){const H=I.groups;for(let W=0,J=H.length;W=1):U.indexOf("OpenGL ES")!==-1&&(ue=parseFloat(/^OpenGL ES (\d)/.exec(U)[1]),re=ue>=2);let $=null,j={};const se=n.getParameter(3088),ee=n.getParameter(2978),ne=new Lt().fromArray(se),ie=new Lt().fromArray(ee);function Me(X,he,Se){const De=new Uint8Array(4),je=n.createTexture();n.bindTexture(X,je),n.texParameteri(X,10241,9728),n.texParameteri(X,10240,9728);for(let Ht=0;Ht"u"?!1:/OculusBrowser/g.test(navigator.userAgent),v=new WeakMap;let x;const _=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function w(G,D){return g?new OffscreenCanvas(G,D):Pd("canvas")}function S(G,D,oe,xe){let we=1;if((G.width>xe||G.height>xe)&&(we=xe/Math.max(G.width,G.height)),we<1||D===!0)if(typeof HTMLImageElement<"u"&&G instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&G instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&G instanceof ImageBitmap){const Be=D?zD:Math.floor,nt=Be(we*G.width),Fe=Be(we*G.height);x===void 0&&(x=w(nt,Fe));const de=oe?w(nt,Fe):x;return de.width=nt,de.height=Fe,de.getContext("2d").drawImage(G,0,0,nt,Fe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+G.width+"x"+G.height+") to ("+nt+"x"+Fe+")."),de}else return"data"in G&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+G.width+"x"+G.height+")."),G;return G}function M(G){return AS(G.width)&&AS(G.height)}function C(G){return a?!1:G.wrapS!==er||G.wrapT!==er||G.minFilter!==yn&&G.minFilter!==Zt}function P(G,D){return G.generateMipmaps&&D&&G.minFilter!==yn&&G.minFilter!==Zt}function L(G){n.generateMipmap(G)}function B(G,D,oe,xe,we=!1){if(a===!1)return D;if(G!==null){if(n[G]!==void 0)return n[G];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+G+"'")}let Be=D;return D===6403&&(oe===5126&&(Be=33326),oe===5131&&(Be=33325),oe===5121&&(Be=33321)),D===33319&&(oe===5126&&(Be=33328),oe===5131&&(Be=33327),oe===5121&&(Be=33323)),D===6408&&(oe===5126&&(Be=34836),oe===5131&&(Be=34842),oe===5121&&(Be=xe===Ct&&we===!1?35907:32856),oe===32819&&(Be=32854),oe===32820&&(Be=32855)),(Be===33325||Be===33326||Be===33327||Be===33328||Be===34842||Be===34836)&&e.get("EXT_color_buffer_float"),Be}function E(G,D,oe){return P(G,oe)===!0||G.isFramebufferTexture&&G.minFilter!==yn&&G.minFilter!==Zt?Math.log2(Math.max(D.width,D.height))+1:G.mipmaps!==void 0&&G.mipmaps.length>0?G.mipmaps.length:G.isCompressedTexture&&Array.isArray(G.image)?D.mipmaps.length:1}function R(G){return G===yn||G===Cd||G===Bc?9728:9729}function I(G){const D=G.target;D.removeEventListener("dispose",I),H(D),D.isVideoTexture&&v.delete(D)}function V(G){const D=G.target;D.removeEventListener("dispose",V),J(D)}function H(G){const D=r.get(G);if(D.__webglInit===void 0)return;const oe=G.source,xe=_.get(oe);if(xe){const we=xe[D.__cacheKey];we.usedTimes--,we.usedTimes===0&&W(G),Object.keys(xe).length===0&&_.delete(oe)}r.remove(G)}function W(G){const D=r.get(G);n.deleteTexture(D.__webglTexture);const oe=G.source,xe=_.get(oe);delete xe[D.__cacheKey],o.memory.textures--}function J(G){const D=G.texture,oe=r.get(G),xe=r.get(D);if(xe.__webglTexture!==void 0&&(n.deleteTexture(xe.__webglTexture),o.memory.textures--),G.depthTexture&&G.depthTexture.dispose(),G.isWebGLCubeRenderTarget)for(let we=0;we<6;we++)n.deleteFramebuffer(oe.__webglFramebuffer[we]),oe.__webglDepthbuffer&&n.deleteRenderbuffer(oe.__webglDepthbuffer[we]);else{if(n.deleteFramebuffer(oe.__webglFramebuffer),oe.__webglDepthbuffer&&n.deleteRenderbuffer(oe.__webglDepthbuffer),oe.__webglMultisampledFramebuffer&&n.deleteFramebuffer(oe.__webglMultisampledFramebuffer),oe.__webglColorRenderbuffer)for(let we=0;we=l&&console.warn("THREE.WebGLTextures: Trying to use "+G+" texture units while this GPU supports only "+l),re+=1,G}function $(G){const D=[];return D.push(G.wrapS),D.push(G.wrapT),D.push(G.wrapR||0),D.push(G.magFilter),D.push(G.minFilter),D.push(G.anisotropy),D.push(G.internalFormat),D.push(G.format),D.push(G.type),D.push(G.generateMipmaps),D.push(G.premultiplyAlpha),D.push(G.flipY),D.push(G.unpackAlignment),D.push(G.encoding),D.join()}function j(G,D){const oe=r.get(G);if(G.isVideoTexture&&ut(G),G.isRenderTargetTexture===!1&&G.version>0&&oe.__version!==G.version){const xe=G.image;if(xe===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(xe.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{qe(oe,G,D);return}}t.bindTexture(3553,oe.__webglTexture,33984+D)}function se(G,D){const oe=r.get(G);if(G.version>0&&oe.__version!==G.version){qe(oe,G,D);return}t.bindTexture(35866,oe.__webglTexture,33984+D)}function ee(G,D){const oe=r.get(G);if(G.version>0&&oe.__version!==G.version){qe(oe,G,D);return}t.bindTexture(32879,oe.__webglTexture,33984+D)}function ne(G,D){const oe=r.get(G);if(G.version>0&&oe.__version!==G.version){Je(oe,G,D);return}t.bindTexture(34067,oe.__webglTexture,33984+D)}const ie={[Sa]:10497,[er]:33071,[jc]:33648},Me={[yn]:9728,[Cd]:9984,[Bc]:9986,[Zt]:9729,[wv]:9985,[Ds]:9987};function ye(G,D,oe){if(oe?(n.texParameteri(G,10242,ie[D.wrapS]),n.texParameteri(G,10243,ie[D.wrapT]),(G===32879||G===35866)&&n.texParameteri(G,32882,ie[D.wrapR]),n.texParameteri(G,10240,Me[D.magFilter]),n.texParameteri(G,10241,Me[D.minFilter])):(n.texParameteri(G,10242,33071),n.texParameteri(G,10243,33071),(G===32879||G===35866)&&n.texParameteri(G,32882,33071),(D.wrapS!==er||D.wrapT!==er)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(G,10240,R(D.magFilter)),n.texParameteri(G,10241,R(D.minFilter)),D.minFilter!==yn&&D.minFilter!==Zt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const xe=e.get("EXT_texture_filter_anisotropic");if(D.magFilter===yn||D.minFilter!==Bc&&D.minFilter!==Ds||D.type===ei&&e.has("OES_texture_float_linear")===!1||a===!1&&D.type===Li&&e.has("OES_texture_half_float_linear")===!1)return;(D.anisotropy>1||r.get(D).__currentAnisotropy)&&(n.texParameterf(G,xe.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(D.anisotropy,i.getMaxAnisotropy())),r.get(D).__currentAnisotropy=D.anisotropy)}}function q(G,D){let oe=!1;G.__webglInit===void 0&&(G.__webglInit=!0,D.addEventListener("dispose",I));const xe=D.source;let we=_.get(xe);we===void 0&&(we={},_.set(xe,we));const Be=$(D);if(Be!==G.__cacheKey){we[Be]===void 0&&(we[Be]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,oe=!0),we[Be].usedTimes++;const nt=we[G.__cacheKey];nt!==void 0&&(we[G.__cacheKey].usedTimes--,nt.usedTimes===0&&W(D)),G.__cacheKey=Be,G.__webglTexture=we[Be].texture}return oe}function qe(G,D,oe){let xe=3553;(D.isDataArrayTexture||D.isCompressedArrayTexture)&&(xe=35866),D.isData3DTexture&&(xe=32879);const we=q(G,D),Be=D.source;t.bindTexture(xe,G.__webglTexture,33984+oe);const nt=r.get(Be);if(Be.version!==nt.__version||we===!0){t.activeTexture(33984+oe),n.pixelStorei(37440,D.flipY),n.pixelStorei(37441,D.premultiplyAlpha),n.pixelStorei(3317,D.unpackAlignment),n.pixelStorei(37443,0);const Fe=C(D)&&M(D.image)===!1;let de=S(D.image,Fe,!1,h);de=Pt(D,de);const ze=M(de)||a,Ke=s.convert(D.format,D.encoding);let tt=s.convert(D.type),Ne=B(D.internalFormat,Ke,tt,D.encoding,D.isVideoTexture);ye(xe,D,ze);let We;const bt=D.mipmaps,kt=a&&D.isVideoTexture!==!0,ln=nt.__version===void 0||we===!0,X=E(D,de,ze);if(D.isDepthTexture)Ne=6402,a?D.type===ei?Ne=36012:D.type===sa?Ne=33190:D.type===Ml?Ne=35056:Ne=33189:D.type===ei&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),D.format===ma&&Ne===6402&&D.type!==gA&&D.type!==sa&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),D.type=sa,tt=s.convert(D.type)),D.format===Dl&&Ne===6402&&(Ne=34041,D.type!==Ml&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),D.type=Ml,tt=s.convert(D.type))),ln&&(kt?t.texStorage2D(3553,1,Ne,de.width,de.height):t.texImage2D(3553,0,Ne,de.width,de.height,0,Ke,tt,null));else if(D.isDataTexture)if(bt.length>0&&ze){kt&&ln&&t.texStorage2D(3553,X,Ne,bt[0].width,bt[0].height);for(let he=0,Se=bt.length;he>=1,Se>>=1}}else if(bt.length>0&&ze){kt&&ln&&t.texStorage2D(3553,X,Ne,bt[0].width,bt[0].height);for(let he=0,Se=bt.length;he0&&ln++,t.texStorage2D(34067,ln,We,de[0].width,de[0].height));for(let he=0;he<6;he++)if(Fe){bt?t.texSubImage2D(34069+he,0,0,0,de[he].width,de[he].height,tt,Ne,de[he].data):t.texImage2D(34069+he,0,We,de[he].width,de[he].height,0,tt,Ne,de[he].data);for(let Se=0;Se=34069&&we<=34074)&&n.framebufferTexture2D(36160,xe,we,r.get(oe).__webglTexture,0),t.bindFramebuffer(36160,null)}function Pe(G,D,oe){if(n.bindRenderbuffer(36161,G),D.depthBuffer&&!D.stencilBuffer){let xe=33189;if(oe||Xe(D)){const we=D.depthTexture;we&&we.isDepthTexture&&(we.type===ei?xe=36012:we.type===sa&&(xe=33190));const Be=et(D);Xe(D)?p.renderbufferStorageMultisampleEXT(36161,Be,xe,D.width,D.height):n.renderbufferStorageMultisample(36161,Be,xe,D.width,D.height)}else n.renderbufferStorage(36161,xe,D.width,D.height);n.framebufferRenderbuffer(36160,36096,36161,G)}else if(D.depthBuffer&&D.stencilBuffer){const xe=et(D);oe&&Xe(D)===!1?n.renderbufferStorageMultisample(36161,xe,35056,D.width,D.height):Xe(D)?p.renderbufferStorageMultisampleEXT(36161,xe,35056,D.width,D.height):n.renderbufferStorage(36161,34041,D.width,D.height),n.framebufferRenderbuffer(36160,33306,36161,G)}else{const xe=D.isWebGLMultipleRenderTargets===!0?D.texture:[D.texture];for(let we=0;we0&&Xe(G)===!1){const Fe=Be?D:[D];oe.__webglMultisampledFramebuffer=n.createFramebuffer(),oe.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,oe.__webglMultisampledFramebuffer);for(let de=0;de0&&Xe(G)===!1){const D=G.isWebGLMultipleRenderTargets?G.texture:[G.texture],oe=G.width,xe=G.height;let we=16384;const Be=[],nt=G.stencilBuffer?33306:36096,Fe=r.get(G),de=G.isWebGLMultipleRenderTargets===!0;if(de)for(let ze=0;ze0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&D.__useRenderToTexture!==!1}function ut(G){const D=o.render.frame;v.get(G)!==D&&(v.set(G,D),G.update())}function Pt(G,D){const oe=G.encoding,xe=G.format,we=G.type;return G.isCompressedTexture===!0||G.isVideoTexture===!0||G.format===O0||oe!==us&&(oe===Ct?a===!1?e.has("EXT_sRGB")===!0&&xe===Or?(G.format=O0,G.minFilter=Zt,G.generateMipmaps=!1):D=SA.sRGBToLinear(D):(xe!==Or||we!==_o)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",oe)),D}this.allocateTextureUnit=U,this.resetTextureUnits=ue,this.setTexture2D=j,this.setTexture2DArray=se,this.setTexture3D=ee,this.setTextureCube=ne,this.rebindTextures=ve,this.setupRenderTarget=ke,this.updateRenderTargetMipmap=Re,this.updateMultisampleRenderTarget=Ze,this.setupDepthRenderbuffer=le,this.setupFrameBufferTexture=_e,this.useMultisampledRTT=Xe}function QD(n,e,t){const r=t.isWebGL2;function i(s,o=null){let a;if(s===_o)return 5121;if(s===_D)return 32819;if(s===SD)return 32820;if(s===vD)return 5120;if(s===yD)return 5122;if(s===gA)return 5123;if(s===xD)return 5124;if(s===sa)return 5125;if(s===ei)return 5126;if(s===Li)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===wD)return 6406;if(s===Or)return 6408;if(s===AD)return 6409;if(s===MD)return 6410;if(s===ma)return 6402;if(s===Dl)return 34041;if(s===O0)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===bD)return 6403;if(s===CD)return 36244;if(s===ED)return 33319;if(s===TD)return 33320;if(s===PD)return 36249;if(s===t0||s===n0||s===r0||s===i0)if(o===Ct)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===t0)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===n0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===r0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===i0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===t0)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===n0)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===r0)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===i0)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===Z_||s===eS||s===tS||s===nS)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===Z_)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===eS)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===tS)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===nS)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===RD)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===rS||s===iS)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===rS)return o===Ct?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===iS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===sS||s===oS||s===aS||s===lS||s===uS||s===cS||s===fS||s===hS||s===dS||s===pS||s===mS||s===gS||s===vS||s===yS)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===sS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===oS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===aS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===lS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===uS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===cS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===fS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===hS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===dS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===pS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===mS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===gS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===vS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===yS)return o===Ct?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===s0)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===s0)return o===Ct?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===BD||s===xS||s===_S||s===SS)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===s0)return a.COMPRESSED_RED_RGTC1_EXT;if(s===xS)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===_S)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===SS)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Ml?r?34042:(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 qD extends Dn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class oo extends Bt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const fV={type:"move"};class i1{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new oo,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 oo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new oo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),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,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(const x of e.hand.values()){const _=t.getJointPose(x,r),g=this._getHandJoint(u,x);_!==null&&(g.matrix.fromArray(_.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.jointRadius=_.radius),g.visible=_!==null}const h=u.joints["index-finger-tip"],d=u.joints["thumb-tip"],p=h.position.distanceTo(d.position),m=.02,v=.005;u.inputState.pinching&&p>m+v?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&p<=m-v&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),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),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(fV)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new oo;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class ZD extends an{constructor(e,t,r,i,s,o,a,l,u,h){if(h=h!==void 0?h:ma,h!==ma&&h!==Dl)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&h===ma&&(r=sa),r===void 0&&h===Dl&&(r=Ml),super(null,i,s,o,a,l,h,r,u),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}}class hV extends bo{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,u=null,h=null,d=null,p=null,m=null,v=null;const x=t.getContextAttributes();let _=null,g=null;const w=[],S=[],M=new Set,C=new Map,P=new Dn;P.layers.enable(1),P.viewport=new Lt;const L=new Dn;L.layers.enable(2),L.viewport=new Lt;const B=[P,L],E=new qD;E.layers.enable(1),E.layers.enable(2);let R=null,I=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ne){let ie=w[ne];return ie===void 0&&(ie=new i1,w[ne]=ie),ie.getTargetRaySpace()},this.getControllerGrip=function(ne){let ie=w[ne];return ie===void 0&&(ie=new i1,w[ne]=ie),ie.getGripSpace()},this.getHand=function(ne){let ie=w[ne];return ie===void 0&&(ie=new i1,w[ne]=ie),ie.getHandSpace()};function V(ne){const ie=S.indexOf(ne.inputSource);if(ie===-1)return;const Me=w[ie];Me!==void 0&&Me.dispatchEvent({type:ne.type,data:ne.inputSource})}function H(){i.removeEventListener("select",V),i.removeEventListener("selectstart",V),i.removeEventListener("selectend",V),i.removeEventListener("squeeze",V),i.removeEventListener("squeezestart",V),i.removeEventListener("squeezeend",V),i.removeEventListener("end",H),i.removeEventListener("inputsourceschange",W);for(let ne=0;ne=0&&(S[ye]=null,w[ye].disconnect(Me))}for(let ie=0;ie=S.length){S.push(Me),ye=qe;break}else if(S[qe]===null){S[qe]=Me,ye=qe;break}if(ye===-1)break}const q=w[ye];q&&q.connect(Me)}}const J=new F,re=new F;function ue(ne,ie,Me){J.setFromMatrixPosition(ie.matrixWorld),re.setFromMatrixPosition(Me.matrixWorld);const ye=J.distanceTo(re),q=ie.projectionMatrix.elements,qe=Me.projectionMatrix.elements,Je=q[14]/(q[10]-1),_e=q[14]/(q[10]+1),Pe=(q[9]+1)/q[5],ge=(q[9]-1)/q[5],le=(q[8]-1)/q[0],ve=(qe[8]+1)/qe[0],ke=Je*le,Re=Je*ve,Ze=ye/(-le+ve),et=Ze*-le;ie.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(et),ne.translateZ(Ze),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert();const Xe=Je+Ze,ut=_e+Ze,Pt=ke-et,G=Re+(ye-et),D=Pe*_e/ut*Xe,oe=ge*_e/ut*Xe;ne.projectionMatrix.makePerspective(Pt,G,D,oe,Xe,ut),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}function U(ne,ie){ie===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(ie.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(i===null)return;E.near=L.near=P.near=ne.near,E.far=L.far=P.far=ne.far,(R!==E.near||I!==E.far)&&(i.updateRenderState({depthNear:E.near,depthFar:E.far}),R=E.near,I=E.far);const ie=ne.parent,Me=E.cameras;U(E,ie);for(let ye=0;yeq&&(C.set(ye,ye.lastChangedTime),r.dispatchEvent({type:"planechanged",data:ye}))}}v=null}const ee=new $D;ee.setAnimationLoop(se),this.setAnimationLoop=function(ne){j=ne},this.dispose=function(){}}}function dV(n,e){function t(_,g){_.matrixAutoUpdate===!0&&_.updateMatrix(),g.value.copy(_.matrix)}function r(_,g){g.color.getRGB(_.fogColor.value,WD(n)),g.isFog?(_.fogNear.value=g.near,_.fogFar.value=g.far):g.isFogExp2&&(_.fogDensity.value=g.density)}function i(_,g,w,S,M){g.isMeshBasicMaterial||g.isMeshLambertMaterial?s(_,g):g.isMeshToonMaterial?(s(_,g),d(_,g)):g.isMeshPhongMaterial?(s(_,g),h(_,g)):g.isMeshStandardMaterial?(s(_,g),p(_,g),g.isMeshPhysicalMaterial&&m(_,g,M)):g.isMeshMatcapMaterial?(s(_,g),v(_,g)):g.isMeshDepthMaterial?s(_,g):g.isMeshDistanceMaterial?(s(_,g),x(_,g)):g.isMeshNormalMaterial?s(_,g):g.isLineBasicMaterial?(o(_,g),g.isLineDashedMaterial&&a(_,g)):g.isPointsMaterial?l(_,g,w,S):g.isSpriteMaterial?u(_,g):g.isShadowMaterial?(_.color.value.copy(g.color),_.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function s(_,g){_.opacity.value=g.opacity,g.color&&_.diffuse.value.copy(g.color),g.emissive&&_.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(_.map.value=g.map,t(g.map,_.mapTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap,t(g.alphaMap,_.alphaMapTransform)),g.bumpMap&&(_.bumpMap.value=g.bumpMap,t(g.bumpMap,_.bumpMapTransform),_.bumpScale.value=g.bumpScale,g.side===Mr&&(_.bumpScale.value*=-1)),g.normalMap&&(_.normalMap.value=g.normalMap,t(g.normalMap,_.normalMapTransform),_.normalScale.value.copy(g.normalScale),g.side===Mr&&_.normalScale.value.negate()),g.displacementMap&&(_.displacementMap.value=g.displacementMap,t(g.displacementMap,_.displacementMapTransform),_.displacementScale.value=g.displacementScale,_.displacementBias.value=g.displacementBias),g.emissiveMap&&(_.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,_.emissiveMapTransform)),g.specularMap&&(_.specularMap.value=g.specularMap,t(g.specularMap,_.specularMapTransform)),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest);const w=e.get(g).envMap;if(w&&(_.envMap.value=w,_.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=g.reflectivity,_.ior.value=g.ior,_.refractionRatio.value=g.refractionRatio),g.lightMap){_.lightMap.value=g.lightMap;const S=n.useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=g.lightMapIntensity*S,t(g.lightMap,_.lightMapTransform)}g.aoMap&&(_.aoMap.value=g.aoMap,_.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,_.aoMapTransform))}function o(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,g.map&&(_.map.value=g.map,t(g.map,_.mapTransform))}function a(_,g){_.dashSize.value=g.dashSize,_.totalSize.value=g.dashSize+g.gapSize,_.scale.value=g.scale}function l(_,g,w,S){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.size.value=g.size*w,_.scale.value=S*.5,g.map&&(_.map.value=g.map,t(g.map,_.uvTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest)}function u(_,g){_.diffuse.value.copy(g.color),_.opacity.value=g.opacity,_.rotation.value=g.rotation,g.map&&(_.map.value=g.map,t(g.map,_.mapTransform)),g.alphaMap&&(_.alphaMap.value=g.alphaMap),g.alphaTest>0&&(_.alphaTest.value=g.alphaTest)}function h(_,g){_.specular.value.copy(g.specular),_.shininess.value=Math.max(g.shininess,1e-4)}function d(_,g){g.gradientMap&&(_.gradientMap.value=g.gradientMap)}function p(_,g){_.metalness.value=g.metalness,g.metalnessMap&&(_.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,_.metalnessMapTransform)),_.roughness.value=g.roughness,g.roughnessMap&&(_.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,_.roughnessMapTransform)),e.get(g).envMap&&(_.envMapIntensity.value=g.envMapIntensity)}function m(_,g,w){_.ior.value=g.ior,g.sheen>0&&(_.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),_.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(_.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,_.sheenColorMapTransform)),g.sheenRoughnessMap&&(_.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,_.sheenRoughnessMapTransform))),g.clearcoat>0&&(_.clearcoat.value=g.clearcoat,_.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(_.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,_.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(_.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===Mr&&_.clearcoatNormalScale.value.negate())),g.iridescence>0&&(_.iridescence.value=g.iridescence,_.iridescenceIOR.value=g.iridescenceIOR,_.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(_.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,_.iridescenceMapTransform)),g.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),g.transmission>0&&(_.transmission.value=g.transmission,_.transmissionSamplerMap.value=w.texture,_.transmissionSamplerSize.value.set(w.width,w.height),g.transmissionMap&&(_.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,_.transmissionMapTransform)),_.thickness.value=g.thickness,g.thicknessMap&&(_.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=g.attenuationDistance,_.attenuationColor.value.copy(g.attenuationColor)),_.specularIntensity.value=g.specularIntensity,_.specularColor.value.copy(g.specularColor),g.specularColorMap&&(_.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,_.specularColorMapTransform)),g.specularIntensityMap&&(_.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,_.specularIntensityMapTransform))}function v(_,g){g.matcap&&(_.matcap.value=g.matcap)}function x(_,g){const w=e.get(g).light;_.referencePosition.value.setFromMatrixPosition(w.matrixWorld),_.nearDistance.value=w.shadow.camera.near,_.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function pV(n,e,t,r){let i={},s={},o=[];const a=t.isWebGL2?n.getParameter(35375):0;function l(w,S){const M=S.program;r.uniformBlockBinding(w,M)}function u(w,S){let M=i[w.id];M===void 0&&(v(w),M=h(w),i[w.id]=M,w.addEventListener("dispose",_));const C=S.program;r.updateUBOMapping(w,C);const P=e.render.frame;s[w.id]!==P&&(p(w),s[w.id]=P)}function h(w){const S=d();w.__bindingPointIndex=S;const M=n.createBuffer(),C=w.__size,P=w.usage;return n.bindBuffer(35345,M),n.bufferData(35345,C,P),n.bindBuffer(35345,null),n.bindBufferBase(35345,S,M),M}function d(){for(let w=0;w0){P=M%C;const V=C-P;P!==0&&V-R.boundary<0&&(M+=C-P,E.__offset=M)}M+=R.storage}return P=M%C,P>0&&(M+=C-P),w.__size=M,w.__cache={},this}function x(w){const S={boundary:0,storage:0};return typeof w=="number"?(S.boundary=4,S.storage=4):w.isVector2?(S.boundary=8,S.storage=8):w.isVector3||w.isColor?(S.boundary=16,S.storage=12):w.isVector4?(S.boundary=16,S.storage=16):w.isMatrix3?(S.boundary=48,S.storage=48):w.isMatrix4?(S.boundary=64,S.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),S}function _(w){const S=w.target;S.removeEventListener("dispose",_);const M=o.indexOf(S.__bindingPointIndex);o.splice(M,1),n.deleteBuffer(i[S.id]),delete i[S.id],delete s[S.id]}function g(){for(const w in i)n.deleteBuffer(i[w]);o=[],i={},s={}}return{bind:l,update:u,dispose:g}}function mV(){const n=Pd("canvas");return n.style.display="block",n}class RA{constructor(e={}){const{canvas:t=mV(),context:r=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:d=!1}=e;this.isWebGLRenderer=!0;let p;r!==null?p=r.getContextAttributes().alpha:p=o;let m=null,v=null;const x=[],_=[];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.outputEncoding=us,this.useLegacyLights=!0,this.toneMapping=as,this.toneMappingExposure=1;const g=this;let w=!1,S=0,M=0,C=null,P=-1,L=null;const B=new Lt,E=new Lt;let R=null,I=t.width,V=t.height,H=1,W=null,J=null;const re=new Lt(0,0,I,V),ue=new Lt(0,0,I,V);let U=!1;const $=new bv;let j=!1,se=!1,ee=null;const ne=new ot,ie=new F,Me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ye(){return C===null?H:1}let q=r;function qe(O,te){for(let fe=0;fe0?v=_[_.length-1]:v=null,x.pop(),x.length>0?m=x[x.length-1]:m=null};function Un(O,te,fe,Q){if(O.visible===!1)return;if(O.layers.test(te.layers)){if(O.isGroup)fe=O.renderOrder;else if(O.isLOD)O.autoUpdate===!0&&O.update(te);else if(O.isLight)v.pushLight(O),O.castShadow&&v.pushShadow(O);else if(O.isSprite){if(!O.frustumCulled||$.intersectsSprite(O)){Q&&ie.setFromMatrixPosition(O.matrixWorld).applyMatrix4(ne);const st=Xe.update(O),at=O.material;at.visible&&m.push(O,st,at,fe,ie.z,null)}}else if((O.isMesh||O.isLine||O.isPoints)&&(O.isSkinnedMesh&&O.skeleton.frame!==ge.render.frame&&(O.skeleton.update(),O.skeleton.frame=ge.render.frame),!O.frustumCulled||$.intersectsObject(O))){Q&&ie.setFromMatrixPosition(O.matrixWorld).applyMatrix4(ne);const st=Xe.update(O),at=O.material;if(Array.isArray(at)){const dt=st.groups;for(let yt=0,xt=dt.length;yt0&&tn(pe,Ye,te,fe),Q&&Pe.viewport(B.copy(Q)),pe.length>0&&mr(pe,te,fe),Ye.length>0&&mr(Ye,te,fe),st.length>0&&mr(st,te,fe),Pe.buffers.depth.setTest(!0),Pe.buffers.depth.setMask(!0),Pe.buffers.color.setMask(!0),Pe.setPolygonOffset(!1)}function tn(O,te,fe,Q){if(ee===null){const at=_e.isWebGL2;ee=new li(1024,1024,{generateMipmaps:!0,type:Je.has("EXT_color_buffer_half_float")?Li:_o,minFilter:Ds,samples:at&&a===!0?4:0})}const pe=g.getRenderTarget();g.setRenderTarget(ee),g.clear();const Ye=g.toneMapping;g.toneMapping=as,mr(O,fe,Q),ve.updateMultisampleRenderTarget(ee),ve.updateRenderTargetMipmap(ee);let st=!1;for(let at=0,dt=te.length;at0&&ve.useMultisampledRTT(O)===!1?pe=le.get(O).__webglMultisampledFramebuffer:pe=xt,B.copy(O.viewport),E.copy(O.scissor),R=O.scissorTest}else B.copy(re).multiplyScalar(H).floor(),E.copy(ue).multiplyScalar(H).floor(),R=U;if(Pe.bindFramebuffer(36160,pe)&&_e.drawBuffers&&Q&&Pe.drawBuffers(O,pe),Pe.viewport(B),Pe.scissor(E),Pe.setScissorTest(R),Ye){const dt=le.get(O.texture);q.framebufferTexture2D(36160,36064,34069+te,dt.__webglTexture,fe)}else if(st){const dt=le.get(O.texture),yt=te||0;q.framebufferTextureLayer(36160,36064,dt.__webglTexture,fe||0,yt)}P=-1},this.readRenderTargetPixels=function(O,te,fe,Q,pe,Ye,st){if(!(O&&O.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let at=le.get(O).__webglFramebuffer;if(O.isWebGLCubeRenderTarget&&st!==void 0&&(at=at[st]),at){Pe.bindFramebuffer(36160,at);try{const dt=O.texture,yt=dt.format,xt=dt.type;if(yt!==Or&&de.convert(yt)!==q.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const St=xt===Li&&(Je.has("EXT_color_buffer_half_float")||_e.isWebGL2&&Je.has("EXT_color_buffer_float"));if(xt!==_o&&de.convert(xt)!==q.getParameter(35738)&&!(xt===ei&&(_e.isWebGL2||Je.has("OES_texture_float")||Je.has("WEBGL_color_buffer_float")))&&!St){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}te>=0&&te<=O.width-Q&&fe>=0&&fe<=O.height-pe&&q.readPixels(te,fe,Q,pe,de.convert(yt),de.convert(xt),Ye)}finally{const dt=C!==null?le.get(C).__webglFramebuffer:null;Pe.bindFramebuffer(36160,dt)}}},this.copyFramebufferToTexture=function(O,te,fe=0){const Q=Math.pow(2,-fe),pe=Math.floor(te.image.width*Q),Ye=Math.floor(te.image.height*Q);ve.setTexture2D(te,0),q.copyTexSubImage2D(3553,fe,0,0,O.x,O.y,pe,Ye),Pe.unbindTexture()},this.copyTextureToTexture=function(O,te,fe,Q=0){const pe=te.image.width,Ye=te.image.height,st=de.convert(fe.format),at=de.convert(fe.type);ve.setTexture2D(fe,0),q.pixelStorei(37440,fe.flipY),q.pixelStorei(37441,fe.premultiplyAlpha),q.pixelStorei(3317,fe.unpackAlignment),te.isDataTexture?q.texSubImage2D(3553,Q,O.x,O.y,pe,Ye,st,at,te.image.data):te.isCompressedTexture?q.compressedTexSubImage2D(3553,Q,O.x,O.y,te.mipmaps[0].width,te.mipmaps[0].height,st,te.mipmaps[0].data):q.texSubImage2D(3553,Q,O.x,O.y,st,at,te.image),Q===0&&fe.generateMipmaps&&q.generateMipmap(3553),Pe.unbindTexture()},this.copyTextureToTexture3D=function(O,te,fe,Q,pe=0){if(g.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ye=O.max.x-O.min.x+1,st=O.max.y-O.min.y+1,at=O.max.z-O.min.z+1,dt=de.convert(Q.format),yt=de.convert(Q.type);let xt;if(Q.isData3DTexture)ve.setTexture3D(Q,0),xt=32879;else if(Q.isDataArrayTexture)ve.setTexture2DArray(Q,0),xt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}q.pixelStorei(37440,Q.flipY),q.pixelStorei(37441,Q.premultiplyAlpha),q.pixelStorei(3317,Q.unpackAlignment);const St=q.getParameter(3314),Ut=q.getParameter(32878),Kn=q.getParameter(3316),Wr=q.getParameter(3315),zi=q.getParameter(32877),$t=fe.isCompressedTexture?fe.mipmaps[0]:fe.image;q.pixelStorei(3314,$t.width),q.pixelStorei(32878,$t.height),q.pixelStorei(3316,O.min.x),q.pixelStorei(3315,O.min.y),q.pixelStorei(32877,O.min.z),fe.isDataTexture||fe.isData3DTexture?q.texSubImage3D(xt,pe,te.x,te.y,te.z,Ye,st,at,dt,yt,$t.data):fe.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),q.compressedTexSubImage3D(xt,pe,te.x,te.y,te.z,Ye,st,at,dt,$t.data)):q.texSubImage3D(xt,pe,te.x,te.y,te.z,Ye,st,at,dt,yt,$t),q.pixelStorei(3314,St),q.pixelStorei(32878,Ut),q.pixelStorei(3316,Kn),q.pixelStorei(3315,Wr),q.pixelStorei(32877,zi),pe===0&&Q.generateMipmaps&&q.generateMipmap(xt),Pe.unbindTexture()},this.initTexture=function(O){O.isCubeTexture?ve.setTextureCube(O,0):O.isData3DTexture?ve.setTexture3D(O,0):O.isDataArrayTexture||O.isCompressedArrayTexture?ve.setTexture2DArray(O,0):ve.setTexture2D(O,0),Pe.unbindTexture()},this.resetState=function(){S=0,M=0,C=null,Pe.reset(),ze.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}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}}class eF extends RA{}eF.prototype.isWebGL1Renderer=!0;class Ev{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ce(e),this.density=t}clone(){return new Ev(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class Tv{constructor(e,t=1,r=1e3){this.isFog=!0,this.name="",this.color=new Ce(e),this.near=t,this.far=r}clone(){return new Tv(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Rd extends Bt{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 tp{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Td,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=oi()}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:ah.clone(),uv:Fr.getInterpolation(ah,ug,uh,cg,QT,s1,qT,new me),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function fg(n,e,t,r,i,s){Fu.subVectors(n,t).addScalar(.5).multiply(r),i!==void 0?(lh.x=s*Fu.x-i*Fu.y,lh.y=i*Fu.x+s*Fu.y):lh.copy(Fu),n.copy(e),n.x+=lh.x,n.y+=lh.y,n.applyMatrix4(tF)}const hg=new F,ZT=new F;class rF extends Bt{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){hg.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(hg);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){hg.setFromMatrixPosition(e.matrixWorld),ZT.setFromMatrixPosition(this.matrixWorld);const r=hg.distanceTo(ZT)/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:S,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),w=Math.min(_.count,o.start+o.count);for(let S=g,M=w-1;Sl)continue;p.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(p);Pe.far||t.push({distance:P,point:d.clone().applyMatrix4(this.matrixWorld),index:S,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:u,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class xV extends an{constructor(e,t,r,i,s,o,a,l,u){super(e,t,r,i,s,o,a,l,u),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Zt,this.magFilter=s!==void 0?s:Zt,this.generateMipmaps=!1;const h=this;function d(){h.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 _V extends an{constructor(e,t,r){super({width:e,height:t}),this.isFramebufferTexture=!0,this.format=r,this.magFilter=yn,this.minFilter=yn,this.generateMipmaps=!1,this.needsUpdate=!0}}class FA extends an{constructor(e,t,r,i,s,o,a,l,u,h,d,p){super(null,o,a,l,u,h,i,s,d,p),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class SV extends FA{constructor(e,t,r,i,s,o){super(e,t,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=er}}class wV extends an{constructor(e,t,r,i,s,o,a,l,u){super(e,t,r,i,s,o,a,l,u),this.isCanvasTexture=!0,this.needsUpdate=!0}}class fs{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,u;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),u=r[i]-o,u<0)a=i+1;else if(u>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const h=r[i],p=r[i+1]-h,m=(o-h)/p;return(i+m)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new me:new F);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 F,i=[],s=[],o=[],a=new F,l=new ot;for(let m=0;m<=e;m++){const v=m/e;i[m]=this.getTangentAt(v,new F)}s[0]=new F,o[0]=new F;let u=Number.MAX_VALUE;const h=Math.abs(i[0].x),d=Math.abs(i[0].y),p=Math.abs(i[0].z);h<=u&&(u=h,r.set(1,0,0)),d<=u&&(u=d,r.set(0,1,0)),p<=u&&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(xn(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(xn(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.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Bv extends fs{constructor(e=0,t=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const r=t||new me,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let u,h;this.closed||a>0?u=i[(a-1)%s]:(vg.subVectors(i[0],i[1]).add(i[0]),u=vg);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(p2(a,l.x,u.x,h.x,d.x),p2(a,l.y,u.y,h.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(),u=l===0?0:1-o/l;return a.getPointAt(u,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let 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=u.getPoint(0);d.equals(this.currentPoint)||this.lineTo(d.x,d.y)}this.curves.push(u);const h=u.getPoint(1);return this.currentPoint.copy(h),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 df extends ht{constructor(e=[new me(0,-.5),new me(.5,0),new me(0,.5)],t=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=Math.floor(t),i=xn(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],u=[],h=1/t,d=new F,p=new me,m=new F,v=new F,x=new F;let _=0,g=0;for(let w=0;w<=e.length-1;w++)switch(w){case 0:_=e[w+1].x-e[w].x,g=e[w+1].y-e[w].y,m.x=g*1,m.y=-_,m.z=g*0,x.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(x.x,x.y,x.z);break;default:_=e[w+1].x-e[w].x,g=e[w+1].y-e[w].y,m.x=g*1,m.y=-_,m.z=g*0,v.copy(m),m.x+=x.x,m.y+=x.y,m.z+=x.z,m.normalize(),l.push(m.x,m.y,m.z),x.copy(v)}for(let w=0;w<=t;w++){const S=r+w*h*i,M=Math.sin(S),C=Math.cos(S);for(let P=0;P<=e.length-1;P++){d.x=e[P].x*M,d.y=e[P].y,d.z=e[P].x*C,o.push(d.x,d.y,d.z),p.x=w/t,p.y=P/(e.length-1),a.push(p.x,p.y);const L=l[3*P+0]*M,B=l[3*P+1],E=l[3*P+0]*C;u.push(L,B,E)}}for(let w=0;w0&&S(!0),t>0&&S(!1)),this.setIndex(h),this.setAttribute("position",new Ge(d,3)),this.setAttribute("normal",new Ge(p,3)),this.setAttribute("uv",new Ge(m,2));function w(){const M=new F,C=new F;let P=0;const L=(t-e)/r;for(let B=0;B<=s;B++){const E=[],R=B/s,I=R*(t-e)+e;for(let V=0;V<=i;V++){const H=V/i,W=H*l+a,J=Math.sin(W),re=Math.cos(W);C.x=I*J,C.y=-R*r+_,C.z=I*re,d.push(C.x,C.y,C.z),M.set(J,L,re).normalize(),p.push(M.x,M.y,M.z),m.push(H,1-R),E.push(v++)}x.push(E)}for(let B=0;B.9&&L<.1&&(S<.2&&(o[w+0]+=1),M<.2&&(o[w+2]+=1),C<.2&&(o[w+4]+=1))}}function p(w){s.push(w.x,w.y,w.z)}function m(w,S){const M=w*3;S.x=e[M+0],S.y=e[M+1],S.z=e[M+2]}function v(){const w=new F,S=new F,M=new F,C=new F,P=new me,L=new me,B=new me;for(let E=0,R=0;E80*t){a=u=n[0],l=h=n[1];for(let v=t;vu&&(u=d),p>h&&(h=p);m=Math.max(u-a,h-l),m=m!==0?32767/m:0}return Ld(s,o,t,a,l,m,0),o}};function fF(n,e,t,r,i){let s,o;if(i===$V(n,e,t,r)>0)for(s=e;s=e;s-=r)o=m2(s,n[s],n[s+1],o);return o&&Iv(o,o.next)&&(Dd(o),o=o.next),o}function Ol(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(Iv(t,t.next)||fn(t.prev,t,t.next)===0)){if(Dd(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Ld(n,e,t,r,i,s,o){if(!n)return;!o&&s&&GV(n,r,i,s);let a=n,l,u;for(;n.prev!==n.next;){if(l=n.prev,u=n.next,s?LV(n,r,i,s):BV(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(u.i/t|0),Dd(n),n=u.next,a=u.next;continue}if(n=u,n===a){o?o===1?(n=IV(Ol(n),e,t),Ld(n,e,t,r,i,s,2)):o===2&&DV(n,e,t,r,i,s):Ld(Ol(n),e,t,r,i,s,1);break}}}function BV(n){const e=n.prev,t=n,r=n.next;if(fn(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,u=r.y,h=is?i>o?i:o:s>o?s:o,m=a>l?a>u?a:u:l>u?l:u;let v=r.next;for(;v!==e;){if(v.x>=h&&v.x<=p&&v.y>=d&&v.y<=m&&Sc(i,a,s,l,o,u,v.x,v.y)&&fn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function LV(n,e,t,r){const i=n.prev,s=n,o=n.next;if(fn(i,s,o)>=0)return!1;const a=i.x,l=s.x,u=o.x,h=i.y,d=s.y,p=o.y,m=al?a>u?a:u:l>u?l:u,_=h>d?h>p?h:p:d>p?d:p,g=ES(m,v,e,t,r),w=ES(x,_,e,t,r);let S=n.prevZ,M=n.nextZ;for(;S&&S.z>=g&&M&&M.z<=w;){if(S.x>=m&&S.x<=x&&S.y>=v&&S.y<=_&&S!==i&&S!==o&&Sc(a,h,l,d,u,p,S.x,S.y)&&fn(S.prev,S,S.next)>=0||(S=S.prevZ,M.x>=m&&M.x<=x&&M.y>=v&&M.y<=_&&M!==i&&M!==o&&Sc(a,h,l,d,u,p,M.x,M.y)&&fn(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;S&&S.z>=g;){if(S.x>=m&&S.x<=x&&S.y>=v&&S.y<=_&&S!==i&&S!==o&&Sc(a,h,l,d,u,p,S.x,S.y)&&fn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;M&&M.z<=w;){if(M.x>=m&&M.x<=x&&M.y>=v&&M.y<=_&&M!==i&&M!==o&&Sc(a,h,l,d,u,p,M.x,M.y)&&fn(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function IV(n,e,t){let r=n;do{const i=r.prev,s=r.next.next;!Iv(i,s)&&hF(i,r,r.next,s)&&Id(i,s)&&Id(s,i)&&(e.push(i.i/t|0),e.push(r.i/t|0),e.push(s.i/t|0),Dd(r),Dd(r.next),r=n=s),r=r.next}while(r!==n);return Ol(r)}function DV(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&VV(o,a)){let l=dF(o,a);o=Ol(o,o.next),l=Ol(l,l.next),Ld(o,e,t,r,i,s,0),Ld(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function FV(n,e,t,r){const i=[];let s,o,a,l,u;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&&Sc(oi.x||t.x===i.x&&UV(i,t)))&&(i=t,h=d)),t=t.next;while(t!==a);return i}function UV(n,e){return fn(n.prev,n,e.prev)<0&&fn(e.next,n,n.next)<0}function GV(n,e,t,r){let i=n;do i.z===0&&(i.z=ES(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,zV(i)}function zV(n){let e,t,r,i,s,o,a,l,u=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,u*=2}while(o>1);return n}function ES(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 HV(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 VV(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!WV(n,e)&&(Id(n,e)&&Id(e,n)&&jV(n,e)&&(fn(n.prev,n,e.prev)||fn(n,e.prev,e))||Iv(n,e)&&fn(n.prev,n,n.next)>0&&fn(e.prev,e,e.next)>0)}function fn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Iv(n,e){return n.x===e.x&&n.y===e.y}function hF(n,e,t,r){const i=wg(fn(n,e,t)),s=wg(fn(n,e,r)),o=wg(fn(t,r,n)),a=wg(fn(t,r,e));return!!(i!==s&&o!==a||i===0&&Sg(n,t,e)||s===0&&Sg(n,r,e)||o===0&&Sg(t,n,r)||a===0&&Sg(t,e,r))}function Sg(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 wg(n){return n>0?1:n<0?-1:0}function WV(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&&hF(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Id(n,e){return fn(n.prev,n,n.next)<0?fn(n,e,n.next)>=0&&fn(n,n.prev,e)>=0:fn(n,e,n.prev)<0||fn(n,n.next,e)<0}function jV(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 dF(n,e){const t=new TS(n.i,n.x,n.y),r=new TS(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 m2(n,e,t,r){const i=new TS(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 Dd(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 TS(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 $V(n,e,t,r){let i=0;for(let s=e,o=t-r;s2&&n[e-1].equals(n[0])&&n.pop()}function v2(n,e){for(let t=0;tNumber.EPSILON){const oe=Math.sqrt(G),xe=Math.sqrt(ut*ut+Pt*Pt),we=le.x-Xe/oe,Be=le.y+et/oe,nt=ve.x-Pt/xe,Fe=ve.y+ut/xe,de=((nt-we)*Pt-(Fe-Be)*ut)/(et*Pt-Xe*ut);ke=we+et*de-ge.x,Re=Be+Xe*de-ge.y;const ze=ke*ke+Re*Re;if(ze<=2)return new me(ke,Re);Ze=Math.sqrt(ze/2)}else{let oe=!1;et>Number.EPSILON?ut>Number.EPSILON&&(oe=!0):et<-Number.EPSILON?ut<-Number.EPSILON&&(oe=!0):Math.sign(Xe)===Math.sign(Pt)&&(oe=!0),oe?(ke=-Xe,Re=et,Ze=Math.sqrt(G)):(ke=et,Re=Xe,Ze=Math.sqrt(G/2))}return new me(ke/Ze,Re/Ze)}const $=[];for(let ge=0,le=W.length,ve=le-1,ke=ge+1;ge=0;ge--){const le=ge/_,ve=m*Math.cos(le*Math.PI/2),ke=v*Math.sin(le*Math.PI/2)+x;for(let Re=0,Ze=W.length;Re=0;){const ke=ve;let Re=ve-1;Re<0&&(Re=ge.length-1);for(let Ze=0,et=h+_*2;Ze0)&&m.push(S,M,P),(g!==r-1||l0!=e>0&&this.version++,this._sheen=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 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.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 vF extends Bn{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ce(16777215),this.specular=new Ce(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mo,this.normalScale=new me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Qd,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 yF extends Bn{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ce(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mo,this.normalScale=new me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class xF extends Bn{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mo,this.normalScale=new me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class HA extends Bn{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ce(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ce(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mo,this.normalScale=new me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Qd,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 _F extends Bn{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ce(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mo,this.normalScale=new me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class SF extends pr{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 Ci(n,e,t){return VA(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function xl(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 VA(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function wF(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 PS(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 WA(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 YV(n,e,t,r,i=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l=r)){d.push(u.times[m]);for(let x=0;xs.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[v]){const g=v*d+h,w=g+d-h;x=Ci(a.values,g,w)}else{const g=a.createInterpolant(),w=h,S=d-h;g.evaluate(s),x=Ci(g.resultBuffer,w,S)}l==="quaternion"&&new Xn().fromArray(x).normalize().conjugate().toArray(x);const _=u.times.length;for(let g=0;g<_;++g){const w=g*m+p;if(l==="quaternion")Xn.multiplyQuaternionsFlat(u.values,w,x,0,u.values,w);else{const S=m-p*2;for(let M=0;M=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=Ci(r,s,o),this.values=Ci(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&&VA(i))for(let a=0,l=i.length;a!==l;++a){const u=i[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),e=!1;break}}return e}optimize(){const e=Ci(this.times),t=Ci(this.values),r=this.getValueSize(),i=this.getInterpolation()===o0,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,u=0;u!==r;++u)t[l+u]=t[a+u];++o}return o!==e.length?(this.times=Ci(e,0,o),this.values=Ci(t,0,o*r)):(this.times=e,this.values=t),this}clone(){const e=Ci(this.times,0),t=Ci(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}hs.prototype.TimeBufferType=Float32Array;hs.prototype.ValueBufferType=Float32Array;hs.prototype.DefaultInterpolation=Fl;class Vl extends hs{}Vl.prototype.ValueTypeName="bool";Vl.prototype.ValueBufferType=Array;Vl.prototype.DefaultInterpolation=$c;Vl.prototype.InterpolantFactoryMethodLinear=void 0;Vl.prototype.InterpolantFactoryMethodSmooth=void 0;class $A extends hs{}$A.prototype.ValueTypeName="color";class Qc extends hs{}Qc.prototype.ValueTypeName="number";class bF extends yf{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 u=e*a;for(let h=u+a;u!==h;u+=4)Xn.slerpFlat(s,0,o,u-a,o,u,l);return s}}class Aa extends hs{InterpolantFactoryMethodLinear(e){return new bF(this.times,this.values,this.getValueSize(),e)}}Aa.prototype.ValueTypeName="quaternion";Aa.prototype.DefaultInterpolation=Fl;Aa.prototype.InterpolantFactoryMethodSmooth=void 0;class Wl extends hs{}Wl.prototype.ValueTypeName="string";Wl.prototype.ValueBufferType=Array;Wl.prototype.DefaultInterpolation=$c;Wl.prototype.InterpolantFactoryMethodLinear=void 0;Wl.prototype.InterpolantFactoryMethodSmooth=void 0;class qc extends hs{}qc.prototype.ValueTypeName="vector";class Zc{constructor(e,t=-1,r,i=Av){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=oi(),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(eW(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(hs.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const d=h[1];let p=i[d];p||(i[d]=p=[]),p.push(u)}}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 _=[],g=[];WA(m,_,g,v),_.length!==0&&x.push(new d(p,_,g))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const u=e.hierarchy||[];for(let d=0;d{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ks[e]!==void 0){Ks[e].push({onLoad:t,onProgress:r,onError:i});return}Ks[e]=[],Ks[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(u=>{if(u.status===200||u.status===0){if(u.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||u.body===void 0||u.body.getReader===void 0)return u;const h=Ks[e],d=u.body.getReader(),p=u.headers.get("Content-Length")||u.headers.get("X-File-Size"),m=p?parseInt(p):0,v=m!==0;let x=0;const _=new ReadableStream({start(g){w();function w(){d.read().then(({done:S,value:M})=>{if(S)g.close();else{x+=M.byteLength;const C=new ProgressEvent("progress",{lengthComputable:v,loaded:x,total:m});for(let P=0,L=h.length;P{switch(l){case"arraybuffer":return u.arrayBuffer();case"blob":return u.blob();case"document":return u.text().then(h=>new DOMParser().parseFromString(h,a));case"json":return u.json();default:if(a===void 0)return u.text();{const d=/charset="?([^;"\s]*)"?/i.exec(a),p=d&&d[1]?d[1].toLowerCase():void 0,m=new TextDecoder(p);return u.arrayBuffer().then(v=>m.decode(v))}}}).then(u=>{kl.add(e,u);const h=Ks[e];delete Ks[e];for(let d=0,p=h.length;d{const h=Ks[e];if(h===void 0)throw this.manager.itemError(e),u;delete Ks[e];for(let d=0,p=h.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 nW extends Er{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new ui(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 Ce().setHex(o.value);break;case"v2":i.uniforms[s].value=new me().fromArray(o.value);break;case"v3":i.uniforms[s].value=new F().fromArray(o.value);break;case"v4":i.uniforms[s].value=new Lt().fromArray(o.value);break;case"m3":i.uniforms[s].value=new At().fromArray(o.value);break;case"m4":i.uniforms[s].value=new ot().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.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new me().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new me().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.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:mF,SpriteMaterial:BA,RawShaderMaterial:gF,ShaderMaterial:Oi,PointsMaterial:Rv,MeshPhysicalMaterial:Eo,MeshStandardMaterial:vf,MeshPhongMaterial:vF,MeshToonMaterial:yF,MeshNormalMaterial:xF,MeshLambertMaterial:HA,MeshDepthMaterial:TA,MeshDistanceMaterial:PA,MeshBasicMaterial:ni,MeshMatcapMaterial:_F,LineDashedMaterial:SF,LineBasicMaterial:pr,Material:Bn};return new t[e]}}class Rs{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 JA(t);s=new Fd(l),s.setCrossOrigin(this.crossOrigin);for(let u=0,h=e.length;u0){i=new Fd(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=kl.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){kl.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let Ag;class qA{static getContext(){return Ag===void 0&&(Ag=new(window.AudioContext||window.webkitAudioContext)),Ag}static setContext(e){Ag=e}}class uW extends Er{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new ui(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{const l=a.slice(0);qA.getContext().decodeAudioData(l,function(h){t(h)})}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}}class cW extends Dv{constructor(e,t,r=1){super(void 0,r),this.isHemisphereLightProbe=!0;const i=new Ce().set(e),s=new Ce().set(t),o=new F(i.r,i.g,i.b),a=new F(s.r,s.g,s.b),l=Math.sqrt(Math.PI),u=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(u)}}class fW extends Dv{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const r=new Ce().set(e);this.sh.coefficients[0].set(r.r,r.g,r.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const b2=new ot,C2=new ot,Ka=new ot;class hW{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Dn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Dn,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,Ka.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(bl*t.fov*.5)/t.zoom;let a,l;C2.elements[12]=-i,b2.elements[12]=i,a=-o*t.aspect+s,l=o*t.aspect+s,Ka.elements[0]=2*t.near/(l-a),Ka.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Ka),a=-o*t.aspect-s,l=o*t.aspect-s,Ka.elements[0]=2*t.near/(l-a),Ka.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Ka)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(C2),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(b2)}}class ZA{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=E2(),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=E2();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function E2(){return(typeof performance>"u"?Date:performance).now()}const Ya=new F,T2=new Xn,dW=new F,Qa=new F;class pW extends Bt{constructor(){super(),this.type="AudioListener",this.context=qA.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new ZA}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(Ya,T2,dW),Qa.set(0,0,-1).applyQuaternion(T2),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Ya.x,i),t.positionY.linearRampToValueAtTime(Ya.y,i),t.positionZ.linearRampToValueAtTime(Ya.z,i),t.forwardX.linearRampToValueAtTime(Qa.x,i),t.forwardY.linearRampToValueAtTime(Qa.y,i),t.forwardZ.linearRampToValueAtTime(Qa.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(Ya.x,Ya.y,Ya.z),t.setOrientation(Qa.x,Qa.y,Qa.z,r.x,r.y,r.z)}}class OF extends Bt{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,u=t+t;l!==u;++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){Xn.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;Xn.multiplyQuaternionsFlat(e,o,e,t,e,r),Xn.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 eM="\\[\\]\\.:\\/",yW=new RegExp("["+eM+"]","g"),tM="[^"+eM+"]",xW="[^"+eM.replace("\\.","")+"]",_W=/((?:WC+[\/:])*)/.source.replace("WC",tM),SW=/(WCOD+)?/.source.replace("WCOD",xW),wW=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",tM),AW=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",tM),MW=new RegExp("^"+_W+SW+wW+AW+"$"),bW=["material","materials","bones","map"];class CW{constructor(e,t,r){const i=r||Rt.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 Rt{constructor(e,t,r){this.path=t,this.parsedPath=r||Rt.parseTrackName(t),this.node=Rt.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 Rt.Composite(e,t,r):new Rt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(yW,"")}static parseTrackName(e){const t=MW.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);bW.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]=h,e[h]=p,t[u]=d,e[d]=l;for(let m=0,v=i;m!==v;++m){const x=r[m],_=x[d],g=x[h];x[h]=_,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 u=arguments[a],h=u.uuid,d=t[h];if(d!==void 0)if(delete t[h],d0&&(t[m.uuid]=d),e[d]=m,e.pop();for(let v=0,x=i;v!==x;++v){const _=r[v];_[d]=_[p],_.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,u=l.length,h=this.nCachedObjects_,d=new Array(u);i=s.length,r[e]=i,o.push(e),a.push(t),s.push(d);for(let p=h,m=l.length;p!==m;++p){const v=l[p];d[p]=new Rt(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],u=e[a];t[u]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class NF{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:gl,endingEnd:gl};for(let u=0;u!==o;++u){const h=s[u].createInterpolant(null);a[u]=h,h.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=ID,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,u=a.sampleValues;return l[0]=s,l[1]=s+r,u[0]=e/o,u[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,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,u=this._propertyBindings;switch(this.blendMode){case vA:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(o),u[h].accumulateAdditive(a);break;case Av:default:for(let h=0,d=l.length;h!==d;++h)l[h].evaluate(o),u[h].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===DD;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===LD){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 u=e<0;this._setEndings(u,!u,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=vl,i.endingEnd=vl):(e?i.endingStart=this.zeroSlopeAtStart?vl:gl:i.endingStart=Ed,t?i.endingEnd=this.zeroSlopeAtEnd?vl:gl:i.endingEnd=Ed)}_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 TW=new Float32Array(1);class PW extends bo{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,u=this._bindingsByRootAndName;let h=u[l];h===void 0&&(h={},u[l]=h);for(let d=0;d!==s;++d){const p=i[d],m=p.name;let v=h[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 kF(Rt.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 u=0;u!==r;++u)t[u]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let u=0;u!==l;++u)a[u].apply(o);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,B2).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 L2=new F,Mg=new F;class OW{constructor(e=new F,t=new F){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){L2.subVectors(e,this.start),Mg.subVectors(this.end,this.start);const r=Mg.dot(Mg);let s=Mg.dot(L2)/r;return t&&(s=xn(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 I2=new F;class kW extends Bt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const r=new ht,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{N2.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(N2,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 YW extends cs{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 ht;i.setAttribute("position",new Ge(t,3)),i.setAttribute("color",new Ge(r,3));const s=new pr({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,r){const i=new Ce,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 QW{constructor(){this.type="ShapePath",this.color=new Ce,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Bd,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 w=[];for(let S=0,M=g.length;SNumber.EPSILON){if(R<0&&(L=w[P],E=-E,B=w[C],R=-R),g.yB.y)continue;if(g.y===L.y){if(g.x===L.x)return!0}else{const I=R*(g.x-L.x)-E*(g.y-L.y);if(I===0)return!0;if(I<0)continue;M=!M}}else{if(g.y!==L.y)continue;if(B.x<=g.x&&g.x<=L.x||L.x<=g.x&&g.x<=B.x)return!0}}return M}const i=Ps.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const u=[];if(s.length===1)return a=s[0],l=new El,l.curves=a.curves,u.push(l),u;let h=!i(s[0].getPoints());h=e?!h:h;const d=[],p=[];let m=[],v=0,x;p[v]=void 0,m[v]=[];for(let g=0,w=s.length;g1){let g=!1,w=0;for(let S=0,M=p.length;S0&&g===!1&&(m=d)}let _;for(let g=0,w=p.length;g{const d=typeof u=="function"?u(e):u;if(d!==e){const p=e;e=h?d:Object.assign({},e,d),t.forEach(m=>m(e,p))}},i=()=>e,s=(u,h=i,d=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=h(e);function m(){const v=h(e);if(!d(p,v)){const x=p;u(p=v,x)}}return t.add(m),()=>t.delete(m)},l={setState:r,getState:i,subscribe:(u,h,d)=>h||d?s(u,h,d):(t.add(u),()=>t.delete(u)),destroy:()=>t.clear()};return e=n(r,i,l),l}const _7=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),U2=_7?z.useEffect:z.useLayoutEffect;function zF(n){const e=typeof n=="function"?x7(n):n,t=(r=e.getState,i=Object.is)=>{const[,s]=z.useReducer(_=>_+1,0),o=e.getState(),a=z.useRef(o),l=z.useRef(r),u=z.useRef(i),h=z.useRef(!1),d=z.useRef();d.current===void 0&&(d.current=r(o));let p,m=!1;(a.current!==o||l.current!==r||u.current!==i||h.current)&&(p=r(o),m=!i(d.current,p)),U2(()=>{m&&(d.current=p),a.current=o,l.current=r,u.current=i,h.current=!1});const v=z.useRef(o);U2(()=>{const _=()=>{try{const w=e.getState(),S=l.current(w);u.current(d.current,S)||(a.current=w,d.current=S,s())}catch{h.current=!0,s()}},g=e.subscribe(_);return e.getState()!==v.current&&_(),g},[]);const x=m?p:d.current;return z.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 BS={},S7={get exports(){return BS},set exports(n){BS=n}},Od={},w7={get exports(){return Od},set exports(n){Od=n}},HF={};/** * @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(U,$){var j=U.length;U.push($);e:for(;0>>1,ee=U[se];if(0>>1;sei(Me,j))yei(q,Me)?(U[se]=q,U[ye]=j,se=ye):(U[se]=Me,U[ie]=j,se=ie);else if(yei(q,j))U[se]=q,U[ye]=j,se=ye;else break e}}return $}function i(U,$){var j=U.sortIndex-$.sortIndex;return j!==0?j:U.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],u=[],h=1,d=null,p=3,m=!1,v=!1,x=!1,_=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(U){for(var $=t(u);$!==null;){if($.callback===null)r(u);else if($.startTime<=U)r(u),$.sortIndex=$.expirationTime,e(l,$);else break;$=t(u)}}function M(U){if(x=!1,S(U),!v)if(t(l)!==null)v=!0,re(C);else{var $=t(u);$!==null&&ue(M,$.startTime-U)}}function C(U,$){v=!1,x&&(x=!1,g(B),B=-1),m=!0;var j=p;try{for(S($),d=t(l);d!==null&&(!(d.expirationTime>$)||U&&!I());){var se=d.callback;if(typeof se=="function"){d.callback=null,p=d.priorityLevel;var ee=se(d.expirationTime<=$);$=n.unstable_now(),typeof ee=="function"?d.callback=ee:d===t(l)&&r(l),S($)}else r(l);d=t(l)}if(d!==null)var ne=!0;else{var ie=t(u);ie!==null&&ue(M,ie.startTime-$),ne=!1}return ne}finally{d=null,p=j,m=!1}}var P=!1,L=null,B=-1,E=5,R=-1;function I(){return!(n.unstable_now()-RU||125se?(U.sortIndex=j,e(u,U),t(l)===null&&U===t(u)&&(x?(g(B),B=-1):x=!0,ue(M,j-se))):(U.sortIndex=ee,e(l,U),v||m||(v=!0,re(C))),U},n.unstable_shouldYield=I,n.unstable_wrapCallback=function(U){var $=p;return function(){var j=p;p=$;try{return U.apply(this,arguments)}finally{p=j}}}})(HF);(function(n){n.exports=HF})(w7);/** * @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 A7=function(e){var t={},r=z,i=Od,s=Object.assign;function o(c){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+c,y=1;yK||b[N]!==T[K]){var ce=` `+b[N].replace(" at new "," at ");return c.displayName&&ce.includes("")&&(ce=ce.replace("",c.displayName)),ce}while(1<=N&&0<=K);break}}}finally{wt=!1,Error.prepareStackTrace=y}return(c=c?c.displayName||c.name:"")?$t(c):""}var An=Object.prototype.hasOwnProperty,Hi=[],Os=-1;function Tr(c){return{current:c}}function Gt(c){0>Os||(c.current=Hi[Os],Hi[Os]=null,Os--)}function pt(c,f){Os++,Hi[Os]=c.current,c.current=f}var rr={},Mn=Tr(rr),Vt=Tr(!1),Vi=rr;function Lo(c,f){var y=c.type.contextTypes;if(!y)return rr;var A=c.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===f)return A.__reactInternalMemoizedMaskedChildContext;var b={},T;for(T in y)b[T]=f[T];return A&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=f,c.__reactInternalMemoizedMaskedChildContext=b),b}function Yn(c){return c=c.childContextTypes,c!=null}function Bp(){Gt(Vt),Gt(Mn)}function Cb(c,f,y){if(Mn.current!==rr)throw Error(o(168));pt(Mn,f),pt(Vt,y)}function Eb(c,f,y){var A=c.stateNode;if(f=f.childContextTypes,typeof A.getChildContext!="function")return y;A=A.getChildContext();for(var b in A)if(!(b in f))throw Error(o(108,B(c)||"Unknown",b));return s({},y,A)}function Lp(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||rr,Vi=Mn.current,pt(Mn,c),pt(Vt,Vt.current),!0}function Tb(c,f,y){var A=c.stateNode;if(!A)throw Error(o(169));y?(c=Eb(c,f,Vi),A.__reactInternalMemoizedMergedChildContext=c,Gt(Vt),Gt(Mn),pt(Mn,c)):Gt(Vt),pt(Vt,y)}var Wi=Math.clz32?Math.clz32:rU,tU=Math.log,nU=Math.LN2;function rU(c){return c>>>=0,c===0?32:31-(tU(c)/nU|0)|0}var Ip=64,Dp=4194304;function Rf(c){switch(c&-c){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 c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function Fp(c,f){var y=c.pendingLanes;if(y===0)return 0;var A=0,b=c.suspendedLanes,T=c.pingedLanes,N=y&268435455;if(N!==0){var K=N&~b;K!==0?A=Rf(K):(T&=N,T!==0&&(A=Rf(T)))}else N=y&~b,N!==0?A=Rf(N):T!==0&&(A=Rf(T));if(A===0)return 0;if(f!==0&&f!==A&&!(f&b)&&(b=A&-A,T=f&-f,b>=T||b===16&&(T&4194240)!==0))return f;if(A&4&&(A|=y&16),f=c.entangledLanes,f!==0)for(c=c.entanglements,f&=A;0y;y++)f.push(c);return f}function Bf(c,f,y){c.pendingLanes|=f,f!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,f=31-Wi(f),c[f]=y}function oU(c,f){var y=c.pendingLanes&~f;c.pendingLanes=f,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=f,c.mutableReadLanes&=f,c.entangledLanes&=f,f=c.entanglements;var A=c.eventTimes;for(c=c.expirationTimes;0>=N,b-=N,Us=1<<32-Wi(f)+b|y<Ft?(Hn=ft,ft=null):Hn=ft.sibling;var Ot=Qe(Z,ft,ae[Ft],Ie);if(Ot===null){ft===null&&(ft=Hn);break}c&&ft&&Ot.alternate===null&&f(Z,ft),Y=T(Ot,Y,Ft),mt===null?Ve=Ot:mt.sibling=Ot,mt=Ot,ft=Hn}if(Ft===ae.length)return y(Z,ft),nn&&Na(Z,Ft),Ve;if(ft===null){for(;FtFt?(Hn=ft,ft=null):Hn=ft.sibling;var Go=Qe(Z,ft,Ot.value,Ie);if(Go===null){ft===null&&(ft=Hn);break}c&&ft&&Go.alternate===null&&f(Z,ft),Y=T(Go,Y,Ft),mt===null?Ve=Go:mt.sibling=Go,mt=Go,ft=Hn}if(Ot.done)return y(Z,ft),nn&&Na(Z,Ft),Ve;if(ft===null){for(;!Ot.done;Ft++,Ot=ae.next())Ot=ct(Z,Ot.value,Ie),Ot!==null&&(Y=T(Ot,Y,Ft),mt===null?Ve=Ot:mt.sibling=Ot,mt=Ot);return nn&&Na(Z,Ft),Ve}for(ft=A(Z,ft);!Ot.done;Ft++,Ot=ae.next())Ot=Wt(ft,Z,Ft,Ot.value,Ie),Ot!==null&&(c&&Ot.alternate!==null&&ft.delete(Ot.key===null?Ft:Ot.key),Y=T(Ot,Y,Ft),mt===null?Ve=Ot:mt.sibling=Ot,mt=Ot);return c&&ft.forEach(function(jU){return f(Z,jU)}),nn&&Na(Z,Ft),Ve}function wi(Z,Y,ae,Ie){if(typeof ae=="object"&&ae!==null&&ae.type===h&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case l:e:{for(var Ve=ae.key,mt=Y;mt!==null;){if(mt.key===Ve){if(Ve=ae.type,Ve===h){if(mt.tag===7){y(Z,mt.sibling),Y=b(mt,ae.props.children),Y.return=Z,Z=Y;break e}}else if(mt.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===S&&Wb(Ve)===mt.type){y(Z,mt.sibling),Y=b(mt,ae.props),Y.ref=Df(Z,mt,ae),Y.return=Z,Z=Y;break e}y(Z,mt);break}else f(Z,mt);mt=mt.sibling}ae.type===h?(Y=ja(ae.props.children,Z.mode,Ie,ae.key),Y.return=Z,Z=Y):(Ie=Am(ae.type,ae.key,ae.props,null,Z.mode,Ie),Ie.ref=Df(Z,Y,ae),Ie.return=Z,Z=Ie)}return N(Z);case u:e:{for(mt=ae.key;Y!==null;){if(Y.key===mt)if(Y.tag===4&&Y.stateNode.containerInfo===ae.containerInfo&&Y.stateNode.implementation===ae.implementation){y(Z,Y.sibling),Y=b(Y,ae.children||[]),Y.return=Z,Z=Y;break e}else{y(Z,Y);break}else f(Z,Y);Y=Y.sibling}Y=cx(ae,Z.mode,Ie),Y.return=Z,Z=Y}return N(Z);case S:return mt=ae._init,wi(Z,Y,mt(ae._payload),Ie)}if(J(ae))return $e(Z,Y,ae,Ie);if(P(ae))return ar(Z,Y,ae,Ie);$p(Z,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"?(ae=""+ae,Y!==null&&Y.tag===6?(y(Z,Y.sibling),Y=b(Y,ae),Y.return=Z,Z=Y):(y(Z,Y),Y=ux(ae,Z.mode,Ie),Y.return=Z,Z=Y),N(Z)):y(Z,Y)}return wi}var lu=jb(!0),$b=jb(!1),Ff={},yi=Tr(Ff),Of=Tr(Ff),uu=Tr(Ff);function xs(c){if(c===Ff)throw Error(o(174));return c}function Ey(c,f){pt(uu,f),pt(Of,c),pt(yi,Ff),c=ue(f),Gt(yi),pt(yi,c)}function cu(){Gt(yi),Gt(Of),Gt(uu)}function Jb(c){var f=xs(uu.current),y=xs(yi.current);f=U(y,c.type,f),y!==f&&(pt(Of,c),pt(yi,f))}function Ty(c){Of.current===c&&(Gt(yi),Gt(Of))}var un=Tr(0);function Jp(c){for(var f=c;f!==null;){if(f.tag===13){var y=f.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||Rp(y)||Pf(y)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var Py=[];function Ry(){for(var c=0;cy?y:4,c(!0);var A=xi.transition;xi.transition={};try{c(!1),f()}finally{Dt=y,xi.transition=A}}function aC(){return _s().memoizedState}function yU(c,f,y){var A=ko(c);y={lane:A,action:y,hasEagerState:!1,eagerState:null,next:null},lC(c)?uC(f,y):(cC(c,f,y),y=vr(),c=_i(c,A,y),c!==null&&fC(c,f,A))}function xU(c,f,y){var A=ko(c),b={lane:A,action:y,hasEagerState:!1,eagerState:null,next:null};if(lC(c))uC(f,b);else{cC(c,f,b);var T=c.alternate;if(c.lanes===0&&(T===null||T.lanes===0)&&(T=f.lastRenderedReducer,T!==null))try{var N=f.lastRenderedState,K=T(N,y);if(b.hasEagerState=!0,b.eagerState=K,gs(K,N))return}catch{}finally{}y=vr(),c=_i(c,A,y),c!==null&&fC(c,f,A)}}function lC(c){var f=c.alternate;return c===mn||f!==null&&f===mn}function uC(c,f){kf=Kp=!0;var y=c.pending;y===null?f.next=f:(f.next=y.next,y.next=f),c.pending=f}function cC(c,f,y){bn!==null&&c.mode&1&&!(_t&2)?(c=f.interleaved,c===null?(y.next=y,ys===null?ys=[f]:ys.push(f)):(y.next=c.next,c.next=y),f.interleaved=y):(c=f.pending,c===null?y.next=y:(y.next=c.next,c.next=y),f.pending=y)}function fC(c,f,y){if(y&4194240){var A=f.lanes;A&=c.pendingLanes,y|=A,f.lanes=y,cy(c,y)}}var em={readContext:mi,useCallback:sr,useContext:sr,useEffect:sr,useImperativeHandle:sr,useInsertionEffect:sr,useLayoutEffect:sr,useMemo:sr,useReducer:sr,useRef:sr,useState:sr,useDebugValue:sr,useDeferredValue:sr,useTransition:sr,useMutableSource:sr,useSyncExternalStore:sr,useId:sr,unstable_isNewReconciler:!1},_U={readContext:mi,useCallback:function(c,f){return zs().memoizedState=[c,f===void 0?null:f],c},useContext:mi,useEffect:Fy,useImperativeHandle:function(c,f,y){return y=y!=null?y.concat([c]):null,qp(4194308,4,rC.bind(null,f,c),y)},useLayoutEffect:function(c,f){return qp(4194308,4,c,f)},useInsertionEffect:function(c,f){return qp(4,2,c,f)},useMemo:function(c,f){var y=zs();return f=f===void 0?null:f,c=c(),y.memoizedState=[c,f],c},useReducer:function(c,f,y){var A=zs();return f=y!==void 0?y(f):f,A.memoizedState=A.baseState=f,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:f},A.queue=c,c=c.dispatch=yU.bind(null,mn,c),[A.memoizedState,c]},useRef:function(c){var f=zs();return c={current:c},f.memoizedState=c},useState:Dy,useDebugValue:Oy,useDeferredValue:function(c){var f=Dy(c),y=f[0],A=f[1];return Fy(function(){var b=xi.transition;xi.transition={};try{A(c)}finally{xi.transition=b}},[c]),y},useTransition:function(){var c=Dy(!1),f=c[0];return c=vU.bind(null,c[1]),zs().memoizedState=c,[f,c]},useMutableSource:function(){},useSyncExternalStore:function(c,f,y){var A=mn,b=zs();if(nn){if(y===void 0)throw Error(o(407));y=y()}else{if(y=f(),bn===null)throw Error(o(349));fu&30||Yb(A,f,y)}b.memoizedState=y;var T={value:y,getSnapshot:f};return b.queue=T,Fy(qb.bind(null,A,T,c),[c]),A.flags|=2048,Uf(9,Qb.bind(null,A,T,y,f),void 0,null),y},useId:function(){var c=zs(),f=bn.identifierPrefix;if(nn){var y=Gs,A=Us;y=(A&~(1<<32-Wi(A)-1)).toString(32)+y,f=":"+f+"R"+y,y=Nf++,0tx&&(f.flags|=128,A=!0,Vf(b,!1),f.lanes=4194304)}else{if(!A)if(c=Jp(T),c!==null){if(f.flags|=128,A=!0,c=c.updateQueue,c!==null&&(f.updateQueue=c,f.flags|=4),Vf(b,!0),b.tail===null&&b.tailMode==="hidden"&&!T.alternate&&!nn)return or(f),null}else 2*Gn()-b.renderingStartTime>tx&&y!==1073741824&&(f.flags|=128,A=!0,Vf(b,!1),f.lanes=4194304);b.isBackwards?(T.sibling=f.child,f.child=T):(c=b.last,c!==null?c.sibling=T:f.child=T,b.last=T)}return b.tail!==null?(f=b.tail,b.rendering=f,b.tail=f.sibling,b.renderingStartTime=Gn(),f.sibling=null,c=un.current,pt(un,A?c&1|2:c&1),f):(or(f),null);case 22:case 23:return ox(),A=f.memoizedState!==null,c!==null&&c.memoizedState!==null!==A&&(f.flags|=8192),A&&f.mode&1?Xr&1073741824&&(or(f),Pe&&f.subtreeFlags&6&&(f.flags|=8192)):or(f),null;case 24:return null;case 25:return null}throw Error(o(156,f.tag))}var bU=a.ReactCurrentOwner,Jr=!1;function gr(c,f,y,A){f.child=c===null?$b(f,null,y,A):lu(f,c.child,y,A)}function xC(c,f,y,A,b){y=y.render;var T=f.ref;return iu(f,b),A=Ly(c,f,y,A,T,b),y=Iy(),c!==null&&!Jr?(f.updateQueue=c.updateQueue,f.flags&=-2053,c.lanes&=~b,Hs(c,f,b)):(nn&&y&&wy(f),f.flags|=1,gr(c,f,A,b),f.child)}function _C(c,f,y,A,b){if(c===null){var T=y.type;return typeof T=="function"&&!lx(T)&&T.defaultProps===void 0&&y.compare===null&&y.defaultProps===void 0?(f.tag=15,f.type=T,SC(c,f,T,A,b)):(c=Am(y.type,null,A,f,f.mode,b),c.ref=f.ref,c.return=f,f.child=c)}if(T=c.child,!(c.lanes&b)){var N=T.memoizedProps;if(y=y.compare,y=y!==null?y:Np,y(N,A)&&c.ref===f.ref)return Hs(c,f,b)}return f.flags|=1,c=Uo(T,A),c.ref=f.ref,c.return=f,f.child=c}function SC(c,f,y,A,b){if(c!==null&&Np(c.memoizedProps,A)&&c.ref===f.ref)if(Jr=!1,(c.lanes&b)!==0)c.flags&131072&&(Jr=!0);else return f.lanes=c.lanes,Hs(c,f,b);return Uy(c,f,y,A,b)}function wC(c,f,y){var A=f.pendingProps,b=A.children,T=c!==null?c.memoizedState:null;if(A.mode==="hidden")if(!(f.mode&1))f.memoizedState={baseLanes:0,cachePool:null},pt(hu,Xr),Xr|=y;else if(y&1073741824)f.memoizedState={baseLanes:0,cachePool:null},A=T!==null?T.baseLanes:y,pt(hu,Xr),Xr|=A;else return c=T!==null?T.baseLanes|y:y,f.lanes=f.childLanes=1073741824,f.memoizedState={baseLanes:c,cachePool:null},f.updateQueue=null,pt(hu,Xr),Xr|=c,null;else T!==null?(A=T.baseLanes|y,f.memoizedState=null):A=y,pt(hu,Xr),Xr|=A;return gr(c,f,b,y),f.child}function AC(c,f){var y=f.ref;(c===null&&y!==null||c!==null&&c.ref!==y)&&(f.flags|=512,f.flags|=2097152)}function Uy(c,f,y,A,b){var T=Yn(y)?Vi:Mn.current;return T=Lo(f,T),iu(f,b),y=Ly(c,f,y,A,T,b),A=Iy(),c!==null&&!Jr?(f.updateQueue=c.updateQueue,f.flags&=-2053,c.lanes&=~b,Hs(c,f,b)):(nn&&A&&wy(f),f.flags|=1,gr(c,f,y,b),f.child)}function MC(c,f,y,A,b){if(Yn(y)){var T=!0;Lp(f)}else T=!1;if(iu(f,b),f.stateNode===null)c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),Nb(f,y,A),Sy(f,y,A,b),A=!0;else if(c===null){var N=f.stateNode,K=f.memoizedProps;N.props=K;var ce=N.context,be=y.contextType;typeof be=="object"&&be!==null?be=mi(be):(be=Yn(y)?Vi:Mn.current,be=Lo(f,be));var Ue=y.getDerivedStateFromProps,ct=typeof Ue=="function"||typeof N.getSnapshotBeforeUpdate=="function";ct||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(K!==A||ce!==be)&&Ub(f,N,A,be),Io=!1;var Qe=f.memoizedState;N.state=Qe,Hp(f,A,N,b),ce=f.memoizedState,K!==A||Qe!==ce||Vt.current||Io?(typeof Ue=="function"&&(_y(f,y,Ue,A),ce=f.memoizedState),(K=Io||kb(f,y,K,A,Qe,ce,be))?(ct||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(f.flags|=4194308)):(typeof N.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=A,f.memoizedState=ce),N.props=A,N.state=ce,N.context=be,A=K):(typeof N.componentDidMount=="function"&&(f.flags|=4194308),A=!1)}else{N=f.stateNode,Ib(c,f),K=f.memoizedProps,be=f.type===f.elementType?K:ji(f.type,K),N.props=be,ct=f.pendingProps,Qe=N.context,ce=y.contextType,typeof ce=="object"&&ce!==null?ce=mi(ce):(ce=Yn(y)?Vi:Mn.current,ce=Lo(f,ce));var Wt=y.getDerivedStateFromProps;(Ue=typeof Wt=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(K!==ct||Qe!==ce)&&Ub(f,N,A,ce),Io=!1,Qe=f.memoizedState,N.state=Qe,Hp(f,A,N,b);var $e=f.memoizedState;K!==ct||Qe!==$e||Vt.current||Io?(typeof Wt=="function"&&(_y(f,y,Wt,A),$e=f.memoizedState),(be=Io||kb(f,y,be,A,Qe,$e,ce)||!1)?(Ue||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(A,$e,ce),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(A,$e,ce)),typeof N.componentDidUpdate=="function"&&(f.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof N.componentDidUpdate!="function"||K===c.memoizedProps&&Qe===c.memoizedState||(f.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||K===c.memoizedProps&&Qe===c.memoizedState||(f.flags|=1024),f.memoizedProps=A,f.memoizedState=$e),N.props=A,N.state=$e,N.context=ce,A=be):(typeof N.componentDidUpdate!="function"||K===c.memoizedProps&&Qe===c.memoizedState||(f.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||K===c.memoizedProps&&Qe===c.memoizedState||(f.flags|=1024),A=!1)}return Gy(c,f,y,A,T,b)}function Gy(c,f,y,A,b,T){AC(c,f);var N=(f.flags&128)!==0;if(!A&&!N)return b&&Tb(f,y,!1),Hs(c,f,T);A=f.stateNode,bU.current=f;var K=N&&typeof y.getDerivedStateFromError!="function"?null:A.render();return f.flags|=1,c!==null&&N?(f.child=lu(f,c.child,null,T),f.child=lu(f,null,K,T)):gr(c,f,K,T),f.memoizedState=A.state,b&&Tb(f,y,!0),f.child}function bC(c){var f=c.stateNode;f.pendingContext?Cb(c,f.pendingContext,f.pendingContext!==f.context):f.context&&Cb(c,f.context,!1),Ey(c,f.containerInfo)}function CC(c,f,y,A,b){return au(),Cy(b),f.flags|=256,gr(c,f,y,A),f.child}var rm={dehydrated:null,treeContext:null,retryLane:0};function im(c){return{baseLanes:c,cachePool:null}}function EC(c,f,y){var A=f.pendingProps,b=un.current,T=!1,N=(f.flags&128)!==0,K;if((K=N)||(K=c!==null&&c.memoizedState===null?!1:(b&2)!==0),K?(T=!0,f.flags&=-129):(c===null||c.memoizedState!==null)&&(b|=1),pt(un,b&1),c===null)return by(f),c=f.memoizedState,c!==null&&(c=c.dehydrated,c!==null)?(f.mode&1?Pf(c)?f.lanes=8:f.lanes=1073741824:f.lanes=1,null):(b=A.children,c=A.fallback,T?(A=f.mode,T=f.child,b={mode:"hidden",children:b},!(A&1)&&T!==null?(T.childLanes=0,T.pendingProps=b):T=Mm(b,A,0,null),c=ja(c,A,y,null),T.return=f,c.return=f,T.sibling=c,f.child=T,f.child.memoizedState=im(y),f.memoizedState=rm,c):zy(f,b));if(b=c.memoizedState,b!==null){if(K=b.dehydrated,K!==null){if(N)return f.flags&256?(f.flags&=-257,sm(c,f,y,Error(o(422)))):f.memoizedState!==null?(f.child=c.child,f.flags|=128,null):(T=A.fallback,b=f.mode,A=Mm({mode:"visible",children:A.children},b,0,null),T=ja(T,b,y,null),T.flags|=2,A.return=f,T.return=f,A.sibling=T,f.child=A,f.mode&1&&lu(f,c.child,null,y),f.child.memoizedState=im(y),f.memoizedState=rm,T);if(!(f.mode&1))f=sm(c,f,y,null);else if(Pf(K))f=sm(c,f,y,Error(o(419)));else if(A=(y&c.childLanes)!==0,Jr||A){if(A=bn,A!==null){switch(y&-y){case 4:T=2;break;case 16:T=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:T=32;break;case 536870912:T=268435456;break;default:T=0}A=T&(A.suspendedLanes|y)?0:T,A!==0&&A!==b.retryLane&&(b.retryLane=A,_i(c,A,-1))}ax(),f=sm(c,f,y,Error(o(421)))}else Rp(K)?(f.flags|=128,f.child=c.child,f=NU.bind(null,c),ay(K,f),f=null):(y=b.treeContext,le&&($r=Q(K),jr=f,nn=!0,$i=null,Lf=!1,y!==null&&(gi[vi++]=Us,gi[vi++]=Gs,gi[vi++]=ka,Us=y.id,Gs=y.overflow,ka=f)),f=zy(f,f.pendingProps.children),f.flags|=4096);return f}return T?(A=PC(c,f,A.children,A.fallback,y),T=f.child,b=c.child.memoizedState,T.memoizedState=b===null?im(y):{baseLanes:b.baseLanes|y,cachePool:null},T.childLanes=c.childLanes&~y,f.memoizedState=rm,A):(y=TC(c,f,A.children,y),f.memoizedState=null,y)}return T?(A=PC(c,f,A.children,A.fallback,y),T=f.child,b=c.child.memoizedState,T.memoizedState=b===null?im(y):{baseLanes:b.baseLanes|y,cachePool:null},T.childLanes=c.childLanes&~y,f.memoizedState=rm,A):(y=TC(c,f,A.children,y),f.memoizedState=null,y)}function zy(c,f){return f=Mm({mode:"visible",children:f},c.mode,0,null),f.return=c,c.child=f}function TC(c,f,y,A){var b=c.child;return c=b.sibling,y=Uo(b,{mode:"visible",children:y}),!(f.mode&1)&&(y.lanes=A),y.return=f,y.sibling=null,c!==null&&(A=f.deletions,A===null?(f.deletions=[c],f.flags|=16):A.push(c)),f.child=y}function PC(c,f,y,A,b){var T=f.mode;c=c.child;var N=c.sibling,K={mode:"hidden",children:y};return!(T&1)&&f.child!==c?(y=f.child,y.childLanes=0,y.pendingProps=K,f.deletions=null):(y=Uo(c,K),y.subtreeFlags=c.subtreeFlags&14680064),N!==null?A=Uo(N,A):(A=ja(A,T,b,null),A.flags|=2),A.return=f,y.return=f,y.sibling=A,f.child=y,A}function sm(c,f,y,A){return A!==null&&Cy(A),lu(f,c.child,null,y),c=zy(f,f.pendingProps.children),c.flags|=2,f.memoizedState=null,c}function RC(c,f,y){c.lanes|=f;var A=c.alternate;A!==null&&(A.lanes|=f),yy(c.return,f,y)}function Hy(c,f,y,A,b){var T=c.memoizedState;T===null?c.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:A,tail:y,tailMode:b}:(T.isBackwards=f,T.rendering=null,T.renderingStartTime=0,T.last=A,T.tail=y,T.tailMode=b)}function BC(c,f,y){var A=f.pendingProps,b=A.revealOrder,T=A.tail;if(gr(c,f,A.children,y),A=un.current,A&2)A=A&1|2,f.flags|=128;else{if(c!==null&&c.flags&128)e:for(c=f.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&RC(c,y,f);else if(c.tag===19)RC(c,y,f);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===f)break e;for(;c.sibling===null;){if(c.return===null||c.return===f)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}A&=1}if(pt(un,A),!(f.mode&1))f.memoizedState=null;else switch(b){case"forwards":for(y=f.child,b=null;y!==null;)c=y.alternate,c!==null&&Jp(c)===null&&(b=y),y=y.sibling;y=b,y===null?(b=f.child,f.child=null):(b=y.sibling,y.sibling=null),Hy(f,!1,b,y,T);break;case"backwards":for(y=null,b=f.child,f.child=null;b!==null;){if(c=b.alternate,c!==null&&Jp(c)===null){f.child=b;break}c=b.sibling,b.sibling=y,y=b,b=c}Hy(f,!0,y,null,T);break;case"together":Hy(f,!1,null,null,void 0);break;default:f.memoizedState=null}return f.child}function Hs(c,f,y){if(c!==null&&(f.dependencies=c.dependencies),du|=f.lanes,!(y&f.childLanes))return null;if(c!==null&&f.child!==c.child)throw Error(o(153));if(f.child!==null){for(c=f.child,y=Uo(c,c.pendingProps),f.child=y,y.return=f;c.sibling!==null;)c=c.sibling,y=y.sibling=Uo(c,c.pendingProps),y.return=f;y.sibling=null}return f.child}function CU(c,f,y){switch(f.tag){case 3:bC(f),au();break;case 5:Jb(f);break;case 1:Yn(f.type)&&Lp(f);break;case 4:Ey(f,f.stateNode.containerInfo);break;case 10:Lb(f,f.type._context,f.memoizedProps.value);break;case 13:var A=f.memoizedState;if(A!==null)return A.dehydrated!==null?(pt(un,un.current&1),f.flags|=128,null):y&f.child.childLanes?EC(c,f,y):(pt(un,un.current&1),c=Hs(c,f,y),c!==null?c.sibling:null);pt(un,un.current&1);break;case 19:if(A=(y&f.childLanes)!==0,c.flags&128){if(A)return BC(c,f,y);f.flags|=128}var b=f.memoizedState;if(b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),pt(un,un.current),A)break;return null;case 22:case 23:return f.lanes=0,wC(c,f,y)}return Hs(c,f,y)}function EU(c,f){switch(Ay(f),f.tag){case 1:return Yn(f.type)&&Bp(),c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 3:return cu(),Gt(Vt),Gt(Mn),Ry(),c=f.flags,c&65536&&!(c&128)?(f.flags=c&-65537|128,f):null;case 5:return Ty(f),null;case 13:if(Gt(un),c=f.memoizedState,c!==null&&c.dehydrated!==null){if(f.alternate===null)throw Error(o(340));au()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 19:return Gt(un),null;case 4:return cu(),null;case 10:return vy(f.type._context),null;case 22:case 23:return ox(),null;case 24:return null;default:return null}}var om=!1,Ga=!1,TU=typeof WeakSet=="function"?WeakSet:Set,Le=null;function am(c,f){var y=c.ref;if(y!==null)if(typeof y=="function")try{y(null)}catch(A){Br(c,f,A)}else y.current=null}function Vy(c,f,y){try{y()}catch(A){Br(c,f,A)}}var LC=!1;function PU(c,f){for($(c.containerInfo),Le=f;Le!==null;)if(c=Le,f=c.child,(c.subtreeFlags&1028)!==0&&f!==null)f.return=c,Le=f;else for(;Le!==null;){c=Le;try{var y=c.alternate;if(c.flags&1024)switch(c.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var A=y.memoizedProps,b=y.memoizedState,T=c.stateNode,N=T.getSnapshotBeforeUpdate(c.elementType===c.type?A:ji(c.type,A),b);T.__reactInternalSnapshotBeforeUpdate=N}break;case 3:Pe&&De(c.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(K){Br(c,c.return,K)}if(f=c.sibling,f!==null){f.return=c.return,Le=f;break}Le=c.return}return y=LC,LC=!1,y}function za(c,f,y){var A=f.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var b=A=A.next;do{if((b.tag&c)===c){var T=b.destroy;b.destroy=void 0,T!==void 0&&Vy(f,y,T)}b=b.next}while(b!==A)}}function Wf(c,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var y=f=f.next;do{if((y.tag&c)===c){var A=y.create;y.destroy=A()}y=y.next}while(y!==f)}}function Wy(c){var f=c.ref;if(f!==null){var y=c.stateNode;switch(c.tag){case 5:c=re(y);break;default:c=y}typeof f=="function"?f(c):f.current=c}}function IC(c,f,y){if(ms&&typeof ms.onCommitFiberUnmount=="function")try{ms.onCommitFiberUnmount(Op,f)}catch{}switch(f.tag){case 0:case 11:case 14:case 15:if(c=f.updateQueue,c!==null&&(c=c.lastEffect,c!==null)){var A=c=c.next;do{var b=A,T=b.destroy;b=b.tag,T!==void 0&&(b&2||b&4)&&Vy(f,y,T),A=A.next}while(A!==c)}break;case 1:if(am(f,y),c=f.stateNode,typeof c.componentWillUnmount=="function")try{c.props=f.memoizedProps,c.state=f.memoizedState,c.componentWillUnmount()}catch(N){Br(f,y,N)}break;case 5:am(f,y);break;case 4:Pe?UC(c,f,y):ge&&ge&&(f=f.stateNode.containerInfo,y=Ht(f),Gi(f,y))}}function DC(c,f,y){for(var A=f;;)if(IC(c,A,y),A.child===null||Pe&&A.tag===4){if(A===f)break;for(;A.sibling===null;){if(A.return===null||A.return===f)return;A=A.return}A.sibling.return=A.return,A=A.sibling}else A.child.return=A,A=A.child}function FC(c){var f=c.alternate;f!==null&&(c.alternate=null,FC(f)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(f=c.stateNode,f!==null&&Ze(f)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function OC(c){return c.tag===5||c.tag===3||c.tag===4}function kC(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||OC(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function NC(c){if(Pe){e:{for(var f=c.return;f!==null;){if(OC(f))break e;f=f.return}throw Error(o(160))}var y=f;switch(y.tag){case 5:f=y.stateNode,y.flags&32&&(kt(f),y.flags&=-33),y=kC(c),$y(c,y,f);break;case 3:case 4:f=y.stateNode.containerInfo,y=kC(c),jy(c,y,f);break;default:throw Error(o(161))}}}function jy(c,f,y){var A=c.tag;if(A===5||A===6)c=c.stateNode,f?Ne(y,c,f):Fe(y,c);else if(A!==4&&(c=c.child,c!==null))for(jy(c,f,y),c=c.sibling;c!==null;)jy(c,f,y),c=c.sibling}function $y(c,f,y){var A=c.tag;if(A===5||A===6)c=c.stateNode,f?tt(y,c,f):nt(y,c);else if(A!==4&&(c=c.child,c!==null))for($y(c,f,y),c=c.sibling;c!==null;)$y(c,f,y),c=c.sibling}function UC(c,f,y){for(var A=f,b=!1,T,N;;){if(!b){b=A.return;e:for(;;){if(b===null)throw Error(o(160));switch(T=b.stateNode,b.tag){case 5:N=!1;break e;case 3:T=T.containerInfo,N=!0;break e;case 4:T=T.containerInfo,N=!0;break e}b=b.return}b=!0}if(A.tag===5||A.tag===6)DC(c,A,y),N?bt(T,A.stateNode):We(T,A.stateNode);else if(A.tag===18)N?St(T,A.stateNode):xt(T,A.stateNode);else if(A.tag===4){if(A.child!==null){T=A.stateNode.containerInfo,N=!0,A.child.return=A,A=A.child;continue}}else if(IC(c,A,y),A.child!==null){A.child.return=A,A=A.child;continue}if(A===f)break;for(;A.sibling===null;){if(A.return===null||A.return===f)return;A=A.return,A.tag===4&&(b=!1)}A.sibling.return=A.return,A=A.sibling}}function Jy(c,f){if(Pe){switch(f.tag){case 0:case 11:case 14:case 15:za(3,f,f.return),Wf(3,f),za(5,f,f.return);return;case 1:return;case 5:var y=f.stateNode;if(y!=null){var A=f.memoizedProps;c=c!==null?c.memoizedProps:A;var b=f.type,T=f.updateQueue;f.updateQueue=null,T!==null&&Ke(y,T,b,c,A,f)}return;case 6:if(f.stateNode===null)throw Error(o(162));y=f.memoizedProps,de(f.stateNode,c!==null?c.memoizedProps:y,y);return;case 3:le&&c!==null&&c.memoizedState.isDehydrated&&dt(f.stateNode.containerInfo);return;case 12:return;case 13:lm(f);return;case 19:lm(f);return;case 17:return}throw Error(o(163))}switch(f.tag){case 0:case 11:case 14:case 15:za(3,f,f.return),Wf(3,f),za(5,f,f.return);return;case 12:return;case 13:lm(f);return;case 19:lm(f);return;case 3:le&&c!==null&&c.memoizedState.isDehydrated&&dt(f.stateNode.containerInfo);break;case 22:case 23:return}e:if(ge){switch(f.tag){case 1:case 5:case 6:break e;case 3:case 4:f=f.stateNode,Gi(f.containerInfo,f.pendingChildren);break e}throw Error(o(163))}}function lm(c){var f=c.updateQueue;if(f!==null){c.updateQueue=null;var y=c.stateNode;y===null&&(y=c.stateNode=new TU),f.forEach(function(A){var b=UU.bind(null,c,A);y.has(A)||(y.add(A),A.then(b,b))})}}function RU(c,f){for(Le=f;Le!==null;){f=Le;var y=f.deletions;if(y!==null)for(var A=0;A";case cm:return":has("+(Yy(c)||"")+")";case fm:return'[role="'+c.value+'"]';case dm:return'"'+c.value+'"';case hm:return'[data-testname="'+c.value+'"]';default:throw Error(o(365))}}function WC(c,f){var y=[];c=[c,0];for(var A=0;Ab&&(b=N),A&=~T}if(A=b,A=Gn()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*LU(A/1960))-A,10c?16:c,Oo===null)var A=!1;else{if(c=Oo,Oo=null,ym=0,_t&6)throw Error(o(331));var b=_t;for(_t|=4,Le=c.current;Le!==null;){var T=Le,N=T.child;if(Le.flags&16){var K=T.deletions;if(K!==null){for(var ce=0;ceGn()-ex?Ha(c,0):Zy|=y),Rr(c,f)}function ZC(c,f){f===0&&(c.mode&1?(f=Dp,Dp<<=1,!(Dp&130023424)&&(Dp=4194304)):f=1);var y=vr();c=Sm(c,f),c!==null&&(Bf(c,f,y),Rr(c,y))}function NU(c){var f=c.memoizedState,y=0;f!==null&&(y=f.retryLane),ZC(c,y)}function UU(c,f){var y=0;switch(c.tag){case 13:var A=c.stateNode,b=c.memoizedState;b!==null&&(y=b.retryLane);break;case 19:A=c.stateNode;break;default:throw Error(o(314))}A!==null&&A.delete(f),ZC(c,y)}var eE;eE=function(c,f,y){if(c!==null)if(c.memoizedProps!==f.pendingProps||Vt.current)Jr=!0;else{if(!(c.lanes&y)&&!(f.flags&128))return Jr=!1,CU(c,f,y);Jr=!!(c.flags&131072)}else Jr=!1,nn&&f.flags&1048576&&Gb(f,jp,f.index);switch(f.lanes=0,f.tag){case 2:var A=f.type;c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),c=f.pendingProps;var b=Lo(f,Mn.current);iu(f,y),b=Ly(null,f,A,c,b,y);var T=Iy();return f.flags|=1,typeof b=="object"&&b!==null&&typeof b.render=="function"&&b.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,Yn(A)?(T=!0,Lp(f)):T=!1,f.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,xy(f),b.updater=Vp,f.stateNode=b,b._reactInternals=f,Sy(f,A,c,y),f=Gy(null,f,A,!0,T,y)):(f.tag=0,nn&&T&&wy(f),gr(null,f,b,y),f=f.child),f;case 16:A=f.elementType;e:{switch(c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),c=f.pendingProps,b=A._init,A=b(A._payload),f.type=A,b=f.tag=zU(A),c=ji(A,c),b){case 0:f=Uy(null,f,A,c,y);break e;case 1:f=MC(null,f,A,c,y);break e;case 11:f=xC(null,f,A,c,y);break e;case 14:f=_C(null,f,A,ji(A.type,c),y);break e}throw Error(o(306,A,""))}return f;case 0:return A=f.type,b=f.pendingProps,b=f.elementType===A?b:ji(A,b),Uy(c,f,A,b,y);case 1:return A=f.type,b=f.pendingProps,b=f.elementType===A?b:ji(A,b),MC(c,f,A,b,y);case 3:e:{if(bC(f),c===null)throw Error(o(387));A=f.pendingProps,T=f.memoizedState,b=T.element,Ib(c,f),Hp(f,A,null,y);var N=f.memoizedState;if(A=N.element,le&&T.isDehydrated)if(T={element:A,isDehydrated:!1,cache:N.cache,transitions:N.transitions},f.updateQueue.baseState=T,f.memoizedState=T,f.flags&256){b=Error(o(423)),f=CC(c,f,A,y,b);break e}else if(A!==b){b=Error(o(424)),f=CC(c,f,A,y,b);break e}else for(le&&($r=fe(f.stateNode.containerInfo),jr=f,nn=!0,$i=null,Lf=!1),y=$b(f,null,A,y),f.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling;else{if(au(),A===b){f=Hs(c,f,y);break e}gr(c,f,A,y)}f=f.child}return f;case 5:return Jb(f),c===null&&by(f),A=f.type,b=f.pendingProps,T=c!==null?c.memoizedProps:null,N=b.children,Me(A,b)?N=null:T!==null&&Me(A,T)&&(f.flags|=32),AC(c,f),gr(c,f,N,y),f.child;case 6:return c===null&&by(f),null;case 13:return EC(c,f,y);case 4:return Ey(f,f.stateNode.containerInfo),A=f.pendingProps,c===null?f.child=lu(f,null,A,y):gr(c,f,A,y),f.child;case 11:return A=f.type,b=f.pendingProps,b=f.elementType===A?b:ji(A,b),xC(c,f,A,b,y);case 7:return gr(c,f,f.pendingProps,y),f.child;case 8:return gr(c,f,f.pendingProps.children,y),f.child;case 12:return gr(c,f,f.pendingProps.children,y),f.child;case 10:e:{if(A=f.type._context,b=f.pendingProps,T=f.memoizedProps,N=b.value,Lb(f,A,N),T!==null)if(gs(T.value,N)){if(T.children===b.children&&!Vt.current){f=Hs(c,f,y);break e}}else for(T=f.child,T!==null&&(T.return=f);T!==null;){var K=T.dependencies;if(K!==null){N=T.child;for(var ce=K.firstContext;ce!==null;){if(ce.context===A){if(T.tag===1){ce=Ns(-1,y&-y),ce.tag=2;var be=T.updateQueue;if(be!==null){be=be.shared;var Ue=be.pending;Ue===null?ce.next=ce:(ce.next=Ue.next,Ue.next=ce),be.pending=ce}}T.lanes|=y,ce=T.alternate,ce!==null&&(ce.lanes|=y),yy(T.return,y,f),K.lanes|=y;break}ce=ce.next}}else if(T.tag===10)N=T.type===f.type?null:T.child;else if(T.tag===18){if(N=T.return,N===null)throw Error(o(341));N.lanes|=y,K=N.alternate,K!==null&&(K.lanes|=y),yy(N,y,f),N=T.sibling}else N=T.child;if(N!==null)N.return=T;else for(N=T;N!==null;){if(N===f){N=null;break}if(T=N.sibling,T!==null){T.return=N.return,N=T;break}N=N.return}T=N}gr(c,f,b.children,y),f=f.child}return f;case 9:return b=f.type,A=f.pendingProps.children,iu(f,y),b=mi(b),A=A(b),f.flags|=1,gr(c,f,A,y),f.child;case 14:return A=f.type,b=ji(A,f.pendingProps),b=ji(A.type,b),_C(c,f,A,b,y);case 15:return SC(c,f,f.type,f.pendingProps,y);case 17:return A=f.type,b=f.pendingProps,b=f.elementType===A?b:ji(A,b),c!==null&&(c.alternate=null,f.alternate=null,f.flags|=2),f.tag=1,Yn(A)?(c=!0,Lp(f)):c=!1,iu(f,y),Nb(f,A,b),Sy(f,A,b,y),Gy(null,f,A,!0,c,y);case 19:return BC(c,f,y);case 22:return wC(c,f,y)}throw Error(o(156,f.tag))};function tE(c,f){return fy(c,f)}function GU(c,f,y,A){this.tag=c,this.key=y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=A,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Si(c,f,y,A){return new GU(c,f,y,A)}function lx(c){return c=c.prototype,!(!c||!c.isReactComponent)}function zU(c){if(typeof c=="function")return lx(c)?1:0;if(c!=null){if(c=c.$$typeof,c===x)return 11;if(c===w)return 14}return 2}function Uo(c,f){var y=c.alternate;return y===null?(y=Si(c.tag,f,c.key,c.mode),y.elementType=c.elementType,y.type=c.type,y.stateNode=c.stateNode,y.alternate=c,c.alternate=y):(y.pendingProps=f,y.type=c.type,y.flags=0,y.subtreeFlags=0,y.deletions=null),y.flags=c.flags&14680064,y.childLanes=c.childLanes,y.lanes=c.lanes,y.child=c.child,y.memoizedProps=c.memoizedProps,y.memoizedState=c.memoizedState,y.updateQueue=c.updateQueue,f=c.dependencies,y.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},y.sibling=c.sibling,y.index=c.index,y.ref=c.ref,y}function Am(c,f,y,A,b,T){var N=2;if(A=c,typeof c=="function")lx(c)&&(N=1);else if(typeof c=="string")N=5;else e:switch(c){case h:return ja(y.children,b,T,f);case d:N=8,b|=8;break;case p:return c=Si(12,y,f,b|2),c.elementType=p,c.lanes=T,c;case _:return c=Si(13,y,f,b),c.elementType=_,c.lanes=T,c;case g:return c=Si(19,y,f,b),c.elementType=g,c.lanes=T,c;case M:return Mm(y,b,T,f);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case m:N=10;break e;case v:N=9;break e;case x:N=11;break e;case w:N=14;break e;case S:N=16,A=null;break e}throw Error(o(130,c==null?c:typeof c,""))}return f=Si(N,y,f,b),f.elementType=c,f.type=A,f.lanes=T,f}function ja(c,f,y,A){return c=Si(7,c,A,f),c.lanes=y,c}function Mm(c,f,y,A){return c=Si(22,c,A,f),c.elementType=M,c.lanes=y,c.stateNode={},c}function ux(c,f,y){return c=Si(6,c,null,f),c.lanes=y,c}function cx(c,f,y){return f=Si(4,c.children!==null?c.children:[],c.key,f),f.lanes=y,f.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},f}function HU(c,f,y,A,b){this.tag=f,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Je,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=uy(0),this.expirationTimes=uy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=uy(0),this.identifierPrefix=A,this.onRecoverableError=b,le&&(this.mutableSourceEagerHydrationData=null)}function nE(c,f,y,A,b,T,N,K,ce){return c=new HU(c,f,y,K,ce),f===1?(f=1,T===!0&&(f|=8)):f=0,T=Si(3,null,null,f),c.current=T,T.stateNode=c,T.memoizedState={element:A,isDehydrated:y,cache:null,transitions:null},xy(T),c}function rE(c){if(!c)return rr;c=c._reactInternals;e:{if(E(c)!==c||c.tag!==1)throw Error(o(170));var f=c;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(Yn(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(o(171))}if(c.tag===1){var y=c.type;if(Yn(y))return Eb(c,y,f)}return f}function iE(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(o(188)):(c=Object.keys(c).join(","),Error(o(268,c)));return c=V(f),c===null?null:c.stateNode}function sE(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var y=c.retryLane;c.retryLane=y!==0&&y=be&&T>=ct&&b<=Ue&&N<=Qe){c.splice(f,1);break}else if(A!==be||y.width!==ce.width||QeN){if(!(T!==ct||y.height!==ce.height||Ueb)){be>A&&(ce.width+=be-A,ce.x=A),UeT&&(ce.height+=ct-T,ce.y=T),Qey&&(y=N)),N ")+` No matching component was found for: `)+c.join(" > ")}return null},t.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return re(c.child.stateNode);default:return c.child.stateNode}},t.injectIntoDevTools=function(c){if(c={bundleType:c.bundleType,version:c.version,rendererPackageName:c.rendererPackageName,rendererConfig:c.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:VU,findFiberByHostInstance:c.findFiberByHostInstance||WU,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)c=!0;else{try{Op=f.inject(c),ms=f}catch{}c=!!f.checkDCE}}return c},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(c,f,y,A){if(!ut)throw Error(o(363));c=Qy(c,f);var b=Be(c,y,A).disconnect;return{disconnect:function(){b()}}},t.registerMutableSourceForHydration=function(c,f){var y=f._getVersion;y=y(f._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[f,y]:c.mutableSourceEagerHydrationData.push(f,y)},t.runWithPriority=function(c,f){var y=Dt;try{return Dt=c,f()}finally{Dt=y}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(c,f,y,A){var b=f.current,T=vr(),N=ko(b);return y=rE(y),f.context===null?f.context=y:f.pendingContext=y,f=Ns(T,N),f.payload={element:c},A=A===void 0?null:A,A!==null&&(f.callback=A),Do(b,f),c=_i(b,N,T),c!==null&&zp(c,b,N),N},t};(function(n){n.exports=A7})(S7);const M7=yw(BS);function VF(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;ii.response=s).then(()=>{r.lifespan&&r.lifespan>0&&setTimeout(()=>{const s=no.indexOf(i);s!==-1&&no.splice(s,1)},r.lifespan)}).catch(s=>i.error=s)};if(no.push(i),!t)throw i.promise}const b7=(n,e,t)=>WF(n,e,!1,t),C7=(n,e,t)=>void WF(n,e,!0,t),E7=n=>{if(n===void 0||n.length===0)no.splice(0,no.length);else{const e=no.find(t=>VF(n,t.keys,t.equal));if(e){const t=no.indexOf(e);t!==-1&&no.splice(t,1)}}},iM={},sM=n=>void Object.assign(iM,n);function T7(n,e){function t(h,{args:d=[],attach:p,...m},v){let x=`${h[0].toUpperCase()}${h.slice(1)}`,_;if(h==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const g=m.object;_=zu(g,{type:h,root:v,attach:p,primitive:!0})}else{const g=iM[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!");_=zu(new g(...d),{type:h,root:v,attach:p,memoizedProps:{args:d}})}return _.__r3f.attach===void 0&&(_ instanceof ht?_.__r3f.attach="geometry":_ instanceof Bn&&(_.__r3f.attach="material")),x!=="inject"&&g1(_,m),_}function r(h,d){let p=!1;if(d){var m,v;(m=d.__r3f)!=null&&m.attach?m1(h,d,d.__r3f.attach):d.isObject3D&&h.isObject3D&&(h.add(d),p=!0),p||(v=h.__r3f)==null||v.objects.push(d),d.__r3f||zu(d,{}),d.__r3f.parent=h,IS(d),Hu(d)}}function i(h,d,p){let m=!1;if(d){var v,x;if((v=d.__r3f)!=null&&v.attach)m1(h,d,d.__r3f.attach);else if(d.isObject3D&&h.isObject3D){d.parent=h,d.dispatchEvent({type:"added"});const _=h.children.filter(w=>w!==d),g=_.indexOf(p);h.children=[..._.slice(0,g),d,..._.slice(g)],m=!0}m||(x=h.__r3f)==null||x.objects.push(d),d.__r3f||zu(d,{}),d.__r3f.parent=h,IS(d),Hu(d)}}function s(h,d,p=!1){h&&[...h].forEach(m=>o(d,m,p))}function o(h,d,p){if(d){var m,v,x;if(d.__r3f&&(d.__r3f.parent=null),(m=h.__r3f)!=null&&m.objects&&(h.__r3f.objects=h.__r3f.objects.filter(M=>M!==d)),(v=d.__r3f)!=null&&v.attach)W2(h,d,d.__r3f.attach);else if(d.isObject3D&&h.isObject3D){var _;h.remove(d),(_=d.__r3f)!=null&&_.root&&F7(d.__r3f.root,d)}const w=(x=d.__r3f)==null?void 0:x.primitive,S=p===void 0?d.dispose!==null&&!w:p;if(!w){var g;s((g=d.__r3f)==null?void 0:g.objects,d,S),s(d.children,d,S)}d.__r3f&&(delete d.__r3f.root,delete d.__r3f.objects,delete d.__r3f.handlers,delete d.__r3f.memoizedProps,w||delete d.__r3f),S&&d.dispose&&d.type!=="Scene"&&Od.unstable_scheduleCallback(Od.unstable_IdlePriority,()=>{try{d.dispose()}catch{}}),Hu(h)}}function a(h,d,p,m){var v;const x=(v=h.__r3f)==null?void 0:v.parent;if(!x)return;const _=t(d,p,h.__r3f.root);if(h.children){for(const g of h.children)g.__r3f&&r(_,g);h.children=h.children.filter(g=>!g.__r3f)}h.__r3f.objects.forEach(g=>r(_,g)),h.__r3f.objects=[],h.__r3f.autoRemovedBeforeAppend||o(x,h),_.parent&&(_.__r3f.autoRemovedBeforeAppend=!0),r(x,_),_.raycast&&_.__r3f.eventCount&&_.__r3f.root.getState().internal.interaction.push(_),[m,m.alternate].forEach(g=>{g!==null&&(g.stateNode=_,g.ref&&(typeof g.ref=="function"?g.ref(_):g.ref.current=_))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:M7({createInstance:t,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(h,d)=>{if(!d)return;const p=h.getState().scene;p.__r3f&&(p.__r3f.root=h,r(p,d))},removeChildFromContainer:(h,d)=>{d&&o(h.getState().scene,d)},insertInContainerBefore:(h,d,p)=>{if(!d||!p)return;const m=h.getState().scene;m.__r3f&&i(m,d,p)},getRootHostContext:()=>null,getChildHostContext:h=>h,finalizeInitialChildren(h){var d;return!!((d=h==null?void 0:h.__r3f)!=null?d:{}).handlers},prepareUpdate(h,d,p,m){if(h.__r3f.primitive&&m.object&&m.object!==h)return[!0];{const{args:v=[],children:x,..._}=m,{args:g=[],children:w,...S}=p;if(!Array.isArray(v))throw new Error("R3F: the args prop must be an array!");if(v.some((C,P)=>C!==g[P]))return[!0];const M=QF(h,_,S,!0);return M.changes.length?[!1,M]:null}},commitUpdate(h,[d,p],m,v,x,_){d?a(h,m,x,_):g1(h,p)},commitMount(h,d,p,m){var v;const x=(v=h.__r3f)!=null?v:{};h.raycast&&x.handlers&&x.eventCount&&h.__r3f.root.getState().internal.interaction.push(h)},getPublicInstance:h=>h,prepareForCommit:()=>null,preparePortalMount:h=>zu(h.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(h){var d;const{attach:p,parent:m}=(d=h.__r3f)!=null?d:{};p&&m&&W2(m,h,p),h.isObject3D&&(h.visible=!1),Hu(h)},unhideInstance(h,d){var p;const{attach:m,parent:v}=(p=h.__r3f)!=null?p:{};m&&v&&m1(v,h,m),(h.isObject3D&&d.visible==null||d.visible)&&(h.visible=!0),Hu(h)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():oa.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&qt.fun(performance.now)?performance.now:qt.fun(Date.now)?Date.now:()=>0,scheduleTimeout:qt.fun(setTimeout)?setTimeout:void 0,cancelTimeout:qt.fun(clearTimeout)?clearTimeout:void 0}),applyProps:g1}}var G2,z2;const jF=()=>{var n;return(n=iM.ColorManagement)!=null?n:null},$F=n=>n&&n.isOrthographicCamera,P7=n=>n&&n.hasOwnProperty("current"),mp=typeof window<"u"&&((G2=window.document)!=null&&G2.createElement||((z2=window.navigator)==null?void 0:z2.product)==="ReactNative")?z.useLayoutEffect:z.useEffect;function JF(n){const e=z.useRef(n);return mp(()=>void(e.current=n),[n]),e}function R7({set:n}){return mp(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class XF extends z.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}XF.getDerivedStateFromError=()=>({error:!0});const KF="__default",H2=new Map,B7=n=>n&&!!n.memoized&&!!n.changes;function YF(n){const e=typeof window<"u"?window.devicePixelRatio:1;return Array.isArray(n)?Math.min(Math.max(n[0],e),n[1]):n}const dh=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},qt={obj:n=>n===Object(n)&&!qt.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(qt.str(n)||qt.num(n))return n===e;const s=qt.obj(n);if(s&&r==="reference")return n===e;const o=qt.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(!qt.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(qt.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 L7(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 I7(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function zu(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 LS(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 V2=/-\d+$/;function m1(n,e,t){if(qt.str(t)){if(V2.test(t)){const s=t.replace(V2,""),{target:o,key:a}=LS(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=LS(n,t);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=t(n,e)}function W2(n,e,t){var r,i;if(qt.str(t)){const{target:s,key:o}=LS(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 QF(n,{children:e,key:t,ref:r,...i},{children:s,key:o,ref:a,...l}={},u=!1){var h;const d=(h=n==null?void 0:n.__r3f)!=null?h:{},p=Object.entries(i),m=[];if(u){const x=Object.keys(l);for(let _=0;_{var g;if((g=n.__r3f)!=null&&g.primitive&&x==="object"||qt.equ(_,l[x]))return;if(/^on(LostPointer|Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,_,!0,[]]);let w=[];x.includes("-")&&(w=x.split("-")),m.push([x,_,!1,w]);for(const S in i){const M=i[S];S.startsWith(`${x}-`)&&m.push([S,M,!1,S.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 g1(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:u}=B7(e)?e:QF(n,e),h=s.eventCount;n.__r3f&&(n.__r3f.memoizedProps=l);for(let p=0;pS[M],n),!(w&&w.set))){const[S,...M]=_.reverse();g=M.reverse().reduce((C,P)=>C[P],n),m=S}if(v===KF+"remove")if(g.constructor){let S=H2.get(g.constructor);S||(S=new g.constructor,H2.set(g.constructor,S)),v=S[m]}else v=0;if(x)v?s.handlers[m]=v:delete s.handlers[m],s.eventCount=Object.keys(s.handlers).length;else if(w&&w.set&&(w.copy||w instanceof Cl)){if(Array.isArray(v))w.fromArray?w.fromArray(v):w.set(...v);else if(w.copy&&v&&v.constructor&&w.constructor===v.constructor)w.copy(v);else if(v!==void 0){const S=w instanceof Ce;!S&&w.setScalar?w.setScalar(v):w instanceof Cl&&v instanceof Cl?w.mask=v.mask:w.set(v),!jF()&&!a.linear&&S&&w.convertSRGBToLinear()}}else g[m]=v,!a.linear&&g[m]instanceof an&&g[m].format===Or&&g[m].type===_o&&(g[m].encoding=Ct);Hu(n)}if(s.parent&&a.internal&&n.raycast&&h!==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!(u.length===1&&u[0][0]==="onUpdate")&&u.length&&(i=n.__r3f)!=null&&i.parent&&IS(n),n}function Hu(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 IS(n){n.onUpdate==null||n.onUpdate(n)}function qF(n,e){n.manual||($F(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 Rg(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function D7(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return oa.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return oa.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return oa.ContinuousEventPriority;default:return oa.DefaultEventPriority}}function ZF(n,e,t,r){const i=t.get(e);i&&(t.delete(e),t.size===0&&(n.delete(r),i.target.releasePointerCapture(r)))}function F7(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)=>{ZF(t.capturedMap,e,r,i)})}function O7(n){function e(l){const{internal:u}=n.getState(),h=l.offsetX-u.initialClick[0],d=l.offsetY-u.initialClick[1];return Math.round(Math.sqrt(h*h+d*d))}function t(l){return l.filter(u=>["Move","Over","Enter","Out","Leave"].some(h=>{var d;return(d=u.__r3f)==null?void 0:d.handlers["onPointer"+h]}))}function r(l,u){const h=n.getState(),d=new Set,p=[],m=u?u(h.internal.interaction):h.internal.interaction;for(let g=0;g{const S=dh(g.object),M=dh(w.object);return!S||!M?g.distance-w.distance:M.events.priority-S.events.priority||g.distance-w.distance}).filter(g=>{const w=Rg(g);return d.has(w)?!1:(d.add(w),!0)});h.events.filter&&(x=h.events.filter(x,h));for(const g of x){let w=g.object;for(;w;){var _;(_=w.__r3f)!=null&&_.eventCount&&p.push({...g,eventObject:w}),w=w.parent}}if("pointerId"in l&&h.internal.capturedMap.has(l.pointerId))for(let g of h.internal.capturedMap.get(l.pointerId).values())d.has(Rg(g.intersection))||p.push(g.intersection);return p}function i(l,u,h,d){const p=n.getState();if(l.length){const m={stopped:!1};for(const v of l){const x=dh(v.object)||p,{raycaster:_,pointer:g,camera:w,internal:S}=x,M=new F(g.x,g.y,0).unproject(w),C=R=>{var I,V;return(I=(V=S.capturedMap.get(R))==null?void 0:V.has(v.eventObject))!=null?I:!1},P=R=>{const I={intersection:v,target:u.target};S.capturedMap.has(R)?S.capturedMap.get(R).set(v.eventObject,I):S.capturedMap.set(R,new Map([[v.eventObject,I]])),u.target.setPointerCapture(R)},L=R=>{const I=S.capturedMap.get(R);I&&ZF(S.capturedMap,v.eventObject,I,R)};let B={};for(let R in u){let I=u[R];typeof I!="function"&&(B[R]=I)}let E={...v,...B,pointer:g,intersections:l,stopped:m.stopped,delta:h,unprojectedPoint:M,ray:_.ray,camera:w,stopPropagation(){const R="pointerId"in u&&S.capturedMap.get(u.pointerId);if((!R||R.has(v.eventObject))&&(E.stopped=m.stopped=!0,S.hovered.size&&Array.from(S.hovered.values()).find(I=>I.eventObject===v.eventObject))){const I=l.slice(0,l.indexOf(v));s([...I,v])}},target:{hasPointerCapture:C,setPointerCapture:P,releasePointerCapture:L},currentTarget:{hasPointerCapture:C,setPointerCapture:P,releasePointerCapture:L},nativeEvent:u};if(d(E),m.stopped===!0)break}}return l}function s(l){const{internal:u}=n.getState();for(const h of u.hovered.values())if(!l.length||!l.find(d=>d.object===h.object&&d.index===h.index&&d.instanceId===h.instanceId)){const p=h.eventObject.__r3f,m=p==null?void 0:p.handlers;if(u.hovered.delete(Rg(h)),p!=null&&p.eventCount){const v={...h,intersections:l};m.onPointerOut==null||m.onPointerOut(v),m.onPointerLeave==null||m.onPointerLeave(v)}}}function o(l,u){for(let h=0;hs([])}return function(h){const{onPointerMissed:d,internal:p}=n.getState();p.lastEvent.current=h;const m=l==="onPointerMove",v=l==="onLostPointerCapture",x=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",g=r(h,m?t:void 0),w=x?e(h):0;l==="onPointerDown"&&(p.initialClick=[h.offsetX,h.offsetY],p.initialHits=g.map(M=>M.eventObject)),x&&!g.length&&w<=2&&(o(h,p.interaction),d&&d(h)),m&&s(g);function S(M){const C=M.eventObject,P=C.__r3f,L=P==null?void 0:P.handlers;if(P!=null&&P.eventCount)if(m){if(L.onPointerOver||L.onPointerEnter||L.onPointerOut||L.onPointerLeave){const B=Rg(M),E=p.hovered.get(B);E?E.stopped&&M.stopPropagation():(p.hovered.set(B,M),L.onPointerOver==null||L.onPointerOver(M),L.onPointerEnter==null||L.onPointerEnter(M))}L.onPointerMove==null||L.onPointerMove(M)}else if(v){const{internal:B}=n.getState();"pointerId"in h&&B.capturedMap.has(h.pointerId)&&requestAnimationFrame(()=>{B.capturedMap.has(h.pointerId)&&(B.capturedMap.delete(h.pointerId),s([]),L.onLostPointerCapture==null||L.onLostPointerCapture(M))})}else{const B=L[l];B?(!x||p.initialHits.includes(C))&&(o(h,p.interaction.filter(E=>!p.initialHits.includes(E))),B(M)):x&&p.initialHits.includes(C)&&o(h,p.interaction.filter(E=>!p.initialHits.includes(E)))}}i(g,h,w,S)}}return{handlePointer:a}}const k7=["set","get","setSize","setFrameloop","setDpr","events","invalidate","advance","size","viewport"],eO=n=>!!(n!=null&&n.render),oM=z.createContext(null),N7=(n,e)=>{const t=zF((a,l)=>{const u=new F,h=new F,d=new F;function p(g=l().camera,w=h,S=l().size){const{width:M,height:C,top:P,left:L}=S,B=M/C;w instanceof F?d.copy(w):d.set(...w);const E=g.getWorldPosition(u).distanceTo(d);if($F(g))return{width:M/g.zoom,height:C/g.zoom,top:P,left:L,factor:1,distance:E,aspect:B};{const R=g.fov*Math.PI/180,I=2*Math.tan(R/2)*E,V=I*(M/C);return{width:V,height:I,top:P,left:L,factor:M/V,distance:E,aspect:B}}}let m;const v=g=>a(w=>({performance:{...w.performance,current:g}})),x=new me;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(g=1)=>n(l(),g),advance:(g,w)=>e(g,w,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new ZA,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(w=>({...w,events:{...w.events,...g}})),setSize:(g,w,S,M,C)=>{const P=l().camera,L={width:g,height:w,top:M||0,left:C||0,updateStyle:S};a(B=>({size:L,viewport:{...B.viewport,...p(P,h,L)}}))},setDpr:g=>a(w=>{const S=YF(g);return{viewport:{...w.viewport,dpr:S,initialDpr:w.viewport.initialDpr||S}}}),setFrameloop:(g="always")=>{const w=l().clock;w.stop(),w.elapsedTime=0,g!=="never"&&(w.start(),w.elapsedTime=0),a(()=>({frameloop:g}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:z.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(g,w,S)=>{const M=l().internal;return M.priority=M.priority+(w>0?1:0),M.subscribers.push({ref:g,priority:w,store:S}),M.subscribers=M.subscribers.sort((C,P)=>C.priority-P.priority),()=>{const C=l().internal;C!=null&&C.subscribers&&(C.priority=C.priority-(w>0?1:0),C.subscribers=C.subscribers.filter(P=>P.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:u,gl:h,set:d}=t.getState();if(l!==i||u.dpr!==s){var p;i=l,s=u.dpr,qF(a,l),h.setPixelRatio(u.dpr);const m=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&h.domElement instanceof HTMLCanvasElement;h.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 Bg,U7=new Set,G7=new Set,z7=new Set;function v1(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function ph(n,e){switch(n){case"before":return v1(U7,e);case"after":return v1(G7,e);case"tail":return v1(z7,e)}}let y1,x1;function _1(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),y1=e.internal.subscribers,Bg=0;Bg0)&&!((u=i.gl.xr)!=null&&u.isPresenting)&&(t+=_1(l,i))}if(ph("after",l),t===0)return ph("tail",l),e=!1,cancelAnimationFrame(r)}function o(l,u=1){var h;if(!l)return n.forEach(d=>o(d.store.getState()),u);(h=l.gl.xr)!=null&&h.isPresenting||!l.internal.active||l.frameloop==="never"||(l.internal.frames=Math.min(60,l.internal.frames+u),e||(e=!0,requestAnimationFrame(s)))}function a(l,u=!0,h,d){if(u&&ph("before",l),h)_1(l,h,d);else for(const p of n.values())_1(l,p.store.getState());u&&ph("after",l)}return{loop:s,invalidate:o,advance:a}}function aM(){const n=z.useContext(oM);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function ao(n=t=>t,e){return aM()(n,e)}function Ov(n,e=0){const t=aM(),r=t.getState().internal.subscribe,i=JF(n);return mp(()=>r(i,e,t),[e,r,t]),null}function tO(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,L7(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l.message})`))))))}}function To(n,e,t,r){const i=Array.isArray(e)?e:[e],s=b7(tO(t,r),[n,...i],{equal:qt.equ});return Array.isArray(e)?s:s[0]}To.preload=function(n,e,t){const r=Array.isArray(e)?e:[e];return C7(tO(t),[n,...r])};To.clear=function(n,e){const t=Array.isArray(e)?e:[e];return E7([n,...t])};const ef=new Map,{invalidate:j2,advance:$2}=H7(ef),{reconciler:kd,applyProps:ro}=T7(ef,D7),Nu={objects:"shallow",strict:!1},V7=(n,e)=>{const t=typeof n=="function"?n(e):n;return eO(t)?t:new RA({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function W7(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 j7(n){const e=ef.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||N7(j2,$2),o=t||kd.createContainer(s,oa.ConcurrentRoot,null,!1,null,"",i,null);e||ef.set(n,{fiber:o,store:s});let a,l=!1,u;return{configure(h={}){let{gl:d,size:p,scene:m,events:v,onCreated:x,shadows:_=!1,linear:g=!1,flat:w=!1,legacy:S=!1,orthographic:M=!1,frameloop:C="always",dpr:P=[1,2],performance:L,raycaster:B,camera:E,onPointerMissed:R}=h,I=s.getState(),V=I.gl;I.gl||I.set({gl:V=V7(d,n)});let H=I.raycaster;H||I.set({raycaster:H=new rM});const{params:W,...J}=B||{};if(qt.equ(J,H,Nu)||ro(H,{...J}),qt.equ(W,H.params,Nu)||ro(H,{params:{...H.params,...W}}),!I.camera||I.camera===u&&!qt.equ(u,E,Nu)){u=E;const se=E instanceof Zd,ee=se?E:M?new ff(0,0,0,0,.1,1e3):new Dn(75,0,.1,1e3);se||(ee.position.z=5,E&&ro(ee,E),!I.camera&&!(E!=null&&E.rotation)&&ee.lookAt(0,0,0)),I.set({camera:ee})}if(!I.scene){let se;m instanceof Rd?se=m:(se=new Rd,m&&ro(se,m)),I.set({scene:zu(se)})}if(!I.xr){const se=(ie,Me)=>{const ye=s.getState();ye.frameloop!=="never"&&$2(ie,!0,ye,Me)},ee=()=>{const ie=s.getState();ie.gl.xr.enabled=ie.gl.xr.isPresenting,ie.gl.xr.setAnimationLoop(ie.gl.xr.isPresenting?se:null),ie.gl.xr.isPresenting||j2(ie)},ne={connect(){const ie=s.getState().gl;ie.xr.addEventListener("sessionstart",ee),ie.xr.addEventListener("sessionend",ee)},disconnect(){const ie=s.getState().gl;ie.xr.removeEventListener("sessionstart",ee),ie.xr.removeEventListener("sessionend",ee)}};V.xr&&ne.connect(),I.set({xr:ne})}if(V.shadowMap){const se=V.shadowMap.enabled,ee=V.shadowMap.type;if(V.shadowMap.enabled=!!_,qt.boo(_))V.shadowMap.type=Xh;else if(qt.str(_)){var re;const ne={basic:jI,percentage:_v,soft:Xh,variance:ml};V.shadowMap.type=(re=ne[_])!=null?re:Xh}else qt.obj(_)&&Object.assign(V.shadowMap,_);(se!==V.shadowMap.enabled||ee!==V.shadowMap.type)&&(V.shadowMap.needsUpdate=!0)}const ue=jF();ue&&("enabled"in ue?ue.enabled=!S:"legacyMode"in ue&&(ue.legacyMode=S));const U=g?us:Ct,$=w?as:mA;V.outputEncoding!==U&&(V.outputEncoding=U),V.toneMapping!==$&&(V.toneMapping=$),I.legacy!==S&&I.set(()=>({legacy:S})),I.linear!==g&&I.set(()=>({linear:g})),I.flat!==w&&I.set(()=>({flat:w})),d&&!qt.fun(d)&&!eO(d)&&!qt.equ(d,V,Nu)&&ro(V,d),v&&!I.events.handlers&&I.set({events:v(s)});const j=W7(n,p);return qt.equ(j,I.size,Nu)||I.setSize(j.width,j.height,j.updateStyle,j.top,j.left),P&&I.viewport.dpr!==YF(P)&&I.setDpr(P),I.frameloop!==C&&I.setFrameloop(C),I.onPointerMissed||I.set({onPointerMissed:R}),L&&!qt.equ(L,I.performance,Nu)&&I.set(se=>({performance:{...se.performance,...L}})),a=x,l=!0,this},render(h){return l||this.configure(),kd.updateContainer(z.createElement($7,{store:s,children:h,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){nO(n)}}}function $7({store:n,children:e,onCreated:t,rootElement:r}){return mp(()=>{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)},[]),z.createElement(oM.Provider,{value:n},e)}function nO(n,e){const t=ef.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),kd.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(),I7(i),ef.delete(n),e&&e(n)}catch{}},500)})}}function J7(n,e,t){return z.createElement(X7,{key:e.uuid,children:n,container:e,state:t})}function X7({state:n={},children:e,container:t}){const{events:r,size:i,...s}=n,o=aM(),[a]=z.useState(()=>new rM),[l]=z.useState(()=>new me),u=z.useCallback((d,p)=>{const m={...d};Object.keys(d).forEach(x=>{(k7.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 F,i),x!==d.camera&&qF(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]),[h]=z.useState(()=>{const d=o.getState();return zF((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(_=>({..._,events:{..._.events,...x}}))}))});return z.useEffect(()=>{const d=o.subscribe(p=>h.setState(m=>u(p,m)));return()=>{d(),h.destroy()}},[]),z.useEffect(()=>{h.setState(d=>u(o.getState(),d))},[u]),z.createElement(z.Fragment,null,kd.createPortal(z.createElement(oM.Provider,{value:h},e),h,null))}kd.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:z.version});function Ma(){return Ma=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0?r=setTimeout(l,e-h):(r=null,t||(a=n.apply(s,i),s=i=null))}var u=function(){s=this,i=arguments,o=Date.now();var h=t&&!r;return r||(r=setTimeout(l,e)),h&&(a=n.apply(s,i),s=i=null),a};return u.clear=function(){r&&(clearTimeout(r),r=null)},u.flush=function(){r&&(a=n.apply(s,i),s=i=null,clearTimeout(r),r=null)},u}DS.debounce=DS;var J2=DS;function K7(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]=z.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=z.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),u=e?typeof e=="number"?e:e.scroll:null,h=e?typeof e=="number"?e:e.resize:null,d=z.useRef(!1);z.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[p,m,v]=z.useMemo(()=>{const w=()=>{if(!l.current.element)return;const{left:S,top:M,width:C,height:P,bottom:L,right:B,x:E,y:R}=l.current.element.getBoundingClientRect(),I={left:S,top:M,width:C,height:P,bottom:L,right:B,x:E,y:R};l.current.element instanceof HTMLElement&&i&&(I.height=l.current.element.offsetHeight,I.width=l.current.element.offsetWidth),Object.freeze(I),d.current&&!Z7(l.current.lastBounds,I)&&a(l.current.lastBounds=I)};return[w,h?J2(w,h):w,u?J2(w,u):w]},[a,i,u,h]);function x(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(w=>w.removeEventListener("scroll",v,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function _(){l.current.element&&(l.current.resizeObserver=new s(v),l.current.resizeObserver.observe(l.current.element),t&&l.current.scrollContainers&&l.current.scrollContainers.forEach(w=>w.addEventListener("scroll",v,{capture:!0,passive:!0})))}const g=w=>{!w||w===l.current.element||(x(),l.current.element=w,l.current.scrollContainers=rO(w),_())};return Q7(v,!!t),Y7(m),z.useEffect(()=>{x(),_()},[t,v,m]),z.useEffect(()=>x,[]),[g,o,p]}function Y7(n){z.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function Q7(n,e){z.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function rO(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,...rO(n.parentElement)]}const q7=["x","y","top","bottom","left","right","width","height"],Z7=(n,e)=>q7.every(t=>n[t]===e[t]);var ej=Object.defineProperty,tj=Object.defineProperties,nj=Object.getOwnPropertyDescriptors,X2=Object.getOwnPropertySymbols,rj=Object.prototype.hasOwnProperty,ij=Object.prototype.propertyIsEnumerable,K2=(n,e,t)=>e in n?ej(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Y2=(n,e)=>{for(var t in e||(e={}))rj.call(e,t)&&K2(n,t,e[t]);if(X2)for(var t of X2(e))ij.call(e,t)&&K2(n,t,e[t]);return n},sj=(n,e)=>tj(n,nj(e));function iO(n,e,t){if(!n)return;if(t(n)===!0)return n;let r=e?n.return:n.child;for(;r;){const i=iO(r,e,t);if(i)return i;r=e?null:r.sibling}}function sO(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const lM=sO(z.createContext(null));class oO extends z.Component{render(){return z.createElement(lM.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:Q2,ReactCurrentDispatcher:q2}=z.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function oj(){const n=z.useContext(lM);if(n===null)throw new Error("its-fine: useFiber must be called within a !");const e=z.useId();return z.useMemo(()=>{var r;return(r=Q2==null?void 0:Q2.current)!=null?r:iO(n,!1,i=>{let s=i.memoizedState;for(;s;){if(s.memoizedState===e)return!0;s=s.next}})},[n,e])}function aj(){var n,e;const t=oj(),[r]=z.useState(()=>new Map);r.clear();let i=t;for(;i;){const s=(n=i.type)==null?void 0:n._context;s&&s!==lM&&!r.has(s)&&r.set(s,(e=q2==null?void 0:q2.current)==null?void 0:e.readContext(sO(s))),i=i.return}return r}function lj(){const n=aj();return z.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>r=>z.createElement(e,null,z.createElement(t.Provider,sj(Y2({},r),{value:n.get(t)}))),e=>z.createElement(oO,Y2({},e))),[n])}const S1={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 uj(n){const{handlePointer:e}=O7(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(S1).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,u]=S1[o];t.addEventListener(l,a,{passive:u})})},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]=S1[s];r.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const cj=z.forwardRef(function({children:e,fallback:t,resize:r,style:i,gl:s,events:o=uj,eventSource:a,eventPrefix:l,shadows:u,linear:h,flat:d,legacy:p,orthographic:m,frameloop:v,dpr:x,performance:_,raycaster:g,camera:w,onPointerMissed:S,onCreated:M,...C},P){z.useMemo(()=>sM(v7),[]);const L=lj(),[B,E]=K7({scroll:!0,debounce:{scroll:50,resize:0},...r}),R=z.useRef(null),I=z.useRef(null);z.useImperativeHandle(P,()=>R.current);const V=JF(S),[H,W]=z.useState(!1),[J,re]=z.useState(!1);if(H)throw H;if(J)throw J;const ue=z.useRef(null);mp(()=>{const $=R.current;E.width>0&&E.height>0&&$&&(ue.current||(ue.current=j7($)),ue.current.configure({gl:s,events:o,shadows:u,linear:h,flat:d,legacy:p,orthographic:m,frameloop:v,dpr:x,performance:_,raycaster:g,camera:w,size:E,onPointerMissed:(...j)=>V.current==null?void 0:V.current(...j),onCreated:j=>{j.events.connect==null||j.events.connect(a?P7(a)?a.current:a:I.current),l&&j.setEvents({compute:(se,ee)=>{const ne=se[l+"X"],ie=se[l+"Y"];ee.pointer.set(ne/ee.size.width*2-1,-(ie/ee.size.height)*2+1),ee.raycaster.setFromCamera(ee.pointer,ee.camera)}}),M==null||M(j)}}),ue.current.render(z.createElement(L,null,z.createElement(XF,{set:re},z.createElement(z.Suspense,{fallback:z.createElement(R7,{set:W})},e)))))}),z.useEffect(()=>{const $=R.current;if($)return()=>nO($)},[]);const U=a?"none":"auto";return z.createElement("div",Ma({ref:I,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:U,...i}},C),z.createElement("div",{ref:B,style:{width:"100%",height:"100%"}},z.createElement("canvas",{ref:R,style:{display:"block"}},t)))}),fj=z.forwardRef(function(e,t){return z.createElement(oO,null,z.createElement(cj,Ma({},e,{ref:t})))});function qh(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function FS(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);tMath.PI&&(t-=Math.PI*2),t}function aO(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}var Mi=function n(e,t,r){var i=this;aO(this,n),qh(this,"dot2",function(s,o){return i.x*s+i.y*o}),qh(this,"dot3",function(s,o,a){return i.x*s+i.y*o+i.z*a}),this.x=e,this.y=t,this.z=r},_j=[new Mi(1,1,0),new Mi(-1,1,0),new Mi(1,-1,0),new Mi(-1,-1,0),new Mi(1,0,1),new Mi(-1,0,1),new Mi(1,0,-1),new Mi(-1,0,-1),new Mi(0,1,1),new Mi(0,-1,1),new Mi(0,1,-1),new Mi(0,-1,-1)],Z2=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180],eP=new Array(512),tP=new Array(512),Sj=function(e){e>0&&e<1&&(e*=65536),e=Math.floor(e),e<256&&(e|=e<<8);for(var t=0;t<256;t++){var r;t&1?r=Z2[t]^e&255:r=Z2[t]^e>>8&255,eP[t]=eP[t+256]=r,tP[t]=tP[t+256]=_j[r%12]}};Sj(0);function wj(n){if(typeof n=="number")n=Math.abs(n);else if(typeof n=="string"){var e=n;n=0;for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:.01,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1/(2*Math.PI);return r/Math.atan(1/t)*Math.atan(Math.sin(2*Math.PI*e*i)/t)},lO=function(e){return 1/(1+e+.48*e*e+.235*e*e*e)};function On(n,e,t){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:.25,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:.01,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:1/0,o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:lO,a=arguments.length>7&&arguments[7]!==void 0?arguments[7]:.001,l="velocity_"+e;if(n.__damp===void 0&&(n.__damp={}),n.__damp[l]===void 0&&(n.__damp[l]=0),Math.abs(n[e]-t)<=a)return n[e]=t,!1;r=Math.max(1e-4,r);var u=2/r,h=o(u*i),d=n[e]-t,p=t,m=s*r;d=Math.min(Math.max(d,-m),m),t=n[e]-d;var v=(n.__damp[l]+u*d)*i;n.__damp[l]=(n.__damp[l]-u*v)*h;var x=t+(d+v)*h;return p-n[e]>0==x>p&&(x=p,n.__damp[l]=(x-p)/i),n[e]=x,!0}function Fc(n,e,t,r,i,s,o,a){return On(n,e,n[e]+xj(n[e],t),r,i,s,o,a)}var mh=new me,rP,iP;function bj(n,e,t,r,i,s,o){return typeof e=="number"?mh.setScalar(e):Array.isArray(e)?mh.set(e[0],e[1]):mh.copy(e),rP=On(n,"x",mh.x,t,r,i,s,o),iP=On(n,"y",mh.y,t,r,i,s,o),rP||iP}var Uu=new F,sP,oP,aP;function OS(n,e,t,r,i,s,o){return typeof e=="number"?Uu.setScalar(e):Array.isArray(e)?Uu.set(e[0],e[1],e[2]):Uu.copy(e),sP=On(n,"x",Uu.x,t,r,i,s,o),oP=On(n,"y",Uu.y,t,r,i,s,o),aP=On(n,"z",Uu.z,t,r,i,s,o),sP||oP||aP}var el=new Lt,lP,uP,cP,fP;function Cj(n,e,t,r,i,s,o){return typeof e=="number"?el.setScalar(e):Array.isArray(e)?el.set(e[0],e[1],e[2],e[3]):el.copy(e),lP=On(n,"x",el.x,t,r,i,s,o),uP=On(n,"y",el.y,t,r,i,s,o),cP=On(n,"z",el.z,t,r,i,s,o),fP=On(n,"w",el.w,t,r,i,s,o),lP||uP||cP||fP}var gh=new Ba,hP,dP,pP;function Ej(n,e,t,r,i,s,o){return Array.isArray(e)?gh.set(e[0],e[1],e[2],e[3]):gh.copy(e),hP=Fc(n,"x",gh.x,t,r,i,s,o),dP=Fc(n,"y",gh.y,t,r,i,s,o),pP=Fc(n,"z",gh.z,t,r,i,s,o),hP||dP||pP}var Gu=new Ce,mP,gP,vP;function Tj(n,e,t,r,i,s,o){return e instanceof Ce?Gu.copy(e):Array.isArray(e)?Gu.setRGB(e[0],e[1],e[2]):Gu.set(e),mP=On(n,"r",Gu.r,t,r,i,s,o),gP=On(n,"g",Gu.g,t,r,i,s,o),vP=On(n,"b",Gu.b,t,r,i,s,o),mP||gP||vP}var Qi=new Xn,Ys=new Lt,yP=new Lt,vh=new Lt,xP,_P,SP,wP;function uO(n,e,t,r,i,s,o){var a=n;Array.isArray(e)?Qi.set(e[0],e[1],e[2],e[3]):Qi.copy(e);var l=n.dot(Qi)>0?1:-1;return Qi.x*=l,Qi.y*=l,Qi.z*=l,Qi.w*=l,xP=On(n,"x",Qi.x,t,r,i,s,o),_P=On(n,"y",Qi.y,t,r,i,s,o),SP=On(n,"z",Qi.z,t,r,i,s,o),wP=On(n,"w",Qi.w,t,r,i,s,o),Ys.set(n.x,n.y,n.z,n.w).normalize(),yP.set(a.__damp.velocity_x,a.__damp.velocity_y,a.__damp.velocity_z,a.__damp.velocity_w),vh.copy(Ys).multiplyScalar(yP.dot(Ys)/Ys.dot(Ys)),a.__damp.velocity_x-=vh.x,a.__damp.velocity_y-=vh.y,a.__damp.velocity_z-=vh.z,a.__damp.velocity_w-=vh.w,n.set(Ys.x,Ys.y,Ys.z,Ys.w),xP||_P||SP||wP}var yh=new UF,AP,MP,bP;function Pj(n,e,t,r,i,s,o){return Array.isArray(e)?yh.set(e[0],e[1],e[2]):yh.copy(e),AP=On(n,"radius",yh.radius,t,r,i,s,o),MP=Fc(n,"phi",yh.phi,t,r,i,s,o),bP=Fc(n,"theta",yh.theta,t,r,i,s,o),AP||MP||bP}var Lg=new ot,CP=new F,EP=new Xn,TP=new F,PP,RP,BP;function Rj(n,e,t,r,i,s,o){var a=n;return a.__damp===void 0&&(a.__damp={position:new F,rotation:new Xn,scale:new F},n.decompose(a.__damp.position,a.__damp.rotation,a.__damp.scale)),Array.isArray(e)?Lg.set.apply(Lg,gj(e)):Lg.copy(e),Lg.decompose(CP,EP,TP),PP=OS(a.__damp.position,CP,t,r,i,s,o),RP=uO(a.__damp.rotation,EP,t,r,i,s,o),BP=OS(a.__damp.scale,TP,t,r,i,s,o),n.compose(a.__damp.position,a.__damp.rotation,a.__damp.scale),PP||RP||BP}var kS=Object.freeze({__proto__:null,rsqw:Mj,exp:lO,damp:On,dampAngle:Fc,damp2:bj,damp3:OS,damp4:Cj,dampE:Ej,dampC:Tj,dampQ:uO,dampS:Pj,dampM:Rj});const Bj=n=>n&&n.isCubeTexture;class Lj extends Rn{constructor(e,t){var r,i;const s=Bj(e),a=((r=s?(i=e.image[0])===null||i===void 0?void 0:i.width:e.image.width)!=null?r:1024)/4,l=Math.floor(Math.log2(a)),u=Math.pow(2,l),h=3*Math.max(u,16*7),d=4*u,p=[s?"#define ENVMAP_TYPE_CUBE":"",`#define CUBEUV_TEXEL_WIDTH ${1/h}`,`#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 } `,x={map:{value:e},height:{value:(t==null?void 0:t.height)||15},radius:{value:(t==null?void 0:t.radius)||100}},_=new pf(1,16),g=new Oi({uniforms:x,fragmentShader:v,vertexShader:m,side:Pi});super(_,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 uM extends Er{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new kj(t)}),this.register(function(t){return new Wj(t)}),this.register(function(t){return new jj(t)}),this.register(function(t){return new Uj(t)}),this.register(function(t){return new Gj(t)}),this.register(function(t){return new zj(t)}),this.register(function(t){return new Hj(t)}),this.register(function(t){return new Oj(t)}),this.register(function(t){return new Vj(t)}),this.register(function(t){return new Nj(t)}),this.register(function(t){return new Dj(t)}),this.register(function(t){return new $j(t)})}load(e,t,r,i){const s=this;let o;this.resourcePath!==""?o=this.resourcePath:this.path!==""?o=this.path:o=Rs.extractUrlBase(e),this.manager.itemStart(e);const a=function(u){i?i(u):console.error(u),s.manager.itemError(e),s.manager.itemEnd(e)},l=new ui(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,function(u){try{s.parse(u,o,function(h){t(h),s.manager.itemEnd(e)},a)}catch(h){a(h)}},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=e;else if(Rs.decodeText(new Uint8Array(e,0,4))===cO){try{o[Mt.KHR_BINARY_GLTF]=new Jj(e)}catch(d){i&&i(d);return}s=o[Mt.KHR_BINARY_GLTF].content}else s=Rs.decodeText(new Uint8Array(e));const l=JSON.parse(s);if(l.asset===void 0||l.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const u=new o$(l,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h=0&&a[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}u.setExtensions(o),u.setPlugins(a),u.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function Ij(){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 Mt={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_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",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_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_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class Dj{constructor(e){this.parser=e,this.name=Mt.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 jj{constructor(e){this.parser=e,this.name=Mt.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 u=r.options.manager.getHandler(a.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)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 $j{constructor(e){this.name=Mt.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,u=i.byteLength||0,h=i.count,d=i.byteStride,p=new Uint8Array(a,l,u);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(h,d,p,i.mode,i.filter).then(function(m){return m.buffer}):o.ready.then(function(){const m=new ArrayBuffer(h*d);return o.decodeGltfBuffer(new Uint8Array(m),h,d,p,i.mode,i.filter),m})})}else return null}}const cO="glTF",xh=12,LP={JSON:1313821514,BIN:5130562};class Jj{constructor(e){this.name=Mt.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,xh);if(this.header={magic:Rs.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==cO)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-xh,i=new DataView(e,xh);let s=0;for(;s",t).replace("#include ",r).replace("#include ",i).replace("#include ",s).replace("#include ",o)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(l){a.specular.value=l}},specularMap:{get:function(){return a.specularMap.value},set:function(l){a.specularMap.value=l,l?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return a.glossiness.value},set:function(l){a.glossiness.value=l}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(l){a.glossinessMap.value=l,l?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class Yj{constructor(){this.name=Mt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity","refractionRatio"]}getMaterialType(){return NS}extendParams(e,t,r){const i=t.extensions[this.name];e.color=new Ce(1,1,1),e.opacity=1;const s=[];if(Array.isArray(i.diffuseFactor)){const o=i.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(i.diffuseTexture!==void 0&&s.push(r.assignTexture(e,"map",i.diffuseTexture,Ct)),e.emissive=new Ce(0,0,0),e.glossiness=i.glossinessFactor!==void 0?i.glossinessFactor:1,e.specular=new Ce(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),i.specularGlossinessTexture!==void 0){const o=i.specularGlossinessTexture;s.push(r.assignTexture(e,"glossinessMap",o)),s.push(r.assignTexture(e,"specularMap",o,Ct))}return Promise.all(s)}createMaterial(e){const t=new NS(e);return t.fog=!0,t.color=e.color,t.map=e.map===void 0?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=e.aoMap===void 0?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=e.emissiveIntensity===void 0?1:e.emissiveIntensity,t.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,t.bumpMap=e.bumpMap===void 0?null:e.bumpMap,t.bumpScale=1,t.normalMap=e.normalMap===void 0?null:e.normalMap,t.normalMapType=Mo,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=e.specularMap===void 0?null:e.specularMap,t.specular=e.specular,t.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=e.envMap===void 0?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t}}class Qj{constructor(){this.name=Mt.KHR_MESH_QUANTIZATION}}class fO extends yf{constructor(e,t,r,i){super(e,t,r,i)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let o=0;o!==i;o++)t[o]=r[s+o];return t}interpolate_(e,t,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,u=a*3,h=i-t,d=(r-t)/h,p=d*d,m=p*d,v=e*u,x=v-u,_=-2*m+3*p,g=m-p,w=1-_,S=g-p+d;for(let M=0;M!==a;M++){const C=o[x+M+a],P=o[x+M+l]*h,L=o[v+M+a],B=o[v+M]*h;s[M]=w*C+S*P+_*L+g*B}return s}}const qj=new Xn;class Zj extends fO{interpolate_(e,t,r,i){const s=super.interpolate_(e,t,r,i);return qj.fromArray(s).normalize().toArray(s),s}}const Qs={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Nd={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},IP={9728:yn,9729:Zt,9984:Cd,9985:wv,9986:Bc,9987:Ds},DP={33071:er,33648:jc,10497:Sa},FP={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},US={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Jo={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},e$={CUBICSPLINE:void 0,LINEAR:Fl,STEP:$c},w1={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function t$(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new vf({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Is})),n.DefaultMaterial}function _h(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 sl(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 n$(n,e,t){let r=!1,i=!1,s=!1;for(let u=0,h=e.length;u0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}class o${constructor(e={},t={}){var r,i;this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Ij,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};const s=typeof navigator<"u"&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,o=typeof navigator<"u"&&((r=navigator.userAgent)===null||r===void 0?void 0:r.indexOf("Firefox"))>-1,a=typeof navigator<"u"&&o?(i=navigator.userAgent)===null||i===void 0?void 0:i.match(/Firefox\/([0-9]+)\./)[1]:-1;typeof createImageBitmap>"u"||s||o&&a<98?this.textureLoader=new pp(this.options.manager):this.textureLoader=new FF(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ui(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._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:{}};_h(s,a,i),sl(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[u,h]of o.children.entries())s(h,a.children[u])};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&&_.setY(E,P[L*l+1]),l>=3&&_.setZ(E,P[L*l+2]),l>=4&&_.setW(E,P[L*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return _})}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 u=this.loadImageSource(t,r).then(function(h){h.flipY=!1,o.name&&(h.name=o.name);const p=(s.samplers||{})[o.sampler]||{};return h.magFilter=IP[p.magFilter]||Zt,h.minFilter=IP[p.minFilter]||Ds,h.wrapS=DP[p.wrapS]||Sa,h.wrapT=DP[p.wrapT]||Sa,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[l]=u,u}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||"",u=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(d){u=!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 h=Promise.resolve(l).then(function(d){return new Promise(function(p,m){let v=p;t.isImageBitmapLoader===!0&&(v=function(x){const _=new an(x);_.needsUpdate=!0,p(_)}),t.load(Rs.resolveURL(d,s.path),v,void 0,m)})}).then(function(d){return u===!0&&a.revokeObjectURL(l),d.userData.mimeType=o.mimeType||s$(o.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),d});return this.sourceCache[e]=h,h}assignTexture(e,t,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(r.texCoord!==void 0&&r.texCoord!=0&&!(t==="aoMap"&&r.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),s.extensions[Mt.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[Mt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Mt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(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 Rv,Bn.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 pr,Bn.prototype.copy.call(l,r),l.color.copy(r.color),this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";r.isGLTFSpecularGlossinessMaterial&&(a+="specular-glossiness:"),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}r.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=r}getMaterialType(){return vf}loadMaterial(e){const t=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},u=[];if(l[Mt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const d=i[Mt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];o=d.getMaterialType(),u.push(d.extendParams(a,s,t))}else if(l[Mt.KHR_MATERIALS_UNLIT]){const d=i[Mt.KHR_MATERIALS_UNLIT];o=d.getMaterialType(),u.push(d.extendParams(a,s,t))}else{const d=s.pbrMetallicRoughness||{};if(a.color=new Ce(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&&u.push(t.assignTexture(a,"map",d.baseColorTexture,Ct)),a.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,a.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(u.push(t.assignTexture(a,"metalnessMap",d.metallicRoughnessTexture)),u.push(t.assignTexture(a,"roughnessMap",d.metallicRoughnessTexture))),o=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=Pi);const h=s.alphaMode||w1.OPAQUE;if(h===w1.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,h===w1.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==ni&&(u.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new me(1,1),s.normalTexture.scale!==void 0)){const d=s.normalTexture.scale;a.normalScale.set(d,d)}return s.occlusionTexture!==void 0&&o!==ni&&(u.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==ni&&(a.emissive=new Ce().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==ni&&u.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,Ct)),Promise.all(u).then(function(){let d;return o===NS?d=i[Mt.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):d=new o(a),s.name&&(d.name=s.name),sl(d,s),t.associations.set(d,{materials:e}),s.extensions&&_h(i,d,s),d})}createUniqueName(e){const t=Rt.sanitizeNodeName(e||"");let r=t;for(let i=1;this.nodeNamesUsed[r];++i)r=t+"_"+i;return this.nodeNamesUsed[r]=!0,r}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[Mt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return kP(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&r$(g,s),g.name=t.createUniqueName(s.name||"mesh_"+e),sl(g,s),_.extensions&&_h(i,g,_),t.assignFinalMaterial(g),d.push(g)}for(let m=0,v=d.length;m1?l=new oo:a.length===1?l=a[0]:l=new Bt,l!==a[0])for(let u=0,h=a.length;u{const d=new Map;for(const[p,m]of s.associations)(p instanceof Bn||p instanceof an)&&d.set(p,m);return h.traverse(p=>{const m=s.associations.get(p);m!=null&&d.set(p,m)}),d};return s.associations=u(o),o})}}function hO(n,e,t,r){const i=t.nodes[n];return r.getDependency("node",n).then(function(s){if(i.skin===void 0)return s;let o;return r.getDependency("skin",i.skin).then(function(a){o=a;const l=[];for(let u=0,h=o.joints.length;u0,C=H>0,P=W>0,L=(M?1:0)+(C?1:0)+(P?1:0),L){case 0:{g.push(x[S]),g.push(x[S+1]),g.push(x[S+2]);break}case 1:{if(M&&(B=x[S+1],E=x[S+2],R=v(x[S],B,_,w),I=v(x[S],E,_,w)),C){B=x[S],E=x[S+2],R=v(x[S+1],B,_,w),I=v(x[S+1],E,_,w),g.push(R),g.push(E.clone()),g.push(B.clone()),g.push(E.clone()),g.push(R.clone()),g.push(I);break}P&&(B=x[S],E=x[S+1],R=v(x[S+2],B,_,w),I=v(x[S+2],E,_,w)),g.push(B.clone()),g.push(E.clone()),g.push(R),g.push(I),g.push(R.clone()),g.push(E.clone());break}case 2:{M||(B=x[S].clone(),E=v(B,x[S+1],_,w),R=v(B,x[S+2],_,w),g.push(B),g.push(E),g.push(R)),C||(B=x[S+1].clone(),E=v(B,x[S+2],_,w),R=v(B,x[S],_,w),g.push(B),g.push(E),g.push(R)),P||(B=x[S+2].clone(),E=v(B,x[S],_,w),R=v(B,x[S+1],_,w),g.push(B),g.push(E),g.push(R));break}}}return g}function v(x,_,g,w){const S=x.position.dot(g)-w,M=_.position.dot(g)-w,C=S/(S-M);return new UP(new F(x.position.x+C*(_.position.x-x.position.x),x.position.y+C*(_.position.y-x.position.y),x.position.z+C*(_.position.z-x.position.z)),new F(x.normal.x+C*(_.normal.x-x.normal.x),x.normal.y+C*(_.normal.y-x.normal.y),x.normal.z+C*(_.normal.z-x.normal.z)))}}}class UP{constructor(e,t){this.position=e,this.normal=t}clone(){return new this.constructor(this.position.clone(),this.normal.clone())}}var u$=Object.prototype;function c$(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||u$;return n===t}var cM=c$;function f$(n,e){return function(t){return n(e(t))}}var dO=f$,h$=dO,d$=h$(Object.keys,Object),p$=d$,m$=cM,g$=p$,v$=Object.prototype,y$=v$.hasOwnProperty;function x$(n){if(!m$(n))return g$(n);var e=[];for(var t in Object(n))y$.call(n,t)&&t!="constructor"&&e.push(t);return e}var _$=x$,S$=typeof bm=="object"&&bm&&bm.Object===Object&&bm,pO=S$,w$=pO,A$=typeof self=="object"&&self&&self.Object===Object&&self,M$=w$||A$||Function("return this")(),Fs=M$,b$=Fs,C$=b$.Symbol,gp=C$,GP=gp,mO=Object.prototype,E$=mO.hasOwnProperty,T$=mO.toString,Sh=GP?GP.toStringTag:void 0;function P$(n){var e=E$.call(n,Sh),t=n[Sh];try{n[Sh]=void 0;var r=!0}catch{}var i=T$.call(n);return r&&(e?n[Sh]=t:delete n[Sh]),i}var R$=P$,B$=Object.prototype,L$=B$.toString;function I$(n){return L$.call(n)}var D$=I$,zP=gp,F$=R$,O$=D$,k$="[object Null]",N$="[object Undefined]",HP=zP?zP.toStringTag:void 0;function U$(n){return n==null?n===void 0?N$:k$:HP&&HP in Object(n)?F$(n):O$(n)}var $l=U$;function G$(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var xf=G$,z$=$l,H$=xf,V$="[object AsyncFunction]",W$="[object Function]",j$="[object GeneratorFunction]",$$="[object Proxy]";function J$(n){if(!H$(n))return!1;var e=z$(n);return e==W$||e==j$||e==V$||e==$$}var gO=J$,X$=Fs,K$=X$["__core-js_shared__"],Y$=K$,A1=Y$,VP=function(){var n=/[^.]+$/.exec(A1&&A1.keys&&A1.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}();function Q$(n){return!!VP&&VP in n}var q$=Q$,Z$=Function.prototype,eJ=Z$.toString;function tJ(n){if(n!=null){try{return eJ.call(n)}catch{}try{return n+""}catch{}}return""}var vO=tJ,nJ=gO,rJ=q$,iJ=xf,sJ=vO,oJ=/[\\^$.*+?()[\]{}|]/g,aJ=/^\[object .+?Constructor\]$/,lJ=Function.prototype,uJ=Object.prototype,cJ=lJ.toString,fJ=uJ.hasOwnProperty,hJ=RegExp("^"+cJ.call(fJ).replace(oJ,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function dJ(n){if(!iJ(n)||rJ(n))return!1;var e=nJ(n)?hJ:aJ;return e.test(sJ(n))}var pJ=dJ;function mJ(n,e){return n==null?void 0:n[e]}var gJ=mJ,vJ=pJ,yJ=gJ;function xJ(n,e){var t=yJ(n,e);return vJ(t)?t:void 0}var Jl=xJ,_J=Jl,SJ=Fs,wJ=_J(SJ,"DataView"),AJ=wJ,MJ=Jl,bJ=Fs,CJ=MJ(bJ,"Map"),fM=CJ,EJ=Jl,TJ=Fs,PJ=EJ(TJ,"Promise"),RJ=PJ,BJ=Jl,LJ=Fs,IJ=BJ(LJ,"Set"),DJ=IJ,FJ=Jl,OJ=Fs,kJ=FJ(OJ,"WeakMap"),NJ=kJ,zS=AJ,HS=fM,VS=RJ,WS=DJ,jS=NJ,yO=$l,_f=vO,WP="[object Map]",UJ="[object Object]",jP="[object Promise]",$P="[object Set]",JP="[object WeakMap]",XP="[object DataView]",GJ=_f(zS),zJ=_f(HS),HJ=_f(VS),VJ=_f(WS),WJ=_f(jS),ol=yO;(zS&&ol(new zS(new ArrayBuffer(1)))!=XP||HS&&ol(new HS)!=WP||VS&&ol(VS.resolve())!=jP||WS&&ol(new WS)!=$P||jS&&ol(new jS)!=JP)&&(ol=function(n){var e=yO(n),t=e==UJ?n.constructor:void 0,r=t?_f(t):"";if(r)switch(r){case GJ:return XP;case zJ:return WP;case HJ:return jP;case VJ:return $P;case WJ:return JP}return e});var kv=ol;function jJ(n){return n!=null&&typeof n=="object"}var Po=jJ,$J=$l,JJ=Po,XJ="[object Arguments]";function KJ(n){return JJ(n)&&$J(n)==XJ}var YJ=KJ,KP=YJ,QJ=Po,xO=Object.prototype,qJ=xO.hasOwnProperty,ZJ=xO.propertyIsEnumerable,eX=KP(function(){return arguments}())?KP:function(n){return QJ(n)&&qJ.call(n,"callee")&&!ZJ.call(n,"callee")},_O=eX,tX=Array.isArray,ds=tX,nX=9007199254740991;function rX(n){return typeof n=="number"&&n>-1&&n%1==0&&n<=nX}var hM=rX,iX=gO,sX=hM;function oX(n){return n!=null&&sX(n.length)&&!iX(n)}var Nv=oX,tf={},aX={get exports(){return tf},set exports(n){tf=n}};function lX(){return!1}var uX=lX;(function(n,e){var t=Fs,r=uX,i=e&&!e.nodeType&&e,s=i&&!0&&n&&!n.nodeType&&n,o=s&&s.exports===i,a=o?t.Buffer:void 0,l=a?a.isBuffer:void 0,u=l||r;n.exports=u})(aX,tf);var cX=$l,fX=hM,hX=Po,dX="[object Arguments]",pX="[object Array]",mX="[object Boolean]",gX="[object Date]",vX="[object Error]",yX="[object Function]",xX="[object Map]",_X="[object Number]",SX="[object Object]",wX="[object RegExp]",AX="[object Set]",MX="[object String]",bX="[object WeakMap]",CX="[object ArrayBuffer]",EX="[object DataView]",TX="[object Float32Array]",PX="[object Float64Array]",RX="[object Int8Array]",BX="[object Int16Array]",LX="[object Int32Array]",IX="[object Uint8Array]",DX="[object Uint8ClampedArray]",FX="[object Uint16Array]",OX="[object Uint32Array]",Yt={};Yt[TX]=Yt[PX]=Yt[RX]=Yt[BX]=Yt[LX]=Yt[IX]=Yt[DX]=Yt[FX]=Yt[OX]=!0;Yt[dX]=Yt[pX]=Yt[CX]=Yt[mX]=Yt[EX]=Yt[gX]=Yt[vX]=Yt[yX]=Yt[xX]=Yt[_X]=Yt[SX]=Yt[wX]=Yt[AX]=Yt[MX]=Yt[bX]=!1;function kX(n){return hX(n)&&fX(n.length)&&!!Yt[cX(n)]}var NX=kX;function UX(n){return function(e){return n(e)}}var dM=UX,nf={},GX={get exports(){return nf},set exports(n){nf=n}};(function(n,e){var t=pO,r=e&&!e.nodeType&&e,i=r&&!0&&n&&!n.nodeType&&n,s=i&&i.exports===r,o=s&&t.process,a=function(){try{var l=i&&i.require&&i.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}}();n.exports=a})(GX,nf);var zX=NX,HX=dM,YP=nf,QP=YP&&YP.isTypedArray,VX=QP?HX(QP):zX,SO=VX;function WX(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var oK=sK,aK=Uv;function lK(n,e){var t=this.__data__,r=aK(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var uK=lK,cK=$X,fK=eK,hK=rK,dK=oK,pK=uK;function Sf(n){var e=-1,t=n==null?0:n.length;for(this.clear();++ea))return!1;var u=s.get(n),h=s.get(e);if(u&&h)return u==e&&h==n;var d=-1,p=!0,m=t&QY?new JY:void 0;for(s.set(n,e),s.set(e,n);++d-1&&n%1==0&&n(B=I.indexOf(d))&&E=S.byteLength||!(R=p(S)))return a(1,"no header found");if(!(I=R.match(M)))return a(3,"bad initial token");for(E.valid|=1,E.programtype=I[1],E.string+=R+` `;R=p(S),R!==!1;){if(E.string+=R+` `,R.charAt(0)==="#"){E.comments+=R+` `;continue}if((I=R.match(C))&&(E.gamma=parseFloat(I[1])),(I=R.match(P))&&(E.exposure=parseFloat(I[1])),(I=R.match(L))&&(E.valid|=2,E.format=I[1]),(I=R.match(B))&&(E.valid|=4,E.height=parseInt(I[1],10),E.width=parseInt(I[2],10)),E.valid&2&&E.valid&4)break}return E.valid&2?E.valid&4?E:a(3,"missing image size specifier"):a(3,"missing format specifier")},v=function(S,M,C){const P=M;if(P<8||P>32767||S[0]!==2||S[1]!==2||S[2]&128)return new Uint8Array(S);if(P!==(S[2]<<8|S[3]))return a(3,"wrong scanline width");const L=new Uint8Array(4*M*C);if(!L.length)return a(4,"unable to allocate buffer space");let B=0,E=0;const R=4*P,I=new Uint8Array(4),V=new Uint8Array(R);let H=C;for(;H>0&&ES.byteLength)return a(1);if(I[0]=S[E++],I[1]=S[E++],I[2]=S[E++],I[3]=S[E++],I[0]!=2||I[1]!=2||(I[2]<<8|I[3])!=P)return a(3,"bad rgbe scanline format");let W=0,J;for(;W128;if(ue&&(J-=128),J===0||W+J>R)return a(3,"bad scanline data");if(ue){const U=S[E++];for(let $=0;${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 u=t.attributeTypes[l];u.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=u.name)}const r=JSON.stringify(t);if(C1.has(e)){const l=C1.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((u,h)=>{i._callbacks[s]={resolve:u,reject:h},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)}),C1.set(e,{key:r,promise:a}),a}_createGeometry(e){const t=new ht;e.index&&t.setIndex(new Nt(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=cie.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=h.draco,p=new d.Decoder,m=new d.DecoderBuffer;m.Init(new Int8Array(l),l.byteLength);try{const v=t(d,p,m,u),x=v.attributes.map(_=>_.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,u){const h=u.attributeIDs,d=u.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 _ in h){const g=self[d[_]];let w,S;if(u.useUniqueIDs)S=h[_],w=a.GetAttributeByUniqueId(p,S);else{if(S=a.GetAttributeId(p,o[h[_]]),S===-1)continue;w=a.GetAttribute(p,S)}x.attributes.push(i(o,a,p,_,g,w))}return v===o.TRIANGULAR_MESH&&(x.index=r(o,a,p)),o.destroy(p),x}function r(o,a,l){const h=l.num_faces()*3,d=h*4,p=o._malloc(d);a.GetTrianglesUInt32Array(l,d,p);const m=new Uint32Array(o.HEAPF32.buffer,p,h).slice();return o._free(p),{array:m,itemSize:1}}function i(o,a,l,u,h,d){const p=d.num_components(),v=l.num_points()*p,x=v*h.BYTES_PER_ELEMENT,_=s(o,h),g=o._malloc(x);a.GetAttributeDataArrayForAllPoints(l,d,_,x,g);const w=new h(o.HEAPF32.buffer,g,v).slice();return o._free(g),{name:u,array:w,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 Dg;const E1=()=>{if(Dg)return Dg;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{const d=bA.clone({[u]:{value:h}});return{...l,...d}},{}),vertexShader:e,fragmentShader:t}),this.key="",a.forEach(([l])=>Object.defineProperty(this,l,{get:()=>this.uniforms[l].value,set:u=>this.uniforms[l].value=u})),Object.assign(this,o),r&&r(this)}};return i.key=Lc.generateUUID(),i}const b3=n=>n===Object(n)&&!Array.isArray(n)&&typeof n!="function";function U0(n,e){const t=ao(i=>i.gl),r=To(pp,b3(n)?Object.values(n):n);if(z.useLayoutEffect(()=>{e==null||e(r)},[e]),z.useEffect(()=>{(Array.isArray(r)?r:[r]).forEach(t.initTexture)},[t,r]),b3(n)){const i=Object.keys(n),s={};return i.forEach(o=>Object.assign(s,{[o]:r[i.indexOf(o)]})),s}else return r}U0.preload=n=>To.preload(pp,n);U0.clear=n=>To.clear(pp,n);function fie(n){return Array.isArray(n)}function T1(n=[0,0,0]){return fie(n)?n:n instanceof F||n instanceof Ba?[n.x,n.y,n.z]:[n,n,n]}const C3=z.forwardRef(function({debug:e,mesh:t,children:r,position:i,rotation:s,scale:o,...a},l){const u=z.useRef(null);z.useImperativeHandle(l,()=>u.current);const h=z.useRef(null);return z.useLayoutEffect(()=>{const d=(t==null?void 0:t.current)||u.current.parent,p=u.current;if(!(d instanceof Rn))throw new Error('Decal must have a Mesh as parent or specify its "mesh" prop');const m={position:new F,rotation:new Ba,scale:new F(1,1,1)};if(d){ro(m,{position:i,scale:o});const v=d.matrixWorld.clone();if(d.matrixWorld.identity(),!s||typeof s=="number"){const x=new Bt;x.position.copy(m.position),x.lookAt(d.position),typeof s=="number"&&x.rotateZ(s),ro(m,{rotation:x.rotation})}else ro(m,{rotation:s});return p.geometry=new l$(d,m.position,m.rotation,m.scale),h.current&&ro(h.current,m),d.matrixWorld=v,()=>{p.geometry.dispose()}}},[t,...T1(i),...T1(o),...T1(s)]),z.createElement("mesh",{ref:u},r||z.createElement("meshStandardMaterial",Ma({transparent:!0,polygonOffset:!0,polygonOffsetFactor:-10},a)),e&&z.createElement("mesh",{ref:h},z.createElement("boxGeometry",null),z.createElement("meshNormalMaterial",{wireframe:!0}),z.createElement("axesHelper",null)))});let Fg=null;function XO(n,e,t){return r=>{t&&t(r),n&&(Fg||(Fg=new uie),Fg.setDecoderPath(typeof n=="string"?n:"https://www.gstatic.com/draco/versioned/decoders/1.5.5/"),r.setDRACOLoader(Fg)),e&&r.setMeshoptDecoder(typeof E1=="function"?E1():E1)}}function MM(n,e=!0,t=!0,r){return To(uM,n,XO(e,t,r))}MM.preload=(n,e=!0,t=!0,r)=>To.preload(uM,n,XO(e,t,r));MM.clear=n=>To.clear(uM,n);const hie=JO({},"void main() { }","void main() { gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); discard; }"),die=z.forwardRef(function({children:e,disable:t,disableX:r,disableY:i,disableZ:s,left:o,right:a,top:l,bottom:u,front:h,back:d,onCentered:p,precise:m=!0,...v},x){const _=z.useRef(null),g=z.useRef(null),w=z.useRef(null);return z.useLayoutEffect(()=>{g.current.matrixWorld.identity();const S=new Ni().setFromObject(w.current,m),M=new F,C=new Ui,P=S.max.x-S.min.x,L=S.max.y-S.min.y,B=S.max.z-S.min.z;S.getCenter(M),S.getBoundingSphere(C);const E=l?L/2:u?-L/2:0,R=o?-P/2:a?P/2:0,I=h?B/2:d?-B/2:0;g.current.position.set(t||r?0:-M.x+R,t||i?0:-M.y+E,t||s?0:-M.z+I),typeof p<"u"&&p({parent:_.current.parent,container:_.current,width:P,height:L,depth:B,boundingBox:S,boundingSphere:C,center:M,verticalAlignment:E,horizontalAlignment:R,depthAlignment:I})},[e,p,l,o,h,t,r,i,s,m,a,u,d]),z.useImperativeHandle(x,()=>_.current,[]),z.createElement("group",Ma({ref:_},v),z.createElement("group",{ref:g},z.createElement("group",{ref:w},e)))}),P1={sunset:"venice/venice_sunset_1k.hdr",dawn:"kiara/kiara_1_dawn_1k.hdr",night:"dikhololo/dikhololo_night_1k.hdr",warehouse:"empty-wharehouse/empty_warehouse_01_1k.hdr",forest:"forrest-slope/forest_slope_1k.hdr",apartment:"lebombo/lebombo_1k.hdr",studio:"studio-small-3/studio_small_03_1k.hdr",city:"potsdamer-platz/potsdamer_platz_1k.hdr",park:"rooitou/rooitou_park_1k.hdr",lobby:"st-fagans/st_fagans_interior_1k.hdr"},pie="https://market-assets.fra1.cdn.digitaloceanspaces.com/market-assets/hdris/";function KO({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}={}){if(t){if(!(t in P1))throw new Error("Preset must be one of: "+Object.keys(P1).join(", "));n=P1[t],e=pie}const s=Array.isArray(n),a=To(s?EF:lie,s?[n]:n,u=>{u.setPath(e),i&&i(u)}),l=s?a[0]:a;return l.mapping=s?xo:Wc,l.encoding=r??s?Ct:us,l}const mie=n=>n.current&&n.current.isScene,gie=n=>mie(n)?n.current:n;function bM(n,e,t,r,i=0){const s=gie(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 CM({scene:n,background:e=!1,blur:t,map:r}){const i=ao(s=>s.scene);return z.useLayoutEffect(()=>{if(r)return bM(e,n,i,r,t)},[i,n,r,e,t]),null}function YO({background:n=!1,scene:e,blur:t,...r}){const i=KO(r),s=ao(o=>o.scene);return z.useLayoutEffect(()=>bM(n,e,s,i,t),[i,n,e,s,t]),null}function vie({children:n,near:e=1,far:t=1e3,resolution:r=256,frames:i=1,map:s,background:o=!1,blur:a,scene:l,files:u,path:h,preset:d=void 0,extensions:p}){const m=ao(S=>S.gl),v=ao(S=>S.scene),x=z.useRef(null),[_]=z.useState(()=>new Rd),g=z.useMemo(()=>{const S=new CA(r);return S.texture.type=Li,S},[r]);z.useLayoutEffect(()=>(i===1&&x.current.update(m,_),bM(o,l,v,g.texture,a)),[n,_,g.texture,l,v,o,i,m]);let w=1;return Ov(()=>{(i===1/0||wsM({GroundProjectedEnvImpl:Lj}),[]);const a=z.useMemo(()=>[o],[o]),l=(e=n.ground)==null?void 0:e.height,u=(t=n.ground)==null?void 0:t.radius,h=(r=(i=n.ground)==null?void 0:i.scale)!==null&&r!==void 0?r:1e3;return z.createElement(z.Fragment,null,z.createElement(CM,Ma({},n,{map:o})),z.createElement("groundProjectedEnvImpl",{args:a,scale:h,height:l,radius:u}))}function xie(n){return n.ground?z.createElement(yie,n):n.map?z.createElement(CM,n):n.children?z.createElement(vie,n):z.createElement(YO,n)}function _ie(n){return n.isLight}function Sie(n){return!!n.geometry}const QO=z.createContext(null),wie=JO({color:new Ce,blend:2,alphaTest:.75,opacity:0,map:null},`varying vec2 vUv; void main() { gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); vUv = uv; }`,`varying vec2 vUv; uniform sampler2D map; uniform vec3 color; uniform float opacity; uniform float alphaTest; uniform float blend; void main() { vec4 sampledDiffuseColor = texture2D(map, vUv); gl_FragColor = vec4(color * sampledDiffuseColor.r * blend, max(0.0, (1.0 - (sampledDiffuseColor.r + sampledDiffuseColor.g + sampledDiffuseColor.b) / alphaTest)) * opacity); #include #include }`),Aie=z.forwardRef(({children:n,temporal:e,frames:t=40,limit:r=1/0,blend:i=20,scale:s=10,opacity:o=1,alphaTest:a=.75,color:l="black",colorBlend:u=2,resolution:h=1024,toneMapped:d=!0,...p},m)=>{sM({SoftShadowMaterial:wie});const v=ao(P=>P.gl),x=ao(P=>P.scene),_=ao(P=>P.camera),g=ao(P=>P.invalidate),w=z.useRef(null),S=z.useRef(null),[M]=z.useState(()=>new Mie(v,x,h));z.useLayoutEffect(()=>{M.configure(w.current)},[]);const C=z.useMemo(()=>({lights:new Map,temporal:!!e,frames:Math.max(2,t),blend:Math.max(2,t===1/0?i:t),count:0,getMesh:()=>w.current,reset:()=>{M.clear();const P=w.current.material;P.opacity=0,P.alphaTest=0,C.count=0},update:(P=1)=>{const L=w.current.material;C.temporal?(L.opacity=Math.min(o,L.opacity+o/C.blend),L.alphaTest=Math.min(a,L.alphaTest+a/C.blend)):(L.opacity=o,L.alphaTest=a),S.current.visible=!0,M.prepare();for(let B=0;BE.update()),M.update(_,C.blend);S.current.visible=!1,M.finish()}}),[M,_,x,e,t,i,o,a]);return z.useLayoutEffect(()=>{C.reset(),!C.temporal&&C.frames!==1/0&&C.update(C.blend)}),z.useImperativeHandle(m,()=>C,[C]),Ov(()=>{(C.temporal||C.frames===1/0)&&C.countnull,ref:S},z.createElement(QO.Provider,{value:C},n)),z.createElement("mesh",{receiveShadow:!0,ref:w,scale:s,rotation:[-Math.PI/2,0,0]},z.createElement("planeGeometry",null),z.createElement("softShadowMaterial",{transparent:!0,depthWrite:!1,toneMapped:d,color:l,blend:u,map:M.progressiveLightMap2.texture})))}),E3=z.forwardRef(({castShadow:n=!0,bias:e=.001,mapSize:t=512,size:r=5,near:i=.5,far:s=500,frames:o=1,position:a=[0,0,0],radius:l=1,amount:u=8,intensity:h=1,ambient:d=.5,...p},m)=>{const v=z.useRef(null),x=new F(...a).length(),_=z.useContext(QO),g=z.useCallback(()=>{let S;if(v.current)for(let M=0;Md)S.position.set(a[0]+Lc.randFloatSpread(l),a[1]+Lc.randFloatSpread(l),a[2]+Lc.randFloatSpread(l));else{let C=Math.acos(2*Math.random()-1)-Math.PI/2,P=2*Math.PI*Math.random();S.position.set(Math.cos(C)*Math.cos(P)*x,Math.abs(Math.cos(C)*Math.sin(P)*x),Math.sin(C)*x)}},[l,d,x,...a]),w=z.useMemo(()=>({update:g}),[g]);return z.useImperativeHandle(m,()=>w,[w]),z.useLayoutEffect(()=>{const S=v.current;return _&&_.lights.set(S.uuid,w),()=>void _.lights.delete(S.uuid)},[_,w]),z.createElement("group",Ma({ref:v},p),Array.from({length:u},(S,M)=>z.createElement("directionalLight",{key:M,castShadow:n,"shadow-bias":e,"shadow-mapSize":[t,t],intensity:h/u},z.createElement("orthographicCamera",{attach:"shadow-camera",args:[-r,r,r,-r,i,s]}))))});class Mie{constructor(e,t,r=1024){this.renderer=e,this.res=r,this.scene=t,this.buffer1Active=!1,this.lights=[],this.meshes=[],this.object=null,this.clearColor=new Ce,this.clearAlpha=0;const i=/(Android|iPad|iPhone|iPod)/g.test(navigator.userAgent)?Li:ei;this.progressiveLightMap1=new li(this.res,this.res,{type:i,encoding:e.outputEncoding}),this.progressiveLightMap2=new li(this.res,this.res,{type:i,encoding:e.outputEncoding}),this.discardMat=new hie,this.targetMat=new HA({fog:!1}),this.previousShadowMap={value:this.progressiveLightMap1.texture},this.averagingWindow={value:100},this.targetMat.onBeforeCompile=s=>{s.vertexShader=`varying vec2 vUv; `+s.vertexShader.slice(0,-1)+"vUv = uv; gl_Position = vec4((uv - 0.5) * 2.0, 1.0, 1.0); }";const o=s.fragmentShader.indexOf("void main() {");s.fragmentShader=`varying vec2 vUv; `+s.fragmentShader.slice(0,o)+`uniform sampler2D previousShadowMap; uniform float averagingWindow; `+s.fragmentShader.slice(o-1,-1)+` vec3 texelOld = texture2D(previousShadowMap, vUv).rgb; gl_FragColor.rgb = mix(texelOld, gl_FragColor.rgb, 1.0/ averagingWindow); }`,s.uniforms.previousShadowMap=this.previousShadowMap,s.uniforms.averagingWindow=this.averagingWindow}}clear(){this.renderer.getClearColor(this.clearColor),this.clearAlpha=this.renderer.getClearAlpha(),this.renderer.setClearColor("black",1),this.renderer.setRenderTarget(this.progressiveLightMap1),this.renderer.clear(),this.renderer.setRenderTarget(this.progressiveLightMap2),this.renderer.clear(),this.renderer.setRenderTarget(null),this.renderer.setClearColor(this.clearColor,this.clearAlpha),this.lights=[],this.meshes=[],this.scene.traverse(e=>{Sie(e)?this.meshes.push({object:e,material:e.material}):_ie(e)&&this.lights.push({object:e,intensity:e.intensity})})}prepare(){this.lights.forEach(e=>e.object.intensity=0),this.meshes.forEach(e=>e.object.material=this.discardMat)}finish(){this.lights.forEach(e=>e.object.intensity=e.intensity),this.meshes.forEach(e=>e.object.material=e.material)}configure(e){this.object=e}update(e,t=100){if(!this.object)return;this.averagingWindow.value=t,this.object.material=this.targetMat;const r=this.buffer1Active?this.progressiveLightMap1:this.progressiveLightMap2,i=this.buffer1Active?this.progressiveLightMap2:this.progressiveLightMap1,s=this.scene.background;this.scene.background=null,this.renderer.setRenderTarget(r),this.previousShadowMap.value=i.texture,this.buffer1Active=!this.buffer1Active,this.renderer.render(this.scene,e),this.renderer.setRenderTarget(null),this.scene.background=s}}var Ee={},bie={get exports(){return Ee},set exports(n){Ee=n}},Cie="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Eie=Cie,Tie=Eie;function qO(){}function ZO(){}ZO.resetWarningCache=qO;var Pie=function(){function n(r,i,s,o,a,l){if(l!==Tie){var u=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 u.name="Invariant Violation",u}}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:ZO,resetWarningCache:qO};return t.PropTypes=t,t};bie.exports=Pie();const Rie=Symbol(),EM=Symbol(),wh="a",Zh="w";let Bie=(n,e)=>new Proxy(n,e);const $S=Object.getPrototypeOf,JS=new WeakMap,ek=n=>n&&(JS.has(n)?JS.get(n):$S(n)===Object.prototype||$S(n)===Array.prototype),G0=n=>typeof n=="object"&&n!==null,Lie=n=>{if(Array.isArray(n))return Array.from(n);const e=Object.getOwnPropertyDescriptors(n);return Object.values(e).forEach(t=>{t.configurable=!0}),Object.create($S(n),e)},TM=n=>n[EM]||n,tk=(n,e,t,r)=>{if(!ek(n))return n;let i=r&&r.get(n);if(!i){const l=TM(n);i=(u=>Object.values(Object.getOwnPropertyDescriptors(u)).some(h=>!h.configurable&&!h.writable))(l)?[l,Lie(l)]:[l],r==null||r.set(n,i)}const[s,o]=i;let a=t&&t.get(s);return a&&a[1].f===!!o||(a=((l,u)=>{const h={f:u};let d=!1;const p=(v,x)=>{if(!d){let _=h[wh].get(l);if(_||(_={},h[wh].set(l,_)),v===Zh)_[Zh]=!0;else{let g=_[v];g||(g=new Set,_[v]=g),g.add(x)}}},m={get:(v,x)=>x===EM?l:(p("k",x),tk(Reflect.get(v,x),h[wh],h.c)),has:(v,x)=>x===Rie?(d=!0,h[wh].delete(l),!0):(p("h",x),Reflect.has(v,x)),getOwnPropertyDescriptor:(v,x)=>(p("o",x),Reflect.getOwnPropertyDescriptor(v,x)),ownKeys:v=>(p(Zh),Reflect.ownKeys(v))};return u&&(m.set=m.deleteProperty=()=>!1),[m,h]})(s,!!o),a[1].p=Bie(o||s,a[0]),t&&t.set(s,a)),a[1][wh]=e,a[1].c=t,a[1].p},nk=(n,e,t,r)=>{if(Object.is(n,e))return!1;if(!G0(n)||!G0(e))return!0;const i=t.get(TM(n));if(!i)return!0;if(r){const o=r.get(n);if(o&&o.n===e)return o.g;r.set(n,{n:e,g:!1})}let s=null;try{for(const o of i.h||[])if(s=Reflect.has(n,o)!==Reflect.has(e,o),s)return s;if(i[Zh]===!0){if(s=((o,a)=>{const l=Reflect.ownKeys(o),u=Reflect.ownKeys(a);return l.length!==u.length||l.some((h,d)=>h!==u[d])})(n,e),s)return s}else for(const o of i.o||[])if(s=!!Reflect.getOwnPropertyDescriptor(n,o)!=!!Reflect.getOwnPropertyDescriptor(e,o),s)return s;for(const o of i.k||[])if(s=nk(n[o],e[o],t,r),s)return s;return s===null&&(s=!0),s}finally{r&&r.set(n,{n:e,g:s})}},Iie=n=>ek(n)&&n[EM]||null,T3=(n,e=!0)=>{JS.set(n,e)},Die=(n,e,t)=>{const r=[],i=new WeakSet,s=(o,a)=>{if(i.has(o))return;G0(o)&&i.add(o);const l=G0(o)&&e.get(TM(o));if(l){var u,h;if((u=l.h)==null||u.forEach(p=>{const m=`:has(${String(p)})`;r.push(a?[...a,m]:[m])}),l[Zh]===!0){const p=":ownKeys";r.push(a?[...a,p]:[p])}else{var d;(d=l.o)==null||d.forEach(p=>{const m=`:hasOwn(${String(p)})`;r.push(a?[...a,m]:[m])})}(h=l.k)==null||h.forEach(p=>{t&&!("value"in(Object.getOwnPropertyDescriptor(o,p)||{}))||s(o[p],a?[...a,p]:[p])})}else a&&r.push(a)};return s(n),r},R1=n=>typeof n=="object"&&n!==null,qo=new WeakMap,Og=new WeakSet,Fie=(n=Object.is,e=(u,h)=>new Proxy(u,h),t=u=>R1(u)&&!Og.has(u)&&(Array.isArray(u)||!(Symbol.iterator in u))&&!(u instanceof WeakMap)&&!(u instanceof WeakSet)&&!(u instanceof Error)&&!(u instanceof Number)&&!(u instanceof Date)&&!(u instanceof String)&&!(u instanceof RegExp)&&!(u instanceof ArrayBuffer),r=u=>{switch(u.status){case"fulfilled":return u.value;case"rejected":throw u.reason;default:throw u}},i=new WeakMap,s=(u,h,d=r)=>{const p=i.get(u);if((p==null?void 0:p[0])===h)return p[1];const m=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u));return T3(m,!0),i.set(u,[h,m]),Reflect.ownKeys(u).forEach(v=>{if(Object.getOwnPropertyDescriptor(m,v))return;const x=Reflect.get(u,v),_={value:x,enumerable:!0,configurable:!0};if(Og.has(x))T3(x,!1);else if(x instanceof Promise)delete _.value,_.get=()=>d(x);else if(qo.has(x)){const[g,w]=qo.get(x);_.value=s(g,w(),d)}Object.defineProperty(m,v,_)}),m},o=new WeakMap,a=[1,1],l=u=>{if(!R1(u))throw new Error("object required");const h=o.get(u);if(h)return h;let d=a[0];const p=new Set,m=(E,R=++a[0])=>{d!==R&&(d=R,p.forEach(I=>I(E,R)))};let v=a[1];const x=(E=++a[1])=>(v!==E&&!p.size&&(v=E,g.forEach(([R])=>{const I=R[1](E);I>d&&(d=I)})),d),_=E=>(R,I)=>{const V=[...R];V[1]=[E,...V[1]],m(V,I)},g=new Map,w=(E,R)=>{if(({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&g.has(E))throw new Error("prop listener already exists");if(p.size){const I=R[3](_(E));g.set(E,[R,I])}else g.set(E,[R])},S=E=>{var R;const I=g.get(E);I&&(g.delete(E),(R=I[1])==null||R.call(I))},M=E=>(p.add(E),p.size===1&&g.forEach(([I,V],H)=>{if(({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&V)throw new Error("remove already exists");const W=I[3](_(H));g.set(H,[I,W])}),()=>{p.delete(E),p.size===0&&g.forEach(([I,V],H)=>{V&&(V(),g.set(H,[I]))})}),C=Array.isArray(u)?[]:Object.create(Object.getPrototypeOf(u)),L=e(C,{deleteProperty(E,R){const I=Reflect.get(E,R);S(R);const V=Reflect.deleteProperty(E,R);return V&&m(["delete",[R],I]),V},set(E,R,I,V){const H=Reflect.has(E,R),W=Reflect.get(E,R,V);if(H&&(n(W,I)||o.has(I)&&n(W,o.get(I))))return!0;S(R),R1(I)&&(I=Iie(I)||I);let J=I;if(I instanceof Promise)I.then(re=>{I.status="fulfilled",I.value=re,m(["resolve",[R],re])}).catch(re=>{I.status="rejected",I.reason=re,m(["reject",[R],re])});else{!qo.has(I)&&t(I)&&(J=l(I));const re=!Og.has(J)&&qo.get(J);re&&w(R,re)}return Reflect.set(E,R,J,V),m(["set",[R],I,W]),!0}});o.set(u,L);const B=[C,x,s,M];return qo.set(L,B),Reflect.ownKeys(u).forEach(E=>{const R=Object.getOwnPropertyDescriptor(u,E);"value"in R&&(L[E]=u[E],delete R.value,delete R.writable),Object.defineProperty(C,E,R)}),L})=>[l,qo,Og,n,e,t,r,i,s,o,a],[Oie]=Fie();function kie(n={}){return Oie(n)}function Nie(n,e,t){const r=qo.get(n);({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&!r&&console.warn("Please use proxy object");let i;const s=[],o=r[3];let a=!1;const u=o(h=>{if(s.push(h),t){e(s.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,a&&e(s.splice(0))}))});return a=!0,()=>{a=!1,u()}}function P3(n,e){const t=qo.get(n);({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&!t&&console.warn("Please use proxy object");const[r,i,s]=t;return s(r,i(),e)}var XS={},Uie={get exports(){return XS},set exports(n){XS=n}},rk={};/** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var rf=z;function Gie(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var zie=typeof Object.is=="function"?Object.is:Gie,Hie=rf.useState,Vie=rf.useEffect,Wie=rf.useLayoutEffect,jie=rf.useDebugValue;function $ie(n,e){var t=e(),r=Hie({inst:{value:t,getSnapshot:e}}),i=r[0].inst,s=r[1];return Wie(function(){i.value=t,i.getSnapshot=e,B1(i)&&s({inst:i})},[n,t,e]),Vie(function(){return B1(i)&&s({inst:i}),n(function(){B1(i)&&s({inst:i})})},[n]),jie(t),t}function B1(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!zie(n,t)}catch{return!0}}function Jie(n,e){return e()}var Xie=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Jie:$ie;rk.useSyncExternalStore=rf.useSyncExternalStore!==void 0?rf.useSyncExternalStore:Xie;(function(n){n.exports=rk})(Uie);const Kie=yw(XS),{use:R3}=k,{useSyncExternalStore:Yie}=Kie,Qie=(n,e)=>{const t=z.useRef();z.useEffect(()=>{t.current=Die(n,e,!0)}),z.useDebugValue(t.current)},qie=new WeakMap;function Xl(n,e){const t=e==null?void 0:e.sync,r=z.useRef(),i=z.useRef();let s=!0;const o=Yie(z.useCallback(u=>{const h=Nie(n,u,t);return u(),h},[n,t]),()=>{const u=P3(n,R3);try{if(!s&&r.current&&i.current&&!nk(r.current,u,i.current,new WeakMap))return r.current}catch{}return u},()=>P3(n,R3));s=!1;const a=new WeakMap;z.useEffect(()=>{r.current=o,i.current=a}),({BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&Qie(o,a);const l=z.useMemo(()=>new WeakMap,[]);return tk(o,a,l,qie)}const wr=kie({intro:!0,color:"#EFBD48",isLogoTexture:!0,isFullTexture:!1,logoDecal:"./threejs.png",fullDecal:"./threejs.png"}),Zie=()=>{const n=Xl(wr),{nodes:e,materials:t}=MM("shirt_baked.glb"),r=U0(n.logoDecal),i=U0(n.fullDecal);Ov((o,a)=>kS.dampC(t.lambert1.color,n.color,.25,a));const s=JSON.stringify(n);return it("group",{children:Zn("mesh",{castShadow:!0,geometry:e.T_Shirt_male.geometry,material:t.lambert1,"material-roughness":1,dispose:null,children:[n.isFullTexture&&it(C3,{position:[0,0,0],rotation:[0,0,0],scale:1,map:i}),n.isLogoTexture&&it(C3,{position:[0,.04,.15],rotation:[0,0,0],scale:.15,map:r,"map-anisotropy":16,depthTest:!1,depthWrite:!0})]})},s)},ese=()=>{const n=z.useRef();return Zn(Aie,{ref:n,temporal:!0,frames:60,alphaTest:.85,scae:10,rotation:[Math.PI/2,0,0],position:[0,0,-.14],children:[it(E3,{amount:4,radius:9,intensity:.55,ambient:.25,position:[5,5,-10]}),it(E3,{amount:4,radius:5,intensity:.25,ambient:.55,position:[-5,5,-9]})]})},tse=({children:n})=>{const e=z.useRef(),t=Xl(wr);return Ov((r,i)=>{const s=window.innerWidth<=1260,o=window.innerWidth<=600;let a=[-.4,0,2];t.intro?(s&&(a=[0,0,2]),o&&(a=[0,.2,2.5])):o?a=[0,0,2.5]:a=[0,0,2],kS.damp3(r.camera.position,a,.25,i),kS.dampE(e.current.rotation,[r.pointer.y/10,-r.pointer.x/5,0],.25,i)}),it("group",{ref:e,children:n})},nse=()=>Zn(fj,{shadows:!0,camera:{position:[0,0,0],fov:25},gl:{preserveDrawingBuffer:!0},className:"w-full max-w-full h-full transition-all ease-in",children:[it("ambientLight",{intensity:.5}),it(xie,{preset:"city"}),Zn(tse,{children:[it(ese,{}),it(die,{children:it(Zie,{})})]})]}),ik=z.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"}),jv=z.createContext({}),$v=z.createContext(null),Jv=typeof document<"u",z0=Jv?z.useLayoutEffect:z.useEffect,sk=z.createContext({strict:!1});function rse(n,e,t,r){const{visualElement:i}=z.useContext(jv),s=z.useContext(sk),o=z.useContext($v),a=z.useContext(ik).reducedMotion,l=z.useRef();r=r||s.renderer,!l.current&&r&&(l.current=r(n,{visualState:e,parent:i,props:t,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:a}));const u=l.current;return z.useInsertionEffect(()=>{u&&u.update(t,o)}),z0(()=>{u&&u.render()}),z.useEffect(()=>{u&&u.updateFeatures()}),(window.HandoffAppearAnimations?z0:z.useEffect)(()=>{u&&u.animationState&&u.animationState.animateChanges()}),u}function wc(n){return typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function ise(n,e,t){return z.useCallback(r=>{r&&n.mount&&n.mount(r),e&&(r?e.mount(r):e.unmount()),t&&(typeof t=="function"?t(r):wc(t)&&(t.current=r))},[e])}function Ud(n){return typeof n=="string"||Array.isArray(n)}function Xv(n){return typeof n=="object"&&typeof n.start=="function"}const PM=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],RM=["initial",...PM];function Kv(n){return Xv(n.animate)||RM.some(e=>Ud(n[e]))}function ok(n){return!!(Kv(n)||n.variants)}function sse(n,e){if(Kv(n)){const{initial:t,animate:r}=n;return{initial:t===!1||Ud(t)?t:void 0,animate:Ud(r)?r:void 0}}return n.inherit!==!1?e:{}}function ose(n){const{initial:e,animate:t}=sse(n,z.useContext(jv));return z.useMemo(()=>({initial:e,animate:t}),[B3(e),B3(t)])}function B3(n){return Array.isArray(n)?n.join(" "):n}const L3={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Gd={};for(const n in L3)Gd[n]={isEnabled:e=>L3[n].some(t=>!!e[t])};function ase(n){for(const e in n)Gd[e]={...Gd[e],...n[e]}}function BM(n){const e=z.useRef(null);return e.current===null&&(e.current=n()),e.current}const ed={hasAnimatedSinceResize:!0,hasEverUpdated:!1};let lse=1;function use(){return BM(()=>{if(ed.hasEverUpdated)return lse++})}const LM=z.createContext({}),ak=z.createContext({}),cse=Symbol.for("motionComponentSymbol");function fse({preloadedFeatures:n,createVisualElement:e,useRender:t,useVisualState:r,Component:i}){n&&ase(n);function s(a,l){let u;const h={...z.useContext(ik),...a,layoutId:hse(a)},{isStatic:d}=h,p=ose(a),m=d?void 0:use(),v=r(a,d);if(!d&&Jv){p.visualElement=rse(i,v,h,e);const x=z.useContext(ak),_=z.useContext(sk).strict;p.visualElement&&(u=p.visualElement.loadFeatures(h,_,n,m,x))}return z.createElement(jv.Provider,{value:p},u&&p.visualElement?z.createElement(u,{visualElement:p.visualElement,...h}):null,t(i,a,m,ise(v,p.visualElement,l),v,d,p.visualElement))}const o=z.forwardRef(s);return o[cse]=i,o}function hse({layoutId:n}){const e=z.useContext(LM).id;return e&&n!==void 0?e+"-"+n:n}function dse(n){function e(r,i={}){return fse(n(r,i))}if(typeof Proxy>"u")return e;const t=new Map;return new Proxy(e,{get:(r,i)=>(t.has(i)||t.set(i,e(i)),t.get(i))})}const pse=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function IM(n){return typeof n!="string"||n.includes("-")?!1:!!(pse.indexOf(n)>-1||/[A-Z]/.test(n))}const H0={};function mse(n){Object.assign(H0,n)}const yp=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Kl=new Set(yp);function lk(n,{layout:e,layoutId:t}){return Kl.has(n)||n.startsWith("origin")||(e||t!==void 0)&&(!!H0[n]||n==="opacity")}const zr=n=>!!(n&&n.getVelocity),gse={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},vse=yp.length;function yse(n,{enableHardwareAcceleration:e=!0,allowTransformNone:t=!0},r,i){let s="";for(let o=0;oe=>typeof e=="string"&&e.startsWith(n),ck=uk("--"),KS=uk("var(--"),xse=(n,e)=>e&&typeof n=="number"?e.transform(n):n,Nl=(n,e,t)=>Math.min(Math.max(t,n),e),Yl={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},td={...Yl,transform:n=>Nl(0,1,n)},kg={...Yl,default:1},nd=n=>Math.round(n*1e5)/1e5,zd=/(-)?([\d]*\.?[\d])+/g,YS=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,_se=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function xp(n){return typeof n=="string"}const _p=n=>({test:e=>xp(e)&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Xo=_p("deg"),Bs=_p("%"),rt=_p("px"),Sse=_p("vh"),wse=_p("vw"),I3={...Bs,parse:n=>Bs.parse(n)/100,transform:n=>Bs.transform(n*100)},D3={...Yl,transform:Math.round},fk={borderWidth:rt,borderTopWidth:rt,borderRightWidth:rt,borderBottomWidth:rt,borderLeftWidth:rt,borderRadius:rt,radius:rt,borderTopLeftRadius:rt,borderTopRightRadius:rt,borderBottomRightRadius:rt,borderBottomLeftRadius:rt,width:rt,maxWidth:rt,height:rt,maxHeight:rt,size:rt,top:rt,right:rt,bottom:rt,left:rt,padding:rt,paddingTop:rt,paddingRight:rt,paddingBottom:rt,paddingLeft:rt,margin:rt,marginTop:rt,marginRight:rt,marginBottom:rt,marginLeft:rt,rotate:Xo,rotateX:Xo,rotateY:Xo,rotateZ:Xo,scale:kg,scaleX:kg,scaleY:kg,scaleZ:kg,skew:Xo,skewX:Xo,skewY:Xo,distance:rt,translateX:rt,translateY:rt,translateZ:rt,x:rt,y:rt,z:rt,perspective:rt,transformPerspective:rt,opacity:td,originX:I3,originY:I3,originZ:rt,zIndex:D3,fillOpacity:td,strokeOpacity:td,numOctaves:D3};function DM(n,e,t,r){const{style:i,vars:s,transform:o,transformOrigin:a}=n;let l=!1,u=!1,h=!0;for(const d in e){const p=e[d];if(ck(d)){s[d]=p;continue}const m=fk[d],v=xse(p,m);if(Kl.has(d)){if(l=!0,o[d]=v,!h)continue;p!==(m.default||0)&&(h=!1)}else d.startsWith("origin")?(u=!0,a[d]=v):i[d]=v}if(e.transform||(l||r?i.transform=yse(n.transform,t,h,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:p="50%",originZ:m=0}=a;i.transformOrigin=`${d} ${p} ${m}`}}const FM=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function hk(n,e,t){for(const r in e)!zr(e[r])&&!lk(r,t)&&(n[r]=e[r])}function Ase({transformTemplate:n},e,t){return z.useMemo(()=>{const r=FM();return DM(r,e,{enableHardwareAcceleration:!t},n),Object.assign({},r.vars,r.style)},[e])}function Mse(n,e,t){const r=n.style||{},i={};return hk(i,r,n),Object.assign(i,Ase(n,e,t)),n.transformValues?n.transformValues(i):i}function bse(n,e,t){const r={},i=Mse(n,e,t);return n.drag&&n.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(r.tabIndex=0),r.style=i,r}const Cse=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function V0(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||Cse.has(n)}let dk=n=>!V0(n);function Ese(n){n&&(dk=e=>e.startsWith("on")?!V0(e):n(e))}try{Ese(require("@emotion/is-prop-valid").default)}catch{}function Tse(n,e,t){const r={};for(const i in n)i==="values"&&typeof n.values=="object"||(dk(i)||t===!0&&V0(i)||!e&&!V0(i)||n.draggable&&i.startsWith("onDrag"))&&(r[i]=n[i]);return r}function F3(n,e,t){return typeof n=="string"?n:rt.transform(e+t*n)}function Pse(n,e,t){const r=F3(e,n.x,n.width),i=F3(t,n.y,n.height);return`${r} ${i}`}const Rse={offset:"stroke-dashoffset",array:"stroke-dasharray"},Bse={offset:"strokeDashoffset",array:"strokeDasharray"};function Lse(n,e,t=1,r=0,i=!0){n.pathLength=1;const s=i?Rse:Bse;n[s.offset]=rt.transform(-r);const o=rt.transform(e),a=rt.transform(t);n[s.array]=`${o} ${a}`}function OM(n,{attrX:e,attrY:t,attrScale:r,originX:i,originY:s,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...u},h,d,p){if(DM(n,u,h,p),d){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:m,style:v,dimensions:x}=n;m.transform&&(x&&(v.transform=m.transform),delete m.transform),x&&(i!==void 0||s!==void 0||v.transform)&&(v.transformOrigin=Pse(x,i!==void 0?i:.5,s!==void 0?s:.5)),e!==void 0&&(m.x=e),t!==void 0&&(m.y=t),r!==void 0&&(m.scale=r),o!==void 0&&Lse(m,o,a,l,!1)}const pk=()=>({...FM(),attrs:{}}),kM=n=>typeof n=="string"&&n.toLowerCase()==="svg";function Ise(n,e,t,r){const i=z.useMemo(()=>{const s=pk();return OM(s,e,{enableHardwareAcceleration:!1},kM(r),n.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(n.style){const s={};hk(s,n.style,n),i.style={...s,...i.style}}return i}function Dse(n=!1){return(t,r,i,s,{latestValues:o},a)=>{const u=(IM(t)?Ise:bse)(r,o,a,t),d={...Tse(r,typeof t=="string",n),...u,ref:s},{children:p}=r,m=z.useMemo(()=>zr(p)?p.get():p,[p]);return i&&(d["data-projection-id"]=i),z.createElement(t,{...d,children:m})}}const NM=n=>n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function mk(n,{style:e,vars:t},r,i){Object.assign(n.style,e,i&&i.getProjectionStyles(r));for(const s in t)n.style.setProperty(s,t[s])}const gk=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function vk(n,e,t,r){mk(n,e,void 0,r);for(const i in e.attrs)n.setAttribute(gk.has(i)?i:NM(i),e.attrs[i])}function UM(n,e){const{style:t}=n,r={};for(const i in t)(zr(t[i])||e.style&&zr(e.style[i])||lk(i,n))&&(r[i]=t[i]);return r}function yk(n,e){const t=UM(n,e);for(const r in n)if(zr(n[r])||zr(e[r])){const i=yp.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;t[i]=n[r]}return t}function GM(n,e,t,r={},i={}){return typeof e=="function"&&(e=e(t!==void 0?t:n.custom,r,i)),typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"&&(e=e(t!==void 0?t:n.custom,r,i)),e}const W0=n=>Array.isArray(n),Fse=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),Ose=n=>W0(n)?n[n.length-1]||0:n;function c0(n){const e=zr(n)?n.get():n;return Fse(e)?e.toValue():e}function kse({scrapeMotionValuesFromProps:n,createRenderState:e,onMount:t},r,i,s){const o={latestValues:Nse(r,i,s,n),renderState:e()};return t&&(o.mount=a=>t(r,a,o)),o}const xk=n=>(e,t)=>{const r=z.useContext(jv),i=z.useContext($v),s=()=>kse(n,e,r,i);return t?s():BM(s)};function Nse(n,e,t,r){const i={},s=r(n,{});for(const p in s)i[p]=c0(s[p]);let{initial:o,animate:a}=n;const l=Kv(n),u=ok(n);e&&u&&!l&&n.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let h=t?t.initial===!1:!1;h=h||o===!1;const d=h?a:o;return d&&typeof d!="boolean"&&!Xv(d)&&(Array.isArray(d)?d:[d]).forEach(m=>{const v=GM(n,m);if(!v)return;const{transitionEnd:x,transition:_,...g}=v;for(const w in g){let S=g[w];if(Array.isArray(S)){const M=h?S.length-1:0;S=S[M]}S!==null&&(i[w]=S)}for(const w in x)i[w]=x[w]}),i}const Use={useVisualState:xk({scrapeMotionValuesFromProps:yk,createRenderState:pk,onMount:(n,e,{renderState:t,latestValues:r})=>{try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}OM(t,r,{enableHardwareAcceleration:!1},kM(e.tagName),n.transformTemplate),vk(e,t)}})},Gse={useVisualState:xk({scrapeMotionValuesFromProps:UM,createRenderState:FM})};function zse(n,{forwardMotionProps:e=!1},t,r){return{...IM(n)?Use:Gse,preloadedFeatures:t,useRender:Dse(e),createVisualElement:r,Component:n}}function lo(n,e,t,r={passive:!0}){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t)}const _k=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1;function Yv(n,e="page"){return{point:{x:n[e+"X"],y:n[e+"Y"]}}}const Hse=n=>e=>_k(e)&&n(e,Yv(e));function fo(n,e,t,r){return lo(n,e,Hse(t),r)}const Vse=(n,e)=>t=>e(n(t)),ga=(...n)=>n.reduce(Vse);function Sk(n){let e=null;return()=>{const t=()=>{e=null};return e===null?(e=n,t):!1}}const O3=Sk("dragHorizontal"),k3=Sk("dragVertical");function wk(n){let e=!1;if(n==="y")e=k3();else if(n==="x")e=O3();else{const t=O3(),r=k3();t&&r?e=()=>{t(),r()}:(t&&t(),r&&r())}return e}function Ak(){const n=wk(!0);return n?(n(),!1):!0}class Da{constructor(e){this.isMounted=!1,this.node=e}update(){}}function Wse(n){let e=[],t=[],r=0,i=!1,s=!1;const o=new WeakSet,a={schedule:(l,u=!1,h=!1)=>{const d=h&&i,p=d?e:t;return u&&o.add(l),p.indexOf(l)===-1&&(p.push(l),d&&i&&(r=e.length)),l},cancel:l=>{const u=t.indexOf(l);u!==-1&&t.splice(u,1),o.delete(l)},process:l=>{if(i){s=!0;return}if(i=!0,[e,t]=[t,e],t.length=0,r=e.length,r)for(let u=0;u(n[e]=Wse(()=>Hd=!0),n),{}),$se=n=>Oc[n].process(jn),Mk=n=>{Hd=!1,jn.delta=QS?1e3/60:Math.max(Math.min(n-jn.timestamp,jse),1),jn.timestamp=n,jn.isProcessing=!0,Qv.forEach($se),jn.isProcessing=!1,Hd&&(QS=!1,requestAnimationFrame(Mk))},Jse=()=>{Hd=!0,QS=!0,jn.isProcessing||requestAnimationFrame(Mk)},on=Qv.reduce((n,e)=>{const t=Oc[e];return n[e]=(r,i=!1,s=!1)=>(Hd||Jse(),t.schedule(r,i,s)),n},{});function wo(n){Qv.forEach(e=>Oc[e].cancel(n))}function N3(n,e){const t="pointer"+(e?"enter":"leave"),r="onHover"+(e?"Start":"End"),i=(s,o)=>{if(s.type==="touch"||Ak())return;const a=n.getProps();n.animationState&&a.whileHover&&n.animationState.setActive("whileHover",e),a[r]&&on.update(()=>a[r](s,o))};return fo(n.current,t,i,{passive:!n.getProps()[r]})}class Xse extends Da{mount(){this.unmount=ga(N3(this.node,!0),N3(this.node,!1))}unmount(){}}class Kse extends Da{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ga(lo(this.node.current,"focus",()=>this.onFocus()),lo(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const bk=(n,e)=>e?n===e?!0:bk(n,e.parentElement):!1,$n=n=>n;function L1(n,e){if(!e)return;const t=new PointerEvent("pointer"+n);e(t,Yv(t))}class Yse extends Da{constructor(){super(...arguments),this.removeStartListeners=$n,this.removeEndListeners=$n,this.removeAccessibleListeners=$n,this.startPointerPress=(e,t)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),s=fo(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:h}=this.node.getProps();on.update(()=>{bk(this.node.current,a.target)?u&&u(a,l):h&&h(a,l)})},{passive:!(r.onTap||r.onPointerUp)}),o=fo(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=ga(s,o),this.startPress(e,t)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||L1("up",(l,u)=>{const{onTap:h}=this.node.getProps();h&&on.update(()=>h(l,u))})};this.removeEndListeners(),this.removeEndListeners=lo(this.node.current,"keyup",o),L1("down",(a,l)=>{this.startPress(a,l)})},t=lo(this.node.current,"keydown",e),r=()=>{this.isPressing&&L1("cancel",(s,o)=>this.cancelPress(s,o))},i=lo(this.node.current,"blur",r);this.removeAccessibleListeners=ga(t,i)}}startPress(e,t){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&on.update(()=>r(e,t))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!Ak()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&on.update(()=>r(e,t))}mount(){const e=this.node.getProps(),t=fo(this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=lo(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=ga(t,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const qS=new WeakMap,I1=new WeakMap,Qse=n=>{const e=qS.get(n.target);e&&e(n)},qse=n=>{n.forEach(Qse)};function Zse({root:n,...e}){const t=n||document;I1.has(t)||I1.set(t,{});const r=I1.get(t),i=JSON.stringify(e);return r[i]||(r[i]=new IntersectionObserver(qse,{root:n,...e})),r[i]}function eoe(n,e,t){const r=Zse(e);return qS.set(n,t),r.observe(n),()=>{qS.delete(n),r.unobserve(n)}}const toe={some:0,all:1};class noe extends Da{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:i="some",once:s}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:toe[i]},a=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,s&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:h,onViewportLeave:d}=this.node.getProps(),p=u?h:d;p&&p(l)};return eoe(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(roe(e,t))&&this.startObserver()}unmount(){}}function roe({viewport:n={}},{viewport:e={}}={}){return t=>n[t]!==e[t]}const ioe={inView:{Feature:noe},tap:{Feature:Yse},focus:{Feature:Kse},hover:{Feature:Xse}};function Ck(n,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==n.length)return!1;for(let r=0;re[r]=t.get()),e}function ooe(n){const e={};return n.values.forEach((t,r)=>e[r]=t.getVelocity()),e}function qv(n,e,t){const r=n.getProps();return GM(r,e,t!==void 0?t:r.custom,soe(n),ooe(n))}const aoe="framerAppearId",loe="data-"+NM(aoe);let uoe=$n,zM=$n;const va=n=>n*1e3,ho=n=>n/1e3,coe={current:!1},Ek=n=>Array.isArray(n)&&typeof n[0]=="number";function Tk(n){return!!(!n||typeof n=="string"&&Pk[n]||Ek(n)||Array.isArray(n)&&n.every(Tk))}const Fh=([n,e,t,r])=>`cubic-bezier(${n}, ${e}, ${t}, ${r})`,Pk={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Fh([0,.65,.55,1]),circOut:Fh([.55,0,1,.45]),backIn:Fh([.31,.01,.66,-.59]),backOut:Fh([.33,1.53,.69,.99])};function Rk(n){if(n)return Ek(n)?Fh(n):Array.isArray(n)?n.map(Rk):Pk[n]}function foe(n,e,t,{delay:r=0,duration:i,repeat:s=0,repeatType:o="loop",ease:a,times:l}={}){const u={[e]:t};l&&(u.offset=l);const h=Rk(a);return Array.isArray(h)&&(u.easing=h),n.animate(u,{delay:r,duration:i,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}const U3={waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate")},D1={},Bk={};for(const n in U3)Bk[n]=()=>(D1[n]===void 0&&(D1[n]=U3[n]()),D1[n]);function hoe(n,{repeat:e,repeatType:t="loop"}){const r=e&&t!=="loop"&&e%2===1?0:n.length-1;return n[r]}const Lk=(n,e,t)=>(((1-3*t+3*e)*n+(3*t-6*e))*n+3*e)*n,doe=1e-7,poe=12;function moe(n,e,t,r,i){let s,o,a=0;do o=e+(t-e)/2,s=Lk(o,r,i)-n,s>0?t=o:e=o;while(Math.abs(s)>doe&&++amoe(s,0,1,n,t);return s=>s===0||s===1?s:Lk(i(s),e,r)}const goe=Sp(.42,0,1,1),voe=Sp(0,0,.58,1),Ik=Sp(.42,0,.58,1),yoe=n=>Array.isArray(n)&&typeof n[0]!="number",Dk=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,Fk=n=>e=>1-n(1-e),Ok=n=>1-Math.sin(Math.acos(n)),HM=Fk(Ok),xoe=Dk(HM),kk=Sp(.33,1.53,.69,.99),VM=Fk(kk),_oe=Dk(VM),Soe=n=>(n*=2)<1?.5*VM(n):.5*(2-Math.pow(2,-10*(n-1))),woe={linear:$n,easeIn:goe,easeInOut:Ik,easeOut:voe,circIn:Ok,circInOut:xoe,circOut:HM,backIn:VM,backInOut:_oe,backOut:kk,anticipate:Soe},G3=n=>{if(Array.isArray(n)){zM(n.length===4);const[e,t,r,i]=n;return Sp(e,t,r,i)}else if(typeof n=="string")return woe[n];return n},WM=(n,e)=>t=>!!(xp(t)&&_se.test(t)&&t.startsWith(n)||e&&Object.prototype.hasOwnProperty.call(t,e)),Nk=(n,e,t)=>r=>{if(!xp(r))return r;const[i,s,o,a]=r.match(zd);return{[n]:parseFloat(i),[e]:parseFloat(s),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Aoe=n=>Nl(0,255,n),F1={...Yl,transform:n=>Math.round(Aoe(n))},_l={test:WM("rgb","red"),parse:Nk("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:r=1})=>"rgba("+F1.transform(n)+", "+F1.transform(e)+", "+F1.transform(t)+", "+nd(td.transform(r))+")"};function Moe(n){let e="",t="",r="",i="";return n.length>5?(e=n.substring(1,3),t=n.substring(3,5),r=n.substring(5,7),i=n.substring(7,9)):(e=n.substring(1,2),t=n.substring(2,3),r=n.substring(3,4),i=n.substring(4,5),e+=e,t+=t,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const ZS={test:WM("#"),parse:Moe,transform:_l.transform},Ac={test:WM("hsl","hue"),parse:Nk("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:r=1})=>"hsla("+Math.round(n)+", "+Bs.transform(nd(e))+", "+Bs.transform(nd(t))+", "+nd(td.transform(r))+")"},_r={test:n=>_l.test(n)||ZS.test(n)||Ac.test(n),parse:n=>_l.test(n)?_l.parse(n):Ac.test(n)?Ac.parse(n):ZS.parse(n),transform:n=>xp(n)?n:n.hasOwnProperty("red")?_l.transform(n):Ac.transform(n)},hn=(n,e,t)=>-t*n+t*e+n;function O1(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function boe({hue:n,saturation:e,lightness:t,alpha:r}){n/=360,e/=100,t/=100;let i=0,s=0,o=0;if(!e)i=s=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;i=O1(l,a,n+1/3),s=O1(l,a,n),o=O1(l,a,n-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:r}}const k1=(n,e,t)=>{const r=n*n;return Math.sqrt(Math.max(0,t*(e*e-r)+r))},Coe=[ZS,_l,Ac],Eoe=n=>Coe.find(e=>e.test(n));function z3(n){const e=Eoe(n);let t=e.parse(n);return e===Ac&&(t=boe(t)),t}const Uk=(n,e)=>{const t=z3(n),r=z3(e),i={...t};return s=>(i.red=k1(t.red,r.red,s),i.green=k1(t.green,r.green,s),i.blue=k1(t.blue,r.blue,s),i.alpha=hn(t.alpha,r.alpha,s),_l.transform(i))},Gk="${c}",zk="${n}";function Toe(n){var e,t;return isNaN(n)&&xp(n)&&(((e=n.match(zd))===null||e===void 0?void 0:e.length)||0)+(((t=n.match(YS))===null||t===void 0?void 0:t.length)||0)>0}function j0(n){typeof n=="number"&&(n=`${n}`);const e=[];let t=0,r=0;const i=n.match(YS);i&&(t=i.length,n=n.replace(YS,Gk),e.push(...i.map(_r.parse)));const s=n.match(zd);return s&&(r=s.length,n=n.replace(zd,zk),e.push(...s.map(Yl.parse))),{values:e,numColors:t,numNumbers:r,tokenised:n}}function Hk(n){return j0(n).values}function Vk(n){const{values:e,numColors:t,tokenised:r}=j0(n),i=e.length;return s=>{let o=r;for(let a=0;atypeof n=="number"?0:n;function Roe(n){const e=Hk(n);return Vk(n)(e.map(Poe))}const ba={test:Toe,parse:Hk,createTransformer:Vk,getAnimatableNone:Roe};function Wk(n,e){return typeof n=="number"?t=>hn(n,e,t):_r.test(n)?Uk(n,e):$k(n,e)}const jk=(n,e)=>{const t=[...n],r=t.length,i=n.map((s,o)=>Wk(s,e[o]));return s=>{for(let o=0;o{const t={...n,...e},r={};for(const i in t)n[i]!==void 0&&e[i]!==void 0&&(r[i]=Wk(n[i],e[i]));return i=>{for(const s in r)t[s]=r[s](i);return t}},$k=(n,e)=>{const t=ba.createTransformer(e),r=j0(n),i=j0(e);return r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?ga(jk(r.values,i.values),t):o=>`${o>0?e:n}`},Vd=(n,e,t)=>{const r=e-n;return r===0?1:(t-n)/r},H3=(n,e)=>t=>hn(n,e,t);function Loe(n){return typeof n=="number"?H3:typeof n=="string"?_r.test(n)?Uk:$k:Array.isArray(n)?jk:typeof n=="object"?Boe:H3}function Ioe(n,e,t){const r=[],i=t||Loe(n[0]),s=n.length-1;for(let o=0;oe[0];n[0]>n[s-1]&&(n=[...n].reverse(),e=[...e].reverse());const o=Ioe(e,r,i),a=o.length,l=u=>{let h=0;if(a>1)for(;hl(Nl(n[0],n[s-1],u)):l}function Doe(n,e){const t=n[n.length-1];for(let r=1;r<=e;r++){const i=Vd(0,e,r);n.push(hn(t,1,i))}}function Foe(n){const e=[0];return Doe(e,n.length-1),e}function Ooe(n,e){return n.map(t=>t*e)}function koe(n,e){return n.map(()=>e||Ik).splice(0,n.length-1)}function $0({duration:n=300,keyframes:e,times:t,ease:r="easeInOut"}){const i=yoe(r)?r.map(G3):G3(r),s={done:!1,value:e[0]},o=Ooe(t&&t.length===e.length?t:Foe(e),n),a=Jk(o,e,{ease:Array.isArray(i)?i:koe(e,i)});return{calculatedDuration:n,next:l=>(s.value=a(l),s.done=l>=n,s)}}function Xk(n,e){return e?n*(1e3/e):0}const Noe=5;function Kk(n,e,t){const r=Math.max(e-Noe,0);return Xk(t-n(r),e-r)}const N1=.001,Uoe=.01,V3=10,Goe=.05,zoe=1;function Hoe({duration:n=800,bounce:e=.25,velocity:t=0,mass:r=1}){let i,s;uoe(n<=va(V3));let o=1-e;o=Nl(Goe,zoe,o),n=Nl(Uoe,V3,ho(n)),o<1?(i=u=>{const h=u*o,d=h*n,p=h-t,m=ew(u,o),v=Math.exp(-d);return N1-p/m*v},s=u=>{const d=u*o*n,p=d*t+t,m=Math.pow(o,2)*Math.pow(u,2)*n,v=Math.exp(-d),x=ew(Math.pow(u,2),o);return(-i(u)+N1>0?-1:1)*((p-m)*v)/x}):(i=u=>{const h=Math.exp(-u*n),d=(u-t)*n+1;return-N1+h*d},s=u=>{const h=Math.exp(-u*n),d=(t-u)*(n*n);return h*d});const a=5/n,l=Woe(i,s,a);if(n=va(n),isNaN(l))return{stiffness:100,damping:10,duration:n};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:o*2*Math.sqrt(r*u),duration:n}}}const Voe=12;function Woe(n,e,t){let r=t;for(let i=1;in[t]!==void 0)}function Joe(n){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...n};if(!W3(n,$oe)&&W3(n,joe)){const t=Hoe(n);e={...e,...t,velocity:0,mass:1},e.isResolvedFromDuration=!0}return e}function Yk({keyframes:n,restDelta:e,restSpeed:t,...r}){const i=n[0],s=n[n.length-1],o={done:!1,value:i},{stiffness:a,damping:l,mass:u,velocity:h,duration:d,isResolvedFromDuration:p}=Joe(r),m=h?-ho(h):0,v=l/(2*Math.sqrt(a*u)),x=s-i,_=ho(Math.sqrt(a/u)),g=Math.abs(x)<5;t||(t=g?.01:2),e||(e=g?.005:.5);let w;if(v<1){const S=ew(_,v);w=M=>{const C=Math.exp(-v*_*M);return s-C*((m+v*_*x)/S*Math.sin(S*M)+x*Math.cos(S*M))}}else if(v===1)w=S=>s-Math.exp(-_*S)*(x+(m+_*x)*S);else{const S=_*Math.sqrt(v*v-1);w=M=>{const C=Math.exp(-v*_*M),P=Math.min(S*M,300);return s-C*((m+v*_*x)*Math.sinh(P)+S*x*Math.cosh(P))/S}}return{calculatedDuration:p&&d||null,next:S=>{const M=w(S);if(p)o.done=S>=d;else{let C=m;S!==0&&(v<1?C=Kk(w,S,M):C=0);const P=Math.abs(C)<=t,L=Math.abs(s-M)<=e;o.done=P&&L}return o.value=o.done?s:M,o}}}function j3({keyframes:n,velocity:e=0,power:t=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:h}){const d=n[0],p={done:!1,value:d},m=B=>a!==void 0&&Bl,v=B=>a===void 0?l:l===void 0||Math.abs(a-B)-x*Math.exp(-B/r),S=B=>g+w(B),M=B=>{const E=w(B),R=S(B);p.done=Math.abs(E)<=u,p.value=p.done?g:R};let C,P;const L=B=>{m(p.value)&&(C=B,P=Yk({keyframes:[p.value,v(p.value)],velocity:Kk(S,B,p.value),damping:i,stiffness:s,restDelta:u,restSpeed:h}))};return L(0),{calculatedDuration:null,next:B=>{let E=!1;return!P&&C===void 0&&(E=!0,M(B),L(B)),C!==void 0&&B>C?P.next(B-C):(!E&&M(B),p)}}}const Xoe=n=>{const e=({timestamp:t})=>n(t);return{start:()=>on.update(e,!0),stop:()=>wo(e),now:()=>jn.isProcessing?jn.timestamp:performance.now()}},$3=2e4;function J3(n){let e=0;const t=50;let r=n.next(e);for(;!r.done&&e<$3;)e+=t,r=n.next(e);return e>=$3?1/0:e}const Koe={decay:j3,inertia:j3,tween:$0,keyframes:$0,spring:Yk};function J0({autoplay:n=!0,delay:e=0,driver:t=Xoe,keyframes:r,type:i="keyframes",repeat:s=0,repeatDelay:o=0,repeatType:a="loop",onPlay:l,onStop:u,onComplete:h,onUpdate:d,...p}){let m=1,v=!1,x,_;const g=()=>{x&&x(),_=new Promise(se=>{x=se})};g();let w;const S=Koe[i]||$0;let M;S!==$0&&typeof r[0]!="number"&&(M=Jk([0,100],r,{clamp:!1}),r=[0,100]);const C=S({...p,keyframes:r});let P;a==="mirror"&&(P=S({...p,keyframes:[...r].reverse(),velocity:-(p.velocity||0)}));let L="idle",B=null,E=null,R=null;C.calculatedDuration===null&&s&&(C.calculatedDuration=J3(C));const{calculatedDuration:I}=C;let V=1/0,H=1/0;I!==null&&(V=I+o,H=V*(s+1)-o);let W=0;const J=se=>{if(E===null)return;m>0&&(E=Math.min(E,se)),B!==null?W=B:W=(se-E)*m;const ee=W-e,ne=ee<0;W=Math.max(ee,0),L==="finished"&&B===null&&(W=H);let ie=W,Me=C;if(s){const Je=W/V;let _e=Math.floor(Je),Pe=Je%1;!Pe&&Je>=1&&(Pe=1),Pe===1&&_e--,_e=Math.min(_e,s+1);const ge=!!(_e%2);ge&&(a==="reverse"?(Pe=1-Pe,o&&(Pe-=o/V)):a==="mirror"&&(Me=P));let le=Nl(0,1,Pe);W>H&&(le=a==="reverse"&&ge?1:0),ie=le*V}const ye=ne?{done:!1,value:r[0]}:Me.next(ie);M&&(ye.value=M(ye.value));let{done:q}=ye;!ne&&I!==null&&(q=W>=H);const qe=B===null&&(L==="finished"||L==="running"&&q||m<0&&W<=0);return d&&d(ye.value),qe&&U(),ye},re=()=>{w&&w.stop(),w=void 0},ue=()=>{L="idle",re(),g(),E=R=null},U=()=>{L="finished",h&&h(),re(),g()},$=()=>{if(v)return;w||(w=t(J));const se=w.now();l&&l(),B!==null?E=se-B:(!E||L==="finished")&&(E=se),R=E,B=null,L="running",w.start()};n&&$();const j={then(se,ee){return _.then(se,ee)},get time(){return ho(W)},set time(se){se=va(se),W=se,B!==null||!w||m===0?B=se:E=w.now()-se/m},get duration(){const se=C.calculatedDuration===null?J3(C):C.calculatedDuration;return ho(se)},get speed(){return m},set speed(se){se===m||!w||(m=se,j.time=ho(W))},get state(){return L},play:$,pause:()=>{L="paused",B=W},stop:()=>{v=!0,L!=="idle"&&(L="idle",u&&u(),ue())},cancel:()=>{R!==null&&J(R),ue()},complete:()=>{L="finished"},sample:se=>(E=0,J(se))};return j}const Yoe=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),Ng=10,Qoe=2e4,qoe=(n,e)=>e.type==="spring"||n==="backgroundColor"||!Tk(e.ease);function Zoe(n,e,{onUpdate:t,onComplete:r,...i}){if(!(Bk.waapi()&&Yoe.has(e)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let o=!1,a,l;const u=()=>{l=new Promise(g=>{a=g})};u();let{keyframes:h,duration:d=300,ease:p,times:m}=i;if(qoe(e,i)){const g=J0({...i,repeat:0,delay:0});let w={done:!1,value:h[0]};const S=[];let M=0;for(;!w.done&&Mv.cancel(),_=()=>{on.update(x),a(),u()};return v.onfinish=()=>{n.set(hoe(h,i)),r&&r(),_()},{then(g,w){return l.then(g,w)},get time(){return ho(v.currentTime||0)},set time(g){v.currentTime=va(g)},get speed(){return v.playbackRate},set speed(g){v.playbackRate=g},get duration(){return ho(d)},play:()=>{o||(v.play(),wo(x))},pause:()=>v.pause(),stop:()=>{if(o=!0,v.playState==="idle")return;const{currentTime:g}=v;if(g){const w=J0({...i,autoplay:!1});n.setWithVelocity(w.sample(g-Ng).value,w.sample(g).value,Ng)}_()},complete:()=>v.finish(),cancel:_}}function eae({keyframes:n,delay:e,onUpdate:t,onComplete:r}){const i=()=>(t&&t(n[n.length-1]),r&&r(),{time:0,speed:1,duration:0,play:$n,pause:$n,stop:$n,then:s=>(s(),Promise.resolve()),cancel:$n,complete:$n});return e?J0({keyframes:[0,1],duration:0,delay:e,onComplete:i}):i()}const tae={type:"spring",stiffness:500,damping:25,restSpeed:10},nae=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),rae={type:"keyframes",duration:.8},iae={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},sae=(n,{keyframes:e})=>e.length>2?rae:Kl.has(n)?n.startsWith("scale")?nae(e[1]):tae:iae,tw=(n,e)=>n==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&ba.test(e)&&!e.startsWith("url(")),oae=new Set(["brightness","contrast","saturate","opacity"]);function aae(n){const[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[r]=t.match(zd)||[];if(!r)return n;const i=t.replace(r,"");let s=oae.has(e)?1:0;return r!==t&&(s*=100),e+"("+s+i+")"}const lae=/([a-z-]*)\(.*?\)/g,nw={...ba,getAnimatableNone:n=>{const e=n.match(lae);return e?e.map(aae).join(" "):n}},uae={...fk,color:_r,backgroundColor:_r,outlineColor:_r,fill:_r,stroke:_r,borderColor:_r,borderTopColor:_r,borderRightColor:_r,borderBottomColor:_r,borderLeftColor:_r,filter:nw,WebkitFilter:nw},jM=n=>uae[n];function $M(n,e){let t=jM(n);return t!==nw&&(t=ba),t.getAnimatableNone?t.getAnimatableNone(e):void 0}function cae({when:n,delay:e,delayChildren:t,staggerChildren:r,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:l,elapsed:u,...h}){return!!Object.keys(h).length}function X3(n){return n===0||typeof n=="string"&&parseFloat(n)===0&&n.indexOf(" ")===-1}function K3(n){return typeof n=="number"?0:$M("",n)}function Qk(n,e){return n[e]||n.default||n}function fae(n,[...e]){for(let t=0;ti=>{const s=Qk(r,n)||{},o=s.delay||r.delay||0;let{elapsed:a=0}=r;a=a-va(o);const l=hae(e,n,t,s),u=l[0],h=l[l.length-1],d=tw(n,u),p=tw(n,h);let m={keyframes:l,velocity:e.getVelocity(),ease:"easeOut",...s,delay:-a,onUpdate:v=>{e.set(v),s.onUpdate&&s.onUpdate(v)},onComplete:()=>{i(),s.onComplete&&s.onComplete()}};if(cae(s)||(m={...m,...sae(n,m)}),m.duration&&(m.duration=va(m.duration)),m.repeatDelay&&(m.repeatDelay=va(m.repeatDelay)),!d||!p||coe.current||s.type===!1)return eae(m);if(e.owner&&e.owner.current instanceof HTMLElement&&!e.owner.getProps().onUpdate){const v=Zoe(e,n,m);if(v)return v}return J0(m)};function X0(n){return!!(zr(n)&&n.add)}const dae=n=>/^\-?\d*\.?\d+$/.test(n),pae=n=>/^0[^.\s]+$/.test(n);function XM(n,e){n.indexOf(e)===-1&&n.push(e)}function KM(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}class YM{constructor(){this.subscriptions=[]}add(e){return XM(this.subscriptions,e),()=>KM(this.subscriptions,e)}notify(e,t,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,t,r);else for(let s=0;s!isNaN(parseFloat(n));class gae{constructor(e,t={}){this.version="10.12.2",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:s,timestamp:o}=jn;this.lastUpdated!==o&&(this.timeDelta=s,this.lastUpdated=o,on.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>on.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=mae(this.current),this.owner=t.owner}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new YM);const r=this.events[e].add(t);return e==="change"?()=>{r(),on.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){!t||!this.passiveEffect?this.updateAndNotify(e,t):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,t,r){this.set(t),this.prev=e,this.timeDelta=r}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?Xk(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function sf(n,e){return new gae(n,e)}const qk=n=>e=>e.test(n),vae={test:n=>n==="auto",parse:n=>n},Zk=[Yl,rt,Bs,Xo,wse,Sse,vae],Ah=n=>Zk.find(qk(n)),yae=[...Zk,_r,ba],xae=n=>yae.find(qk(n));function _ae(n,e,t){n.hasValue(e)?n.getValue(e).set(t):n.addValue(e,sf(t))}function Sae(n,e){const t=qv(n,e);let{transitionEnd:r={},transition:i={},...s}=t?n.makeTargetAnimatable(t,!1):{};s={...s,...r};for(const o in s){const a=Ose(s[o]);_ae(n,o,a)}}function wae(n,e,t){var r,i;const s=Object.keys(e).filter(a=>!n.hasValue(a)),o=s.length;if(o)for(let a=0;al.remove(d))),u.push(x)}return o&&Promise.all(u).then(()=>{o&&Sae(n,o)}),u}function rw(n,e,t={}){const r=qv(n,e,t.custom);let{transition:i=n.getDefaultTransition()||{}}=r||{};t.transitionOverride&&(i=t.transitionOverride);const s=r?()=>Promise.all(eN(n,r,t)):()=>Promise.resolve(),o=n.variantChildren&&n.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:h,staggerDirection:d}=i;return Cae(n,e,u+l,h,d,t)}:()=>Promise.resolve(),{when:a}=i;if(a){const[l,u]=a==="beforeChildren"?[s,o]:[o,s];return l().then(()=>u())}else return Promise.all([s(),o(t.delay)])}function Cae(n,e,t=0,r=0,i=1,s){const o=[],a=(n.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>a-u*r;return Array.from(n.variantChildren).sort(Eae).forEach((u,h)=>{u.notify("AnimationStart",e),o.push(rw(u,e,{...s,delay:t+l(h)}).then(()=>u.notify("AnimationComplete",e)))}),Promise.all(o)}function Eae(n,e){return n.sortNodePosition(e)}function Tae(n,e,t={}){n.notify("AnimationStart",e);let r;if(Array.isArray(e)){const i=e.map(s=>rw(n,s,t));r=Promise.all(i)}else if(typeof e=="string")r=rw(n,e,t);else{const i=typeof e=="function"?qv(n,e,t.custom):e;r=Promise.all(eN(n,i,t))}return r.then(()=>n.notify("AnimationComplete",e))}const Pae=[...PM].reverse(),Rae=PM.length;function Bae(n){return e=>Promise.all(e.map(({animation:t,options:r})=>Tae(n,t,r)))}function Lae(n){let e=Bae(n);const t=Dae();let r=!0;const i=(l,u)=>{const h=qv(n,u);if(h){const{transition:d,transitionEnd:p,...m}=h;l={...l,...m,...p}}return l};function s(l){e=l(n)}function o(l,u){const h=n.getProps(),d=n.getVariantContext(!0)||{},p=[],m=new Set;let v={},x=1/0;for(let g=0;gx&&C;const R=Array.isArray(M)?M:[M];let I=R.reduce(i,{});P===!1&&(I={});const{prevResolvedValues:V={}}=S,H={...V,...I},W=J=>{E=!0,m.delete(J),S.needsAnimating[J]=!0};for(const J in H){const re=I[J],ue=V[J];v.hasOwnProperty(J)||(re!==ue?W0(re)&&W0(ue)?!Ck(re,ue)||B?W(J):S.protectedKeys[J]=!0:re!==void 0?W(J):m.add(J):re!==void 0&&m.has(J)?W(J):S.protectedKeys[J]=!0)}S.prevProp=M,S.prevResolvedValues=I,S.isActive&&(v={...v,...I}),r&&n.blockInitialAnimation&&(E=!1),E&&!L&&p.push(...R.map(J=>({animation:J,options:{type:w,...l}})))}if(m.size){const g={};m.forEach(w=>{const S=n.getBaseTarget(w);S!==void 0&&(g[w]=S)}),p.push({animation:g})}let _=!!p.length;return r&&h.initial===!1&&!n.manuallyAnimateOnMount&&(_=!1),r=!1,_?e(p):Promise.resolve()}function a(l,u,h){var d;if(t[l].isActive===u)return Promise.resolve();(d=n.variantChildren)===null||d===void 0||d.forEach(m=>{var v;return(v=m.animationState)===null||v===void 0?void 0:v.setActive(l,u)}),t[l].isActive=u;const p=o(h,l);for(const m in t)t[m].protectedKeys={};return p}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>t}}function Iae(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!Ck(e,n):!1}function tl(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Dae(){return{animate:tl(!0),whileInView:tl(),whileHover:tl(),whileTap:tl(),whileDrag:tl(),whileFocus:tl(),exit:tl()}}class Fae extends Da{constructor(e){super(e),e.animationState||(e.animationState=Lae(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();this.unmount(),Xv(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){}}let Oae=0;class kae extends Da{constructor(){super(...arguments),this.id=Oae++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const s=this.node.animationState.setActive("exit",!e,{custom:r??this.node.getProps().custom});t&&!e&&s.then(()=>t(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const Nae={animation:{Feature:Fae},exit:{Feature:kae}},Y3=(n,e)=>Math.abs(n-e);function Uae(n,e){const t=Y3(n.x,e.x),r=Y3(n.y,e.y);return Math.sqrt(t**2+r**2)}class tN{constructor(e,t,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=G1(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,d=Uae(u.offset,{x:0,y:0})>=3;if(!h&&!d)return;const{point:p}=u,{timestamp:m}=jn;this.history.push({...p,timestamp:m});const{onStart:v,onMove:x}=this.handlers;h||(v&&v(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),x&&x(this.lastMoveEvent,u)},this.handlePointerMove=(u,h)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=U1(h,this.transformPagePoint),on.update(this.updatePoint,!0)},this.handlePointerUp=(u,h)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:p}=this.handlers,m=G1(u.type==="pointercancel"?this.lastMoveEventInfo:U1(h,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,m),p&&p(u,m)},!_k(e))return;this.handlers=t,this.transformPagePoint=r;const i=Yv(e),s=U1(i,this.transformPagePoint),{point:o}=s,{timestamp:a}=jn;this.history=[{...o,timestamp:a}];const{onSessionStart:l}=t;l&&l(e,G1(s,this.history)),this.removeListeners=ga(fo(window,"pointermove",this.handlePointerMove),fo(window,"pointerup",this.handlePointerUp),fo(window,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),wo(this.updatePoint)}}function U1(n,e){return e?{point:e(n.point)}:n}function Q3(n,e){return{x:n.x-e.x,y:n.y-e.y}}function G1({point:n},e){return{point:n,delta:Q3(n,nN(e)),offset:Q3(n,Gae(e)),velocity:zae(e,.1)}}function Gae(n){return n[0]}function nN(n){return n[n.length-1]}function zae(n,e){if(n.length<2)return{x:0,y:0};let t=n.length-1,r=null;const i=nN(n);for(;t>=0&&(r=n[t],!(i.timestamp-r.timestamp>va(e)));)t--;if(!r)return{x:0,y:0};const s=ho(i.timestamp-r.timestamp);if(s===0)return{x:0,y:0};const o={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function ci(n){return n.max-n.min}function iw(n,e=0,t=.01){return Math.abs(n-e)<=t}function q3(n,e,t,r=.5){n.origin=r,n.originPoint=hn(e.min,e.max,n.origin),n.scale=ci(t)/ci(e),(iw(n.scale,1,1e-4)||isNaN(n.scale))&&(n.scale=1),n.translate=hn(t.min,t.max,n.origin)-n.originPoint,(iw(n.translate)||isNaN(n.translate))&&(n.translate=0)}function rd(n,e,t,r){q3(n.x,e.x,t.x,r?r.originX:void 0),q3(n.y,e.y,t.y,r?r.originY:void 0)}function Z3(n,e,t){n.min=t.min+e.min,n.max=n.min+ci(e)}function Hae(n,e,t){Z3(n.x,e.x,t.x),Z3(n.y,e.y,t.y)}function eR(n,e,t){n.min=e.min-t.min,n.max=n.min+ci(e)}function id(n,e,t){eR(n.x,e.x,t.x),eR(n.y,e.y,t.y)}function Vae(n,{min:e,max:t},r){return e!==void 0&&nt&&(n=r?hn(t,n,r.max):Math.min(n,t)),n}function tR(n,e,t){return{min:e!==void 0?n.min+e:void 0,max:t!==void 0?n.max+t-(n.max-n.min):void 0}}function Wae(n,{top:e,left:t,bottom:r,right:i}){return{x:tR(n.x,t,i),y:tR(n.y,e,r)}}function nR(n,e){let t=e.min-n.min,r=e.max-n.max;return e.max-e.minr?t=Vd(e.min,e.max-r,n.min):r>i&&(t=Vd(n.min,n.max-i,e.min)),Nl(0,1,t)}function Jae(n,e){const t={};return e.min!==void 0&&(t.min=e.min-n.min),e.max!==void 0&&(t.max=e.max-n.min),t}const sw=.35;function Xae(n=sw){return n===!1?n=0:n===!0&&(n=sw),{x:rR(n,"left","right"),y:rR(n,"top","bottom")}}function rR(n,e,t){return{min:iR(n,e),max:iR(n,t)}}function iR(n,e){return typeof n=="number"?n:n[e]||0}const sR=()=>({translate:0,scale:1,origin:0,originPoint:0}),sd=()=>({x:sR(),y:sR()}),oR=()=>({min:0,max:0}),Tn=()=>({x:oR(),y:oR()});function bs(n){return[n("x"),n("y")]}function rN({top:n,left:e,right:t,bottom:r}){return{x:{min:e,max:t},y:{min:n,max:r}}}function Kae({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function Yae(n,e){if(!e)return n;const t=e({x:n.left,y:n.top}),r=e({x:n.right,y:n.bottom});return{top:t.y,left:t.x,bottom:r.y,right:r.x}}function z1(n){return n===void 0||n===1}function ow({scale:n,scaleX:e,scaleY:t}){return!z1(n)||!z1(e)||!z1(t)}function al(n){return ow(n)||iN(n)||n.z||n.rotate||n.rotateX||n.rotateY}function iN(n){return aR(n.x)||aR(n.y)}function aR(n){return n&&n!=="0%"}function K0(n,e,t){const r=n-t,i=e*r;return t+i}function lR(n,e,t,r,i){return i!==void 0&&(n=K0(n,i,r)),K0(n,t,r)+e}function aw(n,e=0,t=1,r,i){n.min=lR(n.min,e,t,r,i),n.max=lR(n.max,e,t,r,i)}function sN(n,{x:e,y:t}){aw(n.x,e.translate,e.scale,e.originPoint),aw(n.y,t.translate,t.scale,t.originPoint)}function Qae(n,e,t,r=!1){const i=t.length;if(!i)return;e.x=e.y=1;let s,o;for(let a=0;a1.0000000000001||n<.999999999999?n:1}function Zo(n,e){n.min=n.min+e,n.max=n.max+e}function cR(n,e,[t,r,i]){const s=e[i]!==void 0?e[i]:.5,o=hn(n.min,n.max,s);aw(n,e[t],e[r],o,e.scale)}const qae=["x","scaleX","originX"],Zae=["y","scaleY","originY"];function Mc(n,e){cR(n.x,e,qae),cR(n.y,e,Zae)}function oN(n,e){return rN(Yae(n.getBoundingClientRect(),e))}function ele(n,e,t){const r=oN(n,t),{scroll:i}=e;return i&&(Zo(r.x,i.offset.x),Zo(r.y,i.offset.y)),r}const tle=new WeakMap;class nle{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Tn(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),t&&this.snapToCursor(Yv(l,"page").point)},s=(l,u)=>{const{drag:h,dragPropagation:d,onDragStart:p}=this.getProps();if(h&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=wk(h),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),bs(v=>{let x=this.getAxisMotionValue(v).get()||0;if(Bs.test(x)){const{projection:_}=this.visualElement;if(_&&_.layout){const g=_.layout.layoutBox[v];g&&(x=ci(g)*(parseFloat(x)/100))}}this.originPoint[v]=x}),p&&on.update(()=>p(l,u),!1,!0);const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(l,u)=>{const{dragPropagation:h,dragDirectionLock:d,onDirectionLock:p,onDrag:m}=this.getProps();if(!h&&!this.openGlobalLock)return;const{offset:v}=u;if(d&&this.currentDirection===null){this.currentDirection=rle(v),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",u.point,v),this.updateAxis("y",u.point,v),this.visualElement.render(),m&&m(l,u)},a=(l,u)=>this.stop(l,u);this.panSession=new tN(e,{onSessionStart:i,onStart:s,onMove:o,onSessionEnd:a},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(e,t){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=t;this.startAnimation(i);const{onDragEnd:s}=this.getProps();s&&on.update(()=>s(e,t))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,r){const{drag:i}=this.getProps();if(!r||!Ug(e,i,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=Vae(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:t}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;e&&wc(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Wae(r.layoutBox,e):this.constraints=!1,this.elastic=Xae(t),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&bs(s=>{this.getAxisMotionValue(s)&&(this.constraints[s]=Jae(r.layoutBox[s],this.constraints[s]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!wc(e))return!1;const r=e.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const s=ele(r,i.root,this.visualElement.getTransformPagePoint());let o=jae(i.layout.layoutBox,s);if(t){const a=t(Kae(o));this.hasMutatedConstraints=!!a,a&&(o=rN(a))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:i,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},u=bs(h=>{if(!Ug(h,t,this.currentDirection))return;let d=l&&l[h]||{};o&&(d={min:0,max:0});const p=i?200:1e6,m=i?40:1e7,v={type:"inertia",velocity:r?e[h]:0,bounceStiffness:p,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...s,...d};return this.startAxisValueAnimation(h,v)});return Promise.all(u).then(a)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return r.start(JM(e,r,0,t))}stopAnimation(){bs(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t="_drag"+e.toUpperCase(),r=this.visualElement.getProps(),i=r[t];return i||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){bs(t=>{const{drag:r}=this.getProps();if(!Ug(t,r,this.currentDirection))return;const{projection:i}=this.visualElement,s=this.getAxisMotionValue(t);if(i&&i.layout){const{min:o,max:a}=i.layout.layoutBox[t];s.set(e[t]-hn(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!wc(t)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};bs(o=>{const a=this.getAxisMotionValue(o);if(a){const l=a.get();i[o]=$ae({min:l,max:l},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),bs(o=>{if(!Ug(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:u}=this.constraints[o];a.set(hn(l,u,i[o]))})}addListeners(){if(!this.visualElement.current)return;tle.set(this.visualElement,this);const e=this.visualElement.current,t=fo(e,"pointerdown",l=>{const{drag:u,dragListener:h=!0}=this.getProps();u&&h&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();wc(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,s=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const o=lo(window,"resize",()=>this.scalePositionWithinConstraints()),a=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(bs(h=>{const d=this.getAxisMotionValue(h);d&&(this.originPoint[h]+=l[h].translate,d.set(d.get()+l[h].translate))}),this.visualElement.render())});return()=>{o(),t(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:s=!1,dragElastic:o=sw,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:i,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function Ug(n,e,t){return(e===!0||e===n)&&(t===null||t===n)}function rle(n,e=10){let t=null;return Math.abs(n.y)>e?t="y":Math.abs(n.x)>e&&(t="x"),t}class ile extends Da{constructor(e){super(e),this.removeGroupControls=$n,this.removeListeners=$n,this.controls=new nle(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||$n}unmount(){this.removeGroupControls(),this.removeListeners()}}const fR=n=>(e,t)=>{n&&on.update(()=>n(e,t))};class sle extends Da{constructor(){super(...arguments),this.removePointerDownListener=$n}onPointerDown(e){this.session=new tN(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:fR(e),onStart:fR(t),onMove:r,onEnd:(s,o)=>{delete this.session,i&&on.update(()=>i(s,o))}}}mount(){this.removePointerDownListener=fo(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function ole(){const n=z.useContext($v);if(n===null)return[!0,null];const{isPresent:e,onExitComplete:t,register:r}=n,i=z.useId();return z.useEffect(()=>r(i),[]),!e&&t?[!1,()=>t&&t(i)]:[!0]}function hR(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const Mh={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(rt.test(n))n=parseFloat(n);else return n;const t=hR(n,e.target.x),r=hR(n,e.target.y);return`${t}% ${r}%`}},aN=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function ale(n){const e=aN.exec(n);if(!e)return[,];const[,t,r]=e;return[t,r]}function lw(n,e,t=1){const[r,i]=ale(n);if(!r)return;const s=window.getComputedStyle(e).getPropertyValue(r);return s?s.trim():KS(i)?lw(i,e,t+1):i}function lle(n,{...e},t){const r=n.current;if(!(r instanceof Element))return{target:e,transitionEnd:t};t&&(t={...t}),n.values.forEach(i=>{const s=i.get();if(!KS(s))return;const o=lw(s,r);o&&i.set(o)});for(const i in e){const s=e[i];if(!KS(s))continue;const o=lw(s,r);o&&(e[i]=o,t||(t={}),t[i]===void 0&&(t[i]=s))}return{target:e,transitionEnd:t}}const dR="_$css",ule={correct:(n,{treeScale:e,projectionDelta:t})=>{const r=n,i=n.includes("var("),s=[];i&&(n=n.replace(aN,m=>(s.push(m),dR)));const o=ba.parse(n);if(o.length>5)return r;const a=ba.createTransformer(n),l=typeof o[0]!="number"?1:0,u=t.x.scale*e.x,h=t.y.scale*e.y;o[0+l]/=u,o[1+l]/=h;const d=hn(u,h,.5);typeof o[2+l]=="number"&&(o[2+l]/=d),typeof o[3+l]=="number"&&(o[3+l]/=d);let p=a(o);if(i){let m=0;p=p.replace(dR,()=>{const v=s[m];return m++,v})}return p}};class cle extends k.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:i}=this.props,{projection:s}=e;mse(fle),s&&(t.group&&t.group.add(s),r&&r.register&&i&&r.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),ed.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:i,isPresent:s}=this.props,o=r.projection;return o&&(o.isPresent=s,i||e.layoutDependency!==t||t===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||on.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),!e.currentAnimation&&e.isLead()&&this.safeToRemove())}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:i}=e;i&&(i.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function lN(n){const[e,t]=ole(),r=z.useContext(LM);return k.createElement(cle,{...n,layoutGroup:r,switchLayoutGroup:z.useContext(ak),isPresent:e,safeToRemove:t})}const fle={borderRadius:{...Mh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Mh,borderTopRightRadius:Mh,borderBottomLeftRadius:Mh,borderBottomRightRadius:Mh,boxShadow:ule},uN=["TopLeft","TopRight","BottomLeft","BottomRight"],hle=uN.length,pR=n=>typeof n=="string"?parseFloat(n):n,mR=n=>typeof n=="number"||rt.test(n);function dle(n,e,t,r,i,s){i?(n.opacity=hn(0,t.opacity!==void 0?t.opacity:1,ple(r)),n.opacityExit=hn(e.opacity!==void 0?e.opacity:1,0,mle(r))):s&&(n.opacity=hn(e.opacity!==void 0?e.opacity:1,t.opacity!==void 0?t.opacity:1,r));for(let o=0;ore?1:t(Vd(n,e,r))}function vR(n,e){n.min=e.min,n.max=e.max}function bi(n,e){vR(n.x,e.x),vR(n.y,e.y)}function yR(n,e,t,r,i){return n-=e,n=K0(n,1/t,r),i!==void 0&&(n=K0(n,1/i,r)),n}function gle(n,e=0,t=1,r=.5,i,s=n,o=n){if(Bs.test(e)&&(e=parseFloat(e),e=hn(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=hn(s.min,s.max,r);n===s&&(a-=e),n.min=yR(n.min,e,t,a,i),n.max=yR(n.max,e,t,a,i)}function xR(n,e,[t,r,i],s,o){gle(n,e[t],e[r],e[i],e.scale,s,o)}const vle=["x","scaleX","originX"],yle=["y","scaleY","originY"];function _R(n,e,t,r){xR(n.x,e,vle,t?t.x:void 0,r?r.x:void 0),xR(n.y,e,yle,t?t.y:void 0,r?r.y:void 0)}function SR(n){return n.translate===0&&n.scale===1}function fN(n){return SR(n.x)&&SR(n.y)}function uw(n,e){return n.x.min===e.x.min&&n.x.max===e.x.max&&n.y.min===e.y.min&&n.y.max===e.y.max}function wR(n){return ci(n.x)/ci(n.y)}class xle{constructor(){this.members=[]}add(e){XM(this.members,e),e.scheduleRender()}remove(e){if(KM(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){const t=this.members.findIndex(i=>e===i);if(t===0)return!1;let r;for(let i=t;i>=0;i--){const s=this.members[i];if(s.isPresent!==!1){r=s;break}}return r?(this.promote(r),!0):!1}promote(e,t){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,t&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:i}=e.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:t,resumingFrom:r}=e;t.onExitComplete&&t.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function AR(n,e,t){let r="";const i=n.x.translate/e.x,s=n.y.translate/e.y;if((i||s)&&(r=`translate3d(${i}px, ${s}px, 0) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),t){const{rotate:l,rotateX:u,rotateY:h}=t;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),h&&(r+=`rotateY(${h}deg) `)}const o=n.x.scale*e.x,a=n.y.scale*e.y;return(o!==1||a!==1)&&(r+=`scale(${o}, ${a})`),r||"none"}const _le=(n,e)=>n.depth-e.depth;class Sle{constructor(){this.children=[],this.isDirty=!1}add(e){XM(this.children,e),this.isDirty=!0}remove(e){KM(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(_le),this.isDirty=!1,this.children.forEach(e)}}function wle(n,e){const t=performance.now(),r=({timestamp:i})=>{const s=i-t;s>=e&&(wo(r),n(s-e))};return on.read(r,!0),()=>wo(r)}function Ale(n){window.MotionDebug&&window.MotionDebug.record(n)}function Mle(n){return n instanceof SVGElement&&n.tagName!=="svg"}function ble(n,e,t){const r=zr(n)?n:sf(n);return r.start(JM("",r,e,t)),r.animation}const MR=["","X","Y","Z"],bR=1e3;let Cle=0;const ll={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function hN({attachResizeListener:n,defaultParent:e,measureScroll:t,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(o,a={},l=e==null?void 0:e()){this.id=Cle++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.potentialNodes=new Map,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{ll.totalNodes=ll.resolvedTargetDeltas=ll.recalculatedProjection=0,this.nodes.forEach(Ple),this.nodes.forEach(Ile),this.nodes.forEach(Dle),this.nodes.forEach(Rle),Ale(ll)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.elementId=o,this.latestValues=a,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0,o&&this.root.registerPotentialNode(o,this);for(let u=0;uthis.root.updateBlockedByResize=!1;n(o,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=wle(p,250),ed.hasAnimatedSinceResize&&(ed.hasAnimatedSinceResize=!1,this.nodes.forEach(ER))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&h&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:p,hasRelativeTargetChanged:m,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||h.getDefaultTransition()||Ule,{onLayoutAnimationStart:_,onLayoutAnimationComplete:g}=h.getProps(),w=!this.targetLayout||!uw(this.targetLayout,v)||m,S=!p&&m;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||S||p&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,S);const M={...Qk(x,"layout"),onPlay:_,onComplete:g};(h.shouldReduceMotion||this.options.layoutRoot)&&(M.delay=0,M.type=!1),this.startAnimation(M)}else!p&&this.animationProgress===0&&ER(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,wo(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Fle),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let h=0;h{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const C=M/1e3;TR(d.x,o.x,C),TR(d.y,o.y,C),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(id(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),kle(this.relativeTarget,this.relativeTargetOrigin,p,C),S&&uw(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=Tn()),bi(S,this.relativeTarget)),x&&(this.animationValues=h,dle(h,u,this.latestValues,C,w,g)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(wo(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=on.update(()=>{ed.hasAnimatedSinceResize=!0,this.currentAnimation=ble(0,bR,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(bR),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:u,latestValues:h}=o;if(!(!a||!l||!u)){if(this!==o&&this.layout&&u&&dN(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||Tn();const d=ci(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+d;const p=ci(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+p}bi(a,l),Mc(a,h),rd(this.projectionDeltaWithTransform,this.layoutCorrected,a,h)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new xle),this.sharedNodes.get(o).add(a);const u=a.options.initialPromotionConfig;a.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(a=!0),!a)return;const u={};for(let h=0;h{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(CR),this.root.sharedNodes.clear()}}}function Ele(n){n.updateLayout()}function Tle(n){var e;const t=((e=n.resumeFrom)===null||e===void 0?void 0:e.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&t&&n.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=n.layout,{animationType:s}=n.options,o=t.source!==n.layout.source;s==="size"?bs(d=>{const p=o?t.measuredBox[d]:t.layoutBox[d],m=ci(p);p.min=r[d].min,p.max=p.min+m}):dN(s,t.layoutBox,r)&&bs(d=>{const p=o?t.measuredBox[d]:t.layoutBox[d],m=ci(r[d]);p.max=p.min+m,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[d].max=n.relativeTarget[d].min+m)});const a=sd();rd(a,r,t.layoutBox);const l=sd();o?rd(l,n.applyTransform(i,!0),t.measuredBox):rd(l,r,t.layoutBox);const u=!fN(a);let h=!1;if(!n.resumeFrom){const d=n.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:p,layout:m}=d;if(p&&m){const v=Tn();id(v,t.layoutBox,p.layoutBox);const x=Tn();id(x,r,m.layoutBox),uw(v,x)||(h=!0),d.options.layoutRoot&&(n.relativeTarget=x,n.relativeTargetOrigin=v,n.relativeParent=d)}}}n.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:u,hasRelativeTargetChanged:h})}else if(n.isLead()){const{onExitComplete:r}=n.options;r&&r()}n.options.transition=void 0}function Ple(n){ll.totalNodes++,n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function Rle(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function Ble(n){n.clearSnapshot()}function CR(n){n.clearMeasurements()}function Lle(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function ER(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0}function Ile(n){n.resolveTargetDelta()}function Dle(n){n.calcProjection()}function Fle(n){n.resetRotation()}function Ole(n){n.removeLeadSnapshot()}function TR(n,e,t){n.translate=hn(e.translate,0,t),n.scale=hn(e.scale,1,t),n.origin=e.origin,n.originPoint=e.originPoint}function PR(n,e,t,r){n.min=hn(e.min,t.min,r),n.max=hn(e.max,t.max,r)}function kle(n,e,t,r){PR(n.x,e.x,t.x,r),PR(n.y,e.y,t.y,r)}function Nle(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const Ule={duration:.45,ease:[.4,0,.1,1]};function Gle(n,e){let t=n.root;for(let s=n.path.length-1;s>=0;s--)if(n.path[s].instance){t=n.path[s];break}const i=(t&&t!==n.root?t.instance:document).querySelector(`[data-projection-id="${e}"]`);i&&n.mount(i,!0)}function RR(n){n.min=Math.round(n.min),n.max=Math.round(n.max)}function zle(n){RR(n.x),RR(n.y)}function dN(n,e,t){return n==="position"||n==="preserve-aspect"&&!iw(wR(e),wR(t),.2)}const Hle=hN({attachResizeListener:(n,e)=>lo(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),H1={current:void 0},pN=hN({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!H1.current){const n=new Hle(0,{});n.mount(window),n.setOptions({layoutScroll:!0}),H1.current=n}return H1.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),Vle={pan:{Feature:sle},drag:{Feature:ile,ProjectionNode:pN,MeasureLayout:lN}},Wle=new Set(["width","height","top","left","right","bottom","x","y"]),mN=n=>Wle.has(n),jle=n=>Object.keys(n).some(mN),BR=n=>n===Yl||n===rt,LR=(n,e)=>parseFloat(n.split(", ")[e]),IR=(n,e)=>(t,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return LR(i[1],e);{const s=r.match(/^matrix\((.+)\)$/);return s?LR(s[1],n):0}},$le=new Set(["x","y","z"]),Jle=yp.filter(n=>!$le.has(n));function Xle(n){const e=[];return Jle.forEach(t=>{const r=n.getValue(t);r!==void 0&&(e.push([t,r.get()]),r.set(t.startsWith("scale")?1:0))}),e.length&&n.render(),e}const DR={width:({x:n},{paddingLeft:e="0",paddingRight:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),height:({y:n},{paddingTop:e="0",paddingBottom:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:IR(4,13),y:IR(5,14)},Kle=(n,e,t)=>{const r=e.measureViewportBox(),i=e.current,s=getComputedStyle(i),{display:o}=s,a={};o==="none"&&e.setStaticValue("display",n.display||"block"),t.forEach(u=>{a[u]=DR[u](r,s)}),e.render();const l=e.measureViewportBox();return t.forEach(u=>{const h=e.getValue(u);h&&h.jump(a[u]),n[u]=DR[u](l,s)}),n},Yle=(n,e,t={},r={})=>{e={...e},r={...r};const i=Object.keys(e).filter(mN);let s=[],o=!1;const a=[];if(i.forEach(l=>{const u=n.getValue(l);if(!n.hasValue(l))return;let h=t[l],d=Ah(h);const p=e[l];let m;if(W0(p)){const v=p.length,x=p[0]===null?1:0;h=p[x],d=Ah(h);for(let _=x;_=0?window.pageYOffset:null,u=Kle(e,n,a);return s.length&&s.forEach(([h,d])=>{n.getValue(h).set(d)}),n.render(),Jv&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:e,transitionEnd:r}};function Qle(n,e,t,r){return jle(e)?Yle(n,e,t,r):{target:e,transitionEnd:r}}const qle=(n,e,t,r)=>{const i=lle(n,e,r);return e=i.target,r=i.transitionEnd,Qle(n,e,t,r)},cw={current:null},gN={current:!1};function Zle(){if(gN.current=!0,!!Jv)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>cw.current=n.matches;n.addListener(e),e()}else cw.current=!1}function eue(n,e,t){const{willChange:r}=e;for(const i in e){const s=e[i],o=t[i];if(zr(s))n.addValue(i,s),X0(r)&&r.add(i);else if(zr(o))n.addValue(i,sf(s,{owner:n})),X0(r)&&r.remove(i);else if(o!==s)if(n.hasValue(i)){const a=n.getValue(i);!a.hasAnimated&&a.set(s)}else{const a=n.getStaticValue(i);n.addValue(i,sf(a!==void 0?a:s,{owner:n}))}}for(const i in t)e[i]===void 0&&n.removeValue(i);return e}const FR=new WeakMap,vN=Object.keys(Gd),tue=vN.length,OR=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],nue=RM.length;class rue{constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:i,visualState:s},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>on.render(this.render,!1,!0);const{latestValues:a,renderState:l}=s;this.latestValues=a,this.baseTarget={...a},this.initialValues=t.initial?{...a}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.options=o,this.isControllingVariants=Kv(t),this.isVariantNode=ok(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...h}=this.scrapeMotionValuesFromProps(t,{});for(const d in h){const p=h[d];a[d]!==void 0&&zr(p)&&(p.set(a[d],!1),X0(u)&&u.add(d))}}scrapeMotionValuesFromProps(e,t){return{}}mount(e){this.current=e,FR.set(e,this),this.projection&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,r)=>this.bindToMotionValue(r,t)),gN.current||Zle(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:cw.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){FR.delete(this.current),this.projection&&this.projection.unmount(),wo(this.notifyUpdate),wo(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,t){const r=Kl.has(e),i=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&on.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),s=t.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{i(),s()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}loadFeatures({children:e,...t},r,i,s,o){let a,l;for(let u=0;uthis.scheduleRender(),animationType:typeof h=="string"?h:"both",initialPromotionConfig:o,layoutScroll:m,layoutRoot:v})}return l}updateFeatures(){for(const e in this.features){const t=this.features[e];t.isMounted?t.update(this.props,this.prevProps):(t.mount(),t.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Tn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}makeTargetAnimatable(e,t=!0){return this.makeTargetAnimatableFromInstance(e,this.props,t)}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;rt.variantChildren.delete(e)}addValue(e,t){t!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,t)),this.values.set(e,t),this.latestValues[e]=t.get()}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&t!==void 0&&(r=sf(t,{owner:this}),this.addValue(e,r)),r}readValue(e){return this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.readValueFromInstance(this.current,e,this.options)}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(t=GM(this.props,r))===null||t===void 0?void 0:t[e]:void 0;if(r&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!zr(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new YM),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class yN extends rue{sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:t,...r},{transformValues:i},s){let o=Mae(r,e||{},this);if(i&&(t&&(t=i(t)),r&&(r=i(r)),o&&(o=i(o))),s){wae(this,r,o);const a=qle(this,r,o,t);t=a.transitionEnd,r=a.target}return{transition:e,transitionEnd:t,...r}}}function iue(n){return window.getComputedStyle(n)}class sue extends yN{readValueFromInstance(e,t){if(Kl.has(t)){const r=jM(t);return r&&r.default||0}else{const r=iue(e),i=(ck(t)?r.getPropertyValue(t):r[t])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:t}){return oN(e,t)}build(e,t,r,i){DM(e,t,r,i.transformTemplate)}scrapeMotionValuesFromProps(e,t){return UM(e,t)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;zr(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}renderInstance(e,t,r,i){mk(e,t,r,i)}}class oue extends yN{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Kl.has(t)){const r=jM(t);return r&&r.default||0}return t=gk.has(t)?t:NM(t),e.getAttribute(t)}measureInstanceViewportBox(){return Tn()}scrapeMotionValuesFromProps(e,t){return yk(e,t)}build(e,t,r,i){OM(e,t,r,this.isSVGTag,i.transformTemplate)}renderInstance(e,t,r,i){vk(e,t,r,i)}mount(e){this.isSVGTag=kM(e.tagName),super.mount(e)}}const aue=(n,e)=>IM(n)?new oue(e,{enableHardwareAcceleration:!1}):new sue(e,{enableHardwareAcceleration:!0}),lue={layout:{ProjectionNode:pN,MeasureLayout:lN}},uue={...Nae,...ioe,...Vle,...lue},na=dse((n,e)=>zse(n,e,uue,aue));function xN(){const n=z.useRef(!1);return z0(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function cue(){const n=xN(),[e,t]=z.useState(0),r=z.useCallback(()=>{n.current&&t(e+1)},[e]);return[z.useCallback(()=>on.postRender(r),[r]),e]}class fue extends z.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function hue({children:n,isPresent:e}){const t=z.useId(),r=z.useRef(null),i=z.useRef({width:0,height:0,top:0,left:0});return z.useInsertionEffect(()=>{const{width:s,height:o,top:a,left:l}=i.current;if(e||!r.current||!s||!o)return;r.current.dataset.motionPopId=t;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` [data-motion-pop-id="${t}"] { position: absolute !important; width: ${s}px !important; height: ${o}px !important; top: ${a}px !important; left: ${l}px !important; } `),()=>{document.head.removeChild(u)}},[e]),z.createElement(fue,{isPresent:e,childRef:r,sizeRef:i},z.cloneElement(n,{ref:r}))}const V1=({children:n,initial:e,isPresent:t,onExitComplete:r,custom:i,presenceAffectsLayout:s,mode:o})=>{const a=BM(due),l=z.useId(),u=z.useMemo(()=>({id:l,initial:e,isPresent:t,custom:i,onExitComplete:h=>{a.set(h,!0);for(const d of a.values())if(!d)return;r&&r()},register:h=>(a.set(h,!1),()=>a.delete(h))}),s?void 0:[t]);return z.useMemo(()=>{a.forEach((h,d)=>a.set(d,!1))},[t]),z.useEffect(()=>{!t&&!a.size&&r&&r()},[t]),o==="popLayout"&&(n=z.createElement(hue,{isPresent:t},n)),z.createElement($v.Provider,{value:u},n)};function due(){return new Map}function pue(n){return z.useEffect(()=>()=>n(),[])}const Vu=n=>n.key||"";function mue(n,e){n.forEach(t=>{const r=Vu(t);e.set(r,t)})}function gue(n){const e=[];return z.Children.forEach(n,t=>{z.isValidElement(t)&&e.push(t)}),e}const _N=({children:n,custom:e,initial:t=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:s=!0,mode:o="sync"})=>{let[a]=cue();const l=z.useContext(LM).forceRender;l&&(a=l);const u=xN(),h=gue(n);let d=h;const p=new Set,m=z.useRef(d),v=z.useRef(new Map).current,x=z.useRef(!0);if(z0(()=>{x.current=!1,mue(h,v),m.current=d}),pue(()=>{x.current=!0,v.clear(),p.clear()}),x.current)return z.createElement(z.Fragment,null,d.map(S=>z.createElement(V1,{key:Vu(S),isPresent:!0,initial:t?void 0:!1,presenceAffectsLayout:s,mode:o},S)));d=[...d];const _=m.current.map(Vu),g=h.map(Vu),w=_.length;for(let S=0;S{if(g.indexOf(S)!==-1)return;const M=v.get(S);if(!M)return;const C=_.indexOf(S),P=()=>{v.delete(S),p.delete(S);const L=m.current.findIndex(B=>B.key===S);if(m.current.splice(L,1),!p.size){if(m.current=h,u.current===!1)return;a(),r&&r()}};d.splice(C,0,z.createElement(V1,{key:Vu(M),isPresent:!1,onExitComplete:P,custom:e,presenceAffectsLayout:s,mode:o},M))}),d=d.map(S=>{const M=S.key;return p.has(M)?S:z.createElement(V1,{key:Vu(S),isPresent:!0,presenceAffectsLayout:s,mode:o},S)}),z.createElement(z.Fragment,null,p.size?d:d.map(S=>z.cloneElement(S)))},vue="assets/ai-b9e562bd.png",yue="assets/file-2099b38f.png",xue="assets/swatch-1e21d263.png",_ue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAALoUlEQVR4nO1deXAT5xXf0k4z7XSmLX8U2gx/MRM69GDSdqZtIJQrXCaEGwzBgCVZsmVz37iY+LYbQzgsMGAuyzYmjuNgcAFjbI5QTBxIABOukMMYKrCl/T7FcTqO/TpvLdm7OlfWSlqZ/c28GQat9L33fvv73nftmmEUKFCgQIECBQoUKFCg4DmG2Wz+Ocuyf7ZarXMJIWsopeukNPxNq9U6j2XZv1gsll+EOl7ZwGQy/cxqtY4hhKwghOyjlH5ICHlKKYVgGiHkGaX0P4SQ/YSQlegT+sY8D7BYLH8ihKRSSusJIe3BTj4VT1K7zcdU9JnpKwCAH1BKR1BKt1JKvwh1omnvDX3PwVgwJibcAAAvEEKiCCG3ZJBMkNjuE0KWNTU1/ZSRO6xW669shbOptwGbWyxw5/ZDqKmuh6KC03Bw/wlJrfDIaaiu+gg+u/2Qa8uPbu0pISSztbX1RUZuYFn2l5TSbEJImy9BffnFIy45ebnlsHalAeZOT4KxI5bDqL8vDYqNGb6ca3PN8lzIM5TD2TNXOZ98JKaNEJIlixEbAPSjlMZSSlvE3v3na65BRkoBzJiSGLTEj/LRZr6eyPmIvprN4lRECMEc6DAnISHDarX+DoeqIhyFC7XXYMumfIgYt9Z7QoYvhcmTE2DOQj2oVsTBArUe5qukMfwt1cpYmBulh4jJ8Vxb3vxBn9F3jAFj8RYvy7KXrVbr74NGBAD8yFYnvvPkWEuLGcrerYFFkWlug31tVALMmq+HmLU6WLc9BjJL1bCrNhoMF3tsc74G1u+MkcTwt/i/jW1hm9g2+oC+oE/u/MVYMCaMzQsp7VhfAODHwVDFVU/ONDe3QP7eCpg2eaPrOy4iAbTrdJBcoIbc88Lku7LM99SSEZJVpvbaHvqUYtSAdn0sRETEu4wBYzuw7wQXq8cu2my+ZbFYXg6ZKqpO13FF0pUSYtbGQnqJ8A4VYztroiExz38y8Dcc1SfG0Gf03ZVyMFaM2ZtaWJbNkkwtYlSBQ8gV8TucHJ48KQGWpelge5XviTDwbGulCjbs6j0Z+N1t/1b55QPGsCxVy8XkGCfGjjkIqFrEqMJiYTnpvjZypcDBCeMSYHWOVlSX5AspGw2+k4Hfwe9K5QfGtPptLRcjP+bx/1jF5QJzIrlaxKii4eYD0CzOdhohLdbHwbZT0iXAwO++zqkg2aiB9WLUsiuGuxa7vED48s6ZaNCsjoXRDiO1JQsy4JPrd6VRi23tqVeqmDEnHjKOeS+akhBTrYKMUjW8dVgDiXu6ko+G/8b/w4EAXhMMX9KPqbnYBTVz5Eoxavkfy7Ib3K6N2SZ5hb6qYsyIpaDbENurgtlXLPdCNCxN0cLYV31Xi8lkKnFJCiFklSdV4DqQoyrUUVlQci4v5AkxyMRKz+8FnSpHkKNxr66AndtKPc74r1y5kikgA1cuKaWsWFVgI3m5x6G9/XuwftcCey7FhDwZhhDbnksaoG3PoKOjA4oKqrgiL1Ytzc3N3wwePHgUXx2vO16EywSuVDFr3jL4/MHXwMe5ewdCnhBDiK3m3kFBTj5/0MjlyrG2YE5dLcGkpKRkMwwzhCOEUrrW8YIPyi441YqEZB037Lv5uFrQOGkzwZ5LwSnoBhna7ktqsHz7X0FObjSddVtbKsovOhFSUlJiZBhmJsMwP2RshwkEF7xfWisYzqYf7ZllH7m6Gjo62wUOVN3ZG/LEGEJkZ+/uE+Sio/N7KLi6pvtzzB1/IRNz64aQSIZhfuOyy8IFtFlT/9kzG83UCpxoeHJe4IS59THsvhicoaZBRoYxt7Q+EuSi4Umt4BrMXff0IGITPHvW4q7LQkJ+i0Pen1BKLY4XFRWc6f6hSeMTuImZvRHjR+ugo7ND4MjpzwwhT5AhyIYx89HZ2QGF9Ru6P8eJ6aSJPfMU3AV1UdRbBw4cuKibEFthT/FVJXdMHwqcaf7mazA8VypRwVPrl4IcYE58VcfJkyfLbGR0dVkI3IL0VSV4J+AdwUdlw3YZJCo6KFbZsMNJHUX1G31Sh9lsbhs2bFiMjYyuos4b/vqskvvP6gROmejDkCfKECR7Qu4LYr//tM5fdfxRMEHsjUqOfpwIndApcKziZk7Ik2UIsFXc2iqIGaATSq5t9kcdsxmGecHVEorPKnnYfE3gGt45Uga/q0YFq7K1MHu+nrPscs9znp3VXXsXuCWLO5RT34iHBeo42LhbuhWFx+SuIOaHzR9Lqw5/VHLs+hbuDuGj/EaWJIFvOaThEsqfWMUn6dxe//ZxFUyZ4nrrFW1hbKzf+zQYmyPevZ4svTr8UclX5hsCBxstDX4FvbVSBVG6OJdJjd3kmhBM9Bsz3JPh7ftirdFyWxDrV+ZPA6MOn1QyMV6w+fPeJ6lOd03Zp+ncqQ7tBh3EJuq4rkds0NNm6n1O6JocrdN175xSQdb7aq774i8DbT0pzhf0GX8HY8BY3MXJV8fECQnSqcOTSvCUBR4ic6eSR7Y7B1eBa6qvgy4mXZAgrANiCZk43hbU8K5uRgwhc97sSfq0WXphV1ahgtGv8PbBM8T5gj7z29Zp07nYMMaunuC2e3VMSXR5MsUndfhTSwovpnNLz3OmOZ88QdNvFt9VJB/RcFukqcVqbkvYGyHYXeGd76nOTJ/Z0529GRMnyg/02VUsmGzcgiioTQ9c7ehtLUkrVnN76fyE+EuIgWdiCMEzV/xrNhmcjxyhj/bPp06L94sQu6Hq5kfHQdIBjfS1ozcqcXccs+sOKoesNGNQCEk2agTX4OjM8RpUnP1z7BJ9JQRjwZjcnkvm5UJydfiiEr6pojK5vRT7liWeKg8GIVsOCQlJLXKeq+D37J/jwTdfCcFYMCaWZbmT8sv1O2D0K8JNqICpw5tKjhZW9dSSMashO72Q2+51vC5YhCQHQSF2QviGMf8rowgmjV3TfR3mxvkmbvl26NChGr/U4UkluA2JO1+42WIyNTs5EGxCsstUAa8hrgixG+YAc3Hig0sut2glUYcdLMv2p5QSd854smARkns+WrBV6qot/ihroTZOUkI8mYM6ZjEM4/85X3wYRc6EGBzmITPmCOchOSfUwnmIwxwqkITk5+fvk0wdduBhLovFcjhYhOyq7ToViENqHFLyCVmSEMv9P9r2syq3M/VlKV2HMnC2Pm+xcKaeI/K8r7+EXL58uaZfv37zJVUHH/X19ckmk8npDFdLS0tbY2Njk1SEzF7gfumEb9zktKaHRKwN/M+5uZHD0Byf/RDrhzdCMGaM3bmmmFij0XiIpwy0wUwgMGjQoBFJSUmZ2GBxcXFBWlpa9oABAxZXVFSUSkXIBIfT5Z6Mf7fjuhV/tuxokUv0Pq2peSMEY8b9cMwB5gJzgrnp379/lAMZf2UCjJcYhpnOb1RKQtZtj+GSh88DurN5i/SQ8JbW5cl0PG+My/ZjRybA+DFLucVF7NJ8XXoXQ4gt/ghblxTpYNNtuQoK8InTX9saHHLv3r2cQBR1QwjNB0L+YNsPf9F2AvElW25C81QughCy5TknRF5QCJEZFEJkBoUQmUEhRGZQCJEZFEJkBoUQmUEhRGZQCJEZFEJkBoUQmUEhRGZQCJEZFEJkBoUQmUEhRGZQCJEZFEJkBoUQmUEhRGZQCAkzQg7ur4Rww8H9lX331IlCSJChECIzKITIDEpRlxkUQmQGhZAwIwQfIcDXpoaTzY3S991hb7hbXhgS4vT++OPlF0OeyFESmasXIONTU3ImxOUryzEQfCF9ONsJN8+f8963Kz9CbC/1d3rrQ1+15uZmK+99u13vbZcb8M9xhzpRNEhmNBoPO71vV27A59kJIcZQJ4sG2Orq6i7wnj8Xvm9XjqTU1dWl49/FCHXiaAC6KVQGj4zIYD5l6xfwj5TYn98+derU8XC2Ytvz+LyaYbe/MWGGITZJR/Yxmxk2ynAB/vPbw8LchthikW/NUKBAgQIFChQoUMA44/+a1QMyPToXpQAAAABJRU5ErkJggg==",Sue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAOnElEQVR4nO2dCVBURxrHO+4ma9Zda1PZyu5Waitbe1jWblU02Rh31XgFYwyeeCQYE2ISE68wb1DwioIXauLJghoUFUFF8UJFUTlEQRSQeOGIiiCKDMfMdD9AEJBvq4c533tzMsO8wfdV/atUnH7d/eP7uvvr7jcISSaZZJJJJplkkkkmmWSSSSZZZzcAeAlj/IqpKisrf+PpeonWAOAXLMuOI4QkYoyLCCFqK9IQQsBFKsYYb8MY/93TfSAKo7+lhJBA2jEu7GRwVBjjZkJIvEajeRs9j1ZbW/sHQkgYIUTlSRBEGE4Wxngi9VrU2U2tVr9JCPkJY9zg6Y4ntnWXECIDgJdRZzOWZQdgjI9jjFtF0NHgoMdUEUJW19XV/Ql5swHAi4SQLzDGN+xsOKSdzQVm1iYYNXw+jBw2zyGNeD8YBv830G6NGDoXwhbFwPWrd+yFU08I2YIx/ivyJqOxF2M8nRBSak9Da2pUcPRQJnz+yQqHOtSVmvH1Ojh7+rK9HtOMMY7DGP8Nid00Gk1vQshlexpWVvYYfoo6CmNGLHR7h494bxaMHDjTqMHfCf6/aV/8ACknc0CjwfaAoeNgGAD8ConNAOAFQkgwxrjFVkNuFRbDquVxMHzwHF6HfOQTAhHrE6EoORYeLn1HUJXL3wZNeO92Ccd/AwVXFPD9vGgY2p/h1WPyhKWQmJAG1dU1NsGo1ep8lUr1ZyQWA4CuhJADtiqek30dFoX8JNgBH4+aCzu3n4CKiipgWRaIIrPdnW5N5HiY9jlUd+88gPXLomD4IL7HUO/dGnUEyh8pbYTdGnVVVdUgMcB4mRByxlJFqevTEDAtYI1giJg+KRDSoxhoyl1p6CCWAlFXg2bdAPcBuXrC7HlP7yaB5jQD2xczMOp94QlAxIZEKC15ZM1TGouKinw9PYuyCOPa1SL4duqPvMYN6R8IC76SQf5OBiBbblCd6qE5lONL3QIDbxwKLFabPavl53WGejzJkMPB1QxMGsEHQ8Ms9RhVjdoilIyMjJEeAUII2Wxp+rpz2wl4f4B5aBo+MBDWB8ng4VEjBFM13ks26yS26iFoNg51vXcUJJk9p666BCA7iFef5vNyOL2JgS/9ZPzBP2ANFN8rE4RSVVXFRkREvNvRMAKEKqNSqWHJgu1mlf/gPRlEL5JpQ4IQCL1ac5dALa4295KbqaBZ865bxg69mm7ttl6vLDlkRzPw9XjO+PLhAsjPLRSEUlxcXNyzZ8+OWUjW1dX9UZd15birBubP3WpW6Vn+lj1CSE23E3gdRm6cBc0PfdsP48QyYFliVnZ9xXVB7xBSywU57FspA5/3zGeFeZeFoSQlJe1BCLk/xU8I2S9UgR9X7TGDQcMTdXt7YbQpCOofX+NBYR/dBrz7S+dgbBgCJDeRVyb1xmd5KxysnxxuxDMw1sd8JiYUvlQqVZO/v/9UhNALbl34CeWjjh7ONIMRNd96eLIaInLmQ32lgg+FJW3eEjcNNKvsWItsHgnkwg5ga5R8GEQFLVc3OV3H+4cYGDtMZjam0AjBm+rn5JxHCP3LbUAwxke4D31YVgGjP5xvqNzib2TauOtsY4FCubTQAhSdqsuBXDsFJHWjdlzAB+SAjywAnLIGyKV9wD60/FnqGS3XItpVP6qbe+UwbIDxl5BOZPjTfs0zPz8/GULoty6HUV9f/7rQSjx8aayhUv6+MmhIb19DQa+Lc6DxbhKwBFsG46DqlYXwLG+Za+qXLYeElcaZ5AeD58CD0nIelNTU1GSE0H9cDgRjPJ/7sHt3H4DPQLmhUpdjnA9VltTy83p48vjndoGoq3kATYo9dg/g9upZlhymTTR6yca1+3lAlEol6d69+6cu9xKMcSH3YZGbDprNqFwNA0wbX/ADNDw4B7Wqcrsg0HHiyeMCaC6M0Xqbu+p1cZvRS+gWQFUVP/8VHh6+FiHkuu1hjHEfoQXgpLFLDJWhc3V3AgFTOPnh0KSIh6f3jkFDyVl4UnYRGh5kaheXT2/vbxsjcoI7pC50vPx8jHGATz6WzQNSUFBwGSE0DiHUxSVACCGR3IdczLpmqMRon0BozuwYGCBCxS01ApkTGCmUUmnu1avXNwih1111pqma+5AVobuMsXOue8MViFzKE4w2R0f7gqaMSgSSkLGxsTsRQgPaDUSj0Yzn5Wsqa7QZUD0QRYLnOwU8LPkUo5fsikkWSqfcQwh9jBBq34YWxviYtYVgwFjv845nWXJQpTBQk9L2Z1eUmbLJOLjT7WihbMaUKVNCEEL/cBpGbW3taxjjJm7BgTM2Gh6+b0XHDebgAjWek0POdgZSI9uUvY2Bxoz2T4fp+uujwcYpcEG+ggckJSXlGEJouNNACCFB3ELvFz807PrRuFmV7PlOBgek2GeEoRdddbui7FXfGcPW2tV7eUAqKirUXbt2pWuS3zkL5Cq30O1bjxkeGjLV+8JV7k4+kEsxrim7YLcxbNGjTPREDbf/QkNDVyOEejt7goQfByctNzw0Lcq7whVQD0mQ84AU7mNctibx9zWGLbp9ze2/vLy8iwihsQ5ngTHGG7iFXc65YdwLGBIIjRme72BwULWp5kDoeELHFVeVv2OJMWzNC9oimJbv0aPHVwgh+zewAOCXGGMlLwWwbLcxRsq9L1xBthxu7zcCoeuH1guuLf/xcQaG9DOuSYQSjjExMdsQQv3sBsKy7BhuIfSMkq9PiAHIzT3eF65At4ijoZZ6hqumvFx9N9noJfGxKTwgd+7cKUIITUIIvWRvuDrMLYTmaPQP+XRsCLRmz3W4ovVpclgTKIPVgQzUpXoOaPP5tnhv6ed0Krzwa5k2cehM+cc2hxv6auqn4YJrEj8/vyCEkO2LQoSQVzHGjdwCaI5G/5BtW5O0x3a0KW0HMqkRwcZZyIFVthv7JEMO1+LkcG4Lo01e3j8od3mIEdLIIW11/HBQINScYhzaKqBb0JXKau3+iL6t9EgU7xc8OfkwQmiYPd4xm/vhkvsma49+Mu1pP+MxmvvQVLjL5l7D4+NyswMCO0Otj0FNmQxkRfOnqB2RpjHdjl7L2B4rWwrWwpPyfLP0/5KFxtM3GwT2SSoqKqq7dOkyGSHU3ZaH8A6/0e1JfeGBMzYJbwJVFkHz9S0WKx023fx8ky0gZUf501O9mtycWTat59B+gVByWPj/PbuyGp48yuWdZqE6f67A7CAEPSLF7deAgID5CKE3bXnIY+4HaRw0bERNWw+FN4utbJPegpZr/+OtjvUzD3uBFB0QhkGFz3YcECo6npiByF0KDaXpFreXaefvjTttVsa59Cs8IJGRkZEIoTG2gPCmuwGTV5oVPqS/THsgzjqYm4aTHTKTTKi9QMqPCcNI3yzrUA8xjAPxDLTmhdkEkbDnLIwf9T3v8xlp+TwgUVFRmxFC/gihV6wBOc/9oOLWfQhmorTjBw/MQutgMo4eEWygLSAtF9pODHKB0Cnr1Tg5PM103yxNqL7TPwsFolFZBTFhNB+En+8i7c/oDiu3X2fOnLlYB+Qv1sYQudA0jepK/i2rYOjdD9OK0kp8ZnIzynTmYQlIUyYDt/cz2pmVpZBFRWdfHQHkg0FzzFIhpu1TqzSQsOeMIIhxvosgbtcpwT123aCu0iUarQOpqKjoRgh5YAkKFb2XR+96CIGh/64HQy+9GFItPiFmpxuFgDRlmqfGrSljc8d4yKZ1Bwx/njxxmfZAHFXSoUz4eFwoDwQ980vvulRbAKFXdHT0Vh0MqldtjSPvCJ3fteQx3ErRKXLoohitu+r/LSb6uPYovzUgN/danllxRbO2HQGkvFypvVSq/zsdOyeMXizoEbt3WvYIU124cCHNBMYYuxKNLMv2FBpPHPEYveggR39jrAGhoSotyj4YdH3CunGlb1p32j66JSvULkc8gqqmpqYhPj4+Vrf+0ANx7FYvxthHrVbn2QOGrkiFwBxKzND+3BoQcsY+78jdYT3t4Q4g9IIONzw5AkKlUjWmp6ef6tOnz3QTEFR9HILhLJj8vFvaVAsFw8yKoGdcbQLhpsVTLagg1v05MC4QKnptmg7w2tC046RDIPr27TuDA2ICQqiH0zCcBUNPp5j+3RqQ1qwgOL/VNpSSw54Bom1PVY3hl8tJEBMRQv9GCHV1CQxnwdgDhKr0sHUYFJi7F4XWgIgShAUw+a4A0polh1sCW6xUmVsY0JxxPwxngIgChDNgbAEBnapPyrWpCromoYP4vcS24zsdAcMRIKIEIfBGB1+VSnVIo9E0OAsEPCxbQEpLS0uPHDly4K233vpWAESvdp9OdIcRQlZ2RiBKpVLDgaAH0VuUIJ4zICN0dwjFC0JvhJAVnRzIOORNRghZLgERkRFClokJSGsWXee0XUGjU+iruxmoS3u+PGSpmIDcEdgSpnsuDQIn3zsrkDCxAGk+L7eYSb6b+Jx4CMY4VCxAiJVMstDOY2cFskQMQNhURnt/3hKQ58lDFosBSPY2yzDo4C6UkumsQL73NJCmTH6oomPJuedxloUxXuRpIKB704LZUVQ7Lud0ViALxQCkNrXtGhv1iut76DHU5xfIAjEAASfUWYHw3h4kAfGgYYznSUBEZCzLhkhARGT0XfASEBGZBERkRgiZK3mIiIwQMkcCIiITenGN6bTXW0Q60TpkOrcx9EqCpzt4sAMaNjCIB+TRo0dVXgmEEDKC25jbihLwHx/m8Y4ebIfo62+jIg7xgCgUipteCaS8vPzXhBCW2yBvV0JCQpwOyCjkbSa0a+jNUiqVmjfeeGOqDshQ5G1Gv4UHY5zm6Y4kLpBarW4KDg5eZnJIrifyRqNfK6dQKBLoi+k93anESZWVlZXPnj1bf4VZP368iLzYugQEBHx28ODBvfQrHK5cuXLJC5STlpZ2kr4mvFu3blNMYNBXvb6GOoHR12y/gxD6ROCwsrfIFyH0e9TJjH5LwD91X+HQ30v0tu414e77thzJJJNMMskkk0wyySSTTDLkGfs/qs34Wg57eFIAAAAASUVORK5CYII=",wue=n=>new Promise((e,t)=>{const r=new FileReader;r.onload=()=>e(r.result),r.readAsDataURL(n)}),Aue=n=>{const e=n.replace("#",""),t=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16);return(t*299+r*587+i*114)/1e3>128?"black":"white"},Mue=[{name:"colorpicker",icon:xue},{name:"filepicker",icon:yue},{name:"aipicker",icon:vue}],bue=[{name:"logoShirt",icon:_ue},{name:"stylishShirt",icon:Sue}],Cue={logo:{stateProperty:"logoDecal",filterTab:"logoShirt"},full:{stateProperty:"fullDecal",filterTab:"stylishShirt"}},po={type:"spring",duration:.8},Y0=n=>({initial:{x:n==="left"?-100:n==="right"?100:0,y:n==="up"?100:n==="down"?-100:0,opacity:0,transition:{...po,delay:.5}},animate:{x:0,y:0,opacity:1,transition:{...po,delay:0}},exit:{x:n==="left"?-100:n==="right"?100:0,y:n==="up"?100:n==="down"?-100:0,transition:{...po,delay:0}}}),Eue={initial:{opacity:0,transition:{...po,delay:.5}},animate:{opacity:1,transition:{...po,delay:0}},exit:{opacity:0,transition:{...po,delay:0}}},Tue={initial:{x:100,opacity:0},animate:{x:0,opacity:1},transition:{type:"spring",damping:5,stiffness:40,restDelta:.001,duration:.3}},Pue={initial:{y:100,opacity:0},animate:{y:0,opacity:1},transition:{type:"spring",damping:7,stiffness:30,restDelta:.001,duration:.6,delay:.2,delayChildren:.2}},Rue={initial:{x:-100,opacity:0,transition:{...po,delay:.5}},animate:{x:0,opacity:1,transition:{...po,delay:0}},exit:{x:-100,opacity:0,transition:{...po,delay:0}}},Tl=({type:n,title:e,customStyles:t,handleClick:r})=>{const i=Xl(wr),s=o=>{if(o==="filled")return{backgroundColor:i.color,color:Aue(i.color)};if(o==="outline")return{borderWidth:"1px",borderColor:i.color,color:i.color}};return it("button",{className:`px-2 py-1.5 flex-1 rounded-md ${t}`,style:s(n),onClick:r,children:e})},Bue=({prompt:n,setPrompt:e,generatingImg:t,handleSubmit:r})=>Zn("div",{className:"aipicker-container",children:[it("textarea",{placeholder:"Ask AI...",rows:5,value:n,onChange:i=>e(i.target.value),className:"aipicker-textarea"}),it("div",{className:"flex flex-wrap gap-3",children:t?it(Tl,{type:"outline",title:"Asking AI...",customStyles:"text-xs"}):Zn(HB,{children:[it(Tl,{type:"outline",title:"AI Logo",handleClick:()=>r("logo"),customStyles:"text-xs"}),it(Tl,{type:"filled",title:"AI Full",handleClick:()=>r("full"),customStyles:"text-xs"})]})})]});var Ri={},wp={},Lue=GO,Iue=Vee;function Due(n,e){return n&&Lue(n,Iue(e))}var QM=Due,Fue=$l,Oue=wM,kue=Po,Nue="[object Object]",Uue=Function.prototype,Gue=Object.prototype,SN=Uue.toString,zue=Gue.hasOwnProperty,Hue=SN.call(Object);function Vue(n){if(!kue(n)||Fue(n)!=Nue)return!1;var e=Oue(n);if(e===null)return!0;var t=zue.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&SN.call(t)==Hue}var Wue=Vue;Object.defineProperty(wp,"__esModule",{value:!0});wp.flattenNames=void 0;var jue=aie,$ue=Zv(jue),Jue=QM,Xue=Zv(Jue),Kue=Wue,Yue=Zv(Kue),Que=Nee,que=Zv(Que);function Zv(n){return n&&n.__esModule?n:{default:n}}var Zue=wp.flattenNames=function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,que.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,Yue.default)(r)?(0,Xue.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,$ue.default)(r)&&t.push(r)}),t};wp.default=Zue;var Ap={},ece=tie,tce=1,nce=4;function rce(n){return ece(n,tce|nce)}var ice=rce;Object.defineProperty(Ap,"__esModule",{value:!0});Ap.mergeClasses=void 0;var sce=QM,oce=wN(sce),ace=ice,lce=wN(ace),uce=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,lce.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,oce.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=uce({},r[a],s[a])}),i}),r};Ap.default=cce;var Mp={};Object.defineProperty(Mp,"__esModule",{value:!0});Mp.autoprefix=void 0;var fce=QM,kR=dce(fce),hce=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){_ce(i,r);function i(){var s,o,a,l;xce(this,i);for(var u=arguments.length,h=Array(u),d=0;d1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){Cce(i,r);function i(){var s,o,a,l;bce(this,i);for(var u=arguments.length,h=Array(u),d=0;d1&&arguments[1]!==void 0?arguments[1]:!0;r[o]=a};return e===0&&i("first-child"),e===t-1&&i("last-child"),(e===0||e%2===0)&&i("even"),Math.abs(e%2)===1&&i("odd"),i("nth-child",e),r};qM.default=Tce;Object.defineProperty(Ri,"__esModule",{value:!0});Ri.ReactCSS=Ri.loop=Ri.handleActive=ZM=Ri.handleHover=Ri.hover=void 0;var Pce=wp,Rce=bf(Pce),Bce=Ap,Lce=bf(Bce),Ice=Mp,Dce=bf(Ice),Fce=bp,AN=bf(Fce),Oce=Cp,kce=bf(Oce),Nce=qM,Uce=bf(Nce);function bf(n){return n&&n.__esModule?n:{default:n}}Ri.hover=AN.default;var ZM=Ri.handleHover=AN.default;Ri.handleActive=kce.default;Ri.loop=Uce.default;var Gce=Ri.ReactCSS=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;ia?p=1:p=Math.round(d*100/a)/100,t.a!==p)return{h:t.h,s:t.s,l:t.l,a:p,source:"rgb"}}else{var m=void 0;if(h<0?m=0:h>o?m=1:m=Math.round(h*100/o)/100,i!==m)return{h:t.h,s:t.s,l:t.l,a:m,source:"rgb"}}return null},$1={},Hce=function(e,t,r,i){if(typeof document>"u"&&!i)return null;var s=i?new i:document.createElement("canvas");s.width=r*2,s.height=r*2;var o=s.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,s.width,s.height),o.fillStyle=t,o.fillRect(0,0,r,r),o.translate(r,r),o.fillRect(0,0,r,r),s.toDataURL()):null},Vce=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if($1[s])return $1[s];var o=Hce(e,t,r,i);return $1[s]=o,o},GR=Object.assign||function(n){for(var e=1;e-1},rfe=function(e){return Number(String(e).replace(/%/g,""))},ife=1,Tt=function(n){qce(e,n);function e(t){Yce(this,e);var r=Qce(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.handleBlur=function(){r.state.blurValue&&r.setState({value:r.state.blurValue,blurValue:null})},r.handleChange=function(i){r.setUpdatedValue(i.target.value,i)},r.handleKeyDown=function(i){var s=rfe(i.target.value);if(!isNaN(s)&&nfe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===MN?s+o:s-o;r.setUpdatedValue(a,i)}},r.handleDrag=function(i){if(r.props.dragLabel){var s=Math.round(r.props.value+i.movementX);s>=0&&s<=r.props.dragMax&&r.props.onChange&&r.props.onChange(r.getValueObjectWithLabel(s),i)}},r.handleMouseDown=function(i){r.props.dragLabel&&(i.preventDefault(),r.handleDrag(i),window.addEventListener("mousemove",r.handleDrag),window.addEventListener("mouseup",r.handleMouseUp))},r.handleMouseUp=function(){r.unbindEventListeners()},r.unbindEventListeners=function(){window.removeEventListener("mousemove",r.handleDrag),window.removeEventListener("mouseup",r.handleMouseUp)},r.state={value:String(t.value).toUpperCase(),blurValue:String(t.value).toUpperCase()},r.inputId="rc-editable-input-"+ife++,r}return Xce(e,[{key:"componentDidUpdate",value:function(r,i){this.props.value!==this.state.value&&(r.value!==this.props.value||i.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(r){return Kce({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||Zce}},{key:"setUpdatedValue",value:function(r,i){var s=this.props.label?this.getValueObjectWithLabel(r):r;this.props.onChange&&this.props.onChange(s,i),this.setState({value:r})}},{key:"render",value:function(){var r=this,i=lt({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return k.createElement("div",{style:i.wrap},k.createElement("input",{id:this.inputId,style:i.input,ref:function(o){return r.input=o},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?k.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(z.PureComponent||z.Component),sfe=function(e,t,r,i){var s=i.clientWidth,o=i.clientHeight,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,u=a-(i.getBoundingClientRect().left+window.pageXOffset),h=l-(i.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var d=void 0;if(h<0)d=359;else if(h>o)d=0;else{var p=-(h*100/o)+100;d=360*p/100}if(r.h!==d)return{h:d,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var m=void 0;if(u<0)m=0;else if(u>s)m=359;else{var v=u*100/s;m=360*v/100}if(r.h!==m)return{h:m,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},ofe=function(){function n(e,t){for(var r=0;r-1}function mfe(n,e){var t=this.__data__,r=ey(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function Ro(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1&&n%1==0&&n<=Fhe}function Tf(n){return n!=null&&ib(n.length)&&!tb(n)}function Ohe(n){return Ea(n)&&Tf(n)}function khe(){return!1}var LN=typeof ri=="object"&&ri&&!ri.nodeType&&ri,YR=LN&&typeof ii=="object"&&ii&&!ii.nodeType&&ii,Nhe=YR&&YR.exports===LN,QR=Nhe?ps.Buffer:void 0,Uhe=QR?QR.isBuffer:void 0,Ghe=Uhe||khe;const ev=Ghe;var zhe="[object Object]",Hhe=Function.prototype,Vhe=Object.prototype,IN=Hhe.toString,Whe=Vhe.hasOwnProperty,jhe=IN.call(Object);function $he(n){if(!Ea(n)||Ql(n)!=zhe)return!1;var e=RN(n);if(e===null)return!0;var t=Whe.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&IN.call(t)==jhe}var Jhe="[object Arguments]",Xhe="[object Array]",Khe="[object Boolean]",Yhe="[object Date]",Qhe="[object Error]",qhe="[object Function]",Zhe="[object Map]",ede="[object Number]",tde="[object Object]",nde="[object RegExp]",rde="[object Set]",ide="[object String]",sde="[object WeakMap]",ode="[object ArrayBuffer]",ade="[object DataView]",lde="[object Float32Array]",ude="[object Float64Array]",cde="[object Int8Array]",fde="[object Int16Array]",hde="[object Int32Array]",dde="[object Uint8Array]",pde="[object Uint8ClampedArray]",mde="[object Uint16Array]",gde="[object Uint32Array]",Qt={};Qt[lde]=Qt[ude]=Qt[cde]=Qt[fde]=Qt[hde]=Qt[dde]=Qt[pde]=Qt[mde]=Qt[gde]=!0;Qt[Jhe]=Qt[Xhe]=Qt[ode]=Qt[Khe]=Qt[ade]=Qt[Yhe]=Qt[Qhe]=Qt[qhe]=Qt[Zhe]=Qt[ede]=Qt[tde]=Qt[nde]=Qt[rde]=Qt[ide]=Qt[sde]=!1;function vde(n){return Ea(n)&&ib(n.length)&&!!Qt[Ql(n)]}function yde(n){return function(e){return n(e)}}var DN=typeof ri=="object"&&ri&&!ri.nodeType&&ri,od=DN&&typeof ii=="object"&&ii&&!ii.nodeType&&ii,xde=od&&od.exports===DN,X1=xde&&bN.process,_de=function(){try{var n=od&&od.require&&od.require("util").types;return n||X1&&X1.binding&&X1.binding("util")}catch{}}();const qR=_de;var ZR=qR&&qR.isTypedArray,Sde=ZR?yde(ZR):vde;const sb=Sde;function hw(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}var wde=Object.prototype,Ade=wde.hasOwnProperty;function Mde(n,e,t){var r=n[e];(!(Ade.call(n,e)&&Ep(r,t))||t===void 0&&!(e in n))&&nb(n,e,t)}function bde(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s-1&&n%1==0&&n0){if(++e>=Hde)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var $de=jde(zde);const Jde=$de;function Xde(n,e){return Jde(Nde(n,e,ny),n+"")}function Kde(n,e,t){if(!ki(t))return!1;var r=typeof e;return(r=="number"?Tf(t)&&ob(e,t.length):r=="string"&&e in t)?Ep(t[e],n):!1}function Yde(n){return Xde(function(e,t){var r=-1,i=t.length,s=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(s=n.length>3&&typeof s=="function"?(i--,s):void 0,o&&Kde(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r=e||L<0||d&&B>=s}function g(){var P=K1();if(_(P))return w(P);a=setTimeout(g,x(P))}function w(P){return a=void 0,p&&r?m(P):(r=i=void 0,o)}function S(){a!==void 0&&clearTimeout(a),u=0,r=l=i=a=void 0}function M(){return a===void 0?o:w(K1())}function C(){var P=K1(),L=_(P);if(r=arguments,i=this,l=P,L){if(a===void 0)return v(l);if(d)return clearTimeout(a),a=setTimeout(g,e),m(l)}return a===void 0&&(a=setTimeout(g,e)),o}return C.cancel=S,C.flush=M,C}var fpe="Expected a function";function hpe(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(fpe);return ki(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),NN(n,e,{leading:r,maxWait:e,trailing:i})}var dpe=function(e,t,r){var i=r.getBoundingClientRect(),s=i.width,o=i.height,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,u=a-(r.getBoundingClientRect().left+window.pageXOffset),h=l-(r.getBoundingClientRect().top+window.pageYOffset);u<0?u=0:u>s&&(u=s),h<0?h=0:h>o&&(h=o);var d=u/s,p=1-h/o;return{h:t.h,s:d,v:p,a:t.a,source:"hsv"}},ppe=function(){function n(e,t){for(var r=0;r=0,s=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return He(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(Upe,arguments)},brighten:function(){return this._applyModification(Gpe,arguments)},darken:function(){return this._applyModification(zpe,arguments)},desaturate:function(){return this._applyModification(Ope,arguments)},saturate:function(){return this._applyModification(kpe,arguments)},greyscale:function(){return this._applyModification(Npe,arguments)},spin:function(){return this._applyModification(Hpe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(jpe,arguments)},complement:function(){return this._applyCombination(Vpe,arguments)},monochromatic:function(){return this._applyCombination($pe,arguments)},splitcomplement:function(){return this._applyCombination(Wpe,arguments)},triad:function(){return this._applyCombination(aB,[3])},tetrad:function(){return this._applyCombination(aB,[4])}};He.fromRatio=function(n,e){if(tv(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Oh(n[r]));n=t}return He(n,e)};function Bpe(n){var e={r:0,g:0,b:0},t=1,r=null,i=null,s=null,o=!1,a=!1;return typeof n=="string"&&(n=Qpe(n)),tv(n)=="object"&&(qs(n.r)&&qs(n.g)&&qs(n.b)?(e=Lpe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):qs(n.h)&&qs(n.s)&&qs(n.v)?(r=Oh(n.s),i=Oh(n.v),e=Dpe(n.h,r,i),o=!0,a="hsv"):qs(n.h)&&qs(n.s)&&qs(n.l)&&(r=Oh(n.s),s=Oh(n.l),e=Ipe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=GN(t),{ok:o,format:n.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function Lpe(n,e,t){return{r:rn(n,255)*255,g:rn(e,255)*255,b:rn(t,255)*255}}function rB(n,e,t){n=rn(n,255),e=rn(e,255),t=rn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=(r+i)/2;if(r==i)s=o=0;else{var l=r-i;switch(o=a>.5?l/(2-r-i):l/(r+i),r){case n:s=(e-t)/l+(e1&&(d-=1),d<1/6?u+(h-u)*6*d:d<1/2?h:d<2/3?u+(h-u)*(2/3-d)*6:u}if(e===0)r=i=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=o(l,a,n+1/3),i=o(l,a,n),s=o(l,a,n-1/3)}return{r:r*255,g:i*255,b:s*255}}function iB(n,e,t){n=rn(n,255),e=rn(e,255),t=rn(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=r,l=r-i;if(o=r===0?0:l/r,r==i)s=0;else{switch(r){case n:s=(e-t)/l+(e>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(He(r));return s}function $pe(n,e){e=e||6;for(var t=He(n).toHsv(),r=t.h,i=t.s,s=t.v,o=[],a=1/e;e--;)o.push(He({h:r,s:i,v:s})),s=(s+a)%1;return o}He.mix=function(n,e,t){t=t===0?0:t||50;var r=He(n).toRgb(),i=He(e).toRgb(),s=t/100,o={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return He(o)};He.readability=function(n,e){var t=He(n),r=He(e);return(Math.max(t.getLuminance(),r.getLuminance())+.05)/(Math.min(t.getLuminance(),r.getLuminance())+.05)};He.isReadable=function(n,e,t){var r=He.readability(n,e),i,s;switch(s=!1,i=qpe(t),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};He.mostReadable=function(n,e,t){var r=null,i=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var u=0;ui&&(i=s,r=He(e[u]));return He.isReadable(n,r,{level:a,size:l})||!o?r:(t.includeFallbackColors=!1,He.mostReadable(n,["#fff","#000"],t))};var dw=He.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Jpe=He.hexNames=Xpe(dw);function Xpe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function GN(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function rn(n,e){Kpe(n)&&(n="100%");var t=Ype(n);return n=Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(n*e,10)/100),Math.abs(n-e)<1e-6?1:n%e/parseFloat(e)}function sy(n){return Math.min(1,Math.max(0,n))}function Qr(n){return parseInt(n,16)}function Kpe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function Ype(n){return typeof n=="string"&&n.indexOf("%")!=-1}function is(n){return n.length==1?"0"+n:""+n}function Oh(n){return n<=1&&(n=n*100+"%"),n}function zN(n){return Math.round(parseFloat(n)*255).toString(16)}function lB(n){return Qr(n)/255}var qi=function(){var n="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+n+")",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function qs(n){return!!qi.CSS_UNIT.exec(n)}function Qpe(n){n=n.replace(Ppe,"").replace(Rpe,"").toLowerCase();var e=!1;if(dw[n])n=dw[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=qi.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=qi.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=qi.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=qi.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=qi.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=qi.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=qi.hex8.exec(n))?{r:Qr(t[1]),g:Qr(t[2]),b:Qr(t[3]),a:lB(t[4]),format:e?"name":"hex8"}:(t=qi.hex6.exec(n))?{r:Qr(t[1]),g:Qr(t[2]),b:Qr(t[3]),format:e?"name":"hex"}:(t=qi.hex4.exec(n))?{r:Qr(t[1]+""+t[1]),g:Qr(t[2]+""+t[2]),b:Qr(t[3]+""+t[3]),a:lB(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=qi.hex3.exec(n))?{r:Qr(t[1]+""+t[1]),g:Qr(t[2]+""+t[2]),b:Qr(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function qpe(n){var e,t;return n=n||{level:"AA",size:"small"},e=(n.level||"AA").toUpperCase(),t=(n.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var uB=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return Tpe(t,function(s){if(e[s]&&(r+=1,isNaN(e[s])||(i+=1),s==="s"||s==="l")){var o=/^\d+%$/;o.test(e[s])&&(i+=1)}}),r===i?e:!1},kh=function(e,t){var r=e.hex?He(e.hex):He(e),i=r.toHsl(),s=r.toHsv(),o=r.toRgb(),a=r.toHex();i.s===0&&(i.h=t||0,s.h=t||0);var l=a==="000000"&&o.a===0;return{hsl:i,hex:l?"transparent":"#"+a,rgb:o,hsv:s,oldHue:e.h||t||i.h,source:e.source}},Fa=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&He(e).isValid()},lb=function(e){if(!e)return"#fff";var t=kh(e);if(t.hex==="transparent")return"rgba(0,0,0,0.4)";var r=(t.rgb.r*299+t.rgb.g*587+t.rgb.b*114)/1e3;return r>=128?"#000":"#fff"},Y1=function(e,t){var r=e.replace("°","");return He(t+" ("+r+")")._ok},Ch=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){ome(i,r);function i(){var s,o,a,l;sme(this,i);for(var u=arguments.length,h=Array(u),d=0;da))return!1;var u=s.get(n),h=s.get(e);if(u&&h)return u==e&&h==n;var d=-1,p=!0,m=t&yme?new nv:void 0;for(s.set(n,e),s.set(e,n);++d=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var zg=24,Gge=QN.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?zg:r,s=n.height,o=s===void 0?zg:s,a=n.style,l=a===void 0?{}:a,u=Uge(n,["fill","width","height","style"]);return TB.default.createElement("svg",EB({viewBox:"0 0 "+zg+" "+zg,style:EB({fill:t,width:i,height:o},l)},u),TB.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},zge=function(){function n(e,t){for(var r=0;r1&&(i.a=1),r.props.onChange({h:r.props.hsl.h,s:r.props.hsl.s,l:r.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},s)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),r.props.onChange({h:i.h||r.props.hsl.h,s:Number(CB(i.s)?r.props.hsl.s:i.s),l:Number(CB(i.l)?r.props.hsl.l:i.l),source:"hsl"},s))},r.showHighlight=function(i){i.currentTarget.style.background="#eee"},r.hideHighlight=function(i){i.currentTarget.style.background="transparent"},t.hsl.a!==1&&t.view==="hex"?r.state={view:"rgb"}:r.state={view:t.view},r}return zge(e,[{key:"render",value:function(){var r=this,i=lt({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),s=void 0;return this.state.view==="hex"?s=k.createElement("div",{style:i.fields,className:"flexbox-fix"},k.createElement("div",{style:i.field},k.createElement(Tt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=k.createElement("div",{style:i.fields,className:"flexbox-fix"},k.createElement("div",{style:i.field},k.createElement(Tt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),k.createElement("div",{style:i.field},k.createElement(Tt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),k.createElement("div",{style:i.field},k.createElement(Tt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),k.createElement("div",{style:i.alpha},k.createElement(Tt,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=k.createElement("div",{style:i.fields,className:"flexbox-fix"},k.createElement("div",{style:i.field},k.createElement(Tt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),k.createElement("div",{style:i.field},k.createElement(Tt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),k.createElement("div",{style:i.field},k.createElement(Tt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),k.createElement("div",{style:i.alpha},k.createElement(Tt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),k.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,k.createElement("div",{style:i.toggle},k.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},k.createElement(Gge,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),e}(k.Component);qN.defaultProps={view:"hex"};var PB=function(){var e=lt({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return k.createElement("div",{style:e.picker})},jge=function(){var e=lt({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return k.createElement("div",{style:e.picker})},pb=function(e){var t=e.width,r=e.onChange,i=e.disableAlpha,s=e.rgb,o=e.hsl,a=e.hsv,l=e.hex,u=e.renderers,h=e.styles,d=h===void 0?{}:h,p=e.className,m=p===void 0?"":p,v=e.defaultView,x=lt(Hr({default:{picker:{width:t,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+s.r+", "+s.g+", "+s.b+", "+s.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},d),{disableAlpha:i});return k.createElement("div",{style:x.picker,className:"chrome-picker "+m},k.createElement("div",{style:x.saturation},k.createElement(iy,{style:x.Saturation,hsl:o,hsv:a,pointer:jge,onChange:r})),k.createElement("div",{style:x.body},k.createElement("div",{style:x.controls,className:"flexbox-fix"},k.createElement("div",{style:x.color},k.createElement("div",{style:x.swatch},k.createElement("div",{style:x.active}),k.createElement(Cf,{renderers:u}))),k.createElement("div",{style:x.toggles},k.createElement("div",{style:x.hue},k.createElement(Ef,{style:x.Hue,hsl:o,pointer:PB,onChange:r})),k.createElement("div",{style:x.alpha},k.createElement(eb,{style:x.Alpha,rgb:s,hsl:o,pointer:PB,renderers:u,onChange:r})))),k.createElement(qN,{rgb:s,hsl:o,hex:l,view:v,onChange:r,disableAlpha:i})))};pb.propTypes={width:Ee.oneOfType([Ee.string,Ee.number]),disableAlpha:Ee.bool,styles:Ee.object,defaultView:Ee.oneOf(["hex","rgb","hsl"])};pb.defaultProps={width:225,disableAlpha:!1,styles:{}};Vr(pb);var $ge=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=lt({default:{color:{background:t,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:lb(t),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:o,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return k.createElement(eu,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},k.createElement("div",{style:a.dot}))},Jge=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=lt({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:t},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),o=function(l,u){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},u):i({hex:l.hex,source:"hex"},u)};return k.createElement("div",{style:s.fields,className:"flexbox-fix"},k.createElement("div",{style:s.active}),k.createElement(Tt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),k.createElement(Tt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),k.createElement(Tt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),k.createElement(Tt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},mb=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.colors,s=e.hex,o=e.rgb,a=e.styles,l=a===void 0?{}:a,u=e.className,h=u===void 0?"":u,d=lt(Hr({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),p=function(v,x){v.hex?Fa(v.hex)&&t({hex:v.hex,source:"hex"},x):t(v,x)};return k.createElement(Tp,{style:d.Compact,styles:l},k.createElement("div",{style:d.compact,className:"compact-picker "+h},k.createElement("div",null,tu(i,function(m){return k.createElement($ge,{key:m,color:m,active:m.toLowerCase()===s,onClick:p,onSwatchHover:r})}),k.createElement("div",{style:d.clear})),k.createElement(Jge,{hex:s,rgb:o,onChange:p})))};mb.propTypes={colors:Ee.arrayOf(Ee.string),styles:Ee.object};mb.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};Vr(mb);var Xge=function(e){var t=e.hover,r=e.color,i=e.onClick,s=e.onSwatchHover,o={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},a=lt({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return k.createElement("div",{style:a.swatch},k.createElement(eu,{color:r,onClick:i,onHover:s,focusStyle:o}))};const Kge=ZM(Xge);var gb=function(e){var t=e.width,r=e.colors,i=e.onChange,s=e.onSwatchHover,o=e.triangle,a=e.styles,l=a===void 0?{}:a,u=e.className,h=u===void 0?"":u,d=lt(Hr({default:{card:{width:t,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},l),{"hide-triangle":o==="hide","top-left-triangle":o==="top-left","top-right-triangle":o==="top-right","bottom-left-triangle":o==="bottom-left","bottom-right-triangle":o==="bottom-right"}),p=function(v,x){return i({hex:v,source:"hex"},x)};return k.createElement("div",{style:d.card,className:"github-picker "+h},k.createElement("div",{style:d.triangleShadow}),k.createElement("div",{style:d.triangle}),tu(r,function(m){return k.createElement(Kge,{color:m,key:m,onClick:p,onSwatchHover:s})}))};gb.propTypes={width:Ee.oneOfType([Ee.string,Ee.number]),colors:Ee.arrayOf(Ee.string),triangle:Ee.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Ee.object};gb.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};Vr(gb);var Yge=function(e){var t=e.direction,r=lt({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:t==="vertical"});return k.createElement("div",{style:r.picker})},Qge=Object.assign||function(n){for(var e=1;e.5});return k.createElement("div",{style:r.picker})},t0e=function(){var e=lt({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return k.createElement("div",{style:e.pointer},k.createElement("div",{style:e.left},k.createElement("div",{style:e.leftInside})),k.createElement("div",{style:e.right},k.createElement("div",{style:e.rightInside})))},RB=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=lt({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:s});return k.createElement("div",{style:o.button,onClick:t},r||i)},n0e=function(e){var t=e.rgb,r=e.currentColor,i=lt({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+t.r+","+t.g+", "+t.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:r,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return k.createElement("div",null,k.createElement("div",{style:i.label},"new"),k.createElement("div",{style:i.swatches},k.createElement("div",{style:i.new}),k.createElement("div",{style:i.current})),k.createElement("div",{style:i.label},"current"))},r0e=function(){function n(e,t){for(var r=0;r100&&(h.a=100),h.a/=100,t({h:i.h,s:i.s,l:i.l,a:h.a,source:"rgb"},d))};return k.createElement("div",{style:a.fields,className:"flexbox-fix"},k.createElement("div",{style:a.double},k.createElement(Tt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),k.createElement("div",{style:a.single},k.createElement(Tt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),k.createElement("div",{style:a.single},k.createElement(Tt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),k.createElement("div",{style:a.single},k.createElement(Tt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),k.createElement("div",{style:a.alpha},k.createElement(Tt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},l0e=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Hg=24,g0e=eU.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Hg:r,s=n.height,o=s===void 0?Hg:s,a=n.style,l=a===void 0?{}:a,u=m0e(n,["fill","width","height","style"]);return LB.default.createElement("svg",BB({viewBox:"0 0 "+Hg+" "+Hg,style:BB({fill:t,width:i,height:o},l)},u),LB.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},v0e=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.first,a=e.last,l=e.active,u=lt({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:lb(t),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:o,last:a,active:l,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return k.createElement(eu,{color:t,style:u.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},k.createElement("div",{style:u.check},k.createElement(g0e,null)))},y0e=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=lt({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return k.createElement("div",{style:o.group},tu(i,function(a,l){return k.createElement(v0e,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},Sb=function(e){var t=e.width,r=e.height,i=e.onChange,s=e.onSwatchHover,o=e.colors,a=e.hex,l=e.styles,u=l===void 0?{}:l,h=e.className,d=h===void 0?"":h,p=lt(Hr({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},u)),m=function(x,_){return i({hex:x,source:"hex"},_)};return k.createElement("div",{style:p.picker,className:"swatches-picker "+d},k.createElement(Tp,null,k.createElement("div",{style:p.overflow},k.createElement("div",{style:p.body},tu(o,function(v){return k.createElement(y0e,{key:v.toString(),group:v,active:a,onClick:m,onSwatchHover:s})}),k.createElement("div",{style:p.clear})))))};Sb.propTypes={width:Ee.oneOfType([Ee.string,Ee.number]),height:Ee.oneOfType([Ee.string,Ee.number]),colors:Ee.arrayOf(Ee.arrayOf(Ee.string)),styles:Ee.object};Sb.defaultProps={width:320,height:240,colors:[[Wu[900],Wu[700],Wu[500],Wu[300],Wu[100]],[ju[900],ju[700],ju[500],ju[300],ju[100]],[$u[900],$u[700],$u[500],$u[300],$u[100]],[Ju[900],Ju[700],Ju[500],Ju[300],Ju[100]],[Xu[900],Xu[700],Xu[500],Xu[300],Xu[100]],[Ku[900],Ku[700],Ku[500],Ku[300],Ku[100]],[Yu[900],Yu[700],Yu[500],Yu[300],Yu[100]],[Qu[900],Qu[700],Qu[500],Qu[300],Qu[100]],[qu[900],qu[700],qu[500],qu[300],qu[100]],["#194D33",Nh[700],Nh[500],Nh[300],Nh[100]],[Zu[900],Zu[700],Zu[500],Zu[300],Zu[100]],[ec[900],ec[700],ec[500],ec[300],ec[100]],[tc[900],tc[700],tc[500],tc[300],tc[100]],[nc[900],nc[700],nc[500],nc[300],nc[100]],[rc[900],rc[700],rc[500],rc[300],rc[100]],[ic[900],ic[700],ic[500],ic[300],ic[100]],[sc[900],sc[700],sc[500],sc[300],sc[100]],[oc[900],oc[700],oc[500],oc[300],oc[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Vr(Sb);var wb=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.hex,s=e.colors,o=e.width,a=e.triangle,l=e.styles,u=l===void 0?{}:l,h=e.className,d=h===void 0?"":h,p=lt(Hr({default:{card:{width:o,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},u),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right"}),m=function(x,_){Fa(x)&&t({hex:x,source:"hex"},_)};return k.createElement("div",{style:p.card,className:"twitter-picker "+d},k.createElement("div",{style:p.triangleShadow}),k.createElement("div",{style:p.triangle}),k.createElement("div",{style:p.body},tu(s,function(v,x){return k.createElement(eu,{key:x,color:v,hex:v,style:p.swatch,onClick:m,onHover:r,focusStyle:{boxShadow:"0 0 4px "+v}})}),k.createElement("div",{style:p.hash},"#"),k.createElement(Tt,{label:null,style:{input:p.input},value:i.replace("#",""),onChange:m}),k.createElement("div",{style:p.clear})))};wb.propTypes={width:Ee.oneOfType([Ee.string,Ee.number]),triangle:Ee.oneOf(["hide","top-left","top-right"]),colors:Ee.arrayOf(Ee.string),styles:Ee.object};wb.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Vr(wb);var Ab=function(e){var t=lt({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return k.createElement("div",{style:t.picker})};Ab.propTypes={hsl:Ee.shape({h:Ee.number,s:Ee.number,l:Ee.number,a:Ee.number})};Ab.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var Mb=function(e){var t=lt({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return k.createElement("div",{style:t.picker})};Mb.propTypes={hsl:Ee.shape({h:Ee.number,s:Ee.number,l:Ee.number,a:Ee.number})};Mb.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var x0e=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(m,v){if(m.hex)Fa(m.hex)&&t({hex:m.hex,source:"hex"},v);else if(m.rgb){var x=m.rgb.split(",");Y1(m.rgb,"rgb")&&t({r:x[0],g:x[1],b:x[2],a:1,source:"rgb"},v)}else if(m.hsv){var _=m.hsv.split(",");Y1(m.hsv,"hsv")&&(_[2]=_[2].replace("%",""),_[1]=_[1].replace("%",""),_[0]=_[0].replace("°",""),_[1]==1?_[1]=.01:_[2]==1&&(_[2]=.01),t({h:Number(_[0]),s:Number(_[1]),v:Number(_[2]),source:"hsv"},v))}else if(m.hsl){var g=m.hsl.split(",");Y1(m.hsl,"hsl")&&(g[2]=g[2].replace("%",""),g[1]=g[1].replace("%",""),g[0]=g[0].replace("°",""),d[1]==1?d[1]=.01:d[2]==1&&(d[2]=.01),t({h:Number(g[0]),s:Number(g[1]),v:Number(g[2]),source:"hsl"},v))}},l=lt({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),u=r.r+", "+r.g+", "+r.b,h=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",d=Math.round(o.h)+"°, "+Math.round(o.s*100)+"%, "+Math.round(o.v*100)+"%";return k.createElement("div",{style:l.wrap,className:"flexbox-fix"},k.createElement("div",{style:l.fields},k.createElement("div",{style:l.double},k.createElement(Tt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),k.createElement("div",{style:l.column},k.createElement("div",{style:l.single},k.createElement(Tt,{style:{input:l.input2,label:l.label2},label:"rgb",value:u,onChange:a})),k.createElement("div",{style:l.single},k.createElement(Tt,{style:{input:l.input2,label:l.label2},label:"hsv",value:d,onChange:a})),k.createElement("div",{style:l.single},k.createElement(Tt,{style:{input:l.input2,label:l.label2},label:"hsl",value:h,onChange:a})))))},bb=function(e){var t=e.width,r=e.onChange,i=e.rgb,s=e.hsl,o=e.hsv,a=e.hex,l=e.header,u=e.styles,h=u===void 0?{}:u,d=e.className,p=d===void 0?"":d,m=lt(Hr({default:{picker:{width:t,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},h));return k.createElement("div",{style:m.picker,className:"google-picker "+p},k.createElement("div",{style:m.head},l),k.createElement("div",{style:m.swatch}),k.createElement("div",{style:m.saturation},k.createElement(iy,{hsl:s,hsv:o,pointer:Ab,onChange:r})),k.createElement("div",{style:m.body},k.createElement("div",{style:m.controls,className:"flexbox-fix"},k.createElement("div",{style:m.hue},k.createElement(Ef,{style:m.Hue,hsl:s,radius:"4px",pointer:Mb,onChange:r}))),k.createElement(x0e,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};bb.propTypes={width:Ee.oneOfType([Ee.string,Ee.number]),styles:Ee.object,header:Ee.string};bb.defaultProps={width:652,styles:{},header:"Color picker"};Vr(bb);const _0e=()=>{const n=Xl(wr);return it("div",{className:"absolute left-full ml-3",children:it(c0e,{color:n.color,disableAlpha:!0,onChange:e=>wr.color=e.hex})})},S0e=({file:n,setFile:e,readFile:t})=>Zn("div",{className:"filepicker-container",children:[Zn("div",{className:"flex-1 flex flex-col",children:[it("input",{id:"file-upload",type:"file",accept:"image/*",onChange:r=>e(r.target.files[0])}),it("label",{htmlFor:"file-upload",className:"filepicker-label",children:"Upload File"}),it("p",{className:"mt-2 text-gray-500 text-xs truncate",children:n===""?"No file selected":n.name})]}),Zn("div",{className:"mt-4 flex flex-wrap gap-3",children:[it(Tl,{type:"outline",title:"Logo",handleClick:()=>t("logo"),customStyles:"text-xs"}),it(Tl,{type:"filled",title:"Full",handleClick:()=>t("full"),customStyles:"text-xs"})]})]}),IB=({tab:n,isFilterTab:e,isActiveTab:t,handleClick:r})=>{const i=Xl(wr),s=e&&t?{backgroundColor:i.color,opacity:.5}:{backgroundColor:"transparent",opacity:1};return it("div",{className:`tab-btn ${e?"rounded-full glassmorphism":"rounded-4"}`,onClick:r,style:s,children:it("img",{src:n.icon,alt:n.name,className:`${e?"w-2/3 h-2/3":"w-11/12 h-11/12 object-contain"}`})},n.name)},w0e=()=>{const n=Xl(wr),[e,t]=z.useState(""),[r,i]=z.useState(""),[s,o]=z.useState(!1),[a,l]=z.useState(""),[u,h]=z.useState({logoShirt:!0,stylishShirt:!1}),d=()=>{switch(a){case"colorpicker":return it(_0e,{});case"filepicker":return it(S0e,{file:e,setFile:t,readFile:x});case"aipicker":return it(Bue,{prompt:r,setPrompt:i,generatingImg:s,handleSubmit:p});default:return null}},p=async _=>{if(!r)return alert("Please enter a prompt");try{o(!0);const w=await(await fetch("http://localhost:8080/api/v1/dalle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:r})})).json();m(_,`data:image/png;base64,${w.photo}`)}catch(g){alert(g)}finally{o(!1),l("")}},m=(_,g)=>{const w=Cue[_];wr[w.stateProperty]=g,u[w.filterTab]||v(w.filterTab)},v=_=>{switch(_){case"logoShirt":wr.isLogoTexture=!u[_];break;case"stylishShirt":wr.isFullTexture=!u[_];break;default:wr.isLogoTexture=!0,wr.isFullTexture=!1;break}h(g=>({...g,[_]:!g[_]}))},x=_=>{wue(e).then(g=>{m(_,g),l("")})};return it(_N,{children:!n.intro&&Zn(HB,{children:[it(na.div,{className:"absolute top-0 left-0 z-10",...Y0("left"),children:it("div",{className:"flex items-center min-h-screen",children:Zn("div",{className:"editortabs-container tabs",children:[Mue.map(_=>it(IB,{tab:_,handleClick:()=>l(_.name)},_.name)),d()]})})},"custom"),it(na.div,{className:"absolute z-10 top-5 right-5",...Eue,children:it(Tl,{type:"filled",title:"Go Back",handleClick:()=>wr.intro=!0,customStyles:"w-fit px-4 py-2.5 font-bold text-sm"})}),it(na.div,{className:"filtertabs-container",...Y0("up"),children:bue.map(_=>it(IB,{tab:_,isFilterTab:!0,isActiveTab:u[_.name],handleClick:()=>v(_.name)},_.name))})]})})},A0e=()=>{const n=Xl(wr);return it(_N,{children:n.intro&&Zn(na.section,{className:"home",...Y0("left"),children:[it(na.header,{...Y0("down"),children:it("img",{src:"./threejs.png",alt:"logo",className:"w-8 h-8 object-contain"})}),Zn(na.div,{className:"home-content",...Rue,children:[it(na.div,{...Tue,children:Zn("h1",{className:"head-text",children:["LET'S ",it("br",{className:"xl:block hidden"}),"CUSTOM IT."]})}),Zn(na.div,{...Pue,className:"flex flex-col gap-5",children:[Zn("p",{className:"max-w-md font-normal text-gray-600 text-base",children:["Create your unique and exclusive shirt with our brand-new 3D customization tool. ",it("strong",{children:"Unleash your imagination"})," "," and define your own style."]}),it(Tl,{type:"filled",title:"Customize It",handleClick:()=>wr.intro=!1,customStyles:"w-fit px-4 py-2.5 font-bold text-sm"})]})]})]})})};function M0e(){return Zn("main",{className:"app transition-all ease-in",children:[it(A0e,{}),it(nse,{}),it(w0e,{})]})}q1.createRoot(document.getElementById("root")).render(it(k.StrictMode,{children:it(M0e,{})}))});export default b0e();