PageSourceSearch

https://santas-lost.netlify.app/assets/index-CCbBKTVe.js

js santas-lost.netlify.app collected 2026-10-03 11:22:09 UTC 904,726 bytes, 4,185 lines download raw bytes

vendor: 19,421 bytes, lines 1-34
1(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 a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(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=n(i);fetch(i.href,s)}})();var jg={exports:{}},Gc={},Hg={exports:{}},qe={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var Ho=Symbol.for("react.element"),Ry=Symbol.for("react.portal"),Cy=Symbol.for("react.fragment"),Py=Symbol.for("react.strict_mode"),Ny=Symbol.for("react.profiler"),Ly=Symbol.for("react.provider"),Iy=Symbol.for("react.context"),Dy=Symbol.for("react.forward_ref"),Uy=Symbol.for("react.suspense"),ky=Symbol.for("react.memo"),Oy=Symbol.for("react.lazy"),nm=Symbol.iterator;function Fy(t){return t===null||typeof t!="object"?null:(t=nm&&t[nm]||t["@@iterator"],typeof t=="function"?t:null)}var Gg={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Wg=Object.assign,$g={};function ba(t,e,n){this.props=t,this.context=e,this.refs=$g,this.updater=n||Gg}ba.prototype.isReactComponent={};ba.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};ba.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Xg(){}Xg.prototype=ba.prototype;function Rf(t,e,n){this.props=t,this.context=e,this.refs=$g,this.updater=n||Gg}var Cf=Rf.prototype=new Xg;Cf.constructor=Rf;Wg(Cf,ba.prototype);Cf.isPureReactComponent=!0;var rm=Array.isArray,qg=Object.prototype.hasOwnProperty,Pf={current:null},Kg={key:!0,ref:!0,__self:!0,__source:!0};function Yg(t,e,n){var r,i={},s=null,a=null;if(e!=null)for(r in e.ref!==void 0&&(a=e.ref),e.key!==void 0&&(s=""+e.key),e)qg.call(e,r)&&!Kg.hasOwnProperty(r)&&(i[r]=e[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var l=Array(o),c=0;c<o;c++)l[c]=arguments[c+2];i.children=l}if(t&&t.defaultProps)for(r in o=t.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return{$$typeof:Ho,type:t,key:s,ref:a,props:i,_owner:Pf.current}}function By(t,e){return{$$typeof:Ho,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function Nf(t){return typeof t=="object"&&t!==null&&t.$$typeof===Ho}function zy(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var im=/\/+/g;function xu(t,e){return typeof t=="object"&&t!==null&&t.key!=null?zy(""+t.key):e.toString(36)}function ql(t,e,n,r,i){var s=typeof t;(s==="undefined"||s==="boolean")&&(t=null);var a=!1;if(t===null)a=!0;else switch(s){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case Ho:case Ry:a=!0}}if(a)return a=t,i=i(a),t=r===""?"."+xu(a,0):r,rm(i)?(n="",t!=null&&(n=t.replace(im,"$&/")+"/"),ql(i,e,n,"",function(c){return c})):i!=null&&(Nf(i)&&(i=By(i,n+(!i.key||a&&a.key===i.key?"":(""+i.key).replace(im,"$&/")+"/")+t)),e.push(i)),1;if(a=0,r=r===""?".":r+":",rm(t))for(var o=0;o<t.length;o++){s=t[o];var l=r+xu(s,o);a+=ql(s,e,n,l,i)}else if(l=Fy(t),typeof l=="function")for(t=l.call(t),o=0;!(s=t.next()).done;)s=s.value,l=r+xu(s,o++),a+=ql(s,e,n,l,i);else if(s==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return a}function sl(t,e,n){if(t==null)return t;var r=[],i=0;return ql(t,r,"","",function(s){return e.call(n,s,i++)}),r}function Vy(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var dn={current:null},Kl={transition:null},jy={ReactCurrentDispatcher:dn,ReactCurrentBatchConfig:Kl,ReactCurrentOwner:Pf};function Jg(){throw Error("act(...) is not supported in production builds of React.")}qe.Children={map:sl,forEach:function(t,e,n){sl(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return sl(t,function(){e++}),e},toArray:function(t){return sl(t,function(e){return e})||[]},only:function(t){if(!Nf(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};qe.Component=ba;qe.Fragment=Cy;qe.Profiler=Ny;qe.PureComponent=Rf;qe.StrictMode=Py;qe.Suspense=Uy;qe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=jy;qe.act=Jg;qe.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=Wg({},t.props),i=t.key,s=t.ref,a=t._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,a=Pf.current),e.key!==void 0&&(i=""+e.key),t.type&&t.type.defaultProps)var o=t.type.defaultProps;for(l in e)qg.call(e,l)&&!Kg.hasOwnProperty(l)&&(r[l]=e[l]===void 0&&o!==void 0?o[l]:e[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){o=Array(l);for(var c=0;c<l;c++)o[c]=arguments[c+2];r.children=o}return{$$typeof:Ho,type:t.type,key:i,ref:s,props:r,_owner:a}};qe.createContext=function(t){return t={$$typeof:Iy,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:Ly,_context:t},t.Consumer=t};qe.createElement=Yg;qe.createFactory=function(t){var e=Yg.bind(null,t);return e.type=t,e};qe.createRef=function(){return{current:null}};qe.forwardRef=function(t){return{$$typeof:Dy,render:t}};qe.isValidElement=Nf;qe.lazy=function(t){return{$$typeof:Oy,_payload:{_status:-1,_result:t},_init:Vy}};qe.memo=function(t,e){return{$$typeof:ky,type:t,compare:e===void 0?null:e}};qe.startTransition=function(t){var e=Kl.transition;Kl.transition={};try{t()}finally{Kl.transition=e}};qe.unstable_act=Jg;qe.useCallback=function(t,e){return dn.current.useCallback(t,e)};qe.useContext=function(t){return dn.current.useContext(t)};qe.useDebugValue=function(){};qe.useDeferredValue=function(t){return dn.current.useDeferredValue(t)};qe.useEffect=function(t,e){return dn.current.useEffect(t,e)};qe.useId=function(){return dn.current.useId()};qe.useImperativeHandle=function(t,e,n){return dn.current.useImperativeHandle(t,e,n)};qe.useInsertionEffect=function(t,e){return dn.current.useInsertionEffect(t,e)};qe.useLayoutEffect=function(t,e){return dn.current.useLayoutEffect(t,e)};qe.useMemo=function(t,e){return dn.current.useMemo(t,e)};qe.useReducer=function(t,e,n){return dn.current.useReducer(t,e,n)};qe.useRef=function(t){return dn.current.useRef(t)};qe.useState=function(t){return dn.current.useState(t)};qe.useSyncExternalStore=function(t,e,n){return dn.current.useSyncExternalStore(t,e,n)};qe.useTransition=function(){return dn.current.useTransition()};qe.version="18.3.1";Hg.exports=qe;var k=Hg.exports;/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var Hy=k,Gy=Symbol.for("react.element"),Wy=Symbol.for("react.fragment"),$y=Object.prototype.hasOwnProperty,Xy=Hy.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,qy={key:!0,ref:!0,__self:!0,__source:!0};function Zg(t,e,n){var r,i={},s=null,a=null;n!==void 0&&(s=""+n),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(a=e.ref);for(r in e)$y.call(e,r)&&!qy.hasOwnProperty(r)&&(i[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:Gy,type:t,key:s,ref:a,props:i,_owner:Xy.current}}Gc.Fragment=Wy;Gc.jsx=Zg;Gc.jsxs=Zg;jg.exports=Gc;var y=jg.exports,Qg={exports:{}},Un={},ex={exports:{}},tx={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(t){function e(D,q){var Y=D.length;D.push(q);e:for(;0<Y;){var de=Y-1>>>1,Ee=D[de];if(0<i(Ee,q))D[de]=q,D[Y]=Ee,Y=de;else break e}}function n(D){return D.length===0?null:D[0]}function r(D){if(D.length===0)return null;var q=D[0],Y=D.pop();if(Y!==q){D[0]=Y;e:for(var de=0,Ee=D.length,se=Ee>>>1;de<se;){var ae=2*(de+1)-1,ye=D[ae],H=ae+1,J=D[H];if(0>i(ye,Y))H<Ee&&0>i(J,ye)?(D[de]=J,D[H]=Y,de=H):(D[de]=ye,D[ae]=Y,de=ae);else if(H<Ee&&0>i(J,Y))D[de]=J,D[H]=Y,de=H;else break e}}return q}function i(D,q){var Y=D.sortIndex-q.sortIndex;return Y!==0?Y:D.id-q.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var l=[],c=[],u=1,d=null,f=3,p=!1,g=!1,_=!1,m=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(D){for(var q=n(c);q!==null;){if(q.callback===null)r(c);else if(q.startTime<=D)r(c),q.sortIndex=q.expirationTime,e(l,q);else break;q=n(c)}}function w(D){if(_=!1,x(D),!g)if(n(l)!==null)g=!0,V(A);else{var q=n(c);q!==null&&Q(w,q.startTime-D)}}function A(D,q){g=!1,_&&(_=!1,h(P),P=-1),p=!0;var Y=f;try{for(x(q),d=n(l);d!==null&&(!(d.expirationTime>q)||D&&!N());){var de=d.callback;if(typeof de=="function"){d.callback=null,f=d.priorityLevel;var Ee=de(d.expirationTime<=q);q=t.unstable_now(),typeof Ee=="function"?d.callback=Ee:d===n(l)&&r(l),x(q)}else r(l);d=n(l)}if(d!==null)var se=!0;else{var ae=n(c);ae!==null&&Q(w,ae.startTime-q),se=!1}return se}finally{d=null,f=Y,p=!1}}var E=!1,R=null,P=-1,M=5,b=-1;function N(){return!(t.unstable_now()-b<M)}function U(){if(R!==null){var D=t.unstable_now();b=D;var q=!0;try{q=R(!0,D)}finally{q?B():(E=!1,R=null)}}else E=!1}var B;if(typeof v=="function")B=function(){v(U)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,W=X.port2;X.port1.onmessage=U,B=function(){W.postMessage(null)}}else B=function(){m(U,0)};function V(D){R=D,E||(E=!0,B())}function Q(D,q){P=m(function(){D(t.unstable_now())},q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(D){D.callback=null},t.unstable_continueExecution=function(){g||p||(g=!0,V(A))},t.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<D?Math.floor(1e3/D):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return n(l)},t.unstable_next=function(D){switch(f){case 1:case 2:case 3:var q=3;break;default:q=f}var Y=f;f=q;try{return D()}finally{f=Y}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(D,q){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var Y=f;f=D;try{return q()}finally{f=Y}},t.unstable_scheduleCallback=function(D,q,Y){var de=t.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?de+Y:de):Y=de,D){case 1:var Ee=-1;break;case 2:Ee=250;break;case 5:Ee=1073741823;break;case 4:Ee=1e4;break;default:Ee=5e3}return Ee=Y+Ee,D={id:u++,callback:q,priorityLevel:D,startTime:Y,expirationTime:Ee,sortIndex:-1},Y>de?(D.sortIndex=Y,e(c,D),n(l)===null&&D===n(c)&&(_?(h(P),P=-1):_=!0,Q(w,Y-de))):(D.sortIndex=Ee,e(l,D),g||p||(g=!0,V(A))),D},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(D){var q=f;return function(){var Y=f;f=q;try{return D.apply(this,arguments)}finally{f=Y}}}})(tx);ex.exports=tx;var Ky=ex.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var Yy=k,Dn=Ky;function re(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var nx=new Set,po={};function ms(t,e){da(t,e),da(t+"Capture",e)}function da(t,e){for(po[t]=e,t=0;t<e.length;t++)nx.add(e[t])}var $r=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Nd=Object.prototype.hasOwnProperty,Jy=/^[: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]*$/,sm={},am={};function Zy(t){return Nd.call(am,t)?!0:Nd.call(sm,t)?!1:Jy.test(t)?am[t]=!0:(sm[t]=!0,!1)}function Qy(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function ew(t,e,n,r){if(e===null||typeof e>"u"||Qy(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.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 hn(t,e,n,r,i,s,a){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=a}var Jt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Jt[t]=new hn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Jt[e]=new hn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Jt[t]=new hn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Jt[t]=new hn(t,2,!1,t,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(t){Jt[t]=new hn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Jt[t]=new hn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Jt[t]=new hn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Jt[t]=new hn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Jt[t]=new hn(t,5,!1,t.toLowerCase(),null,!1,!1)});var Lf=/[\-:]([a-z])/g;function If(t){return t[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(t){var e=t.replace(Lf,If);Jt[e]=new hn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Lf,If);Jt[e]=new hn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Lf,If);Jt[e]=new hn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Jt[t]=new hn(t,1,!1,t.toLowerCase(),null,!1,!1)});Jt.xlinkHref=new hn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Jt[t]=new hn(t,1,!1,t.toLowerCase(),null,!0,!0)});function Df(t,e,n,r){var i=Jt.hasOwnProperty(e)?Jt[e]:null;(i!==null?i.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(ew(e,n,i,r)&&(n=null),r||i===null?Zy(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=n===null?i.type===3?!1:"":n:(e=i.attributeName,r=i.attributeNamespace,n===null?t.removeAttribute(e):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var Zr=Yy.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,al=Symbol.for("react.element"),Hs=Symbol.for("react.portal"),Gs=Symbol.for("react.fragment"),Uf=Symbol.for("react.strict_mode"),Ld=Symbol.for("react.profiler"),rx=Symbol.for("react.provider"),ix=Symbol.for("react.context"),kf=Symbol.for("react.forward_ref"),Id=Symbol.for("react.suspense"),Dd=Symbol.for("react.suspense_list"),Of=Symbol.for("react.memo"),li=Symbol.for("react.lazy"),sx=Symbol.for("react.offscreen"),om=Symbol.iterator;function Ia(t){return t===null||typeof t!="object"?null:(t=om&&t[om]||t["@@iterator"],typeof t=="function"?t:null)}var Mt=Object.assign,vu;function qa(t){if(vu===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);vu=e&&e[1]||""}return`
34`+vu+t}var _u=!1;function yu(t,e){if(!t||_u)return"";_u=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(c){var r=c}Reflect.construct(t,[],e)}else{try{e.call()}catch(c){r=c}t.call(e.prototype)}else{try{throw Error()}catch(c){r=c}t()}}
vendor: 5,289 bytes, lines 34-37
34catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
35`),s=r.stack.split(`
36`),a=i.length-1,o=s.length-1;1<=a&&0<=o&&i[a]!==s[o];)o--;for(;1<=a&&0<=o;a--,o--)if(i[a]!==s[o]){if(a!==1||o!==1)do if(a--,o--,0>o||i[a]!==s[o]){var l=`
37`+i[a].replace(" at new "," at ");return t.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",t.displayName)),l}while(1<=a&&0<=o);break}}}finally{_u=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?qa(t):""}function tw(t){switch(t.tag){case 5:return qa(t.type);case 16:return qa("Lazy");case 13:return qa("Suspense");case 19:return qa("SuspenseList");case 0:case 2:case 15:return t=yu(t.type,!1),t;case 11:return t=yu(t.type.render,!1),t;case 1:return t=yu(t.type,!0),t;default:return""}}function Ud(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Gs:return"Fragment";case Hs:return"Portal";case Ld:return"Profiler";case Uf:return"StrictMode";case Id:return"Suspense";case Dd:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case ix:return(t.displayName||"Context")+".Consumer";case rx:return(t._context.displayName||"Context")+".Provider";case kf:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Of:return e=t.displayName||null,e!==null?e:Ud(t.type)||"Memo";case li:e=t._payload,t=t._init;try{return Ud(t(e))}catch{}}return null}function nw(t){var e=t.type;switch(t.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 t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Ud(e);case 8:return e===Uf?"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 Ri(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function ax(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function rw(t){var e=ax(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,s.call(this,a)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function ol(t){t._valueTracker||(t._valueTracker=rw(t))}function ox(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=ax(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function fc(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function kd(t,e){var n=e.checked;return Mt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function lm(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Ri(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function lx(t,e){e=e.checked,e!=null&&Df(t,"checked",e,!1)}function Od(t,e){lx(t,e);var n=Ri(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Fd(t,e.type,n):e.hasOwnProperty("defaultValue")&&Fd(t,e.type,Ri(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function cm(t,e,n){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=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Fd(t,e,n){(e!=="number"||fc(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Ka=Array.isArray;function na(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Ri(n),e=null,i=0;i<t.length;i++){if(t[i].value===n){t[i].selected=!0,r&&(t[i].defaultSelected=!0);return}e!==null||t[i].disabled||(e=t[i])}e!==null&&(e.selected=!0)}}function Bd(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(re(91)
vendor: 11,464 bytes, line 37
37);return Mt({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function um(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(re(92));if(Ka(n)){if(1<n.length)throw Error(re(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Ri(n)}}function cx(t,e){var n=Ri(e.value),r=Ri(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function dm(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function ux(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function zd(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?ux(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var ll,dx=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,i)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(ll=ll||document.createElement("div"),ll.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=ll.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function mo(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var to={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},iw=["Webkit","ms","Moz","O"];Object.keys(to).forEach(function(t){iw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),to[e]=to[t]})});function hx(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||to.hasOwnProperty(t)&&to[t]?(""+e).trim():e+"px"}function fx(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=hx(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var sw=Mt({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 Vd(t,e){if(e){if(sw[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(re(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(re(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(re(61))}if(e.style!=null&&typeof e.style!="object")throw Error(re(62))}}function jd(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 Hd=null;function Ff(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Gd=null,ra=null,ia=null;function hm(t){if(t=$o(t)){if(typeof Gd!="function")throw Error(re(280));var e=t.stateNode;e&&(e=Kc(e),Gd(t.stateNode,t.type,e))}}function px(t){ra?ia?ia.push(t):ia=[t]:ra=t}function mx(){if(ra){var t=ra,e=ia;if(ia=ra=null,hm(t),e)for(t=0;t<e.length;t++)hm(e[t])}}function gx(t,e){return t(e)}function xx(){}var wu=!1;function vx(t,e,n){if(wu)return t(e,n);wu=!0;try{return gx(t,e,n)}finally{wu=!1,(ra!==null||ia!==null)&&(xx(),mx())}}function go(t,e){var n=t.stateNode;if(n===null)return null;var r=Kc(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(re(231,e,typeof n));return n}var Wd=!1;if($r)try{var Da={};Object.defineProperty(Da,"passive",{get:function(){Wd=!0}}),window.addEventListener("test",Da,Da),window.removeEventListener("test",Da,Da)}catch{Wd=!1}function aw(t,e,n,r,i,s,a,o,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(u){this.onError(u)}}var no=!1,pc=null,mc=!1,$d=null,ow={onError:function(t){no=!0,pc=t}};function lw(t,e,n,r,i,s,a,o,l){no=!1,pc=null,aw.apply(ow,arguments)}function cw(t,e,n,r,i,s,a,o,l){if(lw.apply(this,arguments),no){if(no){var c=pc;no=!1,pc=null}else throw Error(re(198));mc||(mc=!0,$d=c)}}function gs(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function _x(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function fm(t){if(gs(t)!==t)throw Error(re(188))}function uw(t){var e=t.alternate;if(!e){if(e=gs(t),e===null)throw Error(re(188));return e!==t?null:t}for(var n=t,r=e;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return fm(i),t;if(s===r)return fm(i),e;s=s.sibling}throw Error(re(188))}if(n.return!==r.return)n=i,r=s;else{for(var a=!1,o=i.child;o;){if(o===n){a=!0,n=i,r=s;break}if(o===r){a=!0,r=i,n=s;break}o=o.sibling}if(!a){for(o=s.child;o;){if(o===n){a=!0,n=s,r=i;break}if(o===r){a=!0,r=s,n=i;break}o=o.sibling}if(!a)throw Error(re(189))}}if(n.alternate!==r)throw Error(re(190))}if(n.tag!==3)throw Error(re(188));return n.stateNode.current===n?t:e}function yx(t){return t=uw(t),t!==null?wx(t):null}function wx(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=wx(t);if(e!==null)return e;t=t.sibling}return null}var Sx=Dn.unstable_scheduleCallback,pm=Dn.unstable_cancelCallback,dw=Dn.unstable_shouldYield,hw=Dn.unstable_requestPaint,Lt=Dn.unstable_now,fw=Dn.unstable_getCurrentPriorityLevel,Bf=Dn.unstable_ImmediatePriority,bx=Dn.unstable_UserBlockingPriority,gc=Dn.unstable_NormalPriority,pw=Dn.unstable_LowPriority,Ex=Dn.unstable_IdlePriority,Wc=null,_r=null;function mw(t){if(_r&&typeof _r.onCommitFiberRoot=="function")try{_r.onCommitFiberRoot(Wc,t,void 0,(t.current.flags&128)===128)}catch{}}var cr=Math.clz32?Math.clz32:vw,gw=Math.log,xw=Math.LN2;function vw(t){return t>>>=0,t===0?32:31-(gw(t)/xw|0)|0}var cl=64,ul=4194304;function Ya(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function xc(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,a=n&268435455;if(a!==0){var o=a&~i;o!==0?r=Ya(o):(s&=a,s!==0&&(r=Ya(s)))}else a=n&~i,a!==0?r=Ya(a):s!==0&&(r=Ya(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|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-cr(e),i=1<<n,r|=t[n],e&=~i;return r}function _w(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 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 e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function yw(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var a=31-cr(s),o=1<<a,l=i[a];l===-1?(!(o&n)||o&r)&&(i[a]=_w(o,e)):l<=e&&(t.expiredLanes|=o),s&=~o}}function Xd(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Mx(){var t=cl;return cl<<=1,!(cl&4194240)&&(cl=64),t}function Su(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function Go(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-cr(e),t[e]=n}function ww(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var i=31-cr(n),s=1<<i;e[i]=0,r[i]=-1,t[i]=-1,n&=~s}}function zf(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-cr(n),i=1<<r;i&e|t[r]&e&&(t[r]|=e),n&=~i}}var it=0;function Tx(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var Ax,Vf,Rx,Cx,Px,qd=!1,dl=[],_i=null,yi=null,wi=null,xo=new Map,vo=new Map,hi=[],Sw="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function mm(t,e){switch(t){case"focusin":case"focusout":_i=null;break;case"dragenter":case"dragleave":yi=null;break;case"mouseover":case"mouseout":wi=null;break;case"pointerover":case"pointerout":xo.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":vo.delete(e.pointerId)}}function Ua(t,e,n,r,i,s){return t===null||t.nativeEvent!==s?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},e!==null&&(e=$o(e),e!==null&&Vf(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,i!==null&&e.indexOf(i)===-1&&e.push(i),t)}function bw(t,e,n,r,i){switch(e){case"focusin":return _i=Ua(_i,t,e,n,r,i),!0;case"dragenter":return yi=Ua(yi,t,e,n,r,i),!0;case"mouseover":return wi=Ua(wi,t,e,n,r,i),!0;case"pointerover":var s=i.pointerId;return xo.set(s,Ua(xo.get(s)||null,t,e,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,vo.set(s,Ua(vo.get(s)||null,t,e,n,r,i)),!0}return!1}function Nx(t){var e=ts(t.target);if(e!==null){var n=gs(e);if(n!==null){if(e=n.tag,e===13){if(e=_x(n),e!==null){t.blockedOn=e,Px(t.priority,function(){Rx(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Yl(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Kd(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);Hd=r,n.target.dispatchEvent(r),Hd=null}else return e=$o(n),e!==null&&Vf(e),t.blockedOn=n,!1;e.shift()}return!0}function gm(t,e,n){Yl(t)&&n.delete(e)}function Ew(){qd=!1,_i!==null&&Yl(_i)&&(_i=null),yi!==null&&Yl(yi)&&(yi=null),wi!==null&&Yl(wi)&&(wi=null),xo.forEac
vendor: 13,618 bytes, line 37
37h(gm),vo.forEach(gm)}function ka(t,e){t.blockedOn===e&&(t.blockedOn=null,qd||(qd=!0,Dn.unstable_scheduleCallback(Dn.unstable_NormalPriority,Ew)))}function _o(t){function e(i){return ka(i,t)}if(0<dl.length){ka(dl[0],t);for(var n=1;n<dl.length;n++){var r=dl[n];r.blockedOn===t&&(r.blockedOn=null)}}for(_i!==null&&ka(_i,t),yi!==null&&ka(yi,t),wi!==null&&ka(wi,t),xo.forEach(e),vo.forEach(e),n=0;n<hi.length;n++)r=hi[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<hi.length&&(n=hi[0],n.blockedOn===null);)Nx(n),n.blockedOn===null&&hi.shift()}var sa=Zr.ReactCurrentBatchConfig,vc=!0;function Mw(t,e,n,r){var i=it,s=sa.transition;sa.transition=null;try{it=1,jf(t,e,n,r)}finally{it=i,sa.transition=s}}function Tw(t,e,n,r){var i=it,s=sa.transition;sa.transition=null;try{it=4,jf(t,e,n,r)}finally{it=i,sa.transition=s}}function jf(t,e,n,r){if(vc){var i=Kd(t,e,n,r);if(i===null)Lu(t,e,r,_c,n),mm(t,r);else if(bw(i,t,e,n,r))r.stopPropagation();else if(mm(t,r),e&4&&-1<Sw.indexOf(t)){for(;i!==null;){var s=$o(i);if(s!==null&&Ax(s),s=Kd(t,e,n,r),s===null&&Lu(t,e,r,_c,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else Lu(t,e,r,null,n)}}var _c=null;function Kd(t,e,n,r){if(_c=null,t=Ff(r),t=ts(t),t!==null)if(e=gs(t),e===null)t=null;else if(n=e.tag,n===13){if(t=_x(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return _c=t,null}function Lx(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(fw()){case Bf:return 1;case bx:return 4;case gc:case pw:return 16;case Ex:return 536870912;default:return 16}default:return 16}}var gi=null,Hf=null,Jl=null;function Ix(){if(Jl)return Jl;var t,e=Hf,n=e.length,r,i="value"in gi?gi.value:gi.textContent,s=i.length;for(t=0;t<n&&e[t]===i[t];t++);var a=n-t;for(r=1;r<=a&&e[n-r]===i[s-r];r++);return Jl=i.slice(t,1<r?1-r:void 0)}function Zl(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function hl(){return!0}function xm(){return!1}function kn(t){function e(n,r,i,s,a){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=a,this.currentTarget=null;for(var o in t)t.hasOwnProperty(o)&&(n=t[o],this[o]=n?n(s):s[o]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?hl:xm,this.isPropagationStopped=xm,this}return Mt(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=hl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=hl)},persist:function(){},isPersistent:hl}),e}var Ea={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gf=kn(Ea),Wo=Mt({},Ea,{view:0,detail:0}),Aw=kn(Wo),bu,Eu,Oa,$c=Mt({},Wo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Wf,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Oa&&(Oa&&t.type==="mousemove"?(bu=t.screenX-Oa.screenX,Eu=t.screenY-Oa.screenY):Eu=bu=0,Oa=t),bu)},movementY:function(t){return"movementY"in t?t.movementY:Eu}}),vm=kn($c),Rw=Mt({},$c,{dataTransfer:0}),Cw=kn(Rw),Pw=Mt({},Wo,{relatedTarget:0}),Mu=kn(Pw),Nw=Mt({},Ea,{animationName:0,elapsedTime:0,pseudoElement:0}),Lw=kn(Nw),Iw=Mt({},Ea,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Dw=kn(Iw),Uw=Mt({},Ea,{data:0}),_m=kn(Uw),kw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ow={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Fw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Bw(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=Fw[t])?!!e[t]:!1}function Wf(){return Bw}var zw=Mt({},Wo,{key:function(t){if(t.key){var e=kw[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Zl(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Ow[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wf,charCode:function(t){return t.type==="keypress"?Zl(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Zl(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Vw=kn(zw),jw=Mt({},$c,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ym=kn(jw),Hw=Mt({},Wo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wf}),Gw=kn(Hw),Ww=Mt({},Ea,{propertyName:0,elapsedTime:0,pseudoElement:0}),$w=kn(Ww),Xw=Mt({},$c,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),qw=kn(Xw),Kw=[9,13,27,32],$f=$r&&"CompositionEvent"in window,ro=null;$r&&"documentMode"in document&&(ro=document.documentMode);var Yw=$r&&"TextEvent"in window&&!ro,Dx=$r&&(!$f||ro&&8<ro&&11>=ro),wm=" ",Sm=!1;function Ux(t,e){switch(t){case"keyup":return Kw.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function kx(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ws=!1;function Jw(t,e){switch(t){case"compositionend":return kx(e);case"keypress":return e.which!==32?null:(Sm=!0,wm);case"textInput":return t=e.data,t===wm&&Sm?null:t;default:return null}}function Zw(t,e){if(Ws)return t==="compositionend"||!$f&&Ux(t,e)?(t=Ix(),Jl=Hf=gi=null,Ws=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Dx&&e.locale!=="ko"?null:e.data;default:return null}}var Qw={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function bm(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Qw[t.type]:e==="textarea"}function Ox(t,e,n,r){px(r),e=yc(e,"onChange"),0<e.length&&(n=new Gf("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var io=null,yo=null;function eS(t){qx(t,0)}function Xc(t){var e=qs(t);if(ox(e))return t}function tS(t,e){if(t==="change")return e}var Fx=!1;if($r){var Tu;if($r){var Au="oninput"in document;if(!Au){var Em=document.createElement("div");Em.setAttribute("oninput","return;"),Au=typeof Em.oninput=="function"}Tu=Au}else Tu=!1;Fx=Tu&&(!document.documentMode||9<document.documentMode)}function Mm(){io&&(io.detachEvent("onpropertychange",Bx),yo=io=null)}function Bx(t){if(t.propertyName==="value"&&Xc(yo)){var e=[];Ox(e,yo,t,Ff(t)),vx(eS,e)}}function nS(t,e,n){t==="focusin"?(Mm(),io=e,yo=n,io.attachEvent("onpropertychange",Bx)):t==="focusout"&&Mm()}function rS(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Xc(yo)}function iS(t,e){if(t==="click")return Xc(e)}function sS(t,e){if(t==="input"||t==="change")return Xc(e)}function aS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var dr=typeof Object.is=="function"?Object.is:aS;function wo(t,e){if(dr(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Nd.call(e,i)||!dr(t[i],e[i]))return!1}return!0}function Tm(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Am(t,e){var n=Tm(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Tm(n)}}function zx(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?zx(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Vx(){for(var t=window,e=fc();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=fc(t.document)}return e}function Xf(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function oS(t){var e=Vx(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&zx(n.ownerDocument.documentElement,n)){if(r!==null&&Xf(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=Am(n,s);var a=Am(n,r);i&&a&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==a.node||t.focusOffset!==a.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(a.node,a.offset)):(e.setEnd(a.node,a.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var lS=$r&&"documentMode"in document&&11>=document.documentMode,$s=null,Yd=null,so=null,Jd=!1;function Rm(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Jd||$s==null||$s!==fc(r)||(r=$s,"selectionStart"in r&&Xf(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}),so&&wo(so,r)||(so=r,r=yc(Yd,"onSelect"),0<r.length&&(e=new Gf("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=$s)))}function fl(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Xs={animationend:fl("Animation","AnimationEnd"),animationiteration:fl("Animation","AnimationIteration"),animationstart:fl("Animation","AnimationStart"),transitionend:fl("Transition","TransitionEnd")},Ru={},jx={};$r&&(jx=document.createElement("div").style,"AnimationEvent"in window||(delete Xs.animationend.animation,delete Xs.animationiteration.animation,delete Xs.animationstart.animation),"TransitionEvent"in window||delete Xs.transitionend.transition);function qc(t){if(Ru[t])return Ru[t];if(!Xs[t])return t;var e=Xs[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in jx)return Ru[t]=e[n];return t}var Hx=qc("animationend"),Gx=qc("animationiteration"),Wx=qc("animationstart"),$x=qc("transitionend"),Xx=new Map,Cm="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Li(t,e){Xx.set(t,e),ms(e,[t])}for(var Cu=0;Cu<Cm.length;Cu++){var Pu=Cm[Cu],cS=Pu.toLowerCase(),uS=Pu[0].toUpperCase()+Pu.slice(1);
vendor: 5,251 bytes, line 37
37Li(cS,"on"+uS)}Li(Hx,"onAnimationEnd");Li(Gx,"onAnimationIteration");Li(Wx,"onAnimationStart");Li("dblclick","onDoubleClick");Li("focusin","onFocus");Li("focusout","onBlur");Li($x,"onTransitionEnd");da("onMouseEnter",["mouseout","mouseover"]);da("onMouseLeave",["mouseout","mouseover"]);da("onPointerEnter",["pointerout","pointerover"]);da("onPointerLeave",["pointerout","pointerover"]);ms("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ms("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ms("onBeforeInput",["compositionend","keypress","textInput","paste"]);ms("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ms("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ms("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ja="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),dS=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ja));function Pm(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,cw(r,e,void 0,t),t.currentTarget=null}function qx(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],i=r.event;r=r.listeners;e:{var s=void 0;if(e)for(var a=r.length-1;0<=a;a--){var o=r[a],l=o.instance,c=o.currentTarget;if(o=o.listener,l!==s&&i.isPropagationStopped())break e;Pm(i,o,c),s=l}else for(a=0;a<r.length;a++){if(o=r[a],l=o.instance,c=o.currentTarget,o=o.listener,l!==s&&i.isPropagationStopped())break e;Pm(i,o,c),s=l}}}if(mc)throw t=$d,mc=!1,$d=null,t}function pt(t,e){var n=e[nh];n===void 0&&(n=e[nh]=new Set);var r=t+"__bubble";n.has(r)||(Kx(e,t,2,!1),n.add(r))}function Nu(t,e,n){var r=0;e&&(r|=4),Kx(n,t,r,e)}var pl="_reactListening"+Math.random().toString(36).slice(2);function So(t){if(!t[pl]){t[pl]=!0,nx.forEach(function(n){n!=="selectionchange"&&(dS.has(n)||Nu(n,!1,t),Nu(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[pl]||(e[pl]=!0,Nu("selectionchange",!1,e))}}function Kx(t,e,n,r){switch(Lx(e)){case 1:var i=Mw;break;case 4:i=Tw;break;default:i=jf}n=i.bind(null,e,n,t),i=void 0,!Wd||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(i=!0),r?i!==void 0?t.addEventListener(e,n,{capture:!0,passive:i}):t.addEventListener(e,n,!0):i!==void 0?t.addEventListener(e,n,{passive:i}):t.addEventListener(e,n,!1)}function Lu(t,e,n,r,i){var s=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var o=r.stateNode.containerInfo;if(o===i||o.nodeType===8&&o.parentNode===i)break;if(a===4)for(a=r.return;a!==null;){var l=a.tag;if((l===3||l===4)&&(l=a.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;a=a.return}for(;o!==null;){if(a=ts(o),a===null)return;if(l=a.tag,l===5||l===6){r=s=a;continue e}o=o.parentNode}}r=r.return}vx(function(){var c=s,u=Ff(n),d=[];e:{var f=Xx.get(t);if(f!==void 0){var p=Gf,g=t;switch(t){case"keypress":if(Zl(n)===0)break e;case"keydown":case"keyup":p=Vw;break;case"focusin":g="focus",p=Mu;break;case"focusout":g="blur",p=Mu;break;case"beforeblur":case"afterblur":p=Mu;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":p=vm;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":p=Cw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":p=Gw;break;case Hx:case Gx:case Wx:p=Lw;break;case $x:p=$w;break;case"scroll":p=Aw;break;case"wheel":p=qw;break;case"copy":case"cut":case"paste":p=Dw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":p=ym}var _=(e&4)!==0,m=!_&&t==="scroll",h=_?f!==null?f+"Capture":null:f;_=[];for(var v=c,x;v!==null;){x=v;var w=x.stateNode;if(x.tag===5&&w!==null&&(x=w,h!==null&&(w=go(v,h),w!=null&&_.push(bo(v,w,x)))),m)break;v=v.return}0<_.length&&(f=new p(f,g,null,n,u),d.push({event:f,listeners:_}))}}if(!(e&7)){e:{if(f=t==="mouseover"||t==="pointerover",p=t==="mouseout"||t==="pointerout",f&&n!==Hd&&(g=n.relatedTarget||n.fromElement)&&(ts(g)||g[Xr]))break e;if((p||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,p?(g=n.relatedTarget||n.toElement,p=c,g=g?ts(g):null,g!==null&&(m=gs(g),g!==m||g.tag!==5&&g.tag!==6)&&(g=null)):(p=null,g=c),p!==g)){if(_=vm,w="onMouseLeave",h="onMouseEnter",v="mouse",(t==="pointerout"||t==="pointerover")&&(_=ym,w="onPointerLeave",h="onPointerEnter",v="pointer"),m=p==null?f:qs(p),x=g==null?f:qs(g),f=new _(w,v+"leave",p,n,u),f.target=m,f.relatedTarget=x,w=null,ts(u)===c&&(_=new _(h,v+"enter",g,n,u),_.target=x,_.relatedTarget=m,w=_),m=w,p&&g)t:{for(_=p,h=g,v=0,x=_;x;x=vs(x))v++;for(x=0,w=h;w;w=vs(w))x++;for(;0<v-x;)_=vs(_),v--;for(;0<x-v;)h=vs(h),x--;for(;v--;){if(_===h||h!==null&&_===h.alternate)break t;_=vs(_),h=vs(h)}_=null}else _=null;p!==null&&Nm(d,f,p,_,!1),g!==null&&m!==null&&Nm(d,m,g,_,!0)}}
vendor: 5,686 bytes, lines 37-38
37e:{if(f=c?qs(c):window,p=f.nodeName&&f.nodeName.toLowerCase(),p==="select"||p==="input"&&f.type==="file")var A=tS;else if(bm(f))if(Fx)A=sS;else{A=rS;var E=nS}else(p=f.nodeName)&&p.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(A=iS);if(A&&(A=A(t,c))){Ox(d,A,n,u);break e}E&&E(t,f,c),t==="focusout"&&(E=f._wrapperState)&&E.controlled&&f.type==="number"&&Fd(f,"number",f.value)}switch(E=c?qs(c):window,t){case"focusin":(bm(E)||E.contentEditable==="true")&&($s=E,Yd=c,so=null);break;case"focusout":so=Yd=$s=null;break;case"mousedown":Jd=!0;break;case"contextmenu":case"mouseup":case"dragend":Jd=!1,Rm(d,n,u);break;case"selectionchange":if(lS)break;case"keydown":case"keyup":Rm(d,n,u)}var R;if($f)e:{switch(t){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else Ws?Ux(t,n)&&(P="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(P="onCompositionStart");P&&(Dx&&n.locale!=="ko"&&(Ws||P!=="onCompositionStart"?P==="onCompositionEnd"&&Ws&&(R=Ix()):(gi=u,Hf="value"in gi?gi.value:gi.textContent,Ws=!0)),E=yc(c,P),0<E.length&&(P=new _m(P,t,null,n,u),d.push({event:P,listeners:E}),R?P.data=R:(R=kx(n),R!==null&&(P.data=R)))),(R=Yw?Jw(t,n):Zw(t,n))&&(c=yc(c,"onBeforeInput"),0<c.length&&(u=new _m("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=R))}qx(d,e)})}function bo(t,e,n){return{instance:t,listener:e,currentTarget:n}}function yc(t,e){for(var n=e+"Capture",r=[];t!==null;){var i=t,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=go(t,n),s!=null&&r.unshift(bo(t,s,i)),s=go(t,e),s!=null&&r.push(bo(t,s,i))),t=t.return}return r}function vs(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function Nm(t,e,n,r,i){for(var s=e._reactName,a=[];n!==null&&n!==r;){var o=n,l=o.alternate,c=o.stateNode;if(l!==null&&l===r)break;o.tag===5&&c!==null&&(o=c,i?(l=go(n,s),l!=null&&a.unshift(bo(n,l,o))):i||(l=go(n,s),l!=null&&a.push(bo(n,l,o)))),n=n.return}a.length!==0&&t.push({event:e,listeners:a})}var hS=/\r\n?/g,fS=/\u0000|\uFFFD/g;function Lm(t){return(typeof t=="string"?t:""+t).replace(hS,`
38`).replace(fS,"")}function ml(t,e,n){if(e=Lm(e),Lm(t)!==e&&n)throw Error(re(425))}function wc(){}var Zd=null,Qd=null;function eh(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var th=typeof setTimeout=="function"?setTimeout:void 0,pS=typeof clearTimeout=="function"?clearTimeout:void 0,Im=typeof Promise=="function"?Promise:void 0,mS=typeof queueMicrotask=="function"?queueMicrotask:typeof Im<"u"?function(t){return Im.resolve(null).then(t).catch(gS)}:th;function gS(t){setTimeout(function(){throw t})}function Iu(t,e){var n=e,r=0;do{var i=n.nextSibling;if(t.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){t.removeChild(i),_o(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);_o(e)}function Si(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function Dm(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Ma=Math.random().toString(36).slice(2),xr="__reactFiber$"+Ma,Eo="__reactProps$"+Ma,Xr="__reactContainer$"+Ma,nh="__reactEvents$"+Ma,xS="__reactListeners$"+Ma,vS="__reactHandles$"+Ma;function ts(t){var e=t[xr];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Xr]||n[xr]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Dm(t);t!==null;){if(n=t[xr])return n;t=Dm(t)}return e}t=n,n=t.parentNode}return null}function $o(t){return t=t[xr]||t[Xr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function qs(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(re(33))}function Kc(t){return t[Eo]||null}var rh=[],Ks=-1;function Ii(t){return{current:t}}function mt(t){0>Ks||(t.current=rh[Ks],rh[Ks]=null,Ks--)}function ht(t,e){Ks++,rh[Ks]=t.current,t.current=e}var Ci={},sn=Ii(Ci),vn=Ii(!1),ls=Ci;function ha(t,e){var n=t.type.contextTypes;if(!n)return Ci;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function _n(t){return t=t.childContextTypes,t!=null}function Sc(){mt(vn),mt(sn)}function Um(t,e,n){if(sn.current!==Ci)throw Error(re(168));ht(sn,e),ht(vn,n)}function Yx(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(re(108,nw(t)||"Unknown",i));return Mt({},n,r)}function bc(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Ci,ls=sn.current,ht(sn,t),ht(vn,vn.current),!0}function km(t,e,n){var r=t.stateNode;if(!r)throw Error(re(169));n?(t=Yx(t,e,ls),r.__reactInternalMemoizedMergedChildContext=t,mt(vn),mt(sn),ht(sn,t)):mt(vn),ht(vn,n)}var kr=null,Yc=!1,Du=!1;function Jx(t){kr===null?kr=[t]:kr.push(t)}function _S(t){Yc=!0,Jx(t)}function Di(){if(!Du&&kr!==null){Du=!0;var t=0,e=it;try{var n=kr;for(it=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}kr=null,Yc=!1}catch(i){throw kr!==null&&(kr=kr.slice(t+1)),Sx(Bf,Di),i}finally{it=e,Du=!1}}return null}var Ys=[],Js=0,Ec=null,Mc=0,zn=[],Vn=0,cs=null,Fr=1,Br="";function $i(t,e){Ys[Js++]=Mc,Ys[Js++]=Ec,Ec=t,Mc=e}
vendor: 24,752 bytes, lines 38-40
38function Zx(t,e,n){zn[Vn++]=Fr,zn[Vn++]=Br,zn[Vn++]=cs,cs=t;var r=Fr;t=Br;var i=32-cr(r)-1;r&=~(1<<i),n+=1;var s=32-cr(e)+i;if(30<s){var a=i-i%5;s=(r&(1<<a)-1).toString(32),r>>=a,i-=a,Fr=1<<32-cr(e)+i|n<<i|r,Br=s+t}else Fr=1<<s|n<<i|r,Br=t}function qf(t){t.return!==null&&($i(t,1),Zx(t,1,0))}function Kf(t){for(;t===Ec;)Ec=Ys[--Js],Ys[Js]=null,Mc=Ys[--Js],Ys[Js]=null;for(;t===cs;)cs=zn[--Vn],zn[Vn]=null,Br=zn[--Vn],zn[Vn]=null,Fr=zn[--Vn],zn[Vn]=null}var Nn=null,Pn=null,xt=!1,sr=null;function Qx(t,e){var n=Hn(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function Om(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,Nn=t,Pn=Si(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,Nn=t,Pn=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=cs!==null?{id:Fr,overflow:Br}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Hn(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,Nn=t,Pn=null,!0):!1;default:return!1}}function ih(t){return(t.mode&1)!==0&&(t.flags&128)===0}function sh(t){if(xt){var e=Pn;if(e){var n=e;if(!Om(t,e)){if(ih(t))throw Error(re(418));e=Si(n.nextSibling);var r=Nn;e&&Om(t,e)?Qx(r,n):(t.flags=t.flags&-4097|2,xt=!1,Nn=t)}}else{if(ih(t))throw Error(re(418));t.flags=t.flags&-4097|2,xt=!1,Nn=t}}}function Fm(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;Nn=t}function gl(t){if(t!==Nn)return!1;if(!xt)return Fm(t),xt=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!eh(t.type,t.memoizedProps)),e&&(e=Pn)){if(ih(t))throw ev(),Error(re(418));for(;e;)Qx(t,e),e=Si(e.nextSibling)}if(Fm(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(re(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Pn=Si(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Pn=null}}else Pn=Nn?Si(t.stateNode.nextSibling):null;return!0}function ev(){for(var t=Pn;t;)t=Si(t.nextSibling)}function fa(){Pn=Nn=null,xt=!1}function Yf(t){sr===null?sr=[t]:sr.push(t)}var yS=Zr.ReactCurrentBatchConfig;function Fa(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(re(309));var r=n.stateNode}if(!r)throw Error(re(147,t));var i=r,s=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(a){var o=i.refs;a===null?delete o[s]:o[s]=a},e._stringRef=s,e)}if(typeof t!="string")throw Error(re(284));if(!n._owner)throw Error(re(290,t))}return t}function xl(t,e){throw t=Object.prototype.toString.call(e),Error(re(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Bm(t){var e=t._init;return e(t._payload)}function tv(t){function e(h,v){if(t){var x=h.deletions;x===null?(h.deletions=[v],h.flags|=16):x.push(v)}}function n(h,v){if(!t)return null;for(;v!==null;)e(h,v),v=v.sibling;return null}function r(h,v){for(h=new Map;v!==null;)v.key!==null?h.set(v.key,v):h.set(v.index,v),v=v.sibling;return h}function i(h,v){return h=Ti(h,v),h.index=0,h.sibling=null,h}function s(h,v,x){return h.index=x,t?(x=h.alternate,x!==null?(x=x.index,x<v?(h.flags|=2,v):x):(h.flags|=2,v)):(h.flags|=1048576,v)}function a(h){return t&&h.alternate===null&&(h.flags|=2),h}function o(h,v,x,w){return v===null||v.tag!==6?(v=Vu(x,h.mode,w),v.return=h,v):(v=i(v,x),v.return=h,v)}function l(h,v,x,w){var A=x.type;return A===Gs?u(h,v,x.props.children,w,x.key):v!==null&&(v.elementType===A||typeof A=="object"&&A!==null&&A.$$typeof===li&&Bm(A)===v.type)?(w=i(v,x.props),w.ref=Fa(h,v,x),w.return=h,w):(w=sc(x.type,x.key,x.props,null,h.mode,w),w.ref=Fa(h,v,x),w.return=h,w)}function c(h,v,x,w){return v===null||v.tag!==4||v.stateNode.containerInfo!==x.containerInfo||v.stateNode.implementation!==x.implementation?(v=ju(x,h.mode,w),v.return=h,v):(v=i(v,x.children||[]),v.return=h,v)}function u(h,v,x,w,A){return v===null||v.tag!==7?(v=os(x,h.mode,w,A),v.return=h,v):(v=i(v,x),v.return=h,v)}function d(h,v,x){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Vu(""+v,h.mode,x),v.return=h,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case al:return x=sc(v.type,v.key,v.props,null,h.mode,x),x.ref=Fa(h,null,v),x.return=h,x;case Hs:return v=ju(v,h.mode,x),v.return=h,v;case li:var w=v._init;return d(h,w(v._payload),x)}if(Ka(v)||Ia(v))return v=os(v,h.mode,x,null),v.return=h,v;xl(h,v)}return null}function f(h,v,x,w){var A=v!==null?v.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return A!==null?null:o(h,v,""+x,w);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case al:return x.key===A?l(h,v,x,w):null;case Hs:return x.key===A?c(h,v,x,w):null;case li:return A=x._init,f(h,v,A(x._payload),w)}if(Ka(x)||Ia(x))return A!==null?null:u(h,v,x,w,null);xl(h,x)}return null}function p(h,v,x,w,A){if(typeof w=="string"&&w!==""||typeof w=="number")return h=h.get(x)||null,o(v,h,""+w,A);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case al:return h=h.get(w.key===null?x:w.key)||null,l(v,h,w,A);case Hs:return h=h.get(w.key===null?x:w.key)||null,c(v,h,w,A);case li:var E=w._init;return p(h,v,x,E(w._payload),A)}if(Ka(w)||Ia(w))return h=h.get(x)||null,u(v,h,w,A,null);xl(v,w)}return null}function g(h,v,x,w){for(var A=null,E=null,R=v,P=v=0,M=null;R!==null&&P<x.length;P++){R.index>P?(M=R,R=null):M=R.sibling;var b=f(h,R,x[P],w);if(b===null){R===null&&(R=M);break}t&&R&&b.alternate===null&&e(h,R),v=s(b,v,P),E===null?A=b:E.sibling=b,E=b,R=M}if(P===x.length)return n(h,R),xt&&$i(h,P),A;if(R===null){for(;P<x.length;P++)R=d(h,x[P],w),R!==null&&(v=s(R,v,P),E===null?A=R:E.sibling=R,E=R);return xt&&$i(h,P),A}for(R=r(h,R);P<x.length;P++)M=p(R,h,P,x[P],w),M!==null&&(t&&M.alternate!==null&&R.delete(M.key===null?P:M.key),v=s(M,v,P),E===null?A=M:E.sibling=M,E=M);return t&&R.forEach(function(N){return e(h,N)}),xt&&$i(h,P),A}function _(h,v,x,w){var A=Ia(x);if(typeof A!="function")throw Error(re(150));if(x=A.call(x),x==null)throw Error(re(151));for(var E=A=null,R=v,P=v=0,M=null,b=x.next();R!==null&&!b.done;P++,b=x.next()){R.index>P?(M=R,R=null):M=R.sibling;var N=f(h,R,b.value,w);if(N===null){R===null&&(R=M);break}t&&R&&N.alternate===null&&e(h,R),v=s(N,v,P),E===null?A=N:E.sibling=N,E=N,R=M}if(b.done)return n(h,R),xt&&$i(h,P),A;if(R===null){for(;!b.done;P++,b=x.next())b=d(h,b.value,w),b!==null&&(v=s(b,v,P),E===null?A=b:E.sibling=b,E=b);return xt&&$i(h,P),A}for(R=r(h,R);!b.done;P++,b=x.next())b=p(R,h,P,b.value,w),b!==null&&(t&&b.alternate!==null&&R.delete(b.key===null?P:b.key),v=s(b,v,P),E===null?A=b:E.sibling=b,E=b);return t&&R.forEach(function(U){return e(h,U)}),xt&&$i(h,P),A}function m(h,v,x,w){if(typeof x=="object"&&x!==null&&x.type===Gs&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case al:e:{for(var A=x.key,E=v;E!==null;){if(E.key===A){if(A=x.type,A===Gs){if(E.tag===7){n(h,E.sibling),v=i(E,x.props.children),v.return=h,h=v;break e}}else if(E.elementType===A||typeof A=="object"&&A!==null&&A.$$typeof===li&&Bm(A)===E.type){n(h,E.sibling),v=i(E,x.props),v.ref=Fa(h,E,x),v.return=h,h=v;break e}n(h,E);break}else e(h,E);E=E.sibling}x.type===Gs?(v=os(x.props.children,h.mode,w,x.key),v.return=h,h=v):(w=sc(x.type,x.key,x.props,null,h.mode,w),w.ref=Fa(h,v,x),w.return=h,h=w)}return a(h);case Hs:e:{for(E=x.key;v!==null;){if(v.key===E)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(h,v.sibling),v=i(v,x.children||[]),v.return=h,h=v;break e}else{n(h,v);break}else e(h,v);v=v.sibling}v=ju(x,h.mode,w),v.return=h,h=v}return a(h);case li:return E=x._init,m(h,v,E(x._payload),w)}if(Ka(x))return g(h,v,x,w);if(Ia(x))return _(h,v,x,w);xl(h,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,v!==null&&v.tag===6?(n(h,v.sibling),v=i(v,x),v.return=h,h=v):(n(h,v),v=Vu(x,h.mode,w),v.return=h,h=v),a(h)):n(h,v)}return m}var pa=tv(!0),nv=tv(!1),Tc=Ii(null),Ac=null,Zs=null,Jf=null;function Zf(){Jf=Zs=Ac=null}function Qf(t){var e=Tc.current;mt(Tc),t._currentValue=e}function ah(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function aa(t,e){Ac=t,Jf=Zs=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(xn=!0),t.firstContext=null)}function $n(t){var e=t._currentValue;if(Jf!==t)if(t={context:t,memoizedValue:e,next:null},Zs===null){if(Ac===null)throw Error(re(308));Zs=t,Ac.dependencies={lanes:0,firstContext:t}}else Zs=Zs.next=t;return e}var ns=null;function ep(t){ns===null?ns=[t]:ns.push(t)}function rv(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,ep(e)):(n.next=i.next,i.next=n),e.interleaved=n,qr(t,r)}function qr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var ci=!1;function tp(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function iv(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function jr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function bi(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Qe&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,qr(t,n)}return i=r.interleaved,i===null?(e.next=e,ep(r)):(e.next=i.next,i.next=e),r.interleaved=e,qr(t,n)}function Ql(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,zf(t,n)}}function zm(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=a:s=s.next=a,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Rc(t,e,n,r){var i=t.updateQueue;ci=!1;var s=i.firstBaseUpdate,a=i.lastBaseUpdate,o=i.shared.pending;if(o!==null){i.shared.pending=null;var l=o,c=l.next;l.next=null,a===null?s=c:a.next=c,a=l;var u=t.alternate;u!==null&&(u=u.updateQueue,o=u.lastBaseUpdate,o!==a&&(o===null?u.firstBaseUpdate=c:o.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;a=0,u=c=l=null,o=s;do{var f=o.lane,p=o.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var g=t,_=o;switch(f=e,p=n,_.tag){case 1:if(g=_.payload,typeof g=="function"){d=g.call(p,d,f);break e}d=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=_.payload,f=typeof g=="function"?g.call(p,d,f):g,f==null)break e;d=Mt({},d,f);break e;case 2:ci=!0}}o.callback!==null&&o.lane!==0&&(t.flags|=64,f=i.effects,f===null?i.effects=[o]:f.push(o))}else p={eventTime:p,lane:f,tag:o.tag,payload:o.payload,callback:o.callback,next:null},u===null?(c=u=p,l=d):u=u.next=p,a|=f;if(o=o.next,o===null){if(o=i.shared.pending,o===null)break;f=o,o=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(u===null&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,e=i.shared.interleaved,e!==null){i=e;do a|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);ds|=a,t.lanes=a,t.memoizedState=d}}function Vm(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(re(191,i));i.call(r)}}}var Xo={},yr=Ii(Xo),Mo=Ii(Xo),To=Ii(Xo);function rs(t){if(t===Xo)throw Error(re(174));return t}function np(t,e){switch(ht(To,e),ht(Mo,t),ht(yr,Xo),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:zd(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=zd(e,t)}mt(yr),ht(yr,e)}function ma(){mt(yr),mt(Mo),mt(To)}function sv(t){rs(To.current);var e=rs(yr.current),n=zd(e,t.type);e!==n&&(ht(Mo,t),ht(yr,n))}function rp(t){Mo.current===t&&(mt(yr),mt(Mo))}var bt=Ii(0);function Cc(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.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===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Uu=[];function ip(){for(var t=0;t<Uu.length;t++)Uu[t]._workInProgressVersionPrimary=null;Uu.length=0}var ec=Zr.ReactCurrentDispatcher,ku=Zr.ReactCurrentBatchConfig,us=0,Et=null,Ft=null,Ht=null,Pc=!1,ao=!1,Ao=0,wS=0;function Zt(){throw Error(re(321))}function sp(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!dr(t[n],e[n]))return!1;return!0}function ap(t,e,n,r,i,s){if(us=s,Et=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ec.current=t===null||t.memoizedState===null?MS:TS,t=n(r,i),ao){s=0;do{if(ao=!1,Ao=0,25<=s)throw Error(re(301));s+=1,Ht=Ft=null,e.updateQueue=null,ec.current=AS,t=n(r,i)}while(ao)}if(ec.current=Nc,e=Ft!==null&&Ft.next!==null,us=0,Ht=Ft=Et=null,Pc=!1,e)throw Error(re(300));return t}function op(){var t=Ao!==0;return Ao=0,t}function mr(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ht===null?Et.memoizedState=Ht=t:Ht=Ht.next=t,Ht}function Xn(){if(Ft===null){var t=Et.alternate;t=t!==null?t.memoizedState:null}else t=Ft.next;var e=Ht===null?Et.memoizedState:Ht.next;if(e!==null)Ht=e,Ft=t;else{if(t===null)throw Error(re(310));Ft=t,t={memoizedState:Ft.memoizedState,baseState:Ft.baseState,baseQueue:Ft.baseQueue,queue:Ft.queue,next:null},Ht===null?Et.memoizedState=Ht=t:Ht=Ht.next=t}return Ht}function Ro(t,e){return typeof e=="function"?e(t):e}function Ou(t){var e=Xn(),n=e.queue;if(n===null)throw Error(re(311));n.lastRenderedReducer=t;var r=Ft,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var a=i.next;i.next=s.next,s.next=a}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var o=a=null,l=null,c=s;do{var u=c.lane;if((us&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:t(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(o=l=d,a=r):l=l.next=d,Et.lanes|=u,ds|=u}c=c.next}while(c!==null&&c!==s);l===null?a=r:l.next=o,dr(r,e.memoizedState)||(xn=!0),e.memoizedState=r,e.baseState=a,e.baseQueue=l,n.lastRenderedState=r}if(t=n.interleaved,t!==null){i=t;do s=i.lane,Et.lanes|=s,ds|=s,i=i.next;while(i!==t)}else i===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Fu(t){var e=Xn(),n=e.queue;if(n===null)throw Error(re(311));n.lastRenderedReducer=t;var r=n.dispatch,i=n.pending,s=e.memoizedState;if(i!==null){n.pending=null;var a=i=i.next;do s=t(s,a.action),a=a.next;while(a!==i);dr(s,e.memoizedState)||(xn=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),n.lastRenderedState=s}return[s,r]}function av(){}function ov(t,e){var n=Et,r=Xn(),i=e(),s=!dr(r.memoizedState,i);if(s&&(r.memoizedState=i,xn=!0),r=r.queue,lp(uv.bind(null,n,r,t),[t]),r.getSnapshot!==e||s||Ht!==null&&Ht.memoizedState.tag&1){if(n.flags|=2048,Co(9,cv.bind(null,n,r,i,e),void 0,null),Gt===null)throw Error(re(349));us&30||lv(n,e,i)}return i}function lv(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Et.updateQueue,e===null?(e={lastEffect:null,stores:null},Et.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function cv(t,e,n,r){e.value=n,e.getSnapshot=r,dv(e)&&hv(t)}function uv(t,e,n){return n(function(){dv(e)&&hv(t)})}function dv(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!dr(t,n)}catch{return!0}}function hv(t){var e=qr(t,1);e!==null&&ur(e,t,1,-1)}function jm(t){var e=mr();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ro,lastRenderedState:t},e.queue=t,t=t.dispatch=ES.bind(null,Et,t),[e.memoizedState,t]}function Co(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Et.updateQueue,e===null?(e={lastEffect:null,stores:null},Et.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function fv(){return Xn().memoizedState}function tc(t,e,n,r){var i=mr();Et.flags|=t,i.memoizedState=Co(1|e,n,void 0,r===void 0?null:r)}function Jc(t,e,n,r){var i=Xn();r=r===void 0?null:r;var s=void 0;if(Ft!==null){var a=Ft.memoizedState;if(s=a.destroy,r!==null&&sp(r,a.deps)){i.memoizedState=Co(e,n,s,r);return}}Et.flags|=t,i.memoizedState=Co(1|e,n,s,r)}function Hm(t,e){return tc(8390656,8,t,e)}function lp(t,e){return Jc(2048,8,t,e)}function pv(t,e){return Jc(4,2,t,e)}function mv(t,e){return Jc(4,4,t,e)}function gv(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function xv(t,e,n){return n=n!=null?n.concat([t]):null,Jc(4,4,gv.bind(null,e,t),n)}function cp(){}function vv(t,e){var n=Xn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&sp(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function _v(t,e){var n=Xn();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&sp(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function yv(t,e,n){return us&21?(dr(n,e)||(n=Mx(),Et.lanes|=n,ds|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,xn=!0),t.memoizedState=n)}function SS(t,e){var n=it;it=n!==0&&4>n?n:4,t(!0);var r=ku.transition;ku.transition={};try{t(!1),e()}finally{it=n,ku.transition=r}}function wv(){return Xn().memoizedState}function bS(t,e,n){var r=Mi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Sv(t))bv(e,n);else if(n=rv(t,e,n,r),n!==null){var i=cn();ur(n,t,r,i),Ev(n,e,r)}}function ES(t,e,n){var r=Mi(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Sv(t))bv(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var a=e.lastRenderedState,o=s(a,n);if(i.hasEagerState=!0,i.eagerState=o,dr(o,a)){var l=e.interleaved;l===null?(i.next=i,ep(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=rv(t,e,i,r),n!==null&&(i=cn(),ur(n,t,r,i),Ev(n,e,r))}}function Sv(t){var e=t.alternate;return t===Et||e!==null&&e===Et}function bv(t,e){ao=Pc=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Ev(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,zf(t,n)}}var Nc={readContext:$n,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useInsertionEffect:Zt,useLayoutEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useMutableSource:Zt,useSyncExternalStore:Zt,useId:Zt,unstable_isNewReconciler:!1},MS={readContext:$n,useCallback:function(t,e){return mr().memoizedState=[t,e===void 0?null:e],t},useContext:$n,useEffect:Hm,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,tc(4194308,4,gv.bind(null,e,t),n)},useLayoutEffect:function(t,e){return tc(4194308,4,t,e)},useInsertionEffect:function(t,e){return tc(4,2,t,e)},useMemo:function(t,e){var n=mr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=mr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=bS.bind(null,Et,t),[r.memoizedState,t]},useRef:function(t){var e=mr();return t={current:t},e.memoizedState=t},useState:jm,useDebugValue:cp,useDeferredValue:function(t){return mr().memoizedState=t},useTransition:function(){var t=jm(!1),e=t[0];return t=SS.bind(null,t[1]),mr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Et,i=mr();if(xt){if(n===void 0)throw Error(re(407));n=n()}else{if(n=e(),Gt===null)throw Error(re(349));us&30||lv(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,Hm(uv.bind(null,r,s,t),[t]),r.flags|=2048,Co(9,cv.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=mr(),e=Gt.identifierPrefix;if(xt){var n=Br,r=Fr;n=(r&~(1<<32-cr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Ao++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=wS++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},TS={readContext:$n,useCallback:vv,useContext:$n,useEffect:lp,useImperativeHandle:xv,useInsertionEffect:pv,useLayoutEffect:mv,useMemo:_v,useReducer:Ou,useRef:fv,useState:function(){return Ou(Ro)},useDebugValue:cp,useDeferredValue:function(t){var e=Xn();return yv(e,Ft.memoizedState,t)},useTransition:function(){var t=Ou(Ro)[0],e=Xn().memoizedState;return[t,e]},useMutableSource:av,useSyncExternalStore:ov,useId:wv,unstable_isNewReconciler:!1},AS={readContext:$n,useCallback:vv,useContext:$n,useEffect:lp,useImperativeHandle:xv,useInsertionEffect:pv,useLayoutEffect:mv,useMemo:_v,useReducer:Fu,useRef:fv,useState:function(){return Fu(Ro)},useDebugValue:cp,useDeferredValue:function(t){var e=Xn();return Ft===null?e.memoizedState=t:yv(e,Ft.memoizedState,t)},useTransition:function(){var t=Fu(Ro)[0],e=Xn().memoizedState;return[t,e]},useMutableSource:av,useSyncExternalStore:ov,useId:wv,unstable_isNewReconciler:!1};function tr(t,e){if(t&&t.defaultProps){e=Mt({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function oh(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Mt({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Zc={isMounted:function(t){return(t=t._reactInternals)?gs(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=cn(),i=Mi(t),s=jr(r,i);s.payload=e,n!=null&&(s.callback=n),e=bi(t,s,i),e!==null&&(ur(e,t,i,r),Ql(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=cn(),i=Mi(t),s=jr(r,i);s.tag=1,s.payload=e,n!=null&&(s.callback=n),e=bi(t,s,i),e!==null&&(ur(e,t,i,r),Ql(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=cn(),r=Mi(t),i=jr(n,r);i.tag=2,e!=null&&(i.callback=e),e=bi(t,i,r),e!==null&&(ur(e,t,r,n),Ql(e,t,r))}};function Gm(t,e,n,r,i,s,a){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,s,a):e.prototype&&e.prototype.isPureReactComponent?!wo(n,r)||!wo(i,s):!0}function Mv(t,e,n){var r=!1,i=Ci,s=e.contextType;return typeof s=="object"&&s!==null?s=$n(s):(i=_n(e)?ls:sn.current,r=e.contextTypes,s=(r=r!=null)?ha(t,i):Ci),e=new e(n,s),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Zc,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=i,t.__reactInternalMemoizedMaskedChildContext=s),e}function Wm(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&Zc.enqueueReplaceState(e,e.state,null)}function lh(t,e,n,r){var i=t.stateNode;i.props=n,i.state=t.memoizedState,i.refs={},tp(t);var s=e.contextType;typeof s=="object"&&s!==null?i.context=$n(s):(s=_n(e)?ls:sn.current,i.context=ha(t,s)),i.state=t.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(oh(t,e,s,n),i.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(e=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),e!==i.state&&Zc.enqueueReplaceState(i,i.state,null),Rc(t,n,i,r),i.state=t.memoizedState),typeof i.componentDidMount=="function"&&(t.flags|=4194308)}function ga(t,e){try{var n="",r=e;do n+=tw(r),r=r.return;while(r);var i=n}catch(s){i=`
39Error generating stack: `+s.message+`
40`+s.stack}return{value:t,source:e,stack:i,digest:null}}function Bu(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function ch(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var RS=typeof WeakMap=="function"?WeakMap:Map;
vendor: 10,823 bytes, line 40
40function Tv(t,e,n){n=jr(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Ic||(Ic=!0,_h=r),ch(t,e)},n}function Av(t,e,n){n=jr(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){ch(t,e)}}var s=t.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){ch(t,e),typeof r!="function"&&(Ei===null?Ei=new Set([this]):Ei.add(this));var a=e.stack;this.componentDidCatch(e.value,{componentStack:a!==null?a:""})}),n}function $m(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new RS;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=jS.bind(null,t,e,n),e.then(t,t))}function Xm(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function qm(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=jr(-1,1),e.tag=2,bi(n,e,1))),n.lanes|=1),t)}var CS=Zr.ReactCurrentOwner,xn=!1;function ln(t,e,n,r){e.child=t===null?nv(e,null,n,r):pa(e,t.child,n,r)}function Km(t,e,n,r,i){n=n.render;var s=e.ref;return aa(e,i),r=ap(t,e,n,r,s,i),n=op(),t!==null&&!xn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Kr(t,e,i)):(xt&&n&&qf(e),e.flags|=1,ln(t,e,r,i),e.child)}function Ym(t,e,n,r,i){if(t===null){var s=n.type;return typeof s=="function"&&!xp(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,Rv(t,e,s,r,i)):(t=sc(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(s=t.child,!(t.lanes&i)){var a=s.memoizedProps;if(n=n.compare,n=n!==null?n:wo,n(a,r)&&t.ref===e.ref)return Kr(t,e,i)}return e.flags|=1,t=Ti(s,r),t.ref=e.ref,t.return=e,e.child=t}function Rv(t,e,n,r,i){if(t!==null){var s=t.memoizedProps;if(wo(s,r)&&t.ref===e.ref)if(xn=!1,e.pendingProps=r=s,(t.lanes&i)!==0)t.flags&131072&&(xn=!0);else return e.lanes=t.lanes,Kr(t,e,i)}return uh(t,e,n,r,i)}function Cv(t,e,n){var r=e.pendingProps,i=r.children,s=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},ht(ea,An),An|=n;else{if(!(n&1073741824))return t=s!==null?s.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,ht(ea,An),An|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,ht(ea,An),An|=r}else s!==null?(r=s.baseLanes|n,e.memoizedState=null):r=n,ht(ea,An),An|=r;return ln(t,e,i,n),e.child}function Pv(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function uh(t,e,n,r,i){var s=_n(n)?ls:sn.current;return s=ha(e,s),aa(e,i),n=ap(t,e,n,r,s,i),r=op(),t!==null&&!xn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Kr(t,e,i)):(xt&&r&&qf(e),e.flags|=1,ln(t,e,n,i),e.child)}function Jm(t,e,n,r,i){if(_n(n)){var s=!0;bc(e)}else s=!1;if(aa(e,i),e.stateNode===null)nc(t,e),Mv(e,n,r),lh(e,n,r,i),r=!0;else if(t===null){var a=e.stateNode,o=e.memoizedProps;a.props=o;var l=a.context,c=n.contextType;typeof c=="object"&&c!==null?c=$n(c):(c=_n(n)?ls:sn.current,c=ha(e,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==r||l!==c)&&Wm(e,a,r,c),ci=!1;var f=e.memoizedState;a.state=f,Rc(e,r,a,i),l=e.memoizedState,o!==r||f!==l||vn.current||ci?(typeof u=="function"&&(oh(e,n,u,r),l=e.memoizedState),(o=ci||Gm(e,n,o,r,f,l,c))?(d||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(e.flags|=4194308)):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),a.props=r,a.state=l,a.context=c,r=o):(typeof a.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{a=e.stateNode,iv(t,e),o=e.memoizedProps,c=e.type===e.elementType?o:tr(e.type,o),a.props=c,d=e.pendingProps,f=a.context,l=n.contextType,typeof l=="object"&&l!==null?l=$n(l):(l=_n(n)?ls:sn.current,l=ha(e,l));var p=n.getDerivedStateFromProps;(u=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(o!==d||f!==l)&&Wm(e,a,r,l),ci=!1,f=e.memoizedState,a.state=f,Rc(e,r,a,i);var g=e.memoizedState;o!==d||f!==g||vn.current||ci?(typeof p=="function"&&(oh(e,n,p,r),g=e.memoizedState),(c=ci||Gm(e,n,c,r,f,g,l)||!1)?(u||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,g,l),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,g,l)),typeof a.componentDidUpdate=="function"&&(e.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=g),a.props=r,a.state=g,a.context=l,r=c):(typeof a.componentDidUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||o===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return dh(t,e,n,r,s,i)}function dh(t,e,n,r,i,s){Pv(t,e);var a=(e.flags&128)!==0;if(!r&&!a)return i&&km(e,n,!1),Kr(t,e,s);r=e.stateNode,CS.current=e;var o=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&a?(e.child=pa(e,t.child,null,s),e.child=pa(e,null,o,s)):ln(t,e,o,s),e.memoizedState=r.state,i&&km(e,n,!0),e.child}function Nv(t){var e=t.stateNode;e.pendingContext?Um(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Um(t,e.context,!1),np(t,e.containerInfo)}function Zm(t,e,n,r,i){return fa(),Yf(i),e.flags|=256,ln(t,e,n,r),e.child}var hh={dehydrated:null,treeContext:null,retryLane:0};function fh(t){return{baseLanes:t,cachePool:null,transitions:null}}function Lv(t,e,n){var r=e.pendingProps,i=bt.current,s=!1,a=(e.flags&128)!==0,o;if((o=a)||(o=t!==null&&t.memoizedState===null?!1:(i&2)!==0),o?(s=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),ht(bt,i&1),t===null)return sh(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(a=r.children,t=r.fallback,s?(r=e.mode,s=e.child,a={mode:"hidden",children:a},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=a):s=tu(a,r,0,null),t=os(t,r,n,null),s.return=e,t.return=e,s.sibling=t,e.child=s,e.child.memoizedState=fh(n),e.memoizedState=hh,t):up(e,a));if(i=t.memoizedState,i!==null&&(o=i.dehydrated,o!==null))return PS(t,e,a,r,o,i,n);if(s){s=r.fallback,a=e.mode,i=t.child,o=i.sibling;var l={mode:"hidden",children:r.children};return!(a&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=Ti(i,l),r.subtreeFlags=i.subtreeFlags&14680064),o!==null?s=Ti(o,s):(s=os(s,a,n,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,a=t.child.memoizedState,a=a===null?fh(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},s.memoizedState=a,s.childLanes=t.childLanes&~n,e.memoizedState=hh,r}return s=t.child,t=s.sibling,r=Ti(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function up(t,e){return e=tu({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function vl(t,e,n,r){return r!==null&&Yf(r),pa(e,t.child,null,n),t=up(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function PS(t,e,n,r,i,s,a){if(n)return e.flags&256?(e.flags&=-257,r=Bu(Error(re(422))),vl(t,e,a,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=tu({mode:"visible",children:r.children},i,0,null),s=os(s,i,a,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&pa(e,t.child,null,a),e.child.memoizedState=fh(a),e.memoizedState=hh,s);if(!(e.mode&1))return vl(t,e,a,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var o=r.dgst;return r=o,s=Error(re(419)),r=Bu(s,r,void 0),vl(t,e,a,r)}if(o=(a&t.childLanes)!==0,xn||o){if(r=Gt,r!==null){switch(a&-a){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|a)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,qr(t,i),ur(r,t,i,-1))}return gp(),r=Bu(Error(re(421))),vl(t,e,a,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=HS.bind(null,t),i._reactRetry=e,null):(t=s.treeContext,Pn=Si(i.nextSibling),Nn=e,xt=!0,sr=null,t!==null&&(zn[Vn++]=Fr,zn[Vn++]=Br,zn[Vn++]=cs,Fr=t.id,Br=t.overflow,cs=e),e=up(e,r.children),e.flags|=4096,e)}function Qm(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),ah(t.return,e,n)}function zu(t,e,n,r,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function Iv(t,e,n){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(ln(t,e,r.children,n),r=bt.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Qm(t,n,e);else if(t.tag===19)Qm(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(ht(bt,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&Cc(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),zu(e,!1,i,n,s);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&Cc(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}zu(e,!0,n,null,s);break;case"together":zu(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function nc(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}
vendor: 4,905 bytes, line 40
40function Kr(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),ds|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(re(153));if(e.child!==null){for(t=e.child,n=Ti(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Ti(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function NS(t,e,n){switch(e.tag){case 3:Nv(e),fa();break;case 5:sv(e);break;case 1:_n(e.type)&&bc(e);break;case 4:np(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;ht(Tc,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(ht(bt,bt.current&1),e.flags|=128,null):n&e.child.childLanes?Lv(t,e,n):(ht(bt,bt.current&1),t=Kr(t,e,n),t!==null?t.sibling:null);ht(bt,bt.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return Iv(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),ht(bt,bt.current),r)break;return null;case 22:case 23:return e.lanes=0,Cv(t,e,n)}return Kr(t,e,n)}var Dv,ph,Uv,kv;Dv=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};ph=function(){};Uv=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,rs(yr.current);var s=null;switch(n){case"input":i=kd(t,i),r=kd(t,r),s=[];break;case"select":i=Mt({},i,{value:void 0}),r=Mt({},r,{value:void 0}),s=[];break;case"textarea":i=Bd(t,i),r=Bd(t,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=wc)}Vd(n,r);var a;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var o=i[c];for(a in o)o.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(po.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var l=r[c];if(o=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==o&&(l!=null||o!=null))if(c==="style")if(o){for(a in o)!o.hasOwnProperty(a)||l&&l.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in l)l.hasOwnProperty(a)&&o[a]!==l[a]&&(n||(n={}),n[a]=l[a])}else n||(s||(s=[]),s.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,o=o?o.__html:void 0,l!=null&&o!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(po.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&pt("scroll",t),s||o===l||(s=[])):(s=s||[]).push(c,l))}n&&(s=s||[]).push("style",n);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};kv=function(t,e,n,r){n!==r&&(e.flags|=4)};function Ba(t,e){if(!xt)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Qt(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function LS(t,e,n){var r=e.pendingProps;switch(Kf(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qt(e),null;case 1:return _n(e.type)&&Sc(),Qt(e),null;case 3:return r=e.stateNode,ma(),mt(vn),mt(sn),ip(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(gl(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,sr!==null&&(Sh(sr),sr=null))),ph(t,e),Qt(e),null;case 5:rp(e);var i=rs(To.current);if(n=e.type,t!==null&&e.stateNode!=null)Uv(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(re(166));return Qt(e),null}if(t=rs(yr.current),gl(e)){r=e.stateNode,n=e.type;var s=e.memoizedProps;switch(r[xr]=e,r[Eo]=s,t=(e.mode&1)!==0,n){case"dialog":pt("cancel",r),pt("close",r);break;case"iframe":case"object":case"embed":pt("load",r);break;case"video":case"audio":for(i=0;i<Ja.length;i++)pt(Ja[i],r);break;case"source":pt("error",r);break;case"img":case"image":case"link":pt("error",r),pt("load",r);break;case"details":pt("toggle",r);break;case"input":lm(r,s),pt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},pt("invalid",r);break;case"textarea":um(r,s),pt("invalid",r)}Vd(n,s),i=null;for(var a in s)if(s.hasOwnProperty(a)){var o=s[a];
vendor: 32,532 bytes, line 40
40a==="children"?typeof o=="string"?r.textContent!==o&&(s.suppressHydrationWarning!==!0&&ml(r.textContent,o,t),i=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(s.suppressHydrationWarning!==!0&&ml(r.textContent,o,t),i=["children",""+o]):po.hasOwnProperty(a)&&o!=null&&a==="onScroll"&&pt("scroll",r)}switch(n){case"input":ol(r),cm(r,s,!0);break;case"textarea":ol(r),dm(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=wc)}r=i,e.updateQueue=r,r!==null&&(e.flags|=4)}else{a=i.nodeType===9?i:i.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=ux(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=a.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=a.createElement(n,{is:r.is}):(t=a.createElement(n),n==="select"&&(a=t,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):t=a.createElementNS(t,n),t[xr]=e,t[Eo]=r,Dv(t,e,!1,!1),e.stateNode=t;e:{switch(a=jd(n,r),n){case"dialog":pt("cancel",t),pt("close",t),i=r;break;case"iframe":case"object":case"embed":pt("load",t),i=r;break;case"video":case"audio":for(i=0;i<Ja.length;i++)pt(Ja[i],t);i=r;break;case"source":pt("error",t),i=r;break;case"img":case"image":case"link":pt("error",t),pt("load",t),i=r;break;case"details":pt("toggle",t),i=r;break;case"input":lm(t,r),i=kd(t,r),pt("invalid",t);break;case"option":i=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},i=Mt({},r,{value:void 0}),pt("invalid",t);break;case"textarea":um(t,r),i=Bd(t,r),pt("invalid",t);break;default:i=r}Vd(n,i),o=i;for(s in o)if(o.hasOwnProperty(s)){var l=o[s];s==="style"?fx(t,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&dx(t,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&mo(t,l):typeof l=="number"&&mo(t,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(po.hasOwnProperty(s)?l!=null&&s==="onScroll"&&pt("scroll",t):l!=null&&Df(t,s,l,a))}switch(n){case"input":ol(t),cm(t,r,!1);break;case"textarea":ol(t),dm(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Ri(r.value));break;case"select":t.multiple=!!r.multiple,s=r.value,s!=null?na(t,!!r.multiple,s,!1):r.defaultValue!=null&&na(t,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(t.onclick=wc)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Qt(e),null;case 6:if(t&&e.stateNode!=null)kv(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(re(166));if(n=rs(To.current),rs(yr.current),gl(e)){if(r=e.stateNode,n=e.memoizedProps,r[xr]=e,(s=r.nodeValue!==n)&&(t=Nn,t!==null))switch(t.tag){case 3:ml(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&ml(r.nodeValue,n,(t.mode&1)!==0)}s&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[xr]=e,e.stateNode=r}return Qt(e),null;case 13:if(mt(bt),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(xt&&Pn!==null&&e.mode&1&&!(e.flags&128))ev(),fa(),e.flags|=98560,s=!1;else if(s=gl(e),r!==null&&r.dehydrated!==null){if(t===null){if(!s)throw Error(re(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(re(317));s[xr]=e}else fa(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Qt(e),s=!1}else sr!==null&&(Sh(sr),sr=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||bt.current&1?Bt===0&&(Bt=3):gp())),e.updateQueue!==null&&(e.flags|=4),Qt(e),null);case 4:return ma(),ph(t,e),t===null&&So(e.stateNode.containerInfo),Qt(e),null;case 10:return Qf(e.type._context),Qt(e),null;case 17:return _n(e.type)&&Sc(),Qt(e),null;case 19:if(mt(bt),s=e.memoizedState,s===null)return Qt(e),null;if(r=(e.flags&128)!==0,a=s.rendering,a===null)if(r)Ba(s,!1);else{if(Bt!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(a=Cc(t),a!==null){for(e.flags|=128,Ba(s,!1),r=a.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)s=n,t=r,s.flags&=14680066,a=s.alternate,a===null?(s.childLanes=0,s.lanes=t,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=a.childLanes,s.lanes=a.lanes,s.child=a.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=a.memoizedProps,s.memoizedState=a.memoizedState,s.updateQueue=a.updateQueue,s.type=a.type,t=a.dependencies,s.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return ht(bt,bt.current&1|2),e.child}t=t.sibling}s.tail!==null&&Lt()>xa&&(e.flags|=128,r=!0,Ba(s,!1),e.lanes=4194304)}else{if(!r)if(t=Cc(a),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ba(s,!0),s.tail===null&&s.tailMode==="hidden"&&!a.alternate&&!xt)return Qt(e),null}else 2*Lt()-s.renderingStartTime>xa&&n!==1073741824&&(e.flags|=128,r=!0,Ba(s,!1),e.lanes=4194304);s.isBackwards?(a.sibling=e.child,e.child=a):(n=s.last,n!==null?n.sibling=a:e.child=a,s.last=a)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Lt(),e.sibling=null,n=bt.current,ht(bt,r?n&1|2:n&1),e):(Qt(e),null);case 22:case 23:return mp(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?An&1073741824&&(Qt(e),e.subtreeFlags&6&&(e.flags|=8192)):Qt(e),null;case 24:return null;case 25:return null}throw Error(re(156,e.tag))}function IS(t,e){switch(Kf(e),e.tag){case 1:return _n(e.type)&&Sc(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ma(),mt(vn),mt(sn),ip(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return rp(e),null;case 13:if(mt(bt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(re(340));fa()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return mt(bt),null;case 4:return ma(),null;case 10:return Qf(e.type._context),null;case 22:case 23:return mp(),null;case 24:return null;default:return null}}var _l=!1,nn=!1,DS=typeof WeakSet=="function"?WeakSet:Set,ve=null;function Qs(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ct(t,e,r)}else n.current=null}function mh(t,e,n){try{n()}catch(r){Ct(t,e,r)}}var e0=!1;function US(t,e){if(Zd=vc,t=Vx(),Xf(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var a=0,o=-1,l=-1,c=0,u=0,d=t,f=null;t:for(;;){for(var p;d!==n||i!==0&&d.nodeType!==3||(o=a+i),d!==s||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(p=d.firstChild)!==null;)f=d,d=p;for(;;){if(d===t)break t;if(f===n&&++c===i&&(o=a),f===s&&++u===r&&(l=a),(p=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=p}n=o===-1||l===-1?null:{start:o,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Qd={focusedElem:t,selectionRange:n},vc=!1,ve=e;ve!==null;)if(e=ve,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ve=t;else for(;ve!==null;){e=ve;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var _=g.memoizedProps,m=g.memoizedState,h=e.stateNode,v=h.getSnapshotBeforeUpdate(e.elementType===e.type?_:tr(e.type,_),m);h.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var x=e.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(re(163))}}catch(w){Ct(e,e.return,w)}if(t=e.sibling,t!==null){t.return=e.return,ve=t;break}ve=e.return}return g=e0,e0=!1,g}function oo(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&mh(e,n,s)}i=i.next}while(i!==r)}}function Qc(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function gh(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function Ov(t){var e=t.alternate;e!==null&&(t.alternate=null,Ov(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[xr],delete e[Eo],delete e[nh],delete e[xS],delete e[vS])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Fv(t){return t.tag===5||t.tag===3||t.tag===4}function t0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Fv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function xh(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=wc));else if(r!==4&&(t=t.child,t!==null))for(xh(t,e,n),t=t.sibling;t!==null;)xh(t,e,n),t=t.sibling}function vh(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(vh(t,e,n),t=t.sibling;t!==null;)vh(t,e,n),t=t.sibling}var Kt=null,rr=!1;function ei(t,e,n){for(n=n.child;n!==null;)Bv(t,e,n),n=n.sibling}function Bv(t,e,n){if(_r&&typeof _r.onCommitFiberUnmount=="function")try{_r.onCommitFiberUnmount(Wc,n)}catch{}switch(n.tag){case 5:nn||Qs(n,e);case 6:var r=Kt,i=rr;Kt=null,ei(t,e,n),Kt=r,rr=i,Kt!==null&&(rr?(t=Kt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Kt.removeChild(n.stateNode));break;case 18:Kt!==null&&(rr?(t=Kt,n=n.stateNode,t.nodeType===8?Iu(t.parentNode,n):t.nodeType===1&&Iu(t,n),_o(t)):Iu(Kt,n.stateNode));break;case 4:r=Kt,i=rr,Kt=n.stateNode.containerInfo,rr=!0,ei(t,e,n),Kt=r,rr=i;break;case 0:case 11:case 14:case 15:if(!nn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,a=s.destroy;s=s.tag,a!==void 0&&(s&2||s&4)&&mh(n,e,a),i=i.next}while(i!==r)}ei(t,e,n);break;case 1:if(!nn&&(Qs(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(o){Ct(n,e,o)}ei(t,e,n);break;case 21:ei(t,e,n);break;case 22:n.mode&1?(nn=(r=nn)||n.memoizedState!==null,ei(t,e,n),nn=r):ei(t,e,n);break;default:ei(t,e,n)}}function n0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new DS),e.forEach(function(r){var i=GS.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Yn(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=t,a=e,o=a;e:for(;o!==null;){switch(o.tag){case 5:Kt=o.stateNode,rr=!1;break e;case 3:Kt=o.stateNode.containerInfo,rr=!0;break e;case 4:Kt=o.stateNode.containerInfo,rr=!0;break e}o=o.return}if(Kt===null)throw Error(re(160));Bv(s,a,i),Kt=null,rr=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Ct(i,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)zv(e,t),e=e.sibling}function zv(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(Yn(e,t),pr(t),r&4){try{oo(3,t,t.return),Qc(3,t)}catch(_){Ct(t,t.return,_)}try{oo(5,t,t.return)}catch(_){Ct(t,t.return,_)}}break;case 1:Yn(e,t),pr(t),r&512&&n!==null&&Qs(n,n.return);break;case 5:if(Yn(e,t),pr(t),r&512&&n!==null&&Qs(n,n.return),t.flags&32){var i=t.stateNode;try{mo(i,"")}catch(_){Ct(t,t.return,_)}}if(r&4&&(i=t.stateNode,i!=null)){var s=t.memoizedProps,a=n!==null?n.memoizedProps:s,o=t.type,l=t.updateQueue;if(t.updateQueue=null,l!==null)try{o==="input"&&s.type==="radio"&&s.name!=null&&lx(i,s),jd(o,a);var c=jd(o,s);for(a=0;a<l.length;a+=2){var u=l[a],d=l[a+1];u==="style"?fx(i,d):u==="dangerouslySetInnerHTML"?dx(i,d):u==="children"?mo(i,d):Df(i,u,d,c)}switch(o){case"input":Od(i,s);break;case"textarea":cx(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var p=s.value;p!=null?na(i,!!s.multiple,p,!1):f!==!!s.multiple&&(s.defaultValue!=null?na(i,!!s.multiple,s.defaultValue,!0):na(i,!!s.multiple,s.multiple?[]:"",!1))}i[Eo]=s}catch(_){Ct(t,t.return,_)}}break;case 6:if(Yn(e,t),pr(t),r&4){if(t.stateNode===null)throw Error(re(162));i=t.stateNode,s=t.memoizedProps;try{i.nodeValue=s}catch(_){Ct(t,t.return,_)}}break;case 3:if(Yn(e,t),pr(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{_o(e.containerInfo)}catch(_){Ct(t,t.return,_)}break;case 4:Yn(e,t),pr(t);break;case 13:Yn(e,t),pr(t),i=t.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(fp=Lt())),r&4&&n0(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(nn=(c=nn)||u,Yn(e,t),nn=c):Yn(e,t),pr(t),r&8192){if(c=t.memoizedState!==null,(t.stateNode.isHidden=c)&&!u&&t.mode&1)for(ve=t,u=t.child;u!==null;){for(d=ve=u;ve!==null;){switch(f=ve,p=f.child,f.tag){case 0:case 11:case 14:case 15:oo(4,f,f.return);break;case 1:Qs(f,f.return);var g=f.stateNode;if(typeof g.componentWillUnmount=="function"){r=f,n=f.return;try{e=r,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(_){Ct(r,n,_)}}break;case 5:Qs(f,f.return);break;case 22:if(f.memoizedState!==null){i0(d);continue}}p!==null?(p.return=f,ve=p):i0(d)}u=u.sibling}e:for(u=null,d=t;;){if(d.tag===5){if(u===null){u=d;try{i=d.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(o=d.stateNode,l=d.memoizedProps.style,a=l!=null&&l.hasOwnProperty("display")?l.display:null,o.style.display=hx("display",a))}catch(_){Ct(t,t.return,_)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(_){Ct(t,t.return,_)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===t)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===t)break e;for(;d.sibling===null;){if(d.return===null||d.return===t)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Yn(e,t),pr(t),r&4&&n0(t);break;case 21:break;default:Yn(e,t),pr(t)}}function pr(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(Fv(n)){var r=n;break e}n=n.return}throw Error(re(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(mo(i,""),r.flags&=-33);var s=t0(t);vh(t,s,i);break;case 3:case 4:var a=r.stateNode.containerInfo,o=t0(t);xh(t,o,a);break;default:throw Error(re(161))}}catch(l){Ct(t,t.return,l)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function kS(t,e,n){ve=t,Vv(t)}function Vv(t,e,n){for(var r=(t.mode&1)!==0;ve!==null;){var i=ve,s=i.child;if(i.tag===22&&r){var a=i.memoizedState!==null||_l;if(!a){var o=i.alternate,l=o!==null&&o.memoizedState!==null||nn;o=_l;var c=nn;if(_l=a,(nn=l)&&!c)for(ve=i;ve!==null;)a=ve,l=a.child,a.tag===22&&a.memoizedState!==null?s0(i):l!==null?(l.return=a,ve=l):s0(i);for(;s!==null;)ve=s,Vv(s),s=s.sibling;ve=i,_l=o,nn=c}r0(t)}else i.subtreeFlags&8772&&s!==null?(s.return=i,ve=s):r0(t)}}function r0(t){for(;ve!==null;){var e=ve;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:nn||Qc(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!nn)if(n===null)r.componentDidMount();else{var i=e.elementType===e.type?n.memoizedProps:tr(e.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&Vm(e,s,r);break;case 3:var a=e.updateQueue;if(a!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}Vm(e,a,n)}break;case 5:var o=e.stateNode;if(n===null&&e.flags&4){n=o;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var c=e.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&_o(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(re(163))}nn||e.flags&512&&gh(e)}catch(f){Ct(e,e.return,f)}}if(e===t){ve=null;break}if(n=e.sibling,n!==null){n.return=e.return,ve=n;break}ve=e.return}}function i0(t){for(;ve!==null;){var e=ve;if(e===t){ve=null;break}var n=e.sibling;if(n!==null){n.return=e.return,ve=n;break}ve=e.return}}function s0(t){for(;ve!==null;){var e=ve;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Qc(4,e)}catch(l){Ct(e,n,l)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var i=e.return;try{r.componentDidMount()}catch(l){Ct(e,i,l)}}var s=e.return;try{gh(e)}catch(l){Ct(e,s,l)}break;case 5:var a=e.return;try{gh(e)}catch(l){Ct(e,a,l)}}}catch(l){Ct(e,e.return,l)}if(e===t){ve=null;break}var o=e.sibling;if(o!==null){o.return=e.return,ve=o;break}ve=e.return}}var OS=Math.ceil,Lc=Zr.ReactCurrentDispatcher,dp=Zr.ReactCurrentOwner,Wn=Zr.ReactCurrentBatchConfig,Qe=0,Gt=null,kt=null,Yt=0,An=0,ea=Ii(0),Bt=0,Po=null,ds=0,eu=0,hp=0,lo=null,gn=null,fp=0,xa=1/0,Dr=null,Ic=!1,_h=null,Ei=null,yl=!1,xi=null,Dc=0,co=0,yh=null,rc=-1,ic=0;function cn(){return Qe&6?Lt():rc!==-1?rc:rc=Lt()}function Mi(t){return t.mode&1?Qe&2&&Yt!==0?Yt&-Yt:yS.transition!==null?(ic===0&&(ic=Mx()),ic):(t=it,t!==0||(t=window.event,t=t===void 0?16:Lx(t.type)),t):1}function ur(t,e,n,r){if(50<co)throw co=0,yh=null,Error(re(185));Go(t,n,r),(!(Qe&2)||t!==Gt)&&(t===Gt&&(!(Qe&2)&&(eu|=n),Bt===4&&fi(t,Yt)),yn(t,r),n===1&&Qe===0&&!(e.mode&1)&&(xa=Lt()+500,Yc&&Di()))}function yn(t,e){var n=t.callbackNode;yw(t,e);var r=xc(t,t===Gt?Yt:0);if(r===0)n!==null&&pm(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&pm(n),e===1)t.tag===0?_S(a0.bind(null,t)):Jx(a0.bind(null,t)),mS(function(){!(Qe&6)&&Di()}),n=null;else{switch(Tx(r)){case 1:n=Bf;break;case 4:n=bx;break;case 16:n=gc;break;case 536870912:n=Ex;break;default:n=gc}n=Kv(n,jv.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function jv(t,e){if(rc=-1,ic=0,Qe&6)throw Error(re(327));var n=t.callbackNode;if(oa()&&t.callbackNode!==n)return null;var r=xc(t,t===Gt?Yt:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=Uc(t,r);else{e=r;var i=Qe;Qe|=2;var s=Gv();(Gt!==t||Yt!==e)&&(Dr=null,xa=Lt()+500,as(t,e));do try{zS();break}catch(o){Hv(t,o)}while(!0);Zf(),Lc.current=s,Qe=i,kt!==null?e=0:(Gt=null,Yt=0,e=Bt)}if(e!==0){if(e===2&&(i=Xd(t),i!==0&&(r=i,e=wh(t,i))),e===1)throw n=Po,as(t,0),fi(t,r),yn(t,Lt()),n;if(e===6)fi(t,r);else{if(i=t.current.alternate,!(r&30)&&!FS(i)&&(e=Uc(t,r),e===2&&(s=Xd(t),s!==0&&(r=s,e=wh(t,s))),e===1))throw n=Po,as(t,0),fi(t,r),yn(t,Lt()),n;switch(t.finishedWork=i,t.finishedLanes=r,e){case 0:case 1:throw Error(re(345));case 2:Xi(t,gn,Dr);break;case 3:if(fi(t,r),(r&130023424)===r&&(e=fp+500-Lt(),10<e)){if(xc(t,0)!==0)break;if(i=t.suspendedLanes,(i&r)!==r){cn(),t.pingedLanes|=t.suspendedLanes&i;break}t.timeoutHandle=th(Xi.bind(null,t,gn,Dr),e);break}Xi(t,gn,Dr);break;case 4:if(fi(t,r),(r&4194240)===r)break;for(e=t.eventTimes,i=-1;0<r;){var a=31-cr(r);s=1<<a,a=e[a],a>i&&(i=a),r&=~s}if(r=i,r=Lt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*OS(r/1960))-r,10<r){t.timeoutHandle=th(Xi.bind(null,t,gn,Dr),r);break}Xi(t,gn,Dr);break;case 5:Xi(t,gn,Dr);break;default:throw Error(re(329))}}}return yn(t,Lt()),t.callbackNode===n?jv.bind(null,t):null}function wh(t,e){var n=lo;return t.current.memoizedState.isDehydrated&&(as(t,e).flags|=256),t=Uc(t,e),t!==2&&(e=gn,gn=n,e!==null&&Sh(e)),t}function Sh(t){gn===null?gn=t:gn.push.apply(gn,t)}function FS(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!dr(s(),i))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function fi(t,e){for(e&=~hp,e&=~eu,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-cr(e),r=1<<n;t[n]=-1,e&=~r}}function a0(t){if(Qe&6)throw Error(re(327));oa();var e=xc(t,0);if(!(e&1))return yn(t,Lt()),null;var n=Uc(t,e);if(t.tag!==0&&n===2){var r=Xd(t);r!==0&&(e=r,n=wh(t,r))}if(n===1)throw n=Po,as(t,0),fi(t,e),yn(t,Lt()),n;if(n===6)throw Error(re(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,Xi(t,gn,Dr),yn(t,Lt()),null}function pp(t,e){var n=Qe;Qe|=1;try{return t(e)}finally{Qe=n,Qe===0&&(xa=Lt()+500,Yc&&Di())}}function hs(t){xi!==null&&xi.tag===0&&!(Qe&6)&&oa();var e=Qe;Qe|=1;var n=Wn.transition,r=it;try{if(Wn.transition=null,it=1,t)return t()}finally{it=r,Wn.transition=n,Qe=e,!(Qe&6)&&Di()}}function mp(){An=ea.current,mt(ea)}function as(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,pS(n)),kt!==null)for(n=kt.return;n!==null;){var r=n;switch(Kf(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Sc();break;case 3:ma(),mt(vn),mt(sn),ip();break;case 5:rp(r);break;case 4:ma();break;case 13:mt(bt);break;case 19:mt(bt);break;case 10:Qf(r.type._context);break;case 22:case 23:mp()}n=n.return}if(Gt=t,kt=t=Ti(t.current,null),Yt=An=e,Bt=0,Po=null,hp=eu=ds=0,gn=lo=null,ns!==null){for(e=0;e<ns.length;e++)if(n=ns[e],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var a=s.next;s.next=i,r.next=a}n.pending=r}ns=null}return t}function Hv(t,e){do{var n=kt;try{if(Zf(),ec.current=Nc,Pc){for(var r=Et.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Pc=!1}if(us=0,Ht=Ft=Et=null,ao=!1,Ao=0,dp.current=null,n===null||n.return===null){Bt=1,Po=e,kt=null;break}e:{var s=t,a=n.return,o=n,l=e;if(e=Yt,o.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=o,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var p=Xm(a);if(p!==null){p.flags&=-257,qm(p,a,o,s,e),p.mode&1&&$m(s,c,e),e=p,l=c;var g=e.updateQueue;if(g===null){var _=new Set;_.add(l),e.updateQueue=_}else g.add(l);break e}else{if(!(e&1)){$m(s,c,e),gp();break e}l=Error(re(426))}}else if(xt&&o.mode&1){var m=Xm(a);if(m!==null){!(m.flags&65536)&&(m.flags|=256),qm(m,a,o,s,e),Yf(ga(l,o));break e}}s=l=ga(l,o),Bt!==4&&(Bt=2),lo===null?lo=[s]:lo.push(s),s=a;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var h=Tv(s,l,e);zm(s,h);break e;case 1:o=l;var v=s.type,x=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Ei===null||!Ei.has(x)))){s.flags|=65536,e&=-e,s.lanes|=e;var w=Av(s,o,e);zm(s,w);break e}}s=s.return}while(s!==null)}$v(n)}catch(A){e=A,kt===n&&n!==null&&(kt=n=n.return);continue}break}while(!0)}function Gv(){var t=Lc.current;return Lc.current=Nc,t===null?Nc:t}function gp(){(Bt===0||Bt===3||Bt===2)&&(Bt=4),Gt===null||!(ds&268435455)&&!(eu&268435455)||fi(Gt,Yt)}function Uc(t,e){var n=Qe;Qe|=2;var r=Gv();(Gt!==t||Yt!==e)&&(Dr=null,as(t,e));do try{BS();break}catch(i){Hv(t,i)}while(!0);if(Zf(),Qe=n,Lc.current=r,kt!==null)throw Error(re(261));return Gt=null,Yt=0,Bt}function BS(){for(;kt!==null;)Wv(kt)}function zS(){for(;kt!==null&&!dw();)Wv(kt)}function Wv(t){var e=qv(t.alternate,t,An);t.memoizedProps=t.pendingProps,e===null?$v(t):kt=e,dp.current=null}function $v(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=IS(n,e),n!==null){n.flags&=32767,kt=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{Bt=6,kt=null;return}}else if(n=LS(n,e,An),n!==null){kt=n;return}if(e=e.sibling,e!==null){kt=e;return}kt=e=t}while(e!==null);Bt===0&&(Bt=5)}function Xi(t,e,n){var r=it,i=Wn.transition;try{Wn.transition=null,it=1,VS(t,e,n,r)}finally{Wn.transition=i,it=r}return null}function VS(t,e,n,r){do oa();while(xi!==null);if(Qe&6)throw Error(re(327));n=t.finishedWork;var i=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(re(177));t.callbackNode=null,t.callbackPriority=0;var s=n.lanes|n.childLanes;if(ww(t,s),t===Gt&&(kt=Gt=null,Yt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||yl||(yl=!0,Kv(gc,function(){return oa(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=Wn.transition,Wn.transition=null;var a=it;it=1;var o=Qe;Qe|=4,dp.current=null,US(t,n),zv(n,t),oS(Qd),vc=!!Zd,Qd=Zd=null,t.current=n,kS(n),hw(),Qe=o,it=a,Wn.transition=s}else t.current=n;if(yl&&(yl=!1,xi=t,Dc=i),s=t.pendingLanes,s===0&&(Ei=null),mw(n.stateNode),yn(t,Lt()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)i=e[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Ic)throw Ic=!1,t=_h,_h=null,t;return Dc&1&&t.tag!==0&&oa(),s=t.pendingLanes,s&1?t===yh?co++:(co=0,yh=t):co=0,Di(),null}function oa(){if(xi!==null){var t=Tx(Dc),e=Wn.transition,n=it;try{if(Wn.transition=null,it=16>t?16:t,xi===null)var r=!1;else{if(t=xi,xi=null,Dc=0,Qe&6)throw Error(re(331));var i=Qe;for(Qe|=4,ve=t.current;ve!==null;){var s=ve,a=s.child;if(ve.flags&16){var o=s.deletions;if(o!==null){for(var l=0;l<o.length;l++){var c=o[l];for(ve=c;ve!==null;){var u=ve;switch(u.tag){case 0:case 11:case 15:oo(8,u,s)}var d=u.child;if(d!==null)d.return=u,ve=d;else for(;ve!==null;){u=ve;var f=u.sibling,p=u.return;if(Ov(u),u===c){ve=null;break}if(f!==null){f.return=p,ve=f;break}ve=p}}}var g=s.alternate;if(g!==null){var _=g.child;if(_!==null){g.child=null;do{var m=_.sibling;_.sibling=null,_=m}while(_!==null)}}ve=s}}if(s.subtreeFlags&2064&&a!==null)a.return=s,ve=a;else e:for(;ve!==null;){if(s=ve,s.flags&2048)switch(s.tag){case 0:case 11:case 15:oo(9,s,s.return)}var h=s.sibling;if(h!==null){h.return=s.return,ve=h;break e}ve=s.return}}var v=t.current;for(ve=v;ve!==null;){a=ve;var x=a.child;if(a.subtreeFlags&2064&&x!==null)x.return=a,ve=x;else e:for(a=v;ve!==null;){if(o=ve,o.flags&2048)try{switch(o.tag){case 0:case 11:case 15:Qc(9,o)}}catch(A){Ct(o,o.return,A)}if(o===a){ve=null;break e}var w=o.sibling;if(w!==null){w.return=o.return,ve=w;break e}ve=o.return}}if(Qe=i,Di(),_r&&typeof _r.onPostCommitFiberRoot=="function")try{_r.onPostCommitFiberRoot(Wc,t)}catch{}r=!0}return r}finally{it=n,Wn.transition=e}}return!1}function o0(t,e,n){e=ga(n,e),e=Tv(t,e,1),t=bi(t,e,1),e=cn(),t!==null&&(Go(t,1,e),yn(t,e))}function Ct(t,e,n){if(t.tag===3)o0(t,t,n);else for(;e!==null;){if(e.tag===3){o0(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ei===null||!Ei.has(r))){t=ga(n,t),t=Av(e,t,1),e=bi(e,t,1),t=cn(),e!==null&&(Go(e,1,t),yn(e,t));break}}e=e.return}}function jS(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=cn(),t.pingedLanes|=t.suspendedLanes&n,Gt===t&&(Yt&n)===n&&(Bt===4||Bt===3&&(Yt&130023424)===Yt&&500>Lt()-fp?as(t,0):hp|=n),yn(t,e)}function Xv(t,e){e===0&&(t.mode&1?(e=ul,ul<<=1,!(ul&130023424)&&(ul=4194304)):e=1);var n=cn();t=qr(t,e),t!==null&&(Go(t,e,n),yn(t,n))}function HS(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Xv(t,n)}function GS(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(re(314))}r!==null&&r.delete(e),Xv(t,n)}var qv;qv=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||vn.current)xn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return xn=!1,NS(t,e,n);xn=!!(t.flags&131072)}else xn=!1,xt&&e.flags&1048576&&Zx(e,Mc,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;nc(t,e),t=e.pendingProps;var i=ha(e,sn.current);aa(e,n),i=ap(null,e,r,t,i,n);var s=op();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,_n(r)?(s=!0,bc(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,tp(e),i.updater=Zc,e.stateNode=i,i._reactInternals=e,lh(e,r,t,n),e=dh(null,e,r,!0,s,n)):(e.tag=0,xt&&s&&qf(e),ln(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(nc(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=$S(r),t=tr(r,t),i){case 0:e=uh(null,e,r,t,n);break e;case 1:e=Jm(null,e,r,t,n);break e;case 11:e=Km(null,e,r,t,n);break e;case 14:e=Ym(null,e,r,tr(r.type,t),n);break e}throw Error(re(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:tr(r,i),uh(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:tr(r,i),Jm(t,e,r,i,n);case 3:e:{if(Nv(e),t===null)throw Error(re(387));r=e.pendingProps,s=e.memoizedState,i=s.element,iv(t,e),Rc(e,r,null,n);var a=e.memoizedState;if(r=a.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=ga(Error(re(423)),e),e=Zm(t,e,r,n,i);break e}else if(r!==i){i=ga(Error(re(424)),e),e=Zm(t,e,r,n,i);break e}else for(Pn=Si(e.stateNode.containerInfo.firstChild),Nn=e,xt=!0,sr=null,n=nv(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(fa(),r===i){e=Kr(t,e,n);break e}ln(t,e,r,n)}e=e.child}return e;case 5:return sv(e),t===null&&sh(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,a=i.children,eh(r,i)?a=null:s!==null&&eh(r,s)&&(e.flags|=32),Pv(t,e),ln(t,e,a,n),e.child;case 6:return t===null&&sh(e),null;case 13:return Lv(t,e,n);case 4:return np(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=pa(e,null,r,n):ln(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:tr(r,i),Km(t,e,r,i,n);case 7:return ln(t,e,e.pendingProps,n),e.child;case 8:return ln(t,e,e.pendingProps.children,n),e.child;case 12:return ln(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,a=i.value,ht(Tc,r._currentValue),r._currentValue=a,s!==null)if(dr(s.value,a)){if(s.children===i.children&&!vn.current){e=Kr(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var o=s.dependencies;if(o!==null){a=s.child;for(var l=o.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=jr(-1,n&-n),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),ah(s.return,n,e),o.lanes|=n;break}l=l.next}}else if(s.tag===10)a=s.type===e.type?null:s.child;else if(s.tag===18){if(a=s.return,a===null)throw Error(re(341));a.lanes|=n,o=a.alternate,o!==null&&(o.lanes|=n),ah(a,n,e),a=s.sibling}else a=s.child;if(a!==null)a.return=s;else for(a=s;a!==null;){if(a===e){a=null;break}if(s=a.sibling,s!==null){s.return=a.return,a=s;break}a=a.return}s=a}ln(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,aa(e,n),i=$n(i),r=r(i),e.flags|=1,ln(t,e,r,n),e.child;case 14:return r=e.type,i=tr(r,e.pendingProps),i=tr(r.type,i),Ym(t,e,r,i,n);case 15:return Rv(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:tr(r,i),nc(t,e),e.tag=1,_n(r)?(t=!0,bc(e)):t=!1,aa(e,n),Mv(e,r,i),lh(e,r,i,n),dh(null,e,r,!0,t,n);case 19:return Iv(t,e,n);case 22:return Cv(t,e,n)}throw Error(re(156,e.tag))};function Kv(t,e){return Sx(t,e)}function WS(t,e,n,r){this.tag=t,this.key=n,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 Hn(t,e,n,r){return new WS(t,e,n,r)}function xp(t){return t=t.prototype,!(!t||!t.isReactComponent)}function $S(t){if(typeof t=="function")return xp(t)?1:0;if(t!=null){if(t=t.$$typeof,t===kf)return 11;if(t===Of)return 14}return 2}function Ti(t,e){var n=t.alternate;return n===null?(n=Hn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deleti
vendor: 5,103 bytes, line 40
40ons=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function sc(t,e,n,r,i,s){var a=2;if(r=t,typeof t=="function")xp(t)&&(a=1);else if(typeof t=="string")a=5;else e:switch(t){case Gs:return os(n.children,i,s,e);case Uf:a=8,i|=8;break;case Ld:return t=Hn(12,n,e,i|2),t.elementType=Ld,t.lanes=s,t;case Id:return t=Hn(13,n,e,i),t.elementType=Id,t.lanes=s,t;case Dd:return t=Hn(19,n,e,i),t.elementType=Dd,t.lanes=s,t;case sx:return tu(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case rx:a=10;break e;case ix:a=9;break e;case kf:a=11;break e;case Of:a=14;break e;case li:a=16,r=null;break e}throw Error(re(130,t==null?t:typeof t,""))}return e=Hn(a,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function os(t,e,n,r){return t=Hn(7,t,r,e),t.lanes=n,t}function tu(t,e,n,r){return t=Hn(22,t,r,e),t.elementType=sx,t.lanes=n,t.stateNode={isHidden:!1},t}function Vu(t,e,n){return t=Hn(6,t,null,e),t.lanes=n,t}function ju(t,e,n){return e=Hn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function XS(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Su(0),this.expirationTimes=Su(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Su(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function vp(t,e,n,r,i,s,a,o,l){return t=new XS(t,e,n,o,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Hn(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},tp(s),t}function qS(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Hs,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function Yv(t){if(!t)return Ci;t=t._reactInternals;e:{if(gs(t)!==t||t.tag!==1)throw Error(re(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(_n(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(re(171))}if(t.tag===1){var n=t.type;if(_n(n))return Yx(t,n,e)}return e}function Jv(t,e,n,r,i,s,a,o,l){return t=vp(n,r,!0,t,i,s,a,o,l),t.context=Yv(null),n=t.current,r=cn(),i=Mi(n),s=jr(r,i),s.callback=e??null,bi(n,s,i),t.current.lanes=i,Go(t,i,r),yn(t,r),t}function nu(t,e,n,r){var i=e.current,s=cn(),a=Mi(i);return n=Yv(n),e.context===null?e.context=n:e.pendingContext=n,e=jr(s,a),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=bi(i,e,a),t!==null&&(ur(t,i,a,s),Ql(t,i,a)),a}function kc(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function l0(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function _p(t,e){l0(t,e),(t=t.alternate)&&l0(t,e)}function KS(){return null}var Zv=typeof reportError=="function"?reportError:function(t){console.error(t)};function yp(t){this._internalRoot=t}ru.prototype.render=yp.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(re(409));nu(t,e,null,null)};ru.prototype.unmount=yp.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;hs(function(){nu(null,t,null,null)}),e[Xr]=null}};function ru(t){this._internalRoot=t}ru.prototype.unstable_scheduleHydration=function(t){if(t){var e=Cx();t={blockedOn:null,target:t,priority:e};for(var n=0;n<hi.length&&e!==0&&e<hi[n].priority;n++);hi.splice(n,0,t),n===0&&Nx(t)}};function wp(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function iu(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function c0(){}function YS(t,e,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var c=kc(a);s.call(c)}}var a=Jv(e,r,t,0,null,!1,!1,"",c0);return t._reactRootContainer=a,t[Xr]=a.current,So(t.nodeType===8?t.parentNode:t),hs(),a}for(;i=t.lastChild;)t.removeChild(i);if(typeof r=="function"){var o=r;r=function(){var c=kc(l);o.call(c)}}var l=vp(t,0,!1,null,null,!1,!1,"",c0);return t._reactRootContainer=l,t[Xr]=l.current,So(t.nodeType===8?t.parentNode:t),hs(function(){nu(e,l,n,r)}),l}function su(t,e,n,r,i){var s=n._reactRootContainer;if(s){var a=s;if(typeof i=="function"){var o=i;i=function(){var l=kc(a);o.call(l)}}nu(e,a,t,i)}else a=YS(n,e,t,i,r);return kc(a)}Ax=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Ya(e.pendingLanes);
40n!==0&&(zf(e,n|1),yn(e,Lt()),!(Qe&6)&&(xa=Lt()+500,Di()))}break;case 13:hs(function(){var r=qr(t,1);if(r!==null){var i=cn();ur(r,t,1,i)}}),_p(t,1)}};Vf=function(t){if(t.tag===13){var e=qr(t,134217728);if(e!==null){var n=cn();ur(e,t,134217728,n)}_p(t,134217728)}};Rx=function(t){if(t.tag===13){var e=Mi(t),n=qr(t,e);if(n!==null){var r=cn();ur(n,t,e,r)}_p(t,e)}};Cx=function(){return it};Px=function(t,e){var n=it;try{return it=t,e()}finally{it=n}};Gd=function(t,e,n){switch(e){case"input":if(Od(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var i=Kc(r);if(!i)throw Error(re(90));ox(r),Od(r,i)}}}break;case"textarea":cx(t,n);break;case"select":e=n.value,e!=null&&na(t,!!n.multiple,e,!1)}};gx=pp;xx=hs;var JS={usingClientEntryPoint:!1,Events:[$o,qs,Kc,px,mx,pp]},za={findFiberByHostInstance:ts,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ZS={bundleType:za.bundleType,version:za.version,rendererPackageName:za.rendererPackageName,rendererConfig:za.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Zr.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=yx(t),t===null?null:t.stateNode},findFiberByHostInstance:za.findFiberByHostInstance||KS,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var wl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wl.isDisabled&&wl.supportsFiber)try{Wc=wl.inject(ZS),_r=wl}catch{}}Un.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=JS;Un.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wp(e))throw Error(re(200));return qS(t,e,null,n)};Un.createRoot=function(t,e){if(!wp(t))throw Error(re(299));var n=!1,r="",i=Zv;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(i=e.onRecoverableError)),e=vp(t,1,!1,null,null,n,!1,r,i),t[Xr]=e.current,So(t.nodeType===8?t.parentNode:t),new yp(e)};Un.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(re(188)):(t=Object.keys(t).join(","),Error(re(268,t)));return t=yx(e),t=t===null?null:t.stateNode,t};Un.flushSync=function(t){return hs(t)};Un.hydrate=function(t,e,n){if(!iu(e))throw Error(re(200));return su(null,t,e,!0,n)};Un.hydrateRoot=function(t,e,n){if(!wp(t))throw Error(re(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",a=Zv;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),e=Jv(e,null,t,1,n??null,i,!1,s,a),t[Xr]=e.current,So(t),r)for(t=0;t<r.length;t++)n=r[t],i=n._getVersion,i=i(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,i]:e.mutableSourceEagerHydrationData.push(n,i);return new ru(e)};Un.render=function(t,e,n){if(!iu(e))throw Error(re(200));return su(null,t,e,!1,n)};Un.unmountComponentAtNode=function(t){if(!iu(t))throw Error(re(40));return t._reactRootContainer?(hs(function(){su(null,null,t,!1,function(){t._reactRootContainer=null,t[Xr]=null})}),!0):!1};Un.unstable_batchedUpdates=pp;Un.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!iu(n))throw Error(re(200));if(t==null||t._reactInternals===void 0)throw Error(re(38));return su(t,e,n,!1,r)};Un.version="18.3.1-next-f1338f8080-20240426";function Qv(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Qv)}catch(t){console.error(t)}}Qv(),Qg.exports=Un;var QS=Qg.exports,e_,u0=QS;e_=u0.createRoot,u0.hydrateRoot;/**
41 * react-router v7.9.6
42 *
43 * Copyright (c) Remix Software Inc.
44 *
45 * This source code is licensed under the MIT license found in the
46 * LICENSE.md file in the root directory of this source tree.
47 *
48 * @license MIT
49 */var d0="popstate";function e1(t={}){function e(r,i){let{pathname:s,search:a,hash:o}=r.location;return bh("",{pathname:s,search:a,hash:o},i.state&&i.state.usr||null,i.state&&i.state.key||"default")}function n(r,i){return typeof i=="string"?i:No(i)}return n1(e,n,null,t)}function vt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function qn(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function t1(){return Math.random().toString(36).substring(2,10)}function h0(t,e){return{usr:t.state,key:t.key,idx:e}}function bh(t,e,n=null,r){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Ta(e):e,state:n,key:e&&e.key||r||t1()}}function No({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Ta(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function n1(t,e,n,r={}){let{window:i=document.defaultView,v5Compat:s=!1}=r,a=i.history,o="POP",l=null,c=u();c==null&&(c=0,a.replaceState({...a.state,idx:c},""));function u(){return(a.state||{idx:null}).idx}function d(){o="POP";let m=u(),h=m==null?null:m-c;c=m,l&&l({action:o,location:_.location,delta:h})}function f(m,h){o="PUSH";let v=bh(_.location,m,h);c=u()+1;let x=h0(v,c),w=_.createHref(v);try{a.pushState(x,"",w)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;i.location.assign(w)}s&&l&&l({action:o,location:_.location,delta:1})}function p(m,h){o="REPLACE";let v=bh(_.location,m,h);c=u();let x=h0(v,c),w=_.createHref(v);a.replaceState(x,"",w),s&&l&&l({action:o,location:_.location,delta:0})}function g(m){return r1(m)}let _={get action(){return o},get location(){return t(i,a)},listen(m){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(d0,d),l=m,()=>{i.removeEventListener(d0,d),l=null}},createHref(m){return e(i,m)},createURL:g,encodeLocation(m){let h=g(m);return{pathname:h.pathname,search:h.search,hash:h.hash}},push:f,replace:p,go(m){return a.go(m)}};return _}function r1(t,e=!1){let n="http://localhost";
49typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),vt(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:No(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function t_(t,e,n="/"){return i1(t,e,n,!1)}function i1(t,e,n,r){let i=typeof e=="string"?Ta(e):e,s=Yr(i.pathname||"/",n);if(s==null)return null;let a=n_(t);s1(a);let o=null;for(let l=0;o==null&&l<a.length;++l){let c=g1(s);o=p1(a[l],c,r)}return o}function n_(t,e=[],n=[],r="",i=!1){let s=(a,o,l=i,c)=>{let u={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(r)&&l)return;vt(u.relativePath.startsWith(r),`Absolute route path "${u.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(r.length)}let d=Hr([r,u.relativePath]),f=n.concat(u);a.children&&a.children.length>0&&(vt(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),n_(a.children,e,f,d,l)),!(a.path==null&&!a.index)&&e.push({path:d,score:h1(d,a.index),routesMeta:f})};return t.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))s(a,o);else for(let c of r_(a.path))s(a,o,!0,c)}),e}function r_(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return i?[s,""]:[s];let a=r_(r.join("/")),o=[];return o.push(...a.map(l=>l===""?s:[s,l].join("/"))),i&&o.push(...a),o.map(l=>t.startsWith("/")&&l===""?"/":l)}function s1(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:f1(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var a1=/^:[\w-]+$/,o1=3,l1=2,c1=1,u1=10,d1=-2,f0=t=>t==="*";function h1(t,e){let n=t.split("/"),r=n.length;return n.some(f0)&&(r+=d1),e&&(r+=l1),n.filter(i=>!f0(i)).reduce((i,s)=>i+(a1.test(s)?o1:s===""?c1:u1),r)}function f1(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function p1(t,e,n=!1){let{routesMeta:r}=t,i={},s="/",a=[];for(let o=0;o<r.length;++o){let l=r[o],c=o===r.length-1,u=s==="/"?e:e.slice(s.length)||"/",d=Oc({path:l.relativePath,caseSensitive:l.caseSensitive,end:c},u),f=l.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=Oc({path:l.relativePath,caseSensitive:l.caseSensitive,end:!1},u)),!d)return null;
49Object.assign(i,d.params),a.push({params:i,pathname:Hr([s,d.pathname]),pathnameBase:w1(Hr([s,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(s=Hr([s,d.pathnameBase]))}return a}function Oc(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=m1(t.path,t.caseSensitive,t.end),i=e.match(n);if(!i)return null;let s=i[0],a=s.replace(/(.)\/+$/,"$1"),o=i.slice(1);return{params:r.reduce((c,{paramName:u,isOptional:d},f)=>{if(u==="*"){let g=o[f]||"";a=s.slice(0,s.length-g.length).replace(/(.)\/+$/,"$1")}const p=o[f];return d&&!p?c[u]=void 0:c[u]=(p||"").replace(/%2F/g,"/"),c},{}),pathname:s,pathnameBase:a,pattern:t}}function m1(t,e=!1,n=!0){qn(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,o,l)=>(r.push({paramName:o,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function g1(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return qn(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Yr(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}var x1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,v1=t=>x1.test(t);function _1(t,e="/"){let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Ta(t):t,s;if(n)if(v1(n))s=n;else{if(n.includes("//")){let a=n;n=n.replace(/\/\/+/g,"/"),qn(!1,`Pathnames cannot have embedded double slashes - normalizing ${a} -> ${n}`)}n.startsWith("/")?s=p0(n.substring(1),"/"):s=p0(n,e)}else s=e;return{pathname:s,search:S1(r),hash:b1(i)}}function p0(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function Hu(t,e,n,r){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(r)}].  Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function y1(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Sp(t){let e=y1(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function bp(t,e,n,r=!1){let i;typeof t=="string"?i=Ta(t):(i={...t},vt(!i.pathname||!i.pathname.includes("?"),Hu("?","pathname","search",i)),vt(!i.pathname||!i.pathname.includes("#"),Hu("#","pathname","hash",i)),vt(!i.search||!i.search.includes("#"),Hu("#","search","hash",i)));let s=t===""||i.pathname==="",a=s?"/":i.pathname,o;if(a==null)o=n;else{let d=e.length-1;if(!r&&a.startsWith("..")){let f=a.split("/");for(;f[0]==="..";)f.shift(),d-=1;i.pathname=f.join("/")}o=d>=0?e[d]:"/"}let l=_1(i,o),c=a&&a!=="/"&&a.endsWith("/"),u=(s||a===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(c||u)&&(l.pathname+="/"),l}var Hr=t=>t.join("/").replace(/\/\/+/g,"/"),w1=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),S1=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,b1=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function E1(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var i_=["POST","PUT","PATCH","DELETE"];new Set(i_);var M1=["GET",...i_];new Set(M1);var Aa=k.createContext(null);Aa.displayName="DataRouter";var au=k.createContext(null);au.displayName="DataRouterState";k.createContext(!1);var s_=k.createContext({isTransitioning:!1});
49s_.displayName="ViewTransition";var T1=k.createContext(new Map);T1.displayName="Fetchers";var A1=k.createContext(null);A1.displayName="Await";var hr=k.createContext(null);hr.displayName="Navigation";var qo=k.createContext(null);qo.displayName="Location";var Mr=k.createContext({outlet:null,matches:[],isDataRoute:!1});Mr.displayName="Route";var Ep=k.createContext(null);Ep.displayName="RouteError";function R1(t,{relative:e}={}){vt(Ra(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=k.useContext(hr),{hash:i,pathname:s,search:a}=Yo(t,{relative:e}),o=s;return n!=="/"&&(o=s==="/"?n:Hr([n,s])),r.createHref({pathname:o,search:a,hash:i})}function Ra(){return k.useContext(qo)!=null}function Ui(){return vt(Ra(),"useLocation() may be used only in the context of a <Router> component."),k.useContext(qo).location}var a_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function o_(t){k.useContext(hr).static||k.useLayoutEffect(t)}function Ko(){let{isDataRoute:t}=k.useContext(Mr);return t?V1():C1()}function C1(){vt(Ra(),"useNavigate() may be used only in the context of a <Router> component.");let t=k.useContext(Aa),{basename:e,navigator:n}=k.useContext(hr),{matches:r}=k.useContext(Mr),{pathname:i}=Ui(),s=JSON.stringify(Sp(r)),a=k.useRef(!1);return o_(()=>{a.current=!0}),k.useCallback((l,c={})=>{if(qn(a.current,a_),!a.current)return;if(typeof l=="number"){n.go(l);return}let u=bp(l,JSON.parse(s),i,c.relative==="path");t==null&&e!=="/"&&(u.pathname=u.pathname==="/"?e:Hr([e,u.pathname])),(c.replace?n.replace:n.push)(u,c.state,c)},[e,n,s,i,t])}k.createContext(null);function Yo(t,{relative:e}={}){let{matches:n}=k.useContext(Mr),{pathname:r}=Ui(),i=JSON.stringify(Sp(n));return k.useMemo(()=>bp(t,JSON.parse(i),r,e==="path"),[t,i,r,e])}function P1(t,e){return l_(t,e)}function l_(t,e,n,r,i){var v;vt(Ra(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=k.useContext(hr),{matches:a}=k.useContext(Mr),o=a[a.length-1],l=o?o.params:{},c=o?o.pathname:"/",u=o?o.pathnameBase:"/",d=o&&o.route;{let x=d&&d.path||"";c_(c,!d||x.endsWith("*")||x.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${x}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
50
51Please change the parent <Route path="${x}"> to <Route path="${x==="/"?"*":`${x}/*`}">.`)}let f=Ui(),p;if(e){let x=typeof e=="string"?Ta(e):e;vt(u==="/"||((v=x.pathname)==null?void 0:v.startsWith(u)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${x.pathname}" was given in the \`location\` prop.`),p=x}else p=f;let g=p.pathname||"/",_=g;if(u!=="/"){let x=u.replace(/^\//,"").split("/");_="/"+g.replace(/^\//,"").split("/").slice(x.length).join("/")}let m=t_(t,{pathname:_});qn(d||m!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),qn(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=U1(m&&m.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:Hr([u,s.encodeLocation?s.encodeLocation(x.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?u:Hr([u,s.encodeLocation?s.encodeLocation(x.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:x.pathnameBase])})),a,n,r,i);return e&&h?k.createElement(qo.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...p},navigationType:"POP"}},h):h}function N1(){let t=z1(),e=E1(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",t),a=k.createElement(k.Fragment,null,k.createElement("p",null,"💿 Hey developer 👋"),k.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",k.createElement("code",{style:s},"ErrorBoundary")," or"," ",k.createElement("code",{style:s},"errorElement")," prop on your route.")),k.createElement(k.Fragment,null,k.createElement("h2",null,"Unexpected Application 
51Error!"),k.createElement("h3",{style:{fontStyle:"italic"}},e),n?k.createElement("pre",{style:i},n):null,a)}var L1=k.createElement(N1,null),I1=class extends k.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){return this.state.error!==void 0?k.createElement(Mr.Provider,{value:this.props.routeContext},k.createElement(Ep.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function D1({routeContext:t,match:e,children:n}){let r=k.useContext(Aa);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),k.createElement(Mr.Provider,{value:t},n)}function U1(t,e=[],n=null,r=null,i=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,a=n==null?void 0:n.errors;if(a!=null){let u=s.findIndex(d=>d.route.id&&(a==null?void 0:a[d.route.id])!==void 0);vt(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),s=s.slice(0,Math.min(s.length,u+1))}let o=!1,l=-1;if(n)for(let u=0;u<s.length;u++){let d=s[u];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(l=u),d.route.id){let{loaderData:f,errors:p}=n,g=d.route.loader&&!f.hasOwnProperty(d.route.id)&&(!p||p[d.route.id]===void 0);if(d.route.lazy||g){o=!0,l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}let c=n&&r?(u,d)=>{var f,p;r(u,{location:n.location,params:((p=(f=n.matches)==null?void 0:f[0])==null?void 0:p.params)??{},errorInfo:d})}:void 0;return s.reduceRight((u,d,f)=>{let p,g=!1,_=null,m=null;n&&(p=a&&d.route.id?a[d.route.id]:void 0,_=d.route.errorElement||L1,o&&(l<0&&f===0?(c_("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),g=!0,m=null):l===f&&(g=!0,m=d.route.hydrateFallbackElement||null)));let h=e.concat(s.slice(0,f+1)),v=()=>{let x;return p?x=_:g?x=m:d.route.Component?x=k.createElement(d.route.Component,null):d.route.element?x=d.route.element:x=u,k.createElement(D1,{match:d,routeContext:{outlet:u,matches:h,isDataRoute:n!=null},children:x})};return n&&(d.route.ErrorBoundary||d.route.errorElement||f===0)?k.createElement(I1,{location:n.location,revalidation:n.revalidation,component:_,error:p,children:v(),routeContext:{outlet:null,matches:h,isDataRoute:!0},onError:c}):v()},null)}function Mp(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function k1(t){let e=k.useContext(Aa);return vt(e,Mp(t)),e}function O1(t){let e=k.useContext(au);return vt(e,Mp(t)),e}function F1(t){let e=k.useContext(Mr);return vt(e,Mp(t)),e}function Tp(t){let e=F1(t),n=e.matches[e.matches.length-1];return vt(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function B1(){return Tp("useRouteId")}function z1(){var r;let t=k.useContext(Ep),e=O1("useRouteError"),n=Tp("useRouteError");return t!==void 0?t:(r=e.errors)==null?void 0:r[n]}function V1(){let{router:t}=k1("useNavigate"),e=Tp("useNavigate"),n=k.useRef(!1);return o_(()=>{n.current=!0}),k.useCallback(async(i,s={})=>{qn(n.current,a_),n.current&&(typeof i=="number"?t.navigate(i):await t.navigate(i,{fromRouteId:e,...s}))},[t,e])}var m0={};function c_(t,e,n){!e&&!m0[t]&&(m0[t]=!0,qn(!1,n))}k.memo(j1);function j1({routes:t,future:e,state:n,unstable_onError:r}){return l_(t,void 0,n,r,e)}function u_({to:t,replace:e,state:n,relative:r}){vt(Ra(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=k.useContext(hr);qn(!i,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=k.useContext(Mr),{pathname:a}=Ui(),o=Ko(),l=bp(t,Sp(s),a,r==="path"),c=JSON.stringify(l);return k.useEffect(()=>{o(JSON.parse(c),{replace:e,state:n,relative:r})},[o,c,r,e,n]),null}function oi(t){vt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function H1({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:i,static:s=!1}
51){vt(!Ra(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let a=t.replace(/^\/*/,"/"),o=k.useMemo(()=>({basename:a,navigator:i,static:s,future:{}}),[a,i,s]);typeof n=="string"&&(n=Ta(n));let{pathname:l="/",search:c="",hash:u="",state:d=null,key:f="default"}=n,p=k.useMemo(()=>{let g=Yr(l,a);return g==null?null:{location:{pathname:g,search:c,hash:u,state:d,key:f},navigationType:r}},[a,l,c,u,d,f,r]);return qn(p!=null,`<Router basename="${a}"> is not able to match the URL "${l}${c}${u}" because it does not start with the basename, so the <Router> won't render anything.`),p==null?null:k.createElement(hr.Provider,{value:o},k.createElement(qo.Provider,{children:e,value:p}))}function G1({children:t,location:e}){return P1(Eh(t),e)}function Eh(t,e=[]){let n=[];return k.Children.forEach(t,(r,i)=>{if(!k.isValidElement(r))return;let s=[...e,i];if(r.type===k.Fragment){n.push.apply(n,Eh(r.props.children,s));return}vt(r.type===oi,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),vt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=Eh(r.props.children,s)),n.push(a)}),n}var ac="get",oc="application/x-www-form-urlencoded";function ou(t){return t!=null&&typeof t.tagName=="string"}function W1(t){return ou(t)&&t.tagName.toLowerCase()==="button"}function $1(t){return ou(t)&&t.tagName.toLowerCase()==="form"}function X1(t){return ou(t)&&t.tagName.toLowerCase()==="input"}function q1(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function K1(t,e){return t.button===0&&(!e||e==="_self")&&!q1(t)}var Sl=null;function Y1(){if(Sl===null)try{new FormData(document.createElement("form"),0),Sl=!1}catch{Sl=!0}return Sl}var J1=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Gu(t){return t!=null&&!J1.has(t)?(qn(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${oc}"`),null):t}function Z1(t,e){let n,r,i,s,a;if($1(t)){let o=t.getAttribute("action");r=o?Yr(o,e):null,n=t.getAttribute("method")||ac,i=Gu(t.getAttribute("enctype"))||oc,s=new FormData(t)}else if(W1(t)||X1(t)&&(t.type==="submit"||t.type==="image")){let o=t.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let l=t.getAttribute("formaction")||o.getAttribute("action");if(r=l?Yr(l,e):null,n=t.getAttribute("formmethod")||o.getAttribute("method")||ac,i=Gu(t.getAttribute("formenctype"))||Gu(o.getAttribute("enctype"))||oc,s=new FormData(o,t),!Y1()){let{name:c,type:u,value:d}=t;if(u==="image"){let f=c?`${c}.`:"";s.append(`${f}x`,"0"),s.append(`${f}y`,"0")}else c&&s.append(c,d)}}else{if(ou(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=ac,r=null,i=oc,a=t}return s&&i==="text/plain"&&(a=s,s=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:s,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Ap(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Q1(t,e,n){let r=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return r.pathname==="/"?r.pathname=`_root.${n}`:e&&Yr(r.pathname,e)==="/"?r.pathname=`${e.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function eb(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.
51isSpaMode,window.location.reload(),new Promise(()=>{})}}function tb(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function nb(t,e,n){let r=await Promise.all(t.map(async i=>{let s=e.routes[i.route.id];if(s){let a=await eb(s,n);return a.links?a.links():[]}return[]}));return ab(r.flat(1).filter(tb).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function g0(t,e,n,r,i,s){let a=(l,c)=>n[c]?l.route.id!==n[c].route.id:!0,o=(l,c)=>{var u;return n[c].pathname!==l.pathname||((u=n[c].route.path)==null?void 0:u.endsWith("*"))&&n[c].params["*"]!==l.params["*"]};return s==="assets"?e.filter((l,c)=>a(l,c)||o(l,c)):s==="data"?e.filter((l,c)=>{var d;let u=r.routes[l.route.id];if(!u||!u.hasLoader)return!1;if(a(l,c)||o(l,c))return!0;if(l.route.shouldRevalidate){let f=l.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:((d=n[0])==null?void 0:d.params)||{},nextUrl:new URL(t,window.origin),nextParams:l.params,defaultShouldRevalidate:!0});if(typeof f=="boolean")return f}return!0}):[]}function rb(t,e,{includeHydrateFallback:n}={}){return ib(t.map(r=>{let i=e.routes[r.route.id];if(!i)return[];let s=[i.module];return i.clientActionModule&&(s=s.concat(i.clientActionModule)),i.clientLoaderModule&&(s=s.concat(i.clientLoaderModule)),n&&i.hydrateFallbackModule&&(s=s.concat(i.hydrateFallbackModule)),i.imports&&(s=s.concat(i.imports)),s}).flat(1))}function ib(t){return[...new Set(t)]}function sb(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function ab(t,e){let n=new Set;return new Set(e),t.reduce((r,i)=>{let s=JSON.stringify(sb(i));return n.has(s)||(n.add(s),r.push({key:s,link:i})),r},[])}function d_(){let t=k.useContext(Aa);return Ap(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function ob(){let t=k.useContext(au);return Ap(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Rp=k.createContext(void 0);Rp.displayName="FrameworkContext";function h_(){let t=k.useContext(Rp);return Ap(t,"You must render this element inside a <HydratedRouter> element"),t}function lb(t,e){let n=k.useContext(Rp),[r,i]=k.useState(!1),[s,a]=k.useState(!1),{onFocus:o,onBlur:l,onMouseEnter:c,onMouseLeave:u,onTouchStart:d}=e,f=k.useRef(null);k.useEffect(()=>{if(t==="render"&&a(!0),t==="viewport"){let _=h=>{h.forEach(v=>{a(v.isIntersecting)})},m=new IntersectionObserver(_,{threshold:.5});return f.current&&m.observe(f.current),()=>{m.disconnect()}}},[t]),k.useEffect(()=>{if(r){let _=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(_)}}},[r]);let p=()=>{i(!0)},g=()=>{i(!1),a(!1)};return n?t!=="intent"?[s,f,{}]:[s,f,{onFocus:Va(o,p),onBlur:Va(l,g),onMouseEnter:Va(c,p),onMouseLeave:Va(u,g),onTouchStart:Va(d,p)}]:[!1,f,{}]}function Va(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function cb({page:t,...e}){let{router:n}=d_(),r=k.useMemo(()=>t_(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?k.createElement(db,{page:t,matches:r,...e}):null}function ub(t){let{manifest:e,routeModules:n}=h_(),[r,i]=k.useState([]);return k.useEffect(()=>{let s=!1;return nb(t,e,n).then(a=>{s||i(a)}),()=>{s=!0}},[t,e,n]),r}function db({page:t,matches:e,...n}){let r=Ui(),{manifest:i,routeModules:s}=h_(),{basename:a}=d_(),{loaderData:o,matches:l}=ob(),c=k.useMemo(()=>g0(t,e,l,i,r,"data"),[t,e,l,i,r]),u=k.useMemo(()=>g0(t,e,l,i,r,"assets"),[t,e,l,i,r]),d=k.useMemo(()=>{if(t===r.pathname+r.search+r.hash)return[];let g=new Set,_=!1;if(e.forEach(h=>{var x;let v=i.routes[h.route.id];!v||!v.hasLoader||(!c.some(w=>w.route.id===h.route.id)&&h.route.id in o&&((x=s[h.route.id])!=null&&x.shouldRevalidate)||v.hasClientLoader?_=!0:g.add(h.route.id))}),g.size===0)return[];let m=Q1(t,a,"data");return _&&g.size>0&&m.searchParams.set("_routes",e.filter(h=>g.has(h.route.id)).map(h=>h.route.id).join(",")),[m.pathname+m.search]},[a,o,r,i,c,e,t,s]),f=k.useMemo(()=>rb(u,i),[u,i]),p=ub(u);return k.createElement(k.Fragment,null,d.map(g=>k.createElement("link",{key:g,rel:"prefetch",as:"fetch",href:g,...n})),f.map(g=>k.createElement("link",{key:g,rel:"modulepreload",href:g,...n})),p.map(({key:g,link:_})=>k.createElement("link",{key:g,nonce:n.nonce,..._})))}function hb(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var f_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{f_&&(window.__reactRouterVersion="7.9.6")}catch{}function fb({basename:t,children:e,window:n}){let r=k.useRef();r.current==null&&(r.current=e1({window:n,v5Compat:!0}));let i=r.current,[s,a]=k.useState({action:i.action,location:i.location}),o=k.useCallback(l=>{k.startTransition(()=>a(l))},[a]);return k.useLayoutEffect(()=>i.listen(o),[i,o]),k.createElement(H1,{basename:t,children:e,location:s.location,navigationType:s.action,navigator:i})}
51var p_=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Pi=k.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:i,reloadDocument:s,replace:a,state:o,target:l,to:c,preventScrollReset:u,viewTransition:d,...f},p){let{basename:g}=k.useContext(hr),_=typeof c=="string"&&p_.test(c),m,h=!1;if(typeof c=="string"&&_&&(m=c,f_))try{let M=new URL(window.location.href),b=c.startsWith("//")?new URL(M.protocol+c):new URL(c),N=Yr(b.pathname,g);b.origin===M.origin&&N!=null?c=N+b.search+b.hash:h=!0}catch{qn(!1,`<Link to="${c}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let v=R1(c,{relative:i}),[x,w,A]=lb(r,f),E=xb(c,{replace:a,state:o,target:l,preventScrollReset:u,relative:i,viewTransition:d});function R(M){e&&e(M),M.defaultPrevented||E(M)}let P=k.createElement("a",{...f,...A,href:m||v,onClick:h||s?e:R,ref:hb(p,w),target:l,"data-discover":!_&&n==="render"?"true":void 0});return x&&!_?k.createElement(k.Fragment,null,P,k.createElement(cb,{page:v})):P});Pi.displayName="Link";var pb=k.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:i=!1,style:s,to:a,viewTransition:o,children:l,...c},u){let d=Yo(a,{relative:c.relative}),f=Ui(),p=k.useContext(au),{navigator:g,basename:_}=k.useContext(hr),m=p!=null&&Sb(d)&&o===!0,h=g.encodeLocation?g.encodeLocation(d).pathname:d.pathname,v=f.pathname,x=p&&p.navigation&&p.navigation.location?p.navigation.location.pathname:null;n||(v=v.toLowerCase(),x=x?x.toLowerCase():null,h=h.toLowerCase()),x&&_&&(x=Yr(x,_)||x);const w=h!=="/"&&h.endsWith("/")?h.length-1:h.length;let A=v===h||!i&&v.startsWith(h)&&v.charAt(w)==="/",E=x!=null&&(x===h||!i&&x.startsWith(h)&&x.charAt(h.length)==="/"),R={isActive:A,isPending:E,isTransitioning:m},P=A?e:void 0,M;typeof r=="function"?M=r(R):M=[r,A?"active":null,E?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let b=typeof s=="function"?s(R):s;return k.createElement(Pi,{...c,"aria-current":P,className:M,ref:u,style:b,to:a,viewTransition:o},typeof l=="function"?l(R):l)});pb.displayName="NavLink";var mb=k.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:i,state:s,method:a=ac,action:o,onSubmit:l,relative:c,preventScrollReset:u,viewTransition:d,...f},p)=>{let g=yb(),_=wb(o,{relative:c}
51),m=a.toLowerCase()==="get"?"get":"post",h=typeof o=="string"&&p_.test(o),v=x=>{if(l&&l(x),x.defaultPrevented)return;x.preventDefault();let w=x.nativeEvent.submitter,A=(w==null?void 0:w.getAttribute("formmethod"))||a;g(w||x.currentTarget,{fetcherKey:e,method:A,navigate:n,replace:i,state:s,relative:c,preventScrollReset:u,viewTransition:d})};return k.createElement("form",{ref:p,method:m,action:_,onSubmit:r?l:v,...f,"data-discover":!h&&t==="render"?"true":void 0})});mb.displayName="Form";function gb(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function m_(t){let e=k.useContext(Aa);return vt(e,gb(t)),e}function xb(t,{target:e,replace:n,state:r,preventScrollReset:i,relative:s,viewTransition:a}={}){let o=Ko(),l=Ui(),c=Yo(t,{relative:s});return k.useCallback(u=>{if(K1(u,e)){u.preventDefault();let d=n!==void 0?n:No(l)===No(c);o(t,{replace:d,state:r,preventScrollReset:i,relative:s,viewTransition:a})}},[l,o,c,n,r,e,t,i,s,a])}var vb=0,_b=()=>`__${String(++vb)}__`;function yb(){let{router:t}=m_("useSubmit"),{basename:e}=k.useContext(hr),n=B1();return k.useCallback(async(r,i={})=>{let{action:s,method:a,encType:o,formData:l,body:c}=Z1(r,e);if(i.navigate===!1){let u=i.fetcherKey||_b();await t.fetch(u,n,i.action||s,{preventScrollReset:i.preventScrollReset,formData:l,body:c,formMethod:i.method||a,formEncType:i.encType||o,flushSync:i.flushSync})}else await t.navigate(i.action||s,{preventScrollReset:i.preventScrollReset,formData:l,body:c,formMethod:i.method||a,formEncType:i.encType||o,replace:i.replace,state:i.state,fromRouteId:n,flushSync:i.flushSync,viewTransition:i.viewTransition})},[t,e,n])}function wb(t,{relative:e}={}){let{basename:n}=k.useContext(hr),r=k.useContext(Mr);vt(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),s={...Yo(t||".",{relative:e})},a=Ui();if(t==null){s.search=a.search;let o=new URLSearchParams(s.search),l=o.getAll("index");if(l.some(u=>u==="")){o.delete("index"),l.filter(d=>d).forEach(d=>o.append("index",d));let u=o.toString();s.search=u?`?${u}
51`:""}}return(!t||t===".")&&i.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:Hr([n,s.pathname])),No(s)}function Sb(t,{relative:e}={}){let n=k.useContext(s_);vt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=m_("useViewTransitionState"),i=Yo(t,{relative:e});if(!n.isTransitioning)return!1;let s=Yr(n.currentLocation.pathname,r)||n.currentLocation.pathname,a=Yr(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Oc(i.pathname,a)!=null||Oc(i.pathname,s)!=null}const x0="santa-game-device-id";function g_(){const[t,e]=k.useState("");return k.useEffect(()=>{let n=localStorage.getItem(x0);n||(n=crypto.randomUUID(),localStorage.setItem(x0,n)),e(n)},[]),t}function lu(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function bb(t,e,n,r){function i(s){return s instanceof n?s:new n(function(a){a(s)})}return new(n||(n=Promise))(function(s,a){function o(u){try{c(r.next(u))}catch(d){a(d)}}function l(u){try{c(r.throw(u))}catch(d){a(d)}}function c(u){u.done?s(u.value):i(u.value).then(o,l)}c((r=r.apply(t,e||[])).next())})}const Eb=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class Cp extends Error{constructor(e,n="FunctionsError",r){super(e),this.name=n,this.context=r}}class Mb extends Cp{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class v0 extends Cp{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class _0 extends Cp{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Mh;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Mh||(Mh={}));class Tb{constructor(e,{headers:n={},customFetch:r,region:i=Mh.Any}={}){this.url=e,this.headers=n,this.region=i,this.fetch=Eb(r)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return bb(this,arguments,void 0,function*(n,r={}){var i;let s,a;try{const{headers:o,method:l,body:c,signal:u,timeout:d}=r;let f={},{region:p}=r;p||(p=this.region);const g=new URL(`${this.url}/${n}`);p&&p!=="any"&&(f["x-region"]=p,g.searchParams.set("forceFunctionRegion",p));let _;c&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(f["Content-Type"]="application/octet-stream",_=c):typeof c=="string"?(f["Content-Type"]="text/plain",_=c):typeof FormData<"u"&&c instanceof FormData?_=c:(f["Content-Type"]="application/json",_=JSON.stringify(c)):_=c;let m=u;d&&(a=new AbortController,s=setTimeout(()=>a.abort(),d),u?(m=a.signal,u.addEventListener("abort",()=>a.abort())):m=a.signal);const h=yield this.fetch(g.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},f),this.headers),o),body:_,signal:m}).catch(A=>{throw new Mb(A)}),v=h.headers.get("x-relay-error");if(v&&v==="true")throw new v0(h);if(!h.ok)throw new _0(h);let x=((i=h.headers.get("Content-Type"))!==null&&i!==void 0?i:"text/plain").split(";")[0].trim(),w;return x==="application/json"?w=yield h.json():x==="application/octet-stream"||x==="application/pdf"?w=yield h.blob():x==="text/event-stream"?w=h:x==="multipart/form-data"?w=yield h.formData():w=yield h.text(),{data:w,error:null,response:h}}catch(o){return{data:null,error:o,response:o instanceof _0||o instanceof v0?o.context:void 0}}finally{s&&clearTimeout(s)}})}}var Ab=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.co
51de=t.code}},Rb=class{constructor(t){var e,n;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(n=t.isMaybeSingle)!==null&&n!==void 0?n:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){var n=this;this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const r=this.fetch;let i=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async s=>{let a=null,o=null,l=null,c=s.status,u=s.statusText;if(s.ok){var d,f;if(n.method!=="HEAD"){var p;const h=await s.text();h===""||(n.headers.get("Accept")==="text/csv"||n.headers.get("Accept")&&(!((p=n.headers.get("Accept"))===null||p===void 0)&&p.includes("application/vnd.pgrst.plan+text"))?o=h:o=JSON.parse(h))}const _=(d=n.headers.get("Prefer"))===null||d===void 0?void 0:d.match(/count=(exact|planned|estimated)/),m=(f=s.headers.get("content-range"))===null||f===void 0?void 0:f.split("/");_&&m&&m.length>1&&(l=parseInt(m[1])),n.isMaybeSingle&&n.method==="GET"&&Array.isArray(o)&&(o.length>1?(a={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,l=null,c=406,u="Not Acceptable"):o.length===1?o=o[0]:o=null)}else{var g;const _=await s.text();try{a=JSON.parse(_),Array.isArray(a)&&s.status===404&&(o=[],a=null,c=200,u="OK")}catch{s.status===404&&_===""?(c=204,u="No Content"):a={message:_}}if(a&&n.isMaybeSingle&&(!(a==null||(g=a.details)===null||g===void 0)&&g.includes("0 rows"))&&(a=null,c=200,u="OK"),a&&n.shouldThrowOnError)throw new Ab(a)}return{error:a,data:o,count:l,status:c,statusText:u}});return this.shouldThrowOnError||(i=i.catch(s=>{var a;let o="";const l=s==null?void 0:s.cause;if(l){var c,u,d,f;const g=(c=l==null?void 0:l.message)!==null&&c!==void 0?c:"",_=(u=l==null?void 0:l.code)!==null&&u!==void 0?u:"";o=`${(d=s==null?void 0:s.name)!==null&&d!==void 0?d:"FetchError"}: ${s==null?void 0:s.message}`,o+=`
52
53Caused by: ${(f=l==null?void 0:l.name)!==null&&f!==void 0?f:"Error"}: ${g}`,_&&(o+=` (${_})`),l!=null&&l.stack&&(o+=`
54${l.stack}`)}else{var p;o=(p=s==null?void 0:s.stack)!==null&&p!==void 0?p:""}return{error:{message:`${(a=s==null?void 0:s.name)!==null&&a!==void 0?a:"FetchError"}: ${s==null?void 0:s.message}`,details:o,hint:"",code:""},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}returns(){return this}overrideTypes(){return this}},Cb=class extends Rb{select(t){let e=!1;const n=(t??"*").split("").map(r=>/\s/.test(r)&&!e?"":(r==='"'&&(e=!e),r)).join("");return this.url.searchParams.set("select",n),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:n,foreignTable:r,referencedTable:i=r}={}){const s=i?`${i}.order`:"order",a=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${a?`${a},`:""}${t}.${e?"asc":"desc"}${n===void 0?"":n?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:n=e}={}){const r=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(r,`${t}`),this}range(t,e,{foreignTable:n,referencedTable:r=n}={}){const i=typeof r>"u"?"offset":`${r}.offset`,s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(s,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
54explain({analyze:t=!1,verbose:e=!1,settings:n=!1,buffers:r=!1,wal:i=!1,format:s="text"}={}){var a;const o=[t?"analyze":null,e?"verbose":null,n?"settings":null,r?"buffers":null,i?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${l}"; options=${o};`),s==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const y0=new RegExp("[,()]");var zs=class extends Cb{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const n=Array.from(new Set(e)).map(r=>typeof r=="string"&&y0.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`in.(${n})`),this}notIn(t,e){const n=Array.from(new Set(e)).map(r=>typeof r=="string"&&y0.test(r)?`"${r}"`:`${r}`).join(",");return this.url.searchParams.append(t,`not.in.(${n})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:n,type:r}={}){let i="";r==="plain"?i="pl":r==="phrase"?i="ph":r==="websearch"&&(i="w");const s=n===void 0?"":`(${n})`;return this.url.searchParams.append(t,`${i}fts${s}.${e}`),this}match(t){return Object.entries(t).forEach(([e,n])=>{this.url.searchParams.append(e,`eq.${n}`)}),this}not(t,e,n){return this.url.searchParams.append(t,`not.${e}.${n}`),this}or(t,{foreignTable:e,referencedTable:n=e}={}){const r=n?`${n}.or`:"or";return this.url.searchParams.append(r,`(${t})`),this}filter(t,e,n){return this.url.searchParams.append(t,`${e}.${n}`),this}},Pb=class{constructor(t,{headers:e={},schema:n,fetch:r}){this.url=t,this.headers=new Headers(e),this.schema=n,this.fetch=r}select(t,e){const{head:n=!1,count:r}=e??{},i=n?"HEAD":"GET";let s=!1;const a=(t??"*").split("").map(o=>/\s/.test(o)&&!s?"":(o==='"'&&(s=!s),o)).join("");return this.url.searchParams.set("select",a),r&&this.headers.append("Prefer",`count=${r}`),new zs({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:n=!0}={}){var r;const i="POST";if(e&&this.headers.append("Prefer",`count=${e}`),n||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const s=t.reduce((a,o)=>a.concat(Object.keys(o)),[]);if(s.length>0){const a=[...new Set(s)].map(o=>`"${o}"`);this.url.searchParams.set("columns",a.join(","))}}return new zs({method:i,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:n=!1,count:r,defaultToNull:i=!0}={}){var s;const a="POST";if(this.headers.append("Prefer",`resolution=${n?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),r&&this.headers.append("Prefer",`count=${r}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(t)){const o=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(o.length>0){const l=[...new Set(o)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new zs({method:a,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}update(t,{count:e}={}){var n;const r="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new zs({method:r,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}delete({count:t}={}){var e;const n="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new zs({method:n,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}},Nb=class x_{constructor(e,{headers:n={},schema:r,fetch:i}={}){this.url=e,this.headers=new Headers(n),this.schemaName=r,this.fetch=i}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Pb(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new x_(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,n={},{head:r=!1,get:i=!1,count:s}={}){var a;let o;const l=new URL(`${this.url}/rpc/${e}`);let c;r||i?(o=r?"HEAD":"GET",Object.entries(n).filter(([d,f])=>f!==void 0).map(([d,f])=>[d,Array.isArray(f)?`{${f.join(",")}}`:`${f}
54`]).forEach(([d,f])=>{l.searchParams.append(d,f)})):(o="POST",c=n);const u=new Headers(this.headers);return s&&u.set("Prefer",`count=${s}`),new zs({method:o,url:l,headers:u,schema:this.schemaName,body:c,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}};class Lb{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",constructor:WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocket<"u")return{type:"native",constructor:globalThis.WebSocket};if(typeof global<"u"&&typeof global.WebSocket<"u")return{type:"native",constructor:global.WebSocket};if(typeof globalThis<"u"&&typeof globalThis.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&globalThis.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(typeof process<"u"){const n=process.versions;if(n&&n.node){const r=n.node,i=parseInt(r.replace(/^v/,"").split(".")[0]);return i>=22?typeof globalThis.WebSocket<"u"?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${i} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${i} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
55import ws from "ws"
56new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.constructor)return e.constructor;let n=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(n+=`
57
58Suggested solution: ${e.workaround}`),new Error(n)}static createWebSocket(e,n){const r=this.getWebSocketConstructor();return new r(e,n)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const Ib="0.0.0-automated",Db=`realtime-js/${Ib}`,v_="1.0.0",Ub="2.0.0",w0=v_,Th=1e4,kb=1e3,Ob=100;var ui;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(ui||(ui={}));var Ot;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(Ot||(Ot={}));var ir;(function(t){t.close="phx_close",t.error="phx_error",t.join="phx_join",t.reply="phx_reply",t.leave="phx_leave",t.access_token="access_token"})(ir||(ir={}));var Ah;(function(t){t.websocket="websocket"})(Ah||(Ah={}));var Yi;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Yi||(Yi={}));class Fb{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,n){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return n(this._binaryEncodeUserBroadcastPush(e));let r=[e.join_ref,e.ref,e.topic,e.event,e.payload];return n(JSON.stringify(r))}_binaryEncodeUserBroadcastPush(e){var n;return this._isArrayBuffer((n=e.payload)===null||n===void 0?void 0:n.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var n,r;const i=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,i)}_encodeJsonUserBroadcastPush(e){var n,r;const i=(r=(n=e.payload)===null||n===void 0?void 0:n.payload)!==null&&r!==void 0?r:{},a=new TextEncoder().encode(JSON.stringify(i)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,a)}_encodeUserBroadcastPush(e,n,r){var i,s;const a=e.topic,o=(i=e.ref)!==null&&i!==void 0?i:"",l=(s=e.join_ref)!==null&&s!==void 0?s:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},d=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`ref length ${o.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`topic length ${a.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(d.length>255)throw new Error(`metadata length ${d.length} exceeds maximum of 255`);const f=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+o.length+a.length+c.length+d.length,p=new ArrayBuffer(this.HEADER_LENGTH+f);let g=new DataView(p),_=0;g.setUint8(_++,this.KINDS.userBroadcastPush),g.setUint8(_++,l.length),g.setUint8(_++,o.length),g.setUint8(_++,a.length),g.setUint8(_++,c.length),g.setUint8(_++,d.length),g.setUint8(_++,n),Array.from(l,h=>g.setUint8(_++,h.charCodeAt(0))),Array.from(o,h=>g.setUint8(_++,h.charCodeAt(0))),Array.from(a,h=>g.setUint8(_++,h.charCodeAt(0))),Array.from(c,h=>g.setUint8(_++,h.charCodeAt(0))),Array.from(d,h=>g.setUint8(_++,h.charCodeAt(0)));var m=new Uint8Array(p.byteLength+r.byteLength);return m.set(new Uint8Array(p),0),m.set(new Uint8Array(r),p.byteLength),m.buffer}decode(e,n){if(this._isArrayBuffer(e)){let r=this._binaryDecode(e);return n(r)}if(typeof e=="string"){const r=JSON.parse(e),[i,s,a,o,l]=r;
58return n({join_ref:i,ref:s,topic:a,event:o,payload:l})}return n({})}_binaryDecode(e){const n=new DataView(e),r=n.getUint8(0),i=new TextDecoder;switch(r){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,n,i)}}_decodeUserBroadcast(e,n,r){const i=n.getUint8(1),s=n.getUint8(2),a=n.getUint8(3),o=n.getUint8(4);let l=this.HEADER_LENGTH+4;const c=r.decode(e.slice(l,l+i));l=l+i;const u=r.decode(e.slice(l,l+s));l=l+s;const d=r.decode(e.slice(l,l+a));l=l+a;const f=e.slice(l,e.byteLength),p=o===this.JSON_ENCODING?JSON.parse(r.decode(f)):f,g={type:this.BROADCAST_EVENT,event:u,payload:p};return a>0&&(g.meta=JSON.parse(d)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:g}}_isArrayBuffer(e){var n;return e instanceof ArrayBuffer||((n=e==null?void 0:e.constructor)===null||n===void 0?void 0:n.name)==="ArrayBuffer"}_pick(e,n){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([r])=>n.includes(r)))}}class __{constructor(e,n){this.callback=e,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=n}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}var dt;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(dt||(dt={}));const S0=(t,e,n={})=>{var r;const i=(r=n.skipTypes)!==null&&r!==void 0?r:[];return e?Object.keys(e).reduce((s,a)=>(s[a]=Bb(a,t,e,i),s),{}):{}},Bb=(t,e,n,r)=>{const i=e.find(o=>o.name===t),s=i==null?void 0:i.type,a=n[t];return s&&!r.includes(s)?y_(s,a):Rh(a)},y_=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return Hb(e,n)}switch(t){case dt.bool:return zb(e);case dt.float4:case dt.float8:case dt.int2:case dt.int4:case dt.int8:case dt.numeric:case dt.oid:return Vb(e);case dt.json:case dt.jsonb:return jb(e);case dt.timestamp:return Gb(e);case dt.abstime:case dt.date:case dt.daterange:case dt.int4range:case dt.int8range:case dt.money:case dt.reltime:case dt.text:case dt.time:case dt.timestamptz:case dt.timetz:case dt.tsrange:case dt.tstzrange:return Rh(e);default:return Rh(e)}},Rh=t=>t,zb=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},Vb=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},jb=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},Hb=(t,e)=>{if(typeof t!="string")return t;const n=t.length-1,r=t[n];if(t[0]==="{"&&r==="}"){let s;const a=t.slice(1,n);try{s=JSON.parse("["+a+"]")}catch{s=a?a.split(","):[]}return s.map(o=>y_(e,o))}return t},Gb=t=>typeof t=="string"?t.replace(" ","T"):t,w_=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class Wu{constructor(e,n,r={},i=Th){this.channel=e,this.event=n,this.payload=r,this.timeout=i,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var r;return this._hasReceived(e)&&n((r=this.receivedResp)===null||r===void 0?void 0:r.response),this.recHo
58oks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(r=>r.status===e).forEach(r=>r.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var b0;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(b0||(b0={}));class uo{constructor(e,n){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};const r=(n==null?void 0:n.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},i=>{const{onJoin:s,onLeave:a,onSync:o}=this.caller;this.joinRef=this.channel._joinRef(),this.state=uo.syncState(this.state,i,s,a),this.pendingDiffs.forEach(l=>{this.state=uo.syncDiff(this.state,l,s,a)}),this.pendingDiffs=[],o()}),this.channel._on(r.diff,{},i=>{const{onJoin:s,onLeave:a,onSync:o}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(i):(this.state=uo.syncDiff(this.state,i,s,a),o())}),this.onJoin((i,s,a)=>{this.channel._trigger("presence",{event:"join",key:i,currentPresences:s,newPresences:a})}),this.onLeave((i,s,a)=>{this.channel._trigger("presence",{event:"leave",key:i,currentPresences:s,leftPresences:a})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,r,i){const s=this.cloneDeep(e),a=this.transformState(n),o={},l={};return this.map(s,(c,u)=>{a[c]||(l[c]=u)}),this.map(a,(c,u)=>{const d=s[c];if(d){const f=u.map(m=>m.presence_ref),p=d.map(m=>m.presence_ref),g=u.filter(m=>p.indexOf(m.presence_ref)<0),_=d.filter(m=>f.indexOf(m.presence_ref)<0);g.length>0&&(o[c]=g),_.length>0&&(l[c]=_)}else o[c]=u}),this.syncDiff(s,{joins:o,leaves:l},r,i)}static syncDiff(e,n,r,i){const{joins:s,leaves:a}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return r||(r=()=>{}),i||(i=()=>{}),this.map(s,(o,l)=>{var c;const u=(c=e[o])!==null&&c!==void 0?c:[];if(e[o]=this.cloneDeep(l),u.length>0){const d=e[o].map(p=>p.presence_ref),f=u.filter(p=>d.indexOf(p.presence_ref)<0);e[o].unshift(...f)}r(o,u,l)}),this.map(a,(o,l)=>{let c=e[o];if(!c)return;const u=l.map(d=>d.presence_ref);c=c.filter(d=>u.indexOf(d.presence_ref)<0),e[o]=c,i(o,c,l),c.length===0&&delete e[o]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(r=>n(r,e[r]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,r)=>{const i=e[r];return"metas"in i?n[r]=i.metas.map(s=>(s.presence_ref=s.phx_ref,delete s.phx_ref,delete s.phx_ref_prev,s)):n[r]=i,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var E0;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(E0||(E0={}));var ho;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(ho||(ho={}));var Ur;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Ur||(Ur={}));class ta{constructor(e,n={config:{}},r){var i,s;if(this.topic=e,this.params=n,this.socket=r,this.bindings={},this.state=Ot.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new Wu(this,ir.join,this.params,this.timeout),this.rejoinTimer=new __(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=Ot.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(a=>a.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=Ot.closed,this.socket._remove(this)}),this._onError(a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=Ot.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=Ot.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",a=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,a),this.state=Ot.errored,this.rejoinTimer.scheduleTimeout())}),this._on(ir.reply,{},(a,o)=>{this._trigger(this._replyEventName(o),a)}),this.presence=new uo(this),this.broadcastEndpointURL=w_(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(!((s=(i=this.params.config)===null||i===void 0?void 0:i.broadcast)===null||s===void 0)&&s.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,n=this.timeout){var r,i,s;if(this.socket.isConnected()||this.socket.connect(),this.state==Ot.closed){const{config:{broadcast:a,presence:o,private:l}}=this.params,c=(i=(r=this.bindings.postgres_changes)===null||r===void 0?void 0:r.map(p=>p.filter))!==null&&i!==void 0?i:[],u=!!this.bindings[ho.PRESENCE]&&this.bindings[ho.PRESENCE].length>0||((s=this.params.config.presence)===null||s===void 0?void 0:s.enabled)===!0,d={},f={broadcast:a,presence:Object.assign(Object.assign({},o),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(p=>e==null?void 0:e(Ur.CHANNEL_ERROR,p)),this._onClose(()=>e==null?void 0:e(Ur.CLOSED)),this.updateJoinPayload(Object.assign({config:f},d)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:p})=>{var g;if(this.socket._isManualToken()||this.socket.setAuth(),p===void 0){e==null||e(Ur.SUBSCRIBED);return}else{const _=this.bindings.postgres_changes,m=(g=_==null?void 0:_.length)!==null&&g!==void 0?g:0,h=[];for(let v=0;v<m;v++){const x=_[v],{filter:{event:w,schema:A,table:E,filter:R}}=x,P=p&&p[v];
58if(P&&P.event===w&&ta.isFilterValueEqual(P.schema,A)&&ta.isFilterValueEqual(P.table,E)&&ta.isFilterValueEqual(P.filter,R))h.push(Object.assign(Object.assign({},x),{id:P.id}));else{this.unsubscribe(),this.state=Ot.errored,e==null||e(Ur.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=h,e&&e(Ur.SUBSCRIBED);return}}).receive("error",p=>{this.state=Ot.errored,e==null||e(Ur.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(p).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(Ur.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,n={}){return await this.send({type:"presence",event:"track",payload:e},n.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,n,r){return this.state===Ot.joined&&e===ho.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(async()=>await this.subscribe())),this._on(e,n,r)}async httpSend(e,n,r={}){var i;if(n==null)return Promise.reject("Payload is required for httpSend()");const s={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(s.Authorization=`Bearer ${this.socket.accessTokenValue}`);const a={method:"POST",headers:s,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},o=await this._fetchWithTimeout(this.broadcastEndpointURL,a,(i=r.timeout)!==null&&i!==void 0?i:this.timeout);if(o.status===202)return{success:!0};let l=o.statusText;try{const c=await o.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(e,n={}){var r,i;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated 
58in the future. Please use httpSend() explicitly for REST delivery.");const{event:s,payload:a}=e,o={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(o.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:o,body:JSON.stringify({messages:[{topic:this.subTopic,event:s,payload:a,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(r=n.timeout)!==null&&r!==void 0?r:this.timeout);return await((i=c.body)===null||i===void 0?void 0:i.cancel()),c.ok?"ok":"error"}catch(c){return c.name==="AbortError"?"timed out":"error"}}else return new Promise(s=>{var a,o,l;const c=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(o=(a=this.params)===null||a===void 0?void 0:a.config)===null||o===void 0?void 0:o.broadcast)===null||l===void 0)&&l.ack)&&s("ok"),c.receive("ok",()=>s("ok")),c.receive("error",()=>s("error")),c.receive("timeout",()=>s("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=Ot.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(ir.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(i=>{r=new Wu(this,ir.leave,{},e),r.receive("ok",()=>{n(),i("ok")}).receive("timeout",()=>{n(),i("timed out")}).receive("error",()=>{i("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{r==null||r.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=Ot.closed,this.bindings={}}async _fetchWithTimeout(e,n,r){const i=new AbortController,s=setTimeout(()=>i.abort(),r),a=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:i.signal}));return clearTimeout(s),a}_push(e,n,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let i=new Wu(this,e,n,r);return this._canPush()?i.send():this._addToPushBuffer(i),i}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Ob){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,r){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,r){var i,s;const a=e.toLocaleLowerCase(),{close:o,error:l,leave:c,join:u}=ir;if(r&&[o,l,c,u].indexOf(a)>=0&&r!==this._joinRef())return;let f=this._onMessage(a,n,r);if(n&&!f)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(a)?(i=this.bindings.postgres_changes)===null||i===void 0||i.filter(p=>{var g,_,m;return((g=p.filter)===null||g===void 0?void 0:g.event)==="*"||((m=(_=p.filter)===null||_===void 0?void 0:_.event)===null||m===void 0?void 0:m.toLocaleLowerCase())===a}).map(p=>p.callback(f,r)):(s=this.bindings[a])===null||s===void 0||s.filter(p=>{var g,_,m,h,v,x;if(["broadcast","presence","postgres_changes"].includes(a))if("id"in p){const w=p.id,A=(g=p.filter)===null||g===void 0?void 0:g.event;return w&&((_=n.ids)===null||_===void 0?void 0:_.includes(w))&&(A==="*"||(A==null?void 0:A.toLocaleLowerCase())===((m=n.data)===null||m===void 0?void 0:m.type.toLocaleLowerCase()))}else{const w=(v=(h=p==null?void 0:p.filter)===null||h===void 0?void 0:h.event)===null||v===void 0?void 0:v.toLocaleLowerCase();return w==="*"||w===((x=n==null?void 0:n.event)===null||x===void 0?void 0:x.toLocaleLowerCase())}else return p.type.toLocaleLowerCase()===a}).map(p=>{if(typeof f=="object"&&"ids"in f){const g=f.data,{schema:_,table:m,commit_timestamp:h,type:v,errors:x}=g;f=Object.assign(Object.assign({},{schema:_,table:m,commit_timestamp:h,eventType:v,new:{},old:{},errors:x}),this._getPayloadRecords(g))}p.callback(f,r)})}_isClosed(){return this.state===Ot.closed}_isJoined(){return this.state===Ot.joined}_isJoining(){return this.state===Ot.joining}_isLeaving(){return this.state===Ot.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,r){const i=e.toLocaleLowerCase(),s={type:i,filter:n,callback:r};return this.bindings[i]?this.bindings[i].push(s):this.bindings[i]=[s],this}_off(e,n){const r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(i=>{var s;return!(((s=i.type)===null||s===void 0?void 0:s.toLocaleLowerCase())===r&&ta.isEqual(i.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const r in e)if(e[r]!==n[r])return!1;return!0}static isFilterValueEqual(e,n){return(e??void 0)===(n??void 0)}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(ir.close,{},e)}_onError(e){this._on(ir.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=Ot.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=S0(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=S0(e.columns,e.old_record)),n}}const $u=()=>{},bl={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Wb=[1e3,2e3,5e3,1e4],$b=1e4,Xb=`
59  addEventListener("message", (e) => {
60    if (e.data.event === "start") {
61      setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
62    }
63  });`;class qb{constructor(e,n){var r;if(this.accessTokenValue=null,this.apiKey=null,this._manuallySetToken=!1,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Th,this.transport=null,this.heartbeatIntervalMs=bl.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=$u,this.ref=0,this.reconnectTimer=null,this.vsn=w0,this.logger=$u,this.conn=null,this.sendBuffer=[],this.serializer
63=new Fb,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=i=>i?(...s)=>i(...s):(...s)=>fetch(...s),!(!((r=n==null?void 0:n.params)===null||r===void 0)&&r.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${Ah.websocket}`,this.httpEndpoint=w_(e),this._initializeOptions(n),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(n==null?void 0:n.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.conn!==null&&this.isConnected())){if(this._setConnectionState("connecting"),this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=Lb.createWebSocket(this.endpointURL())}catch(e){this._setConnectionState("disconnected");const n=e.message;throw n.includes("Node.js")?new Error(`${n}
64
65To use Realtime in Node.js, you need to provide a WebSocket implementation:
66
67Option 1: Use Node.js 22+ which has native WebSocket support
68Option 2: Install and provide the "ws" package:
69
70  npm install ws
71
72  import ws from "ws"
73  const client = new RealtimeClient(url, {
74    ...options,
75    transport: ws
76  })`):new Error(`WebSocket not available: ${n}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:this.vsn}))}disconnect(e,n){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){const r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},typeof this.conn.close=="function"&&(e?this.conn.close(e,n??""):this.conn.close()),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){const n=await e.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const e=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,n,r){this.logger(e,n,r)}connectionState(){switch(this.conn&&this.conn.readyState){case ui.connecting:return Yi.Connecting;case ui.open:return Yi.Open;case ui.closing:return Yi.Closing;default:return Yi.Closed}}isConnected(){return this.connectionState()===Yi.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const r=`realtime:${e}`,i=this.getChannels().find(s=>s.topic===r);if(i)return i;{const s=new ta(`realtime:${e}`,n,this);return this.channels.push(s),s}}push(e){const{topic:n,event:r,payload:i,ref:s}=e,a=()=>{this.encode(e,o=>{var l;(l=this.conn)===null||l===void 0||l.send(o)})};this.log("push",`${n} ${r} (${s})`,i),this.isConnected()?a():this.sendBuffer.push(a)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(kb,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},bl.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>
760&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(r=>r.topic===e&&(r._isJoined()||r._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(c){this.log("error","error in heartbeat callback",c)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:r,event:i,payload:s,ref:a}=n,o=a?`(${a})`:"",l=s.status||"";this.log("receive",`${l} ${r} ${i} ${o}`.trim(),s),this.channels.filter(c=>c._isMember(r)).forEach(c=>c._trigger(i,s,a)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e),this.conn.readyState===ui.open&&this._onConnOpen())}_teardownConnection(){if(this.conn){if(this.conn.readyState===ui.open||this.conn.readyState===ui.connecting)try{this.conn.close()}catch(e){this.log("error","Error closing connection",e)}this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null}this._clearAllTimers(),this._terminateWorker(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).then(()=>{this.flushSendBuffer()}).catch(n=>{this.log("error","error waiting for auth on connect",n),this.flushSendBuffer()}),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this._terminateWorker()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_onConnClose(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(ir.error))}_appendParams(e,n){if(Object.keys(n).length===0)return e;const r=e.match(/\?/)?"&":"?",i=new URLSearchParams(n);return`${e}${r}${i}`}_workerObjectUrl(e){let n;if(e)n=e;else{const r=new Blob([Xb],{type:"application/javascript"});n=URL.createObjectURL(r)}return n}_setConnectionState(e,n=!1){this._connectionState=e,e==="connecting"?this._wasManualDisconnect=!1:e==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(e=null){let n,r=!1;if(e)n=e,r=!0;else if(this.accessToken)try{n=await this.accessToken()}catch(i){this.log("error","Error fetching access token from callback",i),n=this.accessTokenValue}else n=this.accessTokenValue;r?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=n&&(this.accessTokenValue=n,this.channels.forEac
76h(i=>{const s={access_token:n,version:Db};n&&i.updateJoinPayload(s),i.joinedOnce&&i._isJoined()&&i._push(ir.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(n=>{this.log("error",`Error setting auth in ${e}`,n)})}_triggerStateCallbacks(e,n){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(n)}catch(i){this.log("error",`error in ${e} callback`,i)}})}catch(r){this.log("error",`error triggering ${e} callbacks`,r)}}_setupReconnectionTimer(){this.reconnectTimer=new __(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},bl.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,r,i,s,a,o,l,c,u,d,f,p;switch(this.transport=(n=e==null?void 0:e.transport)!==null&&n!==void 0?n:null,this.timeout=(r=e==null?void 0:e.timeout)!==null&&r!==void 0?r:Th,this.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:bl.HEARTBEAT_INTERVAL,this.worker=(s=e==null?void 0:e.worker)!==null&&s!==void 0?s:!1,this.accessToken=(a=e==null?void 0:e.accessToken)!==null&&a!==void 0?a:null,this.heartbeatCallback=(o=e==null?void 0:e.heartbeatCallback)!==null&&o!==void 0?o:$u,this.vsn=(l=e==null?void 0:e.vsn)!==null&&l!==void 0?l:w0,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(c=e==null?void 0:e.reconnectAfterMs)!==null&&c!==void 0?c:g=>Wb[g-1]||$b,this.vsn){case v_:this.encode=(u=e==null?void 0:e.encode)!==null&&u!==void 0?u:(g,_)=>_(JSON.stringify(g)),this.decode=(d=e==null?void 0:e.decode)!==null&&d!==void 0?d:(g,_)=>_(JSON.parse(g));break;case Ub:this.encode=(f=e==null?void 0:e.encode)!==null&&f!==void 0?f:this.serializer.encode.bind(this.serializer),this.decode=(p=e==null?void 0:e.decode)!==null&&p!==void 0?p:this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${this.vsn}`)}if(this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}var Lo=class extends Error{constructor(t,e){var n;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((n=e.icebergType)==null?void 0:n.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Kb(t,e,n){const r=new URL(e,t);if(n)for(const[i,s]of Object.entries(n))s!==void 0&&r.searchParams.set(i,s);return r.toString()}async function Yb(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function Jb(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:n,path:r,query:i,body:s,headers:a}){const o=Kb(t.baseUrl,r,i),l=await Yb(t.auth),c=await e(o,{method:n,headers:{...s?{"Content-Type":"application/json"}:{},...l,...a},body:s?JSON.stringify(s):void 0}),u=await c.text(),d=(c.headers.get("content-type")||"").includes("application/json"),f=d&&u?JSON.parse(u):u;if(!c.ok){const p=d?f:void 0,g=p==null?void 0:p.error;throw new Lo((g==null?void 0:g.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:g==null?void 0:g.type,icebergCode:g==null?void 0:g.code,details:p})}return{status:c.status,headers:c.headers,data:f}}}}function El(t){return t.join("�")}var Zb=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:El(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(r=>({namespace:r}))}async createNamespace(t,e){const n={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:n})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${El(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${El(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${El(t.namespace)}`}),!0}catch(e){if(e instanceof Lo&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(n){if(n instanceof Lo&&n.status===409)return;throw n}}};function _s(t){return t.join("�")}var Qb=class{constructor(t,e="",n){this.client=t,this.prefix=e,this.accessDelegation=n}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${_s(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const n={};return this.accessDelegation&&(n["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${_s(t.namespace)}/tables`,body:e,headers:n})).data.metadata}async updateTable(t,e){const n=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${_s(t.namespace)}
76/tables/${t.name}`,body:e});return{"metadata-location":n.data["metadata-location"],metadata:n.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${_s(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${_s(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${_s(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(n){if(n instanceof Lo&&n.status===404)return!1;throw n}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(n){if(n instanceof Lo&&n.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw n}}},eE=class{constructor(t){var r;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const n=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=Jb({baseUrl:n,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(r=t.accessDelegation)==null?void 0:r.join(","),this.namespaceOps=new Zb(this.client,e),this.tableOps=new Qb(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}},cu=class extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}};function St(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var tE=class extends cu{constructor(t,e,n){super(t),this.name="StorageApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},Ch=class extends cu{constructor(t,e){super(t),this.name="StorageUnknownError",this.originalError=e}};const Pp=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),nE=()=>Response,Ph=t=>{if(Array.isArray(t))return t.map(n=>Ph(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,r])=>{const i=n.replace(/([-_][a-z])/gi,s=>s.toUpperCase().replace(/[-_]/g,""));e[i]=Ph(r)}),e},rE=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},iE=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t);function Io(t){"@babel/helpers - typeof";return Io=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Io(t)}function sE(t,e){if(Io(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(Io(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function aE(t){var e=sE(t,"string");return Io(e)=="symbol"?e:e+""}function oE(t,e,n){return(e=aE(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function M0(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ke(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};
76e%2?M0(Object(n),!0).forEach(function(r){oE(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):M0(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}const Xu=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},lE=async(t,e,n)=>{t instanceof await nE()&&!(n!=null&&n.noResolveJson)?t.json().then(r=>{const i=t.status||500,s=(r==null?void 0:r.statusCode)||i+"";e(new tE(Xu(r),i,s))}).catch(r=>{e(new Ch(Xu(r),r))}):e(new Ch(Xu(t),t))},cE=(t,e,n,r)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!r?i:(rE(r)?(i.headers=ke({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(r)):i.body=r,e!=null&&e.duplex&&(i.duplex=e.duplex),ke(ke({},i),n))};async function Jo(t,e,n,r,i,s){return new Promise((a,o)=>{t(n,cE(e,r,i,s)).then(l=>{if(!l.ok)throw l;return r!=null&&r.noResolveJson?l:l.json()}).then(l=>a(l)).catch(l=>lE(l,o,r))})}async function Do(t,e,n,r){return Jo(t,"GET",e,n,r)}async function nr(t,e,n,r,i){return Jo(t,"POST",e,r,i,n)}async function Nh(t,e,n,r,i){return Jo(t,"PUT",e,r,i,n)}async function uE(t,e,n,r){return Jo(t,"HEAD",e,ke(ke({},n),{},{noResolveJson:!0}),r)}async function Np(t,e,n,r,i){return Jo(t,"DELETE",e,r,i,n)}var dE=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e}then(t,e){return this.execute().then(t,e)}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(St(e))return{data:null,error:e};throw e}}};let S_;S_=Symbol.toStringTag;var hE=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[S_]="BlobDownloadBuilder",this.promise=null}asStream(){return new dE(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(St(e))return{data:null,error:e};throw e}}};const fE={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},T0={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var pE=class{constructor(t,e={},n,r){this.shouldThrowOnError=!1,this.url=t,this.headers=e,this.bucketId=n,this.fetch=Pp(r)}throwOnError(){return this.shouldThrowOnError=!0,this}async uploadOrUpdate(t,e,n,r){var i=this;try{let s;const a=ke(ke({},T0),r);let o=ke(ke({},i.headers),t==="POST"&&{"x-upsert":String(a.upsert)});const l=a.metadata;typeof Blob<"u"&&n instanceof Blob?(s=new FormData,s.append("cacheControl",a.cacheControl),l&&s.append("metadata",i.encodeMetadata(l)),s.append("",n)):typeof FormData<"u"&&n instanceof FormData?(s=n,s.has("cacheControl")||s.append("cacheControl",a.cacheControl),l&&!s.has("metadata")&&s.append("metadata",i.encodeMetadata(l))):(s=n,o["cache-control"]=`max-age=${a.cacheControl}`,o["content-type"]=a.contentType,l&&(o["x-metadata"]=i.toBase64(i.encodeMetadata(l))),(typeof ReadableStream<"u"&&s instanceof ReadableStream||s&&typeof s=="object"&&"pipe"in s&&typeof s.pipe=="function")&&!a.duplex&&(a.duplex="half")),r!=null&&r.headers&&(o=ke(ke({},o),r.headers));const c=i._removeEmptyFolders(e),u=i._getFinalPath(c),d=await(t=="PUT"?Nh:nr)(i.fetch,`${i.url}/object/${u}`,s,ke({headers:o},a!=null&&a.duplex?{duplex:a.duplex}:{}));return{data:{path:c,id:d.Id,fullPath:d.Key},error:null}}catch(s){if(i.shouldThrowOnError)throw s;if(St(s))return{data:null,error:s};throw s}}async upload(t,e,n){return this.uploadOrUpdate("POST",t,e,n)}async uploadToSignedUrl(t,e,n,r){var i=this;const s=i._removeEmptyFolders(t),a=i._getFinalPath(s),o=new URL(i.url+`/object/upload/sign/${a}`);o.searchParams.set("token",e);try{let l;const c=ke({upsert:T0.upsert},r),u=ke(ke({},i.headers),{"x-upsert":String(c.upsert)});return typeof Blob<"u"&&n instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),l.append("",n)):typeof FormData<"u"&&n instanceof FormData?(l=n,l.append("cacheControl",c.cacheControl)):(l=n,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType),{data:{path:s,fullPath:(await Nh(i.fetch,o.toString(),l,{headers:u})).Key},error:null}}catch(l){if(i.shouldThrowOnError)throw l;if(St(l))return{data:null,error:l};throw l}}async createSignedUploadUrl(t,e){var n=this;try{let r=n._getFinalPath(t);const i=ke({},n.headers);e!=null&&e.upsert&&(i["x-upsert"]="true");const s=await nr(n.fetch,`${n.url}/object/upload/sign/${r}`,{},{headers:i}),a=new URL(n.url+s.url),o=a.searchParams.get("token");if(!o)throw new cu("No token returned by API");return{data:{signedUrl:a.toString(),path:t,token:o},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(St(r))return{data:null,error:r};throw r}}async update(t,e,n){return this.uploadOrUpdate("PUT",t,e,n)}async move(t,e,n){var r=this;try{return{data:await nr(r.fetch,`${r.url}/object/move`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers}),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(St(i))return{data:null,error:i};throw i}}async copy(t,e,n){var r=this;try{return{data:{path:(await nr(r.fetch,`${r.url}/object/copy`,{bucketId:r.bucketId,sourceKey:t,destinationKey:e,destinationBucket:n==null?void 0:n.destinationBucket},{headers:r.headers})).Key},error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(St(i))return{data:null,error:i};throw i}}async createSignedUrl(t,e,n){var r=this;try{let i=r._getFinalPath(t),s=await nr(r.fetch,`${r.url}/object/sign/${i}
76`,ke({expiresIn:e},n!=null&&n.transform?{transform:n.transform}:{}),{headers:r.headers});const a=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return s={signedUrl:encodeURI(`${r.url}${s.signedURL}${a}`)},{data:s,error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(St(i))return{data:null,error:i};throw i}}async createSignedUrls(t,e,n){var r=this;try{const i=await nr(r.fetch,`${r.url}/object/sign/${r.bucketId}`,{expiresIn:e,paths:t},{headers:r.headers}),s=n!=null&&n.download?`&download=${n.download===!0?"":n.download}`:"";return{data:i.map(a=>ke(ke({},a),{},{signedUrl:a.signedURL?encodeURI(`${r.url}${a.signedURL}${s}`):null})),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(St(i))return{data:null,error:i};throw i}}download(t,e){const n=typeof(e==null?void 0:e.transform)<"u"?"render/image/authenticated":"object",r=this.transformOptsToQueryString((e==null?void 0:e.transform)||{}),i=r?`?${r}`:"",s=this._getFinalPath(t),a=()=>Do(this.fetch,`${this.url}/${n}/${s}${i}`,{headers:this.headers,noResolveJson:!0});return new hE(a,this.shouldThrowOnError)}async info(t){var e=this;const n=e._getFinalPath(t);try{return{data:Ph(await Do(e.fetch,`${e.url}/object/info/${n}`,{headers:e.headers})),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(St(r))return{data:null,error:r};throw r}}async exists(t){var e=this;const n=e._getFinalPath(t);try{return await uE(e.fetch,`${e.url}/object/${n}`,{headers:e.headers}),{data:!0,error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(St(r)&&r instanceof Ch){const i=r.originalError;if([400,404].includes(i==null?void 0:i.status))return{data:!1,error:r}}throw r}}getPublicUrl(t,e){const n=this._getFinalPath(t),r=[],i=e!=null&&e.download?`download=${e.download===!0?"":e.download}`:"";i!==""&&r.push(i);const s=typeof(e==null?void 0:e.transform)<"u"?"render/image":"object",a=this.transformOptsToQueryString((e==null?void 0:e.transform)||{});a!==""&&r.push(a);let o=r.join("&");return o!==""&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${s}/public/${n}${o}`)}}}async remove(t){var e=this;try{return{data:await Np(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async list(t,e,n){var r=this;try{const i=ke(ke(ke({},fE),e),{},{prefix:t||""});return{data:await nr(r.fetch,`${r.url}/object/list/${r.bucketId}`,i,{headers:r.headers},n),error:null}}catch(i){if(r.shouldThrowOnError)throw i;if(St(i))return{data:null,error:i};throw i}}async listV2(t,e){var n=this;try{const r=ke({},t);return{data:await nr(n.fetch,`${n.url}/object/list-v2/${n.bucketId}`,r,{headers:n.headers},e),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(St(r))return{data:null,error:r};throw r}}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const e=[];return t.width&&e.push(`width=${t.width}`),t.height&&e.push(`height=${t.height}`),t.resize&&e.push(`resize=${t.resize}`),t.format&&e.push(`format=${t.format}`),t.quality&&e.push(`quality=${t.quality}`),e.join("&")}};const b_="0.0.0",E_={"X-Client-Info":`storage-js/${b_}`};var mE=class{constructor(t,e={},n,r){this.shouldThrowOnError=!1;const i=new URL(t);r!=null&&r.useNewHostname&&/supabase\.(co|in|red)$/.test(i.hostname)&&!i.hostname.includes("storage.supabase.")&&(i.hostname=i.hostname.replace("supabase.","storage.supabase.")),this.url=i.href.replace(/\/$/,""),this.headers=ke(ke({},E_),e),this.fetch=Pp(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async listBuckets(t){var e=this;try{const n=e.listBucketOptionsToQueryString(t);return{data:await Do(e.fetch,`${e.url}/bucket${n}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await Do(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async createBucket(t,e={public:!1}){var n=this;try{return{data:await nr(n.fetch,`${n.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(St(r))return{data:null,error:r};throw r}}async updateBucket(t,e){var n=this;try{return{data:await Nh(n.fetch,`${n.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(St(r))return{data:null,error:r};throw r}}async emptyBucket(t){var e=this;try{return{data:await nr(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Np(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},gE=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=ke(ke({},E_),e),this.fetch=Pp(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await nr(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async listBuckets(t){var e=this;try{const n=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&n.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&n.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&n.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&n.set("sortOrder",t.sortOrder),t!=null&&t.search&&n.set("search",t.search);const r=n.toString(),i=r?`${e.url}/bucket?${r}`:`${e.url}/bucket`;return{data:await Do(e.fetch,i,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Np(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(St(n))return{data:null,error:n};throw n}}from(t){var e=this;if(!iE(t))throw new cu("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const n=new eE({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}
76),r=this.shouldThrowOnError;return new Proxy(n,{get(i,s){const a=i[s];return typeof a!="function"?a:async(...o)=>{try{return{data:await a.apply(i,o),error:null}}catch(l){if(r)throw l;return{data:null,error:l}}}}})}};const Lp={"X-Client-Info":`storage-js/${b_}`,"Content-Type":"application/json"};var M_=class extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}};function Rn(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}var qu=class extends M_{constructor(t,e,n){super(t),this.name="StorageVectorsApiError",this.status=e,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}},xE=class extends M_{constructor(t,e){super(t),this.name="StorageVectorsUnknownError",this.originalError=e}};const Ip=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),vE=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},A0=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),_E=async(t,e,n)=>{if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!(n!=null&&n.noResolveJson)){const r=t.status||500,i=t;if(typeof i.json=="function")i.json().then(s=>{const a=(s==null?void 0:s.statusCode)||(s==null?void 0:s.code)||r+"";e(new qu(A0(s),r,a))}).catch(()=>{const s=r+"";e(new qu(i.statusText||`HTTP ${r} error`,r,s))});else{const s=r+"";e(new qu(i.statusText||`HTTP ${r} error`,r,s))}}else e(new xE(A0(t),t))},yE=(t,e,n,r)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return r?(vE(r)?(i.headers=ke({"Content-Type":"application/json"},e==null?void 0:e.headers),i.body=JSON.stringify(r)):i.body=r,ke(ke({},i),n)):i};async function wE(t,e,n,r,i,s){return new Promise((a,o)=>{t(n,yE(e,r,i,s)).then(l=>{if(!l.ok)throw l;if(r!=null&&r.noResolveJson)return l;const c=l.headers.get("content-type");return!c||!c.includes("application/json")?{}:l.json()}).then(l=>a(l)).catch(l=>_E(l,o,r))})}async function Cn(t,e,n,r,i){return wE(t,"POST",e,r,i,n)}var SE=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=ke(ke({},Lp),e),this.fetch=Ip(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createIndex(t){var e=this;try{return{data:await Cn(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Rn(n))return{data:null,error:n};throw n}}async getIndex(t,e){var n=this;try{return{data:await Cn(n.fetch,`${n.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers}),error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Rn(r))return{data:null,error:r};throw r}}async listIndexes(t){var e=this;try{return{data:await Cn(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Rn(n))return{data:null,error:n};throw n}}async deleteIndex(t,e){var n=this;try{return{data:await Cn(n.fetch,`${n.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:n.headers})||{},error:null}}catch(r){if(n.shouldThrowOnError)throw r;if(Rn(r))return{data:null,error:r};throw r}}},bE=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=ke(ke({},Lp),e),this.fetch=Ip(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async putVectors(t){var e=this;try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:await Cn(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Rn(n))return{data:null,error:n};throw n}}async getVectors(t){var e=this;try{return{data:await Cn(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Rn(n))return{data:null,error:n};throw n}}async listVectors(t){var e=this;try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");
76if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:await Cn(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Rn(n))return{data:null,error:n};throw n}}async queryVectors(t){var e=this;try{return{data:await Cn(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Rn(n))return{data:null,error:n};throw n}}async deleteVectors(t){var e=this;try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:await Cn(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Rn(n))return{data:null,error:n};throw n}}},EE=class{constructor(t,e={},n){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=ke(ke({},Lp),e),this.fetch=Ip(n)}throwOnError(){return this.shouldThrowOnError=!0,this}async createBucket(t){var e=this;try{return{data:await Cn(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Rn(n))return{data:null,error:n};throw n}}async getBucket(t){var e=this;try{return{data:await Cn(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Rn(n))return{data:null,error:n};throw n}}async listBuckets(t={}){var e=this;try{return{data:await Cn(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}),error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Rn(n))return{data:null,error:n};throw n}}async deleteBucket(t){var e=this;try{return{data:await Cn(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{},error:null}}catch(n){if(e.shouldThrowOnError)throw n;if(Rn(n))return{data:null,error:n};throw n}}},ME=class extends EE{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new TE(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,n=this;return e().call(n,t)}async getBucket(t){var e=()=>super.getBucket,n=this;return e().call(n,t)}async listBuckets(t={}){var e=()=>super.listBuckets,n=this;return e().call(n,t)}async deleteBucket(t){var e=()=>super.deleteBucket,n=this;return e().call(n,t)}},TE=class extends SE{constructor(t,e,n,r){super(t,e,r),this.vectorBucketName=n}async createIndex(t){var e=()=>super.createIndex,n=this;return e().call(n,ke(ke({},t),{},{vectorBucketName:n.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,n=this;return e().call(n,ke(ke({},t),{},{vectorBucketName:n.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,n=this;return e().call(n,n.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,n=this;return e().call(n,n.vectorBucketName,t)}index(t){return new AE(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},AE=class extends bE{constructor(t,e,n,r,i){super(t,e,i),this.vectorBucketName=n,this.indexName=r}async putVectors(t){var e=()=>super.putVectors,n=this;return e().call(n,ke(ke({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async getVectors(t){var e=()=>super.getVectors,n=this;return e().call(n,ke(ke({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,n=this;return e().call(n,ke(ke({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,n=this;return e().call(n,ke(ke({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,n=this;return e().call(n,ke(ke({},t),{},{vectorBucketName:n.vectorBucketName,indexName:n.indexName}))}},RE=class extends mE{constructor(t,e={},n,r){super(t,e,n,r)}from(t){return new pE(this.url,this.headers,t,this.fetch)}get vectors(){return new ME(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new gE(this.url+"/iceberg",this.headers,this.fetch)}};const T_="0.0.0",Vs=30*1e3,Lh=3,Ku=Lh*Vs,CE="http://localhost:9999",PE="supabase.auth.token",NE={"X-Client-Info":`gotrue-js/${T_}`},Ih="X-Supabase-Api-Version",A_={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},LE=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,IE=10*60*1e3;
76class Uo extends Error{constructor(e,n,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=r}}function Te(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class DE extends Uo{constructor(e,n,r){super(e,n,r),this.name="AuthApiError",this.status=n,this.code=r}}function UE(t){return Te(t)&&t.name==="AuthApiError"}class Ji extends Uo{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class Qr extends Uo{constructor(e,n,r,i){super(e,r,i),this.name=n,this.status=r}}class Tn extends Qr{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function kE(t){return Te(t)&&t.name==="AuthSessionMissingError"}class ys extends Qr{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class Ml extends Qr{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class Tl extends Qr{constructor(e,n=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}function OE(t){return Te(t)&&t.name==="AuthImplicitGrantRedirectError"}class R0 extends Qr{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class FE extends Qr{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class Dh extends Qr{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function Yu(t){return Te(t)&&t.name==="AuthRetryableFetchError"}class C0 extends Qr{constructor(e,n,r){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=r}}class Uh extends Qr{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Fc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),P0=` 	
77\r=`.split(""),BE=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<P0.length;e+=1)t[P0[e].charCodeAt(0)]=-2;for(let e=0;e<Fc.length;e+=1)t[Fc[e].charCodeAt(0)]=e;return t})();function N0(t,e,n){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(Fc[r]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const r=e.queue>>e.queuedBits-6&63;n(Fc[r]),e.queuedBits-=6}}function R_(t,e,n){const r=BE[t];if(r>-1)for(e.queue=e.queue<<6|r,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(r===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function L0(t){const e=[],n=a=>{e.push(String.fromCodePoint(a))},r={utf8seq:0,codepoint:0},i={queue:0,queuedBits:0},s=a=>{jE(a,r,n)};for(let a=0;a<t.length;a+=1)R_(t.charCodeAt(a),i,s);return e.join("")}function zE(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function VE(t,e){for(let n=0;n<t.length;n+=1){let r=t.charCodeAt(n);if(r>55295&&r<=56319){const i=(r-55296)*1024&65535;r=(t.charCodeAt(n+1)-56320&65535|i)+65536,n+=1}zE(r,e)}}function jE(t,e,n){if(e.utf8seq===0){if(t<=127){n(t);return}for(let r=1;r<6;r+=1)if(!(t>>7-r&1)){e.utf8seq=r;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&n(e.codepoint)}}function la(t){const e=[],n={queue:0,queuedBits:0},r=i=>{e.push(i)};for(let i=0;i<t.length;i+=1)R_(t.charCodeAt(i),n,r);return new Uint8Array(e)}function HE(t){const e=[];return VE(t,n=>e.push(n)),new Uint8Array(e)}function is(t){const e=[],n={queue:0,queuedBits:0},r=i=>{e.push(i)};return t.forEach(i=>
77N0(i,n,r)),N0(null,n,r),e.join("")}function GE(t){return Math.round(Date.now()/1e3)+t}function WE(){return Symbol("auth-callback")}const qt=()=>typeof window<"u"&&typeof document<"u",Fi={tested:!1,writable:!1},C_=()=>{if(!qt())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(Fi.tested)return Fi.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),Fi.tested=!0,Fi.writable=!0}catch{Fi.tested=!0,Fi.writable=!1}return Fi.writable};function $E(t){const e={},n=new URL(t);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((i,s)=>{e[s]=i})}catch{}return n.searchParams.forEach((r,i)=>{e[i]=r}),e}const P_=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),XE=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",js=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},Bi=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},Xt=async(t,e)=>{await t.removeItem(e)};class uu{constructor(){this.promise=new uu.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}uu.promiseConstructor=Promise;function Ju(t){const e=t.split(".");if(e.length!==3)throw new Uh("Invalid JWT structure");for(let r=0;r<e.length;r++)if(!LE.test(e[r]))throw new Uh("JWT not in base64url format");return{header:JSON.parse(L0(e[0])),payload:JSON.parse(L0(e[1])),signature:la(e[2]),raw:{header:e[0],payload:e[1]}}}async function qE(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function KE(t,e){return new Promise((r,i)=>{(async()=>{for(let s=0;s<1/0;s++)try{const a=await t(s);if(!e(s,null,a)){r(a);return}}catch(a){if(!e(s,a)){i(a);return}}})()})}function YE(t){return("0"+t.toString(16)).substr(-2)}function JE(){const e=new Uint32Array(56);if(typeof crypto>"u"){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",r=n.length;let i="";for(let s=0;s<56;s++)i+=n.charAt(Math.floor(Math.random()*r));return i}return crypto.getRandomValues(e),Array.from(e,YE).join("")}async function ZE(t){const n=new TextEncoder().encode(t),r=await crypto.subtle.digest("SHA-256",n),i=new Uint8Array(r);return Array.from(i).map(s=>String.fromCharCode(s)).join("")}async function QE(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const n=await ZE(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function ws(t,e,n=!1){const r=JE();let i=r;n&&(i+="/PASSWORD_RECOVERY"),await js(t,`${e}-code-verifier`,i);const s=await QE(r);return[s,r===s?"plain":"s256"]}const eM=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function tM(t){const e=t.headers.get(Ih);if(!e||!e.match(eM))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function nM(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function rM(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const iM=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Ss(t){if(!iM.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Zu(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const r=n.toString();if(r==="Symbol(Symbol.toPrimitive)"||r==="Symbol(Symbol.toStringTag)"||r==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function sM(t,e){return new Proxy(t,{get:(n,r,i)=>{if(r==="__isInsecureUserWarningProxy")return!0;
77if(typeof r=="symbol"){const s=r.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)"||s==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,r,i)}return!e.value&&typeof r=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(n,r,i)}})}function I0(t){return JSON.parse(JSON.stringify(t))}const qi=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),aM=[502,503,504];async function D0(t){var e;if(!XE(t))throw new Dh(qi(t),0);if(aM.includes(t.status))throw new Dh(qi(t),t.status);let n;try{n=await t.json()}catch(s){throw new Ji(qi(s),s)}let r;const i=tM(t);if(i&&i.getTime()>=A_["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?r=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(r=n.error_code),r){if(r==="weak_password")throw new C0(qi(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(r==="session_not_found")throw new Tn}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((s,a)=>s&&typeof a=="string",!0))throw new C0(qi(n),t.status,n.weak_password.reasons);throw new DE(qi(n),t.status||500,r)}const oM=(t,e,n,r)=>{const i={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?i:(i.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),i.body=JSON.stringify(r),Object.assign(Object.assign({},i),n))};async function Ue(t,e,n,r){var i;const s=Object.assign({},r==null?void 0:r.headers);s[Ih]||(s[Ih]=A_["2024-01-01"].name),r!=null&&r.jwt&&(s.Authorization=`Bearer ${r.jwt}`);const a=(i=r==null?void 0:r.query)!==null&&i!==void 0?i:{};r!=null&&r.redirectTo&&(a.redirect_to=r.redirectTo);const o=Object.keys(a).length?"?"+new URLSearchParams(a).toString():"",l=await lM(t,e,n+o,{headers:s,noResolveJson:r==null?void 0:r.noResolveJson},{},r==null?void 0:r.body);return r!=null&&r.xform?r==null?void 0:r.xform(l):{data:Object.assign({},l),error:null}}async function lM(t,e,n,r,i,s){const a=oM(e,r,i,s);let o;try{o=await t(n,Object.assign({},a))}catch(l){throw console.error(l),new Dh(qi(l),0)}if(o.ok||await D0(o),r!=null&&r.noResolveJson)return o;try{return await o.json()}catch(l){await D0(l)}}function er(t){var e;let n=null;dM(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=GE(t.expires_in)));const r=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:r},error:null}}function U0(t){const e=er(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((n,r)=>n&&typeof r=="string",!0)&&(e.data.weak_password=t.weak_password),e}function pi(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function cM(t){return{data:t,error:null}}function uM(t){const{action_link:e,email_otp:n,hashed_token:r,redirect_to:i,verification_type:s}=t,a=lu(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),o={action_link:e,email_otp:n,hashed_token:r,redirect_to:i,verification_type:s},l=Object.assign({},a);return{data:{properties:o,user:l},error:null}}function k0(t){return t}function dM(t){return t.access_token&&t.refresh_token&&t.expires_in}const Qu=["global","local","others"];class hM{constructor({url:e="",headers:n={},fetch:r}){this.url=e,this.headers=n,this.fetch=P_(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,n=Qu[0]){if(Qu.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Qu.join(", ")}`);try{return await Ue(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(r){if(Te(r))return{data:null,error:r};throw r}}async inviteUserByEmail(e,n={}){try{return await Ue(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:pi})}catch(r){if(Te(r))return{data:{user:null},error:r};throw r}}async generateLink(e){try{const{options:n}=e,r=lu(e,["options"]),i=Object.assign(Object.assign({},r),n);return"newEmail"in r&&(i.new_email=r==null?void 0:r.newEmail,delete i.newEmail),await Ue(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:i,headers:this.headers,xform:uM,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Te(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await Ue(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:pi})}catch(n){if(Te(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,r,i,s,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await Ue(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(s=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:k0});if(u.error)throw u.error;const d=await u.json(),f=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return p.length>
770&&(p.forEach(g=>{const _=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),m=JSON.parse(g.split(";")[1].split("=")[1]);c[`${m}Page`]=_}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(Te(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Ss(e);try{return await Ue(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:pi})}catch(n){if(Te(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){Ss(e);try{return await Ue(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:pi})}catch(r){if(Te(r))return{data:{user:null},error:r};throw r}}async deleteUser(e,n=!1){Ss(e);try{return await Ue(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:pi})}catch(r){if(Te(r))return{data:{user:null},error:r};throw r}}async _listFactors(e){Ss(e.userId);try{const{data:n,error:r}=await Ue(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:i=>({data:{factors:i},error:null})});return{data:n,error:r}}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _deleteFactor(e){Ss(e.userId),Ss(e.id);try{return{data:await Ue(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,r,i,s,a,o,l;try{const c={nextPage:null,lastPage:0,total:0},u=await Ue(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(r=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&r!==void 0?r:"",per_page:(s=(i=e==null?void 0:e.perPage)===null||i===void 0?void 0:i.toString())!==null&&s!==void 0?s:""},xform:k0});if(u.error)throw u.error;const d=await u.json(),f=(a=u.headers.get("x-total-count"))!==null&&a!==void 0?a:0,p=(l=(o=u.headers.get("link"))===null||o===void 0?void 0:o.split(","))!==null&&l!==void 0?l:[];return p.length>0&&(p.forEach(g=>{const _=parseInt(g.split(";")[0].split("=")[1].substring(0,1)),m=JSON.parse(g.split(";")[1].split("=")[1]);c[`${m}Page`]=_}),c.total=parseInt(f)),{data:Object.assign(Object.assign({},d),c),error:null}}catch(c){if(Te(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await Ue(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await Ue(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await Ue(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if(Te(r))return{data:null,error:r};throw r}}async _deleteOAuthClient(e){try{return await Ue(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Te(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await Ue(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Te(n))return{data:null,error:n};throw n}}}function O0(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const bs={debug:!!(globalThis&&C_()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class N_ extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class fM extends N_{}async function pM(t,e,n){bs.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const r=new globalThis.AbortController;return e>0&&setTimeout(()=>{r.abort(),bs.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:r.signal}
77,async i=>{if(i){bs.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await n()}finally{bs.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw bs.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new fM(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(bs.debug)try{const s=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(s,null,"  "))}catch(s){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",s)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await n()}}))}function mM(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function L_(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function gM(t){return parseInt(t,16)}function xM(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}function vM(t){var e;const{chainId:n,domain:r,expirationTime:i,issuedAt:s=new Date,nonce:a,notBefore:o,requestId:l,resources:c,scheme:u,uri:d,version:f}=t;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!r)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(a&&a.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${a}`);if(!d)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(f!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${f}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
78`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const p=L_(t.address),g=u?`${u}://${r}`:r,_=t.statement?`${t.statement}
79`:"",m=`${g} wants you to sign in with your Ethereum account:
80${p}
81
82${_}`;let h=`URI: ${d}
83Version: ${f}
84Chain ID: ${n}${a?`
85Nonce: ${a}`:""}
86Issued At: ${s.toISOString()}`;if(i&&(h+=`
87Expiration Time: ${i.toISOString()}`),o&&(h+=`
88Not Before: ${o.toISOString()}`),l&&(h+=`
89Request ID: ${l}`),c){let v=`
90Resources:`;for(const x of c){if(!x||typeof x!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${x}`);v+=`
91- ${x}`}h+=v}return`${m}
92${h}`}class Ut extends Error{constructor({message:e,code:n,cause:r,name:i}){var s;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=(s=i??(r instanceof Error?r.name:void 0))!==null&&s!==void 0?s:"Unknown Error",this.code=n}}class Bc extends Ut{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function _M({error:t,options:e}){var n,r,i;const{publicKey:s}=e;if(!s)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ut({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((n=s.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Ut({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((r=s.authenticatorSelection)===null||r===void 0?void 0:r.userVerification)==="required")return new Ut({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((i=s.authenticatorSelection)===null||i===void 0?void 0:i.userVerification)==="required")return new Ut({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Ut({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Ut({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return s.pubKeyCredParams.filter(o=>o.type==="public-key").length===0?new Ut({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Ut({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const a=window.location.hostname;if(I_(a)){if(s.rp.id!==a)return new Ut({message:`The RP ID "${s.rp.id}
92" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ut({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new Ut({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Ut({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ut({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function yM({error:t,options:e}){const{publicKey:n}=e;if(!n)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ut({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Ut({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const r=window.location.hostname;if(I_(r)){if(n.rpId!==r)return new Ut({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ut({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Ut({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ut({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class wM{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const SM=new wM;function bM(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:n,excludeCredentials:r}=t,i=lu(t,["challenge","user","excludeCredentials"]),s=la(e).buffer,a=Object.assign(Object.assign({},n),{id:la(n.id).buffer}),o=Object.assign(Object.assign({},i),{challenge:s,user:a});if(r&&r.length>0){o.excludeCredentials=new Array(r.length);for(let l=0;l<r.length;l++){const c=r[l];o.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:la(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return o}function EM(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:n}=t,r=lu(t,["challenge","allowCredentials"]),i=la(e).buffer,s=Object.assign(Object.assign({},r),{challenge:i});if(n&&n.length>0){s.allowCredentials=new Array(n.length);for(let a=0;a<n.length;a++){const o=n[a];s.allowCredentials[a]=Object.assign(Object.assign({},o),{id:la(o.id).buffer,type:o.type||"public-key",transports:o.transports})}}return s}function MM(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t;return{id:t.id,rawId:t.id,response:{attestationObject:is(new Uint8Array(t.response.attestationObject)),clientDataJSON:is(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function TM(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const n=t,r=t.getClientExtensionResults(),i=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:is(new Uint8Array(i.authenticatorData)),clientDataJSON:is(new Uint8Array(i.clientDataJSON)),signature:is(new Uint8Array(i.signature)),userHandle:i.userHandle?is(new Uint8Array(i.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:(e=n.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function I_(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function F0(){var t,e;return!!(qt()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function AM(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Bc("Browser returned unexpected credential type",e)}:{data:null,error:new Bc("Empty credential response",e)}}catch(e){return{data:null,error:_M({error:e,options:t})}}}async function RM(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new Bc("Browser returned unexpected credential type",e)}:{data:null,error:new Bc("Empty credential response",e)}}catch(e){return{data:null,error:yM({error:e,options:t})}}}const CM={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},PM={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function zc(...t){const e=i=>i!==null&&typeof i=="object"&&!Array.isArray(i),n=i=>i instanceof ArrayBuffer||ArrayBuffer.isView(i),r={};for(const i of t)if(i)for(const s in i){const a=i[s];if(a!==void 0)if(Array.isArray(a))r[s]=a;else if(n(a))r[s]=a;else if(e(a)){const o=r[s];e(o)?r[s]=zc(o,a):r[s]=zc(a)}else r[s]=a}return r}function NM(t,e){return zc(CM,t,e||{})}function LM(t,e){return zc(PM,t,e||{})}class IM{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:r,signal:i},s){try{const{data:a,error:o}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!a)return{data:null,error:o};const l=i??SM.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:c}=a.webauthn.credential_options.publicKey;c.name||(c.name=`${c.id}:${r}`),c.displayName||(c.displayName=c.name)}switch(a.webauthn.type){case"create":{const c=NM(a.webauthn.credential_options.publicKey,s==null?void 0:s.create),{data:u,error:d}=await AM({publicKey:c,signal:l});return u?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:u}},error:null}:{data:null,error:d}}case"request":{const c=LM(a.webauthn.credential_options.publicKey,s==null?void 0:s.request),{data:u,error:d}=await RM(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:c,signal:l}));return u?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:u}},error:null}:{data:null,error:d}}}}catch(a){return Te(a)?{data:null,error:a}:{data:null,error:new Ji("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:n,webauthn:r}){return this.client.mfa.verify({factorId:n,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!n)return{data:null,error:new Uo("rpId is required for WebAuthn authentication")};try{if(!F0())return{data:null,error:new Ji("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:r},signal:i},{request:s});if(!a)return{data:null,error:o};const{webauthn:l}=a;return this._verify({factorId:e,challengeId:a.challengeId,webauthn:{type:l.type,rpId:n,rpOrigins:r,credential_response:l.credential_response}})}catch(a){return Te(a)?{data:null,error:a}:{data:null,error:new Ji("Unexpected error in authenticate",a)}}}async _register({friendlyName:e,webauthn:{rpId:n=typeof window<"u"?window.location.hostname:void 0,rpOrigins:r=typeof window<"u"?[window.location.origin]:void 0,signal:i}={}},s){if(!n)return{data:null,error:new Uo("rpId is required for WebAuthn registration")};try{if(!F0())return{data:null,error:new Ji("Browser does not support WebAuthn",null)};const{data:a,error:o}=await this._enroll({friendlyName:e});if(!a)return await this.client.mfa.listFactors().then(u=>{var d;return(d=u.data)===null||d===void 0?void 0:d.all.find(f=>f.factor_type==="webauthn"&&f.friendly_name===e&&f.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:o};const{data:l,error:c}=await this._challenge({factorId:a.id,friendlyName:a.friendly_name,webauthn:{rpId:n,rpOrigins:r},signal:i},{create:s});return l?this._verify({factorId:a.id,challengeId:l.challengeId,webauthn:{rpId:n,rpOrigins:r,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(a){return Te(a)?{data:null,error:a}:{data:null,error:new Ji("Unexpected error in register",a)}}}}mM();const DM={url:CE,storageKey:PE,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:NE,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1};async function B0(t,e,n){return await n()}const Es={};class ko{get jwks(){var e,n;return(n=(e=Es[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){Es[this.storageKey]=Object.assign(Object.assign({},Es[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=Es[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Es[this.storageKey]=Object.assign(Object.assign({},Es[this.storageKey]),{cachedAt:e})}constructor(e){var n,r,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const s=Object.assign(Object.assign({},DM),e);if(this.storageKey=s.storageKey,this.instanceID=(n=ko.nextInstanceID[this.storageKey])!==null&&n!==void 0?n:0,ko.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!s.debug,typeof s.debug=="function"&&(this.logger=s.debug),this.instanceID>0&&qt()){const a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=s.persistSession,this.autoRefreshToken=s.autoRefreshToken,this.admin=new hM({url:s.url,headers:s.headers,fetch:s.fetch}),this.url=s.url,this.headers=s.headers,this.fetch=P_(s.fetch),this.lock=s.lock||B0,this.detectSessionInUrl=s.detectSessionInUrl,this.flowType=s.flowType,this.hasCustomAuthorizationHeader=s.hasCustomAuthorizationHeader,this.throwOnError=s.throwOnError,s.lock?this.lock=s.lock:this.persistSession&&qt()&&(!((r=globalThis==null?void 0:globalThis.navigator)===null||r===void 0)&&r.locks)?this.lock=pM:this.lock=B0,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new IM(this)}
92,this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.persistSession?(s.storage?this.storage=s.storage:C_()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=O0(this.memoryStorage)),s.userStorage&&(this.userStorage=s.userStorage)):(this.memoryStorage={},this.storage=O0(this.memoryStorage)),qt()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a),await this._notifyAllSubscribers(a.data.event,a.data.session,!1)})}this.initialize()}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${T_}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let n={},r="none";if(qt()&&(n=$E(window.location.href),this._isImplicitGrantCallback(n)?r="implicit":await this._isPKCECallback(n)&&(r="pkce")),qt()&&this.detectSessionInUrl&&r!=="none"){const{data:i,error:s}=await this._getSessionFromURL(n,r);if(s){if(this._debug("#_initialize()","error detecting session from URL",s),OE(s)){const l=(e=s.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:s}}return await this._removeSession(),{error:s}}const{session:a,redirectType:o}=i;return this._debug("#_initialize()","detected session in URL",a,"redirect type",o),await this._saveSession(a),setTimeout(async()=>{o==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",a):await this._notifyAllSubscribers("SIGNED_IN",a)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Te(n)?this._returnResult({error:n}):this._returnResult({error:new Ji("Unexpected error during initialization",n)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,r,i;try{const s=await Ue(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(r=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:(i=e==null?void 0:e.options)===null||i===void 0?void 0:i.captchaToken}},xform:er}),{data:a,error:o}=s;if(o||!a)return this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(Te(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signUp(e){var n,r,i;try{let s;if("email"in e){const{email:u,password:d,options:f}=e;let p=null,g=null;this.flowType==="pkce"&&([p,g]=await ws(this.storage,this.storageKey)),s=await Ue(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:f==null?void 0:f.emailRedirectTo,body:{email:u,password:d,data:(n=f==null?void 0:f.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken},code_challenge:p,code_challenge_method:g},xform:er})}else if("phone"in e){const{phone:u,password:d,options:f}=e;s=await Ue(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:d,data:(r=f==null?void 0:f.data)!==null&&r!==void 0?r:{},channel:(i=f==null?void 0:f.channel)!==null&&i!==void 0?i:"sms",gotrue_meta_security:{captcha_token:f==null?void 0:f.captchaToken}},xform:er})}else throw new Ml("You must provide either an email or phone number and a password");const{data:a,error:o}=s;
92if(o||!a)return await Xt(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:o});const l=a.session,c=a.user;return a.session&&(await this._saveSession(a.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),Te(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithPassword(e){try{let n;if("email"in e){const{email:s,password:a,options:o}=e;n=await Ue(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:s,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:U0})}else if("phone"in e){const{phone:s,password:a,options:o}=e;n=await Ue(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:s,password:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:U0})}else throw new Ml("You must provide either an email or phone number and a password");const{data:r,error:i}=n;if(i)return this._returnResult({data:{user:null,session:null},error:i});if(!r||!r.session||!r.user){const s=new ys;return this._returnResult({data:{user:null,session:null},error:s})}return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:i})}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOAuth(e){var n,r,i,s;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(r=e.options)===null||r===void 0?void 0:r.scopes,queryParams:(i=e.options)===null||i===void 0?void 0:i.queryParams,skipBrowserRedirect:(s=e.options)===null||s===void 0?void 0:s.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,r,i,s,a,o,l,c,u,d,f;let p,g;if("message"in e)p=e.message,g=e.signature;else{const{chain:_,wallet:m,statement:h,options:v}=e;let x;if(qt())if(typeof m=="object")x=m;else{const M=window;if("ethereum"in M&&typeof M.ethereum=="object"&&"request"in M.ethereum&&typeof M.ethereum.request=="function")x=M.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof m!="object"||!(v!=null&&v.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=m}const w=new URL((n=v==null?void 0:v.url)!==null&&n!==void 0?n:window.location.href),A=await x.request({method:"eth_requestAccounts"}).then(M=>M).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!A||A.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const E=L_(A[0]);let R=(r=v==null?void 0:v.signInWithEthereum)===null||r===void 0?void 0:r.chainId;if(!R){const M=await x.request({method:"eth_chainId"});R=gM(M)}const P={domain:w.host,address:E,statement:h,uri:w.href,version:"1",chainId:R,nonce:(i=v==null?void 0:v.signInWithEthereum)===null||i===void 0?void 0:i.nonce,issuedAt:(a=(s=v==null?void 0:v.signInWithEthereum)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date,expirationTime:(o=v==null?void 0:v.signInWithEthereum)===null||o===void 0?void 0:o.expirationTime,notBefore:(l=v==null?void 0:v.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=v==null?void 0:v.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=v==null?void 0:v.signInWithEthereum)===null||u===void 0?void 0:u.resources};p=vM(P),g=await x.request({method:"personal_sign",params:[xM(p),E]})}try{const{data:_,error:m}=await Ue(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:p,signature:g},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:er});if(m)throw m;if(!_||!_.session||!_.user){const h=new ys;return this._returnResult({data:{user:null,session:null},error:h})}return _.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("SIGNED_IN",_.session)),this._returnResult({data:Object.assign({},_),error:m})}catch(_){if(Te(_))return this._returnResult({data:{user:null,session:null},error:_});throw _}}async signInWithSolana(e){var n,r,i,s,a,o,l,c,u,d,f,p;let g,_;if("message"in e)g=e.message,_=e.signature;else{const{chain:m,wallet:h,statement:v,options:x}=e;let w;if(qt())if(typeof h=="object")w=h;else{const E=window;if("solana"in E&&typeof E.solana=="object"&&("signIn"in E.solana&&typeof E.solana.signIn=="function"||"signMessage"in E.solana&&typeof E.solana.signMessage=="function"))w=E.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof h!="object"||!(x!=null&&x.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");w=h}const A=new URL((n=x==null?void 0:x.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in w&&w.signIn){const E=await w.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},x==null?void 0:x.signInWithSolana),{version:"1",domain:A.host,uri:A.href}),v?{statement:v}:null));let R;if(Array.isArray(E)&&E[0]&&typeof E[0]=="object")R=E[0];else if(E&&typeof E=="object"&&"signedMessage"in E&&"signature"in E)R=E;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in R&&"signature"in R&&(typeof R.signedMessage=="string"||R.signedMessage instanceof Uint8Array)&&R.signature instanceof Uint8Array)g=typeof R.signedMessage=="string"?R.signedMessage:new TextDecoder().decode(R.signedMessage),_=R.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in w)||typeof w.signMessage!="function"||!("publicKey"in w)||typeof w!="object"||!w.publicKey||!("toBase58"in w.publicKey)||typeof w.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");g=[`${A.host} wants you to sign in with your Solana account:`,w.publicKey.toBase58(),...v?["",v,""]:[""],"Version: 1",`URI: ${A.href}`,`Issued At: ${(i=(r=x==null?void 0:x.signInWithSolana)===null||r===void 0?void 0:r.issuedAt)!==null&&i!==void 0?i:new Date().toISOString()}`,...!((s=x==null?void 0:x.signInWithSolana)===null||s===void 0)&&s.notBefore?[`Not Before: ${x.signInWithSolana.notBefore}`]:[],...!((a=x==null?void 0:x.signInWithSolana)===null||a===void 0)&&a.expirationTime?[`Expiration Time: ${x.signInWithSolana.expirationTime}`]:[],...!((o=x==null?void 0:x.signInWithSolana)===null||o===void 0)&&o.chainId?[`Chain ID: ${x.signInWithSolana.chainId}`]:[],...!((l=x==null?void 0:x.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${x.signInWithSolana.nonce}`]:[],...!((c=x==null?void 0:x.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${x.signInWithSolana.requestId}`]:[],...!((d=(u=x==null?void 0:x.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||d===void 0)&&d.length?["Resources",...x.signInWithSolana.resources.map(R=>`- ${R}`)]:[]].join(`
93`);const E=await w.signMessage(new TextEncoder().encode(g),"utf8");if(!E||!(E instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");_=E}}try{const{data:m,error:h}=await Ue(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:g,signature:is(_)},!((f=e.options)===null||f===void 0)&&f.captchaToken?{gotrue_meta_security:{captcha_token:(p=e.options)===null||p===void 0?void 0:p.captchaToken}}:null),xform:er});if(h)throw h;if(!m||!m.session||!m.user){const v=new ys;return this._returnResult({data:{user:null,session:null},error:v})}return m.session&&(await this._saveSession(m.session),await this._notifyAllSubscribers("SIGNED_IN",m.session)),this._returnResult({data:Object.assign({},m),error:h})}catch(m){if(Te(m))return this._returnResult({data:{user:null,session:null},error:m});throw m}}async _exchangeCodeForSession(e){const n=await Bi(this.storage,`${this.storageKey}-code-verifier`),[r,i]=(n??"").split("/");try{if(!r&&this.flowType==="pkce")throw new FE;const{data:s,error:a}=await Ue(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:er});if(await Xt(this.storage,`${this.storageKey}-code-verifier`),a)throw a;if(!s||!s.session||!s.user){const o=new ys;return this._returnResult({data:{user:null,session:null,redirectType:null},error:o})}return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),this._returnResult({data:Object.assign(Object.assign({},s),{redirectType:i??null}),error:a})}catch(s){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),Te(s))return this._returnResult({data:{user:null,session:null,redirectType:null},error:s});throw s}}async signInWithIdToken(e){try{const{options:n,provider:r,token:i,access_token:s,nonce:a}=e,o=await Ue(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:i,access_token:s,nonce:a,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:er}),{data:l,error:c}=o;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new ys;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async signInWithOtp(e){var n,r,i,s,a;try{if("email"in e){const{email:o,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await ws(this.storage,this.storageKey));const{error:d}=await Ue(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:o,data:(n=l==null?void 0:l.data)!==null&&n!==void 0?n:{},create_user:(r=l==null?void 0:l.shouldCreateUser)!==null&&r!==void 0?r:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:d})}if("phone"in e){const{phone:o,options:l}=e,{data:c,error:u}=await Ue(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:o,data:(i=l==null?void 0:l.data)!==null&&i!==void 0?i:{},create_user:(s=l==null?void 0:l.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(a=l==null?void 0:l.channel)!==null&&a!==void 0?a:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new Ml("You must provide either an email or phone number.")}catch(o){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),Te(o))return this._returnResult({data:{user:null,session:null},error:o});throw o}}async verifyOtp(e){var n,r;try{let i,s;"options"in e&&(i=(n=e.options)===null||n===void 0?void 0:n.redirectTo,s=(r=e.options)===null||r===void 0?void 0:r.captchaToken);const{data:a,error:o}=await Ue(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:s}}),redirectTo:i,xform:er});if(o)throw o;if(!a)throw new Error("An error occurred on token verification.");const l=a.session,c=a.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(Te(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithSSO(e){var n,r,i,s,a;try{let o=null,l=null;this.flowType==="pkce"&&([o,l]=await ws(this.storage,this.storageKey));const c=await Ue(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(r=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&r!==void 0?r:void 0}),!((i=e==null?void 0:e.options)===null||i===void 0)&&i.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}
93:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:cM});return!((s=c.data)===null||s===void 0)&&s.url&&qt()&&!(!((a=e.options)===null||a===void 0)&&a.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(o){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),Te(o))return this._returnResult({data:null,error:o});throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;if(r)throw r;if(!n)throw new Tn;const{error:i}=await Ue(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return this._returnResult({data:{user:null,session:null},error:i})})}catch(e){if(Te(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:r,type:i,options:s}=e,{error:a}=await Ue(this.fetch,"POST",n,{headers:this.headers,body:{email:r,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}},redirectTo:s==null?void 0:s.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:a})}else if("phone"in e){const{phone:r,type:i,options:s}=e,{data:a,error:o}=await Ue(this.fetch,"POST",n,{headers:this.headers,body:{phone:r,type:i,gotrue_meta_security:{captcha_token:s==null?void 0:s.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:a==null?void 0:a.message_id},error:o})}throw new Ml("You must provide either an email or phone number and a type")}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const r=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),i=(async()=>(await r,await n()))();return this.pendingInLock.push((async()=>{try{await i}catch{}})()),i}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const r=n();for(this.pendingInLock.push((async()=>{try{await r}catch{}})()),await r;this.pendingInLock.length;){const i=[...this.pendingInLock];await Promise.all(i),this.pendingInLock.splice(0,i.length)}return await r}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await Bi(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const r=e.expires_at?e.expires_at*1e3-Date.now()<Ku:!1;if(this._debug("#__loadSession()",`session has${r?"":" not"} expired`,"expires_at",e.expires_at),!r){if(this.userStorage){const a=await Bi(this.userStorage,this.storageKey+"-user");a!=null&&a.user?e.user=a.user:e.user=Zu()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const a={value:this.suppressGetSessionWarning};e.user=sM(e.user,a),a.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{session:null},error:s}):this._returnResult({data:{session:i},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const n=await this._acquireLock(-1,async()=>await this._getUser());return n.data.user&&(this.suppressGetSessionWarning=!0),n}async _getUser(e){try{return e?await Ue(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:pi}):await this._useSession(async n=>{var r,i,s;const{data:a,error:o}=n;
93if(o)throw o;return!(!((r=a.session)===null||r===void 0)&&r.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Tn}:await Ue(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(s=(i=a.session)===null||i===void 0?void 0:i.access_token)!==null&&s!==void 0?s:void 0,xform:pi})})}catch(n){if(Te(n))return kE(n)&&(await this._removeSession(),await Xt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:n});throw n}}async updateUser(e,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,n))}async _updateUser(e,n={}){try{return await this._useSession(async r=>{const{data:i,error:s}=r;if(s)throw s;if(!i.session)throw new Tn;const a=i.session;let o=null,l=null;this.flowType==="pkce"&&e.email!=null&&([o,l]=await ws(this.storage,this.storageKey));const{data:c,error:u}=await Ue(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:o,code_challenge_method:l}),jwt:a.access_token,xform:pi});if(u)throw u;return a.user=c.user,await this._saveSession(a),await this._notifyAllSubscribers("USER_UPDATED",a),this._returnResult({data:{user:a.user},error:null})})}catch(r){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),Te(r))return this._returnResult({data:{user:null},error:r});throw r}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Tn;const n=Date.now()/1e3;let r=n,i=!0,s=null;const{payload:a}=Ju(e.access_token);if(a.exp&&(r=a.exp,i=r<=n),i){const{data:o,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!o)return{data:{user:null,session:null},error:null};s=o}else{const{data:o,error:l}=await this._getUser(e.access_token);if(l)throw l;s={access_token:e.access_token,refresh_token:e.refresh_token,user:o.user,token_type:"bearer",expires_in:r-n,expires_at:r},await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)}return this._returnResult({data:{user:s.user,session:s},error:null})}catch(n){if(Te(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var r;if(!e){const{data:a,error:o}=n;if(o)throw o;e=(r=a.session)!==null&&r!==void 0?r:void 0}if(!(e!=null&&e.refresh_token))throw new Tn;const{data:i,error:s}=await this._callRefreshToken(e.refresh_token);return s?this._returnResult({data:{user:null,session:null},error:s}):i?this._returnResult({data:{user:i.user,session:i},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(n){if(Te(n))return this._returnResult({data:{user:null,session:null},error:n});throw n}}async _getSessionFromURL(e,n){try{if(!qt())throw new Tl("No browser detected.");if(e.error||e.error_description||e.error_code)throw new Tl(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new R0("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new Tl("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new R0("No code detected.");const{data:v,error:x}=await this._exchangeCodeForSession(e.code);if(x)throw x;const w=new URL(window.location.href);return w.searchParams.delete("code"),window.history.replaceState(window.history.state,"",w.toString()),{data:{session:v.session,redirectType:null},error:null}}const{provider_token:r,provider_refresh_token:i,access_token:s,refresh_token:a,expires_in:o,expires_at:l,token_type:c}=e;if(!s||!o||!a||!c)throw new Tl("No session defined in URL");const u=Math.round(Date.now()/1e3),d=parseInt(o);let f=u+d;l&&(f=parseInt(l));const p=f-u;
93p*1e3<=Vs&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${d}s`);const g=f-d;u-g>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",g,f,u):u-g<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",g,f,u);const{data:_,error:m}=await this._getUser(s);if(m)throw m;const h={provider_token:r,provider_refresh_token:i,access_token:s,expires_in:d,expires_at:f,refresh_token:a,token_type:c,user:_.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:h,redirectType:e.type},error:null})}catch(r){if(Te(r))return this._returnResult({data:{session:null,redirectType:null},error:r});throw r}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await Bi(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&n)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({error:s});const a=(r=i.session)===null||r===void 0?void 0:r.access_token;if(a){const{error:o}=await this.admin.signOut(a,e);if(o&&!(UE(o)&&(o.status===404||o.status===401||o.status===403)))return this._returnResult({error:o})}return e!=="others"&&(await this._removeSession(),await Xt(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const n=WE(),r={id:n,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",n),this.stateChangeEmitters.delete(n)}};return this._debug("#onAuthStateChange()","registered callback with id",n),this.stateChangeEmitters.set(n,r),(async()=>(await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(n)})))(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async n=>{var r,i;try{const{data:{session:s},error:a}=n;if(a)throw a;await((r=this.stateChangeEmitters.get(e))===null||r===void 0?void 0:r.callback("INITIAL_SESSION",s)),this._debug("INITIAL_SESSION","callback id",e,"session",s)}catch(s){await((i=this.stateChangeEmitters.get(e))===null||i===void 0?void 0:i.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",s),console.error(s)}})}async resetPasswordForEmail(e,n={}){let r=null,i=null;this.flowType==="pkce"&&([r,i]=await ws(this.storage,this.storageKey,!0));try{return await Ue(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:i,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(s){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),Te(s))return this._returnResult({data:null,error:s});throw s}}async getUserIdentities(){var e;try{const{data:n,error:r}=await this.getUser();if(r)throw r;return this._returnResult({data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:r,error:i}=await this._useSession(async s=>{var a,o,l,c,u;const{data:d,error:f}=s;if(f)throw f;const p=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(a=e.options)===null||a===void 0?void 0:a.redirectTo,scopes:(o=e.options)===null||o===void 0?void 0:o.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await Ue(this.fetch,"GET",p,{headers:this.headers,jwt:(u=(c=d.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(i)throw i;return qt()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(r==null?void 0:r.url),this._returnResult({data:{provider:e.provider,url:r==null?void 0:r.url},error:null})}catch(r){if(Te(r))return this._returnResult({data:{provider:e.provider,url:null},error:r});throw r}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var r;try{const{error:i,data:{session:s}}=n;
93if(i)throw i;const{options:a,provider:o,token:l,access_token:c,nonce:u}=e,d=await Ue(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(r=s==null?void 0:s.access_token)!==null&&r!==void 0?r:void 0,body:{provider:o,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:er}),{data:f,error:p}=d;return p?this._returnResult({data:{user:null,session:null},error:p}):!f||!f.session||!f.user?this._returnResult({data:{user:null,session:null},error:new ys}):(f.session&&(await this._saveSession(f.session),await this._notifyAllSubscribers("USER_UPDATED",f.session)),this._returnResult({data:f,error:p}))}catch(i){if(await Xt(this.storage,`${this.storageKey}-code-verifier`),Te(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var r,i;const{data:s,error:a}=n;if(a)throw a;return await Ue(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(i=(r=s.session)===null||r===void 0?void 0:r.access_token)!==null&&i!==void 0?i:void 0})})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const r=Date.now();return await KE(async i=>(i>0&&await qE(200*Math.pow(2,i-1)),this._debug(n,"refreshing attempt",i),await Ue(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:er})),(i,s)=>{const a=200*Math.pow(2,i);return s&&Yu(s)&&Date.now()+a-r<Vs})}catch(r){if(this._debug(n,"error",r),Te(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}finally{this._debug(n,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,n){const r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:n.redirectTo,scopes:n.scopes,queryParams:n.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",n,"url",r),qt()&&!n.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,n;const r="#_recoverAndRefresh()";this._debug(r,"begin");try{const i=await Bi(this.storage,this.storageKey);if(i&&this.userStorage){let a=await Bi(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!a&&(a={user:i.user},await js(this.userStorage,this.storageKey+"-user",a)),i.user=(e=a==null?void 0:a.user)!==null&&e!==void 0?e:Zu()}else if(i&&!i.user&&!i.user){const a=await Bi(this.storage,this.storageKey+"-user");a&&(a!=null&&a.user)?(i.user=a.user,await Xt(this.storage,this.storageKey+"-user"),await js(this.storage,this.storageKey,i)):i.user=Zu()}if(this._debug(r,"session from storage",i),!this._isValidSession(i)){this._debug(r,"session is not valid"),i!==null&&await this._removeSession();return}const s=((n=i.expires_at)!==null&&n!==void 0?n:1/0)*1e3-Date.now()<Ku;if(this._debug(r,`session has${s?"":" not"} expired with margin of ${Ku}s`),s){if(this.autoRefreshToken&&i.refresh_token){const{error:a}=await this._callRefreshToken(i.refresh_token);a&&(console.error(a),Yu(a)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",a),await this._removeSession()))}}else if(i.user&&i.user.__isUserNotAvailableProxy===!0)try{const{data:a,error:o}=await this._getUser(i.access_token);!o&&(a!=null&&a.user)?(i.user=a.user,await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(a){console.error("Error getting user data:",a),this._debug(r,"error getting user data, skipping SIGNED_IN notification",a)}else await this._notifyAllSubscribers("SIGNED_IN",i)}catch(i){this._debug(r,"error",i),console.error(i);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var n,r;if(!e)throw new Tn;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const i=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(i,"begin");try{this.refreshingDeferred=new uu;const{data:s,error:a}=await this._refreshAccessToken(e);if(a)throw a;if(!s.session)throw new Tn;await this._saveSession(s.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",s.session);const o={data:s.session,error:null};return this.refreshingDeferred.resolve(o),o}catch(s){if(this._debug(i,"error",s),Te(s)){const a={data:null,error:s};return Yu(s)||await this._removeSession(),(n=this.refreshingDeferred)===null||n===void 0||n.resolve(a),a}throw(r=this.refreshingDeferred)===null||r===void 0||r.reject(s),s}finally{this.refreshingDeferred=null,this._debug(i,"end")}}async _notifyAllSubscribers(e,n,r=!0){const i=`#_notifyAllSubscribers(${e})`;this._debug(i,"begin",n,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:n});const s=[],a=Array.from(this.stateChangeEmitters.values()).map(async o=>{try{await o.callback(e,n)}catch(l){s.push(l)}});if(await Promise.all(a),s.length>0){for(let o=0;o<s.length;o+=1)console.error(s[o]);throw s[0]}}finally{this._debug(i,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await Xt(this.storage,`${this.storageKey}-code-verifier`);const n=Object.assign({},e),r=n.user&&n.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!r&&n.user&&await js(this.userStorage,this.storageKey+"-user",{user:n.user});const i=Object.assign({},n);delete i.user;const s=I0(i);await js(this.storage,this.storageKey,s)}else{const i=I0(n);await js(this.storage,this.storageKey,i)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await Xt(this.storage,this.storageKey),await Xt(this.storage,this.storageKey+"-code-verifier"),await Xt(this.storage,this.storageKey+"-user"),this.userStorage&&await Xt(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&qt()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
93catch(n){console.error("removing visibilitychange callback failed",n)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Vs);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async n=>{const{data:{session:r}}=n;if(!r||!r.refresh_token||!r.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const i=Math.floor((r.expires_at*1e3-e)/Vs);this._debug("#_autoRefreshTokenTick()",`access token expires in ${i} ticks, a tick lasts ${Vs}ms, refresh threshold is ${Lh} ticks`),i<=Lh&&await this._callRefreshToken(r.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof N_)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!qt()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const n=`#_onVisibilityChanged(${e})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if(document.visibilityState!=="visible"){this._debug(n,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,n,r){const i=[`provider=${encodeURIComponent(n)}`];if(r!=null&&r.redirectTo&&i.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),r!=null&&r.scopes&&i.push(`scopes=${encodeURIComponent(r.scopes)}`),this.flowType==="pkce"){const[s,a]=await ws(this.storage,this.storageKey),o=new URLSearchParams({code_challenge:`${encodeURIComponent(s)}`,code_challenge_method:`${encodeURIComponent(a)}`});i.push(o.toString())}if(r!=null&&r.queryParams){const s=new URLSearchParams(r.queryParams);i.push(s.toString())}return r!=null&&r.skipBrowserRedirect&&i.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${i.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;return s?this._returnResult({data:null,error:s}):await Ue(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token})})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async _enroll(e){try{return await this._useSession(async n=>{var r,i;const{data:s,error:a}=n;if(a)return this._returnResult({data:null,error:a});const o=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await Ue(this.fetch,"POST",`${this.url}/factors`,{body:o,headers:this.headers,jwt:(r=s==null?void 0:s.session)===null||r===void 0?void 0:r.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((i=l==null?void 0:l.totp)===null||i===void 0)&&i.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({data:null,error:s});const a=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?MM(e.webauthn.credential_response):TM(e.webauthn.credential_response)})}:{code:e.code}),{data:o,error:l}=await Ue(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:a,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+o.expires_in},o)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",o),this._returnResult({data:o,error:l}))})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var r;const{data:i,error:s}=n;if(s)return this._returnResult({data:null,error:s});const a=await Ue(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(r=i==null?void 0:i.session)===null||r===void 0?void 0:r.access_token});if(a.error)return a;const{data:o}=a;if(o.type!=="webauthn")return{data:o,error:null};switch(o.webauthn.type){case"create":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:bM(o.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},o),{webauthn:Object.assign(Object.assign({},o.webauthn),{credential_options:Object.assign(Object.assign({},o.webauthn.credential_options),{publicKey:EM(o.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}})}async _challengeAndVerify(e){const{data:n,error:r}=await this._challenge({factorId:e.factorId});return r?this._returnResult({data:null,error:r}):await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:r}=await this.getUser();if(r)return{data:null,error:r};const i={all:[],phone:[],totp:[],webauthn:[]};for(const s of(e=n==null?void 0:n.factors)!==null&&e!==void 0?e:[])i.all.push(s),s.status==="verified"&&i[s.factor_type].push(s);return{data:i,error:null}}async _getAuthenticatorAssuranceLevel(){var e,n;const{data:{session:r},error:i}
93=await this.getSession();if(i)return this._returnResult({data:null,error:i});if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:s}=Ju(r.access_token);let a=null;s.aal&&(a=s.aal);let o=a;((n=(e=r.user.factors)===null||e===void 0?void 0:e.filter(u=>u.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(o="aal2");const c=s.amr||[];return{data:{currentLevel:a,nextLevel:o,currentAuthenticationMethods:c},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?await Ue(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Tn})})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async r=>{const{data:{session:i},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new Tn});const a=await Ue(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"approve"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&qt()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(Te(r))return this._returnResult({data:null,error:r});throw r}}async _denyAuthorization(e,n){try{return await this._useSession(async r=>{const{data:{session:i},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!i)return this._returnResult({data:null,error:new Tn});const a=await Ue(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:i.access_token,body:{action:"deny"},xform:o=>({data:o,error:null})});return a.data&&a.data.redirect_url&&qt()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(a.data.redirect_url),a})}catch(r){if(Te(r))return this._returnResult({data:null,error:r});throw r}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:n},error:r}=e;return r?this._returnResult({data:null,error:r}):n?await Ue(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Tn})})}catch(e){if(Te(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async n=>{const{data:{session:r},error:i}=n;return i?this._returnResult({data:null,error:i}):r?(await Ue(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Tn})})}catch(n){if(Te(n))return this._returnResult({data:null,error:n});throw n}}async fetchJwk(e,n={keys:[]}){let r=n.keys.find(o=>o.kid===e);if(r)return r;const i=Date.now();if(r=this.jwks.keys.find(o=>o.kid===e),r&&this.jwks_cached_at+IE>i)return r;const{data:s,error:a}=await Ue(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(a)throw a;return!s.keys||s.keys.length===0||(this.jwks=s,this.jwks_cached_at=i,r=s.keys.find(o=>o.kid===e),!r)?null:r}async getClaims(e,n={}){try{let r=e;if(!r){const{data:p,error:g}
93=await this.getSession();if(g||!p.session)return this._returnResult({data:null,error:g});r=p.session.access_token}const{header:i,payload:s,signature:a,raw:{header:o,payload:l}}=Ju(r);n!=null&&n.allowExpired||nM(s.exp);const c=!i.alg||i.alg.startsWith("HS")||!i.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(i.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!c){const{error:p}=await this.getUser(r);if(p)throw p;return{data:{claims:s,header:i,signature:a},error:null}}const u=rM(i.alg),d=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,d,a,HE(`${o}.${l}`)))throw new Uh("Invalid JWT signature");return{data:{claims:s,header:i,signature:a},error:null}}catch(r){if(Te(r))return this._returnResult({data:null,error:r});throw r}}}ko.nextInstanceID={};const UM=ko,kM="0.0.0-automated";let Za="";typeof Deno<"u"?Za="deno":typeof document<"u"?Za="web":typeof navigator<"u"&&navigator.product==="ReactNative"?Za="react-native":Za="node";const OM={"X-Client-Info":`supabase-js-${Za}/${kM}`},FM={headers:OM},BM={schema:"public"},zM={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},VM={};function Oo(t){"@babel/helpers - typeof";return Oo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Oo(t)}function jM(t,e){if(Oo(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(Oo(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function HM(t){var e=jM(t,"string");return Oo(e)=="symbol"?e:e+""}function GM(t,e,n){return(e=HM(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function z0(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Rt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?z0(Object(n),!0).forEach(function(r){GM(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):z0(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}const WM=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),$M=()=>Headers,XM=(t,e,n)=>{const r=WM(n),i=$M();return async(s,a)=>{var o;const l=(o=await e())!==null&&o!==void 0?o:t;let c=new i(a==null?void 0:a.headers);return c.has("apikey")||c.set("apikey",t),c.has("Authorization")||c.set("Authorization",`Bearer ${l}`),r(s,Rt(Rt({},a),{},{headers:c}))}};function qM(t){return t.endsWith("/")?t:t+"/"}function KM(t,e){var n,r;const{db:i,auth:s,realtime:a,global:o}=t,{db:l,auth:c,realtime:u,global:d}=e,f={db:Rt(Rt({},l),i),auth:Rt(Rt({},c),s),realtime:Rt(Rt({},u),a),storage:{},global:Rt(Rt(Rt({},d),o),{},{headers:Rt(Rt({},(n=d==null?void 0:d.headers)!==null&&n!==void 0?n:{}),(r=o==null?void 0:o.headers)!==null&&r!==void 0?r:{})}),accessToken:async()=>""};return t.accessToken?f.accessToken=t.accessToken:delete f.accessToken,f}function YM(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(qM(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var JM=class extends UM{constructor(t){super(t)}},ZM=class{constructor(t,e,n){var r,i;this.supabaseUrl=t,this.supabaseKey=e;const s=YM(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",s),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",s),this.storageUrl=new URL("storage/v1",s),this.functionsUrl=new URL("functions/v1",s);const a=`sb-${s.hostname.split(".")[0]}-auth-token`,o={db:BM,realtime:VM,auth:Rt(Rt({},zM),{},{storageKey:a}),global:FM},l=KM(n??{},o);if(this.storageKey=(r=l.auth.storageKey)!==null&&r!==void 0?r:"",this.headers=(i=l.global.headers)!==null&&i!==void 0?i:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,d)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(d)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=XM(e,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Rt({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.accessToken&&this.accessToken().then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new Nb(new 
93URL("rest/v1",s).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new RE(this.storageUrl.href,this.headers,this.fetch,n==null?void 0:n.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new Tb(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},n={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,n)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,n;if(t.accessToken)return await t.accessToken();const{data:r}=await t.auth.getSession();return(e=(n=r.session)===null||n===void 0?void 0:n.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:r,userStorage:i,storageKey:s,flowType:a,lock:o,debug:l,throwOnError:c},u,d){const f={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new JM({url:this.authUrl.href,headers:Rt(Rt({},f),u),storageKey:s,autoRefreshToken:t,persistSession:e,detectSessionInUrl:n,storage:r,userStorage:i,flowType:a,lock:o,debug:l,throwOnError:c,fetch:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(p=>p.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new qb(this.realtimeUrl.href,Rt(Rt({},t),{},{params:Rt(Rt({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,n){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==n?(this.changedAccessToken=n,this.realtime.setAuth(n)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const QM=(t,e,n)=>new ZM(t,e,n);function e3(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}e3()&&console.warn("⚠️  Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const t3="https://rnryqctsoxjsmvqehgau.supabase.co",n3="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJucnlxY3Rzb3hqc212cWVoZ2F1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjQ2ODM4MzAsImV4cCI6MjA4MDI1OTgzMH0.tyV6pKfvf5MO-W56lFCFOiZAcCpOcq-uAX9rqK8oano",ct=QM(t3,n3),V0="santa-game-player";function D_(t){const[e,n]=k.useState(null),[r,i]=k.useState(!0),[s,a]=k.useState(null);k.useEffect(()=>{if(!t){i(!1);return}const l=localStorage.getItem(V0);if(l)try{n(JSON.parse(l))}catch(c){console.error("Failed to parse cached player",c)}o()},[t]);const o=async()=>{if(t)try{i(!0);const{data:l,error:c}=await ct.functions.invoke("assign_nickname",{body:{deviceId:t}});if(c)throw c;l&&(n(l),localStorage.setItem(V0,JSON.stringify(l)),a(null))}catch(l){a(l.message||"Failed to assign nickname"),console.error("Error assigning nickname:",l)}finally{i(!1)}};return{player:e,loading:r,error:s}}/**
94 * @license lucide-react v0.344.0 - ISC
95 *
96 * This source code is licensed under the ISC license.
97 * See the LICENSE file in the root directory of this source tree.
98 */var r3={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
99 * @license lucide-react v0.344.0 - ISC
100 *
101 * This source code is licensed under the ISC license.
102 * See the LICENSE file in the root directory of this source tree.
103 */const i3=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Wt=(t,e)=>{const n=k.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:a,className:o="",children:l,...c},u)=>k.createElement("svg",{ref:u,...r3,width:i,height:i,stroke:r,strokeWidth:a?Number(s)*24/Number(i):s,className:["lucide",`lucide-${i3(t)}`,o].join(" "),...c},[...e.map(([d,f])=>k.createElement(d,f)),...Array.isArray(l)?l:[l]]));return n.displayName=`${t}`,n};/**
104 * @license lucide-react v0.344.0 - ISC
105 *
106 * This source code is licensed under the ISC license.
107 * See the LICENSE file in the root directory of this source tree.
108 */const U_=Wt("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/**
109 * @license lucide-react v0.344.0 - ISC
110 *
111 * This source code is licensed under the ISC license.
112 * See the LICENSE file in the root directory of this source tree.
113 */const s3=Wt("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/**
114 * @license lucide-react v0.344.0 - ISC
115 *
116 * This source code is licensed under the ISC license.
117 * See the LICENSE file in the root directory of this source tree.
118 */const or=Wt("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
119 * @license lucide-react v0.344.0 - ISC
120 *
121 * This source code is licensed under the ISC license.
122 * See the LICENSE file in the root directory of this source tree.
123 */const a3=Wt("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
124 * @license lucide-react v0.344.0 - ISC
125 *
126 * This source code is licensed under the ISC license.
127 * See the LICENSE file in the root directory of this source tree.
128 */const fo=Wt("Hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]);/**
129 * @license lucide-react v0.344.0 - ISC
130 *
131 * This source code is licensed under the ISC license.
132 * See the LICENSE file in the root directory of this source tree.
133 */const k_=Wt("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]]);/**
134 * @license lucide-react v0.344.0 - ISC
135 *
136 * This source code is licensed under the ISC license.
137 * See the LICENSE file in the root directory of this source tree.
138 */const kh=Wt("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
139 * @license lucide-react v0.344.0 - ISC
140 *
141 * This source code is licensed under the ISC license.
142 * See the LICENSE file in the root directory of this source tree.
143 */const o3=Wt("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
144 * @license lucide-react v0.344.0 - ISC
145 *
146 * This source code is licensed under the ISC license.
147 * See the LICENSE file in the root directory of this source tree.
148 */const l3=Wt("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
149 * @license lucide-react v0.344.0 - ISC
150 *
151 * This source code is licensed under the ISC license.
152 * See the LICENSE file in the root directory of this source tree.
153 */const c3=Wt("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
154 * @license lucide-react v0.344.0 - ISC
155 *
156 * This source code is licensed under the ISC license.
157 * See the LICENSE file in the root directory of this source tree.
158 */const u3=Wt("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
159 * @license lucide-react v0.344.0 - ISC
160 *
161 * This source code is licensed under the ISC license.
162 * See the LICENSE file in the root directory of this source tree.
163 */const Al=Wt("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/**
164 * @license lucide-react v0.344.0 - ISC
165 *
166 * This source code is licensed under the ISC license.
167 * See the LICENSE file in the root directory of this source tree.
168 */const d3=Wt("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
169 * @license lucide-react v0.344.0 - ISC
170 *
171 * This source code is licensed under the ISC license.
172 * See the LICENSE file in the root directory of this source tree.
173 */const j0=Wt("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
174 * @license lucide-react v0.344.0 - ISC
175 *
176 * This source code is licensed under the ISC license.
177 * See the LICENSE file in the root directory of this source tree.
178 */const O_=Wt("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}
178],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/**
179 * @license lucide-react v0.344.0 - ISC
180 *
181 * This source code is licensed under the ISC license.
182 * See the LICENSE file in the root directory of this source tree.
183 */const F_=Wt("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
184 * @license lucide-react v0.344.0 - ISC
185 *
186 * This source code is licensed under the ISC license.
187 * See the LICENSE file in the root directory of this source tree.
188 */const B_=Wt("Wand2",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72Z",key:"1bcowg"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/**
189 * @license lucide-react v0.344.0 - ISC
190 *
191 * This source code is licensed under the ISC license.
192 * See the LICENSE file in the root directory of this source tree.
193 */const h3=Wt("Zap",[["polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",key:"45s27k"}]]);function f3(){const t=Ko(),e=g_(),{loading:n}=D_(e);return y.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-red-600 via-green-700 to-red-800 flex flex-col p-4 relative overflow-hidden",children:[y.jsx(Al,{className:"absolute top-10 left-10 w-16 h-16 text-white/20 animate-spin",style:{animationDuration:"10s"}}),y.jsx(Al,{className:"absolute top-20 right-20 w-12 h-12 text-white/20 animate-spin",style:{animationDuration:"15s"}}),y.jsx(Al,{className:"absolute bottom-20 left-1/4 w-20 h-20 text-white/20 animate-spin",style:{animationDuration:"12s"}}),y.jsx(Al,{className:"absolute bottom-10 right-1/3 w-14 h-14 text-white/20 animate-spin",style:{animationDuration:"8s"}}),y.jsx("nav",{className:"relative z-20 mb-4",children:y.jsx("div",{className:"max-w-4xl mx-auto",children:y.jsx("div",{className:"bg-white/95 backdrop-blur-sm rounded-lg shadow-lg p-4",children:y.jsxs("div",{className:"flex flex-wrap justify-center items-center gap-4",children:[y.jsxs(Pi,{to:"/instructions",className:"flex items-center gap-2 text-gray-700 hover:text-red-600 transition-colors font-medium",children:[y.jsx(U_,{className:"w-5 h-5"}),"Instructions"]}),y.jsx("span",{className:"text-gray-300",children:"|"}),y.jsxs(Pi,{to:"/game",className:"flex items-center gap-2 text-gray-700 hover:text-red-600 transition-colors font-medium",children:[y.jsx(s3,{className:"w-5 h-5"}),"Game"]})]})})})}),y.jsx("div",{className:"flex-1 flex items-center justify-center",children:y.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-8 max-w-md w-full text-center relative z-10",children:[y.jsx(or,{className:"w-24 h-24 mx-auto mb-6 text-red-600 animate-bounce"}),y.jsx("h1",{className:"text-4xl font-bold text-gray-900 mb-2",children:"Santa's Lost Present"}),y.jsx("p",{className:"text-gray-600 mb-8",children:"Help find the hidden present somewhere in Greater London!"}),n?y.jsxs("div",{className:"space-y-4",children:[y.jsxs("div",{className:"animate-pulse",children:[y.jsx("div",{className:"h-4 bg-gray-200 rounded w-3/4 mx-auto mb-2"}),y.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2 mx-auto"})]}),y.jsx("p",{className:"text-gray-500 text-sm",children:"Assigning your festive nickname..."})]}):y.jsx("button",{onClick:()=>t("/game"),className:"w-full bg-red-600 text-white font-bold py-4 px-8 rounded-lg hover:bg-red-700 transition-all transform hover:scale-105 shadow-lg",children:"Join the Hunt!"}),y.jsxs("div",{className:"mt-8 text-sm text-gray-500 space-y-1",children:[y.jsx("p",{children:"Tap anywhere on the map to guess"}),y.jsx("p",{children:"Get within 1 kilometer to win!"})]})]})}),y.jsx("footer",{className:"relative z-20 mt-4",children:y.jsx("div",{className:"max-w-4xl mx-auto",children:y.jsx("div",{className:"bg-black/80 backdrop-blur-md rounded-lg border border-white/20 p-3",children:y.jsx("div",{className:"flex flex-wrap justify-center items-center gap-4 text-sm",children:y.jsxs("div",{className:"flex items-center gap-4 text-gray-300",children:[y.jsxs("a",{href:"https://github.com/mandarini",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-white transition-colors",children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"
193currentColor",children:y.jsx("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})}),"GitHub"]}),y.jsxs("a",{href:"https://x.com/psybercity",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-white transition-colors",children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),"Twitter"]}),y.jsxs("a",{href:"https://psyber.city",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-white transition-colors",children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}),"Website"]}),y.jsx("span",{className:"text-gray-500",children:"|"}),y.jsxs("a",{href:"https://github.com/mandarini/santas-lost-present",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-white transition-colors",children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"})}),"Source Code"]}),y.jsxs("a",{href:"https://supabase.com/docs",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-white transition-colors",children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M21.362 9.354H12V.396a.396.396 0 0 0-.716-.233L2.203 12.424l-.401.562a1.04 1.04 0 0 0 .836 1.659H12v8.959a.396.396 0 0 0 .716.233l9.081-12.261.401-.562a1.04 1.04 0 0 0-.836-1.66z"})}),"Supabase Docs"]})]})})})})})]})}function z_(){const[t,e]=k.useState(null),[n,r]=k.useState(!0);k.useEffect(()=>{i();const s=ct.channel("round-status").on("postgres_changes",{event:"UPDATE",schema:"public",table:"rounds",filter:"id=eq.main-round"},a=>{e(a.new)}).subscribe();return()=>{ct.removeChannel(s)}},[]);const i=async()=>{try{const{data:s,error:a}=await ct.from("rounds").select("*").eq("id","main-round").single();if(a)throw a;e(s)}catch(s){console.error("Error fetching round:",s)}finally{r(!1)}};return{round:t,loading:n}}function V_(t){const[e,n]=k.useState(new Map);k.useEffect(()=>{if(t===null)return;r();const i=ct.channel("guesses").on("postgres_changes",{event:"*",schema:"public",table:"guesses"},s=>{if(s.eventType==="INSERT"||s.eventType==="UPDATE"){const a=s.new;a.round_no===t&&n(o=>{const l=new Map(o);return l.set(a.player_id,a),l})}else if(s.eventType==="DELETE"){const a=s.old;n(o=>{const l=new Map(o);return l.delete(a.player_id),l})}}).subscribe();return()=>{ct.removeChannel(i)}},[t]);const r=async()=>{if(t!==null)try{const{data:i,error:s}=await ct.from("guesses").select("*").eq("round_no",t);if(s)throw s;const a=new Map;i==null||i.forEach(o=>{a.set(o.player_id,o)}),n(a)}catch(i){console.error("Error fetching guesses:",i)}};return e}const di={north:51.7,south:51.3,west:-.5,east:.3},j_={lat:51.5,lng:-.1};async function H_(){const t="AIzaSyAD7tBmyWCa4NzpLyK1Tj57FNulquxQmdY";if(!window.google){const e=document.createElement("script");e.src=`https://maps.googleapis.com/maps/api/js?key=${t}&libraries=marker,geometry,places&v=weekly`,e.async=!0,e.defer=!0,await new Promise((n,r)=>{e.onload=n,e.onerror=r,document.head.appendChild(e)})}return window.google.maps}function p3(t,e,n,r){var o,l;if(!((l=(o=window.google)==null?void 0:o.maps)!=null&&l.geometry)){const u=t*Math.PI/180,d=n*Math.PI/180,f=(n-t)*
193Math.PI/180,p=(r-e)*Math.PI/180,g=Math.sin(f/2)*Math.sin(f/2)+Math.cos(u)*Math.cos(d)*Math.sin(p/2)*Math.sin(p/2);return 6371e3*(2*Math.atan2(Math.sqrt(g),Math.sqrt(1-g)))}const i=window.google,s=new i.maps.LatLng(t,e),a=new i.maps.LatLng(n,r);return i.maps.geometry.spherical.computeDistanceBetween(s,a)}function Zi(t){return`hsl(${Math.max(0,Math.min(3e4,t))/3e4*240}, 100%, 50%)`}function H0(t){return t<=1e3?"🎁 YOU WIN!":t<=2e3?"🔥 BURNING HOT!":t<=5e3?"🔥 Very Hot!":t<=1e4?"🌡️ Hot":t<=15e3?"🌡️ Warm":t<=2e4?"😐 Lukewarm":t<=25e3?"❄️ Cool":t<=3e4?"🥶 Very Cold":"🧊 Freezing!"}function m3(){return{lat:di.south+Math.random()*(di.north-di.south),lng:di.west+Math.random()*(di.east-di.west)}}function g3(t,e,n=2e3){const r=n/111e3,i=n/(111e3*Math.cos(t*Math.PI/180));return[{lat:t-r,lng:e+i*.8},{lat:t-r,lng:e-i*.8},{lat:t+r*.3,lng:e-i*.8},{lat:t+r*.6,lng:e-i*1},{lat:t+r*.8,lng:e-i*.4},{lat:t+r,lng:e},{lat:t+r*.8,lng:e+i*.4},{lat:t+r*.6,lng:e+i*1},{lat:t+r*.3,lng:e+i*.8}]}function Oh(t){return t>=10?1:t>=8?.8:t>=6?.6:t>=4?.4:t>=2?.2:0}function x3(){var N;const t=Ko(),e=g_(),{player:n,loading:r}=D_(e),{round:i}=z_(),s=V_((i==null?void 0:i.round_no)??null),a=k.useRef(null),[,o]=k.useState(null),[l,c]=k.useState(null),[u,d]=k.useState(!1),[f,p]=k.useState(null),[g,_]=k.useState(null),[m,h]=k.useState(null),v=k.useRef(i),x=k.useRef(n),w=k.useRef(l),A=k.useRef(g),E=k.useRef(null);k.useEffect(()=>{v.current=i},[i]),k.useEffect(()=>{x.current=n},[n]),k.useEffect(()=>{w.current=l},[l]),k.useEffect(()=>{A.current=g},[g]),k.useEffect(()=>{n&&R()},[n]),k.useEffect(()=>{if(f){const U=setTimeout(()=>p(null),3e3);return()=>clearTimeout(U)}},[f]),k.useEffect(()=>{const U=E.current;if(!U||!i||i.mode!=="polygon"||!i.polygon_coords){m&&(m.setMap(null),h(null));return}const B=window.google;if(!B)return;const X=s.size,W=Oh(X);if(m)m.setOptions({strokeOpacity:W,fillOpacity:W*.35});else{const V=new B.maps.Polygon({paths:i.polygon_coords,strokeColor:"#c41e3a",strokeOpacity:W,strokeWeight:3,fillColor:"#c41e3a",fillOpacity:W*.35,clickable:!1,map:U});h(V)}},[i==null?void 0:i.mode,i==null?void 0:i.polygon_coords,s.size,E.current]),k.useEffect(()=>()=>{m&&m.setMap(null)},[]);const R=async()=>{if(a.current)try{await H_();const U=window.google,B=new U.maps.Map(a.current,{center:j_,zoom:10,mapId:"5b9375d27ba22f66a3252f7b",restriction:{latLngBounds:di,strictBounds:!1},disableDefaultUI:!1,zoomControl:!0,mapTypeControl:!1,streetViewControl:!1,fullscreenControl:!1});B.addListener("click",P),E.current=B,o(B)}catch(U){console.error("Error loading Google Maps:",U),p(U.message||"Failed to load map")}},P=async U=>{var de,Ee,se;const B=v.current,X=x.current,W=w.current;if(!X||!B||B.status!=="running"){(B==null?void 0:B.status)==="idle"?p("Game not started yet"):(B==null?void 0:B.status)==="finished"?p("Game has ended"):B||p("Loading game...");return}const V=U.latLng.lat(),Q=U.latLng.lng(),D=window.google;console.log((de=x.current)==null?void 0:de.color);const q=A.current!==null?Zi(A.current):((Ee=x.current)==null?void 0:Ee.color)||"#EF4444",Y=document.createElement("div");if(Y.style.cssText=`
194      display: inline-block;
195      background: ${q};
196      padding: 8px 16px;
197      border-radius: 24px;
198      color: white;
199      font-weight: bold;
200      box-shadow: 0 4px 12px rgba(0,0,0,0.4);
201      border: 3px solid white;
202      font-size: 14px;
203      white-space: nowrap;
204    `,Y.textContent=`📍 ${((se=x.current)==null?void 0:se.nickname)||"You"}`,console.log("Creating marker at:",V,Q),W)W.position={lat:V,lng:Q},W.content=Y;else{const ae=new D.maps.marker.AdvancedMarkerElement({map:E.current,position:{lat:V,lng:Q},content:Y,title:"Your guess"});w.current=ae,c(ae)}await M(V,Q)},M=async(U,B)=>{var X,W;if(!(u||!e))try{d(!0);const{data:V,error:Q}=await ct.functions.invoke("submit_guess",{body:{deviceId:e,lat:U,lng:B}});if(Q)throw Q;
204if(((X=v.current)==null?void 0:X.mode)==="polygon"){p("Guess submitted!");return}if(console.log("Server response:",V),(V==null?void 0:V.distance_m)!==void 0&&V.distance_m!==null){console.log("Distance:",V.distance_m,"Color:",Zi(V.distance_m)),_(V.distance_m),b(V.distance_m);const D=H0(V.distance_m);if((W=v.current)!=null&&W.show_distance){const q=V.distance_m>=1e3?`${(V.distance_m/1e3).toFixed(1)} km`:`${Math.round(V.distance_m)} m`;p(`${D} (${q})`)}else p(D)}else console.log("No distance returned from server"),p("Guess submitted!")}catch(V){console.error("Error submitting guess:",V),p(V.message||"Failed to submit guess")}finally{d(!1)}},b=U=>{var V;const B=w.current;if(!B){console.log("No marker to update");return}const X=Zi(U);console.log("Updating marker with distance:",U,"color:",X);const W=document.createElement("div");W.style.cssText=`
205      display: inline-block;
206      background: ${X};
207      padding: 8px 16px;
208      border-radius: 24px;
209      color: white;
210      font-weight: bold;
211      box-shadow: 0 4px 12px rgba(0,0,0,0.4);
212      border: 3px solid white;
213      font-size: 14px;
214      white-space: nowrap;
215      text-shadow: 0 1px 2px rgba(0,0,0,0.3);
216    `,W.textContent=((V=x.current)==null?void 0:V.nickname)||"You",B.content=W};return r?y.jsx("div",{className:"min-h-screen bg-gradient-to-br from-red-600 via-green-700 to-red-800 flex items-center justify-center",children:y.jsxs("div",{className:"text-white text-center",children:[y.jsx(or,{className:"w-16 h-16 mx-auto mb-4 animate-bounce"}),y.jsx("p",{className:"text-xl",children:"Joining the hunt..."})]})}):n?y.jsxs("div",{className:"relative w-screen h-screen",children:[y.jsx("div",{ref:a,className:"w-full h-full"}),y.jsx("div",{className:"absolute top-4 left-4 right-4 bg-white/95 backdrop-blur-sm rounded-lg shadow-lg p-4",children:y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsxs("div",{children:[y.jsx("p",{className:"text-sm text-gray-600",children:"Playing as"}),y.jsx("p",{className:"text-lg font-bold",style:{color:n.color},children:n.nickname})]}),y.jsxs(Pi,{to:"/",className:"flex items-center gap-1 text-gray-600 hover:text-red-600 transition-colors text-sm",title:"Home",children:[y.jsx(k_,{className:"w-4 h-4"}),y.jsx("span",{className:"hidden sm:inline",children:"Home"})]}),y.jsxs(Pi,{to:"/instructions",className:"flex items-center gap-1 text-gray-600 hover:text-red-600 transition-colors text-sm",title:"View Instructions",children:[y.jsx(U_,{className:"w-4 h-4"}),y.jsx("span",{className:"hidden sm:inline",children:"Help"})]})]}),y.jsxs("div",{className:"text-right",children:[(i==null?void 0:i.status)==="idle"&&y.jsx("span",{className:"inline-block bg-gray-200 text-gray-800 px-3 py-1 rounded-full text-sm font-medium",children:"Waiting to start..."}),(i==null?void 0:i.status)==="running"&&y.jsxs("span",{className:"inline-block bg-green-500 text-white px-3 py-1 rounded-full text-sm font-medium animate-pulse",children:["Round ",i.round_no," - ",i.mode==="elf"?"Elf Mode":i.mode==="polygon"?"Polygon Hunt":"Normal"]}),(i==null?void 0:i.status)==="finished"&&y.jsx("span",{className:"inline-block bg-red-500 text-white px-3 py-1 rounded-full text-sm font-medium",children:"Game Over"})]})]})}),(i==null?void 0:i.status)==="running"&&y.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 bg-white/95 backdrop-blur-sm rounded-lg shadow-lg px-6 py-3",children:i.mode==="polygon"?y.jsxs("div",{className:"text-center",children:[y.jsx("p",{className:"text-sm font-medium text-gray-700",children:s.size>0?`${s.size} players guessing - find the hidden polygon!`:"Tap anywhere to place your guess"}),y.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Get 10 players inside to win!"})]}):g!==null?y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-white shadow-lg",style:{backgroundColor:Zi(g)}}),y.jsxs("div",{children:[y.jsxs("p",{className:"text-lg font-bold",style:{color:Zi(g)},children:[H0(g),(i==null?void 0:i.show_distance)&&y.jsxs("span",{className:"text-sm font-normal text-gray-600 ml-2",children:["(",g>=1e3?`${(g/1e3).toFixed(1)} km`:`${Math.round(g)} m`,")"]})]}),y.jsx("p",{className:"text-xs text-gray-500",children:"Tap to move your guess"})]})]}):y.jsx("p",{className:"text-sm font-medium text-gray-700",children:"Tap anywhere to place your guess"})}),(i==null?void 0:i.status)==="finished"&&i.winner_player_id===n.id&&y.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center",children:y.jsxs("div",{className:"bg-white rounded-lg shadow-2xl p-8 max-w-md text-center animate-bounce",children:[y.jsx(or,{className:"w-24 h-24 mx-auto mb-4 text-yellow-500"}),y.jsx("h1",{className:"text-4xl font-bold text-green-600 mb-2",children:"You Won!"}),y.jsxs("p",{className:"text-gray-600",children:["You found the present! Distance: ",(N=i.winner_distance_m)==null?void 0:N.toFixed(1),"m"]})]})}),(i==null?void 0:i.status)==="finished"&&i.winner_player_id!==n.id&&y.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center",children:y.jsxs("div",{className:"bg-white rounded-lg shadow-2xl p-8 max-w-md text-center",children:[y.jsx("h1",{className:"text-3xl font-bold text-gray-800 mb
216-4",children:"Game Over"}),y.jsx("p",{className:"text-gray-600",children:"Check the big screen for results!"})]})}),f&&y.jsx("div",{className:"absolute top-24 left-1/2 -translate-x-1/2 bg-gray-900 text-white px-6 py-3 rounded-lg shadow-lg",children:f})]}):y.jsx("div",{className:"min-h-screen bg-gradient-to-br from-red-600 via-green-700 to-red-800 flex items-center justify-center",children:y.jsxs("div",{className:"bg-white rounded-lg shadow-2xl p-8 max-w-md text-center",children:[y.jsx(or,{className:"w-16 h-16 mx-auto mb-4 text-red-600"}),y.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Failed to Join"}),y.jsx("p",{className:"text-gray-600 mb-6",children:"Unable to assign a nickname. Please try again."}),y.jsx("button",{onClick:()=>t("/"),className:"bg-red-600 text-white px-6 py-2 rounded-lg hover:bg-red-700 transition",children:"Try Again"})]})})}function v3(){const[t,e]=k.useState(new Map);k.useEffect(()=>{n();const r=ct.channel("players").on("postgres_changes",{event:"*",schema:"public",table:"players"},i=>{if(i.eventType==="INSERT"){const s=i.new;e(a=>{const o=new Map(a);return o.set(s.id,s),o})}else if(i.eventType==="UPDATE"){const s=i.new;e(a=>{const o=new Map(a);return o.set(s.id,s),o})}else if(i.eventType==="DELETE"){const s=i.old;e(a=>{const o=new Map(a);return o.delete(s.id),o})}}).subscribe();return()=>{ct.removeChannel(r)}},[]);const n=async()=>{try{const{data:r,error:i}=await ct.from("players").select("*");if(i)throw i;const s=new Map;r==null||r.forEach(a=>{s.set(a.id,a)}),e(s)}catch(r){console.error("Error fetching players:",r)}};return t}function Dp(){const[t,e]=k.useState(null),[n,r]=k.useState(null),[i,s]=k.useState(!0);return k.useEffect(()=>{ct.auth.getSession().then(({data:{session:c}})=>{e(c),r((c==null?void 0:c.user)??null),s(!1)});const{data:{subscription:l}}=ct.auth.onAuthStateChange((c,u)=>{e(u),r((u==null?void 0:u.user)??null),s(!1)});return()=>l.unsubscribe()},[]),{session:t,user:n,loading:i,signInWithGitHub:async()=>{const{error:l}=await ct.auth.signInWithOAuth({provider:"github",options:{redirectTo:`${window.location.origin}/admin`}});if(l)throw console.error("Error signing in:",l),l},signOut:async()=>{const{error:l}=await ct.auth.signOut();if(l)throw console.error("Error signing out:",l),l},isAuthenticated:!!t}}/**
217 * @license
218 * Copyright 2010-2025 Three.js Authors
219 * SPDX-License-Identifier: MIT
220 */const Up="181",_3=0,G0=1,y3=2,G_=1,w3=2,Ir=3,Ni=0,wn=1,Or=2,Gr=0,ca=1,W0=2,$0=3,X0=4,S3=5,Qi=100,b3=101,E3=102,M3=103,T3=104,A3=200,R3=201,C3=202,P3=203,Fh=204,Bh=205,N3=206,L3=207,I3=208,D3=209,U3=210,k3=211,O3=212,F3=213,B3=214,zh=0,Vh=1,jh=2,va=3,Hh=4,Gh=5,Wh=6,$h=7,W_=0,z3=1,V3=2,Ai=0,j3=1,H3=2,G3=3,W3=4,$3=5,X3=6,q3=7,$_=300,_a=301,ya=302,Xh=303,qh=304,du=306,Kh=1e3,zr=1001,Yh=1002,Ln=1003,K3=1004,Rl=1005,Gn=1006,ed=1007,ss=1008,Sr=1009,X_=1010,q_=1011,Fo=1012,kp=1013,fs=1014,Vr=1015,Ca=1016,Op=1017,Fp=1018,Bo=1020,K_=35902,Y_=35899,J_=1021,Z_=1022,lr=1023,zo=1026,Vo=1027,Q_=1028,Bp=1029,zp=1030,Vp=1031,jp=1033,lc=33776,cc=33777,uc=33778,dc=33779,Jh=35840,Zh=35841,Qh=35842,ef=35843,tf=36196,nf=37492,rf=37496,sf=37808,af=37809,of=37810,lf=37811,cf=37812,uf=37813,df=37814,hf=37815,ff=37816,pf=37817,mf=37818,gf=37819,xf=37820,vf=37821,_f=36492,yf=36494,wf=36495,Sf=36283,bf=36284,Ef=36285,Mf=36286,Y3=3200,J3=3201,ey=0,Z3=1,mi="",Bn="srgb",wa="srgb-linear",Vc="linear",ot="srgb",Ms=7680,q0=519,Q3=512,eT=513,tT=514,ty=515,nT=516,rT=517,iT=518,sT=519,K0=35044,Y0="300 es",vr=2e3,jc=2001;function ny(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function Hc(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function aT(){const t=Hc("canvas");return t.style.display="block",t}const J0={};function Z0(...t){const e="THREE."+t.shift();console.log(e,...t)}function He(...t){const e="THREE."+t.shift();console.warn(e,...t)}function It(...t){const e="THREE."+t.shift();console.error(e,...t)}function jo(...t){const e=t.join(" ");e in J0||(J0[e]=!0,He(...t))}function oT(t,e,n){return new Promise(function(r,i){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:r()}}setTimeout(s,n)})}class Pa{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){const r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){const r=this._listeners;if(r===void 0)return;const i=r[e];if(i!==void 0){const s=i.indexOf(n);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const r=n[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const en=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","5
2205","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],td=Math.PI/180,Tf=180/Math.PI;function Zo(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(en[t&255]+en[t>>8&255]+en[t>>16&255]+en[t>>24&255]+"-"+en[e&255]+en[e>>8&255]+"-"+en[e>>16&15|64]+en[e>>24&255]+"-"+en[n&63|128]+en[n>>8&255]+"-"+en[n>>16&255]+en[n>>24&255]+en[r&255]+en[r>>8&255]+en[r>>16&255]+en[r>>24&255]).toLowerCase()}function Ze(t,e,n){return Math.max(e,Math.min(n,t))}function lT(t,e){return(t%e+e)%e}function nd(t,e,n){return(1-n)*t+n*e}function ja(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function mn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}class nt{constructor(e=0,n=0){nt.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.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 n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+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,n){return this.x=Ze(this.x,e.x,n.x),this.y=Ze(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=Ze(this.x,e,n),this.y=Ze(this.y,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Ze(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Ze(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}
vendor: 5,155 bytes, line 220
220rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),s=this.x-e.x,a=this.y-e.y;return this.x=s*r-a*i+e.x,this.y=s*i+a*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Qo{constructor(e=0,n=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}static slerpFlat(e,n,r,i,s,a,o){let l=r[i+0],c=r[i+1],u=r[i+2],d=r[i+3],f=s[a+0],p=s[a+1],g=s[a+2],_=s[a+3];if(o<=0){e[n+0]=l,e[n+1]=c,e[n+2]=u,e[n+3]=d;return}if(o>=1){e[n+0]=f,e[n+1]=p,e[n+2]=g,e[n+3]=_;return}if(d!==_||l!==f||c!==p||u!==g){let m=l*f+c*p+u*g+d*_;m<0&&(f=-f,p=-p,g=-g,_=-_,m=-m);let h=1-o;if(m<.9995){const v=Math.acos(m),x=Math.sin(v);h=Math.sin(h*v)/x,o=Math.sin(o*v)/x,l=l*h+f*o,c=c*h+p*o,u=u*h+g*o,d=d*h+_*o}else{l=l*h+f*o,c=c*h+p*o,u=u*h+g*o,d=d*h+_*o;const v=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=v,c*=v,u*=v,d*=v}}e[n]=l,e[n+1]=c,e[n+2]=u,e[n+3]=d}static multiplyQuaternionsFlat(e,n,r,i,s,a){const o=r[i],l=r[i+1],c=r[i+2],u=r[i+3],d=s[a],f=s[a+1],p=s[a+2],g=s[a+3];return e[n]=o*g+u*d+l*p-c*f,e[n+1]=l*g+u*f+c*d-o*p,e[n+2]=c*g+u*p+o*f-l*d,e[n+3]=u*g-o*d-l*f-c*p,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,n,r,i){return this._x=e,this._y=n,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,n=!0){const r=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(r/2),u=o(i/2),d=o(s/2),f=l(r/2),p=l(i/2),g=l(s/2);switch(a){case"XYZ":this._x=f*u*d+c*p*g,this._y=c*p*d-f*u*g,this._z=c*u*g+f*p*d,this._w=c*u*d-f*p*g;break;case"YXZ":this._x=f*u*d+c*p*g,this._y=c*p*d-f*u*g,this._z=c*u*g-f*p*d,this._w=c*u*d+f*p*g;break;case"ZXY":this._x=f*u*d-c*p*g,this._y=c*p*d+f*u*g,this._z=c*u*g+f*p*d,this._w=c*u*d-f*p*g;break;case"ZYX":this._x=f*u*d-c*p*g,this._y=c*p*d+f*u*g,this._z=c*u*g-f*p*d,this._w=c*u*d+f*p*g;break;case"YZX":this._x=f*u*d+c*p*g,this._y=c*p*d+f*u*g,this._z=c*u*g-f*p*d,this._w=c*u*d-f*p*g;break;case"XZY":this._x=f*u*d-c*p*g,this._y=c*p*d-f*u*g,this._z=c*u*g+f*p*d,this._w=c*u*d+f*p*g;break;default:He("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/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 n=e.elements,r=n[0],i=n[4],s=n[8],a=n[1],o=n[5],l=n[9],c=n[2],u=n[6],d=n[10],f=r+o+d;if(f>0){const p=.5/Math.sqrt(f+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(a-i)*p}else if(r>o&&r>d){const p=2*Math.sqrt(1+r-o-d);this._w=(u-l)/p,this._x=.25*p,this._y=(i+a)/p,this._z=(s+c)/p}else if(o>d){const p=2*Math.sqrt(1+o-r-d);this._w=(s-c)/p,this._x=(i+a)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+d-r-o);this._w=(a-i)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<1e-8?(r=0,Math.abs(e.x)>Math.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*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ze(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/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,n){const r=e._x,i=e._y,s=e._z,a=e._w,o=n._x,l=n._y,c=n._z,u=n._w;return this._x=r*u+a*o+i*c-s*l,this._y=i*u+a*l+s*o-r*c,this._z=s*u+a*c+r*l-i*o,this._w=a*u-r*o-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){if(n<=0)return this;if(n>=1)return this.copy(e);let r=e._x,i=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(r=-r,i=-i,s=-s,a=-a,o=-o);let l=1-n;if(o<.9995){const c=Math.acos(o),u=Math.sin(c);l=Math.sin(l*c)/u,n=Math.sin(n*c)/u,this._x=this._x*l+r*n,this._y=this._y*l+i*n,this._z=this._z*l+s*n,this._w=this._w*l+a*n,this._onChangeCallback()}else this._x=this._x*l+r*n,this._y=this._y*l+i*n,this._z=this._z*l+s*n,this._w=this._w*l+a*n,this.normalize();return this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r
vendor: 7,558 bytes, line 220
220=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ${constructor(e=0,n=0,r=0){$.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.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,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(Q0.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(Q0.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,a=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*a,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*a,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*a,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=2*(a*i-o*r),u=2*(o*n-s*i),d=2*(s*r-a*n);return this.x=n+l*c+a*d-o*u,this.y=r+l*u+o*c-s*d,this.z=i+l*d+s*u-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+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,n){return this.x=Ze(this.x,e.x,n.x),this.y=Ze(this.y,e.y,n.y),this.z=Ze(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=Ze(this.x,e,n),this.y=Ze(this.y,e,n),this.z=Ze(this.z,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Ze(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,a=n.x,o=n.y,l=n.z;return this.x=i*l-s*o,this.y=s*a-r*l,this.z=r*o-i*a,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return rd.copy(this).projectOnVector(e),this.sub(rd)}reflect(e){return this.sub(rd.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Ze(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+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,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const rd=new $,Q0=new Qo;class Ge{constructor(e,n,r,i,s,a,o,l,c){Ge.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,a,o,l,c)}set(e,n,r,i,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=o,u[3]=n,u[4]=s,u[5]=l,u[6]=r,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[
vendor: 34,214 bytes, line 220
2206]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,a=r[0],o=r[3],l=r[6],c=r[1],u=r[4],d=r[7],f=r[2],p=r[5],g=r[8],_=i[0],m=i[3],h=i[6],v=i[1],x=i[4],w=i[7],A=i[2],E=i[5],R=i[8];return s[0]=a*_+o*v+l*A,s[3]=a*m+o*x+l*E,s[6]=a*h+o*w+l*R,s[1]=c*_+u*v+d*A,s[4]=c*m+u*x+d*E,s[7]=c*h+u*w+d*R,s[2]=f*_+p*v+g*A,s[5]=f*m+p*x+g*E,s[8]=f*h+p*w+g*R,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return n*a*u-n*o*c-r*s*u+r*o*l+i*s*c-i*a*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=u*a-o*c,f=o*l-u*s,p=c*s-a*l,g=n*d+r*f+i*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/g;return e[0]=d*_,e[1]=(i*c-u*r)*_,e[2]=(o*r-i*a)*_,e[3]=f*_,e[4]=(u*n-i*l)*_,e[5]=(i*s-o*n)*_,e[6]=p*_,e[7]=(r*l-c*n)*_,e[8]=(a*n-r*s)*_,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*a+c*o)+a+e,-i*c,i*l,-i*(-c*a+l*o)+o+n,0,0,1),this}scale(e,n){return this.premultiply(id.makeScale(e,n)),this}rotate(e){return this.premultiply(id.makeRotation(-e)),this}translate(e,n){return this.premultiply(id.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const id=new Ge,eg=new Ge().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),tg=new Ge().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function cT(){const t={enabled:!0,workingColorSpace:wa,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===ot&&(i.r=Wr(i.r),i.g=Wr(i.g),i.b=Wr(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===ot&&(i.r=ua(i.r),i.g=ua(i.g),i.b=ua(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===mi?Vc:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return jo("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return jo("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return t.define({[wa]:{primaries:e,whitePoint:r,transfer:Vc,toXYZ:eg,fromXYZ:tg,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Bn},outputColorSpaceConfig:{drawingBufferColorSpace:Bn}},[Bn]:{primaries:e,whitePoint:r,transfer:ot,toXYZ:eg,fromXYZ:tg,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Bn}}}),t}const tt=cT();function Wr(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function ua(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Ts;class uT{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{Ts===void 0&&(Ts=Hc("canvas")),Ts.width=e.width,Ts.height=e.height;const i=Ts.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=Ts}return r.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=Hc("canvas");n.width=e.width,n.height=e.height;const r=n.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 a=0;a<s.length;a++)s[a]=Wr(s[a]/255)*255;return r.putImageData(i,0,0),n}else if(e.data){const n=e.data.slice(0);for(let r=0;r<n.length;r++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[r]=Math.floor(Wr(n[r]/255)*255):n[r]=Wr(n[r]);return{data:n,width:e.width,height:e.height}}else return He("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let dT=0;class Hp{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:dT++}),this.uuid=Zo(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const n=this.data;return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?e.set(n.videoWidth,n.videoHeight,0):n instanceof VideoFrame?e.set(n.displayHeight,n.displayWidth,0):n!==null?e.set(n.width,n.height,n.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(sd(i[a].image)):s.push(sd(i[a]))}else s=sd(i);r.url=s}return n||(e.images[this.uuid]=r),r}}function sd(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?uT.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(He("Texture: Unable to serialize Texture."),{})}let hT=0;const ad=new $;class un extends Pa{constructor(e=un.DEFAULT_IMAGE,n=un.DEFAULT_MAPPING,r=zr,i=zr,s=Gn,a=ss,o=lr,l=Sr,c=un.DEFAULT_ANISOTROPY,u=mi){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:hT++}),this.uuid=Zo(),this.name="",this.source=new Hp(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new nt(0,0),this.repeat=new nt(1,1),this.center=new nt(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ge,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(ad).x}get height(){return this.source.getSize(ad).y}get depth(){return this.source.getSize(ad).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const n in e){const r=e[n];if(r===void 0){He(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){He(`Texture.setValues(): property '${n}' does not exist.`);continue}i&&r&&i.isVector2&&r.isVector2||i&&r&&i.isVector3&&r.isVector3||i&&r&&i.isMatrix3&&r.isMatrix3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==$_)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Kh:e.x=e.x-Math.floor(e.x);break;case zr:e.x=e.x<0?0:1;break;case Yh: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 Kh:e.y=e.y-Math.floor(e.y);break;case zr:e.y=e.y<0?0:1;break;case Yh:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}un.DEFAULT_IMAGE=null;un.DEFAULT_MAPPING=$_;un.DEFAULT_ANISOTROPY=1;class Pt{constructor(e=0,n=0,r=0,i=1){Pt.prototype.isVector4=!0,this.x=e,this.y=n,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,n,r,i){return this.x=e,this.y=n,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,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;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,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,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,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.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 n=this.x,r=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*n+a[4]*r+a[8]*i+a[12]*s,this.y=a[1]*n+a[5]*r+a[9]*i+a[13]*s,this.z=a[2]*n+a[6]*r+a[10]*i+a[14]*s,this.w=a[3]*n+a[7]*r+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,s;const l=e.elements,c=l[0],u=l[4],d=l[8],f=l[1],p=l[5],g=l[9],_=l[2],m=l[6],h=l[10];if(Math.abs(u-f)<.01&&Math.abs(d-_)<.01&&Math.abs(g-m)<.01){if(Math.abs(u+f)<.1&&Math.abs(d+_)<.1&&Math.abs(g+m)<.1&&Math.abs(c+p+h-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const x=(c+1)/2,w=(p+1)/2,A=(h+1)/2,E=(u+f)/4,R=(d+_)/4,P=(g+m)/4;return x>w&&x>A?x<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(x),i=E/r,s=R/r):w>A?w<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(w),r=E/i,s=P/i):A<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(A),r=R/s,i=P/s),this.set(r,i,s,n),this}let v=Math.sqrt((m-g)*(m-g)+(d-_)*(d-_)+(f-u)*(f-u));return Math.abs(v)<.001&&(v=1),this.x=(m-g)/v,this.y=(d-_)/v,this.z=(f-u)/v,this.w=Math.acos((c+p+h-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Ze(this.x,e.x,n.x),this.y=Ze(this.y,e.y,n.y),this.z=Ze(this.z,e.z,n.z),this.w=Ze(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=Ze(this.x,e,n),this.y=Ze(this.y,e,n),this.z=Ze(this.z,e,n),this.w=Ze(this.w,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Ze(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.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,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),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 fT extends Pa{constructor(e=1,n=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Gn,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},r),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=r.depth,this.scissor=new Pt(0,0,e,n),this.scissorTest=!1,this.viewport=new Pt(0,0,e,n);const i={width:e,height:n,depth:r.depth},s=new un(i);this.textures=[];const a=r.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview}_setTextureOptions(e={}){const n={minFilter:Gn,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(n.mapping=e.mapping),e.wrapS!==void 0&&(n.wrapS=e.wrapS),e.wrapT!==void 0&&(n.wrapT=e.wrapT),e.wrapR!==void 0&&(n.wrapR=e.wrapR),e.magFilter!==void 0&&(n.magFilter=e.magFilter),e.minFilter!==void 0&&(n.minFilter=e.minFilter),e.format!==void 0&&(n.format=e.format),e.type!==void 0&&(n.type=e.type),e.anisotropy!==void 0&&(n.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(n.colorSpace=e.colorSpace),e.flipY!==void 0&&(n.flipY=e.flipY),e.generateMipmaps!==void 0&&(n.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(n.internalFormat=e.internalFormat);for(let r=0;r<this.textures.length;r++)this.textures[r].setValues(n)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,r=1){if(this.width!==e||this.height!==n||this.depth!==r){this.width=e,this.height=n,this.depth=r;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=n,this.textures[i].image.depth=r,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const i=Object.assign({},e.textures[n].image);this.textures[n].source=new Hp(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ps extends fT{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class ry extends un{constructor(e=null,n=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=Ln,this.minFilter=Ln,this.wrapR=zr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class pT extends un{constructor(e=null,n=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=Ln,this.minFilter=Ln,this.wrapR=zr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class el{constructor(e=new $(1/0,1/0,1/0),n=new $(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n+=3)this.expandByPoint(Jn.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint(Jn.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=Jn.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0){const s=r.getAttribute("position");if(n===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Jn):Jn.fromBufferAttribute(s,a),Jn.applyMatrix4(e.matrixWorld),this.expandByPoint(Jn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Cl.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),Cl.copy(r.boundingBox)),Cl.applyMatrix4(e.matrixWorld),this.union(Cl)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],n);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Jn),Jn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ha),Pl.subVectors(this.max,Ha),As.subVectors(e.a,Ha),Rs.subVectors(e.b,Ha),Cs.subVectors(e.c,Ha),ti.subVectors(Rs,As),ni.subVectors(Cs,Rs),zi.subVectors(As,Cs);let n=[0,-ti.z,ti.y,0,-ni.z,ni.y,0,-zi.z,zi.y,ti.z,0,-ti.x,ni.z,0,-ni.x,zi.z,0,-zi.x,-ti.y,ti.x,0,-ni.y,ni.x,0,-zi.y,zi.x,0];return!od(n,As,Rs,Cs,Pl)||(n=[1,0,0,0,1,0,0,0,1],!od(n,As,Rs,Cs,Pl))?!1:(Nl.crossVectors(ti,ni),n=[Nl.x,Nl.y,Nl.z],od(n,As,Rs,Cs,Pl))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Jn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Jn).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:(Ar[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ar[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ar[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ar[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ar[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ar[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ar[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ar[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ar),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)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Ar=[new $,new $,new $,new $,new $,new $,new $,new $],Jn=new $,Cl=new el,As=new $,Rs=new $,Cs=new $,ti=new $,ni=new $,zi=new $,Ha=new $,Pl=new $,Nl=new $,Vi=new $;function od(t,e,n,r,i){for(let s=0,a=t.length-3;s<=a;s+=3){Vi.fromArray(t,s);const o=i.x*Math.abs(Vi.x)+i.y*Math.abs(Vi.y)+i.z*Math.abs(Vi.z),l=e.dot(Vi),c=n.dot(Vi),u=r.dot(Vi);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const mT=new el,Ga=new $,ld=new $;class Gp{constructor(e=new $,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):mT.setFromPoints(e).getCenter(r);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,r.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const r=this.center.distanceToSquared(e);return n.copy(e),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}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;Ga.subVectors(e,this.center);const n=Ga.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(Ga,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):(ld.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ga.copy(e.center).add(ld)),this.expandByPoint(Ga.copy(e.center).sub(ld))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}const Rr=new $,cd=new $,Ll=new $,ri=new $,ud=new $,Il=new $,dd=new $;class gT{constructor(e=new $,n=new $(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.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,Rr)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Rr.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Rr.copy(this.origin).addScaledVector(this.direction,n),Rr.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){cd.copy(e).add(n).multiplyScalar(.5),Ll.copy(n).sub(e).normalize(),ri.copy(this.origin).sub(cd);const s=e.distanceTo(n)*.5,a=-this.direction.dot(Ll),o=ri.dot(this.direction),l=-ri.dot(Ll),c=ri.lengthSq(),u=Math.abs(1-a*a);let d,f,p,g;if(u>0)if(d=a*l-o,f=a*o-l,g=s*u,d>=0)if(f>=-g)if(f<=g){const _=1/u;d*=_,f*=_,p=d*(d+a*f+2*o)+f*(a*d+f+2*l)+c}else f=s,d=Math.max(0,-(a*f+o)),p=-d*d+f*(f+2*l)+c;else f=-s,d=Math.max(0,-(a*f+o)),p=-d*d+f*(f+2*l)+c;else f<=-g?(d=Math.max(0,-(-a*s+o)),f=d>0?-s:Math.min(Math.max(-s,-l),s),p=-d*d+f*(f+2*l)+c):f<=g?(d=0,f=Math.min(Math.max(-s,-l),s),p=f*(f+2*l)+c):(d=Math.max(0,-(a*s+o)),f=d>0?s:Math.min(Math.max(-s,-l),s),p=-d*d+f*(f+2*l)+c);else f=a>0?-s:s,d=Math.max(0,-(a*f+o)),p=-d*d+f*(f+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,d),i&&i.copy(cd).addScaledVector(Ll,f),p}intersectSphere(e,n){Rr.subVectors(e.center,this.origin);const r=Rr.dot(this.direction),i=Rr.dot(Rr)-r*r,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=r-a,l=r+a;return l<0?null:o<0?this.at(l,n):this.at(o,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,d=1/this.direction.z,f=this.origin;return c>=0?(r=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(r=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),r>a||s>i||((s>r||isNaN(r))&&(r=s),(a<i||isNaN(i))&&(i=a),d>=0?(o=(e.min.z-f.z)*d,l=(e.max.z-f.z)*d):(o=(e.max.z-f.z)*d,l=(e.min.z-f.z)*d),r>l||o>i)||((o>r||r!==r)&&(r=o),(l<i||i!==i)&&(i=l),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Rr)!==null}intersectTriangle(e,n,r,i,s){ud.subVectors(n,e),Il.subVectors(r,e),dd.crossVectors(ud,Il);let a=this.direction.dot(dd),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;ri.subVectors(this.origin,e);const l=o*this.direction.dot(Il.crossVectors(ri,Il));if(l<0)return null;const c=o*this.direction.dot(ud.cross(ri));if(c<0||l+c>a)return null;const u=-o*ri.dot(dd);return u<0?null:this.at(u/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Nt{constructor(e,n,r,i,s,a,o,l,c,u,d,f,p,g,_,m){Nt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,a,o,l,c,u,d,f,p,g,_,m)}set(e,n,r,i,s,a,o,l,c,u,d,f,p,g,_,m){const h=this.elements;return h[0]=e,h[4]=n,h[8]=r,h[12]=i,h[1]=s,h[5]=a,h[9]=o,h[13]=l,h[2]=c,h[6]=u,h[10]=d,h[14]=f,h[3]=p,h[7]=g,h[11]=_,h[15]=m,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 Nt().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,r){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,r=e.elements,i=1/Ps.setFromMatrixColumn(e,0).length(),s=1/Ps.setFromMatrixColumn(e,1).length(),a=1/Ps.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*a,n[9]=r[9]*a,n[10]=r[10]*a,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,a=Math.cos(r),o=Math.sin(r),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),d=Math.sin(s);if(e.order==="XYZ"){const f=a*u,p=a*d,g=o*u,_=o*d;n[0]=l*u,n[4]=-l*d,n[8]=c,n[1]=p+g*c,n[5]=f-_*c,n[9]=-o*l,n[2]=_-f*c,n[6]=g+p*c,n[10]=a*l}else if(e.order==="YXZ"){const f=l*u,p=l*d,g=c*u,_=c*d;n[0]=f+_*o,n[4]=g*o-p,n[8]=a*c,n[1]=a*d,n[5]=a*u,n[9]=-o,n[2]=p*o-g,n[6]=_+f*o,n[10]=a*l}else if(e.order==="ZXY"){const f=l*u,p=l*d,g=c*u,_=c*d;n[0]=f-_*o,n[4]=-a*d,n[8]=g+p*o,n[1]=p+g*o,n[5]=a*u,n[9]=_-f*o,n[2]=-a*c,n[6]=o,n[10]=a*l}else if(e.order==="ZYX"){const f=a*u,p=a*d,g=o*u,_=o*d;n[0]=l*u,n[4]=g*c-p,n[8]=f*c+_,n[1]=l*d,n[5]=_*c+f,n[9]=p*c-g,n[2]=-c,n[6]=o*l,n[10]=a*l}else if(e.order==="YZX"){const f=a*l,p=a*c,g=o*l,_=o*c;n[0]=l*u,n[4]=_-f*d,n[8]=g*d+p,n[1]=d,n[5]=a*u,n[9]=-o*u,n[2]=-c*u,n[6]=p*d+g,n[10]=f-_*d}else if(e.order==="XZY"){const f=a*l,p=a*c,g=o*l,_=o*c;
vendor: 4,447 bytes, line 220
220n[0]=l*u,n[4]=-d,n[8]=c*u,n[1]=f*d+_,n[5]=a*u,n[9]=p*d-g,n[2]=g*d-p,n[6]=o*u,n[10]=_*d+f}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(xT,e,vT)}lookAt(e,n,r){const i=this.elements;return En.subVectors(e,n),En.lengthSq()===0&&(En.z=1),En.normalize(),ii.crossVectors(r,En),ii.lengthSq()===0&&(Math.abs(r.z)===1?En.x+=1e-4:En.z+=1e-4,En.normalize(),ii.crossVectors(r,En)),ii.normalize(),Dl.crossVectors(En,ii),i[0]=ii.x,i[4]=Dl.x,i[8]=En.x,i[1]=ii.y,i[5]=Dl.y,i[9]=En.y,i[2]=ii.z,i[6]=Dl.z,i[10]=En.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,a=r[0],o=r[4],l=r[8],c=r[12],u=r[1],d=r[5],f=r[9],p=r[13],g=r[2],_=r[6],m=r[10],h=r[14],v=r[3],x=r[7],w=r[11],A=r[15],E=i[0],R=i[4],P=i[8],M=i[12],b=i[1],N=i[5],U=i[9],B=i[13],X=i[2],W=i[6],V=i[10],Q=i[14],D=i[3],q=i[7],Y=i[11],de=i[15];return s[0]=a*E+o*b+l*X+c*D,s[4]=a*R+o*N+l*W+c*q,s[8]=a*P+o*U+l*V+c*Y,s[12]=a*M+o*B+l*Q+c*de,s[1]=u*E+d*b+f*X+p*D,s[5]=u*R+d*N+f*W+p*q,s[9]=u*P+d*U+f*V+p*Y,s[13]=u*M+d*B+f*Q+p*de,s[2]=g*E+_*b+m*X+h*D,s[6]=g*R+_*N+m*W+h*q,s[10]=g*P+_*U+m*V+h*Y,s[14]=g*M+_*B+m*Q+h*de,s[3]=v*E+x*b+w*X+A*D,s[7]=v*R+x*N+w*W+A*q,s[11]=v*P+x*U+w*V+A*Y,s[15]=v*M+x*B+w*Q+A*de,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],d=e[6],f=e[10],p=e[14],g=e[3],_=e[7],m=e[11],h=e[15];return g*(+s*l*d-i*c*d-s*o*f+r*c*f+i*o*p-r*l*p)+_*(+n*l*p-n*c*f+s*a*f-i*a*p+i*c*u-s*l*u)+m*(+n*c*d-n*o*p-s*a*d+r*a*p+s*o*u-r*c*u)+h*(-i*o*u-n*l*d+n*o*f+i*a*d-r*a*f+r*l*u)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,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]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],d=e[9],f=e[10],p=e[11],g=e[12],_=e[13],m=e[14],h=e[15],v=d*m*c-_*f*c+_*l*p-o*m*p-d*l*h+o*f*h,x=g*f*c-u*m*c-g*l*p+a*m*p+u*l*h-a*f*h,w=u*_*c-g*d*c+g*o*p-a*_*p-u*o*h+a*d*h,A=g*d*l-u*_*l-g*o*f+a*_*f+u*o*m-a*d*m,E=n*v+r*x+i*w+s*A;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const R=1/E;return e[0]=v*R,e[1]=(_*f*s-d*m*s-_*i*p+r*m*p+d*i*h-r*f*h)*R,e[2]=(o*m*s-_*l*s+_*i*c-r*m*c-o*i*h+r*l*h)*R,e[3]=(d*l*s-o*f*s-d*i*c+r*f*c+o*i*p-r*l*p)*R,e[4]=x*R,e[5]=(u*m*s-g*f*s+g*i*p-n*m*p-u*i*h+n*f*h)*R,e[6]=(g*l*s-a*m*s-g*i*c+n*m*c+a*i*h-n*l*h)*R,e[7]=(a*f*s-u*l*s+u*i*c-n*f*c-a*i*p+n*l*p)*R,e[8]=w*R,e[9]=(g*d*s-u*_*s-g*r*p+n*_*p+u*r*h-n*d*h)*R,e[10]=(a*_*s-g*o*s+g*r*c-n*_*c-a*r*h+n*o*h)*R,e[11]=(u*o*s-a*d*s-u*r*c+n*d*c+a*r*p-n*o*p)*R,e[12]=A*R,e[13]=(u*_*i-g*d*i+g*r*f-n*_*f-u*r*m+n*d*m)*R,e[14]=(g*o*i-a*_*i-g*r*l+n*_*l+a*r*m-n*o*m)*R,e[15]=(a*d*i-u*o*i+u*r*l-n*d*l-a*r*f+n*o*f)*R,this}scale(e){const n=this.elements,r=e.x,i=e.y,s=e.z;return n[0]*=r,n[4]*=i,n[8]*=s,n[1]*=r,n[5]*=i,n[9]*=s,n[2]*=r,n[6]*=i,n[10]*=s,n[3]*=r,n[7]*=i,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=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(n,r,i))}makeTranslation(e,n,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),s=1-r,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+r,c*o-i*l,c*l+i*o,0,c*o+i*l,u*o+r,u*l-i*a,0,c*l-i*o,u*l+i*a,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,a){return this.set(1,r,s,0,e,1,a,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,a=n._y,o=n._z,l=n._w,c=s+s,u=a+a,d=o+o,f=s*c,p=s*u,g=s*d,_=a*u,m=a*d,h=o*d,v=l*c,x=l*u,w=l*d,A=r.x,E=r.y,R=r.z;
vendor: 37,642 bytes, line 220
220return i[0]=(1-(_+h))*A,i[1]=(p+w)*A,i[2]=(g-x)*A,i[3]=0,i[4]=(p-w)*E,i[5]=(1-(f+h))*E,i[6]=(m+v)*E,i[7]=0,i[8]=(g+x)*R,i[9]=(m-v)*R,i[10]=(1-(f+_))*R,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;let s=Ps.set(i[0],i[1],i[2]).length();const a=Ps.set(i[4],i[5],i[6]).length(),o=Ps.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],Zn.copy(this);const c=1/s,u=1/a,d=1/o;return Zn.elements[0]*=c,Zn.elements[1]*=c,Zn.elements[2]*=c,Zn.elements[4]*=u,Zn.elements[5]*=u,Zn.elements[6]*=u,Zn.elements[8]*=d,Zn.elements[9]*=d,Zn.elements[10]*=d,n.setFromRotationMatrix(Zn),r.x=s,r.y=a,r.z=o,this}makePerspective(e,n,r,i,s,a,o=vr,l=!1){const c=this.elements,u=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),p=(r+i)/(r-i);let g,_;if(l)g=s/(a-s),_=a*s/(a-s);else if(o===vr)g=-(a+s)/(a-s),_=-2*a*s/(a-s);else if(o===jc)g=-a/(a-s),_=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=f,c[12]=0,c[1]=0,c[5]=d,c[9]=p,c[13]=0,c[2]=0,c[6]=0,c[10]=g,c[14]=_,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,n,r,i,s,a,o=vr,l=!1){const c=this.elements,u=2/(n-e),d=2/(r-i),f=-(n+e)/(n-e),p=-(r+i)/(r-i);let g,_;if(l)g=1/(a-s),_=a/(a-s);else if(o===vr)g=-2/(a-s),_=-(a+s)/(a-s);else if(o===jc)g=-1/(a-s),_=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return c[0]=u,c[4]=0,c[8]=0,c[12]=f,c[1]=0,c[5]=d,c[9]=0,c[13]=p,c[2]=0,c[6]=0,c[10]=g,c[14]=_,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const Ps=new $,Zn=new Nt,xT=new $(0,0,0),vT=new $(1,1,1),ii=new $,Dl=new $,En=new $,ng=new Nt,rg=new Qo;class br{constructor(e=0,n=0,r=0,i=br.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,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,n,r,i=this._order){return this._x=e,this._y=n,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,n=this._order,r=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],l=i[1],c=i[5],u=i[9],d=i[2],f=i[6],p=i[10];switch(n){case"XYZ":this._y=Math.asin(Ze(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ze(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ze(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-d,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ze(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(Ze(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(o,p));break;case"XZY":this._z=Math.asin(-Ze(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:He("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return ng.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ng,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return rg.setFromEuler(this),this.setFromQuaternion(rg,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=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+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}}br.DEFAULT_ORDER="XYZ";class iy{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let _T=0;const ig=new $,Ns=new Qo,Cr=new Nt,Ul=new $,Wa=new $,yT=new $,wT=new Qo,sg=new $(1,0,0),ag=new $(0,1,0),og=new $(0,0,1),lg={type:"added"},ST={type:"removed"},Ls={type:"childadded",child:null},hd={type:"childremoved",child:null};class rn extends Pa{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:_T++}),this.uuid=Zo(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=rn.DEFAULT_UP.clone();const e=new $,n=new br,r=new Qo,i=new $(1,1,1);function s(){r.setFromEuler(n,!1)}function a(){n.setFromQuaternion(r,void 0,!1)}n._onChange(s),r._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Nt},normalMatrix:{value:new Ge}}),this.matrix=new Nt,this.matrixWorld=new Nt,this.matrixAutoUpdate=rn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new iy,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return Ns.setFromAxisAngle(e,n),this.quaternion.multiply(Ns),this}rotateOnWorldAxis(e,n){return Ns.setFromAxisAngle(e,n),this.quaternion.premultiply(Ns),this}rotateX(e){return this.rotateOnAxis(sg,e)}rotateY(e){return this.rotateOnAxis(ag,e)}rotateZ(e){return this.rotateOnAxis(og,e)}translateOnAxis(e,n){return ig.copy(e).applyQuaternion(this.quaternion),this.position.add(ig.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(sg,e)}translateY(e){return this.translateOnAxis(ag,e)}translateZ(e){return this.translateOnAxis(og,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Cr.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?Ul.copy(e):Ul.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),Wa.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Cr.lookAt(Wa,Ul,this.up):Cr.lookAt(Ul,Wa,this.up),this.quaternion.setFromRotationMatrix(Cr),i&&(Cr.extractRotation(i.matrixWorld),Ns.setFromRotationMatrix(Cr),this.quaternion.premultiply(Ns.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(It("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(lg),Ls.child=e,this.dispatchEvent(Ls),Ls.child=null):It("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(ST),hd.child=e,this.dispatchEvent(hd),hd.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Cr.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Cr.multiply(e.parent.matrixWorld)),e.applyMatrix4(Cr),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(lg),Ls.child=e,this.dispatchEvent(Ls),Ls.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let r=0,i=this.children.length;r<i;r++){const a=this.children[r].getObjectByProperty(e,n);if(a!==void 0)return a}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,n,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Wa,e,yT),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Wa,wT,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].updateMatrixWorld(e)}updateWorldMatrix(e,n){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",r={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(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())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[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 o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const d=l[c];s(e.shapes,d)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let l=0,c=this.material.length;l<c;l++)o.push(s(e.materials,this.material[l]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const l=this.animations[o];i.animations.push(s(e.animations,l))}}if(n){const o=a(e.geometries),l=a(e.materials),c=a(e.textures),u=a(e.images),d=a(e.shapes),f=a(e.skeletons),p=a(e.animations),g=a(e.nodes);o.length>0&&(r.geometries=o),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),u.length>0&&(r.images=u),d.length>0&&(r.shapes=d),f.length>0&&(r.skeletons=f),p.length>0&&(r.animations=p),g.length>0&&(r.nodes=g)}return r.object=i,r;function a(o){const l=[];for(const c in o){const u=o[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}rn.DEFAULT_UP=new $(0,1,0);rn.DEFAULT_MATRIX_AUTO_UPDATE=!0;rn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Qn=new $,Pr=new $,fd=new $,Nr=new $,Is=new $,Ds=new $,cg=new $,pd=new $,md=new $,gd=new $,xd=new Pt,vd=new Pt,_d=new Pt;class ar{constructor(e=new $,n=new $,r=new $){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Qn.subVectors(e,n),i.cross(Qn);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){Qn.subVectors(i,n),Pr.subVectors(r,n),fd.subVectors(e,n);const a=Qn.dot(Qn),o=Qn.dot(Pr),l=Qn.dot(fd),c=Pr.dot(Pr),u=Pr.dot(fd),d=a*c-o*o;if(d===0)return s.set(0,0,0),null;const f=1/d,p=(c*l-o*u)*f,g=(a*u-o*l)*f;return s.set(1-p-g,g,p)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Nr)===null?!1:Nr.x>=0&&Nr.y>=0&&Nr.x+Nr.y<=1}static getInterpolation(e,n,r,i,s,a,o,l){return this.getBarycoord(e,n,r,i,Nr)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Nr.x),l.addScaledVector(a,Nr.y),l.addScaledVector(o,Nr.z),l)}static getInterpolatedAttribute(e,n,r,i,s,a){return xd.setScalar(0),vd.setScalar(0),_d.setScalar(0),xd.fromBufferAttribute(e,n),vd.fromBufferAttribute(e,r),_d.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(xd,s.x),a.addScaledVector(vd,s.y),a.addScaledVector(_d,s.z),a}static isFrontFacing(e,n,r,i){return Qn.subVectors(r,n),Pr.subVectors(e,n),Qn.cross(Pr).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),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 Qn.subVectors(this.c,this.b),Pr.subVectors(this.a,this.b),Qn.cross(Pr).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ar.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return ar.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return ar.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return ar.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ar.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,s=this.c;let a,o;Is.subVectors(i,r),Ds.subVectors(s,r),pd.subVectors(e,r);const l=Is.dot(pd),c=Ds.dot(pd);if(l<=0&&c<=0)return n.copy(r);md.subVectors(e,i);const u=Is.dot(md),d=Ds.dot(md);if(u>=0&&d<=u)return n.copy(i);const f=l*d-u*c;if(f<=0&&l>=0&&u<=0)return a=l/(l-u),n.copy(r).addScaledVector(Is,a);gd.subVectors(e,s);const p=Is.dot(gd),g=Ds.dot(gd);if(g>=0&&p<=g)return n.copy(s);const _=p*c-l*g;if(_<=0&&c>=0&&g<=0)return o=c/(c-g),n.copy(r).addScaledVector(Ds,o);const m=u*g-p*d;if(m<=0&&d-u>=0&&p-g>=0)return cg.subVectors(s,i),o=(d-u)/(d-u+(p-g)),n.copy(i).addScaledVector(cg,o);const h=1/(m+_+f);return a=_*h,o=f*h,n.copy(r).addScaledVector(Is,a).addScaledVector(Ds,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const sy={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},si={h:0,s:0,l:0},kl={h:0,s:0,l:0};function yd(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class rt{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Bn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,tt.colorSpaceToWorking(this,n),this}setRGB(e,n,r,i=tt.workingColorSpace){return this.r=e,this.g=n,this.b=r,tt.colorSpaceToWorking(this,i),this}setHSL(e,n,r,i=tt.workingColorSpace){if(e=lT(e,1),n=Ze(n,0,1),r=Ze(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,a=2*r-s;this.r=yd(a,s,e+1/3),this.g=yd(a,s,e),this.b=yd(a,s,e-1/3)}return tt.colorSpaceToWorking(this,i),this}setStyle(e,n=Bn){function r(s){s!==void 0&&parseFloat(s)<1&&He("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:He("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(a===6)return this.setHex(parseInt(s,16),n);He("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Bn){const r=sy[e.toLowerCase()];return r!==void 0?this.setHex(r,n):He("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=Wr(e.r),this.g=Wr(e.g),this.b=Wr(e.b),this}copyLinearToSRGB(e){return this.r=ua(e.r),this.g=ua(e.g),this.b=ua(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Bn){return tt.workingToColorSpace(tn.copy(this),e),Math.round(Ze(tn.r*255,0,255))*65536+Math.round(Ze(tn.g*255,0,255))*256+Math.round(Ze(tn.b*255,0,255))}getHexString(e=Bn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=tt.workingColorSpace){tt.workingToColorSpace(tn.copy(this),n);const r=tn.r,i=tn.g,s=tn.b,a=Math.max(r,i,s),o=Math.min(r,i,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const d=a-o;switch(c=u<=.5?d/(a+o):d/(2-a-o),a){case r:l=(i-s)/d+(i<s?6:0);break;case i:l=(s-r)/d+2;break;case s:l=(r-i)/d+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,n=tt.workingColorSpace){return tt.workingToColorSpace(tn.copy(this),n),e.r=tn.r,e.g=tn.g,e.b=tn.b,e}getStyle(e=Bn){tt.workingToColorSpace(tn.copy(this),e);const n=tn.r,r=tn.g,i=tn.b;return e!==Bn?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(si),this.setHSL(si.h+e,si.s+n,si.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(si),e.getHSL(kl);const r=nd(si.h,kl.h,n),i=nd(si.s,kl.s,n),s=nd(si.l,kl.l,n);return this.setHSL(r,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,s=e.elements;return this.r=s[0]*n+s[3]*r+s[6]*i,this.g=s[1]*n+s[4]*r+s[7]*i,this.b=s[2]*n+s[5]*r+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const tn=new rt;rt.NAMES=sy;let bT=0;class tl extends Pa{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:bT++}),this.uuid=Zo(),this.name="",this.type="Material",this.blending=ca,this.side=Ni,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Fh,this.blendDst=Bh,this.blendEquation=Qi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new rt(0,0,0),this.blendAlpha=0,this.depthFunc=va,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=q0,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ms,this.stencilZFail=Ms,this.stencilZPass=Ms,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.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){He(`Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){He(`Material: '${n}' 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[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.7,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!==void 0&&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.sheenColorMap&&this.sheenColorMap.isTexture&&(r.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(r.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),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!==ca&&(r.blending=this.blending),this.side!==Ni&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==Fh&&(r.blendSrc=this.blendSrc),this.blendDst!==Bh&&(r.blendDst=this.blendDst),this.blendEquation!==Qi&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==va&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==q0&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ms&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Ms&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Ms&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),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.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),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=!0),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 a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(n){const s=i(e.textures),a=i(e.images);s.length>0&&(r.textures=s),a.length>0&&(r.images=a)}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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 4,916 bytes, line 220
220adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class ay extends tl{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new rt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new br,this.combine=W_,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Dt=new $,Ol=new nt;let ET=0;class wr{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:ET++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=K0,this.updateRanges=[],this.gpuType=Vr,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=n.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,r=this.count;n<r;n++)Ol.fromBufferAttribute(this,n),Ol.applyMatrix3(e),this.setXY(n,Ol.x,Ol.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)Dt.fromBufferAttribute(this,n),Dt.applyMatrix3(e),this.setXYZ(n,Dt.x,Dt.y,Dt.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)Dt.fromBufferAttribute(this,n),Dt.applyMatrix4(e),this.setXYZ(n,Dt.x,Dt.y,Dt.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Dt.fromBufferAttribute(this,n),Dt.applyNormalMatrix(e),this.setXYZ(n,Dt.x,Dt.y,Dt.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Dt.fromBufferAttribute(this,n),Dt.transformDirection(e),this.setXYZ(n,Dt.x,Dt.y,Dt.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let r=this.array[e*this.itemSize+n];return this.normalized&&(r=ja(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=mn(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=ja(n,this.array)),n}setX(e,n){return this.normalized&&(n=mn(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=ja(n,this.array)),n}setY(e,n){return this.normalized&&(n=mn(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=ja(n,this.array)),n}setZ(e,n){return this.normalized&&(n=mn(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=ja(n,this.array)),n}setW(e,n){return this.normalized&&(n=mn(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=mn(n,this.array),r=mn(r,this.array)),this.array[e+0]=n,this.array[e+1]=r,this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=mn(n,this.array),r=mn(r,this.array),i=mn(i,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,n,r,i,s){return e*=this.itemSize,this.normalized&&(n=mn(n,this.array),r=mn(r,this.array),i=mn(i,this.array),s=mn(s,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=s,this}
vendor: 24,608 bytes, lines 220-224
220onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==K0&&(e.usage=this.usage),e}}class oy extends wr{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class ly extends wr{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class In extends wr{constructor(e,n,r){super(new Float32Array(e),n,r)}}let MT=0;const Fn=new Nt,wd=new rn,Us=new $,Mn=new el,$a=new el,jt=new $;class Tr extends Pa{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:MT++}),this.uuid=Zo(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(ny(e)?ly:oy)(e,1):this.index=e,this}setIndirect(e){return this.indirect=e,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,r=0){this.groups.push({start:e,count:n,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const s=new Ge().getNormalMatrix(e);r.applyNormalMatrix(s),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Fn.makeRotationFromQuaternion(e),this.applyMatrix4(Fn),this}rotateX(e){return Fn.makeRotationX(e),this.applyMatrix4(Fn),this}rotateY(e){return Fn.makeRotationY(e),this.applyMatrix4(Fn),this}rotateZ(e){return Fn.makeRotationZ(e),this.applyMatrix4(Fn),this}translate(e,n,r){return Fn.makeTranslation(e,n,r),this.applyMatrix4(Fn),this}scale(e,n,r){return Fn.makeScale(e,n,r),this.applyMatrix4(Fn),this}lookAt(e){return wd.lookAt(e),wd.updateMatrix(),this.applyMatrix4(wd.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Us).negate(),this.translate(Us.x,Us.y,Us.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const r=[];for(let i=0,s=e.length;i<s;i++){const a=e[i];r.push(a.x,a.y,a.z||0)}this.setAttribute("position",new In(r,3))}else{const r=Math.min(e.length,n.count);for(let i=0;i<r;i++){const s=e[i];n.setXYZ(i,s.x,s.y,s.z||0)}e.length>n.count&&He("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new el);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){It("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new $(-1/0,-1/0,-1/0),new $(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let r=0,i=n.length;r<i;r++){const s=n[r];Mn.setFromBufferAttribute(s),this.morphTargetsRelative?(jt.addVectors(this.boundingBox.min,Mn.min),this.boundingBox.expandByPoint(jt),jt.addVectors(this.boundingBox.max,Mn.max),this.boundingBox.expandByPoint(jt)):(this.boundingBox.expandByPoint(Mn.min),this.boundingBox.expandByPoint(Mn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&It('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Gp);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){It("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new $,1/0);return}if(e){const r=this.boundingSphere.center;if(Mn.setFromBufferAttribute(e),n)for(let s=0,a=n.length;s<a;s++){const o=n[s];$a.setFromBufferAttribute(o),this.morphTargetsRelative?(jt.addVectors(Mn.min,$a.min),Mn.expandByPoint(jt),jt.addVectors(Mn.max,$a.max),Mn.expandByPoint(jt)):(Mn.expandByPoint($a.min),Mn.expandByPoint($a.max))}Mn.getCenter(r);let i=0;for(let s=0,a=e.count;s<a;s++)jt.fromBufferAttribute(e,s),i=Math.max(i,r.distanceToSquared(jt));if(n)for(let s=0,a=n.length;s<a;s++){const o=n[s],l=this.morphTargetsRelative;for(let c=0,u=o.count;c<u;c++)jt.fromBufferAttribute(o,c),l&&(Us.fromBufferAttribute(e,c),jt.add(Us)),i=Math.max(i,r.distanceToSquared(jt))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&It('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){It("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=n.position,i=n.normal,s=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new wr(new Float32Array(4*r.count),4));const a=this.getAttribute("tangent"),o=[],l=[];for(let P=0;P<r.count;P++)o[P]=new $,l[P]=new $;const c=new $,u=new $,d=new $,f=new nt,p=new nt,g=new nt,_=new $,m=new $;function h(P,M,b){c.fromBufferAttribute(r,P),u.fromBufferAttribute(r,M),d.fromBufferAttribute(r,b),f.fromBufferAttribute(s,P),p.fromBufferAttribute(s,M),g.fromBufferAttribute(s,b),u.sub(c),d.sub(c),p.sub(f),g.sub(f);const N=1/(p.x*g.y-g.x*p.y);isFinite(N)&&(_.copy(u).multiplyScalar(g.y).addScaledVector(d,-p.y).multiplyScalar(N),m.copy(d).multiplyScalar(p.x).addScaledVector(u,-g.x).multiplyScalar(N),o[P].add(_),o[M].add(_),o[b].add(_),l[P].add(m),l[M].add(m),l[b].add(m))}let v=this.groups;v.length===0&&(v=[{start:0,count:e.count}]);for(let P=0,M=v.length;P<M;++P){const b=v[P],N=b.start,U=b.count;for(let B=N,X=N+U;B<X;B+=3)h(e.getX(B+0),e.getX(B+1),e.getX(B+2))}const x=new $,w=new $,A=new $,E=new $;function R(P){A.fromBufferAttribute(i,P),E.copy(A);const M=o[P];x.copy(M),x.sub(A.multiplyScalar(A.dot(M))).normalize(),w.crossVectors(E,M);const N=w.dot(l[P])<0?-1:1;a.setXYZW(P,x.x,x.y,x.z,N)}for(let P=0,M=v.length;P<M;++P){const b=v[P],N=b.start,U=b.count;for(let B=N,X=N+U;B<X;B+=3)R(e.getX(B+0)),R(e.getX(B+1)),R(e.getX(B+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new wr(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let f=0,p=r.count;f<p;f++)r.setXYZ(f,0,0,0);const i=new $,s=new $,a=new $,o=new $,l=new $,c=new $,u=new $,d=new $;if(e)for(let f=0,p=e.count;f<p;f+=3){const g=e.getX(f+0),_=e.getX(f+1),m=e.getX(f+2);i.fromBufferAttribute(n,g),s.fromBufferAttribute(n,_),a.fromBufferAttribute(n,m),u.subVectors(a,s),d.subVectors(i,s),u.cross(d),o.fromBufferAttribute(r,g),l.fromBufferAttribute(r,_),c.fromBufferAttribute(r,m),o.add(u),l.add(u),c.add(u),r.setXYZ(g,o.x,o.y,o.z),r.setXYZ(_,l.x,l.y,l.z),r.setXYZ(m,c.x,c.y,c.z)}else for(let f=0,p=n.count;f<p;f+=3)i.fromBufferAttribute(n,f+0),s.fromBufferAttribute(n,f+1),a.fromBufferAttribute(n,f+2),u.subVectors(a,s),d.subVectors(i,s),u.cross(d),r.setXYZ(f+0,u.x,u.y,u.z),r.setXYZ(f+1,u.x,u.y,u.z),r.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)jt.fromBufferAttribute(e,n),jt.normalize(),e.setXYZ(n,jt.x,jt.y,jt.z)}toNonIndexed(){function e(o,l){const c=o.array,u=o.itemSize,d=o.normalized,f=new c.constructor(l.length*u);let p=0,g=0;for(let _=0,m=l.length;_<m;_++){o.isInterleavedBufferAttribute?p=l[_]*o.data.stride+o.offset:p=l[_]*u;for(let h=0;h<u;h++)f[g++]=c[p++]}return new wr(f,u,d)}if(this.index===null)return He("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Tr,r=this.index.array,i=this.attributes;for(const o in i){const l=i[o],c=e(l,r);n.setAttribute(o,c)}const s=this.morphAttributes;for(const o in s){const l=[],c=s[o];for(let u=0,d=c.length;u<d;u++){const f=c[u],p=e(f,r);l.push(p)}n.morphAttributes[o]=l}n.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,l=a.length;o<l;o++){const c=a[o];n.addGroup(c.start,c.count,c.materialIndex)}return n}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let d=0,f=c.length;d<f;d++){const p=c[d];u.push(p.toJSON(e.data))}u.length>0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),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 n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone());const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(n))}const s=e.morphAttributes;for(const c in s){const u=[],d=s[c];for(let f=0,p=d.length;f<p;f++)u.push(d[f].clone(n));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let c=0,u=a.length;c<u;c++){const d=a[c];this.addGroup(d.start,d.count,d.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const l=e.boundingSphere;return l!==null&&(this.boundingSphere=l.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const ug=new Nt,ji=new gT,Fl=new Gp,dg=new $,Bl=new $,zl=new $,Vl=new $,Sd=new $,jl=new $,hg=new $,Hl=new $;class Er extends rn{constructor(e=new Tr,n=new ay){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,s=r.morphAttributes.position,a=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){jl.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=o[l],d=s[l];u!==0&&(Sd.fromBufferAttribute(d,e),a?jl.addScaledVector(Sd,u):jl.addScaledVector(Sd.sub(n),u))}n.add(jl)}return n}raycast(e,n){const r=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),Fl.copy(r.boundingSphere),Fl.applyMatrix4(s),ji.copy(e.ray).recast(e.near),!(Fl.containsPoint(ji.origin)===!1&&(ji.intersectSphere(Fl,dg)===null||ji.origin.distanceToSquared(dg)>(e.far-e.near)**2))&&(ug.copy(s).invert(),ji.copy(e.ray).applyMatrix4(ug),!(r.boundingBox!==null&&ji.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,ji)))}_computeIntersections(e,n,r){let i;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,d=s.attributes.normal,f=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let g=0,_=f.length;g<_;g++){const m=f[g],h=a[m.materialIndex],v=Math.max(m.start,p.start),x=Math.min(o.count,Math.min(m.start+m.count,p.start+p.count));for(let w=v,A=x;w<A;w+=3){const E=o.getX(w),R=o.getX(w+1),P=o.getX(w+2);i=Gl(this,h,e,r,c,u,d,E,R,P),i&&(i.faceIndex=Math.floor(w/3),i.face.materialIndex=m.materialIndex,n.push(i))}}else{const g=Math.max(0,p.start),_=Math.min(o.count,p.start+p.count);for(let m=g,h=_;m<h;m+=3){const v=o.getX(m),x=o.getX(m+1),w=o.getX(m+2);i=Gl(this,a,e,r,c,u,d,v,x,w),i&&(i.faceIndex=Math.floor(m/3),n.push(i))}}else if(l!==void 0)if(Array.isArray(a))for(let g=0,_=f.length;g<_;g++){const m=f[g],h=a[m.materialIndex],v=Math.max(m.start,p.start),x=Math.min(l.count,Math.min(m.start+m.count,p.start+p.count));for(let w=v,A=x;w<A;w+=3){const E=w,R=w+1,P=w+2;i=Gl(this,h,e,r,c,u,d,E,R,P),i&&(i.faceIndex=Math.floor(w/3),i.face.materialIndex=m.materialIndex,n.push(i))}}else{const g=Math.max(0,p.start),_=Math.min(l.count,p.start+p.count);for(let m=g,h=_;m<h;m+=3){const v=m,x=m+1,w=m+2;i=Gl(this,a,e,r,c,u,d,v,x,w),i&&(i.faceIndex=Math.floor(m/3),n.push(i))}}}}function TT(t,e,n,r,i,s,a,o){let l;if(e.side===wn?l=r.intersectTriangle(a,s,i,!0,o):l=r.intersectTriangle(i,s,a,e.side===Ni,o),l===null)return null;Hl.copy(o),Hl.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(Hl);return c<n.near||c>n.far?null:{distance:c,point:Hl.clone(),object:t}}function Gl(t,e,n,r,i,s,a,o,l,c){t.getVertexPosition(o,Bl),t.getVertexPosition(l,zl),t.getVertexPosition(c,Vl);const u=TT(t,e,n,r,Bl,zl,Vl,hg);if(u){const d=new $;ar.getBarycoord(hg,Bl,zl,Vl,d),i&&(u.uv=ar.getInterpolatedAttribute(i,o,l,c,d,new nt)),s&&(u.uv1=ar.getInterpolatedAttribute(s,o,l,c,d,new nt)),a&&(u.normal=ar.getInterpolatedAttribute(a,o,l,c,d,new $),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));const f={a:o,b:l,c,normal:new $,materialIndex:0};ar.getNormal(Bl,zl,Vl,f.normal),u.face=f,u.barycoord=d}return u}class nl extends Tr{constructor(e=1,n=1,r=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],d=[];let f=0,p=0;g("z","y","x",-1,-1,r,n,e,a,s,0),g("z","y","x",1,-1,r,n,-e,a,s,1),g("x","z","y",1,1,e,r,n,i,a,2),g("x","z","y",1,-1,e,r,-n,i,a,3),g("x","y","z",1,-1,e,n,r,i,s,4),g("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new In(c,3)),this.setAttribute("normal",new In(u,3)),this.setAttribute("uv",new In(d,2));function g(_,m,h,v,x,w,A,E,R,P,M){const b=w/R,N=A/P,U=w/2,B=A/2,X=E/2,W=R+1,V=P+1;let Q=0,D=0;const q=new $;for(let Y=0;Y<V;Y++){const de=Y*N-B;for(let Ee=0;Ee<W;Ee++){const se=Ee*b-U;q[_]=se*v,q[m]=de*x,q[h]=X,c.push(q.x,q.y,q.z),q[_]=0,q[m]=0,q[h]=E>0?1:-1,u.push(q.x,q.y,q.z),d.push(Ee/R),d.push(1-Y/P),Q+=1}}for(let Y=0;Y<P;Y++)for(let de=0;de<R;de++){const Ee=f+de+W*Y,se=f+de+W*(Y+1),ae=f+(de+1)+W*(Y+1),ye=f+(de+1)+W*Y;l.push(Ee,se,ye),l.push(se,ae,ye),D+=6}o.addGroup(p,D,M),p+=D,f+=Q}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nl(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function Sa(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(He("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][r]=null):e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function on(t){const e={};for(let n=0;n<t.length;n++){const r=Sa(t[n]);for(const i in r)e[i]=r[i]}return e}function AT(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function cy(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:tt.workingColorSpace}const RT={clone:Sa,merge:on};var CT=`void main() {
221	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
222}`,PT=`void main() {
223	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
224}`;class Jr extends tl{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=CT,this.fragmentShader=PT,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Sa(e.uniforms),this.uniformsGroups=AT(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const n=super.toJSON(e);n.glslVersion=this.glslVersion,n.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?n.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?n.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?n.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?n.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?n.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?n.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?n.uniforms[i]={type:"m4",value:a.toArray()}:n.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class uy extends rn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Nt,this.projectionMatrix=new Nt,this.projectionMatrixInverse=new Nt,this.coordinateSystem=vr,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const ai=new $,fg=new nt,pg=new nt;class jn extends uy{constructor(e=50,n=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=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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 n=.5*this.getFilmHeight()/e;this.fov=Tf*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(td*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Tf*2*Math.atan(Math.tan(td*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,r){ai.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ai.x,ai.y).multiplyScalar(-e/ai.z),ai.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(ai.x,ai.y).multiplyScalar(-e/ai.z)}getViewSize(e,n){return this.getViewBounds(e,fg,pg),n.subVectors(pg,fg)}setViewOffset(e,n,r,i,s,a){this.aspect=e/n,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=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(td*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*i/l,n-=a.offsetY*r/c,i*=a.width/l,r*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const ks=-90,Os=1;class NT extends rn{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new jn(ks,Os,e,n);i.layers=this.layers,this.add(i);const s=new jn(ks,Os,e,n);s.layers=this.layers,this.add(s);const a=new jn(ks,Os,e,n);a.layers=this.layers,this.add(a);const o=new jn(ks,Os,e,n);o.layers=this.layers,this.add(o);const l=new jn(ks,Os,e,n);l.layers=this.layers,this.add(l);const c=new jn(ks,Os,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,a,o,l]=n;for(const c of n)this.remove(c);if(e===vr)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===jc)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,l,c,u]=this.children,d=e.getRenderTarget(),f=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const _=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(n,s),e.setRenderTarget(r,1,i),e.render(n,a),e.setRenderTarget(r,2,i),e.render(n,o),e.setRenderTarget(r,3,i),e.render(n,l),e.setRenderTarget(r,4,i),e.render(n,c),r.texture.generateMipmaps=_,e.setRenderTarget(r,5,i),e.render(n,u),e.setRenderTarget(d,f,p),e.xr.enabled=g,r.texture.needsPMREMUpdate=!0}}class dy extends un{constructor(e=[],n=_a,r,i,s,a,o,l,c,u){super(e,n,r,i,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class LT extends ps{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new dy(i),this._setTextureOptions(n),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace
vendor: 7,442 bytes, lines 224-259
224=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:`
225
226				varying vec3 vWorldDirection;
227
228				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
229
230					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
231
232				}
233
234				void main() {
235
236					vWorldDirection = transformDirection( position, modelMatrix );
237
238					#include <begin_vertex>
239					#include <project_vertex>
240
241				}
242			`,fragmentShader:`
243
244				uniform sampler2D tEquirect;
245
246				varying vec3 vWorldDirection;
247
248				#include <common>
249
250				void main() {
251
252					vec3 direction = normalize( vWorldDirection );
253
254					vec2 sampleUV = equirectUv( direction );
255
256					gl_FragColor = texture2D( tEquirect, sampleUV );
257
258				}
259			`},i=new nl(5,5,5),s=new Jr({name:"CubemapFromEquirect",uniforms:Sa(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:wn,blending:Gr});s.uniforms.tEquirect.value=n;const a=new Er(i,s),o=n.minFilter;return n.minFilter===ss&&(n.minFilter=Gn),new NT(1,10,this).update(e,a),n.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,n=!0,r=!0,i=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(n,r,i);e.setRenderTarget(s)}}class Qa extends rn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const IT={type:"move"};class bd{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Qa,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 Qa,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new $,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new $),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Qa,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new $,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new $),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,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,n,r){let i=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const _ of e.hand.values()){const m=n.getJointPose(_,r),h=this._getHandJoint(c,_);m!==null&&(h.matrix.fromArray(m.transform.matrix),h.matrix.decompose(h.position,h.rotation,h.scale),h.matrixWorldNeedsUpdate=!0,h.jointRadius=m.radius),h.visible=m!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],f=u.position.distanceTo(d.position),p=.02,g=.005;c.inputState.pinching&&f>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=p-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(IT)))}return o!==null&&(o.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Qa;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}class DT extends rn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new br,this.environmentIntensity=1,this.environmentRotation=new br,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}class UT extends un{constructor(e=null,n=1,r=1,i,s,a,o,l,c=Ln,u=Ln,d,f){super(null,a,o,l,c,u,i,s,d,f),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Ed=new $,kT=new $,OT=new Ge;class Ki{constructor(e=new $(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=Ed.subVectors(r,n).cross(kT.subVectors(e,n)).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,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(Ed),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;
vendor: 5,356 bytes, line 259
259const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>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,n){const r=n||OT.getNormalMatrix(e),i=this.coplanarPoint(Ed).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 Hi=new Gp,FT=new nt(.5,.5),Wl=new $;class Wp{constructor(e=new Ki,n=new Ki,r=new Ki,i=new Ki,s=new Ki,a=new Ki){this.planes=[e,n,r,i,s,a]}set(e,n,r,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(n),o[2].copy(r),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=vr,r=!1){const i=this.planes,s=e.elements,a=s[0],o=s[1],l=s[2],c=s[3],u=s[4],d=s[5],f=s[6],p=s[7],g=s[8],_=s[9],m=s[10],h=s[11],v=s[12],x=s[13],w=s[14],A=s[15];if(i[0].setComponents(c-a,p-u,h-g,A-v).normalize(),i[1].setComponents(c+a,p+u,h+g,A+v).normalize(),i[2].setComponents(c+o,p+d,h+_,A+x).normalize(),i[3].setComponents(c-o,p-d,h-_,A-x).normalize(),r)i[4].setComponents(l,f,m,w).normalize(),i[5].setComponents(c-l,p-f,h-m,A-w).normalize();else if(i[4].setComponents(c-l,p-f,h-m,A-w).normalize(),n===vr)i[5].setComponents(c+l,p+f,h+m,A+w).normalize();else if(n===jc)i[5].setComponents(l,f,m,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Hi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Hi.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Hi)}intersectsSprite(e){Hi.center.set(0,0,0);const n=FT.distanceTo(e.center);return Hi.radius=.7071067811865476+n,Hi.applyMatrix4(e.matrixWorld),this.intersectsSphere(Hi)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const i=n[r];if(Wl.x=i.normal.x>0?e.max.x:e.min.x,Wl.y=i.normal.y>0?e.max.y:e.min.y,Wl.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Wl)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class hy extends un{constructor(e,n,r=fs,i,s,a,o=Ln,l=Ln,c,u=zo,d=1){if(u!==zo&&u!==Vo)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const f={width:e,height:n,depth:d};super(f,i,s,a,o,l,u,r,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Hp(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class fy extends un{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class $p extends Tr{constructor(e=1,n=1,r=1,i=32,s=1,a=!1,o=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:n,height:r,radialSegments:i,heightSegments:s,openEnded:a,thetaStart:o,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const u=[],d=[],f=[],p=[];let g=0;const _=[],m=r/2;let h=0;v(),a===!1&&(e>0&&x(!0),n>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new In(d,3)),this.setAttribute("normal",new In(f,3)),this.setAttribute("uv",new In(p,2));function v(){const w=new $,A=new $;let E=0;const R=(n-e)/r;for(let P=0;P<=s;P++){const M=[],b=P/s,N=b*(n-e)+e;for(let U=0;U<=i;U++){const B=U/i,X=B*l+o,W=Math.sin(X),V=Math.cos(X);A.x=N*W,A.y=-b*r+m,A.z=N*V,d.push(A.x,A.y,A.z),w.set(W,R,V).normalize(),f.push(w.x,w.y,w.z),p.push(B,1-b),M.push(g++)}_.push(M)}for(let P=0;P<i;P++)for(let M=0;M<s;M++){const b=_[M][P],N=_[M+1][P],U=_[M+1][P+1],B=_[M][P+1];(e>0||M!==0)&&(u.push(b,N,B),E+=3),(n>0||M!==s-1)&&(u.push(N,U,B),E+=3)}c.addGroup(h,E,0),h+=E}function x(w){const A=g,E=new nt,R=new $;let P=0;const M=w===!0?e:n,b=w===!0?1:-1;for(let U=1;U<=i;U++)d.push(0,m*b,0),f.push(0,b,0),p.push(.5,.5),g++;const N=g;for(let U=0;U<=i;U++){const X=U/i*l+o,W=Math.cos(X),V=Math.sin(X);R.x=M*V,R.y=m*b,R.z=M*W,d.push(R.x,R.y,R.z),f.push(0,b,0),E.x=W*.5+.5,E.y=V*.5*b+.5,p.push(E.x,E.y),g++}for(let U=0;U<i;U++){const B=A+U,X=N+U;w===!0?u.push(X,X+1,B):u.push(X+1,X,B),P+=3}c.addGroup(h,P,w===!0?1:2),h+=P}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new $p(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Xp extends $p{constructor(e=1,n=1,r=32,i=1,s=!1,a=0,o=Math.PI*2){super(0,e,n,r,i,s,a,o),this.type="C
259oneGeometry",this.parameters={radius:e,height:n,radialSegments:r,heightSegments:i,openEnded:s,thetaStart:a,thetaLength:o}}static fromJSON(e){return new Xp(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class hu extends Tr{constructor(e=1,n=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:r,heightSegments:i};const s=e/2,a=n/2,o=Math.floor(r),l=Math.floor(i),c=o+1,u=l+1,d=e/o,f=n/l,p=[],g=[],_=[],m=[];for(let h=0;h<u;h++){const v=h*f-a;for(let x=0;x<c;x++){const w=x*d-s;g.push(w,-v,0),_.push(0,0,1),m.push(x/o),m.push(1-h/l)}}for(let h=0;h<l;h++)for(let v=0;v<o;v++){const x=v+c*h,w=v+c*(h+1),A=v+1+c*(h+1),E=v+1+c*h;p.push(x,w,E),p.push(w,A,E)}this.setIndex(p),this.setAttribute("position",new In(g,3)),this.setAttribute("normal",new In(_,3)),this.setAttribute("uv",new In(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hu(e.width,e.height,e.widthSegments,e.heightSegments)}}class qp extends Tr{constructor(e=1,n=32,r=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:n,heightSegments:r,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o}
vendor: 5,900 bytes, line 259
259,n=Math.max(3,Math.floor(n)),r=Math.max(2,Math.floor(r));const l=Math.min(a+o,Math.PI);let c=0;const u=[],d=new $,f=new $,p=[],g=[],_=[],m=[];for(let h=0;h<=r;h++){const v=[],x=h/r;let w=0;h===0&&a===0?w=.5/n:h===r&&l===Math.PI&&(w=-.5/n);for(let A=0;A<=n;A++){const E=A/n;d.x=-e*Math.cos(i+E*s)*Math.sin(a+x*o),d.y=e*Math.cos(a+x*o),d.z=e*Math.sin(i+E*s)*Math.sin(a+x*o),g.push(d.x,d.y,d.z),f.copy(d).normalize(),_.push(f.x,f.y,f.z),m.push(E+w,1-x),v.push(c++)}u.push(v)}for(let h=0;h<r;h++)for(let v=0;v<n;v++){const x=u[h][v+1],w=u[h][v],A=u[h+1][v],E=u[h+1][v+1];(h!==0||a>0)&&p.push(x,w,E),(h!==r-1||l<Math.PI)&&p.push(w,A,E)}this.setIndex(p),this.setAttribute("position",new In(g,3)),this.setAttribute("normal",new In(_,3)),this.setAttribute("uv",new In(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new qp(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class BT extends tl{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new rt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new rt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ey,this.normalScale=new nt(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new br,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class zT extends tl{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Y3,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 VT extends tl{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class py extends rn{constructor(e,n=1){super(),this.isLight=!0,this.type="Light",this.color=new rt(e),this.intensity=n}dispose(){}copy(e,n){return super.copy(e,n),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const n=super.toJSON(e);return n.object.color=this.color.getHex(),n.object.intensity=this.intensity,this.groundColor!==void 0&&(n.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(n.object.distance=this.distance),this.angle!==void 0&&(n.object.angle=this.angle),this.decay!==void 0&&(n.object.decay=this.decay),this.penumbra!==void 0&&(n.object.penumbra=this.penumbra),this.shadow!==void 0&&(n.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(n.object.target=this.target.uuid),n}}const Md=new Nt,mg=new $,gg=new $;class jT{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new nt(512,512),this.mapType=Sr,this.map=null,this.mapPass=null,this.matrix=new Nt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Wp,this._frameExtents=new nt(1,1),this._viewportCount=1,this._viewports=[new Pt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const n=this.camera,r=this.matrix;mg.setFromMatrixPosition(e.matrixWorld),n.position.copy(mg),gg.setFromMatrixPosition(e.target.matrixWorld),n.lookAt(gg),n.updateMatrixWorld(),Md.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Md,n.coordinateSystem,n.reversedDepth),n.reversedDepth?r.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(Md)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.n
vendor: 9,835 bytes, lines 259-322
259ormalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class my extends uy{constructor(e=-1,n=1,r=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=r,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),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,n,r,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,a=r+e,o=i+n,l=i-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,l,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}class HT extends jT{constructor(){super(new my(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class GT extends py{constructor(e,n){super(e,n),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(rn.DEFAULT_UP),this.updateMatrix(),this.target=new rn,this.shadow=new HT}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class WT extends py{constructor(e,n){super(e,n),this.isAmbientLight=!0,this.type="AmbientLight"}}class $T extends jn{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}function xg(t,e,n,r){const i=XT(r);switch(n){case J_:return t*e;case Q_:return t*e/i.components*i.byteLength;case Bp:return t*e/i.components*i.byteLength;case zp:return t*e*2/i.components*i.byteLength;case Vp:return t*e*2/i.components*i.byteLength;case Z_:return t*e*3/i.components*i.byteLength;case lr:return t*e*4/i.components*i.byteLength;case jp:return t*e*4/i.components*i.byteLength;case lc:case cc:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case uc:case dc:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Zh:case ef:return Math.max(t,16)*Math.max(e,8)/4;case Jh:case Qh:return Math.max(t,8)*Math.max(e,8)/2;case tf:case nf:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case rf:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case sf:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case af:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case of:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case lf:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case cf:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case uf:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case df:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case hf:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case ff:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case pf:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case mf:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case gf:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case xf:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case vf:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case _f:case yf:case wf:return Math.ceil(t/4)*Math.ceil(e/4)*16;case Sf:case bf:return Math.ceil(t/4)*Math.ceil(e/4)*8;case Ef:case Mf:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function XT(t){switch(t){case Sr:case X_:return{byteLength:1,components:1};case Fo:case q_:case Ca:return{byteLength:2,components:1};case Op:case Fp:return{byteLength:2,components:4};case fs:case kp:case Vr:return{byteLength:4,components:1};case K_:case Y_:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Up}}));typeof window<"u"&&(window.__THREE__?He("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Up);/**
260 * @license
261 * Copyright 2010-2025 Three.js Authors
262 * SPDX-License-Identifier: MIT
263 */function gy(){let t=null,e=!1,n=null,r=null;function i(s,a){n(s,a),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function qT(t){const e=new WeakMap;function n(o,l){const c=o.array,u=o.usage,d=c.byteLength,f=t.createBuffer();t.bindBuffer(l,f),t.bufferData(l,c,u),o.onUploadCallback();let p;if(c instanceof Float32Array)p=t.FLOAT;else if(typeof Float16Array<"u"&&c instanceof Float16Array)p=t.HALF_FLOAT;else if(c instanceof Uint16Array)o.isFloat16BufferAttribute?p=t.HALF_FLOAT:p=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)p=t.SHORT;else if(c instanceof Uint32Array)p=t.UNSIGNED_INT;else if(c instanceof Int32Array)p=t.INT;else if(c instanceof Int8Array)p=t.BYTE;else if(c instanceof Uint8Array)p=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)p=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:p,bytesPerElement:c.BYTES_PER_ELEMENT,version:o.version,size:d}}function r(o,l,c){const u=l.array,d=l.updateRanges;if(t.bindBuffer(c,o),d.length===0)t.bufferSubData(c,0,u);else{d.sort((p,g)=>p.start-g.start);let f=0;for(let p=1;p<d.length;p++){const g=d[f],_=d[p];_.start<=g.start+g.count+1?g.count=Math.max(g.count,_.start+_.count-g.start):(++f,d[f]=_)}d.length=f+1;for(let p=0,g=d.length;p<g;p++){const _=d[p];t.bufferSubData(c,_.start*u.BYTES_PER_ELEMENT,u,_.start,_.count)}l.clearUpdateRanges()}l.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const l=e.get(o);l&&(t.deleteBuffer(l.buffer),e.delete(o))}function a(o,l){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const u=e.get(o);(!u||u.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const c=e.get(o);if(c===void 0)e.set(o,n(o,l));else if(c.version<o.version){if(c.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");r(c.buffer,o,l),c.version=o.version}}return{get:i,remove:s,update:a}}var KT=`#ifdef USE_ALPHAHASH
264	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
265#endif`,YT=`#ifdef USE_ALPHAHASH
266	const float ALPHA_HASH_SCALE = 0.05;
267	float hash2D( vec2 value ) {
268		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
269	}
270	float hash3D( vec3 value ) {
271		return hash2D( vec2( hash2D( value.xy ), value.z ) );
272	}
273	float getAlphaHashThreshold( vec3 position ) {
274		float maxDeriv = max(
275			length( dFdx( position.xyz ) ),
276			length( dFdy( position.xyz ) )
277		);
278		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
279		vec2 pixScales = vec2(
280			exp2( floor( log2( pixScale ) ) ),
281			exp2( ceil( log2( pixScale ) ) )
282		);
283		vec2 alpha = vec2(
284			hash3D( floor( pixScales.x * position.xyz ) ),
285			hash3D( floor( pixScales.y * position.xyz ) )
286		);
287		float lerpFactor = fract( log2( pixScale ) );
288		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
289		float a = min( lerpFactor, 1.0 - lerpFactor );
290		vec3 cases = vec3(
291			x * x / ( 2.0 * a * ( 1.0 - a ) ),
292			( x - 0.5 * a ) / ( 1.0 - a ),
293			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
294		);
295		float threshold = ( x < ( 1.0 - a ) )
296			? ( ( x < a ) ? cases.x : cases.y )
297			: cases.z;
298		return clamp( threshold , 1.0e-6, 1.0 );
299	}
300#endif`,JT=`#ifdef USE_ALPHAMAP
301	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
302#endif`,ZT=`#ifdef USE_ALPHAMAP
303	uniform sampler2D alphaMap;
304#endif`,QT=`#ifdef USE_ALPHATEST
305	#ifdef ALPHA_TO_COVERAGE
306	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
307	if ( diffuseColor.a == 0.0 ) discard;
308	#else
309	if ( diffuseColor.a < alphaTest ) discard;
310	#endif
311#endif`,e2=`#ifdef USE_ALPHATEST
312	uniform float alphaTest;
313#endif`,t2=`#ifdef USE_AOMAP
314	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
315	reflectedLight.indirectDiffuse *= ambientOcclusion;
316	#if defined( USE_CLEARCOAT ) 
317		clearcoatSpecularIndirect *= ambientOcclusion;
318	#endif
319	#if defined( USE_SHEEN ) 
320		sheenSpecularIndirect *= ambientOcclusion;
321	#endif
322	#if defined( USE_ENVMAP ) && defined( STANDARD )
323		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
324		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
325	#endif
326#endif`,n2=`#ifdef USE_AOMAP
327	uniform sampler2D aoMap;
328	uniform float aoMapIntensity;
329#endif`,r2=`#ifdef USE_BATCHING
330	#if ! defined( GL_ANGLE_multi_draw )
331	#define gl_DrawID _gl_DrawID
332	uniform int _gl_DrawID;
333	#endif
334	uniform highp sampler2D batchingTexture;
335	uniform highp usampler2D batchingIdTexture;
336	mat4 getBatchingMatrix( const in float i ) {
337		int size = textureSize( batchingTexture, 0 ).x;
338		int j = int( i ) * 4;
339		int x = j % size;
340		int y = j / size;
341		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
342		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
343		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
344		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
345		return mat4( v1, v2, v3, v4 );
346	}
347	float getIndirectIndex( const in int i ) {
348		int size = textureSize( batchingIdTexture, 0 ).x;
349		int x = i % size;
350		int y = i / size;
351		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
352	}
353#endif
354#ifdef USE_BATCHING_COLOR
355	uniform sampler2D batchingColorTexture;
356	vec3 getBatchingColor( const in float i ) {
357		int size = textureSize( batchingColorTexture, 0 ).x;
358		int j = int( i );
359		int x = j % size;
360		int y = j / size;
361		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
362	}
363#endif`,i2=`#ifdef USE_BATCHING
364	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
365#endif`,s2=`vec3 transformed = vec3( position );
366#ifdef USE_ALPHAHASH
367	vPosition = vec3( position );
368#endif`,a2=`vec3 objectNormal = vec3( normal );
369#ifdef USE_TANGENT
370	vec3 objectTangent = vec3( tangent.xyz );
371#endif`,o2=`float G_BlinnPhong_Implicit( ) {
372	return 0.25;
373}
374float D_BlinnPhong( const in float shininess, const in float dotNH ) {
375	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
376}
377vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
378	vec3 halfDir = normalize( lightDir + viewDir );
379	float dotNH = saturate( dot( normal, halfDir ) );
380	float dotVH = saturate( dot( viewDir, halfDir ) );
381	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
382	float G = G_BlinnPhong_Implicit( );
383	float D = D_BlinnPhong( shininess, dotNH );
384	return F * ( G * D );
385} // validated`,l2=`#ifdef USE_IRIDESCENCE
386	const mat3 XYZ_TO_REC709 = mat3(
387		 3.2404542, -0.9692660,  0.0556434,
388		-1.5371385,  1.8760108, -0.2040259,
389		-0.4985314,  0.0415560,  1.0572252
390	);
391	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
392		vec3 sqrtF0 = sqrt( fresnel0 );
393		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
394	}
395	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
396		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
397	}
398	float IorToFresnel0( float transmittedIor, float incidentIor ) {
399		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
400	}
401	vec3 evalSensitivity( float OPD, vec3 shift ) {
402		float phase = 2.0 * PI * OPD * 1.0e-9;
403		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
404		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
405		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
406		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
407		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
408		xyz /= 1.0685e-7;
409		vec3 rgb = XYZ_TO_REC709 * xyz;
410		return rgb;
411	}
412	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
413		vec3 I;
414		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
415		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
416		float cosTheta2Sq = 1.0 - sinTheta2Sq;
417		if ( cosTheta2Sq < 0.0 ) {
418			return vec3( 1.0 );
419		}
420		float cosTheta2 = sqrt( cosTheta2Sq );
421		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
422		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
423		float T121 = 1.0 - R12;
424		float phi12 = 0.0;
425		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
426		float phi21 = PI - phi12;
427		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
428		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
429		vec3 phi23 = vec3( 0.0 );
430		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
431		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
432		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
433		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
434		vec3 phi = vec3( phi21 ) + phi23;
435		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
436		vec3 r123 = sqrt( R123 );
437		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
438		vec3 C0 = R12 + Rs;
439		I = C0;
440		vec3 Cm = Rs - T121;
441		for ( int m = 1; m <= 2; ++ m ) {
442			Cm *= r123;
443			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
444			I += Cm * Sm;
445		}
446		return max( I, vec3( 0.0 ) );
447	}
448#endif`,c2=`#ifdef USE_BUMPMAP
449	uniform sampler2D bumpMap;
450	uniform float bumpScale;
451	vec2 dHdxy_fwd() {
452		vec2 dSTdx = dFdx( vBumpMapUv );
453		vec2 dSTdy = dFdy( vBumpMapUv );
454		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
455		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
456		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
457		return vec2( dBx, dBy );
458	}
459	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
460		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
461		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
462		vec3 vN = surf_norm;
463		vec3 R1 = cross( vSigmaY, vN );
464		vec3 R2 = cross( vN, vSigmaX );
465		float fDet = dot( vSigmaX, R1 ) * faceDirection;
466		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
467		return normalize( abs( fDet ) * surf_norm - vGrad );
468	}
469#endif`,u2=`#if NUM_CLIPPING_PLANES > 0
470	vec4 plane;
471	#ifdef ALPHA_TO_COVERAGE
472		float distanceToPlane, distanceGradient;
473		float clipOpacity = 1.0;
474		#pragma unroll_loop_start
475		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
476			plane = clippingPlanes[ i ];
477			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
478			distanceGradient = fwidth( distanceToPlane ) / 2.0;
479			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
480			if ( clipOpacity == 0.0 ) discard;
481		}
482		#pragma unroll_loop_end
483		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
484			float unionClipOpacity = 1.0;
485			#pragma unroll_loop_start
486			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
487				plane = clippingPlanes[ i ];
488				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
489				distanceGradient = fwidth( distanceToPlane ) / 2.0;
490				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
491			}
492			#pragma unroll_loop_end
493			clipOpacity *= 1.0 - unionClipOpacity;
494		#endif
495		diffuseColor.a *= clipOpacity;
496		if ( diffuseColor.a == 0.0 ) discard;
497	#else
498		#pragma unroll_loop_start
499		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
500			plane = clippingPlanes[ i ];
501			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
502		}
503		#pragma unroll_loop_end
504		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
505			bool clipped = true;
506			#pragma unroll_loop_start
507			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
508				plane = clippingPlanes[ i ];
509				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
510			}
511			#pragma unroll_loop_end
512			if ( clipped ) discard;
513		#endif
514	#endif
515#endif`,d2=`#if NUM_CLIPPING_PLANES > 0
516	varying vec3 vClipPosition;
517	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
518#endif`,h2=`#if NUM_CLIPPING_PLANES > 0
519	varying vec3 vClipPosition;
520#endif`,f2=`#if NUM_CLIPPING_PLANES > 0
521	vClipPosition = - mvPosition.xyz;
522#endif`,p2=`#if defined( USE_COLOR_ALPHA )
523	diffuseColor *= vColor;
524#elif defined( USE_COLOR )
525	diffuseColor.rgb *= vColor;
526#endif`,m2=`#if defined( USE_COLOR_ALPHA )
527	varying vec4 vColor;
528#elif defined( USE_COLOR )
529	varying vec3 vColor;
530#endif`,g2=`#if defined( USE_COLOR_ALPHA )
531	varying vec4 vColor;
532#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
533	varying vec3 vColor;
534#endif`,x2=`#if defined( USE_COLOR_ALPHA )
535	vColor = vec4( 1.0 );
536#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
537	vColor = vec3( 1.0 );
538#endif
539#ifdef USE_COLOR
540	vColor *= color;
541#endif
542#ifdef USE_INSTANCING_COLOR
543	vColor.xyz *= instanceColor.xyz;
544#endif
545#ifdef USE_BATCHING_COLOR
546	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
547	vColor.xyz *= batchingColor.xyz;
548#endif`,v2=`#define PI 3.141592653589793
549#define PI2 6.283185307179586
550#define PI_HALF 1.5707963267948966
551#define RECIPROCAL_PI 0.3183098861837907
552#define RECIPROCAL_PI2 0.15915494309189535
553#define EPSILON 1e-6
554#ifndef saturate
555#define saturate( a ) clamp( a, 0.0, 1.0 )
556#endif
557#define whiteComplement( a ) ( 1.0 - saturate( a ) )
558float pow2( const in float x ) { return x*x; }
559vec3 pow2( const in vec3 x ) { return x*x; }
560float pow3( const in float x ) { return x*x*x; }
561float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
562float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
563float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
564highp float rand( const in vec2 uv ) {
565	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
566	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
567	return fract( sin( sn ) * c );
568}
569#ifdef HIGH_PRECISION
570	float precisionSafeLength( vec3 v ) { return length( v ); }
571#else
572	float precisionSafeLength( vec3 v ) {
573		float maxComponent = max3( abs( v ) );
574		return length( v / maxComponent ) * maxComponent;
575	}
576#endif
577struct IncidentLight {
578	vec3 color;
579	vec3 direction;
580	bool visible;
581};
582struct ReflectedLight {
583	vec3 directDiffuse;
584	vec3 directSpecular;
585	vec3 indirectDiffuse;
586	vec3 indirectSpecular;
587};
588#ifdef USE_ALPHAHASH
589	varying vec3 vPosition;
590#endif
591vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
592	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
593}
594vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
595	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
596}
597bool isPerspectiveMatrix( mat4 m ) {
598	return m[ 2 ][ 3 ] == - 1.0;
599}
600vec2 equirectUv( in vec3 dir ) {
601	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
602	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
603	return vec2( u, v );
604}
605vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
606	return RECIPROCAL_PI * diffuseColor;
607}
608vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
609	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
610	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
611}
612float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
613	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
614	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
615} // validated`,_2=`#ifdef ENVMAP_TYPE_CUBE_UV
616	#define cubeUV_minMipLevel 4.0
617	#define cubeUV_minTileSize 16.0
618	float getFace( vec3 direction ) {
619		vec3 absDirection = abs( direction );
620		float face = - 1.0;
621		if ( absDirection.x > absDirection.z ) {
622			if ( absDirection.x > absDirection.y )
623				face = direction.x > 0.0 ? 0.0 : 3.0;
624			else
625				face = direction.y > 0.0 ? 1.0 : 4.0;
626		} else {
627			if ( absDirection.z > absDirection.y )
628				face = direction.z > 0.0 ? 2.0 : 5.0;
629			else
630				face = direction.y > 0.0 ? 1.0 : 4.0;
631		}
632		return face;
633	}
634	vec2 getUV( vec3 direction, float face ) {
635		vec2 uv;
636		if ( face == 0.0 ) {
637			uv = vec2( direction.z, direction.y ) / abs( direction.x );
638		} else if ( face == 1.0 ) {
639			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
640		} else if ( face == 2.0 ) {
641			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
642		} else if ( face == 3.0 ) {
643			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
644		} else if ( face == 4.0 ) {
645			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
646		} else {
647			uv = vec2( direction.x, direction.y ) / abs( direction.z );
648		}
649		return 0.5 * ( uv + 1.0 );
650	}
651	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
652		float face = getFace( direction );
653		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
654		mipInt = max( mipInt, cubeUV_minMipLevel );
655		float faceSize = exp2( mipInt );
656		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
657		if ( face > 2.0 ) {
658			uv.y += faceSize;
659			face -= 3.0;
660		}
661		uv.x += face * faceSize;
662		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
663		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
664		uv.x *= CUBEUV_TEXEL_WIDTH;
665		uv.y *= CUBEUV_TEXEL_HEIGHT;
666		#ifdef texture2DGradEXT
667			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
668		#else
669			return texture2D( envMap, uv ).rgb;
670		#endif
671	}
672	#define cubeUV_r0 1.0
673	#define cubeUV_m0 - 2.0
674	#define cubeUV_r1 0.8
675	#define cubeUV_m1 - 1.0
676	#define cubeUV_r4 0.4
677	#define cubeUV_m4 2.0
678	#define cubeUV_r5 0.305
679	#define cubeUV_m5 3.0
680	#define cubeUV_r6 0.21
681	#define cubeUV_m6 4.0
682	float roughnessToMip( float roughness ) {
683		float mip = 0.0;
684		if ( roughness >= cubeUV_r1 ) {
685			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
686		} else if ( roughness >= cubeUV_r4 ) {
687			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
688		} else if ( roughness >= cubeUV_r5 ) {
689			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
690		} else if ( roughness >= cubeUV_r6 ) {
691			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
692		} else {
693			mip = - 2.0 * log2( 1.16 * roughness );		}
694		return mip;
695	}
696	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
697		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
698		float mipF = fract( mip );
699		float mipInt = floor( mip );
700		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
701		if ( mipF == 0.0 ) {
702			return vec4( color0, 1.0 );
703		} else {
704			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
705			return vec4( mix( color0, color1, mipF ), 1.0 );
706		}
707	}
708#endif`,y2=`vec3 transformedNormal = objectNormal;
709#ifdef USE_TANGENT
710	vec3 transformedTangent = objectTangent;
711#endif
712#ifdef USE_BATCHING
713	mat3 bm = mat3( batchingMatrix );
714	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
715	transformedNormal = bm * transformedNormal;
716	#ifdef USE_TANGENT
717		transformedTangent = bm * transformedTangent;
718	#endif
719#endif
720#ifdef USE_INSTANCING
721	mat3 im = mat3( instanceMatrix );
722	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
723	transformedNormal = im * transformedNormal;
724	#ifdef USE_TANGENT
725		transformedTangent = im * transformedTangent;
726	#endif
727#endif
728transformedNormal = normalMatrix * transformedNormal;
729#ifdef FLIP_SIDED
730	transformedNormal = - transformedNormal;
731#endif
732#ifdef USE_TANGENT
733	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
734	#ifdef FLIP_SIDED
735		transformedTangent = - transformedTangent;
736	#endif
737#endif`,w2=`#ifdef USE_DISPLACEMENTMAP
738	uniform sampler2D displacementMap;
739	uniform float displacementScale;
740	uniform float displacementBias;
741#endif`,S2=`#ifdef USE_DISPLACEMENTMAP
742	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
742placementBias );
743#endif`,b2=`#ifdef USE_EMISSIVEMAP
744	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
745	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
746		emissiveColor = sRGBTransferEOTF( emissiveColor );
747	#endif
748	totalEmissiveRadiance *= emissiveColor.rgb;
749#endif`,E2=`#ifdef USE_EMISSIVEMAP
750	uniform sampler2D emissiveMap;
751#endif`,M2="gl_FragColor = linearToOutputTexel( gl_FragColor );",T2=`vec4 LinearTransferOETF( in vec4 value ) {
752	return value;
753}
754vec4 sRGBTransferEOTF( in vec4 value ) {
755	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
756}
757vec4 sRGBTransferOETF( in vec4 value ) {
758	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 );
759}`,A2=`#ifdef USE_ENVMAP
760	#ifdef ENV_WORLDPOS
761		vec3 cameraToFrag;
762		if ( isOrthographic ) {
763			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
764		} else {
765			cameraToFrag = normalize( vWorldPosition - cameraPosition );
766		}
767		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
768		#ifdef ENVMAP_MODE_REFLECTION
769			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
770		#else
771			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
772		#endif
773	#else
774		vec3 reflectVec = vReflect;
775	#endif
776	#ifdef ENVMAP_TYPE_CUBE
777		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
778	#else
779		vec4 envColor = vec4( 0.0 );
780	#endif
781	#ifdef ENVMAP_BLENDING_MULTIPLY
782		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
783	#elif defined( ENVMAP_BLENDING_MIX )
784		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
785	#elif defined( ENVMAP_BLENDING_ADD )
786		outgoingLight += envColor.xyz * specularStrength * reflectivity;
787	#endif
788#endif`,R2=`#ifdef USE_ENVMAP
789	uniform float envMapIntensity;
790	uniform float flipEnvMap;
791	uniform mat3 envMapRotation;
792	#ifdef ENVMAP_TYPE_CUBE
793		uniform samplerCube envMap;
794	#else
795		uniform sampler2D envMap;
796	#endif
797#endif`,C2=`#ifdef USE_ENVMAP
798	uniform float reflectivity;
799	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
800		#define ENV_WORLDPOS
801	#endif
802	#ifdef ENV_WORLDPOS
803		varying vec3 vWorldPosition;
804		uniform float refractionRatio;
805	#else
806		varying vec3 vReflect;
807	#endif
808#endif`,P2=`#ifdef USE_ENVMAP
809	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
810		#define ENV_WORLDPOS
811	#endif
812	#ifdef ENV_WORLDPOS
813		
814		varying vec3 vWorldPosition;
815	#else
816		varying vec3 vReflect;
817		uniform float refractionRatio;
818	#endif
819#endif`,N2=`#ifdef USE_ENVMAP
820	#ifdef ENV_WORLDPOS
821		vWorldPosition = worldPosition.xyz;
822	#else
823		vec3 cameraToVertex;
824		if ( isOrthographic ) {
825			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
826		} else {
827			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
828		}
829		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
830		#ifdef ENVMAP_MODE_REFLECTION
831			vReflect = reflect( cameraToVertex, worldNormal );
832		#else
833			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
834		#endif
835	#endif
836#endif`,L2=`#ifdef USE_FOG
837	vFogDepth = - mvPosition.z;
838#endif`,I2=`#ifdef USE_FOG
839	varying float vFogDepth;
840#endif`,D2=`#ifdef USE_FOG
841	#ifdef FOG_EXP2
842		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
843	#else
844		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
845	#endif
846	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
847#endif`,U2=`#ifdef USE_FOG
848	uniform vec3 fogColor;
849	varying float vFogDepth;
850	#ifdef FOG_EXP2
851		uniform float fogDensity;
852	#else
853		uniform float fogNear;
854		uniform float fogFar;
855	#endif
856#endif`,k2=`#ifdef USE_GRADIENTMAP
857	uniform sampler2D gradientMap;
858#endif
859vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
860	float dotNL = dot( normal, lightDirection );
861	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
862	#ifdef USE_GRADIENTMAP
863		return vec3( texture2D( gradientMap, coord ).r );
864	#else
865		vec2 fw = fwidth( coord ) * 0.5;
866		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
867	#endif
868}`,O2=`#ifdef USE_LIGHTMAP
869	uniform sampler2D lightMap;
870	uniform float lightMapIntensity;
871#endif`,F2=`LambertMaterial material;
872material.diffuseColor = diffuseColor.rgb;
873material.specularStrength = specularStrength;`,B2=`varying vec3 vViewPosition;
874struct LambertMaterial {
875	vec3 diffuseColor;
876	float specularStrength;
877};
878void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
879	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
880	vec3 irradiance = dotNL * directLight.color;
881	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
882}
883void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
884	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
885}
886#define RE_Direct				RE_Direct_Lambert
887#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,z2=`uniform bool receiveShadow;
888uniform vec3 ambientLightColor;
889#if defined( USE_LIGHT_PROBES )
890	uniform vec3 lightProbe[ 9 ];
891#endif
892vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
893	float x = normal.x, y = normal.y, z = normal.z;
894	vec3 result = shCoefficients[ 0 ] * 0.886227;
895	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
896	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
897	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
898	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
899	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
900	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
901	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
902	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
903	return result;
904}
905vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
906	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
907	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
908	return irradiance;
909}
910vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
911	vec3 irradiance = ambientLightColor;
912	return irradiance;
913}
914float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
915	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
916	if ( cutoffDistance > 0.0 ) {
917		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
918	}
919	return distanceFalloff;
920}
921float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
922	return smoothstep( coneCosine, penumbraCosine, angleCosine );
923}
924#if NUM_DIR_LIGHTS > 0
925	struct DirectionalLight {
926		vec3 direction;
927		vec3 color;
928	};
929	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
930	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
931		light.color = directionalLight.color;
932		light.direction = directionalLight.direction;
933		light.visible = true;
934	}
935#endif
936#if NUM_POINT_LIGHTS > 0
937	struct PointLight {
938		vec3 position;
939		vec3 color;
940		float distance;
941		float decay;
942	};
943	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
944	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
945		vec3 lVector = pointLight.position - geometryPosition;
946		light.direction = normalize( lVector );
947		float lightDistance = length( lVector );
948		light.color = pointLight.color;
949		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
950		light.visible = ( light.color != vec3( 0.0 ) );
951	}
952#endif
953#if NUM_SPOT_LIGHTS > 0
954	struct SpotLight {
955		vec3 position;
956		vec3 direction;
957		vec3 color;
958		float distance;
959		float decay;
960		float coneCos;
961		float penumbraCos;
962	};
963	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
964	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
965		vec3 lVector = spotLight.position - geometryPosition;
966		light.direction = normalize( lVector );
967		float angleCos = dot( light.direction, spotLight.direction );
968		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
969		if ( spotAttenuation > 0.0 ) {
970			float lightDistance = length( lVector );
971			light.color = spotLight.color * spotAttenuation;
972			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
973			light.visible = ( light.color != vec3( 0.0 ) );
974		} else {
975			light.color = vec3( 0.0 );
976			light.visible = false;
977		}
978	}
979#endif
980#if NUM_RECT_AREA_LIGHTS > 0
981	struct RectAreaLight {
982		vec3 color;
983		vec3 position;
984		vec3 halfWidth;
985		vec3 halfHeight;
986	};
987	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
988	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
989#endif
990#if NUM_HEMI_LIGHTS > 0
991	struct HemisphereLight {
992		vec3 direction;
993		vec3 skyColor;
994		vec3 groundColor;
995	};
996	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
997	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
998		float dotNL = dot( normal, hemiLight.direction );
999		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
1000		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
1001		return irradiance;
1002	}
1003#endif`,V2=`#ifdef USE_ENVMAP
1004	vec3 getIBLIrradiance( const in vec3 normal ) {
1005		#ifdef ENVMAP_TYPE_CUBE_UV
1006			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
1007			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
1008			return PI * envMapColor.rgb * envMapIntensity;
1009		#else
1010			return vec3( 0.0 );
1011		#endif
1012	}
1013	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
1014		#ifdef ENVMAP_TYPE_CUBE_UV
1015			vec3 reflectVec = reflect( - viewDir, normal );
1016			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
1017			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
1018			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
1019			return envMapColor.rgb * envMapIntensity;
1020		#else
1021			return vec3( 0.0 );
1022		#endif
1023	}
1024	#ifdef USE_ANISOTROPY
1025		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
1026			#ifdef ENVMAP_TYPE_CUBE_UV
1027				vec3 bentNormal = cross( bitangent, viewDir );
1028				bentNormal = normalize( cross( bentNormal, bitangent ) );
1029				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
1030				return getIBLRadiance( viewDir, bentNormal, roughness );
1031			#else
1032				return vec3( 0.0 );
1033			#endif
1034		}
1035	#endif
1036#endif`,j2=`ToonMaterial material;
1037material.diffuseColor = diffuseColor.rgb;`,H2=`varying vec3 vViewPosition;
1038struct ToonMaterial {
1039	vec3 diffuseColor;
1040};
1041void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
1042	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
1043	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1044}
1045void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
1046	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1047}
1048#define RE_Direct				RE_Direct_Toon
1049#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,G2=`BlinnPhongMaterial material;
1050material.diffuseColor = diffuseColor.rgb;
1051material.specularColor = specular;
1052material.specularShininess = shininess;
1053material.specularStrength = specularStrength;`,W2=`varying vec3 vViewPosition;
1054struct BlinnPhongMaterial {
1055	vec3 diffuseColor;
1056	vec3 specularColor;
1057	float specularShininess;
1058	float specularStrength;
1059};
1060void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
1061	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1062	vec3 irradiance = dotNL * directLight.color;
1063	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1064	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
1065}
1066void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
1067	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1068}
1069#define RE_Direct				RE_Direct_BlinnPhong
1070#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,$2=`PhysicalMaterial material;
1071material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
1072vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
1073float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
1074material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
1075material.roughness = min( material.roughness, 1.0 );
1076#ifdef IOR
1077	material.ior = ior;
1078	#ifdef USE_SPECULAR
1079		float specularIntensityFactor = specularIntensity;
1080		vec3 specularColorFactor = specularColor;
1081		#ifdef USE_SPECULAR_COLORMAP
1082			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
1083		#endif
1084		#ifdef USE_SPECULAR_INTENSITYMAP
1085			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
1086		#endif
1087		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
1088	#else
1089		float specularIntensityFactor = 1.0;
1090		vec3 specularColorFactor = vec3( 1.0 );
1091		material.specularF90 = 1.0;
1092	#endif
1093	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
1094#else
1095	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
1096	material.specularF90 = 1.0;
1097#endif
1098#ifdef USE_CLEARCOAT
1099	material.clearcoat = clearcoat;
1100	material.clearcoatRoughness = clearcoatRoughness;
1101	material.clearcoatF0 = vec3( 0.04 );
1102	material.clearcoatF90 = 1.0;
1103	#ifdef USE_CLEARCOATMAP
1104		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
1105	#endif
1106	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1107		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
1108	#endif
1109	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
1110	material.clearcoatRoughness += geometryRoughness;
1111	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
1112#endif
1113#ifdef USE_DISPERSION
1114	material.dispersion = dispersion;
1115#endif
1116#ifdef USE_IRIDESCENCE
1117	material.iridescence = iridescence;
1118	material.iridescenceIOR = iridescenceIOR;
1119	#ifdef USE_IRIDESCENCEMAP
1120		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
1121	#endif
1122	#ifdef USE_IRIDESCENCE_THICKNESSMAP
1123		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
1124	#else
1125		material.iridescenceThickness = iridescenceThicknessMaximum;
1126	#endif
1127#endif
1128#ifdef USE_SHEEN
1129	material.sheenColor = sheenColor;
1130	#ifdef USE_SHEEN_COLORMAP
1131		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
1132	#endif
1133	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
1134	#ifdef USE_SHEEN_ROUGHNESSMAP
1135		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
1136	#endif
1137#endif
1138#ifdef USE_ANISOTROPY
1139	#ifdef USE_ANISOTROPYMAP
1140		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
1141		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
1142		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
1143	#else
1144		vec2 anisotropyV = anisotropyVector;
1145	#endif
1146	material.anisotropy = length( anisotropyV );
1147	if( material.anisotropy == 0.0 ) {
1148		anisotropyV = vec2( 1.0, 0.0 );
1149	} else {
1150		anisotropyV /= material.anisotropy;
1151		material.anisotropy = saturate( material.anisotropy );
1152	}
1153	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
1154	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
1155	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
1156#endif`,X2=`uniform sampler2D dfgLUT;
1157struct PhysicalMaterial {
1158	vec3 diffuseColor;
1159	float roughness;
1160	vec3 specularColor;
1161	float specularF90;
1162	float dispersion;
1163	#ifdef USE_CLEARCOAT
1164		float clearcoat;
1165		float clearcoatRoughness;
1166		vec3 clearcoatF0;
1167		float clearcoatF90;
1168	#endif
1169	#ifdef USE_IRIDESCENCE
1170		float iridescence;
1171		float iridescenceIOR;
1172		float iridescenceThickness;
1173		vec3 iridescenceFresnel;
1174		vec3 iridescenceF0;
1175	#endif
1176	#ifdef USE_SHEEN
1177		vec3 sheenColor;
1178		float sheenRoughness;
1179	#endif
1180	#ifdef IOR
1181		float ior;
1182	#endif
1183	#ifdef USE_TRANSMISSION
1184		float transmission;
1185		float transmissionAlpha;
1186		float thickness;
1187		float attenuationDistance;
1188		vec3 attenuationColor;
1189	#endif
1190	#ifdef USE_ANISOTROPY
1191		float anisotropy;
1192		float alphaT;
1193		vec3 anisotropyT;
1194		vec3 anisotropyB;
1195	#endif
1196};
1197vec3 clearcoatSpecularDirect = vec3( 0.0 );
1198vec3 clearcoatSpecularIndirect = vec3( 0.0 );
1199vec3 sheenSpecularDirect = vec3( 0.0 );
1200vec3 sheenSpecularIndirect = vec3(0.0 );
1201vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
1202    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
1203    float x2 = x * x;
1204    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
1205    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
1206}
1207float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1208	float a2 = pow2( alpha );
1209	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1210	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1211	return 0.5 / max( gv + gl, EPSILON );
1212}
1213float D_GGX( const in float alpha, const in float dotNH ) {
1214	float a2 = pow2( alpha );
1215	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1216	return RECIPROCAL_PI * a2 / pow2( denom );
1217}
1218#ifdef USE_ANISOTROPY
1219	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
1220		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1221		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1222		float v = 0.5 / ( gv + gl );
1223		return saturate(v);
1224	}
1225	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1226		float a2 = alphaT * alphaB;
1227		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1228		highp float v2 = dot( v, v );
1229		float w2 = a2 / v2;
1230		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1231	}
1232#endif
1233#ifdef USE_CLEARCOAT
1234	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1235		vec3 f0 = material.clearcoatF0;
1236		float f90 = material.clearcoatF90;
1237		float roughness = material.clearcoatRoughness;
1238		float alpha = pow2( roughness );
1239		vec3 halfDir = normalize( lightDir + viewDir );
1240		float dotNL = saturate( dot( normal, lightDir ) );
1241		float dotNV = saturate( dot( normal, viewDir ) );
1242		float dotNH = saturate( dot( normal, halfDir ) );
1243		float dotVH = saturate( dot( viewDir, halfDir ) );
1244		vec3 F = F_Schlick( f0, f90, dotVH );
1245		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1246		float D = D_GGX( alpha, dotNH );
1247		return F * ( V * D );
1248	}
1249#endif
1250vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1251	vec3 f0 = material.specularColor;
1252	float f90 = material.specularF90;
1253	float roughness = material.roughness;
1254	float alpha = pow2( roughness );
1255	vec3 halfDir = normalize( lightDir + viewDir );
1256	float dotNL = saturate( dot( normal, lightDir ) );
1257	float dotNV = saturate( dot( normal, viewDir ) );
1258	float dotNH = saturate( dot( normal, halfDir ) );
1259	float dotVH = saturate( dot( viewDir, halfDir ) );
1260	vec3 F = F_Schlick( f0, f90, dotVH );
1261	#ifdef USE_IRIDESCENCE
1262		F = mix( F, material.iridescenceFresnel, material.iridescence );
1263	#endif
1264	#ifdef USE_ANISOTROPY
1265		float dotTL = dot( material.anisotropyT, lightDir );
1266		float dotTV = dot( material.anisotropyT, viewDir );
1267		float dotTH = dot( material.anisotropyT, halfDir );
1268		float dotBL = dot( material.anisotropyB, lightDir );
1269		float dotBV = dot( material.anisotropyB, viewDir );
1270		float dotBH = dot( material.anisotropyB, halfDir );
1271		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1272		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1273	#else
1274		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1275		float D = D_GGX( alpha, dotNH );
1276	#endif
1277	return F * ( V * D );
1278}
1279vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1280	const float LUT_SIZE = 64.0;
1281	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1282	const float LUT_BIAS = 0.5 / LUT_SIZE;
1283	float dotNV = saturate( dot( N, V ) );
1284	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1285	uv = uv * LUT_SCALE + LUT_BIAS;
1286	return uv;
1287}
1288float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1289	float l = length( f );
1290	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1291}
1292vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1293	float x = dot( v1, v2 );
1294	float y = abs( x );
1295	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1296	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1297	float v = a / b;
1298	float theta_sintheta = ( x >
1298 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1299	return cross( v1, v2 ) * theta_sintheta;
1300}
1301vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1302	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1303	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1304	vec3 lightNormal = cross( v1, v2 );
1305	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1306	vec3 T1, T2;
1307	T1 = normalize( V - N * dot( V, N ) );
1308	T2 = - cross( N, T1 );
1309	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1310	vec3 coords[ 4 ];
1311	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1312	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1313	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1314	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1315	coords[ 0 ] = normalize( coords[ 0 ] );
1316	coords[ 1 ] = normalize( coords[ 1 ] );
1317	coords[ 2 ] = normalize( coords[ 2 ] );
1318	coords[ 3 ] = normalize( coords[ 3 ] );
1319	vec3 vectorFormFactor = vec3( 0.0 );
1320	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1321	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1322	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1323	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1324	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1325	return vec3( result );
1326}
1327#if defined( USE_SHEEN )
1328float D_Charlie( float roughness, float dotNH ) {
1329	float alpha = pow2( roughness );
1330	float invAlpha = 1.0 / alpha;
1331	float cos2h = dotNH * dotNH;
1332	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1333	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1334}
1335float V_Neubelt( float dotNV, float dotNL ) {
1336	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1337}
1338vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1339	vec3 halfDir = normalize( lightDir + viewDir );
1340	float dotNL = saturate( dot( normal, lightDir ) );
1341	float dotNV = saturate( dot( normal, viewDir ) );
1342	float dotNH = saturate( dot( normal, halfDir ) );
1343	float D = D_Charlie( sheenRoughness, dotNH );
1344	float V = V_Neubelt( dotNV, dotNL );
1345	return sheenColor * ( D * V );
1346}
1347#endif
1348float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1349	float dotNV = saturate( dot( normal, viewDir ) );
1350	float r2 = roughness * roughness;
1351	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
1352	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
1353	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
1354	return saturate( DG * RECIPROCAL_PI );
1355}
1356vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1357	float dotNV = saturate( dot( normal, viewDir ) );
1358	vec2 uv = vec2( roughness, dotNV );
1359	return texture2D( dfgLUT, uv ).rg;
1360}
1361vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1362	vec2 fab = DFGApprox( normal, viewDir, roughness );
1363	return specularColor * fab.x + specularF90 * fab.y;
1364}
1365#ifdef USE_IRIDESCENCE
1366void 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 ) {
1367#else
1368void 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 ) {
1369#endif
1370	vec2 fab = DFGApprox( normal, viewDir, roughness );
1371	#ifdef USE_IRIDESCENCE
1372		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1373	#else
1374		vec3 Fr = specularColor;
1375	#endif
1376	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1377	float Ess = fab.x + fab.y;
1378	float Ems = 1.0 - Ess;
1379	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1380	singleScatter += FssEss;
1381	multiScatter += Fms * Ems;
1382}
1383vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1384	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
1385	float dotNL = saturate( dot( normal, lightDir ) );
1386	float dotNV = saturate( dot( normal, viewDir ) );
1387	vec2 dfgV = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNV * dotNV), 0.0, dotNV), material.roughness );
1388	vec2 dfgL = DFGApprox( vec3(0.0, 0.0, 1.0), vec3(sqrt(1.0 - dotNL * dotNL), 0.0, dotNL), material.roughness );
1389	vec3 FssEss_V = material.specularColor * dfgV.x + material.specularF90 * dfgV.y;
1390	vec3 FssEss_L = material.specularColor * dfgL.x + material.specularF90 * dfgL.y;
1391	float Ess_V = dfgV.x + dfgV.y;
1392	float Ess_L = dfgL.x + dfgL.y;
1393	float Ems_V = 1.0 - Ess_V;
1394	float Ems_L = 1.0 - Ess_L;
1395	vec3 Favg = material.specularColor + ( 1.0 - material.specularColor ) * 0.047619;
1396	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg * Favg + EPSILON );
1397	float compensationFactor = Ems_V * Ems_L;
1398	vec3 multiScatter = Fms * compensationFactor;
1399	return singleScatter + multiScatter;
1400}
1401#if NUM_RECT_AREA_LIGHTS > 0
1402	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1403		vec3 normal = geometryNormal;
1404		vec3 viewDir = geometryViewDir;
1405		vec3 position = geometryPosition;
1406		vec3 lightPos = rectAreaLight.position;
1407		vec3 halfWidth = rectAreaLight.halfWidth;
1408		vec3 halfHeight = rectAreaLight.halfHeight;
1409		vec3 lightColor = rectAreaLight.color;
1410		float roughness = material.roughness;
1411		vec3 rectCoords[ 4 ];
1412		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1413		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1414		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1415		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1416		vec4 t1 = texture2D( ltc_1, uv );
1417		vec4 t2 = texture2D( ltc_2, uv );
1418		mat3 mInv = mat3(
1419			vec3( t1.x, 0, t1.y ),
1420			vec3(    0, 1,    0 ),
1421			vec3( t1.z, 0, t1.w )
1422		);
1423		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1424		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1425		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1426	}
1427#endif
1428void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1429	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1430	vec3 irradiance = dotNL * directLight.color;
1431	#ifdef USE_CLEARCOAT
1432		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1433		vec3 ccIrradiance = dotNLcc * directLight.color;
1434		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1435	#endif
1436	#ifdef USE_SHEEN
1437		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1438	#endif
1439	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
1440	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1441}
1442void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
1443	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1444}
1445void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
1446	#ifdef USE_CLEARCOAT
1447		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1448	#endif
1449	#ifdef USE_SHEEN
1450		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1451	#endif
1452	vec3 singleScattering = vec3( 0.0 );
1453	vec3 multiScattering = vec3( 0.0 );
1454	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1455	#ifdef USE_IRIDESCENCE
1456		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1457	#else
1458		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1459	#endif
1460	vec3 totalScattering = singleScattering + multiScattering;
1461	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1462	reflectedLight.indirectSpecular += radiance * singleScattering;
1463	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1464	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1465}
1466#define RE_Direct				RE_Direct_Physical
1467#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1468#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1469#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1470float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1471	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1472}`,q2=`
1473vec3 geometryPosition = - vViewPosition;
1474vec3 geometryNormal = normal;
1475vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1476vec3 geometryClearcoatNormal = vec3( 0.0 );
1477#ifdef USE_CLEARCOAT
1478	geometryClearcoatNormal = clearcoatNormal;
1479#endif
1480#ifdef USE_IRIDESCENCE
1481	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1482	if ( material.iridescenceThickness == 0.0 ) {
1483		material.iridescence = 0.0;
1484	} else {
1485		material.iridescence = saturate( material.iridescence );
1486	}
1487	if ( material.iridescence > 0.0 ) {
1488		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1489		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1490	}
1491#endif
1492IncidentLight directLight;
1493#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1494	PointLight pointLight;
1495	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1496	PointLightShadow pointLightShadow;
1497	#endif
1498	#pragma unroll_loop_start
1499	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1500		pointLight = pointLights[ i ];
1501		getPointLightInfo( pointLight, geometryPosition, directLight );
1502		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1503		pointLightShadow = pointLightShadows[ i ];
1504		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1505		#endif
1506		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1507	}
1508	#pragma unroll_loop_end
1509#endif
1510#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1511	SpotLight spotLight;
1512	vec4 spotColor;
1513	vec3 spotLightCoord;
1514	bool inSpotLightMap;
1515	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1516	SpotLightShadow spotLightShadow;
1517	#endif
1518	#pragma unroll_loop_start
1519	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1520		spotLight = spotLights[ i ];
1521		getSpotLightInfo( spotLight, geometryPosition, directLight );
1522		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1523		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1524		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1525		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1526		#else
1527		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1528		#endif
1529		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1530			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1531			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1532			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1533			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1534		#endif
1535		#undef SPOT_LIGHT_MAP_INDEX
1536		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_L
1536IGHT_SHADOWS )
1537		spotLightShadow = spotLightShadows[ i ];
1538		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1539		#endif
1540		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1541	}
1542	#pragma unroll_loop_end
1543#endif
1544#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1545	DirectionalLight directionalLight;
1546	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1547	DirectionalLightShadow directionalLightShadow;
1548	#endif
1549	#pragma unroll_loop_start
1550	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1551		directionalLight = directionalLights[ i ];
1552		getDirectionalLightInfo( directionalLight, directLight );
1553		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1554		directionalLightShadow = directionalLightShadows[ i ];
1555		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1556		#endif
1557		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1558	}
1559	#pragma unroll_loop_end
1560#endif
1561#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1562	RectAreaLight rectAreaLight;
1563	#pragma unroll_loop_start
1564	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1565		rectAreaLight = rectAreaLights[ i ];
1566		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1567	}
1568	#pragma unroll_loop_end
1569#endif
1570#if defined( RE_IndirectDiffuse )
1571	vec3 iblIrradiance = vec3( 0.0 );
1572	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1573	#if defined( USE_LIGHT_PROBES )
1574		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1575	#endif
1576	#if ( NUM_HEMI_LIGHTS > 0 )
1577		#pragma unroll_loop_start
1578		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1579			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1580		}
1581		#pragma unroll_loop_end
1582	#endif
1583#endif
1584#if defined( RE_IndirectSpecular )
1585	vec3 radiance = vec3( 0.0 );
1586	vec3 clearcoatRadiance = vec3( 0.0 );
1587#endif`,K2=`#if defined( RE_IndirectDiffuse )
1588	#ifdef USE_LIGHTMAP
1589		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1590		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1591		irradiance += lightMapIrradiance;
1592	#endif
1593	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1594		iblIrradiance += getIBLIrradiance( geometryNormal );
1595	#endif
1596#endif
1597#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1598	#ifdef USE_ANISOTROPY
1599		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1600	#else
1601		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1602	#endif
1603	#ifdef USE_CLEARCOAT
1604		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1605	#endif
1606#endif`,Y2=`#if defined( RE_IndirectDiffuse )
1607	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1608#endif
1609#if defined( RE_IndirectSpecular )
1610	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1611#endif`,J2=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1612	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1613#endif`,Z2=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1614	uniform float logDepthBufFC;
1615	varying float vFragDepth;
1616	varying float vIsPerspective;
1617#endif`,Q2=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1618	varying float vFragDepth;
1619	varying float vIsPerspective;
1620#endif`,eA=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1621	vFragDepth = 1.0 + gl_Position.w;
1622	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1623#endif`,tA=`#ifdef USE_MAP
1624	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1625	#ifdef DECODE_VIDEO_TEXTURE
1626		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1627	#endif
1628	diffuseColor *= sampledDiffuseColor;
1629#endif`,nA=`#ifdef USE_MAP
1630	uniform sampler2D map;
1631#endif`,rA=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1632	#if defined( USE_POINTS_UV )
1633		vec2 uv = vUv;
1634	#else
1635		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1636	#endif
1637#endif
1638#ifdef USE_MAP
1639	diffuseColor *= texture2D( map, uv );
1640#endif
1641#ifdef USE_ALPHAMAP
1642	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1643#endif`,iA=`#if defined( USE_POINTS_UV )
1644	varying vec2 vUv;
1645#else
1646	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1647		uniform mat3 uvTransform;
1648	#endif
1649#endif
1650#ifdef USE_MAP
1651	uniform sampler2D map;
1652#endif
1653#ifdef USE_ALPHAMAP
1654	uniform sampler2D alphaMap;
1655#endif`,sA=`float metalnessFactor = metalness;
1656#ifdef USE_METALNESSMAP
1657	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1658	metalnessFactor *= texelMetalness.b;
1659#endif`,aA=`#ifdef USE_METALNESSMAP
1660	uniform sampler2D metalnessMap;
1661#endif`,oA=`#ifdef USE_INSTANCING_MORPH
1662	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1663	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1664	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1665		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1666	}
1667#endif`,lA=`#if defined( USE_MORPHCOLORS )
1668	vColor *= morphTargetBaseInfluence;
1669	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1670		#if defined( USE_COLOR_ALPHA )
1671			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1672		#elif defined( USE_COLOR )
1673			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1674		#endif
1675	}
1676#endif`,cA=`#ifdef USE_MORPHNORMALS
1677	objectNormal *= morphTargetBaseInfluence;
1678	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1679		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1680	}
1681#endif`,uA=`#ifdef USE_MORPHTARGETS
1682	#ifndef USE_INSTANCING_MORPH
1683		uniform float morphTargetBaseInfluence;
1684		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1685	#endif
1686	uniform sampler2DArray morphTargetsTexture;
1687	uniform ivec2 morphTargetsTextureSize;
1688	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1689		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1690		int y = texelIndex / morphTargetsTextureSize.x;
1691		int x = texelIndex - y * morphTargetsTextureSize.x;
1692		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1693		return texelFetch( morphTargetsTexture, morphUV, 0 );
1694	}
1695#endif`,dA=`#ifdef USE_MORPHTARGETS
1696	transformed *= morphTargetBaseInfluence;
1697	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1698		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1699	}
1700#endif`,hA=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1701#ifdef FLAT_SHADED
1702	vec3 fdx = dFdx( vViewPosition );
1703	vec3 fdy = dFdy( vViewPosition );
1704	vec3 normal = normalize( cross( fdx, fdy ) );
1705#else
1706	vec3 normal = normalize( vNormal );
1707	#ifdef DOUBLE_SIDED
1708		normal *= faceDirection;
1709	#endif
1710#endif
1711#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1712	#ifdef USE_TANGENT
1713		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1714	#else
1715		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1716		#if defined( USE_NORMALMAP )
1717			vNormalMapUv
1718		#elif defined( USE_CLEARCOAT_NORMALMAP )
1719			vClearcoatNormalMapUv
1720		#else
1721			vUv
1722		#endif
1723		);
1724	#endif
1725	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1726		tbn[0] *= faceDirection;
1727		tbn[1] *= faceDirection;
1728	#endif
1729#endif
1730#ifdef USE_CLEARCOAT_NORMALMAP
1731	#ifdef USE_TANGENT
1732		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1733	#else
1734		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1735	#endif
1736	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1737		tbn2[0] *= faceDirection;
1738		tbn2[1] *= faceDirection;
1739	#endif
1740#endif
1741vec3 nonPerturbedNormal = normal;`,fA=`#ifdef USE_NORMALMAP_OBJECTSPACE
1742	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1743	#ifdef FLIP_SIDED
1744		normal = - normal;
1745	#endif
1746	#ifdef DOUBLE_SIDED
1747		normal = normal * faceDirection;
1748	#endif
1749	normal = normalize( normalMatrix * normal );
1750#elif defined( USE_NORMALMAP_TANGENTSPACE )
1751	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1752	mapN.xy *= normalScale;
1753	normal = normalize( tbn * mapN );
1754#elif defined( USE_BUMPMAP )
1755	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1756#endif`,pA=`#ifndef FLAT_SHADED
1757	varying vec3 vNormal;
1758	#ifdef USE_TANGENT
1759		varying vec3 vTangent;
1760		varying vec3 vBitangent;
1761	#endif
1762#endif`,mA=`#ifndef FLAT_SHADED
1763	varying vec3 vNormal;
1764	#ifdef USE_TANGENT
1765		varying vec3 vTangent;
1766		varying vec3 vBitangent;
1767	#endif
1768#endif`,gA=`#ifndef FLAT_SHADED
1769	vNormal = normalize( transformedNormal );
1770	#ifdef USE_TANGENT
1771		vTangent = normalize( transformedTangent );
1772		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1773	#endif
1774#endif`,xA=`#ifdef USE_NORMALMAP
1775	uniform sampler2D normalMap;
1776	uniform vec2 normalScale;
1777#endif
1778#ifdef USE_NORMALMAP_OBJECTSPACE
1779	uniform mat3 normalMatrix;
1780#endif
1781#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1782	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1783		vec3 q0 = dFdx( eye_pos.xyz );
1784		vec3 q1 = dFdy( eye_pos.xyz );
1785		vec2 st0 = dFdx( uv.st );
1786		vec2 st1 = dFdy( uv.st );
1787		vec3 N = surf_norm;
1788		vec3 q1perp = cross( q1, N );
1789		vec3 q0perp = cross( N, q0 );
1790		vec3 T = q1perp * st0.x + q0perp * st1.x;
1791		vec3 B = q1perp * st0.y + q0perp * st1.y;
1792		float det = max( dot( T, T ), dot( B, B ) );
1793		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1794		return mat3( T * scale, B * scale, N );
1795	}
1796#endif`,vA=`#ifdef USE_CLEARCOAT
1797	vec3 clearcoatNormal = nonPerturbedNormal;
1798#endif`,_A=`#ifdef USE_CLEARCOAT_NORMALMAP
1799	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1800	clearcoatMapN.xy *= clearcoatNormalScale;
1801	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1802#endif`,yA=`#ifdef USE_CLEARCOATMAP
1803	uniform sampler2D clearcoatMap;
1804#endif
1805#ifdef USE_CLEARCOAT_NORMALMAP
1806	uniform sampler2D clearcoatNormalMap;
1807	uniform vec2 clearcoatNormalScale;
1808#endif
1809#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1810	uniform sampler2D clearcoatRoughnessMap;
1811#endif`,wA=`#ifdef USE_IRIDESCENCEMAP
1812	uniform sampler2D iridescenceMap;
1813#endif
1814#ifdef USE_IRIDESCENCE_THICKNESSMAP
1815	uniform sampler2D iridescenceThicknessMap;
1816#endif`,SA=`#ifdef OPAQUE
1817diffuseColor.a = 1.0;
1818#endif
1819#ifdef USE_TRANSMISSION
1820diffuseColor.a *= material.transmissionAlpha;
1821#endif
1822gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,bA=`vec3 packNormalToRGB( const in vec3 normal ) {
1823	return normalize( normal ) * 0.5 + 0.5;
1824}
1825vec3 unpackRGBToNormal( const in vec3 rgb ) {
1826	return 2.0 * rgb.xyz - 1.0;
1827}
1828const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1829const float Inv255 = 1. / 255.;
1830const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1831const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1832const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1833const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1834vec4 packDepthToRGBA( const in float v ) {
1835	if( v <= 0.0 )
1836		return vec4( 0., 0., 0., 0. );
1837	if( v >= 1.0 )
1838		return vec4( 1., 1., 1., 1. );
1839	float vuf;
1840	float af = modf( v * PackFactors.a, vuf );
1841	float bf = modf( vuf * ShiftRight8, vuf );
1842	float gf = modf( vuf * ShiftRight8, vuf );
1843	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1844}
1845vec3 packDepthToRGB( const in float v ) {
1846	if( v <= 0.0 )
1847		return vec3( 0., 0., 0. );
1848	if( v >= 1.0 )
1849		return vec3( 1., 1., 1. );
1850	float vuf;
1851	float bf = modf( v * PackFactors.b, vuf );
1852	float gf = modf( vuf * ShiftRight8, vuf );
1853	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1854}
1855vec2 packDepthToRG( const in float v ) {
1856	if( v <= 0.0 )
1857		return vec2( 0., 0. );
1858	if( v >= 1.0 )
1859		return vec2( 1., 1. );
1860	float vuf;
1861	float gf = modf( v * 256., vuf );
1862	return vec2( vuf * Inv255, gf );
1863}
1864float unpackRGBAToDepth( const in vec4 v ) {
1865	return dot( v, UnpackFactors4 );
1866}
1867float unpackRGBToDepth( const in vec3 v ) {
1868	return dot( v, UnpackFactors3 );
1869}
1870float unpackRGToDepth( const in vec2 v ) {
1871	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1872}
1873vec4 pack2HalfToRGBA( const in vec2 v ) {
1874	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1875	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1876}
1877vec2 unpackRGBATo2Half( const in vec4 v ) {
1878	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1879}
1880float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1881	return ( viewZ + near ) / ( near - far );
1882}
1883float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1884	return depth * ( near - far ) - near;
1885}
1886float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1887	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1888}
1889float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1890	return ( near * far ) / ( ( far - near ) * depth - far );
1891}`,EA=`#ifdef PREMULTIPLIED_ALPHA
1892	gl_FragColor.rgb *= gl_FragColor.a;
1893#endif`,MA=`vec4 mvPosition = vec4( transformed, 1.0 );
1894#ifdef USE_BATCHING
1895	mvPosition = batchingMatrix * mvPosition;
1896#endif
1897#ifdef USE_INSTANCING
1898	mvPosition = instanceMatrix * mvPosition;
1899#endif
1900mvPosition = modelViewMatrix * mvPosition;
1901gl_Position = projectionMatrix * mvPosition;`,TA=`#ifdef DITHERING
1902	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1903#endif`,AA=`#ifdef DITHERING
1904	vec3 dithering( vec3 color ) {
1905		float grid_position = rand( gl_FragCoord.xy );
1906		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1907		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1908		return color + dither_shift_RGB;
1909	}
1910#endif`,RA=`float roughnessFactor = roughness;
1911#ifdef USE_ROUGHNESSMAP
1912	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1913	roughnessFactor *= texelRoughness.g;
1914#endif`,CA=`#ifdef USE_ROUGHNESSMAP
1915	uniform sampler2D roughnessMap;
1916#endif`,PA=`#if NUM_SPOT_LIGHT_COORDS > 0
1917	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1918#endif
1919#if NUM_SPOT_LIGHT_MAPS > 0
1920	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1921#endif
1922#ifdef USE_SHADOWMAP
1923	#if NUM_DIR_LIGHT_SHADOWS > 0
1924		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1925		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1926		struct DirectionalLightShadow {
1927			float shadowIntensity;
1928			float shadowBias;
1929			float shadowNormalBias;
1930			float shadowRadius;
1931			vec2 shadowMapSize;
1932		};
1933		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1934	#endif
1935	#if NUM_SPOT_LIGHT_SHADOWS > 0
1936		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1937		struct SpotLightShadow {
1938			float shadowIntensity;
1939			float shadowBias;
1940			float shadowNormalBias;
1941			float shadowRadius;
1942			vec2 shadowMapSize;
1943		};
1944		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1945	#endif
1946	#if NUM_POINT_LIGHT_SHADOWS > 0
1947		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1948		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1949		struct PointLightShadow {
1950			float shadowIntensity;
1951			float shadowBias;
1952			float shadowNormalBias;
1953			float shadowRadius;
1954			vec2 shadowMapSize;
1955			float shadowCameraNear;
1956			float shadowCameraFar;
1957		};
1958		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1959	#endif
1960	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1961		float depth = unpackRGBAToDepth( texture2D( depths, uv ) );
1962		#ifdef USE_REVERSED_DEPTH_BUFFER
1963			return step( depth, compare );
1964		#else
1965			return step( compare, depth );
1966		#endif
1967	}
1968	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1969		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1970	}
1971	float VSMShadow( sampler2D shadow, vec2 uv, float compare ) {
1972		float occlusion = 1.0;
1973		vec2 distribution = texture2DDistribution( shadow, uv );
1974		#ifdef USE_REVERSED_DEPTH_BUFFER
1975			float hard_shadow = step( distribution.x, compare );
1976		#else
1977			float hard_shadow = step( compare, distribution.x );
1978		#endif
1979		if ( hard_shadow != 1.0 ) {
1980			float distance = compare - distribution.x
vendor: 6,963 bytes, lines 1980-2111
1980;
1981			float variance = max( 0.00000, distribution.y * distribution.y );
1982			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 );
1983		}
1984		return occlusion;
1985	}
1986	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1987		float shadow = 1.0;
1988		shadowCoord.xyz /= shadowCoord.w;
1989		shadowCoord.z += shadowBias;
1990		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1991		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1992		if ( frustumTest ) {
1993		#if defined( SHADOWMAP_TYPE_PCF )
1994			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1995			float dx0 = - texelSize.x * shadowRadius;
1996			float dy0 = - texelSize.y * shadowRadius;
1997			float dx1 = + texelSize.x * shadowRadius;
1998			float dy1 = + texelSize.y * shadowRadius;
1999			float dx2 = dx0 / 2.0;
2000			float dy2 = dy0 / 2.0;
2001			float dx3 = dx1 / 2.0;
2002			float dy3 = dy1 / 2.0;
2003			shadow = (
2004				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
2005				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
2006				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
2007				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
2008				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
2009				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
2010				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
2011				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
2012				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
2013				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
2014				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
2015				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
2016				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
2017				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
2018				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
2019				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
2020				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
2021			) * ( 1.0 / 17.0 );
2022		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
2023			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
2024			float dx = texelSize.x;
2025			float dy = texelSize.y;
2026			vec2 uv = shadowCoord.xy;
2027			vec2 f = fract( uv * shadowMapSize + 0.5 );
2028			uv -= f * texelSize;
2029			shadow = (
2030				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
2031				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
2032				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
2033				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
2034				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
2035					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
2036					 f.x ) +
2037				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
2038					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
2039					 f.x ) +
2040				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
2041					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
2042					 f.y ) +
2043				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
2044					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
2045					 f.y ) +
2046				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
2047						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
2048						  f.x ),
2049					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
2050						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
2051						  f.x ),
2052					 f.y )
2053			) * ( 1.0 / 9.0 );
2054		#elif defined( SHADOWMAP_TYPE_VSM )
2055			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
2056		#else
2057			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
2058		#endif
2059		}
2060		return mix( 1.0, shadow, shadowIntensity );
2061	}
2062	vec2 cubeToUV( vec3 v, float texelSizeY ) {
2063		vec3 absV = abs( v );
2064		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
2065		absV *= scaleToCube;
2066		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
2067		vec2 planar = v.xy;
2068		float almostATexel = 1.5 * texelSizeY;
2069		float almostOne = 1.0 - almostATexel;
2070		if ( absV.z >= almostOne ) {
2071			if ( v.z > 0.0 )
2072				planar.x = 4.0 - v.x;
2073		} else if ( absV.x >= almostOne ) {
2074			float signX = sign( v.x );
2075			planar.x = v.z * signX + 2.0 * signX;
2076		} else if ( absV.y >= almostOne ) {
2077			float signY = sign( v.y );
2078			planar.x = v.x + 2.0 * signY + 2.0;
2079			planar.y = v.z * signY - 2.0;
2080		}
2081		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
2082	}
2083	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
2084		float shadow = 1.0;
2085		vec3 lightToPosition = shadowCoord.xyz;
2086		
2087		float lightToPositionLength = length( lightToPosition );
2088		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
2089			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
2090			vec3 bd3D = normalize( lightToPosition );
2091			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
2092			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
2093				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
2094				shadow = (
2095					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
2096					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
2097					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
2098					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
2099					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
2100					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
2101					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
2102					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
2103					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
2104				) * ( 1.0 / 9.0 );
2105			#else
2106				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
2107			#endif
2108		}
2109		return mix( 1.0, shadow, shadowIntensity );
2110	}
2111#endif`,
2111NA=`#if NUM_SPOT_LIGHT_COORDS > 0
2112	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
2113	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2114#endif
2115#ifdef USE_SHADOWMAP
2116	#if NUM_DIR_LIGHT_SHADOWS > 0
2117		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
2118		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
2119		struct DirectionalLightShadow {
2120			float shadowIntensity;
2121			float shadowBias;
2122			float shadowNormalBias;
2123			float shadowRadius;
2124			vec2 shadowMapSize;
2125		};
2126		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2127	#endif
2128	#if NUM_SPOT_LIGHT_SHADOWS > 0
2129		struct SpotLightShadow {
2130			float shadowIntensity;
2131			float shadowBias;
2132			float shadowNormalBias;
2133			float shadowRadius;
2134			vec2 shadowMapSize;
2135		};
2136		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2137	#endif
2138	#if NUM_POINT_LIGHT_SHADOWS > 0
2139		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2140		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2141		struct PointLightShadow {
2142			float shadowIntensity;
2143			float shadowBias;
2144			float shadowNormalBias;
2145			float shadowRadius;
2146			vec2 shadowMapSize;
2147			float shadowCameraNear;
2148			float shadowCameraFar;
2149		};
2150		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2151	#endif
2152#endif`,LA=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2153	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2154	vec4 shadowWorldPosition;
2155#endif
2156#if defined( USE_SHADOWMAP )
2157	#if NUM_DIR_LIGHT_SHADOWS > 0
2158		#pragma unroll_loop_start
2159		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2160			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2161			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2162		}
2163		#pragma unroll_loop_end
2164	#endif
2165	#if NUM_POINT_LIGHT_SHADOWS > 0
2166		#pragma unroll_loop_start
2167		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2168			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2169			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2170		}
2171		#pragma unroll_loop_end
2172	#endif
2173#endif
2174#if NUM_SPOT_LIGHT_COORDS > 0
2175	#pragma unroll_loop_start
2176	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2177		shadowWorldPosition = worldPosition;
2178		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2179			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2180		#endif
2181		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2182	}
2183	#pragma unroll_loop_end
2184#endif`,IA=`float getShadowMask() {
2185	float shadow = 1.0;
2186	#ifdef USE_SHADOWMAP
2187	#if NUM_DIR_LIGHT_SHADOWS > 0
2188	DirectionalLightShadow directionalLight;
2189	#pragma unroll_loop_start
2190	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2191		directionalLight = directionalLightShadows[ i ];
2192		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2193	}
2194	#pragma unroll_loop_end
2195	#endif
2196	#if NUM_SPOT_LIGHT_SHADOWS > 0
2197	SpotLightShadow spotLight;
2198	#pragma unroll_loop_start
2199	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2200		spotLight = spotLightShadows[ i ];
2201		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2202	}
2203	#pragma unroll_loop_end
2204	#endif
2205	#if NUM_POINT_LIGHT_SHADOWS > 0
2206	PointLightShadow pointLight;
2207	#pragma unroll_loop_start
2208	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2209		pointLight = pointLightShadows[ i ];
2210		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2211	}
2212	#pragma unroll_loop_end
2213	#endif
2214	#endif
2215	return shadow;
2216}`,DA=`#ifdef USE_SKINNING
2217	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2218	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2219	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2220	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2221#endif`,UA=`#ifdef USE_SKINNING
2222	uniform mat4 bindMatrix;
2223	uniform mat4 bindMatrixInverse;
2224	uniform highp sampler2D boneTexture;
2225	mat4 getBoneMatrix( const in float i ) {
2226		int size = textureSize( boneTexture, 0 ).x;
2227		int j = int( i ) * 4;
2228		int x = j % size;
2229		int y = j / size;
2230		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2231		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2232		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2233		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2234		return mat4( v1, v2, v3, v4 );
2235	}
2236#endif`,kA=`#ifdef USE_SKINNING
2237	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2238	vec4 skinned = vec4( 0.0 );
2239	skinned += boneMatX * skinVertex * skinWeight.x;
2240	skinned += boneMatY * skinVertex * skinWeight.y;
2241	skinned += boneMatZ * skinVertex * skinWeight.z;
2242	skinned += boneMatW * skinVertex * skinWeight.w;
2243	transformed = ( bindMatrixInverse * skinned ).xyz;
2244#endif`,OA=`#ifdef USE_SKINNING
2245	mat4 skinMatrix = mat4( 0.0 );
2246	skinMatrix += skinWeight.x * boneMatX;
2247	skinMatrix += skinWeight.y * boneMatY;
2248	skinMatrix += skinWeight.z * boneMatZ;
2249	skinMatrix += skinWeight.w * boneMatW;
2250	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2251	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2252	#ifdef USE_TANGENT
2253		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2254	#endif
2255#endif`,FA=`float specularStrength;
2256#ifdef USE_SPECULARMAP
2257	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2258	specularStrength = texelSpecular.r;
2259#else
2260	specularStrength = 1.0;
2261#endif`,BA=`#ifdef USE_SPECULARMAP
2262	uniform sampler2D specularMap;
2263#endif`,zA=`#if defined( TONE_MAPPING )
2264	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2265#endif`,VA=`#ifndef saturate
2266#define saturate( a ) clamp( a, 0.0, 1.0 )
2267#endif
2268uniform float toneMappingExposure;
2269vec3 LinearToneMapping( vec3 color ) {
2270	return saturate( toneMappingExposure * color );
2271}
2272vec3 ReinhardToneMapping( vec3 color ) {
2273	color *= toneMappingExposure;
2274	return saturate( color / ( vec3( 1.0 ) + color ) );
2275}
2276vec3 CineonToneMapping( vec3 color ) {
2277	color *= toneMappingExposure;
2278	color = max( vec3( 0.0 ), color - 0.004 );
2279	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2280}
2281vec3 RRTAndODTFit( vec3 v ) {
2282	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2283	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2284	return a / b;
2285}
2286vec3 ACESFilmicToneMapping( vec3 color ) {
2287	const mat3 ACESInputMat = mat3(
2288		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2289		vec3( 0.04823, 0.01566, 0.83777 )
2290	);
2291	const mat3 ACESOutputMat = mat3(
2292		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2293		vec3( -0.07367, -0.00605,  1.07602 )
2294	);
2295	color *= toneMappingExposure / 0.6;
2296	color = ACESInputMat * color;
2297	color = RRTAndODTFit( color );
2298	color = ACESOutputMat * color;
2299	return saturate( color );
2300}
2301const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2302	vec3( 1.6605, - 0.1246, - 0.0182 ),
2303	vec3( - 0.5876, 1.1329, - 0.1006 ),
2304	vec3( - 0.0728, - 0.0083, 1.1187 )
2305);
2306const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2307	vec3( 0.6274, 0.0691, 0.0164 ),
2308	vec3( 0.3293, 0.9195, 0.0880 ),
2309	vec3( 0.0433, 0.0113, 0.8956 )
2310);
2311vec3 agxDefaultContrastApprox( vec3 x ) {
2312	vec3 x2 = x * x;
2313	vec3 x4 = x2 * x2;
2314	return + 15.5 * x4 * x2
2315		- 40.14 * x4 * x
2316		+ 31.96 * x4
2317		- 6.868 * x2 * x
2318		+ 0.4298 * x2
2319		+ 0.1191 * x
2320		- 0.00232;
2321}
2322vec3 AgXToneMapping( vec3 color ) {
2323	const mat3 AgXInsetMatrix = mat3(
2324		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2325		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2326		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2327	);
2328	const mat3 AgXOutsetMatrix = mat3(
2329		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2330		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2331		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2332	);
2333	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2334	color *= toneMappingExposure;
2335	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2336	color = AgXInsetMatrix * color;
2337	color = max( color, 1e-10 );	color = log2( color );
2338	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2339	color = clamp( color, 0.0, 1.0 );
2340	color = agxDefaultContrastApprox( color );
2341	color = AgXOutsetMatrix * color;
2342	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2343	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2344	color = clamp( color, 0.0, 1.0 );
2345	return color;
2346}
2347vec3 NeutralToneMapping( vec3 color ) {
2348	const float StartCompression = 0.8 - 0.04;
2349	const float Desaturation = 0.15;
2350	color *= toneMappingExposure;
2351	float x = min( color.r, min( color.g, color.b ) );
2352	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2353	color -= offset;
2354	float peak = max( color.r, max( color.g, color.b ) );
2355	if ( peak < StartCompression ) return color;
2356	float d = 1. - StartCompression;
2357	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2358	color *= newPeak / peak;
2359	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2360	return mix( color, vec3( newPeak ), g );
2361}
2362vec3 CustomToneMapping( vec3 color ) { return color; }`,jA=`#ifdef USE_TRANSMISSION
2363	material.transmission = transmission;
2364	material.transmissionAlpha = 1.0;
2365	material.thickness = thickness;
2366	material.attenuationDistance = attenuationDistance;
2367	material.attenuationColor = attenuationColor;
2368	#ifdef USE_TRANSMISSIONMAP
2369		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2370	#endif
2371	#ifdef USE_THICKNESSMAP
2372		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2373	#endif
2374	vec3 pos = vWorldPosition;
2375	vec3 v = normalize( cameraPosition - pos );
2376	vec3 n = inverseTransformDirection( normal, viewMatrix );
2377	vec4 transmitted = getIBLVolumeRefraction(
2378		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
2379		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2380		material.attenuationColor, material.attenuationDistance );
2381	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2382	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2383#endif`,HA=`#ifdef USE_TRANSMISSION
2384	uniform float transmission;
2385	uniform float thickness;
2386	uniform float attenuationDistance;
2387	uniform vec3 attenuationColor;
2388	#ifdef USE_TRANSMISSIONMAP
2389		uniform sampler2D transmissionMap;
2390	#endif
2391	#ifdef USE_THICKNESSMAP
2392		uniform sampler2D thicknessMap;
2393	#endif
2394	uniform vec2 transmissionSamplerSize;
2395	uniform sampler2D transmissionSamplerMap;
2396	uniform mat4 modelMatrix;
2397	uniform mat4 projectionMatrix;
2398	varying vec3 vWorldPosition;
2399	float w0( float a ) {
2400		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2401	}
2402	float w1( float a ) {
2403		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2404	}
2405	float w2( float a ){
2406		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2407	}
2408	float w3( float a ) {
2409		return ( 1.0 / 6.0 ) * ( a * a * a );
2410	}
2411	float g0( float a ) {
2412		return w0( a ) + w1( a );
2413	}
2414	float g1( float a ) {
2415		return w2( a ) + w3( a );
2416	}
2417	float h0( float a ) {
2418		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2419	}
2420	float h1( float a ) {
2421		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2422	}
2423	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2424		uv = uv * texelSize.zw + 0.5;
2425		vec2 iuv = floor( uv );
2426		vec2 fuv = fract( uv );
2427		float g0x = g0( fuv.x );
2428		float g1x = g1( fuv.x );
2429		float h0x = h0( fuv.x );
2430		float h1x = h1( fuv.x );
2431		float h0y = h0( fuv.y );
2432		float h1y = h1( fuv.y );
2433		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2434		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2435		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2436		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2437		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2438			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2439	}
2440	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2441		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2442		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2443		vec2 fLodSizeInv = 1.0 / fLodSize;
2444		vec2 cLodSizeInv = 1.0 / cLodSize;
2445		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2446		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2447		return mix( fSample, cSample, fract( lod ) );
2448	}
2449	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2450		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2451		vec3 modelScale;
2452		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2453		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2454		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2455		return normalize( refractionVector ) * thickness * modelScale;
2456	}
2457	float applyIorToRoughness( const in float roughness, const in float ior ) {
2458		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2459	}
2460	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2461		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2462		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2463	}
2464	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2465		if ( isinf( attenuationDistance ) ) {
2466			return vec3( 1.0 );
2467		} else {
2468			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2469			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2470		}
2471	}
2472	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2473		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2474		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2475		const in vec3 attenuationColor, const in float attenuationDistance ) {
2476		vec4 transmittedLight;
2477		vec3 transmittance;
2478		#ifdef USE_DISPERSION
2479			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2480			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2481			for ( int i = 0; i < 3; i ++ ) {
2482				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2483				vec3 refractedRayExit = position + transmissionRay;
2484				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2485				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2486				refractionCoords += 1.0;
2487				refractionCoords /= 2.0;
2488				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2489				transmittedLight[ i ] = transmissionSample[ i ];
2490				transmittedLight.a += transmissionSample.a;
2491				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2492			}
2493			transmittedLight.a /= 3.0;
2494		#else
2495			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2496			vec3 refractedRayExit = position + transmissionRay;
2497			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2498			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2499			refractionCoords += 1.0;
2500			refractionCoords /= 2.0;
2501			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2502			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2503		#endif
2504		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2505		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2506		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2507		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2508	}
2509#endif`,GA=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2510	varying vec2 vUv;
2511#endif
2512#ifdef USE_MAP
2513	varying vec2 vMapUv;
2514#endif
2515#ifdef USE_ALPHAMAP
2516	varying vec2 vAlphaMapUv;
2517#endif
2518#ifdef USE_LIGHTMAP
2519	varying vec2 vLightMapUv;
2520#endif
2521#ifdef USE_AOMAP
2522	varying vec2 vAoMapUv;
2523#endif
2524#ifdef USE_BUMPMAP
2525	varying vec2 vBumpMapUv;
2526#endif
2527#ifdef USE_NORMALMAP
2528	varying vec2 vNormalMapUv;
2529#endif
2530#ifdef USE_EMISSIVEMAP
2531	varying vec2 vEmissiveMapUv;
2532#endif
2533#ifdef USE_METALNESSMAP
2534	varying vec2 vMetalnessMapUv;
2535#endif
2536#ifdef USE_ROUGHNESSMAP
2537	varying vec2 vRoughnessMapUv;
2538#endif
2539#ifdef USE_ANISOTROPYMAP
2540	varying vec2 vAnisotropyMapUv;
2541#endif
2542#ifdef USE_CLEARCOATMAP
2543	varying vec2 vClearcoatMapUv;
2544#endif
2545#ifdef USE_CLEARCOAT_NORMALMAP
2546	varying vec2 vClearcoatNormalMapUv;
2547#endif
2548#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2549	varying vec2 vClearcoatRoughnessMapUv;
2550#endif
2551#ifdef USE_IRIDESCENCEMAP
2552	varying vec2 vIridescenceMapUv;
2553#endif
2554#ifdef USE_IRIDESCENCE_THICKNESSMAP
2555	varying vec2 vIridescenceThicknessMapUv;
2556#endif
2557#ifdef USE_SHEEN_COLORMAP
2558	varying vec2 vSheenColorMapUv;
2559#endif
2560#ifdef USE_SHEEN_ROUGHNESSMAP
2561	varying vec2 vSheenRoughnessMapUv;
2562#endif
2563#ifdef USE_SPECULARMAP
2564	varying vec2 vSpecularMapUv;
2565#endif
2566#ifdef USE_SPECULAR_COLORMAP
2567	varying vec2 vSpecularColorMapUv;
2568#endif
2569#ifdef USE_SPECULAR_INTENSITYMAP
2570	varying vec2 vSpecularIntensityMapUv;
2571#endif
2572#ifdef USE_TRANSMISSIONMAP
2573	uniform mat3 transmissionMapTransform;
2574	varying vec2 vTransmissionMapUv;
2575#endif
2576#ifdef USE_THICKNESSMAP
2577	uniform mat3 thicknessMapTransform;
2578	varying vec2 vThicknessMapUv;
2579#endif`,WA=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2580	varying vec2 vUv;
2581#endif
2582#ifdef USE_MAP
2583	uniform mat3 mapTransform;
2584	varying vec2 vMapUv;
2585#endif
2586#ifdef USE_ALPHAMAP
2587	uniform mat3 alphaMapTransform;
2588	varying vec2 vAlphaMapUv;
2589#endif
2590#ifdef USE_LIGHTMAP
2591	uniform mat3 lightMapTransform;
2592	varying vec2 vLightMapUv;
2593#endif
2594#ifdef USE_AOMAP
2595	uniform mat3 aoMapTransform;
2596	varying vec2 vAoMapUv;
2597#endif
2598#ifdef USE_BUMPMAP
2599	uniform mat3 bumpMapTransform;
2600	varying vec2 vBumpMapUv;
2601#endif
2602#ifdef USE_NORMALMAP
2603	uniform mat3 normalMapTransform;
2604	varying vec2 vNormalMapUv;
2605#endif
2606#ifdef USE_DISPLACEMENTMAP
2607	uniform mat3 displacementMapTransform;
2608	varying vec2 vDisplacementMapUv;
2609#endif
2610#ifdef USE_EMISSIVEMAP
2611	uniform mat3 emissiveMapTransform;
2612	varying vec2 vEmissiveMapUv;
2613#endif
2614#ifdef USE_METALNESSMAP
2615	uniform mat3 metalnessMapTransform;
2616	varying vec2 vMetalnessMapUv;
2617#endif
2618#ifdef USE_ROUGHNESSMAP
2619	uniform mat3 roughnessMapTransform;
2620	varying vec2 vRoughnessMapUv;
2621#endif
2622#ifdef USE_ANISOTROPYMAP
2623	uniform mat3 anisotropyMapTransform;
2624	varying vec2 vAnisotropyMapUv;
2625#endif
2626#ifdef USE_CLEARCOATMAP
2627	uniform mat3 clearcoatMapTransform;
2628	varying vec2 vClearcoatMapUv;
2629#endif
2630#ifdef USE_CLEARCOAT_NORMALMAP
2631	uniform mat3 clearcoatNormalMapTransform;
2632	varying vec2 vClearcoatNormalMapUv;
2633#endif
2634#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2635	uniform mat3 clearcoatRoughnessMapTransform;
2636	varying vec2 vClearcoatRoughnessMapUv;
2637#endif
2638#ifdef USE_SHEEN_COLORMAP
2639	uniform mat3 sheenColorMapTransform;
2640	varying vec2 vSheenColorMapUv;
2641#endif
2642#ifdef USE_SHEEN_ROUGHNESSMAP
2643	uniform mat3 sheenRoughnessMapTransform;
2644	varying vec2 vSheenRoughnessMapUv;
2645#endif
2646#ifdef USE_IRIDESCENCEMAP
2647	uniform mat3 iridescenceMapTransform;
2648	varying vec2 vIridescenceMapUv;
2649#endif
2650#ifdef USE_IRIDESCENCE_THICKNESSMAP
2651	uniform mat3 iridescenceThicknessMapTransform;
2652	varying vec2 vIridescenceThicknessMapUv;
2653#endif
2654#ifdef USE_SPECULARMAP
2655	uniform mat3 specularMapTransform;
2656	varying vec2 vSpecularMapUv;
2657#endif
2658#ifdef USE_SPECULAR_COLORMAP
2659	uniform mat3 specularColorMapTransform;
2660	varying vec2 vSpecularColorMapUv;
2661#endif
2662#ifdef USE_SPECULAR_INTENSITYMAP
2663	uniform mat3 specularIntensityMapTransform;
2664	varying vec2 vSpecularIntensityMapUv;
2665#endif
2666#ifdef USE_TRANSMISSIONMAP
2667	uniform mat3 transmissionMapTransform;
2668	varying vec2 vTransmissionMapUv;
2669#endif
2670#ifdef USE_THICKNESSMAP
2671	uniform mat3 thicknessMapTransform;
2672	varying vec2 vThicknessMapUv;
2673#endif`,$A=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2674	vUv = vec3( uv, 1 ).xy;
2675#endif
2676#ifdef USE_MAP
2677	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2678#endif
2679#ifdef USE_ALPHAMAP
2680	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2681#endif
2682#ifdef USE_LIGHTMAP
2683	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2684#endif
2685#ifdef USE_AOMAP
2686	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2687#endif
2688#ifdef USE_BUMPMAP
2689	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2690#endif
2691#ifdef USE_NORMALMAP
2692	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2693#endif
2694#ifdef USE_DISPLACEMENTMAP
2695	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2696#endif
2697#ifdef USE_EMISSIVEMAP
2698	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2699#endif
2700#ifdef USE_METALNESSMAP
2701	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2702#endif
2703#ifdef USE_ROUGHNESSMAP
2704	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2705#endif
2706#ifdef USE_ANISOTROPYMAP
2707	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2708#endif
2709#ifdef USE_CLEARCOATMAP
2710	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2711#endif
2712#ifdef USE_CLEARCOAT_NORMALMAP
2713	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2714#endif
2715#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2716	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2717#endif
2718#ifdef USE_IRIDESCENCEMAP
2719	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2720#endif
2721#ifdef USE_IRIDESCENCE_THICKNESSMAP
2722	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2723#endif
2724#ifdef USE_SHEEN_COLORMAP
2725	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2726#endif
2727#ifdef USE_SHEEN_ROUGHNESSMAP
2728	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2729#endif
2730#ifdef USE_SPECULARMAP
2731	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2732#endif
2733#ifdef USE_SPECULAR_COLORMAP
2734	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2735#endif
2736#ifdef USE_SPECULAR_INTENSITYMAP
2737	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2738#endif
2739#ifdef USE_TRANSMISSIONMAP
2740	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2741#endif
2742#ifdef USE_THICKNESSMAP
2743	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2744#endif`,XA=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2745	vec4 worldPosition = vec4( transformed, 1.0 );
2746	#ifdef USE_BATCHING
2747		worldPosition = batchingMatrix * worldPosition;
2748	#endif
2749	#ifdef USE_INSTANCING
2750		worldPosition = instanceMatrix * worldPosition;
2751	#endif
2752	worldPosition = modelMatrix * worldPosition;
2753#endif`;const qA=`varying vec2 vUv;
2754uniform mat3 uvTransform;
2755void main() {
2756	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2757	gl_Position = vec4( position.xy, 1.0, 1.0 );
2758}`,KA=`uniform sampler2D t2D;
2759uniform float backgroundIntensity;
2760varying vec2 vUv;
2761void main() {
2762	vec4 texColor = texture2D( t2D, vUv );
2763	#ifdef DECODE_VIDEO_TEXTURE
2764		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 );
2765	#endif
2766	texColor.rgb *= backgroundIntensity;
2767	gl_FragColor = texColor;
2768	#include <tonemapping_fragment>
2769	#include <colorspace_fragment>
2770}`,YA=`varying vec3 vWorldDirection;
2771#include <common>
2772void main() {
2773	vWorldDirection = transformDirection( position, modelMatrix );
2774	#include <begin_vertex>
2775	#include <project_vertex>
2776	gl_Position.z = gl_Position.w;
2777}`,JA=`#ifdef ENVMAP_TYPE_CUBE
2778	uniform samplerCube envMap;
2779#elif defined( ENVMAP_TYPE_CUBE_UV )
2780	uniform sampler2D envMap;
2781#endif
2782uniform float flipEnvMap;
2783uniform float backgroundBlurriness;
2784uniform float backgroundIntensity;
2785uniform mat3 backgroundRotation;
2786varying vec3 vWorldDirection;
2787#include <cube_uv_reflection_fragment>
2788void main() {
2789	#ifdef ENVMAP_TYPE_CUBE
2790		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2791	#elif defined( ENVMAP_TYPE_CUBE_UV )
2792		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2793	#else
2794		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2795	#endif
2796	texColor.rgb *= backgroundIntensity;
2797	gl_FragColor = texColor;
2798	#include <tonemapping_fragment>
2799	#include <colorspace_fragment>
2800}`,ZA=`varying vec3 vWorldDirection;
2801#include <common>
2802void main() {
2803	vWorldDirection = transformDirection( position, modelMatrix );
2804	#include <begin_vertex>
2805	#include <project_vertex>
2806	gl_Position.z = gl_Position.w;
2807}`,QA=`uniform samplerCube tCube;
2808uniform float tFlip;
2809uniform float opacity;
2810varying vec3 vWorldDirection;
2811void main() {
2812	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2813	gl_FragColor = texColor;
2814	gl_FragColor.a *= opacity;
2815	#include <tonemapping_fragment>
2816	#include <colorspace_fragment>
2817}`,eR=`#include <common>
2818#include <batching_pars_vertex>
2819#include <uv_pars_vertex>
2820#include <displacementmap_pars_vertex>
2821#include <morphtarget_pars_vertex>
2822#include <skinning_pars_vertex>
2823#include <logdepthbuf_pars_vertex>
2824#include <clipping_planes_pars_vertex>
2825varying vec2 vHighPrecisionZW;
2826void main() {
2827	#include <uv_vertex>
2828	#include <batching_vertex>
2829	#include <skinbase_vertex>
2830	#include <morphinstance_vertex>
2831	#ifdef USE_DISPLACEMENTMAP
2832		#include <beginnormal_vertex>
2833		#include <morphnormal_vertex>
2834		#include <skinnormal_vertex>
2835	#endif
2836	#include <begin_vertex>
2837	#include <morphtarget_vertex>
2838	#include <skinning_vertex>
2839	#include <displacementmap_vertex>
2840	#include <project_vertex>
2841	#include <logdepthbuf_vertex>
2842	#include <clipping_planes_vertex>
2843	vHighPrecisionZW = gl_Position.zw;
2844}`,tR=`#if DEPTH_PACKING == 3200
2845	uniform float opacity;
2846#endif
2847#include <common>
2848#include <packing>
2849#include <uv_pars_fragment>
2850#include <map_pars_fragment>
2851#include <alphamap_pars_fragment>
2852#include <alphatest_pars_fragment>
2853#include <alphahash_pars_fragment>
2854#include <logdepthbuf_pars_fragment>
2855#include <clipping_planes_pars_fragment>
2856varying vec2 vHighPrecisionZW;
2857void main() {
2858	vec4 diffuseColor = vec4( 1.0 );
2859	#include <clipping_planes_fragment>
2860	#if DEPTH_PACKING == 3200
2861		diffuseColor.a = opacity;
2862	#endif
2863	#include <map_fragment>
2864	#include <alphamap_fragment>
2865	#include <alphatest_fragment>
2866	#include <alphahash_fragment>
2867	#include <logdepthbuf_fragment>
2868	#ifdef USE_REVERSED_DEPTH_BUFFER
2869		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2870	#else
2871		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2872	#endif
2873	#if DEPTH_PACKING == 3200
2874		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2875	#elif DEPTH_PACKING == 3201
2876		gl_FragColor = packDepthToRGBA( fragCoordZ );
2877	#elif DEPTH_PACKING == 3202
2878		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2879	#elif DEPTH_PACKING == 3203
2880		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2881	#endif
2882}`,nR=`#define DISTANCE
2883varying vec3 vWorldPosition;
2884#include <common>
2885#include <batching_pars_vertex>
2886#include <uv_pars_vertex>
2887#include <displacementmap_pars_vertex>
2888#include <morphtarget_pars_vertex>
2889#include <skinning_pars_vertex>
2890#include <clipping_planes_pars_vertex>
2891void main() {
2892	#include <uv_vertex>
2893	#include <batching_vertex>
2894	#include <skinbase_vertex>
2895	#include <morphinstance_vertex>
2896	#ifdef USE_DISPLACEMENTMAP
2897		#include <beginnormal_vertex>
2898		#include <morphnormal_vertex>
2899		#include <skinnormal_vertex>
2900	#endif
2901	#include <begin_vertex>
2902	#include <morphtarget_vertex>
2903	#include <skinning_vertex>
2904	#include <displacementmap_vertex>
2905	#include <project_vertex>
2906	#include <worldpos_vertex>
2907	#include <clipping_planes_vertex>
2908	vWorldPosition = worldPosition.xyz;
2909}`,rR=`#define DISTANCE
2910uniform vec3 referencePosition;
2911uniform float nearDistance;
2912uniform float farDistance;
2913varying vec3 vWorldPosition;
2914#include <common>
2915#include <packing>
2916#include <uv_pars_fragment>
2917#include <map_pars_fragment>
2918#include <alphamap_pars_fragment>
2919#include <alphatest_pars_fragment>
2920#include <alphahash_pars_fragment>
2921#include <clipping_planes_pars_fragment>
2922void main () {
2923	vec4 diffuseColor = vec4( 1.0 );
2924	#include <clipping_planes_fragment>
2925	#include <map_fragment>
2926	#include <alphamap_fragment>
2927	#include <alphatest_fragment>
2928	#include <alphahash_fragment>
2929	float dist = length( vWorldPosition - referencePosition );
2930	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2931	dist = saturate( dist );
2932	gl_FragColor = packDepthToRGBA( dist );
2933}`,iR=`varying vec3 vWorldDirection;
2934#include <common>
2935void main() {
2936	vWorldDirection = transformDirection( position, modelMatrix );
2937	#include <begin_vertex>
2938	#include <project_vertex>
2939}`,sR=`uniform sampler2D tEquirect;
2940varying vec3 vWorldDirection;
2941#include <common>
2942void main() {
2943	vec3 direction = normalize( vWorldDirection );
2944	vec2 sampleUV = equirectUv( direction );
2945	gl_FragColor = texture2D( tEquirect, sampleUV );
2946	#include <tonemapping_fragment>
2947	#include <colorspace_fragment>
2948}`,aR=`uniform float scale;
2949attribute float lineDistance;
2950varying float vLineDistance;
2951#include <common>
2952#include <uv_pars_vertex>
2953#include <color_pars_vertex>
2954#include <fog_pars_vertex>
2955#include <morphtarget_pars_vertex>
2956#include <logdepthbuf_pars_vertex>
2957#include <clipping_planes_pars_vertex>
2958void main() {
2959	vLineDistance = scale * lineDistance;
2960	#include <uv_vertex>
2961	#include <color_vertex>
2962	#include <morphinstance_vertex>
2963	#include <morphcolor_vertex>
2964	#include <begin_vertex>
2965	#include <morphtarget_vertex>
2966	#include <project_vertex>
2967	#include <logdepthbuf_vertex>
2968	#include <clipping_planes_vertex>
2969	#include <fog_vertex>
2970}`,oR=`uniform vec3 diffuse;
2971uniform float opacity;
2972uniform float dashSize;
2973uniform float totalSize;
2974varying float vLineDistance;
2975#include <common>
2976#include <color_pars_fragment>
2977#include <uv_pars_fragment>
2978#include <map_pars_fragment>
2979#include <fog_pars_fragment>
2980#include <logdepthbuf_pars_fragment>
2981#include <clipping_planes_pars_fragment>
2982void main() {
2983	vec4 diffuseColor = vec4( diffuse, opacity );
2984	#include <clipping_planes_fragment>
2985	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2986		discard;
2987	}
2988	vec3 outgoingLight = vec3( 0.0 );
2989	#include <logdepthbuf_fragment>
2990	#include <map_fragment>
2991	#include <color_fragment>
2992	outgoingLight = diffuseColor.rgb;
2993	#include <opaque_fragment>
2994	#include <tonemapping_fragment>
2995	#include <colorspace_fragment>
2996	#include <fog_fragment>
2997	#include <premultiplied_alpha_fragment>
2998}`,lR=`#include <common>
2999#include <batching_pars_vertex>
3000#include <uv_pars_vertex>
3001#include <envmap_pars_vertex>
3002#include <color_pars_vertex>
3003#include <fog_pars_vertex>
3004#include <morphtarget_pars_vertex>
3005#include <skinning_pars_vertex>
3006#include <logdepthbuf_pars_vertex>
3007#include <clipping_planes_pars_vertex>
3008void main() {
3009	#include <uv_vertex>
3010	#include <color_vertex>
3011	#include <morphinstance_vertex>
3012	#include <morphcolor_vertex>
3013	#include <batching_vertex>
3014	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
3015		#include <beginnormal_vertex>
3016		#include <morphnormal_vertex>
3017		#include <skinbase_vertex>
3018		#include <skinnormal_vertex>
3019		#include <defaultnormal_vertex>
3020	#endif
3021	#include <begin_vertex>
3022	#include <morphtarget_vertex>
3023	#include <skinning_vertex>
3024	#include <project_vertex>
3025	#include <logdepthbuf_vertex>
3026	#include <clipping_planes_vertex>
3027	#include <worldpos_vertex>
3028	#include <envmap_vertex>
3029	#include <fog_vertex>
3030}`,cR=`uniform vec3 diffuse;
3031uniform float opacity;
3032#ifndef FLAT_SHADED
3033	varying vec3 vNormal;
3034#endif
3035#include <common>
3036#include <dithering_pars_fragment>
3037#include <color_pars_fragment>
3038#include <uv_pars_fragment>
3039#include <map_pars_fragment>
3040#include <alphamap_pars_fragment>
3041#include <alphatest_pars_fragment>
3042#include <alphahash_pars_fragment>
3043#include <aomap_pars_fragment>
3044#include <lightmap_pars_fragment>
3045#include <envmap_common_pars_fragment>
3046#include <envmap_pars_fragment>
3047#include <fog_pars_fragment>
3048#include <specularmap_pars_fragment>
3049#include <logdepthbuf_pars_fragment>
3050#include <clipping_planes_pars_fragment>
3051void main() {
3052	vec4 diffuseColor = vec4( diffuse, opacity );
3053	#include <clipping_planes_fragment>
3054	#include <logdepthbuf_fragment>
3055	#include <map_fragment>
3056	#include <color_fragment>
3057	#include <alphamap_fragment>
3058	#include <alphatest_fragment>
3059	#include <alphahash_fragment>
3060	#include <specularmap_fragment>
3061	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3062	#ifdef USE_LIGHTMAP
3063		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
3064		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
3065	#else
3066		reflectedLight.indirectDiffuse += vec3( 1.0 );
3067	#endif
3068	#include <aomap_fragment>
3069	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
3070	vec3 outgoingLight = reflectedLight.indirectDiffuse;
3071	#include <envmap_fragment>
3072	#include <opaque_fragment>
3073	#include <tonemapping_fragment>
3074	#include <colorspace_fragment>
3075	#include <fog_fragment>
3076	#include <premultiplied_alpha_fragment>
3077	#include <dithering_fragment>
3078}`,uR=`#define LAMBERT
3079varying vec3 vViewPosition;
3080#include <common>
3081#include <batching_pars_vertex>
3082#include <uv_pars_vertex>
3083#include <displacementmap_pars_vertex>
3084#include <envmap_pars_vertex>
3085#include <color_pars_vertex>
3086#include <fog_pars_vertex>
3087#include <normal_pars_vertex>
3088#include <morphtarget_pars_vertex>
3089#include <skinning_pars_vertex>
3090#include <shadowmap_pars_vertex>
3091#include <logdepthbuf_pars_vertex>
3092#include <clipping_planes_pars_vertex>
3093void main() {
3094	#include <uv_vertex>
3095	#include <color_vertex>
3096	#include <morphinstance_vertex>
3097	#include <morphcolor_vertex>
3098	#include <batching_vertex>
3099	#include <beginnormal_vertex>
3100	#include <morphnormal_vertex>
3101	#include <skinbase_vertex>
3102	#include <skinnormal_vertex>
3103	#include <defaultnormal_vertex>
3104	#include <normal_vertex>
3105	#include <begin_vertex>
3106	#include <morphtarget_vertex>
3107	#include <skinning_vertex>
3108	#include <displacementmap_vertex>
3109	#include <project_vertex>
3110	#include <logdepthbuf_vertex>
3111	#include <clipping_planes_vertex>
3112	vViewPosition = - mvPosition.xyz;
3113	#include <worldpos_vertex>
3114	#include <envmap_vertex>
3115	#include <shadowmap_vertex>
3116	#include <fog_vertex>
3117}`,dR=`#define LAMBERT
3118uniform vec3 diffuse;
3119uniform vec3 emissive;
3120uniform float opacity;
3121#include <common>
3122#include <packing>
3123#include <dithering_pars_fragment>
3124#include <color_pars_fragment>
3125#include <uv_pars_fragment>
3126#include <map_pars_fragment>
3127#include <alphamap_pars_fragment>
3128#include <alphatest_pars_fragment>
3129#include <alphahash_pars_fragment>
3130#include <aomap_pars_fragment>
3131#include <lightmap_pars_fragment>
3132#include <emissivemap_pars_fragment>
3133#include <envmap_common_pars_fragment>
3134#include <envmap_pars_fragment>
3135#include <fog_pars_fragment>
3136#include <bsdfs>
3137#include <lights_pars_begin>
3138#include <normal_pars_fragment>
3139#include <lights_lambert_pars_fragment>
3140#include <shadowmap_pars_fragment>
3141#include <bumpmap_pars_fragment>
3142#include <normalmap_pars_fragment>
3143#include <specularmap_pars_fragment>
3144#include <logdepthbuf_pars_fragment>
3145#include <clipping_planes_pars_fragment>
3146void main() {
3147	vec4 diffuseColor = vec4( diffuse, opacity );
3148	#include <clipping_planes_fragment>
3149	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3150	vec3 totalEmissiveRadiance = emissive;
3151	#include <logdepthbuf_fragment>
3152	#include <map_fragment>
3153	#include <color_fragment>
3154	#include <alphamap_fragment>
3155	#include <alphatest_fragment>
3156	#include <alphahash_fragment>
3157	#include <specularmap_fragment>
3158	#include <normal_fragment_begin>
3159	#include <normal_fragment_maps>
3160	#include <emissivemap_fragment>
3161	#include <lights_lambert_fragment>
3162	#include <lights_fragment_begin>
3163	#include <lights_fragment_maps>
3164	#include <lights_fragment_end>
3165	#include <aomap_fragment>
3166	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3167	#include <envmap_fragment>
3168	#include <opaque_fragment>
3169	#include <tonemapping_fragment>
3170	#include <colorspace_fragment>
3171	#include <fog_fragment>
3172	#include <premultiplied_alpha_fragment>
3173	#include <dithering_fragment>
3174}`,hR=`#define MATCAP
3175varying vec3 vViewPosition;
3176#include <common>
3177#include <batching_pars_vertex>
3178#include <uv_pars_vertex>
3179#include <color_pars_vertex>
3180#include <displacementmap_pars_vertex>
3181#include <fog_pars_vertex>
3182#include <normal_pars_vertex>
3183#include <morphtarget_pars_vertex>
3184#include <skinning_pars_vertex>
3185#include <logdepthbuf_pars_vertex>
3186#include <clipping_planes_pars_vertex>
3187void main() {
3188	#include <uv_vertex>
3189	#include <color_vertex>
3190	#include <morphinstance_vertex>
3191	#include <morphcolor_vertex>
3192	#include <batching_vertex>
3193	#include <beginnormal_vertex>
3194	#include <morphnormal_vertex>
3195	#include <skinbase_vertex>
3196	#include <skinnormal_vertex>
3197	#include <defaultnormal_vertex>
3198	#include <normal_vertex>
3199	#include <begin_vertex>
3200	#include <morphtarget_vertex>
3201	#include <skinning_vertex>
3202	#include <displacementmap_vertex>
3203	#include <project_vertex>
3204	#include <logdepthbuf_vertex>
3205	#include <clipping_planes_vertex>
3206	#include <fog_vertex>
3207	vViewPosition = - mvPosition.xyz;
3208}`,fR=`#define MATCAP
3209uniform vec3 diffuse;
3210uniform float opacity;
3211uniform sampler2D matcap;
3212varying vec3 vViewPosition;
3213#include <common>
3214#include <dithering_pars_fragment>
3215#include <color_pars_fragment>
3216#include <uv_pars_fragment>
3217#include <map_pars_fragment>
3218#include <alphamap_pars_fragment>
3219#include <alphatest_pars_fragment>
3220#include <alphahash_pars_fragment>
3221#include <fog_pars_fragment>
3222#include <normal_pars_fragment>
3223#include <bumpmap_pars_fragment>
3224#include
3224 <normalmap_pars_fragment>
3225#include <logdepthbuf_pars_fragment>
3226#include <clipping_planes_pars_fragment>
3227void main() {
3228	vec4 diffuseColor = vec4( diffuse, opacity );
3229	#include <clipping_planes_fragment>
3230	#include <logdepthbuf_fragment>
3231	#include <map_fragment>
3232	#include <color_fragment>
3233	#include <alphamap_fragment>
3234	#include <alphatest_fragment>
3235	#include <alphahash_fragment>
3236	#include <normal_fragment_begin>
3237	#include <normal_fragment_maps>
3238	vec3 viewDir = normalize( vViewPosition );
3239	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3240	vec3 y = cross( viewDir, x );
3241	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3242	#ifdef USE_MATCAP
3243		vec4 matcapColor = texture2D( matcap, uv );
3244	#else
3245		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3246	#endif
3247	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3248	#include <opaque_fragment>
3249	#include <tonemapping_fragment>
3250	#include <colorspace_fragment>
3251	#include <fog_fragment>
3252	#include <premultiplied_alpha_fragment>
3253	#include <dithering_fragment>
3254}`,pR=`#define NORMAL
3255#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3256	varying vec3 vViewPosition;
3257#endif
3258#include <common>
3259#include <batching_pars_vertex>
3260#include <uv_pars_vertex>
3261#include <displacementmap_pars_vertex>
3262#include <normal_pars_vertex>
3263#include <morphtarget_pars_vertex>
3264#include <skinning_pars_vertex>
3265#include <logdepthbuf_pars_vertex>
3266#include <clipping_planes_pars_vertex>
3267void main() {
3268	#include <uv_vertex>
3269	#include <batching_vertex>
3270	#include <beginnormal_vertex>
3271	#include <morphinstance_vertex>
3272	#include <morphnormal_vertex>
3273	#include <skinbase_vertex>
3274	#include <skinnormal_vertex>
3275	#include <defaultnormal_vertex>
3276	#include <normal_vertex>
3277	#include <begin_vertex>
3278	#include <morphtarget_vertex>
3279	#include <skinning_vertex>
3280	#include <displacementmap_vertex>
3281	#include <project_vertex>
3282	#include <logdepthbuf_vertex>
3283	#include <clipping_planes_vertex>
3284#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3285	vViewPosition = - mvPosition.xyz;
3286#endif
3287}`,mR=`#define NORMAL
3288uniform float opacity;
3289#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3290	varying vec3 vViewPosition;
3291#endif
3292#include <packing>
3293#include <uv_pars_fragment>
3294#include <normal_pars_fragment>
3295#include <bumpmap_pars_fragment>
3296#include <normalmap_pars_fragment>
3297#include <logdepthbuf_pars_fragment>
3298#include <clipping_planes_pars_fragment>
3299void main() {
3300	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3301	#include <clipping_planes_fragment>
3302	#include <logdepthbuf_fragment>
3303	#include <normal_fragment_begin>
3304	#include <normal_fragment_maps>
3305	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
3306	#ifdef OPAQUE
3307		gl_FragColor.a = 1.0;
3308	#endif
3309}`,gR=`#define PHONG
3310varying vec3 vViewPosition;
3311#include <common>
3312#include <batching_pars_vertex>
3313#include <uv_pars_vertex>
3314#include <displacementmap_pars_vertex>
3315#include <envmap_pars_vertex>
3316#include <color_pars_vertex>
3317#include <fog_pars_vertex>
3318#include <normal_pars_vertex>
3319#include <morphtarget_pars_vertex>
3320#include <skinning_pars_vertex>
3321#include <shadowmap_pars_vertex>
3322#include <logdepthbuf_pars_vertex>
3323#include <clipping_planes_pars_vertex>
3324void main() {
3325	#include <uv_vertex>
3326	#include <color_vertex>
3327	#include <morphcolor_vertex>
3328	#include <batching_vertex>
3329	#include <beginnormal_vertex>
3330	#include <morphinstance_vertex>
3331	#include <morphnormal_vertex>
3332	#include <skinbase_vertex>
3333	#include <skinnormal_vertex>
3334	#include <defaultnormal_vertex>
3335	#include <normal_vertex>
3336	#include <begin_vertex>
3337	#include <morphtarget_vertex>
3338	#include <skinning_vertex>
3339	#include <displacementmap_vertex>
3340	#include <project_vertex>
3341	#include <logdepthbuf_vertex>
3342	#include <clipping_planes_vertex>
3343	vViewPosition = - mvPosition.xyz;
3344	#include <worldpos_vertex>
3345	#include <envmap_vertex>
3346	#include <shadowmap_vertex>
3347	#include <fog_vertex>
3348}`,xR=`#define PHONG
3349uniform vec3 diffuse;
3350uniform vec3 emissive;
3351uniform vec3 specular;
3352uniform float shininess;
3353uniform float opacity;
3354#include <common>
3355#include <packing>
3356#include <dithering_pars_fragment>
3357#include <color_pars_fragment>
3358#include <uv_pars_fragment>
3359#include <map_pars_fragment>
3360#include <alphamap_pars_fragment>
3361#include <alphatest_pars_fragment>
3362#include <alphahash_pars_fragment>
3363#include <aomap_pars_fragment>
3364#include <lightmap_pars_fragment>
3365#include <emissivemap_pars_fragment>
3366#include <envmap_common_pars_fragment>
3367#include <envmap_pars_fragment>
3368#include <fog_pars_fragment>
3369#include <bsdfs>
3370#include <lights_pars_begin>
3371#include <normal_pars_fragment>
3372#include <lights_phong_pars_fragment>
3373#include <shadowmap_pars_fragment>
3374#include <bumpmap_pars_fragment>
3375#include <normalmap_pars_fragment>
3376#include <specularmap_pars_fragment>
3377#include <logdepthbuf_pars_fragment>
3378#include <clipping_planes_pars_fragment>
3379void main() {
3380	vec4 diffuseColor = vec4( diffuse, opacity );
3381	#include <clipping_planes_fragment>
3382	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3383	vec3 totalEmissiveRadiance = emissive;
3384	#include <logdepthbuf_fragment>
3385	#include <map_fragment>
3386	#include <color_fragment>
3387	#include <alphamap_fragment>
3388	#include <alphatest_fragment>
3389	#include <alphahash_fragment>
3390	#include <specularmap_fragment>
3391	#include <normal_fragment_begin>
3392	#include <normal_fragment_maps>
3393	#include <emissivemap_fragment>
3394	#include <lights_phong_fragment>
3395	#include <lights_fragment_begin>
3396	#include <lights_fragment_maps>
3397	#include <lights_fragment_end>
3398	#include <aomap_fragment>
3399	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3400	#include <envmap_fragment>
3401	#include <opaque_fragment>
3402	#include <tonemapping_fragment>
3403	#include <colorspace_fragment>
3404	#include <fog_fragment>
3405	#include <premultiplied_alpha_fragment>
3406	#include <dithering_fragment>
3407}`,vR=`#define STANDARD
3408varying vec3 vViewPosition;
3409#ifdef USE_TRANSMISSION
3410	varying vec3 vWorldPosition;
3411#endif
3412#include <common>
3413#include <batching_pars_vertex>
3414#include <uv_pars_vertex>
3415#include <displacementmap_pars_vertex>
3416#include <color_pars_vertex>
3417#include <fog_pars_vertex>
3418#include <normal_pars_vertex>
3419#include <morphtarget_pars_vertex>
3420#include <skinning_pars_vertex>
3421#include <shadowmap_pars_vertex>
3422#include <logdepthbuf_pars_vertex>
3423#include <clipping_planes_pars_vertex>
3424void main() {
3425	#include <uv_vertex>
3426	#include <color_vertex>
3427	#include <morphinstance_vertex>
3428	#include <morphcolor_vertex>
3429	#include <batching_vertex>
3430	#include <beginnormal_vertex>
3431	#include <morphnormal_vertex>
3432	#include <skinbase_vertex>
3433	#include <skinnormal_vertex>
3434	#include <defaultnormal_vertex>
3435	#include <normal_vertex>
3436	#include <begin_vertex>
3437	#include <morphtarget_vertex>
3438	#include <skinning_vertex>
3439	#include <displacementmap_vertex>
3440	#include <project_vertex>
3441	#include <logdepthbuf_vertex>
3442	#include <clipping_planes_vertex>
3443	vViewPosition = - mvPosition.xyz;
3444	#include <worldpos_vertex>
3445	#include <shadowmap_vertex>
3446	#include <fog_vertex>
3447#ifdef USE_TRANSMISSION
3448	vWorldPosition = worldPosition.xyz;
3449#endif
3450}`,_R=`#define STANDARD
3451#ifdef PHYSICAL
3452	#define IOR
3453	#define USE_SPECULAR
3454#endif
3455uniform vec3 diffuse;
3456uniform vec3 emissive;
3457uniform float roughness;
3458uniform float metalness;
3459uniform float opacity;
3460#ifdef IOR
3461	uniform float ior;
3462#endif
3463#ifdef USE_SPECULAR
3464	uniform float specularIntensity;
3465	uniform vec3 specularColor;
3466	#ifdef USE_SPECULAR_COLORMAP
3467		uniform sampler2D specularColorMap;
3468	#endif
3469	#ifdef USE_SPECULAR_INTENSITYMAP
3470		uniform sampler2D specularIntensityMap;
3471	#endif
3472#endif
3473#ifdef USE_CLEARCOAT
3474	uniform float clearcoat;
3475	uniform float clearcoatRoughness;
3476#endif
3477#ifdef USE_DISPERSION
3478	uniform float dispersion;
3479#endif
3480#ifdef USE_IRIDESCENCE
3481	uniform float iridescence;
3482	uniform float iridescenceIOR;
3483	uniform float iridescenceThicknessMinimum;
3484	uniform float iridescenceThicknessMaximum;
3485#endif
3486#ifdef USE_SHEEN
3487	uniform vec3 sheenColor;
3488	uniform float sheenRoughness;
3489	#ifdef USE_SHEEN_COLORMAP
3490		uniform sampler2D sheenColorMap;
3491	#endif
3492	#ifdef USE_SHEEN_ROUGHNESSMAP
3493		uniform sampler2D sheenRoughnessMap;
3494	#endif
3495#endif
3496#ifdef USE_ANISOTROPY
3497	uniform vec2 anisotropyVector;
3498	#ifdef USE_ANISOTROPYMAP
3499		uniform sampler2D anisotropyMap;
3500	#endif
3501#endif
3502varying vec3 vViewPosition;
3503#include <common>
3504#include <packing>
3505#include <dithering_pars_fragment>
3506#include <color_pars_fragment>
3507#include <uv_pars_fragment>
3508#include <map_pars_fragment>
3509#include <alphamap_pars_fragment>
3510#include <alphatest_pars_fragment>
3511#include <alphahash_pars_fragment>
3512#include <aomap_pars_fragment>
3513#include <lightmap_pars_fragment>
3514#include <emissivemap_pars_fragment>
3515#include <iridescence_fragment>
3516#include <cube_uv_reflection_fragment>
3517#include <envmap_common_pars_fragment>
3518#include <envmap_physical_pars_fragment>
3519#include <fog_pars_fragment>
3520#include <lights_pars_begin>
3521#include <normal_pars_fragment>
3522#include <lights_physical_pars_fragment>
3523#include <transmission_pars_fragment>
3524#include <shadowmap_pars_fragment>
3525#include <bumpmap_pars_fragment>
3526#include <normalmap_pars_fragment>
3527#include <clearcoat_pars_fragment>
3528#include <iridescence_pars_fragment>
3529#include <roughnessmap_pars_fragment>
3530#include <metalnessmap_pars_fragment>
3531#include <logdepthbuf_pars_fragment>
3532#include <clipping_planes_pars_fragment>
3533void main() {
3534	vec4 diffuseColor = vec4( diffuse, opacity );
3535	#include <clipping_planes_fragment>
3536	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3537	vec3 totalEmissiveRadiance = emissive;
3538	#include <logdepthbuf_fragment>
3539	#include <map_fragment>
3540	#include <color_fragment>
3541	#include <alphamap_fragment>
3542	#include <alphatest_fragment>
3543	#include <alphahash_fragment>
3544	#include <roughnessmap_fragment>
3545	#include <metalnessmap_fragment>
3546	#include <normal_fragment_begin>
3547	#include <normal_fragment_maps>
3548	#include <clearcoat_normal_fragment_begin>
3549	#include <clearcoat_normal_fragment_maps>
3550	#include <emissivemap_fragment>
3551	#include <lights_physical_fragment>
3552	#include <lights_fragment_begin>
3553	#include <lights_fragment_maps>
3554	#include <lights_fragment_end>
3555	#include <aomap_fragment>
3556	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3557	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3558	#include <transmission_fragment>
3559	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3560	#ifdef USE_SHEEN
3561		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
3562		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
3563	#endif
3564	#ifdef USE_CLEARCOAT
3565		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3566		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3567		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3568	#endif
3569	#include <opaque_fragment>
3570	#include <tonemapping_fragment>
3571	#include <colorspace_fragment>
3572	#include <fog_fragment>
3573	#include <premultiplied_alpha_fragment>
3574	#include <dithering_fragment>
3575}`,yR=`#define TOON
3576varying vec3 vViewPosition;
3577#include <common>
3578#include <batching_pars_vertex>
3579#include <uv_pars_vertex>
3580#include <displacementmap_pars_vertex>
3581#include <color_pars_vertex>
3582#include <fog_pars_vertex>
3583#include <normal_pars_vertex>
3584#include <morphtarget_pars_vertex>
3585#include <skinning_pars_vertex>
3586#include <shadowmap_pars_vertex>
3587#include <logdepthbuf_pars_vertex>
3588#include <clipping_planes_pars_vertex>
3589void main() {
3590	#include <uv_vertex>
3591	#include <color_vertex>
3592	#include <morphinstance_vertex>
3593	#include <morphcolor_vertex>
3594	#include <batching_vertex>
3595	#include <beginnormal_vertex>
3596	#include <morphnormal_vertex>
3597	#include <skinbase_vertex>
3598	#include <skinnormal_vertex>
3599	#include <defaultnormal_vertex>
3600	#include <normal_vertex>
3601	#include <begin_vertex>
3602	#include <morphtarget_vertex>
3603	#include <skinning_vertex>
3604	#include <displacementmap_vertex>
3605	#include <project_vertex>
3606	#include <logdepthbuf_vertex>
3607	#include <clipping_planes_vertex>
3608	vViewPosition = - mvPosition.xyz;
3609	#include <worldpos_vertex>
3610	#include <shadowmap_vertex>
3611	#include <fog_vertex>
3612}`,wR=`#define TOON
3613uniform vec3 diffuse;
3614uniform vec3 emissive;
3615uniform float opacity;
3616#include <common>
3617#include <packing>
3618#include <dithering_pars_fragment>
3619#include <color_pars_fragment>
3620#include <uv_pars_fragment>
3621#include <map_pars_fragment>
3622#include <alphamap_pars_fragment>
3623#include <alphatest_pars_fragment>
3624#include <alphahash_pars_fragment>
3625#include <aomap_pars_fragment>
3626#include <lightmap_pars_fragment>
3627#include <emissivemap_pars_fragment>
3628#include <gradientmap_pars_fragment>
3629#include <fog_pars_fragment>
3630#include <bsdfs>
3631#include <lights_pars_begin>
3632#include <normal_pars_fragment>
3633#include <lights_toon_pars_fragment>
3634#include <shadowmap_pars_fragment>
3635#include <bumpmap_pars_fragment>
3636#include <normalmap_pars_fragment>
3637#include <logdepthbuf_pars_fragment>
3638#include <clipping_planes_pars_fragment>
3639void main() {
3640	vec4 diffuseColor = vec4( diffuse, opacity );
3641	#include <clipping_planes_fragment>
3642	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3643	vec3 totalEmissiveRadiance = emissive;
3644	#include <logdepthbuf_fragment>
3645	#include <map_fragment>
3646	#include <color_fragment>
3647	#include <alphamap_fragment>
3648	#include <alphatest_fragment>
3649	#include <alphahash_fragment>
3650	#include <normal_fragment_begin>
3651	#include <normal_fragment_maps>
3652	#include <emissivemap_fragment>
3653	#include <lights_toon_fragment>
3654	#include <lights_fragment_begin>
3655	#include <lights_fragment_maps>
3656	#include <lights_fragment_end>
3657	#include <aomap_fragment>
3658	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3659	#include <opaque_fragment>
3660	#include <tonemapping_fragment>
3661	#include <colorspace_fragment>
3662	#include <fog_fragment>
3663	#include <premultiplied_alpha_fragment>
3664	#include <dithering_fragment>
3665}`,SR=`uniform float size;
3666uniform float scale;
3667#include <common>
3668#include <color_pars_vertex>
3669#include <fog_pars_vertex>
3670#include <morphtarget_pars_vertex>
3671#include <logdepthbuf_pars_vertex>
3672#include <clipping_planes_pars_vertex>
3673#ifdef USE_POINTS_UV
3674	varying vec2 vUv;
3675	uniform mat3 uvTransform;
3676#endif
3677void main() {
3678	#ifdef USE_POINTS_UV
3679		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3680	#endif
3681	#include <color_vertex>
3682	#include <morphinstance_vertex>
3683	#include <morphcolor_vertex>
3684	#include <begin_vertex>
3685	#include <morphtarget_vertex>
3686	#include <project_vertex>
3687	gl_PointSize = size;
3688	#ifdef USE_SIZEATTENUATION
3689		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3690		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3691	#endif
3692	#include <logdepthbuf_vertex>
3693	#include <clipping_planes_vertex>
3694	#include <worldpos_vertex>
3695	#include <fog_vertex>
3696}`,bR=`uniform vec3 diffuse;
3697uniform float opacity;
3698#include <common>
3699#include <color_pars_fragment>
3700#include <map_particle_pars_fragment>
3701#include <alphatest_pars_fragment>
3702#include <alphahash_pars_fragment>
3703#include <fog_pars_fragment>
3704#include <logdepthbuf_pars_fragment>
3705#include <clipping_planes_pars_fragment>
3706void main() {
3707	vec4 diffuseColor = vec4( diffuse, opacity );
3708	#include <clipping_planes_fragment>
3709	vec3 outgoingLight = vec3( 0.0 );
3710	#include <logdepthbuf_fragment>
3711	#include <map_particle_fragment>
3712	#include <color_fragment>
3713	#include <alphatest_fragment>
3714	#include <alphahash_fragment>
3715	outgoingLight = diffuseColor.rgb;
3716	#include <opaque_fragment>
3717	#include <tonemapping_fragment>
3718	#include <colorspace_fragment>
3719	#include <fog_fragment>
3720	#include <premultiplied_alpha_fragment>
3721}`,ER=`#include <common>
3722#include <batching_pars_vertex>
3723#include <fog_pars_vertex>
3724#include <morphtarget_pars_vertex>
3725#include <skinning_pars_vertex>
3726#include <logdepthbuf_pars_vertex>
3727#include <shadowmap_pars_vertex>
3728void main() {
3729	#include <batching_vertex>
3730	#include <beginnormal_vertex>
3731	#include <morphinstance_vertex>
3732	#include <morphnormal_vertex>
3733	#include <skinbase_vertex>
3734	#include <skinnormal_vertex>
3735	#include <defaultnormal_vertex>
3736	#include <begin_vertex>
3737	#include <morphtarget_vertex>
3738	#include <skinning_vertex>
3739	#include <project_vertex>
3740	#include <logdepthbuf_vertex>
3741	#include <worldpos_vertex>
3742	#include <shadowmap_vertex>
3743	#include <fog_vertex>
3744}`,MR=`uniform vec3 color;
3745uniform float opacity;
3746#include <common>
3747#include <packing>
3748#include <fog_pars_fragment>
3749#include <bsdfs>
3750#include <lights_pars_begin>
3751#include <logdepthbuf_pars_fragment>
3752#include <shadowmap_pars_fragment>
3753#include <shadowmask_pars_fragment>
3754void main() {
3755	#include <logdepthbuf_fragment>
3756	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3757	#include <tonemapping_fragment>
3758	#include <colorspace_fragment>
3759	#include <fog_fragment>
3760}`,TR=`uniform float rotation;
3761uniform vec2 center;
3762#include <common>
3763#include <uv_pars_vertex>
3764#include <fog_pars_vertex>
3765#include <logdepthbuf_pars_vertex>
3766#include <clipping_planes_pars_vertex>
3767void main() {
3768	#include <uv_vertex>
3769	vec4 mvPosition = modelViewMatrix[ 3 ];
3770	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3771	#ifndef USE_SIZEATTENUATION
3772		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3773		if ( isPerspective ) scale *= - mvPosition.z;
3774	#endif
3775	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3776	vec2 rotatedPosition;
3777	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3778	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3779	mvPosition.xy += rotatedPosition;
3780	gl_Position = projectionMatrix * mvPosition;
3781	#include <logdepthbuf_vertex>
3782	#include <clipping_planes_vertex>
3783	#include <fog_vertex>
3784}`,AR=`uniform vec3 diffuse;
3785uniform float opacity;
3786#include <common>
3787#include <uv_pars_fragment>
3788#include <map_pars_fragment>
3789#include <alphamap_pars_fragment>
3790#include <alphatest_pars_fragment>
3791#include <alphahash_pars_fragment>
3792#include <fog_pars_fragment>
3793#include <logdepthbuf_pars_fragment>
3794#include <clipping_planes_pars_fragment>
3795void main() {
3796	vec4 diffuseColor = vec4( diffuse, opacity );
3797	#include <clipping_planes_fragment>
3798	vec3 outgoingLight = vec3( 0.0 );
3799	#include <logdepthbuf_fragment>
3800	#include <map_fragment>
3801	#include <alphamap_fragment>
3802	#include <alphatest_fragment>
3803	#include <alphahash_fragment>
3804	outgoingLight = diffuseColor.rgb;
3805	#include <opaque_fragment>
3806	#include <tonemapping_fragment>
3807	#include <colorspace_fragment>
3808	#include <fog_fragment>
3809}`,$e={alphahash_fragment:KT,alphahash_pars_fragment:YT,alphamap_fragment:JT,alphamap_pars_fragment:ZT,alphatest_fragment:QT,alphatest_pars_fragment:e2,aomap_fragment:t2,aomap_pars_fragment:n2,batching_pars_vertex:r2,batching_vertex:i2,begin_vertex:s2,beginnormal_vertex:a2,bsdfs:o2,
vendor: 7,143 bytes, line 3809
3809iridescence_fragment:l2,bumpmap_pars_fragment:c2,clipping_planes_fragment:u2,clipping_planes_pars_fragment:d2,clipping_planes_pars_vertex:h2,clipping_planes_vertex:f2,color_fragment:p2,color_pars_fragment:m2,color_pars_vertex:g2,color_vertex:x2,common:v2,cube_uv_reflection_fragment:_2,defaultnormal_vertex:y2,displacementmap_pars_vertex:w2,displacementmap_vertex:S2,emissivemap_fragment:b2,emissivemap_pars_fragment:E2,colorspace_fragment:M2,colorspace_pars_fragment:T2,envmap_fragment:A2,envmap_common_pars_fragment:R2,envmap_pars_fragment:C2,envmap_pars_vertex:P2,envmap_physical_pars_fragment:V2,envmap_vertex:N2,fog_vertex:L2,fog_pars_vertex:I2,fog_fragment:D2,fog_pars_fragment:U2,gradientmap_pars_fragment:k2,lightmap_pars_fragment:O2,lights_lambert_fragment:F2,lights_lambert_pars_fragment:B2,lights_pars_begin:z2,lights_toon_fragment:j2,lights_toon_pars_fragment:H2,lights_phong_fragment:G2,lights_phong_pars_fragment:W2,lights_physical_fragment:$2,lights_physical_pars_fragment:X2,lights_fragment_begin:q2,lights_fragment_maps:K2,lights_fragment_end:Y2,logdepthbuf_fragment:J2,logdepthbuf_pars_fragment:Z2,logdepthbuf_pars_vertex:Q2,logdepthbuf_vertex:eA,map_fragment:tA,map_pars_fragment:nA,map_particle_fragment:rA,map_particle_pars_fragment:iA,metalnessmap_fragment:sA,metalnessmap_pars_fragment:aA,morphinstance_vertex:oA,morphcolor_vertex:lA,morphnormal_vertex:cA,morphtarget_pars_vertex:uA,morphtarget_vertex:dA,normal_fragment_begin:hA,normal_fragment_maps:fA,normal_pars_fragment:pA,normal_pars_vertex:mA,normal_vertex:gA,normalmap_pars_fragment:xA,clearcoat_normal_fragment_begin:vA,clearcoat_normal_fragment_maps:_A,clearcoat_pars_fragment:yA,iridescence_pars_fragment:wA,opaque_fragment:SA,packing:bA,premultiplied_alpha_fragment:EA,project_vertex:MA,dithering_fragment:TA,dithering_pars_fragment:AA,roughnessmap_fragment:RA,roughnessmap_pars_fragment:CA,shadowmap_pars_fragment:PA,shadowmap_pars_vertex:NA,shadowmap_vertex:LA,shadowmask_pars_fragment:IA,skinbase_vertex:DA,skinning_pars_vertex:UA,skinning_vertex:kA,skinnormal_vertex:OA,specularmap_fragment:FA,specularmap_pars_fragment:BA,tonemapping_fragment:zA,tonemapping_pars_fragment:VA,transmission_fragment:jA,transmission_pars_fragment:HA,uv_pars_fragment:GA,uv_pars_vertex:WA,uv_vertex:$A,worldpos_vertex:XA,background_vert:qA,background_frag:KA,backgroundCube_vert:YA,backgroundCube_frag:JA,cube_vert:ZA,cube_frag:QA,depth_vert:eR,depth_frag:tR,distanceRGBA_vert:nR,distanceRGBA_frag:rR,equirect_vert:iR,equirect_frag:sR,linedashed_vert:aR,linedashed_frag:oR,meshbasic_vert:lR,meshbasic_frag:cR,meshlambert_vert:uR,meshlambert_frag:dR,meshmatcap_vert:hR,meshmatcap_frag:fR,meshnormal_vert:pR,meshnormal_frag:mR,meshphong_vert:gR,meshphong_frag:xR,meshphysical_vert:vR,meshphysical_frag:_R,meshtoon_vert:yR,meshtoon_frag:wR,points_vert:SR,points_frag:bR,shadow_vert:ER,shadow_frag:MR,sprite_vert:TR,sprite_frag:AR},fe={common:{diffuse:{value:new rt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ge},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ge}},envmap:{envMap:{value:null},envMapRotation:{value:new Ge},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ge}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ge}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ge},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ge},normalScale:{value:new nt(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ge},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ge}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ge}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ge}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new rt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new rt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0},uvTransform:{value:new Ge}},sprite:{diffuse:{value:new rt(16777215)},opacity:{value:1},center:{value:new nt(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ge},alphaMap:{value:null},alphaMapTransform:{value:new Ge},alphaTest:{value:0}}},gr={basic:{uniforms:on([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.fog]),vertexShader:$e.meshbasic_vert,fragmentShader:$e.meshbasic_frag},lambert:{uniforms:on([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new rt(0)}}]),vertexShader:$e.meshlambert_vert,fragmentShader:$e.meshlambert_frag},phong:{uniforms:on([fe.common,fe.specularmap,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,fe.lights,{emissive:{value:new rt(0)},specular:{value:new rt(1118481)},shininess:{value:30}}]),vertexShader:$e.meshphong_vert,fragmentShader:$e.meshphong_frag},standard:{uniforms:on([fe.common,fe.envmap,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.roughnessmap,fe.metalnessmap,fe.fog,fe.lights,{emissive:{value:new rt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag},toon:{uniforms:on([fe.common,fe.aomap,fe.lightmap,fe.emissivemap,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.gradientmap,fe.fog,fe.lights,{emissive:{value:new rt(0)}}]),vertexShader:$e.meshtoon_vert,fragmentShader:$e.meshtoon_frag},matcap:{uniforms:on([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,fe.fog,{matc
vendor: 5,280 bytes, line 3809
3809ap:{value:null}}]),vertexShader:$e.meshmatcap_vert,fragmentShader:$e.meshmatcap_frag},points:{uniforms:on([fe.points,fe.fog]),vertexShader:$e.points_vert,fragmentShader:$e.points_frag},dashed:{uniforms:on([fe.common,fe.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:$e.linedashed_vert,fragmentShader:$e.linedashed_frag},depth:{uniforms:on([fe.common,fe.displacementmap]),vertexShader:$e.depth_vert,fragmentShader:$e.depth_frag},normal:{uniforms:on([fe.common,fe.bumpmap,fe.normalmap,fe.displacementmap,{opacity:{value:1}}]),vertexShader:$e.meshnormal_vert,fragmentShader:$e.meshnormal_frag},sprite:{uniforms:on([fe.sprite,fe.fog]),vertexShader:$e.sprite_vert,fragmentShader:$e.sprite_frag},background:{uniforms:{uvTransform:{value:new Ge},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:$e.background_vert,fragmentShader:$e.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ge}},vertexShader:$e.backgroundCube_vert,fragmentShader:$e.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:$e.cube_vert,fragmentShader:$e.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:$e.equirect_vert,fragmentShader:$e.equirect_frag},distanceRGBA:{uniforms:on([fe.common,fe.displacementmap,{referencePosition:{value:new $},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:$e.distanceRGBA_vert,fragmentShader:$e.distanceRGBA_frag},shadow:{uniforms:on([fe.lights,fe.fog,{color:{value:new rt(0)},opacity:{value:1}}]),vertexShader:$e.shadow_vert,fragmentShader:$e.shadow_frag}};gr.physical={uniforms:on([gr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ge},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ge},clearcoatNormalScale:{value:new nt(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ge},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ge},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ge},sheen:{value:0},sheenColor:{value:new rt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ge},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ge},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ge},transmissionSamplerSize:{value:new nt},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ge},attenuationDistance:{value:0},attenuationColor:{value:new rt(0)},specularColor:{value:new rt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ge},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ge},anisotropyVector:{value:new nt},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ge}}]),vertexShader:$e.meshphysical_vert,fragmentShader:$e.meshphysical_frag};const $l={r:0,b:0,g:0},Gi=new br,RR=new Nt;function CR(t,e,n,r,i,s,a){const o=new rt(0);let l=s===!0?0:1,c,u,d=null,f=0,p=null;function g(x){let w=x.isScene===!0?x.background:null;return w&&w.isTexture&&(w=(x.backgroundBlurriness>0?n:e).get(w)),w}function _(x){let w=!1;const A=g(x);A===null?h(o,l):A&&A.isColor&&(h(A,1),w=!0);const E=t.xr.getEnvironmentBlendMode();E==="additive"?r.buffers.color.setClear(0,0,0,1,a):E==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,a),(t.autoClear||w)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function m(x,w){const A=g(w);A&&(A.isCubeTexture||A.mapping===du)?(u===void 0&&(u=new Er(new nl(1,1,1),new Jr({name:"BackgroundCubeMaterial",uniforms:Sa(gr.backgroundCube.uniforms),vertexShader:gr.backgroundCube.vertexShader,fragmentShader:gr.backgroundCube.fragmentShader,side:wn,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(E,R,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),Gi.copy(w.backgroundRotation),Gi.x*=-1,Gi.y*=-1,Gi.z*=-1,A.isCubeTexture&&A.isRenderTargetTexture===!1&&(Gi.y*=-1,Gi.z*=-1),u.material.uniforms.envMap.value=A,u.material.uniforms.flipEnvMap.value=A.isCubeTexture&&A.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(RR.makeRotationFromEuler(Gi)),u.material.toneMapped=tt.getTransfer(A.colorSpace)!==ot,(d!==A||f!==A.version||p!==t.toneMapping)&&(u.material.needsUpdate=!0,d=A,f=A.version,p=t.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null)):A&&A.isTexture&&(c===void 0&&(c=new Er(new hu(2,2),new Jr({name:"Backgroun
3809dMaterial",uniforms:Sa(gr.background.uniforms),vertexShader:gr.background.vertexShader,fragmentShader:gr.background.fragmentShader,side:Ni,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=A,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.toneMapped=tt.getTransfer(A.colorSpace)!==ot,A.matrixAutoUpdate===!0&&A.updateMatrix(),c.material.uniforms.uvTransform.value.copy(A.matrix),(d!==A||f!==A.version||p!==t.toneMapping)&&(c.material.needsUpdate=!0,d=A,f=A.version,p=t.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function h(x,w){x.getRGB($l,cy(t)),r.buffers.color.setClear($l.r,$l.g,$l.b,w,a)}function v(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return o},setClearColor:function(x,w=1){o.set(x),l=w,h(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,h(o,l)},render:_,addToRenderList:m,dispose:v}}function PR(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=f(null);let s=i,a=!1;function o(b,N,U,B,X){let W=!1;const V=d(B,U,N);s!==V&&(s=V,c(s.object)),W=p(b,B,U,X),W&&g(b,B,U,X),X!==null&&e.update(X,t.ELEMENT_ARRAY_BUFFER),(W||a)&&(a=!1,w(b,N,U,B),X!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(X).buffer))}function l(){return t.createVertexArray()}function c(b){return t.bindVertexArray(b)}function u(b){return t.deleteVertexArray(b)}function d(b,N,U){const B=U.wireframe===!0;let X=r[b.id];X===void 0&&(X={},r[b.id]=X);let W=X[N.id];W===void 0&&(W={},X[N.id]=W);let V=W[B];return V===void 0&&(V=f(l()),W[B]=V),V}function f(b){const N=[],U=[],B=[];for(let X=0;X<n;X++)N[X]=0,U[X]=0,B[X]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:N,enabledAttributes:U,attributeDivisors:B,object:b,attributes:{},index:null}}function p(b,N,U,B){const X=s.attributes,W=N.attributes;let V=0;const Q=U.getAttributes();for(const D in Q)if(Q[D].location>=0){const Y=X[D];let de=W[D];if(de===void 0&&(D==="instanceMatrix"&&b.instanceMatrix&&(de=b.instanceMatrix),D==="instanceColor"&&b.instanceColor&&(de=b.instanceColor)),Y===void 0||Y.attribute!==de||de&&Y.data!==de.data)return!0;V++}return s.attributesNum!==V||s.index!==B}function g(b,N,U,B){const X={},W=N.attributes;let V=0;const Q=U.getAttributes();for(const D in Q)if(Q[D].location>=0){let Y=W[D];Y===void 0&&(D==="instanceMatrix"&&b.instanceMatrix&&(Y=b.instanceMatrix),D==="instanceColor"&&b.instanceColor&&(Y=b.instanceColor));const de={};de.attribute=Y,Y&&Y.data&&(de.data=Y.data),X[D]=de,V++}s.attributes=X,s.attributesNum=V,s.index=B}function _(){const b=s.newAttributes;for(let N=0,U=b.length;N<U;N++)b[N]=0}function m(b){h(b,0)}function h(b,N){const U=s.newAttributes,B=s.enabledAttributes,X=s.attributeDivisors;U[b]=1,B[b]===0&&(t.enableVertexAttribArray(b),B[b]=1),X[b]!==N&&(t.vertexAttribDivisor(b,N),X[b]=N)}function v(){const b=s.newAttributes,N=s.enabledAttributes;for(let U=0,B=N.length;U<B;U++)N[U]!==b[U]&&(t.disableVertexAttribArray(U),N[U]=0)}function x(b,N,U,B,X,W,V){V===!0?t.vertexAttribIPointer(b,N,U,X,W):t.vertexAttribPointer(b,N,U,B,X,W)}function w(b,N,U,B){_();const X=B.attributes,W=U.getAttributes(),V=N.defaultAttributeValues;for(const Q in W){const D=W[Q];if(D.location>=0){let q=X[Q];if(q===void 0&&(Q==="instanceMatrix"&&b.instanceMatrix&&(q=b.instanceMatrix),Q==="instanceColor"&&b.instanceColor&&(q=b.instanceColor)),q!==void 0){const Y=q.normalized,de=q.itemSize,Ee=e.get(q);if(Ee===void 0)continue;const se=Ee.buffer,ae=Ee.type,ye=Ee.bytesPerElement,H=ae===t.INT||ae===t.UNSIGNED_INT||q.gpuType===kp;if(q.isInterleavedBufferAttribute){const J=q.data,he=J.stride,Ne=q.offset;if(J.isInstancedInterleavedBuffer){for(let Me=0;Me<D.locationSize;Me++)h(D.location+Me,J.meshPerAttribute);b.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=J.meshPerAttribute*J.count)}else for(let Me=0;Me<D.locationSize;Me++)m(D.location+Me);t.bindBuffer(t.ARRAY_BUFFER,se);for(let Me=0;Me<D.locationSize;Me++)x(D.location+Me,de/D.locationSize,ae,Y,he*ye,(Ne+de/D.locationSize*Me)*ye,H)}else{if(q.isInstancedBufferAttribute){for(let J=0;J<D.locationSize;J++)h(D.location+J,q.meshPerAttribute);b.isInstancedMesh!==!0&&B._maxInstanceCount===void 0&&(B._maxInstanceCount=q.meshPerAttribute*q.count)}else for(let J=0;J<D.locationSize;J++)m(D.location+J);t.bindBuffer(t.ARRAY_BUFFER,se);for(let J=0;J<D.locationSize;
vendor: 1,492 bytes, line 3809
3809J++)x(D.location+J,de/D.locationSize,ae,Y,de*ye,de/D.locationSize*J*ye,H)}}else if(V!==void 0){const Y=V[Q];if(Y!==void 0)switch(Y.length){case 2:t.vertexAttrib2fv(D.location,Y);break;case 3:t.vertexAttrib3fv(D.location,Y);break;case 4:t.vertexAttrib4fv(D.location,Y);break;default:t.vertexAttrib1fv(D.location,Y)}}}}v()}function A(){P();for(const b in r){const N=r[b];for(const U in N){const B=N[U];for(const X in B)u(B[X].object),delete B[X];delete N[U]}delete r[b]}}function E(b){if(r[b.id]===void 0)return;const N=r[b.id];for(const U in N){const B=N[U];for(const X in B)u(B[X].object),delete B[X];delete N[U]}delete r[b.id]}function R(b){for(const N in r){const U=r[N];if(U[b.id]===void 0)continue;const B=U[b.id];for(const X in B)u(B[X].object),delete B[X];delete U[b.id]}}function P(){M(),a=!0,s!==i&&(s=i,c(s.object))}function M(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:P,resetDefaultState:M,dispose:A,releaseStatesOfGeometry:E,releaseStatesOfProgram:R,initAttributes:_,enableAttribute:m,disableUnusedAttributes:v}}function NR(t,e,n){let r;function i(c){r=c}function s(c,u){t.drawArrays(r,c,u),n.update(u,r,1)}function a(c,u,d){d!==0&&(t.drawArraysInstanced(r,c,u,d),n.update(u,r,d))}function o(c,u,d){if(d===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(r,c,0,u,0,d);let p=0;for(let g=0;g<d;g++)p+=u[g];n.update(p,r,1)}function l(c,u,d,f){if(d===0)return;const p=e.get("WEBGL_multi_draw");if(p===null)for(let g=0;g<c.length;g++)a(c[g],u[g],f[g]);
vendor: 13,875 bytes, lines 3809-3886
3809else{p.multiDrawArraysInstancedWEBGL(r,c,0,u,0,f,0,d);let g=0;for(let _=0;_<d;_++)g+=u[_]*f[_];n.update(g,r,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=l}function LR(t,e,n,r){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const R=e.get("EXT_texture_filter_anisotropic");i=t.getParameter(R.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(R){return!(R!==lr&&r.convert(R)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(R){const P=R===Ca&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(R!==Sr&&r.convert(R)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&R!==Vr&&!P)}function l(R){if(R==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";R="mediump"}return R==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const u=l(c);u!==c&&(He("WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const d=n.logarithmicDepthBuffer===!0,f=n.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),p=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),g=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),_=t.getParameter(t.MAX_TEXTURE_SIZE),m=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),h=t.getParameter(t.MAX_VERTEX_ATTRIBS),v=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),x=t.getParameter(t.MAX_VARYING_VECTORS),w=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),A=g>0,E=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:a,textureTypeReadable:o,precision:c,logarithmicDepthBuffer:d,reversedDepthBuffer:f,maxTextures:p,maxVertexTextures:g,maxTextureSize:_,maxCubemapSize:m,maxAttributes:h,maxVertexUniforms:v,maxVaryings:x,maxFragmentUniforms:w,vertexTextures:A,maxSamples:E}}function IR(t){const e=this;let n=null,r=0,i=!1,s=!1;const a=new Ki,o=new Ge,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,f){const p=d.length!==0||f||r!==0||i;return i=f,r=d.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,f){n=u(d,f,0)},this.setState=function(d,f,p){const g=d.clippingPlanes,_=d.clipIntersection,m=d.clipShadows,h=t.get(d);if(!i||g===null||g.length===0||s&&!m)s?u(null):c();else{const v=s?0:r,x=v*4;let w=h.clippingState||null;l.value=w,w=u(g,f,x,p);for(let A=0;A!==x;++A)w[A]=n[A];h.clippingState=w,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function u(d,f,p,g){const _=d!==null?d.length:0;let m=null;if(_!==0){if(m=l.value,g!==!0||m===null){const h=p+_*4,v=f.matrixWorldInverse;o.getNormalMatrix(v),(m===null||m.length<h)&&(m=new Float32Array(h));for(let x=0,w=p;x!==_;++x,w+=4)a.copy(d[x]).applyMatrix4(v,o),a.normal.toArray(m,w),m[w+3]=a.constant}l.value=m,l.needsUpdate=!0}return e.numPlanes=_,e.numIntersection=0,m}}function DR(t){let e=new WeakMap;function n(a,o){return o===Xh?a.mapping=_a:o===qh&&(a.mapping=ya),a}function r(a){if(a&&a.isTexture){const o=a.mapping;if(o===Xh||o===qh)if(e.has(a)){const l=e.get(a).texture;return n(l,a.mapping)}else{const l=a.image;if(l&&l.height>0){const c=new LT(l.height);return c.fromEquirectangularTexture(t,a),e.set(a,c),a.addEventListener("dispose",i),n(c.texture,a.mapping)}else return null}}return a}function i(a){const o=a.target;o.removeEventListener("dispose",i);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}const vi=4,vg=[.125,.215,.35,.446,.526,.582],es=20,UR=256,Xa=new my,_g=new rt;let Td=null,Ad=0,Rd=0,Cd=!1;const kR=new $;class yg{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,n=0,r=.1,i=100,s={}){const{size:a=256,position:o=kR}=s;Td=this._renderer.getRenderTarget(),Ad=this._renderer.getActiveCubeFace(),Rd=this._renderer.getActiveMipmapLevel(),Cd=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const l=this._allocateTargets();return l.depthBuffer=!0,this._sceneToCubeUV(e,r,i,l,o),n>0&&this._blur(l,0,0,n),this._applyPMREM(l),this._cleanup(l),l}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=bg(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Sg(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Td,Ad,Rd),this._renderer.xr.enabled=Cd,e.scissorTest=!1,Fs(e,0,0,e.width,e.height)}_fromTexture(e,n){e.mapping===_a||e.mapping===ya?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Td=this._renderer.getRenderTarget(),Ad=this._renderer.getActiveCubeFace(),Rd=this._renderer.getActiveMipmapLevel(),Cd=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=n||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),n=4*this._cubeSize,r={magFilter:Gn,minFilter:Gn,generateMipmaps:!1,type:Ca,format:lr,colorSpace:wa,depthBuffer:!1},i=wg(e,n,r);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==n){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=wg(e,n,r);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=OR(s)),this._blurMaterial=BR(s,e,n),this._ggxMaterial=FR(s,e,n)}return i}_compileMaterial(e){const n=new Er(new Tr,e);this._renderer.compile(n,Xa)}_sceneToCubeUV(e,n,r,i,s){const l=new jn(90,1,n,r),c=[1,-1,1,1,1,1],u=[1,1,1,-1,-1,-1],d=this._renderer,f=d.autoClear,p=d.toneMapping;d.getClearColor(_g),d.toneMapping=Ai,d.autoClear=!1,d.state.buffers.depth.getReversed()&&(d.setRenderTarget(i),d.clearDepth(),d.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new Er(new nl,new ay({name:"PMREM.Background",side:wn,depthWrite:!1,depthTest:!1})));const _=this._backgroundBox,m=_.material;let h=!1;const v=e.background;v?v.isColor&&(m.color.copy(v),e.background=null,h=!0):(m.color.copy(_g),h=!0);for(let x=0;x<6;x++){const w=x%3;w===0?(l.up.set(0,c[x],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x+u[x],s.y,s.z)):w===1?(l.up.set(0,0,c[x]),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y+u[x],s.z)):(l.up.set(0,c[x],0),l.position.set(s.x,s.y,s.z),l.lookAt(s.x,s.y,s.z+u[x]));const A=this._cubeSize;Fs(i,w*A,x>2?A:0,A,A),d.setRenderTarget(i),h&&d.render(_,l),d.render(e,l)}d.toneMapping=p,d.autoClear=f,e.background=v}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===_a||e.mapping===ya;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=bg()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Sg());const s=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;Fs(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(a,Xa)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);n.autoClear=r}_applyGGXFilter(e,n,r){const i=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[r];o.material=a;const l=a.uniforms,c=r/(this._lodMeshes.length-1),u=n/(this._lodMeshes.length-1),d=Math.sqrt(c*c-u*u),f=.05+c*.95,p=d*f,{_lodMax:g}=this,_=this._sizeLods[r],m=3*_*(r>g-vi?r-g+vi:0),h=4*(this._cubeSize-_);l.envMap.value=e.texture,l.roughness.value=p,l.mipInt.value=g-n,Fs(s,m,h,3*_,2*_),i.setRenderTarget(s),i.render(o,Xa),l.envMap.value=s.texture,l.roughness.value=0,l.mipInt.value=g-r,Fs(e,m,h,3*_,2*_),i.setRenderTarget(e),i.render(o,Xa)}_blur(e,n,r,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,n,r,i,"latitudinal",s),this._halfBlur(a,e,r,r,i,"longitudinal",s)}_halfBlur(e,n,r,i,s,a,o){const l=this._renderer,c=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&It("blur direction must be either latitudinal or longitudinal!");const u=3,d=this._lodMeshes[i];d.material=c;const f=c.uniforms,p=this._sizeLods[r]-1,g=isFinite(s)?Math.PI/(2*p):2*Math.PI/(2*es-1),_=s/g,m=isFinite(s)?1+Math.floor(u*_):es;m>es&&He(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${es}`);const h=[];let v=0;for(let R=0;R<es;++R){const P=R/_,M=Math.exp(-P*P/2);h.push(M),R===0?v+=M:R<m&&(v+=2*M)}for(let R=0;R<h.length;R++)h[R]=h[R]/v;f.envMap.value=e.texture,f.samples.value=m,f.weights.value=h,f.latitudinal.value=a==="latitudinal",o&&(f.poleAxis.value=o);const{_lodMax:x}=this;f.dTheta.value=g,f.mipInt.value=x-r;const w=this._sizeLods[i],A=3*w*(i>x-vi?i-x+vi:0),E=4*(this._cubeSize-w);Fs(n,A,E,3*w,2*w),l.setRenderTarget(n),l.render(d,Xa)}}function OR(t){const e=[],n=[],r=[];let i=t;const s=t-vi+1+vg.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let l=1/o;a>t-vi?l=vg[a-t+vi-1]:a===0&&(l=0),n.push(l);const c=1/(o-2),u=-c,d=1+c,f=[u,u,d,u,d,d,u,u,d,d,u,d],p=6,g=6,_=3,m=2,h=1,v=new Float32Array(_*g*p),x=new Float32Array(m*g*p),w=new Float32Array(h*g*p);for(let E=0;E<p;E++){const R=E%3*2/3-1,P=E>2?0:-1,M=[R,P,0,R+2/3,P,0,R+2/3,P+1,0,R,P,0,R+2/3,P+1,0,R,P+1,0];v.set(M,_*g*E),x.set(f,m*g*E);const b=[E,E,E,E,E,E];w.set(b,h*g*E)}const A=new Tr;A.setAttribute("position",new wr(v,_)),A.setAttribute("uv",new wr(x,m)),A.setAttribute("faceIndex",new wr(w,h)),r.push(new Er(A,null)),i>vi&&i--}return{lodMeshes:r,sizeLods:e,sigmas:n}}function wg(t,e,n){const r=new ps(t,e,n);return r.texture.mapping=du,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Fs(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function FR(t,e,n){return new Jr({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:UR,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:fu(),fragmentShader:`
3810
3811			precision highp float;
3812			precision highp int;
3813
3814			varying vec3 vOutputDirection;
3815
3816			uniform sampler2D envMap;
3817			uniform float roughness;
3818			uniform float mipInt;
3819
3820			#define ENVMAP_TYPE_CUBE_UV
3821			#include <cube_uv_reflection_fragment>
3822
3823			#define PI 3.14159265359
3824
3825			// Van der Corput radical inverse
3826			float radicalInverse_VdC(uint bits) {
3827				bits = (bits << 16u) | (bits >> 16u);
3828				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
3829				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
3830				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
3831				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
3832				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
3833			}
3834
3835			// Hammersley sequence
3836			vec2 hammersley(uint i, uint N) {
3837				return vec2(float(i) / float(N), radicalInverse_VdC(i));
3838			}
3839
3840			// GGX VNDF importance sampling (Eric Heitz 2018)
3841			// "Sampling the GGX Distribution of Visible Normals"
3842			// https://jcgt.org/published/0007/04/01/
3843			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
3844				float alpha = roughness * roughness;
3845
3846				// Section 3.2: Transform view direction to hemisphere configuration
3847				vec3 Vh = normalize(vec3(alpha * V.x, alpha * V.y, V.z));
3848
3849				// Section 4.1: Orthonormal basis
3850				float lensq = Vh.x * Vh.x + Vh.y * Vh.y;
3851				vec3 T1 = lensq > 0.0 ? vec3(-Vh.y, Vh.x, 0.0) / sqrt(lensq) : vec3(1.0, 0.0, 0.0);
3852				vec3 T2 = cross(Vh, T1);
3853
3854				// Section 4.2: Parameterization of projected area
3855				float r = sqrt(Xi.x);
3856				float phi = 2.0 * PI * Xi.y;
3857				float t1 = r * cos(phi);
3858				float t2 = r * sin(phi);
3859				float s = 0.5 * (1.0 + Vh.z);
3860				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
3861
3862				// Section 4.3: Reprojection onto hemisphere
3863				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * Vh;
3864
3865				// Section 3.4: Transform back to ellipsoid configuration
3866				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
3867			}
3868
3869			void main() {
3870				vec3 N = normalize(vOutputDirection);
3871				vec3 V = N; // Assume view direction equals normal for pre-filtering
3872
3873				vec3 prefilteredColor = vec3(0.0);
3874				float totalWeight = 0.0;
3875
3876				// For very low roughness, just sample the environment directly
3877				if (roughness < 0.001) {
3878					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
3879					return;
3880				}
3881
3882				// Tangent space basis for VNDF sampling
3883				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
3884				vec3 tangent = normalize(cross(up, N));
3885				vec3 bitangent = cross(N, tangent);
3886
3887				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
3888					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
3889
3890					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
3891					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
3892
3893					// Transform H back to world space
3894					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
3895					vec3 L = normalize(2.0 * dot(V, H) * H - V);
3896
3897					float NdotL = max(dot(N, L), 0.0);
3898
3899					if(NdotL > 0.0) {
3900						// Sample environment at fixed mip level
3901						// VNDF importance sampling handles the distribution filtering
3902						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
3903
3904						// Weight by NdotL for the split-sum approximation
3905						// VNDF PDF naturally accounts for the visible microfacet distribution
3906						prefilteredColor += sampleColor * NdotL;
3907						totalWeight += NdotL;
3908					}
3909				}
3910
3911				if (totalWeight > 0.0) {
3912					prefilteredColor = prefilteredColor / totalWeight;
3913				}
3914
3915				gl_FragColor = vec4(prefilteredColor, 1.0);
3916			}
3917		`,blending:Gr,depthTest:!1,depthWrite:!1})}function BR(t,e,n){const r=new Float32Array(es),i=new $(0,1,0);return new Jr({name:"SphericalGaussianBlur",defines:{n:es,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:fu(),fragmentShader:`
3918
3919			precision mediump float;
3920			precision mediump int;
3921
3922			varying vec3 vOutputDirection;
3923
3924			uniform sampler2D envMap;
3925			uniform int samples;
3926			uniform float weights[ n ];
3927			uniform bool latitudinal;
3928			uniform float dTheta;
3929			uniform float mipInt;
3930			uniform vec3 poleAxis;
3931
3932			#define ENVMAP_TYPE_CUBE_UV
3933			#include <cube_uv_reflection_fragment>
3934
3935			vec3 getSample( float theta, vec3 axis ) {
3936
3937				float cosTheta = cos( theta );
3938				// Rodrigues' axis-angle rotation
3939				vec3 sampleDirection = vOutputDirection * cosTheta
3940					+ cross( axis, vOutputDirection ) * sin( theta )
3941					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3942
3943				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3944
3945			}
3946
3947			void main() {
3948
3949				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3950
3951				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3952
3953					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3954
3955				}
3956
3957				axis = normalize( axis );
3958
3959				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3960				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3961
3962				for ( int i = 1; i < n; i++ ) {
3963
3964					if ( i >= samples ) {
3965
3966						break;
3967
3968					}
3969
3970					float theta = dTheta * float( i );
3971					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3972					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3973
3974				}
3975
3976			}
3977		`,blending:Gr,depthTest:!1,depthWrite:!1})}function Sg(){return new Jr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:fu(),fragmentShader:`
3978
3979			precision mediump float;
3980			precision mediump int;
3981
3982			varying vec3 vOutputDirection;
3983
3984			uniform sampler2D envMap;
3985
3986			#include <common>
3987
3988			void main() {
3989
3990				vec3 outputDirection = normalize( vOutputDirection );
3991				vec2 uv = equirectUv( outputDirection );
3992
3993				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3994
3995			}
3996		`,blending:Gr,depthTest:!1,depthWrite:!1})}function bg(){return new Jr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:fu(),fragmentShader:`
3997
3998			precision mediump float;
3999			precision mediump int;
4000
4001			uniform float flipEnvMap;
4002
4003			varying vec3 vOutputDirection;
4004
4005			uniform samplerCube envMap;
4006
4007			void main() {
4008
4009				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
4010
4011			}
4012		`,blending:Gr,depthTest:!1,depthWrite:!1})}function fu(){return`
4013
4014		precision mediump float;
4015		precision mediump int;
4016
4017		attribute float faceIndex;
4018
4019		varying vec3 vOutputDirection;
4020
4021		// RH coordinate system; PMREM face-indexing convention
4022		vec3 getDirection( vec2 uv, float face ) {
4023
4024			uv = 2.0 * uv - 1.0;
4025
4026			vec3 direction = vec3( uv, 1.0 );
4027
4028			if ( face == 0.0 ) {
4029
4030				direction = direction.zyx; // ( 1, v, u ) pos x
4031
4032			} else if ( face == 1.0 ) {
4033
4034				direction = direction.xzy;
4035				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
4036
4037			} else if ( face == 2.0 ) {
4038
4039				direction.x *= -1.0; // ( -u, v, 1 ) pos z
4040
4041			} else if ( face == 3.0 ) {
4042
4043				direction = direction.zyx;
4044				direction.xz *= -1.0; // ( -1, v, -u ) neg x
4045
4046			} else if ( face == 4.0 ) {
4047
4048				direction = direction.xzy;
4049				direction.xy *= -1.0; // ( -u, -1, v ) neg y
4050
4051			} else if ( face == 5.0 ) {
4052
4053				direction.z *= -1.0; // ( u, v, -1 ) neg z
4054
4055			}
4056
4057			return direction;
4058
4059		}
4060
4061		void main() {
4062
4063			vOutputDirection = getDirection( uv, faceIndex );
4064			gl_Position = vec4( position, 1.0 );
4065
4066		}
4067	`}function zR(t){let e=new WeakMap,n=null;function r(o){if(o&&o.isTexture){const l=o.mapping,c=l===Xh||l===qh,u=l===_a||l===ya;if(c||u){let d=e.get(o);const f=d!==void 0?d.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==f)return n===null&&(n=new yg(t)),d=c?n.fromEquirectangular(o,d):n.fromCubemap(o,d),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),d.texture;if(d!==void 0)return d.texture;{const p=o.image;return c&&p&&p.height>0||u&&p&&i(p)?(n===null&&(n=new yg(t)),d=c?n.fromEquirectangular(o):n.fromCubemap(o),d.texture.pmremVersion=o.pmremVersion,e.set(o,d),o.addEventListener("dispose",s),d.texture):null}}}return o}function i(o){let l=0;const c=6;for(let u=0;u<c;u++)o[u]!==void 0&&l++;return l===c}function s(o){const l=o.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function a(){e=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:a}}function VR(t){const e={};function n(r){if(e[r]!==void 0)return e[r];const i=t.getExtension(r);return e[r]=i,i}return{has:function(r){return n(r)!==null},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(r){const i=n(r);return i===null&&jo("WebGLRenderer: "+r+" extension not supported."),i}}}function jR(t,e,n,r){const i={},s=new WeakMap;function a(d){const f=d.target;f.index!==null&&e.remove(f.index);for(const g in f.attributes)e.remove(f.attributes[g]);f.removeEventListener("dispose",a),delete i[f.id];const p=s.get(f);p&&(e.remove(p),s.delete(f)),r.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,n.memory.geometries--}function o(d,f){return i[f.id]===!0||(f.addEventListener("dispose",a),i[f.id]=!0,n.memory.geometries++),f}function l(d){const f=d.attributes;for(const p in f)e.update(f[p],t.ARRAY_BUFFER)}function c(d){const f=[],p=d.index,g=d.attributes.position;let _=0;if(p!==null){const v=p.array;_=p.version;for(let x=0,w=v.length;x<w;x+=3){const A=v[x+0],E=v[x+1],R=v[x+2];f.push(A,E,E,R,R,A)}}else if(g!==void 0){const v=g.array;_=g.version;for(let x=0,w=v.length/3-1;x<w;x+=3){const A=x+0,E=x+1,R=x+2;f.push(A,E,E,R,R,A)}}else return;const m=new(ny(f)?ly:oy)(f,1);m.version=_;const h=s.get(d);h&&e.remove(h),s.set(d,m)}function u(d){const f=s.get(d);if(f){const p=d.index;p!==null&&f.version<p.version&&c(d)}else c(d);return s.get(d)}return{get:o,update:l,getWireframeAttribute:u}}function HR(t,e,n){let r;function i(f){r=f}let s,a;function o(f){s=f.type,a=f.bytesPerElement}function l(f,p){t.drawElements(r,p,s,f*a),n.update(p,r,1)}function c(f,p,g){g!==0&&(t.drawElementsInstanced(r,p,s,f*a,g),n.update(p,r,g))}function u(f,p,g){if(g===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(r,p,0,s,f,0,g);let m=0;for(let h=0;h<g;h++)m+=p[h];n.update(m,r,1)}function d(f,p,g,_){if(g===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let h=0;h<f.length;h++)c(f[h]/a,p[h],_[h]);
vendor: 5,342 bytes, line 4067
4067else{m.multiDrawElementsInstancedWEBGL(r,p,0,s,f,0,_,0,g);let h=0;for(let v=0;v<g;v++)h+=p[v]*_[v];n.update(h,r,1)}}this.setMode=i,this.setIndex=o,this.render=l,this.renderInstances=c,this.renderMultiDraw=u,this.renderMultiDrawInstances=d}function GR(t){const e={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function r(s,a,o){switch(n.calls++,a){case t.TRIANGLES:n.triangles+=o*(s/3);break;case t.LINES:n.lines+=o*(s/2);break;case t.LINE_STRIP:n.lines+=o*(s-1);break;case t.LINE_LOOP:n.lines+=o*s;break;case t.POINTS:n.points+=o*s;break;default:It("WebGLInfo: Unknown draw mode:",a);break}}function i(){n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:e,render:n,programs:null,autoReset:!0,reset:i,update:r}}function WR(t,e,n){const r=new WeakMap,i=new Pt;function s(a,o,l){const c=a.morphTargetInfluences,u=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,d=u!==void 0?u.length:0;let f=r.get(o);if(f===void 0||f.count!==d){let b=function(){P.dispose(),r.delete(o),o.removeEventListener("dispose",b)};var p=b;f!==void 0&&f.texture.dispose();const g=o.morphAttributes.position!==void 0,_=o.morphAttributes.normal!==void 0,m=o.morphAttributes.color!==void 0,h=o.morphAttributes.position||[],v=o.morphAttributes.normal||[],x=o.morphAttributes.color||[];let w=0;g===!0&&(w=1),_===!0&&(w=2),m===!0&&(w=3);let A=o.attributes.position.count*w,E=1;A>e.maxTextureSize&&(E=Math.ceil(A/e.maxTextureSize),A=e.maxTextureSize);const R=new Float32Array(A*E*4*d),P=new ry(R,A,E,d);P.type=Vr,P.needsUpdate=!0;const M=w*4;for(let N=0;N<d;N++){const U=h[N],B=v[N],X=x[N],W=A*E*4*N;for(let V=0;V<U.count;V++){const Q=V*M;g===!0&&(i.fromBufferAttribute(U,V),R[W+Q+0]=i.x,R[W+Q+1]=i.y,R[W+Q+2]=i.z,R[W+Q+3]=0),_===!0&&(i.fromBufferAttribute(B,V),R[W+Q+4]=i.x,R[W+Q+5]=i.y,R[W+Q+6]=i.z,R[W+Q+7]=0),m===!0&&(i.fromBufferAttribute(X,V),R[W+Q+8]=i.x,R[W+Q+9]=i.y,R[W+Q+10]=i.z,R[W+Q+11]=X.itemSize===4?i.w:1)}}f={count:d,texture:P,size:new nt(A,E)},r.set(o,f),o.addEventListener("dispose",b)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)l.getUniforms().setValue(t,"morphTexture",a.morphTexture,n);else{let g=0;for(let m=0;m<c.length;m++)g+=c[m];const _=o.morphTargetsRelative?1:1-g;l.getUniforms().setValue(t,"morphTargetBaseInfluence",_),l.getUniforms().setValue(t,"morphTargetInfluences",c)}l.getUniforms().setValue(t,"morphTargetsTexture",f.texture,n),l.getUniforms().setValue(t,"morphTargetsTextureSize",f.size)}return{update:s}}function $R(t,e,n,r){let i=new WeakMap;function s(l){const c=r.render.frame,u=l.geometry,d=e.get(l,u);if(i.get(d)!==c&&(e.update(d),i.set(d,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",o)===!1&&l.addEventListener("dispose",o),i.get(l)!==c&&(n.update(l.instanceMatrix,t.ARRAY_BUFFER),l.instanceColor!==null&&n.update(l.instanceColor,t.ARRAY_BUFFER),i.set(l,c))),l.isSkinnedMesh){const f=l.skeleton;i.get(f)!==c&&(f.update(),i.set(f,c))}return d}function a(){i=new WeakMap}function o(l){const c=l.target;c.removeEventListener("dispose",o),n.remove(c.instanceMatrix),c.instanceColor!==null&&n.remove(c.instanceColor)}return{update:s,dispose:a}}const xy=new un,Eg=new hy(1,1),vy=new ry,_y=new pT,yy=new dy,Mg=[],Tg=[],Ag=new Float32Array(16),Rg=new Float32Array(9),Cg=new Float32Array(4);function Na(t,e,n){const r=t[0];if(r<=0||r>0)return t;const i=e*n;let s=Mg[i];if(s===void 0&&(s=new Float32Array(i),Mg[i]=s),e!==0){r.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=n,t[a].toArray(s,o)}return s}function zt(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}function Vt(t,e){for(let n=0,r=e.length;n<r;n++)t[n]=e[n]}function pu(t,e){let n=Tg[e];n===void 0&&(n=new Int32Array(e),Tg[e]=n);for(let r=0;r!==e;++r)n[r]=t.allocateTextureUnit();return n}function XR(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function qR(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(zt(n,e))return;t.uniform2fv(this.addr,e),Vt(n,e)}}function KR(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(e.r!==void 0)(n[0]!==e.r||n[1]!==e.g||n[2]!==e.b)&&(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(zt(n,e))return;t.uniform3fv(this.addr,e),Vt(n,e)}}function YR(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(zt(n,e))return;t.uniform4fv(this.addr,e),Vt(n,e)}}function JR(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(zt(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),Vt(n,e)}else{if(zt(n,r))return;Cg.set(r),t.uniformMatrix2fv(this.addr,!1,Cg),Vt(n,r)}}function ZR(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(zt(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),Vt(n,e)}else{if(zt(n,r))return;Rg.set(r),t.uniformMatrix3fv(this.addr,!1,Rg),Vt(n,r)}}function QR(t,e){const n=this.cache,r=e.elements;if(r===void 0){if(zt(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),Vt(n,e)}else{if(zt(n,r))return;Ag.set(r),t.uniformMatrix4fv(this.addr,!1,Ag),Vt(n,r)}}function eC(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function tC(t,e){const n=this.cache;
vendor: 12,022 bytes, lines 4067-4102
4067if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(zt(n,e))return;t.uniform2iv(this.addr,e),Vt(n,e)}}function nC(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(zt(n,e))return;t.uniform3iv(this.addr,e),Vt(n,e)}}function rC(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(zt(n,e))return;t.uniform4iv(this.addr,e),Vt(n,e)}}function iC(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function sC(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y)&&(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(zt(n,e))return;t.uniform2uiv(this.addr,e),Vt(n,e)}}function aC(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z)&&(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(zt(n,e))return;t.uniform3uiv(this.addr,e),Vt(n,e)}}function oC(t,e){const n=this.cache;if(e.x!==void 0)(n[0]!==e.x||n[1]!==e.y||n[2]!==e.z||n[3]!==e.w)&&(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(zt(n,e))return;t.uniform4uiv(this.addr,e),Vt(n,e)}}function lC(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i);let s;this.type===t.SAMPLER_2D_SHADOW?(Eg.compareFunction=ty,s=Eg):s=xy,n.setTexture2D(e||s,i)}function cC(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture3D(e||_y,i)}function uC(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTextureCube(e||yy,i)}function dC(t,e,n){const r=this.cache,i=n.allocateTextureUnit();r[0]!==i&&(t.uniform1i(this.addr,i),r[0]=i),n.setTexture2DArray(e||vy,i)}function hC(t){switch(t){case 5126:return XR;case 35664:return qR;case 35665:return KR;case 35666:return YR;case 35674:return JR;case 35675:return ZR;case 35676:return QR;case 5124:case 35670:return eC;case 35667:case 35671:return tC;case 35668:case 35672:return nC;case 35669:case 35673:return rC;case 5125:return iC;case 36294:return sC;case 36295:return aC;case 36296:return oC;case 35678:case 36198:case 36298:case 36306:case 35682:return lC;case 35679:case 36299:case 36307:return cC;case 35680:case 36300:case 36308:case 36293:return uC;case 36289:case 36303:case 36311:case 36292:return dC}}function fC(t,e){t.uniform1fv(this.addr,e)}function pC(t,e){const n=Na(e,this.size,2);t.uniform2fv(this.addr,n)}function mC(t,e){const n=Na(e,this.size,3);t.uniform3fv(this.addr,n)}function gC(t,e){const n=Na(e,this.size,4);t.uniform4fv(this.addr,n)}function xC(t,e){const n=Na(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function vC(t,e){const n=Na(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function _C(t,e){const n=Na(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function yC(t,e){t.uniform1iv(this.addr,e)}function wC(t,e){t.uniform2iv(this.addr,e)}function SC(t,e){t.uniform3iv(this.addr,e)}function bC(t,e){t.uniform4iv(this.addr,e)}function EC(t,e){t.uniform1uiv(this.addr,e)}function MC(t,e){t.uniform2uiv(this.addr,e)}function TC(t,e){t.uniform3uiv(this.addr,e)}function AC(t,e){t.uniform4uiv(this.addr,e)}function RC(t,e,n){const r=this.cache,i=e.length,s=pu(n,i);zt(r,s)||(t.uniform1iv(this.addr,s),Vt(r,s));for(let a=0;a!==i;++a)n.setTexture2D(e[a]||xy,s[a])}function CC(t,e,n){const r=this.cache,i=e.length,s=pu(n,i);zt(r,s)||(t.uniform1iv(this.addr,s),Vt(r,s));for(let a=0;a!==i;++a)n.setTexture3D(e[a]||_y,s[a])}function PC(t,e,n){const r=this.cache,i=e.length,s=pu(n,i);zt(r,s)||(t.uniform1iv(this.addr,s),Vt(r,s));for(let a=0;a!==i;++a)n.setTextureCube(e[a]||yy,s[a])}function NC(t,e,n){const r=this.cache,i=e.length,s=pu(n,i);zt(r,s)||(t.uniform1iv(this.addr,s),Vt(r,s));for(let a=0;a!==i;++a)n.setTexture2DArray(e[a]||vy,s[a])}function LC(t){switch(t){case 5126:return fC;case 35664:return pC;case 35665:return mC;case 35666:return gC;case 35674:return xC;case 35675:return vC;case 35676:return _C;case 5124:case 35670:return yC;case 35667:case 35671:return wC;case 35668:case 35672:return SC;case 35669:case 35673:return bC;case 5125:return EC;case 36294:return MC;case 36295:return TC;case 36296:return AC;case 35678:case 36198:case 36298:case 36306:case 35682:return RC;case 35679:case 36299:case 36307:return CC;case 35680:case 36300:case 36308:case 36293:return PC;case 36289:case 36303:case 36311:case 36292:return NC}}class IC{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.setValue=hC(n.type)}}class DC{constructor(e,n,r){this.id=e,this.addr=r,this.cache=[],this.type=n.type,this.size=n.size,this.setValue=LC(n.type)}}class UC{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,n,r){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,n[o.id],r)}}}const Pd=/(\w+)(\])?(\[|\.)?/g;function Pg(t,e){t.seq.push(e),t.map[e.id]=e}function kC(t,e,n){const r=t.name,i=r.length;for(Pd.lastIndex=0;;){const s=Pd.exec(r),a=Pd.lastIndex;let o=s[1];const l=s[2]==="]",c=s[3];if(l&&(o=o|0),c===void 0||c==="["&&a+2===i){Pg(n,c===void 0?new IC(o,t,e):new DC(o,t,e));break}else{let d=n.map[o];d===void 0&&(d=new UC(o),Pg(n,d)),n=d}}}class hc{constructor(e,n){this.seq=[],this.map={};const r=e.getProgramParameter(n,e.ACTIVE_UNIFORMS);for(let i=0;i<r;++i){const s=e.getActiveUniform(n,i),a=e.getUniformLocation(n,s.name);kC(s,a,this)}}setValue(e,n,r,i){const s=this.map[n];s!==void 0&&s.setValue(e,r,i)}setOptional(e,n,r){const i=n[r];i!==void 0&&this.setValue(e,r,i)}static upload(e,n,r,i){for(let s=0,a=n.length;s!==a;++s){const o=n[s],l=r[o.id];l.needsUpdate!==!1&&o.setValue(e,l.value,i)}}static seqWithValue(e,n){const r=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in n&&r.push(a)}return r}}function Ng(t,e,n){const r=t.createShader(e);return t.shaderSource(r,n),t.compileShader(r),r}const OC=37297;let FC=0;function BC(t,e){const n=t.split(`
4068`),r=[],i=Math.max(e-6,0),s=Math.min(e+6,n.length);for(let a=i;a<s;a++){const o=a+1;r.push(`${o===e?">":" "} ${o}: ${n[a]}`)}return r.join(`
4069`)}const Lg=new Ge;function zC(t){tt._getMatrix(Lg,tt.workingColorSpace,t);const e=`mat3( ${Lg.elements.map(n=>n.toFixed(4))} )`;switch(tt.getTransfer(t)){case Vc:return[e,"LinearTransferOETF"];case ot:return[e,"sRGBTransferOETF"];default:return He("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}function Ig(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),s=(t.getShaderInfoLog(e)||"").trim();if(r&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return n.toUpperCase()+`
4070
4071`+s+`
4072
4073`+BC(t.getShaderSource(e),o)}else return s}function VC(t,e){const n=zC(e);return[`vec4 ${t}( vec4 value ) {`,`	return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join(`
4074`)}function jC(t,e){let n;switch(e){case j3:n="Linear";break;case H3:n="Reinhard";break;case G3:n="Cineon";break;case W3:n="ACESFilmic";break;case X3:n="AgX";break;case q3:n="Neutral";break;case $3:n="Custom";break;default:He("WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Xl=new $;function HC(){tt.getLuminanceCoefficients(Xl);const t=Xl.x.toFixed(4),e=Xl.y.toFixed(4),n=Xl.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${t}, ${e}, ${n} );`,"	return dot( weights, rgb );","}"].join(`
4075`)}function GC(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(eo).join(`
4076`)}function WC(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(`
4077`)}function $C(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){const s=t.getActiveAttrib(e,i),a=s.name;let o=1;s.type===t.FLOAT_MAT2&&(o=2),s.type===t.FLOAT_MAT3&&(o=3),s.type===t.FLOAT_MAT4&&(o=4),n[a]={type:s.type,location:t.getAttribLocation(e,a),locationSize:o}}return n}function eo(t){return t!==""}function Dg(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Ug(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const XC=/^[ \t]*#include +<([\w\d./]+)>/gm;function Af(t){return t.replace(XC,KC)}const qC=new Map;function KC(t,e){let n=$e[e];if(n===void 0){const r=qC.get(e);if(r!==void 0)n=$e[r],He('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return Af(n)}const YC=/#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 kg(t){return t.replace(YC,JC)}function JC(t,e,n,r){let i="";for(let s=parseInt(e);s<parseInt(n);s++)i+=r.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function Og(t){let e=`precision ${t.precision} float;
4078	precision ${t.precision} int;
4079	precision ${t.precision} sampler2D;
4080	precision ${t.precision} samplerCube;
4081	precision ${t.precision} sampler3D;
4082	precision ${t.precision} sampler2DArray;
4083	precision ${t.precision} sampler2DShadow;
4084	precision ${t.precision} samplerCubeShadow;
4085	precision ${t.precision} sampler2DArrayShadow;
4086	precision ${t.precision} isampler2D;
4087	precision ${t.precision} isampler3D;
4088	precision ${t.precision} isamplerCube;
4089	precision ${t.precision} isampler2DArray;
4090	precision ${t.precision} usampler2D;
4091	precision ${t.precision} usampler3D;
4092	precision ${t.precision} usamplerCube;
4093	precision ${t.precision} usampler2DArray;
4094	`;return t.precision==="highp"?e+=`
4095#define HIGH_PRECISION`:t.precision==="mediump"?e+=`
4096#define MEDIUM_PRECISION`:t.precision==="lowp"&&(e+=`
4097#define LOW_PRECISION`),e}function ZC(t){let e="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===G_?e="SHADOWMAP_TYPE_PCF":t.shadowMapType===w3?e="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===Ir&&(e="SHADOWMAP_TYPE_VSM"),e}function QC(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case _a:case ya:e="ENVMAP_TYPE_CUBE";break;case du:e="ENVMAP_TYPE_CUBE_UV";break}return e}function eP(t){let e="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case ya:e="ENVMAP_MODE_REFRACTION";break}return e}function tP(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case W_:e="ENVMAP_BLENDING_MULTIPLY";break;case z3:e="ENVMAP_BLENDING_MIX";break;case V3:e="ENVMAP_BLENDING_ADD";break}return e}function nP(t){const e=t.envMapCubeUVHeight;if(e===null)return null;const n=Math.log2(e)-2,r=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),7*16)),texelHeight:r,maxMip:n}}function rP(t,e,n,r){const i=t.getContext(),s=n.defines;let a=n.vertexShader,o=n.fragmentShader;const l=ZC(n),c=QC(n),u=eP(n),d=tP(n),f=nP(n),p=GC(n),g=WC(s),_=i.createProgram();let m,h,v=n.glslVersion?"#version "+n.glslVersion+`
4098`:"";n.isRawShaderMaterial?(m=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(eo).join(`
4099`),m.length>0&&(m+=`
4100`),h=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g].filter(eo).join(`
4101`),h.length>0&&(h+=`
4102`)):(m=[Og(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,n.extensionCl
vendor: 5,445 bytes, lines 4102-4104
4102ipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
4103`].filter(eo).join(`
4104`),h=[Og(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,g,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alph
vendor: 4,229 bytes, lines 4104-4111
4104aToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+u:"",n.envMap?"#define "+d:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Ai?"#define TONE_MAPPING":"",n.toneMapping!==Ai?$e.tonemapping_pars_fragment:"",n.toneMapping!==Ai?jC("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",$e.colorspace_pars_fragment,VC("linearToOutputTexel",n.outputColorSpace),HC(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",`
4105`].filter(eo).join(`
4106`)),a=Af(a),a=Dg(a,n),a=Ug(a,n),o=Af(o),o=Dg(o,n),o=Ug(o,n),a=kg(a),o=kg(o),n.isRawShaderMaterial!==!0&&(v=`#version 300 es
4107`,m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4108`)+`
4109`+m,h=["#define varying in",n.glslVersion===Y0?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===Y0?"":"#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(`
4110`)+`
4111`+h);const x=v+m+a,w=v+h+o,A=Ng(i,i.VERTEX_SHADER,x),E=Ng(i,i.FRAGMENT_SHADER,w);i.attachShader(_,A),i.attachShader(_,E),n.index0AttributeName!==void 0?i.bindAttribLocation(_,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_);
vendor: 4,461 bytes, lines 4111-4118
4111function R(N){if(t.debug.checkShaderErrors){const U=i.getProgramInfoLog(_)||"",B=i.getShaderInfoLog(A)||"",X=i.getShaderInfoLog(E)||"",W=U.trim(),V=B.trim(),Q=X.trim();let D=!0,q=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(D=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,_,A,E);else{const Y=Ig(i,A,"vertex"),de=Ig(i,E,"fragment");It("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+`
4112
4113Material Name: `+N.name+`
4114Material Type: `+N.type+`
4115
4116Program Info Log: `+W+`
4117`+Y+`
4118`+de)}else W!==""?He("WebGLProgram: Program Info Log:",W):(V===""||Q==="")&&(q=!1);q&&(N.diagnostics={runnable:D,programLog:W,vertexShader:{log:V,prefix:m},fragmentShader:{log:Q,prefix:h}})}i.deleteShader(A),i.deleteShader(E),P=new hc(i,_),M=$C(i,_)}let P;this.getUniforms=function(){return P===void 0&&R(this),P};let M;this.getAttributes=function(){return M===void 0&&R(this),M};let b=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return b===!1&&(b=i.getProgramParameter(_,OC)),b},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=FC++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=A,this.fragmentShader=E,this}let iP=0;class sP{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),s=this._getShaderStage(r),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const r of n)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 n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new aP(e),n.set(e,r)),r}}class aP{constructor(e){this.id=iP++,this.code=e,this.usedTimes=0}}function oP(t,e,n,r,i,s,a){const o=new iy,l=new sP,c=new Set,u=[],d=i.logarithmicDepthBuffer,f=i.vertexTextures;let p=i.precision;const g={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 _(M){return c.add(M),M===0?"uv":`uv${M}`}function m(M,b,N,U,B){const X=U.fog,W=B.geometry,V=M.isMeshStandardMaterial?U.environment:null,Q=(M.isMeshStandardMaterial?n:e).get(M.envMap||V),D=Q&&Q.mapping===du?Q.image.height:null,q=g[M.type];M.precision!==null&&(p=i.getMaxPrecision(M.precision),p!==M.precision&&He("WebGLProgram.getParameters:",M.precision,"not supported, using",p,"instead."));const Y=W.morphAttributes.position||W.morphAttributes.normal||W.morphAttributes.color,de=Y!==void 0?Y.length:0;let Ee=0;W.morphAttributes.position!==void 0&&(Ee=1),W.morphAttributes.normal!==void 0&&(Ee=2),W.morphAttributes.color!==void 0&&(Ee=3);let se,ae,ye,H;if(q){const st=gr[q];se=st.vertexShader,ae=st.fragmentShader}else se=M.vertexShader,ae=M.fragmentShader,l.update(M),ye=l.getVertexShaderID(M),H=l.getFragmentShaderID(M);const J=t.getRenderTarget(),he=t.state.buffers.depth.getReversed(),Ne=B.isInstancedMesh===!0,Me=B.isBatchedMesh===!0,We=!!M.map,$t=!!M.matcap,Xe=!!Q,gt=!!M.aoMap,L=!!M.lightMap,Ke=!!M.bumpMap,Ye=!!M.normalMap,ut=!!M.displacementMap,be=!!M.emissiveMap,_t=!!M.metalnessMap,Pe=!!M.roughnessMap,je=M.anisotropy>0,C=M.clearcoat>0,S=M.dispersion>0,z=M.iridescence>0,Z=M.sheen>0,te=M.transmission>0,K=je&&!!M.anisotropyMap,Re=C&&!!M.clearcoatMap,pe=C&&!!M.clearcoatNormalMap,Le=C&&!!M.clearcoatRoughnessMap,Ae=z&&!!M.iridescenceMap,ne=z&&!!M.iridescenceThicknessMap,le=Z&&!!M.sheenColorMap,Fe=Z&&!!M.sheenRoughnessMap,De=!!M.specularMap,xe=!!M.specularColorMap,ze=!!M.specularIntensityMap,I=te&&!!M.transmissionMap,me=te&&!!M.thicknessMap,ce=!!M.gradientMap,ue=!!M.alphaMap,ie=M.alph
vendor: 17,911 bytes, lines 4118-4146
4118aTest>0,ee=!!M.alphaHash,we=!!M.extensions;let Ve=Ai;M.toneMapped&&(J===null||J.isXRRenderTarget===!0)&&(Ve=t.toneMapping);const ft={shaderID:q,shaderType:M.type,shaderName:M.name,vertexShader:se,fragmentShader:ae,defines:M.defines,customVertexShaderID:ye,customFragmentShaderID:H,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:p,batching:Me,batchingColor:Me&&B._colorsTexture!==null,instancing:Ne,instancingColor:Ne&&B.instanceColor!==null,instancingMorph:Ne&&B.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:J===null?t.outputColorSpace:J.isXRRenderTarget===!0?J.texture.colorSpace:wa,alphaToCoverage:!!M.alphaToCoverage,map:We,matcap:$t,envMap:Xe,envMapMode:Xe&&Q.mapping,envMapCubeUVHeight:D,aoMap:gt,lightMap:L,bumpMap:Ke,normalMap:Ye,displacementMap:f&&ut,emissiveMap:be,normalMapObjectSpace:Ye&&M.normalMapType===Z3,normalMapTangentSpace:Ye&&M.normalMapType===ey,metalnessMap:_t,roughnessMap:Pe,anisotropy:je,anisotropyMap:K,clearcoat:C,clearcoatMap:Re,clearcoatNormalMap:pe,clearcoatRoughnessMap:Le,dispersion:S,iridescence:z,iridescenceMap:Ae,iridescenceThicknessMap:ne,sheen:Z,sheenColorMap:le,sheenRoughnessMap:Fe,specularMap:De,specularColorMap:xe,specularIntensityMap:ze,transmission:te,transmissionMap:I,thicknessMap:me,gradientMap:ce,opaque:M.transparent===!1&&M.blending===ca&&M.alphaToCoverage===!1,alphaMap:ue,alphaTest:ie,alphaHash:ee,combine:M.combine,mapUv:We&&_(M.map.channel),aoMapUv:gt&&_(M.aoMap.channel),lightMapUv:L&&_(M.lightMap.channel),bumpMapUv:Ke&&_(M.bumpMap.channel),normalMapUv:Ye&&_(M.normalMap.channel),displacementMapUv:ut&&_(M.displacementMap.channel),emissiveMapUv:be&&_(M.emissiveMap.channel),metalnessMapUv:_t&&_(M.metalnessMap.channel),roughnessMapUv:Pe&&_(M.roughnessMap.channel),anisotropyMapUv:K&&_(M.anisotropyMap.channel),clearcoatMapUv:Re&&_(M.clearcoatMap.channel),clearcoatNormalMapUv:pe&&_(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Le&&_(M.clearcoatRoughnessMap.channel),iridescenceMapUv:Ae&&_(M.iridescenceMap.channel),iridescenceThicknessMapUv:ne&&_(M.iridescenceThicknessMap.channel),sheenColorMapUv:le&&_(M.sheenColorMap.channel),sheenRoughnessMapUv:Fe&&_(M.sheenRoughnessMap.channel),specularMapUv:De&&_(M.specularMap.channel),specularColorMapUv:xe&&_(M.specularColorMap.channel),specularIntensityMapUv:ze&&_(M.specularIntensityMap.channel),transmissionMapUv:I&&_(M.transmissionMap.channel),thicknessMapUv:me&&_(M.thicknessMap.channel),alphaMapUv:ue&&_(M.alphaMap.channel),vertexTangents:!!W.attributes.tangent&&(Ye||je),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!W.attributes.color&&W.attributes.color.itemSize===4,pointsUvs:B.isPoints===!0&&!!W.attributes.uv&&(We||ue),fog:!!X,useFog:M.fog===!0,fogExp2:!!X&&X.isFogExp2,flatShading:M.flatShading===!0&&M.wireframe===!1,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:d,reversedDepthBuffer:he,skinning:B.isSkinnedMesh===!0,morphTargets:W.morphAttributes.position!==void 0,morphNormals:W.morphAttributes.normal!==void 0,morphColors:W.morphAttributes.color!==void 0,morphTargetsCount:de,morphTextureStride:Ee,numDirLights:b.directional.length,numPointLights:b.point.length,numSpotLights:b.spot.length,numSpotLightMaps:b.spotLightMap.length,numRectAreaLights:b.rectArea.length,numHemiLights:b.hemi.length,numDirLightShadows:b.directionalShadowMap.length,numPointLightShadows:b.pointShadowMap.length,numSpotLightShadows:b.spotShadowMap.length,numSpotLightShadowsWithMaps:b.numSpotLightShadowsWithMaps,numLightProbes:b.numLightProbes,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:M.dithering,shadowMapEnabled:t.shadowMap.enabled&&N.length>0,shadowMapType:t.shadowMap.type,toneMapping:Ve,decodeVideoTexture:We&&M.map.isVideoTexture===!0&&tt.getTransfer(M.map.colorSpace)===ot,decodeVideoTextureEmissive:be&&M.emissiveMap.isVideoTexture===!0&&tt.getTransfer(M.emissiveMap.colorSpace)===ot,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===Or,flipSided:M.side===wn,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:we&&M.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(we&&M.extensions.multiDraw===!0||Me)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return ft.vertexUv1s=c.has(1),ft.vertexUv2s=c.has(2),ft.vertexUv3s=c.has(3),c.clear(),ft}function h(M){const b=[];if(M.shaderID?b.push(M.shaderID):(b.push(M.customVertexShaderID),b.push(M.customFragmentShaderID)),M.defines!==void 0)for(const N in M.defines)b.push(N),b.push(M.defines[N]);return M.isRawShaderMaterial===!1&&(v(b,M),x(b,M),b.push(t.outputColorSpace)),b.push(M.customProgramCacheKey),b.join()}function v(M,b){M.push(b.precision),M.push(b.outputColorSpace),M.push(b.envMapMode),M.push(b.envMapCubeUVHeight),M.push(b.mapUv),M.push(b.alphaMapUv),M.push(b.lightMapUv),M.push(b.aoMapUv),M.push(b.bumpMapUv),M.push(b.normalMapUv),M.push(b.displacementMapUv),M.push(b.emissiveMapUv),M.push(b.metalnessMapUv),M.push(b.roughnessMapUv),M.push(b.anisotropyMapUv),M.push(b.clearcoatMapUv),M.push(b.clearcoatNormalMapUv),M.push(b.clearcoatRoughnessMapUv),M.push(b.iridescenceMapUv),M.push(b.iridescenceThicknessMapUv),M.push(b.sheenColorMapUv),M.push(b.sheenRoughnessMapUv),M.push(b.specularMapUv),M.push(b.specularColorMapUv),M.push(b.specularIntensityMapUv),M.push(b.transmissionMapUv),M.push(b.thicknessMapUv),M.push(b.combine),M.push(b.fogExp2),M.push(b.sizeAttenuation),M.push(b.morphTargetsCount),M.push(b.morphAttributeCount),M.push(b.numDirLights),M.push(b.numPointLights),M.push(b.numSpotLights),M.push(b.numSpotLightMaps),M.push(b.numHemiLights),M.push(b.numRectAreaLights),M.push(b.numDirLightShadows),M.push(b.numPointLightShadows),M.push(b.numSpotLightShadows),M.push(b.numSpotLightShadowsWithMaps),M.push(b.numLightProbes),M.push(b.shadowMapType),M.push(b.toneMapping),M.push(b.numClippingPlanes),M.push(b.numClipIntersection),M.push(b.depthPacking)}function x(M,b){o.disableAll(),b.supportsVertexTextures&&o.enable(0),b.instancing&&o.enable(1),b.instancingColor&&o.enable(2),b.instancingMorph&&o.enable(3),b.matcap&&o.enable(4),b.envMap&&o.enable(5),b.normalMapObjectSpace&&o.enable(6),b.normalMapTangentSpace&&o.enable(7),b.clearcoat&&o.enable(8),b.iridescence&&o.enable(9),b.alphaTest&&o.enable(10),b.vertexColors&&o.enable(11),b.vertexAlphas&&o.enable(12),b.vertexUv1s&&o.enable(13),b.vertexUv2s&&o.enable(14),b.vertexUv3s&&o.enable(15),b.vertexTangents&&o.enable(16),b.anisotropy&&o.enable(17),b.alphaHash&&o.enable(18),b.batching&&o.enable(19),b.dispersion&&o.enable(20),b.batchingColor&&o.enable(21),b.gradientMap&&o.enable(22),M.push(o.mask),o.disableAll(),b.fog&&o.enable(0),b.useFog&&o.enable(1),b.flatShading&&o.enable(2),b.logarithmicDepthBuffer&&o.enable(3),b.reversedDepthBuffer&&o.enable(4),b.skinning&&o.enable(5),b.morphTargets&&o.enable(6),b.morphNormals&&o.enable(7),b.morphColors&&o.enable(8),b.premultipliedAlpha&&o.enable(9),b.shadowMapEnabled&&o.enable(10),b.doubleSided&&o.enable(11),b.flipSided&&o.enable(12),b.useDepthPacking&&o.enable(13),b.dithering&&o.enable(14),b.transmission&&o.enable(15),b.sheen&&o.enable(16),b.opaque&&o.enable(17),b.pointsUvs&&o.enable(18),b.decodeVideoTexture&&o.enable(19),b.decodeVideoTextureEmissive&&o.enable(20),b.alphaToCoverage&&o.enable(21),M.push(o.mask)}function w(M){const b=g[M.type];let N;if(b){const U=gr[b];N=RT.clone(U.uniforms)}else N=M.uniforms;return N}function A(M,b){let N;for(let U=0,B=u.length;U<B;U++){const X=u[U];if(X.cacheKey===b){N=X,++N.usedTimes;break}}return N===void 0&&(N=new rP(t,b,M,s),u.push(N)),N}function E(M){if(--M.usedTimes===0){const b=u.indexOf(M);u[b]=u[u.length-1],u.pop(),M.destroy()}}function R(M){l.remove(M)}function P(){l.dispose()}return{getParameters:m,getProgramCacheKey:h,getUniforms:w,acquireProgram:A,releaseProgram:E,releaseShaderCache:R,programs:u,dispose:P}}function lP(){let t=new WeakMap;function e(a){return t.has(a)}function n(a){let o=t.get(a);return o===void 0&&(o={},t.set(a,o)),o}function r(a){t.delete(a)}function i(a,o,l){t.get(a)[o]=l}function s(){t=new WeakMap}return{has:e,get:n,remove:r,update:i,dispose:s}}function cP(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function Fg(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Bg(){const t=[];let e=0;const n=[],r=[],i=[];function s(){e=0,n.length=0,r.length=0,i.length=0}function a(d,f,p,g,_,m){let h=t[e];return h===void 0?(h={id:d.id,object:d,geometry:f,material:p,groupOrder:g,renderOrder:d.renderOrder,z:_,group:m},t[e]=h):(h.id=d.id,h.object=d,h.geometry=f,h.material=p,h.groupOrder=g,h.renderOrder=d.renderOrder,h.z=_,h.group=m),e++,h}function o(d,f,p,g,_,m){const h=a(d,f,p,g,_,m);p.transmission>0?r.push(h):p.transparent===!0?i.push(h):n.push(h)}function l(d,f,p,g,_,m){const h=a(d,f,p,g,_,m);p.transmission>0?r.unshift(h):p.transparent===!0?i.unshift(h):n.unshift(h)}function c(d,f){n.length>1&&n.sort(d||cP),r.length>1&&r.sort(f||Fg),i.length>1&&i.sort(f||Fg)}function u(){for(let d=e,f=t.length;d<f;d++){const p=t[d];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:n,transmissive:r,transparent:i,init:s,push:o,unshift:l,finish:u,sort:c}}function uP(){let t=new WeakMap;function e(r,i){const s=t.get(r);let a;return s===void 0?(a=new Bg,t.set(r,[a])):i>=s.length?(a=new Bg,s.push(a)):a=s[i],a}function n(){t=new WeakMap}return{get:e,dispose:n}}function dP(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new $,color:new rt};break;case"SpotLight":n={position:new $,direction:new $,color:new rt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new $,color:new rt,distance:0,decay:0};break;case"HemisphereLight":n={direction:new $,skyColor:new rt,groundColor:new rt};break;case"RectAreaLight":n={color:new rt,position:new $,halfWidth:new $,halfHeight:new $};break}return t[e.id]=n,n}}}function hP(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nt};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nt};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new nt,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let fP=0;function pP(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function mP(t){const e=new dP,n=hP(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new $);const i=new $,s=new Nt,a=new Nt;function o(c){let u=0,d=0,f=0;for(let M=0;M<9;M++)r.probe[M].set(0,0,0);let p=0,g=0,_=0,m=0,h=0,v=0,x=0,w=0,A=0,E=0,R=0;c.sort(pP);for(let M=0,b=c.length;M<b;M++){const N=c[M],U=N.color,B=N.intensity,X=N.distance,W=N.shadow&&N.shadow.map?N.shadow.map.texture:null;if(N.isAmbientLight)u+=U.r*B,d+=U.g*B,f+=U.b*B;else if(N.isLightProbe){for(let V=0;V<9;V++)r.probe[V].addScaledVector(N.sh.coefficients[V],B);R++}else if(N.isDirectionalLight){const V=e.get(N);if(V.color.copy(N.color).multiplyScalar(N.intensity),N.castShadow){const Q=N.shadow,D=n.get(N);D.shadowIntensity=Q.intensity,D.shadowBias=Q.bias,D.shadowNormalBias=Q.normalBias,D.shadowRadius=Q.radius,D.shadowMapSize=Q.mapSize,r.directionalShadow[p]=D,r.directionalShadowMap[p]=W,r.directionalShadowMatrix[p]=N.shadow.matrix,v++}r.directional[p]=V,p++}else if(N.isSpotLight){const V=e.get(N);V.position.setFromMatrixPosition(N.matrixWorld),V.color.copy(U).multiplyScalar(B),V.distance=X,V.coneCos=Math.cos(N.angle),V.penumbraCos=Math.cos(N.angle*(1-N.penumbra)),V.decay=N.decay,r.spot[_]=V;const Q=N.shadow;if(N.map&&(r.spotLightMap[A]=N.map,A++,Q.updateMatrices(N),N.castShadow&&E++),r.spotLightMatrix[_]=Q.matrix,N.castShadow){const D=n.get(N);D.shadowIntensity=Q.intensity,D.shadowBias=Q.bias,D.shadowNormalBias=Q.normalBias,D.shadowRadius=Q.radius,D.shadowMapSize=Q.mapSize,r.spotShadow[_]=D,r.spotShadowMap[_]=W,w++}_++}else if(N.isRectAreaLight){const V=e.get(N);V.color.copy(U).multiplyScalar(B),V.halfWidth.set(N.width*.5,0,0),V.halfHeight.set(0,N.height*.5,0),r.rectArea[m]=V,m++}else if(N.isPointLight){const V=e.get(N);if(V.color.copy(N.color).multiplyScalar(N.intensity),V.distance=N.distance,V.decay=N.decay,N.castShadow){const Q=N.shadow,D=n.get(N);D.shadowIntensity=Q.intensity,D.shadowBias=Q.bias,D.shadowNormalBias=Q.normalBias,D.shadowRadius=Q.radius,D.shadowMapSize=Q.mapSize,D.shadowCameraNear=Q.camera.near,D.shadowCameraFar=Q.camera.far,r.pointShadow[g]=D,r.pointShadowMap[g]=W,r.pointShadowMatrix[g]=N.shadow.matrix,x++}r.point[g]=V,g++}else if(N.isHemisphereLight){const V=e.get(N);V.skyColor.copy(N.color).multiplyScalar(B),V.groundColor.copy(N.groundColor).multiplyScalar(B),r.hemi[h]=V,h++}}m>0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=fe.LTC_FLOAT_1,r.rectAreaLTC2=fe.LTC_FLOAT_2):(r.rectAreaLTC1=fe.LTC_HALF_1,r.rectAreaLTC2=fe.LTC_HALF_2)),r.ambient[0]=u,r.ambient[1]=d,r.ambient[2]=f;const P=r.hash;(P.directionalLength!==p||P.pointLength!==g||P.spotLength!==_||P.rectAreaLength!==m||P.hemiLength!==h||P.numDirectionalShadows!==v||P.numPointShadows!==x||P.numSpotShadows!==w||P.numSpotMaps!==A||P.numLightProbes!==R)&&(r.directional.length=p,r.spot.length=_,r.rectArea.length=m,r.point.length=g,r.hemi.length=h,r.directionalShadow.length=v,r.directionalShadowMap.length=v,r.pointShadow.length=x,r.pointShadowMap.length=x,r.spotShadow.length=w,r.spotShadowMap.length=w,r.directionalShadowMatrix.length=v,r.pointShadowMatrix.length=x,r.spotLightMatrix.length=w+A-E,r.spotLightMap.length=A,r.numSpotLightShadowsWithMaps=E,r.numLightProbes=R,P.directionalLength=p,P.pointLength=g,P.spotLength=_,P.rectAreaLength=m,P.hemiLength=h,P.numDirectionalShadows=v,P.numPointShadows=x,P.numSpotShadows=w,P.numSpotMaps=A,P.numLightProbes=R,r.version=fP++)}function l(c,u){let d=0,f=0,p=0,g=0,_=0;const m=u.matrixWorldInverse;for(let h=0,v=c.length;h<v;h++){const x=c[h];if(x.isDirectionalLight){const w=r.directional[d];w.direction.setFromMatrixPosition(x.matrixWorld),i.setFromMatrixPosition(x.target.matrixWorld),w.direction.sub(i),w.direction.transformDirection(m),d++}else if(x.isSpotLight){const w=r.spot[p];w.position.setFromMatrixPosition(x.matrixWorld),w.position.applyMatrix4(m),w.direction.setFromMatrixPosition(x.matrixWorld),i.setFromMatrixPosition(x.target.matrixWorld),w.direction.sub(i),w.direction.transformDirection(m),p++}else if(x.isRectAreaLight){const w=r.rectArea[g];w.position.setFromMatrixPosition(x.matrixWorld),w.position.applyMatrix4(m),a.identity(),s.copy(x.matrixWorld),s.premultiply(m),a.extractRotation(s),w.halfWidth.set(x.width*.5,0,0),w.halfHeight.set(0,x.height*.5,0),w.halfWidth.applyMatrix4(a),w.halfHeight.applyMatrix4(a),g++}else if(x.isPointLight){const w=r.point[f];w.position.setFromMatrixPosition(x.matrixWorld),w.position.applyMatrix4(m),f++}else if(x.isHemisphereLight){const w=r.hemi[_];w.direction.setFromMatrixPosition(x.matrixWorld),w.direction.transformDirection(m),_++}}}return{setup:o,setupView:l,state:r}}function zg(t){const e=new mP(t),n=[],r=[];function i(u){c.camera=u,n.length=0,r.length=0}function s(u){n.push(u)}function a(u){r.push(u)}function o(){e.setup(n)}function l(u){e.setupView(n,u)}const c={lightsArray:n,shadowsArray:r,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:c,setupLights:o,setupLightsView:l,pushLight:s,pushShadow:a}}function gP(t){let e=new WeakMap;function n(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new zg(t),e.set(i,[o])):s>=a.length?(o=new zg(t),a.push(o)):o=a[s],o}function r(){e=new WeakMap}return{get:n,dispose:r}}const xP=`void main() {
4119	gl_Position = vec4( position, 1.0 );
4120}`,vP=`uniform sampler2D shadow_pass;
4121uniform vec2 resolution;
4122uniform float radius;
4123#include <packing>
4124void main() {
4125	const float samples = float( VSM_SAMPLES );
4126	float mean = 0.0;
4127	float squared_mean = 0.0;
4128	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4129	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4130	for ( float i = 0.0; i < samples; i ++ ) {
4131		float uvOffset = uvStart + i * uvStride;
4132		#ifdef HORIZONTAL_PASS
4133			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
4134			mean += distribution.x;
4135			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4136		#else
4137			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
4138			mean += depth;
4139			squared_mean += depth * depth;
4140		#endif
4141	}
4142	mean = mean / samples;
4143	squared_mean = squared_mean / samples;
4144	float std_dev = sqrt( squared_mean - mean * mean );
4145	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
4146}`;function _P(t,e,n){let r=new Wp;const i=new nt,s=new nt,a=new Pt,o=new zT({depthPacking:J3}),l=new VT,c={},u=n.maxTextureSize,d={[Ni]:wn,[wn]:Ni,[Or]:Or}
vendor: 1,420 bytes, line 4146
4146,f=new Jr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new nt},radius:{value:4}},vertexShader:xP,fragmentShader:vP}),p=f.clone();p.defines.HORIZONTAL_PASS=1;const g=new Tr;g.setAttribute("position",new wr(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new Er(g,f),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=G_;let h=this.type;this.render=function(E,R,P){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||E.length===0)return;const M=t.getRenderTarget(),b=t.getActiveCubeFace(),N=t.getActiveMipmapLevel(),U=t.state;U.setBlending(Gr),U.buffers.depth.getReversed()===!0?U.buffers.color.setClear(0,0,0,0):U.buffers.color.setClear(1,1,1,1),U.buffers.depth.setTest(!0),U.setScissorTest(!1);const B=h!==Ir&&this.type===Ir,X=h===Ir&&this.type!==Ir;for(let W=0,V=E.length;W<V;W++){const Q=E[W],D=Q.shadow;if(D===void 0){He("WebGLShadowMap:",Q,"has no shadow.");continue}if(D.autoUpdate===!1&&D.needsUpdate===!1)continue;i.copy(D.mapSize);const q=D.getFrameExtents();if(i.multiply(q),s.copy(D.mapSize),(i.x>u||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/q.x),i.x=s.x*q.x,D.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/q.y),i.y=s.y*q.y,D.mapSize.y=s.y)),D.map===null||B===!0||X===!0){const de=this.type!==Ir?{minFilter:Ln,magFilter:Ln}:{};D.map!==null&&D.map.dispose(),D.map=new ps(i.x,i.y,de),D.map.texture.name=Q.name+".shadowMap",D.camera.updateProjectionMatrix()}
vendor: 30,959 bytes, line 4146
4146t.setRenderTarget(D.map),t.clear();const Y=D.getViewportCount();for(let de=0;de<Y;de++){const Ee=D.getViewport(de);a.set(s.x*Ee.x,s.y*Ee.y,s.x*Ee.z,s.y*Ee.w),U.viewport(a),D.updateMatrices(Q,de),r=D.getFrustum(),w(R,P,D.camera,Q,this.type)}D.isPointLightShadow!==!0&&this.type===Ir&&v(D,P),D.needsUpdate=!1}h=this.type,m.needsUpdate=!1,t.setRenderTarget(M,b,N)};function v(E,R){const P=e.update(_);f.defines.VSM_SAMPLES!==E.blurSamples&&(f.defines.VSM_SAMPLES=E.blurSamples,p.defines.VSM_SAMPLES=E.blurSamples,f.needsUpdate=!0,p.needsUpdate=!0),E.mapPass===null&&(E.mapPass=new ps(i.x,i.y)),f.uniforms.shadow_pass.value=E.map.texture,f.uniforms.resolution.value=E.mapSize,f.uniforms.radius.value=E.radius,t.setRenderTarget(E.mapPass),t.clear(),t.renderBufferDirect(R,null,P,f,_,null),p.uniforms.shadow_pass.value=E.mapPass.texture,p.uniforms.resolution.value=E.mapSize,p.uniforms.radius.value=E.radius,t.setRenderTarget(E.map),t.clear(),t.renderBufferDirect(R,null,P,p,_,null)}function x(E,R,P,M){let b=null;const N=P.isPointLight===!0?E.customDistanceMaterial:E.customDepthMaterial;if(N!==void 0)b=N;else if(b=P.isPointLight===!0?l:o,t.localClippingEnabled&&R.clipShadows===!0&&Array.isArray(R.clippingPlanes)&&R.clippingPlanes.length!==0||R.displacementMap&&R.displacementScale!==0||R.alphaMap&&R.alphaTest>0||R.map&&R.alphaTest>0||R.alphaToCoverage===!0){const U=b.uuid,B=R.uuid;let X=c[U];X===void 0&&(X={},c[U]=X);let W=X[B];W===void 0&&(W=b.clone(),X[B]=W,R.addEventListener("dispose",A)),b=W}if(b.visible=R.visible,b.wireframe=R.wireframe,M===Ir?b.side=R.shadowSide!==null?R.shadowSide:R.side:b.side=R.shadowSide!==null?R.shadowSide:d[R.side],b.alphaMap=R.alphaMap,b.alphaTest=R.alphaToCoverage===!0?.5:R.alphaTest,b.map=R.map,b.clipShadows=R.clipShadows,b.clippingPlanes=R.clippingPlanes,b.clipIntersection=R.clipIntersection,b.displacementMap=R.displacementMap,b.displacementScale=R.displacementScale,b.displacementBias=R.displacementBias,b.wireframeLinewidth=R.wireframeLinewidth,b.linewidth=R.linewidth,P.isPointLight===!0&&b.isMeshDistanceMaterial===!0){const U=t.properties.get(b);U.light=P}return b}function w(E,R,P,M,b){if(E.visible===!1)return;if(E.layers.test(R.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&b===Ir)&&(!E.frustumCulled||r.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,E.matrixWorld);const B=e.update(E),X=E.material;if(Array.isArray(X)){const W=B.groups;for(let V=0,Q=W.length;V<Q;V++){const D=W[V],q=X[D.materialIndex];if(q&&q.visible){const Y=x(E,q,M,b);E.onBeforeShadow(t,E,R,P,B,Y,D),t.renderBufferDirect(P,null,B,Y,E,D),E.onAfterShadow(t,E,R,P,B,Y,D)}}}else if(X.visible){const W=x(E,X,M,b);E.onBeforeShadow(t,E,R,P,B,W,null),t.renderBufferDirect(P,null,B,W,E,null),E.onAfterShadow(t,E,R,P,B,W,null)}}const U=E.children;for(let B=0,X=U.length;B<X;B++)w(U[B],R,P,M,b)}function A(E){E.target.removeEventListener("dispose",A);for(const P in c){const M=c[P],b=E.target.uuid;b in M&&(M[b].dispose(),delete M[b])}}}const yP={[zh]:Vh,[jh]:Wh,[Hh]:$h,[va]:Gh,[Vh]:zh,[Wh]:jh,[$h]:Hh,[Gh]:va};function wP(t,e){function n(){let I=!1;const me=new Pt;let ce=null;const ue=new Pt(0,0,0,0);return{setMask:function(ie){ce!==ie&&!I&&(t.colorMask(ie,ie,ie,ie),ce=ie)},setLocked:function(ie){I=ie},setClear:function(ie,ee,we,Ve,ft){ft===!0&&(ie*=Ve,ee*=Ve,we*=Ve),me.set(ie,ee,we,Ve),ue.equals(me)===!1&&(t.clearColor(ie,ee,we,Ve),ue.copy(me))},reset:function(){I=!1,ce=null,ue.set(-1,0,0,0)}}}function r(){let I=!1,me=!1,ce=null,ue=null,ie=null;return{setReversed:function(ee){if(me!==ee){const we=e.get("EXT_clip_control");ee?we.clipControlEXT(we.LOWER_LEFT_EXT,we.ZERO_TO_ONE_EXT):we.clipControlEXT(we.LOWER_LEFT_EXT,we.NEGATIVE_ONE_TO_ONE_EXT),me=ee;const Ve=ie;ie=null,this.setClear(Ve)}},getReversed:function(){return me},setTest:function(ee){ee?J(t.DEPTH_TEST):he(t.DEPTH_TEST)},setMask:function(ee){ce!==ee&&!I&&(t.depthMask(ee),ce=ee)},setFunc:function(ee){if(me&&(ee=yP[ee]),ue!==ee){switch(ee){case zh:t.depthFunc(t.NEVER);break;case Vh:t.depthFunc(t.ALWAYS);break;case jh:t.depthFunc(t.LESS);break;case va:t.depthFunc(t.LEQUAL);break;case Hh:t.depthFunc(t.EQUAL);break;case Gh:t.depthFunc(t.GEQUAL);break;case Wh:t.depthFunc(t.GREATER);break;case $h:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}ue=ee}},setLocked:function(ee){I=ee},setClear:function(ee){ie!==ee&&(me&&(ee=1-ee),t.clearDepth(ee),ie=ee)},reset:function(){I=!1,ce=null,ue=null,ie=null,me=!1}}}function i(){let I=!1,me=null,ce=null,ue=null,ie=null,ee=null,we=null,Ve=null,ft=null;return{setTest:function(st){I||(st?J(t.STENCIL_TEST):he(t.STENCIL_TEST))},setMask:function(st){me!==st&&!I&&(t.stencilMask(st),me=st)},setFunc:function(st,fr,Kn){(ce!==st||ue!==fr||ie!==Kn)&&(t.stencilFunc(st,fr,Kn),ce=st,ue=fr,ie=Kn)},setOp:function(st,fr,Kn){(ee!==st||we!==fr||Ve!==Kn)&&(t.stencilOp(st,fr,Kn),ee=st,we=fr,Ve=Kn)},setLocked:function(st){I=st},setClear:function(st){ft!==st&&(t.clearStencil(st),ft=st)},reset:function(){I=!1,me=null,ce=null,ue=null,ie=null,ee=null,we=null,Ve=null,ft=null}}}const s=new n,a=new r,o=new i,l=new WeakMap,c=new WeakMap;let u={},d={},f=new WeakMap,p=[],g=null,_=!1,m=null,h=null,v=null,x=null,w=null,A=null,E=null,R=new rt(0,0,0),P=0,M=!1,b=null,N=null,U=null,B=null,X=null;const W=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let V=!1,Q=0;const D=t.getParameter(t.VERSION);D.indexOf("WebGL")!==-1?(Q=parseFloat(/^WebGL (\d)/.exec(D)[1]),V=Q>=1):D.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(D)[1]),V=Q>=2);let q=null,Y={};const de=t.getParameter(t.SCISSOR_BOX),Ee=t.getParameter(t.VIEWPORT),se=new Pt().fromArray(de),ae=new Pt().fromArray(Ee);function ye(I,me,ce,ue){const ie=new Uint8Array(4),ee=t.createTexture();t.bindTexture(I,ee),t.texParameteri(I,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(I,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let we=0;we<ce;we++)I===t.TEXTURE_3D||I===t.TEXTURE_2D_ARRAY?t.texImage3D(me,0,t.RGBA,1,1,ue,0,t.RGBA,t.UNSIGNED_BYTE,ie):t.texImage2D(me+we,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,ie);return ee}const H={};H[t.TEXTURE_2D]=ye(t.TEXTURE_2D,t.TEXTURE_2D,1),H[t.TEXTURE_CUBE_MAP]=ye(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),H[t.TEXTURE_2D_ARRAY]=ye(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),H[t.TEXTURE_3D]=ye(t.TEXTURE_3D,t.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),J(t.DEPTH_TEST),a.setFunc(va),Ke(!1),Ye(G0),J(t.CULL_FACE),gt(Gr);function J(I){u[I]!==!0&&(t.enable(I),u[I]=!0)}function he(I){u[I]!==!1&&(t.disable(I),u[I]=!1)}function Ne(I,me){return d[I]!==me?(t.bindFramebuffer(I,me),d[I]=me,I===t.DRAW_FRAMEBUFFER&&(d[t.FRAMEBUFFER]=me),I===t.FRAMEBUFFER&&(d[t.DRAW_FRAMEBUFFER]=me),!0):!1}function Me(I,me){let ce=p,ue=!1;if(I){ce=f.get(me),ce===void 0&&(ce=[],f.set(me,ce));const ie=I.textures;if(ce.length!==ie.length||ce[0]!==t.COLOR_ATTACHMENT0){for(let ee=0,we=ie.length;ee<we;ee++)ce[ee]=t.COLOR_ATTACHMENT0+ee;ce.length=ie.length,ue=!0}}else ce[0]!==t.BACK&&(ce[0]=t.BACK,ue=!0);ue&&t.drawBuffers(ce)}function We(I){return g!==I?(t.useProgram(I),g=I,!0):!1}const $t={[Qi]:t.FUNC_ADD,[b3]:t.FUNC_SUBTRACT,[E3]:t.FUNC_REVERSE_SUBTRACT};$t[M3]=t.MIN,$t[T3]=t.MAX;const Xe={[A3]:t.ZERO,[R3]:t.ONE,[C3]:t.SRC_COLOR,[Fh]:t.SRC_ALPHA,[U3]:t.SRC_ALPHA_SATURATE,[I3]:t.DST_COLOR,[N3]:t.DST_ALPHA,[P3]:t.ONE_MINUS_SRC_COLOR,[Bh]:t.ONE_MINUS_SRC_ALPHA,[D3]:t.ONE_MINUS_DST_COLOR,[L3]:t.ONE_MINUS_DST_ALPHA,[k3]:t.CONSTANT_COLOR,[O3]:t.ONE_MINUS_CONSTANT_COLOR,[F3]:t.CONSTANT_ALPHA,[B3]:t.ONE_MINUS_CONSTANT_ALPHA};function gt(I,me,ce,ue,ie,ee,we,Ve,ft,st){if(I===Gr){_===!0&&(he(t.BLEND),_=!1);return}if(_===!1&&(J(t.BLEND),_=!0),I!==S3){if(I!==m||st!==M){if((h!==Qi||w!==Qi)&&(t.blendEquation(t.FUNC_ADD),h=Qi,w=Qi),st)switch(I){case ca:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case W0:t.blendFunc(t.ONE,t.ONE);break;case $0:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case X0:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:It("WebGLState: Invalid blending: ",I);break}else switch(I){case ca:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case W0:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case $0:It("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case X0:It("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:It("WebGLState: Invalid blending: ",I);break}v=null,x=null,A=null,E=null,R.set(0,0,0),P=0,m=I,M=st}return}ie=ie||me,ee=ee||ce,we=we||ue,(me!==h||ie!==w)&&(t.blendEquationSeparate($t[me],$t[ie]),h=me,w=ie),(ce!==v||ue!==x||ee!==A||we!==E)&&(t.blendFuncSeparate(Xe[ce],Xe[ue],Xe[ee],Xe[we]),v=ce,x=ue,A=ee,E=we),(Ve.equals(R)===!1||ft!==P)&&(t.blendColor(Ve.r,Ve.g,Ve.b,ft),R.copy(Ve),P=ft),m=I,M=!1}function L(I,me){I.side===Or?he(t.CULL_FACE):J(t.CULL_FACE);let ce=I.side===wn;me&&(ce=!ce),Ke(ce),I.blending===ca&&I.transparent===!1?gt(Gr):gt(I.blending,I.blendEquation,I.blendSrc,I.blendDst,I.blendEquationAlpha,I.blendSrcAlpha,I.blendDstAlpha,I.blendColor,I.blendAlpha,I.premultipliedAlpha),a.setFunc(I.depthFunc),a.setTest(I.depthTest),a.setMask(I.depthWrite),s.setMask(I.colorWrite);const ue=I.stencilWrite;o.setTest(ue),ue&&(o.setMask(I.stencilWriteMask),o.setFunc(I.stencilFunc,I.stencilRef,I.stencilFuncMask),o.setOp(I.stencilFail,I.stencilZFail,I.stencilZPass)),be(I.polygonOffset,I.polygonOffsetFactor,I.polygonOffsetUnits),I.alphaToCoverage===!0?J(t.SAMPLE_ALPHA_TO_COVERAGE):he(t.SAMPLE_ALPHA_TO_COVERAGE)}function Ke(I){b!==I&&(I?t.frontFace(t.CW):t.frontFace(t.CCW),b=I)}function Ye(I){I!==_3?(J(t.CULL_FACE),I!==N&&(I===G0?t.cullFace(t.BACK):I===y3?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):he(t.CULL_FACE),N=I}function ut(I){I!==U&&(V&&t.lineWidth(I),U=I)}function be(I,me,ce){I?(J(t.POLYGON_OFFSET_FILL),(B!==me||X!==ce)&&(t.polygonOffset(me,ce),B=me,X=ce)):he(t.POLYGON_OFFSET_FILL)}function _t(I){I?J(t.SCISSOR_TEST):he(t.SCISSOR_TEST)}function Pe(I){I===void 0&&(I=t.TEXTURE0+W-1),q!==I&&(t.activeTexture(I),q=I)}function je(I,me,ce){ce===void 0&&(q===null?ce=t.TEXTURE0+W-1:ce=q);let ue=Y[ce];ue===void 0&&(ue={type:void 0,texture:void 0},Y[ce]=ue),(ue.type!==I||ue.texture!==me)&&(q!==ce&&(t.activeTexture(ce),q=ce),t.bindTexture(I,me||H[I]),ue.type=I,ue.texture=me)}function C(){const I=Y[q];I!==void 0&&I.type!==void 0&&(t.bindTexture(I.type,null),I.type=void 0,I.texture=void 0)}function S(){try{t.compressedTexImage2D(...arguments)}catch(I){I("WebGLState:",I)}}function z(){try{t.compressedTexImage3D(...arguments)}catch(I){I("WebGLState:",I)}}function Z(){try{t.texSubImage2D(...arguments)}catch(I){I("WebGLState:",I)}}function te(){try{t.texSubImage3D(...arguments)}catch(I){I("WebGLState:",I)}}function K(){try{t.compressedTexSubImage2D(...arguments)}catch(I){I("WebGLState:",I)}}function Re(){try{t.compressedTexSubImage3D(...arguments)}catch(I){I("WebGLState:",I)}}function pe(){try{t.texStorage2D(...arguments)}catch(I){I("WebGLState:",I)}}function Le(){try{t.texStorage3D(...arguments)}catch(I){I("WebGLState:",I)}}function Ae(){try{t.texImage2D(...arguments)}catch(I){I("WebGLState:",I)}}function ne(){try{t.texImage3D(...arguments)}catch(I){I("WebGLState:",I)}}function le(I){se.equals(I)===!1&&(t.scissor(I.x,I.y,I.z,I.w),se.copy(I))}function Fe(I){ae.equals(I)===!1&&(t.viewport(I.x,I.y,I.z,I.w),ae.copy(I))}function De(I,me){let ce=c.get(me);ce===void 0&&(ce=new WeakMap,c.set(me,ce));let ue=ce.get(I);ue===void 0&&(ue=t.getUniformBlockIndex(me,I.name),ce.set(I,ue))}function xe(I,me){const ue=c.get(me).get(I);l.get(me)!==ue&&(t.uniformBlockBinding(me,ue,I.__bindingPointIndex),l.set(me,ue))}function ze(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),a.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),u={},q=null,Y={},d={},f=new WeakMap,p=[],g=null,_=!1,m=null,h=null,v=null,x=null,w=null,A=null,E=null,R=new rt(0,0,0),P=0,M=!1,b=null,N=null,U=null,B=null,X=null,se.set(0,0,t.canvas.width,t.canvas.height),ae.set(0,0,t.canvas.width,t.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:J,disable:he,bindFramebuffer:Ne,drawBuffers:Me,useProgram:We,setBlending:gt,setMaterial:L,setFlipSided:Ke,setCullFace:Ye,setLineWidth:ut,setPolygonOffset:be,setScissorTest:_t,activeTexture:Pe,bindTexture:je,unbindTexture:C,compressedTexImage2D:S,compressedTexImage3D:z,texImage2D:Ae,texImage3D:ne,updateUBOMapping:De,uniformBlockBinding:xe,texStorage2D:pe,texStorage3D:Le,texSubImage2D:Z,texSubImage3D:te,compressedTexSubImage2D:K,compressedTexSubImage3D:Re,scissor:le,viewport:Fe,reset:ze}}function SP(t,e,n,r,i,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new nt,u=new WeakMap;let d;const f=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function g(C,S){return p?new OffscreenCanvas(C,S):Hc("canvas")}function _(C,S,z){let Z=1;const te=je(C);if((te.width>z||te.height>z)&&(Z=z/Math.max(te.width,te.height)),Z<1)if(typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&C instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&C instanceof ImageBitmap||typeof VideoFrame<"u"&&C instanceof VideoFrame){const K=Math.floor(Z*te.width),Re=Math.floor(Z*te.height);d===void 0&&(d=g(K,Re));const pe=S?g(K,Re):d;return pe.width=K,pe.height=Re,pe.getContext("2d").drawImage(C,0,0,K,Re),He("WebGLRenderer: Texture has been resized from ("+te.width+"x"+te.height+") to ("+K+"x"+Re+")."),pe}else return"data"in C&&He("WebGLRenderer: Image in DataTexture is too big ("+te.width+"x"+te.height+")."),C;return C}function m(C){return C.generateMipmaps}function h(C){t.generateMipmap(C)}function v(C){return C.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:C.isWebGL3DRenderTarget?t.TEXTURE_3D:C.isWebGLArrayRenderTarget||C.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function x(C,S,z,Z,te=!1){if(C!==null){if(t[C]!==void 0)return t[C];He("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+C+"'")}let K=S;if(S===t.RED&&(z===t.FLOAT&&(K=t.R32F),z===t.HALF_FLOAT&&(K=t.R16F),z===t.UNSIGNED_BYTE&&(K=t.R8)),S===t.RED_INTEGER&&(z===t.UNSIGNED_BYTE&&(K=t.R8UI),z===t.UNSIGNED_SHORT&&(K=t.R16UI),z===t.UNSIGNED_INT&&(K=t.R32UI),z===t.BYTE&&(K=t.R8I),z===t.SHORT&&(K=t.R16I),z===t.INT&&(K=t.R32I)),S===t.RG&&(z===t.FLOAT&&(K=t.RG32F),z===t.HALF_FLOAT&&(K=t.RG16F),z===t.UNSIGNED_BYTE&&(K=t.RG8)),S===t.RG_INTEGER&&(z===t.UNSIGNED_BYTE&&(K=t.RG8UI),z===t.UNSIGNED_SHORT&&(K=t.RG16UI),z===t.UNSIGNED_INT&&(K=t.RG32UI),z===t.BYTE&&(K=t.RG8I),z===t.SHORT&&(K=t.RG16I),z===t.INT&&(K=t.RG32I)),S===t.RGB_INTEGER&&(z===t.UNSIGNED_BYTE&&(K=t.RGB8UI),z===t.UNSIGNED_SHORT&&(K=t.RGB16UI),z===t.UNSIGNED_INT&&(K=t.RGB32UI),z===t.BYTE&&(K=t.RGB8I),z===t.SHORT&&(K=t.RGB16I),z===t.INT&&(K=t.RGB32I)),S===t.RGBA_INTEGER&&(z===t.UNSIGNED_BYTE&&(K=t.RGBA8UI),z===t.UNSIGNED_SHORT&&(K=t.RGBA16UI),z===t.UNSIGNED_INT&&(K=t.RGBA32UI),z===t.BYTE&&(K=t.RGBA8I),z===t.SHORT&&(K=t.RGBA16I),z===t.INT&&(K=t.RGBA32I)),S===t.RGB&&(z===t.UNSIGNED_INT_5_9_9_9_REV&&(K=t.RGB9_E5),z===t.UNSIGNED_INT_10F_11F_11F_REV&&(K=t.R11F_G11F_B10F)),S===t.RGBA){const Re=te?Vc:tt.getTransfer(Z);z===t.FLOAT&&(K=t.RGBA32F),z===t.HALF_FLOAT&&(K=t.RGBA16F),z===t.UNSIGNED_BYTE&&(K=Re===ot?t.SRGB8_ALPHA8:t.RGBA8),z===t.UNSIGNED_SHORT_4_4_4_4&&(K=t.RGBA4),z===t.UNSIGNED_SHORT_5_5_5_1&&(K=t.RGB5_A1)}return(K===t.R16F||K===t.R32F||K===t.RG16F||K===t.RG32F||K===t.RGBA16F||K===t.RGBA32F)&&e.get("EXT_color_buffer_float"),K}function w(C,S){let z;return C?S===null||S===fs||S===Bo?z=t.DEPTH24_STENCIL8:S===Vr?z=t.DEPTH32F_STENCIL8:S===Fo&&(z=t.DEPTH24_STENCIL8,He("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):S===null||S===fs||S===Bo?z=t.DEPTH_COMPONENT24:S===Vr?z=t.DEPTH_COMPONENT32F:S===Fo&&(z=t.DEPTH_COMPONENT16),z}function A(C,S){return m(C)===!0||C.isFramebufferTexture&&C.minFilter!==Ln&&C.minFilter!==Gn?Math.log2(Math.max(S.width,S.height))+1:C.mipmaps!==void 0&&C.mipmaps.length>0?C.mipmaps.length:C.isCompressedTexture&&Array.isArray(C.image)?S.mipmaps.length:1}function E(C){const S=C.target;S.removeEventListener("dispose",E),P(S),S.isVideoTexture&&u.delete(S)}function R(C){const S=C.target;S.removeEventListener("dispose",R),b(S)}function P(C){const S=r.get(C);if(S.__webglInit===void 0)return;const z=C.source,Z=f.get(z);if(Z){const te=Z[S.__cacheKey];te.usedTimes--,te.usedTimes===0&&M(C),Object.keys(Z).length===0&&f.delete(z)}r.remove(C)}function M(C){const S=r.get(C);t.deleteTexture(S.__webglTexture);const z=C.source,Z=f.get(z);delete Z[S.__cacheKey],a.memory.textures--}function b(C){const S=r.get(C);if(C.depthTexture&&(C.depthTexture.dispose(),r.remove(C.depthTexture)),C.isWebGLCubeRenderTarget)for(let Z=0;Z<6;Z++){if(Array.isArray(S.__webglFramebuffer[Z]))for(let te=0;te<S.__webglFramebuffer[Z].length;te++)t.deleteFramebuffer(S.__webglFramebuffer[Z][te]);else t.deleteFramebuffer(S.__webglFramebuffer[Z]);S.__webglDepthbuffer&&t.deleteRenderbuffer(S.__webglDepthbuffer[Z])}else{if(Array.isArray(S.__webglFramebuffer))for(let Z=0;Z<S.__webglFramebuffer.length;Z++)t.deleteFramebuffer(S.__webglFramebuffer[Z]);else t.deleteFramebuffer(S.__webglFramebuffer);if(S.__webglDepthbuffer&&t.deleteRenderbuffer(S.__webglDepthbuffer),S.__webglMultisampledFramebuffer&&t.deleteFramebuffer(S.__webglMultisampledFramebuffer),S.__webglColorRenderbuffer)for(let Z=0;Z<S.__webglColorRenderbuffer.length;Z++)S.__webglColorRenderbuffer[Z]&&t.deleteRenderbuffer(S.__webglColorRenderbuffer[Z]);S.__webglDepthRenderbuffer&&t.deleteRenderbuffer(S.__webglDepthRenderbuffer)}const z=C.textures;for(let Z=0,te=z.length;Z<te;Z++){const K=r.get(z[Z]);K.__webglTexture&&(t.deleteTexture(K.__webglTexture),a.memory.textures--),r.remove(z[Z])}r.remove(C)}let N=0;function U(){N=0}function B(){const C=N;return C>=i.maxTextures&&He("WebGLTextures: Trying to use "+C+" texture units while this GPU supports only "+i.maxTextures),N+=1,C}function X(C){const S=[];return S.push(C.wrapS),S.push(C.wrapT),S.push(C.wrapR||0),S.push(C.magFilter),S.push(C.minFilter),S.push(C.anisotropy),S.push(C.internalFormat),S.push(C.format),S.push(C.type),S.push(C.generateMipmaps),S.push(C.premultiplyAlpha),S.push(C.flipY),S.push(C.unpackAlignment),S.push(C.colorSpace),S.join()}function W(C,S){const z=r.get(C);if(C.isVideoTexture&&_t(C),C.isRenderTargetTexture===!1&&C.isExternalTexture!==!0&&C.version>0&&z.__version!==C.version){const Z=C.image;if(Z===null)He("WebGLRenderer: Texture marked for update but no image data found.");else if(Z.complete===!1)He("WebGLRenderer: Texture marked for update but image is incomplete");else{H(z,C,S);return}}else C.isExternalTexture&&(z.__webglTexture=C.sourceTexture?C.sourceTexture:null);n.bindTexture(t.TEXTURE_2D,z.__webglTexture,t.TEXTURE0+S)}function V(C,S){const z=r.get(C);if(C.isRenderTargetTexture===!1&&C.version>0&&z.__version!==C.version){H(z,C,S);return}else C.isExternalTexture&&(z.__webglTexture=C.sourceTexture?C.sourceTexture:null);n.bindTexture(t.TEXTURE_2D_ARRAY,z.__webglTexture,t.TEXTURE0+S)}function Q(C,S){const z=r.get(C);if(C.isRenderTargetTexture===!1&&C.version>0&&z.__version!==C.version){H(z,C,S);return}n.bindTexture(t.TEXTURE_3D,z.__webglTexture,t.TEXTURE0+S)}function D(C,S){const z=r.get(C);if(C.version>0&&z.__version!==C.version){J(z,C,S);return}n.bindTexture(t.TEXTURE_CUBE_MAP,z.__webglTexture,t.TEXTURE0+S)}const q={[Kh]:t.REPEAT,[zr]:t.CLAMP_TO_EDGE,[Yh]:t.MIRRORED_REPEAT},Y={[Ln]:t.NEAREST,[K3]:t.NEAREST_MIPMAP_NEAREST,[Rl]:t.NEAREST_MIPMAP_LINEAR,[Gn]:t.LINEAR,[ed]:t.LINEAR_MIPMAP_NEAREST,[ss]:t.LINEAR_MIPMAP_LINEAR},de={[Q3]:t.NEVER,[sT]:t.ALWAYS,[eT]:t.LESS,[ty]:t.LEQUAL,[tT]:t.EQUAL,[iT]:t.GEQUAL,[nT]:t.GREATER,[rT]:t.NOTEQUAL};function Ee(C,S){if(S.type===Vr&&e.has("OES_texture_float_linear")===!1&&(S.magFilter===Gn||S.magFilter===ed||S.magFilter===Rl||S.magFilter===ss||S.minFilter===Gn||S.minFilter===ed||S.minFilter===Rl||S.minFilter===ss)&&He("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(C,t.TEXTURE_WRAP_S,q[S.wrapS]),t.texParameteri(C,t.TEXTURE_WRAP_T,q[S.wrapT]),(C===t.TEXTURE_3D||C===t.TEXTURE_2D_ARRAY)&&t.texParameteri(C,t.TEXTURE_WRAP_R,q[S.wrapR]),t.texParameteri(C,t.TEXTURE_MAG_FILTER,Y[S.magFilter]),t.texParameteri(C,t.TEXTURE_MIN_FILTER,Y[S.minFilter]),S.compareFunction&&(t.texParameteri(C,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(C,t.TEXTURE_COMPARE_FUNC,de[S.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(S.magFilter===Ln||S.minFilter!==Rl&&S.minFilter!==ss||S.type===Vr&&e.has("OES_texture_float_linear")===!1)return;if(S.anisotropy>1||r.get(S).__currentAnisotropy){const z=e.get("EXT_texture_filter_anisotropic");t.texParameterf(C,z.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(S.anisotropy,i.getMaxAnisotropy())),r.get(S).__currentAnisotropy=S.anisotropy}}}function se(C,S){let z=!1;C.__webglInit===void 0&&(C.__webglInit=!0,S.addEventListener("dispose",E));const Z=S.source;let te=f.get(Z);te===void 0&&(te={},f.set(Z,te));const K=X(S);if(K!==C.__cacheKey){te[K]===void 0&&(te[K]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,z=!0),te[K].usedTimes++;const Re=te[C.__cacheKey];Re!==void 0&&(te[C.__cacheKey].usedTimes--,Re.usedTimes===0&&M(S)),C.__cacheKey=K,C.__webglTexture=te[K].texture}return z}function ae(C,S,z){return Math.floor(Math.floor(C/z)/S)}function ye(C,S,z,Z){const K=C.updateRanges;if(K.length===0)n.texSubImage2D(t.TEXTURE_2D,0,0,0,S.width,S.height,z,Z,S.data);else{K.sort((ne,le)=>ne.start-le.start);let Re=0;for(let ne=1;ne<K.length;ne++){const le=K[Re],Fe=K[ne],De=le.start+le.count,xe=ae(Fe.start,S.width,4),ze=ae(le.start,S.width,4);Fe.start<=De+1&&xe===ze&&ae(Fe.start+Fe.count-1,S.width,4)===xe?le.count=Math.max(le.count,Fe.start+Fe.count-le.start):(++Re,K[Re]=Fe)}K.length=Re+1;const pe=t.getParameter(t.UNPACK_ROW_LENGTH),Le=t.getParameter(t.UNPACK_SKIP_PIXELS),Ae=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,S.width);for(let ne=0,le=K.length;ne<le;ne++){const Fe=K[ne],De=Math.floor(Fe.start/4),xe=Math.ceil(Fe.count/4),ze=De%S.width,I=Math.floor(De/S.width),me=xe,ce=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,ze),t.pixelStorei(t.UNPACK_SKIP_ROWS,I),n.texSubImage2D(t.TEXTURE_2D,0,ze,I,me,ce,z,Z,S.data)}C.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,pe),t.pixelStorei(t.UNPACK_SKIP_PIXELS,Le),t.pixelStorei(t.UNPACK_SKIP_ROWS,Ae)}}function H(C,S,z){let Z=t.TEXTURE_2D;(S.isDataArrayTexture||S.isCompressedArrayTexture)&&(Z=t.TEXTURE_2D_ARRAY),S.isData3DTexture&&(Z=t.TEXTURE_3D);const te=se(C,S),K=S.source;n.bindTexture(Z,C.__webglTexture,t.TEXTURE0+z);const Re=r.get(K);if(K.version!==Re.__version||te===!0){n.activeTexture(t.TEXTURE0+z);const pe=tt.getPrimaries(tt.workingColorSpace),Le=S.colorSpace===mi?null:tt.getPrimaries(S.colorSpace),Ae=S.colorSpace===mi||pe===Le?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,S.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,S.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ae);let ne=_(S.image,!1,i.maxTextureSize);ne=Pe(S,ne);const le=s.convert(S.format,S.colorSpace),Fe=s.convert(S.type);let De=x(S.internalFormat,le,Fe,S.colorSpace,S.isVideoTexture);Ee(Z,S);let xe;const ze=S.mipmaps,I=S.isVideoTexture!==!0,me=Re.__version===void 0||te===!0,ce=K.dataReady,ue=A(S,ne);if(S.isDepthTexture)De=w(S.format===Vo,S.type),me&&(I?n.texStorage2D(t.TEXTURE_2D,1,De,ne.width,ne.height):n.texImage2D(t.TEXTURE_2D,0,De,ne.width,ne.height,0,le,Fe,null));else if(S.isDataTexture)if(ze.length>0){I&&me&&n.texStorage2D(t.TEXTURE_2D,ue,De,ze[0].width,ze[0].height);for(let ie=0,ee=ze.length;ie<ee;ie++)xe=ze[ie],I?ce&&n.texSubImage2D(t.TEXTURE_2D,ie,0,0,xe.width,xe.height,le,Fe,xe.data):n.texImage2D(t.TEXTURE_2D,ie,De,xe.width,xe.height,0,le,Fe,xe.data);S.generateMipmaps=!1}else I?(me&&n.texStorage2D(t.TEXTURE_2D,ue,De,ne.width,ne.height),ce&&ye(S,ne,le,Fe)):n.texImage2D(t.TEXTURE_2D,0,De,ne.width,ne.height,0,le,Fe,ne.data);else if(S.isCompressedTexture)if(S.isCompressedArrayTexture){I&&me&&n.texStorage3D(t.TEXTURE_2D_ARRAY,ue,De,ze[0].width,ze[0].height,ne.depth);for(let ie=0,ee=ze.length;ie<ee;ie++)if(xe=ze[ie],S.format!==lr)if(le!==null)if(I){if(ce)if(S.layerUpdates.size>0){const we=xg(xe.width,xe.height,S.format,S.type);for(const Ve of S.layerUpdates){const ft=xe.data.subarray(Ve*we/xe.data.BYTES_PER_ELEMENT,(Ve+1)*we/xe.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,ie,0,0,Ve,xe.width,xe.height,1,le,ft)}S.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,ie,0,0,0,xe.width,xe.height,ne.depth,le,xe.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,ie,De,xe.width,xe.height,ne.depth,0,xe.data,0,0);else He("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else I?ce&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,ie,0,0,0,xe.width,xe.height,ne.depth,le,Fe,xe.data):n.texImage3D(t.TEXTURE_2D_ARRAY,ie,De,xe.width,xe.height,ne.depth,0,le,Fe,xe.data)}else{I&&me&&n.texStorage2D(t.TEXTURE_2D,ue,De,ze[0].width,ze[0].height);for(let ie=0,ee=ze.length;ie<ee;ie++)xe=ze[ie],S.format!==lr?le!==null?I?ce&&n.compressedTexSubImage2D(t.TEXTURE_2D,ie,0,0,xe.width,xe.height,le,xe.data):n.compressedTexImage2D(t.TEXTURE_2D,ie,De,xe.width,xe.height,0,xe.data):He("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):I?ce&&n.texSubImage2D(t.TEXTURE_2D,ie,0,0,xe.width,xe.height,le,Fe,xe.data):n.texImage2D(t.TEXTURE_2D,ie,De,xe.width,xe.height,0,le,Fe,xe.data)}else if(S.isDataArrayTexture)if(I){if(me&&n.texStorage3D(t.TEXTURE_2D_ARRAY,ue,De,ne.width,ne.height,ne.depth),ce)if(S.layerUpdates.size>0){const ie=xg(ne.width,ne.height,S.format,S.type);for(const ee of S.layerUpdates){const we=ne.data.subarray(ee*ie/ne.data.BYTES_PER_ELEMENT,(ee+1)*ie/ne.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,ee,ne.width,ne.height,1,le,Fe,we)}S.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,ne.width,ne.height,ne.depth,le,Fe,ne.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,De,ne.width,ne.height,ne.depth,0,le,Fe,ne.data);else if(S.isData3DTexture)I?(me&&n.texStorage3D(t.TEXTURE_3D,ue,De,ne.width,ne.height,ne.depth),ce&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,ne.width,ne.height,ne.depth,le,Fe,ne.data)):n.texImage3D(t.TEXTURE_3D,0,De,ne.width,ne.height,ne.depth,0,le,Fe,ne.data);else if(S.isFramebufferTexture){if(me)if(I)n.texStorage2D(t.TEXTURE_2D,ue,De,ne.width,ne.height);else{let ie=ne.width,ee=ne.height;for(let we=0;we<ue;we++)n.texImage2D(t.TEXTURE_2D,we,De,ie,ee,0,le,Fe,null),ie>>=1,ee>>=1}}else if(ze.length>0){if(I&&me){const ie=je(ze[0]);n.texStorage2D(t.TEXTURE_2D,ue,De,ie.width,ie.height)}for(let ie=0,ee=ze.length;ie<ee;ie++)xe=ze[ie],I?ce&&n.texSubImage2D(t.TEXTURE_2D,ie,0,0,le,Fe,xe):n.texImage2D(t.TEXTURE_2D,ie,De,le,Fe,xe);S.generateMipmaps=!1}else if(I){if(me){const ie=je(ne);n.texStorage2D(t.TEXTURE_2D,ue,De,ie.width,ie.height)}ce&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,le,Fe,ne)}else n.texImage2D(t.TEXTURE_2D,0,De,le,Fe,ne);m(S)&&h(Z),Re.__version=K.version,S.onUpdate&&S.onUpdate(S)}C.__version=S.version}function J(C,S,z){if(S.image.length!==6)return;const Z=se(C,S),te=S.source;n.bindTexture(t.TEXTURE_CUBE_MAP,C.__webglTexture,t.TEXTURE0+z);const K=r.get(te);if(te.version!==K.__version||Z===!0){n.activeTexture(t.TEXTURE0+z);const Re=tt.getPrimaries(tt.workingColorSpace),pe=S.colorSpace===mi?null:tt.getPrimaries(S.colorSpace),Le=S.colorSpace===mi||Re===pe?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,S.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,S.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,S.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,Le);const Ae=S.isCompressedTexture||S.image[0].isCompressedTexture,ne=S.image[0]&&S.image[0].isDataTexture,le=[];for(let ee=0;ee<6;ee++)!Ae&&!ne?le[ee]=_(S.image[ee],!0,i.maxCubemapSize):le[ee]=ne?S.image[ee].image:S.image[ee],le[ee]=Pe(S,le[ee]);const Fe=le[0],De=s.convert(S.format,S.colorSpace),xe=s.convert(S.type),ze=x(S.internalFormat,De,xe,S.colorSpace),I=S.isVideoTexture!==!0,me=K.__version===void 0||Z===!0,ce=te.dataReady;let ue=A(S,Fe);Ee(t.TEXTURE_CUBE_MAP,S);let ie;if(Ae){I&&me&&n.texStorage2D(t.TEXTURE_CUBE_MAP,ue,ze,Fe.width,Fe.height);for(let ee=0;ee<6;ee++){ie=le[ee].mipmaps;for(let we=0;we<ie.length;we++){const Ve=ie[we];S.format!==lr?De!==null?I?ce&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,we,0,0,Ve.width,Ve.height,De,Ve.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,we,ze,Ve.width,Ve.height,0,Ve.data):He("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):I?ce&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,we,0,0,Ve.width,Ve.height,De,xe,Ve.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,we,ze,Ve.width,Ve.height,0,De,xe,Ve.data)}}}else{if(ie=S.mipmaps,I&&me){ie.length>0&&ue++;const ee=je(le[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,ue,ze,ee.width,ee.height)}for(let ee=0;ee<6;ee++)if(ne){I?ce&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,le[ee].width,le[ee].height,De,xe,le[ee].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,ze,le[ee].width,le[ee].height,0,De,xe,le[ee].data);for(let we=0;we<ie.length;we++){const ft=ie[we].image[ee].image;I?ce&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,we+1,0,0,ft.width,ft.height,De,xe,ft.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,we+1,ze,ft.width,ft.height,0,De,xe,ft.data)}}else{I?ce&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,0,0,De,xe,le[ee]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,0,ze,De,xe,le[ee]);for(let we=0;we<ie.length;we++){const Ve=ie[we];I?ce&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,we+1,0,0,De,xe,Ve.image[ee]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+ee,we+1,ze,De,xe,Ve.image[ee])}}}m(S)&&h(t.TEXTURE_CUBE_MAP),K.__version=te.version,S.onUpdate&&S.onUp
vendor: 4,535 bytes, line 4146
4146date(S)}C.__version=S.version}function he(C,S,z,Z,te,K){const Re=s.convert(z.format,z.colorSpace),pe=s.convert(z.type),Le=x(z.internalFormat,Re,pe,z.colorSpace),Ae=r.get(S),ne=r.get(z);if(ne.__renderTarget=S,!Ae.__hasExternalTextures){const le=Math.max(1,S.width>>K),Fe=Math.max(1,S.height>>K);te===t.TEXTURE_3D||te===t.TEXTURE_2D_ARRAY?n.texImage3D(te,K,Le,le,Fe,S.depth,0,Re,pe,null):n.texImage2D(te,K,Le,le,Fe,0,Re,pe,null)}n.bindFramebuffer(t.FRAMEBUFFER,C),be(S)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Z,te,ne.__webglTexture,0,ut(S)):(te===t.TEXTURE_2D||te>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&te<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Z,te,ne.__webglTexture,K),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Ne(C,S,z){if(t.bindRenderbuffer(t.RENDERBUFFER,C),S.depthBuffer){const Z=S.depthTexture,te=Z&&Z.isDepthTexture?Z.type:null,K=w(S.stencilBuffer,te),Re=S.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,pe=ut(S);be(S)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,pe,K,S.width,S.height):z?t.renderbufferStorageMultisample(t.RENDERBUFFER,pe,K,S.width,S.height):t.renderbufferStorage(t.RENDERBUFFER,K,S.width,S.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Re,t.RENDERBUFFER,C)}else{const Z=S.textures;for(let te=0;te<Z.length;te++){const K=Z[te],Re=s.convert(K.format,K.colorSpace),pe=s.convert(K.type),Le=x(K.internalFormat,Re,pe,K.colorSpace),Ae=ut(S);z&&be(S)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,Ae,Le,S.width,S.height):be(S)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Ae,Le,S.width,S.height):t.renderbufferStorage(t.RENDERBUFFER,Le,S.width,S.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function Me(C,S){if(S&&S.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,C),!(S.depthTexture&&S.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const Z=r.get(S.depthTexture);Z.__renderTarget=S,(!Z.__webglTexture||S.depthTexture.image.width!==S.width||S.depthTexture.image.height!==S.height)&&(S.depthTexture.image.width=S.width,S.depthTexture.image.height=S.height,S.depthTexture.needsUpdate=!0),W(S.depthTexture,0);const te=Z.__webglTexture,K=ut(S);if(S.depthTexture.format===zo)be(S)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,te,0,K):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,te,0);else if(S.depthTexture.format===Vo)be(S)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,te,0,K):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,te,0);else throw new Error("Unknown depthTexture format")}function We(C){const S=r.get(C),z=C.isWebGLCubeRenderTarget===!0;if(S.__boundDepthTexture!==C.depthTexture){const Z=C.depthTexture;if(S.__depthDisposeCallback&&S.__depthDisposeCallback(),Z){const te=()=>{delete S.__boundDepthTexture,delete S.__depthDisposeCallback,Z.removeEventListener("dispose",te)};Z.addEventListener("dispose",te),S.__depthDisposeCallback=te}S.__boundDepthTexture=Z}if(C.depthTexture&&!S.__autoAllocateDepthBuffer){if(z)throw new Error("target.depthTexture not supported in Cube render targets");const Z=C.texture.mipmaps;Z&&Z.length>0?Me(S.__webglFramebuffer[0],C):Me(S.__webglFramebuffer,C)}else if(z){S.__webglDepthbuffer=[];for(let Z=0;Z<6;Z++)if(n.bindFramebuffer(t.FRAMEBUFFER,S.__webglFramebuffer[Z]),S.__webglDepthbuffer[Z]===void 0)S.__webglDepthbuffer[Z]=t.createRenderbuffer(),Ne(S.__webglDepthbuffer[Z],C,!1);else{const te=C.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,K=S.__webglDepthbuffer[Z];t.bindRenderbuffer(t.RENDERBUFFER,K),t.framebufferRenderbuffer(t.FRAMEBUFFER,te,t.RENDERBUFFER,K)}}else{const Z=C.texture.mipmaps;if(Z&&Z.length>0?n.bindFramebuffer(t.FRAMEBUFFER,S.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,S.__webglFramebuffer),S.__webglDepthbuffer===void 0)S.__webglDepthbuffer=t.createRenderbuffer(),Ne(S.__webglDepthbuffer,C,!1);else{const te=C.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,K=S.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,K),t.framebufferRenderbuffer(t.FRAMEBUFFER,te,t.RENDERBUFFER,K)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}function $t(C,S,z){const Z=r.get(C);S!==void 0&&he(Z.__webglFramebuffer,C,C.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),z!==void 0&&We(C)}function Xe(C){const S=C.texture,z=r.get(C),Z=r.get(S);C.addEventListener("dispose",R);
vendor: 20,554 bytes, lines 4146-4170
4146const te=C.textures,K=C.isWebGLCubeRenderTarget===!0,Re=te.length>1;if(Re||(Z.__webglTexture===void 0&&(Z.__webglTexture=t.createTexture()),Z.__version=S.version,a.memory.textures++),K){z.__webglFramebuffer=[];for(let pe=0;pe<6;pe++)if(S.mipmaps&&S.mipmaps.length>0){z.__webglFramebuffer[pe]=[];for(let Le=0;Le<S.mipmaps.length;Le++)z.__webglFramebuffer[pe][Le]=t.createFramebuffer()}else z.__webglFramebuffer[pe]=t.createFramebuffer()}else{if(S.mipmaps&&S.mipmaps.length>0){z.__webglFramebuffer=[];for(let pe=0;pe<S.mipmaps.length;pe++)z.__webglFramebuffer[pe]=t.createFramebuffer()}else z.__webglFramebuffer=t.createFramebuffer();if(Re)for(let pe=0,Le=te.length;pe<Le;pe++){const Ae=r.get(te[pe]);Ae.__webglTexture===void 0&&(Ae.__webglTexture=t.createTexture(),a.memory.textures++)}if(C.samples>0&&be(C)===!1){z.__webglMultisampledFramebuffer=t.createFramebuffer(),z.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,z.__webglMultisampledFramebuffer);for(let pe=0;pe<te.length;pe++){const Le=te[pe];z.__webglColorRenderbuffer[pe]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,z.__webglColorRenderbuffer[pe]);const Ae=s.convert(Le.format,Le.colorSpace),ne=s.convert(Le.type),le=x(Le.internalFormat,Ae,ne,Le.colorSpace,C.isXRRenderTarget===!0),Fe=ut(C);t.renderbufferStorageMultisample(t.RENDERBUFFER,Fe,le,C.width,C.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+pe,t.RENDERBUFFER,z.__webglColorRenderbuffer[pe])}t.bindRenderbuffer(t.RENDERBUFFER,null),C.depthBuffer&&(z.__webglDepthRenderbuffer=t.createRenderbuffer(),Ne(z.__webglDepthRenderbuffer,C,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(K){n.bindTexture(t.TEXTURE_CUBE_MAP,Z.__webglTexture),Ee(t.TEXTURE_CUBE_MAP,S);for(let pe=0;pe<6;pe++)if(S.mipmaps&&S.mipmaps.length>0)for(let Le=0;Le<S.mipmaps.length;Le++)he(z.__webglFramebuffer[pe][Le],C,S,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+pe,Le);else he(z.__webglFramebuffer[pe],C,S,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+pe,0);m(S)&&h(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(Re){for(let pe=0,Le=te.length;pe<Le;pe++){const Ae=te[pe],ne=r.get(Ae);let le=t.TEXTURE_2D;(C.isWebGL3DRenderTarget||C.isWebGLArrayRenderTarget)&&(le=C.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(le,ne.__webglTexture),Ee(le,Ae),he(z.__webglFramebuffer,C,Ae,t.COLOR_ATTACHMENT0+pe,le,0),m(Ae)&&h(le)}n.unbindTexture()}else{let pe=t.TEXTURE_2D;if((C.isWebGL3DRenderTarget||C.isWebGLArrayRenderTarget)&&(pe=C.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(pe,Z.__webglTexture),Ee(pe,S),S.mipmaps&&S.mipmaps.length>0)for(let Le=0;Le<S.mipmaps.length;Le++)he(z.__webglFramebuffer[Le],C,S,t.COLOR_ATTACHMENT0,pe,Le);else he(z.__webglFramebuffer,C,S,t.COLOR_ATTACHMENT0,pe,0);m(S)&&h(pe),n.unbindTexture()}C.depthBuffer&&We(C)}function gt(C){const S=C.textures;for(let z=0,Z=S.length;z<Z;z++){const te=S[z];if(m(te)){const K=v(C),Re=r.get(te).__webglTexture;n.bindTexture(K,Re),h(K),n.unbindTexture()}}}const L=[],Ke=[];function Ye(C){if(C.samples>0){if(be(C)===!1){const S=C.textures,z=C.width,Z=C.height;let te=t.COLOR_BUFFER_BIT;const K=C.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Re=r.get(C),pe=S.length>1;if(pe)for(let Ae=0;Ae<S.length;Ae++)n.bindFramebuffer(t.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ae,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,Re.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ae,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,Re.__webglMultisampledFramebuffer);const Le=C.texture.mipmaps;Le&&Le.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Re.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Re.__webglFramebuffer);for(let Ae=0;Ae<S.length;Ae++){if(C.resolveDepthBuffer&&(C.depthBuffer&&(te|=t.DEPTH_BUFFER_BIT),C.stencilBuffer&&C.resolveStencilBuffer&&(te|=t.STENCIL_BUFFER_BIT)),pe){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Re.__webglColorRenderbuffer[Ae]);const ne=r.get(S[Ae]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,ne,0)}t.blitFramebuffer(0,0,z,Z,0,0,z,Z,te,t.NEAREST),l===!0&&(L.length=0,Ke.length=0,L.push(t.COLOR_ATTACHMENT0+Ae),C.depthBuffer&&C.resolveDepthBuffer===!1&&(L.push(K),Ke.push(K),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Ke)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,L))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),pe)for(let Ae=0;Ae<S.length;Ae++){n.bindFramebuffer(t.FRAMEBUFFER,Re.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ae,t.RENDERBUFFER,Re.__webglColorRenderbuffer[Ae]);const ne=r.get(S[Ae]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,Re.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+Ae,t.TEXTURE_2D,ne,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,Re.__webglMultisampledFramebuffer)}else if(C.depthBuffer&&C.resolveDepthBuffer===!1&&l){const S=C.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[S])}}}function ut(C){return Math.min(i.maxSamples,C.samples)}function be(C){const S=r.get(C);return C.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&S.__useRenderToTexture!==!1}function _t(C){const S=a.render.frame;u.get(C)!==S&&(u.set(C,S),C.update())}function Pe(C,S){const z=C.colorSpace,Z=C.format,te=C.type;return C.isCompressedTexture===!0||C.isVideoTexture===!0||z!==wa&&z!==mi&&(tt.getTransfer(z)===ot?(Z!==lr||te!==Sr)&&He("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):It("WebGLTextures: Unsupported texture color space:",z)),S}function je(C){return typeof HTMLImageElement<"u"&&C instanceof HTMLImageElement?(c.width=C.naturalWidth||C.width,c.height=C.naturalHeight||C.height):typeof VideoFrame<"u"&&C instanceof VideoFrame?(c.width=C.displayWidth,c.height=C.displayHeight):(c.width=C.width,c.height=C.height),c}this.allocateTextureUnit=B,this.resetTextureUnits=U,this.setTexture2D=W,this.setTexture2DArray=V,this.setTexture3D=Q,this.setTextureCube=D,this.rebindTextures=$t,this.setupRenderTarget=Xe,this.updateRenderTargetMipmap=gt,this.updateMultisampleRenderTarget=Ye,this.setupDepthRenderbuffer=We,this.setupFrameBufferTexture=he,this.useMultisampledRTT=be}function bP(t,e){function n(r,i=mi){let s;const a=tt.getTransfer(i);if(r===Sr)return t.UNSIGNED_BYTE;if(r===Op)return t.UNSIGNED_SHORT_4_4_4_4;if(r===Fp)return t.UNSIGNED_SHORT_5_5_5_1;if(r===K_)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===Y_)return t.UNSIGNED_INT_10F_11F_11F_REV;if(r===X_)return t.BYTE;if(r===q_)return t.SHORT;if(r===Fo)return t.UNSIGNED_SHORT;if(r===kp)return t.INT;if(r===fs)return t.UNSIGNED_INT;if(r===Vr)return t.FLOAT;if(r===Ca)return t.HALF_FLOAT;if(r===J_)return t.ALPHA;if(r===Z_)return t.RGB;if(r===lr)return t.RGBA;if(r===zo)return t.DEPTH_COMPONENT;if(r===Vo)return t.DEPTH_STENCIL;if(r===Q_)return t.RED;if(r===Bp)return t.RED_INTEGER;if(r===zp)return t.RG;if(r===Vp)return t.RG_INTEGER;if(r===jp)return t.RGBA_INTEGER;if(r===lc||r===cc||r===uc||r===dc)if(a===ot)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===lc)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===cc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===uc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===dc)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===lc)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===cc)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===uc)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===dc)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===Jh||r===Zh||r===Qh||r===ef)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===Jh)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===Zh)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Qh)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===ef)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===tf||r===nf||r===rf)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===tf||r===nf)return a===ot?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===rf)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===sf||r===af||r===of||r===lf||r===cf||r===uf||r===df||r===hf||r===ff||r===pf||r===mf||r===gf||r===xf||r===vf)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===sf)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===af)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===of)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===lf)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===cf)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===uf)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===df)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===hf)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===ff)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===pf)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===mf)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===gf)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===xf)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===vf)return a===ot?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===_f||r===yf||r===wf)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===_f)return a===ot?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===yf)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===wf)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===Sf||r===bf||r===Ef||r===Mf)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===Sf)return s.COMPRESSED_RED_RGTC1_EXT;if(r===bf)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===Ef)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===Mf)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Bo?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}const EP=`
4147void main() {
4148
4149	gl_Position = vec4( position, 1.0 );
4150
4151}`,MP=`
4152uniform sampler2DArray depthColor;
4153uniform float depthWidth;
4154uniform float depthHeight;
4155
4156void main() {
4157
4158	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4159
4160	if ( coord.x >= 1.0 ) {
4161
4162		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4163
4164	} else {
4165
4166		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4167
4168	}
4169
4170}`;class TP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n){if(this.texture===null){const r=new fy(e.texture);(e.depthNear!==n.depthNear||e.depthFar!==n.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,r=new Jr({vertexShader:EP,fragmentShader:MP,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new Er(new hu(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class AP extends Pa{constructor(e,n){super();const r=this;let i=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,d=null,f=null,p=null,g=null;const _=typeof XRWebGLBinding<"u",m=new TP,h={},v=n.getContextAttributes();let x=null,w=null;const A=[],E=[],R=new nt;let P=null;const M=new jn;M.viewport=new Pt;const b=new jn;b.viewport=new Pt;const N=[M,b],U=new $T;let B=null,X=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(H){let J=A[H];return J===void 0&&(J=new bd,A[H]=J),J.getTargetRaySpace()},this.getControllerGrip=function(H){let J=A[H];return J===void 0&&(J=new bd,A[H]=J),J.getGripSpace()},this.getHand=function(H){let J=A[H];return J===void 0&&(J=new bd,A[H]=J),J.getHandSpace()};function W(H){const J=E.indexOf(H.inputSource);if(J===-1)return;const he=A[J];he!==void 0&&(he.update(H.inputSource,H.frame,c||a),he.dispatchEvent({type:H.type,data:H.inputSource}))}function V(){i.removeEventListener("select",W),i.removeEventListener("selectstart",W),i.removeEventListener("selectend",W),i.removeEventListener("squeeze",W),i.removeEventListener("squeezestart",W),i.removeEventListener("squeezeend",W),i.removeEventListener("end",V),i.removeEventListener("inputsourceschange",Q);for(let H=0;H<A.length;H++){const J=E[H];J!==null&&(E[H]=null,A[H].disconnect(J))}B=null,X=null,m.reset();for(const H in h)delete h[H];e.setRenderTarget(x),p=null,f=null,d=null,i=null,w=null,ye.stop(),r.isPresenting=!1,e.setPixelRatio(P),e.setSize(R.width,R.height,!1),r.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(H){s=H,r.isPresenting===!0&&He("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(H){o=H,r.isPresenting===!0&&He("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(H){c=H},this.getBaseLayer=function(){return f!==null?f:p},this.getBinding=function(){return d===null&&_&&(d=new XRWebGLBinding(i,n)),d},this.getFrame=function(){return g},this.getSession=function(){return i},this.setSession=async function(H){if(i=H,i!==null){if(x=e.getRenderTarget(),i.addEventListener("select",W),i.addEventListener("selectstart",W),i.addEventListener("selectend",W),i.addEventListener("squeeze",W),i.addEventListener("squeezestart",W),i.addEventListener("squeezeend",W),i.addEventListener("end",V),i.addEventListener("inputsourceschange",Q),v.xrCompatible!==!0&&await n.makeXRCompatible(),P=e.getPixelRatio(),e.getSize(R),_&&"createProjectionLayer"in XRWebGLBinding.prototype){let he=null,Ne=null,Me=null;v.depth&&(Me=v.stencil?n.DEPTH24_STENCIL8:n.DEPTH_COMPONENT24,he=v.stencil?Vo:zo,Ne=v.stencil?Bo:fs);const We={colorFormat:n.RGBA8,depthFormat:Me,scaleFactor:s};d=this.getBinding(),f=d.createProjectionLayer(We),i.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),w=new ps(f.textureWidth,f.textureHeight,{format:lr,type:Sr,depthTexture:new hy(f.textureWidth,f.textureHeight,Ne,void 0,void 0,void 0,void 0,void 0,void 0,he),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}else{const he={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(i,n,he),i.updateRenderState({baseLayer:p}),e.setPixelRatio(1),e.setSize(p.framebufferWidth,p.framebufferHeight,!1),w=new ps(p.framebufferWidth,p.framebufferHeight,{format:lr,type:Sr,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:p.ignoreDepthValues===!1,resolveStencilBuffer:p.ignoreDepthValues===!1})}w.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await i.requestReferenceSpace(o),ye.setContext(i),ye.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};function Q(H){for(let J=0;J<H.removed.length;J++){const he=H.removed[J],Ne=E.indexOf(he);Ne>=0&&(E[Ne]=null,A[Ne].disconnect(he))}for(let J=0;J<H.added.length;J++){const he=H.added[J];let Ne=E.indexOf(he);if(Ne===-1){for(let We=0;We<A.length;We++)if(We>=E.length){E.push(he),Ne=We;break}else if(E[We]===null){E[We]=he,Ne=We;break}if(Ne===-1)break}const Me=A[Ne];Me&&Me.connect(he)}}const D=new $,q=new $;function Y(H,J,he){D.setFromMatrixPosition(J.matrixWorld),q.setFromMatrixPosition(he.matrixWorld);const Ne=D.distanceTo(q),Me=J.projectionMatrix.elements,We=he.projectionMatrix.elements,$t=Me[14]/(Me[10]-1),Xe=Me[14]/(Me[10]+1),gt=(Me[9]+1)/Me[5],L=(Me[9]-1)/Me[5],Ke=(Me[8]-1)/Me[0],Ye=(We[8]+1)/We[0],ut=$t*Ke,be=$t*Ye,_t=Ne/(-Ke+Ye),Pe=_t*-Ke;if(J.matrixWorld.decompose(H.position,H.quaternion,H.scale),H.translateX(Pe),H.translateZ(_t),H.matrixWorld.compose(H.position,H.quaternion,H.scale),H.matrixWorldInverse.copy(H.matrixWorld).invert(),Me[10]===-1)H.projectionMatrix.copy(J.projectionMatrix),H.projectionMatrixInverse.copy(J.projectionMatrixInverse);else{const je=$t+_t,C=Xe+_t,S=ut-Pe,z=be+(Ne-Pe),Z=gt*Xe/C*je,te=L*Xe/C*je;H.projectionMatrix.makePerspective(S,z,Z,te,je,C),H.projectionMatrixInverse.copy(H.projectionMatrix).invert()}}function de(H,J){J===null?H.matrixWorld.copy(H.matrix):H.matrixWorld.multiplyMatrices(J.matrixWorld,H.matrix),H.matrixWorldInverse.copy(H.matrixWorld).invert()}this.updateCamera=function(H){if(i===null)return;let J=H.near,he=H.far;m.texture!==null&&(m.depthNear>0&&(J=m.depthNear),m.depthFar>0&&(he=m.depthFar)),U.near=b.near=M.near=J,U.far=b.far=M.far=he,(B!==U.near||X!==U.far)&&(i.updateRenderState({depthNear:U.near,depthFar:U.far}),B=U.near,X=U.far),U.layers.mask=H.layers.mask|6,M.layers.mask=U.layers.mask&3,b.layers.mask=U.layers.mask&5;const Ne=H.parent,Me=U.cameras;de(U,Ne);for(let We=0;We<Me.length;We++)de(Me[We],Ne);Me.length===2?Y(U,M,b):U.projectionMatrix.copy(M.projectionMatrix),Ee(H,U,Ne)};function Ee(H,J,he){he===null?H.matrix.copy(J.matrixWorld):(H.matrix.copy(he.matrixWorld),H.matrix.invert(),H.matrix.multiply(J.matrixWorld)),H.matrix.decompose(H.position,H.quaternion,H.scale),H.updateMatrixWorld(!0),H.projectionMatrix.copy(J.projectionMatrix),H.projectionMatrixInverse.copy(J.projectionMatrixInverse),H.isPerspectiveCamera&&(H.fov=Tf*2*Math.atan(1/H.projectionMatrix.elements[5]),H.zoom=1)}this.getCamera=function(){return U},this.getFoveation=function(){if(!(f===null&&p===null))return l},this.setFoveation=function(H){l=H,f!==null&&(f.fixedFoveation=H),p!==null&&p.fixedFoveation!==void 0&&(p.fixedFoveation=H)},this.hasDepthSensing=function(){return m.texture!==null},this.getDepthSensingMesh=function(){return m.getMesh(U)},this.getCameraTexture=function(H){return h[H]};let se=null;function ae(H,J){if(u=J.getViewerPose(c||a),g=J,u!==null){const he=u.views;p!==null&&(e.setRenderTargetFramebuffer(w,p.framebuffer),e.setRenderTarget(w));let Ne=!1;he.length!==U.cameras.length&&(U.cameras.length=0,Ne=!0);for(let Xe=0;Xe<he.length;Xe++){const gt=he[Xe];let L=null;if(p!==null)L=p.getViewport(gt);else{const Ye=d.getViewSubImage(f,gt);L=Ye.viewport,Xe===0&&(e.setRenderTargetTextures(w,Ye.colorTexture,Ye.depthStencilTexture),e.setRenderTarget(w))}let Ke=N[Xe];Ke===void 0&&(Ke=new jn,Ke.layers.enable(Xe),Ke.viewport=new Pt,N[Xe]=Ke),Ke.matrix.fromArray(gt.transform.matrix),Ke.matrix.decompose(Ke.position,Ke.quaternion,Ke.scale),Ke.projectionMatrix.fromArray(gt.projectionMatrix),Ke.projectionMatrixInverse.copy(Ke.projectionMatrix).invert(),Ke.viewport.set(L.x,L.y,L.width,L.height),Xe===0&&(U.matrix.copy(Ke.matrix),U.matrix.decompose(U.position,U.quaternion,U.scale)),Ne===!0&&U.cameras.push(Ke)}const Me=i.enabledFeatures;if(Me&&Me.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&_){d=r.getBinding();const Xe=d.getDepthInformation(he[0]);Xe&&Xe.isValid&&Xe.texture&&m.init(Xe,i.renderState)}if(Me&&Me.includes("camera-access")&&_){e.state.unbindTexture(),d=r.getBinding();for(let Xe=0;Xe<he.length;Xe++){const gt=he[Xe].camera;if(gt){let L=h[gt];L||(L=new fy,h[gt]=L);const Ke=d.getCameraImage(gt);L.sourceTexture=Ke}}}}for(let he=0;he<A.length;he++){const Ne=E[he],Me=A[he];Ne!==null&&Me!==void 0&&Me.update(Ne,J,c||a)}se&&se(H,J),J.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:J}),g=null}const ye=new gy;ye.setAnimationLoop(ae),this.setAnimationLoop=function(H){se=H},this.dispose=function(){}}}const Wi=new br,RP=new Nt;function CP(t,e){function n(m,h){m.matrixAutoUpdate===!0&&m.updateMatrix(),h.value.copy(m.matrix)}function r(m,h){h.color.getRGB(m.fogColor.value,cy(t)),h.isFog?(m.fogNear.value=h.near,m.fogFar.value=h.far):h.isFogExp2&&(m.fogDensity.value=h.density)}function i(m,h,v,x,w){h.isMeshBasicMaterial||h.isMeshLambertMaterial?s(m,h):h.isMeshToonMaterial?(s(m,h),d(m,h)):h.isMeshPhongMaterial?(s(m,h),u(m,h)):h.isMeshStandardMaterial?(s(m,h),f(m,h),h.isMeshPhysicalMaterial&&p(m,h,w)):h.isMeshMat
vendor: 4,379 bytes, line 4170
4170capMaterial?(s(m,h),g(m,h)):h.isMeshDepthMaterial?s(m,h):h.isMeshDistanceMaterial?(s(m,h),_(m,h)):h.isMeshNormalMaterial?s(m,h):h.isLineBasicMaterial?(a(m,h),h.isLineDashedMaterial&&o(m,h)):h.isPointsMaterial?l(m,h,v,x):h.isSpriteMaterial?c(m,h):h.isShadowMaterial?(m.color.value.copy(h.color),m.opacity.value=h.opacity):h.isShaderMaterial&&(h.uniformsNeedUpdate=!1)}function s(m,h){m.opacity.value=h.opacity,h.color&&m.diffuse.value.copy(h.color),h.emissive&&m.emissive.value.copy(h.emissive).multiplyScalar(h.emissiveIntensity),h.map&&(m.map.value=h.map,n(h.map,m.mapTransform)),h.alphaMap&&(m.alphaMap.value=h.alphaMap,n(h.alphaMap,m.alphaMapTransform)),h.bumpMap&&(m.bumpMap.value=h.bumpMap,n(h.bumpMap,m.bumpMapTransform),m.bumpScale.value=h.bumpScale,h.side===wn&&(m.bumpScale.value*=-1)),h.normalMap&&(m.normalMap.value=h.normalMap,n(h.normalMap,m.normalMapTransform),m.normalScale.value.copy(h.normalScale),h.side===wn&&m.normalScale.value.negate()),h.displacementMap&&(m.displacementMap.value=h.displacementMap,n(h.displacementMap,m.displacementMapTransform),m.displacementScale.value=h.displacementScale,m.displacementBias.value=h.displacementBias),h.emissiveMap&&(m.emissiveMap.value=h.emissiveMap,n(h.emissiveMap,m.emissiveMapTransform)),h.specularMap&&(m.specularMap.value=h.specularMap,n(h.specularMap,m.specularMapTransform)),h.alphaTest>0&&(m.alphaTest.value=h.alphaTest);const v=e.get(h),x=v.envMap,w=v.envMapRotation;x&&(m.envMap.value=x,Wi.copy(w),Wi.x*=-1,Wi.y*=-1,Wi.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(Wi.y*=-1,Wi.z*=-1),m.envMapRotation.value.setFromMatrix4(RP.makeRotationFromEuler(Wi)),m.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=h.reflectivity,m.ior.value=h.ior,m.refractionRatio.value=h.refractionRatio),h.lightMap&&(m.lightMap.value=h.lightMap,m.lightMapIntensity.value=h.lightMapIntensity,n(h.lightMap,m.lightMapTransform)),h.aoMap&&(m.aoMap.value=h.aoMap,m.aoMapIntensity.value=h.aoMapIntensity,n(h.aoMap,m.aoMapTransform))}function a(m,h){m.diffuse.value.copy(h.color),m.opacity.value=h.opacity,h.map&&(m.map.value=h.map,n(h.map,m.mapTransform))}function o(m,h){m.dashSize.value=h.dashSize,m.totalSize.value=h.dashSize+h.gapSize,m.scale.value=h.scale}function l(m,h,v,x){m.diffuse.value.copy(h.color),m.opacity.value=h.opacity,m.size.value=h.size*v,m.scale.value=x*.5,h.map&&(m.map.value=h.map,n(h.map,m.uvTransform)),h.alphaMap&&(m.alphaMap.value=h.alphaMap,n(h.alphaMap,m.alphaMapTransform)),h.alphaTest>0&&(m.alphaTest.value=h.alphaTest)}function c(m,h){m.diffuse.value.copy(h.color),m.opacity.value=h.opacity,m.rotation.value=h.rotation,h.map&&(m.map.value=h.map,n(h.map,m.mapTransform)),h.alphaMap&&(m.alphaMap.value=h.alphaMap,n(h.alphaMap,m.alphaMapTransform)),h.alphaTest>0&&(m.alphaTest.value=h.alphaTest)}function u(m,h){m.specular.value.copy(h.specular),m.shininess.value=Math.max(h.shininess,1e-4)}function d(m,h){h.gradientMap&&(m.gradientMap.value=h.gradientMap)}function f(m,h){m.metalness.value=h.metalness,h.metalnessMap&&(m.metalnessMap.value=h.metalnessMap,n(h.metalnessMap,m.metalnessMapTransform)),m.roughness.value=h.roughness,h.roughnessMap&&(m.roughnessMap.value=h.roughnessMap,n(h.roughnessMap,m.roughnessMapTransform)),h.envMap&&(m.envMapIntensity.value=h.envMapIntensity)}function p(m,h,v){m.ior.value=h.ior,h.sheen>0&&(m.sheenColor.value.copy(h.sheenColor).multiplyScalar(h.sheen),m.sheenRoughness.value=h.sheenRoughness,h.sheenColorMap&&(m.sheenColorMap.value=h.sheenColorMap,n(h.sheenColorMap,m.sheenColorMapTransform)),h.sheenRoughnessMap&&(m.sheenRoughnessMap.value=h.sheenRoughnessMap,n(h.sheenRoughnessMap,m.sheenRoughnessMapTransform))),h.clearcoat>0&&(m.clearcoat.value=h.clearcoat,m.clearcoatRoughness.value=h.clearcoatRoughness,h.clearcoatMap&&(m.clearcoatMap.value=h.clearcoatMap,n(h.clearcoatMap,m.clearcoatMapTransform)),h.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=h.clearcoatRoughnessMap,n(h.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),h.clearcoatNormalMap&&(m.clearcoatNormalMap.value=h.clearcoatNormalMap,n(h.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(h.clearcoatNormalScale),h.side===wn&&m.clearcoatNormalScale.value.negate())),h.dispersion>0&&(m.dispersion.value=h.dispersion),h.iridescence>0&&(m.iridescence.value=h.iridescence,m.iridescenceIOR.value=h.iridescenceIOR,m.
vendor: 4,920 bytes, line 4170
4170iridescenceThicknessMinimum.value=h.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=h.iridescenceThicknessRange[1],h.iridescenceMap&&(m.iridescenceMap.value=h.iridescenceMap,n(h.iridescenceMap,m.iridescenceMapTransform)),h.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=h.iridescenceThicknessMap,n(h.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),h.transmission>0&&(m.transmission.value=h.transmission,m.transmissionSamplerMap.value=v.texture,m.transmissionSamplerSize.value.set(v.width,v.height),h.transmissionMap&&(m.transmissionMap.value=h.transmissionMap,n(h.transmissionMap,m.transmissionMapTransform)),m.thickness.value=h.thickness,h.thicknessMap&&(m.thicknessMap.value=h.thicknessMap,n(h.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=h.attenuationDistance,m.attenuationColor.value.copy(h.attenuationColor)),h.anisotropy>0&&(m.anisotropyVector.value.set(h.anisotropy*Math.cos(h.anisotropyRotation),h.anisotropy*Math.sin(h.anisotropyRotation)),h.anisotropyMap&&(m.anisotropyMap.value=h.anisotropyMap,n(h.anisotropyMap,m.anisotropyMapTransform))),m.specularIntensity.value=h.specularIntensity,m.specularColor.value.copy(h.specularColor),h.specularColorMap&&(m.specularColorMap.value=h.specularColorMap,n(h.specularColorMap,m.specularColorMapTransform)),h.specularIntensityMap&&(m.specularIntensityMap.value=h.specularIntensityMap,n(h.specularIntensityMap,m.specularIntensityMapTransform))}function g(m,h){h.matcap&&(m.matcap.value=h.matcap)}function _(m,h){const v=e.get(h).light;m.referencePosition.value.setFromMatrixPosition(v.matrixWorld),m.nearDistance.value=v.shadow.camera.near,m.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function PP(t,e,n,r){let i={},s={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,x){const w=x.program;r.uniformBlockBinding(v,w)}function c(v,x){let w=i[v.id];w===void 0&&(g(v),w=u(v),i[v.id]=w,v.addEventListener("dispose",m));const A=x.program;r.updateUBOMapping(v,A);const E=e.render.frame;s[v.id]!==E&&(f(v),s[v.id]=E)}function u(v){const x=d();v.__bindingPointIndex=x;const w=t.createBuffer(),A=v.__size,E=v.usage;return t.bindBuffer(t.UNIFORM_BUFFER,w),t.bufferData(t.UNIFORM_BUFFER,A,E),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,x,w),w}function d(){for(let v=0;v<o;v++)if(a.indexOf(v)===-1)return a.push(v),v;return It("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(v){const x=i[v.id],w=v.uniforms,A=v.__cache;t.bindBuffer(t.UNIFORM_BUFFER,x);for(let E=0,R=w.length;E<R;E++){const P=Array.isArray(w[E])?w[E]:[w[E]];for(let M=0,b=P.length;M<b;M++){const N=P[M];if(p(N,E,M,A)===!0){const U=N.__offset,B=Array.isArray(N.value)?N.value:[N.value];let X=0;for(let W=0;W<B.length;W++){const V=B[W],Q=_(V);typeof V=="number"||typeof V=="boolean"?(N.__data[0]=V,t.bufferSubData(t.UNIFORM_BUFFER,U+X,N.__data)):V.isMatrix3?(N.__data[0]=V.elements[0],N.__data[1]=V.elements[1],N.__data[2]=V.elements[2],N.__data[3]=0,N.__data[4]=V.elements[3],N.__data[5]=V.elements[4],N.__data[6]=V.elements[5],N.__data[7]=0,N.__data[8]=V.elements[6],N.__data[9]=V.elements[7],N.__data[10]=V.elements[8],N.__data[11]=0):(V.toArray(N.__data,X),X+=Q.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,U,N.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function p(v,x,w,A){const E=v.value,R=x+"_"+w;if(A[R]===void 0)return typeof E=="number"||typeof E=="boolean"?A[R]=E:A[R]=E.clone(),!0;{const P=A[R];if(typeof E=="number"||typeof E=="boolean"){if(P!==E)return A[R]=E,!0}else if(P.equals(E)===!1)return P.copy(E),!0}return!1}function g(v){const x=v.uniforms;let w=0;const A=16;for(let R=0,P=x.length;R<P;R++){const M=Array.isArray(x[R])?x[R]:[x[R]];for(let b=0,N=M.length;b<N;b++){const U=M[b],B=Array.isArray(U.value)?U.value:[U.value];for(let X=0,W=B.length;X<W;X++){const V=B[X],Q=_(V),D=w%A,q=D%Q.boundary,Y=D+q;w+=q,Y!==0&&A-Y<Q.storage&&(w+=A-Y),U.__data=new Float32Array(Q.storage/Float32Array.BYTES_PER_ELEMENT),U.__offset=w,w+=Q.storage}}}const E=w%A;return E>0&&(w+=A-E),v.__size=w,v.__cache={},this}function _(v){const x={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(x.boundary=4,x.storage=4):v.isVector2?(x.boundary=8,x.storage=8):v.isVector3||v.isColor?(x.boundary=16,x.storage=12):v.isVector4?(x.boundary=16,x.storage=16):v.isMatrix3?(x.boundary=48,x.storage=48):v.isMatrix4?(x.boundary=64,x.storage=64):v.isTexture?He("WebGLRenderer: Texture samplers can not be part of an uniforms group."):He("WebGLRenderer: Unsupported uniform value type.",v),x}function m(v){const x=v.target;x.removeEventListener("dispose",m);const w=a.indexOf(x.__bindingPointIndex);a.splice(w,1),t.deleteBuffer(i[x.id]),delete i[x.id],delete s[x.id]}function h(){for(const v in i)t.deleteBuffer(i[v]);a=[],i={},s={}}return{bind:l,update:c,dispose:h}}const NP
vendor: 11,603 bytes, line 4170
4170=new Uint16Array([11481,15204,11534,15171,11808,15015,12385,14843,12894,14716,13396,14600,13693,14483,13976,14366,14237,14171,14405,13961,14511,13770,14605,13598,14687,13444,14760,13305,14822,13066,14876,12857,14923,12675,14963,12517,14997,12379,15025,12230,15049,12023,15070,11843,15086,11687,15100,11551,15111,11433,15120,11330,15127,11217,15132,11060,15135,10922,15138,10801,15139,10695,15139,10600,13012,14923,13020,14917,13064,14886,13176,14800,13349,14666,13513,14526,13724,14398,13960,14230,14200,14020,14383,13827,14488,13651,14583,13491,14667,13348,14740,13132,14803,12908,14856,12713,14901,12542,14938,12394,14968,12241,14992,12017,15010,11822,15024,11654,15034,11507,15041,11380,15044,11269,15044,11081,15042,10913,15037,10764,15031,10635,15023,10520,15014,10419,15003,10330,13657,14676,13658,14673,13670,14660,13698,14622,13750,14547,13834,14442,13956,14317,14112,14093,14291,13889,14407,13704,14499,13538,14586,13389,14664,13201,14733,12966,14792,12758,14842,12577,14882,12418,14915,12272,14940,12033,14959,11826,14972,11646,14980,11490,14983,11355,14983,11212,14979,11008,14971,10830,14961,10675,14950,10540,14936,10420,14923,10315,14909,10204,14894,10041,14089,14460,14090,14459,14096,14452,14112,14431,14141,14388,14186,14305,14252,14130,14341,13941,14399,13756,14467,13585,14539,13430,14610,13272,14677,13026,14737,12808,14790,12617,14833,12449,14869,12303,14896,12065,14916,11845,14929,11655,14937,11490,14939,11347,14936,11184,14930,10970,14921,10783,14912,10621,14900,10480,14885,10356,14867,10247,14848,10062,14827,9894,14805,9745,14400,14208,14400,14206,14402,14198,14406,14174,14415,14122,14427,14035,14444,13913,14469,13767,14504,13613,14548,13463,14598,13324,14651,13082,14704,12858,14752,12658,14795,12483,14831,12330,14860,12106,14881,11875,14895,11675,14903,11501,14905,11351,14903,11178,14900,10953,14892,10757,14880,10589,14865,10442,14847,10313,14827,10162,14805,9965,14782,9792,14757,9642,14731,9507,14562,13883,14562,13883,14563,13877,14566,13862,14570,13830,14576,13773,14584,13689,14595,13582,14613,13461,14637,13336,14668,13120,14704,12897,14741,12695,14776,12516,14808,12358,14835,12150,14856,11910,14870,11701,14878,11519,14882,11361,14884,11187,14880,10951,14871,10748,14858,10572,14842,10418,14823,10286,14801,10099,14777,9897,14751,9722,14725,9567,14696,9430,14666,9309,14702,13604,14702,13604,14702,13600,14703,13591,14705,13570,14707,13533,14709,13477,14712,13400,14718,13305,14727,13106,14743,12907,14762,12716,14784,12539,14807,12380,14827,12190,14844,11943,14855,11727,14863,11539,14870,11376,14871,11204,14868,10960,14858,10748,14845,10565,14829,10406,14809,10269,14786,10058,14761,9852,14734,9671,14705,9512,14674,9374,14641,9253,14608,9076,14821,13366,14821,13365,14821,13364,14821,13358,14821,13344,14821,13320,14819,13252,14817,13145,14815,13011,14814,12858,14817,12698,14823,12539,14832,12389,14841,12214,14850,11968,14856,11750,14861,11558,14866,11390,14867,11226,14862,10972,14853,10754,14840,10565,14823,10401,14803,10259,14780,10032,14754,9820,14725,9635,14694,9473,14661,9333,14627,9203,14593,8988,14557,8798,14923,13014,14922,13014,14922,13012,14922,13004,14920,12987,14919,12957,14915,12907,14909,12834,14902,12738,14894,12623,14888,12498,14883,12370,14880,12203,14878,11970,14875,11759,14873,11569,14874,11401,14872,11243,14865,10986,14855,10762,14842,10568,14825,10401,14804,10255,14781,10017,14754,9799,14725,9611,14692,9445,14658,9301,14623,9139,14587,8920,14548,8729,14509,8562,15008,12672,15008,12672,15008,12671,15007,12667,15005,12656,15001,12637,14997,12605,14989,12556,14978,12490,14966,12407,14953,12313,14940,12136,14927,11934,14914,11742,14903,11563,14896,11401,14889,11247,14879,10992,14866,10767,14851,10570,14833,10400,14812,10252,14789,10007,14761,9784,14731,9592,14698,9424,14663,9279,14627,9088,14588,8868,14548,8676,14508,8508,14467,8360,15080,12386,15080,12386,15079,12385,15078,12383,15076,12378,15072,12367,15066,12347,15057,12315,15045,12253,15030,12138,15012,11998,14993,11845,14972,11685,14951,11530,14935,11383,14920,11228,14904,10981,14887,10762,14870,10567,14850,10397,14827,10248,14803,9997,14774,9771,14743,9578,14710,9407,14674,9259,14637,9048,14596,8826,14555,8632,14514,8464,14471,8317,14427,8182,15139,12008,15139,12008,15138,12008,15137,12007,15135,12003,15130,11990,15124,11969,15115,11929,15102,11872,15086,11794,15064,11693,15041,11581,15013,11459,14987,11336,14966,11170,14944,10944,14921,10738,14898,10552,14875,10387,14850,10239,14824,9983,14794,9758,14762,9563,14728,9392,14692,9244,14653,9014,14611,8791,14569,8597,14526,8427,14481,8281,14436,8110,14391,7885,15188,11617,15188,11617,15187,11617,15186,11618,15183,11617,15179,11612,15173,11601,15163,11581,15150,11546,15133,11495,15110,11427,15083,11346,15051,11246,15024,11057,14996,10868,14967,10687,14938,10517,14911,10362,14882,10206,14853,9956,14821,9737,14787,9543,14752,9375,14715,9228,14675,8980,14632,8760,14589,8565,14544,8395,14498,8248,14451,8049,14404,7824,14357,7630,15228,11298,15228,11298,15227,11299,15226,11301,15223,11303,15219,11302,15213,11299,15204,11290,15191,11271,15174,11217,15150,11129,15119,11015,15087,10886,15057,10744,15024,10599,14990,10455,14957,10318,14924,10143,14891,9911,14856,9701,14820,9516,14782,9352,14744,9200,14703,8946,14659,8725,14615,8533,14568,8366,14521,8220,14472,7992,14423,7770,14374,7578,14315,7408,15260,10819,15260,10819,15259,10822,15258,10826,15256,10832,15251,10836,15246,10841,15237,10838,15225,10821,15207,10788,15183,10734,15151,10660,15120,10571,15087,10469,15049,10359,15012,10249,14974,10041,14937,9837,14900,9647,14860,9475,14820,9320,14779,9147,14736,8902,14691,8688,14646,8499,14598,8335,14549,8189,14499,7940,14448,7720,14397,7529,14347,7363,14256,7218,15285,10410,15285,10411,15285,10413,15284,10418,15282,10425,15278,10434,15272,10442,15264,10449,15252,10445,15235,10433,15210,10403,15179,10358,15149,10301,15113,10218,15073,10059,15033,9894,14991,9726,14951,9565,14909,9413,14865,9273,14822,9073,14777,8845,14730,8641,14682,8459,14633,8300,14583,8129,14531,7883,14479,7670,14426,7482,14373,7321,14305,7176,14201,6939,15305,9939,15305,9940,15305,9945,15304,9955,15302,9967,15298,9989,15293,10010,15286,10033,15274,10044,15258,10045,15233,10022,15205,9975,15174,9903,15136,9808,15095,9697,15053,9578,15009,9451,14965,9327,14918,9198,14871,8973,14825,8766,14775,8579,14725,8408,14675,8259,14622,8058,14569,7821,14515,7615,14460,7435,14405,7276,14350,7108,14256,6866,14149,6653,15321,9444,15321,9445,15321,9448,15320,9458,15317,9470,15314,9490,15310,9515,15302,9540,15292,9562,15276,9579,15251,9577,15226,9559,15195,9519,15156,9463,15116,9389,15071,9304,15025,9208,14978,9023,14927,8838,14878,8661,14827,8496,14774,8344,14722,8206,14667,7973,14612,7749,14556,7555,14499,7382,14443,7229,14385,7025,14322,6791,14210,6588,14100,6409,15333,8920,15333,8921,15332,8927,15332,8943,15329,8965,15326,9002,15322,9048,15316,9106,15307,9162,15291,9204,15267,9221,15244,9221,15212,9196,15175,9134,15133,9043,15088,8930,15040,8801,14990,8665,14938,8526,14886,8391,14830,8261,14775,8087,14719,7866,14661,7664,14603,7482,14544,7322,14485,7178,14426,6936,14367,6713,14281,6517,14166,6348,14054,6198,15341,8360,15341,8361,15341,8366,15341,8379,15339,8399,15336,8431,15332,8473,15326,8527,15318,8585,15302,8632,15281,8670,15258,8690,15227,8690,15191,8664,15149,8612,15104,8543,15055,8456,15001,8360,14948,8259,14892,8122,14834,7923,14776,7734,14716,7558,14656,7397,14595,7250,14534,7070,14472,6835,14410,6628,14350,6443,14243,6283,14125,6135,14010,5889,15348,7715,15348,7717,15348,7725,15347,7745,15345,7780,15343,7836,15339,7905,15334,8e3,15326,8103,15310,8193,15293,8239,15270,8270,15240,8287,15204,8283,15163,8260,15118,8223,15067,8143,15014,8014,14958,7873,14899,7723,14839,7573,14778,7430,14715,7293,14652,7164,14588,6931,14524,6720,14460,6531,14396,6362,14330,6210,14207,6015,14086,5781,13969,5576,15352,7114,15352,7116,15352,7128,15352,7159,15350,7195,15348,7237,15345,7299,15340,7374,15332,7457,15317,7544,15301,7633,15280,7703,15251,7754,15216,7775,15176,7767,15131,7733,15079,7670,15026,7588,14967,7492,14906,7387,14844,7278,14779,7171,14714,6965,14648,6770,14581,6587,14515,6420,14448,6269,14382,6123,14299,5881,14172,5665,14049,5477,13929,5310,15355,6329,15355,6330,15355,6339,15355,6362,15353,6410,15351,6472,15349,6572,15344,6688,15337,6835,15323,6985,15309,7142,15287,7220,15260,7277,15226,7310,15188,7326,15142,7318,15090,7285,15036,7239,14976,7177,14914,7045,14849,6892,14782,6736,14714,6581,14645,6433,14576,6293,14506,6164,14438,5946,14369,5733,14270,5540,14140,5369,14014,5216,13892,5043,15357,5483,15357,5484,15357,5496,15357,5528,15356,5597,15354,5692,15351,5835,15347,6011,15339,6195,15328,6317,15314,6446,15293,6566,15268,6668,15235,6746,15197,6796,15152,6811,15101,6790,15046,6748,14985,6673,14921,6583,14854,6479,14785,6371,14714,6259,14643,6149,14571,5946,14499,5750,14428,5567,14358,5401,14242,5250,14109,5111,13980,4870,13856,4657,15359,4555,15359,4557,15358,4573,15358,4633,15357,4715,15355,4841,15353,5061,15349,5216,15342,5391,15331,5577,15318,5770,15299,5967,15274,6150,15243,6223,15206,6280,15161,6310,15111,6317,15055,6300,14994,6262,14928,6208,14860,6141,14788,5994,14715,5838,14641,5684,14566,5529,14492,5384,14418,5247,14346,5121,14216,4892,14079,4682,13948,4496,13822,4330,15359,3498,15359,3501,15359,3520,15359,3598,15358,3719,15356,3860,15355,4137,15351,4305,15344,4563,15334,4809,15321,5116,15303,5273,15280,5418,15250,5547,15214,5653,15170,5722,15120,5761,15064,5763,15002,5733,14935,5673,14865,5597,14792,5504,14716,5400,14640,5294,14563,5185,14486,5041,14410,4841,14335,4655,14191,4482,14051,4325,13918,4183,13790,4012,15360,2282,15360,2285,15360,2306,15360,2401,15359,2547,15357,2748,15355,3103,15352,3349,15345,3675,15336,4020,15324,4272,15307,4496,15285,4716,15255,4908,15220,5086,15178,5170,15128,5214,15072,5234,15010,5231,14943,5206,14871,5166,14796,5102,14718,4971,14639,4833,14559,4687,14480,4541,14402,4401,14315,4268,14167,4142,14025,3958,13888,3747,13759,3556,15360,923,15360,925,15360,946,15360,1052,15359,1214,15357,1494,15356,1892,15352,2274,15346,2663,15338,3099,15326,3393,15309,3679,15288,3980,15260,4183,15226,4325,15185,4437,15136,4517,15080,4570,15018,4591,14950,4581,14877,4545,14800,4485,14720,4411,14638,4325,14556,4231,14475,4136,14395,3988,14297,3803,14145,3628,13999,3465,13861,3314,13729,3177,15360,263,15360,264,15360,272,15360,325,15359,407,15358,548,15356,780,15352,1144,15347,1580,15339,2099,15328,2425,15312,2795,15292,3133,15264,3329,15232,3517,15191,3689,15143,3819,15088,3923,15025,3978,14956,3999,14882,3979,14804,3931,14722,3855,14639,3756,14554,3645,14470,3529,14388,3409,14279,3289,14124,3173,13975,3055,13834,2848,13701,2658,15360,49,15360,49,15360,52,15360,75,15359,111,15358,201,15356,283,15353,519,15348,726,15340,1045,15329,1415,15314,1795,15295,2173,15269,2410,15237,2649,15197,2866,15150,3054,15095,3140,15032,3196,14963,3228,14888,3236,14808,3224,14725,3191,14639,3146,14553,3088,14466,2976,14382,2836,14262,2692,14103,2549,13952,2409,13808,2278,13674,2154,15360,4,15360,4,15360,4,15360,13,15359,33,15358,59,15357,112,15353,199,15348,302,15341,456,15331,628,15316,827,15297,1082,15272,1332,15241,1601,15202,1851,15156,2069,15101,2172,15039,2256,14970,2314,14894,2348,14813,2358,14728,2344,14640,2311,14551,2263,14463,2203,14376,2133,14247,2059,14084,1915,13930,1761,13784,1609,13648,1464,15360,0,15360,0,15360,0,15360,3,15359,18,15358,26,15357,53,15354,80,15348,97,15341,165,15332,238,15318,326,15299,427,15275,529,15245,654,15207,771,15161,885,15108,994,15046,1089,14976,1170,14900,1229,14817,1266,14731,1284,14641,1282,14550,1260,14460,1223,14370,1174,14232,1116,14066,1050,13909,981,13761,910,13623,839]);let 
vendor: 10,331 bytes, line 4170
4170Lr=null;function LP(){return Lr===null&&(Lr=new UT(NP,32,32,zp,Ca),Lr.minFilter=Gn,Lr.magFilter=Gn,Lr.wrapS=zr,Lr.wrapT=zr,Lr.generateMipmaps=!1,Lr.needsUpdate=!0),Lr}class IP{constructor(e={}){const{canvas:n=aT(),context:r=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1,reversedDepthBuffer:f=!1}=e;this.isWebGLRenderer=!0;let p;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=r.getContextAttributes().alpha}else p=a;const g=new Set([jp,Vp,Bp]),_=new Set([Sr,fs,Fo,Bo,Op,Fp]),m=new Uint32Array(4),h=new Int32Array(4);let v=null,x=null;const w=[],A=[];this.domElement=n,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.toneMapping=Ai,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const E=this;let R=!1;this._outputColorSpace=Bn;let P=0,M=0,b=null,N=-1,U=null;const B=new Pt,X=new Pt;let W=null;const V=new rt(0);let Q=0,D=n.width,q=n.height,Y=1,de=null,Ee=null;const se=new Pt(0,0,D,q),ae=new Pt(0,0,D,q);let ye=!1;const H=new Wp;let J=!1,he=!1;const Ne=new Nt,Me=new $,We=new Pt,$t={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Xe=!1;function gt(){return b===null?Y:1}let L=r;function Ke(T,O){return n.getContext(T,O)}try{const T={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Up}`),n.addEventListener("webglcontextlost",ie,!1),n.addEventListener("webglcontextrestored",ee,!1),n.addEventListener("webglcontextcreationerror",we,!1),L===null){const O="webgl2";if(L=Ke(O,T),L===null)throw Ke(O)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(T){throw T("WebGLRenderer: "+T.message),T}let Ye,ut,be,_t,Pe,je,C,S,z,Z,te,K,Re,pe,Le,Ae,ne,le,Fe,De,xe,ze,I,me;function ce(){Ye=new VR(L),Ye.init(),ze=new bP(L,Ye),ut=new LR(L,Ye,e,ze),be=new wP(L,Ye),ut.reversedDepthBuffer&&f&&be.buffers.depth.setReversed(!0),_t=new GR(L),Pe=new lP,je=new SP(L,Ye,be,Pe,ut,ze,_t),C=new DR(E),S=new zR(E),z=new qT(L),I=new PR(L,z),Z=new jR(L,z,_t,I),te=new $R(L,Z,z,_t),Fe=new WR(L,ut,je),Ae=new IR(Pe),K=new oP(E,C,S,Ye,ut,I,Ae),Re=new CP(E,Pe),pe=new uP,Le=new gP(Ye),le=new CR(E,C,S,be,te,p,l),ne=new _P(E,te,ut),me=new PP(L,_t,ut,be),De=new NR(L,Ye,_t),xe=new HR(L,Ye,_t),_t.programs=K.programs,E.capabilities=ut,E.extensions=Ye,E.properties=Pe,E.renderLists=pe,E.shadowMap=ne,E.state=be,E.info=_t}ce();const ue=new AP(E,L);this.xr=ue,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){const T=Ye.get("WEBGL_lose_context");T&&T.loseContext()},this.forceContextRestore=function(){const T=Ye.get("WEBGL_lose_context");T&&T.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(T){T!==void 0&&(Y=T,this.setSize(D,q,!1))},this.getSize=function(T){return T.set(D,q)},this.setSize=function(T,O,j=!0){if(ue.isPresenting){He("WebGLRenderer: Can't change size while VR device is presenting.");return}D=T,q=O,n.width=Math.floor(T*Y),n.height=Math.floor(O*Y),j===!0&&(n.style.width=T+"px",n.style.height=O+"px"),this.setViewport(0,0,T,O)},this.getDrawingBufferSize=function(T){return T.set(D*Y,q*Y).floor()},this.setDrawingBufferSize=function(T,O,j){D=T,q=O,Y=j,n.width=Math.floor(T*j),n.height=Math.floor(O*j),this.setViewport(0,0,T,O)},this.getCurrentViewport=function(T){return T.copy(B)},this.getViewport=function(T){return T.copy(se)},this.setViewport=function(T,O,j,G){T.isVector4?se.set(T.x,T.y,T.z,T.w):se.set(T,O,j,G),be.viewport(B.copy(se).multiplyScalar(Y).round())},this.getScissor=function(T){return T.copy(ae)},this.setScissor=function(T,O,j,G){T.isVector4?ae.set(T.x,T.y,T.z,T.w):ae.set(T,O,j,G),be.scissor(X.copy(ae).multiplyScalar(Y).round())},this.getScissorTest=function(){return ye},this.setScissorTest=function(T){be.setScissorTest(ye=T)},this.setOpaqueSort=function(T){de=T},this.setTransparentSort=function(T){Ee=T},this.getClearColor=function(T){return T.copy(le.getClearColor())},this.setClearColor=function(){le.setClearColor(...arguments)},this.getClearAlpha=function(){return le.getClearAlpha()},this.setClearAlpha=function(){le.setClearAlpha(...arguments)},this.clear=function(T=!0,O=!0,j=!0){let G=0;if(T){let F=!1;if(b!==null){const oe=b.texture.format;F=g.has(oe)}if(F){const oe=b.texture.type,ge=_.has(oe),Se=le.getClearColor(),_e=le.getClearAlpha(),Oe=Se.r,Be=Se.g,Ce=Se.b;ge?(m[0]=Oe,m[1]=Be,m[2]=Ce,m[3]=_e,L.clearBufferuiv(L.COLOR,0,m)):(h[0]=Oe,h[1]=Be,h[2]=Ce,h[3]=_e,L.clearBufferiv(L.COLOR,0,h))}else G|=L.COLOR_BUFFER_BIT}O&&(G|=L.DEPTH_BUFFER_BIT),j&&(G|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),L.clear(G)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",ie,!1),n.removeEventListener("webglcontextrestored",ee,!1),n.removeEventListener("webglcontextcreationerror",we,!1),le.dispose(),pe.dispose(),Le.dispose(),Pe.dispose(),C.dispose(),S.dispose(),te.dispose(),I.dispose(),me.dispose(),K.dispose(),ue.dispose(),ue.removeEventListener("sessionstart",Kp),ue.removeEventListener("sessionend",Yp),ki.stop()};function ie(T){T.preventDefault(),Z0("WebGLRenderer: Context Lost."),R=!0}function ee(){Z0("WebGLRenderer: Context Restored."),R=!1;const T=_t.autoReset,O=ne.enabled,j=ne.autoUpdate,G=ne.needsUpdate,F=ne.type;ce(),_t.autoReset=T,ne.enabled=O,ne.autoUpdate=j,ne.needsUpdate=G,ne.type=F}function we(T){It("WebGLRenderer: A WebGL context could not be created. Reason: ",T.statusMessage)}function Ve(T){const O=T.target;O.removeEventListener("dispose",Ve),ft(O)}function ft(T){st(T),Pe.remove(T)}function st(T){const O=Pe.get(T).programs;O!==void 0&&(O.forEach(function(j){K.releaseProgram(j)}),T.isShaderMaterial&&K.releaseShaderCache(T))}this.renderBufferDirect=function(T,O,j,G,F,oe){O===null&&(O=$t);const ge=F.isMesh&&F.matrixWorld.determinant()<0,Se=Sy(T,O,j,G,F);be.setMaterial(G,ge);let _e=j.index,Oe=1;if(G.wireframe===!0){if(_e=Z.getWireframeAttribute(j),_e===void 0)return;Oe=2}const Be=j.drawRange,Ce=j.attributes.position;let Je=Be.start*Oe,at=(Be.start+Be.count)*Oe;oe!==null&&(Je=Math.max(Je,oe.start*Oe),at=Math.min(at,(oe.start+oe.count)*Oe)),_e!==null?(Je=Math.max(Je,0),at=Math.min(at,_e.count)):Ce!=null&&(Je=Math.max(Je,0),at=Math.min(at,Ce.count));const Tt=at-Je;if(Tt<0||Tt===1/0)return;I.setup(F,G,Se,j,_e);let At,lt=De;if(_e!==null&&(At=z.get(_e),lt=xe,lt.setIndex(At)),F.isMesh)G.wireframe===!0?(be.setLineWidth(G.wireframeLinewidth*gt()),lt.setMode(L.LINES)):lt.setMode(L.TRIANGLES);else if(F.isLine){let Ie=G.linewidth;Ie===void 0&&(Ie=1),be.setLineWidth(Ie*gt()),F.isLineSegments?lt.setMode(L.LINES):F.isLineLoop?lt.setMode(L.LINE_LOOP):lt.setMode(L.LINE_STRIP)}else F.isPoints?lt.setMode(L.POINTS):F.isSprite&&lt.setMode(L.TRIANGLES);if(F.isBatchedMesh)if(F._multiDrawInstances!==null)jo("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),lt.renderMultiDrawInstances(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount,F._multiDrawInstances);else if(Ye.get("WEBGL_multi_draw"))lt.renderMultiDraw(F._multiDrawStarts,F._multiDrawCounts,F._multiDrawCount);else{const Ie=F._multiDrawStarts,yt=F._multiDrawCounts,et=F._multiDrawCount,Sn=_e?z.get(_e).bytesPerElement:1,xs=Pe.get(G).currentProgram.getUniforms();for(let bn=0;bn<et;bn++)xs.setValue(L,"_gl_DrawID",bn),lt.render(Ie[bn]/Sn,yt[bn])}else if(F.isInstancedMesh)lt.renderInstances(Je,Tt,F.count);else if(j.isInstancedBufferGeometry){const Ie=j._maxInstanceCount!==void 0?j._maxInstanceCount:1/0,yt=Math.min(j.instanceCount,Ie);lt.renderInstances(Je,Tt,yt)}else lt.render(Je,Tt)};function fr(T,O,j){T.transparent===!0&&T.side===Or&&T.forceSinglePass===!1?(T.side=wn,T.needsUpdate=!0,il(T,O,j),T.side=Ni,T.needsUpdate=!0,il(T,O,j),T.side=Or):il(T,O,j)}this.compile=function(T,O,j=null){j===null&&(j=T),x=Le.get(j),x.init(O),A.push(x),j.traverseVisible(function(F){F.isLight&&F.layers.test(O.layers)&&(x.pushLight(F),F.castShadow&&x.pushShadow(F))}),T!==j&&T.traverseVisible(function(F){F.isLight&&F.layers.test(O.layers)&&(x.pushLight(F),F.castShadow&&x.pushShadow(F))}),x.setupLights();const G=new Set;return T.traverse(function(F){if(!(F.isMesh||F.isPoints||F.isLine||F.isSprite))return;const oe=F.material;if(oe)if(Array.isArray(oe))for(let ge=0;ge<oe.length;ge++){const Se=oe[ge];fr(Se,j,F),G.add(Se)}else fr(oe,j,F),G.add(oe)}),x=A.pop(),G},this.compileAsync=function(T,O,j=null){const G=this.compile(T,O,j);return new Promise(F=>{function oe(){if(G.forEach(function(ge){Pe.get(ge).currentProgram.isReady()&&G.delete(ge)}),G.size===0){F(T);return}setTimeout(oe,10)}Ye.get("KHR_parallel_shader_compile")!==null?oe():setTimeout(oe,10)})};let Kn=null;function wy(T){Kn&&Kn(T)}function Kp(){ki.stop()}function Yp(){ki.start()}const ki=new gy;ki.setAnimationLoop(wy),typeof self<"u"&&ki.setContext(self),this.setAnimationLoop=function(T){Kn=T,ue.setAnimationLoop(T),T===null?ki.stop():ki.start()},ue.addEventListener("sessionstart",Kp),ue.addEventListener("sessionend",Yp),this.render=function(T,O){if(O!==void 0&&O.isCamera!==!0){It("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(R===!0)return;if(T.matrixWorldAutoUpdate===!0&&T.updateMatrixWorld(),O.parent===null&&O.matrixWorldAutoUpdate===!0&&O.updateMatrixWorld(),ue.enabled===!0&&ue.isPresenting===!0&&(ue.cameraAutoUpdate===!0&&ue.updateCamera(O),O=ue.getCamera()),T.isScene===!0&&T.onBeforeRender(E,T,O,b),x=Le.get(T,A.length),x.init(O),A.push(x),Ne.multiplyMatrices(O.projectionMatrix,O.matrixWorldInverse),H.setFromProjectionMatrix(Ne,vr,O.reversedDepth),he=this.localClippingEnabled,J=Ae.init(this.clippingPlanes,he),v=pe.get(T,w.length),v.init(
vendor: 4,820 bytes, line 4170
4170),w.push(v),ue.enabled===!0&&ue.isPresenting===!0){const oe=E.xr.getDepthSensingMesh();oe!==null&&mu(oe,O,-1/0,E.sortObjects)}mu(T,O,0,E.sortObjects),v.finish(),E.sortObjects===!0&&v.sort(de,Ee),Xe=ue.enabled===!1||ue.isPresenting===!1||ue.hasDepthSensing()===!1,Xe&&le.addToRenderList(v,T),this.info.render.frame++,J===!0&&Ae.beginShadows();const j=x.state.shadowsArray;ne.render(j,T,O),J===!0&&Ae.endShadows(),this.info.autoReset===!0&&this.info.reset();const G=v.opaque,F=v.transmissive;if(x.setupLights(),O.isArrayCamera){const oe=O.cameras;if(F.length>0)for(let ge=0,Se=oe.length;ge<Se;ge++){const _e=oe[ge];Zp(G,F,T,_e)}Xe&&le.render(T);for(let ge=0,Se=oe.length;ge<Se;ge++){const _e=oe[ge];Jp(v,T,_e,_e.viewport)}}else F.length>0&&Zp(G,F,T,O),Xe&&le.render(T),Jp(v,T,O);b!==null&&M===0&&(je.updateMultisampleRenderTarget(b),je.updateRenderTargetMipmap(b)),T.isScene===!0&&T.onAfterRender(E,T,O),I.resetDefaultState(),N=-1,U=null,A.pop(),A.length>0?(x=A[A.length-1],J===!0&&Ae.setGlobalState(E.clippingPlanes,x.state.camera)):x=null,w.pop(),w.length>0?v=w[w.length-1]:v=null};function mu(T,O,j,G){if(T.visible===!1)return;if(T.layers.test(O.layers)){if(T.isGroup)j=T.renderOrder;else if(T.isLOD)T.autoUpdate===!0&&T.update(O);else if(T.isLight)x.pushLight(T),T.castShadow&&x.pushShadow(T);else if(T.isSprite){if(!T.frustumCulled||H.intersectsSprite(T)){G&&We.setFromMatrixPosition(T.matrixWorld).applyMatrix4(Ne);const ge=te.update(T),Se=T.material;Se.visible&&v.push(T,ge,Se,j,We.z,null)}}else if((T.isMesh||T.isLine||T.isPoints)&&(!T.frustumCulled||H.intersectsObject(T))){const ge=te.update(T),Se=T.material;if(G&&(T.boundingSphere!==void 0?(T.boundingSphere===null&&T.computeBoundingSphere(),We.copy(T.boundingSphere.center)):(ge.boundingSphere===null&&ge.computeBoundingSphere(),We.copy(ge.boundingSphere.center)),We.applyMatrix4(T.matrixWorld).applyMatrix4(Ne)),Array.isArray(Se)){const _e=ge.groups;for(let Oe=0,Be=_e.length;Oe<Be;Oe++){const Ce=_e[Oe],Je=Se[Ce.materialIndex];Je&&Je.visible&&v.push(T,ge,Je,j,We.z,Ce)}}else Se.visible&&v.push(T,ge,Se,j,We.z,null)}}const oe=T.children;for(let ge=0,Se=oe.length;ge<Se;ge++)mu(oe[ge],O,j,G)}function Jp(T,O,j,G){const{opaque:F,transmissive:oe,transparent:ge}=T;x.setupLightsView(j),J===!0&&Ae.setGlobalState(E.clippingPlanes,j),G&&be.viewport(B.copy(G)),F.length>0&&rl(F,O,j),oe.length>0&&rl(oe,O,j),ge.length>0&&rl(ge,O,j),be.buffers.depth.setTest(!0),be.buffers.depth.setMask(!0),be.buffers.color.setMask(!0),be.setPolygonOffset(!1)}function Zp(T,O,j,G){if((j.isScene===!0?j.overrideMaterial:null)!==null)return;x.state.transmissionRenderTarget[G.id]===void 0&&(x.state.transmissionRenderTarget[G.id]=new ps(1,1,{generateMipmaps:!0,type:Ye.has("EXT_color_buffer_half_float")||Ye.has("EXT_color_buffer_float")?Ca:Sr,minFilter:ss,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:tt.workingColorSpace}));const oe=x.state.transmissionRenderTarget[G.id],ge=G.viewport||B;oe.setSize(ge.z*E.transmissionResolutionScale,ge.w*E.transmissionResolutionScale);const Se=E.getRenderTarget(),_e=E.getActiveCubeFace(),Oe=E.getActiveMipmapLevel();E.setRenderTarget(oe),E.getClearColor(V),Q=E.getClearAlpha(),Q<1&&E.setClearColor(16777215,.5),E.clear(),Xe&&le.render(j);const Be=E.toneMapping;E.toneMapping=Ai;const Ce=G.viewport;if(G.viewport!==void 0&&(G.viewport=void 0),x.setupLightsView(G),J===!0&&Ae.setGlobalState(E.clippingPlanes,G),rl(T,j,G),je.updateMultisampleRenderTarget(oe),je.updateRenderTargetMipmap(oe),Ye.has("WEBGL_multisampled_render_to_texture")===!1){let Je=!1;for(let at=0,Tt=O.length;at<Tt;at++){const At=O[at],{object:lt,geometry:Ie,material:yt,group:et}=At;if(yt.side===Or&&lt.layers.test(G.layers)){const Sn=yt.side;yt.side=wn,yt.needsUpdate=!0,Qp(lt,j,G,Ie,yt,et),yt.side=Sn,yt.needsUpdate=!0,Je=!0}}Je===!0&&(je.updateMultisampleRenderTarget(oe),je.updateRenderTargetMipmap(oe))}E.setRenderTarget(Se,_e,Oe),E.setClearColor(V,Q),Ce!==void 0&&(G.viewport=Ce),E.toneMapping=Be}function rl(T,O,j){const G=O.isScene===!0?O.overrideMaterial:null;for(let F=0,oe=T.length;F<oe;F++){const ge=T[F],{object:Se,geometry:_e,group:Oe}=ge;let Be=ge.material;Be.allowOverride===!0&&G!==null&&(Be=G),Se.layers.test(j.layers)&&Qp(Se,O,j,_e,Be,Oe)}}function Qp(T,O,j,G,F,oe){T.onBeforeRender(E,O,j,G,F,oe),T.modelViewMatrix.multiplyMatrices(j.matrixWorldInverse,T.matrixWorld),T.normalMatrix.getNormalMatrix(T.modelViewMatrix),F.onBeforeRender(E,O,j,G,T,oe),F.transparent===!0&&F.side===Or&&F.forceSinglePass===!1?(F.side=wn,F.needsUpdate=!0,E.renderBufferDirect(j,O,G,F,T,oe),F.side=Ni,F.needsUpdate=!0,E.renderBufferDirect(j,O,G,F,T,oe),F.side=Or):E.renderBufferDirect(j,O,G,F,T,oe),T.onAfterRender(E,O,j,G,F,oe)}function il(T,O,j){O.isScene!==!0&&(O=$t);const G=Pe.get(T),F=x.state.lights,oe=x.state.shadowsArray,ge=F.state.ver
vendor: 16,726 bytes, line 4170
4170sion,Se=K.getParameters(T,F.state,oe,O,j),_e=K.getProgramCacheKey(Se);let Oe=G.programs;G.environment=T.isMeshStandardMaterial?O.environment:null,G.fog=O.fog,G.envMap=(T.isMeshStandardMaterial?S:C).get(T.envMap||G.environment),G.envMapRotation=G.environment!==null&&T.envMap===null?O.environmentRotation:T.envMapRotation,Oe===void 0&&(T.addEventListener("dispose",Ve),Oe=new Map,G.programs=Oe);let Be=Oe.get(_e);if(Be!==void 0){if(G.currentProgram===Be&&G.lightsStateVersion===ge)return tm(T,Se),Be}else Se.uniforms=K.getUniforms(T),T.onBeforeCompile(Se,E),Be=K.acquireProgram(Se,_e),Oe.set(_e,Be),G.uniforms=Se.uniforms;const Ce=G.uniforms;return(!T.isShaderMaterial&&!T.isRawShaderMaterial||T.clipping===!0)&&(Ce.clippingPlanes=Ae.uniform),tm(T,Se),G.needsLights=Ey(T),G.lightsStateVersion=ge,G.needsLights&&(Ce.ambientLightColor.value=F.state.ambient,Ce.lightProbe.value=F.state.probe,Ce.directionalLights.value=F.state.directional,Ce.directionalLightShadows.value=F.state.directionalShadow,Ce.spotLights.value=F.state.spot,Ce.spotLightShadows.value=F.state.spotShadow,Ce.rectAreaLights.value=F.state.rectArea,Ce.ltc_1.value=F.state.rectAreaLTC1,Ce.ltc_2.value=F.state.rectAreaLTC2,Ce.pointLights.value=F.state.point,Ce.pointLightShadows.value=F.state.pointShadow,Ce.hemisphereLights.value=F.state.hemi,Ce.directionalShadowMap.value=F.state.directionalShadowMap,Ce.directionalShadowMatrix.value=F.state.directionalShadowMatrix,Ce.spotShadowMap.value=F.state.spotShadowMap,Ce.spotLightMatrix.value=F.state.spotLightMatrix,Ce.spotLightMap.value=F.state.spotLightMap,Ce.pointShadowMap.value=F.state.pointShadowMap,Ce.pointShadowMatrix.value=F.state.pointShadowMatrix),G.currentProgram=Be,G.uniformsList=null,Be}function em(T){if(T.uniformsList===null){const O=T.currentProgram.getUniforms();T.uniformsList=hc.seqWithValue(O.seq,T.uniforms)}return T.uniformsList}function tm(T,O){const j=Pe.get(T);j.outputColorSpace=O.outputColorSpace,j.batching=O.batching,j.batchingColor=O.batchingColor,j.instancing=O.instancing,j.instancingColor=O.instancingColor,j.instancingMorph=O.instancingMorph,j.skinning=O.skinning,j.morphTargets=O.morphTargets,j.morphNormals=O.morphNormals,j.morphColors=O.morphColors,j.morphTargetsCount=O.morphTargetsCount,j.numClippingPlanes=O.numClippingPlanes,j.numIntersection=O.numClipIntersection,j.vertexAlphas=O.vertexAlphas,j.vertexTangents=O.vertexTangents,j.toneMapping=O.toneMapping}function Sy(T,O,j,G,F){O.isScene!==!0&&(O=$t),je.resetTextureUnits();const oe=O.fog,ge=G.isMeshStandardMaterial?O.environment:null,Se=b===null?E.outputColorSpace:b.isXRRenderTarget===!0?b.texture.colorSpace:wa,_e=(G.isMeshStandardMaterial?S:C).get(G.envMap||ge),Oe=G.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,Be=!!j.attributes.tangent&&(!!G.normalMap||G.anisotropy>0),Ce=!!j.morphAttributes.position,Je=!!j.morphAttributes.normal,at=!!j.morphAttributes.color;let Tt=Ai;G.toneMapped&&(b===null||b.isXRRenderTarget===!0)&&(Tt=E.toneMapping);const At=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,lt=At!==void 0?At.length:0,Ie=Pe.get(G),yt=x.state.lights;if(J===!0&&(he===!0||T!==U)){const an=T===U&&G.id===N;Ae.setState(G,T,an)}let et=!1;G.version===Ie.__version?(Ie.needsLights&&Ie.lightsStateVersion!==yt.state.version||Ie.outputColorSpace!==Se||F.isBatchedMesh&&Ie.batching===!1||!F.isBatchedMesh&&Ie.batching===!0||F.isBatchedMesh&&Ie.batchingColor===!0&&F.colorTexture===null||F.isBatchedMesh&&Ie.batchingColor===!1&&F.colorTexture!==null||F.isInstancedMesh&&Ie.instancing===!1||!F.isInstancedMesh&&Ie.instancing===!0||F.isSkinnedMesh&&Ie.skinning===!1||!F.isSkinnedMesh&&Ie.skinning===!0||F.isInstancedMesh&&Ie.instancingColor===!0&&F.instanceColor===null||F.isInstancedMesh&&Ie.instancingColor===!1&&F.instanceColor!==null||F.isInstancedMesh&&Ie.instancingMorph===!0&&F.morphTexture===null||F.isInstancedMesh&&Ie.instancingMorph===!1&&F.morphTexture!==null||Ie.envMap!==_e||G.fog===!0&&Ie.fog!==oe||Ie.numClippingPlanes!==void 0&&(Ie.numClippingPlanes!==Ae.numPlanes||Ie.numIntersection!==Ae.numIntersection)||Ie.vertexAlphas!==Oe||Ie.vertexTangents!==Be||Ie.morphTargets!==Ce||Ie.morphNormals!==Je||Ie.morphColors!==at||Ie.toneMapping!==Tt||Ie.morphTargetsCount!==lt)&&(et=!0):(et=!0,Ie.__version=G.version);let Sn=Ie.currentProgram;et===!0&&(Sn=il(G,O,F));let xs=!1,bn=!1,La=!1;const wt=Sn.getUniforms(),fn=Ie.uniforms;if(be.useProgram(Sn.program)&&(xs=!0,bn=!0,La=!0),G.id!==N&&(N=G.id,bn=!0),xs||U!==T){be.buffers.depth.getReversed()&&T.reversedDepth!==!0&&(T._reversedDepth=!0,T.updateProjectionMatrix()),wt.setValue(L,"projectionMatrix",T.projectionMatrix),wt.setValue(L,"viewMatrix",T.matrixWorldInverse);const pn=wt.map.cameraPosition;pn!==void 0&&pn.setValue(L,Me.setFromMatrixPosition(T.matrixWorld)),ut.logarithmicDepthBuffer&&wt.setValue(L,"logDepthBufFC",2/(Math.log(T.far+1)/Math.LN2)),(G.isMeshPhongMaterial||G.isMeshToonMaterial||G.isMeshLambertMaterial||G.isMeshBasicMaterial||G.isMeshStandardMaterial||G.isShaderMaterial)&&wt.setValue(L,"isOrthographic",T.isOrthographicCamera===!0),U!==T&&(U=T,bn=!0,La=!0)}if(F.isSkinnedMesh){wt.setOptional(L,F,"bindMatrix"),wt.setOptional(L,F,"bindMatrixInverse");const an=F.skeleton;an&&(an.boneTexture===null&&an.computeBoneTexture(),wt.setValue(L,"boneTexture",an.boneTexture,je))}F.isBatchedMesh&&(wt.setOptional(L,F,"batchingTexture"),wt.setValue(L,"batchingTexture",F._matricesTexture,je),wt.setOptional(L,F,"batchingIdTexture"),wt.setValue(L,"batchingIdTexture",F._indirectTexture,je),wt.setOptional(L,F,"batchingColorTexture"),F._colorsTexture!==null&&wt.setValue(L,"batchingColorTexture",F._colorsTexture,je));const On=j.morphAttributes;if((On.position!==void 0||On.normal!==void 0||On.color!==void 0)&&Fe.update(F,j,Sn),(bn||Ie.receiveShadow!==F.receiveShadow)&&(Ie.receiveShadow=F.receiveShadow,wt.setValue(L,"receiveShadow",F.receiveShadow)),G.isMeshGouraudMaterial&&G.envMap!==null&&(fn.envMap.value=_e,fn.flipEnvMap.value=_e.isCubeTexture&&_e.isRenderTargetTexture===!1?-1:1),G.isMeshStandardMaterial&&G.envMap===null&&O.environment!==null&&(fn.envMapIntensity.value=O.environmentIntensity),fn.dfgLUT!==void 0&&(fn.dfgLUT.value=LP()),bn&&(wt.setValue(L,"toneMappingExposure",E.toneMappingExposure),Ie.needsLights&&by(fn,La),oe&&G.fog===!0&&Re.refreshFogUniforms(fn,oe),Re.refreshMaterialUniforms(fn,G,Y,q,x.state.transmissionRenderTarget[T.id]),hc.upload(L,em(Ie),fn,je)),G.isShaderMaterial&&G.uniformsNeedUpdate===!0&&(hc.upload(L,em(Ie),fn,je),G.uniformsNeedUpdate=!1),G.isSpriteMaterial&&wt.setValue(L,"center",F.center),wt.setValue(L,"modelViewMatrix",F.modelViewMatrix),wt.setValue(L,"normalMatrix",F.normalMatrix),wt.setValue(L,"modelMatrix",F.matrixWorld),G.isShaderMaterial||G.isRawShaderMaterial){const an=G.uniformsGroups;for(let pn=0,gu=an.length;pn<gu;pn++){const Oi=an[pn];me.update(Oi,Sn),me.bind(Oi,Sn)}}return Sn}function by(T,O){T.ambientLightColor.needsUpdate=O,T.lightProbe.needsUpdate=O,T.directionalLights.needsUpdate=O,T.directionalLightShadows.needsUpdate=O,T.pointLights.needsUpdate=O,T.pointLightShadows.needsUpdate=O,T.spotLights.needsUpdate=O,T.spotLightShadows.needsUpdate=O,T.rectAreaLights.needsUpdate=O,T.hemisphereLights.needsUpdate=O}function Ey(T){return T.isMeshLambertMaterial||T.isMeshToonMaterial||T.isMeshPhongMaterial||T.isMeshStandardMaterial||T.isShadowMaterial||T.isShaderMaterial&&T.lights===!0}this.getActiveCubeFace=function(){return P},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return b},this.setRenderTargetTextures=function(T,O,j){const G=Pe.get(T);G.__autoAllocateDepthBuffer=T.resolveDepthBuffer===!1,G.__autoAllocateDepthBuffer===!1&&(G.__useRenderToTexture=!1),Pe.get(T.texture).__webglTexture=O,Pe.get(T.depthTexture).__webglTexture=G.__autoAllocateDepthBuffer?void 0:j,G.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(T,O){const j=Pe.get(T);j.__webglFramebuffer=O,j.__useDefaultFramebuffer=O===void 0};const My=L.createFramebuffer();this.setRenderTarget=function(T,O=0,j=0){b=T,P=O,M=j;let G=!0,F=null,oe=!1,ge=!1;if(T){const _e=Pe.get(T);if(_e.__useDefaultFramebuffer!==void 0)be.bindFramebuffer(L.FRAMEBUFFER,null),G=!1;else if(_e.__webglFramebuffer===void 0)je.setupRenderTarget(T);else if(_e.__hasExternalTextures)je.rebindTextures(T,Pe.get(T.texture).__webglTexture,Pe.get(T.depthTexture).__webglTexture);else if(T.depthBuffer){const Ce=T.depthTexture;if(_e.__boundDepthTexture!==Ce){if(Ce!==null&&Pe.has(Ce)&&(T.width!==Ce.image.width||T.height!==Ce.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");je.setupDepthRenderbuffer(T)}}const Oe=T.texture;(Oe.isData3DTexture||Oe.isDataArrayTexture||Oe.isCompressedArrayTexture)&&(ge=!0);const Be=Pe.get(T).__webglFramebuffer;T.isWebGLCubeRenderTarget?(Array.isArray(Be[O])?F=Be[O][j]:F=Be[O],oe=!0):T.samples>0&&je.useMultisampledRTT(T)===!1?F=Pe.get(T).__webglMultisampledFramebuffer:Array.isArray(Be)?F=Be[j]:F=Be,B.copy(T.viewport),X.copy(T.scissor),W=T.scissorTest}else B.copy(se).multiplyScalar(Y).floor(),X.copy(ae).multiplyScalar(Y).floor(),W=ye;if(j!==0&&(F=My),be.bindFramebuffer(L.FRAMEBUFFER,F)&&G&&be.drawBuffers(T,F),be.viewport(B),be.scissor(X),be.setScissorTest(W),oe){const _e=Pe.get(T.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+O,_e.__webglTexture,j)}else if(ge){const _e=O;for(let Oe=0;Oe<T.textures.length;Oe++){const Be=Pe.get(T.textures[Oe]);L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0+Oe,Be.__webglTexture,j,_e)}}else if(T!==null&&j!==0){const _e=Pe.get(T.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,_e.__webglTexture,j)}N=-1},this.readRenderTargetPixels=function(T,O,j,G,F,oe,ge,Se=0){if(!(T&&T.isWebGLRenderTarget)){It("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let _e=Pe.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&ge!==void 0&&(_e=_e[ge]),_e){be.bindFramebuffer(L.FRAMEBUFFER,_e);try{const Oe=T.textures[Se],Be=Oe.format,Ce=Oe.type;if(!ut.textureFormatReadable(Be)){It("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!ut.textureTypeReadable(Ce)){It("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}O>=0&&O<=T.width-G&&j>=0&&j<=T.height-F&&(T.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+Se),L.readPixels(O,j,G,F,ze.convert(Be),ze.convert(Ce),oe))}finally{const Oe=b!==null?Pe.get(b).__webglFramebuffer:null;be.bindFramebuffer(L.FRAMEBUFFER,Oe)}}},this.readRenderTargetPixelsAsync=async function(T,O,j,G,F,oe,ge,Se=0){if(!(T&&T.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let _e=Pe.get(T).__webglFramebuffer;if(T.isWebGLCubeRenderTarget&&ge!==void 0&&(_e=_e[ge]),_e)if(O>=0&&O<=T.width-G&&j>=0&&j<=T.height-F){be.bindFramebuffer(L.FRAMEBUFFER,_e);const Oe=T.textures[Se],Be=Oe.format,Ce=Oe.type;if(!ut.textureFormatReadable(Be))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!ut.textureTypeReadable(Ce))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Je=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,Je),L.bufferData(L.PIXEL_PACK_BUFFER,oe.byteLength,L.STREAM_READ),T.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+Se),L.readPixels(O,j,G,F,ze.convert(Be),ze.convert(Ce),0);const at=b!==null?Pe.get(b).__webglFramebuffer:null;be.bindFramebuffer(L.FRAMEBUFFER,at);const Tt=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await oT(L,Tt,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,Je),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,oe),L.deleteBuffer(Je),L.deleteSync(Tt),oe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(T,O=null,j=0){const G=Math.pow(2,-j),F=Math.floor(T.image.width*G),oe=Math.floor(T.image.height*G),ge=O!==null?O.x:0,Se=O!==null?O.y:0;je.setTexture2D(T,0),L.copyTexSubImage2D(L.TEXTURE_2D,j,0,0,ge,Se,F,oe),be.unbindTexture()};const Ty=L.createFramebuffer(),Ay=L.createFramebuffer();this.copyTextureToTexture=function(T,O,j=null,G=null,F=0,oe=null){oe===null&&(F!==0?(jo("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),oe=F,F=0):oe=0);let ge,Se,_e,Oe,Be,Ce,Je,at,Tt;const At=T.isCompressedTexture?T.mipmaps[oe]:T.image;if(j!==null)ge=j.max.x-j.min.x,Se=j.max.y-j.min.y,_e=j.isBox3?j.max.z-j.min.z:1,Oe=j.min.x,Be=j.min.y,Ce=j.isBox3?j.min.z:0;else{const On=Math.pow(2,-F);ge=Math.floor(At.width*On),Se=Math.floor(At.height*On),T.isDataArrayTexture?_e=At.depth:T.isData3DTexture?_e=Math.floor(At.depth*On):_e=1,Oe=0,Be=0,Ce=0}G!==null?(Je=G.x,at=G.y,Tt=G.z):(Je=0,at=0,Tt=0);const lt=ze.convert(O.format),Ie=ze.convert(O.type);let yt;O.isData3DTexture?(je.setTexture3D(O,0),yt=L.TEXTURE_3D):O.isDataArrayTexture||O.isCompressedArrayTexture?(je.setTexture2DArray(O,0),yt=L.TEXTURE_2D_ARRAY):(je.setTexture2D(O,0),yt=L.TEXTURE_2D),L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,O.flipY),L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),L.pixelStorei(L.UNPACK_ALIGNMENT,O.unpackAlignment);const et=L.getParameter(L.UNPACK_ROW_LENGTH),Sn=L.getParameter(L.UNPACK_IMAGE_HEIGHT),xs=L.getParameter(L.UNPACK_SKIP_PIXELS),bn=L.getParameter(L.UNPACK_SKIP_ROWS),La=L.getParameter(L.UNPACK_SKIP_IMAGES);L.pixelStorei(L.UNPACK_ROW_LENGTH,At.width),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,At.height),L.pixelStorei(L.UNPACK_SKIP_PIXELS,Oe),L.pixelStorei(L.UNPACK_SKIP_ROWS,Be),L.pixelStorei(L.UNPACK_SKIP_IMAGES,Ce);const wt=T.isDataArrayTexture||T.isData3DTexture,fn=O.isDataArrayTexture||O.isData3DTexture;if(T.isDepthTexture){const On=Pe.get(T),an=Pe.get(O),pn=Pe.get(On.__renderTarget),gu=Pe.get(an.__renderTarget);be.bindFramebuffer(L.READ_FRAMEBUFFER,pn.__webglFramebuffer),be.bindFramebuffer(L.DRAW_FRAMEBUFFER,gu.__webglFramebuffer);for(let Oi=0;Oi<_e;Oi++)wt&&(L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Pe.get(T).__webglTexture,F,Ce+Oi),L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,Pe.get(O).__webglTexture,oe,Tt+Oi)),L.blitFramebuffer(Oe,Be,ge,Se,Je,at,ge,Se,L.DEPTH_BUFFER_BIT,L.NEAREST);be.bindFramebuffer(L.READ_FRAMEBUFFER,null),be.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else if(F!==0||T.isRenderTargetTexture||Pe.has(T)){const On=Pe.get(T),an=Pe.get(O);be.bindFramebuffer(L.READ_FRAMEBUFFER,Ty),be.bindFramebuffer(L.DRAW_FRAMEBUFFER,Ay);for(let pn=0;pn<_e;pn++)wt?L.framebufferTextureLayer(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,On.__webglTexture,F,Ce+pn):L.framebufferTexture2D(L.READ_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,On.__webglTexture,F),fn?L.framebufferTextureLayer(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,an.__webglTexture,oe,Tt+pn):L.framebufferTexture2D(L.DRAW_FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,an.__webglTexture,oe),F!==0?L.blitFramebuffer(Oe,Be,ge,Se,Je,at,ge,Se,L.COLOR_BUFFER_BIT,L.NEAREST):fn?L.copyTexSubImage3D(yt,oe,Je,at,Tt+pn,Oe,Be,ge,Se):L.copyTexSubImage2D(yt,oe,Je,at,Oe,Be,ge,Se);be.bindFramebuffer(L.READ_FRAMEBUFFER,null),be.bindFramebuffer(L.DRAW_FRAMEBUFFER,null)}else fn?T.isDataTexture||T.isData3DTexture?L.texSubImage3D(yt,oe,Je,at,Tt,ge,Se,_e,lt,Ie,At.data):O.isCompressedArrayTexture?L.compressedTexSubImage3D(yt,oe,Je,at,Tt,ge,Se,_e,lt,At.data):L.texSubImage3D(yt,oe,Je,at,Tt,ge,Se,_e,lt,Ie,At):T.isDataTexture?L.texSubImage2D(L.TEXTURE_2D,oe,Je,at,ge,Se,lt,Ie,At.data):T.isCompressedTexture?L.compressedTexSubImage2D(L.TEXTURE_2D,oe,Je,at,At.width,At.height,lt,At.data):L.texSubImage2D(L.TEXTURE_2D,oe,Je,at,ge,Se,lt,Ie,At);L.pixelStorei(L.UNPACK_ROW_LENGTH,et),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,Sn),L.pixelStorei(L.UNPACK_SKIP_PIXELS,xs),L.pixelStorei(L.UNPACK_SKIP_ROWS,bn),L.pixelStorei(L.UNPACK_SKIP_IMAGES,La),oe===0&&O.generateMipmaps&&L.generateMipmap(yt),be.unbindTexture()},this.initRenderTarget=function(T){Pe.get(T).__webglFramebuffer===void 0&&je.setupRenderTarget(T)},this.initTexture=function(T){T.isCubeTexture?je.setTextureCube(T,0):T.isData3DTexture?je.setTexture3D(T,0):T.isDataArrayTexture||T.isCompressedArrayTexture?je.setTexture2DArray(T,0):je.setTexture2D(T,0),be.unbindTexture()},this.resetState=function(){P=0,M=0,b=null,be.reset(),I.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return vr}get outputColorSpace(){return this._outputColorSpace}
4170set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=tt._getDrawingBufferColorSpace(e),n.unpackColorSpace=tt._getUnpackColorSpace()}}function Vg(t){const{map:e,position:n,onAnimationComplete:r}=t;let i,s,a,o;const l={tilt:0,heading:0,zoom:18},c=new google.maps.WebGLOverlayView;return console.log("[WebGL] Creating overlay view"),c.onAdd=()=>{console.log("[WebGL] onAdd called"),i=new DT,a=new jn;const u=new WT(16777215,.75);i.add(u);const d=new GT(16777215,.25);d.position.set(.5,-1,.5),i.add(d),o=new Qa;const f=new BT({color:15352629,metalness:.1,roughness:.6}),p=new qp(8,32,32),g=new Er(p,f);g.position.y=28,o.add(g);const _=new Xp(6,25,32),m=new Er(_,f);m.rotation.x=Math.PI,m.position.y=8,o.add(m),i.add(o),console.log("[WebGL] Pin marker created")},c.onContextRestored=({gl:u})=>{console.log("[WebGL] onContextRestored called",u),s=new IP({canvas:u.canvas,context:u,...u.getContextAttributes()}),s.autoClear=!1,e.moveCamera({center:n,zoom:l.zoom,tilt:l.tilt,heading:l.heading}),console.log("[WebGL] Starting animation loop");let d=0;s.setAnimationLoop(()=>{try{if(d++,c.requestRedraw(),l.tilt<67.5)l.tilt+=.5,d%20===0&&console.log("[WebGL] Phase 1 - tilt:",l.tilt);else if(l.heading<=360)l.heading+=.2,l.zoom-=5e-4,d%100===0&&console.log("[WebGL] Phase 2 - heading:",l.heading,"zoom:",l.zoom);else{console.log("[WebGL] Animation complete"),s.setAnimationLoop(null),r&&r();return}e.moveCamera({tilt:l.tilt,heading:l.heading,zoom:l.zoom})}catch(f){console.error("[WebGL] Animation error:",f),s.setAnimationLoop(null)}})},c.onDraw=({transformer:u})=>{if(!i||!a||!s){console.log("[WebGL] onDraw skipped - missing:",{scene:!!i,camera:!!a,renderer:!!s});return}const d=u.fromLatLngAltitude({lat:n.lat,lng:n.lng,altitude:100});a.projectionMatrix=new Nt().fromArray(d),c.requestRedraw(),s.render(i,a),s.resetState()},c.onContextLost=()=>{s&&s.setAnimationLoop(null)},c.onRemove=()=>{s&&(s.setAnimationLoop(null),s.dispose())},console.log("[WebGL] Setting map on overlay"),c.setMap(e),console.log("[WebGL] Overlay added to map"),c}function DP(t){t.setMap(null)}function UP(){const{round:t}=z_(),e=V_((t==null?void 0:t.round_no)??null),n=v3(),{user:r,signOut:i}=Dp(),s=k.useRef(null),[a,o]=k.useState(null),[l,c]=k.useState(new Map),[u,d]=k.useState(null),[f,p]=k.useState(new Map),[g,_]=k.useState(!1),[m,h]=k.useState(!1),[v,x]=k.useState(null),[w,A]=k.useState(null),[E,R]=k.useState(null),[P,M]=k.useState([]),[b,N]=k.useState([]);k.useEffect(()=>{U()},[]),k.useEffect(()=>{!a||!t||t.status!=="running"||B()},[e,t,a,n,E]),k.useEffect(()=>{if(!a||!t||t.mode!=="polygon"||!t.polygon_coords){E&&(E.setMap(null),R(null));return}const se=window.google,ae=Oh(P.length);if(E)E.setOptions({strokeOpacity:ae,fillOpacity:ae*.35});else{const ye=new se.maps.Polygon({paths:t.polygon_coords,strokeColor:"#c41e3a",strokeOpacity:ae,strokeWeight:3,fillColor:"#c41e3a",fillOpacity:ae*.35,clickable:!1,map:a});R(ye)}return()=>{E&&E.setMap(null)}},[a,t==null?void 0:t.mode,t==null?void 0:t.polygon_coords,P.length]);const U=async()=>{if(s.current)try{await H_();const se=window.google,ae=new se.maps.Map(s.current,{center:j_,zoom:10,mapId:"5b9375d27ba22f66a3252f7b",restriction:{latLngBounds:di,strictBounds:!1}});ae.addListener("click",ye=>{d({lat:ye.latLng.lat(),lng:ye.latLng.lng()})}),o(ae)}catch(se){console.error("Error loading Google Maps:",se),alert("Failed to load map. Please check your Google Maps API key.")}},B=()=>{if(!a||!t||!t.target_lat||!t.target_lng)return;const se=window.google,ae=new Map;if(t.mode==="polygon"&&t.polygon_coords&&E){const ye=[];if(e.forEach((H,J)=>{const he=n.get(J);if(!he)return;const Ne=new se.maps.LatLng(H.lat,H.lng),Me=se.maps.geometry.poly.containsLocation(Ne,E);Me&&ye.push(J),X(J,H,he,Me?"#22c55e":"#6b7280")}),M(ye),t.status==="running"&&ye.length>=10){const H=ye.slice(0,10).map(J=>n.get(J)).filter(J=>J!==void 0);V(H)}p(ae);return}e.forEach((ye,H)=>{const J=n.get(H);if(!J)return;const he=p3(ye.lat,ye.lng,t.target_lat,t.target_lng);if(ae.set(H,he),t.status==="running"&&he<=1e3){W(H,he);return}const Ne=Zi(he);X(H,ye,J,Ne)}),p(ae)},X=(se,ae,ye,H)=>{const J=window.google,he=document.createElement("div");if(he.style.cssText=`
4171      background: ${H};
4172      padding: 8px 12px;
4173      border-radius: 20px;
4174      color: white;
4175      font-weight: bold;
4176      box-shadow: 0 2px 6px rgba(0,0,0,0.3);
4177      white-space: nowrap;
4178      font-size: 14px;
4179    `,he.textContent=ye.nickname,l.has(se)){const Ne=l.get(se);Ne.position={lat:ae.lat,lng:ae.lng},Ne.content=he}else{const Ne=new J.maps.marker.AdvancedMarkerElement({map:a,position:{lat:ae.lat,lng:ae.lng},content:he});c(Me=>{const We=new Map(Me);return We.set(se,Ne),We})}},W=async(se,ae)=>
4179{if(!(!t||t.status!=="running"))try{const{data:{session:ye}}=await ct.auth.getSession();if(!ye)return;await ct.functions.invoke("admin_actions",{body:{action:"set_winner",winner_player_id:se,winner_distance_m:ae},headers:{Authorization:`Bearer ${ye.access_token}`}});const H=n.get(se);if(H&&A(H.nickname),a&&t.target_lat&&t.target_lng){h(!0);const J=Vg({map:a,position:{lat:t.target_lat,lng:t.target_lng},onAnimationComplete:()=>{}});x(J)}}catch(ye){console.error("Error setting winner:",ye)}},V=async se=>{if(!(!t||t.status!=="running"))try{const{data:{session:ae}}=await ct.auth.getSession();if(!ae)return;if(await ct.functions.invoke("admin_actions",{body:{action:"stop_round"},headers:{Authorization:`Bearer ${ae.access_token}`}}),N(se),h(!0),a&&t.target_lat&&t.target_lng){const ye=Vg({map:a,position:{lat:t.target_lat,lng:t.target_lng},onAnimationComplete:()=>{}});x(ye)}}catch(ae){console.error("Error triggering polygon win:",ae)}},Q=async se=>{const ae=u||m3();try{_(!0);const{data:{session:ye}}=await ct.auth.getSession();if(!ye){alert("Not authenticated. Please log in.");return}const H=se==="polygon"?g3(ae.lat,ae.lng):void 0,{error:J}=await ct.functions.invoke("admin_actions",{body:{action:"start_round",mode:se,target_lat:ae.lat,target_lng:ae.lng,polygon_coords:H},headers:{Authorization:`Bearer ${ye.access_token}`}});if(J)throw J;d(ae)}catch(ye){console.error("Error starting round:",ye),alert(ye.message||"Failed to start round")}finally{_(!1)}},D=async()=>{try{_(!0);const{data:{session:se}}=await ct.auth.getSession();if(!se)return;const{error:ae}=await ct.functions.invoke("admin_actions",{body:{action:"stop_round"},headers:{Authorization:`Bearer ${se.access_token}`}});if(ae)throw ae}catch(se){console.error("Error stopping round:",se),alert(se.message||"Failed to stop round")}finally{_(!1)}},q=async()=>{if(confirm("Reset the round? This will clear all guesses."))try{_(!0);const{data:{session:se}}=await ct.auth.getSession();if(!se)return;const{error:ae}=await ct.functions.invoke("admin_actions",{body:{action:"reset_round"},headers:{Authorization:`Bearer ${se.access_token}`}});if(ae)throw ae;l.forEach(ye=>{ye.map=null}),c(new Map),d(null),h(!1),A(null),v&&(DP(v),x(null)),E&&(E.setMap(null),R(null)),M([]),N([])}catch(se){console.error("Error resetting round:",se),alert(se.message||"Failed to reset round")}finally{_(!1)}},Y=async()=>{try{const{data:{session:se}}=await ct.auth.getSession();if(!se)return;const{error:ae}=await ct.functions.invoke("admin_actions",{body:{action:"toggle_show_distance"},headers:{Authorization:`Bearer ${se.access_token}`}});if(ae)throw ae}catch(se){console.error("Error toggling show distance:",se),alert(se.message||"Failed to toggle show distance")}},de=Array.from(e.entries()).map(([se,ae])=>{const ye=n.get(se),H=f.get(se)||0;return{player:ye,guess:ae,distance:H}}).filter(se=>se.player).sort((se,ae)=>se.distance-ae.distance),Ee=async()=>{try{await i()}catch(se){console.error("Error signing out:",se)}};return y.jsxs("div",{className:"flex h-screen",children:[y.jsxs("div",{className:"w-80 bg-gray-900 text-white p-6 flex flex-col overflow-y-auto",children:[y.jsxs("div",{className:"flex items-center justify-between mb-6",children:[y.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[y.jsx(O_,{className:"w-6 h-6 text-yellow-500"}),"Admin"]}),y.jsx("button",{onClick:Ee,className:"p-2 hover:bg-gray-800 rounded-lg transition",title:"Sign out",children:y.jsx(o3,{className:"w-5 h-5 text-gray-400 hover:text-white"})})]}),r&&y.jsxs("div",{className:"mb-4 p-3 bg-gray-800 rounded-lg",children:[y.jsx("p",{className:"text-xs text-gray-400",children:"Signed in as"}),y.jsx("p",{className:"text-sm font-medium truncate",children:r.email})]}),y.jsxs("div",{className:"space-y-4 mb-6",children:[y.jsxs("div",{children:[y.jsx("p",{className:"text-sm text-gray-400",children:"Round"}),y.jsxs("p",{className:"text-xl font-bold",children:["#",(t==null?void 0:t.round_no)||0]})]}),y.jsxs("div",{children:[y.jsx("p",{className:"text-sm text-gray-400",children:"Status"}),y.jsxs("div",{className:"flex items-center gap-2",children:[(t==null?void 0:t.status)==="running"&&y.jsx("span",{className:"w-3 h-3 bg-green-500 rounded-full animate-pulse"}),y.jsx("p",{className:"text-lg font-semibold capitalize",children:(t==null?void 0:t.status)||"idle"})]})]}),(t==null?void 0:t.mode)&&t.status==="running"&&y.jsxs("div",{children:[y.jsx("p",{className:"text-sm text-gray-400",children:"Mode"}),y.jsx("p",{className:"text-lg font-semibold capitalize",children:t.mode})]}),y.jsxs("div",{children:[y.jsxs("p",{className:"text-sm text-gray-400 flex items-center gap-1",children:[y.jsx(F_,{className:"w-4 h-4"}),"Players"]}),y.jsx("p",{className:"text-xl font-bold",children:e.size})]}
4179),(t==null?void 0:t.mode)==="polygon"&&t.status==="running"&&y.jsxs("div",{className:"p-3 bg-rose-900/50 rounded-lg",children:[y.jsxs("p",{className:"text-sm text-gray-400 flex items-center gap-1",children:[y.jsx(fo,{className:"w-4 h-4"}),"Inside Polygon"]}),y.jsxs("p",{className:"text-2xl font-bold text-rose-400",children:[P.length," / 10"]}),y.jsx("div",{className:"mt-2 h-2 bg-gray-700 rounded-full overflow-hidden",children:y.jsx("div",{className:"h-full bg-rose-500 transition-all duration-300",style:{width:`${Math.min(P.length/10*100,100)}%`}})}),y.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Visibility: ",Math.round(Oh(P.length)*100),"%"]})]})]}),y.jsxs("div",{className:"space-y-2 mb-6",children:[(t==null?void 0:t.status)==="idle"&&y.jsxs(y.Fragment,{children:[y.jsxs("button",{onClick:()=>Q("normal"),disabled:g,className:"w-full bg-green-600 hover:bg-green-700 disabled:bg-gray-700 text-white py-3 px-4 rounded-lg flex items-center justify-center gap-2 transition",children:[y.jsx(c3,{className:"w-5 h-5"}),"Start Normal Mode"]}),y.jsxs("button",{onClick:()=>Q("elf"),disabled:g,className:"w-full bg-purple-600 hover:bg-purple-700 disabled:bg-gray-700 text-white py-3 px-4 rounded-lg flex items-center justify-center gap-2 transition",children:[y.jsx(B_,{className:"w-5 h-5"}),"Start Elf Mode"]}),y.jsxs("button",{onClick:()=>Q("polygon"),disabled:g,className:"w-full bg-rose-600 hover:bg-rose-700 disabled:bg-gray-700 text-white py-3 px-4 rounded-lg flex items-center justify-center gap-2 transition",children:[y.jsx(fo,{className:"w-5 h-5"}),"Start Polygon Mode"]})]}),(t==null?void 0:t.status)==="running"&&y.jsxs("button",{onClick:D,disabled:g,className:"w-full bg-red-600 hover:bg-red-700 disabled:bg-gray-700 text-white py-3 px-4 rounded-lg flex items-center justify-center gap-2 transition",children:[y.jsx(d3,{className:"w-5 h-5"}),"Stop Round"]}),(t==null?void 0:t.status)==="finished"&&y.jsxs("button",{onClick:q,disabled:g,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-gray-700 text-white py-3 px-4 rounded-lg flex items-center justify-center gap-2 transition",children:[y.jsx(u3,{className:"w-5 h-5"}),"Reset Round"]})]}),y.jsxs("div",{className:"mb-6 p-3 bg-gray-800 rounded-lg",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"text-sm text-gray-300",children:"Show distance to players"}),y.jsx("button",{onClick:Y,className:`relative w-12 h-6 rounded-full transition-colors ${t!=null&&t.show_distance?"bg-green-500":"bg-gray-600"}`,children:y.jsx("div",{className:`absolute top-1 w-4 h-4 bg-white rounded-full transition-transform ${t!=null&&t.show_distance?"translate-x-7":"translate-x-1"}`})})]}),y.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t!=null&&t.show_distance?'Players can see their distance (e.g. "5.2 km")':"Players only see temperature hints"})]}),y.jsxs("div",{className:"flex-1 overflow-y-auto",children:[y.jsx("h2",{className:"text-lg font-bold mb-3",children:"Players by Distance"}),y.jsx("div",{className:"space-y-2",children:de.map(({player:se,distance:ae})=>y.jsxs("div",{className:"flex items-center justify-between p-2 bg-gray-800 rounded",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:Zi(ae)}}),y.jsx("span",{className:"text-sm font-medium truncate max-w-[140px]",children:se.nickname})]}),y.jsx("span",{className:"text-xs text-gray-400",children:ae>=1e3?`${(ae/1e3).toFixed(1)}km`:`${ae.toFixed(0)}m`})]},se.id))})]})]}),y.jsxs("div",{className:"flex-1 relative",children:[y.jsx("div",{ref:s,className:"w-full h-full"}),m&&w&&y.jsx("div",{className:"absolute top-8 left-1/2 -translate-x-1/2 z-10",children:y.jsx("div",{className:"bg-gradient-to-r from-yellow-400 via-red-500 to-yellow-400 text-white px-8 py-4 rounded-2xl shadow-2xl animate-bounce",children:y.jsxs("div",{className:"flex items-center gap-4",children:[y.jsx(or,{className:"w-10 h-10"}),y.jsxs("div",{children:[y.jsx("p",{className:"text-sm font-medium opacity-90",children:"Present Found!"}),y.jsxs("p",{className:"text-2xl font-bold",children:[w," Wins!"]})]}),y.jsx(or,{className:"w-10 h-10"})]})})}),m&&b.length>0&&y.jsx("div",{className:"absolute top-8 left-1/2 -translate-x-1/2 z-10 max-w-md w-full px-4",children:y.jsxs("div",{className:"bg-gradient-to-r from-yellow-400 via-red-500 to-yellow-400 text-white px-6 py-4 rounded-2xl shadow-2xl",children:[y.jsxs("div",{className:"text-center mb-4",children:[y.jsxs("div",{className:"flex justify-center gap-2 mb-2",children:[y.jsx(or,{className:"w-8 h-8"}),y.jsx(fo,{className:"w-8 h-8"}),y.jsx(or,{className:"w-8 h-8"})]}),y.jsx("p",{className:"text-sm font-medium opacity-90",children:"Polygon Filled!"}),y.jsxs("p",{className:"text-xl font-bold",children:[b.length," Winners!"]})]}),y.jsx("div",{className:"bg-white/20 rounded-lg p-3 max-h-48 overflow-y-auto",children:y.jsx("ol",{className:"space-y-1",children:b.map((se,ae)=>
4179y.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[y.jsxs("span",{className:"font-bold w-6",children:[ae+1,"."]}),y.jsx("span",{className:"truncate",children:se.nickname})]},se.id))})})]})})]})]})}function kP(){const{isAuthenticated:t,loading:e,signInWithGitHub:n}=Dp(),r=Ko(),[i,s]=k.useState(!1),[a,o]=k.useState(null);k.useEffect(()=>{!e&&t&&r("/admin",{replace:!0})},[t,e,r]);const l=async()=>{try{s(!0),o(null),await n()}catch(c){o(c.message||"Failed to sign in"),s(!1)}};return e?y.jsx("div",{className:"min-h-screen bg-gradient-to-b from-red-900 via-red-800 to-green-900 flex items-center justify-center",children:y.jsx(kh,{className:"w-8 h-8 text-white animate-spin"})}):y.jsx("div",{className:"min-h-screen bg-gradient-to-b from-red-900 via-red-800 to-green-900 flex items-center justify-center p-4",children:y.jsxs("div",{className:"bg-white/10 backdrop-blur-lg rounded-2xl p-8 max-w-md w-full text-center",children:[y.jsxs("div",{className:"mb-6",children:[y.jsx(or,{className:"w-16 h-16 text-yellow-400 mx-auto mb-4"}),y.jsx("h1",{className:"text-3xl font-bold text-white mb-2",children:"Admin Login"}),y.jsx("p",{className:"text-white/70",children:"Santa's Lost Present"})]}),y.jsx("p",{className:"text-white/80 mb-8",children:"Sign in with GitHub to access the admin dashboard and control the game."}),a&&y.jsx("div",{className:"bg-red-500/20 border border-red-500/50 rounded-lg p-3 mb-6",children:y.jsx("p",{className:"text-red-200 text-sm",children:a})}),y.jsxs("button",{onClick:l,disabled:i,className:"w-full bg-gray-900 hover:bg-gray-800 disabled:bg-gray-700 text-white py-4 px-6 rounded-xl flex items-center justify-center gap-3 transition font-semibold text-lg",children:[i?y.jsx(kh,{className:"w-6 h-6 animate-spin"}):y.jsx(a3,{className:"w-6 h-6"}),i?"Redirecting...":"Sign in with GitHub"]}),y.jsx("p",{className:"text-white/50 text-sm mt-6",children:"Only authorized admins can access the dashboard."})]})})}function OP(){return y.jsx("div",{className:"min-h-screen bg-gradient-to-br from-red-600 via-green-700 to-red-800 p-4",children:y.jsxs("div",{className:"max-w-4xl mx-auto",children:[y.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-6 mb-6",children:[y.jsxs("div",{className:"flex items-center justify-between mb-4",children:[y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsx(or,{className:"w-10 h-10 text-red-600"}),y.jsx("h1",{className:"text-4xl font-bold text-gray-900",children:"How to Play"})]}),y.jsxs(Pi,{to:"/",className:"flex items-center gap-2 text-gray-600 hover:text-gray-900 transition-colors",children:[y.jsx(k_,{className:"w-5 h-5"}),y.jsx("span",{className:"hidden sm:inline",children:"Home"})]})]}),y.jsx("p",{className:"text-gray-600 text-lg",children:"Help find Santa's lost present somewhere in Greater London!"})]}),y.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-6 mb-6",children:[y.jsxs("h2",{className:"text-2xl font-bold text-gray-900 mb-4 flex items-center gap-2",children:[y.jsx(h3,{className:"w-6 h-6 text-yellow-500"}),"Quick Start"]}),y.jsxs("ol",{className:"space-y-3 text-gray-700",children:[y.jsxs("li",{className:"flex items-start gap-3",children:[y.jsx("span",{className:"flex-shrink-0 w-6 h-6 bg-red-600 text-white rounded-full flex items-center justify-center font-bold",children:"1"}),y.jsx("span",{children:"Navigate to the game URL on your phone"})]}),y.jsxs("li",{className:"flex items-start gap-3",children:[y.jsx("span",{className:"flex-shrink-0 w-6 h-6 bg-red-600 text-white rounded-full flex items-center justify-center font-bold",children:"2"}),y.jsx("span",{children:"You'll automatically be assigned a festive Christmas nickname"})]}),y.jsxs("li",{className:"flex items-start gap-3",children:[y.jsx("span",{className:"flex-shrink-0 w-6 h-6 bg-red-600 text-white rounded-full flex items-center justify-center font-bold",children:"3"}),y.jsx("span",{children:"Wait for the admin to start a round"})]}),y.jsxs("li",{className:"flex items-start gap-3",children:[y.jsx("span",{className:"flex-shrink-0 w-6 h-6 bg-red-600 text-white rounded-full flex items-center justify-center font-bold",children:"4"}),y.jsx("span",{children:"Tap anywhere on the map to place your guess"})]}),y.jsxs("li",{className:"flex items-start gap-3",children:[y.jsx("span",{className:"flex-shrink-0 w-6 h-6 bg-red-600 text-white rounded-full flex items-center justify-center font-bold",children:"5"}),y.jsx("span",{children:"Update your guess as many times as you want"})]}),y.jsxs("li",{className:"flex items-start gap-3",children:[y.jsx("span",{className:"flex-shrink-0 w-6 h-6 bg-red-600 text-white rounded-full flex items-center justify-center font-bold",children:"6"}),y.jsx("span",{children:"Win by meeting the mode-specific victory condition!"})]})]})]}),y.jsxs("div",{className:"space-y-6 mb-6",children:[y.jsx("h2",{className:"text-3xl font-bold text-white text-center mb-6",children:"Game Modes"}),y.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-6",children:[y.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[y.jsx(l3,{className:"w-8 h-8 text-green-600"}),y.jsx("h3",{className:"text-2xl font-bold text-gray-900",children:"Normal Mode"})]}),y.jsx("p",{className:"text-gray-700 mb-4",children:"The classic treasure hunt! The present is hidden at a fixed location somewhere in Greater London."}),y.jsxs("div",{className:"bg-green-50 rounded-lg p-4 mb-4",children:[y.jsxs("h4",{className:"font-semibold text-gray-900 mb-2 flex items-center gap-2",children:[y.jsx(j0,{className:"w-5 h-5 text-green-600"}),"How to Win"]}),y.jsxs("p",{className:"text-gray-700",children:["Get your guess marker within ",y.jsx("strong",{children:"1 kilometer"})," of the hidden present. The first player to achieve this wins!"]})]}),y.jsxs("div",{className:"bg-blue-50 rounded-lg p-4",children:[y.jsx("h4",{className:"font-semibold text-gray-900 mb-2",children:"Distance Feedback"}),y.jsx("p",{className:"text-gray-700 mb-3",children:"Your marker changes color smoothly from red (close) to blue (far), and 
4179you'll see temperature labels:"}),y.jsxs("div",{className:"space-y-2 text-sm",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-lg",children:"🎁"}),y.jsx("span",{className:"font-medium",children:"YOU WIN!"}),y.jsx("span",{className:"text-gray-600 ml-auto",children:"≤ 1 km"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-lg",children:"🔥"}),y.jsx("span",{className:"font-medium",children:"BURNING HOT!"}),y.jsx("span",{className:"text-gray-600 ml-auto",children:"≤ 2 km"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-lg",children:"🔥"}),y.jsx("span",{className:"font-medium",children:"Very Hot!"}),y.jsx("span",{className:"text-gray-600 ml-auto",children:"≤ 5 km"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-lg",children:"🌡️"}),y.jsx("span",{className:"font-medium",children:"Hot"}),y.jsx("span",{className:"text-gray-600 ml-auto",children:"≤ 10 km"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-lg",children:"🌡️"}),y.jsx("span",{className:"font-medium",children:"Warm"}),y.jsx("span",{className:"text-gray-600 ml-auto",children:"≤ 15 km"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-lg",children:"😐"}),y.jsx("span",{className:"font-medium",children:"Lukewarm"}),y.jsx("span",{className:"text-gray-600 ml-auto",children:"≤ 20 km"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-lg",children:"❄️"}),y.jsx("span",{className:"font-medium",children:"Cool"}),y.jsx("span",{className:"text-gray-600 ml-auto",children:"≤ 25 km"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-lg",children:"🥶"}),y.jsx("span",{className:"font-medium",children:"Very Cold"}),y.jsx("span",{className:"text-gray-600 ml-auto",children:"≤ 30 km"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"text-lg",children:"🧊"}),y.jsx("span",{className:"font-medium",children:"Freezing!"}),y.jsx("span",{className:"text-gray-600 ml-auto",children:"> 30 km"})]})]}),y.jsxs("p",{className:"text-gray-600 text-sm mt-3",children:[y.jsx("strong",{children:"Note:"}),' Your marker color smoothly transitions from red (close) to blue (far). The admin may also enable distance display, showing exact distances like "5.2 km" or "150 m".']})]})]}),y.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-6",children:[y.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[y.jsx(B_,{className:"w-8 h-8 text-purple-600"}),y.jsx("h3",{className:"text-2xl font-bold text-gray-900",children:"Elf Mode"})]}),y.jsxs("p",{className:"text-gray-700 mb-4",children:["The mischievous elves are moving the present! The target location changes every ",y.jsx("strong",{children:"20 seconds"})," to a new random spot in Greater London."]}),y.jsxs("div",{className:"bg-purple-50 rounded-lg p-4 mb-4",children:[y.jsxs("h4",{className:"font-semibold text-gray-900 mb-2 flex items-center gap-2",children:[y.jsx(j0,{className:"w-5 h-5 text-purple-600"}),"How to Win"]}),y.jsxs("p",{className:"text-gray-700",children:["Get your guess marker within ",y.jsx("strong",{children:"1 kilometer"})," of the present's current location. Since the target moves, timing is crucial!"]})]}),y.jsxs("div",{className:"bg-yellow-50 rounded-lg p-4",children:[y.jsx("h4",{className:"font-semibold text-gray-900 mb-2",children:"Strategy Tips"}),y.jsxs("ul",{className:"space-y-2 text-gray-700",children:[y.jsxs("li",{className:"flex items-start gap-2",children:[y.jsx("span",{className:"text-purple-600 font-bold",children:"•"}),y.jsx("span",{children:"Watch your marker color closely - if it suddenly gets colder, the target has moved!"})]}),y.jsxs("li",{className:"flex items-start gap-2",children:[y.jsx("span",{className:"text-purple-600 font-bold",children:"•"}),y.jsx("span",{children:"Try to predict where the elves might move next based on the pattern"})]}),y.jsxs("li",{className:"flex items-start gap-2",children:[y.jsx("span",{className:"text-purple-600 font-bold",children:"•"}
vendor: 6,538 bytes, line 4179
4179),y.jsx("span",{children:"Quick reactions are key - update your guess frequently"})]})]})]}),y.jsxs("div",{className:"bg-blue-50 rounded-lg p-4 mt-4",children:[y.jsx("h4",{className:"font-semibold text-gray-900 mb-2",children:"Distance Feedback"}),y.jsx("p",{className:"text-gray-700",children:"Same color and temperature label system as Normal Mode - your marker smoothly transitions from red (close) to blue (far) and shows temperature labels based on your distance to the current target location."})]})]}),y.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-6",children:[y.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[y.jsx(fo,{className:"w-8 h-8 text-rose-600"}),y.jsx("h3",{className:"text-2xl font-bold text-gray-900",children:"Polygon Hunt Mode"})]}),y.jsx("p",{className:"text-gray-700 mb-4",children:"A collaborative challenge! The present is hidden somewhere inside a secret polygon-shaped area on the map. Work together with other players to find it!"}),y.jsxs("div",{className:"bg-rose-50 rounded-lg p-4 mb-4",children:[y.jsxs("h4",{className:"font-semibold text-gray-900 mb-2 flex items-center gap-2",children:[y.jsx(F_,{className:"w-5 h-5 text-rose-600"}),"How to Win"]}),y.jsxs("p",{className:"text-gray-700 mb-2",children:["When ",y.jsx("strong",{children:"10 players"})," have their guesses inside the hidden polygon, everyone inside wins together!"]}),y.jsx("p",{className:"text-gray-600 text-sm",children:"This is a team victory - no single winner, but a group celebration!"})]}),y.jsxs("div",{className:"bg-gradient-to-r from-rose-50 to-pink-50 rounded-lg p-4 mb-4",children:[y.jsxs("h4",{className:"font-semibold text-gray-900 mb-2 flex items-center gap-2",children:[y.jsx(fo,{className:"w-5 h-5 text-rose-600"}),"Polygon Visibility"]}),y.jsx("p",{className:"text-gray-700 mb-2",children:"The hidden polygon becomes more visible as players get closer to finding it:"}),y.jsxs("ul",{className:"space-y-1 text-sm text-gray-700",children:[y.jsxs("li",{children:["• ",y.jsx("strong",{children:"0-2 players inside:"})," Polygon is nearly invisible"]}),y.jsxs("li",{children:["• ",y.jsx("strong",{children:"3-5 players inside:"})," Polygon starts to appear faintly"]}),y.jsxs("li",{children:["• ",y.jsx("strong",{children:"6-8 players inside:"})," Polygon becomes clearly visible"]}),y.jsxs("li",{children:["• ",y.jsx("strong",{children:"9-10 players inside:"})," Polygon is fully visible - victory is near!"]})]})]}),y.jsxs("div",{className:"bg-blue-50 rounded-lg p-4",children:[y.jsx("h4",{className:"font-semibold text-gray-900 mb-2",children:"Marker Colors"}),y.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500"}),y.jsx("span",{className:"text-gray-700",children:"Green = Inside polygon"})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"w-4 h-4 rounded-full bg-gray-500"}),y.jsx("span",{className:"text-gray-700",children:"Gray = Outside polygon"})]})]}),y.jsxs("p",{className:"text-gray-600 text-sm mt-2",children:[y.jsx("strong",{children:"Note:"})," You won't see distance feedback in Polygon Mode - only whether you're inside or outside the target area."]})]})]})]}),y.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl p-6 mb-6",children:[y.jsxs("h2",{className:"text-2xl font-bold text-gray-900 mb-4 flex items-center gap-2",children:[y.jsx(O_,{className:"w-6 h-6 text-yellow-500"}),"Tips & Tricks"]}),y.jsxs("div",{className:"space-y-4 text-gray-700",children:[y.jsxs("div",{className:"bg-gradient-to-r from-yellow-50 to-orange-50 rounded-lg p-4",children:[y.jsx("h4",{className:"font-semibold text-gray-900 mb-2",children:"General Strategy"}),y.jsxs("ul",{className:"space-y-2",children:[y.jsxs("li",{className:"flex items-start gap-2",children:[y.jsx("span",{className:"text-yellow-600 font-bold",children:"•"}),y.jsx("span",{children:"Use landmarks and your knowledge of London to narrow down locations"})]}),y.jsxs("li",{className:"flex items-start gap-2",children:[y.jsx("span",{className:"text-yellow-600 font-bold",children:"•"}),y.jsx("span",{children:"Watch other players' markers on the big screen (if visible) - they might be onto something!"})]}),y.jsxs("li",{className:"flex items-start gap-2",children:[y.jsx("span",{className:"text-yellow-600 font-bold",children:"•"}),y.jsx("span",{children:"Don't be afraid to make multiple guesses - there's no penalty for trying"})]}),y.jsxs("li",{className:"flex items-start gap-2",children:[y.jsx("span",{className:"text-yellow-600 font-bold",children:"•"}),y.jsx("span",{children:"In Normal and Elf modes, pay attention to your marker color changes"})]})]})]}),y.jsxs("div",{className:"bg-blue-50 rounded-lg p-4",children:[y.jsx("h4",{className:"font-semibold text-gray-900 mb-2",children:"Mobile Tips"}),y.jsxs("ul",{className:"space-y-2",children:[y.jsxs("li",{className:"flex items-start gap-2",children:[y.jsx("span",{className:"text-blue-600 font-bold",children:"•"}),y.jsx("span",{children:"Pinch to zoom on the map for more precise guessing"})]}),y.jsxs("li",{className:"flex items-start gap-2",children:[y.jsx("span",{className:"text-blue-600 font-bold",children:"•"}),y.jsx("span",{children:"Rotate your device to landscape for a wider view"})]}),y.jsxs("li",{className:"flex items-start gap-2",children:[y.jsx("span",{className:"text-blue-600 font-bold",children:"•"}),y.jsx("span",{children:"Make sure your location services are enabled for better map performance"})]})]})]})]})]}),y.jsx("div",{className:"bg-white rounded-2xl shadow-2xl p-6 text-center mb-6",children:y.jsxs(Pi,{to:"/game",className:"inline-flex items-center gap-2 bg-red-600 text-white font-bold py-3 px-8 rounded-lg hover:bg-red-700 transition-all transform hover:scale-105 shadow-lg",children:[y.jsx(or,{className:"w-5 h-5"}),"Start Playing"]})}),y.jsx("footer",{className:"relative z-20",children:y.jsx("div",{className:"max-w-4xl mx-auto",children:y.jsx("div",{className:"bg-black/80 backdrop-blur-md rounded-lg border border-white/20 p-3",children:y.jsx("div",{className:"flex flex-wrap justify-center items-center gap-4 text-sm",children:y.jsxs("div",{className:"flex items-center gap-4 text-gray-300",children:[y.jsxs("a",{href:"https://github.com/mandarini",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-white transition-colors",children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"
4179currentColor",children:y.jsx("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})}),"GitHub"]}),y.jsxs("a",{href:"https://x.com/psybercity",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-white transition-colors",children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),"Twitter"]}),y.jsxs("a",{href:"https://psyber.city",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-white transition-colors",children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})}),"Website"]}),y.jsx("span",{className:"text-gray-500",children:"|"}),y.jsxs("a",{href:"https://github.com/mandarini/santas-lost-present",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-white transition-colors",children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"})}),"Source Code"]}),y.jsxs("a",{href:"https://supabase.com/docs",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-white transition-colors",children:[y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:y.jsx("path",{d:"M21.362 9.354H12V.396a.396.396 0 0 0-.716-.233L2.203 12.424l-.401.562a1.04 1.04 0 0 0 .836 1.659H12v8.959a.396.396 0 0 0 .716.233l9.081-12.261.401-.562a1.04 1.04 0 0 0-.836-1.66z"})}),"Supabase Docs"]})]})})})})})]})})}const Bs={lat:51.5197,lng:-.0754,altitude:50};function FP(){const t=k.useRef(null),[e,n]=k.useState(!0),[r,i]=k.useState(null);return k.useEffect(()=>{let s=null;async function a(){var o,l;try{const c="AIzaSyAD7tBmyWCa4NzpLyK1Tj57FNulquxQmdY";(l=(o=window.google)==null?void 0:o.maps)!=null&&l.importLibrary||await new Promise((f,p)=>{const g=document.createElement("script");g.innerHTML=`
4180              (g=>{var h,a,k,p="The Google Maps JavaScript API",c="google",l="importLibrary",q="__ib__",m=document,b=window;b=b[c]||(b[c]={});var d=b.maps||(b.maps={}),r=new Set,e=new URLSearchParams,u=()=>h||(h=new Promise(async(f,n)=>{await (a=m.createElement("script"));e.set("libraries",[...r]+"");for(k in g)e.set(k.replace(/[A-Z]/g,t=>"_"+t[0].toLowerCase()),g[k]);e.set("callback",c+".maps."+q);a.src=\`https://maps.\${c}apis.com/maps/api/js?\`+e;d[q]=f;a.onerror=()=>h=n(Error(p+" could not load."));a.nonce=m.querySelector("script[nonce]")?.nonce||"";m.head.append(a)}));d[l]?console.warn(p+" only loads once. Ignoring:",g):d[l]=(f,...n)=>r.add(f)&&u().then(()=>d[l](f,...n))})({
4181                key: "${c}",
4182                v: "beta",
4183                internalUsageAttributionIds: "gmp_mcp_codeassist_v0.1_github"
4184              });
4185            `,document.head.appendChild(g);const _=setInterval(()=>{var m,h;(h=(m=window.google)==null?void 0:m.maps)!=null&&h.importLibrary&&(clearInterval(_),f())},100);setTimeout(()=>{clearInterval(_),p(new Error("Timeout loading Google Maps"))},1e4)});const{Map3DElement:u}=await window.google.maps.importLibrary("maps3d"),d={center:{lat:Bs.lat,lng:Bs.lng,altitude:Bs.altitude},range:800,tilt:65,heading:0};s=new u({center:{lat:Bs.lat,lng:Bs.lng,altitude:Bs.altitude+200},range:1500,tilt:55,heading:-45,mode:"SATELLITE"}),t.current&&(t.current.innerHTML="",t.current.appendChild(s)),n(!1),setTimeout(()=>{s&&(s.flyCameraTo({endCamera:d,durationMillis:5e3}),s.addEventListener("gmp-animationend",()=>{s.flyCameraAround({camera:d,durationMillis:6e4,rounds:2})},{once:!0}))},1e3),s.addEventListener("gmp-click",()=>{s.stopCameraAnimation()})}catch(c){console.error("Error initializing 3D map:",c),i(c instanceof Error?c.message:"Failed to load 3D map"),n(!1)}}return a(),()=>{var o;
4185s&&((o=s.stopCameraAnimation)==null||o.call(s))}},[]),r?y.jsx("div",{className:"min-h-screen bg-gray-900 flex items-center justify-center",children:y.jsxs("div",{className:"text-center text-white p-8",children:[y.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Error Loading 3D Map"}),y.jsx("p",{className:"text-gray-400",children:r})]})}):y.jsxs("div",{className:"relative w-full h-screen",children:[e&&y.jsx("div",{className:"absolute inset-0 bg-gray-900 flex items-center justify-center z-10",children:y.jsxs("div",{className:"text-center text-white",children:[y.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-white mx-auto mb-4"}),y.jsx("p",{className:"text-lg",children:"Loading Spitalfields 3D..."})]})}),y.jsx("div",{ref:t,className:"w-full h-full"}),!e&&y.jsxs("div",{className:"absolute bottom-6 left-6 bg-black/70 text-white px-4 py-3 rounded-lg backdrop-blur-sm",children:[y.jsx("h2",{className:"font-bold text-lg",children:"Spitalfields, London"}),y.jsx("p",{className:"text-sm text-gray-300",children:"Click anywhere to stop the animation"})]})]})}function BP({children:t}){const{isAuthenticated:e,loading:n}=Dp();return n?y.jsx("div",{className:"min-h-screen bg-gray-900 flex items-center justify-center",children:y.jsxs("div",{className:"text-center",children:[y.jsx(kh,{className:"w-8 h-8 text-white animate-spin mx-auto mb-4"}),y.jsx("p",{className:"text-white/70",children:"Checking authentication..."})]})}):e?y.jsx(y.Fragment,{children:t}):y.jsx(u_,{to:"/admin/login",replace:!0})}function zP(){return y.jsx(fb,{children:y.jsxs(G1,{children:[y.jsx(oi,{path:"/",element:y.jsx(f3,{})}),y.jsx(oi,{path:"/game",element:y.jsx(x3,{})}),y.jsx(oi,{path:"/instructions",element:y.jsx(OP,{})}),y.jsx(oi,{path:"/spitalfields",element:y.jsx(FP,{})}),y.jsx(oi,{path:"/admin/login",element:y.jsx(kP,{})}),y.jsx(oi,{path:"/admin",element:y.jsx(BP,{children:y.jsx(UP,{})})}),y.jsx(oi,{path:"*",element:y.jsx(u_,{to:"/",replace:!0})})]})})}e_(document.getElementById("root")).render(y.jsx(k.StrictMode,{children:y.jsx(zP,{})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.