PageSourceSearch

https://stellar-void.netlify.app/assets/index-sZawWQES.js

js stellar-void.netlify.app collected 2026-10-03 11:27:05 UTC 1,904,595 bytes, 4,094 lines download raw bytes

vendor: 4,109 bytes, lines 1-9
1var wee=Object.defineProperty;var s4=n=>{throw TypeError(n)};var xee=(n,e,t)=>e in n?wee(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ce=(n,e,t)=>xee(n,typeof e!="symbol"?e+"":e,t),pT=(n,e,t)=>e.has(n)||s4("Cannot "+t);var V=(n,e,t)=>(pT(n,e,"read from private field"),t?t.call(n):e.get(n)),ge=(n,e,t)=>e.has(n)?s4("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),ee=(n,e,t,i)=>(pT(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),Ge=(n,e,t)=>(pT(n,e,"access private method"),t);var Cy=(n,e,t,i)=>({set _(r){ee(n,e,r,t)},get _(){return V(n,e,i)}});(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();var El=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function AA(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function p9(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function i(){return this instanceof i?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(i){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(t,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}),t}var m9={exports:{}},MA={},g9={exports:{}},Wt={};/**
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 N1=Symbol.for("react.element"),bee=Symbol.for("react.portal"),_ee=Symbol.for("react.fragment"),Eee=Symbol.for("react.strict_mode"),See=Symbol.for("react.profiler"),Aee=Symbol.for("react.provider"),Mee=Symbol.for("react.context"),Tee=Symbol.for("react.forward_ref"),Pee=Symbol.for("react.suspense"),Cee=Symbol.for("react.memo"),Iee=Symbol.for("react.lazy"),o4=Symbol.iterator;function Ree(n){return n===null||typeof n!="object"?null:(n=o4&&n[o4]||n["@@iterator"],typeof n=="function"?n:null)}var y9={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v9=Object.assign,w9={};function j0(n,e,t){this.props=n,this.context=e,this.refs=w9,this.updater=t||y9}j0.prototype.isReactComponent={};j0.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};j0.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function x9(){}x9.prototype=j0.prototype;function XN(n,e,t){this.props=n,this.context=e,this.refs=w9,this.updater=t||y9}var YN=XN.prototype=new x9;YN.constructor=XN;v9(YN,j0.prototype);YN.isPureReactComponent=!0;var a4=Array.isArray,b9=Object.prototype.hasOwnProperty,QN={current:null},_9={key:!0,ref:!0,__self:!0,__source:!0};function E9(n,e,t){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)b9.call(e,i)&&!_9.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=t;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];r.children=l}if(n&&n.defaultProps)for(i in a=n.defaultProps,a)r[i]===void 0&&(r[i]=a[i]);
vendor: 5,192 bytes, lines 9-17
9return{$$typeof:N1,type:n,key:s,ref:o,props:r,_owner:QN.current}}function Nee(n,e){return{$$typeof:N1,type:n.type,key:e,ref:n.ref,props:n.props,_owner:n._owner}}function ZN(n){return typeof n=="object"&&n!==null&&n.$$typeof===N1}function Dee(n){var e={"=":"=0",":":"=2"};return"$"+n.replace(/[=:]/g,function(t){return e[t]})}var l4=/\/+/g;function mT(n,e){return typeof n=="object"&&n!==null&&n.key!=null?Dee(""+n.key):e.toString(36)}function hE(n,e,t,i,r){var s=typeof n;(s==="undefined"||s==="boolean")&&(n=null);var o=!1;if(n===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(n.$$typeof){case N1:case bee:o=!0}}if(o)return o=n,r=r(o),n=i===""?"."+mT(o,0):i,a4(r)?(t="",n!=null&&(t=n.replace(l4,"$&/")+"/"),hE(r,e,t,"",function(c){return c})):r!=null&&(ZN(r)&&(r=Nee(r,t+(!r.key||o&&o.key===r.key?"":(""+r.key).replace(l4,"$&/")+"/")+n)),e.push(r)),1;if(o=0,i=i===""?".":i+":",a4(n))for(var a=0;a<n.length;a++){s=n[a];var l=i+mT(s,a);o+=hE(s,e,t,l,r)}else if(l=Ree(n),typeof l=="function")for(n=l.call(n),a=0;!(s=n.next()).done;)s=s.value,l=i+mT(s,a++),o+=hE(s,e,t,l,r);else if(s==="object")throw e=String(n),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(n).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function db(n,e,t){if(n==null)return n;var i=[],r=0;return hE(n,i,"","",function(s){return e.call(t,s,r++)}),i}function Oee(n){if(n._status===-1){var e=n._result;e=e(),e.then(function(t){(n._status===0||n._status===-1)&&(n._status=1,n._result=t)},function(t){(n._status===0||n._status===-1)&&(n._status=2,n._result=t)}),n._status===-1&&(n._status=0,n._result=e)}if(n._status===1)return n._result.default;throw n._result}var hs={current:null},fE={transition:null},Lee={ReactCurrentDispatcher:hs,ReactCurrentBatchConfig:fE,ReactCurrentOwner:QN};function S9(){throw Error("act(...) is not supported in production builds of React.")}Wt.Children={map:db,forEach:function(n,e,t){db(n,function(){e.apply(this,arguments)},t)},count:function(n){var e=0;return db(n,function(){e++}),e},toArray:function(n){return db(n,function(e){return e})||[]},only:function(n){if(!ZN(n))throw Error("React.Children.only expected to receive a single React element child.");return n}};Wt.Component=j0;Wt.Fragment=_ee;Wt.Profiler=See;Wt.PureComponent=XN;Wt.StrictMode=Eee;Wt.Suspense=Pee;Wt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Lee;Wt.act=S9;Wt.cloneElement=function(n,e,t){if(n==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+n+".");var i=v9({},n.props),r=n.key,s=n.ref,o=n._owner;if(e!=null){if(e.ref!==void 0&&(s=e.ref,o=QN.current),e.key!==void 0&&(r=""+e.key),n.type&&n.type.defaultProps)var a=n.type.defaultProps;for(l in e)b9.call(e,l)&&!_9.hasOwnProperty(l)&&(i[l]=e[l]===void 0&&a!==void 0?a[l]:e[l])}var l=arguments.length-2;if(l===1)i.children=t;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];i.children=a}return{$$typeof:N1,type:n.type,key:r,ref:s,props:i,_owner:o}};Wt.createContext=function(n){return n={$$typeof:Mee,_currentValue:n,_currentValue2:n,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},n.Provider={$$typeof:Aee,_context:n},n.Consumer=n};Wt.createElement=E9;Wt.createFactory=function(n){var e=E9.bind(null,n);return e.type=n,e};Wt.createRef=function(){return{current:null}};Wt.forwardRef=function(n){return{$$typeof:Tee,render:n}};Wt.isValidElement=ZN;Wt.lazy=function(n){return{$$typeof:Iee,_payload:{_status:-1,_result:n},_init:Oee}};Wt.memo=function(n,e){return{$$typeof:Cee,type:n,compare:e===void 0?null:e}};Wt.startTransition=function(n){var e=fE.transition;fE.transition={};try{n()}finally{fE.transition=e}};Wt.unstable_act=S9;Wt.useCallback=function(n,e){return hs.current.useCallback(n,e)};Wt.useContext=function(n){return hs.current.useContext(n)};Wt.useDebugValue=function(){};Wt.useDeferredValue=function(n){return hs.current.useDeferredValue(n)};Wt.useEffect=function(n,e){return hs.current.useEffect(n,e)};Wt.useId=function(){return hs.current.useId()};Wt.useImperativeHandle=function(n,e,t){return hs.current.useImperativeHandle(n,e,t)};Wt.useInsertionEffect=function(n,e){return hs.current.useInsertionEffect(n,e)};Wt.useLayoutEffect=function(n,e){return hs.current.useLayoutEffect(n,e)};Wt.useMemo=function(n,e){return hs.current.useMemo(n,e)};Wt.useReducer=function(n,e,t){return hs.current.useReducer(n,e,t)};Wt.useRef=function(n){return hs.current.useRef(n)};Wt.useState=function(n){return hs.current.useState(n)};Wt.useSyncExternalStore=function(n,e,t){return hs.current.useSyncExternalStore(n,e,t)};Wt.useTransition=function(){return hs.current.useTransition()};Wt.version="18.3.1";g9.exports=Wt;var fe=g9.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 Uee=fe,Bee=Symbol.for("react.element"),kee=Symbol.for("react.fragment"),Fee=Object.prototype.hasOwnProperty,zee=Uee.__SECRET_INT
vendor: 10,725 bytes, lines 17-33
17ERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Vee={key:!0,ref:!0,__self:!0,__source:!0};function A9(n,e,t){var i,r={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(i in e)Fee.call(e,i)&&!Vee.hasOwnProperty(i)&&(r[i]=e[i]);if(n&&n.defaultProps)for(i in e=n.defaultProps,e)r[i]===void 0&&(r[i]=e[i]);return{$$typeof:Bee,type:n,key:s,ref:o,props:r,_owner:zee.current}}MA.Fragment=kee;MA.jsx=A9;MA.jsxs=A9;m9.exports=MA;var j=m9.exports,M9={exports:{}},xo={},T9={exports:{}},P9={};/**
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(n){function e(N,O){var B=N.length;N.push(O);e:for(;0<B;){var W=B-1>>>1,Q=N[W];if(0<r(Q,O))N[W]=O,N[B]=Q,B=W;else break e}}function t(N){return N.length===0?null:N[0]}function i(N){if(N.length===0)return null;var O=N[0],B=N.pop();if(B!==O){N[0]=B;e:for(var W=0,Q=N.length,oe=Q>>>1;W<oe;){var Y=2*(W+1)-1,te=N[Y],le=Y+1,ve=N[le];if(0>r(te,B))le<Q&&0>r(ve,te)?(N[W]=ve,N[le]=B,W=le):(N[W]=te,N[Y]=B,W=Y);else if(le<Q&&0>r(ve,B))N[W]=ve,N[le]=B,W=le;else break e}}return O}function r(N,O){var B=N.sortIndex-O.sortIndex;return B!==0?B:N.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,h=null,f=3,m=!1,g=!1,v=!1,w=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(N){for(var O=t(c);O!==null;){if(O.callback===null)i(c);else if(O.startTime<=N)i(c),O.sortIndex=O.expirationTime,e(l,O);else break;O=t(c)}}function S(N){if(v=!1,x(N),!g)if(t(l)!==null)g=!0,R(M);else{var O=t(c);O!==null&&F(S,O.startTime-N)}}function M(N,O){g=!1,v&&(v=!1,y(D),D=-1),m=!0;var B=f;try{for(x(O),h=t(l);h!==null&&(!(h.expirationTime>O)||N&&!U());){var W=h.callback;if(typeof W=="function"){h.callback=null,f=h.priorityLevel;var Q=W(h.expirationTime<=O);O=n.unstable_now(),typeof Q=="function"?h.callback=Q:h===t(l)&&i(l),x(O)}else i(l);h=t(l)}if(h!==null)var oe=!0;else{var Y=t(c);Y!==null&&F(S,Y.startTime-O),oe=!1}return oe}finally{h=null,f=B,m=!1}}var A=!1,I=null,D=-1,k=5,C=-1;function U(){return!(n.unstable_now()-C<k)}function G(){if(I!==null){var N=n.unstable_now();C=N;var O=!0;try{O=I(!0,N)}finally{O?H():(A=!1,I=null)}}else A=!1}var H;if(typeof _=="function")H=function(){_(G)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,P=z.port2;z.port1.onmessage=G,H=function(){P.postMessage(null)}}else H=function(){w(G,0)};function R(N){I=N,A||(A=!0,H())}function F(N,O){D=w(function(){N(n.unstable_now())},O)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(N){N.callback=null},n.unstable_continueExecution=function(){g||m||(g=!0,R(M))},n.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<N?Math.floor(1e3/N):5},n.unstable_getCurrentPriorityLevel=function(){return f},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(N){switch(f){case 1:case 2:case 3:var O=3;break;default:O=f}var B=f;f=O;try{return N()}finally{f=B}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(N,O){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var B=f;f=N;try{return O()}finally{f=B}},n.unstable_scheduleCallback=function(N,O,B){var W=n.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?W+B:W):B=W,N){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=B+Q,N={id:u++,callback:O,priorityLevel:N,startTime:B,expirationTime:Q,sortIndex:-1},B>W?(N.sortIndex=B,e(c,N),t(l)===null&&N===t(c)&&(v?(y(D),D=-1):v=!0,F(S,B-W))):(N.sortIndex=Q,e(l,N),g||m||(g=!0,R(M))),N},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(N){var O=f;return function(){var B=f;f=O;try{return N.apply(this,arguments)}finally{f=B}}}})(P9);T9.exports=P9;var Hee=T9.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 $ee=fe,yo=Hee;function De(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t<arguments.length;t++)e+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+n+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var C9=new Set,uw={};function wp(n,e){v0(n,e),v0(n+"Capture",e)}function v0(n,e){for(uw[n]=e,n=0;n<e.length;n++)C9.add(e[n])}var Yc=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m3=Object.prototype.hasOwnProperty,Gee=/^[: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]*$/,c4={},u4={};function jee(n){return m3.call(u4,n)?!0:m3.call(c4,n)?!1:Gee.test(n)?u4[n]=!0:(c4[n]=!0,!1)}function Wee(n,e,t,i){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function qee(n,e,t,i){if(e===null||typeof e>"u"||Wee(n,e,t,i))return!0;if(i)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function fs(n,e,t,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var pr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){pr[n]=new fs(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];pr[e]=new fs(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){pr[n]=new fs(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){pr[n]=new fs(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){pr[n]=new fs(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){pr[n]=new fs(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){pr[n]=new fs(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){pr[n]=new fs(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){pr[n]=new fs(n,5,!1,n.toLowerCase(),null,!1,!1)});var JN=/[\-:]([a-z])/g;function eD(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(JN,eD);pr[e]=new fs(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(JN,eD);pr[e]=new fs(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(JN,eD);pr[e]=new fs(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){pr[n]=new fs(n,1,!1,n.toLowerCase(),null,!1,!1)});pr.xlinkHref=new fs("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){pr[n]=new fs(n,1,!1,n.toLowerCase(),null,!0,!0)});function tD(n,e,t,i){var r=pr.hasOwnProperty(e)?pr[e]:null;(r!==null?r.type!==0:i||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(qee(e,t,r,i)&&(t=null),i||r===null?jee(e)&&(t===null?n.removeAttribute(e):n.setAttribute(e,""+t)):r.mustUseProperty?n[r.propertyName]=t===null?r.type===3?!1:"":t:(e=r.attributeName,i=r.attributeNamespace,t===null?n.removeAttribute(e):(r=r.type,t=r===3||r===4&&t===!0?"":""+t,i?n.setAttributeNS(i,e,t):n.setAttribute(e,t))))}var cu=$ee.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,pb=Symbol.for("react.element"),Bm=Symbol.for("react.portal"),km=Symbol.for("react.fragment"),nD=Symbol.for("react.strict_mode"),g3=Symbol.for("react.profiler"),I9=Symbol.for("react.provider"),R9=Symbol.for("react.context"),iD=Symbol.for("react.forward_ref"),y3=Symbol.for("react.suspense"),v3=Symbol.for("react.suspense_list"),rD=Symbol.for("react.memo"),Yu=Symbol.for("react.lazy"),N9=Symbol.for("react.offscreen"),h4=Symbol.iterator;
vendor: 4,376 bytes, lines 33-37
33function Iy(n){return n===null||typeof n!="object"?null:(n=h4&&n[h4]||n["@@iterator"],typeof n=="function"?n:null)}var Xn=Object.assign,gT;function wv(n){if(gT===void 0)try{throw Error()}catch(t){var e=t.stack.trim().match(/\n( *(at )?)/);gT=e&&e[1]||""}return`
34`+gT+n}var yT=!1;function vT(n,e){if(!n||yT)return"";yT=!0;var t=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 i=c}Reflect.construct(n,[],e)}else{try{e.call()}catch(c){i=c}n.call(e.prototype)}else{try{throw Error()}catch(c){i=c}n()}}catch(c){if(c&&i&&typeof c.stack=="string"){for(var r=c.stack.split(`
35`),s=i.stack.split(`
36`),o=r.length-1,a=s.length-1;1<=o&&0<=a&&r[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(r[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||r[o]!==s[a]){var l=`
37`+r[o].replace(" at new "," at ");return n.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{yT=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?wv(n):""}function Kee(n){switch(n.tag){case 5:return wv(n.type);case 16:return wv("Lazy");case 13:return wv("Suspense");case 19:return wv("SuspenseList");case 0:case 2:case 15:return n=vT(n.type,!1),n;case 11:return n=vT(n.type.render,!1),n;case 1:return n=vT(n.type,!0),n;default:return""}}function w3(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case km:return"Fragment";case Bm:return"Portal";case g3:return"Profiler";case nD:return"StrictMode";case y3:return"Suspense";case v3:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case R9:return(n.displayName||"Context")+".Consumer";case I9:return(n._context.displayName||"Context")+".Provider";case iD:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case rD:return e=n.displayName||null,e!==null?e:w3(n.type)||"Memo";case Yu:e=n._payload,n=n._init;try{return w3(n(e))}catch{}}return null}function Xee(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return w3(e);case 8:return e===nD?"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 Vh(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function D9(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Yee(n){var e=D9(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),i=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var r=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function mb(n){n._valueTracker||(n._valueTracker=Yee(n))}function O9(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),i="";return n&&(i=D9(n)?n.checked?"true":"false":n.value),n=i,n!==t?(e.setValue(n),!0):!1}function JE(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function x3(n,e){var t=e.checked;return Xn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function f4(n,e){var t=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;
vendor: 4,821 bytes, line 37
37t=Vh(e.value!=null?e.value:t),n._wrapperState={initialChecked:i,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function L9(n,e){e=e.checked,e!=null&&tD(n,"checked",e,!1)}function b3(n,e){L9(n,e);var t=Vh(e.value),i=e.type;if(t!=null)i==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(i==="submit"||i==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?_3(n,e.type,t):e.hasOwnProperty("defaultValue")&&_3(n,e.type,Vh(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function d4(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function _3(n,e,t){(e!=="number"||JE(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var xv=Array.isArray;function mg(n,e,t,i){if(n=n.options,e){e={};for(var r=0;r<t.length;r++)e["$"+t[r]]=!0;for(t=0;t<n.length;t++)r=e.hasOwnProperty("$"+n[t].value),n[t].selected!==r&&(n[t].selected=r),r&&i&&(n[t].defaultSelected=!0)}else{for(t=""+Vh(t),e=null,r=0;r<n.length;r++){if(n[r].value===t){n[r].selected=!0,i&&(n[r].defaultSelected=!0);return}e!==null||n[r].disabled||(e=n[r])}e!==null&&(e.selected=!0)}}function E3(n,e){if(e.dangerouslySetInnerHTML!=null)throw Error(De(91));return Xn({},e,{value:void 0,defaultValue:void 0,children:""+n._wrapperState.initialValue})}function p4(n,e){var t=e.value;if(t==null){if(t=e.children,e=e.defaultValue,t!=null){if(e!=null)throw Error(De(92));if(xv(t)){if(1<t.length)throw Error(De(93));t=t[0]}e=t}e==null&&(e=""),t=e}n._wrapperState={initialValue:Vh(t)}}function U9(n,e){var t=Vh(e.value),i=Vh(e.defaultValue);t!=null&&(t=""+t,t!==n.value&&(n.value=t),e.defaultValue==null&&n.defaultValue!==t&&(n.defaultValue=t)),i!=null&&(n.defaultValue=""+i)}function m4(n){var e=n.textContent;e===n._wrapperState.initialValue&&e!==""&&e!==null&&(n.value=e)}function B9(n){switch(n){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 S3(n,e){return n==null||n==="http://www.w3.org/1999/xhtml"?B9(e):n==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":n}var gb,k9=function(n){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,t,i,r){MSApp.execUnsafeLocalFunction(function(){return n(e,t,i,r)})}:n}(function(n,e){if(n.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in n)n.innerHTML=e;else{for(gb=gb||document.createElement("div"),gb.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=gb.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function hw(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Bv={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},Qee=["Webkit","ms","Moz","O"];Object.keys(Bv).forEach(function(n){Qee.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Bv[e]=Bv[n]})});function F9(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Bv.hasOwnProperty(n)&&Bv[n]?(""+e).trim():e+"px"}function z9(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var i=t.indexOf("--")===0,r=F9(t,e[t],i);t==="float"&&(t="cssFloat"),i?n.setProperty(t,r):n[t]=r}}var Zee=Xn({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 A3(n,e){if(e){if(Zee[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(De(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(De(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(De(61))}if(e.style!=null&&typeof e.style!="object")throw Error(De(62))}}function M3(n,e){if(n.indexOf("-")===-1)return typeof e.is=="str
37ing";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var T3=null;function sD(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var P3=null,gg=null,yg=null;function g4(n){if(n=L1(n)){if(typeof P3!="function")throw Error(De(280));var e=n.stateNode;e&&(e=RA(e),P3(n.stateNode,n.type,e))}}function V9(n){gg?yg?yg.push(n):yg=[n]:gg=n}function H9(){if(gg){var n=gg,e=yg;if(yg=gg=null,g4(n),e)for(n=0;n<e.length;n++)g4(e[n])}}function $9(n,e){return n(e)}function G9(){}var wT=!1;function j9(n,e,t){if(wT)return n(e,t);wT=!0;try{return $9(n,e,t)}finally{wT=!1,(gg!==null||yg!==null)&&(G9(),H9())}}function fw(n,e){var t=n.stateNode;if(t===null)return null;var i=RA(t);if(i===null)return null;t=i[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":(i=!i.disabled)||(n=n.type,i=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!i;break e;default:n=!1}if(n)return null;if(t&&typeof t!="function")throw Error(De(231,e,typeof t));return t}var C3=!1;if(Yc)try{var Ry={};Object.defineProperty(Ry,"passive",{get:function(){C3=!0}}),window.addEventListener("test",Ry,Ry),window.removeEventListener("test",Ry,Ry)}catch{C3=!1}function Jee(n,e,t,i,r,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{e.apply(t,c)}catch(u){this.onError(u)}}var kv=!1,eS=null,tS=!1,I3=null,ete={onError:function(n){kv=!0,eS=n}};function tte(n,e,t,i,r,s,o,a,l){kv=!1,eS=null,Jee.apply(ete,arguments)}function nte(n,e,t,i,r,s,o,a,l){if(tte.apply(this,arguments),kv){if(kv){var c=eS;kv=!1,eS=null}else throw Error(De(198));tS||(tS=!0,I3=c)}}function xp(n){var e=n,t=n;if(n.alternate)for(;e.return;)e=e.return;else{n=e;do e=n,e.flags&4098&&(t=e.return),n=e.return;while(n)}return e.tag===3?t:null}function W9(n){if(n.tag===13){var e=n.memoizedState;if(e===null&&(n=n.alternate,n!==null&&(e=n.memoizedState)),e!==null)return e.dehydrated}return null}function y4(n){if(xp(n)!==n)throw Error(De(188))}function ite(n){var e=n.alternate;if(!e){if(e=xp(n),e===null)throw Error(De(188));return e!==n?null:n}for(var t=n,i=e;;){var r=t.return;if(r===null)break;var s=r.alternate;if(s===null){if(i=r.return,i!==null){t=i;continue}break}if(r.child===s.child){for(s=r.child;s;){if(s===t)return y4(r),n;if(s===i)return y4(r),e;s=s.sibling}throw Error(De(188))}if(t.return!==i.return)t=r,i=s;else{for(var o=!1,a=r.child;a;){if(a===t){o=!0,t=r,i=s;break}if(a===i){o=!0,i=r,t=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===t){o=!0,t=s,i=r;break}if(a===i){o=!0,i=s,t=r;break}a=a.sibling}if(!o)throw Error(De(189))}}if(t.alternate!==i)throw Error(De(190))}if(t.tag!==3)throw Error(De(188));return t.stateNode.current===t?n:e}function q9(n){return n=ite(n),n!==null?K9(n):null}function K9(n){if(n.tag===5||n.tag===6)return n;for(n=n.child;n!==null;){var e=K9(n);if(e!==null)return e;n=n.sibling}return null}var X9=yo.unstable_scheduleCallback,v4=yo.unstable_cancelCallback,rte=yo.unstable_shouldYield,ste=yo.unstable_requestPaint,fi=yo.unstable_now,ote=yo.unstable_getCurrentPriorityLevel,oD=yo.unstable_ImmediatePriority,Y9=yo.unstable_UserBlockingPriority,nS=yo.unstable_NormalPriority,ate=yo.unstable_LowPriority,Q9=yo.unstable_IdlePriority,TA=null,Nl=null;function lte(n){if(Nl&&typeof Nl.onCommitFiberRoot=="function")try{Nl.onCommitFiberRoot(TA,n,void 0,(n.current.flags&128)===128)}catch{}}var Ba=Math.clz32?Math.clz32:hte,cte=Math.log,ute=Math.LN2;function hte(n){return n>>>=0,n===0?32:31-(cte(n)/ute|0)|0}var yb=64,vb=4194304;function bv(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function iS(n,e){var t=n.pendingLanes;if(t===0)return 0;var i=0,r=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~r;a!==0?i=bv(a):(s&=o,s!==0&&(i=bv(s)))}else o=t&~r,o!==0?i=bv(o):s!==0&&(i=bv(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=i;0<e;)t=31-Ba(e),r=1<<t,i|=n[t],e&=~r;return i}function fte(n,e){switch(n){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 dte(n,e){for(var t=n.suspendedLanes,i=n.pingedLanes,r=n.expirationTimes,s=n.pendingLanes;0<s;
vendor: 4,405 bytes, line 37
37){var o=31-Ba(s),a=1<<o,l=r[o];l===-1?(!(a&t)||a&i)&&(r[o]=fte(a,e)):l<=e&&(n.expiredLanes|=a),s&=~a}}function R3(n){return n=n.pendingLanes&-1073741825,n!==0?n:n&1073741824?1073741824:0}function Z9(){var n=yb;return yb<<=1,!(yb&4194240)&&(yb=64),n}function xT(n){for(var e=[],t=0;31>t;t++)e.push(n);return e}function D1(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Ba(e),n[e]=t}function pte(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var i=n.eventTimes;for(n=n.expirationTimes;0<t;){var r=31-Ba(t),s=1<<r;e[r]=0,i[r]=-1,n[r]=-1,t&=~s}}function aD(n,e){var t=n.entangledLanes|=e;for(n=n.entanglements;t;){var i=31-Ba(t),r=1<<i;r&e|n[i]&e&&(n[i]|=e),t&=~r}}var gn=0;function J9(n){return n&=-n,1<n?4<n?n&268435455?16:536870912:4:1}var e$,lD,t$,n$,i$,N3=!1,wb=[],Ch=null,Ih=null,Rh=null,dw=new Map,pw=new Map,nh=[],mte="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 w4(n,e){switch(n){case"focusin":case"focusout":Ch=null;break;case"dragenter":case"dragleave":Ih=null;break;case"mouseover":case"mouseout":Rh=null;break;case"pointerover":case"pointerout":dw.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":pw.delete(e.pointerId)}}function Ny(n,e,t,i,r,s){return n===null||n.nativeEvent!==s?(n={blockedOn:e,domEventName:t,eventSystemFlags:i,nativeEvent:s,targetContainers:[r]},e!==null&&(e=L1(e),e!==null&&lD(e)),n):(n.eventSystemFlags|=i,e=n.targetContainers,r!==null&&e.indexOf(r)===-1&&e.push(r),n)}function gte(n,e,t,i,r){switch(e){case"focusin":return Ch=Ny(Ch,n,e,t,i,r),!0;case"dragenter":return Ih=Ny(Ih,n,e,t,i,r),!0;case"mouseover":return Rh=Ny(Rh,n,e,t,i,r),!0;case"pointerover":var s=r.pointerId;return dw.set(s,Ny(dw.get(s)||null,n,e,t,i,r)),!0;case"gotpointercapture":return s=r.pointerId,pw.set(s,Ny(pw.get(s)||null,n,e,t,i,r)),!0}return!1}function r$(n){var e=ad(n.target);if(e!==null){var t=xp(e);if(t!==null){if(e=t.tag,e===13){if(e=W9(t),e!==null){n.blockedOn=e,i$(n.priority,function(){t$(t)});return}}else if(e===3&&t.stateNode.current.memoizedState.isDehydrated){n.blockedOn=t.tag===3?t.stateNode.containerInfo:null;return}}}n.blockedOn=null}function dE(n){if(n.blockedOn!==null)return!1;for(var e=n.targetContainers;0<e.length;){var t=D3(n.domEventName,n.eventSystemFlags,e[0],n.nativeEvent);if(t===null){t=n.nativeEvent;var i=new t.constructor(t.type,t);T3=i,t.target.dispatchEvent(i),T3=null}else return e=L1(t),e!==null&&lD(e),n.blockedOn=t,!1;e.shift()}return!0}function x4(n,e,t){dE(n)&&t.delete(e)}function yte(){N3=!1,Ch!==null&&dE(Ch)&&(Ch=null),Ih!==null&&dE(Ih)&&(Ih=null),Rh!==null&&dE(Rh)&&(Rh=null),dw.forEach(x4),pw.forEach(x4)}function Dy(n,e){n.blockedOn===e&&(n.blockedOn=null,N3||(N3=!0,yo.unstable_scheduleCallback(yo.unstable_NormalPriority,yte)))}function mw(n){function e(r){return Dy(r,n)}if(0<wb.length){Dy(wb[0],n);for(var t=1;t<wb.length;t++){var i=wb[t];i.blockedOn===n&&(i.blockedOn=null)}}for(Ch!==null&&Dy(Ch,n),Ih!==null&&Dy(Ih,n),Rh!==null&&Dy(Rh,n),dw.forEach(e),pw.forEach(e),t=0;t<nh.length;t++)i=nh[t],i.blockedOn===n&&(i.blockedOn=null);for(;0<nh.length&&(t=nh[0],t.blockedOn===null);)r$(t),t.blockedOn===null&&nh.shift()}var vg=cu.ReactCurrentBatchConfig,rS=!0;function vte(n,e,t,i){var r=gn,s=vg.transition;vg.transition=null;try{gn=1,cD(n,e,t,i)}finally{gn=r,vg.transition=s}}function wte(n,e,t,i){var r=gn,s=vg.transition;vg.transition=null;try{gn=4,cD(n,e,t,i)}finally{gn=r,vg.transition=s}}function cD(n,e,t,i){if(rS){var r=D3(n,e,t,i);if(r===null)IT(n,e,i,sS,t),w4(n,i);else if(gte(r,n,e,t,i))i.stopPropagation();else if(w4(n,i),e&4&&-1<mte.indexOf(n)){for(;r!==null;){var s=L1(r);if(s!==null&&e$(s),s=D3(n,e,t,i),s===null&&IT(n,e,i,sS,t),s===r)break;r=s}r!==null&&i.stopPropagation()}else IT(n,e,i,null,t)}}var sS=null;function D3(n,e,t,i){if(sS=null,n=sD(i),n=ad(n),n!==null)if(e=xp(n),e===null)n=null;else if(t=e.tag,t===13){if(n=W9(e),n!==null)return n;n=null}else if(t===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;n=null}else e!==n&&(n=null);return sS=n,null}
vendor: 10,457 bytes, line 37
37function s$(n){switch(n){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(ote()){case oD:return 1;case Y9:return 4;case nS:case ate:return 16;case Q9:return 536870912;default:return 16}default:return 16}}var Ah=null,uD=null,pE=null;function o$(){if(pE)return pE;var n,e=uD,t=e.length,i,r="value"in Ah?Ah.value:Ah.textContent,s=r.length;for(n=0;n<t&&e[n]===r[n];n++);var o=t-n;for(i=1;i<=o&&e[t-i]===r[s-i];i++);return pE=r.slice(n,1<i?1-i:void 0)}function mE(n){var e=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&e===13&&(n=13)):n=e,n===10&&(n=13),32<=n||n===13?n:0}function xb(){return!0}function b4(){return!1}function bo(n){function e(t,i,r,s,o){this._reactName=t,this._targetInst=r,this.type=i,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in n)n.hasOwnProperty(a)&&(t=n[a],this[a]=t?t(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?xb:b4,this.isPropagationStopped=b4,this}return Xn(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():typeof t.returnValue!="unknown"&&(t.returnValue=!1),this.isDefaultPrevented=xb)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():typeof t.cancelBubble!="unknown"&&(t.cancelBubble=!0),this.isPropagationStopped=xb)},persist:function(){},isPersistent:xb}),e}var W0={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hD=bo(W0),O1=Xn({},W0,{view:0,detail:0}),xte=bo(O1),bT,_T,Oy,PA=Xn({},O1,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fD,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==Oy&&(Oy&&n.type==="mousemove"?(bT=n.screenX-Oy.screenX,_T=n.screenY-Oy.screenY):_T=bT=0,Oy=n),bT)},movementY:function(n){return"movementY"in n?n.movementY:_T}}),_4=bo(PA),bte=Xn({},PA,{dataTransfer:0}),_te=bo(bte),Ete=Xn({},O1,{relatedTarget:0}),ET=bo(Ete),Ste=Xn({},W0,{animationName:0,elapsedTime:0,pseudoElement:0}),Ate=bo(Ste),Mte=Xn({},W0,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),Tte=bo(Mte),Pte=Xn({},W0,{data:0}),E4=bo(Pte),Cte={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ite={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"},Rte={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Nte(n){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(n):(n=Rte[n])?!!e[n]:!1}function fD(){return Nte}var Dte=Xn({},O1,{key:function(n){if(n.key){var e=Cte[n.key]||n.key;if(e!=="Unidentified")return e}return n.type==="keypress"?(n=mE(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?Ite[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fD,charCode:function(n){return n.type==="keypress"?mE(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?mE(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),Ote=bo(Dte),Lte=Xn({},PA,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),S4=bo(Lte),Ute=Xn({},O1,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fD}),Bte=bo(Ute),kte=Xn({},W0,{propertyName:0,elapsedTime:0,pseudoElement:0}),Fte=bo(kte),zte=Xn({},PA,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),Vte=bo(zte),Hte=[9,13,27,32],dD=Yc&&"CompositionEvent"in window,Fv=null;Yc&&"documentMode"in document&&(Fv=document.documentMode);var $te=Yc&&"TextEvent"in window&&!Fv,a$=Yc&&(!dD||Fv&&8<Fv&&11>=Fv),A4=" ",M4=!1;function l$(n,e){switch(n){case"keyup":return Hte.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function c$(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Fm=!1;function Gte(n,e){switch(n){case"compositionend":return c$(e);case"keypress":return e.which!==32?null:(M4=!0,A4);case"textInput":return n=e.data,n===A4&&M4?null:n;default:return null}}function jte(n,e){if(Fm)return n==="compositionend"||!dD&&l$(n,e)?(n=o$(),pE=uD=Ah=null,Fm=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return a$&&e.locale!=="ko"?null:e.data;default:return null}}var Wte={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 T4(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e==="input"?!!Wte[n.type]:e==="textarea"}function u$(n,e,t,i){V9(i),e=oS(e,"onChange"),0<e.length&&(t=new hD("onChange","change",null,t,i),n.push({event:t,listeners:e}))}var zv=null,gw=null;function qte(n){b$(n,0)}function CA(n){var e=Hm(n);if(O9(e))return n}function Kte(n,e){if(n==="change")return e}var h$=!1;if(Yc){var ST;if(Yc){var AT="oninput"in document;if(!AT){var P4=document.createElement("div");P4.setAttribute("oninput","return;"),AT=typeof P4.oninput=="function"}ST=AT}else ST=!1;h$=ST&&(!document.documentMode||9<document.documentMode)}function C4(){zv&&(zv.detachEvent("onpropertychange",f$),gw=zv=null)}function f$(n){if(n.propertyName==="value"&&CA(gw)){var e=[];u$(e,gw,n,sD(n)),j9(qte,e)}}function Xte(n,e,t){n==="focusin"?(C4(),zv=e,gw=t,zv.attachEvent("onpropertychange",f$)):n==="focusout"&&C4()}function Yte(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return CA(gw)}function Qte(n,e){if(n==="click")return CA(e)}function Zte(n,e){if(n==="input"||n==="change")return CA(e)}function Jte(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var za=typeof Object.is=="function"?Object.is:Jte;function yw(n,e){if(za(n,e))return!0;if(typeof n!="object"||n===null||typeof e!="object"||e===null)return!1;var t=Object.keys(n),i=Object.keys(e);if(t.length!==i.length)return!1;for(i=0;i<t.length;i++){var r=t[i];if(!m3.call(e,r)||!za(n[r],e[r]))return!1}return!0}function I4(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function R4(n,e){var t=I4(n);n=0;for(var i;t;){if(t.nodeType===3){if(i=n+t.textContent.length,n<=e&&i>=e)return{node:t,offset:e-n};n=i}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=I4(t)}}function d$(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?d$(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function p$(){for(var n=window,e=JE();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=JE(n.document)}return e}function pD(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function ene(n){var e=p$(),t=n.focusedElem,i=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&d$(t.ownerDocument.documentElement,t)){if(i!==null&&pD(t)){if(e=i.start,n=i.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var r=t.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!n.extend&&s>i&&(r=i,i=s,s=r),r=R4(t,s);var o=R4(t,i);r&&o&&(n.rangeCount!==1||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),n.removeAllRanges(),s>i?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t<e.length;t++)n=e[t],n.element.scrollLeft=n.left,n.element.scrollTop=n.top}}var tne=Yc&&"documentMode"in document&&11>=document.documentMode,zm=null,O3=null,Vv=null,L3=!1;function N4(n,e,t){var i=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;L3||zm==null||zm!==JE(i)||(i=zm,"selectionStart"in i&&pD(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focu
vendor: 4,510 bytes, line 37
37sNode:i.focusNode,focusOffset:i.focusOffset}),Vv&&yw(Vv,i)||(Vv=i,i=oS(O3,"onSelect"),0<i.length&&(e=new hD("onSelect","select",null,e,t),n.push({event:e,listeners:i}),e.target=zm)))}function bb(n,e){var t={};return t[n.toLowerCase()]=e.toLowerCase(),t["Webkit"+n]="webkit"+e,t["Moz"+n]="moz"+e,t}var Vm={animationend:bb("Animation","AnimationEnd"),animationiteration:bb("Animation","AnimationIteration"),animationstart:bb("Animation","AnimationStart"),transitionend:bb("Transition","TransitionEnd")},MT={},m$={};Yc&&(m$=document.createElement("div").style,"AnimationEvent"in window||(delete Vm.animationend.animation,delete Vm.animationiteration.animation,delete Vm.animationstart.animation),"TransitionEvent"in window||delete Vm.transitionend.transition);function IA(n){if(MT[n])return MT[n];if(!Vm[n])return n;var e=Vm[n],t;for(t in e)if(e.hasOwnProperty(t)&&t in m$)return MT[n]=e[t];return n}var g$=IA("animationend"),y$=IA("animationiteration"),v$=IA("animationstart"),w$=IA("transitionend"),x$=new Map,D4="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 Jh(n,e){x$.set(n,e),wp(e,[n])}for(var TT=0;TT<D4.length;TT++){var PT=D4[TT],nne=PT.toLowerCase(),ine=PT[0].toUpperCase()+PT.slice(1);Jh(nne,"on"+ine)}Jh(g$,"onAnimationEnd");Jh(y$,"onAnimationIteration");Jh(v$,"onAnimationStart");Jh("dblclick","onDoubleClick");Jh("focusin","onFocus");Jh("focusout","onBlur");Jh(w$,"onTransitionEnd");v0("onMouseEnter",["mouseout","mouseover"]);v0("onMouseLeave",["mouseout","mouseover"]);v0("onPointerEnter",["pointerout","pointerover"]);v0("onPointerLeave",["pointerout","pointerover"]);wp("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));wp("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));wp("onBeforeInput",["compositionend","keypress","textInput","paste"]);wp("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));wp("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));wp("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var _v="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(" "),rne=new Set("cancel close invalid load scroll toggle".split(" ").concat(_v));function O4(n,e,t){var i=n.type||"unknown-event";n.currentTarget=t,nte(i,e,void 0,n),n.currentTarget=null}function b$(n,e){e=(e&4)!==0;for(var t=0;t<n.length;t++){var i=n[t],r=i.event;i=i.listeners;e:{var s=void 0;if(e)for(var o=i.length-1;0<=o;o--){var a=i[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&r.isPropagationStopped())break e;O4(r,a,c),s=l}else for(o=0;o<i.length;o++){if(a=i[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&r.isPropagationStopped())break e;O4(r,a,c),s=l}}}if(tS)throw n=I3,tS=!1,I3=null,n}function Rn(n,e){var t=e[z3];t===void 0&&(t=e[z3]=new Set);var i=n+"__bubble";t.has(i)||(_$(e,n,2,!1),t.add(i))}function CT(n,e,t){var i=0;e&&(i|=4),_$(t,n,i,e)}var _b="_reactListening"+Math.random().toString(36).slice(2);function vw(n){if(!n[_b]){n[_b]=!0,C9.forEach(function(t){t!=="selectionchange"&&(rne.has(t)||CT(t,!1,n),CT(t,!0,n))});var e=n.nodeType===9?n:n.ownerDocument;e===null||e[_b]||(e[_b]=!0,CT("selectionchange",!1,e))}}function _$(n,e,t,i){switch(s$(e)){case 1:var r=vte;break;case 4:r=wte;break;default:r=cD}t=r.bind(null,e,t,n),r=void 0,!C3||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(r=!0),i?r!==void 0?n.addEventListener(e,t,{capture:!0,passive:r}):n.addEventListener(e,t,!0):r!==void 0?n.addEventListener(e,t,{passive:r}):n.addEventListener(e,t,!1)}function IT(n,e,t,i,r){var s=i;if(!(e&1)&&!(e&2)&&i!==null)e:for(;;){if(i===null)return;var o=i.tag;if(o===3||o===4){var a=i.stateNode.containerInfo;
vendor: 4,740 bytes, lines 37-38
37if(a===r||a.nodeType===8&&a.parentNode===r)break;if(o===4)for(o=i.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===r||l.nodeType===8&&l.parentNode===r))return;o=o.return}for(;a!==null;){if(o=ad(a),o===null)return;if(l=o.tag,l===5||l===6){i=s=o;continue e}a=a.parentNode}}i=i.return}j9(function(){var c=s,u=sD(t),h=[];e:{var f=x$.get(n);if(f!==void 0){var m=hD,g=n;switch(n){case"keypress":if(mE(t)===0)break e;case"keydown":case"keyup":m=Ote;break;case"focusin":g="focus",m=ET;break;case"focusout":g="blur",m=ET;break;case"beforeblur":case"afterblur":m=ET;break;case"click":if(t.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":m=_4;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=_te;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=Bte;break;case g$:case y$:case v$:m=Ate;break;case w$:m=Fte;break;case"scroll":m=xte;break;case"wheel":m=Vte;break;case"copy":case"cut":case"paste":m=Tte;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=S4}var v=(e&4)!==0,w=!v&&n==="scroll",y=v?f!==null?f+"Capture":null:f;v=[];for(var _=c,x;_!==null;){x=_;var S=x.stateNode;if(x.tag===5&&S!==null&&(x=S,y!==null&&(S=fw(_,y),S!=null&&v.push(ww(_,S,x)))),w)break;_=_.return}0<v.length&&(f=new m(f,g,null,t,u),h.push({event:f,listeners:v}))}}if(!(e&7)){e:{if(f=n==="mouseover"||n==="pointerover",m=n==="mouseout"||n==="pointerout",f&&t!==T3&&(g=t.relatedTarget||t.fromElement)&&(ad(g)||g[Qc]))break e;if((m||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,m?(g=t.relatedTarget||t.toElement,m=c,g=g?ad(g):null,g!==null&&(w=xp(g),g!==w||g.tag!==5&&g.tag!==6)&&(g=null)):(m=null,g=c),m!==g)){if(v=_4,S="onMouseLeave",y="onMouseEnter",_="mouse",(n==="pointerout"||n==="pointerover")&&(v=S4,S="onPointerLeave",y="onPointerEnter",_="pointer"),w=m==null?f:Hm(m),x=g==null?f:Hm(g),f=new v(S,_+"leave",m,t,u),f.target=w,f.relatedTarget=x,S=null,ad(u)===c&&(v=new v(y,_+"enter",g,t,u),v.target=x,v.relatedTarget=w,S=v),w=S,m&&g)t:{for(v=m,y=g,_=0,x=v;x;x=Yp(x))_++;for(x=0,S=y;S;S=Yp(S))x++;for(;0<_-x;)v=Yp(v),_--;for(;0<x-_;)y=Yp(y),x--;for(;_--;){if(v===y||y!==null&&v===y.alternate)break t;v=Yp(v),y=Yp(y)}v=null}else v=null;m!==null&&L4(h,f,m,v,!1),g!==null&&w!==null&&L4(h,w,g,v,!0)}}e:{if(f=c?Hm(c):window,m=f.nodeName&&f.nodeName.toLowerCase(),m==="select"||m==="input"&&f.type==="file")var M=Kte;else if(T4(f))if(h$)M=Zte;else{M=Yte;var A=Xte}else(m=f.nodeName)&&m.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(M=Qte);if(M&&(M=M(n,c))){u$(h,M,t,u);break e}A&&A(n,f,c),n==="focusout"&&(A=f._wrapperState)&&A.controlled&&f.type==="number"&&_3(f,"number",f.value)}switch(A=c?Hm(c):window,n){case"focusin":(T4(A)||A.contentEditable==="true")&&(zm=A,O3=c,Vv=null);break;case"focusout":Vv=O3=zm=null;break;case"mousedown":L3=!0;break;case"contextmenu":case"mouseup":case"dragend":L3=!1,N4(h,t,u);break;case"selectionchange":if(tne)break;case"keydown":case"keyup":N4(h,t,u)}var I;if(dD)e:{switch(n){case"compositionstart":var D="onCompositionStart";break e;case"compositionend":D="onCompositionEnd";break e;case"compositionupdate":D="onCompositionUpdate";break e}D=void 0}else Fm?l$(n,t)&&(D="onCompositionEnd"):n==="keydown"&&t.keyCode===229&&(D="onCompositionStart");D&&(a$&&t.locale!=="ko"&&(Fm||D!=="onCompositionStart"?D==="onCompositionEnd"&&Fm&&(I=o$()):(Ah=u,uD="value"in Ah?Ah.value:Ah.textContent,Fm=!0)),A=oS(c,D),0<A.length&&(D=new E4(D,n,null,t,u),h.push({event:D,listeners:A}),I?D.data=I:(I=c$(t),I!==null&&(D.data=I)))),(I=$te?Gte(n,t):jte(n,t))&&(c=oS(c,"onBeforeInput"),0<c.length&&(u=new E4("onBeforeInput","beforeinput",null,t,u),h.push({event:u,listeners:c}),u.data=I))}b$(h,e)})}function ww(n,e,t){return{instance:n,listener:e,currentTarget:t}}function oS(n,e){for(var t=e+"Capture",i=[];n!==null;){var r=n,s=r.stateNode;r.tag===5&&s!==null&&(r=s,s=fw(n,t),s!=null&&i.unshift(ww(n,s,r)),s=fw(n,e),s!=null&&i.push(ww(n,s,r))),n=n.return}return i}function Yp(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5);return n||null}function L4(n,e,t,i,r){for(var s=e._reactName,o=[];t!==null&&t!==i;){var a=t,l=a.alternate,c=a.stateNode;if(l!==null&&l===i)break;a.tag===5&&c!==null&&(a=c,r?(l=fw(t,s),l!=null&&o.unshift(ww(t,l,a))):r||(l=fw(t,s),l!=null&&o.push(ww(t,l,a)))),t=t.return}o.length!==0&&n.push({event:e,listeners:o})}var sne=/\r\n?/g,one=/\u0000|\uFFFD/g;function U4(n){return(typeof n=="string"?n:""+n).replace(sne,`
38`).replace(one,"")}
vendor: 3,742 bytes, line 38
38function Eb(n,e,t){if(e=U4(e),U4(n)!==e&&t)throw Error(De(425))}function aS(){}var U3=null,B3=null;function k3(n,e){return n==="textarea"||n==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var F3=typeof setTimeout=="function"?setTimeout:void 0,ane=typeof clearTimeout=="function"?clearTimeout:void 0,B4=typeof Promise=="function"?Promise:void 0,lne=typeof queueMicrotask=="function"?queueMicrotask:typeof B4<"u"?function(n){return B4.resolve(null).then(n).catch(cne)}:F3;function cne(n){setTimeout(function(){throw n})}function RT(n,e){var t=e,i=0;do{var r=t.nextSibling;if(n.removeChild(t),r&&r.nodeType===8)if(t=r.data,t==="/$"){if(i===0){n.removeChild(r),mw(e);return}i--}else t!=="$"&&t!=="$?"&&t!=="$!"||i++;t=r}while(t);mw(e)}function Nh(n){for(;n!=null;n=n.nextSibling){var e=n.nodeType;if(e===1||e===3)break;if(e===8){if(e=n.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return n}function k4(n){n=n.previousSibling;for(var e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="$"||t==="$!"||t==="$?"){if(e===0)return n;e--}else t==="/$"&&e++}n=n.previousSibling}return null}var q0=Math.random().toString(36).slice(2),Al="__reactFiber$"+q0,xw="__reactProps$"+q0,Qc="__reactContainer$"+q0,z3="__reactEvents$"+q0,une="__reactListeners$"+q0,hne="__reactHandles$"+q0;function ad(n){var e=n[Al];if(e)return e;for(var t=n.parentNode;t;){if(e=t[Qc]||t[Al]){if(t=e.alternate,e.child!==null||t!==null&&t.child!==null)for(n=k4(n);n!==null;){if(t=n[Al])return t;n=k4(n)}return e}n=t,t=n.parentNode}return null}function L1(n){return n=n[Al]||n[Qc],!n||n.tag!==5&&n.tag!==6&&n.tag!==13&&n.tag!==3?null:n}function Hm(n){if(n.tag===5||n.tag===6)return n.stateNode;throw Error(De(33))}function RA(n){return n[xw]||null}var V3=[],$m=-1;function ef(n){return{current:n}}function Ln(n){0>$m||(n.current=V3[$m],V3[$m]=null,$m--)}function Pn(n,e){$m++,V3[$m]=n.current,n.current=e}var Hh={},Gr=ef(Hh),Ds=ef(!1),ep=Hh;function w0(n,e){var t=n.type.contextTypes;if(!t)return Hh;var i=n.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in t)r[s]=e[s];return i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=r),r}function Os(n){return n=n.childContextTypes,n!=null}function lS(){Ln(Ds),Ln(Gr)}function F4(n,e,t){if(Gr.current!==Hh)throw Error(De(168));Pn(Gr,e),Pn(Ds,t)}function E$(n,e,t){var i=n.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return t;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(De(108,Xee(n)||"Unknown",r));return Xn({},t,i)}function cS(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||Hh,ep=Gr.current,Pn(Gr,n),Pn(Ds,Ds.current),!0}function z4(n,e,t){var i=n.stateNode;if(!i)throw Error(De(169));t?(n=E$(n,e,ep),i.__reactInternalMemoizedMergedChildContext=n,Ln(Ds),Ln(Gr),Pn(Gr,n)):Ln(Ds),Pn(Ds,t)}var gc=null,NA=!1,NT=!1;function S$(n){gc===null?gc=[n]:gc.push(n)}function fne(n){NA=!0,S$(n)}function tf(){if(!NT&&gc!==null){NT=!0;var n=0,e=gn;try{var t=gc;for(gn=1;n<t.length;n++){var i=t[n];do i=i(!0);while(i!==null)}gc=null,NA=!1}catch(r){throw gc!==null&&(gc=gc.slice(n+1)),X9(oD,tf),r}finally{gn=e,NT=!1}}return null}var Gm=[],jm=0,uS=null,hS=0,ea=[],ta=0,tp=null,Lc=1,Uc="";function Hf(n,e){Gm[jm++]=hS,Gm[jm++]=uS,uS=n,hS=e}function A$(n,e,t){ea[ta++]=Lc,ea[ta++]=Uc,ea[ta++]=tp,tp=n;var i=Lc;n=Uc;var r=32-Ba(i)-1;i&=~(1<<r),t+=1;var s=32-Ba(e)+r;if(30<s){var o=r-r%5;s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,Lc=1<<32-Ba(e)+r|t<<r|i,Uc=s+n}else Lc=1<<s|t<<r|i,Uc=n}
vendor: 14,267 bytes, line 38
38function mD(n){n.return!==null&&(Hf(n,1),A$(n,1,0))}function gD(n){for(;n===uS;)uS=Gm[--jm],Gm[jm]=null,hS=Gm[--jm],Gm[jm]=null;for(;n===tp;)tp=ea[--ta],ea[ta]=null,Uc=ea[--ta],ea[ta]=null,Lc=ea[--ta],ea[ta]=null}var po=null,ho=null,Fn=!1,Ra=null;function M$(n,e){var t=na(5,null,null,0);t.elementType="DELETED",t.stateNode=e,t.return=n,e=n.deletions,e===null?(n.deletions=[t],n.flags|=16):e.push(t)}function V4(n,e){switch(n.tag){case 5:var t=n.type;return e=e.nodeType!==1||t.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(n.stateNode=e,po=n,ho=Nh(e.firstChild),!0):!1;case 6:return e=n.pendingProps===""||e.nodeType!==3?null:e,e!==null?(n.stateNode=e,po=n,ho=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(t=tp!==null?{id:Lc,overflow:Uc}:null,n.memoizedState={dehydrated:e,treeContext:t,retryLane:1073741824},t=na(18,null,null,0),t.stateNode=e,t.return=n,n.child=t,po=n,ho=null,!0):!1;default:return!1}}function H3(n){return(n.mode&1)!==0&&(n.flags&128)===0}function $3(n){if(Fn){var e=ho;if(e){var t=e;if(!V4(n,e)){if(H3(n))throw Error(De(418));e=Nh(t.nextSibling);var i=po;e&&V4(n,e)?M$(i,t):(n.flags=n.flags&-4097|2,Fn=!1,po=n)}}else{if(H3(n))throw Error(De(418));n.flags=n.flags&-4097|2,Fn=!1,po=n}}}function H4(n){for(n=n.return;n!==null&&n.tag!==5&&n.tag!==3&&n.tag!==13;)n=n.return;po=n}function Sb(n){if(n!==po)return!1;if(!Fn)return H4(n),Fn=!0,!1;var e;if((e=n.tag!==3)&&!(e=n.tag!==5)&&(e=n.type,e=e!=="head"&&e!=="body"&&!k3(n.type,n.memoizedProps)),e&&(e=ho)){if(H3(n))throw T$(),Error(De(418));for(;e;)M$(n,e),e=Nh(e.nextSibling)}if(H4(n),n.tag===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(De(317));e:{for(n=n.nextSibling,e=0;n;){if(n.nodeType===8){var t=n.data;if(t==="/$"){if(e===0){ho=Nh(n.nextSibling);break e}e--}else t!=="$"&&t!=="$!"&&t!=="$?"||e++}n=n.nextSibling}ho=null}}else ho=po?Nh(n.stateNode.nextSibling):null;return!0}function T$(){for(var n=ho;n;)n=Nh(n.nextSibling)}function x0(){ho=po=null,Fn=!1}function yD(n){Ra===null?Ra=[n]:Ra.push(n)}var dne=cu.ReactCurrentBatchConfig;function Ly(n,e,t){if(n=t.ref,n!==null&&typeof n!="function"&&typeof n!="object"){if(t._owner){if(t=t._owner,t){if(t.tag!==1)throw Error(De(309));var i=t.stateNode}if(!i)throw Error(De(147,n));var r=i,s=""+n;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===s?e.ref:(e=function(o){var a=r.refs;o===null?delete a[s]:a[s]=o},e._stringRef=s,e)}if(typeof n!="string")throw Error(De(284));if(!t._owner)throw Error(De(290,n))}return n}function Ab(n,e){throw n=Object.prototype.toString.call(e),Error(De(31,n==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":n))}function $4(n){var e=n._init;return e(n._payload)}function P$(n){function e(y,_){if(n){var x=y.deletions;x===null?(y.deletions=[_],y.flags|=16):x.push(_)}}function t(y,_){if(!n)return null;for(;_!==null;)e(y,_),_=_.sibling;return null}function i(y,_){for(y=new Map;_!==null;)_.key!==null?y.set(_.key,_):y.set(_.index,_),_=_.sibling;return y}function r(y,_){return y=Uh(y,_),y.index=0,y.sibling=null,y}function s(y,_,x){return y.index=x,n?(x=y.alternate,x!==null?(x=x.index,x<_?(y.flags|=2,_):x):(y.flags|=2,_)):(y.flags|=1048576,_)}function o(y){return n&&y.alternate===null&&(y.flags|=2),y}function a(y,_,x,S){return _===null||_.tag!==6?(_=FT(x,y.mode,S),_.return=y,_):(_=r(_,x),_.return=y,_)}function l(y,_,x,S){var M=x.type;return M===km?u(y,_,x.props.children,S,x.key):_!==null&&(_.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===Yu&&$4(M)===_.type)?(S=r(_,x.props),S.ref=Ly(y,_,x),S.return=y,S):(S=_E(x.type,x.key,x.props,null,y.mode,S),S.ref=Ly(y,_,x),S.return=y,S)}function c(y,_,x,S){return _===null||_.tag!==4||_.stateNode.containerInfo!==x.containerInfo||_.stateNode.implementation!==x.implementation?(_=zT(x,y.mode,S),_.return=y,_):(_=r(_,x.children||[]),_.return=y,_)}function u(y,_,x,S,M){return _===null||_.tag!==7?(_=jd(x,y.mode,S,M),_.return=y,_):(_=r(_,x),_.return=y,_)}function h(y,_,x){if(typeof _=="string"&&_!==""||typeof _=="number")return _=FT(""+_,y.mode,x),_.return=y,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case pb:return x=_E(_.type,_.key,_.props,null,y.mode,x),x.ref=Ly(y,null,_),x.return=y,x;case Bm:return _=zT(_,y.mode,x),_.return=y,_;case Yu:var S=_._init;return h(y,S(_._payload),x)}if(xv(_)||Iy(_))return _=jd(_,y.mode,x,null),_.return=y,_;Ab(y,_)}return null}function f(y,_,x,S){var M=_!==null?_.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return M!==null?null:a(y,_,""+x,S);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case pb:return x.key===M?l(y,_,x,S):null;case Bm:return x.key===M?c(y,_,x,S):null;case Yu:return M=x._init,f(y,_,M(x._payload),S)}if(xv(x)||Iy(x))return M!==null?null:u(y,_,x,S,null);Ab(y,x)}return null}function m(y,_,x,S,M){if(typeof S=="string"&&S!==""||typeof S=="number")return y=y.get(x)||null,a(_,y,""+S,M);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case pb:return y=y.get(S.key===null?x:S.key)||null,l(_,y,S,M);case Bm:return y=y.get(S.key===null?x:S.key)||null,c(_,y,S,M);case Yu:var A=S._init;return m(y,_,x,A(S._payload),M)}if(xv(S)||Iy(S))return y=y.get(x)||null,u(_,y,S,M,null);Ab(_,S)}return null}function g(y,_,x,S){for(var M=null,A=null,I=_,D=_=0,k=null;I!==null&&D<x.length;D++){I.index>D?(k=I,I=null):k=I.sibling;var C=f(y,I,x[D],S);if(C===null){I===null&&(I=k);break}n&&I&&C.alternate===null&&e(y,I),_=s(C,_,D),A===null?M=C:A.sibling=C,A=C,I=k}if(D===x.length)return t(y,I),Fn&&Hf(y,D),M;if(I===null){for(;D<x.length;D++)I=h(y,x[D],S),I!==null&&(_=s(I,_,D),A===null?M=I:A.sibling=I,A=I);return Fn&&Hf(y,D),M}for(I=i(y,I);D<x.length;D++)k=m(I,y,D,x[D],S),k!==null&&(n&&k.alternate!==null&&I.delete(k.key===null?D:k.key),_=s(k,_,D),A===null?M=k:A.sibling=k,A=k);return n&&I.forEach(function(U){return e(y,U)}),Fn&&Hf(y,D),M}function v(y,_,x,S){var M=Iy(x);if(typeof M!="function")throw Error(De(150));if(x=M.call(x),x==null)throw Error(De(151));for(var A=M=null,I=_,D=_=0,k=null,C=x.next();I!==null&&!C.done;D++,C=x.next()){I.index>D?(k=I,I=null):k=I.sibling;var U=f(y,I,C.value,S);if(U===null){I===null&&(I=k);break}n&&I&&U.alternate===null&&e(y,I),_=s(U,_,D),A===null?M=U:A.sibling=U,A=U,I=k}if(C.done)return t(y,I),Fn&&Hf(y,D),M;if(I===null){for(;!C.done;D++,C=x.next())C=h(y,C.value,S),C!==null&&(_=s(C,_,D),A===null?M=C:A.sibling=C,A=C);return Fn&&Hf(y,D),M}for(I=i(y,I);!C.done;D++,C=x.next())C=m(I,y,D,C.value,S),C!==null&&(n&&C.alternate!==null&&I.delete(C.key===null?D:C.key),_=s(C,_,D),A===null?M=C:A.sibling=C,A=C);return n&&I.forEach(function(G){return e(y,G)}),Fn&&Hf(y,D),M}function w(y,_,x,S){if(typeof x=="object"&&x!==null&&x.type===km&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case pb:e:{for(var M=x.key,A=_;A!==null;){if(A.key===M){if(M=x.type,M===km){if(A.tag===7){t(y,A.sibling),_=r(A,x.props.children),_.return=y,y=_;break e}}else if(A.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===Yu&&$4(M)===A.type){t(y,A.sibling),_=r(A,x.props),_.ref=Ly(y,A,x),_.return=y,y=_;break e}t(y,A);break}else e(y,A);A=A.sibling}x.type===km?(_=jd(x.props.children,y.mode,S,x.key),_.return=y,y=_):(S=_E(x.type,x.key,x.props,null,y.mode,S),S.ref=Ly(y,_,x),S.return=y,y=S)}return o(y);case Bm:e:{for(A=x.key;_!==null;){if(_.key===A)if(_.tag===4&&_.stateNode.containerInfo===x.containerInfo&&_.stateNode.implementation===x.implementation){t(y,_.sibling),_=r(_,x.children||[]),_.return=y,y=_;break e}else{t(y,_);break}else e(y,_);_=_.sibling}_=zT(x,y.mode,S),_.return=y,y=_}return o(y);case Yu:return A=x._init,w(y,_,A(x._payload),S)}if(xv(x))return g(y,_,x,S);if(Iy(x))return v(y,_,x,S);Ab(y,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,_!==null&&_.tag===6?(t(y,_.sibling),_=r(_,x),_.return=y,y=_):(t(y,_),_=FT(x,y.mode,S),_.return=y,y=_),o(y)):t(y,_)}return w}var b0=P$(!0),C$=P$(!1),fS=ef(null),dS=null,Wm=null,vD=null;function wD(){vD=Wm=dS=null}function xD(n){var e=fS.current;Ln(fS),n._currentValue=e}function G3(n,e,t){for(;n!==null;){var i=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),n===t)break;n=n.return}}function wg(n,e){dS=n,vD=Wm=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(Is=!0),n.firstContext=null)}function oa(n){var e=n._currentValue;if(vD!==n)if(n={context:n,memoizedValue:e,next:null},Wm===null){if(dS===null)throw Error(De(308));Wm=n,dS.dependencies={lanes:0,firstContext:n}}else Wm=Wm.next=n;return e}var ld=null;function bD(n){ld===null?ld=[n]:ld.push(n)}function I$(n,e,t,i){var r=e.interleaved;return r===null?(t.next=t,bD(e)):(t.next=r.next,r.next=t),e.interleaved=t,Zc(n,i)}function Zc(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var Qu=!1;function _D(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function R$(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Vc(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function Dh(n,e,t){var i=n.updateQueue;if(i===null)return null;if(i=i.shared,Jt&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,Zc(n,t)}return r=i.interleaved,r===null?(e.next=e,bD(i)):(e.next=r.next,r.next=e),i.interleaved=e,Zc(n,t)}function gE(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,aD(n,t)}}function G4(n,e){var t=n.updateQueue,i=n.alternate;if(i!==null&&(i=i.updateQueue,t===i)){var r=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?r=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?r=s=e:s=s.next=e}else r=s=e;t={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function pS(n,e,t,i){var r=n.updateQueue;Qu=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=n.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var h=r.baseState;o=0,u=c=l=null,a=s;do{var f=a.lane,m=a.eventTime;if((i&f)===f){u!==null&&(u=u.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=n,v=a;switch(f=e,m=t,v.tag){case 1:if(g=v.payload,typeof g=="function"){h=g.call(m,h,f);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=v.payload,f=typeof g=="function"?g.call(m,h,f):g,f==null)break e;h=Xn({},h,f);break e;case 2:Qu=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,f=r.effects,f===null?r.effects=[a]:f.push(a))}else m={eventTime:m,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=m,l=h):u=u.next=m,o|=f;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;f=a,a=f.next,f.next=null,r.lastBaseUpdate=f,r.shared.pending=null}}while(!0);if(u===null&&(l=h),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=u,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);ip|=o,n.lanes=o,n.memoizedState=h}}function j4(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;e<n.length;e++){var i=n[e],r=i.callback;if(r!==null){if(i.callback=null,i=t,typeof r!="function")throw Error(De(191,r));r.call(i)}}}var U1={},Dl=ef(U1),bw=ef(U1),_w=ef(U1);function cd(n){if(n===U1)throw Error(De(174));return n}function ED(n,e){switch(Pn(_w,e),Pn(bw,n),Pn(Dl,U1),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:S3(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=S3(e,n)}Ln(Dl),Pn(Dl,e)}function _0(){Ln(Dl),Ln(bw),Ln(_w)}function N$(n){cd(_w.current);var e=cd(Dl.current),t=S3(e,n.type);e!==t&&(Pn(bw,n),Pn(Dl,t))}function SD(n){bw.current===n&&(Ln(Dl),Ln(bw))}var Gn=ef(0);function mS(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var DT=[];function AD(){for(var n=0;n<DT.length;n++)DT[n]._workInProgressVersionPrimary=null;DT.length=0}var yE=cu.ReactCurrentDispatcher,OT=cu.ReactCurrentBatchConfig,np=0,Kn=null,Pi=null,ji=null,gS=!1,Hv=!1,Ew=0,pne=0;function _r(){throw Error(De(321))}function MD(n,e){if(e===null)return!1;for(var t=0;t<e.length&&t<n.length;t++)if(!za(n[t],e[t]))return!1;return!0}function TD(n,e,t,i,r,s){if(np=s,Kn=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,yE.current=n===null||n.memoizedState===null?vne:wne,n=t(i,r),Hv){s=0;do{if(Hv=!1,Ew=0,25<=s)throw Error(De(301));s+=1,ji=Pi=null,e.updateQueue=null,yE.current=xne,n=t(i,r)}while(Hv)}if(yE.current=yS,e=Pi!==null&&Pi.next!==null,np=0,ji=Pi=Kn=null,gS=!1,e)throw Error(De(300));return n}function PD(){var n=Ew!==0;return Ew=0,n}function ul(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ji===null?Kn.memoizedState=ji=n:ji=ji.next=n,ji}function aa(){if(Pi===null){var n=Kn.alternate;n=n!==null?n.memoizedState:null}else n=Pi.next;var e=ji===null?Kn.memoizedState:ji.next;if(e!==null)ji=e,Pi=n;else{if(n===null)throw Error(De(310));Pi=n,n={memoizedState:Pi.memoizedState,baseState:Pi.baseState,baseQueue:Pi.baseQueue,queue:Pi.queue,next:null},ji===null?Kn.memoizedState=ji=n:ji=ji.next=n}return ji}function Sw(n,e){return typeof e=="function"?e(n):e}function LT(n){var e=aa(),t=e.queue;if(t===null)throw Error(De(311));t.lastRenderedReducer=n;var i=Pi,r=i.baseQueue,s=t.pending;if(s!==null){if(r!==null){var o=r.next;
vendor: 4,159 bytes, line 38
38r.next=s.next,s.next=o}i.baseQueue=r=s,t.pending=null}if(r!==null){s=r.next,i=i.baseState;var a=o=null,l=null,c=s;do{var u=c.lane;if((np&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),i=c.hasEagerState?c.eagerState:n(i,c.action);else{var h={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=h,o=i):l=l.next=h,Kn.lanes|=u,ip|=u}c=c.next}while(c!==null&&c!==s);l===null?o=i:l.next=a,za(i,e.memoizedState)||(Is=!0),e.memoizedState=i,e.baseState=o,e.baseQueue=l,t.lastRenderedState=i}if(n=t.interleaved,n!==null){r=n;do s=r.lane,Kn.lanes|=s,ip|=s,r=r.next;while(r!==n)}else r===null&&(t.lanes=0);return[e.memoizedState,t.dispatch]}function UT(n){var e=aa(),t=e.queue;if(t===null)throw Error(De(311));t.lastRenderedReducer=n;var i=t.dispatch,r=t.pending,s=e.memoizedState;if(r!==null){t.pending=null;var o=r=r.next;do s=n(s,o.action),o=o.next;while(o!==r);za(s,e.memoizedState)||(Is=!0),e.memoizedState=s,e.baseQueue===null&&(e.baseState=s),t.lastRenderedState=s}return[s,i]}function D$(){}function O$(n,e){var t=Kn,i=aa(),r=e(),s=!za(i.memoizedState,r);if(s&&(i.memoizedState=r,Is=!0),i=i.queue,CD(B$.bind(null,t,i,n),[n]),i.getSnapshot!==e||s||ji!==null&&ji.memoizedState.tag&1){if(t.flags|=2048,Aw(9,U$.bind(null,t,i,r,e),void 0,null),Qi===null)throw Error(De(349));np&30||L$(t,e,r)}return r}function L$(n,e,t){n.flags|=16384,n={getSnapshot:e,value:t},e=Kn.updateQueue,e===null?(e={lastEffect:null,stores:null},Kn.updateQueue=e,e.stores=[n]):(t=e.stores,t===null?e.stores=[n]:t.push(n))}function U$(n,e,t,i){e.value=t,e.getSnapshot=i,k$(e)&&F$(n)}function B$(n,e,t){return t(function(){k$(e)&&F$(n)})}function k$(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!za(n,t)}catch{return!0}}function F$(n){var e=Zc(n,1);e!==null&&ka(e,n,1,-1)}function W4(n){var e=ul();return typeof n=="function"&&(n=n()),e.memoizedState=e.baseState=n,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Sw,lastRenderedState:n},e.queue=n,n=n.dispatch=yne.bind(null,Kn,n),[e.memoizedState,n]}function Aw(n,e,t,i){return n={tag:n,create:e,destroy:t,deps:i,next:null},e=Kn.updateQueue,e===null?(e={lastEffect:null,stores:null},Kn.updateQueue=e,e.lastEffect=n.next=n):(t=e.lastEffect,t===null?e.lastEffect=n.next=n:(i=t.next,t.next=n,n.next=i,e.lastEffect=n)),n}function z$(){return aa().memoizedState}function vE(n,e,t,i){var r=ul();Kn.flags|=n,r.memoizedState=Aw(1|e,t,void 0,i===void 0?null:i)}function DA(n,e,t,i){var r=aa();i=i===void 0?null:i;var s=void 0;if(Pi!==null){var o=Pi.memoizedState;if(s=o.destroy,i!==null&&MD(i,o.deps)){r.memoizedState=Aw(e,t,s,i);return}}Kn.flags|=n,r.memoizedState=Aw(1|e,t,s,i)}function q4(n,e){return vE(8390656,8,n,e)}function CD(n,e){return DA(2048,8,n,e)}function V$(n,e){return DA(4,2,n,e)}function H$(n,e){return DA(4,4,n,e)}function $$(n,e){if(typeof e=="function")return n=n(),e(n),function(){e(null)};if(e!=null)return n=n(),e.current=n,function(){e.current=null}}function G$(n,e,t){return t=t!=null?t.concat([n]):null,DA(4,4,$$.bind(null,e,n),t)}function ID(){}function j$(n,e){var t=aa();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&MD(e,i[1])?i[0]:(t.memoizedState=[n,e],n)}function W$(n,e){var t=aa();e=e===void 0?null:e;var i=t.memoizedState;return i!==null&&e!==null&&MD(e,i[1])?i[0]:(n=n(),t.memoizedState=[n,e],n)}function q$(n,e,t){return np&21?(za(t,e)||(t=Z9(),Kn.lanes|=t,ip|=t,n.baseState=!0),e):(n.baseState&&(n.baseState=!1,Is=!0),n.memoizedState=t)}function mne(n,e){var t=gn;gn=t!==0&&4>t?t:4,n(!0);var i=OT.transition;OT.transition={};try{n(!1),e()}finally{gn=t,OT.transition=i}}function K$(){return aa().memoizedState}function gne(n,e,t){var i=Lh(n);if(t={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null},X$(n))Y$(e,t);else if(t=I$(n,e,t,i),t!==null){var r=ss();ka(t,n,i,r),Q$(t,e,i)}}function yne(n,e,t){var i=Lh(n),r={lane:i,action:t,hasEagerState:!1,eagerState:null,next:null};if(X$(n))Y$(e,r);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);
vendor: 7,226 bytes, lines 38-40
38if(r.hasEagerState=!0,r.eagerState=a,za(a,o)){var l=e.interleaved;l===null?(r.next=r,bD(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}t=I$(n,e,r,i),t!==null&&(r=ss(),ka(t,n,i,r),Q$(t,e,i))}}function X$(n){var e=n.alternate;return n===Kn||e!==null&&e===Kn}function Y$(n,e){Hv=gS=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function Q$(n,e,t){if(t&4194240){var i=e.lanes;i&=n.pendingLanes,t|=i,e.lanes=t,aD(n,t)}}var yS={readContext:oa,useCallback:_r,useContext:_r,useEffect:_r,useImperativeHandle:_r,useInsertionEffect:_r,useLayoutEffect:_r,useMemo:_r,useReducer:_r,useRef:_r,useState:_r,useDebugValue:_r,useDeferredValue:_r,useTransition:_r,useMutableSource:_r,useSyncExternalStore:_r,useId:_r,unstable_isNewReconciler:!1},vne={readContext:oa,useCallback:function(n,e){return ul().memoizedState=[n,e===void 0?null:e],n},useContext:oa,useEffect:q4,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,vE(4194308,4,$$.bind(null,e,n),t)},useLayoutEffect:function(n,e){return vE(4194308,4,n,e)},useInsertionEffect:function(n,e){return vE(4,2,n,e)},useMemo:function(n,e){var t=ul();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var i=ul();return e=t!==void 0?t(e):e,i.memoizedState=i.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},i.queue=n,n=n.dispatch=gne.bind(null,Kn,n),[i.memoizedState,n]},useRef:function(n){var e=ul();return n={current:n},e.memoizedState=n},useState:W4,useDebugValue:ID,useDeferredValue:function(n){return ul().memoizedState=n},useTransition:function(){var n=W4(!1),e=n[0];return n=mne.bind(null,n[1]),ul().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var i=Kn,r=ul();if(Fn){if(t===void 0)throw Error(De(407));t=t()}else{if(t=e(),Qi===null)throw Error(De(349));np&30||L$(i,e,t)}r.memoizedState=t;var s={value:t,getSnapshot:e};return r.queue=s,q4(B$.bind(null,i,s,n),[n]),i.flags|=2048,Aw(9,U$.bind(null,i,s,t,e),void 0,null),t},useId:function(){var n=ul(),e=Qi.identifierPrefix;if(Fn){var t=Uc,i=Lc;t=(i&~(1<<32-Ba(i)-1)).toString(32)+t,e=":"+e+"R"+t,t=Ew++,0<t&&(e+="H"+t.toString(32)),e+=":"}else t=pne++,e=":"+e+"r"+t.toString(32)+":";return n.memoizedState=e},unstable_isNewReconciler:!1},wne={readContext:oa,useCallback:j$,useContext:oa,useEffect:CD,useImperativeHandle:G$,useInsertionEffect:V$,useLayoutEffect:H$,useMemo:W$,useReducer:LT,useRef:z$,useState:function(){return LT(Sw)},useDebugValue:ID,useDeferredValue:function(n){var e=aa();return q$(e,Pi.memoizedState,n)},useTransition:function(){var n=LT(Sw)[0],e=aa().memoizedState;return[n,e]},useMutableSource:D$,useSyncExternalStore:O$,useId:K$,unstable_isNewReconciler:!1},xne={readContext:oa,useCallback:j$,useContext:oa,useEffect:CD,useImperativeHandle:G$,useInsertionEffect:V$,useLayoutEffect:H$,useMemo:W$,useReducer:UT,useRef:z$,useState:function(){return UT(Sw)},useDebugValue:ID,useDeferredValue:function(n){var e=aa();return Pi===null?e.memoizedState=n:q$(e,Pi.memoizedState,n)},useTransition:function(){var n=UT(Sw)[0],e=aa().memoizedState;return[n,e]},useMutableSource:D$,useSyncExternalStore:O$,useId:K$,unstable_isNewReconciler:!1};function _a(n,e){if(n&&n.defaultProps){e=Xn({},e),n=n.defaultProps;for(var t in n)e[t]===void 0&&(e[t]=n[t]);return e}return e}function j3(n,e,t,i){e=n.memoizedState,t=t(i,e),t=t==null?e:Xn({},e,t),n.memoizedState=t,n.lanes===0&&(n.updateQueue.baseState=t)}var OA={isMounted:function(n){return(n=n._reactInternals)?xp(n)===n:!1},enqueueSetState:function(n,e,t){n=n._reactInternals;var i=ss(),r=Lh(n),s=Vc(i,r);s.payload=e,t!=null&&(s.callback=t),e=Dh(n,s,r),e!==null&&(ka(e,n,r,i),gE(e,n,r))},enqueueReplaceState:function(n,e,t){n=n._reactInternals;var i=ss(),r=Lh(n),s=Vc(i,r);s.tag=1,s.payload=e,t!=null&&(s.callback=t),e=Dh(n,s,r),e!==null&&(ka(e,n,r,i),gE(e,n,r))},enqueueForceUpdate:function(n,e){n=n._reactInternals;var t=ss(),i=Lh(n),r=Vc(t,i);r.tag=2,e!=null&&(r.callback=e),e=Dh(n,r,i),e!==null&&(ka(e,n,i,t),gE(e,n,i))}};function K4(n,e,t,i,r,s,o){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(i,s,o):e.prototype&&e.prototype.isPureReactComponent?!yw(t,i)||!yw(r,s):!0}function Z$(n,e,t){var i=!1,r=Hh,s=e.contextType;return typeof s=="object"&&s!==null?s=oa(s):(r=Os(e)?ep:Gr.current,i=e.contextTypes,s=(i=i!=null)?w0(n,r):Hh),e=new e(t,s),n.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=OA,n.stateNode=e,e._reactInternals=n,i&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=r,n.__reactInternalMemoizedMaskedChildContext=s),e}function X4(n,e,t,i){n=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(t,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(t,i),e.state!==n&&OA.enqueueReplaceState(e,e.state,null)}function W3(n,e,t,i){var r=n.stateNode;r.props=t,r.state=n.memoizedState,r.refs={},_D(n);var s=e.contextType;typeof s=="object"&&s!==null?r.context=oa(s):(s=Os(e)?ep:Gr.current,r.context=w0(n,s)),r.state=n.memoizedState,s=e.getDerivedStateFromProps,typeof s=="function"&&(j3(n,e,s,t),r.state=n.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof r.getSnapshotBeforeUpdate=="function"||typeof r.UNSAFE_componentWillMount!="function"&&typeof r.componentWillMount!="function"||(e=r.state,typeof r.componentWillMount=="function"&&r.componentWillMount(),typeof r.UNSAFE_componentWillMount=="function"&&r.UNSAFE_componentWillMount(),e!==r.state&&OA.enqueueReplaceState(r,r.state,null),pS(n,t,r,i),r.state=n.memoizedState),typeof r.componentDidMount=="function"&&(n.flags|=4194308)}function E0(n,e){try{var t="",i=e;do t+=Kee(i),i=i.return;while(i);var r=t}catch(s){r=`
39Error generating stack: `+s.message+`
40`+s.stack}return{value:n,source:e,stack:r,digest:null}}function BT(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function q3(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var bne=typeof WeakMap=="function"?WeakMap:Map;function J$(n,e,t){t=Vc(-1,t),t.tag=3,t.payload={element:null};var i=e.value;return t.callback=function(){wS||(wS=!0,iI=i),q3(n,e)},t}function e7(n,e,t){t=Vc(-1,t),t.tag=3;var i=n.type.getDerivedStateFromError;if(typeof i=="function"){var r=e.value;t.payload=function(){return i(r)},t.callback=function(){q3(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){q3(n,e),typeof i!="function"&&(Oh===null?Oh=new Set([this]):Oh.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function Y4(n,e,t){var i=n.pingCache;if(i===null){i=n.pingCache=new bne;var r=new Set;i.set(e,r)}else r=i.get(e),r===void 0&&(r=new Set,i.set(e,r));r.has(t)||(r.add(t),n=Lne.bind(null,n,e,t),e.then(n,n))}function Q4(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function Z4(n,e,t,i,r){return n.mode&1?(n.flags|=65536,n.lanes=r,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Vc(-1,1),e.tag=2,Dh(t,e,1)
vendor: 6,392 bytes, line 40
40)),t.lanes|=1),n)}var _ne=cu.ReactCurrentOwner,Is=!1;function Zr(n,e,t,i){e.child=n===null?C$(e,null,t,i):b0(e,n.child,t,i)}function J4(n,e,t,i,r){t=t.render;var s=e.ref;return wg(e,r),i=TD(n,e,t,i,s,r),t=PD(),n!==null&&!Is?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,Jc(n,e,r)):(Fn&&t&&mD(e),e.flags|=1,Zr(n,e,i,r),e.child)}function ek(n,e,t,i,r){if(n===null){var s=t.type;return typeof s=="function"&&!kD(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,t7(n,e,s,i,r)):(n=_E(t.type,null,i,e,e.mode,r),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&r)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:yw,t(o,i)&&n.ref===e.ref)return Jc(n,e,r)}return e.flags|=1,n=Uh(s,i),n.ref=e.ref,n.return=e,e.child=n}function t7(n,e,t,i,r){if(n!==null){var s=n.memoizedProps;if(yw(s,i)&&n.ref===e.ref)if(Is=!1,e.pendingProps=i=s,(n.lanes&r)!==0)n.flags&131072&&(Is=!0);else return e.lanes=n.lanes,Jc(n,e,r)}return K3(n,e,t,i,r)}function n7(n,e,t){var i=e.pendingProps,r=i.children,s=n!==null?n.memoizedState:null;if(i.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Pn(Km,oo),oo|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,Pn(Km,oo),oo|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},i=s!==null?s.baseLanes:t,Pn(Km,oo),oo|=i}else s!==null?(i=s.baseLanes|t,e.memoizedState=null):i=t,Pn(Km,oo),oo|=i;return Zr(n,e,r,t),e.child}function i7(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function K3(n,e,t,i,r){var s=Os(t)?ep:Gr.current;return s=w0(e,s),wg(e,r),t=TD(n,e,t,i,s,r),i=PD(),n!==null&&!Is?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~r,Jc(n,e,r)):(Fn&&i&&mD(e),e.flags|=1,Zr(n,e,t,r),e.child)}function tk(n,e,t,i,r){if(Os(t)){var s=!0;cS(e)}else s=!1;if(wg(e,r),e.stateNode===null)wE(n,e),Z$(e,t,i),W3(e,t,i,r),i=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=t.contextType;typeof c=="object"&&c!==null?c=oa(c):(c=Os(t)?ep:Gr.current,c=w0(e,c));var u=t.getDerivedStateFromProps,h=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==i||l!==c)&&X4(e,o,i,c),Qu=!1;var f=e.memoizedState;o.state=f,pS(e,i,o,r),l=e.memoizedState,a!==i||f!==l||Ds.current||Qu?(typeof u=="function"&&(j3(e,t,u,i),l=e.memoizedState),(a=Qu||K4(e,t,a,i,f,l,c))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=l),o.props=i,o.state=l,o.context=c,i=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{o=e.stateNode,R$(n,e),a=e.memoizedProps,c=e.type===e.elementType?a:_a(e.type,a),o.props=c,h=e.pendingProps,f=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=oa(l):(l=Os(t)?ep:Gr.current,l=w0(e,l));var m=t.getDerivedStateFromProps;(u=typeof m=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==h||f!==l)&&X4(e,o,i,l),Qu=!1,f=e.memoizedState,o.state=f,pS(e,i,o,r);var g=e.memoizedState;a!==h||f!==g||Ds.current||Qu?(typeof m=="function"&&(j3(e,t,m,i),g=e.memoizedState),(c=Qu||K4(e,t,c,i,f,g,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(i,g,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(i,g,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=g),o.props=i,o.state=g,o.context=l,i=c):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),i=!1)}return X3(n,e,t,i,s,r)}function X3(n,e,t,i,r,s){i7(n,e);var o=(e.flags&128)!==0;if(!i&&!o)return r&&z4(e,t,!1),Jc(n,e,s);i=e.stateNode,_ne.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:i.render();return e.flags|=1,n!==null&&o?(e.child=b0(e,n.child,null,s),e.child=b0(e,null,a,s)):Zr(n,e,a,s),e.memoizedState=i.state,r&&z4(e,t,!0),e.child}function r7(n){var e=n.stateNode;e.pendingContext?F4(n,e.pendingContext,e.pendingContext!==e.context):e.context&&F4(n,e.context,!1),ED(n,e.containerInfo)}function nk(n,e,t,i,r){return x0(),yD(r),e.flags|=256,Zr(n,e,t,i),e.child}var Y3={dehydrated:null,treeContext:null,retryLane:0};function Q3(n){return{baseLanes:n,cachePool:null,transitions:null}}function s7(n,e,t){var i=e.pendingProps,r=Gn.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(r&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(r|=1),Pn(Gn,r&1),n===null)return $3(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=i.children,n=i.fallback,s?(i=e.mode,s=e.child,o={mode:"hidden",children:o},!(i&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=BA(o,i,0,null),n=jd(n,i,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=Q3(t),e.memoizedState=Y3,n):RD(e,o));if(r=n.memoizedState,r!==null&&(a=r.dehydrated,a!==null))return Ene(n,e,o,i,a,r,t);if(s){s=i.fallback,o=e.mode,r=n.child,a=r.sibling;var l={mode:"hidden",children:i.children};return!(o&1)&&e.child!==r?(i=e.child,i.childLanes=0,i.pendingProps=l,e.deletions=null):(i=Uh(r,l),i.subtreeFlags=r.subtreeFlags&14680064),a!==null?s=Uh(a,s):(s=jd(s,o,t,null),s.flags|=2),s.return=e,i.return=e,i.sibling=s,e.child=i,i=s,s=e.child,o=n.child.memoizedState,o=o===null?Q3(t):{base
vendor: 5,401 bytes, line 40
40Lanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=Y3,i}return s=n.child,n=s.sibling,i=Uh(s,{mode:"visible",children:i.children}),!(e.mode&1)&&(i.lanes=t),i.return=e,i.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=i,e.memoizedState=null,i}function RD(n,e){return e=BA({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function Mb(n,e,t,i){return i!==null&&yD(i),b0(e,n.child,null,t),n=RD(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function Ene(n,e,t,i,r,s,o){if(t)return e.flags&256?(e.flags&=-257,i=BT(Error(De(422))),Mb(n,e,o,i)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=i.fallback,r=e.mode,i=BA({mode:"visible",children:i.children},r,0,null),s=jd(s,r,o,null),s.flags|=2,i.return=e,s.return=e,i.sibling=s,e.child=i,e.mode&1&&b0(e,n.child,null,o),e.child.memoizedState=Q3(o),e.memoizedState=Y3,s);if(!(e.mode&1))return Mb(n,e,o,null);if(r.data==="$!"){if(i=r.nextSibling&&r.nextSibling.dataset,i)var a=i.dgst;return i=a,s=Error(De(419)),i=BT(s,i,void 0),Mb(n,e,o,i)}if(a=(o&n.childLanes)!==0,Is||a){if(i=Qi,i!==null){switch(o&-o){case 4:r=2;break;case 16:r=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:r=32;break;case 536870912:r=268435456;break;default:r=0}r=r&(i.suspendedLanes|o)?0:r,r!==0&&r!==s.retryLane&&(s.retryLane=r,Zc(n,r),ka(i,n,r,-1))}return BD(),i=BT(Error(De(421))),Mb(n,e,o,i)}return r.data==="$?"?(e.flags|=128,e.child=n.child,e=Une.bind(null,n),r._reactRetry=e,null):(n=s.treeContext,ho=Nh(r.nextSibling),po=e,Fn=!0,Ra=null,n!==null&&(ea[ta++]=Lc,ea[ta++]=Uc,ea[ta++]=tp,Lc=n.id,Uc=n.overflow,tp=e),e=RD(e,i.children),e.flags|=4096,e)}function ik(n,e,t){n.lanes|=e;var i=n.alternate;i!==null&&(i.lanes|=e),G3(n.return,e,t)}function kT(n,e,t,i,r){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:t,tailMode:r}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=i,s.tail=t,s.tailMode=r)}function o7(n,e,t){var i=e.pendingProps,r=i.revealOrder,s=i.tail;if(Zr(n,e,i.children,t),i=Gn.current,i&2)i=i&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&ik(n,t,e);else if(n.tag===19)ik(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}i&=1}if(Pn(Gn,i),!(e.mode&1))e.memoizedState=null;else switch(r){case"forwards":for(t=e.child,r=null;t!==null;)n=t.alternate,n!==null&&mS(n)===null&&(r=t),t=t.sibling;t=r,t===null?(r=e.child,e.child=null):(r=t.sibling,t.sibling=null),kT(e,!1,r,t,s);break;case"backwards":for(t=null,r=e.child,e.child=null;r!==null;){if(n=r.alternate,n!==null&&mS(n)===null){e.child=r;break}n=r.sibling,r.sibling=t,t=r,r=n}kT(e,!0,t,null,s);break;case"together":kT(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function wE(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function Jc(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),ip|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(De(153));if(e.child!==null){for(n=e.child,t=Uh(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=Uh(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function Sne(n,e,t){switch(e.tag){case 3:r7(e),x0();break;case 5:N$(e);break;case 1:Os(e.type)&&cS(e);break;case 4:ED(e,e.stateNode.containerInfo);break;case 10:var i=e.type._context,r=e.memoizedProps.value;Pn(fS,i._currentValue),i._currentValue=r;break;case 13:if(i=e.memoizedState,i!==null)return i.dehydrated!==null?(Pn(Gn,Gn.current&1),e.flags|=128,null):t&e.child.childLanes?s7(n,e,t):(Pn(Gn,Gn.current&1),n=Jc(n,e,t),n!==null?n.sibling:null);Pn(Gn,Gn.current&1);break;case 19:if(i=(t&e.childLanes)!==0,n.flags&128){if(i)return o7(n,e,t);e.flags|=128}if(r=e.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),Pn(Gn,Gn.current),i)break;return null;case 22:case 23:return e.lanes=0,n7(n,e,t)}return Jc(n,e,t)}var a7,Z3,l7,c7;a7=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};Z3=function(){};l7=function(n,e,t,i){var r=n.memoizedProps;if(r!==i){n=e.stateNode,cd(Dl.current);var s=null;switch(t){case"input":r=x3(n,r),i=x3(n,i),s=[];break;case"select":r=Xn({},r,{value:void 0}),i=Xn({},i,{value:void 0}),s=[];break;case"textarea":r=E3(n,r),i=E3(n,i),s=[];break;default:typeof r.onClick!="function"&&typeof i.onClick=="function"&&(n.onclick=aS)}A3(t,i);var o;t=null;for(c in r)if(!i.hasOwnProperty(c)&&r.hasOwnProperty(c)&&r[c]!=null)if(c==="style"){var a=r[c];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(uw.hasOwnProperty(c)?s||
vendor: 5,322 bytes, line 40
40(s=[]):(s=s||[]).push(c,null));for(c in i){var l=i[c];if(a=r!=null?r[c]:void 0,i.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(c,t)),t=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(uw.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Rn("scroll",n),s||a===l||(s=[])):(s=s||[]).push(c,l))}t&&(s=s||[]).push("style",t);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};c7=function(n,e,t,i){t!==i&&(e.flags|=4)};function Uy(n,e){if(!Fn)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var i=null;t!==null;)t.alternate!==null&&(i=t),t=t.sibling;i===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:i.sibling=null}}function Er(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,i=0;if(e)for(var r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags&14680064,i|=r.flags&14680064,r.return=n,r=r.sibling;else for(r=n.child;r!==null;)t|=r.lanes|r.childLanes,i|=r.subtreeFlags,i|=r.flags,r.return=n,r=r.sibling;return n.subtreeFlags|=i,n.childLanes=t,e}function Ane(n,e,t){var i=e.pendingProps;switch(gD(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Er(e),null;case 1:return Os(e.type)&&lS(),Er(e),null;case 3:return i=e.stateNode,_0(),Ln(Ds),Ln(Gr),AD(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Sb(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Ra!==null&&(oI(Ra),Ra=null))),Z3(n,e),Er(e),null;case 5:SD(e);var r=cd(_w.current);if(t=e.type,n!==null&&e.stateNode!=null)l7(n,e,t,i,r),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!i){if(e.stateNode===null)throw Error(De(166));return Er(e),null}if(n=cd(Dl.current),Sb(e)){i=e.stateNode,t=e.type;var s=e.memoizedProps;switch(i[Al]=e,i[xw]=s,n=(e.mode&1)!==0,t){case"dialog":Rn("cancel",i),Rn("close",i);break;case"iframe":case"object":case"embed":Rn("load",i);break;case"video":case"audio":for(r=0;r<_v.length;r++)Rn(_v[r],i);break;case"source":Rn("error",i);break;case"img":case"image":case"link":Rn("error",i),Rn("load",i);break;case"details":Rn("toggle",i);break;case"input":f4(i,s),Rn("invalid",i);break;case"select":i._wrapperState={wasMultiple:!!s.multiple},Rn("invalid",i);break;case"textarea":p4(i,s),Rn("invalid",i)}A3(t,s),r=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?i.textContent!==a&&(s.suppressHydrationWarning!==!0&&Eb(i.textContent,a,n),r=["children",a]):typeof a=="number"&&i.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Eb(i.textContent,a,n),r=["children",""+a]):uw.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&Rn("scroll",i)}switch(t){case"input":mb(i),d4(i,s,!0);break;case"textarea":mb(i),m4(i);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(i.onclick=aS)}i=r,e.updateQueue=i,i!==null&&(e.flags|=4)}else{o=r.nodeType===9?r:r.ownerDocument,n==="http://www.w3.org/1999/xhtml"&&(n=B9(t)),n==="http://www.w3.org/1999/xhtml"?t==="script"?(n=o.createElement("div"),n.innerHTML="<script><\/script>",n=n.removeChild(n.firstChild)):typeof i.is=="string"?n=o.createElement(t,{is:i.is}):(n=o.createElement(t),t==="select"&&(o=n,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):n=o.createElementNS(n,t),n[Al]=e,n[xw]=i,a7(n,e,!1,!1),e.stateNode=n;e:{switch(o=M3(t,i),t){case"dialog":Rn("cancel",n),Rn("close",n),r=i;break;case"iframe":case"object":case"embed":Rn("load",n),r=i;break;case"video":case"audio":for(r=0;r<_v.length;r++)Rn(_v[r],n);r=i;break;case"source":Rn("error",n),r=i;break;case"img":case"image":case"link":Rn("error",n),Rn("load",n),r=i;break;case"details":Rn("toggle",n),r=i;break;case"input":f4(n,i),r=x3(n,i),Rn("invalid",n);break;case"option":r=i;break;case"select":n._wrapperState={wasMultiple:!!i.multiple},r=Xn({},i,{value:void 0}),Rn("invalid",n);break;case"textarea":p4(n,i),r=E3(n,i),Rn("invalid",n);break;default:r=i}A3(t,r),a=r;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?z9(n,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&k9(n,l)):s==="children"?typeof l=="string"?(t!=="textarea"||l!=="")&&hw(n,l):typeof l=="number"&&hw(n,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(uw.hasOwnProperty(s)?l!=null&&s==="onScroll"&&Rn("scroll",n):l!=null&&tD(n,s,l,o))}switch(t){case"input":mb(n),d4(n,i,!1);break;case"textarea":mb(n),m4(n);break;case"option":i.value!=null&&n.setAttribute("value",""+Vh(i.value));break;case"select":n.multiple=!!i.multiple,s=i.value,s!=null?mg(n,!!i.multiple,s,!1):i.defaultValue!=null&&mg(n,!!i.multiple,i.defaultValue,!0);break;default:typeof r.onClick=="function"&&(n.onclick=aS)}switch(t){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}}i&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}
vendor: 27,751 bytes, line 40
40return Er(e),null;case 6:if(n&&e.stateNode!=null)c7(n,e,n.memoizedProps,i);else{if(typeof i!="string"&&e.stateNode===null)throw Error(De(166));if(t=cd(_w.current),cd(Dl.current),Sb(e)){if(i=e.stateNode,t=e.memoizedProps,i[Al]=e,(s=i.nodeValue!==t)&&(n=po,n!==null))switch(n.tag){case 3:Eb(i.nodeValue,t,(n.mode&1)!==0);break;case 5:n.memoizedProps.suppressHydrationWarning!==!0&&Eb(i.nodeValue,t,(n.mode&1)!==0)}s&&(e.flags|=4)}else i=(t.nodeType===9?t:t.ownerDocument).createTextNode(i),i[Al]=e,e.stateNode=i}return Er(e),null;case 13:if(Ln(Gn),i=e.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(Fn&&ho!==null&&e.mode&1&&!(e.flags&128))T$(),x0(),e.flags|=98560,s=!1;else if(s=Sb(e),i!==null&&i.dehydrated!==null){if(n===null){if(!s)throw Error(De(318));if(s=e.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(De(317));s[Al]=e}else x0(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Er(e),s=!1}else Ra!==null&&(oI(Ra),Ra=null),s=!0;if(!s)return e.flags&65536?e:null}return e.flags&128?(e.lanes=t,e):(i=i!==null,i!==(n!==null&&n.memoizedState!==null)&&i&&(e.child.flags|=8192,e.mode&1&&(n===null||Gn.current&1?Ii===0&&(Ii=3):BD())),e.updateQueue!==null&&(e.flags|=4),Er(e),null);case 4:return _0(),Z3(n,e),n===null&&vw(e.stateNode.containerInfo),Er(e),null;case 10:return xD(e.type._context),Er(e),null;case 17:return Os(e.type)&&lS(),Er(e),null;case 19:if(Ln(Gn),s=e.memoizedState,s===null)return Er(e),null;if(i=(e.flags&128)!==0,o=s.rendering,o===null)if(i)Uy(s,!1);else{if(Ii!==0||n!==null&&n.flags&128)for(n=e.child;n!==null;){if(o=mS(n),o!==null){for(e.flags|=128,Uy(s,!1),i=o.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),e.subtreeFlags=0,i=t,t=e.child;t!==null;)s=t,n=i,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=n,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,n=o.dependencies,s.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext}),t=t.sibling;return Pn(Gn,Gn.current&1|2),e.child}n=n.sibling}s.tail!==null&&fi()>S0&&(e.flags|=128,i=!0,Uy(s,!1),e.lanes=4194304)}else{if(!i)if(n=mS(o),n!==null){if(e.flags|=128,i=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Uy(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Fn)return Er(e),null}else 2*fi()-s.renderingStartTime>S0&&t!==1073741824&&(e.flags|=128,i=!0,Uy(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=fi(),e.sibling=null,t=Gn.current,Pn(Gn,i?t&1|2:t&1),e):(Er(e),null);case 22:case 23:return UD(),i=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?oo&1073741824&&(Er(e),e.subtreeFlags&6&&(e.flags|=8192)):Er(e),null;case 24:return null;case 25:return null}throw Error(De(156,e.tag))}function Mne(n,e){switch(gD(e),e.tag){case 1:return Os(e.type)&&lS(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return _0(),Ln(Ds),Ln(Gr),AD(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return SD(e),null;case 13:if(Ln(Gn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(De(340));x0()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return Ln(Gn),null;case 4:return _0(),null;case 10:return xD(e.type._context),null;case 22:case 23:return UD(),null;case 24:return null;default:return null}}var Tb=!1,kr=!1,Tne=typeof WeakSet=="function"?WeakSet:Set,it=null;function qm(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(i){ni(n,e,i)}else t.current=null}function J3(n,e,t){try{t()}catch(i){ni(n,e,i)}}var rk=!1;function Pne(n,e){if(U3=rS,n=p$(),pD(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var i=t.getSelection&&t.getSelection();if(i&&i.rangeCount!==0){t=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,u=0,h=n,f=null;t:for(;;){for(var m;h!==t||r!==0&&h.nodeType!==3||(a=o+r),h!==s||i!==0&&h.nodeType!==3||(l=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)f=h,h=m;for(;;){if(h===n)break t;if(f===t&&++c===r&&(a=o),f===s&&++u===i&&(l=o),(m=h.nextSibling)!==null)break;h=f,f=h.parentNode}h=m}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(B3={focusedElem:n,selectionRange:t},rS=!1,it=e;it!==null;)if(e=it,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,it=n;else for(;it!==null;){e=it;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var v=g.memoizedProps,w=g.memoizedState,y=e.stateNode,_=y.getSnapshotBeforeUpdate(e.elementType===e.type?v:_a(e.type,v),w);y.__reactInternalSnapshotBeforeUpdate=_}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(De(163))}}catch(S){ni(e,e.return,S)}if(n=e.sibling,n!==null){n.return=e.return,it=n;break}it=e.return}return g=rk,rk=!1,g}function $v(n,e,t){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&n)===n){var s=r.destroy;r.destroy=void 0,s!==void 0&&J3(e,t,s)}r=r.next}while(r!==i)}}function LA(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var i=t.create;t.destroy=i()}t=t.next}while(t!==e)}}function eI(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function u7(n){var e=n.alternate;e!==null&&(n.alternate=null,u7(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Al],delete e[xw],delete e[z3],delete e[une],delete e[hne])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function h7(n){return n.tag===5||n.tag===3||n.tag===4}function sk(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||h7(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function tI(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=aS));else if(i!==4&&(n=n.child,n!==null))for(tI(n,e,t),n=n.sibling;n!==null;)tI(n,e,t),n=n.sibling}function nI(n,e,t){var i=n.tag;if(i===5||i===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(i!==4&&(n=n.child,n!==null))for(nI(n,e,t),n=n.sibling;n!==null;)nI(n,e,t),n=n.sibling}var lr=null,Ia=!1;function _u(n,e,t){for(t=t.child;t!==null;)f7(n,e,t),t=t.sibling}function f7(n,e,t){if(Nl&&typeof Nl.onCommitFiberUnmount=="function")try{Nl.onCommitFiberUnmount(TA,t)}catch{}switch(t.tag){case 5:kr||qm(t,e);case 6:var i=lr,r=Ia;lr=null,_u(n,e,t),lr=i,Ia=r,lr!==null&&(Ia?(n=lr,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):lr.removeChild(t.stateNode));break;case 18:lr!==null&&(Ia?(n=lr,t=t.stateNode,n.nodeType===8?RT(n.parentNode,t):n.nodeType===1&&RT(n,t),mw(n)):RT(lr,t.stateNode));break;case 4:i=lr,r=Ia,lr=t.stateNode.containerInfo,Ia=!0,_u(n,e,t),lr=i,Ia=r;break;case 0:case 11:case 14:case 15:if(!kr&&(i=t.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&J3(t,e,o),r=r.next}while(r!==i)}_u(n,e,t);break;case 1:if(!kr&&(qm(t,e),i=t.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=t.memoizedProps,i.state=t.memoizedState,i.componentWillUnmount()}catch(a){ni(t,e,a)}_u(n,e,t);break;case 21:_u(n,e,t);break;case 22:t.mode&1?(kr=(i=kr)||t.memoizedState!==null,_u(n,e,t),kr=i):_u(n,e,t);break;default:_u(n,e,t)}}function ok(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new Tne),e.forEach(function(i){var r=Bne.bind(null,n,i);t.has(i)||(t.add(i),i.then(r,r))})}}function ha(n,e){var t=e.deletions;if(t!==null)for(var i=0;i<t.length;i++){var r=t[i];try{var s=n,o=e,a=o;e:for(;a!==null;){switch(a.tag){case 5:lr=a.stateNode,Ia=!1;break e;case 3:lr=a.stateNode.containerInfo,Ia=!0;break e;case 4:lr=a.stateNode.containerInfo,Ia=!0;break e}a=a.return}if(lr===null)throw Error(De(160));f7(s,o,r),lr=null,Ia=!1;var l=r.alternate;l!==null&&(l.return=null),r.return=null}catch(c){ni(r,e,c)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)d7(e,n),e=e.sibling}function d7(n,e){var t=n.alternate,i=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:if(ha(e,n),nl(n),i&4){try{$v(3,n,n.return),LA(3,n)}catch(v){ni(n,n.return,v)}try{$v(5,n,n.return)}catch(v){ni(n,n.return,v)}}break;case 1:ha(e,n),nl(n),i&512&&t!==null&&qm(t,t.return);break;case 5:if(ha(e,n),nl(n),i&512&&t!==null&&qm(t,t.return),n.flags&32){var r=n.stateNode;try{hw(r,"")}catch(v){ni(n,n.return,v)}}if(i&4&&(r=n.stateNode,r!=null)){var s=n.memoizedProps,o=t!==null?t.memoizedProps:s,a=n.type,l=n.updateQueue;if(n.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&L9(r,s),M3(a,o);var c=M3(a,s);for(o=0;o<l.length;o+=2){var u=l[o],h=l[o+1];u==="style"?z9(r,h):u==="dangerouslySetInnerHTML"?k9(r,h):u==="children"?hw(r,h):tD(r,u,h,c)}switch(a){case"input":b3(r,s);break;case"textarea":U9(r,s);break;case"select":var f=r._wrapperState.wasMultiple;r._wrapperState.wasMultiple=!!s.multiple;var m=s.value;m!=null?mg(r,!!s.multiple,m,!1):f!==!!s.multiple&&(s.defaultValue!=null?mg(r,!!s.multiple,s.defaultValue,!0):mg(r,!!s.multiple,s.multiple?[]:"",!1))}r[xw]=s}catch(v){ni(n,n.return,v)}}break;case 6:if(ha(e,n),nl(n),i&4){if(n.stateNode===null)throw Error(De(162));r=n.stateNode,s=n.memoizedProps;try{r.nodeValue=s}catch(v){ni(n,n.return,v)}}break;case 3:if(ha(e,n),nl(n),i&4&&t!==null&&t.memoizedState.isDehydrated)try{mw(e.containerInfo)}catch(v){ni(n,n.return,v)}break;case 4:ha(e,n),nl(n);break;case 13:ha(e,n),nl(n),r=n.child,r.flags&8192&&(s=r.memoizedState!==null,r.stateNode.isHidden=s,!s||r.alternate!==null&&r.alternate.memoizedState!==null||(OD=fi())),i&4&&ok(n);break;case 22:if(u=t!==null&&t.memoizedState!==null,n.mode&1?(kr=(c=kr)||u,ha(e,n),kr=c):ha(e,n),nl(n),i&8192){if(c=n.memoizedState!==null,(n.stateNode.isHidden=c)&&!u&&n.mode&1)for(it=n,u=n.child;u!==null;){for(h=it=u;it!==null;){switch(f=it,m=f.child,f.tag){case 0:case 11:case 14:case 15:$v(4,f,f.return);break;case 1:qm(f,f.return);var g=f.stateNode;if(typeof g.componentWillUnmount=="function"){i=f,t=f.return;try{e=i,g.props=e.memoizedProps,g.state=e.memoizedState,g.componentWillUnmount()}catch(v){ni(i,t,v)}}break;case 5:qm(f,f.return);break;case 22:if(f.memoizedState!==null){lk(h);continue}}m!==null?(m.return=f,it=m):lk(h)}u=u.sibling}e:for(u=null,h=n;;){if(h.tag===5){if(u===null){u=h;try{r=h.stateNode,c?(s=r.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=h.stateNode,l=h.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=F9("display",o))}catch(v){ni(n,n.return,v)}}}else if(h.tag===6){if(u===null)try{h.stateNode.nodeValue=c?"":h.memoizedProps}catch(v){ni(n,n.return,v)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===n)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===n)break e;for(;h.sibling===null;){if(h.return===null||h.return===n)break e;u===h&&(u=null),h=h.return}u===h&&(u=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:ha(e,n),nl(n),i&4&&ok(n);break;case 21:break;default:ha(e,n),nl(n)}}function nl(n){var e=n.flags;if(e&2){try{e:{for(var t=n.return;t!==null;){if(h7(t)){var i=t;break e}t=t.return}throw Error(De(160))}switch(i.tag){case 5:var r=i.stateNode;i.flags&32&&(hw(r,""),i.flags&=-33);var s=sk(n);nI(n,s,r);break;case 3:case 4:var o=i.stateNode.containerInfo,a=sk(n);tI(n,a,o);break;default:throw Error(De(161))}}catch(l){ni(n,n.return,l)}n.flags&=-3}e&4096&&(n.flags&=-4097)}function Cne(n,e,t){it=n,p7(n)}function p7(n,e,t){for(var i=(n.mode&1)!==0;it!==null;){var r=it,s=r.child;if(r.tag===22&&i){var o=r.memoizedState!==null||Tb;if(!o){var a=r.alternate,l=a!==null&&a.memoizedState!==null||kr;a=Tb;var c=kr;if(Tb=o,(kr=l)&&!c)for(it=r;it!==null;)o=it,l=o.child,o.tag===22&&o.memoizedState!==null?ck(r):l!==null?(l.return=o,it=l):ck(r);for(;s!==null;)it=s,p7(s),s=s.sibling;it=r,Tb=a,kr=c}ak(n)}else r.subtreeFlags&8772&&s!==null?(s.return=r,it=s):ak(n)}}function ak(n){for(;it!==null;){var e=it;if(e.flags&8772){var t=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:kr||LA(5,e);break;case 1:var i=e.stateNode;if(e.flags&4&&!kr)if(t===null)i.componentDidMount();else{var r=e.elementType===e.type?t.memoizedProps:_a(e.type,t.memoizedProps);i.componentDidUpdate(r,t.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var s=e.updateQueue;s!==null&&j4(e,s,i);break;case 3:var o=e.updateQueue;if(o!==null){if(t=null,e.child!==null)switch(e.child.tag){case 5:t=e.child.stateNode;break;case 1:t=e.child.stateNode}j4(e,o,t)}break;case 5:var a=e.stateNode;if(t===null&&e.flags&4){t=a;var l=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&t.focus();break;case"img":l.src&&(t.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 h=u.dehydrated;h!==null&&mw(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(De(163))}kr||e.flags&512&&eI(e)}catch(f){ni(e,e.return,f)}}if(e===n){it=null;break}if(t=e.sibling,t!==null){t.return=e.return,it=t;break}it=e.return}}function lk(n){for(;it!==null;){var e=it;if(e===n){it=null;break}var t=e.sibling;if(t!==null){t.return=e.return,it=t;break}it=e.return}}function ck(n){for(;it!==null;){var e=it;try{switch(e.tag){case 0:case 11:case 15:var t=e.return;try{LA(4,e)}catch(l){ni(e,t,l)}break;case 1:var i=e.stateNode;if(typeof i.componentDidMount=="function"){var r=e.return;try{i.componentDidMount()}catch(l){ni(e,r,l)}}var s=e.return;try{eI(e)}catch(l){ni(e,s,l)}break;case 5:var o=e.return;try{eI(e)}catch(l){ni(e,o,l)}}}catch(l){ni(e,e.return,l)}if(e===n){it=null;break}var a=e.sibling;if(a!==null){a.return=e.return,it=a;break}it=e.return}}var Ine=Math.ceil,vS=cu.ReactCurrentDispatcher,ND=cu.ReactCurrentOwner,ra=cu.ReactCurrentBatchConfig,Jt=0,Qi=null,Ei=null,fr=0,oo=0,Km=ef(0),Ii=0,Mw=null,ip=0,UA=0,DD=0,Gv=null,Ps=null,OD=0,S0=1/0,hc=null,wS=!1,iI=null,Oh=null,Pb=!1,Mh=null,xS=0,jv=0,rI=null,xE=-1,bE=0;function ss(){return Jt&6?fi():xE!==-1?xE:xE=fi()}function Lh(n){return n.mode&1?Jt&2&&fr!==0?fr&-fr:dne.transition!==null?(bE===0&&(bE=Z9()),bE):(n=gn,n!==0||(n=window.event,n=n===void 0?16:s$(n.type)),n):1}function ka(n,e,t,i){if(50<jv)throw jv=0,rI=null,Error(De(185));D1(n,t,i),(!(Jt&2)||n!==Qi)&&(n===Qi&&(!(Jt&2)&&(UA|=t),Ii===4&&ih(n,fr)),Ls(n,i),t===1&&Jt===0&&!(e.mode&1)&&(S0=fi()+500,NA&&tf()))}function Ls(n,e){var t=n.callbackNode;dte(n,e);var i=iS(n,n===Qi?fr:0);if(i===0)t!==null&&v4(t),n.callbackNode=null,n.callbackPriority=0;else if(e=i&-i,n.callbackPriority!==e){if(t!=null&&v4(t),e===1)n.tag===0?fne(uk.bind(null,n)):S$(uk.bind(null,n)),lne(function(){!(Jt&6)&&tf()}),t=null;else{switch(J9(i)){case 1:t=oD;break;case 4:t=Y9;break;case 16:t=nS;break;case 536870912:t=Q9;break;default:t=nS}t=_7(t,m7.bind(null,n))}n.callbackPriority=e,n.callbackNode=t}}function m7(n,e){if(xE=-1,bE=0,Jt&6)throw Error(De(327));var t=n.callbackNode;if(xg()&&n.callbackNode!==t)return null;var i=iS(n,n===Qi?fr:0);if(i===0)return null;if(i&30||i&n.expiredLanes||e)e=bS(n,i);else{e=i;var r=Jt;Jt|=2;var s=y7();(Qi!==n||fr!==e)&&(hc=null,S0=fi()+500,Gd(n,e));do try{Dne();break}catch(a){g7(n,a)}while(!0);wD(),vS.current=s,Jt=r,Ei!==null?e=0:(Qi=null,fr=0,e=Ii)}if(e!==0){if(e===2&&(r=R3(n),r!==0&&(i=r,e=sI(n,r))),e===1)throw t=Mw,Gd(n,0),ih(n,i),Ls(n,fi()),t;if(e===6)ih(n,i);else{if(r=n.current.alternate,!(i&30)&&!Rne(r)&&(e=bS(n,i),e===2&&(s=R3(n),s!==0&&(i=s,e=sI(n,s))),e===1))throw t=Mw,Gd(n,0),ih(n,i),Ls(n,fi()),t;switch(n.finishedWork=r,n.finishedLanes=i,e){case 0:case 1:throw Error(De(345));case 2:$f(n,Ps,hc);break;case 3:if(ih(n,i),(i&130023424)===i&&(e=OD+500-fi(),10<e)){if(iS(n,0)!==0)break;if(r=n.suspendedLanes,(r&i)!==i){ss(),n.pingedLanes|=n.suspendedLanes&r;break}n.timeoutHandle=F3($f.bind(null,n,Ps,hc),e);break}$f(n,Ps,hc);break;case 4:if(ih(n,i),(i&4194240)===i)break;for(e=n.eventTimes,r=-1;0<i;){var o=31-Ba(i);s=1<<o,o=e[o],o>r&&(r=o),i&=~s}if(i=r,i=fi()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Ine(i/1960))-i,10<i){n.timeoutHandle=F3($f.bind(null,n,Ps,hc),i);break}$f(n,Ps,hc);break;case 5:$f(n,Ps,hc);break;default:throw Error(De(329))}}}return Ls(n,fi()),n.callbackNode===t?m7.bind(null,n):null}function sI(n,e){var t=Gv;return n.current.memoizedState.isDehydrated&&(Gd(n,e).flags|=256),n=bS(n,e),n!==2&&(e=Ps,Ps=t,e!==null&&oI(e)),n}function oI(n){Ps===null?Ps=n:Ps.push.apply(Ps,n)}function Rne(n){for(var e=n;;){if(e.flags&16384){var t=e.updateQueue;if(t!==null&&(t=t.stores,t!==null))for(var i=0;i<t.length;i++){var r=t[i],s=r.getSnapshot;r=r.value;try{if(!za(s(),r))return!1}catch{return!1}}}if(t=e.child,e.subtreeFlags&16384&&t!==null)t.return=e,e=t;else{if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function ih(n,e){for(e&=~DD,e&=~UA,n.suspendedLanes|=e,n.pingedLanes&=~e,n=n.expirationTimes;0<e;){var t=31-Ba(e),i=1<<t;n[t]=-1,e&=~i}}function uk(n){if(Jt&6)throw Error(De(327));xg();var e=iS(n,0);if(!(e&1))return Ls(n,fi()),null;var t=bS(n,e);if(n.tag!==0&&t===2){var i=R3(n);i!==0&&(e=i,t=sI(n,i))}if(t===1)throw t=Mw,Gd(n,0),ih(n,e),Ls(n,fi()),t;if(t===6)throw Error(De(345));return n.finishedWork=n.current.alternate,n.finishedLanes=e,$f(n,Ps,hc),Ls(n,fi()),null}function LD(n,e){var t=Jt;Jt|=1;try{return n(e)}finally{Jt=t,Jt===0&&(S0=fi()+500,NA&&tf())}}function rp(n){Mh!==null&&Mh.tag===0&&!(Jt&6)&&xg();var e=Jt;Jt|=1;var t=ra.transition,i=gn;try{if(ra.transition=null,gn=1,n)return n()}finally{gn=i,ra.transition=t,Jt=e,!(Jt&6)&&tf()}}function UD(){oo=Km.current,Ln(Km)}function Gd(n,e){n.finishedWork=null,n.finishedLanes=0;var t=n.timeoutHandle;if(t!==-1&&(n.timeoutHandle=-1,ane(t)),Ei!==null)for(t=Ei.return;t!==null;){var i=t;switch(gD(i),i.tag){case 1:i=i.type.childContextTypes,i!=null&&lS();break;case 3:_0(),Ln(Ds),Ln(Gr),AD();break;case 5:SD(i);break;case 4:_0();break;case 13:Ln(Gn);break;case 19:Ln(Gn);break;case 10:xD(i.type._context);break;case 22:case 23:UD()}t=t.return}if(Qi=n,Ei=n=Uh(n.current,null),fr=oo=e,Ii=0,Mw=null,DD=UA=ip=0,Ps=Gv=null,ld!==null){for(e=0;e<ld.length;e++)if(t=ld[e],i=t.interleaved,i!==null){t.interleaved=null;var r=i.next,s=t.pending;if(s!==null){var o=s.next;s.next=r,i.next=o}t.pending=i}ld=null}return n}function g7(n,e){do{var t=Ei;try{if(wD(),yE.current=yS,gS){for(var i=Kn.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}gS=!1}if(np=0,ji=Pi=Kn=null,Hv=!1,Ew=0,ND.current=null,t===null||t.return===null){Ii=1,Mw=e,Ei=null;break}e:{var s=n,o=t.return,a=t,l=e;if(e=fr,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,h=u.tag;if(!(u.mode&1)&&(h===0||h===11||h===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 m=Q4(o);if(m!==null){m.flags&=-257,Z4(m,o,a,s,e),m.mode&1&&Y4(s,c,e),e=m,l=c;var g=e.updateQueue;if(g===null){var v=new Set;v.add(l),e.updateQueue=v}else g.add(l);break e}else{if(!(e&1)){Y4(s,c,e),BD();break e}l=Error(De(426))}}else if(Fn&&a.mode&1){var w=Q4(o);if(w!==null){!(w.flags&65536)&&(w.flags|=256),Z4(w,o,a,s,e),yD(E0(l,a));break e}}s=l=E0(l,a),Ii!==4&&(Ii=2),Gv===null?Gv=[s]:Gv.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,e&=-e,s.lanes|=e;var y=J$(s,l,e);G4(s,y);break e;case 1:a=l;var _=s.type,x=s.stateNode;if(!(s.flags&128)&&(typeof _.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Oh===null||!Oh.has(x)))){s.flags|=65536,e&=-e,s.lanes|=e;var S=e7(s,a,e);G4(s,S);break e}}s=s.return}while(s!==null)}w7(t)}catch(M){e=M,Ei===t&&t!==null&&(Ei=t=t.return);continue}break}while(!0)}function y7(){var n=vS.current;return vS.current=yS,n===null?yS:n}function BD(){(Ii===0||Ii===3||Ii===2)&&(Ii=4),Qi===null||!(ip&268435455)&&!(UA&268435455)||ih(Qi,fr)}function bS(n,e){var t=Jt;Jt|=2;var i=y7();(Qi!==n||fr!==e)&&(hc=null,Gd(n,e));do try{Nne();break}catch(r){g7(n,r)}while(!0);if(wD(),Jt=t,vS.current=i,Ei!==null)throw Error(De(261));return Qi=null,fr=0,Ii}function Nne(){for(;Ei!==null;)v7(Ei)}function Dne(){for(;Ei!==null&&!rte();)v7(Ei)}function v7(n){var e=b7(n.alternate,n,oo);n.memoizedProps=n.pendingProps,e===null?w7(n):Ei=e,ND.current=null}function w7(n){var e=n;do{var t=e.alternate;if(n=e.return,e.flags&32768){if(t=Mne(t,e),t!==null){t.flags&=32767,Ei=t;return}if(n!==null)n.flags|=32768,n.subtreeFlags=0,n.deletions=null;else{Ii=6,Ei=null;return}}else if(t=Ane(t,e,oo),t!==null){Ei=t;return}if(e=e.sibling,e!==null){Ei=e;return}Ei=e=n}while(e!==null);Ii===0&&(Ii=5)}function $f(n,e,t){var i=gn,r=ra.transition;try{ra.transition=null,gn=1,One(n,e,t,i)}finally{ra.transition=r,gn=i}return null}function One(n,e,t,i){do xg();while(Mh!==null);if(Jt&6)throw Error(De(327));t=n.finishedWork;var r=n.finishedLanes;if(t===null)return null;if(n.finishedWork=null,n.finishedLanes=0,t===n.current)throw Error(De(177));n.callbackNode=null,n.callbackPriority=0;var s=t.lanes|t.childLanes;if(pte(n,s),n===Qi&&(Ei=Qi=null,fr=0),!(t.subtreeFlags&2064)&&!(t.flags&2064)||Pb||(Pb=!0,_7(nS,function(){return xg(),null})),s=(t.flags&15990)!==0,t.subtreeFlags&15990||s){s=ra.transition,ra.transition=null;var o=gn;gn=1;var a=Jt;Jt|=4,ND.current=null,Pne(n,t),d7(t,n),ene(B3),rS=!!U3,B3=U3=null,n.current=t,Cne(t),ste(),Jt=a,gn=o,ra.transition=s}else n.current=t;if(Pb&&(Pb=!1,Mh=n,xS=r),s=n.pendingLanes,s===0&&(Oh=null),lte(t.stateNode),Ls(n,fi()),e!==null)for(i=n.onRecoverableError,t=0;t<e.length;t++)r=e[t],i(r.value,{componentStack:r.stack,digest:r.digest});if(wS)throw wS=!1,n=iI,iI=null,n;return xS&1&&n.tag!==0&&xg(),s=n.pendingLanes,s&1?n===rI?jv++:(jv=0,rI=n):jv=0,tf(),null}function xg(){if(Mh!==null){var n=J9(xS),e=ra.transition,t=gn;try{if(ra.transition=null,gn=16>n?16:n,Mh===null)var i=!1;else{if(n=Mh,Mh=null,xS=0,Jt&6)throw Error(De(331));var r=Jt;for(Jt|=4,it=n.current;it!==null;){var s=it,o=s.child;if(it.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(it=c;it!==null;){var u=it;switch(u.tag){case 0:case 11:case 15:$v(8,u,s)}var h=u.child;if(h!==null)h.return=u,it=h;else for(;it!==null;){u=it;var f=u.sibling,m=u.return;if(u7(u),u===c){it=null;break}if(f!==null){f.return=m,it=f;break}it=m}}}var g=s.alternate;if(g!==null){var v=g.child;if(v!==null){g.child=null;do{var w=v.sibling;v.sibling=null,v=w}while(v!==null)}}it=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,it=o;else e:for(;it!==null;){if(s=it,s.flags&2048)switch(s.tag){case 0:case 11:case 15:$v(9,s,s.return)}var y=s.sibling;if(y!==null){y.return=s.return,it=y;break e}it=s.return}}var _=n.current;for(it=_;it!==null;){o=it;var x=o.child;if(o.subtreeFlags&2064&&x!==null)x.return=o,it=x;else e:for(o=_;it!==null;){if(a=it,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:LA(9,a)}}catch(M){ni(a,a.return,M)}if(a===o){it=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,it=S;break e}it=a.return}}if(Jt=r,tf(),Nl&&typeof Nl.onPostCommitFiberRoot=="function")try{Nl.onPostCommitFiberRoot(TA,n)}catch{}i=!0}return i}finally{gn=t,ra.transition=e}}return!1}function hk(n,e,t){e=E0(t,e),e=J$(n,e,1),n=Dh(n,e,1),e=ss(),n!==null&&(D1(n,1,e),Ls(n,e))}function ni(n,e,t){if(n.tag===3)hk(n,n,t);else for(;e!==null;){if(e.tag===3){hk(e,n,t);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Oh===null||!Oh.has(i))){n=E0(t,n),n=e7(e,n,1),e=Dh(e,n,1),n=ss(),e!==null&&(D1(e,1,n),Ls(e,n));break}}e=e.return}}function Lne(n,e,t){var i=n.pingCache;i!==null&&i.delete(e),e=ss(),n.pingedLanes|=n.suspendedLanes&t,Qi===n&&(fr&t)===t&&(Ii===4||Ii===3&&(fr&130023424)===fr&&500>fi()-OD?Gd(n,0):DD|=t),Ls(n,e)}function x7(n,e){e===0&&(n.mode&1?(e=vb,vb<<=1,!(vb&130023424)&&(vb=4194304)):e=1);var t=ss();n=Zc(n,e),n!==null&&(D1(n,e,t),Ls(n,t))}function Une(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),x7(n,t)}function Bne(n,e){var t=0;switch(n.tag){case 13:var i=n.stateNode,r=n.memoizedState;r!==null&&(t=r.retryLane);break;case 19:i=n.stateNode;break;default:throw Error(De(314))}i!==null&&i.delete(e),x7(n,t)}var b7;b7=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Ds.current)Is=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Is=!1,Sne(n,e,t);Is=!!(n.flags&131072)}else Is=!1,Fn&&e.flags&1048576&&A$(e,hS,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;wE(n,e),n=e.pendingProps;var r=w0(e,Gr.current);wg(e,t),r=TD(null,e,i,n,r,t);var s=PD();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Os(i)?(s=!0,cS(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,_D(e),r.updater=OA,e.stateNode=r,r._reactInternals=e,W3(e,i,n,t),e=X3(null,e,i,!0,s,t)):(e.tag=0,Fn&&s&&mD(e),Zr(null,e,r,t),e=e.child),e;case 16:i=e.elementType;e:{switch(wE(n,e),n=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=Fne(i),n=_a(i,n),r){case 0:e=K3(null,e,i,n,t);break e;case 1:e=tk(null,e,i,n,t);break e;case 11:e=J4(null,e,i,n,t);break e;case 14:e=ek(null,e,i,_a(i.type,n),t);break e}throw Error(De(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:_a(i,r),K3(n,e,i,r,t);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:_a(i,r),tk(n,e,i,r,t);case 3:e:{if(r7(e),n===null)throw Error(De(387));i=e.pendingProps,s=e.memoizedState,r=s.element,R$(n,e),pS(e,i,null,t);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=E0(Error(De(423)),e),e=nk(n,e,i,t,r);break e}else if(i!==r){r=E0(Error(De(424)),e),e=nk(n,e,i,t,r);break e}else for(ho=Nh(e.stateNode.containerInfo.firstChild),po=e,Fn=!0,Ra=null,t=C$(e,null,i,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(x0(),i===r){e=Jc(n,e,t);break e}Zr(n,e,i,t)}e=e.child}return e;case 5:return N$(e),n===null&&$3(e),i=e.type,r=e.pendingProps,s=n!==null?n.memoizedProps:null,o=r.children,k3(i,r)?o=null:s!==null&&k3(i,s)&&(e.flags|=32),i7(n,e),Zr(n,e,o,t),e.child;case 6:return n===null&&$3(e),null;case 13:return s7(n,e,t);case 4:return ED(e,e.stateNode.containerInfo),i=e.pendingProps,n===null?e.child=b0(e,null,i,t):Zr(n,e,i,t),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:_a(i,r),J4(n,e,i,r,t);case 7:return Zr(n,e,e.pendingProps,t),e.child;case 8:return Zr(n,e,e.pendingProps.children,t),e.child;case 12:return Zr(n,e,e.pendingProps.children,t),e.child;
vendor: 5,680 bytes, line 40
40case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,Pn(fS,i._currentValue),i._currentValue=o,s!==null)if(za(s.value,o)){if(s.children===r.children&&!Ds.current){e=Jc(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=Vc(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),G3(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(De(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),G3(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Zr(n,e,r.children,t),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,wg(e,t),r=oa(r),i=i(r),e.flags|=1,Zr(n,e,i,t),e.child;case 14:return i=e.type,r=_a(i,e.pendingProps),r=_a(i.type,r),ek(n,e,i,r,t);case 15:return t7(n,e,e.type,e.pendingProps,t);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:_a(i,r),wE(n,e),e.tag=1,Os(i)?(n=!0,cS(e)):n=!1,wg(e,t),Z$(e,i,r),W3(e,i,r,t),X3(null,e,i,!0,n,t);case 19:return o7(n,e,t);case 22:return n7(n,e,t)}throw Error(De(156,e.tag))};function _7(n,e){return X9(n,e)}function kne(n,e,t,i){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function na(n,e,t,i){return new kne(n,e,t,i)}function kD(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Fne(n){if(typeof n=="function")return kD(n)?1:0;if(n!=null){if(n=n.$$typeof,n===iD)return 11;if(n===rD)return 14}return 2}function Uh(n,e){var t=n.alternate;return t===null?(t=na(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function _E(n,e,t,i,r,s){var o=2;if(i=n,typeof n=="function")kD(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case km:return jd(t.children,r,s,e);case nD:o=8,r|=8;break;case g3:return n=na(12,t,e,r|2),n.elementType=g3,n.lanes=s,n;case y3:return n=na(13,t,e,r),n.elementType=y3,n.lanes=s,n;case v3:return n=na(19,t,e,r),n.elementType=v3,n.lanes=s,n;case N9:return BA(t,r,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case I9:o=10;break e;case R9:o=9;break e;case iD:o=11;break e;case rD:o=14;break e;case Yu:o=16,i=null;break e}throw Error(De(130,n==null?n:typeof n,""))}return e=na(o,t,e,r),e.elementType=n,e.type=i,e.lanes=s,e}function jd(n,e,t,i){return n=na(7,n,i,e),n.lanes=t,n}function BA(n,e,t,i){return n=na(22,n,i,e),n.elementType=N9,n.lanes=t,n.stateNode={isHidden:!1},n}function FT(n,e,t){return n=na(6,n,null,e),n.lanes=t,n}function zT(n,e,t){return e=na(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function zne(n,e,t,i,r){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=xT(0),this.expirationTimes=xT(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xT(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function FD(n,e,t,i,r,s,o,a,l){return n=new zne(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=na(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:i,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},_D(s),n}function Vne(n,e,t){var i=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Bm,key:i==null?null:""+i,children:n,containerInfo:e,implementation:t}}function E7(n){if(!n)return Hh;n=n._reactInternals;e:{if(xp(n)!==n||n.tag!==1)throw Error(De(170));var e=n;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Os(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(De(171))}if(n.tag===1){var t=n.type;if(Os(t))return E$(n,t,e)}return e}function S7(n,e,t,i,r,s,o,a,l){return n=FD(t,i,!0,n,r,s,o,a,l),n.context=E7(null),t=n.current,i=ss(),r=Lh(t),s=Vc(i,r),s.callback=e??null,Dh(t,s,r),n.current.lanes=r,D1(n,r,i),Ls(n,i),n}function kA(n,e,t,i){var r=e.current,s=ss(),o=Lh(r);return t=E7(t),e.context===null?e.context=t:e.pendingContext=t,e=Vc(s,o),e.payload={element:n},i=i===void 0?null:i,i!==null&&(e.callback=i),n=Dh(r,e,o),n!==null&&(ka(n,r,o,s),gE(n,r,o)),o}function _S(n){if(n=n.current,!n.child)return null;switch(n.child.tag){case 5:return n.child.stateNode;default:return n.child.stateNode}}function fk(n,e){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var t=n.retryLane;n.retryLane=t!==0&&t<e?t:e}}
vendor: 10,704 bytes, line 40
40function zD(n,e){fk(n,e),(n=n.alternate)&&fk(n,e)}function Hne(){return null}var A7=typeof reportError=="function"?reportError:function(n){console.error(n)};function VD(n){this._internalRoot=n}FA.prototype.render=VD.prototype.render=function(n){var e=this._internalRoot;if(e===null)throw Error(De(409));kA(n,e,null,null)};FA.prototype.unmount=VD.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var e=n.containerInfo;rp(function(){kA(null,n,null,null)}),e[Qc]=null}};function FA(n){this._internalRoot=n}FA.prototype.unstable_scheduleHydration=function(n){if(n){var e=n$();n={blockedOn:null,target:n,priority:e};for(var t=0;t<nh.length&&e!==0&&e<nh[t].priority;t++);nh.splice(t,0,n),t===0&&r$(n)}};function HD(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function zA(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11&&(n.nodeType!==8||n.nodeValue!==" react-mount-point-unstable "))}function dk(){}function $ne(n,e,t,i,r){if(r){if(typeof i=="function"){var s=i;i=function(){var c=_S(o);s.call(c)}}var o=S7(e,i,n,0,null,!1,!1,"",dk);return n._reactRootContainer=o,n[Qc]=o.current,vw(n.nodeType===8?n.parentNode:n),rp(),o}for(;r=n.lastChild;)n.removeChild(r);if(typeof i=="function"){var a=i;i=function(){var c=_S(l);a.call(c)}}var l=FD(n,0,!1,null,null,!1,!1,"",dk);return n._reactRootContainer=l,n[Qc]=l.current,vw(n.nodeType===8?n.parentNode:n),rp(function(){kA(e,l,t,i)}),l}function VA(n,e,t,i,r){var s=t._reactRootContainer;if(s){var o=s;if(typeof r=="function"){var a=r;r=function(){var l=_S(o);a.call(l)}}kA(e,o,n,r)}else o=$ne(t,e,n,r,i);return _S(o)}e$=function(n){switch(n.tag){case 3:var e=n.stateNode;if(e.current.memoizedState.isDehydrated){var t=bv(e.pendingLanes);t!==0&&(aD(e,t|1),Ls(e,fi()),!(Jt&6)&&(S0=fi()+500,tf()))}break;case 13:rp(function(){var i=Zc(n,1);if(i!==null){var r=ss();ka(i,n,1,r)}}),zD(n,1)}};lD=function(n){if(n.tag===13){var e=Zc(n,134217728);if(e!==null){var t=ss();ka(e,n,134217728,t)}zD(n,134217728)}};t$=function(n){if(n.tag===13){var e=Lh(n),t=Zc(n,e);if(t!==null){var i=ss();ka(t,n,e,i)}zD(n,e)}};n$=function(){return gn};i$=function(n,e){var t=gn;try{return gn=n,e()}finally{gn=t}};P3=function(n,e,t){switch(e){case"input":if(b3(n,t),e=t.name,t.type==="radio"&&e!=null){for(t=n;t.parentNode;)t=t.parentNode;for(t=t.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<t.length;e++){var i=t[e];if(i!==n&&i.form===n.form){var r=RA(i);if(!r)throw Error(De(90));O9(i),b3(i,r)}}}break;case"textarea":U9(n,t);break;case"select":e=t.value,e!=null&&mg(n,!!t.multiple,e,!1)}};$9=LD;G9=rp;var Gne={usingClientEntryPoint:!1,Events:[L1,Hm,RA,V9,H9,LD]},By={findFiberByHostInstance:ad,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},jne={bundleType:By.bundleType,version:By.version,rendererPackageName:By.rendererPackageName,rendererConfig:By.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:cu.ReactCurrentDispatcher,findHostInstanceByFiber:function(n){return n=q9(n),n===null?null:n.stateNode},findFiberByHostInstance:By.findFiberByHostInstance||Hne,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 Cb=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cb.isDisabled&&Cb.supportsFiber)try{TA=Cb.inject(jne),Nl=Cb}catch{}}xo.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Gne;xo.createPortal=function(n,e){var t=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!HD(e))throw Error(De(200));return Vne(n,e,null,t)};xo.createRoot=function(n,e){if(!HD(n))throw Error(De(299));var t=!1,i="",r=A7;return e!=null&&(e.unstable_strictMode===!0&&(t=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onRecoverableError!==void 0&&(r=e.onRecoverableError)),e=FD(n,1,!1,null,null,t,!1,i,r),n[Qc]=e.current,vw(n.nodeType===8?n.parentNode:n),new VD(e)};xo.findDOMNode=function(n){if(n==null)return null;if(n.nodeType===1)return n;var e=n._reactInternals;if(e===void 0)throw typeof n.render=="function"?Error(De(188)):(n=Object.keys(n).join(","),Error(De(268,n)));return n=q9(e),n=n===null?null:n.stateNode,n};xo.flushSync=function(n){return rp(n)};xo.hydrate=function(n,e,t){if(!zA(e))throw Error(De(200));return VA(null,n,e,!0,t)};xo.hydrateRoot=function(n,e,t){if(!HD(n))throw Error(De(405));var i=t!=null&&t.hydratedSources||null,r=!1,s="",o=A7;if(t!=null&&(t.unstable_strictMode===!0&&(r=!0),t.identifierPrefix!==void 0&&(s=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),e=S7(e,null,n,1,t??null,r,!1,s,o),n[Qc]=e.current,vw(n),i)for(n=0;n<i.length;n++)t=i[n],r=t._getVersion,r=r(t._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[t,r]:e.mutableSourceEagerHydrationData.push(t,r);return new FA(e)};xo.render=function(n,e,t){if(!zA(e))throw Error(De(200));return VA(null,n,e,!1,t)};xo.unmountComponentAtNode=function(n){if(!zA(n))throw Error(De(40));return n._reactRootContainer?(rp(function(){VA(null,null,n,!1,function(){n._reactRootContainer=null,n[Qc]=null})}),!0):!1};xo.unstable_batchedUpdates=LD;xo.unstable_renderSubtreeIntoContainer=function(n,e,t,i){if(!zA(t))throw Error(De(200));if(n==null||n._reactInternals===void 0)throw Error(De(38));return VA(n,e,t,!1,i)};xo.version="18.3.1-next-f1338f8080-20240426";function M7(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(M7)}catch(n){console.error(n)}}M7(),M9.exports=xo;var Wne=M9.exports,T7,pk=Wne;T7=pk.createRoot,pk.hydrateRoot;const P7=fe.createContext({});function qne(n){const e=fe.useRef(null);return e.current===null&&(e.current=n()),e.current}const $D=fe.createContext(null),C7=fe.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"});function Kne(n=!0){const e=fe.useContext($D);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:i,register:r}=e,s=fe.useId();fe.useEffect(()=>{n&&r(s)},[n]);const o=fe.useCallback(()=>n&&i&&i(s),[s,i,n]);return!t&&i?[!1,o]:[!0]}const GD=typeof window<"u",Xne=GD?fe.useLayoutEffect:fe.useEffect,mo=n=>n;let aI=mo;function jD(n){let e;return()=>(e===void 0&&(e=n()),e)}const A0=(n,e,t)=>{const i=e-n;return i===0?1:(t-n)/i},Hc=n=>n*1e3,$c=n=>n/1e3,Yne={skipAnimations:!1,useManualTiming:!1};function Qne(n){let e=new Set,t=new Set,i=!1,r=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(c){s.has(c)&&(l.schedule(c),n()),c(o)}const l={schedule:(c,u=!1,h=!1)=>{const m=h&&i?e:t;return u&&s.add(c),m.has(c)||m.add(c),c},cancel:c=>{t.delete(c),s.delete(c)},process:c=>{if(o=c,i){r=!0;return}i=!0,[e,t]=[t,e],e.forEach(a),e.clear(),i=!1,r&&(r=!1,l.process(c))}};return l}const Ib=["read","resolveKeyframes","update","preRender","render","postRender"],Zne=40;function I7(n,e){let t=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>t=!0,o=Ib.reduce((y,_)=>(y[_]=Qne(s),y),{}),{read:a,resolveKeyframes:l,update:c,preRender:u,render:h,postRender:f}=o,m=()=>{const y=performance.now();t=!1,r.delta=i?1e3/60:Math.max(Math.min(y-r.timestamp,Zne),1),r.timestamp=y,r.isProcessing=!0,a.process(r),l.process(r),c.process(r),u.process(r),h.process(r),f.process(r),r.isProcessing=!1,t&&e&&(i=!1,n(m))},g=()=>{t=!0,i=!0,r.isProcessing||n(m)};return{schedule:Ib.reduce((y,_)=>{const x=o[_];return y[_]=(S,M=!1,A=!1)=>(t||g(),x.schedule(S,M,A)),y},{}),cancel:y=>{for(let _=0;_<Ib.length;_++)o[Ib[_]].cancel(y)},state:r,steps:o}}const{schedule:Un,cancel:$h,state:cr,steps:VT}=I7(typeof requestAnimationFrame<"u"?requestAnimationFrame:mo,!0),R7=fe.createContext({strict:!1}),mk={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},M0={};for(const n in mk)M0[n]={isEnabled:e=>mk[n].some(t=>!!e[t])};function Jne(n){for(const e in n)M0[e]={...M0[e],...n[e]}}const eie=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function ES(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||eie.has(n)}let N7=n=>!ES(n);function tie(n){n&&(N7=e=>e.startsWith("on")?!ES(e):n(e))}try{tie(require("@emotion/is-prop-valid").default)}catch{}function nie(n,e,t){const i={};for(const r in n)r==="values"&&typeof n.values=="object"||(N7(r)||t===!0&&ES(r)||!e&&!ES(r)||n.draggable&&r.startsWith("onDrag"))&&(i[r]=n[r]);return i}function iie(n){if(typeof Proxy>"u")return n;const e=new Map,t=(...i)=>n(...i);return new Proxy(t,{get:(i,r)=>r==="create"?n:(e.has(r)||e.set(r,n(r)),e.get(r))})}const HA=fe.createContext({});function Tw(n){return typeof n=="string"||Array.isArray(n)}function $A(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const WD=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],qD=["initial",...WD];function GA(n){return $A(n.animate)||qD.some(e=>Tw(n[e]))}function D7(n){return!!(GA(n)||n.variants)}function rie(n,e){if(GA(n)){const{initial:t,animate:i}=n;return{initial:t===!1||Tw(t)?t:void 0,animate:Tw(i)?i:void 0}}return n.inherit!==!1?e:{}}function sie(n){const{initial:e,animate:t}=rie(n,fe.useContext(HA));return fe.useMemo(()=>({initial:e,animate:t}),[gk(e),gk(t)])}function gk(n){return Array.isArray(n)?n.join(" "):n}const oie=Symbol.for("motionComponentSymbol");function Xm(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}function aie(n,e,t){return fe.useCallback(i=>{i&&n.onMount&&n.onMount(i),e&&(i?e.mount(i):e.unmount()),t&&(typeof t=="function"?t(i):Xm(t)&&(t.current=i))},[e])}const KD=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),lie="framerAppearId",O7="data-"+KD(lie),{schedule:XD,c
vendor: 24,894 bytes, line 40
40ancel:uke}=I7(queueMicrotask,!1),L7=fe.createContext({});function cie(n,e,t,i,r){var s,o;const{visualElement:a}=fe.useContext(HA),l=fe.useContext(R7),c=fe.useContext($D),u=fe.useContext(C7).reducedMotion,h=fe.useRef(null);i=i||l.renderer,!h.current&&i&&(h.current=i(n,{visualState:e,parent:a,props:t,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u}));const f=h.current,m=fe.useContext(L7);f&&!f.projection&&r&&(f.type==="html"||f.type==="svg")&&uie(h.current,t,r,m);const g=fe.useRef(!1);fe.useInsertionEffect(()=>{f&&g.current&&f.update(t,c)});const v=t[O7],w=fe.useRef(!!v&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,v))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,v)));return Xne(()=>{f&&(g.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),XD.render(f.render),w.current&&f.animationState&&f.animationState.animateChanges())}),fe.useEffect(()=>{f&&(!w.current&&f.animationState&&f.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,v)}),w.current=!1))}),f}function uie(n,e,t,i){const{layoutId:r,layout:s,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c}=e;n.projection=new t(n.latestValues,e["data-framer-portal-id"]?void 0:U7(n.parent)),n.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!o||a&&Xm(a),visualElement:n,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,layoutScroll:l,layoutRoot:c})}function U7(n){if(n)return n.options.allowProjection!==!1?n.projection:U7(n.parent)}function hie({preloadedFeatures:n,createVisualElement:e,useRender:t,useVisualState:i,Component:r}){var s,o;n&&Jne(n);function a(c,u){let h;const f={...fe.useContext(C7),...c,layoutId:fie(c)},{isStatic:m}=f,g=sie(c),v=i(c,m);if(!m&&GD){die();const w=pie(f);h=w.MeasureLayout,g.visualElement=cie(r,v,f,e,w.ProjectionNode)}return j.jsxs(HA.Provider,{value:g,children:[h&&g.visualElement?j.jsx(h,{visualElement:g.visualElement,...f}):null,t(r,c,aie(v,g.visualElement,u),v,m,g.visualElement)]})}a.displayName=`motion.${typeof r=="string"?r:`create(${(o=(s=r.displayName)!==null&&s!==void 0?s:r.name)!==null&&o!==void 0?o:""})`}`;const l=fe.forwardRef(a);return l[oie]=r,l}function fie({layoutId:n}){const e=fe.useContext(P7).id;return e&&n!==void 0?e+"-"+n:n}function die(n,e){fe.useContext(R7).strict}function pie(n){const{drag:e,layout:t}=M0;if(!e&&!t)return{};const i={...e,...t};return{MeasureLayout:e!=null&&e.isEnabled(n)||t!=null&&t.isEnabled(n)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const mie=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function YD(n){return typeof n!="string"||n.includes("-")?!1:!!(mie.indexOf(n)>-1||/[A-Z]/u.test(n))}function yk(n){const e=[{},{}];return n==null||n.values.forEach((t,i)=>{e[0][i]=t.get(),e[1][i]=t.getVelocity()}),e}function QD(n,e,t,i){if(typeof e=="function"){const[r,s]=yk(i);e=e(t!==void 0?t:n.custom,r,s)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[r,s]=yk(i);e=e(t!==void 0?t:n.custom,r,s)}return e}const lI=n=>Array.isArray(n),gie=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),yie=n=>lI(n)?n[n.length-1]||0:n,Vr=n=>!!(n&&n.getVelocity);function EE(n){const e=Vr(n)?n.get():n;return gie(e)?e.toValue():e}function vie({scrapeMotionValuesFromProps:n,createRenderState:e,onUpdate:t},i,r,s){const o={latestValues:wie(i,r,s,n),renderState:e()};return t&&(o.onMount=a=>t({props:i,current:a,...o}),o.onUpdate=a=>t(a)),o}const B7=n=>(e,t)=>{const i=fe.useContext(HA),r=fe.useContext($D),s=()=>vie(n,e,i,r);return t?s():qne(s)};function wie(n,e,t,i){const r={},s=i(n,{});for(const f in s)r[f]=EE(s[f]);let{initial:o,animate:a}=n;const l=GA(n),c=D7(n);e&&c&&!l&&n.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=t?t.initial===!1:!1;u=u||o===!1;const h=u?a:o;if(h&&typeof h!="boolean"&&!$A(h)){const f=Array.isArray(h)?h:[h];for(let m=0;m<f.length;m++){const g=QD(n,f[m]);if(g){const{transitionEnd:v,transition:w,...y}=g;for(const _ in y){let x=y[_];if(Array.isArray(x)){const S=u?x.length-1:0;x=x[S]}x!==null&&(r[_]=x)}for(const _ in v)r[_]=v[_]}}}return r}const K0=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],bp=new Set(K0),k7=n=>e=>typeof e=="string"&&e.startsWith(n),F7=k7("--"),xie=k7("var(--"),ZD=n=>xie(n)?bie.test(n.split("/*")[0].trim()):!1,bie=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,z7=(n,e)=>e&&typeof n=="number"?e.transform(n):n,eu=(n,e,t)=>t>e?e:t<n?n:t,X0={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},Pw={...X0,transform:n=>eu(0,1,n)},Rb={...X0,default:1},B1=n=>({test:e=>typeof e=="string"&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Ku=B1("deg"),Ol=B1("%"),yt=B1("px"),_ie=B1("vh"),Eie=B1("vw"),vk={...Ol,parse:n=>Ol.parse(n)/100,transform:n=>Ol.transform(n*100)},Sie={borderWidth:yt,borderTopWidth:yt,borderRightWidth:yt,borderBottomWidth:yt,borderLeftWidth:yt,borderRadius:yt,radius:yt,borderTopLeftRadius:yt,borderTopRightRadius:yt,borderBottomRightRadius:yt,borderBottomLeftRadius:yt,width:yt,maxWidth:yt,height:yt,maxHeight:yt,top:yt,right:yt,bottom:yt,left:yt,padding:yt,paddingTop:yt,paddingRight:yt,paddingBottom:yt,paddingLeft:yt,margin:yt,marginTop:yt,marginRight:yt,marginBottom:yt,marginLeft:yt,backgroundPositionX:yt,backgroundPositionY:yt},Aie={rotate:Ku,rotateX:Ku,rotateY:Ku,rotateZ:Ku,scale:Rb,scaleX:Rb,scaleY:Rb,scaleZ:Rb,skew:Ku,skewX:Ku,skewY:Ku,distance:yt,translateX:yt,translateY:yt,translateZ:yt,x:yt,y:yt,z:yt,perspective:yt,transformPerspective:yt,opacity:Pw,originX:vk,originY:vk,originZ:yt},wk={...X0,transform:Math.round},JD={...Sie,...Aie,zIndex:wk,size:yt,fillOpacity:Pw,strokeOpacity:Pw,numOctaves:wk},Mie={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Tie=K0.length;function Pie(n,e,t){let i="",r=!0;for(let s=0;s<Tie;s++){const o=K0[s],a=n[o];if(a===void 0)continue;let l=!0;if(typeof a=="number"?l=a===(o.startsWith("scale")?1:0):l=parseFloat(a)===0,!l||t){const c=z7(a,JD[o]);if(!l){r=!1;const u=Mie[o]||o;i+=`${u}(${c}) `}t&&(e[o]=c)}}return i=i.trim(),t?i=t(e,r?"":i):r&&(i="none"),i}function eO(n,e,t){const{style:i,vars:r,transformOrigin:s}=n;let o=!1,a=!1;for(const l in e){const c=e[l];if(bp.has(l)){o=!0;continue}else if(F7(l)){r[l]=c;continue}else{const u=z7(c,JD[l]);l.startsWith("origin")?(a=!0,s[l]=u):i[l]=u}}if(e.transform||(o||t?i.transform=Pie(e,n.transform,t):i.transform&&(i.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:u=0}=s;i.transformOrigin=`${l} ${c} ${u}`}}const Cie={offset:"stroke-dashoffset",array:"stroke-dasharray"},Iie={offset:"strokeDashoffset",array:"strokeDasharray"};function Rie(n,e,t=1,i=0,r=!0){n.pathLength=1;const s=r?Cie:Iie;n[s.offset]=yt.transform(-i);const o=yt.transform(e),a=yt.transform(t);n[s.array]=`${o} ${a}`}function xk(n,e,t){return typeof n=="string"?n:yt.transform(e+t*n)}function Nie(n,e,t){const i=xk(e,n.x,n.width),r=xk(t,n.y,n.height);return`${i} ${r}`}function tO(n,{attrX:e,attrY:t,attrScale:i,originX:r,originY:s,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...c},u,h){if(eO(n,c,h),u){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:f,style:m,dimensions:g}=n;f.transform&&(g&&(m.transform=f.transform),delete f.transform),g&&(r!==void 0||s!==void 0||m.transform)&&(m.transformOrigin=Nie(g,r!==void 0?r:.5,s!==void 0?s:.5)),e!==void 0&&(f.x=e),t!==void 0&&(f.y=t),i!==void 0&&(f.scale=i),o!==void 0&&Rie(f,o,a,l,!1)}const nO=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),V7=()=>({...nO(),attrs:{}}),iO=n=>typeof n=="string"&&n.toLowerCase()==="svg";function H7(n,{style:e,vars:t},i,r){Object.assign(n.style,e,r&&r.getProjectionStyles(i));for(const s in t)n.style.setProperty(s,t[s])}const $7=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function G7(n,e,t,i){H7(n,e,void 0,i);for(const r in e.attrs)n.setAttribute($7.has(r)?r:KD(r),e.attrs[r])}const SS={};function Die(n){Object.assign(SS,n)}function j7(n,{layout:e,layoutId:t}){return bp.has(n)||n.startsWith("origin")||(e||t!==void 0)&&(!!SS[n]||n==="opacity")}function rO(n,e,t){var i;const{style:r}=n,s={};for(const o in r)(Vr(r[o])||e.style&&Vr(e.style[o])||j7(o,n)||((i=t==null?void 0:t.getValue(o))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(s[o]=r[o]);return s}function W7(n,e,t){const i=rO(n,e,t);for(const r in n)if(Vr(n[r])||Vr(e[r])){const s=K0.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=n[r]}return i}function Oie(n,e){try{e.dimensions=typeof n.getBBox=="function"?n.getBBox():n.getBoundingClientRect()}catch{e.dimensions={x:0,y:0,width:0,height:0}}}const bk=["x","y","width","height","cx","cy","r"],Lie={useVisualState:B7({scrapeMotionValuesFromProps:W7,createRenderState:V7,onUpdate:({props:n,prevProps:e,current:t,renderState:i,latestValues:r})=>{if(!t)return;let s=!!n.drag;if(!s){for(const a in r)if(bp.has(a)){s=!0;break}}if(!s)return;let o=!e;if(e)for(let a=0;a<bk.length;a++){const l=bk[a];n[l]!==e[l]&&(o=!0)}o&&Un.read(()=>{Oie(t,i),Un.render(()=>{tO(i,r,iO(t.tagName),n.transformTemplate),G7(t,i)})})}})},Uie={useVisualState:B7({scrapeMotionValuesFromProps:rO,createRenderState:nO})};function q7(n,e,t){for(const i in e)!Vr(e[i])&&!j7(i,t)&&(n[i]=e[i])}function Bie({transformTemplate:n},e){return fe.useMemo(()=>{const t=nO();return eO(t,e,n),Object.assign({},t.vars,t.style)},[e])}function kie(n,e){const t=n.style||{},i={};return q7(i,t,n),Object.assign(i,Bie(n,e)),i}function Fie(n,e){const t={},i=kie(n,e);return n.drag&&n.dragListener!==!1&&(t.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(t.tabIndex=0),t.style=i,t}function zie(n,e,t,i){const r=fe.useMemo(()=>{const s=V7();return tO(s,e,iO(i),n.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(n.style){const s={};q7(s,n.style,n),r.style={...s,...r.style}}return r}function Vie(n=!1){return(t,i,r,{latestValues:s},o)=>{const l=(YD(t)?zie:Fie)(i,s,o,t),c=nie(i,typeof t=="string",n),u=t!==fe.Fragment?{...c,...l,ref:r}:{},{children:h}=i,f=fe.useMemo(()=>Vr(h)?h.get():h,[h]);return fe.createElement(t,{...u,children:f})}}function Hie(n,e){return function(i,{forwardMotionProps:r}={forwardMotionProps:!1}){const o={...YD(i)?Lie:Uie,preloadedFeatures:n,useRender:Vie(r),createVisualElement:e,Component:i};return hie(o)}}function K7(n,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==n.length)return!1;for(let i=0;i<t;i++)if(e[i]!==n[i])return!1;return!0}function jA(n,e,t){const i=n.getProps();return QD(i,e,t!==void 0?t:i.custom,n)}const $ie=jD(()=>window.ScrollTimeline!==void 0);class Gie{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let i=0;i<this.animations.length;i++)this.animations[i][e]=t}attachTimeline(e,t){const i=this.animations.map(r=>{if($ie()&&r.attachTimeline)return r.attachTimeline(e);if(typeof t=="function")return t(r)});return()=>{i.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class jie extends Gie{then(e,t){return Promise.all(this.animations).then(e).catch(t)}}function sO(n,e){return n?n[e]||n.default||n:void 0}const cI=2e4;function X7(n){let e=0;const t=50;let i=n.next(e);for(;!i.done&&e<cI;)e+=t,i=n.next(e);return e>=cI?1/0:e}function oO(n){return typeof n=="function"}function _k(n,e){n.timeline=e,n.onfinish=null}const aO=n=>Array.isArray(n)&&typeof n[0]=="number",Wie={linearEasing:void 0};function qie(n,e){const t=jD(n);return()=>{var i;return(i=Wie[e])!==null&&i!==void 0?i:t()}}const AS=qie(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Y7=(n,e,t=10)=>{let i="";const r=Math.max(Math.round(e/t),2);for(let s=0;s<r;s++)i+=n(A0(0,r-1,s))+", ";return`linear(${i.substring(0,i.length-2)})`};function Q7(n){return!!(typeof n=="function"&&AS()||!n||typeof n=="string"&&(n in uI||AS())||aO(n)||Array.isArray(n)&&n.every(Q7))}const Ev=([n,e,t,i])=>`cubic-bezier(${n}, ${e}, ${t}, ${i})`,uI={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ev([0,.65,.55,1]),circOut:Ev([.55,0,1,.45]),backIn:Ev([.31,.01,.66,-.59]),backOut:Ev([.33,1.53,.69,.99])};function Z7(n,e){if(n)return typeof n=="function"&&AS()?Y7(n,e):aO(n)?Ev(n):Array.isArray(n)?n.map(t=>Z7(t,e)||uI.easeOut):uI[n]}const wa={x:!1,y:!1};function J7(){return wa.x||wa.y}function Kie(n,e,t){var i;if(n instanceof Element)return[n];if(typeof n=="string"){let r=document;const s=(i=void 0)!==null&&i!==void 0?i:r.querySelectorAll(n);return s?Array.from(s):[]}return Array.from(n)}function eG(n,e){const t=Kie(n),i=new AbortController,r={passive:!0,...e,signal:i.signal};return[t,r,()=>i.abort()]}function Ek(n){return e=>{e.pointerType==="touch"||J7()||n(e)}}function Xie(n,e,t={}){const[i,r,s]=eG(n,t),o=Ek(a=>{const{target:l}=a,c=e(a);if(typeof c!="function"||!l)return;const u=Ek(h=>{c(h),l.removeEventListener("pointerleave",u)});l.addEventListener("pointerleave",u,r)});return i.forEach(a=>{a.addEventListener("pointerenter",o,r)}),s}const tG=(n,e)=>e?n===e?!0:tG(n,e.parentElement):!1,lO=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1,Yie=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Qie(n){return Yie.has(n.tagName)||n.tabIndex!==-1}const Sv=new WeakSet;function Sk(n){return e=>{e.key==="Enter"&&n(e)}}function HT(n,e){n.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Zie=(n,e)=>{const t=n.currentTarget;if(!t)return;const i=Sk(()=>{if(Sv.has(t))return;HT(t,"down");const r=Sk(()=>{HT(t,"up")}),s=()=>HT(t,"cancel");t.addEventListener("keyup",r,e),t.addEventListener("blur",s,e)});t.addEventListener("keydown",i,e),t.addEventListener("blur",()=>t.removeEventListener("keydown",i),e)};function Ak(n){return lO(n)&&!J7()}function Jie(n,e,t={}){const[i,r,s]=eG(n,t),o=a=>{const l=a.currentTarget;if(!Ak(a)||Sv.has(l))return;Sv.add(l);const c=e(a),u=(m,g)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",f),!(!Ak(m)||!Sv.has(l))&&(Sv.delete(l),typeof c=="function"&&c(m,{success:g}))},h=m=>{u(m,t.useGlobalTarget||tG(l,m.target))},f=m=>{u(m,!1)};window.addEventListener("pointerup",h,r),window.addEventListener("pointercancel",f,r)};return i.forEach(a=>{!Qie(a)&&a.getAttribute("tabindex")===null&&(a.tabIndex=0),(t.useGlobalTarget?window:a).addEventListener("pointerdown",o,r),a.addEventListener("focus",c=>Zie(c,r),r)}),s}function ere(n){return n==="x"||n==="y"?wa[n]?null:(wa[n]=!0,()=>{wa[n]=!1}):wa.x||wa.y?null:(wa.x=wa.y=!0,()=>{wa.x=wa.y=!1})}const nG=new Set(["width","height","top","left","right","bottom",...K0]);let SE;function tre(){SE=void 0}const Ll={now:()=>(SE===void 0&&Ll.set(cr.isProcessing||Yne.useManualTiming?cr.timestamp:performance.now()),SE),set:n=>{SE=n,queueMicrotask(tre)}};function cO(n,e){n.indexOf(e)===-1&&n.push(e)}function uO(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}class hO{constructor(){this.subscriptions=[]}add(e){return cO(this.subscriptions,e),()=>uO(this.subscriptions,e)}notify(e,t,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,i);else for(let s=0;s<r;s++){const o=this.subscriptions[s];o&&o(e,t,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}function iG(n,e){return e?n*(1e3/e):0}const Mk=30,nre=n=>!isNaN(parseFloat(n));class ire{constructor(e,t={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,r=!0)=>{const s=Ll.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),r&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Ll.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=nre(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new hO);const i=this.events[e].add(t);return e==="change"?()=>{i(),Un.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){!t||!this.passiveEffect?this.updateAndNotify(e,t):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,t,i){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Ll.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Mk)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,Mk);return iG(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Cw(n,e){return new ire(n,e)}function rre(n,e,t){n.hasValue(e)?n.getValue(e).set(t):n.addValue(e,Cw(t))}function sre(n,e){const t=jA(n,e);let{transitionEnd:i={},transition:r={},...s}=t||{};s={...s,...i};for(const o in s){const a=yie(s[o]);rre(n,o,a)}}function ore(n){return!!(Vr(n)&&n.add)}function hI(n,e){const t=n.getValue("willChange");if(ore(t))return t.add(e)}function rG(n){return n.props[O7]}const sG=(n,e,t)=>(((1-3*t+3*e)*n+(3*t-6*e))*n+3*e)*n,are=1e-7,lre=12;function cre(n,e,t,i,r){let s,o,a=0;do o=e+(t-e)/2,s=sG(o,i,r)-n,s>0?t=o:e=o;while(Math.abs(s)>are&&++a<lre);return o}function k1(n,e,t,i){if(n===e&&t===i)return mo;const r=s=>cre(s,0,1,n,t);return s=>s===0||s===1?s:sG(r(s),e,i)}const oG=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,aG=n=>e=>1-n(1-e),lG=k1(.33,1.53,.69,.99),fO=aG(lG),cG=oG(fO),uG=n=>(n*=2)<1?.5*fO(n):.5*(2-Math.pow(2,-10*(n-1))),dO=n=>1-Math.sin(Math.acos(n)),hG=aG(dO),fG=oG(dO),dG=n=>/^0[^.\s]+$/u.test(n);function ure(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||dG(n):!0}const Wv=n=>Math.round(n*1e5)/1e5,pO=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function hre(n){return n==null}const fre=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,mO=(n,e)=>t=>!!(typeof t=="string"&&fre.test(t)&&t.startsWith(n)||e&&!hre(t)&&Object.prototype.hasOwnProperty.call(t,e)),pG=(n,e,t)=>i=>{if(typeof i!="string")return i;const[r,s,o,a]=i.match(pO);return{[n]:parseFloat(r),[e]:parseFloat(s),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},dre=n=>eu(0,255,n),$T={...X0,transform:n=>Math.round(dre(n))},ud={test:mO("rgb","red"),parse:pG("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:i=1})=>"rgba("+$T.transform(n)+", "+$T.transform(e)+", "+$T.transform(t)+", "+Wv(Pw.transform(i))+")"};function pre(n){let e="",t="",i="",r="";return n.length>5?(e=n.substring(1,3),t=n.substring(3,5),i=n.substring(5,7),r=n.substring(7,9)):(e=n.substring(1,2),t=n.substring(2,3),i=n.substring(3,4),r=n.substring(4,5),e+=e,t+=t,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const fI={test:mO("#"),parse:pre,transform:ud.transform},Ym={test:mO("hsl","hue"),parse:pG("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:i=1})=>"hsla("+Math.round(n)+", "+Ol.transform(Wv(e))+", "+Ol.transform(Wv(t))+", "+Wv(Pw.transform(i))+")"},Ur={test:n=>ud.test(n)||fI.test(n)||Ym.test(n),parse:n=>ud.test(n)?ud.parse(n):Ym.test(n)?Ym.parse(n):fI.parse(n),transform:n=>typeof n=="string"?n:n.hasOwnProperty("red")?ud.transform(n):Ym.transform(n)},mre=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function gre(n){var e,t;return isNaN(n)&&typeof n=="string"&&(((e=n.match(pO))===null||e===void 0?void 0:e.length)||0)+(((t=n.match(mre))===null||t===void 0?void 0:t.length)||0)>0}const mG="number",gG="color",yre="var",vre="var(",Tk="${}",wre=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Iw(n){const e=n.toString(),t=[],i={color:[],number:[],var:[]},r=[];let s=0;const a=e.replace(wre,l=>(Ur.test(l)?(i.color.push(s),r.push(gG),t.push(Ur.parse(l))):l.startsWith(vre)?(i.var.push(s),r.push(yre),t.push(l)):(i.number.push(s),r.push(mG),t.push(parseFloat(l))),++s,Tk)).split(Tk);return{values:t,split:a,indexes:i,types:r}}function yG(n){return Iw(n).values}function vG(n){const{split:e,types:t}=Iw(n),i=e.length;return r=>{let s="";for(let o=0;o<i;o++)if(s+=e[o],r[o]!==void 0){const a=t[o];a===mG?s+=Wv(r[o]):a===gG?s+=Ur.transform(r[o]):s+=r[o]}return s}}const xre=n=>typeof n=="number"?0:n;function bre(n){const e=yG(n);return vG(n)(e.map(xre))}const Gh={test:gre,parse:yG,createTransformer:vG,getAnimatableNone:bre},_re=new Set(["brightness","contrast","saturate","opacity"]);function Ere(n){const[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[i]=t.match(pO)||[];if(!i)return n;const r=t.replace(i,"");let s=_re.has(e)?1:0;return i!==t&&(s*=100),e+"("+s+r+")"}const Sre=/\b([a-z-]*)\(.*?\)/gu,dI={...Gh,getAnimatableNone:n=>{const e=n.match(Sre);return e?e.map(Ere).join(" "):n}},Are={...JD,color:Ur,backgroundColor:Ur,outlineColor:Ur,fill:Ur,stroke:Ur,borderColor:Ur,borderTopColor:Ur,borderRightColor:Ur,borderBottomColor:Ur,borderLeftColor:Ur,filter:dI,WebkitFilter:dI},gO=n=>Are[n];function wG(n,e){let t=gO(n);return t!==dI&&(t=Gh),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const Mre=new Set(["auto","none","0"]);function Tre(n,e,t){let i=0,r;for(;i<n.length&&!r;){const s=n[i];typeof s=="string"&&!Mre.has(s)&&Iw(s).values.length&&(r=n[i]),i++}if(r&&t)for(const s of e)n[s]=wG(t,r)}const Pk=n=>n===X0||n===yt,Ck=(n,e)=>parseFloat(n.split(", ")[e]),Ik=(n,e)=>(t,{transform:i})=>{if(i==="none"||!i)return 0;const r=i.match(/^matrix3d\((.+)\)$/u);if(r)return Ck(r[1],e);{const s=i.match(/^matrix\((.+)\)$/u);return s?Ck(s[1],n):0}},Pre=new Set(["x","y","z"]),Cre=K0.filter(n=>!Pre.has(n));function Ire(n){const e=[];return Cre.forEach(t=>{const i=n.getValue(t);i!==void 0&&(e.push([t,i.get()]),i.set(t.startsWith("scale")?1:0))}),e}const T0={width:({x:n},{paddingLeft:e="0",paddingRight:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),height:({y:n},{paddingTop:e="0",paddingBottom:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:Ik(4,13),y:Ik(5,14)};T0.translateX=T0.x;T0.translateY=T0.y;const Wd=new Set;let pI=!1,mI=!1;function xG(){if(mI){const n=Array.from(Wd).filter(i=>i.needsMeasurement),e=new Set(n.map(i=>i.element)),t=new Map;e.forEach(i=>
vendor: 4,774 bytes, line 40
40{const r=Ire(i);r.length&&(t.set(i,r),i.render())}),n.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const r=t.get(i);r&&r.forEach(([s,o])=>{var a;(a=i.getValue(s))===null||a===void 0||a.set(o)})}),n.forEach(i=>i.measureEndState()),n.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}mI=!1,pI=!1,Wd.forEach(n=>n.complete()),Wd.clear()}function bG(){Wd.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(mI=!0)})}function Rre(){bG(),xG()}class yO{constructor(e,t,i,r,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=i,this.motionValue=r,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(Wd.add(this),pI||(pI=!0,Un.read(bG),Un.resolveKeyframes(xG))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:i,motionValue:r}=this;for(let s=0;s<e.length;s++)if(e[s]===null)if(s===0){const o=r==null?void 0:r.get(),a=e[e.length-1];if(o!==void 0)e[0]=o;else if(i&&t){const l=i.readValue(t,a);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=a),r&&o===void 0&&r.set(e[0])}else e[s]=e[s-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),Wd.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,Wd.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const _G=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),Nre=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Dre(n){const e=Nre.exec(n);if(!e)return[,];const[,t,i,r]=e;return[`--${t??i}`,r]}function EG(n,e,t=1){const[i,r]=Dre(n);if(!i)return;const s=window.getComputedStyle(e).getPropertyValue(i);if(s){const o=s.trim();return _G(o)?parseFloat(o):o}return ZD(r)?EG(r,e,t+1):r}const SG=n=>e=>e.test(n),Ore={test:n=>n==="auto",parse:n=>n},AG=[X0,yt,Ol,Ku,Eie,_ie,Ore],Rk=n=>AG.find(SG(n));class MG extends yO{constructor(e,t,i,r,s){super(e,t,i,r,s,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:i}=this;if(!t||!t.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let c=e[l];if(typeof c=="string"&&(c=c.trim(),ZD(c))){const u=EG(c,t.current);u!==void 0&&(e[l]=u),l===e.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!nG.has(i)||e.length!==2)return;const[r,s]=e,o=Rk(r),a=Rk(s);if(o!==a)if(Pk(o)&&Pk(a))for(let l=0;l<e.length;l++){const c=e[l];typeof c=="string"&&(e[l]=parseFloat(c))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,i=[];for(let r=0;r<e.length;r++)ure(e[r])&&i.push(r);i.length&&Tre(e,i,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=T0[i](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const r=t[t.length-1];r!==void 0&&e.getValue(i,r).jump(r,!1)}measureEndState(){var e;const{element:t,name:i,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const s=t.getValue(i);s&&s.jump(this.measuredOrigin,!1);const o=r.length-1,a=r[o];r[o]=T0[i](t.measureViewportBox(),window.getComputedStyle(t.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}const Nk=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(Gh.test(n)||n==="0")&&!n.startsWith("url("));function Lre(n){const e=n[0];if(n.length===1)return!0;for(let t=0;t<n.length;t++)if(n[t]!==e)return!0}function Ure(n,e,t,i){const r=n[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const s=n[n.length-1],o=Nk(r,e),a=Nk(s,e);return!o||!a?!1:Lre(n)||(t==="spring"||oO(t))&&i}const Bre=n=>n!==null;function WA(n,{repeat:e,repeatType:t="loop"},i){const r=n.filter(Bre),s=e&&t!=="loop"&&e%2===1?0:r.length-1;return!s||i===void 0?r[s]:i}const kre=40;class TG{constructor({autoplay:e=!0,delay:t=0,type:i="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=Ll.now(),this.options={autoplay:e,delay:t,type:i,repeat:r,repeatDelay:s,repeatType:o,...a},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt?this.resolvedAt-this.createdAt>kre?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&Rre(),this._resolved}onKeyframesResolved(e,t){this.resolvedAt=Ll.now(),this.hasAttemptedResolve=!0;const{name:i,type:r,velocity:s,delay:o,onComplete:a,onUpdate:l,isGenerator:c}=this.options;
vendor: 5,083 bytes, line 40
40if(!c&&!Ure(e,i,r,s))if(o)this.options.duration=0;else{l&&l(WA(e,this.options,t)),a&&a(),this.resolveFinishedPromise();return}const u=this.initPlayback(e,t);u!==!1&&(this._resolved={keyframes:e,finalKeyframe:t,...u},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const Wn=(n,e,t)=>n+(e-n)*t;function GT(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function Fre({hue:n,saturation:e,lightness:t,alpha:i}){n/=360,e/=100,t/=100;let r=0,s=0,o=0;if(!e)r=s=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=GT(l,a,n+1/3),s=GT(l,a,n),o=GT(l,a,n-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:i}}function MS(n,e){return t=>t>0?e:n}const jT=(n,e,t)=>{const i=n*n,r=t*(e*e-i)+i;return r<0?0:Math.sqrt(r)},zre=[fI,ud,Ym],Vre=n=>zre.find(e=>e.test(n));function Dk(n){const e=Vre(n);if(!e)return!1;let t=e.parse(n);return e===Ym&&(t=Fre(t)),t}const Ok=(n,e)=>{const t=Dk(n),i=Dk(e);if(!t||!i)return MS(n,e);const r={...t};return s=>(r.red=jT(t.red,i.red,s),r.green=jT(t.green,i.green,s),r.blue=jT(t.blue,i.blue,s),r.alpha=Wn(t.alpha,i.alpha,s),ud.transform(r))},Hre=(n,e)=>t=>e(n(t)),F1=(...n)=>n.reduce(Hre),gI=new Set(["none","hidden"]);function $re(n,e){return gI.has(n)?t=>t<=0?n:e:t=>t>=1?e:n}function Gre(n,e){return t=>Wn(n,e,t)}function vO(n){return typeof n=="number"?Gre:typeof n=="string"?ZD(n)?MS:Ur.test(n)?Ok:qre:Array.isArray(n)?PG:typeof n=="object"?Ur.test(n)?Ok:jre:MS}function PG(n,e){const t=[...n],i=t.length,r=n.map((s,o)=>vO(s)(s,e[o]));return s=>{for(let o=0;o<i;o++)t[o]=r[o](s);return t}}function jre(n,e){const t={...n,...e},i={};for(const r in t)n[r]!==void 0&&e[r]!==void 0&&(i[r]=vO(n[r])(n[r],e[r]));return r=>{for(const s in i)t[s]=i[s](r);return t}}function Wre(n,e){var t;const i=[],r={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const o=e.types[s],a=n.indexes[o][r[o]],l=(t=n.values[a])!==null&&t!==void 0?t:0;i[s]=l,r[o]++}return i}const qre=(n,e)=>{const t=Gh.createTransformer(e),i=Iw(n),r=Iw(e);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?gI.has(n)&&!r.values.length||gI.has(e)&&!i.values.length?$re(n,e):F1(PG(Wre(i,r),r.values),t):MS(n,e)};function CG(n,e,t){return typeof n=="number"&&typeof e=="number"&&typeof t=="number"?Wn(n,e,t):vO(n)(n,e)}const Kre=5;function IG(n,e,t){const i=Math.max(e-Kre,0);return iG(t-n(i),e-i)}const ei={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},WT=.001;function Xre({duration:n=ei.duration,bounce:e=ei.bounce,velocity:t=ei.velocity,mass:i=ei.mass}){let r,s,o=1-e;o=eu(ei.minDamping,ei.maxDamping,o),n=eu(ei.minDuration,ei.maxDuration,$c(n)),o<1?(r=c=>{const u=c*o,h=u*n,f=u-t,m=yI(c,o),g=Math.exp(-h);return WT-f/m*g},s=c=>{const h=c*o*n,f=h*t+t,m=Math.pow(o,2)*Math.pow(c,2)*n,g=Math.exp(-h),v=yI(Math.pow(c,2),o);return(-r(c)+WT>0?-1:1)*((f-m)*g)/v}):(r=c=>{const u=Math.exp(-c*n),h=(c-t)*n+1;return-WT+u*h},s=c=>{const u=Math.exp(-c*n),h=(t-c)*(n*n);return u*h});const a=5/n,l=Qre(r,s,a);if(n=Hc(n),isNaN(l))return{stiffness:ei.stiffness,damping:ei.damping,duration:n};{const c=Math.pow(l,2)*i;return{stiffness:c,damping:o*2*Math.sqrt(i*c),duration:n}}}const Yre=12;function Qre(n,e,t){let i=t;for(let r=1;r<Yre;r++)i=i-n(i)/e(i);return i}function yI(n,e){return n*Math.sqrt(1-e*e)}const Zre=["duration","bounce"],Jre=["stiffness","damping","mass"];function Lk(n,e){return e.some(t=>n[t]!==void 0)}function ese(n){let e={velocity:ei.velocity,stiffness:ei.stiffness,damping:ei.damping,mass:ei.mass,isResolvedFromDuration:!1,...n};if(!Lk(n,Jre)&&Lk(n,Zre))if(n.visualDuration){const t=n.visualDuration,i=2*Math.PI/(t*1.2),r=i*i,s=2*eu(.05,1,1-(n.bounce||0))*Math.sqrt(r);e={...e,mass:ei.mass,stiffness:r,damping:s}}else{const t=Xre(n);e={...e,...t,mass:ei.mass},e.isResolvedFromDuration=!0}return e}function RG(n=ei.visualDuration,e=ei.bounce){const t=typeof n!="object"?{visualDuration:n,keyframes:[0,1],bounce:e}:n;let{restSpeed:i,restDelta:r}=t;const s=t.keyframes[0],o=t.keyframes[t.keyframes.length-1],a={done:!1,value:s},{stiffness:l,damping:c,mass:u,duration:h,velocity:f,isResolvedFromDuration:m}=ese({...t,velocity:-$c(t.velocity||0)}),g=f||0,v=c/(2*Math.sqrt(l*u)),w=o-s,y=$c(Math.sqrt(l/u)),_=Math.abs(w)<5;i||(i=_?ei.restSpeed.granular:ei.restSpeed.default),r||(r=_?ei.restDelta.granular:ei.restDelta.default);let x;if(v<1){const M=yI(y,v);x=A=>{const I=Math.exp(-v*y*A);return o-I*((g+v*y*w)/M*Math.sin(M*A)+w*Math.cos(M*A))}}else if(v===1)x=M=>o-Math.exp(-y*M)*(w+(g+y*w)*M);else{const M=y*Math.sqrt(v*v-1);x=A=>{const I=Math.exp(-v*y*A),D=Math.min(M*A,300);return o-I*((g+v*y*w)*Math.sinh(D)+M*w*Math.cosh(D))/M}}
vendor: 5,522 bytes, line 40
40const S={calculatedDuration:m&&h||null,next:M=>{const A=x(M);if(m)a.done=M>=h;else{let I=0;v<1&&(I=M===0?Hc(g):IG(x,M,A));const D=Math.abs(I)<=i,k=Math.abs(o-A)<=r;a.done=D&&k}return a.value=a.done?o:A,a},toString:()=>{const M=Math.min(X7(S),cI),A=Y7(I=>S.next(M*I).value,M,30);return M+"ms "+A}};return S}function Uk({keyframes:n,velocity:e=0,power:t=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const h=n[0],f={done:!1,value:h},m=D=>a!==void 0&&D<a||l!==void 0&&D>l,g=D=>a===void 0?l:l===void 0||Math.abs(a-D)<Math.abs(l-D)?a:l;let v=t*e;const w=h+v,y=o===void 0?w:o(w);y!==w&&(v=y-h);const _=D=>-v*Math.exp(-D/i),x=D=>y+_(D),S=D=>{const k=_(D),C=x(D);f.done=Math.abs(k)<=c,f.value=f.done?y:C};let M,A;const I=D=>{m(f.value)&&(M=D,A=RG({keyframes:[f.value,g(f.value)],velocity:IG(x,D,f.value),damping:r,stiffness:s,restDelta:c,restSpeed:u}))};return I(0),{calculatedDuration:null,next:D=>{let k=!1;return!A&&M===void 0&&(k=!0,S(D),I(D)),M!==void 0&&D>=M?A.next(D-M):(!k&&S(D),f)}}}const tse=k1(.42,0,1,1),nse=k1(0,0,.58,1),NG=k1(.42,0,.58,1),ise=n=>Array.isArray(n)&&typeof n[0]!="number",Bk={linear:mo,easeIn:tse,easeInOut:NG,easeOut:nse,circIn:dO,circInOut:fG,circOut:hG,backIn:fO,backInOut:cG,backOut:lG,anticipate:uG},kk=n=>{if(aO(n)){aI(n.length===4);const[e,t,i,r]=n;return k1(e,t,i,r)}else if(typeof n=="string")return aI(Bk[n]!==void 0),Bk[n];return n};function rse(n,e,t){const i=[],r=t||CG,s=n.length-1;for(let o=0;o<s;o++){let a=r(n[o],n[o+1]);if(e){const l=Array.isArray(e)?e[o]||mo:e;a=F1(l,a)}i.push(a)}return i}function sse(n,e,{clamp:t=!0,ease:i,mixer:r}={}){const s=n.length;if(aI(s===e.length),s===1)return()=>e[0];if(s===2&&e[0]===e[1])return()=>e[1];const o=n[0]===n[1];n[0]>n[s-1]&&(n=[...n].reverse(),e=[...e].reverse());const a=rse(e,i,r),l=a.length,c=u=>{if(o&&u<n[0])return e[0];let h=0;if(l>1)for(;h<n.length-2&&!(u<n[h+1]);h++);const f=A0(n[h],n[h+1],u);return a[h](f)};return t?u=>c(eu(n[0],n[s-1],u)):c}function ose(n,e){const t=n[n.length-1];for(let i=1;i<=e;i++){const r=A0(0,e,i);n.push(Wn(t,1,r))}}function ase(n){const e=[0];return ose(e,n.length-1),e}function lse(n,e){return n.map(t=>t*e)}function cse(n,e){return n.map(()=>e||NG).splice(0,n.length-1)}function TS({duration:n=300,keyframes:e,times:t,ease:i="easeInOut"}){const r=ise(i)?i.map(kk):kk(i),s={done:!1,value:e[0]},o=lse(t&&t.length===e.length?t:ase(e),n),a=sse(o,e,{ease:Array.isArray(r)?r:cse(e,r)});return{calculatedDuration:n,next:l=>(s.value=a(l),s.done=l>=n,s)}}const use=n=>{const e=({timestamp:t})=>n(t);return{start:()=>Un.update(e,!0),stop:()=>$h(e),now:()=>cr.isProcessing?cr.timestamp:Ll.now()}},hse={decay:Uk,inertia:Uk,tween:TS,keyframes:TS,spring:RG},fse=n=>n/100;class wO extends TG{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:l}=this.options;l&&l()};const{name:t,motionValue:i,element:r,keyframes:s}=this.options,o=(r==null?void 0:r.KeyframeResolver)||yO,a=(l,c)=>this.onKeyframesResolved(l,c);this.resolver=new o(s,a,t,i,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const{type:t="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:o=0}=this.options,a=oO(t)?t:hse[t]||TS;let l,c;a!==TS&&typeof e[0]!="number"&&(l=F1(fse,CG(e[0],e[1])),e=[0,100]);const u=a({...this.options,keyframes:e});s==="mirror"&&(c=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=X7(u));const{calculatedDuration:h}=u,f=h+r,m=f*(i+1)-r;return{generator:u,mirroredGenerator:c,mapPercentToKeyframes:l,calculatedDuration:h,resolvedDuration:f,totalDuration:m}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,t=!1){const{resolved:i}=this;if(!i){const{keyframes:D}=this.options;return{done:!0,value:D[D.length-1]}}const{finalKeyframe:r,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:c,totalDuration:u,resolvedDuration:h}=i;if(this.startTime===null)return s.next(0);const{delay:f,repeat:m,repeatType:g,repeatDelay:v,onUpdate:w}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-u/this.speed,this.startTime)),t?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const y=this.currentTime-f*(this.speed>=0?1:-1),_=this.speed>=0?y<0:y>u;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=u);let x=this.currentTime,S=s;if(m){const D=Math.min(this.currentTime,u)/h;let k=Math.floor(D),C=D%1;!C&&D>=1&&(C=1),C===1&&k--,k=Math.min(k,m+1),!!(k%2)&&(g==="reverse"?(C=1-C,v&&(C-=v/h)):g==="mirror"&&(S=o)),x=eu(0,1,C)*h}const M=_?{done:!1,value:l[0]}:S.next(x);a&&(M.value=a(M.value));let{done:A}=M;!_&&c!==null&&(A=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const I=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return I&&r!==void 0&&(M.value=WA(l,this.options,r)),w&&w(M.value),I&&this.finish(),M}get duration(){const{resolved:e}=this;return e?$c(e.calculatedDuration):0}
vendor: 58,802 bytes, line 40
40get time(){return $c(this.currentTime)}set time(e){e=Hc(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=$c(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=use,onPlay:t,startTime:i}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),t&&t();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=r):this.startTime=i??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const dse=new Set(["opacity","clipPath","filter","transform"]);function pse(n,e,t,{delay:i=0,duration:r=300,repeat:s=0,repeatType:o="loop",ease:a="easeInOut",times:l}={}){const c={[e]:t};l&&(c.offset=l);const u=Z7(a,r);return Array.isArray(u)&&(c.easing=u),n.animate(c,{delay:i,duration:r,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}const mse=jD(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),PS=10,gse=2e4;function yse(n){return oO(n.type)||n.type==="spring"||!Q7(n.ease)}function vse(n,e){const t=new wO({...e,keyframes:n,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:n[0]};const r=[];let s=0;for(;!i.done&&s<gse;)i=t.sample(s),r.push(i.value),s+=PS;return{times:void 0,keyframes:r,duration:s-PS,ease:"linear"}}const DG={anticipate:uG,backInOut:cG,circInOut:fG};function wse(n){return n in DG}class Fk extends TG{constructor(e){super(e);const{name:t,motionValue:i,element:r,keyframes:s}=this.options;this.resolver=new MG(s,(o,a)=>this.onKeyframesResolved(o,a),t,i,r),this.resolver.scheduleResolve()}initPlayback(e,t){let{duration:i=300,times:r,ease:s,type:o,motionValue:a,name:l,startTime:c}=this.options;if(!a.owner||!a.owner.current)return!1;if(typeof s=="string"&&AS()&&wse(s)&&(s=DG[s]),yse(this.options)){const{onComplete:h,onUpdate:f,motionValue:m,element:g,...v}=this.options,w=vse(e,v);e=w.keyframes,e.length===1&&(e[1]=e[0]),i=w.duration,r=w.times,s=w.ease,o="keyframes"}const u=pse(a.owner.current,l,e,{...this.options,duration:i,times:r,ease:s});return u.startTime=c??this.calcStartTime(),this.pendingTimeline?(_k(u,this.pendingTimeline),this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:h}=this.options;a.set(WA(e,this.options,t)),h&&h(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:i,times:r,type:o,ease:s,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:t}=e;return $c(t)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:t}=e;return $c(t.currentTime||0)}set time(e){const{resolved:t}=this;if(!t)return;const{animation:i}=t;i.currentTime=Hc(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:t}=e;return t.playbackRate}set speed(e){const{resolved:t}=this;if(!t)return;const{animation:i}=t;i.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:t}=e;return t.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:t}=e;return t.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:t}=this;if(!t)return mo;const{animation:i}=t;_k(i,e)}return mo}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.playState==="finished"&&this.updateFinishedPromise(),t.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:t,keyframes:i,duration:r,type:s,ease:o,times:a}=e;if(t.playState==="idle"||t.playState==="finished")return;if(this.time){const{motionValue:c,onUpdate:u,onComplete:h,element:f,...m}=this.options,g=new wO({...m,keyframes:i,duration:r,type:s,ease:o,times:a,isGenerator:!0}),v=Hc(this.time);c.setWithVelocity(g.sample(v-PS).value,g.sample(v).value,PS)}const{onStop:l}=this.options;l&&l(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:t,name:i,repeatDelay:r,repeatType:s,damping:o,type:a}=e;if(!t||!t.owner||!(t.owner.current instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=t.owner.getProps();return mse()&&i&&dse.has(i)&&!l&&!c&&!r&&s!=="mirror"&&o!==0&&a!=="inertia"}}const xse={type:"spring",stiffness:500,damping:25,restSpeed:10},bse=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),_se={type:"keyframes",duration:.8},Ese={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Sse=(n,{keyframes:e})=>e.length>2?_se:bp.has(n)?n.startsWith("scale")?bse(e[1]):xse:Ese;function Ase({when:n,delay:e,delayChildren:t,staggerChildren:i,staggerDirection:r,repeat:s,repeatType:o,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length}const xO=(n,e,t,i={},r,s)=>o=>{const a=sO(i,n)||{},l=a.delay||i.delay||0;let{elapsed:c=0}=i;c=c-Hc(l);let u={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:f=>{e.set(f),a.onUpdate&&a.onUpdate(f)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:n,motionValue:e,element:s?void 0:r};Ase(a)||(u={...u,...Sse(n,u)}),u.duration&&(u.duration=Hc(u.duration)),u.repeatDelay&&(u.repeatDelay=Hc(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(h=!0)),h&&!s&&e.get()!==void 0){const f=WA(u.keyframes,a);if(f!==void 0)return Un.update(()=>{u.onUpdate(f),u.onComplete()}),new jie([])}return!s&&Fk.supports(u)?new Fk(u):new wO(u)};function Mse({protectedKeys:n,needsAnimating:e},t){const i=n.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,i}function OG(n,e,{delay:t=0,transitionOverride:i,type:r}={}){var s;let{transition:o=n.getDefaultTransition(),transitionEnd:a,...l}=e;i&&(o=i);const c=[],u=r&&n.animationState&&n.animationState.getState()[r];for(const h in l){const f=n.getValue(h,(s=n.latestValues[h])!==null&&s!==void 0?s:null),m=l[h];if(m===void 0||u&&Mse(u,h))continue;const g={delay:t,...sO(o||{},h)};let v=!1;if(window.MotionHandoffAnimation){const y=rG(n);if(y){const _=window.MotionHandoffAnimation(y,h,Un);_!==null&&(g.startTime=_,v=!0)}}hI(n,h),f.start(xO(h,f,m,n.shouldReduceMotion&&nG.has(h)?{type:!1}:g,n,v));const w=f.animation;w&&c.push(w)}return a&&Promise.all(c).then(()=>{Un.update(()=>{a&&sre(n,a)})}),c}function vI(n,e,t={}){var i;const r=jA(n,e,t.type==="exit"?(i=n.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:s=n.getDefaultTransition()||{}}=r||{};t.transitionOverride&&(s=t.transitionOverride);const o=r?()=>Promise.all(OG(n,r,t)):()=>Promise.resolve(),a=n.variantChildren&&n.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:h,staggerDirection:f}=s;return Tse(n,e,u+c,h,f,t)}:()=>Promise.resolve(),{when:l}=s;if(l){const[c,u]=l==="beforeChildren"?[o,a]:[a,o];return c().then(()=>u())}else return Promise.all([o(),a(t.delay)])}function Tse(n,e,t=0,i=0,r=1,s){const o=[],a=(n.variantChildren.size-1)*i,l=r===1?(c=0)=>c*i:(c=0)=>a-c*i;return Array.from(n.variantChildren).sort(Pse).forEach((c,u)=>{c.notify("AnimationStart",e),o.push(vI(c,e,{...s,delay:t+l(u)}).then(()=>c.notify("AnimationComplete",e)))}),Promise.all(o)}function Pse(n,e){return n.sortNodePosition(e)}function Cse(n,e,t={}){n.notify("AnimationStart",e);let i;if(Array.isArray(e)){const r=e.map(s=>vI(n,s,t));i=Promise.all(r)}else if(typeof e=="string")i=vI(n,e,t);else{const r=typeof e=="function"?jA(n,e,t.custom):e;i=Promise.all(OG(n,r,t))}return i.then(()=>{n.notify("AnimationComplete",e)})}const Ise=qD.length;function LG(n){if(!n)return;if(!n.isControllingVariants){const t=n.parent?LG(n.parent)||{}:{};return n.props.initial!==void 0&&(t.initial=n.props.initial),t}const e={};for(let t=0;t<Ise;t++){const i=qD[t],r=n.props[i];(Tw(r)||r===!1)&&(e[i]=r)}return e}const Rse=[...WD].reverse(),Nse=WD.length;function Dse(n){return e=>Promise.all(e.map(({animation:t,options:i})=>Cse(n,t,i)))}function Ose(n){let e=Dse(n),t=zk(),i=!0;const r=l=>(c,u)=>{var h;const f=jA(n,u,l==="exit"?(h=n.presenceContext)===null||h===void 0?void 0:h.custom:void 0);if(f){const{transition:m,transitionEnd:g,...v}=f;c={...c,...v,...g}}return c};function s(l){e=l(n)}function o(l){const{props:c}=n,u=LG(n.parent)||{},h=[],f=new Set;let m={},g=1/0;for(let w=0;w<Nse;w++){const y=Rse[w],_=t[y],x=c[y]!==void 0?c[y]:u[y],S=Tw(x),M=y===l?_.isActive:null;M===!1&&(g=w);let A=x===u[y]&&x!==c[y]&&S;if(A&&i&&n.manuallyAnimateOnMount&&(A=!1),_.protectedKeys={...m},!_.isActive&&M===null||!x&&!_.prevProp||$A(x)||typeof x=="boolean")continue;const I=Lse(_.prevProp,x);let D=I||y===l&&_.isActive&&!A&&S||w>g&&S,k=!1;const C=Array.isArray(x)?x:[x];let U=C.reduce(r(y),{});M===!1&&(U={});const{prevResolvedValues:G={}}=_,H={...G,...U},z=F=>{D=!0,f.has(F)&&(k=!0,f.delete(F)),_.needsAnimating[F]=!0;const N=n.getValue(F);N&&(N.liveStyle=!1)};for(const F in H){const N=U[F],O=G[F];if(m.hasOwnProperty(F))continue;let B=!1;lI(N)&&lI(O)?B=!K7(N,O):B=N!==O,B?N!=null?z(F):f.add(F):N!==void 0&&f.has(F)?z(F):_.protectedKeys[F]=!0}_.prevProp=x,_.prevResolvedValues=U,_.isActive&&(m={...m,...U}),i&&n.blockInitialAnimation&&(D=!1),D&&(!(A&&I)||k)&&h.push(...C.map(F=>({animation:F,options:{type:y}})))}if(f.size){const w={};f.forEach(y=>{const _=n.getBaseTarget(y),x=n.getValue(y);x&&(x.liveStyle=!0),w[y]=_??null}),h.push({animation:w})}let v=!!h.length;return i&&(c.initial===!1||c.initial===c.animate)&&!n.manuallyAnimateOnMount&&(v=!1),i=!1,v?e(h):Promise.resolve()}function a(l,c){var u;if(t[l].isActive===c)return Promise.resolve();(u=n.variantChildren)===null||u===void 0||u.forEach(f=>{var m;return(m=f.animationState)===null||m===void 0?void 0:m.setActive(l,c)}),t[l].isActive=c;const h=o(l);for(const f in t)t[f].protectedKeys={};return h}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>t,reset:()=>{t=zk(),i=!0}}}function Lse(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!K7(e,n):!1}function bf(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function zk(){return{animate:bf(!0),whileInView:bf(),whileHover:bf(),whileTap:bf(),whileDrag:bf(),whileFocus:bf(),exit:bf()}}class nf{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Use extends nf{constructor(e){super(e),e.animationState||(e.animationState=Ose(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();$A(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let Bse=0;class kse extends nf{constructor(){super(...arguments),this.id=Bse++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>t(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const Fse={animation:{Feature:Use},exit:{Feature:kse}};function Rw(n,e,t,i={passive:!0}){return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t)}function z1(n){return{point:{x:n.pageX,y:n.pageY}}}const zse=n=>e=>lO(e)&&n(e,z1(e));function qv(n,e,t,i){return Rw(n,e,zse(t),i)}const Vk=(n,e)=>Math.abs(n-e);function Vse(n,e){const t=Vk(n.x,e.x),i=Vk(n.y,e.y);return Math.sqrt(t**2+i**2)}class UG{constructor(e,t,{transformPagePoint:i,contextWindow:r,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=KT(this.lastMoveEventInfo,this.history),f=this.startEvent!==null,m=Vse(h.offset,{x:0,y:0})>=3;if(!f&&!m)return;const{point:g}=h,{timestamp:v}=cr;this.history.push({...g,timestamp:v});const{onStart:w,onMove:y}=this.handlers;f||(w&&w(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),y&&y(this.lastMoveEvent,h)},this.handlePointerMove=(h,f)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=qT(f,this.transformPagePoint),Un.update(this.updatePoint,!0)},this.handlePointerUp=(h,f)=>{this.end();const{onEnd:m,onSessionEnd:g,resumeAnimation:v}=this.handlers;if(this.dragSnapToOrigin&&v&&v(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const w=KT(h.type==="pointercancel"?this.lastMoveEventInfo:qT(f,this.transformPagePoint),this.history);this.startEvent&&m&&m(h,w),g&&g(h,w)},!lO(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=i,this.contextWindow=r||window;const o=z1(e),a=qT(o,this.transformPagePoint),{point:l}=a,{timestamp:c}=cr;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,KT(a,this.history)),this.removeListeners=F1(qv(this.contextWindow,"pointermove",this.handlePointerMove),qv(this.contextWindow,"pointerup",this.handlePointerUp),qv(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),$h(this.updatePoint)}}function qT(n,e){return e?{point:e(n.point)}:n}function Hk(n,e){return{x:n.x-e.x,y:n.y-e.y}}function KT({point:n},e){return{point:n,delta:Hk(n,BG(e)),offset:Hk(n,Hse(e)),velocity:$se(e,.1)}}function Hse(n){return n[0]}function BG(n){return n[n.length-1]}function $se(n,e){if(n.length<2)return{x:0,y:0};let t=n.length-1,i=null;const r=BG(n);for(;t>=0&&(i=n[t],!(r.timestamp-i.timestamp>Hc(e)));)t--;if(!i)return{x:0,y:0};const s=$c(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const o={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}const kG=1e-4,Gse=1-kG,jse=1+kG,FG=.01,Wse=0-FG,qse=0+FG;function vo(n){return n.max-n.min}function Kse(n,e,t){return Math.abs(n-e)<=t}function $k(n,e,t,i=.5){n.origin=i,n.originPoint=Wn(e.min,e.max,n.origin),n.scale=vo(t)/vo(e),n.translate=Wn(t.min,t.max,n.origin)-n.originPoint,(n.scale>=Gse&&n.scale<=jse||isNaN(n.scale))&&(n.scale=1),(n.translate>=Wse&&n.translate<=qse||isNaN(n.translate))&&(n.translate=0)}function Kv(n,e,t,i){$k(n.x,e.x,t.x,i?i.originX:void 0),$k(n.y,e.y,t.y,i?i.originY:void 0)}function Gk(n,e,t){n.min=t.min+e.min,n.max=n.min+vo(e)}function Xse(n,e,t){Gk(n.x,e.x,t.x),Gk(n.y,e.y,t.y)}function jk(n,e,t){n.min=e.min-t.min,n.max=n.min+vo(e)}function Xv(n,e,t){jk(n.x,e.x,t.x),jk(n.y,e.y,t.y)}function Yse(n,{min:e,max:t},i){return e!==void 0&&n<e?n=i?Wn(e,n,i.min):Math.max(n,e):t!==void 0&&n>t&&(n=i?Wn(t,n,i.max):Math.min(n,t)),n}function Wk(n,e,t){return{min:e!==void 0?n.min+e:void 0,max:t!==void 0?n.max+t-(n.max-n.min):void 0}}function Qse(n,{top:e,left:t,bottom:i,right:r}){return{x:Wk(n.x,t,r),y:Wk(n.y,e,i)}}function qk(n,e){let t=e.min-n.min,i=e.max-n.max;return e.max-e.min<n.max-n.min&&([t,i]=[i,t]),{min:t,max:i}}function Zse(n,e){return{x:qk(n.x,e.x),y:qk(n.y,e.y)}}function Jse(n,e){let t=.5;const i=vo(n),r=vo(e);return r>i?t=A0(e.min,e.max-i,n.min):i>r&&(t=A0(n.min,n.max-r,e.min)),eu(0,1,t)}function eoe(n,e){const t={};return e.min!==void 0&&(t.min=e.min-n.min),e.max!==void 0&&(t.max=e.max-n.min),t}const wI=.35;function toe(n=wI){return n===!1?n=0:n===!0&&(n=wI),{x:Kk(n,"left","right"),y:Kk(n,"top","bottom")}}function Kk(n,e,t){return{min:Xk(n,e),max:Xk(n,t)}}function Xk(n,e){return typeof n=="number"?n:n[e]||0}const Yk=()=>({translate:0,scale:1,origin:0,originPoint:0}),Qm=()=>({x:Yk(),y:Yk()}),Qk=()=>({min:0,max:0}),ci=()=>({x:Qk(),y:Qk()});function Vo(n){return[n("x"),n("y")]}function zG({top:n,left:e,right:t,bottom:i}){return{x:{min:e,max:t},y:{min:n,max:i}}}function noe({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function ioe(n,e){if(!e)return n;const t=e({x:n.left,y:n.top}),i=e({x:n.right,y:n.bottom});return{top:t.y,left:t.x,bottom:i.y,right:i.x}}function XT(n){return n===void 0||n===1}function xI({scale:n,scaleX:e,scaleY:t}){return!XT(n)||!XT(e)||!XT(t)}function Gf(n){return xI(n)||VG(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function VG(n){return Zk(n.x)||Zk(n.y)}function Zk(n){return n&&n!=="0%"}function CS(n,e,t){const i=n-t,r=e*i;return t+r}function Jk(n,e,t,i,r){return r!==void 0&&(n=CS(n,r,i)),CS(n,t,i)+e}function bI(n,e=0,t=1,i,r){n.min=Jk(n.min,e,t,i,r),n.max=Jk(n.max,e,t,i,r)}function HG(n,{x:e,y:t}){bI(n.x,e.translate,e.scale,e.originPoint),bI(n.y,t.translate,t.scale,t.originPoint)}const eF=.999999999999,tF=1.0000000000001;function roe(n,e,t,i=!1){const r=t.length;if(!r)return;e.x=e.y=1;let s,o;for(let a=0;a<r;a++){s=t[a],o=s.projectionDelta;const{visualElement:l}=s.options;l&&l.props.style&&l.props.style.display==="contents"||(i&&s.options.layoutScroll&&s.scroll&&s!==s.root&&Jm(n,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,HG(n,o)),i&&Gf(s.latestValues)&&Jm(n,s.latestValues))}e.x<tF&&e.x>eF&&(e.x=1),e.y<tF&&e.y>eF&&(e.y=1)}function Zm(n,e){n.min=n.min+e,n.max=n.max+e}function nF(n,e,t,i,r=.5){const s=Wn(n.min,n.max,r);bI(n,e,t,s,i)}function Jm(n,e){nF(n.x,e.x,e.scaleX,e.scale,e.originX),nF(n.y,e.y,e.scaleY,e.scale,e.originY)}function $G(n,e){return zG(ioe(n.getBoundingClientRect(),e))}function soe(n,e,t){const i=$G(n,t),{scroll:r}=e;return r&&(Zm(i.x,r.offset.x),Zm(i.y,r.offset.y)),i}const GG=({current:n})=>n?n.ownerDocument.defaultView:null,ooe=new WeakMap;class aoe{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ci(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const r=u=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(z1(u).point)},s=(u,h)=>{const{drag:f,dragPropagation:m,onDragStart:g}=this.getProps();if(f&&!m&&(this.openDragLock&&this.openDragLock(),this.openDragLock=ere(f),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Vo(w=>{let y=this.getAxisMotionValue(w).get()||0;if(Ol.test(y)){const{projection:_}=this.visualElement;if(_&&_.layout){const x=_.layout.layoutBox[w];x&&(y=vo(x)*(parseFloat(y)/100))}}this.originPoint[w]=y}),g&&Un.postRender(()=>g(u,h)),hI(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},o=(u,h)=>{const{dragPropagation:f,dragDirectionLock:m,onDirectionLock:g,onDrag:v}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:w}=h;if(m&&this.currentDirection===null){this.currentDirection=loe(w),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",h.point,w),this.updateAxis("y",h.point,w),this.visualElement.render(),v&&v(u,h)},a=(u,h)=>this.stop(u,h),l=()=>Vo(u=>{var h;return this.getAnimationState(u)==="paused"&&((h=this.getAxisMotionValue(u).animation)===null||h===void 0?void 0:h.play())}),{dragSnapToOrigin:c}=this.getProps();this.panSession=new UG(e,{onSessionStart:r,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:GG(this.visualElement)})}stop(e,t){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:r}=t;this.startAnimation(r);const{onDragEnd:s}=this.getProps();s&&Un.postRender(()=>s(e,t))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,i){const{drag:r}=this.getProps();if(!i||!Nb(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(o=Yse(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:t,dragElastic:i}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;t&&Xm(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=Qse(r.layoutBox,t):this.constraints=!1,this.elastic=toe(i),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Vo(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=eoe(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Xm(e))return!1;const i=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=soe(i,r.root,this.visualElement.getTransformPagePoint());let o=Zse(r.layout.layoutBox,s);if(t){const a=t(noe(o));this.hasMutatedConstraints=!!a,a&&(o=zG(a))}return o}startAnimation(e){const{drag:t,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Vo(u=>{if(!Nb(u,t,this.currentDirection))return;let h=l&&l[u]||{};o&&(h={min:0,max:0});const f=r?200:1e6,m=r?40:1e7,g={type:"inertia",velocity:i?e[u]:0,bounceStiffness:f,bounceDamping:m,timeConstant:750,restDelta:1,restSpeed:10,...s,...h};return this.startAxisValueAnimation(u,g)});return Promise.all(c).then(a)}startAxisValueAnimation(e,t){const i=this.getAxisMotionValue(e);return hI(this.visualElement,e),i.start(xO(e,i,0,t,this.visualElement,!1))}stopAnimation(){Vo(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Vo(e=>{var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.pause()})}getAnimationState(e){var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),r=i[t];return r||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){Vo(t=>{const{drag:i}=this.getProps();if(!Nb(t,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(t);if(r&&r.layout){const{min:o,max:a}=r.layout.layoutBox[t];s.set(e[t]-Wn(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:i}=this.visualElement;if(!Xm(t)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Vo(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();r[o]=Jse({min:l,max:l},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Vo(o=>{if(!Nb(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(Wn(l,c,r[o]))})}addListeners(){if(!this.visualElement.current)return;ooe.set(this.visualElement,this);const e=this.visualElement.current,t=qv(e,"pointerdown",l=>{const{drag:c,dragListener:u=!0}=this.getProps();c&&u&&this.start(l)}),i=()=>{const{dragConstraints:l}=this.getProps();Xm(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,s=r.addEventListener("measure",i);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),Un.read(i);const o=Rw(window,"resize",()=>this.scalePositionWithinConstraints()),a=r.addEventListener("didUpdate",({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(Vo(u=>{const h=this.getAxisMotionValue(u);h&&(this.originPoint[u]+=l[u].translate,h.set(h.get()+l[u].translate))}),this.visualElement.render())});return()=>{o(),t(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:o=wI,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function Nb(n,e,t){return(e===!0||e===n)&&(t===null||t===n)}function loe(n,e=10){let t=null;return Math.abs(n.y)>e?t="y":Math.abs(n.x)>e&&(t="x"),t}class coe extends nf{constructor(e){super(e),this.removeGroupControls=mo,this.removeListeners=mo,this.controls=new aoe(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||mo}unmount(){this.removeGroupControls(),this.removeListeners()}}const iF=n=>(e,t)=>{n&&Un.postRender(()=>n(e,t))};class uoe extends nf{constructor(){super(...arguments),this.removePointerDownListener=mo}onPointerDown(e){this.session=new UG(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:GG(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:iF(e),onStart:iF(t),onMove:i,onEnd:(s,o)=>{delete this.session,r&&Un.postRender(()=>r(s,o))}}}mount(){this.removePointerDownListener=qv(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const AE={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function rF(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const ky={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(yt.test(n))n=parseFloat(n);else return n;const t=rF(n,e.target.x),i=rF(n,e.target.y);return`${t}% ${i}%`}},hoe={correct:(n,{treeScale:e,projectionDelta:t})=>{const i=n,r=Gh.parse(n);if(r.length>5)return i;const s=Gh.createTransformer(n),o=typeof r[0]!="number"?1:0,a=t.x.scale*e.x,l=t.y.scale*e.y;r[0+o]/=a,r[1+o]/=l;const c=Wn(a,l,.5);return typeof r[2+o]=="number"&&(r[2+o]/=c),typeof r[3+o]=="number"&&(r[3+o]/=c),s(r)}};class foe extends fe.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=e;Die(doe),s&&(t.group&&t.group.add(s),i&&i.register&&r&&i.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),AE.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:i,drag:r,isPresent:s}=this.props,o=i.projection;return o&&(o.isPresent=s,r||e.layoutDependency!==t||t===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||Un.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),XD.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:i}=this.props,{projection:r}=e;r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function jG(n){const[e,t]=Kne(),i=fe.useContext(P7);return j.jsx(foe,{...n,layoutGroup:i,switchLayoutGroup:fe.useContext(L7),isPresent:e,safeToRemove:t})}const doe={borderRadius:{...ky,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ky,borderTopRightRadius:ky,borderBottomLeftRadius:ky,borderBottomRightRadius:ky,boxShadow:hoe};function poe(n,e,t){const i=Vr(n)?n:Cw(n);return i.start(xO("",i,e,t)),i.animation}function moe(n){return n instanceof SVGElement&&n.tagName!=="svg"}const goe=(n,e)=>n.depth-e.depth;class yoe{constructor(){this.children=[],this.isDirty=!1}add(e){cO(this.children,e),this.isDirty=!0}remove(e){uO(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(goe),this.isDirty=!1,this.children.forEach(e)}}function voe(n,e){const t=Ll.now(),i=({timestamp:r})=>{const s=r-t;s>=e&&($h(i),n(s-e))};return Un.read(i,!0),()=>$h(i)}const WG=["TopLeft","TopRight","BottomLeft","BottomRight"],woe=WG.length,sF=n=>typeof n=="string"?parseFloat(n):n,oF=n=>typeof n=="number"||yt.test(n);function xoe(n,e,t,i,r,s){r?(n.opacity=Wn(0,t.opacity!==void 0?t.opacity:1,boe(i)),n.opacityExit=Wn(e.opacity!==void 0?e.opacity:1,0,_oe(i))):s&&(n.opacity=Wn(e.opacity!==void 0?e.opacity:1,t.opacity!==void 0?t.opacity:1,i));for(let o=0;o<woe;o++){const a=`border${WG[o]}Radius`;let l=aF(e,a),c=aF(t,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||oF(l)===oF(c)?(n[a]=Math.max(Wn(sF(l),sF(c),i),0),(Ol.test(c)||Ol.test(l))&&(n[a]+="%")):n[a]=c}(e.rotate||t.rotate)&&(n.rotate=Wn(e.rotate||0,t.rotate||0,i))}function aF(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const boe=qG(0,.5,hG),_oe=qG(.5,.95,mo);function qG(n,e,t){return i=>i<n?0:i>e?1:t(A0(n,e,i))}function lF(n,e){n.min=e.min,n.max=e.max}function Lo(n,e){lF(n.x,e.x),lF(n.y,e.y)}function cF(n,e){n.translate=e.translate,n.scale=e.scale,n.originPoint=e.originPoint,n.origin=e.origin}function uF(n,e,t,i,r){return n-=e,n=CS(n,1/t,i),r!==void 0&&(n=CS(n,1/r,i)),n}function Eoe(n,e=0,t=1,i=.5,r,s=n,o=n){if(Ol.test(e)&&(e=parseFloat(e),e=Wn(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Wn(s.min,s.max,i);n===s&&(a-=e),n.min=uF(n.min,e,t,a,r),n.max=uF(n.max,e,t,a,r)}function hF(n,e,[t,i,r],s,o){Eoe(n,e[t],e[i],e[r],e.scale,s,o)}const Soe=["x","scaleX","originX"],Aoe=["y","scaleY","originY"];function fF(n,e,t,i){hF(n.x,e,Soe,t?t.x:void 0,i?i.x:void 0),hF(n.y,e,Aoe,t?t.y:void 0,i?i.y:void 0)}function dF(n){return n.translate===0&&n.scale===1}function KG(n){return dF(n.x)&&dF(n.y)}function pF(n,e){return n.min===e.min&&n.max===e.max}function Moe(n,e){return pF(n.x,e.x)&&pF(n.y,e.y)}function mF(n,e){return Math.round(n.min)===Math.round(e.min)&&Math.round(n.max)===Math.round(e.max)}function XG(n,e){return mF(n.x,e.x)&&mF(n.y,e.y)}function gF(n){return vo(n.x)/vo(n.y)}function yF(n,e){return n.translate===e.translate&&n.scale===e.scale&&n.originPoint===e.originPoint}class Toe{constructor(){this.members=[]}add(e){cO(this.members,e),e.scheduleRender()}remove(e){if(uO(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){const t=this.members.findIndex(r=>e===r);if(t===0)return!1;let i;for(let r=t;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1){i=s;break}}return i?(this.promote(i),!0):!1}promote(e,t){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender(),e.resumeFrom=i,t&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:r}=e.options;r===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:t,resumingFrom:i}=e;t.onExitComplete&&t.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Poe(n,e,t){let i="";const r=n.x.translate/e.x,s=n.y.translate/e.y,o=(t==null?void 0:t.z)||0;if((r||s||o)&&(i=`translate3d(${r}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),t){const{transformPerspective:c,rotate:u,rotateX:h,rotateY:f,skewX:m,skewY:g}=t;c&&(i=`perspective(${c}px) ${i}`),u&&(i+=`rotate(${u}deg) `),h&&(i+=`rotateX(${h}deg) `),f&&(i+=`rotateY(${f}deg) `),m&&(i+=`skewX(${m}deg) `),g&&(i+=`skewY(${g}deg) `)}const a=n.x.scale*e.x,l=n.y.scale*e.y;return(a!==1||l!==1)&&(i+=`scale(${a}, ${l})`),i||"none"}const jf={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Av=typeof window<"u"&&window.MotionDebug!==void 0,YT=["","X","Y","Z"],Coe={visibility:"hidden"},vF=1e3;let Ioe=0;function QT(n,e,t,i){const{latestValues:r}=e;r[n]&&(t[n]=r[n],e.setStaticValue(n,0),i&&(i[n]=0))}function YG(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return;const{visualElement:e}=n.options;if(!e)return;const t=rG(e);if(window.MotionHasOptimisedAnimation(t,"transform")){const{layout:r,layoutId:s}=n.options;window.MotionCancelOptimisedAnimation(t,"transform",Un,!(r||s))}const{parent:i}=n;i&&!i.hasCheckedOptimisedAppear&&YG(i)}function QG({attachResizeListener:n,defaultParent:e,measureScroll:t,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(o={},a=e==null?void 0:e()){this.id=Ioe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Av&&(jf.totalNodes=jf.resolvedTargetDeltas=jf.recalculatedProjection=0),this.nodes.forEach(Doe),this.nodes.forEach(koe),this.nodes.forEach(Foe),this.nodes.forEach(Ooe),Av&&window.MotionDebug.record(jf)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new yoe)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new hO),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,a=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=moe(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),a&&(c||l)&&(this.isLayoutDirty=!0),n){let h;const f=()=>this.root.updateBlockedByResize=!1;n(o,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=voe(f,250),AE.hasAnimatedSinceResize&&(AE.hasAnimatedSinceResize=!1,this.nodes.forEach(xF))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:f,hasRelativeTargetChanged:m,layout:g})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||u.getDefaultTransition()||Goe,{onLayoutAnimationStart:w,onLayoutAnimationComplete:y}=u.getProps(),_=!this.targetLayout||!XG(this.targetLayout,g)||m,x=!f&&m;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||x||f&&(_||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,x);const S={...sO(v,"layout"),onPlay:w,onComplete:y};(u.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S)}else f||xF(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=g})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,$h(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(zoe),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&YG(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(wF);return}this.isUpdating||this.nodes.forEach(Uoe),this.isUpdating=!1,this.nodes.forEach(Boe),this.nodes.forEach(Roe),this.nodes.forEach(Noe),this.clearAllSnapshots();const a=Ll.now();cr.delta=eu(0,1e3/60,a-cr.timestamp),cr.timestamp=a,cr.isProcessing=!0,VT.update.process(cr),VT.preRender.process(cr),VT.render.process(cr),cr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,XD.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Loe),this.sharedNodes.forEach(Voe)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Un.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Un.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=ci(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a){const l=i(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:t(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!r)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!KG(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&(a||Gf(this.latestValues)||u)&&(r(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),joe(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var o;const{visualElement:a}=this.options;if(!a)return ci();const l=a.measureViewportBox();if(!(((o=this.scroll)===null||o===void 0?void 0:o.wasRoot)||this.path.some(Woe))){const{scroll:u}=this.root;u&&(Zm(l.x,u.offset.x),Zm(l.y,u.offset.y))}return l}removeElementScroll(o){var a;const l=ci();if(Lo(l,o),!((a=this.scroll)===null||a===void 0)&&a.wasRoot)return l;for(let c=0;c<this.path.length;c++){const u=this.path[c],{scroll:h,options:f}=u;u!==this.root&&h&&f.layoutScroll&&(h.wasRoot&&Lo(l,o),Zm(l.x,h.offset.x),Zm(l.y,h.offset.y))}return l}applyTransform(o,a=!1){const l=ci();Lo(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Jm(l,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),Gf(u.latestValues)&&Jm(l,u.latestValues)}return Gf(this.latestValues)&&Jm(l,this.latestValues),l}removeTransform(o){const a=ci();Lo(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!c.instance||!Gf(c.latestValues))continue;xI(c.latestValues)&&c.updateSnapshot();const u=ci(),h=c.measurePageBox();Lo(u,h),fF(a,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,u)}return Gf(this.latestValues)&&fF(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==cr.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var a;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:h,layoutId:f}=this.options;if(!(!this.layout||!(h||f))){if(this.resolvedRelativeTargetAt=cr.timestamp,!this.targetDelta&&!this.relativeTarget){const m=this.getClosestProjectingParent();m&&m.layout&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ci(),this.relativeTargetOrigin=ci(),Xv(this.relativeTargetOrigin,this.layout.layoutBox,m.layout.layoutBox),Lo(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=ci(),this.targetWithTransforms=ci()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Xse(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Lo(this.target,this.layout.layoutBox),HG(this.target,this.targetDelta)):Lo(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const m=this.getClosestProjectingParent();m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ci(),this.relativeTargetOrigin=ci(),Xv(this.relativeTargetOrigin,this.target,m.target),Lo(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Av&&jf.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||xI(this.parent.latestValues)||VG(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const a=this.getLead(),l=!!this.resumingFrom||this!==a;let c=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===cr.timestamp&&(c=!1),c)return;const{layout:u,layoutId:h}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||h))return;Lo(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,m=this.treeScale.y;roe(this.layoutCorrected,this.treeScale,this.path,l),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=ci());const{target:g}=a;if(!g){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(cF(this.prevProjectionDelta.x,this.projectionDelta.x),cF(this.prevProjectionDelta.y,this.projectionDelta.y)),Kv(this.projectionDelta,this.layoutCorrected,g,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==m||!yF(this.projectionDelta.x,this.prevProjectionDelta.x)||!yF(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",g)),Av&&jf.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)===null||a===void 0||a.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Qm(),this.projectionDelta=Qm(),this.projectionDeltaWithTransform=Qm()}setAnimationOrigin(o,a=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},h=Qm();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const f=ci(),m=l?l.source:void 0,g=this.layout?this.layout.source:void 0,v=m!==g,w=this.getStack(),y=!w||w.members.length<=1,_=!!(v&&!y&&this.options.crossfade===!0&&!this.path.some($oe));this.animationProgress=0;let x;this.mixTargetDelta=S=>{const M=S/1e3;bF(h.x,o.x,M),bF(h.y,o.y,M),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Xv(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Hoe(this.relativeTarget,this.relativeTargetOrigin,f,M),x&&Moe(this.relativeTarget,x)&&(this.isProjectionDirty=!1),x||(x=ci()),Lo(x,this.relativeTarget)),v&&(this.animationValues=u,xoe(u,c,this.latestValues,M,_,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=M},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&($h(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Un.update(()=>{AE.hasAnimatedSinceResize=!0,this.currentAnimation=poe(0,vF,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(vF),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&ZG(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||ci();const h=vo(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const f=vo(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+f}Lo(a,l),Jm(a,u),Kv(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Toe),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&QT("z",o,c,this.animationValues);for(let u=0;u<YT.length;u++)QT(`rotate${YT[u]}`,o,c,this.animationValues),QT(`skew${YT[u]}`,o,c,this.animationValues);o.render();for(const u in c)o.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);o.scheduleRender()}getProjectionStyles(o){var a,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return Coe;const c={visibility:""},u=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,c.opacity="",c.pointerEvents=EE(o==null?void 0:o.pointerEvents)||"",c.transform=u?u(this.latestValues,""):"none",c;const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){const v={};return this.options.layoutId&&(v.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,v.pointerEvents=EE(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Gf(this.latestValues)&&(v.transform=u?u({},""):"none",this.hasProjected=!1),v}const f=h.animationValues||h.latestValues;this.applyTransformsToTarget(),c.transform=Poe(this.projectionDeltaWithTransform,this.treeScale,f),u&&(c.transform=u(f,c.transform));const{x:m,y:g}=this.projectionDelta;c.transformOrigin=`${m.origin*100}% ${g.origin*100}% 0`,h.animationValues?c.opacity=h===this?(l=(a=f.opacity)!==null&&a!==void 0?a:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:c.opacity=h===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const v in SS){if(f[v]===void 0)continue;const{correct:w,applyTo:y}=SS[v],_=c.transform==="none"?f[v]:w(f[v],h);if(y){const x=y.length;for(let S=0;S<x;S++)c[y[S]]=_}else c[v]=_}return this.options.layoutId&&(c.pointerEvents=h===this?EE(o==null?void 0:o.pointerEvents)||"":"none"),c}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(wF),this.root.sharedNodes.clear()}}}function Roe(n){n.updateLayout()}function Noe(n){var e;const t=((e=n.resumeFrom)===null||e===void 0?void 0:e.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&t&&n.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:r}=n.layout,{animationType:s}=n.options,o=t.source!==n.layout.source;s==="size"?Vo(h=>{const f=o?t.measuredBox[h]:t.layoutBox[h],m=vo(f);f.min=i[h].min,f.max=f.min+m}):ZG(s,t.layoutBox,i)&&Vo(h=>{const f=o?t.measuredBox[h]:t.layoutBox[h],m=vo(i[h]);f.max=f.min+m,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[h].max=n.relativeTarget[h].min+m)});const a=Qm();Kv(a,i,t.layoutBox);const l=Qm();o?Kv(l,n.applyTransform(r,!0),t.measuredBox):Kv(l,i,t.layoutBox);const c=!KG(a);let u=!1;if(!n.resumeFrom){const h=n.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:f,layout:m}=h;if(f&&m){const g=ci();Xv(g,t.layoutBox,f.layoutBox);const v=ci();Xv(v,i,m.layoutBox),XG(g,v)||(u=!0),h.options.layoutRoot&&(n.relativeTarget=v,n.relativeTargetOrigin=g,n.relativeParent=h)}}}n.notifyListeners("didUpdate",{layout:i,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeTargetChanged:u})}else if(n.isLead()){const{onExitComplete:i}=n.options;i&&i()}n.options.transition=void 0}function Doe(n){Av&&jf.totalNodes++,n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function Ooe(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function Loe(n){n.clearSnapshot()}function wF(n){n.clearMeasurements()}function Uoe(n){n.isLayoutDirty=!1}function Boe(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function xF(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function koe(n){n.resolveTargetDelta()}function Foe(n){n.calcProjection()}function zoe(n){n.resetSkewAndRotation()}function Voe(n){n.removeLeadSnapshot()}function bF(n,e,t){n.translate=Wn(e.translate,0,t),n.scale=Wn(e.scale,1,t),n.origin=e.origin,n.originPoint=e.originPoint}function _F(n,e,t,i){n.min=Wn(e.min,t.min,i),n.max=Wn(e.max,t.max,i)}function Hoe(n,e,t,i){_F(n.x,e.x,t.x,i),_F(n.y,e.y,t.y,i)}function $oe(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const Goe={duration:.45,ease:[.4,0,.1,1]},EF=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),SF=EF("applewebkit/")&&!EF("chrome/")?Math.round:mo;function AF(n){n.min=SF(n.min),n.max=SF(n.max)}function joe(n){AF(n.x),AF(n.y)}function ZG(n,e,t){return n==="position"||n==="preserve-aspect"&&!Kse(gF(e),gF(t),.2)}function Woe(n){var e;return n!==n.root&&((e=n.scroll)===null||e===void 0?void 0:e.wasRoot)}const qoe=QG({attachResizeListener:(n,e)=>Rw(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),ZT={current:void 0},JG=QG({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!ZT.current){const n=new qoe({});n.mount(window),n.setOptions({layoutScroll:!0}),ZT.current=n}return ZT.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),Koe={pan:{Feature:uoe},drag:{Feature:coe,ProjectionNode:JG,MeasureLayout:jG}};function MF(n,e,t){const{props:i}=n;n.animationState&&i.whileHover&&n.animationState.setActive("whileHover",t==="Start");const r="onHover"+t,s=i[r];s&&Un.postRender(()=>s(e,z1(e)))}class Xoe extends nf{mount(){const{current:e}=this.node;e&&(this.unmount=Xie(e,t=>(MF(this.node,t,"Start"),i=>MF(this.node,i,"End"))))}unmount(){}}class Yoe extends nf{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=F1(Rw(this.node.current,"focus",()=>this.onFocus()),Rw(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function TF(n,e,t){const{props:i}=n;n.animationState&&i.whileTap&&n.animationState.setActive("whileTap",t==="Start");const r="onTap"+(t==="End"?"":t),s=i[r];s&&Un.postRender(()=>s(e,z1(e)))}class Qoe extends nf{mount(){const{current:e}=this.node;e&&(this.unmount=Jie(e,t=>(TF(this.node,t,"Start"),(i,{success:r})=>TF(this.node,i,r?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const _I=new WeakMap,JT=new WeakMap,Zoe=n=>{const e=_I.get(n.target);e&&e(n)},Joe=n=>{n.forEach(Zoe)};function eae({root:n,...e}){const t=n||document;JT.has(t)||JT.set(t,{});const i=JT.get(t),r=JSON.stringify(e);return i[r]||(i[r]=new IntersectionObserver(Joe,{root:n,...e})),i[r]}function tae(n,e,t){const i=eae(e);return _I.set(n,t),i.observe(n),()=>{_I.delete(n),i.unobserve(n)}}const nae={some:0,all:1};class iae extends nf{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:i,amount:r="some",once:s}=e,o={root:t?t.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:nae[r]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,s&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:h}=this.node.getProps(),f=c?u:h;f&&f(l)};return tae(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(rae(e,t))&&this.startObserver()}unmount(){}}function rae({viewport:n={}},{viewport:e={}}={}){return t=>n[t]!==e[t]}const sae={inView:{Feature:iae},tap:{Feature:Qoe},focus:{Feature:Yoe},hover:{Feature:Xoe}},oae={layout:{ProjectionNode:JG,MeasureLayout:jG}},EI={current:null},ej={current:!1};
vendor: 5,201 bytes, line 40
40function aae(){if(ej.current=!0,!!GD)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>EI.current=n.matches;n.addListener(e),e()}else EI.current=!1}const lae=[...AG,Ur,Gh],cae=n=>lae.find(SG(n)),PF=new WeakMap;function uae(n,e,t){for(const i in e){const r=e[i],s=t[i];if(Vr(r))n.addValue(i,r);else if(Vr(s))n.addValue(i,Cw(r,{owner:n}));else if(s!==r)if(n.hasValue(i)){const o=n.getValue(i);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=n.getStaticValue(i);n.addValue(i,Cw(o!==void 0?o:r,{owner:n}))}}for(const i in t)e[i]===void 0&&n.removeValue(i);return e}const CF=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class hae{scrapeMotionValuesFromProps(e,t,i){return{}}constructor({parent:e,props:t,presenceContext:i,reducedMotionConfig:r,blockInitialAnimation:s,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=yO,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=Ll.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,Un.render(this.render,!1,!0))};const{latestValues:l,renderState:c,onUpdate:u}=o;this.onUpdate=u,this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.blockInitialAnimation=!!s,this.isControllingVariants=GA(t),this.isVariantNode=D7(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:h,...f}=this.scrapeMotionValuesFromProps(t,{},this);for(const m in f){const g=f[m];l[m]!==void 0&&Vr(g)&&g.set(l[m],!1)}}mount(e){this.current=e,PF.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,i)=>this.bindToMotionValue(i,t)),ej.current||aae(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:EI.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){PF.delete(this.current),this.projection&&this.projection.unmount(),$h(this.notifyUpdate),$h(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=bp.has(e),r=t.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&Un.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),s=t.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),s(),o&&o(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in M0){const t=M0[e];if(!t)continue;const{isEnabled:i,Feature:r}=t;if(!this.features[e]&&r&&i(this.props)&&(this.features[e]=new r(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ci()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let i=0;i<CF.length;i++){const r=CF[i];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const s="on"+r,o=e[s];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=uae(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}
vendor: 5,637 bytes, lines 40-74
40addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const i=this.values.get(e);t!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&t!==void 0&&(i=Cw(t===null?void 0:t,{owner:this}),this.addValue(e,i)),i}readValue(e,t){var i;let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(i=this.getBaseTargetFromProps(this.props,e))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(_G(r)||dG(r))?r=parseFloat(r):!cae(r)&&Gh.test(t)&&(r=wG(e,t)),this.setBaseTarget(e,Vr(r)?r.get():r)),Vr(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:i}=this.props;let r;if(typeof i=="string"||typeof i=="object"){const o=QD(this.props,i,(t=this.presenceContext)===null||t===void 0?void 0:t.custom);o&&(r=o[e])}if(i&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Vr(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new hO),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class tj extends hae{constructor(){super(...arguments),this.KeyframeResolver=MG}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:i}){delete t[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Vr(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}function fae(n){return window.getComputedStyle(n)}class dae extends tj{constructor(){super(...arguments),this.type="html",this.renderInstance=H7}readValueFromInstance(e,t){if(bp.has(t)){const i=gO(t);return i&&i.default||0}else{const i=fae(e),r=(F7(t)?i.getPropertyValue(t):i[t])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return $G(e,t)}build(e,t,i){eO(e,t,i.transformTemplate)}scrapeMotionValuesFromProps(e,t,i){return rO(e,t,i)}}class pae extends tj{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ci}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(bp.has(t)){const i=gO(t);return i&&i.default||0}return t=$7.has(t)?t:KD(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,i){return W7(e,t,i)}build(e,t,i){tO(e,t,this.isSVGTag,i.transformTemplate)}renderInstance(e,t,i,r){G7(e,t,i,r)}mount(e){this.isSVGTag=iO(e.tagName),super.mount(e)}}const mae=(n,e)=>YD(n)?new pae(e):new dae(e,{allowProjection:n!==fe.Fragment}),gae=Hie({...Fse,...sae,...Koe,...oae},mae),un=iie(gae);/**
41 * @license lucide-react v0.358.0 - ISC
42 *
43 * This source code is licensed under the ISC license.
44 * See the LICENSE file in the root directory of this source tree.
45 */var yae={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"};/**
46 * @license lucide-react v0.358.0 - ISC
47 *
48 * This source code is licensed under the ISC license.
49 * See the LICENSE file in the root directory of this source tree.
50 */const vae=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
51 * @license lucide-react v0.358.0 - ISC
52 *
53 * This source code is licensed under the ISC license.
54 * See the LICENSE file in the root directory of this source tree.
55 */const si=(n,e)=>{const t=fe.forwardRef(({color:i="currentColor",size:r=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:a="",children:l,...c},u)=>fe.createElement("svg",{ref:u,...yae,width:r,height:r,stroke:i,strokeWidth:o?Number(s)*24/Number(r):s,className:["lucide",`lucide-${vae(n)}`,a].join(" "),...c},[...e.map(([h,f])=>fe.createElement(h,f)),...Array.isArray(l)?l:[l]]));return t.displayName=`${n}`,t};/**
56 * @license lucide-react v0.358.0 - ISC
57 *
58 * This source code is licensed under the ISC license.
59 * See the LICENSE file in the root directory of this source tree.
60 */const wae=si("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"}]]);/**
61 * @license lucide-react v0.358.0 - ISC
62 *
63 * This source code is licensed under the ISC license.
64 * See the LICENSE file in the root directory of this source tree.
65 */const IF=si("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
66 * @license lucide-react v0.358.0 - ISC
67 *
68 * This source code is licensed under the ISC license.
69 * See the LICENSE file in the root directory of this source tree.
70 */const xae=si("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
71 * @license lucide-react v0.358.0 - ISC
72 *
73 * This source code is licensed under the ISC license.
74 * See the LICENSE file in the root directory of this source tree.
75 */const bae=si("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
76 * @license lucide-react v0.358.0 - ISC
77 *
78 * This source code is licensed under the ISC license.
79 * See the LICENSE file in the root directory of this source tree.
80 */const _ae=si("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
81 * @license lucide-react v0.358.0 - ISC
82 *
83 * This source code is licensed under the ISC license.
84 * See the LICENSE file in the root directory of this source tree.
85 */const Eae=si("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
86 * @license lucide-react v0.358.0 - ISC
87 *
88 * This source code is licensed under the ISC license.
89 * See the LICENSE file in the root directory of this source tree.
90 */const Sae=si("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
91 * @license lucide-react v0.358.0 - ISC
92 *
93 * This source code is licensed under the ISC license.
94 * See the LICENSE file in the root directory of this source tree.
95 */const Aae=si("Pause",[["rect",{width:"4",height:"16",x:"6",y:"4",key:"iffhe4"}],["rect",{width:"4",height:"16",x:"14",y:"4",key:"sjin7j"}]]);/**
96 * @license lucide-react v0.358.0 - ISC
97 *
98 * This source code is licensed under the ISC license.
99 * See the LICENSE file in the root directory of this source tree.
100 */const Mae=si("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
101 * @license lucide-react v0.358.0 - ISC
102 *
103 * This source code is licensed under the ISC license.
104 * See the LICENSE file in the root directory of this source tree.
105 */const Tae=si("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/**
106 * @license lucide-react v0.358.0 - ISC
107 *
108 * This source code is licensed under the ISC license.
109 * See the LICENSE file in the root directory of this source tree.
110 */const Pae=si("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
111 * @license lucide-react v0.358.0 - ISC
112 *
113 * This source code is licensed under the ISC license.
114 * See the LICENSE file in the root directory of this source tree.
115 */const Cae=si("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
116 * @license lucide-react v0.358.0 - ISC
117 *
118 * This source code is licensed under the ISC license.
119 * See the LICENSE file in the root directory of this source tree.
120 */const Iae=si("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/**
121 * @license lucide-react v0.358.0 - ISC
122 *
123 * This source code is licensed under the ISC license.
124 * See the LICENSE file in the root directory of this source tree.
125 */const Rae=si("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
126 * @license lucide-react v0.358.0 - ISC
127 *
128 * This source code is licensed under the ISC license.
129 * See the LICENSE file in the root directory of this source tree.
130 */const Nae=si("Sword",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}]]);/**
131 * @license lucide-react v0.358.0 - ISC
132 *
133 * This source code is licensed under the ISC license.
134 * See the LICENSE file in the root directory of this source tree.
135 */const eP=si("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
136 * @license lucide-react v0.358.0 - ISC
137 *
138 * This source code is licensed under the ISC license.
139 * See the LICENSE file in the root directory of this source tree.
140 */const Dae=si("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"}]]);/**
141 * @license lucide-react v0.358.0 - ISC
142 *
143 * This source code is licensed under the ISC license.
144 * See the LICENSE file in the root directory of this source tree.
145 */const Oae=si("Volume2",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",key:"ltjumu"}],["path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",key:"1kegas"}]]);/**
146 * @license lucide-react v0.358.0 - ISC
147 *
148 * This source code is licensed under the ISC license.
149 * See the LICENSE file in the root directory of this source tree.
150 */const Lae=si("VolumeX",[["polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5",key:"16drj5"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
151 * @license lucide-react v0.358.0 - ISC
152 *
153 * This source code is licensed under the ISC license.
154 * See the LICENSE file in the root directory of this source tree.
155 */const Db=si("Wallet",[["path",{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4",key:"195gfw"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h16v-5",key:"195n9w"}],["path",{d:"M18 12a2 2 0 0 0 0 4h4v-4Z",key:"vllfpd"}]]);/**
156 * @license lucide-react v0.358.0 - ISC
157 *
158 * This source code is licensed under the ISC license.
159 * See the LICENSE file in the root directory of this source tree.
160 */const Uae=si("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}
160],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
161 * @license lucide-react v0.358.0 - ISC
162 *
163 * This source code is licensed under the ISC license.
164 * See the LICENSE file in the root directory of this source tree.
165 */const Bae=si("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]),kae="6.15.0";function Fae(n,e,t){const i=e.split("|").map(s=>s.trim());for(let s=0;s<i.length;s++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof n===e)return}const r=new Error(`invalid value for type ${e}`);throw r.code="INVALID_ARGUMENT",r.argument=`value.${t}`,r.value=n,r}async function Jr(n){const e=Object.keys(n);return(await Promise.all(e.map(i=>Promise.resolve(n[i])))).reduce((i,r,s)=>(i[e[s]]=r,i),{})}function vt(n,e,t){for(let i in e){let r=e[i];const s=t?t[i]:null;s&&Fae(r,s,i),Object.defineProperty(n,i,{enumerable:!0,value:r,writable:!1})}}function eg(n,e){if(n==null)return"null";if(e==null&&(e=new Set),typeof n=="object"){if(e.has(n))return"[Circular]";e.add(n)}if(Array.isArray(n))return"[ "+n.map(t=>eg(t,e)).join(", ")+" ]";if(n instanceof Uint8Array){const t="0123456789abcdef";let i="0x";for(let r=0;r<n.length;r++)i+=t[n[r]>>4],i+=t[n[r]&15];return i}if(typeof n=="object"&&typeof n.toJSON=="function")return eg(n.toJSON(),e);switch(typeof n){case"boolean":case"number":case"symbol":return n.toString();case"bigint":return BigInt(n).toString();case"string":return JSON.stringify(n);case"object":{const t=Object.keys(n);return t.sort(),"{ "+t.map(i=>`${eg(i,e)}: ${eg(n[i],e)}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function hr(n,e){return n&&n.code===e}function bO(n){return hr(n,"CALL_EXCEPTION")}function kn(n,e,t){let i=n;{const s=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${eg(t)}`);for(const o in t){if(o==="shortMessage")continue;const a=t[o];s.push(o+"="+eg(a))}}s.push(`code=${e}`),s.push(`version=${kae}`),s.length&&(n+=" ("+s.join(", ")+")")}let r;switch(e){case"INVALID_ARGUMENT":r=new TypeError(n);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":r=new RangeError(n);break;default:r=new Error(n)}return vt(r,{code:e}),t&&Object.assign(r,t),r.shortMessage==null&&vt(r,{shortMessage:i}),r}function Ie(n,e,t,i){if(!n)throw kn(e,t,i)}function ie(n,e,t,i){Ie(n,e,"INVALID_ARGUMENT",{argument:t,value:i})}function nj(n,e,t){t==null&&(t=""),t&&(t=": "+t),Ie(n>=e,"missing argument"+t,"MISSING_ARGUMENT",{count:n,expectedCount:e}),Ie(n<=e,"too many arguments"+t,"UNEXPECTED_ARGUMENT",{count:n,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((n,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");n.push(e)}catch{}return n},[]);function qA(n,e,t){if(t==null&&(t=""),n!==e){let i=t,r="new";t&&(i+=".",r+=" "+t),Ie(!1,`private constructor; use ${i}from* methods`,"UNSUPPORTED_OPERATION",{operation:r})}}function ij(n,e,t){if(n instanceof Uint8Array)return t?new Uint8Array(n):n;if(typeof n=="string"&&n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const i=new Uint8Array((n.length-2)/2);let r=2;for(let s=0;s<i.length;s++)i[s]=parseInt(n.substring(r,r+2),16),r+=2;return i}ie(!1,"invalid BytesLike value",e||"value",n)}function Gt(n,e){return ij(n,e,!1)}function es(n,e){return ij(n,e,!0)}function Cn(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&n.length!==2+2*e||e===!0&&n.length%2!==0)}function _O(n){return Cn(n,!0)||n instanceof Uint8Array}const RF="0123456789abcdef";function Ye(n){const e=Gt(n);let t="0x";for(let i=0;i<e.length;i++){const r=e[i];t+=RF[(r&240)>>4]+RF[r&15]}return t}function ri(n){return"0x"+n.map(e=>Ye(e).substring(2)).join("")}function bg(n){return Cn(n,!0)?(n.length-2)/2:Gt(n).length}function ti(n,e,t){const i=Gt(n);return t!=null&&t>i.length&&Ie(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:i,length:i.length,offset:t}),Ye(i.slice(e??0,t??i.length))}function rj(n,e,t){const i=Gt(n);Ie(e>=i.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(i),length:e,offset:e+1});
165const r=new Uint8Array(e);return r.fill(0),t?r.set(i,e-i.length):r.set(i,0),Ye(r)}function tu(n,e){return rj(n,e,!0)}function zae(n,e){return rj(n,e,!1)}const KA=BigInt(0),La=BigInt(1),tg=9007199254740991;function Vae(n,e){const t=XA(n,"value"),i=BigInt(jt(e,"width"));if(Ie(t>>i===KA,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:n}),t>>i-La){const r=(La<<i)-La;return-((~t&r)+La)}return t}function sj(n,e){let t=ot(n,"value");const i=BigInt(jt(e,"width")),r=La<<i-La;if(t<KA){t=-t,Ie(t<=r,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});const s=(La<<i)-La;return(~t&s)+La}else Ie(t<r,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});return t}function Mv(n,e){const t=XA(n,"value"),i=BigInt(jt(e,"bits"));return t&(La<<i)-La}function ot(n,e){switch(typeof n){case"bigint":return n;case"number":return ie(Number.isInteger(n),"underflow",e||"value",n),ie(n>=-tg&&n<=tg,"overflow",e||"value",n),BigInt(n);case"string":try{if(n==="")throw new Error("empty string");return n[0]==="-"&&n[1]!=="-"?-BigInt(n.substring(1)):BigInt(n)}catch(t){ie(!1,`invalid BigNumberish string: ${t.message}`,e||"value",n)}}ie(!1,"invalid BigNumberish value",e||"value",n)}function XA(n,e){const t=ot(n,e);return Ie(t>=KA,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:n}),t}const NF="0123456789abcdef";function EO(n){if(n instanceof Uint8Array){let e="0x0";for(const t of n)e+=NF[t>>4],e+=NF[t&15];return BigInt(e)}return ot(n)}function jt(n,e){switch(typeof n){case"bigint":return ie(n>=-tg&&n<=tg,"overflow",e||"value",n),Number(n);case"number":return ie(Number.isInteger(n),"underflow",e||"value",n),ie(n>=-tg&&n<=tg,"overflow",e||"value",n),n;case"string":try{if(n==="")throw new Error("empty string");return jt(BigInt(n),e)}catch(t){ie(!1,`invalid numeric string: ${t.message}`,e||"value",n)}}ie(!1,"invalid numeric value",e||"value",n)}function Hae(n){return jt(EO(n))}function jh(n,e){let i=XA(n,"value").toString(16);if(e==null)i.length%2&&(i="0"+i);else{const r=jt(e,"width");for(Ie(r*2>=i.length,`value exceeds width (${r} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:n});i.length<r*2;)i="0"+i}return"0x"+i}function Ri(n){const e=XA(n,"value");if(e===KA)return new Uint8Array([]);let t=e.toString(16);t.length%2&&(t="0"+t);const i=new Uint8Array(t.length/2);for(let r=0;r<i.length;r++){const s=r*2;i[r]=parseInt(t.substring(s,s+2),16)}return i}function Na(n){let e=Ye(_O(n)?n:Ri(n)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const DF="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const OF=BigInt(58);function $ae(n){const e=Gt(n);let t=EO(e),i="";for(;t;)i=DF[Number(t%OF)]+i,t/=OF;for(let r=0;r<e.length&&!e[r];r++)i=DF[0]+i;return i}function Gae(n){n=atob(n);const e=new Uint8Array(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return Gt(e)}function jae(n){const e=Gt(n);let t="";for(let i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return btoa(t)}var Ng;class oj{constructor(e,t,i){ce(this,"filter");ce(this,"emitter");ge(this,Ng);ee(this,Ng,t),vt(this,{emitter:e,filter:i})}async removeListener(){V(this,Ng)!=null&&await this.emitter.off(this.filter,V(this,Ng))}}Ng=new WeakMap;function Wae(n,e,t,i,r){ie(!1,`invalid codepoint at offset ${e}; ${n}`,"bytes",t)}function aj(n,e,t,i,r){if(n==="BAD_PREFIX"||n==="UNEXPECTED_CONTINUE"){let s=0;for(let o=e+1;o<t.length&&t[o]>>6===2;o++)s++;return s}return n==="OVERRUN"?t.length-e-1:0}function qae(n,e,t,i,r){return n==="OVERLONG"?(ie(typeof r=="number","invalid bad code point for replacement","badCodepoint",r),i.push(r),0):(i.push(65533),aj(n,e,t))}const Kae=Object.freeze({error:Wae,ignore:aj,replace:qae});function Xae(n,e){e==null&&(e=Kae.error);const t=Gt(n,"bytes"),i=[];let r=0;for(;r<t.length;){const s=t[r++];if(!(s>>7)){i.push(s);continue}let o=null,a=null;if((s&224)===192)o=1,a=127;else if((s&240)===224)o=2,a=2047;else if((s&248)===240)o=3,a=65535;else{(s&192)===128?r+=e("UNEXPECTED_CONTINUE",r-1,t,i):r+=e("BAD_PREFIX",r-1,t,i);continue}if(r-1+o>=t.length){r+=e("OVERRUN",r-1,t,i);continue}let l=s&(1<<8-o-1)-1;for(let c=0;c<o;c++){let u=t[r];if((u&192)!=128){r+=e("MISSING_CONTINUE",r,t,i),l=null;break}l=l<<6|u&63,r++}if(l!==null){if(l>1114111){r+=e("OUT_OF_RANGE",r-1-o,t,i,l);continue}if(l>=55296&&l<=57343){r+=e("UTF16_SURROGATE",r-1-o,t,i,l);continue}if(l<=a){r+=e("OVERLONG",r-1-o,t,i,l);continue}i.push(l)}}return i}
165function Gc(n,e){ie(typeof n=="string","invalid string value","str",n);let t=[];for(let i=0;i<n.length;i++){const r=n.charCodeAt(i);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192),t.push(r&63|128);else if((r&64512)==55296){i++;const s=n.charCodeAt(i);ie(i<n.length&&(s&64512)===56320,"invalid surrogate pair","str",n);const o=65536+((r&1023)<<10)+(s&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(r>>12|224),t.push(r>>6&63|128),t.push(r&63|128)}return new Uint8Array(t)}function Yae(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function IS(n,e){return Yae(Xae(n,e))}function lj(n){async function e(t,i){Ie(i==null||!i.cancelled,"request cancelled before sending","CANCELLED");const r=t.url.split(":")[0].toLowerCase();Ie(r==="http"||r==="https",`unsupported protocol ${r}`,"UNSUPPORTED_OPERATION",{info:{protocol:r},operation:"request"}),Ie(r==="https"||!t.credentials||t.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let s=null;const o=new AbortController,a=setTimeout(()=>{s=kn("request timeout","TIMEOUT"),o.abort()},t.timeout);i&&i.addListener(()=>{s=kn("request cancelled","CANCELLED"),o.abort()});const l=Object.assign({},n,{method:t.method,headers:new Headers(Array.from(t)),body:t.body||void 0,signal:o.signal});let c;try{c=await fetch(t.url,l)}catch(m){throw clearTimeout(a),s||m}clearTimeout(a);const u={};c.headers.forEach((m,g)=>{u[g.toLowerCase()]=m});const h=await c.arrayBuffer(),f=h==null?null:new Uint8Array(h);return{statusCode:c.status,statusMessage:c.statusText,headers:u,body:f}}return e}const Qae=12,Zae=250;let LF=lj();const Jae=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),ele=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let tP=!1;async function cj(n,e){try{const t=n.match(Jae);if(!t)throw new Error("invalid data");return new Bh(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?Gae(t[3]):nle(t[3]))}catch{return new Bh(599,"BAD REQUEST (invalid data: URI)",{},null,new Wh(n))}}function uj(n){async function e(t,i){try{const r=t.match(ele);if(!r)throw new Error("invalid link");return new Wh(`${n}${r[2]}`)}catch{return new Bh(599,"BAD REQUEST (invalid IPFS URI)",{},null,new Wh(t))}}return e}const Ob={data:cj,ipfs:uj("https://gateway.ipfs.io/ipfs/")},hj=new WeakMap;var Sd,lh;class tle{constructor(e){ge(this,Sd);ge(this,lh);ee(this,Sd,[]),ee(this,lh,!1),hj.set(e,()=>{if(!V(this,lh)){ee(this,lh,!0);for(const t of V(this,Sd))setTimeout(()=>{t()},0);ee(this,Sd,[])}})}addListener(e){Ie(!V(this,lh),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),V(this,Sd).push(e)}get cancelled(){return V(this,lh)}checkSignal(){Ie(!this.cancelled,"cancelled","CANCELLED",{})}}Sd=new WeakMap,lh=new WeakMap;
165function Lb(n){if(n==null)throw new Error("missing signal; should not happen");return n.checkSignal(),n}var Dg,Og,Aa,xc,Lg,Ug,$i,no,bc,Ad,Md,Td,pl,Ma,ch,Pd,Tv;const vA=class vA{constructor(e){ge(this,Pd);ge(this,Dg);ge(this,Og);ge(this,Aa);ge(this,xc);ge(this,Lg);ge(this,Ug);ge(this,$i);ge(this,no);ge(this,bc);ge(this,Ad);ge(this,Md);ge(this,Td);ge(this,pl);ge(this,Ma);ge(this,ch);ee(this,Ug,String(e)),ee(this,Dg,!1),ee(this,Og,!0),ee(this,Aa,{}),ee(this,xc,""),ee(this,Lg,3e5),ee(this,Ma,{slotInterval:Zae,maxAttempts:Qae}),ee(this,ch,null)}get url(){return V(this,Ug)}set url(e){ee(this,Ug,String(e))}get body(){return V(this,$i)==null?null:new Uint8Array(V(this,$i))}set body(e){if(e==null)ee(this,$i,void 0),ee(this,no,void 0);else if(typeof e=="string")ee(this,$i,Gc(e)),ee(this,no,"text/plain");else if(e instanceof Uint8Array)ee(this,$i,e),ee(this,no,"application/octet-stream");else if(typeof e=="object")ee(this,$i,Gc(JSON.stringify(e))),ee(this,no,"application/json");else throw new Error("invalid body")}hasBody(){return V(this,$i)!=null}get method(){return V(this,xc)?V(this,xc):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),ee(this,xc,String(e).toUpperCase())}get headers(){const e=Object.assign({},V(this,Aa));return V(this,bc)&&(e.authorization=`Basic ${jae(Gc(V(this,bc)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&V(this,no)&&(e["content-type"]=V(this,no)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,t){V(this,Aa)[String(e).toLowerCase()]=String(t)}clearHeaders(){ee(this,Aa,{})}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let i=0;return{next:()=>{if(i<t.length){const r=t[i++];return{value:[r,e[r]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return V(this,bc)||null}setCredentials(e,t){ie(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),ee(this,bc,`${e}:${t}`)}get allowGzip(){return V(this,Og)}set allowGzip(e){ee(this,Og,!!e)}get allowInsecureAuthentication(){return!!V(this,Dg)}set allowInsecureAuthentication(e){ee(this,Dg,!!e)}get timeout(){return V(this,Lg)}set timeout(e){ie(e>=0,"timeout must be non-zero","timeout",e),ee(this,Lg,e)}get preflightFunc(){return V(this,Ad)||null}set preflightFunc(e){ee(this,Ad,e)}get processFunc(){return V(this,Md)||null}set processFunc(e){ee(this,Md,e)}get retryFunc(){return V(this,Td)||null}set retryFunc(e){ee(this,Td,e)}get getUrlFunc(){return V(this,ch)||LF}set getUrlFunc(e){ee(this,ch,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${V(this,$i)?Ye(V(this,$i)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(V(this,Ma).slotInterval=e.slotInterval),e.maxAttempts!=null&&(V(this,Ma).maxAttempts=e.maxAttempts)}send(){return Ie(V(this,pl)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),ee(this,pl,new tle(this)),Ge(this,Pd,Tv).call(this,0,UF()+this.timeout,0,this,new Bh(0,"",{},null,this))}cancel(){Ie(V(this,pl)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=hj.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const t=this.url.split(":")[0].toLowerCase(),i=e.split(":")[0].toLowerCase();Ie(this.method==="GET"&&(t!=="https"||i!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const r=new vA(e);return r.method="GET",r.allowGzip=this.allowGzip,r.timeout=this.timeout,ee(r,Aa,Object.assign({},V(this,Aa))),V(this,$i)&&ee(r,$i,new Uint8Array(V(this,$i))),ee(r,no,V(this,no)),r}clone(){const e=new vA(this.url);return ee(e,xc,V(this,xc)),V(this,$i)&&ee(e,$i,V(this,$i)),ee(e,no,V(this,no)),ee(e,Aa,Object.assign({},V(this,Aa))),ee(e,bc,V(this,bc)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),ee(e,Ad,V(this,Ad)),ee(e,Md,V(this,Md)),ee(e,Td,V(this,Td)),ee(e,Ma,Ob
165ject.assign({},V(this,Ma))),ee(e,ch,V(this,ch)),e}static lockConfig(){tP=!0}static getGateway(e){return Ob[e.toLowerCase()]||null}static registerGateway(e,t){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(tP)throw new Error("gateways locked");Ob[e]=t}static registerGetUrl(e){if(tP)throw new Error("gateways locked");LF=e}static createGetUrlFunc(e){return lj(e)}static createDataGateway(){return cj}static createIpfsGatewayFunc(e){return uj(e)}};Dg=new WeakMap,Og=new WeakMap,Aa=new WeakMap,xc=new WeakMap,Lg=new WeakMap,Ug=new WeakMap,$i=new WeakMap,no=new WeakMap,bc=new WeakMap,Ad=new WeakMap,Md=new WeakMap,Td=new WeakMap,pl=new WeakMap,Ma=new WeakMap,ch=new WeakMap,Pd=new WeakSet,Tv=async function(e,t,i,r,s){var u,h,f;if(e>=V(this,Ma).maxAttempts)return s.makeServerError("exceeded maximum retry limit");Ie(UF()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:r}),i>0&&await ile(i);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Ob){const m=await Ob[a](o.url,Lb(V(r,pl)));if(m instanceof Bh){let g=m;if(this.processFunc){Lb(V(r,pl));try{g=await this.processFunc(o,g)}catch(v){(v.throttle==null||typeof v.stall!="number")&&g.makeServerError("error in post-processing function",v).assertOk()}}return g}o=m}this.preflightFunc&&(o=await this.preflightFunc(o));const l=await this.getUrlFunc(o,Lb(V(r,pl)));let c=new Bh(l.statusCode,l.statusMessage,l.headers,l.body,r);if(c.statusCode===301||c.statusCode===302){try{const m=c.headers.location||"";return Ge(u=o.redirect(m),Pd,Tv).call(u,e+1,t,0,r,c)}catch{}return c}else if(c.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,c,e))){const m=c.headers["retry-after"];let g=V(this,Ma).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof m=="string"&&m.match(/^[1-9][0-9]*$/)&&(g=parseInt(m)),Ge(h=o.clone(),Pd,Tv).call(h,e+1,t,g,r,c)}if(this.processFunc){Lb(V(r,pl));try{c=await this.processFunc(o,c)}catch(m){(m.throttle==null||typeof m.stall!="number")&&c.makeServerError("error in post-processing function",m).assertOk();let g=V(this,Ma).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return m.stall>=0&&(g=m.stall),Ge(f=o.clone(),Pd,Tv).call(f,e+1,t,g,r,c)}}return c};let Wh=vA;var x1,b1,_1,io,Bg,Cd;const AU=class AU{constructor(e,t,i,r,s){ge(this,x1);ge(this,b1);ge(this,_1);ge(this,io);ge(this,Bg);ge(this,Cd);ee(this,x1,e),ee(this,b1,t),ee(this,_1,Object.keys(i).reduce((o,a)=>(o[a.toLowerCase()]=String(i[a]),o),{})),ee(this,io,r==null?null:new Uint8Array(r)),ee(this,Bg,s||null),ee(this,Cd,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${V(this,io)?Ye(V(this,io)):"null"}>`}get statusCode(){return V(this,x1)}get statusMessage(){return V(this,b1)}get headers(){return Object.assign({},V(this,_1))}get body(){return V(this,io)==null?null:new Uint8Array(V(this,io))}get bodyText(){try{return V(this,io)==null?"":IS(V(this,io))}catch{Ie(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{Ie(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let i=0;return{next:()=>{if(i<t.length){const r=t[i++];return{value:[r,e[r]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,t){let i;e?i=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,i=`CLIENT ESCALATED SERVER ERROR (${e})`);const r=new AU(599,i,this.headers,this.body,V(this,Bg)||void 0);return ee(r,Cd,{message:e,error:t}),r}throwThrottleError(e,t){t==null?t=-1:ie(Number.isInteger(t)&&t>=0,"invalid stall timeout","stall",t);const i=new Error(e||"throttling requests");throw vt(i,{stall:t,throttle:!0}),i}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return V(this,io)!=null}get request(){return V(this,Bg)}ok(){return V(this,Cd).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:t}=V(this,Cd);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let i=null;this.request&&(i=this.request.url);let r=null;try{V(this,io)&&(r=IS(V(this,io)))}catch{}Ie(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:t,info:{requestUrl:i,responseBody:r,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};x1=new WeakMap,b1=new WeakMap,_1=new WeakMap,io=new WeakMap,Bg=new WeakMap,Cd=new WeakMap;let Bh=AU;function UF(){return new Date().getTime()}function nle(n){return Gc(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>
165String.fromCharCode(parseInt(t,16))))}function ile(n){return new Promise(e=>setTimeout(e,n))}function rle(n){let e=n.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function BF(n,e,t){let i=0;for(let r=0;r<t;r++)i=i*256+n[e+r];return i}function kF(n,e,t,i){const r=[];for(;t<e+1+i;){const s=fj(n,t);r.push(s.result),t+=s.consumed,Ie(t<=e+1+i,"child data too short","BUFFER_OVERRUN",{buffer:n,length:i,offset:e})}return{consumed:1+i,result:r}}function fj(n,e){Ie(n.length!==0,"data too short","BUFFER_OVERRUN",{buffer:n,length:0,offset:1});const t=i=>{Ie(i<=n.length,"data short segment too short","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:i})};if(n[e]>=248){const i=n[e]-247;t(e+1+i);const r=BF(n,e+1,i);return t(e+1+i+r),kF(n,e,e+1+i,i+r)}else if(n[e]>=192){const i=n[e]-192;return t(e+1+i),kF(n,e,e+1,i)}else if(n[e]>=184){const i=n[e]-183;t(e+1+i);const r=BF(n,e+1,i);t(e+1+i+r);const s=Ye(n.slice(e+1+i,e+1+i+r));return{consumed:1+i+r,result:s}}else if(n[e]>=128){const i=n[e]-128;t(e+1+i);const r=Ye(n.slice(e+1,e+1+i));return{consumed:1+i,result:r}}return{consumed:1,result:rle(n[e])}}function V1(n){const e=Gt(n,"data"),t=fj(e,0);return ie(t.consumed===e.length,"unexpected junk after rlp payload","data",n),t.result}function FF(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function dj(n){if(Array.isArray(n)){let i=[];if(n.forEach(function(s){i=i.concat(dj(s))}),i.length<=55)return i.unshift(192+i.length),i;const r=FF(i.length);return r.unshift(247+r.length),r.concat(i)}const e=Array.prototype.slice.call(Gt(n,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const t=FF(e.length);return t.unshift(183+t.length),t.concat(e)}const zF="0123456789abcdef";function qh(n){let e="0x";for(const t of dj(n))e+=zF[t>>4],e+=zF[t&15];return e}const ns=32,SI=new Uint8Array(ns),sle=["then"],Ub={},pj=new WeakMap;function Qf(n){return pj.get(n)}function VF(n,e){pj.set(n,e)}function Fy(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);throw t.error=e,t}function AI(n,e,t){return n.indexOf(null)>=0?e.map((i,r)=>i instanceof P0?AI(Qf(i),i,t):i):n.reduce((i,r,s)=>{let o=e.getValue(r);return r in i||(t&&o instanceof P0&&(o=AI(Qf(o),o,t)),i[r]=o),i},{})}var kg;const fg=class fg extends Array{constructor(...t){const i=t[0];let r=t[1],s=(t[2]||[]).slice(),o=!0;i!==Ub&&(r=t,s=[],o=!1);super(r.length);ge(this,kg);r.forEach((c,u)=>{this[u]=c});const a=s.reduce((c,u)=>(typeof u=="string"&&c.set(u,(c.get(u)||0)+1),c),new Map);if(VF(this,Object.freeze(r.map((c,u)=>{const h=s[u];return h!=null&&a.get(h)===1?h:null}))),ee(this,kg,[]),V(this,kg)==null&&V(this,kg),!o)return;Object.freeze(this);const l=new Proxy(this,{get:(c,u,h)=>{if(typeof u=="string"){if(u.match(/^[0-9]+$/)){const m=jt(u,"%index");if(m<0||m>=this.length)throw new RangeError("out of result range");const g=c[m];return g instanceof Error&&Fy(`index ${m}`,g),g}if(sle.indexOf(u)>=0)return Reflect.get(c,u,h);const f=c[u];if(f instanceof Function)return function(...m){return f.apply(this===h?c:this,m)};if(!(u in c))return c.getValue.apply(this===h?c:this,[u])}return Reflect.get(c,u,h)}});return VF(l,Qf(this)),l}toArray(t){const i=[];return this.forEach((r,s)=>{r instanceof Error&&Fy(`index ${s}`,r),t&&r instanceof fg&&(r=r.toArray(t)),i.push(r)}),i}toObject(t){const i=Qf(this);return i.reduce((r,s,o)=>(Ie(s!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),AI(i,this,t)),{})}slice(t,i){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),i==null&&(i=this.length),i<0&&(i+=this.length,i<0&&(i=0)),i>this.length&&(i=this.length);const r=Qf(this),s=[],o=[];for(let a=t;a<i;a++)s.push(this[a]),o.push(r[a]);return new fg(Ub,s,o)}filter(t,i){const r=Qf(this),s=[],o=[];for(let a=0;a<this.length;a++){const l=this[a];l instanceof Error&&Fy(`index ${a}`,l),t.call(i,l,a,this)&&(s.push(l),o.push(r[a]))}return new fg(Ub,s,o)}map(t,i){const r=[];for(let s=0;s<this.length;s++){const o=this[s];o instanceof Error&&Fy(`index ${s}`,o),r.push(t.call(i,o,s,this))}return r}getValue(t){const i=Qf(this).indexOf(t);if(i===-1)return;const r=this[i];return r instanceof Error&&Fy(`property ${JSON.stringify(t)}`,r.error),r}static fromItems(t,i){return new fg(Ub,t,i)}};kg=new WeakMap;let P0=fg;function HF(n){let e=Ri(n);return Ie(e.length<=ns,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:ns,offset:e.length}),e.length!==ns&&(e=es(ri([SI.slice(e.length%ns),e]))),e}class uu{constructor(e,t,i,r){ce(this,"name");ce(this,"type");ce(this,"localName");ce(this,"dynamic");vt(this,{name:e,type:t,localName:i,dynamic:r},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){ie(!1,e,this.localName,t)}}var _c,Id,Fg,ME;class MI{constructor(){ge(this,Fg);ge(this,_c);ge(this,Id);ee(this,_c,[]),ee(this,Id,0)}get data(){return ri(V(this,_c))}get length(){return V(this,Id)}appendWriter(e){return Ge(this,Fg,ME).call(this,es(e.data))}writeBytes(e){let t=es(e);const i=t.length%ns;return i&&(t=es(ri([t,SI.slice(i)]))),Ge(this,Fg,ME).call(this,t)}writeValue(e){return Ge(this,Fg,ME).call(this,HF(e))}writeUpdatableValue(){const e=V(this,_c).length;return V(this,_c).push(SI),ee(this,Id,V(this,Id)+ns),t=>{V(this,_c)[e]=HF(t)}}}_c=new WeakMap,Id=new WeakMap,Fg=new WeakSet,ME=function(e){return V(this,_c).push(e),ee(this,Id,V(this,Id)+e.length),e.length};var _s,ro,Rd,Nd,uh,vp,PI,mj;const MU=class MU{constructor(e,t,i){ge(this,vp);ce(this,"allowLoose");ge(this,_s);ge(this,ro);ge(this,Rd);ge(this,Nd);ge(this,uh);vt(this,{allowLoose:!!t}),ee(this,_s,es(e)),ee(this,Rd,0),ee(this,Nd,null),ee(this,uh,i??1024),ee(this,ro,0)}get data(){return Ye(V(this,_s))}get dataLength(){return V(this,_s).length}get consumed(){return V(this,ro)}get bytes(){return new Uint8Array(V(this,_s))}subReader(e){const t=new MU(V(this,_s).slice(V(this,ro)+e),this.allowLoose,V(this,uh));return ee(t,Nd,this),t}readBytes(e,t){let i=Ge(this,vp,mj).call(this,0,e,!!t);return Ge(this,vp,PI).call(this,e),ee(this,ro,V(this,ro)+i.length),i.slice(0,e)}readValue(){return EO(this.readBytes(ns))}readIndex(){return Hae(this.readBytes(ns))}};_s=new WeakMap,ro=new WeakMap,Rd=new WeakMap,Nd=new WeakMap,uh=new WeakMap,vp=new WeakSet,PI=function(e){var t;if(V(this,Nd))return Ge(t=V(this,Nd),vp,PI).call(t,e);ee(this,Rd,V(this,Rd)+e),Ie(V(this,uh)<1||V(this,Rd)<=V(this,uh)*this.dataLength,`c
165ompressed ABI data exceeds inflation ratio of ${V(this,uh)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:es(V(this,_s)),offset:V(this,ro),length:e,info:{bytesRead:V(this,Rd),dataLength:this.dataLength}})},mj=function(e,t,i){let r=Math.ceil(t/ns)*ns;return V(this,ro)+r>V(this,_s).length&&(this.allowLoose&&i&&V(this,ro)+t<=V(this,_s).length?r=t:Ie(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:es(V(this,_s)),length:V(this,_s).length,offset:V(this,ro)+r})),V(this,_s).slice(V(this,ro),V(this,ro)+r)};let TI=MU;function RS(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function SO(n,...e){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(n.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${n.length}`)}function ole(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");RS(n.outputLen),RS(n.blockLen)}function C0(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function gj(n,e){SO(n);const t=e.outputLen;if(n.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}const nP=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const yj=n=>n instanceof Uint8Array,ale=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),iP=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),il=(n,e)=>n<<32-e|n>>>e,lle=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!lle)throw new Error("Non little-endian hardware is not supported");function cle(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function YA(n){if(typeof n=="string"&&(n=cle(n)),!yj(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function ule(...n){const e=new Uint8Array(n.reduce((i,r)=>i+r.length,0));let t=0;return n.forEach(i=>{if(!yj(i))throw new Error("Uint8Array expected");e.set(i,t),t+=i.length}),e}let AO=class{clone(){return this._cloneInto()}};function MO(n){const e=i=>n().update(YA(i)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function hle(n=32){if(nP&&typeof nP.getRandomValues=="function")return nP.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}let vj=class extends AO{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ole(e);const i=YA(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,s=new Uint8Array(r);s.set(i.length>r?e.create().update(i).digest():i);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=e.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),s.fill(0)}update(e){return C0(this),this.iHash.update(e),this}digestInto(e){C0(this),SO(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:i,finished:r,destroyed:s,blockLen:o,outputLen:a}=this;return e=e,e.finished=r,e.destroyed=s,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=i._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const wj=(n,e,t)=>new vj(n,e).update(t).digest();wj.create=(n,e)=>new vj(n,e);function fle(n,e,t,i){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,i);const r=BigInt(32),s=BigInt(4294967295),o=Number(t>>r&s),a=Number(t&s),l=i?4:0,c=i?0:4;n.setUint32(e+l,o,i),n.setUint32(e+c,a,i)}class xj extends AO{constructor(e,t,i,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=i,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=iP(this.buffer)}update(e){C0(this);const{view:t,buffer:i,blockLen:r}=this;e=YA(e);const s=e.length;for(let o=0;o<s;){const a=Math.min(r-this.pos,s-o);if(a===r){const l=iP(e);for(;r<=s-o;o+=r)this.process(l,o);continue}i.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){C0(this),gj(e,this),this.finished=!0;const{buffer:t,view:i,blockLen:r,isLE:s}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(i,0),o=0);for(let h=o;h<r;h++)t[h]=0;fle(i,r-8,BigInt(this.length*8),s),this.process(i,0);const a=iP(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<c;h++)a.setUint32(4*h,u[h],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const i=e.slice(0,t);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:i,length:r,finished:s,destroyed:o,pos:a}=this;return e.length=r,e.pos=a,e.finished=s,e.destroyed=o,r%t&&e.buffer.set(i),e}}const dle=(n,e,t)=>n&e^~n&t,ple=(n,e,t)=>n&e^n&t^e&t,mle=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756
vendor: 3,386 bytes, line 165
165734187,3204031479,3329325298]),Eu=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Su=new Uint32Array(64);let gle=class extends xj{constructor(){super(64,32,8,!1),this.A=Eu[0]|0,this.B=Eu[1]|0,this.C=Eu[2]|0,this.D=Eu[3]|0,this.E=Eu[4]|0,this.F=Eu[5]|0,this.G=Eu[6]|0,this.H=Eu[7]|0}get(){const{A:e,B:t,C:i,D:r,E:s,F:o,G:a,H:l}=this;return[e,t,i,r,s,o,a,l]}set(e,t,i,r,s,o,a,l){this.A=e|0,this.B=t|0,this.C=i|0,this.D=r|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,t){for(let h=0;h<16;h++,t+=4)Su[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){const f=Su[h-15],m=Su[h-2],g=il(f,7)^il(f,18)^f>>>3,v=il(m,17)^il(m,19)^m>>>10;Su[h]=v+Su[h-7]+g+Su[h-16]|0}let{A:i,B:r,C:s,D:o,E:a,F:l,G:c,H:u}=this;for(let h=0;h<64;h++){const f=il(a,6)^il(a,11)^il(a,25),m=u+f+dle(a,l,c)+mle[h]+Su[h]|0,v=(il(i,2)^il(i,13)^il(i,22))+ple(i,r,s)|0;u=c,c=l,l=a,a=o+m|0,o=s,s=r,r=i,i=m+v|0}i=i+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(i,r,s,o,a,l,c,u)}roundClean(){Su.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const bj=MO(()=>new gle),Bb=BigInt(2**32-1),CI=BigInt(32);function _j(n,e=!1){return e?{h:Number(n&Bb),l:Number(n>>CI&Bb)}:{h:Number(n>>CI&Bb)|0,l:Number(n&Bb)|0}}function Ej(n,e=!1){let t=new Uint32Array(n.length),i=new Uint32Array(n.length);for(let r=0;r<n.length;r++){const{h:s,l:o}=_j(n[r],e);[t[r],i[r]]=[s,o]}return[t,i]}const yle=(n,e)=>BigInt(n>>>0)<<CI|BigInt(e>>>0),vle=(n,e,t)=>n>>>t,wle=(n,e,t)=>n<<32-t|e>>>t,xle=(n,e,t)=>n>>>t|e<<32-t,ble=(n,e,t)=>n<<32-t|e>>>t,_le=(n,e,t)=>n<<64-t|e>>>t-32,Ele=(n,e,t)=>n>>>t-32|e<<64-t,Sle=(n,e)=>e,Ale=(n,e)=>n,Sj=(n,e,t)=>n<<t|e>>>32-t,Aj=(n,e,t)=>e<<t|n>>>32-t,Mj=(n,e,t)=>e<<t-32|n>>>64-t,Tj=(n,e,t)=>n<<t-32|e>>>64-t;function Mle(n,e,t,i){const r=(e>>>0)+(i>>>0);return{h:n+t+(r/2**32|0)|0,l:r|0}}const Tle=(n,e,t)=>(n>>>0)+(e>>>0)+(t>>>0),Ple=(n,e,t,i)=>e+t+i+(n/2**32|0)|0,Cle=(n,e,t,i)=>(n>>>0)+(e>>>0)+(t>>>0)+(i>>>0),Ile=(n,e,t,i,r)=>e+t+i+r+(n/2**32|0)|0,Rle=(n,e,t,i,r)=>(n>>>0)+(e>>>0)+(t>>>0)+(i>>>0)+(r>>>0),Nle=(n,e,t,i,r,s)=>e+t+i+r+s+(n/2**32|0)|0,Bt={fromBig:_j,split:Ej,toBig:yle,shrSH:vle,shrSL:wle,rotrSH:xle,rotrSL:ble,rotrBH:_le,rotrBL:Ele,rotr32H:Sle,rotr32L:Ale,rotlSH:Sj,rotlSL:Aj,rotlBH:Mj,rotlBL:Tj,add:Mle,add3L:Tle,add3H:Ple,add4L:Cle,add4H:Ile,add5H:Nle,add5L:Rle},[Dle,Ole]=Bt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
1655771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Au=new Uint32Array(80),Mu=new Uint32Array(80);class Lle extends xj{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:i,Bl:r,Ch:s,Cl:o,Dh:a,Dl:l,Eh:c,El:u,Fh:h,Fl:f,Gh:m,Gl:g,Hh:v,Hl:w}=this;return[e,t,i,r,s,o,a,l,c,u,h,f,m,g,v,w]}set(e,t,i,r,s,o,a,l,c,u,h,f,m,g,v,w){this.Ah=e|0,this.Al=t|0,this.Bh=i|0,this.Bl=r|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=c|0,this.El=u|0,this.Fh=h|0,this.Fl=f|0,this.Gh=m|0,this.Gl=g|0,this.Hh=v|0,this.Hl=w|0}process(e,t){for(let x=0;x<16;x++,t+=4)Au[x]=e.getUint32(t),Mu[x]=e.getUint32(t+=4);for(let x=16;x<80;x++){const S=Au[x-15]|0,M=Mu[x-15]|0,A=Bt.rotrSH(S,M,1)^Bt.rotrSH(S,M,8)^Bt.shrSH(S,M,7),I=Bt.rotrSL(S,M,1)^Bt.rotrSL(S,M,8)^Bt.shrSL(S,M,7),D=Au[x-2]|0,k=Mu[x-2]|0,C=Bt.rotrSH(D,k,19)^Bt.rotrBH(D,k,61)^Bt.shrSH(D,k,6),U=Bt.rotrSL(D,k,19)^Bt.rotrBL(D,k,61)^Bt.shrSL(D,k,6),G=Bt.add4L(I,U,Mu[x-7],Mu[x-16]),H=Bt.add4H(G,A,C,Au[x-7],Au[x-16]);Au[x]=H|0,Mu[x]=G|0}let{Ah:i,Al:r,Bh:s,Bl:o,Ch:a,Cl:l,Dh:c,Dl:u,Eh:h,El:f,Fh:m,Fl:g,Gh:v,Gl:w,Hh:y,Hl:_}=this;for(let x=0;x<80;
165x++){const S=Bt.rotrSH(h,f,14)^Bt.rotrSH(h,f,18)^Bt.rotrBH(h,f,41),M=Bt.rotrSL(h,f,14)^Bt.rotrSL(h,f,18)^Bt.rotrBL(h,f,41),A=h&m^~h&v,I=f&g^~f&w,D=Bt.add5L(_,M,I,Ole[x],Mu[x]),k=Bt.add5H(D,y,S,A,Dle[x],Au[x]),C=D|0,U=Bt.rotrSH(i,r,28)^Bt.rotrBH(i,r,34)^Bt.rotrBH(i,r,39),G=Bt.rotrSL(i,r,28)^Bt.rotrBL(i,r,34)^Bt.rotrBL(i,r,39),H=i&s^i&a^s&a,z=r&o^r&l^o&l;y=v|0,_=w|0,v=m|0,w=g|0,m=h|0,g=f|0,{h,l:f}=Bt.add(c|0,u|0,k|0,C|0),c=a|0,u=l|0,a=s|0,l=o|0,s=i|0,o=r|0;const P=Bt.add3L(C,G,z);i=Bt.add3H(P,k,U,H),r=P|0}({h:i,l:r}=Bt.add(this.Ah|0,this.Al|0,i|0,r|0)),{h:s,l:o}=Bt.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l}=Bt.add(this.Ch|0,this.Cl|0,a|0,l|0),{h:c,l:u}=Bt.add(this.Dh|0,this.Dl|0,c|0,u|0),{h,l:f}=Bt.add(this.Eh|0,this.El|0,h|0,f|0),{h:m,l:g}=Bt.add(this.Fh|0,this.Fl|0,m|0,g|0),{h:v,l:w}=Bt.add(this.Gh|0,this.Gl|0,v|0,w|0),{h:y,l:_}=Bt.add(this.Hh|0,this.Hl|0,y|0,_|0),this.set(i,r,s,o,a,l,c,u,h,f,m,g,v,w,y,_)}roundClean(){Au.fill(0),Mu.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Ule=MO(()=>new Lle);function Ble(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const $F=Ble();$F.crypto||$F.msCrypto;function kle(n){switch(n){case"sha256":return bj.create();case"sha512":return Ule.create()}ie(!1,"invalid hashing algorithm name","algorithm",n)}const[Pj,Cj,Ij]=[[],[],[]],Fle=BigInt(0),zy=BigInt(1),zle=BigInt(2),Vle=BigInt(7),Hle=BigInt(256),$le=BigInt(113);for(let n=0,e=zy,t=1,i=0;n<24;n++){[t,i]=[i,(2*t+3*i)%5],Pj.push(2*(5*i+t)),Cj.push((n+1)*(n+2)/2%64);let r=Fle;for(let s=0;s<7;s++)e=(e<<zy^(e>>Vle)*$le)%Hle,e&zle&&(r^=zy<<(zy<<BigInt(s))-zy);Ij.push(r)}const[Gle,jle]=Ej(Ij,!0),GF=(n,e,t)=>t>32?Mj(n,e,t):Sj(n,e,t),jF=(n,e,t)=>t>32?Tj(n,e,t):Aj(n,e,t);function Wle(n,e=24){const t=new Uint32Array(10);for(let i=24-e;i<24;i++){for(let o=0;o<10;o++)t[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,c=t[l],u=t[l+1],h=GF(c,u,1)^t[a],f=jF(c,u,1)^t[a+1];for(let m=0;m<50;m+=10)n[o+m]^=h,n[o+m+1]^=f}let r=n[2],s=n[3];for(let o=0;o<24;o++){const a=Cj[o],l=GF(r,s,a),c=jF(r,s,a),u=Pj[o];r=n[u],s=n[u+1],n[u]=l,n[u+1]=c}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)t[a]=n[o+a];for(let a=0;a<10;a++)n[o+a]^=~t[(a+2)%10]&t[(a+4)%10]}n[0]^=Gle[i],n[1]^=jle[i]}t.fill(0)}let qle=class Rj extends AO{constructor(e,t,i,r=!1,s=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=i,this.enableXOF=r,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,RS(i),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ale(this.state)}keccak(){Wle(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){C0(this);const{blockLen:t,state:i}=this;e=YA(e);const r=e.length;for(let s=0;s<r;){const o=Math.min(t-this.pos,r-s);for(let a=0;a<o;a++)i[this.pos++]^=e[s++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:i,blockLen:r}=this;e[i]^=t,t&128&&i===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){C0(this,!1),SO(e),this.finish();const t=this.state,{blockLen:i}=this;for(let r=0,s=e.length;r<s;){this.posOut>=i&&this.keccak();const o=Math.min(i-this.posOut,s-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return RS(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(gj(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:i,outputLen:r,rounds:s,enableXOF:o}=this;return e||(e=new Rj(t,i,r,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=i,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}};const Kle=(n,e,t)=>MO(()=>new qle(e,n,t)),Xle=Kle(1,136,256/8);let Nj=!1;const Dj=function(n){return Xle(n)};let Oj=Dj;function Si(n){const e=Gt(n,"data");return Ye(Oj(e))}Si._=Dj;Si.lock=function(){Nj=!0};Si.register=function(n){if(Nj)throw new TypeError("keccak256 is locked");Oj=n};Object.freeze(Si);const Lj=function(n){return kle("sha256").update(n).digest()};let Uj=Lj,Bj=!1;function Y0(n){const e=Gt(n,"data");return Ye(Uj(e))}Y0._=Lj;Y0.lock=function(){Bj=!0};Y0.register=function(n){if(Bj)throw new Error("sha256 is locked");Uj=n};Object.freeze(Y0);Object.freeze(Y0);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const kj=BigInt(0),QA=BigInt(1),Yle=BigInt(2),ZA=n=>n instanceof Uint8Array,Qle=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function I0(n){if(!ZA(n))throw new Error("Uint8Array expected");let e="";for(let t=0;t<n.length;t++)e+=Qle[n[t]];return e}function Fj(n){const e=n.toString(16);return e.length&1?`0${e}`:e}
165function TO(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}function R0(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const e=n.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const t=new Uint8Array(e/2);for(let i=0;i<t.length;i++){const r=i*2,s=n.slice(r,r+2),o=Number.parseInt(s,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[i]=o}return t}function qd(n){return TO(I0(n))}function PO(n){if(!ZA(n))throw new Error("Uint8Array expected");return TO(I0(Uint8Array.from(n).reverse()))}function N0(n,e){return R0(n.toString(16).padStart(e*2,"0"))}function CO(n,e){return N0(n,e).reverse()}function Zle(n){return R0(Fj(n))}function Ea(n,e,t){let i;if(typeof e=="string")try{i=R0(e)}catch(s){throw new Error(`${n} must be valid hex string, got "${e}". Cause: ${s}`)}else if(ZA(e))i=Uint8Array.from(e);else throw new Error(`${n} must be hex string or Uint8Array`);const r=i.length;if(typeof t=="number"&&r!==t)throw new Error(`${n} expected ${t} bytes, got ${r}`);return i}function Nw(...n){const e=new Uint8Array(n.reduce((i,r)=>i+r.length,0));let t=0;return n.forEach(i=>{if(!ZA(i))throw new Error("Uint8Array expected");e.set(i,t),t+=i.length}),e}function Jle(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function ece(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function tce(n){let e;for(e=0;n>kj;n>>=QA,e+=1);return e}function nce(n,e){return n>>BigInt(e)&QA}const ice=(n,e,t)=>n|(t?QA:kj)<<BigInt(e),IO=n=>(Yle<<BigInt(n-1))-QA,rP=n=>new Uint8Array(n),WF=n=>Uint8Array.from(n);function zj(n,e,t){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let i=rP(n),r=rP(n),s=0;const o=()=>{i.fill(1),r.fill(0),s=0},a=(...h)=>t(r,i,...h),l=(h=rP())=>{r=a(WF([0]),h),i=a(),h.length!==0&&(r=a(WF([1]),h),i=a())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const f=[];for(;h<e;){i=a();const m=i.slice();f.push(m),h+=i.length}return Nw(...f)};return(h,f)=>{o(),l(h);let m;for(;!(m=f(c()));)l();return o(),m}}const rce={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||n instanceof Uint8Array,isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function H1(n,e,t={}){const i=(r,s,o)=>{const a=rce[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const l=n[r];if(!(o&&l===void 0)&&!a(l,n))throw new Error(`Invalid param ${String(r)}=${l} (${typeof l}), expected ${s}`)};for(const[r,s]of Object.entries(e))i(r,s,!1);for(const[r,s]of Object.entries(t))i(r,s,!0);return n}const sce=Object.freeze(Object.defineProperty({__proto__:null,bitGet:nce,bitLen:tce,bitMask:IO,bitSet:ice,bytesToHex:I0,bytesToNumberBE:qd,bytesToNumberLE:PO,concatBytes:Nw,createHmacDrbg:zj,ensureBytes:Ea,equalBytes:Jle,hexToBytes:R0,hexToNumber:TO,numberToBytesBE:N0,numberToBytesLE:CO,numberToHexUnpadded:Fj,numberToVarBytesBE:Zle,utf8ToBytes:ece,validateObject:H1},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xi=BigInt(0),di=BigInt(1),Zf=BigInt(2),oce=BigInt(3),II=BigInt(4),qF=BigInt(5),KF=BigInt(8);BigInt(9);BigInt(16);function Ss(n,e){const t=n%e;return t>=Xi?t:e+t}function ace(n,e,t){if(t<=Xi||e<Xi)throw new Error("Expected power/modulo > 0");if(t===di)return Xi;let i=di;for(;e>Xi;)e&di&&(i=i*n%t),n=n*n%t,e>>=di;return i}function Uo(n,e,t){let i=n;for(;e-- >Xi;)i*=i,i%=t;return i}function RI(n,e){if(n===Xi||e<=Xi)throw new Error(`invert: expected positive integers, got n=${n} mod=${e}`);let t=Ss(n,e),i=e,r=Xi,s=di;for(;t!==Xi;){const a=i/t,l=i%t,c=r-s*a;i=t,t=l,r=s,s=c}if(i!==di)throw new Error("invert: does not exist");return Ss(r,e)}function lce(n){const e=(n-di)/Zf;let t,i,r;for(t=n-di,i=0;t%Zf===Xi;t/=Zf,i++);for(r=Zf;r<n&&ace(r,e,n)!==n-di;r++);if(i===1){const o=(n+di)/II;return function(l,c){const u=l.pow(c,o);if(!l.eql(l.sqr(u),c))throw new Error("Cannot find square root");return u}}const s=(t+di)/Zf;return function(a,l){if(a.pow(l,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let c=i,u=a.pow(a.mul(a.ONE,r),t),h=a.pow(l,s),f=a.pow(l,t);for(;!a.eql(f,a.ONE);){if(a.eql(f,a.ZERO))return a.ZERO;let m=1;for(let v=a.sqr(f);m<c&&!a.eql(v,a.ONE);m++)v=a.sqr(v);const g=a.pow(u,di<<BigInt(c-m-1));u=a.sqr(g),h=a.mul(h,g),f=a.mul(f,u),c=m}return h}}function cce(n){if(n%II===oce){const e=(n+di)/II;return function(i,r){const s=i.pow(r,e);if(!i.eql(i.sqr(s),r))throw new Error("Cannot find square root");return s}}if(n%KF===qF){const e=(n-qF)/KF;return function(i,r){const s=i.mul(r,Zf),o=i.pow(s,e),a=i.mul(r,o),l=i.mul(i.mul(a,Zf),o),c=i.mul(a,i.sub(l,i.ONE));if(!i.eql(i.sqr(c),r))throw new Error("Cannot find square root");return c}}return lce(n)}const uce=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function hce(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=uce.reduce((i,r)=>(i[r]="function",i),e);return H1(n,t)}function fce(n,e,t){if(t<Xi)throw new Error("Expected power > 0");if(t===Xi)return n.ONE;if(t===di)return e;let i=n.ONE,r=e;for(;t>Xi;)t&di&&(i=n.mul(i,r)),r=n.sqr(r),t>>=di;return i}function dce(n,e){const t=new Array(e.length),i=e.reduce((s,o,a)=>n.is0(o)?s:(t[a]=s,n.mul(s,o)),n.ONE),r=n.inv(i);return e.reduceRight((s,o,a)=>n.is0(o)?s:(t[a]=n.mul(s,t[a]),n.mul(s,o)),r),t}function Vj(n,e){const t=e!==void 0?e:n.toString(2).length,i=Math.ceil(t/8);return{nBitLength:t,nByteLength:i}}function pce(n,e,t=!1,i={}){if(n<=Xi)throw new Error(`Expected Field ORDER > 0, got ${n}`);const{nBitLength:r,nByteLength:s}=Vj(n,e);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=cce(n),a=Object.freeze({ORDER:n,BITS:r,BYTES:s,MASK:IO(r),ZERO:Xi,ONE:di,create:l=>Ss(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return Xi<=l&&l<n},is0:l=>l===Xi,isOdd:l=>(l&di)===di,neg:l=>Ss(-l,n),eql:(l,c)=>l===c,sqr:l=>
165Ss(l*l,n),add:(l,c)=>Ss(l+c,n),sub:(l,c)=>Ss(l-c,n),mul:(l,c)=>Ss(l*c,n),pow:(l,c)=>fce(a,l,c),div:(l,c)=>Ss(l*RI(c,n),n),sqrN:l=>l*l,addN:(l,c)=>l+c,subN:(l,c)=>l-c,mulN:(l,c)=>l*c,inv:l=>RI(l,n),sqrt:i.sqrt||(l=>o(a,l)),invertBatch:l=>dce(a,l),cmov:(l,c,u)=>u?c:l,toBytes:l=>t?CO(l,s):N0(l,s),fromBytes:l=>{if(l.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${l.length}`);return t?PO(l):qd(l)}});return Object.freeze(a)}function Hj(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function $j(n){const e=Hj(n);return e+Math.ceil(e/2)}function mce(n,e,t=!1){const i=n.length,r=Hj(e),s=$j(e);if(i<16||i<s||i>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${i}`);const o=t?qd(n):PO(n),a=Ss(o,e-di)+di;return t?CO(a,r):N0(a,r)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gce=BigInt(0),sP=BigInt(1);function yce(n,e){const t=(r,s)=>{const o=s.negate();return r?o:s},i=r=>{const s=Math.ceil(e/r)+1,o=2**(r-1);return{windows:s,windowSize:o}};return{constTimeNegate:t,unsafeLadder(r,s){let o=n.ZERO,a=r;for(;s>gce;)s&sP&&(o=o.add(a)),a=a.double(),s>>=sP;return o},precomputeWindow(r,s){const{windows:o,windowSize:a}=i(s),l=[];let c=r,u=c;for(let h=0;h<o;h++){u=c,l.push(u);for(let f=1;f<a;f++)u=u.add(c),l.push(u);c=u.double()}return l},wNAF(r,s,o){const{windows:a,windowSize:l}=i(r);let c=n.ZERO,u=n.BASE;const h=BigInt(2**r-1),f=2**r,m=BigInt(r);for(let g=0;g<a;g++){const v=g*l;let w=Number(o&h);o>>=m,w>l&&(w-=f,o+=sP);const y=v,_=v+Math.abs(w)-1,x=g%2!==0,S=w<0;w===0?u=u.add(t(x,s[y])):c=c.add(t(S,s[_]))}return{p:c,f:u}},wNAFCached(r,s,o,a){const l=r._WINDOW_SIZE||1;let c=s.get(r);return c||(c=this.precomputeWindow(r,l),l!==1&&s.set(r,a(c))),this.wNAF(l,c,o)}}}function Gj(n){return hce(n.Fp),H1(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Vj(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function vce(n){const e=Gj(n);H1(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:i,a:r}=e;if(t){if(!i.eql(r,i.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:wce,hexToBytes:xce}=sce,hd={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(n){const{Err:e}=hd;if(n.length<2||n[0]!==2)throw new e("Invalid signature integer tag");const t=n[1],i=n.subarray(2,t+2);if(!t||i.length!==t)throw new e("Invalid signature integer: wrong length");if(i[0]&128)throw new e("Invalid signature integer: negative");if(i[0]===0&&!(i[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:wce(i),l:n.subarray(t+2)}},toSig(n){const{Err:e}=hd,t=typeof n=="string"?xce(n):n;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let i=t.length;if(i<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==i-2)throw new e("Invalid signature: incorrect length");const{d:r,l:s}=hd._parseInt(t.subarray(2)),{d:o,l:a}=hd._parseInt(s);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r,s:o}},hexFromSig(n){const e=c=>Number.parseInt(c[0],16)&8?"00"+c:c,t=c=>{const u=c.toString(16);return u.length&1?`0${u}`:u},i=e(t(n.s)),r=e(t(n.r)),s=i.length/2,o=r.length/2,a=t(s),l=t(o);return`30${t(o+s+4)}02${l}${r}02${a}${i}`}},Rc=BigInt(0),Yo=BigInt(1);BigInt(2);const XF=BigInt(3);BigInt(4);function bce(n){const e=vce(n),{Fp:t}=e,i=e.toBytes||((g,v,w)=>{const y=v.toAffine();return Nw(Uint8Array.from([4]),t.toBytes(y.x),t.toBytes(y.y))}),r=e.fromBytes||(g=>{const v=g.subarray(1),w=t.fromBytes(v.subarray(0,t.BYTES)),y=t.fromBytes(v.subarray(t.BYTES,2*t.BYTES));return{x:w,y}});function s(g){const{a:v,b:w}=e,y=t.sqr(g),_=t.mul(y,g);return t.add(t.add(_,t.mul(g,v)),w)}if(!t.eql(t.sqr(e.Gy),s(e.Gx)))throw new Error("bad generator point: equation left != right");function o(g){return typeof g=="bigint"&&Rc<g&&g<e.n}function a(g){if(!o(g))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(g){const{allowedPrivateKeyLengths:v,nByteLength:w,wrapPrivateKey:y,n:_}=e;if(v&&typeof g!="bigint"){if(g instanceof Uint8Array&&(g=I0(g)),typeof g!="string"||!v.includes(g.length))throw new Error("Invalid key");g=g.padStart(w*2,"0")}let x;try{x=typeof g=="bigint"?g:qd(Ea("private key",g,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof g}`)}return y&&(x=Ss(x,_)),a(x),x}const c=new Map;function u(g){if(!(g instanceof h))throw new Error("ProjectivePoint expected")}
vendor: 4,096 bytes, line 165
165class h{constructor(v,w,y){if(this.px=v,this.py=w,this.pz=y,v==null||!t.isValid(v))throw new Error("x required");if(w==null||!t.isValid(w))throw new Error("y required");if(y==null||!t.isValid(y))throw new Error("z required")}static fromAffine(v){const{x:w,y}=v||{};if(!v||!t.isValid(w)||!t.isValid(y))throw new Error("invalid affine point");if(v instanceof h)throw new Error("projective point not allowed");const _=x=>t.eql(x,t.ZERO);return _(w)&&_(y)?h.ZERO:new h(w,y,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(v){const w=t.invertBatch(v.map(y=>y.pz));return v.map((y,_)=>y.toAffine(w[_])).map(h.fromAffine)}static fromHex(v){const w=h.fromAffine(r(Ea("pointHex",v)));return w.assertValidity(),w}static fromPrivateKey(v){return h.BASE.multiply(l(v))}_setWindowSize(v){this._WINDOW_SIZE=v,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:v,y:w}=this.toAffine();if(!t.isValid(v)||!t.isValid(w))throw new Error("bad point: x or y not FE");const y=t.sqr(w),_=s(v);if(!t.eql(y,_))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:v}=this.toAffine();if(t.isOdd)return!t.isOdd(v);throw new Error("Field doesn't support isOdd")}equals(v){u(v);const{px:w,py:y,pz:_}=this,{px:x,py:S,pz:M}=v,A=t.eql(t.mul(w,M),t.mul(x,_)),I=t.eql(t.mul(y,M),t.mul(S,_));return A&&I}negate(){return new h(this.px,t.neg(this.py),this.pz)}double(){const{a:v,b:w}=e,y=t.mul(w,XF),{px:_,py:x,pz:S}=this;let M=t.ZERO,A=t.ZERO,I=t.ZERO,D=t.mul(_,_),k=t.mul(x,x),C=t.mul(S,S),U=t.mul(_,x);return U=t.add(U,U),I=t.mul(_,S),I=t.add(I,I),M=t.mul(v,I),A=t.mul(y,C),A=t.add(M,A),M=t.sub(k,A),A=t.add(k,A),A=t.mul(M,A),M=t.mul(U,M),I=t.mul(y,I),C=t.mul(v,C),U=t.sub(D,C),U=t.mul(v,U),U=t.add(U,I),I=t.add(D,D),D=t.add(I,D),D=t.add(D,C),D=t.mul(D,U),A=t.add(A,D),C=t.mul(x,S),C=t.add(C,C),D=t.mul(C,U),M=t.sub(M,D),I=t.mul(C,k),I=t.add(I,I),I=t.add(I,I),new h(M,A,I)}add(v){u(v);const{px:w,py:y,pz:_}=this,{px:x,py:S,pz:M}=v;let A=t.ZERO,I=t.ZERO,D=t.ZERO;const k=e.a,C=t.mul(e.b,XF);let U=t.mul(w,x),G=t.mul(y,S),H=t.mul(_,M),z=t.add(w,y),P=t.add(x,S);z=t.mul(z,P),P=t.add(U,G),z=t.sub(z,P),P=t.add(w,_);let R=t.add(x,M);return P=t.mul(P,R),R=t.add(U,H),P=t.sub(P,R),R=t.add(y,_),A=t.add(S,M),R=t.mul(R,A),A=t.add(G,H),R=t.sub(R,A),D=t.mul(k,P),A=t.mul(C,H),D=t.add(A,D),A=t.sub(G,D),D=t.add(G,D),I=t.mul(A,D),G=t.add(U,U),G=t.add(G,U),H=t.mul(k,H),P=t.mul(C,P),G=t.add(G,H),H=t.sub(U,H),H=t.mul(k,H),P=t.add(P,H),U=t.mul(G,P),I=t.add(I,U),U=t.mul(R,P),A=t.mul(z,A),A=t.sub(A,U),U=t.mul(z,G),D=t.mul(R,D),D=t.add(D,U),new h(A,I,D)}subtract(v){return this.add(v.negate())}is0(){return this.equals(h.ZERO)}wNAF(v){return m.wNAFCached(this,c,v,w=>{const y=t.invertBatch(w.map(_=>_.pz));return w.map((_,x)=>_.toAffine(y[x])).map(h.fromAffine)})}multiplyUnsafe(v){const w=h.ZERO;if(v===Rc)return w;if(a(v),v===Yo)return this;const{endo:y}=e;if(!y)return m.unsafeLadder(this,v);let{k1neg:_,k1:x,k2neg:S,k2:M}=y.splitScalar(v),A=w,I=w,D=this;for(;x>Rc||M>Rc;)x&Yo&&(A=A.add(D)),M&Yo&&(I=I.add(D)),D=D.double(),x>>=Yo,M>>=Yo;return _&&(A=A.negate()),S&&(I=I.negate()),I=new h(t.mul(I.px,y.beta),I.py,I.pz),A.add(I)}multiply(v){a(v);let w=v,y,_;const{endo:x}=e;if(x){const{k1neg:S,k1:M,k2neg:A,k2:I}=x.splitScalar(w);let{p:D,f:k}=this.wNAF(M),{p:C,f:U}=this.wNAF(I);D=m.constTimeNegate(S,D),C=m.constTimeNegate(A,C),C=new h(t.mul(C.px,x.beta),C.py,C.pz),y=D.add(C),_=k.add(U)}else{const{p:S,f:M}=this.wNAF(w);y=S,_=M}return h.normalizeZ([y,_])[0]}multiplyAndAddUnsafe(v,w,y){const _=h.BASE,x=(M,A)=>A===Rc||A===Yo||!M.equals(_)?M.multiplyUnsafe(A):M.multiply(A),S=x(this,w).add(x(v,y));return S.is0()?void 0:S}toAffine(v){const{px:w,py:y,pz:_}=this,x=this.is0();v==null&&(v=x?t.ONE:t.inv(_));const S=t.mul(w,v),M=t.mul(y,v),A=t.mul(_,v);if(x)return{x:t.ZERO,y:t.ZERO};if(!t.eql(A,t.ONE))throw new Error("invZ was invalid");return{x:S,y:M}}isTorsionFree(){const{h:v,isTorsionFree:w}=e;if(v===Yo)return!0;
165if(w)return w(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:v,clearCofactor:w}=e;return v===Yo?this:w?w(h,this):this.multiplyUnsafe(e.h)}toRawBytes(v=!0){return this.assertValidity(),i(h,this,v)}toHex(v=!0){return I0(this.toRawBytes(v))}}h.BASE=new h(e.Gx,e.Gy,t.ONE),h.ZERO=new h(t.ZERO,t.ONE,t.ZERO);const f=e.nBitLength,m=yce(h,e.endo?Math.ceil(f/2):f);return{CURVE:e,ProjectivePoint:h,normPrivateKeyToScalar:l,weierstrassEquation:s,isWithinCurveOrder:o}}function _ce(n){const e=Gj(n);return H1(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function Ece(n){const e=_ce(n),{Fp:t,n:i}=e,r=t.BYTES+1,s=2*t.BYTES+1;function o(P){return Rc<P&&P<t.ORDER}function a(P){return Ss(P,i)}function l(P){return RI(P,i)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:h,isWithinCurveOrder:f}=bce({...e,toBytes(P,R,F){const N=R.toAffine(),O=t.toBytes(N.x),B=Nw;return F?B(Uint8Array.from([R.hasEvenY()?2:3]),O):B(Uint8Array.from([4]),O,t.toBytes(N.y))},fromBytes(P){const R=P.length,F=P[0],N=P.subarray(1);if(R===r&&(F===2||F===3)){const O=qd(N);if(!o(O))throw new Error("Point is not on curve");const B=h(O);let W=t.sqrt(B);const Q=(W&Yo)===Yo;return(F&1)===1!==Q&&(W=t.neg(W)),{x:O,y:W}}else if(R===s&&F===4){const O=t.fromBytes(N.subarray(0,t.BYTES)),B=t.fromBytes(N.subarray(t.BYTES,2*t.BYTES));return{x:O,y:B}}else throw new Error(`Point of length ${R} was invalid. Expected ${r} compressed bytes or ${s} uncompressed bytes`)}}),m=P=>I0(N0(P,e.nByteLength));function g(P){const R=i>>Yo;return P>R}function v(P){return g(P)?a(-P):P}const w=(P,R,F)=>qd(P.slice(R,F));class y{constructor(R,F,N){this.r=R,this.s=F,this.recovery=N,this.assertValidity()}static fromCompact(R){const F=e.nByteLength;return R=Ea("compactSignature",R,F*2),new y(w(R,0,F),w(R,F,2*F))}static fromDER(R){const{r:F,s:N}=hd.toSig(Ea("DER",R));return new y(F,N)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(R){return new y(this.r,this.s,R)}recoverPublicKey(R){const{r:F,s:N,recovery:O}=this,B=I(Ea("msgHash",R));if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");const W=O===2||O===3?F+e.n:F;if(W>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const Q=O&1?"03":"02",oe=c.fromHex(Q+m(W)),Y=l(W),te=a(-B*Y),le=a(N*Y),ve=c.BASE.multiplyAndAddUnsafe(oe,te,le);if(!ve)throw new Error("point at infinify");return ve.assertValidity(),ve}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return R0(this.toDERHex())}toDERHex(){return hd.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return R0(this.toCompactHex())}toCompactHex(){return m(this.r)+m(this.s)}}const _={isValidPrivateKey(P){try{return u(P),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const P=$j(e.n);return mce(e.randomBytes(P),e.n)},precompute(P=8,R=c.BASE){return R._setWindowSize(P),R.multiply(BigInt(3)),R}};function x(P,R=!0){return c.fromPrivateKey(P).toRawBytes(R)}function S(P){const R=P instanceof Uint8Array,F=typeof P=="string",N=(R||F)&&P.length;return R?N===r||N===s:F?N===2*r||N===2*s:P instanceof c}function M(P,R,F=!0){if(S(P))throw new Error("first arg must be private key");if(!S(R))throw new Error("second arg must be public key");return c.fromHex(R).multiply(u(P)).toRawBytes(F)}const A=e.bits2int||function(P){const R=qd(P),F=P.length*8-e.nBitLength;return F>0?R>>BigInt(F):R},I=e.bits2int_modN||function(P){return a(A(P))},D=IO(e.nBitLength);function k(P){if(typeof P!="bigint")throw new Error("bigint expected");if(!(Rc<=P&&P<D))throw new Error(`bigint expected < 2^${e.nBitLength}`);return N0(P,e.nByteLength)}function C(P,R,F=U){if(["recovered","canonical"].some(be=>be in F))throw new Error("sign() legacy options not supported");const{hash:N,randomBytes:O}=e;let{lowS:B,prehash:W,extraEntropy:Q}=F;B==null&&(B=!0),P=Ea("msgHash",P),W&&(P=Ea("prehashed msgHash",N(P)));const oe=I(P),Y=u(R),te=[k(Y),k(oe)];if(Q!=null){const be=Q===!0?O(t.BYTES):Q;te.push(Ea("extraEntropy",be))}const le=Nw(...te),ve=oe;function Te(be){const Le=A(be);if(!f(Le))return;const Oe=l(Le),J=c.BASE.multiply(Le).toAffine(),Se=a(J.x);if(Se===Rc)return;const me=a(Oe*a(ve+Se*Y));if(me===Rc)return;let Re=(J.x===Se?0:2)|Number(J.y&Yo),Ae=me;return B&&g(me)&&(Ae=v(me),Re^=1),new y(Se,Ae,Re)}return{seed:le,k2sig:Te}}const U={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function H(P,R,F=U){const{seed:N,k2sig:O}=C(P,R,F),B=e;return zj(B.hash.outputLen,B.nByteLength,B.hmac)(N,O)}c.BASE._setWindowSize(8);function z(P,R,F,N=G){var J;const O=P;if(R=Ea("msgHash",R),F=Ea("publicKey",F),"strict"in N)throw new Error("options.strict was renamed to lowS");const{lowS:B,prehash:W}=N;let Q,oe;try{if(typeof O=="string"||O instanceof Uint8Array)try{Q=y.fromDER(O)}catch(Se){if(!(Se instanceof hd.Err))throw Se;Q=y.fromCompact(O)}else if(typeof O=="object"&&typeof O.r=="bigint"&&typeof O.s=="bigint"){const{r:Se,s:me}=O;Q=new y(Se,me)}else throw new Error("PARSE");
165oe=c.fromHex(F)}catch(Se){if(Se.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(B&&Q.hasHighS())return!1;W&&(R=e.hash(R));const{r:Y,s:te}=Q,le=I(R),ve=l(te),Te=a(le*ve),be=a(Y*ve),Le=(J=c.BASE.multiplyAndAddUnsafe(oe,Te,be))==null?void 0:J.toAffine();return Le?a(Le.x)===Y:!1}return{CURVE:e,getPublicKey:x,getSharedSecret:M,sign:H,verify:z,ProjectivePoint:c,Signature:y,utils:_}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Sce(n){return{hash:n,hmac:(e,...t)=>wj(n,e,ule(...t)),randomBytes:hle}}function Ace(n,e){const t=i=>Ece({...n,...Sce(i)});return Object.freeze({...t(e),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const jj=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),YF=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Mce=BigInt(1),NI=BigInt(2),QF=(n,e)=>(n+e/NI)/e;function Tce(n){const e=jj,t=BigInt(3),i=BigInt(6),r=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),c=n*n*n%e,u=c*c*n%e,h=Uo(u,t,e)*u%e,f=Uo(h,t,e)*u%e,m=Uo(f,NI,e)*c%e,g=Uo(m,r,e)*m%e,v=Uo(g,s,e)*g%e,w=Uo(v,a,e)*v%e,y=Uo(w,l,e)*w%e,_=Uo(y,a,e)*v%e,x=Uo(_,t,e)*u%e,S=Uo(x,o,e)*g%e,M=Uo(S,i,e)*c%e,A=Uo(M,NI,e);if(!DI.eql(DI.sqr(A),n))throw new Error("Cannot find square root");return A}const DI=pce(jj,void 0,void 0,{sqrt:Tce}),Xu=Ace({a:BigInt(0),b:BigInt(7),Fp:DI,n:YF,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=YF,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),i=-Mce*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),r=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=t,o=BigInt("0x100000000000000000000000000000000"),a=QF(s*n,e),l=QF(-i*n,e);let c=Ss(n-a*t-l*r,e),u=Ss(-a*i-l*s,e);const h=c>o,f=u>o;if(h&&(c=e-c),f&&(u=e-u),c>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:h,k1:c,k2neg:f,k2:u}}}},bj);BigInt(0);Xu.ProjectivePoint;const Dw="0x0000000000000000000000000000000000000000",ZF="0x0000000000000000000000000000000000000000000000000000000000000000",JF=BigInt(0),e8=BigInt(1),t8=BigInt(2),n8=BigInt(27),i8=BigInt(28),kb=BigInt(35),Qp={};function r8(n){return tu(Ri(n),32)}var zg,ml,Vg,Dd;const ba=class ba{constructor(e,t,i,r){ge(this,zg);ge(this,ml);ge(this,Vg);ge(this,Dd);qA(e,Qp,"Signature"),ee(this,zg,t),ee(this,ml,i),ee(this,Vg,r),ee(this,Dd,null)}get r(){return V(this,zg)}
165set r(e){ie(bg(e)===32,"invalid r","value",e),ee(this,zg,Ye(e))}get s(){return ie(parseInt(V(this,ml).substring(0,3))<8,"non-canonical s; use ._s","s",V(this,ml)),V(this,ml)}set s(e){ie(bg(e)===32,"invalid s","value",e),ee(this,ml,Ye(e))}get _s(){return V(this,ml)}isValid(){return parseInt(V(this,ml).substring(0,3))<8}get v(){return V(this,Vg)}set v(e){const t=jt(e,"value");ie(t===27||t===28,"invalid v","v",e),ee(this,Vg,t)}get networkV(){return V(this,Dd)}get legacyChainId(){const e=this.networkV;return e==null?null:ba.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=Gt(this.s);return this.yParity&&(e[0]|=128),Ye(e)}get compactSerialized(){return ri([this.r,this.yParityAndS])}get serialized(){return ri([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this._s}"${this.isValid()?"":', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new ba(Qp,this.r,this._s,this.v);return this.networkV&&ee(e,Dd,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this._s,v:this.v}}static getChainId(e){const t=ot(e,"v");return t==n8||t==i8?JF:(ie(t>=kb,"invalid EIP-155 v","v",e),(t-kb)/t8)}static getChainIdV(e,t){return ot(e)*t8+BigInt(35+t-27)}static getNormalizedV(e){const t=ot(e);return t===JF||t===n8?27:t===e8||t===i8?28:(ie(t>=kb,"invalid v","v",e),t&e8?27:28)}static from(e){function t(c,u){ie(c,u,"signature",e)}if(e==null)return new ba(Qp,ZF,ZF,27);if(typeof e=="string"){const c=Gt(e,"signature");if(c.length===64){const u=Ye(c.slice(0,32)),h=c.slice(32,64),f=h[0]&128?28:27;return h[0]&=127,new ba(Qp,u,Ye(h),f)}if(c.length===65){const u=Ye(c.slice(0,32)),h=Ye(c.slice(32,64)),f=ba.getNormalizedV(c[64]);return new ba(Qp,u,h,f)}t(!1,"invalid raw signature length")}if(e instanceof ba)return e.clone();const i=e.r;t(i!=null,"missing r");const r=r8(i),s=function(c,u){if(c!=null)return r8(c);if(u!=null){t(Cn(u,32),"invalid yParityAndS");const h=Gt(u);return h[0]&=127,Ye(h)}t(!1,"missing s")}(e.s,e.yParityAndS),{networkV:o,v:a}=function(c,u,h){if(c!=null){const f=ot(c);return{networkV:f>=kb?f:void 0,v:ba.getNormalizedV(f)}}if(u!=null)return t(Cn(u,32),"invalid yParityAndS"),{v:Gt(u)[0]&128?28:27};if(h!=null){switch(jt(h,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),l=new ba(Qp,r,s,a);return o&&ee(l,Dd,o),t(e.yParity==null||jt(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),t(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}};zg=new WeakMap,ml=new WeakMap,Vg=new WeakMap,Dd=new WeakMap;let Us=ba;var Ec;const rd=class rd{constructor(e){ge(this,Ec);
165ie(bg(e)===32,"invalid private key","privateKey","[REDACTED]"),ee(this,Ec,Ye(e))}get privateKey(){return V(this,Ec)}get publicKey(){return rd.computePublicKey(V(this,Ec))}get compressedPublicKey(){return rd.computePublicKey(V(this,Ec),!0)}sign(e){ie(bg(e)===32,"invalid digest length","digest",e);const t=Xu.sign(es(e),es(V(this,Ec)),{lowS:!0});return Us.from({r:jh(t.r,32),s:jh(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=rd.computePublicKey(e);return Ye(Xu.getSharedSecret(es(V(this,Ec)),Gt(t),!1))}static computePublicKey(e,t){let i=Gt(e,"key");if(i.length===32){const s=Xu.getPublicKey(i,!!t);return Ye(s)}if(i.length===64){const s=new Uint8Array(65);s[0]=4,s.set(i,1),i=s}const r=Xu.ProjectivePoint.fromHex(i);return Ye(r.toRawBytes(t))}static recoverPublicKey(e,t){ie(bg(e)===32,"invalid digest length","digest",e);const i=Us.from(t);let r=Xu.Signature.fromCompact(es(ri([i.r,i.s])));r=r.addRecoveryBit(i.yParity);const s=r.recoverPublicKey(es(e));return ie(s!=null,"invalid signature for digest","signature",t),"0x"+s.toHex(!1)}static addPoints(e,t,i){const r=Xu.ProjectivePoint.fromHex(rd.computePublicKey(e).substring(2)),s=Xu.ProjectivePoint.fromHex(rd.computePublicKey(t).substring(2));return"0x"+r.add(s).toHex(!!i)}};Ec=new WeakMap;let Ow=rd;const Pce=BigInt(0),Cce=BigInt(36);function s8(n){n=n.toLowerCase();const e=n.substring(2).split(""),t=new Uint8Array(40);for(let r=0;r<40;r++)t[r]=e[r].charCodeAt(0);const i=Gt(Si(t));for(let r=0;r<40;r+=2)i[r>>1]>>4>=8&&(e[r]=e[r].toUpperCase()),(i[r>>1]&15)>=8&&(e[r+1]=e[r+1].toUpperCase());return"0x"+e.join("")}const RO={};for(let n=0;n<10;n++)RO[String(n)]=String(n);for(let n=0;n<26;n++)RO[String.fromCharCode(65+n)]=String(10+n);const o8=15;function Ice(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(i=>RO[i]).join("");for(;e.length>=o8;){let i=e.substring(0,o8);e=parseInt(i,10)%97+e.substring(i.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}const Rce=function(){const n={};for(let e=0;e<36;e++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[e];n[t]=BigInt(e)}return n}();function Nce(n){n=n.toLowerCase();let e=Pce;for(let t=0;t<n.length;t++)e=e*Cce+Rce[n[t]];return e}function hn(n){if(ie(typeof n=="string","invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/)){n.startsWith("0x")||(n="0x"+n);const e=s8(n);return ie(!n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===n,"bad address checksum","address",n),e}if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){ie(n.substring(2,4)===Ice(n),"bad icap checksum","address",n);let e=Nce(n.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return s8("0x"+e)}ie(!1,"invalid address","address",n)}function Dce(n){const e=hn(n.from);let i=ot(n.nonce,"tx.nonce").toString(16);return i==="0"?i="0x":i.length%2?i="0x0"+i:i="0x"+i,hn(ti(Si(qh([e,i])),12))}function Wj(n){return n&&typeof n.getAddress=="function"}async function oP(n,e){const t=await e;return(t==null||t==="0x0000000000000000000000000000000000000000")&&(Ie(typeof n!="string","unconfigured name","UNCONFIGURED_NAME",{value:n}),ie(!1,"invalid AddressLike value; did not resolve to a value address","target",n)),hn(t)}function is(n,e){if(typeof n=="string")return n.match(/^0x[0-9a-f]{40}$/i)?hn(n):(Ie(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),oP(n,e.resolveName(n)));if(Wj(n))return oP(n,n.getAddress());if(n&&typeof n.then=="function")return oP(n,n);ie(!1,"unsupported addressable value","target",n)}const fc={};function nt(n,e){let t=!1;return e<0&&(t=!0,e*=-1),new Hr(fc,`${t?"":"u"}int${e}`,n,{signed:t,width:e})}function rn(n,e){return new Hr(fc,`bytes${e||""}`,n,{size:e})}const a8=Symbol.for("_ethers_typed");var Od;const mc=class mc{constructor(e,t,i,r){ce(this,"type");ce(this,"value");ge(this,Od);ce(this,"_typedSymbol");r==null&&(r=null),qA(fc,e,"Typed"),vt(this,{_typedSymbol:a8,type:t,value:i}),ee(this,Od,r),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")}
165)`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return V(this,Od)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return V(this,Od)===!0?-1:V(this,Od)===!1?this.value.length:null}static from(e,t){return new mc(fc,e,t)}static uint8(e){return nt(e,8)}static uint16(e){return nt(e,16)}static uint24(e){return nt(e,24)}static uint32(e){return nt(e,32)}static uint40(e){return nt(e,40)}static uint48(e){return nt(e,48)}static uint56(e){return nt(e,56)}static uint64(e){return nt(e,64)}static uint72(e){return nt(e,72)}static uint80(e){return nt(e,80)}static uint88(e){return nt(e,88)}static uint96(e){return nt(e,96)}static uint104(e){return nt(e,104)}static uint112(e){return nt(e,112)}static uint120(e){return nt(e,120)}static uint128(e){return nt(e,128)}static uint136(e){return nt(e,136)}static uint144(e){return nt(e,144)}static uint152(e){return nt(e,152)}static uint160(e){return nt(e,160)}static uint168(e){return nt(e,168)}static uint176(e){return nt(e,176)}static uint184(e){return nt(e,184)}static uint192(e){return nt(e,192)}static uint200(e){return nt(e,200)}static uint208(e){return nt(e,208)}static uint216(e){return nt(e,216)}static uint224(e){return nt(e,224)}static uint232(e){return nt(e,232)}static uint240(e){return nt(e,240)}static uint248(e){return nt(e,248)}static uint256(e){return nt(e,256)}static uint(e){return nt(e,256)}static int8(e){return nt(e,-8)}static int16(e){return nt(e,-16)}static int24(e){return nt(e,-24)}static int32(e){return nt(e,-32)}static int40(e){return nt(e,-40)}static int48(e){return nt(e,-48)}static int56(e){return nt(e,-56)}static int64(e){return nt(e,-64)}static int72(e){return nt(e,-72)}static int80(e){return nt(e,-80)}static int88(e){return nt(e,-88)}static int96(e){return nt(e,-96)}static int104(e){return nt(e,-104)}static int112(e){return nt(e,-112)}static int120(e){return nt(e,-120)}static int128(e){return nt(e,-128)}static int136(e){return nt(e,-136)}static int144(e){return nt(e,-144)}static int152(e){return nt(e,-152)}static int160(e){return nt(e,-160)}static int168(e){return nt(e,-168)}static int176(e){return nt(e,-176)}static int184(e){return nt(e,-184)}static int192(e){return nt(e,-192)}static int200(e){return nt(e,-200)}static int208(e){return nt(e,-208)}static int216(e){return nt(e,-216)}static int224(e){return nt(e,-224)}static int232(e){return nt(e,-232)}static int240(e){return nt(e,-240)}static int248(e){return nt(e,-248)}static int256(e){return nt(e,-256)}static int(e){return nt(e,-256)}static bytes1(e){return rn(e,1)}static bytes2(e){return rn(e,2)}static bytes3(e){return rn(e,3)}static bytes4(e){return rn(e,4)}static bytes5(e){return rn(e,5)}static bytes6(e){return rn(e,6)}static bytes7(e){return rn(e,7)}static bytes8(e){return rn(e,8)}static bytes9(e){return rn(e,9)}static bytes10(e){return rn(e,10)}static bytes11(e){return rn(e,11)}static bytes12(e){return rn(e,12)}static bytes13(e){return rn(e,13)}static bytes14(e){return rn(e,14)}static bytes15(e){return rn(e,15)}static bytes16(e){return rn(e,16)}static bytes17(e){return rn(e,17)}static bytes18(e){return rn(e,18)}static bytes19(e){return rn(e,19)}static bytes20(e){return rn(e,20)}static bytes21(e){return rn(e,21)}static bytes22(e){return rn(e,22)}static bytes23(e){return rn(e,23)}static bytes24(e){return rn(e,24)}static bytes25(e){return rn(e,25)}static bytes26(e){return rn(e,26)}static bytes27(e){return rn(e,27)}static bytes28(e){return rn(e,28)}static bytes29(e){return rn(e,29)}static bytes30(e){return rn(e,30)}static bytes31(e){return rn(e,31)}static bytes32(e){return rn(e,32)}static address(e){return new mc(fc,"address",e)}static bool(e){return new mc(fc,"bool",!!e)}static bytes(e){return new mc(fc,"bytes",e)}static string(e){return new mc(fc,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new mc(fc,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===a8}static dereference(e,t){if(mc.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}};Od=new WeakMap;let Hr=mc;class Oce extends uu{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let i=Hr.dereference(t,"string");try{i=hn(i)}catch(r){return this._throwError(r.message,t)}return e.writeValue(i)}decode(e){return hn(jh(e.readValue(),20))}}class Lce extends uu{constructor(t){super(t.name,t.type,"_",t.dynamic);ce(this,"coder");
165this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,i){return this.coder.encode(t,i)}decode(t){return this.coder.decode(t)}}function qj(n,e,t){let i=[];if(Array.isArray(t))i=t;else if(t&&typeof t=="object"){let l={};i=e.map(c=>{const u=c.localName;return Ie(u,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:c},value:t}),Ie(!l[u],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:c},value:t}),l[u]=!0,t[u]})}else ie(!1,"invalid tuple value","tuple",t);ie(e.length===i.length,"types/value length mismatch","tuple",t);let r=new MI,s=new MI,o=[];e.forEach((l,c)=>{let u=i[c];if(l.dynamic){let h=s.length;l.encode(s,u);let f=r.writeUpdatableValue();o.push(m=>{f(m+h)})}else l.encode(r,u)}),o.forEach(l=>{l(r.length)});let a=n.appendWriter(r);return a+=n.appendWriter(s),a}function Kj(n,e){let t=[],i=[],r=n.subReader(0);return e.forEach(s=>{let o=null;if(s.dynamic){let a=n.readIndex(),l=r.subReader(a);try{o=s.decode(l)}catch(c){if(hr(c,"BUFFER_OVERRUN"))throw c;o=c,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(a){if(hr(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}if(o==null)throw new Error("investigate");t.push(o),i.push(s.localName||null)}),P0.fromItems(t,i)}class Uce extends uu{constructor(t,i,r){const s=t.type+"["+(i>=0?i:"")+"]",o=i===-1||t.dynamic;super("array",s,r,o);ce(this,"coder");ce(this,"length");vt(this,{coder:t,length:i})}defaultValue(){const t=this.coder.defaultValue(),i=[];for(let r=0;r<this.length;r++)i.push(t);return i}encode(t,i){const r=Hr.dereference(i,"array");Array.isArray(r)||this._throwError("expected array value",r);let s=this.length;s===-1&&(s=r.length,t.writeValue(r.length)),nj(r.length,s,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<r.length;a++)o.push(this.coder);return qj(t,o,r)}decode(t){let i=this.length;i===-1&&(i=t.readIndex(),Ie(i*ns<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:i*ns,length:t.dataLength}));let r=[];for(let s=0;s<i;s++)r.push(new Lce(this.coder));return Kj(t,r)}}class Bce extends uu{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const i=Hr.dereference(t,"bool");return e.writeValue(i?1:0)}decode(e){return!!e.readValue()}}class Xj extends uu{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=es(t);let i=e.writeValue(t.length);return i+=e.writeBytes(t),i}decode(e){return e.readBytes(e.readIndex(),!0)}}class kce extends Xj{constructor(e){super("bytes",e)}decode(e){return Ye(super.decode(e))}}class Fce extends uu{constructor(t,i){let r="bytes"+String(t);super(r,r,i,!1);ce(this,"size");vt(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,i){let r=es(Hr.dereference(i,this.type));return r.length!==this.size&&this._throwError("incorrect data length",i),t.writeBytes(r)}decode(t){return Ye(t.readBytes(this.size))}}const zce=new Uint8Array([]);class Vce extends uu{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError("not null",t),e.writeBytes(zce)}decode(e){return e.readBytes(0),null}}const Hce=BigInt(0),$ce=BigInt(1),Gce=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class jce extends uu{constructor(t,i,r){const s=(i?"int":"uint")+t*8;super(s,s,r,!1);ce(this,"size");ce(this,"signed");vt(this,{size:t,signed:i},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,i){let r=ot(Hr.dereference(i,this.type)),s=Mv(Gce,ns*8);if(this.signed){let o=Mv(s,this.size*8-1);(r>o||r<-(o+$ce))&&this._throwError("value out-of-bounds",i),r=sj(r,8*ns)}else(r<Hce||r>Mv(s,this.size*8))&&this._throwError("value out-of-bounds",i);return t.writeValue(r)}decode(t){let i=Mv(t.readValue(),this.size*8);return this.signed&&(i=Vae(i,this.size*8)),i}}class Wce extends Xj{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Gc(Hr.dereference(t,"string")))}decode(e){return IS(super.decode(e))}}class Fb extends uu{constructor(t,i){let r=!1;const s=[];t.forEach(a=>{a.dynamic&&(r=!0),s.push(a.type)});const o="tuple("+s.join(",")+")";super("tuple",o,i,r);ce(this,"coders");vt(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];
165this.coders.forEach(r=>{t.push(r.defaultValue())});const i=this.coders.reduce((r,s)=>{const o=s.localName;return o&&(r[o]||(r[o]=0),r[o]++),r},{});return this.coders.forEach((r,s)=>{let o=r.localName;!o||i[o]!==1||(o==="length"&&(o="_length"),t[o]==null&&(t[o]=t[s]))}),Object.freeze(t)}encode(t,i){const r=Hr.dereference(i,"tuple");return qj(t,this.coders,r)}decode(t){return Kj(t,this.coders)}}function aP(n,e){return{address:hn(n),storageKeys:e.map((t,i)=>(ie(Cn(t,32),"invalid slot",`storageKeys[${i}]`,t),t.toLowerCase()))}}function _p(n){if(Array.isArray(n))return n.map((t,i)=>Array.isArray(t)?(ie(t.length===2,"invalid slot set",`value[${i}]`,t),aP(t[0],t[1])):(ie(t!=null&&typeof t=="object","invalid address-slot set","value",n),aP(t.address,t.storageKeys)));ie(n!=null&&typeof n=="object","invalid access list","value",n);const e=Object.keys(n).map(t=>{const i=n[t].reduce((r,s)=>(r[s]=!0,r),{});return aP(t,Object.keys(i).sort())});return e.sort((t,i)=>t.address.localeCompare(i.address)),e}function Yj(n){return{address:hn(n.address),nonce:ot(n.nonce!=null?n.nonce:0),chainId:ot(n.chainId!=null?n.chainId:0),signature:Us.from(n.signature)}}function qce(n){let e;return typeof n=="string"?e=Ow.computePublicKey(n,!1):e=n.publicKey,hn(Si("0x"+e.substring(4)).substring(26))}function Kce(n,e){return qce(Ow.recoverPublicKey(n,e))}const Wi=BigInt(0),Xce=BigInt(2),Yce=BigInt(27),Qce=BigInt(28),Zce=BigInt(35),Jce=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),lP=4096*32;function eue(n){return{blobToKzgCommitment:i=>{if("computeBlobProof"in n){if("blobToKzgCommitment"in n&&typeof n.blobToKzgCommitment=="function")return Gt(n.blobToKzgCommitment(Ye(i)))}else if("blobToKzgCommitment"in n&&typeof n.blobToKzgCommitment=="function")return Gt(n.blobToKzgCommitment(i));if("blobToKZGCommitment"in n&&typeof n.blobToKZGCommitment=="function")return Gt(n.blobToKZGCommitment(Ye(i)));ie(!1,"unsupported KZG library","kzg",n)},computeBlobKzgProof:(i,r)=>{if("computeBlobProof"in n&&typeof n.computeBlobProof=="function")return Gt(n.computeBlobProof(Ye(i),Ye(r)));if("computeBlobKzgProof"in n&&typeof n.computeBlobKzgProof=="function")return n.computeBlobKzgProof(i,r);if("computeBlobKZGProof"in n&&typeof n.computeBlobKZGProof=="function")return Gt(n.computeBlobKZGProof(Ye(i),Ye(r)));ie(!1,"unsupported KZG library","kzg",n)}}}function l8(n,e){let t=n.toString(16);for(;t.length<2;)t="0"+t;return t+=Y0(e).substring(4),"0x"+t}function Q0(n){return n==="0x"?null:hn(n)}function JA(n,e){try{return _p(n)}catch(t){ie(!1,t.message,e,n)}}function tue(n,e){try{if(!Array.isArray(n))throw new Error("authorizationList: invalid array");const t=[];for(let i=0;i<n.length;i++){const r=n[i];if(!Array.isArray(r))throw new Error(`authorization[${i}]: invalid array`);if(r.length!==6)throw new Error(`authorization[${i}]: wrong length`);if(!r[1])throw new Error(`authorization[${i}]: null address`);t.push({address:Q0(r[1]),nonce:vn(r[2],"nonce"),chainId:vn(r[0],"chainId"),signature:Us.from({yParity:Ep(r[3],"yParity"),r:tu(r[4],32),s:tu(r[5],32)})})}return t}catch(t){ie(!1,t.message,e,n)}}function Ep(n,e){return n==="0x"?0:jt(n,e)}function vn(n,e){if(n==="0x")return Wi;const t=ot(n,e);return ie(t<=Jce,"value exceeds uint size",e,t),t}function Qt(n,e){const t=ot(n,"value"),i=Ri(t);return ie(i.length<=32,"value too large",`tx.${e}`,t),i}function e2(n){return _p(n).map(e=>[e.address,e.storageKeys])}function nue(n){return n.map(e=>[Qt(e.chainId,"chainId"),e.address,Qt(e.nonce,"nonce"),Qt(e.signature.yParity,"yParity"),Ri(e.signature.r),Ri(e.signature.s)])}function iue(n,e){ie(Array.isArray(n),`invalid ${e}`,"value",n);for(let t=0;t<n.length;t++)ie(Cn(n[t],32),"invalid ${ param } hash",`value[${t}]`,n[t]);return n}function rue(n){const e=V1(n);ie(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",n);const t={type:0,nonce:Ep(e[0],"nonce"),gasPrice:vn(e[1],"gasPrice"),gasLimit:vn(e[2],"gasLimit"),to:Q0(e[3]),value:vn(e[4],"value"),data:Ye(e[5]),chainId:Wi};if(e.length===6)return t;const i=vn(e[6],"v"),r=vn(e[7],"r"),s=vn(e[8],"s");if(r===Wi&&s===Wi)t.chainId=i;else{let o=(i-Zce)/Xce;o<Wi&&(o=Wi),t.chainId=o,ie(o!==Wi||i===Yce||i===Qce,"non-canonical legacy v","v",e[6]),t.signature=Us.from({r:tu(e[7],32),s:tu(e[8],32),v:i})}return t}function sue(n,e){const t=[Qt(n.nonce,"nonce"),Qt(n.gasPrice||0,"gasPrice"),Qt(n.gasLimit,"gasLimit"),n.to||"0x",Qt(n.value,"value"),n.data];let i=Wi;if(n.chainId!=Wi)i=ot(n.chainId,"tx.chainId"),ie(!e||e.networkV==null||e.legacyChainId===i,"tx.chainId/sig.v mismatch","sig",e);else if(n.signature){const s=n.signature.legacyChainId;s!=null&&(i=s)}if(!e)return i!==Wi&&(t.push(Ri(i)),t.push("0x"),t.push("0x")),qh(t);let r=BigInt(27+e.yParity);return i!==Wi?r=Us.getChainIdV(i,e.v):BigInt(e.v)!==r&&ie(!1,"tx.chainId/sig.v mismatch","sig",e),t.push(Ri(r)),t.push(Ri(e.r)),t.push(Ri(e.s)),qh(t)}function t2(n,e){let t;
165try{if(t=Ep(e[0],"yParity"),t!==0&&t!==1)throw new Error("bad yParity")}catch{ie(!1,"invalid yParity","yParity",e[0])}const i=tu(e[1],32),r=tu(e[2],32),s=Us.from({r:i,s:r,yParity:t});n.signature=s}function oue(n){const e=V1(Gt(n).slice(1));ie(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",Ye(n));const t={type:2,chainId:vn(e[0],"chainId"),nonce:Ep(e[1],"nonce"),maxPriorityFeePerGas:vn(e[2],"maxPriorityFeePerGas"),maxFeePerGas:vn(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:vn(e[4],"gasLimit"),to:Q0(e[5]),value:vn(e[6],"value"),data:Ye(e[7]),accessList:JA(e[8],"accessList")};return e.length===9||t2(t,e.slice(9)),t}function aue(n,e){const t=[Qt(n.chainId,"chainId"),Qt(n.nonce,"nonce"),Qt(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Qt(n.maxFeePerGas||0,"maxFeePerGas"),Qt(n.gasLimit,"gasLimit"),n.to||"0x",Qt(n.value,"value"),n.data,e2(n.accessList||[])];return e&&(t.push(Qt(e.yParity,"yParity")),t.push(Ri(e.r)),t.push(Ri(e.s))),ri(["0x02",qh(t)])}function lue(n){const e=V1(Gt(n).slice(1));ie(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",Ye(n));const t={type:1,chainId:vn(e[0],"chainId"),nonce:Ep(e[1],"nonce"),gasPrice:vn(e[2],"gasPrice"),gasLimit:vn(e[3],"gasLimit"),to:Q0(e[4]),value:vn(e[5],"value"),data:Ye(e[6]),accessList:JA(e[7],"accessList")};return e.length===8||t2(t,e.slice(8)),t}function cue(n,e){const t=[Qt(n.chainId,"chainId"),Qt(n.nonce,"nonce"),Qt(n.gasPrice||0,"gasPrice"),Qt(n.gasLimit,"gasLimit"),n.to||"0x",Qt(n.value,"value"),n.data,e2(n.accessList||[])];return e&&(t.push(Qt(e.yParity,"recoveryParam")),t.push(Ri(e.r)),t.push(Ri(e.s))),ri(["0x01",qh(t)])}function uue(n){let e=V1(Gt(n).slice(1)),t="3",i=null;if(e.length===4&&Array.isArray(e[0])){t="3 (network format)";const s=e[1],o=e[2],a=e[3];ie(Array.isArray(s),"invalid network format: blobs not an array","fields[1]",s),ie(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),ie(Array.isArray(a),"invalid network format: proofs not an array","fields[3]",a),ie(s.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),ie(s.length===a.length,"invalid network format: blobs/proofs length mismatch","fields",e),i=[];for(let l=0;l<e[1].length;l++)i.push({data:s[l],commitment:o[l],proof:a[l]});e=e[0]}ie(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${t}`,"data",Ye(n));const r={type:3,chainId:vn(e[0],"chainId"),nonce:Ep(e[1],"nonce"),maxPriorityFeePerGas:vn(e[2],"maxPriorityFeePerGas"),maxFeePerGas:vn(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:vn(e[4],"gasLimit"),to:Q0(e[5]),value:vn(e[6],"value"),data:Ye(e[7]),accessList:JA(e[8],"accessList"),maxFeePerBlobGas:vn(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};i&&(r.blobs=i),ie(r.to!=null,`invalid address for transaction type: ${t}`,"data",n),ie(Array.isArray(r.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",n);for(let s=0;s<r.blobVersionedHashes.length;s++)ie(Cn(r.blobVersionedHashes[s],32),`invalid blobVersionedHash at index ${s}: must be length 32`,"data",n);return e.length===11||t2(r,e.slice(11)),r}function hue(n,e,t){const i=[Qt(n.chainId,"chainId"),Qt(n.nonce,"nonce"),Qt(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Qt(n.maxFeePerGas||0,"maxFeePerGas"),Qt(n.gasLimit,"gasLimit"),n.to||Dw,Qt(n.value,"value"),n.data,e2(n.accessList||[]),Qt(n.maxFeePerBlobGas||0,"maxFeePerBlobGas"),iue(n.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(i.push(Qt(e.yParity,"yParity")),i.push(Ri(e.r)),i.push(Ri(e.s)),t)?ri(["0x03",qh([i,t.map(r=>r.data),t.map(r=>r.commitment),t.map(r=>r.proof)])]):ri(["0x03",qh(i)])}function fue(n){const e=V1(Gt(n).slice(1));ie(Array.isArray(e)&&(e.length===10||e.length===13),"invalid field count for transaction type: 4","data",Ye(n));const t={type:4,chainId:vn(e[0],"chainId"),nonce:Ep(e[1],"nonce"),maxPriorityFeePerGas:vn(e[2],"maxPriorityFeePerGas"),maxFeePerGas:vn(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:vn(e[4],"gasLimit"),to:Q0(e[5]),value:vn(e[6],"value"),data:Ye(e[7]),accessList:JA(e[8],"accessList"),authorizationList:tue(e[9],"authorizationList")};return e.length===10||t2(t,e.slice(10)),t}function due(n,e){const t=[Qt(n.chainId,"chainId"),Qt(n.nonce,"nonce"),Qt(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Qt(n.maxFeePerGas||0,"maxFeePerGas"),Qt(n.gasLimit,"gasLimit"),n.to||"0x",Qt(n.value,"value"),n.data,e2(n.accessList||[]),nue(n.authorizationList||[])];return e&&(t.push(Qt(e.yParity,"yParity")),t.push(Ri(e.r)),t.push(Ri(e.s))),ri(["0x04",qh(t)]
165)}var Ta,Hg,$g,Gg,jg,Wg,qg,Kg,Xg,Yg,Qg,Zg,Ld,hh,gl,fh,Jg,e0,TE;const dl=class dl{constructor(){ge(this,e0);ge(this,Ta);ge(this,Hg);ge(this,$g);ge(this,Gg);ge(this,jg);ge(this,Wg);ge(this,qg);ge(this,Kg);ge(this,Xg);ge(this,Yg);ge(this,Qg);ge(this,Zg);ge(this,Ld);ge(this,hh);ge(this,gl);ge(this,fh);ge(this,Jg);ee(this,Ta,null),ee(this,Hg,null),ee(this,Gg,0),ee(this,jg,Wi),ee(this,Wg,null),ee(this,qg,null),ee(this,Kg,null),ee(this,$g,"0x"),ee(this,Xg,Wi),ee(this,Yg,Wi),ee(this,Qg,null),ee(this,Zg,null),ee(this,Ld,null),ee(this,hh,null),ee(this,gl,null),ee(this,fh,null),ee(this,Jg,null)}get type(){return V(this,Ta)}set type(e){switch(e){case null:ee(this,Ta,null);break;case 0:case"legacy":ee(this,Ta,0);break;case 1:case"berlin":case"eip-2930":ee(this,Ta,1);break;case 2:case"london":case"eip-1559":ee(this,Ta,2);break;case 3:case"cancun":case"eip-4844":ee(this,Ta,3);break;case 4:case"pectra":case"eip-7702":ee(this,Ta,4);break;default:ie(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844";case 4:return"eip-7702"}return null}get to(){const e=V(this,Hg);return e==null&&this.type===3?Dw:e}set to(e){ee(this,Hg,e==null?null:hn(e))}get nonce(){return V(this,Gg)}set nonce(e){ee(this,Gg,jt(e,"value"))}get gasLimit(){return V(this,jg)}set gasLimit(e){ee(this,jg,ot(e))}get gasPrice(){const e=V(this,Wg);return e==null&&(this.type===0||this.type===1)?Wi:e}set gasPrice(e){ee(this,Wg,e==null?null:ot(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=V(this,qg);return e??(this.type===2||this.type===3?Wi:null)}set maxPriorityFeePerGas(e){ee(this,qg,e==null?null:ot(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=V(this,Kg);return e??(this.type===2||this.type===3?Wi:null)}set maxFeePerGas(e){ee(this,Kg,e==null?null:ot(e,"maxFeePerGas"))}get data(){return V(this,$g)}set data(e){ee(this,$g,Ye(e))}get value(){return V(this,Xg)}set value(e){ee(this,Xg,ot(e,"value"))}get chainId(){return V(this,Yg)}set chainId(e){ee(this,Yg,ot(e))}get signature(){return V(this,Qg)||null}set signature(e){ee(this,Qg,e==null?null:Us.from(e))}get accessList(){const e=V(this,Zg)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){ee(this,Zg,e==null?null:_p(e))}get authorizationList(){const e=V(this,Jg)||null;return e==null&&this.type===4?[]:e}set authorizationList(e){ee(this,Jg,e==null?null:e.map(t=>Yj(t)))}get maxFeePerBlobGas(){const e=V(this,Ld);return e==null&&this.type===3?Wi:e}set maxFeePerBlobGas(e){ee(this,Ld,e==null?null:ot(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=V(this,hh);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){ie(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let t=0;t<e.length;t++)ie(Cn(e[t],32),"invalid blobVersionedHash",`value[${t}]`,e[t])}ee(this,hh,e)}get blobs(){return V(this,fh)==null?null:V(this,fh).map(e=>Object.assign({},e))}set blobs(e){if(e==null){ee(this,fh,null);return}const t=[],i=[];for(let r=0;r<e.length;r++){const s=e[r];if(_O(s)){Ie(V(this,gl),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=Gt(s);if(ie(o.length<=lP,"blob is too large",`blobs[${r}]`,s),o.length!==lP){const c=new Uint8Array(lP);c.set(o),o=c}const a=V(this,gl).blobToKzgCommitment(o),l=Ye(V(this,gl).computeBlobKzgProof(o,a));t.push({data:Ye(o),commitment:Ye(a),proof:l}),i.push(l8(1,a))}else{const o=Ye(s.commitment);t.push({data:Ye(s.data),commitment:o,proof:Ye(s.proof)}),i.push(l8(1,o))}}ee(this,fh,t),ee(this,hh,i)}get kzg(){return V(this,gl)}set kzg(e){e==null?ee(this,gl,null):ee(this,gl,eue(e))}get hash(){return this.signature==null?null:Si(Ge(this,e0,TE).call(this,!0,!1))}get unsignedHash(){return Si(this.unsignedSerialized)}get from(){return this.signature==null?null:Kce(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:Ow.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return Ge(this,e0,TE).call(this,!0,!0)}
165get unsignedSerialized(){return Ge(this,e0,TE).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,t=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,i=this.accessList!=null,r=V(this,Ld)!=null||V(this,hh);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&Ie(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Ie(!t||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Ie(this.type!==0||!i,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const s=[];return this.type!=null?s.push(this.type):this.authorizationList&&this.authorizationList.length?s.push(4):t?s.push(2):e?(s.push(1),i||s.push(0)):i?(s.push(1),s.push(2)):(r&&this.to||(s.push(0),s.push(1),s.push(2)),s.push(3)),s.sort(),s}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return dl.from(this)}toJSON(){const e=t=>t==null?null:t.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new dl;if(typeof e=="string"){const i=Gt(e);if(i[0]>=127)return dl.from(rue(i));switch(i[0]){case 1:return dl.from(lue(i));case 2:return dl.from(oue(i));case 3:return dl.from(uue(i));case 4:return dl.from(fue(i))}Ie(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new dl;return e.type!=null&&(t.type=e.type),e.to!=null&&(t.to=e.to),e.nonce!=null&&(t.nonce=e.nonce),e.gasLimit!=null&&(t.gasLimit=e.gasLimit),e.gasPrice!=null&&(t.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(t.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(t.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(t.data=e.data),e.value!=null&&(t.value=e.value),e.chainId!=null&&(t.chainId=e.chainId),e.signature!=null&&(t.signature=Us.from(e.signature)),e.accessList!=null&&(t.accessList=e.accessList),e.authorizationList!=null&&(t.authorizationList=e.authorizationList),e.blobVersionedHashes!=null&&(t.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(t.kzg=e.kzg),e.blobs!=null&&(t.blobs=e.blobs),e.hash!=null&&(ie(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),ie(t.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(ie(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),ie(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}};Ta=new WeakMap,Hg=new WeakMap,$g=new WeakMap,Gg=new WeakMap,jg=new WeakMap,Wg=new WeakMap,qg=new WeakMap,Kg=new WeakMap,Xg=new WeakMap,Yg=new WeakMap,Qg=new WeakMap,Zg=new WeakMap,Ld=new WeakMap,hh=new WeakMap,gl=new WeakMap,fh=new WeakMap,Jg=new WeakMap,e0=new WeakSet,TE=function(e,t){Ie(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const i=e?this.signature:null;switch(this.inferType()){case 0:return sue(this,i);case 1:return cue(this,i);case 2:return aue(this,i);case 3:return hue(this,i,t?this.blobs:null);case 4:return due(this,i)}Ie(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let NS=dl;function sp(n){return Si(Gc(n))}var pue="AEEUdwmgDS8BxQKKAP4BOgDjATAAngDUAIMAoABoAOAAagCOAEQAhABMAHIAOwA9ACsANgAmAGIAHgAuACgAJwAXAC0AGgAjAB8ALwAUACkAEgAeAAkAGwARABkAFgA5ACgALQArADcAFQApABAAHgAiABAAGgAeABMAGAUhBe8BFxREN8sF2wC5AK5HAW8ArQkDzQCuhzc3NzcBP68NEfMABQdHBuw5BV8FYAA9MzkI9r4ZBg7QyQAWA9CeOwLNCjcCjqkChuA/lm+RAsXTAoP6ASfnEQDytQFJAjWVCkeXAOsA6godAB/cwdAUE0WlBCN/AQUCQRjFD/MRBjHxDQSJbw0jBzUAswBxme+tnIcAYwabAysG8QAjAEMMmxcDqgPKQyDXCMMxA7kUQwD3NXOrAKmFIAAfBC0D3x4BJQDBGdUFAhEgVD8JnwmQJiNWYUzrg0oAGwAUAB0AFnNcACkAFgBP9h3gPfsDOWDKneY2ChglX1UDYD30ABsAFAAdABZzIGRAnwDD8wAjAEEMzRbDqgMB2sAFYwXqAtCnAsS4AwpUJKRtFHsadUz9AMMVbwLpABM1NJEX0ZkCgYMBEyMAxRVvAukAEzUBUFAtmUwSAy4DBTER33EftQHfSwB5MxJ/AjkWKQLzL8E/cwBB6QH9LQDPDtO9ASNriQC5DQANAwCK21EFI91zHwCoL9kBqQcHBwcHKzUDowBvAQohPvU3fAQgHwCyAc8CKQMA5zMSezr7ULgFmDp/LzVQ
165BgEGAi8FYQVgt8AFcTtlQhpCWEmfe5tmZ6IAExsDzQ8t+X8rBKtTAltbAn0jsy8Bl6utPWMDTR8Ei2kRANkDBrNHNysDBzECQWUAcwFpJ3kAiyUhAJ0BUb8AL3EfAbfNAz81KUsFWwF3YQZtAm0A+VEfAzEJDQBRSQCzAQBlAHsAM70GD/v3IZWHBwARKQAxALsjTwHZAeMPEzmXgIHwABIAGQA8AEUAQDt3gdvIEGcQZAkGTRFMdEIVEwK0D64L7REdDNkq09PgADSxB/MDWwfzA1sDWwfzB/MDWwfzA1sDWwNbA1scEvAi28gQZw9QBHUFlgWTBN4IiyZREYkHMAjaVBV0JhxPA00BBCMtSSQ7mzMTJUpMFE0LCAQ2SmyvfUADTzGzVP2QqgPTMlc5dAkGHnkSqAAyD3skNb1OhnpPcagKU0+2tYdJak5vAsY6sEAACikJm2/Dd1YGRRAfJ6kQ+ww3AbkBPw3xS9wE9QY/BM0fgRkdD9GVoAipLeEM8SbnLqWAXiP5KocF8Uv4POELUVFsD10LaQnnOmeBUgMlAREijwrhDT0IcRD3Cs1vDekRSQc9A9lJngCpBwULFR05FbkmFGKwCw05ewb/GvoLkyazEy17AAXXGiUGUQEtGwMA0y7rhbRaNVwgT2MGBwspI8sUrFAkDSlAu3hMGh8HGSWtApVDdEqLUToelyH6PEENai4XUYAH+TwJGVMLhTyiRq9FEhHWPpE9TCJNTDAEOYMsMyePCdMPiQy9fHYBXQklCbUMdRM1ERs3yQg9Bx0xlygnGQglRplgngT7owP3E9UDDwVDCUUHFwO5HDETMhUtBRGBKNsC9zbZLrcCk1aEARsFzw8pH+MQVEfkDu0InwJpA4cl7wAxFSUAGyKfCEdnAGOP3FMJLs8Iy2pwI3gDaxTrZRF3B5UOWwerHDcVwxzlcMxeD4YMKKezCV8BeQmdAWME5wgNNV+MpCBFZ1eLXBifIGVBQ14AAjUMaRWjRMGHfAKPD28SHwE5AXcHPQ0FAnsR8RFvEJkI74YINbkz/DopBFMhhyAVCisDU2zSCysm/Qz8bQGnEmYDEDRBd/Jnr2C6KBgBBx0yyUFkIfULlk/RDKAaxRhGVDIZ6AfDA/ca9yfuQVsGAwOnBxc6UTPyBMELbQiPCUMATQ6nGwfbGG4KdYzUATWPAbudA1uVhwJzkwY7Bw8Aaw+LBX3pACECqwinAAkA0wNbAD0CsQehAB0AiUUBQQMrMwEl6QKTA5cINc8BmTMB9y0EH8cMGQD7O25OAsO1AoBuZqYF4VwCkgJNOQFRKQQJUktVA7N15QDfAE8GF+NLARmvTs8e50cB43MvAMsA/wAJOQcJRQHRAfdxALsBYws1Caa3uQFR7S0AhwAZbwHbAo0A4QA5AIP1AVcAUQVd/QXXAlNNARU1HC9bZQG/AyMBNwERAH0Gz5GpzQsjBHEH1wIQHxXlAu8yB7kFAyLjE9FCyQK94lkAMhoKPAqrCqpgX2Q3CjV2PVQAEh+sPss/UgVVO1c7XDtXO1w7VztcO1c7XDtXO1wDm8Pmw+YKcF9JYe8Mqg3YRMw6TRPfYFVgNhPMLbsUxRXSJVoZQRrAJwkl6FUNDwgt12Y0CDA0eRfAAEMpbINFY4oeNApPHOtTlVT8LR8AtUumM7MNsBsZREQFS3XxYi4WEgomAmSFAmJGX1GzAV83JAKh+wJonAJmDQKfiDgfDwJmPwJmKgRyBIMDfxcDfpY5Cjl7GzmGOicnAmwhAjI6OA4CbcsCbbLzjgM3a0kvAWsA4gDlAE4JB5wMkQECD8YAEbkCdzMCdqZDAnlPRwJ4viFg30WyRvcCfEMCeswCfQ0CfPRIBEiBZygALxlJXEpfGRtK0ALRBQLQ0EsrA4hTA4fqRMmRNgLypV0HAwOyS9JMMSkH001QTbMCi0MCitzFHwshR2sJuwKOOwKOYESbhQKO3QKOYHxRuFM5AQ5S2FSJApP/ApMQAO0AIFUiVbNV1AosHymZijLleGpFPz0Cl6MC77ZYJawAXSkClpMCloCgAK1ZsFoNhVEAPwKWuQKWUlxIXNUCmc8CmWhczl0LHQKcnznGOqECnBoCn58CnryOACETNS4TAp31Ap6WALlBYThh8wKe1wKgcgGtAp6jIwKeUqljzGQrKS8CJ7MCJoICoP8CoFDbAqYzAqXSAqgDAIECp/ZogGi1AAdNaiBq1QKs5wKssgKtawKtBgJXIQJV4AKx5dsDH1JsmwKywRECsuwbbORtZ21MYwMl0QK2YD9DbpQDKUkCuGICuUsZArkue3A6cOUCvR0DLbYDMhUCvoxyBgMzdQK+HnMmc1MCw88CwwhzhnRPOUl05AM8qwEDPJ4DPcMCxYACxksCxhSNAshtVQLISALJUwLJMgJkoQLd1nh9ZXiyeSlL1AMYp2cGAmH4GfeVKHsPXpZevxUCz28Cz3AzT1fW9xejAMqxAs93AS3uA04Wfk8JAtwrAtuOAtJTA1JgA1NjAQUDVZCAjUMEzxrxZEl5A4LSg5EC2ssC2eKEFIRNp0ADhqkAMwNkEoZ1Xf0AWQLfaQLevHd7AuIz7RgB8zQrAfSfAfLWiwLr9wLpdH0DAur9AuroAP1LAb0C7o0C66CWrpcHAu5DA4XkmH1w5HGlAvMHAG0DjhqZlwL3FwORcgOSiwL3nAL53QL4apogmq+/O5siA52HAv7+AR8APZ8gAZ+3AwWRA6ZuA6bdANXJAwZuoYyiCQ0DDE0BEwEjB3EGZb1rCQC/BG/DFY8etxEAG3k9ACcDNxJRA42DAWcrJQCM8wAlAOanC6OVCLsGI6fJBgCvBRnDBvElRUYFFoAFcD9GSDNCKUK8X3kZX8QAls0FOgCQVCGbwTsuYDoZutcONxjOGJHJ/gVfBWAFXwVgBWsFYAVfBWAFXwVgBV8FYAVfBWBOHQjfjW8KCgoKbF7xMwTRA7kGN8PDAMMEr8MA70gxFroFTj5xPnhCR0K+X30/X/AAWBkzswCNBsxzzASm70aCRS4rDDMeLz49fnXfcsH5GcoscQFz13Y4HwVnBXLJycnACNdRYwgICAqEXoWTxgA7P4kACxbZBu21Kw0AjMsTAwkVAOVtJUUsJ1JCuULESUArXy9gPi9AKwnJRQYKTD9LPoA+iT54PnkCkULEUUpDX9NWV3JVEjQAc1w3A3IBE3YnX+g7QiMJb6MKaiszRCUuQrNCxDPMCcwEX9EWJzYREBEEBwIHKn6l33JCNVIfybPJtAltydPUCmhBZw/tEKsZAJOVJU1CLRuxbUHOQAo7P0s+eEJHHA8SJVRPdGM0NVrpvBoKhfUlM0JHHGUQUhEWO1xLSj8MO0ucNAqJIzVCRxv9EFsqKyA4OQgNj2nwZgp5ZNFgE2A1K3YHS2AhQQojJmC7DgpzGG1WYFUZCQYHZO9gHWCdYIVgu2BTYJlwFh8GvRbcXbG8YgtDHrMBwzPVyQonHQgkCyYBgQJ0Ajc4nVqIAwGSCsBPIgDsK3SWEtIVBa5N8gGjAo+kVwVIZwD/AEUSCDweX4ITrRQsJ8K3TwBXFDwEAB0TvzVcAtoTS20RIwDgVgZ9BBImYgA5AL4Coi8LFnezOkCnIQFjAY4KBAPh9RcGsgZSBsEAJctdsWIRu2kTkQstRw7DAcMBKgpPBGIGMDAwKCYnKTQaLg4AKRSVAFwCdl+YUZ0JdicFD3lPAdt1F9ZZKCGxuE3yBxkFVGcA/wBFEgiCBwAOLHQSjxOtQDg1z7deFRMAZ8QTAGtKb1ApIiPHADkAvgKiLy1DFtYCmBiDAlDDWNB0eo7fpaMO/aEVRRv0ATEQZBIODyMEAc8JQhCbDRgzFD4TAEMAu9YBCgCsAOkAm5I3ABwAYxvONnR+MhXJAxgKQyxL2+kkJhMbhQKDBMkSsvF0AD9BNQ6uQC7WqSQHwxEAEEIu1hkhAH2z4iQPwyJPHNWpdyYBRSpnJALzoBAEVPPsH20MxA0CCEQKRgAFyAtFAlMNwwjEDUQJRArELtapMg7DDZgJIw+TGukEIwvDFkMAqAtDEMMMBhioe+QAO3MMRAACrgnEBSPY9Q0FDnbSBoMAB8MSYxkSxAEJAPIJAAB8FWMOFtMc/HcXwxhDAC7DAvOowwAewwJdKDKHAAHDAALrFUQVwwAbwyvzpWMWv8wA/ABpAy++bcYDUKPD0KhDCwKmJ1MAAmMA5+UZwxAagwipBRL/eADfw6fDGOMCGsOjk3l6BwOpo4sAEsMOGxMAA5sAbcMOAAvDp0MJGkMDwgipnNIPAwfIqUMGAOGDAAPzABXDAAcDAAnDAGmTABrDAA7DChjDjnEWAwABYwAOcwAuUyYABsMAF8MIKQANUgC6wy4AA8MADqMq8wCyYgAcIwAB8wqpAAXOCx0V4wAHowBCwwEKAGnDAAuDAB3DAAjDCakABdIAbqcZ3QCZCCkABdIAAAFDAAfjAB2jCCkABqIACYMAGzMAbSMA5sOIAAhjAAhDABTDBAkpAAbSAOOTAAlDC6kOzPtnAAdDAG6kQFAATwAKwwwAA0MACbUDPwAHIwAZgwACE6cDAAojAApDAAoDp/MGwwAJIwADEwAQQwgAFEMAEXMAD5MADfMADcMAGRMOFiMAFUMAbqMWuwHDAMIAE0MLAGkzEgDhUwACQwAEWgAXgwUjAAbYABjDBSYBgzBaAEFNALcQBxUMegAwMngBrA0IZgJ0KxQHBREPd1N0ZzKRJwaIHAZqNT4DqQq8BwngAB4DAwt2AX56T1ocKQNXAh1GATQGC3tOxYNagkgAMQA5CQADAQEAWxLjAIOYNAEzAH7tFRk6TglSAF8NAAlYAQ+S1ACAQwQorQBiAN4dAJ1wPyeTANVzuQDX3AIeEMp9ey
165MgXiUAEdkBkJizKltbVVAaRMqRAAEAhyQ/SDEz6BmfVwB6ATEsOClKIRcDOF0E/832AFNt5AByAnkCRxGCOs94NjXdAwINGBonDBwPALW2AwICAgAAAAAAAAYDBQMDARrUAwAtAAAAAgEGBgYGBgYFBQUFBQUEBQYHCAkEBQUFBQQAAAICAAAAIgCNAJAAlT0A6gC7ANwApEQAwgCyAK0AqADuAKYA2gCjAOcBCAEDAMcAgQBiANIA1AEDAN4A8gCQAKkBMQDqAN8A3AsBCQ8yO9ra2tq8xuLT1tRJOB0BUgFcNU0BWgFpAWgBWwFMUUlLbhMBUxsNEAs6PhMOACcUKy0vMj5AQENDQ0RFFEYGJFdXV1dZWVhZL1pbXVxcI2NnZ2ZoZypsbnZ1eHh4eHh4enp6enp6enp6enp8fH18e2IARPIASQCaAHgAMgBm+ACOAFcAVwA3AnbvAIsABfj4AGQAk/IAnwBPAGIAZP//sACFAIUAaQBWALEAJAC2AIMCQAJDAPwA5wD+AP4A6AD/AOkA6QDoAOYALwJ7AVEBQAE+AVQBPgE+AT4BOQE4ATgBOAEcAVgXADEQCAEAUx8SHgsdHhYAjgCWAKYAUQBqIAIxAHYAbwCXAxUDJzIDIUlGTzEAkQJPAMcCVwKkAMAClgKWApYClgKWApYCiwKWApYClgKWApYClgKVApUCmAKgApcClgKWApQClAKUApQCkgKVAnUB1AKXAp8ClgKWApUeAIETBQD+DQOfAmECOh8BVBg9AuIZEjMbAU4/G1WZAXusRAFpYQEFA0FPAQYAmTEeIJdyADFoAHEANgCRA5zMk/C2jGINwjMWygIZCaXdfDILBCs5dAE7YnQBugDlhoiHhoiGiYqKhouOjIaNkI6Ij4qQipGGkoaThpSSlYaWhpeKmIaZhpqGm4aci52QnoqfhuIC4XTpAt90AIp0LHSoAIsAdHQEQwRABEIERQRDBEkERgRBBEcESQRIBEQERgRJAJ5udACrA490ALxuAQ10ANFZdHQA13QCFHQA/mJ0AP4BIQD+APwA/AD9APwDhGZ03ASMK23HAP4A/AD8AP0A/CR0dACRYnQA/gCRASEA/gCRAvQA/gCRA4RmdNwEjCttxyR0AP9idAEhAP4A/gD8APwA/QD8AP8A/AD8AP0A/AOEZnTcBIwrbcckdHQAkWJ0ASEA/gCRAP4AkQL0AP4AkQOEZnTcBIwrbcckdAJLAT50AlIBQXQCU8l0dAJfdHQDpgL0A6YDpgOnA6cDpwOnA4RmdNwEjCttxyR0dACRYnQBIQOmAJEDpgCRAvQDpgCRA4RmdNwEjCttxyR0BDh0AJEEOQCRDpU5dSgCADR03gV2CwArdAEFAM5iCnR0AF1iAAYcOgp0dACRCnQAXAEIwWZ0CnRmdHQAkWZ0CnRmdEXgAFF03gp0dEY0tlT2u3SOAQTwscwhjZZKrhYcBSfFp9XNbKiVDOD2b+cpe4/Z17mQnbtzzhaeQtE2GGj0IDNTjRUSyTxxw/RPHW/+vS7d1NfRt9z9QPZg4X7QFfhCnkvgNPIItOsC2eV6hPannZNHlZ9xrwZXIMOlu3jSoQSq78WEjwLjw1ELSlF1aBvfzwk5ZX7AUvQzjPQKbDuQ+sm4wNOp4A6AdVuRS0t1y/DZpg4R6m7FNjM9HgvW7Bi88zaMjOo6lM8wtBBdj8LP4ylv3zCXPhebMKJc066o9sF71oFW/8JXu86HJbwDID5lzw5GWLR/LhT0Qqnp2JQxNZNfcbLIzPy+YypqRm/lBmGmex+82+PisxUumSeJkALIT6rJezxMH+CTJmQtt5uwTVbL3ptmjDUQzlSIvWi8Tl7ng1NpuRn1Ng4n14Qc+3Iil7OwkvNWogLSPkn3pihIFytyIGmMhOe3n1tWsuMy9BdKyqF4Z3v2SgggTL9KVvMXPnCbRe+oOuFFP3HejBG/w9gvmfNYvg6JuWia2lcSSN1uIjBktzoIazOHPJZ7kKHPz8mRWVdW3lA8WGF9dQF6Bm673boov3BUWDU2JNcahR23GtfHKLOz/viZ+rYnZFaIznXO67CYEJ1fXuTRpZhYZkKe54xeoagkNGLs+NTZHE0rX45/XvQ2RGADX6vcAvdxIUBV27wxGm2zjZo4X3ILgAlrOFheuZ6wtsvaIj4yLY7qqawlliaIcrz2G+c3vscAnCkCuMzMmZvMfu9lLwTvfX+3cVSyPdN9ZwgDZhfjRgNJcLiJ67b9xx8JHswprbiE3v9UphotAPIgnXVIN5KmMc0piXhc6cChPnN+MRhG9adtdttQTTwSIpl8I4/j//d3sz1326qTBTpPRM/Hgh3kzqEXs8ZAk4ErQhNO8hzrQ0DLkWMA/N+91tn2MdOJnWC2FCZehkQrwzwbKOjhvZsbM95QoeL9skYyMf4srVPVJSgg7pOLUtr/n9eT99oe9nLtFRpjA9okV2Kj8h9k5HaC0oivRD8VyXkJ81tcd4fHNXPCfloIQasxsuO18/46dR2jgul/UIet2G0kRvnyONMKhHs6J26FEoqSqd+rfYjeEGwHWVDpX1fh1jBBcKGMqRepju9Y00mDVHC+Xdij/j44rKfvfjGinNs1jO/0F3jB83XCDINN/HB84axlP+3E/klktRo+vl3U/aiyMJbIodE1XSsDn6UAzIoMtUObY2+k/4gY/l+AkZJ5Sj2vQrkyLm3FoxjhDX+31UXBFf9XrAH31fFqoBmDEZvhvvpnZ87N+oZEu7U9O/nnk+QWj3x8uyoRbEnf+O5UMr9i0nHP38IF5AvzrBW8YWBUR0mIAzIvndQq9N3v/Jto3aPjPXUPl8ASdPPyAp7jENf8bk7VMM9ol9XGmlBmeDMuGqt+WzuL6CXAxXjIhCPM5vACchgMJ/8XBGLO/D1isVvGhwwHHr1DLaI5mn2Jr/b1pUD90uciDaS8cXNDzCWvNmT/PhQe5e8nTnnnkt8Ds/SIjibcum/fqDhKopxAY8AkSrPn+IGDEKOO+U3XOP6djFs2H5N9+orhOahiQk5KnEUWa+CzkVzhp8bMHRbg81qhjjXuIKbHjSLSIBKWqockGtKinY+z4/RdBUF6pcc3JmnlxVcNgrI4SEzKUZSwcD2QCyxzKve+gAmg6ZuSRkpPFa6mfThu7LJNu3H5K42uCpNvPAsoedolKV/LHe/eJ+BbaG5MG0NaSGVPRUmNFMFFSSpXEcXwbVh7UETOZZtoVNRGOIbbkig3McEtR68cG0RZAoJevWYo7Dg/lZ1CQzblWeUvVHmr8fY4Nqd9JJiH/zEX24mJviH60fAyFr0A3c4bC1j3yZU60VgJxXn8JgJXLUIsiBnmKmMYz+7yBQFBvqb2eYnuW59joZBf56/wXvWIR4R8wTmV80i1mZy+S4+BUES+hzjk0uXpC///z/IlqHZ1monzlXp8aCfhGKMti73FI1KbL1q6IKO4fuBuZ59gagjn5xU79muMpHXg6S+e+gDM/U9BKLHbl9l6o8czQKl4RUkJJiqftQG2i3BMg/TQlUYFkJDYBOOvAugYuzYSDnZbDDd/aSd9x0Oe6F+bJcHfl9+gp6L5/TgA+BdFFovbfCrQ40s5vMPw8866pNX8zyFGeFWdxIpPVp9Rg1UPOVFbFZrvaFq/YAzHQgqMWpahMYfqHpmwXfHL1/kpYmGuHFwT55mQu0dylfNuq2Oq0hTMCPwqfxnuBIPLXfci4Y1ANy+1CUipQxld/izVh16WyG2Q0CQQ9NqtAnx1HCHwDj7sYxOSB0wopZSnOzxQOcExmxrVTF2BkOthVpGfuhaGECfCJpJKpjnihY+xOT2QJxN61+9K6QSqtv2Shr82I3jgJrqBg0wELFZPjvHpvzTtaJnLK6Vb97Yn933koO/saN7fsjwNKzp4l2lJVx2orjCGzC/4ZL4zCver6aQYtC5sdoychuFE6ufOiog+VWi5UDkbmvmtah/3aArEBIi39s5ILUnlFLgilcGuz9CQshEY7fw2ouoILAYPVT/gyAIq3TFAIwVsl+ktkRz/qGfnCDGrm5gsl/l9QdvCWGsjPz3dU7XuqKfdUrr/6XIgjp4rey6AJBmCmUJMjITHVdFb5m1p+dLMCL8t55zD42cmftmLEJC0Da04YiRCVUBLLa8D071/N5UBNBXDh0LFsmhV/5B5ExOB4j3WVG/S3lfK5o+V6ELHvy6RR9n4ac+VsK4VE4yphPvV+kG9FegTBH4ZRXL2HytUHCduJazB/KykjfetYxOXTLws267aGOd+I+JhKP//+VnXmS90OD/jvLcVu0asyqcuYN1mSb6XTlCkqv1vigZPIYwNF/zpWcT1GR/6aEIRjkh0yhg4LXJfaGobYJTY4JI58KiAKgmmgAKWdl5nYCeLqavRJGQNuYuZtZFGx+IkI4w4NS2xwbetNMunOjBu/hmKCI/w7tfiiyUd//4rbTeWt4izBY8YvGIN6vyKYmP/8X8wHKCeN+WRcKM70+tXKNGyevU9H2Dg5BsljnTf8YbsJ1TmMs74Ce2XlHisleguhyeg44rQOHZuw/6HTkhnnurK2d62q6yS7210SsAIaR+jXMQA+svkrLpsUY+F30Uw89uOdGAR6vo4FIME0EfVVeHTu6eKicfhSqOeXJhbftcd08sWEnNUL1C9fnprTgd83IMut8onVUF0hvqzZfHduP
165jbjwEXIcoYmy+P6tcJZHmeOv6VrvEdkHDJecjHuHeWANe79VG662qTjA/HCvumVv3qL+LrOcpqGps2ZGwQdFJ7PU4iuyRlBrwfO+xnPyr47s2cXVbWzAyznDiBGjCM3ksxjjqM62GE9C8f5U38kB3VjtabKp/nRdvMESPGDG90bWRLAt1Qk5DyLuazRR1YzdC1c+hZXvAWV8xA72S4A8B67vjVhbba3MMop293FeEXpe7zItMWrJG/LOH9ByOXmYnNJfjmfuX9KbrpgLOba4nZ+fl8Gbdv/ihv+6wFGKHCYrVwmhFC0J3V2bn2tIB1wCc1CST3d3X2OyxhguXcs4sm679UngzofuSeBewMFJboIQHbUh/m2JhW2hG9DIvG2t7yZIzKBTz9wBtnNC+2pCRYhSIuQ1j8xsz5VvqnyUIthvuoyyu7fNIrg/KQUVmGQaqkqZk/Vx5b33/gsEs8yX7SC1J+NV4icz6bvIE7C5G6McBaI8rVg56q5QBJWxn/87Q1sPK4+sQa8fLU5gXo4paaq4cOcQ4wR0VBHPGjKh+UlPCbA1nLXyEUX45qZ8J7/Ln4FPJE2TdzD0Z8MLSNQiykMMmSyOCiFfy84Rq60emYB2vD09KjYwsoIpeDcBDTElBbXxND72yhd9pC/1CMid/5HUMvAL27OtcIJDzNKpRPNqPOpyt2aPGz9QWIs9hQ9LiX5s8m9hjTUu/f7MyIatjjd+tSfQ3ufZxPpmJhTaBtZtKLUcfOCUqADuO+QoH8B9v6U+P0HV1GLQmtoNFTb3s74ivZgjES0qfK+8RdGgBbcCMSy8eBvh98+et1KIFqSe1KQPyXULBMTsIYnysIwiZBJYdI20vseV+wuJkcqGemehKjaAb9L57xZm3g2zX0bZ2xk/fU+bCo7TlnbW7JuF1YdURo/2Gw7VclDG1W7LOtas2LX4upifZ/23rzpsnY/ALfRgrcWP5hYmV9VxVOQA1fZvp9F2UNU+7d7xRyVm5wiLp3/0dlV7vdw1PMiZrbDAYzIVqEjRY2YU03sJhPnlwIPcZUG5ltL6S8XCxU1eYS5cjr34veBmXAvy7yN4ZjArIG0dfD/5UpBNlX1ZPoxJOwyqRi3wQWtOzd4oNKh0LkoTm8cwqgIfKhqqGOhwo71I+zXnMemTv2B2AUzABWyFztGgGULjDDzWYwJUVBTjKCn5K2QGMK1CQT7SzziOjo+BhAmqBjzuc3xYym2eedGeOIRJVyTwDw37iCMe4g5Vbnsb5ZBdxOAnMT7HU4DHpxWGuQ7GeiY30Cpbvzss55+5Km1YsbD5ea3NI9QNYIXol5apgSu9dZ8f8xS5dtHpido5BclDuLWY4lhik0tbJa07yJhH0BOyEut/GRbYTS6RfiTYWGMCkNpfSHi7HvdiTglEVHKZXaVhezH4kkXiIvKopYAlPusftpE4a5IZwvw1x/eLvoDIh/zpo9FiQInsTb2SAkKHV42XYBjpJDg4374XiVb3ws4qM0s9eSQ5HzsMU4OZJKuopFjBM+dAZEl8RUMx5uU2N486Kr141tVsGQfGjORYMCJAMsxELeNT4RmWjRcpdTGBwcx6XN9drWqPmJzcrGrH4+DRc7+n1w3kPZwu0BkNr6hQrqgo7JTB9A5kdJ/H7P4cWBMwsmuixAzJB3yrQpnGIq90lxAXLzDCdn1LPibsRt7rHNjgQBklRgPZ8vTbjXdgXrTWQsK5MdrXXQVPp0Rinq3frzZKJ0qD6Qhc40VzAraUXlob1gvkhK3vpmHgI6FRlQZNx6eRqkp0zy4AQlX813fAPtL3jMRaitGFFjo0zmErloC+h+YYdVQ6k4F/epxAoF0BmqEoKNTt6j4vQZNQ2BoqF9Vj53TOIoNmDiu9Xp15RkIgQIGcoLpfoIbenzpGUAtqFJp5W+LLnx38jHeECTJ/navKY1NWfN0sY1T8/pB8kIH3DU3DX+u6W3YwpypBMYOhbSxGjq84RZ84fWJow8pyHqn4S/9J15EcCMsXqrfwyd9mhiu3+rEo9pPpoJkdZqHjra4NvzFwuThNKy6hao/SlLw3ZADUcUp3w3SRVfW2rhl80zOgTYnKE0Hs2qp1J6H3xqPqIkvUDRMFDYyRbsFI3M9MEyovPk8rlw7/0a81cDVLmBsR2ze2pBuKb23fbeZC0uXoIvDppfTwIDxk1Oq2dGesGc+oJXWJLGkOha3CX+DUnzgAp9HGH9RsPZN63Hn4RMA5eSVhPHO+9RcRb/IOgtW31V1Q5IPGtoxPjC+MEJbVlIMYADd9aHYWUIQKopuPOHmoqSkubnAKnzgKHqgIOfW5RdAgotN6BN+O2ZYHkuemLnvQ8U9THVrS1RtLmKbcC7PeeDsYznvqzeg6VCNwmr0Yyx1wnLjyT84BZz3EJyCptD3yeueAyDWIs0L2qs/VQ3HUyqfrja0V1LdDzqAikeWuV4sc7RLIB69jEIBjCkyZedoUHqCrOvShVzyd73OdrJW0hPOuQv2qOoHDc9xVb6Yu6uq3Xqp2ZaH46A7lzevbxQEmfrzvAYSJuZ4WDk1Hz3QX1LVdiUK0EvlAGAYlG3Md30r7dcPN63yqBCIj25prpvZP0nI4+EgWoFG95V596CurXpKRBGRjQlHCvy5Ib/iW8nZJWwrET3mgd6mEhfP4KCuaLjopWs7h+MdXFdIv8dHQJgg1xi1eYqB0uDYjxwVmri0Sv5XKut/onqapC+FQiC2C1lvYJ9MVco6yDYsS3AANUfMtvtbYI2hfwZatiSsnoUeMZd34GVjkMMKA+XnjJpXgRW2SHTZplVowPmJsvXy6w3cfO1AK2dvtZEKTkC/TY9LFiKHCG0DnrMQdGm2lzlBHM9iEYynH2UcVMhUEjsc0oDBTgo2ZSQ1gzkAHeWeBXYFjYLuuf8yzTCy7/RFR81WDjXMbq2BOH5dURnxo6oivmxL3cKzKInlZkD31nvpHB9Kk7GfcfE1t+1V64b9LtgeJGlpRFxQCAqWJ5DoY77ski8gsOEOr2uywZaoO/NGa0X0y1pNQHBi3b2SUGNpcZxDT7rLbBf1FSnQ8guxGW3W+36BW0gBje4DOz6Ba6SVk0xiKgt+q2JOFyr4SYfnu+Ic1QZYIuwHBrgzr6UvOcSCzPTOo7D6IC4ISeS7zkl4h+2VoeHpnG/uWR3+ysNgPcOIXQbv0n4mr3BwQcdKJxgPSeyuP/z1Jjg4e9nUvoXegqQVIE30EHx5GHv+FAVUNTowYDJgyFhf5IvlYmEqRif6+WN1MkEJmDcQITx9FX23a4mxy1AQRsOHO/+eImX9l8EMJI3oPWzVXxSOeHU1dUWYr2uAA7AMb+vAEZSbU3qob9ibCyXeypEMpZ6863o6QPqlqGHZkuWABSTVNd4cOh9hv3qEpSx2Zy/DJMP6cItEmiBJ5PFqQnDEIt3NrA3COlOSgz43D7gpNFNJ5MBh4oFzhDPiglC2ypsNU4ISywY2erkyb1NC3Qh/IfWj0eDgZI4/ln8WPfBsT3meTjq1Uqt1E7Zl/qftqkx6aM9KueMCekSnMrcHj1CqTWWzEzPsZGcDe3Ue4Ws+XFYVxNbOFF8ezkvQGR6ZOtOLU2lQEnMBStx47vE6Pb7AYMBRj2OOfZXfisjJnpTfSNjo6sZ6qSvNxZNmDeS7Gk3yYyCk1HtKN2UnhMIjOXUzAqDv90lx9O/q/AT1ZMnit5XQe9wmQxnE/WSH0CqZ9/2Hy+Sfmpeg8RwsHI5Z8kC8H293m/LHVVM/BA7HaTJYg5Enk7M/xWpq0192ACfBai2LA/qrCjCr6Dh1BIMzMXINBmX96MJ5Hn2nxln/RXPFhwHxUmSV0EV2V0jm86/dxxuYSU1W7sVkEbN9EzkG0QFwPhyHKyb3t+Fj5WoUUTErcazE/N6EW6Lvp0d//SDPj7EV9UdJN+Amnf3Wwk3A0SlJ9Z00yvXZ7n3z70G47Hfsow8Wq1JXcfwnA+Yxa5mFsgV464KKP4T31wqIgzFPd3eCe3j5ory5fBF2hgCFyVFrLzI9eetNXvM7oQqyFgDo4CTp/hDV9NMX9JDHQ/nyHTLvZLNLF6ftn2OxjGm8+PqOwhxnPHWipkE/8wbtyri80Sr7pMNkQGMfo4ZYK9OcCC4ESV
165FFbLMIvlxSoRqWie0wxqnLfcLSXMSpMMQEJYDVObYsXIQNv4TGNwjq1kvT1UOkicTrG3IaBZ3XdScS3u8sgeZPVpOLkbiF940FjbCeNRINNvDbd01EPBrTCPpm12m43ze1bBB59Ia6Ovhnur/Nvx3IxwSWol+3H2qfCJR8df6aQf4v6WiONxkK+IqT4pKQrZK/LplgDI/PJZbOep8dtbV7oCr6CgfpWa8NczOkPx81iSHbsNhVSJBOtrLIMrL31LK9TqHqAbAHe0RLmmV806kRLDLNEhUEJfm9u0sxpkL93Zgd6rw+tqBfTMi59xqXHLXSHwSbSBl0EK0+loECOPtrl+/nsaFe197di4yUgoe4jKoAJDXc6DGDjrQOoFDWZJ9HXwt8xDrQP+7aRwWKWI1GF8s8O4KzxWBBcwnl3vnl1Oez3oh6Ea1vjR7/z7DDTrFtqU2W/KAEzAuXDNZ7MY73MF216dzdSbWmUp4lcm7keJfWaMHgut9x5C9mj66Z0lJ+yhsjVvyiWrfk1lzPOTdhG15Y7gQlXtacvI7qv/XNSscDwqkgwHT/gUsD5yB7LdRRvJxQGYINn9hTpodKFVSTPrtGvyQw+HlRFXIkodErAGu9Iy1YpfSPc3jkFh5CX3lPxv7aqjE/JAfTIpEjGb/H7MO0e2vsViSW1qa/Lmi4/n4DEI3g7lYrcanspDfEpKkdV1OjSLOy0BCUqVoECaB55vs06rXl4jqmLsPsFM/7vYJ0vrBhDCm/00A/H81l1uekJ/6Lml3Hb9+NKiLqATJmDpyzfYZFHumEjC662L0Bwkxi7E9U4cQA0XMVDuMYAIeLMPgQaMVOd8fmt5SflFIfuBoszeAw7ow5gXPE2Y/yBc/7jExARUf/BxIHQBF5Sn3i61w4z5xJdCyO1F1X3+3ax+JSvMeZ7S6QSKp1Fp/sjYz6Z+VgCZzibGeEoujryfMulH7Rai5kAft9ebcW50DyJr2uo2z97mTWIu45YsSnNSMrrNUuG1XsYBtD9TDYzQffKB87vWbkM4EbPAFgoBV4GQS+vtFDUqOFAoi1nTtmIOvg38N4hT2Sn8r8clmBCXspBlMBYTnrqFJGBT3wZOzAyJDre9dHH7+x7qaaKDOB4UQALD5ecS0DE4obubQEiuJZ0EpBVpLuYcce8Aa4PYd/V4DLDAJBYKQPCWTcrEaZ5HYbJi11Gd6hjGom1ii18VHYnG28NKpkz2UKVPxlhYSp8uZr367iOmoy7zsxehW9wzcy2zG0a80PBMCRQMb32hnaHeOR8fnNDzZhaNYhkOdDsBUZ3loDMa1YP0uS0cjUP3b/6DBlqmZOeNABDsLl5BI5QJups8uxAuWJdkUB/pO6Zax6tsg7fN5mjjDgMGngO+DPcKqiHIDbFIGudxtPTIyDi9SFMKBDcfdGQRv41q1AqmxgkVfJMnP8w/Bc7N9/TR6C7mGObFqFkIEom8sKi2xYqJLTCHK7cxzaZvqODo22c3wisBCP4HeAgcRbNPAsBkNRhSmD48dHupdBRw4mIvtS5oeF6zeT1KMCyhMnmhpkFAGWnGscoNkwvQ8ZM5lE/vgTHFYL99OuNxdFBxTEDd5v2qLR8y9WkXsWgG6kZNndFG+pO/UAkOCipqIhL3hq7cRSdrCq7YhUsTocEcnaFa6nVkhnSeRYUA1YO0z5itF9Sly3VlxYDw239TJJH6f3EUfYO5lb7bcFcz8Bp7Oo8QmnsUHOz/fagVUBtKEw1iT88j+aKkv8cscKNkMxjYr8344D1kFoZ7/td1W6LCNYN594301tUGRmFjAzeRg5vyoM1F6+bJZ/Q54jN/k8SFd3DxPTYaAUsivsBfgTn7Mx8H2SpPt4GOdYRnEJOH6jHM2p6SgB0gzIRq6fHxGMmSmqaPCmlfwxiuloaVIitLGN8wie2CDWhkzLoCJcODh7KIOAqbHEvXdUxaS4TTTs07Clzj/6GmVs9kiZDerMxEnhUB6QQPlcfqkG9882RqHoLiHGBoHfQuXIsAG8GTAtao2KVwRnvvam8jo1e312GQAKWEa4sUVEAMG4G6ckcONDwRcg1e2D3+ohXgY4UAWF8wHKQMrSnzCgfFpsxh+aHXMGtPQroQasRY4U6UdG0rz1Vjbka0MekOGRZQEvqQFlxseFor8zWFgHek3v29+WqN6gaK5gZOTOMZzpQIC1201LkMCXild3vWXSc5UX9xcFYfbRPzGFa1FDcPfPB/jUEq/FeGt419CI3YmBlVoHsa4KdcwQP5ZSwHHhFJ7/Ph/Rap/4vmG91eDwPP0lDfCDRCLszTqfzM71xpmiKi2HwS4WlqvGNwtvwF5Dqpn6KTq8ax00UMPkxDcZrEEEsIvHiUXXEphdb4GB4FymlPwBz4Gperqq5pW7TQ6/yNRhW8VT5NhuP0udlxo4gILq5ZxAZk8ZGh3g4CqxJlPKY7AQxupfUcVpWT5VItp1+30UqoyP4wWsRo3olRRgkWZZ2ZN6VC3OZFeXB8NbnUrSdikNptD1QiGuKkr8EmSR/AK9Rw+FF3s5uwuPbvHGiPeFOViltMK7AUaOsq9+x9cndk3iJEE5LKZRlWJbKOZweROzmPNVPkjE3K/TyA57Rs68TkZ3MR8akKpm7cFjnjPd/DdkWjgYoKHSr5Wu5ssoBYU4acRs5g2DHxUmdq8VXOXRbunD8QN0LhgkssgahcdoYsNvuXGUK/KXD/7oFb+VGdhqIn02veuM5bLudJOc2Ky0GMaG4W/xWBxIJcL7yliJOXOpx0AkBqUgzlDczmLT4iILXDxxtRR1oZa2JWFgiAb43obrJnG/TZC2KSK2wqOzRZTXavZZFMb1f3bXvVaNaK828w9TO610gk8JNf3gMfETzXXsbcvRGCG9JWQZ6+cDPqc4466Yo2RcKH+PILeKOqtnlbInR3MmBeGG3FH10yzkybuqEC2HSQwpA0An7d9+73BkDUTm30bZmoP/RGbgFN+GrCOfADgqr0WbI1a1okpFms8iHYw9hm0zUvlEMivBRxModrbJJ+9/p3jUdQQ9BCtQdxnOGrT5dzRUmw0593/mbRSdBg0nRvRZM5/E16m7ZHmDEtWhwvfdZCZ8J8M12W0yRMszXamWfQTwIZ4ayYktrnscQuWr8idp3PjT2eF/jmtdhIfcpMnb+IfZY2FebW6UY/AK3jP4u3Tu4zE4qlnQgLFbM19EBIsNf7KhjdbqQ/D6yiDb+NlEi2SKD+ivXVUK8ib0oBo366gXkR8ZxGjpJIDcEgZPa9TcYe0TIbiPl/rPUQDu3XBJ9X/GNq3FAUsKsll57DzaGMrjcT+gctp+9MLYXCq+sqP81eVQ0r9lt+gcQfZbACRbEjvlMskztZG8gbC8Qn9tt26Q7y7nDrbZq/LEz7kR6Jc6pg3N9rVX8Y5MJrGlML9p9lU4jbTkKqCveeZUJjHB03m2KRKR2TytoFkTXOLg7keU1s1lrPMQJpoOKLuAAC+y1HlJucU6ysB5hsXhvSPPLq5J7JtnqHKZ4vYjC4Vy8153QY+6780xDuGARsGbOs1WqzH0QS765rnSKEbbKlkO8oI/VDwUd0is13tKpqILu1mDJFNy/iJAWcvDgjxvusIT+PGz3ST/J9r9Mtfd0jpaGeiLYIqXc7DiHSS8TcjFVksi66PEkxW1z6ujbLLUGNNYnzOWpH8BZGK4bCK7iR+MbIv8ncDAz1u4StN3vTTzewr9IQjk9wxFxn+6N1ddKs0vffJiS08N3a4G1SVrlZ97Q/M+8G9fe5AP6d9/Qq4WRnORVhofPIKEdCr3llspUfE0oKIIYoByBRPh+bX1HLS3JWGJRhIvE1aW4NTd8ePi4Z+kXb+Z8snYfSNcqijhAgVsx4RCM54cXUiYkjeBmmC4ajOHrChoELscJJC7+9jjMjw5BagZKlgRMiSNYz7h7vvZIoQqbtQmspc0cUk1G/73iXtSpROl5wtLgQi0mW2Ex8i3WULhcggx6E1LMVHUsdc9GHI1PH3U2Ko0PyGdn9KdVOLm7FPBui0i9a0HpA60MsewVE4z8CAt5d401Gv6zXlIT5Ybit1VIA0FCs7wtvYreru1fUyW3oLAZ/+aTnZrOcYRNVA8spoRtlRoWflsRClFcgzkqiHOrf0/SVw+EpVaFlJ0g4Kxq1MMOmiQdpMNpte8lMMQqm6cIFXlnGbfJllysKDi+0JJMotkqgIxOSQgU9dn/lWkeVf8nUm3iwX2Nl3WDw9i6AUK3vBAbZZrcJpDQ/N64AVwjT07Jef30GSSmtNu2WlW7YoyW2FlWfZFQUwk867EdLYKk9VG6JgEnBiBxkY7LMo4YLQJJlAo9l/oTvJkSARDF/XtyAzM8O2t3eT/iXa6wDN3WewNmQHdPfsxChU/KtLG2Mn8i4ZqKdSlIaBZadxJmRzVS/o4yA65RTSViq60oa395Lqw0pzY4SipwE0SXXsKV+GZraGSkr/RW08wPRvqvSUkYBMA9lPx4m24az+IHmCbXA+0faxTRE9wuGeO06DIXa6QlKJ3puIyiuAVfPr736vzo2pBirS+Vxel3TMm3JKhz9o2ZoRvaFVpIkykb0Hcm4oHFBMcNSNj7/4GJt43ogonY2Vg4nsDQIWxAcorpXACzgBqQPjYsE/VUpXpwNManEru4NwMCFPkXvMoqvoeLN3qyu/N1eWEHttMD65v19l/0kH2mR35iv/FI+yjoHJ9gPMz67af3Mq/BoWXqu3rphiWMXVkmnPSEkpGpUI2h1MThideGFEOK6YZHPwYzMBvpNC7+ZHxPb7epfefGyIB4JzO9DTNEYnDLVVHdQyvOEVefrk6Uv5kTQYVYWWdqrdcIl7yljwwIWdfQ/y+2QB3eR/qxYObuYyB4gTbo2in4PzarU1sO9nETkmj9/AoxDA+JM3GMqQtJR4jtduHtnoCLxd1gQUscHRB/MoRYIEsP2pDZ9KvHgtlk1iTbWWbHhohwFEYX7y51fUV2nuUmnoUcqnWIQAAgl9LTVX+Bc0QGNEhChxHR4YjfE51PUdGfsSFE6ck7BL3/hTf9jLq4G1IafINxOLKeAtO7quulYvH5YOBc+zX7CrMgWnW47/jfRsWnJjYYoE7xMfWV2HN2iyIqLI";
165const c8=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),u8=4;function mue(n){let e=0;function t(){return n[e++]<<8|n[e++]}let i=t(),r=1,s=[0,1];for(let M=1;M<i;M++)s.push(r+=t());let o=t(),a=e;e+=o;let l=0,c=0;function u(){return l==0&&(c=c<<8|n[e++],l=8),c>>--l&1}const h=31,f=2**h,m=f>>>1,g=m>>1,v=f-1;let w=0;for(let M=0;M<h;M++)w=w<<1|u();let y=[],_=0,x=f;for(;;){let M=Math.floor(((w-_+1)*r-1)/x),A=0,I=i;for(;I-A>1;){let C=A+I>>>1;M<s[C]?I=C:A=C}if(A==0)break;y.push(A);let D=_+Math.floor(x*s[A]/r),k=_+Math.floor(x*s[A+1]/r)-1;for(;!((D^k)&m);)w=w<<1&v|u(),D=D<<1&v,k=k<<1&v|1;for(;D&~k&g;)w=w&m|w<<1&v>>>1|u(),D=D<<1^m,k=(k^m)<<1|m|1;_=D,x=1+k-D}let S=i-4;return y.map(M=>{switch(M-S){case 3:return S+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return S+256+(n[a++]<<8|n[a++]);case 1:return S+n[a++];default:return M-1}})}function gue(n){let e=0;return()=>n[e++]}function Qj(n){return gue(mue(yue(n)))}function yue(n){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((r,s)=>e[r.charCodeAt(0)]=s);let t=n.length,i=new Uint8Array(6*t>>3);for(let r=0,s=0,o=0,a=0;r<t;r++)a=a<<6|e[n.charCodeAt(r)],o+=6,o>=8&&(i[s++]=a>>(o-=8));return i}function vue(n){return n&1?~n>>1:n>>1}function wue(n,e){let t=Array(n);for(let i=0,r=0;i<n;i++)t[i]=r+=vue(e());return t}function Lw(n,e=0){let t=[];for(;;){let i=n(),r=n();if(!r)break;e+=i;for(let s=0;s<r;s++)t.push(e+s);e+=r+1}return t}function Zj(n){return Uw(()=>{let e=Lw(n);if(e.length)return e})}function Jj(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(xue(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(bue(t,n))}return e.flat()}function Uw(n){let e=[];for(;;){let t=n(e.length);if(!t)break;e.push(t)}return e}function eW(n,e,t){let i=Array(n).fill().map(()=>[]);for(let r=0;r<e;r++)wue(n,t).forEach((s,o)=>i[o].push(s));return i}function xue(n,e){let t=1+e(),i=e(),r=Uw(e);return eW(r.length,1+n,e).flatMap((o,a)=>{let[l,...c]=o;return Array(r[a]).fill().map((u,h)=>{let f=h*i;return[l+h*t,c.map(m=>m+f)]})})}function bue(n,e){let t=1+e();return eW(t,1+n,e).map(r=>[r[0],r.slice(1)])}function _ue(n){let e=[],t=Lw(n);return r(i([]),[]),e;function i(s){let o=n(),a=Uw(()=>{let l=Lw(n).map(c=>t[c]);if(l.length)return i(l)});return{S:o,B:a,Q:s}}function r({S:s,B:o},a,l){if(!(s&4&&l===a[a.length-1])){s&2&&(l=a[a.length-1]),s&1&&e.push(a);for(let c of o)for(let u of c.Q)r(c,[...a,u],l)}}}function Eue(n){return n.toString(16).toUpperCase().padStart(2,"0")}function tW(n){return`{${Eue(n)}}`}function Sue(n){let e=[];for(let t=0,i=n.length;t<i;){let r=n.codePointAt(t);t+=r<65536?1:2,e.push(r)}return e}function D0(n){let t=n.length;if(t<4096)return String.fromCodePoint(...n);let i=[];for(let r=0;r<t;)i.push(String.fromCodePoint(...n.slice(r,r+=4096)));return i.join("")}function Aue(n,e){let t=n.length,i=t-e.length;for(let r=0;i==0&&r<t;r++)i=n[r]-e[r];return i}var Mue=
vendor: 7,453 bytes, line 165
165"AEUDTAHBCFQATQDRADAAcgAgADQAFAAsABQAHwAOACQADQARAAoAFwAHABIACAAPAAUACwAFAAwABAAQAAMABwAEAAoABQAIAAIACgABAAQAFAALAAIACwABAAIAAQAHAAMAAwAEAAsADAAMAAwACgANAA0AAwAKAAkABAAdAAYAZwDSAdsDJgC0CkMB8xhZAqfoC190UGcThgBurwf7PT09Pb09AjgJum8OjDllxHYUKXAPxzq6tABAxgK8ysUvWAgMPT09PT09PSs6LT2HcgWXWwFLoSMEEEl5RFVMKvO0XQ8ExDdJMnIgsj26PTQyy8FfEQ8AY8IPAGcEbwRwBHEEcgRzBHQEdQR2BHcEeAR6BHsEfAR+BIAEgfndBQoBYgULAWIFDAFiBNcE2ATZBRAFEQUvBdALFAsVDPcNBw13DYcOMA4xDjMB4BllHI0B2grbAMDpHLkQ7QHVAPRNQQFnGRUEg0yEB2uaJF8AJpIBpob5AERSMAKNoAXqaQLUBMCzEiACnwRZEkkVsS7tANAsBG0RuAQLEPABv9HICTUBXigPZwRBApMDOwAamhtaABqEAY8KvKx3LQ4ArAB8UhwEBAVSagD8AEFZADkBIadVj2UMUgx5Il4ANQC9AxIB1BlbEPMAs30CGxlXAhwZKQIECBc6EbsCoxngzv7UzRQA8M0BawL6ZwkN7wABAD33OQRcsgLJCjMCjqUChtw/km+NAsXPAoP2BT84PwURAK0RAvptb6cApQS/OMMey5HJS84UdxpxTPkCogVFITaTOwERAK5pAvkNBOVyA7q3BKlOJSALAgUIBRcEdASpBXqzABXFSWZOawLCOqw//AolCZdvv3dSBkEQGyelEPcMMwG1ATsN7UvYBPEGOwTJH30ZGQ/NlZwIpS3dDO0m4y6hgFoj9SqDBe1L9DzdC01RaA9ZC2UJ4zpjgU4DIQENIosK3Q05CG0Q8wrJaw3lEUUHOQPVSZoApQcBCxEdNRW1JhBirAsJOXcG+xr2C48mrxMpevwF0xohBk0BKRr/AM8u54WwWjFcHE9fBgMLJSPHFKhQIA0lQLd4SBobBxUlqQKRQ3BKh1E2HpMh9jw9DWYuE1F8B/U8BRlPC4E8nkarRQ4R0j6NPUgiSUwsBDV/LC8niwnPD4UMuXxyAVkJIQmxDHETMREXN8UIOQcZLZckJxUIIUaVYJoE958D8xPRAwsFPwlBBxMDtRwtEy4VKQUNgSTXAvM21S6zAo9WgAEXBcsPJR/fEFBH4A7pCJsCZQODJesALRUhABcimwhDYwBfj9hTBS7LCMdqbCN0A2cU52ERcweRDlcHpxwzFb8c4XDIXguGCCijrwlbAXUJmQFfBOMICTVbjKAgQWdTi1gYmyBhQT9d/AIxDGUVn0S9h3gCiw9rEhsBNQFzBzkNAQJ3Ee0RaxCVCOuGBDW1M/g6JQRPIYMgEQonA09szgsnJvkM+GkBoxJiAww0PXfuZ6tgtiQX/QcZMsVBYCHxC5JPzQycGsEYQlQuGeQHvwPzGvMn6kFXBf8DowMTOk0z7gS9C2kIiwk/AEkOoxcH1xhqCnGM0AExiwG3mQNXkYMCb48GNwcLAGcLhwV55QAdAqcIowAFAM8DVwA5Aq0HnQAZAIVBAT0DJy8BIeUCjwOTCDHLAZUvAfMpBBvDDBUA9zduSgLDsQKAamaiBd1YAo4CSTUBTSUEBU5HUQOvceEA2wBLBhPfRwEVq0rLGuNDAd9vKwDHAPsABTUHBUEBzQHzbQC3AV8LMQmis7UBTekpAIMAFWsB1wKJAN0ANQB/8QFTAE0FWfkF0wJPSQERMRgrV2EBuwMfATMBDQB5BsuNpckHHwRtB9MCEBsV4QLvLge1AQMi3xPNQsUCvd5VoWACZIECYkJbTa9bNyACofcCaJgCZgkCn4Q4GwsCZjsCZiYEbgR/A38TA36SOQY5dxc5gjojIwJsHQIyNjgKAm3HAm2u74ozZ0UrAWcA3gDhAEoFB5gMjQD+C8IADbUCdy8CdqI/AnlLQwJ4uh1c20WuRtcCfD8CesgCfQkCfPAFWQUgSABIfWMkAoFtAoAAAoAFAn+uSVhKWxUXSswC0QEC0MxLJwOITwOH5kTFkTIC8qFdAwMDrkvOTC0lA89NTE2vAos/AorYwRsHHUNnBbcCjjcCjlxAl4ECjtkCjlx4UbRTNQpS1FSFApP7ApMMAOkAHFUeVa9V0AYsGymVhjLheGZFOzkCl58C77JYIagAWSUClo8ClnycAKlZrFoJgU0AOwKWtQKWTlxEXNECmcsCmWRcyl0HGQKcmznCOp0CnBYCn5sCnriKAB0PMSoPAp3xAp6SALU9YTRh7wKe0wKgbgGpAp6fHwKeTqVjyGQnJSsCJ68CJn4CoPsCoEwCot0CocQCpi8Cpc4Cp/8AfQKn8mh8aLEAA0lqHGrRAqzjAqyuAq1nAq0CAlcdAlXcArHh1wMfTmyXArK9DQKy6Bds4G1jbUhfAyXNArZcOz9ukAMpRQK4XgK5RxUCuSp3cDZw4QK9GQK72nCWAzIRAr6IcgIDM3ECvhpzInNPAsPLAsMEc4J0SzVFdOADPKcDPJoDPb8CxXwCxkcCxhCJAshpUQLIRALJTwLJLgJknQLd0nh5YXiueSVL0AMYo2cCAmH0GfOVJHsLXpJeuxECz2sCz2wvS1PS8xOfAMatAs9zASnqA04SfksFAtwnAtuKAtJPA1JcA1NfAQEDVYyAiT8AyxbtYEWCHILTgs6DjQLaxwLZ3oQQhEmnPAOGpQAvA2QOhnFZ+QBVAt9lAt64c3cC4i/tFAHzMCcB9JsB8tKHAuvzAulweQLq+QLq5AD5RwG5Au6JAuuclqqXAwLuPwOF4Jh5cOBxoQLzAwBpA44WmZMC9xMDkW4DkocC95gC+dkC+GaaHJqruzebHgOdgwL++gEbADmfHJ+zAwWNA6ZqA6bZANHFAwZqoYiiBQkDDEkCwAA/AwDhQRdTARHzA2sHl2cFAJMtK7evvdsBiZkUfxEEOQH7KQUhDp0JnwCS/SlXxQL3AZ0AtwW5AG8LbUEuFCaNLgFDAYD8AbUmAHUDDgRtACwCFgyhAAAKAj0CagPdA34EkQEgRQUhfAoABQBEABMANhICdwEABdUDa+8KxQIA9wqfJ7+xt+UBkSFBQgHpFH8RNMCJAAQAGwBaAkUChIsABjpTOpSNbQC4Oo860ACNOME63AClAOgAywE6gTo7Ofw5+Tt2iTpbO56JOm85GAFWATMBbAUvNV01njWtNWY1dTW2NcU1gjWRNdI14TWeNa017jX9NbI1wTYCNhE1xjXVNhY2JzXeNe02LjY9Ni41LSE2OjY9Njw2yTcIBJA8VzY4Nt03IDcPNsogN4k3MAoEsDxnNiQ3GTdsOo03IULUQwdC4EMLHA8PCZsobShRVQYA6X8A6bABFCnXAukBowC9BbcAbwNzBL8MDAMMAQgDAAkKCwsLCQoGBAVVBI/DvwDz9b29kaUCb0QtsRTNLt4eGBcSHAMZFhYZEhYEARAEBUEcQRxBHEEcQRxBHEEaQRxBHEFCSTxBPElISUhBNkM2QTYbNklISVmBVIgBFLWZAu0BhQCjBcEAbykBvwGJAaQcEZ0ePCklMAAhMvAIMAL54gC7Bm8EescjzQMpARQpKgDUABavAj626xQAJP0A3etzuf4NNRA7efy2Z9NQrCnC0OSyANz5BBIbJ5IFDR6miIavYS6tprjjmuKebxm5C74Q225X1pkaYYPb6f1DK4k3xMEBb9S2WMjEibTNWhsRJIA+vwNVEiXTE5iXs/wezV66oFLfp9NZGYW+Gk19J2+bCT6Ye2w6LDYdgzKMUabk595eLBCXANz9HUpWbATq9vqXVx9XDg+Pc9Xp4+bsS005SVM/BJBM4687WUuf+Uj9dEi8aDNaPxtpbDxcG1THTImUMZq4UCaaNYpsVqraNyKLJXDYsFZ/5jl7bLRtO88t7P3xZaAxhb5OdPMXqsSkp1WCieG8jXm1U99+blvLlXzPCS+M93VnJCiK+09LfaSaBAVBomyDgJua8dfUzR7ga34IvR2Nvj+A9heJ6lsl1KG4NkI1032Cnff1m1wof2B9oHJK4bi6JkEdSqeNeiuo6QoZZincoc73/TH9SXF8sCE7XyuYyW8WSgbGFCjPV0ihLKhdPs08Tx82fYAkLLc4I2wdl4apY7GU5lHRFzRWJep7Ww3wbeA3qmd59/86P4xuNaqDpygXt6M85glSBHOCGgJDnt+pN9bK7HApMguX6+06RZNjzVmcZJ+wcUrJ9//bpRNxNuKpNl9uFds+S9tdx7LaM5ZkIrPj6nIU9mnbFtVbs9s/uLgl8MVczAwet+iOEzzBlYW7RCMgE6gyNLeq6+1tIx4dpgZnd0DksJS5f+JNDpwwcPNXaaVspq1fbQajOrJgK0ofKtJ1Ne90L6VO4MOl5S886p7u6xo7OLjG8TGL+HU1JXGJgppg4nNbNJ5nlzSpuPYy21JUEcUA94PoFiZfjZue+QnyQ80ekOuZVkxx4g+cvhJfHgNl4hy1/a6+RKcKlar/J29y//EztlbVPHVUeQ1zX86eQVAjR/M3dA9w4W8LfaXp4EgM85wOWasli837PzVMOnsLzR+k3o75/lRPAJSE1xAKQzEi5v10ke+VBvRt1cwQRMd+U5mLCTGVd6XiZtgBG5cDi0w22GKcVNvHiu5LQbZEDVtz0onn7k5+heuKXVsZtSzilkLRAUmjMXEMB3J9YC50XBxPiz53SC+EhnPl9WsKCv92SM/OFFIMJZYfl0WW8tIO3UxYcwdMAj7FSmgrsZ2aAZO03BOhP1bNNZItyXYQFTpC3SG1VuPDqH9GkiCDmE+JwxyIVSO5siDErAOpEXFgjy6PQtOVDj+s6e1r8heWVvmZnTciuf4EiNZzCAd7SOMhXERIOlsHIMG399i9aLTy3m2hRLZjJVDNLS53iGIK11dPqQt0zBDyg6qc7YqkDm2M5Ve6dCWCaCbTXX2rToaIgz6+zh4lYUi/+6nqcFMAkQJKHYLK0wYk5N9szV6xihDbDDFr45lN1K4aCXBq/FitPSud9gLt5ZVn+ZqGX7cwm2z5EGMgfFpIFyhGGuDPmso6TItTMwny+7uPnLCf4W6goFQFV0oQSsc9VfMmVLcLr6ZetDZbaSFTLqnSO/bIPjA3/zAUoqgGFAEQS4IhuMzEp2I3jJzbzkk/IEmyax+rhZTwd6f+CGtwPixu8IvzACquPWPREu9ZvGkUzpRwvRRuaNN6cr0W1wWits9ICdYJ7ltbgMiSL3sTPeufgNcVqMVWFkCPDH4jG2jA0XcVgQj62Cb29v9f/z/+2KbYvIv/zzjpQAPkliaVDzNrW57TZ/ZOyZD0nlfMmAIBIAGAI0D3k/mdN4xr9v85ZbZbbqfH2jGd5hUqNZWwl5SPfoGmfElmazUIeNL1j/mkF7VNAzTq4jNt8JoQ11NQOcmhprXoxSxfRGJ9LDEOAQ+dmxAQH90iti9e2u/MoeuaGcDTHoC+xsmEeWmxEKefQuIzHbpw5Tc5cEocboAD09oipWQhtTO1wivf/O+DRe2rpl/E9wlrzBorjJsOeG1B/XPW4EaJEFdNlECEZga5ZoGRHXgYouGRuVkm8tDESiEyFNo+3s5M5puSdTyUL2llnINVHEt91XUNW4ewdMgJ4boJfEyt/iY5WXqbA+A2Fkt5Z0lutiWhe9nZIyIUjyXDC3UsaG1t+eNx6z4W/OYoTB7A6x+dNSTOi9AInctbESqm5gvOLww7OWXPrmHwVZasrl4eD113pm+JtT7JVOvnCXqdzzdTRHgJ0PiGTFYW5Gvt9R9LD6Lzfs0v/TZZHSmyVNq7viIHE6DBK7Qp07Iz55EM8SYtQvZf/obBniTWi5C2/ovHfw4VndkE5XYdjOhCMRjDeOEfXeN/CwfGduiUIfsoFeUxXeQXba7c7972XNv8w+dTjjUM0QeNAReW+J014dKAD/McQYXT7c0GQPIkn3Ll6R7gGjuiQoZD0TEeEqQpKoZ15g/0OPQI17QiSv9AUROa/V/TQN3dvLArec3RrsYlvBm1b8LWzltdugsC50lNKYLEp2a+ZZYqPejULRlOJh5zj/LVMyTDvwKhMxxwuDkxJ1QpoNI0OTWLom4Z71SNzI9TV1iXJrIu9Wcnd+MCaAw8o1jSXd94YU/1gnkrC9BUEOtQvEIQ7g0i6h+KL2JKk8Ydl7HruvgWMSAmNe+LshGhV4qnWHhO9/RIPQzY1tHRj2VqOyNsDpK0cww+56AdDC4gsWwY0XxoucIWIqs/GcwnWqlaT0KPr8mbK5U94/301i1WLt4YINTVvCFBrFZbIbY8eycOdeJ2teD5IfPLCRg7jjcFTwlMFNl9zdh/o3E/hHPwj7BWg0MU09pPrBLbrCgm54A6H+I6v27+jL5gkjWg/iYdks9jbfVP5y/n0dlgWEMlKasl7JvFZd56LfybW1eeaVO0gxTfXZwD8G4SI116yx7UKVRgui6Ya1YpixqXeNLc8IxtAwCU5IhwQgn+NqHnRaDv61CxKhOq4pOX7M6pkA+Pmpd4j1vn6ACUALoLLc4vpXci8VidLxzm7qFBe7s+quuJs6ETYmnpgS3LwSZxPIltgBDXz8M1k/W2ySNv2f9/NPhxLGK2D21dkHeSGmenRT3Yqcdl0m/h3OYr8V+lXNYGf8aCCpd4bWjE4QIPj7vUKN4Nrfs7ML6Y2OyS830JCnofg/k7lpFpt4SqZc5HGg1HCOrHvOdC8bP6FGDbE/VV0mX4IakzbdS/op+Kt3G24/8QbBV7y86sGSQ/vZzU8FXs7u6jIvwchsEP2BpIhW3G8uWNwa3HmjfH/ZjhhCWvluAcF+nMf14ClKg5hGgtPLJ98ueNAkc5Hs2WZlk2QHvfreCK1CCGO6nMZVSb99VM/ajr8WHTte9JSmkXq/i/U943HEbdzW6Re/S88dKgg8pGOLlAeNiqrcLkUR3/aClFpMXcOUP3rmETcWSfMXZE3TUOi8i+fqRnTYLflVx/Vb/6GJ7eIRZUA6k3RYR3iFSK9c4iDdNwJuZL2FKz/IK5VimcNWEqdXjSoxSgmF0UPlDoUlNrPcM7ftmA8Y9gKiqKEHuWN+AZRIwtVSxye2Kf8rM3lhJ5XcBXU9n4v0Oy1RU2M+4qM8AQPVwse8ErNSob5oFPWxuqZnVzo1qB/IBxkM3EVUKFUUlO3e51259GgNcJbCmlvrdjtoTW7rChm1wyCKzpCTwozUUEOIcWLneRLgMXh+SjGSFkAllzbGS5HK7LlfCMRNRDSvbQPjcXaenNYxCvu2Qyznz6StuxVj66SgI0T8B6/sfHAJYZaZ78thjOSIFumNWLQbeZixDCCC+v0YBtkxiBB3jefHqZ/dFHU+crbj6OvS1x/JDD7vlm7zOVPwpUC01nhxZuY/63E7g"
165;const Bw=44032,DS=4352,OS=4449,LS=4519,nW=19,iW=21,O0=28,US=iW*O0,Tue=nW*US,Pue=Bw+Tue,Cue=DS+nW,Iue=OS+iW,Rue=LS+O0;function Pv(n){return n>>24&255}function rW(n){return n&16777215}let OI,h8,LI,PE;function Nue(){let n=Qj(Mue);OI=new Map(Zj(n).flatMap((e,t)=>e.map(i=>[i,t+1<<24]))),h8=new Set(Lw(n)),LI=new Map,PE=new Map;for(let[e,t]of Jj(n)){if(!h8.has(e)&&t.length==2){let[i,r]=t,s=PE.get(i);s||(s=new Map,PE.set(i,s)),s.set(r,e)}LI.set(e,t.reverse())}}function sW(n){return n>=Bw&&n<Pue}function Due(n,e){if(n>=DS&&n<Cue&&e>=OS&&e<Iue)return Bw+(n-DS)*US+(e-OS)*O0;if(sW(n)&&e>LS&&e<Rue&&(n-Bw)%O0==0)return n+(e-LS);{let t=PE.get(n);return t&&(t=t.get(e),t)?t:-1}}function oW(n){OI||Nue();let e=[],t=[],i=!1;function r(s){let o=OI.get(s);o&&(i=!0,s|=o),e.push(s)}for(let s of n)for(;;){if(s<128)e.push(s);else if(sW(s)){let o=s-Bw,a=o/US|0,l=o%US/O0|0,c=o%O0;r(DS+a),r(OS+l),c>0&&r(LS+c)}else{let o=LI.get(s);o?t.push(...o):r(s)}if(!t.length)break;s=t.pop()}if(i&&e.length>1){let s=Pv(e[0]);for(let o=1;o<e.length;o++){let a=Pv(e[o]);if(a==0||s<=a){s=a;continue}let l=o-1;for(;;){let c=e[l+1];if(e[l+1]=e[l],e[l]=c,!l||(s=Pv(e[--l]),s<=a))break}s=Pv(e[o])}}return e}function Oue(n){let e=[],t=[],i=-1,r=0;for(let s of n){let o=Pv(s),a=rW(s);if(i==-1)o==0?i=a:e.push(a);else if(r>0&&r>=o)o==0?(e.push(i,...t),t.length=0,i=a):t.push(a),r=o;else{let l=Due(i,a);l>=0?i=l:r==0&&o==0?(e.push(i),i=a):(t.push(a),r=o)}}return i>=0&&e.push(i,...t),e}function aW(n){return oW(n).map(rW)}function Lue(n){return Oue(oW(n))}const f8=45,lW=".",cW=65039,uW=1,BS=n=>Array.from(n);function kw(n,e){return n.P.has(e)||n.Q.has(e)}class Uue extends Array{get is_emoji(){return!0}}let UI,hW,fd,BI,fW,_g,cP,Rm,Wf,d8,kI;function NO(){if(UI)return;let n=Qj(pue);const e=()=>Lw(n),t=()=>new Set(e()),i=(u,h)=>h.forEach(f=>u.add(f));UI=new Map(Jj(n)),hW=t(),fd=e(),BI=new Set(e().map(u=>fd[u])),fd=new Set(fd),fW=t(),t();let r=Zj(n),s=n();const o=()=>{let u=new Set;return e().forEach(h=>i(u,r[h])),i(u,e()),u};_g=Uw(u=>{let h=Uw(n).map(f=>f+96);if(h.length){let f=u>=s;h[0]-=32,h=D0(h),f&&(h=`Restricted[${h}]`);let m=o(),g=o(),v=!n();return{N:h,P:m,Q:g,M:v,R:f}}}),cP=t(),Rm=new Map;let a=e().concat(BS(cP)).sort((u,h)=>u-h);a.forEach((u,h)=>{let f=n(),m=a[h]=f?a[h-f]:{V:[],M:new Map};m.V.push(u),cP.has(u)||Rm.set(u,m)});for(let{V:u,M:h}of new Set(Rm.values())){let f=[];for(let g of u){let v=_g.filter(y=>kw(y,g)),w=f.find(({G:y})=>v.some(_=>y.has(_)));w||(w={G:new Set,V:[]},f.push(w)),w.V.push(g),i(w.G,v)}let m=f.flatMap(g=>BS(g.G));for(let{G:g,V:v}of f){let w=new Set(m.filter(y=>!g.has(y)));for(let y of v)h.set(y,w)}}Wf=new Set;let l=new Set;const c=u=>Wf.has(u)?l.add(u):Wf.add(u);for(let u of _g){for(let h of u.P)c(h);for(let h of u.Q)c(h)}for(let u of Wf)!Rm.has(u)&&!l.has(u)&&Rm.set(u,uW);i(Wf,aW(Wf)),d8=_ue(n).map(u=>Uue.from(u)).sort(Aue),kI=new Map;for(let u of d8){let h=[kI];for(let f of u){let m=h.map(g=>{let v=g.get(f);return v||(v=new Map,g.set(f,v)),v});f===cW?h.push(...m):h=m}for(let f of h)f.V=u}}function DO(n){return(dW(n)?"":`${OO(n2([n]))} `)+tW(n)}function OO(n){return`"${n}"‎`}function Bue(n){if(n.length>=4&&n[2]==f8&&n[3]==f8)throw new Error(`invalid label extension: "${D0(n.slice(0,4))}"`)}function kue(n){for(let t=n.lastIndexOf(95);t>0;)if(n[--t]!==95)throw new Error("underscore allowed only at start")}function Fue(n){let e=n[0],t=c8.get(e);if(t)throw Yv(`leading ${t}`);let i=n.length,r=-1;for(let s=1;s<i;s++){e=n[s];let o=c8.get(e);if(o){if(r==s)throw Yv(`${t} + ${o}`);r=s+1,t=o}}if(r==i)throw Yv(`trailing ${t}`)}function n2(n,e=1/0,t=tW){let i=[];zue(n[0])&&i.push("◌"),n.length>e&&(e>>=1,n=[...n.slice(0,e),8230,...n.slice(-e)]);let r=0,s=n.length;for(let o=0;o<s;o++){let a=n[o];dW(a)&&(i.push(D0(n.slice(r,o))),i.push(t(a)),r=o+1)}return i.push(D0(n.slice(r,s))),i.join("")}function zue(n){return NO(),fd.has(n)}function dW(n){return NO(),fW.has(n)}function Vue(n){return jue(Hue(n,Lue,Kue))}function Hue(n,e,t){if(!n)return[];NO();let i=0;return n.split(lW).map(r=>{let s=Sue(r),o={input:s,offset:i};i+=s.length+1;try{let a=o.tokens=que(s,e,t),l=a.length,c;if(!l)throw new Error("empty label");let u=o.output=a.flat();if(kue(u),!(o.emoji=l>1||a[0].is_emoji)&&u.every(f=>f<128))Bue(u),c="ASCII";else{let f=a.flatMap(m=>m.is_emoji?[]:m);if(!f.length)c="Emoji";else{if(fd.has(u[0]))throw Yv("leading combining mark");for(let v=1;v<l;v++){let w=a[v];
165if(!w.is_emoji&&fd.has(w[0]))throw Yv(`emoji + combining mark: "${D0(a[v-1])} + ${n2([w[0]])}"`)}Fue(u);let m=BS(new Set(f)),[g]=Gue(m);Wue(g,f),$ue(g,m),c=g.N}}o.type=c}catch(a){o.error=a}return o})}function $ue(n,e){let t,i=[];for(let r of e){let s=Rm.get(r);if(s===uW)return;if(s){let o=s.M.get(r);if(t=t?t.filter(a=>o.has(a)):BS(o),!t.length)return}else i.push(r)}if(t){for(let r of t)if(i.every(s=>kw(r,s)))throw new Error(`whole-script confusable: ${n.N}/${r.N}`)}}function Gue(n){let e=_g;for(let t of n){let i=e.filter(r=>kw(r,t));if(!i.length)throw _g.some(r=>kw(r,t))?mW(e[0],t):pW(t);if(e=i,i.length==1)break}return e}function jue(n){return n.map(({input:e,error:t,output:i})=>{if(t){let r=t.message;throw new Error(n.length==1?r:`Invalid label ${OO(n2(e,63))}: ${r}`)}return D0(i)}).join(lW)}function pW(n){return new Error(`disallowed character: ${DO(n)}`)}function mW(n,e){let t=DO(e),i=_g.find(r=>r.P.has(e));return i&&(t=`${i.N} ${t}`),new Error(`illegal mixture: ${n.N} + ${t}`)}function Yv(n){return new Error(`illegal placement: ${n}`)}function Wue(n,e){for(let t of e)if(!kw(n,t))throw mW(n,t);if(n.M){let t=aW(e);for(let i=1,r=t.length;i<r;i++)if(BI.has(t[i])){let s=i+1;for(let o;s<r&&BI.has(o=t[s]);s++)for(let a=i;a<s;a++)if(t[a]==o)throw new Error(`duplicate non-spacing marks: ${DO(o)}`);if(s-i>u8)throw new Error(`excessive non-spacing marks: ${OO(n2(t.slice(i-1,s)))} (${s-i}/${u8})`);i=s}}}function que(n,e,t){let i=[],r=[];for(n=n.slice().reverse();n.length;){let s=Xue(n);if(s)r.length&&(i.push(e(r)),r=[]),i.push(t(s));else{let o=n.pop();if(Wf.has(o))r.push(o);else{let a=UI.get(o);if(a)r.push(...a);else if(!hW.has(o))throw pW(o)}}}return r.length&&i.push(e(r)),i}function Kue(n){return n.filter(e=>e!=cW)}function Xue(n,e){let t=kI,i,r=n.length;for(;r&&(t=t.get(n[--r]),!!t);){let{V:s}=t;s&&(i=s,n.length=r)}return i}const gW=new Uint8Array(32);gW.fill(0);function p8(n){return ie(n.length!==0,"invalid ENS name; empty component","comp",n),n}function yW(n){const e=Gc(Yue(n)),t=[];if(n.length===0)return t;let i=0;for(let r=0;r<e.length;r++)e[r]===46&&(t.push(p8(e.slice(i,r))),i=r+1);return ie(i<e.length,"invalid ENS name; empty component","name",n),t.push(p8(e.slice(i))),t}function Yue(n){try{if(n.length===0)throw new Error("empty label");return Vue(n)}catch(e){ie(!1,`invalid ENS name (${e.message})`,"name",n)}}function FI(n){ie(typeof n=="string","invalid ENS name; not a string","name",n),ie(n.length,"invalid ENS name (empty label)","name",n);let e=gW;const t=yW(n);for(;t.length;)e=Si(ri([e,Si(t.pop())]));return Ye(e)}function Que(n,e){const t=e;return ie(t<=255,"DNS encoded label cannot exceed 255","length",t),Ye(ri(yW(n).map(i=>{ie(i.length<=t,`label ${JSON.stringify(n)} exceeds ${t} bytes`,"name",n);const r=new Uint8Array(i.length+1);return r.set(i,1),r[0]=r.length-1,r})))+"00"}const vW=new Uint8Array(32);vW.fill(0);const Zue=BigInt(-1),wW=BigInt(0),xW=BigInt(1),Jue=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function ehe(n){const e=Gt(n),t=e.length%32;return t?ri([e,vW.slice(t)]):Ye(e)}const the=jh(xW,32),nhe=jh(wW,32),m8={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},uP=["name","version","chainId","verifyingContract","salt"];function g8(n){return function(e){return ie(typeof e=="string",`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const ihe={name:g8("name"),version:g8("version"),chainId:function(n){const e=ot(n,"domain.chainId");return ie(e>=0,"invalid chain ID","domain.chainId",n),Number.isSafeInteger(e)?Number(e):Na(e)},verifyingContract:function(n){try{return hn(n).toLowerCase()}catch{}ie(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){const e=Gt(n,"domain.salt");return ie(e.length===32,'invalid domain value "salt"',"domain.salt",n),Ye(e)}};function hP(n){{const e=n.match(/^(u?)int(\d+)$/);
165if(e){const t=e[1]==="",i=parseInt(e[2]);ie(i%8===0&&i!==0&&i<=256&&e[2]===String(i),"invalid numeric width","type",n);const r=Mv(Jue,t?i-1:i),s=t?(r+xW)*Zue:wW;return function(o){const a=ot(o,"value");return ie(a>=s&&a<=r,`value out-of-bounds for ${n}`,"value",a),jh(t?sj(a,256):a,32)}}}{const e=n.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return ie(t!==0&&t<=32&&e[1]===String(t),"invalid bytes width","type",n),function(i){const r=Gt(i);return ie(r.length===t,`invalid length for ${n}`,"value",i),ehe(i)}}}switch(n){case"address":return function(e){return tu(hn(e),32)};case"bool":return function(e){return e?the:nhe};case"bytes":return function(e){return Si(e)};case"string":return function(e){return sp(e)}}return null}function y8(n,e){return`${n}(${e.map(({name:t,type:i})=>i+" "+t).join(",")})`}function zb(n){const e=n.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:n}}var E1,Sc,t0,wA,bW;const $o=class $o{constructor(e){ge(this,wA);ce(this,"primaryType");ge(this,E1);ge(this,Sc);ge(this,t0);ee(this,Sc,new Map),ee(this,t0,new Map);const t=new Map,i=new Map,r=new Map,s={};Object.keys(e).forEach(l=>{s[l]=e[l].map(({name:c,type:u})=>{let{base:h,index:f}=zb(u);return h==="int"&&!e.int&&(h="int256"),h==="uint"&&!e.uint&&(h="uint256"),{name:c,type:h+(f||"")}}),t.set(l,new Set),i.set(l,[]),r.set(l,new Set)}),ee(this,E1,JSON.stringify(s));for(const l in s){const c=new Set;for(const u of s[l]){ie(!c.has(u.name),`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),c.add(u.name);const h=zb(u.type).base;ie(h!==l,`circular type reference to ${JSON.stringify(h)}`,"types",e),!hP(h)&&(ie(i.has(h),`unknown type ${JSON.stringify(h)}`,"types",e),i.get(h).push(l),t.get(l).add(h))}}const o=Array.from(i.keys()).filter(l=>i.get(l).length===0);ie(o.length!==0,"missing primary type","types",e),ie(o.length===1,`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),vt(this,{primaryType:o[0]});function a(l,c){ie(!c.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),c.add(l);for(const u of t.get(l))if(i.has(u)){a(u,c);for(const h of c)r.get(h).add(u)}c.delete(l)}a(this.primaryType,new Set);for(const[l,c]of r){const u=Array.from(c);u.sort(),V(this,Sc).set(l,y8(l,s[l])+u.map(h=>y8(h,s[h])).join(""))}}get types(){return JSON.parse(V(this,E1))}getEncoder(e){let t=V(this,t0).get(e);return t||(t=Ge(this,wA,bW).call(this,e),V(this,t0).set(e,t)),t}encodeType(e){const t=V(this,Sc).get(e);return ie(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Si(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,i){if(hP(e))return i(e,t);const r=zb(e).array;if(r)return ie(r.count===-1||r.count===t.length,`array length mismatch; expected length ${r.count}`,"value",t),t.map(o=>this._visit(r.prefix,o,i));const s=this.types[e];if(s)return s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,t[a],i),o),{});ie(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new $o(e)}static getPrimaryType(e){return $o.from(e).primaryType}static hashStruct(e,t,i){return $o.from(t).hashStruct(e,i)}static hashDomain(e){const t=[];for(const i in e){if(e[i]==null)continue;const r=m8[i];ie(r,`invalid typed-data domain key: ${JSON.stringify(i)}`,"domain",e),t.push({name:i,type:r})}return t.sort((i,r)=>uP.indexOf(i.name)-uP.indexOf(r.name)),$o.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,i){return ri(["0x1901",$o.hashDomain(e),$o.from(t).hash(i)])}static hash(e,t,i){return Si($o.encode(e,t,i))}static async resolveNames(e,t,i,r){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const s={};e.verifyingContract&&!Cn(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=$o.from(t);o.visit(i,(a,l)=>(a==="address"&&!Cn(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=await r(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),i=o.visit(i,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:i}}static getPayload(e,t,i){$o.hashDomain(e);const r={},s=[];uP.forEach(l=>{const c=e[l];c!=null&&(r[l]=ihe[l](c),s.push({name:l,type:m8[l]}))});const o=$o.from(t);t=o.types;const a=Object.assign({},t);return ie(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",t),a.EIP712Domain=s,o.encode(i),{types:a,domain:r,primaryType:o.primaryType,message:o.visit(i,(l,c)=>{if(l.match(/^bytes(\d*)/))return Ye(Gt(c));if(l.match(/^u?int/))return ot(c).toString();switch(l){case"address":return c.toLowerCase();case"bool":return!!c;
165case"string":return ie(typeof c=="string","invalid string","value",c),c}ie(!1,"unsupported type","type",l)})}}};E1=new WeakMap,Sc=new WeakMap,t0=new WeakMap,wA=new WeakSet,bW=function(e){{const r=hP(e);if(r)return r}const t=zb(e).array;if(t){const r=t.prefix,s=this.getEncoder(r);return o=>{ie(t.count===-1||t.count===o.length,`array length mismatch; expected length ${t.count}`,"value",o);let a=o.map(s);return V(this,Sc).has(r)&&(a=a.map(Si)),Si(ri(a))}}const i=this.types[e];if(i){const r=sp(V(this,Sc).get(e));return s=>{const o=i.map(({name:a,type:l})=>{const c=this.getEncoder(l)(s[a]);return V(this,Sc).has(l)?Si(c):c});return o.unshift(r),ri(o)}}ie(!1,`unknown type: ${e}`,"type",e)};let kS=$o;function rs(n){const e=new Set;return n.forEach(t=>e.add(t)),Object.freeze(e)}const rhe="external public payable override",she=rs(rhe.split(" ")),_W="constant external internal payable private public pure view override",ohe=rs(_W.split(" ")),EW="constructor error event fallback function receive struct",SW=rs(EW.split(" ")),AW="calldata memory storage payable indexed",ahe=rs(AW.split(" ")),lhe="tuple returns",che=[EW,AW,lhe,_W].join(" "),uhe=rs(che.split(" ")),hhe={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},fhe=new RegExp("^(\\s*)"),dhe=new RegExp("^([0-9]+)"),phe=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),MW=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),TW=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");var ar,Pa,S1,zI;const xA=class xA{constructor(e){ge(this,S1);ge(this,ar);ge(this,Pa);ee(this,ar,0),ee(this,Pa,e.slice())}get offset(){return V(this,ar)}get length(){return V(this,Pa).length-V(this,ar)}clone(){return new xA(V(this,Pa))}reset(){ee(this,ar,0)}popKeyword(e){const t=this.peek();if(t.type!=="KEYWORD"||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=Ge(this,S1,zI).call(this,V(this,ar)+1,e.match+1);return ee(this,ar,e.match+1),t}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=[];for(;V(this,ar)<e.match-1;){const i=this.peek().linkNext;t.push(Ge(this,S1,zI).call(this,V(this,ar)+1,i)),ee(this,ar,i)}return ee(this,ar,e.match+1),t}peek(){if(V(this,ar)>=V(this,Pa).length)throw new Error("out-of-bounds");return V(this,Pa)[V(this,ar)]}peekKeyword(e){const t=this.peekType("KEYWORD");return t!=null&&e.has(t)?t:null}peekType(e){if(this.length===0)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return Cy(this,ar)._++,e}toString(){const e=[];for(let t=V(this,ar);t<V(this,Pa).length;t++){const i=V(this,Pa)[t];e.push(`${i.type}:${i.text}`)}return`<TokenString ${e.join(" ")}>`}};ar=new WeakMap,Pa=new WeakMap,S1=new WeakSet,zI=function(e=0,t=0){return new xA(V(this,Pa).slice(e,t).map(i=>Object.freeze(Object.assign({},i,{match:i.match-e,linkBack:i.linkBack-e,linkNext:i.linkNext-e}))))};let Va=xA;function rf(n){const e=[],t=o=>{const a=s<n.length?JSON.stringify(n[s]):"$EOI";throw new Error(`invalid token ${a} at ${s}: ${o}`)};let i=[],r=[],s=0;for(;s<n.length;){let o=n.substring(s),a=o.match(fhe);a&&(s+=a[1].length,o=n.substring(s));const l={depth:i.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:s,value:-1};e.push(l);let c=hhe[o[0]]||"";if(c){if(l.type=c,l.text=o[0],s++,c==="OPEN_PAREN")i.push(e.length-1),r.push(e.length-1);else if(c=="CLOSE_PAREN")i.length===0&&t("no matching open bracket"),l.match=i.pop(),e[l.match].match=e.length-1,l.depth--,l.linkBack=r.pop(),e[l.linkBack].linkNext=e.length-1;else if(c==="COMMA")l.linkBack=r.pop(),e[l.linkBack].linkNext=e.length-1,r.push(e.length-1);else if(c==="OPEN_BRACKET")l.type="BRACKET";else if(c==="CLOSE_BRACKET"){let u=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const h=e.pop().text;u=h+u,e[e.length-1].value=jt(h)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=u}continue}if(a=o.match(phe),a){if(l.text=a[1],s+=l.text.length,uhe.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(TW)){l.type="TYPE";continue}l.type="ID";continue}if(a=o.match(dhe),a){l.text=a[1],l.type="NUMBER",s+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${s}`)}return new Va(e.map(o=>Object.freeze(o)))}function v8(n,e){let t=[];for(const i in e.keys())n.has(i)&&t.push(i);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function i2(n,e){if(e.peekKeyword(SW)){const t=e.pop().text;if(t!==n)throw new Error(`expected ${n}, got ${t}`)}return e.popType("ID")}function nu(n,e){const t=new Set;for(;;){const i=n.peekType("KEYWORD");if(i==null||e&&!e.has(i))break;if(n.pop(),t.has(i))throw new Error(`duplicate keywords: ${JSON.stringify(i)}`);t.add(i)}return Object.freeze(t)}function PW(n){let e=nu(n,ohe);return v8(e,rs("constant payable nonpayable".split(" "))),v8(e,rs("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function jc(n,e){return n.popParams().map(t=>dr.from(t,e))}function CW(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return ot(n.pop().text);throw new Error("invalid gas")}return null}function op(n){if(n.length)throw new Error(`unexpected tokens at offset ${n.offset}: ${n.toString()}`)}const mhe=new RegExp(/^(.*)\[([0-9]*)\]$/);function w8(n){const e=n.match(TW);
165if(ie(e,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(e[2]){const t=parseInt(e[2]);ie(t!==0&&t<=32,"invalid bytes length","type",n)}else if(e[3]){const t=parseInt(e[3]);ie(t!==0&&t<=256&&t%8===0,"invalid numeric width","type",n)}return n}const jn={},Fs=Symbol.for("_ethers_internal"),x8="_ParamTypeInternal",b8="_ErrorInternal",_8="_EventInternal",E8="_ConstructorInternal",S8="_FallbackInternal",A8="_FunctionInternal",M8="_StructInternal";var n0,CE;const Go=class Go{constructor(e,t,i,r,s,o,a,l){ge(this,n0);ce(this,"name");ce(this,"type");ce(this,"baseType");ce(this,"indexed");ce(this,"components");ce(this,"arrayLength");ce(this,"arrayChildren");if(qA(e,jn,"ParamType"),Object.defineProperty(this,Fs,{value:x8}),o&&(o=Object.freeze(o.slice())),r==="array"){if(a==null||l==null)throw new Error("")}else if(a!=null||l!=null)throw new Error("");if(r==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");vt(this,{name:t,type:i,baseType:r,indexed:s,components:o,arrayLength:a,arrayChildren:l})}format(e){if(e==null&&(e="sighash"),e==="json"){const i=this.name||"";if(this.isArray()){const s=JSON.parse(this.arrayChildren.format("json"));return s.name=i,s.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(s)}const r={type:this.baseType==="tuple"?"tuple":this.type,name:i};return typeof this.indexed=="boolean"&&(r.indexed=this.indexed),this.isTuple()&&(r.components=this.components.map(s=>JSON.parse(s.format(e)))),JSON.stringify(r)}let t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map(i=>i.format(e)).join(e==="full"?", ":",")+")":t+=this.type,e!=="sighash"&&(this.indexed===!0&&(t+=" indexed"),e==="full"&&this.name&&(t+=" "+this.name)),t}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,t){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const i=this;return e.map(r=>i.arrayChildren.walk(r,t))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const i=this;return e.map((r,s)=>i.components[s].walk(r,t))}return t(this.type,e)}async walkAsync(e,t){const i=[],r=[e];return Ge(this,n0,CE).call(this,i,e,t,s=>{r[0]=s}),i.length&&await Promise.all(i),r[0]}static from(e,t){if(Go.isParamType(e))return e;if(typeof e=="string")try{return Go.from(rf(e),t)}catch{ie(!1,"invalid param type","obj",e)}else if(e instanceof Va){let a="",l="",c=null;nu(e,rs(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",c=e.popParams().map(v=>Go.from(v)),a=`tuple(${c.map(v=>v.format()).join(",")})`):(a=w8(e.popType("TYPE")),l=a);let u=null,h=null;for(;e.length&&e.peekType("BRACKET");){const v=e.pop();u=new Go(jn,"",a,l,null,c,h,u),h=v.value,a+=v.text,l="array",c=null}let f=null;if(nu(e,ahe).has("indexed")){if(!t)throw new Error("");f=!0}
165const g=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Go(jn,g,a,l,f,c,h,u)}const i=e.name;ie(!i||typeof i=="string"&&i.match(MW),"invalid name","obj.name",i);let r=e.indexed;r!=null&&(ie(t,"parameter cannot be indexed","obj.indexed",e.indexed),r=!!r);let s=e.type,o=s.match(mhe);if(o){const a=parseInt(o[2]||"-1"),l=Go.from({type:o[1],components:e.components});return new Go(jn,i||"",s,"array",r,null,a,l)}if(s==="tuple"||s.startsWith("tuple(")||s.startsWith("(")){const a=e.components!=null?e.components.map(c=>Go.from(c)):null;return new Go(jn,i||"",s,"tuple",r,a,null,null)}return s=w8(e.type),new Go(jn,i||"",s,s,r,null,null,null)}static isParamType(e){return e&&e[Fs]===x8}};n0=new WeakSet,CE=function(e,t,i,r){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=t.slice();a.forEach((l,c)=>{var u;Ge(u=o,n0,CE).call(u,e,l,i,h=>{a[c]=h})}),r(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(t))a=t.slice();else{if(t==null||typeof t!="object")throw new Error("invalid tuple value");a=o.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in t))throw new Error(`missing value for component ${l.name}`);return t[l.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((l,c)=>{var u;Ge(u=o[c],n0,CE).call(u,e,l,i,h=>{a[c]=h})}),r(a);return}const s=i(this.type,t);s.then?e.push(async function(){r(await s)}()):r(s)};let dr=Go;class ap{constructor(e,t,i){ce(this,"type");ce(this,"inputs");qA(e,jn,"Fragment"),i=Object.freeze(i.slice()),vt(this,{type:t,inputs:i})}static from(e){if(typeof e=="string"){try{ap.from(JSON.parse(e))}catch{}return ap.from(rf(e))}if(e instanceof Va)switch(e.peekKeyword(SW)){case"constructor":return Bc.from(e);case"error":return Cs.from(e);case"event":return Ml.from(e);case"fallback":case"receive":return yc.from(e);case"function":return Tl.from(e);case"struct":return Kd.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Bc.from(e);case"error":return Cs.from(e);case"event":return Ml.from(e);case"fallback":case"receive":return yc.from(e);case"function":return Tl.from(e);case"struct":return Kd.from(e)}Ie(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}ie(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Bc.isFragment(e)}static isError(e){return Cs.isFragment(e)}static isEvent(e){return Ml.isFragment(e)}static isFunction(e){return Tl.isFragment(e)}static isStruct(e){return Kd.isFragment(e)}}class r2 extends ap{constructor(t,i,r,s){super(t,i,s);ce(this,"name");ie(typeof r=="string"&&r.match(MW),"invalid identifier","name",r),s=Object.freeze(s.slice()),vt(this,{name:r})}}function Fw(n,e){return"("+e.map(t=>t.format(n)).join(n==="full"?", ":",")+")"}class Cs extends r2{constructor(e,t,i){super(e,"error",t,i),Object.defineProperty(this,Fs,{value:b8})}get selector(){return sp(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(i=>JSON.parse(i.format(e)))});const t=[];return e!=="sighash"&&t.push("error"),t.push(this.name+Fw(e,this.inputs)),t.join(" ")}static from(e){if(Cs.isFragment(e))return e;if(typeof e=="string")return Cs.from(rf(e));if(e instanceof Va){const t=i2("error",e),i=jc(e);return op(e),new Cs(jn,t,i)}return new Cs(jn,e.name,e.inputs?e.inputs.map(dr.from):[])}static isFragment(e){return e&&e[Fs]===b8}}class Ml extends r2{constructor(t,i,r,s){super(t,"event",i,r);ce(this,"anonymous");Object.defineProperty(this,Fs,{value:_8}),vt(this,{anonymous:s})}get topicHash(){return sp(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const i=[];return t!=="sighash"&&i.push("event"),i.push(this.name+Fw(t,this.inputs)),t!=="sighash"&&this.anonymous&&i.push("anonymous"),i.join(" ")}static getTopicHash(t,i){return i=(i||[]).map(s=>dr.from(s)),new Ml(jn,t,i,!1).topicHash}static from(t){if(Ml.isFragment(t))return t;if(typeof t=="string")try{return Ml.from(rf(t))}catch{ie(!1,"invalid event fragment","obj",t)}else if(t instanceof Va){const i=i2("event",t),r=jc(t,!0),s=!!nu(t,rs(["anonymous"])).has("anonymous");return op(t),new Ml(jn,i,r,s)}return new Ml(jn,t.name,t.inputs?t.inputs.map(i=>dr.from(i,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[Fs]===_8}}class Bc extends ap{constructor(t,i,r,s,o){super(t,i,r);ce(this,"payable");ce(this,"gas");Object.defineProperty(this,Fs,{value:E8}),vt(this,{payable:s,gas:o})}
165format(t){if(Ie(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t)))});const i=[`constructor${Fw(t,this.inputs)}`];return this.payable&&i.push("payable"),this.gas!=null&&i.push(`@${this.gas.toString()}`),i.join(" ")}static from(t){if(Bc.isFragment(t))return t;if(typeof t=="string")try{return Bc.from(rf(t))}catch{ie(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof Va){nu(t,rs(["constructor"]));const i=jc(t),r=!!nu(t,she).has("payable"),s=CW(t);return op(t),new Bc(jn,"constructor",i,r,s)}return new Bc(jn,"constructor",t.inputs?t.inputs.map(dr.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[Fs]===E8}}class yc extends ap{constructor(t,i,r){super(t,"fallback",i);ce(this,"payable");Object.defineProperty(this,Fs,{value:S8}),vt(this,{payable:r})}format(t){const i=this.inputs.length===0?"receive":"fallback";if(t==="json"){const r=this.payable?"payable":"nonpayable";return JSON.stringify({type:i,stateMutability:r})}return`${i}()${this.payable?" payable":""}`}static from(t){if(yc.isFragment(t))return t;if(typeof t=="string")try{return yc.from(rf(t))}catch{ie(!1,"invalid fallback fragment","obj",t)}else if(t instanceof Va){const i=t.toString(),r=t.peekKeyword(rs(["fallback","receive"]));if(ie(r,"type must be fallback or receive","obj",i),t.popKeyword(rs(["fallback","receive"]))==="receive"){const l=jc(t);return ie(l.length===0,"receive cannot have arguments","obj.inputs",l),nu(t,rs(["payable"])),op(t),new yc(jn,[],!0)}let o=jc(t);o.length?ie(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(l=>l.format("minimal")).join(", ")):o=[dr.from("bytes")];const a=PW(t);if(ie(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),nu(t,rs(["returns"])).has("returns")){const l=jc(t);ie(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(c=>c.format("minimal")).join(", "))}return op(t),new yc(jn,o,a==="payable")}if(t.type==="receive")return new yc(jn,[],!0);if(t.type==="fallback"){const i=[dr.from("bytes")],r=t.stateMutability==="payable";return new yc(jn,i,r)}ie(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[Fs]===S8}}class Tl extends r2{constructor(t,i,r,s,o,a){super(t,"function",i,s);ce(this,"constant");ce(this,"outputs");ce(this,"stateMutability");ce(this,"payable");ce(this,"gas");Object.defineProperty(this,Fs,{value:A8}),o=Object.freeze(o.slice()),vt(this,{constant:r==="view"||r==="pure",gas:a,outputs:o,payable:r==="payable",stateMutability:r})}get selector(){return sp(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(t))),outputs:this.outputs.map(r=>JSON.parse(r.format(t)))});const i=[];return t!=="sighash"&&i.push("function"),i.push(this.name+Fw(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&i.push(this.stateMutability),this.outputs&&this.outputs.length&&(i.push("returns"),i.push(Fw(t,this.outputs))),this.gas!=null&&i.push(`@${this.gas.toString()}`)),i.join(" ")}static getSelector(t,i){return i=(i||[]).map(s=>dr.from(s)),new Tl(jn,t,"view",i,[],null).selector}static from(t){if(Tl.isFragment(t))return t;if(typeof t=="string")try{return Tl.from(rf(t))}catch{ie(!1,"invalid function fragment","obj",t)}else if(t instanceof Va){const r=i2("function",t),s=jc(t),o=PW(t);let a=[];nu(t,rs(["returns"])).has("returns")&&(a=jc(t));const l=CW(t);return op(t),new Tl(jn,r,o,s,a,l)}let i=t.stateMutability;return i==null&&(i="payable",typeof t.constant=="boolean"?(i="view",t.constant||(i="payable",typeof t.payable=="boolean"&&!t.payable&&(i="nonp
165ayable"))):typeof t.payable=="boolean"&&!t.payable&&(i="nonpayable")),new Tl(jn,t.name,i,t.inputs?t.inputs.map(dr.from):[],t.outputs?t.outputs.map(dr.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[Fs]===A8}}class Kd extends r2{constructor(e,t,i){super(e,"struct",t,i),Object.defineProperty(this,Fs,{value:M8})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return Kd.from(rf(e))}catch{ie(!1,"invalid struct fragment","obj",e)}else if(e instanceof Va){const t=i2("struct",e),i=jc(e);return op(e),new Kd(jn,t,i)}return new Kd(jn,e.name,e.inputs?e.inputs.map(dr.from):[])}static isFragment(e){return e&&e[Fs]===M8}}const Ga=new Map;Ga.set(0,"GENERIC_PANIC");Ga.set(1,"ASSERT_FALSE");Ga.set(17,"OVERFLOW");Ga.set(18,"DIVIDE_BY_ZERO");Ga.set(33,"ENUM_RANGE_ERROR");Ga.set(34,"BAD_STORAGE_DATA");Ga.set(49,"STACK_UNDERFLOW");Ga.set(50,"ARRAY_RANGE_ERROR");Ga.set(65,"OUT_OF_MEMORY");Ga.set(81,"UNINITIALIZED_FUNCTION_CALL");const ghe=new RegExp(/^bytes([0-9]*)$/),yhe=new RegExp(/^(u?int)([0-9]*)$/);let fP=null,T8=1024;function vhe(n,e,t,i){let r="missing revert data",s=null;const o=null;let a=null;if(t){r="execution reverted";const c=Gt(t);if(t=Ye(t),c.length===0)r+=" (no data present; likely require(false) occurred",s="require(false)";else if(c.length%32!==4)r+=" (could not decode reason; invalid data length)";else if(Ye(c.slice(0,4))==="0x08c379a0")try{s=i.decode(["string"],c.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[s]},r+=`: ${JSON.stringify(s)}`}catch{r+=" (could not decode reason; invalid string data)"}else if(Ye(c.slice(0,4))==="0x4e487b71")try{const u=Number(i.decode(["uint256"],c.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[u]},s=`Panic due to ${Ga.get(u)||"UNKNOWN"}(${u})`,r+=`: ${s}`}catch{r+=" (could not decode panic code)"}else r+=" (unknown custom error)"}const l={to:e.to?hn(e.to):null,data:e.data||"0x"};return e.from&&(l.from=hn(e.from)),kn(r,"CALL_EXCEPTION",{action:n,data:t,reason:s,transaction:l,invocation:o,revert:a})}var dh,Nm;const bA=class bA{constructor(){ge(this,dh)}getDefaultValue(e){const t=e.map(r=>Ge(this,dh,Nm).call(this,dr.from(r)));return new Fb(t,"_").defaultValue()}encode(e,t){nj(t.length,e.length,"types/values length mismatch");const i=e.map(o=>Ge(this,dh,Nm).call(this,dr.from(o))),r=new Fb(i,"_"),s=new MI;return r.encode(s,t),s.data}decode(e,t,i){const r=e.map(o=>Ge(this,dh,Nm).call(this,dr.from(o)));return new Fb(r,"_").decode(new TI(t,i,T8))}static _setDefaultMaxInflation(e){ie(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),T8=e}static defaultAbiCoder(){return fP==null&&(fP=new bA),fP}static getBuiltinCallException(e,t,i){return vhe(e,t,i,bA.defaultAbiCoder())}};dh=new WeakSet,Nm=function(e){if(e.isArray())return new Uce(Ge(this,dh,Nm).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new Fb(e.components.map(i=>Ge(this,dh,Nm).call(this,i)),e.name);switch(e.baseType){case"address":return new Oce(e.name);case"bool":return new Bce(e.name);case"string":return new Wce(e.name);case"bytes":return new kce(e.name);case"":return new Vce(e.name)}let t=e.type.match(yhe);if(t){let i=parseInt(t[2]||"256");return ie(i!==0&&i<=256&&i%8===0,"invalid "+t[1]+" bit length","param",e),new jce(i/8,t[1]==="int",e.name)}if(t=e.type.match(ghe),t){let i=parseInt(t[1]);
165return ie(i!==0&&i<=32,"invalid bytes length","param",e),new Fce(i,e.name)}ie(!1,"invalid type","type",e.type)};let zw=bA;class whe{constructor(e,t,i){ce(this,"fragment");ce(this,"name");ce(this,"signature");ce(this,"topic");ce(this,"args");const r=e.name,s=e.format();vt(this,{fragment:e,name:r,signature:s,topic:t,args:i})}}class xhe{constructor(e,t,i,r){ce(this,"fragment");ce(this,"name");ce(this,"args");ce(this,"signature");ce(this,"selector");ce(this,"value");const s=e.name,o=e.format();vt(this,{fragment:e,name:s,args:i,signature:o,selector:t,value:r})}}class bhe{constructor(e,t,i){ce(this,"fragment");ce(this,"name");ce(this,"args");ce(this,"signature");ce(this,"selector");const r=e.name,s=e.format();vt(this,{fragment:e,name:r,args:i,signature:s,selector:t})}}class P8{constructor(e){ce(this,"hash");ce(this,"_isIndexed");vt(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const C8={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},I8={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:n=>`reverted with reason string ${JSON.stringify(n)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:n=>{let e="unknown panic code";return n>=0&&n<=255&&C8[n.toString()]&&(e=C8[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${e})`}}};var yl,vl,wl,Dr,Vl,IE,RE;const sd=class sd{constructor(e){ge(this,Vl);ce(this,"fragments");ce(this,"deploy");ce(this,"fallback");ce(this,"receive");ge(this,yl);ge(this,vl);ge(this,wl);ge(this,Dr);let t=[];typeof e=="string"?t=JSON.parse(e):t=e,ee(this,wl,new Map),ee(this,yl,new Map),ee(this,vl,new Map);const i=[];for(const o of t)try{i.push(ap.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}vt(this,{fragments:Object.freeze(i)});let r=null,s=!1;ee(this,Dr,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let l;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}vt(this,{deploy:o});return;case"fallback":o.inputs.length===0?s=!0:(ie(!r||o.payable!==r.payable,"conflicting fallback fragments",`fragments[${a}]`,o),r=o,s=r.payable);return;case"function":l=V(this,wl);break;case"event":l=V(this,vl);break;case"error":l=V(this,yl);break;default:return}const c=o.format();l.has(c)||l.set(c,o)}),this.deploy||vt(this,{deploy:Bc.from("constructor()")}),vt(this,{fallback:r,receive:s})}format(e){const t=e?"minimal":"full";return this.fragments.map(r=>r.format(t))}formatJson(){const e=this.fragments.map(t=>t.format("json"));return JSON.stringify(e.map(t=>JSON.parse(t)))}getAbiCoder(){return zw.defaultAbiCoder()}getFunctionName(e){const t=Ge(this,Vl,IE).call(this,e,null,!1);return ie(t,"no matching function","key",e),t.name}hasFunction(e){return!!Ge(this,Vl,IE).call(this,e,null,!1)}getFunction(e,t){return Ge(this,Vl,IE).call(this,e,t||null,!0)}forEachFunction(e){const t=Array.from(V(this,wl).keys());t.sort((i,r)=>i.localeCompare(r));for(let i=0;i<t.length;i++){const r=t[i];e(V(this,wl).get(r),i)}}getEventName(e){const t=Ge(this,Vl,RE).call(this,e,null,!1);return ie(t,"no matching event","key",e),t.name}hasEvent(e){return!!Ge(this,Vl,RE).call(this,e,null,!1)}getEvent(e,t){return Ge(this,Vl,RE).call(this,e,t||null,!0)}forEachEvent(e){const t=Array.from(V(this,vl).keys());t.sort((i,r)=>i.localeCompare(r));for(let i=0;i<t.length;i++){const r=t[i];e(V(this,vl).get(r),i)}}getError(e,t){if(Cn(e)){const r=e.toLowerCase();if(I8[r])return Cs.from(I8[r].signature);for(const s of V(this,yl).values())if(r===s.selector)return s;return null}if(e.indexOf("(")===-1){const r=[];for(const[s,o]of V(this,yl))s.split("(")[0]===e&&r.push(o);if(r.length===0)return e==="Error"?Cs.from("error Error(string)"):e==="Panic"?Cs.from("error Panic(uint256)"):null;if(r.length>1){const s=r.map(o=>JSON.stringify(o.format())).join(", ");ie(!1,`ambiguous error description (i.e. ${s})`,"name",e)}return r[0]}if(e=Cs.from(e).format(),e==="Error(string)")return Cs.from("error Error(string)");if(e==="Panic(uint256)")return Cs.from("error Panic(uint256)");const i=V(this,yl).get(e);return i||null}forEachError(e){const t=Array.from(V(this,yl).keys());t.sort((i,r)=>i.localeCompare(r));for(let i=0;i<t.length;i++){const r=t[i];e(V(this,yl).get(r),i)}}_decodeParams(e,t){return V(this,Dr).decode(e,t)}_encodeParams(e,t){return V(this,Dr).encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){if(typeof e=="string"){const i=this.getError(e);ie(i,"unknown error","fragment",e),e=i}return ie(ti(t,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",t),this._decodeParams(e.inputs,ti(t,4))}encodeErrorResult(e,t){if(typeof e=="string"){const i=this.getError(e);ie(i,"unknown error","fragment",e),e=i}return ri([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionData(e,t){if(typeof e=="string"){const i=this.getFunction(e);ie(i,"unknown function","fragment",e),e=i}return ie(ti(t,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",t),this._decodeParams(e.inputs,ti(t,4))}encodeFunctionData(e,t){if(typeof e=="string"){const i=this.getFunction(e);ie(i,"unknown function","fragment",e),e=i}return ri([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionResult(e,t){if(typeof e=="string"){const s=this.getFunction(e);ie(s,"unknown function","fragment",e),e=s}let i="invalid length for result data";const r=es(t);if(r.length%32===0)try{return V(this,Dr).decode(e.outputs,r)}catch{i="could not decode result data"}Ie(!1,i,"BAD_DATA",{value:Ye(r),info:{method:e.name,signature:e.format()}})}makeError(e,t){const i=Gt(e,"data"),r=zw.getBuiltinCallException("call",t,i);if(r.message.startsWith("execution reverted (unknown custom error)")){const a=Ye(i.slice(0,4)),l=this.getError(a);
165if(l)try{const c=V(this,Dr).decode(l.inputs,i.slice(4));r.revert={name:l.name,signature:l.format(),args:c},r.reason=r.revert.signature,r.message=`execution reverted: ${r.reason}`}catch{r.message="execution reverted (coult not decode custom error)"}}const o=this.parseTransaction(t);return o&&(r.invocation={method:o.name,signature:o.signature,args:o.args}),r}encodeFunctionResult(e,t){if(typeof e=="string"){const i=this.getFunction(e);ie(i,"unknown function","fragment",e),e=i}return Ye(V(this,Dr).encode(e.outputs,t||[]))}encodeFilterTopics(e,t){if(typeof e=="string"){const s=this.getEvent(e);ie(s,"unknown event","eventFragment",e),e=s}Ie(t.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:t.length,expectedCount:e.inputs.length});const i=[];e.anonymous||i.push(e.topicHash);const r=(s,o)=>s.type==="string"?sp(o):s.type==="bytes"?Si(Ye(o)):(s.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":s.type.match(/^u?int/)?o=jh(o):s.type.match(/^bytes/)?o=zae(o,32):s.type==="address"&&V(this,Dr).encode(["address"],[o]),tu(Ye(o),32));for(t.forEach((s,o)=>{const a=e.inputs[o];if(!a.indexed){ie(s==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?i.push(null):a.baseType==="array"||a.baseType==="tuple"?ie(!1,"filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?i.push(s.map(l=>r(a,l))):i.push(r(a,s))});i.length&&i[i.length-1]===null;)i.pop();return i}encodeEventLog(e,t){if(typeof e=="string"){const o=this.getEvent(e);ie(o,"unknown event","eventFragment",e),e=o}const i=[],r=[],s=[];return e.anonymous||i.push(e.topicHash),ie(t.length===e.inputs.length,"event arguments/values mismatch","values",t),e.inputs.forEach((o,a)=>{const l=t[a];if(o.indexed)if(o.type==="string")i.push(sp(l));else if(o.type==="bytes")i.push(Si(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");i.push(V(this,Dr).encode([o.type],[l]))}else r.push(o),s.push(l)}),{data:V(this,Dr).encode(r,s),topics:i}}decodeEventLog(e,t,i){if(typeof e=="string"){const m=this.getEvent(e);ie(m,"unknown event","eventFragment",e),e=m}if(i!=null&&!e.anonymous){const m=e.topicHash;ie(Cn(i[0],32)&&i[0].toLowerCase()===m,"fragment/topic mismatch","topics[0]",i[0]),i=i.slice(1)}const r=[],s=[],o=[];e.inputs.forEach((m,g)=>{m.indexed?m.type==="string"||m.type==="bytes"||m.baseType==="tuple"||m.baseType==="array"?(r.push(dr.from({type:"bytes32",name:m.name})),o.push(!0)):(r.push(m),o.push(!1)):(s.push(m),o.push(!1))});const a=i!=null?V(this,Dr).decode(r,ri(i)):null,l=V(this,Dr).decode(s,t,!0),c=[],u=[];let h=0,f=0;return e.inputs.forEach((m,g)=>{let v=null;if(m.indexed)if(a==null)v=new P8(null);else if(o[g])v=new P8(a[f++]);else try{v=a[f++]}catch(w){v=w}else try{v=l[h++]}catch(w){v=w}c.push(v),u.push(m.name||null)}),P0.fromItems(c,u)}parseTransaction(e){const t=Gt(e.data,"tx.data"),i=ot(e.value!=null?e.value:0,"tx.value"),r=this.getFunction(Ye(t.slice(0,4)));if(!r)return null;const s=V(this,Dr).decode(r.inputs,t.slice(4));return new xhe(r,r.selector,s,i)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new whe(t,t.topicHash,this.decodeEventLog(t,e.data,e.topics))}parseError(e){const t=Ye(e),i=this.getError(ti(t,0,4));if(!i)return null;const r=V(this,Dr).decode(i.inputs,ti(t,4));return new bhe(i,i.selector,r)}static from(e){return e instanceof sd?e:typeof e=="string"?new sd(JSON.parse(e)):typeof e.formatJson=="function"?new sd(e.formatJson()):typeof e.format=="function"?new sd(e.format("json")):new sd(e)}};yl=new WeakMap,vl=new WeakMap,wl=new WeakMap,Dr=new WeakMap,Vl=new WeakSet,IE=function(e,t,i){if(Cn(e)){const s=e.toLowerCase();for(const o of V(this,wl).values())if(s===o.selector)return o;return null}if(e.indexOf("(")===-1){const s=[];for(const[o,a]of V(this,wl))o.split("(")[0]===e&&s.push(a);if(t){const o=t.length>0?t[t.length-1]:null;let a=t.length,l=!0;Hr.isTyped(o)&&o.type==="overrides"&&(l=!1,a--);for(let c=s.length-1;c>=0;c--){const u=s[c].inputs.length;u!==a&&(!l||u!==a-1)&&s.splice(c,1)}for(let c=s.length-1;c>=0;c--){const u=s[c].inputs;for(let h=0;h<t.length;h++)if(Hr.isTyped(t[h])){if(h>=u.length){if(t[h].type==="overrides")continue;s.splice(c,1);break}if(t[h].type!==u[h].baseType){s.splice(c,1);break}}}}if(s.length===1&&t&&t.length!==s[0].inputs.length){const o=t[t.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&s.splice(0,1)}if(s.length===0)return null;if(s.length>1&&i){const o=s.map(a=>JSON.stringify(a.format())).join(", ");ie(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return s[0]}const r=V(this,wl).get(Tl.from(e).format());return r||null},RE=function(e,t,i){if(Cn(e)){const s=e.toLowerCase();for(const o of V(this,vl).values())if(s===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const s=[];for(const[o,a]of V(this,vl))o.split("(")[0]===e&&s.push(a);if(t){for(let o=s.length-1;o>=0;o--)s[o].inputs.length<t.length&&s.splice(o,1);for(let o=s.length-1;o>=0;o--){const a=s[o].inputs;for(let l=0;l<t.length;l++)if(Hr.isTyped(t[l])&&t[l].type!==a[l].baseType){s.splice(o,1);break}}}if(s.length===0)return null;if(s.length>1&&i){const o=s.map(a=>JSON.stringify(a.format())).join(", ");ie(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return s[0]}const r=V(this,vl).get(Ml.from(e).format());return r||null};let VI=sd;const IW=BigInt(0);function Eg(n){return n??null}function ui(n){return n==null?null:n.toString()}class R8{constructor(e,t,i){ce(this,"gasPrice");ce(this,"maxFeePerGas");ce(this,"maxPriorityFeePerGas");vt(this,{gasPrice:Eg(e),maxFeePerGas:Eg(t),maxPriorityFeePerGas:Eg(i)})}toJSON(){const{gasPrice:e,maxFeePerGas:t,maxPriorityFeePerGas:i}=this;return{_type:"FeeData",gasPrice:ui(e),maxFeePerGas:ui(t),maxPriorityFeePerGas:ui(i)}}}function FS(n){const e={};n.to&&(e.to=n.to),n.from&&(e.from=n.from),n.data&&(e.data=Ye(n.data));const t="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const r of t)!(r in n)||n[r]==null||(e[r]=ot(n[r],`request.${r}`));const i="type,nonce".split(/,/);for(const r of i)!(r in n)||n[r]==null||(e[r]=jt(n[r],`request.${r}`));return n.accessList&&(e.accessList=_p(n.accessList)),n.authorizationList&&(e.authorizationList=n.authorizationList.slice()),"blockTag"in n&&(e.blockTag=n.blockTag),"enableCcipRead"in n&&
165(e.enableCcipRead=!!n.enableCcipRead),"customData"in n&&(e.customData=n.customData),"blobVersionedHashes"in n&&n.blobVersionedHashes&&(e.blobVersionedHashes=n.blobVersionedHashes.slice()),"kzg"in n&&(e.kzg=n.kzg),"blobs"in n&&n.blobs&&(e.blobs=n.blobs.map(r=>_O(r)?Ye(r):Object.assign({},r))),e}var Ac,f9;let _he=(f9=class{constructor(e,t){ce(this,"provider");ce(this,"number");ce(this,"hash");ce(this,"timestamp");ce(this,"parentHash");ce(this,"parentBeaconBlockRoot");ce(this,"nonce");ce(this,"difficulty");ce(this,"gasLimit");ce(this,"gasUsed");ce(this,"stateRoot");ce(this,"receiptsRoot");ce(this,"blobGasUsed");ce(this,"excessBlobGas");ce(this,"miner");ce(this,"prevRandao");ce(this,"extraData");ce(this,"baseFeePerGas");ge(this,Ac);ee(this,Ac,e.transactions.map(i=>typeof i!="string"?new Vw(i,t):i)),vt(this,{provider:t,hash:Eg(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:Eg(e.prevRandao),extraData:e.extraData,baseFeePerGas:Eg(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return V(this,Ac).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=V(this,Ac).slice();return e.length===0?[]:(Ie(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:t,extraData:i,gasLimit:r,gasUsed:s,hash:o,miner:a,prevRandao:l,nonce:c,number:u,parentHash:h,parentBeaconBlockRoot:f,stateRoot:m,receiptsRoot:g,timestamp:v,transactions:w}=this;return{_type:"Block",baseFeePerGas:ui(e),difficulty:ui(t),extraData:i,gasLimit:ui(r),gasUsed:ui(s),blobGasUsed:ui(this.blobGasUsed),excessBlobGas:ui(this.excessBlobGas),hash:o,miner:a,prevRandao:l,nonce:c,number:u,parentHash:h,timestamp:v,parentBeaconBlockRoot:f,stateRoot:m,receiptsRoot:g,transactions:w}}[Symbol.iterator](){let e=0;const t=this.transactions;return{next:()=>e<this.length?{value:t[e++],done:!1}:{value:void 0,done:!0}}}get length(){return V(this,Ac).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let t;if(typeof e=="number")t=V(this,Ac)[e];else{const i=e.toLowerCase();for(const r of V(this,Ac))if(typeof r=="string"){if(r!==i)continue;t=r;break}else{if(r.hash!==i)continue;t=r;break}}if(t==null)throw new Error("no such tx");return typeof t=="string"?await this.provider.getTransaction(t):t}getPrefetchedTransaction(e){const t=this.prefetchedTransactions;if(typeof e=="number")return t[e];e=e.toLowerCase();for(const i of t)if(i.hash===e)return i;ie(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return Ehe(this)}},Ac=new WeakMap,f9);class $1{constructor(e,t){ce(this,"provider");ce(this,"transactionHash");ce(this,"blockHash");ce(this,"blockNumber");ce(this,"removed");ce(this,"address");ce(this,"data");ce(this,"topics");ce(this,"index");ce(this,"transactionIndex");this.provider=t;const i=Object.freeze(e.topics.slice());vt(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:i,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:t,blockNumber:i,data:r,index:s,removed:o,topics:a,transactionHash:l,transactionIndex:c}=this;return{_type:"log",address:e,blockHash:t,blockNumber:i,data:r,index:s,removed:o,topics:a,transactionHash:l,transactionIndex:c}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return Ie(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return Ie(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return Ie(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return She(this)}}var A1;class RW{constructor(e,t){ce(this,"provider");ce(this,"to");ce(this,"from");ce(this,"contractAddress");ce(this,"hash");ce(this,"index");ce(this,"blockHash");ce(this,"blockNumber");ce(this,"logsBloom");ce(this,"gasUsed");ce(this,"blobGasUsed");ce(this,"cumulativeGasUsed");ce(this,"gasPrice");ce(this,"blobGasPrice");ce(this,"type");ce(this,"status");ce(this,"root");ge(this,A1);ee(this,A1,Object.freeze(e.logs.map(r=>new $1(r,t))));let i=IW;e.effectiveGasPrice!=null?i=e.effectiveGasPrice:e.gasPrice!=null&&(i=e.gasPrice),vt(this,{provider:t,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:i,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return V(this,A1)}toJSON(){const{to:e,from:t,contractAddress:i,hash:r,index:s,blockHash:o,blockNumber:a,logsBloom:l,logs:c,status:u,root:h}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:i,cumulativeGasUsed:ui(this.cumulativeGasUsed),from:t,gasPrice:ui(this.gasPrice),blobGasUsed:ui(this.blobGasUsed),blobGasPrice:ui(this.blobGasPrice),gasUsed:ui(this.gasUsed),hash:r,index:s,logs:c,logs
165Bloom:l,root:h,status:u,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return DW(this)}reorderedEvent(e){return Ie(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),NW(this,e)}}A1=new WeakMap;var ph;const TU=class TU{constructor(e,t){ce(this,"provider");ce(this,"blockNumber");ce(this,"blockHash");ce(this,"index");ce(this,"hash");ce(this,"type");ce(this,"to");ce(this,"from");ce(this,"nonce");ce(this,"gasLimit");ce(this,"gasPrice");ce(this,"maxPriorityFeePerGas");ce(this,"maxFeePerGas");ce(this,"maxFeePerBlobGas");ce(this,"data");ce(this,"value");ce(this,"chainId");ce(this,"signature");ce(this,"accessList");ce(this,"blobVersionedHashes");ce(this,"authorizationList");ge(this,ph);this.provider=t,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,this.authorizationList=e.authorizationList!=null?e.authorizationList:null,ee(this,ph,-1)}toJSON(){const{blockNumber:e,blockHash:t,index:i,hash:r,type:s,to:o,from:a,nonce:l,data:c,signature:u,accessList:h,blobVersionedHashes:f}=this;return{_type:"TransactionResponse",accessList:h,blockNumber:e,blockHash:t,blobVersionedHashes:f,chainId:ui(this.chainId),data:c,from:a,gasLimit:ui(this.gasLimit),gasPrice:ui(this.gasPrice),hash:r,maxFeePerGas:ui(this.maxFeePerGas),maxPriorityFeePerGas:ui(this.maxPriorityFeePerGas),maxFeePerBlobGas:ui(this.maxFeePerBlobGas),nonce:l,signature:u,to:o,index:i,type:s,value:ui(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const i=await this.getTransaction();i&&(e=i.blockNumber)}if(e==null)return null;const t=this.provider.getBlock(e);if(t==null)throw new Error("TODO");return t}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:t,blockNumber:i}=await Jr({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return t==null||t.blockNumber==null?0:i-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,t){const i=e??1,r=t??0;let s=V(this,ph),o=-1,a=s===-1;const l=async()=>{if(a)return null;const{blockNumber:f,nonce:m}=await Jr({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(m<this.nonce){s=f;return}if(a)return null;const g=await this.getTransaction();if(!(g&&g.blockNumber!=null))for(o===-1&&(o=s-3,o<V(this,ph)&&(o=V(this,ph)));o<=f;){if(a)return null;const v=await this.provider.getBlock(o,!0);if(v==null)return;for(const w of v)if(w===this.hash)return;for(let w=0;w<v.length;w++){const y=await v.getTransaction(w);if(y.from===this.from&&y.nonce===this.nonce){if(a)return null;const _=await this.provider.getTransactionReceipt(y.hash);if(_==null||f-_.blockNumber+1<i)return;let x="replaced";y.data===this.data&&y.to===this.to&&y.value===this.value?x="repriced":y.data==="0x"&&y.from===y.to&&y.value===IW&&(x="cancelled"),Ie(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:x==="replaced"||x==="cancelled",reason:x,replacement:y.replaceableTransaction(s),hash:y.hash,receipt:_})}}o++}},c=f=>{if(f==null||f.status!==0)return f;Ie(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:f.to,from:f.from,data:""},receipt:f})},u=await this.provider.getTransactionReceipt(this.hash);if(i===0)return c(u);if(u){if(i===1||await u.confirmations()>=i)return c(u)}else if(await l(),i===0)return null;return await new Promise((f,m)=>{const g=[],v=()=>{g.forEach(y=>y())};if(g.push(()=>{a=!0}),r>0){const y=setTimeout(()=>{v(),m(kn("wait for transaction timeout","TIMEOUT"))},r);g.push(()=>{clearTimeout(y)})}const w=async y=>{if(await y.confirmations()>=i){v();try{f(c(y))}catch(_){m(_)}}};if(g.push(()=>{this.provider.off(this.hash,w)}),this.provider.on(this.hash,w),s>=0){const y=async()=>{try{await l()}catch(_){if(hr(_,"TRANSACTION_REPLACED")){v(),m(_);return}}a||this.provider.once("block",y)};g.push(()=>{this.provider.off("block",y)}),this.provider.once("block",y)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return Ie(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),DW(this)}reorderedEvent(e){return Ie(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),Ie(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),NW(this,e)}replaceableTransaction(e){ie(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new TU(this,this.provider);return ee(t,ph,e),t}};ph=new WeakMap;let Vw=TU;function Ehe(n){return{orphan:"drop-block",hash:n.hash,number:n.number}}function NW(n,e){return{orphan:"reorder-transaction",tx:n,other:e}}function DW(n){return{orphan:"drop-transaction",tx:n}}function She(n){return{orphan:"drop-log",log:{transactionHash:n.transactionHash,blockHash:n.blockHash,blockNumber:n.blockNumber,address:n.address,data:n.data,topics:Object.freeze(n.topics.slice()),index:n.index}}}class LO extends $1{constructor(t,i,r){super(t,t.provider);ce(this,"interface");ce(this,"fragment");ce(this,"args");const s=i.decodeEventLog(r,t.data,t.topics);vt(this,{args:s,fragment:r,interface:i})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class OW extends $1{constructor(t,i){super(t,t.provider);ce(this,"error");vt(this,{error:i})}}var i0;class Ahe extends RW{constructor(t,i,r){super(r,i);ge(this,i0);ee(this,i0,t)}get logs(){return super.logs.map(t=>{const i=t.topics.length?V(this,i0).getEvent(t.topics[0]):null;if(i)try{return new LO(t,V(this,i0),i)}catch(r){return new OW(t,r)}return t})}}i0=new WeakMap;var M1;class UO extends Vw{constructor(t,i,r){super(r,i);ge(this,M1);ee(this,M1,t)}async wait(t,i){const r=await super.wait(t,i);return r==null?null:new Ahe(V(this,M1),this.provider,r)}}
165M1=new WeakMap;class LW extends oj{constructor(t,i,r,s){super(t,i,r);ce(this,"log");vt(this,{log:s})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class Mhe extends LW{constructor(e,t,i,r,s){super(e,t,i,new LO(s,e.interface,r));const o=e.interface.decodeEventLog(r,this.log.data,this.log.topics);vt(this,{args:o,fragment:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const N8=BigInt(0);function UW(n){return n&&typeof n.call=="function"}function BW(n){return n&&typeof n.estimateGas=="function"}function s2(n){return n&&typeof n.resolveName=="function"}function kW(n){return n&&typeof n.sendTransaction=="function"}function FW(n){if(n!=null){if(s2(n))return n;if(n.provider)return n.provider}}var T1;class The{constructor(e,t,i){ge(this,T1);ce(this,"fragment");if(vt(this,{fragment:t}),t.inputs.length<i.length)throw new Error("too many arguments");const r=lp(e.runner,"resolveName"),s=s2(r)?r:null;ee(this,T1,async function(){const o=await Promise.all(t.inputs.map((a,l)=>i[l]==null?null:a.walkAsync(i[l],(u,h)=>u==="address"?Array.isArray(h)?Promise.all(h.map(f=>is(f,s))):is(h,s):h)));return e.interface.encodeFilterTopics(t,o)}())}getTopicFilter(){return V(this,T1)}}T1=new WeakMap;function lp(n,e){return n==null?null:typeof n[e]=="function"?n:n.provider&&typeof n.provider[e]=="function"?n.provider:null}function dd(n){return n==null?null:n.provider||null}async function zW(n,e){const t=Hr.dereference(n,"overrides");ie(typeof t=="object","invalid overrides parameter","overrides",n);const i=FS(t);return ie(i.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",i.to),ie(i.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",i.data),i.from&&(i.from=i.from),i}async function Phe(n,e,t){const i=lp(n,"resolveName"),r=s2(i)?i:null;return await Promise.all(e.map((s,o)=>s.walkAsync(t[o],(a,l)=>(l=Hr.dereference(l,a),a==="address"?is(l,r):l))))}function Che(n){const e=async function(o){const a=await zW(o,["data"]);a.to=await n.getAddress(),a.from&&(a.from=await is(a.from,FW(n.runner)));const l=n.interface,c=ot(a.value||N8,"overrides.value")===N8,u=(a.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!u&&!c&&ie(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),ie(l.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data);const h=l.receive||l.fallback&&l.fallback.payable;return ie(h||c,"cannot send value to non-payable fallback","overrides.value",a.value),ie(l.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data),a},t=async function(o){const a=lp(n.runner,"call");Ie(UW(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(o);try{return await a.call(l)}catch(c){throw bO(c)&&c.data?n.interface.makeError(c.data,l):c}},i=async function(o){const a=n.runner;Ie(kW(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await a.sendTransaction(await e(o)),c=dd(n.runner);return new UO(n.interface,c,l)},r=async function(o){const a=lp(n.runner,"estimateGas");return Ie(BW(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},s=async o=>await i(o);return vt(s,{_contract:n,estimateGas:r,populateTransaction:e,send:i,staticCall:t}),s}function Ihe(n,e){const t=function(...c){const u=n.interface.getFunction(e,c);return Ie(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:c}}),u},i=async function(...c){const u=t(...c);let h={};if(u.inputs.length+1===c.length&&(h=await zW(c.pop()),h.from&&(h.from=await is(h.from,FW(n.runner)))),u.inputs.length!==c.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const f=await Phe(n.runner,u.inputs,c);return Object.assign({},h,await Jr({to:n.getAddress(),data:n.interface.encodeFunctionData(u,f)}))},r=async function(...c){const u=await a(...c);return u.length===1?u[0]:u},s=async function(...c){const u=n.runner;Ie(kW(u),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const h=await u.sendTransaction(await i(...c)),f=dd(n.runner);return new UO(n.interface,f,h)},o=async function(...c){const u=lp(n.runner,"estimateGas");return Ie(BW(u),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await u.estimateGas(await i(...c))},a=async function(...c){const u=lp(n.runner,"call");Ie(UW(u),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const h=await i(...c);let f="0x";try{f=await u.call(h)}catch(g){throw bO(g)&&g.data?n.interface.makeError(g.data,h):g}const m=t(...c);return n.interface.decodeFunctionResult(m,f)},l=async(...c)=>t(...c).constant?await r(...c):await s(...c);return vt(l,{name:n.interface.getFunctionName(e),_contract:n,_key:e,getFragment:t,estimateGas:o,populateTransaction:i,send:s,staticCall:r,staticCallResult:a}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const c=n.interface.getFunction(e);return Ie(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),c}}),l}function Rhe(n,e){const t=function(...r){const s=n.interface.getEvent(e,r);return Ie(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:r}}),s},i=function(...r){return new The(n,t(...r),r)};return vt(i,{name:n.interface.getEventName(e),_contract:n,_key:e,getFragment:t}
165),Object.defineProperty(i,"fragment",{configurable:!1,enumerable:!0,get:()=>{const r=n.interface.getEvent(e);return Ie(r,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),r}}),i}const zS=Symbol.for("_ethersInternal_contract"),VW=new WeakMap;function Nhe(n,e){VW.set(n[zS],e)}function to(n){return VW.get(n[zS])}function Dhe(n){return n&&typeof n=="object"&&"getTopicFilter"in n&&typeof n.getTopicFilter=="function"&&n.fragment}async function BO(n,e){let t,i=null;if(Array.isArray(e)){const s=function(o){if(Cn(o,32))return o;const a=n.interface.getEvent(o);return ie(a,"unknown fragment","name",o),a.topicHash};t=e.map(o=>o==null?null:Array.isArray(o)?o.map(s):s(o))}else e==="*"?t=[null]:typeof e=="string"?Cn(e,32)?t=[e]:(i=n.interface.getEvent(e),ie(i,"unknown fragment","event",e),t=[i.topicHash]):Dhe(e)?t=await e.getTopicFilter():"fragment"in e?(i=e.fragment,t=[i.topicHash]):ie(!1,"unknown event name","event",e);t=t.map(s=>{if(s==null)return null;if(Array.isArray(s)){const o=Array.from(new Set(s.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return s.toLowerCase()});const r=t.map(s=>s==null?"null":Array.isArray(s)?s.join("|"):s).join("&");return{fragment:i,tag:r,topics:t}}async function Cv(n,e){const{subs:t}=to(n);return t.get((await BO(n,e)).tag)||null}async function D8(n,e,t){const i=dd(n.runner);Ie(i,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:r,tag:s,topics:o}=await BO(n,t),{addr:a,subs:l}=to(n);let c=l.get(s);if(!c){const h={address:a||n,topics:o},f=w=>{let y=r;if(y==null)try{y=n.interface.getEvent(w.topics[0])}catch{}if(y){const _=y,x=r?n.interface.decodeEventLog(r,w.data,w.topics):[];$I(n,t,x,S=>new Mhe(n,S,t,_,w))}else $I(n,t,[],_=>new LW(n,_,t,w))};let m=[];c={tag:s,listeners:[],start:()=>{m.length||m.push(i.on(h,f))},stop:async()=>{if(m.length==0)return;let w=m;m=[],await Promise.all(w),i.off(h,f)}},l.set(s,c)}return c}let HI=Promise.resolve();async function Ohe(n,e,t,i){await HI;const r=await Cv(n,e);if(!r)return!1;const s=r.listeners.length;return r.listeners=r.listeners.filter(({listener:o,once:a})=>{const l=Array.from(t);i&&l.push(i(a?null:o));try{o.call(n,...l)}catch{}return!a}),r.listeners.length===0&&(r.stop(),to(n).subs.delete(r.tag)),s>0}async function $I(n,e,t,i){try{await HI}catch{}const r=Ohe(n,e,t,i);return HI=r,await r}const Vb=["then"];var d9;d9=zS;const cw=class cw{constructor(e,t,i,r){ce(this,"target");ce(this,"interface");ce(this,"runner");ce(this,"filters");ce(this,d9);ce(this,"fallback");ie(typeof e=="string"||Wj(e),"invalid value for Contract target","target",e),i==null&&(i=null);const s=VI.from(t);vt(this,{target:e,runner:i,interface:s}),Object.defineProperty(this,zS,{value:{}});let o,a=null,l=null;if(r){const h=dd(i);l=new UO(this.interface,h,r)}let c=new Map;if(typeof e=="string")if(Cn(e))a=e,o=Promise.resolve(e);else{const h=lp(i,"resolveName");if(!s2(h))throw kn("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=h.resolveName(e).then(f=>{if(f==null)throw kn("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return to(this).addr=f,f})}else o=e.getAddress().then(h=>{if(h==null)throw new Error("TODO");return to(this).addr=h,h});Nhe(this,{addrPromise:o,addr:a,deployTx:l,subs:c});const u=new Proxy({},{get:(h,f,m)=>{if(typeof f=="symbol"||Vb.indexOf(f)>=0)return Reflect.get(h,f,m);try{return this.getEvent(f)}catch(g){if(!hr(g,"INVALID_ARGUMENT")||g.argument!=="key")throw g}},has:(h,f)=>Vb.indexOf(f)>=0?Reflect.has(h,f):Reflect.has(h,f)||this.interface.hasEvent(String(f))});return vt(this,{filters:u}),vt(this,{fallback:s.receive||s.fallback?Che(this):null}),new Proxy(this,{get:(h,f,m)=>{if(typeof f=="symbol"||f in h||Vb.indexOf(f)>=0)return Reflect.get(h,f,m);try{return h.getFunction(f)}catch(g){if(!hr(g,"INVALID_ARGUMENT")||g.argument!=="key")throw g}},has:(h,f)=>typeof f=="symbol"||f in h||Vb.indexOf(f)>=0?Reflect.has(h,f):h.interface.hasFunction(f)})}connect(e){return new cw(this.target,this.interface,e)}attach(e){return new cw(e,this.interface,this.runner)}async getAddress(){return await to(this).addrPromise}async getDeployedCode(){const e=dd(this.runner);Ie(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await e.getCode(await this.getAddress());return t==="0x"?null:t}async waitForDeployment(){const e=this.deploymentTransaction();
165if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const i=dd(this.runner);return Ie(i!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((r,s)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return r(this);i.once("block",o)}catch(a){s(a)}};o()})}deploymentTransaction(){return to(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),Ihe(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),Rhe(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,t,i){t==null&&(t=0),i==null&&(i="latest");const{addr:r,addrPromise:s}=to(this),o=r||await s,{fragment:a,topics:l}=await BO(this,e),c={address:o,topics:l,fromBlock:t,toBlock:i},u=dd(this.runner);return Ie(u,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await u.getLogs(c)).map(h=>{let f=a;if(f==null)try{f=this.interface.getEvent(h.topics[0])}catch{}if(f)try{return new LO(h,this.interface,f)}catch(m){return new OW(h,m)}return new $1(h,u)})}async on(e,t){const i=await D8(this,"on",e);return i.listeners.push({listener:t,once:!1}),i.start(),this}async once(e,t){const i=await D8(this,"once",e);return i.listeners.push({listener:t,once:!0}),i.start(),this}async emit(e,...t){return await $I(this,e,t,null)}async listenerCount(e){if(e){const r=await Cv(this,e);return r?r.listeners.length:0}const{subs:t}=to(this);let i=0;for(const{listeners:r}of t.values())i+=r.length;return i}async listeners(e){if(e){const r=await Cv(this,e);return r?r.listeners.map(({listener:s})=>s):[]}const{subs:t}=to(this);let i=[];for(const{listeners:r}of t.values())i=i.concat(r.map(({listener:s})=>s));return i}async off(e,t){const i=await Cv(this,e);if(!i)return this;if(t){const r=i.listeners.map(({listener:s})=>s).indexOf(t);r>=0&&i.listeners.splice(r,1)}return(t==null||i.listeners.length===0)&&(i.stop(),to(this).subs.delete(i.tag)),this}async removeAllListeners(e){if(e){const t=await Cv(this,e);if(!t)return this;t.stop(),to(this).subs.delete(t.tag)}else{const{subs:t}=to(this);for(const{tag:i,stop:r}of t.values())r(),t.delete(i)}return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return await this.off(e,t)}static buildClass(e){class t extends cw{constructor(r,s=null){super(r,e,s)}}return t}static from(e,t,i){return i==null&&(i=null),new this(e,t,i)}};let GI=cw;function Lhe(){return GI}class Qv extends Lhe(){}function dP(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):ie(!1,"unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}class Uhe{constructor(e){ce(this,"name");vt(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,t){throw new Error("unsupported coin")}async decodeAddress(e,t){throw new Error("unsupported coin")}}const HW=new RegExp("^(ipfs)://(.*)$","i"),O8=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),HW,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];var mh,Ud,gh,Dm,_A,$W;const dg=class dg{constructor(e,t,i){ge(this,gh);ce(this,"provider");ce(this,"address");ce(this,"name");ge(this,mh);ge(this,Ud);vt(this,{provider:e,address:t,name:i}),ee(this,mh,null),ee(this,Ud,new Qv(t,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return V(this,mh)==null&&ee(this,mh,(async()=>{try{return await V(this,Ud).supportsInterface("0x9061b923")}catch(e){if(hr(e,"CALL_EXCEPTION"))return!1;throw ee(this,mh,null),e}})()),await V(this,mh)}async getAddress(e){if(e==null&&(e=60),e===60)try{const s=await Ge(this,gh,Dm).call(this,"addr(bytes32)");return s==null||s===Dw?null:s}catch(s){if(hr(s,"CALL_EXCEPTION"))return null;throw s}if(e>=0&&e<2147483648){let s=e+2147483648;const o=await Ge(this,gh,Dm).call(this,"addr(bytes32,uint)",[s]);if(Cn(o,20))return hn(o)}let t=null;for(const s of this.provider.plugins)if(s instanceof Uhe&&s.supportsCoinType(e)){t=s;break}if(t==null)return null;const i=await Ge(this,gh,Dm).call(this,"addr(bytes32,uint)",[e]);if(i==null||i==="0x")return null;const r=await t.decodeAddress(e,i);if(r!=null)return r;Ie(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:i}})}async getText(e){const t=await Ge(this,gh,Dm).call(this,"text(bytes32,string)",[e]);return t==null||t==="0x"?null:t}async getContentHash(){const e=await Ge(this,gh,Dm).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const t=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const r=t[1]==="e3010170"?"ipfs":"ipns",s=parseInt(t[4],16);if(t[5].length===s*2)return`${r}://${$ae("0x"+t[2])}`}const i=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(i&&i[1].length===64)return`bzz://${i[1]}`;Ie(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const t=await this.getText("avatar");if(t==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:t});for(let i=0;i<O8.length;i++){const r=t.match(O8[i]);if(r==null)continue;const s=r[1].toLowerCase();switch(s){case"https":case"data":return e.push({type:"url",value:t}),{linkage:e,url:t};case"ipfs":{const o=dP(t);return e.push({type:"ipfs",value:t}),e.push({type:"url",value:o}),{linkage:e,url:o}}case"erc721":case"erc1155":{const o=s==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:s,value:t});const a=await this.getAddress();if(a==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const l=(r[2]||"").split("/");if(l.length!==2)return e.push({type:`!${s}caip`,value:r[2]||""}),{url:null,linkage:e};const c=l[1],u=new Qv(l[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(s==="erc721"){const v=await u.ownerOf(c);if(a!==v)return e.push({type:"!owner",value:v}),{url:null,linkage:e};e.push({type:"owner",value:v})}else if(s==="erc1155"){const v=await u.balanceOf(a,c);
165if(!v)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:v.toString()})}let h=await u[o](c);if(h==null||h==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:h}),s==="erc1155"&&(h=h.replace("{id}",jh(c,32).substring(2)),e.push({type:"metadata-url-expanded",value:h})),h.match(/^ipfs:/i)&&(h=dP(h)),e.push({type:"metadata-url",value:h});let f={};const m=await new Wh(h).send();m.assertOk();try{f=m.bodyJson}catch{try{e.push({type:"!metadata",value:m.bodyText})}catch{const y=m.body;return y&&e.push({type:"!metadata",value:Ye(y)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!f)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(f)});let g=f.image;if(typeof g!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!g.match(/^(https:\/\/|data:)/i)){if(g.match(HW)==null)return e.push({type:"!imageUrl-ipfs",value:g}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:g}),g=dP(g)}return e.push({type:"url",value:g}),{linkage:e,url:g}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const t=await e.getNetwork(),i=t.getPlugin("org.ethers.plugins.network.Ens");return Ie(i,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:t}}),i.address}static async fromName(e,t){var r;let i=t;for(;;){if(i===""||i==="."||t!=="eth"&&i==="eth")return null;const s=await Ge(r=dg,_A,$W).call(r,e,i);if(s!=null){const o=new dg(e,s,t);return i!==t&&!await o.supportsWildcard()?null:o}i=i.split(".").slice(1).join(".")}}};mh=new WeakMap,Ud=new WeakMap,gh=new WeakSet,Dm=async function(e,t){t=(t||[]).slice();const i=V(this,Ud).interface;t.unshift(FI(this.name));let r=null;await this.supportsWildcard()&&(r=i.getFunction(e),Ie(r,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),t=[Que(this.name,255),i.encodeFunctionData(r,t)],e="resolve(bytes,bytes)"),t.push({enableCcipRead:!0});try{const s=await V(this,Ud)[e](...t);return r?i.decodeFunctionResult(r,s)[0]:s}
165catch(s){if(!hr(s,"CALL_EXCEPTION"))throw s}return null},_A=new WeakSet,$W=async function(e,t){const i=await dg.getEnsAddress(e);try{const s=await new Qv(i,["function resolver(bytes32) view returns (address)"],e).resolver(FI(t),{enableCcipRead:!0});return s===Dw?null:s}catch(r){throw r}return null},ge(dg,_A);let VS=dg;const L8=BigInt(0);function Yt(n,e){return function(t){return t==null?e:n(t)}}function Hw(n,e){return t=>{if(e&&t==null)return null;if(!Array.isArray(t))throw new Error("not an array");return t.map(i=>n(i))}}function G1(n,e){return t=>{const i={};for(const r in n){let s=r;if(e&&r in e&&!(s in t)){for(const o of e[r])if(o in t){s=o;break}}try{const o=n[r](t[s]);o!==void 0&&(i[r]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";Ie(!1,`invalid value for value.${r} (${a})`,"BAD_DATA",{value:t})}}return i}}function Bhe(n){switch(n){case!0:case"true":return!0;case!1:case"false":return!1}ie(!1,`invalid boolean; ${JSON.stringify(n)}`,"value",n)}function L0(n){return ie(Cn(n,!0),"invalid data","value",n),n}function ur(n){return ie(Cn(n,32),"invalid hash","value",n),n}const khe=G1({address:hn,blockHash:ur,blockNumber:jt,data:L0,index:jt,removed:Yt(Bhe,!1),topics:Hw(ur),transactionHash:ur,transactionIndex:jt},{index:["logIndex"]});function Fhe(n){return khe(n)}const zhe=G1({hash:Yt(ur),parentHash:ur,parentBeaconBlockRoot:Yt(ur,null),number:jt,timestamp:jt,nonce:Yt(L0),difficulty:ot,gasLimit:ot,gasUsed:ot,stateRoot:Yt(ur,null),receiptsRoot:Yt(ur,null),blobGasUsed:Yt(ot,null),excessBlobGas:Yt(ot,null),miner:Yt(hn),prevRandao:Yt(ur,null),extraData:L0,baseFeePerGas:Yt(ot)},{prevRandao:["mixHash"]});function Vhe(n){const e=zhe(n);return e.transactions=n.transactions.map(t=>typeof t=="string"?t:GW(t)),e}const Hhe=G1({transactionIndex:jt,blockNumber:jt,transactionHash:ur,address:hn,topics:Hw(ur),data:L0,index:jt,blockHash:ur},{index:["logIndex"]});function $he(n){return Hhe(n)}const Ghe=G1({to:Yt(hn,null),from:Yt(hn,null),contractAddress:Yt(hn,null),index:jt,root:Yt(Ye),gasUsed:ot,blobGasUsed:Yt(ot,null),logsBloom:Yt(L0),blockHash:ur,hash:ur,logs:Hw($he),blockNumber:jt,cumulativeGasUsed:ot,effectiveGasPrice:Yt(ot),blobGasPrice:Yt(ot,null),status:Yt(jt),type:Yt(jt,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function jhe(n){return Ghe(n)}function GW(n){n.to&&ot(n.to)===L8&&(n.to="0x0000000000000000000000000000000000000000");const e=G1({hash:ur,index:Yt(jt,void 0),type:t=>t==="0x"||t==null?0:jt(t),accessList:Yt(_p,null),blobVersionedHashes:Yt(Hw(ur,!0),null),authorizationList:Yt(Hw(t=>{let i;if(t.signature)i=t.signature;else{let r=t.yParity;r==="0x1b"?r=0:r==="0x1c"&&(r=1),i=Object.assign({},t,{yParity:r})}return{address:hn(t.address),chainId:ot(t.chainId),nonce:ot(t.nonce),signature:Us.from(i)}},!1),null),blockHash:Yt(ur,null),blockNumber:Yt(jt,null),transactionIndex:Yt(jt,null),from:hn,gasPrice:Yt(ot),maxPriorityFeePerGas:Yt(ot),maxFeePerGas:Yt(ot),maxFeePerBlobGas:Yt(ot,null),gasLimit:ot,to:Yt(hn,null),value:ot,nonce:jt,data:L0,creates:Yt(hn,null),chainId:Yt(ot,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(n);if(e.to==null&&e.creates==null&&(e.creates=Dce(e)),(n.type===1||n.type===2)&&n.accessList==null&&(e.accessList=[]),n.signature?e.signature=Us.from(n.signature):e.signature=Us.from(n),e.chainId==null){const t=e.signature.legacyChainId;t!=null&&(e.chainId=t)}return e.blockHash&&ot(e.blockHash)===L8&&(e.blockHash=null),e}const Whe="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class j1{constructor(e){ce(this,"name");vt(this,{name:e})}clone(){return new j1(this.name)}}class o2 extends j1{constructor(t,i){t==null&&(t=0);super(`org.ethers.network.plugins.GasCost#${t||0}`);ce(this,"effectiveBlock");ce(this,"txBase");ce(this,"txCreate");ce(this,"txDataZero");ce(this,"txDataNonzero");ce(this,"txAccessListStorageKey");ce(this,"txAccessListAddress");const r={effectiveBlock:t};function s(o,a){let l=(i||{})[o];l==null&&(l=a),ie(typeof l=="number",`invalud value for ${o}`,"costs",i),r[o]=l}s("txBase",21e3),s("txCreate",32e3),s("txDataZero",4),s("txDataNonzero",16),s("txAccessListStorageKey",1900),s("txAccessListAddress",2400),vt(this,r)}clone(){return new o2(this.effectiveBlock,this)}}class a2 extends j1{constructor(t,i){super("org.ethers.plugins.network.Ens");ce(this,"address");ce(this,"targetNetwork");vt(this,{address:t||Whe,targetNetwork:i??1})}clone(){return new a2(this.address,this.targetNetwork)}}var P1,C1;class qhe extends j1{constructor(t,i){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");ge(this,P1);ge(this,C1);ee(this,P1,t),ee(this,C1,i)}get url(){return V(this,P1)}get processFunc(){return V(this,C1)}clone(){return this}}P1=new WeakMap,C1=new WeakMap;const pP=new Map;var r0,s0,yh;const pg=class pg{constructor(e,t){ge(this,r0);ge(this,s0);ge(this,yh);ee(this,r0,e),ee(this,s0,ot(t)),ee(this,yh,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return V(this,r0)}set name(e){ee(this,r0,e)}get chainId(){return V(this,s0)}set chainId(e){ee(this,s0,ot(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===ot(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===ot(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===ot(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(V(this,yh).values())}attachPlugin(e){if(V(this,yh).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return V(this,yh).set(e.name,e.clone()),this}getPlugin(e){return V(this,yh).get(e)||null}getPlugins(e){return this.plugins.filter(t=>t.name.split("#")[0]===e)}clone(){const e=new pg(this.name,this.chainId);return this.plugins.forEach(t=>{e.attachPlugin(t.clone())}),e}computeIntrinsicGas(e){const t=this.getPlugin("org.ethers.plugins.network.GasCost")||new o2;let i=t.txBase;if(e.to==null&&(i+=t.txCreate),e.data)for(let r=2;r<e.data.length;r+=2)e.data.substring(r,r+2)==="00"?i+=t.txDataZero:i+=t.txDataNonzero;if(e.accessList){const r=_p(e.accessList);for(const s in r)i+=t.txAccessListAddress+t.txAccessListStorageKey*r[s].storageKeys.length}return i}static from(e){if(Khe(),e==null)return pg.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const t=pP.get(e);if(t)return t();if(typeof e=="bigint")return new pg("unknown",e);ie(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){ie(typeof e.name=="string"&&typeof e.chainId=="number","invali
165d network object name or chainId","network",e);const t=new pg(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&t.attachPlugin(new a2(e.ensAddress,e.ensNetwork)),t}ie(!1,"invalid network","network",e)}static register(e,t){typeof e=="number"&&(e=BigInt(e));const i=pP.get(e);i&&ie(!1,`conflicting network for ${JSON.stringify(i.name)}`,"nameOrChainId",e),pP.set(e,t)}};r0=new WeakMap,s0=new WeakMap,yh=new WeakMap;let Pl=pg;function U8(n,e){const t=String(n);if(!t.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${n}`);const i=t.split(".");if(i.length===1&&i.push(""),i.length!==2)throw new Error(`invalid gwei value: ${n}`);for(;i[1].length<e;)i[1]+="0";if(i[1].length>9){let r=BigInt(i[1].substring(0,9));i[1].substring(9).match(/^0+$/)||r++,i[1]=r.toString()}return BigInt(i[0]+i[1])}function B8(n){return new qhe(n,async(e,t,i)=>{i.setHeader("User-Agent","ethers");let r;try{const[s,o]=await Promise.all([i.send(),e()]);r=s;const a=r.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:U8(a.maxFee,9),maxPriorityFeePerGas:U8(a.maxPriorityFee,9)}}catch(s){Ie(!1,`error encountered with polygon gas station (${JSON.stringify(i.url)})`,"SERVER_ERROR",{request:i,response:r,error:s})}})}let k8=!1;function Khe(){if(k8)return;k8=!0;function n(e,t,i){const r=function(){const s=new Pl(e,t);return i.ensNetwork!=null&&s.attachPlugin(new a2(null,i.ensNetwork)),s.attachPlugin(new o2),(i.plugins||[]).forEach(o=>{s.attachPlugin(o)}),s};Pl.register(e,r),Pl.register(t,r),i.altNames&&i.altNames.forEach(s=>{Pl.register(s,r)})}n("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),n("ropsten",3,{ensNetwork:3}),n("rinkeby",4,{ensNetwork:4}),n("goerli",5,{ensNetwork:5}),n("kovan",42,{ensNetwork:42}),n("sepolia",11155111,{ensNetwork:11155111}),n("holesky",17e3,{ensNetwork:17e3}),n("classic",61,{}),n("classicKotti",6,{}),n("arbitrum",42161,{ensNetwork:1}),n("arbitrum-goerli",421613,{}),n("arbitrum-sepolia",421614,{}),n("base",8453,{ensNetwork:1}),n("base-goerli",84531,{}),n("base-sepolia",84532,{}),n("bnb",56,{ensNetwork:1}),n("bnbt",97,{}),n("linea",59144,{ensNetwork:1}),n("linea-goerli",59140,{}),n("linea-sepolia",59141,{}),n("matic",137,{ensNetwork:1,plugins:[B8("https://gasstation.polygon.technology/v2")]}),n("matic-amoy",80002,{}),n("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[B8("https://gasstation-testnet.polygon.technology/v2")]}),n("optimism",10,{ensNetwork:1,plugins:[]}),n("optimism-goerli",420,{}),n("optimism-sepolia",11155420,{}),n("xdai",100,{ensNetwork:1})}function jI(n){return JSON.parse(JSON.stringify(n))}var Mc,Wo,vh,xl,o0,NE;class Xhe{constructor(e){ge(this,o0);ge(this,Mc);ge(this,Wo);ge(this,vh);ge(this,xl);ee(this,Mc,e),ee(this,Wo,null),ee(this,vh,4e3),ee(this,xl,-2)}get pollingInterval(){return V(this,vh)}set pollingInterval(e){ee(this,vh,e)}start(){V(this,Wo)||(ee(this,Wo,V(this,Mc)._setTimeout(Ge(this,o0,NE).bind(this),V(this,vh))),Ge(this,o0,NE).call(this))}stop(){V(this,Wo)&&(V(this,Mc)._clearTimeout(V(this,Wo)),ee(this,Wo,null))}pause(e){this.stop(),e&&ee(this,xl,-2)}resume(){this.start()}}Mc=new WeakMap,Wo=new WeakMap,vh=new WeakMap,xl=new WeakMap,o0=new WeakSet,NE=async function(){try{const e=await V(this,Mc).getBlockNumber();if(V(this,xl)===-2){ee(this,xl,e);return}if(e!==V(this,xl)){for(let t=V(this,xl)+1;t<=e;t++){if(V(this,Wo)==null)return;await V(this,Mc).emit("block",t)}ee(this,xl,e)}}catch{}V(this,Wo)!=null&&ee(this,Wo,V(this,Mc)._setTimeout(Ge(this,o0,NE).bind(this),V(this,vh)))};var Bd,kd,wh;class kO{constructor(e){ge(this,Bd);ge(this,kd);ge(this,wh);ee(this,Bd,e),ee(this,wh,!1),ee(this,kd,t=>{this._poll(t,V(this,Bd))})}async _poll(e,t){throw new Error("sub-classes must override this")}start(){V(this,wh)||(ee(this,wh,!0),V(this,kd).call(this,-2),V(this,Bd).on("block",V(this,kd)))}stop(){V(this,wh)&&(ee(this,wh,!1),V(this,Bd).off("block",V(this,kd)))}pause(e){this.stop()}resume(){this.start()}}Bd=new WeakMap,kd=new WeakMap,wh=new WeakMap;var a0,Tc;class Yhe extends kO{constructor(t,i){super(t);ge(this,a0);ge(this,Tc);ee(this,a0,i),ee(this,Tc,-2)}pause(t){t&&ee(this,Tc,-2),super.pause(t)}async _poll(t,i){const r=await i.getBlock(V(this,a0));r!=null&&(V(this,Tc)===-2?ee(this,Tc,r.number):r.number>V(this,Tc)&&(i.emit(V(this,a0),r.number),ee(this,Tc,r.number)))}}a0=new WeakMap,Tc=new WeakMap;var EA;class Qhe extends kO{constructor(t,i){super(t);ge(this,EA);ee(this,EA,jI(i))}async _poll(t,i){throw new Error("@TODO")}}EA=new WeakMap;var l0;class Zhe extends kO{constructor(t,i){super(t);ge(this,l0);ee(this,l0,i)}async _poll(t,i){const r=await i.getTransactionReceipt(V(this,l0));r&&i.emit(V(this,l0),r)}}l0=new WeakMap;var Pc,c0,u0,xh,qo,SA,jW;class FO{constructor(e,t){ge(this,SA);ge(this,Pc);ge(this,c0);ge(this,u0);ge(this,xh);ge(this,qo);ee(this,Pc,e),ee(this,c0,jI(t)),ee(this,u0,Ge(this,SA,jW).bind(this)),ee(this,xh,!1),ee(this,qo,-2)}start(){V(this,xh)||(ee(this,xh,!0),V(this,qo)===-2&&V(this,Pc).getBlockNumber().then(e=>{ee(this,qo,e)}),V(this,Pc).on("block",V(this,u0)))}stop(){V(this,xh)&&(ee(this,xh,!1),V(this,Pc).off("block",V(this,u0)))}pause(e){this.stop(),e&&ee(this,qo,-2)}resume(){this.start()}}Pc=new WeakMap,c0=new WeakMap,u0=new WeakMap,xh=new WeakMap,qo=new WeakMap,SA=new WeakSet,jW=async function(e){if(V(this,qo)===-2)return;const t=jI(V(this,c0));t.fromBlock=V(this,qo)+1,t.toBlock=e;const i=await V(this,Pc).getLogs(t);if(i.length===0){V(this,qo)<e-60&&ee(this,qo,e-60);return}for(const r of i)V(this,Pc).emit(V(this,c0),r),ee(this,qo,r.blockNumber)};const Jhe=BigInt(2),efe=10;function Hb(n){return n&&typeof n.then=="function"}function DE(n,e){return n+":"+JSON.stringify(e,(t,i)=>{if(i==null)return"null";if(typeof i=="bigint")return`bigint:${i.toString()}`;if(typeof i=="string")return i.toLowerCase();if(typeof i=="object"&&!Array.isArray(i)){const r=Object.keys(i);return r.sort(),r.reduce((s,o)=>(s[o]=i[o],s),{})}return i})}class WW{constructor(e){ce(this,"name");vt(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function tfe(n){return JSON.parse(JSON.stringify(n))}function WI(n){return n=Array.from(new Set(n).values()),n.sort(),n}async function mP(n,e){if(n==null)throw new Error("invalid event");
165if(Array.isArray(n)&&(n={topics:n}),typeof n=="string")switch(n){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:n,tag:n}}if(Cn(n,32)){const t=n.toLowerCase();return{type:"transaction",tag:DE("tx",{hash:t}),hash:t}}if(n.orphan){const t=n;return{type:"orphan",tag:DE("orphan",t),filter:tfe(t)}}if(n.address||n.topics){const t=n,i={topics:(t.topics||[]).map(r=>r==null?null:Array.isArray(r)?WI(r.map(s=>s.toLowerCase())):r.toLowerCase())};if(t.address){const r=[],s=[],o=a=>{Cn(a)?r.push(a):s.push((async()=>{r.push(await is(a,e))})())};Array.isArray(t.address)?t.address.forEach(o):o(t.address),s.length&&await Promise.all(s),i.address=WI(r.map(a=>a.toLowerCase()))}return{filter:i,tag:DE("event",i),type:"event"}}ie(!1,"unknown ProviderEvent","event",n)}function gP(){return new Date().getTime()}const nfe={cacheTimeout:250,pollingInterval:4e3};var Or,bh,Lr,h0,so,Fd,_h,Cc,I1,Ko,f0,d0,$t,Js,qI,KI,Iv,XI,Rv,OE;class ife{constructor(e,t){ge(this,$t);ge(this,Or);ge(this,bh);ge(this,Lr);ge(this,h0);ge(this,so);ge(this,Fd);ge(this,_h);ge(this,Cc);ge(this,I1);ge(this,Ko);ge(this,f0);ge(this,d0);if(ee(this,d0,Object.assign({},nfe,t||{})),e==="any")ee(this,Fd,!0),ee(this,so,null);else if(e){const i=Pl.from(e);ee(this,Fd,!1),ee(this,so,Promise.resolve(i)),setTimeout(()=>
165{this.emit("network",i,null)},0)}else ee(this,Fd,!1),ee(this,so,null);ee(this,Cc,-1),ee(this,_h,new Map),ee(this,Or,new Map),ee(this,bh,new Map),ee(this,Lr,null),ee(this,h0,!1),ee(this,I1,1),ee(this,Ko,new Map),ee(this,f0,!1)}get pollingInterval(){return V(this,d0).pollingInterval}get provider(){return this}get plugins(){return Array.from(V(this,bh).values())}attachPlugin(e){if(V(this,bh).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return V(this,bh).set(e.name,e.connect(this)),this}getPlugin(e){return V(this,bh).get(e)||null}get disableCcipRead(){return V(this,f0)}set disableCcipRead(e){ee(this,f0,!!e)}async ccipReadFetch(e,t,i){if(this.disableCcipRead||i.length===0||e.to==null)return null;const r=e.to.toLowerCase(),s=t.toLowerCase(),o=[];for(let a=0;a<i.length;a++){const l=i[a],c=l.replace("{sender}",r).replace("{data}",s),u=new Wh(c);l.indexOf("{data}")===-1&&(u.body={data:s,sender:r}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:u,index:a,urls:i});let h="unknown error",f;try{f=await u.send()}catch(m){o.push(m.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:u,result:{error:m}});continue}try{const m=f.bodyJson;if(m.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:u,result:m}),m.data;m.message&&(h=m.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:u,result:m})}catch{}Ie(f.statusCode<400||f.statusCode>=500,`response not found during CCIP fetch: ${h}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:l,errorMessage:h}}),o.push(h)}Ie(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:i,errorMessages:o}})}_wrapBlock(e,t){return new _he(Vhe(e),this)}_wrapLog(e,t){return new $1(Fhe(e),this)}_wrapTransactionReceipt(e,t){return new RW(jhe(e),this)}_wrapTransactionResponse(e,t){return new Vw(GW(e),this)}_detectNetwork(){Ie(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){Ie(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=jt(await Ge(this,$t,Js).call(this,{method:"getBlockNumber"}),"%response");return V(this,Cc)>=0&&ee(this,Cc,e),e}_getAddress(e){return is(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(Cn(e))return Cn(e,32)?e:Na(e);if(typeof e=="bigint"&&(e=jt(e,"blockTag")),typeof e=="number")return e>=0?Na(e):V(this,Cc)>=0?Na(V(this,Cc)+e):this.getBlockNumber().then(t=>Na(t+e));ie(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const t=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?WI(l.map(c=>c.toLowerCase())):l.toLowerCase()),i="blockHash"in e?e.blockHash:void 0,r=(l,c,u)=>{let h;switch(l.length){case 0:break;case 1:h=l[0];break;default:l.sort(),h=l}if(i&&(c!=null||u!=null))throw new Error("invalid filter");const f={};return h&&(f.address=h),t.length&&(f.topics=t),c&&(f.fromBlock=c),u&&(f.toBlock=u),i&&(f.blockHash=i),f};let s=[];if(e.address)if(Array.isArray(e.address))for(const l of e.address)s.push(this._getAddress(l));else s.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),s.filter(l=>typeof l!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(s),o,a]).then(l=>r(l[0],l[1],l[2])):r(s,o,a)}_getTransactionRequest(e){const t=FS(e),i=[];if(["to","from"].forEach(r=>{if(t[r]==null)return;const s=is(t[r],this);Hb(s)?i.push(async function(){t[r]=await s}()):t[r]=s}),t.blockTag!=null){const r=this._getBlockTag(t.blockTag);Hb(r)?i.push(async function(){t.blockTag=await r}()):t.blockTag=r}return i.length?async function(){return await Promise.all(i),t}():t}async getNetwork(){if(V(this,so)==null){const r=(async()=>{try{const s=await this._detectNetwork();return this.emit("network",s,null),s}catch(s){throw V(this,so)===r&&ee(this,so,null),s}})();return ee(this,so,r),(await r).clone()}const e=V(this,so),[t,i]=await Promise.all([e,this._detectNetwork()]);
165return t.chainId!==i.chainId&&(V(this,Fd)?(this.emit("network",i,t),V(this,so)===e&&ee(this,so,Promise.resolve(i))):Ie(!1,`network changed: ${t.chainId} => ${i.chainId} `,"NETWORK_ERROR",{event:"changed"})),t.clone()}async getFeeData(){const e=await this.getNetwork(),t=async()=>{const{_block:r,gasPrice:s,priorityFee:o}=await Jr({_block:Ge(this,$t,XI).call(this,"latest",!1),gasPrice:(async()=>{try{const u=await Ge(this,$t,Js).call(this,{method:"getGasPrice"});return ot(u,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const u=await Ge(this,$t,Js).call(this,{method:"getPriorityFee"});return ot(u,"%response")}catch{}return null})()});let a=null,l=null;const c=this._wrapBlock(r,e);return c&&c.baseFeePerGas&&(l=o??BigInt("1000000000"),a=c.baseFeePerGas*Jhe+l),new R8(s,a,l)},i=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(i){const r=new Wh(i.url),s=await i.processFunc(t,this,r);return new R8(s.gasPrice,s.maxFeePerGas,s.maxPriorityFeePerGas)}return await t()}async estimateGas(e){let t=this._getTransactionRequest(e);return Hb(t)&&(t=await t),ot(await Ge(this,$t,Js).call(this,{method:"estimateGas",transaction:t}),"%response")}async call(e){const{tx:t,blockTag:i}=await Jr({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await Ge(this,$t,KI).call(this,Ge(this,$t,qI).call(this,t,i,e.enableCcipRead?0:-1))}async getBalance(e,t){return ot(await Ge(this,$t,Iv).call(this,{method:"getBalance"},e,t),"%response")}async getTransactionCount(e,t){return jt(await Ge(this,$t,Iv).call(this,{method:"getTransactionCount"},e,t),"%response")}async getCode(e,t){return Ye(await Ge(this,$t,Iv).call(this,{method:"getCode"},e,t))}async getStorage(e,t,i){const r=ot(t,"position");return Ye(await Ge(this,$t,Iv).call(this,{method:"getStorage",position:r},e,i))}async broadcastTransaction(e){const{blockNumber:t,hash:i,network:r}=await Jr({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),s=NS.from(e);if(s.hash!==i)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(s,r).replaceableTransaction(t)}async getBlock(e,t){const{network:i,params:r}=await Jr({network:this.getNetwork(),params:Ge(this,$t,XI).call(this,e,!!t)});return r==null?null:this._wrapBlock(r,i)}async getTransaction(e){const{network:t,params:i}=await Jr({network:this.getNetwork(),params:Ge(this,$t,Js).call(this,{method:"getTransaction",hash:e})});return i==null?null:this._wrapTransactionResponse(i,t)}async getTransactionReceipt(e){const{network:t,params:i}=await Jr({network:this.getNetwork(),params:Ge(this,$t,Js).call(this,{method:"getTransactionReceipt",hash:e})});if(i==null)return null;if(i.gasPrice==null&&i.effectiveGasPrice==null){const r=await Ge(this,$t,Js).call(this,{method:"getTransaction",hash:e});if(r==null)throw new Error("report this; could not find tx or effectiveGasPrice");i.effectiveGasPrice=r.gasPrice}return this._wrapTransactionReceipt(i,t)}async getTransactionResult(e){const{result:t}=await Jr({network:this.getNetwork(),result:Ge(this,$t,Js).call(this,{method:"getTransactionResult",hash:e})});return t==null?null:Ye(t)}async getLogs(e){let t=this._getFilter(e);Hb(t)&&(t=await t);const{network:i,params:r}=await Jr({network:this.getNetwork(),params:Ge(this,$t,Js).call(this,{method:"getLogs",filter:t})});return r.map(s=>this._wrapLog(s,i))}_getProvider(e){Ie(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await VS.fromName(this,e)}async getAvatar(e){const t=await this.getResolver(e);return t?await t.getAvatar():null}async resolveName(e){const t=await this.getResolver(e);return t?await t.getAddress():null}async lookupAddress(e){e=hn(e);const t=FI(e.substring(2).toLowerCase()+".addr.reverse");try{const i=await VS.getEnsAddress(this),s=await new Qv(i,["function resolver(bytes32) view returns (address)"],this).resolver(t);if(s==null||s===Dw)return null;const a=await new Qv(s,["function name(bytes32) view returns (string)"],this).name(t);return await this.resolveName(a)!==e?null:a}catch(i){if(hr(i,"BAD_DATA")&&i.value==="0x"||hr(i,"CALL_EXCEPTION"))return null;throw i}return null}async waitForTransaction(e,t,i){const r=t??1;return r===0?this.getTransactionReceipt(e):new Promise(async(s,o)=>{let a=null;const l=async c=>{try{const u=await this.getTransactionReceipt(e);
165if(u!=null&&c-u.blockNumber+1>=r){s(u),a&&(clearTimeout(a),a=null);return}}catch(u){console.log("EEE",u)}this.once("block",l)};i!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",l),o(kn("timeout","TIMEOUT",{reason:"timeout"})))},i)),l(await this.getBlockNumber())})}async waitForBlock(e){Ie(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const t=V(this,Ko).get(e);t&&(t.timer&&clearTimeout(t.timer),V(this,Ko).delete(e))}_setTimeout(e,t){t==null&&(t=0);const i=Cy(this,I1)._++,r=()=>{V(this,Ko).delete(i),e()};if(this.paused)V(this,Ko).set(i,{timer:null,func:r,time:t});else{const s=setTimeout(r,t);V(this,Ko).set(i,{timer:s,func:r,time:gP()})}return i}_forEachSubscriber(e){for(const t of V(this,Or).values())e(t.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new WW(e.type);case"block":{const t=new Xhe(this);return t.pollingInterval=this.pollingInterval,t}case"safe":case"finalized":return new Yhe(this,e.type);case"event":return new FO(this,e.filter);case"transaction":return new Zhe(this,e.hash);case"orphan":return new Qhe(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,t){for(const i of V(this,Or).values())if(i.subscriber===e){i.started&&i.subscriber.stop(),i.subscriber=t,i.started&&t.start(),V(this,Lr)!=null&&t.pause(V(this,Lr));break}}async on(e,t){const i=await Ge(this,$t,OE).call(this,e);return i.listeners.push({listener:t,once:!1}),i.started||(i.subscriber.start(),i.started=!0,V(this,Lr)!=null&&i.subscriber.pause(V(this,Lr))),this}async once(e,t){const i=await Ge(this,$t,OE).call(this,e);return i.listeners.push({listener:t,once:!0}),i.started||(i.subscriber.start(),i.started=!0,V(this,Lr)!=null&&i.subscriber.pause(V(this,Lr))),this}async emit(e,...t){const i=await Ge(this,$t,Rv).call(this,e,t);if(!i||i.listeners.length===0)return!1;const r=i.listeners.length;return i.listeners=i.listeners.filter(({listener:s,once:o})=>{const a=new oj(this,o?null:s,e);try{s.call(this,...t,a)}catch{}return!o}),i.listeners.length===0&&(i.started&&i.subscriber.stop(),V(this,Or).delete(i.tag)),r>0}async listenerCount(e){if(e){const i=await Ge(this,$t,Rv).call(this,e);return i?i.listeners.length:0}let t=0;for(const{listeners:i}of V(this,Or).values())t+=i.length;return t}async listeners(e){if(e){const i=await Ge(this,$t,Rv).call(this,e);return i?i.listeners.map(({listener:r})=>r):[]}let t=[];for(const{listeners:i}of V(this,Or).values())t=t.concat(i.map(({listener:r})=>r));return t}async off(e,t){const i=await Ge(this,$t,Rv).call(this,e);if(!i)return this;if(t){const r=i.listeners.map(({listener:s})=>s).indexOf(t);r>=0&&i.listeners.splice(r,1)}return(!t||i.listeners.length===0)&&(i.started&&i.subscriber.stop(),V(this,Or).delete(i.tag)),this}async removeAllListeners(e){if(e){const{tag:t,started:i,subscriber:r}=await Ge(this,$t,OE).call(this,e);i&&r.stop(),V(this,Or).delete(t)}else for(const[t,{started:i,subscriber:r}]of V(this,Or))i&&r.stop(),V(this,Or).delete(t);return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return this.off(e,t)}get destroyed(){return V(this,h0)}destroy(){this.removeAllListeners();for(const e of V(this,Ko).keys())this._clearTimeout(e);ee(this,h0,!0)}get paused(){return V(this,Lr)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(ee(this,Cc,-1),V(this,Lr)!=null){if(V(this,Lr)==!!e)return;Ie(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(t=>t.pause(e)),ee(this,Lr,!!e);for(const t of V(this,Ko).values())t.timer&&clearTimeout(t.timer),t.time=gP()-t.time}resume(){if(V(this,Lr)!=null){this._forEachSubscriber(e=>e.resume()),ee(this,Lr,null);for(const e of V(this,Ko).values()){let t=e.time;t<0&&(t=0),e.time=gP(),setTimeout(e.func,t)}}}}Or=new WeakMap,bh=new WeakMap,Lr=new WeakMap,h0=new WeakMap,so=new WeakMap,Fd=new WeakMap,_h=new WeakMap,Cc=new WeakMap,I1=new WeakMap,Ko=new WeakMap,f0=new WeakMap,d0=new WeakMap,$t=new WeakSet,Js=async function(e){const t=V(this,d0).cacheTimeout;if(t<0)return await this._perform(e);const i=DE(e.method,e);let r=V(this,_h).get(i);return r||(r=this._perform(e),V(this,_h).set(i,r),setTimeout(()=>{V(this,_h).get(i)===r&&V(this,_h).delete(i)},t)),await r},qI=async function(e,t,i){Ie(i<efe,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:t,enableCcipRead:!0})});const r=FS(e);try{return Ye(await this._perform({method:"call",transaction:r,blockTag:t}))}catch(s){if(!this.disableCcipRead&&bO(s)&&s.data&&i>=0&&t==="latest"&&r.to!=null&&ti(s.data,0,4)==="0x556f1830"){const o=s.data,a=await is(r.to,this);let l;try{l=lfe(ti(s.data,4))}catch(h){Ie(!1,h.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:r,info:{data:o}})}Ie(l.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:r,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:l.errorArgs}});const c=await this.ccipReadFetch(r,l.calldata,l.urls);Ie(c!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:r,info:{data:s.data,errorArgs:l.errorArgs}});const u={to:a,data:ri([l.selector,afe([c,l.extraData])])};
165this.emit("debug",{action:"sendCcipReadCall",transaction:u});try{const h=await Ge(this,$t,qI).call(this,u,t,i+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},u),result:h}),h}catch(h){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},u),error:h}),h}}throw s}},KI=async function(e){const{value:t}=await Jr({network:this.getNetwork(),value:e});return t},Iv=async function(e,t,i){let r=this._getAddress(t),s=this._getBlockTag(i);return(typeof r!="string"||typeof s!="string")&&([r,s]=await Promise.all([r,s])),await Ge(this,$t,KI).call(this,Ge(this,$t,Js).call(this,Object.assign(e,{address:r,blockTag:s})))},XI=async function(e,t){if(Cn(e,32))return await Ge(this,$t,Js).call(this,{method:"getBlock",blockHash:e,includeTransactions:t});let i=this._getBlockTag(e);return typeof i!="string"&&(i=await i),await Ge(this,$t,Js).call(this,{method:"getBlock",blockTag:i,includeTransactions:t})},Rv=async function(e,t){let i=await mP(e,this);return i.type==="event"&&t&&t.length>0&&t[0].removed===!0&&(i=await mP({orphan:"drop-log",log:t[0]},this)),V(this,Or).get(i.tag)||null},OE=async function(e){const t=await mP(e,this),i=t.tag;let r=V(this,Or).get(i);return r||(r={subscriber:this._getSubscriber(t),tag:i,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},V(this,Or).set(i,r)),r};function rfe(n,e){try{const t=YI(n,e);if(t)return IS(t)}catch{}return null}function YI(n,e){if(n==="0x")return null;try{const t=jt(ti(n,e,e+32)),i=jt(ti(n,t,t+32));return ti(n,t+32,t+32+i)}catch{}return null}function F8(n){const e=Ri(n);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function sfe(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}const ofe=new Uint8Array([]);function afe(n){const e=[];let t=0;for(let i=0;i<n.length;i++)e.push(ofe),t+=32;for(let i=0;i<n.length;i++){const r=Gt(n[i]);e[i]=F8(t),e.push(F8(r.length)),e.push(sfe(r)),t+=32+Math.ceil(r.length/32)*32}return ri(e)}const z8="0x0000000000000000000000000000000000000000000000000000000000000000";function lfe(n){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};Ie(bg(n)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=ti(n,0,32);Ie(ti(t,0,12)===ti(z8,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=ti(t,12);try{const i=[],r=jt(ti(n,32,64)),s=jt(ti(n,r,r+32)),o=ti(n,r+32);for(let a=0;a<s;a++){const l=rfe(o,a*32);if(l==null)throw new Error("abort");i.push(l)}e.urls=i}catch{Ie(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const i=YI(n,64);if(i==null)throw new Error("abort");e.calldata=i}catch{Ie(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}Ie(ti(n,100,128)===ti(z8,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=ti(n,96,100);try{const i=YI(n,128);if(i==null)throw new Error("abort");e.extraData=i}catch{Ie(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(i=>e[i]),e}function _f(n,e){if(n.provider)return n.provider;Ie(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function V8(n,e){let t=FS(e);if(t.to!=null&&(t.to=is(t.to,n)),t.from!=null){const i=t.from;t.from=Promise.all([n.getAddress(),is(i,n)]).then(([r,s])=>(ie(r.toLowerCase()===s.toLowerCase(),"transaction from mismatch","tx.from",s),r))}else t.from=n.getAddress();return await Jr(t)}class cfe{constructor(e){ce(this,"provider");vt(this,{provider:e||null})}async getNonce(e){return _f(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await V8(this,e)}async populateTransaction(e){const t=_f(this,"populateTransaction"),i=await V8(this,e);i.nonce==null&&(i.nonce=await this.getNonce("pending")),i.gasLimit==null&&(i.gasLimit=await this.estimateGas(i));const r=await this.provider.getNetwork();if(i.chainId!=null){const o=ot(i.chainId);ie(o===r.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else i.chainId=r.chainId;const s=i.maxFeePerGas!=null||i.maxPriorityFeePerGas!=null;if(i.gasPrice!=null&&(i.type===2||s)?ie(!1,"eip-1559 transaction do n
165ot support gasPrice","tx",e):(i.type===0||i.type===1)&&s&&ie(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(i.type===2||i.type==null)&&i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)i.type=2;else if(i.type===0||i.type===1){const o=await t.getFeeData();Ie(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),i.gasPrice==null&&(i.gasPrice=o.gasPrice)}else{const o=await t.getFeeData();if(i.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(i.authorizationList&&i.authorizationList.length?i.type=4:i.type=2,i.gasPrice!=null){const a=i.gasPrice;delete i.gasPrice,i.maxFeePerGas=a,i.maxPriorityFeePerGas=a}else i.maxFeePerGas==null&&(i.maxFeePerGas=o.maxFeePerGas),i.maxPriorityFeePerGas==null&&(i.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(Ie(!s,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),i.gasPrice==null&&(i.gasPrice=o.gasPrice),i.type=0):Ie(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(i.type===2||i.type===3||i.type===4)&&(i.maxFeePerGas==null&&(i.maxFeePerGas=o.maxFeePerGas),i.maxPriorityFeePerGas==null&&(i.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await Jr(i)}async populateAuthorization(e){const t=Object.assign({},e);return t.chainId==null&&(t.chainId=(await _f(this,"getNetwork").getNetwork()).chainId),t.nonce==null&&(t.nonce=await this.getNonce()),t}async estimateGas(e){return _f(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return _f(this,"call").call(await this.populateCall(e))}async resolveName(e){return await _f(this,"resolveName").resolveName(e)}async sendTransaction(e){const t=_f(this,"sendTransaction"),i=await this.populateTransaction(e);delete i.from;const r=NS.from(i);return await t.broadcastTransaction(await this.signTransaction(r))}authorize(e){Ie(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}function ufe(n){return JSON.parse(JSON.stringify(n))}var Qr,bl,zd,Eh,Vd,p0,Zh,QI,ZI;class qW{constructor(e){ge(this,Zh);ge(this,Qr);ge(this,bl);ge(this,zd);ge(this,Eh);ge(this,Vd);ge(this,p0);ee(this,Qr,e),ee(this,bl,null),ee(this,zd,Ge(this,Zh,QI).bind(this)),ee(this,Eh,!1),ee(this,Vd,null),ee(this,p0,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,t){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){V(this,Eh)||(ee(this,Eh,!0),Ge(this,Zh,QI).call(this,-2))}stop(){V(this,Eh)&&(ee(this,Eh,!1),ee(this,p0,!0),Ge(this,Zh,ZI).call(this),V(this,Qr).off("block",V(this,zd)))}pause(e){e&&Ge(this,Zh,ZI).call(this),V(this,Qr).off("block",V(this,zd))}resume(){this.start()}}Qr=new WeakMap,bl=new WeakMap,zd=new WeakMap,Eh=new WeakMap,Vd=new WeakMap,p0=new WeakMap,Zh=new WeakSet,QI=async function(e){try{V(this,bl)==null&&ee(this,bl,this._subscribe(V(this,Qr)));let t=null;try{t=await V(this,bl)}
165catch(s){if(!hr(s,"UNSUPPORTED_OPERATION")||s.operation!=="eth_newFilter")throw s}if(t==null){ee(this,bl,null),V(this,Qr)._recoverSubscriber(this,this._recover(V(this,Qr)));return}const i=await V(this,Qr).getNetwork();if(V(this,Vd)||ee(this,Vd,i),V(this,Vd).chainId!==i.chainId)throw new Error("chaid changed");if(V(this,p0))return;const r=await V(this,Qr).send("eth_getFilterChanges",[t]);await this._emitResults(V(this,Qr),r)}catch(t){console.log("@TODO",t)}V(this,Qr).once("block",V(this,zd))},ZI=function(){const e=V(this,bl);e&&(ee(this,bl,null),e.then(t=>{V(this,Qr).destroyed||V(this,Qr).send("eth_uninstallFilter",[t])}))};var Hd;class hfe extends qW{constructor(t,i){super(t);ge(this,Hd);ee(this,Hd,ufe(i))}_recover(t){return new FO(t,V(this,Hd))}async _subscribe(t){return await t.send("eth_newFilter",[V(this,Hd)])}async _emitResults(t,i){for(const r of i)t.emit(V(this,Hd),t._wrapLog(r,t._network))}}Hd=new WeakMap;class ffe extends qW{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,t){for(const i of t)e.emit("pending",i)}}const dfe="bigint,boolean,function,number,string,symbol".split(/,/g);function LE(n){if(n==null||dfe.indexOf(typeof n)>=0||typeof n.getAddress=="function")return n;if(Array.isArray(n))return n.map(LE);if(typeof n=="object")return Object.keys(n).reduce((e,t)=>(e[t]=n[t],e),{});throw new Error(`should not happen: ${n} (${typeof n})`)}function pfe(n){return new Promise(e=>{setTimeout(e,n)})}function Zp(n){return n&&n.toLowerCase()}function H8(n){return n&&typeof n.pollingInterval=="number"}const KW={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class yP extends cfe{constructor(t,i){super(t);ce(this,"address");i=hn(i),vt(this,{address:i})}connect(t){Ie(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(t){return await this.populateCall(t)}async sendUncheckedTransaction(t){const i=LE(t),r=[];if(i.from){const o=i.from;r.push((async()=>{const a=await is(o,this.provider);ie(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),i.from=a})())}else i.from=this.address;if(i.gasLimit==null&&r.push((async()=>{i.gasLimit=await this.provider.estimateGas({...i,from:this.address})})()),i.to!=null){const o=i.to;r.push((async()=>{i.to=await is(o,this.provider)})())}r.length&&await Promise.all(r);const s=this.provider.getRpcTransaction(i);return this.provider.send("eth_sendTransaction",[s])}async sendTransaction(t){const i=await this.provider.getBlockNumber(),r=await this.sendUncheckedTransaction(t);return await new Promise((s,o)=>{const a=[1e3,100];let l=0;const c=async()=>{try{const u=await this.provider.getTransaction(r);if(u!=null){s(u.replaceableTransaction(i));return}}catch(u){if(hr(u,"CANCELLED")||hr(u,"BAD_DATA")||hr(u,"NETWORK_ERROR")||hr(u,"UNSUPPORTED_OPERATION")){u.info==null&&(u.info={}),u.info.sendTransactionHash=r,o(u);return}if(hr(u,"INVALID_ARGUMENT")&&(l++,u.info==null&&(u.info={}),u.info.sendTransactionHash=r,l>10)){o(u);return}this.provider.emit("error",kn("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:u}))}this.provider._setTimeout(()=>{c()},a.pop()||4e3)};c()})}async signTransaction(t){const i=LE(t);if(i.from){const s=await is(i.from,this.provider);ie(s!=null&&s.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),i.from=s}else i.from=this.address;const r=this.provider.getRpcTransaction(i);return await this.provider.send("eth_signTransaction",[r])}async signMessage(t){const i=typeof t=="string"?Gc(t):t;return await this.provider.send("personal_sign",[Ye(i),this.address.toLowerCase()])}async signTypedData(t,i,r){const s=LE(r),o=await kS.resolveNames(t,i,s,async a=>{const l=await is(a);return ie(l!=null,"TypedData does not support null address","value",a),l});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(kS.getPayload(o.domain,i,o.value))])}async unlock(t){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),t,null])}async _legacySignMessage(t){const i=typeof t=="string"?Gc(t):t;return await this.provider.send("eth_sign",[this.address.toLowerCase(),Ye(i)])}}var $d,m0,Ic,_l,Ca,Xo,Es,R1,JI;class mfe extends ife{constructor(t,i){super(t,i);ge(this,R1);ge(this,$d);ge(this,m0);ge(this,Ic);ge(this,_l);ge(this,Ca);ge(this,Xo);ge(this,Es);ee(this,m0,1),ee(this,$d,Object.assign({},KW,i||{})),ee(this,Ic,[]),ee(this,_l,null),ee(this,Xo,null),ee(this,Es,null);{let s=null;const o=new Promise(a=>{s=a});ee(this,Ca,{promise:o,resolve:s})}const r=this._getOption("staticNetwork");typeof r=="boolean"?(ie(!r||t!=="any","staticNetwork cannot be used on special network 'any'","options",i),r&&t!=null&&ee(this,Xo,Pl.from(t))):r&&(ie(t==null||r.matches(t),"staticNetwork MUST match network object","options",i),ee(this,Xo,r))}_getOption(t){return V(this,$d)[t]}get _network(){return Ie(V(this,Xo),"network is not available yet","NETWORK_E
165RROR"),V(this,Xo)}async _perform(t){if(t.method==="call"||t.method==="estimateGas"){let r=t.transaction;if(r&&r.type!=null&&ot(r.type)&&r.maxFeePerGas==null&&r.maxPriorityFeePerGas==null){const s=await this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(t=Object.assign({},t,{transaction:Object.assign({},r,{type:void 0})}))}}const i=this.getRpcRequest(t);return i!=null?await this.send(i.method,i.args):super._perform(t)}async _detectNetwork(){const t=this._getOption("staticNetwork");if(t)if(t===!0){if(V(this,Xo))return V(this,Xo)}else return t;return V(this,Es)?await V(this,Es):this.ready?(ee(this,Es,(async()=>{try{const i=Pl.from(ot(await this.send("eth_chainId",[])));return ee(this,Es,null),i}catch(i){throw ee(this,Es,null),i}})()),await V(this,Es)):(ee(this,Es,(async()=>{const i={id:Cy(this,m0)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:i});let r;try{r=(await this._send(i))[0],ee(this,Es,null)}catch(s){throw ee(this,Es,null),this.emit("debug",{action:"receiveRpcError",error:s}),s}
165if(this.emit("debug",{action:"receiveRpcResult",result:r}),"result"in r)return Pl.from(ot(r.result));throw this.getRpcError(i,r)})()),await V(this,Es))}_start(){V(this,Ca)==null||V(this,Ca).resolve==null||(V(this,Ca).resolve(),ee(this,Ca,null),(async()=>{for(;V(this,Xo)==null&&!this.destroyed;)try{ee(this,Xo,await this._detectNetwork())}catch(t){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",kn("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:t}})),await pfe(1e3)}Ge(this,R1,JI).call(this)})())}async _waitUntilReady(){if(V(this,Ca)!=null)return await V(this,Ca).promise}_getSubscriber(t){return t.type==="pending"?new ffe(this):t.type==="event"?this._getOption("polling")?new FO(this,t.filter):new hfe(this,t.filter):t.type==="orphan"&&t.filter.orphan==="drop-log"?new WW("orphan"):super._getSubscriber(t)}get ready(){return V(this,Ca)==null}getRpcTransaction(t){const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(r=>{if(t[r]==null)return;let s=r;r==="gasLimit"&&(s="gas"),i[s]=Na(ot(t[r],`tx.${r}`))}),["from","to","data"].forEach(r=>{t[r]!=null&&(i[r]=Ye(t[r]))}),t.accessList&&(i.accessList=_p(t.accessList)),t.blobVersionedHashes&&(i.blobVersionedHashes=t.blobVersionedHashes.map(r=>r.toLowerCase())),t.authorizationList&&(i.authorizationList=t.authorizationList.map(r=>{const s=Yj(r);return{address:s.address,nonce:Na(s.nonce),chainId:Na(s.chainId),yParity:Na(s.signature.yParity),r:Na(s.signature.r),s:Na(s.signature.s)}})),i}getRpcRequest(t){switch(t.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Zp(t.address),t.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Zp(t.address),t.blockTag]};case"getCode":return{method:"eth_getCode",args:[Zp(t.address),t.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Zp(t.address),"0x"+t.position.toString(16),t.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[t.signedTransaction]};case"getBlock":if("blockTag"in t)return{method:"eth_getBlockByNumber",args:[t.blockTag,!!t.includeTransactions]};if("blockHash"in t)return{method:"eth_getBlockByHash",args:[t.blockHash,!!t.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[t.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[t.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(t.transaction),t.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(t.transaction)]};case"getLogs":return t.filter&&t.filter.address!=null&&(Array.isArray(t.filter.address)?t.filter.address=t.filter.address.map(Zp):t.filter.address=Zp(t.filter.address)),{method:"eth_getLogs",args:[t.filter]}}return null}getRpcError(t,i){const{method:r}=t,{error:s}=i;if(r==="eth_estimateGas"&&s.message){const l=s.message;if(!l.match(/revert/i)&&l.match(/insufficient funds/i))return kn("insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.params[0],info:{payload:t,error:s}});if(l.match(/nonce/i)&&l.match(/too low/i))return kn("nonce has already been used","NONCE_EXPIRED",{transaction:t.params[0],info:{payload:t,error:s}})}if(r==="eth_call"||r==="eth_estimateGas"){const l=eR(s),c=zw.getBuiltinCallException(r==="eth_call"?"call":"estimateGas",t.params[0],l?l.data:null);return c.info={error:s,payload:t},c}const o=JSON.stringify(yfe(s));if(typeof s.message=="string"&&s.message.match(/user denied|ethers-user-denied/i))return kn("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[r]||"unknown",reason:"rejected",info:{payload:t,error:s}});if(r==="eth_sendRawTransaction"||r==="eth_sendTransaction"){const l=t.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return kn("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:l,info:{error:s}});if(o.match(/nonce/i)&&o.match(/too low/i))return kn("nonce has already been used","NONCE_EXPIRED",{transaction:l,info:{error:s}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return kn("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:l,info:{error:s}});if(o.match(/only replay-protected/i))return kn("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:r,info:{transaction:l,info:{error:s}}})}let a=!!o.match(/the method .* does not exist/i);return a||s&&s.details&&s.details.startsWith("Unauthorized method:")&&(a=!0),a?kn("unsupported operation","UNSUPPORTED_OPERATION",{operation:t.method,info:{error:s,payload:t}}
165):kn("could not coalesce error","UNKNOWN_ERROR",{error:s,payload:t})}send(t,i){if(this.destroyed)return Promise.reject(kn("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t}));const r=Cy(this,m0)._++,s=new Promise((o,a)=>{V(this,Ic).push({resolve:o,reject:a,payload:{method:t,params:i,id:r,jsonrpc:"2.0"}})});return Ge(this,R1,JI).call(this),s}async getSigner(t){t==null&&(t=0);const i=this.send("eth_accounts",[]);if(typeof t=="number"){const s=await i;if(t>=s.length)throw new Error("no such account");return new yP(this,s[t])}const{accounts:r}=await Jr({network:this.getNetwork(),accounts:i});t=hn(t);for(const s of r)if(hn(s)===t)return new yP(this,t);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(i=>new yP(this,i))}destroy(){V(this,_l)&&(clearTimeout(V(this,_l)),ee(this,_l,null));for(const{payload:t,reject:i}of V(this,Ic))i(kn("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t.method}));ee(this,Ic,[]),super.destroy()}}$d=new WeakMap,m0=new WeakMap,Ic=new WeakMap,_l=new WeakMap,Ca=new WeakMap,Xo=new WeakMap,Es=new WeakMap,R1=new WeakSet,JI=function(){if(V(this,_l))return;const t=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");ee(this,_l,setTimeout(()=>{ee(this,_l,null);const i=V(this,Ic);for(ee(this,Ic,[]);i.length;){const r=[i.shift()];for(;i.length&&r.length!==V(this,$d).batchMaxCount;)if(r.push(i.shift()),JSON.stringify(r.map(o=>o.payload)).length>V(this,$d).batchMaxSize){i.unshift(r.pop());break}(async()=>{const s=r.length===1?r[0].payload:r.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:s});try{const o=await this._send(s);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:l,payload:c}of r){if(this.destroyed){l(kn("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:c.method}));continue}const u=o.filter(h=>h.id===c.id)[0];if(u==null){const h=kn("missing response for request","BAD_DATA",{value:o,info:{payload:c}});this.emit("error",h),l(h);continue}if("error"in u){l(this.getRpcError(c,u));continue}a(u.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of r)a(o)}})()}},t))};var Sh;class gfe extends mfe{constructor(t,i){super(t,i);ge(this,Sh);let r=this._getOption("pollingInterval");r==null&&(r=KW.pollingInterval),ee(this,Sh,r)}_getSubscriber(t){const i=super._getSubscriber(t);return H8(i)&&(i.pollingInterval=V(this,Sh)),i}get pollingInterval(){return V(this,Sh)}set pollingInterval(t){if(!Number.isInteger(t)||t<0)throw new Error("invalid interval");ee(this,Sh,t),this._forEachSubscriber(i=>{H8(i)&&(i.pollingInterval=V(this,Sh))})}}Sh=new WeakMap;function eR(n){if(n==null)return null;if(typeof n.message=="string"&&n.message.match(/revert/i)&&Cn(n.data))return{message:n.message,data:n.data};if(typeof n=="object"){for(const e in n){const t=eR(n[e]);if(t)return t}return null}if(typeof n=="string")try{return eR(JSON.parse(n))}catch{}return null}function tR(n,e){if(n!=null){if(typeof n.message=="string"&&e.push(n.message),typeof n=="object")for(const t in n)tR(n[t],e);if(typeof n=="string")try{return tR(JSON.parse(n),e)}catch{}}}function yfe(n){const e=[];return tR(n,e),e}var g0,y0;const od=class od extends gfe{constructor(t,i,r){const s=Object.assign({},r??{},{batchMaxCount:1});ie(t&&t.request,"invalid EIP-1193 provider","ethereum",t);super(i,s);ge(this,g0);ge(this,y0);ee(this,y0,null),r&&r.providerInfo&&ee(this,y0,r.providerInfo),ee(this,g0,async(o,a)=>{const l={method:o,params:a};this.emit("debug",{action:"sendEip1193Request",payload:l});try{const c=await t.request(l);return this.emit("debug",{action:"receiveEip1193Result",result:c}),c}catch(c){const u=new Error(c.message);throw u.code=c.code,u.data=c.data,u.payload=l,this.emit("debug",{action:"receiveEip1193Error",error:u}),u}})}get providerInfo(){return V(this,y0)}async send(t,i){return await this._start(),await super.send(t,i)}async _send(t){ie(!Array.isArray(t),"EIP-1193 does not support batch request","payload",t);try{const i=await V(this,g0).call(this,t.method,t.params||[]);return[{id:t.id,result:i}]}catch(i){return[{id:t.id,error:{code:i.code,data:i.data,message:i.message}}]}}getRpcError(t,i){switch(i=JSON.parse(JSON.stringify(i)),i.error.code||-1){case 4001:i.error.message=`ethers-user-denied: ${i.error.message}`;break;case 4200:i.error.message=`ethers-unsupported: ${i.error.message}`;break}return super.getRpcError(t,i)}async hasSigner(t){t==null&&(t=0);const i=await this.send("eth_accounts",[]);return typeof t=="number"?i.length>t:(t=t.toLowerCase(),i.filter(r=>r.toLowerCase()===t).length!==0)}async getSigner(t){if(t==null&&(t=0),!await this.hasSigner(t))try{await V(this,g0).call(this,"eth_requestAccounts",[])}catch(i){const r=i.payload;throw this.getRpcError(r,{id:r.id,error:i})}return await super.getSigner(t)}static async discover(t){if(t==null&&(t={}),t.provider)return new od(t.provider);
165const i=t.window?t.window:typeof window<"u"?window:null;if(i==null)return null;const r=t.anyProvider;if(r&&i.ethereum)return new od(i.ethereum);if(!("addEventListener"in i&&"dispatchEvent"in i&&"removeEventListener"in i))return null;const s=t.timeout?t.timeout:300;return s===0?null:await new Promise((o,a)=>{let l=[];const c=f=>{l.push(f.detail),r&&u()},u=()=>{if(clearTimeout(h),l.length)if(t&&t.filter){const f=t.filter(l.map(m=>Object.assign({},m.info)));if(f==null)o(null);else if(f instanceof od)o(f);else{let m=null;if(f.uuid&&(m=l.filter(v=>f.uuid===v.info.uuid)[0]),m){const{provider:g,info:v}=m;o(new od(g,void 0,{providerInfo:v}))}else a(kn("filter returned unknown info","UNSUPPORTED_OPERATION",{value:f}))}}else{const{provider:f,info:m}=l[0];o(new od(f,void 0,{providerInfo:m}))}else o(null);i.removeEventListener("eip6963:announceProvider",c)},h=setTimeout(()=>{u()},s);i.addEventListener("eip6963:announceProvider",c),i.dispatchEvent(new Event("eip6963:requestProvider"))})}};g0=new WeakMap,y0=new WeakMap;let dc=od;const vfe="modulepreload",wfe=function(n){return"/"+n},$8={},xfe=function(e,t,i){let r=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(t.map(l=>{if(l=wfe(l),l in $8)return;$8[l]=!0;const c=l.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${u}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":vfe,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((f,m)=>{h.addEventListener("load",f),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};var zO={exports:{}},Sg=typeof Reflect=="object"?Reflect:null,G8=Sg&&typeof Sg.apply=="function"?Sg.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)},UE;Sg&&typeof Sg.ownKeys=="function"?UE=Sg.ownKeys:Object.getOwnPropertySymbols?UE=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:UE=function(e){return Object.getOwnPropertyNames(e)};function bfe(n){console&&console.warn&&console.warn(n)}var XW=Number.isNaN||function(e){return e!==e};function xn(){xn.init.call(this)}zO.exports=xn;zO.exports.once=Afe;xn.EventEmitter=xn;xn.prototype._events=void 0;xn.prototype._eventsCount=0;xn.prototype._maxListeners=void 0;var j8=10;function l2(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(xn,"defaultMaxListeners",{enumerable:!0,get:function(){return j8},set:function(n){if(typeof n!="number"||n<0||XW(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");j8=n}});xn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};xn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||XW(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function YW(n){return n._maxListeners===void 0?xn.defaultMaxListeners:n._maxListeners}xn.prototype.getMaxListeners=function(){return YW(this)};xn.prototype.emit=function(e){for(var t=[],i=1;i<arguments.length;i++)t.push(arguments[i]);var r=e==="error",s=this._events;if(s!==void 0)r=r&&s.error===void 0;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")G8(l,this,t);else for(var c=l.length,u=tq(l,c),i=0;i<c;++i)G8(u[i],this,t);return!0};function QW(n,e,t,i){var r,s,o;if(l2(t),s=n._events,s===void 0?(s=n._events=Object.create(null),n._eventsCount=0):(s.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),s=n._events),o=s[e]),o===void 0)
vendor: 43,585 bytes, lines 165-179
165o=s[e]=t,++n._eventsCount;else if(typeof o=="function"?o=s[e]=i?[t,o]:[o,t]:i?o.unshift(t):o.push(t),r=YW(n),r>0&&o.length>r&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,bfe(a)}return n}xn.prototype.addListener=function(e,t){return QW(this,e,t,!1)};xn.prototype.on=xn.prototype.addListener;xn.prototype.prependListener=function(e,t){return QW(this,e,t,!0)};function _fe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ZW(n,e,t){var i={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},r=_fe.bind(i);return r.listener=t,i.wrapFn=r,r}xn.prototype.once=function(e,t){return l2(t),this.on(e,ZW(this,e,t)),this};xn.prototype.prependOnceListener=function(e,t){return l2(t),this.prependListener(e,ZW(this,e,t)),this};xn.prototype.removeListener=function(e,t){var i,r,s,o,a;if(l2(t),r=this._events,r===void 0)return this;if(i=r[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,o=i.length-1;o>=0;o--)if(i[o]===t||i[o].listener===t){a=i[o].listener,s=o;break}if(s<0)return this;s===0?i.shift():Efe(i,s),i.length===1&&(r[e]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};xn.prototype.off=xn.prototype.removeListener;xn.prototype.removeAllListeners=function(e){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),o;for(r=0;r<s.length;++r)o=s[r],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=i[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function JW(n,e,t){var i=n._events;if(i===void 0)return[];var r=i[e];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?Sfe(r):tq(r,r.length)}xn.prototype.listeners=function(e){return JW(this,e,!0)};xn.prototype.rawListeners=function(e){return JW(this,e,!1)};xn.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):eq.call(n,e)};xn.prototype.listenerCount=eq;function eq(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}xn.prototype.eventNames=function(){return this._eventsCount>0?UE(this._events):[]};function tq(n,e){for(var t=new Array(e),i=0;i<e;++i)t[i]=n[i];return t}function Efe(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function Sfe(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function Afe(n,e){return new Promise(function(t,i){function r(o){n.removeListener(e,s),i(o)}function s(){typeof n.removeListener=="function"&&n.removeListener("error",r),t([].slice.call(arguments))}nq(n,e,s,{once:!0}),e!=="error"&&Mfe(n,r,{once:!0})})}function Mfe(n,e,t){typeof n.on=="function"&&nq(n,"error",e,t)}function nq(n,e,t,i){if(typeof n.on=="function")i.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function r(s){i.once&&n.removeEventListener(e,r),t(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}var _o=zO.exports;const VO=AA(_o);var W8=function(n,e,t){if(t||arguments.length===2)for(var i=0,r=e.length,s;i<r;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return n.concat(s||Array.prototype.slice.call(e))},Tfe=function(){function n(e,t,i){this.name=e,this.version=t,this.os=i,this.type="browser"}return n}(),Pfe=function(){function n(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}return n}(),Cfe=function(){function n(e,t,i,r){this.name=e,this.version=t,this.os=i,this.bot=r,this.type="bot-device"}return n}(),Ife=function(){function n(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return n}(),Rfe=function(){function n(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return n}(),Nfe=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Dfe=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,q8=3,Ofe=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",Nfe]],K8=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function Lfe(n){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Rfe:typeof navigator<"u"?Bfe(navigator.userAgent):Ffe()}function Ufe(n){return n!==""&&Ofe.reduce(function(e,t){var i=t[0],r=t[1];if(e)return e;var s=r.exec(n);return!!s&&[i,s]},!1)}function Bfe(n){var e=Ufe(n);if(!e)return null;var t=e[0],i=e[1];if(t==="searchbot")return new Ife;var r=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);r?r.length<q8&&(r=W8(W8([],r,!0),zfe(q8-r.length),!0)):r=[];var s=r.join("."),o=kfe(n),a=Dfe.exec(n);return a&&a[1]?new Cfe(t,s,o,a[1]):new Tfe(t,s,o)}function kfe(n){for(var e=0,t=K8.length;e<t;e++){var i=K8[e],r=i[0],s=i[1],o=s.exec(n);if(o)return r}return null}function Ffe(){var n=typeof process<"u"&&process.version;return n?new Pfe(process.version.slice(1)):null}function zfe(n){for(var e=[],t=0;t<n;t++)e.push("0");return e}var Be={};/*! *****************************************************************************
166Copyright (c) Microsoft Corporation.
167
168Permission to use, copy, modify, and/or distribute this software for any
169purpose with or without fee is hereby granted.
170
171THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
172REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
173AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
174INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
175LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
176OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
177PERFORMANCE OF THIS SOFTWARE.
178***************************************************************************** */var nR=function(n,e){return nR=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])},nR(n,e)};function Vfe(n,e){nR(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var iR=function(){return iR=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},iR.apply(this,arguments)};function Hfe(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(n);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(t[i[r]]=n[i[r]]);return t}function $fe(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s}function Gfe(n,e){return function(t,i){e(t,i,n)}}function jfe(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function Wfe(n,e,t,i){function r(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(u){try{c(i.next(u))}catch(h){o(h)}}function l(u){try{c(i.throw(u))}catch(h){o(h)}}function c(u){u.done?s(u.value):r(u.value).then(a,l)}c((i=i.apply(n,e||[])).next())})}function qfe(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Kfe(n,e,t,i){i===void 0&&(i=t),n[i]=e[t]}function Xfe(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function rR(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function iq(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var i=t.call(n),r,s=[],o;try{for(;(e===void 0||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function Yfe(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(iq(arguments[e]));return n}function Qfe(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var i=Array(n),r=0,e=0;e<t;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i}function $w(n){return this instanceof $w?(this.v=n,this):new $w(n)}function Zfe(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(n,e||[]),r,s=[];return r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(f){i[f]&&(r[f]=function(m){return new Promise(function(g,v){s.push([f,m,g,v])>1||a(f,m)})})}function a(f,m){try{l(i[f](m))}catch(g){h(s[0][3],g)}}function l(f){f.value instanceof $w?Promise.resolve(f.value.v).then(c,u):h(s[0][2],f)}function c(f){a("next",f)}function u(f){a("throw",f)}function h(f,m){f(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function Jfe(n){var e,t;return e={},i("next"),i("throw",function(r){throw r}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(r,s){e[r]=n[r]?function(o){return(t=!t)?{value:$w(n[r](o)),done:r==="return"}:s?s(o):o}:s}}function ede(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof rR=="function"?rR(n):n[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=n[s]&&function(o){return new Promise(function(a,l){o=n[s](o),r(a,l,o.done,o.value)})}}function r(s,o,a,l){Promise.resolve(l).then(function(c){s({value:c,done:a})},o)}}function tde(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function nde(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function ide(n){return n&&n.__esModule?n:{default:n}}function rde(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function sde(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}const ode=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return iR},__asyncDelegator:Jfe,__asyncGenerator:Zfe,__asyncValues:ede,__await:$w,__awaiter:Wfe,__classPrivateFieldGet:rde,__classPrivateFieldSet:sde,__createBinding:Kfe,__decorate:$fe,__exportStar:Xfe,__extends:Vfe,__generator:qfe,__importDefault:ide,__importStar:nde,__makeTemplateObject:tde,__metadata:jfe,__param:Gfe,__read:iq,__rest:Hfe,__spread:Yfe,__spreadArrays:Qfe,__values:rR},Symbol.toStringTag,{value:"Module"})),c2=p9(ode);var vP={},Vy={},X8;function ade(){if(X8)return Vy;X8=1,Object.defineProperty(Vy,"__esModule",{value:!0}),Vy.delay=void 0;function n(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}return Vy.delay=n,Vy}var Ef={},wP={},Sf={},Y8;function lde(){return Y8||(Y8=1,Object.defineProperty(Sf,"__esModule",{value:!0}),Sf.ONE_THOUSAND=Sf.ONE_HUNDRED=void 0,Sf.ONE_HUNDRED=100,Sf.ONE_THOUSAND=1e3),Sf}var xP={},Q8;function cde(){return Q8||(Q8=1,function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.ONE_YEAR=n.FOUR_WEEKS=n.THREE_WEEKS=n.TWO_WEEKS=n.ONE_WEEK=n.THIRTY_DAYS=n.SEVEN_DAYS=n.FIVE_DAYS=n.THREE_DAYS=n.ONE_DAY=n.TWENTY_FOUR_HOURS=n.TWELVE_HOURS=n.SIX_HOURS=n.THREE_HOURS=n.ONE_HOUR=n.SIXTY_MINUTES=n.THIRTY_MINUTES=n.TEN_MINUTES=n.FIVE_MINUTES=n.ONE_MINUTE=n.SIXTY_SECONDS=n.THIRTY_SECONDS=n.TEN_SECONDS=n.FIVE_SECONDS=n.ONE_SECOND=void 0,n.ONE_SECOND=1,n.FIVE_SECONDS=5,n.TEN_SECONDS=10,n.THIRTY_SECONDS=30,n.SIXTY_SECONDS=60,n.ONE_MINUTE=n.SIXTY_SECONDS,n.FIVE_MINUTES=n.ONE_MINUTE*5,n.TEN_MINUTES=n.ONE_MINUTE*10,n.THIRTY_MINUTES=n.ONE_MINUTE*30,n.SIXTY_MINUTES=n.ONE_MINUTE*60,n.ONE_HOUR=n.SIXTY_MINUTES,n.THREE_HOURS=n.ONE_HOUR*3,n.SIX_HOURS=n.ONE_HOUR*6,n.TWELVE_HOURS=n.ONE_HOUR*12,n.TWENTY_FOUR_HOURS=n.ONE_HOUR*24,n.ONE_DAY=n.TWENTY_FOUR_HOURS,n.THREE_DAYS=n.ONE_DAY*3,n.FIVE_DAYS=n.ONE_DAY*5,n.SEVEN_DAYS=n.ONE_DAY*7,n.THIRTY_DAYS=n.ONE_DAY*30,n.ONE_WEEK=n.SEVEN_DAYS,n.TWO_WEEKS=n.ONE_WEEK*2,n.THREE_WEEKS=n.ONE_WEEK*3,n.FOUR_WEEKS=n.ONE_WEEK*4,n.ONE_YEAR=n.ONE_DAY*365}(xP)),xP}var Z8;function rq(){return Z8||(Z8=1,function(n){Object.defineProperty(n,"__esModule",{value:!0});const e=c2;e.__exportStar(lde(),n),e.__exportStar(cde(),n)}(wP)),wP}var J8;function ude(){if(J8)return Ef;J8=1,Object.defineProperty(Ef,"__esModule",{value:!0}),Ef.fromMiliseconds=Ef.toMiliseconds=void 0;const n=rq();function e(i){return i*n.ONE_THOUSAND}Ef.toMiliseconds=e;function t(i){return Math.floor(i/n.ONE_THOUSAND)}return Ef.fromMiliseconds=t,Ef}var e5;function hde(){return e5||(e5=1,function(n){Object.defineProperty(n,"__esModule",{value:!0});const e=c2;e.__exportStar(ade(),n),e.__exportStar(ude(),n)}(vP)),vP}var Jp={},t5;function fde(){if(t5)return Jp;t5=1,Object.defineProperty(Jp,"__esModule",{value:!0}),Jp.Watch=void 0;class n{constructor(){this.timestamps=new Map}start(t){if(this.timestamps.has(t))throw new Error(`Watch already started for label: ${t}`);this.timestamps.set(t,{started:Date.now()})}stop(t){const i=this.get(t);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${t}`);const r=Date.now()-i.started;this.timestamps.set(t,{started:i.started,elapsed:r})}get(t){const i=this.timestamps.get(t);if(typeof i>"u")throw new Error(`No timestamp found for label: ${t}`);return i}elapsed(t){const i=this.get(t);return i.elapsed||Date.now()-i.started}}return Jp.Watch=n,Jp.default=n,Jp}var bP={},Hy={},n5;function dde(){if(n5)return Hy;n5=1,Object.defineProperty(Hy,"__esModule",{value:!0}),Hy.IWatch=void 0;class n{}return Hy.IWatch=n,Hy}var i5;function pde(){return i5||(i5=1,function(n){Object.defineProperty(n,"__esModule",{value:!0}),c2.__exportStar(dde(),n)}(bP)),bP}(function(n){Object.defineProperty(n,"__esModule",{value:!0});const e=c2;e.__exportStar(hde(),n),e.__exportStar(fde(),n),e.__exportStar(pde(),n),e.__exportStar(rq(),n)})(Be);var Mn={};Object.defineProperty(Mn,"__esModule",{value:!0});Mn.getLocalStorage=Mn.getLocalStorageOrThrow=Mn.getCrypto=Mn.getCryptoOrThrow=sq=Mn.getLocation=Mn.getLocationOrThrow=HO=Mn.getNavigator=Mn.getNavigatorOrThrow=cp=Mn.getDocument=Mn.getDocumentOrThrow=Mn.getFromWindowOrThrow=Mn.getFromWindow=void 0;function Sp(n){let e;return typeof window<"u"&&typeof window[n]<"u"&&(e=window[n]),e}Mn.getFromWindow=Sp;function Z0(n){const e=Sp(n);if(!e)throw new Error(`${n} is not defined in Window`);return e}Mn.getFromWindowOrThrow=Z0;function mde(){return Z0("document")}Mn.getDocumentOrThrow=mde;function gde(){return Sp("document")}var cp=Mn.getDocument=gde;function yde(){return Z0("navigator")}Mn.getNavigatorOrThrow=yde;function vde(){return Sp("navigator")}var HO=Mn.getNavigator=vde;function wde(){return Z0("location")}Mn.getLocationOrThrow=wde;function xde(){return Sp("location")}var sq=Mn.getLocation=xde;function bde(){return Z0("crypto")}Mn.getCryptoOrThrow=bde;function _de(){return Sp("crypto")}Mn.getCrypto=_de;function Ede(){return Z0("localStorage")}Mn.getLocalStorageOrThrow=Ede;function Sde(){return Sp("localStorage")}Mn.getLocalStorage=Sde;var $O={};Object.defineProperty($O,"__esModule",{value:!0});var oq=$O.getWindowMetadata=void 0;const r5=Mn;function Ade(){let n,e;try{n=r5.getDocumentOrThrow(),e=r5.getLocationOrThrow()}catch{return null}function t(){const h=n.getElementsByTagName("link"),f=[];for(let m=0;m<h.length;m++){const g=h[m],v=g.getAttribute("rel");if(v&&v.toLowerCase().indexOf("icon")>-1){const w=g.getAttribute("href");if(w)if(w.toLowerCase().indexOf("https:")===-1&&w.toLowerCase().indexOf("http:")===-1&&w.indexOf("//")!==0){let y=e.protocol+"//"+e.host;if(w.indexOf("/")===0)y+=w;else{const _=e.pathname.split("/");_.pop();const x=_.join("/");y+=x+"/"+w}f.push(y)}else if(w.indexOf("//")===0){const y=e.protocol+w;f.push(y)}else f.push(w)}}return f}function i(...h){const f=n.getElementsByTagName("meta");for(let m=0;m<f.length;m++){const g=f[m],v=["itemprop","property","name"].map(w=>g.getAttribute(w)).filter(w=>w?h.includes(w):!1);if(v.length&&v){const w=g.getAttribute("content");if(w)return w}}return""}function r(){let h=i("name","og:site_name","og:title","twitter:title");return h||(h=n.title),h}function s(){return i("description","og:description","twitter:description","keywords")}const o=r(),a=s(),l=e.origin,c=t();return{description:a,url:l,icons:c,name:o}}oq=$O.getWindowMetadata=Ade;const Mde="0.1.1";function Tde(){return Mde}class Vn extends Error{constructor(e,t={}){const i=(()=>{var l;if(t.cause instanceof Vn){if(t.cause.details)return t.cause.details;if(t.cause.shortMessage)return t.cause.shortMessage}return t.cause&&"details"in t.cause&&typeof t.cause.details=="string"?t.cause.details:(l=t.cause)!=null&&l.message?t.cause.message:t.details})(),r=t.cause instanceof Vn&&t.cause.docsPath||t.docsPath,o=`https://oxlib.sh${r??""}`,a=[e||"An error occurred.",...t.metaMessages?["",...t.metaMessages]:[],...i||r?["",i?`Details: ${i}`:void 0,r?`See: ${o}`:void 0]:[]].filter(l=>typeof l=="string").join(`
179`);super(a,t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${Tde()}`}),this.cause=t.cause,this.details=i,this.docs=o,this.docsPath=r,this.shortMessage=e}walk(e){return aq(this,e)}}function aq(n,e){return e!=null&&e(n)?n:n&&typeof n=="object"&&"cause"in n&&n.cause?aq(n.cause,e):e?null:n}const em=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Pde(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Gw(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function up(n,...e){if(!Pde(n))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(n.length))throw new Error("Uint8Array expected of length "+e+", got length="+n.length)}function Cde(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Gw(n.outputLen),Gw(n.blockLen)}function U0(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function lq(n,e){up(n);const t=e.outputLen;if(n.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function Ide(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function B0(...n){for(let e=0;e<n.length;e++)n[e].fill(0)}function _P(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function rl(n,e){return n<<32-e|n>>>e}const Rde=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Nde(n){return n<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255}function Dde(n){for(let e=0;e<n.length;e++)n[e]=Nde(n[e]);return n}const s5=Rde?n=>n:Dde;function Ode(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function u2(n){return typeof n=="string"&&(n=Ode(n)),up(n),n}function Lde(...n){let e=0;for(let i=0;i<n.length;i++){const r=n[i];up(r),e+=r.length}const t=new Uint8Array(e);for(let i=0,r=0;i<n.length;i++){const s=n[i];t.set(s,r),r+=s.length}return t}class GO{}function cq(n){const e=i=>n().update(u2(i)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function Ude(n=32){if(em&&typeof em.getRandomValues=="function")return em.getRandomValues(new Uint8Array(n));if(em&&typeof em.randomBytes=="function")return Uint8Array.from(em.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}function Bde(n,e,t,i){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,i);const r=BigInt(32),s=BigInt(4294967295),o=Number(t>>r&s),a=Number(t&s),l=i?4:0,c=i?0:4;n.setUint32(e+l,o,i),n.setUint32(e+c,a,i)}function kde(n,e,t){return n&e^~n&t}function Fde(n,e,t){return n&e^n&t^e&t}class zde extends GO{constructor(e,t,i,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=i,this.isLE=r,this.buffer=new Uint8Array(e),this.view=_P(this.buffer)}update(e){U0(this),e=u2(e),up(e);const{view:t,buffer:i,blockLen:r}=this,s=e.length;for(let o=0;o<s;){const a=Math.min(r-this.pos,s-o);if(a===r){const l=_P(e);for(;r<=s-o;o+=r)this.process(l,o);continue}i.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){U0(this),lq(e,this),this.finished=!0;const{buffer:t,view:i,blockLen:r,isLE:s}=this;let{pos:o}=this;t[o++]=128,B0(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(i,0),o=0);for(let h=o;h<r;h++)t[h]=0;Bde(i,r-8,BigInt(this.length*8),s),this.process(i,0);const a=_P(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<c;h++)a.setUint32(4*h,u[h],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const i=e.slice(0,t);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:i,length:r,finished:s,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=s,e.length=r,e.pos=a,r%t&&e.buffer.set(i),e}clone(){return this._cloneInto()}}const Tu=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),$b=BigInt(2**32-1),o5=BigInt(32);function Vde(n,e=!1){return e?{h:Number(n&$b),l:Number(n>>o5&$b)}:{h:Number(n>>o5&$b)|0,l:Number(n&$b)|0}}function Hde(n,e=!1){const t=n.length;let i=new Uint32Array(t),r=new Uint32Array(t);for(let s=0;s<t;s++){const{h:o,l:a}=Vde(n[s],e);[i[s],r[s]]=[o,a]}return[i,r]}const $de=(n,e,t)=>n<<t|e>>>32-t,Gde=(n,e,t)=>e<<t|n>>>32-t,jde=(n,e,t)=>e<<t-32|n>>>64-t,Wde=(n,e,t)=>n<<t-32|e>>>64-t,qde=BigInt(0),$y=BigInt(1),Kde=BigInt(2),Xde=BigInt(7),Yde=BigInt(256),Qde=BigInt(113),uq=[],hq=[],fq=[];for(let n=0,e=$y,t=1,i=0;n<24;n++){[t,i]=[i,(2*t+3*i)%5],uq.push(2*(5*i+t)),hq.push((n+1)*(n+2)/2%64);let r=qde;for(let s=0;s<7;s++)e=(e<<$y^(e>>Xde)*Qde)%Yde,e&Kde&&(r^=$y<<($y<<BigInt(s))-$y);fq.push(r)}const dq=Hde(fq,!0),Zde=dq[0],Jde=dq[1],a5=(n,e,t)=>t>32?jde(n,e,t):$de(n,e,t),l5=(n,e,t)=>t>32?Wde(n,e,t):Gde(n,e,t);function epe(n,e=24){const t=new Uint32Array(10);for(let i=24-e;i<24;i++){for(let o=0;o<10;o++)t[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,c=t[l],u=t[l+1],h=a5(c,u,1)^t[a],f=l5(c,u,1)^t[a+1];for(let m=0;m<50;m+=10)n[o+m]^=h,n[o+m+1]^=f}let r=n[2],s=n[3];for(let o=0;o<24;o++){const a=hq[o],l=a5(r,s,a),c=l5(r,s,a),u=uq[o];r=n[u],s=n[u+1],n[u]=l,n[u+1]=c}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)t[a]=n[o+a];for(let a=0;a<10;a++)n[o+a]^=~t[(a+2)%10]&t[(a+4)%10]}n[0]^=Zde[i],n[1]^=Jde[i]}B0(t)}class jO extends GO{constructor(e,t,i,r=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=i,this.enableXOF=r,this.rounds=s,Gw(i),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Ide(this.state)}clone(){return this._cloneInto()}keccak(){s5(this.state32),epe(this.state32,this.rounds),s5(this.state32),this.posOut=0,this.pos=0}update(e){U0(this),e=u2(e),up(e);const{blockLen:t,state:i}=this,r=e.length;for(let s=0;s<r;){const o=Math.min(t-this.pos,r-s);for(let a=0;a<o;a++)i[this.pos++]^=e[s++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:i,blockLen:r}=this;e[i]^=t,t&128&&i===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){U0(this,!1),up(e),this.finish();const t=this.state,{blockLen:i}=this;for(let r=0,s=e.length;r<s;){this.posOut>=i&&this.keccak();const o=Math.min(i-this.posOut,s-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return Gw(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(lq(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,B0(this.state)}_cloneInto(e){const{blockLen:t,suffix:i,outputLen:r,rounds:s,enableXOF:o}=this;return e||(e=new jO(t,i,r,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=i,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}const tpe=(n,e,t)=>cq(()=>new jO(e,n,t)),npe=tpe(1,136,256/8),ipe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Pu=new Uint32Array(64);class rpe extends zde{constructor(e=32){super(64,e,8,!1),this.A=Tu[0]|0,this.B=Tu[1]|0,this.C=Tu[2]|0,this.D=Tu[3]|0,this.E=Tu[4]|0,this.F=Tu[5]|0,this.G=Tu[6]|0,this.H=Tu[7]|0}get(){const{A:e,B:t,C:i,D:r,E:s,F:o,G:a,H:l}=this;return[e,t,i,r,s,o,a,l]}set(e,t,i,r,s,o,a,l){this.A=e|0,this.B=t|0,this.C=i|0,this.D=r|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,t){for(let h=0;h<16;h++,t+=4)Pu[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){const f=Pu[h-15],m=Pu[h-2],g=rl(f,7)^rl(f,18)^f>>>3,v=rl(m,17)^rl(m,19)^m>>>10;Pu[h]=v+Pu[h-7]+g+Pu[h-16]|0}let{A:i,B:r,C:s,D:o,E:a,F:l,G:c,H:u}=this;for(let h=0;h<64;h++){const f=rl(a,6)^rl(a,11)^rl(a,25),m=u+f+kde(a,l,c)+ipe[h]+Pu[h]|0,v=(rl(i,2)^rl(i,13)^rl(i,22))+Fde(i,r,s)|0;u=c,c=l,l=a,a=o+m|0,o=s,s=r,r=i,i=m+v|0}i=i+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(i,r,s,o,a,l,c,u)}roundClean(){B0(Pu)}destroy(){this.set(0,0,0,0,0,0,0,0),B0(this.buffer)}}const spe=cq(()=>new rpe);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const WO=BigInt(0),sR=BigInt(1);function W1(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function qO(n){if(!W1(n))throw new Error("Uint8Array expected")}function jw(n,e){if(typeof e!="boolean")throw new Error(n+" boolean expected, got "+e)}function Gb(n){const e=n.toString(16);return e.length&1?"0"+e:e}function pq(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?WO:BigInt("0x"+n)}const mq=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",ope=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function Ww(n){if(qO(n),mq)return n.toHex();let e="";for(let t=0;t<n.length;t++)e+=ope[n[t]];return e}const Yl={_0:48,_9:57,A:65,F:70,a:97,f:102};function c5(n){if(n>=Yl._0&&n<=Yl._9)return n-Yl._0;if(n>=Yl.A&&n<=Yl.F)return n-(Yl.A-10);if(n>=Yl.a&&n<=Yl.f)return n-(Yl.a-10)}function HS(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(mq)return Uint8Array.fromHex(n);const e=n.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(t);for(let r=0,s=0;r<t;r++,s+=2){const o=c5(n.charCodeAt(s)),a=c5(n.charCodeAt(s+1));if(o===void 0||a===void 0){const l=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}i[r]=o*16+a}return i}function Xd(n){return pq(Ww(n))}function gq(n){return qO(n),pq(Ww(Uint8Array.from(n).reverse()))}function q1(n,e){return HS(n.toString(16).padStart(e*2,"0"))}function yq(n,e){return q1(n,e).reverse()}function jo(n,e,t){let i;if(typeof e=="string")try{i=HS(e)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(W1(e))i=Uint8Array.from(e);else throw new Error(n+" must be hex string or Uint8Array");const r=i.length;if(typeof t=="number"&&r!==t)throw new Error(n+" of length "+t+" expected, got "+r);return i}function $S(...n){let e=0;for(let i=0;i<n.length;i++){const r=n[i];qO(r),e+=r.length}const t=new Uint8Array(e);for(let i=0,r=0;i<n.length;i++){const s=n[i];t.set(s,r),r+=s.length}return t}const EP=n=>typeof n=="bigint"&&WO<=n;function KO(n,e,t){return EP(n)&&EP(e)&&EP(t)&&e<=n&&n<t}function Ag(n,e,t,i){if(!KO(e,t,i))throw new Error("expected valid "+n+": "+t+" <= n < "+i+", got "+e)}function ape(n){let e;for(e=0;n>WO;n>>=sR,e+=1);return e}const h2=n=>(sR<<BigInt(n))-sR,SP=n=>new Uint8Array(n),u5=n=>Uint8Array.from(n);function lpe(n,e,t){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let i=SP(n),r=SP(n),s=0;const o=()=>{i.fill(1),r.fill(0),s=0},a=(...h)=>t(r,i,...h),l=(h=SP(0))=>{r=a(u5([0]),h),i=a(),h.length!==0&&(r=a(u5([1]),h),i=a())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let h=0;const f=[];for(;h<e;){i=a();const m=i.slice();f.push(m),h+=i.length}return $S(...f)};return(h,f)=>{o(),l(h);let m;for(;!(m=f(c()));)l();return o(),m}}const cpe={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||W1(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function f2(n,e,t={}){const i=(r,s,o)=>{const a=cpe[s];if(typeof a!="function")throw new Error("invalid validator function");const l=n[r];if(!(o&&l===void 0)&&!a(l,n))throw new Error("param "+String(r)+" is invalid. Expected "+s+", got "+l)};for(const[r,s]of Object.entries(e))i(r,s,!1);for(const[r,s]of Object.entries(t))i(r,s,!0);return n}function h5(n){const e=new WeakMap;return(t,...i)=>{const r=e.get(t);if(r!==void 0)return r;const s=n(t,...i);return e.set(t,s),s}}function upe(n,e){if(m5(n)>e)throw new Rpe({givenSize:m5(n),maxSize:e})}const Ql={zero:48,nine:57,A:65,F:70,a:97,f:102};function f5(n){if(n>=Ql.zero&&n<=Ql.nine)return n-Ql.zero;if(n>=Ql.A&&n<=Ql.F)return n-(Ql.A-10);if(n>=Ql.a&&n<=Ql.f)return n-(Ql.a-10)}function hpe(n,e={}){const{dir:t,size:i=32}=e;if(i===0)return n;if(n.length>i)throw new Npe({size:n.length,targetSize:i,type:"Bytes"});const r=new Uint8Array(i);for(let s=0;s<i;s++){const o=t==="right";r[o?s:i-s-1]=n[o?s:n.length-s-1]}return r}function vq(n,e){if(Kh(n)>e)throw new bpe({givenSize:Kh(n),maxSize:e})}function fpe(n,e){if(typeof e=="number"&&e>0&&e>Kh(n)-1)throw new bq({offset:e,position:"start",size:Kh(n)})}function dpe(n,e,t){if(typeof e=="number"&&typeof t=="number"&&Kh(n)!==t-e)throw new bq({offset:t,position:"end",size:Kh(n)})}function wq(n,e={}){const{dir:t,size:i=32}=e;if(i===0)return n;const r=n.replace("0x","");if(r.length>i*2)throw new _pe({size:Math.ceil(r.length/2),targetSize:i,type:"Hex"});return`0x${r[t==="right"?"padEnd":"padStart"](i*2,"0")}`}const ppe="#__bigint";function XO(n,e,t){return JSON.stringify(n,(i,r)=>typeof r=="bigint"?r.toString()+ppe:r,t)}const mpe=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function gpe(n,e={}){const{strict:t=!1}=e;if(!n)throw new d5(n);if(typeof n!="string")throw new d5(n);if(t&&!/^0x[0-9a-fA-F]*$/.test(n))throw new p5(n);if(!n.startsWith("0x"))throw new p5(n)}function ype(...n){return`0x${n.reduce((e,t)=>e+t.replace("0x",""),"")}`}function YO(n){return n instanceof Uint8Array?GS(n):Array.isArray(n)?GS(new Uint8Array(n)):n}function GS(n,e={}){let t="";for(let r=0;r<n.length;r++)t+=mpe[n[r]];const i=`0x${t}`;return typeof e.size=="number"?(vq(i,e.size),xq(i,e.size)):i}function AP(n,e={}){const{signed:t,size:i}=e,r=BigInt(n);let s;i?t?s=(1n<<BigInt(i)*8n-1n)-1n:s=2n**(BigInt(i)*8n)-1n:typeof n=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&t?-s-1n:0;if(s&&r>s||r<o){const c=typeof n=="bigint"?"n":"";throw new xpe({max:s?`${s}${c}`:void 0,min:`${o}${c}`,signed:t,size:i,value:`${n}${c}`})}const l=`0x${(t&&r<0?(1n<<BigInt(i*8))+BigInt(r):r).toString(16)}`;return i?vpe(l,i):l}function vpe(n,e){return wq(n,{dir:"left",size:e})}function xq(n,e){return wq(n,{dir:"right",size:e})}function pc(n,e,t,i={}){const{strict:r}=i;fpe(n,e);const s=`0x${n.replace("0x","").slice((e??0)*2,(t??n.length)*2)}`;return r&&dpe(s,e,t),s}function Kh(n){return Math.ceil((n.length-2)/2)}function wpe(n,e={}){const{strict:t=!1}=e;try{return gpe(n,{strict:t}),!0}catch{return!1}}class xpe extends Vn{constructor({max:e,min:t,signed:i,size:r,value:s}){super(`Number \`${s}\` is not in safe${r?` ${r*8}-bit`:""}${i?" signed":" unsigned"} integer range ${e?`(\`${t}\` to \`${e}\`)`:`(above \`${t}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class d5 extends Vn{constructor(e){super(`Value \`${typeof e=="object"?XO(e):e}\` of type \`${typeof e}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class p5 extends Vn{constructor(e){super(`Value \`${e}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}let bpe=class extends Vn{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed \`${t}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}};class bq extends Vn{constructor({offset:e,position:t,size:i}){super(`Slice ${t==="start"?"starting":"ending"} at offset \`${e}\` is out-of-bounds (size: \`${i}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}let _pe=class extends Vn{constructor({size:e,targetSize:t,type:i}){super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}};const Epe=new TextEncoder;function Spe(n){if(!(n instanceof Uint8Array)){if(!n)throw new jb(n);if(typeof n!="object")throw new jb(n);if(!("BYTES_PER_ELEMENT"in n))throw new jb(n);if(n.BYTES_PER_ELEMENT!==1||n.constructor.name!=="Uint8Array")throw new jb(n)}}function Ape(n){return n instanceof Uint8Array?n:typeof n=="string"?Tpe(n):Mpe(n)}function Mpe(n){return n instanceof Uint8Array?n:new Uint8Array(n)}function Tpe(n,e={}){const{size:t}=e;let i=n;t&&(vq(n,t),i=xq(n,t));let r=i.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,o=new Uint8Array(s);for(let a=0,l=0;a<s;a++){const c=f5(r.charCodeAt(l++)),u=f5(r.charCodeAt(l++));if(c===void 0||u===void 0)throw new Vn(`Invalid byte sequence ("${r[l-2]}${r[l-1]}" in "${r}").`);o[a]=c*16+u}return o}function Ppe(n,e={}){const{size:t}=e,i=Epe.encode(n);return typeof t=="number"?(upe(i,t),Cpe(i,t)):i}function Cpe(n,e){return hpe(n,{dir:"right",size:e})}function m5(n){return n.length}function Ipe(n){try{return Spe(n),!0}catch{return!1}}class jb extends Vn{constructor(e){super(`Value \`${typeof e=="object"?XO(e):e}\` of type \`${typeof e}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}class Rpe extends Vn{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed \`${t}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class Npe extends Vn{constructor({size:e,targetSize:t,type:i}){super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}function _q(n,e={}){const{as:t=typeof n=="string"?"Hex":"Bytes"}=e,i=npe(Ape(n));return t==="Bytes"?i:GS(i)}class Dpe extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&t!==void 0&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const i=this.keys().next().value;i&&this.delete(i)}return this}}const Ope={checksum:new Dpe(8192)},MP=Ope.checksum;function Eq(n,e={}){const{compressed:t}=e,{prefix:i,x:r,y:s}=n;if(t===!1||typeof r=="bigint"&&typeof s=="bigint"){if(i!==4)throw new g5({prefix:i,cause:new zpe});return}if(t===!0||typeof r=="bigint"&&typeof s>"u"){if(i!==3&&i!==2)throw new g5({prefix:i,cause:new Fpe});return}throw new kpe({publicKey:n})}function Lpe(n){const e=(()=>{if(wpe(n))return Sq(n);if(Ipe(n))return Upe(n);const{prefix:t,x:i,y:r}=n;return typeof i=="bigint"&&typeof r=="bigint"?{prefix:t??4,x:i,y:r}:{prefix:t,x:i}})();return Eq(e),e}function Upe(n){return Sq(GS(n))}function Sq(n){if(n.length!==132&&n.length!==130&&n.length!==68)throw new Vpe({publicKey:n});if(n.length===130){const i=BigInt(pc(n,0,32)),r=BigInt(pc(n,32,64));return{prefix:4,x:i,y:r}}if(n.length===132){const i=Number(pc(n,0,1)),r=BigInt(pc(n,1,33)),s=BigInt(pc(n,33,65));return{prefix:i,x:r,y:s}}const e=Number(pc(n,0,1)),t=BigInt(pc(n,1,33));return{prefix:e,x:t}}function Bpe(n,e={}){Eq(n);const{prefix:t,x:i,y:r}=n,{includePrefix:s=!0}=e;return ype(s?AP(t,{size:1}):"0x",AP(i,{size:32}),typeof r=="bigint"?AP(r,{size:32}):"0x")}class kpe extends Vn{constructor({publicKey:e}){super(`Value \`${XO(e)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class g5 extends Vn{constructor({prefix:e,cause:t}){super(`Prefix "${e}
179" is invalid.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class Fpe extends Vn{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class zpe extends Vn{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let Vpe=class extends Vn{constructor({publicKey:e}){super(`Value \`${e}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${Kh(YO(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const Hpe=/^0x[a-fA-F0-9]{40}$/;function Aq(n,e={}){const{strict:t=!0}=e;if(!Hpe.test(n))throw new y5({address:n,cause:new jpe});if(t){if(n.toLowerCase()===n)return;if(Mq(n)!==n)throw new y5({address:n,cause:new Wpe})}}function Mq(n){if(MP.has(n))return MP.get(n);Aq(n,{strict:!1});const e=n.substring(2).toLowerCase(),t=_q(Ppe(e),{as:"Bytes"}),i=e.split("");for(let s=0;s<40;s+=2)t[s>>1]>>4>=8&&i[s]&&(i[s]=i[s].toUpperCase()),(t[s>>1]&15)>=8&&i[s+1]&&(i[s+1]=i[s+1].toUpperCase());const r=`0x${i.join("")}`;return MP.set(n,r),r}function $pe(n,e={}){const{checksum:t=!1}=e;return Aq(n),t?Mq(n):n}function Gpe(n,e={}){const t=_q(`0x${Bpe(n).slice(4)}`).substring(26);return $pe(`0x${t}`,e)}class y5 extends Vn{constructor({address:e,cause:t}){super(`Address "${e}" is invalid.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class jpe extends Vn{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class Wpe extends Vn{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}class Tq extends GO{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Cde(e);const i=u2(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,s=new Uint8Array(r);s.set(i.length>r?e.create().update(i).digest():i);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=e.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),B0(s)}update(e){return U0(this),this.iHash.update(e),this}digestInto(e){U0(this),up(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:i,finished:r,destroyed:s,blockLen:o,outputLen:a}=this;return e=e,e.finished=r,e.destroyed=s,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=i._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Pq=(n,e,t)=>new Tq(n,e).update(t).digest();Pq.create=(n,e)=>new Tq(n,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Rs=BigInt(0),os=BigInt(1),pd=BigInt(2),qpe=BigInt(3),Cq=BigInt(4),Iq=BigInt(5),Rq=BigInt(8);function As(n,e){const t=n%e;return t>=Rs?t:e+t}function Bo(n,e,t){let i=n;for(;e-- >Rs;)i*=i,i%=t;return i}function oR(n,e){if(n===Rs)throw new Error("invert: expected non-zero number");if(e<=Rs)throw new Error("invert: expected positive modulus, got "+e);let t=As(n,e),i=e,r=Rs,s=os;for(;t!==Rs;){const a=i/t,l=i%t,c=r-s*a;i=t,t=l,r=s,s=c}if(i!==os)throw new Error("invert: does not exist");return As(r,e)}function Nq(n,e){const t=(n.ORDER+os)/Cq,i=n.pow(e,t);if(!n.eql(n.sqr(i),e))throw new Error("Cannot find square root");return i}
vendor: 55,122 bytes, line 179
179function Kpe(n,e){const t=(n.ORDER-Iq)/Rq,i=n.mul(e,pd),r=n.pow(i,t),s=n.mul(e,r),o=n.mul(n.mul(s,pd),r),a=n.mul(s,n.sub(o,n.ONE));if(!n.eql(n.sqr(a),e))throw new Error("Cannot find square root");return a}function Xpe(n){if(n<BigInt(3))throw new Error("sqrt is not defined for small field");let e=n-os,t=0;for(;e%pd===Rs;)e/=pd,t++;let i=pd;const r=QO(n);for(;v5(r,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(t===1)return Nq;let s=r.pow(i,e);const o=(e+os)/pd;return function(l,c){if(l.is0(c))return c;if(v5(l,c)!==1)throw new Error("Cannot find square root");let u=t,h=l.mul(l.ONE,s),f=l.pow(c,e),m=l.pow(c,o);for(;!l.eql(f,l.ONE);){if(l.is0(f))return l.ZERO;let g=1,v=l.sqr(f);for(;!l.eql(v,l.ONE);)if(g++,v=l.sqr(v),g===u)throw new Error("Cannot find square root");const w=os<<BigInt(u-g-1),y=l.pow(h,w);u=g,h=l.sqr(y),f=l.mul(f,h),m=l.mul(m,y)}return m}}function Ype(n){return n%Cq===qpe?Nq:n%Rq===Iq?Kpe:Xpe(n)}const Qpe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Zpe(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=Qpe.reduce((i,r)=>(i[r]="function",i),e);return f2(n,t)}function Jpe(n,e,t){if(t<Rs)throw new Error("invalid exponent, negatives unsupported");if(t===Rs)return n.ONE;if(t===os)return e;let i=n.ONE,r=e;for(;t>Rs;)t&os&&(i=n.mul(i,r)),r=n.sqr(r),t>>=os;return i}function Dq(n,e,t=!1){const i=new Array(e.length).fill(t?n.ZERO:void 0),r=e.reduce((o,a,l)=>n.is0(a)?o:(i[l]=o,n.mul(o,a)),n.ONE),s=n.inv(r);return e.reduceRight((o,a,l)=>n.is0(a)?o:(i[l]=n.mul(o,i[l]),n.mul(o,a)),s),i}function v5(n,e){const t=(n.ORDER-os)/pd,i=n.pow(e,t),r=n.eql(i,n.ONE),s=n.eql(i,n.ZERO),o=n.eql(i,n.neg(n.ONE));if(!r&&!s&&!o)throw new Error("invalid Legendre symbol result");return r?1:s?0:-1}function Oq(n,e){e!==void 0&&Gw(e);const t=e!==void 0?e:n.toString(2).length,i=Math.ceil(t/8);return{nBitLength:t,nByteLength:i}}function QO(n,e,t=!1,i={}){if(n<=Rs)throw new Error("invalid field: expected ORDER > 0, got "+n);const{nBitLength:r,nByteLength:s}=Oq(n,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:n,isLE:t,BITS:r,BYTES:s,MASK:h2(r),ZERO:Rs,ONE:os,create:l=>As(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof l);return Rs<=l&&l<n},is0:l=>l===Rs,isOdd:l=>(l&os)===os,neg:l=>As(-l,n),eql:(l,c)=>l===c,sqr:l=>As(l*l,n),add:(l,c)=>As(l+c,n),sub:(l,c)=>As(l-c,n),mul:(l,c)=>As(l*c,n),pow:(l,c)=>Jpe(a,l,c),div:(l,c)=>As(l*oR(c,n),n),sqrN:l=>l*l,addN:(l,c)=>l+c,subN:(l,c)=>l-c,mulN:(l,c)=>l*c,inv:l=>oR(l,n),sqrt:i.sqrt||(l=>(o||(o=Ype(n)),o(a,l))),toBytes:l=>t?yq(l,s):q1(l,s),fromBytes:l=>{if(l.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+l.length);return t?gq(l):Xd(l)},invertBatch:l=>Dq(a,l),cmov:(l,c,u)=>u?c:l});return Object.freeze(a)}function Lq(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function Uq(n){const e=Lq(n);return e+Math.ceil(e/2)}function eme(n,e,t=!1){const i=n.length,r=Lq(e),s=Uq(e);if(i<16||i<s||i>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+i);const o=t?gq(n):Xd(n),a=As(o,e-os)+os;return t?yq(a,r):q1(a,r)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const w5=BigInt(0),aR=BigInt(1);function TP(n,e){const t=e.negate();return n?t:e}function Bq(n,e){if(!Number.isSafeInteger(n)||n<=0||n>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+n)}function PP(n,e){Bq(n,e);const t=Math.ceil(e/n)+1,i=2**(n-1),r=2**n,s=h2(n),o=BigInt(n);return{windows:t,windowSize:i,mask:s,maxNumber:r,shiftBy:o}}function x5(n,e,t){const{windowSize:i,mask:r,maxNumber:s,shiftBy:o}=t;let a=Number(n&r),l=n>>o;a>i&&(a-=s,l+=aR);const c=e*i,u=c+Math.abs(a)-1,h=a===0,f=a<0,m=e%2!==0;return{nextN:l,offset:u,isZero:h,isNeg:f,isNegF:m,offsetF:c}}function tme(n,e){if(!Array.isArray(n))throw new Error("array expected");n.forEach((t,i)=>{if(!(t instanceof e))throw new Error("invalid point at index "+i)})}function nme(n,e){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((t,i)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+i)})}const CP=new WeakMap,kq=new WeakMap;function IP(n){return kq.get(n)||1}function ime(n,e){return{constTimeNegate:TP,hasPrecomputes(t){return IP(t)!==1},unsafeLadder(t,i,r=n.ZERO){let s=t;for(;i>w5;)i&aR&&(r=r.add(s)),s=s.double(),i>>=aR;return r},precomputeWindow(t,i){const{windows:r,windowSize:s}=PP(i,e),o=[];let a=t,l=a;for(let c=0;c<r;c++){l=a,o.push(l);for(let u=1;u<s;u++)l=l.add(a),o.push(l);a=l.double()}return o},wNAF(t,i,r){let s=n.ZERO,o=n.BASE;const a=PP(t,e);for(let l=0;l<a.windows;l++){const{nextN:c,offset:u,isZero:h,isNeg:f,isNegF:m,offsetF:g}=x5(r,l,a);r=c,h?o=o.add(TP(m,i[g])):s=s.add(TP(f,i[u]))}return{p:s,f:o}},wNAFUnsafe(t,i,r,s=n.ZERO){const o=PP(t,e);for(let a=0;a<o.windows&&r!==w5;a++){const{nextN:l,offset:c,isZero:u,isNeg:h}=x5(r,a,o);if(r=l,!u){const f=i[c];s=s.add(h?f.negate():f)}}return s},getPrecomputes(t,i,r){let s=CP.get(i);return s||(s=this.precomputeWindow(i,t),t!==1&&CP.set(i,r(s))),s},wNAFCached(t,i,r){const s=IP(t);return this.wNAF(s,this.getPrecomputes(s,t,r),i)},wNAFCachedUnsafe(t,i,r,s){const o=IP(t);return o===1?this.unsafeLadder(t,i,s):this.wNAFUnsafe(o,this.getPrecomputes(o,t,r),i,s)},setWindowSize(t,i){Bq(i,e),kq.set(t,i),CP.delete(t)}}}function rme(n,e,t,i){tme(t,n),nme(i,e);const r=t.length,s=i.length;if(r!==s)throw new Error("arrays of points and scalars must have equal length");const o=n.ZERO,a=ape(BigInt(r));let l=1;a>12?l=a-3:a>4?l=a-2:a>0&&(l=2);const c=h2(l),u=new Array(Number(c)+1).fill(o),h=Math.floor((e.BITS-1)/l)*l;let f=o;for(let m=h;m>=0;m-=l){u.fill(o);for(let v=0;v<s;v++){const w=i[v],y=Number(w>>BigInt(m)&c);u[y]=u[y].add(t[v])}let g=o;for(let v=u.length-1,w=o;v>0;v--)w=w.add(u[v]),g=g.add(w);if(f=f.add(g),m!==0)for(let v=0;v<l;v++)f=f.double()}return f}function Fq(n){return Zpe(n.Fp),f2(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Oq(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function b5(n){n.lowS!==void 0&&jw("lowS",n.lowS),n.prehash!==void 0&&jw("prehash",n.prehash)}function sme(n){const e=Fq(n);f2(e,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:t,Fp:i,a:r}=e;if(t){if(!i.eql(r,i.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...e})}class ome extends Error{constructor(e=""){super(e)}}const vc={Err:ome,_tlv:{encode:(n,e)=>{const{Err:t}=vc;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");const i=e.length/2,r=Gb(i);if(r.length/2&128)throw new t("tlv.encode: long form length too big");const s=i>127?Gb(r.length/2|128):"";return Gb(n)+s+r+e},decode(n,e){const{Err:t}=vc;let i=0;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[i++]!==n)throw new t("tlv.decode: wrong tlv");const r=e[i++],s=!!(r&128);let o=0;if(!s)o=r;else{const l=r&127;if(!l)throw new t("tlv.decode(long): indefinite length not supported");if(l>4)throw new t("tlv.decode(long): byte length is too big");const c=e.subarray(i,i+l);if(c.length!==l)throw new t("tlv.decode: length bytes not complete");if(c[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(const u of c)o=o<<8|u;if(i+=l,o<128)throw new t("tlv.decode(long): not minimal encoding")}const a=e.subarray(i,i+o);if(a.length!==o)throw new t("tlv.decode: wrong value length");return{v:a,l:e.subarray(i+o)}}},_int:{encode(n){const{Err:e}=vc;if(n<Nc)throw new e("integer: negative integers are not allowed");let t=Gb(n);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(n){const{Err:e}=vc;if(n[0]&128)throw new e("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return Xd(n)}},toSig(n){const{Err:e,_int:t,_tlv:i}=vc,r=jo("signature",n),{v:s,l:o}=i.decode(48,r);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l}=i.decode(2,s),{v:c,l:u}=i.decode(2,l);if(u.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(a),s:t.decode(c)}},hexFromSig(n){const{_tlv:e,_int:t}=vc,i=e.encode(2,t.encode(n.r)),r=e.encode(2,t.encode(n.s)),s=i+r;return e.encode(48,s)}};function RP(n,e){return Ww(q1(n,e))}const Nc=BigInt(0),Gi=BigInt(1);BigInt(2);const NP=BigInt(3),ame=BigInt(4);function lme(n){const e=sme(n),{Fp:t}=e,i=QO(e.n,e.nBitLength),r=e.toBytes||((x,S,M)=>{const A=S.toAffine();return $S(Uint8Array.from([4]),t.toBytes(A.x),t.toBytes(A.y))}),s=e.fromBytes||(x=>{const S=x.subarray(1),M=t.fromBytes(S.subarray(0,t.BYTES)),A=t.fromBytes(S.subarray(t.BYTES,2*t.BYTES));return{x:M,y:A}});function o(x){const{a:S,b:M}=e,A=t.sqr(x),I=t.mul(A,x);return t.add(t.add(I,t.mul(x,S)),M)}function a(x,S){const M=t.sqr(S),A=o(x);return t.eql(M,A)}if(!a(e.Gx,e.Gy))throw new Error("bad curve params: generator point");const l=t.mul(t.pow(e.a,NP),ame),c=t.mul(t.sqr(e.b),BigInt(27));if(t.is0(t.add(l,c)))throw new Error("bad curve params: a or b");function u(x){return KO(x,Gi,e.n)}function h(x){const{allowedPrivateKeyLengths:S,nByteLength:M,wrapPrivateKey:A,n:I}=e;if(S&&typeof x!="bigint"){if(W1(x)&&(x=Ww(x)),typeof x!="string"||!S.includes(x.length))throw new Error("invalid private key");x=x.padStart(M*2,"0")}let D;try{D=typeof x=="bigint"?x:Xd(jo("private key",x,M))}catch{throw new Error("invalid private key, expected hex or "+M+" bytes, got "+typeof x)}return A&&(D=As(D,I)),Ag("private key",D,Gi,I),D}function f(x){if(!(x instanceof v))throw new Error("ProjectivePoint expected")}const m=h5((x,S)=>{const{px:M,py:A,pz:I}=x;if(t.eql(I,t.ONE))return{x:M,y:A};const D=x.is0();S==null&&(S=D?t.ONE:t.inv(I));const k=t.mul(M,S),C=t.mul(A,S),U=t.mul(I,S);if(D)return{x:t.ZERO,y:t.ZERO};if(!t.eql(U,t.ONE))throw new Error("invZ was invalid");return{x:k,y:C}}),g=h5(x=>{if(x.is0()){if(e.allowInfinityPoint&&!t.is0(x.py))return;throw new Error("bad point: ZERO")}const{x:S,y:M}=x.toAffine();if(!t.isValid(S)||!t.isValid(M))throw new Error("bad point: x or y not FE");if(!a(S,M))throw new Error("bad point: equation left != right");if(!x.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class v{constructor(S,M,A){if(S==null||!t.isValid(S))throw new Error("x required");if(M==null||!t.isValid(M)||t.is0(M))throw new Error("y required");if(A==null||!t.isValid(A))throw new Error("z required");this.px=S,this.py=M,this.pz=A,Object.freeze(this)}static fromAffine(S){const{x:M,y:A}=S||{};if(!S||!t.isValid(M)||!t.isValid(A))throw new Error("invalid affine point");if(S instanceof v)throw new Error("projective point not allowed");const I=D=>t.eql(D,t.ZERO);return I(M)&&I(A)?v.ZERO:new v(M,A,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(S){const M=Dq(t,S.map(A=>A.pz));return S.map((A,I)=>A.toAffine(M[I])).map(v.fromAffine)}static fromHex(S){const M=v.fromAffine(s(jo("pointHex",S)));return M.assertValidity(),M}static fromPrivateKey(S){return v.BASE.multiply(h(S))}static msm(S,M){return rme(v,i,S,M)}_setWindowSize(S){_.setWindowSize(this,S)}assertValidity(){g(this)}hasEvenY(){const{y:S}=this.toAffine();if(t.isOdd)return!t.isOdd(S);throw new Error("Field doesn't support isOdd")}equals(S){f(S);const{px:M,py:A,pz:I}=this,{px:D,py:k,pz:C}=S,U=t.eql(t.mul(M,C),t.mul(D,I)),G=t.eql(t.mul(A,C),t.mul(k,I));return U&&G}negate(){return new v(this.px,t.neg(this.py),this.pz)}double(){const{a:S,b:M}=e,A=t.mul(M,NP),{px:I,py:D,pz:k}=this;let C=t.ZERO,U=t.ZERO,G=t.ZERO,H=t.mul(I,I),z=t.mul(D,D),P=t.mul(k,k),R=t.mul(I,D);return R=t.add(R,R),G=t.mul(I,k),G=t.add(G,G),C=t.mul(S,G),U=t.mul(A,P),U=t.add(C,U),C=t.sub(z,U),U=t.add(z,U),U=t.mul(C,U),C=t.mul(R,C),G=t.mul(A,G),P=t.mul(S,P),R=t.sub(H,P),R=t.mul(S,R),R=t.add(R,G),G=t.add(H,H),H=t.add(G,H),H=t.add(H,P),H=t.mul(H,R),U=t.add(U,H),P=t.mul(D,k),P=t.add(P,P),H=t.mul(P,R),C=t.sub(C,H),G=t.mul(P,z),G=t.add(G,G),G=t.add(G,G),new v(C,U,G)}add(S){f(S);const{px:M,py:A,pz:I}=this,{px:D,py:k,pz:C}=S;let U=t.ZERO,G=t.ZERO,H=t.ZERO;const z=e.a,P=t.mul(e.b,NP);let R=t.mul(M,D),F=t.mul(A,k),N=t.mul(I,C),O=t.add(M,A),B=t.add(D,k);O=t.mul(O,B),B=t.add(R,F),O=t.sub(O,B),B=t.add(M,I);let W=t.add(D,C);return B=t.mul(B,W),W=t.add(R,N),B=t.sub(B,W),W=t.add(A,I),U=t.add(k,C),W=t.mul(W,U),U=t.add(F,N),W=t.sub(W,U),H=t.mul(z,B),U=t.mul(P,N),H=t.add(U,H),U=t.sub(F,H),H=t.add(F,H),G=t.mul(U,H),F=t.add(R,R),F=t.add(F,R),N=t.mul(z,N),B=t.mul(P,B),F=t.add(F,N),N=t.sub(R,N),N=t.mul(z,N),B=t.add(B,N),R=t.mul(F,B),G=t.add(G,R),R=t.mul(W,B),U=t.mul(O,U),U=t.sub(U,R),R=t.mul(O,F),H=t.mul(W,H),H=t.add(H,R),new v(U,G,H)}subtract(S){return this.add(S.negate())}is0(){return this.equals(v.ZERO)}wNAF(S){return _.wNAFCached(this,S,v.normalizeZ)}multiplyUnsafe(S){const{endo:M,n:A}=e;Ag("scalar",S,Nc,A);const I=v.ZERO;if(S===Nc)return I;if(this.is0()||S===Gi)return this;if(!M||_.hasPrecomputes(this))return _.wNAFCachedUnsafe(this,S,v.normalizeZ);let{k1neg:D,k1:k,k2neg:C,k2:U}=M.splitScalar(S),G=I,H=I,z=this;for(;k>Nc||U>Nc;)k&Gi&&(G=G.add(z)),U&Gi&&(H=H.add(z)),z=z.double(),k>>=Gi,U>>=Gi;return D&&(G=G.negate()),C&&(H=H.negate()),H=new v(t.mul(H.px,M.beta),H.py,H.pz),G.add(H)}multiply(S){const{endo:M,n:A}=e;Ag("scalar",S,Gi,A);let I,D;if(M){const{k1neg:k,k1:C,k2neg:U,k2:G}=M.splitScalar(S);let{p:H,f:z}=this.wNAF(C),{p:P,f:R}=this.wNAF(G);H=_.constTimeNegate(k,H),P=_.constTimeNegate(U,P),P=new v(t.mul(P.px,M.beta),P.py,P.pz),I=H.add(P),D=z.add(R)}else{const{p:k,f:C}=this.wNAF(S);I=k,D=C}return v.normalizeZ([I,D])[0]}multiplyAndAddUnsafe(S,M,A){const I=v.BASE,D=(C,U)=>U===Nc||U===Gi||!C.equals(I)?C.multiplyUnsafe(U):C.multiply(U),k=D(this,M).add(D(S,A));return k.is0()?void 0:k}toAffine(S){return m(this,S)}isTorsionFree(){const{h:S,isTorsionFree:M}=e;if(S===Gi)return!0;if(M)return M(v,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:S,clearCofactor:M}=e;return S===Gi?this:M?M(v,this):this.multiplyUnsafe(e.h)}toRawBytes(S=!0){return jw("isCompressed",S),this.assertValidity(),r(v,this,S)}toHex(S=!0){return jw("isCompressed",S),Ww(this.toRawBytes(S))}}v.BASE=new v(e.Gx,e.Gy,t.ONE),v.ZERO=new v(t.ZERO,t.ONE,t.ZERO);const{endo:w,nBitLength:y}=e,_=ime(v,w?Math.ceil(y/2):y);return{CURVE:e,ProjectivePoint:v,normPrivateKeyToScalar:h,weierstrassEquation:o,isWithinCurveOrder:u}}function cme(n){const e=Fq(n);return f2(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function ume(n){const e=cme(n),{Fp:t,n:i,nByteLength:r,nBitLength:s}=e,o=t.BYTES+1,a=2*t.BYTES+1;function l(P){return As(P,i)}function c(P){return oR(P,i)}const{ProjectivePoint:u,normPrivateKeyToScalar:h,weierstrassEquation:f,isWithinCurveOrder:m}=lme({...e,toBytes(P,R,F){const N=R.toAffine(),O=t.toBytes(N.x),B=$S;return jw("isCompressed",F),F?B(Uint8Array.from([R.hasEvenY()?2:3]),O):B(Uint8Array.from([4]),O,t.toBytes(N.y))},fromBytes(P){const R=P.length,F=P[0],N=P.subarray(1);if(R===o&&(F===2||F===3)){const O=Xd(N);if(!KO(O,Gi,t.ORDER))throw new Error("Point is not on curve");const B=f(O);let W;try{W=t.sqrt(B)}catch(Y){const te=Y instanceof Error?": "+Y.message:"";throw new Error("Point is not on curve"+te)}const Q=(W&Gi)===Gi;return(F&1)===1!==Q&&(W=t.neg(W)),{x:O,y:W}}else if(R===a&&F===4){const O=t.fromBytes(N.subarray(0,t.BYTES)),B=t.fromBytes(N.subarray(t.BYTES,2*t.BYTES));return{x:O,y:B}}else{const O=o,B=a;throw new Error("invalid Point, expected length of "+O+", or uncompressed "+B+", got "+R)}}});function g(P){const R=i>>Gi;return P>R}function v(P){return g(P)?l(-P):P}const w=(P,R,F)=>Xd(P.slice(R,F));class y{constructor(R,F,N){Ag("r",R,Gi,i),Ag("s",F,Gi,i),this.r=R,this.s=F,N!=null&&(this.recovery=N),Object.freeze(this)}static fromCompact(R){const F=r;return R=jo("compactSignature",R,F*2),new y(w(R,0,F),w(R,F,2*F))}static fromDER(R){const{r:F,s:N}=vc.toSig(jo("DER",R));return new y(F,N)}assertValidity(){}addRecoveryBit(R){return new y(this.r,this.s,R)}recoverPublicKey(R){const{r:F,s:N,recovery:O}=this,B=I(jo("msgHash",R));if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");const W=O===2||O===3?F+e.n:F;if(W>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const Q=O&1?"03":"02",oe=u.fromHex(Q+RP(W,t.BYTES)),Y=c(W),te=l(-B*Y),le=l(N*Y),ve=u.BASE.multiplyAndAddUnsafe(oe,te,le);if(!ve)throw new Error("point at infinify");return ve.assertValidity(),ve}hasHighS(){return g(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,l(-this.s),this.recovery):this}toDERRawBytes(){return HS(this.toDERHex())}toDERHex(){return vc.hexFromSig(this)}toCompactRawBytes(){return HS(this.toCompactHex())}toCompactHex(){const R=r;return RP(this.r,R)+RP(this.s,R)}}const _={isValidPrivateKey(P){try{return h(P),!0}catch{return!1}},normPrivateKeyToScalar:h,randomPrivateKey:()=>{const P=Uq(e.n);return eme(e.randomBytes(P),e.n)},precompute(P=8,R=u.BASE){return R._setWindowSize(P),R.multiply(BigInt(3)),R}};function x(P,R=!0){return u.fromPrivateKey(P).toRawBytes(R)}function S(P){if(typeof P=="bigint")return!1;if(P instanceof u)return!0;const F=jo("key",P).length,N=t.BYTES,O=N+1,B=2*N+1;if(!(e.allowedPrivateKeyLengths||r===O))return F===O||F===B}function M(P,R,F=!0){if(S(P)===!0)throw new Error("first arg must be private key");if(S(R)===!1)throw new Error("second arg must be public key");return u.fromHex(R).multiply(h(P)).toRawBytes(F)}const A=e.bits2int||function(P){if(P.length>8192)throw new Error("input is too large");const R=Xd(P),F=P.length*8-s;return F>0?R>>BigInt(F):R},I=e.bits2int_modN||function(P){return l(A(P))},D=h2(s);function k(P){return Ag("num < 2^"+s,P,Nc,D),q1(P,r)}function C(P,R,F=U){if(["recovered","canonical"].some(be=>be in F))throw new Error("sign() legacy options not supported");const{hash:N,randomBytes:O}=e;let{lowS:B,prehash:W,extraEntropy:Q}=F;B==null&&(B=!0),P=jo("msgHash",P),b5(F),W&&(P=jo("prehashed msgHash",N(P)));const oe=I(P),Y=h(R),te=[k(Y),k(oe)];if(Q!=null&&Q!==!1){const be=Q===!0?O(t.BYTES):Q;te.push(jo("extraEntropy",be))}const le=$S(...te),ve=oe;function Te(be){const Le=A(be);if(!m(Le))return;const Oe=c(Le),J=u.BASE.multiply(Le).toAffine(),Se=l(J.x);if(Se===Nc)return;const me=l(Oe*l(ve+Se*Y));if(me===Nc)return;let Re=(J.x===Se?0:2)|Number(J.y&Gi),Ae=me;return B&&g(me)&&(Ae=v(me),Re^=1),new y(Se,Ae,Re)}return{seed:le,k2sig:Te}}const U={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function H(P,R,F=U){const{seed:N,k2sig:O}=C(P,R,F),B=e;return lpe(B.hash.outputLen,B.nByteLength,B.hmac)(N,O)}u.BASE._setWindowSize(8);function z(P,R,F,N=G){var Re;const O=P;R=jo("msgHash",R),F=jo("publicKey",F);const{lowS:B,prehash:W,format:Q}=N;if(b5(N),"strict"in N)throw new Error("options.strict was renamed to lowS");if(Q!==void 0&&Q!=="compact"&&Q!=="der")throw new Error("format must be compact or der");const oe=typeof O=="string"||W1(O),Y=!oe&&!Q&&typeof O=="object"&&O!==null&&typeof O.r=="bigint"&&typeof O.s=="bigint";if(!oe&&!Y)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let te,le;try{if(Y&&(te=new y(O.r,O.s)),oe){try{Q!=="compact"&&(te=y.fromDER(O))}catch(Ae){if(!(Ae instanceof vc.Err))throw Ae}!te&&Q!=="der"&&(te=y.fromCompact(O))}le=u.fromHex(F)}catch{return!1}if(!te||B&&te.hasHighS())return!1;W&&(R=e.hash(R));const{r:ve,s:Te}=te,be=I(R),Le=c(Te),Oe=l(be*Le),J=l(ve*Le),Se=(Re=u.BASE.multiplyAndAddUnsafe(le,Oe,J))==null?void 0:Re.toAffine();return Se?l(Se.x)===ve:!1}return{CURVE:e,getPublicKey:x,getSharedSecret:M,sign:H,verify:z,ProjectivePoint:u,Signature:y,utils:_}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function hme(n){return{hash:n,hmac:(e,...t)=>Pq(n,e,Lde(...t)),randomBytes:Ude}}function fme(n,e){const t=i=>ume({...n,...hme(i)});return{...t(e),create:t}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const zq=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),_5=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),dme=BigInt(0),pme=BigInt(1),lR=BigInt(2),E5=(n,e)=>(n+e/lR)/e;function mme(n){const e=zq,t=BigInt(3),i=BigInt(6),r=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),c=n*n*n%e,u=c*c*n%e,h=Bo(u,t,e)*u%e,f=Bo(h,t,e)*u%e,m=Bo(f,lR,e)*c%e,g=Bo(m,r,e)*m%e,v=Bo(g,s,e)*g%e,w=Bo(v,a,e)*v%e,y=Bo(w,l,e)*w%e,_=Bo(y,a,e)*v%e,x=Bo(_,t,e)*u%e,S=Bo(x,o,e)*g%e,M=Bo(S,i,e)*c%e,A=Bo(M,lR,e);if(!cR.eql(cR.sqr(A),n))throw new Error("Cannot find square root");return A}const cR=QO(zq,void 0,void 0,{sqrt:mme}),gme=fme({a:dme,b:BigInt(7),Fp:cR,n:_5,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=_5,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),i=-pme*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),r=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=t,o=BigInt("0x100000000000000000000000000000000"),a=E5(s*n,e),l=E5(-i*n,e);let c=As(n-a*t-l*r,e),u=As(-a*i-l*s,e);const h=c>o,f=u>o;if(h&&(c=e-c),f&&(u=e-u),c>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:h,k1:c,k2neg:f,k2:u}}}},spe);function yme(n){if(n.length!==130&&n.length!==132)throw new wme({signature:n});const e=BigInt(pc(n,0,32)),t=BigInt(pc(n,32,64)),i=(()=>{const r=+`0x${n.slice(130)}`;if(!Number.isNaN(r))try{return vme(r)}catch{throw new xme({value:r})}})();return typeof i>"u"?{r:e,s:t}:{r:e,s:t,yParity:i}}function vme(n){if(n===0||n===27)return 0;if(n===1||n===28)return 1;if(n>=35)return n%2===0?1:0;throw new bme({value:n})}class wme extends Vn{constructor({signature:e}){super(`Value \`${e}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${Kh(YO(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class xme extends Vn{constructor({value:e}){super(`Value \`${e}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class bme extends Vn{constructor({value:e}){super(`Value \`${e}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function _me(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Vq(n,e){return Array.isArray(e)?e.length===0?!0:n?e.every(t=>typeof t=="string"):e.every(t=>Number.isSafeInteger(t)):!1}function jS(n,e){if(typeof e!="string")throw new Error(`${n}: string expected`);return!0}function ZO(n){if(!Number.isSafeInteger(n))throw new Error(`invalid integer: ${n}`)}function uR(n){if(!Array.isArray(n))throw new Error("array expected")}function WS(n,e){if(!Vq(!0,e))throw new Error(`${n}: array of strings expected`)}function Eme(n,e){if(!Vq(!1,e))throw new Error(`${n}: array of numbers expected`)}function Sme(...n){const e=s=>s,t=(s,o)=>a=>s(o(a)),i=n.map(s=>s.encode).reduceRight(t,e),r=n.map(s=>s.decode).reduce(t,e);return{encode:i,decode:r}}function Ame(n){const e=typeof n=="string"?n.split(""):n,t=e.length;WS("alphabet",e);const i=new Map(e.map((r,s)=>[r,s]));return{encode:r=>(uR(r),r.map(s=>{if(!Number.isSafeInteger(s)||s<0||s>=t)throw new Error(`alphabet.encode: digit index outside alphabet "${s}". Allowed: ${n}`);return e[s]})),decode:r=>(uR(r),r.map(s=>{jS("alphabet.decode",s);const o=i.get(s);if(o===void 0)throw new Error(`Unknown letter: "${s}". Allowed: ${n}`);return o}))}}function Mme(n=""){return jS("join",n),{encode:e=>(WS("join.decode",e),e.join(n)),decode:e=>(jS("join.decode",e),e.split(n))}}function Tme(n,e="="){return ZO(n),jS("padding",e),{encode(t){for(WS("padding.encode",t);t.length*n%8;)t.push(e);return t},decode(t){WS("padding.decode",t);let i=t.length;if(i*n%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;i>0&&t[i-1]===e;i--)if((i-1)*n%8===0)throw new Error("padding: invalid, string has too much padding");return t.slice(0,i)}}}const Hq=(n,e)=>e===0?n:Hq(e,n%e),qS=(n,e)=>n+(e-Hq(n,e)),DP=(()=>{let n=[];for(let e=0;e<40;e++)n.push(2**e);return n})();function S5(n,e,t,i){if(uR(n),e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(t<=0||t>32)throw new Error(`convertRadix2: wrong to=${t}`);if(qS(e,t)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${t} carryBits=${qS(e,t)}`);let r=0,s=0;const o=DP[e],a=DP[t]-1,l=[];for(const c of n){if(ZO(c),c>=o)throw new Error(`convertRadix2: invalid data word=${c} from=${e}`);if(r=r<<e|c,s+e>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${e}`);for(s+=e;s>=t;s-=t)l.push((r>>s-t&a)>>>0);const u=DP[s];if(u===void 0)throw new Error("invalid carry");r&=u-1}if(r=r<<t-s&a,!i&&s>=e)throw new Error("Excess padding");if(!i&&r>0)throw new Error(`Non-zero padding: ${r}`);return i&&s>0&&l.push(r>>>0),l}function Pme(n,e=!1){if(ZO(n),n<=0||n>32)throw new Error("radix2: bits should be in (0..32]");if(qS(8,n)>32||qS(n,8)>32)throw new Error("radix2: carry overflow");return{encode:t=>{if(!_me(t))throw new Error("radix2.encode input should be Uint8Array");return S5(Array.from(t),8,n,!e)},decode:t=>(Eme("radix2.decode",t),Uint8Array.from(S5(t,n,8,e)))}}const Cme=Sme(Pme(5),Ame("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Tme(5),Mme(""));function Ime(n){return Gpe(Rme(n))}function Rme(n){const{payload:e,signature:t}=n,{r:i,s:r,yParity:s}=t,a=new gme.Signature(BigInt(i),BigInt(r)).addRecoveryBit(s).recoverPublicKey(YO(e).substring(2));return Lpe(a)}function Nme(n){if(n.length>=255)throw new TypeError("Alphabet too long");const e=new Uint8Array(256);for(let c=0;c<e.length;c++)e[c]=255;for(let c=0;c<n.length;c++){const u=n.charAt(c),h=u.charCodeAt(0);if(e[h]!==255)throw new TypeError(u+" is ambiguous");e[h]=c}const t=n.length,i=n.charAt(0),r=Math.log(t)/Math.log(256),s=Math.log(256)/Math.log(t);function o(c){if(c instanceof Uint8Array||(ArrayBuffer.isView(c)?c=new Uint8Array(c.buffer,c.byteOffset,c.byteLength):Array.isArray(c)&&(c=Uint8Array.from(c))),!(c instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(c.length===0)return"";let u=0,h=0,f=0;const m=c.length;for(;f!==m&&c[f]===0;)f++,u++;const g=(m-f)*s+1>>>0,v=new Uint8Array(g);for(;f!==m;){let _=c[f],x=0;for(let S=g-1;(_!==0||x<h)&&S!==-1;S--,x++)_+=256*v[S]>>>0,v[S]=_%t>>>0,_=_/t>>>0;if(_!==0)throw new Error("Non-zero carry");h=x,f++}let w=g-h;for(;w!==g&&v[w]===0;)w++;let y=i.repeat(u);for(;w<g;++w)y+=n.charAt(v[w]);return y}function a(c){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;let u=0,h=0,f=0;for(;c[u]===i;)h++,u++;const m=(c.length-u)*r+1>>>0,g=new Uint8Array(m);for(;u<c.length;){const _=c.charCodeAt(u);if(_>255)return;let x=e[_];if(x===255)return;let S=0;for(let M=m-1;(x!==0||S<f)&&M!==-1;M--,S++)x+=t*g[M]>>>0,g[M]=x%256>>>0,x=x/256>>>0;if(x!==0)throw new Error("Non-zero carry");f=S,u++}let v=m-f;for(;v!==m&&g[v]===0;)v++;const w=new Uint8Array(h+(m-v));let y=h;for(;v!==m;)w[y++]=g[v++];return w}function l(c){const u=a(c);if(u)return u;throw new Error("Non-base"+t+" character")}return{encode:o,decodeUnsafe:a,decode:l}}var Dme="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const K1=Nme(Dme);function Ome(n){const e=n.length;let t=0,i=0;for(;i<e;){let r=n.charCodeAt(i++);if(r&4294967168)if(!(r&4294965248))t+=2;else{if(r>=55296&&r<=56319&&i<e){const s=n.charCodeAt(i);(s&64512)===56320&&(++i,r=((r&1023)<<10)+(s&1023)+65536)}r&4294901760?t+=4:t+=3}else{t++;continue}}return t}function Lme(n,e,t){const i=n.length;let r=t,s=0;for(;s<i;){let o=n.charCodeAt(s++);if(o&4294967168)if(!(o&4294965248))e[r++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<i){const a=n.charCodeAt(s);(a&64512)===56320&&(++s,o=((o&1023)<<10)+(a&1023)+65536)}o&4294901760?(e[r++]=o>>18&7|240,e[r++]=o>>12&63|128,e[r++]=o>>6&63|128):(e[r++]=o>>12&15|224,e[r++]=o>>6&63|128)}else{e[r++]=o;continue}e[r++]=o&63|128}}const Ume=new TextEncoder,Bme=50;function kme(n,e,t){Ume.encodeInto(n,e.subarray(t))}function Fme(n,e,t){n.length>Bme?kme(n,e,t):Lme(n,e,t)}const zme=4096;function $q(n,e,t){let i=e;const r=i+t,s=[];let o="";for(;i<r;){const a=n[i++];if(!(a&128))s.push(a);else if((a&224)===192){const l=n[i++]&63;s.push((a&31)<<6|l)}else if((a&240)===224){const l=n[i++]&63,c=n[i++]&63;s.push((a&31)<<12|l<<6|c)}else if((a&248)===240){const l=n[i++]&63,c=n[i++]&63,u=n[i++]&63;let h=(a&7)<<18|l<<12|c<<6|u;h>65535&&(h-=65536,s.push(h>>>10&1023|55296),h=56320|h&1023),s.push(h)}else s.push(a);s.length>=zme&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const Vme=new TextDecoder,Hme=200;function $me(n,e,t){const i=n.subarray(e,e+t);return Vme.decode(i)}function Gme(n,e,t){return t>Hme?$me(n,e,t):$q(n,e,t)}class Wb{constructor(e,t){this.type=e,this.data=t}}class ao extends Error{constructor(e){super(e);const t=Object.create(ao.prototype);Object.setPrototypeOf(this,t),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:ao.name})}}const Gy=4294967295;function jme(n,e,t){const i=t/4294967296,r=t;n.setUint32(e,i),n.setUint32(e+4,r)}function Gq(n,e,t){const i=Math.floor(t/4294967296),r=t;n.setUint32(e,i),n.setUint32(e+4,r)}function jq(n,e){const t=n.getInt32(e),i=n.getUint32(e+4);return t*4294967296+i}function Wme(n,e){const t=n.getUint32(e),i=n.getUint32(e+4);return t*4294967296+i}const qme=-1,Kme=4294967296-1,Xme=17179869184-1;function Yme({sec:n,nsec:e}){if(n>=0&&e>=0&&n<=Xme)if(e===0&&n<=Kme){const t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,n),t}else{const t=n/4294967296,i=n&4294967295,r=new Uint8Array(8),s=new DataView(r.buffer);return s.setUint32(0,e<<2|t&3),s.setUint32(4,i),r}else{const t=new Uint8Array(12),i=new DataView(t.buffer);return i.setUint32(0,e),Gq(i,4,n),t}}function Qme(n){const e=n.getTime(),t=Math.floor(e/1e3),i=(e-t*1e3)*1e6,r=Math.floor(i/1e9);return{sec:t+r,nsec:i-r*1e9}}function Zme(n){if(n instanceof Date){const e=Qme(n);return Yme(e)}else return null}function Jme(n){const e=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(n.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const t=e.getUint32(0),i=e.getUint32(4),r=(t&3)*4294967296+i,s=t>>>2;return{sec:r,nsec:s}}case 12:{const t=jq(e,4),i=e.getUint32(0);return{sec:t,nsec:i}}default:throw new ao(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${n.length}`)}}function ege(n){const e=Jme(n);return new Date(e.sec*1e3+e.nsec/1e6)}const tge={type:qme,encode:Zme,decode:ege};class KS{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(tge)}register({type:e,encode:t,decode:i}){if(e>=0)this.encoders[e]=t,this.decoders[e]=i;else{const r=-1-e;this.builtInEncoders[r]=t,this.builtInDecoders[r]=i}}tryToEncode(e,t){for(let i=0;i<this.builtInEncoders.length;i++){const r=this.builtInEncoders[i];if(r!=null){const s=r(e,t);if(s!=null){const o=-1-i;return new Wb(o,s)}}}for(let i=0;i<this.encoders.length;i++){const r=this.encoders[i];if(r!=null){const s=r(e,t);if(s!=null){const o=i;return new Wb(o,s)}}}return e instanceof Wb?e:null}decode(e,t,i){const r=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return r?r(e,t,i):new Wb(t,e)}}KS.defaultCodec=new KS;function nge(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function hR(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):nge(n)?new Uint8Array(n):Uint8Array.from(n)}const ige=100,rge=2048;let sge=class Wq{constructor(e){this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??KS.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.maxDepth=(e==null?void 0:e.maxDepth)??ige,this.initialBufferSize=(e==null?void 0:e.initialBufferSize)??rge,this.sortKeys=(e==null?void 0:e.sortKeys)??!1,this.forceFloat32=(e==null?void 0:e.forceFloat32)??!1,this.ignoreUndefined=(e==null?void 0:e.ignoreUndefined)??!1,this.forceIntegerToFloat=(e==null?void 0:e.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new Wq({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,t){if(t>this.maxDepth)throw new Error(`Too deep objects in depth ${t}`);e==null?this.encodeNil():typeof e=="boolean"?this.encodeBoolean(e):typeof e=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):typeof e=="string"?this.encodeString(e):this.useBigInt64&&typeof e=="bigint"?this.encodeBigInt64(e):this.encodeObject(e,t)}ensureBufferSizeToWrite(e){const t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(t*2)}resizeBuffer(e){const t=new ArrayBuffer(e),i=new Uint8Array(t),r=new DataView(t);i.set(this.bytes),this.view=r,this.bytes=i}encodeNil(){this.writeU8(192)}encodeBoolean(e){e===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw new Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){const i=Ome(e);this.ensureBufferSizeToWrite(5+i),this.writeStringHeader(i),Fme(e,this.bytes,this.pos),this.pos+=i}encodeObject(e,t){const i=this.extensionCodec.tryToEncode(e,this.context);if(i!=null)this.encodeExtension(i);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if(typeof e=="object")this.encodeMap(e,t);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){const t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw new Error(`Too large binary: ${t}`);const i=hR(e);this.writeU8a(i)}encodeArray(e,t){const i=e.length;if(i<16)this.writeU8(144+i);else if(i<65536)this.writeU8(220),this.writeU16(i);else if(i<4294967296)this.writeU8(221),this.writeU32(i);else throw new Error(`Too large array: ${i}`);for(const r of e)this.doEncode(r,t+1)}countWithoutUndefined(e,t){let i=0;for(const r of t)e[r]!==void 0&&i++;return i}encodeMap(e,t){const i=Object.keys(e);this.sortKeys&&i.sort();const r=this.ignoreUndefined?this.countWithoutUndefined(e,i):i.length;if(r<16)this.writeU8(128+r);else if(r<65536)this.writeU8(222),this.writeU16(r);else if(r<4294967296)this.writeU8(223),this.writeU32(r);else throw new Error(`Too large map object: ${r}`);for(const s of i){const o=e[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,t+1))}}encodeExtension(e){if(typeof e.data=="function"){const i=e.data(this.pos+6),r=i.length;if(r>=4294967296)throw new Error(`Too large extension object: ${r}`);this.writeU8(201),this.writeU32(r),this.writeI8(e.type),this.writeU8a(i);return}const t=e.data.length;if(t===1)this.writeU8(212);else if(t===2)this.writeU8(213);else if(t===4)this.writeU8(214);else if(t===8)this.writeU8(215);else if(t===16)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw new Error(`Too large extension object: ${t}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),jme(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),Gq(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}};function oge(n,e){return new sge(e).encodeSharedRef(n)}function OP(n){return`${n<0?"-":""}0x${Math.abs(n).toString(16).padStart(2,"0")}`}const age=16,lge=16;class cge{constructor(e=age,t=lge){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=t,this.caches=[];for(let i=0;i<this.maxKeyLength;i++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,t,i){const r=this.caches[i-1];e:for(const s of r){const o=s.bytes;for(let a=0;a<i;a++)if(o[a]!==e[t+a])continue e;return s.str}return null}store(e,t){const i=this.caches[e.length-1],r={bytes:e,str:t};i.length>=this.maxLengthPerKey?i[Math.random()*i.length|0]=r:i.push(r)}decode(e,t,i){const r=this.find(e,t,i);if(r!=null)return this.hit++,r;this.miss++;const s=$q(e,t,i),o=Uint8Array.prototype.slice.call(e,t,t+i);return this.store(o,s),s}}const fR="array",Zv="map_key",qq="map_value",uge=n=>{if(typeof n=="string"||typeof n=="number")return n;throw new ao("The type of key must be string or number but "+typeof n)};class hge{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const t=this.getUninitializedStateFromPool();t.type=fR,t.position=0,t.size=e,t.array=new Array(e)}pushMapState(e){const t=this.getUninitializedStateFromPool();t.type=Zv,t.readCount=0,t.size=e,t.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const e={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(e)}return this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===fR){const i=e;i.size=0,i.array=void 0,i.position=0,i.type=void 0}if(e.type===Zv||e.type===qq){const i=e;i.size=0,i.map=void 0,i.readCount=0,i.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const jy=-1,JO=new DataView(new ArrayBuffer(0)),fge=new Uint8Array(JO.buffer);try{JO.getInt8(0)}catch(n){if(!(n instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const A5=new RangeError("Insufficient data"),dge=new cge;let pge=class Kq{constructor(e){this.totalPos=0,this.pos=0,this.view=JO,this.bytes=fge,this.headByte=jy,this.stack=new hge,this.entered=!1,this.extensionCodec=(e==null?void 0:e.extensionCodec)??KS.defaultCodec,this.context=e==null?void 0:e.context,this.useBigInt64=(e==null?void 0:e.useBigInt64)??!1,this.rawStrings=(e==null?void 0:e.rawStrings)??!1,this.maxStrLength=(e==null?void 0:e.maxStrLength)??Gy,this.maxBinLength=(e==null?void 0:e.maxBinLength)??Gy,this.maxArrayLength=(e==null?void 0:e.maxArrayLength)??Gy,this.maxMapLength=(e==null?void 0:e.maxMapLength)??Gy,this.maxExtLength=(e==null?void 0:e.maxExtLength)??Gy,this.keyDecoder=(e==null?void 0:e.keyDecoder)!==void 0?e.keyDecoder:dge,this.mapKeyConverter=(e==null?void 0:e.mapKeyConverter)??uge}clone(){return new Kq({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=jy,this.stack.reset()}setBuffer(e){const t=hR(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(this.headByte===jy&&!this.hasRemaining(1))this.setBuffer(e);else{const t=this.bytes.subarray(this.pos),i=hR(e),r=new Uint8Array(t.length+i.length);r.set(t),r.set(i,t.length),this.setBuffer(r)}}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:t,pos:i}=this;return new RangeError(`Extra ${t.byteLength-i} of ${t.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){yield*this.clone().decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{this.entered=!0;let t=!1,i;for await(const a of e){if(t)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{i=this.doDecodeSync(),t=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(t){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return i}const{headByte:r,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${OP(r)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async*decodeMultiAsync(e,t){if(this.entered){yield*this.clone().decodeMultiAsync(e,t);return}try{this.entered=!0;let i=t,r=-1;for await(const s of e){if(t&&r===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),i&&(r=this.readArraySize(),i=!1,this.complete());try{for(;yield this.doDecodeSync(),--r!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let t;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){const r=e-128;if(r!==0){this.pushMapState(r),this.complete();continue e}else t={}}else if(e<160){const r=e-144;if(r!==0){this.pushArrayState(r),this.complete();continue e}else t=[]}else{const r=e-160;t=this.decodeString(r,0)}else if(e===192)t=null;else if(e===194)t=!1;else if(e===195)t=!0;else if(e===202)t=this.readF32();else if(e===203)t=this.readF64();else if(e===204)t=this.readU8();else if(e===205)t=this.readU16();else if(e===206)t=this.readU32();else if(e===207)this.useBigInt64?t=this.readU64AsBigInt():t=this.readU64();else if(e===208)t=this.readI8();else if(e===209)t=this.readI16();else if(e===210)t=this.readI32();else if(e===211)this.useBigInt64?t=this.readI64AsBigInt():t=this.readI64();else if(e===217){const r=this.lookU8();t=this.decodeString(r,1)}else if(e===218){const r=this.lookU16();t=this.decodeString(r,2)}else if(e===219){const r=this.lookU32();t=this.decodeString(r,4)}else if(e===220){const r=this.readU16();if(r!==0){this.pushArrayState(r),this.complete();continue e}else t=[]}else if(e===221){const r=this.readU32();if(r!==0){this.pushArrayState(r),this.complete();continue e}else t=[]}else if(e===222){const r=this.readU16();if(r!==0){this.pushMapState(r),this.complete();continue e}else t={}}else if(e===223){const r=this.readU32();if(r!==0){this.pushMapState(r),this.complete();continue e}else t={}}else if(e===196){const r=this.lookU8();t=this.decodeBinary(r,1)}else if(e===197){const r=this.lookU16();t=this.decodeBinary(r,2)}else if(e===198){const r=this.lookU32();t=this.decodeBinary(r,4)}else if(e===212)t=this.decodeExtension(1,0);else if(e===213)t=this.decodeExtension(2,0);else if(e===214)t=this.decodeExtension(4,0);else if(e===215)t=this.decodeExtension(8,0);else if(e===216)t=this.decodeExtension(16,0);else if(e===199){const r=this.lookU8();t=this.decodeExtension(r,1)}else if(e===200){const r=this.lookU16();t=this.decodeExtension(r,2)}else if(e===201){const r=this.lookU32();t=this.decodeExtension(r,4)}else throw new ao(`Unrecognized type byte: ${OP(e)}`);this.complete();const i=this.stack;for(;i.length>0;){const r=i.top();if(r.type===fR)if(r.array[r.position]=t,r.position++,r.position===r.size)t=r.array,i.release(r);else continue e;else if(r.type===Zv){if(t==="__proto__")throw new ao("The key __proto__ is not allowed");r.key=this.mapKeyConverter(t),r.type=qq;continue e}else if(r.map[r.key]=t,r.readCount++,r.readCount===r.size)t=r.map,i.release(r);else{r.key=null,r.type=Zv;continue e}}return t}}readHeadByte(){return this.headByte===jy&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=jy}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:{if(e<160)return e-144;throw new ao(`Unrecognized array type byte: ${OP(e)}`)}}}pushMapState(e){if(e>this.maxMapLength)throw new ao(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new ao(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,t):this.decodeBinary(e,t)}decodeUtf8String(e,t){var s;if(e>this.maxStrLength)throw new ao(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw A5;const i=this.pos+t;let r;return this.stateIsMapKey()&&((s=this.keyDecoder)!=null&&s.canBeCached(e))?r=this.keyDecoder.decode(this.bytes,i,e):r=Gme(this.bytes,i,e),this.pos+=t+e,r}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Zv:!1}decodeBinary(e,t){if(e>this.maxBinLength)throw new ao(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw A5;const i=this.pos+t,r=this.bytes.subarray(i,i+e);return this.pos+=t+e,r}decodeExtension(e,t){if(e>this.maxExtLength)throw new ao(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const i=this.view.getInt8(this.pos+t),r=this.decodeBinary(e,t+1);return this.extensionCodec.decode(r,i,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=Wme(this.view,this.pos);return this.pos+=8,e}readI64(){const e=jq(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}};function mge(n,e){return new pge(e).decode(n)}const gge=n=>JSON.stringify(n,(e,t)=>typeof t=="bigint"?t.toString()+"n":t),yge=n=>{const e=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,t=n.replace(e,'$1"$2n"$3');return JSON.parse(t,(i,r)=>typeof r=="string"&&r.match(/^\d+n$/)?BigInt(r.substring(0,r.length-1)):r)};function hp(n){if(typeof n!="string")throw new Error(`Cannot safe json parse value of type ${typeof n}`);try{return yge(n)}catch{return n}}function iu(n){return typeof n=="string"?n:gge(n)||""}function vge(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Xq(n,...e){if(!vge(n))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(n.length))throw new Error("Uint8Array expected of length "+e+", got length="+n.length)}function M5(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function wge(n,e){Xq(n);const t=e.outputLen;if(n.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}const tm=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const LP=n=>new DataView(n.buffer,n.byteOffset,n.byteLength);function xge(n){if(typeof n!="string")throw new Error("utf8ToBytes expected string, got "+typeof n);return new Uint8Array(new TextEncoder().encode(n))}function Yq(n){return typeof n=="string"&&(n=xge(n)),Xq(n),n}let bge=class{clone(){return this._cloneInto()}};function _ge(n){const e=i=>n().update(Yq(i)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function Qq(n=32){if(tm&&typeof tm.getRandomValues=="function")return tm.getRandomValues(new Uint8Array(n));if(tm&&typeof tm.randomBytes=="function")return tm.randomBytes(n);throw new Error("crypto.getRandomValues must be defined")}function Ege(n,e,t,i){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,i);const r=BigInt(32),s=BigInt(4294967295),o=Number(t>>r&s),a=Number(t&s),l=i?4:0,c=i?0:4;n.setUint32(e+l,o,i),n.setUint32(e+c,a,i)}let Sge=class extends bge{constructor(e,t,i,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=i,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=LP(this.buffer)}update(e){M5(this);const{view:t,buffer:i,blockLen:r}=this;e=Yq(e);const s=e.length;for(let o=0;o<s;){const a=Math.min(r-this.pos,s-o);if(a===r){const l=LP(e);for(;r<=s-o;o+=r)this.process(l,o);continue}i.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){M5(this),wge(e,this),this.finished=!0;const{buffer:t,view:i,blockLen:r,isLE:s}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(i,0),o=0);for(let h=o;h<r;h++)t[h]=0;Ege(i,r-8,BigInt(this.length*8),s),this.process(i,0);const a=LP(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<c;h++)a.setUint32(4*h,u[h],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const i=e.slice(0,t);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:i,length:r,finished:s,destroyed:o,pos:a}=this;return e.length=r,e.pos=a,e.finished=s,e.destroyed=o,r%t&&e.buffer.set(i),e}};const qb=BigInt(2**32-1),dR=BigInt(32);function Zq(n,e=!1){return e?{h:Number(n&qb),l:Number(n>>dR&qb)}:{h:Number(n>>dR&qb)|0,l:Number(n&qb)|0}}function Age(n,e=!1){let t=new Uint32Array(n.length),i=new Uint32Array(n.length);for(let r=0;r<n.length;r++){const{h:s,l:o}=Zq(n[r],e);[t[r],i[r]]=[s,o]}return[t,i]}const Mge=(n,e)=>BigInt(n>>>0)<<dR|BigInt(e>>>0),Tge=(n,e,t)=>n>>>t,Pge=(n,e,t)=>n<<32-t|e>>>t,Cge=(n,e,t)=>n>>>t|e<<32-t,Ige=(n,e,t)=>n<<32-t|e>>>t,Rge=(n,e,t)=>n<<64-t|e>>>t-32,Nge=(n,e,t)=>n>>>t-32|e<<64-t,Dge=(n,e)=>e,Oge=(n,e)=>n,Lge=(n,e,t)=>n<<t|e>>>32-t,Uge=(n,e,t)=>e<<t|n>>>32-t,Bge=(n,e,t)=>e<<t-32|n>>>64-t,kge=(n,e,t)=>n<<t-32|e>>>64-t;function Fge(n,e,t,i){const r=(e>>>0)+(i>>>0);return{h:n+t+(r/2**32|0)|0,l:r|0}}const zge=(n,e,t)=>(n>>>0)+(e>>>0)+(t>>>0),Vge=(n,e,t,i)=>e+t+i+(n/2**32|0)|0,Hge=(n,e,t,i)=>(n>>>0)+(e>>>0)+(t>>>0)+(i>>>0),$ge=(n,e,t,i,r)=>e+t+i+r+(n/2**32|0)|0,Gge=(n,e,t,i,r)=>(n>>>0)+(e>>>0)+(t>>>0)+(i>>>0)+(r>>>0),jge=(n,e,t,i,r,s)=>e+t+i+r+s+(n/2**32|0)|0,kt={fromBig:Zq,split:Age,toBig:Mge,shrSH:Tge,shrSL:Pge,rotrSH:Cge,rotrSL:Ige,rotrBH:Rge,rotrBL:Nge,rotr32H:Dge,rotr32L:Oge,rotlSH:Lge,rotlSL:Uge,rotlBH:Bge,rotlBL:kge,add:Fge,add3L:zge,add3H:Vge,add4L:Hge,add4H:$ge,add5H:jge,add5L:Gge},[Wge,qge]=kt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b89
1796f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Cu=new Uint32Array(80),Iu=new Uint32Array(80);let Kge=class extends Sge{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:i,Bl:r,Ch:s,Cl:o,Dh:a,Dl:l,Eh:c,El:u,Fh:h,Fl:f,Gh:m,Gl:g,Hh:v,Hl:w}=this;return[e,t,i,r,s,o,a,l,c,u,h,f,m,g,v,w]}set(e,t,i,r,s,o,a,l,c,u,h,f,m,g,v,w){this.Ah=e|0,this.Al=t|0,this.Bh=i|0,this.Bl=r|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=c|0,this.El=u|0,this.Fh=h|0,this.Fl=f|0,this.Gh=m|0,this.Gl=g|0,this.Hh=v|0,this.Hl=w|0}process(e,t){for(let x=0;x<16;x++,t+=4)Cu[x]=e.getUint32(t),Iu[x]=e.getUint32(t+=4);for(let x=16;x<80;x++){const S=Cu[x-15]|0,M=Iu[x-15]|0,A=kt.rotrSH(S,M,1)^kt.rotrSH(S,M,8)^kt.shrSH(S,M,7),I=kt.rotrSL(S,M,1)^kt.rotrSL(S,M,8)^kt.shrSL(S,M,7),D=Cu[x-2]|0,k=Iu[x-2]|0,C=kt.rotrSH(D,k,19)^kt.rotrBH(D,k,61)^kt.shrSH(D,k,6),U=kt.rotrSL(D,k,19)^kt.rotrBL(D,k,61)^kt.shrSL(D,k,6),G=kt.add4L(I,U,Iu[x-7],Iu[x-16]),H=kt.add4H(G,A,C,Cu[x-7],Cu[x-16]);Cu[x]=H|0,Iu[x]=G|0}let{Ah:i,Al:r,Bh:s,Bl:o,Ch:a,Cl:l,Dh:c,Dl:u,Eh:h,El:f,Fh:m,Fl:g,Gh:v,Gl:w,Hh:y,Hl:_}=this;for(let x=0;x<80;x++){const S=kt.rotrSH(h,f,14)^kt.rotrSH(h,f,18)^kt.rotrBH(h,f,41),M=kt.rotrSL(h,f,14)^kt.rotrSL(h,f,18)^kt.rotrBL(h,f,41),A=h&m^~h&v,I=f&g^~f&w,D=kt.add5L(_,M,I,qge[x],Iu[x]),k=kt.add5H(D,y,S,A,Wge[x],Cu[x]),C=D|0,U=kt.rotrSH(i,r,28)^kt.rotrBH(i,r,34)^kt.rotrBH(i,r,39),G=kt.rotrSL(i,r,28)^kt.rotrBL(i,r,34)^kt.rotrBL(i,r,39),H=i&s^i&a^s&a,z=r&o^r&l^o&l;y=v|0,_=w|0,v=m|0,w=g|0,m=h|0,g=f|0,{h,l:f}=kt.add(c|0,u|0,k|0,C|0),c=a|0,u=l|0,a=s|0,l=o|0,s=i|0,o=r|0;const P=kt.add3L(C,G,z);i=kt.add3H(P,k,U,H),r=P|0}({h:i,l:r}=kt.add(this.Ah|0,this.Al|0,i|0,r|0)),{h:s,l:o}=kt.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l}=kt.add(this.Ch|0,this.Cl|0,a|0,l|0),{h:c,l:u}=kt.add(this.Dh|0,this.Dl|0,c|0,u|0),{h,l:f}=kt.add(this.Eh|0,this.El|0,h|0,f|0),{h:m,l:g}=kt.add(this.Fh|0,this.Fl|0,m|0,g|0),{h:v,l:w}=kt.add(this.Gh|0,this.Gl|0,v|0,w|0),{h:y,l:_}=kt.add(this.Hh|0,this.Hl|0,y|0,_|0),this.set(i,r,s,o,a,l,c,u,h,f,m,g,v,w,y,_)}roundClean(){Cu.fill(0),Iu.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const Xge=_ge(()=>new Kge);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const eL=BigInt(0),Jq=BigInt(1),Yge=BigInt(2);function tL(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function nL(n){if(!tL(n))throw new Error("Uint8Array expected")}function UP(n,e){if(typeof e!="boolean")throw new Error(n+" boolean expected, got "+e)}const Qge=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function iL(n){nL(n);let e="";for(let t=0;t<n.length;t++)e+=Qge[n[t]];return e}
vendor: 18,800 bytes, line 179
179function eK(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?eL:BigInt("0x"+n)}const Zl={_0:48,_9:57,A:65,F:70,a:97,f:102};function T5(n){if(n>=Zl._0&&n<=Zl._9)return n-Zl._0;if(n>=Zl.A&&n<=Zl.F)return n-(Zl.A-10);if(n>=Zl.a&&n<=Zl.f)return n-(Zl.a-10)}function tK(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const e=n.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(t);for(let r=0,s=0;r<t;r++,s+=2){const o=T5(n.charCodeAt(s)),a=T5(n.charCodeAt(s+1));if(o===void 0||a===void 0){const l=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}i[r]=o*16+a}return i}function Zge(n){return eK(iL(n))}function BE(n){return nL(n),eK(iL(Uint8Array.from(n).reverse()))}function nK(n,e){return tK(n.toString(16).padStart(e*2,"0"))}function pR(n,e){return nK(n,e).reverse()}function Jl(n,e,t){let i;if(typeof e=="string")try{i=tK(e)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(tL(e))i=Uint8Array.from(e);else throw new Error(n+" must be hex string or Uint8Array");const r=i.length;if(typeof t=="number"&&r!==t)throw new Error(n+" of length "+t+" expected, got "+r);return i}function P5(...n){let e=0;for(let i=0;i<n.length;i++){const r=n[i];nL(r),e+=r.length}const t=new Uint8Array(e);for(let i=0,r=0;i<n.length;i++){const s=n[i];t.set(s,r),r+=s.length}return t}const BP=n=>typeof n=="bigint"&&eL<=n;function Jge(n,e,t){return BP(n)&&BP(e)&&BP(t)&&e<=n&&n<t}function Wy(n,e,t,i){if(!Jge(e,t,i))throw new Error("expected valid "+n+": "+t+" <= n < "+i+", got "+e)}function e0e(n){let e;for(e=0;n>eL;n>>=Jq,e+=1);return e}const t0e=n=>(Yge<<BigInt(n-1))-Jq,n0e={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||tL(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function rL(n,e,t={}){const i=(r,s,o)=>{const a=n0e[s];if(typeof a!="function")throw new Error("invalid validator function");const l=n[r];if(!(o&&l===void 0)&&!a(l,n))throw new Error("param "+String(r)+" is invalid. Expected "+s+", got "+l)};for(const[r,s]of Object.entries(e))i(r,s,!1);for(const[r,s]of Object.entries(t))i(r,s,!0);return n}function C5(n){const e=new WeakMap;return(t,...i)=>{const r=e.get(t);if(r!==void 0)return r;const s=n(t,...i);return e.set(t,s),s}}const Yi=BigInt(0),pi=BigInt(1),Jf=BigInt(2),i0e=BigInt(3),mR=BigInt(4),I5=BigInt(5),R5=BigInt(8);function Ci(n,e){const t=n%e;return t>=Yi?t:e+t}function r0e(n,e,t){if(e<Yi)throw new Error("invalid exponent, negatives unsupported");if(t<=Yi)throw new Error("invalid modulus");if(t===pi)return Yi;let i=pi;for(;e>Yi;)e&pi&&(i=i*n%t),n=n*n%t,e>>=pi;return i}function sl(n,e,t){let i=n;for(;e-- >Yi;)i*=i,i%=t;return i}function N5(n,e){if(n===Yi)throw new Error("invert: expected non-zero number");if(e<=Yi)throw new Error("invert: expected positive modulus, got "+e);let t=Ci(n,e),i=e,r=Yi,s=pi;for(;t!==Yi;){const o=i/t,a=i%t,l=r-s*o;i=t,t=a,r=s,s=l}if(i!==pi)throw new Error("invert: does not exist");return Ci(r,e)}function s0e(n){const e=(n-pi)/Jf;let t,i,r;for(t=n-pi,i=0;t%Jf===Yi;t/=Jf,i++);for(r=Jf;r<n&&r0e(r,e,n)!==n-pi;r++)if(r>1e3)throw new Error("Cannot find square root: likely non-prime P");if(i===1){const o=(n+pi)/mR;return function(a,l){const c=a.pow(l,o);if(!a.eql(a.sqr(c),l))throw new Error("Cannot find square root");return c}}const s=(t+pi)/Jf;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let l=i,c=o.pow(o.mul(o.ONE,r),t),u=o.pow(a,s),h=o.pow(a,t);for(;!o.eql(h,o.ONE);){if(o.eql(h,o.ZERO))return o.ZERO;let f=1;for(let g=o.sqr(h);f<l&&!o.eql(g,o.ONE);f++)g=o.sqr(g);const m=o.pow(c,pi<<BigInt(l-f-1));c=o.sqr(m),u=o.mul(u,m),h=o.mul(h,c),l=f}return u}}function o0e(n){if(n%mR===i0e){const e=(n+pi)/mR;return function(t,i){const r=t.pow(i,e);if(!t.eql(t.sqr(r),i))throw new Error("Cannot find square root");return r}}if(n%R5===I5){const e=(n-I5)/R5;return function(t,i){const r=t.mul(i,Jf),s=t.pow(r,e),o=t.mul(i,s),a=t.mul(t.mul(o,Jf),s),l=t.mul(o,t.sub(a,t.ONE));if(!t.eql(t.sqr(l),i))throw new Error("Cannot find square root");return l}}return s0e(n)}const a0e=(n,e)=>(Ci(n,e)&pi)===pi,l0e=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function c0e(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=l0e.reduce((i,r)=>(i[r]="function",i),e);return rL(n,t)}function u0e(n,e,t){if(t<Yi)throw new Error("invalid exponent, negatives unsupported");if(t===Yi)return n.ONE;if(t===pi)return e;let i=n.ONE,r=e;for(;t>Yi;)t&pi&&(i=n.mul(i,r)),r=n.sqr(r),t>>=pi;return i}function h0e(n,e){const t=new Array(e.length),i=e.reduce((s,o,a)=>n.is0(o)?s:(t[a]=s,n.mul(s,o)),n.ONE),r=n.inv(i);return e.reduceRight((s,o,a)=>n.is0(o)?s:(t[a]=n.mul(s,t[a]),n.mul(s,o)),r),t}function iK(n,e){const t=e!==void 0?e:n.toString(2).length,i=Math.ceil(t/8);return{nBitLength:t,nByteLength:i}}function rK(n,e,t=!1,i={}){if(n<=Yi)throw new Error("invalid field: expected ORDER > 0, got "+n);const{nBitLength:r,nByteLength:s}=iK(n,e);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:n,isLE:t,BITS:r,BYTES:s,MASK:t0e(r),ZERO:Yi,ONE:pi,create:l=>Ci(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof l);return Yi<=l&&l<n},is0:l=>l===Yi,isOdd:l=>(l&pi)===pi,neg:l=>Ci(-l,n),eql:(l,c)=>l===c,sqr:l=>Ci(l*l,n),add:(l,c)=>Ci(l+c,n),sub:(l,c)=>Ci(l-c,n),mul:(l,c)=>Ci(l*c,n),pow:(l,c)=>u0e(a,l,c),div:(l,c)=>Ci(l*N5(c,n),n),sqrN:l=>l*l,addN:(l,c)=>l+c,subN:(l,c)=>l-c,mulN:(l,c)=>l*c,inv:l=>N5(l,n),sqrt:i.sqrt||(l=>(o||(o=o0e(n)),o(a,l))),invertBatch:l=>h0e(a,l),cmov:(l,c,u)=>u?c:l,toBytes:l=>t?pR(l,s):nK(l,s),fromBytes:l=>{if(l.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+l.length);return t?BE(l):Zge(l)}});return Object.freeze(a)}const D5=BigInt(0),Kb=BigInt(1);function kP(n,e){const t=e.negate();return n?t:e}function sK(n,e){if(!Number.isSafeInteger(n)||n<=0||n>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+n)}function FP(n,e){sK(n,e);const t=Math.ceil(e/n)+1,i=2**(n-1);return{windows:t,windowSize:i}}function f0e(n,e){if(!Array.isArray(n))throw new Error("array expected");n.forEach((t,i)=>{if(!(t instanceof e))throw new Error("invalid point at index "+i)})}function d0e(n,e){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((t,i)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+i)})}const zP=new WeakMap,oK=new WeakMap;function VP(n){return oK.get(n)||1}function p0e(n,e){return{constTimeNegate:kP,hasPrecomputes(t){return VP(t)!==1},unsafeLadder(t,i,r=n.ZERO){let s=t;for(;i>D5;)i&Kb&&(r=r.add(s)),s=s.double(),i>>=Kb;return r},precomputeWindow(t,i){const{windows:r,windowSize:s}=FP(i,e),o=[];let a=t,l=a;for(let c=0;c<r;c++){l=a,o.push(l);for(let u=1;u<s;u++)l=l.add(a),o.push(l);a=l.double()}return o},wNAF(t,i,r){const{windows:s,windowSize:o}=FP(t,e);let a=n.ZERO,l=n.BASE;const c=BigInt(2**t-1),u=2**t,h=BigInt(t);for(let f=0;f<s;f++){const m=f*o;let g=Number(r&c);r>>=h,g>o&&(g-=u,r+=Kb);const v=m,w=m+Math.abs(g)-1,y=f%2!==0,_=g<0;g===0?l=l.add(kP(y,i[v])):a=a.add(kP(_,i[w]))}return{p:a,f:l}},wNAFUnsafe(t,i,r,s=n.ZERO){const{windows:o,windowSize:a}=FP(t,e),l=BigInt(2**t-1),c=2**t,u=BigInt(t);for(let h=0;h<o;h++){const f=h*a;if(r===D5)break;let m=Number(r&l);if(r>>=u,m>a&&(m-=c,r+=Kb),m===0)continue;let g=i[f+Math.abs(m)-1];m<0&&(g=g.negate()),s=s.add(g)}return s},getPrecomputes(t,i,r){let s=zP.get(i);return s||(s=this.precomputeWindow(i,t),t!==1&&zP.set(i,r(s))),s},wNAFCached(t,i,r){const s=VP(t);return this.wNAF(s,this.getPrecomputes(s,t,r),i)},wNAFCachedUnsafe(t,i,r,s){const o=VP(t);return o===1?this.unsafeLadder(t,i,s):this.wNAFUnsafe(o,this.getPrecomputes(o,t,r),i,s)},setWindowSize(t,i){sK(i,e),oK.set(t,i),zP.delete(t)}}}function m0e(n,e,t,i){if(f0e(t,n),d0e(i,e),t.length!==i.length)throw new Error("arrays of points and scalars must have equal length");const r=n.ZERO,s=e0e(BigInt(t.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,l=new Array(a+1).fill(r),c=Math.floor((e.BITS-1)/o)*o;let u=r;for(let h=c;h>=0;h-=o){l.fill(r);for(let m=0;m<i.length;m++){const g=i[m],v=Number(g>>BigInt(h)&BigInt(a));l[v]=l[v].add(t[m])}let f=r;for(let m=l.length-1,g=r;m>0;m--)g=g.add(l[m]),f=f.add(g);if(u=u.add(f),h!==0)for(let m=0;m<o;m++)u=u.double()}return u}function g0e(n){return c0e(n.Fp),rL(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...iK(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}const fa=BigInt(0),ys=BigInt(1),Xb=BigInt(2),y0e=BigInt(8),v0e={zip215:!0};function w0e(n){const e=g0e(n);return rL(n,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function x0e(n){const e=w0e(n),{Fp:t,n:i,prehash:r,hash:s,randomBytes:o,nByteLength:a,h:l}=e,c=Xb<<BigInt(a*8)-ys,u=t.create,h=rK(e.n,e.nBitLength),f=e.uvRatio||((P,R)=>{try{return{isValid:!0,value:t.sqrt(P*t.inv(R))}}catch{return{isValid:!1,value:fa}}}),m=e.adjustScalarBytes||(P=>P),g=e.domain||((P,R,F)=>{if(UP("phflag",F),R.length||F)throw new Error("Contexts/pre-hash are not supported");return P});function v(P,R){Wy("coordinate "+P,R,fa,c)}function w(P){if(!(P instanceof x))throw new Error("ExtendedPoint expected")}const y=C5((P,R)=>{const{ex:F,ey:N,ez:O}=P,B=P.is0();R==null&&(R=B?y0e:t.inv(O));const W=u(F*R),Q=u(N*R),oe=u(O*R);if(B)return{x:fa,y:ys};if(oe!==ys)throw new Error("invZ was invalid");return{x:W,y:Q}}),_=C5(P=>{const{a:R,d:F}=e;if(P.is0())throw new Error("bad point: ZERO");const{ex:N,ey:O,ez:B,et:W}=P,Q=u(N*N),oe=u(O*O),Y=u(B*B),te=u(Y*Y),le=u(Q*R),ve=u(Y*u(le+oe)),Te=u(te+u(F*u(Q*oe)));if(ve!==Te)throw new Error("bad point: equation left != right (1)");const be=u(N*O),Le=u(B*W);if(be!==Le)throw new Error("bad point: equation left != right (2)");return!0});class x{constructor(R,F,N,O){this.ex=R,this.ey=F,this.ez=N,this.et=O,v("x",R),v("y",F),v("z",N),v("t",O),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(R){if(R instanceof x)throw new Error("extended point not allowed");const{x:F,y:N}=R||{};return v("x",F),v("y",N),new x(F,N,ys,u(F*N))}static normalizeZ(R){const F=t.invertBatch(R.map(N=>N.ez));return R.map((N,O)=>N.toAffine(F[O])).map(x.fromAffine)}static msm(R,F){return m0e(x,h,R,F)}_setWindowSize(R){A.setWindowSize(this,R)}assertValidity(){_(this)}equals(R){w(R);const{ex:F,ey:N,ez:O}=this,{ex:B,ey:W,ez:Q}=R,oe=u(F*Q),Y=u(B*O),te=u(N*Q),le=u(W*O);return oe===Y&&te===le}is0(){return this.equals(x.ZERO)}negate(){return new x(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){const{a:R}=e,{ex:F,ey:N,ez:O}=this,B=u(F*F),W=u(N*N),Q=u(Xb*u(O*O)),oe=u(R*B),Y=F+N,te=u(u(Y*Y)-B-W),le=oe+W,ve=le-Q,Te=oe-W,be=u(te*ve),Le=u(le*Te),Oe=u(te*Te),J=u(ve*le);return new x(be,Le,J,Oe)}add(R){w(R);const{a:F,d:N}=e,{ex:O,ey:B,ez:W,et:Q}=this,{ex:oe,ey:Y,ez:te,et:le}=R;if(F===BigInt(-1)){const rt=u((B-O)*(Y+oe)),Et=u((B+O)*(Y-oe)),X=u(Et-rt);if(X===fa)return this.double();const $=u(W*Xb*le),xe=u(Q*Xb*te),Ee=xe+$,Ne=Et+rt,Pe=xe-$,_t=u(Ee*X),pt=u(Ne*Pe),Fe=u(Ee*Pe),$e=u(X*Ne);return new x(_t,pt,$e,Fe)}const ve=u(O*oe),Te=u(B*Y),be=u(Q*N*le),Le=u(W*te),Oe=u((O+B)*(oe+Y)-ve-Te),J=Le-be,Se=Le+be,me=u(Te-F*ve),Re=u(Oe*J),Ae=u(Se*me),Ze=u(Oe*me),Ke=u(J*Se);return new x(Re,Ae,Ke,Ze)}subtract(R){return this.add(R.negate())}wNAF(R){return A.wNAFCached(this,R,x.normalizeZ)}multiply(R){const F=R;Wy("scalar",F,ys,i);const{p:N,f:O}=this.wNAF(F);return x.normalizeZ([N,O])[0]}multiplyUnsafe(R,F=x.ZERO){const N=R;return Wy("scalar",N,fa,i),N===fa?M:this.is0()||N===ys?this:A.wNAFCachedUnsafe(this,N,x.normalizeZ,F)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return A.unsafeLadder(this,i).is0()}toAffine(R){return y(this,R)}clearCofactor(){const{h:R}=e;return R===ys?this:this.multiplyUnsafe(R)}static fromHex(R,F=!1){const{d:N,a:O}=e,B=t.BYTES;R=Jl("pointHex",R,B),UP("zip215",F);const W=R.slice(),Q=R[B-1];W[B-1]=Q&-129;const oe=BE(W),Y=F?c:t.ORDER;Wy("pointHex.y",oe,fa,Y);const te=u(oe*oe),le=u(te-ys),ve=u(N*te-O);let{isValid:Te,value:be}=f(le,ve);if(!Te)throw new Error("Point.fromHex: invalid y coordinate");const Le=(be&ys)===ys,Oe=(Q&128)!==0;if(!F&&be===fa&&Oe)throw new Error("Point.fromHex: x=0 and x_0=1");return Oe!==Le&&(be=u(-be)),x.fromAffine({x:be,y:oe})}static fromPrivateKey(R){return k(R).point}toRawBytes(){const{x:R,y:F}=this.toAffine(),N=pR(F,t.BYTES);return N[N.length-1]|=R&ys?128:0,N}toHex(){return iL(this.toRawBytes())}}x.BASE=new x(e.Gx,e.Gy,ys,u(e.Gx*e.Gy)),x.ZERO=new x(fa,ys,ys,fa);const{BASE:S,ZERO:M}=x,A=p0e(x,a*8);function I(P){return Ci(P,i)}function D(P){return I(BE(P))}function k(P){const R=t.BYTES;P=Jl("private key",P,R);const F=Jl("hashed private key",s(P),2*R),N=m(F.slice(0,R)),O=F.slice(R,2*R),B=D(N),W=S.multiply(B),Q=W.toRawBytes();return{head:N,prefix:O,scalar:B,point:W,pointBytes:Q}}function C(P){return k(P).pointBytes}function U(P=new Uint8Array,...R){const F=P5(...R);return D(s(g(F,Jl("context",P),!!r)))}function G(P,R,F={}){P=Jl("message",P),r&&(P=r(P));const{prefix:N,scalar:O,pointBytes:B}=k(R),W=U(F.context,N,P),Q=S.multiply(W).toRawBytes(),oe=U(F.context,Q,B,P),Y=I(W+oe*O);Wy("signature.s",Y,fa,i);const te=P5(Q,pR(Y,t.BYTES));return Jl("result",te,t.BYTES*2)}const H=v0e;function z(P,R,F,N=H){const{context:O,zip215:B}=N,W=t.BYTES;P=Jl("signature",P,2*W),R=Jl("message",R),F=Jl("publicKey",F,W),B!==void 0&&UP("zip215",B),r&&(R=r(R));const Q=BE(P.slice(W,2*W));let oe,Y,te;try{oe=x.fromHex(F,B),Y=x.fromHex(P.slice(0,W),B),te=S.multiplyUnsafe(Q)}catch{return!1}if(!B&&oe.isSmallOrder())return!1;const le=U(O,Y.toRawBytes(),oe.toRawBytes(),R);return Y.add(oe.multiplyUnsafe(le)).subtract(te).clearCofactor().equals(x.ZERO)}return S._setWindowSize(8),{CURVE:e,getPublicKey:C,sign:G,verify:z,ExtendedPoint:x,utils:{getExtendedPublicKey:k,randomPrivateKey:()=>o(t.BYTES),precompute(P=8,R=x.BASE){return R._setWindowSize(P),R.multiply(BigInt(3)),R}}}}BigInt(0),BigInt(1);const sL=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),O5=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const b0e=BigInt(1),L5=BigInt(2);BigInt(3);const _0e=BigInt(5),E0e=BigInt(8);function S0e(n){const e=BigInt(10),t=BigInt(20),i=BigInt(40),r=BigInt(80),s=sL,o=n*n%s*n%s,a=sl(o,L5,s)*o%s,l=sl(a,b0e,s)*n%s,c=sl(l,_0e,s)*l%s,u=sl(c,e,s)*c%s,h=sl(u,t,s)*u%s,f=sl(h,i,s)*h%s,m=sl(f,r,s)*f%s,g=sl(m,r,s)*f%s,v=sl(g,e,s)*c%s;return{pow_p_5_8:sl(v,L5,s)*n%s,b2:o}}function A0e(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}function M0e(n,e){const t=sL,i=Ci(e*e*e,t),r=Ci(i*i*e,t),s=S0e(n*r).pow_p_5_8;let o=Ci(n*i*s,t);const a=Ci(e*o*o,t),l=o,c=Ci(o*O5,t),u=a===n,h=a===Ci(-n,t),f=a===Ci(-n*O5,t);return u&&(o=l),(h||f)&&(o=c),a0e(o,t)&&(o=Ci(-o,t)),{isValid:u||h,value:o}}const T0e=rK(sL,void 0,!0),P0e={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:T0e,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:E0e,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Xge,randomBytes:Qq,adjustScalarBytes:A0e,uvRatio:M0e},aK=x0e(P0e),C0e="EdDSA",I0e="JWT",XS=".",d2="base64url",lK="utf8",cK="utf8",R0e=":",N0e="did",D0e="key",U5="base58btc",O0e="z",L0e="K36",U0e=32;function oL(n){return globalThis.Buffer!=null?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n}function uK(n=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?oL(globalThis.Buffer.allocUnsafe(n)):new Uint8Array(n)}function hK(n,e){e||(e=n.reduce((r,s)=>r+s.length,0));const t=uK(e);let i=0;for(const r of n)t.set(r,i),i+=r.length;return oL(t)}function B0e(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var r=0;r<n.length;r++){var s=n.charAt(r),o=s.charCodeAt(0);if(t[o]!==255)throw new TypeError(s+" is ambiguous");t[o]=r}var a=n.length,l=n.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var v=0,w=0,y=0,_=g.length;y!==_&&g[y]===0;)y++,v++;for(var x=(_-y)*u+1>>>0,S=new Uint8Array(x);y!==_;){for(var M=g[y],A=0,I=x-1;(M!==0||A<w)&&I!==-1;I--,A++)M+=256*S[I]>>>0,S[I]=M%a>>>0,M=M/a>>>0;if(M!==0)throw new Error("Non-zero carry");w=A,y++}for(var D=x-w;D!==x&&S[D]===0;)D++;for(var k=l.repeat(v);D<x;++D)k+=n.charAt(S[D]);return k}function f(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var v=0;if(g[v]!==" "){for(var w=0,y=0;g[v]===l;)w++,v++;for(var _=(g.length-v)*c+1>>>0,x=new Uint8Array(_);g[v];){var S=t[g.charCodeAt(v)];if(S===255)return;for(var M=0,A=_-1;(S!==0||M<y)&&A!==-1;A--,M++)S+=a*x[A]>>>0,x[A]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");y=M,v++}if(g[v]!==" "){for(var I=_-y;I!==_&&x[I]===0;)I++;for(var D=new Uint8Array(w+(_-I)),k=w;I!==_;)D[k++]=x[I++];return D}}}function m(g){var v=f(g);if(v)return v;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:f,decode:m}}var k0e=B0e,F0e=k0e;const fK=n=>{if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")},z0e=n=>new TextEncoder().encode(n),V0e=n=>new TextDecoder().decode(n);let H0e=class{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},$0e=class{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name}
179 decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return dK(this,e)}},G0e=class{constructor(e){this.decoders=e}or(e){return dK(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const dK=(n,e)=>new G0e({...n.decoders||{[n.prefix]:n},...e.decoders||{[e.prefix]:e}});let j0e=class{constructor(e,t,i,r){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=r,this.encoder=new H0e(e,t,i),this.decoder=new $0e(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const p2=({name:n,prefix:e,encode:t,decode:i})=>new j0e(n,e,t,i),X1=({prefix:n,name:e,alphabet:t})=>{const{encode:i,decode:r}=F0e(t,e);return p2({prefix:n,name:e,encode:i,decode:s=>fK(r(s))})},W0e=(n,e,t,i)=>{const r={};for(let u=0;u<e.length;++u)r[e[u]]=u;let s=n.length;for(;n[s-1]==="=";)--s;const o=new Uint8Array(s*t/8|0);let a=0,l=0,c=0;for(let u=0;u<s;++u){const h=r[n[u]];if(h===void 0)throw new SyntaxError(`Non-${i} character`);l=l<<t|h,a+=t,a>=8&&(a-=8,o[c++]=255&l>>a)}if(a>=t||255&l<<8-a)throw new SyntaxError("Unexpected end of data");return o},q0e=(n,e,t)=>{const i=e[e.length-1]==="=",r=(1<<t)-1;let s="",o=0,a=0;for(let l=0;l<n.length;++l)for(a=a<<8|n[l],o+=8;o>t;)o-=t,s+=e[r&a>>o];if(o&&(s+=e[r&a<<t-o]),i)for(;s.length*t&7;)s+="=";return s},mr=({name:n,prefix:e,bitsPerChar:t,alphabet:i})=>p2({prefix:e,name:n,encode(r){return q0e(r,i,t)},decode(r){return W0e(r,i,t,n)}}),K0e=p2({prefix:"\0",name:"identity",encode:n=>V0e(n),decode:n=>z0e(n)});var X0e=Object.freeze({__proto__:null,identity:K0e});const Y0e=mr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Q0e=Object.freeze({__proto__:null,base2:Y0e});const Z0e=mr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var J0e=Object.freeze({__proto__:null,base8:Z0e});const eye=X1({prefix:"9",name:"base10",alphabet:"0123456789"});var tye=Object.freeze({__proto__:null,base10:eye});const nye=mr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),iye=mr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var rye=Object.freeze({__proto__:null,base16:nye,base16upper:iye});const sye=mr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),oye=mr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),aye=mr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),lye=mr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cye=mr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),uye=mr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),hye=mr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fye=mr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),dye=mr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var pye=Object.freeze({__proto__:null,base32:sye,base32upper:oye,base32pad:aye,base32padupper:lye,base32hex:cye,base32hexupper:uye,base32hexpad:hye,base32hexpadupper:fye,base32z:dye});const mye=X1({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gye=X1({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var yye=Object.freeze({__proto__:null,base36:mye,base36upper:gye});const vye=X1({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),wye=X1({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var xye=Object.freeze({__proto__:null,base58btc:vye,base58flickr:wye});const bye=mr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
179+/",bitsPerChar:6}),_ye=mr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Eye=mr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Sye=mr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Aye=Object.freeze({__proto__:null,base64:bye,base64pad:_ye,base64url:Eye,base64urlpad:Sye});const pK=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Mye=pK.reduce((n,e,t)=>(n[t]=e,n),[]),Tye=pK.reduce((n,e,t)=>(n[e.codePointAt(0)]=t,n),[]);function Pye(n){return n.reduce((e,t)=>(e+=Mye[t],e),"")}function Cye(n){const e=[];for(const t of n){const i=Tye[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const Iye=p2({prefix:"🚀",name:"base256emoji",encode:Pye,decode:Cye});var Rye=Object.freeze({__proto__:null,base256emoji:Iye}),Nye=mK,B5=128,Dye=127,Oye=~Dye,Lye=Math.pow(2,31);function mK(n,e,t){e=e||[],t=t||0;for(var i=t;n>=Lye;)e[t++]=n&255|B5,n/=128;for(;n&Oye;)e[t++]=n&255|B5,n>>>=7;return e[t]=n|0,mK.bytes=t-i+1,e}var Uye=gR,Bye=128,k5=127;function gR(n,i){var t=0,i=i||0,r=0,s=i,o,a=n.length;do{if(s>=a)throw gR.bytes=0,new RangeError("Could not decode varint");o=n[s++],t+=r<28?(o&k5)<<r:(o&k5)*Math.pow(2,r),r+=7}while(o>=Bye);return gR.bytes=s-i,t}var kye=Math.pow(2,7),Fye=Math.pow(2,14),zye=Math.pow(2,21),Vye=Math.pow(2,28),Hye=M
vendor: 6,118 bytes, line 179
179ath.pow(2,35),$ye=Math.pow(2,42),Gye=Math.pow(2,49),jye=Math.pow(2,56),Wye=Math.pow(2,63),qye=function(n){return n<kye?1:n<Fye?2:n<zye?3:n<Vye?4:n<Hye?5:n<$ye?6:n<Gye?7:n<jye?8:n<Wye?9:10},Kye={encode:Nye,decode:Uye,encodingLength:qye},gK=Kye;const F5=(n,e,t=0)=>(gK.encode(n,e,t),e),z5=n=>gK.encodingLength(n),yR=(n,e)=>{const t=e.byteLength,i=z5(n),r=i+z5(t),s=new Uint8Array(r+t);return F5(n,s,0),F5(t,s,i),s.set(e,r),new Xye(n,t,e,s)};let Xye=class{constructor(e,t,i,r){this.code=e,this.size=t,this.digest=i,this.bytes=r}};const yK=({name:n,code:e,encode:t})=>new Yye(n,e,t);let Yye=class{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?yR(this.code,t):t.then(i=>yR(this.code,i))}else throw Error("Unknown type, must be binary type")}};const vK=n=>async e=>new Uint8Array(await crypto.subtle.digest(n,e)),Qye=yK({name:"sha2-256",code:18,encode:vK("SHA-256")}),Zye=yK({name:"sha2-512",code:19,encode:vK("SHA-512")});var Jye=Object.freeze({__proto__:null,sha256:Qye,sha512:Zye});const wK=0,eve="identity",xK=fK,tve=n=>yR(wK,xK(n)),nve={code:wK,name:eve,encode:xK,digest:tve};var ive=Object.freeze({__proto__:null,identity:nve});new TextEncoder,new TextDecoder;const V5={...X0e,...Q0e,...J0e,...tye,...rye,...pye,...yye,...xye,...Aye,...Rye};({...Jye,...ive});function bK(n,e,t,i){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:t},decoder:{decode:i}}}const H5=bK("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),HP=bK("ascii","a",n=>{let e="a";for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);return e},n=>{n=n.substring(1);const e=uK(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return e}),_K={utf8:H5,"utf-8":H5,hex:V5.base16,latin1:HP,ascii:HP,binary:HP,...V5};function m2(n,e="utf8"){const t=_K[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("utf8"):t.encoder.encode(n).substring(1)}function J0(n,e="utf8"){const t=_K[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?oL(globalThis.Buffer.from(n,"utf-8")):t.decoder.decode(`${t.prefix}${n}`)}function $5(n){return hp(m2(J0(n,d2),lK))}function YS(n){return m2(J0(iu(n),lK),d2)}function EK(n){const e=J0(L0e,U5),t=O0e+m2(hK([e,n]),U5);return[N0e,D0e,t].join(R0e)}function rve(n){return m2(n,d2)}function sve(n){return J0(n,d2)}function ove(n){return J0([YS(n.header),YS(n.payload)].join(XS),cK)}function ave(n){return[YS(n.header),YS(n.payload),rve(n.signature)].join(XS)}function vR(n){const e=n.split(XS),t=$5(e[0]),i=$5(e[1]),r=sve(e[2]),s=J0(e.slice(0,2).join(XS),cK);return{header:t,payload:i,signature:r,data:s}}function G5(n=Qq(U0e)){const e=aK.getPublicKey(n);return{secretKey:hK([n,e]),publicKey:e}}async function lve(n,e,t,i,r=Be.fromMiliseconds(Date.now())){const s={alg:C0e,typ:I0e},o=EK(i.publicKey),a=r+t,l={iss:o,sub:n,aud:e,iat:r,exp:a},c=ove({header:s,payload:l}),u=aK.sign(c,i.secretKey.slice(0,32));return ave({header:s,payload:l,signature:u})}function aL(n){return globalThis.Buffer!=null?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n}function SK(n=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?aL(globalThis.Buffer.allocUnsafe(n)):new Uint8Array(n)}function Jv(n,e){e||(e=n.reduce((r,s)=>r+s.length,0));const t=SK(e);let i=0;for(const r of n)t.set(r,i),i+=r.length;return aL(t)}function cve(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var r=0;r<n.length;r++){var s=n.charAt(r),o=s.charCodeAt(0);if(t[o]!==255)throw new TypeError(s+" is ambiguous");t[o]=r}var a=n.length,l=n.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var v=0,w=0,y=0,_=g.length;y!==_&&g[y]===0;)y++,v++;for(var x=(_-y)*u+1>>>0,S=new Uint8Array(x);y!==_;){for(var M=g[y],A=0,I=x-1;(M!==0||A<w)&&I!==-1;I--,A++)M+=256*S[I]>>>0,S[I]=M%a>>>0,M=M/a>>>0;if(M!==0)throw new Error("Non-zero carry");w=A,y++}for(var D=x-w;D!==x&&S[D]===0;)D++;for(var k=l.repeat(v);D<x;++D)k+=n.charAt(S[D]);return k}function f(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var v=0;if(g[v]!==" "){for(var w=0,y=0;g[v]===l;)w++,v++;for(var _=(g.length-v)*c+1>>>0,x=new Uint8Array(_);g[v];){var S=t[g.charCodeAt(v)];if(S===255)return;for(var M=0,A=_-1;(S!==0||M<y)&&A!==-1;A--,M++)S+=a*x[A]>>>0,x[A]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");y=M,v++}if(g[v]!==" "){for(var I=_-y;I!==_&&x[I]===0;)I++;for(var D=new Uint8Array(w+(_-I)),k=w;I!==_;)D[k++]=x[I++];return D}}}function m(g){var v=f(g);if(v)return v;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:f,decode:m}}var uve=cve,hve=uve;const fve=n=>{if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")},dve=n=>new TextEncoder().encode(n),pve=n=>new TextDecoder().decode(n);class mve{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class gve{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name}
179 decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return AK(this,e)}}class yve{constructor(e){this.decoders=e}or(e){return AK(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const AK=(n,e)=>new yve({...n.decoders||{[n.prefix]:n},...e.decoders||{[e.prefix]:e}});class vve{constructor(e,t,i,r){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=r,this.encoder=new mve(e,t,i),this.decoder=new gve(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const g2=({name:n,prefix:e,encode:t,decode:i})=>new vve(n,e,t,i),Y1=({prefix:n,name:e,alphabet:t})=>{const{encode:i,decode:r}=hve(t,e);return g2({prefix:n,name:e,encode:i,decode:s=>fve(r(s))})},wve=(n,e,t,i)=>{const r={};for(let u=0;u<e.length;++u)r[e[u]]=u;let s=n.length;for(;n[s-1]==="=";)--s;const o=new Uint8Array(s*t/8|0);let a=0,l=0,c=0;for(let u=0;u<s;++u){const h=r[n[u]];if(h===void 0)throw new SyntaxError(`Non-${i} character`);l=l<<t|h,a+=t,a>=8&&(a-=8,o[c++]=255&l>>a)}if(a>=t||255&l<<8-a)throw new SyntaxError("Unexpected end of data");return o},xve=(n,e,t)=>{const i=e[e.length-1]==="=",r=(1<<t)-1;let s="",o=0,a=0;for(let l=0;l<n.length;++l)for(a=a<<8|n[l],o+=8;o>t;)o-=t,s+=e[r&a>>o];if(o&&(s+=e[r&a<<t-o]),i)for(;s.length*t&7;)s+="=";return s},gr=({name:n,prefix:e,bitsPerChar:t,alphabet:i})=>g2({prefix:e,name:n,encode(r){return xve(r,i,t)},decode(r){return wve(r,i,t,n)}}),bve=g2({prefix:"\0",name:"identity",encode:n=>pve(n),decode:n=>dve(n)}),_ve=Object.freeze(Object.defineProperty({__proto__:null,identity:bve},Symbol.toStringTag,{value:"Module"})),Eve=gr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Sve=Object.freeze(Object.defineProperty({__proto__:null,base2:Eve},Symbol.toStringTag,{value:"Module"})),Ave=gr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Mve=Object.freeze(Object.defineProperty({__proto__:null,base8:Ave},Symbol.toStringTag,{value:"Module"})),Tve=Y1({prefix:"9",name:"base10",alphabet:"0123456789"}),Pve=Object.freeze(Object.defineProperty({__proto__:null,base10:Tve},Symbol.toStringTag,{value:"Module"})),Cve=gr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Ive=gr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Rve=Object.freeze(Object.defineProperty({__proto__:null,base16:Cve,base16upper:Ive},Symbol.toStringTag,{value:"Module"})),Nve=gr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Dve=gr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ove=gr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Lve=gr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Uve=gr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Bve=gr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),kve=gr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Fve=gr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),zve=gr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),Vve=Object.freeze(Object.defineProperty({__proto__:null,base32:Nve,base32hex:Uve,base32hexpad:kve,base32hexpadupper:Fve,base32hexupper:Bve,base32pad:Ove,base32padupper:Lve,base32upper:Dve,base32z:zve},Symbol.toStringTag,{value:"Module"})),Hve=Y1({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),$ve=Y1({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Gve=Object.freeze(Object.defineProperty({__proto__:null,base36:Hve,base36upper:$ve},Symbol.toStringTag,{value:"Module"})),jve=Y1({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Wve=Y1({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),qve=Object.freeze(Object.defineProperty({__proto__:null,base58btc:jve,base58flickr:Wve},Symbol.toStringTag,{value:"Module"})),Kve=gr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
179+/",bitsPerChar:6}),Xve=gr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Yve=gr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Qve=gr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Zve=Object.freeze(Object.defineProperty({__proto__:null,base64:Kve,base64pad:Xve,base64url:Yve,base64urlpad:Qve},Symbol.toStringTag,{value:"Module"})),MK=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Jve=MK.reduce((n,e,t)=>(n[t]=e,n),[]),ewe=MK.reduce((n,e,t)=>(n[e.codePointAt(0)]=t,n),[]);function twe(n){return n.reduce((e,t)=>(e+=Jve[t],e),"")}function nwe(n){const e=[];for(const t of n){const i=ewe[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const iwe=g2({prefix:"🚀",name:"base256emoji",encode:twe,decode:nwe}),rwe=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:iwe},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const j5={..._ve,...Sve,...Mve,...Pve,...Rve,...Vve,...Gve,...qve,...Zve,...rwe};function TK(n,e,t,i){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:t},decoder:{decode:i}}}const W5=TK("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),$P=TK("ascii","a",n=>{let e="a";for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);return e},n=>{n=n.substring(1);const e=SK(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return e}),PK={utf8:W5,"utf-8":W5,hex:j5.base16,latin1:$P,ascii:$P,binary:$P,...j5};function ia(n,e="utf8"){const t=PK[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?aL(globalThis.Buffer.from(n,"utf-8")):t.decoder.decode(`${t.prefix}${n}`)}function Bs(n,e="utf8"){const t=PK[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("utf8"):t.encoder.encode(n).substring(1)}const swe={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},owe="Input must be an string, Buffer or Uint8Array";function awe(n){let e;if(n instanceof Uint8Array)e=n;else if(typeof n=="string")e=new TextEncoder().encode(n);else throw new Error(owe);return e}function lwe(n){return Array.prototype.map.call(n,function(e){return(e<16?"0":"")+e.toString(16)}).join("")}function Yb(n){return(4294967296+n).toString(16).substring(1)}function cwe(n,e,t){let i=`
180`+n+" = ";for(let r=0;r<e.length;r+=2){if(t===32)i+=Yb(e[r]).toUpperCase(),i+=" ",i+=Yb(e[r+1]).toUpperCase();else if(t===64)i+=Yb(e[r+1]).toUpperCase(),i+=Yb(e[r]).toUpperCase();else throw new Error("Invalid size "+t);r%6===4?i+=`
181`+new Array(n.length+4).join(" "):r<e.length-2&&(i+=" ")}console.log(i)}function uwe(n,e,t){let i=new Date().getTime();
vendor: 38,536 bytes, line 181
181const r=new Uint8Array(e);for(let o=0;o<e;o++)r[o]=o%256;const s=new Date().getTime();console.log("Generated random input in "+(s-i)+"ms"),i=s;for(let o=0;o<t;o++){const a=n(r),l=new Date().getTime(),c=l-i;i=l,console.log("Hashed in "+c+"ms: "+a.substring(0,20)+"..."),console.log(Math.round(e/(1<<20)/(c/1e3)*100)/100+" MB PER SECOND")}}var CK={normalizeInput:awe,toHex:lwe,debugPrint:cwe,testSpeed:uwe};const kE=CK;function Qb(n,e,t){const i=n[e]+n[t];let r=n[e+1]+n[t+1];i>=4294967296&&r++,n[e]=i,n[e+1]=r}function q5(n,e,t,i){let r=n[e]+t;t<0&&(r+=4294967296);let s=n[e+1]+i;r>=4294967296&&s++,n[e]=r,n[e+1]=s}function IK(n,e){return n[e]^n[e+1]<<8^n[e+2]<<16^n[e+3]<<24}function Ru(n,e,t,i,r,s){const o=Nv[r],a=Nv[r+1],l=Nv[s],c=Nv[s+1];Qb(Rt,n,e),q5(Rt,n,o,a);let u=Rt[i]^Rt[n],h=Rt[i+1]^Rt[n+1];Rt[i]=h,Rt[i+1]=u,Qb(Rt,t,i),u=Rt[e]^Rt[t],h=Rt[e+1]^Rt[t+1],Rt[e]=u>>>24^h<<8,Rt[e+1]=h>>>24^u<<8,Qb(Rt,n,e),q5(Rt,n,l,c),u=Rt[i]^Rt[n],h=Rt[i+1]^Rt[n+1],Rt[i]=u>>>16^h<<16,Rt[i+1]=h>>>16^u<<16,Qb(Rt,t,i),u=Rt[e]^Rt[t],h=Rt[e+1]^Rt[t+1],Rt[e]=h>>>31^u<<1,Rt[e+1]=u>>>31^h<<1}const RK=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),hwe=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],Sr=new Uint8Array(hwe.map(function(n){return n*2})),Rt=new Uint32Array(32),Nv=new Uint32Array(32);function NK(n,e){let t=0;for(t=0;t<16;t++)Rt[t]=n.h[t],Rt[t+16]=RK[t];for(Rt[24]=Rt[24]^n.t,Rt[25]=Rt[25]^n.t/4294967296,e&&(Rt[28]=~Rt[28],Rt[29]=~Rt[29]),t=0;t<32;t++)Nv[t]=IK(n.b,4*t);for(t=0;t<12;t++)Ru(0,8,16,24,Sr[t*16+0],Sr[t*16+1]),Ru(2,10,18,26,Sr[t*16+2],Sr[t*16+3]),Ru(4,12,20,28,Sr[t*16+4],Sr[t*16+5]),Ru(6,14,22,30,Sr[t*16+6],Sr[t*16+7]),Ru(0,10,20,30,Sr[t*16+8],Sr[t*16+9]),Ru(2,12,22,24,Sr[t*16+10],Sr[t*16+11]),Ru(4,14,16,26,Sr[t*16+12],Sr[t*16+13]),Ru(6,8,18,28,Sr[t*16+14],Sr[t*16+15]);for(t=0;t<16;t++)n.h[t]=n.h[t]^Rt[t]^Rt[t+16]}const Nu=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function DK(n,e,t,i){if(n===0||n>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(e&&e.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(t&&t.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(i&&i.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const r={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:n};Nu.fill(0),Nu[0]=n,e&&(Nu[1]=e.length),Nu[2]=1,Nu[3]=1,t&&Nu.set(t,32),i&&Nu.set(i,48);for(let s=0;s<16;s++)r.h[s]=RK[s]^IK(Nu,s*4);return e&&(lL(r,e),r.c=128),r}function lL(n,e){for(let t=0;t<e.length;t++)n.c===128&&(n.t+=n.c,NK(n,!1),n.c=0),n.b[n.c++]=e[t]}function OK(n){for(n.t+=n.c;n.c<128;)n.b[n.c++]=0;NK(n,!0);const e=new Uint8Array(n.outlen);for(let t=0;t<n.outlen;t++)e[t]=n.h[t>>2]>>8*(t&3);return e}function LK(n,e,t,i,r){t=t||64,n=kE.normalizeInput(n),i&&(i=kE.normalizeInput(i)),r&&(r=kE.normalizeInput(r));const s=DK(t,e,i,r);return lL(s,n),OK(s)}function fwe(n,e,t,i,r){const s=LK(n,e,t,i,r);return kE.toHex(s)}var dwe={blake2b:LK,blake2bHex:fwe,blake2bInit:DK,blake2bUpdate:lL,blake2bFinal:OK};const UK=CK;function pwe(n,e){return n[e]^n[e+1]<<8^n[e+2]<<16^n[e+3]<<24}function Du(n,e,t,i,r,s){an[n]=an[n]+an[e]+r,an[i]=Zb(an[i]^an[n],16),an[t]=an[t]+an[i],an[e]=Zb(an[e]^an[t],12),an[n]=an[n]+an[e]+s,an[i]=Zb(an[i]^an[n],8),an[t]=an[t]+an[i],an[e]=Zb(an[e]^an[t],7)}function Zb(n,e){return n>>>e^n<<32-e}const BK=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ar=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),an=new Uint32Array(16),nr=new Uint32Array(16);function kK(n,e){let t=0;for(t=0;t<8;t++)an[t]=n.h[t],an[t+8]=BK[t];for(an[12]^=n.t,an[13]^=n.t/4294967296,e&&(an[14]=~an[14]),t=0;t<16;t++)nr[t]=pwe(n.b,4*t);for(t=0;t<10;t++)Du(0,4,8,12,nr[Ar[t*16+0]],nr[Ar[t*16+1]]),Du(1,5,9,13,nr[Ar[t*16+2]],nr[Ar[t*16+3]]),Du(2,6,10,14,nr[Ar[t*16+4]],nr[Ar[t*16+5]]),Du(3,7,11,15,nr[Ar[t*16+6]],nr[Ar[t*16+7]]),Du(0,5,10,15,nr[Ar[t*16+8]],nr[Ar[t*16+9]]),Du(1,6,11,12,nr[Ar[t*16+10]],nr[Ar[t*16+11]]),Du(2,7,8,13,nr[Ar[t*16+12]],nr[Ar[t*16+13]]),Du(3,4,9,14,nr[Ar[t*16+14]],nr[Ar[t*16+15]]);for(t=0;t<8;t++)n.h[t]^=an[t]^an[t+8]}function FK(n,e){if(!(n>0&&n<=32))throw new Error("Incorrect output length, should be in [1, 32]");const t=e?e.length:0;if(e&&!(t>0&&t<=32))throw new Error("Incorrect key length, should be in [1, 32]");const i={h:new Uint32Array(BK),b:new Uint8Array(64),c:0,t:0,outlen:n};return i.h[0]^=16842752^t<<8^n,t>0&&(cL(i,e),i.c=64),i}function cL(n,e){for(let t=0;t<e.length;t++)n.c===64&&(n.t+=n.c,kK(n,!1),n.c=0),n.b[n.c++]=e[t]}function zK(n){for(n.t+=n.c;n.c<64;)n.b[n.c++]=0;kK(n,!0);const e=new Uint8Array(n.outlen);for(let t=0;t<n.outlen;t++)e[t]=n.h[t>>2]>>8*(t&3)&255;return e}function VK(n,e,t){t=t||32,n=UK.normalizeInput(n);const i=FK(t,e);return cL(i,n),zK(i)}function mwe(n,e,t){const i=VK(n,e,t);return UK.toHex(i)}var gwe={blake2s:VK,blake2sHex:mwe,blake2sInit:FK,blake2sUpdate:cL,blake2sFinal:zK};const qy=dwe,Ky=gwe;var ywe={blake2b:qy.blake2b,blake2bHex:qy.blake2bHex,blake2bInit:qy.blake2bInit,blake2bUpdate:qy.blake2bUpdate,blake2bFinal:qy.blake2bFinal,blake2s:Ky.blake2s,blake2sHex:Ky.blake2sHex,blake2sInit:Ky.blake2sInit,blake2sUpdate:Ky.blake2sUpdate,blake2sFinal:Ky.blake2sFinal},y2={exports:{}};function vwe(n){try{return JSON.stringify(n)}catch{return'"[Circular]"'}}var wwe=xwe;function xwe(n,e,t){var i=t&&t.stringify||vwe,r=1;if(typeof n=="object"&&n!==null){var s=e.length+r;if(s===1)return n;var o=new Array(s);o[0]=i(n);for(var a=1;a<s;a++)o[a]=i(e[a]);return o.join(" ")}if(typeof n!="string")return n;var l=e.length;if(l===0)return n;for(var c="",u=1-r,h=-1,f=n&&n.length||0,m=0;m<f;){if(n.charCodeAt(m)===37&&m+1<f){switch(h=h>-1?h:0,n.charCodeAt(m+1)){case 100:case 102:if(u>=l||e[u]==null)break;h<m&&(c+=n.slice(h,m)),c+=Number(e[u]),h=m+2,m++;break;case 105:if(u>=l||e[u]==null)break;h<m&&(c+=n.slice(h,m)),c+=Math.floor(Number(e[u])),h=m+2,m++;break;case 79:case 111:case 106:if(u>=l||e[u]===void 0)break;h<m&&(c+=n.slice(h,m));var g=typeof e[u];if(g==="string"){c+="'"+e[u]+"'",h=m+2,m++;break}if(g==="function"){c+=e[u].name||"<anonymous>",h=m+2,m++;break}c+=i(e[u]),h=m+2,m++;break;case 115:if(u>=l)break;h<m&&(c+=n.slice(h,m)),c+=String(e[u]),h=m+2,m++;break;case 37:h<m&&(c+=n.slice(h,m)),c+="%",h=m+2,m++,u--;break}++u}++m}return h===-1?n:(h<f&&(c+=n.slice(h)),c)}const K5=wwe;y2.exports=ru;const qw=Lwe().console||{},bwe={mapHttpRequest:Jb,mapHttpResponse:Jb,wrapRequestSerializer:GP,wrapResponseSerializer:GP,wrapErrorSerializer:GP,req:Jb,res:Jb,err:Y5,errWithCause:Y5};function Th(n,e){return n==="silent"?1/0:e.levels.values[n]}const uL=Symbol("pino.logFuncs"),wR=Symbol("pino.hierarchy"),_we={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function X5(n,e){const t={logger:e,parent:n[wR]};e[wR]=t}function Ewe(n,e,t){const i={};e.forEach(r=>{i[r]=t[r]?t[r]:qw[r]||qw[_we[r]||"log"]||Mg}),n[uL]=i}function Swe(n,e){return Array.isArray(n)?n.filter(function(i){return i!=="!stdSerializers.err"}):n===!0?Object.keys(e):!1}function ru(n){n=n||{},n.browser=n.browser||{};const e=n.browser.transmit;if(e&&typeof e.send!="function")throw Error("pino: transmit option must have a send function");const t=n.browser.write||qw;n.browser.write&&(n.browser.asObject=!0);const i=n.serializers||{},r=Swe(n.browser.serialize,i);let s=n.browser.serialize;Array.isArray(n.browser.serialize)&&n.browser.serialize.indexOf("!stdSerializers.err")>-1&&(s=!1);const o=Object.keys(n.customLevels||{}),a=["error","fatal","warn","info","debug","trace"].concat(o);typeof t=="function"&&a.forEach(function(v){t[v]=t}),(n.enabled===!1||n.browser.disabled)&&(n.level="silent");const l=n.level||"info",c=Object.create(t);c.log||(c.log=Mg),Ewe(c,a,t),X5({},c),Object.defineProperty(c,"levelVal",{get:h}),Object.defineProperty(c,"level",{get:f,set:m});const u={transmit:e,serialize:r,asObject:n.browser.asObject,asObjectBindingsOnly:n.browser.asObjectBindingsOnly,formatters:n.browser.formatters,levels:a,timestamp:Nwe(n),messageKey:n.messageKey||"msg",onChild:n.onChild||Mg};c.levels=Awe(n),c.level=l,c.isLevelEnabled=function(v){return this.levels.values[v]?this.levels.values[v]>=this.levels.values[this.level]:!1},c.setMaxListeners=c.getMaxListeners=c.emit=c.addListener=c.on=c.prependListener=c.once=c.prependOnceListener=c.removeListener=c.removeAllListeners=c.listeners=c.listenerCount=c.eventNames=c.write=c.flush=Mg,c.serializers=i,c._serialize=r,c._stdErrSerialize=s,c.child=function(...v){return g.call(this,u,...v)},e&&(c._logEvent=xR());function h(){return Th(this.level,this)}function f(){return this._level}function m(v){if(v!=="silent"&&!this.levels.values[v])throw Error("unknown level "+v);this._level=v,Af(this,u,c,"error"),Af(this,u,c,"fatal"),Af(this,u,c,"warn"),Af(this,u,c,"info"),Af(this,u,c,"debug"),Af(this,u,c,"trace"),o.forEach(w=>{Af(this,u,c,w)})}function g(v,w,y){if(!w)throw new Error("missing bindings for child Pino");y=y||{},r&&w.serializers&&(y.serializers=w.serializers);const _=y.serializers;if(r&&_){var x=Object.assign({},i,_),S=n.browser.serialize===!0?Object.keys(x):r;delete w.serializers,hL([w],S,x,this._stdErrSerialize)}function M(I){this._childLevel=(I._childLevel|0)+1,this.bindings=w,x&&(this.serializers=x,this._serialize=S),e&&(this._logEvent=xR([].concat(I._logEvent.bindings,w)))}M.prototype=this;const A=new M(this);return X5(this,A),A.child=function(...I){return g.call(this,v,...I)},A.level=y.level||this.level,v.onChild(A),A}return c}function Awe(n){const e=n.customLevels||{},t=Object.assign({},ru.levels.values,e),i=Object.assign({},ru.levels.labels,Mwe(e));return{values:t,labels:i}}function Mwe(n){const e={};return Object.keys(n).forEach(function(t){e[n[t]]=t}),e}ru.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};ru.stdSerializers=bwe;ru.stdTimeFunctions=Object.assign({},{nullTime:HK,epochTime:$K,unixTime:Dwe,isoTime:Owe});function Twe(n){const e=[];n.bindings&&e.push(n.bindings);let t=n[wR];for(;t.parent;)t=t.parent,t.logger.bindings&&e.push(t.logger.bindings);return e.reverse()}function Af(n,e,t,i){if(Object.defineProperty(n,i,{value:Th(n.level,t)>Th(i,t)?Mg:t[uL][i],writable:!0,enumerable:!0,configurable:!0}),n[i]===Mg){if(!e.transmit)return;const s=e.transmit.level||n.level,o=Th(s,t);if(Th(i,t)<o)return}n[i]=Cwe(n,e,t,i);const r=Twe(n);r.length!==0&&(n[i]=Pwe(r,n[i]))}function Pwe(n,e){return function(){return e.apply(this,[...n,...arguments])}}function Cwe(n,e,t,i){return function(r){return function(){const o=e.timestamp(),a=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===qw?qw:this;for(var c=0;c<a.length;c++)a[c]=arguments[c];var u=!1;if(e.serialize&&(hL(a,this._serialize,this.serializers,this._stdErrSerialize),u=!0),e.asObject||e.formatters?r.call(l,...Iwe(this,i,a,o,e)):r.apply(l,a),e.transmit){const h=e.transmit.level||n._level,f=Th(h,t),m=Th(i,t);if(m<f)return;Rwe(this,{ts:o,methodLevel:i,methodValue:m,transmitLevel:h,transmitValue:t.levels.values[e.transmit.level||n._level],send:e.transmit.send,val:Th(n._level,t)},a,u)}}}(n[uL][i])}function Iwe(n,e,t,i,r){const{level:s,log:o=h=>h}=r.formatters||{},a=t.slice();let l=a[0];const c={};let u=(n._childLevel|0)+1;if(u<1&&(u=1),i&&(c.time=i),s){const h=s(e,n.levels.values[e]);Object.assign(c,h)}else c.level=n.levels.values[e];if(r.asObjectBindingsOnly){if(l!==null&&typeof l=="object")for(;u--&&typeof a[0]=="object";)Object.assign(c,a.shift());return[o(c),...a]}else{if(l!==null&&typeof l=="object"){for(;u--&&typeof a[0]=="object";)Object.assign(c,a.shift());l=a.length?K5(a.shift(),a):void 0}else typeof l=="string"&&(l=K5(a.shift(),a));return l!==void 0&&(c[r.messageKey]=l),[o(c)]}}function hL(n,e,t,i){for(const r in n)if(i&&n[r]instanceof Error)n[r]=ru.stdSerializers.err(n[r]);else if(typeof n[r]=="object"&&!Array.isArray(n[r])&&e)for(const s in n[r])e.indexOf(s)>-1&&s in t&&(n[r][s]=t[s](n[r][s]))}function Rwe(n,e,t,i=!1){const r=e.send,s=e.ts,o=e.methodLevel,a=e.methodValue,l=e.val,c=n._logEvent.bindings;i||hL(t,n._serialize||Object.keys(n.serializers),n.serializers,n._stdErrSerialize===void 0?!0:n._stdErrSerialize),n._logEvent.ts=s,n._logEvent.messages=t.filter(function(u){return c.indexOf(u)===-1}),n._logEvent.level.label=o,n._logEvent.level.value=a,r(o,n._logEvent,l),n._logEvent=xR(c)}function xR(n){return{ts:0,messages:[],bindings:n||[],level:{label:"",value:0}}}function Y5(n){const e={type:n.constructor.name,msg:n.message,stack:n.stack};for(const t in n)e[t]===void 0&&(e[t]=n[t]);return e}function Nwe(n){return typeof n.timestamp=="function"?n.timestamp:n.timestamp===!1?HK:$K}function Jb(){return{}}function GP(n){return n}function Mg(){}function HK(){return!1}function $K(){return Date.now()}function Dwe(){return Math.round(Date.now()/1e3)}function Owe(){return new Date(Date.now()).toISOString()}function Lwe(){function n(e){return typeof e<"u"&&e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return n(self)||n(window)||n(this)||{}}}y2.exports.default=ru;y2.exports.pino=ru;var Om=y2.exports;const GK=AA(Om),Uwe={level:"info"},v2="custom_context",fL=1e3*1024;var Bwe=Object.defineProperty,kwe=(n,e,t)=>e in n?Bwe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,rh=(n,e,t)=>kwe(n,typeof e!="symbol"?e+"":e,t);let Fwe=class{constructor(e){rh(this,"nodeValue"),rh(this,"sizeInBytes"),rh(this,"next"),this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},Q5=class{constructor(e){rh(this,"lengthInNodes"),rh(this,"sizeInBytes"),rh(this,"head"),rh(this,"tail"),rh(this,"maxSizeInBytes"),this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){const t=new Fwe(e);if(t.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;const e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){const e=[];let t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};const t=e.value;return e=e.next,{done:!1,value:t}}}}};var zwe=Object.defineProperty,Vwe=(n,e,t)=>e in n?zwe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,e_=(n,e,t)=>Vwe(n,typeof e!="symbol"?e+"":e,t);let jK=class{constructor(e,t=fL){e_(this,"logs"),e_(this,"level"),e_(this,"levelValue"),e_(this,"MAX_LOG_SIZE_IN_BYTES"),this.level=e??"error",this.levelValue=Om.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new Q5(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===Om.levels.values.error?console.error(e):t===Om.levels.values.warn?console.warn(e):t===Om.levels.values.debug?console.debug(e):t===Om.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(iu({timestamp:new Date().toISOString(),log:e}));const t=typeof e=="string"?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new Q5(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const t=this.getLogArray();return t.push(iu({extraMetadata:e})),new Blob(t,{type:"application/json"})}};var Hwe=Object.defineProperty,$we=(n,e,t)=>e in n?Hwe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Gwe=(n,e,t)=>$we(n,e+"",t);let jwe=class{constructor(e,t=fL){Gwe(this,"baseChunkLogger"),this.baseChunkLogger=new jK(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){const t=URL.createObjectURL(this.logsToBlob(e)),i=document.createElement("a");i.href=t,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(t)}};var Wwe=Object.defineProperty,qwe=(n,e,t)=>e in n?Wwe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Kwe=(n,e,t)=>qwe(n,e+"",t);let Xwe=class{constructor(e,t=fL){Kwe(this,"baseChunkLogger"),this.baseChunkLogger=new jK(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}};var Ywe=Object.defineProperty,Qwe=Object.defineProperties,Zwe=Object.getOwnPropertyDescriptors,Z5=Object.getOwnPropertySymbols,Jwe=Object.prototype.hasOwnProperty,e1e=Object.prototype.propertyIsEnumerable,J5=(n,e,t)=>e in n?Ywe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,QS=(n,e)=>{for(var t in e||(e={}))Jwe.call(e,t)&&J5(n,t,e[t]);if(Z5)for(var t of Z5(e))e1e.call(e,t)&&J5(n,t,e[t]);return n},ZS=(n,e)=>Qwe(n,Zwe(e));function t1e(n){return ZS(QS({},n),{level:(n==null?void 0:n.level)||Uwe.level})}function n1e(n,e,t=v2){return n[t]=e,n}function Vs(n,e=v2){return n[e]||""}function i1e(n,e,t=v2){const i=Vs(n,t);return i.trim()?`${i}/${e}`:e}function Eo(n,e,t=v2){const i=i1e(n,e,t),r=n.child({context:i});return n1e(r,i,t)}function r1e(n){var e,t;const i=new jwe((e=n.opts)==null?void 0:e.level,n.maxSizeInBytes);return{logger:GK(ZS(QS({},n.opts),{level:"trace",browser:ZS(QS({},(t=n.opts)==null?void 0:t.browser),{write:r=>i.write(r)})})),chunkLoggerController:i}}function s1e(n){var e;const t=new Xwe((e=n.opts)==null?void 0:e.level,n.maxSizeInBytes);return{logger:GK(ZS(QS({},n.opts),{level:"trace"}),t),chunkLoggerController:t}}function WK(n){return typeof n.loggerOverride<"u"&&typeof n.loggerOverride!="string"?{logger:n.loggerOverride,chunkLoggerController:null}:typeof window<"u"?r1e(n):s1e(n)}var o1e={};const a1e=":";function Wc(n){const[e,t]=n.split(a1e);return{namespace:e,reference:t}}function e6(n,e=[]){const t=[];return Object.keys(n).forEach(i=>{if(e.length&&!e.includes(i))return;const r=n[i];t.push(...r.accounts)}),t}function qK(n,e){return n.includes(":")?[n]:e.chains||[]}var l1e=Object.defineProperty,c1e=Object.defineProperties,u1e=Object.getOwnPropertyDescriptors,t6=Object.getOwnPropertySymbols,h1e=Object.prototype.hasOwnProperty,f1e=Object.prototype.propertyIsEnumerable,bR=(n,e,t)=>e in n?l1e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,n6=(n,e)=>{for(var t in e||(e={}))h1e.call(e,t)&&bR(n,t,e[t]);if(t6)for(var t of t6(e))f1e.call(e,t)&&bR(n,t,e[t]);return n},d1e=(n,e)=>c1e(n,u1e(e)),i6=(n,e,t)=>bR(n,typeof e!="symbol"?e+"":e,t);const p1e="ReactNative",fo={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},m1e="js";function JS(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function sf(){return!cp()&&!!HO()&&navigator.product===p1e}function g1e(){return sf()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function y1e(){return sf()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function ey(){return!JS()&&!!HO()&&!!cp()}function Q1(){return sf()?fo.reactNative:JS()?fo.node:ey()?fo.browser:fo.unknown}function r6(){var n;try{return sf()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(n=global.Application)==null?void 0:n.applicationId:void 0}catch{return}}function v1e(n,e){const t=new URLSearchParams(n);return Object.entries(e).sort(([i],[r])=>i.localeCompare(r)).forEach(([i,r])=>{r!=null&&t.set(i,String(r))}),t.toString()}function w1e(n){var e,t;const i=KK();try{return n!=null&&n.url&&i.url&&new URL(n.url).host!==new URL(i.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${n.url} differs from the actual page url:${i.url}. This is probably unintended and can lead to issues.`),n.url=i.url),(e=n==null?void 0:n.icons)!=null&&e.length&&n.icons.length>0&&(n.icons=n.icons.filter(r=>r!=="")),d1e(n6(n6({},i),n),{url:(n==null?void 0:n.url)||i.url,name:(n==null?void 0:n.name)||i.name,description:(n==null?void 0:n.description)||i.description,icons:(t=n==null?void 0:n.icons)!=null&&t.length&&n.icons.length>0?n.icons:i.icons})}catch(r){return console.warn("Error populating app metadata",r),n||i}}function KK(){return oq()||{name:"",description:"",url:"",icons:[""]}}function x1e(){if(Q1()===fo.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:t,Version:i}=global.Platform;return[t,i].join("-")}const n=Lfe();if(n===null)return"unknown";const e=n.os?n.os.replace(" ","").toLowerCase():"unknown";return n.type==="browser"?[e,n.name,n.version].join("-"):[e,n.version].join("-")}function b1e(){var n;const e=Q1();return e===fo.browser?[e,((n=sq())==null?void 0:n.host)||"unknown"].join(":"):e}function XK(n,e,t){const i=x1e(),r=b1e();return[[n,e].join("-"),[m1e,t].join("-"),i,r].join("/")}function _1e({protocol:n,version:e,relayUrl:t,sdkVersion:i,auth:r,projectId:s,useOnCloseEvent:o,bundleId:a,packageName:l}){const c=t.split("?"),u=XK(n,e,i),h={auth:r,ua:u,projectId:s,useOnCloseEvent:o||void 0,packageName:l||void 0,bundleId:a||void 0},f=v1e(c[1]||"",h);return c[0]+"?"+f}function md(n,e){return n.filter(t=>e.includes(t)).length===n.length}function _R(n){return Object.fromEntries(n.entries())}function ER(n){return new Map(Object.entries(n))}function qf(n=Be.FIVE_MINUTES,e){const t=Be.toMiliseconds(n||Be.FIVE_MINUTES);let i,r,s,o;return{resolve:a=>{s&&i&&(clearTimeout(s),i(a),o=Promise.resolve(a))},reject:a=>{s&&r&&(clearTimeout(s),r(a))},done:()=>new Promise((a,l)=>{if(o)return a(o);s=setTimeout(()=>{const c=new Error(e);o=Promise.reject(c),l(c)},t),i=a,r=l})}}function Cl(n,e,t){return new Promise(async(i,r)=>{const s=setTimeout(()=>r(new Error(t)),e);try{const o=await n;i(o)}catch(o){r(o)}clearTimeout(s)})}function YK(n,e){if(typeof e=="string"&&e.startsWith(`${n}:`))return e;if(n.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(n.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${n}`)}function E1e(n){return YK("topic",n)}function S1e(n){return YK("id",n)}function QK(n){const[e,t]=n.split(":"),i={id:void 0,topic:void 0};if(e==="topic"&&typeof t=="string")i.topic=t;else if(e==="id"&&Number.isInteger(Number(t)))i.id=Number(t);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${t}`);return i}function xi(n,e){return Be.fromMiliseconds(Date.now()+Be.toMiliseconds(n))}function Sl(n){return Date.now()>=Be.toMiliseconds(n)}function dn(n,e){return`${n}${e?`:${e}`:""}`}function Ul(n=[],e=[]){return[...new Set([...n,...e])]}async function A1e({id:n,topic:e,wcDeepLink:t}){var i;try{if(!t)return;const r=typeof t=="string"?JSON.parse(t):t,s=r==null?void 0:r.href;if(typeof s!="string")return;const o=M1e(s,n,e),a=Q1();if(a===fo.browser){if(!((i=cp())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}T1e(o)}else a===fo.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(r){console.error(r)}}function M1e(n,e,t){const i=`requestId=${e}&sessionTopic=${t}`;n.endsWith("/")&&(n=n.slice(0,-1));let r=`${n}`;if(n.startsWith("https://t.me")){const s=n.includes("?")?"&startapp=":"?startapp=";r=`${r}${s}${R1e(i,!0)}`}else r=`${r}/wc?${i}`;return r}function T1e(n){let e="_self";I1e()?e="_top":(C1e()||n.startsWith("https://")||n.startsWith("http://"))&&(e="_blank"),window.open(n,e,"noreferrer noopener")}async function P1e(n,e){let t="";try{if(ey()&&(t=localStorage.getItem(e),t))return t;t=await n.getItem(e)}catch(i){console.error(i)}return t}function s6(n,e){if(!n.includes(e))return null;const t=n.split(/([&,?,=])/),i=t.indexOf(e);return t[i+2]}function o6(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,n=>{const e=Math.random()*16|0;return(n==="x"?e:e&3|8).toString(16)})}function dL(){return typeof process<"u"&&o1e.IS_VITEST==="true"}function C1e(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function I1e(){try{return window.self!==window.top}catch{return!1}}function R1e(n,e=!1){const t=Buffer.from(n).toString("base64");return e?t.replace(/[=]/g,""):t}function ZK(n){return Buffer.from(n,"base64").toString("utf-8")}function N1e(n){return new Promise(e=>setTimeout(e,n))}let D1e=class{constructor({limit:e}){i6(this,"limit"),i6(this,"set"),this.limit=e,this.set=new Set}add(e){if(!this.set.has(e)){if(this.set.size>=this.limit){const t=this.set.values().next().value;t&&this.set.delete(t)}this.set.add(e)}}has(e){return this.set.has(e)}};const t_=BigInt(2**32-1),a6=BigInt(32);function JK(n,e=!1){return e?{h:Number(n&t_),l:Number(n>>a6&t_)}:{h:Number(n>>a6&t_)|0,l:Number(n&t_)|0}}function eX(n,e=!1){const t=n.length;let i=new Uint32Array(t),r=new Uint32Array(t);for(let s=0;s<t;s++){const{h:o,l:a}=JK(n[s],e);[i[s],r[s]]=[o,a]}return[i,r]}const l6=(n,e,t)=>n>>>t,c6=(n,e,t)=>n<<32-t|e>>>t,Zu=(n,e,t)=>n>>>t|e<<32-t,Ju=(n,e,t)=>n<<32-t|e>>>t,Dv=(n,e,t)=>n<<64-t|e>>>t-32,Ov=(n,e,t)=>n>>>t-32|e<<64-t,O1e=(n,e)=>e,L1e=(n,e)=>n,U1e=(n,e,t)=>n<<t|e>>>32-t,B1e=(n,e,t)=>e<<t|n>>>32-t,k1e=(n,e,t)=>e<<t-32|n>>>64-t,F1e=(n,e,t)=>n<<t-32|e>>>64-t;function xa(n,e,t,i){const r=(e>>>0)+(i>>>0);return{h:n+t+(r/2**32|0)|0,l:r|0}}const pL=(n,e,t)=>(n>>>0)+(e>>>0)+(t>>>0),mL=(n,e,t,i)=>e+t+i+(n/2**32|0)|0,z1e=(n,e,t,i)=>(n>>>0)+(e>>>0)+(t>>>0)+(i>>>0),V1e=(n,e,t,i,r)=>e+t+i+r+(n/2**32|0)|0,H1e=(n,e,t,i,r)=>(n>>>0)+(e>>>0)+(t>>>0)+(i>>>0)+(r>>>0),$1e=(n,e,t,i,r,s)=>e+t+i+r+s+(n/2**32|0)|0,nm=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function w2(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function su(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function Ha(n,...e){if(!w2(n))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(n.length))throw new Error("Uint8Array expected of length "+e+", got length="+n.length)}function x2(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");su(n.outputLen),su(n.blockLen)}function Xh(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function gL(n,e){Ha(n);const t=e.outputLen;if(n.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function Kw(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function la(...n){for(let e=0;e<n.length;e++)n[e].fill(0)}function jP(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function ol(n,e){return n<<32-e|n>>>e}const tX=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function nX(n){return n<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255}const cc=tX?n=>n:n=>nX(n);function G1e(n){for(let e=0;e<n.length;e++)n[e]=nX(n[e]);return n}const eh=tX?n=>n:G1e,iX=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",j1e=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function Tg(n){if(Ha(n),iX)return n.toHex();let e="";for(let t=0;t<n.length;t++)e+=j1e[n[t]];return e}const ec={_0:48,_9:57,A:65,F:70,a:97,f:102};function u6(n){if(n>=ec._0&&n<=ec._9)return n-ec._0;if(n>=ec.A&&n<=ec.F)return n-(ec.A-10);if(n>=ec.a&&n<=ec.f)return n-(ec.a-10)}function eA(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(iX)return Uint8Array.fromHex(n);const e=n.length,t=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const i=new Uint8Array(t);for(let r=0,s=0;r<t;r++,s+=2){const o=u6(n.charCodeAt(s)),a=u6(n.charCodeAt(s+1));if(o===void 0||a===void 0){const l=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}i[r]=o*16+a}return i}function rX(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function Fa(n){return typeof n=="string"&&(n=rX(n)),Ha(n),n}function sh(...n){let e=0;for(let i=0;i<n.length;i++){const r=n[i];Ha(r),e+=r.length}const t=new Uint8Array(e);for(let i=0,r=0;i<n.length;i++){const s=n[i];t.set(s,r),r+=s.length}return t}let b2=class{};function Z1(n){const e=i=>n().update(Fa(i)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function W1e(n){const e=(i,r)=>n(r).update(Fa(i)).digest(),t=n({});return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=i=>n(i),e}function Ap(n=32){if(nm&&typeof nm.getRandomValues=="function")return nm.getRandomValues(new Uint8Array(n));if(nm&&typeof nm.randomBytes=="function")return Uint8Array.from(nm.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}const q1e=BigInt(0),Xy=BigInt(1),K1e=BigInt(2),X1e=BigInt(7),Y1e=BigInt(256),Q1e=BigInt(113),sX=[],oX=[],aX=[];for(let n=0,e=Xy,t=1,i=0;n<24;n++){[t,i]=[i,(2*t+3*i)%5],sX.push(2*(5*i+t)),oX.push((n+1)*(n+2)/2%64);let r=q1e;for(let s=0;s<7;s++)e=(e<<Xy^(e>>X1e)*Q1e)%Y1e,e&K1e&&(r^=Xy<<(Xy<<BigInt(s))-Xy);aX.push(r)}const lX=eX(aX,!0),Z1e=lX[0],J1e=lX[1],h6=(n,e,t)=>t>32?k1e(n,e,t):U1e(n,e,t),f6=(n,e,t)=>t>32?F1e(n,e,t):B1e(n,e,t);function exe(n,e=24){const t=new Uint32Array(10);for(let i=24-e;i<24;i++){for(let o=0;o<10;o++)t[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,c=t[l],u=t[l+1],h=h6(c,u,1)^t[a],f=f6(c,u,1)^t[a+1];for(let m=0;m<50;m+=10)n[o+m]^=h,n[o+m+1]^=f}let r=n[2],s=n[3];for(let o=0;o<24;o++){const a=oX[o],l=h6(r,s,a),c=f6(r,s,a),u=sX[o];r=n[u],s=n[u+1],n[u]=l,n[u+1]=c}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)t[a]=n[o+a];for(let a=0;a<10;a++)n[o+a]^=~t[(a+2)%10]&t[(a+4)%10]}n[0]^=Z1e[i],n[1]^=J1e[i]}la(t)}let txe=class cX extends b2{constructor(e,t,i,r=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=i,this.enableXOF=r,this.rounds=s,su(i),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Kw(this.state)}clone(){return this._cloneInto()}keccak(){eh(this.state32),exe(this.state32,this.rounds),eh(this.state32),this.posOut=0,this.pos=0}update(e){Xh(this),e=Fa(e),Ha(e);const{blockLen:t,state:i}=this,r=e.length;for(let s=0;s<r;){const o=Math.min(t-this.pos,r-s);for(let a=0;a<o;a++)i[this.pos++]^=e[s++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:i,blockLen:r}=this;e[i]^=t,t&128&&i===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){Xh(this,!1),Ha(e),this.finish();const t=this.state,{blockLen:i}=this;for(let r=0,s=e.length;r<s;){this.posOut>=i&&this.keccak();const o=Math.min(i-this.posOut,s-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return su(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(gL(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,la(this.state)}_cloneInto(e){const{blockLen:t,suffix:i,outputLen:r,rounds:s,enableXOF:o}=this;return e||(e=new cX(t,i,r,o,s)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=s,e.suffix=i,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}};const nxe=(n,e,t)=>Z1(()=>new txe(e,n,t)),ixe=nxe(1,136,256/8);function rxe(n,e,t,i){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,i);const r=BigInt(32),s=BigInt(4294967295),o=Number(t>>r&s),a=Number(t&s),l=i?4:0,c=i?0:4;n.setUint32(e+l,o,i),n.setUint32(e+c,a,i)}function sxe(n,e,t){return n&e^~n&t}function oxe(n,e,t){return n&e^n&t^e&t}let uX=class extends b2{constructor(e,t,i,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=i,this.isLE=r,this.buffer=new Uint8Array(e),this.view=jP(this.buffer)}update(e){Xh(this),e=Fa(e),Ha(e);const{view:t,buffer:i,blockLen:r}=this,s=e.length;for(let o=0;o<s;){const a=Math.min(r-this.pos,s-o);if(a===r){const l=jP(e);for(;r<=s-o;o+=r)this.process(l,o);continue}i.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Xh(this),gL(e,this),this.finished=!0;const{buffer:t,view:i,blockLen:r,isLE:s}=this;let{pos:o}=this;t[o++]=128,la(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(i,0),o=0);for(let h=o;h<r;h++)t[h]=0;rxe(i,r-8,BigInt(this.length*8),s),this.process(i,0);const a=jP(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<c;h++)a.setUint32(4*h,u[h],s)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const i=e.slice(0,t);return this.destroy(),i}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:i,length:r,finished:s,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=s,e.length=r,e.pos=a,r%t&&e.buffer.set(i),e}clone(){return this._cloneInto()}};const Ou=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Mr=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Tr=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),axe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Lu=new Uint32Array(64);class lxe extends uX{constructor(e=32){super(64,e,8,!1),this.A=Ou[0]|0,this.B=Ou[1]|0,this.C=Ou[2]|0,this.D=Ou[3]|0,this.E=Ou[4]|0,this.F=Ou[5]|0,this.G=Ou[6]|0,this.H=Ou[7]|0}get(){const{A:e,B:t,C:i,D:r,E:s,F:o,G:a,H:l}=this;return[e,t,i,r,s,o,a,l]}set(e,t,i,r,s,o,a,l){this.A=e|0,this.B=t|0,this.C=i|0,this.D=r|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,t){for(let h=0;h<16;h++,t+=4)Lu[h]=e.getUint32(t,!1);for(let h=16;h<64;h++){const f=Lu[h-15],m=Lu[h-2],g=ol(f,7)^ol(f,18)^f>>>3,v=ol(m,17)^ol(m,19)^m>>>10;Lu[h]=v+Lu[h-7]+g+Lu[h-16]|0}let{A:i,B:r,C:s,D:o,E:a,F:l,G:c,H:u}=this;for(let h=0;h<64;h++){const f=ol(a,6)^ol(a,11)^ol(a,25),m=u+f+sxe(a,l,c)+axe[h]+Lu[h]|0,g=(ol(i,2)^ol(i,13)^ol(i,22))+oxe(i,r,s)|0;u=c,c=l,l=a,a=o+m|0,o=s,s=r,r=i,i=m+g|0}i=i+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(i,r,s,o,a,l,c,u)}roundClean(){la(Lu)}destroy(){this.set(0,0,0,0,0,0,0,0),la(this.buffer)}}const hX=eX(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e3585
1815771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),cxe=hX[0],uxe=hX[1],Uu=new Uint32Array(80),Bu=new Uint32Array(80);let yL=class extends uX{constructor(e=64){super(128,e,16,!1),this.Ah=Tr[0]|0,this.Al=Tr[1]|0,this.Bh=Tr[2]|0,this.Bl=Tr[3]|0,this.Ch=Tr[4]|0,this.Cl=Tr[5]|0,this.Dh=Tr[6]|0,this.Dl=Tr[7]|0,this.Eh=Tr[8]|0,this.El=Tr[9]|0,this.Fh=Tr[10]|0,this.Fl=Tr[11]|0,this.Gh=Tr[12]|0,this.Gl=Tr[13]|0,this.Hh=Tr[14]|0,this.Hl=Tr[15]|0}get(){const{Ah:e,Al:t,Bh:i,Bl:r,Ch:s,Cl:o,Dh:a,Dl:l,Eh:c,El:u,Fh:h,Fl:f,Gh:m,Gl:g,Hh:v,Hl:w}=this;return[e,t,i,r,s,o,a,l,c,u,h,f,m,g,v,w]}set(e,t,i,r,s,o,a,l,c,u,h,f,m,g,v,w){this.Ah=e|0,this.Al=t|0,this.Bh=i|0,this.Bl=r|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=c|0,this.El=u|0,this.Fh=h|0,this.Fl=f|0,this.Gh=m|0,this.Gl=g|0,this.Hh=v|0,this.Hl=w|0}process(e,t){for(let x=0;x<16;x++,t+=4)Uu[x]=e.getUint32(t),Bu[x]=e.getUint32(t+=4);for(let x=16;x<80;x++){const S=Uu[x-15]|0,M=Bu[x-15]|0,A=Zu(S,M,1)^Zu(S,M,8)^l6(S,M,7),I=Ju(S,M,1)^Ju(S,M,8)^c6(S,M,7),D=Uu[x-2]|0,k=Bu[x-2]|0,C=Zu(D,k,19)^Dv(D,k,61)^l6(D,k,6),U=Ju(D,k,19)^Ov(D,k,61)^c6(D,k,6),G=z1e(I,U,Bu[x-7],Bu[x-16]),H=V1e(G,A,C,Uu[x-7],Uu[x-16]);Uu[x]=H|0,Bu[x]=G|0}let{Ah:i,Al:r,Bh:s,Bl:o,Ch:a,Cl:l,Dh:c,Dl:u,Eh:h,El:f,Fh:m,Fl:g,Gh:v,Gl:w,Hh:y,Hl:_}=this;for(let x=0;x<80;x++){const S=Zu(h,f,14)^Zu(h,f,18)^Dv(h,f,41),M=Ju(h,f,14)^Ju(h,f,18)^Ov(h,f,41),A=h&m^~h&v,I=f&g^~f&w,D=H1e(_,M,I,uxe[x],Bu[x]),k=$1e(D,y,S,A,cxe[x],Uu[x]),C=D|0,U=Zu(i,r,28)^Dv(i,r,34)^Dv(i,r,39),G=Ju(i,r,28)^Ov(i,r,34)^Ov(i,r,39),H=i&s^i&a^s&a,z=r&o^r&l^o&l;y=v|0,_=w|0,v=m|0,w=g|0,m=h|0,g=f|0,{h,l:f}=xa(c|0,u|0,k|0,C|0),c=a|0,u=l|0,a=s|0,l=o|0,s=i|0,o=r|0;const P=pL(C,G,z);i=mL(P,k,U,H),r=P|0}({h:i,l:r}=xa(this.Ah|0,this.Al|0,i|0,r|0)),{h:s,l:o}=xa(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l}=xa(this.Ch|0,this.Cl|0,a|0,l|0),{h:c,l:u}=xa(this.Dh|0,this.Dl|0,c|0,u|0),{h,l:f}=xa(this.Eh|0,this.El|0,h|0,f|0),{h:m,l:g}=xa(this.Fh|0,this.Fl|0,m|0,g|0),{h:v,l:w}=xa(this.Gh|0,this.Gl|0,v|0,w|0),{h:y,l:_}=xa(this.Hh|0,this.Hl|0,y|0,_|0),this.set(i,r,s,o,a,l,c,u,h,f,m,g,v,w,y,_)}roundClean(){la(Uu,Bu)}destroy(){la(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};class hxe extends yL{constructor(){super(48),this.Ah=Mr[0]|0,this.Al=Mr[1]|0,this.Bh=Mr[2]|0,this.Bl=Mr[3]|0,this.Ch=Mr[4]|0,this.Cl=Mr[5]|0,this.Dh=Mr[6]|0,this.Dl=Mr[7]|0,this.Eh=Mr[8]|0,this.El=Mr[9]|0,this.Fh=Mr[10]|0,this.Fl=Mr[11]|0,this.Gh=Mr[12]|0,this.Gl=Mr[13]|0,this.Hh=Mr[14]|0,this.Hl=Mr[15]|0}}const Pr=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class fxe extends yL{constructor(){super(32),this.Ah=Pr[0]|0,this.Al=Pr[1]|0,this.Bh=Pr[2]|0,this.Bl=Pr[3]|0,this.Ch=Pr[4]|0,this.Cl=Pr[5]|0,this.Dh=Pr[6]|0,this.Dl=Pr[7]|0,this.Eh=Pr[8]|0,this.El=Pr[9]|0,this.Fh=Pr[10]|0,this.Fl=Pr[11]|0,this.Gh=Pr[12]|0,this.Gl=Pr[13]|0,this.Hh=Pr[14]|0,this.Hl=Pr[15]|0}}const _2=Z1(()=>new lxe),dxe=Z1(()=>new yL),pxe=Z1(()=>new hxe),mxe=Z1(()=>new fxe),gxe=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),Ti=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Xe=new Uint32Array(32);function ku(n,e,t,i,r,s){const o=r[s],a=r[s+1];let l=Xe[2*n],c=Xe[2*n+1],u=Xe[2*e],h=Xe[2*e+1],f=Xe[2*t],m=Xe[2*t+1],g=Xe[2*i],v=Xe[2*i+1],w=pL(l,u,o);c=mL(w,c,h,a),l=w|0,{Dh:v,Dl:g}={Dh:v^c,Dl:g^l},{Dh:v,Dl:g}={Dh:O1e(v,g),Dl:L1e(v)},{h:m,l:f}=xa(m,f,v,g),{Bh:h,Bl:u}={Bh:h^m,Bl:u^f},{Bh:h,Bl:u}={Bh:Zu(h,u,24),Bl:Ju(h,u,24)}
vendor: 62,698 bytes, lines 181-184
181,Xe[2*n]=l,Xe[2*n+1]=c,Xe[2*e]=u,Xe[2*e+1]=h,Xe[2*t]=f,Xe[2*t+1]=m,Xe[2*i]=g,Xe[2*i+1]=v}function Fu(n,e,t,i,r,s){const o=r[s],a=r[s+1];let l=Xe[2*n],c=Xe[2*n+1],u=Xe[2*e],h=Xe[2*e+1],f=Xe[2*t],m=Xe[2*t+1],g=Xe[2*i],v=Xe[2*i+1],w=pL(l,u,o);c=mL(w,c,h,a),l=w|0,{Dh:v,Dl:g}={Dh:v^c,Dl:g^l},{Dh:v,Dl:g}={Dh:Zu(v,g,16),Dl:Ju(v,g,16)},{h:m,l:f}=xa(m,f,v,g),{Bh:h,Bl:u}={Bh:h^m,Bl:u^f},{Bh:h,Bl:u}={Bh:Dv(h,u,63),Bl:Ov(h,u,63)},Xe[2*n]=l,Xe[2*n+1]=c,Xe[2*e]=u,Xe[2*e+1]=h,Xe[2*t]=f,Xe[2*t+1]=m,Xe[2*i]=g,Xe[2*i+1]=v}function yxe(n,e={},t,i,r){if(su(t),n<0||n>t)throw new Error("outputLen bigger than keyLen");const{key:s,salt:o,personalization:a}=e;if(s!==void 0&&(s.length<1||s.length>t))throw new Error("key length must be undefined or 1.."+t);if(o!==void 0&&o.length!==i)throw new Error("salt must be undefined or "+i);if(a!==void 0&&a.length!==r)throw new Error("personalization must be undefined or "+r)}class vxe extends b2{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,su(e),su(t),this.blockLen=e,this.outputLen=t,this.buffer=new Uint8Array(e),this.buffer32=Kw(this.buffer)}update(e){Xh(this),e=Fa(e),Ha(e);const{blockLen:t,buffer:i,buffer32:r}=this,s=e.length,o=e.byteOffset,a=e.buffer;for(let l=0;l<s;){this.pos===t&&(eh(r),this.compress(r,0,!1),eh(r),this.pos=0);const c=Math.min(t-this.pos,s-l),u=o+l;if(c===t&&!(u%4)&&l+c<s){const h=new Uint32Array(a,u,Math.floor((s-l)/4));eh(h);for(let f=0;l+t<s;f+=r.length,l+=t)this.length+=t,this.compress(h,f,!1);eh(h);continue}i.set(e.subarray(l,l+c),this.pos),this.pos+=c,this.length+=c,l+=c}return this}digestInto(e){Xh(this),gL(e,this);const{pos:t,buffer32:i}=this;this.finished=!0,la(this.buffer.subarray(t)),eh(i),this.compress(i,0,!0),eh(i);const r=Kw(e);this.get().forEach((s,o)=>r[o]=cc(s))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const i=e.slice(0,t);return this.destroy(),i}_cloneInto(e){const{buffer:t,length:i,finished:r,destroyed:s,outputLen:o,pos:a}=this;return e||(e=new this.constructor({dkLen:o})),e.set(...this.get()),e.buffer.set(t),e.destroyed=s,e.finished=r,e.length=i,e.pos=a,e.outputLen=o,e}clone(){return this._cloneInto()}}class wxe extends vxe{constructor(e={}){const t=e.dkLen===void 0?64:e.dkLen;super(128,t),this.v0l=Ti[0]|0,this.v0h=Ti[1]|0,this.v1l=Ti[2]|0,this.v1h=Ti[3]|0,this.v2l=Ti[4]|0,this.v2h=Ti[5]|0,this.v3l=Ti[6]|0,this.v3h=Ti[7]|0,this.v4l=Ti[8]|0,this.v4h=Ti[9]|0,this.v5l=Ti[10]|0,this.v5h=Ti[11]|0,this.v6l=Ti[12]|0,this.v6h=Ti[13]|0,this.v7l=Ti[14]|0,this.v7h=Ti[15]|0,yxe(t,e,64,16,16);let{key:i,personalization:r,salt:s}=e,o=0;if(i!==void 0&&(i=Fa(i),o=i.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=Fa(s);const a=Kw(s);this.v4l^=cc(a[0]),this.v4h^=cc(a[1]),this.v5l^=cc(a[2]),this.v5h^=cc(a[3])}if(r!==void 0){r=Fa(r);const a=Kw(r);this.v6l^=cc(a[0]),this.v6h^=cc(a[1]),this.v7l^=cc(a[2]),this.v7h^=cc(a[3])}if(i!==void 0){const a=new Uint8Array(this.blockLen);a.set(i),this.update(a)}}get(){let{v0l:e,v0h:t,v1l:i,v1h:r,v2l:s,v2h:o,v3l:a,v3h:l,v4l:c,v4h:u,v5l:h,v5h:f,v6l:m,v6h:g,v7l:v,v7h:w}=this;return[e,t,i,r,s,o,a,l,c,u,h,f,m,g,v,w]}set(e,t,i,r,s,o,a,l,c,u,h,f,m,g,v,w){this.v0l=e|0,this.v0h=t|0,this.v1l=i|0,this.v1h=r|0,this.v2l=s|0,this.v2h=o|0,this.v3l=a|0,this.v3h=l|0,this.v4l=c|0,this.v4h=u|0,this.v5l=h|0,this.v5h=f|0,this.v6l=m|0,this.v6h=g|0,this.v7l=v|0,this.v7h=w|0}compress(e,t,i){this.get().forEach((l,c)=>Xe[c]=l),Xe.set(Ti,16);let{h:r,l:s}=JK(BigInt(this.length));Xe[24]=Ti[8]^s,Xe[25]=Ti[9]^r,i&&(Xe[28]=~Xe[28],Xe[29]=~Xe[29]);let o=0;const a=gxe;for(let l=0;l<12;l++)ku(0,4,8,12,e,t+2*a[o++]),Fu(0,4,8,12,e,t+2*a[o++]),ku(1,5,9,13,e,t+2*a[o++]),Fu(1,5,9,13,e,t+2*a[o++]),ku(2,6,10,14,e,t+2*a[o++]),Fu(2,6,10,14,e,t+2*a[o++]),ku(3,7,11,15,e,t+2*a[o++]),Fu(3,7,11,15,e,t+2*a[o++]),ku(0,5,10,15,e,t+2*a[o++]),Fu(0,5,10,15,e,t+2*a[o++]),ku(1,6,11,12,e,t+2*a[o++]),Fu(1,6,11,12,e,t+2*a[o++]),ku(2,7,8,13,e,t+2*a[o++]),Fu(2,7,8,13,e,t+2*a[o++]),ku(3,4,9,14,e,t+2*a[o++]),Fu(3,4,9,14,e,t+2*a[o++]);this.v0l^=Xe[0]^Xe[16],this.v0h^=Xe[1]^Xe[17],this.v1l^=Xe[2]^Xe[18],this.v1h^=Xe[3]^Xe[19],this.v2l^=Xe[4]^Xe[20],this.v2h^=Xe[5]^Xe[21],this.v3l^=Xe[6]^Xe[22],this.v3h^=Xe[7]^Xe[23],this.v4l^=Xe[8]^Xe[24],this.v4h^=Xe[9]^Xe[25],this.v5l^=Xe[10]^Xe[26],this.v5h^=Xe[11]^Xe[27],this.v6l^=Xe[12]^Xe[28],this.v6h^=Xe[13]^Xe[29],this.v7l^=Xe[14]^Xe[30],this.v7h^=Xe[15]^Xe[31],la(Xe)}destroy(){this.destroyed=!0,la(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const xxe=W1e(n=>new wxe(n)),bxe="https://rpc.walletconnect.org/v1";function fX(n){const e=`�Ethereum Signed Message:
182${n.length}`,t=new TextEncoder().encode(e+n);return"0x"+Buffer.from(ixe(t)).toString("hex")}async function _xe(n,e,t,i,r,s){switch(t.t){case"eip191":return await Exe(n,e,t.s);case"eip1271":return await Sxe(n,e,t.s,i,r,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${t.t}`)}}function Exe(n,e,t){const i=yme(t);return Ime({payload:fX(e),signature:i}).toLowerCase()===n.toLowerCase()}async function Sxe(n,e,t,i,r,s){const o=Wc(i);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{const a="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",c=t.substring(2),u=(c.length/2).toString(16).padStart(64,"0"),h=(e.startsWith("0x")?e:fX(e)).substring(2),f=a+h+l+u+c,m=await fetch(`${s||bxe}/?chainId=${i}&projectId=${r}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:Axe(),jsonrpc:"2.0",method:"eth_call",params:[{to:n,data:f},"latest"]})}),{result:g}=await m.json();return g?g.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function Axe(){return Date.now()+Math.floor(Math.random()*1e3)}function Mxe(n){const e=atob(n),t=new Uint8Array(e.length);for(let o=0;o<e.length;o++)t[o]=e.charCodeAt(o);const i=t[0];if(i===0)throw new Error("No signatures found");const r=1+i*64;if(t.length<r)throw new Error("Transaction data too short for claimed signature count");if(t.length<100)throw new Error("Transaction too short");const s=Buffer.from(n,"base64").slice(1,65);return K1.encode(s)}function Txe(n){const e=new Uint8Array(Buffer.from(n,"base64")),t=Array.from("TransactionData::").map(s=>s.charCodeAt(0)),i=new Uint8Array(t.length+e.length);i.set(t),i.set(e,t.length);const r=xxe(i,{dkLen:32});return K1.encode(r)}function d6(n){const e=new Uint8Array(_2(Pxe(n)));return K1.encode(e)}function Pxe(n){if(n instanceof Uint8Array)return n;if(Array.isArray(n))return new Uint8Array(n);if(typeof n=="object"&&n!=null&&n.data)return new Uint8Array(Object.values(n.data));if(typeof n=="object"&&n)return new Uint8Array(Object.values(n));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function p6(n){const e=Buffer.from(n,"base64"),t=mge(e).txn;if(!t)throw new Error("Invalid signed transaction: missing 'txn' field");const i=oge(t),r=Buffer.from("TX"),s=Buffer.concat([r,Buffer.from(i)]),o=mxe(s);return Cme.encode(o).replace(/=+$/,"")}function WP(n){const e=[];let t=BigInt(n);for(;t>=BigInt(128);)e.push(Number(t&BigInt(127)|BigInt(128))),t>>=BigInt(7);return e.push(Number(t)),Buffer.from(e)}function Cxe(n){const e=Buffer.from(n.signed.bodyBytes,"base64"),t=Buffer.from(n.signed.authInfoBytes,"base64"),i=Buffer.from(n.signature.signature,"base64"),r=[];r.push(Buffer.from([10])),r.push(WP(e.length)),r.push(e),r.push(Buffer.from([18])),r.push(WP(t.length)),r.push(t),r.push(Buffer.from([26])),r.push(WP(i.length)),r.push(i);const s=Buffer.concat(r),o=_2(s);return Buffer.from(o).toString("hex").toUpperCase()}function Ixe(n){var e,t;const i=[];try{if(typeof n=="string")return i.push(n),i;if(typeof n!="object")return i;n!=null&&n.id&&i.push(n.id);const r=(t=(e=n==null?void 0:n.capabilities)==null?void 0:e.caip345)==null?void 0:t.transactionHashes;r&&i.push(...r)}catch(r){console.warn("getWalletSendCallsHashes failed: ",r)}return i}var Rxe=Object.defineProperty,Nxe=Object.defineProperties,Dxe=Object.getOwnPropertyDescriptors,m6=Object.getOwnPropertySymbols,Oxe=Object.prototype.hasOwnProperty,Lxe=Object.prototype.propertyIsEnumerable,g6=(n,e,t)=>e in n?Rxe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Uxe=(n,e)=>{for(var t in e||(e={}))Oxe.call(e,t)&&g6(n,t,e[t]);if(m6)for(var t of m6(e))Lxe.call(e,t)&&g6(n,t,e[t]);return n},Bxe=(n,e)=>Nxe(n,Dxe(e));const dX="did:pkh:",kxe={eip155:"Ethereum",solana:"Solana",bip122:"Bitcoin"},Fxe=n=>n?kxe[n]||n:"",E2=n=>n==null?void 0:n.split(":"),zxe=n=>{const e=n&&E2(n);if(e)return n.includes(dX)?e[3]:e[1]},Vxe=n=>{const e=n&&E2(n);if(e)return n.includes(dX)?e[2]:e[0]},SR=n=>{const e=n&&E2(n);if(e)return e[2]+":"+e[3]},tA=n=>{const e=n&&E2(n);if(e)return e.pop()};async function y6(n){const{cacao:e,projectId:t}=n,{s:i,p:r}=e,s=pX(r,r.iss),o=tA(r.iss);return await _xe(o,s,i,SR(r.iss),t)}const pX=(n,e)=>{const t=Vxe(e);if(!t)throw new Error("Invalid issuer: "+e);const i=`${n.domain} wants you to sign in with your ${Fxe(t)} account:`,r=tA(e);if(!n.aud&&!n.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let s=n.statement||void 0;const o=`URI: ${n.aud||n.uri}`,a=`Version: ${n.version}`,l=`Chain ID: ${zxe(e)}`,c=`Nonce: ${n.nonce}`,u=`Issued At: ${n.iat}`,h=n.exp?`Expiration Time: ${n.exp}`:void 0,f=n.nbf?`Not Before: ${n.nbf}`:void 0,m=n.requestId?`Request ID: ${n.requestId}`:void 0,g=n.resources?`Resources:${n.resources.map(w=>`
183- ${w}`).join("")}`:void 0,v=FE(n.resources);if(v){const w=Xw(v);s=Yxe(s,w)}return[i,r,"",s,"",o,a,l,c,u,h,f,m,g].filter(w=>w!=null).join(`
184`)};function Hxe(n){return Buffer.from(JSON.stringify(n)).toString("base64")}function $xe(n){return JSON.parse(Buffer.from(n,"base64").toString("utf-8"))}function fp(n){if(!n)throw new Error("No recap provided, value is undefined");if(!n.att)throw new Error("No `att` property found");const e=Object.keys(n.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(t=>{const i=n.att[t];if(Array.isArray(i))throw new Error(`Resource must be an object: ${t}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${t}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${t}`);Object.keys(i).forEach(r=>{const s=i[r];if(!Array.isArray(s))throw new Error(`Ability limits ${r} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${r} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${r}) must be an array of objects, found: ${o}`)})})})}function Gxe(n,e,t,i={}){return t==null||t.sort((r,s)=>r.localeCompare(s)),{att:{[n]:jxe(e,t,i)}}}function jxe(n,e,t={}){e=e==null?void 0:e.sort((r,s)=>r.localeCompare(s));const i=e.map(r=>({[`${n}/${r}`]:[t]}));return Object.assign({},...i)}function mX(n){return fp(n),`urn:recap:${Hxe(n).replace(/=/g,"")}`}function Xw(n){const e=$xe(n.replace("urn:recap:",""));return fp(e),e}function Wxe(n,e,t){const i=Gxe(n,e,t);return mX(i)}function qxe(n){return n&&n.includes("urn:recap:")}function Kxe(n,e){const t=Xw(n),i=Xw(e),r=Xxe(t,i);return mX(r)}function Xxe(n,e){fp(n),fp(e);const t=Object.keys(n.att).concat(Object.keys(e.att)).sort((r,s)=>r.localeCompare(s)),i={att:{}};return t.forEach(r=>{var s,o;Object.keys(((s=n.att)==null?void 0:s[r])||{}).concat(Object.keys(((o=e.att)==null?void 0:o[r])||{})).sort((a,l)=>a.localeCompare(l)).forEach(a=>{var l,c;i.att[r]=Bxe(Uxe({},i.att[r]),{[a]:((l=n.att[r])==null?void 0:l[a])||((c=e.att[r])==null?void 0:c[a])})})}),i}function Yxe(n="",e){fp(e);const t="I further authorize the stated URI to perform the following actions on my behalf: ";if(n.includes(t))return n;const i=[];let r=0;Object.keys(e.att).forEach(a=>{const l=Object.keys(e.att[a]).map(h=>({ability:h.split("/")[0],action:h.split("/")[1]}));l.sort((h,f)=>h.action.localeCompare(f.action));const c={};l.forEach(h=>{c[h.ability]||(c[h.ability]=[]),c[h.ability].push(h.action)});const u=Object.keys(c).map(h=>(r++,`(${r}) '${h}': '${c[h].join("', '")}' for '${a}'.`));i.push(u.join(", ").replace(".,","."))});const s=i.join(" "),o=`${t}${s}`;return`${n?n+" ":""}${o}`}function v6(n){var e;const t=Xw(n);fp(t);const i=(e=t.att)==null?void 0:e.eip155;return i?Object.keys(i).map(r=>r.split("/")[1]):[]}function w6(n){const e=Xw(n);fp(e);const t=[];return Object.values(e.att).forEach(i=>{Object.values(i).forEach(r=>{var s;(s=r==null?void 0:r[0])!=null&&s.chains&&t.push(r[0].chains)})}),[...new Set(t.flat())]}function FE(n){if(!n)return;const e=n==null?void 0:n[n.length-1];return qxe(e)?e:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function gX(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function AR(n){if(typeof n!="boolean")throw new Error(`boolean expected, not ${n}`)}function qP(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function Ms(n,...e){if(!gX(n))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(n.length))throw new Error("Uint8Array expected of length "+e+", got length="+n.length)}function x6(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function Qxe(n,e){Ms(n);const t=e.outputLen;if(n.length<t)throw new Error("digestInto() expects output buffer of length at least "+t)}function kh(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function k0(...n){for(let e=0;e<n.length;e++)n[e].fill(0)}function Zxe(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}const Jxe=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ebe(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function MR(n){if(typeof n=="string")n=ebe(n);else if(gX(n))n=TR(n);else throw new Error("Uint8Array expected, got "+typeof n);return n}function tbe(n,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(n,e)}function nbe(n,e){if(n.length!==e.length)return!1;let t=0;for(let i=0;i<n.length;i++)t|=n[i]^e[i];return t===0}const ibe=(n,e)=>{function t(i,...r){if(Ms(i),!Jxe)throw new Error("Non little-endian hardware is not yet supported");if(n.nonceLength!==void 0){const c=r[0];if(!c)throw new Error("nonce / iv required");n.varSizeNonce?Ms(c):Ms(c,n.nonceLength)}const s=n.tagLength;s&&r[1]!==void 0&&Ms(r[1]);const o=e(i,...r),a=(c,u)=>{if(u!==void 0){if(c!==2)throw new Error("cipher output not supported");Ms(u)}};let l=!1;return{encrypt(c,u){if(l)throw new Error("cannot encrypt() twice with same key + nonce");return l=!0,Ms(c),a(o.encrypt.length,u),o.encrypt(c,u)},decrypt(c,u){if(Ms(c),s&&c.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return a(o.decrypt.length,u),o.decrypt(c,u)}}}return Object.assign(t,n),t};function b6(n,e,t=!0){if(e===void 0)return new Uint8Array(n);if(e.length!==n)throw new Error("invalid output length, expected "+n+", got: "+e.length);if(t&&!sbe(e))throw new Error("invalid output, must be aligned");return e}function _6(n,e,t,i){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,i);const r=BigInt(32),s=BigInt(4294967295),o=Number(t>>r&s),a=Number(t&s);n.setUint32(e+4,o,i),n.setUint32(e+0,a,i)}function rbe(n,e,t){AR(t);const i=new Uint8Array(16),r=Zxe(i);return _6(r,0,BigInt(e),t),_6(r,8,BigInt(n),t),i}function sbe(n){return n.byteOffset%4===0}function TR(n){return Uint8Array.from(n)}const yX=n=>Uint8Array.from(n.split("").map(e=>e.charCodeAt(0))),obe=yX("expand 16-byte k"),abe=yX("expand 32-byte k"),lbe=kh(obe),cbe=kh(abe);function sn(n,e){return n<<e|n>>>32-e}function PR(n){return n.byteOffset%4===0}const n_=64,ube=16,vX=2**32-1,E6=new Uint32Array;function hbe(n,e,t,i,r,s,o,a){const l=r.length,c=new Uint8Array(n_),u=kh(c),h=PR(r)&&PR(s),f=h?kh(r):E6,m=h?kh(s):E6;for(let g=0;g<l;o++){if(n(e,t,i,u,o,a),o>=vX)throw new Error("arx: counter overflow");const v=Math.min(n_,l-g);if(h&&v===n_){const w=g/4;if(g%4!==0)throw new Error("arx: invalid block position");for(let y=0,_;y<ube;y++)_=w+y,m[_]=f[_]^u[y];g+=n_;continue}for(let w=0,y;w<v;w++)y=g+w,s[y]=r[y]^c[w];g+=v}}function fbe(n,e){const{allowShortKeys:t,extendNonceFn:i,counterLength:r,counterRight:s,rounds:o}=tbe({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof n!="function")throw new Error("core must be a function");return qP(r),qP(o),AR(s),AR(t),(a,l,c,u,h=0)=>{Ms(a),Ms(l),Ms(c);const f=c.length;if(u===void 0&&(u=new Uint8Array(f)),Ms(u),qP(h),h<0||h>=vX)throw new Error("arx: counter overflow");if(u.length<f)throw new Error(`arx: output (${u.length}) is shorter than data (${f})`);const m=[];let g=a.length,v,w;if(g===32)m.push(v=TR(a)),w=cbe;else if(g===16&&t)v=new Uint8Array(32),v.set(a),v.set(a,16),w=lbe,m.push(v);else throw new Error(`arx: invalid 32-byte key, got length=${g}`);PR(l)||m.push(l=TR(l));const y=kh(v);if(i){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");i(w,y,kh(l.subarray(0,16)),y),l=l.subarray(16)}const _=16-r;if(_!==l.length)throw new Error(`arx: nonce must be ${_} or 16 bytes`);if(_!==12){const S=new Uint8Array(12);S.set(l,s?0:12-l.length),l=S,m.push(l)}const x=kh(l);return hbe(n,w,y,x,c,u,h,o),k0(...m),u}}const ir=(n,e)=>n[e++]&255|(n[e++]&255)<<8;class dbe{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=MR(e),Ms(e,32);const t=ir(e,0),i=ir(e,2),r=ir(e,4),s=ir(e,6),o=ir(e,8),a=ir(e,10),l=ir(e,12),c=ir(e,14);this.r[0]=t&8191,this.r[1]=(t>>>13|i<<3)&8191,this.r[2]=(i>>>10|r<<6)&7939,this.r[3]=(r>>>7|s<<9)&8191,this.r[4]=(s>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|l<<5)&8065,this.r[8]=(l>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let u=0;u<8;u++)this.pad[u]=ir(e,16+2*u)}process(e,t,i=!1){const r=i?0:2048,{h:s,r:o}=this,a=o[0],l=o[1],c=o[2],u=o[3],h=o[4],f=o[5],m=o[6],g=o[7],v=o[8],w=o[9],y=ir(e,t+0),_=ir(e,t+2),x=ir(e,t+4),S=ir(e,t+6),M=ir(e,t+8),A=ir(e,t+10),I=ir(e,t+12),D=ir(e,t+14);let k=s[0]+(y&8191),C=s[1]+((y>>>13|_<<3)&8191),U=s[2]+((_>>>10|x<<6)&8191),G=s[3]+((x>>>7|S<<9)&8191),H=s[4]+((S>>>4|M<<12)&8191),z=s[5]+(M>>>1&8191),P=s[6]+((M>>>14|A<<2)&8191),R=s[7]+((A>>>11|I<<5)&8191),F=s[8]+((I>>>8|D<<8)&8191),N=s[9]+(D>>>5|r),O=0,B=O+k*a+C*(5*w)+U*(5*v)+G*(5*g)+H*(5*m);O=B>>>13,B&=8191,B+=z*(5*f)+P*(5*h)+R*(5*u)+F*(5*c)+N*(5*l),O+=B>>>13,B&=8191;let W=O+k*l+C*a+U*(5*w)+G*(5*v)+H*(5*g);O=W>>>13,W&=8191,W+=z*(5*m)+P*(5*f)+R*(5*h)+F*(5*u)+N*(5*c),O+=W>>>13,W&=8191;let Q=O+k*c+C*l+U*a+G*(5*w)+H*(5*v);O=Q>>>13,Q&=8191,Q+=z*(5*g)+P*(5*m)+R*(5*f)+F*(5*h)+N*(5*u),O+=Q>>>13,Q&=8191;let oe=O+k*u+C*c+U*l+G*a+H*(5*w);O=oe>>>13,oe&=8191,oe+=z*(5*v)+P*(5*g)+R*(5*m)+F*(5*f)+N*(5*h),O+=oe>>>13,oe&=8191;let Y=O+k*h+C*u+U*c+G*l+H*a;O=Y>>>13,Y&=8191,Y+=z*(5*w)+P*(5*v)+R*(5*g)+F*(5*m)+N*(5*f),O+=Y>>>13,Y&=8191;let te=O+k*f+C*h+U*u+G*c+H*l;O=te>>>13,te&=8191,te+=z*a+P*(5*w)+R*(5*v)+F*(5*g)+N*(5*m),O+=te>>>13,te&=8191;let le=O+k*m+C*f+U*h+G*u+H*c;O=le>>>13,le&=8191,le+=z*l+P*a+R*(5*w)+F*(5*v)+N*(5*g),O+=le>>>13,le&=8191;let ve=O+k*g+C*m+U*f+G*h+H*u;O=ve>>>13,ve&=8191,ve+=z*c+P*l+R*a+F*(5*w)+N*(5*v),O+=ve>>>13,ve&=8191;let Te=O+k*v+C*g+U*m+G*f+H*h;O=Te>>>13,Te&=8191,Te+=z*u+P*c+R*l+F*a+N*(5*w),O+=Te>>>13,Te&=8191;let be=O+k*w+C*v+U*g+G*m+H*f;O=be>>>13,be&=8191,be+=z*h+P*u+R*c+F*l+N*a,O+=be>>>13,be&=8191,O=(O<<2)+O|0,O=O+B|0,B=O&8191,O=O>>>13,W+=O,s[0]=B,s[1]=W,s[2]=Q,s[3]=oe,s[4]=Y,s[5]=te,s[6]=le,s[7]=ve,s[8]=Te,s[9]=be}finalize(){const{h:e,pad:t}=this,i=new Uint16Array(10);let r=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=r,r=e[a]>>>13,e[a]&=8191;e[0]+=r*5,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,i[0]=e[0]+5,r=i[0]>>>13,i[0]&=8191;for(let a=1;a<10;a++)i[a]=e[a]+r,r=i[a]>>>13,i[a]&=8191;i[9]-=8192;let s=(r^1)-1;for(let a=0;a<10;a++)i[a]&=s;s=~s;for(let a=0;a<10;a++)e[a]=e[a]&s|i[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let o=e[0]+t[0];e[0]=o&65535;for(let a=1;a<8;a++)o=(e[a]+t[a]|0)+(o>>>16)|0,e[a]=o&65535;k0(i)}update(e){x6(this),e=MR(e),Ms(e);const{buffer:t,blockLen:i}=this,r=e.length;for(let s=0;s<r;){const o=Math.min(i-this.pos,r-s);if(o===i){for(;i<=r-s;s+=i)this.process(e,s);continue}t.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){k0(this.h,this.r,this.buffer,this.pad)}digestInto(e){x6(this),Qxe(e,this),this.finished=!0;const{buffer:t,h:i}=this;let{pos:r}=this;if(r){for(t[r++]=1;r<16;r++)t[r]=0;this.process(t,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)e[s++]=i[o]>>>0,e[s++]=i[o]>>>8;return e}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const i=e.slice(0,t);return this.destroy(),i}}function pbe(n){const e=(i,r)=>n(r).update(MR(i)).digest(),t=n(new Uint8Array(32));return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=i=>n(i),e}const mbe=pbe(n=>new dbe(n));function gbe(n,e,t,i,r,s=20){let o=n[0],a=n[1],l=n[2],c=n[3],u=e[0],h=e[1],f=e[2],m=e[3],g=e[4],v=e[5],w=e[6],y=e[7],_=r,x=t[0],S=t[1],M=t[2],A=o,I=a,D=l,k=c,C=u,U=h,G=f,H=m,z=g,P=v,R=w,F=y,N=_,O=x,B=S,W=M;for(let oe=0;oe<s;oe+=2)A=A+C|0,N=sn(N^A,16),z=z+N|0,C=sn(C^z,12),A=A+C|0,N=sn(N^A,8),z=z+N|0,C=sn(C^z,7),I=I+U|0,O=sn(O^I,16),P=P+O|0,U=sn(U^P,12),I=I+U|0,O=sn(O^I,8),P=P+O|0,U=sn(U^P,7),D=D+G|0,B=sn(B^D,16),R=R+B|0,G=sn(G^R,12),D=D+G|0,B=sn(B^D,8),R=R+B|0,G=sn(G^R,7),k=k+H|0,W=sn(W^k,16),F=F+W|0,H=sn(H^F,12),k=k+H|0,W=sn(W^k,8),F=F+W|0,H=sn(H^F,7),A=A+U|0,W=sn(W^A,16),R=R+W|0,U=sn(U^R,12),A=A+U|0,W=sn(W^A,8),R=R+W|0,U=sn(U^R,7),I=I+G|0,N=sn(N^I,16),F=F+N|0,G=sn(G^F,12),I=I+G|0,N=sn(N^I,8),F=F+N|0,G=sn(G^F,7),D=D+H|0,O=sn(O^D,16),z=z+O|0,H=sn(H^z,12),D=D+H|0,O=sn(O^D,8),z=z+O|0,H=sn(H^z,7),k=k+C|0,B=sn(B^k,16),P=P+B|0,C=sn(C^P,12),k=k+C|0,B=sn(B^k,8),P=P+B|0,C=sn(C^P,7);let Q=0;i[Q++]=o+A|0,i[Q++]=a+I|0,i[Q++]=l+D|0,i[Q++]=c+k|0,i[Q++]=u+C|0,i[Q++]=h+U|0,i[Q++]=f+G|0,i[Q++]=m+H|0,i[Q++]=g+z|0,i[Q++]=v+P|0,i[Q++]=w+R|0,i[Q++]=y+F|0,i[Q++]=_+N|0,i[Q++]=x+O|0,i[Q++]=S+B|0,i[Q++]=M+W|0}const ybe=fbe(gbe,{counterRight:!1,counterLength:4,allowShortKeys:!1}),vbe=new Uint8Array(16),S6=(n,e)=>{n.update(e);const t=e.length%16;t&&n.update(vbe.subarray(t))},wbe=new Uint8Array(32);function A6(n,e,t,i,r){const s=n(e,t,wbe),o=mbe.create(s);r&&S6(o,r),S6(o,i);const a=rbe(i.length,r?r.length:0,!0);o.update(a);const l=o.digest();return k0(s,a),l}const xbe=n=>(e,t,i)=>({encrypt(r,s){const o=r.length;s=b6(o+16,s,!1),s.set(r);const a=s.subarray(0,-16);n(e,t,a,a,1);const l=A6(n,e,t,a,i);return s.set(l,o),k0(l),s},decrypt(r,s){s=b6(r.length-16,s,!1);const o=r.subarray(0,-16),a=r.subarray(-16),l=A6(n,e,t,o,i);if(!nbe(a,l))throw new Error("invalid tag");return s.set(r.subarray(0,-16)),n(e,t,s,s,1),k0(l),s}}),wX=ibe({blockSize:64,nonceLength:12,tagLength:16},xbe(ybe));let xX=class extends b2{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,x2(e);const i=Fa(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,s=new Uint8Array(r);s.set(i.length>r?e.create().update(i).digest():i);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=e.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),la(s)}update(e){return Xh(this),this.iHash.update(e),this}digestInto(e){Xh(this),Ha(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:i,finished:r,destroyed:s,blockLen:o,outputLen:a}=this;return e=e,e.finished=r,e.destroyed=s,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=i._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const S2=(n,e,t)=>new xX(n,e).update(t).digest();S2.create=(n,e)=>new xX(n,e);function bbe(n,e,t){return x2(n),t===void 0&&(t=new Uint8Array(n.outputLen)),S2(n,Fa(t),Fa(e))}const KP=Uint8Array.from([0]),M6=Uint8Array.of();function _be(n,e,t,i=32){x2(n),su(i);const r=n.outputLen;if(i>255*r)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(i/r);t===void 0&&(t=M6);const o=new Uint8Array(s*r),a=S2.create(n,e),l=a._cloneInto(),c=new Uint8Array(a.outputLen);for(let u=0;u<s;u++)KP[0]=u+1,l.update(u===0?M6:c).update(t).update(KP).digestInto(c),o.set(c,r*u),a._cloneInto(l);return a.destroy(),l.destroy(),la(c,KP),o.slice(0,i)}const Ebe=(n,e,t,i,r)=>_be(n,bbe(n,e,t),i,r),A2=_2,vL=BigInt(0),CR=BigInt(1);function nA(n,e=""){if(typeof n!="boolean"){const t=e&&`"${e}"`;throw new Error(t+"expected boolean, got type="+typeof n)}return n}function gd(n,e,t=""){const i=w2(n),r=n==null?void 0:n.length,s=e!==void 0;if(!i||s&&r!==e){const o=t&&`"${t}" `,a=s?` of length ${e}`:"",l=i?`length=${r}`:`type=${typeof n}`;throw new Error(o+"expected Uint8Array"+a+", got "+l)}return n}function i_(n){const e=n.toString(16);return e.length&1?"0"+e:e}function bX(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?vL:BigInt("0x"+n)}function M2(n){return bX(Tg(n))}function iA(n){return Ha(n),bX(Tg(Uint8Array.from(n).reverse()))}function wL(n,e){return eA(n.toString(16).padStart(e*2,"0"))}function xL(n,e){return wL(n,e).reverse()}function Br(n,e,t){let i;if(typeof e=="string")try{i=eA(e)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(w2(e))i=Uint8Array.from(e);else throw new Error(n+" must be hex string or Uint8Array");const r=i.length;if(typeof t=="number"&&r!==t)throw new Error(n+" of length "+t+" expected, got "+r);return i}const XP=n=>typeof n=="bigint"&&vL<=n;function Sbe(n,e,t){return XP(n)&&XP(e)&&XP(t)&&e<=n&&n<t}function IR(n,e,t,i){if(!Sbe(e,t,i))throw new Error("expected valid "+n+": "+t+" <= n < "+i+", got "+e)}function _X(n){let e;for(e=0;n>vL;n>>=CR,e+=1);return e}const J1=n=>(CR<<BigInt(n))-CR;function Abe(n,e,t){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");const i=f=>new Uint8Array(f),r=f=>Uint8Array.of(f);let s=i(n),o=i(n),a=0;const l=()=>{s.fill(1),o.fill(0),a=0},c=(...f)=>t(o,s,...f),u=(f=i(0))=>{o=c(r(0),f),s=c(),f.length!==0&&(o=c(r(1),f),s=c())},h=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const m=[];for(;f<e;){s=c();const g=s.slice();m.push(g),f+=s.length}return sh(...m)};return(f,m)=>{l(),u(f);let g;for(;!(g=m(h()));)u();return l(),g}}function T2(n,e,t={}){if(!n||typeof n!="object")throw new Error("expected valid options object");function i(r,s,o){const a=n[r];if(o&&a===void 0)return;const l=typeof a;if(l!==s||a===null)throw new Error(`param "${r}" is invalid: expected ${s}, got ${l}`)}Object.entries(e).forEach(([r,s])=>i(r,s,!1)),Object.entries(t).forEach(([r,s])=>i(r,s,!0))}function T6(n){const e=new WeakMap;return(t,...i)=>{const r=e.get(t);if(r!==void 0)return r;const s=n(t,...i);return e.set(t,s),s}}const Ns=BigInt(0),as=BigInt(1),yd=BigInt(2),EX=BigInt(3),SX=BigInt(4),AX=BigInt(5),Mbe=BigInt(7),MX=BigInt(8),Tbe=BigInt(9),TX=BigInt(16);function lo(n,e){const t=n%e;return t>=Ns?t:e+t}function va(n,e,t){let i=n;for(;e-- >Ns;)i*=i,i%=t;return i}function P6(n,e){if(n===Ns)throw new Error("invert: expected non-zero number");if(e<=Ns)throw new Error("invert: expected positive modulus, got "+e);let t=lo(n,e),i=e,r=Ns,s=as;for(;t!==Ns;){const o=i/t,a=i%t,l=r-s*o;i=t,t=a,r=s,s=l}if(i!==as)throw new Error("invert: does not exist");return lo(r,e)}function bL(n,e,t){if(!n.eql(n.sqr(e),t))throw new Error("Cannot find square root")}function PX(n,e){const t=(n.ORDER+as)/SX,i=n.pow(e,t);return bL(n,i,e),i}function Pbe(n,e){const t=(n.ORDER-AX)/MX,i=n.mul(e,yd),r=n.pow(i,t),s=n.mul(e,r),o=n.mul(n.mul(s,yd),r),a=n.mul(s,n.sub(o,n.ONE));return bL(n,a,e),a}function Cbe(n){const e=of(n),t=CX(n),i=t(e,e.neg(e.ONE)),r=t(e,i),s=t(e,e.neg(i)),o=(n+Mbe)/TX;return(a,l)=>{let c=a.pow(l,o),u=a.mul(c,i);const h=a.mul(c,r),f=a.mul(c,s),m=a.eql(a.sqr(u),l),g=a.eql(a.sqr(h),l);c=a.cmov(c,u,m),u=a.cmov(f,h,g);const v=a.eql(a.sqr(u),l),w=a.cmov(c,u,v);return bL(a,w,l),w}}function CX(n){if(n<EX)throw new Error("sqrt is not defined for small field");let e=n-as,t=0;for(;e%yd===Ns;)e/=yd,t++;let i=yd;const r=of(n);for(;C6(r,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(t===1)return PX;let s=r.pow(i,e);const o=(e+as)/yd;return function(a,l){if(a.is0(l))return l;if(C6(a,l)!==1)throw new Error("Cannot find square root");let c=t,u=a.mul(a.ONE,s),h=a.pow(l,e),f=a.pow(l,o);for(;!a.eql(h,a.ONE);){if(a.is0(h))return a.ZERO;let m=1,g=a.sqr(h);for(;!a.eql(g,a.ONE);)if(m++,g=a.sqr(g),m===c)throw new Error("Cannot find square root");const v=as<<BigInt(c-m-1),w=a.pow(u,v);c=m,u=a.sqr(w),h=a.mul(h,u),f=a.mul(f,w)}return f}}function Ibe(n){return n%SX===EX?PX:n%MX===AX?Pbe:n%TX===Tbe?Cbe(n):CX(n)}const Rbe=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Nbe(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},t=Rbe.reduce((i,r)=>(i[r]="function",i),e);return T2(n,t),n}function Dbe(n,e,t){if(t<Ns)throw new Error("invalid exponent, negatives unsupported");if(t===Ns)return n.ONE;if(t===as)return e;let i=n.ONE,r=e;for(;t>Ns;)t&as&&(i=n.mul(i,r)),r=n.sqr(r),t>>=as;return i}function IX(n,e,t=!1){const i=new Array(e.length).fill(t?n.ZERO:void 0),r=e.reduce((o,a,l)=>n.is0(a)?o:(i[l]=o,n.mul(o,a)),n.ONE),s=n.inv(r);return e.reduceRight((o,a,l)=>n.is0(a)?o:(i[l]=n.mul(o,i[l]),n.mul(o,a)),s),i}function C6(n,e){const t=(n.ORDER-as)/yd,i=n.pow(e,t),r=n.eql(i,n.ONE),s=n.eql(i,n.ZERO),o=n.eql(i,n.neg(n.ONE));if(!r&&!s&&!o)throw new Error("invalid Legendre symbol result");return r?1:s?0:-1}function RX(n,e){e!==void 0&&su(e);const t=e!==void 0?e:n.toString(2).length,i=Math.ceil(t/8);return{nBitLength:t,nByteLength:i}}function of(n,e,t=!1,i={}){if(n<=Ns)throw new Error("invalid field: expected ORDER > 0, got "+n);let r,s,o=!1,a;if(typeof e=="object"&&e!=null){if(i.sqrt||t)throw new Error("cannot specify opts in two arguments");const f=e;f.BITS&&(r=f.BITS),f.sqrt&&(s=f.sqrt),typeof f.isLE=="boolean"&&(t=f.isLE),typeof f.modFromBytes=="boolean"&&(o=f.modFromBytes),a=f.allowedLengths}else typeof e=="number"&&(r=e),i.sqrt&&(s=i.sqrt);const{nBitLength:l,nByteLength:c}=RX(n,r);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u;const h=Object.freeze({ORDER:n,isLE:t,BITS:l,BYTES:c,MASK:J1(l),ZERO:Ns,ONE:as,allowedLengths:a,create:f=>lo(f,n),isValid:f=>{if(typeof f!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof f);return Ns<=f&&f<n},is0:f=>f===Ns,isValidNot0:f=>!h.is0(f)&&h.isValid(f),isOdd:f=>(f&as)===as,neg:f=>lo(-f,n),eql:(f,m)=>f===m,sqr:f=>lo(f*f,n),add:(f,m)=>lo(f+m,n),sub:(f,m)=>lo(f-m,n),mul:(f,m)=>lo(f*m,n),pow:(f,m)=>Dbe(h,f,m),div:(f,m)=>lo(f*P6(m,n),n),sqrN:f=>f*f,addN:(f,m)=>f+m,subN:(f,m)=>f-m,mulN:(f,m)=>f*m,inv:f=>P6(f,n),sqrt:s||(f=>(u||(u=Ibe(n)),u(h,f))),toBytes:f=>t?xL(f,c):wL(f,c),fromBytes:(f,m=!0)=>{if(a){if(!a.includes(f.length)||f.length>c)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+f.length);const v=new Uint8Array(c);v.set(f,t?0:v.length-f.length),f=v}if(f.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+f.length);let g=t?iA(f):M2(f);if(o&&(g=lo(g,n)),!m&&!h.isValid(g))throw new Error("invalid field element: outside of range 0..ORDER");return g},invertBatch:f=>IX(h,f),cmov:(f,m,g)=>g?m:f});return Object.freeze(h)}function NX(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function DX(n){const e=NX(n);return e+Math.ceil(e/2)}function Obe(n,e,t=!1){const i=n.length,r=NX(e),s=DX(e);if(i<16||i<s||i>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+i);const o=t?iA(n):M2(n),a=lo(o,e-as)+as;return t?xL(a,r):wL(a,r)}const F0=BigInt(0),vd=BigInt(1);function rA(n,e){const t=e.negate();return n?t:e}function YP(n,e){const t=IX(n.Fp,e.map(i=>i.Z));return e.map((i,r)=>n.fromAffine(i.toAffine(t[r])))}function OX(n,e){if(!Number.isSafeInteger(n)||n<=0||n>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+n)}function QP(n,e){OX(n,e);const t=Math.ceil(e/n)+1,i=2**(n-1),r=2**n,s=J1(n),o=BigInt(n);return{windows:t,windowSize:i,mask:s,maxNumber:r,shiftBy:o}}function I6(n,e,t){const{windowSize:i,mask:r,maxNumber:s,shiftBy:o}=t;let a=Number(n&r),l=n>>o;a>i&&(a-=s,l+=vd);const c=e*i,u=c+Math.abs(a)-1,h=a===0,f=a<0,m=e%2!==0;return{nextN:l,offset:u,isZero:h,isNeg:f,isNegF:m,offsetF:c}}function Lbe(n,e){if(!Array.isArray(n))throw new Error("array expected");n.forEach((t,i)=>{if(!(t instanceof e))throw new Error("invalid point at index "+i)})}function Ube(n,e){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((t,i)=>{if(!e.isValid(t))throw new Error("invalid scalar at index "+i)})}const ZP=new WeakMap,LX=new WeakMap;function JP(n){return LX.get(n)||1}function R6(n){if(n!==F0)throw new Error("invalid wNAF")}class Bbe{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,i=this.ZERO){let r=e;for(;t>F0;)t&vd&&(i=i.add(r)),r=r.double(),t>>=vd;return i}precomputeWindow(e,t){const{windows:i,windowSize:r}=QP(t,this.bits),s=[];let o=e,a=o;for(let l=0;l<i;l++){a=o,s.push(a);for(let c=1;c<r;c++)a=a.add(o),s.push(a);o=a.double()}return s}wNAF(e,t,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let r=this.ZERO,s=this.BASE;const o=QP(e,this.bits);for(let a=0;a<o.windows;a++){const{nextN:l,offset:c,isZero:u,isNeg:h,isNegF:f,offsetF:m}=I6(i,a,o);i=l,u?s=s.add(rA(f,t[m])):r=r.add(rA(h,t[c]))}return R6(i),{p:r,f:s}}wNAFUnsafe(e,t,i,r=this.ZERO){const s=QP(e,this.bits);for(let o=0;o<s.windows&&i!==F0;o++){const{nextN:a,offset:l,isZero:c,isNeg:u}=I6(i,o,s);if(i=a,!c){const h=t[l];r=r.add(u?h.negate():h)}}return R6(i),r}getPrecomputes(e,t,i){let r=ZP.get(t);return r||(r=this.precomputeWindow(t,e),e!==1&&(typeof i=="function"&&(r=i(r)),ZP.set(t,r))),r}cached(e,t,i){const r=JP(e);return this.wNAF(r,this.getPrecomputes(r,e,i),t)}unsafe(e,t,i,r){const s=JP(e);return s===1?this._unsafeLadder(e,t,r):this.wNAFUnsafe(s,this.getPrecomputes(s,e,i),t,r)}createCache(e,t){OX(t,this.bits),LX.set(e,t),ZP.delete(e)}hasCache(e){return JP(e)!==1}}function kbe(n,e,t,i){let r=e,s=n.ZERO,o=n.ZERO;for(;t>F0||i>F0;)t&vd&&(s=s.add(r)),i&vd&&(o=o.add(r)),r=r.double(),t>>=vd,i>>=vd;return{p1:s,p2:o}}function Fbe(n,e,t,i){Lbe(t,n),Ube(i,e);const r=t.length,s=i.length;if(r!==s)throw new Error("arrays of points and scalars must have equal length");const o=n.ZERO,a=_X(BigInt(r));let l=1;a>12?l=a-3:a>4?l=a-2:a>0&&(l=2);const c=J1(l),u=new Array(Number(c)+1).fill(o),h=Math.floor((e.BITS-1)/l)*l;let f=o;for(let m=h;m>=0;m-=l){u.fill(o);for(let v=0;v<s;v++){const w=i[v],y=Number(w>>BigInt(m)&c);u[y]=u[y].add(t[v])}let g=o;for(let v=u.length-1,w=o;v>0;v--)w=w.add(u[v]),g=g.add(w);if(f=f.add(g),m!==0)for(let v=0;v<l;v++)f=f.double()}return f}function N6(n,e,t){if(e){if(e.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Nbe(e),e}else return of(n,{isLE:t})}function zbe(n,e,t={},i){if(i===void 0&&(i=n==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${n} CURVE object`);for(const a of["p","n","h"]){const l=e[a];if(!(typeof l=="bigint"&&l>F0))throw new Error(`CURVE.${a} must be positive bigint`)}const r=N6(e.p,t.Fp,i),s=N6(e.n,t.Fn,i),o=["Gx","Gy","a","b"];for(const a of o)if(!r.isValid(e[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:r,Fn:s}}BigInt(0),BigInt(1),BigInt(2),BigInt(8),rX("HashToScalar-");const Yy=BigInt(0),im=BigInt(1),r_=BigInt(2);function Vbe(n){return T2(n,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...n})}function Hbe(n){const e=Vbe(n),{P:t,type:i,adjustScalarBytes:r,powPminus2:s,randomBytes:o}=e,a=i==="x25519";if(!a&&i!=="x448")throw new Error("invalid type");const l=o||Ap,c=a?255:448,u=a?32:56,h=BigInt(a?9:5),f=BigInt(a?121665:39081),m=a?r_**BigInt(254):r_**BigInt(447),g=a?BigInt(8)*r_**BigInt(251)-im:BigInt(4)*r_**BigInt(445)-im,v=m+g+im,w=G=>lo(G,t),y=_(h);function _(G){return xL(w(G),u)}function x(G){const H=Br("u coordinate",G,u);return a&&(H[31]&=127),w(iA(H))}function S(G){return iA(r(Br("scalar",G,u)))}function M(G,H){const z=D(x(H),S(G));if(z===Yy)throw new Error("invalid private or public key received");return _(z)}function A(G){return M(G,y)}function I(G,H,z){const P=w(G*(H-z));return H=w(H-P),z=w(z+P),{x_2:H,x_3:z}}function D(G,H){IR("u",G,Yy,t),IR("scalar",H,m,v);const z=H,P=G;let R=im,F=Yy,N=G,O=im,B=Yy;for(let Q=BigInt(c-1);Q>=Yy;Q--){const oe=z>>Q&im;B^=oe,{x_2:R,x_3:N}=I(B,R,N),{x_2:F,x_3:O}=I(B,F,O),B=oe;const Y=R+F,te=w(Y*Y),le=R-F,ve=w(le*le),Te=te-ve,be=N+O,Le=N-O,Oe=w(Le*Y),J=w(be*le),Se=Oe+J,me=Oe-J;N=w(Se*Se),O=w(P*w(me*me)),R=w(te*ve),F=w(Te*(te+w(f*Te)))}({x_2:R,x_3:N}=I(B,R,N)),{x_2:F,x_3:O}=I(B,F,O);const W=s(F);return w(R*W)}const k={secretKey:u,publicKey:u,seed:u},C=(G=l(u))=>(Ha(G,k.seed),G);function U(G){const H=C(G);return{secretKey:H,publicKey:A(H)}}return{keygen:U,getSharedSecret:(G,H)=>M(G,H),getPublicKey:G=>A(G),scalarMult:M,scalarMultBase:A,utils:{randomSecretKey:C,randomPrivateKey:C},GuBytes:y.slice(),lengths:k}}const $be=BigInt(1),D6=BigInt(2),Gbe=BigInt(3),jbe=BigInt(5),Wbe=BigInt(8),UX=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),qbe={p:UX,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Wbe,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Kbe(n){const e=BigInt(10),t=BigInt(20),i=BigInt(40),r=BigInt(80),s=UX,o=n*n%s*n%s,a=va(o,D6,s)*o%s,l=va(a,$be,s)*n%s,c=va(l,jbe,s)*l%s,u=va(c,e,s)*c%s,h=va(u,t,s)*u%s,f=va(h,i,s)*h%s,m=va(f,r,s)*f%s,g=va(m,r,s)*f%s,v=va(g,e,s)*c%s;return{pow_p_5_8:va(v,D6,s)*n%s,b2:o}}function Xbe(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}const Ybe=of(qbe.p,{isLE:!0}),RR=(()=>{const n=Ybe.ORDER;return Hbe({P:n,type:"x25519",powPminus2:e=>{const{pow_p_5_8:t,b2:i}=Kbe(e);return lo(va(t,Gbe,n)*i,n)},adjustScalarBytes:Xbe})})(),O6=(n,e)=>(n+(n>=0?e:-e)/BX)/e;function Qbe(n,e,t){const[[i,r],[s,o]]=e,a=O6(o*n,t),l=O6(-r*n,t);let c=n-a*i-l*s,u=-a*r-l*o;const h=c<kc,f=u<kc;h&&(c=-c),f&&(u=-u);const m=J1(Math.ceil(_X(t)/2))+Pg;if(c<kc||c>=m||u<kc||u>=m)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:h,k1:c,k2neg:f,k2:u}}function NR(n){if(!["compact","recovered","der"].includes(n))throw new Error('Signature format must be "compact", "recovered", or "der"');return n}function eC(n,e){const t={};for(let i of Object.keys(e))t[i]=n[i]===void 0?e[i]:n[i];return nA(t.lowS,"lowS"),nA(t.prehash,"prehash"),t.format!==void 0&&NR(t.format),t}class Zbe extends Error{constructor(e=""){super(e)}}const wc={Err:Zbe,_tlv:{encode:(n,e)=>{const{Err:t}=wc;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length&1)throw new t("tlv.encode: unpadded data");const i=e.length/2,r=i_(i);if(r.length/2&128)throw new t("tlv.encode: long form length too big");const s=i>127?i_(r.length/2|128):"";return i_(n)+s+r+e},decode(n,e){const{Err:t}=wc;let i=0;if(n<0||n>256)throw new t("tlv.encode: wrong tag");if(e.length<2||e[i++]!==n)throw new t("tlv.decode: wrong tlv");const r=e[i++],s=!!(r&128);let o=0;if(!s)o=r;else{const l=r&127;if(!l)throw new t("tlv.decode(long): indefinite length not supported");if(l>4)throw new t("tlv.decode(long): byte length is too big");const c=e.subarray(i,i+l);if(c.length!==l)throw new t("tlv.decode: length bytes not complete");if(c[0]===0)throw new t("tlv.decode(long): zero leftmost byte");for(const u of c)o=o<<8|u;if(i+=l,o<128)throw new t("tlv.decode(long): not minimal encoding")}const a=e.subarray(i,i+o);if(a.length!==o)throw new t("tlv.decode: wrong value length");return{v:a,l:e.subarray(i+o)}}},_int:{encode(n){const{Err:e}=wc;if(n<kc)throw new e("integer: negative integers are not allowed");let t=i_(n);if(Number.parseInt(t[0],16)&8&&(t="00"+t),t.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return t},decode(n){const{Err:e}=wc;if(n[0]&128)throw new e("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return M2(n)}},toSig(n){const{Err:e,_int:t,_tlv:i}=wc,r=Br("signature",n),{v:s,l:o}=i.decode(48,r);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l}=i.decode(2,s),{v:c,l:u}=i.decode(2,l);if(u.length)throw new e("invalid signature: left bytes after parsing");return{r:t.decode(a),s:t.decode(c)}},hexFromSig(n){const{_tlv:e,_int:t}=wc,i=e.encode(2,t.encode(n.r)),r=e.encode(2,t.encode(n.s)),s=i+r;return e.encode(48,s)}},kc=BigInt(0),Pg=BigInt(1),BX=BigInt(2),s_=BigInt(3),Jbe=BigInt(4);function ng(n,e){const{BYTES:t}=n;let i;if(typeof e=="bigint")i=e;else{let r=Br("private key",e);try{i=n.fromBytes(r)}catch{throw new Error(`invalid private key: expected ui8a of size ${t}, got ${typeof e}`)}}if(!n.isValidNot0(i))throw new Error("invalid private key: out of range [1..N-1]");return i}function e_e(n,e={}){const t=zbe("weierstrass",n,e),{Fp:i,Fn:r}=t;let s=t.CURVE;const{h:o,n:a}=s;T2(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:l}=e;if(l&&(!i.is0(s.a)||typeof l.beta!="bigint"||!Array.isArray(l.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const c=FX(i,r);function u(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function h(G,H,z){const{x:P,y:R}=H.toAffine(),F=i.toBytes(P);if(nA(z,"isCompressed"),z){u();const N=!i.isOdd(R);return sh(kX(N),F)}else return sh(Uint8Array.of(4),F,i.toBytes(R))}function f(G){gd(G,void 0,"Point");const{publicKey:H,publicKeyUncompressed:z}=c,P=G.length,R=G[0],F=G.subarray(1);if(P===H&&(R===2||R===3)){const N=i.fromBytes(F);if(!i.isValid(N))throw new Error("bad point: is not on curve, wrong x");const O=v(N);let B;try{B=i.sqrt(O)}catch(Q){const oe=Q instanceof Error?": "+Q.message:"";throw new Error("bad point: is not on curve, sqrt error"+oe)}u();const W=i.isOdd(B);return(R&1)===1!==W&&(B=i.neg(B)),{x:N,y:B}}else if(P===z&&R===4){const N=i.BYTES,O=i.fromBytes(F.subarray(0,N)),B=i.fromBytes(F.subarray(N,N*2));if(!w(O,B))throw new Error("bad point: is not on curve");return{x:O,y:B}}else throw new Error(`bad point: got length ${P}, expected compressed=${H} or uncompressed=${z}`)}const m=e.toBytes||h,g=e.fromBytes||f;function v(G){const H=i.sqr(G),z=i.mul(H,G);return i.add(i.add(z,i.mul(G,s.a)),s.b)}function w(G,H){const z=i.sqr(H),P=v(G);return i.eql(z,P)}if(!w(s.Gx,s.Gy))throw new Error("bad curve params: generator point");const y=i.mul(i.pow(s.a,s_),Jbe),_=i.mul(i.sqr(s.b),BigInt(27));if(i.is0(i.add(y,_)))throw new Error("bad curve params: a or b");function x(G,H,z=!1){if(!i.isValid(H)||z&&i.is0(H))throw new Error(`bad point coordinate ${G}`);return H}function S(G){if(!(G instanceof k))throw new Error("ProjectivePoint expected")}function M(G){if(!l||!l.basises)throw new Error("no endo");return Qbe(G,l.basises,r.ORDER)}const A=T6((G,H)=>{const{X:z,Y:P,Z:R}=G;if(i.eql(R,i.ONE))return{x:z,y:P};const F=G.is0();H==null&&(H=F?i.ONE:i.inv(R));const N=i.mul(z,H),O=i.mul(P,H),B=i.mul(R,H);if(F)return{x:i.ZERO,y:i.ZERO};if(!i.eql(B,i.ONE))throw new Error("invZ was invalid");return{x:N,y:O}}),I=T6(G=>{if(G.is0()){if(e.allowInfinityPoint&&!i.is0(G.Y))return;throw new Error("bad point: ZERO")}const{x:H,y:z}=G.toAffine();if(!i.isValid(H)||!i.isValid(z))throw new Error("bad point: x or y not field elements");if(!w(H,z))throw new Error("bad point: equation left != right");if(!G.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function D(G,H,z,P,R){return z=new k(i.mul(z.X,G),z.Y,z.Z),H=rA(P,H),z=rA(R,z),H.add(z)}class k{constructor(H,z,P){this.X=x("x",H),this.Y=x("y",z,!0),this.Z=x("z",P),Object.freeze(this)}static CURVE(){return s}static fromAffine(H){const{x:z,y:P}=H||{};if(!H||!i.isValid(z)||!i.isValid(P))throw new Error("invalid affine point");if(H instanceof k)throw new Error("projective point not allowed");return i.is0(z)&&i.is0(P)?k.ZERO:new k(z,P,i.ONE)}static fromBytes(H){const z=k.fromAffine(g(gd(H,void 0,"point")));return z.assertValidity(),z}static fromHex(H){return k.fromBytes(Br("pointHex",H))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(H=8,z=!0){return U.createCache(this,H),z||this.multiply(s_),this}assertValidity(){I(this)}hasEvenY(){const{y:H}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(H)}equals(H){S(H);const{X:z,Y:P,Z:R}=this,{X:F,Y:N,Z:O}=H,B=i.eql(i.mul(z,O),i.mul(F,R)),W=i.eql(i.mul(P,O),i.mul(N,R));return B&&W}negate(){return new k(this.X,i.neg(this.Y),this.Z)}double(){const{a:H,b:z}=s,P=i.mul(z,s_),{X:R,Y:F,Z:N}=this;let O=i.ZERO,B=i.ZERO,W=i.ZERO,Q=i.mul(R,R),oe=i.mul(F,F),Y=i.mul(N,N),te=i.mul(R,F);return te=i.add(te,te),W=i.mul(R,N),W=i.add(W,W),O=i.mul(H,W),B=i.mul(P,Y),B=i.add(O,B),O=i.sub(oe,B),B=i.add(oe,B),B=i.mul(O,B),O=i.mul(te,O),W=i.mul(P,W),Y=i.mul(H,Y),te=i.sub(Q,Y),te=i.mul(H,te),te=i.add(te,W),W=i.add(Q,Q),Q=i.add(W,Q),Q=i.add(Q,Y),Q=i.mul(Q,te),B=i.add(B,Q),Y=i.mul(F,N),Y=i.add(Y,Y),Q=i.mul(Y,te),O=i.sub(O,Q),W=i.mul(Y,oe),W=i.add(W,W),W=i.add(W,W),new k(O,B,W)}add(H){S(H);const{X:z,Y:P,Z:R}=this,{X:F,Y:N,Z:O}=H;let B=i.ZERO,W=i.ZERO,Q=i.ZERO;const oe=s.a,Y=i.mul(s.b,s_);let te=i.mul(z,F),le=i.mul(P,N),ve=i.mul(R,O),Te=i.add(z,P),be=i.add(F,N);Te=i.mul(Te,be),be=i.add(te,le),Te=i.sub(Te,be),be=i.add(z,R);let Le=i.add(F,O);return be=i.mul(be,Le),Le=i.add(te,ve),be=i.sub(be,Le),Le=i.add(P,R),B=i.add(N,O),Le=i.mul(Le,B),B=i.add(le,ve),Le=i.sub(Le,B),Q=i.mul(oe,be),B=i.mul(Y,ve),Q=i.add(B,Q),B=i.sub(le,Q),Q=i.add(le,Q),W=i.mul(B,Q),le=i.add(te,te),le=i.add(le,te),ve=i.mul(oe,ve),be=i.mul(Y,be),le=i.add(le,ve),ve=i.sub(te,ve),ve=i.mul(oe,ve),be=i.add(be,ve),te=i.mul(le,be),W=i.add(W,te),te=i.mul(Le,be),B=i.mul(Te,B),B=i.sub(B,te),te=i.mul(Te,le),Q=i.mul(Le,Q),Q=i.add(Q,te),new k(B,W,Q)}subtract(H){return this.add(H.negate())}is0(){return this.equals(k.ZERO)}multiply(H){const{endo:z}=e;if(!r.isValidNot0(H))throw new Error("invalid scalar: out of range");let P,R;const F=N=>U.cached(this,N,O=>YP(k,O));if(z){const{k1neg:N,k1:O,k2neg:B,k2:W}=M(H),{p:Q,f:oe}=F(O),{p:Y,f:te}=F(W);R=oe.add(te),P=D(z.beta,Q,Y,N,B)}else{const{p:N,f:O}=F(H);P=N,R=O}return YP(k,[P,R])[0]}multiplyUnsafe(H){const{endo:z}=e,P=this;if(!r.isValid(H))throw new Error("invalid scalar: out of range");if(H===kc||P.is0())return k.ZERO;if(H===Pg)return P;if(U.hasCache(this))return this.multiply(H);if(z){const{k1neg:R,k1:F,k2neg:N,k2:O}=M(H),{p1:B,p2:W}=kbe(k,P,F,O);return D(z.beta,B,W,R,N)}else return U.unsafe(P,H)}multiplyAndAddUnsafe(H,z,P){const R=this.multiplyUnsafe(z).add(H.multiplyUnsafe(P));return R.is0()?void 0:R}toAffine(H){return A(this,H)}isTorsionFree(){const{isTorsionFree:H}=e;return o===Pg?!0:H?H(k,this):U.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:H}=e;return o===Pg?this:H?H(k,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(H=!0){return nA(H,"isCompressed"),this.assertValidity(),m(k,this,H)}toHex(H=!0){return Tg(this.toBytes(H))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(H=!0){return this.toBytes(H)}_setWindowSize(H){this.precompute(H)}static normalizeZ(H){return YP(k,H)}static msm(H,z){return Fbe(k,r,H,z)}static fromPrivateKey(H){return k.BASE.multiply(ng(r,H))}}k.BASE=new k(s.Gx,s.Gy,i.ONE),k.ZERO=new k(i.ZERO,i.ONE,i.ZERO),k.Fp=i,k.Fn=r;const C=r.BITS,U=new Bbe(k,e.endo?Math.ceil(C/2):C);return k.BASE.precompute(8),k}function kX(n){return Uint8Array.of(n?2:3)}function FX(n,e){return{secretKey:e.BYTES,publicKey:1+n.BYTES,publicKeyUncompressed:1+2*n.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function t_e(n,e={}){const{Fn:t}=n,i=e.randomBytes||Ap,r=Object.assign(FX(n.Fp,t),{seed:DX(t.ORDER)});function s(f){try{return!!ng(t,f)}catch{return!1}}function o(f,m){const{publicKey:g,publicKeyUncompressed:v}=r;try{const w=f.length;return m===!0&&w!==g||m===!1&&w!==v?!1:!!n.fromBytes(f)}catch{return!1}}function a(f=i(r.seed)){return Obe(gd(f,r.seed,"seed"),t.ORDER)}function l(f,m=!0){return n.BASE.multiply(ng(t,f)).toBytes(m)}function c(f){const m=a(f);return{secretKey:m,publicKey:l(m)}}function u(f){if(typeof f=="bigint")return!1;if(f instanceof n)return!0;const{secretKey:m,publicKey:g,publicKeyUncompressed:v}=r;if(t.allowedLengths||m===g)return;const w=Br("key",f).length;return w===g||w===v}function h(f,m,g=!0){if(u(f)===!0)throw new Error("first arg must be private key");if(u(m)===!1)throw new Error("second arg must be public key");const v=ng(t,f);return n.fromHex(m).multiply(v).toBytes(g)}return Object.freeze({getPublicKey:l,getSharedSecret:h,keygen:c,Point:n,utils:{isValidSecretKey:s,isValidPublicKey:o,randomSecretKey:a,isValidPrivateKey:s,randomPrivateKey:a,normPrivateKeyToScalar:f=>ng(t,f),precompute(f=8,m=n.BASE){return m.precompute(f,!1)}},lengths:r})}function n_e(n,e,t={}){x2(e),T2(t,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const i=t.randomBytes||Ap,r=t.hmac||((z,...P)=>S2(e,z,sh(...P))),{Fp:s,Fn:o}=n,{ORDER:a,BITS:l}=o,{keygen:c,getPublicKey:u,getSharedSecret:h,utils:f,lengths:m}=t_e(n,t),g={prehash:!1,lowS:typeof t.lowS=="boolean"?t.lowS:!1,format:void 0,extraEntropy:!1},v="compact";function w(z){const P=a>>Pg;return z>P}function y(z,P){if(!o.isValidNot0(P))throw new Error(`invalid signature ${z}: out of range 1..Point.Fn.ORDER`);return P}function _(z,P){NR(P);const R=m.signature,F=P==="compact"?R:P==="recovered"?R+1:void 0;return gd(z,F,`${P} signature`)}class x{constructor(P,R,F){this.r=y("r",P),this.s=y("s",R),F!=null&&(this.recovery=F),Object.freeze(this)}static fromBytes(P,R=v){_(P,R);let F;if(R==="der"){const{r:W,s:Q}=wc.toSig(gd(P));return new x(W,Q)}R==="recovered"&&(F=P[0],R="compact",P=P.subarray(1));const N=o.BYTES,O=P.subarray(0,N),B=P.subarray(N,N*2);return new x(o.fromBytes(O),o.fromBytes(B),F)}static fromHex(P,R){return this.fromBytes(eA(P),R)}addRecoveryBit(P){return new x(this.r,this.s,P)}recoverPublicKey(P){const R=s.ORDER,{r:F,s:N,recovery:O}=this;if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");if(a*BX<R&&O>1)throw new Error("recovery id is ambiguous for h>1 curve");const B=O===2||O===3?F+a:F;if(!s.isValid(B))throw new Error("recovery id 2 or 3 invalid");const W=s.toBytes(B),Q=n.fromBytes(sh(kX((O&1)===0),W)),oe=o.inv(B),Y=M(Br("msgHash",P)),te=o.create(-Y*oe),le=o.create(N*oe),ve=n.BASE.multiplyUnsafe(te).add(Q.multiplyUnsafe(le));if(ve.is0())throw new Error("point at infinify");return ve.assertValidity(),ve}hasHighS(){return w(this.s)}toBytes(P=v){if(NR(P),P==="der")return eA(wc.hexFromSig(this));const R=o.toBytes(this.r),F=o.toBytes(this.s);if(P==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return sh(Uint8Array.of(this.recovery),R,F)}return sh(R,F)}toHex(P){return Tg(this.toBytes(P))}assertValidity(){}static fromCompact(P){return x.fromBytes(Br("sig",P),"compact")}static fromDER(P){return x.fromBytes(Br("sig",P),"der")}normalizeS(){return this.hasHighS()?new x(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Tg(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Tg(this.toBytes("compact"))}}const S=t.bits2int||function(z){if(z.length>8192)throw new Error("input is too large");const P=M2(z),R=z.length*8-l;return R>0?P>>BigInt(R):P},M=t.bits2int_modN||function(z){return o.create(S(z))},A=J1(l);function I(z){return IR("num < 2^"+l,z,kc,A),o.toBytes(z)}function D(z,P){return gd(z,void 0,"message"),P?gd(e(z),void 0,"prehashed message"):z}function k(z,P,R){if(["recovered","canonical"].some(le=>le in R))throw new Error("sign() legacy options not supported");const{lowS:F,prehash:N,extraEntropy:O}=eC(R,g);z=D(z,N);const B=M(z),W=ng(o,P),Q=[I(W),I(B)];if(O!=null&&O!==!1){const le=O===!0?i(m.secretKey):O;Q.push(Br("extraEntropy",le))}const oe=sh(...Q),Y=B;function te(le){const ve=S(le);if(!o.isValidNot0(ve))return;const Te=o.inv(ve),be=n.BASE.multiply(ve).toAffine(),Le=o.create(be.x);if(Le===kc)return;const Oe=o.create(Te*o.create(Y+Le*W));if(Oe===kc)return;let J=(be.x===Le?0:2)|Number(be.y&Pg),Se=Oe;return F&&w(Oe)&&(Se=o.neg(Oe),J^=1),new x(Le,Se,J)}return{seed:oe,k2sig:te}}function C(z,P,R={}){z=Br("message",z);const{seed:F,k2sig:N}=k(z,P,R);return Abe(e.outputLen,o.BYTES,r)(F,N)}function U(z){let P;const R=typeof z=="string"||w2(z),F=!R&&z!==null&&typeof z=="object"&&typeof z.r=="bigint"&&typeof z.s=="bigint";if(!R&&!F)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(F)P=new x(z.r,z.s);else if(R){try{P=x.fromBytes(Br("sig",z),"der")}catch(N){if(!(N instanceof wc.Err))throw N}if(!P)try{P=x.fromBytes(Br("sig",z),"compact")}catch{return!1}}return P||!1}function G(z,P,R,F={}){const{lowS:N,prehash:O,format:B}=eC(F,g);if(R=Br("publicKey",R),P=D(Br("message",P),O),"strict"in F)throw new Error("options.strict was renamed to lowS");const W=B===void 0?U(z):x.fromBytes(Br("sig",z),B);if(W===!1)return!1;try{const Q=n.fromBytes(R);if(N&&W.hasHighS())return!1;const{r:oe,s:Y}=W,te=M(P),le=o.inv(Y),ve=o.create(te*le),Te=o.create(oe*le),be=n.BASE.multiplyUnsafe(ve).add(Q.multiplyUnsafe(Te));return be.is0()?!1:o.create(be.x)===oe}catch{return!1}}function H(z,P,R={}){const{prehash:F}=eC(R,g);return P=D(P,F),x.fromBytes(z,"recovered").recoverPublicKey(P).toBytes()}return Object.freeze({keygen:c,getPublicKey:u,getSharedSecret:h,utils:f,lengths:m,Point:n,sign:C,verify:G,recoverPublicKey:H,Signature:x,hash:e})}function i_e(n){const e={a:n.a,b:n.b,p:n.Fp.ORDER,n:n.n,h:n.h,Gx:n.Gx,Gy:n.Gy},t=n.Fp;let i=n.allowedPrivateKeyLengths?Array.from(new Set(n.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0;const r=of(e.n,{BITS:n.nBitLength,allowedLengths:i,modFromBytes:n.wrapPrivateKey}),s={Fp:t,Fn:r,allowInfinityPoint:n.allowInfinityPoint,endo:n.endo,isTorsionFree:n.isTorsionFree,clearCofactor:n.clearCofactor,fromBytes:n.fromBytes,toBytes:n.toBytes};return{CURVE:e,curveOpts:s}}function r_e(n){const{CURVE:e,curveOpts:t}=i_e(n),i={hmac:n.hmac,randomBytes:n.randomBytes,lowS:n.lowS,bits2int:n.bits2int,bits2int_modN:n.bits2int_modN};return{CURVE:e,curveOpts:t,hash:n.hash,ecdsaOpts:i}}function s_e(n,e){const t=e.Point;return Object.assign({},e,{ProjectivePoint:t,CURVE:Object.assign({},n,RX(t.Fn.ORDER,t.Fn.BITS))})}function o_e(n){const{CURVE:e,curveOpts:t,hash:i,ecdsaOpts:r}=r_e(n),s=e_e(e,t),o=n_e(s,i,r);return s_e(n,o)}function DR(n,e){const t=i=>o_e({...n,hash:i});return{...t(e),create:t}}const zX={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},VX={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},HX={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},a_e=of(zX.p),l_e=of(VX.p),c_e=of(HX.p),u_e=DR({...zX,Fp:a_e,lowS:!1},_2);DR({...VX,Fp:l_e,lowS:!1},pxe),DR({...HX,Fp:c_e,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},dxe);const h_e=u_e,$X="base10",ls="base16",Ts="base64pad",oh="base64url",ex="utf8",GX=0,qc=1,tx=2,f_e=0,L6=1,ew=12,_L=32;function d_e(){const n=RR.utils.randomPrivateKey(),e=RR.getPublicKey(n);return{privateKey:Bs(n,ls),publicKey:Bs(e,ls)}}function OR(){const n=Ap(_L);return Bs(n,ls)}function p_e(n,e){const t=RR.getSharedSecret(ia(n,ls),ia(e,ls)),i=Ebe(A2,t,void 0,void 0,_L);return Bs(i,ls)}function zE(n){const e=A2(ia(n,ls));return Bs(e,ls)}function Qo(n){const e=A2(ia(n,ex));return Bs(e,ls)}function jX(n){return ia(`${n}`,$X)}function dp(n){return Number(Bs(n,$X))}function WX(n){return n.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function qX(n){const e=n.replace(/-/g,"+").replace(/_/g,"/"),t=(4-e.length%4)%4;return e+"=".repeat(t)}function m_e(n){const e=jX(typeof n.type<"u"?n.type:GX);if(dp(e)===qc&&typeof n.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const t=typeof n.senderPublicKey<"u"?ia(n.senderPublicKey,ls):void 0,i=typeof n.iv<"u"?ia(n.iv,ls):Ap(ew),r=ia(n.symKey,ls),s=wX(r,i).encrypt(ia(n.message,ex)),o=KX({type:e,sealed:s,iv:i,senderPublicKey:t});return n.encoding===oh?WX(o):o}function g_e(n){const e=ia(n.symKey,ls),{sealed:t,iv:i}=Yw({encoded:n.encoded,encoding:n.encoding}),r=wX(e,i).decrypt(t);if(r===null)throw new Error("Failed to decrypt");return Bs(r,ex)}function y_e(n,e){const t=jX(tx),i=Ap(ew),r=ia(n,ex),s=KX({type:t,sealed:r,iv:i});return e===oh?WX(s):s}function v_e(n,e){const{sealed:t}=Yw({encoded:n,encoding:e});return Bs(t,ex)}function KX(n){if(dp(n.type)===tx)return Bs(Jv([n.type,n.sealed]),Ts);if(dp(n.type)===qc){if(typeof n.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Bs(Jv([n.type,n.senderPublicKey,n.iv,n.sealed]),Ts)}return Bs(Jv([n.type,n.iv,n.sealed]),Ts)}function Yw(n){const e=(n.encoding||Ts)===oh?qX(n.encoded):n.encoded,t=ia(e,Ts),i=t.slice(f_e,L6),r=L6;if(dp(i)===qc){const l=r+_L,c=l+ew,u=t.slice(r,l),h=t.slice(l,c),f=t.slice(c);return{type:i,sealed:f,iv:h,senderPublicKey:u}}if(dp(i)===tx){const l=t.slice(r),c=Ap(ew);return{type:i,sealed:l,iv:c}}const s=r+ew,o=t.slice(r,s),a=t.slice(s);return{type:i,sealed:a,iv:o}}function w_e(n,e){const t=Yw({encoded:n,encoding:e==null?void 0:e.encoding});return XX({type:dp(t.type),senderPublicKey:typeof t.senderPublicKey<"u"?Bs(t.senderPublicKey,ls):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function XX(n){const e=(n==null?void 0:n.type)||GX;if(e===qc){if(typeof(n==null?void 0:n.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(n==null?void 0:n.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:n==null?void 0:n.senderPublicKey,receiverPublicKey:n==null?void 0:n.receiverPublicKey}}function U6(n){return n.type===qc&&typeof n.senderPublicKey=="string"&&typeof n.receiverPublicKey=="string"}function B6(n){return n.type===tx}function x_e(n){const e=Buffer.from(n.x,"base64"),t=Buffer.from(n.y,"base64");return Jv([new Uint8Array([4]),e,t])}function b_e(n,e){const[t,i,r]=n.split("."),s=Buffer.from(qX(r),"base64");if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32),a=s.slice(32,64),l=`${t}.${i}`,c=A2(l),u=x_e(e);if(!h_e.verify(Jv([o,a]),c,u))throw new Error("Invalid signature");return vR(n).payload}const __e="irn";function sA(n){return(n==null?void 0:n.relay)||{protocol:__e}}function ig(n){const e=swe[n];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${n}`);return e}var E_e=Object.defineProperty,S_e=Object.defineProperties,A_e=Object.getOwnPropertyDescriptors,k6=Object.getOwnPropertySymbols,M_e=Object.prototype.hasOwnProperty,T_e=Object.prototype.propertyIsEnumerable,F6=(n,e,t)=>e in n?E_e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,tC=(n,e)=>{for(var t in e||(e={}))M_e.call(e,t)&&F6(n,t,e[t]);if(k6)for(var t of k6(e))T_e.call(e,t)&&F6(n,t,e[t]);return n},P_e=(n,e)=>S_e(n,A_e(e));function C_e(n,e="-"){const t={},i="relay"+e;return Object.keys(n).forEach(r=>{if(r.startsWith(i)){const s=r.replace(i,""),o=n[r];t[s]=o}}),t}function z6(n){if(!n.includes("wc:")){const c=ZK(n);c!=null&&c.includes("wc:")&&(n=c)}n=n.includes("wc://")?n.replace("wc://",""):n,n=n.includes("wc:")?n.replace("wc:",""):n;const e=n.indexOf(":"),t=n.indexOf("?")!==-1?n.indexOf("?"):void 0,i=n.substring(0,e),r=n.substring(e+1,t).split("@"),s=typeof t<"u"?n.substring(t):"",o=new URLSearchParams(s),a=Object.fromEntries(o.entries()),l=typeof a.methods=="str
184ing"?a.methods.split(","):void 0;return{protocol:i,topic:I_e(r[0]),version:parseInt(r[1],10),symKey:a.symKey,relay:C_e(a),methods:l,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function I_e(n){return n.startsWith("//")?n.substring(2):n}function R_e(n,e="-"){const t="relay",i={};return Object.keys(n).forEach(r=>{const s=r,o=t+e+s;n[s]&&(i[o]=n[s])}),i}function V6(n){const e=new URLSearchParams,t=tC(tC(P_e(tC({},R_e(n.relay)),{symKey:n.symKey}),n.expiryTimestamp&&{expiryTimestamp:n.expiryTimestamp.toString()}),n.methods&&{methods:n.methods.join(",")});return Object.entries(t).sort(([i],[r])=>i.localeCompare(r)).forEach(([i,r])=>{r!==void 0&&e.append(i,String(r))}),`${n.protocol}:${n.topic}@${n.version}?${e}`}function o_(n,e,t){return`${n}?wc_ev=${t}&topic=${e}`}var N_e=Object.defineProperty,D_e=Object.defineProperties,O_e=Object.getOwnPropertyDescriptors,H6=Object.getOwnPropertySymbols,L_e=Object.prototype.hasOwnProperty,U_e=Object.prototype.propertyIsEnumerable,$6=(n,e,t)=>e in n?N_e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,B_e=(n,e)=>{for(var t in e||(e={}))L_e.call(e,t)&&$6(n,t,e[t]);if(H6)for(var t of H6(e))U_e.call(e,t)&&$6(n,t,e[t]);return n},k_e=(n,e)=>D_e(n,O_e(e));function ty(n){const e=[];return n.forEach(t=>{const[i,r]=t.split(":");e.push(`${i}:${r}`)}),e}function YX(n){const e=[];return Object.values(n).forEach(t=>{e.push(...ty(t.accounts))}),[...new Set(e)]}function F_e(n){const e=[];return Object.values(n).forEach(t=>{e.push(...t.methods)}),[...new Set(e)]}function z_e(n){const e=[];return Object.values(n).forEach(t=>{e.push(...t.events)}),[...new Set(e)]}function V_e(n,e){const t=[];return Object.values(n).forEach(i=>{ty(i.accounts).includes(e)&&t.push(...i.methods)}),t}function H_e(n,e){const t=[];return Object.values(n).forEach(i=>{ty(i.accounts).includes(e)&&t.push(...i.events)}),t}function P2(n){return n.includes(":")}function rg(n){return P2(n)?n.split(":")[0]:n}function G6(n){var e,t,i;const r={};if(!Bl(n))return r;for(const[s,o]of Object.entries(n)){const a=P2(s)?[s]:o.chains,l=o.methods||[],c=o.events||[],u=rg(s);r[u]=k_e(B_e({},r[u]),{chains:Ul(a,(e=r[u])==null?void 0:e.chains),methods:Ul(l,(t=r[u])==null?void 0:t.methods),events:Ul(c,(i=r[u])==null?void 0:i.events)})}return r}function $_e(n){const e={};return n==null||n.forEach(t=>{var i;const[r,s]=t.split(":");e[r]||(e[r]={accounts:[],chains:[],events:[],methods:[]}),e[r].accounts.push(t),(i=e[r].chains)==null||i.push(`${r}:${s}`)}),e}function j6(n,e){e=e.map(i=>i.replace("did:pkh:",""));const t=$_e(e);for(const[i,r]of Object.entries(t))r.methods?r.methods=Ul(r.methods,n):r.methods=n,r.events=["chainChanged","accountsChanged"];return t}function G_e(n,e){var t,i,r,s,o,a;const l=G6(n),c=G6(e),u={},h=Object.keys(l).concat(Object.keys(c));for(const f of h)u[f]={chains:Ul((t=l[f])==null?void 0:t.chains,(i=c[f])==null?void 0:i.chains),methods:Ul((r=l[f])==null?void 0:r.methods,(s=c[f])==null?void 0:s.methods),events:Ul((o=l[f])==null?void 0:o.events,(a=c[f])==null?void 0:a.events)};return u}const j_e={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},W_e={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function Ve(n,e){const{message:t,code:i}=W_e[n];return{message:e?`${t} ${e}`:t,code:i}}function Dn(n,e){const{message:t,code:i}=j_e[n];return{message:e?`${t} ${e}`:t,code:i}}function sa(n,e){return!!Array.isArray(n)}function Bl(n){return Object.getPrototypeOf(n)===Object.prototype&&Object.keys(n).length}function qi(n){return typeof n>"u"}function _i(n,e){return e&&qi(n)?!0:typeof n=="string"&&!!n.trim().length}function EL(n,e){return typeof n=="number"&&!isNaN(n)}function q_e(n,e){const{requiredNamespaces:t}=e,i=Object.keys(n.namespaces),r=Object.keys(t);let s=!0;return md(r,i)?(i.forEach(o=>{const{accounts:a,methods:l,events:c}=n.namespaces[o],u=ty(a),h=t[o];
vendor: 17,818 bytes, lines 184-190
184(!md(qK(o,h),u)||!md(h.methods,l)||!md(h.events,c))&&(s=!1)}),s):!1}function oA(n){return _i(n,!1)&&n.includes(":")?n.split(":").length===2:!1}function K_e(n){if(_i(n,!1)&&n.includes(":")){const e=n.split(":");if(e.length===3){const t=e[0]+":"+e[1];return!!e[2]&&oA(t)}}return!1}function X_e(n){function e(t){try{return typeof new URL(t)<"u"}catch{return!1}}try{if(_i(n,!1)){if(e(n))return!0;const t=ZK(n);return e(t)}}catch{}return!1}function Y_e(n){var e;return(e=n==null?void 0:n.proposer)==null?void 0:e.publicKey}function Q_e(n){return n==null?void 0:n.topic}function Z_e(n,e){let t=null;return _i(n==null?void 0:n.publicKey,!1)||(t=Ve("MISSING_OR_INVALID",`${e} controller public key should be a string`)),t}function W6(n){let e=!0;return sa(n)?n.length&&(e=n.every(t=>_i(t,!1))):e=!1,e}function J_e(n,e,t){let i=null;return sa(e)&&e.length?e.forEach(r=>{i||oA(r)||(i=Dn("UNSUPPORTED_CHAINS",`${t}, chain ${r} should be a string and conform to "namespace:chainId" format`))}):oA(n)||(i=Dn("UNSUPPORTED_CHAINS",`${t}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),i}function eEe(n,e,t){let i=null;return Object.entries(n).forEach(([r,s])=>{if(i)return;const o=J_e(r,qK(r,s),`${e} ${t}`);o&&(i=o)}),i}function tEe(n,e){let t=null;return sa(n)?n.forEach(i=>{t||K_e(i)||(t=Dn("UNSUPPORTED_ACCOUNTS",`${e}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):t=Dn("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),t}function nEe(n,e){let t=null;return Object.values(n).forEach(i=>{if(t)return;const r=tEe(i==null?void 0:i.accounts,`${e} namespace`);r&&(t=r)}),t}function iEe(n,e){let t=null;return W6(n==null?void 0:n.methods)?W6(n==null?void 0:n.events)||(t=Dn("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):t=Dn("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),t}function QX(n,e){let t=null;return Object.values(n).forEach(i=>{if(t)return;const r=iEe(i,`${e}, namespace`);r&&(t=r)}),t}function rEe(n,e,t){let i=null;if(n&&Bl(n)){const r=QX(n,e);r&&(i=r);const s=eEe(n,e,t);s&&(i=s)}else i=Ve("MISSING_OR_INVALID",`${e}, ${t} should be an object with data`);return i}function nC(n,e){let t=null;if(n&&Bl(n)){const i=QX(n,e);i&&(t=i);const r=nEe(n,e);r&&(t=r)}else t=Ve("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return t}function ZX(n){return _i(n.protocol,!0)}function sEe(n,e){let t=!1;return n?n&&sa(n)&&n.length&&n.forEach(i=>{t=ZX(i)}):t=!0,t}function oEe(n){return typeof n=="number"}function bs(n){return typeof n<"u"&&typeof n!==null}function aEe(n){return!(!n||typeof n!="object"||!n.code||!EL(n.code)||!n.message||!_i(n.message,!1))}function lEe(n){return!(qi(n)||!_i(n.method,!1))}function cEe(n){return!(qi(n)||qi(n.result)&&qi(n.error)||!EL(n.id)||!_i(n.jsonrpc,!1))}function uEe(n){return!(qi(n)||!_i(n.name,!1))}function q6(n,e){return!(!oA(e)||!YX(n).includes(e))}function hEe(n,e,t){return _i(t,!1)?V_e(n,e).includes(t):!1}function fEe(n,e,t){return _i(t,!1)?H_e(n,e).includes(t):!1}function K6(n,e,t){let i=null;const r=dEe(n),s=pEe(e),o=Object.keys(r),a=Object.keys(s),l=X6(Object.keys(n)),c=X6(Object.keys(e)),u=l.filter(h=>!c.includes(h));return u.length&&(i=Ve("NON_CONFORMING_NAMESPACES",`${t} namespaces keys don't satisfy requiredNamespaces.
185      Required: ${u.toString()}
186      Received: ${Object.keys(e).toString()}`)),md(o,a)||(i=Ve("NON_CONFORMING_NAMESPACES",`${t} namespaces chains don't satisfy required namespaces.
187      Required: ${o.toString()}
188      Approved: ${a.toString()}`)),Object.keys(e).forEach(h=>{if(!h.includes(":")||i)return;const f=ty(e[h].accounts);f.includes(h)||(i=Ve("NON_CONFORMING_NAMESPACES",`${t} namespaces accounts don't satisfy namespace accounts for ${h}
189        Required: ${h}
190        Approved: ${f.toString()}`))}),o.forEach(h=>{i||(md(r[h].methods,s[h].methods)?md(r[h].events,s[h].events)||(i=Ve("NON_CONFORMING_NAMESPACES",`${t} namespaces events don't satisfy namespace events for ${h}`)):i=Ve("NON_CONFORMING_NAMESPACES",`${t} namespaces methods don't satisfy namespace methods for ${h}`))}),i}function dEe(n){const e={};return Object.keys(n).forEach(t=>{var i;t.includes(":")?e[t]=n[t]:(i=n[t].chains)==null||i.forEach(r=>{e[r]={methods:n[t].methods,events:n[t].events}})}),e}function X6(n){return[...new Set(n.map(e=>e.includes(":")?e.split(":")[0]:e))]}function pEe(n){const e={};return Object.keys(n).forEach(t=>{if(t.includes(":"))e[t]=n[t];else{const i=ty(n[t].accounts);i==null||i.forEach(r=>{e[r]={accounts:n[t].accounts.filter(s=>s.includes(`${r}:`)),methods:n[t].methods,events:n[t].events}})}}),e}function mEe(n,e){return EL(n)&&n<=e.max&&n>=e.min}function Y6(){const n=Q1();return new Promise(e=>{switch(n){case fo.browser:e(gEe());break;case fo.reactNative:e(yEe());break;case fo.node:e(vEe());break;default:e(!0)}})}function gEe(){return ey()&&(navigator==null?void 0:navigator.onLine)}async function yEe(){if(sf()&&typeof global<"u"&&global!=null&&global.NetInfo){const n=await(global==null?void 0:global.NetInfo.fetch());return n==null?void 0:n.isConnected}return!0}function vEe(){return!0}function wEe(n){switch(Q1()){case fo.browser:xEe(n);break;case fo.reactNative:bEe(n);break}}function xEe(n){!sf()&&ey()&&(window.addEventListener("online",()=>n(!0)),window.addEventListener("offline",()=>n(!1)))}function bEe(n){sf()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>n(e==null?void 0:e.isConnected)))}function _Ee(){var n;return ey()&&cp()?((n=cp())==null?void 0:n.visibilityState)==="visible":!0}const iC={};class Qy{static get(e){return iC[e]}static set(e,t){iC[e]=t}static delete(e){delete iC[e]}}function EEe(n){const e=K1.decode(n);if(e.length<33)throw new Error("Too short to contain a public key");return e.slice(1,33)}function SEe({publicKey:n,signature:e,payload:t}){var i;const r=LR(t.method),s=128|parseInt(((i=t.version)==null?void 0:i.toString())||"4"),o=TEe(t.address),a=t.era==="00"?new Uint8Array([0]):LR(t.era);if(a.length!==1&&a.length!==2)throw new Error("Invalid era length");const l=parseInt(t.nonce,16),c=new Uint8Array([l&255,l>>8&255]),u=BigInt(`0x${MEe(t.tip)}`),h=CEe(u),f=new Uint8Array([0,...n,o,...e,...a,...c,...h,...r]),m=PEe(f.length+1);return new Uint8Array([...m,s,...f])}function AEe(n){const e=LR(n),t=ywe.blake2b(e,void 0,32);return"0x"+Buffer.from(t).toString("hex")}function LR(n){return new Uint8Array(n.replace(/^0x/,"").match(/.{1,2}/g).map(e=>parseInt(e,16)))}function MEe(n){return n.startsWith("0x")?n.slice(2):n}function TEe(n){const e=K1.decode(n)[0];return e===42?0:e===60?2:1}function PEe(n){if(n<64)return new Uint8Array([n<<2]);if(n<16384){const e=n<<2|1;return new Uint8Array([e&255,e>>8&255])}else if(n<1<<30){const e=n<<2|2;return new Uint8Array([e&255,e>>8&255,e>>16&255,e>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function CEe(n){if(n<BigInt(1)<<BigInt(6))return new Uint8Array([Number(n<<BigInt(2))]);if(n<BigInt(1)<<BigInt(14)){const e=n<<BigInt(2)|BigInt(1);return new Uint8Array([Number(e&BigInt(255)),Number(e>>BigInt(8)&BigInt(255))])}else if(n<BigInt(1)<<BigInt(30)){const e=n<<BigInt(2)|BigInt(2);return new Uint8Array([Number(e&BigInt(255)),Number(e>>BigInt(8)&BigInt(255)),Number(e>>BigInt(16)&BigInt(255)),Number(e>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function IEe(n){const e=Uint8Array.from(Buffer.from(n.signature,"hex")),t=EEe(n.transaction.address),i=SEe({publicKey:t,signature:e,payload:n.transaction}),r=Buffer.from(i).toString("hex");return AEe(r)}function SL({logger:n,name:e}){const t=typeof n=="string"?WK({opts:{level:n,name:e}}).logger:n;return t.level=typeof n=="string"?n:n.level,t}class Mp{}let REe=class extends Mp{constructor(e){super()}};const Q6=Be.FIVE_SECONDS,Tp={pulse:"heartbeat_pulse"};let NEe=class JX extends REe{constructor(e){super(e),this.events=new _o.EventEmitter,this.interval=Q6,this.interval=(e==null?void 0:e.interval)||Q6}static async init(e){const t=new JX(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),Be.toMiliseconds(this.interval))}pulse(){this.events.emit(Tp.pulse)}};const DEe=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,OEe=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,LEe=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function UEe(n,e){if(n==="__proto__"||n==="constructor"&&e&&typeof e=="object"&&"prototype"in e){BEe(n);return}return e}function BEe(n){console.warn(`[destr] Dropping "${n}" key to prevent prototype pollution.`)}function a_(n,e={}){if(typeof n!="string")return n;if(n[0]==='"'&&n[n.length-1]==='"'&&n.indexOf("\\")===-1)return n.slice(1,-1);const t=n.trim();if(t.length<=9)switch(t.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!LEe.test(n)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return n}try{if(DEe.test(n)||OEe.test(n)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(n,UEe)}return JSON.parse(n)}catch(i){if(e.strict)throw i;return n}}function kEe(n){return!n||typeof n.then!="function"?Promise.resolve(n):n}function Hi(n,...e){try{return kEe(n(...e))}catch(t){return Promise.reject(t)}}function FEe(n){const e=typeof n;return n===null||e!=="object"&&e!=="function"}function zEe(n){const e=Object.getPrototypeOf(n);return!e||e.isPrototypeOf(Object)}function VE(n){if(FEe(n))return String(n);if(zEe(n)||Array.isArray(n))return JSON.stringify(n);if(typeof n.toJSON=="function")return VE(n.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const UR="base64:";function VEe(n){return typeof n=="string"?n:UR+GEe(n)}function HEe(n){return typeof n!="string"||!n.startsWith(UR)?n:$Ee(n.slice(UR.length))}function $Ee(n){return globalThis.Buffer?Buffer.from(n,"base64"):Uint8Array.from(globalThis.atob(n),e=>e.codePointAt(0))}function GEe(n){return globalThis.Buffer?Buffer.from(n).toString("base64"):globalThis.btoa(String.fromCodePoint(...n))}function xs(n){var e;return n&&((e=n.split("?")[0])==null?void 0:e.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function jEe(...n){return xs(n.join(":"))}function l_(n){return n=xs(n),n?n+":":""}function WEe(n,e){if(e===void 0)return!0;let t=0,i=n.indexOf(":");for(;i>-1;)t++,i=n.indexOf(":",i+1);return t<=e}function qEe(n,e){return e?n.startsWith(e)&&n[n.length-1]!=="$":n[n.length-1]!=="$"}const KEe="memory",XEe=()=>{const n=new Map;return{name:KEe,getInstance:()=>n,hasItem(e){return n.has(e)},getItem(e){return n.get(e)??null},getItemRaw(e){return n.get(e)??null},setItem(e,t){n.set(e,t)},setItemRaw(e,t){n.set(e,t)},removeItem(e){n.delete(e)},getKeys(){return[...n.keys()]},clear(){n.clear()},dispose(){n.clear()}}};function YEe(n={}){const e={mounts:{"":n.driver||XEe()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},t=c=>{for(const u of e.mountpoints)if(c.startsWith(u))return{base:u,relativeKey:c.slice(u.length),driver:e.mounts[u]};return{base:"",relativeKey:c,driver:e.mounts[""]}},i=(c,u)=>e.mountpoints.filter(h=>h.startsWith(c)||u&&c.startsWith(h)).map(h=>({relativeBase:c.length>h.length?c.slice(h.length):void 0,mountpoint:h,driver:e.mounts[h]})),r=(c,u)=>{if(e.watching){u=xs(u);for(const h of e.watchListeners)h(c,u)}},s=async()=>{if(!e.watching){e.watching=!0;for(const c in e.mounts)e.unwatch[c]=await Z6(e.mounts[c],r,c)}},o=async()=>{if(e.watching){for(const c in e.unwatch)await e.unwatch[c]();e.unwatch={},e.watching=!1}},a=(c,u,h)=>{const f=new Map,m=g=>{let v=f.get(g.base);return v||(v={driver:g.driver,base:g.base,items:[]},f.set(g.base,v)),v};for(const g of c){const v=typeof g=="string",w=xs(v?g:g.key),y=v?void 0:g.value,_=v||!g.options?u:{...u,...g.options},x=t(w);m(x).items.push({key:w,value:y,relativeKey:x.relativeKey,options:_})}return Promise.all([...f.values()].map(g=>h(g))).then(g=>g.flat())},l={hasItem(c,u={}){c=xs(c);const{relativeKey:h,driver:f}=t(c);return Hi(f.hasItem,h,u)},getItem(c,u={}){c=xs(c);const{relativeKey:h,driver:f}=t(c);return Hi(f.getItem,h,u).then(m=>a_(m))},getItems(c,u={}){return a(c,u,h=>h.driver.getItems?Hi(h.driver.getItems,h.items.map(f=>({key:f.relativeKey,options:f.options})),u).then(f=>f.map(m=>({key:jEe(h.base,m.key),value:a_(m.value)}))):Promise.all(h.items.map(f=>Hi(h.driver.getItem,f.relativeKey,f.options).then(m=>({key:f.key,value:a_(m)})))))},getItemRaw(c,u={}){c=xs(c);const{relativeKey:h,driver:f}=t(c);return f.getItemRaw?Hi(f.getItemRaw,h,u):Hi(f.getItem,h,u).then(m=>HEe(m))},async setItem(c,u,h={}){if(u===void 0)return l.removeItem(c);c=xs(c);const{relativeKey:f,driver:m}=t(c);m.setItem&&(await Hi(m.setItem,f,VE(u),h),m.watch||r("update",c))},async setItems(c,u){await a(c,u,async h=>{if(h.driver.setItems)return Hi(h.driver.setItems,h.items.map(f=>({key:f.relativeKey,value:VE(f.value),options:f.options})),u);h.driver.setItem&&await Promise.all(h.items.map(f=>Hi(h.driver.setItem,f.relativeKey,VE(f.value),f.options)))})},async setItemRaw(c,u,h={}){if(u===void 0)return l.removeItem(c,h);c=xs(c);const{relativeKey:f,driver:m}=t(c);if(m.setItemRaw)await Hi(m.setItemRaw,f,u,h);else if(m.setItem)await Hi(m.setItem,f,VEe(u),h);else return;m.watch||r("update",c)},async removeItem(c,u={}){typeof u=="boolean"&&(u={removeMeta:u}),c=xs(c);const{relativeKey:h,driver:f}=t(c);f.removeItem&&(await Hi(f.removeItem,h,u),(u.removeMeta||u.removeMata)&&await Hi(f.removeItem,h+"$",u),f.watch||r("remove",c))},async getMeta(c,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),c=xs(c);const{relativeKey:h,driver:f}=t(c),m=Object.create(null);if(f.getMeta&&Object.assign(m,await Hi(f.getMeta,h,u)),!u.nativeOnly){const g=await Hi(f.getItem,h+"$",u).then(v=>a_(v));g&&typeof g=="object"&&(typeof g.atime=="string"&&(g.atime=new Date(g.atime)),typeof g.mtime=="string"&&(g.mtime=new Date(g.mtime)),Object.assign(m,g))}return m},setMeta(c,u,h={}){return this.setItem(c+"$",u,h)},removeMeta(c,u={}){return this.removeItem(c+"$",u)},async getKeys(c,u={}){var w;c=l_(c);const h=i(c,!0);let f=[];const m=[];let g=!0;for(const y of h){(w=y.driver.flags)!=null&&w.maxDepth||(g=!1);const _=await Hi(y.driver.getKeys,y.relativeBase,u);for(const x of _){const S=y.mountpoint+xs(x);f.some(M=>S.startsWith(M))||m.push(S)}f=[y.mountpoint,...f.filter(x=>!x.startsWith(y.mountpoint))]}const v=u.maxDepth!==void 0&&!g;return m.filter(y=>(!v||WEe(y,u.maxDepth))&&qEe(y,c))},async clear(c,u={}){c=l_(c),await Promise.all(i(c,!1).map(async h=>{if(h.driver.clear)return Hi(h.driver.clear,h.relativeBase,u);if(h.driver.removeItem){const f=await h.driver.getKeys(h.relativeBase||"",u);return Promise.all(f.map(m=>h.driver.removeItem(m,u)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(c=>J6(c)))},async watch(c){return await s(),e.watchListeners.push(c),async()=>{e.watchListeners=e.watchListeners.filter(u=>u!==c),e.watchListeners.length===0&&await o()}},async unwatch(){e.watchListeners=[],await o()},mount(c,u){if(c=l_(c),c&&e.mounts[c])throw new Error(`already mounted at ${c}`);return c&&(e.mountpoints.push(c),e.mountpoints.sort((h,f)=>f.length-h.length)),e.mounts[c]=u,e.watching&&Promise.resolve(Z6(u,r,c)).then(h=>{e.unwatch[c]=h}).catch(console.error),l},async unmount(c,u=!0){var h,f;c=l_(c),!(!c||!e.mounts[c])&&(e.watching&&c in e.unwatch&&((f=(h=e.unwatch)[c])==null||f.call(h),delete e.unwatch[c]),u&&await J6(e.mounts[c]),e.mountpoints=e.mountpoints.filter(m=>m!==c),delete e.mounts[c])},getMount(c=""){c=xs(c)+":";const u=t(c);return{driver:u.driver,base:u.base}},getMounts(c="",u={}){return c=xs(c),i(c,u.parents).map(f=>({driver:f.driver,base:f.mountpoint}))},keys:(c,u={})=>l.getKeys(c,u),get:(c,u={})=>l.getItem(c,u),set:(c,u,h={})=>l.setItem(c,u,h),has:(c,u={})=>l.hasItem(c,u),del:(c,u={})=>l.removeItem(c,u),remove:(c,u={})=>l.removeItem(c,u)};return l}function Z6(n,e,t){return n.watch?n.watch((i,r)=>e(i,t+r)):()=>{}}async function J6(n){typeof n.dispose=="function"&&await Hi(n.dispose)}function Pp(n){return new Promise((e,t)=>{n.oncomplete=n.onsuccess=()=>e(n.result),n.onabort=n.onerror=()=>t(n.error)})}function eY(n,e){let t;const i=()=>{if(t)return t;const r=indexedDB.open(n);return r.onupgradeneeded=()=>r.result.createObjectStore(e),t=Pp(r),t.then(s=>{s.onclose=()=>t=void 0},()=>{}),t};return(r,s)=>i().then(o=>s(o.transaction(e,r).objectStore(e)))}let rC;function nx(){return rC||(rC=eY("keyval-store","keyval")),rC}function ez(n,e=nx()){return e("readonly",t=>Pp(t.get(n)))}function QEe(n,e,t=nx()){return t("readwrite",i=>(i.put(e,n),Pp(i.transaction)))}function ZEe(n,e=nx()){return e("readwrite",t=>(t.delete(n),Pp(t.transaction)))}function JEe(n=nx()){return n("readwrite",e=>(e.clear(),Pp(e.transaction)))}function eSe(n,e){return n.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},Pp(n.transaction)}function tSe(n=nx()){return n("readonly",e=>{if(e.getAllKeys)return Pp(e.getAllKeys());const t=[];return eSe(e,i=>t.push(i.key)).then(()=>t)})}const nSe="idb-keyval";var iSe=(n={})=>{const e=n.base&&n.base.length>0?`${n.base}
190:`:"",t=r=>e+r;let i;return n.dbName&&n.storeName&&(i=eY(n.dbName,n.storeName)),{name:nSe,options:n,async hasItem(r){return!(typeof await ez(t(r),i)>"u")},async getItem(r){return await ez(t(r),i)??null},setItem(r,s){return QEe(t(r),s,i)},removeItem(r){return ZEe(t(r),i)},getKeys(){return tSe(i)},clear(){return JEe(i)}}};const rSe="WALLET_CONNECT_V2_INDEXED_DB",sSe="keyvaluestorage";let oSe=class{constructor(){this.indexedDb=YEe({driver:iSe({dbName:rSe,storeName:sSe})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,iu(t))}async removeItem(e){await this.indexedDb.removeItem(e)}};var sC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},HE={exports:{}};(function(){let n;function e(){}n=e,n.prototype.getItem=function(t){return this.hasOwnProperty(t)?String(this[t]):null},n.prototype.setItem=function(t,i){this[t]=String(i)},n.prototype.removeItem=function(t){delete this[t]},n.prototype.clear=function(){const t=this;Object.keys(t).forEach(function(i){t[i]=void 0,delete t[i]})},n.prototype.key=function(t){return t=t||0,Object.keys(this)[t]},n.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof sC<"u"&&sC.localStorage?HE.exports=sC.localStorage:typeof window<"u"&&window.localStorage?HE.exports=window.localStorage:HE.exports=new e})();function aSe(n){var e;return[n[0],hp((e=n[1])!=null?e:"")]}let lSe=class{constructor(){this.localStorage=HE.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(aSe)}async getItem(e){const t=this.localStorage.getItem(e);if(t!==null)return hp(t)}async setItem(e,t){this.localStorage.setItem(e,iu(t))}async removeItem(e){this.localStorage.removeItem(e)}};const cSe="wc_storage_version",tz=1,uSe=async(n,e,t)=>{const i=cSe,r=await e.getItem(i);if(r&&r>=tz){t(e);return}const s=await n.getKeys();if(!s.length){t(e);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const l=a.toLowerCase();if(l.includes("wc@")||l.includes("walletconnect")||l.includes("wc_")||l.includes("wallet_connect")){const c=await n.getItem(a);await e.setItem(a,c),o.push(a)}}await e.setItem(i,tz),t(e),hSe(n,o)},hSe=async(n,e)=>{e.length&&e.forEach(async t=>{await n.removeItem(t)})};let fSe=class{constructor(){this.initialized=!1,this.setInitialized=t=>{this.storage=t,this.initialized=!0};const e=new lSe;this.storage=e;try{const t=new oSe;uSe(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}};var dSe=Object.defineProperty,pSe=(n,e,t)=>e in n?dSe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,nz=(n,e,t)=>pSe(n,typeof e!="symbol"?e+"":e,t);let mSe=class extends Mp{constructor(e){super(),this.opts=e,nz(this,"protocol","wc"),nz(this,"version",2)}};var gSe=Object.defineProperty,ySe=(n,e,t)=>e in n?gSe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,vSe=(n,e,t)=>ySe(n,e+"",t);let wSe=class extends Mp{constructor(e,t){super(),this.core=e,this.logger=t,vSe(this,"records",new Map)}},xSe=class{constructor(e,t){this.logger=e,this.core=t}},bSe=class extends Mp{constructor(e,t){super(),this.relayer=e,this.logger=t}},_Se=class extends Mp{constructor(e){super()}},ESe=class{constructor(e,t,i,r){this.core=e,this.logger=t,this.name=i}},SSe=class extends Mp{constructor(e,t){super(),this.relayer=e,this.logger=t}},ASe=class extends Mp{constructor(e,t){super(),this.core=e,this.logger=t}},MSe=class{constructor(e,t,i){this.core=e,this.logger=t,this.store=i}},TSe=class{constructor(e,t){this.projectId=e,this.logger=t}},PSe=class{constructor(e,t,i){this.core=e,this.logger=t,this.telemetryEnabled=i}};
vendor: 27,318 bytes, lines 190-203
190var CSe=Object.defineProperty,ISe=(n,e,t)=>e in n?CSe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,iz=(n,e,t)=>ISe(n,typeof e!="symbol"?e+"":e,t);let RSe=class{constructor(e){this.opts=e,iz(this,"protocol","wc"),iz(this,"version",2)}},NSe=class{constructor(e){this.client=e}};const DSe="PARSE_ERROR",OSe="INVALID_REQUEST",LSe="METHOD_NOT_FOUND",USe="INVALID_PARAMS",tY="INTERNAL_ERROR",AL="SERVER_ERROR",BSe=[-32700,-32600,-32601,-32602,-32603],tw={[DSe]:{code:-32700,message:"Parse error"},[OSe]:{code:-32600,message:"Invalid Request"},[LSe]:{code:-32601,message:"Method not found"},[USe]:{code:-32602,message:"Invalid params"},[tY]:{code:-32603,message:"Internal error"},[AL]:{code:-32e3,message:"Server error"}},nY=AL;function kSe(n){return BSe.includes(n)}function rz(n){return Object.keys(tw).includes(n)?tw[n]:tw[nY]}function FSe(n){const e=Object.values(tw).find(t=>t.code===n);return e||tw[nY]}function iY(n,e,t){return n.message.includes("getaddrinfo ENOTFOUND")||n.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${t} RPC url at ${e}`):n}var rY={};/*! *****************************************************************************
191Copyright (c) Microsoft Corporation.
192
193Permission to use, copy, modify, and/or distribute this software for any
194purpose with or without fee is hereby granted.
195
196THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
197REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
198AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
199INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
200LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
201OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
202PERFORMANCE OF THIS SOFTWARE.
203***************************************************************************** */var BR=function(n,e){return BR=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])},BR(n,e)};function zSe(n,e){BR(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var kR=function(){return kR=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++){t=arguments[i];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},kR.apply(this,arguments)};function VSe(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(n);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(n,i[r])&&(t[i[r]]=n[i[r]]);return t}function HSe(n,e,t,i){var r=arguments.length,s=r<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(n,e,t,i);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(s=(r<3?o(s):r>3?o(e,t,s):o(e,t))||s);return r>3&&s&&Object.defineProperty(e,t,s),s}function $Se(n,e){return function(t,i){e(t,i,n)}}function GSe(n,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,e)}function jSe(n,e,t,i){function r(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(u){try{c(i.next(u))}catch(h){o(h)}}function l(u){try{c(i.throw(u))}catch(h){o(h)}}function c(u){u.done?s(u.value):r(u.value).then(a,l)}c((i=i.apply(n,e||[])).next())})}function WSe(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},i,r,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;t;)try{if(i=1,r&&(s=c[0]&2?r.return:c[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,c[1])).done)return s;switch(r=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,r=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]<s[3])){t.label=c[1];break}if(c[0]===6&&t.label<s[1]){t.label=s[1],s=c;break}if(s&&t.label<s[2]){t.label=s[2],t.ops.push(c);break}s[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(u){c=[6,u],r=0}finally{i=s=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function qSe(n,e,t,i){i===void 0&&(i=t),n[i]=e[t]}function KSe(n,e){for(var t in n)t!=="default"&&!e.hasOwnProperty(t)&&(e[t]=n[t])}function FR(n){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&n[e],i=0;if(t)return t.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&i>=n.length&&(n=void 0),{value:n&&n[i++],done:!n}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function sY(n,e){var t=typeof Symbol=="function"&&n[Symbol.iterator];if(!t)return n;var i=t.call(n),r,s=[],o;try{for(;(e===void 0||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return s}function XSe(){for(var n=[],e=0;e<arguments.length;e++)n=n.concat(sY(arguments[e]));return n}function YSe(){for(var n=0,e=0,t=arguments.length;e<t;e++)n+=arguments[e].length;for(var i=Array(n),r=0,e=0;e<t;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,r++)i[r]=s[o];return i}function Qw(n){return this instanceof Qw?(this.v=n,this):new Qw(n)}function QSe(n,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i=t.apply(n,e||[]),r,s=[];return r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(f){i[f]&&(r[f]=function(m){return new Promise(function(g,v){s.push([f,m,g,v])>1||a(f,m)})})}function a(f,m){try{l(i[f](m))}catch(g){h(s[0][3],g)}}function l(f){f.value instanceof Qw?Promise.resolve(f.value.v).then(c,u):h(s[0][2],f)}function c(f){a("next",f)}function u(f){a("throw",f)}function h(f,m){f(m),s.shift(),s.length&&a(s[0][0],s[0][1])}}function ZSe(n){var e,t;return e={},i("next"),i("throw",function(r){throw r}),i("return"),e[Symbol.iterator]=function(){return this},e;function i(r,s){e[r]=n[r]?function(o){return(t=!t)?{value:Qw(n[r](o)),done:r==="return"}:s?s(o):o}:s}}function JSe(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof FR=="function"?FR(n):n[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(s){t[s]=n[s]&&function(o){return new Promise(function(a,l){o=n[s](o),r(a,l,o.done,o.value)})}}function r(s,o,a,l){Promise.resolve(l).then(function(c){s({value:c,done:a})},o)}}function eAe(n,e){return Object.defineProperty?Object.defineProperty(n,"raw",{value:e}):n.raw=e,n}function tAe(n){if(n&&n.__esModule)return n;var e={};if(n!=null)for(var t in n)Object.hasOwnProperty.call(n,t)&&(e[t]=n[t]);return e.default=n,e}function nAe(n){return n&&n.__esModule?n:{default:n}}function iAe(n,e){if(!e.has(n))throw new TypeError("attempted to get private field on non-instance");return e.get(n)}function rAe(n,e,t){if(!e.has(n))throw new TypeError("attempted to set private field on non-instance");return e.set(n,t),t}const sAe=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return kR},__asyncDelegator:ZSe,__asyncGenerator:QSe,__asyncValues:JSe,__await:Qw,__awaiter:jSe,__classPrivateFieldGet:iAe,__classPrivateFieldSet:rAe,__createBinding:qSe,__decorate:HSe,__exportStar:KSe,__extends:zSe,__generator:WSe,__importDefault:nAe,__importStar:tAe,__makeTemplateObject:eAe,__metadata:GSe,__param:$Se,__read:sY,__rest:VSe,__spread:XSe,__spreadArrays:YSe,__values:FR},Symbol.toStringTag,{value:"Module"})),oAe=p9(sAe);var tc={},sz;function aAe(){if(sz)return tc;sz=1,Object.defineProperty(tc,"__esModule",{value:!0}),tc.isBrowserCryptoAvailable=tc.getSubtleCrypto=tc.getBrowerCrypto=void 0;function n(){return(El==null?void 0:El.crypto)||(El==null?void 0:El.msCrypto)||{}}tc.getBrowerCrypto=n;function e(){const i=n();return i.subtle||i.webkitSubtle}tc.getSubtleCrypto=e;function t(){return!!n()&&!!e()}return tc.isBrowserCryptoAvailable=t,tc}var nc={},oz;function lAe(){if(oz)return nc;oz=1,Object.defineProperty(nc,"__esModule",{value:!0}),nc.isBrowser=nc.isNode=nc.isReactNative=void 0;function n(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}nc.isReactNative=n;function e(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}nc.isNode=e;function t(){return!n()&&!e()}return nc.isBrowser=t,nc}(function(n){Object.defineProperty(n,"__esModule",{value:!0});const e=oAe;e.__exportStar(aAe(),n),e.__exportStar(lAe(),n)})(rY);function hl(n=3){const e=Date.now()*Math.pow(10,n),t=Math.floor(Math.random()*Math.pow(10,n));return e+t}function Ph(n=6){return BigInt(hl(n))}function Da(n,e,t){return{id:t||hl(),jsonrpc:"2.0",method:n,params:e}}function Zw(n,e){return{id:n,jsonrpc:"2.0",result:e}}function C2(n,e,t){return{id:n,jsonrpc:"2.0",error:cAe(e)}}function cAe(n,e){return typeof n>"u"?rz(tY):(typeof n=="string"&&(n=Object.assign(Object.assign({},rz(AL)),{message:n})),kSe(n.code)&&(n=FSe(n.code)),n)}class uAe{}class hAe extends uAe{constructor(){super()}}class fAe extends hAe{constructor(e){super()}}const dAe="^https?:",pAe="^wss?:";function mAe(n){const e=n.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function oY(n,e){const t=mAe(n);return typeof t>"u"?!1:new RegExp(e).test(t)}function az(n){return oY(n,dAe)}function lz(n){return oY(n,pAe)}function gAe(n){return new RegExp("wss?://localhost(:d{2,5})?").test(n)}function aY(n){return typeof n=="object"&&"id"in n&&"jsonrpc"in n&&n.jsonrpc==="2.0"}function ML(n){return aY(n)&&"method"in n}function I2(n){return aY(n)&&(fl(n)||Zo(n))}function fl(n){return"result"in n}function Zo(n){return"error"in n}let TL=class extends fAe{constructor(e){super(e),this.events=new _o.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Da(e.method,e.params||[],e.id||Ph().toString()),t)}async requestStrict(e,t){return new Promise(async(i,r)=>{if(!this.connection.connected)try{await this.open()}catch(s){r(s)}this.events.on(`${e.id}`,s=>{Zo(s)?r(s.error):i(s.result)});try{await this.connection.send(e,t)}catch(s){r(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),I2(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const yAe=()=>typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),vAe=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",cz=n=>n.split("?")[0],uz=10,wAe=yAe();let xAe=class{constructor(e){if(this.url=e,this.events=new _o.EventEmitter,this.registering=!1,!lz(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>"u"){t(new Error("Connection already closed"));return}this.socket.onclose=i=>{this.onClose(i),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(iu(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!lz(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,r)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),r(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return r(new Error("WebSocket connection is missing or invalid"));i(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,i)=>{const r=rY.isReactNative()?void 0:{rejectUnauthorized:!gAe(e)},s=new wAe(e,[],r);vAe()?s.onerror=o=>{const a=o;i(this.emitError(a.error))}:s.on("error",o=>{i(this.emitError(o))}),s.onopen=()=>{this.onOpen(s),t(s)}})}onOpen(e){e.onmessage=t=>this.onPayload(t),e.onclose=t=>this.onClose(t),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?hp(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),r=i.message||i.toString(),s=C2(e,r);this.events.emit("payload",s)}parseError(e,t=this.url){return iY(e,cz(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>uz&&this.events.setMaxListeners(uz)}emitError(e){const t=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${cz(this.url)}`));return this.events.emit("register_error",t),t}};var bAe={};const lY="wc",cY=2,aA="core",Hl=`${lY}@2:${aA}:`,_Ae={name:aA,logger:"error"},EAe={database:":memory:"},SAe="crypto",hz="client_ed25519_seed",AAe=Be.ONE_DAY,MAe="keychain",TAe="0.3",PAe="messages",CAe="0.3",IAe=Be.SIX_HOURS,RAe="publisher",uY="irn",NAe="error",hY="wss://relay.walletconnect.org",DAe="relayer",bi={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},OAe="_subscription",ko={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},LAe=.1,zR="2.23.0",Nn={link_mode:"link_mode",relay:"relay"},$E={inbound:"inbound",outbound:"outbound"},UAe="0.3",BAe="WALLETCONNECT_CLIENT_ID",fz="WALLETCONNECT_LINK_MODE_APPS",eo={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},kAe="subscription",FAe="0.3",zAe="pairing",VAe="0.3",Zy={wc_pairingDelete:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:Be.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:Be.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:Be.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:0},res:{ttl:Be.ONE_DAY,prompt:!1,tag:0}}},ed={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},da={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},HAe="history",$Ae="0.3",GAe="expirer",Ho={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},jAe="0.3",WAe="verify-api",qAe="https://verify.walletconnect.com",fY="https://verify.walletconnect.org",nw=fY,KAe=`${nw}/v3`,XAe=[qAe,fY],YAe="echo",QAe="https://echo.walletconnect.com",cl={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},uc={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},pa={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success",session_request_response_started:"session_request_response_started",session_request_response_validation_success:"session_request_response_validation_success",session_request_response_publish_started:"session_request_response_publish_started"},Mf={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found",session_request_response_validation_failure:"session_request_response_validation_failure",session_request_response_publish_failure:"session_request_response_publish_failure"},Tf={authenticated_session_approve_started:"authenticated_session_approve_started",authenticated_session_not_expired:"authenticated_session_not_expired",chains_caip2_compliant:"chains_caip2_compliant",chains_evm_compliant:"chains_evm_compliant",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve",authenticated_session_approve_publish_success:"authenticated_session_approve_publish_success"},Jy={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",missing_session_authenticate_request:"missing_session_authenticate_request",session_authenticate_request_expired:"session_authenticate_request_expired",chains_caip2_compliant_failure:"chains_caip2_compliant_failure",chains_evm_compliant_failure:"chains_evm_compliant_failure",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},ZAe=.1,JAe="event-client",e2e=86400,t2e="https://pulse.walletconnect.org/batch";function n2e(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),i=0;i<t.length;i++)t[i]=255;for(var r=0;r<n.length;r++){var s=n.charAt(r),o=s.charCodeAt(0);if(t[o]!==255)throw new TypeError(s+" is ambiguous");t[o]=r}var a=n.length,l=n.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var v=0,w=0,y=0,_=g.length;y!==_&&g[y]===0;)y++,v++;for(var x=(_-y)*u+1>>>0,S=new Uint8Array(x);y!==_;){for(var M=g[y],A=0,I=x-1;(M!==0||A<w)&&I!==-1;I--,A++)M+=256*S[I]>>>0,S[I]=M%a>>>0,M=M/a>>>0;if(M!==0)throw new Error("Non-zero carry");w=A,y++}for(var D=x-w;D!==x&&S[D]===0;)D++;for(var k=l.repeat(v);D<x;++D)k+=n.charAt(S[D]);return k}function f(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var v=0;if(g[v]!==" "){for(var w=0,y=0;g[v]===l;)w++,v++;for(var _=(g.length-v)*c+1>>>0,x=new Uint8Array(_);g[v];){var S=t[g.charCodeAt(v)];if(S===255)return;for(var M=0,A=_-1;(S!==0||M<y)&&A!==-1;A--,M++)S+=a*x[A]>>>0,x[A]=S%256>>>0,S=S/256>>>0;if(S!==0)throw new Error("Non-zero carry");y=M,v++}if(g[v]!==" "){for(var I=_-y;I!==_&&x[I]===0;)I++;for(var D=new Uint8Array(w+(_-I)),k=w;I!==_;)D[k++]=x[I++];return D}}}function m(g){var v=f(g);if(v)return v;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:f,decode:m}}var i2e=n2e,r2e=i2e;const dY=n=>{if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")},s2e=n=>new TextEncoder().encode(n),o2e=n=>new TextDecoder().decode(n);class a2e{constructor(e,t,i){this.name=e,this.prefix=t,this.baseEncode=i}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class l2e{constructor(e,t,i){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=i}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return pY(this,e)}}class c2e{constructor(e){this.decoders=e}or(e){return pY(this,e)}decode(e){const t=e[0],i=this.decoders[t];if(i)return i.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const pY=(n,e)=>new c2e({...n.decoders||{[n.prefix]:n},...e.decoders||{[e.prefix]:e}});class u2e{constructor(e,t,i,r){this.name=e,this.prefix=t,this.baseEncode=i,this.baseDecode=r,this.encoder=new a2e(e,t,i),this.decoder=new l2e(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const R2=({name:n,prefix:e,encode:t,decode:i})=>new u2e(n,e,t,i),ix=({prefix:n,name:e,alphabet:t})=>{const{encode:i,decode:r}=r2e(t,e);return R2({prefix:n,name:e,encode:i,decode:s=>dY(r(s))})},h2e=(n,e,t,i)=>{const r={};for(let u=0;u<e.length;++u)r[e[u]]=u;let s=n.length;for(;n[s-1]==="=";)--s;const o=new Uint8Array(s*t/8|0);let a=0,l=0,c=0;for(let u=0;u<s;++u){const h=r[n[u]];if(h===void 0)throw new SyntaxError(`Non-${i} character`);l=l<<t|h,a+=t,a>=8&&(a-=8,o[c++]=255&l>>a)}if(a>=t||255&l<<8-a)throw new SyntaxError("Unexpected end of data");return o},f2e=(n,e,t)=>{const i=e[e.length-1]==="=",r=(1<<t)-1;let s="",o=0,a=0;for(let l=0;l<n.length;++l)for(a=a<<8|n[l],o+=8;o>t;)o-=t,s+=e[r&a>>o];if(o&&(s+=e[r&a<<t-o]),i)for(;s.length*t&7;)s+="=";return s},yr=({name:n,prefix:e,bitsPerChar:t,alphabet:i})=>R2({prefix:e,name:n,encode(r){return f2e(r,i,t)},decode(r){return h2e(r,i,t,n)}}),d2e=R2({prefix:"\0",name:"identity",encode:n=>o2e(n),decode:n=>s2e(n)});var p2e=Object.freeze({__proto__:null,identity:d2e});const m2e=yr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var g2e=Object.freeze({__proto__:null,base2:m2e});const y2e=yr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var v2e=Object.freeze({__proto__:null,base8:y2e});const w2e=ix({prefix:"9",name:"base10",alphabet:"0123456789"});var x2e=Object.freeze({__proto__:null,base10:w2e});const b2e=yr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_2e=yr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var E2e=Object.freeze({__proto__:null,base16:b2e,base16upper:_2e});const S2e=yr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),A2e=yr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),M2e=yr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),T2e=yr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),P2e=yr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),C2e=yr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),I2e=yr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),R2e=yr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),N2e=yr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var D2e=Object.freeze({__proto__:null,base32:S2e,base32upper:A2e,base32pad:M2e,base32padupper:T2e,base32hex:P2e,base32hexupper:C2e,base32hexpad:I2e,base32hexpadupper:R2e,base32z:N2e});const O2e=ix({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),L2e=ix({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var U2e=Object.freeze({__proto__:null,base36:O2e,base36upper:L2e});const B2e=ix({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),k2e=ix({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var F2e=Object.freeze({__proto__:null,base58btc:B2e,base58flickr:k2e});const z2e=yr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
203+/",bitsPerChar:6}),V2e=yr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),H2e=yr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),$2e=yr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var G2e=Object.freeze({__proto__:null,base64:z2e,base64pad:V2e,base64url:H2e,base64urlpad:$2e});const mY=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),j2e=mY.reduce((n,e,t)=>(n[t]=e,n),[]),W2e=mY.reduce((n,e,t)=>(n[e.codePointAt(0)]=t,n),[]);function q2e(n){return n.reduce((e,t)=>(e+=j2e[t],e),"")}function K2e(n){const e=[];for(const t of n){const i=W2e[t.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${t}`);e.push(i)}return new Uint8Array(e)}const X2e=R2({prefix:"🚀",name:"base256emoji",encode:q2e,decode:K2e});var Y2e=Object.freeze({__proto__:null,base256emoji:X2e}),Q2e=gY,dz=128,Z2e=127,J2e=~Z2e,eMe=Math.pow(2,31);function gY(n,e,t){e=e||[],t=t||0;for(var i=t;n>=eMe;)e[t++]=n&255|dz,n/=128;for(;n&J2e;)e[t++]=n&255|dz,n>>>=7;return e[t]=n|0,gY.bytes=t-i+1,e}var tMe=VR,nMe=128,pz=127;function VR(n,i){var t=0,i=i||0,r=0,s=i,o,a=n.length;do{if(s>=a)throw VR.bytes=0,new RangeError("Could not decode varint");o=n[s++],t+=r<28?(o&pz)<<r:(o&pz)*Math.pow(2,r),r+=7}while(o>=nMe);return VR.bytes=s-i,t}var iMe=Math.pow(2,7),rMe=Math.pow(2,14),sMe=Math.pow(2,21),oMe=Math.pow(2,28),aMe=Math.pow(2,35),lMe=Math.pow(2,42),cMe=Math.pow(2,49),uMe=Math.pow(2,56),hMe=Math.pow(2,63),fMe=function(n){return n<iMe?1:n<rMe?2:n<sMe?3:n<oMe?4:n<aMe?5:n<lMe?6:n<cMe?7:n<uMe?8:n<hMe?9:10},dMe={encode:Q2e,decode:tMe,encodingLength:fMe},yY=dMe;const mz=(n,e,t=0)=>(yY.encode(n,e,t),e),gz=n=>yY.encodingLength(n),HR=(n,e)=>{const t=e.byteLength,i=gz(n),r=i+gz(t),s=new Uint8Array(r+t);return mz(n,s,0),mz(t,s,i),s.set(e,r),new pMe(n,t,e,s)};class pMe{constructor(e,t,i,r){this.code=e,this.size=t,this.digest=i,this.bytes=r}}const vY=({name:n,code:e,encode:t})=>new mMe(n,e,t);class mMe{constructor(e,t,i){this.name=e,this.code=t,this.encode=i}digest(e){if(e instanceof Uint8Array){const t=this.encode(e);return t instanceof Uint8Array?HR(this.code,t):t.then(i=>HR(this.code,i))}else throw Error("Unknown type, must be binary type")}}const wY=n=>async e=>new Uint8Array(await crypto.subtle.digest(n,e)),gMe=vY({name:"sha2-256",code:18,encode:wY("SHA-256")}),yMe=vY({name:"sha2-512",code:19,encode:wY("SHA-512")});var vMe=Object.freeze({__proto__:null,sha256:gMe,sha512:yMe});const xY=0,wMe="identity",bY=dY,xMe=n=>HR(xY,bY(n)),bMe={code:xY,name:wMe,encode:bY,digest:xMe};var _Me=Object.freeze({__proto__:null,identity:bMe});new TextEncoder,new TextDecoder;const yz={...p2e,...g2e,...v2e,...x2e,...E2e,...D2e,...U2e,...F2e,...G2e,...Y2e};({...vMe,..._Me});function _Y(n){return globalThis.Buffer!=null?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n}function EMe(n=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?_Y(globalThis.Buffer.allocUnsafe(n)):new Uint8Array(n)}function EY(n,e,t,i){return{name:n,prefix:e,encoder:{name:n,prefix:e,encode:t},decoder:{decode:i}}}const vz=EY("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),oC=EY("ascii","a",n=>{let e="a";for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);return e},n=>{n=n.substring(1);const e=EMe(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return e}),SMe={utf8:vz,"utf-8":vz,hex:yz.base16,latin1:oC,ascii:oC,binary:oC,...yz};function AMe(n,e="utf8"){const t=SMe[e];if(!t)throw new Error(`Unsupported encoding "${e}"`);return(e==="utf8"||e==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?_Y(globalThis.Buffer.from(n,"utf-8")):t.decoder.decode(`${t.prefix}${n}`)}var MMe=Object.defineProperty,TMe=(n,e,t)=>e in n?MMe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,al=(n,e,t)=>TMe(n,typeof e!="symbol"?e+"":e,t);class PMe{constructor(e,t){this.core=e,this.logger=t,al(this,"keychain",new Map),al(this,"name",MAe),al(this,"version",TAe),al(this,"initialized",!1),al(this,"storagePrefix",Hl),al(this,"init",async()=>
vendor: 52,548 bytes, line 203
203{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}}),al(this,"has",i=>(this.isInitialized(),this.keychain.has(i))),al(this,"set",async(i,r)=>{this.isInitialized(),this.keychain.set(i,r),await this.persist()}),al(this,"get",i=>{this.isInitialized();const r=this.keychain.get(i);if(typeof r>"u"){const{message:s}=Ve("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return r}),al(this,"del",async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()}),this.core=e,this.logger=Eo(t,this.name)}get context(){return Vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,_R(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ER(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=Ve("NOT_INITIALIZED",this.name);throw new Error(e)}}}var CMe=Object.defineProperty,IMe=(n,e,t)=>e in n?CMe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Fi=(n,e,t)=>IMe(n,typeof e!="symbol"?e+"":e,t);class RMe{constructor(e,t,i){this.core=e,this.logger=t,Fi(this,"name",SAe),Fi(this,"keychain"),Fi(this,"randomSessionIdentifier",OR()),Fi(this,"initialized",!1),Fi(this,"clientId"),Fi(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Fi(this,"hasKeys",r=>(this.isInitialized(),this.keychain.has(r))),Fi(this,"getClientId",async()=>{if(this.isInitialized(),this.clientId)return this.clientId;const r=await this.getClientSeed(),s=G5(r),o=EK(s.publicKey);return this.clientId=o,o}),Fi(this,"generateKeyPair",()=>{this.isInitialized();const r=d_e();return this.setPrivateKey(r.publicKey,r.privateKey)}),Fi(this,"signJWT",async r=>{this.isInitialized();const s=await this.getClientSeed(),o=G5(s),a=this.randomSessionIdentifier;return await lve(a,r,AAe,o)}),Fi(this,"generateSharedKey",(r,s,o)=>{this.isInitialized();const a=this.getPrivateKey(r),l=p_e(a,s);return this.setSymKey(l,o)}),Fi(this,"setSymKey",async(r,s)=>{this.isInitialized();const o=s||zE(r);return await this.keychain.set(o,r),o}),Fi(this,"deleteKeyPair",async r=>{this.isInitialized(),await this.keychain.del(r)}),Fi(this,"deleteSymKey",async r=>{this.isInitialized(),await this.keychain.del(r)}),Fi(this,"encode",async(r,s,o)=>{this.isInitialized();const a=XX(o),l=iu(s);if(B6(a))return y_e(l,o==null?void 0:o.encoding);if(U6(a)){const f=a.senderPublicKey,m=a.receiverPublicKey;r=await this.generateSharedKey(f,m)}const c=this.getSymKey(r),{type:u,senderPublicKey:h}=a;return m_e({type:u,symKey:c,message:l,senderPublicKey:h,encoding:o==null?void 0:o.encoding})}),Fi(this,"decode",async(r,s,o)=>{this.isInitialized();const a=w_e(s,o);if(B6(a)){const l=v_e(s,o==null?void 0:o.encoding);return hp(l)}if(U6(a)){const l=a.receiverPublicKey,c=a.senderPublicKey;r=await this.generateSharedKey(l,c)}try{const l=this.getSymKey(r),c=g_e({symKey:l,encoded:s,encoding:o==null?void 0:o.encoding});return hp(c)}catch(l){this.logger.error(`Failed to decode message from topic: '${r}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),Fi(this,"getPayloadType",(r,s=Ts)=>{const o=Yw({encoded:r,encoding:s});return dp(o.type)}),Fi(this,"getPayloadSenderPublicKey",(r,s=Ts)=>{const o=Yw({encoded:r,encoding:s});return o.senderPublicKey?Bs(o.senderPublicKey,ls):void 0}),this.core=e,this.logger=Eo(t,this.name),this.keychain=i||new PMe(this.core,this.logger)}get context(){return Vs(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(hz)}catch{e=OR(),await this.keychain.set(hz,e)}return AMe(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=Ve("NOT_INITIALIZED",this.name);throw new Error(e)}}}var NMe=Object.defineProperty,DMe=Object.defineProperties,OMe=Object.getOwnPropertyDescriptors,wz=Object.getOwnPropertySymbols,LMe=Object.prototype.hasOwnProperty,UMe=Object.prototype.propertyIsEnumerable,$R=(n,e,t)=>e in n?NMe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,BMe=(n,e)=>{for(var t in e||(e={}))LMe.call(e,t)&&$R(n,t,e[t]);if(wz)for(var t of wz(e))UMe.call(e,t)&&$R(n,t,e[t]);return n},kMe=(n,e)=>DMe(n,OMe(e)),Ks=(n,e,t)=>$R(n,typeof e!="symbol"?e+"":e,t);class FMe extends xSe{constructor(e,t){super(e,t),this.logger=e,this.core=t,Ks(this,"messages",new Map),Ks(this,"messagesWithoutClientAck",new Map),Ks(this,"name",PAe),Ks(this,"version",CAe),Ks(this,"initialized",!1),Ks(this,"storagePrefix",Hl),Ks(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i);const r=await this.getRelayerMessagesWithoutClientAck();typeof r<"u"&&(this.messagesWithoutClientAck=r),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}}),Ks(this,"set",async(i,r,s)=>{this.isInitialized();const o=Qo(r);let a=this.messages.get(i);if(typeof a>"u"&&(a={}),typeof a[o]<"u")return o;if(a[o]=r,this.messages.set(i,a),s===$E.inbound){const l=this.messagesWithoutClientAck.get(i)||{};this.messagesWithoutClientAck.set(i,kMe(BMe({},l),{[o]:r}))}return await this.persist(),o}),Ks(this,"get",i=>{this.isInitialized();let r=this.messages.get(i);return typeof r>"u"&&(r={}),r}),Ks(this,"getWithoutAck",i=>{this.isInitialized();const r={};for(const s of i){const o=this.messagesWithoutClientAck.get(s)||{};r[s]=Object.values(o)}return r}),Ks(this,"has",(i,r)=>{this.isInitialized();const s=this.get(i),o=Qo(r);return typeof s[o]<"u"}),Ks(this,"ack",async(i,r)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(i);if(typeof s>"u")return;const o=Qo(r);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(i):this.messagesWithoutClientAck.set(i,s),await this.persist()}),Ks(this,"del",async i=>{this.isInitialized(),this.messages.delete(i),this.messagesWithoutClientAck.delete(i),await this.persist()}),this.logger=Eo(e,this.name),this.core=t}get context(){return Vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,_R(e))}async setRelayerMessagesWithoutClientAck(e){await this.core.storage.setItem(this.storageKeyWithoutClientAck,_R(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?ER(e):void 0}async getRelayerMessagesWithoutClientAck(){const e=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof e<"u"?ER(e):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:e}=Ve("NOT_INITIALIZED",this.name);throw new Error(e)}}}var zMe=Object.defineProperty,VMe=Object.defineProperties,HMe=Object.getOwnPropertyDescriptors,xz=Object.getOwnPropertySymbols,$Me=Object.prototype.hasOwnProperty,GMe=Object.prototype.propertyIsEnumerable,GR=(n,e,t)=>e in n?zMe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,rm=(n,e)=>{for(var t in e||(e={}))$Me.call(e,t)&&GR(n,t,e[t]);if(xz)for(var t of xz(e))GMe.call(e,t)&&GR(n,t,e[t]);return n},bz=(n,e)=>VMe(n,HMe(e)),Fo=(n,e,t)=>GR(n,typeof e!="symbol"?e+"":e,t);class jMe extends bSe{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,Fo(this,"events",new _o.EventEmitter),Fo(this,"name",RAe),Fo(this,"queue",new Map),Fo(this,"publishTimeout",Be.toMiliseconds(Be.ONE_MINUTE)),Fo(this,"initialPublishTimeout",Be.toMiliseconds(Be.ONE_SECOND*15)),Fo(this,"needsTransportRestart",!1),Fo(this,"publish",async(i,r,s)=>{var o,a,l,c,u;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:r,opts:s}});const h=(s==null?void 0:s.ttl)||IAe,f=(s==null?void 0:s.prompt)||!1,m=(s==null?void 0:s.tag)||0,g=(s==null?void 0:s.id)||Ph().toString(),v=ig(sA().protocol),w={id:g,method:(s==null?void 0:s.publishMethod)||v.publish,params:rm({topic:i,message:r,ttl:h,prompt:f,tag:m,attestation:s==null?void 0:s.attestation},s==null?void 0:s.tvf)},y=`Failed to publish payload, please try again. id:${g} tag:${m}`;try{qi((o=w.params)==null?void 0:o.prompt)&&((a=w.params)==null||delete a.prompt),qi((l=w.params)==null?void 0:l.tag)&&((c=w.params)==null||delete c.tag);const _=new Promise(async x=>{const S=({id:A})=>{var I;((I=w.id)==null?void 0:I.toString())===A.toString()&&(this.removeRequestFromQueue(A),this.relayer.events.removeListener(bi.publish,S),x())};this.relayer.events.on(bi.publish,S);const M=Cl(new Promise((A,I)=>{this.rpcPublish(w,s).then(A).catch(D=>{this.logger.warn(D,D==null?void 0:D.message),I(D)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${g} tag:${m}`);try{await M,this.events.removeListener(bi.publish,S)}catch(A){this.queue.set(g,{request:w,opts:s,attempt:1}),this.logger.warn(A,A==null?void 0:A.message)}});this.logger.trace({type:"method",method:"publish",params:{id:g,topic:i,message:r,opts:s}}),await Cl(_,this.publishTimeout,y)}catch(_){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(_),(u=s==null?void 0:s.internal)!=null&&u.throwOnFailedPublish)throw _}finally{this.queue.delete(g)}}),Fo(this,"publishCustom",async i=>{var r,s,o,a,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:i});const{payload:c,opts:u={}}=i,{attestation:h,tvf:f,publishMethod:m,prompt:g,tag:v,ttl:w=Be.FIVE_MINUTES}=u,y=u.id||Ph().toString(),_=ig(sA().protocol),x=m||_.publish,S={id:y,method:x,params:rm(bz(rm({},c),{ttl:w,prompt:g,tag:v,attestation:h}),f)},M=`Failed to publish custom payload, please try again. id:${y} tag:${v}`;try{qi((r=S.params)==null?void 0:r.prompt)&&((s=S.params)==null||delete s.prompt),qi((o=S.params)==null?void 0:o.tag)&&((a=S.params)==null||delete a.tag);const A=new Promise(async I=>{const D=({id:C})=>{var U;((U=S.id)==null?void 0:U.toString())===C.toString()&&(this.removeRequestFromQueue(C),this.relayer.events.removeListener(bi.publish,D),I())};this.relayer.events.on(bi.publish,D);const k=Cl(new Promise((C,U)=>{this.rpcPublish(S,u).then(C).catch(G=>{this.logger.warn(G,G==null?void 0:G.message),U(G)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${x} id:${y} tag:${v}`);try{await k,this.events.removeListener(bi.publish,D)}catch(C){this.queue.set(y,{request:S,opts:u,attempt:1}),this.logger.warn(C,C==null?void 0:C.message)}});this.logger.trace({type:"method",method:"publish",params:{id:y,payload:c,opts:u}}),await Cl(A,this.publishTimeout,M)}catch(A){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(A),(l=u==null?void 0:u.internal)!=null&&l.throwOnFailedPublish)throw A}finally{this.queue.delete(y)}}),Fo(this,"on",(i,r)=>{this.events.on(i,r)}),Fo(this,"once",(i,r)=>{this.events.once(i,r)}),Fo(this,"off",(i,r)=>{this.events.off(i,r)}),Fo(this,"removeListener",(i,r)=>{this.events.removeListener(i,r)}),this.relayer=e,this.logger=Eo(t,this.name),this.registerEventListeners()}get context(){return Vs(this.logger)}async rpcPublish(e,t){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:e});const i=await this.relayer.request(e);return this.relayer.events.emit(bi.publish,rm(rm({},e),t)),this.logger.debug("Successfully Published Payload"),i}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,t)=>{var i;const r=e.attempt+1;this.queue.set(t,bz(rm({},e),{attempt:r})),this.logger.warn({},`Publisher: queue->publishing: ${e.request.id}, tag: ${(i=e.request.params)==null?void 0:i.tag}, attempt: ${r}`),await this.rpcPublish(e.request,e.opts),this.logger.warn({},`Publisher: queue->published: ${e.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Tp.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(bi.connection_stalled);return}this.checkQueue()}),this.relayer.on(bi.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}var WMe=Object.defineProperty,qMe=(n,e,t)=>e in n?WMe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,sm=(n,e,t)=>qMe(n,typeof e!="symbol"?e+"":e,t);class KMe{constructor(){sm(this,"map",new Map),sm(this,"set",(e,t)=>{const i=this.get(e);this.exists(e,t)||this.map.set(e,[...i,t])}),sm(this,"get",e=>this.map.get(e)||[]),sm(this,"exists",(e,t)=>this.get(e).includes(t)),sm(this,"delete",(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const i=this.get(e);if(!this.exists(e,t))return;const r=i.filter(s=>s!==t);if(!r.length){this.map.delete(e);return}this.map.set(e,r)}),sm(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var XMe=Object.defineProperty,YMe=Object.defineProperties,QMe=Object.getOwnPropertyDescriptors,_z=Object.getOwnPropertySymbols,ZMe=Object.prototype.hasOwnProperty,JMe=Object.prototype.propertyIsEnumerable,jR=(n,e,t)=>e in n?XMe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ev=(n,e)=>{for(var t in e||(e={}))ZMe.call(e,t)&&jR(n,t,e[t]);if(_z)for(var t of _z(e))JMe.call(e,t)&&jR(n,t,e[t]);return n},aC=(n,e)=>YMe(n,QMe(e)),_n=(n,e,t)=>jR(n,typeof e!="symbol"?e+"":e,t);class eTe extends SSe{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,_n(this,"subscriptions",new Map),_n(this,"topicMap",new KMe),_n(this,"events",new _o.EventEmitter),_n(this,"name",kAe),_n(this,"version",FAe),_n(this,"pending",new Map),_n(this,"cached",[]),_n(this,"initialized",!1),_n(this,"storagePrefix",Hl),_n(this,"subscribeTimeout",Be.toMiliseconds(Be.ONE_MINUTE)),_n(this,"initialSubscribeTimeout",Be.toMiliseconds(Be.ONE_SECOND*15)),_n(this,"clientId"),_n(this,"batchSubscribeTopicsLimit",500),_n(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),_n(this,"subscribe",async(i,r)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:r}});try{const o=sA(r),a={topic:i,relay:o,transportType:r==null?void 0:r.transportType};(s=r==null?void 0:r.internal)!=null&&s.skipSubscribe||this.pending.set(i,a);const l=await this.rpcSubscribe(i,o,r);return typeof l=="string"&&(this.onSubscribe(l,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:r}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),_n(this,"unsubscribe",async(i,r)=>{this.isInitialized(),typeof(r==null?void 0:r.id)<"u"?await this.unsubscribeById(i,r.id,r):await this.unsubscribeByTopic(i,r)}),_n(this,"isSubscribed",i=>new Promise(r=>{r(this.topicMap.topics.includes(i))})),_n(this,"isKnownTopic",i=>new Promise(r=>{r(this.topicMap.topics.includes(i)||this.pending.has(i)||this.cached.some(s=>s.topic===i))})),_n(this,"on",(i,r)=>{this.events.on(i,r)}),_n(this,"once",(i,r)=>{this.events.once(i,r)}),_n(this,"off",(i,r)=>{this.events.off(i,r)}),_n(this,"removeListener",(i,r)=>{this.events.removeListener(i,r)}),_n(this,"start",async()=>{await this.onConnect()}),_n(this,"stop",async()=>{await this.onDisconnect()}),_n(this,"restart",async()=>{await this.restore(),await this.onRestart()}),_n(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const i=[];this.pending.forEach(r=>{i.push(r)}),await this.batchSubscribe(i)}),_n(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Tp.pulse,async()=>{await this.checkPending()}),this.events.on(eo.created,async i=>{const r=eo.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),await this.persist()}),this.events.on(eo.deleted,async i=>{const r=eo.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:i}),await this.persist()})}),this.relayer=e,this.logger=Eo(t,this.name),this.clientId=""}get context(){return Vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,t){let i=!1;try{i=this.getSubscription(e).topic===t}catch{}return i}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){const i=this.topicMap.get(e);await Promise.all(i.map(async r=>await this.unsubscribeById(e,r,t)))}async unsubscribeById(e,t,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}});try{const r=sA(i);await this.restartToComplete({topic:e,id:t,relay:r}),await this.rpcUnsubscribe(e,t,r);const s=Dn("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:i}})}catch(r){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(r),r}}async rpcSubscribe(e,t,i){var r,s;const o=await this.getSubscriptionId(e);if((r=i==null?void 0:i.internal)!=null&&r.skipSubscribe)return o;(!i||(i==null?void 0:i.transportType)===Nn.relay)&&await this.restartToComplete({topic:e,id:e,relay:t});const a={method:ig(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:a});const l=(s=i==null?void 0:i.internal)==null?void 0:s.throwOnFailedPublish;try{if((i==null?void 0:i.transportType)===Nn.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(a).catch(h=>this.logger.warn(h))},Be.toMiliseconds(Be.ONE_SECOND)),o;const c=new Promise(async h=>{const f=m=>{m.topic===e&&(this.events.removeListener(eo.created,f),h(m.id))};this.events.on(eo.created,f);try{const m=await Cl(new Promise((g,v)=>{this.relayer.request(a).catch(w=>{this.logger.warn(w,w==null?void 0:w.message),v(w)}).then(g)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(eo.created,f),h(m)}catch{}}),u=await Cl(c,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!u&&l)throw new Error(`Subscribing to ${e} failed, please try again`);return u?o:null}catch(c){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(bi.connection_stalled),l)throw c}return null}async rpcBatchSubscribe(e){if(!e.length)return;const t=e[0].relay,i={method:ig(t.protocol).batchSubscribe,params:{topics:e.map(r=>r.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await Cl(new Promise(r=>{this.relayer.request(i).catch(s=>this.logger.warn(s)).then(r)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(bi.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const t=e[0].relay,i={method:ig(t.protocol).batchFetchMessages,params:{topics:e.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let r;try{r=await await Cl(new Promise((s,o)=>{this.relayer.request(i).catch(a=>{this.logger.warn(a),o(a)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(bi.connection_stalled)}return r}rpcUnsubscribe(e,t,i){const r={method:ig(i.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}onSubscribe(e,t){this.setSubscription(e,aC(ev({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(t=>{this.setSubscription(t.id,ev({},t)),this.pending.delete(t.topic)})}async onUnsubscribe(e,t,i){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,i),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,ev({},t)),this.topicMap.set(t.topic,e),this.events.emit(eo.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const t=this.subscriptions.get(e);if(!t){const{message:i}=Ve("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});const i=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(i.topic,e),this.events.emit(eo.deleted,aC(ev({},i),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(eo.sync)}async onRestart(){if(this.cached.length){const e=[...this.cached],t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let i=0;i<t;i++){const r=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(r)}}this.events.emit(eo.resubscribed)}async restore(){try{const e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size&&!e.every(t=>{var i;return t.topic===((i=this.subscriptions.get(t.id))==null?void 0:i.topic)})){const{message:t}=Ve("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(await Promise.all(e.map(async t=>aC(ev({},t),{id:await this.getSubscriptionId(t.topic)})))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(await N1e(Be.toMiliseconds(Be.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(t.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=Ve("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(e){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(e){return Qo(e+await this.getClientId())}}var tTe=Object.defineProperty,Ez=Object.getOwnPropertySymbols,nTe=Object.prototype.hasOwnProperty,iTe=Object.prototype.propertyIsEnumerable,WR=(n,e,t)=>e in n?tTe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Sz=(n,e)=>{for(var t in e||(e={}))nTe.call(e,t)&&WR(n,t,e[t]);if(Ez)for(var t of Ez(e))iTe.call(e,t)&&WR(n,t,e[t]);return n},on=(n,e,t)=>WR(n,typeof e!="symbol"?e+"":e,t);class rTe extends _Se{constructor(e){var t;super(e),on(this,"protocol","wc"),on(this,"version",2),on(this,"core"),on(this,"logger"),on(this,"events",new _o.EventEmitter),on(this,"provider"),on(this,"messages"),on(this,"subscriber"),on(this,"publisher"),on(this,"name",DAe),on(this,"transportExplicitlyClosed",!1),on(this,"initialized",!1),on(this,"connectionAttemptInProgress",!1),on(this,"relayUrl"),on(this,"projectId"),on(this,"packageName"),on(this,"bundleId"),on(this,"hasExperiencedNetworkDisruption",!1),on(this,"pingTimeout"),on(this,"heartBeatTimeout",Be.toMiliseconds(Be.THIRTY_SECONDS+Be.FIVE_SECONDS)),on(this,"reconnectTimeout"),on(this,"connectPromise"),on(this,"reconnectInProgress",!1),on(this,"requestsInFlight",[]),on(this,"connectTimeout",Be.toMiliseconds(Be.ONE_SECOND*15)),on(this,"request",async i=>{var r,s;this.logger.debug("Publishing Request Payload");const o=i.id||Ph().toString();await this.toEstablishConnection();try{this.logger.trace({id:o,method:i.method,topic:(r=i.params)==null?void 0:r.topic},"relayer.request - publishing...");const a=`${o}:${((s=i.params)==null?void 0:s.tag)||""}`;this.requestsInFlight.push(a);const l=await this.provider.request(i);return this.requestsInFlight=this.requestsInFlight.filter(c=>c!==a),l}catch(a){throw this.logger.debug(`Failed to Publish Request: ${o}`),a}}),on(this,"resetPingTimeout",()=>{JS()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var i,r,s,o;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(o=(s=(r=(i=this.provider)==null?void 0:i.connection)==null?void 0:r.socket)==null?void 0:s.terminate)==null||o.call(s)}catch(a){this.logger.warn(a,a==null?void 0:a.message)}},this.heartBeatTimeout))}),on(this,"onPayloadHandler",i=>{this.onProviderPayload(i),this.resetPingTimeout()}),on(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(bi.connect)}),on(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),on(this,"onProviderErrorHandler",i=>{this.logger.fatal(`Fatal socket error: ${i.message}`),this.events.emit(bi.error,i),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),on(this,"registerProviderListeners",()=>{this.provider.on(ko.payload,this.onPayloadHandler),this.provider.on(ko.connect,this.onConnectHandler),this.provider.on(ko.disconnect,this.onDisconnectHandler),this.provider.on(ko.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger=SL({logger:(t=e.logger)!=null?t:NAe,name:this.name}),this.messages=new FMe(this.logger,e.core),this.subscriber=new eTe(this,this.logger),this.publisher=new jMe(this,this.logger),this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||hY,g1e()?this.packageName=r6():y1e()&&(this.bundleId=r6()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(e=>this.logger.warn(e,e==null?void 0:e.message))}get context(){return Vs(this.logger)}get connected(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===1||!1}get connecting(){var e,t,i;return((i=(t=(e=this.provider)==null?void 0:e.connection)==null?void 0:t.socket)==null?void 0:i.readyState)===0||this.connectPromise!==void 0||!1}async publish(e,t,i){this.isInitialized(),await this.publisher.publish(e,t,i),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:Nn.relay},$E.outbound)}async publishCustom(e){this.isInitialized(),await this.publisher.publishCustom(e)}async subscribe(e,t){var i,r,s;this.isInitialized(),(!(t!=null&&t.transportType)||(t==null?void 0:t.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((i=t==null?void 0:t.internal)==null?void 0:i.throwOnFailedPublish)>"u"?!0:(r=t==null?void 0:t.internal)==null?void 0:r.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(e))==null?void 0:s[0])||"",l;const c=u=>{u.topic===e&&(this.subscriber.off(eo.created,c),l())};return await Promise.all([new Promise(u=>{l=u,this.subscriber.on(eo.created,c)}),new Promise(async(u,h)=>{a=await this.subscriber.subscribe(e,Sz({internal:{throwOnFailedPublish:o}},t)).catch(f=>{o&&h(f)})||a,u()})]),a}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Cl(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(t,i)=>{await this.connect(e).then(t).catch(i).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Y6())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const t=e.sort((i,r)=>i.publishedAt-r.publishedAt);this.logger.debug(`Batch of ${t.length} message events sorted`);for(const i of t)try{await this.onMessageEvent(i)}catch(r){this.logger.warn(r,"Error while processing batch message event: "+(r==null?void 0:r.message))}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){const{topic:i}=e;if(!t.sessionExists){const r=xi(Be.FIVE_MINUTES),s={topic:i,expiry:r,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,s)}this.events.emit(bi.message,e),await this.recordMessageEvent(e,$E.inbound)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let t=1;for(;t<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${t}...`),await this.createProvider(),await new Promise(async(i,r)=>{const s=()=>{r(new Error("Connection interrupted while trying to connect"))};this.provider.once(ko.disconnect,s),await Cl(new Promise((o,a)=>{this.provider.connect().then(o).catch(a)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{r(o)}).finally(()=>{this.provider.off(ko.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,a)=>{const l=()=>{r(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(ko.disconnect,l),await this.subscriber.start().then(o).catch(a).finally(()=>{this.provider.off(ko.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,i()})}catch(i){await this.subscriber.stop();const r=i;this.logger.warn({},r.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${t}`);break}await new Promise(i=>setTimeout(i,Be.toMiliseconds(t*1))),t++}}startPingTimeout(){var e,t,i,r,s;if(JS())try{(t=(e=this.provider)==null?void 0:e.connection)!=null&&t.socket&&((s=(r=(i=this.provider)==null?void 0:i.connection)==null?void 0:r.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new TL(new xAe(_1e({sdkVersion:zR,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e,t){const{topic:i,message:r}=e;await this.messages.set(i,r,t)}async shouldIgnoreMessageEvent(e){const{topic:t,message:i}=e;if(!i||i.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isKnownTopic(t))return this.logger.warn(`Ignoring message for unknown topic ${t}`),!0;const r=this.messages.has(t,i);return r&&this.logger.warn(`Ignoring duplicate message: ${i}`),r}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),ML(e)){if(!e.method.endsWith(OAe))return;const t=e.params,{topic:i,message:r,publishedAt:s,attestation:o}=t.data,a={topic:i,message:r,publishedAt:s,transportType:Nn.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Sz({type:"event",event:t.id},a)),this.events.emit(t.id,a),await this.acknowledgePayload(e),await this.onMessageEvent(a)}else I2(e)&&this.events.emit(bi.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(await this.recordMessageEvent(e,$E.inbound),this.events.emit(bi.message,e))}async acknowledgePayload(e){const t=Zw(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(ko.payload,this.onPayloadHandler),this.provider.off(ko.connect,this.onConnectHandler),this.provider.off(ko.disconnect,this.onDisconnectHandler),this.provider.off(ko.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await Y6();wEe(async t=>{e!==t&&(e=t,t?await this.transportOpen().catch(i=>this.logger.error(i,i==null?void 0:i.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Tp.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&_Ee())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(t){this.logger.warn(t,t==null?void 0:t.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(bi.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e,e==null?void 0:e.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},Be.toMiliseconds(LAe)))))}isInitialized(){if(!this.initialized){const{message:e}=Ve("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function sTe(n,e){return n===e||Number.isNaN(n)&&Number.isNaN(e)}function Az(n){return Object.getOwnPropertySymbols(n).filter(e=>Object.prototype.propertyIsEnumerable.call(n,e))}function Mz(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}const oTe="[object RegExp]",aTe="[object String]",lTe="[object Number]",cTe="[object Boolean]",Tz="[object Arguments]",uTe="[object Symbol]",hTe="[object Date]",fTe="[object Map]",dTe="[object Set]",pTe="[object Array]",mTe="[object Function]",gTe="[object ArrayBuffer]",lC="[object Object]",yTe="[object Error]",vTe="[object DataView]",wTe="[object Uint8Array]",xTe="[object Uint8ClampedArray]",bTe="[object Uint16Array]",_Te="[object Uint32Array]",ETe="[object BigUint64Array]",STe="[object Int8Array]",ATe="[object Int16Array]",MTe="[object Int32Array]",TTe="[object BigInt64Array]",PTe="[object Float32Array]",CTe="[object Float64Array]";function ITe(){}function Pz(n){if(!n||typeof n!="object")return!1;const e=Object.getPrototypeOf(n);return e===null||e===Object.prototype||Object.getPrototypeOf(e)===null?Object.prototype.toString.call(n)==="[object Object]":!1}function RTe(n,e,t){return Lv(n,e,void 0,void 0,void 0,void 0,t)}function Lv(n,e,t,i,r,s,o){const a=o(n,e,t,i,r,s);if(a!==void 0)return a;if(typeof n==typeof e)switch(typeof n){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return n===e;case"number":return n===e||Object.is(n,e);case"function":return n===e;case"object":return iw(n,e,s,o)}return iw(n,e,s,o)}function iw(n,e,t,i){if(Object.is(n,e))return!0;let r=Mz(n),s=Mz(e);if(r===Tz&&(r=lC),s===Tz&&(s=lC),r!==s)return!1;switch(r){case aTe:return n.toString()===e.toString();case lTe:{const l=n.valueOf(),c=e.valueOf();return sTe(l,c)}case cTe:case hTe:case uTe:return Object.is(n.valueOf(),e.valueOf());case oTe:return n.source===e.source&&n.flags===e.flags;case mTe:return n===e}t=t??new Map;const o=t.get(n),a=t.get(e);if(o!=null&&a!=null)return o===e;t.set(n,e),t.set(e,n);try{switch(r){case fTe:{if(n.size!==e.size)return!1;for(const[l,c]of n.entries())if(!e.has(l)||!Lv(c,e.get(l),l,n,e,t,i))return!1;return!0}case dTe:{if(n.size!==e.size)return!1;const l=Array.from(n.values()),c=Array.from(e.values());for(let u=0;u<l.length;u++){const h=l[u],f=c.findIndex(m=>Lv(h,m,void 0,n,e,t,i));if(f===-1)return!1;c.splice(f,1)}return!0}case pTe:case wTe:case xTe:case bTe:case _Te:case ETe:case STe:case ATe:case MTe:case TTe:case PTe:case CTe:{if(typeof Buffer<"u"&&Buffer.isBuffer(n)!==Buffer.isBuffer(e)||n.length!==e.length)return!1;for(let l=0;l<n.length;l++)if(!Lv(n[l],e[l],l,n,e,t,i))return!1;return!0}case gTe:return n.byteLength!==e.byteLength?!1:iw(new Uint8Array(n),new Uint8Array(e),t,i);case vTe:return n.byteLength!==e.byteLength||n.byteOffset!==e.byteOffset?!1:iw(new Uint8Array(n),new Uint8Array(e),t,i);case yTe:return n.name===e.name&&n.message===e.message;case lC:{if(!(iw(n.constructor,e.constructor,t,i)||Pz(n)&&Pz(e)))return!1;const l=[...Object.keys(n),...Az(n)],c=[...Object.keys(e),...Az(e)];if(l.length!==c.length)return!1;for(let u=0;u<l.length;u++){const h=l[u],f=n[h];if(!Object.hasOwn(e,h))return!1;const m=e[h];if(!Lv(f,m,h,n,e,t,i))return!1}return!0}default:return!1}}finally{t.delete(n),t.delete(e)}}function NTe(n,e){return RTe(n,e,ITe)}var DTe=Object.defineProperty,Cz=Object.getOwnPropertySymbols,OTe=Object.prototype.hasOwnProperty,LTe=Object.prototype.propertyIsEnumerable,qR=(n,e,t)=>e in n?DTe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Iz=(n,e)=>{for(var t in e||(e={}))OTe.call(e,t)&&qR(n,t,e[t]);if(Cz)for(var t of Cz(e))LTe.call(e,t)&&qR(n,t,e[t]);return n},vs=(n,e,t)=>qR(n,typeof e!="symbol"?e+"":e,t);class Cp extends ESe{constructor(e,t,i,r=Hl,s=void 0){super(e,t,i,r),this.core=e,this.logger=t,this.name=i,vs(this,"map",new Map),vs(this,"version",UAe),vs(this,"cached",[]),vs(this,"initialized",!1),vs(this,"getKey"),vs(this,"storagePrefix",Hl),vs(this,"recentlyDeleted",[]),vs(this,"recentlyDeletedLimit",200),vs(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!qi(o)?this.map.set(this.getKey(o),o):Y_e(o)?this.map.set(o.id,o):Q_e(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),vs(this,"set",async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())}),vs(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),vs(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(l=>NTe(a[l],o[l]))):this.values)),vs(this,"update",async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const l=Iz(Iz({},this.getData(o)),a);this.map.set(o,l),await this.persist()}),vs(this,"delete",async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=Eo(t,this.name),this.storagePrefix=r,this.getKey=s}get context(){return Vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){const{message:r}=Ve("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(r),new Error(r)}const{message:i}=Ve("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(i),new Error(i)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:t}=Ve("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=Ve("NOT_INITIALIZED",this.name);throw new Error(e)}}}var UTe=Object.defineProperty,BTe=(n,e,t)=>e in n?UTe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Kt=(n,e,t)=>BTe(n,typeof e!="symbol"?e+"":e,t);class kTe{constructor(e,t){this.core=e,this.logger=t,Kt(this,"name",zAe),Kt(this,"version",VAe),Kt(this,"events",new VO),Kt(this,"pairings"),Kt(this,"initialized",!1),Kt(this,"storagePrefix",Hl),Kt(this,"ignoredPayloadTypes",[qc]),Kt(this,"registeredMethods",[]),Kt(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),Kt(this,"register",({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]}),Kt(this,"create",async i=>{this.isInitialized();const r=OR(),s=await this.core.crypto.setSymKey(r),o=xi(Be.FIVE_MINUTES),a={protocol:uY},l={topic:s,expiry:o,relay:a,active:!1,methods:i==null?void 0:i.methods},c=V6({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:r,relay:a,expiryTimestamp:o,methods:i==null?void 0:i.methods});return this.events.emit(ed.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:i==null?void 0:i.transportType,internal:i==null?void 0:i.internal}),{topic:s,uri:c}}),Kt(this,"pair",async i=>{this.isInitialized();const r=this.core.eventClient.createEvent({properties:{topic:i==null?void 0:i.uri,trace:[cl.pairing_started]}});this.isValidPair(i,r);const{topic:s,symKey:o,relay:a,expiryTimestamp:l,methods:c}=z6(i.uri);r.props.properties.topic=s,r.addTrace(cl.pairing_uri_validation_success),r.addTrace(cl.pairing_uri_not_expired);let u;if(this.pairings.keys.includes(s)){if(u=this.pairings.get(s),r.addTrace(cl.existing_pairing),u.active)throw r.setError(uc.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);r.addTrace(cl.pairing_not_expired)}const h=l||xi(Be.FIVE_MINUTES),f={topic:s,relay:a,expiry:h,active:!1,methods:c};this.core.expirer.set(s,h),await this.pairings.set(s,f),r.addTrace(cl.store_new_pairing),i.activatePairing&&await this.activate({topic:s}),this.events.emit(ed.create,f),r.addTrace(cl.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),r.addTrace(cl.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{r.setError(uc.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(m){throw r.setError(uc.subscribe_pairing_topic_failure),m}return r.addTrace(cl.subscribe_pairing_topic_success),f}),Kt(this,"activate",async({topic:i})=>{this.isInitialized();const r=xi(Be.FIVE_MINUTES);this.core.expirer.set(i,r),await this.pairings.update(i,{active:!0,expiry:r})}),Kt(this,"ping",async i=>{this.isInitialized(),await this.isValidPing(i),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:r}=i;if(this.pairings.keys.includes(r)){const s=await this.sendRequest(r,"wc_pairingPing",{}),{done:o,resolve:a,reject:l}=qf();this.events.once(dn("pairing_ping",s),({error:c})=>{c?l(c):a()}),await o()}}),Kt(this,"updateExpiry",async({topic:i,expiry:r})=>{this.isInitialized(),await this.pairings.update(i,{expiry:r})}),Kt(this,"updateMetadata",async({topic:i,metadata:r})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:r})}),Kt(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),Kt(this,"disconnect",async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:r}=i;this.pairings.keys.includes(r)&&(await this.sendRequest(r,"wc_pairingDelete",Dn("USER_DISCONNECTED")),await this.deletePairing(r))}),Kt(this,"formatUriFromPairing",i=>{this.isInitialized();const{topic:r,relay:s,expiry:o,methods:a}=i,l=this.core.crypto.keychain.get(r);return V6({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:l,relay:s,expiryTimestamp:o,methods:a})}),Kt(this,"sendRequest",async(i,r,s)=>{const o=Da(r,s),a=await this.core.crypto.encode(i,o),l=Zy[r].req;return this.core.history.set(i,o),this.core.relayer.publish(i,a,l),o.id}),Kt(this,"sendResult",async(i,r,s)=>{const o=Zw(i,s),a=await this.core.crypto.encode(r,o),l=(await this.core.history.get(r,i)).request.method,c=Zy[l].res;await this.core.relayer.publish(r,a,c),await this.core.history.resolve(o)}),Kt(this,"sendError",async(i,r,s)=>{const o=C2(i,s),a=await this.core.crypto.encode(r,o),l=(await this.core.history.get(r,i)).request.method,c=Zy[l]?Zy[l].res:Zy.unregistered_method.res;await this.core.relayer.publish(r,a,c),await this.core.history.resolve(o)}),Kt(this,"deletePairing",async(i,r)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,Dn("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),r?Promise.resolve():this.core.expirer.del(i)])}),Kt(this,"cleanup",async()=>{const i=this.pairings.getAll().filter(r=>Sl(r.expiry));await Promise.all(i.map(r=>this.deletePairing(r.topic)))}),Kt(this,"onRelayEventRequest",async i=>{const{topic:r,payload:s}=i;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(r,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(r,s);default:return await this.onUnknownRpcMethodRequest(r,s)}}),Kt(this,"onRelayEventResponse",async i=>{const{topic:r,payload:s}=i,o=(await this.core.history.get(r,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(r,s);default:return this.onUnknownRpcMethodResponse(o)}}),Kt(this,"onPairingPingRequest",async(i,r)=>{const{id:s}=r;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit(ed.ping,{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}}),Kt(this,"onPairingPingResponse",(i,r)=>{const{id:s}=r;setTimeout(()=>{fl(r)?this.events.emit(dn("pairing_ping",s),{}):Zo(r)&&this.events.emit(dn("pairing_ping",s),{error:r.error})},500)}),Kt(this,"onPairingDeleteRequest",async(i,r)=>{const{id:s}=r;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(ed.delete,{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}}),Kt(this,"onUnknownRpcMethodRequest",async(i,r)=>{const{id:s,method:o}=r;try{if(this.registeredMethods.includes(o))return;const a=Dn("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,i,a),this.logger.error(a)}catch(a){await this.sendError(s,i,a),this.logger.error(a)}}),Kt(this,"onUnknownRpcMethodResponse",i=>{this.registeredMethods.includes(i)||this.logger.error(Dn("WC_METHOD_UNSUPPORTED",i))}),Kt(this,"isValidPair",(i,r)=>{var s;if(!bs(i)){const{message:a}=Ve("MISSING_OR_INVALID",`pair() params: ${i}`);throw r.setError(uc.malformed_pairing_uri),new Error(a)}if(!X_e(i.uri)){const{message:a}=Ve("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw r.setError(uc.malformed_pairing_uri),new Error(a)}const o=z6(i==null?void 0:i.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=Ve("MISSING_OR_INVALID","pair() uri#relay-protocol");throw r.setError(uc.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=Ve("MISSING_OR_INVALID","pair() uri#symKey");throw r.setError(uc.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&Be.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){r.setError(uc.pairing_expired);const{message:a}=Ve("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(a)}}),Kt(this,"isValidPing",async i=>{if(!bs(i)){const{message:s}=Ve("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:r}=i;await this.isValidPairingTopic(r)}),Kt(this,"isValidDisconnect",async i=>{if(!bs(i)){const{message:s}=Ve("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:r}=i;await this.isValidPairingTopic(r)}),Kt(this,"isValidPairingTopic",async i=>{if(!_i(i,!1)){const{message:r}=Ve("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(r)}if(!this.pairings.keys.includes(i)){const{message:r}=Ve("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(r)}if(Sl(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:r}=Ve("EXPIRED",`pairing topic: ${i}`);throw new Error(r)}}),this.core=e,this.logger=Eo(t,this.name),this.pairings=new Cp(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Vs(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=Ve("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(bi.message,async e=>{const{topic:t,message:i,transportType:r}=e;if(this.pairings.keys.includes(t)&&r!==Nn.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))try{const s=await this.core.crypto.decode(t,i);ML(s)?(this.core.history.set(t,s),await this.onRelayEventRequest({topic:t,payload:s})):I2(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:t,payload:s}),this.core.history.delete(t,s.id)),await this.core.relayer.messages.ack(t,i)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Ho.expired,async e=>{const{topic:t}=QK(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(ed.expire,{topic:t}))})}}var FTe=Object.defineProperty,zTe=(n,e,t)=>e in n?FTe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,rr=(n,e,t)=>zTe(n,typeof e!="symbol"?e+"":e,t);class VTe extends wSe{constructor(e,t){super(e,t),this.core=e,this.logger=t,rr(this,"records",new Map),rr(this,"events",new _o.EventEmitter),rr(this,"name",HAe),rr(this,"version",$Ae),rr(this,"cac
203hed",[]),rr(this,"initialized",!1),rr(this,"storagePrefix",Hl),rr(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),rr(this,"set",(i,r,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:r,chainId:s}),this.records.has(r.id))return;const o={id:r.id,topic:i,request:{method:r.method,params:r.params||null},chainId:s,expiry:xi(Be.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(da.created,o)}),rr(this,"resolve",async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const r=await this.getRecord(i.id);typeof r.response>"u"&&(r.response=Zo(i)?{error:i.error}:{result:i.result},this.records.set(r.id,r),this.persist(),this.events.emit(da.updated,r))}),rr(this,"get",async(i,r)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:r}),await this.getRecord(r))),rr(this,"delete",(i,r)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:r}),this.values.forEach(s=>{if(s.topic===i){if(typeof r<"u"&&s.id!==r)return;this.records.delete(s.id),this.events.emit(da.deleted,s)}}),this.persist()}),rr(this,"exists",async(i,r)=>(this.isInitialized(),this.records.has(r)?(await this.getRecord(r)).topic===i:!1)),rr(this,"on",(i,r)=>{this.events.on(i,r)}),rr(this,"once",(i,r)=>{this.events.once(i,r)}),rr(this,"off",(i,r)=>{this.events.off(i,r)}),rr(this,"removeListener",(i,r)=>{this.events.removeListener(i,r)}),this.logger=Eo(t,this.name)}get context(){return Vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const e=[];return this.values.forEach(t=>{if(typeof t.response<"u")return;const i={topic:t.topic,request:Da(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(i)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const t=this.records.get(e);if(!t){const{message:i}=Ve("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(i)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(da.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:t}=Ve("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(da.created,e=>{const t=da.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(da.updated,e=>{const t=da.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(da.deleted,e=>{const t=da.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(Tp.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{Be.toMiliseconds(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(da.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=Ve("NOT_INITIALIZED",this.name);throw new Error(e)}}}var HTe=Object.defineProperty,$Te=(n,e,t)=>
vendor: 79,762 bytes, line 203
203e in n?HTe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Cr=(n,e,t)=>$Te(n,typeof e!="symbol"?e+"":e,t);class GTe extends ASe{constructor(e,t){super(e,t),this.core=e,this.logger=t,Cr(this,"expirations",new Map),Cr(this,"events",new _o.EventEmitter),Cr(this,"name",GAe),Cr(this,"version",jAe),Cr(this,"cached",[]),Cr(this,"initialized",!1),Cr(this,"storagePrefix",Hl),Cr(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Cr(this,"has",i=>{try{const r=this.formatTarget(i);return typeof this.getExpiration(r)<"u"}catch{return!1}}),Cr(this,"set",(i,r)=>{this.isInitialized();const s=this.formatTarget(i),o={target:s,expiry:r};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Ho.created,{target:s,expiration:o})}),Cr(this,"get",i=>{this.isInitialized();const r=this.formatTarget(i);return this.getExpiration(r)}),Cr(this,"del",i=>{if(this.isInitialized(),this.has(i)){const r=this.formatTarget(i),s=this.getExpiration(r);this.expirations.delete(r),this.events.emit(Ho.deleted,{target:r,expiration:s})}}),Cr(this,"on",(i,r)=>{this.events.on(i,r)}),Cr(this,"once",(i,r)=>{this.events.once(i,r)}),Cr(this,"off",(i,r)=>{this.events.off(i,r)}),Cr(this,"removeListener",(i,r)=>{this.events.removeListener(i,r)}),this.logger=Eo(t,this.name)}get context(){return Vs(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e=="string")return E1e(e);if(typeof e=="number")return S1e(e);const{message:t}=Ve("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Ho.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:t}=Ve("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(t),new Error(t)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const t=this.expirations.get(e);if(!t){const{message:i}=Ve("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(i),new Error(i)}return t}checkExpiry(e,t){const{expiry:i}=t;Be.toMiliseconds(i)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(Ho.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(Tp.pulse,()=>this.checkExpirations()),this.events.on(Ho.created,e=>{const t=Ho.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Ho.expired,e=>{const t=Ho.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(Ho.deleted,e=>{const t=Ho.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=Ve("NOT_INITIALIZED",this.name);throw new Error(e)}}}var jTe=Object.defineProperty,WTe=(n,e,t)=>e in n?jTe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,vi=(n,e,t)=>WTe(n,typeof e!="symbol"?e+"":e,t);class qTe extends MSe{constructor(e,t,i){super(e,t,i),this.core=e,this.logger=t,this.store=i,vi(this,"name",WAe),vi(this,"abortController"),vi(this,"isDevEnv"),vi(this,"verifyUrlV3",KAe),vi(this,"storagePrefix",Hl),vi(this,"version",cY),vi(this,"publicKey"),vi(this,"fetchPromise"),vi(this,"init",async()=>{var r;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&Be.toMiliseconds((r=this.publicKey)==null?void 0:r.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),vi(this,"register",async r=>{if(!ey()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=r,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const c=cp(),u=this.startAbortTimer(Be.ONE_SECOND*5),h=await new Promise((f,m)=>{const g=()=>{window.removeEventListener("message",w),c.body.removeChild(v),m("attestation aborted")};this.abortController.signal.addEventListener("abort",g);const v=c.createElement("iframe");v.src=l,v.style.display="none",v.addEventListener("error",g,{signal:this.abortController.signal});const w=y=>{if(y.data&&typeof y.data=="string")try{const _=JSON.parse(y.data);if(_.type==="verify_attestation"){if(vR(_.attestation).payload.id!==o)return;clearInterval(u),c.body.removeChild(v),this.abortController.signal.removeEventListener("abort",g),window.removeEventListener("message",w),f(_.attestation===null?"":_.attestation)}}catch(_){this.logger.warn(_)}};c.body.appendChild(v),window.addEventListener("message",w,{signal:this.abortController.signal})});return this.logger.debug(h,"jwt attestation"),h}catch(c){this.logger.warn(c)}return""}),vi(this,"resolve",async r=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=r;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(vR(s).payload.id!==a)return;const c=await this.isValidJwtAttestation(s);if(c){if(!c.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return c}}if(!o)return;const l=this.getVerifyUrl(r==null?void 0:r.verifyUrl);return this.fetchAttestation(o,l)}),vi(this,"fetchAttestation",async(r,s)=>{this.logger.debug(`resolving attestation: ${r} from url: ${s}`);const o=this.startAbortTimer(Be.ONE_SECOND*5),a=await fetch(`${s}/attestation/${r}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0}),vi(this,"getVerifyUrl",r=>{let s=r||nw;return XAe.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${nw}`),s=nw),s}),vi(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const r=this.startAbortTimer(Be.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(r),await s.json()}catch(r){this.logger.warn(r)}}),vi(this,"persistPublicKey",async r=>{this.logger.debug(r,"persisting public key to local storage"),await this.store.setItem(this.storeKey,r),this.publicKey=r}),vi(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),vi(this,"isValidJwtAttestation",async r=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(r,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(r,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}}),vi(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),vi(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const r=await this.fetchPromise;return this.fetchPromise=void 0,r}),vi(this,"validateAttestation",(r,s)=>{const o=b_e(r,s.publicKey),a={hasExpired:Be.toMiliseconds(o.exp)<Date.now(),payload:o};if(a.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:a.payload.origin,isScam:a.payload.isScam,isVerified:a.payload.isVerified}}),this.logger=Eo(t,this.name),this.abortController=new AbortController,this.isDevEnv=dL(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Vs(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),Be.toMiliseconds(e))}}var KTe=Object.defineProperty,XTe=(n,e,t)=>e in n?KTe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Rz=(n,e,t)=>XTe(n,typeof e!="symbol"?e+"":e,t);class YTe extends TSe{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,Rz(this,"context",YAe),Rz(this,"registerDeviceToken",async i=>{const{clientId:r,token:s,notificationType:o,enableEncrypted:a=!1}=i,l=`${QAe}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:r,type:o,token:s,always_raw:a})})}),this.logger=Eo(t,this.context)}}var QTe=Object.defineProperty,Nz=Object.getOwnPropertySymbols,ZTe=Object.prototype.hasOwnProperty,JTe=Object.prototype.propertyIsEnumerable,KR=(n,e,t)=>e in n?QTe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,tv=(n,e)=>{for(var t in e||(e={}))ZTe.call(e,t)&&KR(n,t,e[t]);if(Nz)for(var t of Nz(e))JTe.call(e,t)&&KR(n,t,e[t]);return n},zi=(n,e,t)=>KR(n,typeof e!="symbol"?e+"":e,t);class ePe extends PSe{constructor(e,t,i=!0){super(e,t,i),this.core=e,this.logger=t,zi(this,"context",JAe),zi(this,"storagePrefix",Hl),zi(this,"storageVersion",ZAe),zi(this,"events",new Map),zi(this,"shouldPersist",!1),zi(this,"init",async()=>{if(!dL())try{const r={eventId:o6(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:XK(this.core.relayer.protocol,this.core.relayer.version,zR)}}};await this.sendEvent([r])}catch(r){this.logger.warn(r)}}),zi(this,"createEvent",r=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:l}}=r,c=o6(),u=this.core.projectId||"",h=Date.now(),f=tv({eventId:c,timestamp:h,props:{event:s,type:o,properties:{topic:a,trace:l}},bundleId:u,domain:this.getAppDomain()},this.setMethods(c));return this.telemetryEnabled&&(this.events.set(c,f),this.shouldPersist=!0),f}),zi(this,"getEvent",r=>{const{eventId:s,topic:o}=r;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(a)return tv(tv({},a),this.setMethods(a.eventId))}),zi(this,"deleteEvent",r=>{const{eventId:s}=r;this.events.delete(s),this.shouldPersist=!0}),zi(this,"setEventListeners",()=>{this.core.heartbeat.on(Tp.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(r=>{Be.fromMiliseconds(Date.now())-Be.fromMiliseconds(r.timestamp)>e2e&&(this.events.delete(r.eventId),this.shouldPersist=!0)})})}),zi(this,"setMethods",r=>({addTrace:s=>this.addTrace(r,s),setError:s=>this.setError(r,s)})),zi(this,"addTrace",(r,s)=>{const o=this.events.get(r);o&&(o.props.properties.trace.push(s),this.events.set(r,o),this.shouldPersist=!0)}),zi(this,"setError",(r,s)=>{const o=this.events.get(r);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(r,o),this.shouldPersist=!0)}),zi(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),zi(this,"restore",async()=>{try{const r=await this.core.storage.getItem(this.storageKey)||[];if(!r.length)return;r.forEach(s=>{this.events.set(s.eventId,tv(tv({},s),this.setMethods(s.eventId)))})}catch(r){this.logger.warn(r)}}),zi(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const r=[];for(const[s,o]of this.events)o.props.type&&r.push(o);if(r.length!==0)try{if((await this.sendEvent(r)).ok)for(const s of r)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),zi(this,"sendEvent",async r=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${t2e}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${zR}${s}`,{method:"POST",body:JSON.stringify(r)})}),zi(this,"getAppDomain",()=>KK().url),this.logger=Eo(t,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var tPe=Object.defineProperty,Dz=Object.getOwnPropertySymbols,nPe=Object.prototype.hasOwnProperty,iPe=Object.prototype.propertyIsEnumerable,XR=(n,e,t)=>e in n?tPe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Oz=(n,e)=>{for(var t in e||(e={}))nPe.call(e,t)&&XR(n,t,e[t]);if(Dz)for(var t of Dz(e))iPe.call(e,t)&&XR(n,t,e[t]);return n},Sn=(n,e,t)=>XR(n,typeof e!="symbol"?e+"":e,t);let rPe=class SY extends mSe{constructor(e){var t;super(e),Sn(this,"protocol",lY),Sn(this,"version",cY),Sn(this,"name",aA),Sn(this,"relayUrl"),Sn(this,"projectId"),Sn(this,"customStoragePrefix"),Sn(this,"events",new _o.EventEmitter),Sn(this,"logger"),Sn(this,"heartbeat"),Sn(this,"relayer"),Sn(this,"crypto"),Sn(this,"storage"),Sn(this,"history"),Sn(this,"expirer"),Sn(this,"pairing"),Sn(this,"verify"),Sn(this,"echoClient"),Sn(this,"linkModeSupportedApps"),Sn(this,"eventClient"),Sn(this,"initialized",!1),Sn(this,"logChunkController"),Sn(this,"on",(a,l)=>this.events.on(a,l)),Sn(this,"once",(a,l)=>this.events.once(a,l)),Sn(this,"off",(a,l)=>this.events.off(a,l)),Sn(this,"removeListener",(a,l)=>this.events.removeListener(a,l)),Sn(this,"dispatchEnvelope",({topic:a,message:l,sessionExists:c})=>{if(!a||!l)return;const u={topic:a,message:l,publishedAt:Date.now(),transportType:Nn.link_mode};this.relayer.onLinkMessageEvent(u,{sessionExists:c})});const i=this.getGlobalCore(e==null?void 0:e.customStoragePrefix);if(i)try{return this.customStoragePrefix=i.customStoragePrefix,this.logger=i.logger,this.heartbeat=i.heartbeat,this.crypto=i.crypto,this.history=i.history,this.expirer=i.expirer,this.storage=i.storage,this.relayer=i.relayer,this.pairing=i.pairing,this.verify=i.verify,this.echoClient=i.echoClient,this.linkModeSupportedApps=i.linkModeSupportedApps,this.eventClient=i.eventClient,this.initialized=i.initialized,this.logChunkController=i.logChunkController,i}catch(a){console.warn("Failed to copy global core",a)}this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||hY,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const r=t1e({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:_Ae.logger,name:aA}),{logger:s,chunkLoggerController:o}=WK({opts:r,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=o,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,l;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Eo(s,this.name),this.heartbeat=new NEe,this.crypto=new RMe(this,this.logger,e==null?void 0:e.keychain),this.history=new VTe(this,this.logger),this.expirer=new GTe(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new fSe(Oz(Oz({},EAe),e==null?void 0:e.storageOptions)),this.relayer=new rTe({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new kTe(this,this.logger),this.verify=new qTe(this,this.logger,this.storage),this.echoClient=new YTe(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ePe(this,this.logger,e==null?void 0:e.telemetryEnabled),this.setGlobalCore(this)}static async init(e){const t=new SY(e);await t.initialize();const i=await t.crypto.getClientId();return await t.storage.setItem(BAe,i),t}get context(){return Vs(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(fz,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(fz)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(e,`Core Initialization Failure at epoch ${Date.now()}`),this.logger.error(e.message),e}}getGlobalCore(e=""){try{if(this.isGlobalCoreDisabled())return;const t=`_walletConnectCore_${e}`,i=`${t}_count`;return globalThis[i]=(globalThis[i]||0)+1,globalThis[i]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[i]} times.`),globalThis[t]}catch(t){console.warn("Failed to get global WalletConnect core",t);return}}setGlobalCore(e){var t;try{if(this.isGlobalCoreDisabled())return;const i=`_walletConnectCore_${((t=e.opts)==null?void 0:t.customStoragePrefix)||""}`;globalThis[i]=e}catch(i){console.warn("Failed to set global WalletConnect core",i)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&bAe.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}};const sPe=rPe,AY="wc",MY=2,TY="client",PL=`${AY}@${MY}:${TY}:`,cC={name:TY,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.org"},Lz="WALLETCONNECT_DEEPLINK_CHOICE",oPe="proposal",Uz="Proposal expired",aPe="session",om=Be.SEVEN_DAYS,lPe="engine",sr={wc_sessionPropose:{req:{ttl:Be.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:1104},res:{ttl:Be.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:1106},res:{ttl:Be.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:Be.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:Be.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:1112},res:{ttl:Be.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:Be.ONE_DAY,prompt:!1,tag:1114},res:{ttl:Be.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:Be.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:Be.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:Be.FIVE_MINUTES,prompt:!1,tag:1119}}},uC={min:Be.FIVE_MINUTES,max:Be.SEVEN_DAYS},ll={idle:"IDLE",active:"ACTIVE"},cPe={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},uPe="request",hPe=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],fPe="wc",dPe="auth",pPe="authKeys",mPe="pairingTopics",gPe="requests",N2=`${fPe}@${1.5}:${dPe}:`,GE=`${N2}:PUB_KEY`;var yPe=Object.defineProperty,vPe=Object.defineProperties,wPe=Object.getOwnPropertyDescriptors,Bz=Object.getOwnPropertySymbols,xPe=Object.prototype.hasOwnProperty,bPe=Object.prototype.propertyIsEnumerable,YR=(n,e,t)=>e in n?yPe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,cn=(n,e)=>{for(var t in e||(e={}))xPe.call(e,t)&&YR(n,t,e[t]);if(Bz)for(var t of Bz(e))bPe.call(e,t)&&YR(n,t,e[t]);return n},or=(n,e)=>vPe(n,wPe(e)),Ce=(n,e,t)=>YR(n,typeof e!="symbol"?e+"":e,t);class _Pe extends NSe{constructor(e){super(e),Ce(this,"name",lPe),Ce(this,"events",new VO),Ce(this,"initialized",!1),Ce(this,"requestQueue",{state:ll.idle,queue:[]}),Ce(this,"sessionRequestQueue",{state:ll.idle,queue:[]}),Ce(this,"emittedSessionRequests",new D1e({limit:500})),Ce(this,"requestQueueDelay",Be.ONE_SECOND),Ce(this,"expectedPairingMethodMap",new Map),Ce(this,"recentlyDeletedMap",new Map),Ce(this,"recentlyDeletedLimit",200),Ce(this,"relayMessageCache",[]),Ce(this,"pendingSessions",new Map),Ce(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(sr)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},Be.toMiliseconds(this.requestQueueDelay)))}),Ce(this,"connect",async t=>{var i;this.isInitialized(),await this.confirmOnlineStateOrThrow();const r=or(cn({},t),{requiredNamespaces:t.requiredNamespaces||{},optionalNamespaces:t.optionalNamespaces||{}});await this.isValidConnect(r),r.optionalNamespaces=G_e(r.requiredNamespaces,r.optionalNamespaces),r.requiredNamespaces={};const{pairingTopic:s,requiredNamespaces:o,optionalNamespaces:a,sessionProperties:l,scopedProperties:c,relays:u,authentication:h,walletPay:f}=r,m=((i=h==null?void 0:h[0])==null?void 0:i.ttl)||sr.wc_sessionPropose.req.ttl||Be.FIVE_MINUTES;this.validateRequestExpiry(m);let g=s,v,w=!1;try{if(g){const k=this.client.core.pairing.pairings.get(g);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),w=k.active}}catch(k){throw this.client.logger.error(`connect() -> pairing.get(${g}) failed`),k}if(!g||!w){const{topic:k,uri:C}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});g=k,v=C}if(!g){const{message:k}=Ve("NO_MATCHING_KEY",`connect() pairing topic: ${g}`);throw new Error(k)}const y=await this.client.core.crypto.generateKeyPair(),_=xi(m),x=cn(or(cn(cn({requiredNamespaces:o,optionalNamespaces:a,relays:u??[{protocol:uY}],proposer:{publicKey:y,metadata:this.client.metadata},expiryTimestamp:_,pairingTopic:g},l&&{sessionProperties:l}),c&&{scopedProperties:c}),{id:hl()}),(h||f)&&{requests:{authentication:h==null?void 0:h.map(k=>{const{domain:C,chains:U,nonce:G,uri:H,exp:z,nbf:P,type:R,statement:F,requestId:N,resources:O,signatureTypes:B}=k;return{domain:C,chains:U,nonce:G,type:R??"caip122",aud:H,version:"1",iat:new Date().toISOString(),exp:z,nbf:P,statement:F,requestId:N,resources:O,signatureTypes:B}}),walletPay:f}}),S=dn("session_connect",x.id),{reject:M,resolve:A,done:I}=qf(m,Uz),D=({id:k})=>{k===x.id&&(this.client.events.off("proposal_expire",D),this.pendingSessions.delete(x.id),this.events.emit(S,{error:{message:Uz,code:0}}))};return this.client.events.on("proposal_expire",D),this.events.once(S,({error:k,session:C})=>{this.client.events.off("proposal_expire",D),k?M(k):C&&A(C)}),await this.setProposal(x.id,x),await this.sendProposeSession({proposal:x,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:x.id}}}).catch(k=>{throw this.deleteProposal(x.id),k}),{uri:v,approval:I}}),Ce(this,"pair",async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(t)}catch(i){throw this.client.logger.error("pair() failed"),i}}),Ce(this,"approve",async t=>{var i,r,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(i=t==null?void 0:t.id)==null?void 0:i.toString(),trace:[pa.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(C){throw o.setError(Mf.no_internet_connection),C}try{await this.isValidProposalId(t==null?void 0:t.id)}catch(C){throw this.client.logger.error(`approve() -> proposal.get(${t==null?void 0:t.id}) failed`),o.setError(Mf.proposal_not_found),C}try{await this.isValidApprove(t)}catch(C){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(Mf.session_approve_namespace_validation_failure),C}const{id:a,relayProtocol:l,namespaces:c,sessionProperties:u,scopedProperties:h,sessionConfig:f,proposalRequestsResponses:m}=t,g=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:v,proposer:w,requiredNamespaces:y,optionalNamespaces:_}=g;let x=(r=this.client.core.eventClient)==null?void 0:r.getEvent({topic:v});x||(x=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:pa.session_approve_started,properties:{topic:v,trace:[pa.session_approve_started,pa.session_namespaces_validation_success]}}));const S=await this.client.core.crypto.generateKeyPair(),M=w.publicKey,A=await this.client.core.crypto.generateSharedKey(S,M),I=or(cn(cn(cn({relay:{protocol:l??"irn"},namespaces:c,controller:{publicKey:S,metadata:this.client.metadata},expiry:xi(om)},u&&{sessionProperties:u}),h&&{scopedProperties:h}),f&&{sessionConfig:f}),{proposalRequestsResponses:m}),D=Nn.relay;x.addTrace(pa.subscribing_session_topic);try{await this.client.core.relayer.subscribe(A,{transportType:D,internal:{skipSubscribe:!0}})}catch(C){throw x.setError(Mf.subscribe_session_topic_failure),C}x.addTrace(pa.subscribe_session_topic_success);const k=or(cn({},I),{topic:A,requiredNamespaces:y,optionalNamespaces:_,pairingTopic:v,acknowledged:!1,self:I.controller,peer:{publicKey:w.publicKey,metadata:w.metadata},controller:S,transportType:Nn.relay,authentication:m==null?void 0:m.authentication,walletPayResult:m==null?void 0:m.walletPay});await this.client.session.set(A,k),x.addTrace(pa.store_session);try{await this.sendApproveSession({sessionTopic:A,proposal:g,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:S},sessionSettleRequest:I,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:cn({correlationId:a},this.getTVFApproveParams(k))}}),x.addTrace(pa.session_approve_publish_success)}catch(C){throw this.client.logger.error(C),this.client.session.delete(A,Dn("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(A),C}return this.client.core.eventClient.deleteEvent({eventId:x.eventId}),await this.client.core.pairing.updateMetadata({topic:v,metadata:w.metadata}),await this.deleteProposal(a),await this.client.core.pairing.activate({topic:v}),await this.setExpiry(A,xi(om)),{topic:A,acknowledged:()=>Promise.resolve(this.client.session.get(A))}}),Ce(this,"reject",async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(t)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:i,reason:r}=t;let s;try{s=this.client.proposal.get(i).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),o}s&&await this.sendError({id:i,topic:s,error:r,rpcOpts:sr.wc_sessionPropose.reject}),await this.deleteProposal(i)}),Ce(this,"update",async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(t)}catch(h){throw this.client.logger.error("update() -> isValidUpdate() failed"),h}const{topic:i,namespaces:r}=t,{done:s,resolve:o,reject:a}=qf(Be.FIVE_MINUTES,"Session update request expired without receiving any acknowledgement"),l=hl(),c=Ph().toString(),u=this.client.session.get(i).namespaces;return this.events.once(dn("session_update",l),({error:h})=>{h?a(h):o()}),await this.client.session.update(i,{namespaces:r}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:c}).catch(h=>{this.client.logger.error(h),this.client.session.update(i,{namespaces:u}),a(h)}),{acknowledged:s}}),Ce(this,"extend",async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(t)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:i}=t,r=hl(),{done:s,resolve:o,reject:a}=qf(Be.FIVE_MINUTES,"Session extend request expired without receiving any acknowledgement");return this.events.once(dn("session_extend",r),({error:l})=>{l?a(l):o()}),await this.setExpiry(i,xi(om)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch(l=>{a(l)}),{acknowledged:s}}),Ce(this,"request",async t=>{this.isInitialized();try{await this.isValidRequest(t)}catch(w){throw this.client.logger.error("request() -> isValidRequest() failed"),w}const{chainId:i,request:r,topic:s,expiry:o=sr.wc_sessionRequest.req.ttl}=t,a=this.client.session.get(s);(a==null?void 0:a.transportType)===Nn.relay&&await this.confirmOnlineStateOrThrow();const l=hl(),c=Ph().toString(),{done:u,resolve:h,reject:f}=qf(o,"Request expired. Please try again.");this.events.once(dn("session_request",l),({error:w,result:y})=>{w?f(w):h(y)});const m="wc_sessionRequest",g=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(g)return await this.sendRequest({clientRpcId:l,relayRpcId:c,topic:s,method:m,params:{request:or(cn({},r),{expiryTimestamp:xi(o)}),chainId:i},expiry:o,throwOnFailedPublish:!0,appLink:g}).catch(w=>f(w)),this.client.events.emit("session_request_sent",{topic:s,request:r,chainId:i,id:l}),await u();const v={request:or(cn({},r),{expiryTimestamp:xi(o)}),chainId:i};return await Promise.all([new Promise(async w=>{await this.sendRequest({clientRpcId:l,relayRpcId:c,topic:s,method:m,params:v,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,v)}).catch(y=>f(y)),this.client.events.emit("session_request_sent",{topic:s,request:r,chainId:i,id:l}),w()}),new Promise(async w=>{var y;if(!((y=a.sessionConfig)!=null&&y.disableDeepLink)){const _=await P1e(this.client.core.storage,Lz);await A1e({id:l,topic:s,wcDeepLink:_})}w()}),u()]).then(w=>w[2])}),Ce(this,"respond",async t=>{var i,r;this.isInitialized();const s=this.client.core.eventClient.createEvent({properties:{topic:(t==null?void 0:t.topic)||((r=(i=t==null?void 0:t.response)==null?void 0:i.id)==null?void 0:r.toString()),trace:[pa.session_request_response_started]}});try{await this.isValidRespond(t)}catch(h){throw s.addTrace(h==null?void 0:h.message),s.setError(Mf.session_request_response_validation_failure),h}s.addTrace(pa.session_request_response_validation_success);const{topic:o,response:a}=t,{id:l}=a,c=this.client.session.get(o);c.transportType===Nn.relay&&await this.confirmOnlineStateOrThrow();const u=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);try{s.addTrace(pa.session_request_response_publish_started),fl(a)?await this.sendResult({id:l,topic:o,result:a.result,throwOnFailedPublish:!0,appLink:u}):Zo(a)&&await this.sendError({id:l,topic:o,error:a.error,appLink:u}),this.cleanupAfterResponse(t)}catch(h){throw s.addTrace(h==null?void 0:h.message),s.setError(Mf.session_request_response_publish_failure),h}}),Ce(this,"ping",async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(t)}catch(r){throw this.client.logger.error("ping() -> isValidPing() failed"),r}const{topic:i}=t;if(this.client.session.keys.includes(i)){const r=hl(),s=Ph().toString(),{done:o,resolve:a,reject:l}=qf(Be.FIVE_MINUTES,"Ping request expired without receiving any acknowledgement");this.events.once(dn("session_ping",r),({error:c})=>{c?l(c):a()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:r,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(i)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:i}))}),Ce(this,"emit",async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(t);const{topic:i,event:r,chainId:s}=t,o=Ph().toString(),a=hl();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:r,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:a})}),Ce(this,"disconnect",async t=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(t);const{topic:i}=t;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:Dn("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:r}=Ve("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(r)}}),Ce(this,"find",t=>(this.isInitialized(),this.client.session.getAll().filter(i=>q_e(i,t)))),Ce(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),Ce(this,"authenticate",async(t,i)=>{var r;this.isInitialized(),this.isValidAuthenticate(t);const s=i&&this.client.core.linkModeSupportedApps.includes(i)&&((r=this.client.metadata.redirect)==null?void 0:r.linkMode),o=s?Nn.link_mode:Nn.relay;o===Nn.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:l="",uri:c,domain:u,nonce:h,type:f,exp:m,nbf:g,methods:v=[],expiry:w}=t,y=[...t.resources||[]],{topic:_,uri:x}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:_,uri:x}});const S=await this.client.core.crypto.generateKeyPair(),M=zE(S);if(await Promise.all([this.client.auth.authKeys.set(GE,{responseTopic:M,publicKey:S}),this.client.auth.pairingTopics.set(M,{topic:M,pairingTopic:_})]),await this.client.core.relayer.subscribe(M,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${_}`),v.length>0){const{namespace:O}=Wc(a[0]);let B=Wxe(O,"request",v);FE(y)&&(B=Kxe(B,y.pop())),y.push(B)}const A=w&&w>sr.wc_sessionAuthenticate.req.ttl?w:sr.wc_sessionAuthenticate.req.ttl,I={authPayload:{type:f??"caip122",chains:a,statement:l,aud:c,domain:u,version:"1",nonce:h,iat:new Date().toISOString(),exp:m,nbf:g,resources:y},requester:{publicKey:S,metadata:this.client.metadata},expiryTimestamp:xi(A)},D={eip155:{chains:a,methods:[...new Set(["personal_sign",...v])],events:["chainChanged","accountsChanged"]}},k={requiredNamespaces:{},optionalNamespaces:D,relays:[{protocol:"irn"}],pairingTopic:_,proposer:{publicKey:S,metadata:this.client.metadata},expiryTimestamp:xi(sr.wc_sessionPropose.req.ttl),id:hl()},{done:C,resolve:U,reject:G}=qf(A,"Request expired"),H=hl(),z=dn("session_connect",k.id),P=dn("session_request",H),R=async({error:O,session:B})=>{this.events.off(P,F),O?G(O):B&&U({session:B})},F=async O=>{var B,W,Q;if(await this.deletePendingAuthRequest(H,{message:"fulfilled",code:0}),O.error){const be=Dn("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return O.error.code===be.code?void 0:(this.events.off(z,R),G(O.error.message))}await this.deleteProposal(k.id),this.events.off(z,R);const{cacaos:oe,responder:Y}=O.result,te=[],le=[];for(const be of oe){await y6({cacao:be,projectId:this.client.core.projectId})||(this.client.logger.error(be,"Signature verification failed"),G(Dn("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Le}=be,Oe=FE(Le.resources),J=[SR(Le.iss)],Se=tA(Le.iss);if(Oe){const me=v6(Oe),Re=w6(Oe);te.push(...me),J.push(...Re)}for(const me of J)le.push(`${me}:${Se}`)}const ve=await this.client.core.crypto.generateSharedKey(S,Y.publicKey);let Te;te.length>0&&(Te={topic:ve,acknowledged:!0,self:{publicKey:S,metadata:this.client.metadata},peer:Y,controller:Y.publicKey,expiry:xi(om),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:_,namespaces:j6([...new Set(te)],[...new Set(le)]),transportType:o},await this.client.core.relayer.subscribe(ve,{transportType:o}),await this.client.session.set(ve,Te),_&&await this.client.core.pairing.updateMetadata({topic:_,metadata:Y.metadata}),Te=this.client.session.get(ve)),(B=this.client.metadata.redirect)!=null&&B.linkMode&&(W=Y.metadata.redirect)!=null&&W.linkMode&&(Q=Y.metadata.redirect)!=null&&Q.universal&&i&&(this.client.core.addLinkModeSupportedApp(Y.metadata.redirect.universal),this.client.session.update(ve,{transportType:Nn.link_mode})),U({auths:oe,session:Te})};this.events.once(z,R),this.events.once(P,F);let N;try{if(s){const O=Da("wc_sessionAuthenticate",I,H);this.client.core.history.set(_,O);const B=await this.client.core.crypto.encode("",O,{type:tx,encoding:oh});N=o_(i,_,B)}else await Promise.all([this.sendRequest({topic:_,method:"wc_sessionAuthenticate",params:I,expiry:t.expiry,throwOnFailedPublish:!0,clientRpcId:H}),this.sendRequest({topic:_,method:"wc_sessionPropose",params:k,expiry:sr.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:k.id})])}catch(O){throw this.events.off(z,R),this.events.off(P,F),O}return await this.setProposal(k.id,k),await this.setAuthRequest(H,{request:or(cn({},I),{verifyContext:{}}),pairingTopic:_,transportType:o}),{uri:N??x,response:C}}),Ce(this,"approveSessionAuthenticate",async t=>{const{id:i,auths:r}=t,s=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[Tf.authenticated_session_approve_started]}});try{this.isInitialized()}catch(w){throw s.setError(Jy.no_internet_connection),w}const o=this.getPendingAuthRequest(i);if(!o)throw s.setError(Jy.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const a=o.transportType||Nn.relay;a===Nn.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),u=zE(l),h={type:qc,receiverPublicKey:l,senderPublicKey:c},f=[],m=[];for(const w of r){if(!await y6({cacao:w,projectId:this.client.core.projectId})){s.setError(Jy.invalid_cacao);const M=Dn("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:u,error:M,encodeOpts:h}),new Error(M.message)}s.addTrace(Tf.cacaos_verified);const{p:y}=w,_=FE(y.resources),x=[SR(y.iss)],S=tA(y.iss);if(_){const M=v6(_),A=w6(_);f.push(...M),x.push(...A)}for(const M of x)m.push(`${M}:${S}`)}const g=await this.client.core.crypto.generateSharedKey(c,l);s.addTrace(Tf.create_authenticated_session_topic);let v;if((f==null?void 0:f.length)>0){v={topic:g,acknowledged:!0,self:{publicKey:c,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:xi(om),authentication:r,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:j6([...new Set(f)],[...new Set(m)]),transportType:a},s.addTrace(Tf.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(g,{transportType:a})}catch(w){throw s.setError(Jy.subscribe_authenticated_session_topic_failure),w}s.addTrace(Tf.subscribe_authenticated_session_topic_success),await this.client.session.set(g,v),s.addTrace(Tf.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Tf.publishing_authenticated_session_approve);try{await this.sendResult({topic:u,id:i,result:{cacaos:r,responder:{publicKey:c,metadata:this.client.metadata}},encodeOpts:h,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(w){throw s.setError(Jy.authenticated_session_approve_publish_failure),w}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:v}}),Ce(this,"rejectSessionAuthenticate",async t=>{this.isInitialized();const{id:i,reason:r}=t,s=this.getPendingAuthRequest(i);if(!s)throw new Error(`Could not find pending auth request with id ${i}`);s.transportType===Nn.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),l=zE(o),c={type:qc,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:i,topic:l,error:r,encodeOpts:c,rpcOpts:sr.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.deleteProposal(i)}),Ce(this,"formatAuthMessage",t=>{this.isInitialized();const{request:i,iss:r}=t;return pX(i,r)}),Ce(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const t=this.relayMessageCache.shift();t&&await this.onRelayMessage(t)}catch(t){this.client.logger.error(t)}},50)}),Ce(this,"cleanupDuplicatePairings",async t=>{if(t.pairingTopic)try{const i=this.client.core.pairing.pairings.get(t.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===t.peer.metadata.url&&s.topic&&s.topic!==i.topic});if(r.length===0)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}}),Ce(this,"deleteSession",async t=>{var i;const{topic:r,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=t,{self:l}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,Dn("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),s||this.client.core.expirer.del(r),this.client.core.storage.removeItem(Lz).catch(c=>this.client.logger.warn(c)),r===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=ll.idle),await Promise.all(this.getPendingSessionRequests().filter(c=>c.topic===r).map(c=>this.deletePendingSessionRequest(c.id,Dn("USER_DISCONNECTED")))),o&&this.client.events.emit("session_delete",{id:a,topic:r})}),Ce(this,"deleteProposal",async(t,i)=>{if(i)try{const r=this.client.proposal.get(t),s=this.client.core.eventClient.getEvent({topic:r.pairingTopic});s==null||s.setError(Mf.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(t,Dn("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"proposal")}),Ce(this,"deletePendingSessionRequest",async(t,i,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(t,i),r?Promise.resolve():this.client.core.expirer.del(t)]),this.addToRecentlyDeleted(t,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==t),r&&(this.sessionRequestQueue.state=ll.idle,this.client.events.emit("session_request_expire",{id:t}))}),Ce(this,"deletePendingAuthRequest",async(t,i,r=!1)=>{await Promise.all([this.client.auth.requests.delete(t,i),r?Promise.resolve():this.client.core.expirer.del(t)])}),Ce(this,"setExpiry",async(t,i)=>{this.client.session.keys.includes(t)&&(this.client.core.expirer.set(t,i),await this.client.session.update(t,{expiry:i}))}),Ce(this,"setProposal",async(t,i)=>{this.client.core.expirer.set(t,xi(sr.wc_sessionPropose.req.ttl)),await this.client.proposal.set(t,i)}),Ce(this,"setAuthRequest",async(t,i)=>{const{request:r,pairingTopic:s,transportType:o=Nn.relay}=i;this.client.core.expirer.set(t,r.expiryTimestamp),await this.client.auth.requests.set(t,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:t,pairingTopic:s,verifyContext:r.verifyContext,transportType:o})}),Ce(this,"setPendingSessionRequest",async t=>{const{id:i,topic:r,params:s,verifyContext:o}=t,a=s.request.expiryTimestamp||xi(sr.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,a),await this.client.pendingRequest.set(i,{id:i,topic:r,params:s,verifyContext:o})}),Ce(this,"sendRequest",async t=>{const{topic:i,method:r,params:s,expiry:o,relayRpcId:a,clientRpcId:l,throwOnFailedPublish:c,appLink:u,tvf:h,publishOpts:f={}}=t,m=Da(r,s,l);let g;const v=!!u;try{const _=v?oh:Ts;g=await this.client.core.crypto.encode(i,m,{encoding:_})}catch(_){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),_}let w;if(hPe.includes(r)){const _=Qo(JSON.stringify(m)),x=Qo(g);w=await this.client.core.verify.register({id:x,decryptedId:_})}const y=cn(cn({},sr[r].req),f);if(y.attestation=w,o&&(y.ttl=o),a&&(y.id=a),this.client.core.history.set(i,m),v){const _=o_(u,i,g);await global.Linking.openURL(_,this.client.name)}else y.tvf=or(cn({},h),{correlationId:m.id}),c?(y.internal=or(cn({},y.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,g,y)):this.client.core.relayer.publish(i,g,y).catch(_=>this.client.logger.error(_));return m.id}),Ce(this,"sendProposeSession",async t=>{const{proposal:i,publishOpts:r}=t,s=Da("wc_sessionPropose",i,i.id);this.client.core.history.set(i.pairingTopic,s);const o=await this.client.core.crypto.encode(i.pairingTopic,s,{encoding:Ts}),a=Qo(JSON.stringify(s)),l=Qo(o),c=await this.client.core.verify.register({id:l,decryptedId:a});await this.client.core.relayer.publishCustom({payload:{pairingTopic:i.pairingTopic,sessionProposal:o},opts:or(cn({},r),{publishMethod:"wc_proposeSession",attestation:c})})}),Ce(this,"sendApproveSession",async t=>{const{sessionTopic:i,pairingProposalResponse:r,proposal:s,sessionSettleRequest:o,publishOpts:a}=t,l=Zw(s.id,r),c=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Ts}),u=Da("wc_sessionSettle",o,a==null?void 0:a.id),h=await this.client.core.crypto.encode(i,u,{encoding:Ts});this.client.core.history.set(i,u),await this.client.core.relayer.publishCustom({payload:{sessionTopic:i,pairingTopic:s.pairingTopic,sessionProposalResponse:c,sessionSettlementRequest:h},opts:or(cn({},a),{publishMethod:"wc_approveSession"})})}),Ce(this,"sendResult",async t=>{const{id:i,topic:r,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:l}=t,c=Zw(i,s);let u;const h=l&&typeof(global==null?void 0:global.Linking)<"u";try{const g=h?oh:Ts;u=await this.client.core.crypto.encode(r,c,or(cn({},a||{}),{encoding:g}))}catch(g){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${r} failed`),g}let f,m;try{f=await this.client.core.history.get(r,i);const g=f.request;try{m=this.getTVFParams(i,g.params,s)}catch(v){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${v==null?void 0:v.message}`)}}catch(g){throw this.client.logger.error(`sendResult() -> history.get(${r}, ${i}) failed`),g}if(h){const g=o_(l,r,u);await global.Linking.openURL(g,this.client.name)}else{const g=f.request.method,v=sr[g].res;v.tvf=or(cn({},m),{correlationId:i}),o?(v.internal=or(cn({},v.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,u,v)):this.client.core.relayer.publish(r,u,v).catch(w=>this.client.logger.error(w))}await this.client.core.history.resolve(c)}),Ce(this,"sendError",async t=>{const{id:i,topic:r,error:s,encodeOpts:o,rpcOpts:a,appLink:l}=t,c=C2(i,s);let u;const h=l&&typeof(global==null?void 0:global.Linking)<"u";try{const m=h?oh:Ts;u=await this.client.core.crypto.encode(r,c,or(cn({},o||{}),{encoding:m}))}catch(m){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${r} failed`),m}let f;try{f=await this.client.core.history.get(r,i)}catch(m){throw this.client.logger.error(`sendError() -> history.get(${r}, ${i}) failed`),m}if(h){const m=o_(l,r,u);await global.Linking.openURL(m,this.client.name)}else{const m=f.request.method,g=a||sr[m].res;this.client.core.relayer.publish(r,u,g)}await this.client.core.history.resolve(c)}),Ce(this,"cleanup",async()=>{const t=[],i=[];this.client.session.getAll().forEach(r=>{let s=!1;Sl(r.expiry)&&(s=!0),this.client.core.crypto.keychain.has(r.topic)||(s=!0),s&&t.push(r.topic)}),this.client.proposal.getAll().forEach(r=>{Sl(r.expiryTimestamp)&&i.push(r.id)}),await Promise.all([...t.map(r=>this.deleteSession({topic:r})),...i.map(r=>this.deleteProposal(r))])}),Ce(this,"onProviderMessageEvent",async t=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(t):await this.onRelayMessage(t)}),Ce(this,"onRelayEventRequest",async t=>{this.requestQueue.queue.push(t),await this.processRequestsQueue()}),Ce(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===ll.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ll.active;const t=this.requestQueue.queue.shift();if(t)try{await this.processRequest(t)}catch(i){this.client.logger.warn(i)}}this.requestQueue.state=ll.idle}),Ce(this,"processRequest",async t=>{const{topic:i,payload:r,attestation:s,transportType:o,encryptedId:a}=t,l=r.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:r,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,r);case"wc_sessionPing":return await this.onSessionPingRequest(i,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,r);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:r,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(i,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:r,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),Ce(this,"onRelayEventResponse",async t=>{const{topic:i,payload:r,transportType:s}=t,o=(await this.client.core.history.get(i,r.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(i,r,s);case"wc_sessionSettle":return this.onSessionSettleResponse(i,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,r);case"wc_sessionExtend":return this.onSessionExtendResponse(i,r);case"wc_sessionPing":return this.onSessionPingResponse(i,r);case"wc_sessionRequest":return this.onSessionRequestResponse(i,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,r);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),Ce(this,"onRelayEventUnknownPayload",t=>{const{topic:i}=t,{message:r}=Ve("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(r)}),Ce(this,"shouldIgnorePairingRequest",t=>{const{topic:i,requestMethod:r}=t,s=this.expectedPairingMethodMap.get(i);return!s||s.includes(r)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),Ce(this,"onSessionProposeRequest",async t=>{const{topic:i,payload:r,attestation:s,encryptedId:o}=t,{params:a,id:l}=r;try{const c=this.client.core.eventClient.getEvent({topic:i});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),c==null||c.setError(uc.proposal_listener_not_found)),this.isValidConnect(cn({},r.params));const u=a.expiryTimestamp||xi(sr.wc_sessionPropose.req.ttl),h=cn({id:l,pairingTopic:i,expiryTimestamp:u,attestation:s,encryptedId:o},a);await this.setProposal(l,h);const f=await this.getVerifyContext({attestationId:s,hash:Qo(JSON.stringify(r)),encryptedId:o,metadata:h.proposer.metadata});c==null||c.addTrace(cl.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:h,verifyContext:f})}catch(c){await this.sendError({id:l,topic:i,error:c,rpcOpts:sr.wc_sessionPropose.autoReject}),this.client.logger.error(c)}}),Ce(this,"onSessionProposeResponse",async(t,i,r)=>{const{id:s}=i;if(fl(i)){const{result:o}=i;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const l=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const c=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:c});const u=await this.client.core.crypto.generateSharedKey(l,c);this.pendingSessions.set(s,{sessionTopic:u,pairingTopic:t,proposalId:s,publicKey:l});const h=await this.client.core.relayer.subscribe(u,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:h}),await this.client.core.pairing.activate({topic:t})}else if(Zo(i)){await this.deleteProposal(s);const o=dn("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:i.error})}}),Ce(this,"onSessionSettleRequest",async(t,i)=>{const{id:r,params:s}=i;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:l,namespaces:c,sessionProperties:u,scopedProperties:h,sessionConfig:f,proposalRequestsResponses:m}=i.params,g=[...this.pendingSessions.values()].find(y=>y.sessionTopic===t);if(!g)return this.client.logger.error(`Pending session not found for topic ${t}`);const v=this.client.proposal.get(g.proposalId),w=or(cn(cn(cn({topic:t,relay:o,expiry:l,namespaces:c,acknowledged:!0,pairingTopic:g.pairingTopic,requiredNamespaces:v.requiredNamespaces,optionalNamespaces:v.optionalNamespaces,controller:a.publicKey,self:{publicKey:g.publicKey,metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},u&&{sessionProperties:u}),h&&{scopedProperties:h}),f&&{sessionConfig:f}),{transportType:Nn.relay,authentication:m==null?void 0:m.authentication,walletPayResult:m==null?void 0:m.walletPay});await this.client.session.set(w.topic,w),await this.setExpiry(w.topic,w.expiry),await this.client.core.pairing.updateMetadata({topic:g.pairingTopic,metadata:w.peer.metadata}),this.pendingSessions.delete(g.proposalId),this.deleteProposal(g.proposalId,!1),this.cleanupDuplicatePairings(w),await this.sendResult({id:i.id,topic:t,throwOnFailedPublish:!0,result:!0}),this.client.events.emit("session_connect",{session:w}),this.events.emit(dn("session_connect",g.proposalId),{session:w})}catch(o){await this.sendError({id:r,topic:t,error:o}),this.client.logger.error(o)}}),Ce(this,"onSessionSettleResponse",async(t,i)=>{const{id:r}=i;fl(i)?(await this.client.session.update(t,{acknowledged:!0}),this.events.emit(dn("session_approve",r),{})):Zo(i)&&(await this.client.session.delete(t,Dn("USER_DISCONNECTED")),this.events.emit(dn("session_approve",r),{error:i.error}))}),Ce(this,"onSessionUpdateRequest",async(t,i)=>{const{params:r,id:s}=i;try{const o=`${t}_session_update`,a=Qy.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:t,error:Dn("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(cn({topic:t},r));try{Qy.set(o,s),await this.client.session.update(t,{namespaces:r.namespaces}),await this.sendResult({id:s,topic:t,result:!0})}catch(l){throw Qy.delete(o),l}this.client.events.emit("session_update",{id:s,topic:t,params:r})}catch(o){await this.sendError({id:s,topic:t,error:o}),this.client.logger.error(o)}}),Ce(this,"isRequestOutOfSync",(t,i)=>i.toString().slice(0,-3)<t.toString().slice(0,-3)),Ce(this,"onSessionUpdateResponse",(t,i)=>{const{id:r}=i,s=dn("session_update",r);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);fl(i)?this.events.emit(dn("session_update",r),{}):Zo(i)&&this.events.emit(dn("session_update",r),{error:i.error})}),Ce(this,"onSessionExtendRequest",async(t,i)=>{const{id:r}=i;try{this.isValidExtend({topic:t}),await this.setExpiry(t,xi(om)),await this.sendResult({id:r,topic:t,result:!0}),this.client.events.emit("session_extend",{id:r,topic:t})}catch(s){await this.sendError({id:r,topic:t,error:s}),this.client.logger.error(s)}}),Ce(this,"onSessionExtendResponse",(t,i)=>{const{id:r}=i,s=dn("session_extend",r);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);fl(i)?this.events.emit(dn("session_extend",r),{}):Zo(i)&&this.events.emit(dn("session_extend",r),{error:i.error})}),Ce(this,"onSessionPingRequest",async(t,i)=>{const{id:r}=i;try{this.isValidPing({topic:t}),await this.sendResult({id:r,topic:t,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:t})}catch(s){await this.sendError({id:r,topic:t,error:s}),this.client.logger.error(s)}}),Ce(this,"onSessionPingResponse",(t,i)=>{const{id:r}=i,s=dn("session_ping",r);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);fl(i)?this.events.emit(dn("session_ping",r),{}):Zo(i)&&this.events.emit(dn("session_ping",r),{error:i.error})},500)}),Ce(this,"onSessionDeleteRequest",async(t,i)=>{const{id:r}=i;try{await this.isValidDisconnect({topic:t,reason:i.params}),this.cleanupPendingSentRequestsForTopic({topic:t,error:Dn("USER_DISCONNECTED")}),await this.deleteSession({topic:t,id:r})}catch(s){this.client.logger.error(s)}}),Ce(this,"onSessionRequest",async t=>{var i,r,s;const{topic:o,payload:a,attestation:l,encryptedId:c,transportType:u}=t,{id:h,params:f}=a;try{await this.isValidRequest(cn({topic:o},f));const m=this.client.session.get(o),g=await this.getVerifyContext({attestationId:l,hash:Qo(JSON.stringify(Da("wc_sessionRequest",f,h))),encryptedId:c,metadata:m.peer.metadata,transportType:u}),v={id:h,topic:o,params:f,verifyContext:g};await this.setPendingSessionRequest(v),u===Nn.link_mode&&(i=m.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((r=m.peer.metadata.redirect)==null?void 0:r.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(v):(this.addSessionRequestToSessionRequestQueue(v),this.processSessionRequestQueue())}catch(m){await this.sendError({id:h,topic:o,error:m}),this.client.logger.error(m)}}),Ce(this,"onSessionRequestResponse",(t,i)=>{const{id:r}=i,s=dn("session_request",r);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);fl(i)?this.events.emit(dn("session_request",r),{result:i.result}):Zo(i)&&this.events.emit(dn("session_request",r),{error:i.error})}),Ce(this,"onSessionEventRequest",async(t,i)=>{const{id:r,params:s}=i;try{const o=`${t}_session_event_${s.event.name}`,a=Qy.get(o);if(a&&this.isRequestOutOfSync(a,r)){this.client.logger.info(`Discarding out of sync request - ${r}`);return}this.isValidEmit(cn({topic:t},s)),this.client.events.emit("session_event",{id:r,topic:t,params:s}),Qy.set(o,r)}catch(o){await this.sendError({id:r,topic:t,error:o}),this.client.logger.error(o)}}),Ce(this,"onSessionAuthenticateResponse",(t,i)=>{const{id:r}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:t,payload:i}),fl(i)?this.events.emit(dn("session_request",r),{result:i.result}):Zo(i)&&this.events.emit(dn("session_request",r),{error:i.error})}),Ce(this,"onSessionAuthenticateRequest",async t=>{var i;const{topic:r,payload:s,attestation:o,encryptedId:a,transportType:l}=t;try{const{requester:c,authPayload:u,expiryTimestamp:h}=s.params,f=await this.getVerifyContext({attestationId:o,hash:Qo(JSON.stringify(s)),encryptedId:a,metadata:c.metadata,transportType:l}),m={requester:c,pairingTopic:r,id:s.id,authPayload:u,verifyContext:f,expiryTimestamp:h};await this.setAuthRequest(s.id,{request:m,pairingTopic:r,transportType:l}),l===Nn.link_mode&&(i=c.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(c.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:s.params,id:s.id,verifyContext:f})}catch(c){this.client.logger.error(c);const u=s.params.requester.publicKey,h=await this.client.core.crypto.generateKeyPair(),f=this.getAppLinkIfEnabled(s.params.requester.metadata,l),m={type:qc,receiverPublicKey:u,senderPublicKey:h};await this.sendError({id:s.id,topic:r,error:c,encodeOpts:m,rpcOpts:sr.wc_sessionAuthenticate.autoReject,appLink:f})}}),Ce(this,"addSessionRequestToSessionRequestQueue",t=>{this.sessionRequestQueue.queue.push(t)}),Ce(this,"cleanupAfterResponse",t=>{this.deletePendingSessionRequest(t.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ll.idle,this.processSessionRequestQueue()},Be.toMiliseconds(this.requestQueueDelay))}),Ce(this,"cleanupPendingSentRequestsForTopic",({topic:t,error:i})=>{const r=this.client.core.history.pending;r.length>0&&r.filter(s=>s.topic===t&&s.request.method==="wc_sessionRequest").forEach(s=>{this.events.emit(dn("session_request",s.request.id),{error:i})})}),Ce(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===ll.active){this.client.logger.info("session request queue is already active.");return}const t=this.sessionRequestQueue.queue[0];if(!t){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(t)}catch(i){this.client.logger.error(i)}}),Ce(this,"emitSessionRequest",t=>{if(this.emittedSessionRequests.has(t.id)){this.client.logger.warn({id:t.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${t.id}`);return}this.sessionRequestQueue.state=ll.active,this.emittedSessionRequests.add(t.id),this.client.events.emit("session_request",t)}),Ce(this,"onPairingCreated",t=>{if(t.methods&&this.expectedPairingMethodMap.set(t.topic,t.methods),t.active)return;const i=this.client.proposal.getAll().find(r=>r.pairingTopic===t.topic);i&&this.onSessionProposeRequest({topic:t.topic,payload:Da("wc_sessionPropose",or(cn({},i),{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties,scopedProperties:i.scopedProperties}),i.id),attestation:i.attestation,encryptedId:i.encryptedId})}),Ce(this,"isValidConnect",async t=>{if(!bs(t)){const{message:c}=Ve("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(t)}`);throw new Error(c)}const{pairingTopic:i,requiredNamespaces:r,optionalNamespaces:s,sessionProperties:o,scopedProperties:a,relays:l}=t;if(qi(i)||await this.isValidPairingTopic(i),!sEe(l)){const{message:c}=Ve("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(c)}if(r&&!qi(r)&&Bl(r)!==0){const c="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(c):this.client.logger.warn(c),this.validateNamespaces(r,"requiredNamespaces")}if(s&&!qi(s)&&Bl(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),o&&!qi(o)&&this.validateSessionProps(o,"sessionProperties"),a&&!qi(a)){this.validateSessionProps(a,"scopedProperties");const c=Object.keys(r||{}).concat(Object.keys(s||{}));if(!Object.keys(a).every(u=>c.includes(u.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(c)}`)}}),Ce(this,"validateNamespaces",(t,i)=>{const r=rEe(t,"connect()",i);if(r)throw new Error(r.message)}),Ce(this,"isValidApprove",async t=>{if(!bs(t))throw new Error(Ve("MISSING_OR_INVALID",`approve() params: ${t}`).message);const{id:i,namespaces:r,relayProtocol:s,sessionProperties:o,scopedProperties:a}=t;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const l=this.client.proposal.get(i),c=nC(r,"approve()");if(c)throw new Error(c.message);const u=K6(l.requiredNamespaces,r,"approve()");if(u)throw new Error(u.message);if(!_i(s,!0)){const{message:h}=Ve("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(h)}if(o&&!qi(o)&&this.validateSessionProps(o,"sessionProperties"),a&&!qi(a)){this.validateSessionProps(a,"scopedProperties");const h=new Set(Object.keys(r));if(!Object.keys(a).every(f=>h.has(f.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(a)}, approved namespaces: ${Array.from(h).join(", ")}`)}}),Ce(this,"isValidReject",async t=>{if(!bs(t)){const{message:s}=Ve("MISSING_OR_INVALID",`reject() params: ${t}`);throw new Error(s)}const{id:i,reason:r}=t;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!aEe(r)){const{message:s}=Ve("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw new Error(s)}}),Ce(this,"isValidSessionSettleRequest",t=>{if(!bs(t)){const{message:c}=Ve("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${t}`);throw new Error(c)}const{relay:i,controller:r,namespaces:s,expiry:o}=t;if(!ZX(i)){const{message:c}=Ve("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(c)}const a=Z_e(r,"onSessionSettleRequest()");if(a)throw new Error(a.message);const l=nC(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(Sl(o)){const{message:c}=Ve("EXPIRED","onSessionSettleRequest()");throw new Error(c)}}),Ce(this,"isValidUpdate",async t=>{if(!bs(t)){const{message:l}=Ve("MISSING_OR_INVALID",`update() params: ${t}`);throw new Error(l)}const{topic:i,namespaces:r}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const s=this.client.session.get(i),o=nC(r,"update()");if(o)throw new Error(o.message);const a=K6(s.requiredNamespaces,r,"update()");if(a)throw new Error(a.message)}),Ce(this,"isValidExtend",async t=>{if(!bs(t)){const{message:r}=Ve("MISSING_OR_INVALID",`extend() params: ${t}`);throw new Error(r)}const{topic:i}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)}),Ce(this,"isValidRequest",async t=>{if(!bs(t)){const{message:l}=Ve("MISSING_OR_INVALID",`request() params: ${t}`);throw new Error(l)}const{topic:i,request:r,chainId:s,expiry:o}=t;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:a}=this.client.session.get(i);if(!q6(a,s)){const{message:l}=Ve("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!lEe(r)){const{message:l}=Ve("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw new Error(l)}if(!hEe(a,s,r.method)){const{message:l}=Ve("MISSING_OR_INVALID",`request() method: ${r.method}`);throw new Error(l)}this.validateRequestExpiry(o)}),Ce(this,"isValidRespond",async t=>{var i;if(!bs(t)){const{message:a}=Ve("MISSING_OR_INVALID",`respond() params: ${t}`);throw new Error(a)}const{topic:r,response:s}=t;try{await this.isValidSessionTopic(r)}catch(a){throw(i=t==null?void 0:t.response)!=null&&i.id&&this.cleanupAfterResponse(t),a}if(!cEe(s)){const{message:a}=Ve("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(a)}const o=this.client.pendingRequest.get(s.id);if(o.topic!==r){const{message:a}=Ve("MISMATCHED_TOPIC",`Request response topic mismatch. reqId: ${s.id}, expected topic: ${o.topic}, received topic: ${r}`);throw new Error(a)}}),Ce(this,"isValidPing",async t=>{if(!bs(t)){const{message:r}=Ve("MISSING_OR_INVALID",`ping() params: ${t}`);throw new Error(r)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)}),Ce(this,"isValidEmit",async t=>{if(!bs(t)){const{message:a}=Ve("MISSING_OR_INVALID",`emit() params: ${t}`);throw new Error(a)}const{topic:i,event:r,chainId:s}=t;await this.isValidSessionTopic(i);const{namespaces:o}=this.client.session.get(i);if(!q6(o,s)){const{message:a}=Ve("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!uEe(r)){const{message:a}=Ve("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(a)}if(!fEe(o,s,r.name)){const{message:a}=Ve("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(a)}}),Ce(this,"isValidDisconnect",async t=>{if(!bs(t)){const{message:r}=Ve("MISSING_OR_INVALID",`disconnect() params: ${t}`);throw new Error(r)}const{topic:i}=t;await this.isValidSessionOrPairingTopic(i)}),Ce(this,"isValidAuthenticate",t=>{const{chains:i,uri:r,domain:s,nonce:o}=t;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!_i(r,!1))throw new Error("uri is required parameter");if(!_i(s,!1))throw new Error("domain is required parameter");if(!_i(o,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(l=>Wc(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=Wc(i[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),Ce(this,"getVerifyContext",async t=>{const{attestationId:i,hash:r,encryptedId:s,metadata:o,transportType:a}=t,l={verified:{verifyUrl:o.verifyUrl||nw,validation:"UNKNOWN",origin:o.url||""}};try{if(a===Nn.link_mode){const u=this.getAppLinkIfEnabled(o,a);return l.verified.validation=u&&new URL(u).origin===new URL(o.url).origin?"VALID":"INVALID",l}const c=await this.client.core.verify.resolve({attestationId:i,hash:r,encryptedId:s,verifyUrl:o.verifyUrl});c&&(l.verified.origin=c.origin,l.verified.isScam=c.isScam,l.verified.validation=c.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(c){this.client.logger.warn(c)}return this.client.logger.debug(`Verify context: ${JSON.stringify(l)}`),l}),Ce(this,"validateSessionProps",(t,i)=>{Object.values(t).forEach((r,s)=>{if(r==null){const{message:o}=Ve("MISSING_OR_INVALID",`${i} must contain an existing value for each key. Received: ${r} for key ${Object.keys(t)[s]}`);throw new Error(o)}})}),Ce(this,"getPendingAuthRequest",t=>{const i=this.client.auth.requests.get(t);return typeof i=="object"?i:void 0}),Ce(this,"addToRecentlyDeleted",(t,i)=>{if(this.recentlyDeletedMap.set(t,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let r=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(r++>=s)break;this.recentlyDeletedMap.delete(o)}}}),Ce(this,"checkRecentlyDeleted",t=>{const i=this.recentlyDeletedMap.get(t);if(i){const{message:r}=Ve("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${t}`);throw new Error(r)}}),Ce(this,"isLinkModeEnabled",(t,i)=>{var r,s,o,a,l,c,u,h,f;return!t||i!==Nn.link_mode?!1:((s=(r=this.client.metadata)==null?void 0:r.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((c=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:c.universal)!==""&&((u=t==null?void 0:t.redirect)==null?void 0:u.universal)!==void 0&&((h=t==null?void 0:t.redirect)==null?void 0:h.universal)!==""&&((f=t==null?void 0:t.redirect)==null?void 0:f.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(t.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"}),Ce(this,"getAppLinkIfEnabled",(t,i)=>{var r;return this.isLinkModeEnabled(t,i)?(r=t==null?void 0:t.redirect)==null?void 0:r.universal:void 0}),Ce(this,"handleLinkModeMessage",({url:t})=>{if(!t||!t.includes("wc_ev")||!t.includes("topic"))return;const i=s6(t,"topic")||"",r=decodeURIComponent(s6(t,"wc_ev")||""),s=this.client.session.keys.includes(i);s&&this.client.session.update(i,{transportType:Nn.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:r,sessionExists:s})}),Ce(this,"registerLinkModeListeners",async()=>{var t;if(dL()||sf()&&(t=this.client.metadata.redirect)!=null&&t.linkMode){const i=global==null?void 0:global.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const r=await i.getInitialURL();r&&setTimeout(()=>{this.handleLinkModeMessage({url:r})},50)}}}),Ce(this,"getTVFApproveParams",t=>{try{const i=YX(t.namespaces),r=F_e(t.namespaces),s=z_e(t.namespaces),o=t.sessionProperties,a=t.scopedProperties;return{approvedChains:i,approvedMethods:r,approvedEvents:s,sessionProperties:o,scopedProperties:a}}catch(i){return this.client.logger.warn(i,"Error getting TVF approve params"),{}}}),Ce(this,"getTVFParams",(t,i,r)=>{var s,o,a;if(!((s=i.request)!=null&&s.method))return{};const l={correlationId:t,rpcMethods:[i.request.method],chainId:i.chainId};try{const c=this.extractTxHashesFromResult(i.request,r);l.txHashes=c,l.contractAddresses=this.isValidContractData(i.request.params)?[(a=(o=i.request.params)==null?void 0:o[0])==null?void 0:a.to]:[]}catch(c){this.client.logger.warn(c,"Error getting TVF params")}return l}),Ce(this,"isValidContractData",t=>{var i;if(!t)return!1;try{const r=(t==null?void 0:t.data)||((i=t==null?void 0:t[0])==null?void 0:i.data);if(!r.startsWith("0x"))return!1;const s=r.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),Ce(this,"extractTxHashesFromResult",(t,i)=>{var r;try{if(!i)return[];const s=t.method,o=cPe[s];if(s==="sui_signTransaction")return[Txe(i.transactionBytes)];if(s==="near_signTransaction")return[d6(i)];if(s==="near_signTransactions")return i.map(l=>d6(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(r=i.tx_json)==null?void 0:r.hash];if(s==="polkadot_signTransaction")return[IEe({transaction:t.params.transactionPayload,signature:i.signature})];if(s==="algo_signTxn")return sa(i)?i.map(l=>p6(l)):[p6(i)];if(s==="cosmos_signDirect")return[Cxe(i)];if(s==="wallet_sendCalls")return Ixe(i);if(typeof i=="string")return[i];const a=i[o.key];if(sa(a))return s==="solana_signAllTransactions"?a.map(l=>Mxe(l)):a;if(typeof a=="string")return[a]}catch(s){this.client.logger.warn(s,"Error extracting tx hashes from result")}return[]})}async processPendingMessageEvents(){try{const e=this.client.session.keys,t=this.client.core.relayer.messages.getWithoutAck(e);for(const[i,r]of Object.entries(t))for(const s of r)try{await this.onProviderMessageEvent({topic:i,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${i}, message: ${s}`)}}catch(e){this.client.logger.warn(e,"processPendingMessageEvents failed")}}isInitialized(){if(!this.initialized){const{message:e}=Ve("NOT_INITIALIZED",this.name);throw new Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(bi.message,e=>{this.onProviderMessageEvent(e)})}async onRelayMessage(e){const{topic:t,message:i,attestation:r,transportType:s}=e,{publicKey:o}=this.client.auth.authKeys.keys.includes(GE)?this.client.auth.authKeys.get(GE):{responseTopic:void 0,publicKey:void 0};try{const a=await this.client.core.crypto.decode(t,i,{receiverPublicKey:o,encoding:s===Nn.link_mode?oh:Ts});ML(a)?(this.client.core.history.set(t,a),await this.onRelayEventRequest({topic:t,payload:a,attestation:r,transportType:s,encryptedId:Qo(i)})):I2(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:t,payload:a,transportType:s}),this.client.core.history.delete(t,a.id)):(this.client.logger.error(`onRelayMessage() -> unknown payload: ${JSON.stringify(a)}`),await this.onRelayEventUnknownPayload({topic:t,payload:a,transportType:s})),await this.client.core.relayer.messages.ack(t,i)}catch(a){this.client.logger.error(`onRelayMessage() -> failed to process an inbound message: ${i}`),this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(Ho.expired,async e=>{const{topic:t,id:i}=QK(e.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,Ve("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,Ve("EXPIRED"),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(ed.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(ed.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!_i(e,!1)){const{message:t}=Ve("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:t}=Ve("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(t)}if(Sl(this.client.core.pairing.pairings.get(e).expiry)){const{message:t}=Ve("EXPIRED",`pairing topic: ${e}`);throw new Error(t)}}async isValidSessionTopic(e){if(!_i(e,!1)){const{message:t}=Ve("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:t}=Ve("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(t)}if(Sl(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:t}=Ve("EXPIRED",`session topic: ${e}`);throw new Error(t)}if(!this.client.core.crypto.keychain.has(e)){const{message:t}=Ve("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(_i(e,!1)){const{message:t}=Ve("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(t)}else{const{message:t}=Ve("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(t)}}async isValidProposalId(e){if(!oEe(e)){const{message:t}=Ve("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(t)}if(!this.client.proposal.keys.includes(e)){const{message:t}=Ve("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(t)}if(Sl(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:t}=Ve("EXPIRED",`proposal id: ${e}`);throw new Error(t)}}validateRequestExpiry(e){if(e&&!mEe(e,uC)){const{message:t}=Ve("MISSING_OR_INVALID",`request() expiry: ${e}. Expiry must be a number (in seconds) between ${uC.min} and ${uC.max}`);throw new Error(t)}}}class EPe extends Cp{constructor(e,t){super(e,t,oPe,PL),this.core=e,this.logger=t}}let SPe=class extends Cp{constructor(e,t){super(e,t,aPe,PL),this.core=e,this.logger=t}};class APe extends Cp{constructor(e,t){super(e,t,uPe,PL,i=>i.id),this.core=e,this.logger=t}}class MPe extends Cp{constructor(e,t){super(e,t,pPe,N2,()=>GE),this.core=e,this.logger=t}}class TPe extends Cp{constructor(e,t){super(e,t,mPe,N2),this.core=e,this.logger=t}}class PPe extends Cp{constructor(e,t){super(e,t,gPe,N2,i=>i.id),this.core=e,this.logger=t}}var CPe=Object.defineProperty,IPe=(n,e,t)=>e in n?CPe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,hC=(n,e,t)=>IPe(n,typeof e!="symbol"?e+"":e,t);class RPe{constructor(e,t){this.core=e,this.logger=t,hC(this,"authKeys"),hC(this,"pairingTopics"),hC(this,"requests"),this.authKeys=new MPe(this.core,this.logger),this.pairingTopics=new TPe(this.core,this.logger),this.requests=new PPe(this.core,this.logger)}
203async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var NPe=Object.defineProperty,DPe=(n,e,t)=>e in n?NPe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Xt=(n,e,t)=>DPe(n,typeof e!="symbol"?e+"":e,t);class CL extends RSe{constructor(e){super(e),Xt(this,"protocol",AY),Xt(this,"version",MY),Xt(this,"name",cC.name),Xt(this,"metadata"),Xt(this,"core"),Xt(this,"logger"),Xt(this,"events",new _o.EventEmitter),Xt(this,"engine"),Xt(this,"session"),Xt(this,"proposal"),Xt(this,"pendingRequest"),Xt(this,"auth"),Xt(this,"signConfig"),Xt(this,"on",(i,r)=>this.events.on(i,r)),Xt(this,"once",(i,r)=>this.events.once(i,r)),Xt(this,"off",(i,r)=>this.events.off(i,r)),Xt(this,"removeListener",(i,r)=>this.events.removeListener(i,r)),Xt(this,"removeAllListeners",i=>this.events.removeAllListeners(i)),Xt(this,"connect",async i=>{try{return await this.engine.connect(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"pair",async i=>{try{return await this.engine.pair(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"approve",async i=>{try{return await this.engine.approve(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"reject",async i=>{try{return await this.engine.reject(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"update",async i=>{try{return await this.engine.update(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"extend",async i=>{try{return await this.engine.extend(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"request",async i=>{try{return await this.engine.request(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"respond",async i=>{try{return await this.engine.respond(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"ping",async i=>{try{return await this.engine.ping(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"emit",async i=>{try{return await this.engine.emit(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"disconnect",async i=>{try{return await this.engine.disconnect(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"find",i=>{try{return this.engine.find(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}}),Xt(this,"authenticate",async(i,r)=>{try{return await this.engine.authenticate(i,r)}catch(s){throw this.logger.error(s.message),s}}),Xt(this,"formatAuthMessage",i=>{try{return this.engine.formatAuthMessage(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"approveSessionAuthenticate",async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(r){throw this.logger.error(r.message),r}}),Xt(this,"rejectSessionAuthenticate",async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(r){throw this.logger.error(r.message),r}}),this.name=(e==null?void 0:e.name)||cC.name,this.metadata=w1e(e==null?void 0:e.metadata),this.signConfig=e==null?void 0:e.signConfig;const t=SL({logger:(e==null?void 0:e.logger)||cC.logger,name:this.name});this.logger=t,this.core=(e==null?void 0:e.core)||new sPe(e),this.session=new SPe(this.core,this.logger),this.proposal=new EPe(this.core,this.logger),this.pendingRequest=new APe(this.core,this.logger),this.engine=new _Pe(this),this.auth=new RPe(this.core,this.logger)}static async init(e){const t=new CL(e);return await t.initialize(),t}get context(){return Vs(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}const OPe=CL;
vendor: 5,537 bytes, line 203
203var QR={exports:{}};(function(n,e){var t=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof El<"u"&&El,i=function(){function s(){this.fetch=!1,this.DOMException=t.DOMException}return s.prototype=t,new s}();(function(s){(function(o){var a=typeof s<"u"&&s||typeof self<"u"&&self||typeof El<"u"&&El||{},l={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};function c(P){return P&&DataView.prototype.isPrototypeOf(P)}if(l.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],h=ArrayBuffer.isView||function(P){return P&&u.indexOf(Object.prototype.toString.call(P))>-1};function f(P){if(typeof P!="string"&&(P=String(P)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(P)||P==="")throw new TypeError('Invalid character in header field name: "'+P+'"');return P.toLowerCase()}function m(P){return typeof P!="string"&&(P=String(P)),P}function g(P){var R={next:function(){var F=P.shift();return{done:F===void 0,value:F}}};return l.iterable&&(R[Symbol.iterator]=function(){return R}),R}function v(P){this.map={},P instanceof v?P.forEach(function(R,F){this.append(F,R)},this):Array.isArray(P)?P.forEach(function(R){if(R.length!=2)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+R.length);this.append(R[0],R[1])},this):P&&Object.getOwnPropertyNames(P).forEach(function(R){this.append(R,P[R])},this)}v.prototype.append=function(P,R){P=f(P),R=m(R);var F=this.map[P];this.map[P]=F?F+", "+R:R},v.prototype.delete=function(P){delete this.map[f(P)]},v.prototype.get=function(P){return P=f(P),this.has(P)?this.map[P]:null},v.prototype.has=function(P){return this.map.hasOwnProperty(f(P))},v.prototype.set=function(P,R){this.map[f(P)]=m(R)},v.prototype.forEach=function(P,R){for(var F in this.map)this.map.hasOwnProperty(F)&&P.call(R,this.map[F],F,this)},v.prototype.keys=function(){var P=[];return this.forEach(function(R,F){P.push(F)}),g(P)},v.prototype.values=function(){var P=[];return this.forEach(function(R){P.push(R)}),g(P)},v.prototype.entries=function(){var P=[];return this.forEach(function(R,F){P.push([F,R])}),g(P)},l.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function w(P){if(!P._noBody){if(P.bodyUsed)return Promise.reject(new TypeError("Already read"));P.bodyUsed=!0}}function y(P){return new Promise(function(R,F){P.onload=function(){R(P.result)},P.onerror=function(){F(P.error)}})}function _(P){var R=new FileReader,F=y(R);return R.readAsArrayBuffer(P),F}function x(P){var R=new FileReader,F=y(R),N=/charset=([A-Za-z0-9_-]+)/.exec(P.type),O=N?N[1]:"utf-8";return R.readAsText(P,O),F}function S(P){for(var R=new Uint8Array(P),F=new Array(R.length),N=0;N<R.length;N++)F[N]=String.fromCharCode(R[N]);return F.join("")}function M(P){if(P.slice)return P.slice(0);var R=new Uint8Array(P.byteLength);return R.set(new Uint8Array(P)),R.buffer}function A(){return this.bodyUsed=!1,this._initBody=function(P){this.bodyUsed=this.bodyUsed,this._bodyInit=P,P?typeof P=="string"?this._bodyText=P:l.blob&&Blob.prototype.isPrototypeOf(P)?this._bodyBlob=P:l.formData&&FormData.prototype.isPrototypeOf(P)?this._bodyFormData=P:l.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)?this._bodyText=P.toString():l.arrayBuffer&&l.blob&&c(P)?(this._bodyArrayBuffer=M(P.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):l.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(P)||h(P))?this._bodyArrayBuffer=M(P):this._bodyText=P=Object.prototype.toString.call(P):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||(typeof P=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l.searchParams&&URLSearchParams.prototype.isPrototypeOf(P)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},l.blob&&(this.blob=function(){var P=w(this);if(P)return P;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer){var P=w(this);return P||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}else{if(l.blob)return this.blob().then(_);throw new Error("could not read as ArrayBuffer")}},this.text=function(){var P=w(this);if(P)return P;if(this._bodyBlob)return x(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(S(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l.formData&&(this.formData=function(){return this.text().then(C)}),this.json=function(){return this.text().then(JSON.parse)},this}var I=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function D(P){var R=P.toUpperCase();return I.indexOf(R)>-1?R:P}function k(P,R){if(!(this instanceof k))throw new TypeError('Please use the "new" operator, this DOM object c
203onstructor cannot be called as a function.');R=R||{};var F=R.body;if(P instanceof k){if(P.bodyUsed)throw new TypeError("Already read");this.url=P.url,this.credentials=P.credentials,R.headers||(this.headers=new v(P.headers)),this.method=P.method,this.mode=P.mode,this.signal=P.signal,!F&&P._bodyInit!=null&&(F=P._bodyInit,P.bodyUsed=!0)}else this.url=String(P);if(this.credentials=R.credentials||this.credentials||"same-origin",(R.headers||!this.headers)&&(this.headers=new v(R.headers)),this.method=D(R.method||this.method||"GET"),this.mode=R.mode||this.mode||null,this.signal=R.signal||this.signal||function(){if("AbortController"in a){var B=new AbortController;return B.signal}}(),this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&F)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(F),(this.method==="GET"||this.method==="HEAD")&&(R.cache==="no-store"||R.cache==="no-cache")){var N=/([?&])_=[^&]*/;if(N.test(this.url))this.url=this.url.replace(N,"$1_="+new Date().getTime());else{var O=/\?/;this.url+=(O.test(this.url)?"&":"?")+"_="+new Date().getTime()}}}k.prototype.clone=function(){return new k(this,{body:this._bodyInit})};function C(P){var R=new FormData;return P.trim().split("&").forEach(function(F){if(F){var N=F.split("="),O=N.shift().replace(/\+/g," "),B=N.join("=").replace(/\+/g," ");R.append(decodeURIComponent(O),decodeURIComponent(B))}}),R}function U(P){var R=new v,F=P.replace(/\r?\n[\t ]+/g," ");return F.split("\r").map(function(N){return N.indexOf(`
204`)===0?N.substr(1,N.length):N}).forEach(function(N){var O=N.split(":"),B=O.shift().trim();if(B){var W=O.join(":").trim();try{R.append(B,W)}catch(Q){console.warn("Response "+Q.message)}}}),R}A.call(k.prototype);function G(P,R){if(!(this instanceof G))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(R||(R={}),this.type="default",this.status=R.status===void 0?200:R.status,this.status<200||this.status>599)throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=R.statusText===void 0?"":""+R.statusText,this.headers=new v(R.headers),this.url=R.url||"",this._initBody(P)}A.call(G.prototype),G.prototype.clone=function(){return new G(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},G.error=function(){var P=new G(null,{status:200,statusText:""});return P.ok=!1,P.status=0,P.type="error",P};var H=[301,302,303,307,308];G.redirect=function(P,R){if(H.indexOf(R)===-1)throw new RangeError("Invalid status code");return new G(null,{status:R,headers:{location:P}})},o.DOMException=a.DOMException;try{new o.DOMException}catch{o.DOMException=function(R,F){this.message=R,this.name=F;var N=Error(R);this.stack=N.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function z(P,R){return new Promise(function(F,N){var O=new k(P,R);if(O.signal&&O.signal.aborted)return N(new o.DOMException("Aborted","AbortError"));var B=new XMLHttpRequest;function W(){B.abort()}B.onload=function(){var Y={statusText:B.statusText,headers:U(B.getAllResponseHeaders()||"")};O.url.indexOf("file://")===0&&(B.status<200||B.status>599)?Y.status=200:Y.status=B.status,Y.url="responseURL"in B?B.responseURL:Y.headers.get("X-Request-URL");var te="response"in B?B.response:B.responseText;setTimeout(function(){F(new G(te,Y))},0)},B.onerror=function(){setTimeout(function(){N(new TypeError("Network request failed"))},0)},B.ontimeout=function(){setTimeout(function(){N(new TypeError("Network request timed out"))},0)},B.onabort=function(){setTimeout(function(){N(new o.DOMException("Aborted","AbortError"))},0)};function Q(Y){try{return Y===""&&a.location.href?a.location.href:Y}catch{return Y}}if(B.open(O.method,Q(O.url),!0),O.credentials==="include"?B.withCredentials=!0:O.credentials==="omit"&&(B.withCredentials=!1),"responseType"in B&&(l.blob?B.responseType="blob":l.arrayBuffer&&(B.responseType="arraybuffer")),R&&typeof R.headers=="object"&&!(R.headers instanceof v||a.Headers&&R.headers instanceof a.Headers)){var oe=[];
vendor: 4,399 bytes, line 204
204Object.getOwnPropertyNames(R.headers).forEach(function(Y){oe.push(f(Y)),B.setRequestHeader(Y,m(R.headers[Y]))}),O.headers.forEach(function(Y,te){oe.indexOf(te)===-1&&B.setRequestHeader(te,Y)})}else O.headers.forEach(function(Y,te){B.setRequestHeader(te,Y)});O.signal&&(O.signal.addEventListener("abort",W),B.onreadystatechange=function(){B.readyState===4&&O.signal.removeEventListener("abort",W)}),B.send(typeof O._bodyInit>"u"?null:O._bodyInit)})}return z.polyfill=!0,a.fetch||(a.fetch=z,a.Headers=v,a.Request=k,a.Response=G),o.Headers=v,o.Request=k,o.Response=G,o.fetch=z,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=t.fetch?t:i;e=r.fetch,e.default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,n.exports=e})(QR,QR.exports);var LPe=QR.exports;const kz=AA(LPe);var UPe=Object.defineProperty,BPe=Object.defineProperties,kPe=Object.getOwnPropertyDescriptors,Fz=Object.getOwnPropertySymbols,FPe=Object.prototype.hasOwnProperty,zPe=Object.prototype.propertyIsEnumerable,zz=(n,e,t)=>e in n?UPe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Vz=(n,e)=>{for(var t in e||(e={}))FPe.call(e,t)&&zz(n,t,e[t]);if(Fz)for(var t of Fz(e))zPe.call(e,t)&&zz(n,t,e[t]);return n},Hz=(n,e)=>BPe(n,kPe(e));const VPe={Accept:"application/json","Content-Type":"application/json"},HPe="POST",$z={headers:VPe,method:HPe},Gz=10;let PY=class{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new _o.EventEmitter,this.isAvailable=!1,this.registering=!1,!az(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const t=iu(e),i=await(await kz(this.url,Hz(Vz({},$z),{body:t}))).json();this.onPayload({data:i})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!az(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const t=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=t||this.events.listenerCount("open")>=t)&&this.events.setMaxListeners(t+1),new Promise((i,r)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),r(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return r(new Error("HTTP connection is missing or invalid"));i()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const t=iu({id:1,jsonrpc:"2.0",method:"test",params:[]});await kz(e,Hz(Vz({},$z),{body:t}))}this.onOpen()}catch(t){const i=this.parseError(t);throw this.events.emit("register_error",i),this.onClose(),i}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const t=typeof e.data=="string"?hp(e.data):e.data;this.events.emit("payload",t)}onError(e,t){const i=this.parseError(t),r=i.message||i.toString(),s=C2(e,r);this.events.emit("payload",s)}parseError(e,t=this.url){return iY(e,t,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>Gz&&this.events.setMaxListeners(Gz)}};function IL(n){return n==null||typeof n!="object"&&typeof n!="function"}function CY(n){return Object.getOwnPropertySymbols(n).filter(e=>Object.prototype.propertyIsEnumerable.call(n,e))}function IY(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}const $Pe="[object RegExp]",RY="[object String]",NY="[object Number]",DY="[object Boolean]",OY="[object Arguments]",GPe="[object Symbol]",jPe="[object Date]",WPe="[object Map]",qPe="[object Set]",KPe="[object Array]",XPe="[object ArrayBuffer]",YPe="[object Object]",QPe="[object DataView]",ZPe="[object Uint8Array]",JPe="[object Uint8ClampedArray]",eCe="[object Uint16Array]",tCe="[object Uint32Array]",nCe="[object Int8Array]",iCe="[object Int16Array]",rCe="[object Int32Array]",sCe="[object Float32Array]",oCe="[object Float64Array
204]";function RL(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function aCe(n,e){return sg(n,void 0,n,new Map,e)}function sg(n,e,t,i=new Map,r=void 0){const s=r==null?void 0:r(n,e,t,i);if(s!=null)return s;if(IL(n))return n;if(i.has(n))return i.get(n);if(Array.isArray(n)){const o=new Array(n.length);i.set(n,o);for(let a=0;a<n.length;a++)o[a]=sg(n[a],a,t,i,r);return Object.hasOwn(n,"index")&&(o.index=n.index),Object.hasOwn(n,"input")&&(o.input=n.input),o}if(n instanceof Date)return new Date(n.getTime());if(n instanceof RegExp){const o=new RegExp(n.source,n.flags);return o.lastIndex=n.lastIndex,o}if(n instanceof Map){const o=new Map;i.set(n,o);for(const[a,l]of n)o.set(a,sg(l,a,t,i,r));return o}if(n instanceof Set){const o=new Set;i.set(n,o);for(const a of n)o.add(sg(a,void 0,t,i,r));return o}if(typeof Buffer<"u"&&Buffer.isBuffer(n))return n.subarray();if(RL(n)){const o=new(Object.getPrototypeOf(n)).constructor(n.length);i.set(n,o);for(let a=0;a<n.length;a++)o[a]=sg(n[a],a,t,i,r);return o}if(n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer)return n.slice(0);if(n instanceof DataView){const o=new DataView(n.buffer.slice(0),n.byteOffset,n.byteLength);return i.set(n,o),td(o,n,t,i,r),o}if(typeof File<"u"&&n instanceof File){const o=new File([n],n.name,{type:n.type});return i.set(n,o),td(o,n,t,i,r),o}if(n instanceof Blob){const o=new Blob([n],{type:n.type});return i.set(n,o),td(o,n,t,i,r),o}if(n instanceof Error){const o=new n.constructor;return i.set(n,o),o.message=n.message,o.name=n.name,o.stack=n.stack,o.cause=n.cause,td(o,n,t,i,r),o}if(typeof n=="object"&&lCe(n)){const o=Object.create(Object.getPrototypeOf(n));return i.set(n,o),td(o,n,t,i,r),o}return n}function td(n,e,t=n,i,r){const s=[...Object.keys(e),...CY(e)];for(let o=0;o<s.length;o++){const a=s[o],l=Object.getOwnPropertyDescriptor(n,a);(l==null||l.writable)&&(n[a]=sg(e[a],a,t,i,r))}}function lCe(n){switch(IY(n)){case OY:case KPe:case XPe:case QPe:case DY:case jPe:case sCe:case oCe:case nCe:case iCe:case rCe:case WPe:case NY:case YPe:case $Pe:case qPe:case RY:case GPe:case ZPe:case JPe:case eCe:case tCe:return!0;default:return!1}}function cCe(n,e){return aCe(n,(t,i,r,s)=>{if(typeof n=="object")switch(Object.prototype.toString.call(n)){case NY:case RY:case DY:{const o=new n.constructor(n==null?void 0:n.valueOf());return td(o,n),o}case OY:{const o={};return td(o,n),o.length=n.length,o[Symbol.iterator]=n[Symbol.iterator],o}default:return}})}function jz(n){return cCe(n)}function Wz(n){return n!==null&&typeof n=="object"&&IY(n)==="[object Arguments]"}function qz(n){return typeof n=="object"&&n!==null}function uCe(){}function hCe(n){return RL(n)}function fCe(n){var t;if(typeof n!="object"||n==null)return!1;if(Object.getPrototypeOf(n)===null)return!0;if(Object.prototype.toString.call(n)!=="[object Object]"){const i=n[Symbol.toStringTag];return i==null||!((t=Object.getOwnPropertyDescriptor(n,Symbol.toStringTag))!=null&&t.writable)?!1:n.toString()===`[object ${i}]`}let e=n;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(n)===e}function dCe(n){if(IL(n))return n;if(Array.isArray(n)||RL(n)||n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer)return n.slice(0);const e=Object.getPrototypeOf(n),t=e.constructor;if(n instanceof Date||n instanceof Map||n instanceof Set)return new t(n);if(n instanceof RegExp){const i=new t(n);return i.lastIndex=n.lastIndex,i}if(n instanceof DataView)return new t(n.buffer.slice(0));if(n instanceof Error){const i=new t(n.message);return i.stack=n.stack,i.name=n.name,i.cause=n.cause,i}if(typeof File<"u"&&n instanceof File)return new t([n],n.name,{type:n.type,lastModified:n.lastModified});if(typeof n=="object"){const i=Object.create(e);return Object.assign(i,n)}return n}function pCe(n,...e){const t=e.slice(0,-1),i=e[e.length-1];let r=n;for(let s=0;s<t.length;s++){const o=t[s];r=ZR(r,o,i,new Map)}return r}function ZR(n,e,t,i){if(IL(n)&&(n=Object(n)),e==null||typeof e!="object")return n;if(i.has(e))return dCe(i.get(e));if(i.set(e,n),Array.isArray(e)){e=e.slice();for(let s=0;s<e.length;s++)e[s]=e[s]??void 0}const r=[...Object.keys(e),...CY(e)];for(let s=0;s<r.length;s++){const o=r[s];let a=e[o],l=n[o];if(Wz(a)&&(a={...a}),Wz(l)&&(l={...l}),typeof Buffer<"u"&&Buffer.isBuffer(a)&&(a=jz(a)),Array.isArray(a))if(typeof l=="object"&&l!=null){const u=[],h=Reflect.ownKeys(l);for(let f=0;f<h.length;f++){const m=h[f];u[m]=l[m]}l=u}else l=[];const c=t(l,a,o,n,e,i);c!=null?n[o]=c:Array.isArray(a)||qz(l)&&qz(a)?n[o]=ZR(l,a,t,i):l==null&&fCe(a)?n[o]=ZR({},a,t,i):l==null&&hCe(a)?n[o]=jz(a):(l===void 0||a!==void 0)&&(n[o]=a)}return n}function mCe(n,...e){return pCe(n,...e,uCe)}const Kz="error",gCe="wss://relay.walletconnect.org",yCe="wc",LY="universal_provider",c_=`${yCe}@2:${LY}:`,UY="https://rpc.walletconnect.org/v1/",BY="generic",vCe=`${UY}bundler`,Cg="call_status",wCe=86400,NL={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var xCe=Object.defineProperty,bCe=Object.defineProperties,_Ce=Object.getOwnPropertyDescriptors,Xz=Object.getOwnPropertySymbols,ECe=Object.prototype.hasOwnProperty,SCe
vendor: 14,814 bytes, line 204
204=Object.prototype.propertyIsEnumerable,Yz=(n,e,t)=>e in n?xCe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,u_=(n,e)=>{for(var t in e||(e={}))ECe.call(e,t)&&Yz(n,t,e[t]);if(Xz)for(var t of Xz(e))SCe.call(e,t)&&Yz(n,t,e[t]);return n},ACe=(n,e)=>bCe(n,_Ce(e));function kY(n,e,t){var i;const r=Wc(n);return((i=e.rpcMap)==null?void 0:i[r.reference])||`${UY}?chainId=${r.namespace}:${r.reference}&projectId=${t}`}function MCe(n){return n.includes(":")?n.split(":")[1]:n}function FY(n){return n.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function TCe(n,e){const t=Object.keys(e.namespaces).filter(r=>r.includes(n));if(!t.length)return[];const i=[];return t.forEach(r=>{const s=e.namespaces[r].accounts;i.push(...s)}),i}function Qz(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>{var i,r;return((i=t==null?void 0:t.chains)==null?void 0:i.length)&&((r=t==null?void 0:t.chains)==null?void 0:r.length)>0}))}function h_(n={},e={}){const t=Qz(Zz(n)),i=Qz(Zz(e));return mCe(t,i)}function Zz(n){var e,t,i,r,s;const o={};if(!Bl(n))return o;for(const[a,l]of Object.entries(n)){const c=P2(a)?[a]:l.chains,u=l.methods||[],h=l.events||[],f=l.rpcMap||{},m=rg(a);o[m]=ACe(u_(u_({},o[m]),l),{chains:Ul(c,(e=o[m])==null?void 0:e.chains),methods:Ul(u,(t=o[m])==null?void 0:t.methods),events:Ul(h,(i=o[m])==null?void 0:i.events)}),(Bl(f)||Bl(((r=o[m])==null?void 0:r.rpcMap)||{}))&&(o[m].rpcMap=u_(u_({},f),(s=o[m])==null?void 0:s.rpcMap))}return o}function Jz(n){return n.includes(":")?n.split(":")[2]:n}function eV(n){const e={};for(const[t,i]of Object.entries(n)){const r=i.methods||[],s=i.events||[],o=i.accounts||[],a=P2(t)?[t]:i.chains?i.chains:FY(i.accounts);e[t]={chains:a,methods:r,events:s,accounts:o}}return e}function fC(n){return typeof n=="number"?n:n.includes("0x")?parseInt(n,16):(n=n.includes(":")?n.split(":")[1]:n,isNaN(Number(n))?n:Number(n))}function PCe(n){try{const e=JSON.parse(n);return typeof e=="object"&&e!==null&&!Array.isArray(e)}catch{return!1}}const zY={},Ig=n=>zY[n],dC=(n,e)=>{zY[n]=e};var CCe=Object.defineProperty,tV=Object.getOwnPropertySymbols,ICe=Object.prototype.hasOwnProperty,RCe=Object.prototype.propertyIsEnumerable,nV=(n,e,t)=>e in n?CCe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,iV=(n,e)=>{for(var t in e||(e={}))ICe.call(e,t)&&nV(n,t,e[t]);if(tV)for(var t of tV(e))RCe.call(e,t)&&nV(n,t,e[t]);return n};const rV="eip155",NCe=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],DCe=n=>n&&n.startsWith("0x")?BigInt(n).toString(10):n,pC=n=>n&&n.startsWith("0x")?n:`0x${BigInt(n).toString(16)}`,sV=n=>Object.keys(n).filter(e=>NCe.includes(e)).reduce((e,t)=>(e[t]=OCe(n[t]),e),{}),OCe=n=>typeof n=="string"&&PCe(n)?JSON.parse(n):n,LCe=(n,e,t)=>{const{sessionProperties:i={},scopedProperties:r={}}=n,s={};if(!Bl(r)&&!Bl(i))return;const o=sV(i);for(const a of t){const l=DCe(a);if(!l)continue;s[pC(l)]=o;const c=r==null?void 0:r[`${rV}:${l}`];if(c){const u=c==null?void 0:c[`${rV}:${l}:${e}`];s[pC(l)]=iV(iV({},s[pC(l)]),sV(u||c))}}for(const[a,l]of Object.entries(s))Object.keys(l).length===0&&delete s[a];return Object.keys(s).length>0?s:void 0};var UCe=Object.defineProperty,BCe=(n,e,t)=>e in n?UCe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,kCe=(n,e,t)=>BCe(n,e+"",t);let mC,FCe=class VY{constructor(e){kCe(this,"storage"),this.storage=e}async getItem(e){return await this.storage.getItem(e)}async setItem(e,t){return await this.storage.setItem(e,t)}async removeItem(e){return await this.storage.removeItem(e)}static getStorage(e){return mC||(mC=new VY(e)),mC}};var zCe=Object.defineProperty,VCe=Object.defineProperties,HCe=Object.getOwnPropertyDescriptors,oV=Object.getOwnPropertySymbols,$Ce=Object.prototype.hasOwnProperty,GCe=Object.prototype.propertyIsEnumerable,aV=(n,e,t)=>e in n?zCe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,jCe=(n,e)=>{for(var t in e||(e={}))$Ce.call(e,t)&&aV(n,t,e[t]);if(oV)for(var t of oV(e))GCe.call(e,t)&&aV(n,t,e[t]);return n},WCe=(n,e)=>VCe(n,HCe(e));async function qCe(n,e){const t=Wc(n.result.capabilities.caip345.caip2),i=n.result.capabilities.caip345.transactionHashes,r=await Promise.allSettled(i.map(h=>KCe(t.reference,h,e))),s=r.filter(h=>h.status==="fulfilled").map(h=>h.value).filter(h=>h);r.filter(h=>h.status==="rejected").forEach(h=>console.warn("Failed to fetch transaction receipt:",h.reason));const o=!s.length||s.some(h=>!h),a=s.every(h=>(h==null?void 0:h.status)==="0x1"),l=s.every(h=>(h==null?void 0:h.status)==="0x0"),c=s.some(h=>(h==null?void 0:h.status)==="0x0");let u;return o?u=100:a?u=200:l?u=500:c&&(u=600),{id:n.result.id,version:n.request.version,atomic:n.request.atomicRequired,chainId:n.request.chainId,capabilities:n.result.capabilities,receipts:s,status:u}}async function KCe(n,e,t){return await t(parseInt(n)).request(Da("eth_getTransactionReceipt",[e]))}async function XCe({sendCalls:n,storage:e}){const t=await e.getItem(Cg);await e.setItem(Cg,WCe(jCe({},t),{[n.result.id]:{request:n.request,result:n.result,expiry:xi(wCe)}}))}async function YCe({resultId:n,storage:e}){const t=await e.getItem(Cg);if(t){delete t[n],await e.setItem(Cg,t);for(const i in t)Sl(t[i].expiry)&&delete t[i];await e.setItem(Cg,t)}}async function QCe({resultId:n,storage:e}){const t=await e.getItem(Cg),i=t==null?void 0:t[n];if(i&&!Sl(i.expiry))return i;await YCe({resultId:n,storage:e})}var ZCe=Object.defineProperty,JCe=Object.defineProperties,e3e=Object.getOwnPropertyDescriptors,lV=Object.getOwnPropertySymbols,t3e=Object.prototype.hasOwnProperty,n3e=Object.prototype.propertyIsEnumerable,JR=(n,e,t)=>e in n?ZCe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,gC=(n,e)=>{for(var t in e||(e={}))t3e.call(e,t)&&JR(n,t,e[t]);if(lV)for(var t of lV(e))n3e.call(e,t)&&JR(n,t,e[t]);return n},yC=(n,e)=>JCe(n,e3e(e)),Pf=(n,e,t)=>JR(n,typeof e!="symbol"?e+"":e,t);class i3e{constructor(e){Pf(this,"name","eip155"),Pf(this,"client"),Pf(this,"chainId"),Pf(this,"namespace"),Pf(this,"httpProviders"),Pf(this,"events"),Pf(this,"storage"),this.namespace=e.namespace,this.events=Ig("events"),this.client=Ig("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=FCe.getStorage(this.client.core.storage)}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e);case"wallet_sendCalls":return await this.sendCalls(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t);const i=this.chainId;this.chainId=parseInt(e),this.events.emit(NL.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${e}`,previousCaipChainId:`${this.name}:${i}`})}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||kY(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new TL(new PY(i,Ig("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const r=parseInt(MCe(t));e[r]=this.createHttpProvider(r,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(e){const t=e||this.chainId;return this.httpProviders[t]||(this.httpProviders=yC(gC({},this.httpProviders),{[t]:this.createHttpProvider(t)}),this.httpProviders[t])}async handleSwitchChain(e){var t,i;let r=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";r=r.startsWith("0x")?r:`0x${r}`;const s=parseInt(r,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:r}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,r,s,o;const a=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0],l=((s=(r=e.request)==null?void 0:r.params)==null?void 0:s[1])||[];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const c=this.client.session.get(e.topic),u=((o=c==null?void 0:c.sessionProperties)==null?void 0:o.capabilities)||{},h=`${a}${l.join(",")}`,f=u==null?void 0:u[h];if(f)return f;let m;try{m=LCe(c,a,l)}catch(v){console.warn("Failed to extract capabilities from session",v)}if(m)return m;const g=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:yC(gC({},c.sessionProperties||{}),{capabilities:yC(gC({},u||{}),{[h]:g})})})}catch(v){console.warn("Failed to update session with capabilities",v)}return g}async getCallStatus(e){var t,i,r;const s=this.client.session.get(e.topic),o=(t=s.sessionProperties)==null?void 0:t.bundler_name;if(o){const c=this.getBundlerUrl(e.chainId,o);try{return await this.getUserOperationReceipt(c,e)}catch(u){console.warn("Failed to fetch call status from bundler",u,c)}}const a=(i=s.sessionProperties)==null?void 0:i.bundler_url;if(a)try{return await this.getUserOperationReceipt(a,e)}catch(c){console.warn("Failed to fetch call status from custom bundler",c,a)}const l=await QCe({resultId:(r=e.request.params)==null?void 0:r[0],storage:this.storage});if(l)try{return await qCe(l,this.getHttpProvider.bind(this))}catch(c){console.warn("Failed to fetch call status from stored send calls",c,l)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const r=new URL(e),s=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Da("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,t){return`${vCe}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}async sendCalls(e){var t,i,r;const s=await this.client.request(e),o=(t=e.request.params)==null?void 0:t[0],a=s==null?void 0:s.id,l=(s==null?void 0:s.capabilities)||{},c=(i=l==null?void 0:l.caip345)==null?void 0:i.caip2,u=(r=l==null?void 0:l.caip345)==null?void 0:r.transactionHashes;return!a||!c||!(u!=null&&u.length)||await XCe({sendCalls:{request:o,result:s},storage:this.storage}),s}}var r3e=Object.defineProperty,s3e=(n,e,t)=>e in n?r3e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,am=(n,e,t)=>s3e(n,typeof e!="symbol"?e+"":e,t);class o3e{constructor(e){am(this,"name",BY),am(this,"client"),am(this,"httpProviders"),am(this,"events"),am(this,"namespace"),am(this,"chainId"),this.namespace=e.namespace,this.events=Ig("events"),this.client=Ig("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t);const i=this.chainId;this.chainId=e,this.events.emit(NL.DEFAULT_CHAIN_CHANGED,{currentCaipChainId:`${this.name}:${e}`,previousCaipChainId:`${this.name}:${i}`})}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getNamespaceName(){const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return Wc(e).namespace}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(r=>{var s,o;const a=Wc(r),l=(o=(s=this.namespace)==null?void 0:s.rpcMap)==null?void 0:o[`${a.namespace}:${a.reference}`];i[a.reference]=this.createHttpProvider(r,l)}),i}getHttpProvider(e){const t=Wc(e).reference,i=this.httpProviders[t];if(typeof i>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return i}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||kY(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new TL(new PY(i,Ig("disableProviderPing")))}}var a3e=Object.defineProperty,l3e=Object.defineProperties,c3e=Object.getOwnPropertyDescriptors,cV=Object.getOwnPropertySymbols,u3e=Object.prototype.hasOwnProperty,h3e=Object.prototype.propertyIsEnumerable,eN=(n,e,t)=>e in n?a3e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,nv=(n,e)=>{for(var t in e||(e={}))u3e.call(e,t)&&eN(n,t,e[t]);if(cV)for(var t of cV(e))h3e.call(e,t)&&eN(n,t,e[t]);return n},f_=(n,e)=>l3e(n,c3e(e)),Xs=(n,e,t)=>eN(n,typeof e!="symbol"?e+"":e,t);class DL{constructor(e){Xs(this,"client"),Xs(this,"namespaces"),Xs(this,"optionalNamespaces"),Xs(this,"sessionProperties"),Xs(this,"scopedProperties"),Xs(this,"events",new VO),Xs(this,"rpcProviders",{}),Xs(this,"session"),Xs(this,"providerOpts"),Xs(this,"logger"),Xs(this,"uri"),Xs(this,"disableProviderPing",!1),Xs(this,"connectParam
204s");var t,i;this.providerOpts=e,this.logger=SL({logger:(t=e.logger)!=null?t:Kz,name:(i=this.providerOpts.name)!=null?i:LY}),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new DL(e);return await t.initialize(),t}async request(e,t,i){const[r,s]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(r).request({request:nv({},e),chainId:`${r}:${s}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,r){const s=new Date().getTime();this.request(e,i,r).then(o=>t(null,Zw(s,o))).catch(o=>t(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Dn("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.connectParams=e,this.setNamespaces(e),this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:r}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const s=await r();if(this.session=s.session,this.session){const o=eV(this.session.namespaces);this.namespaces=h_(this.namespaces,o),await this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){var t,i;const{uri:r,approval:s}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties,authentication:(t=this.connectParams)==null?void 0:t.authentication,walletPay:(i=this.connectParams)==null?void 0:i.walletPay});r&&(this.uri=r,this.events.emit("display_uri",r));const o=await s();this.session=o;const a=eV(o.namespaces);return this.namespaces=h_(this.namespaces,a),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,r]=this.validateChain(e);this.getProvider(i).setDefaultChain(r,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){try{this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(!sa(t))return;for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}catch(t){this.logger.warn(t,"Failed to cleanup pending pairings")}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var e,t;if(this.client=this.providerOpts.client||await OPe.init({core:this.providerOpts.core,logger:this.providerOpts.logger||Kz,relayUrl:this.providerOpts.relayUrl||gCe,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(i){throw this.logger.error(i,"Failed to get session"),new Error(`The provided session: ${(t=(e=this.providerOpts)==null?void 0:e.session)==null?void 0:t.topic} doesn't exist in the Sign client`)}else{const i=this.client.session.getAll();this.session=i[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>rg(t)))];dC("client",this.client),dC("events",this.events),dC("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=TCe(t,this.session);if((i==null?void 0:i.length)===0)return;const r=FY(i),s=h_(this.namespaces,this.optionalNamespaces),o=f_(nv({},s[t]),{accounts:i,chains:r});switch(t){case"eip155":this.rpcProviders[t]=new i3e({namespace:o});break;default:this.rpcProviders[t]=new o3e({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{var t;const{topic:i}=e;i===((t=this.session)==null?void 0:t.topic)&&this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{var t;const{params:i,topic:r}=e;if(r!==((t=this.session)==null?void 0:t.topic))return;const{event:s}=i;if(s.name==="accountsChanged"){const o=s.data;o&&sa(o)&&this.events.emit("accountsChanged",o.map(Jz))}else if(s.name==="chainChanged"){const o=i.chainId,a=i.event.data,l=rg(o),c=fC(o)!==fC(a)?`${l}:${fC(a)}`:o;this.onChainChanged({currentCaipChainId:c})}else this.events.emit(s.name,s.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i,r;if(e!==((i=this.session)==null?void 0:i.topic))return;const{namespaces:s}=t,o=(r=this.client)==null?void 0:r.session.get(e);this.session=f_(nv({},o),{namespaces:s}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{var t;
204e.topic===((t=this.session)==null?void 0:t.topic)&&(await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",f_(nv({},Dn("USER_DISCONNECTED")),{data:e.topic})))}),this.on(NL.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(f_(nv({},e),{internal:!0}))})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[BY]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t={},optionalNamespaces:i={},sessionProperties:r,scopedProperties:s}=e;this.optionalNamespaces=h_(t,i),this.sessionProperties=r,this.scopedProperties=s}validateChain(e){const[t,i]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(o=>rg(o)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const r=rg(Object.keys(this.namespaces)[0]),s=this.rpcProviders[r].getDefaultChain();return[r,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}async onChainChanged({currentCaipChainId:e,previousCaipChainId:t,internal:i=!1}){if(!this.namespaces)return;const[r,s]=this.validateChain(e);s&&(this.updateNamespaceChain(r,s),i?(this.events.emit("chainChanged",s),this.emitAccountsChangedOnChainChange({namespace:r,currentCaipChainId:e,previousCaipChainId:t})):this.getProvider(r).setDefaultChain(s),await this.persist("namespaces",this.namespaces))}emitAccountsChangedOnChainChange({namespace:e,currentCaipChainId:t,previousCaipChainId:i}){var r,s;try{if(i===t)return;const o=(s=(r=this.session)==null?void 0:r.namespaces[e])==null?void 0:s.accounts;if(!o)return;const a=o.filter(l=>l.includes(`${t}:`)).map(Jz);if(!sa(a))return;this.events.emit("accountsChanged",a)}catch(o){this.logger.warn(o,"Failed to emit accountsChanged on chain change")}}updateNamespaceChain(e,t){if(!this.namespaces)return;const i=this.namespaces[e]?e:`${e}:${t}`,r={chains:[],methods:[],events:[],defaultChain:t};this.namespaces[i]?this.namespaces[i]&&(this.namespaces[i].defaultChain=t):this.namespaces[i]=r}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.connectParams=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(e,t){var i;const r=((i=this.session)==null?void 0:i.topic)||"";await this.client.core.storage.setItem(`${c_}/${e}${r}`,t)}async getFromStore(e){var t;const i=((t=this.session)==null?void 0:t.topic)||"";return await this.client.core.storage.getItem(`${c_}/${e}${i}`)}async deleteFromStore(e){var t;const i=((t=this.session)==null?void 0:t.topic)||"";await this.client.core.storage.removeItem(`${c_}/${e}${i}`)}async cleanupStorage(){var e;try{if(((e=this.client)==null?void 0:e.session.length)>0)return;const t=await this.client.core.storage.getKeys();for(const i of t)i.startsWith(c_)&&await this.client.core.storage.removeItem(i)}catch(t){this.logger.warn(t,"Failed to cleanup storage")}}}const f3e=DL,d3e="wc",p3e="ethereum_provider",m3e=`${d3e}@2:${p3e}:`,g3e="https://rpc.walletconnect.org/v1/",tN=["eth_sendTransaction","personal_sign"],y3e=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],nN=["chainChanged","accountsChanged"],v3e=["chainChanged","accountsChanged","message","disconnect","connect"],w3e=async()=>{const{createAppKit:n}=await xfe(()=>import("./core-BZ7irhOn.js").then(e=>e.bt),[]);return n};var x3e=Object.defineProperty,b3e=Object.defineProperties,_3e=Object.getOwnPropertyDescriptors,uV=Object.getOwnPropertySymbols,E3e=Object.prototype.hasOwnProperty,S3e=Object.prototype.propertyIsEnumerable,iN=(n,e,t)=>e in n?x3e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Kf=(n,e)=>{for(var t in e||(e={}))E3e.call(e,t)&&iN(n,t,e[t]);if(uV)for(var t of uV(e))S3e.call(e,t)&&iN(n,t,e[t]);return n},iv=(n,e)=>b3e(n,_3e(e)),Ys=(n,e,t)=>iN(n,typeof e!="symbol"?e+"":e,t);function lA(n){return Number(n[0].split(":")[1])}function d_(n){return`0x${n.toString(16)}`}function A3e(n){const{chains:e,optionalChains:t,methods:i,optionalMethods:r,events:s,optionalEvents:o,rpcMap:a}=n;if(!sa(e))throw new Error("Invalid chains");const l={chains:e,methods:i||tN,events:s||nN,rpcMap:Kf({},e.length?{[lA(e)]:a[lA(e)]}:{})},c=s==null?void 0:s.filter(m=>!nN.includes(m)),u=i==null?void 0:i.filter(m=>!tN.includes(m));if(!t&&!o&&!r&&!(c!=null&&c.length)&&!(u!=null&&u.length))return{required:e.length?l:void 0};const h=(c==null?void 0:c.length)&&(u==null?void 0:u.length)||!t,f={chains:[...new Set(h?l.chains.concat(t||[]):t)],methods:[...new Set(l.methods.concat(r!=null&&r.length?r:y3e))],events:[...new Set(l.events.concat(o!=null&&o.length?o:v3e))],rpcMap:a};return{required:e.length?l:void 0,optional:t.length?f:void 0}}let M3e=class HY{constructor(){Ys(this,"events",new _o.EventEmitter),Ys(this,"namespace","eip155"),Ys(this,"accounts",[]),Ys(this,"signer"),Ys(this,"chainId",1),Ys(this,"modal"),Ys(this,"rpc"),Ys(this,"STORAGE_KEY",m3e),Ys(this,"on",(e,t)=>(this.events.on(e,t),this)),Ys(this,"once",(e,t)=>(this.events.once(e,t),this)),Ys(this,"removeListener",(e,t)=>(this.events.removeListener(e,t),this)),Ys(this,"off",(e,t)=>(this.events.off(e,t),this)),Ys(this,"parseAccount",e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e),this.signer={},this.rpc={}}static async init(e){const t=new HY;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){var t;if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:i,optional:r}=A3e(this.rpc);try{const s=await new Promise(async(a,l)=>{var c,u;this.rpc.showQrModal&&((c=this.modal)==null||c.open(),(u=this.modal)==null||u.subscribeState(f=>{!f.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),l(new Error("Connection request reset. Please try again.")))}));const h=e!=null&&e.scopedProperties?{[this.namespace]:e.scopedProperties}:void 0;await this.signer.connect(iv(Kf({namespaces:Kf({},i&&{[this.namespace]:i})},r&&{optionalNamespaces:{[this.namespace]:r}}),{pairingTopic:e==null?void 0:e.pairingTopic,scopedProperties:h})).then(f=>{a(f)}
204).catch(f=>{var m;(m=this.modal)==null||m.showErrorMessage("Unable to connect"),l(new Error(f.message))})});if(!s)return;const o=e6(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:d_(this.chainId)})}catch(s){throw this.signer.logger.error(s),s}finally{(t=this.modal)==null||t.close()}}async authenticate(e,t){var i;if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const r=await new Promise(async(o,a)=>{var l,c;this.rpc.showQrModal&&((l=this.modal)==null||l.open(),(c=this.modal)==null||c.subscribeState(u=>{!u.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(iv(Kf({},e),{chains:this.rpc.chains}),t).then(u=>{o(u)}).catch(u=>{var h;(h=this.modal)==null||h.showErrorMessage("Unable to connect"),a(new Error(u.message))})}),s=r.session;if(s){const o=e6(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:o),this.setAccounts(o),this.events.emit("connect",{chainId:d_(this.chainId)})}return r}catch(r){throw this.signer.logger.error(r),r}finally{(i=this.modal)==null||i.close()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("accountsChanged",e=>{this.accounts=this.parseAccounts(e),this.events.emit("accountsChanged",this.accounts)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",d_(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",iv(Kf({},Dn("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",d_(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,r]=e.split(":");return{chainId:`${t}:${i}`,address:r}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const r=(t=e==null?void 0:e.chains)!=null?t:[],s=(i=e==null?void 0:e.optionalChains)!=null?i:[],o=r.concat(s);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const a=r.length?(e==null?void 0:e.methods)||tN:[],l=r.length?(e==null?void 0:e.events)||nN:[],c=(e==null?void 0:e.optionalMethods)||[],u=(e==null?void 0:e.optionalEvents)||[],h=(e==null?void 0:e.rpcMap)||this.buildRpcMap(o,e.projectId),f=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:r==null?void 0:r.map(m=>this.formatChainId(m)),optionalChains:s.map(m=>this.formatChainId(m)),methods:a,events:l,optionalMethods:c,optionalEvents:u,rpcMap:h,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:f,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(r=>{i[r]=this.getRpcUrl(r,t)}),i}async initialize(e){var t;if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?lA(this.rpc.chains):lA(this.rpc.optionalChains),this.signer=await f3e.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storage:e.storage,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled,logger:e.logger}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let i;try{const r=await w3e(),{convertWCMToAppKitOptions:s}=await Promise.resolve().then(function(){return U3e}),o=s(iv(Kf({},this.rpc.qrModalOptions),{chains:[...new Set([...this.rpc.chains,...this.rpc.optionalChains])],metadata:this.rpc.metadata,projectId:this.rpc.projectId}));if(!o.networks.length)throw new Error("No networks found for WalletConnect");i=r(iv(Kf({},o),{universalProvider:this.signer,manualWCControl:!0,enableMobileFullScreen:((t=this.rpc.qrModalOptions)==null?void 0:t.enableMobileFullScreen)===!0}))}catch(r){throw console.warn(r),new Error("To use QR modal, please install @reown/appkit package")}if(i)try{this.modal=i}catch(r){throw this.signer.logger.error(r),new Error("Could not generate WalletConnectMod
204al Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:r}=e;t&&sa(t)&&(this.rpc.chains=t.map(s=>this.formatChainId(s)),t.forEach(s=>{this.rpc.rpcMap[s]=(r==null?void 0:r[s])||this.getRpcUrl(s)})),i&&sa(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(s=>this.formatChainId(s)),i.forEach(s=>{this.rpc.rpcMap[s]=(r==null?void 0:r[s])||this.getRpcUrl(s)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${g3e}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}};var T3e=Object.defineProperty,P3e=Object.defineProperties,C3e=Object.getOwnPropertyDescriptors,hV=Object.getOwnPropertySymbols,I3e=Object.prototype.hasOwnProperty,R3e=Object.prototype.propertyIsEnumerable,fV=(n,e,t)=>e in n?T3e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,$Y=(n,e)=>{for(var t in e||(e={}))I3e.call(e,t)&&fV(n,t,e[t]);if(hV)for(var t of hV(e))R3e.call(e,t)&&fV(n,t,e[t]);return n},N3e=(n,e)=>P3e(n,C3e(e));function D3e(n){if(n)return{"--w3m-font-family":n["--wcm-font-family"],"--w3m-accent":n["--wcm-accent-color"],"--w3m-color-mix":n["--wcm-background-color"],"--w3m-z-index":n["--wcm-z-index"]?Number(n["--wcm-z-index"]):void 0,"--w3m-qr-color":n["--wcm-accent-color"],"--w3m-font-size-master":n["--wcm-text-medium-regular-size"],"--w3m-border-radius-master":n["--wcm-container-border-radius"],"--w3m-color-mix-strength":0}}const O3e=n=>{const[e,t]=n.split(":");return GY({id:t,caipNetworkId:n,chainNamespace:e,name:"",nativeCurrency:{name:"",symbol:"",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}})};function L3e(n){var e,t,i,r,s,o,a;const l=(e=n.chains)==null?void 0:e.map(O3e).filter(Boolean);if(l.length===0)throw new Error("At least one chain must be specified");const c=l.find(h=>{var f;return h.id===((f=n.defaultChain)==null?void 0:f.id)}),u={projectId:n.projectId,networks:l,themeMode:n.themeMode,themeVariables:D3e(n.themeVariables),chainImages:n.chainImages,connectorImages:n.walletImages,defaultNetwork:c,metadata:N3e($Y({},n.metadata),{name:((t=n.metadata)==null?void 0:t.name)||"WalletConnect",description:((i=n.metadata)==null?void 0:i.description)||"Connect to WalletConnect-compatible wallets",url:((r=n.metadata)==null?void 0:r.url)||"https://walletconnect.org",icons:((s=n.metadata)==null?void 0:s.icons)||["https://walletconnect.org/walletconnect-logo.png"]}),showWallets:!0,featuredWalletIds:n.explorerRecommendedWalletIds==="NONE"?[]:Array.isArray(n.explorerRecommendedWalletIds)?n.explorerRecommendedWalletIds:[],excludeWalletIds:n.explorerExcludedWalletIds==="ALL"?[]:Array.isArray(n.explorerExcludedWalletIds)?n.explorerExcludedWalletIds:[],enableEIP6963:!1,enableInjected:!1,enableCoinbase:!0,enableWalletConnect:!0,features:{email:!1,socials:!1}};if((o=n.mobileWallets)!=null&&o.length||(a=n.desktopWallets)!=null&&a.length){const h=[...(n.mobileWallets||[]).map(g=>({id:g.id,name:g.name,links:g.links})),...(n.desktopWallets||[]).map(g=>({id:g.id,name:g.name,links:{native:g.links.native,universal:g.links.universal}}))],f=[...u.featuredWalletIds||[],...u.excludeWalletIds||[]],m=h.filter(g=>!f.includes(g.id));m.length&&(u.customWallets=m)}return u}function GY(n){return $Y({formatters:void 0,fees:void 0,serializers:void 0},n)}var U3e=Object.freeze({__proto__:null,convertWCMToAppKitOptions:L3e,defineChain:GY});
204const rv={chainId:"0x279F",chainName:"Monad Testnet",nativeCurrency:{name:"MON",symbol:"MON",decimals:18},rpcUrls:["https://testnet-rpc.monad.xyz/"],blockExplorerUrls:["https://testnet.monadexplorer.com/"]};class B3e{constructor(){this.state={isConnected:!1,address:null,provider:null,chainId:null,walletType:null},this.listeners=[],this.wcProvider=null}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}notify(){this.listeners.forEach(e=>e(this.state))}async connectWallet(e="metamask"){try{e==="walletconnect"?await this.connectWalletConnect():await this.connectMetaMask()}catch(t){throw t.code===4001?new Error("Connection rejected. Please approve the connection in your wallet."):t}}async connectMetaMask(){if(!window.ethereum)throw new Error("No wallet found. Please install MetaMask or another Web3 wallet.");const e=await window.ethereum.request({method:"eth_requestAccounts"});if(!e||e.length===0)throw new Error("No accounts available. Please unlock MetaMask and try again.");const t=new dc(window.ethereum);let i;try{i=await t.getSigner()}catch{throw new Error("MetaMask is locked. Please unlock it and try again.")}const r=await i.getAddress();if(r.toLowerCase()!==e[0].toLowerCase())throw new Error("Account mismatch. Please unlock MetaMask with the correct account.");let s=await t.getNetwork();if(Number(s.chainId)!==10143){await this.switchToMonadTestnet();const o=new dc(window.ethereum);s=await o.getNetwork(),this.state={isConnected:!0,address:r,provider:o,chainId:Number(s.chainId),walletType:"metamask"}}else this.state={isConnected:!0,address:r,provider:t,chainId:Number(s.chainId),walletType:"metamask"};this.notify()}async connectWalletConnect(){this.wcProvider=await M3e.init({projectId:"3314f39613059cb687432d249f1658d2",chains:[10143],showQrModal:!0,qrModalOptions:{themeMode:"dark",themeVariables:{"--wcm-z-index":"9999"}},optionalChains:[1,137,56],rpcMap:{10143:"https://testnet-rpc.monad.xyz/"},metadata:{name:"Stellar Void",description:"Space combat game on Monad",url:window.location.origin,icons:["https://stellar-void.com/icon.png"]}}),await this.wcProvider.enable();const e=new dc(this.wcProvider),i=await(await e.getSigner()).getAddress();let r=await e.getNetwork();if(Number(r.chainId)!==10143)try{await this.wcProvider.request({method:"wallet_addEthereumChain",params:[rv]}),await this.wcProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:rv.chainId}]});const s=new dc(this.wcProvider);r=await s.getNetwork(),this.state={isConnected:!0,address:i,provider:s,chainId:Number(r.chainId),walletType:"walletconnect"}}catch(s){console.log("Failed to add/switch to Monad Testnet on mobile:",s),this.state={isConnected:!0,address:i,provider:e,chainId:Number(r.chainId),walletType:"walletconnect"}}else this.state={isConnected:!0,address:i,provider:e,chainId:Number(r.chainId),walletType:"walletconnect"};this.wcProvider.on("accountsChanged",s=>{s.length===0?this.disconnectWallet():this.state.isConnected&&(this.state.address=s[0],this.notify())}),this.wcProvider.on("chainChanged",s=>{this.state.isConnected&&(this.state.chainId=s,this.notify())}),this.wcProvider.on("disconnect",()=>{this.disconnectWallet()}),this.notify()}async switchToMonadTestnet(){const e=this.state.walletType==="walletconnect"?this.wcProvider:window.ethereum;if(!e)throw new Error("No wallet found");try{if(await e.request({method:"wallet_switchEthereumChain",params:[{chainId:rv.chainId}]}),this.state.walletType==="walletconnect"&&this.wcProvider){const t=new dc(this.wcProvider),i=await t.getNetwork();this.state.chainId=Number(i.chainId),this.state.provider=t,this.notify()}}catch(t){if(t.code===4902){if(await e.request({method:"wallet_addEthereumChain",params:[rv]}),this.state.walletType==="walletconnect"&&this.wcProvider){const i=new dc(this.wcProvider),r=await i.getNetwork();this.state.chainId=Number(r.chainId),this.state.provider=i,this.notify()}}else throw t.code===4001?new Error("Please switch to Monad Testnet to continue."):new Error("Failed to switch to Monad Testnet. Please switch manually.")}}async addMonadTestnet(){try{const e=this.state.walletType==="walletconnect"?this.wcProvider:window.ethereum;if(!e)throw new Error("No wallet found");if(await e.request({method:"wallet_addEthereumChain",params:[rv]}
204),this.state.walletType==="walletconnect"&&this.wcProvider){const t=new dc(this.wcProvider),i=await t.getNetwork();this.state.chainId=Number(i.chainId),this.state.provider=t,this.notify()}}catch(e){throw console.error("Failed to add Monad Testnet:",e),e}}async disconnectWallet(){if(this.state.walletType==="walletconnect"&&this.wcProvider){try{await this.wcProvider.disconnect()}catch(e){console.log("WalletConnect disconnect failed:",e)}this.wcProvider=null}else if(window.ethereum&&this.state.isConnected)try{await window.ethereum.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]})}catch(e){console.log("Permission revocation not supported or failed:",e)}this.state={isConnected:!1,address:null,provider:null,chainId:null,walletType:null},this.notify()}getState(){return{...this.state}}async initialize(){try{if(!window.ethereum)return;window.ethereum.on("accountsChanged",e=>{e.length===0?this.disconnectWallet():this.state.isConnected&&(this.state.address=e[0],this.notify())}),window.ethereum.on("chainChanged",e=>{this.state.isConnected&&(this.state.chainId=parseInt(e,16),this.notify())}),window.ethereum.on("disconnect",()=>{this.disconnectWallet()})}catch(e){console.error("Failed to initialize wallet:",e)}}}const Cf=new B3e;function k3e(){const[n,e]=fe.useState(Cf.getState()),[t,i]=fe.useState(!1),[r,s]=fe.useState(null);fe.useEffect(()=>(Cf.initialize(),Cf.subscribe(e)),[]);const o=async(f="metamask")=>{i(!0),s(null);try{await Cf.connectWallet(f)}catch(m){s(m.message||"Failed to connect wallet")}finally{i(!1)}},a=async()=>{try{await Cf.disconnectWallet(),s(null)}catch(f){s(f.message||"Failed to disconnect wallet")}},l=async()=>{try{await Cf.addMonadTestnet(),s(null)}catch(f){s(f.message||"Failed to add Monad Testnet")}},c=async()=>{try{await Cf.switchToMonadTestnet(),s(null)}catch(f){s(f.message||"Failed to switch to Monad Testnet")}},u=f=>`${f.slice(0,6)}...${f.slice(-4)}`,h=n.chainId===10143;return{...n,isConnecting:t,error:r,connectWallet:o,disconnectWallet:a,addMonadTestnet:l,switchToMonadTestnet:c,formatAddress:u,isOnMonadTestnet:h}}function cA({className:n=""}){const{isConnected:e,address:t,isConnecting:i,error:r,connectWallet:s,disconnectWallet:o,addMonadTestnet:a,switchToMonadTestnet:l,formatAddress:c,isOnMonadTestnet:u}=k3e(),[h,f]=fe.useState(!1),[m,g]=fe.useState(!1),v=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),w=async()=>{e?f(!0):g(!0)},y=async S=>{g(!1),await s(S)},_=async()=>{await a(),f(!1)},x=async()=>{await l(),f(!1)};return j.jsxs(j.Fragment,{children:[j.jsxs(un.button,{onClick:w,disabled:i,className:`${n} flex items-center gap-2 transition-all duration-300`,whileHover:{scale:i?1:1.05},whileTap:{scale:i?1:.95},children:[j.jsx(Db,{className:"w-5 h-5"}),i?"CONNECTING...":e?j.jsxs(j.Fragment,{children:[c(t),!u&&j.jsx(eP,{className:"w-4 h-4 text-yellow-500"}),u&&j.jsx(IF,{className:"w-4 h-4 text-green-500"})]}):"CONNECT WALLET"]}),m&&j.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:j.jsxs(un.div,{initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},className:"bg-gray-900 border border-red-600/30 rounded-lg p-6 max-w-md w-full",children:[j.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[j.jsx(Db,{className:"w-6 h-6 text-red-600"}),j.jsx("h3",{className:"text-xl font-bold",children:"Connect Wallet"})]}),j.jsxs("div",{className:"space-y-3",children:[!v&&window.ethereum&&j.jsx("button",{onClick:()=>y("metamask"),className:"w-full bg-gradient-to-r from-orange-500 to-red-600 hover:from-orange-600 hover:to-red-700 text-white font-semibold py-4 px-6 rounded-lg transition-all duration-300 flex items-center justify-between",children:j.jsxs("div",{className:"flex items-center gap-3",children:[j.jsx(Db,{className:"w-6 h-6"}),j.jsxs("div",{className:"text-left",children:[j.jsx("div",{className:"font-bold",children:"MetaMask"}),j.jsx("div",{className:"text-xs opacity-80",children:"Desktop browser extension"})]})]})}),j.jsx("button",{onClick:()=>y("walletconnect"),className:"w-full bg-gradient-to-r from-blue-500 to-blue-700 hover:from-blue-600 hover:to-blue-800 text-white font-semibold py-4 px-6 rounded-lg transition-all duration-300 flex items-center justify-between",children:j.jsxs("div",{className:"flex items-center gap-3",children:[j.jsx(Rae,{className:"w-6 h-6"}),j.jsxs("div",{className:"text-left",children:[j.jsx("div",{className:"font-bold",children:"WalletConnect"}),j.jsx("div",{className:"text-xs opacity-80",children:"Mobile wallets & more"})]})]})}),j.jsx("div",{className:"bg-blue-900/20 border border-blue-600/30 p-4 rounded-lg mt-4",children:j.jsx("p",{className:"text-sm text-gray-300",children:v?"Use WalletConnect to connect your mobile wallet (Trust Wallet, Rainbow, MetaMask Mobile, etc.)":"Choose MetaMask for desktop or WalletConnect for mobile wallets"})})]}),j.jsx("button",{onClick:()=>g(!1),className:"w-full mt-4 button-secondary px-4 py-2 rounded font-semibold",children:"Cancel"})]})}),h&&j.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4",children:j.jsxs(un.div,{initial:{opacity:0,scale:.9}
204,animate:{opacity:1,scale:1},className:"bg-gray-900 border border-red-600/30 rounded-lg p-6 max-w-md w-full",children:[j.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[j.jsx(Db,{className:"w-6 h-6 text-red-600"}),j.jsx("h3",{className:"text-xl font-bold",children:"Wallet Connected"})]}),j.jsxs("div",{className:"space-y-4",children:[j.jsxs("div",{className:"bg-black/50 p-4 rounded-lg",children:[j.jsx("p",{className:"text-sm text-gray-400 mb-1",children:"Connected Address:"}),j.jsx("p",{className:"font-mono text-sm",children:t})]}),!u&&j.jsxs("div",{className:"bg-yellow-900/20 border border-yellow-600/30 p-4 rounded-lg",children:[j.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[j.jsx(eP,{className:"w-5 h-5 text-yellow-500"}),j.jsx("p",{className:"font-semibold text-yellow-400",children:"Wrong Network"})]}),j.jsx("p",{className:"text-sm text-gray-300 mb-3",children:"You're not connected to Monad Testnet. Switch or add the network to continue."}),j.jsxs("div",{className:"flex gap-2",children:[j.jsx("button",{onClick:x,className:"button-primary px-4 py-2 rounded text-sm font-semibold",children:"Switch Network"}),j.jsx("button",{onClick:_,className:"button-secondary px-4 py-2 rounded text-sm font-semibold",children:"Add Network"})]})]}),u&&j.jsxs("div",{className:"bg-green-900/20 border border-green-600/30 p-4 rounded-lg",children:[j.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[j.jsx(IF,{className:"w-5 h-5 text-green-500"}),j.jsx("p",{className:"font-semibold text-green-400",children:"Connected to Monad Testnet"})]}),j.jsx("p",{className:"text-sm text-gray-300",children:"You're ready to participate in Stellar Void battles!"})]}),j.jsxs("div",{className:"bg-blue-900/20 border border-blue-600/30 p-4 rounded-lg",children:[j.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[j.jsx(bae,{className:"w-4 h-4 text-blue-400"}),j.jsx("p",{className:"font-semibold text-blue-400",children:"Need Testnet Tokens?"})]}),j.jsx("p",{className:"text-sm text-gray-300 mb-2",children:"Get free MON tokens from the Monad faucet to start playing."}),j.jsx("a",{href:"https://faucet.monad.xyz",target:"_blank",rel:"noopener noreferrer",className:"text-blue-400 hover:text-blue-300 text-sm underline",children:"Visit Monad Faucet →"})]}),j.jsxs("div",{className:"flex gap-3 pt-4",children:[j.jsx("button",{onClick:()=>f(!1),className:"button-secondary px-4 py-2 rounded font-semibold flex-1",children:"Close"}),j.jsx("button",{onClick:()=>{o(),f(!1)},className:"bg-red-600/20 hover:bg-red-600/40 border border-red-600/50 px-4 py-2 rounded font-semibold flex-1 transition-colors",children:"Disconnect"})]})]})]})}),r&&j.jsxs("div",{className:"fixed bottom-4 right-4 bg-red-900/90 border border-red-600 p-4 rounded-lg max-w-sm z-50",children:[j.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[j.jsx(eP,{className:"w-5 h-5 text-red-400"}),j.jsx("p",{className:"font-semibold text-red-400",children:"Wallet Error"})]}),j.jsx("p",{className:"text-sm text-gray-300",children:r})]})]})}const p_=[{title:"Stellar Void OST",src:"/Stellar Void_SV_OST.mp3"},{title:"Airlock Sequence",src:"/Airlock Sequence_SV OST.mp3"}];function F3e(){const[n,e]=fe.useState(!1),[t,i]=fe.useState(!1),[r,s]=fe.useState(0),[o,a]=fe.useState(0),[l,c]=fe.useState(0),[u,h]=fe.useState(!1),f=fe.useRef(null),m=fe.useRef(!1);fe.useEffect(()=>{if(!f.current||m.current)return;m.current=!0,f.current.volume=.5,f.current.load(),(async()=>{var D;try{await((D=f.current)==null?void 0:D.play()),e(!0)}catch{console.log("Autoplay prevented, waiting for user interaction");const C=async()=>{var U;try{await((U=f.current)==null?void 0:U.play()),e(!0),document.removeEventListener("click",C),document.removeEventListener("touchstart",C)}catch(G){console.log("Playback failed after interaction:",G)}};document.addEventListener("click",C),document.addEventListener("touchstart",C)}})();const S=f.current,M=()=>{S&&a(S.currentTime)},A=()=>{S&&c(S.duration)},I=()=>{y()};return S.addEventListener("timeupdate",M),S.addEventListener("durationchange",A),S.addEventListener("ended",I),()=>{S.removeEventListener("timeupdate",M),S.removeEventListener("durationchange",A),S.removeEventListener("ended",I)}},[]),fe.useEffect(()=>{if(!f.current)return;const x=f.current;x.src=p_[r].src,x.load(),n&&x.play().catch(S=>{console.log("Error playing new track:",S),e(!1)})},[r]);const g=x=>{const S=Math.floor(x/60),M=Math.floor(x%60);return`${S}:${M.toString().padStart(2,"0")}`},v=async()=>
204{if(f.current)try{n?f.current.pause():await f.current.play(),e(!n)}catch(x){console.log("Error toggling playback:",x)}},w=()=>{f.current&&(f.current.muted=!t,i(!t))},y=()=>{s(x=>(x+1)%p_.length)},_=()=>{h(!u)};return j.jsx("nav",{className:"fixed w-full z-50 bg-black py-2",children:j.jsxs("div",{className:"container mx-auto px-4",children:[j.jsxs("div",{className:"flex justify-between items-center",children:[j.jsxs("div",{className:"flex items-center gap-4 lg:gap-8",children:[j.jsx(un.img,{src:"/StellarVoid_header_logo.png",alt:"Stellar Void",className:"h-8 w-auto",animate:{opacity:[.7,1,.7]},transition:{duration:2,ease:"easeInOut",repeat:1/0}}),j.jsxs("div",{className:"hidden sm:flex items-center gap-2 bg-red-900/20 px-4 py-2 rounded-lg",children:[j.jsx("audio",{ref:f,src:p_[r].src,preload:"auto"}),j.jsx(un.button,{onClick:v,whileHover:{scale:1.1},whileTap:{scale:.9},className:"text-white hover:text-red-500 transition-colors",children:n?j.jsx(Aae,{size:20}):j.jsx(Mae,{size:20})}),j.jsx(un.button,{onClick:y,whileHover:{scale:1.1},whileTap:{scale:.9},className:"text-white hover:text-red-500 transition-colors",children:j.jsx(Iae,{size:20})}),j.jsx(un.button,{onClick:w,whileHover:{scale:1.1},whileTap:{scale:.9},className:"text-white hover:text-red-500 transition-colors",children:t?j.jsx(Lae,{size:20}):j.jsx(Oae,{size:20})}),j.jsxs("div",{className:"flex flex-col",children:[j.jsx("span",{className:"text-sm text-white/70 hidden lg:block",children:p_[r].title}),j.jsxs("span",{className:"text-xs text-white/50 hidden lg:block",children:[g(o)," / ",g(l)]})]})]})]}),j.jsx("button",{onClick:_,className:"lg:hidden text-white hover:text-red-500 transition-colors",children:u?j.jsx(Uae,{size:24}):j.jsx(Sae,{size:24})}),j.jsxs("div",{className:"hidden lg:flex items-center space-x-8",children:[j.jsx("a",{href:"#features",className:"nav-link",children:"FEATURES"}),j.jsx("a",{href:"#gameplay",className:"nav-link",children:"GAMEPLAY"}),j.jsx("a",{href:"#roadmap",className:"nav-link",children:"ROADMAP"}),j.jsx(cA,{className:"button-primary px-6 py-2 rounded-md font-bold"})]})]}),j.jsx(un.div,{initial:!1,animate:{height:u?"auto":0,opacity:u?1:0},className:`lg:hidden overflow-hidden ${u?"mt-4":""}`,children:j.jsxs("div",{className:"flex flex-col space-y-4 py-4",children:[j.jsx("a",{href:"#features",className:"nav-link",onClick:_,children:"FEATURES"}),j.jsx("a",{href:"#gameplay",className:"nav-link",onClick:_,children:"GAMEPLAY"}),j.jsx("a",{href:"#roadmap",className:"nav-link",onClick:_,children:"ROADMAP"}),j.jsx(cA,{className:"button-primary px-6 py-2 rounded-md font-bold w-full text-center"})]})})]})})}function z3e(){return j.jsxs("section",{className:"hero-section flex items-center relative overflow-hidden",children:[j.jsx("video",{src:"/images/screenshots/Stallar-Void-Front-Page-Demo.MP4",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,className:"absolute inset-0 w-full h-full object-cover opacity-30",style:{zIndex:0}}),j.jsx("div",{className:"container mx-auto py-24 md:py-32 relative z-10",children:j.jsxs(un.div,{initial:{opacity:0,x:-50},animate:{opacity:1,x:0},transition:{duration:.8},className:"max-w-2xl relative z-20",children:[j.jsx("h1",{className:"font-bold mb-2 sm:mb-4 red-glow-text text-balance",children:"MASTER THE VOID"}),j.jsx("h2",{className:"font-bold mb-4 sm:mb-6 text-balance",children:"CLAIM YOUR FORTUNE"}),j.jsx("p",{className:"text-lg sm:text-xl mb-6 sm:mb-8 opacity-90 max-w-lg text-balance",children:"Intense 10-player space dogfights where skill means survival and profit. Stake your assets. Outmaneuver opponents. Secure instant blockchain payouts."}),j.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[j.jsx(cA,{className:"button-primary px-6 sm:px-8 py-3 rounded-md font-bold text-lg text-center"}),j.jsx(un.a,{href:"#gameplay",className:"button-secondary px-6 sm:px-8 py-3 rounded-md font-bold text-lg text-center",whileHover:{scale:1.05},whileTap:{scale:.95},children:"LEARN MORE"})]}),j.jsxs(un.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{duration:.8,delay:.4},className:"flex items-center gap-3 mt-8 justify-center sm:justify-start",children:[j.jsx("span",{className:"text-gray-400 text-sm font-medium",children:"POWERED BY"}),j.jsx("img",{src:"/images/logos/monad.svg",alt:"Monad",className:"h-6 w-auto opacity-80 hover:opacity-100 transition-opacity"})]})]})})]})}function V3e(){return j.jsx("section",{className:"py-16 bg-black bg-opacity-70",children:j.jsx("div",{className:"container mx-auto px-4",children:j.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[j.jsxs("div",{className:"stat-card p-8 rounded-lg text-center",children:[j.jsx("div",{className:"text-4xl font-bold text-red-600 mb-2",children:"$96B+"}),j.jsx("div",{className:"text-lg opacity-90",children:"Global PC Gaming Market"})]}),j.jsxs("div",{className:"stat-card p-8 rounded-lg text-center",children:[j.jsx("div",{className:"text-4xl font-bold text-red-600 mb-2",children:"21.8%"}),j.jsx("div",{className:"text-lg opacity-90",children:"Blockchain Gaming CAGR"})]}),j.jsxs("div",{className:"stat-card p-8 rounded-lg text-center",children:[j.jsx("div",{className:"text-4xl font-bold text-red-600 mb-2",children:"18.5%"}),j.jsx("div",{className:"text-lg opacity-90",children:"Esports Wagering Growth"})]})]})})})}var rN=new Map,m_=new WeakMap,dV=0,H3e=void 0;function $3e(n){return n?(m_.has(n)||(dV+=1,m_.set(n,dV.toString())),m_.get(n)):"0"}function G3e(n){return Object.keys(n).sort().filter(e=>n[e]!==void 0).map(e=>`${e}_${e==="root"?$3e(n.root):n[e]}`).toString()}function j3e(n){const e=G3e(n);let t=rN.get(e);if(!t){const i=new Map;let r;const s=new IntersectionObserver(o=>{o.forEach(a=>{var l;const c=a.isIntersecting&&r.some(u=>a.intersectionRatio>=u);n.trackVisibility&&typeof a.isVisible>"u"&&(a.isVisible=c),(l=i.get(a.target))==null||l.forEach(u=>{u(c,a)})})},n);r=s.thresholds||(Array.isArray(n.threshold)?n.threshold:[n.threshold||0]),t={id:e,observer:s,elements:i},rN.set(e,t)}return t}function W3e(n,e,t={},i=H3e){if(typeof window.IntersectionObserver>"u"&&i!==void 0){const l=n.getBoundingClientRect();return e(i,{isIntersecting:i,target:n,intersectionRatio:typeof t.threshold=="number"?t.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:r,observer:s,elements:o}=j3e(t),a=o.get(n)||[];return o.has(n)||o.set(n,a),a.push(e),s.observe(n),function(){a.splice(a.indexOf(e),1),a.length===0&&(o.delete(n),s.unobserve(n)),o.size===0&&(s.disconnect(),rN.delete(r))}}function af({threshold:n,delay:e,trackVisibility:t,rootMargin:i,root:r,triggerOnce:s,skip:o,initialInView:a,fallbackInView:l,onChange:c}={}){var u;const[h,f]=fe.useState(null),m=fe.useRef(c),[g,v]=fe.useState({inView:!!a,entry:void 0});m.current=c,fe.useEffect(()=>{if(o||!h)return;let x;return x=W3e(h,(S,M)=>{v({inView:S,entry:M}),m.current&&m.current(S,M),M.isIntersecting&&s&&x&&(x(),x=void 0)},{root:r,rootMargin:i,threshold:n,trackVisibility:t,delay:e},l),()=>{x&&x()}},[Array.isArray(n)?n.toString():n,h,r,i,s,o,t,l,e]);const w=(u=g.entry)==null?void 0:u.target,y=fe.useRef(void 0);!h&&w&&!s&&!o&&y.current!==w&&(y.current=w,v({inView:!!a,entry:void 0}));const _=[f,g.inView,g.entry];return _.ref=_[0],_.inView=_[1],_.entry=_[2],_}function g_({icon:n,title:e,description:t,delay:i}){const[r,s]=af({triggerOnce:!0,threshold:.2});return j.jsxs(un.div,{ref:r,initial:{opacity:0,y:20},animate:s?{opacity:1,y:0}:{opacity:0,y:20},transition:{duration:.8,delay:i},className:"feature-card p-6 rounded-lg",children:[j.jsx("div",{className:"text-red-600 mb-4 flex justify-center",children:n}),j.jsx("h3",{className:"text-xl font-bold text-white mb-2",children:e}),j.jsx("p",{className:"text-gray-400",children:t})]})}function q3e(){const[n,e]=af({triggerOnce:!0,threshold:.1});return j.jsx("section",{id:"features",className:"py-20",children:j.jsxs("div",{className:"container mx-auto px-4",children:[j.jsxs(un.h2,{ref:n,initial:{opacity:0,y:20},animate:e?{opacity:1,y:0}:{opacity:0,y:20},transition:{duration:.8},className:"text-4xl font-bold mb-16 text-center",children:["DEFY ",j.jsx("span",{className:"text-red-600",children:"GRAVITY"}),". DEFINE YOUR"," ",j.jsx("span",{className:"text-red-600",children:"DESTINY"}),"."]}),j.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-8",children:[j.jsx(g_,{icon:j.jsx(Tae,{className:"w-8 h-8"}),title:"AAA SPACE COMBAT",description:"Experience breathtaking visuals and precise controls in immer
204sive, zero-gravity battlefields. This isn't just another blockchain game—it's a premium combat simulator with real stakes.",delay:.2}),j.jsx(g_,{icon:j.jsx(Nae,{className:"w-8 h-8"}),title:"SKILL-BASED WAGERING",description:"Your skill determines your earnings. No pay-to-win mechanics—just pure dogfighting expertise. Outmaneuver, outgun, and outlast your opponents to claim their stakes.",delay:.4}),j.jsx(g_,{icon:j.jsx(Cae,{className:"w-8 h-8"}),title:"SOLANA-POWERED SECURITY",description:"Every match secured by Solana's lightning-fast blockchain. Smart contracts guarantee immediate, tamper-proof prize distribution to winners with minimal fees.",delay:.6}),j.jsx(g_,{icon:j.jsx(xae,{className:"w-8 h-8"}),title:"ACCESSIBLE ENTRY POINTS",description:"Start wagering from just $1 per match. As your skills improve, progress to higher-stakes arenas with bigger prizes. Free practice mode available to hone your combat tactics.",delay:.8})]})]})})}function vC({phase:n,title:e,items:t,delay:i}){const[r,s]=af({triggerOnce:!0,threshold:.2});return j.jsxs(un.div,{ref:r,initial:{opacity:0,y:20},animate:s?{opacity:1,y:0}:{opacity:0,y:20},transition:{duration:.8,delay:i},className:"game-detail p-6 rounded-lg md:mt-16",children:[j.jsxs("div",{className:"text-red-600 text-xl font-bold mb-4",children:[n,". ",e]}),j.jsx("ul",{className:"space-y-4 opacity-90",children:t.map((o,a)=>j.jsxs("li",{children:["• ",o]},a))})]})}function K3e(){const[n,e]=af({triggerOnce:!0,threshold:.1});return j.jsxs("section",{id:"gameplay",className:"py-20 bg-black bg-opacity-70",children:[j.jsxs("div",{className:"container mx-auto px-4",children:[j.jsxs(un.h2,{ref:n,initial:{opacity:0,y:20},animate:e?{opacity:1,y:0}:{opacity:0,y:20},transition:{duration:.8},className:"text-4xl font-bold mb-16 text-center",children:["BATTLE. ",j.jsx("span",{className:"text-red-600",children:"WAGER"}),". DOMINATE."]}),j.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-y-16 md:gap-x-8",children:[j.jsx(vC,{phase:"01",title:"PRE-MATCH",items:["Secure multi-layered authentication","OTP verification for each wager","Mobile app wallet integration","Biometric verification for all transactions"],delay:.2}),j.jsx(vC,{phase:"02",title:"MATCH PHASE",items:["10 players enter the arena","Assets secured in smart contract escrow","10-minute intense combat rounds","Victory by survival or highest kills","Multi-tiered tiebreaker system"],delay:.4}),j.jsx(vC,{phase:"03",title:"DISTRIBUTION",items:["Automatic smart contract execution","Instant prize distribution","Transparent transaction records","Automated refund system for technical issues"],delay:.6})]})]}),j.jsx(un.div,{initial:{opacity:0,y:20},animate:e?{opacity:1,y:0}:{opacity:0,y:20},transition:{duration:.8,delay:.8},className:"mt-20 w-full",children:j.jsx("video",{src:"/images/Stellar Void_What_is_it_about.mp4",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,style:{width:"100%",height:"auto",display:"block"}})})]})}function X3e(){return j.jsx("section",{className:"py-20",children:j.jsx("div",{className:"container mx-auto px-4",children:j.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-16",children:[j.jsxs("div",{children:[j.jsxs("h2",{className:"text-3xl font-bold mb-8 text-white",children:[j.jsx("span",{className:"text-red-600",children:"PROBLEM:"})," THE BROKEN GAMING PARADIGM"]}),j.jsxs("div",{className:"space-y-6 opacity-90",children:[j.jsx("p",{className:"text-lg",children:"Traditional gaming turns thousands of hours into zero financial return. Even skilled players can't monetize their expertise outside professional competition."}),j.jsx("p",{className:"text-lg",children:"Meanwhile, existing blockchain games prioritize tokenomics over quality gameplay, with crude graphics and simplistic mechanics."}),j.jsx("p",{className:"text-lg",children:"Current Web3 wagering platforms limit players to basic card games and puzzles—not the complex, skill-based competitions gamers crave."})]})]}),j.jsxs("div",{children:[j.jsxs("h2",{className:"text-3xl font-bold mb-8 text-white",children:[j.jsx("span",{className:"text-red-600",children:"SOLUTION:"})," SKILL-BASED SPACE COMBAT"]}
vendor: 76,809 bytes, lines 204-208
204),j.jsxs("div",{className:"space-y-6 opacity-90",children:[j.jsx("p",{className:"text-lg",children:"STELLAR VOID rewards skilled gameplay with immediate financial returns. Your combat prowess directly translates to earnings."}),j.jsx("p",{className:"text-lg",children:"We deliver AAA-quality space combat with professional graphics and mechanics—gameplay first, blockchain integration second."}),j.jsx("p",{className:"text-lg",children:"Our platform offers complex, high-skill ceiling competitive matches with real stakes, not simplistic mini-games."})]})]})]})})})}/**
205 * @license
206 * Copyright 2010-2023 Three.js Authors
207 * SPDX-License-Identifier: MIT
208 */const rx="162",Y3e={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Q3e={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},jY=0,sN=1,WY=2,Z3e=3,qY=0,D2=1,rw=2,Sa=3,ou=0,cs=1,Ua=2,Kc=0,Yd=1,uA=2,oN=3,aN=4,KY=5,ah=100,XY=101,YY=102,lN=103,cN=104,QY=200,ZY=201,JY=202,eQ=203,hA=204,fA=205,tQ=206,nQ=207,iQ=208,rQ=209,sQ=210,oQ=211,aQ=212,lQ=213,cQ=214,uQ=0,hQ=1,fQ=2,Jw=3,dQ=4,pQ=5,mQ=6,gQ=7,sx=0,yQ=1,vQ=2,kl=0,wQ=1,xQ=2,bQ=3,OL=4,_Q=5,EQ=6,SQ=7,uN="attached",AQ="detached",O2=300,au=301,Yh=302,e1=303,t1=304,ny=306,pp=1e3,Fr=1001,n1=1002,hi=1003,dA=1004,J3e=1004,nd=1005,eIe=1005,On=1006,sw=1007,tIe=1007,Il=1008,nIe=1008,Fl=1009,MQ=1010,TQ=1011,L2=1012,LL=1013,Fc=1014,co=1015,z0=1016,UL=1017,BL=1018,Fh=1020,PQ=1021,zr=1023,CQ=1024,IQ=1025,zh=1026,mp=1027,kL=1028,FL=1029,RQ=1030,zL=1031,VL=1033,jE=33776,WE=33777,qE=33778,KE=33779,hN=35840,fN=35841,dN=35842,pN=35843,HL=36196,mN=37492,gN=37496,yN=37808,vN=37809,wN=37810,xN=37811,bN=37812,_N=37813,EN=37814,SN=37815,AN=37816,MN=37817,TN=37818,PN=37819,CN=37820,IN=37821,XE=36492,RN=36494,NN=36495,NQ=36283,DN=36284,ON=36285,LN=36286,DQ=2200,OQ=2201,LQ=2202,i1=2300,r1=2301,YE=2302,wd=2400,xd=2401,s1=2402,U2=2500,$L=2501,iIe=0,rIe=1,sIe=2,UQ=3200,BQ=3201,lf=0,kQ=1,Dc="",Jo="srgb",hu="srgb-linear",B2="display-p3",ox="display-p3-linear",o1="linear",An="srgb",a1="rec709",l1="p3",oIe=0,Xf=7680,aIe=7681,lIe=7682,cIe=7683,uIe=34055,hIe=34056,fIe=5386,dIe=512,pIe=513,mIe=514,gIe=515,yIe=516,vIe=517,wIe=518,UN=519,FQ=512,zQ=513,VQ=514,GL=515,HQ=516,$Q=517,GQ=518,jQ=519,c1=35044,xIe=35048,bIe=35040,_Ie=35045,EIe=35049,SIe=35041,AIe=35046,MIe=35050,TIe=35042,PIe="100",BN="300 es",pA=1035,Rl=2e3,u1=2001;class fu{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}}const Ir=["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","55","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"];let pV=1234567;const Qd=Math.PI/180,V0=180/Math.PI;function go(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Ir[n&255]+Ir[n>>8&255]+Ir[n>>16&255]+Ir[n>>24&255]+"-"+Ir[e&255]+Ir[e>>8&255]+"-"+Ir[e>>16&15|64]+Ir[e>>24&255]+"-"+Ir[t&63|128]+Ir[t>>8&255]+"-"+Ir[t>>16&255]+Ir[t>>24&255]+Ir[i&255]+Ir[i>>8&255]+Ir[i>>16&255]+Ir[i>>24&255]).toLowerCase()}function ii(n,e,t){return Math.max(e,Math.min(t,n))}function jL(n,e){return(n%e+e)%e}function CIe(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function IIe(n,e,t){return n!==e?(t-n)/(e-n):0}function ow(n,e,t){return(1-t)*n+t*e}function RIe(n,e,t,i){return ow(n,e,1-Math.exp(-t*i))}function NIe(n,e=1){return e-Math.abs(jL(n,e*2)-e)}function DIe(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function OIe(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function LIe(n,e){return n+Math.floor(Math.random()*(e-n+1))}function UIe(n,e){return n+Math.random()*(e-n)}function BIe(n){return n*(.5-Math.random())}function kIe(n){n!==void 0&&(pV=n);let e=pV+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function FIe(n){return n*Qd}function zIe(n){return n*V0}function kN(n){return(n&n-1)===0&&n!==0}function VIe(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function mA(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function HIe(n,e,t,i,r){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+i)/2),u=o((e+i)/2),h=s((e-i)/2),f=o((e-i)/2),m=s((i-e)/2),g=o((i-e)/2);switch(r){case"XYX":n.set(a*u,l*h,l*f,a*c);break;case"YZY":n.set(l*f,a*u,l*h,a*c);break;case"ZXZ":n.set(l*h,l*f,a*u,a*c);break;case"XZX":n.set(a*u,l*g,l*m,a*c);break;case"YXY":n.set(l*m,a*u,l*g,a*c);break;case"ZYZ":n.set(l*g,l*m,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function ts(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Dt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const $Ie={DEG2RAD:Qd,RAD2DEG:V0,generateUUID:go,clamp:ii,euclideanModulo:jL,mapLinear:CIe,inverseLerp:IIe,lerp:ow,damp:RIe,pingpong:NIe,smoothstep:DIe,smootherstep:OIe,randInt:LIe,randFloat:UIe,randFloatSpread:BIe,seededRandom:kIe,degToRad:FIe,radToDeg:zIe,isPowerOfTwo:kN,ceilPowerOfTwo:VIe,floorPowerOfTwo:mA,setQuaternionFromProperEuler:HIe,normalize:Dt,denormalize:ts};class Me{constructor(e=0,t=0){Me.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=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 t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(ii(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Nt{constructor(e,t,i,r,s,o,a,l,c){Nt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c)}set(e,t,i,r,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],f=i[2],m=i[5],g=i[8],v=r[0],w=r[3],y=r[6],_=r[1],x=r[4],S=r[7],M=r[2],A=r[5],I=r[8];return s[0]=o*v+a*_+l*M,s[3]=o*w+a*x+l*A,s[6]=o*y+a*S+l*I,s[1]=c*v+u*_+h*M,s[4]=c*w+u*x+h*A,s[7]=c*y+u*S+h*I,s[2]=f*v+m*_+g*M,s[5]=f*w+m*x+g*A,s[8]=f*y+m*S+g*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*s*u+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,f=a*l-u*s,m=c*s-o*l,g=t*h+i*f+r*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/g;return e[0]=h*v,e[1]=(r*c-u*i)*v,e[2]=(a*i-r*o)*v,e[3]=f*v,e[4]=(u*t-r*l)*v,e[5]=(r*s-a*t)*v,e[6]=m*v,e[7]=(i*l-c*t)*v,e[8]=(o*t-i*s)*v,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(wC.makeScale(e,t)),this}rotate(e){return this.premultiply(wC.makeRotation(-e)),this}translate(e,t){return this.premultiply(wC.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const wC=new Nt;function WQ(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const GIe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function og(n,e){return new GIe[n](e)}function h1(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function qQ(){const n=h1("canvas");return n.style.display="block",n}const mV={};function KQ(n){n in mV||(mV[n]=!0,console.warn(n))}const gV=new Nt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),yV=new Nt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),y_={[hu]:{transfer:o1,primaries:a1,toReference:n=>n,fromReference:n=>n},[Jo]:{transfer:An,primaries:a1,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[ox]:{transfer:o1,primaries:l1,toReference:n=>n.applyMatrix3(yV),fromReference:n=>n.applyMatrix3(gV)},[B2]:{transfer:An,primaries:l1,toReference:n=>n.convertSRGBToLinear().applyMatrix3(yV),fromReference:n=>n.applyMatrix3(gV).convertLinearToSRGB()}},jIe=new Set([hu,ox]),pn={enabled:!0,_workingColorSpace:hu,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!jIe.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=y_[e].toReference,r=y_[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return y_[n].primaries},getTransfer:function(n){return n===Dc?o1:y_[n].transfer}};function Rg(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function xC(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let lm;class WL{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{lm===void 0&&(lm=h1("canvas")),lm.width=e.width,lm.height=e.height;const i=lm.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=lm}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=h1("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=Rg(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){const t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(Rg(t[i]/255)*255):t[i]=Rg(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let WIe=0;class bd{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:WIe++}),this.uuid=go(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(bC(r[o].image)):s.push(bC(r[o]))}else s=bC(r);i.url=s}return t||(e.images[this.uuid]=i),i}}function bC(n){return typeof HTMLImageElement<"u"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&n instanceof ImageBitmap?WL.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let qIe=0;class zn extends fu{constructor(e=zn.DEFAULT_IMAGE,t=zn.DEFAULT_MAPPING,i=Fr,r=Fr,s=On,o=Il,a=zr,l=Fl,c=zn.DEFAULT_ANISOTROPY,u=Dc){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:qIe++}),this.uuid=go(),this.name="",this.source=new bd(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=c,this.format=a,this.internalFormat=null,this.type=l,this.offset=new Me(0,0),this.repeat=new Me(1,1),this.center=new Me(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Nt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}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)}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.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const i={metadata:{version:4.6,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&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==O2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case pp:e.x=e.x-Math.floor(e.x);break;case Fr:e.x=e.x<0?0:1;break;case n1: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 pp:e.y=e.y-Math.floor(e.y);break;case Fr:e.y=e.y<0?0:1;break;case n1: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)}}zn.DEFAULT_IMAGE=null;zn.DEFAULT_MAPPING=O2;zn.DEFAULT_ANISOTROPY=1;class mn{constructor(e=0,t=0,i=0,r=1){mn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,r,s;const l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],m=l[5],g=l[9],v=l[2],w=l[6],y=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-v)<.01&&Math.abs(g-w)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+v)<.1&&Math.abs(g+w)<.1&&Math.abs(c+m+y-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,S=(m+1)/2,M=(y+1)/2,A=(u+f)/4,I=(h+v)/4,D=(g+w)/4;return x>S&&x>M?x<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(x),r=A/i,s=I/i):S>M?S<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(S),i=A/r,s=D/r):M<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(M),i=I/s,r=D/s),this.set(i,r,s,t),this}let _=Math.sqrt((w-g)*(w-g)+(h-v)*(h-v)+(f-u)*(f-u));return Math.abs(_)<.001&&(_=1),this.x=(w-g)/_,this.y=(h-v)/_,this.z=(f-u)/_,this.w=Math.acos((c+m+y-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class XQ extends fu{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new mn(0,0,e,t),this.scissorTest=!1,this.viewport=new mn(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:On,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);const s=new zn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];const o=i.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new bd(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class $a extends XQ{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}}class k2 extends zn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=hi,this.minFilter=hi,this.wrapR=Fr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class KIe extends $a{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new k2(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class qL extends zn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=hi,this.minFilter=hi,this.wrapR=Fr,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class XIe extends $a{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new qL(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class ks{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let l=i[r+0],c=i[r+1],u=i[r+2],h=i[r+3];const f=s[o+0],m=s[o+1],g=s[o+2],v=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=f,e[t+1]=m,e[t+2]=g,e[t+3]=v;return}if(h!==v||l!==f||c!==m||u!==g){let w=1-a;const y=l*f+c*m+u*g+h*v,_=y>=0?1:-1,x=1-y*y;if(x>Number.EPSILON){const M=Math.sqrt(x),A=Math.atan2(M,y*_);w=Math.sin(w*A)/M,a=Math.sin(a*A)/M}const S=a*_;if(l=l*w+f*S,c=c*w+m*S,u=u*w+g*S,h=h*w+v*S,w===1-a){const M=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=M,c*=M,u*=M,h*=M}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[o],f=s[o+1],m=s[o+2],g=s[o+3];return e[t]=a*g+u*h+l*m-c*f,e[t+1]=l*g+u*f+c*h-a*m,e[t+2]=c*g+u*m+a*f-l*h,e[t+3]=u*g-a*h-l*f-c*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(r/2),h=a(s/2),f=l(i/2),m=l(r/2),g=l(s/2);switch(o){case"XYZ":this._x=f*u*h+c*m*g,this._y=c*m*h-f*u*g,this._z=c*u*g+f*m*h,this._w=c*u*h-f*m*g;break;case"YXZ":this._x=f*u*h+c*m*g,this._y=c*m*h-f*u*g,this._z=c*u*g-f*m*h,this._w=c*u*h+f*m*g;break;case"ZXY":this._x=f*u*h-c*m*g,this._y=c*m*h+f*u*g,this._z=c*u*g+f*m*h,this._w=c*u*h-f*m*g;break;case"ZYX":this._x=f*u*h-c*m*g,this._y=c*m*h+f*u*g,this._z=c*u*g-f*m*h,this._w=c*u*h+f*m*g;break;case"YZX":this._x=f*u*h+c*m*g,this._y=c*m*h+f*u*g,this._z=c*u*g-f*m*h,this._w=c*u*h-f*m*g;break;case"XZY":this._x=f*u*h-c*m*g,this._y=c*m*h-f*u*g,this._z=c*u*g+f*m*h,this._w=c*u*h+f*m*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=i+a+h;if(f>0){const m=.5/Math.sqrt(f+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(o-r)*m}else if(i>a&&i>h){const m=2*Math.sqrt(1+i-a-h);this._w=(u-l)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+c)/m}else if(a>h){const m=2*Math.sqrt(1+a-i-h);this._w=(s-c)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+h-i-a);this._w=(o-r)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(ii(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+r*c-s*l,this._y=r*u+o*l+s*a-i*c,this._z=s*u+o*c+i*l-r*a,this._w=o*u-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*i+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=o*h+this._w*f,this._x=i*h+this._x*f,this._y=r*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._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 K{constructor(e=0,t=0,i=0){K.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(vV.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(vV.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),u=2*(a*t-s*r),h=2*(s*i-o*t);return this.x=t+l*c+o*h-a*u,this.y=i+l*u+a*c-s*h,this.z=r+l*h+s*u-o*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 t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return _C.copy(this).projectOnVector(e),this.sub(_C)}reflect(e){return this.sub(_C.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(ii(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const _C=new K,vV=new ks;class us{constructor(e=new K(1/0,1/0,1/0),t=new K(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(ma.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(ma.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=ma.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}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,t=!1){e.updateWorldMatrix(!1,!1);const i=e.geometry;if(i!==void 0){const s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,ma):ma.fromBufferAttribute(s,o),ma.applyMatrix4(e.matrixWorld),this.expandByPoint(ma);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),v_.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),v_.copy(i.boundingBox)),v_.applyMatrix4(e.matrixWorld),this.union(v_)}const r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);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,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.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,ma),ma.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(sv),w_.subVectors(this.max,sv),cm.subVectors(e.a,sv),um.subVectors(e.b,sv),hm.subVectors(e.c,sv),zu.subVectors(um,cm),Vu.subVectors(hm,um),If.subVectors(cm,hm);let t=[0,-zu.z,zu.y,0,-Vu.z,Vu.y,0,-If.z,If.y,zu.z,0,-zu.x,Vu.z,0,-Vu.x,If.z,0,-If.x,-zu.y,zu.x,0,-Vu.y,Vu.x,0,-If.y,If.x,0];return!EC(t,cm,um,hm,w_)||(t=[1,0,0,0,1,0,0,0,1],!EC(t,cm,um,hm,w_))?!1:(x_.crossVectors(zu,Vu),t=[x_.x,x_.y,x_.z],EC(t,cm,um,hm,w_))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ma).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ma).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:(ic[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ic[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ic[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ic[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ic[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ic[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ic[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ic[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ic),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const ic=[new K,new K,new K,new K,new K,new K,new K,new K],ma=new K,v_=new us,cm=new K,um=new K,hm=new K,zu=new K,Vu=new K,If=new K,sv=new K,w_=new K,x_=new K,Rf=new K;function EC(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Rf.fromArray(n,s);const a=r.x*Math.abs(Rf.x)+r.y*Math.abs(Rf.y)+r.z*Math.abs(Rf.z),l=e.dot(Rf),c=t.dot(Rf),u=i.dot(Rf);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const YIe=new us,ov=new K,SC=new K;class $r{constructor(e=new K,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):YIe.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),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 t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const i=this.center.distanceToSquared(e);return t.copy(e),i>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;ov.subVectors(e,this.center);const t=ov.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(ov,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(SC.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ov.copy(e.center).add(SC)),this.expandByPoint(ov.copy(e.center).sub(SC))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const rc=new K,AC=new K,b_=new K,Hu=new K,MC=new K,__=new K,TC=new K;class iy{constructor(e=new K,t=new K(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,rc)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=rc.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(rc.copy(this.origin).addScaledVector(this.direction,t),rc.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){AC.copy(e).add(t).multiplyScalar(.5),b_.copy(t).sub(e).normalize(),Hu.copy(this.origin).sub(AC);const s=e.distanceTo(t)*.5,o=-this.direction.dot(b_),a=Hu.dot(this.direction),l=-Hu.dot(b_),c=Hu.lengthSq(),u=Math.abs(1-o*o);let h,f,m,g;if(u>0)if(h=o*l-a,f=o*a-l,g=s*u,h>=0)if(f>=-g)if(f<=g){const v=1/u;h*=v,f*=v,m=h*(h+o*f+2*a)+f*(o*h+f+2*l)+c}else f=s,h=Math.max(0,-(o*f+a)),m=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(o*f+a)),m=-h*h+f*(f+2*l)+c;else f<=-g?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-l),s),m=-h*h+f*(f+2*l)+c):f<=g?(h=0,f=Math.min(Math.max(-s,-l),s),m=f*(f+2*l)+c):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-l),s),m=-h*h+f*(f+2*l)+c);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),m=-h*h+f*(f+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(AC).addScaledVector(b_,f),m}intersectSphere(e,t){rc.subVectors(e.center,this.origin);const i=rc.dot(this.direction),r=rc.dot(rc)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(i=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(i=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),h>=0?(a=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),i>l||a>r)||((a>i||i!==i)&&(i=a),(l<r||r!==r)&&(r=l),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,rc)!==null}intersectTriangle(e,t,i,r,s){MC.subVectors(t,e),__.subVectors(i,e),TC.crossVectors(MC,__);let o=this.direction.dot(TC),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Hu.subVectors(this.origin,e);const l=a*this.direction.dot(__.crossVectors(Hu,__));if(l<0)return null;const c=a*this.direction.dot(MC.cross(Hu));if(c<0||l+c>o)return null;const u=-a*Hu.dot(TC);return u<0?null:this.at(u/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class wt{constructor(e,t,i,r,s,o,a,l,c,u,h,f,m,g,v,w){wt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,l,c,u,h,f,m,g,v,w)}set(e,t,i,r,s,o,a,l,c,u,h,f,m,g,v,w){const y=this.elements;return y[0]=e,y[4]=t,y[8]=i,y[12]=r,y[1]=s,y[5]=o,y[9]=a,y[13]=l,y[2]=c,y[6]=u,y[10]=h,y[14]=f,y[3]=m,y[7]=g,y[11]=v,y[15]=w,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 wt().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/fm.setFromMatrixColumn(e,0).length(),s=1/fm.setFromMatrixColumn(e,1).length(),o=1/fm.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=o*u,m=o*h,g=a*u,v=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=m+g*c,t[5]=f-v*c,t[9]=-a*l,t[2]=v-f*c,t[6]=g+m*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*u,m=l*h,g=c*u,v=c*h;t[0]=f+v*a,t[4]=g*a-m,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=m*a-g,t[6]=v+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*u,m=l*h,g=c*u,v=c*h;t[0]=f-v*a,t[4]=-o*h,t[8]=g+m*a,t[1]=m+g*a,t[5]=o*u,t[9]=v-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*u,m=o*h,g=a*u,v=a*h;t[0]=l*u,t[4]=g*c-m,t[8]=f*c+v,t[1]=l*h,t[5]=v*c+f,t[9]=m*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,m=o*c,g=a*l,v=a*c;t[0]=l*u,t[4]=v-f*h,t[8]=g*h+m,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=m*h+g,t[10]=f-v*h}else if(e.order==="XZY"){const f=o*l,m=o*c,g=a*l,v=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+v,t[5]=o*u,t[9]=m*h-g,t[2]=g*h-m,t[6]=a*u,t[10]=v*h+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(QIe,e,ZIe)}lookAt(e,t,i){const r=this.elements;return Qs.subVectors(e,t),Qs.lengthSq()===0&&(Qs.z=1),Qs.normalize(),$u.crossVectors(i,Qs),$u.lengthSq()===0&&(Math.abs(i.z)===1?Qs.x+=1e-4:Qs.z+=1e-4,Qs.normalize(),$u.crossVectors(i,Qs)),$u.normalize(),E_.crossVectors(Qs,$u),r[0]=$u.x,r[4]=E_.x,r[8]=Qs.x,r[1]=$u.y,r[5]=E_.y,r[9]=Qs.y,r[2]=$u.z,r[6]=E_.z,r[10]=Qs.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],h=i[5],f=i[9],m=i[13],g=i[2],v=i[6],w=i[10],y=i[14],_=i[3],x=i[7],S=i[11],M=i[15],A=r[0],I=r[4],D=r[8],k=r[12],C=r[1],U=r[5],G=r[9],H=r[13],z=r[2],P=r[6],R=r[10],F=r[14],N=r[3],O=r[7],B=r[11],W=r[15];return s[0]=o*A+a*C+l*z+c*N,s[4]=o*I+a*U+l*P+c*O,s[8]=o*D+a*G+l*R+c*B,s[12]=o*k+a*H+l*F+c*W,s[1]=u*A+h*C+f*z+m*N,s[5]=u*I+h*U+f*P+m*O,s[9]=u*D+h*G+f*R+m*B,s[13]=u*k+h*H+f*F+m*W,s[2]=g*A+v*C+w*z+y*N,s[6]=g*I+v*U+w*P+y*O,s[10]=g*D+v*G+w*R+y*B,s[14]=g*k+v*H+w*F+y*W,s[3]=_*A+x*C+S*z+M*N,s[7]=_*I+x*U+S*P+M*O,s[11]=_*D+x*G+S*R+M*B,s[15]=_*k+x*H+S*F+M*W,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],m=e[14],g=e[3],v=e[7],w=e[11],y=e[15];return g*(+s*l*h-r*c*h-s*a*f+i*c*f+r*a*m-i*l*m)+v*(+t*l*m-t*c*f+s*o*f-r*o*m+r*c*u-s*l*u)+w*(+t*c*h-t*a*m-s*o*h+i*o*m+s*a*u-i*c*u)+y*(-r*a*u-t*l*h+t*a*f+r*o*h-i*o*f+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],m=e[11],g=e[12],v=e[13],w=e[14],y=e[15],_=h*w*c-v*f*c+v*l*m-a*w*m-h*l*y+a*f*y,x=g*f*c-u*w*c-g*l*m+o*w*m+u*l*y-o*f*y,S=u*v*c-g*h*c+g*a*m-o*v*m-u*a*y+o*h*y,M=g*h*l-u*v*l-g*a*f+o*v*f+u*a*w-o*h*w,A=t*_+i*x+r*S+s*M;if(A===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const I=1/A;return e[0]=_*I,e[1]=(v*f*s-h*w*s-v*r*m+i*w*m+h*r*y-i*f*y)*I,e[2]=(a*w*s-v*l*s+v*r*c-i*w*c-a*r*y+i*l*y)*I,e[3]=(h*l*s-a*f*s-h*r*c+i*f*c+a*r*m-i*l*m)*I,e[4]=x*I,e[5]=(u*w*s-g*f*s+g*r*m-t*w*m-u*r*y+t*f*y)*I,e[6]=(g*l*s-o*w*s-g*r*c+t*w*c+o*r*y-t*l*y)*I,e[7]=(o*f*s-u*l*s+u*r*c-t*f*c-o*r*m+t*l*m)*I,e[8]=S*I,e[9]=(g*h*s-u*v*s-g*i*m+t*v*m+u*i*y-t*h*y)*I,e[10]=(o*v*s-g*a*s+g*i*c-t*v*c-o*i*y+t*a*y)*I,e[11]=(u*a*s-o*h*s-u*i*c+t*h*c+o*i*m-t*a*m)*I,e[12]=M*I,e[13]=(u*v*r-g*h*r+g*i*f-t*v*f-u*i*w+t*h*w)*I,e[14]=(g*a*r-o*v*r-g*i*l+t*v*l+o*i*w-t*a*w)*I,e[15]=(o*h*r-u*a*r+u*i*l-t*h*l-o*i*f+t*a*f)*I,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,u*a+i,u*l-r*o,0,c*l-r*a,u*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,f=s*c,m=s*u,g=s*h,v=o*u,w=o*h,y=a*h,_=l*c,x=l*u,S=l*h,M=i.x,A=i.y,I=i.z;return r[0]=(1-(v+y))*M,r[1]=(m+S)*M,r[2]=(g-x)*M,r[3]=0,r[4]=(m-S)*A,r[5]=(1-(f+y))*A,r[6]=(w+_)*A,r[7]=0,r[8]=(g+x)*I,r[9]=(w-_)*I,r[10]=(1-(f+v))*I,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=fm.set(r[0],r[1],r[2]).length();const o=fm.set(r[4],r[5],r[6]).length(),a=fm.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],ga.copy(this);const c=1/s,u=1/o,h=1/a;return ga.elements[0]*=c,ga.elements[1]*=c,ga.elements[2]*=c,ga.elements[4]*=u,ga.elements[5]*=u,ga.elements[6]*=u,ga.elements[8]*=h,ga.elements[9]*=h,ga.elements[10]*=h,t.setFromRotationMatrix(ga),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Rl){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),h=(t+e)/(t-e),f=(i+r)/(i-r);let m,g;if(a===Rl)m=-(o+s)/(o-s),g=-2*o*s/(o-s);else if(a===u1)m=-o/(o-s),g=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=g,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Rl){const l=this.elements,c=1/(t-e),u=1/(i-r),h=1/(o-s),f=(t+e)*c,m=(i+r)*u;let g,v;if(a===Rl)g=(o+s)*h,v=-2*h;else if(a===u1)g=s*h,v=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-m,l[2]=0,l[6]=0,l[10]=v,l[14]=-g,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const fm=new K,ga=new wt,QIe=new K(0,0,0),ZIe=new K(1,1,1),$u=new K,E_=new K,Qs=new K,wV=new wt,xV=new ks;class wo{constructor(e=0,t=0,i=0,r=wo.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],u=r[9],h=r[2],f=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(ii(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ii(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(ii(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-ii(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(ii(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-ii(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return wV.makeRotationFromQuaternion(e),this.setFromRotationMatrix(wV,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return xV.setFromEuler(this),this.setFromQuaternion(xV,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}wo.DEFAULT_ORDER="XYZ";class Zd{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 JIe=0;const bV=new K,dm=new ks,sc=new wt,S_=new K,av=new K,eRe=new K,tRe=new ks,_V=new K(1,0,0),EV=new K(0,1,0),SV=new K(0,0,1),nRe={type:"added"},iRe={type:"removed"},PC={type:"childadded",child:null},CC={type:"childremoved",child:null};class ln extends fu{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:JIe++}),this.uuid=go(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ln.DEFAULT_UP.clone();const e=new K,t=new wo,i=new ks,r=new K(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new wt},normalMatrix:{value:new Nt}}),this.matrix=new wt,this.matrixWorld=new wt,this.matrixAutoUpdate=ln.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ln.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Zd,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],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,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return dm.setFromAxisAngle(e,t),this.quaternion.multiply(dm),this}rotateOnWorldAxis(e,t){return dm.setFromAxisAngle(e,t),this.quaternion.premultiply(dm),this}rotateX(e){return this.rotateOnAxis(_V,e)}rotateY(e){return this.rotateOnAxis(EV,e)}rotateZ(e){return this.rotateOnAxis(SV,e)}translateOnAxis(e,t){return bV.copy(e).applyQuaternion(this.quaternion),this.position.add(bV.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(_V,e)}translateY(e){return this.translateOnAxis(EV,e)}translateZ(e){return this.translateOnAxis(SV,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(sc.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?S_.copy(e):S_.set(e,t,i);const r=this.parent;this.updateWorldMatrix(!0,!1),av.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?sc.lookAt(av,S_,this.up):sc.lookAt(S_,av,this.up),this.quaternion.setFromRotationMatrix(sc),r&&(sc.extractRotation(r.matrixWorld),dm.setFromRotationMatrix(sc),this.quaternion.premultiply(dm.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(nRe),PC.child=e,this.dispatchEvent(PC),PC.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(iRe),CC.child=e,this.dispatchEvent(CC),CC.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),sc.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),sc.multiply(e.parent.matrixWorld)),e.applyMatrix4(sc),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){const o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);const r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(av,e,eRe),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(av,tRe,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.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.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let i=0,r=t.length;i<r;i++){const s=t[i];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){const i=this.parent;if(e===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){const r=this.children;for(let s=0,o=r.length;s<o;s++){const a=r[s];a.matrixWorldAutoUpdate===!0&&a.updateWorldMatrix(!1,!0)}}}toJSON(e){const t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c<u;c++){const h=l[c];s(e.shapes,h)}else s(e.shapes,l)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const a=[];for(let l=0,c=this.material.length;l<c;l++)a.push(s(e.materials,this.material[l]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){const l=this.animations[a];r.animations.push(s(e.animations,l))}}if(t){const a=o(e.geometries),l=o(e.materials),c=o(e.textures),u=o(e.images),h=o(e.shapes),f=o(e.skeletons),m=o(e.animations),g=o(e.nodes);a.length>0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),f.length>0&&(i.skeletons=f),m.length>0&&(i.animations=m),g.length>0&&(i.nodes=g)}return i.object=r,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.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)),t===!0)for(let i=0;i<e.children.length;i++){const r=e.children[i];this.add(r.clone())}return this}}ln.DEFAULT_UP=new K(0,1,0);ln.DEFAULT_MATRIX_AUTO_UPDATE=!0;ln.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ya=new K,oc=new K,IC=new K,ac=new K,pm=new K,mm=new K,AV=new K,RC=new K,NC=new K,DC=new K;class uo{constructor(e=new K,t=new K,i=new K){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),ya.subVectors(e,t),r.cross(ya);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){ya.subVectors(r,t),oc.subVectors(i,t),IC.subVectors(e,t);const o=ya.dot(ya),a=ya.dot(oc),l=ya.dot(IC),c=oc.dot(oc),u=oc.dot(IC),h=o*c-a*a;if(h===0)return s.set(0,0,0),null;const f=1/h,m=(c*l-a*u)*f,g=(o*u-a*l)*f;return s.set(1-m-g,g,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,ac)===null?!1:ac.x>=0&&ac.y>=0&&ac.x+ac.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,ac)===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,ac.x),l.addScaledVector(o,ac.y),l.addScaledVector(a,ac.z),l)}static isFrontFacing(e,t,i,r){return ya.subVectors(i,t),oc.subVectors(e,t),ya.cross(oc).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ya.subVectors(this.c,this.b),oc.subVectors(this.a,this.b),ya.cross(oc).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return uo.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return uo.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return uo.getInterpolation(e,this.a,this.b,this.c,t,i,r,s
vendor: 10,610 bytes, line 208
208)}containsPoint(e){return uo.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return uo.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let o,a;pm.subVectors(r,i),mm.subVectors(s,i),RC.subVectors(e,i);const l=pm.dot(RC),c=mm.dot(RC);if(l<=0&&c<=0)return t.copy(i);NC.subVectors(e,r);const u=pm.dot(NC),h=mm.dot(NC);if(u>=0&&h<=u)return t.copy(r);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(pm,o);DC.subVectors(e,s);const m=pm.dot(DC),g=mm.dot(DC);if(g>=0&&m<=g)return t.copy(s);const v=m*c-l*g;if(v<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(i).addScaledVector(mm,a);const w=u*g-m*h;if(w<=0&&h-u>=0&&m-g>=0)return AV.subVectors(s,r),a=(h-u)/(h-u+(m-g)),t.copy(r).addScaledVector(AV,a);const y=1/(w+v+f);return o=v*y,a=f*y,t.copy(i).addScaledVector(pm,o).addScaledVector(mm,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const YQ={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},Gu={h:0,s:0,l:0},A_={h:0,s:0,l:0};function OC(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class et{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Jo){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,pn.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=pn.workingColorSpace){return this.r=e,this.g=t,this.b=i,pn.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=pn.workingColorSpace){if(e=jL(e,1),t=ii(t,0,1),i=ii(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=OC(o,s,e+1/3),this.g=OC(o,s,e),this.b=OC(o,s,e-1/3)}return pn.toWorkingColorSpace(this,r),this}setStyle(e,t=Jo){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Jo){const i=YQ[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Rg(e.r),this.g=Rg(e.g),this.b=Rg(e.b),this}copyLinearToSRGB(e){return this.r=xC(e.r),this.g=xC(e.g),this.b=xC(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Jo){return pn.fromWorkingColorSpace(Rr.copy(this),e),Math.round(ii(Rr.r*255,0,255))*65536+Math.round(ii(Rr.g*255,0,255))*256+Math.round(ii(Rr.b*255,0,255))}getHexString(e=Jo){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=pn.workingColorSpace){pn.fromWorkingColorSpace(Rr.copy(this),t);const i=Rr.r,r=Rr.g,s=Rr.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case i:l=(r-s)/h+(r<s?6:0);break;case r:l=(s-i)/h+2;break;case s:l=(i-r)/h+4;break}l/=6}return e.h=l,e.s=c,e.l=u,e}getRGB(e,t=pn.workingColorSpace){return pn.fromWorkingColorSpace(Rr.copy(this),t),e.r=Rr.r,e.g=Rr.g,e.b=Rr.b,e}getStyle(e=Jo){pn.fromWorkingColorSpace(Rr.copy(this),e);const t=Rr.r,i=Rr.g,r=Rr.b;return e!==Jo?`color(${e} ${t.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(i*255)},${Math.round(r*255)})`}offsetHSL(e,t,i){return this.getHSL(Gu),this.setHSL(Gu.h+e,Gu.s+t,Gu.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.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,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(Gu),e.getHSL(A_);const i=ow(Gu.h,A_.h,t),r=ow(Gu.s,A_.s,t),s=ow(Gu.l,A_.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Rr=new et;et.NAMES=YQ;let rRe=0;class jr extends fu{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:rRe++}),this.uuid=go(),this.name="",this.type="Material",this.blending=Yd,this.side=ou,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=hA,this.blendDst=fA,this.blendEquation=ah,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new et(0,0,0),this.blendAlpha=0,this.depthFunc=Jw,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=UN,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Xf,this.stencilZFail=Xf,this.stencilZPass=Xf,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};
vendor: 52,204 bytes, lines 208-306
208i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Yd&&(i.blending=this.blending),this.side!==ou&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==hA&&(i.blendSrc=this.blendSrc),this.blendDst!==fA&&(i.blendDst=this.blendDst),this.blendEquation!==ah&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Jw&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==UN&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Xf&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Xf&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Xf&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.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 t=e.clippingPlanes;let i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class cf extends jr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new et(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 wo,this.combine=sx,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 Oc=sRe();function sRe(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function ws(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=ii(n,-65504,65504),Oc.floatView[0]=n;const e=Oc.uint32View[0],t=e>>23&511;return Oc.baseTable[t]+((e&8388607)>>Oc.shiftTable[t])}function Uv(n){const e=n>>10;return Oc.uint32View[0]=Oc.mantissaTable[Oc.offsetTable[e]+(n&1023)]+Oc.exponentTable[e],Oc.floatView[0]}const oRe={toHalfFloat:ws,fromHalfFloat:Uv},wi=new K,M_=new Me;class wn{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=c1,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=co,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return KQ("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}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,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)M_.fromBufferAttribute(this,t),M_.applyMatrix3(e),this.setXY(t,M_.x,M_.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)wi.fromBufferAttribute(this,t),wi.applyMatrix3(e),this.setXYZ(t,wi.x,wi.y,wi.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)wi.fromBufferAttribute(this,t),wi.applyMatrix4(e),this.setXYZ(t,wi.x,wi.y,wi.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)wi.fromBufferAttribute(this,t),wi.applyNormalMatrix(e),this.setXYZ(t,wi.x,wi.y,wi.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)wi.fromBufferAttribute(this,t),wi.transformDirection(e),this.setXYZ(t,wi.x,wi.y,wi.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=ts(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Dt(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=ts(t,this.array)),t}setX(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=ts(t,this.array)),t}setY(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=ts(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=ts(t,this.array)),t}setW(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Dt(t,this.array),i=Dt(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Dt(t,this.array),i=Dt(i,this.array),r=Dt(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Dt(t,this.array),i=Dt(i,this.array),r=Dt(r,this.array),s=Dt(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(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!==c1&&(e.usage=this.usage),e}}class aRe extends wn{constructor(e,t,i){super(new Int8Array(e),t,i)}}class lRe extends wn{constructor(e,t,i){super(new Uint8Array(e),t,i)}}class cRe extends wn{constructor(e,t,i){super(new Uint8ClampedArray(e),t,i)}}class uRe extends wn{constructor(e,t,i){super(new Int16Array(e),t,i)}}class KL extends wn{constructor(e,t,i){super(new Uint16Array(e),t,i)}}class hRe extends wn{constructor(e,t,i){super(new Int32Array(e),t,i)}}class XL extends wn{constructor(e,t,i){super(new Uint32Array(e),t,i)}}class fRe extends wn{constructor(e,t,i){super(new Uint16Array(e),t,i),this.isFloat16BufferAttribute=!0}getX(e){let t=Uv(this.array[e*this.itemSize]);return this.normalized&&(t=ts(t,this.array)),t}setX(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize]=ws(t),this}getY(e){let t=Uv(this.array[e*this.itemSize+1]);return this.normalized&&(t=ts(t,this.array)),t}setY(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize+1]=ws(t),this}getZ(e){let t=Uv(this.array[e*this.itemSize+2]);return this.normalized&&(t=ts(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize+2]=ws(t),this}getW(e){let t=Uv(this.array[e*this.itemSize+3]);return this.normalized&&(t=ts(t,this.array)),t}setW(e,t){return this.normalized&&(t=Dt(t,this.array)),this.array[e*this.itemSize+3]=ws(t),this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Dt(t,this.array),i=Dt(i,this.array)),this.array[e+0]=ws(t),this.array[e+1]=ws(i),this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Dt(t,this.array),i=Dt(i,this.array),r=Dt(r,this.array)),this.array[e+0]=ws(t),this.array[e+1]=ws(i),this.array[e+2]=ws(r),this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Dt(t,this.array),i=Dt(i,this.array),r=Dt(r,this.array),s=Dt(s,this.array)),this.array[e+0]=ws(t),this.array[e+1]=ws(i),this.array[e+2]=ws(r),this.array[e+3]=ws(s),this}}class at extends wn{constructor(e,t,i){super(new Float32Array(e),t,i)}}let dRe=0;const zo=new wt,LC=new ln,gm=new K,Zs=new us,lv=new us,Vi=new K;class Ft extends fu{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:dRe++}),this.uuid=go(),this.name="",this.type="BufferGeometry",this.index=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(WQ(e)?XL:KL)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const s=new Nt().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}const r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return zo.makeRotationFromQuaternion(e),this.applyMatrix4(zo),this}rotateX(e){return zo.makeRotationX(e),this.applyMatrix4(zo),this}rotateY(e){return zo.makeRotationY(e),this.applyMatrix4(zo),this}rotateZ(e){return zo.makeRotationZ(e),this.applyMatrix4(zo),this}translate(e,t,i){return zo.makeTranslation(e,t,i),this.applyMatrix4(zo),this}scale(e,t,i){return zo.makeScale(e,t,i),this.applyMatrix4(zo),this}lookAt(e){return LC.lookAt(e),LC.updateMatrix(),this.applyMatrix4(LC.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(gm).negate(),this.translate(gm.x,gm.y,gm.z),this}setFromPoints(e){const t=[];for(let i=0,r=e.length;i<r;i++){const s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new at(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new us);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new K(-1/0,-1/0,-1/0),new K(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){const s=t[i];Zs.setFromBufferAttribute(s),this.morphTargetsRelative?(Vi.addVectors(this.boundingBox.min,Zs.min),this.boundingBox.expandByPoint(Vi),Vi.addVectors(this.boundingBox.max,Zs.max),this.boundingBox.expandByPoint(Vi)):(this.boundingBox.expandByPoint(Zs.min),this.boundingBox.expandByPoint(Zs.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.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 $r);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new K,1/0);return}if(e){const i=this.boundingSphere.center;if(Zs.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){const a=t[s];lv.setFromBufferAttribute(a),this.morphTargetsRelative?(Vi.addVectors(Zs.min,lv.min),Zs.expandByPoint(Vi),Vi.addVectors(Zs.max,lv.max),Zs.expandByPoint(Vi)):(Zs.expandByPoint(lv.min),Zs.expandByPoint(lv.max))}Zs.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)Vi.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(Vi));if(t)for(let s=0,o=t.length;s<o;s++){const a=t[s],l=this.morphTargetsRelative;for(let c=0,u=a.count;c<u;c++)Vi.fromBufferAttribute(a,c),l&&(gm.fromBufferAttribute(e,c),Vi.add(gm)),r=Math.max(r,i.distanceToSquared(Vi))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new wn(new Float32Array(4*i.count),4));const o=this.getAttribute("tangent"),a=[],l=[];for(let D=0;D<i.count;D++)a[D]=new K,l[D]=new K;const c=new K,u=new K,h=new K,f=new Me,m=new Me,g=new Me,v=new K,w=new K;function y(D,k,C){c.fromBufferAttribute(i,D),u.fromBufferAttribute(i,k),h.fromBufferAttribute(i,C),f.fromBufferAttribute(s,D),m.fromBufferAttribute(s,k),g.fromBufferAttribute(s,C),u.sub(c),h.sub(c),m.sub(f),g.sub(f);const U=1/(m.x*g.y-g.x*m.y);isFinite(U)&&(v.copy(u).multiplyScalar(g.y).addScaledVector(h,-m.y).multiplyScalar(U),w.copy(h).multiplyScalar(m.x).addScaledVector(u,-g.x).multiplyScalar(U),a[D].add(v),a[k].add(v),a[C].add(v),l[D].add(w),l[k].add(w),l[C].add(w))}let _=this.groups;_.length===0&&(_=[{start:0,count:e.count}]);for(let D=0,k=_.length;D<k;++D){const C=_[D],U=C.start,G=C.count;for(let H=U,z=U+G;H<z;H+=3)y(e.getX(H+0),e.getX(H+1),e.getX(H+2))}const x=new K,S=new K,M=new K,A=new K;function I(D){M.fromBufferAttribute(r,D),A.copy(M);const k=a[D];x.copy(k),x.sub(M.multiplyScalar(M.dot(k))).normalize(),S.crossVectors(A,k);const U=S.dot(l[D])<0?-1:1;o.setXYZW(D,x.x,x.y,x.z,U)}for(let D=0,k=_.length;D<k;++D){const C=_[D],U=C.start,G=C.count;for(let H=U,z=U+G;H<z;H+=3)I(e.getX(H+0)),I(e.getX(H+1)),I(e.getX(H+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new wn(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let f=0,m=i.count;f<m;f++)i.setXYZ(f,0,0,0);const r=new K,s=new K,o=new K,a=new K,l=new K,c=new K,u=new K,h=new K;if(e)for(let f=0,m=e.count;f<m;f+=3){const g=e.getX(f+0),v=e.getX(f+1),w=e.getX(f+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,v),o.fromBufferAttribute(t,w),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),a.fromBufferAttribute(i,g),l.fromBufferAttribute(i,v),c.fromBufferAttribute(i,w),a.add(u),l.add(u),c.add(u),i.setXYZ(g,a.x,a.y,a.z),i.setXYZ(v,l.x,l.y,l.z),i.setXYZ(w,c.x,c.y,c.z)}else for(let f=0,m=t.count;f<m;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),i.setXYZ(f+0,u.x,u.y,u.z),i.setXYZ(f+1,u.x,u.y,u.z),i.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)Vi.fromBufferAttribute(e,t),Vi.normalize(),e.setXYZ(t,Vi.x,Vi.y,Vi.z)}toNonIndexed(){function e(a,l){const c=a.array,u=a.itemSize,h=a.normalized,f=new c.constructor(l.length*u);let m=0,g=0;for(let v=0,w=l.length;v<w;v++){a.isInterleavedBufferAttribute?m=l[v]*a.data.stride+a.offset:m=l[v]*u;for(let y=0;y<u;y++)f[g++]=c[m++]}return new wn(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new Ft,i=this.index.array,r=this.attributes;for(const a in r){const l=r[a],c=e(l,i);t.setAttribute(a,c)}const s=this.morphAttributes;for(const a in s){const l=[],c=s[a];for(let u=0,h=c.length;u<h;u++){const f=c[u],m=e(f,i);l.push(m)}t.morphAttributes[a]=l}t.morphTargetsRelative=this.morphTargetsRelative;const o=this.groups;for(let a=0,l=o.length;a<l;a++){const c=o[a];t.addGroup(c.start,c.count,c.materialIndex)}return t}toJSON(){const e={metadata:{version:4.6,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 t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h<f;h++){const m=c[h];u.push(m.toJSON(e.data))}u.length>0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,m=h.length;f<m;f++)u.push(h[f].clone(t));this.morphAttributes[c]=u}this.morphTargetsRelative=e.morphTargetsRelative;const o=e.groups;for(let c=0,u=o.length;c<u;c++){const h=o[c];this.addGroup(h.start,h.count,h.materialIndex)}const a=e.boundingBox;a!==null&&(this.boundingBox=a.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 MV=new wt,Nf=new iy,T_=new $r,TV=new K,ym=new K,vm=new K,wm=new K,UC=new K,P_=new K,C_=new Me,I_=new Me,R_=new Me,PV=new K,CV=new K,IV=new K,N_=new K,D_=new K;class Ai extends ln{constructor(e=new Ft,t=new cf){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),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 t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);const a=this.morphTargetInfluences;if(s&&a){P_.set(0,0,0);for(let l=0,c=s.length;l<c;l++){const u=a[l],h=s[l];u!==0&&(UC.fromBufferAttribute(h,e),o?P_.addScaledVector(UC,u):P_.addScaledVector(UC.sub(t),u))}t.add(P_)}return t}raycast(e,t){const i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),T_.copy(i.boundingSphere),T_.applyMatrix4(s),Nf.copy(e.ray).recast(e.near),!(T_.containsPoint(Nf.origin)===!1&&(Nf.intersectSphere(T_,TV)===null||Nf.origin.distanceToSquared(TV)>(e.far-e.near)**2))&&(MV.copy(s).invert(),Nf.copy(e.ray).applyMatrix4(MV),!(i.boundingBox!==null&&Nf.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Nf)))}_computeIntersections(e,t,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,v=f.length;g<v;g++){const w=f[g],y=o[w.materialIndex],_=Math.max(w.start,m.start),x=Math.min(a.count,Math.min(w.start+w.count,m.start+m.count));for(let S=_,M=x;S<M;S+=3){const A=a.getX(S),I=a.getX(S+1),D=a.getX(S+2);r=O_(this,y,e,i,c,u,h,A,I,D),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=w.materialIndex,t.push(r))}}else{const g=Math.max(0,m.start),v=Math.min(a.count,m.start+m.count);for(let w=g,y=v;w<y;w+=3){const _=a.getX(w),x=a.getX(w+1),S=a.getX(w+2);r=O_(this,o,e,i,c,u,h,_,x,S),r&&(r.faceIndex=Math.floor(w/3),t.push(r))}}else if(l!==void 0)if(Array.isArray(o))for(let g=0,v=f.length;g<v;g++){const w=f[g],y=o[w.materialIndex],_=Math.max(w.start,m.start),x=Math.min(l.count,Math.min(w.start+w.count,m.start+m.count));for(let S=_,M=x;S<M;S+=3){const A=S,I=S+1,D=S+2;r=O_(this,y,e,i,c,u,h,A,I,D),r&&(r.faceIndex=Math.floor(S/3),r.face.materialIndex=w.materialIndex,t.push(r))}}else{const g=Math.max(0,m.start),v=Math.min(l.count,m.start+m.count);for(let w=g,y=v;w<y;w+=3){const _=w,x=w+1,S=w+2;r=O_(this,o,e,i,c,u,h,_,x,S),r&&(r.faceIndex=Math.floor(w/3),t.push(r))}}}}function pRe(n,e,t,i,r,s,o,a){let l;if(e.side===cs?l=i.intersectTriangle(o,s,r,!0,a):l=i.intersectTriangle(r,s,o,e.side===ou,a),l===null)return null;D_.copy(a),D_.applyMatrix4(n.matrixWorld);const c=t.ray.origin.distanceTo(D_);return c<t.near||c>t.far?null:{distance:c,point:D_.clone(),object:n}}function O_(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,ym),n.getVertexPosition(l,vm),n.getVertexPosition(c,wm);const u=pRe(n,e,t,i,ym,vm,wm,N_);if(u){r&&(C_.fromBufferAttribute(r,a),I_.fromBufferAttribute(r,l),R_.fromBufferAttribute(r,c),u.uv=uo.getInterpolation(N_,ym,vm,wm,C_,I_,R_,new Me)),s&&(C_.fromBufferAttribute(s,a),I_.fromBufferAttribute(s,l),R_.fromBufferAttribute(s,c),u.uv1=uo.getInterpolation(N_,ym,vm,wm,C_,I_,R_,new Me)),o&&(PV.fromBufferAttribute(o,a),CV.fromBufferAttribute(o,l),IV.fromBufferAttribute(o,c),u.normal=uo.getInterpolation(N_,ym,vm,wm,PV,CV,IV,new K),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new K,materialIndex:0};uo.getNormal(ym,vm,wm,h.normal),u.face=h}return u}class Ip extends Ft{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let f=0,m=0;g("z","y","x",-1,-1,i,t,e,o,s,0),g("z","y","x",1,-1,i,t,-e,o,s,1),g("x","z","y",1,1,e,i,t,r,o,2),g("x","z","y",1,-1,e,i,-t,r,o,3),g("x","y","z",1,-1,e,t,i,r,s,4),g("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new at(c,3)),this.setAttribute("normal",new at(u,3)),this.setAttribute("uv",new at(h,2));function g(v,w,y,_,x,S,M,A,I,D,k){const C=S/I,U=M/D,G=S/2,H=M/2,z=A/2,P=I+1,R=D+1;let F=0,N=0;const O=new K;for(let B=0;B<R;B++){const W=B*U-H;for(let Q=0;Q<P;Q++){const oe=Q*C-G;O[v]=oe*_,O[w]=W*x,O[y]=z,c.push(O.x,O.y,O.z),O[v]=0,O[w]=0,O[y]=A>0?1:-1,u.push(O.x,O.y,O.z),h.push(Q/I),h.push(1-B/D),F+=1}}for(let B=0;B<D;B++)for(let W=0;W<I;W++){const Q=f+W+P*B,oe=f+W+P*(B+1),Y=f+(W+1)+P*(B+1),te=f+(W+1)+P*B;l.push(Q,oe,te),l.push(oe,Y,te),N+=6}a.addGroup(m,N,k),m+=N,f+=F}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Ip(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function H0(n){const e={};for(const t in n){e[t]={};for(const i in n[t]){const r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function Yr(n){const e={};for(let t=0;t<n.length;t++){const i=H0(n[t]);for(const r in i)e[r]=i[r]}return e}function mRe(n){const e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function QQ(n){return n.getRenderTarget()===null?n.outputColorSpace:pn.workingColorSpace}const ZQ={clone:H0,merge:Yr};var gRe=`void main() {
209	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
210}`,yRe=`void main() {
211	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
212}`;class zs extends jr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=gRe,this.fragmentShader=yRe,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1,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=H0(e.uniforms),this.uniformsGroups=mRe(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 t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const r in this.uniforms){const o=this.uniforms[r].value;o&&o.isTexture?t.uniforms[r]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[r]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[r]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[r]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[r]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[r]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[r]={type:"m4",value:o.toArray()}:t.uniforms[r]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class ax extends ln{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new wt,this.projectionMatrix=new wt,this.projectionMatrixInverse=new wt,this.coordinateSystem=Rl}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const ju=new K,RV=new Me,NV=new Me;class Ki extends ax{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=V0*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Qd*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return V0*2*Math.atan(Math.tan(Qd*.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,t,i){ju.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ju.x,ju.y).multiplyScalar(-e/ju.z),ju.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(ju.x,ju.y).multiplyScalar(-e/ju.z)}getViewSize(e,t){return this.getViewBounds(e,RV,NV),t.subVectors(NV,RV)}setViewOffset(e,t,i,r,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Qd*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,t-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const xm=-90,bm=1;class JQ extends ln{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Ki(xm,bm,e,t);r.layers=this.layers,this.add(r);const s=new Ki(xm,bm,e,t);s.layers=this.layers,this.add(s);const o=new Ki(xm,bm,e,t);o.layers=this.layers,this.add(o);const a=new Ki(xm,bm,e,t);a.layers=this.layers,this.add(a);const l=new Ki(xm,bm,e,t);l.layers=this.layers,this.add(l);const c=new Ki(xm,bm,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Rl)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===u1)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,u]=this.children,h=e.getRenderTarget(),f=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),g=e.xr.enabled;e.xr.enabled=!1;const v=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(t,s),e.setRenderTarget(i,1,r),e.render(t,o),e.setRenderTarget(i,2,r),e.render(t,a),e.setRenderTarget(i,3,r),e.render(t,l),e.setRenderTarget(i,4,r),e.render(t,c),i.texture.generateMipmaps=v,e.setRenderTarget(i,5,r),e.render(t,u),e.setRenderTarget(h,f,m),e.xr.enabled=g,i.texture.needsPMREMUpdate=!0}}class lx extends zn{constructor(e,t,i,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:au,super(e,t,i,r,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class eZ extends $a{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];this.texture=new lx(r,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:On}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`
213
214				varying vec3 vWorldDirection;
215
216				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
217
218					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
219
220				}
221
222				void main() {
223
224					vWorldDirection = transformDirection( position, modelMatrix );
225
226					#include <begin_vertex>
227					#include <project_vertex>
228
229				}
230			`,fragmentShader:`
231
232				uniform sampler2D tEquirect;
233
234				varying vec3 vWorldDirection;
235
236				#include <common>
237
238				void main() {
239
240					vec3 direction = normalize( vWorldDirection );
241
242					vec2 sampleUV = equirectUv( direction );
243
244					gl_FragColor = texture2D( tEquirect, sampleUV );
245
246				}
247			`},r=new Ip(5,5,5),s=new zs({name:"CubemapFromEquirect",uniforms:H0(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:cs,blending:Kc});s.uniforms.tEquirect.value=t;const o=new Ai(r,s),a=t.minFilter;return t.minFilter===Il&&(t.minFilter=On),new JQ(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,r);e.setRenderTarget(s)}}const BC=new K,vRe=new K,wRe=new Nt;class th{constructor(e=new K(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=BC.subVectors(i,t).cross(vRe.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(BC),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||wRe.getNormalMatrix(e),r=this.coplanarPoint(BC).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Df=new $r,L_=new K;class cx{constructor(e=new th,t=new th,i=new th,r=new th,s=new th,o=new th){this.planes=[e,t,i,r,s,o]}set(e,t,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=Rl){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],u=r[5],h=r[6],f=r[7],m=r[8],g=r[9],v=r[10],w=r[11],y=r[12],_=r[13],x=r[14],S=r[15];if(i[0].setComponents(l-s,f-c,w-m,S-y).normalize(),i[1].setComponents(l+s,f+c,w+m,S+y).normalize(),i[2].setComponents(l+o,f+u,w+g,S+_).normalize(),i[3].setComponents(l-o,f-u,w-g,S-_).normalize(),i[4].setComponents(l-a,f-h,w-v,S-x).normalize(),t===Rl)i[5].setComponents(l+a,f+h,w+v,S+x).normalize();else if(t===u1)i[5].setComponents(a,h,v,x).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Df.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Df.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Df)}intersectsSprite(e){return Df.center.set(0,0,0),Df.radius=.7071067811865476,Df.applyMatrix4(e.matrixWorld),this.intersectsSphere(Df)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)<r)return!1;return!0}intersectsBox(e){const t=this.planes;for(let i=0;i<6;i++){const r=t[i];if(L_.x=r.normal.x>0?e.max.x:e.min.x,L_.y=r.normal.y>0?e.max.y:e.min.y,L_.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(L_)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function tZ(){let n=null,e=!1,t=null,i=null;function r(s,o){t(s,o),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function xRe(n,e){const t=e.isWebGL2,i=new WeakMap;function r(c,u){const h=c.array,f=c.usage,m=h.byteLength,g=n.createBuffer();n.bindBuffer(u,g),n.bufferData(u,h,f),c.onUploadCallback();let v;if(h instanceof Float32Array)v=n.FLOAT;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)v=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else v=n.UNSIGNED_SHORT;else if(h instanceof Int16Array)v=n.SHORT;else if(h instanceof Uint32Array)v=n.UNSIGNED_INT;else if(h instanceof Int32Array)v=n.INT;else if(h instanceof Int8Array)v=n.BYTE;else if(h instanceof Uint8Array)v=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)v=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:g,type:v,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version,size:m}}function s(c,u,h){const f=u.array,m=u._updateRange,g=u.updateRanges;if(n.bindBuffer(h,c),m.count===-1&&g.length===0&&n.bufferSubData(h,0,f),g.length!==0){for(let v=0,w=g.length;v<w;v++){const y=g[v];t?n.bufferSubData(h,y.start*f.BYTES_PER_ELEMENT,f,y.start,y.count):n.bufferSubData(h,y.start*f.BYTES_PER_ELEMENT,f.subarray(y.start,y.start+y.count))}u.clearUpdateRanges()}m.count!==-1&&(t?n.bufferSubData(h,m.offset*f.BYTES_PER_ELEMENT,f,m.offset,m.count):n.bufferSubData(h,m.offset*f.BYTES_PER_ELEMENT,f.subarray(m.offset,m.offset+m.count)),m.count=-1),u.onUploadCallback()}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=i.get(c);u&&(n.deleteBuffer(u.buffer),i.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const f=i.get(c);(!f||f.version<c.version)&&i.set(c,{buffer:c.buffer,type:c.type,bytesPerElement:c.elementSize,version:c.version});return}c.isInterleavedBufferAttribute&&(c=c.data);const h=i.get(c);if(h===void 0)i.set(c,r(c,u));else if(h.version<c.version){if(h.size!==c.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.");s(h.buffer,c,u),h.version=c.version}}return{get:o,remove:a,update:l}}class ry extends Ft{constructor(e=1,t=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:i,heightSegments:r};const s=e/2,o=t/2,a=Math.floor(i),l=Math.floor(r),c=a+1,u=l+1,h=e/a,f=t/l,m=[],g=[],v=[],w=[];for(let y=0;y<u;y++){const _=y*f-o;for(let x=0;x<c;x++){const S=x*h-s;g.push(S,-_,0),v.push(0,0,1),w.push(x/a),w.push(1-y/l)}}for(let y=0;y<l;y++)for(let _=0;_<a;_++){const x=_+c*y,S=_+c*(y+1),M=_+1+c*(y+1),A=_+1+c*y;m.push(x,S,A),m.push(S,M,A)}this.setIndex(m),this.setAttribute("position",new at(g,3)),this.setAttribute("normal",new at(v,3)),this.setAttribute("uv",new at(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ry(e.width,e.height,e.widthSegments,e.heightSegments)}}var bRe=`#ifdef USE_ALPHAHASH
248	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
249#endif`,_Re=`#ifdef USE_ALPHAHASH
250	const float ALPHA_HASH_SCALE = 0.05;
251	float hash2D( vec2 value ) {
252		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
253	}
254	float hash3D( vec3 value ) {
255		return hash2D( vec2( hash2D( value.xy ), value.z ) );
256	}
257	float getAlphaHashThreshold( vec3 position ) {
258		float maxDeriv = max(
259			length( dFdx( position.xyz ) ),
260			length( dFdy( position.xyz ) )
261		);
262		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
263		vec2 pixScales = vec2(
264			exp2( floor( log2( pixScale ) ) ),
265			exp2( ceil( log2( pixScale ) ) )
266		);
267		vec2 alpha = vec2(
268			hash3D( floor( pixScales.x * position.xyz ) ),
269			hash3D( floor( pixScales.y * position.xyz ) )
270		);
271		float lerpFactor = fract( log2( pixScale ) );
272		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
273		float a = min( lerpFactor, 1.0 - lerpFactor );
274		vec3 cases = vec3(
275			x * x / ( 2.0 * a * ( 1.0 - a ) ),
276			( x - 0.5 * a ) / ( 1.0 - a ),
277			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
278		);
279		float threshold = ( x < ( 1.0 - a ) )
280			? ( ( x < a ) ? cases.x : cases.y )
281			: cases.z;
282		return clamp( threshold , 1.0e-6, 1.0 );
283	}
284#endif`,ERe=`#ifdef USE_ALPHAMAP
285	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
286#endif`,SRe=`#ifdef USE_ALPHAMAP
287	uniform sampler2D alphaMap;
288#endif`,ARe=`#ifdef USE_ALPHATEST
289	#ifdef ALPHA_TO_COVERAGE
290	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
291	if ( diffuseColor.a == 0.0 ) discard;
292	#else
293	if ( diffuseColor.a < alphaTest ) discard;
294	#endif
295#endif`,MRe=`#ifdef USE_ALPHATEST
296	uniform float alphaTest;
297#endif`,TRe=`#ifdef USE_AOMAP
298	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
299	reflectedLight.indirectDiffuse *= ambientOcclusion;
300	#if defined( USE_CLEARCOAT ) 
301		clearcoatSpecularIndirect *= ambientOcclusion;
302	#endif
303	#if defined( USE_SHEEN ) 
304		sheenSpecularIndirect *= ambientOcclusion;
305	#endif
306	#if defined( USE_ENVMAP ) && defined( STANDARD )
307		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
308		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
309	#endif
310#endif`,PRe=`#ifdef USE_AOMAP
311	uniform sampler2D aoMap;
312	uniform float aoMapIntensity;
313#endif`,CRe=`#ifdef USE_BATCHING
314	attribute float batchId;
315	uniform highp sampler2D batchingTexture;
316	mat4 getBatchingMatrix( const in float i ) {
317		int size = textureSize( batchingTexture, 0 ).x;
318		int j = int( i ) * 4;
319		int x = j % size;
320		int y = j / size;
321		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
322		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
323		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
324		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
325		return mat4( v1, v2, v3, v4 );
326	}
327#endif`,IRe=`#ifdef USE_BATCHING
328	mat4 batchingMatrix = getBatchingMatrix( batchId );
329#endif`,RRe=`vec3 transformed = vec3( position );
330#ifdef USE_ALPHAHASH
331	vPosition = vec3( position );
332#endif`,NRe=`vec3 objectNormal = vec3( normal );
333#ifdef USE_TANGENT
334	vec3 objectTangent = vec3( tangent.xyz );
335#endif`,DRe=`float G_BlinnPhong_Implicit( ) {
336	return 0.25;
337}
338float D_BlinnPhong( const in float shininess, const in float dotNH ) {
339	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
340}
341vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
342	vec3 halfDir = normalize( lightDir + viewDir );
343	float dotNH = saturate( dot( normal, halfDir ) );
344	float dotVH = saturate( dot( viewDir, halfDir ) );
345	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
346	float G = G_BlinnPhong_Implicit( );
347	float D = D_BlinnPhong( shininess, dotNH );
348	return F * ( G * D );
349} // validated`,ORe=`#ifdef USE_IRIDESCENCE
350	const mat3 XYZ_TO_REC709 = mat3(
351		 3.2404542, -0.9692660,  0.0556434,
352		-1.5371385,  1.8760108, -0.2040259,
353		-0.4985314,  0.0415560,  1.0572252
354	);
355	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
356		vec3 sqrtF0 = sqrt( fresnel0 );
357		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
358	}
359	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
360		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
361	}
362	float IorToFresnel0( float transmittedIor, float incidentIor ) {
363		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
364	}
365	vec3 evalSensitivity( float OPD, vec3 shift ) {
366		float phase = 2.0 * PI * OPD * 1.0e-9;
367		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
368		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
369		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
370		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
371		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 ) );
372		xyz /= 1.0685e-7;
373		vec3 rgb = XYZ_TO_REC709 * xyz;
374		return rgb;
375	}
376	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
377		vec3 I;
378		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
379		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
380		float cosTheta2Sq = 1.0 - sinTheta2Sq;
381		if ( cosTheta2Sq < 0.0 ) {
382			return vec3( 1.0 );
383		}
384		float cosTheta2 = sqrt( cosTheta2Sq );
385		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
386		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
387		float T121 = 1.0 - R12;
388		float phi12 = 0.0;
389		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
390		float phi21 = PI - phi12;
391		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
392		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
393		vec3 phi23 = vec3( 0.0 );
394		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
395		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
396		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
397		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
398		vec3 phi = vec3( phi21 ) + phi23;
399		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
400		vec3 r123 = sqrt( R123 );
401		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
402		vec3 C0 = R12 + Rs;
403		I = C0;
404		vec3 Cm = Rs - T121;
405		for ( int m = 1; m <= 2; ++ m ) {
406			Cm *= r123;
407			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
408			I += Cm * Sm;
409		}
410		return max( I, vec3( 0.0 ) );
411	}
412#endif`,LRe=`#ifdef USE_BUMPMAP
413	uniform sampler2D bumpMap;
414	uniform float bumpScale;
415	vec2 dHdxy_fwd() {
416		vec2 dSTdx = dFdx( vBumpMapUv );
417		vec2 dSTdy = dFdy( vBumpMapUv );
418		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
419		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
420		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
421		return vec2( dBx, dBy );
422	}
423	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
424		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
425		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
426		vec3 vN = surf_norm;
427		vec3 R1 = cross( vSigmaY, vN );
428		vec3 R2 = cross( vN, vSigmaX );
429		float fDet = dot( vSigmaX, R1 ) * faceDirection;
430		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
431		return normalize( abs( fDet ) * surf_norm - vGrad );
432	}
433#endif`,URe=`#if NUM_CLIPPING_PLANES > 0
434	vec4 plane;
435	#ifdef ALPHA_TO_COVERAGE
436		float distanceToPlane, distanceGradient;
437		float clipOpacity = 1.0;
438		#pragma unroll_loop_start
439		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
440			plane = clippingPlanes[ i ];
441			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
442			distanceGradient = fwidth( distanceToPlane ) / 2.0;
443			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
444			if ( clipOpacity == 0.0 ) discard;
445		}
446		#pragma unroll_loop_end
447		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
448			float unionClipOpacity = 1.0;
449			#pragma unroll_loop_start
450			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
451				plane = clippingPlanes[ i ];
452				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
453				distanceGradient = fwidth( distanceToPlane ) / 2.0;
454				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
455			}
456			#pragma unroll_loop_end
457			clipOpacity *= 1.0 - unionClipOpacity;
458		#endif
459		diffuseColor.a *= clipOpacity;
460		if ( diffuseColor.a == 0.0 ) discard;
461	#else
462		#pragma unroll_loop_start
463		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
464			plane = clippingPlanes[ i ];
465			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
466		}
467		#pragma unroll_loop_end
468		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
469			bool clipped = true;
470			#pragma unroll_loop_start
471			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
472				plane = clippingPlanes[ i ];
473				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
474			}
475			#pragma unroll_loop_end
476			if ( clipped ) discard;
477		#endif
478	#endif
479#endif`,BRe=`#if NUM_CLIPPING_PLANES > 0
480	varying vec3 vClipPosition;
481	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
482#endif`,kRe=`#if NUM_CLIPPING_PLANES > 0
483	varying vec3 vClipPosition;
484#endif`,FRe=`#if NUM_CLIPPING_PLANES > 0
485	vClipPosition = - mvPosition.xyz;
486#endif`,zRe=`#if defined( USE_COLOR_ALPHA )
487	diffuseColor *= vColor;
488#elif defined( USE_COLOR )
489	diffuseColor.rgb *= vColor;
490#endif`,VRe=`#if defined( USE_COLOR_ALPHA )
491	varying vec4 vColor;
492#elif defined( USE_COLOR )
493	varying vec3 vColor;
494#endif`,HRe=`#if defined( USE_COLOR_ALPHA )
495	varying vec4 vColor;
496#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
497	varying vec3 vColor;
498#endif`,$Re=`#if defined( USE_COLOR_ALPHA )
499	vColor = vec4( 1.0 );
500#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
501	vColor = vec3( 1.0 );
502#endif
503#ifdef USE_COLOR
504	vColor *= color;
505#endif
506#ifdef USE_INSTANCING_COLOR
507	vColor.xyz *= instanceColor.xyz;
508#endif`,GRe=`#define PI 3.141592653589793
509#define PI2 6.283185307179586
510#define PI_HALF 1.5707963267948966
511#define RECIPROCAL_PI 0.3183098861837907
512#define RECIPROCAL_PI2 0.15915494309189535
513#define EPSILON 1e-6
514#ifndef saturate
515#define saturate( a ) clamp( a, 0.0, 1.0 )
516#endif
517#define whiteComplement( a ) ( 1.0 - saturate( a ) )
518float pow2( const in float x ) { return x*x; }
519vec3 pow2( const in vec3 x ) { return x*x; }
520float pow3( const in float x ) { return x*x*x; }
521float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
522float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
523float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
524highp float rand( const in vec2 uv ) {
525	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
526	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
527	return fract( sin( sn ) * c );
528}
529#ifdef HIGH_PRECISION
530	float precisionSafeLength( vec3 v ) { return length( v ); }
531#else
532	float precisionSafeLength( vec3 v ) {
533		float maxComponent = max3( abs( v ) );
534		return length( v / maxComponent ) * maxComponent;
535	}
536#endif
537struct IncidentLight {
538	vec3 color;
539	vec3 direction;
540	bool visible;
541};
542struct ReflectedLight {
543	vec3 directDiffuse;
544	vec3 directSpecular;
545	vec3 indirectDiffuse;
546	vec3 indirectSpecular;
547};
548#ifdef USE_ALPHAHASH
549	varying vec3 vPosition;
550#endif
551vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
552	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
553}
554vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
555	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
556}
557mat3 transposeMat3( const in mat3 m ) {
558	mat3 tmp;
559	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
560	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
561	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
562	return tmp;
563}
564float luminance( const in vec3 rgb ) {
565	const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
566	return dot( weights, rgb );
567}
568bool isPerspectiveMatrix( mat4 m ) {
569	return m[ 2 ][ 3 ] == - 1.0;
570}
571vec2 equirectUv( in vec3 dir ) {
572	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
573	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
574	return vec2( u, v );
575}
576vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
577	return RECIPROCAL_PI * diffuseColor;
578}
579vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
580	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
581	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
582}
583float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
584	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
585	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
586} // validated`,jRe=`#ifdef ENVMAP_TYPE_CUBE_UV
587	#define cubeUV_minMipLevel 4.0
588	#define cubeUV_minTileSize 16.0
589	float getFace( vec3 direction ) {
590		vec3 absDirection = abs( direction );
591		float face = - 1.0;
592		if ( absDirection.x > absDirection.z ) {
593			if ( absDirection.x > absDirection.y )
594				face = direction.x > 0.0 ? 0.0 : 3.0;
595			else
596				face = direction.y > 0.0 ? 1.0 : 4.0;
597		} else {
598			if ( absDirection.z > absDirection.y )
599				face = direction.z > 0.0 ? 2.0 : 5.0;
600			else
601				face = direction.y > 0.0 ? 1.0 : 4.0;
602		}
603		return face;
604	}
605	vec2 getUV( vec3 direction, float face ) {
606		vec2 uv;
607		if ( face == 0.0 ) {
608			uv = vec2( direction.z, direction.y ) / abs( direction.x );
609		} else if ( face == 1.0 ) {
610			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
611		} else if ( face == 2.0 ) {
612			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
613		} else if ( face == 3.0 ) {
614			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
615		} else if ( face == 4.0 ) {
616			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
617		} else {
618			uv = vec2( direction.x, direction.y ) / abs( direction.z );
619		}
620		return 0.5 * ( uv + 1.0 );
621	}
622	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
623		float face = getFace( direction );
624		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
625		mipInt = max( mipInt, cubeUV_minMipLevel );
626		float faceSize = exp2( mipInt );
627		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
628		if ( face > 2.0 ) {
629			uv.y += faceSize;
630			face -= 3.0;
631		}
632		uv.x += face * faceSize;
633		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
634		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
635		uv.x *= CUBEUV_TEXEL_WIDTH;
636		uv.y *= CUBEUV_TEXEL_HEIGHT;
637		#ifdef texture2DGradEXT
638			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
639		#else
640			return texture2D( envMap, uv ).rgb;
641		#endif
642	}
643	#define cubeUV_r0 1.0
644	#define cubeUV_m0 - 2.0
645	#define cubeUV_r1 0.8
646	#define cubeUV_m1 - 1.0
647	#define cubeUV_r4 0.4
648	#define cubeUV_m4 2.0
649	#define cubeUV_r5 0.305
650	#define cubeUV_m5 3.0
651	#define cubeUV_r6 0.21
652	#define cubeUV_m6 4.0
653	float roughnessToMip( float roughness ) {
654		float mip = 0.0;
655		if ( roughness >= cubeUV_r1 ) {
656			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
657		} else if ( roughness >= cubeUV_r4 ) {
658			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
659		} else if ( roughness >= cubeUV_r5 ) {
660			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
661		} else if ( roughness >= cubeUV_r6 ) {
662			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
663		} else {
664			mip = - 2.0 * log2( 1.16 * roughness );		}
665		return mip;
666	}
667	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
668		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
669		float mipF = fract( mip );
670		float mipInt = floor( mip );
671		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
672		if ( mipF == 0.0 ) {
673			return vec4( color0, 1.0 );
674		} else {
675			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
676			return vec4( mix( color0, color1, mipF ), 1.0 );
677		}
678	}
679#endif`,WRe=`vec3 transformedNormal = objectNormal;
680#ifdef USE_TANGENT
681	vec3 transformedTangent = objectTangent;
682#endif
683#ifdef USE_BATCHING
684	mat3 bm = mat3( batchingMatrix );
685	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
686	transformedNormal = bm * transformedNormal;
687	#ifdef USE_TANGENT
688		transformedTangent = bm * transformedTangent;
689	#endif
690#endif
691#ifdef USE_INSTANCING
692	mat3 im = mat3( instanceMatrix );
693	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
694	transformedNormal = im * transformedNormal;
695	#ifdef USE_TANGENT
696		transformedTangent = im * transformedTangent;
697	#endif
698#endif
699transformedNormal = normalMatrix * transformedNormal;
700#ifdef FLIP_SIDED
701	transformedNormal = - transformedNormal;
702#endif
703#ifdef USE_TANGENT
704	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
705	#ifdef FLIP_SIDED
706		transformedTangent = - transformedTangent;
707	#endif
708#endif`,qRe=`#ifdef USE_DISPLACEMENTMAP
709	uniform sampler2D displacementMap;
710	uniform float displacementScale;
711	uniform float displacementBias;
712#endif`,KRe=`#ifdef USE_DISPLACEMENTMAP
713	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
713placementBias );
714#endif`,XRe=`#ifdef USE_EMISSIVEMAP
715	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
716	totalEmissiveRadiance *= emissiveColor.rgb;
717#endif`,YRe=`#ifdef USE_EMISSIVEMAP
718	uniform sampler2D emissiveMap;
719#endif`,QRe="gl_FragColor = linearToOutputTexel( gl_FragColor );",ZRe=`
720const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
721	vec3( 0.8224621, 0.177538, 0.0 ),
722	vec3( 0.0331941, 0.9668058, 0.0 ),
723	vec3( 0.0170827, 0.0723974, 0.9105199 )
724);
725const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
726	vec3( 1.2249401, - 0.2249404, 0.0 ),
727	vec3( - 0.0420569, 1.0420571, 0.0 ),
728	vec3( - 0.0196376, - 0.0786361, 1.0982735 )
729);
730vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
731	return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
732}
733vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
734	return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
735}
736vec4 LinearTransferOETF( in vec4 value ) {
737	return value;
738}
739vec4 sRGBTransferOETF( in vec4 value ) {
740	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 );
741}
742vec4 LinearToLinear( in vec4 value ) {
743	return value;
744}
745vec4 LinearTosRGB( in vec4 value ) {
746	return sRGBTransferOETF( value );
747}`,JRe=`#ifdef USE_ENVMAP
748	#ifdef ENV_WORLDPOS
749		vec3 cameraToFrag;
750		if ( isOrthographic ) {
751			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
752		} else {
753			cameraToFrag = normalize( vWorldPosition - cameraPosition );
754		}
755		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
756		#ifdef ENVMAP_MODE_REFLECTION
757			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
758		#else
759			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
760		#endif
761	#else
762		vec3 reflectVec = vReflect;
763	#endif
764	#ifdef ENVMAP_TYPE_CUBE
765		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
766	#else
767		vec4 envColor = vec4( 0.0 );
768	#endif
769	#ifdef ENVMAP_BLENDING_MULTIPLY
770		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
771	#elif defined( ENVMAP_BLENDING_MIX )
772		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
773	#elif defined( ENVMAP_BLENDING_ADD )
774		outgoingLight += envColor.xyz * specularStrength * reflectivity;
775	#endif
776#endif`,eNe=`#ifdef USE_ENVMAP
777	uniform float envMapIntensity;
778	uniform float flipEnvMap;
779	uniform mat3 envMapRotation;
780	#ifdef ENVMAP_TYPE_CUBE
781		uniform samplerCube envMap;
782	#else
783		uniform sampler2D envMap;
784	#endif
785	
786#endif`,tNe=`#ifdef USE_ENVMAP
787	uniform float reflectivity;
788	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
789		#define ENV_WORLDPOS
790	#endif
791	#ifdef ENV_WORLDPOS
792		varying vec3 vWorldPosition;
793		uniform float refractionRatio;
794	#else
795		varying vec3 vReflect;
796	#endif
797#endif`,nNe=`#ifdef USE_ENVMAP
798	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
799		#define ENV_WORLDPOS
800	#endif
801	#ifdef ENV_WORLDPOS
802		
803		varying vec3 vWorldPosition;
804	#else
805		varying vec3 vReflect;
806		uniform float refractionRatio;
807	#endif
808#endif`,iNe=`#ifdef USE_ENVMAP
809	#ifdef ENV_WORLDPOS
810		vWorldPosition = worldPosition.xyz;
811	#else
812		vec3 cameraToVertex;
813		if ( isOrthographic ) {
814			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
815		} else {
816			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
817		}
818		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
819		#ifdef ENVMAP_MODE_REFLECTION
820			vReflect = reflect( cameraToVertex, worldNormal );
821		#else
822			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
823		#endif
824	#endif
825#endif`,rNe=`#ifdef USE_FOG
826	vFogDepth = - mvPosition.z;
827#endif`,sNe=`#ifdef USE_FOG
828	varying float vFogDepth;
829#endif`,oNe=`#ifdef USE_FOG
830	#ifdef FOG_EXP2
831		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
832	#else
833		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
834	#endif
835	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
836#endif`,aNe=`#ifdef USE_FOG
837	uniform vec3 fogColor;
838	varying float vFogDepth;
839	#ifdef FOG_EXP2
840		uniform float fogDensity;
841	#else
842		uniform float fogNear;
843		uniform float fogFar;
844	#endif
845#endif`,lNe=`#ifdef USE_GRADIENTMAP
846	uniform sampler2D gradientMap;
847#endif
848vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
849	float dotNL = dot( normal, lightDirection );
850	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
851	#ifdef USE_GRADIENTMAP
852		return vec3( texture2D( gradientMap, coord ).r );
853	#else
854		vec2 fw = fwidth( coord ) * 0.5;
855		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
856	#endif
857}`,cNe=`#ifdef USE_LIGHTMAP
858	vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
859	vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
860	reflectedLight.indirectDiffuse += lightMapIrradiance;
861#endif`,uNe=`#ifdef USE_LIGHTMAP
862	uniform sampler2D lightMap;
863	uniform float lightMapIntensity;
864#endif`,hNe=`LambertMaterial material;
865material.diffuseColor = diffuseColor.rgb;
866material.specularStrength = specularStrength;`,fNe=`varying vec3 vViewPosition;
867struct LambertMaterial {
868	vec3 diffuseColor;
869	float specularStrength;
870};
871void 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 ) {
872	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
873	vec3 irradiance = dotNL * directLight.color;
874	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
875}
876void 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 ) {
877	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
878}
879#define RE_Direct				RE_Direct_Lambert
880#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,dNe=`uniform bool receiveShadow;
881uniform vec3 ambientLightColor;
882#if defined( USE_LIGHT_PROBES )
883	uniform vec3 lightProbe[ 9 ];
884#endif
885vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
886	float x = normal.x, y = normal.y, z = normal.z;
887	vec3 result = shCoefficients[ 0 ] * 0.886227;
888	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
889	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
890	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
891	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
892	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
893	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
894	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
895	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
896	return result;
897}
898vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
899	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
900	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
901	return irradiance;
902}
903vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
904	vec3 irradiance = ambientLightColor;
905	return irradiance;
906}
907float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
908	#if defined ( LEGACY_LIGHTS )
909		if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
910			return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
911		}
912		return 1.0;
913	#else
914		float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
915		if ( cutoffDistance > 0.0 ) {
916			distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
917		}
918		return distanceFalloff;
919	#endif
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`,pNe=`#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, roughness * 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`,mNe=`ToonMaterial material;
1037material.diffuseColor = diffuseColor.rgb;`,gNe=`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`,yNe=`BlinnPhongMaterial material;
1050material.diffuseColor = diffuseColor.rgb;
1051material.specularColor = specular;
1052material.specularShininess = shininess;
1053material.specularStrength = specularStrength;`,vNe=`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`,wNe=`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_IRIDESCENCE
1114	material.iridescence = iridescence;
1115	material.iridescenceIOR = iridescenceIOR;
1116	#ifdef USE_IRIDESCENCEMAP
1117		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
1118	#endif
1119	#ifdef USE_IRIDESCENCE_THICKNESSMAP
1120		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
1121	#else
1122		material.iridescenceThickness = iridescenceThicknessMaximum;
1123	#endif
1124#endif
1125#ifdef USE_SHEEN
1126	material.sheenColor = sheenColor;
1127	#ifdef USE_SHEEN_COLORMAP
1128		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
1129	#endif
1130	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
1131	#ifdef USE_SHEEN_ROUGHNESSMAP
1132		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
1133	#endif
1134#endif
1135#ifdef USE_ANISOTROPY
1136	#ifdef USE_ANISOTROPYMAP
1137		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
1138		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
1139		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
1140	#else
1141		vec2 anisotropyV = anisotropyVector;
1142	#endif
1143	material.anisotropy = length( anisotropyV );
1144	if( material.anisotropy == 0.0 ) {
1145		anisotropyV = vec2( 1.0, 0.0 );
1146	} else {
1147		anisotropyV /= material.anisotropy;
1148		material.anisotropy = saturate( material.anisotropy );
1149	}
1150	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
1151	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
1152	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
1153#endif`,xNe=`struct PhysicalMaterial {
1154	vec3 diffuseColor;
1155	float roughness;
1156	vec3 specularColor;
1157	float specularF90
vendor: 14,563 bytes, lines 1157-1453
1157;
1158	#ifdef USE_CLEARCOAT
1159		float clearcoat;
1160		float clearcoatRoughness;
1161		vec3 clearcoatF0;
1162		float clearcoatF90;
1163	#endif
1164	#ifdef USE_IRIDESCENCE
1165		float iridescence;
1166		float iridescenceIOR;
1167		float iridescenceThickness;
1168		vec3 iridescenceFresnel;
1169		vec3 iridescenceF0;
1170	#endif
1171	#ifdef USE_SHEEN
1172		vec3 sheenColor;
1173		float sheenRoughness;
1174	#endif
1175	#ifdef IOR
1176		float ior;
1177	#endif
1178	#ifdef USE_TRANSMISSION
1179		float transmission;
1180		float transmissionAlpha;
1181		float thickness;
1182		float attenuationDistance;
1183		vec3 attenuationColor;
1184	#endif
1185	#ifdef USE_ANISOTROPY
1186		float anisotropy;
1187		float alphaT;
1188		vec3 anisotropyT;
1189		vec3 anisotropyB;
1190	#endif
1191};
1192vec3 clearcoatSpecularDirect = vec3( 0.0 );
1193vec3 clearcoatSpecularIndirect = vec3( 0.0 );
1194vec3 sheenSpecularDirect = vec3( 0.0 );
1195vec3 sheenSpecularIndirect = vec3(0.0 );
1196vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
1197    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
1198    float x2 = x * x;
1199    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
1200    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
1201}
1202float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
1203	float a2 = pow2( alpha );
1204	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
1205	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
1206	return 0.5 / max( gv + gl, EPSILON );
1207}
1208float D_GGX( const in float alpha, const in float dotNH ) {
1209	float a2 = pow2( alpha );
1210	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1211	return RECIPROCAL_PI * a2 / pow2( denom );
1212}
1213#ifdef USE_ANISOTROPY
1214	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 ) {
1215		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1216		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1217		float v = 0.5 / ( gv + gl );
1218		return saturate(v);
1219	}
1220	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1221		float a2 = alphaT * alphaB;
1222		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1223		highp float v2 = dot( v, v );
1224		float w2 = a2 / v2;
1225		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1226	}
1227#endif
1228#ifdef USE_CLEARCOAT
1229	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1230		vec3 f0 = material.clearcoatF0;
1231		float f90 = material.clearcoatF90;
1232		float roughness = material.clearcoatRoughness;
1233		float alpha = pow2( roughness );
1234		vec3 halfDir = normalize( lightDir + viewDir );
1235		float dotNL = saturate( dot( normal, lightDir ) );
1236		float dotNV = saturate( dot( normal, viewDir ) );
1237		float dotNH = saturate( dot( normal, halfDir ) );
1238		float dotVH = saturate( dot( viewDir, halfDir ) );
1239		vec3 F = F_Schlick( f0, f90, dotVH );
1240		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1241		float D = D_GGX( alpha, dotNH );
1242		return F * ( V * D );
1243	}
1244#endif
1245vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1246	vec3 f0 = material.specularColor;
1247	float f90 = material.specularF90;
1248	float roughness = material.roughness;
1249	float alpha = pow2( roughness );
1250	vec3 halfDir = normalize( lightDir + viewDir );
1251	float dotNL = saturate( dot( normal, lightDir ) );
1252	float dotNV = saturate( dot( normal, viewDir ) );
1253	float dotNH = saturate( dot( normal, halfDir ) );
1254	float dotVH = saturate( dot( viewDir, halfDir ) );
1255	vec3 F = F_Schlick( f0, f90, dotVH );
1256	#ifdef USE_IRIDESCENCE
1257		F = mix( F, material.iridescenceFresnel, material.iridescence );
1258	#endif
1259	#ifdef USE_ANISOTROPY
1260		float dotTL = dot( material.anisotropyT, lightDir );
1261		float dotTV = dot( material.anisotropyT, viewDir );
1262		float dotTH = dot( material.anisotropyT, halfDir );
1263		float dotBL = dot( material.anisotropyB, lightDir );
1264		float dotBV = dot( material.anisotropyB, viewDir );
1265		float dotBH = dot( material.anisotropyB, halfDir );
1266		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1267		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1268	#else
1269		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1270		float D = D_GGX( alpha, dotNH );
1271	#endif
1272	return F * ( V * D );
1273}
1274vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1275	const float LUT_SIZE = 64.0;
1276	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1277	const float LUT_BIAS = 0.5 / LUT_SIZE;
1278	float dotNV = saturate( dot( N, V ) );
1279	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1280	uv = uv * LUT_SCALE + LUT_BIAS;
1281	return uv;
1282}
1283float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1284	float l = length( f );
1285	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1286}
1287vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1288	float x = dot( v1, v2 );
1289	float y = abs( x );
1290	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1291	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1292	float v = a / b;
1293	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1294	return cross( v1, v2 ) * theta_sintheta;
1295}
1296vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1297	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1298	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1299	vec3 lightNormal = cross( v1, v2 );
1300	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1301	vec3 T1, T2;
1302	T1 = normalize( V - N * dot( V, N ) );
1303	T2 = - cross( N, T1 );
1304	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
1305	vec3 coords[ 4 ];
1306	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1307	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1308	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1309	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1310	coords[ 0 ] = normalize( coords[ 0 ] );
1311	coords[ 1 ] = normalize( coords[ 1 ] );
1312	coords[ 2 ] = normalize( coords[ 2 ] );
1313	coords[ 3 ] = normalize( coords[ 3 ] );
1314	vec3 vectorFormFactor = vec3( 0.0 );
1315	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1316	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1317	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1318	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1319	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1320	return vec3( result );
1321}
1322#if defined( USE_SHEEN )
1323float D_Charlie( float roughness, float dotNH ) {
1324	float alpha = pow2( roughness );
1325	float invAlpha = 1.0 / alpha;
1326	float cos2h = dotNH * dotNH;
1327	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1328	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1329}
1330float V_Neubelt( float dotNV, float dotNL ) {
1331	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1332}
1333vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1334	vec3 halfDir = normalize( lightDir + viewDir );
1335	float dotNL = saturate( dot( normal, lightDir ) );
1336	float dotNV = saturate( dot( normal, viewDir ) );
1337	float dotNH = saturate( dot( normal, halfDir ) );
1338	float D = D_Charlie( sheenRoughness, dotNH );
1339	float V = V_Neubelt( dotNV, dotNL );
1340	return sheenColor * ( D * V );
1341}
1342#endif
1343float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1344	float dotNV = saturate( dot( normal, viewDir ) );
1345	float r2 = roughness * roughness;
1346	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
1347	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
1348	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
1349	return saturate( DG * RECIPROCAL_PI );
1350}
1351vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1352	float dotNV = saturate( dot( normal, viewDir ) );
1353	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
1354	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
1355	vec4 r = roughness * c0 + c1;
1356	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
1357	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
1358	return fab;
1359}
1360vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1361	vec2 fab = DFGApprox( normal, viewDir, roughness );
1362	return specularColor * fab.x + specularF90 * fab.y;
1363}
1364#ifdef USE_IRIDESCENCE
1365void 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 ) {
1366#else
1367void 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 ) {
1368#endif
1369	vec2 fab = DFGApprox( normal, viewDir, roughness );
1370	#ifdef USE_IRIDESCENCE
1371		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1372	#else
1373		vec3 Fr = specularColor;
1374	#endif
1375	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1376	float Ess = fab.x + fab.y;
1377	float Ems = 1.0 - Ess;
1378	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1379	singleScatter += FssEss;
1380	multiScatter += Fms * Ems;
1381}
1382#if NUM_RECT_AREA_LIGHTS > 0
1383	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 ) {
1384		vec3 normal = geometryNormal;
1385		vec3 viewDir = geometryViewDir;
1386		vec3 position = geometryPosition;
1387		vec3 lightPos = rectAreaLight.position;
1388		vec3 halfWidth = rectAreaLight.halfWidth;
1389		vec3 halfHeight = rectAreaLight.halfHeight;
1390		vec3 lightColor = rectAreaLight.color;
1391		float roughness = material.roughness;
1392		vec3 rectCoords[ 4 ];
1393		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1394		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1395		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1396		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1397		vec4 t1 = texture2D( ltc_1, uv );
1398		vec4 t2 = texture2D( ltc_2, uv );
1399		mat3 mInv = mat3(
1400			vec3( t1.x, 0, t1.y ),
1401			vec3(    0, 1,    0 ),
1402			vec3( t1.z, 0, t1.w )
1403		);
1404		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
1405		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1406		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1407	}
1408#endif
1409void 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 ) {
1410	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1411	vec3 irradiance = dotNL * directLight.color;
1412	#ifdef USE_CLEARCOAT
1413		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1414		vec3 ccIrradiance = dotNLcc * directLight.color;
1415		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1416	#endif
1417	#ifdef USE_SHEEN
1418		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1419	#endif
1420	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
1421	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1422}
1423void 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 ) {
1424	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
1425}
1426void 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) {
1427	#ifdef USE_CLEARCOAT
1428		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1429	#endif
1430	#ifdef USE_SHEEN
1431		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1432	#endif
1433	vec3 singleScattering = vec3( 0.0 );
1434	vec3 multiScattering = vec3( 0.0 );
1435	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1436	#ifdef USE_IRIDESCENCE
1437		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
1438	#else
1439		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
1440	#endif
1441	vec3 totalScattering = singleScattering + multiScattering;
1442	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
1443	reflectedLight.indirectSpecular += radiance * singleScattering;
1444	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
1445	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
1446}
1447#define RE_Direct				RE_Direct_Physical
1448#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1449#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1450#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1451float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1452	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1453}`,
1453bNe=`
1454vec3 geometryPosition = - vViewPosition;
1455vec3 geometryNormal = normal;
1456vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1457vec3 geometryClearcoatNormal = vec3( 0.0 );
1458#ifdef USE_CLEARCOAT
1459	geometryClearcoatNormal = clearcoatNormal;
1460#endif
1461#ifdef USE_IRIDESCENCE
1462	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1463	if ( material.iridescenceThickness == 0.0 ) {
1464		material.iridescence = 0.0;
1465	} else {
1466		material.iridescence = saturate( material.iridescence );
1467	}
1468	if ( material.iridescence > 0.0 ) {
1469		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1470		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1471	}
1472#endif
1473IncidentLight directLight;
1474#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1475	PointLight pointLight;
1476	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1477	PointLightShadow pointLightShadow;
1478	#endif
1479	#pragma unroll_loop_start
1480	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1481		pointLight = pointLights[ i ];
1482		getPointLightInfo( pointLight, geometryPosition, directLight );
1483		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
1484		pointLightShadow = pointLightShadows[ i ];
1485		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1486		#endif
1487		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1488	}
1489	#pragma unroll_loop_end
1490#endif
1491#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1492	SpotLight spotLight;
1493	vec4 spotColor;
1494	vec3 spotLightCoord;
1495	bool inSpotLightMap;
1496	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1497	SpotLightShadow spotLightShadow;
1498	#endif
1499	#pragma unroll_loop_start
1500	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1501		spotLight = spotLights[ i ];
1502		getSpotLightInfo( spotLight, geometryPosition, directLight );
1503		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1504		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1505		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1506		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1507		#else
1508		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1509		#endif
1510		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1511			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1512			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1513			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1514			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1515		#endif
1516		#undef SPOT_LIGHT_MAP_INDEX
1517		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1518		spotLightShadow = spotLightShadows[ i ];
1519		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1520		#endif
1521		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1522	}
1523	#pragma unroll_loop_end
1524#endif
1525#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1526	DirectionalLight directionalLight;
1527	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1528	DirectionalLightShadow directionalLightShadow;
1529	#endif
1530	#pragma unroll_loop_start
1531	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1532		directionalLight = directionalLights[ i ];
1533		getDirectionalLightInfo( directionalLight, directLight );
1534		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1535		directionalLightShadow = directionalLightShadows[ i ];
1536		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1537		#endif
1538		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1539	}
1540	#pragma unroll_loop_end
1541#endif
1542#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1543	RectAreaLight rectAreaLight;
1544	#pragma unroll_loop_start
1545	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1546		rectAreaLight = rectAreaLights[ i ];
1547		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1548	}
1549	#pragma unroll_loop_end
1550#endif
1551#if defined( RE_IndirectDiffuse )
1552	vec3 iblIrradiance = vec3( 0.0 );
1553	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1554	#if defined( USE_LIGHT_PROBES )
1555		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1556	#endif
1557	#if ( NUM_HEMI_LIGHTS > 0 )
1558		#pragma unroll_loop_start
1559		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1560			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1561		}
1562		#pragma unroll_loop_end
1563	#endif
1564#endif
1565#if defined( RE_IndirectSpecular )
1566	vec3 radiance = vec3( 0.0 );
1567	vec3 clearcoatRadiance = vec3( 0.0 );
1568#endif`,_Ne=`#if defined( RE_IndirectDiffuse )
1569	#ifdef USE_LIGHTMAP
1570		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1571		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1572		irradiance += lightMapIrradiance;
1573	#endif
1574	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
1575		iblIrradiance += getIBLIrradiance( geometryNormal );
1576	#endif
1577#endif
1578#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1579	#ifdef USE_ANISOTROPY
1580		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1581	#else
1582		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1583	#endif
1584	#ifdef USE_CLEARCOAT
1585		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1586	#endif
1587#endif`,ENe=`#if defined( RE_IndirectDiffuse )
1588	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1589#endif
1590#if defined( RE_IndirectSpecular )
1591	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1592#endif`,SNe=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1593	gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1594#endif`,ANe=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
1595	uniform float logDepthBufFC;
1596	varying float vFragDepth;
1597	varying float vIsPerspective;
1598#endif`,MNe=`#ifdef USE_LOGDEPTHBUF
1599	#ifdef USE_LOGDEPTHBUF_EXT
1600		varying float vFragDepth;
1601		varying float vIsPerspective;
1602	#else
1603		uniform float logDepthBufFC;
1604	#endif
1605#endif`,TNe=`#ifdef USE_LOGDEPTHBUF
1606	#ifdef USE_LOGDEPTHBUF_EXT
1607		vFragDepth = 1.0 + gl_Position.w;
1608		vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1609	#else
1610		if ( isPerspectiveMatrix( projectionMatrix ) ) {
1611			gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
1612			gl_Position.z *= gl_Position.w;
1613		}
1614	#endif
1615#endif`,PNe=`#ifdef USE_MAP
1616	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1617	#ifdef DECODE_VIDEO_TEXTURE
1618		sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
1619	
1620	#endif
1621	diffuseColor *= sampledDiffuseColor;
1622#endif`,CNe=`#ifdef USE_MAP
1623	uniform sampler2D map;
1624#endif`,INe=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1625	#if defined( USE_POINTS_UV )
1626		vec2 uv = vUv;
1627	#else
1628		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1629	#endif
1630#endif
1631#ifdef USE_MAP
1632	diffuseColor *= texture2D( map, uv );
1633#endif
1634#ifdef USE_ALPHAMAP
1635	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1636#endif`,RNe=`#if defined( USE_POINTS_UV )
1637	varying vec2 vUv;
1638#else
1639	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1640		uniform mat3 uvTransform;
1641	#endif
1642#endif
1643#ifdef USE_MAP
1644	uniform sampler2D map;
1645#endif
1646#ifdef USE_ALPHAMAP
1647	uniform sampler2D alphaMap;
1648#endif`,NNe=`float metalnessFactor = metalness;
1649#ifdef USE_METALNESSMAP
1650	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1651	metalnessFactor *= texelMetalness.b;
1652#endif`,DNe=`#ifdef USE_METALNESSMAP
1653	uniform sampler2D metalnessMap;
1654#endif`,ONe=`#ifdef USE_INSTANCING_MORPH
1655	float morphTargetInfluences[MORPHTARGETS_COUNT];
1656	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1657	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1658		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1659	}
1660#endif`,LNe=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
1661	vColor *= morphTargetBaseInfluence;
1662	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1663		#if defined( USE_COLOR_ALPHA )
1664			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1665		#elif defined( USE_COLOR )
1666			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1667		#endif
1668	}
1669#endif`,UNe=`#ifdef USE_MORPHNORMALS
1670	objectNormal *= morphTargetBaseInfluence;
1671	#ifdef MORPHTARGETS_TEXTURE
1672		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1673			if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1674		}
1675	#else
1676		objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
1677		objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
1678		objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
1679		objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
1680	#endif
1681#endif`,BNe=`#ifdef USE_MORPHTARGETS
1682	#ifndef USE_INSTANCING_MORPH
1683		uniform float morphTargetBaseInfluence;
1684	#endif
1685	#ifdef MORPHTARGETS_TEXTURE
1686		#ifndef USE_INSTANCING_MORPH
1687			uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1688		#endif
1689		uniform sampler2DArray morphTargetsTexture;
1690		uniform ivec2 morphTargetsTextureSize;
1691		vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1692			int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1693			int y = texelIndex / morphTargetsTextureSize.x;
1694			int x = texelIndex - y * morphTargetsTextureSize.x;
1695			ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1696			return texelFetch( morphTargetsTexture, morphUV, 0 );
1697		}
1698	#else
1699		#ifndef USE_MORPHNORMALS
1700			uniform float morphTargetInfluences[ 8 ];
1701		#else
1702			uniform float morphTargetInfluences[ 4 ];
1703		#endif
1704	#endif
1705#endif`,kNe=`#ifdef USE_MORPHTARGETS
1706	transformed *= morphTargetBaseInfluence;
1707	#ifdef MORPHTARGETS_TEXTURE
1708		for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1709			if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1710		}
1711	#else
1712		transformed += morphTarget0 * morphTargetInfluences[ 0 ];
1713		transformed += morphTarget1 * morphTargetInfluences[ 1 ];
1714		transformed += morphTarget2 * morphTargetInfluences[ 2 ];
1715		transformed += morphTarget3 * morphTargetInfluences[ 3 ];
1716		#ifndef USE_MORPHNORMALS
1717			transformed += morphTarget4 * morphTargetInfluences[ 4 ];
1718			transformed += morphTarget5 * morphTargetInfluences[ 5 ];
1719			transformed += morphTarget6 * morphTargetInfluences[ 6 ];
1720			transformed += morphTarget7 * morphTargetInfluences[ 7 ];
1721		#endif
1722	#endif
1723#endif`,FNe=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1724#ifdef FLAT_SHADED
1725	vec3 fdx = dFdx( vViewPosition );
1726	vec3 fdy = dFdy( vViewPosition );
1727	vec3 normal = normalize( cross( fdx, fdy ) );
1728#else
1729	vec3 normal = normalize( vNormal );
1730	#ifdef DOUBLE_SIDED
1731		normal *= faceDirection;
1732	#endif
1733#endif
1734#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1735	#ifdef USE_TANGENT
1736		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1737	#else
1738		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1739		#if defined( USE_NORMALMAP )
1740			vNormalMapUv
1741		#elif defined( USE_CLEARCOAT_NORMALMAP )
1742			vClearcoatNormalMapUv
1743		#else
1744			vUv
1745		#endif
1746		);
1747	#endif
1748	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1749		tbn[0] *= faceDirection;
1750		tbn[1] *= faceDirection;
1751	#endif
1752#endif
1753#ifdef USE_CLEARCOAT_NORMALMAP
1754	#ifdef USE_TANGENT
1755		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1756	#else
1757		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1758	#endif
1759	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1760		tbn2[0] *= faceDirection;
1761		tbn2[1] *= faceDirection;
1762	#endif
1763#endif
1764vec3 nonPerturbedNormal = normal;`,zNe=`#ifdef USE_NORMALMAP_OBJECTSPACE
1765	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1766	#ifdef FLIP_SIDED
1767		normal = - normal;
1768	#endif
1769	#ifdef DOUBLE_SIDED
1770		normal = normal * faceDirection;
1771	#endif
1772	normal = normalize( normalMatrix * normal );
1773#elif defined( USE_NORMALMAP_TANGENTSPACE )
1774	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1775	mapN.xy *= normalScale;
1776	normal = normalize( tbn * mapN );
1777#elif defined( USE_BUMPMAP )
1778	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1779#endif`,VNe=`#ifndef FLAT_SHADED
1780	varying vec3 vNormal;
1781	#ifdef USE_TANGENT
1782		varying vec3 vTangent;
1783		varying vec3 vBitangent;
1784	#endif
1785#endif`,HNe=`#ifndef FLAT_SHADED
1786	varying vec3 vNormal;
1787	#ifdef USE_TANGENT
1788		varying vec3 vTangent;
1789		varying vec3 vBitangent;
1790	#endif
1791#endif`,$Ne=`#ifndef FLAT_SHADED
1792	vNormal = normalize( transformedNormal );
1793	#ifdef USE_TANGENT
1794		vTangent = normalize( transformedTangent );
1795		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1796	#endif
1797#endif`,GNe=`#ifdef USE_NORMALMAP
1798	uniform sampler2D normalMap;
1799	uniform vec2 normalScale;
1800#endif
1801#ifdef USE_NORMALMAP_OBJECTSPACE
1802	uniform mat3 normalMatrix;
1803#endif
1804#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1805	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1806		vec3 q0 = dFdx( eye_pos.xyz );
1807		vec3 q1 = dFdy( eye_pos.xyz );
1808		vec2 st0 = dFdx( uv.st );
1809		vec2 st1 = dFdy( uv.st );
1810		vec3 N = surf_norm;
1811		vec3 q1perp = cross( q1, N );
1812		vec3 q0perp = cross( N, q0 );
1813		vec3 T = q1perp * st0.x + q0perp * st1.x;
1814		vec3 B = q1perp * st0.y + q0perp * st1.y;
1815		float det = max( dot( T, T ), dot( B, B ) );
1816		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1817		return mat3( T * scale, B * scale, N );
1818	}
1819#endif`,jNe=`#ifdef USE_CLEARCOAT
1820	vec3 clearcoatNormal = nonPerturbedNormal;
1821#endif`,WNe=`#ifdef USE_CLEARCOAT_NORMALMAP
1822	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1823	clearcoatMapN.xy *= clearcoatNormalScale;
1824	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1825#endif`,qNe=`#ifdef USE_CLEARCOATMAP
1826	uniform sampler2D clearcoatMap;
1827#endif
1828#ifdef USE_CLEARCOAT_NORMALMAP
1829	uniform sampler2D clearcoatNormalMap;
1830	uniform vec2 clearcoatNormalScale;
1831#endif
1832#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1833	uniform sampler2D clearcoatRoughnessMap;
1834#endif`,KNe=`#ifdef USE_IRIDESCENCEMAP
1835	uniform sampler2D iridescenceMap;
1836#endif
1837#ifdef USE_IRIDESCENCE_THICKNESSMAP
1838	uniform sampler2D iridescenceThicknessMap;
1839#endif`,XNe=`#ifdef OPAQUE
1840diffuseColor.a = 1.0;
1841#endif
1842#ifdef USE_TRANSMISSION
1843diffuseColor.a *= material.transmissionAlpha;
1844#endif
1845gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,YNe=`vec3 packNormalToRGB( const in vec3 normal ) {
1846	return normalize( normal ) * 0.5 + 0.5;
1847}
1848vec3 unpackRGBToNormal( const in vec3 rgb ) {
1849	return 2.0 * rgb.xyz - 1.0;
1850}
1851const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
1852const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
1853const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
1854const float ShiftRight8 = 1. / 256.;
1855vec4 packDepthToRGBA( const in float v ) {
1856	vec4 r = vec4( fract( v * PackFactors ), v );
1857	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
1858}
1859float unpackRGBAToDepth( const in vec4 v ) {
1860	return dot( v, UnpackFactors );
1861}
1862vec2 packDepthToRG( in highp float v ) {
1863	return packDepthToRGBA( v ).yx;
1864}
1865float unpackRGToDepth( const in highp vec2 v ) {
1866	return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
1867}
1868vec4 pack2HalfToRGBA( vec2 v ) {
1869	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1870	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1871}
1872vec2 unpackRGBATo2Half( vec4 v ) {
1873	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1874}
1875float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1876	return ( viewZ + near ) / ( near - far );
1877}
1878float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1879	return depth * ( near - far ) - near;
1880}
1881float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1882	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1883}
1884float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1885	return ( near * far ) / ( ( far - near ) * depth - far );
1886}`,QNe=`#ifdef PREMULTIPLIED_ALPHA
1887	gl_FragColor.rgb *= gl_FragColor.a;
1888#endif`,ZNe=`vec4 mvPosition = vec4( transformed, 1.0 );
1889#ifdef USE_BATCHING
1890	mvPosition = batchingMatrix * mvPosition;
1891#endif
1892#ifdef USE_INSTANCING
1893	mvPosition = instanceMatrix * mvPosition;
1894#endif
1895mvPosition = modelViewMatrix * mvPosition;
1896gl_Position = projectionMatrix * mvPosition;`,JNe=`#ifdef DITHERING
1897	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1898#endif`,eDe=`#ifdef DITHERING
1899	vec3 dithering( vec3 color ) {
1900		float grid_position = rand( gl_FragCoord.xy );
1901		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1902		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1903		return color + dither_shift_RGB;
1904	}
1905#endif`,tDe=`float roughnessFactor = roughness;
1906#ifdef USE_ROUGHNESSMAP
1907	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1908	roughnessFactor *= texelRoughness.g;
1909#endif`,nDe=`#ifdef USE_ROUGHNESSMAP
1910	uniform sampler2D roughnessMap;
1911#endif`,iDe=`#if NUM_SPOT_LIGHT_COORDS > 0
1912	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1913#endif
1914#if NUM_SPOT_LIGHT_MAPS > 0
1915	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1916#endif
1917#ifdef USE_SHADOWMAP
1918	#if NUM_DIR_LIGHT_SHADOWS > 0
1919		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1920		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1921		struct DirectionalLightShadow {
1922			float shadowBias;
1923			float shadowNormalBias;
1924			float shadowRadius;
1925			vec2 shadowMapSize;
1926		};
1927		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1928	#endif
1929	#if NUM_SPOT_LIGHT_SHADOWS > 0
1930		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1931		struct SpotLightShadow {
1932			float shadowBias;
1933			float shadowNormalBias;
1934			float shadowRadius;
1935			vec2 shadowMapSize;
1936		};
1937		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1938	#endif
1939	#if NUM_POINT_LIGHT_SHADOWS > 0
1940		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1941		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1942		struct PointLightShadow {
1943			float shadowBias;
1944			float shadowNormalBias;
1945			float shadowRadius;
1946			vec2 shadowMapSize;
1947			float shadowCameraNear;
1948			float shadowCameraFar;
1949		};
1950		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1951	#endif
1952	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
1953		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
1954	}
1955	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
1956		return unpackRGBATo2Half( texture2D( shadow, uv ) );
1957	}
1958	float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
1959		float occlusion = 1.0;
1960		vec2 distribution = texture2DDistribution( shadow, uv );
1961		float hard_shadow = step( compare , distribution.x );
1962		if (hard_shadow != 1.0 ) {
1963			float distance = compare - distribution.x ;
1964			float variance = max( 0.00000, distribution.y * distribution.y );
1965			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 );
1966		}
1967		return occlusion;
1968	}
1969	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1970		float shadow = 1.0;
1971		shadowCoord.xyz /= shadowCoord.w;
1972		shadowCoord.z += shadowBias;
1973		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1974		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1975		if ( frustumTest ) {
1976		#if defined( SHADOWMAP_TYPE_PCF )
1977			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1978			float dx0 = - texelSize.x * shadowRadius;
1979			float dy0 = - texelSize.y * shadowRadius;
1980			float dx1 = + texelSize.x * shadowRadius;
1981			float dy1 = + texelSize.y * shadowRadius;
1982			float dx2 = dx0 / 2.0;
1983			float dy2 = dy0 / 2.0;
1984			float dx3 = dx1 / 2.0;
1985			float dy3 = dy1 / 2.0;
1986			shadow = (
1987				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
1988				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
1989				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
1990				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
1991				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
1992				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
1993				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
1994				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
1995				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
1996				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
1997				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
1998				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
1999				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
2000				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
2001				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
2002				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
2003				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
2004			) * ( 1.0 / 17.0 );
2005		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
2006			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
2007			float dx = texelSize.x;
2008			float dy = texelSize.y;
2009			vec2 uv = shadowCoord.xy;
2010			vec2 f = fract( uv * shadowMapSize + 0.5 );
2011			uv -= f * texelSize;
2012			shadow = (
2013				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
2014				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
2015				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
2016				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
2017				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
2018					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
2019					 f.x ) +
2020				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
2021					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
2022					 f.x ) +
2023				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
2024					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
2025					 f.y ) +
2026				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
2027					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
2028					 f.y ) +
2029				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
2030						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
2031						  f.x ),
2032					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
2033						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
2034						  f.x ),
2035					 f.y )
2036			) * ( 1.0 / 9.0 );
2037		#elif defined( SHADOWMAP_TYPE_VSM )
2038			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
2039		#else
2040			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
2041		#endif
2042		}
2043		return shadow;
2044	}
2045	vec2 cubeToUV( vec3 v, float texelSizeY ) {
2046		vec3 absV = abs( v );
2047		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
2048		absV *= scaleToCube;
2049		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
2050		vec2 planar = v.xy;
2051		float almostATexel = 1.5 * texelSizeY;
2052		float almostOne = 1.0 - almostATexel;
2053		if ( absV.z >= almostOne ) {
2054			if ( v.z > 0.0 )
2055				planar.x = 4.0 - v.x;
2056		} else if ( absV.x >= almostOne ) {
2057			float signX = sign( v.x );
2058			planar.x = v.z * signX + 2.0 * signX;
2059		} else if ( absV.y >= almostOne ) {
2060			float signY = sign( v.y );
2061			planar.x = v.x + 2.0 * signY + 2.0;
2062			planar.y = v.z * signY - 2.0;
2063		}
2064		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
2065	}
2066	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
2067		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
2068		vec3 lightToPosition = shadowCoord.xyz;
2069		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
2070		vec3 bd3D = normalize( lightToPosition );
2071		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
2072			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
2073			return (
2074				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
2075				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
2076				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
2077				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
2078				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
2079				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
2080				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
2081				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
2082				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
2083			) * ( 1.0 / 9.0 );
2084		#else
2085			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
2086		#endif
2087	}
2088#endif`,rDe=`#if NUM_SPOT_LIGHT_COORDS > 0
2089	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
2090	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
2091#endif
2092#ifdef USE_SHADOWMAP
2093	#if NUM_DIR_LIGHT_SHADOWS > 0
2094		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
2095		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
2096		struct DirectionalLightShadow {
2097			float shadowBias;
2098			float shadowNormalBias;
2099			float shadowRadius;
2100			vec2 shadowMapSize;
2101		};
2102		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
2103	#endif
2104	#if NUM_SPOT_LIGHT_SHADOWS > 0
2105		struct SpotLightShadow {
2106			float shadowBias;
2107			float shadowNormalBias;
2108			float shadowRadius;
2109			vec2 shadowMapSize;
2110		};
2111		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
2112	#endif
2113	#if NUM_POINT_LIGHT_SHADOWS > 0
2114		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
2115		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
2116		struct PointLightShadow {
2117			float shadowBias;
2118			float shadowNormalBias;
2119			float shadowRadius;
2120			vec2 shadowMapSize;
2121			float shadowCameraNear;
2122			float shadowCameraFar;
2123		};
2124		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
2125	#endif
2126#endif`,sDe=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2127	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2128	vec4 shadowWorldPosition;
2129#endif
2130#if defined( USE_SHADOWMAP )
2131	#if NUM_DIR_LIGHT_SHADOWS > 0
2132		#pragma unroll_loop_start
2133		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2134			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2135			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2136		}
2137		#pragma unroll_loop_end
2138	#endif
2139	#if NUM_POINT_LIGHT_SHADOWS > 0
2140		#pragma unroll_loop_start
2141		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2142			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2143			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2144		}
2145		#pragma unroll_loop_end
2146	#endif
2147#endif
2148#if NUM_SPOT_LIGHT_COORDS > 0
2149	#pragma unroll_loop_start
2150	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2151		shadowWorldPosition = worldPosition;
2152		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2153			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2154		#endif
2155		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2156	}
2157	#pragma unroll_loop_end
2158#endif`,oDe=`float getShadowMask() {
2159	float shadow = 1.0;
2160	#ifdef USE_SHADOWMAP
2161	#if NUM_DIR_LIGHT_SHADOWS > 0
2162	DirectionalLightShadow directionalLight;
2163	#pragma unroll_loop_start
2164	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2165		directionalLight = directionalLightShadows[ i ];
2166		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2167	}
2168	#pragma unroll_loop_end
2169	#endif
2170	#if NUM_SPOT_LIGHT_SHADOWS > 0
2171	SpotLightShadow spotLight;
2172	#pragma unroll_loop_start
2173	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2174		spotLight = spotLightShadows[ i ];
2175		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2176	}
2177	#pragma unroll_loop_end
2178	#endif
2179	#if NUM_POINT_LIGHT_SHADOWS > 0
2180	PointLightShadow pointLight;
2181	#pragma unroll_loop_start
2182	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2183		pointLight = pointLightShadows[ i ];
2184		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2185	}
2186	#pragma unroll_loop_end
2187	#endif
2188	#endif
2189	return shadow;
2190}`,aDe=`#ifdef USE_SKINNING
2191	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2192	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2193	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2194	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2195#endif`,lDe=`#ifdef USE_SKINNING
2196	uniform mat4 bindMatrix;
2197	uniform mat4 bindMatrixInverse;
2198	uniform highp sampler2D boneTexture;
2199	mat4 getBoneMatrix( const in float i ) {
2200		int size = textureSize( boneTexture, 0 ).x;
2201		int j = int( i ) * 4;
2202		int x = j % size;
2203		int y = j / size;
2204		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2205		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2206		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2207		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2208		return mat4( v1, v2, v3, v4 );
2209	}
2210#endif`,cDe=`#ifdef USE_SKINNING
2211	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2212	vec4 skinned = vec4( 0.0 );
2213	skinned += boneMatX * skinVertex * skinWeight.x;
2214	skinned += boneMatY * skinVertex * skinWeight.y;
2215	skinned += boneMatZ * skinVertex * skinWeight.z;
2216	skinned += boneMatW * skinVertex * skinWeight.w;
2217	transformed = ( bindMatrixInverse * skinned ).xyz;
2218#endif`,uDe=`#ifdef USE_SKINNING
2219	mat4 skinMatrix = mat4( 0.0 );
2220	skinMatrix += skinWeight.x * boneMatX;
2221	skinMatrix += skinWeight.y * boneMatY;
2222	skinMatrix += skinWeight.z * boneMatZ;
2223	skinMatrix += skinWeight.w * boneMatW;
2224	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2225	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2226	#ifdef USE_TANGENT
2227		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2228	#endif
2229#endif`,hDe=`float specularStrength;
2230#ifdef USE_SPECULARMAP
2231	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2232	specularStrength = texelSpecular.r;
2233#else
2234	specularStrength = 1.0;
2235#endif`,fDe=`#ifdef USE_SPECULARMAP
2236	uniform sampler2D specularMap;
2237#endif`,dDe=`#if defined( TONE_MAPPING )
2238	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2239#endif`,pDe=`#ifndef saturate
2240#define saturate( a ) clamp( a, 0.0, 1.0 )
2241#endif
2242uniform float toneMappingExposure;
2243vec3 LinearToneMapping( vec3 color ) {
2244	return saturate( toneMappingExposure * color );
2245}
2246vec3 ReinhardToneMapping( vec3 color ) {
2247	color *= toneMappingExposure;
2248	return saturate( color / ( vec3( 1.0 ) + color ) );
2249}
2250vec3 OptimizedCineonToneMapping( vec3 color ) {
2251	color *= toneMappingExposure;
2252	color = max( vec3( 0.0 ), color - 0.004 );
2253	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2254}
2255vec3 RRTAndODTFit( vec3 v ) {
2256	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2257	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2258	return a / b;
2259}
2260vec3 ACESFilmicToneMapping( vec3 color ) {
2261	const mat3 ACESInputMat = mat3(
2262		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2263		vec3( 0.04823, 0.01566, 0.83777 )
2264	);
2265	const mat3 ACESOutputMat = mat3(
2266		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2267		vec3( -0.07367, -0.00605,  1.07602 )
2268	);
2269	color *= toneMappingExposure / 0.6;
2270	color = ACESInputMat * color;
2271	color = RRTAndODTFit( color );
2272	color = ACESOutputMat * color;
2273	return saturate( color );
2274}
2275const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2276	vec3( 1.6605, - 0.1246, - 0.0182 ),
2277	vec3( - 0.5876, 1.1329, - 0.1006 ),
2278	vec3( - 0.0728, - 0.0083, 1.1187 )
2279);
2280const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2281	vec3( 0.6274, 0.0691, 0.0164 ),
2282	vec3( 0.3293, 0.9195, 0.0880 ),
2283	vec3( 0.0433, 0.0113, 0.8956 )
2284);
2285vec3 agxDefaultContrastApprox( vec3 x ) {
2286	vec3 x2 = x * x;
2287	vec3 x4 = x2 * x2;
2288	return + 15.5 * x4 * x2
2289		- 40.14 * x4 * x
2290		+ 31.96 * x4
2291		- 6.868 * x2 * x
2292		+ 0.4298 * x2
2293		+ 0.1191 * x
2294		- 0.00232;
2295}
2296vec3 AgXToneMapping( vec3 color ) {
2297	const mat3 AgXInsetMatrix = mat3(
2298		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2299		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2300		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2301	);
2302	const mat3 AgXOutsetMatrix = mat3(
2303		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2304		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2305		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2306	);
2307	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2308	color *= toneMappingExposure;
2309	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2310	color = AgXInsetMatrix * color;
2311	color = max( color, 1e-10 );	color = log2( color );
2312	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2313	color = clamp( color, 0.0, 1.0 );
2314	color = agxDefaultContrastApprox( color );
2315	color = AgXOutsetMatrix * color;
2316	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2317	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2318	color = clamp( color, 0.0, 1.0 );
2319	return color;
2320}
2321vec3 NeutralToneMapping( vec3 color ) {
2322	float startCompression = 0.8 - 0.04;
2323	float desaturation = 0.15;
2324	color *= toneMappingExposure;
2325	float x = min(color.r, min(color.g, color.b));
2326	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2327	color -= offset;
2328	float peak = max(color.r, max(color.g, color.b));
2329	if (peak < startCompression) return color;
2330	float d = 1. - startCompression;
2331	float newPeak = 1. - d * d / (peak + d - startCompression);
2332	color *= newPeak / peak;
2333	float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);
2334	return mix(color, vec3(1, 1, 1), g);
2335}
2336vec3 CustomToneMapping( vec3 color ) { return color; }`,mDe=`#ifdef USE_TRANSMISSION
2337	material.transmission = transmission;
2338	material.transmissionAlpha = 1.0;
2339	material.thickness = thickness;
2340	material.attenuationDistance = attenuationDistance;
2341	material.attenuationColor = attenuationColor;
2342	#ifdef USE_TRANSMISSIONMAP
2343		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2344	#endif
2345	#ifdef USE_THICKNESSMAP
2346		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2347	#endif
2348	vec3 pos = vWorldPosition;
2349	vec3 v = normalize( cameraPosition - pos );
2350	vec3 n = inverseTransformDirection( normal, viewMatrix );
2351	vec4 transmitted = getIBLVolumeRefraction(
2352		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
2353		pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
2354		material.attenuationColor, material.attenuationDistance );
2355	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2356	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2357#endif`,gDe=`#ifdef USE_TRANSMISSION
2358	uniform float transmission;
2359	uniform float thickness;
2360	uniform float attenuationDistance;
2361	uniform vec3 attenuationColor;
2362	#ifdef USE_TRANSMISSIONMAP
2363		uniform sampler2D transmissionMap;
2364	#endif
2365	#ifdef USE_THICKNESSMAP
2366		uniform sampler2D thicknessMap;
2367	#endif
2368	uniform vec2 transmissionSamplerSize;
2369	uniform sampler2D transmissionSamplerMap;
2370	uniform mat4 modelMatrix;
2371	uniform mat4 projectionMatrix;
2372	varying vec3 vWorldPosition;
2373	float w0( float a ) {
2374		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2375	}
2376	float w1( float a ) {
2377		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2378	}
2379	float w2( float a ){
2380		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2381	}
2382	float w3( float a ) {
2383		return ( 1.0 / 6.0 ) * ( a * a * a );
2384	}
2385	float g0( float a ) {
2386		return w0( a ) + w1( a );
2387	}
2388	float g1( float a ) {
2389		return w2( a ) + w3( a );
2390	}
2391	float h0( float a ) {
2392		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2393	}
2394	float h1( float a ) {
2395		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2396	}
2397	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2398		uv = uv * texelSize.zw + 0.5;
2399		vec2 iuv = floor( uv );
2400		vec2 fuv = fract( uv );
2401		float g0x = g0( fuv.x );
2402		float g1x = g1( fuv.x );
2403		float h0x = h0( fuv.x );
2404		float h1x = h1( fuv.x );
2405		float h0y = h0( fuv.y );
2406		float h1y = h1( fuv.y );
2407		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2408		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2409		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2410		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2411		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2412			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2413	}
2414	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2415		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2416		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2417		vec2 fLodSizeInv = 1.0 / fLodSize;
2418		vec2 cLodSizeInv = 1.0 / cLodSize;
2419		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2420		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2421		return mix( fSample, cSample, fract( lod ) );
2422	}
2423	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2424		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2425		vec3 modelScale;
2426		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2427		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2428		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2429		return normalize( refractionVector ) * thickness * modelScale;
2430	}
2431	float applyIorToRoughness( const in float roughness, const in float ior ) {
2432		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2433	}
2434	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2435		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2436		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2437	}
2438	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2439		if ( isinf( attenuationDistance ) ) {
2440			return vec3( 1.0 );
2441		} else {
2442			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2443			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2444		}
2445	}
2446	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2447		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2448		const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
2449		const in vec3 attenuationColor, const in float attenuationDistance ) {
2450		vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2451		vec3 refractedRayExit = position + transmissionRay;
2452		vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2453		vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2454		refractionCoords += 1.0;
2455		refractionCoords /= 2.0;
2456		vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2457		vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2458		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2459		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2460		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2461		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2462	}
2463#endif`,yDe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2464	varying vec2 vUv;
2465#endif
2466#ifdef USE_MAP
2467	varying vec2 vMapUv;
2468#endif
2469#ifdef USE_ALPHAMAP
2470	varying vec2 vAlphaMapUv;
2471#endif
2472#ifdef USE_LIGHTMAP
2473	varying vec2 vLightMapUv;
2474#endif
2475#ifdef USE_AOMAP
2476	varying vec2 vAoMapUv;
2477#endif
2478#ifdef USE_BUMPMAP
2479	varying vec2 vBumpMapUv;
2480#endif
2481#ifdef USE_NORMALMAP
2482	varying vec2 vNormalMapUv;
2483#endif
2484#ifdef USE_EMISSIVEMAP
2485	varying vec2 vEmissiveMapUv;
2486#endif
2487#ifdef USE_METALNESSMAP
2488	varying vec2 vMetalnessMapUv;
2489#endif
2490#ifdef USE_ROUGHNESSMAP
2491	varying vec2 vRoughnessMapUv;
2492#endif
2493#ifdef USE_ANISOTROPYMAP
2494	varying vec2 vAnisotropyMapUv;
2495#endif
2496#ifdef USE_CLEARCOATMAP
2497	varying vec2 vClearcoatMapUv;
2498#endif
2499#ifdef USE_CLEARCOAT_NORMALMAP
2500	varying vec2 vClearcoatNormalMapUv;
2501#endif
2502#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2503	varying vec2 vClearcoatRoughnessMapUv;
2504#endif
2505#ifdef USE_IRIDESCENCEMAP
2506	varying vec2 vIridescenceMapUv;
2507#endif
2508#ifdef USE_IRIDESCENCE_THICKNESSMAP
2509	varying vec2 vIridescenceThicknessMapUv;
2510#endif
2511#ifdef USE_SHEEN_COLORMAP
2512	varying vec2 vSheenColorMapUv;
2513#endif
2514#ifdef USE_SHEEN_ROUGHNESSMAP
2515	varying vec2 vSheenRoughnessMapUv;
2516#endif
2517#ifdef USE_SPECULARMAP
2518	varying vec2 vSpecularMapUv;
2519#endif
2520#ifdef USE_SPECULAR_COLORMAP
2521	varying vec2 vSpecularColorMapUv;
2522#endif
2523#ifdef USE_SPECULAR_INTENSITYMAP
2524	varying vec2 vSpecularIntensityMapUv;
2525#endif
2526#ifdef USE_TRANSMISSIONMAP
2527	uniform mat3 transmissionMapTransform;
2528	varying vec2 vTransmissionMapUv;
2529#endif
2530#ifdef USE_THICKNESSMAP
2531	uniform mat3 thicknessMapTransform;
2532	varying vec2 vThicknessMapUv;
2533#endif`,vDe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2534	varying vec2 vUv;
2535#endif
2536#ifdef USE_MAP
2537	uniform mat3 mapTransform;
2538	varying vec2 vMapUv;
2539#endif
2540#ifdef USE_ALPHAMAP
2541	uniform mat3 alphaMapTransform;
2542	varying vec2 vAlphaMapUv;
2543#endif
2544#ifdef USE_LIGHTMAP
2545	uniform mat3 lightMapTransform;
2546	varying vec2 vLightMapUv;
2547#endif
2548#ifdef USE_AOMAP
2549	uniform mat3 aoMapTransform;
2550	varying vec2 vAoMapUv;
2551#endif
2552#ifdef USE_BUMPMAP
2553	uniform mat3 bumpMapTransform;
2554	varying vec2 vBumpMapUv;
2555#endif
2556#ifdef USE_NORMALMAP
2557	uniform mat3 normalMapTransform;
2558	varying vec2 vNormalMapUv;
2559#endif
2560#ifdef USE_DISPLACEMENTMAP
2561	uniform mat3 displacementMapTransform;
2562	varying vec2 vDisplacementMapUv;
2563#endif
2564#ifdef USE_EMISSIVEMAP
2565	uniform mat3 emissiveMapTransform;
2566	varying vec2 vEmissiveMapUv;
2567#endif
2568#ifdef USE_METALNESSMAP
2569	uniform mat3 metalnessMapTransform;
2570	varying vec2 vMetalnessMapUv;
2571#endif
2572#ifdef USE_ROUGHNESSMAP
2573	uniform mat3 roughnessMapTransform;
2574	varying vec2 vRoughnessMapUv;
2575#endif
2576#ifdef USE_ANISOTROPYMAP
2577	uniform mat3 anisotropyMapTransform;
2578	varying vec2 vAnisotropyMapUv;
2579#endif
2580#ifdef USE_CLEARCOATMAP
2581	uniform mat3 clearcoatMapTransform;
2582	varying vec2 vClearcoatMapUv;
2583#endif
2584#ifdef USE_CLEARCOAT_NORMALMAP
2585	uniform mat3 clearcoatNormalMapTransform;
2586	varying vec2 vClearcoatNormalMapUv;
2587#endif
2588#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2589	uniform mat3 clearcoatRoughnessMapTransform;
2590	varying vec2 vClearcoatRoughnessMapUv;
2591#endif
2592#ifdef USE_SHEEN_COLORMAP
2593	uniform mat3 sheenColorMapTransform;
2594	varying vec2 vSheenColorMapUv;
2595#endif
2596#ifdef USE_SHEEN_ROUGHNESSMAP
2597	uniform mat3 sheenRoughnessMapTransform;
2598	varying vec2 vSheenRoughnessMapUv;
2599#endif
2600#ifdef USE_IRIDESCENCEMAP
2601	uniform mat3 iridescenceMapTransform;
2602	varying vec2 vIridescenceMapUv;
2603#endif
2604#ifdef USE_IRIDESCENCE_THICKNESSMAP
2605	uniform mat3 iridescenceThicknessMapTransform;
2606	varying vec2 vIridescenceThicknessMapUv;
2607#endif
2608#ifdef USE_SPECULARMAP
2609	uniform mat3 specularMapTransform;
2610	varying vec2 vSpecularMapUv;
2611#endif
2612#ifdef USE_SPECULAR_COLORMAP
2613	uniform mat3 specularColorMapTransform;
2614	varying vec2 vSpecularColorMapUv;
2615#endif
2616#ifdef USE_SPECULAR_INTENSITYMAP
2617	uniform mat3 specularIntensityMapTransform;
2618	varying vec2 vSpecularIntensityMapUv;
2619#endif
2620#ifdef USE_TRANSMISSIONMAP
2621	uniform mat3 transmissionMapTransform;
2622	varying vec2 vTransmissionMapUv;
2623#endif
2624#ifdef USE_THICKNESSMAP
2625	uniform mat3 thicknessMapTransform;
2626	varying vec2 vThicknessMapUv;
2627#endif`,wDe=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2628	vUv = vec3( uv, 1 ).xy;
2629#endif
2630#ifdef USE_MAP
2631	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2632#endif
2633#ifdef USE_ALPHAMAP
2634	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2635#endif
2636#ifdef USE_LIGHTMAP
2637	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2638#endif
2639#ifdef USE_AOMAP
2640	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2641#endif
2642#ifdef USE_BUMPMAP
2643	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2644#endif
2645#ifdef USE_NORMALMAP
2646	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2647#endif
2648#ifdef USE_DISPLACEMENTMAP
2649	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2650#endif
2651#ifdef USE_EMISSIVEMAP
2652	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2653#endif
2654#ifdef USE_METALNESSMAP
2655	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2656#endif
2657#ifdef USE_ROUGHNESSMAP
2658	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2659#endif
2660#ifdef USE_ANISOTROPYMAP
2661	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2662#endif
2663#ifdef USE_CLEARCOATMAP
2664	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2665#endif
2666#ifdef USE_CLEARCOAT_NORMALMAP
2667	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2668#endif
2669#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2670	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2671#endif
2672#ifdef USE_IRIDESCENCEMAP
2673	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2674#endif
2675#ifdef USE_IRIDESCENCE_THICKNESSMAP
2676	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2677#endif
2678#ifdef USE_SHEEN_COLORMAP
2679	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2680#endif
2681#ifdef USE_SHEEN_ROUGHNESSMAP
2682	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2683#endif
2684#ifdef USE_SPECULARMAP
2685	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2686#endif
2687#ifdef USE_SPECULAR_COLORMAP
2688	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2689#endif
2690#ifdef USE_SPECULAR_INTENSITYMAP
2691	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2692#endif
2693#ifdef USE_TRANSMISSIONMAP
2694	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2695#endif
2696#ifdef USE_THICKNESSMAP
2697	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2698#endif`,xDe=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2699	vec4 worldPosition = vec4( transformed, 1.0 );
2700	#ifdef USE_BATCHING
2701		worldPosition = batchingMatrix * worldPosition;
2702	#endif
2703	#ifdef USE_INSTANCING
2704		worldPosition = instanceMatrix * worldPosition;
2705	#endif
2706	worldPosition = modelMatrix * worldPosition;
2707#endif`;const bDe=`varying vec2 vUv;
2708uniform mat3 uvTransform;
2709void main() {
2710	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2711	gl_Position = vec4( position.xy, 1.0, 1.0 );
2712}`,_De=`uniform sampler2D t2D;
2713uniform float backgroundIntensity;
2714varying vec2 vUv;
2715void main() {
2716	vec4 texColor = texture2D( t2D, vUv );
2717	#ifdef DECODE_VIDEO_TEXTURE
2718		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 );
2719	#endif
2720	texColor.rgb *= backgroundIntensity;
2721	gl_FragColor = texColor;
2722	#include <tonemapping_fragment>
2723	#include <colorspace_fragment>
2724}`,EDe=`varying vec3 vWorldDirection;
2725#include <common>
2726void main() {
2727	vWorldDirection = transformDirection( position, modelMatrix );
2728	#include <begin_vertex>
2729	#include <project_vertex>
2730	gl_Position.z = gl_Position.w;
2731}`,SDe=`#ifdef ENVMAP_TYPE_CUBE
2732	uniform samplerCube envMap;
2733#elif defined( ENVMAP_TYPE_CUBE_UV )
2734	uniform sampler2D envMap;
2735#endif
2736uniform float flipEnvMap;
2737uniform float backgroundBlurriness;
2738uniform float backgroundIntensity;
2739uniform mat3 backgroundRotation;
2740varying vec3 vWorldDirection;
2741#include <cube_uv_reflection_fragment>
2742void main() {
2743	#ifdef ENVMAP_TYPE_CUBE
2744		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2745	#elif defined( ENVMAP_TYPE_CUBE_UV )
2746		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2747	#else
2748		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2749	#endif
2750	texColor.rgb *= backgroundIntensity;
2751	gl_FragColor = texColor;
2752	#include <tonemapping_fragment>
2753	#include <colorspace_fragment>
2754}`,ADe=`varying vec3 vWorldDirection;
2755#include <common>
2756void main() {
2757	vWorldDirection = transformDirection( position, modelMatrix );
2758	#include <begin_vertex>
2759	#include <project_vertex>
2760	gl_Position.z = gl_Position.w;
2761}`,MDe=`uniform samplerCube tCube;
2762uniform float tFlip;
2763uniform float opacity;
2764varying vec3 vWorldDirection;
2765void main() {
2766	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2767	gl_FragColor = texColor;
2768	gl_FragColor.a *= opacity;
2769	#include <tonemapping_fragment>
2770	#include <colorspace_fragment>
2771}`,TDe=`#include <common>
2772#include <batching_pars_vertex>
2773#include <uv_pars_vertex>
2774#include <displacementmap_pars_vertex>
2775#include <morphtarget_pars_vertex>
2776#include <skinning_pars_vertex>
2777#include <logdepthbuf_pars_vertex>
2778#include <clipping_planes_pars_vertex>
2779varying vec2 vHighPrecisionZW;
2780void main() {
2781	#include <uv_vertex>
2782	#include <batching_vertex>
2783	#include <skinbase_vertex>
2784	#include <morphinstance_vertex>
2785	#ifdef USE_DISPLACEMENTMAP
2786		#include <beginnormal_vertex>
2787		#include <morphnormal_vertex>
2788		#include <skinnormal_vertex>
2789	#endif
2790	#include <begin_vertex>
2791	#include <morphtarget_vertex>
2792	#include <skinning_vertex>
2793	#include <displacementmap_vertex>
2794	#include <project_vertex>
2795	#include <logdepthbuf_vertex>
2796	#include <clipping_planes_vertex>
2797	vHighPrecisionZW = gl_Position.zw;
2798}`,PDe=`#if DEPTH_PACKING == 3200
2799	uniform float opacity;
2800#endif
2801#include <common>
2802#include <packing>
2803#include <uv_pars_fragment>
2804#include <map_pars_fragment>
2805#include <alphamap_pars_fragment>
2806#include <alphatest_pars_fragment>
2807#include <alphahash_pars_fragment>
2808#include <logdepthbuf_pars_fragment>
2809#include <clipping_planes_pars_fragment>
2810varying vec2 vHighPrecisionZW;
2811void main() {
2812	vec4 diffuseColor = vec4( 1.0 );
2813	#include <clipping_planes_fragment>
2814	#if DEPTH_PACKING == 3200
2815		diffuseColor.a = opacity;
2816	#endif
2817	#include <map_fragment>
2818	#include <alphamap_fragment>
2819	#include <alphatest_fragment>
2820	#include <alphahash_fragment>
2821	#include <logdepthbuf_fragment>
2822	float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
2823	#if DEPTH_PACKING == 3200
2824		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2825	#elif DEPTH_PACKING == 3201
2826		gl_FragColor = packDepthToRGBA( fragCoordZ );
2827	#endif
2828}`,CDe=`#define DISTANCE
2829varying vec3 vWorldPosition;
2830#include <common>
2831#include <batching_pars_vertex>
2832#include <uv_pars_vertex>
2833#include <displacementmap_pars_vertex>
2834#include <morphtarget_pars_vertex>
2835#include <skinning_pars_vertex>
2836#include <clipping_planes_pars_vertex>
2837void main() {
2838	#include <uv_vertex>
2839	#include <batching_vertex>
2840	#include <skinbase_vertex>
2841	#include <morphinstance_vertex>
2842	#ifdef USE_DISPLACEMENTMAP
2843		#include <beginnormal_vertex>
2844		#include <morphnormal_vertex>
2845		#include <skinnormal_vertex>
2846	#endif
2847	#include <begin_vertex>
2848	#include <morphtarget_vertex>
2849	#include <skinning_vertex>
2850	#include <displacementmap_vertex>
2851	#include <project_vertex>
2852	#include <worldpos_vertex>
2853	#include <clipping_planes_vertex>
2854	vWorldPosition = worldPosition.xyz;
2855}`,IDe=`#define DISTANCE
2856uniform vec3 referencePosition;
2857uniform float nearDistance;
2858uniform float farDistance;
2859varying vec3 vWorldPosition;
2860#include <common>
2861#include <packing>
2862#include <uv_pars_fragment>
2863#include <map_pars_fragment>
2864#include <alphamap_pars_fragment>
2865#include <alphatest_pars_fragment>
2866#include <alphahash_pars_fragment>
2867#include <clipping_planes_pars_fragment>
2868void main () {
2869	vec4 diffuseColor = vec4( 1.0 );
2870	#include <clipping_planes_fragment>
2871	#include <map_fragment>
2872	#include <alphamap_fragment>
2873	#include <alphatest_fragment>
2874	#include <alphahash_fragment>
2875	float dist = length( vWorldPosition - referencePosition );
2876	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2877	dist = saturate( dist );
2878	gl_FragColor = packDepthToRGBA( dist );
2879}`,RDe=`varying vec3 vWorldDirection;
2880#include <common>
2881void main() {
2882	vWorldDirection = transformDirection( position, modelMatrix );
2883	#include <begin_vertex>
2884	#include <project_vertex>
2885}`,NDe=`uniform sampler2D tEquirect;
2886varying vec3 vWorldDirection;
2887#include <common>
2888void main() {
2889	vec3 direction = normalize( vWorldDirection );
2890	vec2 sampleUV = equirectUv( direction );
2891	gl_FragColor = texture2D( tEquirect, sampleUV );
2892	#include <tonemapping_fragment>
2893	#include <colorspace_fragment>
2894}`,DDe=`uniform float scale;
2895attribute float lineDistance;
2896varying float vLineDistance;
2897#include <common>
2898#include <uv_pars_vertex>
2899#include <color_pars_vertex>
2900#include <fog_pars_vertex>
2901#include <morphtarget_pars_vertex>
2902#include <logdepthbuf_pars_vertex>
2903#include <clipping_planes_pars_vertex>
2904void main() {
2905	vLineDistance = scale * lineDistance;
2906	#include <uv_vertex>
2907	#include <color_vertex>
2908	#include <morphinstance_vertex>
2909	#include <morphcolor_vertex>
2910	#include <begin_vertex>
2911	#include <morphtarget_vertex>
2912	#include <project_vertex>
2913	#include <logdepthbuf_vertex>
2914	#include <clipping_planes_vertex>
2915	#include <fog_vertex>
2916}`,ODe=`uniform vec3 diffuse;
2917uniform float opacity;
2918uniform float dashSize;
2919uniform float totalSize;
2920varying float vLineDistance;
2921#include <common>
2922#include <color_pars_fragment>
2923#include <uv_pars_fragment>
2924#include <map_pars_fragment>
2925#include <fog_pars_fragment>
2926#include <logdepthbuf_pars_fragment>
2927#include <clipping_planes_pars_fragment>
2928void main() {
2929	vec4 diffuseColor = vec4( diffuse, opacity );
2930	#include <clipping_planes_fragment>
2931	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2932		discard;
2933	}
2934	vec3 outgoingLight = vec3( 0.0 );
2935	#include <logdepthbuf_fragment>
2936	#include <map_fragment>
2937	#include <color_fragment>
2938	outgoingLight = diffuseColor.rgb;
2939	#include <opaque_fragment>
2940	#include <tonemapping_fragment>
2941	#include <colorspace_fragment>
2942	#include <fog_fragment>
2943	#include <premultiplied_alpha_fragment>
2944}`,LDe=`#include <common>
2945#include <batching_pars_vertex>
2946#include <uv_pars_vertex>
2947#include <envmap_pars_vertex>
2948#include <color_pars_vertex>
2949#include <fog_pars_vertex>
2950#include <morphtarget_pars_vertex>
2951#include <skinning_pars_vertex>
2952#include <logdepthbuf_pars_vertex>
2953#include <clipping_planes_pars_vertex>
2954void main() {
2955	#include <uv_vertex>
2956	#include <color_vertex>
2957	#include <morphinstance_vertex>
2958	#include <morphcolor_vertex>
2959	#include <batching_vertex>
2960	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2961		#include <beginnormal_vertex>
2962		#include <morphnormal_vertex>
2963		#include <skinbase_vertex>
2964		#include <skinnormal_vertex>
2965		#include <defaultnormal_vertex>
2966	#endif
2967	#include <begin_vertex>
2968	#include <morphtarget_vertex>
2969	#include <skinning_vertex>
2970	#include <project_vertex>
2971	#include <logdepthbuf_vertex>
2972	#include <clipping_planes_vertex>
2973	#include <worldpos_vertex>
2974	#include <envmap_vertex>
2975	#include <fog_vertex>
2976}`,UDe=`uniform vec3 diffuse;
2977uniform float opacity;
2978#ifndef FLAT_SHADED
2979	varying vec3 vNormal;
2980#endif
2981#include <common>
2982#include <dithering_pars_fragment>
2983#include <color_pars_fragment>
2984#include <uv_pars_fragment>
2985#include <map_pars_fragment>
2986#include <alphamap_pars_fragment>
2987#include <alphatest_pars_fragment>
2988#include <alphahash_pars_fragment>
2989#include <aomap_pars_fragment>
2990#include <lightmap_pars_fragment>
2991#include <envmap_common_pars_fragment>
2992#include <envmap_pars_fragment>
2993#include <fog_pars_fragment>
2994#include <specularmap_pars_fragment>
2995#include <logdepthbuf_pars_fragment>
2996#include <clipping_planes_pars_fragment>
2997void main() {
2998	vec4 diffuseColor = vec4( diffuse, opacity );
2999	#include <clipping_planes_fragment>
3000	#include <logdepthbuf_fragment>
3001	#include <map_fragment>
3002	#include <color_fragment>
3003	#include <alphamap_fragment>
3004	#include <alphatest_fragment>
3005	#include <alphahash_fragment>
3006	#include <specularmap_fragment>
3007	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3008	#ifdef USE_LIGHTMAP
3009		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
3010		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
3011	#else
3012		reflectedLight.indirectDiffuse += vec3( 1.0 );
3013	#endif
3014	#include <aomap_fragment>
3015	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
3016	vec3 outgoingLight = reflectedLight.indirectDiffuse;
3017	#include <envmap_fragment>
3018	#include <opaque_fragment>
3019	#include <tonemapping_fragment>
3020	#include <colorspace_fragment>
3021	#include <fog_fragment>
3022	#include <premultiplied_alpha_fragment>
3023	#include <dithering_fragment>
3024}`,BDe=`#define LAMBERT
3025varying vec3 vViewPosition;
3026#include <common>
3027#include <batching_pars_vertex>
3028#include <uv_pars_vertex>
3029#include <displacementmap_pars_vertex>
3030#include <envmap_pars_vertex>
3031#include <color_pars_vertex>
3032#include <fog_pars_vertex>
3033#include <normal_pars_vertex>
3034#include <morphtarget_pars_vertex>
3035#include <skinning_pars_vertex>
3036#include <shadowmap_pars_vertex>
3037#include <logdepthbuf_pars_vertex>
3038#include <clipping_planes_pars_vertex>
3039void main() {
3040	#include <uv_vertex>
3041	#include <color_vertex>
3042	#include <morphinstance_vertex>
3043	#include <morphcolor_vertex>
3044	#include <batching_vertex>
3045	#include <beginnormal_vertex>
3046	#include <morphnormal_vertex>
3047	#include <skinbase_vertex>
3048	#include <skinnormal_vertex>
3049	#include <defaultnormal_vertex>
3050	#include <normal_vertex>
3051	#include <begin_vertex>
3052	#include <morphtarget_vertex>
3053	#include <skinning_vertex>
3054	#include <displacementmap_vertex>
3055	#include <project_vertex>
3056	#include <logdepthbuf_vertex>
3057	#include <clipping_planes_vertex>
3058	vViewPosition = - mvPosition.xyz;
3059	#include <worldpos_vertex>
3060	#include <envmap_vertex>
3061	#include <shadowmap_vertex>
3062	#include <fog_vertex>
3063}`,kDe=`#define LAMBERT
3064uniform vec3 diffuse;
3065uniform vec3 emissive;
3066uniform float opacity;
3067#include <common>
3068#include <packing>
3069#include <dithering_pars_fragment>
3070#include <color_pars_fragment>
3071#include <uv_pars_fragment>
3072#include <map_pars_fragment>
3073#include <alphamap_pars_fragment>
3074#include <alphatest_pars_fragment>
3075#include <alphahash_pars_fragment>
3076#include <aomap_pars_fragment>
3077#include <lightmap_pars_fragment>
3078#include <emissivemap_pars_fragment>
3079#include <envmap_common_pars_fragment>
3080#include <envmap_pars_fragment>
3081#include <fog_pars_fragment>
3082#include <bsdfs>
3083#include <lights_pars_begin>
3084#include <normal_pars_fragment>
3085#include <lights_lambert_pars_fragment>
3086#include <shadowmap_pars_fragment>
3087#include <bumpmap_pars_fragment>
3088#include <normalmap_pars_fragment>
3089#include <specularmap_pars_fragment>
3090#include <logdepthbuf_pars_fragment>
3091#include <clipping_planes_pars_fragment>
3092void main() {
3093	vec4 diffuseColor = vec4( diffuse, opacity );
3094	#include <clipping_planes_fragment>
3095	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3096	vec3 totalEmissiveRadiance = emissive;
3097	#include <logdepthbuf_fragment>
3098	#include <map_fragment>
3099	#include <color_fragment>
3100	#include <alphamap_fragment>
3101	#include <alphatest_fragment>
3102	#include <alphahash_fragment>
3103	#include <specularmap_fragment>
3104	#include <normal_fragment_begin>
3105	#include <normal_fragment_maps>
3106	#include <emissivemap_fragment>
3107	#include <lights_lambert_fragment>
3108	#include <lights_fragment_begin>
3109	#include <lights_fragment_maps>
3110	#include <lights_fragment_end>
3111	#include <aomap_fragment>
3112	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3113	#include <envmap_fragment>
3114	#include <opaque_fragment>
3115	#include <tonemapping_fragment>
3116	#include <colorspace_fragment>
3117	#include <fog_fragment>
3118	#include <premultiplied_alpha_fragment>
3119	#include <dithering_fragment>
3120}`,FDe=`#define MATCAP
3121varying vec3 vViewPosition;
3122#include <common>
3123#include <batching_pars_vertex>
3124#include <uv_pars_vertex>
3125#include <color_pars_vertex>
3126#include <displacementmap_pars_vertex>
3127#include <fog_pars_vertex>
3128#include <normal_pars_vertex>
3129#include <morphtarget_pars_vertex>
3130#include <skinning_pars_vertex>
3131#include <logdepthbuf_pars_vertex>
3132#include <clipping_planes_pars_vertex>
3133void main() {
3134	#include <uv_vertex>
3135	#include <color_vertex>
3136	#include <morphinstance_vertex>
3137	#include <morphcolor_vertex>
3138	#include <batching_vertex>
3139	#include <beginnormal_vertex>
3140	#include <morphnormal_vertex>
3141	#include <skinbase_vertex>
3142	#include <skinnormal_vertex>
3143	#include <defaultnormal_vertex>
3144	#include <normal_vertex>
3145	#include <begin_vertex>
3146	#include <morphtarget_vertex>
3147	#include <skinning_vertex>
3148	#include <displacementmap_vertex>
3149	#include <project_vertex>
3150	#include <logdepthbuf_vertex>
3151	#include <clipping_planes_vertex>
3152	#include <fog_vertex>
3153	vViewPosition = - mvPosition.xyz;
3154}`,zDe=`#define MATCAP
3155uniform vec3 diffuse;
3156uniform float opacity;
3157uniform sampler2D matcap;
3158varying vec3 vViewPosition;
3159#include <common>
3160#include <dithering_pars_fragment>
3161#include <color_pars_fragment>
3162#include <uv_pars_fragment>
3163#include <map_pars_fragment>
3164#include <alphamap_pars_fragment>
3165#include <alphatest_pars_fragment>
3166#include <alphahash_pars_fragment>
3167#include <fog_pars_fragment>
3168#include <normal_pars_fragment>
3169#include <bumpmap_pars_fragment>
3170#include <normalmap_pars_fragment>
3171#include <logdepthbuf_pars_fragment>
3172#include <clipping_planes_pars_fragment>
3173void main() {
3174	vec4 diffuseColor = vec4( diffuse, opacity );
3175	#include <clipping_planes_fragment>
3176	#include <logdepthbuf_fragment>
3177	#include <map_fragment>
3178	#include <color_fragm
3178ent>
3179	#include <alphamap_fragment>
3180	#include <alphatest_fragment>
3181	#include <alphahash_fragment>
3182	#include <normal_fragment_begin>
3183	#include <normal_fragment_maps>
3184	vec3 viewDir = normalize( vViewPosition );
3185	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3186	vec3 y = cross( viewDir, x );
3187	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3188	#ifdef USE_MATCAP
3189		vec4 matcapColor = texture2D( matcap, uv );
3190	#else
3191		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3192	#endif
3193	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3194	#include <opaque_fragment>
3195	#include <tonemapping_fragment>
3196	#include <colorspace_fragment>
3197	#include <fog_fragment>
3198	#include <premultiplied_alpha_fragment>
3199	#include <dithering_fragment>
3200}`,VDe=`#define NORMAL
3201#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3202	varying vec3 vViewPosition;
3203#endif
3204#include <common>
3205#include <batching_pars_vertex>
3206#include <uv_pars_vertex>
3207#include <displacementmap_pars_vertex>
3208#include <normal_pars_vertex>
3209#include <morphtarget_pars_vertex>
3210#include <skinning_pars_vertex>
3211#include <logdepthbuf_pars_vertex>
3212#include <clipping_planes_pars_vertex>
3213void main() {
3214	#include <uv_vertex>
3215	#include <batching_vertex>
3216	#include <beginnormal_vertex>
3217	#include <morphinstance_vertex>
3218	#include <morphnormal_vertex>
3219	#include <skinbase_vertex>
3220	#include <skinnormal_vertex>
3221	#include <defaultnormal_vertex>
3222	#include <normal_vertex>
3223	#include <begin_vertex>
3224	#include <morphtarget_vertex>
3225	#include <skinning_vertex>
3226	#include <displacementmap_vertex>
3227	#include <project_vertex>
3228	#include <logdepthbuf_vertex>
3229	#include <clipping_planes_vertex>
3230#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3231	vViewPosition = - mvPosition.xyz;
3232#endif
3233}`,HDe=`#define NORMAL
3234uniform float opacity;
3235#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3236	varying vec3 vViewPosition;
3237#endif
3238#include <packing>
3239#include <uv_pars_fragment>
3240#include <normal_pars_fragment>
3241#include <bumpmap_pars_fragment>
3242#include <normalmap_pars_fragment>
3243#include <logdepthbuf_pars_fragment>
3244#include <clipping_planes_pars_fragment>
3245void main() {
3246	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3247	#include <clipping_planes_fragment>
3248	#include <logdepthbuf_fragment>
3249	#include <normal_fragment_begin>
3250	#include <normal_fragment_maps>
3251	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
3252	#ifdef OPAQUE
3253		gl_FragColor.a = 1.0;
3254	#endif
3255}`,$De=`#define PHONG
3256varying vec3 vViewPosition;
3257#include <common>
3258#include <batching_pars_vertex>
3259#include <uv_pars_vertex>
3260#include <displacementmap_pars_vertex>
3261#include <envmap_pars_vertex>
3262#include <color_pars_vertex>
3263#include <fog_pars_vertex>
3264#include <normal_pars_vertex>
3265#include <morphtarget_pars_vertex>
3266#include <skinning_pars_vertex>
3267#include <shadowmap_pars_vertex>
3268#include <logdepthbuf_pars_vertex>
3269#include <clipping_planes_pars_vertex>
3270void main() {
3271	#include <uv_vertex>
3272	#include <color_vertex>
3273	#include <morphcolor_vertex>
3274	#include <batching_vertex>
3275	#include <beginnormal_vertex>
3276	#include <morphinstance_vertex>
3277	#include <morphnormal_vertex>
3278	#include <skinbase_vertex>
3279	#include <skinnormal_vertex>
3280	#include <defaultnormal_vertex>
3281	#include <normal_vertex>
3282	#include <begin_vertex>
3283	#include <morphtarget_vertex>
3284	#include <skinning_vertex>
3285	#include <displacementmap_vertex>
3286	#include <project_vertex>
3287	#include <logdepthbuf_vertex>
3288	#include <clipping_planes_vertex>
3289	vViewPosition = - mvPosition.xyz;
3290	#include <worldpos_vertex>
3291	#include <envmap_vertex>
3292	#include <shadowmap_vertex>
3293	#include <fog_vertex>
3294}`,GDe=`#define PHONG
3295uniform vec3 diffuse;
3296uniform vec3 emissive;
3297uniform vec3 specular;
3298uniform float shininess;
3299uniform float opacity;
3300#include <common>
3301#include <packing>
3302#include <dithering_pars_fragment>
3303#include <color_pars_fragment>
3304#include <uv_pars_fragment>
3305#include <map_pars_fragment>
3306#include <alphamap_pars_fragment>
3307#include <alphatest_pars_fragment>
3308#include <alphahash_pars_fragment>
3309#include <aomap_pars_fragment>
3310#include <lightmap_pars_fragment>
3311#include <emissivemap_pars_fragment>
3312#include <envmap_common_pars_fragment>
3313#include <envmap_pars_fragment>
3314#include <fog_pars_fragment>
3315#include <bsdfs>
3316#include <lights_pars_begin>
3317#include <normal_pars_fragment>
3318#include <lights_phong_pars_fragment>
3319#include <shadowmap_pars_fragment>
3320#include <bumpmap_pars_fragment>
3321#include <normalmap_pars_fragment>
3322#include <specularmap_pars_fragment>
3323#include <logdepthbuf_pars_fragment>
3324#include <clipping_planes_pars_fragment>
3325void main() {
3326	vec4 diffuseColor = vec4( diffuse, opacity );
3327	#include <clipping_planes_fragment>
3328	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3329	vec3 totalEmissiveRadiance = emissive;
3330	#include <logdepthbuf_fragment>
3331	#include <map_fragment>
3332	#include <color_fragment>
3333	#include <alphamap_fragment>
3334	#include <alphatest_fragment>
3335	#include <alphahash_fragment>
3336	#include <specularmap_fragment>
3337	#include <normal_fragment_begin>
3338	#include <normal_fragment_maps>
3339	#include <emissivemap_fragment>
3340	#include <lights_phong_fragment>
3341	#include <lights_fragment_begin>
3342	#include <lights_fragment_maps>
3343	#include <lights_fragment_end>
3344	#include <aomap_fragment>
3345	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3346	#include <envmap_fragment>
3347	#include <opaque_fragment>
3348	#include <tonemapping_fragment>
3349	#include <colorspace_fragment>
3350	#include <fog_fragment>
3351	#include <premultiplied_alpha_fragment>
3352	#include <dithering_fragment>
3353}`,jDe=`#define STANDARD
3354varying vec3 vViewPosition;
3355#ifdef USE_TRANSMISSION
3356	varying vec3 vWorldPosition;
3357#endif
3358#include <common>
3359#include <batching_pars_vertex>
3360#include <uv_pars_vertex>
3361#include <displacementmap_pars_vertex>
3362#include <color_pars_vertex>
3363#include <fog_pars_vertex>
3364#include <normal_pars_vertex>
3365#include <morphtarget_pars_vertex>
3366#include <skinning_pars_vertex>
3367#include <shadowmap_pars_vertex>
3368#include <logdepthbuf_pars_vertex>
3369#include <clipping_planes_pars_vertex>
3370void main() {
3371	#include <uv_vertex>
3372	#include <color_vertex>
3373	#include <morphinstance_vertex>
3374	#include <morphcolor_vertex>
3375	#include <batching_vertex>
3376	#include <beginnormal_vertex>
3377	#include <morphnormal_vertex>
3378	#include <skinbase_vertex>
3379	#include <skinnormal_vertex>
3380	#include <defaultnormal_vertex>
3381	#include <normal_vertex>
3382	#include <begin_vertex>
3383	#include <morphtarget_vertex>
3384	#include <skinning_vertex>
3385	#include <displacementmap_vertex>
3386	#include <project_vertex>
3387	#include <logdepthbuf_vertex>
3388	#include <clipping_planes_vertex>
3389	vViewPosition = - mvPosition.xyz;
3390	#include <worldpos_vertex>
3391	#include <shadowmap_vertex>
3392	#include <fog_vertex>
3393#ifdef USE_TRANSMISSION
3394	vWorldPosition = worldPosition.xyz;
3395#endif
3396}`,WDe=`#define STANDARD
3397#ifdef PHYSICAL
3398	#define IOR
3399	#define USE_SPECULAR
3400#endif
3401uniform vec3 diffuse;
3402uniform vec3 emissive;
3403uniform float roughness;
3404uniform float metalness;
3405uniform float opacity;
3406#ifdef IOR
3407	uniform float ior;
3408#endif
3409#ifdef USE_SPECULAR
3410	uniform float specularIntensity;
3411	uniform vec3 specularColor;
3412	#ifdef USE_SPECULAR_COLORMAP
3413		uniform sampler2D specularColorMap;
3414	#endif
3415	#ifdef USE_SPECULAR_INTENSITYMAP
3416		uniform sampler2D specularIntensityMap;
3417	#endif
3418#endif
3419#ifdef USE_CLEARCOAT
3420	uniform float clearcoat;
3421	uniform float clearcoatRoughness;
3422#endif
3423#ifdef USE_IRIDESCENCE
3424	uniform float iridescence;
3425	uniform float iridescenceIOR;
3426	uniform float iridescenceThicknessMinimum;
3427	uniform float iridescenceThicknessMaximum;
3428#endif
3429#ifdef USE_SHEEN
3430	uniform vec3 sheenColor;
3431	uniform float sheenRoughness;
3432	#ifdef USE_SHEEN_COLORMAP
3433		uniform sampler2D sheenColorMap;
3434	#endif
3435	#ifdef USE_SHEEN_ROUGHNESSMAP
3436		uniform sampler2D sheenRoughnessMap;
3437	#endif
3438#endif
3439#ifdef USE_ANISOTROPY
3440	uniform vec2 anisotropyVector;
3441	#ifdef USE_ANISOTROPYMAP
3442		uniform sampler2D anisotropyMap;
3443	#endif
3444#endif
3445varying vec3 vViewPosition;
3446#include <common>
3447#include <packing>
3448#include <dithering_pars_fragment>
3449#include <color_pars_fragment>
3450#include <uv_pars_fragment>
3451#include <map_pars_fragment>
3452#include <alphamap_pars_fragment>
3453#include <alphatest_pars_fragment>
3454#include <alphahash_pars_fragment>
3455#include <aomap_pars_fragment>
3456#include <lightmap_pars_fragment>
3457#include <emissivemap_pars_fragment>
3458#include <iridescence_fragment>
3459#include <cube_uv_reflection_fragment>
3460#include <envmap_common_pars_fragment>
3461#include <envmap_physical_pars_fragment>
3462#include <fog_pars_fragment>
3463#include <lights_pars_begin>
3464#include <normal_pars_fragment>
3465#include <lights_physical_pars_fragment>
3466#include <transmission_pars_fragment>
3467#include <shadowmap_pars_fragment>
3468#include <bumpmap_pars_fragment>
3469#include <normalmap_pars_fragment>
3470#include <clearcoat_pars_fragment>
3471#include <iridescence_pars_fragment>
3472#include <roughnessmap_pars_fragment>
3473#include <metalnessmap_pars_fragment>
3474#include <logdepthbuf_pars_fragment>
3475#include <clipping_planes_pars_fragment>
3476void main() {
3477	vec4 diffuseColor = vec4( diffuse, opacity );
3478	#include <clipping_planes_fragment>
3479	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3480	vec3 totalEmissiveRadiance = emissive;
3481	#include <logdepthbuf_fragment>
3482	#include <map_fragment>
3483	#include <color_fragment>
3484	#include <alphamap_fragment>
3485	#include <alphatest_fragment>
3486	#include <alphahash_fragment>
3487	#include <roughnessmap_fragment>
3488	#include <metalnessmap_fragment>
3489	#include <normal_fragment_begin>
3490	#include <normal_fragment_maps>
3491	#include <clearcoat_normal_fragment_begin>
3492	#include <clearcoat_normal_fragment_maps>
3493	#include <emissivemap_fragment>
3494	#include <lights_physical_fragment>
3495	#include <lights_fragment_begin>
3496	#include <lights_fragment_maps>
3497	#include <lights_fragment_end>
3498	#include <aomap_fragment>
3499	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3500	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3501	#include <transmission_fragment>
3502	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3503	#ifdef USE_SHEEN
3504		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
3505		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
3506	#endif
3507	#ifdef USE_CLEARCOAT
3508		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3509		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3510		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3511	#endif
3512	#include <opaque_fragment>
3513	#include <tonemapping_fragment>
3514	#include <colorspace_fragment>
3515	#include <fog_fragment>
3516	#include <premultiplied_alpha_fragment>
3517	#include <dithering_fragment>
3518}`,qDe=`#define TOON
3519varying vec3 vViewPosition;
3520#include <common>
3521#include <batching_pars_vertex>
3522#include <uv_pars_vertex>
3523#include <displacementmap_pars_vertex>
3524#include <color_pars_vertex>
3525#include <fog_pars_vertex>
3526#include <normal_pars_vertex>
3527#include <morphtarget_pars_vertex>
3528#include <skinning_pars_vertex>
3529#include <shadowmap_pars_vertex>
3530#include <logdepthbuf_pars_vertex>
3531#include <clipping_planes_pars_vertex>
3532void main() {
3533	#include <uv_vertex>
3534	#include <color_vertex>
3535	#include <morphinstance_vertex>
3536	#include <morphcolor_vertex>
3537	#include <batching_vertex>
3538	#include <beginnormal_vertex>
3539	#include <morphnormal_vertex>
3540	#include <skinbase_vertex>
3541	#include <skinnormal_vertex>
3542	#include <defaultnormal_vertex>
3543	#include <normal_vertex>
3544	#include <begin_vertex>
3545	#include <morphtarget_vertex>
3546	#include <skinning_vertex>
3547	#include <displacementmap_vertex>
3548	#include <project_vertex>
3549	#include <logdepthbuf_vertex>
3550	#include <clipping_planes_vertex>
3551	vViewPosition = - mvPosition.xyz;
3552	#include <worldpos_vertex>
3553	#include <shadowmap_vertex>
3554	#include <fog_vertex>
3555}`,KDe=`#define TOON
3556uniform vec3 diffuse;
3557uniform vec3 emissive;
3558uniform float opacity;
3559#include <common>
3560#include <packing>
3561#include <dithering_pars_fragment>
3562#include <color_pars_fragment>
3563#include <uv_pars_fragment>
3564#include <map_pars_fragment>
3565#include <alphamap_pars_fragment>
3566#include <alphatest_pars_fragment>
3567#include <alphahash_pars_fragment>
3568#include <aomap_pars_fragment>
3569#include <lightmap_pars_fragment>
3570#include <emissivemap_pars_fragment>
3571#include <gradientmap_pars_fragment>
3572#include <fog_pars_fragment>
3573#include <bsdfs>
3574#include <lights_pars_begin>
3575#include <normal_pars_fragment>
3576#include <lights_toon_pars_fragment>
3577#include <shadowmap_pars_fragment>
3578#include <bumpmap_pars_fragment>
3579#include <normalmap_pars_fragment>
3580#include <logdepthbuf_pars_fragment>
3581#include <clipping_planes_pars_fragment>
3582void main() {
3583	vec4 diffuseColor = vec4( diffuse, opacity );
3584	#include <clipping_planes_fragment>
3585	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3586	vec3 totalEmissiveRadiance = emissive;
3587	#include <logdepthbuf_fragment>
3588	#include <map_fragment>
3589	#include <color_fragment>
3590	#include <alphamap_fragment>
3591	#include <alphatest_fragment>
3592	#include <alphahash_fragment>
3593	#include <normal_fragment_begin>
3594	#include <normal_fragment_maps>
3595	#include <emissivemap_fragment>
3596	#include <lights_toon_fragment>
3597	#include <lights_fragment_begin>
3598	#include <lights_fragment_maps>
3599	#include <lights_fragment_end>
3600	#include <aomap_fragment>
3601	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3602	#include <opaque_fragment>
3603	#include <tonemapping_fragment>
3604	#include <colorspace_fragment>
3605	#include <fog_fragment>
3606	#include <premultiplied_alpha_fragment>
3607	#include <dithering_fragment>
3608}`,XDe=`uniform float size;
3609uniform float scale;
3610#include <common>
3611#include <color_pars_vertex>
3612#include <fog_pars_vertex>
3613#include <morphtarget_pars_vertex>
3614#include <logdepthbuf_pars_vertex>
3615#include <clipping_planes_pars_vertex>
3616#ifdef USE_POINTS_UV
3617	varying vec2 vUv;
3618	uniform mat3 uvTransform;
3619#endif
3620void main() {
3621	#ifdef USE_POINTS_UV
3622		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3623	#endif
3624	#include <color_vertex>
3625	#include <morphinstance_vertex>
3626	#include <morphcolor_vertex>
3627	#include <begin_vertex>
3628	#include <morphtarget_vertex>
3629	#include <project_vertex>
3630	gl_PointSize = size;
3631	#ifdef USE_SIZEATTENUATION
3632		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3633		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3634	#endif
3635	#include <logdepthbuf_vertex>
3636	#include <clipping_planes_vertex>
3637	#include <worldpos_vertex>
3638	#include <fog_vertex>
3639}`,YDe=`uniform vec3 diffuse;
3640uniform float opacity;
3641#include <common>
3642#include <color_pars_fragment>
3643#include <map_particle_pars_fragment>
3644#include <alphatest_pars_fragment>
3645#include <alphahash_pars_fragment>
3646#include <fog_pars_fragment>
3647#include <logdepthbuf_pars_fragment>
3648#include <clipping_planes_pars_fragment>
3649void main() {
3650	vec4 diffuseColor = vec4( diffuse, opacity );
3651	#include <clipping_planes_fragment>
3652	vec3 outgoingLight = vec3( 0.0 );
3653	#include <logdepthbuf_fragment>
3654	#include <map_particle_fragment>
3655	#include <color_fragment>
3656	#include <alphatest_fragment>
3657	#include <alphahash_fragment>
3658	outgoingLight = diffuseColor.rgb;
3659	#include <opaque_fragment>
3660	#include <tonemapping_fragment>
3661	#include <colorspace_fragment>
3662	#include <fog_fragment>
3663	#include <premultiplied_alpha_fragment>
3664}`,QDe=`#include <common>
3665#include <batching_pars_vertex>
3666#include <fog_pars_vertex>
3667#include <morphtarget_pars_vertex>
3668#include <skinning_pars_vertex>
3669#include <logdepthbuf_pars_vertex>
3670#include <shadowmap_pars_vertex>
3671void main() {
3672	#include <batching_vertex>
3673	#include <beginnormal_vertex>
3674	#include <morphinstance_vertex>
3675	#include <morphnormal_vertex>
3676	#include <skinbase_vertex>
3677	#include <skinnormal_vertex>
3678	#include <defaultnormal_vertex>
3679	#include <begin_vertex>
3680	#include <morphtarget_vertex>
3681	#include <skinning_vertex>
3682	#include <project_vertex>
3683	#include <logdepthbuf_vertex>
3684	#include <worldpos_vertex>
3685	#include <shadowmap_vertex>
3686	#include <fog_vertex>
3687}`,ZDe=`uniform vec3 color;
3688uniform float opacity;
3689#include <common>
3690#include <packing>
3691#include <fog_pars_fragment>
3692#include <bsdfs>
3693#include <lights_pars_begin>
3694#include <logdepthbuf_pars_fragment>
3695#include <shadowmap_pars_fragment>
3696#include <shadowmask_pars_fragment>
3697void main() {
3698	#include <logdepthbuf_fragment>
3699	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3700	#include <tonemapping_fragment>
3701	#include <colorspace_fragment>
3702	#include <fog_fragment>
3703}`,JDe=`uniform float rotation;
3704uniform vec2 center;
3705#include <common>
3706#include <uv_pars_vertex>
3707#include <fog_pars_vertex>
3708#include <logdepthbuf_pars_vertex>
3709#include <clipping_planes_pars_vertex>
3710void main() {
3711	#include <uv_vertex>
3712	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
3713	vec2 scale;
3714	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
3715	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
3716	#ifndef USE_SIZEATTENUATION
3717		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3718		if ( isPerspective ) scale *= - mvPosition.z;
3719	#endif
3720	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3721	vec2 rotatedPosition;
3722	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3723	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3724	mvPosition.xy += rotatedPosition;
3725	gl_Position = projectionMatrix * mvPosition;
3726	#include <logdepthbuf_vertex>
3727	#include <clipping_planes_vertex>
3728	#include <fog_vertex>
3729}`,eOe=`uniform vec3 diffuse;
3730uniform float opacity;
3731#include <common>
3732#include <uv_pars_fragment>
3733#include <map_pars_fragment>
3734#include <alphamap_pars_fragment>
3735#include <alphatest_pars_fragment>
3736#include <alphahash_pars_fragment>
3737#include <fog_pars_fragment>
3738#include <logdepthbuf_pars_fragment>
3739#include <clipping_planes_pars_fragment>
3740void main() {
3741	vec4 diffuseColor = vec4( diffuse, opacity );
3742	#include <clipping_planes_fragment>
3743	vec3 outgoingLight = vec3( 0.0 );
3744	#include <logdepthbuf_fragment>
3745	#include <map_fragment>
3746	#include <alphamap_fragment>
3747	#include <alphatest_fragment>
3748	#include <alphahash_fragment>
3749	outgoingLight = diffuseColor.rgb;
3750	#include <opaque_fragment>
3751	#include <tonemapping_fragment>
3752	#include <colorspace_fragment>
3753	#include <fog_fragment>
3754}`,Lt={alphahash_fragment:bRe,alphahash_pars_fragment:_Re,alphamap_fragment:ERe,alphamap_pars_fragment:SRe,alphatest_fragment:ARe,alphatest_pars_fragment:MRe,aomap_fragment:TRe,aomap_pars_fragment:PRe,batching_pars_vertex:CRe,batching_vertex:IRe,begin_vertex:RRe,beginnormal_vertex:NRe,bsdfs:DRe,iridescence_fragment:ORe,bumpmap_pars_fragment:LRe,clipping_planes_fragment:URe,clipping_planes_pars_fragment:BRe,clipping_planes_pars_vertex:kRe,clipping_planes_vertex:FRe,color_fragment:zRe,color_pars_fragment:VRe,color_pars_vertex:HRe,color_vertex:$Re,common:GRe,cube_uv_reflection_fragment:jRe,defaultnormal_vertex:WRe,displacementmap_pars_vertex:qRe,displacementmap_vertex:KRe,emissivemap_fragment:XRe,emissivemap_pars_fragment:YRe,colorspace_fragment:QRe,colorspace_pars_fragment:ZRe,envmap_fragment:JRe,envmap_common_pars_fragment:eNe,envmap_pars_fragment:tNe,envmap_pars_vertex:nNe,envmap_physical_pars_fragment:pNe,envmap_vertex:iNe,fog_vertex:rNe,fog_pars_vertex:sNe,fog_fragment:oNe,fog_pars_fragment:aNe,gradientmap_pars_fragment:lNe,lightmap_fragment:cNe,lightmap_pars_fragment:uNe,lights_lambert_fragment:hNe,lights_lambert_pars_fragment:fNe,lights_pars_begin:dNe,lights_toon_fragment:mNe,lights_toon_pars_fragment:gNe,lights_phong_fragment:yNe,lights_phong_pars_fragment:vNe,lights_physical_fragment:wNe,lights_physical_pars_fragment:xNe,lights_fragment_begin:bNe,lights_fragment_maps:_Ne,lights_fragment_end:ENe,logdepthbuf_fragment:SNe,logdepthbuf_pars_fragment:ANe,logdepthbuf_pars_vertex:MNe,logdepthbuf_vertex:TNe,map_fragment:PNe,map_pars_fragment:CNe,map_particle_fragment:INe,map_particle_pars_fragment:RNe,metalnessmap_fragment:NNe,metalnessmap_pars_fragment:DNe,morphinstance_vertex:ONe,morphcolor_vertex:LNe,morphnormal_vertex:UNe,morphtarget_pars_vertex:BNe,morphtarget_vertex:kNe,normal_fragment_begin:FNe,normal_fragment_maps:zNe,normal_pars_fragment:VNe,normal_pars_vertex:HNe,normal_vertex:$Ne,normalmap_pars_fragment:GNe,clearcoat_normal_fragment_begin:jNe,clearcoat_normal_fragment_maps:WNe,clearcoat_pars_fragment:qNe,iridescence_pars_fragment:KNe,opaque_fragment:XNe,packing:YNe,premultiplied_alpha_fragment:QNe,project_vertex:ZNe,dithering_fragment:JNe,dithering_pars_fragment:eDe,roughnessmap_fragment:tDe,roughnessmap_pars_fragment:nDe,shadowmap_pars_fragment:iDe,shadowmap_pars_vertex:rDe,shadowmap_vertex:sDe,shadowmask_pars_fragment:oDe,skinbase_vertex:aDe,skinning_pars_vertex:lDe,skinning_vertex:cDe,skinnormal_vertex:uDe,specularmap_fragment:hDe,specularmap_pars_fragment:fDe,tonemapping_fragment:dDe,tonemapping_pars_fragment:pDe,transmission_fragment:mDe,transmission_pars_fragment:gDe,uv_pars_fragment:yDe,uv_pars_vertex:vDe,uv_vertex:wDe,worldpos_vertex:xDe,background_vert:bDe,background_frag:_De,backgroundCube_vert:EDe,backgroundCube_frag:SDe,cube_vert:ADe,cube_frag:MDe,depth_vert:TDe,depth_frag:PDe,distanceRGBA_vert:CDe,distanceRGBA_frag:IDe,equirect_vert:RDe,equirect_frag:NDe,linedashed_vert:DDe,linedashed_frag:ODe,meshbasic_vert:LDe,meshbasic_frag:UDe,meshlambert_vert:BDe,meshlambert_frag:kDe,meshmatcap_vert:FDe,meshmatcap_frag:zDe,meshnormal_vert:VDe,meshnormal_frag:HDe,meshphong_vert:$De,meshphong_frag:GDe,meshphysical_vert:jDe,meshphysical_frag:WDe,meshtoon_vert:qDe,meshtoon_frag:KDe,points_vert:XDe,points_frag:YDe,shadow_vert:QDe,shadow_frag:ZDe,sprite_vert:JDe,sprite_frag:eOe},He={common:{diffuse:{value:new et(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Nt},alphaMap:{value:null},alphaMapTransform:{value:new Nt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Nt}},envmap:{envMap:{value:null},envMapRotation:{value:new Nt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Nt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Nt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Nt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Nt},normalScale:{value:new Me(1,1)}}
vendor: 6,683 bytes, line 3754
3754,displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Nt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Nt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Nt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Nt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new et(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new et(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Nt},alphaTest:{value:0},uvTransform:{value:new Nt}},sprite:{diffuse:{value:new et(16777215)},opacity:{value:1},center:{value:new Me(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Nt},alphaMap:{value:null},alphaMapTransform:{value:new Nt},alphaTest:{value:0}}},Oa={basic:{uniforms:Yr([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.fog]),vertexShader:Lt.meshbasic_vert,fragmentShader:Lt.meshbasic_frag},lambert:{uniforms:Yr([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.fog,He.lights,{emissive:{value:new et(0)}}]),vertexShader:Lt.meshlambert_vert,fragmentShader:Lt.meshlambert_frag},phong:{uniforms:Yr([He.common,He.specularmap,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.fog,He.lights,{emissive:{value:new et(0)},specular:{value:new et(1118481)},shininess:{value:30}}]),vertexShader:Lt.meshphong_vert,fragmentShader:Lt.meshphong_frag},standard:{uniforms:Yr([He.common,He.envmap,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.roughnessmap,He.metalnessmap,He.fog,He.lights,{emissive:{value:new et(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Lt.meshphysical_vert,fragmentShader:Lt.meshphysical_frag},toon:{uniforms:Yr([He.common,He.aomap,He.lightmap,He.emissivemap,He.bumpmap,He.normalmap,He.displacementmap,He.gradientmap,He.fog,He.lights,{emissive:{value:new et(0)}}]),vertexShader:Lt.meshtoon_vert,fragmentShader:Lt.meshtoon_frag},matcap:{uniforms:Yr([He.common,He.bumpmap,He.normalmap,He.displacementmap,He.fog,{matcap:{value:null}}]),vertexShader:Lt.meshmatcap_vert,fragmentShader:Lt.meshmatcap_frag},points:{uniforms:Yr([He.points,He.fog]),vertexShader:Lt.points_vert,fragmentShader:Lt.points_frag},dashed:{uniforms:Yr([He.common,He.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Lt.linedashed_vert,fragmentShader:Lt.linedashed_frag},depth:{uniforms:Yr([He.common,He.displacementmap]),vertexShader:Lt.depth_vert,fragmentShader:Lt.depth_frag},normal:{uniforms:Yr([He.common,He.bumpmap,He.normalmap,He.displacementmap,{opacity:{value:1}}]),vertexShader:Lt.meshnormal_vert,fragmentShader:Lt.meshnormal_frag},sprite:{uniforms:Yr([He.sprite,He.fog]),vertexShader:Lt.sprite_vert,fragmentShader:Lt.sprite_frag},background:{uniforms:{uvTransform:{value:new Nt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Lt.background_vert,fragmentShader:Lt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Nt}},vertexShader:Lt.backgroundCube_vert,fragmentShader:Lt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Lt.cube_vert,fragmentShader:Lt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Lt.equirect_vert,fragmentShader:Lt.equirect_frag},distanceRGBA:{uniforms:Yr([He.common,He.displacementmap,{referencePosition:{value:new K},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Lt.distanceRGBA_vert,fragmentShader:Lt.distanceRGBA_frag},shadow:{uniforms:Yr([He.lights,He.fog,{color:{value:new et(0)},opacity:{value:1}}]),vertexShader:Lt.shadow_vert,fragmentShader:Lt.shadow_frag}};Oa.physical={uniforms:Yr([Oa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Nt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Nt},clearcoatNormalScale:{value:new Me(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Nt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Nt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Nt},sheen:{value:0},sheenColor:{value:new et(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Nt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Nt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Nt},transmissionSamplerSize:{value:new Me},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Nt},attenuationDistance:{value:0},attenuationColor:{value:new et(0)},specularColor:{value:new et(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Nt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Nt},anisotropyVector:{value:new Me},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Nt}}]),vertexShader:Lt.meshphysical_vert,fragmentShader:Lt.meshphysical_frag};const U_={r:0,b:0,g:0}
vendor: 22,191 bytes, lines 3754-3829
3754,Of=new wo,tOe=new wt;function nOe(n,e,t,i,r,s,o){const a=new et(0);let l=s===!0?0:1,c,u,h=null,f=0,m=null;function g(w,y){let _=!1,x=y.isScene===!0?y.background:null;x&&x.isTexture&&(x=(y.backgroundBlurriness>0?t:e).get(x)),x===null?v(a,l):x&&x.isColor&&(v(x,1),_=!0);const S=n.xr.getEnvironmentBlendMode();S==="additive"?i.buffers.color.setClear(0,0,0,1,o):S==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||_)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),x&&(x.isCubeTexture||x.mapping===ny)?(u===void 0&&(u=new Ai(new Ip(1,1,1),new zs({name:"BackgroundCubeMaterial",uniforms:H0(Oa.backgroundCube.uniforms),vertexShader:Oa.backgroundCube.vertexShader,fragmentShader:Oa.backgroundCube.fragmentShader,side:cs,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(M,A,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),Of.copy(y.backgroundRotation),Of.x*=-1,Of.y*=-1,Of.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(Of.y*=-1,Of.z*=-1),u.material.uniforms.envMap.value=x,u.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=y.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(tOe.makeRotationFromEuler(Of)),u.material.toneMapped=pn.getTransfer(x.colorSpace)!==An,(h!==x||f!==x.version||m!==n.toneMapping)&&(u.material.needsUpdate=!0,h=x,f=x.version,m=n.toneMapping),u.layers.enableAll(),w.unshift(u,u.geometry,u.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new Ai(new ry(2,2),new zs({name:"BackgroundMaterial",uniforms:H0(Oa.background.uniforms),vertexShader:Oa.background.vertexShader,fragmentShader:Oa.background.fragmentShader,side:ou,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=x,c.material.uniforms.backgroundIntensity.value=y.backgroundIntensity,c.material.toneMapped=pn.getTransfer(x.colorSpace)!==An,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(h!==x||f!==x.version||m!==n.toneMapping)&&(c.material.needsUpdate=!0,h=x,f=x.version,m=n.toneMapping),c.layers.enableAll(),w.unshift(c,c.geometry,c.material,0,0,null))}function v(w,y){w.getRGB(U_,QQ(n)),i.buffers.color.setClear(U_.r,U_.g,U_.b,y,o)}return{getClearColor:function(){return a},setClearColor:function(w,y=1){a.set(w),l=y,v(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(w){l=w,v(a,l)},render:g}}function iOe(n,e,t,i){const r=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,a={},l=w(null);let c=l,u=!1;function h(z,P,R,F,N){let O=!1;if(o){const B=v(F,R,P);c!==B&&(c=B,m(c.object)),O=y(z,F,R,N),O&&_(z,F,R,N)}else{const B=P.wireframe===!0;(c.geometry!==F.id||c.program!==R.id||c.wireframe!==B)&&(c.geometry=F.id,c.program=R.id,c.wireframe=B,O=!0)}N!==null&&t.update(N,n.ELEMENT_ARRAY_BUFFER),(O||u)&&(u=!1,D(z,P,R,F),N!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(N).buffer))}function f(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function m(z){return i.isWebGL2?n.bindVertexArray(z):s.bindVertexArrayOES(z)}function g(z){return i.isWebGL2?n.deleteVertexArray(z):s.deleteVertexArrayOES(z)}function v(z,P,R){const F=R.wireframe===!0;let N=a[z.id];N===void 0&&(N={},a[z.id]=N);let O=N[P.id];O===void 0&&(O={},N[P.id]=O);let B=O[F];return B===void 0&&(B=w(f()),O[F]=B),B}function w(z){const P=[],R=[],F=[];for(let N=0;N<r;N++)P[N]=0,R[N]=0,F[N]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:P,enabledAttributes:R,attributeDivisors:F,object:z,attributes:{},index:null}}function y(z,P,R,F){const N=c.attributes,O=P.attributes;let B=0;const W=R.getAttributes();for(const Q in W)if(W[Q].location>=0){const Y=N[Q];let te=O[Q];if(te===void 0&&(Q==="instanceMatrix"&&z.instanceMatrix&&(te=z.instanceMatrix),Q==="instanceColor"&&z.instanceColor&&(te=z.instanceColor)),Y===void 0||Y.attribute!==te||te&&Y.data!==te.data)return!0;B++}return c.attributesNum!==B||c.index!==F}function _(z,P,R,F){const N={},O=P.attributes;let B=0;const W=R.getAttributes();for(const Q in W)if(W[Q].location>=0){let Y=O[Q];Y===void 0&&(Q==="instanceMatrix"&&z.instanceMatrix&&(Y=z.instanceMatrix),Q==="instanceColor"&&z.instanceColor&&(Y=z.instanceColor));const te={};te.attribute=Y,Y&&Y.data&&(te.data=Y.data),N[Q]=te,B++}c.attributes=N,c.attributesNum=B,c.index=F}function x(){const z=c.newAttributes;for(let P=0,R=z.length;P<R;P++)z[P]=0}function S(z){M(z,0)}function M(z,P){const R=c.newAttributes,F=c.enabledAttributes,N=c.attributeDivisors;R[z]=1,F[z]===0&&(n.enableVertexAttribArray(z),F[z]=1),N[z]!==P&&((i.isWebGL2?n:e.get("ANGLE_instanced_arrays"))[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](z,P),N[z]=P)}function A(){const z=c.newAttributes,P=c.enabledAttributes;for(let R=0,F=P.length;R<F;R++)P[R]!==z[R]&&(n.disableVertexAttribArray(R),P[R]=0)}function I(z,P,R,F,N,O,B){B===!0?n.vertexAttribIPointer(z,P,R,N,O):n.vertexAttribPointer(z,P,R,F,N,O)}function D(z,P,R,F){if(i.isWebGL2===!1&&(z.isInstancedMesh||F.isInstancedBufferGeometry)&&e.get("ANGLE_instanced_arrays")===null)return;x();const N=F.attributes,O=R.getAttributes(),B=P.defaultAttributeValues;for(const W in O){const Q=O[W];if(Q.location>=0){let oe=N[W];if(oe===void 0&&(W==="instanceMatrix"&&z.instanceMatrix&&(oe=z.instanceMatrix),W==="instanceColor"&&z.instanceColor&&(oe=z.instanceColor)),oe!==void 0){const Y=oe.normalized,te=oe.itemSize,le=t.get(oe);if(le===void 0)continue;const ve=le.buffer,Te=le.type,be=le.bytesPerElement,Le=i.isWebGL2===!0&&(Te===n.INT||Te===n.UNSIGNED_INT||oe.gpuType===LL);if(oe.isInterleavedBufferAttribute){const Oe=oe.data,J=Oe.stride,Se=oe.offset;if(Oe.isInstancedInterleavedBuffer){for(let me=0;me<Q.locationSize;me++)M(Q.location+me,Oe.meshPerAttribute);z.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=Oe.meshPerAttribute*Oe.count)}else for(let me=0;me<Q.locationSize;me++)S(Q.location+me);n.bindBuffer(n.ARRAY_BUFFER,ve);for(let me=0;me<Q.locationSize;me++)I(Q.location+me,te/Q.locationSize,Te,Y,J*be,(Se+te/Q.locationSize*me)*be,Le)}else{if(oe.isInstancedBufferAttribute){for(let Oe=0;Oe<Q.locationSize;Oe++)M(Q.location+Oe,oe.meshPerAttribute);z.isInstancedMesh!==!0&&F._maxInstanceCount===void 0&&(F._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let Oe=0;Oe<Q.locationSize;Oe++)S(Q.location+Oe);n.bindBuffer(n.ARRAY_BUFFER,ve);for(let Oe=0;Oe<Q.locationSize;Oe++)I(Q.location+Oe,te/Q.locationSize,Te,Y,te*be,te/Q.locationSize*Oe*be,Le)}}else if(B!==void 0){const Y=B[W];if(Y!==void 0)switch(Y.length){case 2:n.vertexAttrib2fv(Q.location,Y);break;case 3:n.vertexAttrib3fv(Q.location,Y);break;case 4:n.vertexAttrib4fv(Q.location,Y);break;default:n.vertexAttrib1fv(Q.location,Y)}}}}A()}function k(){G();for(const z in a){const P=a[z];for(const R in P){const F=P[R];for(const N in F)g(F[N].object),delete F[N];delete P[R]}delete a[z]}}function C(z){if(a[z.id]===void 0)return;const P=a[z.id];for(const R in P){const F=P[R];for(const N in F)g(F[N].object),delete F[N];delete P[R]}delete a[z.id]}function U(z){for(const P in a){const R=a[P];if(R[z.id]===void 0)continue;const F=R[z.id];for(const N in F)g(F[N].object),delete F[N];delete R[z.id]}}function G(){H(),u=!0,c!==l&&(c=l,m(c.object))}function H(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:h,reset:G,resetDefaultState:H,dispose:k,releaseStatesOfGeometry:C,releaseStatesOfProgram:U,initAttributes:x,enableAttribute:S,disableUnusedAttributes:A}}function rOe(n,e,t,i){const r=i.isWebGL2;let s;function o(u){s=u}function a(u,h){n.drawArrays(s,u,h),t.update(h,s,1)}function l(u,h,f){if(f===0)return;let m,g;if(r)m=n,g="drawArraysInstanced";else if(m=e.get("ANGLE_instanced_arrays"),g="drawArraysInstancedANGLE",m===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}m[g](s,u,h,f),t.update(h,s,f)}function c(u,h,f){if(f===0)return;const m=e.get("WEBGL_multi_draw");if(m===null)for(let g=0;g<f;g++)this.render(u[g],h[g]);else{m.multiDrawArraysWEBGL(s,u,0,h,0,f);let g=0;for(let v=0;v<f;v++)g+=h[v];t.update(g,s,1)}}this.setMode=o,this.render=a,this.renderInstances=l,this.renderMultiDraw=c}function sOe(n,e,t){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function s(I){if(I==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";I="mediump"}return I==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),v=n.getParameter(n.MAX_VERTEX_ATTRIBS),w=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),y=n.getParameter(n.MAX_VARYING_VECTORS),_=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),x=f>0,S=o||e.has("OES_texture_float"),M=x&&S,A=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:m,maxCubemapSize:g,maxAttributes:v,maxVertexUniforms:w,maxVaryings:y,maxFragmentUniforms:_,vertexTextures:x,floatFragmentTextures:S,floatVertexTextures:M,maxSamples:A}}function oOe(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new th,a=new Nt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const m=h.length!==0||f||i!==0||r;return r=f,i=h.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,m){const g=h.clippingPlanes,v=h.clipIntersection,w=h.clipShadows,y=n.get(h);if(!r||g===null||g.length===0||s&&!w)s?u(null):c();else{const _=s?0:i,x=_*4;let S=y.clippingState||null;l.value=S,S=u(g,f,x,m);for(let M=0;M!==x;++M)S[M]=t[M];y.clippingState=S,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=_}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,f,m,g){const v=h!==null?h.length:0;let w=null;if(v!==0){if(w=l.value,g!==!0||w===null){const y=m+v*4,_=f.matrixWorldInverse;a.getNormalMatrix(_),(w===null||w.length<y)&&(w=new Float32Array(y));for(let x=0,S=m;x!==v;++x,S+=4)o.copy(h[x]).applyMatrix4(_,a),o.normal.toArray(w,S),w[S+3]=o.constant}l.value=w,l.needsUpdate=!0}return e.numPlanes=v,e.numIntersection=0,w}}function aOe(n){let e=new WeakMap;function t(o,a){return a===e1?o.mapping=au:a===t1&&(o.mapping=Yh),o}function i(o){if(o&&o.isTexture){const a=o.mapping;if(a===e1||a===t1)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new eZ(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",r),t(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class ux extends ax{constructor(e=-1,t=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+t,l=r-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const ag=4,DV=[.125,.215,.35,.446,.526,.582],id=20,kC=new ux,OV=new et;let FC=null,zC=0,VC=0;const Yf=(1+Math.sqrt(5))/2,_m=1/Yf,LV=[new K(1,1,1),new K(-1,1,1),new K(1,1,-1),new K(-1,1,-1),new K(0,Yf,_m),new K(0,Yf,-_m),new K(_m,0,Yf),new K(-_m,0,Yf),new K(Yf,_m,0),new K(-Yf,_m,0)];class FN{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,r=100){FC=this._renderer.getRenderTarget(),zC=this._renderer.getActiveCubeFace(),VC=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=kV(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=BV(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(FC,zC,VC),e.scissorTest=!1,B_(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===au||e.mapping===Yh?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),FC=this._renderer.getRenderTarget(),zC=this._renderer.getActiveCubeFace(),VC=this._renderer.getActiveMipmapLevel();const i=t||this._allocateTargets();return this._textureToCubeUV(e,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,i={magFilter:On,minFilter:On,generateMipmaps:!1,type:z0,format:zr,colorSpace:hu,depthBuffer:!1},r=UV(e,t,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=UV(e,t,i);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=lOe(s)),this._blurMaterial=cOe(s,e,t)}return r}_compileMaterial(e){const t=new Ai(this._lodPlanes[0],e);this._renderer.compile(t,kC)}_sceneToCubeUV(e,t,i,r){const a=new Ki(90,1,t,i),l=[1,-1,1,1,1,1],c=[1,1,1,-1,-1,-1],u=this._renderer,h=u.autoClear,f=u.toneMapping;u.getClearColor(OV),u.toneMapping=kl,u.autoClear=!1;const m=new cf({name:"PMREM.Background",side:cs,depthWrite:!1,depthTest:!1}),g=new Ai(new Ip,m);let v=!1;const w=e.background;w?w.isColor&&(m.color.copy(w),e.background=null,v=!0):(m.color.copy(OV),v=!0);for(let y=0;y<6;y++){const _=y%3;_===0?(a.up.set(0,l[y],0),a.lookAt(c[y],0,0)):_===1?(a.up.set(0,0,l[y]),a.lookAt(0,c[y],0)):(a.up.set(0,l[y],0),a.lookAt(0,0,c[y]));const x=this._cubeSize;B_(r,_*x,y>2?x:0,x,x),u.setRenderTarget(r),v&&u.render(g,a),u.render(e,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=w}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===au||e.mapping===Yh;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=kV()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=BV());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new Ai(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;B_(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,kC)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;r<this._lodPlanes.length;r++){const s=Math.sqrt(this._sigmas[r]*this._sigmas[r]-this._sigmas[r-1]*this._sigmas[r-1]),o=LV[(r-1)%LV.length];this._blur(e,r-1,r,s,o)}t.autoClear=i}_blur(e,t,i,r,s){const o=this._pingPongRenderTarget;this._halfBlur(e,o,t,i,r,"latitudinal",s),this._halfBlur(o,e,i,i,r,"longitudinal",s)}_halfBlur(e,t,i,r,s,o,a){const l=this._renderer,c=this._blurMaterial;o!=="latitudinal"&&o!=="longitudinal"&&console.error("blur direction must be either latitudinal or longitudinal!");const u=3,h=new Ai(this._lodPlanes[r],c),f=c.uniforms,m=this._sizeLods[i]-1,g=isFinite(s)?Math.PI/(2*m):2*Math.PI/(2*id-1),v=s/g,w=isFinite(s)?1+Math.floor(u*v):id;w>id&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${id}`);const y=[];let _=0;for(let I=0;I<id;++I){const D=I/v,k=Math.exp(-D*D/2);y.push(k),I===0?_+=k:I<w&&(_+=2*k)}for(let I=0;I<y.length;I++)y[I]=y[I]/_;f.envMap.value=e.texture,f.samples.value=w,f.weights.value=y,f.latitudinal.value=o==="latitudinal",a&&(f.poleAxis.value=a);const{_lodMax:x}=this;f.dTheta.value=g,f.mipInt.value=x-i;const S=this._sizeLods[r],M=3*S*(r>x-ag?r-x+ag:0),A=4*(this._cubeSize-S);B_(t,M,A,3*S,2*S),l.setRenderTarget(t),l.render(h,kC)}}function lOe(n){const e=[],t=[],i=[];let r=n;const s=n-ag+1+DV.length;for(let o=0;o<s;o++){const a=Math.pow(2,r);t.push(a);let l=1/a;o>n-ag?l=DV[o-n+ag-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,h=1+c,f=[u,u,h,u,h,h,u,u,h,h,u,h],m=6,g=6,v=3,w=2,y=1,_=new Float32Array(v*g*m),x=new Float32Array(w*g*m),S=new Float32Array(y*g*m);for(let A=0;A<m;A++){const I=A%3*2/3-1,D=A>2?0:-1,k=[I,D,0,I+2/3,D,0,I+2/3,D+1,0,I,D,0,I+2/3,D+1,0,I,D+1,0];_.set(k,v*g*A),x.set(f,w*g*A);const C=[A,A,A,A,A,A];S.set(C,y*g*A)}const M=new Ft;M.setAttribute("position",new wn(_,v)),M.setAttribute("uv",new wn(x,w)),M.setAttribute("faceIndex",new wn(S,y)),e.push(M),r>ag&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function UV(n,e,t){const i=new $a(n,e,t);return i.texture.mapping=ny,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function B_(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function cOe(n,e,t){const i=new Float32Array(id),r=new K(0,1,0);return new zs({name:"SphericalGaussianBlur",defines:{n:id,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:YL(),fragmentShader:`
3755
3756			precision mediump float;
3757			precision mediump int;
3758
3759			varying vec3 vOutputDirection;
3760
3761			uniform sampler2D envMap;
3762			uniform int samples;
3763			uniform float weights[ n ];
3764			uniform bool latitudinal;
3765			uniform float dTheta;
3766			uniform float mipInt;
3767			uniform vec3 poleAxis;
3768
3769			#define ENVMAP_TYPE_CUBE_UV
3770			#include <cube_uv_reflection_fragment>
3771
3772			vec3 getSample( float theta, vec3 axis ) {
3773
3774				float cosTheta = cos( theta );
3775				// Rodrigues' axis-angle rotation
3776				vec3 sampleDirection = vOutputDirection * cosTheta
3777					+ cross( axis, vOutputDirection ) * sin( theta )
3778					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3779
3780				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3781
3782			}
3783
3784			void main() {
3785
3786				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3787
3788				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3789
3790					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3791
3792				}
3793
3794				axis = normalize( axis );
3795
3796				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3797				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3798
3799				for ( int i = 1; i < n; i++ ) {
3800
3801					if ( i >= samples ) {
3802
3803						break;
3804
3805					}
3806
3807					float theta = dTheta * float( i );
3808					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3809					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3810
3811				}
3812
3813			}
3814		`,blending:Kc,depthTest:!1,depthWrite:!1})}function BV(){return new zs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:YL(),fragmentShader:`
3815
3816			precision mediump float;
3817			precision mediump int;
3818
3819			varying vec3 vOutputDirection;
3820
3821			uniform sampler2D envMap;
3822
3823			#include <common>
3824
3825			void main() {
3826
3827				vec3 outputDirection = normalize( vOutputDirection );
3828				vec2 uv = equirectUv( outputDirection );
3829
3830				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3831
3832			}
3833		`,blending:Kc,depthTest:!1,depthWrite:!1})}function kV(){return new zs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:YL(),fragmentShader:`
3834
3835			precision mediump float;
3836			precision mediump int;
3837
3838			uniform float flipEnvMap;
3839
3840			varying vec3 vOutputDirection;
3841
3842			uniform samplerCube envMap;
3843
3844			void main() {
3845
3846				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3847
3848			}
3849		`,blending:Kc,depthTest:!1,depthWrite:!1})}function YL(){return`
3850
3851		precision mediump float;
3852		precision mediump int;
3853
3854		attribute float faceIndex;
3855
3856		varying vec3 vOutputDirection;
3857
3858		// RH coordinate system; PMREM face-indexing convention
3859		vec3 getDirection( vec2 uv, float face ) {
3860
3861			uv = 2.0 * uv - 1.0;
3862
3863			vec3 direction = vec3( uv, 1.0 );
3864
3865			if ( face == 0.0 ) {
3866
3867				direction = direction.zyx; // ( 1, v, u ) pos x
3868
3869			} else if ( face == 1.0 ) {
3870
3871				direction = direction.xzy;
3872				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3873
3874			} else if ( face == 2.0 ) {
3875
3876				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3877
3878			} else if ( face == 3.0 ) {
3879
3880				direction = direction.zyx;
3881				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3882
3883			} else if ( face == 4.0 ) {
3884
3885				direction = direction.xzy;
3886				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3887
3888			} else if ( face == 5.0 ) {
3889
3890				direction.z *= -1.0; // ( u, v, -1 ) neg z
3891
3892			}
3893
3894			return direction;
3895
3896		}
3897
3898		void main() {
3899
3900			vOutputDirection = getDirection( uv, faceIndex );
3901			gl_Position = vec4( position, 1.0 );
3902
3903		}
3904	`}function uOe(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===e1||l===t1,u=l===au||l===Yh;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new FN(n)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||u&&h&&r(h)){t===null&&(t=new FN(n));const f=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function r(a){let l=0;const c=6;for(let u=0;u<c;u++)a[u]!==void 0&&l++;return l===c}function s(a){const l=a.target;l.removeEventListener("dispose",s);const c=e.get(l);c!==void 0&&(e.delete(l),c.dispose())}function o(){e=new WeakMap,t!==null&&(t.dispose(),t=null)}return{get:i,dispose:o}}function hOe(n){const e={};function t(i){if(e[i]!==void 0)return e[i];let r;switch(i){case"WEBGL_depth_texture":r=n.getExtension("WEBGL_depth_texture")||n.getExtension("MOZ_WEBGL_depth_texture")||n.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":r=n.getExtension("EXT_texture_filter_anisotropic")||n.getExtension("MOZ_EXT_texture_filter_anisotropic")||n.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":r=n.getExtension("WEBGL_compressed_texture_s3tc")||n.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":r=n.getExtension("WEBGL_compressed_texture_pvrtc")||n.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:r=n.getExtension(i)}return e[i]=r,r}return{has:function(i){return t(i)!==null},init:function(i){i.isWebGL2?(t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance")):(t("WEBGL_depth_texture"),t("OES_texture_float"),t("OES_texture_half_float"),t("OES_texture_half_float_linear"),t("OES_standard_derivatives"),t("OES_element_index_uint"),t("OES_vertex_array_object"),t("ANGLE_instanced_arrays")),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture")},get:function(i){const r=t(i);return r===null&&console.warn("THREE.WebGLRenderer: "+i+" extension not supported."),r}}}function fOe(n,e,t,i){const r={},s=new WeakMap;function o(h){const f=h.target;f.index!==null&&e.remove(f.index);for(const g in f.attributes)e.remove(f.attributes[g]);for(const g in f.morphAttributes){const v=f.morphAttributes[g];for(let w=0,y=v.length;w<y;w++)e.remove(v[w])}f.removeEventListener("dispose",o),delete r[f.id];const m=s.get(f);m&&(e.remove(m),s.delete(f)),i.releaseStatesOfGeometry(f),f.isInstancedBufferGeometry===!0&&delete f._maxInstanceCount,t.memory.geometries--}function a(h,f){return r[f.id]===!0||(f.addEventListener("dispose",o),r[f.id]=!0,t.memory.geometries++),f}function l(h){const f=h.attributes;for(const g in f)e.update(f[g],n.ARRAY_BUFFER);const m=h.morphAttributes;for(const g in m){const v=m[g];for(let w=0,y=v.length;w<y;w++)e.update(v[w],n.ARRAY_BUFFER)}}function c(h){const f=[],m=h.index,g=h.attributes.position;let v=0;if(m!==null){const _=m.array;v=m.version;for(let x=0,S=_.length;x<S;x+=3){const M=_[x+0],A=_[x+1],I=_[x+2];f.push(M,A,A,I,I,M)}}else if(g!==void 0){const _=g.array;v=g.version;for(let x=0,S=_.length/3-1;x<S;
vendor: 4,929 bytes, line 3904
3904x+=3){const M=x+0,A=x+1,I=x+2;f.push(M,A,A,I,I,M)}}else return;const w=new(WQ(f)?XL:KL)(f,1);w.version=v;const y=s.get(h);y&&e.remove(y),s.set(h,w)}function u(h){const f=s.get(h);if(f){const m=h.index;m!==null&&f.version<m.version&&c(h)}else c(h);return s.get(h)}return{get:a,update:l,getWireframeAttribute:u}}function dOe(n,e,t,i){const r=i.isWebGL2;let s;function o(m){s=m}let a,l;function c(m){a=m.type,l=m.bytesPerElement}function u(m,g){n.drawElements(s,g,a,m*l),t.update(g,s,1)}function h(m,g,v){if(v===0)return;let w,y;if(r)w=n,y="drawElementsInstanced";else if(w=e.get("ANGLE_instanced_arrays"),y="drawElementsInstancedANGLE",w===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}w[y](s,g,a,m*l,v),t.update(g,s,v)}function f(m,g,v){if(v===0)return;const w=e.get("WEBGL_multi_draw");if(w===null)for(let y=0;y<v;y++)this.render(m[y]/l,g[y]);else{w.multiDrawElementsWEBGL(s,g,0,a,m,0,v);let y=0;for(let _=0;_<v;_++)y+=g[_];t.update(y,s,1)}}this.setMode=o,this.setIndex=c,this.render=u,this.renderInstances=h,this.renderMultiDraw=f}function pOe(n){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function i(s,o,a){switch(t.calls++,o){case n.TRIANGLES:t.triangles+=a*(s/3);break;case n.LINES:t.lines+=a*(s/2);break;case n.LINE_STRIP:t.lines+=a*(s-1);break;case n.LINE_LOOP:t.lines+=a*s;break;case n.POINTS:t.points+=a*s;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:r,update:i}}function mOe(n,e){return n[0]-e[0]}function gOe(n,e){return Math.abs(e[1])-Math.abs(n[1])}function yOe(n,e,t){const i={},r=new Float32Array(8),s=new WeakMap,o=new mn,a=[];for(let c=0;c<8;c++)a[c]=[c,0];function l(c,u,h){const f=c.morphTargetInfluences;if(e.isWebGL2===!0){const m=u.morphAttributes.position||u.morphAttributes.normal||u.morphAttributes.color,g=m!==void 0?m.length:0;let v=s.get(u);if(v===void 0||v.count!==g){let G=function(){C.dispose(),s.delete(u),u.removeEventListener("dispose",G)};v!==void 0&&v.texture.dispose();const w=u.morphAttributes.position!==void 0,y=u.morphAttributes.normal!==void 0,_=u.morphAttributes.color!==void 0,x=u.morphAttributes.position||[],S=u.morphAttributes.normal||[],M=u.morphAttributes.color||[];let A=0;w===!0&&(A=1),y===!0&&(A=2),_===!0&&(A=3);let I=u.attributes.position.count*A,D=1;I>e.maxTextureSize&&(D=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const k=new Float32Array(I*D*4*g),C=new k2(k,I,D,g);C.type=co,C.needsUpdate=!0;const U=A*4;for(let H=0;H<g;H++){const z=x[H],P=S[H],R=M[H],F=I*D*4*H;for(let N=0;N<z.count;N++){const O=N*U;w===!0&&(o.fromBufferAttribute(z,N),k[F+O+0]=o.x,k[F+O+1]=o.y,k[F+O+2]=o.z,k[F+O+3]=0),y===!0&&(o.fromBufferAttribute(P,N),k[F+O+4]=o.x,k[F+O+5]=o.y,k[F+O+6]=o.z,k[F+O+7]=0),_===!0&&(o.fromBufferAttribute(R,N),k[F+O+8]=o.x,k[F+O+9]=o.y,k[F+O+10]=o.z,k[F+O+11]=R.itemSize===4?o.w:1)}}v={count:g,texture:C,size:new Me(I,D)},s.set(u,v),u.addEventListener("dispose",G)}if(c.isInstancedMesh===!0&&c.morphTexture!==null)h.getUniforms().setValue(n,"morphTexture",c.morphTexture,t);else{let w=0;for(let _=0;_<f.length;_++)w+=f[_];const y=u.morphTargetsRelative?1:1-w;h.getUniforms().setValue(n,"morphTargetBaseInfluence",y),h.getUniforms().setValue(n,"morphTargetInfluences",f)}h.getUniforms().setValue(n,"morphTargetsTexture",v.texture,t),h.getUniforms().setValue(n,"morphTargetsTextureSize",v.size)}else{const m=f===void 0?0:f.length;let g=i[u.id];if(g===void 0||g.length!==m){g=[];for(let x=0;x<m;x++)g[x]=[x,0];i[u.id]=g}for(let x=0;x<m;x++){const S=g[x];S[0]=x,S[1]=f[x]}g.sort(gOe);for(let x=0;x<8;x++)x<m&&g[x][1]?(a[x][0]=g[x][0],a[x][1]=g[x][1]):(a[x][0]=Number.MAX_SAFE_INTEGER,a[x][1]=0);a.sort(mOe);const v=u.morphAttributes.position,w=u.morphAttributes.normal;let y=0;for(let x=0;x<8;x++){const S=a[x],M=S[0],A=S[1];M!==Number.MAX_SAFE_INTEGER&&A?(v&&u.getAttribute("morphTarget"+x)!==v[M]&&u.setAttribute("morphTarget"+x,v[M]),w&&u.getAttribute("morphNormal"+x)!==w[M]&&u.setAttribute("morphNormal"+x,w[M]),r[x]=A,y+=A):(v&&u.hasAttribute("morphTarget"+x)===!0&&u.deleteAttribute("morphTarget"+x),w&&u.hasAttribute("morphNormal"+x)===!0&&u.deleteAttribute("morphNormal"+x),r[x]=0)}const _=u.morphTargetsRelative?1:1-y;h.getUniforms().setValue(n,"morphTargetBaseInfluence",_),h.getUniforms().setValue(n,"morphTargetInfluences",r)}}return{update:l}}function vOe(n,e,t,i){let r=new WeakMap;function s(l){const c=i.render.frame,u=l.geometry,h=e.get(l,u);if(r.get(h)!==c&&(e.update(h),r.set(h,c)),l.isInstancedMesh&&(l.hasEventListener("dispose",a)===!1&&l.addEventListener("dispose",a),r.get(l)!==c&&(t.update(l.instanceMatrix,n.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,n.ARRAY_BUFFER),r.set(l,c))),l.isSkinnedMesh){const f=l.skeleton;
vendor: 15,885 bytes, lines 3904-3938
3904r.get(f)!==c&&(f.update(),r.set(f,c))}return h}function o(){r=new WeakMap}function a(l){const c=l.target;c.removeEventListener("dispose",a),t.remove(c.instanceMatrix),c.instanceColor!==null&&t.remove(c.instanceColor)}return{update:s,dispose:o}}class QL extends zn{constructor(e,t,i,r,s,o,a,l,c,u){if(u=u!==void 0?u:zh,u!==zh&&u!==mp)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===zh&&(i=Fc),i===void 0&&u===mp&&(i=Fh),super(null,r,s,o,a,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:hi,this.minFilter=l!==void 0?l:hi,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}const nZ=new zn,iZ=new QL(1,1);iZ.compareFunction=GL;const rZ=new k2,sZ=new qL,oZ=new lx,FV=[],zV=[],VV=new Float32Array(16),HV=new Float32Array(9),$V=new Float32Array(4);function sy(n,e,t){const i=n[0];if(i<=0||i>0)return n;const r=e*t;let s=FV[r];if(s===void 0&&(s=new Float32Array(r),FV[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Ni(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t<i;t++)if(n[t]!==e[t])return!1;return!0}function Di(n,e){for(let t=0,i=e.length;t<i;t++)n[t]=e[t]}function F2(n,e){let t=zV[e];t===void 0&&(t=new Int32Array(e),zV[e]=t);for(let i=0;i!==e;++i)t[i]=n.allocateTextureUnit();return t}function wOe(n,e){const t=this.cache;t[0]!==e&&(n.uniform1f(this.addr,e),t[0]=e)}function xOe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ni(t,e))return;n.uniform2fv(this.addr,e),Di(t,e)}}function bOe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(n.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(Ni(t,e))return;n.uniform3fv(this.addr,e),Di(t,e)}}function _Oe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ni(t,e))return;n.uniform4fv(this.addr,e),Di(t,e)}}function EOe(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Ni(t,e))return;n.uniformMatrix2fv(this.addr,!1,e),Di(t,e)}else{if(Ni(t,i))return;$V.set(i),n.uniformMatrix2fv(this.addr,!1,$V),Di(t,i)}}function SOe(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Ni(t,e))return;n.uniformMatrix3fv(this.addr,!1,e),Di(t,e)}else{if(Ni(t,i))return;HV.set(i),n.uniformMatrix3fv(this.addr,!1,HV),Di(t,i)}}function AOe(n,e){const t=this.cache,i=e.elements;if(i===void 0){if(Ni(t,e))return;n.uniformMatrix4fv(this.addr,!1,e),Di(t,e)}else{if(Ni(t,i))return;VV.set(i),n.uniformMatrix4fv(this.addr,!1,VV),Di(t,i)}}function MOe(n,e){const t=this.cache;t[0]!==e&&(n.uniform1i(this.addr,e),t[0]=e)}function TOe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ni(t,e))return;n.uniform2iv(this.addr,e),Di(t,e)}}function POe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Ni(t,e))return;n.uniform3iv(this.addr,e),Di(t,e)}}function COe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ni(t,e))return;n.uniform4iv(this.addr,e),Di(t,e)}}function IOe(n,e){const t=this.cache;t[0]!==e&&(n.uniform1ui(this.addr,e),t[0]=e)}function ROe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(n.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(Ni(t,e))return;n.uniform2uiv(this.addr,e),Di(t,e)}}function NOe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(n.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(Ni(t,e))return;n.uniform3uiv(this.addr,e),Di(t,e)}}function DOe(n,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(n.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(Ni(t,e))return;n.uniform4uiv(this.addr,e),Di(t,e)}}function OOe(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r);const s=this.type===n.SAMPLER_2D_SHADOW?iZ:nZ;t.setTexture2D(e||s,r)}function LOe(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture3D(e||sZ,r)}function UOe(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTextureCube(e||oZ,r)}function BOe(n,e,t){const i=this.cache,r=t.allocateTextureUnit();i[0]!==r&&(n.uniform1i(this.addr,r),i[0]=r),t.setTexture2DArray(e||rZ,r)}function kOe(n){switch(n){case 5126:return wOe;case 35664:return xOe;case 35665:return bOe;case 35666:return _Oe;case 35674:return EOe;case 35675:return SOe;case 35676:return AOe;case 5124:case 35670:return MOe;case 35667:case 35671:return TOe;case 35668:case 35672:return POe;case 35669:case 35673:return COe;case 5125:return IOe;case 36294:return ROe;case 36295:return NOe;case 36296:return DOe;case 35678:case 36198:case 36298:case 36306:case 35682:return OOe;case 35679:case 36299:case 36307:return LOe;case 35680:case 36300:case 36308:case 36293:return UOe;case 36289:case 36303:case 36311:case 36292:return BOe}}function FOe(n,e){n.uniform1fv(this.addr,e)}function zOe(n,e){const t=sy(e,this.size,2);n.uniform2fv(this.addr,t)}function VOe(n,e){const t=sy(e,this.size,3);n.uniform3fv(this.addr,t)}function HOe(n,e){const t=sy(e,this.size,4);n.uniform4fv(this.addr,t)}function $Oe(n,e){const t=sy(e,this.size,4);n.uniformMatrix2fv(this.addr,!1,t)}function GOe(n,e){const t=sy(e,this.size,9);n.uniformMatrix3fv(this.addr,!1,t)}function jOe(n,e){const t=sy(e,this.size,16);n.uniformMatrix4fv(this.addr,!1,t)}function WOe(n,e){n.uniform1iv(this.addr,e)}function qOe(n,e){n.uniform2iv(this.addr,e)}function KOe(n,e){n.uniform3iv(this.addr,e)}function XOe(n,e){n.uniform4iv(this.addr,e)}function YOe(n,e){n.uniform1uiv(this.addr,e)}function QOe(n,e){n.uniform2uiv(this.addr,e)}function ZOe(n,e){n.uniform3uiv(this.addr,e)}function JOe(n,e){n.uniform4uiv(this.addr,e)}function eLe(n,e,t){const i=this.cache,r=e.length,s=F2(t,r);Ni(i,s)||(n.uniform1iv(this.addr,s),Di(i,s));for(let o=0;o!==r;++o)t.setTexture2D(e[o]||nZ,s[o])}function tLe(n,e,t){const i=this.cache,r=e.length,s=F2(t,r);Ni(i,s)||(n.uniform1iv(this.addr,s),Di(i,s));for(let o=0;o!==r;++o)t.setTexture3D(e[o]||sZ,s[o])}function nLe(n,e,t){const i=this.cache,r=e.length,s=F2(t,r);Ni(i,s)||(n.uniform1iv(this.addr,s),Di(i,s));for(let o=0;o!==r;++o)t.setTextureCube(e[o]||oZ,s[o])}function iLe(n,e,t){const i=this.cache,r=e.length,s=F2(t,r);Ni(i,s)||(n.uniform1iv(this.addr,s),Di(i,s));for(let o=0;o!==r;++o)t.setTexture2DArray(e[o]||rZ,s[o])}function rLe(n){switch(n){case 5126:return FOe;case 35664:return zOe;case 35665:return VOe;case 35666:return HOe;case 35674:return $Oe;case 35675:return GOe;case 35676:return jOe;case 5124:case 35670:return WOe;case 35667:case 35671:return qOe;case 35668:case 35672:return KOe;case 35669:case 35673:return XOe;case 5125:return YOe;case 36294:return QOe;case 36295:return ZOe;case 36296:return JOe;case 35678:case 36198:case 36298:case 36306:case 35682:return eLe;case 35679:case 36299:case 36307:return tLe;case 35680:case 36300:case 36308:case 36293:return nLe;case 36289:case 36303:case 36311:case 36292:return iLe}}class sLe{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.setValue=kOe(t.type)}}class oLe{constructor(e,t,i){this.id=e,this.addr=i,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=rLe(t.type)}}class aLe{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,i){const r=this.seq;for(let s=0,o=r.length;s!==o;++s){const a=r[s];a.setValue(e,t[a.id],i)}}}const HC=/(\w+)(\])?(\[|\.)?/g;function GV(n,e){n.seq.push(e),n.map[e.id]=e}function lLe(n,e,t){const i=n.name,r=i.length;for(HC.lastIndex=0;;){const s=HC.exec(i),o=HC.lastIndex;let a=s[1];const l=s[2]==="]",c=s[3];if(l&&(a=a|0),c===void 0||c==="["&&o+2===r){GV(t,c===void 0?new sLe(a,n,e):new oLe(a,n,e));break}else{let h=t.map[a];h===void 0&&(h=new aLe(a),GV(t,h)),t=h}}}class QE{constructor(e,t){this.seq=[],this.map={};const i=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let r=0;r<i;++r){const s=e.getActiveUniform(t,r),o=e.getUniformLocation(t,s.name);lLe(s,o,this)}}setValue(e,t,i,r){const s=this.map[t];s!==void 0&&s.setValue(e,i,r)}setOptional(e,t,i){const r=t[i];r!==void 0&&this.setValue(e,i,r)}static upload(e,t,i,r){for(let s=0,o=t.length;s!==o;++s){const a=t[s],l=i[a.id];l.needsUpdate!==!1&&a.setValue(e,l.value,r)}}static seqWithValue(e,t){const i=[];for(let r=0,s=e.length;r!==s;++r){const o=e[r];o.id in t&&i.push(o)}return i}}function jV(n,e,t){const i=n.createShader(e);return n.shaderSource(i,t),n.compileShader(i),i}const cLe=37297;let uLe=0;function hLe(n,e){const t=n.split(`
3905`),i=[],r=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let o=r;o<s;o++){const a=o+1;i.push(`${a===e?">":" "} ${a}: ${t[o]}`)}return i.join(`
3906`)}function fLe(n){const e=pn.getPrimaries(pn.workingColorSpace),t=pn.getPrimaries(n);let i;switch(e===t?i="":e===l1&&t===a1?i="LinearDisplayP3ToLinearSRGB":e===a1&&t===l1&&(i="LinearSRGBToLinearDisplayP3"),n){case hu:case ox:return[i,"LinearTransferOETF"];case Jo:case B2:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[i,"LinearTransferOETF"]}}function WV(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return t.toUpperCase()+`
3907
3908`+r+`
3909
3910`+hLe(n.getShaderSource(e),o)}else return r}function dLe(n,e){const t=fLe(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function pLe(n,e){let t;switch(e){case wQ:t="Linear";break;case xQ:t="Reinhard";break;case bQ:t="OptimizedCineon";break;case OL:t="ACESFilmic";break;case EQ:t="AgX";break;case SQ:t="Neutral";break;case _Q:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function mLe(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.alphaToCoverage||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(lg).join(`
3911`)}function gLe(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(lg).join(`
3912`)}function yLe(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(`
3913`)}function vLe(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const s=n.getActiveAttrib(e,r),o=s.name;let a=1;s.type===n.FLOAT_MAT2&&(a=2),s.type===n.FLOAT_MAT3&&(a=3),s.type===n.FLOAT_MAT4&&(a=4),t[o]={type:s.type,location:n.getAttribLocation(e,o),locationSize:a}}return t}function lg(n){return n!==""}function qV(n,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return n.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,t).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 KV(n,e){return n.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const wLe=/^[ \t]*#include +<([\w\d./]+)>/gm;function zN(n){return n.replace(wLe,bLe)}const xLe=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function bLe(n,e){let t=Lt[e];if(t===void 0){const i=xLe.get(e);if(i!==void 0)t=Lt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return zN(t)}const _Le=/#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 XV(n){return n.replace(_Le,ELe)}function ELe(n,e,t,i){let r="";for(let s=parseInt(e);s<parseInt(t);s++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return r}function YV(n){let e=`precision ${n.precision} float;
3914	precision ${n.precision} int;
3915	precision ${n.precision} sampler2D;
3916	precision ${n.precision} samplerCube;
3917	`;return n.isWebGL2&&(e+=`precision ${n.precision} sampler3D;
3918		precision ${n.precision} sampler2DArray;
3919		precision ${n.precision} sampler2DShadow;
3920		precision ${n.precision} samplerCubeShadow;
3921		precision ${n.precision} sampler2DArrayShadow;
3922		precision ${n.precision} isampler2D;
3923		precision ${n.precision} isampler3D;
3924		precision ${n.precision} isamplerCube;
3925		precision ${n.precision} isampler2DArray;
3926		precision ${n.precision} usampler2D;
3927		precision ${n.precision} usampler3D;
3928		precision ${n.precision} usamplerCube;
3929		precision ${n.precision} usampler2DArray;
3930		`),n.precision==="highp"?e+=`
3931#define HIGH_PRECISION`:n.precision==="mediump"?e+=`
3932#define MEDIUM_PRECISION`:n.precision==="lowp"&&(e+=`
3933#define LOW_PRECISION`),e}function SLe(n){let e="SHADOWMAP_TYPE_BASIC";return n.shadowMapType===D2?e="SHADOWMAP_TYPE_PCF":n.shadowMapType===rw?e="SHADOWMAP_TYPE_PCF_SOFT":n.shadowMapType===Sa&&(e="SHADOWMAP_TYPE_VSM"),e}function ALe(n){let e="ENVMAP_TYPE_CUBE";if(n.envMap)switch(n.envMapMode){case au:case Yh:e="ENVMAP_TYPE_CUBE";break;case ny:e="ENVMAP_TYPE_CUBE_UV";break}return e}function MLe(n){let e="ENVMAP_MODE_REFLECTION";if(n.envMap)switch(n.envMapMode){case Yh:e="ENVMAP_MODE_REFRACTION";break}return e}function TLe(n){let e="ENVMAP_BLENDING_NONE";if(n.envMap)switch(n.combine){case sx:e="ENVMAP_BLENDING_MULTIPLY";break;case yQ:e="ENVMAP_BLENDING_MIX";break;case vQ:e="ENVMAP_BLENDING_ADD";break}return e}function PLe(n){const e=n.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),7*16)),texelHeight:i,maxMip:t}}function CLe(n,e,t,i){const r=n.getContext(),s=t.defines;let o=t.vertexShader,a=t.fragmentShader;const l=SLe(t),c=ALe(t),u=MLe(t),h=TLe(t),f=PLe(t),m=t.isWebGL2?"":mLe(t),g=gLe(t),v=yLe(s),w=r.createProgram();let y,_,x=t.glslVersion?"#version "+t.glslVersion+`
3934`:"";t.isRawShaderMaterial?(y=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(lg).join(`
3935`),y.length>0&&(y+=`
3936`),_=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(lg).join(`
3937`),_.length>0&&(_+=`
3938`)):(y=[YV(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.extensionCl
vendor: 6,426 bytes, lines 3938-3940
3938ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#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","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
3939`].filter(lg).join(`
3940`),_=[m,YV(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.max
vendor: 26,472 bytes, lines 3940-3960
3940Mip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==kl?"#define TONE_MAPPING":"",t.toneMapping!==kl?Lt.tonemapping_pars_fragment:"",t.toneMapping!==kl?pLe("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Lt.colorspace_pars_fragment,dLe("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
3941`].filter(lg).join(`
3942`)),o=zN(o),o=qV(o,t),o=KV(o,t),a=zN(a),a=qV(a,t),a=KV(a,t),o=XV(o),a=XV(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(x=`#version 300 es
3943`,y=[g,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
3944`)+`
3945`+y,_=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===BN?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===BN?"":"#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(`
3946`)+`
3947`+_);const S=x+y+o,M=x+_+a,A=jV(r,r.VERTEX_SHADER,S),I=jV(r,r.FRAGMENT_SHADER,M);r.attachShader(w,A),r.attachShader(w,I),t.index0AttributeName!==void 0?r.bindAttribLocation(w,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(w,0,"position"),r.linkProgram(w);function D(G){if(n.debug.checkShaderErrors){const H=r.getProgramInfoLog(w).trim(),z=r.getShaderInfoLog(A).trim(),P=r.getShaderInfoLog(I).trim();let R=!0,F=!0;if(r.getProgramParameter(w,r.LINK_STATUS)===!1)if(R=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,w,A,I);else{const N=WV(r,A,"vertex"),O=WV(r,I,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(w,r.VALIDATE_STATUS)+`
3948
3949Material Name: `+G.name+`
3950Material Type: `+G.type+`
3951
3952Program Info Log: `+H+`
3953`+N+`
3954`+O)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(z===""||P==="")&&(F=!1);F&&(G.diagnostics={runnable:R,programLog:H,vertexShader:{log:z,prefix:y},fragmentShader:{log:P,prefix:_}})}r.deleteShader(A),r.deleteShader(I),k=new QE(r,w),C=vLe(r,w)}let k;this.getUniforms=function(){return k===void 0&&D(this),k};let C;this.getAttributes=function(){return C===void 0&&D(this),C};let U=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return U===!1&&(U=r.getProgramParameter(w,cLe)),U},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(w),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=uLe++,this.cacheKey=e,this.usedTimes=1,this.program=w,this.vertexShader=A,this.fragmentShader=I,this}let ILe=0;class RLe{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new NLe(e),t.set(e,i)),i}}class NLe{constructor(e){this.id=ILe++,this.code=e,this.usedTimes=0}}function DLe(n,e,t,i,r,s,o){const a=new Zd,l=new RLe,c=new Set,u=[],h=r.isWebGL2,f=r.logarithmicDepthBuffer,m=r.vertexTextures;let g=r.precision;const v={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function w(C){return c.add(C),C===0?"uv":`uv${C}`}function y(C,U,G,H,z){const P=H.fog,R=z.geometry,F=C.isMeshStandardMaterial?H.environment:null,N=(C.isMeshStandardMaterial?t:e).get(C.envMap||F),O=N&&N.mapping===ny?N.image.height:null,B=v[C.type];C.precision!==null&&(g=r.getMaxPrecision(C.precision),g!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",g,"instead."));const W=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,Q=W!==void 0?W.length:0;let oe=0;R.morphAttributes.position!==void 0&&(oe=1),R.morphAttributes.normal!==void 0&&(oe=2),R.morphAttributes.color!==void 0&&(oe=3);let Y,te,le,ve;if(B){const fn=Oa[B];Y=fn.vertexShader,te=fn.fragmentShader}else Y=C.vertexShader,te=C.fragmentShader,l.update(C),le=l.getVertexShaderID(C),ve=l.getFragmentShaderID(C);const Te=n.getRenderTarget(),be=z.isInstancedMesh===!0,Le=z.isBatchedMesh===!0,Oe=!!C.map,J=!!C.matcap,Se=!!N,me=!!C.aoMap,Re=!!C.lightMap,Ae=!!C.bumpMap,Ze=!!C.normalMap,Ke=!!C.displacementMap,rt=!!C.emissiveMap,Et=!!C.metalnessMap,X=!!C.roughnessMap,$=C.anisotropy>0,xe=C.clearcoat>0,Ee=C.iridescence>0,Ne=C.sheen>0,Pe=C.transmission>0,_t=$&&!!C.anisotropyMap,pt=xe&&!!C.clearcoatMap,Fe=xe&&!!C.clearcoatNormalMap,$e=xe&&!!C.clearcoatRoughnessMap,At=Ee&&!!C.iridescenceMap,ke=Ee&&!!C.iridescenceThicknessMap,Yn=Ne&&!!C.sheenColorMap,zt=Ne&&!!C.sheenRoughnessMap,dt=!!C.specularMap,lt=!!C.specularColorMap,ct=!!C.specularIntensityMap,qt=Pe&&!!C.transmissionMap,Pt=Pe&&!!C.thicknessMap,En=!!C.gradientMap,re=!!C.alphaMap,je=C.alphaTest>0,de=!!C.alphaHash,ze=!!C.extensions;let We=kl;C.toneMapped&&(Te===null||Te.isXRRenderTarget===!0)&&(We=n.toneMapping);const Ht={isWebGL2:h,shaderID:B,shaderType:C.type,shaderName:C.name,vertexShader:Y,fragmentShader:te,defines:C.defines,customVertexShaderID:le,customFragmentShaderID:ve,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:g,batching:Le,instancing:be,instancingColor:be&&z.instanceColor!==null,instancingMorph:be&&z.morphTexture!==null,supportsVertexTextures:m,outputColorSpace:Te===null?n.outputColorSpace:Te.isXRRenderTarget===!0?Te.texture.colorSpace:hu,alphaToCoverage:!!C.alphaToCoverage,map:Oe,matcap:J,envMap:Se,envMapMode:Se&&N.mapping,envMapCubeUVHeight:O,aoMap:me,lightMap:Re,bumpMap:Ae,normalMap:Ze,displacementMap:m&&Ke,emissiveMap:rt,normalMapObjectSpace:Ze&&C.normalMapType===kQ,normalMapTangentSpace:Ze&&C.normalMapType===lf,metalnessMap:Et,roughnessMap:X,anisotropy:$,anisotropyMap:_t,clearcoat:xe,clearcoatMap:pt,clearcoatNormalMap:Fe,clearcoatRoughnessMap:$e,iridescence:Ee,iridescenceMap:At,iridescenceThicknessMap:ke,sheen:Ne,sheenColorMap:Yn,sheenRoughnessMap:zt,specularMap:dt,specularColorMap:lt,specularIntensityMap:ct,transmission:Pe,transmissionMap:qt,thicknessMap:Pt,gradientMap:En,opaque:C.transparent===!1&&C.blending===Yd&&C.alphaToCoverage===!1,alphaMap:re,alphaTest:je,alphaHash:de,combine:C.combine,mapUv:Oe&&w(C.map.channel),aoMapUv:me&&w(C.aoMap.channel),lightMapUv:Re&&w(C.lightMap.channel),bumpMapUv:Ae&&w(C.bumpMap.channel),normalMapUv:Ze&&w(C.normalMap.channel),displacementMapUv:Ke&&w(C.displacementMap.channel),emissiveMapUv:rt&&w(C.emissiveMap.channel),metalnessMapUv:Et&&w(C.metalnessMap.channel),roughnessMapUv:X&&w(C.roughnessMap.channel),anisotropyMapUv:_t&&w(C.anisotropyMap.channel),clearcoatMapUv:pt&&w(C.clearcoatMap.channel),clearcoatNormalMapUv:Fe&&w(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:$e&&w(C.clearcoatRoughnessMap.channel),iridescenceMapUv:At&&w(C.iridescenceMap.channel),iridescenceThicknessMapUv:ke&&w(C.iridescenceThicknessMap.channel),sheenColorMapUv:Yn&&w(C.sheenColorMap.channel),sheenRoughnessMapUv:zt&&w(C.sheenRoughnessMap.channel),specularMapUv:dt&&w(C.specularMap.channel),specularColorMapUv:lt&&w(C.specularColorMap.channel),specularIntensityMapUv:ct&&w(C.specularIntensityMap.channel),transmissionMapUv:qt&&w(C.transmissionMap.channel),thicknessMapUv:Pt&&w(C.thicknessMap.channel),alphaMapUv:re&&w(C.alphaMap.channel),vertexTangents:!!R.attributes.tangent&&(Ze||$),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!R.attributes.color&&R.attributes.color.itemSize===4,pointsUvs:z.isPoints===!0&&!!R.attributes.uv&&(Oe||re),fog:!!P,useFog:C.fog===!0,fogExp2:!!P&&P.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:z.isSkinnedMesh===!0,morphTargets:R.morphAttributes.position!==void 0,morphNormals:R.morphAttributes.normal!==void 0,morphColors:R.morphAttributes.color!==void 0,morphTargetsCount:Q,morphTextureStride:oe,numDirLights:U.directional.length,numPointLights:U.point.length,numSpotLights:U.spot.length,numSpotLightMaps:U.spotLightMap.length,numRectAreaLights:U.rectArea.length,numHemiLights:U.hemi.length,numDirLightShadows:U.directionalShadowMap.length,numPointLightShadows:U.pointShadowMap.length,numSpotLightShadows:U.spotShadowMap.length,numSpotLightShadowsWithMaps:U.numSpotLightShadowsWithMaps,numLightProbes:U.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:C.dithering,shadowMapEnabled:n.shadowMap.enabled&&G.length>0,shadowMapType:n.shadowMap.type,toneMapping:We,useLegacyLights:n._useLegacyLights,decodeVideoTexture:Oe&&C.map.isVideoTexture===!0&&pn.getTransfer(C.map.colorSpace)===An,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===Ua,flipSided:C.side===cs,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionDerivatives:ze&&C.extensions.derivatives===!0,extensionFragDepth:ze&&C.extensions.fragDepth===!0,extensionDrawBuffers:ze&&C.extensions.drawBuffers===!0,extensionShaderTextureLOD:ze&&C.extensions.shaderTextureLOD===!0,extensionClipCullDistance:ze&&C.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:ze&&C.extensions.multiDraw===!0&&i.has("WEBGL_multi_draw"),rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:C.customProgramCacheKey()};return Ht.vertexUv1s=c.has(1),Ht.vertexUv2s=c.has(2),Ht.vertexUv3s=c.has(3),c.clear(),Ht}function _(C){const U=[];if(C.shaderID?U.push(C.shaderID):(U.push(C.customVertexShaderID),U.push(C.customFragmentShaderID)),C.defines!==void 0)for(const G in C.defines)U.push(G),U.push(C.defines[G]);return C.isRawShaderMaterial===!1&&(x(U,C),S(U,C),U.push(n.outputColorSpace)),U.push(C.customProgramCacheKey),U.join()}function x(C,U){C.push(U.precision),C.push(U.outputColorSpace),C.push(U.envMapMode),C.push(U.envMapCubeUVHeight),C.push(U.mapUv),C.push(U.alphaMapUv),C.push(U.lightMapUv),C.push(U.aoMapUv),C.push(U.bumpMapUv),C.push(U.normalMapUv),C.push(U.displacementMapUv),C.push(U.emissiveMapUv),C.push(U.metalnessMapUv),C.push(U.roughnessMapUv),C.push(U.anisotropyMapUv),C.push(U.clearcoatMapUv),C.push(U.clearcoatNormalMapUv),C.push(U.clearcoatRoughnessMapUv),C.push(U.iridescenceMapUv),C.push(U.iridescenceThicknessMapUv),C.push(U.sheenColorMapUv),C.push(U.sheenRoughnessMapUv),C.push(U.specularMapUv),C.push(U.specularColorMapUv),C.push(U.specularIntensityMapUv),C.push(U.transmissionMapUv),C.push(U.thicknessMapUv),C.push(U.combine),C.push(U.fogExp2),C.push(U.sizeAttenuation),C.push(U.morphTargetsCount),C.push(U.morphAttributeCount),C.push(U.numDirLights),C.push(U.numPointLights),C.push(U.numSpotLights),C.push(U.numSpotLightMaps),C.push(U.numHemiLights),C.push(U.numRectAreaLights),C.push(U.numDirLightShadows),C.push(U.numPointLightShadows),C.push(U.numSpotLightShadows),C.push(U.numSpotLightShadowsWithMaps),C.push(U.numLightProbes),C.push(U.shadowMapType),C.push(U.toneMapping),C.push(U.numClippingPlanes),C.push(U.numClipIntersection),C.push(U.depthPacking)}function S(C,U){a.disableAll(),U.isWebGL2&&a.enable(0),U.supportsVertexTextures&&a.enable(1),U.instancing&&a.enable(2),U.instancingColor&&a.enable(3),U.instancingMorph&&a.enable(4),U.matcap&&a.enable(5),U.envMap&&a.enable(6),U.normalMapObjectSpace&&a.enable(7),U.normalMapTangentSpace&&a.enable(8),U.clearcoat&&a.enable(9),U.iridescence&&a.enable(10),U.alphaTest&&a.enable(11),U.vertexColors&&a.enable(12),U.vertexAlphas&&a.enable(13),U.vertexUv1s&&a.enable(14),U.vertexUv2s&&a.enable(15),U.vertexUv3s&&a.enable(16),U.vertexTangents&&a.enable(17),U.anisotropy&&a.enable(18),U.alphaHash&&a.enable(19),U.batching&&a.enable(20),C.push(a.mask),a.disableAll(),U.fog&&a.enable(0),U.useFog&&a.enable(1),U.flatShading&&a.enable(2),U.logarithmicDepthBuffer&&a.enable(3),U.skinning&&a.enable(4),U.morphTargets&&a.enable(5),U.morphNormals&&a.enable(6),U.morphColors&&a.enable(7),U.premultipliedAlpha&&a.enable(8),U.shadowMapEnabled&&a.enable(9),U.useLegacyLights&&a.enable(10),U.doubleSided&&a.enable(11),U.flipSided&&a.enable(12),U.useDepthPacking&&a.enable(13),U.dithering&&a.enable(14),U.transmission&&a.enable(15),U.sheen&&a.enable(16),U.opaque&&a.enable(17),U.pointsUvs&&a.enable(18),U.decodeVideoTexture&&a.enable(19),U.alphaToCoverage&&a.enable(20),C.push(a.mask)}function M(C){const U=v[C.type];let G;if(U){const H=Oa[U];G=ZQ.clone(H.uniforms)}else G=C.uniforms;return G}function A(C,U){let G;for(let H=0,z=u.length;H<z;H++){const P=u[H];if(P.cacheKey===U){G=P,++G.usedTimes;break}}return G===void 0&&(G=new CLe(n,U,C,s),u.push(G)),G}function I(C){if(--C.usedTimes===0){const U=u.indexOf(C);u[U]=u[u.length-1],u.pop(),C.destroy()}}function D(C){l.remove(C)}function k(){l.dispose()}return{getParameters:y,getProgramCacheKey:_,getUniforms:M,acquireProgram:A,releaseProgram:I,releaseShaderCache:D,programs:u,dispose:k}}function OLe(){let n=new WeakMap;function e(s){let o=n.get(s);return o===void 0&&(o={},n.set(s,o)),o}function t(s){n.delete(s)}function i(s,o,a){n.get(s)[o]=a}function r(){n=new WeakMap}return{get:e,remove:t,update:i,dispose:r}}function LLe(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.material.id!==e.material.id?n.material.id-e.material.id:n.z!==e.z?n.z-e.z:n.id-e.id}function QV(n,e){return n.groupOrder!==e.groupOrder?n.groupOrder-e.groupOrder:n.renderOrder!==e.renderOrder?n.renderOrder-e.renderOrder:n.z!==e.z?e.z-n.z:n.id-e.id}function ZV(){const n=[];let e=0;const t=[],i=[],r=[];function s(){e=0,t.length=0,i.length=0,r.length=0}function o(h,f,m,g,v,w){let y=n[e];return y===void 0?(y={id:h.id,object:h,geometry:f,material:m,groupOrder:g,renderOrder:h.renderOrder,z:v,group:w},n[e]=y):(y.id=h.id,y.object=h,y.geometry=f,y.material=m,y.groupOrder=g,y.renderOrder=h.renderOrder,y.z=v,y.group=w),e++,y}function a(h,f,m,g,v,w){const y=o(h,f,m,g,v,w);m.transmission>0?i.push(y):m.transparent===!0?r.push(y):t.push(y)}function l(h,f,m,g,v,w){const y=o(h,f,m,g,v,w);m.transmission>0?i.unshift(y):m.transparent===!0?r.unshift(y):t.unshift(y)}function c(h,f){t.length>1&&t.sort(h||LLe),i.length>1&&i.sort(f||QV),r.length>1&&r.sort(f||QV)}function u(){for(let h=e,f=n.length;h<f;h++){const m=n[h];if(m.id===null)break;m.id=null,m.object=null,m.geometry=null,m.material=null,m.group=null}}return{opaque:t,transmissive:i,transparent:r,init:s,push:a,unshift:l,finish:u,sort:c}}function ULe(){let n=new WeakMap;function e(i,r){const s=n.get(i);let o;return s===void 0?(o=new ZV,n.set(i,[o])):r>=s.length?(o=new ZV,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function BLe(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new K,color:new et};break;case"SpotLight":t={position:new K,direction:new K,color:new et,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new K,color:new et,distance:0,decay:0};break;case"HemisphereLight":t={direction:new K,skyColor:new et,groundColor:new et};break;case"RectAreaLight":t={color:new et,position:new K,halfWidth:new K,halfHeight:new K};break}return n[e.id]=t,t}}}function kLe(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Me};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Me};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Me,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let FLe=0;function zLe(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function VLe(n,e){const t=new BLe,i=kLe(),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 u=0;u<9;u++)r.probe.push(new K);const s=new K,o=new wt,a=new wt;function l(u,h){let f=0,m=0,g=0;for(let G=0;G<9;G++)r.probe[G].set(0,0,0);let v=0,w=0,y=0,_=0,x=0,S=0,M=0,A=0,I=0,D=0,k=0;u.sort(zLe);const C=h===!0?Math.PI:1;for(let G=0,H=u.length;G<H;G++){const z=u[G],P=z.color,R=z.intensity,F=z.distance,N=z.shadow&&z.shadow.map?z.shadow.map.texture:null;if(z.isAmbientLight)f+=P.r*R*C,m+=P.g*R*C,g+=P.b*R*C;else if(z.isLightProbe){for(let O=0;O<9;O++)r.probe[O].addScaledVector(z.sh.coefficients[O],R);k++}else if(z.isDirectionalLight){const O=t.get(z);if(O.color.copy(z.color).multiplyScalar(z.intensity*C),z.castShadow){const B=z.shadow,W=i.get(z);W.shadowBias=B.bias,W.shadowNormalBias=B.normalBias,W.shadowRadius=B.radius,W.shadowMapSize=B.mapSize,r.directionalShadow[v]=W,r.directionalShadowMap[v]=N,r.directionalShadowMatrix[v]=z.shadow.matrix,S++}r.directional[v]=O,v++}else if(z.isSpotLight){const O=t.get(z);O.position.setFromMatrixPosition(z.matrixWorld),O.color.copy(P).multiplyScalar(R*C),O.distance=F,O.coneCos=Math.cos(z.angle),O.penumbraCos=Math.cos(z.angle*(1-z.penumbra)),O.decay=z.decay,r.spot[y]=O;const B=z.shadow;if(z.map&&(r.spotLightMap[I]=z.map,I++,B.updateMatrices(z),z.castShadow&&D++),r.spotLightMatrix[y]=B.matrix,z.castShadow){const W=i.get(z);W.shadowBias=B.bias,W.shadowNormalBias=B.normalBias,W.shadowRadius=B.radius,W.shadowMapSize=B.mapSize,r.spotShadow[y]=W,r.spotShadowMap[y]=N,A++}y++}else if(z.isRectAreaLight){const O=t.get(z);O.color.copy(P).multiplyScalar(R),O.halfWidth.set(z.width*.5,0,0),O.halfHeight.set(0,z.height*.5,0),r.rectArea[_]=O,_++}else if(z.isPointLight){const O=t.get(z);if(O.color.copy(z.color).multiplyScalar(z.intensity*C),O.distance=z.distance,O.decay=z.decay,z.castShadow){const B=z.shadow,W=i.get(z);W.shadowBias=B.bias,W.shadowNormalBias=B.normalBias,W.shadowRadius=B.radius,W.shadowMapSize=B.mapSize,W.shadowCameraNear=B.camera.near,W.shadowCameraFar=B.camera.far,r.pointShadow[w]=W,r.pointShadowMap[w]=N,r.pointShadowMatrix[w]=z.shadow.matrix,M++}r.point[w]=O,w++}else if(z.isHemisphereLight){const O=t.get(z);O.skyColor.copy(z.color).multiplyScalar(R*C),O.groundColor.copy(z.groundColor).multiplyScalar(R*C),r.hemi[x]=O,x++}}_>0&&(e.isWebGL2?n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=He.LTC_FLOAT_1,r.rectAreaLTC2=He.LTC_FLOAT_2):(r.rectAreaLTC1=He.LTC_HALF_1,r.rectAreaLTC2=He.LTC_HALF_2):n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=He.LTC_FLOAT_1,r.rectAreaLTC2=He.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=He.LTC_HALF_1,r.rectAreaLTC2=He.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=f,r.ambient[1]=m,r.ambient[2]=g;const U=r.hash;(U.directionalLength!==v||U.pointLength!==w||U.spotLength!==y||U.rectAreaLength!==_||U.hemiLength!==x||U.numDirectionalShadows!==S||U.numPointShadows!==M||U.numSpotShadows!==A||U.numSpotMaps!==I||U.numLightProbes!==k)&&(r.directional.length=v,r.spot.length=y,r.rectArea.length=_,r.point.length=w,r.hemi.length=x,r.directionalShadow.length=S,r.directionalShadowMap.length=S,r.pointShadow.length=M,r.pointShadowMap.length=M,r.spotShadow.length=A,r.spotShadowMap.length=A,r.directionalShadowMatrix.length=S,r.pointShadowMatrix.length=M,r.spotLightMatrix.length=A+I-D,r.spotLightMap.length=I,r.numSpotLightShadowsWithMaps=D,r.numLightProbes=k,U.directionalLength=v,U.pointLength=w,U.spotLength=y,U.rectAreaLength=_,U.hemiLength=x,U.numDirectionalShadows=S,U.numPointShadows=M,U.numSpotShadows=A,U.numSpotMaps=I,U.numLightProbes=k,r.version=FLe++)}function c(u,h){let f=0,m=0,g=0,v=0,w=0;const y=h.matrixWorldInverse;for(let _=0,x=u.length;_<x;_++){const S=u[_];if(S.isDirectionalLight){const M=r.directional[f];M.direction.setFromMatrixPosition(S.matrixWorld),s.setFromMatrixPosition(S.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(y),f++}else if(S.isSpotLight){const M=r.spot[g];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(y),M.direction.setFromMatrixPosition(S.matrixWorld),s.setFromMatrixPosition(S.target.matrixWorld),M.direction.sub(s),M.direction.transformDirection(y),g++}else if(S.isRectAreaLight){const M=r.rectArea[v];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(y),a.identity(),o.copy(S.matrixWorld),o.premultiply(y),a.extractRotation(o),M.halfWidth.set(S.width*.5,0,0),M.halfHeight.set(0,S.height*.5,0),M.halfWidth.applyMatrix4(a),M.halfHeight.applyMatrix4(a),v++}else if(S.isPointLight){const M=r.point[m];M.position.setFromMatrixPosition(S.matrixWorld),M.position.applyMatrix4(y),m++}else if(S.isHemisphereLight){const M=r.hemi[w];M.direction.setFromMatrixPosition(S.matrixWorld),M.direction.transformDirection(y),w++}}}return{setup:l,setupView:c,state:r}}function JV(n,e){const t=new VLe(n,e),i=[],r=[];function s(){i.length=0,r.length=0}function o(h){i.push(h)}function a(h){r.push(h)}function l(h){t.setup(i,h)}function c(h){t.setupView(i,h)}return{init:s,state:{lightsArray:i,shadowsArray:r,lights:t},setupLights:l,setupLightsView:c,pushLight:o,pushShadow:a}}function HLe(n,e){let t=new WeakMap;function i(s,o=0){const a=t.get(s);let l;return a===void 0?(l=new JV(n,e),t.set(s,[l])):o>=a.length?(l=new JV(n,e),a.push(l)):l=a[o],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class ZL extends jr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=UQ,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 JL extends jr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const $Le=`void main() {
3955	gl_Position = vec4( position, 1.0 );
3956}`,GLe=`uniform sampler2D shadow_pass;
3957uniform vec2 resolution;
3958uniform float radius;
3959#include <packing>
3960void main() {
3961	const float samples = float( VSM_SAMPLES );
3962	float mean = 0.0;
3963	float squared_mean = 0.0;
3964	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
3965	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
3966	for ( float i = 0.0; i < samples; i ++ ) {
3967		float uvOffset = uvStart + i * uvStride;
3968		#ifdef HORIZONTAL_PASS
3969			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
3970			mean += distribution.x;
3971			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
3972		#else
3973			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
3974			mean += depth;
3975			squared_mean += depth * depth;
3976		#endif
3977	}
3978	mean = mean / samples;
3979	squared_mean = squared_mean / samples;
3980	float std_dev = sqrt( squared_mean - mean * mean );
3981	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
3982}`;function jLe(n,e,t){let i=new cx;const r=new Me,s=new Me,o=new mn,a=new ZL({depthPacking:BQ}),l=new JL,c={},u=t.maxTextureSize,h={[ou]:cs,[cs]:ou,[Ua]:Ua},f=new zs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Me},radius:{value:4}},vertexShader:$Le,fragmentShader:GLe}),m=f.clone();m.defines.HORIZONTAL_PASS=1;const g=new Ft;g.setAttribute("position",new wn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Ai(g,f),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=D2;let y=this.type;this.render=function(A,I,D){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||A.length===0)return;const k=n.getRenderTarget(),C=n.getActiveCubeFace(),U=n.getActiveMipmapLevel(),G=n.state;G.setBlending(Kc),G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);const H=y!==Sa&&this.type===Sa,z=y===Sa&&this.type!==Sa;for(let P=0,R=A.length;P<R;P++){const F=A[P],N=F.shadow;if(N===void 0){console.warn("THREE.WebGLShadowMap:",F,"has no shadow.");continue}if(N.autoUpdate===!1&&N.needsUpdate===!1)continue;r.copy(N.mapSize);const O=N.getFrameExtents();if(r.multiply(O),s.copy(N.mapSize),(r.x>u||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/O.x),r.x=s.x*O.x,N.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/O.y),r.y=s.y*O.y,N.mapSize.y=s.y)),N.map===null||H===!0||z===!0){const W=this.type!==Sa?{minFilter:hi,magFilter:hi}:{};N.map!==null&&N.map.dispose(),N.map=new $a(r.x,r.y,W),N.map.texture.name=F.name+".shadowMap",N.camera.updateProjectionMatrix()}n.setRenderTarget(N.map),n.clear();const B=N.getViewportCount();for(let W=0;W<B;W++){const Q=N.getViewport(W);o.set(s.x*Q.x,s.y*Q.y,s.x*Q.z,s.y*Q.w),G.viewport(o),N.updateMatrices(F,W),i=N.getFrustum(),S(I,D,N.camera,F,this.type)}N.isPointLightShadow!==!0&&this.type===Sa&&_(N,D),N.needsUpdate=!1}y=this.type,w.needsUpdate=!1,n.setRenderTarget(k,C,U)};function _(A,I){const D=e.update(v);f.defines.VSM_SAMPLES!==A.blurSamples&&(f.defines.VSM_SAMPLES=A.blurSamples,m.defines.VSM_SAMPLES=A.blurSamples,f.needsUpdate=!0,m.needsUpdate=!0),A.mapPass===null&&(A.mapPass=new $a(r.x,r.y)),f.uniforms.shadow_pass.value=A.map.texture,f.uniforms.resolution.value=A.mapSize,f.uniforms.radius.value=A.radius,n.setRenderTarget(A.mapPass),n.clear(),n.renderBufferDirect(I,null,D,f,v,null),m.uniforms.shadow_pass.value=A.mapPass.texture,m.uniforms.resolution.value=A.mapSize,m.uniforms.radius.value=A.radius,n.setRenderTarget(A.map),n.clear(),n.renderBufferDirect(I,null,D,m,v,null)}function x(A,I,D,k){let C=null;const U=D.isPointLight===!0?A.customDistanceMaterial:A.customDepthMaterial;if(U!==void 0)C=U;else if(C=D.isPointLight===!0?l:a,n.localClippingEnabled&&I.clipShadows===!0&&Array.isArray(I.clippingPlanes)&&I.clippingPlanes.length!==0||I.displacementMap&&I.displacementScale!==0||I.alphaMap&&I.alphaTest>0||I.map&&I.alphaTest>0){const G=C.uuid,H=I.uuid;let z=c[G];z===void 0&&(z={},c[G]=z);let P=z[H];P===void 0&&(P=C.clone(),z[H]=P,I.addEventListener("dispose",M)),C=P}if(C.visible=I.visible,C.wireframe=I.wireframe,k===Sa?C.side=I.shadowSide!==null?I.shadowSide:I.side:C.side=I.shadowSide!==null?I.shadowSide:h[I.side],C.alphaMap=I.alphaMap,C.alphaTest=I.alphaTest,C.map=I.map,C.clipShadows=I.clipShadows,C.clippingPlanes=I.clippingPlanes,C.clipIntersection=I.clipIntersection,C.displacementMap=I.displacementMap,C.displacementScale=I.displacementScale,C.displacementBias=I.displacementBias,C.wireframeLinewidth=I.wireframeLinewidth,C.linewidth=I.linewidth,D.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const G=n.properties.get(C);G.light=D}return C}function S(A,I,D,k,C){if(A.visible===!1)return;if(A.layers.test(I.layers)&&(A.isMesh||A.isLine||A.isPoints)&&(A.castShadow||A.receiveShadow&&C===Sa)&&(!A.frustumCulled||i.intersectsObject(A))){A.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,A.matrixWorld);const H=e.update(A),z=A.material;if(Array.isArray(z)){const P=H.groups;for(let R=0,F=P.length;R<F;R++){const N=P[R],O=z[N.materialIndex];if(O&&O.visible){const B=x(A,O,k,C);A.onBeforeShadow(n,A,I,D,H,B,N),n.renderBufferDirect(D,null,H,B,A,N),A.onAfterShadow(n,A,I,D,H,B,N)}}}else if(z.visible){const P=x(A,z,k,C);A.onBeforeShadow(n,A,I,D,H,P,null),n.renderBufferDirect(D,null,H,P,A,null),A.onAfterShadow(n,A,I,D,H,P,null)}}const G=A.children;for(let H=0,z=G.length;H<z;H++)S(G[H],I,D,k,C)}function M(A){A.target.removeEventListener("dispose",M);for(const D in c){const k=c[D],C=A.target.uuid;C in k&&(k[C].dispose(),delete k[C])}}}function WLe(n,e,t){const i=t.isWebGL2;function r(){let re=!1;const je=new mn;let de=null;const ze=new mn(0,0,0,0);return{setMask:function(We){de!==We&&!re&&(n.colorMask(We,We,We,We),de=We)},setLocked:function(We){re=We},setClear:function(We,Ht,fn,mi,Wr){Wr===!0&&(We*=mi,Ht*=mi,fn*=mi),je.set(We,Ht,fn,mi),ze.equals(je)===!1&&(n.clearColor(We,Ht,fn,mi),ze.copy(je))},reset:function(){re=!1,de=null,ze.set(-1,0,0,0)}}}function s(){let re=!1,je=null,de=null,ze=null;return{setTest:function(We){We?be(n.DEPTH_TEST):Le(n.DEPTH_TEST)},setMask:function(We){je!==We&&!re&&(n.depthMask(We),je=We)},setFunc:function(We){if(de!==We){switch(We){case uQ:n.depthFunc(n.NEVER);break;case hQ:n.depthFunc(n.ALWAYS);break;case fQ:n.depthFunc(n.LESS);break;case Jw:n.depthFunc(n.LEQUAL);break;case dQ:n.depthFunc(n.EQUAL);break;case pQ:n.depthFunc(n.GEQUAL);break;case mQ:n.depthFunc(n.GREATER);break;case gQ:n.depthFunc(n.NOTEQUAL);break;default:n.depthFunc(n.LEQUAL)}de=We}},setLocked:function(We){re=We},setClear:function(We){ze!==We&&(n.clearDepth(We),ze=We)},reset:function(){re=!1,je=null,de=null,ze=null}}}function o(){let re=!1,je=null,de=null,ze=null,We=null,Ht=null,fn=null,mi=null,Wr=null;return{setTest:function(yn){re||(yn?be(n.STENCIL_TEST):Le(n.STENCIL_TEST))},setMask:function(yn){je!==yn&&!re&&(n.stencilMask(yn),je=yn)},setFunc:function(yn,Zi,So){(de!==yn||ze!==Zi||We!==So)&&(n.stencilFunc(yn,Zi,So),de=yn,ze=Zi,We=So)},setOp:function(yn,Zi,So){(Ht!==yn||fn!==Zi||mi!==So)&&(n.stencilOp(yn,Zi,So),Ht=yn,fn=Zi,mi=So)}
vendor: 18,367 bytes, line 3982
3982,setLocked:function(yn){re=yn},setClear:function(yn){Wr!==yn&&(n.clearStencil(yn),Wr=yn)},reset:function(){re=!1,je=null,de=null,ze=null,We=null,Ht=null,fn=null,mi=null,Wr=null}}}const a=new r,l=new s,c=new o,u=new WeakMap,h=new WeakMap;let f={},m={},g=new WeakMap,v=[],w=null,y=!1,_=null,x=null,S=null,M=null,A=null,I=null,D=null,k=new et(0,0,0),C=0,U=!1,G=null,H=null,z=null,P=null,R=null;const F=n.getParameter(n.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let N=!1,O=0;const B=n.getParameter(n.VERSION);B.indexOf("WebGL")!==-1?(O=parseFloat(/^WebGL (\d)/.exec(B)[1]),N=O>=1):B.indexOf("OpenGL ES")!==-1&&(O=parseFloat(/^OpenGL ES (\d)/.exec(B)[1]),N=O>=2);let W=null,Q={};const oe=n.getParameter(n.SCISSOR_BOX),Y=n.getParameter(n.VIEWPORT),te=new mn().fromArray(oe),le=new mn().fromArray(Y);function ve(re,je,de,ze){const We=new Uint8Array(4),Ht=n.createTexture();n.bindTexture(re,Ht),n.texParameteri(re,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(re,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let fn=0;fn<de;fn++)i&&(re===n.TEXTURE_3D||re===n.TEXTURE_2D_ARRAY)?n.texImage3D(je,0,n.RGBA,1,1,ze,0,n.RGBA,n.UNSIGNED_BYTE,We):n.texImage2D(je+fn,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,We);return Ht}const Te={};Te[n.TEXTURE_2D]=ve(n.TEXTURE_2D,n.TEXTURE_2D,1),Te[n.TEXTURE_CUBE_MAP]=ve(n.TEXTURE_CUBE_MAP,n.TEXTURE_CUBE_MAP_POSITIVE_X,6),i&&(Te[n.TEXTURE_2D_ARRAY]=ve(n.TEXTURE_2D_ARRAY,n.TEXTURE_2D_ARRAY,1,1),Te[n.TEXTURE_3D]=ve(n.TEXTURE_3D,n.TEXTURE_3D,1,1)),a.setClear(0,0,0,1),l.setClear(1),c.setClear(0),be(n.DEPTH_TEST),l.setFunc(Jw),Ke(!1),rt(sN),be(n.CULL_FACE),Ae(Kc);function be(re){f[re]!==!0&&(n.enable(re),f[re]=!0)}function Le(re){f[re]!==!1&&(n.disable(re),f[re]=!1)}function Oe(re,je){return m[re]!==je?(n.bindFramebuffer(re,je),m[re]=je,i&&(re===n.DRAW_FRAMEBUFFER&&(m[n.FRAMEBUFFER]=je),re===n.FRAMEBUFFER&&(m[n.DRAW_FRAMEBUFFER]=je)),!0):!1}function J(re,je){let de=v,ze=!1;if(re){de=g.get(je),de===void 0&&(de=[],g.set(je,de));const We=re.textures;if(de.length!==We.length||de[0]!==n.COLOR_ATTACHMENT0){for(let Ht=0,fn=We.length;Ht<fn;Ht++)de[Ht]=n.COLOR_ATTACHMENT0+Ht;de.length=We.length,ze=!0}}else de[0]!==n.BACK&&(de[0]=n.BACK,ze=!0);if(ze)if(t.isWebGL2)n.drawBuffers(de);else if(e.has("WEBGL_draw_buffers")===!0)e.get("WEBGL_draw_buffers").drawBuffersWEBGL(de);else throw new Error("THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension")}function Se(re){return w!==re?(n.useProgram(re),w=re,!0):!1}const me={[ah]:n.FUNC_ADD,[XY]:n.FUNC_SUBTRACT,[YY]:n.FUNC_REVERSE_SUBTRACT};if(i)me[lN]=n.MIN,me[cN]=n.MAX;else{const re=e.get("EXT_blend_minmax");re!==null&&(me[lN]=re.MIN_EXT,me[cN]=re.MAX_EXT)}const Re={[QY]:n.ZERO,[ZY]:n.ONE,[JY]:n.SRC_COLOR,[hA]:n.SRC_ALPHA,[sQ]:n.SRC_ALPHA_SATURATE,[iQ]:n.DST_COLOR,[tQ]:n.DST_ALPHA,[eQ]:n.ONE_MINUS_SRC_COLOR,[fA]:n.ONE_MINUS_SRC_ALPHA,[rQ]:n.ONE_MINUS_DST_COLOR,[nQ]:n.ONE_MINUS_DST_ALPHA,[oQ]:n.CONSTANT_COLOR,[aQ]:n.ONE_MINUS_CONSTANT_COLOR,[lQ]:n.CONSTANT_ALPHA,[cQ]:n.ONE_MINUS_CONSTANT_ALPHA};function Ae(re,je,de,ze,We,Ht,fn,mi,Wr,yn){if(re===Kc){y===!0&&(Le(n.BLEND),y=!1);return}if(y===!1&&(be(n.BLEND),y=!0),re!==KY){if(re!==_||yn!==U){if((x!==ah||A!==ah)&&(n.blendEquation(n.FUNC_ADD),x=ah,A=ah),yn)switch(re){case Yd:n.blendFuncSeparate(n.ONE,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case uA:n.blendFunc(n.ONE,n.ONE);break;case oN:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case aN:n.blendFuncSeparate(n.ZERO,n.SRC_COLOR,n.ZERO,n.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",re);break}else switch(re){case Yd:n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA);break;case uA:n.blendFunc(n.SRC_ALPHA,n.ONE);break;case oN:n.blendFuncSeparate(n.ZERO,n.ONE_MINUS_SRC_COLOR,n.ZERO,n.ONE);break;case aN:n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",re);break}S=null,M=null,I=null,D=null,k.set(0,0,0),C=0,_=re,U=yn}return}We=We||je,Ht=Ht||de,fn=fn||ze,(je!==x||We!==A)&&(n.blendEquationSeparate(me[je],me[We]),x=je,A=We),(de!==S||ze!==M||Ht!==I||fn!==D)&&(n.blendFuncSeparate(Re[de],Re[ze],Re[Ht],Re[fn]),S=de,M=ze,I=Ht,D=fn),(mi.equals(k)===!1||Wr!==C)&&(n.blendColor(mi.r,mi.g,mi.b,Wr),k.copy(mi),C=Wr),_=re,U=!1}function Ze(re,je){re.side===Ua?Le(n.CULL_FACE):be(n.CULL_FACE);let de=re.side===cs;je&&(de=!de),Ke(de),re.blending===Yd&&re.transparent===!1?Ae(Kc):Ae(re.blending,re.blendEquation,re.blendSrc,re.blendDst,re.blendEquationAlpha,re.blendSrcAlpha,re.blendDstAlpha,re.blendColor,re.blendAlpha,re.premultipliedAlpha),l.setFunc(re.depthFunc),l.setTest(re.depthTest),l.setMask(re.depthWrite),a.setMask(re.colorWrite);const ze=re.stencilWrite;c.setTest(ze),ze&&(c.setMask(re.stencilWriteMask),c.setFunc(re.stencilFunc,re.stencilRef,re.stencilFuncMask),c.setOp(re.stencilFail,re.stencilZFail,re.stencilZPass)),X(re.polygonOffset,re.polygonOffsetFactor,re.polygonOffsetUnits),re.alphaToCoverage===!0?be(n.SAMPLE_ALPHA_TO_COVERAGE):Le(n.SAMPLE_ALPHA_TO_COVERAGE)}function Ke(re){G!==re&&(re?n.frontFace(n.CW):n.frontFace(n.CCW),G=re)}function rt(re){re!==jY?(be(n.CULL_FACE),re!==H&&(re===sN?n.cullFace(n.BACK):re===WY?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK))):Le(n.CULL_FACE),H=re}function Et(re){re!==z&&(N&&n.lineWidth(re),z=re)}function X(re,je,de){re?(be(n.POLYGON_OFFSET_FILL),(P!==je||R!==de)&&(n.polygonOffset(je,de),P=je,R=de)):Le(n.POLYGON_OFFSET_FILL)}function $(re){re?be(n.SCISSOR_TEST):Le(n.SCISSOR_TEST)}function xe(re){re===void 0&&(re=n.TEXTURE0+F-1),W!==re&&(n.activeTexture(re),W=re)}function Ee(re,je,de){de===void 0&&(W===null?de=n.TEXTURE0+F-1:de=W);let ze=Q[de];ze===void 0&&(ze={type:void 0,texture:void 0},Q[de]=ze),(ze.type!==re||ze.texture!==je)&&(W!==de&&(n.activeTexture(de),W=de),n.bindTexture(re,je||Te[re]),ze.type=re,ze.texture=je)}function Ne(){const re=Q[W];re!==void 0&&re.type!==void 0&&(n.bindTexture(re.type,null),re.type=void 0,re.texture=void 0)}function Pe(){try{n.compressedTexImage2D.apply(n,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function _t(){try{n.compressedTexImage3D.apply(n,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function pt(){try{n.texSubImage2D.apply(n,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function Fe(){try{n.texSubImage3D.apply(n,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function $e(){try{n.compressedTexSubImage2D.apply(n,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function At(){try{n.compressedTexSubImage3D.apply(n,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function ke(){try{n.texStorage2D.apply(n,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function Yn(){try{n.texStorage3D.apply(n,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function zt(){try{n.texImage2D.apply(n,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function dt(){try{n.texImage3D.apply(n,arguments)}catch(re){console.error("THREE.WebGLState:",re)}}function lt(re){te.equals(re)===!1&&(n.scissor(re.x,re.y,re.z,re.w),te.copy(re))}function ct(re){le.equals(re)===!1&&(n.viewport(re.x,re.y,re.z,re.w),le.copy(re))}function qt(re,je){let de=h.get(je);de===void 0&&(de=new WeakMap,h.set(je,de));let ze=de.get(re);ze===void 0&&(ze=n.getUniformBlockIndex(je,re.name),de.set(re,ze))}function Pt(re,je){const ze=h.get(je).get(re);u.get(je)!==ze&&(n.uniformBlockBinding(je,ze,re.__bindingPointIndex),u.set(je,ze))}function En(){n.disable(n.BLEND),n.disable(n.CULL_FACE),n.disable(n.DEPTH_TEST),n.disable(n.POLYGON_OFFSET_FILL),n.disable(n.SCISSOR_TEST),n.disable(n.STENCIL_TEST),n.disable(n.SAMPLE_ALPHA_TO_COVERAGE),n.blendEquation(n.FUNC_ADD),n.blendFunc(n.ONE,n.ZERO),n.blendFuncSeparate(n.ONE,n.ZERO,n.ONE,n.ZERO),n.blendColor(0,0,0,0),n.colorMask(!0,!0,!0,!0),n.clearColor(0,0,0,0),n.depthMask(!0),n.depthFunc(n.LESS),n.clearDepth(1),n.stencilMask(4294967295),n.stencilFunc(n.ALWAYS,0,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.KEEP),n.clearStencil(0),n.cullFace(n.BACK),n.frontFace(n.CCW),n.polygonOffset(0,0),n.activeTexture(n.TEXTURE0),n.bindFramebuffer(n.FRAMEBUFFER,null),i===!0&&(n.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),n.bindFramebuffer(n.READ_FRAMEBUFFER,null)),n.useProgram(null),n.lineWidth(1),n.scissor(0,0,n.canvas.width,n.canvas.height),n.viewport(0,0,n.canvas.width,n.canvas.height),f={},W=null,Q={},m={},g=new WeakMap,v=[],w=null,y=!1,_=null,x=null,S=null,M=null,A=null,I=null,D=null,k=new et(0,0,0),C=0,U=!1,G=null,H=null,z=null,P=null,R=null,te.set(0,0,n.canvas.width,n.canvas.height),le.set(0,0,n.canvas.width,n.canvas.height),a.reset(),l.reset(),c.reset()}return{buffers:{color:a,depth:l,stencil:c},enable:be,disable:Le,bindFramebuffer:Oe,drawBuffers:J,useProgram:Se,setBlending:Ae,setMaterial:Ze,setFlipSided:Ke,setCullFace:rt,setLineWidth:Et,setPolygonOffset:X,setScissorTest:$,activeTexture:xe,bindTexture:Ee,unbindTexture:Ne,compressedTexImage2D:Pe,compressedTexImage3D:_t,texImage2D:zt,texImage3D:dt,updateUBOMapping:qt,uniformBlockBinding:Pt,texStorage2D:ke,texStorage3D:Yn,texSubImage2D:pt,texSubImage3D:Fe,compressedTexSubImage2D:$e,compressedTexSubImage3D:At,scissor:lt,viewport:ct,reset:En}}function qLe(n,e,t,i,r,s,o){const a=r.isWebGL2,l=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),u=new Me,h=new WeakMap;let f;const m=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(X,$){return g?new OffscreenCanvas(X,$):h1("canvas")}function w(X,$,xe,Ee){let Ne=1;const Pe=Et(X);if((Pe.width>Ee||Pe.height>Ee)&&(Ne=Ee/Math.max(Pe.width,Pe.height)),Ne<1||$===!0)if(typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&X instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&X instanceof ImageBitmap||typeof VideoFrame<"u"&&X instanceof VideoFrame){const _t=$?mA:Math.floor,pt=_t(Ne*Pe.width),Fe=_t(Ne*Pe.height);f===void 0&&(f=v(pt,Fe));const $e=xe?v(pt,Fe):f;return $e.width=pt,$e.height=Fe,$e.getContext("2d").drawImage(X,0,0,pt,Fe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Pe.width+"x"+Pe.height+") to ("+pt+"x"+Fe+")."),$e}else return"data"in X&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Pe.width+"x"+Pe.height+")."),X;return X}function y(X){const $=Et(X);return kN($.width)&&kN($.height)}function _(X){return a?!1:X.wrapS!==Fr||X.wrapT!==Fr||X.minFilter!==hi&&X.minFilter!==On}function x(X,$){return X.generateMipmaps&&$&&X.minFilter!==hi&&X.minFilter!==On}function S(X){n.generateMipmap(X)}function M(X,$,xe,Ee,Ne=!1){if(a===!1)return $;if(X!==null){if(n[X]!==void 0)return n[X];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+X+"'")}let Pe=$;if($===n.RED&&(xe===n.FLOAT&&(Pe=n.R32F),xe===n.HALF_FLOAT&&(Pe=n.R16F),xe===n.UNSIGNED_BYTE&&(Pe=n.R8)),$===n.RED_INTEGER&&(xe===n.UNSIGNED_BYTE&&(Pe=n.R8UI),xe===n.UNSIGNED_SHORT&&(Pe=n.R16UI),xe===n.UNSIGNED_INT&&(Pe=n.R32UI),xe===n.BYTE&&(Pe=n.R8I),xe===n.SHORT&&(Pe=n.R16I),xe===n.INT&&(Pe=n.R32I)),$===n.RG&&(xe===n.FLOAT&&(Pe=n.RG32F),xe===n.HALF_FLOAT&&(Pe=n.RG16F),xe===n.UNSIGNED_BYTE&&(Pe=n.RG8)),$===n.RG_INTEGER&&(xe===n.UNSIGNED_BYTE&&(Pe=n.RG8UI),xe===n.UNSIGNED_SHORT&&(Pe=n.RG16UI),xe===n.UNSIGNED_INT&&(Pe=n.RG32UI),xe===n.BYTE&&(Pe=n.RG8I),xe===n.SHORT&&(Pe=n.RG16I),xe===n.INT&&(Pe=n.RG32I)),$===n.RGBA){const _t=Ne?o1:pn.getTransfer(Ee);xe===n.FLOAT&&(Pe=n.RGBA32F),xe===n.HALF_FLOAT&&(Pe=n.RGBA16F),xe===n.UNSIGNED_BYTE&&(Pe=_t===An?n.SRGB8_ALPHA8:n.RGBA8),xe===n.UNSIGNED_SHORT_4_4_4_4&&(Pe=n.RGBA4),xe===n.UNSIGNED_SHORT_5_5_5_1&&(Pe=n.RGB5_A1)}return(Pe===n.R16F||Pe===n.R32F||Pe===n.RG16F||Pe===n.RG32F||Pe===n.RGBA16F||Pe===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Pe}function A(X,$,xe){return x(X,xe)===!0||X.isFramebufferTexture&&X.minFilter!==hi&&X.minFilter!==On?Math.log2(Math.max($.width,$.height))+1:X.mipmaps!==void 0&&X.mipmaps.length>0?X.mipmaps.length:X.isCompressedTexture&&Array.isArray(X.image)?$.mipmaps.length:1}function I(X){return X===hi||X===dA||X===nd?n.NEAREST:n.LINEAR}function D(X){const $=X.target;$.removeEventListener("dispose",D),C($),$.isVideoTexture&&h.delete($)}function k(X){const $=X.target;$.removeEventListener("dispose",k),G($)}function C(X){const $=i.get(X);if($.__webglInit===void 0)return;const xe=X.source,Ee=m.get(xe);if(Ee){const Ne=Ee[$.__cacheKey];Ne.usedTimes--,Ne.usedTimes===0&&U(X),Object.keys(Ee).length===0&&m.delete(xe)}i.remove(X)}function U(X){const $=i.get(X);n.deleteTexture($.__webglTexture);const xe=X.source,Ee=m.get(xe);delete Ee[$.__cacheKey],o.memory.textures--}function G(X){const $=i.get(X);if(X.depthTexture&&X.depthTexture.dispose(),X.isWebGLCubeRenderTarget)for(let Ee=0;Ee<6;Ee++){if(Array.isArray($.__webglFramebuffer[Ee]))for(let Ne=0;Ne<$.__webglFramebuffer[Ee].length;Ne++)n.deleteFramebuffer($.__webglFramebuffer[Ee][Ne]);else n.deleteFramebuffer($.__webglFramebuffer[Ee]);$.__webglDepthbuffer&&n.deleteRenderbuffer($.__webglDepthbuffer[Ee])}else{if(Array.isArray($.__webglFramebuffer))for(let Ee=0;Ee<$.__webglFramebuffer.length;Ee++)n.deleteFramebuffer($.__webglFramebuffer[Ee]);else n.deleteFramebuffer($.__webglFramebuffer);if($.__webglDepthbuffer&&n.deleteRenderbuffer($.__webglDepthbuffer),$.__webglMultisampledFramebuffer&&n.deleteFramebuffer($.__webglMultisampledFramebuffer),$.__webglColorRenderbuffer)for(let Ee=0;Ee<$.__webglColorRenderbuffer.length;Ee++)$.__webglColorRenderbuffer[Ee]&&n.deleteRenderbuffer($.__webglColorRenderbuffer[Ee]);$.__webglDepthRenderbuffer&&n.deleteRenderbuffer($.__webglDepthRenderbuffer)}const xe=X.textures;for(let Ee=0,Ne=xe.length;Ee<Ne;Ee++){const Pe=i.get(xe[Ee]);Pe.__webglTexture&&(n.deleteTexture(Pe.__webglTexture),o.memory.textures--),i.remove(xe[Ee])}i.remove(X)}let H=0;function z(){H=0}function P(){const X=H;return X>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+X+" texture units while this GPU supports only "+r.maxTextures),H+=1,X}function R(X){const $=[];return $.push(X.wrapS),$.push(X.wrapT),$.push(X.wrapR||0),$.push(X.magFilter),$.push(X.minFilter),$.push(X.anisotropy),$.push(X.internalFormat),$.push(X.format),$.push(X.type),$.push(X.generateMipmaps),$.push(X.premultiplyAlpha),$.push(X.flipY),$.push(X.unpackAlignment),$.push(X.colorSpace),$.join()}function F(X,$){const xe=i.get(X);if(X.isVideoTexture&&Ke(X),X.isRenderTargetTexture===!1&&X.version>0&&xe.__version!==X.version){const Ee=X.image;if(Ee===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ee.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{le(xe,X,$);return}}t.bindTexture(n.TEXTURE_2D,xe.__webglTexture,n.TEXTURE0+$)}function N(X,$){const xe=i.get(X);if(X.version>0&&xe.__version!==X.version){le(xe,X,$);return}t.bindTexture(n.TEXTURE_2D_ARRAY,xe.__webglTexture,n.TEXTURE0+$)}function O(X,$){const xe=i.get(X);if(X.version>0&&xe.__version!==X.version){le(xe,X,$);return}t.bindTexture(n.TEXTURE_3D,xe.__webglTexture,n.TEXTURE0+$)}function B(X,$){const xe=i.get(X);if(X.version>0&&xe.__version!==X.version){ve(xe,X,$);return}t.bindTexture(n.TEXTURE_CUBE_MAP,xe.__webglTexture,n.TEXTURE0+$)}const W={[pp]:n.REPEAT,[Fr]:n.CLAMP_TO_EDGE,[n1]:n.MIRRORED_REPEAT},Q={[hi]:n.NEAREST,[dA]:n.NEAREST_MIPMAP_NEAREST,[nd]:n.NEAREST_MIPMAP_LINEAR,[On]:n.LINEAR,[sw]:n.LINEAR_MIPMAP_NEAREST,[Il]:n.LINEAR_MIPMAP_LINEAR},oe={[FQ]:n.NEVER,[jQ]:n.ALWAYS,[zQ]:n.LESS,[GL]:n.LEQUAL,[VQ]:n.EQUAL,[GQ]:n.GEQUAL,[HQ]:n.GREATER,[$Q]:n.NOTEQUAL};function Y(X,$,xe){if($.type===co&&e.has("OES_texture_float_linear")===!1&&($.magFilter===On||$.magFilter===sw||$.magFilter===nd||$.magFilter===Il||$.minFilter===On||$.minFilter===sw||$.minFilter===nd||$.minFilter===Il)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),xe?(n.texParameteri(X,n.TEXTURE_WRAP_S,W[$.wrapS]),n.texParameteri(X,n.TEXTURE_WRAP_T,W[$.wrapT]),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,W[$.wrapR]),n.texParameteri(X,n.TEXTURE_MAG_FILTER,Q[$.magFilter]),n.texParameteri(X,n.TEXTURE_MIN_FILTER,Q[$.minFilter])):(n.texParameteri(X,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(X,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),($.wrapS!==Fr||$.wrapT!==Fr)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(X,n.TEXTURE_MAG_FILTER,I($.magFilter)),n.texParameteri(X,n.TEXTURE_MIN_FILTER,I($.minFilter)),$.minFilter!==hi&&$.minFilter!==On&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),$.compareFunction&&(n.texParameteri(X,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(X,n.TEXTURE_COMPARE_FUNC,oe[$.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if($.magFilter===hi||$.minFilter!==nd&&$.minFilter!==Il||$.type===co&&e.has("OES_texture_float_linear")===!1||a===!1&&$.type===z0&&e.has("OES_texture_half_float_linear")===!1)return;if($.anisotropy>1||i.get($).__currentAnisotropy){const Ee=e.get("EXT_texture_filter_anisotropic");n.texParameterf(X,Ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min($.anisotropy,r.getMaxAnisotropy())),i.get($).__currentAnisotropy=$.anisotropy}}}function te(X,$){let xe=!1;X.__webglInit===void 0&&(X.__webglInit=!0,$.addEventListener("dispose",D));const Ee=$.source;let Ne=m.get(Ee);Ne===void 0&&(Ne={},m.set(Ee,Ne));const Pe=R($);if(Pe!==X.__cacheKey){Ne[Pe]===void 0&&(Ne[Pe]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,xe=!0),Ne[Pe].usedTimes++;const _t=Ne[X.__cacheKey];_t!==void 0&&(Ne[X.__cacheKey].usedTimes--,_t.usedTimes===0&&U($)),X.__cacheKey=Pe,X.__webglTexture=Ne[Pe].texture}return xe}function le(X,$,xe){let Ee=n.TEXTURE_2D;($.isDataArrayTexture||$.isCompressedArrayTexture)&&(Ee=n.TEXTURE_2D_ARRAY),$.isData3DTexture&&(Ee=n.TEXTURE_3D);const Ne=te(X,$),Pe=$.source;t.bindTexture(Ee,X.__webglTexture,n.TEXTURE0+xe);const _t=i.get(Pe);if(Pe.version!==_t.__version||Ne===!0){t.activeTexture(n.TEXTURE0+xe);
3982const pt=pn.getPrimaries(pn.workingColorSpace),Fe=$.colorSpace===Dc?null:pn.getPrimaries($.colorSpace),$e=$.colorSpace===Dc||pt===Fe?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,$.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,$.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,$.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,$e);const At=_($)&&y($.image)===!1;let ke=w($.image,At,!1,r.maxTextureSize);ke=rt($,ke);const Yn=y(ke)||a,zt=s.convert($.format,$.colorSpace);let dt=s.convert($.type),lt=M($.internalFormat,zt,dt,$.colorSpace,$.isVideoTexture);Y(Ee,$,Yn);let ct;const qt=$.mipmaps,Pt=a&&$.isVideoTexture!==!0&&lt!==HL,En=_t.__version===void 0||Ne===!0,re=Pe.dataReady,je=A($,ke,Yn);if($.isDepthTexture)lt=n.DEPTH_COMPONENT,a?$.type===co?lt=n.DEPTH_COMPONENT32F:$.type===Fc?lt=n.DEPTH_COMPONENT24:$.type===Fh?lt=n.DEPTH24_STENCIL8:lt=n.DEPTH_COMPONENT16:$.type===co&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),$.format===zh&&lt===n.DEPTH_COMPONENT&&$.type!==L2&&$.type!==Fc&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),$.type=Fc,dt=s.convert($.type)),$.format===mp&&lt===n.DEPTH_COMPONENT&&(lt=n.DEPTH_STENCIL,$.type!==Fh&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),$.type=Fh,dt=s.convert($.type))),En&&(Pt?t.texStorage2D(n.TEXTURE_2D,1,lt,ke.width,ke.height):t.texImage2D(n.TEXTURE_2D,0,lt,ke.width,ke.height,0,zt,dt,null));else if($.isDataTexture)if(qt.length>0&&Yn){Pt&&En&&t.texStorage2D(n.TEXTURE_2D,je,lt,qt[0].width,qt[0].height);for(let de=0,ze=qt.length;de<ze;de++)ct=qt[de],Pt?re&&t.texSubImage2D(n.TEXTURE_2D,de,0,0,ct.width,ct.height,zt,dt,ct.data):t.texImage2D(n.TEXTURE_2D,de,lt,ct.width,ct.height,0,zt,dt,ct.data);$.generateMipmaps=!1}else Pt?(En&&t.texStorage2D(n.TEXTURE_2D,je,lt,ke.width,ke.height),re&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,ke.width,ke.height,zt,dt,ke.data)):t.texImage2D(n.TEXTURE_2D,0,lt,ke.width,ke.height,0,zt,dt,ke.data);else if($.isCompressedTexture)if($.isCompressedArrayTexture){Pt&&En&&t.texStorage3D(n.TEXTURE_2D_ARRAY,je,lt,qt[0].width,qt[0].height,ke.depth);for(let de=0,ze=qt.length;de<ze;de++)ct=qt[de],$.format!==zr?zt!==null?Pt?re&&t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,de,0,0,0,ct.width,ct.height,ke.depth,zt,ct.data,0,0):t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,de,lt,ct.width,ct.height,ke.depth,0,ct.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Pt?re&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,de,0,0,0,ct.width,ct.height,ke.depth,zt,dt,ct.data):t.texImage3D(n.TEXTURE_2D_ARRAY,de,lt,ct.width,ct.height,ke.depth,0,zt,dt,ct.data)}else{Pt&&En&&t.texStorage2D(n.TEXTURE_2D,je,lt,qt[0].width,qt[0].height);for(let de=0,ze=qt.length;de<ze;de++)ct=qt[de],$.format!==zr?zt!==null?Pt?re&&t.compressedTexSubImage2D(n.TEXTURE_2D,de,0,0,ct.width,ct.height,zt,ct.data):t.compressedTexImage2D(n.TEXTURE_2D,de,lt,ct.width,ct.height,0,ct.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):Pt?re&&t.texSubImage2D(n.TEXTURE_2D,de,0,0,ct.width,ct.height,zt,dt,ct.data):t.texImage2D(n.TEXTURE_2D,de,lt,ct.width,ct.height,0,zt,dt,ct.data)}else if($.isDataArrayTexture)Pt?(En&&t.texStorage3D(n.TEXTURE_2D_ARRAY,je,lt,ke.width,ke.height,ke.depth),re&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,ke.width,ke.height,ke.depth,zt,dt,ke.data)):t.texImage3D(n.TEXTURE_2D_ARRAY,0,lt,ke.width,ke.height,ke.depth,0,zt,dt,ke.data);else if($.isData3DTexture)Pt?(En&&t.texStorage3D(n.TEXTURE_3D,je,lt,ke.width,ke.height,ke.depth),re&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,ke.width,ke.height,ke.depth,zt,dt,ke.data)):t.texImage3D(n.TEXTURE_3D,0,lt,ke.width,ke.height,ke.depth,0,zt,dt,ke.data);else if($.isFramebufferTexture){if(En)if(Pt)t.texStorage2D(n.TEXTURE_2D,je,lt,ke.width,ke.height);else{let de=ke.width,ze=ke.height;for(let We=0;We<je;We++)t.texImage2D(n.TEXTURE_2D,We,lt,de,ze,0,zt,dt,null),de>>=1,ze>>=1}}else if(qt.length>
vendor: 44,917 bytes, lines 3982-4006
39820&&Yn){if(Pt&&En){const de=Et(qt[0]);t.texStorage2D(n.TEXTURE_2D,je,lt,de.width,de.height)}for(let de=0,ze=qt.length;de<ze;de++)ct=qt[de],Pt?re&&t.texSubImage2D(n.TEXTURE_2D,de,0,0,zt,dt,ct):t.texImage2D(n.TEXTURE_2D,de,lt,zt,dt,ct);$.generateMipmaps=!1}else if(Pt){if(En){const de=Et(ke);t.texStorage2D(n.TEXTURE_2D,je,lt,de.width,de.height)}re&&t.texSubImage2D(n.TEXTURE_2D,0,0,0,zt,dt,ke)}else t.texImage2D(n.TEXTURE_2D,0,lt,zt,dt,ke);x($,Yn)&&S(Ee),_t.__version=Pe.version,$.onUpdate&&$.onUpdate($)}X.__version=$.version}function ve(X,$,xe){if($.image.length!==6)return;const Ee=te(X,$),Ne=$.source;t.bindTexture(n.TEXTURE_CUBE_MAP,X.__webglTexture,n.TEXTURE0+xe);const Pe=i.get(Ne);if(Ne.version!==Pe.__version||Ee===!0){t.activeTexture(n.TEXTURE0+xe);const _t=pn.getPrimaries(pn.workingColorSpace),pt=$.colorSpace===Dc?null:pn.getPrimaries($.colorSpace),Fe=$.colorSpace===Dc||_t===pt?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,$.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,$.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,$.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,Fe);const $e=$.isCompressedTexture||$.image[0].isCompressedTexture,At=$.image[0]&&$.image[0].isDataTexture,ke=[];for(let de=0;de<6;de++)!$e&&!At?ke[de]=w($.image[de],!1,!0,r.maxCubemapSize):ke[de]=At?$.image[de].image:$.image[de],ke[de]=rt($,ke[de]);const Yn=ke[0],zt=y(Yn)||a,dt=s.convert($.format,$.colorSpace),lt=s.convert($.type),ct=M($.internalFormat,dt,lt,$.colorSpace),qt=a&&$.isVideoTexture!==!0,Pt=Pe.__version===void 0||Ee===!0,En=Ne.dataReady;let re=A($,Yn,zt);Y(n.TEXTURE_CUBE_MAP,$,zt);let je;if($e){qt&&Pt&&t.texStorage2D(n.TEXTURE_CUBE_MAP,re,ct,Yn.width,Yn.height);for(let de=0;de<6;de++){je=ke[de].mipmaps;for(let ze=0;ze<je.length;ze++){const We=je[ze];$.format!==zr?dt!==null?qt?En&&t.compressedTexSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,ze,0,0,We.width,We.height,dt,We.data):t.compressedTexImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,ze,ct,We.width,We.height,0,We.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):qt?En&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,ze,0,0,We.width,We.height,dt,lt,We.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,ze,ct,We.width,We.height,0,dt,lt,We.data)}}}else{if(je=$.mipmaps,qt&&Pt){je.length>0&&re++;const de=Et(ke[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,re,ct,de.width,de.height)}for(let de=0;de<6;de++)if(At){qt?En&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,ke[de].width,ke[de].height,dt,lt,ke[de].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,ct,ke[de].width,ke[de].height,0,dt,lt,ke[de].data);for(let ze=0;ze<je.length;ze++){const Ht=je[ze].image[de].image;qt?En&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,ze+1,0,0,Ht.width,Ht.height,dt,lt,Ht.data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,ze+1,ct,Ht.width,Ht.height,0,dt,lt,Ht.data)}}else{qt?En&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,0,0,dt,lt,ke[de]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,0,ct,dt,lt,ke[de]);for(let ze=0;ze<je.length;ze++){const We=je[ze];qt?En&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,ze+1,0,0,dt,lt,We.image[de]):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+de,ze+1,ct,dt,lt,We.image[de])}}}x($,zt)&&S(n.TEXTURE_CUBE_MAP),Pe.__version=Ne.version,$.onUpdate&&$.onUpdate($)}X.__version=$.version}function Te(X,$,xe,Ee,Ne,Pe){const _t=s.convert(xe.format,xe.colorSpace),pt=s.convert(xe.type),Fe=M(xe.internalFormat,_t,pt,xe.colorSpace);if(!i.get($).__hasExternalTextures){const At=Math.max(1,$.width>>Pe),ke=Math.max(1,$.height>>Pe);Ne===n.TEXTURE_3D||Ne===n.TEXTURE_2D_ARRAY?t.texImage3D(Ne,Pe,Fe,At,ke,$.depth,0,_t,pt,null):t.texImage2D(Ne,Pe,Fe,At,ke,0,_t,pt,null)}t.bindFramebuffer(n.FRAMEBUFFER,X),Ze($)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Ee,Ne,i.get(xe).__webglTexture,0,Ae($)):(Ne===n.TEXTURE_2D||Ne>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Ne<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Ee,Ne,i.get(xe).__webglTexture,Pe),t.bindFramebuffer(n.FRAMEBUFFER,null)}function be(X,$,xe){if(n.bindRenderbuffer(n.RENDERBUFFER,X),$.depthBuffer&&!$.stencilBuffer){let Ee=a===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(xe||Ze($)){const Ne=$.depthTexture;Ne&&Ne.isDepthTexture&&(Ne.type===co?Ee=n.DEPTH_COMPONENT32F:Ne.type===Fc&&(Ee=n.DEPTH_COMPONENT24));const Pe=Ae($);Ze($)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Pe,Ee,$.width,$.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Pe,Ee,$.width,$.height)}else n.renderbufferStorage(n.RENDERBUFFER,Ee,$.width,$.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,X)}else if($.depthBuffer&&$.stencilBuffer){const Ee=Ae($);xe&&Ze($)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ee,n.DEPTH24_STENCIL8,$.width,$.height):Ze($)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ee,n.DEPTH24_STENCIL8,$.width,$.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,$.width,$.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,X)}else{const Ee=$.textures;for(let Ne=0;Ne<Ee.length;Ne++){const Pe=Ee[Ne],_t=s.convert(Pe.format,Pe.colorSpace),pt=s.convert(Pe.type),Fe=M(Pe.internalFormat,_t,pt,Pe.colorSpace),$e=Ae($);xe&&Ze($)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,$e,Fe,$.width,$.height):Ze($)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,$e,Fe,$.width,$.height):n.renderbufferStorage(n.RENDERBUFFER,Fe,$.width,$.height)}}n.bindRenderbuffer(n.RENDERBUFFER,null)}function Le(X,$){if($&&$.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(t.bindFramebuffer(n.FRAMEBUFFER,X),!($.depthTexture&&$.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get($.depthTexture).__webglTexture||$.depthTexture.image.width!==$.width||$.depthTexture.image.height!==$.height)&&($.depthTexture.image.width=$.width,$.depthTexture.image.height=$.height,$.depthTexture.needsUpdate=!0),F($.depthTexture,0);const Ee=i.get($.depthTexture).__webglTexture,Ne=Ae($);if($.depthTexture.format===zh)Ze($)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,Ee,0,Ne):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,Ee,0);else if($.depthTexture.format===mp)Ze($)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,Ee,0,Ne):n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.TEXTURE_2D,Ee,0);else throw new Error("Unknown depthTexture format")}function Oe(X){const $=i.get(X),xe=X.isWebGLCubeRenderTarget===!0;if(X.depthTexture&&!$.__autoAllocateDepthBuffer){if(xe)throw new Error("target.depthTexture not supported in Cube render targets");Le($.__webglFramebuffer,X)}else if(xe){$.__webglDepthbuffer=[];for(let Ee=0;Ee<6;Ee++)t.bindFramebuffer(n.FRAMEBUFFER,$.__webglFramebuffer[Ee]),$.__webglDepthbuffer[Ee]=n.createRenderbuffer(),be($.__webglDepthbuffer[Ee],X,!1)}else t.bindFramebuffer(n.FRAMEBUFFER,$.__webglFramebuffer),$.__webglDepthbuffer=n.createRenderbuffer(),be($.__webglDepthbuffer,X,!1);t.bindFramebuffer(n.FRAMEBUFFER,null)}function J(X,$,xe){const Ee=i.get(X);$!==void 0&&Te(Ee.__webglFramebuffer,X,X.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),xe!==void 0&&Oe(X)}function Se(X){const $=X.texture,xe=i.get(X),Ee=i.get($);X.addEventListener("dispose",k);const Ne=X.textures,Pe=X.isWebGLCubeRenderTarget===!0,_t=Ne.length>1,pt=y(X)||a;if(_t||(Ee.__webglTexture===void 0&&(Ee.__webglTexture=n.createTexture()),Ee.__version=$.version,o.memory.textures++),Pe){xe.__webglFramebuffer=[];for(let Fe=0;Fe<6;Fe++)if(a&&$.mipmaps&&$.mipmaps.length>0){xe.__webglFramebuffer[Fe]=[];for(let $e=0;$e<$.mipmaps.length;$e++)xe.__webglFramebuffer[Fe][$e]=n.createFramebuffer()}else xe.__webglFramebuffer[Fe]=n.createFramebuffer()}else{if(a&&$.mipmaps&&$.mipmaps.length>0){xe.__webglFramebuffer=[];for(let Fe=0;Fe<$.mipmaps.length;Fe++)xe.__webglFramebuffer[Fe]=n.createFramebuffer()}else xe.__webglFramebuffer=n.createFramebuffer();if(_t)if(r.drawBuffers)for(let Fe=0,$e=Ne.length;Fe<$e;Fe++){const At=i.get(Ne[Fe]);At.__webglTexture===void 0&&(At.__webglTexture=n.createTexture(),o.memory.textures++)}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");if(a&&X.samples>0&&Ze(X)===!1){xe.__webglMultisampledFramebuffer=n.createFramebuffer(),xe.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,xe.__webglMultisampledFramebuffer);for(let Fe=0;Fe<Ne.length;Fe++){const $e=Ne[Fe];xe.__webglColorRenderbuffer[Fe]=n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,xe.__webglColorRenderbuffer[Fe]);const At=s.convert($e.format,$e.colorSpace),ke=s.convert($e.type),Yn=M($e.internalFormat,At,ke,$e.colorSpace,X.isXRRenderTarget===!0),zt=Ae(X);n.renderbufferStorageMultisample(n.RENDERBUFFER,zt,Yn,X.width,X.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+Fe,n.RENDERBUFFER,xe.__webglColorRenderbuffer[Fe])}n.bindRenderbuffer(n.RENDERBUFFER,null),X.depthBuffer&&(xe.__webglDepthRenderbuffer=n.createRenderbuffer(),be(xe.__webglDepthRenderbuffer,X,!0)),t.bindFramebuffer(n.FRAMEBUFFER,null)}}if(Pe){t.bindTexture(n.TEXTURE_CUBE_MAP,Ee.__webglTexture),Y(n.TEXTURE_CUBE_MAP,$,pt);for(let Fe=0;Fe<6;Fe++)if(a&&$.mipmaps&&$.mipmaps.length>0)for(let $e=0;$e<$.mipmaps.length;$e++)Te(xe.__webglFramebuffer[Fe][$e],X,$,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Fe,$e);else Te(xe.__webglFramebuffer[Fe],X,$,n.COLOR_ATTACHMENT0,n.TEXTURE_CUBE_MAP_POSITIVE_X+Fe,0);x($,pt)&&S(n.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(_t){for(let Fe=0,$e=Ne.length;Fe<$e;Fe++){const At=Ne[Fe],ke=i.get(At);t.bindTexture(n.TEXTURE_2D,ke.__webglTexture),Y(n.TEXTURE_2D,At,pt),Te(xe.__webglFramebuffer,X,At,n.COLOR_ATTACHMENT0+Fe,n.TEXTURE_2D,0),x(At,pt)&&S(n.TEXTURE_2D)}t.unbindTexture()}else{let Fe=n.TEXTURE_2D;if((X.isWebGL3DRenderTarget||X.isWebGLArrayRenderTarget)&&(a?Fe=X.isWebGL3DRenderTarget?n.TEXTURE_3D:n.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture(Fe,Ee.__webglTexture),Y(Fe,$,pt),a&&$.mipmaps&&$.mipmaps.length>0)for(let $e=0;$e<$.mipmaps.length;$e++)Te(xe.__webglFramebuffer[$e],X,$,n.COLOR_ATTACHMENT0,Fe,$e);else Te(xe.__webglFramebuffer,X,$,n.COLOR_ATTACHMENT0,Fe,0);x($,pt)&&S(Fe),t.unbindTexture()}X.depthBuffer&&Oe(X)}function me(X){const $=y(X)||a,xe=X.textures;for(let Ee=0,Ne=xe.length;Ee<Ne;Ee++){const Pe=xe[Ee];if(x(Pe,$)){const _t=X.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D,pt=i.get(Pe).__webglTexture;t.bindTexture(_t,pt),S(_t),t.unbindTexture()}}}function Re(X){if(a&&X.samples>0&&Ze(X)===!1){const $=X.textures,xe=X.width,Ee=X.height;let Ne=n.COLOR_BUFFER_BIT;const Pe=[],_t=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,pt=i.get(X),Fe=$.length>1;if(Fe)for(let $e=0;$e<$.length;$e++)t.bindFramebuffer(n.FRAMEBUFFER,pt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+$e,n.RENDERBUFFER,null),t.bindFramebuffer(n.FRAMEBUFFER,pt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+$e,n.TEXTURE_2D,null,0);t.bindFramebuffer(n.READ_FRAMEBUFFER,pt.__webglMultisampledFramebuffer),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,pt.__webglFramebuffer);for(let $e=0;$e<$.length;$e++){Pe.push(n.COLOR_ATTACHMENT0+$e),X.depthBuffer&&Pe.push(_t);const At=pt.__ignoreDepthValues!==void 0?pt.__ignoreDepthValues:!1;if(At===!1&&(X.depthBuffer&&(Ne|=n.DEPTH_BUFFER_BIT),X.stencilBuffer&&(Ne|=n.STENCIL_BUFFER_BIT)),Fe&&n.framebufferRenderbuffer(n.READ_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,pt.__webglColorRenderbuffer[$e]),At===!0&&(n.invalidateFramebuffer(n.READ_FRAMEBUFFER,[_t]),n.invalidateFramebuffer(n.DRAW_FRAMEBUFFER,[_t])),Fe){const ke=i.get($[$e]).__webglTexture;n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,ke,0)}n.blitFramebuffer(0,0,xe,Ee,0,0,xe,Ee,Ne,n.NEAREST),c&&n.invalidateFramebuffer(n.READ_FRAMEBUFFER,Pe)}if(t.bindFramebuffer(n.READ_FRAMEBUFFER,null),t.bindFramebuffer(n.DRAW_FRAMEBUFFER,null),Fe)for(let $e=0;$e<$.length;$e++){t.bindFramebuffer(n.FRAMEBUFFER,pt.__webglMultisampledFramebuffer),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+$e,n.RENDERBUFFER,pt.__webglColorRenderbuffer[$e]);const At=i.get($[$e]).__webglTexture;t.bindFramebuffer(n.FRAMEBUFFER,pt.__webglFramebuffer),n.framebufferTexture2D(n.DRAW_FRAMEBUFFER,n.COLOR_ATTACHMENT0+$e,n.TEXTURE_2D,At,0)}t.bindFramebuffer(n.DRAW_FRAMEBUFFER,pt.__webglMultisampledFramebuffer)}}function Ae(X){return Math.min(r.maxSamples,X.samples)}function Ze(X){const $=i.get(X);return a&&X.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&$.__useRenderToTexture!==!1}function Ke(X){const $=o.render.frame;h.get(X)!==$&&(h.set(X,$),X.update())}function rt(X,$){const xe=X.colorSpace,Ee=X.format,Ne=X.type;return X.isCompressedTexture===!0||X.isVideoTexture===!0||X.format===pA||xe!==hu&&xe!==Dc&&(pn.getTransfer(xe)===An?a===!1?e.has("EXT_sRGB")===!0&&Ee===zr?(X.format=pA,X.minFilter=On,X.generateMipmaps=!1):$=WL.sRGBToLinear($):(Ee!==zr||Ne!==Fl)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",xe)),$}function Et(X){return typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement?(u.width=X.naturalWidth||X.width,u.height=X.naturalHeight||X.height):typeof VideoFrame<"u"&&X instanceof VideoFrame?(u.width=X.displayWidth,u.height=X.displayHeight):(u.width=X.width,u.height=X.height),u}this.allocateTextureUnit=P,this.resetTextureUnits=z,this.setTexture2D=F,this.setTexture2DArray=N,this.setTexture3D=O,this.setTextureCube=B,this.rebindTextures=J,this.setupRenderTarget=Se,this.updateRenderTargetMipmap=me,this.updateMultisampleRenderTarget=Re,this.setupDepthRenderbuffer=Oe,this.setupFrameBufferTexture=Te,this.useMultisampledRTT=Ze}function aZ(n,e,t){const i=t.isWebGL2;function r(s,o=Dc){let a;const l=pn.getTransfer(o);if(s===Fl)return n.UNSIGNED_BYTE;if(s===UL)return n.UNSIGNED_SHORT_4_4_4_4;if(s===BL)return n.UNSIGNED_SHORT_5_5_5_1;if(s===MQ)return n.BYTE;if(s===TQ)return n.SHORT;if(s===L2)return n.UNSIGNED_SHORT;if(s===LL)return n.INT;if(s===Fc)return n.UNSIGNED_INT;if(s===co)return n.FLOAT;if(s===z0)return i?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===PQ)return n.ALPHA;if(s===zr)return n.RGBA;if(s===CQ)return n.LUMINANCE;if(s===IQ)return n.LUMINANCE_ALPHA;if(s===zh)return n.DEPTH_COMPONENT;if(s===mp)return n.DEPTH_STENCIL;if(s===pA)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===kL)return n.RED;if(s===FL)return n.RED_INTEGER;if(s===RQ)return n.RG;if(s===zL)return n.RG_INTEGER;if(s===VL)return n.RGBA_INTEGER;if(s===jE||s===WE||s===qE||s===KE)if(l===An)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===jE)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===WE)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===qE)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===KE)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===jE)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===WE)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===qE)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===KE)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===hN||s===fN||s===dN||s===pN)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===hN)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===fN)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===dN)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===pN)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===HL)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===mN||s===gN)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===mN)return l===An?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===gN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===yN||s===vN||s===wN||s===xN||s===bN||s===_N||s===EN||s===SN||s===AN||s===MN||s===TN||s===PN||s===CN||s===IN)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===yN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===vN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===wN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===xN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===bN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===_N)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===EN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===SN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===AN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===MN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===TN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===PN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===CN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===IN)return l===An?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===XE||s===RN||s===NN)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===XE)return l===An?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===RN)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===NN)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===NQ||s===DN||s===ON||s===LN)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===XE)return a.COMPRESSED_RED_RGTC1_EXT;if(s===DN)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===ON)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===LN)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Fh?i?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class lZ extends Ki{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class cg extends ln{constructor(){super(),this.isGroup=!0,this.type="Group"}}const KLe={type:"move"};class $C{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new cg,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 cg,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new K,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new K),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new cg,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new K,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new K),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const v of e.hand.values()){const w=t.getJointPose(v,i),y=this._getHandJoint(c,v);w!==null&&(y.matrix.fromArray(w.transform.matrix),y.matrix.decompose(y.position,y.rotation,y.scale),y.matrixWorldNeedsUpdate=!0,y.jointRadius=w.radius),y.visible=w!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),m=.02,g=.005;c.inputState.pinching&&f>m+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=m-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(KLe)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new cg;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}const XLe=`
3983void main() {
3984
3985	gl_Position = vec4( position, 1.0 );
3986
3987}`,YLe=`
3988uniform sampler2DArray depthColor;
3989uniform float depthWidth;
3990uniform float depthHeight;
3991
3992void main() {
3993
3994	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
3995
3996	if ( coord.x >= 1.0 ) {
3997
3998		gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
3999
4000	} else {
4001
4002		gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4003
4004	}
4005
4006}`;class QLe{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new zn,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}render(e,t){if(this.texture!==null){if(this.mesh===null){const i=t.cameras[0].viewport,r=new zs({extensions:{fragDepth:!0},vertexShader:XLe,fragmentShader:YLe,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new Ai(new ry(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class ZLe extends fu{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,f=null,m=null,g=null;const v=new QLe,w=t.getContextAttributes();let y=null,_=null;const x=[],S=[],M=new Me;let A=null;const I=new Ki;I.layers.enable(1),I.viewport=new mn;const D=new Ki;D.layers.enable(2),D.viewport=new mn;const k=[I,D],C=new lZ;C.layers.enable(1),C.layers.enable(2);let U=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Y){let te=x[Y];return te===void 0&&(te=new $C,x[Y]=te),te.getTargetRaySpace()},this.getControllerGrip=function(Y){let te=x[Y];return te===void 0&&(te=new $C,x[Y]=te),te.getGripSpace()},this.getHand=function(Y){let te=x[Y];return te===void 0&&(te=new $C,x[Y]=te),te.getHandSpace()};function H(Y){const te=S.indexOf(Y.inputSource);if(te===-1)return;const le=x[te];le!==void 0&&(le.update(Y.inputSource,Y.frame,c||o),le.dispatchEvent({type:Y.type,data:Y.inputSource}))}function z(){r.removeEventListener("select",H),r.removeEventListener("selectstart",H),r.removeEventListener("selectend",H),r.removeEventListener("squeeze",H),r.removeEventListener("squeezestart",H),r.removeEventListener("squeezeend",H),r.removeEventListener("end",z),r.removeEventListener("inputsourceschange",P);for(let Y=0;Y<x.length;Y++){const te=S[Y];te!==null&&(S[Y]=null,x[Y].disconnect(te))}U=null,G=null,v.reset(),e.setRenderTarget(y),m=null,f=null,h=null,r=null,_=null,oe.stop(),i.isPresenting=!1,e.setPixelRatio(A),e.setSize(M.width,M.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(Y){s=Y,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Y){a=Y,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||o},this.setReferenceSpace=function(Y){c=Y},this.getBaseLayer=function(){return f!==null?f:m},this.getBinding=function(){return h},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=async function(Y){if(r=Y,r!==null){if(y=e.getRenderTarget(),r.addEventListener("select",H),r.addEventListener("selectstart",H),r.addEventListener("selectend",H),r.addEventListener("squeeze",H),r.addEventListener("squeezestart",H),r.addEventListener("squeezeend",H),r.addEventListener("end",z),r.addEventListener("inputsourceschange",P),w.xrCompatible!==!0&&await t.makeXRCompatible(),A=e.getPixelRatio(),e.getSize(M),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const te={antialias:r.renderState.layers===void 0?w.antialias:!0,alpha:!0,depth:w.depth,stencil:w.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,te),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),_=new $a(m.framebufferWidth,m.framebufferHeight,{format:zr,type:Fl,colorSpace:e.outputColorSpace,stencilBuffer:w.stencil})}else{let te=null,le=null,ve=null;w.depth&&(ve=w.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,te=w.stencil?mp:zh,le=w.stencil?Fh:Fc);const Te={colorFormat:t.RGBA8,depthFormat:ve,scaleFactor:s};h=new XRWebGLBinding(r,t),f=h.createProjectionLayer(Te),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),_=new $a(f.textureWidth,f.textureHeight,{format:zr,type:Fl,depthTexture:new QL(f.textureWidth,f.textureHeight,le,void 0,void 0,void 0,void 0,void 0,void 0,te),stencilBuffer:w.stencil,colorSpace:e.outputColorSpace,samples:w.antialias?4:0});const be=e.properties.get(_);be.__ignoreDepthValues=f.ignoreDepthValues}_.isXRRenderTarget=!0,this.setFoveation(l),c=null,o=await r.requestReferenceSpace(a),oe.setContext(r),oe.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function P(Y){for(let te=0;te<Y.removed.length;te++){const le=Y.removed[te],ve=S.indexOf(le);ve>=0&&(S[ve]=null,x[ve].disconnect(le))}for(let te=0;te<Y.added.length;te++){const le=Y.added[te];let ve=S.indexOf(le);if(ve===-1){for(let be=0;be<x.length;be++)if(be>=S.length){S.push(le),ve=be;break}else if(S[be]===null){S[be]=le,ve=be;break}if(ve===-1)break}const Te=x[ve];Te&&Te.connect(le)}}const R=new K,F=new K;function N(Y,te,le){R.setFromMatrixPosition(te.matrixWorld),F.setFromMatrixPosition(le.matrixWorld);const ve=R.distanceTo(F),Te=te.projectionMatrix.elements,be=le.projectionMatrix.elements,Le=Te[14]/(Te[10]-1),Oe=Te[14]/(Te[10]+1),J=(Te[9]+1)/Te[5],Se=(Te[9]-1)/Te[5],me=(Te[8]-1)/Te[0],Re=(be[8]+1)/be[0],Ae=Le*me,Ze=Le*Re,Ke=ve/(-me+Re),rt=Ke*-me;te.matrixWorld.decompose(Y.position,Y.quaternion,Y.scale),Y.translateX(rt),Y.translateZ(Ke),Y.matrixWorld.compose(Y.position,Y.quaternion,Y.scale),Y.matrixWorldInverse.copy(Y.matrixWorld).invert();const Et=Le+Ke,X=Oe+Ke,$=Ae-rt,xe=Ze+(ve-rt),Ee=J*Oe/X*Et,Ne=Se*Oe/X*Et;Y.projectionMatrix.makePerspective($,xe,Ee,Ne,Et,X),Y.projectionMatrixInverse.copy(Y.projectionMatrix).invert()}function O(Y,te){te===null?Y.matrixWorld.copy(Y.matrix):Y.matrixWorld.multiplyMatrices(te.matrixWorld,Y.matrix),Y.matrixWorldInverse.copy(Y.matrixWorld).invert()}this.updateCamera=function(Y){if(r===null)return;v.texture!==null&&(Y.near=v.depthNear,Y.far=v.depthFar),C.near=D.near=I.near=Y.near,C.far=D.far=I.far=Y.far,(U!==C.near||G!==C.far)&&(r.updateRenderState({depthNear:C.near,depthFar:C.far}),U=C.near,G=C.far,I.near=U,I.far=G,D.near=U,D.far=G,I.updateProjectionMatrix(),D.updateProjectionMatrix(),Y.updateProjectionMatrix());const te=Y.parent,le=C.cameras;O(C,te);for(let ve=0;ve<le.length;ve++)O(le[ve],te);le.length===2?N(C,I,D):C.projectionMatrix.copy(I.projectionMatrix),B(Y,C,te)};function B(Y,te,le){le===null?Y.matrix.copy(te.matrixWorld):(Y.matrix.copy(le.matrixWorld),Y.matrix.invert(),Y.matrix.multiply(te.matrixWorld)),Y.matrix.decompose(Y.position,Y.quaternion,Y.scale),Y.updateMatrixWorld(!0),Y.projectionMatrix.copy(te.projectionMatrix),Y.projectionMatrixInverse.copy(te.projectionMatrixInverse),Y.isPerspectiveCamera&&(Y.fov=V0*2*Math.atan(1/Y.projectionMatrix.elements[5]),Y.zoom=1)}this.getCamera=function(){return C},this.getFoveation=function(){if(!(f===null&&m===null))return l},this.setFoveation=function(Y){l=Y,f!==null&&(f.fixedFoveation=Y),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=Y)},this.hasDepthSensing=function(){return v.texture!==null};let W=null;function Q(Y,te){if(u=te.getViewerPose(c||o),g=te,u!==null){const le=u.views;m!==null&&(e.setRenderTargetFramebuffer(_,m.framebuffer),e.setRenderTarget(_));let ve=!1;le.length!==C.cameras.length&&(C.cameras.length=0,ve=!0);for(let be=0;be<le.length;be++){const Le=le[be];let Oe=null;if(m!==null)Oe=m.getViewport(Le);else{const Se=h.getViewSubImage(f,Le);Oe=Se.viewport,be===0&&(e.setRenderTargetTextures(_,Se.colorTexture,f.ignoreDepthValues?void 0:Se.depthStencilTexture),e.setRenderTarget(_))}let J=k[be];J===void 0&&(J=new Ki,J.layers.enable(be),J.viewport=new mn,k[be]=J),J.matrix.fromArray(Le.transform.matrix),J.matrix.decompose(J.position,J.quaternion,J.scale),J.projectionMatrix.fromArray(Le.projectionMatrix),J.projectionMatrixInverse.copy(J.projectionMatrix).invert(),J.viewport.set(Oe.x,Oe.y,Oe.width,Oe.height),be===0&&(C.matrix.copy(J.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),ve===!0&&C.cameras.push(J)}const Te=r.enabledFeatures;if(Te&&Te.includes("depth-sensing")){const be=h.getDepthInformation(le[0]);be&&be.isValid&&be.texture&&v.init(e,be,r.renderState)}}for(let le=0;le<x.length;le++){const ve=S[le],Te=x[le];ve!==null&&Te!==void 0&&Te.update(ve,te,c||o)}v.render(e,C),W&&W(Y,te),te.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:te}),g=null}const oe=new tZ;oe.setAnimationLoop(Q),this.setAnimationLoop=function(Y){W=Y},this.dispose=function(){}}}const Lf=new wo,JLe=new wt;function eUe(n,e){function t(w,y){w.matrixAutoUpdate===!0&&w.updateMatrix(),y.value.copy(w.matrix)}function i(w,y){y.color.getRGB(w.fogColor.value,QQ(n)),y.isFog?(w.fogNear.value=y.near,w.fogFar.value=y.far):y.isFogExp2&&(w.fogDensity.value=y.density)}function r(w,y,_,x,S){y.isMeshBasicMaterial||y.isMeshLambertMaterial?s(w,y):y.isMeshToonMaterial?(s(w,y),h(w,y)):y.isMeshPhongMaterial?(s(w,y),u(w,y)):y.isMeshStandardMaterial?(s(w,y),f(w,y),y.isMeshPhysicalMaterial&&m(w,y,S)):y.isMeshMatcapMaterial?(s(w,y),g(w,y)):y.isMeshDepthMaterial?s(w,y):y.isMeshDistanceMaterial?(s(w,y),v(w,y)):y.isMeshNormalMaterial?s(w,y):y.isLineBasicMaterial?(o(w,y),y.isLineDashedMaterial&&a(w,y)):y.isPointsMaterial?l(w,y,_,x):y.isSpriteMaterial?c(w,y):y.isShadowMaterial?(w.color.value.copy(y.color),w.opacity.value=y.opacity):y.isShaderMaterial&&(y.uniformsNeedUpdate=!1)}function s(w,y){w.opacity.value=y.opacity,y.color&&w.diffuse.value.copy(y.color),y.emissive&&w.emissive.value.copy(y.emissive).multiplyScalar(y.emissiveIntensity),y.map&&(w.map.value=y.map,t(y.map,w.mapTransform)),y.alphaMap&&(w.alphaMap.value=y.alphaMap,t(y.alphaMap,w.alphaMapTransform)),y.bumpMap&&(w.bumpMap.value=y.bumpMap,t(y.bumpMap,w.bumpMapTransform),w.bumpScale.value=y.bumpScale,y.side===cs&&(w.bumpScale.value*=-1)),y.normalMap&&(w.normalMap.value=y.normalMap,t(y.normalMap,w.normalMapTransform),w.normalScale.value.copy(y.normalScale),y.side===cs&&w.normalScale.value.negate()),y.displacementMap&&(w.displacementMap.value=y.displacementMap,t(y.displacementMap,w.displacementMapTransform),w.displacementScale.value=y.displacementScale,w.displacementBias.value=y.displacementBias),y.emissiveMap&&(w.emissiveMap.value=y.emissiveMap,t(y.emissiveMap,w.emissiveMapTransform)),y.specularMap&&(w.specularMap.value=y.specularMap,t(y.specularMap,w.specularMapTransform)),y.alphaTest>0&&(w.alphaTest.value=y.alphaTest);const _=e.get(y),x=_.envMap,S=_.envMapRotation;if(x&&(w.envMap.value=x,Lf.copy(S),Lf.x*=-1,Lf.y*=-1,Lf.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(Lf.y*=-1,Lf.z*=-1),w.envMapRotation.value.setFromMatrix4(JLe.makeRotationFromEuler(Lf)),w.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=y.reflectivity,w.ior.value=y.ior,w.refractionRatio.value=y.refractionRatio),y.lightMap){w.lightMap.value=y.lightMap;const M=n._useLegacyLights===!0?Math.PI:1;w.lightMapIntensity.value=y.lightMapIntensity*M,t(y.lightMap,w.lightMapTransform)}y.aoMap&&(w.aoMap.value=y.aoMap,w.aoMapIntensity.value=y.aoMapIntensity,t(y.aoMap,w.aoMapTransform))}function o(w,y){w.diffuse.value.copy(y.color),w.opacity.value=y.opacity,y.map&&(w.map.value=y.map,t(y.map,w.mapTransform))}function a(w,y){w.dashSize.value=y.dashSize,w.totalSize.value=y.dashSize+y.gapSize,w.scale.value=y.scale}function l(w,y,_,x){w.diffuse.value.copy(y.color),w.opacity.value=y.opacity,w.size.value=y.size*_,w.scale.value=x*.5,y.map&&(w.map.value=y.map,t(y.map,w.uvTransform)),y.alphaMap&&(w.alphaMap.value=y.alphaMap,t(y.alphaMap,w.alphaMapTransform)),y.alphaTest>0&&(w.alphaTest.value=y.alphaTest)}function c(w,y){w.diffuse.value.copy(y.color),w.opacity.value=y.opacity,w.rotation.value=y.rotation,y.map&&(w.map.value=y.map,t(y.map,w.mapTransform)),y.alphaMap&&(w.alphaMap.value=y.alphaMap,t(y.alphaMap,w.alphaMapTransform)),y.alphaTest>0&&(w.alphaTest.value=y.alphaTest)}function u(w,y){w.specular.value.copy(y.specular),w.shininess.value=Math.max(y.shininess,1e-4)}function h(w,y){y.gradientMap&&(w.gradientMap.value=y.gradientMap)}function f(w,y){w.metalness.value=y.metalness,y.metalnessMap&&(w.metalnessMap.value=y.metalnessMap,t(y.metalnessMap,w.metalnessMapTransform)),w.roughness.value=y.roughness,y.roughnessMap&&(w.roughnessMap.value=y.roughnessMap,t(y.roughnessMap,w.roughnessMapTransform)),e.get(y).envMap&&(w.envMapIntensity.value=y.envMapIntensity)}function m(w,y,_){w.ior.value=y.ior,y.sheen>0&&(w.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),w.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(w.sheenColorMap.value=y.sheenColorMap,t(y.sheenColorMap,w.sheenColorMapTransform)),y.sheenRoughnessMap&&(w.sheenRoughnessMap.value=y.sheenRoughnessMap,t(y.sheenRoughnessMap,w.sheenRoughnessMapTransform))),y.clearcoat>0&&(w.clearcoat.value=y.clearcoat,w.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(w.clearcoatMap.value=y.clearcoatMap,t(y.clearcoatMap,w.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,t(y.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(w.clearcoatNormalMap.value=y.clearcoatNormalMap,t(y.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===cs&&w.clearcoatNormalScale.value.negate())),y.iridescence>0&&(w.iridescence.value=y.iridescence,w.iridescenceIOR.value=y.iridescenceIOR,w.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(w.iridescenceMap.value=y.iridescenceMap,t(y.iridescenceMap,w.iridescenceMapTransform)),y.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=y.iridescenceThicknessMap,t(y.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),y.transmission>0&&(w.transmission.value=y.transmission,w.transmissionSamplerMap.value=_.texture,w.transmissionSamplerSize.value.set(_.width,_.height),y.transmissionMap&&(w.transmissionMap.value=y.transmissionMap,t(y.transmissionMap,w.transmissionMapTransform)),w.thickness.value=y.thickness,y.thicknessMap&&(w.thicknessMap.value=y.thicknessMap,t(y.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=y.attenuationDistance,w.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(w.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(w.anisotropyMap.value=y.anisotropyMap,t(y.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=y.specularIntensity,w.specularColor.value.copy(y.specularColor),y.specularColorMap&&(w.specularColorMap.value=y.specularColorMap,t(y.specularColorMap,w.specularColorMapTransform)),y.specularIntensityMap&&(w.specularIntensityMap.value=y.specularIntensityMap,t(y.specularIntensityMap,w.specularIntensityMapTransform))}function g(w,y){y.matcap&&(w.matcap.value=y.matcap)}function v(w,y){const _=e.get(y).light;w.referencePosition.value.setFromMatrixPosition(_.matrixWorld),w.nearDistance.value=_.shadow.camera.near,w.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function tUe(n,e,t,i){let r={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(_,x){const S=x.program;i.uniformBlockBinding(_,S)}function c(_,x){let S=r[_.id];S===void 0&&(g(_),S=u(_),r[_.id]=S,_.addEventListener("dispose",w));const M=x.program;i.updateUBOMapping(_,M);const A=e.render.frame;s[_.id]!==A&&(f(_),s[_.id]=A)}function u(_){const x=h();_.__bindingPointIndex=x;const S=n.createBuffer(),M=_.__size,A=_.usage;return n.bindBuffer(n.UNIFORM_BUFFER,S),n.bufferData(n.UNIFORM_BUFFER,M,A),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,x,S),S}function h(){for(let _=0;_<a;_++)if(o.indexOf(_)===-1)return o.push(_),_;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(_){const x=r[_.id],S=_.uniforms,M=_.__cache;n.bindBuffer(n.UNIFORM_BUFFER,x);for(let A=0,I=S.length;A<I;A++){const D=Array.isArray(S[A])?S[A]:[S[A]];for(let k=0,C=D.length;k<C;k++){const U=D[k];if(m(U,A,k,M)===!0){const G=U.__offset,H=Array.isArray(U.value)?U.value:[U.value];let z=0;for(let P=0;P<H.length;P++){const R=H[P],F=v(R);typeof R=="number"||typeof R=="boolean"?(U.__data[0]=R,n.bufferSubData(n.UNIFORM_BUFFER,G+z,U.__data)):R.isMatrix3?(U.__data[0]=R.elements[0],U.__data[1]=R.elements[1],U.__data[2]=R.elements[2],U.__data[3]=0,U.__data[4]=R.elements[3],U.__data[5]=R.elements[4],U.__data[6]=R.elements[5],U.__data[7]=0,U.__data[8]=R.elements[6],U.__data[9]=R.elements[7],U.__data[10]=R.elements[8],U.__data[11]=0):(R.toArray(U.__data,z),z+=F.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,G,U.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function m(_,x,S,M){const A=_.value,I=x+"_"+S;if(M[I]===void 0)return typeof A=="number"||typeof A=="boolean"?M[I]=A:M[I]=A.clone(),!0;{const D=M[I];if(typeof A=="number"||typeof A=="boolean"){if(D!==A)return M[I]=A,!0}else if(D.equals(A)===!1)return D.copy(A),!0}return!1}function g(_){const x=_.uniforms;let S=0;const M=16;for(let I=0,D=x.length;I<D;I++){const k=Array.isArray(x[I])?x[I]:[x[I]];for(let C=0,U=k.length;C<U;C++){const G=k[C],H=Array.isArray(G.value)?G.value:[G.value];for(let z=0,P=H.length;z<P;z++){const R=H[z],F=v(R),N=S%M;N!==0&&M-N<F.boundary&&(S+=M-N),G.__data=new Float32Array(F.storage/Float32Array.BYTES_PER_ELEMENT),G.__offset=S,S+=F.storage}}}const A=S%M;return A>0&&(S+=M-A),_.__size=S,_.__cache={},this}function v(_){const x={boundary:0,storage:0};return typeof _=="number"||typeof _=="boolean"?(x.boundary=4,x.storage=4):_.isVector2?(x.boundary=8,x.storage=8):_.isVector3||_.isColor?(x.boundary=16,x.storage=12):_.isVector4?(x.boundary=16,x.storage=16):_.isMatrix3?(x.boundary=48,x.storage=48):_.isMatrix4?(x.boundary=64,x.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),x}function w(_){const x=_.target;x.removeEventListener("dispose",w);const S=o.indexOf(x.__bindingPointIndex);o.splice(S,1),n.deleteBuffer(r[x.id]),delete r[x.id],delete s[x.id]}function y(){for(const _ in r)n.deleteBuffer(r[_]);o=[],r={},s={}}return{bind:l,update:c,dispose:y}}class eU{constructor(e={}){const{canvas:t=qQ(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=o;const m=new Uint32Array(4),g=new Int32Array(4);let v=null,w=null;const y=[],_=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Jo,this._useLegacyLights=!1,this.toneMapping=kl,this.toneMappingExposure=1;const x=this;let S=!1,M=0,A=0,I=null,D=-1,k=null;const C=new mn,U=new mn;let G=null;const H=new et(0);let z=0,P=t.width,R=t.height,F=1,N=null,O=null;const B=new mn(0,0,P,R),W=new mn(0,0,P,R);let Q=!1;const oe=new cx;let Y=!1,te=!1,le=null;const ve=new wt,Te=new Me,be=new K,Le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Oe(){return I===null?F:1}let J=i;function Se(q,ae){for(let pe=0;pe<q.length;pe++){const ye=q[pe],he=t.getContext(ye,ae);if(he!==null)return he}return null}try{const q={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${rx}`),t.addEventListener("webglcontextlost",En,!1),t.addEventListener("webglcontextrestored",re,!1),t.addEventListener("webglcontextcreationerror",je,!1),J===null){const ae=["webgl2","webgl","experimental-webgl"];if(x.isWebGL1Renderer===!0&&ae.shift(),J=Se(ae,q),J===null)throw Se(ae)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext<"u"&&J instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),J.getShaderPrecisionFormat===void 0&&(J.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let me,Re,Ae,Ze,Ke,rt,Et,X,$,xe,Ee,Ne,Pe,_t,pt,Fe,$e,At,ke,Yn,zt,dt,lt,ct;function qt(){me=new hOe(J),Re=new sOe(J,me,e),me.init(Re),dt=new aZ(J,me,Re),Ae=new WLe(J,me,Re),Ze=new pOe(J),Ke=new OLe,rt=new qLe(J,me,Ae,Ke,Re,dt,Ze),Et=new aOe(x),X=new uOe(x),$=new xRe(J,Re),lt=new iOe(J,me,$,Re),xe=new fOe(J,$,Ze,lt),Ee=new vOe(J,xe,$,Ze),ke=new yOe(J,Re,rt),Fe=new oOe(Ke),Ne=new DLe(x,Et,X,me,Re,lt,Fe),Pe=new eUe(x,Ke),_t=new ULe,pt=new HLe(me,Re),At=new nOe(x,Et,X,Ae,Ee,f,l),$e=new jLe(x,Ee,Re),ct=new tUe(J,Ze,Re,Ae),Yn=new rOe(J,me,Ze,Re),zt=new dOe(J,me,Ze,Re),Ze.programs=Ne.programs,x.capabilities=Re,x.extensions=me,x.properties=Ke,x.renderLists=_t,x.shadowMap=$e,x.state=Ae,x.info=Ze}qt();const Pt=new ZLe(x,J);this.xr=Pt,this.getContext=function(){return J},this.getContextAttributes=function(){return J.getContextAttributes()},this.forceContextLoss=function(){const q=me.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){const q=me.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return F},this.setPixelRatio=function(q){q!==void 0&&(F=q,this.setSize(P,R,!1))},this.getSize=function(q){return q.set(P,R)},this.setSize=function(q,ae,pe=!0){if(Pt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}P=q,R=ae,t.width=Math.floor(q*F),t.height=Math.floor(ae*F),pe===!0&&(t.style.width=q+"px",t.style.height=ae+"px"),this.setViewport(0,0,q,ae)},this.getDrawingBufferSize=function(q){return q.set(P*F,R*F).floor()},this.setDrawingBufferSize=function(q,ae,pe){P=q,R=ae,F=pe,t.width=Math.floor(q*pe),t.height=Math.floor(ae*pe),this.setViewport(0,0,q,ae)},this.getCurrentViewport=function(q){return q.copy(C)},this.getViewport=function(q){return q.copy(B)},this.setViewport=function(q,ae,pe,ye){q.isVector4?B.set(q.x,q.y,q.z,q.w):B.set(q,ae,pe,ye),Ae.viewport(C.copy(B).multiplyScalar(F).round())}
vendor: 4,200 bytes, line 4006
4006,this.getScissor=function(q){return q.copy(W)},this.setScissor=function(q,ae,pe,ye){q.isVector4?W.set(q.x,q.y,q.z,q.w):W.set(q,ae,pe,ye),Ae.scissor(U.copy(W).multiplyScalar(F).round())},this.getScissorTest=function(){return Q},this.setScissorTest=function(q){Ae.setScissorTest(Q=q)},this.setOpaqueSort=function(q){N=q},this.setTransparentSort=function(q){O=q},this.getClearColor=function(q){return q.copy(At.getClearColor())},this.setClearColor=function(){At.setClearColor.apply(At,arguments)},this.getClearAlpha=function(){return At.getClearAlpha()},this.setClearAlpha=function(){At.setClearAlpha.apply(At,arguments)},this.clear=function(q=!0,ae=!0,pe=!0){let ye=0;if(q){let he=!1;if(I!==null){const Je=I.texture.format;he=Je===VL||Je===zL||Je===FL}if(he){const Je=I.texture.type,ht=Je===Fl||Je===Fc||Je===L2||Je===Fh||Je===UL||Je===BL,gt=At.getClearColor(),xt=At.getClearAlpha(),Mt=gt.r,St=gt.g,Tt=gt.b;ht?(m[0]=Mt,m[1]=St,m[2]=Tt,m[3]=xt,J.clearBufferuiv(J.COLOR,0,m)):(g[0]=Mt,g[1]=St,g[2]=Tt,g[3]=xt,J.clearBufferiv(J.COLOR,0,g))}else ye|=J.COLOR_BUFFER_BIT}ae&&(ye|=J.DEPTH_BUFFER_BIT),pe&&(ye|=J.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),J.clear(ye)},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(){t.removeEventListener("webglcontextlost",En,!1),t.removeEventListener("webglcontextrestored",re,!1),t.removeEventListener("webglcontextcreationerror",je,!1),_t.dispose(),pt.dispose(),Ke.dispose(),Et.dispose(),X.dispose(),Ee.dispose(),lt.dispose(),ct.dispose(),Ne.dispose(),Pt.dispose(),Pt.removeEventListener("sessionstart",Wr),Pt.removeEventListener("sessionend",yn),le&&(le.dispose(),le=null),Zi.stop()};function En(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),S=!0}function re(){console.log("THREE.WebGLRenderer: Context Restored."),S=!1;const q=Ze.autoReset,ae=$e.enabled,pe=$e.autoUpdate,ye=$e.needsUpdate,he=$e.type;qt(),Ze.autoReset=q,$e.enabled=ae,$e.autoUpdate=pe,$e.needsUpdate=ye,$e.type=he}function je(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function de(q){const ae=q.target;ae.removeEventListener("dispose",de),ze(ae)}function ze(q){We(q),Ke.remove(q)}function We(q){const ae=Ke.get(q).programs;ae!==void 0&&(ae.forEach(function(pe){Ne.releaseProgram(pe)}),q.isShaderMaterial&&Ne.releaseShaderCache(q))}this.renderBufferDirect=function(q,ae,pe,ye,he,Je){ae===null&&(ae=Le);const ht=he.isMesh&&he.matrixWorld.determinant()<0,gt=aM(q,ae,pe,ye,he);Ae.setMaterial(ye,ht);let xt=pe.index,Mt=1;if(ye.wireframe===!0){if(xt=xe.getWireframeAttribute(pe),xt===void 0)return;Mt=2}const St=pe.drawRange,Tt=pe.attributes.position;let Hn=St.start*Mt,Ji=(St.start+St.count)*Mt;Je!==null&&(Hn=Math.max(Hn,Je.start*Mt),Ji=Math.min(Ji,(Je.start+Je.count)*Mt)),xt!==null?(Hn=Math.max(Hn,0),Ji=Math.min(Ji,xt.count)):Tt!=null&&(Hn=Math.max(Hn,0),Ji=Math.min(Ji,Tt.count));const In=Ji-Hn;if(In<0||In===1/0)return;lt.setup(he,ye,gt,pe,xt);let Oi,bt=Yn;if(xt!==null&&(Oi=$.get(xt),bt=zt,bt.setIndex(Oi)),he.isMesh)ye.wireframe===!0?(Ae.setLineWidth(ye.wireframeLinewidth*Oe()),bt.setMode(J.LINES)):bt.setMode(J.TRIANGLES);else if(he.isLine){let tt=ye.linewidth;tt===void 0&&(tt=1),Ae.setLineWidth(tt*Oe()),he.isLineSegments?bt.setMode(J.LINES):he.isLineLoop?bt.setMode(J.LINE_LOOP):bt.setMode(J.LINE_STRIP)}else he.isPoints?bt.setMode(J.POINTS):he.isSprite&&bt.setMode(J.TRIANGLES);if(he.isBatchedMesh)bt.renderMultiDraw(he._multiDrawStarts,he._multiDrawCounts,he._multiDrawCount);else if(he.isInstancedMesh)bt.renderInstances(Hn,In,he.count);else if(pe.isInstancedBufferGeometry){const tt=pe._maxInstanceCount!==void 0?pe._maxInstanceCount:1/0,Ao=Math.min(pe.instanceCount,tt);bt.renderInstances(Hn,In,Ao)}else bt.render(Hn,In)};function Ht(q,ae,pe){q.transparent===!0&&q.side===Ua&&q.forceSinglePass===!1?(q.side=cs,q.needsUpdate=!0,Lp(q,ae,pe),q.side=ou,q.needsUpdate=!0,Lp(q,ae,pe),q.side=Ua):Lp(q,ae,pe)}this.compile=function(q,ae,pe=null){pe===null&&(pe=q),w=pt.get(pe),w.init(),_.push(w),pe.traverseVisible(function(he){he.isLight&&he.layers.test(ae.layers
vendor: 65,520 bytes, line 4006
4006)&&(w.pushLight(he),he.castShadow&&w.pushShadow(he))}),q!==pe&&q.traverseVisible(function(he){he.isLight&&he.layers.test(ae.layers)&&(w.pushLight(he),he.castShadow&&w.pushShadow(he))}),w.setupLights(x._useLegacyLights);const ye=new Set;return q.traverse(function(he){const Je=he.material;if(Je)if(Array.isArray(Je))for(let ht=0;ht<Je.length;ht++){const gt=Je[ht];Ht(gt,pe,he),ye.add(gt)}else Ht(Je,pe,he),ye.add(Je)}),_.pop(),w=null,ye},this.compileAsync=function(q,ae,pe=null){const ye=this.compile(q,ae,pe);return new Promise(he=>{function Je(){if(ye.forEach(function(ht){Ke.get(ht).currentProgram.isReady()&&ye.delete(ht)}),ye.size===0){he(q);return}setTimeout(Je,10)}me.get("KHR_parallel_shader_compile")!==null?Je():setTimeout(Je,10)})};let fn=null;function mi(q){fn&&fn(q)}function Wr(){Zi.stop()}function yn(){Zi.start()}const Zi=new tZ;Zi.setAnimationLoop(mi),typeof self<"u"&&Zi.setContext(self),this.setAnimationLoop=function(q){fn=q,Pt.setAnimationLoop(q),q===null?Zi.stop():Zi.start()},Pt.addEventListener("sessionstart",Wr),Pt.addEventListener("sessionend",yn),this.render=function(q,ae){if(ae!==void 0&&ae.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),ae.parent===null&&ae.matrixWorldAutoUpdate===!0&&ae.updateMatrixWorld(),Pt.enabled===!0&&Pt.isPresenting===!0&&(Pt.cameraAutoUpdate===!0&&Pt.updateCamera(ae),ae=Pt.getCamera()),q.isScene===!0&&q.onBeforeRender(x,q,ae,I),w=pt.get(q,_.length),w.init(),_.push(w),ve.multiplyMatrices(ae.projectionMatrix,ae.matrixWorldInverse),oe.setFromProjectionMatrix(ve),te=this.localClippingEnabled,Y=Fe.init(this.clippingPlanes,te),v=_t.get(q,y.length),v.init(),y.push(v),So(q,ae,0,x.sortObjects),v.finish(),x.sortObjects===!0&&v.sort(N,O),this.info.render.frame++,Y===!0&&Fe.beginShadows();const pe=w.state.shadowsArray;if($e.render(pe,q,ae),Y===!0&&Fe.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Pt.enabled===!1||Pt.isPresenting===!1||Pt.hasDepthSensing()===!1)&&At.render(v,q),w.setupLights(x._useLegacyLights),ae.isArrayCamera){const ye=ae.cameras;for(let he=0,Je=ye.length;he<Je;he++){const ht=ye[he];ly(v,q,ht,ht.viewport)}}else ly(v,q,ae);I!==null&&(rt.updateMultisampleRenderTarget(I),rt.updateRenderTargetMipmap(I)),q.isScene===!0&&q.onAfterRender(x,q,ae),lt.resetDefaultState(),D=-1,k=null,_.pop(),_.length>0?w=_[_.length-1]:w=null,y.pop(),y.length>0?v=y[y.length-1]:v=null};function So(q,ae,pe,ye){if(q.visible===!1)return;if(q.layers.test(ae.layers)){if(q.isGroup)pe=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(ae);else if(q.isLight)w.pushLight(q),q.castShadow&&w.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||oe.intersectsSprite(q)){ye&&be.setFromMatrixPosition(q.matrixWorld).applyMatrix4(ve);const ht=Ee.update(q),gt=q.material;gt.visible&&v.push(q,ht,gt,pe,be.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||oe.intersectsObject(q))){const ht=Ee.update(q),gt=q.material;if(ye&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),be.copy(q.boundingSphere.center)):(ht.boundingSphere===null&&ht.computeBoundingSphere(),be.copy(ht.boundingSphere.center)),be.applyMatrix4(q.matrixWorld).applyMatrix4(ve)),Array.isArray(gt)){const xt=ht.groups;for(let Mt=0,St=xt.length;Mt<St;Mt++){const Tt=xt[Mt],Hn=gt[Tt.materialIndex];Hn&&Hn.visible&&v.push(q,ht,Hn,pe,be.z,Tt)}}else gt.visible&&v.push(q,ht,gt,pe,be.z,null)}}const Je=q.children;for(let ht=0,gt=Je.length;ht<gt;ht++)So(Je[ht],ae,pe,ye)}function ly(q,ae,pe,ye){const he=q.opaque,Je=q.transmissive,ht=q.transparent;w.setupLightsView(pe),Y===!0&&Fe.setGlobalState(x.clippingPlanes,pe),Je.length>0&&cy(he,Je,ae,pe),ye&&Ae.viewport(C.copy(ye)),he.length>0&&Op(he,ae,pe),Je.length>0&&Op(Je,ae,pe),ht.length>0&&Op(ht,ae,pe),Ae.buffers.depth.setTest(!0),Ae.buffers.depth.setMask(!0),Ae.buffers.color.setMask(!0),Ae.setPolygonOffset(!1)}function cy(q,ae,pe,ye){if((pe.isScene===!0?pe.overrideMaterial:null)!==null)return;const Je=Re.isWebGL2;le===null&&(le=new $a(1,1,{generateMipmaps:!0,type:me.has("EXT_color_buffer_half_float")?z0:Fl,minFilter:Il,samples:Je?4:0})),x.getDrawingBufferSize(Te),Je?le.setSize(Te.x,Te.y):le.setSize(mA(Te.x),mA(Te.y));const ht=x.getRenderTarget();x.setRenderTarget(le),x.getClearColor(H),z=x.getClearAlpha(),z<1&&x.setClearColor(16777215,.5),x.clear();const gt=x.toneMapping;x.toneMapping=kl,Op(q,pe,ye),rt.updateMultisampleRenderTarget(le),rt.updateRenderTargetMipmap(le);let xt=!1;for(let Mt=0,St=ae.length;Mt<St;Mt++){const Tt=ae[Mt],Hn=Tt.object,Ji=Tt.geometry,In=Tt.material,Oi=Tt.group;if(In.side===Ua&&Hn.layers.test(ye.layers)){const bt=In.side;In.side=cs,In.needsUpdate=!0,du(Hn,pe,ye,Ji,In,Oi),In.side=bt,In.needsUpdate=!0,xt=!0}}xt===!0&&(rt.updateMultisampleRenderTarget(le),rt.updateRenderTargetMipmap(le)),x.setRenderTarget(ht),x.setClearColor(H,z),x.toneMapping=gt}function Op(q,ae,pe){const ye=ae.isScene===!0?ae.overrideMaterial:null;for(let he=0,Je=q.length;he<Je;he++){const ht=q[he],gt=ht.object,xt=ht.geometry,Mt=ye===null?ht.material:ye,St=ht.group;gt.layers.test(pe.layers)&&du(gt,ae,pe,xt,Mt,St)}}function du(q,ae,pe,ye,he,Je){q.onBeforeRender(x,ae,pe,ye,he,Je),q.modelViewMatrix.multiplyMatrices(pe.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),he.onBeforeRender(x,ae,pe,ye,q,Je),he.transparent===!0&&he.side===Ua&&he.forceSinglePass===!1?(he.side=cs,he.needsUpdate=!0,x.renderBufferDirect(pe,ae,ye,he,q,Je),he.side=ou,he.needsUpdate=!0,x.renderBufferDirect(pe,ae,ye,he,q,Je),he.side=Ua):x.renderBufferDirect(pe,ae,ye,he,q,Je),q.onAfterRender(x,ae,pe,ye,he,Je)}function Lp(q,ae,pe){ae.isScene!==!0&&(ae=Le);const ye=Ke.get(q),he=w.state.lights,Je=w.state.shadowsArray,ht=he.state.version,gt=Ne.getParameters(q,he.state,Je,ae,pe),xt=Ne.getProgramCacheKey(gt);let Mt=ye.programs;ye.environment=q.isMeshStandardMaterial?ae.environment:null,ye.fog=ae.fog,ye.envMap=(q.isMeshStandardMaterial?X:Et).get(q.envMap||ye.environment),ye.envMapRotation=ye.environment!==null&&q.envMap===null?ae.environmentRotation:q.envMapRotation,Mt===void 0&&(q.addEventListener("dispose",de),Mt=new Map,ye.programs=Mt);let St=Mt.get(xt);if(St!==void 0){if(ye.currentProgram===St&&ye.lightsStateVersion===ht)return wx(q,gt),St}else gt.uniforms=Ne.getUniforms(q),q.onBuild(pe,gt,x),q.onBeforeCompile(gt,x),St=Ne.acquireProgram(gt,xt),Mt.set(xt,St),ye.uniforms=gt.uniforms;const Tt=ye.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(Tt.clippingPlanes=Fe.uniform),wx(q,gt),ye.needsLights=cM(q),ye.lightsStateVersion=ht,ye.needsLights&&(Tt.ambientLightColor.value=he.state.ambient,Tt.lightProbe.value=he.state.probe,Tt.directionalLights.value=he.state.directional,Tt.directionalLightShadows.value=he.state.directionalShadow,Tt.spotLights.value=he.state.spot,Tt.spotLightShadows.value=he.state.spotShadow,Tt.rectAreaLights.value=he.state.rectArea,Tt.ltc_1.value=he.state.rectAreaLTC1,Tt.ltc_2.value=he.state.rectAreaLTC2,Tt.pointLights.value=he.state.point,Tt.pointLightShadows.value=he.state.pointShadow,Tt.hemisphereLights.value=he.state.hemi,Tt.directionalShadowMap.value=he.state.directionalShadowMap,Tt.directionalShadowMatrix.value=he.state.directionalShadowMatrix,Tt.spotShadowMap.value=he.state.spotShadowMap,Tt.spotLightMatrix.value=he.state.spotLightMatrix,Tt.spotLightMap.value=he.state.spotLightMap,Tt.pointShadowMap.value=he.state.pointShadowMap,Tt.pointShadowMatrix.value=he.state.pointShadowMatrix),ye.currentProgram=St,ye.uniformsList=null,St}function vx(q){if(q.uniformsList===null){const ae=q.currentProgram.getUniforms();q.uniformsList=QE.seqWithValue(ae.seq,q.uniforms)}return q.uniformsList}function wx(q,ae){const pe=Ke.get(q);pe.outputColorSpace=ae.outputColorSpace,pe.batching=ae.batching,pe.instancing=ae.instancing,pe.instancingColor=ae.instancingColor,pe.instancingMorph=ae.instancingMorph,pe.skinning=ae.skinning,pe.morphTargets=ae.morphTargets,pe.morphNormals=ae.morphNormals,pe.morphColors=ae.morphColors,pe.morphTargetsCount=ae.morphTargetsCount,pe.numClippingPlanes=ae.numClippingPlanes,pe.numIntersection=ae.numClipIntersection,pe.vertexAlphas=ae.vertexAlphas,pe.vertexTangents=ae.vertexTangents,pe.toneMapping=ae.toneMapping}function aM(q,ae,pe,ye,he){ae.isScene!==!0&&(ae=Le),rt.resetTextureUnits();const Je=ae.fog,ht=ye.isMeshStandardMaterial?ae.environment:null,gt=I===null?x.outputColorSpace:I.isXRRenderTarget===!0?I.texture.colorSpace:hu,xt=(ye.isMeshStandardMaterial?X:Et).get(ye.envMap||ht),Mt=ye.vertexColors===!0&&!!pe.attributes.color&&pe.attributes.color.itemSize===4,St=!!pe.attributes.tangent&&(!!ye.normalMap||ye.anisotropy>0),Tt=!!pe.morphAttributes.position,Hn=!!pe.morphAttributes.normal,Ji=!!pe.morphAttributes.color;let In=kl;ye.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(In=x.toneMapping);const Oi=pe.morphAttributes.position||pe.morphAttributes.normal||pe.morphAttributes.color,bt=Oi!==void 0?Oi.length:0,tt=Ke.get(ye),Ao=w.state.lights;if(Y===!0&&(te===!0||q!==k)){const er=q===k&&ye.id===D;Fe.setState(ye,q,er)}let Ot=!1;ye.version===tt.__version?(tt.needsLights&&tt.lightsStateVersion!==Ao.state.version||tt.outputColorSpace!==gt||he.isBatchedMesh&&tt.batching===!1||!he.isBatchedMesh&&tt.batching===!0||he.isInstancedMesh&&tt.instancing===!1||!he.isInstancedMesh&&tt.instancing===!0||he.isSkinnedMesh&&tt.skinning===!1||!he.isSkinnedMesh&&tt.skinning===!0||he.isInstancedMesh&&tt.instancingColor===!0&&he.instanceColor===null||he.isInstancedMesh&&tt.instancingColor===!1&&he.instanceColor!==null||he.isInstancedMesh&&tt.instancingMorph===!0&&he.morphTexture===null||he.isInstancedMesh&&tt.instancingMorph===!1&&he.morphTexture!==null||tt.envMap!==xt||ye.fog===!0&&tt.fog!==Je||tt.numClippingPlanes!==void 0&&(tt.numClippingPlanes!==Fe.numPlanes||tt.numIntersection!==Fe.numIntersection)||tt.vertexAlphas!==Mt||tt.vertexTangents!==St||tt.morphTargets!==Tt||tt.morphNormals!==Hn||tt.morphColors!==Ji||tt.toneMapping!==In||Re.isWebGL2===!0&&tt.morphTargetsCount!==bt)&&(Ot=!0):(Ot=!0,tt.__version=ye.version);let Qn=tt.currentProgram;Ot===!0&&(Qn=Lp(ye,ae,he));let qa=!1,Mo=!1,Li=!1;const oi=Qn.getUniforms(),Ka=tt.uniforms;if(Ae.useProgram(Qn.program)&&(qa=!0,Mo=!0,Li=!0),ye.id!==D&&(D=ye.id,Mo=!0),qa||k!==q){oi.setValue(J,"projectionMatrix",q.projectionMatrix),oi.setValue(J,"viewMatrix",q.matrixWorldInverse);const er=oi.map.cameraPosition;er!==void 0&&er.setValue(J,be.setFromMatrixPosition(q.matrixWorld)),Re.logarithmicDepthBuffer&&oi.setValue(J,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(ye.isMeshPhongMaterial||ye.isMeshToonMaterial||ye.isMeshLambertMaterial||ye.isMeshBasicMaterial||ye.isMeshStandardMaterial||ye.isShaderMaterial)&&oi.setValue(J,"isOrthographic",q.isOrthographicCamera===!0),k!==q&&(k=q,Mo=!0,Li=!0)}if(he.isSkinnedMesh){oi.setOptional(J,he,"bindMatrix"),oi.setOptional(J,he,"bindMatrixInverse");const er=he.skeleton;er&&(Re.floatVertexTextures?(er.boneTexture===null&&er.computeBoneTexture(),oi.setValue(J,"boneTexture",er.boneTexture,rt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}he.isBatchedMesh&&(oi.setOptional(J,he,"batchingTexture"),oi.setValue(J,"batchingTexture",he._matricesTexture,rt));const Up=pe.morphAttributes;if((Up.position!==void 0||Up.normal!==void 0||Up.color!==void 0&&Re.isWebGL2===!0)&&ke.update(he,pe,Qn),(Mo||tt.receiveShadow!==he.receiveShadow)&&(tt.receiveShadow=he.receiveShadow,oi.setValue(J,"receiveShadow",he.receiveShadow)),ye.isMeshGouraudMaterial&&ye.envMap!==null&&(Ka.envMap.value=xt,Ka.flipEnvMap.value=xt.isCubeTexture&&xt.isRenderTargetTexture===!1?-1:1),Mo&&(oi.setValue(J,"toneMappingExposure",x.toneMappingExposure),tt.needsLights&&lM(Ka,Li),Je&&ye.fog===!0&&Pe.refreshFogUniforms(Ka,Je),Pe.refreshMaterialUniforms(Ka,ye,F,R,le),QE.upload(J,vx(tt),Ka,rt)),ye.isShaderMaterial&&ye.uniformsNeedUpdate===!0&&(QE.upload(J,vx(tt),Ka,rt),ye.uniformsNeedUpdate=!1),ye.isSpriteMaterial&&oi.setValue(J,"center",he.center),oi.setValue(J,"modelViewMatrix",he.modelViewMatrix),oi.setValue(J,"normalMatrix",he.normalMatrix),oi.setValue(J,"modelMatrix",he.matrixWorld),ye.isShaderMaterial||ye.isRawShaderMaterial){const er=ye.uniformsGroups;for(let Bp=0,$s=er.length;Bp<$s;Bp++)if(Re.isWebGL2){const xx=er[Bp];ct.update(xx,Qn),ct.bind(xx,Qn)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Qn}function lM(q,ae){q.ambientLightColor.needsUpdate=ae,q.lightProbe.needsUpdate=ae,q.directionalLights.needsUpdate=ae,q.directionalLightShadows.needsUpdate=ae,q.pointLights.needsUpdate=ae,q.pointLightShadows.needsUpdate=ae,q.spotLights.needsUpdate=ae,q.spotLightShadows.needsUpdate=ae,q.rectAreaLights.needsUpdate=ae,q.hemisphereLights.needsUpdate=ae}function cM(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return A},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(q,ae,pe){Ke.get(q.texture).__webglTexture=ae,Ke.get(q.depthTexture).__webglTexture=pe;const ye=Ke.get(q);ye.__hasExternalTextures=!0,ye.__autoAllocateDepthBuffer=pe===void 0,ye.__autoAllocateDepthBuffer||me.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ye.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(q,ae){const pe=Ke.get(q);pe.__webglFramebuffer=ae,pe.__useDefaultFramebuffer=ae===void 0},this.setRenderTarget=function(q,ae=0,pe=0){I=q,M=ae,A=pe;let ye=!0,he=null,Je=!1,ht=!1;if(q){const xt=Ke.get(q);xt.__useDefaultFramebuffer!==void 0?(Ae.bindFramebuffer(J.FRAMEBUFFER,null),ye=!1):xt.__webglFramebuffer===void 0?rt.setupRenderTarget(q):xt.__hasExternalTextures&&rt.rebindTextures(q,Ke.get(q.texture).__webglTexture,Ke.get(q.depthTexture).__webglTexture);const Mt=q.texture;(Mt.isData3DTexture||Mt.isDataArrayTexture||Mt.isCompressedArrayTexture)&&(ht=!0);const St=Ke.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(St[ae])?he=St[ae][pe]:he=St[ae],Je=!0):Re.isWebGL2&&q.samples>0&&rt.useMultisampledRTT(q)===!1?he=Ke.get(q).__webglMultisampledFramebuffer:Array.isArray(St)?he=St[pe]:he=St,C.copy(q.viewport),U.copy(q.scissor),G=q.scissorTest}else C.copy(B).multiplyScalar(F).floor(),U.copy(W).multiplyScalar(F).floor(),G=Q;if(Ae.bindFramebuffer(J.FRAMEBUFFER,he)&&Re.drawBuffers&&ye&&Ae.drawBuffers(q,he),Ae.viewport(C),Ae.scissor(U),Ae.setScissorTest(G),Je){const xt=Ke.get(q.texture);J.framebufferTexture2D(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0,J.TEXTURE_CUBE_MAP_POSITIVE_X+ae,xt.__webglTexture,pe)}else if(ht){const xt=Ke.get(q.texture),Mt=ae||0;J.framebufferTextureLayer(J.FRAMEBUFFER,J.COLOR_ATTACHMENT0,xt.__webglTexture,pe||0,Mt)}D=-1},this.readRenderTargetPixels=function(q,ae,pe,ye,he,Je,ht){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let gt=Ke.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&ht!==void 0&&(gt=gt[ht]),gt){Ae.bindFramebuffer(J.FRAMEBUFFER,gt);try{const xt=q.texture,Mt=xt.format,St=xt.type;if(Mt!==zr&&dt.convert(Mt)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Tt=St===z0&&(me.has("EXT_color_buffer_half_float")||Re.isWebGL2&&me.has("EXT_color_buffer_float"));if(St!==Fl&&dt.convert(St)!==J.getParameter(J.IMPLEMENTATION_COLOR_READ_TYPE)&&!(St===co&&(Re.isWebGL2||me.has("OES_texture_float")||me.has("WEBGL_color_buffer_float")))&&!Tt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ae>=0&&ae<=q.width-ye&&pe>=0&&pe<=q.height-he&&J.readPixels(ae,pe,ye,he,dt.convert(Mt),dt.convert(St),Je)}finally{const xt=I!==null?Ke.get(I).__webglFramebuffer:null;Ae.bindFramebuffer(J.FRAMEBUFFER,xt)}}},this.copyFramebufferToTexture=function(q,ae,pe=0){const ye=Math.pow(2,-pe),he=Math.floor(ae.image.width*ye),Je=Math.floor(ae.image.height*ye);rt.setTexture2D(ae,0),J.copyTexSubImage2D(J.TEXTURE_2D,pe,0,0,q.x,q.y,he,Je),Ae.unbindTexture()},this.copyTextureToTexture=function(q,ae,pe,ye=0){const he=ae.image.width,Je=ae.image.height,ht=dt.convert(pe.format),gt=dt.convert(pe.type);rt.setTexture2D(pe,0),J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,pe.flipY),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,pe.premultiplyAlpha),J.pixelStorei(J.UNPACK_ALIGNMENT,pe.unpackAlignment),ae.isDataTexture?J.texSubImage2D(J.TEXTURE_2D,ye,q.x,q.y,he,Je,ht,gt,ae.image.data):ae.isCompressedTexture?J.compressedTexSubImage2D(J.TEXTURE_2D,ye,q.x,q.y,ae.mipmaps[0].width,ae.mipmaps[0].height,ht,ae.mipmaps[0].data):J.texSubImage2D(J.TEXTURE_2D,ye,q.x,q.y,ht,gt,ae.image),ye===0&&pe.generateMipmaps&&J.generateMipmap(J.TEXTURE_2D),Ae.unbindTexture()},this.copyTextureToTexture3D=function(q,ae,pe,ye,he=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Je=Math.round(q.max.x-q.min.x),ht=Math.round(q.max.y-q.min.y),gt=q.max.z-q.min.z+1,xt=dt.convert(ye.format),Mt=dt.convert(ye.type);let St;if(ye.isData3DTexture)rt.setTexture3D(ye,0),St=J.TEXTURE_3D;else if(ye.isDataArrayTexture||ye.isCompressedArrayTexture)rt.setTexture2DArray(ye,0),St=J.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}J.pixelStorei(J.UNPACK_FLIP_Y_WEBGL,ye.flipY),J.pixelStorei(J.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ye.premultiplyAlpha),J.pixelStorei(J.UNPACK_ALIGNMENT,ye.unpackAlignment);const Tt=J.getParameter(J.UNPACK_ROW_LENGTH),Hn=J.getParameter(J.UNPACK_IMAGE_HEIGHT),Ji=J.getParameter(J.UNPACK_SKIP_PIXELS),In=J.getParameter(J.UNPACK_SKIP_ROWS),Oi=J.getParameter(J.UNPACK_SKIP_IMAGES),bt=pe.isCompressedTexture?pe.mipmaps[he]:pe.image;J.pixelStorei(J.UNPACK_ROW_LENGTH,bt.width),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,bt.height),J.pixelStorei(J.UNPACK_SKIP_PIXELS,q.min.x),J.pixelStorei(J.UNPACK_SKIP_ROWS,q.min.y),J.pixelStorei(J.UNPACK_SKIP_IMAGES,q.min.z),pe.isDataTexture||pe.isData3DTexture?J.texSubImage3D(St,he,ae.x,ae.y,ae.z,Je,ht,gt,xt,Mt,bt.data):ye.isCompressedArrayTexture?J.compressedTexSubImage3D(St,he,ae.x,ae.y,ae.z,Je,ht,gt,xt,bt.data):J.texSubImage3D(St,he,ae.x,ae.y,ae.z,Je,ht,gt,xt,Mt,bt),J.pixelStorei(J.UNPACK_ROW_LENGTH,Tt),J.pixelStorei(J.UNPACK_IMAGE_HEIGHT,Hn),J.pixelStorei(J.UNPACK_SKIP_PIXELS,Ji),J.pixelStorei(J.UNPACK_SKIP_ROWS,In),J.pixelStorei(J.UNPACK_SKIP_IMAGES,Oi),he===0&&ye.generateMipmaps&&J.generateMipmap(St),Ae.unbindTexture()},this.initTexture=function(q){q.isCubeTexture?rt.setTextureCube(q,0):q.isData3DTexture?rt.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?rt.setTexture2DArray(q,0):rt.setTexture2D(q,0),Ae.unbindTexture()},this.resetState=function(){M=0,A=0,I=null,Ae.reset(),lt.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Rl}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===B2?"display-p3":"srgb",t.unpackColorSpace=pn.workingColorSpace===ox?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class cZ extends eU{}cZ.prototype.isWebGL1Renderer=!0;class z2{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new et(e),this.density=t}clone(){return new z2(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class V2{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new et(e),this.near=t,this.far=i}clone(){return new V2(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class tU extends ln{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 wo,this.environmentRotation=new wo,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class H2{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=c1,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=go()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return KQ("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;r<s;r++)this.array[e+r]=t.array[i+r];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=go()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(t,this.stride);return i.setUsage(this.usage),i}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=go()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Xr=new K;class gp{constructor(e,t,i,r=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=i,this.normalized=r}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,i=this.data.count;t<i;t++)Xr.fromBufferAttribute(this,t),Xr.applyMatrix4(e),this.setXYZ(t,Xr.x,Xr.y,Xr.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)Xr.fromBufferAttribute(this,t),Xr.applyNormalMatrix(e),this.setXYZ(t,Xr.x,Xr.y,Xr.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)Xr.fromBufferAttribute(this,t),Xr.transformDirection(e),this.setXYZ(t,Xr.x,Xr.y,Xr.z);return this}getComponent(e,t){let i=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(i=ts(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Dt(i,this.array)),this.data.array[e*this.data.stride+this.offset+t]=i,this}setX(e,t){return this.normalized&&(t=Dt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=Dt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=Dt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=Dt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=ts(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=ts(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=ts(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=ts(t,this.array)),t}setXY(e,t,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=Dt(t,this.array),i=Dt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this}setXYZ(e,t,i,r){return e=e*this.data.stride+this.offset,this.normalized&&(t=Dt(t,this.array),i=Dt(i,this.array),r=Dt(r,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=Dt(t,this.array),i=Dt(i,this.array),r=Dt(r,this.array),s=Dt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=i,this.data.array[e+2]=r,this.data.array[e+3]=s,this}clone(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return new wn(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new gp(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let i=0;i<this.count;i++){const r=i*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[r+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class nU extends jr{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new et(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}let Em;const cv=new K,Sm=new K,Am=new K,Mm=new Me,uv=new Me,uZ=new wt,k_=new K,hv=new K,F_=new K,eH=new Me,GC=new Me,tH=new Me;class hZ extends ln{constructor(e=new nU){if(super(),this.isSprite=!0,this.type="Sprite",Em===void 0){Em=new Ft;const t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new H2(t,5);Em.setIndex([0,1,2,0,2,3]),Em.setAttribute("position",new gp(i,3,0,!1)),Em.setAttribute("uv",new gp(i,2,3,!1))}this.geometry=Em,this.material=e,this.center=new Me(.5,.5)}raycast(e,t){e.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Sm.setFromMatrixScale(this.matrixWorld),uZ.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Am.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Sm.multiplyScalar(-Am.z);const i=this.material.rotation;let r,s;i!==0&&(s=Math.cos(i),r=Math.sin(i));const o=this.center;z_(k_.set(-.5,-.5,0),Am,o,Sm,r,s),z_(hv.set(.5,-.5,0),Am,o,Sm,r,s),z_(F_.set(.5,.5,0),Am,o,Sm,r,s),eH.set(0,0),GC.set(1,0),tH.set(1,1);let a=e.ray.intersectTriangle(k_,hv,F_,!1,cv);if(a===null&&(z_(hv.set(-.5,.5,0),Am,o,Sm,r,s),GC.set(0,1),a=e.ray.intersectTriangle(k_,F_,hv,!1,cv),a===null))return;const l=e.ray.origin.distanceTo(cv);l<e.near||l>e.far||t.push({distance:l,point:cv.clone(),uv:uo.getInterpolation(cv,k_,hv,F_,eH,GC,tH,new Me),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function z_(n,e,t,i,r,s){Mm.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(uv.x=s*Mm.x-r*Mm.y,uv.y=r*Mm.x+s*Mm.y):uv.copy(Mm),n.copy(e),n.x+=uv.x,n.y+=uv.y,n.applyMatrix4(uZ)}const V_=new K,nH=new K;class fZ extends ln{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let i=0,r=t.length;i<r;i++){const s=t[i];this.addLevel(s.object.clone(),s.distance,s.hysteresis)}return this.autoUpdate=e.autoUpdate,this}addLevel(e,t=0,i=0){t=Math.abs(t);const r=this.levels;let s;for(s=0;s<r.length&&!(t<r[s].distance);s++);return r.splice(s,0,{distance:t,hysteresis:i,object:e}),this.add(e),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(e){const t=this.levels;if(t.length>0){let i,r;for(i=1,r=t.length;i<r;i++){let s=t[i].distance;if(t[i].object.visible&&(s-=s*t[i].hysteresis),e<s)break}return t[i-1].object}return null}raycast(e,t){if(this.levels.length>0){V_.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(V_);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){V_.setFromMatrixPosition(e.matrixWorld),nH.setFromMatrixPosition(this.matrixWorld);const i=V_.distanceTo(nH)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r<s;r++){let o=t[r].distance;if(t[r].object.visible&&(o-=o*t[r].hysteresis),i>=o)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;r<s;r++)t[r].object.visible=!1}}toJSON(e){const t=super.toJSON(e);this.autoUpdate===!1&&(t.object.autoUpdate=!1),t.object.levels=[];const i=this.levels;for(let r=0,s=i.length;r<s;r++){const o=i[r];t.object.levels.push({object:o.object.uuid,distance:o.distance,hysteresis:o.hysteresis})}return t}}const iH=new K,rH=new mn,sH=new mn,nUe=new K,oH=new wt,H_=new K,jC=new $r,aH=new wt,WC=new iy;class dZ extends Ai{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=uN,this.bindMatrix=new wt,this.bindMatrixInverse=new wt,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new us),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,H_),this.boundingBox.expandByPoint(H_)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new $r),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let i=0;i<t.count;i++)this.getVertexPosition(i,H_),this.boundingSphere.expandByPoint(H_)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const i=this.material,r=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),jC.copy(this.boundingSphere),jC.applyMatrix4(r),e.ray.intersectsSphere(jC)!==!1&&(aH.copy(r).invert(),WC.copy(e.ray).applyMatrix4(aH),!(this.boundingBox!==null&&WC.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,WC)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new mn,t=this.geometry.attributes.skinWeight;for(let i=0,r=t.count;i<r;i++){e.fromBufferAttribute(t,i);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(i,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===uN?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===AQ?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const i=this.skeleton,r=this.geometry;rH.fromBufferAttribute(r.attributes.skinIndex,e),sH.fromBufferAttribute(r.attributes.skinWeight,e),iH.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const o=sH.getComponent(s);if(o!==0){const a=rH.getComponent(s);oH.multiplyMatrices(i.bones[a].matrixWorld,i.boneInverses[a]),t.addScaledVector(nUe.copy(iH).applyMatrix4(oH),o)}}return t.applyMatrix4(this.bindMatrixInverse)}}class iU extends ln{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Xc extends zn{constructor(e=null,t=1,i=1,r,s,o,a,l,c=hi,u=hi,h,f){super(null,o,a,l,c,u,r,s,h,f),this.isDataTexture=!0,this.image={data:e,width:t,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const lH=new wt,iUe=new wt;class $2{constructor(e=[],t=[]){this.uuid=go(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let i=0,r=this.bones.length;i<r;i++)this.boneInverses.push(new wt)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const i=new wt;this.bones[e]&&i.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&i.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const i=this.bones[e];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const e=this.bones,t=this.boneInverses,i=this.boneMatrices,r=this.boneTexture;for(let s=0,o=e.length;s<o;s++){const a=e[s]?e[s].matrixWorld:iUe;lH.multiplyMatrices(a,t[s]),lH.toArray(i,s*16)}r!==null&&(r.needsUpdate=!0)}clone(){return new $2(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const i=new Xc(t,e,e,zr,co);return i.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=i,this}getBoneByName(e){for(let t=0,i=this.bones.length;t<i;t++){const r=this.bones[t];if(r.name===e)return r}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let i=0,r=e.bones.length;i<r;i++){const s=e.bones[i];let o=t[s];o===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",s),o=new iU),this.bones.push(o),this.boneInverses.push(new wt().fromArray(e.boneInverses[i]))}return this.init(),this}toJSON(){const e={metadata:{version:4.6,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,i=this.boneInverses;for(let r=0,s=t.length;r<s;r++){const o=t[r];e.bones.push(o.uuid);const a=i[r];e.boneInverses.push(a.toArray())}return e}}class $0 extends wn{constructor(e,t,i,r=1){super(e,t,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=r}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const Tm=new wt,cH=new wt,$_=[],uH=new us,rUe=new wt,fv=new Ai,dv=new $r;class pZ extends Ai{constructor(e,t,i){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new $0(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let r=0;r<i;r++)this.setMatrixAt(r,rUe)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new us),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Tm),uH.copy(e.boundingBox).applyMatrix4(Tm),this.boundingBox.union(uH)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new $r),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<t;i++)this.getMatrixAt(i,Tm),dv.copy(e.boundingSphere).applyMatrix4(Tm),this.boundingSphere.union(dv)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const i=t.morphTargetInfluences,r=this.morphTexture.source.data.data,s=i.length+1,o=e*s+1;for(let a=0;a<i.length;a++)i[a]=r[o+a]}raycast(e,t){const i=this.matrixWorld,r=this.count;if(fv.geometry=this.geometry,fv.material=this.material,fv.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),dv.copy(this.boundingSphere),dv.applyMatrix4(i),e.ray.intersectsSphere(dv)!==!1))for(let s=0;s<r;s++){this.getMatrixAt(s,Tm),cH.multiplyMatrices(i,Tm),fv.matrixWorld=cH,fv.raycast(e,$_);for(let o=0,a=$_.length;o<a;o++){const l=$_[o];l.instanceId=s,l.object=this,t.push(l)}$_.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new $0(new Float32Array(this.instanceMatrix.count*3),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const i=t.morphTargetInfluences,r=i.length+1;this.morphTexture===null&&(this.morphTexture=new Xc(new Float32Array(r*this.count),r,this.count,kL,co));const s=this.morphTexture.source.data.data;let o=0;for(let c=0;c<i.length;c++)o+=i[c];const a=this.geometry.morphTargetsRelative?1:1-o,l=r*e;s[l]=a,s.set(i,l+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}function sUe(n,e){return n.z-e.z}function oUe(n,e){return e.z-n.z}class aUe{constructor(){this.index=0,this.pool=[],this.list=[]}push(e,t){const i=this.pool,r=this.list;this.index>=i.length&&i.push({start:-1,count:-1,z:-1});const s=i[this.index];r.push(s),this.index++,s.start=e.start,s.count=e.count,s.z=t}reset(){this.list.length=0,this.index=0}}const Pm="batchId",Wu=new wt,hH=new wt,lUe=new wt,fH=new wt,qC=new cx,G_=new us,Uf=new $r,pv=new K,KC=new aUe,Nr=new Ai,j_=[];function cUe(n,e,t=0){const i=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const r=n.count;for(let s=0;s<r;s++)for(let o=0;o<i;o++)e.setComponent(s+t,o,n.getComponent(s,o))}else e.array.set(n.array,t*i);e.needsUpdate=!0}class mZ extends Ai{get maxGeometryCount(){return this._maxGeometryCount}constructor(e,t,i=t*2,r){super(new Ft,r),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._drawRanges=[],this._reservedRanges=[],this._visibility=[],this._active=[],this._bounds=[],this._maxGeometryCount=e,this._maxVertexCount=t,this._maxIndexCount=i,this._geometryInitialized=!1,this._geometryCount=0,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._visibilityChanged=!0,this._matricesTexture=null,this._initMatricesTexture()}_initMatricesTexture(){let e=Math.sqrt(this._maxGeometryCount*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4),i=new Xc(t,e,e,zr,co);this._matricesTexture=i}_initializeGeometry(e){const t=this.geometry,i=this._maxVertexCount,r=this._maxGeometryCount,s=this._maxIndexCount;if(this._geometryInitialized===!1){for(const a in e.attributes){const l=e.getAttribute(a),{array:c,itemSize:u,normalized:h}=l,f=new c.constructor(i*u),m=new l.constructor(f,u,h);m.setUsage(l.usage),t.setAttribute(a,m)}if(e.getIndex()!==null){const a=i>65536?new Uint32Array(s):new Uint16Array(s);t.setIndex(new wn(a,1))}const o=r>65536?new Uint32Array(i):new Uint16Array(i);t.setAttribute(Pm,new wn(o,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(Pm))throw new Error(`BatchedMesh: Geometry cannot use attribute "${Pm}"`);const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in t.attributes){if(i===Pm)continue;if(!e.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=t.getAttribute(i);if(r.itemSize!==s.itemSize||r.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new us);const e=this._geometryCount,t=this.boundingBox,i=this._active;t.makeEmpty();for(let r=0;r<e;r++)i[r]!==!1&&(this.getMatrixAt(r,Wu),this.getBoundingBoxAt(r,G_).applyMatrix4(Wu),t.union(G_))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new $r);const e=this._geometryCount,t=this.boundingSphere,i=this._active;t.makeEmpty();for(let r=0;r<e;r++)i[r]!==!1&&(this.getMatrixAt(r,Wu),this.getBoundingSphereAt(r,Uf).applyMatrix4(Wu),t.union(Uf))}addGeometry(e,t=-1,i=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._geometryCount>=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const r={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),t===-1?r.vertexCount=e.getAttribute("position").count:r.vertexCount=t,s===null?r.vertexStart=0:r.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),u=c!==null;if(u&&(i===-1?r.indexCount=c.count:r.indexCount=i,s===null?r.indexStart=0:r.indexStart=s.indexStart+s.indexCount),r.indexStart!==-1&&r.indexStart+r.indexCount>this._maxIndexCount||r.vertexStart+r.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._visibility,f=this._active,m=this._matricesTexture,g=this._matricesTexture.image.data;h.push(!0),f.push(!0);const v=this._geometryCount;this._geometryCount++,lUe.toArray(g,v*16),m.needsUpdate=!0,o.push(r),a.push({start:u?r.indexStart:r.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new us,sphereInitialized:!1,sphere:new $r});const w=this.geometry.getAttribute(Pm);for(let y=0;y<r.vertexCount;y++)w.setX(r.vertexStart+y,v);return w.needsUpdate=!0,this.setGeometryAt(v,e),v}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(r&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const m in i.attributes){if(m===Pm)continue;const g=t.getAttribute(m),v=i.getAttribute(m);cUe(g,v,l);const w=g.itemSize;for(let y=g.count,_=c;y<_;y++){const x=l+y;for(let S=0;S<w;S++)v.setComponent(x,S,0)}v.needsUpdate=!0}if(r){const m=a.indexStart;for(let g=0;g<o.count;g++)s.setX(m+g,l+o.getX(g));for(let g=o.count,v=a.indexCount;g<v;g++)s.setX(m+g,l);s.needsUpdate=!0}const u=this._bounds[e];t.boundingBox!==null?(u.box.copy(t.boundingBox),u.boxInitialized=!0):u.boxInitialized=!1,t.boundingSphere!==null?(u.sphere.copy(t.boundingSphere),u.sphereInitialized=!0):u.sphereInitialized=!1;const h=this._drawRanges[e],f=t.getAttribute("position");return h.count=r?o.count:f.count,this._visibilityChanged=!0,e}deleteGeometry(e){const t=this._active;return e>=t.length||t[e]===!1?this:(t[e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(this._active[e]===!1)return null;const r=this._bounds[e],s=r.box,o=this.geometry;if(r.boxInitialized===!1){s.makeEmpty();const a=o.index,l=o.attributes.position,c=this._drawRanges[e];for(let u=c.start,h=c.start+c.count;u<h;u++){let f=u;a&&(f=a.getX(f)),s.expandByPoint(pv.fromBufferAttribute(l,f))}r.boxInitialized=!0}return t.copy(s),t}getBoundingSphereAt(e,t){if(this._active[e]===!1)return null;const r=this._bounds[e],s=r.sphere,o=this.geometry;if(r.sphereInitialized===!1){s.makeEmpty(),this.getBoundingBoxAt(e,G_),G_.getCenter(s.center);const a=o.index,l=o.attributes.position,c=this._drawRanges[e];let u=0;for(let h=c.start,f=c.start+c.count;h<f;h++){let m=h;a&&(m=a.getX(m)),pv.fromBufferAttribute(l,m),u=Math.max(u,s.center.distanceToSquared(pv))}s.radius=Math.sqrt(u),r.sphereInitialized=!0}return t.copy(s),t}setMatrixAt(e,t){const i=this._active,r=this._matricesTexture,s=this._matricesTexture.image.data,o=this._geometryCount;return e>=o||i[e]===!1?this:(t.toArray(s,e*16),r.needsUpdate=!0,this)}getMatrixAt(e,t){const i=this._active,r=this._matricesTexture.image.data,s=this._geometryCount;return e>=s||i[e]===!1?null:t.fromArray(r,e*16)}setVisibleAt(e,t){const i=this._visibility,r=this._active,s=this._geometryCount;return e>=s||r[e]===!1||i[e]===t?this:(i[e]=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._visibility,i=this._active,r=this._geometryCount;return e>=r||i[e]===!1?!1:t[e]}raycast(e,t){const i=this._visibility,r=this._active,s=this._drawRanges,o=this._geometryCount,a=this.matrixWorld,l=this.geometry;Nr.material=this.material,Nr.geometry.index=l.index,Nr.geometry.attributes=l.attributes,Nr.geometry.boundingBox===null&&(Nr.geometry.boundingBox=new us),Nr.geometry.boundingSphere===null&&(Nr.geometry.boundingSphere=new $r);for(let c=0;c<o;c++){if(!i[c]||!r[c])continue;const u=s[c];Nr.geometry.setDrawRange(u.start,u.count),this.getMatrixAt(c,Nr.matrixWorld).premultiply(a),this.getBoundingBoxAt(c,Nr.geometry.boundingBox),this.getBoundingSphereAt(c,Nr.geometry.boundingSphere),Nr.raycast(e,j_);for(let h=0,f=j_.length;h<f;h++){const m=j_[h];m.object=this,m.batchId=c,t.push(m)}j_.length=0}Nr.material=null,Nr.geometry.index=null,Nr.geometry.attributes={},Nr.geometry.setDrawRange(0,1/0)}copy(e){return super.copy(e),this.geometry=e.geometry.clone(),this.perObjectFrustumCulled=e.perObjectFrustumCulled,this.sortObjects=e.sortObjects,this.boundingBox=e.boundingBox!==null?e.boundingBox.clone():null,this.boundingSphere=e.boundingSphere!==null?e.boundingSphere.clone():null,this._drawRanges=e._drawRanges.map(t=>({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._visibility=e._visibility.slice(),this._active=e._active.slice(),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxGeometryCount=e._maxGeometryCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(e,t,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._active,c=this._visibility,u=this._multiDrawStarts,h=this._multiDrawCounts,f=this._drawRanges,m=this.perObjectFrustumCulled;m&&(fH.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),qC.setFromProjectionMatrix(fH,e.coordinateSystem));let g=0;if(this.sortObjects){hH.copy(this.matrixWorld).invert(),pv.setFromMatrixPosition(i.matrixWorld).applyMatrix4(hH);for(let y=0,_=c.length;y<_;y++)if(c[y]&&l[y]){this.getMatrixAt(y,Wu),this.getBoundingSphereAt(y,Uf).applyMatrix4(Wu);let x=!1;if(m&&(x=!qC.intersectsSphere(Uf)),!x){const S=pv.distanceTo(Uf.center);KC.push(f[y],S)}}const v=KC.list,w=this.customSort;w===null?v.sort(s.transparent?oUe:sUe):w.call(this,v,i);for(let y=0,_=v.length;y<_;y++){const x=v[y];u[g]=x.start*a,h[g]=x.count,g++}KC.reset()}else for(let v=0,w=c.length;v<w;v++)if(c[v]&&l[v]){let y=!1;if(m&&(this.getMatrixAt(v,Wu),this.getBoundingSphereAt(v,Uf).applyMatrix4(Wu),y=!qC.intersectsSphere(Uf)),!y){const _=f[v];u[g]=_.start*a,h[g]=_.count,g++}}this._multiDrawCount=g,this._visibilityChanged=!1}onBeforeShadow(e,t,i,r,s,o){this.onBeforeRender(e,null,r,s,o)}}class ds extends jr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new et(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const dH=new K,pH=new K,mH=new wt,XC=new iy,W_=new $r;class Qh extends ln{constructor(e=new Ft,t=new ds){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[0];for(let r=1,s=t.count;r<s;r++)dH.fromBufferAttribute(t,r-1),pH.fromBufferAttribute(t,r),i[r]=i[r-1],i[r]+=dH.distanceTo(pH);e.setAttribute("lineDistance",new at(i,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Line.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),W_.copy(i.boundingSphere),W_.applyMatrix4(r),W_.radius+=s,e.ray.intersectsSphere(W_)===!1)return;mH.copy(r).invert(),XC.copy(e.ray).applyMatrix4(mH);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=new K,u=new K,h=new K,f=new K,m=this.isLineSegments?2:1,g=i.index,w=i.attributes.position;if(g!==null){const y=Math.max(0,o.start),_=Math.min(g.count,o.start+o.count);for(let x=y,S=_-1;x<S;x+=m){const M=g.getX(x),A=g.getX(x+1);if(c.fromBufferAttribute(w,M),u.fromBufferAttribute(w,A),XC.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const D=e.ray.origin.distanceTo(f);D<e.near||D>e.far||t.push({distance:D,point:h.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const y=Math.max(0,o.start),_=Math.min(w.count,o.start+o.count);for(let x=y,S=_-1;x<S;x+=m){if(c.fromBufferAttribute(w,x),u.fromBufferAttribute(w,x+1),XC.distanceSqToSegment(c,u,f,h)>l)continue;f.applyMatrix4(this.matrixWorld);const A=e.ray.origin.distanceTo(f);A<e.near||A>e.far||t.push({distance:A,point:h.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}const gH=new K,yH=new K;class $l extends Qh{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,i=[];for(let r=0,s=t.count;r<s;r+=2)gH.fromBufferAttribute(t,r),yH.fromBufferAttribute(t,r+1),i[r]=r===0?0:i[r-1],i[r+1]=i[r]+gH.distanceTo(yH);e.setAttribute("lineDistance",new at(i,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class gZ extends Qh{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class rU extends jr{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new et(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const vH=new wt,VN=new iy,q_=new $r,K_=new K;class yZ extends ln{constructor(e=new Ft,t=new rU){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const i=this.geometry,r=this.matrixWorld,s=e.params.Points.threshold,o=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),q_.copy(i.boundingSphere),q_.applyMatrix4(r),q_.radius+=s,e.ray.intersectsSphere(q_)===!1)return;vH.copy(r).invert(),VN.copy(e.ray).applyMatrix4(vH);const a=s/((this.scale.x+this.scale.y+this.scale.z)/3),l=a*a,c=i.index,h=i.attributes.position;if(c!==null){const f=Math.max(0,o.start),m=Math.min(c.count,o.start+o.count);for(let g=f,v=m;g<v;g++){const w=c.getX(g);K_.fromBufferAttribute(h,w),wH(K_,w,l,r,e,t,this)}}else{const f=Math.max(0,o.start),m=Math.min(h.count,o.start+o.count);for(let g=f,v=m;g<v;g++)K_.fromBufferAttribute(h,g),wH(K_,g,l,r,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){const a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}}function wH(n,e,t,i,r,s,o){const a=VN.distanceSqToPoint(n);if(a<t){const l=new K;VN.closestPointToPoint(n,l),l.applyMatrix4(i);const c=r.ray.origin.distanceTo(l);if(c<r.near||c>r.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class uUe extends zn{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:On,this.magFilter=s!==void 0?s:On,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class hUe extends zn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=hi,this.minFilter=hi,this.generateMipmaps=!1,this.needsUpdate=!0}}class G2 extends zn{constructor(e,t,i,r,s,o,a,l,c,u,h,f){super(null,o,a,l,c,u,r,s,h,f),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class fUe extends G2{constructor(e,t,i,r,s,o){super(e,t,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Fr}}class dUe extends G2{constructor(e,t,i){super(void 0,e[0].width,e[0].height,t,i,au),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class pUe extends zn{constructor(e,t,i,r,s,o,a,l,c){super(e,t,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class ja{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let o;t?o=t:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const u=i[r],f=i[r+1]-u,m=(o-u)/f;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=t||(o.isVector2?new Me:new K);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new K,r=[],s=[],o=[],a=new K,l=new wt;for(let m=0;m<=e;m++){const g=m/e;r[m]=this.getTangentAt(g,new K)}s[0]=new K,o[0]=new K;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),h=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),f<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(r[m-1],r[m]),a.length()>Number.EPSILON){a.normalize();const g=Math.acos(ii(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(a,g))}o[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(ii(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let g=1;g<=e;g++)s[g].applyMatrix4(l.makeRotationAxis(r[g],m*g)),o[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class j2 extends ja{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t=new Me){const i=t,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);const a=this.aStartAngle+e*s;let l=this.aX+this.xRadius*Math.cos(a),c=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){const u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=l-this.aX,m=c-this.aY;l=f*u-m*h+this.aX,c=f*h+m*u+this.aY}return i.set(l,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class vZ extends j2{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}}function sU(){let n=0,e=0,t=0,i=0;function r(s,o,a,l){n=s,e=a,t=-3*s+3*o-2*a-l,i=2*s-2*o+a+l}return{initCatmullRom:function(s,o,a,l,c){r(o,a,c*(a-s),c*(l-o))},initNonuniformCatmullRom:function(s,o,a,l,c,u,h){let f=(o-s)/c-(a-s)/(c+u)+(a-o)/u,m=(a-o)/u-(l-o)/(u+h)+(l-a)/h;f*=u,m*=u,r(o,a,f,m)},calc:function(s){const o=s*s,a=o*s;return n+e*s+t*o+i*a}}}const X_=new K,YC=new sU,QC=new sU,ZC=new sU;class wZ extends ja{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new K){const i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e;let a=Math.floor(o),l=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,u;this.closed||a>0?c=r[(a-1)%s]:(X_.subVectors(r[0],r[1]).add(r[0]),c=X_);const h=r[a%s],f=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(X_.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=X_),this.curveType==="centripetal"||this.curveType==="chordal"){const m=this.curveType==="chordal"?.5:.25;let g=Math.pow(c.distanceToSquared(h),m),v=Math.pow(h.distanceToSquared(f),m),w=Math.pow(f.distanceToSquared(u),m);v<1e-4&&(v=1),g<1e-4&&(g=v),w<1e-4&&(w=v),YC.initNonuniformCatmullRom(c.x,h.x,f.x,u.x,g,v,w),QC.initNonuniformCatmullRom(c.y,h.y,f.y,u.y,g,v,w),ZC.initNonuniformCatmullRom(c.z,h.z,f.z,u.z,g,v,w)}else this.curveType==="catmullrom"&&(YC.initCatmullRom(c.x,h.x,f.x,u.x,this.tension),QC.initCatmullRom(c.y,h.y,f.y,u.y,this.tension),ZC.initCatmullRom(c.z,h.z,f.z,u.z,this.tension));return i.set(YC.calc(l),QC.calc(l),ZC.calc(l)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new K().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function xH(n,e,t,i,r){const s=(i-e)*.5,o=(r-t)*.5,a=n*n,l=n*a;return(2*t-2*i+s+o)*l+(-3*t+3*i-2*s-o)*a+s*n+t}function mUe(n,e){const t=1-n;return t*t*e}function gUe(n,e){return 2*(1-n)*n*e}function yUe(n,e){return n*n*e}function aw(n,e,t,i){return mUe(n,e)+gUe(n,t)+yUe(n,i)}function vUe(n,e){const t=1-n;return t*t*t*e}function wUe(n,e){const t=1-n;return 3*t*t*n*e}function xUe(n,e){return 3*(1-n)*n*n*e}function bUe(n,e){return n*n*n*e}function lw(n,e,t,i,r){return vUe(n,e)+wUe(n,t)+xUe(n,i)+bUe(n,r)}class oU extends ja{constructor(e=new Me,t=new Me,i=new Me,r=new Me){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new Me){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(lw(e,r.x,s.x,o.x,a.x),lw(e,r.y,s.y,o.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class xZ extends ja{constructor(e=new K,t=new K,i=new K,r=new K){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new K){const i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(lw(e,r.x,s.x,o.x,a.x),lw(e,r.y,s.y,o.y,a.y),lw(e,r.z,s.z,o.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class aU extends ja{constructor(e=new Me,t=new Me){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new Me){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}
vendor: 4,414 bytes, line 4006
4006getTangent(e,t=new Me){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class bZ extends ja{constructor(e=new K,t=new K){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new K){const i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new K){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class lU extends ja{constructor(e=new Me,t=new Me,i=new Me){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new Me){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(aw(e,r.x,s.x,o.x),aw(e,r.y,s.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class cU extends ja{constructor(e=new K,t=new K,i=new K){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new K){const i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(aw(e,r.x,s.x,o.x),aw(e,r.y,s.y,o.y),aw(e,r.z,s.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class uU extends ja{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new Me){const i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,l=r[o===0?o:o-1],c=r[o],u=r[o>r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(xH(a,l.x,c.x,u.x,h.x),xH(a,l.y,c.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){const r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){const r=e.points[t];this.points.push(new Me().fromArray(r))}return this}}var gA=Object.freeze({__proto__:null,ArcCurve:vZ,CatmullRomCurve3:wZ,CubicBezierCurve:oU,CubicBezierCurve3:xZ,EllipseCurve:j2,LineCurve:aU,LineCurve3:bZ,QuadraticBezierCurve:lU,QuadraticBezierCurve3:cU,SplineCurve:uU});class _Z extends ja{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new gA[i](t,e))}return this}getPoint(e,t){const i=e*this.getLength(),r=this.getCurveLengths();let s=0;for(;s<r.length;){if(r[s]>=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let i;for(let r=0,s=this.curves;r<s.length;r++){const o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isS
vendor: 6,555 bytes, line 4006
4006plineCurve?e*o.points.length:e,l=o.getPoints(a);for(let c=0;c<l.length;c++){const u=l[c];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){const r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){const r=e.curves[t];this.curves.push(new gA[r.type]().fromJSON(r))}return this}}class f1 extends _Z{constructor(e){super(),this.type="Path",this.currentPoint=new Me,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const i=new aU(this.currentPoint.clone(),new Me(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){const s=new lU(this.currentPoint.clone(),new Me(e,t),new Me(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){const a=new oU(this.currentPoint.clone(),new Me(e,t),new Me(i,r),new Me(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),i=new uU(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){const a=this.currentPoint.x,l=this.currentPoint.y;return this.absarc(e+a,t+l,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,l){const c=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+c,t+u,i,r,s,o,a,l),this}absellipse(e,t,i,r,s,o,a,l){const c=new j2(e,t,i,r,s,o,a,l);if(this.curves.length>0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class hx extends Ft{constructor(e=[new Me(0,-.5),new Me(.5,0),new Me(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=ii(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new K,f=new Me,m=new K,g=new K,v=new K;let w=0,y=0;for(let _=0;_<=e.length-1;_++)switch(_){case 0:w=e[_+1].x-e[_].x,y=e[_+1].y-e[_].y,m.x=y*1,m.y=-w,m.z=y*0,v.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(v.x,v.y,v.z);break;default:w=e[_+1].x-e[_].x,y=e[_+1].y-e[_].y,m.x=y*1,m.y=-w,m.z=y*0,g.copy(m),m.x+=v.x,m.y+=v.y,m.z+=v.z,m.normalize(),l.push(m.x,m.y,m.z),v.copy(g)}for(let _=0;_<=t;_++){const x=i+_*u*r,S=Math.sin(x),M=Math.cos(x);for(let A=0;A<=e.length-1;A++){h.x=e[A].x*S,h.y=e[A].y,h.z=e[A].x*M,o.push(h.x,h.y,h.z),f.x=_/t,f.y=A/(e.length-1),a.push(f.x,f.y);const I=l[3*A+0]*S,D=l[3*A+1],k=l[3*A+0]*M;c.push(I,D,k)}}for(let _=0;_<t;_++)for(let x=0;x<e.length-1;x++){const S=x+_*e.length,M=S,A=S+e.length,I=S+e.length+1,D=S+1;s.push(M,A,D),s.push(I,D,A)}this.setIndex(s),this.setAttribute("position",new at(o,3)),this.setAttribute("uv",new at(a,2)),this.setAttribute("normal",new at(c,3))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new hx(e.points,e.segments,e.phiStart,e.phiLength)}}class W2 extends hx{constructor(e=1,t=1,i=4,r=8){const s=new f1;s.absarc(0,-t/2,e,Math.PI*1.5,0),s.absarc(0,t/2,e,0,Math.PI*.5),super(s.getPoints(i),r),this.type="CapsuleGeometry",this.parameters={radius:e,length:t,capSegments:i,radialSegments:r}}static fromJSON(e){return new W2(e.radius,e.length,e.capSegments,e.radialSegments)}}class q2 extends Ft{constructor(e=1,t=32,i=0,r=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:i,thetaLength:r},t=Math.max(3,t);const s=[],o=[],a=[],l=[],c=new K,u=new Me;o.push(0,0,0),a.push(0,0,1),l.push(.5,.5);for(let h=0,f=3;h<=t;h++,f+=3){const m=i+h/t*r;c.x=e*Math.cos(m),c.y=e*Math.sin(m),o.push(c.x,c.y,c.z),a.push(0,0,1),u.x=(o[f]/e+1)/2,u.y=(o[f+1]/e+1)/2,l.push(u.x,u.y)}for(let h=1;h<=t;h++)s.push(h,h+1,0);this.setIndex(s),this.setAttribute("position",new at(o,3)),this.setAttribute("normal",new at(a,3)),this.setAttribute("uv",new at(l,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new q2(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class oy extends Ft{constructor(e=1,t=1,i=1,r=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:i,radialSegments:r,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;r=Math.floor(r),s=Math.floor(s);const u=[],h=[],f=[],m=[];let g=0;const v=[],w=i/2;let y=0;_(),o===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new at(h,3)),this.setAttribute("normal",new at(f,3)),this.setAttribute("uv",new at(m,2));function _(){const S=new K,M=new K;let A=0;const I=(t-e)/i;for(let D=0;D<=s;D++){const k=[],C=D/s,U=C*(t-e)+e;for(let G=0;G<=r;G++){const H=G/r,z=H*l+a,P=Math.sin(z),R=Math.cos(z);M.x=U*P,M.y=-C*i+w,M.z=U*R,h.push(M.x,M.y,M.z),S.set(P,I,R).normalize(),f.push(S.x,S.y,S.z),m.push(H,1-C),k.push(g++)}v.push(k)}for(let D=0;D<r;D++)for(let k=0;k<s;k++){const C=v[k][D],U=v[k+1][D],G=v[k+1][D+1],H=v[k][D+1];u.push(C,U,H),u.push(U,G,H),A+=6}c.addGroup(y,A,0),y+=A}function x(S){const M=g,A=new Me,I=new K;let D=0;const k=S===!0?e:t,C=S===!0?1:-1;for(let G=1;G<=r;G++)h.push(0,w*C,0),f.push(0,C,0),m.push(.5,.5),g++;const U=g;for(let G=0;G<=r;G++){const z=G/r*l+a,P=Math.cos(z),R=Math.sin(z);I.x=k*R,I.y=w*C,I.z=k*P,h.push(I.x,I.y,I.z),f.push(0,C,0),A.x=P*.5+.5,A.y=R*.5*C+.5,m.push(A.x,A.y),g++}for(let G=0;G<r;G++){const H=M+G,z=U+G;S===!0?u.push(z,z+1,H):u.push(z+1,z,H),D+=3}c.addGroup(y,D,S===!0?1:2),y+=D}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new oy(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class K2 extends oy{constructor(e=1,t=1,i=32,r=1,s=!1,o=0,a=Math.PI*2){super(0,e,t,i,r,s,o,a),this.type="C
4006oneGeometry",this.parameters={radius:e,height:t,radialSegments:i,heightSegments:r,openEnded:s,thetaStart:o,thetaLength:a}}static fromJSON(e){return new K2(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class uf extends Ft{constructor(e=[],t=[],i=1,r=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:i,detail:r};const s=[],o=[];a(r),c(i),u(),this.setAttribute("position",new at(s,3)),this.setAttribute("normal",new at(s.slice(),3)),this.setAttribute("uv",new at(o,2)),r===0?this.computeVertexNormals():this.normalizeNormals();function a(_){const x=new K,S=new K,M=new K;for(let A=0;A<t.length;A+=3)m(t[A+0],x),m(t[A+1],S),m(t[A+2],M),l(x,S,M,_)}function l(_,x,S,M){const A=M+1,I=[];for(let D=0;D<=A;D++){I[D]=[];const k=_.clone().lerp(S,D/A),C=x.clone().lerp(S,D/A),U=A-D;for(let G=0;G<=U;G++)G===0&&D===A?I[D][G]=k:I[D][G]=k.clone().lerp(C,G/U)}for(let D=0;D<A;D++)for(let k=0;k<2*(A-D)-1;k++){const C=Math.floor(k/2);k%2===0?(f(I[D][C+1]),f(I[D+1][C]),f(I[D][C])):(f(I[D][C+1]),f(I[D+1][C+1]),f(I[D+1][C]))}}function c(_){const x=new K;for(let S=0;S<s.length;S+=3)x.x=s[S+0],x.y=s[S+1],x.z=s[S+2],x.normalize().multiplyScalar(_),s[S+0]=x.x,s[S+1]=x.y,s[S+2]=x.z}function u(){const _=new K;for(let x=0;x<s.length;x+=3){_.x=s[x+0],_.y=s[x+1],_.z=s[x+2];const S=w(_)/2/Math.PI+.5,M=y(_)/Math.PI+.5;o.push(S,1-M)}g(),h()}function h(){for(let _=0;_<o.length;_+=6){const x=o[_+0],S=o[_+2],M=o[_+4],A=Math.max(x,S,M),I=Math.min(x,S,M);A>.9&&I<.1&&(x<.2&&(o[_+0]+=1),S<.2&&(o[_+2]+=1),M<.2&&(o[_+4]+=1))}}function f(_){s.push(_.x,_.y,_.z)}function m(_,x){const S=_*3;x.x=e[S+0],x.y=e[S+1],x.z=e[S+2]}function g(){const _=new K,x=new K,S=new K,M=new K,A=new Me,I=new Me,D=new Me;for(let k=0,C=0;k<s.length;k+=9,C+=6){_.set(s[k+0],s[k+1],s[k+2]),x.set(s[k+3],s[k+4],s[k+5]),S.set(s[k+6],s[k+7],s[k+8]),A.set(o[C+0],o[C+1]),I.set(o[C+2],o[C+3]),D.set(o[C+4],o[C+5]),M.copy(_).add(x).add(S).divideScalar(3);const U=w(M);v(A,C+0,_,U),v(I,C+2,x,U),v(D,C+4,S,U)}}function v(_,x,S,M){M<0&&_.x===1&&(o[x]=_.x-1),S.x===0&&S.z===0&&(o[x]=M/2/Math.PI+.5)}function w(_){return Math.atan2(_.z,-_.x)}function y(_){return Math.atan2(-_.y,Math.sqrt(_.x*_.x+_.z*_.z))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new uf(e.vertices,e.indices,e.radius,e.details)}}class X2 extends uf{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=1/i,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-r,-i,0,-r,i,0,r,-i,0,r,i,-r,-i,0,-r,i,0,r,-i,0,r,i,0,-i,0,-r,i,0,-r,-i,0,r,i,0,r],o=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,
vendor: 127,273 bytes, line 4006
400619,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(s,o,e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new X2(e.radius,e.detail)}}const Y_=new K,Q_=new K,JC=new K,Z_=new uo;class EZ extends Ft{constructor(e=null,t=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},e!==null){const r=Math.pow(10,4),s=Math.cos(Qd*t),o=e.getIndex(),a=e.getAttribute("position"),l=o?o.count:a.count,c=[0,0,0],u=["a","b","c"],h=new Array(3),f={},m=[];for(let g=0;g<l;g+=3){o?(c[0]=o.getX(g),c[1]=o.getX(g+1),c[2]=o.getX(g+2)):(c[0]=g,c[1]=g+1,c[2]=g+2);const{a:v,b:w,c:y}=Z_;if(v.fromBufferAttribute(a,c[0]),w.fromBufferAttribute(a,c[1]),y.fromBufferAttribute(a,c[2]),Z_.getNormal(JC),h[0]=`${Math.round(v.x*r)},${Math.round(v.y*r)},${Math.round(v.z*r)}`,h[1]=`${Math.round(w.x*r)},${Math.round(w.y*r)},${Math.round(w.z*r)}`,h[2]=`${Math.round(y.x*r)},${Math.round(y.y*r)},${Math.round(y.z*r)}`,!(h[0]===h[1]||h[1]===h[2]||h[2]===h[0]))for(let _=0;_<3;_++){const x=(_+1)%3,S=h[_],M=h[x],A=Z_[u[_]],I=Z_[u[x]],D=`${S}_${M}`,k=`${M}_${S}`;k in f&&f[k]?(JC.dot(f[k].normal)<=s&&(m.push(A.x,A.y,A.z),m.push(I.x,I.y,I.z)),f[k]=null):D in f||(f[D]={index0:c[_],index1:c[x],normal:JC.clone()})}}for(const g in f)if(f[g]){const{index0:v,index1:w}=f[g];Y_.fromBufferAttribute(a,v),Q_.fromBufferAttribute(a,w),m.push(Y_.x,Y_.y,Y_.z),m.push(Q_.x,Q_.y,Q_.z)}this.setAttribute("position",new at(m,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}class Jd extends f1{constructor(e){super(e),this.uuid=go(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){const r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){const r=e.holes[t];this.holes.push(new f1().fromJSON(r))}return this}}const _Ue={triangulate:function(n,e,t=2){const i=e&&e.length,r=i?e[0]*t:n.length;let s=SZ(n,0,r,t,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,c,u,h,f,m;if(i&&(s=TUe(n,e,s,t)),n.length>80*t){a=c=n[0],l=u=n[1];for(let g=t;g<r;g+=t)h=n[g],f=n[g+1],h<a&&(a=h),f<l&&(l=f),h>c&&(c=h),f>u&&(u=f);m=Math.max(c-a,u-l),m=m!==0?32767/m:0}return d1(s,o,t,a,l,m,0),o}};function SZ(n,e,t,i,r){let s,o;if(r===kUe(n,e,t,i)>0)for(s=e;s<t;s+=i)o=bH(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=bH(s,n[s],n[s+1],o);return o&&Y2(o,o.next)&&(m1(o),o=o.next),o}function yp(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Y2(t,t.next)||qn(t.prev,t,t.next)===0)){if(m1(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function d1(n,e,t,i,r,s,o){if(!n)return;!o&&s&&NUe(n,i,r,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?SUe(n,i,r,s):EUe(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),m1(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=AUe(yp(n),e,t),d1(n,e,t,i,r,s,2)):o===2&&MUe(n,e,t,i,r,s):d1(yp(n),e,t,i,r,s,1);break}}}function EUe(n){const e=n.prev,t=n,i=n.next;if(qn(e,t,i)>=0)return!1;const r=e.x,s=t.x,o=i.x,a=e.y,l=t.y,c=i.y,u=r<s?r<o?r:o:s<o?s:o,h=a<l?a<c?a:c:l<c?l:c,f=r>s?r>o?r:o:s>o?s:o,m=a>l?a>c?a:c:l>c?l:c;let g=i.next;for(;g!==e;){if(g.x>=u&&g.x<=f&&g.y>=h&&g.y<=m&&ug(r,a,s,l,o,c,g.x,g.y)&&qn(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function SUe(n,e,t,i){const r=n.prev,s=n,o=n.next;if(qn(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,u=r.y,h=s.y,f=o.y,m=a<l?a<c?a:c:l<c?l:c,g=u<h?u<f?u:f:h<f?h:f,v=a>l?a>c?a:c:l>c?l:c,w=u>h?u>f?u:f:h>f?h:f,y=HN(m,g,e,t,i),_=HN(v,w,e,t,i);let x=n.prevZ,S=n.nextZ;for(;x&&x.z>=y&&S&&S.z<=_;){if(x.x>=m&&x.x<=v&&x.y>=g&&x.y<=w&&x!==r&&x!==o&&ug(a,u,l,h,c,f,x.x,x.y)&&qn(x.prev,x,x.next)>=0||(x=x.prevZ,S.x>=m&&S.x<=v&&S.y>=g&&S.y<=w&&S!==r&&S!==o&&ug(a,u,l,h,c,f,S.x,S.y)&&qn(S.prev,S,S.next)>=0))return!1;S=S.nextZ}for(;x&&x.z>=y;){if(x.x>=m&&x.x<=v&&x.y>=g&&x.y<=w&&x!==r&&x!==o&&ug(a,u,l,h,c,f,x.x,x.y)&&qn(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;S&&S.z<=_;){if(S.x>=m&&S.x<=v&&S.y>=g&&S.y<=w&&S!==r&&S!==o&&ug(a,u,l,h,c,f,S.x,S.y)&&qn(S.prev,S,S.next)>=0)return!1;S=S.nextZ}return!0}function AUe(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!Y2(r,s)&&AZ(r,i,i.next,s)&&p1(r,s)&&p1(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),m1(i),m1(i.next),i=n=s),i=i.next}while(i!==n);return yp(i)}function MUe(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&LUe(o,a)){let l=MZ(o,a);o=yp(o,o.next),l=yp(l,l.next),d1(o,e,t,i,r,s,0),d1(l,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function TUe(n,e,t,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s<o;s++)a=e[s]*i,l=s<o-1?e[s+1]*i:n.length,c=SZ(n,a,l,i,!1),c===c.next&&(c.steiner=!0),r.push(OUe(c));for(r.sort(PUe),s=0;s<r.length;s++)t=CUe(r[s],t);return t}function PUe(n,e){return n.x-e.x}function CUe(n,e){const t=IUe(n,e);if(!t)return e;const i=MZ(t,n);return yp(i,i.next),yp(t,t.next)}function IUe(n,e){let t=e,i=-1/0,r;const s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){const f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>i&&(i=f,r=t.x<t.next.x?t:t.next,f===s))return r}t=t.next}while(t!==e);if(!r)return null;const a=r,l=r.x,c=r.y;let u=1/0,h;t=r;do s>=t.x&&t.x>=l&&s!==t.x&&ug(o<c?s:i,o,l,c,o<c?i:s,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(s-t.x),p1(t,n)&&(h<u||h===u&&(t.x>r.x||t.x===r.x&&RUe(r,t)))&&(r=t,u=h)),t=t.next;while(t!==a);return r}function RUe(n,e){return qn(n.prev,n,e.prev)<0&&qn(e.next,n,n.next)<0}function NUe(n,e,t,i){let r=n;do r.z===0&&(r.z=HN(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,DUe(r)}function DUe(n){let e,t,i,r,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<c&&(a++,i=i.nextZ,!!i);e++);for(l=c;a>0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(o>1);return n}function HN(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function OUe(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function ug(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function LUe(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!UUe(n,e)&&(p1(n,e)&&p1(e,n)&&BUe(n,e)&&(qn(n.prev,n,e.prev)||qn(n,e.prev,e))||Y2(n,e)&&qn(n.prev,n,n.next)>0&&qn(e.prev,e,e.next)>0)}function qn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Y2(n,e){return n.x===e.x&&n.y===e.y}function AZ(n,e,t,i){const r=eE(qn(n,e,t)),s=eE(qn(n,e,i)),o=eE(qn(t,i,n)),a=eE(qn(t,i,e));return!!(r!==s&&o!==a||r===0&&J_(n,t,e)||s===0&&J_(n,i,e)||o===0&&J_(t,n,i)||a===0&&J_(t,e,i))}function J_(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function eE(n){return n>0?1:n<0?-1:0}function UUe(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&AZ(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function p1(n,e){return qn(n.prev,n,n.next)<0?qn(n,e,n.next)>=0&&qn(n,n.prev,e)>=0:qn(n,e,n.prev)<0||qn(n,n.next,e)<0}function BUe(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function MZ(n,e){const t=new $N(n.i,n.x,n.y),i=new $N(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function bH(n,e,t,i){const r=new $N(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function m1(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function $N(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function kUe(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}class zl{static area(e){const t=e.length;let i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return zl.area(e)<0}static triangulateShape(e,t){const i=[],r=[],s=[];_H(e),EH(i,e);let o=e.length;t.forEach(_H);for(let l=0;l<t.length;l++)r.push(o),o+=t[l].length,EH(i,t[l]);const a=_Ue.triangulate(i,r);for(let l=0;l<a.length;l+=3)s.push(a.slice(l,l+3));return s}}function _H(n){const e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function EH(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}class Q2 extends Ft{constructor(e=new Jd([new Me(.5,.5),new Me(-.5,.5),new Me(-.5,-.5),new Me(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const i=this,r=[],s=[];for(let a=0,l=e.length;a<l;a++){const c=e[a];o(c)}this.setAttribute("position",new at(r,3)),this.setAttribute("uv",new at(s,2)),this.computeVertexNormals();function o(a){const l=[],c=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1;let f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,m=t.bevelThickness!==void 0?t.bevelThickness:.2,g=t.bevelSize!==void 0?t.bevelSize:m-.1,v=t.bevelOffset!==void 0?t.bevelOffset:0,w=t.bevelSegments!==void 0?t.bevelSegments:3;const y=t.extrudePath,_=t.UVGenerator!==void 0?t.UVGenerator:FUe;let x,S=!1,M,A,I,D;y&&(x=y.getSpacedPoints(u),S=!0,f=!1,M=y.computeFrenetFrames(u,!1),A=new K,I=new K,D=new K),f||(w=0,m=0,g=0,v=0);const k=a.extractPoints(c);let C=k.shape;const U=k.holes;if(!zl.isClockWise(C)){C=C.reverse();for(let J=0,Se=U.length;J<Se;J++){const me=U[J];zl.isClockWise(me)&&(U[J]=me.reverse())}}const H=zl.triangulateShape(C,U),z=C;for(let J=0,Se=U.length;J<Se;J++){const me=U[J];C=C.concat(me)}function P(J,Se,me){return Se||console.error("THREE.ExtrudeGeometry: vec does not exist"),J.clone().addScaledVector(Se,me)}const R=C.length,F=H.length;function N(J,Se,me){let Re,Ae,Ze;const Ke=J.x-Se.x,rt=J.y-Se.y,Et=me.x-J.x,X=me.y-J.y,$=Ke*Ke+rt*rt,xe=Ke*X-rt*Et;if(Math.abs(xe)>Number.EPSILON){const Ee=Math.sqrt($),Ne=Math.sqrt(Et*Et+X*X),Pe=Se.x-rt/Ee,_t=Se.y+Ke/Ee,pt=me.x-X/Ne,Fe=me.y+Et/Ne,$e=((pt-Pe)*X-(Fe-_t)*Et)/(Ke*X-rt*Et);Re=Pe+Ke*$e-J.x,Ae=_t+rt*$e-J.y;const At=Re*Re+Ae*Ae;if(At<=2)return new Me(Re,Ae);Ze=Math.sqrt(At/2)}else{let Ee=!1;Ke>Number.EPSILON?Et>Number.EPSILON&&(Ee=!0):Ke<-Number.EPSILON?Et<-Number.EPSILON&&(Ee=!0):Math.sign(rt)===Math.sign(X)&&(Ee=!0),Ee?(Re=-rt,Ae=Ke,Ze=Math.sqrt($)):(Re=Ke,Ae=rt,Ze=Math.sqrt($/2))}return new Me(Re/Ze,Ae/Ze)}const O=[];for(let J=0,Se=z.length,me=Se-1,Re=J+1;J<Se;J++,me++,Re++)me===Se&&(me=0),Re===Se&&(Re=0),O[J]=N(z[J],z[me],z[Re]);const B=[];let W,Q=O.concat();for(let J=0,Se=U.length;J<Se;J++){const me=U[J];W=[];for(let Re=0,Ae=me.length,Ze=Ae-1,Ke=Re+1;Re<Ae;Re++,Ze++,Ke++)Ze===Ae&&(Ze=0),Ke===Ae&&(Ke=0),W[Re]=N(me[Re],me[Ze],me[Ke]);B.push(W),Q=Q.concat(W)}for(let J=0;J<w;J++){const Se=J/w,me=m*Math.cos(Se*Math.PI/2),Re=g*Math.sin(Se*Math.PI/2)+v;for(let Ae=0,Ze=z.length;Ae<Ze;Ae++){const Ke=P(z[Ae],O[Ae],Re);ve(Ke.x,Ke.y,-me)}for(let Ae=0,Ze=U.length;Ae<Ze;Ae++){const Ke=U[Ae];W=B[Ae];for(let rt=0,Et=Ke.length;rt<Et;rt++){const X=P(Ke[rt],W[rt],Re);ve(X.x,X.y,-me)}}}const oe=g+v;for(let J=0;J<R;J++){const Se=f?P(C[J],Q[J],oe):C[J];S?(I.copy(M.normals[0]).multiplyScalar(Se.x),A.copy(M.binormals[0]).multiplyScalar(Se.y),D.copy(x[0]).add(I).add(A),ve(D.x,D.y,D.z)):ve(Se.x,Se.y,0)}for(let J=1;J<=u;J++)for(let Se=0;Se<R;Se++){const me=f?P(C[Se],Q[Se],oe):C[Se];S?(I.copy(M.normals[J]).multiplyScalar(me.x),A.copy(M.binormals[J]).multiplyScalar(me.y),D.copy(x[J]).add(I).add(A),ve(D.x,D.y,D.z)):ve(me.x,me.y,h/u*J)}for(let J=w-1;J>=0;J--){const Se=J/w,me=m*Math.cos(Se*Math.PI/2),Re=g*Math.sin(Se*Math.PI/2)+v;for(let Ae=0,Ze=z.length;Ae<Ze;Ae++){const Ke=P(z[Ae],O[Ae],Re);ve(Ke.x,Ke.y,h+me)}for(let Ae=0,Ze=U.length;Ae<Ze;Ae++){const Ke=U[Ae];W=B[Ae];for(let rt=0,Et=Ke.length;rt<Et;rt++){const X=P(Ke[rt],W[rt],Re);S?ve(X.x,X.y+x[u-1].y,x[u-1].x+me):ve(X.x,X.y,h+me)}}}Y(),te();function Y(){const J=r.length/3;if(f){let Se=0,me=R*Se;for(let Re=0;Re<F;Re++){const Ae=H[Re];Te(Ae[2]+me,Ae[1]+me,Ae[0]+me)}Se=u+w*2,me=R*Se;for(let Re=0;Re<F;Re++){const Ae=H[Re];Te(Ae[0]+me,Ae[1]+me,Ae[2]+me)}}else{for(let Se=0;Se<F;Se++){const me=H[Se];Te(me[2],me[1],me[0])}for(let Se=0;Se<F;Se++){const me=H[Se];Te(me[0]+R*u,me[1]+R*u,me[2]+R*u)}}i.addGroup(J,r.length/3-J,0)}function te(){const J=r.length/3;let Se=0;le(z,Se),Se+=z.length;for(let me=0,Re=U.length;me<Re;me++){const Ae=U[me];le(Ae,Se),Se+=Ae.length}i.addGroup(J,r.length/3-J,1)}function le(J,Se){let me=J.length;for(;--me>=0;){const Re=me;let Ae=me-1;Ae<0&&(Ae=J.length-1);for(let Ze=0,Ke=u+w*2;Ze<Ke;Ze++){const rt=R*Ze,Et=R*(Ze+1),X=Se+Re+rt,$=Se+Ae+rt,xe=Se+Ae+Et,Ee=Se+Re+Et;be(X,$,xe,Ee)}}}function ve(J,Se,me){l.push(J),l.push(Se),l.push(me)}function Te(J,Se,me){Le(J),Le(Se),Le(me);const Re=r.length/3,Ae=_.generateTopUV(i,r,Re-3,Re-2,Re-1);Oe(Ae[0]),Oe(Ae[1]),Oe(Ae[2])}function be(J,Se,me,Re){Le(J),Le(Se),Le(Re),Le(Se),Le(me),Le(Re);const Ae=r.length/3,Ze=_.generateSideWallUV(i,r,Ae-6,Ae-3,Ae-2,Ae-1);Oe(Ze[0]),Oe(Ze[1]),Oe(Ze[3]),Oe(Ze[1]),Oe(Ze[2]),Oe(Ze[3])}function Le(J){r.push(l[J*3+0]),r.push(l[J*3+1]),r.push(l[J*3+2])}function Oe(J){s.push(J.x),s.push(J.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return zUe(t,i,e)}static fromJSON(e,t){const i=[];for(let s=0,o=e.shapes.length;s<o;s++){const a=t[e.shapes[s]];i.push(a)}const r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new gA[r.type]().fromJSON(r)),new Q2(i,e.options)}}const FUe={generateTopUV:function(n,e,t,i,r){const s=e[t*3],o=e[t*3+1],a=e[i*3],l=e[i*3+1],c=e[r*3],u=e[r*3+1];return[new Me(s,o),new Me(a,l),new Me(c,u)]},generateSideWallUV:function(n,e,t,i,r,s){const o=e[t*3],a=e[t*3+1],l=e[t*3+2],c=e[i*3],u=e[i*3+1],h=e[i*3+2],f=e[r*3],m=e[r*3+1],g=e[r*3+2],v=e[s*3],w=e[s*3+1],y=e[s*3+2];return Math.abs(a-u)<Math.abs(o-c)?[new Me(o,1-l),new Me(c,1-h),new Me(f,1-g),new Me(v,1-y)]:[new Me(a,1-l),new Me(u,1-h),new Me(m,1-g),new Me(w,1-y)]}};function zUe(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){const s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}class Z2 extends uf{constructor(e=1,t=0){const i=(1+Math.sqrt(5))/2,r=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(r,s,e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Z2(e.radius,e.detail)}}class fx extends uf{constructor(e=1,t=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],r=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,r,e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new fx(e.radius,e.detail)}}class J2 extends Ft{constructor(e=.5,t=1,i=32,r=1,s=0,o=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:i,phiSegments:r,thetaStart:s,thetaLength:o},i=Math.max(3,i),r=Math.max(1,r);const a=[],l=[],c=[],u=[];let h=e;const f=(t-e)/r,m=new K,g=new Me;for(let v=0;v<=r;v++){for(let w=0;w<=i;w++){const y=s+w/i*o;m.x=h*Math.cos(y),m.y=h*Math.sin(y),l.push(m.x,m.y,m.z),c.push(0,0,1),g.x=(m.x/t+1)/2,g.y=(m.y/t+1)/2,u.push(g.x,g.y)}h+=f}for(let v=0;v<r;v++){const w=v*(i+1);for(let y=0;y<i;y++){const _=y+w,x=_,S=_+i+1,M=_+i+2,A=_+1;a.push(x,S,A),a.push(S,M,A)}}this.setIndex(a),this.setAttribute("position",new at(l,3)),this.setAttribute("normal",new at(c,3)),this.setAttribute("uv",new at(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new J2(e.innerRadius,e.outerRadius,e.thetaSegments,e.phiSegments,e.thetaStart,e.thetaLength)}}class eM extends Ft{constructor(e=new Jd([new Me(0,.5),new Me(-.5,-.5),new Me(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const i=[],r=[],s=[],o=[];let a=0,l=0;if(Array.isArray(e)===!1)c(e);else for(let u=0;u<e.length;u++)c(e[u]),this.addGroup(a,l,u),a+=l,l=0;this.setIndex(i),this.setAttribute("position",new at(r,3)),this.setAttribute("normal",new at(s,3)),this.setAttribute("uv",new at(o,2));function c(u){const h=r.length/3,f=u.extractPoints(t);let m=f.shape;const g=f.holes;zl.isClockWise(m)===!1&&(m=m.reverse());for(let w=0,y=g.length;w<y;w++){const _=g[w];zl.isClockWise(_)===!0&&(g[w]=_.reverse())}const v=zl.triangulateShape(m,g);for(let w=0,y=g.length;w<y;w++){const _=g[w];m=m.concat(_)}for(let w=0,y=m.length;w<y;w++){const _=m[w];r.push(_.x,_.y,0),s.push(0,0,1),o.push(_.x,_.y)}for(let w=0,y=v.length;w<y;w++){const _=v[w],x=_[0]+h,S=_[1]+h,M=_[2]+h;i.push(x,S,M),l+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return VUe(t,e)}static fromJSON(e,t){const i=[];for(let r=0,s=e.shapes.length;r<s;r++){const o=t[e.shapes[r]];i.push(o)}return new eM(i,e.curveSegments)}}function VUe(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){const r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}class dx extends Ft{constructor(e=1,t=32,i=16,r=0,s=Math.PI*2,o=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:i,phiStart:r,phiLength:s,thetaStart:o,thetaLength:a},t=Math.max(3,Math.floor(t)),i=Math.max(2,Math.floor(i));const l=Math.min(o+a,Math.PI);let c=0;const u=[],h=new K,f=new K,m=[],g=[],v=[],w=[];for(let y=0;y<=i;y++){const _=[],x=y/i;let S=0;y===0&&o===0?S=.5/t:y===i&&l===Math.PI&&(S=-.5/t);for(let M=0;M<=t;M++){const A=M/t;h.x=-e*Math.cos(r+A*s)*Math.sin(o+x*a),h.y=e*Math.cos(o+x*a),h.z=e*Math.sin(r+A*s)*Math.sin(o+x*a),g.push(h.x,h.y,h.z),f.copy(h).normalize(),v.push(f.x,f.y,f.z),w.push(A+S,1-x),_.push(c++)}u.push(_)}for(let y=0;y<i;y++)for(let _=0;_<t;_++){const x=u[y][_+1],S=u[y][_],M=u[y+1][_],A=u[y+1][_+1];(y!==0||o>0)&&m.push(x,S,A),(y!==i-1||l<Math.PI)&&m.push(S,M,A)}this.setIndex(m),this.setAttribute("position",new at(g,3)),this.setAttribute("normal",new at(v,3)),this.setAttribute("uv",new at(w,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new dx(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}class tM extends uf{constructor(e=1,t=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],r=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,r,e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new tM(e.radius,e.detail)}}class nM extends Ft{constructor(e=1,t=.4,i=12,r=48,s=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:i,tubularSegments:r,arc:s},i=Math.floor(i),r=Math.floor(r);const o=[],a=[],l=[],c=[],u=new K,h=new K,f=new K;for(let m=0;m<=i;m++)for(let g=0;g<=r;g++){const v=g/r*s,w=m/i*Math.PI*2;h.x=(e+t*Math.cos(w))*Math.cos(v),h.y=(e+t*Math.cos(w))*Math.sin(v),h.z=t*Math.sin(w),a.push(h.x,h.y,h.z),u.x=e*Math.cos(v),u.y=e*Math.sin(v),f.subVectors(h,u).normalize(),l.push(f.x,f.y,f.z),c.push(g/r),c.push(m/i)}for(let m=1;m<=i;m++)for(let g=1;g<=r;g++){const v=(r+1)*m+g-1,w=(r+1)*(m-1)+g-1,y=(r+1)*(m-1)+g,_=(r+1)*m+g;o.push(v,w,_),o.push(w,y,_)}this.setIndex(o),this.setAttribute("position",new at(a,3)),this.setAttribute("normal",new at(l,3)),this.setAttribute("uv",new at(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new nM(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class iM extends Ft{constructor(e=1,t=.4,i=64,r=8,s=2,o=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:i,radialSegments:r,p:s,q:o},i=Math.floor(i),r=Math.floor(r);const a=[],l=[],c=[],u=[],h=new K,f=new K,m=new K,g=new K,v=new K,w=new K,y=new K;for(let x=0;x<=i;++x){const S=x/i*s*Math.PI*2;_(S,s,o,e,m),_(S+.01,s,o,e,g),w.subVectors(g,m),y.addVectors(g,m),v.crossVectors(w,y),y.crossVectors(v,w),v.normalize(),y.normalize();for(let M=0;M<=r;++M){const A=M/r*Math.PI*2,I=-t*Math.cos(A),D=t*Math.sin(A);h.x=m.x+(I*y.x+D*v.x),h.y=m.y+(I*y.y+D*v.y),h.z=m.z+(I*y.z+D*v.z),l.push(h.x,h.y,h.z),f.subVectors(h,m).normalize(),c.push(f.x,f.y,f.z),u.push(x/i),u.push(M/r)}}for(let x=1;x<=i;x++)for(let S=1;S<=r;S++){const M=(r+1)*(x-1)+(S-1),A=(r+1)*x+(S-1),I=(r+1)*x+S,D=(r+1)*(x-1)+S;a.push(M,A,D),a.push(A,I,D)}this.setIndex(a),this.setAttribute("position",new at(l,3)),this.setAttribute("normal",new at(c,3)),this.setAttribute("uv",new at(u,2));function _(x,S,M,A,I){const D=Math.cos(x),k=Math.sin(x),C=M/S*x,U=Math.cos(C);I.x=A*(2+U)*.5*D,I.y=A*(2+U)*k*.5,I.z=A*Math.sin(C)*.5}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new iM(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class rM extends Ft{constructor(e=new cU(new K(-1,-1,0),new K(-1,1,0),new K(1,1,0)),t=64,i=1,r=8,s=!1){super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:i,radialSegments:r,closed:s};const o=e.computeFrenetFrames(t,s);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals;const a=new K,l=new K,c=new Me;let u=new K;const h=[],f=[],m=[],g=[];v(),this.setIndex(g),this.setAttribute("position",new at(h,3)),this.setAttribute("normal",new at(f,3)),this.setAttribute("uv",new at(m,2));function v(){for(let x=0;x<t;x++)w(x);w(s===!1?t:0),_(),y()}function w(x){u=e.getPointAt(x/t,u);const S=o.normals[x],M=o.binormals[x];for(let A=0;A<=r;A++){const I=A/r*Math.PI*2,D=Math.sin(I),k=-Math.cos(I);l.x=k*S.x+D*M.x,l.y=k*S.y+D*M.y,l.z=k*S.z+D*M.z,l.normalize(),f.push(l.x,l.y,l.z),a.x=u.x+i*l.x,a.y=u.y+i*l.y,a.z=u.z+i*l.z,h.push(a.x,a.y,a.z)}}function y(){for(let x=1;x<=t;x++)for(let S=1;S<=r;S++){const M=(r+1)*(x-1)+(S-1),A=(r+1)*x+(S-1),I=(r+1)*x+S,D=(r+1)*(x-1)+S;g.push(M,A,D),g.push(A,I,D)}}function _(){for(let x=0;x<=t;x++)for(let S=0;S<=r;S++)c.x=x/t,c.y=S/r,m.push(c.x,c.y)}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON();return e.path=this.parameters.path.toJSON(),e}static fromJSON(e){return new rM(new gA[e.path.type]().fromJSON(e.path),e.tubularSegments,e.radius,e.radialSegments,e.closed)}}class TZ extends Ft{constructor(e=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},e!==null){const t=[],i=new Set,r=new K,s=new K;if(e.index!==null){const o=e.attributes.position,a=e.index;let l=e.groups;l.length===0&&(l=[{start:0,count:a.count,materialIndex:0}]);for(let c=0,u=l.length;c<u;++c){const h=l[c],f=h.start,m=h.count;for(let g=f,v=f+m;g<v;g+=3)for(let w=0;w<3;w++){const y=a.getX(g+w),_=a.getX(g+(w+1)%3);r.fromBufferAttribute(o,y),s.fromBufferAttribute(o,_),SH(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}}else{const o=e.attributes.position;for(let a=0,l=o.count/3;a<l;a++)for(let c=0;c<3;c++){const u=3*a+c,h=3*a+(c+1)%3;r.fromBufferAttribute(o,u),s.fromBufferAttribute(o,h),SH(r,s,i)===!0&&(t.push(r.x,r.y,r.z),t.push(s.x,s.y,s.z))}}this.setAttribute("position",new at(t,3))}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}}function SH(n,e,t){const i=`${n.x},${n.y},${n.z}-${e.x},${e.y},${e.z}`,r=`${e.x},${e.y},${e.z}-${n.x},${n.y},${n.z}`;return t.has(i)===!0||t.has(r)===!0?!1:(t.add(i),t.add(r),!0)}var AH=Object.freeze({__proto__:null,BoxGeometry:Ip,CapsuleGeometry:W2,CircleGeometry:q2,ConeGeometry:K2,CylinderGeometry:oy,DodecahedronGeometry:X2,EdgesGeometry:EZ,ExtrudeGeometry:Q2,IcosahedronGeometry:Z2,LatheGeometry:hx,OctahedronGeometry:fx,PlaneGeometry:ry,PolyhedronGeometry:uf,RingGeometry:J2,ShapeGeometry:eM,SphereGeometry:dx,TetrahedronGeometry:tM,TorusGeometry:nM,TorusKnotGeometry:iM,TubeGeometry:rM,WireframeGeometry:TZ});class PZ extends jr{constructor(e){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new et(0),this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.fog=e.fog,this}}class CZ extends zs{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class hU extends jr{constructor(e){super(),this.isMeshStandardMaterial=!0,this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new et(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 et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lf,this.normalScale=new Me(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 wo,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 IZ extends hU{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Me(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return ii(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new et(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new et(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new et(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class RZ extends jr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new et(16777215),this.specular=new et(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lf,this.normalScale=new Me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new wo,this.combine=sx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.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.flatShading=e.flatShading,this.fog=e.fog,this}}class NZ extends jr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new et(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lf,this.normalScale=new Me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class DZ extends jr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lf,this.normalScale=new Me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class OZ extends jr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new et(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new et(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lf,this.normalScale=new Me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new wo,this.combine=sx,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.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.flatShading=e.flatShading,this.fog=e.fog,this}}class LZ extends jr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new et(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lf,this.normalScale=new Me(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class UZ extends ds{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function _d(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function BZ(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function kZ(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function GN(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,o=0;o!==i;++s){const a=t[s]*e;for(let l=0;l!==e;++l)r[o++]=n[a+l]}return r}function fU(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),t.push(o)),s=n[r++];while(s!==void 0)}function HUe(n,e,t,i,r=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l<s.tracks.length;++l){const c=s.tracks[l],u=c.getValueSize(),h=[],f=[];for(let m=0;m<c.times.length;++m){const g=c.times[m]*r;if(!(g<t||g>=i)){h.push(c.times[m]);for(let v=0;v<u;++v)f.push(c.values[m*u+v])}}h.length!==0&&(c.times=_d(h,c.times.constructor),c.values=_d(f,c.values.constructor),o.push(c))}s.tracks=o;let a=1/0;for(let l=0;l<s.tracks.length;++l)a>s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l<s.tracks.length;++l)s.tracks[l].shift(-1*a);return s.resetDuration(),s}function $Ue(n,e=0,t=n,i=30){i<=0&&(i=30);const r=t.tracks.length,s=e/i;for(let o=0;o<r;++o){const a=t.tracks[o],l=a.ValueTypeName;if(l==="bool"||l==="string")continue;const c=n.tracks.find(function(y){return y.name===a.name&&y.ValueTypeName===l});if(c===void 0)continue;let u=0;const h=a.getValueSize();a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(u=h/3);let f=0;const m=c.getValueSize();c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(f=m/3);const g=a.times.length-1;let v;if(s<=a.times[0]){const y=u,_=h-u;v=a.values.slice(y,_)}else if(s>=a.times[g]){const y=g*h+u,_=y+h-u;v=a.values.slice(y,_)}else{const y=a.createInterpolant(),_=u,x=h-u;y.evaluate(s),v=y.resultBuffer.slice(_,x)}l==="quaternion"&&new ks().fromArray(v).normalize().conjugate().toArray(v);const w=c.times.length;for(let y=0;y<w;++y){const _=y*m+f;if(l==="quaternion")ks.multiplyQuaternionsFlat(c.values,_,v,0,c.values,_);else{const x=m-f*2;for(let S=0;S<x;++S)c.values[_+S]-=v[S]}}}return n.blendMode=$L,n}const GUe={convertArray:_d,isTypedArray:BZ,getKeyframeOrder:kZ,sortedArray:GN,flattenJSON:fU,subclip:HUe,makeClipAdditive:$Ue};class px{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,r=t[i],s=t[i-1];e:{t:{let o;n:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break t}o=t.length;break n}if(!(e>=s)){const a=t[1];e<a&&(i=2,s=a);for(let l=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===l)break;if(r=s,s=t[--i-1],e>=s)break t}o=i,i=0;break n}break e}for(;i<o;){const a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class FZ extends px{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:wd,endingEnd:wd}}intervalChanged_(e,t,i){const r=this.parameterPositions;let s=e-2,o=e+1,a=r[s],l=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case xd:s=e,a=2*t-i;break;case s1:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(l===void 0)switch(this.getSettings_().endingEnd){case xd:o=e,l=2*i-t;break;case s1:o=1,l=i+r[1]-r[0];break;default:o=e-1,l=t}const c=(i-t)*.5,u=this.valueSize;this._weightPrev=c/(t-a),this._weightNext=c/(l-i),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,m=this._weightNext,g=(i-t)/(r-t),v=g*g,w=v*g,y=-f*w+2*f*v-f*g,_=(1+f)*w+(-1.5-2*f)*v+(-.5+f)*g+1,x=(-1-m)*w+(1.5+m)*v+.5*g,S=m*w-m*v;for(let M=0;M!==a;++M)s[M]=y*o[u+M]+_*o[c+M]+x*o[l+M]+S*o[h+M];return s}}class dU extends px{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=e*a,c=l-a,u=(i-t)/(r-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[c+f]*h+o[l+f]*u;return s}}class zZ extends px{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}}class Wa{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=_d(t,this.TimeBufferType),this.values=_d(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:_d(e.times,Array),values:_d(e.values,Array)};const r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new zZ(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new dU(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new FZ(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case i1:t=this.InterpolantFactoryMethodDiscrete;break;case r1:t=this.InterpolantFactoryMethodLinear;break;case YE:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return i1;case this.InterpolantFactoryMethodLinear:return r1;case this.InterpolantFactoryMethodSmooth:return YE}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){const i=this.times,r=i.length;let s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&BZ(r))for(let a=0,l=r.length;a!==l;++a){const c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===YE,s=e.length-1;let o=1;for(let a=1;a<s;++a){let l=!1;const c=e[a],u=e[a+1];if(c!==u&&(a!==1||c!==e[0]))if(r)l=!0;else{const h=a*i,f=h-i,m=h+i;for(let g=0;g!==i;++g){const v=t[h+g];if(v!==t[f+g]||v!==t[m+g]){l=!0;break}}}if(l){if(a!==o){e[o]=e[a];const h=a*i,f=o*i;for(let m=0;m!==i;++m)t[f+m]=t[h+m]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}Wa.prototype.TimeBufferType=Float32Array;Wa.prototype.ValueBufferType=Float32Array;Wa.prototype.DefaultInterpolation=r1;class Rp extends Wa{}Rp.prototype.ValueTypeName="bool";Rp.prototype.ValueBufferType=Array;Rp.prototype.DefaultInterpolation=i1;Rp.prototype.InterpolantFactoryMethodLinear=void 0;Rp.prototype.InterpolantFactoryMethodSmooth=void 0;class pU extends Wa{}pU.prototype.ValueTypeName="color";class g1 extends Wa{}g1.prototype.ValueTypeName="number";class VZ extends px{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(r-t);let c=e*a;for(let u=c+a;c!==u;c+=4)ks.slerpFlat(s,0,o,c-a,o,c,l);return s}}class ay extends Wa{InterpolantFactoryMethodLinear(e){return new VZ(this.times,this.values,this.getValueSize(),e)}}ay.prototype.ValueTypeName="quaternion";ay.prototype.DefaultInterpolation=r1;ay.prototype.InterpolantFactoryMethodSmooth=void 0;class Np extends Wa{}Np.prototype.ValueTypeName="string";Np.prototype.ValueBufferType=Array;Np.prototype.DefaultInterpolation=i1;Np.prototype.InterpolantFactoryMethodLinear=void 0;Np.prototype.InterpolantFactoryMethodSmooth=void 0;class y1 extends Wa{}y1.prototype.ValueTypeName="vector";class v1{constructor(e,t=-1,i,r=U2){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=go(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(WUe(i[o]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)t.push(Wa.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a<s;a++){let l=[],c=[];l.push((a+s-1)%s,a,(a+1)%s),c.push(0,1,0);const u=kZ(l);l=GN(l,1,u),c=GN(c,1,u),!r&&l[0]===0&&(l.push(s),c.push(c[0])),o.push(new g1(".morphTargetInfluences["+t[a].name+"]",l,c).scale(1/i))}return new this(e,-1,o)}static findByName(e,t){let i=e;if(!Array.isArray(e)){const r=e;i=r.geometry&&r.geometry.animations||r.animations}for(let r=0;r<i.length;r++)if(i[r].name===t)return i[r];return null}static CreateClipsFromMorphTargetSequences(e,t,i){const r={},s=/^([\w-]*?)([\d]+)$/;for(let a=0,l=e.length;a<l;a++){const c=e[a],u=c.name.match(s);if(u&&u.length>1){const h=u[1];let f=r[h];f||(r[h]=f=[]),f.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,f,m,g,v){if(m.length!==0){const w=[],y=[];fU(m,w,y,g),w.length!==0&&v.push(new h(f,w,y))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h<c.length;h++){const f=c[h].keys;if(!(!f||f.length===0))if(f[0].morphTargets){const m={};let g;for(g=0;g<f.length;g++)if(f[g].morphTargets)for(let v=0;v<f[g].morphTargets.length;v++)m[f[g].morphTargets[v]]=-1;for(const v in m){const w=[],y=[];for(let _=0;_!==f[g].morphTargets.length;++_){const x=f[g];w.push(x.time),y.push(x.morphTarget===v?1:0)}r.push(new g1(".morphTargetInfluence["+v+"]",w,y))}l=m.length*o}else{const m=".bones["+t[h].name+"]";i(y1,m+".position",f,"pos",r),i(ay,m+".quaternion",f,"rot",r),i(y1,m+".scale",f,"scl",r)}}return r.length===0?null:new this(s,l,r,a)}resetDuration(){const e=this.tracks;let t=0;for(let i=0,r=e.length;i!==r;++i){const s=this.tracks[i];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new this.constructor(this.name,this.duration,e,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function jUe(n){switch(n.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return g1;case"vector":case"vector2":case"vector3":case"vector4":return y1;case"color":return pU;case"quaternion":return ay;case"bool":case"boolean":return Rp;case"string":return Np}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+n)}function WUe(n){if(n.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=jUe(n.type);if(n.times===void 0){const t=[],i=[];fU(n.keys,t,i,"value"),n.times=t,n.values=i}return e.parse!==void 0?e.parse(n):new e(n.name,n.times,n.values,n.interpolation)}const zc={enabled:!1,files:{},add:function(n,e){this.enabled!==!1&&(this.files[n]=e)},get:function(n){if(this.enabled!==!1)return this.files[n]},remove:function(n){delete this.files[n]},clear:function(){this.files={}}};class mU{constructor(e,t,i){const r=this;let s=!1,o=0,a=0,l;const c=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return l?l(u):u},this.setURLModifier=function(u){return l=u,this},this.addHandler=function(u,h){return c.push(u,h),this},this.removeHandler=function(u){const h=c.indexOf(u);return h!==-1&&c.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=c.length;h<f;h+=2){const m=c[h],g=c[h+1];if(m.global&&(m.lastIndex=0),m.test(u))return g}return null}}}const HZ=new mU;class Hs{constructor(e){this.manager=e!==void 0?e:HZ,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){const i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}Hs.DEFAULT_MATERIAL_NAME="__DEFAULT";const lc={};class qUe extends Error{constructor(e,t){super(e),this.response=t}}class lu extends Hs{constructor(e){super(e)}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=zc.get(e);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(lc[e]!==void 0){lc[e].push({onLoad:t,onProgress:i,onError:r});return}lc[e]=[],lc[e].push({onLoad:t,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const u=lc[e],h=c.body.getReader(),f=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),m=f?parseInt(f):0,g=m!==0;let v=0;const w=new ReadableStream({start(y){_();function _(){h.read().then(({done:x,value:S})=>{if(x)y.close();else{v+=S.byteLength;const M=new ProgressEvent("progress",{lengthComputable:g,loaded:v,total:m});for(let A=0,I=u.length;A<I;A++){const D=u[A];D.onProgress&&D.onProgress(M)}y.enqueue(S),_()}})}}});return new Response(w)}else throw new qUe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,m=new TextDecoder(f);return c.arrayBuffer().then(g=>m.decode(g))}}}).then(c=>{zc.add(e,c);const u=lc[e];delete lc[e];for(let h=0,f=u.length;h<f;h++){const m=u[h];m.onLoad&&m.onLoad(c)}}).catch(c=>{const u=lc[e];if(u===void 0)throw this.manager.itemError(e),c;delete lc[e];for(let h=0,f=u.length;h<f;h++){const m=u[h];m.onError&&m.onError(c)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class KUe extends Hs{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new lu(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i<e.length;i++){const r=v1.parse(e[i]);t.push(r)}return t}}class XUe extends Hs{constructor(e){super(e)}load(e,t,i,r){const s=this,o=[],a=new G2,l=new lu(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(s.withCredentials);let c=0;function u(h){l.load(e[h],function(f){const m=s.parse(f,!0);o[h]={width:m.width,height:m.height,format:m.format,mipmaps:m.mipmaps},c+=1,c===6&&(m.mipmapCount===1&&(a.minFilter=On),a.image=o,a.format=m.format,a.needsUpdate=!0,t&&t(a))},i,r)}if(Array.isArray(e))for(let h=0,f=e.length;h<f;++h)u(h);else l.load(e,function(h){const f=s.parse(h,!0);if(f.isCubemap){const m=f.mipmaps.length/f.mipmapCount;for(let g=0;g<m;g++){o[g]={mipmaps:[]};for(let v=0;v<f.mipmapCount;v++)o[g].mipmaps.push(f.mipmaps[g*f.mipmapCount+v]),o[g].format=f.format,o[g].width=f.width,o[g].height=f.height}a.image=o}else a.image.width=f.width,a.image.height=f.height,a.mipmaps=f.mipmaps;f.mipmapCount===1&&(a.minFilter=On),a.format=f.format,a.needsUpdate=!0,t&&t(a)},i,r);return a}}class w1 extends Hs{constructor(e){super(e)}load(e,t,i,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=zc.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=h1("img");function l(){u(),zc.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(h){u(),r&&r(h),s.manager.itemError(e),s.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class YUe extends Hs{constructor(e){super(e)}load(e,t,i,r){const s=new lx;s.colorSpace=Jo;const o=new w1(this.manager);o.setCrossOrigin(this.crossOrigin),o.setPath(this.path);let a=0;function l(c){o.load(e[c],function(u){s.images[c]=u,a++,a===6&&(s.needsUpdate=!0,t&&t(s))},void 0,r)}for(let c=0;c<e.length;++c)l(c);return s}}class QUe extends Hs{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new Xc,a=new lu(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(u){if(r!==void 0)r(u);else{console.error(u);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Fr,o.wrapT=c.wrapT!==void 0?c.wrapT:Fr,o.magFilter=c.magFilter!==void 0?c.magFilter:On,o.minFilter=c.minFilter!==void 0?c.minFilter:On,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=Il),c.mipmapCount===1&&(o.minFilter=On),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},i,r),o}}class sM extends Hs{constructor(e){super(e)}load(e,t,i,r){const s=new zn,o=new w1(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},i,r),s}}class hf extends ln{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new et(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}}class $Z extends hf{constructor(e,t,i){super(e,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ln.DEFAULT_UP),this.updateMatrix(),this.groundColor=new et(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const e3=new wt,MH=new K,TH=new K;class gU{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Me(512,512),this.map=null,this.mapPass=null,this.matrix=new wt,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new cx,this._frameExtents=new Me(1,1),this._viewportCount=1,this._viewports=[new mn(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;MH.setFromMatrixPosition(e.matrixWorld),t.position.copy(MH),TH.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(TH),t.updateMatrixWorld(),e3.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(e3),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(e3)}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.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return 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 ZUe extends gU{constructor(){super(new Ki(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=V0*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(i!==t.fov||r!==t.aspect||s!==t.far)&&(t.fov=i,t.aspect=r,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class GZ extends hf{constructor(e,t,i=0,r=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ln.DEFAULT_UP),this.updateMatrix(),this.target=new ln,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new ZUe}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const PH=new wt,mv=new K,t3=new K;class JUe extends gU{constructor(){super(new Ki(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Me(4,2),this._viewportCount=6,this._viewports=[new mn(2,1,1,1),new mn(0,1,1,1),new mn(3,1,1,1),new mn(1,1,1,1),new mn(3,0,1,1),new mn(1,0,1,1)],this._cubeDirections=[new K(1,0,0),new K(-1,0,0),new K(0,0,1),new K(0,0,-1),new K(0,1,0),new K(0,-1,0)],this._cubeUps=[new K(0,1,0),new K(0,1,0),new K(0,1,0),new K(0,1,0),new K(0,0,1),new K(0,0,-1)]}updateMatrices(e,t=0){const i=this.camera,r=this.matrix,s=e.distance||i.far;s!==i.far&&(i.far=s,i.updateProjectionMatrix()),mv.setFromMatrixPosition(e.matrixWorld),i.position.copy(mv),t3.copy(i.position),t3.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(t3),i.updateMatrixWorld(),r.makeTranslation(-mv.x,-mv.y,-mv.z),PH.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(PH)}}class jZ extends hf{constructor(e,t,i=0,r=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=r,this.shadow=new JUe}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class eBe extends gU{constructor(){super(new ux(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class WZ extends hf{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ln.DEFAULT_UP),this.updateMatrix(),this.target=new ln,this.shadow=new eBe}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class qZ extends hf{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class KZ extends hf{constructor(e,t,i=10,r=10){super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=r}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class XZ{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new K)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.282095),t.addScaledVector(o[1],.488603*r),t.addScaledVector(o[2],.488603*s),t.addScaledVector(o[3],.488603*i),t.addScaledVector(o[4],1.092548*(i*r)),t.addScaledVector(o[5],1.092548*(r*s)),t.addScaledVector(o[6],.315392*(3*s*s-1)),t.addScaledVector(o[7],1.092548*(i*s)),t.addScaledVector(o[8],.546274*(i*i-r*r)),t}getIrradianceAt(e,t){const i=e.x,r=e.y,s=e.z,o=this.coefficients;return t.copy(o[0]).multiplyScalar(.886227),t.addScaledVector(o[1],2*.511664*r),t.addScaledVector(o[2],2*.511664*s),t.addScaledVector(o[3],2*.511664*i),t.addScaledVector(o[4],2*.429043*i*r),t.addScaledVector(o[5],2*.429043*r*s),t.addScaledVector(o[6],.743125*s*s-.247708),t.addScaledVector(o[7],2*.429043*i*s),t.addScaledVector(o[8],.429043*(i*i-r*r)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(e.coefficients[i],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let i=0;i<9;i++)this.coefficients[i].lerp(e.coefficients[i],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].fromArray(e,t+r*3);return this}toArray(e=[],t=0){const i=this.coefficients;for(let r=0;r<9;r++)i[r].toArray(e,t+r*3);return e}static getBasisAt(e,t){const i=e.x,r=e.y,s=e.z;t[0]=.282095,t[1]=.488603*r,t[2]=.488603*s,t[3]=.488603*i,t[4]=1.092548*i*r,t[5]=1.092548*r*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*i*s,t[8]=.546274*(i*i-r*r)}}class YZ extends hf{constructor(e=new XZ,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}fromJSON(e){return this.intensity=e.intensity,this.sh.fromArray(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class oM extends Hs{constructor(e){super(e),this.textures={}}load(e,t,i,r){const s=this,o=new lu(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=this.textures;function i(s){return t[s]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",s),t[s]}const r=oM.createMaterialFromType(e.type);if(e.uuid!==void 0&&(r.uuid=e.uuid),e.name!==void 0&&(r.name=e.name),e.color!==void 0&&r.color!==void 0&&r.color.setHex(e.color),e.roughness!==void 0&&(r.roughness=e.roughness),e.metalness!==void 0&&(r.metalness=e.metalness),e.sheen!==void 0&&(r.sheen=e.sheen),e.sheenColor!==void 0&&(r.sheenColor=new et().setHex(e.sheenColor)),e.sheenRoughness!==void 0&&(r.sheenRoughness=e.sheenRoughness),e.emissive!==void 0&&r.emissive!==void 0&&r.emissive.setHex(e.emissive),e.specular!==void 0&&r.specular!==void 0&&r.specular.setHex(e.specular),e.specularIntensity!==void 0&&(r.specularIntensity=e.specularIntensity),e.specularColor!==void 0&&r.specularColor!==void 0&&r.specularColor.setHex(e.specularColor),e.shininess!==void 0&&(r.shininess=e.shininess),e.clearcoat!==void 0&&(r.clearcoat=e.clearcoat),e.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=e.clearcoatRoughness),e.iridescence!==void 0&&(r.iridescence=e.iridescence),e.iridescenceIOR!==void 0&&(r.iridescenceIOR=e.iridescenceIOR),e.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=e.iridescenceThicknessRange),e.transmission!==void 0&&(r.transmission=e.transmission),e.thickness!==void 0&&(r.thickness=e.thickness),e.attenuationDistance!==void 0&&(r.attenuationDistance=e.attenuationDistance),e.attenuationColor!==void 0&&r.attenuationColor!==void 0&&r.attenuationColor.setHex(e.attenuationColor),e.anisotropy!==void 0&&(r.anisotropy=e.anisotropy),e.anisotropyRotation!==void 0&&(r.anisotropyRotation=e.anisotropyRotation),e.fog!==void 0&&(r.fog=e.fog),e.flatShading!==void 0&&(r.flatShading=e.flatShading),e.blending!==void 0&&(r.blending=e.blending),e.combine!==void 0&&(r.combine=e.combine),e.side!==void 0&&(r.side=e.side),e.shadowSide!==void 0&&(r.shadowSide=e.shadowSide),e.opacity!==void 0&&(r.opacity=e.opacity),e.transparent!==void 0&&(r.transparent=e.transparent),e.alphaTest!==void 0&&(r.alphaTest=e.alphaTest),e.alphaHash!==void 0&&(r.alphaHash=e.alphaHash),e.depthFunc!==void 0&&(r.depthFunc=e.depthFunc),e.depthTest!==void 0&&(r.depthTest=e.depthTest),e.depthWrite!==void 0&&(r.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(r.colorWrite=e.colorWrite),e.blendSrc!==void 0&&(r.blendSrc=e.blendSrc),e.blendDst!==void 0&&(r.blendDst=e.blendDst),e.blendEquation!==void 0&&(r.blendEquation=e.blendEquation),e.blendSrcAlpha!==void 0&&(r.blendSrcAlpha=e.blendSrcAlpha),e.blendDstAlpha!==void 0&&(r.blendDstAlpha=e.blendDstAlpha),e.blendEquationAlpha!==void 0&&(r.blendEquationAlpha=e.blendEquationAlpha),e.blendColor!==void 0&&r.blendColor!==void 0&&r.blendColor.setHex(e.blendColor),e.blendAlpha!==void 0&&(r.blendAlpha=e.blendAlpha),e.stencilWriteMask!==void 0&&(r.stencilWriteMask=e.stencilWriteMask),e.stencilFunc!==void 0&&(r.stencilFunc=e.stencilFunc),e.stencilRef!==void 0&&(r.stencilRef=e.stencilRef),e.stencilFuncMask!==void 0&&(r.stencilFuncMask=e.stencilFuncMask),e.stencilFail!==void 0&&(r.stencilFail=e.stencilFail),e.stencilZFail!==void 0&&(r.stencilZFail=e.stencilZFail),e.stencilZPass!==void 0&&(r.stencilZPass=e.stencilZPass),e.stencilWrite!==void 0&&(r.stencilWrite=e.stencilWrite),e.wireframe!==void 0&&(r.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(r.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(r.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(r.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(r.rotation=e.rotation),e.linewidth!==void 0&&(r.linewidth=e.linewidth),e.dashSize!==void 0&&(r.dashSize=e.dashSize),e.gapSize!==void 0&&(r.gapSize=e.gapSize),e.scale!==void 0&&(r.scale=e.scale),e.polygonOffset!==void 0&&(r.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(r.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(r.polygonOffsetUnits=e.polygonOffsetUnits),e.dithering!==void 0&&(r.dithering=e.dithering),e.alphaToCoverage!==void 0&&(r.alphaToCoverage=e.alphaToCoverage),e.premultipliedAlpha!==void 0&&(r.premultipliedAlpha=e.premultipliedAlpha),e.forceSinglePass!==void 0&&(r.forceSinglePass=e.forceSinglePass),e.visible!==void 0&&(r.visible=e.visible),e.toneMapped!==void 0&&(r.toneMapped=e.toneMapped),e.userData!==void 0&&(r.userData=e.userData),e.vertexColors!==void 0&&(typeof e.vertexColors=="number"?r.vertexColors=e.vertexColors>0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new et().setHex(o.value);break;case"v2":r.uniforms[s].value=new Me().fromArray(o.value);break;case"v3":r.uniforms[s].value=new K().fromArray(o.value);break;case"v4":r.uniforms[s].value=new mn().fromArray(o.value);break;case"m3":r.uniforms[s].value=new Nt().fromArray(o.value);break;case"m4":r.uniforms[s].value=new wt().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new Me().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapRotation!==void 0&&r.envMapRotation.fromArray(e.envMapRotation),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new Me().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:PZ,SpriteMaterial:nU,RawShaderMaterial:CZ,ShaderMaterial:zs,PointsMaterial:rU,MeshPhysicalMaterial:IZ,MeshStandardMaterial:hU,MeshPhongMaterial:RZ,MeshToonMaterial:NZ,MeshNormalMaterial:DZ,MeshLambertMaterial:OZ,MeshDepthMaterial:ZL,MeshDistanceMaterial:JL,MeshBasicMaterial:cf,MeshMatcapMaterial:LZ,LineDashedMaterial:UZ,LineBasicMaterial:ds,Material:jr};return new t[e]}}class jN{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i<r;i++)t+=String.fromCharCode(e[i]);try{return decodeURIComponent(escape(t))}catch{return t}}static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class QZ extends Ft{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class ZZ extends Hs{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new lu(s.manager);o.setPath(s.path),o.setRequestHeader(s.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t={},i={};function r(m,g){if(t[g]!==void 0)return t[g];const w=m.interleavedBuffers[g],y=s(m,w.buffer),_=og(w.type,y),x=new H2(_,w.stride);return x.uuid=w.uuid,t[g]=x,x}function s(m,g){if(i[g]!==void 0)return i[g];const w=m.arrayBuffers[g],y=new Uint32Array(w).buffer;return i[g]=y,y}const o=e.isInstancedBufferGeometry?new QZ:new Ft,a=e.data.index;if(a!==void 0){const m=og(a.type,a.array);o.setIndex(new wn(m,1))}const l=e.data.attributes;for(const m in l){const g=l[m];let v;if(g.isInterleavedBufferAttribute){const w=r(e.data,g.data);v=new gp(w,g.itemSize,g.offset,g.normalized)}else{const w=og(g.type,g.array),y=g.isInstancedBufferAttribute?$0:wn;v=new y(w,g.itemSize,g.normalized)}g.name!==void 0&&(v.name=g.name),g.usage!==void 0&&v.setUsage(g.usage),o.setAttribute(m,v)}const c=e.data.morphAttributes;if(c)for(const m in c){const g=c[m],v=[];for(let w=0,y=g.length;w<y;w++){const _=g[w];let x;if(_.isInterleavedBufferAttribute){const S=r(e.data,_.data);x=new gp(S,_.itemSize,_.offset,_.normalized)}else{const S=og(_.type,_.array);x=new wn(S,_.itemSize,_.normalized)}_.name!==void 0&&(x.name=_.name),v.push(x)}o.morphAttributes[m]=v}e.data.morphTargetsRelative&&(o.morphTargetsRelative=!0);const h=e.data.groups||e.data.drawcalls||e.data.offsets;if(h!==void 0)for(let m=0,g=h.length;m!==g;++m){const v=h[m];o.addGroup(v.start,v.count,v.materialIndex)}const f=e.data.boundingSphere;if(f!==void 0){const m=new K;f.center!==void 0&&m.fromArray(f.center),o.boundingSphere=new $r(m,f.radius)}return e.name&&(o.name=e.name),e.userData&&(o.userData=e.userData),o}}class tBe extends Hs{constructor(e){super(e)}load(e,t,i,r){const s=this,o=this.path===""?jN.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||o;const a=new lu(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){let c=null;try{c=JSON.parse(l)}catch(h){r!==void 0&&r(h),console.error("THREE:ObjectLoader: Can't parse "+e+".",h.message);return}const u=c.metadata;if(u===void 0||u.type===void 0||u.type.toLowerCase()==="geometry"){r!==void 0&&r(new Error("THREE.ObjectLoader: Can't load "+e)),console.error("THREE.ObjectLoader: Can't load "+e);return}s.parse(c,t)},i,r)}async loadAsync(e,t){const i=this,r=this.path===""?jN.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||r;const s=new lu(this.manager);s.setPath(this.path),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials);const o=await s.loadAsync(e,t),a=JSON.parse(o),l=a.metadata;if(l===void 0||l.type===void 0||l.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+e);return await i.parseAsync(a)}parse(e,t){const i=this.parseAnimations(e.animations),r=this.parseShapes(e.shapes),s=this.parseGeometries(e.geometries,r),o=this.parseImages(e.images,function(){t!==void 0&&t(c)}),a=this.parseTextures(e.textures,o),l=this.parseMaterials(e.materials,a),c=this.parseObject(e.object,s,l,a,i),u=this.parseSkeletons(e.skeletons,c);if(this.bindSkeletons(c,u),t!==void 0){let h=!1;for(const f in o)if(o[f].data instanceof HTMLImageElement){h=!0;break}h===!1&&t(c)}return c}async parseAsync(e){const t=this.parseAnimations(e.animations),i=this.parseShapes(e.shapes),r=this.parseGeometries(e.geometries,i),s=await this.parseImagesAsync(e.images),o=this.parseTextures(e.textures,s),a=this.parseMaterials(e.materials,o),l=this.parseObject(e.object,r,a,o,t),c=this.parseSkeletons(e.skeletons,l);return this.bindSkeletons(l,c),l}parseShapes(e){const t={};if(e!==void 0)for(let i=0,r=e.length;i<r;i++){const s=new Jd().fromJSON(e[i]);t[s.uuid]=s}return t}parseSkeletons(e,t){const i={},r={};if(t.traverse(function(s){s.isBone&&(r[s.uuid]=s)}),e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=new $2().fromJSON(e[s],r);i[a.uuid]=a}return i}parseGeometries(e,t){const i={};if(e!==void 0){const r=new ZZ;for(let s=0,o=e.length;s<o;s++){let a;const l=e[s];switch(l.type){case"BufferGeometry":case"InstancedBufferGeometry":a=r.parse(l);break;default:l.type in AH?a=AH[l.type].fromJSON(l,t):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${l.type}"`)}a.uuid=l.uuid,l.name!==void 0&&(a.name=l.name),l.userData!==void 0&&(a.userData=l.userData),i[l.uuid]=a}}return i}parseMaterials(e,t){const i={},r={};if(e!==void 0){const s=new oM;s.setTextures(t);for(let o=0,a=e.length;o<a;o++){const l=e[o];i[l.uuid]===void 0&&(i[l.uuid]=s.parse(l)),r[l.uuid]=i[l.uuid]}}return r}parseAnimations(e){const t={};if(e!==void 0)for(let i=0;i<e.length;i++){const r=e[i],s=v1.parse(r);t[s.uuid]=s}return t}parseImages(e,t){const i=this,r={};let s;function o(l){return i.manager.itemStart(l),s.load(l,function(){i.manager.itemEnd(l)},void 0,function(){i.manager.itemError(l),i.manager.itemEnd(l)})}function a(l){if(typeof l=="string"){const c=l,u=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c)?c:i.resourcePath+c;return o(u)}else return l.data?{data:og(l.type,l.data),width:l.width,height:l.height}:null}if(e!==void 0&&e.length>0){const l=new mU(t);s=new w1(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c<u;c++){const h=e[c],f=h.url;if(Array.isArray(f)){const m=[];for(let g=0,v=f.length;g<v;g++){const w=f[g],y=a(w);y!==null&&(y instanceof HTMLImageElement?m.push(y):m.push(new Xc(y.data,y.width,y.height)))}r[h.uuid]=new bd(m)}else{const m=a(h.url);r[h.uuid]=new bd(m)}}}return r}async parseImagesAsync(e){const t=this,i={};let r;async function s(o){if(typeof o=="string"){const a=o,l=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(a)?a:t.resourcePath+a;return await r.loadAsync(l)}else return o.data?{data:og(o.type,o.data),width:o.width,height:o.height}:null}if(e!==void 0&&e.length>0){r=new w1(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o<a;o++){const l=e[o],c=l.url;if(Array.isArray(c)){const u=[];for(let h=0,f=c.length;h<f;h++){const m=c[h],g=await s(m);g!==null&&(g instanceof HTMLImageElement?u.push(g):u.push(new Xc(g.data,g.width,g.height)))}i[l.uuid]=new bd(u)}else{const u=await s(l.url);i[l.uuid]=new bd(u)}}}return i}parseTextures(e,t){function i(s,o){return typeof s=="number"?s:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",s),o[s])}const r={};if(e!==void 0)for(let s=0,o=e.length;s<o;s++){const a=e[s];a.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',a.uuid),t[a.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",a.image);const l=t[a.image],c=l.data;let u;Array.isArray(c)?(u=new lx,c.length===6&&(u.needsUpdate=!0)):(c&&c.data?u=new Xc:u=new zn,c&&(u.needsUpdate=!0)),u.source=l,u.uuid=a.uuid,a.name!==void 0&&(u.name=a.name),a.mapping!==void 0&&(u.mapping=i(a.mapping,nBe)),a.channel!==void 0&&(u.channel=a.channel),a.offset!==void 0&&u.offset.fromArray(a.offset),a.repeat!==void 0&&u.repeat.fromArray(a.repeat),a.center!==void 0&&u.center.fromArray(a.center),a.rotation!==void 0&&(u.rotation=a.rotation),a.wrap!==void 0&&(u.wrapS=i(a.wrap[0],CH),u.wrapT=i(a.wrap[1],CH)),a.format!==void 0&&(u.format=a.format),a.internalFormat!==void 0&&(u.internalFormat=a.internalFormat),a.type!==void 0&&(u.type=a.type),a.colorSpace!==void 0&&(u.colorSpace=a.colorSpace),a.minFilter!==void 0&&(u.minFilter=i(a.minFilter,IH)),a.magFilter!==void 0&&(u.magFilter=i(a.magFilter,IH)),a.anisotropy!==void 0&&(u.anisotropy=a.anisotropy),a.flipY!==void 0&&(u.flipY=a.flipY),a.generateMipmaps!==void 0&&(u.generateMipmaps=a.generateMipmaps),a.premultiplyAlpha!==void 0&&(u.premultiplyAlpha=a.premultiplyAlpha),a.unpackAlignment!==void 0&&(u.unpackAlignment=a.unpackAlignment),a.compareFunction!==void 0&&(u.compareFunction=a.compareFunction),a.userData!==void 0&&(u.userData=a.userData),r[a.uuid]=u}return r}parseObject(e,t,i,r,s){let o;function a(f){return t[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",f),t[f]}function l(f){if(f!==void 0){if(Array.isArray(f)){const m=[];for(let g=0,v=f.length;g<v;g++){const w=f[g];i[w]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",w),m.push(i[w])}return m}return i[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",f),i[f]}}function c(f){return r[f]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",f),r[f]}let u,h;switch(e.type){case"Scene":o=new tU,e.background!==void 0&&(Number.isInteger(e.background)?o.background=new et(e.background):o.background=c(e.background)),e.environment!==void 0&&(o.environment=c(e.environment)),e.fog!==void 0&&(e.fog.type==="Fog"?o.fog=new V2(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(o.fog=new z2(e.fog.color,e.fog.density)),e.fog.name!==""&&(o.fog.name=e.fog.name)),e.backgroundBlurriness!==void 0&&(o.backgroundBlurriness=e.backgroundBlurriness),e.backgroundIntensity!==void 0&&(o.backgroundIntensity=e.backgroundIntensity),e.backgroundRotation!==void 0&&o.backgroundRotation.fromArray(e.backgroundRotation),e.environmentRotation!==void 0&&o.environmentRotation.fromArray(e.environmentRotation);break;case"PerspectiveCamera":o=new Ki(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(o.focus=e.focus),e.zoom!==void 0&&(o.zoom=e.zoom),e.filmGauge!==void 0&&(o.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(o.filmOffset=e.filmOffset),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"OrthographicCamera":o=new ux(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(o.zoom=e.zoom),e.view!==void 0&&(o.view=Object.assign({},e.view));break;case"AmbientLight":o=new qZ(e.color,e.intensity);break;case"DirectionalLight":o=new WZ(e.color,e.intensity);break;case"PointLight":o=new jZ(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":o=new KZ(e.color,e.intensity,e.width,e.height);break;case"SpotLight":o=new GZ(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":o=new $Z(e.color,e.groundColor,e.intensity);break;case"LightProbe":o=new YZ().fromJSON(e);break;case"SkinnedMesh":u=a(e.geometry),h=l(e.material),o=new dZ(u,h),e.bindMode!==void 0&&(o.bindMode=e.bindMode),e.bindMatrix!==void 0&&o.bindMatrix.fromArray(e.bindMatrix),e.skeleton!==void 0&&(o.skeleton=e.skeleton);break;case"Mesh":u=a(e.geometry),h=l(e.material),o=new Ai(u,h);break;case"InstancedMesh":u=a(e.geometry),h=l(e.material);const f=e.count,m=e.instanceMatrix,g=e.instanceColor;o=new pZ(u,h,f),o.instanceMatrix=new $0(new Float32Array(m.array),16),g!==void 0&&(o.instanceColor=new $0(new Float32Array(g.array),g.itemSize));break;case"BatchedMesh":u=a(e.geometry),h=l(e.material),o=new mZ(e.maxGeometryCount,e.maxVertexCount,e.maxIndexCount,h),o.geometry=u,o.perObjectFrustumCulled=e.perObjectFrustumCulled,o.sortObjects=e.sortObjects,o._drawRanges=e.drawRanges,o._reservedRanges=e.reservedRanges,o._visibility=e.visibility,o._active=e.active,o._bounds=e.bounds.map(v=>{const w=new us;w.min.fromArray(v.boxMin),w.max.fromArray(v.boxMax);const y=new $r;return y.radius=v.sphereRadius,y.center.fromArray(v.sphereCenter),{boxInitialized:v.boxInitialized,box:w,sphereInitialized:v.sphereInitialized,sphere:y}}),o._maxGeometryCount=e.maxGeometryCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid);break;case"LOD":o=new fZ;break;case"Line":o=new Qh(a(e.geometry),l(e.material));break;case"LineLoop":o=new gZ(a(e.geometry),l(e.material));break;case"LineSegments":o=new $l(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new yZ(a(e.geometry),l(e.material));break;case"Sprite":o=new hZ(l(e.material));break;case"Group":o=new cg;break;case"Bone":o=new iU;break;default:o=new ln}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const f=e.children;for(let m=0;m<f.length;m++)o.add(this.parseObject(f[m],t,i,r,s))}if(e.animations!==void 0){const f=e.animations;for(let m=0;m<f.length;m++){const g=f[m];o.animations.push(s[g])}}if(e.type==="LOD"){e.autoUpdate!==void 0&&(o.autoUpdate=e.autoUpdate);const f=e.levels;for(let m=0;m<f.length;m++){const g=f[m],v=o.getObjectByProperty("uuid",g.object);v!==void 0&&o.addLevel(v,g.distance,g.hysteresis)}}return o}bindSkeletons(e,t){Object.keys(t).length!==0&&e.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const r=t[i.skeleton];r===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",i.skeleton):i.bind(r,i.bindMatrix)}})}}const nBe={UVMapping:O2,CubeReflectionMapping:au,CubeRefractionMapping:Yh,EquirectangularReflectionMapping:e1,EquirectangularRefractionMapping:t1,CubeUVReflectionMapping:ny},CH={RepeatWrapping:pp,ClampToEdgeWrapping:Fr,MirroredRepeatWrapping:n1},IH={NearestFilter:hi,NearestMipmapNearestFilter:dA,NearestMipmapLinearFilter:nd,LinearFilter:On,LinearMipmapNearestFilter:sw,LinearMipmapLinearFilter:Il};class iBe extends Hs{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=zc.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{r&&r(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return zc.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),zc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});zc.add(e,l),s.manager.itemStart(e)}}let tE;class yU{static getContext(){return tE===void 0&&(tE=new(window.AudioContext||window.webkitAudioContext)),tE}static setContext(e){tE=e}}class rBe extends Hs{constructor(e){super(e)}load(e,t,i,r){const s=this,o=new lu(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);yU.getContext().decodeAudioData(c,function(h){t(h)}).catch(a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const RH=new wt,NH=new wt,Bf=new wt;class sBe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Ki,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Ki,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Bf.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,o=t.near*Math.tan(Qd*t.fov*.5)/t.zoom;let a,l;NH.elements[12]=-r,RH.elements[12]=r,a=-o*t.aspect+s,l=o*t.aspect+s,Bf.elements[0]=2*t.near/(l-a),Bf.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Bf),a=-o*t.aspect-s,l=o*t.aspect-s,Bf.elements[0]=2*t.near/(l-a),Bf.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Bf)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(NH),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(RH)}}class vU{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=DH(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=DH();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function DH(){return(typeof performance>"u"?Date:performance).now()}const kf=new K,OH=new ks,oBe=new K,Ff=new K;class aBe extends ln{constructor(){super(),this.type="AudioListener",this.context=yU.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new vU}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(kf,OH,oBe),Ff.set(0,0,-1).applyQuaternion(OH),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(kf.x,r),t.positionY.linearRampToValueAtTime(kf.y,r),t.positionZ.linearRampToValueAtTime(kf.z,r),t.forwardX.linearRampToValueAtTime(Ff.x,r),t.forwardY.linearRampToValueAtTime(Ff.y,r),t.forwardZ.linearRampToValueAtTime(Ff.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(kf.x,kf.y,kf.z),t.setOrientation(Ff.x,Ff.y,Ff.z,i.x,i.y,i.z)}}class JZ extends ln{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),this._connected===!0?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){return this.detune=e,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}const zf=new K,LH=new ks,lBe=new K,Vf=new K;class cBe extends JZ{constructor(e){super(e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){super.connect(),this.panner.connect(this.gain)}disconnect(){super.disconnect(),this.panner.disconnect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(e){return this.panner.refDistance=e,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(e){return this.panner.rolloffFactor=e,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(e){return this.panner.distanceModel=e,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(e){return this.panner.maxDistance=e,this}setDirectionalCone(e,t,i){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=i,this}updateMatrixWorld(e){if(super.updateMatrixWorld(e),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(zf,LH,lBe),Vf.set(0,0,1).applyQuaternion(LH);const t=this.panner;if(t.positionX){const i=this.context.currentTime+this.listener.timeDelta;t.positionX.linearRampToValueAtTime(zf.x,i),t.positionY.linearRampToValueAtTime(zf.y,i),t.positionZ.linearRampToValueAtTime(zf.z,i),t.orientationX.linearRampToValueAtTime(Vf.x,i),t.orientationY.linearRampToValueAtTime(Vf.y,i),t.orientationZ.linearRampToValueAtTime(Vf.z,i)}else t.setPosition(zf.x,zf.y,zf.z),t.setOrientation(Vf.x,Vf.y,Vf.z)}}class uBe{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let i=0;i<t.length;i++)e+=t[i];return e/t.length}}class eJ{constructor(e,t,i){this.binding=e,this.valueSize=i;let r,s,o;switch(t){case"quaternion":r=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":r=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:r=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=r,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const i=this.buffer,r=this.valueSize,s=e*r+r;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==r;++a)i[s+a]=i[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(i,s,0,a,r)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,i=this.valueSize,r=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,r,0,e,i),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,i=this.buffer,r=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(i,r,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,o=r;s!==o;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i<t;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[t+i]=this.buffer[e+i]}_select(e,t,i,r,s){if(r>=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){ks.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;ks.multiplyQuaternionsFlat(e,o,e,t,e,i),ks.slerpFlat(e,t,e,t,e,o,r)}_lerp(e,t,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,t,i,r,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[i+o]*r}}}const wU="\\[\\]\\.:\\/",hBe=new RegExp("["+wU+"]","g"),xU="[^"+wU+"]",fBe="[^"+wU.replace("\\.","")+"]",dBe=/((?:WC+[\/:])*)/.source.replace("WC",xU),pBe=/(WCOD+)?/.source.replace("WCOD",fBe),mBe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",xU),gBe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",xU),yBe=new RegExp("^"+dBe+pBe+mBe+gBe+"$"),vBe=["material","materials","bones","map"];class wBe{constructor(e,t,i){const r=i||Zt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class Zt{constructor(e,t,i){this.path=t,this.parsedPath=i||Zt.parseTrackName(t),this.node=Zt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new Zt.Composite(e,t,i):new Zt(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(hBe,"")}static parseTrackName(e){const t=yBe.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);vBe.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o<s.length;o++){const a=s[o];if(a.name===t||a.uuid===t)return a;const l=i(a.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,i=t.objectName,r=t.propertyName;let s=t.propertyIndex;if(e||(e=Zt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let c=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===c){c=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(c!==void 0){if(e[c]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[c]}}const o=e[r];if(o===void 0){const c=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+c+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let l=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}l=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(l=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(l=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[l],this.setValue=this.SetterByBindingTypeAndVersioning[l][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Zt.Composite=wBe;Zt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Zt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Zt.prototype.GetterByBindingType=[Zt.prototype._getValue_direct,Zt.prototype._getValue_array,Zt.prototype._getValue_arrayElement,Zt.prototype._getValue_toArray];Zt.prototype.SetterByBindingTypeAndVersioning=[[Zt.prototype._setValue_direct,Zt.prototype._setValue_direct_setNeedsUpdate,Zt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Zt.prototype._setValue_array,Zt.prototype._setValue_array_setNeedsUpdate,Zt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Zt.prototype._setValue_arrayElement,Zt.prototype._setValue_arrayElement_setNeedsUpdate,Zt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Zt.prototype._setValue_fromArray,Zt.prototype._setValue_fromArray_setNeedsUpdate,Zt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class xBe{constructor(){this.isAnimationObjectGroup=!0,this.uuid=go(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const e={};this._indicesByUUID=e;for(let i=0,r=arguments.length;i!==r;++i)e[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const t=this;this.stats={objects:{get total(){return t._objects.length},get inUse(){return this.total-t.nCachedObjects_}},get bindingsPerObject(){return t._bindings.length}}}add(){const e=this._objects,t=this._indicesByUUID,i=this._paths,r=this._parsedPaths,s=this._bindings,o=s.length;let a,l=e.length,c=this.nCachedObjects_;for(let u=0,h=arguments.length;u!==h;++u){const f=arguments[u],m=f.uuid;let g=t[m];if(g===void 0){g=l++,t[m]=g,e.push(f);for(let v=0,w=o;v!==w;++v)s[v].push(new Zt(f,i[v],r[v]))}else if(g<c){a=e[g];const v=--c,w=e[v];t[w.uuid]=g,e[g]=w,t[m]=v,e[v]=f;for(let y=0,_=o;y!==_;++y){const x=s[y],S=x[v];let M=x[g];x[g]=S,M===void 0&&(M=new Zt(f,i[y],r[y])),x[v]=M}}else e[g]!==a&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=c}remove(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_;for(let o=0,a=arguments.length;o!==a;++o){const l=arguments[o],c=l.uuid,u=t[c];if(u!==void 0&&u>=s){const h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let m=0,g=r;m!==g;++m){const v=i[m],w=v[h],y=v[u];v[u]=w,v[h]=y}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h<s){const f=--s,m=e[f],g=--o,v=e[g];t[m.uuid]=h,e[h]=m,t[v.uuid]=f,e[f]=v,e.pop();for(let w=0,y=r;w!==y;++w){const _=i[w],x=_[f],S=_[g];_[h]=x,_[f]=S,_.pop()}}else{const f=--o,m=e[f];f>0&&(t[m.uuid]=h),e[h]=m,e.pop();for(let g=0,v=r;g!==v;++g){const w=i[g];w[h]=w[f],w.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);r=s.length,i[e]=r,o.push(e),a.push(t),s.push(h);for(let f=u,m=l.length;f!==m;++f){const g=l[f];h[f]=new Zt(g,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class tJ{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:wd,endingEnd:wd};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=OQ,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/o,c[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case $L:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case U2:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(r,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===LQ;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===DQ){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=t||r<0){const a=Math.floor(r/t);r-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=xd,r.endingEnd=xd):(e?r.endingStart=this.zeroSlopeAtStart?xd:wd:r.endingStart=s1,t?r.endingEnd=this.zeroSlopeAtEnd?xd:wd:r.endingEnd=s1)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=i,this}}const bBe=new Float32Array(1);class _Be extends fu{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const f=r[h],m=f.name;let g=u[m];if(g!==void 0)++g.referenceCount,o[h]=g;else{if(g=o[h],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,l,m));continue}const v=t&&t._propertyBindings[h].binding.parsedPath;g=new eJ(Zt.create(i,m,v),f.ValueTypeName,f.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,l,m),o[h]=g}a[h].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,i){const r=this._actions,s=this._actionsByClip;let o=s[t];if(o===void 0)o={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=o;else{const a=o.knownActions;e._byClipCacheIndex=a.length,a.push(e)}e._cacheIndex=r.length,r.push(e),o.actionByRoot[i]=e}_removeInactiveAction(e){const t=this._actions,i=t[t.length-1],r=e._cacheIndex;i._cacheIndex=r,t[r]=i,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,o=this._actionsByClip,a=o[s],l=a.knownActions,c=l[l.length-1],u=e._byClipCacheIndex;c._byClipCacheIndex=u,l[u]=c,l.pop(),e._byClipCacheIndex=null;const h=a.actionByRoot,f=(e._localRoot||this._root).uuid;delete h[f],l.length===0&&delete o[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,i=e._cacheIndex,r=this._nActiveActions++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackAction(e){const t=this._actions,i=e._cacheIndex,r=--this._nActiveActions,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_addInactiveBinding(e,t,i){const r=this._bindingsByRootAndName,s=this._bindings;let o=r[t];o===void 0&&(o={},r[t]=o),o[i]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,i=e.binding,r=i.rootNode.uuid,s=i.path,o=this._bindingsByRootAndName,a=o[r],l=t[t.length-1],c=e._cacheIndex;l._cacheIndex=c,t[c]=l,t.pop(),delete a[s],Object.keys(a).length===0&&delete o[r]}_lendBinding(e){const t=this._bindings,i=e._cacheIndex,r=this._nActiveBindings++,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_takeBackBinding(e){const t=this._bindings,i=e._cacheIndex,r=--this._nActiveBindings,s=t[r];e._cacheIndex=r,t[r]=e,s._cacheIndex=i,t[i]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let i=e[t];return i===void 0&&(i=new dU(new Float32Array(2),new Float32Array(2),1,bBe),i.__cacheIndex=t,e[t]=i),i}_takeBackControlInterpolant(e){const t=this._controlInterpolants,i=e.__cacheIndex,r=--this._nActiveControlInterpolants,s=t[r];e.__cacheIndex=r,t[r]=e,s.__cacheIndex=i,t[i]=s}clipAction(e,t,i){const r=t||this._root,s=r.uuid;let o=typeof e=="string"?v1.findByName(r,e):e;const a=o!==null?o.uuid:e,l=this._actionsByClip[a];let c=null;if(i===void 0&&(o!==null?i=o.blendMode:i=U2),l!==void 0){const h=l.actionByRoot[s];if(h!==void 0&&h.blendMode===i)return h;c=l.knownActions[0],o===null&&(o=c._clip)}if(o===null)return null;const u=new tJ(this,o,t,i);return this._bindAction(u,c),this._addInactiveAction(u,a,s),u}existingAction(e,t){const i=t||this._root,r=i.uuid,s=typeof e=="string"?v1.findByName(i,e):e,o=s?s.uuid:e,a=this._actionsByClip[o];return a!==void 0&&a.actionByRoot[r]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let i=t-1;i>=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,i=e.uuid,r=this._actionsByClip,s=r[i];if(s!==void 0){const o=s.knownActions;for(let a=0,l=o.length;a!==l;++a){const c=o[a];this._deactivateAction(c);const u=c._cacheIndex,h=t[t.length-1];c._cacheIndex=null,c._byClipCacheIndex=null,h._cacheIndex=u,t[u]=h,t.pop(),this._removeInactiveBindingsForAction(c)}delete r[i]}}uncacheRoot(e){const t=e.uuid,i=this._actionsByClip;for(const o in i){const a=i[o].actionByRoot,l=a[t];l!==void 0&&(this._deactivateAction(l),this._removeInactiveAction(l))}const r=this._bindingsByRootAndName,s=r[t];if(s!==void 0)for(const o in s){const a=s[o];a.restoreOriginalState(),this._removeInactiveBinding(a)}}uncacheAction(e,t){const i=this.existingAction(e,t);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class bU{constructor(e){this.value=e}clone(){return new bU(this.value.clone===void 0?this.value:this.value.clone())}}let EBe=0;class SBe extends fu{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:EBe++}),this.name="",this.usage=c1,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){return this.dispatchEvent({type:"dispose"}),this}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let i=0,r=t.length;i<r;i++){const s=Array.isArray(t[i])?t[i]:[t[i]];for(let o=0;o<s.length;o++)this.uniforms.push(s[o].clone())}return this}clone(){return new this.constructor().copy(this)}}class ABe extends H2{constructor(e,t,i=1){super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class MBe{constructor(e,t,i,r,s){this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=i,this.elementSize=r,this.count=s,this.version=0}set needsUpdate(e){e===!0&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const UH=new wt;class nJ{constructor(e,t,i=0,r=1/0){this.ray=new iy(e,t),this.near=i,this.far=r,this.camera=null,this.layers=new Zd,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):console.error("THREE.Raycaster: 
4006Unsupported camera type: "+t.type)}setFromXRController(e){return UH.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(UH),this}intersectObject(e,t=!0,i=[]){return WN(e,this,i,t),i.sort(BH),i}intersectObjects(e,t=!0,i=[]){for(let r=0,s=e.length;r<s;r++)WN(e[r],this,i,t);return i.sort(BH),i}}function BH(n,e){return n.distance-e.distance}function WN(n,e,t,i){if(n.layers.test(e.layers)&&n.raycast(e,t),i===!0){const r=n.children;for(let s=0,o=r.length;s<o;s++)WN(r[s],e,t,!0)}}class iJ{constructor(e=1,t=0,i=0){return this.radius=e,this.phi=t,this.theta=i,this}set(e,t,i){return this.radius=e,this.phi=t,this.theta=i,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+t*t+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,i),this.phi=Math.acos(ii(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class TBe{constructor(e=1,t=0,i=0){return this.radius=e,this.theta=t,this.y=i,this}set(e,t,i){return this.radius=e,this.theta=t,this.y=i,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,i){return this.radius=Math.sqrt(e*e+i*i),this.theta=Math.atan2(e,i),this.y=t,this}clone(){return new this.constructor().copy(this)}}const kH=new Me;class PBe{constructor(e=new Me(1/0,1/0),t=new Me(-1/0,-1/0)){this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const i=kH.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}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=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(e){return this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(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}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,kH).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const FH=new K,nE=new K;class CBe{constructor(e=new K,t=new K){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){FH.subVectors(e,this.start),nE.subVectors(this.end,this.start);const i=nE.dot(nE);let s=nE.dot(FH)/i;return t&&(s=ii(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}
vendor: 10,149 bytes, line 4006
4006applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const zH=new K;class IBe extends ln{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new Ft,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o<l;o++,a++){const c=o/l*Math.PI*2,u=a/l*Math.PI*2;r.push(Math.cos(c),Math.sin(c),1,Math.cos(u),Math.sin(u),1)}i.setAttribute("position",new at(r,3));const s=new ds({fog:!1,toneMapped:!1});this.cone=new $l(i,s),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const e=this.light.distance?this.light.distance:1e3,t=e*Math.tan(this.light.angle);this.cone.scale.set(t,t,e),zH.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(zH),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const qu=new K,iE=new wt,n3=new wt;class RBe extends $l{constructor(e){const t=rJ(e),i=new Ft,r=[],s=[],o=new et(0,0,1),a=new et(0,1,0);for(let c=0;c<t.length;c++){const u=t[c];u.parent&&u.parent.isBone&&(r.push(0,0,0),r.push(0,0,0),s.push(o.r,o.g,o.b),s.push(a.r,a.g,a.b))}i.setAttribute("position",new at(r,3)),i.setAttribute("color",new at(s,3));const l=new ds({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,l),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(e){const t=this.bones,i=this.geometry,r=i.getAttribute("position");n3.copy(this.root.matrixWorld).invert();for(let s=0,o=0;s<t.length;s++){const a=t[s];a.parent&&a.parent.isBone&&(iE.multiplyMatrices(n3,a.matrixWorld),qu.setFromMatrixPosition(iE),r.setXYZ(o,qu.x,qu.y,qu.z),iE.multiplyMatrices(n3,a.parent.matrixWorld),qu.setFromMatrixPosition(iE),r.setXYZ(o+1,qu.x,qu.y,qu.z),o+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose()}}function rJ(n){const e=[];n.isBone===!0&&e.push(n);for(let t=0;t<n.children.length;t++)e.push.apply(e,rJ(n.children[t]));return e}class NBe extends Ai{constructor(e,t,i){const r=new dx(t,4,2),s=new cf({wireframe:!0,fog:!1,toneMapped:!1});super(r,s),this.light=e,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const DBe=new K,VH=new et,HH=new et;class OBe extends ln{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const r=new fx(t);r.rotateY(Math.PI*.5),this.material=new cf({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const s=r.getAttribute("position"),o=new Float32Array(s.count*3);r.setAttribute("color",new wn(o,3)),this.add(new Ai(r,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const e=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const t=e.geometry.getAttribute("color");VH.copy(this.light.color),HH.copy(this.light.groundColor);for(let i=0,r=t.count;i<r;i++){const s=i<r/2?VH:HH;t.setXYZ(i,s.r,s.g,s.b)}t.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),e.lookAt(DBe.setFromMatrixPosition(this.light.matrixWorld).negate())}}class LBe extends $l{constructor(e=10,t=10,i=4473924,r=8947848){i=new et(i),r=new et(r);const s=t/2,o=e/t,a=e/2,l=[],c=[];for(let f=0,m=0,g=-a;f<=t;f++,g+=o){l.push(-a,0,g,a,0,g),l.push(g,0,-a,g,0,a);const v=f===s?i:r;v.toArray(c,m),m+=3,v.toArray(c,m),m+=3,v.toArray(c,m),m+=3,v.toArray(c,m),m+=3}const u=new Ft;u.setAttribute("position",new at(l,3)),u.setAttribute("color",new at(c,3));const h=new ds({vertexColors:!0,toneMapped:!1});super(u,h),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class UBe extends $l{constructor(e=10,t=16,i=8,r=64,s=4473924,o=8947848){s=new et(s),o=new et(o);const a=[],l=[];if(t>1)for(let h=0;h<t;h++){const f=h/t*(Math.PI*2),m=Math.sin(f)*e,g=Math.cos(f)*e;a.push(0,0,0),a.push(m,0,g);const v=h&1?s:o;l.push(v.r,v.g,v.b),l.push(v.r,v.g,v.b)}for(let h=0;h<i;h++){const f=h&1?s:o,m=e-e/i*h;for(let g=0;g<r;g++){let v=g/r*(Math.PI*2),w=Math.sin(v)*m,y=Math.cos(v)*m;a.push(w,0,y),l.push(f.r,f.g,f.b),v=(g+1)/r*(Math.PI*2),w=Math.sin(v)*m,y=Math.cos(v)*m,a.push(w,0,y),l.push(f.r,f.g,f.b)}}const c=new Ft;c.setAttribute("position",new at(a,3)),c.setAttribute("color",new at(l,3));const u=new ds({vertexColors:!0,toneMapped:!1});super(c,u),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const $H=new K,rE=new K,GH=new K;class BBe extends ln{constructor(e,t,i){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",t===void 0&&(t=1);let r=new Ft;r.setAttribute("position",new at([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));const s=new ds({fog:!1,toneMapped:!1});this.lightPlane=new Qh(r,s),this.add(this.lightPlane),r=new Ft,r.setAttribute("position",new at([0,0,0,0,0,1],3)),this.targetLine=new Qh(r,s),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),$H.setFromMatrixPosition(this.light.matrixWorld),rE.setFromMatrixPosition(this.light.target.matrixWorld),GH.subVectors(rE,$H),this.lightPlane.lookAt(rE),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(rE),this.targetLine.scale.z=GH.length()}}const sE=new K,Jn=new ax;class kBe extends $l{constructor(e){const t=new Ft,i=new ds({color:16777215,vertexColors:!0,toneMapped:!1}),r=[],s=[],o={};a("n1","n2"),a("n2","n4"),a("n4","n3"),a("n3","n1"),a("f1","f2"),a("f2","f4"),a("f4","f3"),a("f3","f1"),a("n1","f1"),a("n2","f2"),a("n3","f3"),a("n4","f4"),a("p","n1"),a("p","n2"),a("p","n3"),a("p","n4"),a("u1","u2"),a("u2","u3"),a("u3","u1"),a("c","t"),a("p","c"),a("cn1","cn2"),a("cn3","cn4"),a("cf1","cf2"),a("cf3","cf4");function a(g,v){l(g),l(v)}function l(g){r.push(0,0,0),s.push(0,0,0),o[g]===void 0&&(o[g]=[]),o[g].push(r.length/3-1)}t.setAttribute("position",new at(r,3)),t.setAttribute("color",new at(s,3)),super(t,i),this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=o,this.update();const c=new et(16755200),u=new et(16711680),h=new et(43775),f=new et(16777215),m=new et(3355443);this.setColors(c,u,h,f,m)}setColors(e,t,i,r,s){const a=this.geometry.getAttribute("color");a.setXYZ(0,e.r,e.g,e.b),a.setXYZ(1,e.r,e.g,e.b),a.setXYZ(2,e.r,e.g,e.b),a.setXYZ(3,e.r,e.g,e.b),a.setXYZ(4,e.r,e.g,e.b),a.setXYZ(5,e.r,e.g,e.b),a.setXYZ(6,e.r,e.g,e.b),a.setXYZ(7,e.r,e.g,e.b),a.setXYZ(8,e.r,e.g,e.b),a.setXYZ(9,e.r,e.g,e.b),a.setXYZ(10,e.r,e.g,e.b),a.setXYZ(11,e.r,e.g,e.b),a.setXYZ(12,e.r,e.g,e.b),a.setXYZ(13,e.r,e.g,e.b),a.setXYZ(14,e.r,e.g,e.b),a.setXYZ(15,e.r,e.g,e.b),a.setXYZ(16,e.r,e.g,e.b),a.setXYZ(17,e.r,e.g,e.b),a.setXYZ(18,e.r,e.g,e.b),a.setXYZ(19,e.r,e.g,e.b),a.setXYZ(20,e.r,e.g,e.b),a.setXYZ(21,e.r,e.g,e.b),a.setXYZ(22,e.r,e.g,e.b),a.setXYZ(23,e.r,e.g,e.b),a.setXYZ(24,t.r,t.g,t.b),a.setXYZ(25,t.r,t.g,t.b),a.setXYZ(26,t.r,t.g,t.b),a.setXYZ(27,t.r,t.g,t.b),a.setXYZ(28,t.r,t.g,t.b),a.setXYZ(29,t.r,t.g,t.b),a.setXYZ(30,t.r,t.g,t.b),a.setXYZ(31,t.r,t.g,t.b),a.setXYZ(32,i.r,i.g,i.b),a.setXYZ(33,i.r,i.g,i.b),a.setXYZ(34,i.r,i.g,i.b),a.setXYZ(35,i.r,i.g,i.b),a.setXYZ(36,i.r,i.g,i.b),a.setXYZ(37,i.r,i.g,i.b),a.setXYZ(38,r.r,r.g,r.b),a.setXYZ(39,r.r,r.g,r.b),a.setXYZ(40,s.r,s.g,s.b),a.setXYZ(41,s.r,s.g,s.b),a.setXYZ(42,s.r,s.g,s.b),a.setXYZ(43,s.r,s.g,s.b),a.setXYZ(44,s.r,s.g,s.b),a.setXYZ(45,s.r,s.g,s.b),a.setXYZ(46,s.r,s.g,s.b),a.setXYZ(47,s.r,s.g,s.b),a.setXYZ(48,s.r,s.g,s.b),a.setXYZ(49,s.r,s.g,s.b),a.needsUpdate=!0}update(){const e=this.geometry,t=this.pointMap,i=1,r=1;Jn.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),li("c",t,e,Jn,0,0,-1),li("t",t,e,Jn,0,0,1),li("n1",t,e,Jn,-i,-r,-1),li("n2",t,e,Jn,i,-r,-1),li("n3",t,e,Jn,-i,r,-1),li("n4",t,e,Jn,i,r,-1),li("f1",t,e,Jn,-i,-r,1),li("f2",t,e,Jn,i,-r,1),li("f3",t,e,Jn,-i,r,1),li("f4",t,e,Jn,i,r,1),li("u1",t,e,Jn,i*.7,r*1.1,-1),li("u2",t,e,Jn,-i*.7,r*1.1,-1),li("u3",t,e,Jn,0,r*2,-1),li("cf1",t,e,Jn,-i,0,1),li("cf2",t,e,Jn,i,0,1),li("cf3",t,e,Jn,0,-r,1),li("cf4",t,e,Jn,0,r,1),li("cn1",t,e,Jn,-i,0,-1),li("cn2",t,e,Jn,i,0,-1),li("cn3",t,e,Jn,0,-r,-1),li("cn4",t,e,Jn,0,r,-1),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function li(n,e,t,i,r,s,o){sE.set(r,s,o).unproject(i);const a=e[n];if(a!==void 0){const l=t.getAttribute("position");for(let c=0,u=a.length;c<u;c++)l.setXYZ(a[c],sE.x,sE.y,sE.z)}}const oE=new us;class FBe extends $l{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=new Float32Array(8*3),s=new Ft;s.setIndex(new wn(i,1)),s.setAttribute("position",new wn(r,3)),super(s,new ds({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(e){if(e!==void 0&&console.warn("THREE.BoxHelper: .update(
4006) has no longer arguments."),this.object!==void 0&&oE.setFromObject(this.object),oE.isEmpty())return;const t=oE.min,i=oE.max,r=this.geometry.attributes.position,s=r.array;s[0]=i.x,s[1]=i.y,s[2]=i.z,s[3]=t.x,s[4]=i.y,s[5]=i.z,s[6]=t.x,s[7]=t.y,s[8]=i.z,s[9]=i.x,s[10]=t.y,s[11]=i.z,s[12]=i.x,s[13]=i.y,s[14]=t.z,s[15]=t.x,s[16]=i.y,s[17]=t.z,s[18]=t.x,s[19]=t.y,s[20]=t.z,s[21]=i.x,s[22]=t.y,s[23]=t.z,r.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class zBe extends $l{constructor(e,t=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),r=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],s=new Ft;s.setIndex(new wn(i,1)),s.setAttribute("position",new at(r,3)),super(s,new ds({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class VBe extends Qh{constructor(e,t=1,i=16776960){const r=i,s=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],o=new Ft;o.setAttribute("position",new at(s,3)),o.computeBoundingSphere(),super(o,new ds({color:r,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],l=new Ft;l.setAttribute("position",new at(a,3)),l.computeBoundingSphere(),this.add(new Ai(l,new cf({color:r,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const jH=new K;let aE,i3;class HBe extends ln{constructor(e=new K(0,0,1),t=new K(0,0,0),i=1,r=16776960,s=i*.2,o=s*.2){super(),this.type="ArrowHelper",aE===void 0&&(aE=new Ft,aE.setAttribute("position",new at([0,0,0,0,1,0],3)),i3=new oy(0,.5,1,5,1),i3.translate(0,-.5,0)),this.position.copy(t),this.line=new Qh(aE,new ds({color:r,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Ai(i3,new cf({color:r,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(i,s,o)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{jH.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(jH,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class $Be extends $l{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Ft;r.setAttribute("position",new at(t,3)),r.setAttribute("color",new at(i,3));const s=new ds({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new et,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class GBe{constructor(){this.type="ShapePath",this.color=new et,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new f1,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,o){return this.currentPath.bezierCurveTo(e,t,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(y){const _=[];for(let x=0,S=y.length;x<S;x++){const M=y[x],A=new Jd;A.curves=M.curves,_.push(A)}return _}function i(y,_){const x=_.length;let S=!1;for(let M=x-1,A=0;A<x;M=A++){let I=_[M],D=_[A],k=D.x-I.x,C=D.y-I.y;if(Math.abs(C)>Number.EPSILON){if(C<0&&(I=_[A],k=-k,D=_[M],C=-C),y.y<I.y||y.y>D.y)continue;
vendor: 5,410 bytes, line 4006
4006if(y.y===I.y){if(y.x===I.x)return!0}else{const U=C*(y.x-I.x)-k*(y.y-I.y);if(U===0)return!0;if(U<0)continue;S=!S}}else{if(y.y!==I.y)continue;if(D.x<=y.x&&y.x<=I.x||I.x<=y.x&&y.x<=D.x)return!0}}return S}const r=zl.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Jd,l.curves=a.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const h=[],f=[];let m=[],g=0,v;f[g]=void 0,m[g]=[];for(let y=0,_=s.length;y<_;y++)a=s[y],v=a.getPoints(),o=r(v),o=e?!o:o,o?(!u&&f[g]&&g++,f[g]={s:new Jd,p:v},f[g].s.curves=a.curves,u&&g++,m[g]=[]):m[g].push({h:a,p:v[0]});if(!f[0])return t(s);if(f.length>1){let y=!1,_=0;for(let x=0,S=f.length;x<S;x++)h[x]=[];for(let x=0,S=f.length;x<S;x++){const M=m[x];for(let A=0;A<M.length;A++){const I=M[A];let D=!0;for(let k=0;k<f.length;k++)i(I.p,f[k].p)&&(x!==k&&_++,D?(D=!1,h[k].push(I)):y=!0);D&&h[x].push(I)}}_>0&&y===!1&&(m=h)}let w;for(let y=0,_=f.length;y<_;y++){l=f[y].s,c.push(l),w=m[y];for(let x=0,S=w.length;x<S;x++)l.holes.push(w[x].h)}return c}}class jBe extends $a{constructor(e=1,t=1,i=1,r={}){console.warn('THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.'),super(e,t,{...r,count:i}),this.isWebGLMultipleRenderTargets=!0}get texture(){return this.textures}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:rx}}));typeof window<"u"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=rx);const WBe=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:OL,AddEquation:ah,AddOperation:vQ,AdditiveAnimationBlendMode:$L,AdditiveBlending:uA,AgXToneMapping:EQ,AlphaFormat:PQ,AlwaysCompare:jQ,AlwaysDepth:hQ,AlwaysStencilFunc:UN,AmbientLight:qZ,AnimationAction:tJ,AnimationClip:v1,AnimationLoader:KUe,AnimationMixer:_Be,AnimationObjectGroup:xBe,AnimationUtils:GUe,ArcCurve:vZ,ArrayCamera:lZ,ArrowHelper:HBe,AttachedBindMode:uN,Audio:JZ,AudioAnalyser:uBe,AudioContext:yU,AudioListener:aBe,AudioLoader:rBe,AxesHelper:$Be,BackSide:cs,BasicDepthPacking:UQ,BasicShadowMap:qY,BatchedMesh:mZ,Bone:iU,BooleanKeyframeTrack:Rp,Box2:PBe,Box3:us,Box3Helper:zBe,BoxGeometry:Ip,BoxHelper:FBe,BufferAttribute:wn,BufferGeometry:Ft,BufferGeometryLoader:ZZ,ByteType:MQ,Cache:zc,Camera:ax,CameraHelper:kBe,CanvasTexture:pUe,CapsuleGeometry:W2,CatmullRomCurve3:wZ,CineonToneMapping:bQ,CircleGeometry:q2,ClampToEdgeWrapping:Fr,Clock:vU,Color:et,ColorKeyframeTrack:pU,ColorManagement:pn,CompressedArrayTexture:fUe,CompressedCubeTexture:dUe,CompressedTexture:G2,CompressedTextureLoader:XUe,ConeGeometry:K2,ConstantAlphaFactor:lQ,ConstantColorFactor:oQ,CubeCamera:JQ,CubeReflectionMapping:au,CubeRefractionMapping:Yh,CubeTexture:lx,CubeTextureLoader:YUe,CubeUVReflectionMapping:ny,CubicBezierCurve:oU,CubicBezierCurve3:xZ,CubicInterpolant:FZ,CullFaceBack:sN,CullFaceFront:WY,CullFaceFrontBack:Z3e,CullFaceNone:jY,Curve:ja,CurvePath:_Z,CustomBlending:KY,CustomToneMapping:_Q,CylinderGeometry:oy,Cylindrical:TBe,Data3DTexture:qL,DataArrayTexture:k2,DataTexture:Xc,DataTextureLoader:QUe,DataUtils:oRe,DecrementStencilOp:cIe,DecrementWrapStencilOp:hIe,DefaultLoadingManager:HZ,DepthFormat:zh,DepthStencilFormat:mp,DepthTexture:QL,DetachedBindMode:AQ,DirectionalLight:WZ,DirectionalLightHelper:BBe,DiscreteInterpolant:zZ,DisplayP3ColorSpace:B2,DodecahedronGeometry:X2,DoubleSide:Ua,DstAlphaFactor:tQ,DstColorFactor:iQ,DynamicCopyUsage:MIe,DynamicDrawUsage:xIe,DynamicReadUsage:EIe,EdgesGeometry:EZ,EllipseCurve:j2,EqualCompare:VQ,EqualDepth:dQ,EqualStencilFunc:mIe,EquirectangularReflectionMapping:e1,EquirectangularRefractionMapping:t1,Euler:wo,EventDispatcher:fu,ExtrudeGeometry:Q2,FileLoader:lu,Float16BufferAttribute:fRe,Float32BufferAttribute:at,FloatType:co,Fog:V2,FogExp2:z2,FramebufferTexture:hUe,FrontSide:ou,Frustum:cx,GLBufferAttribute:MBe,GLSL1:PIe,GLSL3:BN,GreaterCompare:HQ,GreaterDepth:mQ,GreaterEqualCompare:GQ,GreaterEqualDepth:pQ,GreaterEqualStencilFunc:wIe,GreaterStencilFunc:yIe,GridHelper:LBe,Group:cg,HalfFloatType:z0,HemisphereLight:$Z,HemisphereLightHelper:OBe,IcosahedronGeometry:Z2,ImageBitmapLoader:iBe,ImageLoader:w1,ImageUtils:WL,IncrementStencilOp:lIe,IncrementWrapStencilOp:uIe,InstancedBufferAttribute:$0,InstancedBufferGeometry:QZ,InstancedInterleavedBuffer:ABe,InstancedMesh:pZ,Int16BufferAttribute:uRe,Int32BufferAttribute:hRe,Int8BufferAttribute:aRe,IntType:LL,InterleavedBuffer:H2,InterleavedBufferAttribute:gp,Interpolant:px,InterpolateDiscrete:i1,InterpolateLinear:r1,InterpolateSmooth:YE,InvertStencilOp:fIe,KeepStencilOp:Xf,KeyframeTrack:Wa,LOD:fZ,LatheGeometry:hx,Layers:Zd,LessCompare:zQ,LessDepth:fQ,LessEqualCompare:GL,LessEqualDepth:Jw,LessEqualStencilFunc:gIe,LessStencilFunc:pIe,Light:hf,LightProbe:YZ,Line:Qh,Line3:CBe,LineBasicMaterial:ds,LineCurve:aU,LineCurve3:bZ,LineDashedMaterial:UZ,LineLoop:gZ,LineSegments:$l,LinearDisplayP3ColorSpace:ox,LinearFilter:On,LinearInterpolant:dU,LinearMipMapLinearFilter:nIe,LinearMipMapNearestFilter:tIe,LinearMipmapLinearFilter:Il,LinearMipmapNearestFilter:sw,LinearSRGBColorSpace:hu,LinearToneMapping:wQ,LinearTransfer:o1,Loader:Hs,LoaderUtils:jN,LoadingManager:mU,LoopOnce:DQ,LoopPingPong:LQ,LoopRepeat:OQ,LuminanceAlphaFormat:IQ,LuminanceFormat:CQ,MOUSE:Y3e,Material:jr,MaterialLoader:oM,MathUtils:$Ie,Matrix3:Nt,Matr
4006ix4:wt,MaxEquation:cN,Mesh:Ai,MeshBasicMaterial:cf,MeshDepthMaterial:ZL,MeshDistanceMaterial:JL,MeshLambertMaterial:OZ,MeshMatcapMaterial:LZ,MeshNormalMaterial:DZ,MeshPhongMaterial:RZ,MeshPhysicalMaterial:IZ,MeshStandardMaterial:hU,MeshToonMaterial:NZ,MinEquation:lN,MirroredRepeatWrapping:n1,MixOperation:yQ,MultiplyBlending:aN,MultiplyOperation:sx,NearestFilter:hi,NearestMipMapLinearFilter:eIe,NearestMipMapNearestFilter:J3e,NearestMipmapLinearFilter:nd,NearestMipmapNearestFilter:dA,NeutralToneMapping:SQ,NeverCompare:FQ,NeverDepth:uQ,NeverStencilFunc:dIe,NoBlending:Kc,NoColorSpace:Dc,NoToneMapping:kl,NormalAnimationBlendMode:U2,NormalBlending:Yd,NotEqualCompare:$Q,NotEqualDepth:gQ,NotEqualStencilFunc:vIe,NumberKeyframeTrack:g1,Object3D:ln,ObjectLoader:tBe,ObjectSpaceNormalMap:kQ,OctahedronGeometry:fx,OneFactor:ZY,OneMinusConstantAlphaFactor:cQ,OneMinusConstantColorFactor:aQ,OneMinusDstAlphaFactor:nQ,OneMinusDstColorFactor:rQ,OneMinusSrcAlphaFactor:fA,OneMinusSrcColorFactor:eQ,OrthographicCamera:ux,P3Primaries:l1,PCFShadowMap:D2,PCFSoftShadowMap:rw,PMREMGenerator:FN,Path:f1,PerspectiveCamera:Ki,Plane:th,PlaneGeometry:ry,PlaneHelper:VBe,PointLight:jZ,PointLightHelper:NBe,Points:yZ,PointsMaterial:rU,PolarGridHelper:UBe,PolyhedronGeometry:uf,PositionalAudio:cBe,PropertyBinding:Zt,PropertyMixer:eJ,QuadraticBezierCurve:lU,QuadraticBezierCurve3:cU,Quaternion:ks,QuaternionKeyframeTrack:ay,QuaternionLinearInterpolant:VZ,RED_GREEN_RGTC2_Format:ON,RED_RGTC1_Format:NQ,REVISION:rx,RGBADepthPacking:BQ,RGBAFormat:zr,RGBAIntegerFormat:VL,RGBA_ASTC_10x10_Format:PN,RGBA_ASTC_10x5_Format:AN,RGBA_ASTC_10x6_Format:MN,RGBA_ASTC_10x8_Format:TN,RGBA_ASTC_12x10_Format:CN,RGBA_ASTC_12x12_Format:IN,RGBA_ASTC_4x4_Format:yN,RGBA_ASTC_5x4_Format:vN,RGBA_ASTC_5x5_Format:wN,RGBA_ASTC_6x5_Format:xN,RGBA_ASTC_6x6_Format:bN,RGBA_ASTC_8x5_Format:_N,RGBA_ASTC_8x6_Format:EN,RGBA_ASTC_8x8_Format:SN,RGBA_BPTC_Format:XE,RGBA_ETC2_EAC_Format:gN,RGBA_PVRTC_2BPPV1_Format:pN,RGBA_PVRTC_4BPPV1_Format:dN,RGBA_S3TC_DXT1_Format:WE,RGBA_S3TC_DXT3_Format:qE,RGBA_S3TC_DXT5_Format:KE,RGB_BPTC_SIGNED_Format:RN,RGB_BPTC_UNSIGNED_Format:NN,RGB_ETC1_Format:HL,RGB_ETC2_Format:mN,RGB_PVRTC_2BPPV1_Format:fN,RGB_PVRTC_4BPPV1_Format:hN,RGB_S3TC_DXT1_Format:jE,RGFormat:RQ,RGIntegerFormat:zL,RawShaderMaterial:CZ,Ray:iy,Raycaster:nJ,Rec709Primaries:a1,RectAreaLight:KZ,RedFormat:kL,RedIntegerFormat:FL,ReinhardToneMapping:xQ,RenderTarget:XQ,RepeatWrapping:pp,ReplaceStencilOp:aIe,ReverseSubtractEquation:YY,RingGeometry:J2,SIGNED_RED_GREEN_RGTC2_Format:LN,SIGNED_RED_RGTC1_Format:DN,SRGBColorSpace:Jo,SRGBTransfer:An,Scene:tU,ShaderChunk:Lt,ShaderLib:Oa,ShaderMaterial:zs,ShadowMaterial:PZ,Shape:Jd,ShapeGeometry:eM,ShapePath:GBe,ShapeUtils:zl,ShortType:TQ,Skeleton:$2,SkeletonHelper:RBe,SkinnedMesh:dZ,Source:bd,Sphere:$r,SphereGeometry:dx,Spherical:iJ,SphericalHarmonics3:XZ,SplineCurve:uU,SpotLight:GZ,SpotLightHelper:IBe,Sprite:hZ,SpriteMaterial:nU,SrcAlphaFactor:hA,SrcAlphaSaturateFactor:sQ,SrcColorFactor:JY,StaticCopyUsage:AIe,StaticDrawUsage:c1,StaticReadUsage:_Ie,StereoCamera:sBe,StreamCopyUsage:TIe,StreamDrawUsage:bIe,StreamReadUsage:SIe,StringKeyframeTrack:Np,SubtractEquation:XY,SubtractiveBlending:oN,TOUCH:Q3e,TangentSpaceNormalMap:lf,TetrahedronGeometry:tM,Texture:zn,TextureLoader:sM,TorusGeometry:nM,TorusKnotGeometry:iM,Triangle:uo,TriangleFanDrawMode:sIe,TriangleStripDrawMode:rIe,TrianglesDrawMode:iIe,TubeGeometry:rM,UVMapping:O2,Uint16BufferAttribute:KL,Uint32BufferAttribute:XL,Uint8BufferAttribute:lRe,Uint8ClampedBufferAttribute:cRe,Uniform:bU,UniformsGroup:SBe,UniformsLib:He,UniformsUtils:ZQ,UnsignedByteType:Fl,UnsignedInt248Type:Fh,UnsignedIntType:Fc,UnsignedShort4444Type:UL,UnsignedShort5551Type:BL,UnsignedShortType:L2,VSMShadowMap:Sa,Vector2:Me,Vector3:K,Vector4:mn,VectorKeyframeTrack:y1,VideoTexture:uUe,WebGL1Renderer:cZ,WebGL3DRenderTarget:XIe,WebGLArrayRenderTarget:KIe,WebGLCoordinateSystem:Rl,WebGLCubeRenderTarget:eZ,WebGLMultipleRenderTargets:jBe,WebGLRenderTarget:$a,WebGLRenderer:eU,WebGLUtils:aZ,WebGPUCoordinateSystem:u1,WireframeGeometry:TZ,WrapAroundEnding:s1,ZeroCurvatureEnding:wd,ZeroFactor:QY,ZeroSlopeEnding:xd,ZeroStencilOp:oIe,_SRGBAFormat:pA,createCanvasElement:qQ},Symbol.toStringTag,{value:"Module"}));var sJ={exports:{}},Dp={};/**
4007 * @license React
4008 * react-reconciler-constants.production.min.js
4009 *
4010 * Copyright (c) Facebook, Inc. and its affiliates.
4011 *
4012 * This source code is licensed under the MIT license found in the
4013 * LICENSE file in the root directory of this source tree.
4014 */Dp.ConcurrentRoot=1;Dp.ContinuousEventPriority=4;Dp.DefaultEventPriority=16;Dp.DiscreteEventPriority=1;Dp.IdleEventPriority=536870912;Dp.LegacyRoot=0;
vendor: 74,257 bytes, lines 4014-4036
4014sJ.exports=Dp;var hg=sJ.exports;function qBe(n){let e;const t=new Set,i=(c,u)=>{const h=typeof c=="function"?c(e):c;if(h!==e){const f=e;e=u?h:Object.assign({},e,h),t.forEach(m=>m(e,f))}},r=()=>e,s=(c,u=r,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let f=u(e);function m(){const g=u(e);if(!h(f,g)){const v=f;c(f=g,v)}}return t.add(m),()=>t.delete(m)},l={setState:i,getState:r,subscribe:(c,u,h)=>u||h?s(c,u,h):(t.add(c),()=>t.delete(c)),destroy:()=>t.clear()};return e=n(i,r,l),l}const KBe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),WH=KBe?fe.useEffect:fe.useLayoutEffect;function XBe(n){const e=typeof n=="function"?qBe(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=fe.useReducer(w=>w+1,0),o=e.getState(),a=fe.useRef(o),l=fe.useRef(i),c=fe.useRef(r),u=fe.useRef(!1),h=fe.useRef();h.current===void 0&&(h.current=i(o));let f,m=!1;(a.current!==o||l.current!==i||c.current!==r||u.current)&&(f=i(o),m=!r(h.current,f)),WH(()=>{m&&(h.current=f),a.current=o,l.current=i,c.current=r,u.current=!1});const g=fe.useRef(o);WH(()=>{const w=()=>{try{const _=e.getState(),x=l.current(_);c.current(h.current,x)||(a.current=_,h.current=x,s())}catch{u.current=!0,s()}},y=e.subscribe(w);return e.getState()!==g.current&&w(),y},[]);const v=m?f:h.current;return fe.useDebugValue(v),v};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,e];return{next(){const r=i.length<=0;return{value:i.shift(),done:r}}}},t}const YBe=n=>typeof n=="object"&&typeof n.then=="function",Ed=[];function oJ(n,e,t=(i,r)=>i===r){if(n===e)return!0;if(!n||!e)return!1;const i=n.length;if(e.length!==i)return!1;for(let r=0;r<i;r++)if(!t(n[r],e[r]))return!1;return!0}function aJ(n,e=null,t=!1,i={}){e===null&&(e=[n]);for(const s of Ed)if(oJ(e,s.keys,s.equal)){if(t)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return i.lifespan&&i.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,i.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:i.equal,remove:()=>{const s=Ed.indexOf(r);s!==-1&&Ed.splice(s,1)},promise:(YBe(n)?n:n(...e)).then(s=>{r.response=s,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(s=>r.error=s)};if(Ed.push(r),!t)throw r.promise}const QBe=(n,e,t)=>aJ(n,e,!1,t),ZBe=(n,e,t)=>void aJ(n,e,!0,t),JBe=n=>{if(n===void 0||n.length===0)Ed.splice(0,Ed.length);else{const e=Ed.find(t=>oJ(n,t.keys,t.equal));e&&e.remove()}};var lJ={exports:{}},r3={exports:{}},s3={};/**
4015 * @license React
4016 * scheduler.production.min.js
4017 *
4018 * Copyright (c) Facebook, Inc. and its affiliates.
4019 *
4020 * This source code is licensed under the MIT license found in the
4021 * LICENSE file in the root directory of this source tree.
4022 */var qH;function e4e(){return qH||(qH=1,function(n){function e(N,O){var B=N.length;N.push(O);e:for(;0<B;){var W=B-1>>>1,Q=N[W];if(0<r(Q,O))N[W]=O,N[B]=Q,B=W;else break e}}function t(N){return N.length===0?null:N[0]}function i(N){if(N.length===0)return null;var O=N[0],B=N.pop();if(B!==O){N[0]=B;e:for(var W=0,Q=N.length,oe=Q>>>1;W<oe;){var Y=2*(W+1)-1,te=N[Y],le=Y+1,ve=N[le];if(0>r(te,B))le<Q&&0>r(ve,te)?(N[W]=ve,N[le]=B,W=le):(N[W]=te,N[Y]=B,W=Y);else if(le<Q&&0>r(ve,B))N[W]=ve,N[le]=B,W=le;else break e}}return O}function r(N,O){var B=N.sortIndex-O.sortIndex;return B!==0?B:N.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,h=null,f=3,m=!1,g=!1,v=!1,w=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(N){for(var O=t(c);O!==null;){if(O.callback===null)i(c);else if(O.startTime<=N)i(c),O.sortIndex=O.expirationTime,e(l,O);else break;O=t(c)}}function S(N){if(v=!1,x(N),!g)if(t(l)!==null)g=!0,R(M);else{var O=t(c);O!==null&&F(S,O.startTime-N)}}function M(N,O){g=!1,v&&(v=!1,y(D),D=-1),m=!0;var B=f;try{for(x(O),h=t(l);h!==null&&(!(h.expirationTime>O)||N&&!U());){var W=h.callback;if(typeof W=="function"){h.callback=null,f=h.priorityLevel;var Q=W(h.expirationTime<=O);O=n.unstable_now(),typeof Q=="function"?h.callback=Q:h===t(l)&&i(l),x(O)}else i(l);h=t(l)}if(h!==null)var oe=!0;else{var Y=t(c);Y!==null&&F(S,Y.startTime-O),oe=!1}return oe}finally{h=null,f=B,m=!1}}var A=!1,I=null,D=-1,k=5,C=-1;function U(){return!(n.unstable_now()-C<k)}function G(){if(I!==null){var N=n.unstable_now();C=N;var O=!0;try{O=I(!0,N)}finally{O?H():(A=!1,I=null)}}else A=!1}var H;if(typeof _=="function")H=function(){_(G)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,P=z.port2;z.port1.onmessage=G,H=function(){P.postMessage(null)}}else H=function(){w(G,0)};function R(N){I=N,A||(A=!0,H())}function F(N,O){D=w(function(){N(n.unstable_now())},O)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(N){N.callback=null},n.unstable_continueExecution=function(){g||m||(g=!0,R(M))},n.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<N?Math.floor(1e3/N):5},n.unstable_getCurrentPriorityLevel=function(){return f},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(N){switch(f){case 1:case 2:case 3:var O=3;break;default:O=f}var B=f;f=O;try{return N()}finally{f=B}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(N,O){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var B=f;f=N;try{return O()}finally{f=B}},n.unstable_scheduleCallback=function(N,O,B){var W=n.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?W+B:W):B=W,N){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=B+Q,N={id:u++,callback:O,priorityLevel:N,startTime:B,expirationTime:Q,sortIndex:-1},B>W?(N.sortIndex=B,e(c,N),t(l)===null&&N===t(c)&&(v?(y(D),D=-1):v=!0,F(S,B-W))):(N.sortIndex=Q,e(l,N),g||m||(g=!0,R(M))),N},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(N){var O=f;return function(){var B=f;f=O;try{return N.apply(this,arguments)}finally{f=B}}}}(s3)),s3}var KH;function t4e(){return KH||(KH=1,r3.exports=e4e()),r3.exports}/**
4023 * @license React
4024 * react-reconciler.production.min.js
4025 *
4026 * Copyright (c) Facebook, Inc. and its affiliates.
4027 *
4028 * This source code is licensed under the MIT license found in the
4029 * LICENSE file in the root directory of this source tree.
4030 */var n4e=function(e){var t={},i=fe,r=t4e(),s=Object.assign;function o(d){for(var p="https://reactjs.org/docs/error-decoder.html?invariant="+d,b=1;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b]);return"Minified React error #"+d+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var a=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,l=Symbol.for("react.element"),c=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),g=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),y=Symbol.for("react.suspense_list"),_=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),S=Symbol.for("react.offscreen"),M=Symbol.iterator;function A(d){return d===null||typeof d!="object"?null:(d=M&&d[M]||d["@@iterator"],typeof d=="function"?d:null)}function I(d){if(d==null)return null;if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case u:return"Fragment";case c:return"Portal";case f:return"Profiler";case h:return"StrictMode";case w:return"Suspense";case y:return"SuspenseList"}if(typeof d=="object")switch(d.$$typeof){case g:return(d.displayName||"Context")+".Consumer";case m:return(d._context.displayName||"Context")+".Provider";case v:var p=d.render;return d=d.displayName,d||(d=p.displayName||p.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case _:return p=d.displayName||null,p!==null?p:I(d.type)||"Memo";case x:p=d._payload,d=d._init;try{return I(d(p))}catch{}}return null}function D(d){var p=d.type;switch(d.tag){case 24:return"Cache";case 9:return(p.displayName||"Context")+".Consumer";case 10:return(p._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return d=p.render,d=d.displayName||d.name||"",p.displayName||(d!==""?"ForwardRef("+d+")":"ForwardRef");case 7:return"Fragment";case 5:return p;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return I(p);case 8:return p===h?"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 p=="function")return p.displayName||p.name||null;if(typeof p=="string")return p}return null}function k(d){var p=d,b=d;if(d.alternate)for(;p.return;)p=p.return;else{d=p;do p=d,p.flags&4098&&(b=p.return),d=p.return;while(d)}return p.tag===3?b:null}function C(d){if(k(d)!==d)throw Error(o(188))}function U(d){var p=d.alternate;if(!p){if(p=k(d),p===null)throw Error(o(188));return p!==d?null:d}for(var b=d,E=p;;){var T=b.return;if(T===null)break;var L=T.alternate;if(L===null){if(E=T.return,E!==null){b=E;continue}break}if(T.child===L.child){for(L=T.child;L;){if(L===b)return C(T),d;if(L===E)return C(T),p;L=L.sibling}throw Error(o(188))}if(b.return!==E.return)b=T,E=L;else{for(var Z=!1,ne=T.child;ne;){if(ne===b){Z=!0,b=T,E=L;break}if(ne===E){Z=!0,E=T,b=L;break}ne=ne.sibling}if(!Z){for(ne=L.child;ne;){if(ne===b){Z=!0,b=L,E=T;break}if(ne===E){Z=!0,E=L,b=T;break}ne=ne.sibling}if(!Z)throw Error(o(189))}}if(b.alternate!==E)throw Error(o(190))}if(b.tag!==3)throw Error(o(188));return b.stateNode.current===b?d:p}function G(d){return d=U(d),d!==null?H(d):null}function H(d){if(d.tag===5||d.tag===6)return d;for(d=d.child;d!==null;){var p=H(d);if(p!==null)return p;d=d.sibling}return null}function z(d){if(d.tag===5||d.tag===6)return d;for(d=d.child;d!==null;){if(d.tag!==4){var p=z(d);if(p!==null)return p}d=d.sibling}return null}var P=Array.isArray,R=e.getPublicInstance,F=e.getRootHostContext,N=e.getChildHostContext,O=e.prepareForCommit,B=e.resetAfterCommit,W=e.createInstance,Q=e.appendInitialChild,oe=e.finalizeInitialChildren,Y=e.prepareUpdate,te=e.shouldSetTextContent,le=e.createTextInstance,ve=e.scheduleTimeout,Te=e.cancelTimeout,be=e.noTimeout,Le=e.isPrimaryRenderer,Oe=e.supportsMutation,J=e.supportsPersistence,Se=e.supportsHydration,me=e.getInstanceFromNode,Re=e.preparePortalMount,Ae=e.getCurrentEventPriority,Ze=e.detachDeletedInstance,Ke=e.supportsMicrotasks,rt=e.scheduleMicrotask,Et=e.supportsTestSelectors,X=e.findFiberRoot,$=e.getBoundingRect,xe=e.getTextContent,Ee=e.isHiddenSubtree,Ne=e.matchAccessibilityRole,Pe=e.setFocusIfFocusable,_t=e.setupIntersectionObserver,pt=e.appendChild,Fe=e.appendChildToContainer,$e=e.commitTextUpdate,At=e.commitMount,ke=e.commitUpdate,Yn=e.insertBefore,zt=e.insertInContainerBefore,dt=e.removeChild,lt=e.removeChildFromContainer,ct=e.resetTextContent,qt=e.hideInstance,Pt=e.hideTextInstance,En=e.unhideInstance,re=e.unhideTextInstance,je=e.clearContainer,de=e.cloneInstance,ze=e.createContainerChildSet,We=e.appendChildToContainerChildSet,Ht=e.finalizeContainerChildren,fn=e.replaceContainerChildren,mi=e.cloneHiddenInstance,Wr=e.cloneHiddenTextInstance,yn=e.canHydrateInstance,Zi=e.canHydrateTextInstance,So=e.canHydrateSuspenseInstance,ly=e.isSuspenseInstancePending,cy=e.isSuspenseInstanceFallback,Op=e.registerSuspenseInstanceRetry,du=e.getNextHydratableSibling,Lp=e.getFirstHydratableChild,vx=e.getFirstHydratableChildWithinContainer,wx=e.getFirstHydratableChildWithinSuspenseInstance,aM=e.hydrateInstance,lM=e.hydrateTextInstance,cM=e.hydrateSuspenseInstance,q=e.getNextHydratableInstanceAfterSuspenseInstance,ae=e.commitHydratedContainer,pe=e.commitHydratedSuspenseInstance,ye=e.clearSuspenseBoundary,he=e.clearSuspenseBoundaryFromContainer,Je=e.shouldDeleteUnhydratedTailInstances,ht=e.didNotMatchHydratedContainerTextInstance,gt=e.didNotMatchHydratedTextInstance,xt;function Mt(d){if(xt===void 0)try{throw Error()}catch(b){var p=b.stack.trim().match(/\n( *(at )?)/);xt=p&&p[1]||""}return`
4031`+xt+d}var St=!1;function Tt(d,p){if(!d||St)return"";St=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(p)if(p=function(){throw Error()},Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(Ue){var E=Ue}Reflect.construct(d,[],p)}else{try{p.call()}catch(Ue){E=Ue}d.call(p.prototype)}else{try{throw Error()}catch(Ue){E=Ue}d()}}catch(Ue){if(Ue&&E&&typeof Ue.stack=="string"){for(var T=Ue.stack.split(`
4032`),L=E.stack.split(`
4033`),Z=T.length-1,ne=L.length-1;1<=Z&&0<=ne&&T[Z]!==L[ne];)ne--;for(;1<=Z&&0<=ne;Z--,ne--)if(T[Z]!==L[ne]){if(Z!==1||ne!==1)do if(Z--,ne--,0>ne||T[Z]!==L[ne]){var _e=`
4034`+T[Z].replace(" at new "," at ");return d.displayName&&_e.includes("<anonymous>")&&(_e=_e.replace("<anonymous>",d.displayName)),_e}while(1<=Z&&0<=ne);break}}}finally{St=!1,Error.prepareStackTrace=b}return(d=d?d.displayName||d.name:"")?Mt(d):""}var Hn=Object.prototype.hasOwnProperty,Ji=[],In=-1;function Oi(d){return{current:d}}function bt(d){0>In||(d.current=Ji[In],Ji[In]=null,In--)}function tt(d,p){In++,Ji[In]=d.current,d.current=p}var Ao={},Ot=Oi(Ao),Qn=Oi(!1),qa=Ao;function Mo(d,p){var b=d.type.contextTypes;if(!b)return Ao;var E=d.stateNode;if(E&&E.__reactInternalMemoizedUnmaskedChildContext===p)return E.__reactInternalMemoizedMaskedChildContext;var T={},L;for(L in b)T[L]=p[L];return E&&(d=d.stateNode,d.__reactInternalMemoizedUnmaskedChildContext=p,d.__reactInternalMemoizedMaskedChildContext=T),T}function Li(d){return d=d.childContextTypes,d!=null}function oi(){bt(Qn),bt(Ot)}function Ka(d,p,b){if(Ot.current!==Ao)throw Error(o(168));tt(Ot,p),tt(Qn,b)}function Up(d,p,b){var E=d.stateNode;if(p=p.childContextTypes,typeof E.getChildContext!="function")return b;E=E.getChildContext();for(var T in E)if(!(T in p))throw Error(o(108,D(d)||"Unknown",T));return s({},b,E)}function er(d){return d=(d=d.stateNode)&&d.__reactInternalMemoizedMergedChildContext||Ao,qa=Ot.current,tt(Ot,d),tt(Qn,Qn.current),!0}function Bp(d,p,b){var E=d.stateNode;if(!E)throw Error(o(169));b?(d=Up(d,p,qa),E.__reactInternalMemoizedMergedChildContext=d,bt(Qn),bt(Ot),tt(Ot,d)):bt(Qn),tt(Qn,b)}var $s=Math.clz32?Math.clz32:IJ,xx=Math.log,CJ=Math.LN2;function IJ(d){return d>>>=0,d===0?32:31-(xx(d)/CJ|0)|0}var bx=64,_x=4194304;function uy(d){switch(d&-d){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return d&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return d}}function Ex(d,p){var b=d.pendingLanes;if(b===0)return 0;var E=0,T=d.suspendedLanes,L=d.pingedLanes,Z=b&268435455;if(Z!==0){var ne=Z&~T;ne!==0?E=uy(ne):(L&=Z,L!==0&&(E=uy(L)))}else Z=b&~T,Z!==0?E=uy(Z):L!==0&&(E=uy(L));if(E===0)return 0;if(p!==0&&p!==E&&!(p&T)&&(T=E&-E,L=p&-p,T>=L||T===16&&(L&4194240)!==0))return p;if(E&4&&(E|=b&16),p=d.entangledLanes,p!==0)for(d=d.entanglements,p&=E;0<p;)b=31-$s(p),T=1<<b,E|=d[b],p&=~T;return E}function RJ(d,p){switch(d){case 1:case 2:case 4:return p+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 p+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 NJ(d,p){for(var b=d.suspendedLanes,E=d.pingedLanes,T=d.expirationTimes,L=d.pendingLanes;0<L;){var Z=31-$s(L),ne=1<<Z,_e=T[Z];_e===-1?(!(ne&b)||ne&E)&&(T[Z]=RJ(ne,p)):_e<=p&&(d.expiredLanes|=ne),L&=~ne}}function uM(d){return d=d.pendingLanes&-1073741825,d!==0?d:d&1073741824?1073741824:0}function hM(d){for(var p=[],b=0;31>b;b++)p.push(d);return p}function hy(d,p,b){d.pendingLanes|=p,p!==536870912&&(d.suspendedLanes=0,d.pingedLanes=0),d=d.eventTimes,p=31-$s(p),d[p]=b}function DJ(d,p){var b=d.pendingLanes&~p;d.pendingLanes=p,d.suspendedLanes=0,d.pingedLanes=0,d.expiredLanes&=p,d.mutableReadLanes&=p,d.entangledLanes&=p,p=d.entanglements;var E=d.eventTimes;for(d=d.expirationTimes;0<b;){var T=31-$s(b),L=1<<T;p[T]=0,E[T]=-1,d[T]=-1,b&=~L}}function fM(d,p){var b=d.entangledLanes|=p;for(d=d.entanglements;b;){var E=31-$s(b),T=1<<E;T&p|d[E]&p&&(d[E]|=p),b&=~T}}var en=0;function PU(d){return d&=-d,1<d?4<d?d&268435455?16:536870912:4:1}var dM=r.unstable_scheduleCallback,CU=r.unstable_cancelCallback,OJ=r.unstable_shouldYield,LJ=r.unstable_requestPaint,Ui=r.unstable_now,pM=r.unstable_ImmediatePriority,UJ=r.unstable_UserBlockingPriority,mM=r.unstable_NormalPriority,BJ=r.unstable_IdlePriority,Sx=null,Xa=null;function kJ(d){if(Xa&&typeof Xa.onCommitFiberRoot=="function")try{Xa.onCommitFiberRoot(Sx,d,void 0,(d.current.flags&128)===128)}catch{}}function FJ(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var Ya=typeof Object.is=="function"?Object.is:FJ,Gl=null,Ax=!1,gM=!1;function IU(d){Gl===null?Gl=[d]:Gl.push(d)}function zJ(d){Ax=!0,IU(d)}function Qa(){if(!gM&&Gl!==null){gM=!0;var d=0,p=en;try{var b=Gl;for(en=1;d<b.length;d++){var E=b[d];do E=E(!0);while(E!==null)}Gl=null,Ax=!1}catch(T){throw Gl!==null&&(Gl=Gl.slice(d+1)),dM(pM,Qa),T}finally{en=p,gM=!1}}return null}var VJ=a.ReactCurrentBatchConfig;function Mx(d,p){if(Ya(d,p))return!0;if(typeof d!="object"||d===null||typeof p!="object"||p===null)return!1;var b=Object.keys(d),E=Object.keys(p);if(b.length!==E.length)return!1;for(E=0;E<b.length;E++){var T=b[E];if(!Hn.call(p,T)||!Ya(d[T],p[T]))return!1}return!0}function HJ(d){switch(d.tag){case 5:return Mt(d.type);case 16:return Mt("Lazy");case 13:return Mt("Suspense");case 19:return Mt("SuspenseList");case 0:case 2:case 15:return d=Tt(d.type,!1),d;case 11:return d=Tt(d.type.render,!1),d;case 1:return d=Tt(d.type,!0),d;default:return""}}function ca(d,p){if(d&&d.defaultProps){p=s({},p),d=d.defaultProps;for(var b in d)p[b]===void 0&&(p[b]=d[b]);return p}return p}var Tx=Oi(null),Px=null,kp=null,yM=null;function vM(){yM=kp=Px=null}function RU(d,p,b){Le?(tt(Tx,p._currentValue),p._currentValue=b):(tt(Tx,p._currentValue2),p._currentValue2=b)}function wM(d){var p=Tx.current;bt(Tx),Le?d._currentValue=p:d._currentValue2=p}function xM(d,p,b){for(;d!==null;){var E=d.alternate;if((d.childLanes&p)!==p?(d.childLanes|=p,E!==null&&(E.childLanes|=p)):E!==null&&(E.childLanes&p)!==p&&(E.childLanes|=p),d===b)break;d=d.return}}function Fp(d,p){Px=d,yM=kp=null,d=d.dependencies,d!==null&&d.firstContext!==null&&(d.lanes&p&&(Ws=!0),d.firstContext=null)}function To(d){var p=Le?d._currentValue:d._currentValue2;if(yM!==d)if(d={context:d,memoizedValue:p,next:null},kp===null){if(Px===null)throw Error(o(308));kp=d,Px.dependencies={lanes:0,firstContext:d}}else kp=kp.next=d;return p}var Za=null,pu=!1;function bM(d){d.updateQueue={baseState:d.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function NU(d,p){d=d.updateQueue,p.updateQueue===d&&(p.updateQueue={baseState:d.baseState,firstBaseUpdate:d.firstBaseUpdate,lastBaseUpdate:d.lastBaseUpdate,shared:d.shared,effects:d.effects})}function jl(d,p){return{eventTime:d,lane:p,tag:0,payload:null,callback:null,next:null}}function mu(d,p){var b=d.updateQueue;b!==null&&(b=b.shared,gi!==null&&d.mode&1&&!(Vt&2)?(d=b.interleaved,d===null?(p.next=p,Za===null?Za=[b]:Za.push(b)):(p.next=d.next,d.next=p),b.interleaved=p):(d=b.pending,d===null?p.next=p:(p.next=d.next,d.next=p),b.pending=p))}function Cx(d,p,b){if(p=p.updateQueue,p!==null&&(p=p.shared,(b&4194240)!==0)){var E=p.lanes;E&=d.pendingLanes,b|=E,p.lanes=b,fM(d,b)}}function DU(d,p){var b=d.updateQueue,E=d.alternate;if(E!==null&&(E=E.updateQueue,b===E)){var T=null,L=null;if(b=b.firstBaseUpdate,b!==null){do{var Z={eventTime:b.eventTime,lane:b.lane,tag:b.tag,payload:b.payload,callback:b.callback,next:null};L===null?T=L=Z:L=L.next=Z,b=b.next}while(b!==null);L===null?T=L=p:L=L.next=p}else T=L=p;b={baseState:E.baseState,firstBaseUpdate:T,lastBaseUpdate:L,shared:E.shared,effects:E.effects},d.updateQueue=b;return}d=b.lastBaseUpdate,d===null?b.firstBaseUpdate=p:d.next=p,b.lastBaseUpdate=p}function Ix(d,p,b,E){var T=d.updateQueue;pu=!1;var L=T.firstBaseUpdate,Z=T.lastBaseUpdate,ne=T.shared.pending;if(ne!==null){T.shared.pending=null;var _e=ne,Ue=_e.next;_e.next=null,Z===null?L=Ue:Z.next=Ue,Z=_e;var st=d.alternate;st!==null&&(st=st.updateQueue,ne=st.lastBaseUpdate,ne!==Z&&(ne===null?st.firstBaseUpdate=Ue:ne.next=Ue,st.lastBaseUpdate=_e))}if(L!==null){var Ct=T.baseState;Z=0,st=Ue=_e=null,ne=L;do{var mt=ne.lane,bn=ne.eventTime;if((E&mt)===mt){st!==null&&(st=st.next={eventTime:bn,lane:0,tag:ne.tag,payload:ne.payload,callback:ne.callback,next:null});e:{var ft=d,br=ne;switch(mt=p,bn=b,br.tag){case 1:if(ft=br.payload,typeof ft=="function"){Ct=ft.call(bn,Ct,mt);break e}Ct=ft;break e;case 3:ft.flags=ft.flags&-65537|128;case 0:if(ft=br.payload,mt=typeof ft=="function"?ft.call(bn,Ct,mt):ft,mt==null)break e;Ct=s({},Ct,mt);break e;case 2:pu=!0}}ne.callback!==null&&ne.lane!==0&&(d.flags|=64,mt=T.effects,mt===null?T.effects=[ne]:mt.push(ne))}else bn={eventTime:bn,lane:mt,tag:ne.tag,payload:ne.payload,callback:ne.callback,next:null},st===null?(Ue=st=bn,_e=Ct):st=st.next=bn,Z|=mt;if(ne=ne.next,ne===null){if(ne=T.shared.pending,ne===null)break;mt=ne,ne=mt.next,mt.next=null,T.lastBaseUpdate=mt,T.shared.pending=null}}while(!0);if(st===null&&(_e=Ct),T.baseState=_e,T.firstBaseUpdate=Ue,T.lastBaseUpdate=st,p=T.shared.interleaved,p!==null){T=p;do Z|=T.lane,T=T.next;while(T!==p)}else L===null&&(T.shared.lanes=0);Kp|=Z,d.lanes=Z,d.memoizedState=Ct}}function OU(d,p,b){if(d=p.effects,p.effects=null,d!==null)for(p=0;p<d.length;p++){var E=d[p],T=E.callback;if(T!==null){if(E.callback=null,E=b,typeof T!="function")throw Error(o(191,T));T.call(E)}}}var LU=new i.Component().refs;function _M(d,p,b,E){p=d.memoizedState,b=b(E,p),b=b==null?p:s({},p,b),d.memoizedState=b,d.lanes===0&&(d.updateQueue.baseState=b)}var Rx={isMounted:function(d){return(d=d._reactInternals)?k(d)===d:!1},enqueueSetState:function(d,p,b){d=d._reactInternals;var E=Kr(),T=vu(d),L=jl(E,T);L.payload=p,b!=null&&(L.callback=b),mu(d,L),p=No(d,T,E),p!==null&&Cx(p,d,T)},enqueueReplaceState:function(d,p,b){d=d._reactInternals;var E=Kr(),T=vu(d),L=jl(E,T);L.tag=1,L.payload=p,b!=null&&(L.callback=b),mu(d,L),p=No(d,T,E),p!==null&&Cx(p,d,T)},enqueueForceUpdate:function(d,p){d=d._reactInternals;var b=Kr(),E=vu(d),T=jl(b,E);T.tag=2,p!=null&&(T.callback=p),mu(d,T),p=No(d,E,b),p!==null&&Cx(p,d,E)}};function UU(d,p,b,E,T,L,Z){return d=d.stateNode,typeof d.shouldComponentUpdate=="function"?d.shouldComponentUpdate(E,L,Z):p.prototype&&p.prototype.isPureReactComponent?!Mx(b,E)||!Mx(T,L):!0}function BU(d,p,b){var E=!1,T=Ao,L=p.contextType;return typeof L=="object"&&L!==null?L=To(L):(T=Li(p)?qa:Ot.current,E=p.contextTypes,L=(E=E!=null)?Mo(d,T):Ao),p=new p(b,L),d.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Rx,d.stateNode=p,p._reactInternals=d,E&&(d=d.stateNode,d.__reactInternalMemoizedUnmaskedChildContext=T,d.__reactInternalMemoizedMaskedChildContext=L),p}function kU(d,p,b,E){d=p.state,typeof p.componentWillReceiveProps=="function"&&p.componentWillReceiveProps(b,E),typeof p.UNSAFE_componentWillReceiveProps=="function"&&p.UNSAFE_componentWillReceiveProps(b,E),p.state!==d&&Rx.enqueueReplaceState(p,p.state,null)}function EM(d,p,b,E){var T=d.stateNode;T.props=b,T.state=d.memoizedState,T.refs=LU,bM(d);var L=p.contextType;typeof L=="object"&&L!==null?T.context=To(L):(L=Li(p)?qa:Ot.current,T.context=Mo(d,L)),T.state=d.memoizedState,L=p.getDerivedStateFromProps,typeof L=="function"&&(_M(d,p,L,b),T.state=d.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof T.getSnapshotBeforeUpdate=="function"||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(p=T.state,typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount(),p!==T.state&&Rx.enqueueReplaceState(T,T.state,null),Ix(d,b,T,E),T.state=d.memoizedState),typeof T.componentDidMount=="function"&&(d.flags|=4194308)}var zp=[],Vp=0,Nx=null,Dx=0,Po=[],Co=0,ff=null,Wl=1,ql="";function df(d,p){zp[Vp++]=Dx,zp[Vp++]=Nx,Nx=d,Dx=p}function FU(d,p,b){Po[Co++]=Wl,Po[Co++]=ql,Po[Co++]=ff,ff=d;var E=Wl;d=ql;var T=32-$s(E)-1;E&=~(1<<T),b+=1;var L=32-$s(p)+T;if(30<L){var Z=T-T%5;L=(E&(1<<Z)-1).toString(32),E>>=Z,T-=Z,Wl=1<<32-$s(p)+T|b<<T|E,ql=L+d}else Wl=1<<L|b<<T|E,ql=d}function SM(d){d.return!==null&&(df(d,1),FU(d,1,0))}function AM(d){for(;d===Nx;)Nx=zp[--Vp],zp[Vp]=null,Dx=zp[--Vp],zp[Vp]=null;for(;d===ff;)ff=Po[--Co],Po[Co]=null,ql=Po[--Co],Po[Co]=null,Wl=Po[--Co],Po[Co]=null}var Gs=null,js=null,Bn=!1,fy=!1,ua=null;function zU(d,p){var b=Do(5,null,null,0);b.elementType="DELETED",b.stateNode=p,b.return=d,p=d.deletions,p===null?(d.deletions=[b],d.flags|=16):p.push(b)}function VU(d,p){switch(d.tag){case 5:return p=yn(p,d.type,d.pendingProps),p!==null?(d.stateNode=p,Gs=d,js=Lp(p),!0):!1;case 6:return p=Zi(p,d.pendingProps),p!==null?(d.stateNode=p,Gs=d,js=null,!0):!1;case 13:if(p=So(p),p!==null){var b=ff!==null?{id:Wl,overflow:ql}:null;return d.memoizedState={dehydrated:p,treeContext:b,retryLane:1073741824},b=Do(18,null,null,0),b.stateNode=p,b.return=d,d.child=b,Gs=d,js=null,!0}return!1;default:return!1}}function MM(d){return(d.mode&1)!==0&&(d.flags&128)===0}function TM(d){if(Bn){var p=js;if(p){var b=p;if(!VU(d,p)){if(MM(d))throw Error(o(418));p=du(b);var E=Gs;p&&VU(d,p)?zU(E,b):(d.flags=d.flags&-4097|2,Bn=!1,Gs=d)}}else{if(MM(d))throw Error(o(418));d.flags=d.flags&-4097|2,Bn=!1,Gs=d}}}function HU(d){for(d=d.return;d!==null&&d.tag!==5&&d.tag!==3&&d.tag!==13;)d=d.return;Gs=d}function dy(d){if(!Se||d!==Gs)return!1;if(!Bn)return HU(d),Bn=!0,!1;if(d.tag!==3&&(d.tag!==5||Je(d.type)&&!te(d.type,d.memoizedProps))){var p=js;if(p){if(MM(d)){for(d=js;d;)d=du(d);throw Error(o(418))}for(;p;)zU(d,p),p=du(p)}}if(HU(d),d.tag===13){if(!Se)throw Error(o(316));if(d=d.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(o(317));js=q(d)}else js=Gs?du(d.stateNode):null;return!0}function Hp(){Se&&(js=Gs=null,fy=Bn=!1)}function PM(d){ua===null?ua=[d]:ua.push(d)}function py(d,p,b){if(d=b.ref,d!==null&&typeof d!="function"&&typeof d!="object"){if(b._owner){if(b=b._owner,b){if(b.tag!==1)throw Error(o(309));var E=b.stateNode}if(!E)throw Error(o(147,d));var T=E,L=""+d;return p!==null&&p.ref!==null&&typeof p.ref=="function"&&p.ref._stringRef===L?p.ref:(p=function(Z){var ne=T.refs;ne===LU&&(ne=T.refs={}),Z===null?delete ne[L]:ne[L]=Z},p._stringRef=L,p)}if(typeof d!="string")throw Error(o(284));if(!b._owner)throw Error(o(290,d))}return d}function Ox(d,p){throw d=Object.prototype.toString.call(p),Error(o(31,d==="[object Object]"?"object with keys {"+Object.keys(p).join(", ")+"}":d))}function $U(d){var p=d._init;return p(d._payload)}function GU(d){function p(ue,se){if(d){var we=ue.deletions;we===null?(ue.deletions=[se],ue.flags|=16):we.push(se)}}function b(ue,se){if(!d)return null;for(;se!==null;)p(ue,se),se=se.sibling;return null}function E(ue,se){for(ue=new Map;se!==null;)se.key!==null?ue.set(se.key,se):ue.set(se.index,se),se=se.sibling;return ue}function T(ue,se){return ue=xu(ue,se),ue.index=0,ue.sibling=null,ue}function L(ue,se,we){return ue.index=we,d?(we=ue.alternate,we!==null?(we=we.index,we<se?(ue.flags|=2,se):we):(ue.flags|=2,se)):(ue.flags|=1048576,se)}function Z(ue){return d&&ue.alternate===null&&(ue.flags|=2),ue}function ne(ue,se,we,Qe){return se===null||se.tag!==6?(se=hT(we,ue.mode,Qe),se.return=ue,se):(se=T(se,we),se.return=ue,se)}function _e(ue,se,we,Qe){var ut=we.type;return ut===u?st(ue,se,we.props.children,Qe,we.key):se!==null&&(se.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===x&&$U(ut)===se.type)?(Qe=T(se,we.props),Qe.ref=py(ue,se,we),Qe.return=ue,Qe):(Qe=hb(we.type,we.key,we.props,null,ue.mode,Qe),Qe.ref=py(ue,se,we),Qe.return=ue,Qe)}function Ue(ue,se,we,Qe){return se===null||se.tag!==4||se.stateNode.containerInfo!==we.containerInfo||se.stateNode.implementation!==we.implementation?(se=fT(we,ue.mode,Qe),se.return=ue,se):(se=T(se,we.children||[]),se.return=ue,se)}function st(ue,se,we,Qe,ut){return se===null||se.tag!==7?(se=xf(we,ue.mode,Qe,ut),se.return=ue,se):(se=T(se,we),se.return=ue,se)}function Ct(ue,se,we){if(typeof se=="string"&&se!==""||typeof se=="number")return se=hT(""+se,ue.mode,we),se.return=ue,se;if(typeof se=="object"&&se!==null){switch(se.$$typeof){case l:return we=hb(se.type,se.key,se.props,null,ue.mode,we),we.ref=py(ue,null,se),we.return=ue,we;case c:return se=fT(se,ue.mode,we),se.return=ue,se;case x:var Qe=se._init;return Ct(ue,Qe(se._payload),we)}if(P(se)||A(se))return se=xf(se,ue.mode,we,null),se.return=ue,se;Ox(ue,se)}return null}function mt(ue,se,we,Qe){var ut=se!==null?se.key:null;if(typeof we=="string"&&we!==""||typeof we=="number")return ut!==null?null:ne(ue,se,""+we,Qe);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case l:return we.key===ut?_e(ue,se,we,Qe):null;case c:return we.key===ut?Ue(ue,se,we,Qe):null;case x:return ut=we._init,mt(ue,se,ut(we._payload),Qe)}if(P(we)||A(we))return ut!==null?null:st(ue,se,we,Qe,null);Ox(ue,we)}return null}function bn(ue,se,we,Qe,ut){if(typeof Qe=="string"&&Qe!==""||typeof Qe=="number")return ue=ue.get(we)||null,ne(se,ue,""+Qe,ut);if(typeof Qe=="object"&&Qe!==null){switch(Qe.$$typeof){case l:return ue=ue.get(Qe.key===null?we:Qe.key)||null,_e(se,ue,Qe,ut);case c:return ue=ue.get(Qe.key===null?we:Qe.key)||null,Ue(se,ue,Qe,ut);case x:var Ut=Qe._init;return bn(ue,se,we,Ut(Qe._payload),ut)}if(P(Qe)||A(Qe))return ue=ue.get(we)||null,st(se,ue,Qe,ut,null);Ox(se,Qe)}return null}function ft(ue,se,we,Qe){for(var ut=null,Ut=null,It=se,tn=se=0,ki=null;It!==null&&tn<we.length;tn++){It.index>tn?(ki=It,It=null):ki=It.sibling;var nn=mt(ue,It,we[tn],Qe);if(nn===null){It===null&&(It=ki);break}d&&It&&nn.alternate===null&&p(ue,It),se=L(nn,se,tn),Ut===null?ut=nn:Ut.sibling=nn,Ut=nn,It=ki}if(tn===we.length)return b(ue,It),Bn&&df(ue,tn),ut;if(It===null){for(;tn<we.length;tn++)It=Ct(ue,we[tn],Qe),It!==null&&(se=L(It,se,tn),Ut===null?ut=It:Ut.sibling=It,Ut=It);return Bn&&df(ue,tn),ut}for(It=E(ue,It);tn<we.length;tn++)ki=bn(It,ue,tn,we[tn],Qe),ki!==null&&(d&&ki.alternate!==null&&It.delete(ki.key===null?tn:ki.key),se=L(ki,se,tn),Ut===null?ut=ki:Ut.sibling=ki,Ut=ki);return d&&It.forEach(function(bu){return p(ue,bu)}),Bn&&df(ue,tn),ut}function br(ue,se,we,Qe){var ut=A(we);if(typeof ut!="function")throw Error(o(150));if(we=ut.call(we),we==null)throw Error(o(151));for(var Ut=ut=null,It=se,tn=se=0,ki=null,nn=we.next();It!==null&&!nn.done;tn++,nn=we.next()){It.index>tn?(ki=It,It=null):ki=It.sibling;var bu=mt(ue,It,nn.value,Qe);if(bu===null){It===null&&(It=ki);break}d&&It&&bu.alternate===null&&p(ue,It),se=L(bu,se,tn),Ut===null?ut=bu:Ut.sibling=bu,Ut=bu,It=ki}if(nn.done)return b(ue,It),Bn&&df(ue,tn),ut;if(It===null){for(;!nn.done;tn++,nn=we.next())nn=Ct(ue,nn.value,Qe),nn!==null&&(se=L(nn,se,tn),Ut===null?ut=nn:Ut.sibling=nn,Ut=nn);return Bn&&df(ue,tn),ut}for(It=E(ue,It);!nn.done;tn++,nn=we.next())nn=bn(It,ue,tn,nn.value,Qe),nn!==null&&(d&&nn.alternate!==null&&It.delete(nn.key===null?tn:nn.key),se=L(nn,se,tn),Ut===null?ut=nn:Ut.sibling=nn,Ut=nn);return d&&It.forEach(function(vee){return p(ue,vee)}),Bn&&df(ue,tn),ut}function Oo(ue,se,we,Qe){if(typeof we=="object"&&we!==null&&we.type===u&&we.key===null&&(we=we.props.children),typeof we=="object"&&we!==null){switch(we.$$typeof){case l:e:{for(var ut=we.key,Ut=se;Ut!==null;){if(Ut.key===ut){if(ut=we.type,ut===u){if(Ut.tag===7){b(ue,Ut.sibling),se=T(Ut,we.props.children),se.return=ue,ue=se;break e}}else if(Ut.elementType===ut||typeof ut=="object"&&ut!==null&&ut.$$typeof===x&&$U(ut)===Ut.type){b(ue,Ut.sibling),se=T(Ut,we.props),se.ref=py(ue,Ut,we),se.return=ue,ue=se;break e}b(ue,Ut);break}else p(ue,Ut);Ut=Ut.sibling}we.type===u?(se=xf(we.props.children,ue.mode,Qe,we.key),se.return=ue,ue=se):(Qe=hb(we.type,we.key,we.props,null,ue.mode,Qe),Qe.ref=py(ue,se,we),Qe.return=ue,ue=Qe)}return Z(ue);case c:e:{for(Ut=we.key;se!==null;){if(se.key===Ut)if(se.tag===4&&se.stateNode.containerInfo===we.containerInfo&&se.stateNode.implementation===we.implementation){b(ue,se.sibling),se=T(se,we.children||[]),se.return=ue,ue=se;break e}else{b(ue,se);break}else p(ue,se);se=se.sibling}se=fT(we,ue.mode,Qe),se.return=ue,ue=se}return Z(ue);case x:return Ut=we._init,Oo(ue,se,Ut(we._payload),Qe)}if(P(we))return ft(ue,se,we,Qe);if(A(we))return br(ue,se,we,Qe);Ox(ue,we)}return typeof we=="string"&&we!==""||typeof we=="number"?(we=""+we,se!==null&&se.tag===6?(b(ue,se.sibling),se=T(se,we),se.return=ue,ue=se):(b(ue,se),se=hT(we,ue.mode,Qe),se.return=ue,ue=se),Z(ue)):b(ue,se)}return Oo}var $p=GU(!0),jU=GU(!1),my={},Io=Oi(my),gy=Oi(my),Gp=Oi(my);function Ja(d){if(d===my)throw Error(o(174));return d}function CM(d,p){tt(Gp,p),tt(gy,d),tt(Io,my),d=F(p),bt(Io),tt(Io,d)}function jp(){bt(Io),bt(gy),bt(Gp)}function WU(d){var p=Ja(Gp.current),b=Ja(Io.current);p=N(b,d.type,p),b!==p&&(tt(gy,d),tt(Io,p))}function IM(d){gy.current===d&&(bt(Io),bt(gy))}var $n=Oi(0);function Lx(d){for(var p=d;p!==null;){if(p.tag===13){var b=p.memoizedState;if(b!==null&&(b=b.dehydrated,b===null||ly(b)||cy(b)))return p}else if(p.tag===19&&p.memoizedProps.revealOrder!==void 0){if(p.flags&128)return p}else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===d)break;for(;p.sibling===null;){if(p.return===null||p.return===d)return null;p=p.return}p.sibling.return=p.return,p=p.sibling}return null}var RM=[];function NM(){for(var d=0;d<RM.length;d++){var p=RM[d];Le?p._workInProgressVersionPrimary=null:p._workInProgressVersionSecondary=null}RM.length=0}var Ux=a.ReactCurrentDispatcher,Ro=a.ReactCurrentBatchConfig,Wp=0,Zn=null,vr=null,Bi=null,Bx=!1,yy=!1,vy=0,$J=0;function wr(){throw Error(o(321))}function DM(d,p){if(p===null)return!1;for(var b=0;b<p.length&&b<d.length;b++)if(!Ya(d[b],p[b]))return!1;return!0}function OM(d,p,b,E,T,L){if(Wp=L,Zn=p,p.memoizedState=null,p.updateQueue=null,p.lanes=0,Ux.current=d===null||d.memoizedState===null?qJ:KJ,d=b(E,T),yy){L=0;do{if(yy=!1,vy=0,25<=L)throw Error(o(301));L+=1,Bi=vr=null,p.updateQueue=null,Ux.current=XJ,d=b(E,T)}while(yy)}if(Ux.current=Hx,p=vr!==null&&vr.next!==null,Wp=0,Bi=vr=Zn=null,Bx=!1,p)throw Error(o(300));return d}function LM(){var d=vy!==0;return vy=0,d}function Kl(){var d={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bi===null?Zn.memoizedState=Bi=d:Bi=Bi.next=d,Bi}function el(){if(vr===null){var d=Zn.alternate;d=d!==null?d.memoizedState:null}else d=vr.next;var p=Bi===null?Zn.memoizedState:Bi.next;if(p!==null)Bi=p,vr=d;else{if(d===null)throw Error(o(310));vr=d,d={memoizedState:vr.memoizedState,baseState:vr.baseState,baseQueue:vr.baseQueue,queue:vr.queue,next:null},Bi===null?Zn.memoizedState=Bi=d:Bi=Bi.next=d}return Bi}function pf(d,p){return typeof p=="function"?p(d):p}function kx(d){var p=el(),b=p.queue;if(b===null)throw Error(o(311));b.lastRenderedReducer=d;var E=vr,T=E.baseQueue,L=b.pending;if(L!==null){if(T!==null){var Z=T.next;T.next=L.next,L.next=Z}E.baseQueue=T=L,b.pending=null}if(T!==null){L=T.next,E=E.baseState;var ne=Z=null,_e=null,Ue=L;do{var st=Ue.lane;if((Wp&st)===st)_e!==null&&(_e=_e.next={lane:0,action:Ue.action,hasEagerState:Ue.hasEagerState,eagerState:Ue.eagerState,next:null}),E=Ue.hasEagerState?Ue.eagerState:d(E,Ue.action);else{var Ct={lane:st,action:Ue.action,hasEagerState:Ue.hasEagerState,eagerState:Ue.eagerState,next:null};_e===null?(ne=_e=Ct,Z=E):_e=_e.next=Ct,Zn.lanes|=st,Kp|=st}Ue=Ue.next}while(Ue!==null&&Ue!==L);_e===null?Z=E:_e.next=ne,Ya(E,p.memoizedState)||(Ws=!0),p.memoizedState=E,p.baseState=Z,p.baseQueue=_e,b.lastRenderedState=E}if(d=b.interleaved,d!==null){T=d;do L=T.lane,Zn.lanes|=L,Kp|=L,T=T.next;while(T!==d)}else T===null&&(b.lanes=0);return[p.memoizedState,b.dispatch]}function Fx(d){var p=el(),b=p.queue;if(b===null)throw Error(o(311));b.lastRenderedReducer=d;var E=b.dispatch,T=b.pending,L=p.memoizedState;if(T!==null){b.pending=null;var Z=T=T.next;do L=d(L,Z.action),Z=Z.next;while(Z!==T);Ya(L,p.memoizedState)||(Ws=!0),p.memoizedState=L,p.baseQueue===null&&(p.baseState=L),b.lastRenderedState=L}return[L,E]}function qU(){}function KU(d,p){var b=Zn,E=el(),T=p(),L=!Ya(E.memoizedState,T);if(L&&(E.memoizedState=T,Ws=!0),E=E.queue,xy(QU.bind(null,b,E,d),[d]),E.getSnapshot!==p||L||Bi!==null&&Bi.memoizedState.tag&1){if(b.flags|=2048,wy(9,YU.bind(null,b,E,T,p),void 0,null),gi===null)throw Error(o(349));Wp&30||XU(b,p,T)}return T}function XU(d,p,b){d.flags|=16384,d={getSnapshot:p,value:b},p=Zn.updateQueue,p===null?(p={lastEffect:null,stores:null},Zn.updateQueue=p,p.stores=[d]):(b=p.stores,b===null?p.stores=[d]:b.push(d))}function YU(d,p,b,E){p.value=b,p.getSnapshot=E,ZU(p)&&No(d,1,-1)}function QU(d,p,b){return b(function(){ZU(p)&&No(d,1,-1)})}function ZU(d){var p=d.getSnapshot;d=d.value;try{var b=p();return!Ya(d,b)}catch{return!0}}function UM(d){var p=Kl();return typeof d=="function"&&(d=d()),p.memoizedState=p.baseState=d,d={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:pf,lastRenderedState:d},p.queue=d,d=d.dispatch=WJ.bind(null,Zn,d),[p.memoizedState,d]}function wy(d,p,b,E){return d={tag:d,create:p,destroy:b,deps:E,next:null},p=Zn.updateQueue,p===null?(p={lastEffect:null,stores:null},Zn.updateQueue=p,p.lastEffect=d.next=d):(b=p.lastEffect,b===null?p.lastEffect=d.next=d:(E=b.next,b.next=d,d.next=E,p.lastEffect=d)),d}function JU(){return el().memoizedState}function zx(d,p,b,E){var T=Kl();Zn.flags|=d,T.memoizedState=wy(1|p,b,void 0,E===void 0?null:E)}function Vx(d,p,b,E){var T=el();E=E===void 0?null:E;var L=void 0;if(vr!==null){var Z=vr.memoizedState;if(L=Z.destroy,E!==null&&DM(E,Z.deps)){T.memoizedState=wy(p,b,L,E);return}}Zn.flags|=d,T.memoizedState=wy(1|p,b,L,E)}function BM(d,p){return zx(8390656,8,d,p)}function xy(d,p){return Vx(2048,8,d,p)}function eB(d,p){return Vx(4,2,d,p)}function tB(d,p){return Vx(4,4,d,p)}function nB(d,p){if(typeof p=="function")return d=d(),p(d),function(){p(null)};if(p!=null)return d=d(),p.current=d,function(){p.current=null}}function iB(d,p,b){return b=b!=null?b.concat([d]):null,Vx(4,4,nB.bind(null,p,d),b)}function kM(){}function rB(d,p){var b=el();p=p===void 0?null:p;var E=b.memoizedState;return E!==null&&p!==null&&DM(p,E[1])?E[0]:(b.memoizedState=[d,p],d)}function sB(d,p){var b=el();p=p===void 0?null:p;var E=b.memoizedState;return E!==null&&p!==null&&DM(p,E[1])?E[0]:(d=d(),b.memoizedState=[d,p],d)}function GJ(d,p){var b=en;en=b!==0&&4>b?b:4,d(!0);var E=Ro.transition;Ro.transition={};try{d(!1),p()}finally{en=b,Ro.transition=E}}function oB(){return el().memoizedState}function jJ(d,p,b){var E=vu(d);b={lane:E,action:b,hasEagerState:!1,eagerState:null,next:null},aB(d)?lB(p,b):(cB(d,p,b),b=Kr(),d=No(d,E,b),d!==null&&uB(d,p,E))}function WJ(d,p,b){var E=vu(d),T={lane:E,action:b,hasEagerState:!1,eagerState:null,next:null};if(aB(d))lB(p,T);else{cB(d,p,T);var L=d.alternate;if(d.lanes===0&&(L===null||L.lanes===0)&&(L=p.lastRenderedReducer,L!==null))try{var Z=p.lastRenderedState,ne=L(Z,b);if(T.hasEagerState=!0,T.eagerState=ne,Ya(ne,Z))return}catch{}finally{}b=Kr(),d=No(d,E,b),d!==null&&uB(d,p,E)}}function aB(d){var p=d.alternate;return d===Zn||p!==null&&p===Zn}function lB(d,p){yy=Bx=!0;var b=d.pending;b===null?p.next=p:(p.next=b.next,b.next=p),d.pending=p}function cB(d,p,b){gi!==null&&d.mode&1&&!(Vt&2)?(d=p.interleaved,d===null?(b.next=b,Za===null?Za=[p]:Za.push(p)):(b.next=d.next,d.next=b),p.interleaved=b):(d=p.pending,d===null?b.next=b:(b.next=d.next,d.next=b),p.pending=b)}function uB(d,p,b){if(b&4194240){var E=p.lanes;E&=d.pendingLanes,b|=E,p.lanes=b,fM(d,b)}}var Hx={readContext:To,useCallback:wr,useContext:wr,useEffect:wr,useImperativeHandle:wr,useInsertionEffect:wr,useLayoutEffect:wr,useMemo:wr,useReducer:wr,useRef:wr,useState:wr,useDebugValue:wr,useDeferredValue:wr,useTransition:wr,useMutableSource:wr,useSyncExternalStore:wr,useId:wr,unstable_isNewReconciler:!1},qJ={readContext:To,useCallback:function(d,p){return Kl().memoizedState=[d,p===void 0?null:p],d},useContext:To,useEffect:BM,useImperativeHandle:function(d,p,b){return b=b!=null?b.concat([d]):null,zx(4194308,4,nB.bind(null,p,d),b)},useLayoutEffect:function(d,p){return zx(4194308,4,d,p)},useInsertionEffect:function(d,p){return zx(4,2,d,p)},useMemo:function(d,p){var b=Kl();return p=p===void 0?null:p,d=d(),b.memoizedState=[d,p],d},useReducer:function(d,p,b){var E=Kl();return p=b!==void 0?b(p):p,E.memoizedState=E.baseState=p,d={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:d,lastRenderedState:p},E.queue=d,d=d.dispatch=jJ.bind(null,Zn,d),[E.memoizedState,d]},useRef:function(d){var p=Kl();return d={current:d},p.memoizedState=d},useState:UM,useDebugValue:kM,useDeferredValue:function(d){var p=UM(d),b=p[0],E=p[1];return BM(function(){var T=Ro.transition;Ro.transition={};try{E(d)}finally{Ro.transition=T}},[d]),b},useTransition:function(){var d=UM(!1),p=d[0];return d=GJ.bind(null,d[1]),Kl().memoizedState=d,[p,d]},useMutableSource:function(){},useSyncExternalStore:function(d,p,b){var E=Zn,T=Kl();if(Bn){if(b===void 0)throw Error(o(407));b=b()}else{if(b=p(),gi===null)throw Error(o(349));Wp&30||XU(E,p,b)}T.memoizedState=b;var L={value:b,getSnapshot:p};return T.queue=L,BM(QU.bind(null,E,L,d),[d]),E.flags|=2048,wy(9,YU.bind(null,E,L,b,p),void 0,null),b},useId:function(){var d=Kl(),p=gi.identifierPrefix;if(Bn){var b=ql,E=Wl;b=(E&~(1<<32-$s(E)-1)).toString(32)+b,p=":"+p+"R"+b,b=vy++,0<b&&(p+="H"+b.toString(32)),p+=":"}else b=$J++,p=":"+p+"r"+b.toString(32)+":";return d.memoizedState=p},unstable_isNewReconciler:!1},KJ={readContext:To,useCallback:rB,useContext:To,useEffect:xy,useImperativeHandle:iB,useInsertionEffect:eB,useLayoutEffect:tB,useMemo:sB,useReducer:kx,useRef:JU,useState:function(){return kx(pf)},useDebugValue:kM,useDeferredValue:function(d){var p=kx(pf),b=p[0],E=p[1];return xy(function(){var T=Ro.transition;Ro.transition={};try{E(d)}finally{Ro.transition=T}},[d]),b},useTransition:function(){var d=kx(pf)[0],p=el().memoizedState;return[d,p]},useMutableSource:qU,useSyncExternalStore:KU,useId:oB,unstable_isNewReconciler:!1},XJ={readContext:To,useCallback:rB,useContext:To,useEffect:xy,useImperativeHandle:iB,useInsertionEffect:eB,useLayoutEffect:tB,useMemo:sB,useReducer:Fx,useRef:JU,useState:function(){return Fx(pf)},useDebugValue:kM,useDeferredValue:function(d){var p=Fx(pf),b=p[0],E=p[1];return xy(function(){var T=Ro.transition;Ro.transition={};try{E(d)}finally{Ro.transition=T}},[d]),b},useTransition:function(){var d=Fx(pf)[0],p=el().memoizedState;return[d,p]},useMutableSource:qU,useSyncExternalStore:KU,useId:oB,unstable_isNewReconciler:!1};function FM(d,p){try{var b="",E=p;do b+=HJ(E),E=E.return;while(E);var T=b}catch(L){T=`
4035Error generating stack: `+L.message+`
4036`+L.stack}return{value:d,source:p,stack:T}}function zM(d,p){try{console.error(p.value)}catch(b){setTimeout(function(){throw b})}}var YJ=typeof WeakMap=="function"?WeakMap:Map;function hB(d,p,b){b=jl(-1,b),b.tag=3,b.payload={element:null};var E=p.value;return b.callback=function(){rb||(rb=!0,rT=E),zM(d,p)},b}function fB(d,p,b){b=jl(-1,b),b.tag=3;var E=d.type.getDerivedStateFromError;if(typeof E=="function"){var T=p.value;b.payload=function(){return E(T)},b.callback=function(){zM(d,p)}}var L=d.stateNode;return L!==null&&typeof L.componentDidCatch=="function"&&(b.callback=function(){zM(d,p),typeof E!="function"&&(gu===null?gu=new Set([this]):gu.add(this));var Z=p.stack;this.componentDidCatch(p.value,{componentStack:Z!==null?Z:""})}),b}function dB(d,p,b){var E=d.pingCache;if(E===null){E=d.pingCache=new YJ;var T=new Set;E.set(p,T)}else T=E.get(p),T===void 0&&(T=new Set,E.set(p,T));T.has(b)||(T.add(b),d=uee.bind(null,d,p,b),p.then(d,d))}function pB(d){do{var p;if((p=d.tag===13)&&(p=d.memoizedState,p=p!==null?p.dehydrated!==null:!0),p)return d;d=d.return}while(d!==null);return null}function mB(d,p,b,E,T){return d.mode&1?(d.flags|=65536,d.lanes=T,d):(d===p?d.flags|=65536:(d.flags|=128,b.flags|=131072,b.flags&=-52805,b.tag===1&&(b.alternate===null?b.tag=17:(p=jl(-1,1),p.tag=2,mu(b,p))),b.lanes|=1),d)}function tl(d){d.flags|=4}function gB(d,p){if(d!==null&&d.child===p.child)return!0;if(p.flags&16)return!1;for(d=p.child;d!==null;){if(d.flags&12854||d.subtreeFlags&12854)return!1;d=d.sibling}return!0}var by,_y,$x,Gx;if(Oe)by=function(d,p){for(var b=p.child;b!==null;){if(b.tag===5||b.tag===6)Q(d,b.stateNode);else if(b.tag!==4&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===p)break;for(;b.sibling===null;){if(b.return===null||b.return===p)return;b=b.return}b.sibling.return=b.return,b=b.sibling}},_y=function(){},$x=function(d,p,b,E,T){if(d=d.memoizedProps,d!==E){var L=p.stateNode,Z=Ja(Io.current);b=Y(L,b,d,E,T,Z),(p.updateQueue=b)&&tl(p)}},Gx=function(d,p,b,E){b!==E&&tl(p)};else if(J){by=function(d,p,b,E){for(var T=p.child;T!==null;){if(T.tag===5){var L=T.stateNode;b&&E&&(L=mi(L,T.type,T.memoizedProps,T)),Q(d,L)}else if(T.tag===6)L=T.stateNode,b&&E&&(L=Wr(L,T.memoizedProps,T)),Q(d,L);else if(T.tag!==4){if(T.tag===22&&T.memoizedState!==null)L=T.child,L!==null&&(L.return=T),by(d,T,!0,!0);else if(T.child!==null){T.child.return=T,T=T.child;continue}}if(T===p)break;for(;T.sibling===null;){if(T.return===null||T.return===p)return;T=T.return}T.sibling.return=T.return,T=T.sibling}};var yB=function(d,p,b,E){for(var T=p.child;T!==null;){if(T.tag===5){var L=T.stateNode;b&&E&&(L=mi(L,T.type,T.memoizedProps,T)),We(d,L)}else if(T.tag===6)L=T.stateNode,b&&E&&(L=Wr(L,T.memoizedProps,T)),We(d,L);else if(T.tag!==4){if(T.tag===22&&T.memoizedState!==null)L=T.child,L!==null&&(L.return=T),yB(d,T,!0,!0);else if(T.child!==null){T.child.return=T,T=T.child;continue}}if(T===p)break;for(;T.sibling===null;){if(T.return===null||T.return===p)return;T=T.return}T.sibling.return=T.return,T=T.sibling}};_y=function(d,p){var b=p.stateNode;if(!gB(d,p)){d=b.containerInfo;var E=ze(d);yB(E,p,!1,!1),b.pendingChildren=E,tl(p),Ht(d,E)}},$x=function(d,p,b,E,T){var L=d.stateNode,Z=d.memoizedProps;if((d=gB(d,p))&&Z===E)p.stateNode=L;else{var ne=p.stateNode,_e=Ja(Io.current),Ue=null;Z!==E&&(Ue=Y(ne,b,Z,E,T,_e)),d&&Ue===null?p.stateNode=L:(L=de(L,Ue,b,Z,E,p,d,ne),oe(L,b,E,T,_e)&&tl(p),p.stateNode=L,d?tl(p):by(L,p,!1,!1))}},Gx=function(d,p,b,E){b!==E?(d=Ja(Gp.current),b=Ja(Io.current),p.stateNode=le(E,d,b,p),tl(p)):p.stateNode=d.stateNode}}else _y=function(){},$x=function(){},Gx=function(){};function Ey(d,p){if(!Bn)switch(d.tailMode){case"hidden":p=d.tail;for(var b=null;p!==null;)p.alternate!==null&&(b=p),p=p.sibling;b===null?d.tail=null:b.sibling=null;break;case"collapsed":b=d.tail;for(var E=null;b!==null;)b.alternate!==null&&(E=b),b=b.sibling;E===null?p||d.tail===null?d.tail=null:d.tail.sibling=null:E.sibling=null}}function xr(d){var p=d.alternate!==null&&d.alternate.child===d.child,b=0,E=0;if(p)for(var T=d.child;T!==null;)b|=T.lanes|T.childLanes,E|=T.subtreeFlags&14680064,E|=T.flags&14680064,T.return=d,T=T.sibling;else for(T=d.child;T!==null;)b|=T.lanes|T.childLanes,E|=T.subtreeFlags,E|=T.flags,T.return=d,T=T.sibling;return d.subtreeFlags|=E,d.childLanes=b,p}function QJ(d,p,b){var E=p.pendingProps;switch(AM(p),p.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return xr(p),null;case 1:return Li(p.type)&&oi(),xr(p),null;case 3:return E=p.stateNode,jp(),bt(Qn),bt(Ot),NM(),E.pendingContext&&(E.context=E.pendingContext,E.pendingContext=null),(d===null||d.child===null)&&(dy(p)?tl(p):d===null||d.memoizedState.isDehydrated&&!(p.flags&256)||(p.flags|=1024,ua!==null&&(aT(ua),ua=null))),_y(d,p),xr(p),null;case 5:IM(p),b=Ja(Gp.current);var T=p.type;if(d!==null&&p.stateNode!=null)$x(d,p,T,E,b),d.ref!==p.ref&&(p.flags|=512,p.flags|=2097152);else{if(!E){if(p.stateNode===null)throw Error(o(166));return xr(p),null}if(d=Ja(Io.current),dy(p)){if(!Se)throw Error(o(175));d=aM(p.stateNode,p.type,p.memoizedProps,b,d,p,!fy),p.updateQueue=d,d!==null&&tl(p)}else{var L=W(T,E,b,d,p);by(L,p,!1,!1),p.stateNode=L,oe(L,T,E,b,d)&&tl(p)}p.ref!==null&&(p.flags|=512,p.flags|=2097152)}return xr(p),null;case 6:if(d&&p.stateNode!=null)Gx(d,p,d.memoizedProps,E);else{if(typeof E!="string"&&p.stateNode===null)throw Error(o(166));if(d=Ja(Gp.current),b=Ja(Io.current),dy(p)){if(!Se)throw Error(o(176));if(d=p.stateNode,E=p.memoizedProps,(b=lM(d,E,p,!fy))&&(T=Gs,T!==null))switch(L=(T.mode&1)!==0,T.tag){case 3:ht(T.stateNode.containerInfo,d,E,L);break;case 5:gt(T.type,T.memoizedProps,T.stateNode,d,E,L)}b&&tl(p)}else p.stateNode=le(E,d,b,p)}return xr(p),null;case 13:if(bt($n),E=p.memoizedState,Bn&&js!==null&&p.mode&1&&!(p.flags&128)){for(d=js;d;)d=du(d);return Hp(),p.flags|=98560,p}if(E!==null&&E.dehydrated!==null){if(E=dy(p),d===null){if(!E)throw Error(o(318));if(!Se)throw Error(o(344));if(d=p.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(o(317));cM(d,p)}else Hp(),!(p.flags&128)&&(p.memoizedState=null),p.flags|=4;return xr(p),null}return ua!==null&&(aT(ua),ua=null),p.flags&128?(p.lanes=b,p):(E=E!==null,b=!1,d===null?dy(p):b=d.memoizedState!==null,E&&!b&&(p.child.flags|=8192,p.mode&1&&(d===null||$n.current&1?Mi===0&&(Mi=3):cT())),p.updateQueue!==null&&(p.flags|=4),xr(p),null);case 4:return jp(),_y(d,p),d===null&&Re(p.stateNode.containerInfo),xr(p),null;case 10:return wM(p.type._context),xr(p),null;case 17:return Li(p.type)&&oi(),xr(p),null;case 19:if(bt($n),T=p.memoizedState,T===null)return xr(p),null;if(E=(p.flags&128)!==0,L=T.rendering,L===null)if(E)Ey(T,!1);else{if(Mi!==0||d!==null&&d.flags&128)for(d=p.child;d!==null;){if(L=Lx(d),L!==null){for(p.flags|=128,Ey(T,!1),d=L.updateQueue,d!==null&&(p.updateQueue=d,p.flags|=4),p.subtreeFlags=0,d=b,E=p.child;E!==null;)b=E,T=d,b.flags&=14680066,L=b.alternate,L===null?(b.childLanes=0,b.lanes=T,b.child=null,b.subtreeFlags=0,b.memoizedProps=null,b.memoizedState=null,b.updateQueue=null,b.dependencies=null,b.stateNode=null):(b.childLanes=L.childLanes,b.lanes=L.lanes,b.child=L.child,b.subtreeFlags=0,b.deletions=null,b.memoizedProps=L.memoizedProps,b.memoizedState=L.memoizedState,b.updateQueue=L.updateQueue,b.type=L.type,T=L.dependencies,b.dependencies=T===null?null:{lanes:T.lanes,firstContext:T.firstContext}),E=E.sibling;return tt($n,$n.current&1|2),p.child}d=d.sibling}T.tail!==null&&Ui()>iT&&(p.flags|=128,E=!0,Ey(T,!1),p.lanes=4194304)}else{if(!E)if(d=Lx(L),d!==null){if(p.flags|=128,E=!0,d=d.updateQueue,d!==null&&(p.updateQueue=d,p.flags|=4),Ey(T,!0),T.tail===null&&T.tailMode==="hidden"&&!L.alternate&&!Bn)return xr(p),null}else 2*Ui()-T.renderingStartTime>iT&&b!==1073741824&&(p.flags|=128,E=!0,Ey(T,!1),p.lanes=4194304);T.isBackwards?(L.sibling=p.child,p.child=L):(d=T.last,d!==null?d.sibling=L:p.child=L,T.last=L)}return T.tail!==null?(p=T.tail,T.rendering=p,T.tail=p.sibling,T.renderingStartTime=Ui(),p.sibling=null,d=$n.current,tt($n,E?d&1|2:d&1),p):(xr(p),null);case 22:case 23:return lT(),E=p.memoizedState!==null,d!==null&&d.memoizedState!==null!==E&&(p.flags|=8192),E&&p.mode&1?qs&1073741824&&(xr(p),Oe&&p.subtreeFlags&6&&(p.flags|=8192)):xr(p),null;case 24:return null;case 25:return null}throw Error(o(156,p.tag))}var ZJ=a.ReactCurrentOwner,Ws=!1;function qr(d,p,b,E){p.child=d===null?jU(p,null,b,E):$p(p,d.child,b,E)}function vB(d,p,b,E,T){b=b.render;var L=p.ref;return Fp(p,T),E=OM(d,p,b,E,L,T),b=LM(),d!==null&&!Ws?(p.updateQueue=d.updateQueue,p.flags&=-2053,d.lanes&=~T,Xl(d,p,T)):(Bn&&b&&SM(p),p.flags|=1,qr(d,p,E,T),p.child)}function wB(d,p,b,E,T){if(d===null){var L=b.type;return typeof L=="function"&&!uT(L)&&L.defaultProps===void 0&&b.compare===null&&b.defaultProps===void 0?(p.tag=15,p.type=L,xB(d,p,L,E,T)):(d=hb(b.type,null,E,p,p.mode,T),d.ref=p.ref,d.return=p,p.child=d)}if(L=d.child,!(d.lanes&T)){var Z=L.memoizedProps;if(b=b.compare,b=b!==null?b:Mx,b(Z,E)&&d.ref===p.ref)return Xl(d,p,T)}return p.flags|=1,d=xu(L,E),d.ref=p.ref,d.return=p,p.child=d}function xB(d,p,b,E,T){if(d!==null&&Mx(d.memoizedProps,E)&&d.ref===p.ref)if(Ws=!1,(d.lanes&T)!==0)d.flags&131072&&(Ws=!0);else return p.lanes=d.lanes,Xl(d,p,T);return VM(d,p,b,E,T)}function bB(d,p,b){var E=p.pendingProps,T=E.children,L=d!==null?d.memoizedState:null;if(E.mode==="hidden")if(!(p.mode&1))p.memoizedState={baseLanes:0,cachePool:null},tt(qp,qs),qs|=b;else if(b&1073741824)p.memoizedState={baseLanes:0,cachePool:null},E=L!==null?L.baseLanes:b,tt(qp,qs),qs|=E;else return d=L!==null?L.baseLanes|b:b,p.lanes=p.childLanes=1073741824,p.memoizedState={baseLanes:d,cachePool:null},p.updateQueue=null,tt(qp,qs),qs|=d,null;else L!==null?(E=L.baseLanes|b,p.memoizedState=null):E=b,tt(qp,qs),qs|=E;return qr(d,p,T,b),p.child}function _B(d,p){var b=p.ref;(d===null&&b!==null||d!==null&&d.ref!==b)&&(p.flags|=512,p.flags|=2097152)}function VM(d,p,b,E,T){var L=Li(b)?qa:Ot.current;return L=Mo(p,L),Fp(p,T),b=OM(d,p,b,E,L,T),E=LM(),d!==null&&!Ws?(p.updateQueue=d.updateQueue,p.flags&=-2053,d.lanes&=~T,Xl(d,p,T)):(Bn&&E&&SM(p),p.flags|=1,qr(d,p,b,T),p.child)}function EB(d,p,b,E,T){if(Li(b)){var L=!0;er(p)}else L=!1;if(Fp(p,T),p.stateNode===null)d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),BU(p,b,E),EM(p,b,E,T),E=!0;else if(d===null){var Z=p.stateNode,ne=p.memoizedProps;Z.props=ne;var _e=Z.context,Ue=b.contextType;typeof Ue=="object"&&Ue!==null?Ue=To(Ue):(Ue=Li(b)?qa:Ot.current,Ue=Mo(p,Ue));var st=b.getDerivedStateFromProps,Ct=typeof st=="function"||typeof Z.getSnapshotBeforeUpdate=="function";Ct||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(ne!==E||_e!==Ue)&&kU(p,Z,E,Ue),pu=!1;var mt=p.memoizedState;Z.state=mt,Ix(p,E,Z,T),_e=p.memoizedState,ne!==E||mt!==_e||Qn.current||pu?(typeof st=="function"&&(_M(p,b,st,E),_e=p.memoizedState),(ne=pu||UU(p,b,ne,E,mt,_e,Ue))?(Ct||typeof Z.UNSAFE_componentWillMount!="function"&&typeof Z.componentWillMount!="function"||(typeof Z.componentWillMount=="function"&&Z.componentWillMount(),typeof Z.UNSAFE_componentWillMount=="function"&&Z.UNSAFE_componentWillMount()),typeof Z.componentDidMount=="function"&&(p.flags|=4194308)):(typeof Z.componentDidMount=="function"&&(p.flags|=4194308),p.memoizedProps=E,p.memoizedState=_e),Z.props=E,Z.state=_e,Z.context=Ue,E=ne):(typeof Z.componentDidMount=="function"&&(p.flags|=4194308),E=!1)}else{Z=p.stateNode,NU(d,p),ne=p.memoizedProps,Ue=p.type===p.elementType?ne:ca(p.type,ne),Z.props=Ue,Ct=p.pendingProps,mt=Z.context,_e=b.contextType,typeof _e=="object"&&_e!==null?_e=To(_e):(_e=Li(b)?qa:Ot.current,_e=Mo(p,_e));var bn=b.getDerivedStateFromProps;(st=typeof bn=="function"||typeof Z.getSnapshotBeforeUpdate=="function")||typeof Z.UNSAFE_componentWillReceiveProps!="function"&&typeof Z.componentWillReceiveProps!="function"||(ne!==Ct||mt!==_e)&&kU(p,Z,E,_e),pu=!1,mt=p.memoizedState,Z.state=mt,Ix(p,E,Z,T);var ft=p.memoizedState;ne!==Ct||mt!==ft||Qn.current||pu?(typeof bn=="function"&&(_M(p,b,bn,E),ft=p.memoizedState),(Ue=pu||UU(p,b,Ue,E,mt,ft,_e)||!1)?(st||typeof Z.UNSAFE_componentWillUpdate!="function"&&typeof Z.componentWillUpdate!="function"||(typeof Z.componentWillUpdate=="function"&&Z.componentWillUpdate(E,ft,_e),typeof Z.UNSAFE_componentWillUpdate=="function"&&Z.UNSAFE_componentWillUpdate(E,ft,_e)),typeof Z.componentDidUpdate=="function"&&(p.flags|=4),typeof Z.getSnapshotBeforeUpdate=="function"&&(p.flags|=1024)):(typeof Z.componentDidUpdate!="function"||ne===d.memoizedProps&&mt===d.memoizedState||(p.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||ne===d.memoizedProps&&mt===d.memoizedState||(p.flags|=1024),p.memoizedProps=E,p.memoizedState=ft),Z.props=E,Z.state=ft,Z.context=_e,E=Ue):(typeof Z.componentDidUpdate!="function"||ne===d.memoizedProps&&mt===d.memoizedState||(p.flags|=4),typeof Z.getSnapshotBeforeUpdate!="function"||ne===d.memoizedProps&&mt===d.memoizedState||(p.flags|=1024),E=!1)}return HM(d,p,b,E,L,T)}function HM(d,p,b,E,T,L){_B(d,p);var Z=(p.flags&128)!==0;if(!E&&!Z)return T&&Bp(p,b,!1),Xl(d,p,L);E=p.stateNode,ZJ.current=p;var ne=Z&&typeof b.getDerivedStateFromError!="function"?null:E.render();return p.flags|=1,d!==null&&Z?(p.child=$p(p,d.child,null,L),p.child=$p(p,null,ne,L)):qr(d,p,ne,L),p.memoizedState=E.state,T&&Bp(p,b,!0),p.child}function SB(d){var p=d.stateNode;p.pendingContext?Ka(d,p.pendingContext,p.pendingContext!==p.context):p.context&&Ka(d,p.context,!1),CM(d,p.containerInfo)}function AB(d,p,b,E,T){return Hp(),PM(T),p.flags|=256,qr(d,p,b,E),p.child}var jx={dehydrated:null,treeContext:null,retryLane:0};function Wx(d){return{baseLanes:d,cachePool:null}}function MB(d,p,b){var E=p.pendingProps,T=$n.current,L=!1,Z=(p.flags&128)!==0,ne;if((ne=Z)||(ne=d!==null&&d.memoizedState===null?!1:(T&2)!==0),ne?(L=!0,p.flags&=-129):(d===null||d.memoizedState!==null)&&(T|=1),tt($n,T&1),d===null)return TM(p),d=p.memoizedState,d!==null&&(d=d.dehydrated,d!==null)?(p.mode&1?cy(d)?p.lanes=8:p.lanes=1073741824:p.lanes=1,null):(T=E.children,d=E.fallback,L?(E=p.mode,L=p.child,T={mode:"hidden",children:T},!(E&1)&&L!==null?(L.childLanes=0,L.pendingProps=T):L=fb(T,E,0,null),d=xf(d,E,b,null),L.return=p,d.return=p,L.sibling=d,p.child=L,p.child.memoizedState=Wx(b),p.memoizedState=jx,d):$M(p,T));if(T=d.memoizedState,T!==null){if(ne=T.dehydrated,ne!==null){if(Z)return p.flags&256?(p.flags&=-257,qx(d,p,b,Error(o(422)))):p.memoizedState!==null?(p.child=d.child,p.flags|=128,null):(L=E.fallback,T=p.mode,E=fb({mode:"visible",children:E.children},T,0,null),L=xf(L,T,b,null),L.flags|=2,E.return=p,L.return=p,E.sibling=L,p.child=E,p.mode&1&&$p(p,d.child,null,b),p.child.memoizedState=Wx(b),p.memoizedState=jx,L);if(!(p.mode&1))p=qx(d,p,b,null);else if(cy(ne))p=qx(d,p,b,Error(o(419)));else if(E=(b&d.childLanes)!==0,Ws||E){if(E=gi,E!==null){switch(b&-b){case 4:L=2;break;case 16:L=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:L=32;break;case 536870912:L=268435456;break;default:L=0}E=L&(E.suspendedLanes|b)?0:L,E!==0&&E!==T.retryLane&&(T.retryLane=E,No(d,E,-1))}cT(),p=qx(d,p,b,Error(o(421)))}else ly(ne)?(p.flags|=128,p.child=d.child,p=hee.bind(null,d),Op(ne,p),p=null):(b=T.treeContext,Se&&(js=wx(ne),Gs=p,Bn=!0,ua=null,fy=!1,b!==null&&(Po[Co++]=Wl,Po[Co++]=ql,Po[Co++]=ff,Wl=b.id,ql=b.overflow,ff=p)),p=$M(p,p.pendingProps.children),p.flags|=4096);return p}return L?(E=PB(d,p,E.children,E.fallback,b),L=p.child,T=d.child.memoizedState,L.memoizedState=T===null?Wx(b):{baseLanes:T.baseLanes|b,cachePool:null},L.childLanes=d.childLanes&~b,p.memoizedState=jx,E):(b=TB(d,p,E.children,b),p.memoizedState=null,b)}return L?(E=PB(d,p,E.children,E.fallback,b),L=p.child,T=d.child.memoizedState,L.memoizedState=T===null?Wx(b):{baseLanes:T.baseLanes|b,cachePool:null},L.childLanes=d.childLanes&~b,p.memoizedState=jx,E):(b=TB(d,p,E.children,b),p.memoizedState=null,b)}function $M(d,p){return p=fb({mode:"visible",children:p},d.mode,0,null),p.return=d,d.child=p}function TB(d,p,b,E){var T=d.child;return d=T.sibling,b=xu(T,{mode:"visible",children:b}),!(p.mode&1)&&(b.lanes=E),b.return=p,b.sibling=null,d!==null&&(E=p.deletions,E===null?(p.deletions=[d],p.flags|=16):E.push(d)),p.child=b}function PB(d,p,b,E,T){var L=p.mode;d=d.child;var Z=d.sibling,ne={mode:"hidden",children:b};return!(L&1)&&p.child!==d?(b=p.child,b.childLanes=0,b.pendingProps=ne,p.deletions=null):(b=xu(d,ne),b.subtreeFlags=d.subtreeFlags&14680064),Z!==null?E=xu(Z,E):(E=xf(E,L,T,null),E.flags|=2),E.return=p,b.return=p,b.sibling=E,p.child=b,E}function qx(d,p,b,E){return E!==null&&PM(E),$p(p,d.child,null,b),d=$M(p,p.pendingProps.children),d.flags|=2,p.memoizedState=null,d}function CB(d,p,b){d.lanes|=p;var E=d.alternate;E!==null&&(E.lanes|=p),xM(d.return,p,b)}function GM(d,p,b,E,T){var L=d.memoizedState;L===null?d.memoizedState={isBackwards:p,rendering:null,renderingStartTime:0,last:E,tail:b,tailMode:T}:(L.isBackwards=p,L.rendering=null,L.renderingStartTime=0,L.last=E,L.tail=b,L.tailMode=T)}function IB(d,p,b){var E=p.pendingProps,T=E.revealOrder,L=E.tail;if(qr(d,p,E.children,b),E=$n.current,E&2)E=E&1|2,p.flags|=128;else{if(d!==null&&d.flags&128)e:for(d=p.child;d!==null;){if(d.tag===13)d.memoizedState!==null&&CB(d,b,p);else if(d.tag===19)CB(d,b,p);else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===p)break e;for(;d.sibling===null;){if(d.return===null||d.return===p)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}E&=1}if(tt($n,E),!(p.mode&1))p.memoizedState=null;else switch(T){case"forwards":for(b=p.child,T=null;b!==null;)d=b.alternate,d!==null&&Lx(d)===null&&(T=b),b=b.sibling;b=T,b===null?(T=p.child,p.child=null):(T=b.sibling,b.sibling=null),GM(p,!1,T,b,L);break;case"backwards":for(b=null,T=p.child,p.child=null;T!==null;){if(d=T.alternate,d!==null&&Lx(d)===null){p.child=T;break}d=T.sibling,T.sibling=b,b=T,T=d}GM(p,!0,b,null,L);break;case"together":GM(p,!1,null,null,void 0);break;default:p.memoizedState=null}return p.child}function Xl(d,p,b){if(d!==null&&(p.dependencies=d.dependencies),Kp|=p.lanes,!(b&p.childLanes))return null;if(d!==null&&p.child!==d.child)throw Error(o(153));if(p.child!==null){for(d=p.child,b=xu(d,d.pendingProps),p.child=b,b.return=p;d.sibling!==null;)d=d.sibling,b=b.sibling=xu(d,d.pendingProps),b.return=p;b.sibling=null}return p.child}function JJ(d,p,b){switch(p.tag){case 3:SB(p),Hp();break;case 5:WU(p);break;case 1:Li(p.type)&&er(p);break;case 4:CM(p,p.stateNode.containerInfo);break;case 10:RU(p,p.type._context,p.memoizedProps.value);break;case 13:var E=p.memoizedState;if(E!==null)return E.dehydrated!==null?(tt($n,$n.current&1),p.flags|=128,null):b&p.child.childLanes?MB(d,p,b):(tt($n,$n.current&1),d=Xl(d,p,b),d!==null?d.sibling:null);tt($n,$n.current&1);break;case 19:if(E=(b&p.childLanes)!==0,d.flags&128){if(E)return IB(d,p,b);p.flags|=128}var T=p.memoizedState;if(T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),tt($n,$n.current),E)break;return null;case 22:case 23:return p.lanes=0,bB(d,p,b)}return Xl(d,p,b)}function eee(d,p){switch(AM(p),p.tag){case 1:return Li(p.type)&&oi(),d=p.flags,d&65536?(p.flags=d&-65537|128,p):null;case 3:return jp(),bt(Qn),bt(Ot),NM(),d=p.flags,d&65536&&!(d&128)?(p.flags=d&-65537|128,p):null;case 5:return IM(p),null;case 13:if(bt($n),d=p.memoizedState,d!==null&&d.dehydrated!==null){if(p.alternate===null)throw Error(o(340));Hp()}return d=p.flags,d&65536?(p.flags=d&-65537|128,p):null;case 19:return bt($n),null;case 4:return jp(),null;case 10:return wM(p.type._context),null;case 22:case 23:return lT(),null;case 24:return null;default:return null}}var Kx=!1,mf=!1,tee=typeof WeakSet=="function"?WeakSet:Set,qe=null;function Xx(d,p){var b=d.ref;if(b!==null)if(typeof b=="function")try{b(null)}catch(E){gs(d,p,E)}else b.current=null}function jM(d,p,b){try{b()}catch(E){gs(d,p,E)}}var RB=!1;function nee(d,p){for(O(d.containerInfo),qe=p;qe!==null;)if(d=qe,p=d.child,(d.subtreeFlags&1028)!==0&&p!==null)p.return=d,qe=p;else for(;qe!==null;){d=qe;try{var b=d.alternate;if(d.flags&1024)switch(d.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var E=b.memoizedProps,T=b.memoizedState,L=d.stateNode,Z=L.getSnapshotBeforeUpdate(d.elementType===d.type?E:ca(d.type,E),T);L.__reactInternalSnapshotBeforeUpdate=Z}break;case 3:Oe&&je(d.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ne){gs(d,d.return,ne)}if(p=d.sibling,p!==null){p.return=d.return,qe=p;break}qe=d.return}return b=RB,RB=!1,b}function gf(d,p,b){var E=p.updateQueue;if(E=E!==null?E.lastEffect:null,E!==null){var T=E=E.next;do{if((T.tag&d)===d){var L=T.destroy;T.destroy=void 0,L!==void 0&&jM(p,b,L)}T=T.next}while(T!==E)}}function Sy(d,p){if(p=p.updateQueue,p=p!==null?p.lastEffect:null,p!==null){var b=p=p.next;do{if((b.tag&d)===d){var E=b.create;b.destroy=E()}b=b.next}while(b!==p)}}function WM(d){var p=d.ref;if(p!==null){var b=d.stateNode;switch(d.tag){case 5:d=R(b);break;default:d=b}typeof p=="function"?p(d):p.current=d}}function NB(d,p,b){if(Xa&&typeof Xa.onCommitFiberUnmount=="function")try{Xa.onCommitFiberUnmount(Sx,p)}catch{}switch(p.tag){case 0:case 11:case 14:case 15:if(d=p.updateQueue,d!==null&&(d=d.lastEffect,d!==null)){var E=d=d.next;do{var T=E,L=T.destroy;T=T.tag,L!==void 0&&(T&2||T&4)&&jM(p,b,L),E=E.next}while(E!==d)}break;case 1:if(Xx(p,b),d=p.stateNode,typeof d.componentWillUnmount=="function")try{d.props=p.memoizedProps,d.state=p.memoizedState,d.componentWillUnmount()}catch(Z){gs(p,b,Z)}break;case 5:Xx(p,b);break;case 4:Oe?kB(d,p,b):J&&J&&(p=p.stateNode.containerInfo,b=ze(p),fn(p,b))}}function DB(d,p,b){for(var E=p;;)if(NB(d,E,b),E.child===null||Oe&&E.tag===4){if(E===p)break;for(;E.sibling===null;){if(E.return===null||E.return===p)return;E=E.return}E.sibling.return=E.return,E=E.sibling}else E.child.return=E,E=E.child}function OB(d){var p=d.alternate;p!==null&&(d.alternate=null,OB(p)),d.child=null,d.deletions=null,d.sibling=null,d.tag===5&&(p=d.stateNode,p!==null&&Ze(p)),d.stateNode=null,d.return=null,d.dependencies=null,d.memoizedProps=null,d.memoizedState=null,d.pendingProps=null,d.stateNode=null,d.updateQueue=null}function LB(d){return d.tag===5||d.tag===3||d.tag===4}function UB(d){e:for(;;){for(;d.sibling===null;){if(d.return===null||LB(d.return))return null;d=d.return}for(d.sibling.return=d.return,d=d.sibling;d.tag!==5&&d.tag!==6&&d.tag!==18;){if(d.flags&2||d.child===null||d.tag===4)continue e;d.child.return=d,d=d.child}if(!(d.flags&2))return d.stateNode}}function BB(d){if(Oe){e:{for(var p=d.return;p!==null;){if(LB(p))break e;p=p.return}throw Error(o(160))}var b=p;switch(b.tag){case 5:p=b.stateNode,b.flags&32&&(ct(p),b.flags&=-33),b=UB(d),KM(d,b,p);break;case 3:case 4:p=b.stateNode.containerInfo,b=UB(d),qM(d,b,p);break;default:throw Error(o(161))}}}function qM(d,p,b){var E=d.tag;if(E===5||E===6)d=d.stateNode,p?zt(b,d,p):Fe(b,d);else if(E!==4&&(d=d.child,d!==null))for(qM(d,p,b),d=d.sibling;d!==null;)qM(d,p,b),d=d.sibling}function KM(d,p,b){var E=d.tag;if(E===5||E===6)d=d.stateNode,p?Yn(b,d,p):pt(b,d);else if(E!==4&&(d=d.child,d!==null))for(KM(d,p,b),d=d.sibling;d!==null;)KM(d,p,b),d=d.sibling}function kB(d,p,b){for(var E=p,T=!1,L,Z;;){if(!T){T=E.return;e:for(;;){if(T===null)throw Error(o(160));switch(L=T.stateNode,T.tag){case 5:Z=!1;break e;case 3:L=L.containerInfo,Z=!0;break e;case 4:L=L.containerInfo,Z=!0;break e}T=T.return}T=!0}if(E.tag===5||E.tag===6)DB(d,E,b),Z?lt(L,E.stateNode):dt(L,E.stateNode);else if(E.tag===18)Z?he(L,E.stateNode):ye(L,E.stateNode);else if(E.tag===4){if(E.child!==null){L=E.stateNode.containerInfo,Z=!0,E.child.return=E,E=E.child;continue}}else if(NB(d,E,b),E.child!==null){E.child.return=E,E=E.child;continue}if(E===p)break;for(;E.sibling===null;){if(E.return===null||E.return===p)return;E=E.return,E.tag===4&&(T=!1)}E.sibling.return=E.return,E=E.sibling}}function XM(d,p){if(Oe){switch(p.tag){case 0:case 11:case 14:case 15:gf(3,p,p.return),Sy(3,p),gf(5,p,p.return);return;case 1:return;case 5:var b=p.stateNode;if(b!=null){var E=p.memoizedProps;d=d!==null?d.memoizedProps:E;var T=p.type,L=p.updateQueue;p.updateQueue=null,L!==null&&ke(b,L,T,d,E,p)}return;case 6:if(p.stateNode===null)throw Error(o(162));b=p.memoizedProps,$e(p.stateNode,d!==null?d.memoizedProps:b,b);return;case 3:Se&&d!==null&&d.memoizedState.isDehydrated&&ae(p.stateNode.containerInfo);return;case 12:return;case 13:Yx(p);return;case 19:Yx(p);return;case 17:return}throw Error(o(163))}switch(p.tag){case 0:case 11:case 14:case 15:gf(3,p,p.return),Sy(3,p),gf(5,p,p.return);return;case 12:return;case 13:Yx(p);return;case 19:Yx(p);return;case 3:Se&&d!==null&&d.memoizedState.isDehydrated&&ae(p.stateNode.containerInfo);break;case 22:case 23:return}e:if(J){switch(p.tag){case 1:case 5:case 6:break e;case 3:case 4:p=p.stateNode,fn(p.containerInfo,p.pendingChildren);break e}throw Error(o(163))}}function Yx(d){var p=d.updateQueue;if(p!==null){d.updateQueue=null;var b=d.stateNode;b===null&&(b=d.stateNode=new tee),p.forEach(function(E){var T=fee.bind(null,d,E);b.has(E)||(b.add(E),E.then(T,T))})}}function iee(d,p){for(qe=p;qe!==null;){p=qe;var b=p.deletions;if(b!==null)for(var E=0;E<b.length;E++){var T=b[E];try{var L=d;Oe?kB(L,T,p):DB(L,T,p);var Z=T.alternate;Z!==null&&(Z.return=null),T.return=null}catch(ut){gs(T,p,ut)}}if(b=p.child,p.subtreeFlags&12854&&b!==null)b.return=p,qe=b;else for(;qe!==null;){p=qe;try{var ne=p.flags;if(ne&32&&Oe&&ct(p.stateNode),ne&512){var _e=p.alternate;if(_e!==null){var Ue=_e.ref;Ue!==null&&(typeof Ue=="function"?Ue(null):Ue.current=null)}}if(ne&8192)switch(p.tag){case 13:if(p.memoizedState!==null){var st=p.alternate;(st===null||st.memoizedState===null)&&(nT=Ui())}break;case 22:var Ct=p.memoizedState!==null,mt=p.alternate,bn=mt!==null&&mt.memoizedState!==null;if(b=p,Oe){e:if(E=b,T=Ct,L=null,Oe)for(var ft=E;;){if(ft.tag===5){if(L===null){L=ft;var br=ft.stateNode;T?qt(br):En(ft.stateNode,ft.memoizedProps)}}else if(ft.tag===6){if(L===null){var Oo=ft.stateNode;T?Pt(Oo):re(Oo,ft.memoizedProps)}}else if((ft.tag!==22&&ft.tag!==23||ft.memoizedState===null||ft===E)&&ft.child!==null){ft.child.return=ft,ft=ft.child;continue}if(ft===E)break;for(;ft.sibling===null;){if(ft.return===null||ft.return===E)break e;L===ft&&(L=null),ft=ft.return}L===ft&&(L=null),ft.sibling.return=ft.return,ft=ft.sibling}}if(Ct&&!bn&&b.mode&1){qe=b;for(var ue=b.child;ue!==null;){for(b=qe=ue;qe!==null;){E=qe;var se=E.child;switch(E.tag){case 0:case 11:case 14:case 15:gf(4,E,E.return);break;case 1:Xx(E,E.return);var we=E.stateNode;if(typeof we.componentWillUnmount=="function"){var Qe=E.return;try{we.props=E.memoizedProps,we.state=E.memoizedState,we.componentWillUnmount()}catch(ut){gs(E,Qe,ut)}}break;case 5:Xx(E,E.return);break;case 22:if(E.memoizedState!==null){VB(b);continue}}se!==null?(se.return=E,qe=se):VB(b)}ue=ue.sibling}}}switch(ne&4102){case 2:BB(p),p.flags&=-3;break;case 6:BB(p),p.flags&=-3,XM(p.alternate,p);break;case 4096:p.flags&=-4097;break;case 4100:p.flags&=-4097,XM(p.alternate,p);break;case 4:XM(p.alternate,p)}}catch(ut){gs(p,p.return,ut)}if(b=p.sibling,b!==null){b.return=p.return,qe=b;break}qe=p.return}}}function ree(d,p,b){qe=d,FB(d)}function FB(d,p,b){for(var E=(d.mode&1)!==0;qe!==null;){var T=qe,L=T.child;if(T.tag===22&&E){var Z=T.memoizedState!==null||Kx;if(!Z){var ne=T.alternate,_e=ne!==null&&ne.memoizedState!==null||mf;ne=Kx;var Ue=mf;if(Kx=Z,(mf=_e)&&!Ue)for(qe=T;qe!==null;)Z=qe,_e=Z.child,Z.tag===22&&Z.memoizedState!==null?HB(T):_e!==null?(_e.return=Z,qe=_e):HB(T);for(;L!==null;)qe=L,FB(L),L=L.sibling;qe=T,Kx=ne,mf=Ue}zB(d)}else T.subtreeFlags&8772&&L!==null?(L.return=T,qe=L):zB(d)}}function zB(d){for(;qe!==null;){var p=qe;if(p.flags&8772){var b=p.alternate;try{if(p.flags&8772)switch(p.tag){case 0:case 11:case 15:mf||Sy(5,p);break;case 1:var E=p.stateNode;if(p.flags&4&&!mf)if(b===null)E.componentDidMount();else{var T=p.elementType===p.type?b.memoizedProps:ca(p.type,b.memoizedProps);E.componentDidUpdate(T,b.memoizedState,E.__reactInternalSnapshotBeforeUpdate)}var L=p.updateQueue;L!==null&&OU(p,L,E);break;case 3:var Z=p.updateQueue;if(Z!==null){if(b=null,p.child!==null)switch(p.child.tag){case 5:b=R(p.child.stateNode);break;case 1:b=p.child.stateNode}OU(p,Z,b)}break;case 5:var ne=p.stateNode;b===null&&p.flags&4&&At(ne,p.type,p.memoizedProps,p);break;case 6:break;case 4:break;case 12:break;case 13:if(Se&&p.memoizedState===null){var _e=p.alternate;if(_e!==null){var Ue=_e.memoizedState;if(Ue!==null){var st=Ue.dehydrated;st!==null&&pe(st)}}}break;case 19:case 17:case 21:case 22:case 23:break;default:throw Error(o(163))}mf||p.flags&512&&WM(p)}catch(Ct){gs(p,p.return,Ct)}}if(p===d){qe=null;break}if(b=p.sibling,b!==null){b.return=p.return,qe=b;break}qe=p.return}}function VB(d){for(;qe!==null;){var p=qe;if(p===d){qe=null;break}var b=p.sibling;if(b!==null){b.return=p.return,qe=b;break}qe=p.return}}function HB(d){for(;qe!==null;){var p=qe;try{switch(p.tag){case 0:case 11:case 15:var b=p.return;try{Sy(4,p)}catch(_e){gs(p,b,_e)}break;case 1:var E=p.stateNode;if(typeof E.componentDidMount=="function"){var T=p.return;try{E.componentDidMount()}catch(_e){gs(p,T,_e)}}var L=p.return;try{WM(p)}catch(_e){gs(p,L,_e)}break;case 5:var Z=p.return;try{WM(p)}catch(_e){gs(p,Z,_e)}}}catch(_e){gs(p,p.return,_e)}if(p===d){qe=null;break}var ne=p.sibling;if(ne!==null){ne.return=p.return,qe=ne;break}qe=p.return}}var Qx=0,Zx=1,Jx=2,eb=3,tb=4;if(typeof Symbol=="function"&&Symbol.for){var Ay=Symbol.for;Qx=Ay("selector.component"),Zx=Ay("selector.has_pseudo_class"),Jx=Ay("selector.role"),eb=Ay("selector.test_id"),tb=Ay("selector.text")}function YM(d){var p=me(d);if(p!=null){if(typeof p.memoizedProps["data-testname"]!="string")throw Error(o(364));return p}if(d=X(d),d===null)throw Error(o(362));return d.stateNode.current}function QM(d,p){switch(p.$$typeof){case Qx:if(d.type===p.value)return!0;break;case Zx:e:{p=p.value,d=[d,0];for(var b=0;b<d.length;){var E=d[b++],T=d[b++],L=p[T];if(E.tag!==5||!Ee(E)){for(;L!=null&&QM(E,L);)T++,L=p[T];if(T===p.length){p=!0;break e}else for(E=E.child;E!==null;)d.push(E,T),E=E.sibling}}p=!1}return p;case Jx:if(d.tag===5&&Ne(d.stateNode,p.value))return!0;break;case tb:if((d.tag===5||d.tag===6)&&(d=xe(d),d!==null&&0<=d.indexOf(p.value)))return!0;break;case eb:if(d.tag===5&&(d=d.memoizedProps["data-testname"],typeof d=="str
4036ing"&&d.toLowerCase()===p.value.toLowerCase()))return!0;break;default:throw Error(o(365))}return!1}function ZM(d){switch(d.$$typeof){case Qx:return"<"+(I(d.value)||"Unknown")+">";case Zx:return":has("+(ZM(d)||"")+")";case Jx:return'[role="'+d.value+'"]';case tb:return'"'+d.value+'"';case eb:return'[data-testname="'+d.value+'"]';default:throw Error(o(365))}}function $B(d,p){var b=[];d=[d,0];for(var E=0;E<d.length;){var T=d[E++],L=d[E++],Z=p[L];if(T.tag!==5||!Ee(T)){for(;Z!=null&&QM(T,Z);)L++,Z=p[L];if(L===p.length)b.push(T);else for(T=T.child;T!==null;)d.push(T,L),T=T.sibling}}return b}function JM(d,p){if(!Et)throw Error(o(363));d=YM(d),d=$B(d,p),p=[],d=Array.from(d);for(var b=0;b<d.length;){var E=d[b++];if(E.tag===5)Ee(E)||p.push(E.stateNode);else for(E=E.child;E!==null;)d.push(E),E=E.sibling}return p}var see=Math.ceil,nb=a.ReactCurrentDispatcher,eT=a.ReactCurrentOwner,ai=a.ReactCurrentBatchConfig,Vt=0,gi=null,yi=null,tr=0,qs=0,qp=Oi(0),Mi=0,My=null,Kp=0,ib=0,tT=0,Ty=null,ps=null,nT=0,iT=1/0;function Xp(){iT=Ui()+500}var rb=!1,rT=null,gu=null,sb=!1,yu=null,ob=0,Py=0,sT=null,ab=-1,lb=0;function Kr(){return Vt&6?Ui():ab!==-1?ab:ab=Ui()}function vu(d){return d.mode&1?Vt&2&&tr!==0?tr&-tr:VJ.transition!==null?(lb===0&&(d=bx,bx<<=1,!(bx&4194240)&&(bx=64),lb=d),lb):(d=en,d!==0?d:Ae()):1}function No(d,p,b){if(50<Py)throw Py=0,sT=null,Error(o(185));var E=cb(d,p);return E===null?null:(hy(E,p,b),(!(Vt&2)||E!==gi)&&(E===gi&&(!(Vt&2)&&(ib|=p),Mi===4&&wu(E,tr)),ms(E,b),p===1&&Vt===0&&!(d.mode&1)&&(Xp(),Ax&&Qa())),E)}function cb(d,p){d.lanes|=p;var b=d.alternate;for(b!==null&&(b.lanes|=p),b=d,d=d.return;d!==null;)d.childLanes|=p,b=d.alternate,b!==null&&(b.childLanes|=p),b=d,d=d.return;return b.tag===3?b.stateNode:null}function ms(d,p){var b=d.callbackNode;NJ(d,p);var E=Ex(d,d===gi?tr:0);if(E===0)b!==null&&CU(b),d.callbackNode=null,d.callbackPriority=0;else if(p=E&-E,d.callbackPriority!==p){if(b!=null&&CU(b),p===1)d.tag===0?zJ(jB.bind(null,d)):IU(jB.bind(null,d)),Ke?rt(function(){Vt===0&&Qa()}):dM(pM,Qa),b=null;else{switch(PU(E)){case 1:b=pM;break;case 4:b=UJ;break;case 16:b=mM;break;case 536870912:b=BJ;break;default:b=mM}b=e4(b,GB.bind(null,d))}d.callbackPriority=p,d.callbackNode=b}}function GB(d,p){if(ab=-1,lb=0,Vt&6)throw Error(o(327));var b=d.callbackNode;if(wf()&&d.callbackNode!==b)return null;var E=Ex(d,d===gi?tr:0);if(E===0)return null;if(E&30||E&d.expiredLanes||p)p=ub(d,E);else{p=E;var T=Vt;Vt|=2;var L=KB();(gi!==d||tr!==p)&&(Xp(),yf(d,p));do try{lee();break}catch(ne){qB(d,ne)}while(!0);vM(),nb.current=L,Vt=T,yi!==null?p=0:(gi=null,tr=0,p=Mi)}if(p!==0){if(p===2&&(T=uM(d),T!==0&&(E=T,p=oT(d,T))),p===1)throw b=My,yf(d,0),wu(d,E),ms(d,Ui()),b;if(p===6)wu(d,E);else{if(T=d.current.alternate,!(E&30)&&!oee(T)&&(p=ub(d,E),p===2&&(L=uM(d),L!==0&&(E=L,p=oT(d,L))),p===1))throw b=My,yf(d,0),wu(d,E),ms(d,Ui()),b;switch(d.finishedWork=T,d.finishedLanes=E,p){case 0:case 1:throw Error(o(345));case 2:vf(d,ps);break;case 3:if(wu(d,E),(E&130023424)===E&&(p=nT+500-Ui(),10<p)){if(Ex(d,0)!==0)break;if(T=d.suspendedLanes,(T&E)!==E){Kr(),d.pingedLanes|=d.suspendedLanes&T;break}d.timeoutHandle=ve(vf.bind(null,d,ps),p);break}vf(d,ps);break;case 4:if(wu(d,E),(E&4194240)===E)break;for(p=d.eventTimes,T=-1;0<E;){var Z=31-$s(E);L=1<<Z,Z=p[Z],Z>T&&(T=Z),E&=~L}if(E=T,E=Ui()-E,E=(120>E?120:480>E?480:1080>E?1080:1920>E?1920:3e3>E?3e3:4320>E?4320:1960*see(E/1960))-E,10<E){d.timeoutHandle=ve(vf.bind(null,d,ps),E);break}vf(d,ps);break;case 5:vf(d,ps);break;default:throw Error(o(329))}}}return ms(d,Ui()),d.callbackNode===b?GB.bind(null,d):null}function oT(d,p){var b=Ty;return d.current.memoizedState.isDehydrated&&(yf(d,p).flags|=256),d=ub(d,p),d!==2&&(p=ps,ps=b,p!==null&&aT(p)),d}function aT(d){ps===null?ps=d:ps.push.apply(ps,d)}function oee(d){for(var p=d;;){if(p.flags&16384){var b=p.updateQueue;if(b!==null&&(b=b.stores,b!==null))for(var E=0;E<b.length;E++){var T=b[E],L=T.getSnapshot;T=T.value;try{if(!Ya(L(),T))return!1}catch{return!1}}}if(b=p.child,p.subtreeFlags&16384&&b!==null)b.return=p,p=b;else{if(p===d)break;for(;p.sibling===null;){if(p.return===null||p.return===d)return!0;p=p.return}p.sibling.return=p.return,p=p.sibling}}return!0}function wu(d,p){for(p&=~tT,p&=~ib,d.suspendedLanes|=p,d.pingedLanes&=~p,d=d.expirationTimes;0<p;){var b=31-$s(p),E=1<<b;d[b]=-1,p&=~E}}function jB(d){if(Vt&6)throw Error(o(327));wf();var p=Ex(d,0);if(!(p&1))return ms(d,Ui()),null;var b=ub(d,p);if(d.tag!==0&&b===2){var E=uM(d);E!==0&&(p=E,b=oT(d,E))}if(b===1)throw b=My,yf(d,0),wu(d,p),ms(d,Ui()),b;if(b===6)throw Error(o(345));return d.finishedWork=d.current.alternate,d.finishedLanes=p,vf(d,ps),ms(d,Ui()),null}function WB(d){yu!==null&&yu.tag===0&&!(Vt&6)&&wf();var p=Vt;Vt|=1;var b=ai.transition,E=en;try{if(ai.transition=null,en=1,d)return d()}finally{en=E,ai.transition=b,Vt=p,!(Vt&6)&&Qa()}}function lT(){qs=qp.current,bt(qp)}function yf(d,p){d.finishedWork=null,d.finishedLanes=0;var b=d.timeoutHandle;if(b!==be&&(d.timeoutHandle=be,Te(b)),yi!==null)for(b=yi.return;b!==null;){var E=b;switch(AM(E),E.tag){case 1:E=E.type.childContextTypes,E!=null&&oi();break;case 3:jp(),bt(Qn),bt(Ot),NM();break;case 5:IM(E);break;case 4:jp();break;case 13:bt($n);break;case 19:bt($n);break;
vendor: 10,288 bytes, line 4036
4036case 10:wM(E.type._context);break;case 22:case 23:lT()}b=b.return}if(gi=d,yi=d=xu(d.current,null),tr=qs=p,Mi=0,My=null,tT=ib=Kp=0,ps=Ty=null,Za!==null){for(p=0;p<Za.length;p++)if(b=Za[p],E=b.interleaved,E!==null){b.interleaved=null;var T=E.next,L=b.pending;if(L!==null){var Z=L.next;L.next=T,E.next=Z}b.pending=E}Za=null}return d}function qB(d,p){do{var b=yi;try{if(vM(),Ux.current=Hx,Bx){for(var E=Zn.memoizedState;E!==null;){var T=E.queue;T!==null&&(T.pending=null),E=E.next}Bx=!1}if(Wp=0,Bi=vr=Zn=null,yy=!1,vy=0,eT.current=null,b===null||b.return===null){Mi=1,My=p,yi=null;break}e:{var L=d,Z=b.return,ne=b,_e=p;if(p=tr,ne.flags|=32768,_e!==null&&typeof _e=="object"&&typeof _e.then=="function"){var Ue=_e,st=ne,Ct=st.tag;if(!(st.mode&1)&&(Ct===0||Ct===11||Ct===15)){var mt=st.alternate;mt?(st.updateQueue=mt.updateQueue,st.memoizedState=mt.memoizedState,st.lanes=mt.lanes):(st.updateQueue=null,st.memoizedState=null)}var bn=pB(Z);if(bn!==null){bn.flags&=-257,mB(bn,Z,ne,L,p),bn.mode&1&&dB(L,Ue,p),p=bn,_e=Ue;var ft=p.updateQueue;if(ft===null){var br=new Set;br.add(_e),p.updateQueue=br}else ft.add(_e);break e}else{if(!(p&1)){dB(L,Ue,p),cT();break e}_e=Error(o(426))}}else if(Bn&&ne.mode&1){var Oo=pB(Z);if(Oo!==null){!(Oo.flags&65536)&&(Oo.flags|=256),mB(Oo,Z,ne,L,p),PM(_e);break e}}L=_e,Mi!==4&&(Mi=2),Ty===null?Ty=[L]:Ty.push(L),_e=FM(_e,ne),ne=Z;do{switch(ne.tag){case 3:ne.flags|=65536,p&=-p,ne.lanes|=p;var ue=hB(ne,_e,p);DU(ne,ue);break e;case 1:L=_e;var se=ne.type,we=ne.stateNode;if(!(ne.flags&128)&&(typeof se.getDerivedStateFromError=="function"||we!==null&&typeof we.componentDidCatch=="function"&&(gu===null||!gu.has(we)))){ne.flags|=65536,p&=-p,ne.lanes|=p;var Qe=fB(ne,L,p);DU(ne,Qe);break e}}ne=ne.return}while(ne!==null)}YB(b)}catch(ut){p=ut,yi===b&&b!==null&&(yi=b=b.return);continue}break}while(!0)}function KB(){var d=nb.current;return nb.current=Hx,d===null?Hx:d}function cT(){(Mi===0||Mi===3||Mi===2)&&(Mi=4),gi===null||!(Kp&268435455)&&!(ib&268435455)||wu(gi,tr)}function ub(d,p){var b=Vt;Vt|=2;var E=KB();gi===d&&tr===p||yf(d,p);do try{aee();break}catch(T){qB(d,T)}while(!0);if(vM(),Vt=b,nb.current=E,yi!==null)throw Error(o(261));return gi=null,tr=0,Mi}function aee(){for(;yi!==null;)XB(yi)}function lee(){for(;yi!==null&&!OJ();)XB(yi)}function XB(d){var p=JB(d.alternate,d,qs);d.memoizedProps=d.pendingProps,p===null?YB(d):yi=p,eT.current=null}function YB(d){var p=d;do{var b=p.alternate;if(d=p.return,p.flags&32768){if(b=eee(b,p),b!==null){b.flags&=32767,yi=b;return}if(d!==null)d.flags|=32768,d.subtreeFlags=0,d.deletions=null;else{Mi=6,yi=null;return}}else if(b=QJ(b,p,qs),b!==null){yi=b;return}if(p=p.sibling,p!==null){yi=p;return}yi=p=d}while(p!==null);Mi===0&&(Mi=5)}function vf(d,p){var b=en,E=ai.transition;try{ai.transition=null,en=1,cee(d,p,b)}finally{ai.transition=E,en=b}return null}function cee(d,p,b){do wf();while(yu!==null);if(Vt&6)throw Error(o(327));var E=d.finishedWork,T=d.finishedLanes;if(E===null)return null;if(d.finishedWork=null,d.finishedLanes=0,E===d.current)throw Error(o(177));d.callbackNode=null,d.callbackPriority=0;var L=E.lanes|E.childLanes;if(DJ(d,L),d===gi&&(yi=gi=null,tr=0),!(E.subtreeFlags&2064)&&!(E.flags&2064)||sb||(sb=!0,e4(mM,function(){return wf(),null})),L=(E.flags&15990)!==0,E.subtreeFlags&15990||L){L=ai.transition,ai.transition=null;var Z=en;en=1;var ne=Vt;Vt|=4,eT.current=null,nee(d,E),iee(d,E),B(d.containerInfo),d.current=E,ree(E),LJ(),Vt=ne,en=Z,ai.transition=L}else d.current=E;if(sb&&(sb=!1,yu=d,ob=T),L=d.pendingLanes,L===0&&(gu=null),kJ(E.stateNode),ms(d,Ui()),p!==null)for(b=d.onRecoverableError,E=0;E<p.length;E++)b(p[E]);if(rb)throw rb=!1,d=rT,rT=null,d;return ob&1&&d.tag!==0&&wf(),L=d.pendingLanes,L&1?d===sT?Py++:(Py=0,sT=d):Py=0,Qa(),null}function wf(){if(yu!==null){var d=PU(ob),p=ai.transition,b=en;try{if(ai.transition=null,en=16>d?16:d,yu===null)var E=!1;else{if(d=yu,yu=null,ob=0,Vt&6)throw Error(o(331));var T=Vt;for(Vt|=4,qe=d.current;qe!==null;){var L=qe,Z=L.child;if(qe.flags&16){var ne=L.deletions;if(ne!==null){for(var _e=0;_e<ne.length;_e++){var Ue=ne[_e];for(qe=Ue;qe!==null;){var st=qe;switch(st.tag){case 0:case 11:case 15:gf(8,st,L)}var Ct=st.child;if(Ct!==null)Ct.return=st,qe=Ct;else for(;qe!==null;){st=qe;var mt=st.sibling,bn=st.return;if(OB(st),st===Ue){qe=null;break}if(mt!==null){mt.return=bn,qe=mt;break}qe=bn}}}var ft=L.alternate;if(ft!==null){var br=ft.child;if(br!==null){ft.child=null;do{var Oo=br.sibling;br.sibling=null,br=Oo}while(br!==null)}}qe=L}}if(L.subtreeFlags&2064&&Z!==null)Z.return=L,qe=Z;else e:for(;qe!==null;){if(L=qe,L.flags&2048)switch(L.tag){case 0:case 11:case 15:gf(9,L,L.return)}var ue=L.sibling;if(ue!==null){ue.return=L.return,qe=ue;break e}qe=L.return}}var se=d.current;for(qe=se;qe!==null;){Z=qe;var we=Z.child;if(Z.subtreeFlags&2064&&we!==null)we.return=Z,qe=we;else e:for(Z=se;qe!==null;){if(ne=qe,ne.flags&2048)try{switch(ne.tag){case 0:case 11:case 15:Sy(9,ne)}}catch(ut){gs(ne,ne.return,ut)}if(ne===Z){qe=null;break e}var Qe=ne.sibling;if(Qe!==null){Qe.return=ne.return,qe=Qe;break e}qe=ne.return}}if(Vt=T,Qa(),Xa&&typeof Xa.onPostCommitFiberRoot=="function")try{Xa.onPostCommitFiberRoot(Sx,d)}catch{}E=!0}return E}finally{en=b,ai.transition=p}}return!1}function QB(d,p,b){p=FM(b,p),p=hB(d,p,1),mu(d,p),p=Kr(),d=cb(d,1),d!==null&&(hy(d,1,p),ms(d,p))}function gs(d,p,b){if(d.tag===3)QB(d,d,b);else for(;p!==null;){if(p.tag===3){QB(p,d,b);break}else if(p.tag===1){var E=p.stateNode;if(typeof p.type.getDerivedStateFromError=="function"||typeof E.componentDidCatch=="function"&&(gu===null||!gu.has(E))){d=FM(b,d),d=fB(p,d,1),mu(p,d),d=Kr(),p=cb(p,1),p!==null&&(hy(p,1,d),ms(p,d));break}}p=p.return}}function uee(d,p,b){var E=d.pingCache;E!==null&&E.delete(p),p=Kr(),d.pingedLanes|=d.suspendedLanes&b,gi===d&&(tr&b)===b&&(Mi===4||Mi===3&&(tr&130023424)===tr&&500>Ui()-nT?yf(d,0):tT|=b),ms(d,p)}function ZB(d,p){p===0&&(d.mode&1?(p=_x,_x<<=1,!(_x&130023424)&&(_x=4194304)):p=1);var b=Kr();d=cb(d,p),d!==null&&(hy(d,p,b),ms(d,b))}function hee(d){var p=d.memoizedState,b=0;p!==null&&(b=p.retryLane),ZB(d,b)}function fee(d,p){var b=0;switch(d.tag){case 13:var E=d.stateNode,T=d.memoizedState;T!==null&&(b=T.retryLane);break;case 19:E=d.stateNode;break;default:throw Error(o(314))}E!==null&&E.delete(p),ZB(d,b)}var JB;JB=function(d,p,b){if(d!==null)if(d.memoizedProps!==p.pendingProps||Qn.current)Ws=!0;else{if(!(d.lanes&b)&&!(p.flags&128))return Ws=!1,JJ(d,p,b);Ws=!!(d.flags&131072)}else Ws=!1,Bn&&p.flags&1048576&&FU(p,Dx,p.index);switch(p.lanes=0,p.tag){case 2:var E=p.type;d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),d=p.pendingProps;var T=Mo(p,Ot.current);Fp(p,b),T=OM(null,p,E,d,T,b);var L=LM();return p.flags|=1,typeof T=="object"&&T!==null&&typeof T.render=="function"&&T.$$typeof===void 0?(p.tag=1,p.memoizedState=null,p.updateQueue=null,Li(E)?(L=!0,er(p)):L=!1,p.memoizedState=T.state!==null&&T.state!==void 0?T.state:null,bM(p),T.updater=Rx,p.stateNode=T,T._reactInternals=p,EM(p,E,d,b),p=HM(null,p,E,!0,L,b)):(p.tag=0,Bn&&L&&SM(p),qr(null,p,T,b),p=p.child),p;case 16:E=p.elementType;e:{switch(d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),d=p.pendingProps,T=E._init,E=T(E._payload),p.type=E,T=p.tag=pee(E),d=ca(E,d),T){case 0:p=VM(null,p,E,d,b);break e;case 1:p=EB(null,p,E,d,b);break e;case 11:p=vB(null,p,E,d,b);break e;case 14:p=wB(null,p,E,ca(E.type,d),b);break e}throw Error(o(306,E,""))}return p;case 0:return E=p.type,T=p.pendingProps,T=p.elementType===E?T:ca(E,T),VM(d,p,E,T,b);case 1:return E=p.type,T=p.pendingProps,T=p.elementType===E?T:ca(E,T),EB(d,p,E,T,b);case 3:e:{if(SB(p),d===null)throw Error(o(387));E=p.pendingProps,L=p.memoizedState,T=L.element,NU(d,p),Ix(p,E,null,b);var Z=p.memoizedState;if(E=Z.element,Se&&L.isDehydrated)if(L={element:E,isDehydrated:!1,cache:Z.cache,transitions:Z.transitions},p.updateQueue.baseState=L,p.memoizedState=L,p.flags&256){T=Error(o(423)),p=AB(d,p,E,b,T);break e}else if(E!==T){T=Error(o(424)),p=AB(d,p,E,b,T);break e}else for(Se&&(js=vx(p.stateNode.containerInfo),Gs=p,Bn=!0,ua=null,fy=!1),b=jU(p,null,E,b),p.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling;else{if(Hp(),E===T){p=Xl(d,p,b);break e}qr(d,p,E,b)}p=p.child}return p;case 5:return WU(p),d===null&&TM(p),E=p.type,T=p.pendingProps,L=d!==null?d.memoizedProps:null,Z=T.children,te(E,T)?Z=null:L!==null&&te(E,L)&&(p.flags|=32),_B(d,p),qr(d,p,Z,b),p.child;case 6:return d===null&&TM(p),null;case 13:return MB(d,p,b);case 4:return CM(p,p.stateNode.containerInfo),E=p.pendingProps,d===null?p.child=$p(p,null,E,b):qr(d,p,E,b),p.child;case 11:return E=p.type,T=p.pendingProps,T=p.elementType===E?T:ca(E,T),vB(d,p,E,T,b);case 7:return qr(d,p,p.pendingProps,b),p.child;case 8:return qr(d,p,p.pendingProps.children,b),p.child;case 12:return qr(d,p,p.pendingProps.children,b),p.child;case 10:e:{if(E=p.type._context,T=p.pendingProps,L=p.memoizedProps,Z=T.value,RU(p,E,Z),L!==null)if(Ya(L.value,Z)){if(L.children===T.children&&!Qn.current){p=Xl(d,p,b);break e}}else for(L=p.child,L!==null&&(L.return=p);L!==null;){var ne=L.dependencies;if(ne!==null){Z=L.child;for(var _e=ne.firstContext;_e!==null;){if(_e.context===E){if(L.tag===1){_e=jl(-1,b&-b),_e.tag=2;var Ue=L.updateQueue;if(Ue!==null){Ue=Ue.shared;var st=Ue.pending;st===null?_e.next=_e:(_e.next=st.next,st.next=_e),Ue.pending=_e}}L.lanes|=b,_e=L.alternate,_e!==null&&(_e.lanes|=b),xM(L.return,b,p),ne.lanes|=b;break}_e=_e.next}}else if(L.tag===10)Z=L.type===p.type?null:L.child;else if(L.tag===18){if(Z=L.return,Z===null)throw Error(o(341));Z.lanes|=b,ne=Z.alternate,ne!==null&&(ne.lanes|=b),xM(Z,b,p),Z=L.sibling}else Z=L.child;if(Z!==null)Z.return=L;else for(Z=L;Z!==null;){if(Z===p){Z=null;break}if(L=Z.sibling,L!==null){L.return=Z.return,Z=L;break}Z=Z.return}L=Z}qr(d,p,T.children,b),p=p.child}return p;case 9:return T=p.type,E=p.pendingProps.children,Fp(p,b),T=To(T),E=E(T),p.flags|=1,qr(d,p,E,b),p.child;case 14:return E=p.type,T=ca(E,p.pendingProps),T=ca(E.type,T),wB(d,p,E,T,b);case 15:return xB(d,p,p.type,p.pendingProps,b);case 17:return E=p.type,T=p.pendingProps,T=p.elementType===E?T:ca(E,T),d!==null&&(d.alternate=null,p.alternate=null,p.flags|=2),p.tag=1,Li(E)?(d=!0,er(p)):d=!1,Fp(p,b),BU(p,E,T),EM(p,E,T,b),HM(null,p,E,!0,d,b);case 19:return IB(d,p,b);case 22:return bB(d,p,b)}throw Error(o(156,p.tag))};function e4(d,p){return dM(d,p)}
vendor: 1,810 bytes, line 4036
4036function dee(d,p,b,E){this.tag=d,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=p,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=E,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Do(d,p,b,E){return new dee(d,p,b,E)}function uT(d){return d=d.prototype,!(!d||!d.isReactComponent)}function pee(d){if(typeof d=="function")return uT(d)?1:0;if(d!=null){if(d=d.$$typeof,d===v)return 11;if(d===_)return 14}return 2}function xu(d,p){var b=d.alternate;return b===null?(b=Do(d.tag,p,d.key,d.mode),b.elementType=d.elementType,b.type=d.type,b.stateNode=d.stateNode,b.alternate=d,d.alternate=b):(b.pendingProps=p,b.type=d.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=d.flags&14680064,b.childLanes=d.childLanes,b.lanes=d.lanes,b.child=d.child,b.memoizedProps=d.memoizedProps,b.memoizedState=d.memoizedState,b.updateQueue=d.updateQueue,p=d.dependencies,b.dependencies=p===null?null:{lanes:p.lanes,firstContext:p.firstContext},b.sibling=d.sibling,b.index=d.index,b.ref=d.ref,b}function hb(d,p,b,E,T,L){var Z=2;if(E=d,typeof d=="function")uT(d)&&(Z=1);else if(typeof d=="string")Z=5;else e:switch(d){case u:return xf(b.children,T,L,p);case h:Z=8,T|=8;break;case f:return d=Do(12,b,p,T|2),d.elementType=f,d.lanes=L,d;case w:return d=Do(13,b,p,T),d.elementType=w,d.lanes=L,d;case y:return d=Do(19,b,p,T),d.elementType=y,d.lanes=L,d;case S:return fb(b,T,L,p);default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case m:Z=10;break e;case g:Z=9;break e;case v:Z=11;break e;case _:Z=14;break e;case x:Z=16,E=null;break e}throw Error(o(130,d==null?d:typeof d,""))}return p=Do(Z,b,p,T),p.elementType=d,p.type=E,p.lanes=L,p}
vendor: 45,347 bytes, lines 4036-4048
4036function xf(d,p,b,E){return d=Do(7,d,E,p),d.lanes=b,d}function fb(d,p,b,E){return d=Do(22,d,E,p),d.elementType=S,d.lanes=b,d.stateNode={},d}function hT(d,p,b){return d=Do(6,d,null,p),d.lanes=b,d}function fT(d,p,b){return p=Do(4,d.children!==null?d.children:[],d.key,p),p.lanes=b,p.stateNode={containerInfo:d.containerInfo,pendingChildren:null,implementation:d.implementation},p}function mee(d,p,b,E,T){this.tag=p,this.containerInfo=d,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=be,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=hM(0),this.expirationTimes=hM(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hM(0),this.identifierPrefix=E,this.onRecoverableError=T,Se&&(this.mutableSourceEagerHydrationData=null)}function t4(d,p,b,E,T,L,Z,ne,_e){return d=new mee(d,p,b,ne,_e),p===1?(p=1,L===!0&&(p|=8)):p=0,L=Do(3,null,null,p),d.current=L,L.stateNode=d,L.memoizedState={element:E,isDehydrated:b,cache:null,transitions:null},bM(L),d}function n4(d){if(!d)return Ao;d=d._reactInternals;e:{if(k(d)!==d||d.tag!==1)throw Error(o(170));var p=d;do{switch(p.tag){case 3:p=p.stateNode.context;break e;case 1:if(Li(p.type)){p=p.stateNode.__reactInternalMemoizedMergedChildContext;break e}}p=p.return}while(p!==null);throw Error(o(171))}if(d.tag===1){var b=d.type;if(Li(b))return Up(d,b,p)}return p}function i4(d){var p=d._reactInternals;if(p===void 0)throw typeof d.render=="function"?Error(o(188)):(d=Object.keys(d).join(","),Error(o(268,d)));return d=G(p),d===null?null:d.stateNode}function r4(d,p){if(d=d.memoizedState,d!==null&&d.dehydrated!==null){var b=d.retryLane;d.retryLane=b!==0&&b<p?b:p}}function dT(d,p){r4(d,p),(d=d.alternate)&&r4(d,p)}function gee(d){return d=G(d),d===null?null:d.stateNode}function yee(){return null}return t.attemptContinuousHydration=function(d){if(d.tag===13){var p=Kr();No(d,134217728,p),dT(d,134217728)}},t.attemptHydrationAtCurrentPriority=function(d){if(d.tag===13){var p=Kr(),b=vu(d);No(d,b,p),dT(d,b)}},t.attemptSynchronousHydration=function(d){switch(d.tag){case 3:var p=d.stateNode;if(p.current.memoizedState.isDehydrated){var b=uy(p.pendingLanes);b!==0&&(fM(p,b|1),ms(p,Ui()),!(Vt&6)&&(Xp(),Qa()))}break;case 13:var E=Kr();WB(function(){return No(d,1,E)}),dT(d,1)}},t.batchedUpdates=function(d,p){var b=Vt;Vt|=1;try{return d(p)}finally{Vt=b,Vt===0&&(Xp(),Ax&&Qa())}},t.createComponentSelector=function(d){return{$$typeof:Qx,value:d}},t.createContainer=function(d,p,b,E,T,L,Z){return t4(d,p,!1,null,b,E,T,L,Z)},t.createHasPseudoClassSelector=function(d){return{$$typeof:Zx,value:d}},t.createHydrationContainer=function(d,p,b,E,T,L,Z,ne,_e){return d=t4(b,E,!0,d,T,L,Z,ne,_e),d.context=n4(null),b=d.current,E=Kr(),T=vu(b),L=jl(E,T),L.callback=p??null,mu(b,L),d.current.lanes=T,hy(d,T,E),ms(d,E),d},t.createPortal=function(d,p,b){var E=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:E==null?null:""+E,children:d,containerInfo:p,implementation:b}},t.createRoleSelector=function(d){return{$$typeof:Jx,value:d}},t.createTestNameSelector=function(d){return{$$typeof:eb,value:d}},t.createTextSelector=function(d){return{$$typeof:tb,value:d}},t.deferredUpdates=function(d){var p=en,b=ai.transition;try{return ai.transition=null,en=16,d()}finally{en=p,ai.transition=b}},t.discreteUpdates=function(d,p,b,E,T){var L=en,Z=ai.transition;try{return ai.transition=null,en=1,d(p,b,E,T)}finally{en=L,ai.transition=Z,Vt===0&&Xp()}},t.findAllNodes=JM,t.findBoundingRects=function(d,p){if(!Et)throw Error(o(363));p=JM(d,p),d=[];for(var b=0;b<p.length;b++)d.push($(p[b]));for(p=d.length-1;0<p;p--){b=d[p];for(var E=b.x,T=E+b.width,L=b.y,Z=L+b.height,ne=p-1;0<=ne;ne--)if(p!==ne){var _e=d[ne],Ue=_e.x,st=Ue+_e.width,Ct=_e.y,mt=Ct+_e.height;if(E>=Ue&&L>=Ct&&T<=st&&Z<=mt){d.splice(p,1);break}else if(E!==Ue||b.width!==_e.width||mt<L||Ct>Z){if(!(L!==Ct||b.height!==_e.height||st<E||Ue>T)){Ue>E&&(_e.width+=Ue-E,_e.x=E),st<T&&(_e.width=T-Ue),d.splice(p,1);break}}else{Ct>L&&(_e.height+=Ct-L,_e.y=L),mt<Z&&(_e.height=Z-Ct),d.splice(p,1);break}}}return d},t.findHostInstance=i4,t.findHostInstanceWithNoPortals=function(d){return d=U(d),d=d!==null?z(d):null,d===null?null:d.stateNode},t.findHostInstanceWithWarning=function(d){return i4(d)},t.flushControlled=function(d){var p=Vt;Vt|=1;var b=ai.transition,E=en;try{ai.transition=null,en=1,d()}finally{en=E,ai.transition=b,Vt=p,Vt===0&&(Xp(),Qa())}},t.flushPassiveEffects=wf,t.flushSync=WB,t.focusWithin=function(d,p){if(!Et)throw Error(o(363));for(d=YM(d),p=$B(d,p),p=Array.from(p),d=0;d<p.length;){var b=p[d++];if(!Ee(b)){if(b.tag===5&&Pe(b.stateNode))return!0;for(b=b.child;b!==null;)p.push(b),b=b.sibling}}return!1},t.getCurrentUpdatePriority=function(){return en},t.getFindAllNodesFailureDescription=function(d,p){if(!Et)throw Error(o(363));var b=0,E=[];d=[YM(d),0];for(var T=0;T<d.length;){var L=d[T++],Z=d[T++],ne=p[Z];if((L.tag!==5||!Ee(L))&&(QM(L,ne)&&(E.push(ZM(ne)),Z++,Z>b&&(b=Z)),Z<p.length))for(L=L.child;L!==null;)d.push(L,Z),L=L.sibling}if(b<p.length){for(d=[];b<p.length;b++)d.push(ZM(p[b]));return`findAllNodes was able to match part of the selector:
4037  `+(E.join(" > ")+`
4038
4039No matching component was found for:
4040  `)+d.join(" > ")}return null},t.getPublicRootInstance=function(d){if(d=d.current,!d.child)return null;switch(d.child.tag){case 5:return R(d.child.stateNode);default:return d.child.stateNode}},t.injectIntoDevTools=function(d){if(d={bundleType:d.bundleType,version:d.version,rendererPackageName:d.rendererPackageName,rendererConfig:d.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:gee,findFiberByHostInstance:d.findFiberByHostInstance||yee,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")d=!1;else{var p=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(p.isDisabled||!p.supportsFiber)d=!0;else{try{Sx=p.inject(d),Xa=p}catch{}d=!!p.checkDCE}}return d},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(d,p,b,E){if(!Et)throw Error(o(363));d=JM(d,p);var T=_t(d,b,E).disconnect;return{disconnect:function(){T()}}},t.registerMutableSourceForHydration=function(d,p){var b=p._getVersion;b=b(p._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[p,b]:d.mutableSourceEagerHydrationData.push(p,b)},t.runWithPriority=function(d,p){var b=en;try{return en=d,p()}finally{en=b}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(d,p,b,E){var T=p.current,L=Kr(),Z=vu(T);return b=n4(b),p.context===null?p.context=b:p.pendingContext=b,p=jl(L,Z),p.payload={element:d},E=E===void 0?null:E,E!==null&&(p.callback=E),mu(T,p),d=No(T,Z,L),d!==null&&Cx(d,T,Z),Z},t};lJ.exports=n4e;var i4e=lJ.exports;const r4e=AA(i4e);var cJ={exports:{}},uJ={};/**
4041 * @license React
4042 * scheduler.production.min.js
4043 *
4044 * Copyright (c) Facebook, Inc. and its affiliates.
4045 *
4046 * This source code is licensed under the MIT license found in the
4047 * LICENSE file in the root directory of this source tree.
4048 */(function(n){function e(N,O){var B=N.length;N.push(O);e:for(;0<B;){var W=B-1>>>1,Q=N[W];if(0<r(Q,O))N[W]=O,N[B]=Q,B=W;else break e}}function t(N){return N.length===0?null:N[0]}function i(N){if(N.length===0)return null;var O=N[0],B=N.pop();if(B!==O){N[0]=B;e:for(var W=0,Q=N.length,oe=Q>>>1;W<oe;){var Y=2*(W+1)-1,te=N[Y],le=Y+1,ve=N[le];if(0>r(te,B))le<Q&&0>r(ve,te)?(N[W]=ve,N[le]=B,W=le):(N[W]=te,N[Y]=B,W=Y);else if(le<Q&&0>r(ve,B))N[W]=ve,N[le]=B,W=le;else break e}}return O}function r(N,O){var B=N.sortIndex-O.sortIndex;return B!==0?B:N.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,h=null,f=3,m=!1,g=!1,v=!1,w=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(N){for(var O=t(c);O!==null;){if(O.callback===null)i(c);else if(O.startTime<=N)i(c),O.sortIndex=O.expirationTime,e(l,O);else break;O=t(c)}}function S(N){if(v=!1,x(N),!g)if(t(l)!==null)g=!0,R(M);else{var O=t(c);O!==null&&F(S,O.startTime-N)}}function M(N,O){g=!1,v&&(v=!1,y(D),D=-1),m=!0;var B=f;try{for(x(O),h=t(l);h!==null&&(!(h.expirationTime>O)||N&&!U());){var W=h.callback;if(typeof W=="function"){h.callback=null,f=h.priorityLevel;var Q=W(h.expirationTime<=O);O=n.unstable_now(),typeof Q=="function"?h.callback=Q:h===t(l)&&i(l),x(O)}else i(l);h=t(l)}if(h!==null)var oe=!0;else{var Y=t(c);Y!==null&&F(S,Y.startTime-O),oe=!1}return oe}finally{h=null,f=B,m=!1}}var A=!1,I=null,D=-1,k=5,C=-1;function U(){return!(n.unstable_now()-C<k)}function G(){if(I!==null){var N=n.unstable_now();C=N;var O=!0;try{O=I(!0,N)}finally{O?H():(A=!1,I=null)}}else A=!1}var H;if(typeof _=="function")H=function(){_(G)};else if(typeof MessageChannel<"u"){var z=new MessageChannel,P=z.port2;z.port1.onmessage=G,H=function(){P.postMessage(null)}}else H=function(){w(G,0)};function R(N){I=N,A||(A=!0,H())}function F(N,O){D=w(function(){N(n.unstable_now())},O)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(N){N.callback=null},n.unstable_continueExecution=function(){g||m||(g=!0,R(M))},n.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<N?Math.floor(1e3/N):5},n.unstable_getCurrentPriorityLevel=function(){return f},n.unstable_getFirstCallbackNode=function(){return t(l)},n.unstable_next=function(N){switch(f){case 1:case 2:case 3:var O=3;break;default:O=f}var B=f;f=O;try{return N()}finally{f=B}},n.unstable_pauseExecution=function(){},n.unstable_requestPaint=function(){},n.unstable_runWithPriority=function(N,O){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var B=f;f=N;try{return O()}finally{f=B}},n.unstable_scheduleCallback=function(N,O,B){var W=n.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?W+B:W):B=W,N){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=B+Q,N={id:u++,callback:O,priorityLevel:N,startTime:B,expirationTime:Q,sortIndex:-1},B>W?(N.sortIndex=B,e(c,N),t(l)===null&&N===t(c)&&(v?(y(D),D=-1):v=!0,F(S,B-W))):(N.sortIndex=Q,e(l,N),g||m||(g=!0,R(M))),N},n.unstable_shouldYield=U,n.unstable_wrapCallback=function(N){var O=f;return function(){var B=f;f=O;try{return N.apply(this,arguments)}finally{f=B}}}})(uJ);cJ.exports=uJ;var XH=cJ.exports;const _U={},s4e=n=>void Object.assign(_U,n);function o4e(n,e){function t(u,{args:h=[],attach:f,...m},g){let v=`${u[0].toUpperCase()}${u.slice(1)}`,w;if(u==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const y=m.object;w=Lm(y,{type:u,root:g,attach:f,primitive:!0})}else{const y=_U[v];if(!y)throw new Error(`R3F: ${v} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");w=Lm(new y(...h),{type:u,root:g,attach:f,memoizedProps:{args:h}})}return w.__r3f.attach===void 0&&(w.isBufferGeometry?w.__r3f.attach="geometry":w.isMaterial&&(w.__r3f.attach="material")),v!=="inject"&&l3(w,m),w}function i(u,h){let f=!1;if(h){var m,g;(m=h.__r3f)!=null&&m.attach?a3(u,h,h.__r3f.attach):h.isObject3D&&u.isObject3D&&(u.add(h),f=!0),f||(g=u.__r3f)==null||g.objects.push(h),h.__r3f||Lm(h,{}),h.__r3f.parent=u,KN(h),Um(h)}}function r(u,h,f){let m=!1;if(h){var g,v;if((g=h.__r3f)!=null&&g.attach)a3(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){h.parent=u,h.dispatchEvent({type:"added"}),u.dispatchEvent({type:"childadded",child:h});const w=u.children.filter(_=>_!==h),y=w.indexOf(f);u.children=[...w.slice(0,y),h,...w.slice(y)],m=!0}m||(v=u.__r3f)==null||v.objects.push(h),h.__r3f||Lm(h,{}),h.__r3f.parent=u,KN(h),Um(h)}}function s(u,h,f=!1){u&&[...u].forEach(m=>o(h,m,f))}function o(u,h,f){if(h){var m,g,v;if(h.__r3f&&(h.__r3f.parent=null),(m=u.__r3f)!=null&&m.objects&&(u.__r3f.objects=u.__r3f.objects.filter(S=>S!==h)),(g=h.__r3f)!=null&&g.attach)e9(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){var w;u.remove(h),(w=h.__r3f)!=null&&w.root&&m4e(ZE(h),h)}const _=(v=h.__r3f)==null?void 0:v.primitive,x=!_&&(f===void 0?h.dispose!==null:f);if(!_){var y;s((y=h.__r3f)==null?void 0:y.objects,h,x),s(h.children,h,x)}if(delete h.__r3f,x&&h.dispose&&h.type!=="Scene"){const S=()=>{try{h.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?XH.unstable_scheduleCallback(XH.unstable_IdlePriority,S):S()}Um(u)}}function a(u,h,f,m){var g;const v=(g=u.__r3f)==null?void 0:g.parent;if(!v)return;const w=t(h,f,u.__r3f.root);if(u.children){for(const y of u.children)y.__r3f&&i(w,y);u.children=u.children.filter(y=>!y.__r3f)}u.__r3f.objects.forEach(y=>i(w,y)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||o(v,u),w.parent&&(w.__r3f.autoRemovedBeforeAppend=!0),i(v,w),w.raycast&&w.__r3f.eventCount&&ZE(w).getState().internal.interaction.push(w),[m,m.alternate].forEach(y=>{y!==null&&(y.stateNode=w,y.ref&&(typeof y.ref=="function"?y.ref(w):y.ref.current=w))})}const l=()=>{};return{reconciler:r4e({createInstance:t,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,h)=>{if(!h)return;const f=u.getState().scene;f.__r3f&&(f.__r3f.root=u,i(f,h))},removeChildFromContainer:(u,h)=>{h&&o(u.getState().scene,h)},insertInContainerBefore:(u,h,f)=>{if(!h||!f)return;const m=u.getState().scene;m.__r3f&&r(m,h,f)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var h;return!!((h=u==null?void 0:u.__r3f)!=null?h:{}).handlers},prepareUpdate(u,h,f,m){var g;if(((g=u==null?void 0:u.__r3f)!=null?g:{}).primitive&&m.object&&m.object!==u)return[!0];{const{args:w=[],children:y,..._}=m,{args:x=[],children:S,...M}=f;if(!Array.isArray(w))throw new Error("R3F: the args prop must be an array!");if(w.some((I,D)=>I!==x[D]))return[!0];const A=yJ(u,_,M,!0);return A.changes.length?[!1,A]:null}},commitUpdate(u,[h,f],m,g,v,w){h?a(u,m,v,w):l3(u,f)},commitMount(u,h,f,m){var g;const v=(g=u.__r3f)!=null?g:{};u.raycast&&v.handlers&&v.eventCount&&ZE(u).getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>Lm(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var h;const{attach:f,parent:m}=(h=u.__r3f)!=null?h:{};f&&m&&e9(m,u,f),u.isObject3D&&(u.visible=!1),Um(u)},unhideInstance(u,h){var f;const{attach:m,parent:g}=(f=u.__r3f)!=null?f:{};m&&g&&a3(g,u,m),(u.isObject3D&&h.visible==null||h.visible)&&(u.visible=!0),Um(u)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():hg.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Tn.fun(performance.now)?performance.now:Tn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Tn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Tn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:l3}}var YH,QH;const o3=n=>"colorSpace"in n||"outputColorSpace"in n,hJ=()=>{var n;return(n=_U.ColorManagement)!=null?n:null},fJ=n=>n&&n.isOrthographicCamera,a4e=n=>n&&n.hasOwnProperty("current"),mx=typeof window<"u"&&((YH=window.document)!=null&&YH.createElement||((QH=window.navigator)==null?void 0:QH.product)==="ReactNative")?fe.useLayoutEffect:fe.useEffect;function dJ(n){const e=fe.useRef(n);return mx(()=>void(e.current=n),[n]),e}function l4e({set:n}){return mx(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class pJ extends fe.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}pJ.getDerivedStateFromError=()=>({error:!0});const mJ="__default",ZH=new Map,c4e=n=>n&&!!n.memoized&&!!n.changes;function gJ(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const gv=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()};function ZE(n){let e=n.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const Tn={obj:n=>n===Object(n)&&!Tn.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:r=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(Tn.str(n)||Tn.num(n)||Tn.boo(n))return n===e;const s=Tn.obj(n);if(s&&i==="reference")return n===e;const o=Tn.arr(n);if(o&&t==="reference")return n===e;if((o||s)&&n===e)return!0;let a;for(a in n)if(!(a in e))return!1;if(s&&t==="shallow"&&i==="shallow"){for(a in r?e:n)if(!Tn.equ(n[a],e[a],{strict:r,objects:"reference"}))return!1}else for(a in r?e:n)if(n[a]!==e[a])return!1;if(Tn.und(a)){if(o&&n.length===0&&e.length===0||s&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function u4e(n){const e={nodes:{},materials:{}};return n&&n.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}function h4e(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function Lm(n,e){const t=n;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},n}function qN(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),r=i.pop();return t=i.reduce((s,o)=>s[o],n),{target:t,key:r}}else return{target:t,key:e}}const JH=/-\d+$/;function a3(n,e,t){if(Tn.str(t)){if(JH.test(t)){const s=t.replace(JH,""),{target:o,key:a}=qN(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:r}=qN(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function e9(n,e,t){var i,r;if(Tn.str(t)){const{target:s,key:o}=qN(n,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(r=e.__r3f)==null||delete r.previousAttach}function yJ(n,{children:e,key:t,ref:i,...r},{children:s,key:o,ref:a,...l}={},c=!1){const u=n.__r3f,h=Object.entries(r),f=[];if(c){const g=Object.keys(l);for(let v=0;v<g.length;v++)r.hasOwnProperty(g[v])||h.unshift([g[v],mJ+"remove"])}h.forEach(([g,v])=>{var w;if((w=n.__r3f)!=null&&w.primitive&&g==="object"||Tn.equ(v,l[g]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(g))return f.push([g,v,!0,[]]);let y=[];g.includes("-")&&(y=g.split("-")),f.push([g,v,!1,y]);for(const _ in r){const x=r[_];_.startsWith(`${g}-`)&&f.push([_,x,!1,_.split("-")])}});const m={...r};return u!=null&&u.memoizedProps&&u!=null&&u.memoizedProps.args&&(m.args=u.memoizedProps.args),u!=null&&u.memoizedProps&&u!=null&&u.memoizedProps.attach&&(m.attach=u.memoizedProps.attach),{memoized:m,changes:f}}const f4e=typeof process<"u"&&!1;function l3(n,e){var t;const i=n.__r3f,r=i==null?void 0:i.root,s=r==null||r.getState==null?void 0:r.getState(),{memoized:o,changes:a}=c4e(e)?e:yJ(n,e),l=i==null?void 0:i.eventCount;n.__r3f&&(n.__r3f.memoizedProps=o);for(let f=0;f<a.length;f++){let[m,g,v,w]=a[f];if(o3(n)){const S="srgb",M="srgb-linear";m==="encoding"?(m="colorSpace",g=g===3001?S:M):m==="outputEncoding"&&(m="outputColorSpace",g=g===3001?S:M)}let y=n,_=y[m];if(w.length&&(_=w.reduce((x,S)=>x[S],n),!(_&&_.set))){const[x,...S]=w.reverse();y=S.reverse().reduce((M,A)=>M[A],n),m=x}if(g===mJ+"remove")if(y.constructor){let x=ZH.get(y.constructor);x||(x=new y.constructor,ZH.set(y.constructor,x)),g=x[m]}else g=0;if(v&&i)g?i.handlers[m]=g:delete i.handlers[m],i.eventCount=Object.keys(i.handlers).length;else if(_&&_.set&&(_.copy||_ instanceof Zd)){if(Array.isArray(g))_.fromArray?_.fromArray(g):_.set(...g);else if(_.copy&&g&&g.constructor&&(f4e?_.constructor.name===g.constructor.name:_.constructor===g.constructor))_.copy(g);else if(g!==void 0){var c;const x=(c=_)==null?void 0:c.isColor;!x&&_.setScalar?_.setScalar(g):_ instanceof Zd&&g instanceof Zd?_.mask=g.mask:_.set(g),!hJ()&&s&&!s.linear&&x&&_.convertSRGBToLinear()}}else{var u;if(y[m]=g,(u=y[m])!=null&&u.isTexture&&y[m].format===zr&&y[m].type===Fl&&s){const x=y[m];o3(x)&&o3(s.gl)?x.colorSpace=s.gl.outputColorSpace:x.encoding=s.gl.outputEncoding}}Um(n)}if(i&&i.parent&&n.raycast&&l!==i.eventCount){const f=ZE(n).getState().internal,m=f.interaction.indexOf(n);m>-1&&f.interaction.splice(m,1),i.eventCount&&f.interaction.push(n)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(t=n.__r3f)!=null&&t.parent&&KN(n),n}function Um(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function KN(n){n.onUpdate==null||n.onUpdate(n)}function d4e(n,e){n.manual||(fJ(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function lE(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function p4e(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return hg.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return hg.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return hg.ContinuousEventPriority;default:return hg.DefaultEventPriority}}function vJ(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function m4e(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((i,r)=>{vJ(t.capturedMap,e,i,r)})}function g4e(n){function e(l){const{internal:c}=n.getState(),u=l.offsetX-c.initialClick[0],h=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+h*h))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var h;return(h=c.__r3f)==null?void 0:h.handlers["onPointer"+u]}))}function i(l,c){const u=n.getState(),h=new Set,f=[],m=c?c(u.internal.interaction):u.internal.interaction;for(let y=0;y<m.length;y++){const _=gv(m[y]);_&&(_.raycaster.camera=void 0)}u.previousRoot||u.events.compute==null||u.events.compute(l,u);function g(y){const _=gv(y);if(!_||!_.events.enabled||_.raycaster.camera===null)return[];if(_.raycaster.camera===void 0){var x;_.events.compute==null||_.events.compute(l,_,(x=_.previousRoot)==null?void 0:x.getState()),_.raycaster.camera===void 0&&(_.raycaster.camera=null)}return _.raycaster.camera?_.raycaster.intersectObject(y,!0):[]}let v=m.flatMap(g).sort((y,_)=>{const x=gv(y.object),S=gv(_.object);return!x||!S?y.distance-_.distance:S.events.priority-x.events.priority||y.distance-_.distance}).filter(y=>{const _=lE(y);return h.has(_)?!1:(h.add(_),!0)});u.events.filter&&(v=u.events.filter(v,u));for(const y of v){let _=y.object;for(;_;){var w;(w=_.__r3f)!=null&&w.eventCount&&f.push({...y,eventObject:_}),_=_.parent}}if("pointerId"in l&&u.internal.capturedMap.has(l.pointerId))for(let y of u.internal.capturedMap.get(l.pointerId).values())h.has(lE(y.intersection))||f.push(y.intersection);return f}function r(l,c,u,h){const f=n.getState();if(l.length){const m={stopped:!1};for(const g of l){const v=gv(g.object)||f,{raycaster:w,pointer:y,camera:_,internal:x}=v,S=new K(y.x,y.y,0).unproject(_),M=C=>{var U,G;return(U=(G=x.capturedMap.get(C))==null?void 0:G.has(g.eventObject))!=null?U:!1},A=C=>{const U={intersection:g,target:c.target};x.capturedMap.has(C)?x.capturedMap.get(C).set(g.eventObject,U):x.capturedMap.set(C,new Map([[g.eventObject,U]])),c.target.setPointerCapture(C)},I=C=>{const U=x.capturedMap.get(C);U&&vJ(x.capturedMap,g.eventObject,U,C)};let D={};for(let C in c){let U=c[C];typeof U!="function"&&(D[C]=U)}let k={...g,...D,pointer:y,intersections:l,stopped:m.stopped,delta:u,unprojectedPoint:S,ray:w.ray,camera:_,stopPropagation(){const C="pointerId"in c&&x.capturedMap.get(c.pointerId);if((!C||C.has(g.eventObject))&&(k.stopped=m.stopped=!0,x.hovered.size&&Array.from(x.hovered.values()).find(U=>U.eventObject===g.eventObject))){const U=l.slice(0,l.indexOf(g));s([...U,g])}},target:{hasPointerCapture:M,setPointerCapture:A,releasePointerCapture:I},currentTarget:{hasPointerCapture:M,setPointerCapture:A,releasePointerCapture:I},nativeEvent:c};if(h(k),m.stopped===!0)break}}return l}function s(l){const{internal:c}=n.getState();for(const u of c.hovered.values())if(!l.length||!l.find(h=>h.object===u.object&&h.index===u.index&&h.instanceId===u.instanceId)){const f=u.eventObject.__r3f,m=f==null?void 0:f.handlers;if(c.hovered.delete(lE(u)),f!=null&&f.eventCount){const g={...u,intersections:l};m.onPointerOut==null||m.onPointerOut(g),m.onPointerLeave==null||m.onPointerLeave(g)}}}function o(l,c){for(let u=0;u<c.length;u++){const h=c[u].__r3f;h==null||h.handlers.onPointerMissed==null||h.handlers.onPointerMissed(l)}}function a(l){switch(l){case"onPointerLeave":case"onPointerCancel":return()=>s([]);case"onLostPointerCapture":return c=>{const{internal:u}=n.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),s([]))})}}return function(u){const{onPointerMissed:h,internal:f}=n.getState();f.lastEvent.current=u;const m=l==="onPointerMove",g=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",w=i(u,m?t:void 0),y=g?e(u):0;l==="onPointerDown"&&(f.initialClick=[u.offsetX,u.offsetY],f.initialHits=w.map(x=>x.eventObject)),g&&!w.length&&y<=2&&(o(u,f.interaction),h&&h(u)),m&&s(w);function _(x){const S=x.eventObject,M=S.__r3f,A=M==null?void 0:M.handlers;if(M!=null&&M.eventCount)if(m){if(A.onPointerOver||A.onPointerEnter||A.onPointerOut||A.onPointerLeave){const I=lE(x),D=f.hovered.get(I);D?D.stopped&&x.stopPropagation():(f.hovered.set(I,x),A.onPointerOver==null||A.onPointerOver(x),A.onPointerEnter==null||A.onPointerEnter(x))}A.onPointerMove==null||A.onPointerMove(x)}else{const I=A[l];I?(!g||f.initialHits.includes(S))&&(o(u,f.interaction.filter(D=>!f.initialHits.includes(D))),I(x)):g&&f.initialHits.includes(S)&&o(u,f.interaction.filter(D=>!f.initialHits.includes(D)))}}r(w,u,y,_)}}return{handlePointer:a}}const wJ=n=>!!(n!=null&&n.render),xJ=fe.createContext(null),y4e=(n,e)=>{const t=XBe((a,l)=>{const c=new K,u=new K,h=new K;function f(y=l().camera,_=u,x=l().size){const{width:S,height:M,top:A,left:I}=x,D=S/M;_.isVector3?h.copy(_):h.set(..._);const k=y.getWorldPosition(c).distanceTo(h);if(fJ(y))return{width:S/y.zoom,height:M/y.zoom,top:A,left:I,factor:1,distance:k,aspect:D};{const C=y.fov*Math.PI/180,U=2*Math.tan(C/2)*k,G=U*(S/M);return{width:G,height:U,top:A,left:I,factor:S/G,distance:k,aspect:D}}}let m;const g=y=>a(_=>({performance:{..._.performance,current:y}})),v=new Me;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(y=1)=>n(l(),y),advance:(y,_)=>e(y,_,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new vU,pointer:v,mouse:v,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const y=l();m&&clearTimeout(m),y.performance.current!==y.performance.min&&g(y.performance.min),m=setTimeout(()=>g(l().performance.max),y.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:f},setEvents:y=>a(_=>({..._,events:{..._.events,...y}})),setSize:(y,_,x,S,M)=>{const A=l().camera,I={width:y,height:_,top:S||0,left:M||0,updateStyle:x};a(D=>({size:I,viewport:{...D.viewport,...f(A,u,I)}}))},setDpr:y=>a(_=>{const x=gJ(y);return{viewport:{..._.viewport,dpr:x,initialDpr:_.viewport.initialDpr||x}}}),setFrameloop:(y="always")=>{const _=l().clock;_.stop(),_.elapsedTime=0,y!=="never"&&(_.start(),_.elapsedTime=0),a(()=>({frameloop:y}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:fe.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(y,_,x)=>{const S=l().internal;return S.priority=S.priority+(_>0?1:0),S.subscribers.push({ref:y,priority:_,store:x}),S.subscribers=S.subscribers.sort((M,A)=>M.priority-A.priority),()=>{const M=l().internal;M!=null&&M.subscribers&&(M.priority=M.priority-(_>0?1:0),M.subscribers=M.subscribers.filter(A=>A.ref!==y))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,o=i.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:u,set:h}=t.getState();if(l.width!==r.width||l.height!==r.height||c.dpr!==s){var f;r=l,s=c.dpr,d4e(a,l),u.setPixelRatio(c.dpr);const m=(f=l.updateStyle)!=null?f:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(l.width,l.height,m)}a!==o&&(o=a,h(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let cE,v4e=new Set,w4e=new Set,x4e=new Set;function c3(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function yv(n,e){switch(n){case"before":return c3(v4e,e);case"after":return c3(w4e,e);case"tail":return c3(x4e,e)}}let u3,h3;function f3(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),u3=e.internal.subscribers,cE=0;cE<u3.length;cE++)h3=u3[cE],h3.ref.current(h3.store.getState(),i,t);return!e.internal.priority&&e.gl.render&&e.gl.render(e.scene,e.camera),e.internal.frames=Math.max(0,e.internal.frames-1),e.frameloop==="always"?1:e.internal.frames}function b4e(n){let e=!1,t=!1,i,r,s;function o(c){r=requestAnimationFrame(o),e=!0,i=0,yv("before",c),t=!0;for(const h of n.values()){var u;s=h.store.getState(),s.internal.active&&(s.frameloop==="always"||s.internal.frames>0)&&!((u=s.gl.xr)!=null&&u.isPresenting)&&(i+=f3(c,s))}if(t=!1,yv("after",c),i===0)return yv("tail",c),e=!1,cancelAnimationFrame(r)}function a(c,u=1){var h;if(!c)return n.forEach(f=>a(f.store.getState(),u));(h=c.gl.xr)!=null&&h.isPresenting||!c.internal.active||c.frameloop==="never"||(u>1?c.internal.frames=Math.min(60,c.internal.frames+u):t?c.internal.frames=2:c.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function l(c,u=!0,h,f){if(u&&yv("before",c),h)f3(c,h,f);else for(const m of n.values())f3(c,m.store.getState());u&&yv("after",c)}return{loop:o,invalidate:a,advance:l}}function bJ(){const n=fe.useContext(xJ);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function _4e(n=t=>t,e){return bJ()(n,e)}function gx(n,e=0){const t=bJ(),i=t.getState().internal.subscribe,r=dJ(n);return mx(()=>i(r,e,t),[e,i,t]),null}const t9=new WeakMap;function _J(n,e){return function(t,...i){let r=t9.get(t);return r||(r=new t,t9.set(t,r)),n&&n(r),Promise.all(i.map(s=>new Promise((o,a)=>r.load(s,l=>{l.scene&&Object.assign(l,u4e(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l==null?void 0:l.message}`))))))}}function yx(n,e,t,i){const r=Array.isArray(e)?e:[e],s=QBe(_J(t,i),[n,...r],{equal:Tn.equ});return Array.isArray(e)?s:s[0]}yx.preload=function(n,e,t){const i=Array.isArray(e)?e:[e];return ZBe(_J(t),[n,...i])};yx.clear=function(n,e){const t=Array.isArray(e)?e:[e];return JBe([n,...t])};const G0=new Map,{invalidate:n9,advance:i9}=b4e(G0),{reconciler:yA,applyProps:Cm}=o4e(G0,p4e),Im={objects:"shallow",strict:!1},E4e=(n,e)=>{const t=typeof n=="function"?n(e):n;return wJ(t)?t:new eU({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function S4e(n,e){const t=typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement;if(e){const{width:i,height:r,top:s,left:o,updateStyle:a=t}=e;return{width:i,height:r,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:i,height:r,top:s,left:o}=n.parentElement.getBoundingClientRect();return{width:i,height:r,top:s,left:o,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function A4e(n){const e=G0.get(n),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=i||y4e(n9,i9),o=t||yA.createContainer(s,hg.ConcurrentRoot,null,!1,null,"",r,null);e||G0.set(n,{fiber:o,store:s});let a,l=!1,c;return{configure(u={}){let{gl:h,size:f,scene:m,events:g,onCreated:v,shadows:w=!1,linear:y=!1,flat:_=!1,legacy:x=!1,orthographic:S=!1,frameloop:M="always",dpr:A=[1,2],performance:I,raycaster:D,camera:k,onPointerMissed:C}=u,U=s.getState(),G=U.gl;U.gl||U.set({gl:G=E4e(h,n)});let H=U.raycaster;H||U.set({raycaster:H=new nJ});const{params:z,...P}=D||{};if(Tn.equ(P,H,Im)||Cm(H,{...P}),Tn.equ(z,H.params,Im)||Cm(H,{params:{...H.params,...z}}),!U.camera||U.camera===c&&!Tn.equ(c,k,Im)){c=k;const B=k instanceof ax,W=B?k:S?new ux(0,0,0,0,.1,1e3):new Ki(75,0,.1,1e3);B||(W.position.z=5,k&&(Cm(W,k),("aspect"in k||"left"in k||"right"in k||"bottom"in k||"top"in k)&&(W.manual=!0,W.updateProjectionMatrix())),!U.camera&&!(k!=null&&k.rotation)&&W.lookAt(0,0,0)),U.set({camera:W}),H.camera=W}if(!U.scene){let B;m!=null&&m.isScene?B=m:(B=new tU,m&&Cm(B,m)),U.set({scene:Lm(B)})}if(!U.xr){var R;const B=(oe,Y)=>{const te=s.getState();te.frameloop!=="never"&&i9(oe,!0,te,Y)},W=()=>{const oe=s.getState();oe.gl.xr.enabled=oe.gl.xr.isPresenting,oe.gl.xr.setAnimationLoop(oe.gl.xr.isPresenting?B:null),oe.gl.xr.isPresenting||n9(oe)},Q={connect(){const oe=s.getState().gl;oe.xr.addEventListener("sessionstart",W),oe.xr.addEventListener("sessionend",W)},disconnect(){const oe=s.getState().gl;oe.xr.removeEventListener("sessionstart",W),oe.xr.removeEventListener("sessionend",W)}};typeof((R=G.xr)==null?void 0:R.addEventListener)=="function"&&Q.connect(),U.set({xr:Q})}if(G.shadowMap){const B=G.shadowMap.enabled,W=G.shadowMap.type;if(G.shadowMap.enabled=!!w,Tn.boo(w))G.shadowMap.type=rw;else if(Tn.str(w)){var F;const Q={basic:qY,percentage:D2,soft:rw,variance:Sa};G.shadowMap.type=(F=Q[w])!=null?F:rw}else Tn.obj(w)&&Object.assign(G.shadowMap,w);(B!==G.shadowMap.enabled||W!==G.shadowMap.type)&&(G.shadowMap.needsUpdate=!0)}const N=hJ();N&&("enabled"in N?N.enabled=!x:"legacyMode"in N&&(N.legacyMode=x)),l||Cm(G,{outputEncoding:y?3e3:3001,toneMapping:_?kl:OL}),U.legacy!==x&&U.set(()=>({legacy:x})),U.linear!==y&&U.set(()=>({linear:y})),U.flat!==_&&U.set(()=>({flat:_})),h&&!Tn.fun(h)&&!wJ(h)&&!Tn.equ(h,G,Im)&&Cm(G,h),g&&!U.events.handlers&&U.set({events:g(s)});const O=S4e(n,f);return Tn.equ(O,U.size,Im)||U.setSize(O.width,O.height,O.updateStyle,O.top,O.left),A&&U.viewport.dpr!==gJ(A)&&U.setDpr(A),U.frameloop!==M&&U.setFrameloop(M),U.onPointerMissed||U.set({onPointerMissed:C}),I&&!Tn.equ(I,U.performance,Im)&&U.set(B=>({performance:{...B.performance,...I}})),a=v,l=!0,this},render(u){return l||this.configure(),yA.updateContainer(j.jsx(M4e,{store:s,children:u,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){EJ(n)}}}function M4e({store:n,children:e,onCreated:t,rootElement:i}){return mx(()=>{const r=n.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),n.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),j.jsx(xJ.Provider,{value:n,children:e})}function EJ(n,e){const t=G0.get(n),i=t==null?void 0:t.fiber;if(i){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),yA.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,o,a,l;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=r.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),h4e(r),G0.delete(n)}catch{}},500)})}}yA.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:fe.version});const d3={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function T4e(n){const{handlePointer:e}=g4e(n);return{priority:1,enabled:!0,compute(t,i,r){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(d3).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:r}=n.getState();(t=r.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var i;const{set:r,events:s}=n.getState();s.disconnect==null||s.disconnect(),r(o=>({events:{...o.events,connected:t}})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([o,a])=>{const[l,c]=d3[o];t.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([s,o])=>{if(i&&i.connected instanceof HTMLElement){const[a]=d3[s];i.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}function r9(n,e){let t;return(...i)=>{window.clearTimeout(t),t=window.setTimeout(()=>n(...i),e)}}function P4e({debounce:n,scroll:e,polyfill:t,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){const r=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!r)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=fe.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=fe.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=n?typeof n=="number"?n:n.scroll:null,c=n?typeof n=="number"?n:n.resize:null,u=fe.useRef(!1);fe.useEffect(()=>(u.current=!0,()=>void(u.current=!1)));const[h,f,m]=fe.useMemo(()=>{const y=()=>{if(!a.current.element)return;const{left:_,top:x,width:S,height:M,bottom:A,right:I,x:D,y:k}=a.current.element.getBoundingClientRect(),C={left:_,top:x,width:S,height:M,bottom:A,right:I,x:D,y:k};a.current.element instanceof HTMLElement&&i&&(C.height=a.current.element.offsetHeight,C.width=a.current.element.offsetWidth),Object.freeze(C),u.current&&!N4e(a.current.lastBounds,C)&&o(a.current.lastBounds=C)};return[y,c?r9(y,c):y,l?r9(y,l):y]},[o,i,l,c]);function g(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(y=>y.removeEventListener("scroll",m,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function v(){a.current.element&&(a.current.resizeObserver=new r(m),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(y=>y.addEventListener("scroll",m,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{m()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const w=y=>{!y||y===a.current.element||(g(),a.current.element=y,a.current.scrollContainers=SJ(y),v())};return I4e(m,!!e),C4e(f),fe.useEffect(()=>{g(),v()},[e,m,f]),fe.useEffect(()=>g,[]),[w,s,h]}function C4e(n){fe.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function I4e(n,e){fe.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function SJ(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:r}=window.getComputedStyle(n);return[t,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...SJ(n.parentElement)]}const R4e=["x","y","top","bottom","left","right","width","height"],N4e=(n,e)=>R4e.every(t=>n[t]===e[t]);var D4e=Object.defineProperty,O4e=Object.defineProperties,L4e=Object.getOwnPropertyDescriptors,s9=Object.getOwnPropertySymbols,U4e=Object.prototype.hasOwnProperty,B4e=Object.prototype.propertyIsEnumerable,o9=(n,e,t)=>e in n?D4e(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,a9=(n,e)=>{for(var t in e||(e={}))U4e.call(e,t)&&o9(n,t,e[t]);if(s9)for(var t of s9(e))B4e.call(e,t)&&o9(n,t,e[t]);return n},k4e=(n,e)=>O4e(n,L4e(e)),l9,c9;typeof window<"u"&&((l9=window.document)!=null&&l9.createElement||((c9=window.navigator)==null?void 0:c9.product)==="ReactNative")?fe.useLayoutEffect:fe.useEffect;function AJ(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=n.child;for(;i;){const r=AJ(i,e,t);if(r)return r;i=i.sibling}}function MJ(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const u9=console.error;console.error=function(){const n=[...arguments].join("");if(n!=null&&n.startsWith("Warning:")&&n.includes("useContext")){console.error=u9;return}return u9.apply(this,arguments)};const EU=MJ(fe.createContext(null));class TJ extends fe.Component{render(){return fe.createElement(EU.Provider,{value:this._reactInternals},this.props.children)}}function F4e(){const n=fe.useContext(EU);if(n===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=fe.useId();return fe.useMemo(()=>{for(const i of[n,n==null?void 0:n.alternate]){if(!i)continue;const r=AJ(i,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(r)return r}},[n,e])}function z4e(){const n=F4e(),[e]=fe.useState(()=>new Map);e.clear();let t=n;for(;t;){if(t.type&&typeof t.type=="object"){const r=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;r&&r!==EU&&!e.has(r)&&e.set(r,fe.useContext(MJ(r)))}t=t.return}return e}function V4e(){const n=z4e();return fe.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>fe.createElement(e,null,fe.createElement(t.Provider,k4e(a9({},i),{value:n.get(t)}))),e=>fe.createElement(TJ,a9({},e))),[n])}const H4e=fe.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:s,events:o=T4e,eventSource:a,eventPrefix:l,shadows:c,linear:u,flat:h,legacy:f,orthographic:m,frameloop:g,dpr:v,performance:w,raycaster:y,camera:_,scene:x,onPointerMissed:S,onCreated:M,...A},I){fe.useMemo(()=>s4e(WBe),[]);const D=V4e(),[k,C]=P4e({scroll:!0,debounce:{scroll:50,resize:0},...i}),U=fe.useRef(null),G=fe.useRef(null);fe.useImperativeHandle(I,()=>U.current);const H=dJ(S),[z,P]=fe.useState(!1),[R,F]=fe.useState(!1);if(z)throw z;if(R)throw R;const N=fe.useRef(null);mx(()=>{const B=U.current;C.width>0&&C.height>0&&B&&(N.current||(N.current=A4e(B)),N.current.configure({gl:s,events:o,shadows:c,linear:u,flat:h,legacy:f,orthographic:m,frameloop:g,dpr:v,performance:w,raycaster:y,camera:_,scene:x,size:C,onPointerMissed:(...W)=>H.current==null?void 0:H.current(...W),onCreated:W=>{W.events.connect==null||W.events.connect(a?a4e(a)?a.current:a:G.current),l&&W.setEvents({compute:(Q,oe)=>{const Y=Q[l+"X"],te=Q[l+"Y"];oe.pointer.set(Y/oe.size.width*2-1,-(te/oe.size.height)*2+1),oe.raycaster.setFromCamera(oe.pointer,oe.camera)}}),M==null||M(W)}}),N.current.render(j.jsx(D,{children:j.jsx(pJ,{set:F,children:j.jsx(fe.Suspense,{fallback:j.jsx(l4e,{set:P}),children:e??null})})})))}),fe.useEffect(()=>{const B=U.current;if(B)return()=>EJ(B)},[]);const O=a?"none":"auto";return j.jsx("div",{ref:G,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:O,...r},...A,children:j.jsx("div",{ref:k,style:{width:"100%",height:"100%"},children:j.jsx("canvas",{ref:U,style:{display:"block"},children:t})})})}),PJ=fe.forwardRef(function(e,t){return j.jsx(TJ,{children:j.jsx(H4e,{...e,ref:t})})});
4048function $4e(...n){return n.filter(Boolean).join(" ")}const G4e=`
4049  varying vec2 vUv;
4050  void main() {
4051    vUv = uv;
4052    gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
4053  }
4054`,j4e=`
4055  uniform float iTime;
4056  uniform vec2 iResolution;
4057  uniform sampler2D iChannel0;
4058  varying vec2 vUv;
4059
4060  void main() {
4061    vec2 uv = vUv;
4062    float result = 0.0;
4063
4064    result += texture2D(iChannel0, uv * 1.1 + vec2(iTime * -0.005)).r;
4065    result *= texture2D(iChannel0, uv * 0.9 + vec2(iTime * 0.005)).g;
4066
4067    result = pow(result, 12.0);
4068
4069    gl_FragColor = vec4(vec3(5.0) * result, 1.0);
4070  }
4071`;function W4e(n=512){const e=new Uint8Array(n*n*4);for(let i=0;i<n*n;i++){const r=i*4,s=Math.random()*255,o=Math.random()*255,a=Math.random()*255;e[r]=s,e[r+1]=o,e[r+2]=a,e[r+3]=255}const t=new Xc(e,n,n,zr);return t.wrapS=pp,t.wrapT=pp,t.minFilter=On,t.magFilter=On,t.needsUpdate=!0,t}function q4e({speed:n=1,intensity:e=5}){const t=fe.useRef(null),i=fe.useMemo(()=>W4e(512),[]),r=fe.useMemo(()=>new zs({uniforms:{iTime:{value:0},iResolution:{value:new Me(typeof window<"u"?window.innerWidth:1920,typeof window<"u"?window.innerHeight:1080)},iChannel0:{value:i}},vertexShader:G4e,fragmentShader:j4e,transparent:!1,side:Ua}),[i]);return gx(s=>{t.current&&t.current.material instanceof zs&&(t.current.material.uniforms.iTime.value=s.clock.elapsedTime*n,t.current.material.uniforms.iResolution.value.set(s.size.width,s.size.height))}),j.jsx("mesh",{ref:t,material:r,children:j.jsx("planeGeometry",{args:[10,10]})})}function K4e({speed:n=1,intensity:e=5,className:t=""}){return j.jsx("div",{className:$4e("fixed scale-125 inset-0 w-full h-full opacity-50 mix-blend-lighten pointer-events-none z-50",t),style:{width:"100vw",height:"100vh"},children:j.jsxs(PJ,{camera:{position:[0,0,8],fov:35},style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:10},gl:{powerPreference:"high-performance"},children:[j.jsx("color",{attach:"background",args:["hsl(var(--background))"]}),j.jsx(q4e,{speed:n,intensity:e})]})})}function vv({quarter:n,title:e,description:t,isRight:i,delay:r}){const[s,o]=af({triggerOnce:!0,threshold:.2});return j.jsxs(j.Fragment,{children:[j.jsxs(un.div,{ref:s,initial:{opacity:0,x:i?50:-50},animate:o?{opacity:1,x:0}:{opacity:0,x:i?50:-50},transition:{duration:.8,delay:r},className:`md:${i?"pl-16":"text-right pr-16"} relative`,children:[j.jsx("div",{className:`absolute ${i?"left-0":"right-0"} md:${i?"right-full":"left-full"} top-0 transform ${i?"translate-x-0 md:translate-x-1/2":"translate-x-0 md:-translate-x-1/2"} -translate-y-1/3 w-4 h-4 bg-red-600 rounded-full z-10`}),j.jsxs("h3",{className:"text-2xl font-bold mb-2 text-red-600",children:[n,": ",e]}),j.jsx("p",{className:"opacity-90",children:t})]}),!i&&j.jsx("div",{className:"hidden md:block"}),i&&j.jsx("div",{className:"hidden md:block"})]})}function X4e(){const[n,e]=af({triggerOnce:!0,threshold:.1});return j.jsxs("section",{id:"roadmap",className:"py-20 relative overflow-hidden",children:[j.jsx(K4e,{speed:.5,intensity:3,className:"absolute inset-0 opacity-30"}),j.jsxs("div",{className:"container mx-auto px-4 relative z-10",children:[j.jsxs(un.h2,{ref:n,initial:{opacity:0,y:20},animate:e?{opacity:1,y:0}:{opacity:0,y:20},transition:{duration:.8},className:"text-4xl font-bold mb-16 text-center",children:["MISSION ",j.jsx("span",{className:"text-red-600",children:"TRAJECTORY"})]}),j.jsxs("div",{className:"relative",children:[j.jsx("div",{className:"absolute left-1/2 transform -translate-x-1/2 h-full w-1 bg-red-900 opacity-50"}),j.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-y-24",children:[j.jsx(vv,{quarter:"Q4 2025",title:"PRE ALPHA LAUNCH",description:"Monad users can use testnet to experience dog fights and gameplay",delay:.1}),j.jsx(vv,{quarter:"Q1 2026",title:"ALPHA LAUNCH",description:"Internal testing and limited external feedback to refine gameplay mechanics, wagering systems, and game stability.",delay:.3}),j.jsx(vv,{quarter:"Q2 2026",title:"BETA LAUNCH",description:"Open the game to a wider audience, gather real-world player data, test scaling, and continue refinement based on player input.",isRight:!0,delay:.5}),j.jsx(vv,{quarter:"Q3 2026",title:"FULL RELEASE",description:"Launch the fully polished game with all key features, monetization models, and full integration for a global audience.",delay:.7}),j.jsx(vv,{quarter:"Q4 2026+",title:"EXPANSION",description:"Continue to evolve the game, expand the player base, and introduce new features based on player feedback and technological advancements.",isRight:!0,delay:.9})]})]})]})]})}function uE({value:n,label:e,delay:t}){const[i,r]=af({triggerOnce:!0,threshold:.2});return j.jsxs(un.div,{ref:i,initial:{opacity:0,scale:.8},animate:r?{opacity:1,scale:1}:{opacity:0,scale:.8},transition:{duration:.8,delay:t},className:"countdown-item w-24 h-24 flex flex-col items-center justify-center rounded-lg",children:[j.jsx("div",{className:"text-3xl font-bold text-red-600",children:n}),j.jsx("div",{className:"text-sm opacity-80",children:e})]})}function Y4e(){const[n,e]=af({triggerOnce:!0,threshold:.1}),[t,i]=fe.useState({days:"00",hours:"00",minutes:"00",seconds:"00"});return fe.useEffect(()=>{const r=new Date("2025-11-24T12:00:00Z"),s=()=>{const a=new Date,l=r.getTime()-a.getTime();if(l>0){const c=Math.floor(l/864e5),u=Math.floor(l/(1e3*60*60)%24),h=Math.floor(l/1e3/60%60),f=Math.floor(l/1e3%60);i({days:c.toString().padStart(2,"0"),hours:u.toString().padStart(2,"0"),minutes:h.toString().padStart(2,"0"),seconds:f.toString().padStart(2,"0")})}else i({days:"00",hours:"00",minutes:"00",seconds:"00"})},o=setInterval(s,1e3);return s(),()=>clearInterval(o)},[]),j.jsx("section",{id:"join",className:"py-20 bg-black bg-opacity-70",children:j.jsxs("div",{className:"container mx-auto px-4 text-center",children:[j.jsxs(un.h2,{ref:n,initial:{opacity:0,y:20},animate:e?{opacity:1,y:0}:{opacity:0,y:20},transition:{duration:.8},className:"text-4xl font-bold mb-6",children:["READY TO ",j.jsx("span",{className:"text-red-600 pulse",children:"DOMINATE"})," THE VOID?"]}),j.jsx(un.p,{initial:{opacity:0,y:20},animate:e?{opacity:1,y:0}:{opacity:0,y:20},transition:{duration:.8,delay:.2},className:"text-xl mb-12 max-w-2xl mx-auto opacity-90",children:"Join the upcoming Alpha and be among the first to experience high-stakes space combat. Your skills will be rewarded."}),j.jsxs(un.div,{initial:{opacity:0,y:20},animate:e?{opacity:1,y:0}:{opacity:0,y:20},transition:{duration:.8,delay:.4},className:"flex flex-col md:flex-row gap-8 justify-center mb-16",children:[j.jsx(cA,{className:"button-primary px-8 py-4 rounded-md font-bold text-lg"}),j.jsx(un.a,{href:"#",className:"button-secondary px-8 py-4 rounded-md font-bold text-lg",whileHover:{scale:1.05},whileTap:{scale:.95},children:"BECOME A PARTNER"}),j.jsx(un.a,{href:"#",className:"button-secondary px-8 py-4 rounded-md font-bold text-lg",whileHover:{scale:1.05},whileTap:{scale:.95},children:"CONTACT US"})]}),j.jsx("div",{className:"red-line mb-16 w-full max-w-3xl mx-auto"}),j.jsxs(un.div,{initial:{opacity:0,y:20},animate:e?{opacity:1,y:0}:{opacity:0,y:20},transition:{duration:.8,delay:.6},className:"text-center",children:[j.jsx("h3",{className:"text-2xl font-bold mb-8",children:"PRE ALPHA LAUNCH COUNTDOWN"}),j.jsxs("div",{className:"flex flex-wrap justify-center gap-6",children:[j.jsx(uE,{value:t.days,label:"DAYS",delay:.7}),j.jsx(uE,{value:t.hours,label:"HOURS",delay:.8}),j.jsx(uE,{value:t.minutes,label:"MINUTES",delay:.9}),j.jsx(uE,{value:t.seconds,label:"SECONDS",delay:1})]})]})]})})}const Q4e=()=>j.jsx("svg",{viewBox:"0 0 24 24",className:"w-5 h-5",fill:"currentColor",children:j.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"})}),Z4e=()=>j.jsx("svg",{viewBox:"0 -28.5 256 256",className:"w-5 h-5",fill:"currentColor",children:j.jsx("path",{d:"M216.856339,16.5966031 C200.285002,8.84328665 182.566144,3.2084988 164.041564,0 C161.766523,4.11318106 159.108624,9.64549908 157.276099,14.0464379 C137.583995,11.0849896 118.072967,11.0849896 98.7430163,14.0464379 C96.9108417,9.64549908 94.1925838,4.11318106 91.8971895,0 C73.3526068,3.2084988 55.6133949,8.86399117 39.0420583,16.6376612 C5.61752293,67.146514 -3.4433191,116.400813 1.08711069,164.955721 C23.2560196,181.510915 44.7403634,191.567697 65.8621325,198.148576 C71.0772151,190.971126 75.7283628,183.341335 79.7352139,175.300261 C72.104019,172.400575 64.7949724,168.822202 57.8887866,164.667963 C59.7209612,163.310589 61.5131304,161.891452 63.2445898,160.431257 C105.36741,180.133187 151.
4071134928,180.133187 192.754523,160.431257 C194.506336,161.891452 196.298154,163.310589 198.110326,164.667963 C191.183787,168.842556 183.854737,172.420929 176.223542,175.320965 C180.230393,183.341335 184.861538,190.991831 190.096624,198.16893 C211.238746,191.588051 232.743023,181.531619 254.911949,164.955721 C260.227747,108.668201 245.831087,59.8662432 216.856339,16.5966031 Z M85.4738752,135.09489 C72.8290281,135.09489 62.4592217,123.290155 62.4592217,108.914901 C62.4592217,94.5396472 72.607595,82.7145587 85.4738752,82.7145587 C98.3405064,82.7145587 108.709962,94.5189427 108.488529,108.914901 C108.508531,123.290155 98.3405064,135.09489 85.4738752,135.09489 Z M170.525237,135.09489 C157.88039,135.09489 147.510584,123.290155 147.510584,108.914901 C147.510584,94.5396472 157.658606,82.7145587 170.525237,82.7145587 C183.391518,82.7145587 193.761324,94.5189427 193.539891,108.914901 C193.539891,123.290155 183.391518,135.09489 170.525237,135.09489 Z"})});function J4e(){return j.jsxs("footer",{className:"relative bg-black overflow-hidden",children:[j.jsxs("div",{className:"absolute inset-0 z-0",children:[j.jsx("img",{src:"/images/Footer Image.webp",alt:"Footer Background",className:"w-full h-full object-cover opacity-20"}),j.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black via-black/90 to-transparent"})]}),j.jsxs("div",{className:"relative z-10",children:[j.jsx("div",{className:"container mx-auto px-4 pt-20",children:j.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-12 mb-16",children:[j.jsxs("div",{className:"space-y-6",children:[j.jsx("img",{src:"/images/logos/Stellar Void Logo.webp",alt:"Stellar Void",className:"h-12 w-auto"}),j.jsx("p",{className:"text-gray-400",children:"The next evolution in competitive space combat. Where skill meets fortune in the void."}),j.jsxs("div",{className:"flex space-x-4",children:[j.jsx(un.a,{href:"https://x.com/stellarvoidgame",target:"_blank",rel:"noopener noreferrer",className:"bg-red-600/20 p-2 rounded-lg hover:bg-red-600/40 transition-colors",whileHover:{scale:1.1},children:j.jsx(Q4e,{})}),j.jsx(un.a,{href:"https://discord.gg/W35FunpVaK",target:"_blank",rel:"noopener noreferrer",className:"bg-red-600/20 p-2 rounded-lg hover:bg-red-600/40 transition-colors",whileHover:{scale:1.1},children:j.jsx(Z4e,{})}),j.jsx(un.a,{href:"https://t.me/stellarvoidgame",target:"_blank",rel:"noopener noreferrer",className:"bg-red-600/20 p-2 rounded-lg hover:bg-red-600/40 transition-colors",whileHover:{scale:1.1},children:j.jsx(Pae,{className:"w-5 h-5"})}),j.jsx(un.a,{href:"https://www.youtube.com/channel/UCvqWI08bv0uF2Lq3dTKWpRg",target:"_blank",rel:"noopener noreferrer",className:"bg-red-600/20 p-2 rounded-lg hover:bg-red-600/40 transition-colors",whileHover:{scale:1.1},children:j.jsx(Bae,{className:"w-5 h-5"})}),j.jsx(un.a,{href:"#",className:"bg-red-600/20 p-2 rounded-lg hover:bg-red-600/40 transition-colors",whileHover:{scale:1.1},children:j.jsx(wae,{className:"w-5 h-5"})})]})]}),j.jsxs("div",{children:[j.jsx("h3",{className:"text-xl font-bold mb-6",children:"Quick Links"}),j.jsxs("ul",{className:"space-y-4",children:[j.jsx("li",{children:j.jsxs("a",{href:"#features",className:"text-gray-400 hover:text-red-500 transition-colors flex items-center gap-2",children:[j.jsx(_ae,{className:"w-4 h-4"})," Features"]})}),j.jsx("li",{children:j.jsxs("a",{href:"#gameplay",className:"text-gray-400 hover:text-red-500 transition-colors flex items-center gap-2",children:[j.jsx(Dae,{className:"w-4 h-4"})," Gameplay"]})}),j.jsx("li",{children:j.jsxs("a",{href:"#roadmap",className:"text-gray-400 hover:text-red-500 transition-colors flex items-center gap-2",children:[j.jsx(Eae,{className:"w-4 h-4"})," Contact"]})})]})]}),j.jsxs("div",{children:[j.jsx("h3",{className:"text-xl font-bold mb-6",children:"Latest Updates"}),j.jsxs("div",{className:"space-y-4",children:[j.jsxs("a",{href:"#",className:"block group",children:[j.jsx("p",{className:"text-red-500 text-sm mb-1",children:"December 15, 2024"}),j.jsx("p",{className:"text-gray-400 group-hover:text-white transition-colors",children:"Alpha Testing Registration Now Open"})]}),j.jsxs("a",{href:"#",className:"block group",children:[j.jsx("p",{className:"text-red-500 text-sm mb-1",children:"November 10, 2024"}),j.jsx("p",{className:"text-gray-400 group-hover:text-white transition-colors",children:"New Spacecraft Class Revealed"})]}),j.jsxs("a",{href:"#",className:"block group",children:[j.jsx("p",{className:"text-red-500 text-sm mb-1",children:"October 5, 2024"}),j.jsx("p",{className:"text-gray-400 group-hover:text-white transition-colors",children:"In Discussions with Major Exchange"})]})]})]}),j.jsxs("div",{children:[j.jsx("h3",{className:"text-xl font-bold mb-6",children:"Stay Updated"}),j.jsx("p",{className:"text-gray-400 mb-4",children:"Subscribe to re
4071ceive the latest news and updates."}),j.jsxs("form",{className:"space-y-4",children:[j.jsx("input",{type:"email",placeholder:"Enter your email",className:"w-full bg-white/5 border border-red-600/30 rounded-lg px-4 py-2 text-white placeholder-gray-500 focus:outline-none focus:border-red-600 transition-colors"}),j.jsx(un.button,{type:"submit",className:"w-full button-primary py-2 rounded-lg font-bold",whileHover:{scale:1.02},whileTap:{scale:.98},children:"SUBSCRIBE"})]})]})]})}),j.jsx("div",{className:"red-line w-full max-w-7xl mx-auto opacity-30"}),j.jsx("div",{className:"container mx-auto px-4 py-8",children:j.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4",children:[j.jsx("p",{className:"text-gray-500 text-sm",children:"© 2025 Stellar Void. All rights reserved."}),j.jsxs("div",{className:"flex gap-6 text-sm",children:[j.jsx("a",{href:"#",className:"text-gray-500 hover:text-red-500 transition-colors",children:"Privacy Policy"}),j.jsx("a",{href:"#",className:"text-gray-500 hover:text-red-500 transition-colors",children:"Terms of Service"}),j.jsx("a",{href:"#",className:"text-gray-500 hover:text-red-500 transition-colors",children:"Responsible Gaming"})]})]})})]})]})}const p3=n=>n===Object(n)&&!Array.isArray(n)&&typeof n!="function";function SU(n,e){const t=_4e(s=>s.gl),i=yx(sM,p3(n)?Object.values(n):n);return fe.useLayoutEffect(()=>{e==null||e(i)},[e]),fe.useEffect(()=>{if("initTexture"in t){let s=[];Array.isArray(i)?s=i:i instanceof zn?s=[i]:p3(i)&&(s=Object.values(i)),s.forEach(o=>{o instanceof zn&&t.initTexture(o)})}},[t,i]),fe.useMemo(()=>{if(p3(n)){const s={};let o=0;for(const a in n)s[a]=i[o++];return s}else return i},[n,i])}SU.preload=n=>yx.preload(sM,n);SU.clear=n=>yx.clear(sM,n);const eke=()=>parseInt(rx.replace(/\D+/g,"")),tke=eke();class nke extends zs{constructor(){super({uniforms:{time:{value:0},fade:{value:1}},vertexShader:`
4072      uniform float time;
4073      attribute float size;
4074      varying vec3 vColor;
4075      void main() {
4076        vColor = color;
4077        vec4 mvPosition = modelViewMatrix * vec4(position, 0.5);
4078        gl_PointSize = size * (30.0 / -mvPosition.z) * (3.0 + sin(time + 100.0));
4079        gl_Position = projectionMatrix * mvPosition;
4080      }`,fragmentShader:`
4081      uniform sampler2D pointTexture;
4082      uniform float fade;
4083      varying vec3 vColor;
4084      void main() {
4085        float opacity = 1.0;
4086        if (fade == 1.0) {
4087          float d = distance(gl_PointCoord, vec2(0.5, 0.5));
4088          opacity = 1.0 / (1.0 + exp(16.0 * (d - 0.25)));
4089        }
4090        gl_FragColor = vec4(vColor, opacity);
4091
4092        #include <tonemapping_fragment>
4093	      #include <${tke>=154?"colorspace_fragment":"encodings_fragment"}>
4094      }`})}}const ike=n=>new K().setFromSpherical(new iJ(n,Math.acos(1-Math.random()*2),Math.random()*2*Math.PI)),rke=fe.forwardRef(({radius:n=100,depth:e=50,count:t=5e3,saturation:i=0,factor:r=4,fade:s=!1,speed:o=1},a)=>{const l=fe.useRef(),[c,u,h]=fe.useMemo(()=>{const m=[],g=[],v=Array.from({length:t},()=>(.5+.5*Math.random())*r),w=new et;let y=n+e;const _=e/t;for(let x=0;x<t;x++)y-=_*Math.random(),m.push(...ike(y).toArray()),w.setHSL(x/t,i,.9),g.push(w.r,w.g,w.b);return[new Float32Array(m),new Float32Array(g),new Float32Array(v)]},[t,e,r,n,i]);gx(m=>l.current&&(l.current.uniforms.time.value=m.clock.elapsedTime*o));const[f]=fe.useState(()=>new nke);return fe.createElement("points",{ref:a},fe.createElement("bufferGeometry",null,fe.createElement("bufferAttribute",{attach:"attributes-position",args:[c,3]}),fe.createElement("bufferAttribute",{attach:"attributes-color",args:[u,3]}),fe.createElement("bufferAttribute",{attach:"attributes-size",args:[h,1]})),fe.createElement("primitive",{ref:l,object:f,attach:"material",blending:uA,"uniforms-fade-value":s,depthWrite:!1,transparent:!0,vertexColors:!0}))});function h9({position:n,scale:e,rotationSpeed:t,textureUrl:i}){const r=fe.useRef(),s=SU(i);return gx(o=>{r.current&&(r.current.rotation.y+=t)}),j.jsxs("mesh",{ref:r,position:n,scale:e,children:[j.jsx("sphereGeometry",{args:[1,64,64]}),j.jsx("meshStandardMaterial",{map:s,metalness:.2,roughness:.8,normalScale:new Me(.2,.2)})]})}function ske({position:n,rotation:e}){const t=fe.useRef();return gx(i=>{t.current&&(t.current.rotation.x+=.01,t.current.rotation.y+=.005,t.current.position.y-=.02,t.current.position.y<-20&&(t.current.position.y=20,t.current.position.x=(Math.random()-.5)*40,t.current.position.z=(Math.random()-.5)*40))}),j.jsxs("mesh",{ref:t,position:n,rotation:e,children:[j.jsx("dodecahedronGeometry",{args:[.3,1]}),j.jsx("meshStandardMaterial",{color:"#666666",metalness:.8,roughness:.5})]})}function oke(){const[n,e]=fe.useState({x:0,y:0}),t=fe.useRef();fe.useEffect(()=>{const r=s=>{e({x:s.clientX/window.innerWidth*2-1,y:-(s.clientY/window.innerHeight)*2+1})};return window.addEventListener("mousemove",r),()=>window.removeEventListener("mousemove",r)},[]),gx(r=>{t.current&&(t.current.rotation.y+=5e-4,t.current.rotation.x=n.y*.1,t.current.rotation.z=n.x*.1)});const i=Array.from({length:50},()=>({position:[(Math.random()-.5)*40,(Math.random()-.5)*40,(Math.random()-.5)*40],rotation:[Math.random()*Math.PI,Math.random()*Math.PI,Math.random()*Math.PI]}
4094));return j.jsxs("group",{ref:t,children:[j.jsx(rke,{radius:300,depth:50,count:5e3,factor:4,saturation:0,fade:!0,speed:1}),j.jsx(h9,{position:[10,0,-20],scale:[3,3,3],rotationSpeed:.001,textureUrl:"https://images.unsplash.com/photo-1614730321146-b6fa6a46bcb4?auto=format&fit=crop&q=80&w=1024"}),j.jsx(h9,{position:[-15,5,-30],scale:[4,4,4],rotationSpeed:5e-4,textureUrl:"https://images.unsplash.com/photo-1614728894747-a83421e2b9c9?auto=format&fit=crop&q=80&w=1024"}),i.map((r,s)=>j.jsx(ske,{position:r.position,rotation:r.rotation},s)),j.jsx("ambientLight",{intensity:.2}),j.jsx("pointLight",{position:[10,10,10],intensity:1}),j.jsx("pointLight",{position:[-10,-10,-10],intensity:.5})]})}function ake(){return j.jsx("div",{className:"absolute inset-0 -z-10",children:j.jsx(PJ,{camera:{position:[0,0,30],fov:60},style:{background:"black"},gl:{antialias:!0},children:j.jsx(oke,{})})})}function lke(){return j.jsxs(j.Fragment,{children:[j.jsxs("div",{className:"relative bg-black",children:[j.jsx(F3e,{}),j.jsx(z3e,{})]}),j.jsxs("div",{className:"relative",children:[j.jsx(ake,{}),j.jsx(V3e,{}),j.jsx(q3e,{}),j.jsx(K3e,{}),j.jsx(X3e,{}),j.jsx(X4e,{}),j.jsx(Y4e,{}),j.jsx(J4e,{})]})]})}T7(document.getElementById("root")).render(j.jsx(fe.StrictMode,{children:j.jsx(lke,{})}));export{Vs as A,_o as B,swe as C,t1e as D,NEe as E,TL as F,xAe as G,ML as H,Mp as I,I2 as J,Zw as K,Tp as L,VO as M,Da as N,lve as O,G5 as P,EK as Q,Ph as R,C2 as S,fl as T,Zo as U,hl as V,PY as W,Eo as X,WK as Y,xfe as _,QEe as a,ZEe as b,eY as c,a_ as d,JEe as e,hp as f,ez as g,oq as h,Be as i,ia as j,tSe as k,cp as l,HO as m,K1 as n,mge as o,oge as p,Cme as q,yme as r,iu as s,Bs as t,Ime as u,ywe as v,Lfe as w,sq as x,Jv as y,vR as z};

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.