var hI=Object.defineProperty;var y2=n=>{throw TypeError(n)};var fI=(n,e,t)=>e in n?hI(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var xe=(n,e,t)=>fI(n,typeof e!="symbol"?e+"":e,t),U0=(n,e,t)=>e.has(n)||y2("Cannot "+t);var dt=(n,e,t)=>(U0(n,e,"read from private field"),t?t.call(n):e.get(n)),ri=(n,e,t)=>e.has(n)?y2("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),En=(n,e,t,i)=>(U0(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),hi=(n,e,t)=>(U0(n,e,"access private method"),t);var Ku=(n,e,t,i)=>({set _(r){En(n,e,r,t)},get _(){return dt(n,e,i)}});function Yie(){import.meta.url,import("_").catch(()=>1),async function*(){}().next()}(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)}})();/** * @vue/shared v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **//*! #__NO_SIDE_EFFECTS__ */function kv(n){const e=Object.create(null);for(const t of n.split(","))e[t]=1;return t=>t in e}const un={},Vc=[],Ws=()=>{},pI=()=>!1,Um=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&(n.charCodeAt(2)>122||n.charCodeAt(2)<97),Uv=n=>n.startsWith("onUpdate:"),Jn=Object.assign,zv=(n,e)=>{const t=n.indexOf(e);t>-1&&n.splice(t,1)},mI=Object.prototype.hasOwnProperty,Jt=(n,e)=>mI.call(n,e),yt=Array.isArray,Hc=n=>zm(n)==="[object Map]",IT=n=>zm(n)==="[object Set]",Ct=n=>typeof n=="function",wn=n=>typeof n=="string",Ba=n=>typeof n=="symbol",gn=n=>n!==null&&typeof n=="object",NT=n=>(gn(n)||Ct(n))&&Ct(n.then)&&Ct(n.catch),PT=Object.prototype.toString,zm=n=>PT.call(n),gI=n=>zm(n).slice(8,-1),LT=n=>zm(n)==="[object Object]",Vv=n=>wn(n)&&n!=="NaN"&&n[0]!=="-"&&""+parseInt(n,10)===n,Ed=kv(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Vm=n=>{const e=Object.create(null);return t=>e[t]||(e[t]=n(t))},yI=/-(\w)/g,ns=Vm(n=>n.replace(yI,(e,t)=>t?t.toUpperCase():"")),vI=/\B([A-Z])/g,Wl=Vm(n=>n.replace(vI,"-$1").toLowerCase()),Hm=Vm(n=>n.charAt(0).toUpperCase()+n.slice(1)),z0=Vm(n=>n?"on".concat(Hm(n)):""),Ra=(n,e)=>!Object.is(n,e),V0=(n,...e)=>{for(let t=0;t{Object.defineProperty(n,e,{configurable:!0,enumerable:!1,writable:i,value:t})},_I=n=>{const e=parseFloat(n);return isNaN(e)?n:e},xI=n=>{const e=wn(n)?Number(n):NaN;return isNaN(e)?n:e};let v2;const $m=()=>v2||(v2=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Qs(n){if(yt(n)){const e={};for(let t=0;t{if(t){const i=t.split(AI);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function Ks(n){let e="";if(wn(n))e=n;else if(yt(n))for(let t=0;t!!(n&&n.__v_isRef===!0),su=n=>wn(n)?n:n==null?"":yt(n)||gn(n)&&(n.toString===PT||!Ct(n.toString))?FT(n)?su(n.value):JSON.stringify(n,OT,2):String(n),OT=(n,e)=>FT(e)?OT(n,e.value):Hc(e)?{["Map(".concat(e.size,")")]:[...e.entries()].reduce((t,[i,r],s)=>(t[H0(i,s)+" =>"]=r,t),{})}:IT(e)?{["Set(".concat(e.size,")")]:[...e.values()].map(t=>H0(t))}:Ba(e)?H0(e):gn(e)&&!yt(e)&&!LT(e)?String(e):e,H0=(n,e="")=>{var t;return Ba(n)?"Symbol(".concat((t=n.description)!=null?t:e,")"):n};/** * @vue/reactivity v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/let Ri;class BT{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Ri,!e&&Ri&&(this.index=(Ri.scopes||(Ri.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e0&&--this._on===0&&(Ri=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,i;for(t=0,i=this.effects.length;t0)return;if(Rd){let e=Rd;for(Rd=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let n;for(;Md;){let e=Md;for(Md=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){n||(n=i)}e=t}}if(n)throw n}function HT(n){for(let e=n.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function $T(n){let e,t=n.depsTail,i=t;for(;i;){const r=i.prevDep;i.version===-1?(i===t&&(t=r),Wv(i),MI(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=r}n.deps=e,n.depsTail=t}function D1(n){for(let e=n.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(GT(e.dep.computed)||e.dep.version!==e.version))return!0;return!!n._dirty}function GT(n){if(n.flags&4&&!(n.flags&16)||(n.flags&=-17,n.globalVersion===Xd)||(n.globalVersion=Xd,!n.isSSR&&n.flags&128&&(!n.deps&&!n._dirty||!D1(n))))return;n.flags|=2;const e=n.dep,t=fn,i=vs;fn=n,vs=!0;try{HT(n);const r=n.fn(n._value);(e.version===0||Ra(r,n._value))&&(n.flags|=128,n._value=r,e.version++)}catch(r){throw e.version++,r}finally{fn=t,vs=i,$T(n),n.flags&=-3}}function Wv(n,e=!1){const{dep:t,prevSub:i,nextSub:r}=n;if(i&&(i.nextSub=r,n.prevSub=void 0),r&&(r.prevSub=i,n.nextSub=void 0),t.subs===n&&(t.subs=i,!i&&t.computed)){t.computed.flags&=-5;for(let s=t.computed.deps;s;s=s.nextDep)Wv(s,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function MI(n){const{prevDep:e,nextDep:t}=n;e&&(e.nextDep=t,n.prevDep=void 0),t&&(t.prevDep=e,n.nextDep=void 0)}let vs=!0;const WT=[];function $o(){WT.push(vs),vs=!1}function Go(){const n=WT.pop();vs=n===void 0?!0:n}function _2(n){const{cleanup:e}=n;if(n.cleanup=void 0,e){const t=fn;fn=void 0;try{e()}finally{fn=t}}}let Xd=0;class RI{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Qv{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!fn||!vs||fn===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==fn)t=this.activeLink=new RI(fn,this),fn.deps?(t.prevDep=fn.depsTail,fn.depsTail.nextDep=t,fn.depsTail=t):fn.deps=fn.depsTail=t,QT(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const i=t.nextDep;i.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=i),t.prevDep=fn.depsTail,t.nextDep=void 0,fn.depsTail.nextDep=t,fn.depsTail=t,fn.deps===t&&(fn.deps=i)}return t}trigger(e){this.version++,Xd++,this.notify(e)}notify(e){$v();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Gv()}}}function QT(n){if(n.dep.sc++,n.sub.flags&4){const e=n.dep.computed;if(e&&!n.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)QT(i)}const t=n.dep.subs;t!==n&&(n.prevSub=t,t&&(t.nextSub=n)),n.dep.subs=n}}const Qp=new WeakMap,Cl=Symbol(""),F1=Symbol(""),Kd=Symbol("");function Pi(n,e,t){if(vs&&fn){let i=Qp.get(n);i||Qp.set(n,i=new Map);let r=i.get(t);r||(i.set(t,r=new Qv),r.map=i,r.key=t),r.track()}}function No(n,e,t,i,r,s){const o=Qp.get(n);if(!o){Xd++;return}const a=l=>{l&&l.trigger()};if($v(),e==="clear")o.forEach(a);else{const l=yt(n),c=l&&Vv(t);if(l&&t==="length"){const u=Number(i);o.forEach((d,h)=>{(h==="length"||h===Kd||!Ba(h)&&h>=u)&&a(d)})}else switch((t!==void 0||o.has(void 0))&&a(o.get(t)),c&&a(o.get(Kd)),e){case"add":l?c&&a(o.get("length")):(a(o.get(Cl)),Hc(n)&&a(o.get(F1)));break;case"delete":l||(a(o.get(Cl)),Hc(n)&&a(o.get(F1)));break;case"set":Hc(n)&&a(o.get(Cl));break}}Gv()}function II(n,e){const t=Qp.get(n);return t&&t.get(e)}function Yl(n){const e=Ot(n);return e===n?e:(Pi(e,"iterate",Kd),Zr(n)?e:e.map(mi))}function Gm(n){return Pi(n=Ot(n),"iterate",Kd),n}const NI={__proto__:null,[Symbol.iterator](){return G0(this,Symbol.iterator,mi)},concat(...n){return Yl(this).concat(...n.map(e=>yt(e)?Yl(e):e))},entries(){return G0(this,"entries",n=>(n[1]=mi(n[1]),n))},every(n,e){return ho(this,"every",n,e,void 0,arguments)},filter(n,e){return ho(this,"filter",n,e,t=>t.map(mi),arguments)},find(n,e){return ho(this,"find",n,e,mi,arguments)},findIndex(n,e){return ho(this,"findIndex",n,e,void 0,arguments)},findLast(n,e){return ho(this,"findLast",n,e,mi,arguments)},findLastIndex(n,e){return ho(this,"findLastIndex",n,e,void 0,arguments)},forEach(n,e){return ho(this,"forEach",n,e,void 0,arguments)},includes(...n){return W0(this,"includes",n)},indexOf(...n){return W0(this,"indexOf",n)},join(n){return Yl(this).join(n)},lastIndexOf(...n){return W0(this,"lastIndexOf",n)},map(n,e){return ho(this,"map",n,e,void 0,arguments)},pop(){return Yu(this,"pop")},push(...n){return Yu(this,"push",n)},reduce(n,...e){return x2(this,"reduce",n,e)},reduceRight(n,...e){return x2(this,"reduceRight",n,e)},shift(){return Yu(this,"shift")},some(n,e){return ho(this,"some",n,e,void 0,arguments)},splice(...n){return Yu(this,"splice",n)},toReversed(){return Yl(this).toReversed()},toSorted(n){return Yl(this).toSorted(n)},toSpliced(...n){return Yl(this).toSpliced(...n)},unshift(...n){return Yu(this,"unshift",n)},values(){return G0(this,"values",mi)}};function G0(n,e,t){const i=Gm(n),r=i[e]();return i!==n&&!Zr(n)&&(r._next=r.next,r.next=()=>{const s=r._next();return s.value&&(s.value=t(s.value)),s}),r}const PI=Array.prototype;function ho(n,e,t,i,r,s){const o=Gm(n),a=o!==n&&!Zr(n),l=o[e];if(l!==PI[e]){const d=l.apply(n,s);return a?mi(d):d}let c=t;o!==n&&(a?c=function(d,h){return t.call(this,mi(d),h,n)}:t.length>2&&(c=function(d,h){return t.call(this,d,h,n)}));const u=l.call(o,c,i);return a&&r?r(u):u}function x2(n,e,t,i){const r=Gm(n);let s=t;return r!==n&&(Zr(n)?t.length>3&&(s=function(o,a,l){return t.call(this,o,a,l,n)}):s=function(o,a,l){return t.call(this,o,mi(a),l,n)}),r[e](s,...i)}function W0(n,e,t){const i=Ot(n);Pi(i,"iterate",Kd);const r=i[e](...t);return(r===-1||r===!1)&&Xv(t[0])?(t[0]=Ot(t[0]),i[e](...t)):r}function Yu(n,e,t=[]){$o(),$v();const i=Ot(n)[e].apply(n,t);return Gv(),Go(),i}const LI=kv("__proto__,__v_isRef,__isVue"),jT=new Set(Object.getOwnPropertyNames(Symbol).filter(n=>n!=="arguments"&&n!=="caller").map(n=>Symbol[n]).filter(Ba));function DI(n){Ba(n)||(n=String(n));const e=Ot(this);return Pi(e,"has",n),e.hasOwnProperty(n)}class qT{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,i){if(t==="__v_skip")return e.__v_skip;const r=this._isReadonly,s=this._isShallow;if(t==="__v_isReactive")return!r;if(t==="__v_isReadonly")return r;if(t==="__v_isShallow")return s;if(t==="__v_raw")return i===(r?s?GI:ZT:s?YT:KT).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const o=yt(e);if(!r){let l;if(o&&(l=NI[t]))return l;if(t==="hasOwnProperty")return DI}const a=Reflect.get(e,t,bn(e)?e:i);return(Ba(t)?jT.has(t):LI(t))||(r||Pi(e,"get",t),s)?a:bn(a)?o&&Vv(t)?a:a.value:gn(a)?r?JT(a):Ys(a):a}}class XT extends qT{constructor(e=!1){super(!1,e)}set(e,t,i,r){let s=e[t];if(!this._isShallow){const l=La(s);if(!Zr(i)&&!La(i)&&(s=Ot(s),i=Ot(i)),!yt(e)&&bn(s)&&!bn(i))return l?!1:(s.value=i,!0)}const o=yt(e)&&Vv(t)?Number(t)n,cf=n=>Reflect.getPrototypeOf(n);function UI(n,e,t){return function(...i){const r=this.__v_raw,s=Ot(r),o=Hc(s),a=n==="entries"||n===Symbol.iterator&&o,l=n==="keys"&&o,c=r[n](...i),u=t?O1:e?jp:mi;return!e&&Pi(s,"iterate",l?F1:Cl),{next(){const{value:d,done:h}=c.next();return h?{value:d,done:h}:{value:a?[u(d[0]),u(d[1])]:u(d),done:h}},[Symbol.iterator](){return this}}}}function uf(n){return function(...e){return n==="delete"?!1:n==="clear"?void 0:this}}function zI(n,e){const t={get(r){const s=this.__v_raw,o=Ot(s),a=Ot(r);n||(Ra(r,a)&&Pi(o,"get",r),Pi(o,"get",a));const{has:l}=cf(o),c=e?O1:n?jp:mi;if(l.call(o,r))return c(s.get(r));if(l.call(o,a))return c(s.get(a));s!==o&&s.get(r)},get size(){const r=this.__v_raw;return!n&&Pi(Ot(r),"iterate",Cl),Reflect.get(r,"size",r)},has(r){const s=this.__v_raw,o=Ot(s),a=Ot(r);return n||(Ra(r,a)&&Pi(o,"has",r),Pi(o,"has",a)),r===a?s.has(r):s.has(r)||s.has(a)},forEach(r,s){const o=this,a=o.__v_raw,l=Ot(a),c=e?O1:n?jp:mi;return!n&&Pi(l,"iterate",Cl),a.forEach((u,d)=>r.call(s,c(u),c(d),o))}};return Jn(t,n?{add:uf("add"),set:uf("set"),delete:uf("delete"),clear:uf("clear")}:{add(r){!e&&!Zr(r)&&!La(r)&&(r=Ot(r));const s=Ot(this);return cf(s).has.call(s,r)||(s.add(r),No(s,"add",r,r)),this},set(r,s){!e&&!Zr(s)&&!La(s)&&(s=Ot(s));const o=Ot(this),{has:a,get:l}=cf(o);let c=a.call(o,r);c||(r=Ot(r),c=a.call(o,r));const u=l.call(o,r);return o.set(r,s),c?Ra(s,u)&&No(o,"set",r,s):No(o,"add",r,s),this},delete(r){const s=Ot(this),{has:o,get:a}=cf(s);let l=o.call(s,r);l||(r=Ot(r),l=o.call(s,r)),a&&a.call(s,r);const c=s.delete(r);return l&&No(s,"delete",r,void 0),c},clear(){const r=Ot(this),s=r.size!==0,o=r.clear();return s&&No(r,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(r=>{t[r]=UI(r,n,e)}),t}function jv(n,e){const t=zI(n,e);return(i,r,s)=>r==="__v_isReactive"?!n:r==="__v_isReadonly"?n:r==="__v_raw"?i:Reflect.get(Jt(t,r)&&r in i?t:i,r,s)}const VI={get:jv(!1,!1)},HI={get:jv(!1,!0)},$I={get:jv(!0,!1)};const KT=new WeakMap,YT=new WeakMap,ZT=new WeakMap,GI=new WeakMap;function WI(n){switch(n){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function QI(n){return n.__v_skip||!Object.isExtensible(n)?0:WI(gI(n))}function Ys(n){return La(n)?n:qv(n,!1,OI,VI,KT)}function jI(n){return qv(n,!1,kI,HI,YT)}function JT(n){return qv(n,!0,BI,$I,ZT)}function qv(n,e,t,i,r){if(!gn(n)||n.__v_raw&&!(e&&n.__v_isReactive))return n;const s=QI(n);if(s===0)return n;const o=r.get(n);if(o)return o;const a=new Proxy(n,s===2?i:t);return r.set(n,a),a}function Uo(n){return La(n)?Uo(n.__v_raw):!!(n&&n.__v_isReactive)}function La(n){return!!(n&&n.__v_isReadonly)}function Zr(n){return!!(n&&n.__v_isShallow)}function Xv(n){return n?!!n.__v_raw:!1}function Ot(n){const e=n&&n.__v_raw;return e?Ot(e):n}function Kv(n){return!Jt(n,"__v_skip")&&Object.isExtensible(n)&&L1(n,"__v_skip",!0),n}const mi=n=>gn(n)?Ys(n):n,jp=n=>gn(n)?JT(n):n;function bn(n){return n?n.__v_isRef===!0:!1}function Dn(n){return ew(n,!1)}function Nr(n){return ew(n,!0)}function ew(n,e){return bn(n)?n:new qI(n,e)}class qI{constructor(e,t){this.dep=new Qv,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Ot(e),this._value=t?e:mi(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,i=this.__v_isShallow||Zr(e)||La(e);e=i?e:Ot(e),Ra(e,t)&&(this._rawValue=e,this._value=i?e:mi(e),this.dep.trigger())}}function XI(n){n.dep&&n.dep.trigger()}function We(n){return bn(n)?n.value:n}const KI={get:(n,e,t)=>e==="__v_raw"?n:We(Reflect.get(n,e,t)),set:(n,e,t,i)=>{const r=n[e];return bn(r)&&!bn(t)?(r.value=t,!0):Reflect.set(n,e,t,i)}};function tw(n){return Uo(n)?n:new Proxy(n,KI)}function YI(n){const e=yt(n)?new Array(n.length):{};for(const t in n)e[t]=nw(n,t);return e}class ZI{constructor(e,t,i){this._object=e,this._key=t,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return II(Ot(this._object),this._key)}}class JI{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function e8(n,e,t){return bn(n)?n:Ct(n)?new JI(n):gn(n)&&arguments.length>1?nw(n,e,t):Dn(n)}function nw(n,e,t){const i=n[e];return bn(i)?i:new ZI(n,e,t)}class t8{constructor(e,t,i){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Qv(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Xd-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&fn!==this)return VT(this,!0),!0}get value(){const e=this.dep.track();return GT(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function n8(n,e,t=!1){let i,r;return Ct(n)?i=n:(i=n.get,r=n.set),new t8(i,r,t)}const df={},qp=new WeakMap;let ul;function i8(n,e=!1,t=ul){if(t){let i=qp.get(t);i||qp.set(t,i=[]),i.push(n)}}function r8(n,e,t=un){const{immediate:i,deep:r,once:s,scheduler:o,augmentJob:a,call:l}=t,c=_=>r?_:Zr(_)||r===!1||r===0?Po(_,1):Po(_);let u,d,h,f,p=!1,g=!1;if(bn(n)?(d=()=>n.value,p=Zr(n)):Uo(n)?(d=()=>c(n),p=!0):yt(n)?(g=!0,p=n.some(_=>Uo(_)||Zr(_)),d=()=>n.map(_=>{if(bn(_))return _.value;if(Uo(_))return c(_);if(Ct(_))return l?l(_,2):_()})):Ct(n)?e?d=l?()=>l(n,2):n:d=()=>{if(h){$o();try{h()}finally{Go()}}const _=ul;ul=u;try{return l?l(n,3,[f]):n(f)}finally{ul=_}}:d=Ws,e&&r){const _=d,S=r===!0?1/0:r;d=()=>Po(_(),S)}const y=kT(),m=()=>{u.stop(),y&&y.active&&zv(y.effects,u)};if(s&&e){const _=e;e=(...S)=>{_(...S),m()}}let v=g?new Array(n.length).fill(df):df;const x=_=>{if(!(!(u.flags&1)||!u.dirty&&!_))if(e){const S=u.run();if(r||p||(g?S.some((E,A)=>Ra(E,v[A])):Ra(S,v))){h&&h();const E=ul;ul=u;try{const A=[S,v===df?void 0:g&&v[0]===df?[]:v,f];v=S,l?l(e,3,A):e(...A)}finally{ul=E}}}else u.run()};return a&&a(x),u=new UT(d),u.scheduler=o?()=>o(x,!1):x,f=_=>i8(_,!1,u),h=u.onStop=()=>{const _=qp.get(u);if(_){if(l)l(_,4);else for(const S of _)S();qp.delete(u)}},e?i?x(!0):v=u.run():o?o(x.bind(null,!0),!0):u.run(),m.pause=u.pause.bind(u),m.resume=u.resume.bind(u),m.stop=m,m}function Po(n,e=1/0,t){if(e<=0||!gn(n)||n.__v_skip||(t=t||new Set,t.has(n)))return n;if(t.add(n),e--,bn(n))Po(n.value,e,t);else if(yt(n))for(let i=0;i{Po(i,e,t)});else if(LT(n)){for(const i in n)Po(n[i],e,t);for(const i of Object.getOwnPropertySymbols(n))Object.prototype.propertyIsEnumerable.call(n,i)&&Po(n[i],e,t)}return n}/** * @vue/runtime-core v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/function Nh(n,e,t,i){try{return i?n(...i):n()}catch(r){Wm(r,e,t)}}function As(n,e,t,i){if(Ct(n)){const r=Nh(n,e,t,i);return r&&NT(r)&&r.catch(s=>{Wm(s,e,t)}),r}if(yt(n)){const r=[];for(let s=0;s>>1,r=Xi[i],s=Yd(r);s=Yd(t)?Xi.push(n):Xi.splice(o8(e),0,n),n.flags|=1,rw()}}function rw(){Xp||(Xp=iw.then(ow))}function a8(n){yt(n)?$c.push(...n):ga&&n.id===-1?ga.splice(Tc+1,0,n):n.flags&1||($c.push(n),n.flags|=1),rw()}function S2(n,e,t=Fs+1){for(;tYd(t)-Yd(i));if($c.length=0,ga){ga.push(...e);return}for(ga=e,Tc=0;Tcn.id==null?n.flags&2?-1:1/0:n.id;function ow(n){try{for(Fs=0;Fs{i._d&&D2(-1);const s=Kp(e);let o;try{o=n(...r)}finally{Kp(s),i._d&&D2(1)}return o};return i._n=!0,i._c=!0,i._d=!0,i}function Pc(n,e){if(Zi===null)return n;const t=Xm(Zi),i=n.dirs||(n.dirs=[]);for(let r=0;rn.__isTeleport,Id=n=>n&&(n.disabled||n.disabled===""),A2=n=>n&&(n.defer||n.defer===""),b2=n=>typeof SVGElement<"u"&&n instanceof SVGElement,T2=n=>typeof MathMLElement=="function"&&n instanceof MathMLElement,B1=(n,e)=>{const t=n&&n.to;return wn(t)?e?e(t):null:t},uw={name:"Teleport",__isTeleport:!0,process(n,e,t,i,r,s,o,a,l,c){const{mc:u,pc:d,pbc:h,o:{insert:f,querySelector:p,createText:g,createComment:y}}=c,m=Id(e.props);let{shapeFlag:v,children:x,dynamicChildren:_}=e;if(n==null){const S=e.el=g(""),E=e.anchor=g("");f(S,t,i),f(E,t,i);const A=(w,M)=>{v&16&&(r&&r.isCE&&(r.ce._teleportTarget=w),u(x,w,M,r,s,o,a,l))},R=()=>{const w=e.target=B1(e.props,p),M=hw(w,e,g,f);w&&(o!=="svg"&&b2(w)?o="svg":o!=="mathml"&&T2(w)&&(o="mathml"),m||(A(w,M),mp(e,!1)))};m&&(A(t,E),mp(e,!0)),A2(e.props)?(e.el.__isMounted=!1,ji(()=>{R(),delete e.el.__isMounted},s)):R()}else{if(A2(e.props)&&n.el.__isMounted===!1){ji(()=>{uw.process(n,e,t,i,r,s,o,a,l,c)},s);return}e.el=n.el,e.targetStart=n.targetStart;const S=e.anchor=n.anchor,E=e.target=n.target,A=e.targetAnchor=n.targetAnchor,R=Id(n.props),w=R?t:E,M=R?S:A;if(o==="svg"||b2(E)?o="svg":(o==="mathml"||T2(E))&&(o="mathml"),_?(h(n.dynamicChildren,_,w,r,s,o,a),n_(n,e,!0)):l||d(n,e,w,M,r,s,o,a,!1),m)R?e.props&&n.props&&e.props.to!==n.props.to&&(e.props.to=n.props.to):hf(e,t,S,c,1);else if((e.props&&e.props.to)!==(n.props&&n.props.to)){const I=e.target=B1(e.props,p);I&&hf(e,I,null,c,0)}else R&&hf(e,E,A,c,1);mp(e,m)}},remove(n,e,t,{um:i,o:{remove:r}},s){const{shapeFlag:o,children:a,anchor:l,targetStart:c,targetAnchor:u,target:d,props:h}=n;if(d&&(r(c),r(u)),s&&r(l),o&16){const f=s||!Id(h);for(let p=0;p{n.isMounted=!0}),Jv(()=>{n.isUnmounting=!0}),n}const Vr=[Function,Array],d8={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Vr,onEnter:Vr,onAfterEnter:Vr,onEnterCancelled:Vr,onBeforeLeave:Vr,onLeave:Vr,onAfterLeave:Vr,onLeaveCancelled:Vr,onBeforeAppear:Vr,onAppear:Vr,onAfterAppear:Vr,onAppearCancelled:Vr};function h8(n,e){const{leavingVNodes:t}=n;let i=t.get(e.type);return i||(i=Object.create(null),t.set(e.type,i)),i}function k1(n,e,t,i,r){const{appear:s,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:h,onLeave:f,onAfterLeave:p,onLeaveCancelled:g,onBeforeAppear:y,onAppear:m,onAfterAppear:v,onAppearCancelled:x}=e,_=String(n.key),S=h8(t,n),E=(w,M)=>{w&&As(w,i,9,M)},A=(w,M)=>{const I=M[1];E(w,M),yt(w)?w.every(L=>L.length<=1)&&I():w.length<=1&&I()},R={mode:o,persisted:a,beforeEnter(w){let M=l;if(!t.isMounted)if(s)M=y||l;else return;w[Zl]&&w[Zl](!0);const I=S[_];I&&wc(n,I)&&I.el[Zl]&&I.el[Zl](),E(M,[w])},enter(w){let M=c,I=u,L=d;if(!t.isMounted)if(s)M=m||c,I=v||u,L=x||d;else return;let k=!1;const T=w[ff]=F=>{k||(k=!0,F?E(L,[w]):E(I,[w]),R.delayedLeave&&R.delayedLeave(),w[ff]=void 0)};M?A(M,[w,T]):T()},leave(w,M){const I=String(n.key);if(w[ff]&&w[ff](!0),t.isUnmounting)return M();E(h,[w]);let L=!1;const k=w[Zl]=T=>{L||(L=!0,M(),T?E(g,[w]):E(p,[w]),w[Zl]=void 0,S[I]===n&&delete S[I])};S[I]=n,f?A(f,[w,k]):k()},clone(w){return k1(w,e,t,i)}};return R}function Zd(n,e){n.shapeFlag&6&&n.component?(n.transition=e,Zd(n.component.subTree,e)):n.shapeFlag&128?(n.ssContent.transition=e.clone(n.ssContent),n.ssFallback.transition=e.clone(n.ssFallback)):n.transition=e}function fw(n,e=!1,t){let i=[],r=0;for(let s=0;s1)for(let s=0;st.value,set:s=>t.value=s})}return t}function Nd(n,e,t,i,r=!1){if(yt(n)){n.forEach((p,g)=>Nd(p,e&&(yt(e)?e[g]:e),t,i,r));return}if(Pd(i)&&!r){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&Nd(n,e,t,i.component.subTree);return}const s=i.shapeFlag&4?Xm(i.component):i.el,o=r?null:s,{i:a,r:l}=n,c=e&&e.r,u=a.refs===un?a.refs={}:a.refs,d=a.setupState,h=Ot(d),f=d===un?()=>!1:p=>Jt(h,p);if(c!=null&&c!==l&&(wn(c)?(u[c]=null,f(c)&&(d[c]=null)):bn(c)&&(c.value=null)),Ct(l))Nh(l,a,12,[o,u]);else{const p=wn(l),g=bn(l);if(p||g){const y=()=>{if(n.f){const m=p?f(l)?d[l]:u[l]:l.value;r?yt(m)&&zv(m,s):yt(m)?m.includes(s)||m.push(s):p?(u[l]=[s],f(l)&&(d[l]=u[l])):(l.value=[s],n.k&&(u[n.k]=l.value))}else p?(u[l]=o,f(l)&&(d[l]=o)):g&&(l.value=o,n.k&&(u[n.k]=o))};o?(y.id=-1,ji(y,t)):y()}}}$m().requestIdleCallback;$m().cancelIdleCallback;const Pd=n=>!!n.type.__asyncLoader,mw=n=>n.type.__isKeepAlive;function f8(n,e){gw(n,"a",e)}function p8(n,e){gw(n,"da",e)}function gw(n,e,t=li){const i=n.__wdc||(n.__wdc=()=>{let r=t;for(;r;){if(r.isDeactivated)return;r=r.parent}return n()});if(Qm(e,i,t),t){let r=t.parent;for(;r&&r.parent;)mw(r.parent.vnode)&&m8(i,e,t,r),r=r.parent}}function m8(n,e,t,i){const r=Qm(e,n,i,!0);Lh(()=>{zv(i[e],r)},t)}function Qm(n,e,t=li,i=!1){if(t){const r=t[n]||(t[n]=[]),s=e.__weh||(e.__weh=(...o)=>{$o();const a=Dh(t),l=As(e,t,n,o);return a(),Go(),l});return i?r.unshift(s):r.push(s),s}}const ea=n=>(e,t=li)=>{(!th||n==="sp")&&Qm(n,(...i)=>e(...i),t)},yw=ea("bm"),ka=ea("m"),g8=ea("bu"),Zv=ea("u"),Jv=ea("bum"),Lh=ea("um"),y8=ea("sp"),v8=ea("rtg"),_8=ea("rtc");function x8(n,e=li){Qm("ec",n,e)}const vw="components",S8="directives",_w=Symbol.for("v-ndc");function A8(n){return wn(n)?xw(vw,n,!1)||n:n||_w}function b8(n){return xw(S8,n)}function xw(n,e,t=!0,i=!1){const r=Zi||li;if(r){const s=r.type;if(n===vw){const a=u9(s,!1);if(a&&(a===e||a===ns(e)||a===Hm(ns(e))))return s}const o=w2(r[n]||s[n],e)||w2(r.appContext[n],e);return!o&&i?s:o}}function w2(n,e){return n&&(n[e]||n[ns(e)]||n[Hm(ns(e))])}function Jd(n,e,t,i){let r;const s=t,o=yt(n);if(o||wn(n)){const a=o&&Uo(n);let l=!1,c=!1;a&&(l=!Zr(n),c=La(n),n=Gm(n)),r=new Array(n.length);for(let u=0,d=n.length;ue(a,l,void 0,s));else{const a=Object.keys(n);r=new Array(a.length);for(let l=0,c=a.length;ln?kw(n)?Xm(n):U1(n.parent):null,Ld=Jn(Object.create(null),{$:n=>n,$el:n=>n.vnode.el,$data:n=>n.data,$props:n=>n.props,$attrs:n=>n.attrs,$slots:n=>n.slots,$refs:n=>n.refs,$parent:n=>U1(n.parent),$root:n=>U1(n.root),$host:n=>n.ce,$emit:n=>n.emit,$options:n=>Aw(n),$forceUpdate:n=>n.f||(n.f=()=>{Yv(n.update)}),$nextTick:n=>n.n||(n.n=Ph.bind(n.proxy)),$watch:n=>W8.bind(n)}),Q0=(n,e)=>n!==un&&!n.__isScriptSetup&&Jt(n,e),T8={get({_:n},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:i,data:r,props:s,accessCache:o,type:a,appContext:l}=n;let c;if(e[0]!=="$"){const f=o[e];if(f!==void 0)switch(f){case 1:return i[e];case 2:return r[e];case 4:return t[e];case 3:return s[e]}else{if(Q0(i,e))return o[e]=1,i[e];if(r!==un&&Jt(r,e))return o[e]=2,r[e];if((c=n.propsOptions[0])&&Jt(c,e))return o[e]=3,s[e];if(t!==un&&Jt(t,e))return o[e]=4,t[e];z1&&(o[e]=0)}}const u=Ld[e];let d,h;if(u)return e==="$attrs"&&Pi(n.attrs,"get",""),u(n);if((d=a.__cssModules)&&(d=d[e]))return d;if(t!==un&&Jt(t,e))return o[e]=4,t[e];if(h=l.config.globalProperties,Jt(h,e))return h[e]},set({_:n},e,t){const{data:i,setupState:r,ctx:s}=n;return Q0(r,e)?(r[e]=t,!0):i!==un&&Jt(i,e)?(i[e]=t,!0):Jt(n.props,e)||e[0]==="$"&&e.slice(1)in n?!1:(s[e]=t,!0)},has({_:{data:n,setupState:e,accessCache:t,ctx:i,appContext:r,propsOptions:s}},o){let a;return!!t[o]||n!==un&&Jt(n,o)||Q0(e,o)||(a=s[0])&&Jt(a,o)||Jt(i,o)||Jt(Ld,o)||Jt(r.config.globalProperties,o)},defineProperty(n,e,t){return t.get!=null?n._.accessCache[e]=0:Jt(t,"value")&&this.set(n,e,t.value,null),Reflect.defineProperty(n,e,t)}};function C2(n){return yt(n)?n.reduce((e,t)=>(e[t]=null,e),{}):n}let z1=!0;function w8(n){const e=Aw(n),t=n.proxy,i=n.ctx;z1=!1,e.beforeCreate&&E2(e.beforeCreate,n,"bc");const{data:r,computed:s,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:d,mounted:h,beforeUpdate:f,updated:p,activated:g,deactivated:y,beforeDestroy:m,beforeUnmount:v,destroyed:x,unmounted:_,render:S,renderTracked:E,renderTriggered:A,errorCaptured:R,serverPrefetch:w,expose:M,inheritAttrs:I,components:L,directives:k,filters:T}=e;if(c&&C8(c,i,null),o)for(const Q in o){const ee=o[Q];Ct(ee)&&(i[Q]=ee.bind(t))}if(r){const Q=r.call(t,t);gn(Q)&&(n.data=Ys(Q))}if(z1=!0,s)for(const Q in s){const ee=s[Q],se=Ct(ee)?ee.bind(t,t):Ct(ee.get)?ee.get.bind(t,t):Ws,he=!Ct(ee)&&Ct(ee.set)?ee.set.bind(t):Ws,ie=Ge({get:se,set:he});Object.defineProperty(i,Q,{enumerable:!0,configurable:!0,get:()=>ie.value,set:re=>ie.value=re})}if(a)for(const Q in a)Sw(a[Q],i,t,Q);if(l){const Q=Ct(l)?l.call(t):l;Reflect.ownKeys(Q).forEach(ee=>{ta(ee,Q[ee])})}u&&E2(u,n,"c");function V(Q,ee){yt(ee)?ee.forEach(se=>Q(se.bind(t))):ee&&Q(ee.bind(t))}if(V(yw,d),V(ka,h),V(g8,f),V(Zv,p),V(f8,g),V(p8,y),V(x8,R),V(_8,E),V(v8,A),V(Jv,v),V(Lh,_),V(y8,w),yt(M))if(M.length){const Q=n.exposed||(n.exposed={});M.forEach(ee=>{Object.defineProperty(Q,ee,{get:()=>t[ee],set:se=>t[ee]=se})})}else n.exposed||(n.exposed={});S&&n.render===Ws&&(n.render=S),I!=null&&(n.inheritAttrs=I),L&&(n.components=L),k&&(n.directives=k),w&&pw(n)}function C8(n,e,t=Ws){yt(n)&&(n=V1(n));for(const i in n){const r=n[i];let s;gn(r)?"default"in r?s=Ji(r.from||i,r.default,!0):s=Ji(r.from||i):s=Ji(r),bn(s)?Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[i]=s}}function E2(n,e,t){As(yt(n)?n.map(i=>i.bind(e.proxy)):n.bind(e.proxy),e,t)}function Sw(n,e,t,i){let r=i.includes(".")?Lw(t,i):()=>t[i];if(wn(n)){const s=e[n];Ct(s)&&ci(r,s)}else if(Ct(n))ci(r,n.bind(t));else if(gn(n))if(yt(n))n.forEach(s=>Sw(s,e,t,i));else{const s=Ct(n.handler)?n.handler.bind(t):e[n.handler];Ct(s)&&ci(r,s,n)}}function Aw(n){const e=n.type,{mixins:t,extends:i}=e,{mixins:r,optionsCache:s,config:{optionMergeStrategies:o}}=n.appContext,a=s.get(e);let l;return a?l=a:!r.length&&!t&&!i?l=e:(l={},r.length&&r.forEach(c=>Zp(l,c,o,!0)),Zp(l,e,o)),gn(e)&&s.set(e,l),l}function Zp(n,e,t,i=!1){const{mixins:r,extends:s}=e;s&&Zp(n,s,t,!0),r&&r.forEach(o=>Zp(n,o,t,!0));for(const o in e)if(!(i&&o==="expose")){const a=E8[o]||t&&t[o];n[o]=a?a(n[o],e[o]):e[o]}return n}const E8={data:M2,props:R2,emits:R2,methods:Ad,computed:Ad,beforeCreate:$i,created:$i,beforeMount:$i,mounted:$i,beforeUpdate:$i,updated:$i,beforeDestroy:$i,beforeUnmount:$i,destroyed:$i,unmounted:$i,activated:$i,deactivated:$i,errorCaptured:$i,serverPrefetch:$i,components:Ad,directives:Ad,watch:R8,provide:M2,inject:M8};function M2(n,e){return e?n?function(){return Jn(Ct(n)?n.call(this,this):n,Ct(e)?e.call(this,this):e)}:e:n}function M8(n,e){return Ad(V1(n),V1(e))}function V1(n){if(yt(n)){const e={};for(let t=0;t1)return t&&Ct(e)?e.call(i&&i.proxy):e}}function P8(){return!!(li||Zi||El)}const Tw={},ww=()=>Object.create(Tw),Cw=n=>Object.getPrototypeOf(n)===Tw;function L8(n,e,t,i=!1){const r={},s=ww();n.propsDefaults=Object.create(null),Ew(n,e,r,s);for(const o in n.propsOptions[0])o in r||(r[o]=void 0);t?n.props=i?r:jI(r):n.type.props?n.props=r:n.props=s,n.attrs=s}function D8(n,e,t,i){const{props:r,attrs:s,vnode:{patchFlag:o}}=n,a=Ot(r),[l]=n.propsOptions;let c=!1;if((i||o>0)&&!(o&16)){if(o&8){const u=n.vnode.dynamicProps;for(let d=0;d{l=!0;const[h,f]=Mw(d,e,!0);Jn(o,h),f&&a.push(...f)};!t&&e.mixins.length&&e.mixins.forEach(u),n.extends&&u(n.extends),n.mixins&&n.mixins.forEach(u)}if(!s&&!l)return gn(n)&&i.set(n,Vc),Vc;if(yt(s))for(let u=0;un[0]==="_"||n==="$stable",t_=n=>yt(n)?n.map(ks):[ks(n)],O8=(n,e,t)=>{if(e._n)return e;const i=lw((...r)=>t_(e(...r)),t);return i._c=!1,i},Rw=(n,e,t)=>{const i=n._ctx;for(const r in n){if(e_(r))continue;const s=n[r];if(Ct(s))e[r]=O8(r,s,i);else if(s!=null){const o=t_(s);e[r]=()=>o}}},Iw=(n,e)=>{const t=t_(e);n.slots.default=()=>t},Nw=(n,e,t)=>{for(const i in e)(t||!e_(i))&&(n[i]=e[i])},B8=(n,e,t)=>{const i=n.slots=ww();if(n.vnode.shapeFlag&32){const r=e.__;r&&L1(i,"__",r,!0);const s=e._;s?(Nw(i,e,t),t&&L1(i,"_",s,!0)):Rw(e,i)}else e&&Iw(n,e)},k8=(n,e,t)=>{const{vnode:i,slots:r}=n;let s=!0,o=un;if(i.shapeFlag&32){const a=e._;a?t&&a===1?s=!1:Nw(r,e,t):(s=!e.$stable,Rw(e,r)),o=e}else e&&(Iw(n,e),o={default:1});if(s)for(const a in r)!e_(a)&&o[a]==null&&delete r[a]},ji=Z8;function U8(n){return z8(n)}function z8(n,e){const t=$m();t.__VUE__=!0;const{insert:i,remove:r,patchProp:s,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:d,nextSibling:h,setScopeId:f=Ws,insertStaticContent:p}=n,g=(te,ne,b,oe=null,J=null,H=null,P=void 0,U=null,j=!!ne.dynamicChildren)=>{if(te===ne)return;te&&!wc(te,ne)&&(oe=Ce(te),re(te,J,H,!0),te=null),ne.patchFlag===-2&&(j=!1,ne.dynamicChildren=null);const{type:B,ref:D,shapeFlag:W}=ne;switch(B){case Iu:y(te,ne,b,oe);break;case Zs:m(te,ne,b,oe);break;case gp:te==null&&v(ne,b,oe,P);break;case Hn:L(te,ne,b,oe,J,H,P,U,j);break;default:W&1?S(te,ne,b,oe,J,H,P,U,j):W&6?k(te,ne,b,oe,J,H,P,U,j):(W&64||W&128)&&B.process(te,ne,b,oe,J,H,P,U,j,Be)}D!=null&&J?Nd(D,te&&te.ref,H,ne||te,!ne):D==null&&te&&te.ref!=null&&Nd(te.ref,null,H,te,!0)},y=(te,ne,b,oe)=>{if(te==null)i(ne.el=a(ne.children),b,oe);else{const J=ne.el=te.el;ne.children!==te.children&&c(J,ne.children)}},m=(te,ne,b,oe)=>{te==null?i(ne.el=l(ne.children||""),b,oe):ne.el=te.el},v=(te,ne,b,oe)=>{[te.el,te.anchor]=p(te.children,ne,b,oe,te.el,te.anchor)},x=({el:te,anchor:ne},b,oe)=>{let J;for(;te&&te!==ne;)J=h(te),i(te,b,oe),te=J;i(ne,b,oe)},_=({el:te,anchor:ne})=>{let b;for(;te&&te!==ne;)b=h(te),r(te),te=b;r(ne)},S=(te,ne,b,oe,J,H,P,U,j)=>{ne.type==="svg"?P="svg":ne.type==="math"&&(P="mathml"),te==null?E(ne,b,oe,J,H,P,U,j):w(te,ne,J,H,P,U,j)},E=(te,ne,b,oe,J,H,P,U)=>{let j,B;const{props:D,shapeFlag:W,transition:G,dirs:X}=te;if(j=te.el=o(te.type,H,D&&D.is,D),W&8?u(j,te.children):W&16&&R(te.children,j,null,oe,J,j0(te,H),P,U),X&&qa(te,null,oe,"created"),A(j,te,te.scopeId,P,oe),D){for(const z in D)z!=="value"&&!Ed(z)&&s(j,z,null,D[z],H,oe);"value"in D&&s(j,"value",null,D.value,H),(B=D.onVnodeBeforeMount)&&Ms(B,oe,te)}X&&qa(te,null,oe,"beforeMount");const ue=V8(J,G);ue&&G.beforeEnter(j),i(j,ne,b),((B=D&&D.onVnodeMounted)||ue||X)&&ji(()=>{B&&Ms(B,oe,te),ue&&G.enter(j),X&&qa(te,null,oe,"mounted")},J)},A=(te,ne,b,oe,J)=>{if(b&&f(te,b),oe)for(let H=0;H{for(let B=j;B{const U=ne.el=te.el;let{patchFlag:j,dynamicChildren:B,dirs:D}=ne;j|=te.patchFlag&16;const W=te.props||un,G=ne.props||un;let X;if(b&&Xa(b,!1),(X=G.onVnodeBeforeUpdate)&&Ms(X,b,ne,te),D&&qa(ne,te,b,"beforeUpdate"),b&&Xa(b,!0),(W.innerHTML&&G.innerHTML==null||W.textContent&&G.textContent==null)&&u(U,""),B?M(te.dynamicChildren,B,U,b,oe,j0(ne,J),H):P||ee(te,ne,U,null,b,oe,j0(ne,J),H,!1),j>0){if(j&16)I(U,W,G,b,J);else if(j&2&&W.class!==G.class&&s(U,"class",null,G.class,J),j&4&&s(U,"style",W.style,G.style,J),j&8){const ue=ne.dynamicProps;for(let z=0;z{X&&Ms(X,b,ne,te),D&&qa(ne,te,b,"updated")},oe)},M=(te,ne,b,oe,J,H,P)=>{for(let U=0;U{if(ne!==b){if(ne!==un)for(const H in ne)!Ed(H)&&!(H in b)&&s(te,H,ne[H],null,J,oe);for(const H in b){if(Ed(H))continue;const P=b[H],U=ne[H];P!==U&&H!=="value"&&s(te,H,U,P,J,oe)}"value"in b&&s(te,"value",ne.value,b.value,J)}},L=(te,ne,b,oe,J,H,P,U,j)=>{const B=ne.el=te?te.el:a(""),D=ne.anchor=te?te.anchor:a("");let{patchFlag:W,dynamicChildren:G,slotScopeIds:X}=ne;X&&(U=U?U.concat(X):X),te==null?(i(B,b,oe),i(D,b,oe),R(ne.children||[],b,D,J,H,P,U,j)):W>0&&W&64&&G&&te.dynamicChildren?(M(te.dynamicChildren,G,b,J,H,P,U),(ne.key!=null||J&&ne===J.subTree)&&n_(te,ne,!0)):ee(te,ne,b,D,J,H,P,U,j)},k=(te,ne,b,oe,J,H,P,U,j)=>{ne.slotScopeIds=U,te==null?ne.shapeFlag&512?J.ctx.activate(ne,b,oe,P,j):T(ne,b,oe,J,H,P,j):F(te,ne,j)},T=(te,ne,b,oe,J,H,P)=>{const U=te.component=s9(te,oe,J);if(mw(te)&&(U.ctx.renderer=Be),o9(U,!1,P),U.asyncDep){if(J&&J.registerDep(U,V,P),!te.el){const j=U.subTree=Re(Zs);m(null,j,ne,b)}}else V(U,te,ne,b,J,H,P)},F=(te,ne,b)=>{const oe=ne.component=te.component;if(K8(te,ne,b))if(oe.asyncDep&&!oe.asyncResolved){Q(oe,ne,b);return}else oe.next=ne,oe.update();else ne.el=te.el,oe.vnode=ne},V=(te,ne,b,oe,J,H,P)=>{const U=()=>{if(te.isMounted){let{next:W,bu:G,u:X,parent:ue,vnode:z}=te;{const $=Pw(te);if($){W&&(W.el=z.el,Q(te,W,P)),$.asyncDep.then(()=>{te.isUnmounted||U()});return}}let C=W,N;Xa(te,!1),W?(W.el=z.el,Q(te,W,P)):W=z,G&&V0(G),(N=W.props&&W.props.onVnodeBeforeUpdate)&&Ms(N,ue,W,z),Xa(te,!0);const q=P2(te),Z=te.subTree;te.subTree=q,g(Z,q,d(Z.el),Ce(Z),te,J,H),W.el=q.el,C===null&&Y8(te,q.el),X&&ji(X,J),(N=W.props&&W.props.onVnodeUpdated)&&ji(()=>Ms(N,ue,W,z),J)}else{let W;const{el:G,props:X}=ne,{bm:ue,m:z,parent:C,root:N,type:q}=te,Z=Pd(ne);Xa(te,!1),ue&&V0(ue),!Z&&(W=X&&X.onVnodeBeforeMount)&&Ms(W,C,ne),Xa(te,!0);{N.ce&&N.ce._def.shadowRoot!==!1&&N.ce._injectChildStyle(q);const $=te.subTree=P2(te);g(null,$,b,oe,te,J,H),ne.el=$.el}if(z&&ji(z,J),!Z&&(W=X&&X.onVnodeMounted)){const $=ne;ji(()=>Ms(W,C,$),J)}(ne.shapeFlag&256||C&&Pd(C.vnode)&&C.vnode.shapeFlag&256)&&te.a&&ji(te.a,J),te.isMounted=!0,ne=b=oe=null}};te.scope.on();const j=te.effect=new UT(U);te.scope.off();const B=te.update=j.run.bind(j),D=te.job=j.runIfDirty.bind(j);D.i=te,D.id=te.uid,j.scheduler=()=>Yv(D),Xa(te,!0),B()},Q=(te,ne,b)=>{ne.component=te;const oe=te.vnode.props;te.vnode=ne,te.next=null,D8(te,ne.props,oe,b),k8(te,ne.children,b),$o(),S2(te),Go()},ee=(te,ne,b,oe,J,H,P,U,j=!1)=>{const B=te&&te.children,D=te?te.shapeFlag:0,W=ne.children,{patchFlag:G,shapeFlag:X}=ne;if(G>0){if(G&128){he(B,W,b,oe,J,H,P,U,j);return}else if(G&256){se(B,W,b,oe,J,H,P,U,j);return}}X&8?(D&16&&Te(B,J,H),W!==B&&u(b,W)):D&16?X&16?he(B,W,b,oe,J,H,P,U,j):Te(B,J,H,!0):(D&8&&u(b,""),X&16&&R(W,b,oe,J,H,P,U,j))},se=(te,ne,b,oe,J,H,P,U,j)=>{te=te||Vc,ne=ne||Vc;const B=te.length,D=ne.length,W=Math.min(B,D);let G;for(G=0;GD?Te(te,J,H,!0,!1,W):R(ne,b,oe,J,H,P,U,j,W)},he=(te,ne,b,oe,J,H,P,U,j)=>{let B=0;const D=ne.length;let W=te.length-1,G=D-1;for(;B<=W&&B<=G;){const X=te[B],ue=ne[B]=j?ya(ne[B]):ks(ne[B]);if(wc(X,ue))g(X,ue,b,null,J,H,P,U,j);else break;B++}for(;B<=W&&B<=G;){const X=te[W],ue=ne[G]=j?ya(ne[G]):ks(ne[G]);if(wc(X,ue))g(X,ue,b,null,J,H,P,U,j);else break;W--,G--}if(B>W){if(B<=G){const X=G+1,ue=XG)for(;B<=W;)re(te[B],J,H,!0),B++;else{const X=B,ue=B,z=new Map;for(B=ue;B<=G;B++){const Le=ne[B]=j?ya(ne[B]):ks(ne[B]);Le.key!=null&&z.set(Le.key,B)}let C,N=0;const q=G-ue+1;let Z=!1,$=0;const ae=new Array(q);for(B=0;B=q){re(Le,J,H,!0);continue}let Ve;if(Le.key!=null)Ve=z.get(Le.key);else for(C=ue;C<=G;C++)if(ae[C-ue]===0&&wc(Le,ne[C])){Ve=C;break}Ve===void 0?re(Le,J,H,!0):(ae[Ve-ue]=B+1,Ve>=$?$=Ve:Z=!0,g(Le,ne[Ve],b,null,J,H,P,U,j),N++)}const ke=Z?H8(ae):Vc;for(C=ke.length-1,B=q-1;B>=0;B--){const Le=ue+B,Ve=ne[Le],Je=Le+1{const{el:H,type:P,transition:U,children:j,shapeFlag:B}=te;if(B&6){ie(te.component.subTree,ne,b,oe);return}if(B&128){te.suspense.move(ne,b,oe);return}if(B&64){P.move(te,ne,b,Be);return}if(P===Hn){i(H,ne,b);for(let W=0;WU.enter(H),J);else{const{leave:W,delayLeave:G,afterLeave:X}=U,ue=()=>{te.ctx.isUnmounted?r(H):i(H,ne,b)},z=()=>{W(H,()=>{ue(),X&&X()})};G?G(H,ue,z):z()}else i(H,ne,b)},re=(te,ne,b,oe=!1,J=!1)=>{const{type:H,props:P,ref:U,children:j,dynamicChildren:B,shapeFlag:D,patchFlag:W,dirs:G,cacheIndex:X}=te;if(W===-2&&(J=!1),U!=null&&($o(),Nd(U,null,b,te,!0),Go()),X!=null&&(ne.renderCache[X]=void 0),D&256){ne.ctx.deactivate(te);return}const ue=D&1&&G,z=!Pd(te);let C;if(z&&(C=P&&P.onVnodeBeforeUnmount)&&Ms(C,ne,te),D&6)fe(te.component,b,oe);else{if(D&128){te.suspense.unmount(b,oe);return}ue&&qa(te,null,ne,"beforeUnmount"),D&64?te.type.remove(te,ne,b,Be,oe):B&&!B.hasOnce&&(H!==Hn||W>0&&W&64)?Te(B,ne,b,!1,!0):(H===Hn&&W&384||!J&&D&16)&&Te(j,ne,b),oe&&be(te)}(z&&(C=P&&P.onVnodeUnmounted)||ue)&&ji(()=>{C&&Ms(C,ne,te),ue&&qa(te,null,ne,"unmounted")},b)},be=te=>{const{type:ne,el:b,anchor:oe,transition:J}=te;if(ne===Hn){le(b,oe);return}if(ne===gp){_(te);return}const H=()=>{r(b),J&&!J.persisted&&J.afterLeave&&J.afterLeave()};if(te.shapeFlag&1&&J&&!J.persisted){const{leave:P,delayLeave:U}=J,j=()=>P(b,H);U?U(te.el,H,j):j()}else H()},le=(te,ne)=>{let b;for(;te!==ne;)b=h(te),r(te),te=b;r(ne)},fe=(te,ne,b)=>{const{bum:oe,scope:J,job:H,subTree:P,um:U,m:j,a:B,parent:D,slots:{__:W}}=te;N2(j),N2(B),oe&&V0(oe),D&&yt(W)&&W.forEach(G=>{D.renderCache[G]=void 0}),J.stop(),H&&(H.flags|=8,re(P,te,ne,b)),U&&ji(U,ne),ji(()=>{te.isUnmounted=!0},ne),ne&&ne.pendingBranch&&!ne.isUnmounted&&te.asyncDep&&!te.asyncResolved&&te.suspenseId===ne.pendingId&&(ne.deps--,ne.deps===0&&ne.resolve())},Te=(te,ne,b,oe=!1,J=!1,H=0)=>{for(let P=H;P{if(te.shapeFlag&6)return Ce(te.component.subTree);if(te.shapeFlag&128)return te.suspense.next();const ne=h(te.anchor||te.el),b=ne&&ne[cw];return b?h(b):ne};let Ie=!1;const ze=(te,ne,b)=>{te==null?ne._vnode&&re(ne._vnode,null,null,!0):g(ne._vnode||null,te,ne,null,null,null,b),ne._vnode=te,Ie||(Ie=!0,S2(),sw(),Ie=!1)},Be={p:g,um:re,m:ie,r:be,mt:T,mc:R,pc:ee,pbc:M,n:Ce,o:n};return{render:ze,hydrate:void 0,createApp:N8(ze)}}function j0({type:n,props:e},t){return t==="svg"&&n==="foreignObject"||t==="mathml"&&n==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function Xa({effect:n,job:e},t){t?(n.flags|=32,e.flags|=4):(n.flags&=-33,e.flags&=-5)}function V8(n,e){return(!n||n&&!n.pendingBranch)&&e&&!e.persisted}function n_(n,e,t=!1){const i=n.children,r=e.children;if(yt(i)&&yt(r))for(let s=0;s>1,n[t[a]]0&&(e[i]=t[s-1]),t[s]=i)}}for(s=t.length,o=t[s-1];s-- >0;)t[s]=o,o=e[o];return t}function Pw(n){const e=n.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Pw(e)}function N2(n){if(n)for(let e=0;eJi($8);function jm(n,e){return i_(n,null,e)}function ci(n,e,t){return i_(n,e,t)}function i_(n,e,t=un){const{immediate:i,deep:r,flush:s,once:o}=t,a=Jn({},t),l=e&&i||!e&&s!=="post";let c;if(th){if(s==="sync"){const f=G8();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Ws,f.resume=Ws,f.pause=Ws,f}}const u=li;a.call=(f,p,g)=>As(f,u,p,g);let d=!1;s==="post"?a.scheduler=f=>{ji(f,u&&u.suspense)}:s!=="sync"&&(d=!0,a.scheduler=(f,p)=>{p?f():Yv(f)}),a.augmentJob=f=>{e&&(f.flags|=4),d&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const h=r8(n,e,a);return th&&(c?c.push(h):l&&h()),h}function W8(n,e,t){const i=this.proxy,r=wn(n)?n.includes(".")?Lw(i,n):()=>i[n]:n.bind(i,i);let s;Ct(e)?s=e:(s=e.handler,t=e);const o=Dh(this),a=i_(r,s.bind(i),t);return o(),a}function Lw(n,e){const t=e.split(".");return()=>{let i=n;for(let r=0;re==="modelValue"||e==="model-value"?n.modelModifiers:n["".concat(e,"Modifiers")]||n["".concat(ns(e),"Modifiers")]||n["".concat(Wl(e),"Modifiers")];function j8(n,e,...t){if(n.isUnmounted)return;const i=n.vnode.props||un;let r=t;const s=e.startsWith("update:"),o=s&&Q8(i,e.slice(7));o&&(o.trim&&(r=t.map(u=>wn(u)?u.trim():u)),o.number&&(r=t.map(_I)));let a,l=i[a=z0(e)]||i[a=z0(ns(e))];!l&&s&&(l=i[a=z0(Wl(e))]),l&&As(l,n,6,r);const c=i[a+"Once"];if(c){if(!n.emitted)n.emitted={};else if(n.emitted[a])return;n.emitted[a]=!0,As(c,n,6,r)}}function Dw(n,e,t=!1){const i=e.emitsCache,r=i.get(n);if(r!==void 0)return r;const s=n.emits;let o={},a=!1;if(!Ct(n)){const l=c=>{const u=Dw(c,e,!0);u&&(a=!0,Jn(o,u))};!t&&e.mixins.length&&e.mixins.forEach(l),n.extends&&l(n.extends),n.mixins&&n.mixins.forEach(l)}return!s&&!a?(gn(n)&&i.set(n,null),null):(yt(s)?s.forEach(l=>o[l]=null):Jn(o,s),gn(n)&&i.set(n,o),o)}function qm(n,e){return!n||!Um(e)?!1:(e=e.slice(2).replace(/Once$/,""),Jt(n,e[0].toLowerCase()+e.slice(1))||Jt(n,Wl(e))||Jt(n,e))}function P2(n){const{type:e,vnode:t,proxy:i,withProxy:r,propsOptions:[s],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:d,data:h,setupState:f,ctx:p,inheritAttrs:g}=n,y=Kp(n);let m,v;try{if(t.shapeFlag&4){const _=r||i,S=_;m=ks(c.call(S,_,u,d,f,h,p)),v=a}else{const _=e;m=ks(_.length>1?_(d,{attrs:a,slots:o,emit:l}):_(d,null)),v=e.props?a:q8(a)}}catch(_){Dd.length=0,Wm(_,n,1),m=Re(Zs)}let x=m;if(v&&g!==!1){const _=Object.keys(v),{shapeFlag:S}=x;_.length&&S&7&&(s&&_.some(Uv)&&(v=X8(v,s)),x=Ol(x,v,!1,!0))}return t.dirs&&(x=Ol(x,null,!1,!0),x.dirs=x.dirs?x.dirs.concat(t.dirs):t.dirs),t.transition&&Zd(x,t.transition),m=x,Kp(y),m}const q8=n=>{let e;for(const t in n)(t==="class"||t==="style"||Um(t))&&((e||(e={}))[t]=n[t]);return e},X8=(n,e)=>{const t={};for(const i in n)(!Uv(i)||!(i.slice(9)in e))&&(t[i]=n[i]);return t};function K8(n,e,t){const{props:i,children:r,component:s}=n,{props:o,children:a,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&l>=0){if(l&1024)return!0;if(l&16)return i?L2(i,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let d=0;dn.__isSuspense;function Z8(n,e){e&&e.pendingBranch?yt(n)?e.effects.push(...n):e.effects.push(n):a8(n)}const Hn=Symbol.for("v-fgt"),Iu=Symbol.for("v-txt"),Zs=Symbol.for("v-cmt"),gp=Symbol.for("v-stc"),Dd=[];let Mr=null;function ft(n=!1){Dd.push(Mr=n?null:[])}function J8(){Dd.pop(),Mr=Dd[Dd.length-1]||null}let eh=1;function D2(n,e=!1){eh+=n,n<0&&Mr&&e&&(Mr.hasOnce=!0)}function Ow(n){return n.dynamicChildren=eh>0?Mr||Vc:null,J8(),eh>0&&Mr&&Mr.push(n),n}function xt(n,e,t,i,r,s){return Ow(zt(n,e,t,i,r,s,!0))}function ou(n,e,t,i,r){return Ow(Re(n,e,t,i,r,!0))}function Jp(n){return n?n.__v_isVNode===!0:!1}function wc(n,e){return n.type===e.type&&n.key===e.key}const Bw=({key:n})=>n!=null?n:null,yp=({ref:n,ref_key:e,ref_for:t})=>(typeof n=="number"&&(n=""+n),n!=null?wn(n)||bn(n)||Ct(n)?{i:Zi,r:n,k:e,f:!!t}:n:null);function zt(n,e=null,t=null,i=0,r=null,s=n===Hn?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:n,props:e,key:e&&Bw(e),ref:e&&yp(e),scopeId:aw,slotScopeIds:null,children:t,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:i,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Zi};return a?(r_(l,t),s&128&&n.normalize(l)):t&&(l.shapeFlag|=wn(t)?8:16),eh>0&&!o&&Mr&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&Mr.push(l),l}const Re=e9;function e9(n,e=null,t=null,i=0,r=null,s=!1){if((!n||n===_w)&&(n=Zs),Jp(n)){const a=Ol(n,e,!0);return t&&r_(a,t),eh>0&&!s&&Mr&&(a.shapeFlag&6?Mr[Mr.indexOf(n)]=a:Mr.push(a)),a.patchFlag=-2,a}if(d9(n)&&(n=n.__vccOpts),e){e=t9(e);let{class:a,style:l}=e;a&&!wn(a)&&(e.class=Ks(a)),gn(l)&&(Xv(l)&&!yt(l)&&(l=Jn({},l)),e.style=Qs(l))}const o=wn(n)?1:Fw(n)?128:l8(n)?64:gn(n)?4:Ct(n)?2:0;return zt(n,e,t,i,r,o,s,!0)}function t9(n){return n?Xv(n)||Cw(n)?Jn({},n):n:null}function Ol(n,e,t=!1,i=!1){const{props:r,ref:s,patchFlag:o,children:a,transition:l}=n,c=e?n9(r||{},e):r,u={__v_isVNode:!0,__v_skip:!0,type:n.type,props:c,key:c&&Bw(c),ref:e&&e.ref?t&&s?yt(s)?s.concat(yp(e)):[s,yp(e)]:yp(e):s,scopeId:n.scopeId,slotScopeIds:n.slotScopeIds,children:a,target:n.target,targetStart:n.targetStart,targetAnchor:n.targetAnchor,staticCount:n.staticCount,shapeFlag:n.shapeFlag,patchFlag:e&&n.type!==Hn?o===-1?16:o|16:o,dynamicProps:n.dynamicProps,dynamicChildren:n.dynamicChildren,appContext:n.appContext,dirs:n.dirs,transition:l,component:n.component,suspense:n.suspense,ssContent:n.ssContent&&Ol(n.ssContent),ssFallback:n.ssFallback&&Ol(n.ssFallback),el:n.el,anchor:n.anchor,ctx:n.ctx,ce:n.ce};return l&&i&&Zd(u,l.clone(u)),u}function em(n=" ",e=0){return Re(Iu,null,n,e)}function Nu(n,e){const t=Re(gp,null,n);return t.staticCount=e,t}function br(n="",e=!1){return e?(ft(),ou(Zs,null,n)):Re(Zs,null,n)}function ks(n){return n==null||typeof n=="boolean"?Re(Zs):yt(n)?Re(Hn,null,n.slice()):Jp(n)?ya(n):Re(Iu,null,String(n))}function ya(n){return n.el===null&&n.patchFlag!==-1||n.memo?n:Ol(n)}function r_(n,e){let t=0;const{shapeFlag:i}=n;if(e==null)e=null;else if(yt(e))t=16;else if(typeof e=="object")if(i&65){const r=e.default;r&&(r._c&&(r._d=!1),r_(n,r()),r._c&&(r._d=!0));return}else{t=32;const r=e._;!r&&!Cw(e)?e._ctx=Zi:r===3&&Zi&&(Zi.slots._===1?e._=1:(e._=2,n.patchFlag|=1024))}else Ct(e)?(e={default:e,_ctx:Zi},t=32):(e=String(e),i&64?(t=16,e=[em(e)]):t=8);n.children=e,n.shapeFlag|=t}function n9(...n){const e={};for(let t=0;tli||Zi;let tm,$1;{const n=$m(),e=(t,i)=>{let r;return(r=n[t])||(r=n[t]=[]),r.push(i),s=>{r.length>1?r.forEach(o=>o(s)):r[0](s)}};tm=e("__VUE_INSTANCE_SETTERS__",t=>li=t),$1=e("__VUE_SSR_SETTERS__",t=>th=t)}const Dh=n=>{const e=li;return tm(n),n.scope.on(),()=>{n.scope.off(),tm(e)}},F2=()=>{li&&li.scope.off(),tm(null)};function kw(n){return n.vnode.shapeFlag&4}let th=!1;function o9(n,e=!1,t=!1){e&&$1(e);const{props:i,children:r}=n.vnode,s=kw(n);L8(n,i,s,e),B8(n,r,t||e);const o=s?a9(n,e):void 0;return e&&$1(!1),o}function a9(n,e){const t=n.type;n.accessCache=Object.create(null),n.proxy=new Proxy(n.ctx,T8);const{setup:i}=t;if(i){$o();const r=n.setupContext=i.length>1?c9(n):null,s=Dh(n),o=Nh(i,n,0,[n.props,r]),a=NT(o);if(Go(),s(),(a||n.sp)&&!Pd(n)&&pw(n),a){if(o.then(F2,F2),e)return o.then(l=>{O2(n,l)}).catch(l=>{Wm(l,n,0)});n.asyncDep=o}else O2(n,o)}else Uw(n)}function O2(n,e,t){Ct(e)?n.type.__ssrInlineRender?n.ssrRender=e:n.render=e:gn(e)&&(n.setupState=tw(e)),Uw(n)}function Uw(n,e,t){const i=n.type;n.render||(n.render=i.render||Ws);{const r=Dh(n);$o();try{w8(n)}finally{Go(),r()}}}const l9={get(n,e){return Pi(n,"get",""),n[e]}};function c9(n){const e=t=>{n.exposed=t||{}};return{attrs:new Proxy(n.attrs,l9),slots:n.slots,emit:n.emit,expose:e}}function Xm(n){return n.exposed?n.exposeProxy||(n.exposeProxy=new Proxy(tw(Kv(n.exposed)),{get(e,t){if(t in e)return e[t];if(t in Ld)return Ld[t](n)},has(e,t){return t in e||t in Ld}})):n.proxy}function u9(n,e=!0){return Ct(n)?n.displayName||n.name:n.name||e&&n.__name}function d9(n){return Ct(n)&&"__vccOpts"in n}const Ge=(n,e)=>n8(n,e,th);function Da(n,e,t){const i=arguments.length;return i===2?gn(e)&&!yt(e)?Jp(e)?Re(n,null,[e]):Re(n,e):Re(n,null,e):(i>3?t=Array.prototype.slice.call(arguments,2):i===3&&Jp(t)&&(t=[t]),Re(n,e,t))}const h9="3.5.17";/** * @vue/runtime-dom v3.5.17 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/let G1;const B2=typeof window<"u"&&window.trustedTypes;if(B2)try{G1=B2.createPolicy("vue",{createHTML:n=>n})}catch(n){}const zw=G1?n=>G1.createHTML(n):n=>n,f9="http://www.w3.org/2000/svg",p9="http://www.w3.org/1998/Math/MathML",bo=typeof document<"u"?document:null,k2=bo&&bo.createElement("template"),m9={insert:(n,e,t)=>{e.insertBefore(n,t||null)},remove:n=>{const e=n.parentNode;e&&e.removeChild(n)},createElement:(n,e,t,i)=>{const r=e==="svg"?bo.createElementNS(f9,n):e==="mathml"?bo.createElementNS(p9,n):t?bo.createElement(n,{is:t}):bo.createElement(n);return n==="select"&&i&&i.multiple!=null&&r.setAttribute("multiple",i.multiple),r},createText:n=>bo.createTextNode(n),createComment:n=>bo.createComment(n),setText:(n,e)=>{n.nodeValue=e},setElementText:(n,e)=>{n.textContent=e},parentNode:n=>n.parentNode,nextSibling:n=>n.nextSibling,querySelector:n=>bo.querySelector(n),setScopeId(n,e){n.setAttribute(e,"")},insertStaticContent(n,e,t,i,r,s){const o=t?t.previousSibling:e.lastChild;if(r&&(r===s||r.nextSibling))for(;e.insertBefore(r.cloneNode(!0),t),!(r===s||!(r=r.nextSibling)););else{k2.innerHTML=zw(i==="svg"?"".concat(n,""):i==="mathml"?"".concat(n,""):n);const a=k2.content;if(i==="svg"||i==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},ia="transition",Zu="animation",au=Symbol("_vtc"),Vw={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},g9=Jn({},d8,Vw),Ka=(n,e=[])=>{yt(n)?n.forEach(t=>t(...e)):n&&n(...e)},U2=n=>n?yt(n)?n.some(e=>e.length>1):n.length>1:!1;function y9(n){const e={};for(const L in n)L in Vw||(e[L]=n[L]);if(n.css===!1)return e;const{name:t="v",type:i,duration:r,enterFromClass:s="".concat(t,"-enter-from"),enterActiveClass:o="".concat(t,"-enter-active"),enterToClass:a="".concat(t,"-enter-to"),appearFromClass:l=s,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:d="".concat(t,"-leave-from"),leaveActiveClass:h="".concat(t,"-leave-active"),leaveToClass:f="".concat(t,"-leave-to")}=n,p=v9(r),g=p&&p[0],y=p&&p[1],{onBeforeEnter:m,onEnter:v,onEnterCancelled:x,onLeave:_,onLeaveCancelled:S,onBeforeAppear:E=m,onAppear:A=v,onAppearCancelled:R=x}=e,w=(L,k,T,F)=>{L._enterCancelled=F,fa(L,k?u:a),fa(L,k?c:o),T&&T()},M=(L,k)=>{L._isLeaving=!1,fa(L,d),fa(L,f),fa(L,h),k&&k()},I=L=>(k,T)=>{const F=L?A:v,V=()=>w(k,L,T);Ka(F,[k,V]),z2(()=>{fa(k,L?l:s),Ls(k,L?u:a),U2(F)||V2(k,i,g,V)})};return Jn(e,{onBeforeEnter(L){Ka(m,[L]),Ls(L,s),Ls(L,o)},onBeforeAppear(L){Ka(E,[L]),Ls(L,l),Ls(L,c)},onEnter:I(!1),onAppear:I(!0),onLeave(L,k){L._isLeaving=!0;const T=()=>M(L,k);Ls(L,d),L._enterCancelled?(Ls(L,h),W1()):(W1(),Ls(L,h)),z2(()=>{L._isLeaving&&(fa(L,d),Ls(L,f),U2(_)||V2(L,i,y,T))}),Ka(_,[L,T])},onEnterCancelled(L){w(L,!1,void 0,!0),Ka(x,[L])},onAppearCancelled(L){w(L,!0,void 0,!0),Ka(R,[L])},onLeaveCancelled(L){M(L),Ka(S,[L])}})}function v9(n){if(n==null)return null;if(gn(n))return[q0(n.enter),q0(n.leave)];{const e=q0(n);return[e,e]}}function q0(n){return xI(n)}function Ls(n,e){e.split(/\s+/).forEach(t=>t&&n.classList.add(t)),(n[au]||(n[au]=new Set)).add(e)}function fa(n,e){e.split(/\s+/).forEach(i=>i&&n.classList.remove(i));const t=n[au];t&&(t.delete(e),t.size||(n[au]=void 0))}function z2(n){requestAnimationFrame(()=>{requestAnimationFrame(n)})}let _9=0;function V2(n,e,t,i){const r=n._endId=++_9,s=()=>{r===n._endId&&i()};if(t!=null)return setTimeout(s,t);const{type:o,timeout:a,propCount:l}=Hw(n,e);if(!o)return i();const c=o+"end";let u=0;const d=()=>{n.removeEventListener(c,h),s()},h=f=>{f.target===n&&++u>=l&&d()};setTimeout(()=>{u(t[p]||"").split(", "),r=i("".concat(ia,"Delay")),s=i("".concat(ia,"Duration")),o=H2(r,s),a=i("".concat(Zu,"Delay")),l=i("".concat(Zu,"Duration")),c=H2(a,l);let u=null,d=0,h=0;e===ia?o>0&&(u=ia,d=o,h=s.length):e===Zu?c>0&&(u=Zu,d=c,h=l.length):(d=Math.max(o,c),u=d>0?o>c?ia:Zu:null,h=u?u===ia?s.length:l.length:0);const f=u===ia&&/\b(transform|all)(,|$)/.test(i("".concat(ia,"Property")).toString());return{type:u,timeout:d,propCount:h,hasTransform:f}}function H2(n,e){for(;n.length$2(t)+$2(n[i])))}function $2(n){return n==="auto"?0:Number(n.slice(0,-1).replace(",","."))*1e3}function W1(){return document.body.offsetHeight}function x9(n,e,t){const i=n[au];i&&(e=(e?[e,...i]:[...i]).join(" ")),e==null?n.removeAttribute("class"):t?n.setAttribute("class",e):n.className=e}const nm=Symbol("_vod"),$w=Symbol("_vsh"),im={beforeMount(n,{value:e},{transition:t}){n[nm]=n.style.display==="none"?"":n.style.display,t&&e?t.beforeEnter(n):Ju(n,e)},mounted(n,{value:e},{transition:t}){t&&e&&t.enter(n)},updated(n,{value:e,oldValue:t},{transition:i}){!e!=!t&&(i?e?(i.beforeEnter(n),Ju(n,!0),i.enter(n)):i.leave(n,()=>{Ju(n,!1)}):Ju(n,e))},beforeUnmount(n,{value:e}){Ju(n,e)}};function Ju(n,e){n.style.display=e?n[nm]:"none",n[$w]=!e}const S9=Symbol(""),A9=/(^|;)\s*display\s*:/;function b9(n,e,t){const i=n.style,r=wn(t);let s=!1;if(t&&!r){if(e)if(wn(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();t[a]==null&&vp(i,a,"")}else for(const o in e)t[o]==null&&vp(i,o,"");for(const o in t)o==="display"&&(s=!0),vp(i,o,t[o])}else if(r){if(e!==t){const o=i[S9];o&&(t+=";"+o),i.cssText=t,s=A9.test(t)}}else e&&n.removeAttribute("style");nm in n&&(n[nm]=s?i.display:"",n[$w]&&(i.display="none"))}const G2=/\s*!important$/;function vp(n,e,t){if(yt(t))t.forEach(i=>vp(n,e,i));else if(t==null&&(t=""),e.startsWith("--"))n.setProperty(e,t);else{const i=T9(n,e);G2.test(t)?n.setProperty(Wl(i),t.replace(G2,""),"important"):n[i]=t}}const W2=["Webkit","Moz","ms"],X0={};function T9(n,e){const t=X0[e];if(t)return t;let i=ns(e);if(i!=="filter"&&i in n)return X0[e]=i;i=Hm(i);for(let r=0;rK0||(R9.then(()=>K0=0),K0=Date.now());function N9(n,e){const t=i=>{if(!i._vts)i._vts=Date.now();else if(i._vts<=t.attached)return;As(P9(i,t.value),e,5,[i])};return t.value=n,t.attached=I9(),t}function P9(n,e){if(yt(e)){const t=n.stopImmediatePropagation;return n.stopImmediatePropagation=()=>{t.call(n),n._stopped=!0},e.map(i=>r=>!r._stopped&&i&&i(r))}else return e}const Y2=n=>n.charCodeAt(0)===111&&n.charCodeAt(1)===110&&n.charCodeAt(2)>96&&n.charCodeAt(2)<123,L9=(n,e,t,i,r,s)=>{const o=r==="svg";e==="class"?x9(n,i,o):e==="style"?b9(n,t,i):Um(e)?Uv(e)||E9(n,e,t,i,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):D9(n,e,i,o))?(q2(n,e,i),!n.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&j2(n,e,i,o,s,e!=="value")):n._isVueCE&&(/[A-Z]/.test(e)||!wn(i))?q2(n,ns(e),i,s,e):(e==="true-value"?n._trueValue=i:e==="false-value"&&(n._falseValue=i),j2(n,e,i,o))};function D9(n,e,t,i){if(i)return!!(e==="innerHTML"||e==="textContent"||e in n&&Y2(e)&&Ct(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&n.tagName==="INPUT"||e==="type"&&n.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const r=n.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Y2(e)&&wn(t)?!1:e in n}const Gw=new WeakMap,Ww=new WeakMap,rm=Symbol("_moveCb"),Z2=Symbol("_enterCb"),F9=n=>(delete n.props.mode,n),O9=F9({name:"TransitionGroup",props:Jn({},g9,{tag:String,moveClass:String}),setup(n,{slots:e}){const t=Wo(),i=u8();let r,s;return Zv(()=>{if(!r.length)return;const o=n.moveClass||"".concat(n.name||"v","-move");if(!z9(r[0].el,t.vnode.el,o)){r=[];return}r.forEach(B9),r.forEach(k9);const a=r.filter(U9);W1(),a.forEach(l=>{const c=l.el,u=c.style;Ls(c,o),u.transform=u.webkitTransform=u.transitionDuration="";const d=c[rm]=h=>{h&&h.target!==c||(!h||/transform$/.test(h.propertyName))&&(c.removeEventListener("transitionend",d),c[rm]=null,fa(c,o))};c.addEventListener("transitionend",d)}),r=[]}),()=>{const o=Ot(n),a=y9(o);let l=o.tag||Hn;if(r=[],s)for(let c=0;c{a.split(/\s+/).forEach(l=>l&&i.classList.remove(l))}),t.split(/\s+/).forEach(a=>a&&i.classList.add(a)),i.style.display="none";const s=e.nodeType===1?e:e.parentNode;s.appendChild(i);const{hasTransform:o}=Hw(i);return s.removeChild(i),o}const V9=["ctrl","shift","alt","meta"],H9={stop:n=>n.stopPropagation(),prevent:n=>n.preventDefault(),self:n=>n.target!==n.currentTarget,ctrl:n=>!n.ctrlKey,shift:n=>!n.shiftKey,alt:n=>!n.altKey,meta:n=>!n.metaKey,left:n=>"button"in n&&n.button!==0,middle:n=>"button"in n&&n.button!==1,right:n=>"button"in n&&n.button!==2,exact:(n,e)=>V9.some(t=>n["".concat(t,"Key")]&&!e.includes(t))},pf=(n,e)=>{const t=n._withMods||(n._withMods={}),i=e.join(".");return t[i]||(t[i]=(r,...s)=>{for(let o=0;o{jw().render(...n)},G9=(...n)=>{const e=jw().createApp(...n),{mount:t}=e;return e.mount=i=>{const r=Q9(i);if(!r)return;const s=e._component;!Ct(s)&&!s.render&&!s.template&&(s.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=t(r,!1,W9(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},e};function W9(n){if(n instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&n instanceof MathMLElement)return"mathml"}function Q9(n){return wn(n)?document.querySelector(n):n}/*! * pinia v3.0.3 * (c) 2025 Eduardo San Martin Morote * @license MIT */let qw;const Km=n=>qw=n,Xw=Symbol();function Q1(n){return n&&typeof n=="object"&&Object.prototype.toString.call(n)==="[object Object]"&&typeof n.toJSON!="function"}var Fd;(function(n){n.direct="direct",n.patchObject="patch object",n.patchFunction="patch function"})(Fd||(Fd={}));function j9(){const n=Hv(!0),e=n.run(()=>Dn({}));let t=[],i=[];const r=Kv({install(s){Km(r),r._a=s,s.provide(Xw,r),s.config.globalProperties.$pinia=r,i.forEach(o=>t.push(o)),i=[]},use(s){return this._a?t.push(s):i.push(s),this},_p:t,_a:null,_e:n,_s:new Map,state:e});return r}const Kw=()=>{};function tS(n,e,t,i=Kw){n.push(e);const r=()=>{const s=n.indexOf(e);s>-1&&(n.splice(s,1),i())};return!t&&kT()&&EI(r),r}function Jl(n,...e){n.slice().forEach(t=>{t(...e)})}const q9=n=>n(),nS=Symbol(),Y0=Symbol();function j1(n,e){n instanceof Map&&e instanceof Map?e.forEach((t,i)=>n.set(i,t)):n instanceof Set&&e instanceof Set&&e.forEach(n.add,n);for(const t in e){if(!e.hasOwnProperty(t))continue;const i=e[t],r=n[t];Q1(r)&&Q1(i)&&n.hasOwnProperty(t)&&!bn(i)&&!Uo(i)?n[t]=j1(r,i):n[t]=i}return n}const X9=Symbol();function K9(n){return!Q1(n)||!Object.prototype.hasOwnProperty.call(n,X9)}const{assign:pa}=Object;function Y9(n){return!!(bn(n)&&n.effect)}function Z9(n,e,t,i){const{state:r,actions:s,getters:o}=e,a=t.state.value[n];let l;function c(){a||(t.state.value[n]=r?r():{});const u=YI(t.state.value[n]);return pa(u,s,Object.keys(o||{}).reduce((d,h)=>(d[h]=Kv(Ge(()=>{Km(t);const f=t._s.get(n);return o[h].call(f,f)})),d),{}))}return l=Yw(n,c,e,t,i,!0),l}function Yw(n,e,t={},i,r,s){let o;const a=pa({actions:{}},t),l={deep:!0};let c,u,d=[],h=[],f;const p=i.state.value[n];!s&&!p&&(i.state.value[n]={}),Dn({});let g;function y(R){let w;c=u=!1,typeof R=="function"?(R(i.state.value[n]),w={type:Fd.patchFunction,storeId:n,events:f}):(j1(i.state.value[n],R),w={type:Fd.patchObject,payload:R,storeId:n,events:f});const M=g=Symbol();Ph().then(()=>{g===M&&(c=!0)}),u=!0,Jl(d,w,i.state.value[n])}const m=s?function(){const{state:w}=t,M=w?w():{};this.$patch(I=>{pa(I,M)})}:Kw;function v(){o.stop(),d=[],h=[],i._s.delete(n)}const x=(R,w="")=>{if(nS in R)return R[Y0]=w,R;const M=function(){Km(i);const I=Array.from(arguments),L=[],k=[];function T(Q){L.push(Q)}function F(Q){k.push(Q)}Jl(h,{args:I,name:M[Y0],store:S,after:T,onError:F});let V;try{V=R.apply(this&&this.$id===n?this:S,I)}catch(Q){throw Jl(k,Q),Q}return V instanceof Promise?V.then(Q=>(Jl(L,Q),Q)).catch(Q=>(Jl(k,Q),Promise.reject(Q))):(Jl(L,V),V)};return M[nS]=!0,M[Y0]=w,M},_={_p:i,$id:n,$onAction:tS.bind(null,h),$patch:y,$reset:m,$subscribe(R,w={}){const M=tS(d,R,w.detached,()=>I()),I=o.run(()=>ci(()=>i.state.value[n],L=>{(w.flush==="sync"?u:c)&&R({storeId:n,type:Fd.direct,events:f},L)},pa({},l,w)));return M},$dispose:v},S=Ys(_);i._s.set(n,S);const A=(i._a&&i._a.runWithContext||q9)(()=>i._e.run(()=>(o=Hv()).run(()=>e({action:x}))));for(const R in A){const w=A[R];if(bn(w)&&!Y9(w)||Uo(w))s||(p&&K9(w)&&(bn(w)?w.value=p[R]:j1(w,p[R])),i.state.value[n][R]=w);else if(typeof w=="function"){const M=x(w,R);A[R]=M,a.actions[R]=w}}return pa(S,A),pa(Ot(S),A),Object.defineProperty(S,"$state",{get:()=>i.state.value[n],set:R=>{y(w=>{pa(w,R)})}}),i._p.forEach(R=>{pa(S,o.run(()=>R({store:S,app:i._a,pinia:i,options:a})))}),p&&s&&t.hydrate&&t.hydrate(S.$state,p),c=!0,u=!0,S}/*! #__NO_SIDE_EFFECTS__ */function Zw(n,e,t){let i;const r=typeof e=="function";i=r?t:e;function s(o,a){const l=P8();return o=o||(l?Ji(Xw,null):null),o&&Km(o),o=qw,o._s.has(n)||(r?Yw(n,e,i,o):Z9(n,i,o)),o._s.get(n)}return s.$id=n,s}function sm(n){const e=Ot(n),t={};for(const i in e){const r=e[i];r.effect?t[i]=Ge({get:()=>n[i],set(s){n[i]=s}}):(bn(r)||Uo(r))&&(t[i]=e8(n,i))}return t}function s_(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Z0={exports:{}},iS;function J9(){return iS||(iS=1,function(n){var e=Object.prototype.hasOwnProperty,t="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(t=!1));function r(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function s(l,c,u,d,h){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new r(u,d||l,h),p=t?t+c:c;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],f]:l._events[p].push(f):(l._events[p]=f,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new i:delete l._events[c]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,d;if(this._eventsCount===0)return c;for(d in u=this._events)e.call(u,d)&&c.push(t?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=t?t+c:c,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var h=0,f=d.length,p=new Array(f);h(n.ErrorReceived="ErrorReceived",n.MessageReceived="MessageReceived",n.StartSpeech="StartSpeech",n.EndSpeech="EndSpeech",n.StateChanged="StateChanged",n))(xr||{}),Kr=(n=>(n.WS_CLOSE="WS_CLOSE",n.WS_ERROR="WS_ERROR",n.WS_MESSAGE="WS_MESSAGE",n.WS_OPEN="WS_OPEN",n))(Kr||{}),Bl=(n=>(n.Player_EndSpeaking="Player_EndSpeaking",n.Player_NoLegacy="Player_NoLegacy",n.Player_StartSpeaking="Player_StartSpeaking",n.Player_WaitNextAudioClip="Player_WaitNextAudioClip",n))(Bl||{}),q1=(n=>(n.Change_Status="Change_Status",n.Chat_BinsizeError="Chat_BinsizeError",n))(q1||{});class tN extends o_{constructor(t){super();xe(this,"engine");xe(this,"_inited",!1);this._init(t)}_init(t){this._inited||(this._inited=!0,this.engine=new WebSocket(t),this.engine.addEventListener("error",i=>{this.emit(Kr.WS_ERROR,i)}),this.engine.addEventListener("open",()=>{this.emit(Kr.WS_OPEN)}),this.engine.addEventListener("message",i=>{this.emit(Kr.WS_MESSAGE,i.data)}),this.engine.addEventListener("close",()=>{this.emit(Kr.WS_CLOSE)}))}send(t){var i;(i=this.engine)==null||i.send(t)}stop(){var t;this.emit(Kr.WS_CLOSE),this._inited=!1,(t=this.engine)==null||t.close()}}var ma=(n=>(n.Idle="Idle",n.Listening="Listening",n.Responding="Responding",n.Thinking="Thinking",n))(ma||{}),qi=(n=>(n.closed="closed",n.open="open",n.waiting="waiting",n))(qi||{});class Jw extends Error{constructor(e){super(e),this.name="TimeoutError"}}class nN extends Error{constructor(e){super(),this.name="AbortError",this.message=e}}const rS=n=>globalThis.DOMException===void 0?new nN(n):new DOMException(n),sS=n=>{const e=n.reason===void 0?rS("This operation was aborted."):n.reason;return e instanceof Error?e:rS(e)};function iN(n,e){const{milliseconds:t,fallback:i,message:r,customTimers:s={setTimeout,clearTimeout}}=e;let o,a;const c=new Promise((u,d)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError("Expected `milliseconds` to be a positive number, got `".concat(t,"`"));if(e.signal){const{signal:f}=e;f.aborted&&d(sS(f)),a=()=>{d(sS(f))},f.addEventListener("abort",a,{once:!0})}if(t===Number.POSITIVE_INFINITY){n.then(u,d);return}const h=new Jw;o=s.setTimeout.call(void 0,()=>{if(i){try{u(i())}catch(f){d(f)}return}typeof n.cancel=="function"&&n.cancel(),r===!1?u():r instanceof Error?d(r):(h.message=r!=null?r:"Promise timed out after ".concat(t," milliseconds"),d(h))},t),(async()=>{try{u(await n)}catch(f){d(f)}})()}).finally(()=>{c.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return c.clear=()=>{s.clearTimeout.call(void 0,o),o=void 0},c}function rN(n,e,t){let i=0,r=n.length;for(;r>0;){const s=Math.trunc(r/2);let o=i+s;t(n[o],e)<=0?(i=++o,r-=s+1):r=s}return i}var Gr;class sN{constructor(){ri(this,Gr,[])}enqueue(e,t){t={priority:0,...t};const i={priority:t.priority,id:t.id,run:e};if(this.size===0||dt(this,Gr)[this.size-1].priority>=t.priority){dt(this,Gr).push(i);return}const r=rN(dt(this,Gr),i,(s,o)=>o.priority-s.priority);dt(this,Gr).splice(r,0,i)}setPriority(e,t){const i=dt(this,Gr).findIndex(s=>s.id===e);if(i===-1)throw new ReferenceError('No promise function with the id "'.concat(e,'" exists in the queue.'));const[r]=dt(this,Gr).splice(i,1);this.enqueue(r.run,{priority:t,id:e})}dequeue(){const e=dt(this,Gr).shift();return e==null?void 0:e.run}filter(e){return dt(this,Gr).filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return dt(this,Gr).length}}Gr=new WeakMap;var eu,tu,Sa,Eh,nu,Mh,Wr,iu,Qi,Rh,Qr,ru,Io,Ih,Om,Gt,e5,t5,n5,i5,r5,_p,X1,K1,xp,s5,Sp;class oN extends o_{constructor(t){var i,r,s,o;super();ri(this,Gt);ri(this,eu);ri(this,tu);ri(this,Sa,0);ri(this,Eh);ri(this,nu);ri(this,Mh,0);ri(this,Wr);ri(this,iu);ri(this,Qi);ri(this,Rh);ri(this,Qr,0);ri(this,ru);ri(this,Io);ri(this,Ih);ri(this,Om,BigInt(1));xe(this,"timeout");if(t={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:sN,...t},!(typeof t.intervalCap=="number"&&t.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `".concat((r=(i=t.intervalCap)==null?void 0:i.toString())!=null?r:"","` (").concat(typeof t.intervalCap,")"));if(t.interval===void 0||!(Number.isFinite(t.interval)&&t.interval>=0))throw new TypeError("Expected `interval` to be a finite number >= 0, got `".concat((o=(s=t.interval)==null?void 0:s.toString())!=null?o:"","` (").concat(typeof t.interval,")"));En(this,eu,t.carryoverConcurrencyCount),En(this,tu,t.intervalCap===Number.POSITIVE_INFINITY||t.interval===0),En(this,Eh,t.intervalCap),En(this,nu,t.interval),En(this,Qi,new t.queueClass),En(this,Rh,t.queueClass),this.concurrency=t.concurrency,this.timeout=t.timeout,En(this,Ih,t.throwOnTimeout===!0),En(this,Io,t.autoStart===!1)}get concurrency(){return dt(this,ru)}set concurrency(t){if(!(typeof t=="number"&&t>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `".concat(t,"` (").concat(typeof t,")"));En(this,ru,t),hi(this,Gt,xp).call(this)}setPriority(t,i){dt(this,Qi).setPriority(t,i)}async add(t,i={}){var r;return(r=i.id)!=null||(i.id=(Ku(this,Om)._++).toString()),i={timeout:this.timeout,throwOnTimeout:dt(this,Ih),...i},new Promise((s,o)=>{dt(this,Qi).enqueue(async()=>{var a;Ku(this,Qr)._++,Ku(this,Sa)._++;try{(a=i.signal)==null||a.throwIfAborted();let l=t({signal:i.signal});i.timeout&&(l=iN(Promise.resolve(l),{milliseconds:i.timeout})),i.signal&&(l=Promise.race([l,hi(this,Gt,s5).call(this,i.signal)]));const c=await l;s(c),this.emit("completed",c)}catch(l){if(l instanceof Jw&&!i.throwOnTimeout){s();return}o(l),this.emit("error",l)}finally{hi(this,Gt,n5).call(this)}},i),this.emit("add"),hi(this,Gt,_p).call(this)})}async addAll(t,i){return Promise.all(t.map(async r=>this.add(r,i)))}start(){return dt(this,Io)?(En(this,Io,!1),hi(this,Gt,xp).call(this),this):this}pause(){En(this,Io,!0)}clear(){En(this,Qi,new(dt(this,Rh)))}async onEmpty(){dt(this,Qi).size!==0&&await hi(this,Gt,Sp).call(this,"empty")}async onSizeLessThan(t){dt(this,Qi).sizedt(this,Qi).size{hi(this,Gt,i5).call(this)},i)),!0}return!1},_p=function(){if(dt(this,Qi).size===0)return dt(this,Wr)&&clearInterval(dt(this,Wr)),En(this,Wr,void 0),this.emit("empty"),dt(this,Qr)===0&&this.emit("idle"),!1;if(!dt(this,Io)){const t=!dt(this,Gt,r5);if(dt(this,Gt,e5)&&dt(this,Gt,t5)){const i=dt(this,Qi).dequeue();return i?(this.emit("active"),i(),t&&hi(this,Gt,X1).call(this),!0):!1}}return!1},X1=function(){dt(this,tu)||dt(this,Wr)!==void 0||(En(this,Wr,setInterval(()=>{hi(this,Gt,K1).call(this)},dt(this,nu))),En(this,Mh,Date.now()+dt(this,nu)))},K1=function(){dt(this,Sa)===0&&dt(this,Qr)===0&&dt(this,Wr)&&(clearInterval(dt(this,Wr)),En(this,Wr,void 0)),En(this,Sa,dt(this,eu)?dt(this,Qr):0),hi(this,Gt,xp).call(this)},xp=function(){for(;hi(this,Gt,_p).call(this););},s5=async function(t){return new Promise((i,r)=>{t.addEventListener("abort",()=>{r(t.reason)},{once:!0})})},Sp=async function(t,i){return new Promise(r=>{const s=()=>{i&&!i()||(this.off(t,s),r())};this.on(t,s)})};var ed={},oS;function o5(){if(oS)return ed;oS=1,ed.byteLength=a,ed.toByteArray=c,ed.fromByteArray=h;for(var n=[],e=[],t=typeof Uint8Array<"u"?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,s=i.length;r0)throw new Error("Invalid string. Length must be a multiple of 4");var g=f.indexOf("=");g===-1&&(g=p);var y=g===p?0:4-g%4;return[g,y]}function a(f){var p=o(f),g=p[0],y=p[1];return(g+y)*3/4-y}function l(f,p,g){return(p+g)*3/4-g}function c(f){var p,g=o(f),y=g[0],m=g[1],v=new t(l(f,y,m)),x=0,_=m>0?y-4:y,S;for(S=0;S<_;S+=4)p=e[f.charCodeAt(S)]<<18|e[f.charCodeAt(S+1)]<<12|e[f.charCodeAt(S+2)]<<6|e[f.charCodeAt(S+3)],v[x++]=p>>16&255,v[x++]=p>>8&255,v[x++]=p&255;return m===2&&(p=e[f.charCodeAt(S)]<<2|e[f.charCodeAt(S+1)]>>4,v[x++]=p&255),m===1&&(p=e[f.charCodeAt(S)]<<10|e[f.charCodeAt(S+1)]<<4|e[f.charCodeAt(S+2)]>>2,v[x++]=p>>8&255,v[x++]=p&255),v}function u(f){return n[f>>18&63]+n[f>>12&63]+n[f>>6&63]+n[f&63]}function d(f,p,g){for(var y,m=[],v=p;v_?_:x+v));return y===1?(p=f[g-1],m.push(n[p>>2]+n[p<<4&63]+"==")):y===2&&(p=(f[g-2]<<8)+f[g-1],m.push(n[p>>10]+n[p>>4&63]+n[p<<2&63]+"=")),m.join("")}return ed}o5();var J0={},mf={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */var aS;function aN(){return aS||(aS=1,mf.read=function(n,e,t,i,r){var s,o,a=r*8-i-1,l=(1<>1,u=-7,d=t?r-1:0,h=t?-1:1,f=n[e+d];for(d+=h,s=f&(1<<-u)-1,f>>=-u,u+=a;u>0;s=s*256+n[e+d],d+=h,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=i;u>0;o=o*256+n[e+d],d+=h,u-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(f?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-c}return(f?-1:1)*o*Math.pow(2,s-i)},mf.write=function(n,e,t,i,r,s){var o,a,l,c=s*8-r-1,u=(1<>1,h=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:s-1,p=i?1:-1,g=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?e+=h/l:e+=h*Math.pow(2,1-d),e*l>=2&&(o++,l/=2),o+d>=u?(a=0,o=u):o+d>=1?(a=(e*l-1)*Math.pow(2,r),o=o+d):(a=e*Math.pow(2,d-1)*Math.pow(2,r),o=0));r>=8;n[t+f]=a&255,f+=p,a/=256,r-=8);for(o=o<0;n[t+f]=o&255,f+=p,o/=256,c-=8);n[t+f-p]|=g*128}),mf}/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */var lS;function a5(){return lS||(lS=1,function(n){const e=o5(),t=aN(),i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=a,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50;const r=2147483647;n.kMaxLength=r,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{const z=new Uint8Array(1),C={foo:function(){return 42}};return Object.setPrototypeOf(C,Uint8Array.prototype),Object.setPrototypeOf(z,C),z.foo()===42}catch(z){return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(z){if(z>r)throw new RangeError('The value "'+z+'" is invalid for option "size"');const C=new Uint8Array(z);return Object.setPrototypeOf(C,a.prototype),C}function a(z,C,N){if(typeof z=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return d(z)}return l(z,C,N)}a.poolSize=8192;function l(z,C,N){if(typeof z=="string")return h(z,C);if(ArrayBuffer.isView(z))return p(z);if(z==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof z);if(D(z,ArrayBuffer)||z&&D(z.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(D(z,SharedArrayBuffer)||z&&D(z.buffer,SharedArrayBuffer)))return g(z,C,N);if(typeof z=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const q=z.valueOf&&z.valueOf();if(q!=null&&q!==z)return a.from(q,C,N);const Z=y(z);if(Z)return Z;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof z[Symbol.toPrimitive]=="function")return a.from(z[Symbol.toPrimitive]("string"),C,N);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof z)}a.from=function(z,C,N){return l(z,C,N)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(z){if(typeof z!="number")throw new TypeError('"size" argument must be of type number');if(z<0)throw new RangeError('The value "'+z+'" is invalid for option "size"')}function u(z,C,N){return c(z),z<=0?o(z):C!==void 0?typeof N=="string"?o(z).fill(C,N):o(z).fill(C):o(z)}a.alloc=function(z,C,N){return u(z,C,N)};function d(z){return c(z),o(z<0?0:m(z)|0)}a.allocUnsafe=function(z){return d(z)},a.allocUnsafeSlow=function(z){return d(z)};function h(z,C){if((typeof C!="string"||C==="")&&(C="utf8"),!a.isEncoding(C))throw new TypeError("Unknown encoding: "+C);const N=x(z,C)|0;let q=o(N);const Z=q.write(z,C);return Z!==N&&(q=q.slice(0,Z)),q}function f(z){const C=z.length<0?0:m(z.length)|0,N=o(C);for(let q=0;q=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return z|0}function v(z){return+z!=z&&(z=0),a.alloc(+z)}a.isBuffer=function(C){return C!=null&&C._isBuffer===!0&&C!==a.prototype},a.compare=function(C,N){if(D(C,Uint8Array)&&(C=a.from(C,C.offset,C.byteLength)),D(N,Uint8Array)&&(N=a.from(N,N.offset,N.byteLength)),!a.isBuffer(C)||!a.isBuffer(N))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(C===N)return 0;let q=C.length,Z=N.length;for(let $=0,ae=Math.min(q,Z);$Z.length?(a.isBuffer(ae)||(ae=a.from(ae)),ae.copy(Z,$)):Uint8Array.prototype.set.call(Z,ae,$);else if(a.isBuffer(ae))ae.copy(Z,$);else throw new TypeError('"list" argument must be an Array of Buffers');$+=ae.length}return Z};function x(z,C){if(a.isBuffer(z))return z.length;if(ArrayBuffer.isView(z)||D(z,ArrayBuffer))return z.byteLength;if(typeof z!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof z);const N=z.length,q=arguments.length>2&&arguments[2]===!0;if(!q&&N===0)return 0;let Z=!1;for(;;)switch(C){case"ascii":case"latin1":case"binary":return N;case"utf8":case"utf-8":return H(z).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N*2;case"hex":return N>>>1;case"base64":return j(z).length;default:if(Z)return q?-1:H(z).length;C=(""+C).toLowerCase(),Z=!0}}a.byteLength=x;function _(z,C,N){let q=!1;if((C===void 0||C<0)&&(C=0),C>this.length||((N===void 0||N>this.length)&&(N=this.length),N<=0)||(N>>>=0,C>>>=0,N<=C))return"";for(z||(z="utf8");;)switch(z){case"hex":return se(this,C,N);case"utf8":case"utf-8":return T(this,C,N);case"ascii":return Q(this,C,N);case"latin1":case"binary":return ee(this,C,N);case"base64":return k(this,C,N);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return he(this,C,N);default:if(q)throw new TypeError("Unknown encoding: "+z);z=(z+"").toLowerCase(),q=!0}}a.prototype._isBuffer=!0;function S(z,C,N){const q=z[C];z[C]=z[N],z[N]=q}a.prototype.swap16=function(){const C=this.length;if(C%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let N=0;NN&&(C+=" ... "),""},i&&(a.prototype[i]=a.prototype.inspect),a.prototype.compare=function(C,N,q,Z,$){if(D(C,Uint8Array)&&(C=a.from(C,C.offset,C.byteLength)),!a.isBuffer(C))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof C);if(N===void 0&&(N=0),q===void 0&&(q=C?C.length:0),Z===void 0&&(Z=0),$===void 0&&($=this.length),N<0||q>C.length||Z<0||$>this.length)throw new RangeError("out of range index");if(Z>=$&&N>=q)return 0;if(Z>=$)return-1;if(N>=q)return 1;if(N>>>=0,q>>>=0,Z>>>=0,$>>>=0,this===C)return 0;let ae=$-Z,ke=q-N;const Le=Math.min(ae,ke),Ve=this.slice(Z,$),Je=C.slice(N,q);for(let st=0;st2147483647?N=2147483647:N<-2147483648&&(N=-2147483648),N=+N,W(N)&&(N=Z?0:z.length-1),N<0&&(N=z.length+N),N>=z.length){if(Z)return-1;N=z.length-1}else if(N<0)if(Z)N=0;else return-1;if(typeof C=="string"&&(C=a.from(C,q)),a.isBuffer(C))return C.length===0?-1:A(z,C,N,q,Z);if(typeof C=="number")return C=C&255,typeof Uint8Array.prototype.indexOf=="function"?Z?Uint8Array.prototype.indexOf.call(z,C,N):Uint8Array.prototype.lastIndexOf.call(z,C,N):A(z,[C],N,q,Z);throw new TypeError("val must be string, number or Buffer")}function A(z,C,N,q,Z){let $=1,ae=z.length,ke=C.length;if(q!==void 0&&(q=String(q).toLowerCase(),q==="ucs2"||q==="ucs-2"||q==="utf16le"||q==="utf-16le")){if(z.length<2||C.length<2)return-1;$=2,ae/=2,ke/=2,N/=2}function Le(Je,st){return $===1?Je[st]:Je.readUInt16BE(st*$)}let Ve;if(Z){let Je=-1;for(Ve=N;Veae&&(N=ae-ke),Ve=N;Ve>=0;Ve--){let Je=!0;for(let st=0;stZ&&(q=Z)):q=Z;const $=C.length;q>$/2&&(q=$/2);let ae;for(ae=0;ae>>0,isFinite(q)?(q=q>>>0,Z===void 0&&(Z="utf8")):(Z=q,q=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const $=this.length-N;if((q===void 0||q>$)&&(q=$),C.length>0&&(q<0||N<0)||N>this.length)throw new RangeError("Attempt to write outside buffer bounds");Z||(Z="utf8");let ae=!1;for(;;)switch(Z){case"hex":return R(this,C,N,q);case"utf8":case"utf-8":return w(this,C,N,q);case"ascii":case"latin1":case"binary":return M(this,C,N,q);case"base64":return I(this,C,N,q);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,C,N,q);default:if(ae)throw new TypeError("Unknown encoding: "+Z);Z=(""+Z).toLowerCase(),ae=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function k(z,C,N){return C===0&&N===z.length?e.fromByteArray(z):e.fromByteArray(z.slice(C,N))}function T(z,C,N){N=Math.min(z.length,N);const q=[];let Z=C;for(;Z239?4:$>223?3:$>191?2:1;if(Z+ke<=N){let Le,Ve,Je,st;switch(ke){case 1:$<128&&(ae=$);break;case 2:Le=z[Z+1],(Le&192)===128&&(st=($&31)<<6|Le&63,st>127&&(ae=st));break;case 3:Le=z[Z+1],Ve=z[Z+2],(Le&192)===128&&(Ve&192)===128&&(st=($&15)<<12|(Le&63)<<6|Ve&63,st>2047&&(st<55296||st>57343)&&(ae=st));break;case 4:Le=z[Z+1],Ve=z[Z+2],Je=z[Z+3],(Le&192)===128&&(Ve&192)===128&&(Je&192)===128&&(st=($&15)<<18|(Le&63)<<12|(Ve&63)<<6|Je&63,st>65535&&st<1114112&&(ae=st))}}ae===null?(ae=65533,ke=1):ae>65535&&(ae-=65536,q.push(ae>>>10&1023|55296),ae=56320|ae&1023),q.push(ae),Z+=ke}return V(q)}const F=4096;function V(z){const C=z.length;if(C<=F)return String.fromCharCode.apply(String,z);let N="",q=0;for(;qq)&&(N=q);let Z="";for(let $=C;$q&&(C=q),N<0?(N+=q,N<0&&(N=0)):N>q&&(N=q),NN)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(C,N,q){C=C>>>0,N=N>>>0,q||ie(C,N,this.length);let Z=this[C],$=1,ae=0;for(;++ae>>0,N=N>>>0,q||ie(C,N,this.length);let Z=this[C+--N],$=1;for(;N>0&&($*=256);)Z+=this[C+--N]*$;return Z},a.prototype.readUint8=a.prototype.readUInt8=function(C,N){return C=C>>>0,N||ie(C,1,this.length),this[C]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(C,N){return C=C>>>0,N||ie(C,2,this.length),this[C]|this[C+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(C,N){return C=C>>>0,N||ie(C,2,this.length),this[C]<<8|this[C+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(C,N){return C=C>>>0,N||ie(C,4,this.length),(this[C]|this[C+1]<<8|this[C+2]<<16)+this[C+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(C,N){return C=C>>>0,N||ie(C,4,this.length),this[C]*16777216+(this[C+1]<<16|this[C+2]<<8|this[C+3])},a.prototype.readBigUInt64LE=X(function(C){C=C>>>0,ne(C,"offset");const N=this[C],q=this[C+7];(N===void 0||q===void 0)&&b(C,this.length-8);const Z=N+this[++C]*2**8+this[++C]*2**16+this[++C]*2**24,$=this[++C]+this[++C]*2**8+this[++C]*2**16+q*2**24;return BigInt(Z)+(BigInt($)<>>0,ne(C,"offset");const N=this[C],q=this[C+7];(N===void 0||q===void 0)&&b(C,this.length-8);const Z=N*2**24+this[++C]*2**16+this[++C]*2**8+this[++C],$=this[++C]*2**24+this[++C]*2**16+this[++C]*2**8+q;return(BigInt(Z)<>>0,N=N>>>0,q||ie(C,N,this.length);let Z=this[C],$=1,ae=0;for(;++ae=$&&(Z-=Math.pow(2,8*N)),Z},a.prototype.readIntBE=function(C,N,q){C=C>>>0,N=N>>>0,q||ie(C,N,this.length);let Z=N,$=1,ae=this[C+--Z];for(;Z>0&&($*=256);)ae+=this[C+--Z]*$;return $*=128,ae>=$&&(ae-=Math.pow(2,8*N)),ae},a.prototype.readInt8=function(C,N){return C=C>>>0,N||ie(C,1,this.length),this[C]&128?(255-this[C]+1)*-1:this[C]},a.prototype.readInt16LE=function(C,N){C=C>>>0,N||ie(C,2,this.length);const q=this[C]|this[C+1]<<8;return q&32768?q|4294901760:q},a.prototype.readInt16BE=function(C,N){C=C>>>0,N||ie(C,2,this.length);const q=this[C+1]|this[C]<<8;return q&32768?q|4294901760:q},a.prototype.readInt32LE=function(C,N){return C=C>>>0,N||ie(C,4,this.length),this[C]|this[C+1]<<8|this[C+2]<<16|this[C+3]<<24},a.prototype.readInt32BE=function(C,N){return C=C>>>0,N||ie(C,4,this.length),this[C]<<24|this[C+1]<<16|this[C+2]<<8|this[C+3]},a.prototype.readBigInt64LE=X(function(C){C=C>>>0,ne(C,"offset");const N=this[C],q=this[C+7];(N===void 0||q===void 0)&&b(C,this.length-8);const Z=this[C+4]+this[C+5]*2**8+this[C+6]*2**16+(q<<24);return(BigInt(Z)<>>0,ne(C,"offset");const N=this[C],q=this[C+7];(N===void 0||q===void 0)&&b(C,this.length-8);const Z=(N<<24)+this[++C]*2**16+this[++C]*2**8+this[++C];return(BigInt(Z)<>>0,N||ie(C,4,this.length),t.read(this,C,!0,23,4)},a.prototype.readFloatBE=function(C,N){return C=C>>>0,N||ie(C,4,this.length),t.read(this,C,!1,23,4)},a.prototype.readDoubleLE=function(C,N){return C=C>>>0,N||ie(C,8,this.length),t.read(this,C,!0,52,8)},a.prototype.readDoubleBE=function(C,N){return C=C>>>0,N||ie(C,8,this.length),t.read(this,C,!1,52,8)};function re(z,C,N,q,Z,$){if(!a.isBuffer(z))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>Z||C<$)throw new RangeError('"value" argument is out of bounds');if(N+q>z.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(C,N,q,Z){if(C=+C,N=N>>>0,q=q>>>0,!Z){const ke=Math.pow(2,8*q)-1;re(this,C,N,q,ke,0)}let $=1,ae=0;for(this[N]=C&255;++ae>>0,q=q>>>0,!Z){const ke=Math.pow(2,8*q)-1;re(this,C,N,q,ke,0)}let $=q-1,ae=1;for(this[N+$]=C&255;--$>=0&&(ae*=256);)this[N+$]=C/ae&255;return N+q},a.prototype.writeUint8=a.prototype.writeUInt8=function(C,N,q){return C=+C,N=N>>>0,q||re(this,C,N,1,255,0),this[N]=C&255,N+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(C,N,q){return C=+C,N=N>>>0,q||re(this,C,N,2,65535,0),this[N]=C&255,this[N+1]=C>>>8,N+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(C,N,q){return C=+C,N=N>>>0,q||re(this,C,N,2,65535,0),this[N]=C>>>8,this[N+1]=C&255,N+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(C,N,q){return C=+C,N=N>>>0,q||re(this,C,N,4,4294967295,0),this[N+3]=C>>>24,this[N+2]=C>>>16,this[N+1]=C>>>8,this[N]=C&255,N+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(C,N,q){return C=+C,N=N>>>0,q||re(this,C,N,4,4294967295,0),this[N]=C>>>24,this[N+1]=C>>>16,this[N+2]=C>>>8,this[N+3]=C&255,N+4};function be(z,C,N,q,Z){te(C,q,Z,z,N,7);let $=Number(C&BigInt(4294967295));z[N++]=$,$=$>>8,z[N++]=$,$=$>>8,z[N++]=$,$=$>>8,z[N++]=$;let ae=Number(C>>BigInt(32)&BigInt(4294967295));return z[N++]=ae,ae=ae>>8,z[N++]=ae,ae=ae>>8,z[N++]=ae,ae=ae>>8,z[N++]=ae,N}function le(z,C,N,q,Z){te(C,q,Z,z,N,7);let $=Number(C&BigInt(4294967295));z[N+7]=$,$=$>>8,z[N+6]=$,$=$>>8,z[N+5]=$,$=$>>8,z[N+4]=$;let ae=Number(C>>BigInt(32)&BigInt(4294967295));return z[N+3]=ae,ae=ae>>8,z[N+2]=ae,ae=ae>>8,z[N+1]=ae,ae=ae>>8,z[N]=ae,N+8}a.prototype.writeBigUInt64LE=X(function(C,N=0){return be(this,C,N,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=X(function(C,N=0){return le(this,C,N,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(C,N,q,Z){if(C=+C,N=N>>>0,!Z){const Le=Math.pow(2,8*q-1);re(this,C,N,q,Le-1,-Le)}let $=0,ae=1,ke=0;for(this[N]=C&255;++$>0)-ke&255;return N+q},a.prototype.writeIntBE=function(C,N,q,Z){if(C=+C,N=N>>>0,!Z){const Le=Math.pow(2,8*q-1);re(this,C,N,q,Le-1,-Le)}let $=q-1,ae=1,ke=0;for(this[N+$]=C&255;--$>=0&&(ae*=256);)C<0&&ke===0&&this[N+$+1]!==0&&(ke=1),this[N+$]=(C/ae>>0)-ke&255;return N+q},a.prototype.writeInt8=function(C,N,q){return C=+C,N=N>>>0,q||re(this,C,N,1,127,-128),C<0&&(C=255+C+1),this[N]=C&255,N+1},a.prototype.writeInt16LE=function(C,N,q){return C=+C,N=N>>>0,q||re(this,C,N,2,32767,-32768),this[N]=C&255,this[N+1]=C>>>8,N+2},a.prototype.writeInt16BE=function(C,N,q){return C=+C,N=N>>>0,q||re(this,C,N,2,32767,-32768),this[N]=C>>>8,this[N+1]=C&255,N+2},a.prototype.writeInt32LE=function(C,N,q){return C=+C,N=N>>>0,q||re(this,C,N,4,2147483647,-2147483648),this[N]=C&255,this[N+1]=C>>>8,this[N+2]=C>>>16,this[N+3]=C>>>24,N+4},a.prototype.writeInt32BE=function(C,N,q){return C=+C,N=N>>>0,q||re(this,C,N,4,2147483647,-2147483648),C<0&&(C=4294967295+C+1),this[N]=C>>>24,this[N+1]=C>>>16,this[N+2]=C>>>8,this[N+3]=C&255,N+4},a.prototype.writeBigInt64LE=X(function(C,N=0){return be(this,C,N,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=X(function(C,N=0){return le(this,C,N,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function fe(z,C,N,q,Z,$){if(N+q>z.length)throw new RangeError("Index out of range");if(N<0)throw new RangeError("Index out of range")}function Te(z,C,N,q,Z){return C=+C,N=N>>>0,Z||fe(z,C,N,4),t.write(z,C,N,q,23,4),N+4}a.prototype.writeFloatLE=function(C,N,q){return Te(this,C,N,!0,q)},a.prototype.writeFloatBE=function(C,N,q){return Te(this,C,N,!1,q)};function Ce(z,C,N,q,Z){return C=+C,N=N>>>0,Z||fe(z,C,N,8),t.write(z,C,N,q,52,8),N+8}a.prototype.writeDoubleLE=function(C,N,q){return Ce(this,C,N,!0,q)},a.prototype.writeDoubleBE=function(C,N,q){return Ce(this,C,N,!1,q)},a.prototype.copy=function(C,N,q,Z){if(!a.isBuffer(C))throw new TypeError("argument should be a Buffer");if(q||(q=0),!Z&&Z!==0&&(Z=this.length),N>=C.length&&(N=C.length),N||(N=0),Z>0&&Z=this.length)throw new RangeError("Index out of range");if(Z<0)throw new RangeError("sourceEnd out of bounds");Z>this.length&&(Z=this.length),C.length-N>>0,q=q===void 0?this.length:q>>>0,C||(C=0);let $;if(typeof C=="number")for($=N;$2**32?Z=Be(String(N)):typeof N=="bigint"&&(Z=String(N),(N>BigInt(2)**BigInt(32)||N<-(BigInt(2)**BigInt(32)))&&(Z=Be(Z)),Z+="n"),q+=" It must be ".concat(C,". Received ").concat(Z),q},RangeError);function Be(z){let C="",N=z.length;const q=z[0]==="-"?1:0;for(;N>=q+4;N-=3)C="_".concat(z.slice(N-3,N)).concat(C);return"".concat(z.slice(0,N)).concat(C)}function it(z,C,N){ne(C,"offset"),(z[C]===void 0||z[C+N]===void 0)&&b(C,z.length-(N+1))}function te(z,C,N,q,Z,$){if(z>N||z= 0".concat(ae," and < 2").concat(ae," ** ").concat(($+1)*8).concat(ae):ke=">= -(2".concat(ae," ** ").concat(($+1)*8-1).concat(ae,") and < 2 ** ")+"".concat(($+1)*8-1).concat(ae),new Ie.ERR_OUT_OF_RANGE("value",ke,z)}it(q,Z,$)}function ne(z,C){if(typeof z!="number")throw new Ie.ERR_INVALID_ARG_TYPE(C,"number",z)}function b(z,C,N){throw Math.floor(z)!==z?(ne(z,N),new Ie.ERR_OUT_OF_RANGE("offset","an integer",z)):C<0?new Ie.ERR_BUFFER_OUT_OF_BOUNDS:new Ie.ERR_OUT_OF_RANGE("offset",">= 0 and <= ".concat(C),z)}const oe=/[^+/0-9A-Za-z-_]/g;function J(z){if(z=z.split("=")[0],z=z.trim().replace(oe,""),z.length<2)return"";for(;z.length%4!==0;)z=z+"=";return z}function H(z,C){C=C||1/0;let N;const q=z.length;let Z=null;const $=[];for(let ae=0;ae55295&&N<57344){if(!Z){if(N>56319){(C-=3)>-1&&$.push(239,191,189);continue}else if(ae+1===q){(C-=3)>-1&&$.push(239,191,189);continue}Z=N;continue}if(N<56320){(C-=3)>-1&&$.push(239,191,189),Z=N;continue}N=(Z-55296<<10|N-56320)+65536}else Z&&(C-=3)>-1&&$.push(239,191,189);if(Z=null,N<128){if((C-=1)<0)break;$.push(N)}else if(N<2048){if((C-=2)<0)break;$.push(N>>6|192,N&63|128)}else if(N<65536){if((C-=3)<0)break;$.push(N>>12|224,N>>6&63|128,N&63|128)}else if(N<1114112){if((C-=4)<0)break;$.push(N>>18|240,N>>12&63|128,N>>6&63|128,N&63|128)}else throw new Error("Invalid code point")}return $}function P(z){const C=[];for(let N=0;N>8,Z=N%256,$.push(Z),$.push(q);return $}function j(z){return e.toByteArray(J(z))}function B(z,C,N,q){let Z;for(Z=0;Z=C.length||Z>=z.length);++Z)C[Z+N]=z[Z];return Z}function D(z,C){return z instanceof C||z!=null&&z.constructor!=null&&z.constructor.name!=null&&z.constructor.name===C.name}function W(z){return z!==z}const G=function(){const z="0123456789abcdef",C=new Array(256);for(let N=0;N<16;++N){const q=N*16;for(let Z=0;Z<16;++Z)C[q+Z]=z[N]+z[Z]}return C}();function X(z){return typeof BigInt>"u"?ue:z}function ue(){throw new Error("BigInt not supported")}}(J0)),J0}var lN=a5(),eg,cS;function cN(){if(cS)return eg;cS=1;const n=(f,p,g)=>{const y=f.indexOf(0,p),m=Math.min(p+g,y===-1?f.length:y);return f.slice(p,m).toString("utf8")},e=(f,p,g,y)=>{const m=p.write(f,g,y,"utf8");m{let y=f[0];return y>=g&&(y=g-1),p++,f.slice(p,p+y).toString("utf8")},i=(f,p,g,y)=>{let m=Buffer.alloc(f,"utf8"),v=m.length;v>=y&&(v=y-1),v>255&&(v=255),m[g]=v,m.copy(p,g+1,0,v),p.fill(0,g+1+v,g+y)},r=(f,p)=>f.readUInt32LE(p,!0),s=(f,p)=>f.readUInt32BE(p,!0),o=(f,p)=>f.readInt32LE(p,!0),a=(f,p)=>f.readInt32BE(p,!0),l=(f,p,g)=>{p.writeUInt32LE(f,g,!0)},c=(f,p,g)=>{p.writeUInt32BE(f,g,!0)},u=(f,p,g)=>{p.writeInt32LE(f,g,!0)},d=(f,p,g)=>{p.writeInt32BE(f,g,!0)};function h(f){const p=f.Buffer,g=f.isLittleEndian===void 0?!0:!!f.isLittleEndian,y=f.is64bit===void 0?!0:!!f.is64bit,m=f.unpackUInt64LE,v=f.unpackUInt64BE,x=f.unpackInt64LE,_=f.unpackInt64BE,S=f.packUInt64LE,E=f.packUInt64BE,A=f.packInt64LE,R=f.packInt64BE,w={x:[1,1,null,null],c:[1,1,(T,F)=>String.fromCharCode(T[F]),(T,F,V)=>{F[V]=T.charCodeAt(0)}],b:[1,1,(T,F)=>T.readInt8(F),(T,F,V)=>{F.writeInt8(T,V,!0)}],B:[1,1,(T,F)=>T[F],(T,F,V)=>{F[V]=T}],h:[2,2,g?(T,F)=>T.readInt16LE(F):(T,F)=>T.readInt16BE(F),g?(T,F,V)=>F.writeInt16LE(T,V,!0):(T,F,V)=>F.writeInt16BE(T,V,!0)],H:[2,2,g?(T,F)=>T.readUInt16LE(F):(T,F)=>T.readUInt16BE(F),g?(T,F,V)=>F.writeUInt16LE(T,V,!0):(T,F,V)=>F.writeUInt16BE(T,V,!0)],i:[4,4,g?o:a,g?u:d],I:[4,4,g?r:s,g?l:c],l:[4,4,g?o:a,g?u:d],L:[4,4,g?r:s,g?l:c],f:[4,4,g?(T,F)=>T.readFloatLE(F):(T,F)=>T.readFloatBE(F),g?(T,F,V)=>F.writeFloatLE(T,V,!0):(T,F,V)=>F.writeFloatBE(T,V,!0)],d:[8,8,g?(T,F)=>T.readDoubleLE(F):(T,F)=>T.readDoubleBE(F),g?(T,F,V)=>F.writeDoubleLE(T,V,!0):(T,F,V)=>F.writeDoubleBE(T,V,!0)],s:[1,1,n,e],p:[1,1,t,i],P:[y?8:4,y?8:4,g?y?m:r:y?v:s,g?y?S:l:y?E:c],q:[8,8,g?x:_,g?A:R],Q:[8,8,g?m:v,g?S:E],"?":[1,1,(T,F)=>T[F]!==0,(T,F,V)=>{F[V]=T?1:0}]},M={x:[1,1,null,null],c:[1,1,(T,F)=>String.fromCharCode(T[F]),(T,F,V)=>{F[V]=T.charCodeAt(0)}],b:[1,1,(T,F)=>T.readInt8(F),(T,F,V)=>{F.writeInt8(T,V,!0)}],B:[1,1,(T,F)=>T[F],(T,F,V)=>{F[V]=T}],h:[2,1,(T,F)=>T.readInt16LE(F),(T,F,V)=>F.writeInt16LE(T,V,!0)],H:[2,1,(T,F)=>T.readUInt16LE(F),(T,F,V)=>F.writeUInt16LE(T,V,!0)],i:[4,1,o,u],I:[4,1,r,l],l:[4,1,o,u],L:[4,1,r,l],f:[4,1,(T,F)=>T.readFloatLE(F),(T,F,V)=>F.writeFloatLE(T,V,!0)],d:[8,1,(T,F)=>T.readDoubleLE(F),(T,F,V)=>F.writeDoubleLE(T,V,!0)],s:[1,1,n,e],p:[1,1,t,i],P:[y?8:4,1,y?m:r,y?S:l],q:[8,1,x,A],Q:[8,1,m,S],"?":[1,1,(T,F)=>T[F]!==0,(T,F,V)=>{F[V]=T?1:0}]},I={x:[1,1,null,null],c:[1,1,(T,F)=>String.fromCharCode(T[F]),(T,F,V)=>{F[V]=T.charCodeAt(0)}],b:[1,1,(T,F)=>T.readInt8(F),(T,F,V)=>{F.writeInt8(T,V,!0)}],B:[1,1,(T,F)=>T[F],(T,F,V)=>{F[V]=T}],h:[2,1,(T,F)=>T.readInt16BE(F),(T,F,V)=>F.writeInt16BE(T,V,!0)],H:[2,1,(T,F)=>T.readUInt16BE(F),(T,F,V)=>F.writeUInt16BE(T,V,!0)],i:[4,1,a,d],I:[4,1,s,c],l:[4,1,a,d],L:[4,1,s,c],f:[4,1,(T,F)=>T.readFloatBE(F),(T,F,V)=>F.writeFloatBE(T,V,!0)],d:[8,1,(T,F)=>T.readDoubleBE(F),(T,F,V)=>F.writeDoubleBE(T,V,!0)],s:[1,1,n,e],p:[1,1,t,i],P:[y?8:4,1,y?v:s,y?E:c],q:[8,1,_,R],Q:[8,1,v,E],"?":[1,1,(T,F)=>T[F]!==0,(T,F,V)=>{F[V]=T?1:0}]};let L=T=>{let F=T[0],V=!0,Q=w;switch(F){case"<":Q=M;break;case">":case"!":Q=I;break;case"=":Q=g?M:I;break;default:V=!1;case"@":Q=w;break}return{map:Q,skipFirst:V}};class k{static sizeOf(F){let V=0,Q=null,ee=0,se,he,ie,re,be=L(F),le=be.map;for(be.skipFirst&&ee++,he=F.length;ee="0"&&se<="9"){Q=Q===null?se:Q+se;continue}ie=le[se],ie&&(re=ie[1],re>1&&(V=Math.ceil(V/re)*re),Q=Q?parseInt(Q,10):0,se==="s"?V+=Q||0:se==="p"?V+=Q||1:V+=ie[0]*(Q||1),Q=null)}return V}static unpack(F,V,Q){return k.unpackFrom(F,V,Q,0)}static unpackFrom(F,V,Q,ee){let se=[],he=null,ie=0,re=L(F),be=re.map;re.skipFirst&&ie++;for(const le=F.length;ie="0"&&fe<="9"){he=he===null?fe:he+fe;continue}const Te=be[fe];if(!Te)continue;let Ce=Te[0];const Ie=Te[1];Ie>1&&(ee=Math.ceil(ee/Ie)*Ie),he=he?parseInt(he,10):0;let ze;fe==="s"?(ze=1,Ce=he):fe==="p"?(ze=1,Ce=he||1):ze=he||1;let Be=Te[2];for(;ze>0;){if(Be){if(Q&&ee+Ce>=V.length)throw new Error("Reached end of buffer, can't unpack anymore data.");se.push(Be(V,ee,he))}ee+=Ce,ze--}he=null}return se}static pack(F,V,Q){Array.isArray(V)||(V=Array.prototype.slice.call(arguments,1),Q=!0);let ee=p.alloc(k.sizeOf(F)),se=0,he=null,ie=0,re=0,be=L(F),le=be.map;be.skipFirst&&ie++;for(const fe=F.length;ie="0"&&Te<="9"){he=he===null?Te:he+Te;continue}const Ce=le[Te];if(!Ce)continue;let Ie=Ce[0];const ze=Ce[1];ze>1&&(se=Math.ceil(se/ze)*ze),he=he?parseInt(he,10):0;let Be;Te==="s"?(Be=1,Ie=he):Te==="p"?(Be=1,Ie=he||1):Be=he||1;let it=Ce[3];for(;Be>0;){if(it){if(Q&&re>=V.length)throw new Error("Reached end of data, no more elements to pack.");it(V[re],ee,se,he),re++}se+=Ie,Be--}he=null}return ee}}return k}return eg=h,eg}var tg,uS;function uN(){if(uS)return tg;uS=1,tg=e;var n=null;try{n=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(M){}function e(M,I,L){this.low=M|0,this.high=I|0,this.unsigned=!!L}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0});function t(M){return(M&&M.__isLong__)===!0}e.isLong=t;var i={},r={};function s(M,I){var L,k,T;return I?(M>>>=0,(T=0<=M&&M<256)&&(k=r[M],k)?k:(L=a(M,(M|0)<0?-1:0,!0),T&&(r[M]=L),L)):(M|=0,(T=-128<=M&&M<128)&&(k=i[M],k)?k:(L=a(M,M<0?-1:0,!1),T&&(i[M]=L),L))}e.fromInt=s;function o(M,I){if(isNaN(M))return I?v:m;if(I){if(M<0)return v;if(M>=p)return A}else{if(M<=-g)return R;if(M+1>=g)return E}return M<0?o(-M,I).neg():a(M%f|0,M/f|0,I)}e.fromNumber=o;function a(M,I,L){return new e(M,I,L)}e.fromBits=a;var l=Math.pow;function c(M,I,L){if(M.length===0)throw Error("empty string");if(M==="NaN"||M==="Infinity"||M==="+Infinity"||M==="-Infinity")return m;if(typeof I=="number"?(L=I,I=!1):I=!!I,L=L||10,L<2||360)throw Error("interior hyphen");if(k===0)return c(M.substring(1),I,L).neg();for(var T=o(l(L,8)),F=m,V=0;V>>0:this.low},w.toNumber=function(){return this.unsigned?(this.high>>>0)*f+(this.low>>>0):this.high*f+(this.low>>>0)},w.toString=function(I){if(I=I||10,I<2||36>>0,he=se.toString(I);if(V=ee,V.isZero())return he+Q;for(;he.length<6;)he="0"+he;Q=""+he+Q}},w.getHighBits=function(){return this.high},w.getHighBitsUnsigned=function(){return this.high>>>0},w.getLowBits=function(){return this.low},w.getLowBitsUnsigned=function(){return this.low>>>0},w.getNumBitsAbs=function(){if(this.isNegative())return this.eq(R)?64:this.neg().getNumBitsAbs();for(var I=this.high!=0?this.high:this.low,L=31;L>0&&(I&1<=0},w.isOdd=function(){return(this.low&1)===1},w.isEven=function(){return(this.low&1)===0},w.equals=function(I){return t(I)||(I=u(I)),this.unsigned!==I.unsigned&&this.high>>>31===1&&I.high>>>31===1?!1:this.high===I.high&&this.low===I.low},w.eq=w.equals,w.notEquals=function(I){return!this.eq(I)},w.neq=w.notEquals,w.ne=w.notEquals,w.lessThan=function(I){return this.comp(I)<0},w.lt=w.lessThan,w.lessThanOrEqual=function(I){return this.comp(I)<=0},w.lte=w.lessThanOrEqual,w.le=w.lessThanOrEqual,w.greaterThan=function(I){return this.comp(I)>0},w.gt=w.greaterThan,w.greaterThanOrEqual=function(I){return this.comp(I)>=0},w.gte=w.greaterThanOrEqual,w.ge=w.greaterThanOrEqual,w.compare=function(I){if(t(I)||(I=u(I)),this.eq(I))return 0;var L=this.isNegative(),k=I.isNegative();return L&&!k?-1:!L&&k?1:this.unsigned?I.high>>>0>this.high>>>0||I.high===this.high&&I.low>>>0>this.low>>>0?-1:1:this.sub(I).isNegative()?-1:1},w.comp=w.compare,w.negate=function(){return!this.unsigned&&this.eq(R)?R:this.not().add(x)},w.neg=w.negate,w.add=function(I){t(I)||(I=u(I));var L=this.high>>>16,k=this.high&65535,T=this.low>>>16,F=this.low&65535,V=I.high>>>16,Q=I.high&65535,ee=I.low>>>16,se=I.low&65535,he=0,ie=0,re=0,be=0;return be+=F+se,re+=be>>>16,be&=65535,re+=T+ee,ie+=re>>>16,re&=65535,ie+=k+Q,he+=ie>>>16,ie&=65535,he+=L+V,he&=65535,a(re<<16|be,he<<16|ie,this.unsigned)},w.subtract=function(I){return t(I)||(I=u(I)),this.add(I.neg())},w.sub=w.subtract,w.multiply=function(I){if(this.isZero())return m;if(t(I)||(I=u(I)),n){var L=n.mul(this.low,this.high,I.low,I.high);return a(L,n.get_high(),this.unsigned)}if(I.isZero())return m;if(this.eq(R))return I.isOdd()?R:m;if(I.eq(R))return this.isOdd()?R:m;if(this.isNegative())return I.isNegative()?this.neg().mul(I.neg()):this.neg().mul(I).neg();if(I.isNegative())return this.mul(I.neg()).neg();if(this.lt(y)&&I.lt(y))return o(this.toNumber()*I.toNumber(),this.unsigned);var k=this.high>>>16,T=this.high&65535,F=this.low>>>16,V=this.low&65535,Q=I.high>>>16,ee=I.high&65535,se=I.low>>>16,he=I.low&65535,ie=0,re=0,be=0,le=0;return le+=V*he,be+=le>>>16,le&=65535,be+=F*he,re+=be>>>16,be&=65535,be+=V*se,re+=be>>>16,be&=65535,re+=T*he,ie+=re>>>16,re&=65535,re+=F*se,ie+=re>>>16,re&=65535,re+=V*ee,ie+=re>>>16,re&=65535,ie+=k*he+T*se+F*ee+V*Q,ie&=65535,a(be<<16|le,ie<<16|re,this.unsigned)},w.mul=w.multiply,w.divide=function(I){if(t(I)||(I=u(I)),I.isZero())throw Error("division by zero");if(n){if(!this.unsigned&&this.high===-2147483648&&I.low===-1&&I.high===-1)return this;var L=(this.unsigned?n.div_u:n.div_s)(this.low,this.high,I.low,I.high);return a(L,n.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?v:m;var k,T,F;if(this.unsigned){if(I.unsigned||(I=I.toUnsigned()),I.gt(this))return v;if(I.gt(this.shru(1)))return _;F=v}else{if(this.eq(R)){if(I.eq(x)||I.eq(S))return R;if(I.eq(R))return x;var V=this.shr(1);return k=V.div(I).shl(1),k.eq(m)?I.isNegative()?x:S:(T=this.sub(I.mul(k)),F=k.add(T.div(I)),F)}else if(I.eq(R))return this.unsigned?v:m;if(this.isNegative())return I.isNegative()?this.neg().div(I.neg()):this.neg().div(I).neg();if(I.isNegative())return this.div(I.neg()).neg();F=m}for(T=this;T.gte(I);){k=Math.max(1,Math.floor(T.toNumber()/I.toNumber()));for(var Q=Math.ceil(Math.log(k)/Math.LN2),ee=Q<=48?1:l(2,Q-48),se=o(k),he=se.mul(I);he.isNegative()||he.gt(T);)k-=ee,se=o(k,this.unsigned),he=se.mul(I);se.isZero()&&(se=x),F=F.add(se),T=T.sub(he)}return F},w.div=w.divide,w.modulo=function(I){if(t(I)||(I=u(I)),n){var L=(this.unsigned?n.rem_u:n.rem_s)(this.low,this.high,I.low,I.high);return a(L,n.get_high(),this.unsigned)}return this.sub(this.div(I).mul(I))},w.mod=w.modulo,w.rem=w.modulo,w.not=function(){return a(~this.low,~this.high,this.unsigned)},w.and=function(I){return t(I)||(I=u(I)),a(this.low&I.low,this.high&I.high,this.unsigned)},w.or=function(I){return t(I)||(I=u(I)),a(this.low|I.low,this.high|I.high,this.unsigned)},w.xor=function(I){return t(I)||(I=u(I)),a(this.low^I.low,this.high^I.high,this.unsigned)},w.shiftLeft=function(I){return t(I)&&(I=I.toInt()),(I&=63)===0?this:I<32?a(this.low<>>32-I,this.unsigned):a(0,this.low<>>I|this.high<<32-I,this.high>>I,this.unsigned):a(this.high>>I-32,this.high>=0?0:-1,this.unsigned)},w.shr=w.shiftRight,w.shiftRightUnsigned=function(I){if(t(I)&&(I=I.toInt()),I&=63,I===0)return this;var L=this.high;if(I<32){var k=this.low;return a(k>>>I|L<<32-I,L>>>I,this.unsigned)}else return I===32?a(L,0,this.unsigned):a(L>>>I-32,0,this.unsigned)},w.shru=w.shiftRightUnsigned,w.shr_u=w.shiftRightUnsigned,w.toSigned=function(){return this.unsigned?a(this.low,this.high,!1):this},w.toUnsigned=function(){return this.unsigned?this:a(this.low,this.high,!0)},w.toBytes=function(I){return I?this.toBytesLE():this.toBytesBE()},w.toBytesLE=function(){var I=this.high,L=this.low;return[L&255,L>>>8&255,L>>>16&255,L>>>24,I&255,I>>>8&255,I>>>16&255,I>>>24]},w.toBytesBE=function(){var I=this.high,L=this.low;return[I>>>24,I>>>16&255,I>>>8&255,I&255,L>>>24,L>>>16&255,L>>>8&255,L&255]},e.fromBytes=function(I,L,k){return k?e.fromBytesLE(I,L):e.fromBytesBE(I,L)},e.fromBytesLE=function(I,L){return new e(I[0]|I[1]<<8|I[2]<<16|I[3]<<24,I[4]|I[5]<<8|I[6]<<16|I[7]<<24,L)},e.fromBytesBE=function(I,L){return new e(I[4]<<24|I[5]<<16|I[6]<<8|I[7],I[0]<<24|I[1]<<16|I[2]<<8|I[3],L)},tg}var ng,dS;function dN(){if(dS)return ng;dS=1;const n=uN(),e=(a,l)=>n.fromBits(a.readInt32LE(l),a.readInt32LE(l+4),!0),t=(a,l)=>n.fromBits(a.readInt32BE(l+4),a.readInt32BE(l),!0),i=(a,l)=>n.fromBits(a.readInt32LE(l),a.readInt32LE(l+4),!1),r=(a,l)=>n.fromBits(a.readInt32BE(l+4),a.readInt32BE(l),!1),s=(a,l,c)=>{a instanceof n||(typeof a=="number"?a=n.fromNumber(a):a=n.fromString(a||"")),l.writeInt32LE(a.getLowBits(),c,!0),l.writeInt32LE(a.getHighBits(),c+4,!0)},o=(a,l,c)=>{a instanceof n||(typeof a=="number"?a=n.fromNumber(a):a=n.fromString(a||"")),l.writeInt32BE(a.getHighBits(),c,!0),l.writeInt32BE(a.getLowBits(),c+4,!0)};return ng={unpackUInt64LE:e,unpackUInt64BE:t,unpackInt64LE:i,unpackInt64BE:r,packUInt64LE:s,packUInt64BE:o,packInt64LE:s,packInt64BE:o},ng}var ig,hS;function hN(){return hS||(hS=1,ig=cN()(Object.assign({Buffer:a5().Buffer,isLittleEndian:typeof Uint8Array!==void 0?new Uint8Array(new Uint32Array([305419896]).buffer)[0]===120:!0,is64bit:typeof navigator!==void 0?/WOW64|Win64|arm64|ia64|x64;|Mac OS X/i.test(navigator.userAgent):!0},dN()))),ig}var fN=hN();const pN=s_(fN),mN=async function(n,e="{let e="",t=crypto.getRandomValues(new Uint8Array(n|=0));for(;n--;)e+=gN[t[n]&63];return e};class a_{constructor(e,t){xe(this,"id",yN());xe(this,"analyserNode");xe(this,"audioCtx");xe(this,"autoPlay",!0);xe(this,"bufferSource");xe(this,"convertValue",32768);xe(this,"ee");xe(this,"gainNode");xe(this,"option",{inputCodec:"Int16",channels:1,sampleRate:8e3,fftSize:2048,onended:()=>{},isMute:!1});xe(this,"samplesList",[]);xe(this,"startTime");xe(this,"typedArray");xe(this,"_firstStartRelativeTime");xe(this,"_firstStartAbsoluteTime");this.ee=t,this.init(e)}static isTypedArray(e){return e.byteLength&&e.buffer&&e.buffer.constructor===ArrayBuffer||e.constructor===ArrayBuffer}async continue(){await this.audioCtx.resume()}destroy(){var e;this.samplesList=[],(e=this.audioCtx)==null||e.close(),this.audioCtx=void 0}feed(e){let{audio:t}=e;const{end_of_batch:i}=e;if(!t)return;this._isSupported(t),t=this._getFormattedValue(t);const r=new Float32Array(t.length);r.set(t,0);const s={data:r,end_of_batch:i};this.samplesList.push(s),this.flush(s,this.samplesList.length-1)}flush(e,t){if(!(e&&this.autoPlay&&this.audioCtx))return;const{data:i,end_of_batch:r}=e;this.bufferSource&&(this.bufferSource.onended=()=>{}),this.bufferSource=this.audioCtx.createBufferSource(),typeof this.option.onended=="function"&&(this.bufferSource.onended=()=>{!r&&t===this.samplesList.length-1&&this.ee.emit(Bl.Player_WaitNextAudioClip),this.option.onended()});const s=i.length/this.option.channels,o=this.audioCtx.createBuffer(this.option.channels,s,this.option.sampleRate);for(let a=0;a=s-51&&(l[d]=l[d]*u--/50),c+=this.option.channels}this.startTime{this.flush(t,i)})):this.autoPlay=e}volume(e){this.gainNode.gain.value=e}_getFormattedValue(e){const t=this.typedArray;e.constructor===ArrayBuffer?e=new t(e):e=new t(e.buffer);const i=new Float32Array(e.length);for(let r=0;rawait this._motionDataGroupHandler(t))}clear(){this._motionDataGroups.forEach(e=>{var t;(t=e.player)==null||t.destroy()}),this._motionDataGroups=[]}setMute(e){this._motionDataGroups.forEach(t=>{var i;(i=t.player)==null||i.setMute(e)})}getArkitFaceFrame(){return{arkitFace:this._getArkitFaceFrame()}}getLastBatchId(){let e;return this._motionDataGroups.forEach(t=>{t.batch_id&&(e=t.batch_id)}),e}getTtt2FaceFrame(){return{tts2Face:this._getTts2FaceFrame()}}interrupt(){this._motionDataGroups.forEach(e=>{var t;e.batch_id&&(this._maxBatchId=e.batch_id),(t=e.player)==null||t.destroy()}),this._motionDataGroups=[]}_getArkitFaceFrame(){if(!this._motionDataGroups.length)return null;const e=this._motionDataGroups.find(r=>r.player);if(!e)return null;const{arkitFaceArrayBufferArray:t,player:i}=e;if(i&&i._firstStartAbsoluteTime&&t&&t.length>0&&this._arkitFaceShape&&this._arkit_face_sample_rate){const r=Date.now()-i._firstStartAbsoluteTime;let s=0,o;i.samplesList.forEach((h,f)=>{o===void 0&&h.startTime!==void 0&&(o=h.startTime),h.startTime!==void 0&&h.startTime-o<=r/1e3&&(s=f)});const a=i.samplesList[s],l=r-a.startTime*1e3,c=Math.floor(l/1e3*this._arkit_face_sample_rate),u=new Float32Array(t[s]),d=u==null?void 0:u.slice(c*this._arkitFaceShape,c*this._arkitFaceShape+this._arkitFaceShape);if(d!=null&&d.length){const h={};return(this._arkit_face_channel_names||[]).forEach((p,g)=>{Object.assign(h,{[p]:d[g]})}),h}return null}return null}_getTts2FaceFrame(){if(!this._motionDataGroups.length)return null;const e=this._motionDataGroups.find(r=>r.player);if(!e)return null;const{tts2faceArrayBufferArray:t,player:i}=e;if(i&&i._firstStartAbsoluteTime&&t&&t.length>0&&this._tts2FaceShape&&this._tts2face_sample_rate){const r=Date.now()-i._firstStartAbsoluteTime;let s=0,o;i.samplesList.forEach((h,f)=>{o===void 0&&h.startTime!==void 0&&(o=h.startTime),h.startTime!==void 0&&h.startTime-o<=r/1e3&&(s=f)});const a=i.samplesList[s],l=r-a.startTime*1e3,c=Math.floor(l/1e3*this._tts2face_sample_rate),u=new Float32Array(t[s]),d=u==null?void 0:u.slice(c*this._tts2FaceShape,c*this._tts2FaceShape+this._tts2FaceShape);return d!=null&&d.length?d:null}return null}async _motionDataGroupHandler(e){try{const{first_package:t,motion_data_slice:i,segment_num:r,binary_size:s,use_binary_frame:o,is_audio_mute:a}=e;if(t){const l=this._motionDataGroups[this._motionDataGroups.length-1];l&&l.segment_num!==l.motion_data_slices.length&&this.ee.emit(xr.ErrorReceived,"lost data packets"),this._motionDataGroups.push({first_package:t,binary_size:s,segment_num:r,use_binary_frame:o,motion_data_slices:[],merged_motion_data:new Uint8Array(s)})}else{if(this._motionDataGroups.length===0||!i)return;const l=this._motionDataGroups[this._motionDataGroups.length-1],c=this._motionDataGroups[this._motionDataGroups.length-2];if(l.motion_data_slices.push(i),l.motion_data_slices.length===l.segment_num){const u=l.motion_data_slices[0],{parsedData:d,jsonSize:h,binSize:f}=await mN(u);l.jsonSize=h,l.binSize=f;const p=u.slice(12+l.jsonSize);if(p.size!==l.binSize&&this.ee.emit(q1.Chat_BinsizeError),!this._connectBatch(d,l,c))return;await this._handleArkitFaceConfig(d,l,c,p),await this._handleAudioConfig(d,l,c,p,a||!1),this._handleEvents(d)}}}catch(t){console.error("err",t),this.ee.emit(xr.ErrorReceived,t.message)}}async _handleAudioConfig(e,t,i,r,s){const{data_records:o={},end_of_batch:a}=e,{audio:l}=o;if(l){const{sample_rate:c,shape:u,data_offset:d,data_type:h}=l,f=vN[h],p=_N[h];if(t.player===void 0&&(i&&i.player&&i.batch_id===t.batch_id?t.player=i.player:c&&(t.player=new a_({inputCodec:f,channels:1,sampleRate:c,fftSize:1024,isMute:s,onended:S=>{if(!S)return;const{end_of_batch:E,lastMotionGroup:A}=S;if(E){const{batch_id:R,player:w}=A;this.ee.emit(Bl.Player_EndSpeaking,w),this._motionDataGroups=this._motionDataGroups.filter(M=>M.batch_id>R),this._motionDataGroups.length&&this._motionDataGroups[0].player?this._motionDataGroups[0].player.updateAutoPlay(!0):this.ee.emit(Bl.Player_NoLegacy)}}},this.ee)),a)){const S=t.player.option.onended;t.player.option.onended=()=>{S({end_of_batch:a,lastMotionGroup:t})}}const g=u.reduce((S,E)=>S*E,f==="Int16"?2:4),y=d,m=d+g,x=await r.slice(y,m).arrayBuffer(),_=this._motionDataGroups.find(S=>S.player);this._motionDataGroups.length&&t.player&&_&&_.player!==t.player&&(t.player.autoPlay=!1),t.player&&t.player.feed({audio:new p(x),end_of_batch:a})}else i&&i.player&&t.batch_id===i.batch_id&&(t.player=i.player)}async _handleArkitFaceConfig(e,t,i,r){const{data_records:s={}}=e,{arkit_face:o}=s;if(o){const{channel_names:a,shape:l,data_offset:c,sample_rate:u}=o;if(a&&!this._arkit_face_channel_names&&(this._arkit_face_channel_names=a,this._arkit_face_sample_rate=u),t.arkitFaceArrayBufferArray===void 0){i&&i.arkitFaceArrayBufferArray&&i.batch_id===t.batch_id?t.arkitFaceArrayBufferArray=i.arkitFaceArrayBufferArray:t.arkitFaceArrayBufferArray=[];const d=l.reduce((p,g)=>p*g,4);this._arkitFaceShape=l[1];const f=await r.slice(c,c+d).arrayBuffer();t.arkitFaceArrayBufferArray.push(f)}}else i&&i.arkitFaceArrayBufferArray&&t.batch_id===i.batch_id&&(t.arkitFaceArrayBufferArray=i.arkitFaceArrayBufferArray)}async _handletts2faceConfig(e,t,i,r){const{data_records:s={}}=e,{tts2face:o}=s;if(o){const{channel_names:a,shape:l,data_offset:c,sample_rate:u}=o;if(a&&!this._tts2face_channel_names&&(this._tts2face_channel_names=a,this._tts2face_sample_rate=u),t.tts2faceArrayBufferArray===void 0){i&&i.tts2faceArrayBufferArray&&i.batch_id===t.batch_id?t.tts2faceArrayBufferArray=i.tts2faceArrayBufferArray:t.tts2faceArrayBufferArray=[];const d=l.reduce((p,g)=>p*g,4);this._tts2FaceShape=l[1];const f=await r.slice(c,c+d).arrayBuffer();t.tts2faceArrayBufferArray.push(f)}}else i&&i.tts2faceArrayBufferArray&&t.batch_id===i.batch_id&&(t.tts2faceArrayBufferArray=i.tts2faceArrayBufferArray)}_handleEvents(e){const{events:t}=e;t&&t.length&&t.forEach(i=>{switch(i.event_type){case"interrupt_speech":break;case"change_status":this.ee.emit(q1.Change_Status,i);break}})}_connectBatch(e,t,i){let r=!0;return e.batch_id&&t.batch_id===void 0&&(t.batch_id=e.batch_id),!t.batch_id&&i&&i.batch_id&&(t.batch_id=i.batch_id),e.batch_name&&t.batch_name===void 0&&(t.batch_name=e.batch_name),this._maxBatchId&&t.batch_id&&t.batch_id<=this._maxBatchId&&(this.clear(),r=!1),r}}const vl=class vl{constructor(e,t){let i,r;this.promise=new Promise((c,u)=>{i=c,r=u});const s=i.bind(this),o=r.bind(this),a=(...c)=>{s(...c)},l=c=>{o(c)};e(a.bind(this),l.bind(this)),this.abortHandler=t,this.id=vl.idGen++}then(e){return new vl((t,i)=>{this.promise=this.promise.then((...r)=>{const s=e(...r);s instanceof Promise||s instanceof vl?s.then((...o)=>{t(...o)}):t(s)}).catch(r=>{i(r)})},this.abortHandler)}catch(e){return new vl(t=>{this.promise=this.promise.then((...i)=>{t(...i)}).catch(e)},this.abortHandler)}abort(e){this.abortHandler&&this.abortHandler(e)}};xe(vl,"idGen",0);let nh=vl;class Ap extends Error{constructor(e){super(e)}}(function(){const n=new Float32Array(1),e=new Int32Array(n.buffer);return function(t){n[0]=t;const i=e[0];let r=i>>16&32768,s=i>>12&2047;const o=i>>23&255;return o<103?r:o>142?(r|=31744,r|=(o==255?0:1)&&i&8388607,r):o<113?(s|=2048,r|=(s>>114-o)+(s>>113-o&1),r):(r|=o-112<<10|s>>1,r+=s&1,r)}})();const Vi=function(){const n=new Float32Array(1),e=new Int32Array(n.buffer);return function(t){return n[0]=t,e[0]}}(),SN=function(n,e){return n[e]+(n[e+1]<<8)+(n[e+2]<<16)+(n[e+3]<<24)},l_=function(n,e,t=!0,i){const r=new AbortController,s=r.signal;let o=!1;const a=l=>{r.abort(l),o=!0};return new nh((l,c)=>{const u={signal:s};i&&(u.headers=i),fetch(n,u).then(async d=>{if(!d.ok){const m=await d.text();c(new Error("Fetch failed: ".concat(d.status," ").concat(d.statusText," ").concat(m)));return}const h=d.body.getReader();let f=0,p=d.headers.get("Content-Length"),g=p?parseInt(p):void 0;const y=[];for(;!o;)try{const{value:m,done:v}=await h.read();if(v){if(e&&e(100,"100%",m,g),t){const S=new Blob(y).arrayBuffer();l(S)}else l();break}f+=m.length;let x,_;g!==void 0&&(x=f/g*100,_="".concat(x.toFixed(2),"%")),t&&y.push(m),e&&e(x,_,m,g)}catch(m){c(m);return}}).catch(d=>{c(new Ap(d))})},a)},gi=function(n,e,t){return Math.max(Math.min(n,t),e)},ec=function(){return performance.now()/1e3},Cc=n=>{if(n.geometry&&(n.geometry.dispose(),n.geometry=null),n.material&&(n.material.dispose(),n.material=null),n.children)for(let e of n.children)Cc(e)},ms=(n,e)=>new Promise(t=>{window.setTimeout(()=>{t(n())},e?1:50)}),Gc=(n=0)=>{switch(n){case 1:return 9;case 2:return 24}return 0},c_=()=>{let n,e;return{promise:new Promise((i,r)=>{n=i,e=r}),resolve:n,reject:e}},rg=n=>{let e,t;return n||(n=()=>{}),{promise:new nh((r,s)=>{e=r,t=s},n),resolve:e,reject:t}};class AN{constructor(e,t,i){this.major=e,this.minor=t,this.patch=i}toString(){return"".concat(this.major,"_").concat(this.minor,"_").concat(this.patch)}}function u_(){const n=navigator.userAgent;return n.indexOf("iPhone")>0||n.indexOf("iPad")>0}function l5(){if(u_()){const n=navigator.userAgent.match(/OS (\d+)_(\d+)_?(\d+)?/);return new AN(parseInt(n[1]||0,10),parseInt(n[2]||0,10),parseInt(n[3]||0,10))}else return null}const bN=14,jd=class jd{constructor(e=0){this.sphericalHarmonicsDegree=e,this.sphericalHarmonicsCount=Gc(this.sphericalHarmonicsDegree),this.componentCount=this.sphericalHarmonicsCount+bN,this.defaultSphericalHarmonics=new Array(this.sphericalHarmonicsCount).fill(0),this.splats=[],this.splatCount=0}static createSplat(e=0){const t=[0,0,0,1,1,1,1,0,0,0,0,0,0,0];let i=Gc(e);for(let r=0;r>8&255]+wi[n>>16&255]+wi[n>>24&255]+"-"+wi[e&255]+wi[e>>8&255]+"-"+wi[e>>16&15|64]+wi[e>>24&255]+"-"+wi[t&63|128]+wi[t>>8&255]+"-"+wi[t>>16&255]+wi[t>>24&255]+wi[i&255]+wi[i>>8&255]+wi[i>>16&255]+wi[i>>24&255]).toLowerCase()}function Nt(n,e,t){return Math.max(e,Math.min(t,n))}function v_(n,e){return(n%e+e)%e}function hP(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function fP(n,e,t){return n!==e?(t-n)/(e-n):0}function Bd(n,e,t){return(1-t)*n+t*e}function pP(n,e,t,i){return Bd(n,e,1-Math.exp(-t*i))}function mP(n,e=1){return e-Math.abs(v_(n,e*2)-e)}function gP(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function yP(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function vP(n,e){return n+Math.floor(Math.random()*(e-n+1))}function _P(n,e){return n+Math.random()*(e-n)}function xP(n){return n*(.5-Math.random())}function SP(n){n!==void 0&&(xS=n);let e=xS+=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 AP(n){return n*Od}function bP(n){return n*hu}function TP(n){return(n&n-1)===0&&n!==0}function wP(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function CP(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function EP(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),d=s((e-i)/2),h=o((e-i)/2),f=s((i-e)/2),p=o((i-e)/2);switch(r){case"XYX":n.set(a*u,l*d,l*h,a*c);break;case"YZY":n.set(l*h,a*u,l*d,a*c);break;case"ZXZ":n.set(l*d,l*h,a*u,a*c);break;case"XZX":n.set(a*u,l*p,l*f,a*c);break;case"YXY":n.set(l*f,a*u,l*p,a*c);break;case"ZYZ":n.set(l*p,l*f,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function fs(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 ln(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 Ta={DEG2RAD:Od,RAD2DEG:hu,generateUUID:xs,clamp:Nt,euclideanModulo:v_,mapLinear:hP,inverseLerp:fP,lerp:Bd,damp:pP,pingpong:mP,smoothstep:gP,smootherstep:yP,randInt:vP,randFloat:_P,randFloatSpread:xP,seededRandom:SP,degToRad:AP,radToDeg:bP,isPowerOfTwo:TP,ceilPowerOfTwo:wP,floorPowerOfTwo:CP,setQuaternionFromProperEuler:EP,normalize:ln,denormalize:fs};class qe{constructor(e=0,t=0){qe.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=Nt(this.x,e.x,t.x),this.y=Nt(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Nt(this.x,e,t),this.y=Nt(this.y,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Nt(i,e,t))}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(Nt(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 mt{constructor(e,t,i,r,s,o,a,l,c){mt.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],d=i[7],h=i[2],f=i[5],p=i[8],g=r[0],y=r[3],m=r[6],v=r[1],x=r[4],_=r[7],S=r[2],E=r[5],A=r[8];return s[0]=o*g+a*v+l*S,s[3]=o*y+a*x+l*E,s[6]=o*m+a*_+l*A,s[1]=c*g+u*v+d*S,s[4]=c*y+u*x+d*E,s[7]=c*m+u*_+d*A,s[2]=h*g+f*v+p*S,s[5]=h*y+f*x+p*E,s[8]=h*m+f*_+p*A,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],d=u*o-a*c,h=a*l-u*s,f=c*s-o*l,p=t*d+i*h+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const g=1/p;return e[0]=d*g,e[1]=(r*c-u*i)*g,e[2]=(a*i-r*o)*g,e[3]=h*g,e[4]=(u*t-r*l)*g,e[5]=(r*s-a*t)*g,e[6]=f*g,e[7]=(i*l-c*t)*g,e[8]=(o*t-i*s)*g,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(og.makeScale(e,t)),this}rotate(e){return this.premultiply(og.makeRotation(-e)),this}translate(e,t){return this.premultiply(og.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 og=new mt;function w5(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function ch(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function MP(){const n=ch("canvas");return n.style.display="block",n}const SS={};function Ec(n){n in SS||(SS[n]=!0,console.warn(n))}function RP(n,e,t){return new Promise(function(i,r){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:r();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:i()}}setTimeout(s,t)})}function IP(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function NP(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const AS=new mt().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),bS=new mt().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function PP(){const n={enabled:!0,workingColorSpace:Bi,spaces:{},convert:function(r,s,o){return this.enabled===!1||s===o||!s||!o||(this.spaces[s].transfer===Zt&&(r.r=Vo(r.r),r.g=Vo(r.g),r.b=Vo(r.b)),this.spaces[s].primaries!==this.spaces[o].primaries&&(r.applyMatrix3(this.spaces[s].toXYZ),r.applyMatrix3(this.spaces[o].fromXYZ)),this.spaces[o].transfer===Zt&&(r.r=Wc(r.r),r.g=Wc(r.g),r.b=Wc(r.b))),r},fromWorkingColorSpace:function(r,s){return this.convert(r,this.workingColorSpace,s)},toWorkingColorSpace:function(r,s){return this.convert(r,s,this.workingColorSpace)},getPrimaries:function(r){return this.spaces[r].primaries},getTransfer:function(r){return r===Vs?cm:this.spaces[r].transfer},getLuminanceCoefficients:function(r,s=this.workingColorSpace){return r.fromArray(this.spaces[s].luminanceCoefficients)},define:function(r){Object.assign(this.spaces,r)},_getMatrix:function(r,s,o){return r.copy(this.spaces[s].toXYZ).multiply(this.spaces[o].fromXYZ)},_getDrawingBufferColorSpace:function(r){return this.spaces[r].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(r=this.workingColorSpace){return this.spaces[r].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],i=[.3127,.329];return n.define({[Bi]:{primaries:e,whitePoint:i,transfer:cm,toXYZ:AS,fromXYZ:bS,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:fi},outputColorSpaceConfig:{drawingBufferColorSpace:fi}},[fi]:{primaries:e,whitePoint:i,transfer:Zt,toXYZ:AS,fromXYZ:bS,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:fi}}}),n}const wt=PP();function Vo(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Wc(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let rc;class LP{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{rc===void 0&&(rc=ch("canvas")),rc.width=e.width,rc.height=e.height;const i=rc.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=rc}return 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=ch("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;o0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==h_)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case cu:e.x=e.x-Math.floor(e.x);break;case Aa:e.x=e.x<0?0:1;break;case om: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 cu:e.y=e.y-Math.floor(e.y);break;case Aa:e.y=e.y<0?0:1;break;case om:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Wn.DEFAULT_IMAGE=null;Wn.DEFAULT_MAPPING=h_;Wn.DEFAULT_ANISOTROPY=1;class Mt{constructor(e=0,t=0,i=0,r=1){Mt.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}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const 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],d=l[8],h=l[1],f=l[5],p=l[9],g=l[2],y=l[6],m=l[10];if(Math.abs(u-h)<.01&&Math.abs(d-g)<.01&&Math.abs(p-y)<.01){if(Math.abs(u+h)<.1&&Math.abs(d+g)<.1&&Math.abs(p+y)<.1&&Math.abs(c+f+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,_=(f+1)/2,S=(m+1)/2,E=(u+h)/4,A=(d+g)/4,R=(p+y)/4;return x>_&&x>S?x<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(x),r=E/i,s=A/i):_>S?_<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(_),i=E/r,s=R/r):S<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(S),i=A/s,r=R/s),this.set(i,r,s,t),this}let v=Math.sqrt((y-p)*(y-p)+(d-g)*(d-g)+(h-u)*(h-u));return Math.abs(v)<.001&&(v=1),this.x=(y-p)/v,this.y=(d-g)/v,this.z=(h-u)/v,this.w=Math.acos((c+f+m-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Nt(this.x,e.x,t.x),this.y=Nt(this.y,e.y,t.y),this.z=Nt(this.z,e.z,t.z),this.w=Nt(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=Nt(this.x,e,t),this.y=Nt(this.y,e,t),this.z=Nt(this.z,e,t),this.w=Nt(this.w,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Nt(i,e,t))}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 Fh extends ro{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Mt(0,0,e,t),this.scissorTest=!1,this.viewport=new Mt(0,0,e,t);const r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Rr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},i);const s=new Wn(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=0?1:-1,x=1-m*m;if(x>Number.EPSILON){const S=Math.sqrt(x),E=Math.atan2(S,m*v);y=Math.sin(y*E)/S,a=Math.sin(a*E)/S}const _=a*v;if(l=l*y+h*_,c=c*y+f*_,u=u*y+p*_,d=d*y+g*_,y===1-a){const S=1/Math.sqrt(l*l+c*c+u*u+d*d);l*=S,c*=S,u*=S,d*=S}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=d}static multiplyQuaternionsFlat(e,t,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],u=i[r+3],d=s[o],h=s[o+1],f=s[o+2],p=s[o+3];return e[t]=a*p+u*d+l*f-c*h,e[t+1]=l*p+u*h+c*d-a*f,e[t+2]=c*p+u*f+a*h-l*d,e[t+3]=u*p-a*d-l*h-c*f,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),d=a(s/2),h=l(i/2),f=l(r/2),p=l(s/2);switch(o){case"XYZ":this._x=h*u*d+c*f*p,this._y=c*f*d-h*u*p,this._z=c*u*p+h*f*d,this._w=c*u*d-h*f*p;break;case"YXZ":this._x=h*u*d+c*f*p,this._y=c*f*d-h*u*p,this._z=c*u*p-h*f*d,this._w=c*u*d+h*f*p;break;case"ZXY":this._x=h*u*d-c*f*p,this._y=c*f*d+h*u*p,this._z=c*u*p+h*f*d,this._w=c*u*d-h*f*p;break;case"ZYX":this._x=h*u*d-c*f*p,this._y=c*f*d+h*u*p,this._z=c*u*p-h*f*d,this._w=c*u*d+h*f*p;break;case"YZX":this._x=h*u*d+c*f*p,this._y=c*f*d+h*u*p,this._z=c*u*p-h*f*d,this._w=c*u*d-h*f*p;break;case"XZY":this._x=h*u*d-c*f*p,this._y=c*f*d-h*u*p,this._z=c*u*p+h*f*d,this._w=c*u*d+h*f*p;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],d=t[10],h=i+a+d;if(h>0){const f=.5/Math.sqrt(h+1);this._w=.25/f,this._x=(u-l)*f,this._y=(s-c)*f,this._z=(o-r)*f}else if(i>a&&i>d){const f=2*Math.sqrt(1+i-a-d);this._w=(u-l)/f,this._x=.25*f,this._y=(r+o)/f,this._z=(s+c)/f}else if(a>d){const f=2*Math.sqrt(1+a-i-d);this._w=(s-c)/f,this._x=(r+o)/f,this._y=.25*f,this._z=(l+u)/f}else{const f=2*Math.sqrt(1+d-i-a);this._w=(o-r)/f,this._x=(s+c)/f,this._y=(l+u)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.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(Nt(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 f=1-t;return this._w=f*o+t*this._w,this._x=f*i+t*this._x,this._y=f*r+t*this._y,this._z=f*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),d=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=o*d+this._w*h,this._x=i*d+this._x*h,this._y=r*d+this._y*h,this._z=s*d+this._z*h,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 Y{constructor(e=0,t=0,i=0){Y.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(TS.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(TS.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),d=2*(s*i-o*t);return this.x=t+l*c+o*d-a*u,this.y=i+l*u+a*c-s*d,this.z=r+l*d+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=Nt(this.x,e.x,t.x),this.y=Nt(this.y,e.y,t.y),this.z=Nt(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Nt(this.x,e,t),this.y=Nt(this.y,e,t),this.z=Nt(this.z,e,t),this}clampLength(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Nt(i,e,t))}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 lg.copy(this).projectOnVector(e),this.sub(lg)}reflect(e){return this.sub(lg.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(Nt(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 lg=new Y,TS=new Qt;class rr{constructor(e=new Y(1/0,1/0,1/0),t=new Y(-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=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,ls),ls.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(td),yf.subVectors(this.max,td),sc.subVectors(e.a,td),oc.subVectors(e.b,td),ac.subVectors(e.c,td),ra.subVectors(oc,sc),sa.subVectors(ac,oc),Ya.subVectors(sc,ac);let t=[0,-ra.z,ra.y,0,-sa.z,sa.y,0,-Ya.z,Ya.y,ra.z,0,-ra.x,sa.z,0,-sa.x,Ya.z,0,-Ya.x,-ra.y,ra.x,0,-sa.y,sa.x,0,-Ya.y,Ya.x,0];return!cg(t,sc,oc,ac,yf)||(t=[1,0,0,0,1,0,0,0,1],!cg(t,sc,oc,ac,yf))?!1:(vf.crossVectors(ra,sa),t=[vf.x,vf.y,vf.z],cg(t,sc,oc,ac,yf))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,ls).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(ls).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:(fo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),fo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),fo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),fo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),fo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),fo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),fo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),fo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(fo),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 fo=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],ls=new Y,gf=new rr,sc=new Y,oc=new Y,ac=new Y,ra=new Y,sa=new Y,Ya=new Y,td=new Y,yf=new Y,vf=new Y,Za=new Y;function cg(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Za.fromArray(n,s);const a=r.x*Math.abs(Za.x)+r.y*Math.abs(Za.y)+r.z*Math.abs(Za.z),l=e.dot(Za),c=t.dot(Za),u=i.dot(Za);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const BP=new rr,nd=new Y,ug=new Y;class so{constructor(e=new Y,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):BP.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;nd.subVectors(e,this.center);const t=nd.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(nd,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):(ug.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(nd.copy(e.center).add(ug)),this.expandByPoint(nd.copy(e.center).sub(ug))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const po=new Y,dg=new Y,_f=new Y,oa=new Y,hg=new Y,xf=new Y,fg=new Y;let Oh=class{constructor(e=new Y,t=new Y(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,po)),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=po.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(po.copy(this.origin).addScaledVector(this.direction,t),po.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){dg.copy(e).add(t).multiplyScalar(.5),_f.copy(t).sub(e).normalize(),oa.copy(this.origin).sub(dg);const s=e.distanceTo(t)*.5,o=-this.direction.dot(_f),a=oa.dot(this.direction),l=-oa.dot(_f),c=oa.lengthSq(),u=Math.abs(1-o*o);let d,h,f,p;if(u>0)if(d=o*l-a,h=o*a-l,p=s*u,d>=0)if(h>=-p)if(h<=p){const g=1/u;d*=g,h*=g,f=d*(d+o*h+2*a)+h*(o*d+h+2*l)+c}else h=s,d=Math.max(0,-(o*h+a)),f=-d*d+h*(h+2*l)+c;else h=-s,d=Math.max(0,-(o*h+a)),f=-d*d+h*(h+2*l)+c;else h<=-p?(d=Math.max(0,-(-o*s+a)),h=d>0?-s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c):h<=p?(d=0,h=Math.min(Math.max(-s,-l),s),f=h*(h+2*l)+c):(d=Math.max(0,-(o*s+a)),h=d>0?s:Math.min(Math.max(-s,-l),s),f=-d*d+h*(h+2*l)+c);else h=o>0?-s:s,d=Math.max(0,-(o*h+a)),f=-d*d+h*(h+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,d),r&&r.copy(dg).addScaledVector(_f,h),f}intersectSphere(e,t){po.subVectors(e.center,this.origin);const i=po.dot(this.direction),r=po.dot(po)-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,d=1/this.direction.z,h=this.origin;return c>=0?(i=(e.min.x-h.x)*c,r=(e.max.x-h.x)*c):(i=(e.max.x-h.x)*c,r=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,o=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o=0?(a=(e.min.z-h.z)*d,l=(e.max.z-h.z)*d):(a=(e.max.z-h.z)*d,l=(e.min.z-h.z)*d),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,po)!==null}intersectTriangle(e,t,i,r,s){hg.subVectors(t,e),xf.subVectors(i,e),fg.crossVectors(hg,xf);let o=this.direction.dot(fg),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;oa.subVectors(this.origin,e);const l=a*this.direction.dot(xf.crossVectors(oa,xf));if(l<0)return null;const c=a*this.direction.dot(hg.cross(oa));if(c<0||l+c>o)return null;const u=-a*oa.dot(fg);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 Xe{constructor(e,t,i,r,s,o,a,l,c,u,d,h,f,p,g,y){Xe.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,d,h,f,p,g,y)}set(e,t,i,r,s,o,a,l,c,u,d,h,f,p,g,y){const m=this.elements;return m[0]=e,m[4]=t,m[8]=i,m[12]=r,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=c,m[6]=u,m[10]=d,m[14]=h,m[3]=f,m[7]=p,m[11]=g,m[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Xe().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/lc.setFromMatrixColumn(e,0).length(),s=1/lc.setFromMatrixColumn(e,1).length(),o=1/lc.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),d=Math.sin(s);if(e.order==="XYZ"){const h=o*u,f=o*d,p=a*u,g=a*d;t[0]=l*u,t[4]=-l*d,t[8]=c,t[1]=f+p*c,t[5]=h-g*c,t[9]=-a*l,t[2]=g-h*c,t[6]=p+f*c,t[10]=o*l}else if(e.order==="YXZ"){const h=l*u,f=l*d,p=c*u,g=c*d;t[0]=h+g*a,t[4]=p*a-f,t[8]=o*c,t[1]=o*d,t[5]=o*u,t[9]=-a,t[2]=f*a-p,t[6]=g+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*u,f=l*d,p=c*u,g=c*d;t[0]=h-g*a,t[4]=-o*d,t[8]=p+f*a,t[1]=f+p*a,t[5]=o*u,t[9]=g-h*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*u,f=o*d,p=a*u,g=a*d;t[0]=l*u,t[4]=p*c-f,t[8]=h*c+g,t[1]=l*d,t[5]=g*c+h,t[9]=f*c-p,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,f=o*c,p=a*l,g=a*c;t[0]=l*u,t[4]=g-h*d,t[8]=p*d+f,t[1]=d,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=f*d+p,t[10]=h-g*d}else if(e.order==="XZY"){const h=o*l,f=o*c,p=a*l,g=a*c;t[0]=l*u,t[4]=-d,t[8]=c*u,t[1]=h*d+g,t[5]=o*u,t[9]=f*d-p,t[2]=p*d-f,t[6]=a*u,t[10]=g*d+h}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(kP,e,UP)}lookAt(e,t,i){const r=this.elements;return hr.subVectors(e,t),hr.lengthSq()===0&&(hr.z=1),hr.normalize(),aa.crossVectors(i,hr),aa.lengthSq()===0&&(Math.abs(i.z)===1?hr.x+=1e-4:hr.z+=1e-4,hr.normalize(),aa.crossVectors(i,hr)),aa.normalize(),Sf.crossVectors(hr,aa),r[0]=aa.x,r[4]=Sf.x,r[8]=hr.x,r[1]=aa.y,r[5]=Sf.y,r[9]=hr.y,r[2]=aa.z,r[6]=Sf.z,r[10]=hr.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],d=i[5],h=i[9],f=i[13],p=i[2],g=i[6],y=i[10],m=i[14],v=i[3],x=i[7],_=i[11],S=i[15],E=r[0],A=r[4],R=r[8],w=r[12],M=r[1],I=r[5],L=r[9],k=r[13],T=r[2],F=r[6],V=r[10],Q=r[14],ee=r[3],se=r[7],he=r[11],ie=r[15];return s[0]=o*E+a*M+l*T+c*ee,s[4]=o*A+a*I+l*F+c*se,s[8]=o*R+a*L+l*V+c*he,s[12]=o*w+a*k+l*Q+c*ie,s[1]=u*E+d*M+h*T+f*ee,s[5]=u*A+d*I+h*F+f*se,s[9]=u*R+d*L+h*V+f*he,s[13]=u*w+d*k+h*Q+f*ie,s[2]=p*E+g*M+y*T+m*ee,s[6]=p*A+g*I+y*F+m*se,s[10]=p*R+g*L+y*V+m*he,s[14]=p*w+g*k+y*Q+m*ie,s[3]=v*E+x*M+_*T+S*ee,s[7]=v*A+x*I+_*F+S*se,s[11]=v*R+x*L+_*V+S*he,s[15]=v*w+x*k+_*Q+S*ie,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],d=e[6],h=e[10],f=e[14],p=e[3],g=e[7],y=e[11],m=e[15];return p*(+s*l*d-r*c*d-s*a*h+i*c*h+r*a*f-i*l*f)+g*(+t*l*f-t*c*h+s*o*h-r*o*f+r*c*u-s*l*u)+y*(+t*c*d-t*a*f-s*o*d+i*o*f+s*a*u-i*c*u)+m*(-r*a*u-t*l*d+t*a*h+r*o*d-i*o*h+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],d=e[9],h=e[10],f=e[11],p=e[12],g=e[13],y=e[14],m=e[15],v=d*y*c-g*h*c+g*l*f-a*y*f-d*l*m+a*h*m,x=p*h*c-u*y*c-p*l*f+o*y*f+u*l*m-o*h*m,_=u*g*c-p*d*c+p*a*f-o*g*f-u*a*m+o*d*m,S=p*d*l-u*g*l-p*a*h+o*g*h+u*a*y-o*d*y,E=t*v+i*x+r*_+s*S;if(E===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/E;return e[0]=v*A,e[1]=(g*h*s-d*y*s-g*r*f+i*y*f+d*r*m-i*h*m)*A,e[2]=(a*y*s-g*l*s+g*r*c-i*y*c-a*r*m+i*l*m)*A,e[3]=(d*l*s-a*h*s-d*r*c+i*h*c+a*r*f-i*l*f)*A,e[4]=x*A,e[5]=(u*y*s-p*h*s+p*r*f-t*y*f-u*r*m+t*h*m)*A,e[6]=(p*l*s-o*y*s-p*r*c+t*y*c+o*r*m-t*l*m)*A,e[7]=(o*h*s-u*l*s+u*r*c-t*h*c-o*r*f+t*l*f)*A,e[8]=_*A,e[9]=(p*d*s-u*g*s-p*i*f+t*g*f+u*i*m-t*d*m)*A,e[10]=(o*g*s-p*a*s+p*i*c-t*g*c-o*i*m+t*a*m)*A,e[11]=(u*a*s-o*d*s-u*i*c+t*d*c+o*i*f-t*a*f)*A,e[12]=S*A,e[13]=(u*g*r-p*d*r+p*i*h-t*g*h-u*i*y+t*d*y)*A,e[14]=(p*a*r-o*g*r-p*i*l+t*g*l+o*i*y-t*a*y)*A,e[15]=(o*d*r-u*a*r+u*i*l-t*d*l-o*i*h+t*a*h)*A,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,d=a+a,h=s*c,f=s*u,p=s*d,g=o*u,y=o*d,m=a*d,v=l*c,x=l*u,_=l*d,S=i.x,E=i.y,A=i.z;return r[0]=(1-(g+m))*S,r[1]=(f+_)*S,r[2]=(p-x)*S,r[3]=0,r[4]=(f-_)*E,r[5]=(1-(h+m))*E,r[6]=(y+v)*E,r[7]=0,r[8]=(p+x)*A,r[9]=(y-v)*A,r[10]=(1-(h+g))*A,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=lc.set(r[0],r[1],r[2]).length();const o=lc.set(r[4],r[5],r[6]).length(),a=lc.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],cs.copy(this);const c=1/s,u=1/o,d=1/a;return cs.elements[0]*=c,cs.elements[1]*=c,cs.elements[2]*=c,cs.elements[4]*=u,cs.elements[5]*=u,cs.elements[6]*=u,cs.elements[8]*=d,cs.elements[9]*=d,cs.elements[10]*=d,t.setFromRotationMatrix(cs),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=Ir){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),d=(t+e)/(t-e),h=(i+r)/(i-r);let f,p;if(a===Ir)f=-(o+s)/(o-s),p=-2*o*s/(o-s);else if(a===Qo)f=-o/(o-s),p=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=h,l[13]=0,l[2]=0,l[6]=0,l[10]=f,l[14]=p,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=Ir){const l=this.elements,c=1/(t-e),u=1/(i-r),d=1/(o-s),h=(t+e)*c,f=(i+r)*u;let p,g;if(a===Ir)p=(o+s)*d,g=-2*d;else if(a===Qo)p=s*d,g=-1*d;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-h,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-f,l[2]=0,l[6]=0,l[10]=g,l[14]=-p,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 lc=new Y,cs=new Xe,kP=new Y(0,0,0),UP=new Y(1,1,1),aa=new Y,Sf=new Y,hr=new Y,wS=new Xe,CS=new Qt;class ws{constructor(e=0,t=0,i=0,r=ws.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],d=r[2],h=r[6],f=r[10];switch(t){case"XYZ":this._y=Math.asin(Nt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Nt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-d,s),this._z=0);break;case"ZXY":this._x=Math.asin(Nt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-d,f),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Nt(d,-1,1)),Math.abs(d)<.9999999?(this._x=Math.atan2(h,f),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Nt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-d,s)):(this._x=0,this._y=Math.atan2(a,f));break;case"XZY":this._z=Math.asin(-Nt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,f),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 wS.makeRotationFromQuaternion(e),this.setFromRotationMatrix(wS,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return CS.setFromEuler(this),this.setFromQuaternion(CS,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}}ws.DEFAULT_ORDER="XYZ";class E5{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(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.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.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;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),d.length>0&&(i.shapes=d),h.length>0&&(i.skeletons=h),f.length>0&&(i.animations=f),p.length>0&&(i.nodes=p)}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;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){us.subVectors(r,t),go.subVectors(i,t),mg.subVectors(e,t);const o=us.dot(us),a=us.dot(go),l=us.dot(mg),c=go.dot(go),u=go.dot(mg),d=o*c-a*a;if(d===0)return s.set(0,0,0),null;const h=1/d,f=(c*l-a*u)*h,p=(o*u-a*l)*h;return s.set(1-f-p,p,f)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,yo)===null?!1:yo.x>=0&&yo.y>=0&&yo.x+yo.y<=1}static getInterpolation(e,t,i,r,s,o,a,l){return this.getBarycoord(e,t,i,r,yo)===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,yo.x),l.addScaledVector(o,yo.y),l.addScaledVector(a,yo.z),l)}static getInterpolatedAttribute(e,t,i,r,s,o){return _g.setScalar(0),xg.setScalar(0),Sg.setScalar(0),_g.fromBufferAttribute(e,t),xg.fromBufferAttribute(e,i),Sg.fromBufferAttribute(e,r),o.setScalar(0),o.addScaledVector(_g,s.x),o.addScaledVector(xg,s.y),o.addScaledVector(Sg,s.z),o}static isFrontFacing(e,t,i,r){return us.subVectors(i,t),go.subVectors(e,t),us.cross(go).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 us.subVectors(this.c,this.b),go.subVectors(this.a,this.b),us.cross(go).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return ps.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return ps.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return ps.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return ps.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return ps.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;dc.subVectors(r,i),hc.subVectors(s,i),gg.subVectors(e,i);const l=dc.dot(gg),c=hc.dot(gg);if(l<=0&&c<=0)return t.copy(i);yg.subVectors(e,r);const u=dc.dot(yg),d=hc.dot(yg);if(u>=0&&d<=u)return t.copy(r);const h=l*d-u*c;if(h<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(dc,o);vg.subVectors(e,s);const f=dc.dot(vg),p=hc.dot(vg);if(p>=0&&f<=p)return t.copy(s);const g=f*c-l*p;if(g<=0&&c>=0&&p<=0)return a=c/(c-p),t.copy(i).addScaledVector(hc,a);const y=u*p-f*d;if(y<=0&&d-u>=0&&f-p>=0)return PS.subVectors(s,r),a=(d-u)/(d-u+(f-p)),t.copy(r).addScaledVector(PS,a);const m=1/(y+g+h);return o=g*m,a=h*m,t.copy(i).addScaledVector(dc,o).addScaledVector(hc,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const M5={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},la={h:0,s:0,l:0},bf={h:0,s:0,l:0};function Ag(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 gt{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=fi){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,wt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=wt.workingColorSpace){return this.r=e,this.g=t,this.b=i,wt.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=wt.workingColorSpace){if(e=v_(e,1),t=Nt(t,0,1),i=Nt(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=Ag(o,s,e+1/3),this.g=Ag(o,s,e),this.b=Ag(o,s,e-1/3)}return wt.toWorkingColorSpace(this,r),this}setStyle(e,t=fi){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=fi){const i=M5[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=Vo(e.r),this.g=Vo(e.g),this.b=Vo(e.b),this}copyLinearToSRGB(e){return this.r=Wc(e.r),this.g=Wc(e.g),this.b=Wc(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=fi){return wt.fromWorkingColorSpace(Ci.copy(this),e),Math.round(Nt(Ci.r*255,0,255))*65536+Math.round(Nt(Ci.g*255,0,255))*256+Math.round(Nt(Ci.b*255,0,255))}getHexString(e=fi){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=wt.workingColorSpace){wt.fromWorkingColorSpace(Ci.copy(this),t);const i=Ci.r,r=Ci.g,s=Ci.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 d=o-a;switch(c=u<=.5?d/(o+a):d/(2-o-a),o){case i:l=(r-s)/d+(r0!=e>0&&this.version++,this._alphaTest=e}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 '".concat(t,"' has value of undefined."));continue}const r=this[t];if(r===void 0){console.warn("THREE.Material: '".concat(t,"' is not a property of THREE.").concat(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"}};i.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.dispersion!==void 0&&(i.dispersion=this.dispersion),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!==zo&&(i.blending=this.blending),this.side!==bs&&(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!==ih&&(i.blendSrc=this.blendSrc),this.blendDst!==rh&&(i.blendDst=this.blendDst),this.blendEquation!==hl&&(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!==lu&&(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!==vS&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ic&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ic&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ic&&(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++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class Yr extends es{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new gt(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 ws,this.combine=d5,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 Lo=WP();function WP(){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)===0;)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 QP(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=Nt(n,-65504,65504),Lo.floatView[0]=n;const e=Lo.uint32View[0],t=e>>23&511;return Lo.baseTable[t]+((e&8388607)>>Lo.shiftTable[t])}function jP(n){const e=n>>10;return Lo.uint32View[0]=Lo.mantissaTable[Lo.offsetTable[e]+(n&1023)]+Lo.exponentTable[e],Lo.floatView[0]}const uh={toHalfFloat:QP,fromHalfFloat:jP},zn=new Y,Tf=new qe;let qP=0;class xi{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:qP++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=um,this.updateRanges=[],this.gpuType=ir,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}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;rt.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new rr);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 Y(-1/0,-1/0,-1/0),new Y(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const 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 d=0,h=c.length;d0&&(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=[],d=s[c];for(let h=0,f=d.length;h0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(LS.copy(s).invert(),Ja.copy(e.ray).applyMatrix4(LS),!(i.boundingBox!==null&&Ja.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,Ja)))}_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,d=s.attributes.normal,h=s.groups,f=s.drawRange;if(a!==null)if(Array.isArray(o))for(let p=0,g=h.length;pt.far?null:{distance:c,point:If.clone(),object:n}}function Nf(n,e,t,i,r,s,o,a,l,c){n.getVertexPosition(a,Cf),n.getVertexPosition(l,Ef),n.getVertexPosition(c,Mf);const u=KP(n,e,t,i,Cf,Ef,Mf,FS);if(u){const d=new Y;ps.getBarycoord(FS,Cf,Ef,Mf,d),r&&(u.uv=ps.getInterpolatedAttribute(r,a,l,c,d,new qe)),s&&(u.uv1=ps.getInterpolatedAttribute(s,a,l,c,d,new qe)),o&&(u.normal=ps.getInterpolatedAttribute(o,a,l,c,d,new Y),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new Y,materialIndex:0};ps.getNormal(Cf,Ef,Mf,h.normal),u.face=h,u.barycoord=d}return u}class Pu extends ki{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=[],d=[];let h=0,f=0;p("z","y","x",-1,-1,i,t,e,o,s,0),p("z","y","x",1,-1,i,t,-e,o,s,1),p("x","z","y",1,1,e,i,t,r,o,2),p("x","z","y",1,-1,e,i,-t,r,o,3),p("x","y","z",1,-1,e,t,i,r,s,4),p("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new Si(c,3)),this.setAttribute("normal",new Si(u,3)),this.setAttribute("uv",new Si(d,2));function p(g,y,m,v,x,_,S,E,A,R,w){const M=_/A,I=S/R,L=_/2,k=S/2,T=E/2,F=A+1,V=R+1;let Q=0,ee=0;const se=new Y;for(let he=0;he0?1:-1,u.push(se.x,se.y,se.z),d.push(re/A),d.push(1-he/R),Q+=1}}for(let he=0;he0&&(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 P5 extends nn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Xe,this.projectionMatrix=new Xe,this.projectionMatrixInverse=new Xe,this.coordinateSystem=Ir}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 ca=new Y,OS=new qe,BS=new qe;class Ki extends P5{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=hu*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Od*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return hu*2*Math.atan(Math.tan(Od*.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){ca.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ca.x,ca.y).multiplyScalar(-e/ca.z),ca.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(ca.x,ca.y).multiplyScalar(-e/ca.z)}getViewSize(e,t){return this.getViewBounds(e,OS,BS),t.subVectors(BS,OS)}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(Od*.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 pc=-90,mc=1;class tL extends nn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Ki(pc,mc,e,t);r.layers=this.layers,this.add(r);const s=new Ki(pc,mc,e,t);s.layers=this.layers,this.add(s);const o=new Ki(pc,mc,e,t);o.layers=this.layers,this.add(o);const a=new Ki(pc,mc,e,t);a.layers=this.layers,this.add(a);const l=new Ki(pc,mc,e,t);l.layers=this.layers,this.add(l);const c=new Ki(pc,mc,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===Ir)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===Qo)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,d=e.getRenderTarget(),h=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const g=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=g,e.setRenderTarget(i,5,r),e.render(t,u),e.setRenderTarget(d,h,f),e.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class L5 extends Wn{constructor(e,t,i,r,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:kl,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 nL extends Fa{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 L5(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:Rr}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:"\n\n varying vec3 vWorldDirection;\n\n vec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n }\n\n void main() {\n\n vWorldDirection = transformDirection( position, modelMatrix );\n\n #include \n #include \n\n }\n ",fragmentShader:"\n\n uniform sampler2D tEquirect;\n\n varying vec3 vWorldDirection;\n\n #include \n\n void main() {\n\n vec3 direction = normalize( vWorldDirection );\n\n vec2 sampleUV = equirectUv( direction );\n\n gl_FragColor = texture2D( tEquirect, sampleUV );\n\n }\n "},r=new Pu(5,5,5),s=new Pr({name:"CubemapFromEquirect",uniforms:fu(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Fi,blending:Ia});s.uniforms.tEquirect.value=t;const o=new pn(r,s),a=t.minFilter;return t.minFilter===Hs&&(t.minFilter=Rr),new tL(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)}}class xl extends nn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const iL={type:"move"};class wg{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new xl,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 xl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new xl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y),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 g of e.hand.values()){const y=t.getJointPose(g,i),m=this._getHandJoint(c,g);y!==null&&(m.matrix.fromArray(y.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=y.radius),m.visible=y!==null}const u=c.joints["index-finger-tip"],d=c.joints["thumb-tip"],h=u.position.distanceTo(d.position),f=.02,p=.005;c.inputState.pinching&&h>f+p?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=f-p&&(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(iL)))}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 xl;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class rL extends nn{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 ws,this.environmentIntensity=1,this.environmentRotation=new ws,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.environmentIntensity=e.environmentIntensity,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(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class x_{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=um,this.updateRanges=[],this.version=0,this.uuid=xs()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}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;r1?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||dL.getNormalMatrix(e),r=this.coplanarPoint(Mg).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 el=new so,Df=new Y;class S_{constructor(e=new Co,t=new Co,i=new Co,r=new Co,s=new Co,o=new Co){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=Ir){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],d=r[6],h=r[7],f=r[8],p=r[9],g=r[10],y=r[11],m=r[12],v=r[13],x=r[14],_=r[15];if(i[0].setComponents(l-s,h-c,y-f,_-m).normalize(),i[1].setComponents(l+s,h+c,y+f,_+m).normalize(),i[2].setComponents(l+o,h+u,y+p,_+v).normalize(),i[3].setComponents(l-o,h-u,y-p,_-v).normalize(),i[4].setComponents(l-a,h-d,y-g,_-x).normalize(),t===Ir)i[5].setComponents(l+a,h+d,y+g,_+x).normalize();else if(t===Qo)i[5].setComponents(a,d,g,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(),el.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),el.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(el)}intersectsSprite(e){return el.center.set(0,0,0),el.radius=.7071067811865476,el.applyMatrix4(e.matrixWorld),this.intersectsSphere(el)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,Df.y=r.normal.y>0?e.max.y:e.min.y,Df.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(Df)<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)}}class D5 extends es{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new gt(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 dm=new Y,hm=new Y,QS=new Xe,ad=new Oh,Ff=new so,Rg=new Y,jS=new Y;class A_ extends nn{constructor(e=new ki,t=new D5){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;r0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;si)return;Rg.applyMatrix4(n.matrixWorld);const c=e.ray.origin.distanceTo(Rg);if(!(ce.far))return{distance:c,point:jS.clone().applyMatrix4(n.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:n}}const qS=new Y,XS=new Y;class hL extends A_{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;r0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class O5 extends Wn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=_i,this.minFilter=_i,this.generateMipmaps=!1,this.needsUpdate=!0}}class Ua extends Wn{constructor(e,t,i,r,s,o,a,l,c,u=Ml){if(u!==Ml&&u!==du)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===Ml&&(i=Ni),i===void 0&&u===du&&(i=uu),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:_i,this.minFilter=l!==void 0?l:_i,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class hh extends ki{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=[],d=[],h=[],f=[];let p=0;const g=[],y=i/2;let m=0;v(),o===!1&&(e>0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new Si(d,3)),this.setAttribute("normal",new Si(h,3)),this.setAttribute("uv",new Si(f,2));function v(){const _=new Y,S=new Y;let E=0;const A=(t-e)/i;for(let R=0;R<=s;R++){const w=[],M=R/s,I=M*(t-e)+e;for(let L=0;L<=r;L++){const k=L/r,T=k*l+a,F=Math.sin(T),V=Math.cos(T);S.x=I*F,S.y=-M*i+y,S.z=I*V,d.push(S.x,S.y,S.z),_.set(F,A,V).normalize(),h.push(_.x,_.y,_.z),f.push(k,1-M),w.push(p++)}g.push(w)}for(let R=0;R0||w!==0)&&(u.push(M,I,k),E+=3),(t>0||w!==s-1)&&(u.push(I,L,k),E+=3)}c.addGroup(m,E,0),m+=E}function x(_){const S=p,E=new qe,A=new Y;let R=0;const w=_===!0?e:t,M=_===!0?1:-1;for(let L=1;L<=r;L++)d.push(0,y*M,0),h.push(0,M,0),f.push(.5,.5),p++;const I=p;for(let L=0;L<=r;L++){const T=L/r*l+a,F=Math.cos(T),V=Math.sin(T);A.x=w*V,A.y=y*M,A.z=w*F,d.push(A.x,A.y,A.z),h.push(0,M,0),E.x=F*.5+.5,E.y=V*.5*M+.5,f.push(E.x,E.y),p++}for(let L=0;L0)&&f.push(x,_,E),(m!==i-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=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.dispersion=e.dispersion,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 mL extends es{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=rP,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 gL extends es{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}}function Uf(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 yL(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function vL(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 ZS(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 B5(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)}class Bh{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=s)){const a=t[1];e=s)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--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&&yL(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()===sg,s=e.length-1;let o=1;for(let a=1;a0){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}}ao.prototype.TimeBufferType=Float32Array;ao.prototype.ValueBufferType=Float32Array;ao.prototype.DefaultInterpolation=lh;class Lu extends ao{constructor(e,t,i){super(e,t,i)}}Lu.prototype.ValueTypeName="bool";Lu.prototype.ValueBufferType=Array;Lu.prototype.DefaultInterpolation=ah;Lu.prototype.InterpolantFactoryMethodLinear=void 0;Lu.prototype.InterpolantFactoryMethodSmooth=void 0;class U5 extends ao{}U5.prototype.ValueTypeName="color";class mu extends ao{}mu.prototype.ValueTypeName="number";class SL extends Bh{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)Qt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class gu extends ao{InterpolantFactoryMethodLinear(e){return new SL(this.times,this.values,this.getValueSize(),e)}}gu.prototype.ValueTypeName="quaternion";gu.prototype.InterpolantFactoryMethodSmooth=void 0;class Du extends ao{constructor(e,t,i){super(e,t,i)}}Du.prototype.ValueTypeName="string";Du.prototype.ValueBufferType=Array;Du.prototype.DefaultInterpolation=ah;Du.prototype.InterpolantFactoryMethodLinear=void 0;Du.prototype.InterpolantFactoryMethodSmooth=void 0;class yu extends ao{}yu.prototype.ValueTypeName="vector";class Dy{constructor(e="",t=-1,i=[],r=y_){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=xs(),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(bL(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(ao.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,o=[];for(let a=0;a1){const d=u[1];let h=r[d];h||(r[d]=h=[]),h.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(d,h,f,p,g){if(f.length!==0){const y=[],m=[];B5(f,y,m,p),y.length!==0&&g.push(new d(h,y,m))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let d=0;d{t&&t(s),this.manager.itemEnd(e)},0),s;if(vo[e]!==void 0){vo[e].push({onLoad:t,onProgress:i,onError:r});return}vo[e]=[],vo[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=vo[e],d=c.body.getReader(),h=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),f=h?parseInt(h):0,p=f!==0;let g=0;const y=new ReadableStream({start(m){v();function v(){d.read().then(({done:x,value:_})=>{if(x)m.close();else{g+=_.byteLength;const S=new ProgressEvent("progress",{lengthComputable:p,loaded:g,total:f});for(let E=0,A=u.length;E{m.error(x)})}}});return new Response(y)}else throw new CL('fetch for "'.concat(c.url,'" responded with ').concat(c.status,": ").concat(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 d=/charset="?([^;"\s]*)"?/i.exec(a),h=d&&d[1]?d[1].toLowerCase():void 0,f=new TextDecoder(h);return c.arrayBuffer().then(p=>f.decode(p))}}}).then(c=>{wa.add(e,c);const u=vo[e];delete vo[e];for(let d=0,h=u.length;d{const u=vo[e];if(u===void 0)throw this.manager.itemError(e),c;delete vo[e];for(let d=0,h=u.length;d{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class EL extends Fu{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=wa.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=ch("img");function l(){u(),wa.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(d){u(),r&&r(d),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 ML extends Fu{constructor(e){super(e)}load(e,t,i,r){const s=new Wn,o=new EL(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 w_ extends nn{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new gt(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()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const Ig=new Xe,JS=new Y,eA=new Y;class C_{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new qe(512,512),this.map=null,this.mapPass=null,this.matrix=new Xe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new S_,this._frameExtents=new qe(1,1),this._viewportCount=1,this._viewports=[new Mt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;JS.setFromMatrixPosition(e.matrixWorld),t.position.copy(JS),eA.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(eA),t.updateMatrixWorld(),Ig.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Ig),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(Ig)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class RL extends C_{constructor(){super(new Ki(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=hu*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 IL extends w_{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(nn.DEFAULT_UP),this.updateMatrix(),this.target=new nn,this.distance=i,this.angle=r,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new RL}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 tA=new Xe,ld=new Y,Ng=new Y;class NL extends C_{constructor(){super(new Ki(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new qe(4,2),this._viewportCount=6,this._viewports=[new Mt(2,1,1,1),new Mt(0,1,1,1),new Mt(3,1,1,1),new Mt(1,1,1,1),new Mt(3,0,1,1),new Mt(1,0,1,1)],this._cubeDirections=[new Y(1,0,0),new Y(-1,0,0),new Y(0,0,1),new Y(0,0,-1),new Y(0,1,0),new Y(0,-1,0)],this._cubeUps=[new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,1,0),new Y(0,0,1),new Y(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()),ld.setFromMatrixPosition(e.matrixWorld),i.position.copy(ld),Ng.copy(i.position),Ng.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Ng),i.updateMatrixWorld(),r.makeTranslation(-ld.x,-ld.y,-ld.z),tA.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(tA)}}class PL extends w_{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 NL}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 Ou extends P5{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}}class LL extends C_{constructor(){super(new Ou(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class DL extends w_{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(nn.DEFAULT_UP),this.updateMatrix(),this.target=new nn,this.shadow=new LL}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class kd{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i"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=wa.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 wa.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),wa.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});wa.add(e,l),s.manager.itemStart(e)}}class BL extends Ki{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e,this.index=0}}class kL{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=nA(),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=nA();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function nA(){return performance.now()}class UL{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=.5)for(let o=0;o!==s;++o)e[t+o]=e[i+o]}_slerp(e,t,i,r){Qt.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const o=this._workIndex*s;Qt.multiplyQuaternionsFlat(e,o,e,t,e,i),Qt.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 E_="\\[\\]\\.:\\/",zL=new RegExp("["+E_+"]","g"),M_="[^"+E_+"]",VL="[^"+E_.replace("\\.","")+"]",HL=/((?:WC+[\/:])*)/.source.replace("WC",M_),$L=/(WCOD+)?/.source.replace("WCOD",VL),GL=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",M_),WL=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",M_),QL=new RegExp("^"+HL+$L+GL+WL+"$"),jL=["material","materials","bones","map"];class qL{constructor(e,t,i){const r=i||en.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 en{constructor(e,t,i){this.path=t,this.parsedPath=i||en.parseTrackName(t),this.node=en.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 en.Composite(e,t,i):new en(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(zL,"")}static parseTrackName(e){const t=QL.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);jL.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;o0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case nP:for(let u=0,d=l.length;u!==d;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case y_:default:for(let u=0,d=l.length;u!==d;++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===tP;if(e===0)return s===-1?r:o&&(s&1)===1?t-r:r;if(i===Jr){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=Dc,r.endingEnd=Dc):(e?r.endingStart=this.zeroSlopeAtStart?Dc:Lc:r.endingStart=am,t?r.endingEnd=this.zeroSlopeAtEnd?Dc:Lc:r.endingEnd=am)}_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 KL=new Float32Array(1);class YL extends ro{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 d=0;d!==s;++d){const h=r[d],f=h.name;let p=u[f];if(p!==void 0)++p.referenceCount,o[d]=p;else{if(p=o[d],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,f));continue}const g=t&&t._propertyBindings[d].binding.parsedPath;p=new UL(en.create(i,f,g),h.ValueTypeName,h.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,f),o[d]=p}a[d].resultBuffer=p.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=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;tf.start-p.start);let h=0;for(let f=1;f0?t:e).get(_)),_}function g(x){let _=!1;const S=p(x);S===null?m(a,l):S&&S.isColor&&(m(S,1),_=!0);const E=n.xr.getEnvironmentBlendMode();E==="additive"?i.buffers.color.setClear(0,0,0,1,o):E==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(n.autoClear||_)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function y(x,_){const S=p(_);S&&(S.isCubeTexture||S.mapping===Ym)?(u===void 0&&(u=new pn(new Pu(1,1,1),new Pr({name:"BackgroundCubeMaterial",uniforms:fu(Us.backgroundCube.uniforms),vertexShader:Us.backgroundCube.vertexShader,fragmentShader:Us.backgroundCube.fragmentShader,side:Fi,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(E,A,R){this.matrixWorld.copyPosition(R.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),tl.copy(_.backgroundRotation),tl.x*=-1,tl.y*=-1,tl.z*=-1,S.isCubeTexture&&S.isRenderTargetTexture===!1&&(tl.y*=-1,tl.z*=-1),u.material.uniforms.envMap.value=S,u.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=_.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(D7.makeRotationFromEuler(tl)),u.material.toneMapped=wt.getTransfer(S.colorSpace)!==Zt,(d!==S||h!==S.version||f!==n.toneMapping)&&(u.material.needsUpdate=!0,d=S,h=S.version,f=n.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new pn(new pu(2,2),new Pr({name:"BackgroundMaterial",uniforms:fu(Us.background.uniforms),vertexShader:Us.background.vertexShader,fragmentShader:Us.background.fragmentShader,side:bs,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=S,c.material.uniforms.backgroundIntensity.value=_.backgroundIntensity,c.material.toneMapped=wt.getTransfer(S.colorSpace)!==Zt,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(d!==S||h!==S.version||f!==n.toneMapping)&&(c.material.needsUpdate=!0,d=S,h=S.version,f=n.toneMapping),c.layers.enableAll(),x.unshift(c,c.geometry,c.material,0,0,null))}function m(x,_){x.getRGB(zf,N5(n)),i.buffers.color.setClear(zf.r,zf.g,zf.b,_,o)}function v(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(x,_=1){a.set(x),l=_,m(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,m(a,l)},render:g,addToRenderList:y,dispose:v}}function O7(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),i={},r=h(null);let s=r,o=!1;function a(M,I,L,k,T){let F=!1;const V=d(k,L,I);s!==V&&(s=V,c(s.object)),F=f(M,k,L,T),F&&p(M,k,L,T),T!==null&&e.update(T,n.ELEMENT_ARRAY_BUFFER),(F||o)&&(o=!1,_(M,I,L,k),T!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(T).buffer))}function l(){return n.createVertexArray()}function c(M){return n.bindVertexArray(M)}function u(M){return n.deleteVertexArray(M)}function d(M,I,L){const k=L.wireframe===!0;let T=i[M.id];T===void 0&&(T={},i[M.id]=T);let F=T[I.id];F===void 0&&(F={},T[I.id]=F);let V=F[k];return V===void 0&&(V=h(l()),F[k]=V),V}function h(M){const I=[],L=[],k=[];for(let T=0;T=0){const he=T[ee];let ie=F[ee];if(ie===void 0&&(ee==="instanceMatrix"&&M.instanceMatrix&&(ie=M.instanceMatrix),ee==="instanceColor"&&M.instanceColor&&(ie=M.instanceColor)),he===void 0||he.attribute!==ie||ie&&he.data!==ie.data)return!0;V++}return s.attributesNum!==V||s.index!==k}function p(M,I,L,k){const T={},F=I.attributes;let V=0;const Q=L.getAttributes();for(const ee in Q)if(Q[ee].location>=0){let he=F[ee];he===void 0&&(ee==="instanceMatrix"&&M.instanceMatrix&&(he=M.instanceMatrix),ee==="instanceColor"&&M.instanceColor&&(he=M.instanceColor));const ie={};ie.attribute=he,he&&he.data&&(ie.data=he.data),T[ee]=ie,V++}s.attributes=T,s.attributesNum=V,s.index=k}function g(){const M=s.newAttributes;for(let I=0,L=M.length;I=0){let se=T[Q];if(se===void 0&&(Q==="instanceMatrix"&&M.instanceMatrix&&(se=M.instanceMatrix),Q==="instanceColor"&&M.instanceColor&&(se=M.instanceColor)),se!==void 0){const he=se.normalized,ie=se.itemSize,re=e.get(se);if(re===void 0)continue;const be=re.buffer,le=re.type,fe=re.bytesPerElement,Te=le===n.INT||le===n.UNSIGNED_INT||se.gpuType===Zm;if(se.isInterleavedBufferAttribute){const Ce=se.data,Ie=Ce.stride,ze=se.offset;if(Ce.isInstancedInterleavedBuffer){for(let Be=0;Be0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const u=l(c);u!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",u,"instead."),c=u);const d=t.logarithmicDepthBuffer===!0,h=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control"),f=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_TEXTURE_SIZE),y=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),m=n.getParameter(n.MAX_VERTEX_ATTRIBS),v=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),x=n.getParameter(n.MAX_VARYING_VECTORS),_=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),S=p>0,E=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:d,reverseDepthBuffer:h,maxTextures:f,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:y,maxAttributes:m,maxVertexUniforms:v,maxVaryings:x,maxFragmentUniforms:_,vertexTextures:S,maxSamples:E}}function U7(n){const e=this;let t=null,i=0,r=!1,s=!1;const o=new Co,a=new mt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(d,h){const f=d.length!==0||h||i!==0||r;return r=h,i=d.length,f},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(d,h){t=u(d,h,0)},this.setState=function(d,h,f){const p=d.clippingPlanes,g=d.clipIntersection,y=d.clipShadows,m=n.get(d);if(!r||p===null||p.length===0||s&&!y)s?u(null):c();else{const v=s?0:i,x=v*4;let _=m.clippingState||null;l.value=_,_=u(p,h,x,f);for(let S=0;S!==x;++S)_[S]=t[S];m.clippingState=_,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(d,h,f,p){const g=d!==null?d.length:0;let y=null;if(g!==0){if(y=l.value,p!==!0||y===null){const m=f+g*4,v=h.matrixWorldInverse;a.getNormalMatrix(v),(y===null||y.length0){const c=new nL(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}}const Fc=4,sA=[.125,.215,.35,.446,.526,.582],fl=20,Pg=new Ou,oA=new gt;let Lg=null,Dg=0,Fg=0,Og=!1;const dl=(1+Math.sqrt(5))/2,yc=1/dl,aA=[new Y(-dl,yc,0),new Y(dl,yc,0),new Y(-yc,0,dl),new Y(yc,0,dl),new Y(0,dl,-yc),new Y(0,dl,yc),new Y(-1,1,-1),new Y(1,1,-1),new Y(-1,1,1),new Y(1,1,1)];let lA=class{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){Lg=this._renderer.getRenderTarget(),Dg=this._renderer.getActiveCubeFace(),Fg=this._renderer.getActiveMipmapLevel(),Og=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,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=dA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=uA(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?x:0,x,x),u.setRenderTarget(r),g&&u.render(p,a),u.render(e,a)}p.geometry.dispose(),p.material.dispose(),u.toneMapping=h,u.autoClear=d,e.background=y}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===kl||e.mapping===Ul;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=dA()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=uA());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new pn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Vf(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,Pg)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;const r=this._lodPlanes.length;for(let s=1;sfl&&console.warn("sigmaRadians, ".concat(s,", is too large and will clip, as it requested ").concat(y," samples when the maximum is set to ").concat(fl));const m=[];let v=0;for(let A=0;Ax-Fc?r-x+Fc:0),E=4*(this._cubeSize-_);Vf(t,S,E,3*_,2*_),l.setRenderTarget(t),l.render(d,Pg)}};function V7(n){const e=[],t=[],i=[];let r=n;const s=n-Fc+1+sA.length;for(let o=0;on-Fc?l=sA[o-n+Fc-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,d=1+c,h=[u,u,d,u,d,d,u,u,d,d,u,d],f=6,p=6,g=3,y=2,m=1,v=new Float32Array(g*p*f),x=new Float32Array(y*p*f),_=new Float32Array(m*p*f);for(let E=0;E2?0:-1,w=[A,R,0,A+2/3,R,0,A+2/3,R+1,0,A,R,0,A+2/3,R+1,0,A,R+1,0];v.set(w,g*p*E),x.set(h,y*p*E);const M=[E,E,E,E,E,E];_.set(M,m*p*E)}const S=new ki;S.setAttribute("position",new xi(v,g)),S.setAttribute("uv",new xi(x,y)),S.setAttribute("faceIndex",new xi(_,m)),e.push(S),r>Fc&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function cA(n,e,t){const i=new Fa(n,e,t);return i.texture.mapping=Ym,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Vf(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function H7(n,e,t){const i=new Float32Array(fl),r=new Y(0,1,0);return new Pr({name:"SphericalGaussianBlur",defines:{n:fl,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:"".concat(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:I_(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform float mipInt;\n uniform vec3 poleAxis;\n\n #define ENVMAP_TYPE_CUBE_UV\n #include \n\n vec3 getSample( float theta, vec3 axis ) {\n\n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n return bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n }\n\n void main() {\n\n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n }\n\n axis = normalize( axis );\n\n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n for ( int i = 1; i < n; i++ ) {\n\n if ( i >= samples ) {\n\n break;\n\n }\n\n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n }\n\n }\n ",blending:Ia,depthTest:!1,depthWrite:!1})}function uA(){return new Pr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:I_(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n varying vec3 vOutputDirection;\n\n uniform sampler2D envMap;\n\n #include \n\n void main() {\n\n vec3 outputDirection = normalize( vOutputDirection );\n vec2 uv = equirectUv( outputDirection );\n\n gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n }\n ",blending:Ia,depthTest:!1,depthWrite:!1})}function dA(){return new Pr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:I_(),fragmentShader:"\n\n precision mediump float;\n precision mediump int;\n\n uniform float flipEnvMap;\n\n varying vec3 vOutputDirection;\n\n uniform samplerCube envMap;\n\n void main() {\n\n gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n }\n ",blending:Ia,depthTest:!1,depthWrite:!1})}function I_(){return"\n\n precision mediump float;\n precision mediump int;\n\n attribute float faceIndex;\n\n varying vec3 vOutputDirection;\n\n // RH coordinate system; PMREM face-indexing convention\n vec3 getDirection( vec2 uv, float face ) {\n\n uv = 2.0 * uv - 1.0;\n\n vec3 direction = vec3( uv, 1.0 );\n\n if ( face == 0.0 ) {\n\n direction = direction.zyx; // ( 1, v, u ) pos x\n\n } else if ( face == 1.0 ) {\n\n direction = direction.xzy;\n direction.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n } else if ( face == 2.0 ) {\n\n direction.x *= -1.0; // ( -u, v, 1 ) pos z\n\n } else if ( face == 3.0 ) {\n\n direction = direction.zyx;\n direction.xz *= -1.0; // ( -1, v, -u ) neg x\n\n } else if ( face == 4.0 ) {\n\n direction = direction.xzy;\n direction.xy *= -1.0; // ( -u, -1, v ) neg y\n\n } else if ( face == 5.0 ) {\n\n direction.z *= -1.0; // ( u, v, -1 ) neg z\n\n }\n\n return direction;\n\n }\n\n void main() {\n\n vOutputDirection = getDirection( uv, faceIndex );\n gl_Position = vec4( position, 1.0 );\n\n }\n "}function $7(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===ry||l===sy,u=l===kl||l===Ul;if(c||u){let d=e.get(a);const h=d!==void 0?d.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==h)return t===null&&(t=new lA(n)),d=c?t.fromEquirectangular(a,d):t.fromCubemap(a,d),d.texture.pmremVersion=a.pmremVersion,e.set(a,d),d.texture;if(d!==void 0)return d.texture;{const f=a.image;return c&&f&&f.height>0||u&&f&&r(f)?(t===null&&(t=new lA(n)),d=c?t.fromEquirectangular(a):t.fromCubemap(a),d.texture.pmremVersion=a.pmremVersion,e.set(a,d),a.addEventListener("dispose",s),d.texture):null}}}return a}function r(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(S=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);const E=new Float32Array(_*S*4*d),A=new __(E,_,S,d);A.type=ir,A.needsUpdate=!0;const R=x*4;for(let M=0;M0)return n;const r=e*t;let s=fA[r];if(s===void 0&&(s=new Float32Array(r),fA[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 ei(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "," ").concat(a,": ").concat(t[o]))}return i.join("\n")}const xA=new mt;function $O(n){wt._getMatrix(xA,wt.workingColorSpace,n);const e="mat3( ".concat(xA.elements.map(t=>t.toFixed(4))," )");switch(wt.getTransfer(n)){case cm:return[e,"LinearTransferOETF"];case Zt:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",n),[e,"LinearTransferOETF"]}}function SA(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()+"\n\n"+r+"\n\n"+HO(n.getShaderSource(e),o)}else return r}function GO(n,e){const t=$O(e);return["vec4 ".concat(n,"( vec4 value ) {")," return ".concat(t[1],"( vec4( value.rgb * ").concat(t[0],", value.a ) );"),"}"].join("\n")}function WO(n,e){let t;switch(e){case QN:t="Linear";break;case jN:t="Reinhard";break;case qN:t="Cineon";break;case XN:t="ACESFilmic";break;case YN:t="AgX";break;case ZN:t="Neutral";break;case KN:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Hf=new Y;function QO(){wt.getLuminanceCoefficients(Hf);const n=Hf.x.toFixed(4),e=Hf.y.toFixed(4),t=Hf.z.toFixed(4);return["float luminance( const in vec3 rgb ) {"," const vec3 weights = vec3( ".concat(n,", ").concat(e,", ").concat(t," );")," return dot( weights, rgb );","}"].join("\n")}function jO(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Td).join("\n")}function qO(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join("\n")}function XO(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function Fy(n){return n.replace(KO,ZO)}const YO=new Map;function ZO(n,e){let t=It[e];if(t===void 0){const i=YO.get(e);if(i!==void 0)t=It[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 Fy(t)}const JO=/#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 TA(n){return n.replace(JO,eB)}function eB(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(y+="\n"),m=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(Td).join("\n"),m.length>0&&(m+="\n")):(y=[wA(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",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?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#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.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif","\n"].filter(Td).join("\n"),m=[wA(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,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 "+d:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",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||t.batchingColor?"#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.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==_s?"#define TONE_MAPPING":"",t.toneMapping!==_s?It.tonemapping_pars_fragment:"",t.toneMapping!==_s?WO("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",It.colorspace_pars_fragment,GO("linearToOutputTexel",t.outputColorSpace),QO(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"","\n"].filter(Td).join("\n")),o=Fy(o),o=AA(o,t),o=bA(o,t),a=Fy(a),a=AA(a,t),a=bA(a,t),o=TA(o),a=TA(a),t.isRawShaderMaterial!==!0&&(v="#version 300 es\n",y=[f,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+y,m=["#define varying in",t.glslVersion===_S?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===_S?"":"#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("\n")+"\n"+m);const x=v+y+o,_=v+m+a,S=_A(r,r.VERTEX_SHADER,x),E=_A(r,r.FRAGMENT_SHADER,_);r.attachShader(g,S),r.attachShader(g,E),t.index0AttributeName!==void 0?r.bindAttribLocation(g,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(g,0,"position"),r.linkProgram(g);function A(I){if(n.debug.checkShaderErrors){const L=r.getProgramInfoLog(g).trim(),k=r.getShaderInfoLog(S).trim(),T=r.getShaderInfoLog(E).trim();let F=!0,V=!0;if(r.getProgramParameter(g,r.LINK_STATUS)===!1)if(F=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,g,S,E);else{const Q=SA(r,S,"vertex"),ee=SA(r,E,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(g,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+I.name+"\nMaterial Type: "+I.type+"\n\nProgram Info Log: "+L+"\n"+Q+"\n"+ee)}else L!==""?console.warn("THREE.WebGLProgram: Program Info Log:",L):(k===""||T==="")&&(V=!1);V&&(I.diagnostics={runnable:F,programLog:L,vertexShader:{log:k,prefix:y},fragmentShader:{log:T,prefix:m}})}r.deleteShader(S),r.deleteShader(E),R=new Rp(r,g),w=XO(r,g)}let R;this.getUniforms=function(){return R===void 0&&A(this),R};let w;this.getAttributes=function(){return w===void 0&&A(this),w};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=r.getProgramParameter(g,zO)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(g),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=VO++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=S,this.fragmentShader=E,this}let aB=0;class lB{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 cB(e),t.set(e,i)),i}}class cB{constructor(e){this.id=aB++,this.code=e,this.usedTimes=0}}function uB(n,e,t,i,r,s,o){const a=new E5,l=new lB,c=new Set,u=[],d=r.logarithmicDepthBuffer,h=r.vertexTextures;let f=r.precision;const p={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 g(w){return c.add(w),w===0?"uv":"uv".concat(w)}function y(w,M,I,L,k){const T=L.fog,F=k.geometry,V=w.isMeshStandardMaterial?L.environment:null,Q=(w.isMeshStandardMaterial?t:e).get(w.envMap||V),ee=Q&&Q.mapping===Ym?Q.image.height:null,se=p[w.type];w.precision!==null&&(f=r.getMaxPrecision(w.precision),f!==w.precision&&console.warn("THREE.WebGLProgram.getParameters:",w.precision,"not supported, using",f,"instead."));const he=F.morphAttributes.position||F.morphAttributes.normal||F.morphAttributes.color,ie=he!==void 0?he.length:0;let re=0;F.morphAttributes.position!==void 0&&(re=1),F.morphAttributes.normal!==void 0&&(re=2),F.morphAttributes.color!==void 0&&(re=3);let be,le,fe,Te;if(se){const sn=Us[se];be=sn.vertexShader,le=sn.fragmentShader}else be=w.vertexShader,le=w.fragmentShader,l.update(w),fe=l.getVertexShaderID(w),Te=l.getFragmentShaderID(w);const Ce=n.getRenderTarget(),Ie=n.state.buffers.depth.getReversed(),ze=k.isInstancedMesh===!0,Be=k.isBatchedMesh===!0,it=!!w.map,te=!!w.matcap,ne=!!Q,b=!!w.aoMap,oe=!!w.lightMap,J=!!w.bumpMap,H=!!w.normalMap,P=!!w.displacementMap,U=!!w.emissiveMap,j=!!w.metalnessMap,B=!!w.roughnessMap,D=w.anisotropy>0,W=w.clearcoat>0,G=w.dispersion>0,X=w.iridescence>0,ue=w.sheen>0,z=w.transmission>0,C=D&&!!w.anisotropyMap,N=W&&!!w.clearcoatMap,q=W&&!!w.clearcoatNormalMap,Z=W&&!!w.clearcoatRoughnessMap,$=X&&!!w.iridescenceMap,ae=X&&!!w.iridescenceThicknessMap,ke=ue&&!!w.sheenColorMap,Le=ue&&!!w.sheenRoughnessMap,Ve=!!w.specularMap,Je=!!w.specularColorMap,st=!!w.specularIntensityMap,pe=z&&!!w.transmissionMap,Ze=z&&!!w.thicknessMap,we=!!w.gradientMap,De=!!w.alphaMap,Ke=w.alphaTest>0,et=!!w.alphaHash,_t=!!w.extensions;let hn=_s;w.toneMapped&&(Ce===null||Ce.isXRRenderTarget===!0)&&(hn=n.toneMapping);const Ti={shaderID:se,shaderType:w.type,shaderName:w.name,vertexShader:be,fragmentShader:le,defines:w.defines,customVertexShaderID:fe,customFragmentShaderID:Te,isRawShaderMaterial:w.isRawShaderMaterial===!0,glslVersion:w.glslVersion,precision:f,batching:Be,batchingColor:Be&&k._colorsTexture!==null,instancing:ze,instancingColor:ze&&k.instanceColor!==null,instancingMorph:ze&&k.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:Ce===null?n.outputColorSpace:Ce.isXRRenderTarget===!0?Ce.texture.colorSpace:Bi,alphaToCoverage:!!w.alphaToCoverage,map:it,matcap:te,envMap:ne,envMapMode:ne&&Q.mapping,envMapCubeUVHeight:ee,aoMap:b,lightMap:oe,bumpMap:J,normalMap:H,displacementMap:h&&P,emissiveMap:U,normalMapObjectSpace:H&&w.normalMapType===A5,normalMapTangentSpace:H&&w.normalMapType===lm,metalnessMap:j,roughnessMap:B,anisotropy:D,anisotropyMap:C,clearcoat:W,clearcoatMap:N,clearcoatNormalMap:q,clearcoatRoughnessMap:Z,dispersion:G,iridescence:X,iridescenceMap:$,iridescenceThicknessMap:ae,sheen:ue,sheenColorMap:ke,sheenRoughnessMap:Le,specularMap:Ve,specularColorMap:Je,specularIntensityMap:st,transmission:z,transmissionMap:pe,thicknessMap:Ze,gradientMap:we,opaque:w.transparent===!1&&w.blending===zo&&w.alphaToCoverage===!1,alphaMap:De,alphaTest:Ke,alphaHash:et,combine:w.combine,mapUv:it&&g(w.map.channel),aoMapUv:b&&g(w.aoMap.channel),lightMapUv:oe&&g(w.lightMap.channel),bumpMapUv:J&&g(w.bumpMap.channel),normalMapUv:H&&g(w.normalMap.channel),displacementMapUv:P&&g(w.displacementMap.channel),emissiveMapUv:U&&g(w.emissiveMap.channel),metalnessMapUv:j&&g(w.metalnessMap.channel),roughnessMapUv:B&&g(w.roughnessMap.channel),anisotropyMapUv:C&&g(w.anisotropyMap.channel),clearcoatMapUv:N&&g(w.clearcoatMap.channel),clearcoatNormalMapUv:q&&g(w.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Z&&g(w.clearcoatRoughnessMap.channel),iridescenceMapUv:$&&g(w.iridescenceMap.channel),iridescenceThicknessMapUv:ae&&g(w.iridescenceThicknessMap.channel),sheenColorMapUv:ke&&g(w.sheenColorMap.channel),sheenRoughnessMapUv:Le&&g(w.sheenRoughnessMap.channel),specularMapUv:Ve&&g(w.specularMap.channel),specularColorMapUv:Je&&g(w.specularColorMap.channel),specularIntensityMapUv:st&&g(w.specularIntensityMap.channel),transmissionMapUv:pe&&g(w.transmissionMap.channel),thicknessMapUv:Ze&&g(w.thicknessMap.channel),alphaMapUv:De&&g(w.alphaMap.channel),vertexTangents:!!F.attributes.tangent&&(H||D),vertexColors:w.vertexColors,vertexAlphas:w.vertexColors===!0&&!!F.attributes.color&&F.attributes.color.itemSize===4,pointsUvs:k.isPoints===!0&&!!F.attributes.uv&&(it||De),fog:!!T,useFog:w.fog===!0,fogExp2:!!T&&T.isFogExp2,flatShading:w.flatShading===!0,sizeAttenuation:w.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:Ie,skinning:k.isSkinnedMesh===!0,morphTargets:F.morphAttributes.position!==void 0,morphNormals:F.morphAttributes.normal!==void 0,morphColors:F.morphAttributes.color!==void 0,morphTargetsCount:ie,morphTextureStride:re,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numLightProbes:M.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:w.dithering,shadowMapEnabled:n.shadowMap.enabled&&I.length>0,shadowMapType:n.shadowMap.type,toneMapping:hn,decodeVideoTexture:it&&w.map.isVideoTexture===!0&&wt.getTransfer(w.map.colorSpace)===Zt,decodeVideoTextureEmissive:U&&w.emissiveMap.isVideoTexture===!0&&wt.getTransfer(w.emissiveMap.colorSpace)===Zt,premultipliedAlpha:w.premultipliedAlpha,doubleSided:w.side===Cr,flipSided:w.side===Fi,useDepthPacking:w.depthPacking>=0,depthPacking:w.depthPacking||0,index0AttributeName:w.index0AttributeName,extensionClipCullDistance:_t&&w.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(_t&&w.extensions.multiDraw===!0||Be)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:w.customProgramCacheKey()};return Ti.vertexUv1s=c.has(1),Ti.vertexUv2s=c.has(2),Ti.vertexUv3s=c.has(3),c.clear(),Ti}function m(w){const M=[];if(w.shaderID?M.push(w.shaderID):(M.push(w.customVertexShaderID),M.push(w.customFragmentShaderID)),w.defines!==void 0)for(const I in w.defines)M.push(I),M.push(w.defines[I]);return w.isRawShaderMaterial===!1&&(v(M,w),x(M,w),M.push(n.outputColorSpace)),M.push(w.customProgramCacheKey),M.join()}function v(w,M){w.push(M.precision),w.push(M.outputColorSpace),w.push(M.envMapMode),w.push(M.envMapCubeUVHeight),w.push(M.mapUv),w.push(M.alphaMapUv),w.push(M.lightMapUv),w.push(M.aoMapUv),w.push(M.bumpMapUv),w.push(M.normalMapUv),w.push(M.displacementMapUv),w.push(M.emissiveMapUv),w.push(M.metalnessMapUv),w.push(M.roughnessMapUv),w.push(M.anisotropyMapUv),w.push(M.clearcoatMapUv),w.push(M.clearcoatNormalMapUv),w.push(M.clearcoatRoughnessMapUv),w.push(M.iridescenceMapUv),w.push(M.iridescenceThicknessMapUv),w.push(M.sheenColorMapUv),w.push(M.sheenRoughnessMapUv),w.push(M.specularMapUv),w.push(M.specularColorMapUv),w.push(M.specularIntensityMapUv),w.push(M.transmissionMapUv),w.push(M.thicknessMapUv),w.push(M.combine),w.push(M.fogExp2),w.push(M.sizeAttenuation),w.push(M.morphTargetsCount),w.push(M.morphAttributeCount),w.push(M.numDirLights),w.push(M.numPointLights),w.push(M.numSpotLights),w.push(M.numSpotLightMaps),w.push(M.numHemiLights),w.push(M.numRectAreaLights),w.push(M.numDirLightShadows),w.push(M.numPointLightShadows),w.push(M.numSpotLightShadows),w.push(M.numSpotLightShadowsWithMaps),w.push(M.numLightProbes),w.push(M.shadowMapType),w.push(M.toneMapping),w.push(M.numClippingPlanes),w.push(M.numClipIntersection),w.push(M.depthPacking)}function x(w,M){a.disableAll(),M.supportsVertexTextures&&a.enable(0),M.instancing&&a.enable(1),M.instancingColor&&a.enable(2),M.instancingMorph&&a.enable(3),M.matcap&&a.enable(4),M.envMap&&a.enable(5),M.normalMapObjectSpace&&a.enable(6),M.normalMapTangentSpace&&a.enable(7),M.clearcoat&&a.enable(8),M.iridescence&&a.enable(9),M.alphaTest&&a.enable(10),M.vertexColors&&a.enable(11),M.vertexAlphas&&a.enable(12),M.vertexUv1s&&a.enable(13),M.vertexUv2s&&a.enable(14),M.vertexUv3s&&a.enable(15),M.vertexTangents&&a.enable(16),M.anisotropy&&a.enable(17),M.alphaHash&&a.enable(18),M.batching&&a.enable(19),M.dispersion&&a.enable(20),M.batchingColor&&a.enable(21),w.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.reverseDepthBuffer&&a.enable(4),M.skinning&&a.enable(5),M.morphTargets&&a.enable(6),M.morphNormals&&a.enable(7),M.morphColors&&a.enable(8),M.premultipliedAlpha&&a.enable(9),M.shadowMapEnabled&&a.enable(10),M.doubleSided&&a.enable(11),M.flipSided&&a.enable(12),M.useDepthPacking&&a.enable(13),M.dithering&&a.enable(14),M.transmission&&a.enable(15),M.sheen&&a.enable(16),M.opaque&&a.enable(17),M.pointsUvs&&a.enable(18),M.decodeVideoTexture&&a.enable(19),M.decodeVideoTextureEmissive&&a.enable(20),M.alphaToCoverage&&a.enable(21),w.push(a.mask)}function _(w){const M=p[w.type];let I;if(M){const L=Us[M];I=ZP.clone(L.uniforms)}else I=w.uniforms;return I}function S(w,M){let I;for(let L=0,k=u.length;L0?i.push(m):f.transparent===!0?r.push(m):t.push(m)}function l(d,h,f,p,g,y){const m=o(d,h,f,p,g,y);f.transmission>0?i.unshift(m):f.transparent===!0?r.unshift(m):t.unshift(m)}function c(d,h){t.length>1&&t.sort(d||hB),i.length>1&&i.sort(h||CA),r.length>1&&r.sort(h||CA)}function u(){for(let d=e,h=n.length;d=s.length?(o=new EA,s.push(o)):o=s[r],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function pB(){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 Y,color:new gt};break;case"SpotLight":t={position:new Y,direction:new Y,color:new gt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Y,color:new gt,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Y,skyColor:new gt,groundColor:new gt};break;case"RectAreaLight":t={color:new gt,position:new Y,halfWidth:new Y,halfHeight:new Y};break}return n[e.id]=t,t}}}function mB(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new qe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new qe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new qe,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let gB=0;function yB(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function vB(n){const e=new pB,t=mB(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)i.probe.push(new Y);const r=new Y,s=new Xe,o=new Xe;function a(c){let u=0,d=0,h=0;for(let w=0;w<9;w++)i.probe[w].set(0,0,0);let f=0,p=0,g=0,y=0,m=0,v=0,x=0,_=0,S=0,E=0,A=0;c.sort(yB);for(let w=0,M=c.length;w0&&(n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=tt.LTC_FLOAT_1,i.rectAreaLTC2=tt.LTC_FLOAT_2):(i.rectAreaLTC1=tt.LTC_HALF_1,i.rectAreaLTC2=tt.LTC_HALF_2)),i.ambient[0]=u,i.ambient[1]=d,i.ambient[2]=h;const R=i.hash;(R.directionalLength!==f||R.pointLength!==p||R.spotLength!==g||R.rectAreaLength!==y||R.hemiLength!==m||R.numDirectionalShadows!==v||R.numPointShadows!==x||R.numSpotShadows!==_||R.numSpotMaps!==S||R.numLightProbes!==A)&&(i.directional.length=f,i.spot.length=g,i.rectArea.length=y,i.point.length=p,i.hemi.length=m,i.directionalShadow.length=v,i.directionalShadowMap.length=v,i.pointShadow.length=x,i.pointShadowMap.length=x,i.spotShadow.length=_,i.spotShadowMap.length=_,i.directionalShadowMatrix.length=v,i.pointShadowMatrix.length=x,i.spotLightMatrix.length=_+S-E,i.spotLightMap.length=S,i.numSpotLightShadowsWithMaps=E,i.numLightProbes=A,R.directionalLength=f,R.pointLength=p,R.spotLength=g,R.rectAreaLength=y,R.hemiLength=m,R.numDirectionalShadows=v,R.numPointShadows=x,R.numSpotShadows=_,R.numSpotMaps=S,R.numLightProbes=A,i.version=gB++)}function l(c,u){let d=0,h=0,f=0,p=0,g=0;const y=u.matrixWorldInverse;for(let m=0,v=c.length;m=o.length?(a=new MA(n),o.push(a)):a=o[s],a}function i(){e=new WeakMap}return{get:t,dispose:i}}const xB="void main() {\n gl_Position = vec4( position, 1.0 );\n}",SB="uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include \nvoid main() {\n const float samples = float( VSM_SAMPLES );\n float mean = 0.0;\n float squared_mean = 0.0;\n float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n float uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n for ( float i = 0.0; i < samples; i ++ ) {\n float uvOffset = uvStart + i * uvStride;\n #ifdef HORIZONTAL_PASS\n vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n mean += distribution.x;\n squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n #else\n float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n mean += depth;\n squared_mean += depth * depth;\n #endif\n }\n mean = mean / samples;\n squared_mean = squared_mean / samples;\n float std_dev = sqrt( squared_mean - mean * mean );\n gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";function AB(n,e,t){let i=new S_;const r=new qe,s=new qe,o=new Mt,a=new mL({depthPacking:sP}),l=new gL,c={},u=t.maxTextureSize,d={[bs]:Fi,[Fi]:bs,[Cr]:Cr},h=new Pr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new qe},radius:{value:4}},vertexShader:xB,fragmentShader:SB}),f=h.clone();f.defines.HORIZONTAL_PASS=1;const p=new ki;p.setAttribute("position",new xi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new pn(p,h),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=c5;let m=this.type;this.render=function(E,A,R){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||E.length===0)return;const w=n.getRenderTarget(),M=n.getActiveCubeFace(),I=n.getActiveMipmapLevel(),L=n.state;L.setBlending(Ia),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);const k=m!==Ar&&this.type===Ar,T=m===Ar&&this.type!==Ar;for(let F=0,V=E.length;Fu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/se.x),r.x=s.x*se.x,ee.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/se.y),r.y=s.y*se.y,ee.mapSize.y=s.y)),ee.map===null||k===!0||T===!0){const ie=this.type!==Ar?{minFilter:_i,magFilter:_i}:{};ee.map!==null&&ee.map.dispose(),ee.map=new Fa(r.x,r.y,ie),ee.map.texture.name=Q.name+".shadowMap",ee.camera.updateProjectionMatrix()}n.setRenderTarget(ee.map),n.clear();const he=ee.getViewportCount();for(let ie=0;ie0||A.map&&A.alphaTest>0){const L=M.uuid,k=A.uuid;let T=c[L];T===void 0&&(T={},c[L]=T);let F=T[k];F===void 0&&(F=M.clone(),T[k]=F,A.addEventListener("dispose",S)),M=F}if(M.visible=A.visible,M.wireframe=A.wireframe,w===Ar?M.side=A.shadowSide!==null?A.shadowSide:A.side:M.side=A.shadowSide!==null?A.shadowSide:d[A.side],M.alphaMap=A.alphaMap,M.alphaTest=A.alphaTest,M.map=A.map,M.clipShadows=A.clipShadows,M.clippingPlanes=A.clippingPlanes,M.clipIntersection=A.clipIntersection,M.displacementMap=A.displacementMap,M.displacementScale=A.displacementScale,M.displacementBias=A.displacementBias,M.wireframeLinewidth=A.wireframeLinewidth,M.linewidth=A.linewidth,R.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const L=n.properties.get(M);L.light=R}return M}function _(E,A,R,w,M){if(E.visible===!1)return;if(E.layers.test(A.layers)&&(E.isMesh||E.isLine||E.isPoints)&&(E.castShadow||E.receiveShadow&&M===Ar)&&(!E.frustumCulled||i.intersectsObject(E))){E.modelViewMatrix.multiplyMatrices(R.matrixWorldInverse,E.matrixWorld);const k=e.update(E),T=E.material;if(Array.isArray(T)){const F=k.groups;for(let V=0,Q=F.length;V=1):ee.indexOf("OpenGL ES")!==-1&&(Q=parseFloat(/^OpenGL ES (\d)/.exec(ee)[1]),V=Q>=2);let se=null,he={};const ie=n.getParameter(n.SCISSOR_BOX),re=n.getParameter(n.VIEWPORT),be=new Mt().fromArray(ie),le=new Mt().fromArray(re);function fe(pe,Ze,we,De){const Ke=new Uint8Array(4),et=n.createTexture();n.bindTexture(pe,et),n.texParameteri(pe,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(pe,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let _t=0;_t"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new qe,u=new WeakMap;let d;const h=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch(B){}function p(B,D){return f?new OffscreenCanvas(B,D):ch("canvas")}function g(B,D,W){let G=1;const X=j(B);if((X.width>W||X.height>W)&&(G=W/Math.max(X.width,X.height)),G<1)if(typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&B instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&B instanceof ImageBitmap||typeof VideoFrame<"u"&&B instanceof VideoFrame){const ue=Math.floor(G*X.width),z=Math.floor(G*X.height);d===void 0&&(d=p(ue,z));const C=D?p(ue,z):d;return C.width=ue,C.height=z,C.getContext("2d").drawImage(B,0,0,ue,z),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+X.width+"x"+X.height+") to ("+ue+"x"+z+")."),C}else return"data"in B&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+X.width+"x"+X.height+")."),B;return B}function y(B){return B.generateMipmaps}function m(B){n.generateMipmap(B)}function v(B){return B.isWebGLCubeRenderTarget?n.TEXTURE_CUBE_MAP:B.isWebGL3DRenderTarget?n.TEXTURE_3D:B.isWebGLArrayRenderTarget||B.isCompressedArrayTexture?n.TEXTURE_2D_ARRAY:n.TEXTURE_2D}function x(B,D,W,G,X=!1){if(B!==null){if(n[B]!==void 0)return n[B];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+B+"'")}let ue=D;if(D===n.RED&&(W===n.FLOAT&&(ue=n.R32F),W===n.HALF_FLOAT&&(ue=n.R16F),W===n.UNSIGNED_BYTE&&(ue=n.R8)),D===n.RED_INTEGER&&(W===n.UNSIGNED_BYTE&&(ue=n.R8UI),W===n.UNSIGNED_SHORT&&(ue=n.R16UI),W===n.UNSIGNED_INT&&(ue=n.R32UI),W===n.BYTE&&(ue=n.R8I),W===n.SHORT&&(ue=n.R16I),W===n.INT&&(ue=n.R32I)),D===n.RG&&(W===n.FLOAT&&(ue=n.RG32F),W===n.HALF_FLOAT&&(ue=n.RG16F),W===n.UNSIGNED_BYTE&&(ue=n.RG8)),D===n.RG_INTEGER&&(W===n.UNSIGNED_BYTE&&(ue=n.RG8UI),W===n.UNSIGNED_SHORT&&(ue=n.RG16UI),W===n.UNSIGNED_INT&&(ue=n.RG32UI),W===n.BYTE&&(ue=n.RG8I),W===n.SHORT&&(ue=n.RG16I),W===n.INT&&(ue=n.RG32I)),D===n.RGB_INTEGER&&(W===n.UNSIGNED_BYTE&&(ue=n.RGB8UI),W===n.UNSIGNED_SHORT&&(ue=n.RGB16UI),W===n.UNSIGNED_INT&&(ue=n.RGB32UI),W===n.BYTE&&(ue=n.RGB8I),W===n.SHORT&&(ue=n.RGB16I),W===n.INT&&(ue=n.RGB32I)),D===n.RGBA_INTEGER&&(W===n.UNSIGNED_BYTE&&(ue=n.RGBA8UI),W===n.UNSIGNED_SHORT&&(ue=n.RGBA16UI),W===n.UNSIGNED_INT&&(ue=n.RGBA32UI),W===n.BYTE&&(ue=n.RGBA8I),W===n.SHORT&&(ue=n.RGBA16I),W===n.INT&&(ue=n.RGBA32I)),D===n.RGB&&W===n.UNSIGNED_INT_5_9_9_9_REV&&(ue=n.RGB9_E5),D===n.RGBA){const z=X?cm:wt.getTransfer(G);W===n.FLOAT&&(ue=n.RGBA32F),W===n.HALF_FLOAT&&(ue=n.RGBA16F),W===n.UNSIGNED_BYTE&&(ue=z===Zt?n.SRGB8_ALPHA8:n.RGBA8),W===n.UNSIGNED_SHORT_4_4_4_4&&(ue=n.RGBA4),W===n.UNSIGNED_SHORT_5_5_5_1&&(ue=n.RGB5_A1)}return(ue===n.R16F||ue===n.R32F||ue===n.RG16F||ue===n.RG32F||ue===n.RGBA16F||ue===n.RGBA32F)&&e.get("EXT_color_buffer_float"),ue}function _(B,D){let W;return B?D===null||D===Ni||D===uu?W=n.DEPTH24_STENCIL8:D===ir?W=n.DEPTH32F_STENCIL8:D===sh&&(W=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):D===null||D===Ni||D===uu?W=n.DEPTH_COMPONENT24:D===ir?W=n.DEPTH_COMPONENT32F:D===sh&&(W=n.DEPTH_COMPONENT16),W}function S(B,D){return y(B)===!0||B.isFramebufferTexture&&B.minFilter!==_i&&B.minFilter!==Rr?Math.log2(Math.max(D.width,D.height))+1:B.mipmaps!==void 0&&B.mipmaps.length>0?B.mipmaps.length:B.isCompressedTexture&&Array.isArray(B.image)?D.mipmaps.length:1}function E(B){const D=B.target;D.removeEventListener("dispose",E),R(D),D.isVideoTexture&&u.delete(D)}function A(B){const D=B.target;D.removeEventListener("dispose",A),M(D)}function R(B){const D=i.get(B);if(D.__webglInit===void 0)return;const W=B.source,G=h.get(W);if(G){const X=G[D.__cacheKey];X.usedTimes--,X.usedTimes===0&&w(B),Object.keys(G).length===0&&h.delete(W)}i.remove(B)}function w(B){const D=i.get(B);n.deleteTexture(D.__webglTexture);const W=B.source,G=h.get(W);delete G[D.__cacheKey],o.memory.textures--}function M(B){const D=i.get(B);if(B.depthTexture&&(B.depthTexture.dispose(),i.remove(B.depthTexture)),B.isWebGLCubeRenderTarget)for(let G=0;G<6;G++){if(Array.isArray(D.__webglFramebuffer[G]))for(let X=0;X=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+B+" texture units while this GPU supports only "+r.maxTextures),I+=1,B}function T(B){const D=[];return D.push(B.wrapS),D.push(B.wrapT),D.push(B.wrapR||0),D.push(B.magFilter),D.push(B.minFilter),D.push(B.anisotropy),D.push(B.internalFormat),D.push(B.format),D.push(B.type),D.push(B.generateMipmaps),D.push(B.premultiplyAlpha),D.push(B.flipY),D.push(B.unpackAlignment),D.push(B.colorSpace),D.join()}function F(B,D){const W=i.get(B);if(B.isVideoTexture&&P(B),B.isRenderTargetTexture===!1&&B.version>0&&W.__version!==B.version){const G=B.image;if(G===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(G.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{le(W,B,D);return}}t.bindTexture(n.TEXTURE_2D,W.__webglTexture,n.TEXTURE0+D)}function V(B,D){const W=i.get(B);if(B.version>0&&W.__version!==B.version){le(W,B,D);return}t.bindTexture(n.TEXTURE_2D_ARRAY,W.__webglTexture,n.TEXTURE0+D)}function Q(B,D){const W=i.get(B);if(B.version>0&&W.__version!==B.version){le(W,B,D);return}t.bindTexture(n.TEXTURE_3D,W.__webglTexture,n.TEXTURE0+D)}function ee(B,D){const W=i.get(B);if(B.version>0&&W.__version!==B.version){fe(W,B,D);return}t.bindTexture(n.TEXTURE_CUBE_MAP,W.__webglTexture,n.TEXTURE0+D)}const se={[cu]:n.REPEAT,[Aa]:n.CLAMP_TO_EDGE,[om]:n.MIRRORED_REPEAT},he={[_i]:n.NEAREST,[h5]:n.NEAREST_MIPMAP_NEAREST,[bd]:n.NEAREST_MIPMAP_LINEAR,[Rr]:n.LINEAR,[bp]:n.LINEAR_MIPMAP_NEAREST,[Hs]:n.LINEAR_MIPMAP_LINEAR},ie={[oP]:n.NEVER,[dP]:n.ALWAYS,[b5]:n.LESS,[T5]:n.LEQUAL,[aP]:n.EQUAL,[uP]:n.GEQUAL,[lP]:n.GREATER,[cP]:n.NOTEQUAL};function re(B,D){if(D.type===ir&&e.has("OES_texture_float_linear")===!1&&(D.magFilter===Rr||D.magFilter===bp||D.magFilter===bd||D.magFilter===Hs||D.minFilter===Rr||D.minFilter===bp||D.minFilter===bd||D.minFilter===Hs)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(B,n.TEXTURE_WRAP_S,se[D.wrapS]),n.texParameteri(B,n.TEXTURE_WRAP_T,se[D.wrapT]),(B===n.TEXTURE_3D||B===n.TEXTURE_2D_ARRAY)&&n.texParameteri(B,n.TEXTURE_WRAP_R,se[D.wrapR]),n.texParameteri(B,n.TEXTURE_MAG_FILTER,he[D.magFilter]),n.texParameteri(B,n.TEXTURE_MIN_FILTER,he[D.minFilter]),D.compareFunction&&(n.texParameteri(B,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(B,n.TEXTURE_COMPARE_FUNC,ie[D.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(D.magFilter===_i||D.minFilter!==bd&&D.minFilter!==Hs||D.type===ir&&e.has("OES_texture_float_linear")===!1)return;if(D.anisotropy>1||i.get(D).__currentAnisotropy){const W=e.get("EXT_texture_filter_anisotropic");n.texParameterf(B,W.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(D.anisotropy,r.getMaxAnisotropy())),i.get(D).__currentAnisotropy=D.anisotropy}}}function be(B,D){let W=!1;B.__webglInit===void 0&&(B.__webglInit=!0,D.addEventListener("dispose",E));const G=D.source;let X=h.get(G);X===void 0&&(X={},h.set(G,X));const ue=T(D);if(ue!==B.__cacheKey){X[ue]===void 0&&(X[ue]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,W=!0),X[ue].usedTimes++;const z=X[B.__cacheKey];z!==void 0&&(X[B.__cacheKey].usedTimes--,z.usedTimes===0&&w(D)),B.__cacheKey=ue,B.__webglTexture=X[ue].texture}return W}function le(B,D,W){let G=n.TEXTURE_2D;(D.isDataArrayTexture||D.isCompressedArrayTexture)&&(G=n.TEXTURE_2D_ARRAY),D.isData3DTexture&&(G=n.TEXTURE_3D);const X=be(B,D),ue=D.source;t.bindTexture(G,B.__webglTexture,n.TEXTURE0+W);const z=i.get(ue);if(ue.version!==z.__version||X===!0){t.activeTexture(n.TEXTURE0+W);const C=wt.getPrimaries(wt.workingColorSpace),N=D.colorSpace===Vs?null:wt.getPrimaries(D.colorSpace),q=D.colorSpace===Vs||C===N?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,D.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,D.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,D.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,q);let Z=g(D.image,!1,r.maxTextureSize);Z=U(D,Z);const $=s.convert(D.format,D.colorSpace),ae=s.convert(D.type);let ke=x(D.internalFormat,$,ae,D.colorSpace,D.isVideoTexture);re(G,D);let Le;const Ve=D.mipmaps,Je=D.isVideoTexture!==!0,st=z.__version===void 0||X===!0,pe=ue.dataReady,Ze=S(D,Z);if(D.isDepthTexture)ke=_(D.format===du,D.type),st&&(Je?t.texStorage2D(n.TEXTURE_2D,1,ke,Z.width,Z.height):t.texImage2D(n.TEXTURE_2D,0,ke,Z.width,Z.height,0,$,ae,null));else if(D.isDataTexture)if(Ve.length>0){Je&&st&&t.texStorage2D(n.TEXTURE_2D,Ze,ke,Ve[0].width,Ve[0].height);for(let we=0,De=Ve.length;we0){const Ke=rA(Le.width,Le.height,D.format,D.type);for(const et of D.layerUpdates){const _t=Le.data.subarray(et*Ke/Le.data.BYTES_PER_ELEMENT,(et+1)*Ke/Le.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,we,0,0,et,Le.width,Le.height,1,$,_t)}D.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,we,0,0,0,Le.width,Le.height,Z.depth,$,Le.data)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,we,ke,Le.width,Le.height,Z.depth,0,Le.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Je?pe&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,we,0,0,0,Le.width,Le.height,Z.depth,$,ae,Le.data):t.texImage3D(n.TEXTURE_2D_ARRAY,we,ke,Le.width,Le.height,Z.depth,0,$,ae,Le.data)}else{Je&&st&&t.texStorage2D(n.TEXTURE_2D,Ze,ke,Ve[0].width,Ve[0].height);for(let we=0,De=Ve.length;we0){const we=rA(Z.width,Z.height,D.format,D.type);for(const De of D.layerUpdates){const Ke=Z.data.subarray(De*we/Z.data.BYTES_PER_ELEMENT,(De+1)*we/Z.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,De,Z.width,Z.height,1,$,ae,Ke)}D.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,Z.width,Z.height,Z.depth,$,ae,Z.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,ke,Z.width,Z.height,Z.depth,0,$,ae,Z.data);else if(D.isData3DTexture)Je?(st&&t.texStorage3D(n.TEXTURE_3D,Ze,ke,Z.width,Z.height,Z.depth),pe&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,Z.width,Z.height,Z.depth,$,ae,Z.data)):t.texImage3D(n.TEXTURE_3D,0,ke,Z.width,Z.height,Z.depth,0,$,ae,Z.data);else if(D.isFramebufferTexture){if(st)if(Je)t.texStorage2D(n.TEXTURE_2D,Ze,ke,Z.width,Z.height);else{let we=Z.width,De=Z.height;for(let Ke=0;Ke>=1,De>>=1}}else if(Ve.length>0){if(Je&&st){const we=j(Ve[0]);t.texStorage2D(n.TEXTURE_2D,Ze,ke,we.width,we.height)}for(let we=0,De=Ve.length;we0&&Ze++;const De=j($[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Ze,Ve,De.width,De.height)}for(let De=0;De<6;De++)if(Z){Je?pe&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,0,0,$[De].width,$[De].height,ke,Le,$[De].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+De,0,Ve,$[De].width,$[De].height,0,ke,Le,$[De].data);for(let Ke=0;Ke>ue),ae=Math.max(1,D.height>>ue);X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY?t.texImage3D(X,ue,N,$,ae,D.depth,0,z,C,null):t.texImage2D(X,ue,N,$,ae,0,z,C,null)}t.bindFramebuffer(n.FRAMEBUFFER,B),H(D)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,G,X,Z.__webglTexture,0,J(D)):(X===n.TEXTURE_2D||X>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&X<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,G,X,Z.__webglTexture,ue),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Ce(B,D,W){if(n.bindRenderbuffer(n.RENDERBUFFER,B),D.depthBuffer){const G=D.depthTexture,X=G&&G.isDepthTexture?G.type:null,ue=_(D.stencilBuffer,X),z=D.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,C=J(D);H(D)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,C,ue,D.width,D.height):W?n.renderbufferStorageMultisample(n.RENDERBUFFER,C,ue,D.width,D.height):n.renderbufferStorage(n.RENDERBUFFER,ue,D.width,D.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,z,n.RENDERBUFFER,B)}else{const G=D.textures;for(let X=0;X{delete D.__boundDepthTexture,delete D.__depthDisposeCallback,G.removeEventListener("dispose",X)};G.addEventListener("dispose",X),D.__depthDisposeCallback=X}D.__boundDepthTexture=G}if(B.depthTexture&&!D.__autoAllocateDepthBuffer){if(W)throw new Error("target.depthTexture not supported in Cube render targets");Ie(D.__webglFramebuffer,B)}else if(W){D.__webglDepthbuffer=[];for(let G=0;G<6;G++)if(t.bindFramebuffer(n.FRAMEBUFFER,D.__webglFramebuffer[G]),D.__webglDepthbuffer[G]===void 0)D.__webglDepthbuffer[G]=n.createRenderbuffer(),Ce(D.__webglDepthbuffer[G],B,!1);else{const X=B.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,ue=D.__webglDepthbuffer[G];n.bindRenderbuffer(n.RENDERBUFFER,ue),n.framebufferRenderbuffer(n.FRAMEBUFFER,X,n.RENDERBUFFER,ue)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,D.__webglFramebuffer),D.__webglDepthbuffer===void 0)D.__webglDepthbuffer=n.createRenderbuffer(),Ce(D.__webglDepthbuffer,B,!1);else{const G=B.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,X=D.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,X),n.framebufferRenderbuffer(n.FRAMEBUFFER,G,n.RENDERBUFFER,X)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function Be(B,D,W){const G=i.get(B);D!==void 0&&Te(G.__webglFramebuffer,B,B.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),W!==void 0&&ze(B)}function it(B){const D=B.texture,W=i.get(B),G=i.get(D);B.addEventListener("dispose",A);const X=B.textures,ue=B.isWebGLCubeRenderTarget===!0,z=X.length>1;if(z||(G.__webglTexture===void 0&&(G.__webglTexture=n.createTexture()),G.__version=D.version,o.memory.textures++),ue){W.__webglFramebuffer=[];for(let C=0;C<6;C++)if(D.mipmaps&&D.mipmaps.length>0){W.__webglFramebuffer[C]=[];for(let N=0;N0){W.__webglFramebuffer=[];for(let C=0;C0&&H(B)===!1){W.__webglMultisampledFramebuffer=n.createFramebuffer(),W.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,W.__webglMultisampledFramebuffer);for(let C=0;C0)for(let N=0;N0)for(let N=0;N0){if(H(B)===!1){const D=B.textures,W=B.width,G=B.height;let X=n.COLOR_BUFFER_BIT;const ue=B.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,z=i.get(B),C=D.length>1;if(C)for(let N=0;N0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&D.__useRenderToTexture!==!1}function P(B){const D=o.render.frame;u.get(B)!==D&&(u.set(B,D),B.update())}function U(B,D){const W=B.colorSpace,G=B.format,X=B.type;return B.isCompressedTexture===!0||B.isVideoTexture===!0||W!==Bi&&W!==Vs&&(wt.getTransfer(W)===Zt?(G!==Di||X!==Js)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",W)),D}function j(B){return typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement?(c.width=B.naturalWidth||B.width,c.height=B.naturalHeight||B.height):typeof VideoFrame<"u"&&B instanceof VideoFrame?(c.width=B.displayWidth,c.height=B.displayHeight):(c.width=B.width,c.height=B.height),c}this.allocateTextureUnit=k,this.resetTextureUnits=L,this.setTexture2D=F,this.setTexture2DArray=V,this.setTexture3D=Q,this.setTextureCube=ee,this.rebindTextures=Be,this.setupRenderTarget=it,this.updateRenderTargetMipmap=te,this.updateMultisampleRenderTarget=oe,this.setupDepthRenderbuffer=ze,this.setupFrameBufferTexture=Te,this.useMultisampledRTT=H}function Q5(n,e){function t(i,r=Vs){let s;const o=wt.getTransfer(r);if(i===Js)return n.UNSIGNED_BYTE;if(i===f_)return n.UNSIGNED_SHORT_4_4_4_4;if(i===p_)return n.UNSIGNED_SHORT_5_5_5_1;if(i===m5)return n.UNSIGNED_INT_5_9_9_9_REV;if(i===f5)return n.BYTE;if(i===p5)return n.SHORT;if(i===sh)return n.UNSIGNED_SHORT;if(i===Zm)return n.INT;if(i===Ni)return n.UNSIGNED_INT;if(i===ir)return n.FLOAT;if(i===Ts)return n.HALF_FLOAT;if(i===g5)return n.ALPHA;if(i===y5)return n.RGB;if(i===Di)return n.RGBA;if(i===v5)return n.LUMINANCE;if(i===_5)return n.LUMINANCE_ALPHA;if(i===Ml)return n.DEPTH_COMPONENT;if(i===du)return n.DEPTH_STENCIL;if(i===m_)return n.RED;if(i===Jm)return n.RED_INTEGER;if(i===oh)return n.RG;if(i===g_)return n.RG_INTEGER;if(i===wo)return n.RGBA_INTEGER;if(i===Tp||i===wp||i===Cp||i===Ep)if(o===Zt)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(i===Tp)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===wp)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Cp)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===Ep)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(i===Tp)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===wp)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Cp)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===Ep)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===oy||i===ay||i===ly||i===cy)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(i===oy)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===ay)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===ly)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===cy)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===uy||i===dy||i===hy)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(i===uy||i===dy)return o===Zt?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(i===hy)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===fy||i===py||i===my||i===gy||i===yy||i===vy||i===_y||i===xy||i===Sy||i===Ay||i===by||i===Ty||i===wy||i===Cy)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(i===fy)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===py)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===my)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===gy)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===yy)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===vy)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===_y)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===xy)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===Sy)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===Ay)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===by)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===Ty)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===wy)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===Cy)return o===Zt?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===Mp||i===Ey||i===My)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(i===Mp)return o===Zt?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===Ey)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===My)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===x5||i===Ry||i===Iy||i===Ny)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(i===Mp)return s.COMPRESSED_RED_RGTC1_EXT;if(i===Ry)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===Iy)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===Ny)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===uu?n.UNSIGNED_INT_24_8:n[i]!==void 0?n[i]:null}return{convert:t}}const CB="\nvoid main() {\n\n gl_Position = vec4( position, 1.0 );\n\n}",EB="\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n if ( coord.x >= 1.0 ) {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n } else {\n\n gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n }\n\n}";class MB{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){const r=new Wn,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}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,i=new Pr({vertexShader:CB,fragmentShader:EB,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new pn(new pu(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class RB extends ro{constructor(e,t){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,d=null,h=null,f=null,p=null;const g=new MB,y=t.getContextAttributes();let m=null,v=null;const x=[],_=[],S=new qe;let E=null;const A=new Ki;A.viewport=new Mt;const R=new Ki;R.viewport=new Mt;const w=[A,R],M=new BL;let I=null,L=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(le){let fe=x[le];return fe===void 0&&(fe=new wg,x[le]=fe),fe.getTargetRaySpace()},this.getControllerGrip=function(le){let fe=x[le];return fe===void 0&&(fe=new wg,x[le]=fe),fe.getGripSpace()},this.getHand=function(le){let fe=x[le];return fe===void 0&&(fe=new wg,x[le]=fe),fe.getHandSpace()};function k(le){const fe=_.indexOf(le.inputSource);if(fe===-1)return;const Te=x[fe];Te!==void 0&&(Te.update(le.inputSource,le.frame,c||o),Te.dispatchEvent({type:le.type,data:le.inputSource}))}function T(){r.removeEventListener("select",k),r.removeEventListener("selectstart",k),r.removeEventListener("selectend",k),r.removeEventListener("squeeze",k),r.removeEventListener("squeezestart",k),r.removeEventListener("squeezeend",k),r.removeEventListener("end",T),r.removeEventListener("inputsourceschange",F);for(let le=0;le=0&&(_[Ce]=null,x[Ce].disconnect(Te))}for(let fe=0;fe=_.length){_.push(Te),Ce=ze;break}else if(_[ze]===null){_[ze]=Te,Ce=ze;break}if(Ce===-1)break}const Ie=x[Ce];Ie&&Ie.connect(Te)}}const V=new Y,Q=new Y;function ee(le,fe,Te){V.setFromMatrixPosition(fe.matrixWorld),Q.setFromMatrixPosition(Te.matrixWorld);const Ce=V.distanceTo(Q),Ie=fe.projectionMatrix.elements,ze=Te.projectionMatrix.elements,Be=Ie[14]/(Ie[10]-1),it=Ie[14]/(Ie[10]+1),te=(Ie[9]+1)/Ie[5],ne=(Ie[9]-1)/Ie[5],b=(Ie[8]-1)/Ie[0],oe=(ze[8]+1)/ze[0],J=Be*b,H=Be*oe,P=Ce/(-b+oe),U=P*-b;if(fe.matrixWorld.decompose(le.position,le.quaternion,le.scale),le.translateX(U),le.translateZ(P),le.matrixWorld.compose(le.position,le.quaternion,le.scale),le.matrixWorldInverse.copy(le.matrixWorld).invert(),Ie[10]===-1)le.projectionMatrix.copy(fe.projectionMatrix),le.projectionMatrixInverse.copy(fe.projectionMatrixInverse);else{const j=Be+P,B=it+P,D=J-U,W=H+(Ce-U),G=te*it/B*j,X=ne*it/B*j;le.projectionMatrix.makePerspective(D,W,G,X,j,B),le.projectionMatrixInverse.copy(le.projectionMatrix).invert()}}function se(le,fe){fe===null?le.matrixWorld.copy(le.matrix):le.matrixWorld.multiplyMatrices(fe.matrixWorld,le.matrix),le.matrixWorldInverse.copy(le.matrixWorld).invert()}this.updateCamera=function(le){if(r===null)return;let fe=le.near,Te=le.far;g.texture!==null&&(g.depthNear>0&&(fe=g.depthNear),g.depthFar>0&&(Te=g.depthFar)),M.near=R.near=A.near=fe,M.far=R.far=A.far=Te,(I!==M.near||L!==M.far)&&(r.updateRenderState({depthNear:M.near,depthFar:M.far}),I=M.near,L=M.far),A.layers.mask=le.layers.mask|2,R.layers.mask=le.layers.mask|4,M.layers.mask=A.layers.mask|R.layers.mask;const Ce=le.parent,Ie=M.cameras;se(M,Ce);for(let ze=0;ze0&&(y.alphaTest.value=m.alphaTest);const v=e.get(m),x=v.envMap,_=v.envMapRotation;x&&(y.envMap.value=x,nl.copy(_),nl.x*=-1,nl.y*=-1,nl.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(nl.y*=-1,nl.z*=-1),y.envMapRotation.value.setFromMatrix4(IB.makeRotationFromEuler(nl)),y.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=m.reflectivity,y.ior.value=m.ior,y.refractionRatio.value=m.refractionRatio),m.lightMap&&(y.lightMap.value=m.lightMap,y.lightMapIntensity.value=m.lightMapIntensity,t(m.lightMap,y.lightMapTransform)),m.aoMap&&(y.aoMap.value=m.aoMap,y.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,y.aoMapTransform))}function o(y,m){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,m.map&&(y.map.value=m.map,t(m.map,y.mapTransform))}function a(y,m){y.dashSize.value=m.dashSize,y.totalSize.value=m.dashSize+m.gapSize,y.scale.value=m.scale}function l(y,m,v,x){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,y.size.value=m.size*v,y.scale.value=x*.5,m.map&&(y.map.value=m.map,t(m.map,y.uvTransform)),m.alphaMap&&(y.alphaMap.value=m.alphaMap,t(m.alphaMap,y.alphaMapTransform)),m.alphaTest>0&&(y.alphaTest.value=m.alphaTest)}function c(y,m){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,y.rotation.value=m.rotation,m.map&&(y.map.value=m.map,t(m.map,y.mapTransform)),m.alphaMap&&(y.alphaMap.value=m.alphaMap,t(m.alphaMap,y.alphaMapTransform)),m.alphaTest>0&&(y.alphaTest.value=m.alphaTest)}function u(y,m){y.specular.value.copy(m.specular),y.shininess.value=Math.max(m.shininess,1e-4)}function d(y,m){m.gradientMap&&(y.gradientMap.value=m.gradientMap)}function h(y,m){y.metalness.value=m.metalness,m.metalnessMap&&(y.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,y.metalnessMapTransform)),y.roughness.value=m.roughness,m.roughnessMap&&(y.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,y.roughnessMapTransform)),m.envMap&&(y.envMapIntensity.value=m.envMapIntensity)}function f(y,m,v){y.ior.value=m.ior,m.sheen>0&&(y.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),y.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(y.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,y.sheenColorMapTransform)),m.sheenRoughnessMap&&(y.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,y.sheenRoughnessMapTransform))),m.clearcoat>0&&(y.clearcoat.value=m.clearcoat,y.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(y.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,y.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(y.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Fi&&y.clearcoatNormalScale.value.negate())),m.dispersion>0&&(y.dispersion.value=m.dispersion),m.iridescence>0&&(y.iridescence.value=m.iridescence,y.iridescenceIOR.value=m.iridescenceIOR,y.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(y.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,y.iridescenceMapTransform)),m.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),m.transmission>0&&(y.transmission.value=m.transmission,y.transmissionSamplerMap.value=v.texture,y.transmissionSamplerSize.value.set(v.width,v.height),m.transmissionMap&&(y.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,y.transmissionMapTransform)),y.thickness.value=m.thickness,m.thicknessMap&&(y.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=m.attenuationDistance,y.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(y.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(y.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=m.specularIntensity,y.specularColor.value.copy(m.specularColor),m.specularColorMap&&(y.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,y.specularColorMapTransform)),m.specularIntensityMap&&(y.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,y.specularIntensityMapTransform))}function p(y,m){m.matcap&&(y.matcap.value=m.matcap)}function g(y,m){const v=e.get(m).light;y.referencePosition.value.setFromMatrixPosition(v.matrixWorld),y.nearDistance.value=v.shadow.camera.near,y.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function PB(n,e,t,i){let r={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,x){const _=x.program;i.uniformBlockBinding(v,_)}function c(v,x){let _=r[v.id];_===void 0&&(p(v),_=u(v),r[v.id]=_,v.addEventListener("dispose",y));const S=x.program;i.updateUBOMapping(v,S);const E=e.render.frame;s[v.id]!==E&&(h(v),s[v.id]=E)}function u(v){const x=d();v.__bindingPointIndex=x;const _=n.createBuffer(),S=v.__size,E=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,_),n.bufferData(n.UNIFORM_BUFFER,S,E),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,x,_),_}function d(){for(let v=0;v0&&(_+=S-E),v.__size=_,v.__cache={},this}function g(v){const x={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(x.boundary=4,x.storage=4):v.isVector2?(x.boundary=8,x.storage=8):v.isVector3||v.isColor?(x.boundary=16,x.storage=12):v.isVector4?(x.boundary=16,x.storage=16):v.isMatrix3?(x.boundary=48,x.storage=48):v.isMatrix4?(x.boundary=64,x.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),x}function y(v){const x=v.target;x.removeEventListener("dispose",y);const _=o.indexOf(x.__bindingPointIndex);o.splice(_,1),n.deleteBuffer(r[x.id]),delete r[x.id],delete s[x.id]}function m(){for(const v in r)n.deleteBuffer(r[v]);o=[],r={},s={}}return{bind:l,update:c,dispose:m}}class LB{constructor(e={}){const{canvas:t=MP(),context:i=null,depth:r=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:d=!1,reverseDepthBuffer:h=!1}=e;this.isWebGLRenderer=!0;let f;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=i.getContextAttributes().alpha}else f=o;const p=new Uint32Array(4),g=new Int32Array(4);let y=null,m=null;const v=[],x=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=fi,this.toneMapping=_s,this.toneMappingExposure=1;const _=this;let S=!1,E=0,A=0,R=null,w=-1,M=null;const I=new Mt,L=new Mt;let k=null;const T=new gt(0);let F=0,V=t.width,Q=t.height,ee=1,se=null,he=null;const ie=new Mt(0,0,V,Q),re=new Mt(0,0,V,Q);let be=!1;const le=new S_;let fe=!1,Te=!1;this.transmissionResolutionScale=1;const Ce=new Xe,Ie=new Xe,ze=new Y,Be=new Mt,it={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let te=!1;function ne(){return R===null?ee:1}let b=i;function oe(K,ge){return t.getContext(K,ge)}try{const K={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:d};if("setAttribute"in t&&t.setAttribute("data-engine","three.js r".concat(d_)),t.addEventListener("webglcontextlost",De,!1),t.addEventListener("webglcontextrestored",Ke,!1),t.addEventListener("webglcontextcreationerror",et,!1),b===null){const ge="webgl2";if(b=oe(ge,K),b===null)throw oe(ge)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(K){throw console.error("THREE.WebGLRenderer: "+K.message),K}let J,H,P,U,j,B,D,W,G,X,ue,z,C,N,q,Z,$,ae,ke,Le,Ve,Je,st,pe;function Ze(){J=new G7(b),J.init(),Je=new Q5(b,J),H=new k7(b,J,e,Je),P=new TB(b,J),H.reverseDepthBuffer&&h&&P.buffers.depth.setReversed(!0),U=new j7(b),j=new dB,B=new wB(b,J,P,j,H,Je,U),D=new z7(_),W=new $7(_),G=new eD(b),st=new O7(b,G),X=new W7(b,G,U,st),ue=new X7(b,X,G,U),ke=new q7(b,H,B),Z=new U7(j),z=new uB(_,D,W,J,H,st,Z),C=new NB(_,j),N=new fB,q=new _B(J),ae=new F7(_,D,W,P,ue,f,l),$=new AB(_,ue,H),pe=new PB(b,U,H,P),Le=new B7(b,J,U),Ve=new Q7(b,J,U),U.programs=z.programs,_.capabilities=H,_.extensions=J,_.properties=j,_.renderLists=N,_.shadowMap=$,_.state=P,_.info=U}Ze();const we=new RB(_,b);this.xr=we,this.getContext=function(){return b},this.getContextAttributes=function(){return b.getContextAttributes()},this.forceContextLoss=function(){const K=J.get("WEBGL_lose_context");K&&K.loseContext()},this.forceContextRestore=function(){const K=J.get("WEBGL_lose_context");K&&K.restoreContext()},this.getPixelRatio=function(){return ee},this.setPixelRatio=function(K){K!==void 0&&(ee=K,this.setSize(V,Q,!1))},this.getSize=function(K){return K.set(V,Q)},this.setSize=function(K,ge,Se=!0){if(we.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}V=K,Q=ge,t.width=Math.floor(K*ee),t.height=Math.floor(ge*ee),Se===!0&&(t.style.width=K+"px",t.style.height=ge+"px"),this.setViewport(0,0,K,ge)},this.getDrawingBufferSize=function(K){return K.set(V*ee,Q*ee).floor()},this.setDrawingBufferSize=function(K,ge,Se){V=K,Q=ge,ee=Se,t.width=Math.floor(K*Se),t.height=Math.floor(ge*Se),this.setViewport(0,0,K,ge)},this.getCurrentViewport=function(K){return K.copy(I)},this.getViewport=function(K){return K.copy(ie)},this.setViewport=function(K,ge,Se,Ae){K.isVector4?ie.set(K.x,K.y,K.z,K.w):ie.set(K,ge,Se,Ae),P.viewport(I.copy(ie).multiplyScalar(ee).round())},this.getScissor=function(K){return K.copy(re)},this.setScissor=function(K,ge,Se,Ae){K.isVector4?re.set(K.x,K.y,K.z,K.w):re.set(K,ge,Se,Ae),P.scissor(L.copy(re).multiplyScalar(ee).round())},this.getScissorTest=function(){return be},this.setScissorTest=function(K){P.setScissorTest(be=K)},this.setOpaqueSort=function(K){se=K},this.setTransparentSort=function(K){he=K},this.getClearColor=function(K){return K.copy(ae.getClearColor())},this.setClearColor=function(){ae.setClearColor.apply(ae,arguments)},this.getClearAlpha=function(){return ae.getClearAlpha()},this.setClearAlpha=function(){ae.setClearAlpha.apply(ae,arguments)},this.clear=function(K=!0,ge=!0,Se=!0){let Ae=0;if(K){let ye=!1;if(R!==null){const $e=R.texture.format;ye=$e===wo||$e===g_||$e===Jm}if(ye){const $e=R.texture.type,nt=$e===Js||$e===Ni||$e===sh||$e===uu||$e===f_||$e===p_,ot=ae.getClearColor(),at=ae.getClearAlpha(),At=ot.r,Tt=ot.g,ht=ot.b;nt?(p[0]=At,p[1]=Tt,p[2]=ht,p[3]=at,b.clearBufferuiv(b.COLOR,0,p)):(g[0]=At,g[1]=Tt,g[2]=ht,g[3]=at,b.clearBufferiv(b.COLOR,0,g))}else Ae|=b.COLOR_BUFFER_BIT}ge&&(Ae|=b.DEPTH_BUFFER_BIT),Se&&(Ae|=b.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),b.clear(Ae)},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",De,!1),t.removeEventListener("webglcontextrestored",Ke,!1),t.removeEventListener("webglcontextcreationerror",et,!1),ae.dispose(),N.dispose(),q.dispose(),j.dispose(),D.dispose(),W.dispose(),ue.dispose(),st.dispose(),pe.dispose(),z.dispose(),we.dispose(),we.removeEventListener("sessionstart",u2),we.removeEventListener("sessionend",d2),Qa.stop()};function De(K){K.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),S=!0}function Ke(){console.log("THREE.WebGLRenderer: Context Restored."),S=!1;const K=U.autoReset,ge=$.enabled,Se=$.autoUpdate,Ae=$.needsUpdate,ye=$.type;Ze(),U.autoReset=K,$.enabled=ge,$.autoUpdate=Se,$.needsUpdate=Ae,$.type=ye}function et(K){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",K.statusMessage)}function _t(K){const ge=K.target;ge.removeEventListener("dispose",_t),hn(ge)}function hn(K){Ti(K),j.remove(K)}function Ti(K){const ge=j.get(K).programs;ge!==void 0&&(ge.forEach(function(Se){z.releaseProgram(Se)}),K.isShaderMaterial&&z.releaseShaderCache(K))}this.renderBufferDirect=function(K,ge,Se,Ae,ye,$e){ge===null&&(ge=it);const nt=ye.isMesh&&ye.matrixWorld.determinant()<0,ot=oI(K,ge,Se,Ae,ye);P.setMaterial(Ae,nt);let at=Se.index,At=1;if(Ae.wireframe===!0){if(at=X.getWireframeAttribute(Se),at===void 0)return;At=2}const Tt=Se.drawRange,ht=Se.attributes.position;let Ut=Tt.start*At,Xt=(Tt.start+Tt.count)*At;$e!==null&&(Ut=Math.max(Ut,$e.start*At),Xt=Math.min(Xt,($e.start+$e.count)*At)),at!==null?(Ut=Math.max(Ut,0),Xt=Math.min(Xt,at.count)):ht!=null&&(Ut=Math.max(Ut,0),Xt=Math.min(Xt,ht.count));const Un=Xt-Ut;if(Un<0||Un===1/0)return;st.setup(ye,Ae,ot,Se,at);let Cn,Vt=Le;if(at!==null&&(Cn=G.get(at),Vt=Ve,Vt.setIndex(Cn)),ye.isMesh)Ae.wireframe===!0?(P.setLineWidth(Ae.wireframeLinewidth*ne()),Vt.setMode(b.LINES)):Vt.setMode(b.TRIANGLES);else if(ye.isLine){let pt=Ae.linewidth;pt===void 0&&(pt=1),P.setLineWidth(pt*ne()),ye.isLineSegments?Vt.setMode(b.LINES):ye.isLineLoop?Vt.setMode(b.LINE_LOOP):Vt.setMode(b.LINE_STRIP)}else ye.isPoints?Vt.setMode(b.POINTS):ye.isSprite&&Vt.setMode(b.TRIANGLES);if(ye.isBatchedMesh)if(ye._multiDrawInstances!==null)Vt.renderMultiDrawInstances(ye._multiDrawStarts,ye._multiDrawCounts,ye._multiDrawCount,ye._multiDrawInstances);else if(J.get("WEBGL_multi_draw"))Vt.renderMultiDraw(ye._multiDrawStarts,ye._multiDrawCounts,ye._multiDrawCount);else{const pt=ye._multiDrawStarts,di=ye._multiDrawCounts,Kt=ye._multiDrawCount,as=at?G.get(at).bytesPerElement:1,Kl=j.get(Ae).currentProgram.getUniforms();for(let dr=0;dr{function $e(){if(Ae.forEach(function(nt){j.get(nt).currentProgram.isReady()&&Ae.delete(nt)}),Ae.size===0){ye(K);return}setTimeout($e,10)}J.get("KHR_parallel_shader_compile")!==null?$e():setTimeout($e,10)})};let os=null;function uo(K){os&&os(K)}function u2(){Qa.stop()}function d2(){Qa.start()}const Qa=new V5;Qa.setAnimationLoop(uo),typeof self<"u"&&Qa.setContext(self),this.setAnimationLoop=function(K){os=K,we.setAnimationLoop(K),K===null?Qa.stop():Qa.start()},we.addEventListener("sessionstart",u2),we.addEventListener("sessionend",d2),this.render=function(K,ge){if(ge!==void 0&&ge.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(S===!0)return;if(K.matrixWorldAutoUpdate===!0&&K.updateMatrixWorld(),ge.parent===null&&ge.matrixWorldAutoUpdate===!0&&ge.updateMatrixWorld(),we.enabled===!0&&we.isPresenting===!0&&(we.cameraAutoUpdate===!0&&we.updateCamera(ge),ge=we.getCamera()),K.isScene===!0&&K.onBeforeRender(_,K,ge,R),m=q.get(K,x.length),m.init(ge),x.push(m),Ie.multiplyMatrices(ge.projectionMatrix,ge.matrixWorldInverse),le.setFromProjectionMatrix(Ie),Te=this.localClippingEnabled,fe=Z.init(this.clippingPlanes,Te),y=N.get(K,v.length),y.init(),v.push(y),we.enabled===!0&&we.isPresenting===!0){const $e=_.xr.getDepthSensingMesh();$e!==null&&B0($e,ge,-1/0,_.sortObjects)}B0(K,ge,0,_.sortObjects),y.finish(),_.sortObjects===!0&&y.sort(se,he),te=we.enabled===!1||we.isPresenting===!1||we.hasDepthSensing()===!1,te&&ae.addToRenderList(y,K),this.info.render.frame++,fe===!0&&Z.beginShadows();const Se=m.state.shadowsArray;$.render(Se,K,ge),fe===!0&&Z.endShadows(),this.info.autoReset===!0&&this.info.reset();const Ae=y.opaque,ye=y.transmissive;if(m.setupLights(),ge.isArrayCamera){const $e=ge.cameras;if(ye.length>0)for(let nt=0,ot=$e.length;nt0&&f2(Ae,ye,K,ge),te&&ae.render(K),h2(y,K,ge);R!==null&&A===0&&(B.updateMultisampleRenderTarget(R),B.updateRenderTargetMipmap(R)),K.isScene===!0&&K.onAfterRender(_,K,ge),st.resetDefaultState(),w=-1,M=null,x.pop(),x.length>0?(m=x[x.length-1],fe===!0&&Z.setGlobalState(_.clippingPlanes,m.state.camera)):m=null,v.pop(),v.length>0?y=v[v.length-1]:y=null};function B0(K,ge,Se,Ae){if(K.visible===!1)return;if(K.layers.test(ge.layers)){if(K.isGroup)Se=K.renderOrder;else if(K.isLOD)K.autoUpdate===!0&&K.update(ge);else if(K.isLight)m.pushLight(K),K.castShadow&&m.pushShadow(K);else if(K.isSprite){if(!K.frustumCulled||le.intersectsSprite(K)){Ae&&Be.setFromMatrixPosition(K.matrixWorld).applyMatrix4(Ie);const nt=ue.update(K),ot=K.material;ot.visible&&y.push(K,nt,ot,Se,Be.z,null)}}else if((K.isMesh||K.isLine||K.isPoints)&&(!K.frustumCulled||le.intersectsObject(K))){const nt=ue.update(K),ot=K.material;if(Ae&&(K.boundingSphere!==void 0?(K.boundingSphere===null&&K.computeBoundingSphere(),Be.copy(K.boundingSphere.center)):(nt.boundingSphere===null&&nt.computeBoundingSphere(),Be.copy(nt.boundingSphere.center)),Be.applyMatrix4(K.matrixWorld).applyMatrix4(Ie)),Array.isArray(ot)){const at=nt.groups;for(let At=0,Tt=at.length;At0&&af(ye,ge,Se),$e.length>0&&af($e,ge,Se),nt.length>0&&af(nt,ge,Se),P.buffers.depth.setTest(!0),P.buffers.depth.setMask(!0),P.buffers.color.setMask(!0),P.setPolygonOffset(!1)}function f2(K,ge,Se,Ae){if((Se.isScene===!0?Se.overrideMaterial:null)!==null)return;m.state.transmissionRenderTarget[Ae.id]===void 0&&(m.state.transmissionRenderTarget[Ae.id]=new Fa(1,1,{generateMipmaps:!0,type:J.has("EXT_color_buffer_half_float")||J.has("EXT_color_buffer_float")?Ts:Js,minFilter:Hs,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:wt.workingColorSpace}));const $e=m.state.transmissionRenderTarget[Ae.id],nt=Ae.viewport||I;$e.setSize(nt.z*_.transmissionResolutionScale,nt.w*_.transmissionResolutionScale);const ot=_.getRenderTarget();_.setRenderTarget($e),_.getClearColor(T),F=_.getClearAlpha(),F<1&&_.setClearColor(16777215,.5),_.clear(),te&&ae.render(Se);const at=_.toneMapping;_.toneMapping=_s;const At=Ae.viewport;if(Ae.viewport!==void 0&&(Ae.viewport=void 0),m.setupLightsView(Ae),fe===!0&&Z.setGlobalState(_.clippingPlanes,Ae),af(K,Se,Ae),B.updateMultisampleRenderTarget($e),B.updateRenderTargetMipmap($e),J.has("WEBGL_multisampled_render_to_texture")===!1){let Tt=!1;for(let ht=0,Ut=ge.length;ht0),ht=!!Se.morphAttributes.position,Ut=!!Se.morphAttributes.normal,Xt=!!Se.morphAttributes.color;let Un=_s;Ae.toneMapped&&(R===null||R.isXRRenderTarget===!0)&&(Un=_.toneMapping);const Cn=Se.morphAttributes.position||Se.morphAttributes.normal||Se.morphAttributes.color,Vt=Cn!==void 0?Cn.length:0,pt=j.get(Ae),di=m.state.lights;if(fe===!0&&(Te===!0||K!==M)){const zi=K===M&&Ae.id===w;Z.setState(Ae,K,zi)}let Kt=!1;Ae.version===pt.__version?(pt.needsLights&&pt.lightsStateVersion!==di.state.version||pt.outputColorSpace!==ot||ye.isBatchedMesh&&pt.batching===!1||!ye.isBatchedMesh&&pt.batching===!0||ye.isBatchedMesh&&pt.batchingColor===!0&&ye.colorTexture===null||ye.isBatchedMesh&&pt.batchingColor===!1&&ye.colorTexture!==null||ye.isInstancedMesh&&pt.instancing===!1||!ye.isInstancedMesh&&pt.instancing===!0||ye.isSkinnedMesh&&pt.skinning===!1||!ye.isSkinnedMesh&&pt.skinning===!0||ye.isInstancedMesh&&pt.instancingColor===!0&&ye.instanceColor===null||ye.isInstancedMesh&&pt.instancingColor===!1&&ye.instanceColor!==null||ye.isInstancedMesh&&pt.instancingMorph===!0&&ye.morphTexture===null||ye.isInstancedMesh&&pt.instancingMorph===!1&&ye.morphTexture!==null||pt.envMap!==at||Ae.fog===!0&&pt.fog!==$e||pt.numClippingPlanes!==void 0&&(pt.numClippingPlanes!==Z.numPlanes||pt.numIntersection!==Z.numIntersection)||pt.vertexAlphas!==At||pt.vertexTangents!==Tt||pt.morphTargets!==ht||pt.morphNormals!==Ut||pt.morphColors!==Xt||pt.toneMapping!==Un||pt.morphTargetsCount!==Vt)&&(Kt=!0):(Kt=!0,pt.__version=Ae.version);let as=pt.currentProgram;Kt===!0&&(as=lf(Ae,ge,ye));let Kl=!1,dr=!1,Xu=!1;const Sn=as.getUniforms(),Ur=pt.uniforms;if(P.useProgram(as.program)&&(Kl=!0,dr=!0,Xu=!0),Ae.id!==w&&(w=Ae.id,dr=!0),Kl||M!==K){P.buffers.depth.getReversed()?(Ce.copy(K.projectionMatrix),IP(Ce),NP(Ce),Sn.setValue(b,"projectionMatrix",Ce)):Sn.setValue(b,"projectionMatrix",K.projectionMatrix),Sn.setValue(b,"viewMatrix",K.matrixWorldInverse);const nr=Sn.map.cameraPosition;nr!==void 0&&nr.setValue(b,ze.setFromMatrixPosition(K.matrixWorld)),H.logarithmicDepthBuffer&&Sn.setValue(b,"logDepthBufFC",2/(Math.log(K.far+1)/Math.LN2)),(Ae.isMeshPhongMaterial||Ae.isMeshToonMaterial||Ae.isMeshLambertMaterial||Ae.isMeshBasicMaterial||Ae.isMeshStandardMaterial||Ae.isShaderMaterial)&&Sn.setValue(b,"isOrthographic",K.isOrthographicCamera===!0),M!==K&&(M=K,dr=!0,Xu=!0)}if(ye.isSkinnedMesh){Sn.setOptional(b,ye,"bindMatrix"),Sn.setOptional(b,ye,"bindMatrixInverse");const zi=ye.skeleton;zi&&(zi.boneTexture===null&&zi.computeBoneTexture(),Sn.setValue(b,"boneTexture",zi.boneTexture,B))}ye.isBatchedMesh&&(Sn.setOptional(b,ye,"batchingTexture"),Sn.setValue(b,"batchingTexture",ye._matricesTexture,B),Sn.setOptional(b,ye,"batchingIdTexture"),Sn.setValue(b,"batchingIdTexture",ye._indirectTexture,B),Sn.setOptional(b,ye,"batchingColorTexture"),ye._colorsTexture!==null&&Sn.setValue(b,"batchingColorTexture",ye._colorsTexture,B));const zr=Se.morphAttributes;if((zr.position!==void 0||zr.normal!==void 0||zr.color!==void 0)&&ke.update(ye,Se,as),(dr||pt.receiveShadow!==ye.receiveShadow)&&(pt.receiveShadow=ye.receiveShadow,Sn.setValue(b,"receiveShadow",ye.receiveShadow)),Ae.isMeshGouraudMaterial&&Ae.envMap!==null&&(Ur.envMap.value=at,Ur.flipEnvMap.value=at.isCubeTexture&&at.isRenderTargetTexture===!1?-1:1),Ae.isMeshStandardMaterial&&Ae.envMap===null&&ge.environment!==null&&(Ur.envMapIntensity.value=ge.environmentIntensity),dr&&(Sn.setValue(b,"toneMappingExposure",_.toneMappingExposure),pt.needsLights&&aI(Ur,Xu),$e&&Ae.fog===!0&&C.refreshFogUniforms(Ur,$e),C.refreshMaterialUniforms(Ur,Ae,ee,Q,m.state.transmissionRenderTarget[K.id]),Rp.upload(b,m2(pt),Ur,B)),Ae.isShaderMaterial&&Ae.uniformsNeedUpdate===!0&&(Rp.upload(b,m2(pt),Ur,B),Ae.uniformsNeedUpdate=!1),Ae.isSpriteMaterial&&Sn.setValue(b,"center",ye.center),Sn.setValue(b,"modelViewMatrix",ye.modelViewMatrix),Sn.setValue(b,"normalMatrix",ye.normalMatrix),Sn.setValue(b,"modelMatrix",ye.matrixWorld),Ae.isShaderMaterial||Ae.isRawShaderMaterial){const zi=Ae.uniformsGroups;for(let nr=0,k0=zi.length;nr0&&B.useMultisampledRTT(K)===!1?ye=j.get(K).__webglMultisampledFramebuffer:Array.isArray(Tt)?ye=Tt[Se]:ye=Tt,I.copy(K.viewport),L.copy(K.scissor),k=K.scissorTest}else I.copy(ie).multiplyScalar(ee).floor(),L.copy(re).multiplyScalar(ee).floor(),k=be;if(Se!==0&&(ye=cI),P.bindFramebuffer(b.FRAMEBUFFER,ye)&&Ae&&P.drawBuffers(K,ye),P.viewport(I),P.scissor(L),P.setScissorTest(k),$e){const at=j.get(K.texture);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_CUBE_MAP_POSITIVE_X+ge,at.__webglTexture,Se)}else if(nt){const at=j.get(K.texture),At=ge;b.framebufferTextureLayer(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,at.__webglTexture,Se,At)}else if(K!==null&&Se!==0){const at=j.get(K.texture);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,at.__webglTexture,Se)}w=-1},this.readRenderTargetPixels=function(K,ge,Se,Ae,ye,$e,nt){if(!(K&&K.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ot=j.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&nt!==void 0&&(ot=ot[nt]),ot){P.bindFramebuffer(b.FRAMEBUFFER,ot);try{const at=K.texture,At=at.format,Tt=at.type;if(!H.textureFormatReadable(At)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!H.textureTypeReadable(Tt)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ge>=0&&ge<=K.width-Ae&&Se>=0&&Se<=K.height-ye&&b.readPixels(ge,Se,Ae,ye,Je.convert(At),Je.convert(Tt),$e)}finally{const at=R!==null?j.get(R).__webglFramebuffer:null;P.bindFramebuffer(b.FRAMEBUFFER,at)}}},this.readRenderTargetPixelsAsync=async function(K,ge,Se,Ae,ye,$e,nt){if(!(K&&K.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ot=j.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&nt!==void 0&&(ot=ot[nt]),ot){const at=K.texture,At=at.format,Tt=at.type;if(!H.textureFormatReadable(At))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!H.textureTypeReadable(Tt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(ge>=0&&ge<=K.width-Ae&&Se>=0&&Se<=K.height-ye){P.bindFramebuffer(b.FRAMEBUFFER,ot);const ht=b.createBuffer();b.bindBuffer(b.PIXEL_PACK_BUFFER,ht),b.bufferData(b.PIXEL_PACK_BUFFER,$e.byteLength,b.STREAM_READ),b.readPixels(ge,Se,Ae,ye,Je.convert(At),Je.convert(Tt),0);const Ut=R!==null?j.get(R).__webglFramebuffer:null;P.bindFramebuffer(b.FRAMEBUFFER,Ut);const Xt=b.fenceSync(b.SYNC_GPU_COMMANDS_COMPLETE,0);return b.flush(),await RP(b,Xt,4),b.bindBuffer(b.PIXEL_PACK_BUFFER,ht),b.getBufferSubData(b.PIXEL_PACK_BUFFER,0,$e),b.deleteBuffer(ht),b.deleteSync(Xt),$e}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(K,ge=null,Se=0){K.isTexture!==!0&&(Ec("WebGLRenderer: copyFramebufferToTexture function signature has changed."),ge=arguments[0]||null,K=arguments[1]);const Ae=Math.pow(2,-Se),ye=Math.floor(K.image.width*Ae),$e=Math.floor(K.image.height*Ae),nt=ge!==null?ge.x:0,ot=ge!==null?ge.y:0;B.setTexture2D(K,0),b.copyTexSubImage2D(b.TEXTURE_2D,Se,0,0,nt,ot,ye,$e),P.unbindTexture()};const uI=b.createFramebuffer(),dI=b.createFramebuffer();this.copyTextureToTexture=function(K,ge,Se=null,Ae=null,ye=0,$e=null){K.isTexture!==!0&&(Ec("WebGLRenderer: copyTextureToTexture function signature has changed."),Ae=arguments[0]||null,K=arguments[1],ge=arguments[2],$e=arguments[3]||0,Se=null),$e===null&&(ye!==0?(Ec("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),$e=ye,ye=0):$e=0);let nt,ot,at,At,Tt,ht,Ut,Xt,Un;const Cn=K.isCompressedTexture?K.mipmaps[$e]:K.image;if(Se!==null)nt=Se.max.x-Se.min.x,ot=Se.max.y-Se.min.y,at=Se.isBox3?Se.max.z-Se.min.z:1,At=Se.min.x,Tt=Se.min.y,ht=Se.isBox3?Se.min.z:0;else{const zr=Math.pow(2,-ye);nt=Math.floor(Cn.width*zr),ot=Math.floor(Cn.height*zr),K.isDataArrayTexture?at=Cn.depth:K.isData3DTexture?at=Math.floor(Cn.depth*zr):at=1,At=0,Tt=0,ht=0}Ae!==null?(Ut=Ae.x,Xt=Ae.y,Un=Ae.z):(Ut=0,Xt=0,Un=0);const Vt=Je.convert(ge.format),pt=Je.convert(ge.type);let di;ge.isData3DTexture?(B.setTexture3D(ge,0),di=b.TEXTURE_3D):ge.isDataArrayTexture||ge.isCompressedArrayTexture?(B.setTexture2DArray(ge,0),di=b.TEXTURE_2D_ARRAY):(B.setTexture2D(ge,0),di=b.TEXTURE_2D),b.pixelStorei(b.UNPACK_FLIP_Y_WEBGL,ge.flipY),b.pixelStorei(b.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ge.premultiplyAlpha),b.pixelStorei(b.UNPACK_ALIGNMENT,ge.unpackAlignment);const Kt=b.getParameter(b.UNPACK_ROW_LENGTH),as=b.getParameter(b.UNPACK_IMAGE_HEIGHT),Kl=b.getParameter(b.UNPACK_SKIP_PIXELS),dr=b.getParameter(b.UNPACK_SKIP_ROWS),Xu=b.getParameter(b.UNPACK_SKIP_IMAGES);b.pixelStorei(b.UNPACK_ROW_LENGTH,Cn.width),b.pixelStorei(b.UNPACK_IMAGE_HEIGHT,Cn.height),b.pixelStorei(b.UNPACK_SKIP_PIXELS,At),b.pixelStorei(b.UNPACK_SKIP_ROWS,Tt),b.pixelStorei(b.UNPACK_SKIP_IMAGES,ht);const Sn=K.isDataArrayTexture||K.isData3DTexture,Ur=ge.isDataArrayTexture||ge.isData3DTexture;if(K.isDepthTexture){const zr=j.get(K),zi=j.get(ge),nr=j.get(zr.__renderTarget),k0=j.get(zi.__renderTarget);P.bindFramebuffer(b.READ_FRAMEBUFFER,nr.__webglFramebuffer),P.bindFramebuffer(b.DRAW_FRAMEBUFFER,k0.__webglFramebuffer);for(let ja=0;ja{if(e===0)return n;if(e===1||e===2&&!t)return uh.fromHalfFloat(n);if(e===2)return P_(n,i,r)},Ud=(n,e,t)=>{n=gi(n,e,t);const i=t-e;return gi(Math.floor((n-e)/i*255),0,255)},P_=(n,e,t)=>{const i=t-e;return n/255*i+e},j5=(n,e,t)=>Ud(N_(n,e,t)),FB=(n,e,t)=>jn(P_(n,e,t)),Yt=(n,e,t,i=!1)=>t===0?n.getFloat32(e*4,!0):t===1||t===2&&!i?n.getUint16(e*2,!0):n.getUint8(e,!0),OB=function(){const n=e=>e;return function(e,t,i,r=!1){if(t===i)return e;let s=n;return t===2&&r?i===1?s=FB:i==0&&(s=P_):t===2||t===1?i===0?s=N_:i==2&&(r?s=j5:s=n):t===0&&(i===1?s=jn:i==2&&(r?s=Ud:s=jn)),s(e)}}(),vc=(n,e,t,i,r=0)=>{const s=new Uint8Array(n,e),o=new Uint8Array(t,i);for(let a=0;a{const c=l.w<0?-1:1;l.x*=c,l.y*=c,l.z*=c,l.w*=c};return function(l,c,u,d,h,f,p,g){const y=this.splatCount;d=d||0,h=h||y-1,f===void 0&&(f=d);const m=(v,x)=>OB(v,x,p);for(let v=d;v<=h;v++){const x=this.globalSplatIndexToSectionMap[v],_=this.sections[x],S=v-_.splatCountOffset,E=_.bytesPerSplat*S+Oe.CompressionLevels[this.compressionLevel].ScaleOffsetBytes,A=(v-d+f)*Oe.ScaleComponentCount,R=(v-d+f)*Oe.RotationComponentCount,w=new DataView(this.bufferData,_.dataBase+E),M=g&&g.x!==void 0?g.x:Yt(w,0,this.compressionLevel),I=g&&g.y!==void 0?g.y:Yt(w,1,this.compressionLevel),L=g&&g.z!==void 0?g.z:Yt(w,2,this.compressionLevel),k=Yt(w,3,this.compressionLevel),T=Yt(w,4,this.compressionLevel),F=Yt(w,5,this.compressionLevel),V=Yt(w,6,this.compressionLevel);r.set(An(M,this.compressionLevel),An(I,this.compressionLevel),An(L,this.compressionLevel)),s.set(An(T,this.compressionLevel),An(F,this.compressionLevel),An(V,this.compressionLevel),An(k,this.compressionLevel)).normalize(),u&&(o.set(0,0,0),e.makeScale(r.x,r.y,r.z),t.makeRotationFromQuaternion(s),i.identity().premultiply(e).premultiply(t),i.premultiply(u),i.decompose(o,s,r),s.normalize()),a(s),l&&(l[A]=m(r.x,0),l[A+1]=m(r.y,0),l[A+2]=m(r.z,0)),c&&(c[R]=m(s.x,0),c[R+1]=m(s.y,0),c[R+2]=m(s.z,0),c[R+3]=m(s.w,0))}}}());xe(this,"fillSphericalHarmonicsArray",function(){for(let T=0;T<15;T++)new Y;const e=new mt,t=new Xe,i=new Y,r=new Y,s=new Qt,o=[],a=[],l=[],c=[],u=[],d=[],h=[],f=[],p=[],g=[],y=[],m=[],v=[],x=[],_=[],S=[],E=[],A=[],R=T=>T,w=(T,F,V,Q)=>{T[0]=F,T[1]=V,T[2]=Q},M=(T,F,V,Q,ee)=>{T[0]=Yt(F,Q,ee,!0),T[1]=Yt(F,Q+V,ee,!0),T[2]=Yt(F,Q+V+V,ee,!0)},I=(T,F)=>{F[0]=T[0],F[1]=T[1],F[2]=T[2]},L=(T,F,V,Q)=>{F[V]=Q(T[0]),F[V+1]=Q(T[1]),F[V+2]=Q(T[2])},k=(T,F,V,Q,ee)=>(F[0]=An(T[0],V,!0,Q,ee),F[1]=An(T[1],V,!0,Q,ee),F[2]=An(T[2],V,!0,Q,ee),F);return function(T,F,V,Q,ee,se,he){const ie=this.splatCount;Q=Q||0,ee=ee||ie-1,se===void 0&&(se=Q),V&&F>=1&&(t.copy(V),t.decompose(i,s,r),s.normalize(),t.makeRotationFromQuaternion(s),e.setFromMatrix4(t),w(o,e.elements[4],-e.elements[7],e.elements[1]),w(a,-e.elements[5],e.elements[8],-e.elements[2]),w(l,e.elements[3],-e.elements[6],e.elements[0]));const re=le=>j5(le,this.minSphericalHarmonicsCoeff,this.maxSphericalHarmonicsCoeff),be=le=>Ud(le,this.minSphericalHarmonicsCoeff,this.maxSphericalHarmonicsCoeff);for(let le=Q;le<=ee;le++){const fe=this.globalSplatIndexToSectionMap[le],Te=this.sections[fe];F=Math.min(F,Te.sphericalHarmonicsDegree);const Ce=Gc(F),Ie=le-Te.splatCountOffset,ze=Te.bytesPerSplat*Ie+Oe.CompressionLevels[this.compressionLevel].SphericalHarmonicsOffsetBytes,Be=new DataView(this.bufferData,Te.dataBase+ze),it=(le-Q+se)*Ce;let te=V?0:this.compressionLevel,ne=R;te!==he&&(te===1?he===0?ne=N_:he==2&&(ne=re):te===0&&(he===1?ne=jn:he==2&&(ne=be)));const b=this.minSphericalHarmonicsCoeff,oe=this.maxSphericalHarmonicsCoeff;F>=1&&(M(p,Be,3,0,this.compressionLevel),M(g,Be,3,1,this.compressionLevel),M(y,Be,3,2,this.compressionLevel),V?(k(p,p,this.compressionLevel,b,oe),k(g,g,this.compressionLevel,b,oe),k(y,y,this.compressionLevel,b,oe),Oe.rotateSphericalHarmonics3(p,g,y,o,a,l,x,_,S)):(I(p,x),I(g,_),I(y,S)),L(x,T,it,ne),L(_,T,it+3,ne),L(S,T,it+6,ne),F>=2&&(M(p,Be,5,9,this.compressionLevel),M(g,Be,5,10,this.compressionLevel),M(y,Be,5,11,this.compressionLevel),M(m,Be,5,12,this.compressionLevel),M(v,Be,5,13,this.compressionLevel),V?(k(p,p,this.compressionLevel,b,oe),k(g,g,this.compressionLevel,b,oe),k(y,y,this.compressionLevel,b,oe),k(m,m,this.compressionLevel,b,oe),k(v,v,this.compressionLevel,b,oe),Oe.rotateSphericalHarmonics5(p,g,y,m,v,o,a,l,c,u,d,h,f,x,_,S,E,A)):(I(p,x),I(g,_),I(y,S),I(m,E),I(v,A)),L(x,T,it+9,ne),L(_,T,it+12,ne),L(S,T,it+15,ne),L(E,T,it+18,ne),L(A,T,it+21,ne)))}}}());this.constructFromBuffer(e,t)}getSplatCount(){return this.splatCount}getMaxSplatCount(){return this.maxSplatCount}getMinSphericalHarmonicsDegree(){let e=0;for(let t=0;t=s&&t=1){const p=this.getBucketIndex(o,a)*Oe.BucketStorageSizeFloats,g=o.compressionScaleFactor,y=o.compressionScaleRange;i.x=(u-y)*g+o.bucketArray[p],i.y=(d-y)*g+o.bucketArray[p+1],i.z=(h-y)*g+o.bucketArray[p+2]}else i.x=u,i.y=d,i.z=h;i.x+=e[t*3+0],i.y+=e[t*3+1],i.z+=e[t*3+2],r&&i.applyMatrix4(r)}getSplatColor(e,t){const i=this.globalSplatIndexToSectionMap[e],r=this.sections[i],s=e-r.splatCountOffset,o=r.bytesPerSplat*s+Oe.CompressionLevels[this.compressionLevel].ColorOffsetBytes,a=new Uint8Array(this.bufferData,r.dataBase+o,4);t.set(a[0],a[1],a[2],a[3])}fillSplatCenterArray(e,t,i,r,s,o){const a=this.splatCount;r=r||0,s=s||a-1,o===void 0&&(o=r);const l=new Y;for(let c=r;c<=s;c++){const u=this.globalSplatIndexToSectionMap[c],d=this.sections[u],h=c-d.splatCountOffset,f=(c-r+o)*Oe.CenterComponentCount,p=d.bytesPerSplat*h,g=new DataView(this.bufferData,d.dataBase+p),y=Yt(g,0,this.compressionLevel),m=Yt(g,1,this.compressionLevel),v=Yt(g,2,this.compressionLevel);if(this.compressionLevel>=1){const _=this.getBucketIndex(d,h)*Oe.BucketStorageSizeFloats,S=d.compressionScaleFactor,E=d.compressionScaleRange;l.x=(y-E)*S+d.bucketArray[_],l.y=(m-E)*S+d.bucketArray[_+1],l.z=(v-E)*S+d.bucketArray[_+2]}else l.x=y,l.y=m,l.z=v;i&&l.applyMatrix4(i),t[f]=l.x+e[c*3+0],t[f+1]=l.y+e[c*3+1],t[f+2]=l.z+e[c*3+2]}}fillSplatCovarianceArray(e,t,i,r,s,o){const a=this.splatCount,l=new Y,c=new Qt;i=i||0,r=r||a-1,s===void 0&&(s=i);for(let u=i;u<=r;u++){const d=this.globalSplatIndexToSectionMap[u],h=this.sections[d],f=u-h.splatCountOffset,p=(u-i+s)*Oe.CovarianceComponentCount,g=h.bytesPerSplat*f+Oe.CompressionLevels[this.compressionLevel].ScaleOffsetBytes,y=new DataView(this.bufferData,h.dataBase+g);l.set(An(Yt(y,0,this.compressionLevel),this.compressionLevel),An(Yt(y,1,this.compressionLevel),this.compressionLevel),An(Yt(y,2,this.compressionLevel),this.compressionLevel)),c.set(An(Yt(y,4,this.compressionLevel),this.compressionLevel),An(Yt(y,5,this.compressionLevel),this.compressionLevel),An(Yt(y,6,this.compressionLevel),this.compressionLevel),An(Yt(y,3,this.compressionLevel),this.compressionLevel)),Oe.computeCovariance(l,c,t,e,p,o)}}fillSplatColorArray(e,t,i,r,s){const o=this.splatCount;i=i||0,r=r||o-1,s===void 0&&(s=i);for(let a=i;a<=r;a++){const l=this.globalSplatIndexToSectionMap[a],c=this.sections[l],u=a-c.splatCountOffset,d=(a-i+s)*Oe.ColorComponentCount,h=c.bytesPerSplat*u+Oe.CompressionLevels[this.compressionLevel].ColorOffsetBytes,f=new Uint8Array(this.bufferData,c.dataBase+h);let p=f[3];p=p>=t?p:0,e[d]=f[0],e[d+1]=f[1],e[d+2]=f[2],e[d+3]=p}}static parseHeader(e){const t=new Uint8Array(e,0,Oe.HeaderSizeBytes),i=new Uint16Array(e,0,Oe.HeaderSizeBytes/2),r=new Uint32Array(e,0,Oe.HeaderSizeBytes/4),s=new Float32Array(e,0,Oe.HeaderSizeBytes/4),o=t[0],a=t[1],l=r[1],c=r[2],u=r[3],d=r[4],h=i[10],f=new Y(s[6],s[7],s[8]),p=s[9]||-ua,g=s[10]||ua;return{versionMajor:o,versionMinor:a,maxSectionCount:l,sectionCount:c,maxSplatCount:u,splatCount:d,compressionLevel:h,sceneCenter:f,minSphericalHarmonicsCoeff:p,maxSphericalHarmonicsCoeff:g}}static writeHeaderCountsToBuffer(e,t,i){const r=new Uint32Array(i,0,Oe.HeaderSizeBytes/4);r[2]=e,r[4]=t}static writeHeaderToBuffer(e,t){const i=new Uint8Array(t,0,Oe.HeaderSizeBytes),r=new Uint16Array(t,0,Oe.HeaderSizeBytes/2),s=new Uint32Array(t,0,Oe.HeaderSizeBytes/4),o=new Float32Array(t,0,Oe.HeaderSizeBytes/4);i[0]=e.versionMajor,i[1]=e.versionMinor,i[2]=0,i[3]=0,s[1]=e.maxSectionCount,s[2]=e.sectionCount,s[3]=e.maxSplatCount,s[4]=e.splatCount,r[10]=e.compressionLevel,o[6]=e.sceneCenter.x,o[7]=e.sceneCenter.y,o[8]=e.sceneCenter.z,o[9]=e.minSphericalHarmonicsCoeff||-ua,o[10]=e.maxSphericalHarmonicsCoeff||ua}static parseSectionHeaders(e,t,i=0,r){const s=e.compressionLevel,o=e.maxSectionCount,a=new Uint16Array(t,i,o*Oe.SectionHeaderSizeBytes/2),l=new Uint32Array(t,i,o*Oe.SectionHeaderSizeBytes/4),c=new Float32Array(t,i,o*Oe.SectionHeaderSizeBytes/4),u=[];let d=0,h=d/2,f=d/4,p=Oe.HeaderSizeBytes+e.maxSectionCount*Oe.SectionHeaderSizeBytes,g=0;for(let y=0;y=1?e.bucketSize:0,o[3]=t>=1?e.bucketCount:0,a[4]=t>=1?e.bucketBlockSize:0,s[10]=t>=1?Oe.BucketStorageSizeBytes:0,o[6]=t>=1?e.compressionScaleRange:0,o[7]=e.storageSizeBytes,o[8]=t>=1?e.fullBucketCount:0,o[9]=t>=1?e.partiallyFilledBucketCount:0,s[20]=e.sphericalHarmonicsDegree}static writeSectionHeaderSplatCountToBuffer(e,t,i=0){const r=new Uint32Array(t,i,Oe.SectionHeaderSizeBytes/4);r[0]=e}constructFromBuffer(e,t){this.bufferData=e,this.globalSplatIndexToLocalSplatIndexMap=[],this.globalSplatIndexToSectionMap=[];const i=Oe.parseHeader(this.bufferData);this.versionMajor=i.versionMajor,this.versionMinor=i.versionMinor,this.maxSectionCount=i.maxSectionCount,this.sectionCount=t?i.maxSectionCount:0,this.maxSplatCount=i.maxSplatCount,this.splatCount=t?i.maxSplatCount:0,this.compressionLevel=i.compressionLevel,this.sceneCenter=new Y().copy(i.sceneCenter),this.minSphericalHarmonicsCoeff=i.minSphericalHarmonicsCoeff,this.maxSphericalHarmonicsCoeff=i.maxSphericalHarmonicsCoeff,this.sections=Oe.parseSectionHeaders(i,this.bufferData,Oe.HeaderSizeBytes,t),this.linkBufferArrays(),this.buildMaps()}static calculateComponentStorage(e,t){const i=Oe.CompressionLevels[e].BytesPerCenter,r=Oe.CompressionLevels[e].BytesPerScale,s=Oe.CompressionLevels[e].BytesPerRotation,o=Oe.CompressionLevels[e].BytesPerColor,a=Gc(t),l=Oe.CompressionLevels[e].BytesPerSphericalHarmonicsComponent*a,c=i+r+s+o+l;return{bytesPerCenter:i,bytesPerScale:r,bytesPerRotation:s,bytesPerColor:o,sphericalHarmonicsComponentsPerSplat:a,sphericalHarmonicsBytesPerSplat:l,bytesPerSplat:c}}linkBufferArrays(){for(let e=0;e0&&(t.partiallyFilledBucketLengths=new Uint32Array(this.bufferData,t.base,t.partiallyFilledBucketCount))}}buildMaps(){let e=0;for(let t=0;tu)&&(u=R[w])}}c=c||-ua,u=u||ua;const{bytesPerSplat:d}=Oe.calculateComponentStorage(i,l),h=Oe.CompressionLevels[i].ScaleRange,f=[],p=[];let g=0;for(let S=0;S=t&&A.addSplat(Te)}const R=a[S]||{},w=(R.blockSizeFactor||1)*(s||Oe.BucketBlockSize),M=Math.ceil((R.bucketSizeFactor||1)*(o||Oe.BucketSize)),I=Oe.computeBucketsForUncompressedSplatArray(A,w,M),L=I.fullBuckets.length,k=I.partiallyFullBuckets.map(fe=>fe.splats.length),T=k.length,F=[...I.fullBuckets,...I.partiallyFullBuckets],V=A.splats.length*d,Q=T*4,ee=i>=1?F.length*Oe.BucketStorageSizeBytes+Q:0,se=V+ee,he=new ArrayBuffer(se),ie=h/(w*.5),re=new Y;let be=0;for(let fe=0;fe=1){const fe=new Uint32Array(he,0,k.length*4);for(let Ce=0;Cea.x)&&(a.x=m[0]),(g===0||m[1]a.y)&&(a.y=m[1]),(g===0||m[2]a.z)&&(a.z=m[2])}const l=new Y().copy(a).sub(o),c=Math.ceil(l.y/t),u=Math.ceil(l.z/t),d=new Y,h=[],f={};for(let g=0;g=i&&(h.push(E),f[S]=null)}const p=[];for(let g in f)if(f.hasOwnProperty(g)){const y=f[g];y&&p.push(y)}return{fullBuckets:h,partiallyFullBuckets:p}}};xe(Oe,"CurrentMajorVersion",0),xe(Oe,"CurrentMinorVersion",1),xe(Oe,"CenterComponentCount",3),xe(Oe,"ScaleComponentCount",3),xe(Oe,"RotationComponentCount",4),xe(Oe,"ColorComponentCount",4),xe(Oe,"CovarianceComponentCount",6),xe(Oe,"SplatScaleOffsetFloat",3),xe(Oe,"SplatRotationOffsetFloat",6),xe(Oe,"CompressionLevels",{0:{BytesPerCenter:12,BytesPerScale:12,BytesPerRotation:16,BytesPerColor:4,ScaleOffsetBytes:12,RotationffsetBytes:24,ColorOffsetBytes:40,SphericalHarmonicsOffsetBytes:44,ScaleRange:1,BytesPerSphericalHarmonicsComponent:4,SphericalHarmonicsOffsetFloat:11,SphericalHarmonicsDegrees:{0:{BytesPerSplat:44},1:{BytesPerSplat:80},2:{BytesPerSplat:140}}},1:{BytesPerCenter:6,BytesPerScale:6,BytesPerRotation:8,BytesPerColor:4,ScaleOffsetBytes:6,RotationffsetBytes:12,ColorOffsetBytes:20,SphericalHarmonicsOffsetBytes:24,ScaleRange:32767,BytesPerSphericalHarmonicsComponent:2,SphericalHarmonicsOffsetFloat:12,SphericalHarmonicsDegrees:{0:{BytesPerSplat:24},1:{BytesPerSplat:42},2:{BytesPerSplat:72}}},2:{BytesPerCenter:6,BytesPerScale:6,BytesPerRotation:8,BytesPerColor:4,ScaleOffsetBytes:6,RotationffsetBytes:12,ColorOffsetBytes:20,SphericalHarmonicsOffsetBytes:24,ScaleRange:32767,BytesPerSphericalHarmonicsComponent:1,SphericalHarmonicsOffsetFloat:12,SphericalHarmonicsDegrees:{0:{BytesPerSplat:24},1:{BytesPerSplat:33},2:{BytesPerSplat:48}}}}),xe(Oe,"CovarianceSizeFloats",6),xe(Oe,"HeaderSizeBytes",4096),xe(Oe,"SectionHeaderSizeBytes",1024),xe(Oe,"BucketStorageSizeBytes",12),xe(Oe,"BucketStorageSizeFloats",3),xe(Oe,"BucketBlockSize",5),xe(Oe,"BucketSize",256),xe(Oe,"computeCovariance",function(){const e=new Xe,t=new mt,i=new mt,r=new mt,s=new mt,o=new mt,a=new mt;return function(l,c,u,d,h=0,f){e.makeScale(l.x,l.y,l.z),t.setFromMatrix4(e),e.makeRotationFromQuaternion(c),i.setFromMatrix4(e),r.copy(i).multiply(t),s.copy(r).transpose().premultiply(r),u&&(o.setFromMatrix4(u),a.copy(o).transpose(),s.multiply(a),s.premultiply(o)),f>=1?(d[h]=jn(s.elements[0]),d[h+1]=jn(s.elements[3]),d[h+2]=jn(s.elements[6]),d[h+3]=jn(s.elements[4]),d[h+4]=jn(s.elements[7]),d[h+5]=jn(s.elements[8])):(d[h]=s.elements[0],d[h+1]=s.elements[3],d[h+2]=s.elements[6],d[h+3]=s.elements[4],d[h+4]=s.elements[7],d[h+5]=s.elements[8])}}()),xe(Oe,"dot3",(e,t,i,r,s)=>{s[0]=s[1]=s[2]=0;const o=r[0],a=r[1],l=r[2];Oe.addInto3(e[0]*o,e[1]*o,e[2]*o,s),Oe.addInto3(t[0]*a,t[1]*a,t[2]*a,s),Oe.addInto3(i[0]*l,i[1]*l,i[2]*l,s)}),xe(Oe,"addInto3",(e,t,i,r)=>{r[0]=r[0]+e,r[1]=r[1]+t,r[2]=r[2]+i}),xe(Oe,"dot5",(e,t,i,r,s,o,a)=>{a[0]=a[1]=a[2]=0;const l=o[0],c=o[1],u=o[2],d=o[3],h=o[4];Oe.addInto3(e[0]*l,e[1]*l,e[2]*l,a),Oe.addInto3(t[0]*c,t[1]*c,t[2]*c,a),Oe.addInto3(i[0]*u,i[1]*u,i[2]*u,a),Oe.addInto3(r[0]*d,r[1]*d,r[2]*d,a),Oe.addInto3(s[0]*h,s[1]*h,s[2]*h,a)}),xe(Oe,"rotateSphericalHarmonics3",(e,t,i,r,s,o,a,l,c)=>{Oe.dot3(e,t,i,r,a),Oe.dot3(e,t,i,s,l),Oe.dot3(e,t,i,o,c)}),xe(Oe,"rotateSphericalHarmonics5",(e,t,i,r,s,o,a,l,c,u,d,h,f,p,g,y,m,v)=>{const x=Math.sqrt(.25),_=Math.sqrt(3/4),S=Math.sqrt(1/3),E=Math.sqrt(4/3),A=Math.sqrt(1/12);c[0]=x*(l[2]*o[0]+l[0]*o[2]+(o[2]*l[0]+o[0]*l[2])),c[1]=l[1]*o[0]+o[1]*l[0],c[2]=_*(l[1]*o[1]+o[1]*l[1]),c[3]=l[1]*o[2]+o[1]*l[2],c[4]=x*(l[2]*o[2]-l[0]*o[0]+(o[2]*l[2]-o[0]*l[0])),Oe.dot5(e,t,i,r,s,c,p),u[0]=x*(a[2]*o[0]+a[0]*o[2]+(o[2]*a[0]+o[0]*a[2])),u[1]=a[1]*o[0]+o[1]*a[0],u[2]=_*(a[1]*o[1]+o[1]*a[1]),u[3]=a[1]*o[2]+o[1]*a[2],u[4]=x*(a[2]*o[2]-a[0]*o[0]+(o[2]*a[2]-o[0]*a[0])),Oe.dot5(e,t,i,r,s,u,g),d[0]=S*(a[2]*a[0]+a[0]*a[2])+-A*(l[2]*l[0]+l[0]*l[2]+(o[2]*o[0]+o[0]*o[2])),d[1]=E*a[1]*a[0]+-S*(l[1]*l[0]+o[1]*o[0]),d[2]=a[1]*a[1]+-x*(l[1]*l[1]+o[1]*o[1]),d[3]=E*a[1]*a[2]+-S*(l[1]*l[2]+o[1]*o[2]),d[4]=S*(a[2]*a[2]-a[0]*a[0])+-A*(l[2]*l[2]-l[0]*l[0]+(o[2]*o[2]-o[0]*o[0])),Oe.dot5(e,t,i,r,s,d,y),h[0]=x*(a[2]*l[0]+a[0]*l[2]+(l[2]*a[0]+l[0]*a[2])),h[1]=a[1]*l[0]+l[1]*a[0],h[2]=_*(a[1]*l[1]+l[1]*a[1]),h[3]=a[1]*l[2]+l[1]*a[2],h[4]=x*(a[2]*l[2]-a[0]*l[0]+(l[2]*a[2]-l[0]*a[0])),Oe.dot5(e,t,i,r,s,h,m),f[0]=x*(l[2]*l[0]+l[0]*l[2]-(o[2]*o[0]+o[0]*o[2])),f[1]=l[1]*l[0]-o[1]*o[0],f[2]=_*(l[1]*l[1]-o[1]*o[1]),f[3]=l[1]*l[2]-o[1]*o[2],f[4]=x*(l[2]*l[2]-l[0]*l[0]-(o[2]*o[2]-o[0]*o[0])),Oe.dot5(e,t,i,r,s,f,v)}),xe(Oe,"writeSplatDataToSectionBuffer",function(){const e=new ArrayBuffer(12),t=new ArrayBuffer(12),i=new ArrayBuffer(16),r=new ArrayBuffer(4),s=new ArrayBuffer(256),o=new Qt,a=new Y,l=new Y,{X:c,Y:u,Z:d,SCALE0:h,SCALE1:f,SCALE2:p,ROTATION0:g,ROTATION1:y,ROTATION2:m,ROTATION3:v,FDC0:x,FDC1:_,FDC2:S,OPACITY:E,FRC0:A,FRC9:R}=lt.OFFSET,w=(M,I,L)=>{const k=L*2+1;return M=Math.round(M*I)+L,gi(M,0,k)};return function(M,I,L,k,T,F,V,Q,ee=-ua,se=ua){const he=Gc(T),ie=Oe.CompressionLevels[k].BytesPerCenter,re=Oe.CompressionLevels[k].BytesPerScale,be=Oe.CompressionLevels[k].BytesPerRotation,le=Oe.CompressionLevels[k].BytesPerColor,fe=L,Te=fe+ie,Ce=Te+re,Ie=Ce+be,ze=Ie+le;if(M[g]!==void 0?(o.set(M[g],M[y],M[m],M[v]),o.normalize()):o.set(1,0,0,0),M[h]!==void 0?a.set(M[h]||0,M[f]||0,M[p]||0):a.set(0,0,0),k===0){const it=new Float32Array(I,fe,Oe.CenterComponentCount),te=new Float32Array(I,Ce,Oe.RotationComponentCount),ne=new Float32Array(I,Te,Oe.ScaleComponentCount);if(te.set([o.x,o.y,o.z,o.w]),ne.set([a.x,a.y,a.z]),it.set([M[c],M[u],M[d]]),T>0){const b=new Float32Array(I,ze,he);if(T>=1){for(let oe=0;oe<9;oe++)b[oe]=M[A+oe]||0;if(T>=2)for(let oe=0;oe<15;oe++)b[oe+9]=M[R+oe]||0}}}else{const it=new Uint16Array(e,0,Oe.CenterComponentCount),te=new Uint16Array(i,0,Oe.RotationComponentCount),ne=new Uint16Array(t,0,Oe.ScaleComponentCount);if(te.set([jn(o.x),jn(o.y),jn(o.z),jn(o.w)]),ne.set([jn(a.x),jn(a.y),jn(a.z)]),l.set(M[c],M[u],M[d]).sub(F),l.x=w(l.x,V,Q),l.y=w(l.y,V,Q),l.z=w(l.z,V,Q),it.set([l.x,l.y,l.z]),T>0){const b=k===1?Uint16Array:Uint8Array,oe=k===1?2:1,J=new b(s,0,he);if(T>=1){for(let P=0;P<9;P++){const U=M[A+P]||0;J[P]=k===1?jn(U):Ud(U,ee,se)}const H=9*oe;if(vc(J.buffer,0,I,ze,H),T>=2){for(let P=0;P<15;P++){const U=M[R+P]||0;J[P+9]=k===1?jn(U):Ud(U,ee,se)}vc(J.buffer,H,I,ze+H,15*oe)}}}vc(it.buffer,0,I,fe,6),vc(ne.buffer,0,I,Te,6),vc(te.buffer,0,I,Ce,8)}const Be=new Uint8ClampedArray(r,0,4);Be.set([M[x]||0,M[_]||0,M[S]||0]),Be[3]=M[E]||0,vc(Be.buffer,0,I,Ie,4)}}());let ct=Oe;const RA=new Uint8Array([112,108,121,10]),IA=new Uint8Array([10,101,110,100,95,104,101,97,100,101,114,10]),kg="end_header",Ug=new Map([["char",Int8Array],["uchar",Uint8Array],["short",Int16Array],["ushort",Uint16Array],["int",Int32Array],["uint",Uint32Array],["float",Float32Array],["double",Float64Array]]),$s=(n,e)=>{const t=(1<{n.x=$s(e>>>21,11),n.y=$s(e>>>11,10),n.z=$s(e,11)},BB=(n,e)=>{n.x=$s(e>>>24,8),n.y=$s(e>>>16,8),n.z=$s(e>>>8,8),n.w=$s(e,8)},kB=(n,e)=>{const t=1/(Math.sqrt(2)*.5),i=($s(e>>>20,10)-.5)*t,r=($s(e>>>10,10)-.5)*t,s=($s(e,10)-.5)*t,o=Math.sqrt(1-(i*i+r*r+s*s));switch(e>>>30){case 0:n.set(o,i,r,s);break;case 1:n.set(i,o,r,s);break;case 2:n.set(i,r,o,s);break;case 3:n.set(i,r,s,o);break}},_c=(n,e,t)=>n*(1-t)+e*t,Ei=(n,e)=>{var t;return(t=n.properties.find(i=>i.name===e&&i.storage))==null?void 0:t.storage},Mi=class Mi{static decodeHeaderText(e){let t,i,r;const s=e.split("\n").filter(l=>!l.startsWith("comment "));let o=0,a=!1;for(let l=1;l{const h=u.length-d.length;let f,p;for(f=0;f<=h;++f){for(p=0;p{if(u.length=RA.length&&!i(r,RA))throw new Error("Invalid PLY header");if(s=t(r,IA),s===-1)throw new Error("End of PLY header not found");const o=new TextDecoder("ascii").decode(r.slice(0,s)),{chunkElement:a,vertexElement:l,bytesPerSplat:c}=Mi.decodeHeaderText(o);return{headerSizeBytes:s+IA.length,bytesPerSplat:c,chunkElement:a,vertexElement:l}}static readElementData(e,t,i,r,s,o=null){let a=t instanceof DataView?t:new DataView(t);r=r||0,s=s||e.count-1;for(let l=r;l<=s;++l)for(let c=0;c0&&(_++,_===2?c=E:_===3&&(a=parseInt(E)))}}else if(v.startsWith("property")){const x=v.match(/(\w+)\s+(\w+)\s+(\w+)/);if(x){const _=x[2],S=x[3];h.push(S);const E=t[S];f[S]=_;const A=PA[_];E!==void 0&&(u.push(E),d[E]=A)}}if(v===_r.HeaderEndToken){l=!0;break}s&&(r.push(v),o++)}const p=[];let g=0;for(let m of h){const v=f[m];if(f.hasOwnProperty(m)){const x=t[m];x!==void 0&&(p[x]=g)}g+=UB[PA[v]]}const y=this.decodeSphericalHarmonicsFromSectionHeader(h,t);return{headerLines:r,headerStartLine:i,headerEndLine:o,fieldTypes:d,fieldIds:u,fieldOffsets:p,bytesPerVertex:g,vertexCount:a,dataSizeBytes:g*a,endOfHeader:l,sectionName:c,sphericalHarmonicsDegree:y.degree,sphericalHarmonicsCoefficientsPerChannel:y.coefficientsPerChannel,sphericalHarmonicsDegree1Fields:y.degree1Fields,sphericalHarmonicsDegree2Fields:y.degree2Fields}}decodeSphericalHarmonicsFromSectionHeader(e,t){let i=0,r=0;for(let l of e)l.startsWith("f_rest")&&i++;r=i/3;let s=0;r>=3&&(s=1),r>=8&&(s=2);let o=[],a=[];for(let l=0;l<3;l++){if(s>=1)for(let c=0;c<3;c++)o.push(t["f_rest_"+(c+r*l)]);if(s>=2)for(let c=0;c<5;c++)a.push(t["f_rest_"+(c+r*l+3)])}return{degree:s,coefficientsPerChannel:r,degree1Fields:o,degree2Fields:a}}static getHeaderSectionNames(e){const t=[];for(let i of e)if(i.startsWith("element")){const r=i.split(" ");let s=0;for(let o of r){const a=o.trim();a.length>0&&(s++,s===2&&t.push(a))}}return t}static checkTextForEndHeader(e){return!!e.includes(_r.HeaderEndToken)}static checkBufferForEndHeader(e,t,i,r){const s=new Uint8Array(e,Math.max(0,t-i),i),o=r.decode(s);return _r.checkTextForEndHeader(o)}static extractHeaderFromBufferToText(e){const t=new TextDecoder;let i=0,r="";const s=100;for(;;){if(i+s>=e.byteLength)throw new Error("End of file reached while searching for end of header");const o=new Uint8Array(e,i,s);if(r+=t.decode(o),i+=s,_r.checkBufferForEndHeader(e,i,s*2,t))break}return r}readHeaderFromBuffer(e){const t=new TextDecoder;let i=0,r="";const s=100;for(;;){if(i+s>=e.byteLength)throw new Error("End of file reached while searching for end of header");const o=new Uint8Array(e,i,s);if(r+=t.decode(o),i+=s,_r.checkBufferForEndHeader(e,i,s*2,t))break}return r}static convertHeaderTextToLines(e){const t=e.split("\n"),i=[];for(let r=0;re),[LA,VB,HB,$B,GB,WB,QB,jB,qB,XB,DA,KB,YB,FA,OA,ZB,JB,ek]=zB,_l=class _l{constructor(){this.plyParserutils=new pi}decodeHeaderLines(e){let t=0;e.forEach(u=>{u.includes("f_rest_")&&t++});let i=0;t>=45?i=45:t>=24?i=24:t>=9&&(i=9);let s=Array.from(Array(Math.max(i-1,0))).map((u,d)=>"f_rest_".concat(d+1));const o=[...X5,...s],a=o.map((u,d)=>d),l=a.reduce((u,d)=>(u[o[d]]=d,u),{}),c=this.plyParserutils.decodeSectionHeader(e,l,0);return c.splatCount=c.vertexCount,c.bytesPerSplat=c.bytesPerVertex,c.fieldsToReadIndexes=a,c}decodeHeaderText(e){const t=pi.convertHeaderTextToLines(e),i=this.decodeHeaderLines(t);return i.headerText=e,i.headerSizeBytes=e.indexOf(pi.HeaderEndToken)+pi.HeaderEndToken.length+1,i}decodeHeaderFromBuffer(e){const t=this.plyParserutils.readHeaderFromBuffer(e);return this.decodeHeaderText(t)}findSplatData(e,t){return new DataView(e,t.headerSizeBytes)}parseToUncompressedSplatBufferSection(e,t,i,r,s,o,a,l=0){l=Math.min(l,e.sphericalHarmonicsDegree);const c=ct.CompressionLevels[0].SphericalHarmonicsDegrees[l].BytesPerSplat;for(let u=t;u<=i;u++){const d=_l.parseToUncompressedSplat(r,u,e,s,l),h=u*c+a;ct.writeSplatDataToSectionBuffer(d,o,h,0,l)}}parseToUncompressedSplatArraySection(e,t,i,r,s,o,a=0){a=Math.min(a,e.sphericalHarmonicsDegree);for(let l=t;l<=i;l++){const c=_l.parseToUncompressedSplat(r,l,e,s,a);o.addSplat(c)}}decodeSectionSplatData(e,t,i,r){r=Math.min(r,i.sphericalHarmonicsDegree);const s=new lt(r);for(let o=0;o=1&&e[ek]!==void 0){for(let R=0;R<9;R++)A[m[R]]=e[_.sphericalHarmonicsDegree1Fields[R]];if(E>=2)for(let R=0;R<15;R++)A[m[9+R]]=e[_.sphericalHarmonicsDegree2Fields[R]]}return t.set(e[$B],e[GB],e[WB],e[QB]),t.normalize(),A[c]=t.x,A[u]=t.y,A[d]=t.z,A[h]=t.w,A[i]=e[jB],A[r]=e[qB],A[s]=e[XB],A}}());let pm=_l;const K5=["features_dc","features_rest_0","features_rest_1","features_rest_2","features_rest_3","features_rest_4","features_rest_5","features_rest_6","features_rest_7","features_rest_8","features_rest_9","features_rest_10","features_rest_11","features_rest_12","features_rest_13","features_rest_14","opacity","scaling","rotation_re","rotation_im"],$f=K5.map((n,e)=>e),[Gf,tk,nk,BA,Wf,ik,zg]=[0,1,4,16,17,18,19],Y5=["scale_0","scale_1","scale_2","rot_0","rot_1","rot_2","rot_3","x","y","z","f_dc_0","f_dc_1","f_dc_2","opacity","red","green","blue","f_rest_0","f_rest_1","f_rest_2","f_rest_3","f_rest_4","f_rest_5","f_rest_6","f_rest_7","f_rest_8","f_rest_9","f_rest_10","f_rest_11","f_rest_12","f_rest_13","f_rest_14","f_rest_15","f_rest_16","f_rest_17","f_rest_18","f_rest_19","f_rest_20","f_rest_21","f_rest_22","f_rest_23","f_rest_24","f_rest_25","f_rest_26","f_rest_27","f_rest_28","f_rest_29","f_rest_30","f_rest_31","f_rest_32","f_rest_33","f_rest_34","f_rest_35","f_rest_36","f_rest_37","f_rest_38","f_rest_39","f_rest_40","f_rest_41","f_rest_42","f_rest_43","f_rest_44","f_rest_45"],Oy=Y5.map((n,e)=>e),[kA,rk,sk,ok,ak,lk,ck,uk,dk,hk,By,Z5,J5,UA]=Oy,zA=By,fk=Z5,pk=J5,Qf=n=>{const e=(31744&n)>>10,t=1023&n;return(n>>15?-1:1)*(e?e===31?t?NaN:1/0:Math.pow(2,e-15)*(1+t/1024):t/1024*6103515625e-14)},qd=class qd{constructor(){this.plyParserutils=new pi}decodeSectionHeadersFromHeaderLines(e){const t=Oy.reduce((u,d)=>(u[Y5[d]]=d,u),{}),i=$f.reduce((u,d)=>(u[K5[d]]=d,u),{}),r=pi.getHeaderSectionNames(e);let s;for(let u=0;u=1&&_.sphericalHarmonicsDegree>=1){for(let k=0;k<9;k++){const T=S[tk+k%3];R[m[k]]=T[e[_.sphericalHarmonicsDegree1Fields[k]]]}if(A>=2&&_.sphericalHarmonicsDegree>=2)for(let k=0;k<15;k++){const T=S[nk+k%5];R[m[9+k]]=T[e[_.sphericalHarmonicsDegree2Fields[k]]]}}const w=S[ik][e[ok]],M=S[zg][e[ak]],I=S[zg][e[lk]],L=S[zg][e[ck]];return t.set(w,M,I,L),t.normalize(),R[c]=t.x,R[u]=t.y,R[d]=t.z,R[h]=t.w,R[i]=Qf(e[uk]),R[r]=Qf(e[dk]),R[s]=Qf(e[hk]),R}}());let ky=qd;class mk{static parseToUncompressedSplatArray(e,t=0){const i=pi.determineHeaderFormatFromPlyBuffer(e);if(i===Na.PlayCanvasCompressed)return Sl.parseToUncompressedSplatArray(e);if(i===Na.INRIAV1)return new pm().parseToUncompressedSplatArray(e,t);if(i===Na.INRIAV2)return new ky().parseToUncompressedSplatArray(e,t)}}class U_{constructor(e,t,i,r){this.sectionCount=e,this.sectionFilters=t,this.groupingParameters=i,this.partitionGenerator=r}partitionUncompressedSplatArray(e){let t,i,r;if(this.partitionGenerator){const o=this.partitionGenerator(e);t=o.groupingParameters,i=o.sectionCount,r=o.sectionFilters}else t=this.groupingParameters,i=this.sectionCount,r=this.sectionFilters;const s=[];for(let o=0;o{const a=lt.OFFSET.X,l=lt.OFFSET.Y,c=lt.OFFSET.Z;e<=0&&(e=o.splatCount);const u=new Y,d=.5,h=m=>{m.x=Math.floor(m.x/d)*d,m.y=Math.floor(m.y/d)*d,m.z=Math.floor(m.z/d)*d};o.splats.forEach(m=>{u.set(m[a],m[l],m[c]).sub(t),h(u),m.centerDist=u.lengthSq()}),o.splats.sort((m,v)=>{let x=m.centerDist,_=v.centerDist;return x>_?1:-1});const f=[],p=[];e=Math.min(o.splatCount,e);const g=Math.ceil(o.splatCount/e);let y=0;for(let m=0;mx>=v&&x{const fe=re>=100;if(le&&(Q.push({data:le,sizeBytes:le.byteLength,startBytes:T,endBytes:T+le.byteLength}),T+=le.byteLength),p===Mn.DownloadBeforeProcessing)fe&&I.resolve(Q);else{if(R){if(M&&!w){const Te=V.headerSizeBytes+V.chunkElement.storageSizeBytes;S=VA(Q,S),S.byteLength>=Te&&(Sl.readElementData(V.chunkElement,S,V.headerSizeBytes),L=Te,k=Te,w=!0)}}else if(F+=se.decode(le),pi.checkTextForEndHeader(F)){const Te=pi.determineHeaderFormatFromHeaderText(F);if(Te===Na.INRIAV1)V=he.decodeHeaderText(F),E=V.splatCount,w=!0,M=!1;else if(Te===Na.PlayCanvasCompressed)V=Sl.decodeHeaderText(F),E=V.vertexElement.count,M=!0;else{if(i)throw new z_("PlyLoader.loadFromURL() -> Selected Ply format cannot be directly loaded.");p=Mn.DownloadBeforeProcessing;return}l=Math.min(l,V.sphericalHarmonicsDegree);const Ce=ct.CompressionLevels[0].SphericalHarmonicsDegrees[l],Ie=y+Ce.BytesPerSplat*E;p===Mn.DirectToSplatBuffer?(x=new ArrayBuffer(Ie),ct.writeHeaderToBuffer({versionMajor:ct.CurrentMajorVersion,versionMinor:ct.CurrentMinorVersion,maxSectionCount:m,sectionCount:m,maxSplatCount:E,splatCount:A,compressionLevel:0,sceneCenter:new Y},x)):ee=new lt(l),L=V.headerSizeBytes,k=V.headerSizeBytes,R=!0}if(R&&w){if(Q.length>0&&(v=VA(Q,v),T-L>g||fe)){const Ce=T-k,Ie=Math.floor(Ce/V.bytesPerSplat),ze=Ie*V.bytesPerSplat,Be=Ce-ze,it=A+Ie,te=k-Q[0].startBytes,ne=new DataView(v,te,ze),b=ct.CompressionLevels[0].SphericalHarmonicsDegrees[l],oe=A*b.BytesPerSplat+y;if(p===Mn.DirectToSplatBuffer?M?Sl.parseToUncompressedSplatBufferSection(V.chunkElement,V.vertexElement,0,Ie-1,A,ne,0,x,oe):he.parseToUncompressedSplatBufferSection(V,0,Ie-1,ne,0,x,oe,l):M?Sl.parseToUncompressedSplatArraySection(V.chunkElement,V.vertexElement,0,Ie-1,A,ne,0,ee):he.parseToUncompressedSplatArraySection(V,0,Ie-1,ne,0,ee,l),A=it,p===Mn.DirectToSplatBuffer&&(_||(ct.writeSectionHeaderToBuffer({maxSplatCount:E,splatCount:A,bucketSize:0,bucketCount:0,bucketBlockSize:0,compressionScaleRange:0,storageSizeBytes:0,fullBucketCount:0,partiallyFilledBucketCount:0,sphericalHarmonicsDegree:l},0,x,ct.HeaderSizeBytes),_=new ct(x,!1)),_.updateLoadedCounts(1,A),r&&r(_,fe)),L+=g,k+=ze,Be===0)Q=[];else{let J=[],H=0;for(let P=Q.length-1;P>=0;P--){const U=Q[P];if(H+=U.sizeBytes,J.unshift(U),H>=Be)break}Q=J}}fe&&(p===Mn.DirectToSplatBuffer?I.resolve(_):I.resolve(ee))}}t&&t(re,be,Kn.Downloading)};return t&&t(0,"0%",Kn.Downloading),l_(e,ie,!1,c).then(()=>(t&&t(0,"0%",Kn.Processing),I.promise.then(re=>{if(t&&t(100,"100%",Kn.Done),p===Mn.DownloadBeforeProcessing){const be=Q.map(le=>le.data);return new Blob(be).arrayBuffer().then(le=>V_.loadFromFileData(le,s,o,a,l,u,d,h,f))}else return p===Mn.DirectToSplatBuffer?re:ms(()=>HA(re,a,s,o,u,d,h,f))})))}static loadFromFileData(e,t,i,r,s=0,o,a,l,c){return ms(()=>mk.parseToUncompressedSplatArray(e,s)).then(u=>HA(u,r,t,i,o,a,l,c))}}const on=class on{static parseToUncompressedSplatBufferSection(e,t,i,r,s,o){const a=ct.CompressionLevels[0].BytesPerCenter,l=ct.CompressionLevels[0].BytesPerScale,c=ct.CompressionLevels[0].BytesPerRotation,u=ct.CompressionLevels[0].SphericalHarmonicsDegrees[0].BytesPerSplat;for(let d=e;d<=t;d++){const h=d*on.RowSizeBytes+r,f=new Float32Array(i,h,3),p=new Float32Array(i,h+on.CenterSizeBytes,3),g=new Uint8Array(i,h+on.CenterSizeBytes+on.ScaleSizeBytes,4),y=new Uint8Array(i,h+on.CenterSizeBytes+on.ScaleSizeBytes+on.RotationSizeBytes,4),m=new Qt((y[1]-128)/128,(y[2]-128)/128,(y[3]-128)/128,(y[0]-128)/128);m.normalize();const v=d*u+o,x=new Float32Array(s,v,3),_=new Float32Array(s,v+a,3),S=new Float32Array(s,v+a+l,4),E=new Uint8Array(s,v+a+l+c,4);x[0]=f[0],x[1]=f[1],x[2]=f[2],_[0]=p[0],_[1]=p[1],_[2]=p[2],S[0]=m.w,S[1]=m.x,S[2]=m.y,S[3]=m.z,E[0]=g[0],E[1]=g[1],E[2]=g[2],E[3]=g[3]}}static parseToUncompressedSplatArraySection(e,t,i,r,s){for(let o=e;o<=t;o++){const a=o*on.RowSizeBytes+r,l=new Float32Array(i,a,3),c=new Float32Array(i,a+on.CenterSizeBytes,3),u=new Uint8Array(i,a+on.CenterSizeBytes+on.ScaleSizeBytes,4),d=new Uint8Array(i,a+on.CenterSizeBytes+on.ScaleSizeBytes+on.RotationSizeBytes,4),h=new Qt((d[1]-128)/128,(d[2]-128)/128,(d[3]-128)/128,(d[0]-128)/128);h.normalize(),s.addSplatFromComonents(l[0],l[1],l[2],c[0],c[1],c[2],h.w,h.x,h.y,h.z,u[0],u[1],u[2],u[3])}}static parseStandardSplatToUncompressedSplatArray(e){const t=e.byteLength/on.RowSizeBytes,i=new lt;for(let r=0;r{const V=L>=100;if(T&&M.push(T),f===Mn.DownloadBeforeProcessing){V&&A.resolve(M);return}if(!F){if(i)throw new z_("Cannon directly load .splat because no file size info is available.");f=Mn.DownloadBeforeProcessing;return}if(!m){_=F/pl.RowSizeBytes,m=new ArrayBuffer(F);const Q=ct.CompressionLevels[0].SphericalHarmonicsDegrees[0].BytesPerSplat,ee=p+Q*_;f===Mn.DirectToSplatBuffer?(v=new ArrayBuffer(ee),ct.writeHeaderToBuffer({versionMajor:ct.CurrentMajorVersion,versionMinor:ct.CurrentMinorVersion,maxSectionCount:y,sectionCount:y,maxSplatCount:_,splatCount:S,compressionLevel:0,sceneCenter:new Y},v)):E=new lt(0)}if(T){new Uint8Array(m,w,T.byteLength).set(new Uint8Array(T)),w+=T.byteLength;const Q=w-R;if(Q>g||V){const se=(V?Q:g)/pl.RowSizeBytes,he=S+se;f===Mn.DirectToSplatBuffer?pl.parseToUncompressedSplatBufferSection(S,he-1,m,0,v,p):pl.parseToUncompressedSplatArraySection(S,he-1,m,0,E),S=he,f===Mn.DirectToSplatBuffer&&(x||(ct.writeSectionHeaderToBuffer({maxSplatCount:_,splatCount:S,bucketSize:0,bucketCount:0,bucketBlockSize:0,compressionScaleRange:0,storageSizeBytes:0,fullBucketCount:0,partiallyFilledBucketCount:0},0,v,ct.HeaderSizeBytes),x=new ct(v,!1)),x.updateLoadedCounts(1,S),r&&r(x,V)),R+=g}}V&&(f===Mn.DirectToSplatBuffer?A.resolve(x):A.resolve(E)),t&&t(L,k,Kn.Downloading)};return t&&t(0,"0%",Kn.Downloading),l_(e,I,!1,l).then(()=>(t&&t(0,"0%",Kn.Processing),A.promise.then(L=>(t&&t(100,"100%",Kn.Done),f===Mn.DownloadBeforeProcessing?new Blob(M).arrayBuffer().then(k=>H_.loadFromFileData(k,s,o,a,c,u,d,h)):f===Mn.DirectToSplatBuffer?L:ms(()=>$A(L,a,s,o,c,u,d,h))))))}static loadFromFileData(e,t,i,r,s,o,a,l){return ms(()=>{const c=pl.parseStandardSplatToUncompressedSplatArray(e);return $A(c,r,t,i,s,o,a,l)})}}const zc=class zc{static checkVersion(e){const t=ct.CurrentMajorVersion,i=ct.CurrentMinorVersion,r=ct.parseHeader(e);if(r.versionMajor===t&&r.versionMinor>=i||r.versionMajor>t)return!0;throw new Error("KSplat version not supported: v".concat(r.versionMajor,".").concat(r.versionMinor,". ")+"Minimum required: v".concat(t,".").concat(i))}static loadFromURL(e,t,i,r,s){let o,a,l,c,u=!1,d=!1,h,f=[],p=!1,g=!1,y=0,m=0,v=0,x=!1,_=!1,S=!1,E=[];const A=c_(),R=()=>{!u&&!d&&y>=ct.HeaderSizeBytes&&(d=!0,new Blob(E).arrayBuffer().then(F=>{l=new ArrayBuffer(ct.HeaderSizeBytes),new Uint8Array(l).set(new Uint8Array(F,0,ct.HeaderSizeBytes)),zc.checkVersion(l),d=!1,u=!0,c=ct.parseHeader(l),window.setTimeout(()=>{I()},1)}))};let w=0;const M=()=>{w===0&&(w++,window.setTimeout(()=>{w--,L()},1))},I=()=>{const T=()=>{g=!0,new Blob(E).arrayBuffer().then(V=>{g=!1,p=!0,h=new ArrayBuffer(c.maxSectionCount*ct.SectionHeaderSizeBytes),new Uint8Array(h).set(new Uint8Array(V,ct.HeaderSizeBytes,c.maxSectionCount*ct.SectionHeaderSizeBytes)),f=ct.parseSectionHeaders(c,h,0,!1);let Q=0;for(let se=0;se=ct.HeaderSizeBytes+ct.SectionHeaderSizeBytes*c.maxSectionCount&&T()},L=()=>{if(S)return;S=!0;const T=()=>{if(S=!1,p){if(_)return;if(x=y>=v,y-m>Ft.ProgressiveLoadSectionSize||x){m+=Ft.ProgressiveLoadSectionSize,_=m>=v,a||(a=new ct(o,!1));const V=ct.HeaderSizeBytes+ct.SectionHeaderSizeBytes*c.maxSectionCount;let Q=0,ee=0,se=0;for(let re=0;re=fe){ee++;const Te=m-fe,ze=ct.CompressionLevels[c.compressionLevel].SphericalHarmonicsDegrees[be.sphericalHarmonicsDegree].BytesPerSplat;let Be=Math.floor(Te/ze);Be=Math.min(Be,be.maxSplatCount),se+=Be,a.updateLoadedCounts(ee,se),a.updateSectionLoadedCounts(re,Be)}else break;Q+=be.storageSizeBytes}r(a,_);const he=m/v*100,ie=he.toFixed(2)+"%";t&&t(he,ie,Kn.Downloading),_?A.resolve(a):L()}}};window.setTimeout(T,Ft.ProgressiveLoadSectionDelayDuration)};return l_(e,(T,F,V)=>{V&&(E.push(V),o&&new Uint8Array(o,y,V.byteLength).set(new Uint8Array(V)),y+=V.byteLength),i?(R(),I(),L()):t&&t(T,F,Kn.Downloading)},!i,s).then(T=>(t&&t(0,"0%",Kn.Processing),(i?A.promise:zc.loadFromFileData(T)).then(V=>(t&&t(100,"100%",Kn.Done),V))))}static loadFromFileData(e){return ms(()=>(zc.checkVersion(e),new ct(e)))}};xe(zc,"downloadFile",function(){let e;return function(t,i){const r=new Blob([t.bufferData],{type:"application/octet-stream"});e||(e=document.createElement("a"),document.body.appendChild(e)),e.download=i,e.href=URL.createObjectURL(r),e.click()}}());let Uy=zc;const zs={Splat:0,KSplat:1,Ply:2},GA=n=>n.endsWith(".ply")?zs.Ply:n.endsWith(".splat")?zs.Splat:n.endsWith(".ksplat")?zs.KSplat:null,WA={type:"change"},Vg={type:"start"},QA={type:"end"},jf=new Oh,jA=new Co,gk=Math.cos(70*Ta.DEG2RAD);class qf extends ro{constructor(e,t){super(),this.object=e,this.domElement=t,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Y,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-Math.PI/72,this.maxAzimuthAngle=Math.PI/72,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!1,this.panSpeed=1,this.screenSpacePanning=!0,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"KeyA",UP:"KeyW",RIGHT:"KeyD",BOTTOM:"KeyS"},this.mouseButtons={LEFT:tc.ROTATE,MIDDLE:tc.DOLLY,RIGHT:tc.PAN},this.touches={ONE:nc.ROTATE,TWO:nc.DOLLY_PAN},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=$=>{$.addEventListener("keydown",G),this._domElementKeyEvents=$},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",G),this._domElementKeyEvents=null},this.saveState=function(){i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=function(){i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,this.clearDampedRotation(),this.clearDampedPan(),i.object.updateProjectionMatrix(),i.dispatchEvent(WA),i.update(),s=r.NONE},this.clearDampedRotation=function(){l.theta=0,l.phi=0},this.clearDampedPan=function(){u.set(0,0,0)},this.update=function(){const $=new Y,ae=new Qt().setFromUnitVectors(e.up,new Y(0,1,0)),ke=ae.clone().invert(),Le=new Y,Ve=new Qt,Je=new Y,st=2*Math.PI;return function(){ae.setFromUnitVectors(e.up,new Y(0,1,0)),ke.copy(ae).invert();const Ze=i.object.position;$.copy(Ze).sub(i.target),$.applyQuaternion(ae),a.setFromVector3($),i.autoRotate&&s===r.NONE&&I(w()),i.enableDamping?(a.theta+=l.theta*i.dampingFactor,a.phi+=l.phi*i.dampingFactor):(a.theta+=l.theta,a.phi+=l.phi);let we=i.minAzimuthAngle,De=i.maxAzimuthAngle;isFinite(we)&&isFinite(De)&&(we<-Math.PI?we+=st:we>Math.PI&&(we-=st),De<-Math.PI?De+=st:De>Math.PI&&(De-=st),we<=De?a.theta=Math.max(we,Math.min(De,a.theta)):a.theta=a.theta>(we+De)/2?Math.max(we,a.theta):Math.min(De,a.theta)),a.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,a.phi)),a.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(u,i.dampingFactor):i.target.add(u),i.zoomToCursor&&E||i.object.isOrthographicCamera?a.radius=se(a.radius):a.radius=se(a.radius*c),$.setFromSpherical(a),$.applyQuaternion(ke),Ze.copy(i.target).add($),i.object.lookAt(i.target),i.enableDamping===!0?(l.theta*=1-i.dampingFactor,l.phi*=1-i.dampingFactor,u.multiplyScalar(1-i.dampingFactor)):(l.set(0,0,0),u.set(0,0,0));let Ke=!1;if(i.zoomToCursor&&E){let et=null;if(i.object.isPerspectiveCamera){const _t=$.length();et=se(_t*c);const hn=_t-et;i.object.position.addScaledVector(_,hn),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const _t=new Y(S.x,S.y,0);_t.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/c)),i.object.updateProjectionMatrix(),Ke=!0;const hn=new Y(S.x,S.y,0);hn.unproject(i.object),i.object.position.sub(hn).add(_t),i.object.updateMatrixWorld(),et=$.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;et!==null&&(this.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(et).add(i.object.position):(jf.origin.copy(i.object.position),jf.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(jf.direction))o||8*(1-Ve.dot(i.object.quaternion))>o||Je.distanceToSquared(i.target)>0?(i.dispatchEvent(WA),Le.copy(i.object.position),Ve.copy(i.object.quaternion),Je.copy(i.target),Ke=!1,!0):!1}}(),this.dispose=function(){i.domElement.removeEventListener("contextmenu",z),i.domElement.removeEventListener("pointerdown",P),i.domElement.removeEventListener("pointercancel",j),i.domElement.removeEventListener("wheel",W),i.domElement.removeEventListener("pointermove",U),i.domElement.removeEventListener("pointerup",j),i._domElementKeyEvents!==null&&(i._domElementKeyEvents.removeEventListener("keydown",G),i._domElementKeyEvents=null)};const i=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=r.NONE;const o=1e-6,a=new iA,l=new iA;let c=1;const u=new Y,d=new qe,h=new qe,f=new qe,p=new qe,g=new qe,y=new qe,m=new qe,v=new qe,x=new qe,_=new Y,S=new qe;let E=!1;const A=[],R={};function w(){return 2*Math.PI/60/60*i.autoRotateSpeed}function M(){return Math.pow(.95,i.zoomSpeed)}function I($){l.theta-=$}function L($){l.phi-=$}const k=function(){const $=new Y;return function(ke,Le){$.setFromMatrixColumn(Le,0),$.multiplyScalar(-ke),u.add($)}}(),T=function(){const $=new Y;return function(ke,Le){i.screenSpacePanning===!0?$.setFromMatrixColumn(Le,1):($.setFromMatrixColumn(Le,0),$.crossVectors(i.object.up,$)),$.multiplyScalar(ke),u.add($)}}(),F=function(){const $=new Y;return function(ke,Le){const Ve=i.domElement;if(i.object.isPerspectiveCamera){const Je=i.object.position;$.copy(Je).sub(i.target);let st=$.length();st*=Math.tan(i.object.fov/2*Math.PI/180),k(2*ke*st/Ve.clientHeight,i.object.matrix),T(2*Le*st/Ve.clientHeight,i.object.matrix)}else i.object.isOrthographicCamera?(k(ke*(i.object.right-i.object.left)/i.object.zoom/Ve.clientWidth,i.object.matrix),T(Le*(i.object.top-i.object.bottom)/i.object.zoom/Ve.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}}();function V($){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c/=$:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function Q($){i.object.isPerspectiveCamera||i.object.isOrthographicCamera?c*=$:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function ee($){if(!i.zoomToCursor)return;E=!0;const ae=i.domElement.getBoundingClientRect(),ke=$.clientX-ae.left,Le=$.clientY-ae.top,Ve=ae.width,Je=ae.height;S.x=ke/Ve*2-1,S.y=-(Le/Je)*2+1,_.set(S.x,S.y,1).unproject(e).sub(e.position).normalize()}function se($){return Math.max(i.minDistance,Math.min(i.maxDistance,$))}function he($){d.set($.clientX,$.clientY)}function ie($){ee($),m.set($.clientX,$.clientY)}function re($){p.set($.clientX,$.clientY)}function be($){h.set($.clientX,$.clientY),f.subVectors(h,d).multiplyScalar(i.rotateSpeed);const ae=i.domElement;I(2*Math.PI*f.x/ae.clientHeight),L(2*Math.PI*f.y/ae.clientHeight),d.copy(h),i.update()}function le($){v.set($.clientX,$.clientY),x.subVectors(v,m),x.y>0?V(M()):x.y<0&&Q(M()),m.copy(v),i.update()}function fe($){g.set($.clientX,$.clientY),y.subVectors(g,p).multiplyScalar(i.panSpeed),F(y.x,y.y),p.copy(g),i.update()}function Te($){ee($),$.deltaY<0?Q(M()):$.deltaY>0&&V(M()),i.update()}function Ce($){let ae=!1;switch($.code){case i.keys.UP:$.ctrlKey||$.metaKey||$.shiftKey?L(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):F(0,i.keyPanSpeed),ae=!0;break;case i.keys.BOTTOM:$.ctrlKey||$.metaKey||$.shiftKey?L(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):F(0,-i.keyPanSpeed),ae=!0;break;case i.keys.LEFT:$.ctrlKey||$.metaKey||$.shiftKey?I(2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):F(i.keyPanSpeed,0),ae=!0;break;case i.keys.RIGHT:$.ctrlKey||$.metaKey||$.shiftKey?I(-2*Math.PI*i.rotateSpeed/i.domElement.clientHeight):F(-i.keyPanSpeed,0),ae=!0;break}ae&&($.preventDefault(),i.update())}function Ie(){if(A.length===1)d.set(A[0].pageX,A[0].pageY);else{const $=.5*(A[0].pageX+A[1].pageX),ae=.5*(A[0].pageY+A[1].pageY);d.set($,ae)}}function ze(){if(A.length===1)p.set(A[0].pageX,A[0].pageY);else{const $=.5*(A[0].pageX+A[1].pageX),ae=.5*(A[0].pageY+A[1].pageY);p.set($,ae)}}function Be(){const $=A[0].pageX-A[1].pageX,ae=A[0].pageY-A[1].pageY,ke=Math.sqrt($*$+ae*ae);m.set(0,ke)}function it(){i.enableZoom&&Be(),i.enablePan&&ze()}function te(){i.enableZoom&&Be(),i.enableRotate&&Ie()}function ne($){if(A.length==1)h.set($.pageX,$.pageY);else{const ke=Z($),Le=.5*($.pageX+ke.x),Ve=.5*($.pageY+ke.y);h.set(Le,Ve)}f.subVectors(h,d).multiplyScalar(i.rotateSpeed);const ae=i.domElement;I(2*Math.PI*f.x/ae.clientHeight),L(2*Math.PI*f.y/ae.clientHeight),d.copy(h)}function b($){if(A.length===1)g.set($.pageX,$.pageY);else{const ae=Z($),ke=.5*($.pageX+ae.x),Le=.5*($.pageY+ae.y);g.set(ke,Le)}y.subVectors(g,p).multiplyScalar(i.panSpeed),F(y.x,y.y),p.copy(g)}function oe($){const ae=Z($),ke=$.pageX-ae.x,Le=$.pageY-ae.y,Ve=Math.sqrt(ke*ke+Le*Le);v.set(0,Ve),x.set(0,Math.pow(v.y/m.y,i.zoomSpeed)),V(x.y),m.copy(v)}function J($){i.enableZoom&&oe($),i.enablePan&&b($)}function H($){i.enableZoom&&oe($),i.enableRotate&&ne($)}function P($){i.enabled!==!1&&(A.length===0&&(i.domElement.setPointerCapture($.pointerId),i.domElement.addEventListener("pointermove",U),i.domElement.addEventListener("pointerup",j)),C($),$.pointerType==="touch"?X($):B($))}function U($){i.enabled!==!1&&($.pointerType==="touch"?ue($):D($))}function j($){N($),A.length===0&&(i.domElement.releasePointerCapture($.pointerId),i.domElement.removeEventListener("pointermove",U),i.domElement.removeEventListener("pointerup",j)),i.dispatchEvent(QA),s=r.NONE}function B($){let ae;switch($.button){case 0:ae=i.mouseButtons.LEFT;break;case 1:ae=i.mouseButtons.MIDDLE;break;case 2:ae=i.mouseButtons.RIGHT;break;default:ae=-1}switch(ae){case tc.DOLLY:if(i.enableZoom===!1)return;ie($),s=r.DOLLY;break;case tc.ROTATE:if($.ctrlKey||$.metaKey||$.shiftKey){if(i.enablePan===!1)return;re($),s=r.PAN}else{if(i.enableRotate===!1)return;he($),s=r.ROTATE}break;case tc.PAN:if($.ctrlKey||$.metaKey||$.shiftKey){if(i.enableRotate===!1)return;he($),s=r.ROTATE}else{if(i.enablePan===!1)return;re($),s=r.PAN}break;default:s=r.NONE}s!==r.NONE&&i.dispatchEvent(Vg)}function D($){switch(s){case r.ROTATE:if(i.enableRotate===!1)return;be($);break;case r.DOLLY:if(i.enableZoom===!1)return;le($);break;case r.PAN:if(i.enablePan===!1)return;fe($);break}}function W($){i.enabled===!1||i.enableZoom===!1||s!==r.NONE||($.preventDefault(),i.dispatchEvent(Vg),Te($),i.dispatchEvent(QA))}function G($){i.enabled===!1||i.enablePan===!1||Ce($)}function X($){switch(q($),A.length){case 1:switch(i.touches.ONE){case nc.ROTATE:if(i.enableRotate===!1)return;Ie(),s=r.TOUCH_ROTATE;break;case nc.PAN:if(i.enablePan===!1)return;ze(),s=r.TOUCH_PAN;break;default:s=r.NONE}break;case 2:switch(i.touches.TWO){case nc.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;it(),s=r.TOUCH_DOLLY_PAN;break;case nc.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;te(),s=r.TOUCH_DOLLY_ROTATE;break;default:s=r.NONE}break;default:s=r.NONE}s!==r.NONE&&i.dispatchEvent(Vg)}function ue($){switch(q($),s){case r.TOUCH_ROTATE:if(i.enableRotate===!1)return;ne($),i.update();break;case r.TOUCH_PAN:if(i.enablePan===!1)return;b($),i.update();break;case r.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;J($),i.update();break;case r.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;H($),i.update();break;default:s=r.NONE}}function z($){i.enabled!==!1&&$.preventDefault()}function C($){A.push($)}function N($){delete R[$.pointerId];for(let ae=0;ae{const s=performance.now();let o=n.style.display==="none"?0:parseFloat(n.style.opacity);isNaN(o)&&(o=1);const a=window.setInterval(()=>{const c=performance.now()-s;let u=Math.min(c/i,1);u>.999&&(u=1);let d;e?(d=(1-u)*o,d<1e-4&&(d=0)):d=(1-o)*u+o,d>0?(n.style.display=t,n.style.opacity=d):n.style.display="none",u>=1&&(r&&r(),window.clearInterval(a))},16);return a},vk=500,Bm=class Bm{constructor(e,t){this.taskIDGen=0,this.elementID=Bm.elementIDGen++,this.tasks=[],this.message=e||"Loading...",this.container=t||document.body,this.spinnerContainerOuter=document.createElement("div"),this.spinnerContainerOuter.className="spinnerOuterContainer".concat(this.elementID),this.spinnerContainerOuter.style.display="none",this.spinnerContainerPrimary=document.createElement("div"),this.spinnerContainerPrimary.className="spinnerContainerPrimary".concat(this.elementID),this.spinnerPrimary=document.createElement("div"),this.spinnerPrimary.classList.add("spinner".concat(this.elementID),"spinnerPrimary".concat(this.elementID)),this.messageContainerPrimary=document.createElement("div"),this.messageContainerPrimary.classList.add("messageContainer".concat(this.elementID),"messageContainerPrimary".concat(this.elementID)),this.messageContainerPrimary.innerHTML=this.message,this.spinnerContainerMin=document.createElement("div"),this.spinnerContainerMin.className="spinnerContainerMin".concat(this.elementID),this.spinnerMin=document.createElement("div"),this.spinnerMin.classList.add("spinner".concat(this.elementID),"spinnerMin".concat(this.elementID)),this.messageContainerMin=document.createElement("div"),this.messageContainerMin.classList.add("messageContainer".concat(this.elementID),"messageContainerMin".concat(this.elementID)),this.messageContainerMin.innerHTML=this.message,this.spinnerContainerPrimary.appendChild(this.spinnerPrimary),this.spinnerContainerPrimary.appendChild(this.messageContainerPrimary),this.spinnerContainerOuter.appendChild(this.spinnerContainerPrimary),this.spinnerContainerMin.appendChild(this.spinnerMin),this.spinnerContainerMin.appendChild(this.messageContainerMin),this.spinnerContainerOuter.appendChild(this.spinnerContainerMin);const i=document.createElement("style");i.innerHTML="\n\n .spinnerOuterContainer".concat(this.elementID," {\n width: 100%;\n height: 100%;\n margin: 0;\n top: 0;\n left: 0;\n position: absolute;\n pointer-events: none;\n }\n\n .messageContainer").concat(this.elementID," {\n height: 20px;\n font-family: arial;\n font-size: 12pt;\n color: #ffffff;\n text-align: center;\n vertical-align: middle;\n }\n\n .spinner").concat(this.elementID," {\n padding: 15px;\n background: #07e8d6;\n z-index:99999;\n \n aspect-ratio: 1;\n border-radius: 50%;\n --_m: \n conic-gradient(#0000,#000),\n linear-gradient(#000 0 0) content-box;\n -webkit-mask: var(--_m);\n mask: var(--_m);\n -webkit-mask-composite: source-out;\n mask-composite: subtract;\n box-sizing: border-box;\n animation: load 1s linear infinite;\n }\n\n .spinnerContainerPrimary").concat(this.elementID," {\n z-index:99999;\n background-color: rgba(128, 128, 128, 0.75);\n border: #666666 1px solid;\n border-radius: 5px;\n padding-top: 20px;\n padding-bottom: 10px;\n margin: 0;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-80px, -80px);\n width: 180px;\n pointer-events: auto;\n }\n\n .spinnerPrimary").concat(this.elementID," {\n width: 120px;\n margin-left: 30px;\n }\n\n .messageContainerPrimary").concat(this.elementID," {\n padding-top: 15px;\n }\n\n .spinnerContainerMin").concat(this.elementID," {\n z-index:99999;\n background-color: rgba(128, 128, 128, 0.75);\n border: #666666 1px solid;\n border-radius: 5px;\n padding-top: 20px;\n padding-bottom: 15px;\n margin: 0;\n position: absolute;\n bottom: 50px;\n left: 50%;\n transform: translate(-50%, 0);\n display: flex;\n flex-direction: left;\n pointer-events: auto;\n min-width: 250px;\n }\n\n .messageContainerMin").concat(this.elementID," {\n margin-right: 15px;\n }\n\n .spinnerMin").concat(this.elementID," {\n width: 50px;\n height: 50px;\n margin-left: 15px;\n margin-right: 25px;\n }\n\n .messageContainerMin").concat(this.elementID," {\n padding-top: 15px;\n }\n \n @keyframes load {\n to{transform: rotate(1turn)}\n }\n\n "),this.spinnerContainerOuter.appendChild(i),this.container.appendChild(this.spinnerContainerOuter),this.setMinimized(!1,!0),this.fadeTransitions=[]}addTask(e){const t={message:e,id:this.taskIDGen++};return this.tasks.push(t),this.update(),t.id}removeTask(e){let t=0;for(let i of this.tasks){if(i.id===e){this.tasks.splice(t,1);break}t++}this.update()}removeAllTasks(){this.tasks=[],this.update()}setMessageForTask(e,t){for(let i of this.tasks)if(i.id===e){i.message=t;break}this.update()}update(){this.tasks.length>0?(this.show(),this.setMessage(this.tasks[this.tasks.length-1].message)):this.hide()}show(){this.spinnerContainerOuter.style.display="block",this.visible=!0}hide(){this.spinnerContainerOuter.style.display="none",this.visible=!1}setContainer(e){this.container&&this.spinnerContainerOuter.parentElement===this.container&&this.container.removeChild(this.spinnerContainerOuter),e&&(this.container=e,this.container.appendChild(this.spinnerContainerOuter),this.spinnerContainerOuter.style.zIndex=this.container.style.zIndex+1)}setMinimized(e,t){const i=(r,s,o,a,l)=>{o?r.style.display=s?a:"none":this.fadeTransitions[l]=yk(r,!s,a,vk,()=>{this.fadeTransitions[l]=null})};i(this.spinnerContainerPrimary,!e,t,"block",0),i(this.spinnerContainerMin,e,t,"flex",1),this.minimized=e}setMessage(e){this.messageContainerPrimary.innerHTML=e,this.messageContainerMin.innerHTML=e}};xe(Bm,"elementIDGen",0);let zy=Bm;class _k{constructor(e){this.idGen=0,this.tasks=[],this.container=e||document.body,this.progressBarContainerOuter=document.createElement("div"),this.progressBarContainerOuter.className="progressBarOuterContainer",this.progressBarContainerOuter.style.display="none",this.progressBarBox=document.createElement("div"),this.progressBarBox.className="progressBarBox",this.progressBarBackground=document.createElement("div"),this.progressBarBackground.className="progressBarBackground",this.progressBar=document.createElement("div"),this.progressBar.className="progressBar",this.progressBarBackground.appendChild(this.progressBar),this.progressBarBox.appendChild(this.progressBarBackground),this.progressBarContainerOuter.appendChild(this.progressBarBox);const t=document.createElement("style");t.innerHTML="\n\n .progressBarOuterContainer {\n width: 100%;\n height: 100%;\n margin: 0;\n top: 0;\n left: 0;\n position: absolute;\n pointer-events: none;\n }\n\n .progressBarBox {\n z-index:99999;\n padding: 7px 9px 5px 7px;\n background-color: rgba(190, 190, 190, 0.75);\n border: #555555 1px solid;\n border-radius: 15px;\n margin: 0;\n position: absolute;\n bottom: 50px;\n left: 50%;\n transform: translate(-50%, 0);\n width: 180px;\n height: 30px;\n pointer-events: auto;\n }\n\n .progressBarBackground {\n width: 100%;\n height: 25px;\n border-radius:10px;\n background-color: rgba(128, 128, 128, 0.75);\n border: #444444 1px solid;\n box-shadow: inset 0 0 10px #333333;\n }\n\n .progressBar {\n height: 25px;\n width: 0px;\n border-radius:10px;\n background-color: rgba(0, 200, 0, 0.75);\n box-shadow: inset 0 0 10px #003300;\n }\n\n ",this.progressBarContainerOuter.appendChild(t),this.container.appendChild(this.progressBarContainerOuter)}show(){this.progressBarContainerOuter.style.display="block"}hide(){this.progressBarContainerOuter.style.display="none"}setProgress(e){this.progressBar.style.width=e+"%"}setContainer(e){this.container&&this.progressBarContainerOuter.parentElement===this.container&&this.container.removeChild(this.progressBarContainerOuter),e&&(this.container=e,this.container.appendChild(this.progressBarContainerOuter),this.progressBarContainerOuter.style.zIndex=this.container.style.zIndex+1)}}const qA=new Y;class xk extends nn{constructor(e=new Y(0,0,1),t=new Y(0,0,0),i=1,r=.1,s=16776960,o=i*.2,a=o*.2){super(),this.type="ArrowHelper";const l=new hh(r,r,i,32);l.translate(0,i/2,0);const c=new hh(0,a,o,32);c.translate(0,i,0),this.position.copy(t),this.line=new pn(l,new Yr({color:s,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new pn(c,new Yr({color:s,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e)}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{qA.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(qA,t)}}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 zd{constructor(e){xe(this,"updateFocusMarker",function(){const e=new Y,t=new Xe,i=new Y;return function(r,s,o){t.copy(s.matrixWorld).invert(),e.copy(r).applyMatrix4(t),e.normalize().multiplyScalar(10),e.applyMatrix4(s.matrixWorld),i.copy(s.position).sub(r);const a=i.length();this.focusMarker.position.copy(r),this.focusMarker.scale.set(a,a,a),this.focusMarker.material.uniforms.realFocusPosition.value.copy(r),this.focusMarker.material.uniforms.viewport.value.copy(o),this.focusMarker.material.uniformsNeedUpdate=!0}}());xe(this,"positionAndOrientControlPlane",function(){const e=new Qt,t=new Y(0,1,0);return function(i,r){e.setFromUnitVectors(t,r),this.controlPlane.position.copy(i),this.controlPlane.quaternion.copy(e)}}());this.threeScene=e,this.splatRenderTarget=null,this.renderTargetCopyQuad=null,this.renderTargetCopyCamera=null,this.meshCursor=null,this.focusMarker=null,this.controlPlane=null,this.debugRoot=null,this.secondaryDebugRoot=null}updateSplatRenderTargetForRenderDimensions(e,t){this.destroySplatRendertarget(),this.splatRenderTarget=new Fa(e,t,{format:Di,stencilBuffer:!1,depthBuffer:!0}),this.splatRenderTarget.depthTexture=new Ua(e,t),this.splatRenderTarget.depthTexture.format=Ml,this.splatRenderTarget.depthTexture.type=Ni}destroySplatRendertarget(){this.splatRenderTarget&&(this.splatRenderTarget=null)}setupRenderTargetCopyObjects(){const e={sourceColorTexture:{type:"t",value:null},sourceDepthTexture:{type:"t",value:null}},t=new Pr({vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = vec4( position.xy, 0.0, 1.0 ); \n }\n ",fragmentShader:"\n #include \n #include \n varying vec2 vUv;\n uniform sampler2D sourceColorTexture;\n uniform sampler2D sourceDepthTexture;\n void main() {\n vec4 color = texture2D(sourceColorTexture, vUv);\n float fragDepth = texture2D(sourceDepthTexture, vUv).x;\n gl_FragDepth = fragDepth;\n gl_FragColor = vec4(color.rgb, color.a * 2.0);\n }\n ",uniforms:e,depthWrite:!1,depthTest:!1,transparent:!0,blending:u5,blendSrc:ih,blendSrcAlpha:ih,blendDst:rh,blendDstAlpha:rh});t.extensions.fragDepth=!0,this.renderTargetCopyQuad=new pn(new pu(2,2),t),this.renderTargetCopyCamera=new Ou(-1,1,1,-1,0,1)}destroyRenderTargetCopyObjects(){this.renderTargetCopyQuad&&(Cc(this.renderTargetCopyQuad),this.renderTargetCopyQuad=null)}setupMeshCursor(){if(!this.meshCursor){const e=new b_(.5,1.5,32),t=new Yr({color:16777215}),i=new pn(e,t);i.rotation.set(0,0,Math.PI),i.position.set(0,1,0);const r=new pn(e,t);r.position.set(0,-1,0);const s=new pn(e,t);s.rotation.set(0,0,Math.PI/2),s.position.set(1,0,0);const o=new pn(e,t);o.rotation.set(0,0,-Math.PI/2),o.position.set(-1,0,0),this.meshCursor=new nn,this.meshCursor.add(i),this.meshCursor.add(r),this.meshCursor.add(s),this.meshCursor.add(o),this.meshCursor.scale.set(.1,.1,.1),this.threeScene.add(this.meshCursor),this.meshCursor.visible=!1}}destroyMeshCursor(){this.meshCursor&&(Cc(this.meshCursor),this.threeScene.remove(this.meshCursor),this.meshCursor=null)}setMeshCursorVisibility(e){this.meshCursor.visible=e}getMeschCursorVisibility(){return this.meshCursor.visible}setMeshCursorPosition(e){this.meshCursor.position.copy(e)}positionAndOrientMeshCursor(e,t){this.meshCursor.position.copy(e),this.meshCursor.up.copy(t.up),this.meshCursor.lookAt(t.position)}setupFocusMarker(){if(!this.focusMarker){const e=new fm(.5,32,32),t=zd.buildFocusMarkerMaterial();t.depthTest=!1,t.depthWrite=!1,t.transparent=!0,this.focusMarker=new pn(e,t)}}destroyFocusMarker(){this.focusMarker&&(Cc(this.focusMarker),this.focusMarker=null)}setFocusMarkerVisibility(e){this.focusMarker.visible=e}setFocusMarkerOpacity(e){this.focusMarker.material.uniforms.opacity.value=e,this.focusMarker.material.uniformsNeedUpdate=!0}getFocusMarkerOpacity(){return this.focusMarker.material.uniforms.opacity.value}setupControlPlane(){if(!this.controlPlane){const e=new pu(1,1);e.rotateX(-Math.PI/2);const t=new Yr({color:16777215});t.transparent=!0,t.opacity=.6,t.depthTest=!1,t.depthWrite=!1,t.side=Cr;const i=new pn(e,t),r=new Y(0,1,0);r.normalize();const s=new Y(0,0,0),o=.5,a=.01,l=56576,c=new xk(r,s,o,a,l,.1,.03);this.controlPlane=new nn,this.controlPlane.add(i),this.controlPlane.add(c)}}destroyControlPlane(){this.controlPlane&&(Cc(this.controlPlane),this.controlPlane=null)}setControlPlaneVisibility(e){this.controlPlane.visible=e}addDebugMeshes(){this.debugRoot=this.createDebugMeshes(),this.secondaryDebugRoot=this.createSecondaryDebugMeshes(),this.threeScene.add(this.debugRoot),this.threeScene.add(this.secondaryDebugRoot)}destroyDebugMeshes(){for(let e of[this.debugRoot,this.secondaryDebugRoot])e&&(Cc(e),this.threeScene.remove(e));this.debugRoot=null,this.secondaryDebugRoot=null}createDebugMeshes(e){const t=new fm(1,32,32),i=new nn,r=(s,o)=>{let a=new pn(t,zd.buildDebugMaterial(s));a.renderOrder=e,i.add(a),a.position.fromArray(o)};return r(16711680,[-50,0,0]),r(16711680,[50,0,0]),r(65280,[0,0,-50]),r(65280,[0,0,50]),r(16755200,[5,0,5]),i}createSecondaryDebugMeshes(e){const t=new Pu(3,3,3),i=new nn;let r=12303291;const s=a=>{let l=new pn(t,zd.buildDebugMaterial(r));l.renderOrder=e,i.add(l),l.position.fromArray(a)};let o=10;return s([-o,0,-o]),s([-o,0,o]),s([o,0,-o]),s([o,0,o]),i}static buildDebugMaterial(e){const t="\n #include \n varying float ndcDepth;\n\n void main() {\n gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position.xyz, 1.0);\n ndcDepth = gl_Position.z / gl_Position.w;\n gl_Position.x = gl_Position.x / gl_Position.w;\n gl_Position.y = gl_Position.y / gl_Position.w;\n gl_Position.z = 0.0;\n gl_Position.w = 1.0;\n \n }\n ",i="\n #include \n uniform vec3 color;\n varying float ndcDepth;\n void main() {\n gl_FragDepth = (ndcDepth + 1.0) / 2.0;\n gl_FragColor = vec4(color.rgb, 0.0);\n }\n ",r={color:{type:"v3",value:new gt(e)}},s=new Pr({uniforms:r,vertexShader:t,fragmentShader:i,transparent:!1,depthTest:!0,depthWrite:!0,side:bs});return s.extensions.fragDepth=!0,s}static buildFocusMarkerMaterial(e){const t="\n #include \n\n uniform vec2 viewport;\n uniform vec3 realFocusPosition;\n\n varying vec4 ndcPosition;\n varying vec4 ndcCenter;\n varying vec4 ndcFocusPosition;\n\n void main() {\n float radius = 0.01;\n\n vec4 viewPosition = modelViewMatrix * vec4(position.xyz, 1.0);\n vec4 viewCenter = modelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0);\n\n vec4 viewFocusPosition = modelViewMatrix * vec4(realFocusPosition, 1.0);\n\n ndcPosition = projectionMatrix * viewPosition;\n ndcPosition = ndcPosition * vec4(1.0 / ndcPosition.w);\n ndcCenter = projectionMatrix * viewCenter;\n ndcCenter = ndcCenter * vec4(1.0 / ndcCenter.w);\n\n ndcFocusPosition = projectionMatrix * viewFocusPosition;\n ndcFocusPosition = ndcFocusPosition * vec4(1.0 / ndcFocusPosition.w);\n\n gl_Position = projectionMatrix * viewPosition;\n\n }\n ",i="\n #include \n uniform vec3 color;\n uniform vec2 viewport;\n uniform float opacity;\n\n varying vec4 ndcPosition;\n varying vec4 ndcCenter;\n varying vec4 ndcFocusPosition;\n\n void main() {\n vec2 screenPosition = vec2(ndcPosition) * viewport;\n vec2 screenCenter = vec2(ndcCenter) * viewport;\n\n vec2 screenVec = screenPosition - screenCenter;\n\n float projectedRadius = length(screenVec);\n\n float lineWidth = 0.0005 * viewport.y;\n float aaRange = 0.0025 * viewport.y;\n float radius = 0.06 * viewport.y;\n float radDiff = abs(projectedRadius - radius) - lineWidth;\n float alpha = 1.0 - clamp(radDiff / 5.0, 0.0, 1.0); \n\n gl_FragColor = vec4(color.rgb, alpha * opacity);\n }\n ",r={color:{type:"v3",value:new gt(e)},realFocusPosition:{type:"v3",value:new Y},viewport:{type:"v2",value:new qe},opacity:{value:0}};return new Pr({uniforms:r,vertexShader:t,fragmentShader:i,transparent:!0,depthTest:!1,depthWrite:!1,side:bs})}dispose(){this.destroyMeshCursor(),this.destroyFocusMarker(),this.destroyDebugMeshes(),this.destroyControlPlane(),this.destroyRenderTargetCopyObjects(),this.destroySplatRendertarget()}}const Sk=new Y(1,0,0),Ak=new Y(0,1,0),bk=new Y(0,0,1);class Hg{constructor(e=new Y,t=new Y){xe(this,"intersectBox",function(){const e=new Y,t=[],i=[],r=[];return function(s,o){if(i[0]=this.origin.x,i[1]=this.origin.y,i[2]=this.origin.z,r[0]=this.direction.x,r[1]=this.direction.y,r[2]=this.direction.z,this.boxContainsPoint(s,this.origin,1e-4))return o&&(o.origin.copy(this.origin),o.normal.set(0,0,0),o.distance=-1),!0;for(let a=0;a<3;a++){if(r[a]==0)continue;const l=a==0?Sk:a==1?Ak:bk,c=r[a]<0?s.max:s.min;let u=-Math.sign(r[a]);t[0]=a==0?c.x:a==1?c.y:c.z;let d=t[0]-i[a];if(d*u<0){const h=(a+1)%3,f=(a+2)%3;if(t[2]=r[h]/r[a]*d+i[h],t[1]=r[f]/r[a]*d+i[f],e.set(t[a],t[f],t[h]),this.boxContainsPoint(s,e,1e-4))return o&&(o.origin.copy(e),o.normal.copy(l).multiplyScalar(u),o.distance=e.sub(this.origin).length()),!0}}return!1}}());xe(this,"intersectSphere",function(){const e=new Y;return function(t,i,r){e.copy(t).sub(this.origin);const s=e.dot(this.direction),o=s*s,l=e.dot(e)-o,c=i*i;if(l>c)return!1;const u=Math.sqrt(c-l),d=s-u,h=s+u;if(h<0)return!1;let f=d<0?h:d;return r&&(r.origin.copy(this.origin).addScaledVector(this.direction,f),r.normal.copy(r.origin).sub(t).normalize(),r.distance=f),!0}}());this.origin=new Y,this.direction=new Y,this.setParameters(e,t)}setParameters(e,t){this.origin.copy(e),this.direction.copy(t).normalize()}boxContainsPoint(e,t,i){return!(t.xe.max.x+i||t.ye.max.y+i||t.ze.max.z+i)}}class $_{constructor(){this.origin=new Y,this.normal=new Y,this.distance=0,this.splatIndex=0}set(e,t,i,r){this.origin.copy(e),this.normal.copy(t),this.distance=i,this.splatIndex=r}clone(){const e=new $_;return e.origin.copy(this.origin),e.normal.copy(this.normal),e.distance=this.distance,e.splatIndex=this.splatIndex,e}}const Eo={ThreeD:0,TwoD:1};class Tk{constructor(e,t,i=!1){xe(this,"ndcCoords",new qe);xe(this,"setFromCameraAndScreenPosition",(e,t,i)=>{if(this.ndcCoords.x=t.x/i.x*2-1,this.ndcCoords.y=(i.y-t.y)/i.y*2-1,e.isPerspectiveCamera)this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(this.ndcCoords.x,this.ndcCoords.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e;else if(e.isOrthographicCamera)this.ray.origin.set(this.ndcCoords.x,this.ndcCoords.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e;else throw new Error("Raycaster::setFromCameraAndScreenPosition() -> Unsupported camera type")});xe(this,"intersectSplatMesh",function(){const e=new Xe,t=new Xe,i=new Xe,r=new Hg,s=new Y;return function(o,a=[]){const l=o.getSplatTree();if(l){for(let c=0;c{h.origin.applyMatrix4(t),h.normal.applyMatrix4(t).normalize(),h.distance=s.copy(h.origin).sub(this.ray.origin).length()}),a.push(...d)}return a.sort((c,u)=>c.distance>u.distance?1:-1),a}}}());xe(this,"castRayAtSplatTreeNode",function(){const e=new Mt,t=new Y,i=new Y,r=new Qt,s=new $_,o=1e-7,a=new Y(0,0,0),l=new Xe,c=new Xe,u=new Xe,d=new Xe,h=new Xe,f=new Hg;return function(p,g,y,m=[]){if(p.intersectBox(y.boundingBox)){if(y.data&&y.data.indexes&&y.data.indexes.length>0)for(let v=0;v0)for(let v of y.children)this.castRayAtSplatTreeNode(p,g,v,m);return m}}}());this.ray=new Hg(e,t),this.raycastAgainstTrueSplatEllipsoid=i}}class Qc{static buildVertexShaderBase(e=!1,t=!1,i=0,r="",s=!0){let o="";return s==!0?o+="#define USE_FLAME":o+="#define USE_SKINNING",o+="\n precision highp float;\n #include \n\n attribute uint splatIndex;\n uniform highp usampler2D flameModelTexture;\n uniform highp usampler2D boneTexture;\n uniform highp usampler2D boneWeightTexture;\n\n\n uniform highp usampler2D centersColorsTexture;\n uniform highp sampler2D sphericalHarmonicsTexture;\n uniform highp sampler2D sphericalHarmonicsTextureR;\n uniform highp sampler2D sphericalHarmonicsTextureG;\n uniform highp sampler2D sphericalHarmonicsTextureB;\n\n uniform highp usampler2D sceneIndexesTexture;\n uniform vec2 sceneIndexesTextureSize;\n uniform int sceneCount;\n uniform int gaussianSplatCount;\n uniform int bsCount;\n uniform float headBoneIndex;\n #ifdef USE_SKINNING\n attribute vec4 skinIndex;\n attribute vec4 skinWeight;\n #endif\n ",t&&(o+="\n uniform float sceneOpacity[".concat(Ft.MaxScenes,"];\n uniform int sceneVisibility[").concat(Ft.MaxScenes,"];\n ")),e&&(o+="\n uniform highp mat4 transforms[".concat(Ft.MaxScenes,"];\n ")),o+="\n ".concat(r,"\n uniform vec2 focal;\n uniform float orthoZoom;\n uniform int orthographicMode;\n uniform int pointCloudModeEnabled;\n uniform float inverseFocalAdjustment;\n uniform vec2 viewport;\n uniform vec2 basisViewport;\n uniform vec2 centersColorsTextureSize;\n uniform vec2 flameModelTextureSize;\n uniform vec2 boneWeightTextureSize;\n uniform vec2 boneTextureSize;\n\n uniform int sphericalHarmonicsDegree;\n uniform vec2 sphericalHarmonicsTextureSize;\n uniform int sphericalHarmonics8BitMode;\n uniform int sphericalHarmonicsMultiTextureMode;\n uniform float visibleRegionRadius;\n uniform float visibleRegionFadeStartRadius;\n uniform float firstRenderTime;\n uniform float currentTime;\n uniform int fadeInComplete;\n uniform vec3 sceneCenter;\n uniform float splatScale;\n uniform float sphericalHarmonics8BitCompressionRangeMin[").concat(Ft.MaxScenes,"];\n uniform float sphericalHarmonics8BitCompressionRangeMax[").concat(Ft.MaxScenes,"];\n\n varying vec4 vColor;\n varying vec2 vUv;\n varying vec2 vPosition;\n varying vec2 vSplatIndex;\n #ifdef USE_SKINNING\n uniform mat4 bindMatrix;\n uniform mat4 bindMatrixInverse;\n uniform highp sampler2D boneTexture0;\n mat4 getBoneMatrix0( const in float i ) {\n int size = textureSize( boneTexture0, 0 ).x;\n int j = int( i ) * 4;\n int x = j % size;\n int y = j / size;\n vec4 v1 = texelFetch( boneTexture0, ivec2( x, y ), 0 );\n vec4 v2 = texelFetch( boneTexture0, ivec2( x + 1, y ), 0 );\n vec4 v3 = texelFetch( boneTexture0, ivec2( x + 2, y ), 0 );\n vec4 v4 = texelFetch( boneTexture0, ivec2( x + 3, y ), 0 );\n return mat4( v1, v2, v3, v4 );\n }\n #endif\n\n mat3 quaternionToRotationMatrix(float x, float y, float z, float w) {\n float s = 1.0 / sqrt(w * w + x * x + y * y + z * z);\n \n return mat3(\n 1. - 2. * (y * y + z * z),\n 2. * (x * y + w * z),\n 2. * (x * z - w * y),\n 2. * (x * y - w * z),\n 1. - 2. * (x * x + z * z),\n 2. * (y * z + w * x),\n 2. * (x * z + w * y),\n 2. * (y * z - w * x),\n 1. - 2. * (x * x + y * y)\n );\n }\n\n const float sqrt8 = sqrt(8.0);\n const float minAlpha = 1.0 / 255.0;\n\n const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);\n const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000));\n const uvec4 shift4 = uvec4(0, 8, 16, 24);\n int internal = 1;//show a gaussian splatting point every internal points.\n vec4 uintToRGBAVec (uint u) {\n uvec4 urgba = mask4 & u;\n urgba = urgba >> shift4;\n vec4 rgba = vec4(urgba) * encodeNorm4;\n return rgba;\n }\n float getRealIndex(int sIndex, int reducedFactor) {\n int remainder = sIndex % reducedFactor;\n\n if(remainder == int(0)) {\n return float(sIndex);\n }\n else\n {\n return float(sIndex - remainder);\n }\n }\n\n vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(uint(getRealIndex(int(splatIndex), internal)) * uint(stride) + uint(offset)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n vec2 getFlameDataUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(uint(int(splatIndex) / internal) * uint(stride) + uint(offset) + uint(gaussianSplatCount * bsCount)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n vec2 getBoneWeightUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(uint(int(splatIndex) / internal) * uint(stride) + uint(offset)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n vec2 getBSFlameDataUV(in int bsInedex, in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(uint(int(splatIndex) / internal) * uint(stride) + uint(offset) + uint(gaussianSplatCount * bsInedex)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n vec2 getDataUVF(in uint sIndex, in float stride, in uint offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(uint(float(getRealIndex(int(sIndex), internal)) * stride) + offset) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n const float SH_C1 = 0.4886025119029199f;\n const float[5] SH_C2 = float[](1.0925484, -1.0925484, 0.3153916, -1.0925484, 0.5462742);\n\n mat4 getBoneMatrix( float i ) {\n float y = i;\n float x = 0.0;\n\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(i * 4.0) / boneTextureSize.x;//4\n samplerUV.y = float(floor(d)) / boneTextureSize.y;//5\n samplerUV.x = fract(d);\n\n vec4 v1 = uintBitsToFloat(texture( boneTexture, samplerUV ));\n vec4 v2 = uintBitsToFloat(texture( boneTexture, vec2(samplerUV.x + 1.0 / boneTextureSize.x, samplerUV.y)));\n vec4 v3 = uintBitsToFloat(texture( boneTexture, vec2(samplerUV.x + 2.0 / boneTextureSize.x, samplerUV.y) ));\n vec4 v4 = uintBitsToFloat(texture( boneTexture, vec2(samplerUV.x + 3.0 / boneTextureSize.x, samplerUV.y)));\n\n return mat4( v1, v2, v3, v4 );\n }\n\n void main () {\n\n uint oddOffset = splatIndex & uint(0x00000001);\n uint doubleOddOffset = oddOffset * uint(2);\n bool isEven = oddOffset == uint(0);\n uint nearestEvenIndex = splatIndex - oddOffset;\n float fOddOffset = float(oddOffset);\n\n uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize));\n // vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba));\n\n uvec3 sampledCenter = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize)).gba;\n vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenter));\n\n vec2 flameTextureUV = getBSFlameDataUV(bsCount, 1, 0, flameModelTextureSize);\n uvec3 sampledflamePos = texture(flameModelTexture, flameTextureUV).rgb;\n // splatCenter += uintBitsToFloat(uvec3(sampledflamePos.rgb));\n\n for(int i = 0; i < bsCount; ++i) {\n vec2 flameBSTextureUV = getBSFlameDataUV(i, 1, 0, flameModelTextureSize);\n uvec3 sampledBSPos = texture(flameModelTexture, flameBSTextureUV).rgb;\n\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(i / 4 + 5 * 4) / boneTextureSize.x;//4\n samplerUV.y = float(floor(d)) / boneTextureSize.y;//32\n samplerUV.x = fract(d);\n\n vec4 bsWeight = uintBitsToFloat(texture(boneTexture, samplerUV));\n float weight = bsWeight.r;\n if(i % 4 == 1) {\n weight = bsWeight.g;\n }\n if(i % 4 == 2) {\n weight = bsWeight.b;\n }\n if(i % 4 == 3) {\n weight = bsWeight.a;\n }\n\n splatCenter = splatCenter + weight * uintBitsToFloat(sampledBSPos);\n }\n\n\n #ifdef USE_SKINNING\n mat4 boneMatX = getBoneMatrix0( skinIndex.x );\n mat4 boneMatY = getBoneMatrix0( skinIndex.y );\n mat4 boneMatZ = getBoneMatrix0( skinIndex.z );\n mat4 boneMatW = getBoneMatrix0( skinIndex.w );\n #endif\n #ifdef USE_SKINNING\n mat4 skinMatrix = mat4( 0.0 );\n skinMatrix += skinWeight.x * boneMatX;\n skinMatrix += skinWeight.y * boneMatY;\n skinMatrix += skinWeight.z * boneMatZ;\n skinMatrix += skinWeight.w * boneMatW;\n // skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n #endif\n vec3 transformed = vec3(splatCenter.xyz);\n #ifdef USE_SKINNING\n // vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n vec4 skinVertex = vec4( transformed, 1.0 );\n\n vec4 skinned = vec4( 0.0 );\n // There is an offset between the Gaussian point and the mesh vertex,\n // which will cause defects in the skeletal animation driving the Gaussian point. \n //In order to circumvent this problem, only the head bone(index is 110 currently) is used to drive\n\n if (headBoneIndex >= 0.0)\n {\n mat4 boneMat = getBoneMatrix0( headBoneIndex );\n skinned += boneMat * skinVertex * 1.0;\n }\n\n // skinned += boneMatX * skinVertex * skinWeight.x;\n // skinned += boneMatY * skinVertex * skinWeight.y;\n // skinned += boneMatZ * skinVertex * skinWeight.z;\n // skinned += boneMatW * skinVertex * skinWeight.w;\n\n // transformed = ( bindMatrixInverse * skinned ).xyz;\n transformed = skinned.xyz;\n\n #endif\n splatCenter = transformed.xyz;\n\n #ifdef USE_FLAME\n mat4 boneMatX = getBoneMatrix( 0.0 );\n mat4 boneMatY = getBoneMatrix( 1.0 );\n mat4 boneMatZ = getBoneMatrix( 2.0 );\n mat4 boneMatW = getBoneMatrix( 3.0 ); \n mat4 boneMat0 = getBoneMatrix( 4.0 ); \n \n vec2 boneWeightUV0 = getBoneWeightUV(2, 0, boneWeightTextureSize);\n vec2 boneWeightUV1 = getBoneWeightUV(2, 1, boneWeightTextureSize);\n\n uvec4 sampledBoneMatrixValue = texture(boneWeightTexture, boneWeightUV0);\n uvec4 sampledBoneMatrixValue0 = texture(boneWeightTexture, boneWeightUV1);\n\n vec4 boneMatrixValue = uintBitsToFloat(sampledBoneMatrixValue);\n vec4 boneMatrixValue0 = uintBitsToFloat(sampledBoneMatrixValue0);\n\n vec4 skinVertex = vec4( splatCenter, 1.0 );\n vec4 skinned = vec4( 0.0 );\n float minWeight = min(boneMatrixValue.x,min(boneMatrixValue.y, min(boneMatrixValue.z, min(boneMatrixValue.w, boneMatrixValue0.x))));\n \n if(boneMatrixValue.x > 0.0 && boneMatrixValue.x > minWeight)\n skinned += boneMatX * skinVertex * boneMatrixValue.x;\n \n if(boneMatrixValue.y > 0.0 && boneMatrixValue.y > minWeight)\n skinned += boneMatY * skinVertex * boneMatrixValue.y;\n \n if(boneMatrixValue.z > 0.0 && boneMatrixValue.z > minWeight)\n skinned += boneMatZ * skinVertex * boneMatrixValue.z;\n \n if(boneMatrixValue.w > 0.0 && boneMatrixValue.w > minWeight)\n skinned += boneMatW * skinVertex * boneMatrixValue.w;\n \n if(boneMatrixValue0.x > 0.0 && boneMatrixValue0.x > minWeight)\n skinned += boneMat0 * skinVertex * boneMatrixValue0.x;\n \n splatCenter = skinned.xyz;\n #endif\n\n uint sceneIndex = uint(0);\n if (sceneCount > 1) {\n sceneIndex = texture(sceneIndexesTexture, getDataUV(1, 0, sceneIndexesTextureSize)).r;\n }\n "),t&&(o+="\n float splatOpacityFromScene = sceneOpacity[sceneIndex];\n int sceneVisible = sceneVisibility[sceneIndex];\n if (splatOpacityFromScene <= 0.01 || sceneVisible == 0) {\n gl_Position = vec4(0.0, 0.0, 2.0, 1.0);\n return;\n }\n "),e?o+="\n mat4 transform = transforms[sceneIndex];\n mat4 transformModelViewMatrix = viewMatrix * transform;\n #ifdef USE_SKINNING\n transformModelViewMatrix = transformModelViewMatrix * skinMatrix;\n #endif\n ":o+="mat4 transformModelViewMatrix = modelViewMatrix;",o+="\n float sh8BitCompressionRangeMinForScene = sphericalHarmonics8BitCompressionRangeMin[sceneIndex];\n float sh8BitCompressionRangeMaxForScene = sphericalHarmonics8BitCompressionRangeMax[sceneIndex];\n float sh8BitCompressionRangeForScene = sh8BitCompressionRangeMaxForScene - sh8BitCompressionRangeMinForScene;\n float sh8BitCompressionHalfRangeForScene = sh8BitCompressionRangeForScene / 2.0;\n vec3 vec8BitSHShift = vec3(sh8BitCompressionRangeMinForScene);\n\n vec4 viewCenter = transformModelViewMatrix * vec4(splatCenter, 1.0);\n\n vec4 clipCenter = projectionMatrix * viewCenter;\n\n float clip = 1.2 * clipCenter.w;\n if (clipCenter.z < -clip || clipCenter.x < -clip || clipCenter.x > clip || clipCenter.y < -clip || clipCenter.y > clip) {\n gl_Position = vec4(0.0, 0.0, 2.0, 1.0);\n return;\n }\n\n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n vPosition = position.xy;\n vSplatIndex = vec2(splatIndex, splatIndex);\n\n vColor = uintToRGBAVec(sampledCenterColor.r);\n ",i>=1&&(o+=" \n if (sphericalHarmonicsDegree >= 1) {\n ",e?o+="\n vec3 worldViewDir = normalize(splatCenter - vec3(inverse(transform) * vec4(cameraPosition, 1.0)));\n ":o+="\n vec3 worldViewDir = normalize(splatCenter - cameraPosition);\n ",o+="\n vec3 sh1;\n vec3 sh2;\n vec3 sh3;\n ",i>=2&&(o+="\n vec3 sh4;\n vec3 sh5;\n vec3 sh6;\n vec3 sh7;\n vec3 sh8;\n "),i===1?o+="\n if (sphericalHarmonicsMultiTextureMode == 0) {\n vec2 shUV = getDataUVF(nearestEvenIndex, 2.5, doubleOddOffset, sphericalHarmonicsTextureSize);\n vec4 sampledSH0123 = texture(sphericalHarmonicsTexture, shUV);\n shUV = getDataUVF(nearestEvenIndex, 2.5, doubleOddOffset + uint(1), sphericalHarmonicsTextureSize);\n vec4 sampledSH4567 = texture(sphericalHarmonicsTexture, shUV);\n shUV = getDataUVF(nearestEvenIndex, 2.5, doubleOddOffset + uint(2), sphericalHarmonicsTextureSize);\n vec4 sampledSH891011 = texture(sphericalHarmonicsTexture, shUV);\n sh1 = vec3(sampledSH0123.rgb) * (1.0 - fOddOffset) + vec3(sampledSH0123.ba, sampledSH4567.r) * fOddOffset;\n sh2 = vec3(sampledSH0123.a, sampledSH4567.rg) * (1.0 - fOddOffset) + vec3(sampledSH4567.gba) * fOddOffset;\n sh3 = vec3(sampledSH4567.ba, sampledSH891011.r) * (1.0 - fOddOffset) + vec3(sampledSH891011.rgb) * fOddOffset;\n } else {\n vec2 sampledSH01R = texture(sphericalHarmonicsTextureR, getDataUV(2, 0, sphericalHarmonicsTextureSize)).rg;\n vec2 sampledSH23R = texture(sphericalHarmonicsTextureR, getDataUV(2, 1, sphericalHarmonicsTextureSize)).rg;\n vec2 sampledSH01G = texture(sphericalHarmonicsTextureG, getDataUV(2, 0, sphericalHarmonicsTextureSize)).rg;\n vec2 sampledSH23G = texture(sphericalHarmonicsTextureG, getDataUV(2, 1, sphericalHarmonicsTextureSize)).rg;\n vec2 sampledSH01B = texture(sphericalHarmonicsTextureB, getDataUV(2, 0, sphericalHarmonicsTextureSize)).rg;\n vec2 sampledSH23B = texture(sphericalHarmonicsTextureB, getDataUV(2, 1, sphericalHarmonicsTextureSize)).rg;\n sh1 = vec3(sampledSH01R.rg, sampledSH23R.r);\n sh2 = vec3(sampledSH01G.rg, sampledSH23G.r);\n sh3 = vec3(sampledSH01B.rg, sampledSH23B.r);\n }\n ":i===2&&(o+="\n vec4 sampledSH0123;\n vec4 sampledSH4567;\n vec4 sampledSH891011;\n\n vec4 sampledSH0123R;\n vec4 sampledSH0123G;\n vec4 sampledSH0123B;\n\n if (sphericalHarmonicsMultiTextureMode == 0) {\n sampledSH0123 = texture(sphericalHarmonicsTexture, getDataUV(6, 0, sphericalHarmonicsTextureSize));\n sampledSH4567 = texture(sphericalHarmonicsTexture, getDataUV(6, 1, sphericalHarmonicsTextureSize));\n sampledSH891011 = texture(sphericalHarmonicsTexture, getDataUV(6, 2, sphericalHarmonicsTextureSize));\n sh1 = sampledSH0123.rgb;\n sh2 = vec3(sampledSH0123.a, sampledSH4567.rg);\n sh3 = vec3(sampledSH4567.ba, sampledSH891011.r);\n } else {\n sampledSH0123R = texture(sphericalHarmonicsTextureR, getDataUV(2, 0, sphericalHarmonicsTextureSize));\n sampledSH0123G = texture(sphericalHarmonicsTextureG, getDataUV(2, 0, sphericalHarmonicsTextureSize));\n sampledSH0123B = texture(sphericalHarmonicsTextureB, getDataUV(2, 0, sphericalHarmonicsTextureSize));\n sh1 = vec3(sampledSH0123R.rgb);\n sh2 = vec3(sampledSH0123G.rgb);\n sh3 = vec3(sampledSH0123B.rgb);\n }\n "),o+="\n if (sphericalHarmonics8BitMode == 1) {\n sh1 = sh1 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh2 = sh2 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh3 = sh3 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n }\n float x = worldViewDir.x;\n float y = worldViewDir.y;\n float z = worldViewDir.z;\n vColor.rgb += SH_C1 * (-sh1 * y + sh2 * z - sh3 * x);\n ",i>=2&&(o+="\n if (sphericalHarmonicsDegree >= 2) {\n float xx = x * x;\n float yy = y * y;\n float zz = z * z;\n float xy = x * y;\n float yz = y * z;\n float xz = x * z;\n ",i===2&&(o+="\n if (sphericalHarmonicsMultiTextureMode == 0) {\n vec4 sampledSH12131415 = texture(sphericalHarmonicsTexture, getDataUV(6, 3, sphericalHarmonicsTextureSize));\n vec4 sampledSH16171819 = texture(sphericalHarmonicsTexture, getDataUV(6, 4, sphericalHarmonicsTextureSize));\n vec4 sampledSH20212223 = texture(sphericalHarmonicsTexture, getDataUV(6, 5, sphericalHarmonicsTextureSize));\n sh4 = sampledSH891011.gba;\n sh5 = sampledSH12131415.rgb;\n sh6 = vec3(sampledSH12131415.a, sampledSH16171819.rg);\n sh7 = vec3(sampledSH16171819.ba, sampledSH20212223.r);\n sh8 = sampledSH20212223.gba;\n } else {\n vec4 sampledSH4567R = texture(sphericalHarmonicsTextureR, getDataUV(2, 1, sphericalHarmonicsTextureSize));\n vec4 sampledSH4567G = texture(sphericalHarmonicsTextureG, getDataUV(2, 1, sphericalHarmonicsTextureSize));\n vec4 sampledSH4567B = texture(sphericalHarmonicsTextureB, getDataUV(2, 1, sphericalHarmonicsTextureSize));\n sh4 = vec3(sampledSH0123R.a, sampledSH4567R.rg);\n sh5 = vec3(sampledSH4567R.ba, sampledSH0123G.a);\n sh6 = vec3(sampledSH4567G.rgb);\n sh7 = vec3(sampledSH4567G.a, sampledSH0123B.a, sampledSH4567B.r);\n sh8 = vec3(sampledSH4567B.gba);\n }\n "),o+="\n if (sphericalHarmonics8BitMode == 1) {\n sh4 = sh4 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh5 = sh5 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh6 = sh6 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh7 = sh7 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n sh8 = sh8 * sh8BitCompressionRangeForScene + vec8BitSHShift;\n }\n\n vColor.rgb +=\n (SH_C2[0] * xy) * sh4 +\n (SH_C2[1] * yz) * sh5 +\n (SH_C2[2] * (2.0 * zz - xx - yy)) * sh6 +\n (SH_C2[3] * xz) * sh7 +\n (SH_C2[4] * (xx - yy)) * sh8;\n }\n "),o+="\n\n vColor.rgb = clamp(vColor.rgb, vec3(0.), vec3(1.));\n\n }\n\n "),o}static getVertexShaderFadeIn(){return"\n if (fadeInComplete == 0) {\n float opacityAdjust = 1.0;\n float centerDist = length(splatCenter - sceneCenter);\n float renderTime = max(currentTime - firstRenderTime, 0.0);\n\n float fadeDistance = 0.75;\n float distanceLoadFadeInFactor = step(visibleRegionFadeStartRadius, centerDist);\n distanceLoadFadeInFactor = (1.0 - distanceLoadFadeInFactor) +\n (1.0 - clamp((centerDist - visibleRegionFadeStartRadius) / fadeDistance, 0.0, 1.0)) *\n distanceLoadFadeInFactor;\n opacityAdjust *= distanceLoadFadeInFactor;\n vColor.a *= opacityAdjust;\n }\n "}static getUniforms(e=!1,t=!1,i=0,r=1,s=!1){const o={sceneCenter:{type:"v3",value:new Y},fadeInComplete:{type:"i",value:0},orthographicMode:{type:"i",value:0},visibleRegionFadeStartRadius:{type:"f",value:0},visibleRegionRadius:{type:"f",value:0},bindMatrix:{type:"m4",value:new Xe},bindMatrixInverse:{type:"m4",value:new Xe},currentTime:{type:"f",value:0},firstRenderTime:{type:"f",value:0},centersColorsTexture:{type:"t",value:null},flameModelTexture:{type:"t",value:null},boneTexture:{type:"t",value:null},boneTexture0:{type:"t",value:null},boneWeightTexture:{type:"t",value:null},sphericalHarmonicsTexture:{type:"t",value:null},sphericalHarmonicsTextureR:{type:"t",value:null},sphericalHarmonicsTextureG:{type:"t",value:null},sphericalHarmonicsTextureB:{type:"t",value:null},sphericalHarmonics8BitCompressionRangeMin:{type:"f",value:[]},sphericalHarmonics8BitCompressionRangeMax:{type:"f",value:[]},focal:{type:"v2",value:new qe},orthoZoom:{type:"f",value:1},inverseFocalAdjustment:{type:"f",value:1},viewport:{type:"v2",value:new qe},basisViewport:{type:"v2",value:new qe},debugColor:{type:"v3",value:new gt},centersColorsTextureSize:{type:"v2",value:new qe(1024,1024)},flameModelTextureSize:{type:"v2",value:new qe(4096,2048)},boneTextureSize:{type:"v2",value:new qe(4,32)},boneWeightTextureSize:{type:"v2",value:new qe(512,512)},sphericalHarmonicsDegree:{type:"i",value:i},sphericalHarmonicsTextureSize:{type:"v2",value:new qe(1024,1024)},sphericalHarmonics8BitMode:{type:"i",value:0},sphericalHarmonicsMultiTextureMode:{type:"i",value:0},splatScale:{type:"f",value:r},pointCloudModeEnabled:{type:"i",value:s?1:0},sceneIndexesTexture:{type:"t",value:null},sceneIndexesTextureSize:{type:"v2",value:new qe(1024,1024)},sceneCount:{type:"i",value:1},gaussianSplatCount:{type:"i",value:1},bsCount:{type:"i",value:1},headBoneIndex:{type:"f",value:-1}};for(let a=0;a\n\n uniform vec3 debugColor;\n\n varying vec4 vColor;\n varying vec2 vUv;\n varying vec2 vPosition;\n varying mat3 vT;\n varying vec2 vQuadCenter;\n varying vec2 vFragCoord;\n\n void main () {\n\n const float FilterInvSquare = 2.0;\n const float near_n = 0.2;\n const float T = 1.0;\n\n vec2 xy = vQuadCenter;\n vec3 Tu = vT[0];\n vec3 Tv = vT[1];\n vec3 Tw = vT[2];\n vec3 k = vFragCoord.x * Tw - Tu;\n vec3 l = vFragCoord.y * Tw - Tv;\n vec3 p = cross(k, l);\n if (p.z == 0.0) discard;\n vec2 s = vec2(p.x / p.z, p.y / p.z);\n float rho3d = (s.x * s.x + s.y * s.y); \n vec2 d = vec2(xy.x - vFragCoord.x, xy.y - vFragCoord.y);\n float rho2d = FilterInvSquare * (d.x * d.x + d.y * d.y); \n\n // compute intersection and depth\n float rho = min(rho3d, rho2d);\n float depth = (rho3d <= rho2d) ? (s.x * Tw.x + s.y * Tw.y) + Tw.z : Tw.z; \n if (depth < near_n) discard;\n // vec4 nor_o = collected_normal_opacity[j];\n // float normal[3] = {nor_o.x, nor_o.y, nor_o.z};\n float opa = vColor.a;\n\n float power = -0.5f * rho;\n if (power > 0.0f) discard;\n\n // Eq. (2) from 3D Gaussian splatting paper.\n // Obtain alpha by multiplying with Gaussian opacity\n // and its exponential falloff from mean.\n // Avoid numerical instabilities (see paper appendix). \n float alpha = min(0.99f, opa * exp(power));\n if (alpha < 1.0f / 255.0f) discard;\n float test_T = T * (1.0 - alpha);\n if (test_T < 0.0001)discard;\n\n float w = alpha * T;\n gl_FragColor = vec4(vColor.rgb, w);\n }\n "}}class wk{static build(e){const t=new ki;t.setIndex([0,1,2,0,2,3]);const i=new Float32Array(4*3),r=new xi(i,3);t.setAttribute("position",r),r.setXYZ(0,-1,-1,0),r.setXYZ(1,-1,1,0),r.setXYZ(2,1,1,0),r.setXYZ(3,1,-1,0),r.needsUpdate=!0;const s=new FL().copy(t),o=new Uint32Array(e),a=new jo(o,1,!1);return a.setUsage(ba),s.setAttribute("splatIndex",a),s.instanceCount=0,s}}class Ck extends nn{constructor(e,t=new Y,i=new Qt,r=new Y(1,1,1),s=1,o=1,a=!0){super(),this.splatBuffer=e,this.position.copy(t),this.quaternion.copy(i),this.scale.copy(r),this.transform=new Xe,this.minimumAlpha=s,this.opacity=o,this.visible=a}copyTransformData(e){this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.transform.copy(e.transform)}updateTransform(e){e?(this.matrixWorldAutoUpdate&&this.updateWorldMatrix(!0,!1),this.transform.copy(this.matrixWorld)):(this.matrixAutoUpdate&&this.updateMatrix(),this.transform.copy(this.matrix))}}const km=class km{constructor(e,t,i,r){this.min=new Y().copy(e),this.max=new Y().copy(t),this.boundingBox=new rr(this.min,this.max),this.center=new Y().copy(this.max).sub(this.min).multiplyScalar(.5).add(this.min),this.depth=i,this.children=[],this.data=null,this.id=r||km.idGen++}};xe(km,"idGen",0);let Vy=km;class Vd{constructor(e,t){this.maxDepth=e,this.maxCentersPerNode=t,this.sceneDimensions=new Y,this.sceneMin=new Y,this.sceneMax=new Y,this.rootNode=null,this.nodesWithIndexes=[],this.splatMesh=null}static convertWorkerSubTreeNode(e){const t=new Y().fromArray(e.min),i=new Y().fromArray(e.max),r=new Vy(t,i,e.depth,e.id);if(e.data.indexes){r.data={indexes:[]};for(let s of e.data.indexes)r.data.indexes.push(s)}if(e.children)for(let s of e.children)r.children.push(Vd.convertWorkerSubTreeNode(s));return r}static convertWorkerSubTree(e,t){const i=new Vd(e.maxDepth,e.maxCentersPerNode);i.sceneMin=new Y().fromArray(e.sceneMin),i.sceneMax=new Y().fromArray(e.sceneMax),i.splatMesh=t,i.rootNode=Vd.convertWorkerSubTreeNode(e.rootNode);const r=(s,o)=>{s.children.length===0&&o(s);for(let a of s.children)r(a,o)};return i.nodesWithIndexes=[],r(i.rootNode,s=>{s.data&&s.data.indexes&&s.data.indexes.length>0&&i.nodesWithIndexes.push(s)}),i}}function Ek(n){let e=0;class t{constructor(l,c){this.min=[l[0],l[1],l[2]],this.max=[c[0],c[1],c[2]]}containsPoint(l){return l[0]>=this.min[0]&&l[0]<=this.max[0]&&l[1]>=this.min[1]&&l[1]<=this.max[1]&&l[2]>=this.min[2]&&l[2]<=this.max[2]}}class i{constructor(l,c){this.maxDepth=l,this.maxCentersPerNode=c,this.sceneDimensions=[],this.sceneMin=[],this.sceneMax=[],this.rootNode=null,this.addedIndexes={},this.nodesWithIndexes=[],this.splatMesh=null,this.disposed=!1}}class r{constructor(l,c,u,d){this.min=[l[0],l[1],l[2]],this.max=[c[0],c[1],c[2]],this.center=[(c[0]-l[0])*.5+l[0],(c[1]-l[1])*.5+l[1],(c[2]-l[2])*.5+l[2]],this.depth=u,this.children=[],this.data=null,this.id=d||e++}}processSplatTreeNode=function(a,l,c,u){const d=l.data.indexes.length;if(da.maxDepth){const v=[];for(let x=0;xx>_?1:-1),a.nodesWithIndexes.push(l);return}const h=[l.max[0]-l.min[0],l.max[1]-l.min[1],l.max[2]-l.min[2]],f=[h[0]*.5,h[1]*.5,h[2]*.5],p=[l.min[0]+f[0],l.min[1]+f[1],l.min[2]+f[2]],g=[new t([p[0]-f[0],p[1],p[2]-f[2]],[p[0],p[1]+f[1],p[2]]),new t([p[0],p[1],p[2]-f[2]],[p[0]+f[0],p[1]+f[1],p[2]]),new t([p[0],p[1],p[2]],[p[0]+f[0],p[1]+f[1],p[2]+f[2]]),new t([p[0]-f[0],p[1],p[2]],[p[0],p[1]+f[1],p[2]+f[2]]),new t([p[0]-f[0],p[1]-f[1],p[2]-f[2]],[p[0],p[1],p[2]]),new t([p[0],p[1]-f[1],p[2]-f[2]],[p[0]+f[0],p[1],p[2]]),new t([p[0],p[1]-f[1],p[2]],[p[0]+f[0],p[1],p[2]+f[2]]),new t([p[0]-f[0],p[1]-f[1],p[2]],[p[0],p[1],p[2]+f[2]])],y=[];for(let v=0;v{const u=[0,0,0],d=[0,0,0],h=[],f=Math.floor(a.length/4);for(let g=0;gd[0])&&(d[0]=m),(g===0||vd[1])&&(d[1]=v),(g===0||xd[2])&&(d[2]=x),h.push(_)}const p=new i(l,c);return p.sceneMin=u,p.sceneMax=d,p.rootNode=new r(p.sceneMin,p.sceneMax,0),p.rootNode.data={indexes:h},p};function o(a,l,c){const u=[];for(let h of a){const f=Math.floor(h.length/4);for(let p=0;p{a.data.process&&o(a.data.process.centers,a.data.process.maxDepth,a.data.process.maxCentersPerNode)}}function Mk(n,e,t,i,r){n.postMessage({process:{centers:e,maxDepth:i,maxCentersPerNode:r}},t)}function Rk(){return new Worker(URL.createObjectURL(new Blob(["(",Ek.toString(),")(self)"],{type:"application/javascript"})))}class Ik{constructor(e,t){xe(this,"processSplatMesh",(e,t=()=>!0,i,r)=>{this.splatTreeWorker||(this.splatTreeWorker=Rk()),this.splatMesh=e,this.subTrees=[];const s=new Y,o=(a,l)=>{const c=new Float32Array(l*4);let u=0;for(let d=0;d{const l=()=>this.disposed?(this.diposeSplatTreeWorker(),a(),!0):!1;i&&i(!1),ms(()=>{if(l())return;const c=[];if(e.dynamicMode){let u=0;for(let d=0;d{l()||u.data.subTrees&&(r&&r(!1),ms(()=>{if(!l()){for(let d of u.data.subTrees){const h=Vd.convertWorkerSubTree(d,e);this.subTrees.push(h)}this.diposeSplatTreeWorker(),r&&r(!0),ms(()=>{a()})}}))},ms(()=>{if(l())return;i&&i(!0);const u=c.map(d=>d.buffer);Mk(this.splatTreeWorker,c,u,this.maxDepth,this.maxCentersPerNode)})})})});this.maxDepth=e,this.maxCentersPerNode=t,this.subTrees=[],this.splatMesh=null}dispose(){this.diposeSplatTreeWorker(),this.disposed=!0}diposeSplatTreeWorker(){this.splatTreeWorker&&this.splatTreeWorker.terminate(),this.splatTreeWorker=null}countLeaves(){let e=0;return this.visitLeaves(()=>{e++}),e}visitLeaves(e){const t=(i,r)=>{i.children.length===0&&r(i);for(let s of i.children)t(s,r)};for(let i of this.subTrees)t(i.rootNode,e)}}function Nk(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 Pk(n,e,t){let i;function r(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const A=e.get("EXT_texture_filter_anisotropic");i=n.getParameter(A.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function s(A){if(A==="highp"){if(n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.HIGH_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,d=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),h=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_TEXTURE_SIZE),p=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),g=n.getParameter(n.MAX_VERTEX_ATTRIBS),y=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),m=n.getParameter(n.MAX_VARYING_VECTORS),v=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),x=h>0,_=o||e.has("OES_texture_float"),S=x&&_,E=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:d,maxVertexTextures:h,maxTextureSize:f,maxCubemapSize:p,maxAttributes:g,maxVertexUniforms:y,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:x,floatFragmentTextures:_,floatVertexTextures:S,maxSamples:E}}const Hd={Default:0,Instant:2},jc={None:0,Info:3},XA=new ki,Lk=new Yr,Xf=6,$g=4,Dk=4,Fk=4,Ok=6,Bk=8,Gg=4,cd=4,KA=1,kk=.012,Uk=.003,YA=1,ZA=16777216;class oi extends pn{constructor(t=Eo.ThreeD,i=!1,r=!1,s=!1,o=1,a=!0,l=!1,c=!1,u=1024,d=jc.None,h=0,f=1,p=.3){super(XA,Lk);xe(this,"buildSplatTree",(t=[],i,r)=>new Promise(s=>{this.disposeSplatTree(),this.baseSplatTree=new Ik(8,1e3);const o=performance.now(),a=new Mt;this.baseSplatTree.processSplatMesh(this,l=>{this.getSplatColor(l,a);const c=this.getSceneIndexForSplat(l),u=t[c]||1;return a.w>=u},i,r).then(()=>{const l=performance.now()-o;if(this.logLevel>=jc.Info&&console.log("SplatTree build: "+l+" ms"),this.disposed)s();else{this.splatTree=this.baseSplatTree,this.baseSplatTree=null;let c=0,u=0,d=0;this.splatTree.visitLeaves(h=>{const f=h.data.indexes.length;f>0&&(u+=f,d++,c++)}),this.logLevel>=jc.Info&&(console.log("SplatTree leaves: ".concat(this.splatTree.countLeaves())),console.log("SplatTree leaves with splats:".concat(c)),u=u/d,console.log("Avg splat count per node: ".concat(u)),console.log("Total splat count: ".concat(this.getSplatCount()))),s()}})}));xe(this,"updateUniforms",function(){const t=new qe;return function(i,r,s,o,a,l){if(this.getSplatCount()>0){if(t.set(i.x*this.devicePixelRatio,i.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(t),this.material.uniforms.basisViewport.value.set(1/t.x,1/t.y),this.material.uniforms.focal.value.set(r,s),this.material.uniforms.orthographicMode.value=o?1:0,this.material.uniforms.orthoZoom.value=a,this.material.uniforms.inverseFocalAdjustment.value=l,this.dynamicMode)for(let u=0;u{const i=this.getMaxSplatCount();if(!this.renderer)return;const r=this.lastRenderer!==this.renderer,s=t!==i;if(!r&&!s)return;r?this.disposeDistancesComputationGPUResources():s&&this.disposeDistancesComputationGPUBufferResources();const o=this.renderer.getContext(),a=(f,p,g)=>{const y=f.createShader(p);if(!y)return console.error("Fatal error: gl could not create a shader object."),null;if(f.shaderSource(y,g),f.compileShader(y),!f.getShaderParameter(y,f.COMPILE_STATUS)){let v="unknown";p===f.VERTEX_SHADER?v="vertex shader":p===f.FRAGMENT_SHADER&&(v="fragement shader");const x=f.getShaderInfoLog(y);return console.error("Failed to compile "+v+" with these errors:"+x),f.deleteShader(y),null}return y};let l;this.integerBasedDistancesComputation?(l="#version 300 es\n in ivec4 center;\n flat out int distance;",this.dynamicMode?l+="\n in uint sceneIndex;\n uniform ivec4 transforms[".concat(Ft.MaxScenes,"];\n void main(void) {\n ivec4 transform = transforms[sceneIndex];\n distance = center.x * transform.x + center.y * transform.y + center.z * transform.z + transform.w * center.w;\n }\n "):l+="\n uniform ivec3 modelViewProj;\n void main(void) {\n distance = center.x * modelViewProj.x + center.y * modelViewProj.y + center.z * modelViewProj.z;\n }\n "):(l="#version 300 es\n in vec4 center;\n flat out float distance;",this.dynamicMode?l+="\n in uint sceneIndex;\n uniform mat4 transforms[".concat(Ft.MaxScenes,"];\n void main(void) {\n vec4 transformedCenter = transforms[sceneIndex] * vec4(center.xyz, 1.0);\n distance = transformedCenter.z;\n }\n "):l+="\n uniform vec3 modelViewProj;\n void main(void) {\n distance = center.x * modelViewProj.x + center.y * modelViewProj.y + center.z * modelViewProj.z;\n }\n ");const c="#version 300 es\n precision lowp float;\n out vec4 fragColor;\n void main(){}\n ",u=o.getParameter(o.VERTEX_ARRAY_BINDING),d=o.getParameter(o.CURRENT_PROGRAM),h=d?o.getProgramParameter(d,o.DELETE_STATUS):!1;if(r&&(this.distancesTransformFeedback.vao=o.createVertexArray()),o.bindVertexArray(this.distancesTransformFeedback.vao),r){const f=o.createProgram(),p=a(o,o.VERTEX_SHADER,l),g=a(o,o.FRAGMENT_SHADER,c);if(!p||!g)throw new Error("Could not compile shaders for distances computation on GPU.");if(o.attachShader(f,p),o.attachShader(f,g),o.transformFeedbackVaryings(f,["distance"],o.SEPARATE_ATTRIBS),o.linkProgram(f),!o.getProgramParameter(f,o.LINK_STATUS)){const m=o.getProgramInfoLog(f);throw console.error("Fatal error: Failed to link program: "+m),o.deleteProgram(f),o.deleteShader(g),o.deleteShader(p),new Error("Could not link shaders for distances computation on GPU.")}this.distancesTransformFeedback.program=f,this.distancesTransformFeedback.vertexShader=p,this.distancesTransformFeedback.vertexShader=g}if(o.useProgram(this.distancesTransformFeedback.program),this.distancesTransformFeedback.centersLoc=o.getAttribLocation(this.distancesTransformFeedback.program,"center"),this.dynamicMode){this.distancesTransformFeedback.sceneIndexesLoc=o.getAttribLocation(this.distancesTransformFeedback.program,"sceneIndex");for(let f=0;f{if(!this.renderer)return;const s=this.renderer.getContext(),o=s.getParameter(s.VERTEX_ARRAY_BINDING),a=s.getParameter(s.CURRENT_PROGRAM),l=a?s.getProgramParameter(a,s.DELETE_STATUS):!1;if(s.bindVertexArray(this.distancesTransformFeedback.vao),s.useProgram(this.distancesTransformFeedback.program),s.enable(s.RASTERIZER_DISCARD),this.dynamicMode)for(let d=0;d{const h=()=>{if(this.disposed)d();else switch(s.clientWaitSync(c,0,0)){case s.TIMEOUT_EXPIRED:return this.computeDistancesOnGPUSyncTimeout=setTimeout(h),this.computeDistancesOnGPUSyncTimeout;case s.WAIT_FAILED:throw new Error("should never get here");default:this.computeDistancesOnGPUSyncTimeout=null,s.deleteSync(c);const y=s.getParameter(s.VERTEX_ARRAY_BINDING);s.bindVertexArray(this.distancesTransformFeedback.vao),s.bindBuffer(s.ARRAY_BUFFER,this.distancesTransformFeedback.outDistancesBuffer),s.getBufferSubData(s.ARRAY_BUFFER,0,r),s.bindBuffer(s.ARRAY_BUFFER,null),y&&s.bindVertexArray(y),d()}};this.computeDistancesOnGPUSyncTimeout=setTimeout(h)});return a&&l!==!0&&s.useProgram(a),o&&s.bindVertexArray(o),u}}());xe(this,"morphedMesh");xe(this,"getSplatCenter",function(){const t={};return function(i,r,s,o){this.getLocalSplatParameters(r,t,o),t.splatBuffer.getSplatCenter(i,t.localIndex,s,t.sceneTransform)}}());xe(this,"getSplatScaleAndRotation",function(){const t={},i=new Y;return function(r,s,o,a){this.getLocalSplatParameters(r,t,a),i.x=void 0,i.y=void 0,i.z=void 0,this.splatRenderMode===Eo.TwoD&&(i.z=0),t.splatBuffer.getSplatScaleAndRotation(t.localIndex,s,o,t.sceneTransform,i)}}());xe(this,"getSplatColor",function(){const t={};return function(i,r){this.getLocalSplatParameters(i,t),t.splatBuffer.getSplatColor(t.localIndex,r)}}());this.renderer=void 0,this.splatRenderMode=t,this.dynamicMode=i,this.enableOptionalEffects=r,this.halfPrecisionCovariancesOnGPU=s,this.devicePixelRatio=o,this.enableDistancesComputationOnGPU=a,this.integerBasedDistancesComputation=l,this.antialiased=c,this.kernel2DSize=p,this.maxScreenSpaceSplatSize=u,this.logLevel=d,this.sphericalHarmonicsDegree=h,this.minSphericalHarmonicsDegree=0,this.sceneFadeInRateMultiplier=f,this.scenes=[],this.splatTree=null,this.baseSplatTree=null,this.splatDataTextures={},this.flameModel=null,this.expressionBSNum=0,this.bsWeight=[],this.bonesMatrix=null,this.bonesNum=null,this.bonesWeight=null,this.gaussianSplatCount=null,this.useFlameModel=!0,this.morphTargetDictionary=null,this.distancesTransformFeedback={id:null,vertexShader:null,fragmentShader:null,program:null,centersBuffer:null,sceneIndexesBuffer:null,outDistancesBuffer:null,centersLoc:-1,modelViewProjLoc:-1,sceneIndexesLoc:-1,transformsLocs:[]},this.globalSplatIndexToLocalSplatIndexMap=[],this.globalSplatIndexToSceneIndexMap=[],this.lastBuildSplatCount=0,this.lastBuildScenes=[],this.lastBuildMaxSplatCount=0,this.lastBuildSceneCount=0,this.firstRenderTime=-1,this.finalBuild=!1,this.webGLUtils=null,this.boundingBox=new rr,this.calculatedSceneCenter=new Y,this.maxSplatDistanceFromSceneCenter=0,this.visibleRegionBufferRadius=0,this.visibleRegionRadius=0,this.visibleRegionFadeStartRadius=0,this.visibleRegionChanging=!1,this.splatScale=1,this.pointCloudModeEnabled=!1,this.disposed=!1,this.lastRenderer=null,this.visible=!1}static buildScenes(t,i,r){const s=[];s.length=i.length;for(let o=0;o0,g}freeIntermediateSplatData(){const t=i=>{delete i.source.data,delete i.image,i.onUpdate=null};delete this.splatDataTextures.baseData.covariances,delete this.splatDataTextures.baseData.centers,delete this.splatDataTextures.baseData.colors,delete this.splatDataTextures.baseData.sphericalHarmonics,delete this.splatDataTextures.centerColors.data,delete this.splatDataTextures.covariances.data,this.splatDataTextures.sphericalHarmonics&&delete this.splatDataTextures.sphericalHarmonics.data,this.splatDataTextures.sceneIndexes&&delete this.splatDataTextures.sceneIndexes.data,this.splatDataTextures.centerColors.texture.needsUpdate=!0,this.splatDataTextures.centerColors.texture.onUpdate=()=>{t(this.splatDataTextures.centerColors.texture)},this.splatDataTextures.flameModelPosTexture.texture.needsUpdate=!0,this.splatDataTextures.flameModelPosTexture.texture.onUpdate=()=>{t(this.splatDataTextures.flameModelPosTexture.texture)},this.splatDataTextures.covariances.texture.needsUpdate=!0,this.splatDataTextures.covariances.texture.onUpdate=()=>{t(this.splatDataTextures.covariances.texture)},this.splatDataTextures.sphericalHarmonics&&(this.splatDataTextures.sphericalHarmonics.texture?(this.splatDataTextures.sphericalHarmonics.texture.needsUpdate=!0,this.splatDataTextures.sphericalHarmonics.texture.onUpdate=()=>{t(this.splatDataTextures.sphericalHarmonics.texture)}):this.splatDataTextures.sphericalHarmonics.textures.forEach(i=>{i.needsUpdate=!0,i.onUpdate=()=>{t(i)}})),this.splatDataTextures.sceneIndexes&&(this.splatDataTextures.sceneIndexes.texture.needsUpdate=!0,this.splatDataTextures.sceneIndexes.texture.onUpdate=()=>{t(this.splatDataTextures.sceneIndexes.texture)})}dispose(){this.disposeMeshData(),this.disposeTextures(),this.disposeSplatTree(),this.enableDistancesComputationOnGPU&&(this.computeDistancesOnGPUSyncTimeout&&(clearTimeout(this.computeDistancesOnGPUSyncTimeout),this.computeDistancesOnGPUSyncTimeout=null),this.disposeDistancesComputationGPUResources()),this.scenes=[],this.distancesTransformFeedback={id:null,vertexShader:null,fragmentShader:null,program:null,centersBuffer:null,sceneIndexesBuffer:null,outDistancesBuffer:null,centersLoc:-1,modelViewProjLoc:-1,sceneIndexesLoc:-1,transformsLocs:[]},this.renderer=null,this.globalSplatIndexToLocalSplatIndexMap=[],this.globalSplatIndexToSceneIndexMap=[],this.lastBuildSplatCount=0,this.lastBuildScenes=[],this.lastBuildMaxSplatCount=0,this.lastBuildSceneCount=0,this.firstRenderTime=-1,this.finalBuild=!1,this.webGLUtils=null,this.boundingBox=new rr,this.calculatedSceneCenter=new Y,this.maxSplatDistanceFromSceneCenter=0,this.visibleRegionBufferRadius=0,this.visibleRegionRadius=0,this.visibleRegionFadeStartRadius=0,this.visibleRegionChanging=!1,this.splatScale=1,this.pointCloudModeEnabled=!1,this.disposed=!0,this.lastRenderer=null,this.visible=!1}disposeMeshData(){this.geometry&&this.geometry!==XA&&(this.geometry.dispose(),this.geometry=null),this.material&&(this.material.dispose(),this.material=null)}disposeTextures(){for(let t in this.splatDataTextures)if(this.splatDataTextures.hasOwnProperty(t)){const i=this.splatDataTextures[t];i.texture&&(i.texture.dispose(),i.texture=null)}this.splatDataTextures=null}disposeSplatTree(){this.splatTree&&(this.splatTree.dispose(),this.splatTree=null),this.baseSplatTree&&(this.baseSplatTree.dispose(),this.baseSplatTree=null)}getSplatTree(){return this.splatTree}onSplatTreeReady(t){this.onSplatTreeReadyCallback=t}getDataForDistancesComputation(t,i){const r=this.integerBasedDistancesComputation?this.getIntegerCenters(t,i,!0):this.getFloatCenters(t,i,!0),s=this.getSceneIndexes(t,i);return{centers:r,sceneIndexes:s}}refreshGPUDataFromSplatBuffers(t){const i=this.getSplatCount(!0);this.refreshDataTexturesFromSplatBuffers(t);const r=t?this.lastBuildSplatCount:0,{centers:s,sceneIndexes:o}=this.getDataForDistancesComputation(r,i-1);return this.enableDistancesComputationOnGPU&&this.refreshGPUBuffersForDistancesComputation(s,o,t),{from:r,to:i-1,count:i-r,centers:s,sceneIndexes:o}}refreshGPUBuffersForDistancesComputation(t,i,r=!1){const s=r?this.lastBuildSplatCount:0;this.updateGPUCentersBufferForDistancesComputation(r,t,s),this.updateGPUTransformIndexesBufferForDistancesComputation(r,i,s)}refreshDataTexturesFromSplatBuffers(t){const i=this.getSplatCount(!0),r=this.lastBuildSplatCount,s=i-1;t?this.updateBaseDataFromSplatBuffers(r,s):(this.setupDataTextures(),this.updateBaseDataFromSplatBuffers()),this.updateDataTexturesFromBaseData(r,s),this.updateVisibleRegion(t)}setupDataTextures(){const t=this.getMaxSplatCount(),i=this.getSplatCount(!0);this.disposeTextures();const r=(R,w)=>{const M=new qe(4096,1024);for(;M.x*M.y*RR>=1?Ok:Dk,o=R=>{const w=s(R),M=r(w,6);return{elementsPerTexelStored:w,texSize:M}};let a=this.getTargetCovarianceCompressionLevel();const l=0,c=this.getTargetSphericalHarmonicsCompressionLevel();let u,d,h;if(this.splatRenderMode===Eo.ThreeD){const R=o(a);R.texSize.x*R.texSize.y>ZA&&a===0&&(a=1),u=new Float32Array(t*Xf)}else d=new Float32Array(t*3),h=new Float32Array(t*4);const f=new Float32Array(t*3),p=new Uint8Array(t*4);let g=Float32Array;c===1?g=Uint16Array:c===2&&(g=Uint8Array);const y=Gc(this.minSphericalHarmonicsDegree),m=this.minSphericalHarmonicsDegree?new g(t*y):void 0,v=r(cd,4),x=new Uint32Array(v.x*v.y*cd);oi.updateCenterColorsPaddedData(0,i-1,f,p,x);const _=new vr(x,v.x,v.y,wo,Ni);if(_.internalFormat="RGBA32UI",_.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=_,this.material.uniforms.centersColorsTextureSize.value.copy(v),this.material.uniformsNeedUpdate=!0,this.splatDataTextures={baseData:{covariances:u,scales:d,rotations:h,centers:f,colors:p,sphericalHarmonics:m},centerColors:{data:x,texture:_,size:v}},this.splatRenderMode===Eo.ThreeD){const R=o(a),w=R.elementsPerTexelStored,M=R.texSize;let I=a>=1?Uint32Array:Float32Array;const L=a>=1?Bk:Fk,k=new I(M.x*M.y*L);a===0?k.set(u):oi.updatePaddedCompressedCovariancesTextureData(u,k,0,0,u.length);let T;if(a>=1)T=new vr(k,M.x,M.y,wo,Ni),T.internalFormat="RGBA32UI",this.material.uniforms.covariancesTextureHalfFloat.value=T;else{T=new vr(k,M.x,M.y,Di,ir),this.material.uniforms.covariancesTexture.value=T;const F=new vr(new Uint32Array(32),2,2,wo,Ni);F.internalFormat="RGBA32UI",this.material.uniforms.covariancesTextureHalfFloat.value=F,F.needsUpdate=!0}T.needsUpdate=!0,this.material.uniforms.covariancesAreHalfFloat.value=a>=1?1:0,this.material.uniforms.covariancesTextureSize.value.copy(M),this.splatDataTextures.covariances={data:k,texture:T,size:M,compressionLevel:a,elementsPerTexelStored:w,elementsPerTexelAllocated:L}}else{const w=r(Gg,6);let M=Float32Array,I=ir;const L=new M(w.x*w.y*Gg);oi.updateScaleRotationsPaddedData(0,i-1,d,h,L);const k=new vr(L,w.x,w.y,Di,I);k.needsUpdate=!0,this.material.uniforms.scaleRotationsTexture.value=k,this.material.uniforms.scaleRotationsTextureSize.value.copy(w),this.splatDataTextures.scaleRotations={data:L,texture:k,size:w,compressionLevel:l}}if(m){const R=c===2?Js:Ts;let w=y;w%2!==0&&w++;const M=this.minSphericalHarmonicsDegree===2?4:2,I=M===4?Di:oh;let L=r(M,w);if(L.x*L.y<=ZA){const k=L.x*L.y*M,T=new g(k);for(let V=0;V=3){for(let le=0;le<3;le++)se[be+le]=m[re+ee*3+le];if(k>=8)for(let le=0;le<5;le++)se[be+3+le]=m[re+9+ee*5+le]}}const he=new vr(se,L.x,L.y,I,R);Q.push(he),he.needsUpdate=!0,F[ee].value=he}this.material.uniforms.sphericalHarmonicsMultiTextureMode.value=1,this.splatDataTextures.sphericalHarmonics={componentCount:y,componentCountPerChannel:k,paddedComponentCount:w,data:V,textureCount:3,textures:Q,size:L,compressionLevel:c,elementsPerTexel:M}}this.material.uniforms.sphericalHarmonicsTextureSize.value.copy(L),this.material.uniforms.sphericalHarmonics8BitMode.value=c===2?1:0;for(let k=0;k{R.name=="head"&&(this.material.uniforms.headBoneIndex.value=w)}),this.buildModelTexture(this.flameModel),this.buildBoneMatrixTexture(),this.useFlameModel&&this.buildBoneWeightTexture(this.flameModel)}buildBoneMatrixTexture(){if(!this.bsWeight)return;const t=new qe(4,32);let i=new Float32Array(this.bonesMatrix),r=new Uint32Array(t.x*t.y*4);if(this.morphTargetDictionary=this.flameModel.morphTargetDictionary,this.useFlameModel){for(let o=0;o{const p=t.morphTargetDictionary[h];var g=t.geometry.morphAttributes.position[p];s=s.concat(Array.from(g.array))}),s=s.concat(Array.from(r));let c=new Float32Array(i.x*i.y*4),u=new Uint32Array(i.x*i.y*4);for(let h=0;h{const V=this.renderer?this.renderer.properties.get(I):null;!V||!V.__webglTexture?I.needsUpdate=!0:this.updateDataTexture(T,I,L,V,k,F,A,t,i)},w=l.componentCount,M=l.paddedComponentCount;if(l.textureCount===1){const I=l.data;for(let L=t;L<=i;L++){const k=w*L,T=M*L;for(let F=0;F=3){for(let Q=0;Q<3;Q++)k[V+Q]=v[F+L*3+Q];if(I>=8)for(let Q=0;Q<5;Q++)k[V+3+Q]=v[F+9+L*5+Q]}}R(l.textures[L],l.size,l.elementsPerTexel,k,M)}}}const x=this.splatDataTextures.sceneIndexes,_=x.data;for(let A=this.lastBuildSplatCount;A<=i;A++)_[A]=this.globalSplatIndexToSceneIndexMap[A];const S=x.texture,E=this.renderer?this.renderer.properties.get(S):null;!E||!E.__webglTexture?S.needsUpdate=!0:this.updateDataTexture(_,x.texture,x.size,E,1,1,1,this.lastBuildSplatCount,i)}getTargetCovarianceCompressionLevel(){return this.halfPrecisionCovariancesOnGPU?1:0}getTargetSphericalHarmonicsCompressionLevel(){return Math.max(1,this.getMaximumSplatBufferCompressionLevel())}getMaximumSplatBufferCompressionLevel(){let t;for(let i=0;it)&&(t=s.compressionLevel)}return t}getMinimumSplatBufferCompressionLevel(){let t;for(let i=0;i=3&&(l+=2,c=0)}static updateCenterColorsPaddedData(t,i,r,s,o){for(let a=t;a<=i;a++){const l=a*4,c=a*3,u=a*4;o[u]=SN(s,l),o[u+1]=Vi(r[c]),o[u+2]=Vi(r[c+1]),o[u+3]=Vi(r[c+2])}}static updateScaleRotationsPaddedData(t,i,r,s,o){for(let l=t;l<=i;l++){const c=l*3,u=l*4,d=l*6;o[d]=r[c],o[d+1]=r[c+1],o[d+2]=r[c+2],o[d+3]=s[u],o[d+4]=s[u+1],o[d+5]=s[u+2]}}updateVisibleRegion(t){const i=this.getSplatCount(!0),r=new Y;if(!t){const o=new Y;this.scenes.forEach(a=>{o.add(a.splatBuffer.sceneCenter)}),o.multiplyScalar(1/this.scenes.length),this.calculatedSceneCenter.copy(o),this.material.uniforms.sceneCenter.value.copy(this.calculatedSceneCenter),this.material.uniformsNeedUpdate=!0}const s=t?this.lastBuildSplatCount:0;for(let o=s;othis.maxSplatDistanceFromSceneCenter&&(this.maxSplatDistanceFromSceneCenter=a)}this.maxSplatDistanceFromSceneCenter-this.visibleRegionBufferRadius>YA&&(this.visibleRegionBufferRadius=this.maxSplatDistanceFromSceneCenter,this.visibleRegionRadius=Math.max(this.visibleRegionBufferRadius-YA,0)),this.finalBuild&&(this.visibleRegionRadius=this.visibleRegionBufferRadius=this.maxSplatDistanceFromSceneCenter),this.updateVisibleRegionFadeDistance()}updateVisibleRegionFadeDistance(t=Hd.Default){const i=kk*this.sceneFadeInRateMultiplier,r=Uk*this.sceneFadeInRateMultiplier,s=this.finalBuild?i:r,o=t===Hd.Default?s:r;this.visibleRegionFadeStartRadius=(this.visibleRegionRadius-this.visibleRegionFadeStartRadius)*o+this.visibleRegionFadeStartRadius;const l=(this.visibleRegionBufferRadius>0?this.visibleRegionFadeStartRadius/this.visibleRegionBufferRadius:0)>.99,c=l||t===Hd.Instant?1:0;this.material.uniforms.visibleRegionFadeStartRadius.value=this.visibleRegionFadeStartRadius,this.material.uniforms.visibleRegionRadius.value=this.visibleRegionRadius,this.material.uniforms.firstRenderTime.value=this.firstRenderTime,this.material.uniforms.currentTime.value=performance.now(),this.material.uniforms.fadeInComplete.value=c,this.material.uniformsNeedUpdate=!0,this.visibleRegionChanging=!l}updateRenderIndexes(t,i){const r=this.geometry;r.attributes.splatIndex.set(t),r.attributes.splatIndex.needsUpdate=!0,i>0&&this.firstRenderTime===-1&&(this.firstRenderTime=performance.now()),r.instanceCount=i,r.setDrawRange(0,i)}updateTransforms(){for(let t=0;t0){this.setupDistancesComputationTransformFeedback();const{centers:o,sceneIndexes:a}=this.getDataForDistancesComputation(0,this.getSplatCount()-1);this.refreshGPUBuffersForDistancesComputation(o,a)}}}updateGPUCentersBufferForDistancesComputation(t,i,r){if(!this.renderer)return;const s=this.renderer.getContext(),o=s.getParameter(s.VERTEX_ARRAY_BINDING);s.bindVertexArray(this.distancesTransformFeedback.vao);const a=this.integerBasedDistancesComputation?Uint32Array:Float32Array,l=16,c=r*l;if(s.bindBuffer(s.ARRAY_BUFFER,this.distancesTransformFeedback.centersBuffer),t)s.bufferSubData(s.ARRAY_BUFFER,c,i);else{const u=new a(this.getMaxSplatCount()*l);u.set(i),s.bufferData(s.ARRAY_BUFFER,u,s.STATIC_DRAW)}s.bindBuffer(s.ARRAY_BUFFER,null),o&&s.bindVertexArray(o)}updateGPUTransformIndexesBufferForDistancesComputation(t,i,r){if(!this.renderer||!this.dynamicMode)return;const s=this.renderer.getContext(),o=s.getParameter(s.VERTEX_ARRAY_BINDING);s.bindVertexArray(this.distancesTransformFeedback.vao);const a=r*4;if(s.bindBuffer(s.ARRAY_BUFFER,this.distancesTransformFeedback.sceneIndexesBuffer),t)s.bufferSubData(s.ARRAY_BUFFER,a,i);else{const l=new Uint32Array(this.getMaxSplatCount()*4);l.set(i),s.bufferData(s.ARRAY_BUFFER,l,s.STATIC_DRAW)}s.bindBuffer(s.ARRAY_BUFFER,null),o&&s.bindVertexArray(o)}getSceneIndexes(t,i){let r;const s=i-t+1;r=new Uint32Array(s);for(let o=t;o<=i;o++)r[o]=this.globalSplatIndexToSceneIndexMap[o];return r}getLocalSplatParameters(t,i,r){r==null&&(r=!this.dynamicMode),i.splatBuffer=this.getSplatBufferForSplat(t),i.localIndex=this.getSplatLocalIndex(t),i.sceneTransform=r?this.getSceneTransformForSplat(t):null}fillSplatDataArrays(t,i,r,s,o,a,l,c,u=0,d=0,h=1,f,p,g=0,y){const m=new Y;m.x=void 0,m.y=void 0,this.splatRenderMode===Eo.ThreeD?m.z=void 0:m.z=1;const v=new Xe;let x=0,_=this.scenes.length-1;y!=null&&y>=0&&y<=this.scenes.length&&(x=y,_=y);for(let S=x;S<=_;S++){c==null&&(c=!this.dynamicMode);const E=this.getScene(S),A=E.splatBuffer;let R;if(c&&(this.getSceneTransform(S,v),R=v),t&&A.fillSplatCovarianceArray(t,R,f,p,g,u),i||r){if(!i||!r)throw new Error('SplatMesh::fillSplatDataArrays() -> "scales" and "rotations" must both be valid.');A.fillSplatScaleRotationArray(i,r,R,f,p,g,d,m)}s&&A.fillSplatCenterArray(this.morphedMesh,s,R,f,p,g),o&&A.fillSplatColorArray(o,E.minimumAlpha,f,p,g),a&&A.fillSphericalHarmonicsArray(a,this.minSphericalHarmonicsDegree,R,f,p,g,h),g+=A.getSplatCount()}}getIntegerCenters(t,i,r=!1){const s=i-t+1,o=new Float32Array(s*3);this.fillSplatDataArrays(null,null,null,o,null,null,void 0,void 0,void 0,void 0,t);let a,l=r?4:3;a=new Int32Array(s*l);for(let c=0;c=this.scenes.length)throw new Error("SplatMesh::getScene() -> Invalid scene index.");return this.scenes[t]}getSceneCount(){return this.scenes.length}getSplatBufferForSplat(t){return this.getScene(this.globalSplatIndexToSceneIndexMap[t]).splatBuffer}getSceneIndexForSplat(t){return this.globalSplatIndexToSceneIndexMap[t]}getSceneTransformForSplat(t){return this.getScene(this.globalSplatIndexToSceneIndexMap[t]).transform}getSplatLocalIndex(t){return this.globalSplatIndexToLocalSplatIndexMap[t]}static getIntegerMatrixArray(t){const i=t.elements,r=[];for(let s=0;s<16;s++)r[s]=Math.round(i[s]*1e3);return r}computeBoundingBox(t=!1,i){let r=this.getSplatCount();if(i!=null){if(i<0||i>=this.scenes.length)throw new Error("SplatMesh::computeBoundingBox() -> Invalid scene index.");r=this.scenes[i].splatBuffer.getSplatCount()}const s=new Float32Array(r*3);this.fillSplatDataArrays(null,null,null,s,null,null,t,void 0,void 0,void 0,void 0,i);const o=new Y,a=new Y;for(let l=0;la.x)&&(a.x=u),(l===0||d>a.y)&&(a.y=d),(l===0||h>a.z)&&(a.z=h)}return new rr(o,a)}}var zk="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEbA2AAAGAQf39/f39/f39/f39/f39/fwBgAAF/AhIBA2VudgZtZW1vcnkCAwCAgAQDBAMAAQIHVAQRX193YXNtX2NhbGxfY3RvcnMAABhfX3dhc21fYXBwbHlfZGF0YV9yZWxvY3MAAAtzb3J0SW5kZXhlcwABE2Vtc2NyaXB0ZW5fdGxzX2luaXQAAgqWEAMDAAELihAEAXwDewN/A30gCyAKayEMAkACQCAOBEAgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQMgDCEBA0AgAyABQQJ0IgVqIAIgACAFaigCAEECdGooAgAiBTYCACAFIAogBSAKSBshCiAFIA0gBSANShshDSABQQFqIgEgC0cNAAsMAwsgDwRAIAsgDE0NAkF/IQ9B+P///wchCkGIgICAeCENIAwhAgNAIA8gByAAIAJBAnQiFWooAgAiFkECdGooAgAiFEcEQAJ/IAX9CQI4IAggFEEGdGoiDv0JAgwgDioCHP0gASAOKgIs/SACIA4qAjz9IAP95gEgBf0JAiggDv0JAgggDioCGP0gASAOKgIo/SACIA4qAjj9IAP95gEgBf0JAgggDv0JAgAgDioCEP0gASAOKgIg/SACIA4qAjD9IAP95gEgBf0JAhggDv0JAgQgDioCFP0gASAOKgIk/SACIA4qAjT9IAP95gH95AH95AH95AEiEf1f/QwAAAAAAECPQAAAAAAAQI9AIhL98gEiE/0hASIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshDgJ/IBP9IQAiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgL/REgDv0cAQJ/IBEgEf0NCAkKCwwNDg8AAAAAAAAAAP1fIBL98gEiEf0hACIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAv9HAICfyAR/SEBIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4C/0cAyESIBQhDwsgAyAVaiABIBZBBHRq/QAAACAS/bUBIhH9GwAgEf0bAWogEf0bAmogEf0bA2oiDjYCACAOIAogCiAOShshCiAOIA0gDSAOSBshDSACQQFqIgIgC0cNAAsMAwsCfyAFKgIIu/0UIAUqAhi7/SIB/QwAAAAAAECPQAAAAAAAQI9A/fIBIhH9IQEiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIQ4CfyAR/SEAIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyECAn8gBSoCKLtEAAAAAABAj0CiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEFQfj///8HIQpBiICAgHghDSALIAxNDQIgAv0RIA79HAEgBf0cAiESIAwhBQNAIAMgBUECdCICaiABIAAgAmooAgBBBHRq/QAAACAS/bUBIhH9GwAgEf0bAWogEf0bAmoiAjYCACACIAogAiAKSBshCiACIA0gAiANShshDSAFQQFqIgUgC0cNAAsMAgsgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQIgDCEBA0AgAyABQQJ0IgVqAn8gAiAAIAVqKAIAQQJ0aioCALtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyIONgIAIAogDiAKIA5IGyEKIA0gDiANIA5KGyENIAFBAWoiASALRw0ACwwCCyAPRQRAIAsgDE0NASAFKgIoIRcgBSoCGCEYIAUqAgghGUH4////ByEKQYiAgIB4IQ0gDCEFA0ACfyAXIAEgACAFQQJ0IgdqKAIAQQR0aiICKgIIlCAZIAIqAgCUIBggAioCBJSSkrtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEOIAMgB2ogDjYCACAKIA4gCiAOSBshCiANIA4gDSAOShshDSAFQQFqIgUgC0cNAAsMAgsgCyAMTQ0AQX8hD0H4////ByEKQYiAgIB4IQ0gDCECA0AgDyAHIAAgAkECdCIUaigCAEECdCIVaigCACIORwRAIAX9CQI4IAggDkEGdGoiD/0JAgwgDyoCHP0gASAPKgIs/SACIA8qAjz9IAP95gEgBf0JAiggD/0JAgggDyoCGP0gASAPKgIo/SACIA8qAjj9IAP95gEgBf0JAgggD/0JAgAgDyoCEP0gASAPKgIg/SACIA8qAjD9IAP95gEgBf0JAhggD/0JAgQgDyoCFP0gASAPKgIk/SACIA8qAjT9IAP95gH95AH95AH95AEhESAOIQ8LIAMgFGoCfyAR/R8DIAEgFUECdCIOQQxyaioCAJQgEf0fAiABIA5BCHJqKgIAlCAR/R8AIAEgDmoqAgCUIBH9HwEgASAOQQRyaioCAJSSkpK7RAAAAAAAALBAoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAsiDjYCACAKIA4gCiAOSBshCiANIA4gDSAOShshDSACQQFqIgIgC0cNAAsMAQtBiICAgHghDUH4////ByEKCyALIAxLBEAgCUEBa7MgDbIgCrKTlSEXIAwhDQNAAn8gFyADIA1BAnRqIgEoAgAgCmuylCIYi0MAAABPXQRAIBioDAELQYCAgIB4CyEOIAEgDjYCACAEIA5BAnRqIgEgASgCAEEBajYCACANQQFqIg0gC0cNAAsLIAlBAk8EQCAEKAIAIQ1BASEKA0AgBCAKQQJ0aiIBIAEoAgAgDWoiDTYCACAKQQFqIgogCUcNAAsLIAxBAEoEQCAMIQoDQCAGIApBAWsiAUECdCICaiAAIAJqKAIANgIAIApBAUshAiABIQogAg0ACwsgCyAMSgRAIAshCgNAIAYgCyAEIAMgCkEBayIKQQJ0IgFqKAIAQQJ0aiICKAIAIgVrQQJ0aiAAIAFqKAIANgIAIAIgBUEBazYCACAKIAxKDQALCwsEAEEACw==",JA="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEXAmAAAGAQf39/f39/f39/f39/f39/fwACEgEDZW52Bm1lbW9yeQIDAICABAMDAgABBz4DEV9fd2FzbV9jYWxsX2N0b3JzAAAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAALc29ydEluZGV4ZXMAAQqiDwICAAucDwMBfAd9Bn8gCyAKayEMAkACQCAOBEAgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQMgDCEFA0AgAyAFQQJ0IgFqIAIgACABaigCAEECdGooAgAiATYCACABIAogASAKSBshCiABIA0gASANShshDSAFQQFqIgUgC0cNAAsMAwsgDwRAIAsgDE0NAkF/IQ9B+P///wchCkGIgICAeCENIAwhAgNAIA8gByAAIAJBAnQiGmooAgBBAnQiG2ooAgAiDkcEQAJ/IAUqAjgiESAIIA5BBnRqIg8qAjyUIAUqAigiEiAPKgI4lCAFKgIIIhMgDyoCMJQgBSoCGCIUIA8qAjSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRgCfyARIA8qAiyUIBIgDyoCKJQgEyAPKgIglCAUIA8qAiSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRkCfyARIA8qAhyUIBIgDyoCGJQgEyAPKgIQlCAUIA8qAhSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRwCfyARIA8qAgyUIBIgDyoCCJQgEyAPKgIAlCAUIA8qAgSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIR0gDiEPCyADIBpqIAEgG0ECdGoiDigCBCAcbCAOKAIAIB1saiAOKAIIIBlsaiAOKAIMIBhsaiIONgIAIA4gCiAKIA5KGyEKIA4gDSANIA5IGyENIAJBAWoiAiALRw0ACwwDCwJ/IAUqAii7RAAAAAAAQI9AoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshAgJ/IAUqAhi7RAAAAAAAQI9AoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshByALIAxNAn8gBSoCCLtEAAAAAABAj0CiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEPQfj///8HIQpBiICAgHghDQ0CIAwhBQNAIAMgBUECdCIIaiABIAAgCGooAgBBBHRqIggoAgQgB2wgCCgCACAPbGogCCgCCCACbGoiCDYCACAIIAogCCAKSBshCiAIIA0gCCANShshDSAFQQFqIgUgC0cNAAsMAgsgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQIgDCEFA0AgAyAFQQJ0IgFqAn8gAiAAIAFqKAIAQQJ0aioCALtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyIONgIAIAogDiAKIA5IGyEKIA0gDiANIA5KGyENIAVBAWoiBSALRw0ACwwCCyAPRQRAIAsgDE0NASAFKgIoIREgBSoCGCESIAUqAgghE0H4////ByEKQYiAgIB4IQ0gDCEFA0ACfyARIAEgACAFQQJ0IgdqKAIAQQR0aiICKgIIlCATIAIqAgCUIBIgAioCBJSSkrtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEOIAMgB2ogDjYCACAKIA4gCiAOSBshCiANIA4gDSAOShshDSAFQQFqIgUgC0cNAAsMAgsgCyAMTQ0AQX8hD0H4////ByEKQYiAgIB4IQ0gDCECA0AgDyAHIAAgAkECdCIYaigCAEECdCIZaigCACIORwRAIAUqAjgiESAIIA5BBnRqIg8qAjyUIAUqAigiEiAPKgI4lCAFKgIIIhMgDyoCMJQgBSoCGCIUIA8qAjSUkpKSIRUgESAPKgIslCASIA8qAiiUIBMgDyoCIJQgFCAPKgIklJKSkiEWIBEgDyoCHJQgEiAPKgIYlCATIA8qAhCUIBQgDyoCFJSSkpIhFyARIA8qAgyUIBIgDyoCCJQgEyAPKgIAlCAUIA8qAgSUkpKSIREgDiEPCyADIBhqAn8gFSABIBlBAnRqIg4qAgyUIBYgDioCCJQgESAOKgIAlCAXIA4qAgSUkpKSu0QAAAAAAACwQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIg42AgAgCiAOIAogDkgbIQogDSAOIA0gDkobIQ0gAkEBaiICIAtHDQALDAELQYiAgIB4IQ1B+P///wchCgsgCyAMSwRAIAlBAWuzIA2yIAqyk5UhESAMIQ0DQAJ/IBEgAyANQQJ0aiIBKAIAIAprspQiEotDAAAAT10EQCASqAwBC0GAgICAeAshDiABIA42AgAgBCAOQQJ0aiIBIAEoAgBBAWo2AgAgDUEBaiINIAtHDQALCyAJQQJPBEAgBCgCACENQQEhCgNAIAQgCkECdGoiASABKAIAIA1qIg02AgAgCkEBaiIKIAlHDQALCyAMQQBKBEAgDCEKA0AgBiAKQQFrIgFBAnQiAmogACACaigCADYCACAKQQFLIAEhCg0ACwsgCyAMSgRAIAshCgNAIAYgCyAEIAMgCkEBayIKQQJ0IgFqKAIAQQJ0aiICKAIAIgVrQQJ0aiAAIAFqKAIANgIAIAIgBUEBazYCACAKIAxKDQALCws=",Vk="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEXAmAAAGAQf39/f39/f39/f39/f39/fwACDwEDZW52Bm1lbW9yeQIAAAMDAgABBz4DEV9fd2FzbV9jYWxsX2N0b3JzAAAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAALc29ydEluZGV4ZXMAAQrrDwICAAvlDwQBfAN7B30DfyALIAprIQwCQAJAIA4EQCANBEBB+P///wchCkGIgICAeCENIAsgDE0NAyAMIQUDQCADIAVBAnQiAWogAiAAIAFqKAIAQQJ0aigCACIBNgIAIAEgCiABIApIGyEKIAEgDSABIA1KGyENIAVBAWoiBSALRw0ACwwDCyAPBEAgCyAMTQ0CQX8hD0H4////ByEKQYiAgIB4IQ0gDCECA0AgDyAHIAAgAkECdCIcaigCACIdQQJ0aigCACIbRwRAAn8gBf0JAjggCCAbQQZ0aiIO/QkCDCAOKgIc/SABIA4qAiz9IAIgDioCPP0gA/3mASAF/QkCKCAO/QkCCCAOKgIY/SABIA4qAij9IAIgDioCOP0gA/3mASAF/QkCCCAO/QkCACAOKgIQ/SABIA4qAiD9IAIgDioCMP0gA/3mASAF/QkCGCAO/QkCBCAOKgIU/SABIA4qAiT9IAIgDioCNP0gA/3mAf3kAf3kAf3kASIR/V/9DAAAAAAAQI9AAAAAAABAj0AiEv3yASIT/SEBIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEOAn8gE/0hACIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAv9ESAO/RwBAn8gESAR/Q0ICQoLDA0ODwABAgMAAQID/V8gEv3yASIR/SEAIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4C/0cAgJ/IBH9IQEiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgL/RwDIRIgGyEPCyADIBxqIAEgHUEEdGr9AAAAIBL9tQEiEf0bACAR/RsBaiAR/RsCaiAR/RsDaiIONgIAIA4gCiAKIA5KGyEKIA4gDSANIA5IGyENIAJBAWoiAiALRw0ACwwDCwJ/IAUqAgi7/RQgBSoCGLv9IgH9DAAAAAAAQI9AAAAAAABAj0D98gEiEf0hASIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshDgJ/IBH9IQAiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLAn8gBSoCKLtEAAAAAABAj0CiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEFQfj///8HIQpBiICAgHghDSALIAxNDQL9ESAO/RwBIAX9HAIhEiAMIQUDQCADIAVBAnQiAmogASAAIAJqKAIAQQR0av0AAAAgEv21ASIR/RsAIBH9GwFqIBH9GwJqIgI2AgAgAiAKIAIgCkgbIQogAiANIAIgDUobIQ0gBUEBaiIFIAtHDQALDAILIA0EQEH4////ByEKQYiAgIB4IQ0gCyAMTQ0CIAwhBQNAIAMgBUECdCIBagJ/IAIgACABaigCAEECdGoqAgC7RAAAAAAAALBAoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAsiDjYCACAKIA4gCiAOSBshCiANIA4gDSAOShshDSAFQQFqIgUgC0cNAAsMAgsgD0UEQCALIAxNDQEgBSoCKCEUIAUqAhghFSAFKgIIIRZB+P///wchCkGIgICAeCENIAwhBQNAAn8gFCABIAAgBUECdCIHaigCAEEEdGoiAioCCJQgFiACKgIAlCAVIAIqAgSUkpK7RAAAAAAAALBAoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshDiADIAdqIA42AgAgCiAOIAogDkgbIQogDSAOIA0gDkobIQ0gBUEBaiIFIAtHDQALDAILIAsgDE0NAEF/IQ9B+P///wchCkGIgICAeCENIAwhAgNAIA8gByAAIAJBAnQiG2ooAgBBAnQiHGooAgAiDkcEQCAFKgI4IhQgCCAOQQZ0aiIPKgI8lCAFKgIoIhUgDyoCOJQgBSoCCCIWIA8qAjCUIAUqAhgiFyAPKgI0lJKSkiEYIBQgDyoCLJQgFSAPKgIolCAWIA8qAiCUIBcgDyoCJJSSkpIhGSAUIA8qAhyUIBUgDyoCGJQgFiAPKgIQlCAXIA8qAhSUkpKSIRogFCAPKgIMlCAVIA8qAgiUIBYgDyoCAJQgFyAPKgIElJKSkiEUIA4hDwsgAyAbagJ/IBggASAcQQJ0aiIOKgIMlCAZIA4qAgiUIBQgDioCAJQgGiAOKgIElJKSkrtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyIONgIAIAogDiAKIA5IGyEKIA0gDiANIA5KGyENIAJBAWoiAiALRw0ACwwBC0GIgICAeCENQfj///8HIQoLIAsgDEsEQCAJQQFrsyANsiAKspOVIRQgDCENA0ACfyAUIAMgDUECdGoiASgCACAKa7KUIhWLQwAAAE9dBEAgFagMAQtBgICAgHgLIQ4gASAONgIAIAQgDkECdGoiASABKAIAQQFqNgIAIA1BAWoiDSALRw0ACwsgCUECTwRAIAQoAgAhDUEBIQoDQCAEIApBAnRqIgEgASgCACANaiINNgIAIApBAWoiCiAJRw0ACwsgDEEASgRAIAwhCgNAIAYgCkEBayIBQQJ0IgJqIAAgAmooAgA2AgAgCkEBSyABIQoNAAsLIAsgDEoEQCALIQoDQCAGIAsgBCADIApBAWsiCkECdCIBaigCAEECdGoiAigCACIFa0ECdGogACABaigCADYCACACIAVBAWs2AgAgCiAMSg0ACwsL",Hk="AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEXAmAAAGAQf39/f39/f39/f39/f39/fwACDwEDZW52Bm1lbW9yeQIAAAMDAgABBz4DEV9fd2FzbV9jYWxsX2N0b3JzAAAYX193YXNtX2FwcGx5X2RhdGFfcmVsb2NzAAALc29ydEluZGV4ZXMAAQqiDwICAAucDwMBfAd9Bn8gCyAKayEMAkACQCAOBEAgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQMgDCEFA0AgAyAFQQJ0IgFqIAIgACABaigCAEECdGooAgAiATYCACABIAogASAKSBshCiABIA0gASANShshDSAFQQFqIgUgC0cNAAsMAwsgDwRAIAsgDE0NAkF/IQ9B+P///wchCkGIgICAeCENIAwhAgNAIA8gByAAIAJBAnQiGmooAgBBAnQiG2ooAgAiDkcEQAJ/IAUqAjgiESAIIA5BBnRqIg8qAjyUIAUqAigiEiAPKgI4lCAFKgIIIhMgDyoCMJQgBSoCGCIUIA8qAjSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRgCfyARIA8qAiyUIBIgDyoCKJQgEyAPKgIglCAUIA8qAiSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRkCfyARIA8qAhyUIBIgDyoCGJQgEyAPKgIQlCAUIA8qAhSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIRwCfyARIA8qAgyUIBIgDyoCCJQgEyAPKgIAlCAUIA8qAgSUkpKSu0QAAAAAAECPQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIR0gDiEPCyADIBpqIAEgG0ECdGoiDigCBCAcbCAOKAIAIB1saiAOKAIIIBlsaiAOKAIMIBhsaiIONgIAIA4gCiAKIA5KGyEKIA4gDSANIA5IGyENIAJBAWoiAiALRw0ACwwDCwJ/IAUqAii7RAAAAAAAQI9AoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshAgJ/IAUqAhi7RAAAAAAAQI9AoiIQmUQAAAAAAADgQWMEQCAQqgwBC0GAgICAeAshByALIAxNAn8gBSoCCLtEAAAAAABAj0CiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEPQfj///8HIQpBiICAgHghDQ0CIAwhBQNAIAMgBUECdCIIaiABIAAgCGooAgBBBHRqIggoAgQgB2wgCCgCACAPbGogCCgCCCACbGoiCDYCACAIIAogCCAKSBshCiAIIA0gCCANShshDSAFQQFqIgUgC0cNAAsMAgsgDQRAQfj///8HIQpBiICAgHghDSALIAxNDQIgDCEFA0AgAyAFQQJ0IgFqAn8gAiAAIAFqKAIAQQJ0aioCALtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyIONgIAIAogDiAKIA5IGyEKIA0gDiANIA5KGyENIAVBAWoiBSALRw0ACwwCCyAPRQRAIAsgDE0NASAFKgIoIREgBSoCGCESIAUqAgghE0H4////ByEKQYiAgIB4IQ0gDCEFA0ACfyARIAEgACAFQQJ0IgdqKAIAQQR0aiICKgIIlCATIAIqAgCUIBIgAioCBJSSkrtEAAAAAAAAsECiIhCZRAAAAAAAAOBBYwRAIBCqDAELQYCAgIB4CyEOIAMgB2ogDjYCACAKIA4gCiAOSBshCiANIA4gDSAOShshDSAFQQFqIgUgC0cNAAsMAgsgCyAMTQ0AQX8hD0H4////ByEKQYiAgIB4IQ0gDCECA0AgDyAHIAAgAkECdCIYaigCAEECdCIZaigCACIORwRAIAUqAjgiESAIIA5BBnRqIg8qAjyUIAUqAigiEiAPKgI4lCAFKgIIIhMgDyoCMJQgBSoCGCIUIA8qAjSUkpKSIRUgESAPKgIslCASIA8qAiiUIBMgDyoCIJQgFCAPKgIklJKSkiEWIBEgDyoCHJQgEiAPKgIYlCATIA8qAhCUIBQgDyoCFJSSkpIhFyARIA8qAgyUIBIgDyoCCJQgEyAPKgIAlCAUIA8qAgSUkpKSIREgDiEPCyADIBhqAn8gFSABIBlBAnRqIg4qAgyUIBYgDioCCJQgESAOKgIAlCAXIA4qAgSUkpKSu0QAAAAAAACwQKIiEJlEAAAAAAAA4EFjBEAgEKoMAQtBgICAgHgLIg42AgAgCiAOIAogDkgbIQogDSAOIA0gDkobIQ0gAkEBaiICIAtHDQALDAELQYiAgIB4IQ1B+P///wchCgsgCyAMSwRAIAlBAWuzIA2yIAqyk5UhESAMIQ0DQAJ/IBEgAyANQQJ0aiIBKAIAIAprspQiEotDAAAAT10EQCASqAwBC0GAgICAeAshDiABIA42AgAgBCAOQQJ0aiIBIAEoAgBBAWo2AgAgDUEBaiINIAtHDQALCyAJQQJPBEAgBCgCACENQQEhCgNAIAQgCkECdGoiASABKAIAIA1qIg02AgAgCkEBaiIKIAlHDQALCyAMQQBKBEAgDCEKA0AgBiAKQQFrIgFBAnQiAmogACACaigCADYCACAKQQFLIAEhCg0ACwsgCyAMSgRAIAshCgNAIAYgCyAEIAMgCkEBayIKQQJ0IgFqKAIAQQJ0aiICKAIAIgVrQQJ0aiAAIAFqKAIANgIAIAIgBUEBazYCACAKIAxKDQALCws=";function $k(n){let e,t,i,r,s,o,a,l,c,u,d,h,f,p,g,y,m,v,x,_;function S(E,A,R,w,M,I,L){const k=performance.now();if(!i&&(new Uint32Array(t,a,M.byteLength/_.BytesPerInt).set(M),new Float32Array(t,u,L.byteLength/_.BytesPerFloat).set(L),w)){let ee;r?ee=new Int32Array(t,d,I.byteLength/_.BytesPerInt):ee=new Float32Array(t,d,I.byteLength/_.BytesPerFloat),ee.set(I)}y||(y=new Uint32Array(v)),new Float32Array(t,g,16).set(R),new Uint32Array(t,f,v).set(y),e.exports.sortIndexes(a,p,d,h,f,g,l,c,u,v,E,A,o,w,r,s);const T={sortDone:!0,splatSortCount:E,splatRenderCount:A,sortTime:0};if(!i){const V=new Uint32Array(t,l,A);(!m||m.length{if(E.data.centers)centers=E.data.centers,sceneIndexes=E.data.sceneIndexes,r?new Int32Array(t,p+E.data.range.from*_.BytesPerInt*4,E.data.range.count*4).set(new Int32Array(centers)):new Float32Array(t,p+E.data.range.from*_.BytesPerFloat*4,E.data.range.count*4).set(new Float32Array(centers)),s&&new Uint32Array(t,c+E.data.range.from*4,E.data.range.count).set(new Uint32Array(sceneIndexes)),x=E.data.range.from+E.data.range.count;else if(E.data.sort){const A=Math.min(E.data.sort.splatRenderCount||0,x),R=Math.min(E.data.sort.splatSortCount||0,x),w=E.data.sort.usePrecomputedDistances;let M,I,L;i||(M=E.data.sort.indexesToSort,L=E.data.sort.transforms,w&&(I=E.data.sort.precomputedDistances)),S(R,A,E.data.sort.modelViewProj,w,M,I,L)}else if(E.data.init){_=E.data.init.Constants,o=E.data.init.splatCount,i=E.data.init.useSharedMemory,r=E.data.init.integerBasedSort,s=E.data.init.dynamicMode,v=E.data.init.distanceMapRange,x=0;const A=r?_.BytesPerInt*4:_.BytesPerFloat*4,R=new Uint8Array(E.data.init.sorterWasmBytes),w=16*_.BytesPerFloat,M=o*_.BytesPerInt,I=o*A,L=w,k=r?o*_.BytesPerInt:o*_.BytesPerFloat,T=o*_.BytesPerInt,F=o*_.BytesPerInt,V=r?v*_.BytesPerInt*2:v*_.BytesPerFloat*2,Q=s?o*_.BytesPerInt:0,ee=s?_.MaxScenes*w:0,se=_.MemoryPageSize*32,he=M+I+L+k+T+V+F+Q+ee+se,ie=Math.floor(he/_.MemoryPageSize)+1,re={module:{},env:{memory:new WebAssembly.Memory({initial:ie,maximum:ie,shared:!0})}};WebAssembly.compile(R).then(be=>WebAssembly.instantiate(be,re)).then(be=>{e=be,a=0,p=a+M,g=p+I,d=g+L,h=d+k,f=h+T,l=f+V,c=l+F,u=c+Q,t=re.env.memory.buffer,i?n.postMessage({sortSetupPhase1Complete:!0,indexesToSortBuffer:t,indexesToSortOffset:a,sortedIndexesBuffer:t,sortedIndexesOffset:l,precomputedDistancesBuffer:t,precomputedDistancesOffset:d,transformsBuffer:t,transformsOffset:u}):n.postMessage({sortSetupPhase1Complete:!0})})}}}function Gk(n,e,t,i,r,s=Ft.DefaultSplatSortDistanceMapPrecision){const o=new Worker(URL.createObjectURL(new Blob(["(",$k.toString(),")(self)"],{type:"application/javascript"})));let a=zk;const l=u_()?l5():null;!t&&!e?(a=JA,l&&l.major<=16&&l.minor<4&&(a=Hk)):t?e||l&&l.major<=16&&l.minor<4&&(a=Vk):a=JA;const c=atob(a),u=new Uint8Array(c.length);for(let d=0;d{console.warn(f)}))},navigator.xr.offerSession!==void 0&&navigator.xr.offerSession("immersive-vr",h).then(u).catch(f=>{console.warn(f)})}function s(){i.style.display="",i.style.cursor="auto",i.style.left="calc(50% - 75px)",i.style.width="150px",i.onmouseenter=null,i.onmouseleave=null,i.onclick=null}function o(){s(),i.textContent="VR NOT SUPPORTED"}function a(c){s(),console.warn("Exception when trying to call xr.isSessionSupported",c),i.textContent="VR NOT ALLOWED"}function l(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return i.id="VRButton",i.style.display="none",l(i),navigator.xr.isSessionSupported("immersive-vr").then(function(c){c?r():o(),c&&vu.xrSessionIsGranted&&i.click()}).catch(a),i;{const c=document.createElement("a");return window.isSecureContext===!1?(c.href=document.location.href.replace(/^http:/,"https:"),c.innerHTML="WEBXR NEEDS HTTPS"):(c.href="https://immersiveweb.dev/",c.innerHTML="WEBXR NOT AVAILABLE"),c.style.left="calc(50% - 90px)",c.style.width="180px",c.style.textDecoration="none",l(c),c}}static registerSessionGrantedListener(){if(typeof navigator<"u"&&"xr"in navigator){if(/WebXRViewer\//i.test(navigator.userAgent))return;navigator.xr.addEventListener("sessiongranted",()=>{vu.xrSessionIsGranted=!0})}}}vu.xrSessionIsGranted=!1;vu.registerSessionGrantedListener();class Wk{static createButton(e,t={}){const i=document.createElement("button");function r(){if(t.domOverlay===void 0){const h=document.createElement("div");h.style.display="none",document.body.appendChild(h);const f=document.createElementNS("http://www.w3.org/2000/svg","svg");f.setAttribute("width",38),f.setAttribute("height",38),f.style.position="absolute",f.style.right="20px",f.style.top="20px",f.addEventListener("click",function(){c.end()}),h.appendChild(f);const p=document.createElementNS("http://www.w3.org/2000/svg","path");p.setAttribute("d","M 12,12 L 28,28 M 28,12 12,28"),p.setAttribute("stroke","#fff"),p.setAttribute("stroke-width",2),f.appendChild(p),t.optionalFeatures===void 0&&(t.optionalFeatures=[]),t.optionalFeatures.push("dom-overlay"),t.domOverlay={root:h}}let c=null;async function u(h){h.addEventListener("end",d),e.xr.setReferenceSpaceType("local"),await e.xr.setSession(h),i.textContent="STOP AR",t.domOverlay.root.style.display="",c=h}function d(){c.removeEventListener("end",d),i.textContent="START AR",t.domOverlay.root.style.display="none",c=null}i.style.display="",i.style.cursor="pointer",i.style.left="calc(50% - 50px)",i.style.width="100px",i.textContent="START AR",i.onmouseenter=function(){i.style.opacity="1.0"},i.onmouseleave=function(){i.style.opacity="0.5"},i.onclick=function(){c===null?navigator.xr.requestSession("immersive-ar",t).then(u):(c.end(),navigator.xr.offerSession!==void 0&&navigator.xr.offerSession("immersive-ar",t).then(u).catch(h=>{console.warn(h)}))},navigator.xr.offerSession!==void 0&&navigator.xr.offerSession("immersive-ar",t).then(u).catch(h=>{console.warn(h)})}function s(){i.style.display="",i.style.cursor="auto",i.style.left="calc(50% - 75px)",i.style.width="150px",i.onmouseenter=null,i.onmouseleave=null,i.onclick=null}function o(){s(),i.textContent="AR NOT SUPPORTED"}function a(c){s(),console.warn("Exception when trying to call xr.isSessionSupported",c),i.textContent="AR NOT ALLOWED"}function l(c){c.style.position="absolute",c.style.bottom="20px",c.style.padding="12px 6px",c.style.border="1px solid #fff",c.style.borderRadius="4px",c.style.background="rgba(0,0,0,0.1)",c.style.color="#fff",c.style.font="normal 13px sans-serif",c.style.textAlign="center",c.style.opacity="0.5",c.style.outline="none",c.style.zIndex="999"}if("xr"in navigator)return i.id="ARButton",i.style.display="none",l(i),navigator.xr.isSessionSupported("immersive-ar").then(function(c){c?r():o()}).catch(a),i;{const c=document.createElement("a");return window.isSecureContext===!1?(c.href=document.location.href.replace(/^http:/,"https:"),c.innerHTML="WEBXR NEEDS HTTPS"):(c.href="https://immersiveweb.dev/",c.innerHTML="WEBXR NOT AVAILABLE"),c.style.left="calc(50% - 90px)",c.style.width="180px",c.style.textDecoration="none",l(c),c}}}const Wg={Always:0,Never:2};/** * @license * Copyright 2010-2025 Three.js Authors * SPDX-License-Identifier: MIT */const Qk=["alphaMap","alphaTest","anisotropy","anisotropyMap","anisotropyRotation","aoMap","attenuationColor","attenuationDistance","bumpMap","clearcoat","clearcoatMap","clearcoatNormalMap","clearcoatNormalScale","clearcoatRoughness","color","dispersion","displacementMap","emissive","emissiveMap","envMap","gradientMap","ior","iridescence","iridescenceIOR","iridescenceMap","iridescenceThicknessMap","lightMap","map","matcap","metalness","metalnessMap","normalMap","normalScale","opacity","roughness","roughnessMap","sheen","sheenColor","sheenColorMap","sheenRoughnessMap","shininess","specular","specularColor","specularColorMap","specularIntensity","specularIntensityMap","specularMap","thickness","transmission","transmissionMap"];class jk{constructor(e){this.renderObjects=new WeakMap,this.hasNode=this.containsNode(e),this.hasAnimation=e.object.isSkinnedMesh===!0,this.refreshUniforms=Qk,this.renderId=0}firstInitialization(e){return this.renderObjects.has(e)===!1?(this.getRenderObjectData(e),!0):!1}getRenderObjectData(e){let t=this.renderObjects.get(e);if(t===void 0){const{geometry:i,material:r,object:s}=e;if(t={material:this.getMaterialData(r),geometry:{id:i.id,attributes:this.getAttributesData(i.attributes),indexVersion:i.index?i.index.version:null,drawRange:{start:i.drawRange.start,count:i.drawRange.count}},worldMatrix:s.matrixWorld.clone()},s.center&&(t.center=s.center.clone()),s.morphTargetInfluences&&(t.morphTargetInfluences=s.morphTargetInfluences.slice()),e.bundle!==null&&(t.version=e.bundle.version),t.material.transmission>0){const{width:o,height:a}=e.context;t.bufferWidth=o,t.bufferHeight=a}this.renderObjects.set(e,t)}return t}getAttributesData(e){const t={};for(const i in e){const r=e[i];t[i]={version:r.version}}return t}containsNode(e){const t=e.material;for(const i in t)if(t[i]&&t[i].isNode)return!0;return e.renderer.nodes.modelViewMatrix!==null||e.renderer.nodes.modelNormalViewMatrix!==null}getMaterialData(e){const t={};for(const i of this.refreshUniforms){const r=e[i];r!=null&&(typeof r=="object"&&r.clone!==void 0?r.isTexture===!0?t[i]={id:r.id,version:r.version}:t[i]=r.clone():t[i]=r)}return t}equals(e){const{object:t,material:i,geometry:r}=e,s=this.getRenderObjectData(e);if(s.worldMatrix.equals(t.matrixWorld)!==!0)return s.worldMatrix.copy(t.matrixWorld),!1;const o=s.material;for(const g in o){const y=o[g],m=i[g];if(y.equals!==void 0){if(y.equals(m)===!1)return y.copy(m),!1}else if(m.isTexture===!0){if(y.id!==m.id||y.version!==m.version)return y.id=m.id,y.version=m.version,!1}else if(y!==m)return o[g]=m,!1}if(o.transmission>0){const{width:g,height:y}=e.context;if(s.bufferWidth!==g||s.bufferHeight!==y)return s.bufferWidth=g,s.bufferHeight=y,!1}const a=s.geometry,l=r.attributes,c=a.attributes,u=Object.keys(c),d=Object.keys(l);if(a.id!==r.id)return a.id=r.id,!1;if(u.length!==d.length)return s.geometry.attributes=this.getAttributesData(l),!1;for(const g of u){const y=c[g],m=l[g];if(m===void 0)return delete c[g],!1;if(y.version!==m.version)return y.version=m.version,!1}const h=r.index,f=a.indexVersion,p=h?h.version:null;if(f!==p)return a.indexVersion=p,!1;if(a.drawRange.start!==r.drawRange.start||a.drawRange.count!==r.drawRange.count)return a.drawRange.start=r.drawRange.start,a.drawRange.count=r.drawRange.count,!1;if(s.morphTargetInfluences){let g=!1;for(let y=0;y>>16,2246822507),t^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(t^t>>>13,3266489909),4294967296*(2097151&i)+(t>>>0)}const qk=n=>fh(n),eC=n=>fh(n),tC=(...n)=>fh(n);function nC(n,e=!1){const t=[];n.isNode===!0&&(t.push(n.id),n=n.getSelf());for(const{property:i,childNode:r}of ym(n))t.push(fh(i.slice(0,-4)),r.getCacheKey(e));return fh(t)}function*ym(n,e=!1){for(const t in n){if(t.startsWith("_")===!0)continue;const i=n[t];if(Array.isArray(i)===!0)for(let r=0;re.charCodeAt(0)).buffer}const Hy={VERTEX:"vertex",FRAGMENT:"fragment"},Wt={NONE:"none",FRAME:"frame",RENDER:"render",OBJECT:"object"},Yk={BOOLEAN:"bool",INTEGER:"int",FLOAT:"float",VECTOR2:"vec2",VECTOR3:"vec3",VECTOR4:"vec4",MATRIX2:"mat2",MATRIX3:"mat3",MATRIX4:"mat4"},Gs={READ_ONLY:"readOnly",WRITE_ONLY:"writeOnly",READ_WRITE:"readWrite"},aC=["fragment","vertex"],Zk=["setup","analyze","generate"],Jk=[...aC,"compute"],ku=["x","y","z","w"];let eU=0;class ut extends ro{static get type(){return"Node"}constructor(e=null){super(),this.nodeType=e,this.updateType=Wt.NONE,this.updateBeforeType=Wt.NONE,this.updateAfterType=Wt.NONE,this.uuid=Ta.generateUUID(),this.version=0,this.global=!1,this.isNode=!0,this._cacheKey=null,this._cacheKeyVersion=0,Object.defineProperty(this,"id",{value:eU++})}set needsUpdate(e){e===!0&&this.version++}get type(){return this.constructor.type}onUpdate(e,t){return this.updateType=t,this.update=e.bind(this.getSelf()),this}onFrameUpdate(e){return this.onUpdate(e,Wt.FRAME)}onRenderUpdate(e){return this.onUpdate(e,Wt.RENDER)}onObjectUpdate(e){return this.onUpdate(e,Wt.OBJECT)}onReference(e){return this.updateReference=e.bind(this.getSelf()),this}getSelf(){return this.self||this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(const{childNode:e}of ym(this))yield e}dispose(){this.dispatchEvent({type:"dispose"})}traverse(e){e(this);for(const t of this.getChildren())t.traverse(e)}getCacheKey(e=!1){return e=e||this.version!==this._cacheKeyVersion,(e===!0||this._cacheKey===null)&&(this._cacheKey=tC(nC(this,e),this.customCacheKey()),this._cacheKeyVersion=this.version),this._cacheKey}customCacheKey(){return 0}getScope(){return this}getHash(){return this.uuid}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(e){const t=this.getNodeType(e);return e.getElementType(t)}getMemberType(){return"void"}getNodeType(e){const t=e.getNodeProperties(this);return t.outputNode?t.outputNode.getNodeType(e):this.nodeType}getShared(e){const t=this.getHash(e);return e.getNodeFromHash(t)||this}setup(e){const t=e.getNodeProperties(this);let i=0;for(const r of this.getChildren())t["node"+i++]=r;return t.outputNode||null}analyze(e){if(e.increaseUsage(this)===1){const i=e.getNodeProperties(this);for(const r of Object.values(i))r&&r.isNode===!0&&r.build(e)}}generate(e,t){const{outputNode:i}=e.getNodeProperties(this);if(i&&i.isNode===!0)return i.build(e,t)}updateBefore(){console.warn("Abstract function.")}updateAfter(){console.warn("Abstract function.")}update(){console.warn("Abstract function.")}build(e,t=null){const i=this.getShared(e);if(this!==i)return i.build(e,t);e.addNode(this),e.addChain(this);let r=null;const s=e.getBuildStage();if(s==="setup"){this.updateReference(e);const o=e.getNodeProperties(this);if(o.initialized!==!0){o.initialized=!0;const a=this.setup(e),l=a&&a.isNode===!0;for(const c of Object.values(o))c&&c.isNode===!0&&c.build(e);l&&a.build(e),o.outputNode=a}}else if(s==="analyze")this.analyze(e);else if(s==="generate")if(this.generate.length===1){const a=this.getNodeType(e),l=e.getDataFromNode(this);r=l.snippet,r===void 0?(r=this.generate(e)||"",l.snippet=r):l.flowCodes!==void 0&&e.context.nodeBlock!==void 0&&e.addFlowCodeHierarchy(this,e.context.nodeBlock),r=e.format(r,a,t)}else r=this.generate(e,t)||"";return e.removeChain(this),e.addSequentialNode(this),r}getSerializeChildren(){return ym(this)}serialize(e){const t=this.getSerializeChildren(),i={};for(const{property:r,index:s,childNode:o}of t)s!==void 0?(i[r]===void 0&&(i[r]=Number.isInteger(s)?[]:{}),i[r][s]=o.toJSON(e.meta).uuid):i[r]=o.toJSON(e.meta).uuid;Object.keys(i).length>0&&(e.inputNodes=i)}deserialize(e){if(e.inputNodes!==void 0){const t=e.meta.nodes;for(const i in e.inputNodes)if(Array.isArray(e.inputNodes[i])){const r=[];for(const s of e.inputNodes[i])r.push(t[s]);this[i]=r}else if(typeof e.inputNodes[i]=="object"){const r={};for(const s in e.inputNodes[i]){const o=e.inputNodes[i][s];r[s]=t[o]}this[i]=r}else{const r=e.inputNodes[i];this[i]=t[r]}}}toJSON(e){const{uuid:t,type:i}=this,r=e===void 0||typeof e=="string";r&&(e={textures:{},images:{},nodes:{}});let s=e.nodes[t];s===void 0&&(s={uuid:t,type:i,meta:e,metadata:{version:4.6,type:"Node",generator:"Node.toJSON"}},r!==!0&&(e.nodes[s.uuid]=s),this.serialize(s),delete s.meta);function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}if(r){const a=o(e.textures),l=o(e.images),c=o(e.nodes);a.length>0&&(s.textures=a),l.length>0&&(s.images=l),c.length>0&&(s.nodes=c)}return s}}class Ql extends ut{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}getNodeType(e){return this.node.getElementType(e)}generate(e){const t=this.node.build(e),i=this.indexNode.build(e,"uint");return"".concat(t,"[ ").concat(i," ]")}}class lC extends ut{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}getNodeType(e){const t=this.node.getNodeType(e);let i=null;for(const r of this.convertTo.split("|"))(i===null||e.getTypeLength(t)===e.getTypeLength(r))&&(i=r);return i}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){const i=this.node,r=this.getNodeType(e),s=i.build(e,r);return e.format(s,r,t)}}class kn extends ut{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){const r=e.getVectorType(this.getNodeType(e,t)),s=e.getDataFromNode(this);if(s.propertyName!==void 0)return e.format(s.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){const o=super.build(e,r),a=e.getVarFromNode(this,null,r),l=e.getPropertyName(a);return e.addLineFlowCode("".concat(l," = ").concat(o),this),s.snippet=o,s.propertyName=l,e.format(s.propertyName,r,t)}}return super.build(e,t)}}class tU extends kn{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}getNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,i)=>t+e.getTypeLength(i.getNodeType(e)),0))}generate(e,t){const i=this.getNodeType(e),r=this.nodes,s=e.getComponentType(i),o=[];for(const l of r){let c=l.build(e);const u=e.getComponentType(l.getNodeType(e));u!==s&&(c=e.format(c,u,s)),o.push(c)}const a="".concat(e.getType(i),"( ").concat(o.join(", ")," )");return e.format(a,i,t)}}const nU=ku.join("");class $y extends ut{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(const t of this.components)e=Math.max(ku.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}getNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}generate(e,t){const i=this.node,r=e.getTypeLength(i.getNodeType(e));let s=null;if(r>1){let o=null;this.getVectorLength()>=r&&(o=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));const l=i.build(e,o);this.components.length===r&&this.components===nU.slice(0,this.components.length)?s=e.format(l,o,t):s=e.format("".concat(l,".").concat(this.components),this.getNodeType(e),t)}else s=i.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}}class iU extends kn{static get type(){return"SetNode"}constructor(e,t,i){super(),this.sourceNode=e,this.components=t,this.targetNode=i}getNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){const{sourceNode:t,components:i,targetNode:r}=this,s=this.getNodeType(e),o=e.getComponentType(r.getNodeType(e)),a=e.getTypeFromLength(i.length,o),l=r.build(e,a),c=t.build(e,s),u=e.getTypeLength(s),d=[];for(let h=0;hn.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),nb=n=>cC(n).split("").sort().join(""),uC={setup(n,e){const t=e.shift();return n(kh(t),...e)},get(n,e,t){if(typeof e=="string"&&n[e]===void 0){if(n.isStackNode!==!0&&e==="assign")return(...i)=>(_u.assign(t,...i),t);if(Oc.has(e)){const i=Oc.get(e);return n.isStackNode?(...r)=>t.add(i(...r)):(...r)=>i(t,...r)}else{if(e==="self")return n;if(e.endsWith("Assign")&&Oc.has(e.slice(0,e.length-6))){const i=Oc.get(e.slice(0,e.length-6));return n.isStackNode?(...r)=>t.assign(r[0],i(...r)):(...r)=>t.assign(i(t,...r))}else{if(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0)return e=cC(e),Fe(new $y(t,e));if(/^set[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=nb(e.slice(3).toLowerCase()),i=>Fe(new iU(n,e,i));if(/^flip[XYZWRGBASTPQ]{1,4}$/.test(e)===!0)return e=nb(e.slice(4).toLowerCase()),()=>Fe(new rU(Fe(n),e));if(e==="width"||e==="height"||e==="depth")return e==="width"?e="x":e==="height"?e="y":e==="depth"&&(e="z"),Fe(new $y(n,e));if(/^\d+$/.test(e)===!0)return Fe(new Ql(t,new Cs(Number(e),"uint")));if(/^get$/.test(e)===!0)return i=>Fe(new sU(t,i))}}}return Reflect.get(n,e,t)},set(n,e,t,i){return typeof e=="string"&&n[e]===void 0&&(/^[xyzwrgbastpq]{1,4}$/.test(e)===!0||e==="width"||e==="height"||e==="depth"||/^\d+$/.test(e)===!0)?(i[e].assign(t),!0):Reflect.set(n,e,t,i)}},Qg=new WeakMap,ib=new WeakMap,oU=function(n,e=null){const t=Ca(n);if(t==="node"){let i=Qg.get(n);return i===void 0&&(i=new Proxy(n,uC),Qg.set(n,i),Qg.set(i,i)),i}else{if(e===null&&(t==="float"||t==="boolean")||t&&t!=="shader"&&t!=="string")return Fe(Gy(n,e));if(t==="shader")return _e(n)}return n},aU=function(n,e=null){for(const t in n)n[t]=Fe(n[t],e);return n},lU=function(n,e=null){const t=n.length;for(let i=0;iFe(i!==null?Object.assign(s,i):s);return e===null?(...s)=>r(new n(...Rl(s))):t!==null?(t=Fe(t),(...s)=>r(new n(e,...Rl(s),t))):(...s)=>r(new n(e,...Rl(s)))},uU=function(n,...e){return Fe(new n(...Rl(e)))};class dU extends ut{constructor(e,t){super(),this.shaderNode=e,this.inputNodes=t}getNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){const{shaderNode:t,inputNodes:i}=this,r=e.getNodeProperties(t);if(r.onceOutput)return r.onceOutput;let s=null;if(t.layout){let o=ib.get(e.constructor);o===void 0&&(o=new WeakMap,ib.set(e.constructor,o));let a=o.get(t);a===void 0&&(a=Fe(e.buildFunctionNode(t)),o.set(t,a)),e.currentFunctionNode!==null&&e.currentFunctionNode.includes.push(a),s=Fe(a.call(i))}else{const o=t.jsFunc,a=i!==null||o.length>1?o(i||[],e):o(e);s=Fe(a)}return t.once&&(r.onceOutput=s),s}getOutputNode(e){const t=e.getNodeProperties(this);return t.outputNode===null&&(t.outputNode=this.setupOutput(e)),t.outputNode}setup(e){return this.getOutputNode(e)}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}generate(e,t){return this.getOutputNode(e).build(e,t)}}class hU extends ut{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}call(e=null){return kh(e),Fe(new dU(this,e))}setup(){return this.call()}}const fU=[!1,!0],pU=[0,1,2,3],mU=[-1,-2],dC=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],Q_=new Map;for(const n of fU)Q_.set(n,new Cs(n));const j_=new Map;for(const n of pU)j_.set(n,new Cs(n,"uint"));const q_=new Map([...j_].map(n=>new Cs(n.value,"int")));for(const n of mU)q_.set(n,new Cs(n,"int"));const r0=new Map([...q_].map(n=>new Cs(n.value)));for(const n of dC)r0.set(n,new Cs(n));for(const n of dC)r0.set(-n,new Cs(-n));const s0={bool:Q_,uint:j_,ints:q_,float:r0},rb=new Map([...Q_,...r0]),Gy=(n,e)=>rb.has(n)?rb.get(n):n.isNode===!0?n:new Cs(n,e),gU=n=>{try{return n.getNodeType()}catch(e){return}},Qn=function(n,e=null){return(...t)=>{if((t.length===0||!["bool","float","int","uint"].includes(n)&&t.every(r=>typeof r!="object"))&&(t=[iC(n,...t)]),t.length===1&&e!==null&&e.has(t[0]))return Fe(e.get(t[0]));if(t.length===1){const r=Gy(t[0],n);return gU(r)===n?Fe(r):Fe(new lC(r,n))}const i=t.map(r=>Gy(r));return Fe(new tU(i,n))}},ph=n=>typeof n=="object"&&n!==null?n.value:n,hC=n=>n!=null?n.nodeType||n.convertTo||(typeof n=="string"?n:null):null;function $d(n,e){return new Proxy(new hU(n,e),uC)}const Fe=(n,e=null)=>oU(n,e),kh=(n,e=null)=>new aU(n,e),Rl=(n,e=null)=>new lU(n,e),Pe=(...n)=>new cU(...n),Qe=(...n)=>new uU(...n),_e=(n,e)=>{const t=new $d(n,e),i=(...r)=>{let s;return kh(r),r[0]&&r[0].isNode?s=[...r]:s=r[0],t.call(s)};return i.shaderNode=t,i.setLayout=r=>(t.setLayout(r),i),i.once=()=>(t.once=!0,i),i},yU=(...n)=>(console.warn("TSL.ShaderNode: tslFn() has been renamed to Fn()."),_e(...n));Ne("toGlobal",n=>(n.global=!0,n));const Wy=n=>{_u=n},fC=()=>_u,Dt=(...n)=>_u.If(...n);function pC(n){return _u&&_u.add(n),n}Ne("append",pC);const mC=new Qn("color"),ce=new Qn("float",s0.float),de=new Qn("int",s0.ints),Ye=new Qn("uint",s0.uint),qo=new Qn("bool",s0.bool),He=new Qn("vec2"),Xn=new Qn("ivec2"),gC=new Qn("uvec2"),yC=new Qn("bvec2"),ve=new Qn("vec3"),vC=new Qn("ivec3"),Uu=new Qn("uvec3"),X_=new Qn("bvec3"),vt=new Qn("vec4"),_C=new Qn("ivec4"),xC=new Qn("uvec4"),SC=new Qn("bvec4"),o0=new Qn("mat2"),is=new Qn("mat3"),Il=new Qn("mat4"),vU=(n="")=>Fe(new Cs(n,"string")),_U=n=>Fe(new Cs(n,"ArrayBuffer"));Ne("toColor",mC);Ne("toFloat",ce);Ne("toInt",de);Ne("toUint",Ye);Ne("toBool",qo);Ne("toVec2",He);Ne("toIVec2",Xn);Ne("toUVec2",gC);Ne("toBVec2",yC);Ne("toVec3",ve);Ne("toIVec3",vC);Ne("toUVec3",Uu);Ne("toBVec3",X_);Ne("toVec4",vt);Ne("toIVec4",_C);Ne("toUVec4",xC);Ne("toBVec4",SC);Ne("toMat2",o0);Ne("toMat3",is);Ne("toMat4",Il);const AC=Pe(Ql),bC=(n,e)=>Fe(new lC(Fe(n),e)),xU=(n,e)=>Fe(new $y(Fe(n),e));Ne("element",AC);Ne("convert",bC);class sb extends kn{static get type(){return"ArrayNode"}constructor(e,t,i=null){super(e),this.count=t,this.values=i,this.isArrayNode=!0}getNodeType(e){return this.nodeType===null&&(this.nodeType=this.values[0].getNodeType(e)),this.nodeType}getElementType(e){return this.getNodeType(e)}generate(e){const t=this.getNodeType(e);return e.generateArray(t,this.count,this.values)}}const TC=(...n)=>{let e;if(n.length===1){const t=n[0];e=new sb(null,t.length,t)}else{const t=n[0],i=n[1];e=new sb(t,i)}return Fe(e)};Ne("toArray",(n,e)=>TC(Array(e).fill(n)));class wC extends ut{static get type(){return"UniformGroupNode"}constructor(e,t=!1,i=1){super("string"),this.name=e,this.shared=t,this.order=i,this.isUniformGroup=!0}serialize(e){super.serialize(e),e.name=this.name,e.version=this.version,e.shared=this.shared}deserialize(e){super.deserialize(e),this.name=e.name,this.version=e.version,this.shared=e.shared}}const CC=n=>new wC(n),a0=(n,e=0)=>new wC(n,!0,e),SU=a0("frame"),kt=a0("render"),EC=CC("object");class Uh extends W_{static get type(){return"UniformNode"}constructor(e,t=null){super(e,t),this.isUniformNode=!0,this.name="",this.groupNode=EC}label(e){return this.name=e,this}setGroup(e){return this.groupNode=e,this}getGroup(){return this.groupNode}getUniformHash(e){return this.getHash(e)}onUpdate(e,t){const i=this.getSelf();return e=e.bind(i),super.onUpdate(r=>{const s=e(r,i);s!==void 0&&(this.value=s)},t)}generate(e,t){const i=this.getNodeType(e),r=this.getUniformHash(e);let s=e.getNodeFromHash(r);s===void 0&&(e.setHashNode(this,r),s=this);const o=s.getInputType(e),a=e.getUniformFromNode(s,o,e.shaderStage,this.name||e.context.label),l=e.getPropertyName(a);return e.context.label!==void 0&&delete e.context.label,e.format(l,i,t)}}const Rt=(n,e)=>{const t=hC(e||n),i=n&&n.isNode===!0?n.node&&n.node.value||n.value:n;return Fe(new Uh(i,t))};class qt extends ut{static get type(){return"PropertyNode"}constructor(e,t=null,i=!1){super(e),this.name=t,this.varying=i,this.isPropertyNode=!0}getHash(e){return this.name||super.getHash(e)}isGlobal(){return!0}generate(e){let t;return this.varying===!0?(t=e.getVaryingFromNode(this,this.name),t.needsInterpolation=!0):t=e.getVarFromNode(this,this.name),e.getPropertyName(t)}}const MC=(n,e)=>Fe(new qt(n,e)),mh=(n,e)=>Fe(new qt(n,e,!0)),hs=Qe(qt,"vec4","DiffuseColor"),Qy=Qe(qt,"vec3","EmissiveColor"),RC=Qe(qt,"float","Roughness"),AU=Qe(qt,"float","Metalness"),bU=Qe(qt,"float","Clearcoat"),TU=Qe(qt,"float","ClearcoatRoughness"),wU=Qe(qt,"vec3","Sheen"),CU=Qe(qt,"float","SheenRoughness"),IC=Qe(qt,"float","Iridescence"),EU=Qe(qt,"float","IridescenceIOR"),MU=Qe(qt,"float","IridescenceThickness"),jy=Qe(qt,"float","AlphaT"),NC=Qe(qt,"float","Anisotropy"),Ip=Qe(qt,"vec3","AnisotropyT"),qc=Qe(qt,"vec3","AnisotropyB"),RU=Qe(qt,"color","SpecularColor"),IU=Qe(qt,"float","SpecularF90"),NU=Qe(qt,"float","Shininess"),gh=Qe(qt,"vec4","Output"),PU=Qe(qt,"float","dashSize"),LU=Qe(qt,"float","gapSize"),DU=Qe(qt,"float","pointWidth"),FU=Qe(qt,"float","IOR"),OU=Qe(qt,"float","Transmission"),BU=Qe(qt,"float","Thickness"),kU=Qe(qt,"float","AttenuationDistance"),UU=Qe(qt,"color","AttenuationColor"),zU=Qe(qt,"float","Dispersion");class VU extends kn{static get type(){return"AssignNode"}constructor(e,t){super(),this.targetNode=e,this.sourceNode=t}hasDependencies(){return!1}getNodeType(e,t){return t!=="void"?this.targetNode.getNodeType(e):"void"}needsSplitAssign(e){const{targetNode:t}=this;if(e.isAvailable("swizzleAssign")===!1&&t.isSplitNode&&t.components.length>1){const i=e.getTypeLength(t.node.getNodeType(e));return ku.join("").slice(0,i)!==t.components}return!1}generate(e,t){const{targetNode:i,sourceNode:r}=this,s=this.needsSplitAssign(e),o=i.getNodeType(e),a=i.context({assign:!0}).build(e),l=r.build(e,o),c=r.getNodeType(e),u=e.getDataFromNode(this);let d;if(u.initialized===!0)t!=="void"&&(d=a);else if(s){const h=e.getVarFromNode(this,null,o),f=e.getPropertyName(h);e.addLineFlowCode("".concat(f," = ").concat(l),this);const p=i.node.context({assign:!0}).build(e);for(let g=0;g{const u=c.type,d=u==="pointer";let h;return d?h="&"+l.build(e):h=l.build(e,u),h};if(Array.isArray(s))for(let l=0;l(e=e.length>1||e[0]&&e[0].isNode===!0?Rl(e):kh(e[0]),Fe(new HU(Fe(n),e)));Ne("call",LC);class Tn extends kn{static get type(){return"OperatorNode"}constructor(e,t,i,...r){if(super(),r.length>0){let s=new Tn(e,t,i);for(let o=0;o>"||i==="<<")return e.getIntegerType(o);if(i==="!"||i==="=="||i==="&&"||i==="||"||i==="^^")return"bool";if(i==="<"||i===">"||i==="<="||i===">="){const l=t?e.getTypeLength(t):Math.max(e.getTypeLength(o),e.getTypeLength(a));return l>1?"bvec".concat(l):"bool"}else{if(e.isMatrix(o)){if(a==="float")return o;if(e.isVector(a))return e.getVectorFromMatrix(o);if(e.isMatrix(a))return o}else if(e.isMatrix(a)){if(o==="float")return a;if(e.isVector(o))return e.getVectorFromMatrix(a)}return e.getTypeLength(a)>e.getTypeLength(o)?a:o}}generate(e,t){const i=this.op,r=this.aNode,s=this.bNode,o=this.getNodeType(e,t);let a=null,l=null;o!=="void"?(a=r.getNodeType(e),l=typeof s<"u"?s.getNodeType(e):null,i==="<"||i===">"||i==="<="||i===">="||i==="=="?e.isVector(a)?l=a:a!==l&&(a=l="float"):i===">>"||i==="<<"?(a=o,l=e.changeComponentType(l,"uint")):e.isMatrix(a)?l==="float"?l="float":e.isVector(l)?l=e.getVectorFromMatrix(a):e.isMatrix(l)||(a=l=o):e.isMatrix(l)?a==="float"?a="float":e.isVector(a)?a=e.getVectorFromMatrix(l):a=l=o:a=l=o):a=l=o;const c=r.build(e,a),u=typeof s<"u"?s.build(e,l):null,d=e.getTypeLength(t),h=e.getFunctionOperator(i);if(t!=="void")return i==="<"&&d>1?e.useComparisonMethod?e.format("".concat(e.getMethod("lessThan",t),"( ").concat(c,", ").concat(u," )"),o,t):e.format("( ".concat(c," < ").concat(u," )"),o,t):i==="<="&&d>1?e.useComparisonMethod?e.format("".concat(e.getMethod("lessThanEqual",t),"( ").concat(c,", ").concat(u," )"),o,t):e.format("( ".concat(c," <= ").concat(u," )"),o,t):i===">"&&d>1?e.useComparisonMethod?e.format("".concat(e.getMethod("greaterThan",t),"( ").concat(c,", ").concat(u," )"),o,t):e.format("( ".concat(c," > ").concat(u," )"),o,t):i===">="&&d>1?e.useComparisonMethod?e.format("".concat(e.getMethod("greaterThanEqual",t),"( ").concat(c,", ").concat(u," )"),o,t):e.format("( ".concat(c," >= ").concat(u," )"),o,t):i==="!"||i==="~"?e.format("(".concat(i).concat(c,")"),a,t):h?e.format("".concat(h,"( ").concat(c,", ").concat(u," )"),o,t):e.isMatrix(a)&&l==="float"?e.format("( ".concat(u," ").concat(i," ").concat(c," )"),o,t):a==="float"&&e.isMatrix(l)?e.format("".concat(c," ").concat(i," ").concat(u),o,t):e.format("( ".concat(c," ").concat(i," ").concat(u," )"),o,t);if(a!=="void")return h?e.format("".concat(h,"( ").concat(c,", ").concat(u," )"),o,t):e.isMatrix(a)&&l==="float"?e.format("".concat(u," ").concat(i," ").concat(c),o,t):e.format("".concat(c," ").concat(i," ").concat(u),o,t)}serialize(e){super.serialize(e),e.op=this.op}deserialize(e){super.deserialize(e),this.op=e.op}}const On=Pe(Tn,"+"),Bt=Pe(Tn,"-"),St=Pe(Tn,"*"),Xo=Pe(Tn,"/"),K_=Pe(Tn,"%"),DC=Pe(Tn,"=="),FC=Pe(Tn,"!="),OC=Pe(Tn,"<"),Y_=Pe(Tn,">"),BC=Pe(Tn,"<="),kC=Pe(Tn,">="),UC=Pe(Tn,"&&"),zC=Pe(Tn,"||"),VC=Pe(Tn,"!"),HC=Pe(Tn,"^^"),$C=Pe(Tn,"&"),GC=Pe(Tn,"~"),WC=Pe(Tn,"|"),QC=Pe(Tn,"^"),jC=Pe(Tn,"<<"),qC=Pe(Tn,">>");Ne("add",On);Ne("sub",Bt);Ne("mul",St);Ne("div",Xo);Ne("modInt",K_);Ne("equal",DC);Ne("notEqual",FC);Ne("lessThan",OC);Ne("greaterThan",Y_);Ne("lessThanEqual",BC);Ne("greaterThanEqual",kC);Ne("and",UC);Ne("or",zC);Ne("not",VC);Ne("xor",HC);Ne("bitAnd",$C);Ne("bitNot",GC);Ne("bitOr",WC);Ne("bitXor",QC);Ne("shiftLeft",jC);Ne("shiftRight",qC);const XC=(...n)=>(console.warn("TSL.OperatorNode: .remainder() has been renamed to .modInt()."),K_(...n));Ne("remainder",XC);class me extends kn{static get type(){return"MathNode"}constructor(e,t,i=null,r=null){super(),this.method=e,this.aNode=t,this.bNode=i,this.cNode=r,this.isMathNode=!0}getInputType(e){const t=this.aNode.getNodeType(e),i=this.bNode?this.bNode.getNodeType(e):null,r=this.cNode?this.cNode.getNodeType(e):null,s=e.isMatrix(t)?0:e.getTypeLength(t),o=e.isMatrix(i)?0:e.getTypeLength(i),a=e.isMatrix(r)?0:e.getTypeLength(r);return s>o&&s>a?t:o>a?i:a>s?r:t}getNodeType(e){const t=this.method;return t===me.LENGTH||t===me.DISTANCE||t===me.DOT?"float":t===me.CROSS?"vec3":t===me.ALL?"bool":t===me.EQUALS?e.changeComponentType(this.aNode.getNodeType(e),"bool"):t===me.MOD?this.aNode.getNodeType(e):this.getInputType(e)}generate(e,t){let i=this.method;const r=this.getNodeType(e),s=this.getInputType(e),o=this.aNode,a=this.bNode,l=this.cNode,c=e.renderer.coordinateSystem;if(i===me.TRANSFORM_DIRECTION){let u=o,d=a;e.isMatrix(u.getNodeType(e))?d=vt(ve(d),0):u=vt(ve(u),0);const h=St(u,d).xyz;return jl(h).build(e,t)}else{if(i===me.NEGATE)return e.format("( - "+o.build(e,s)+" )",r,t);if(i===me.ONE_MINUS)return Bt(1,o).build(e,t);if(i===me.RECIPROCAL)return Xo(1,o).build(e,t);if(i===me.DIFFERENCE)return mn(Bt(o,a)).build(e,t);{const u=[];return i===me.CROSS||i===me.MOD?u.push(o.build(e,r),a.build(e,r)):c===Ir&&i===me.STEP?u.push(o.build(e,e.getTypeLength(o.getNodeType(e))===1?"float":s),a.build(e,s)):c===Ir&&(i===me.MIN||i===me.MAX)||i===me.MOD?u.push(o.build(e,s),a.build(e,e.getTypeLength(a.getNodeType(e))===1?"float":s)):i===me.REFRACT?u.push(o.build(e,s),a.build(e,s),l.build(e,"float")):i===me.MIX?u.push(o.build(e,s),a.build(e,s),l.build(e,e.getTypeLength(l.getNodeType(e))===1?"float":s)):(c===Qo&&i===me.ATAN&&a!==null&&(i="atan2"),u.push(o.build(e,s)),a!==null&&u.push(a.build(e,s)),l!==null&&u.push(l.build(e,s))),e.format("".concat(e.getMethod(i,r),"( ").concat(u.join(", ")," )"),r,t)}}}serialize(e){super.serialize(e),e.method=this.method}deserialize(e){super.deserialize(e),this.method=e.method}}me.ALL="all";me.ANY="any";me.RADIANS="radians";me.DEGREES="degrees";me.EXP="exp";me.EXP2="exp2";me.LOG="log";me.LOG2="log2";me.SQRT="sqrt";me.INVERSE_SQRT="inversesqrt";me.FLOOR="floor";me.CEIL="ceil";me.NORMALIZE="normalize";me.FRACT="fract";me.SIN="sin";me.COS="cos";me.TAN="tan";me.ASIN="asin";me.ACOS="acos";me.ATAN="atan";me.ABS="abs";me.SIGN="sign";me.LENGTH="length";me.NEGATE="negate";me.ONE_MINUS="oneMinus";me.DFDX="dFdx";me.DFDY="dFdy";me.ROUND="round";me.RECIPROCAL="reciprocal";me.TRUNC="trunc";me.FWIDTH="fwidth";me.TRANSPOSE="transpose";me.BITCAST="bitcast";me.EQUALS="equals";me.MIN="min";me.MAX="max";me.MOD="mod";me.STEP="step";me.REFLECT="reflect";me.DISTANCE="distance";me.DIFFERENCE="difference";me.DOT="dot";me.CROSS="cross";me.POW="pow";me.TRANSFORM_DIRECTION="transformDirection";me.MIX="mix";me.CLAMP="clamp";me.REFRACT="refract";me.SMOOTHSTEP="smoothstep";me.FACEFORWARD="faceforward";const KC=ce(1e-6),$U=ce(1e6),_m=ce(Math.PI),GU=ce(Math.PI*2),Z_=Pe(me,me.ALL),YC=Pe(me,me.ANY),ZC=Pe(me,me.RADIANS),JC=Pe(me,me.DEGREES),eE=Pe(me,me.EXP),xu=Pe(me,me.EXP2),J_=Pe(me,me.LOG),Ho=Pe(me,me.LOG2),lo=Pe(me,me.SQRT),ex=Pe(me,me.INVERSE_SQRT),js=Pe(me,me.FLOOR),l0=Pe(me,me.CEIL),jl=Pe(me,me.NORMALIZE),na=Pe(me,me.FRACT),wr=Pe(me,me.SIN),Mo=Pe(me,me.COS),tE=Pe(me,me.TAN),nE=Pe(me,me.ASIN),iE=Pe(me,me.ACOS),tx=Pe(me,me.ATAN),mn=Pe(me,me.ABS),nx=Pe(me,me.SIGN),xm=Pe(me,me.LENGTH),rE=Pe(me,me.NEGATE),sE=Pe(me,me.ONE_MINUS),ix=Pe(me,me.DFDX),rx=Pe(me,me.DFDY),oE=Pe(me,me.ROUND),aE=Pe(me,me.RECIPROCAL),sx=Pe(me,me.TRUNC),lE=Pe(me,me.FWIDTH),cE=Pe(me,me.TRANSPOSE),WU=Pe(me,me.BITCAST),uE=Pe(me,me.EQUALS),Fr=Pe(me,me.MIN),ui=Pe(me,me.MAX),ox=Pe(me,me.MOD),c0=Pe(me,me.STEP),dE=Pe(me,me.REFLECT),hE=Pe(me,me.DISTANCE),fE=Pe(me,me.DIFFERENCE),za=Pe(me,me.DOT),u0=Pe(me,me.CROSS),gs=Pe(me,me.POW),pE=Pe(me,me.POW,2),mE=Pe(me,me.POW,3),gE=Pe(me,me.POW,4),yE=Pe(me,me.TRANSFORM_DIRECTION),vE=n=>St(nx(n),gs(mn(n),1/3)),ax=n=>za(n,n),Ln=Pe(me,me.MIX),Ko=(n,e=0,t=1)=>Fe(new me(me.CLAMP,Fe(n),Fe(e),Fe(t))),_E=n=>Ko(n),xE=Pe(me,me.REFRACT),Vl=Pe(me,me.SMOOTHSTEP),lx=Pe(me,me.FACEFORWARD),SE=_e(([n])=>{const i=43758.5453,r=za(n.xy,He(12.9898,78.233)),s=ox(r,_m);return na(wr(s).mul(i))}),AE=(n,e,t)=>Ln(e,t,n),bE=(n,e,t)=>Vl(e,t,n),TE=(n,e)=>(console.warn('THREE.TSL: "atan2" is overloaded. Use "atan" instead.'),tx(n,e)),QU=lx,jU=ex;Ne("all",Z_);Ne("any",YC);Ne("equals",uE);Ne("radians",ZC);Ne("degrees",JC);Ne("exp",eE);Ne("exp2",xu);Ne("log",J_);Ne("log2",Ho);Ne("sqrt",lo);Ne("inverseSqrt",ex);Ne("floor",js);Ne("ceil",l0);Ne("normalize",jl);Ne("fract",na);Ne("sin",wr);Ne("cos",Mo);Ne("tan",tE);Ne("asin",nE);Ne("acos",iE);Ne("atan",tx);Ne("abs",mn);Ne("sign",nx);Ne("length",xm);Ne("lengthSq",ax);Ne("negate",rE);Ne("oneMinus",sE);Ne("dFdx",ix);Ne("dFdy",rx);Ne("round",oE);Ne("reciprocal",aE);Ne("trunc",sx);Ne("fwidth",lE);Ne("atan2",TE);Ne("min",Fr);Ne("max",ui);Ne("mod",ox);Ne("step",c0);Ne("reflect",dE);Ne("distance",hE);Ne("dot",za);Ne("cross",u0);Ne("pow",gs);Ne("pow2",pE);Ne("pow3",mE);Ne("pow4",gE);Ne("transformDirection",yE);Ne("mix",AE);Ne("clamp",Ko);Ne("refract",xE);Ne("smoothstep",bE);Ne("faceForward",lx);Ne("difference",fE);Ne("saturate",_E);Ne("cbrt",vE);Ne("transpose",cE);Ne("rand",SE);class qU extends ut{static get type(){return"ConditionalNode"}constructor(e,t,i=null){super(),this.condNode=e,this.ifNode=t,this.elseNode=i}getNodeType(e){const{ifNode:t,elseNode:i}=e.getNodeProperties(this);if(t===void 0)return this.setup(e),this.getNodeType(e);const r=t.getNodeType(e);if(i!==null){const s=i.getNodeType(e);if(e.getTypeLength(s)>e.getTypeLength(r))return s}return r}setup(e){const t=this.condNode.cache(),i=this.ifNode.cache(),r=this.elseNode?this.elseNode.cache():null,s=e.context.nodeBlock;e.getDataFromNode(i).parentNodeBlock=s,r!==null&&(e.getDataFromNode(r).parentNodeBlock=s);const o=e.getNodeProperties(this);o.condNode=t,o.ifNode=i.context({nodeBlock:i}),o.elseNode=r?r.context({nodeBlock:r}):null}generate(e,t){const i=this.getNodeType(e),r=e.getDataFromNode(this);if(r.nodeProperty!==void 0)return r.nodeProperty;const{condNode:s,ifNode:o,elseNode:a}=e.getNodeProperties(this),l=t!=="void",c=l?MC(i).build(e):"";r.nodeProperty=c;const u=s.build(e,"bool");e.addFlowCode("\n".concat(e.tab,"if ( ").concat(u," ) {\n\n")).addFlowTab();let d=o.build(e,i);if(d&&(l?d=c+" = "+d+";":d="return "+d+";"),e.removeFlowTab().addFlowCode(e.tab+" "+d+"\n\n"+e.tab+"}"),a!==null){e.addFlowCode(" else {\n\n").addFlowTab();let h=a.build(e,i);h&&(l?h=c+" = "+h+";":h="return "+h+";"),e.removeFlowTab().addFlowCode(e.tab+" "+h+"\n\n"+e.tab+"}\n\n")}else e.addFlowCode("\n\n");return e.format(c,i,t)}}const sr=Pe(qU);Ne("select",sr);const wE=(...n)=>(console.warn("TSL.ConditionalNode: cond() has been renamed to select()."),sr(...n));Ne("cond",wE);class CE extends ut{static get type(){return"ContextNode"}constructor(e,t={}){super(),this.isContextNode=!0,this.node=e,this.value=t}getScope(){return this.node.getScope()}getNodeType(e){return this.node.getNodeType(e)}analyze(e){this.node.build(e)}setup(e){const t=e.getContext();e.setContext({...e.context,...this.value});const i=this.node.build(e);return e.setContext(t),i}generate(e,t){const i=e.getContext();e.setContext({...e.context,...this.value});const r=this.node.build(e,t);return e.setContext(i),r}}const cx=Pe(CE),EE=(n,e)=>cx(n,{label:e});Ne("context",cx);Ne("label",EE);class XU extends ut{static get type(){return"VarNode"}constructor(e,t=null,i=!1){super(),this.node=e,this.name=t,this.global=!0,this.isVarNode=!0,this.readOnly=i}getHash(e){return this.name||super.getHash(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}getElementType(e){return this.node.getElementType(e)}getNodeType(e){return this.node.getNodeType(e)}generate(e){const{node:t,name:i,readOnly:r}=this,{renderer:s}=e,o=s.backend.isWebGPUBackend===!0;let a=!1,l=!1;r&&(a=e.isDeterministic(t),l=o?r:a);const c=e.getVectorType(this.getNodeType(e)),u=t.build(e,c),d=e.getVarFromNode(this,i,c,void 0,l),h=e.getPropertyName(d);let f=h;if(l)if(o)f=a?"const ".concat(h):"let ".concat(h);else{const p=e.getArrayCount(t);f="const ".concat(e.getVar(d.type,h,p))}return e.addLineFlowCode("".concat(f," = ").concat(u),this),h}}const ux=Pe(XU),ME=(n,e=null)=>ux(n,e).append(),RE=(n,e=null)=>ux(n,e,!0).append();Ne("toVar",ME);Ne("toConst",RE);const IE=n=>(console.warn('TSL: "temp( node )" is deprecated. Use "Var( node )" or "node.toVar()" instead.'),ux(n));Ne("temp",IE);class KU extends ut{static get type(){return"VaryingNode"}constructor(e,t=null){super(),this.node=e,this.name=t,this.isVaryingNode=!0}isGlobal(){return!0}getHash(e){return this.name||super.getHash(e)}getNodeType(e){return this.node.getNodeType(e)}setupVarying(e){const t=e.getNodeProperties(this);let i=t.varying;if(i===void 0){const r=this.name,s=this.getNodeType(e);t.varying=i=e.getVaryingFromNode(this,r,s),t.node=this.node}return i.needsInterpolation||(i.needsInterpolation=e.shaderStage==="fragment"),i}setup(e){this.setupVarying(e)}analyze(e){return this.setupVarying(e),this.node.analyze(e)}generate(e){const t=e.getNodeProperties(this),i=this.setupVarying(e),r=e.shaderStage==="fragment"&&t.reassignPosition===!0&&e.context.needsPositionReassign;if(t.propertyName===void 0||r){const s=this.getNodeType(e),o=e.getPropertyName(i,Hy.VERTEX);e.flowNodeFromShaderStage(Hy.VERTEX,this.node,s,o),t.propertyName=o,r?t.reassignPosition=!1:t.reassignPosition===void 0&&e.context.isPositionNodeInput&&(t.reassignPosition=!0)}return e.getPropertyName(i)}}const tr=Pe(KU),NE=n=>tr(n);Ne("toVarying",tr);Ne("toVertexStage",NE);Ne("varying",(...n)=>(console.warn("TSL.VaryingNode: .varying() has been renamed to .toVarying()."),tr(...n)));Ne("vertexStage",(...n)=>(console.warn("TSL.VaryingNode: .vertexStage() has been renamed to .toVertexStage()."),tr(...n)));const PE=_e(([n])=>{const e=n.mul(.9478672986).add(.0521327014).pow(2.4),t=n.mul(.0773993808),i=n.lessThanEqual(.04045);return Ln(e,t,i)}).setLayout({name:"sRGBTransferEOTF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),LE=_e(([n])=>{const e=n.pow(.41666).mul(1.055).sub(.055),t=n.mul(12.92),i=n.lessThanEqual(.0031308);return Ln(e,t,i)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),zh="WorkingColorSpace",dx="OutputColorSpace";class Vh extends kn{static get type(){return"ColorSpaceNode"}constructor(e,t,i){super("vec4"),this.colorNode=e,this.source=t,this.target=i}resolveColorSpace(e,t){return t===zh?wt.workingColorSpace:t===dx?e.context.outputColorSpace||e.renderer.outputColorSpace:t}setup(e){const{colorNode:t}=this,i=this.resolveColorSpace(e,this.source),r=this.resolveColorSpace(e,this.target);let s=t;return wt.enabled===!1||i===r||!i||!r||(wt.getTransfer(i)===Zt&&(s=vt(PE(s.rgb),s.a)),wt.getPrimaries(i)!==wt.getPrimaries(r)&&(s=vt(is(wt._getMatrix(new mt,i,r)).mul(s.rgb),s.a)),wt.getTransfer(r)===Zt&&(s=vt(LE(s.rgb),s.a))),s}}const DE=n=>Fe(new Vh(Fe(n),zh,dx)),FE=n=>Fe(new Vh(Fe(n),dx,zh)),OE=(n,e)=>Fe(new Vh(Fe(n),zh,e)),hx=(n,e)=>Fe(new Vh(Fe(n),e,zh)),YU=(n,e,t)=>Fe(new Vh(Fe(n),e,t));Ne("toOutputColorSpace",DE);Ne("toWorkingColorSpace",FE);Ne("workingToColorSpace",OE);Ne("colorSpaceToWorking",hx);let ZU=class extends Ql{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),i=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,i,r)}};class JU extends ut{static get type(){return"ReferenceBaseNode"}constructor(e,t,i=null,r=null){super(),this.property=e,this.uniformType=t,this.object=i,this.count=r,this.properties=e.split("."),this.reference=i,this.node=null,this.group=null,this.updateType=Wt.OBJECT}setGroup(e){return this.group=e,this}element(e){return Fe(new ZU(this,Fe(e)))}setNodeType(e){const t=Rt(null,e).getSelf();this.group!==null&&t.setGroup(this.group),this.node=t}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let i=e[t[0]];for(let r=1;rFe(new ez(n,e,t));class tz extends kn{static get type(){return"ToneMappingNode"}constructor(e,t=UE,i=null){super("vec3"),this.toneMapping=e,this.exposureNode=t,this.colorNode=i}customCacheKey(){return tC(this.toneMapping)}setup(e){const t=this.colorNode||e.context.color,i=this.toneMapping;if(i===_s)return t;let r=null;const s=e.renderer.library.getToneMappingFunction(i);return s!==null?r=vt(s(t.rgb,this.exposureNode),t.a):(console.error("ToneMappingNode: Unsupported Tone Mapping configuration.",i),r=t),r}}const kE=(n,e,t)=>Fe(new tz(n,Fe(e),Fe(t))),UE=BE("toneMappingExposure","float");Ne("toneMapping",(n,e,t)=>kE(e,t,n));class nz extends W_{static get type(){return"BufferAttributeNode"}constructor(e,t=null,i=0,r=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferStride=i,this.bufferOffset=r,this.usage=um,this.instanced=!1,this.attribute=null,this.global=!0,e&&e.isBufferAttribute===!0&&(this.attribute=e,this.usage=e.usage,this.instanced=e.isInstancedBufferAttribute)}getHash(e){if(this.bufferStride===0&&this.bufferOffset===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getNodeType(e){return this.bufferType===null&&(this.bufferType=e.getTypeFromAttribute(this.attribute)),this.bufferType}setup(e){if(this.attribute!==null)return;const t=this.getNodeType(e),i=this.value,r=e.getTypeLength(t),s=this.bufferStride||r,o=this.bufferOffset,a=i.isInterleavedBuffer===!0?i:new x_(i,s),l=new e0(a,r,o);a.setUsage(this.usage),this.attribute=l,this.attribute.isInstancedBufferAttribute=this.instanced}generate(e){const t=this.getNodeType(e),i=e.getBufferAttributeFromNode(this,t),r=e.getPropertyName(i);let s=null;return e.shaderStage==="vertex"||e.shaderStage==="compute"?(this.name=r,s=r):s=tr(this).build(e,t),s}getInputType(){return"bufferAttribute"}setUsage(e){return this.usage=e,this.attribute&&this.attribute.isBufferAttribute===!0&&(this.attribute.usage=e),this}setInstanced(e){return this.instanced=e,this}}const Hh=(n,e=null,t=0,i=0)=>Fe(new nz(n,e,t,i)),zE=(n,e=null,t=0,i=0)=>Hh(n,e,t,i).setUsage(ba),Sm=(n,e=null,t=0,i=0)=>Hh(n,e,t,i).setInstanced(!0),qy=(n,e=null,t=0,i=0)=>zE(n,e,t,i).setInstanced(!0);Ne("toAttribute",n=>Hh(n.value));class iz extends ut{static get type(){return"ComputeNode"}constructor(e,t,i=[64]){super("void"),this.isComputeNode=!0,this.computeNode=e,this.count=t,this.workgroupSize=i,this.dispatchCount=0,this.version=1,this.name="",this.updateBeforeType=Wt.OBJECT,this.onInitFunction=null,this.updateDispatchCount()}dispose(){this.dispatchEvent({type:"dispose"})}label(e){return this.name=e,this}updateDispatchCount(){const{count:e,workgroupSize:t}=this;let i=t[0];for(let r=1;rFe(new iz(Fe(n),e,t));Ne("compute",VE);class rz extends ut{static get type(){return"CacheNode"}constructor(e,t=!0){super(),this.node=e,this.parent=t,this.isCacheNode=!0}getNodeType(e){const t=e.getCache(),i=e.getCacheFromNode(this,this.parent);e.setCache(i);const r=this.node.getNodeType(e);return e.setCache(t),r}build(e,...t){const i=e.getCache(),r=e.getCacheFromNode(this,this.parent);e.setCache(r);const s=this.node.build(e,...t);return e.setCache(i),s}}const HE=(n,e)=>Fe(new rz(Fe(n),e));Ne("cache",HE);class sz extends ut{static get type(){return"BypassNode"}constructor(e,t){super(),this.isBypassNode=!0,this.outputNode=e,this.callNode=t}getNodeType(e){return this.outputNode.getNodeType(e)}generate(e){const t=this.callNode.build(e,"void");return t!==""&&e.addLineFlowCode(t,this),this.outputNode.build(e)}}const $E=Pe(sz);Ne("bypass",$E);class GE extends ut{static get type(){return"RemapNode"}constructor(e,t,i,r=ce(0),s=ce(1)){super(),this.node=e,this.inLowNode=t,this.inHighNode=i,this.outLowNode=r,this.outHighNode=s,this.doClamp=!0}setup(){const{node:e,inLowNode:t,inHighNode:i,outLowNode:r,outHighNode:s,doClamp:o}=this;let a=e.sub(t).div(i.sub(t));return o===!0&&(a=a.clamp()),a.mul(s.sub(r)).add(r)}}const WE=Pe(GE,null,null,{doClamp:!1}),QE=Pe(GE);Ne("remap",WE);Ne("remapClamp",QE);class oz extends ut{static get type(){return"ExpressionNode"}constructor(e="",t="void"){super(t),this.snippet=e}generate(e,t){const i=this.getNodeType(e),r=this.snippet;if(i==="void")e.addLineFlowCode(r,this);else return e.format("( ".concat(r," )"),i,t)}}const Oa=Pe(oz),jE=n=>(n?sr(n,Oa("discard")):Oa("discard")).append(),az=()=>Oa("return").append();Ne("discard",jE);class lz extends kn{static get type(){return"RenderOutputNode"}constructor(e,t,i){super("vec4"),this.colorNode=e,this.toneMapping=t,this.outputColorSpace=i,this.isRenderOutputNode=!0}setup({context:e}){let t=this.colorNode||e.color;const i=(this.toneMapping!==null?this.toneMapping:e.toneMapping)||_s,r=(this.outputColorSpace!==null?this.outputColorSpace:e.outputColorSpace)||Vs;return i!==_s&&(t=t.toneMapping(i)),r!==Vs&&r!==wt.workingColorSpace&&(t=t.workingToColorSpace(r)),t}}const qE=(n,e=null,t=null)=>Fe(new lz(Fe(n),e,t));Ne("renderOutput",qE);function cz(n){console.warn("THREE.TSLBase: AddNodeElement has been removed in favor of tree-shaking. Trying add",n)}class XE extends ut{static get type(){return"AttributeNode"}constructor(e,t=null){super(t),this.global=!0,this._attributeName=e}getHash(e){return this.getAttributeName(e)}getNodeType(e){let t=this.nodeType;if(t===null){const i=this.getAttributeName(e);if(e.hasGeometryAttribute(i)){const r=e.geometry.getAttribute(i);t=e.getTypeFromAttribute(r)}else t="float"}return t}setAttributeName(e){return this._attributeName=e,this}getAttributeName(){return this._attributeName}generate(e){const t=this.getAttributeName(e),i=this.getNodeType(e);if(e.hasGeometryAttribute(t)===!0){const s=e.geometry.getAttribute(t),o=e.getTypeFromAttribute(s),a=e.getAttribute(t,o);return e.shaderStage==="vertex"?e.format(a.name,o,i):tr(this).build(e,i)}else return console.warn('AttributeNode: Vertex attribute "'.concat(t,'" not found on geometry.')),e.generateConst(i)}serialize(e){super.serialize(e),e.global=this.global,e._attributeName=this._attributeName}deserialize(e){super.deserialize(e),this.global=e.global,this._attributeName=e._attributeName}}const Yo=(n,e)=>Fe(new XE(n,e)),xn=(n=0)=>Yo("uv"+(n>0?n:""),"vec2");class uz extends ut{static get type(){return"TextureSizeNode"}constructor(e,t=null){super("uvec2"),this.isTextureSizeNode=!0,this.textureNode=e,this.levelNode=t}generate(e,t){const i=this.textureNode.build(e,"property"),r=this.levelNode===null?"0":this.levelNode.build(e,"int");return e.format("".concat(e.getMethod("textureDimensions"),"( ").concat(i,", ").concat(r," )"),this.getNodeType(e),t)}}const Pa=Pe(uz);class dz extends Uh{static get type(){return"MaxMipLevelNode"}constructor(e){super(0),this._textureNode=e,this.updateType=Wt.FRAME}get textureNode(){return this._textureNode}get texture(){return this._textureNode.value}update(){const e=this.texture,t=e.images,i=t&&t.length>0?t[0]&&t[0].image||t[0]:e.image;if(i&&i.width!==void 0){const{width:r,height:s}=i;this.value=Math.log2(Math.max(r,s))}}}const KE=Pe(dz);class Zo extends Uh{static get type(){return"TextureNode"}constructor(e,t=null,i=null,r=null){super(e),this.isTextureNode=!0,this.uvNode=t,this.levelNode=i,this.biasNode=r,this.compareNode=null,this.depthNode=null,this.gradNode=null,this.sampler=!0,this.updateMatrix=!1,this.updateType=Wt.NONE,this.referenceNode=null,this._value=e,this._matrixUniform=null,this.setUpdateMatrix(t===null)}set value(e){this.referenceNode?this.referenceNode.value=e:this._value=e}get value(){return this.referenceNode?this.referenceNode.value:this._value}getUniformHash(){return this.value.uuid}getNodeType(){return this.value.isDepthTexture===!0?"float":this.value.type===Ni?"uvec4":this.value.type===Zm?"ivec4":"vec4"}getInputType(){return"texture"}getDefaultUV(){return xn(this.value.channel)}updateReference(){return this.value}getTransformedUV(e){return this._matrixUniform===null&&(this._matrixUniform=Rt(this.value.matrix)),this._matrixUniform.mul(ve(e,1)).xy}setUpdateMatrix(e){return this.updateMatrix=e,this.updateType=e?Wt.RENDER:Wt.NONE,this}setupUV(e,t){const i=this.value;return e.isFlipY()&&(i.image instanceof ImageBitmap&&i.flipY===!0||i.isRenderTargetTexture===!0||i.isFramebufferTexture===!0||i.isDepthTexture===!0)&&(this.sampler?t=t.flipY():t=t.setY(de(Pa(this,this.levelNode).y).sub(t.y).sub(1))),t}setup(e){const t=e.getNodeProperties(this);t.referenceNode=this.referenceNode;const i=this.value;if(!i||i.isTexture!==!0)throw new Error("THREE.TSL: `texture( value )` function expects a valid instance of THREE.Texture().");let r=this.uvNode;(r===null||e.context.forceUVContext===!0)&&e.context.getUV&&(r=e.context.getUV(this)),r||(r=this.getDefaultUV()),this.updateMatrix===!0&&(r=this.getTransformedUV(r)),r=this.setupUV(e,r);let s=this.levelNode;s===null&&e.context.getTextureLevel&&(s=e.context.getTextureLevel(this)),t.uvNode=r,t.levelNode=s,t.biasNode=this.biasNode,t.compareNode=this.compareNode,t.gradNode=this.gradNode,t.depthNode=this.depthNode}generateUV(e,t){return t.build(e,this.sampler===!0?"vec2":"ivec2")}generateSnippet(e,t,i,r,s,o,a,l){const c=this.value;let u;return r?u=e.generateTextureLevel(c,t,i,r,o):s?u=e.generateTextureBias(c,t,i,s,o):l?u=e.generateTextureGrad(c,t,i,l,o):a?u=e.generateTextureCompare(c,t,i,a,o):this.sampler===!1?u=e.generateTextureLoad(c,t,i,o):u=e.generateTexture(c,t,i,o),u}generate(e,t){const i=this.value,r=e.getNodeProperties(this),s=super.generate(e,"property");if(t==="sampler")return s+"_sampler";if(e.isReference(t))return s;{const o=e.getDataFromNode(this);let a=o.propertyName;if(a===void 0){const{uvNode:u,levelNode:d,biasNode:h,compareNode:f,depthNode:p,gradNode:g}=r,y=this.generateUV(e,u),m=d?d.build(e,"float"):null,v=h?h.build(e,"float"):null,x=p?p.build(e,"int"):null,_=f?f.build(e,"float"):null,S=g?[g[0].build(e,"vec2"),g[1].build(e,"vec2")]:null,E=e.getVarFromNode(this);a=e.getPropertyName(E);const A=this.generateSnippet(e,s,y,m,v,x,_,S);e.addLineFlowCode("".concat(a," = ").concat(A),this),o.snippet=A,o.propertyName=a}let l=a;const c=this.getNodeType(e);return e.needsToWorkingColorSpace(i)&&(l=hx(Oa(l,c),i.colorSpace).setup(e).build(e,c)),e.format(l,c,t)}}setSampler(e){return this.sampler=e,this}getSampler(){return this.sampler}uv(e){return console.warn("THREE.TextureNode: .uv() has been renamed. Use .sample() instead."),this.sample(e)}sample(e){const t=this.clone();return t.uvNode=Fe(e),t.referenceNode=this.getSelf(),Fe(t)}blur(e){const t=this.clone();return t.biasNode=Fe(e).mul(KE(t)),t.referenceNode=this.getSelf(),Fe(t)}level(e){const t=this.clone();return t.levelNode=Fe(e),t.referenceNode=this.getSelf(),Fe(t)}size(e){return Pa(this,e)}bias(e){const t=this.clone();return t.biasNode=Fe(e),t.referenceNode=this.getSelf(),Fe(t)}compare(e){const t=this.clone();return t.compareNode=Fe(e),t.referenceNode=this.getSelf(),Fe(t)}grad(e,t){const i=this.clone();return i.gradNode=[Fe(e),Fe(t)],i.referenceNode=this.getSelf(),Fe(i)}depth(e){const t=this.clone();return t.depthNode=Fe(e),t.referenceNode=this.getSelf(),Fe(t)}serialize(e){super.serialize(e),e.value=this.value.toJSON(e.meta).uuid,e.sampler=this.sampler,e.updateMatrix=this.updateMatrix,e.updateType=this.updateType}deserialize(e){super.deserialize(e),this.value=e.meta.textures[e.value],this.sampler=e.sampler,this.updateMatrix=e.updateMatrix,this.updateType=e.updateType}update(){const e=this.value,t=this._matrixUniform;t!==null&&(t.value=e.matrix),e.matrixAutoUpdate===!0&&e.updateMatrix()}clone(){const e=new this.constructor(this.value,this.uvNode,this.levelNode,this.biasNode);return e.sampler=this.sampler,e}}const er=Pe(Zo),Rn=(...n)=>er(...n).setSampler(!1),hz=n=>(n.isNode===!0?n:er(n)).convert("sampler");class fx extends Uh{static get type(){return"BufferNode"}constructor(e,t,i=0){super(e,t),this.isBufferNode=!0,this.bufferType=t,this.bufferCount=i}getElementType(e){return this.getNodeType(e)}getInputType(){return"buffer"}}const $h=(n,e,t)=>Fe(new fx(n,e,t));class fz extends Ql{static get type(){return"UniformArrayElementNode"}constructor(e,t){super(e,t),this.isArrayBufferElementNode=!0}generate(e){const t=super.generate(e),i=this.getNodeType(),r=this.node.getPaddedType();return e.format(t,r,i)}}class YE extends fx{static get type(){return"UniformArrayNode"}constructor(e,t=null){super(null),this.array=e,this.elementType=t===null?Ca(e[0]):t,this.paddedType=this.getPaddedType(),this.updateType=Wt.RENDER,this.isArrayBufferNode=!0}getNodeType(){return this.paddedType}getElementType(){return this.elementType}getPaddedType(){const e=this.elementType;let t="vec4";return e==="mat2"?t="mat2":/mat/.test(e)===!0?t="mat4":e.charAt(0)==="i"?t="ivec4":e.charAt(0)==="u"&&(t="uvec4"),t}update(){const{array:e,value:t}=this,i=this.elementType;if(i==="float"||i==="int"||i==="uint")for(let r=0;rFe(new YE(n,e)),pz=(n,e)=>(console.warn("TSL.UniformArrayNode: uniforms() has been renamed to uniformArray()."),Fe(new YE(n,e))),px=Rt(0,"uint").setGroup(a0("cameraIndex")).toVarying("v_cameraIndex"),_a=Rt("float").label("cameraNear").setGroup(kt).onRenderUpdate(({camera:n})=>n.near),xa=Rt("float").label("cameraFar").setGroup(kt).onRenderUpdate(({camera:n})=>n.far),Gh=_e(({camera:n})=>{let e;if(n.isArrayCamera&&n.cameras.length>0){const t=[];for(const r of n.cameras)t.push(r.projectionMatrix);e=Do(t).setGroup(kt).label("cameraProjectionMatrices").element(px).toVar("cameraProjectionMatrix")}else e=Rt("mat4").label("cameraProjectionMatrix").setGroup(kt).onRenderUpdate(({camera:t})=>t.projectionMatrix);return e}).once()(),mz=Rt("mat4").label("cameraProjectionMatrixInverse").setGroup(kt).onRenderUpdate(({camera:n})=>n.projectionMatrixInverse),ss=_e(({camera:n})=>{let e;if(n.isArrayCamera&&n.cameras.length>0){const t=[];for(const r of n.cameras)t.push(r.matrixWorldInverse);e=Do(t).setGroup(kt).label("cameraViewMatrices").element(px).toVar("cameraViewMatrix")}else e=Rt("mat4").label("cameraViewMatrix").setGroup(kt).onRenderUpdate(({camera:t})=>t.matrixWorldInverse);return e}).once()(),gz=Rt("mat4").label("cameraWorldMatrix").setGroup(kt).onRenderUpdate(({camera:n})=>n.matrixWorld),yz=Rt("mat3").label("cameraNormalMatrix").setGroup(kt).onRenderUpdate(({camera:n})=>n.normalMatrix),vz=Rt(new Y).label("cameraPosition").setGroup(kt).onRenderUpdate(({camera:n},e)=>e.value.setFromMatrixPosition(n.matrixWorld));class Ht extends ut{static get type(){return"Object3DNode"}constructor(e,t=null){super(),this.scope=e,this.object3d=t,this.updateType=Wt.OBJECT,this._uniformNode=new Uh(null)}getNodeType(){const e=this.scope;if(e===Ht.WORLD_MATRIX)return"mat4";if(e===Ht.POSITION||e===Ht.VIEW_POSITION||e===Ht.DIRECTION||e===Ht.SCALE)return"vec3"}update(e){const t=this.object3d,i=this._uniformNode,r=this.scope;if(r===Ht.WORLD_MATRIX)i.value=t.matrixWorld;else if(r===Ht.POSITION)i.value=i.value||new Y,i.value.setFromMatrixPosition(t.matrixWorld);else if(r===Ht.SCALE)i.value=i.value||new Y,i.value.setFromMatrixScale(t.matrixWorld);else if(r===Ht.DIRECTION)i.value=i.value||new Y,t.getWorldDirection(i.value);else if(r===Ht.VIEW_POSITION){const s=e.camera;i.value=i.value||new Y,i.value.setFromMatrixPosition(t.matrixWorld),i.value.applyMatrix4(s.matrixWorldInverse)}}generate(e){const t=this.scope;return t===Ht.WORLD_MATRIX?this._uniformNode.nodeType="mat4":(t===Ht.POSITION||t===Ht.VIEW_POSITION||t===Ht.DIRECTION||t===Ht.SCALE)&&(this._uniformNode.nodeType="vec3"),this._uniformNode.build(e)}serialize(e){super.serialize(e),e.scope=this.scope}deserialize(e){super.deserialize(e),this.scope=e.scope}}Ht.WORLD_MATRIX="worldMatrix";Ht.POSITION="position";Ht.SCALE="scale";Ht.VIEW_POSITION="viewPosition";Ht.DIRECTION="direction";const _z=Pe(Ht,Ht.DIRECTION),xz=Pe(Ht,Ht.WORLD_MATRIX),ZE=Pe(Ht,Ht.POSITION),Sz=Pe(Ht,Ht.SCALE),Az=Pe(Ht,Ht.VIEW_POSITION);class eo extends Ht{static get type(){return"ModelNode"}constructor(e){super(e)}update(e){this.object3d=e.object,super.update(e)}}const bz=Qe(eo,eo.DIRECTION),Fo=Qe(eo,eo.WORLD_MATRIX),Tz=Qe(eo,eo.POSITION),wz=Qe(eo,eo.SCALE),Cz=Qe(eo,eo.VIEW_POSITION),JE=Rt(new mt).onObjectUpdate(({object:n},e)=>e.value.getNormalMatrix(n.matrixWorld)),Ez=Rt(new Xe).onObjectUpdate(({object:n},e)=>e.value.copy(n.matrixWorld).invert()),Wh=_e(n=>n.renderer.nodes.modelViewMatrix||eM).once()().toVar("modelViewMatrix"),eM=ss.mul(Fo),Mz=_e(n=>(n.context.isHighPrecisionModelViewMatrix=!0,Rt("mat4").onObjectUpdate(({object:e,camera:t})=>e.modelViewMatrix.multiplyMatrices(t.matrixWorldInverse,e.matrixWorld)))).once()().toVar("highpModelViewMatrix"),Rz=_e(n=>{const e=n.context.isHighPrecisionModelViewMatrix;return Rt("mat3").onObjectUpdate(({object:t,camera:i})=>(e!==!0&&t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix)))}).once()().toVar("highpModelNormalViewMatrix"),mx=Yo("position","vec3"),Nn=mx.toVarying("positionLocal"),Am=mx.toVarying("positionPrevious"),Nl=Fo.mul(Nn).xyz.toVarying("v_positionWorld").context({needsPositionReassign:!0}),tM=Nn.transformDirection(Fo).toVarying("v_positionWorldDirection").normalize().toVar("positionWorldDirection").context({needsPositionReassign:!0}),Yn=_e(n=>n.context.setupPositionView(),"vec3").once()().toVarying("v_positionView").context({needsPositionReassign:!0}),Er=Yn.negate().toVarying("v_positionViewDirection").normalize().toVar("positionViewDirection");class Iz extends ut{static get type(){return"FrontFacingNode"}constructor(){super("bool"),this.isFrontFacingNode=!0}generate(e){const{renderer:t,material:i}=e;return t.coordinateSystem===Ir&&i.side===Fi?"false":e.getFrontFacing()}}const nM=Qe(Iz),Qh=ce(nM).mul(2).sub(1),gx=Yo("normal","vec3"),cr=_e(n=>n.geometry.hasAttribute("normal")===!1?(console.warn('TSL.NormalNode: Vertex attribute "normal" not found on geometry.'),ve(0,1,0)):gx,"vec3").once()().toVar("normalLocal"),iM=Yn.dFdx().cross(Yn.dFdy()).normalize().toVar("normalFlat"),to=_e(n=>{let e;return n.material.flatShading===!0?e=iM:e=tr(yx(cr),"v_normalView").normalize(),e},"vec3").once()().toVar("normalView"),rM=tr(to.transformDirection(ss),"v_normalWorld").normalize().toVar("normalWorld"),Jo=_e(n=>n.context.setupNormal().context({getUV:null}),"vec3").once()().mul(Qh).toVar("transformedNormalView"),sM=Jo.transformDirection(ss).toVar("transformedNormalWorld"),Nz=_e(n=>n.context.setupClearcoatNormal().context({getUV:null}),"vec3").once()().mul(Qh).toVar("transformedClearcoatNormalView"),oM=_e(([n,e=Fo])=>{const t=is(e),i=n.div(ve(t[0].dot(t[0]),t[1].dot(t[1]),t[2].dot(t[2])));return t.mul(i).xyz}),yx=_e(([n],e)=>{const t=e.renderer.nodes.modelNormalViewMatrix;if(t!==null)return t.transformDirection(n);const i=JE.mul(n);return ss.transformDirection(i)}),aM=Rt(0).onReference(({material:n})=>n).onRenderUpdate(({material:n})=>n.refractionRatio),lM=Er.negate().reflect(Jo),cM=Er.negate().refract(Jo,aM),uM=lM.transformDirection(ss).toVar("reflectVector"),dM=cM.transformDirection(ss).toVar("reflectVector");class Pz extends Zo{static get type(){return"CubeTextureNode"}constructor(e,t=null,i=null,r=null){super(e,t,i,r),this.isCubeTextureNode=!0}getInputType(){return"cubeTexture"}getDefaultUV(){const e=this.value;return e.mapping===kl?uM:e.mapping===Ul?dM:(console.error('THREE.CubeTextureNode: Mapping "%s" not supported.',e.mapping),ve(0,0,0))}setUpdateMatrix(){}setupUV(e,t){const i=this.value;return e.renderer.coordinateSystem===Qo||!i.isRenderTargetTexture?ve(t.x.negate(),t.yz):t}generateUV(e,t){return t.build(e,"vec3")}}const hM=Pe(Pz);class Lz extends Ql{static get type(){return"ReferenceElementNode"}constructor(e,t){super(e,t),this.referenceNode=e,this.isReferenceElementNode=!0}getNodeType(){return this.referenceNode.uniformType}generate(e){const t=super.generate(e),i=this.referenceNode.getNodeType(),r=this.getNodeType();return e.format(t,i,r)}}class d0 extends ut{static get type(){return"ReferenceNode"}constructor(e,t,i=null,r=null){super(),this.property=e,this.uniformType=t,this.object=i,this.count=r,this.properties=e.split("."),this.reference=i,this.node=null,this.group=null,this.name=null,this.updateType=Wt.OBJECT}element(e){return Fe(new Lz(this,Fe(e)))}setGroup(e){return this.group=e,this}label(e){return this.name=e,this}setNodeType(e){let t=null;this.count!==null?t=$h(null,e,this.count):Array.isArray(this.getValueFromReference())?t=Do(null,e):e==="texture"?t=er(null):e==="cubeTexture"?t=hM(null):t=Rt(null,e),this.group!==null&&t.setGroup(this.group),this.name!==null&&t.label(this.name),this.node=t.getSelf()}getNodeType(e){return this.node===null&&(this.updateReference(e),this.updateValue()),this.node.getNodeType(e)}getValueFromReference(e=this.reference){const{properties:t}=this;let i=e[t[0]];for(let r=1;rFe(new d0(n,e,t)),Xy=(n,e,t,i)=>Fe(new d0(n,e,i,t));class Dz extends d0{static get type(){return"MaterialReferenceNode"}constructor(e,t,i=null){super(e,t,i),this.material=i,this.isMaterialReferenceNode=!0}updateReference(e){return this.reference=this.material!==null?this.material:e.material,this.reference}}const ml=(n,e,t=null)=>Fe(new Dz(n,e,t)),h0=_e(n=>(n.geometry.hasAttribute("tangent")===!1&&n.geometry.computeTangents(),Yo("tangent","vec4")))(),jh=h0.xyz.toVar("tangentLocal"),qh=Wh.mul(vt(jh,0)).xyz.toVarying("v_tangentView").normalize().toVar("tangentView"),fM=qh.transformDirection(ss).toVarying("v_tangentWorld").normalize().toVar("tangentWorld"),vx=qh.toVar("transformedTangentView"),Fz=vx.transformDirection(ss).normalize().toVar("transformedTangentWorld"),Xh=n=>n.mul(h0.w).xyz,Oz=tr(Xh(gx.cross(h0)),"v_bitangentGeometry").normalize().toVar("bitangentGeometry"),Bz=tr(Xh(cr.cross(jh)),"v_bitangentLocal").normalize().toVar("bitangentLocal"),pM=tr(Xh(to.cross(qh)),"v_bitangentView").normalize().toVar("bitangentView"),kz=tr(Xh(rM.cross(fM)),"v_bitangentWorld").normalize().toVar("bitangentWorld"),mM=Xh(Jo.cross(vx)).normalize().toVar("transformedBitangentView"),Uz=mM.transformDirection(ss).normalize().toVar("transformedBitangentWorld"),_x=is(qh,pM,to),gM=Er.mul(_x),zz=(n,e)=>n.sub(gM.mul(e)),Vz=(()=>{let n=qc.cross(Er);return n=n.cross(qc).normalize(),n=Ln(n,Jo,NC.mul(RC.oneMinus()).oneMinus().pow2().pow2()).normalize(),n})(),Hz=_e(n=>{const{eye_pos:e,surf_norm:t,mapN:i,uv:r}=n,s=e.dFdx(),o=e.dFdy(),a=r.dFdx(),l=r.dFdy(),c=t,u=o.cross(c),d=c.cross(s),h=u.mul(a.x).add(d.mul(l.x)),f=u.mul(a.y).add(d.mul(l.y)),p=h.dot(h).max(f.dot(f)),g=Qh.mul(p.inverseSqrt());return On(h.mul(i.x,g),f.mul(i.y,g),c.mul(i.z)).normalize()});class $z extends kn{static get type(){return"NormalMapNode"}constructor(e,t=null){super("vec3"),this.node=e,this.scaleNode=t,this.normalMapType=lm}setup(e){const{normalMapType:t,scaleNode:i}=this;let r=this.node.mul(2).sub(1);i!==null&&(r=ve(r.xy.mul(i),r.z));let s=null;return t===A5?s=yx(r):t===lm&&(e.hasGeometryAttribute("tangent")===!0?s=_x.mul(r).normalize():s=Hz({eye_pos:Yn,surf_norm:to,mapN:r,uv:xn()})),s}}const Ky=Pe($z),Gz=_e(({textureNode:n,bumpScale:e})=>{const t=r=>n.cache().context({getUV:s=>r(s.uvNode||xn()),forceUVContext:!0}),i=ce(t(r=>r));return He(ce(t(r=>r.add(r.dFdx()))).sub(i),ce(t(r=>r.add(r.dFdy()))).sub(i)).mul(e)}),Wz=_e(n=>{const{surf_pos:e,surf_norm:t,dHdxy:i}=n,r=e.dFdx().normalize(),s=e.dFdy().normalize(),o=t,a=s.cross(o),l=o.cross(r),c=r.dot(a).mul(Qh),u=c.sign().mul(i.x.mul(a).add(i.y.mul(l)));return c.abs().mul(t).sub(u).normalize()});class Qz extends kn{static get type(){return"BumpMapNode"}constructor(e,t=null){super("vec3"),this.textureNode=e,this.scaleNode=t}setup(){const e=this.scaleNode!==null?this.scaleNode:1,t=Gz({textureNode:this.textureNode,bumpScale:e});return Wz({surf_pos:Yn,surf_norm:to,dHdxy:t})}}const yM=Pe(Qz),ob=new Map;class Ee extends ut{static get type(){return"MaterialNode"}constructor(e){super(),this.scope=e}getCache(e,t){let i=ob.get(e);return i===void 0&&(i=ml(e,t),ob.set(e,i)),i}getFloat(e){return this.getCache(e,"float")}getColor(e){return this.getCache(e,"color")}getTexture(e){return this.getCache(e==="map"?"map":e+"Map","texture")}setup(e){const t=e.context.material,i=this.scope;let r=null;if(i===Ee.COLOR){const s=t.color!==void 0?this.getColor(i):ve();t.map&&t.map.isTexture===!0?r=s.mul(this.getTexture("map")):r=s}else if(i===Ee.OPACITY){const s=this.getFloat(i);t.alphaMap&&t.alphaMap.isTexture===!0?r=s.mul(this.getTexture("alpha")):r=s}else if(i===Ee.SPECULAR_STRENGTH)t.specularMap&&t.specularMap.isTexture===!0?r=this.getTexture("specular").r:r=ce(1);else if(i===Ee.SPECULAR_INTENSITY){const s=this.getFloat(i);t.specularIntensityMap&&t.specularIntensityMap.isTexture===!0?r=s.mul(this.getTexture(i).a):r=s}else if(i===Ee.SPECULAR_COLOR){const s=this.getColor(i);t.specularColorMap&&t.specularColorMap.isTexture===!0?r=s.mul(this.getTexture(i).rgb):r=s}else if(i===Ee.ROUGHNESS){const s=this.getFloat(i);t.roughnessMap&&t.roughnessMap.isTexture===!0?r=s.mul(this.getTexture(i).g):r=s}else if(i===Ee.METALNESS){const s=this.getFloat(i);t.metalnessMap&&t.metalnessMap.isTexture===!0?r=s.mul(this.getTexture(i).b):r=s}else if(i===Ee.EMISSIVE){const s=this.getFloat("emissiveIntensity"),o=this.getColor(i).mul(s);t.emissiveMap&&t.emissiveMap.isTexture===!0?r=o.mul(this.getTexture(i)):r=o}else if(i===Ee.NORMAL)t.normalMap?(r=Ky(this.getTexture("normal"),this.getCache("normalScale","vec2")),r.normalMapType=t.normalMapType):t.bumpMap?r=yM(this.getTexture("bump").r,this.getFloat("bumpScale")):r=to;else if(i===Ee.CLEARCOAT){const s=this.getFloat(i);t.clearcoatMap&&t.clearcoatMap.isTexture===!0?r=s.mul(this.getTexture(i).r):r=s}else if(i===Ee.CLEARCOAT_ROUGHNESS){const s=this.getFloat(i);t.clearcoatRoughnessMap&&t.clearcoatRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(i).r):r=s}else if(i===Ee.CLEARCOAT_NORMAL)t.clearcoatNormalMap?r=Ky(this.getTexture(i),this.getCache(i+"Scale","vec2")):r=to;else if(i===Ee.SHEEN){const s=this.getColor("sheenColor").mul(this.getFloat("sheen"));t.sheenColorMap&&t.sheenColorMap.isTexture===!0?r=s.mul(this.getTexture("sheenColor").rgb):r=s}else if(i===Ee.SHEEN_ROUGHNESS){const s=this.getFloat(i);t.sheenRoughnessMap&&t.sheenRoughnessMap.isTexture===!0?r=s.mul(this.getTexture(i).a):r=s,r=r.clamp(.07,1)}else if(i===Ee.ANISOTROPY)if(t.anisotropyMap&&t.anisotropyMap.isTexture===!0){const s=this.getTexture(i);r=o0(Mc.x,Mc.y,Mc.y.negate(),Mc.x).mul(s.rg.mul(2).sub(He(1)).normalize().mul(s.b))}else r=Mc;else if(i===Ee.IRIDESCENCE_THICKNESS){const s=Pn("1","float",t.iridescenceThicknessRange);if(t.iridescenceThicknessMap){const o=Pn("0","float",t.iridescenceThicknessRange);r=s.sub(o).mul(this.getTexture(i).g).add(o)}else r=s}else if(i===Ee.TRANSMISSION){const s=this.getFloat(i);t.transmissionMap?r=s.mul(this.getTexture(i).r):r=s}else if(i===Ee.THICKNESS){const s=this.getFloat(i);t.thicknessMap?r=s.mul(this.getTexture(i).g):r=s}else if(i===Ee.IOR)r=this.getFloat(i);else if(i===Ee.LIGHT_MAP)r=this.getTexture(i).rgb.mul(this.getFloat("lightMapIntensity"));else if(i===Ee.AO)r=this.getTexture(i).r.sub(1).mul(this.getFloat("aoMapIntensity")).add(1);else{const s=this.getNodeType(e);r=this.getCache(i,s)}return r}}Ee.ALPHA_TEST="alphaTest";Ee.COLOR="color";Ee.OPACITY="opacity";Ee.SHININESS="shininess";Ee.SPECULAR="specular";Ee.SPECULAR_STRENGTH="specularStrength";Ee.SPECULAR_INTENSITY="specularIntensity";Ee.SPECULAR_COLOR="specularColor";Ee.REFLECTIVITY="reflectivity";Ee.ROUGHNESS="roughness";Ee.METALNESS="metalness";Ee.NORMAL="normal";Ee.CLEARCOAT="clearcoat";Ee.CLEARCOAT_ROUGHNESS="clearcoatRoughness";Ee.CLEARCOAT_NORMAL="clearcoatNormal";Ee.EMISSIVE="emissive";Ee.ROTATION="rotation";Ee.SHEEN="sheen";Ee.SHEEN_ROUGHNESS="sheenRoughness";Ee.ANISOTROPY="anisotropy";Ee.IRIDESCENCE="iridescence";Ee.IRIDESCENCE_IOR="iridescenceIOR";Ee.IRIDESCENCE_THICKNESS="iridescenceThickness";Ee.IOR="ior";Ee.TRANSMISSION="transmission";Ee.THICKNESS="thickness";Ee.ATTENUATION_DISTANCE="attenuationDistance";Ee.ATTENUATION_COLOR="attenuationColor";Ee.LINE_SCALE="scale";Ee.LINE_DASH_SIZE="dashSize";Ee.LINE_GAP_SIZE="gapSize";Ee.LINE_WIDTH="linewidth";Ee.LINE_DASH_OFFSET="dashOffset";Ee.POINT_SIZE="size";Ee.DISPERSION="dispersion";Ee.LIGHT_MAP="light";Ee.AO="ao";const vM=Qe(Ee,Ee.ALPHA_TEST),_M=Qe(Ee,Ee.COLOR),jz=Qe(Ee,Ee.SHININESS),xM=Qe(Ee,Ee.EMISSIVE),SM=Qe(Ee,Ee.OPACITY),qz=Qe(Ee,Ee.SPECULAR),Xz=Qe(Ee,Ee.SPECULAR_INTENSITY),Kz=Qe(Ee,Ee.SPECULAR_COLOR),Yz=Qe(Ee,Ee.SPECULAR_STRENGTH),Zz=Qe(Ee,Ee.REFLECTIVITY),Jz=Qe(Ee,Ee.ROUGHNESS),eV=Qe(Ee,Ee.METALNESS),AM=Qe(Ee,Ee.NORMAL),tV=Qe(Ee,Ee.CLEARCOAT),nV=Qe(Ee,Ee.CLEARCOAT_ROUGHNESS),iV=Qe(Ee,Ee.CLEARCOAT_NORMAL),rV=Qe(Ee,Ee.ROTATION),sV=Qe(Ee,Ee.SHEEN),oV=Qe(Ee,Ee.SHEEN_ROUGHNESS),aV=Qe(Ee,Ee.ANISOTROPY),lV=Qe(Ee,Ee.IRIDESCENCE),cV=Qe(Ee,Ee.IRIDESCENCE_IOR),uV=Qe(Ee,Ee.IRIDESCENCE_THICKNESS),dV=Qe(Ee,Ee.TRANSMISSION),hV=Qe(Ee,Ee.THICKNESS),fV=Qe(Ee,Ee.IOR),pV=Qe(Ee,Ee.ATTENUATION_DISTANCE),mV=Qe(Ee,Ee.ATTENUATION_COLOR),gV=Qe(Ee,Ee.LINE_SCALE),yV=Qe(Ee,Ee.LINE_DASH_SIZE),vV=Qe(Ee,Ee.LINE_GAP_SIZE),_V=Qe(Ee,Ee.LINE_WIDTH),xV=Qe(Ee,Ee.LINE_DASH_OFFSET),SV=Qe(Ee,Ee.POINT_SIZE),AV=Qe(Ee,Ee.DISPERSION),bM=Qe(Ee,Ee.LIGHT_MAP),TM=Qe(Ee,Ee.AO),Mc=Rt(new qe).onReference(function(n){return n.material}).onRenderUpdate(function({material:n}){this.value.set(n.anisotropy*Math.cos(n.anisotropyRotation),n.anisotropy*Math.sin(n.anisotropyRotation))}),wM=_e(n=>n.context.setupModelViewProjection(),"vec4").once()().toVarying("v_modelViewProjection");class vn extends ut{static get type(){return"IndexNode"}constructor(e){super("uint"),this.scope=e,this.isIndexNode=!0}generate(e){const t=this.getNodeType(e),i=this.scope;let r;if(i===vn.VERTEX)r=e.getVertexIndex();else if(i===vn.INSTANCE)r=e.getInstanceIndex();else if(i===vn.DRAW)r=e.getDrawIndex();else if(i===vn.INVOCATION_LOCAL)r=e.getInvocationLocalIndex();else if(i===vn.INVOCATION_SUBGROUP)r=e.getInvocationSubgroupIndex();else if(i===vn.SUBGROUP)r=e.getSubgroupIndex();else throw new Error("THREE.IndexNode: Unknown scope: "+i);let s;return e.shaderStage==="vertex"||e.shaderStage==="compute"?s=r:s=tr(this).build(e,t),s}}vn.VERTEX="vertex";vn.INSTANCE="instance";vn.SUBGROUP="subgroup";vn.INVOCATION_LOCAL="invocationLocal";vn.INVOCATION_SUBGROUP="invocationSubgroup";vn.DRAW="draw";const CM=Qe(vn,vn.VERTEX),Kh=Qe(vn,vn.INSTANCE),bV=Qe(vn,vn.SUBGROUP),TV=Qe(vn,vn.INVOCATION_SUBGROUP),wV=Qe(vn,vn.INVOCATION_LOCAL),EM=Qe(vn,vn.DRAW);class MM extends ut{static get type(){return"InstanceNode"}constructor(e,t,i){super("void"),this.count=e,this.instanceMatrix=t,this.instanceColor=i,this.instanceMatrixNode=null,this.instanceColorNode=null,this.updateType=Wt.FRAME,this.buffer=null,this.bufferColor=null}setup(e){const{count:t,instanceMatrix:i,instanceColor:r}=this;let{instanceMatrixNode:s,instanceColorNode:o}=this;if(s===null){if(t<=1e3)s=$h(i.array,"mat4",Math.max(t,1)).element(Kh);else{const l=new ZL(i.array,16,1);this.buffer=l;const c=i.usage===ba?qy:Sm,u=[c(l,"vec4",16,0),c(l,"vec4",16,4),c(l,"vec4",16,8),c(l,"vec4",16,12)];s=Il(...u)}this.instanceMatrixNode=s}if(r&&o===null){const l=new jo(r.array,3),c=r.usage===ba?qy:Sm;this.bufferColor=l,o=ve(c(l,"vec3",3,0)),this.instanceColorNode=o}const a=s.mul(Nn).xyz;if(Nn.assign(a),e.hasGeometryAttribute("normal")){const l=oM(cr,s);cr.assign(l)}this.instanceColorNode!==null&&mh("vec3","vInstanceColor").assign(this.instanceColorNode)}update(){this.instanceMatrix.usage!==ba&&this.buffer!==null&&this.instanceMatrix.version!==this.buffer.version&&(this.buffer.version=this.instanceMatrix.version),this.instanceColor&&this.instanceColor.usage!==ba&&this.bufferColor!==null&&this.instanceColor.version!==this.bufferColor.version&&(this.bufferColor.version=this.instanceColor.version)}}const CV=Pe(MM);class EV extends MM{static get type(){return"InstancedMeshNode"}constructor(e){const{count:t,instanceMatrix:i,instanceColor:r}=e;super(t,i,r),this.instancedMesh=e}}const RM=Pe(EV);class MV extends ut{static get type(){return"BatchNode"}constructor(e){super("void"),this.batchMesh=e,this.batchingIdNode=null}setup(e){this.batchingIdNode===null&&(e.getDrawIndex()===null?this.batchingIdNode=Kh:this.batchingIdNode=EM);const i=_e(([p])=>{const g=de(Pa(Rn(this.batchMesh._indirectTexture),0)),y=de(p).modInt(g),m=de(p).div(g);return Rn(this.batchMesh._indirectTexture,Xn(y,m)).x}).setLayout({name:"getIndirectIndex",type:"uint",inputs:[{name:"id",type:"int"}]})(de(this.batchingIdNode)),r=this.batchMesh._matricesTexture,s=Pa(Rn(r),0),o=ce(i).mul(4).toInt().toVar(),a=o.modInt(s),l=o.div(de(s)),c=Il(Rn(r,Xn(a,l)),Rn(r,Xn(a.add(1),l)),Rn(r,Xn(a.add(2),l)),Rn(r,Xn(a.add(3),l))),u=this.batchMesh._colorsTexture;if(u!==null){const g=_e(([y])=>{const m=Pa(Rn(u),0).x,v=y,x=v.modInt(m),_=v.div(m);return Rn(u,Xn(x,_)).rgb}).setLayout({name:"getBatchingColor",type:"vec3",inputs:[{name:"id",type:"int"}]})(i);mh("vec3","vBatchColor").assign(g)}const d=is(c);Nn.assign(c.mul(Nn));const h=cr.div(ve(d[0].dot(d[0]),d[1].dot(d[1]),d[2].dot(d[2]))),f=d.mul(h).xyz;cr.assign(f),e.hasGeometryAttribute("tangent")&&jh.mulAssign(d)}}const IM=Pe(MV),ab=new WeakMap;class NM extends ut{static get type(){return"SkinningNode"}constructor(e,t=!1){super("void"),this.skinnedMesh=e,this.useReference=t,this.updateType=Wt.OBJECT,this.skinIndexNode=Yo("skinIndex","uvec4"),this.skinWeightNode=Yo("skinWeight","vec4");let i,r,s;t?(i=Pn("bindMatrix","mat4"),r=Pn("bindMatrixInverse","mat4"),s=Xy("skeleton.boneMatrices","mat4",e.skeleton.bones.length)):(i=Rt(e.bindMatrix,"mat4"),r=Rt(e.bindMatrixInverse,"mat4"),s=$h(e.skeleton.boneMatrices,"mat4",e.skeleton.bones.length)),this.bindMatrixNode=i,this.bindMatrixInverseNode=r,this.boneMatricesNode=s,this.previousBoneMatricesNode=null}getSkinnedPosition(e=this.boneMatricesNode,t=Nn){const{skinIndexNode:i,skinWeightNode:r,bindMatrixNode:s,bindMatrixInverseNode:o}=this,a=e.element(i.x),l=e.element(i.y),c=e.element(i.z),u=e.element(i.w),d=s.mul(t),h=On(a.mul(r.x).mul(d),l.mul(r.y).mul(d),c.mul(r.z).mul(d),u.mul(r.w).mul(d));return o.mul(h).xyz}getSkinnedNormal(e=this.boneMatricesNode,t=cr){const{skinIndexNode:i,skinWeightNode:r,bindMatrixNode:s,bindMatrixInverseNode:o}=this,a=e.element(i.x),l=e.element(i.y),c=e.element(i.z),u=e.element(i.w);let d=On(r.x.mul(a),r.y.mul(l),r.z.mul(c),r.w.mul(u));return d=o.mul(d).mul(s),d.transformDirection(t).xyz}getPreviousSkinnedPosition(e){const t=e.object;return this.previousBoneMatricesNode===null&&(t.skeleton.previousBoneMatrices=new Float32Array(t.skeleton.boneMatrices),this.previousBoneMatricesNode=Xy("skeleton.previousBoneMatrices","mat4",t.skeleton.bones.length)),this.getSkinnedPosition(this.previousBoneMatricesNode,Am)}needsPreviousBoneMatrices(e){const t=e.renderer.getMRT();return t&&t.has("velocity")||rC(e.object).useVelocity===!0}setup(e){this.needsPreviousBoneMatrices(e)&&Am.assign(this.getPreviousSkinnedPosition(e));const t=this.getSkinnedPosition();if(Nn.assign(t),e.hasGeometryAttribute("normal")){const i=this.getSkinnedNormal();cr.assign(i),e.hasGeometryAttribute("tangent")&&jh.assign(i)}}generate(e,t){if(t!=="void")return Nn.build(e,t)}update(e){const i=(this.useReference?e.object:this.skinnedMesh).skeleton;ab.get(i)!==e.frameId&&(ab.set(i,e.frameId),this.previousBoneMatricesNode!==null&&i.previousBoneMatrices.set(i.boneMatrices),i.update())}}const RV=n=>Fe(new NM(n)),PM=n=>Fe(new NM(n,!0));class IV extends ut{static get type(){return"LoopNode"}constructor(e=[]){super(),this.params=e}getVarName(e){return String.fromCharCode(105+e)}getProperties(e){const t=e.getNodeProperties(this);if(t.stackNode!==void 0)return t;const i={};for(let s=0,o=this.params.length-1;sNumber(d)?p=">=":p="<"));const y={start:u,end:d},m=y.start,v=y.end;let x="",_="",S="";g||(f==="int"||f==="uint"?p.includes("<")?g="++":g="--":p.includes("<")?g="+= 1.":g="-= 1."),x+=e.getVar(f,h)+" = "+m,_+=h+" "+p+" "+v,S+=h+" "+g;const E="for ( ".concat(x,"; ").concat(_,"; ").concat(S," )");e.addFlowCode((a===0?"\n":"")+e.tab+E+" {\n\n").addFlowTab()}const s=r.build(e,"void"),o=t.returnsNode?t.returnsNode.build(e):"";e.removeFlowTab().addFlowCode("\n"+e.tab+s);for(let a=0,l=this.params.length-1;aFe(new IV(Rl(n,"int"))).append(),NV=()=>Oa("continue").append(),LM=()=>Oa("break").append(),PV=(...n)=>(console.warn("TSL.LoopNode: loop() has been renamed to Loop()."),cn(...n)),jg=new WeakMap,pr=new Mt,lb=_e(({bufferMap:n,influence:e,stride:t,width:i,depth:r,offset:s})=>{const o=de(CM).mul(t).add(s),a=o.div(i),l=o.sub(a.mul(i));return Rn(n,Xn(l,a)).depth(r).mul(e)});function LV(n){const e=n.morphAttributes.position!==void 0,t=n.morphAttributes.normal!==void 0,i=n.morphAttributes.color!==void 0,r=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,s=r!==void 0?r.length:0;let o=jg.get(n);if(o===void 0||o.count!==s){let m=function(){g.dispose(),jg.delete(n),n.removeEventListener("dispose",m)};o!==void 0&&o.texture.dispose();const a=n.morphAttributes.position||[],l=n.morphAttributes.normal||[],c=n.morphAttributes.color||[];let u=0;e===!0&&(u=1),t===!0&&(u=2),i===!0&&(u=3);let d=n.attributes.position.count*u,h=1;const f=4096;d>f&&(h=Math.ceil(d/f),d=f);const p=new Float32Array(d*h*4*s),g=new __(p,d,h,s);g.type=ir,g.needsUpdate=!0;const y=u*4;for(let v=0;v{const h=ce(0).toVar();this.mesh.count>1&&this.mesh.morphTexture!==null&&this.mesh.morphTexture!==void 0?h.assign(Rn(this.mesh.morphTexture,Xn(de(d).add(1),de(Kh))).r):h.assign(Pn("morphTargetInfluences","float").element(d).toVar()),i===!0&&Nn.addAssign(lb({bufferMap:a,influence:h,stride:l,width:u,depth:d,offset:de(0)})),r===!0&&cr.addAssign(lb({bufferMap:a,influence:h,stride:l,width:u,depth:d,offset:de(1)}))})}update(){const e=this.morphBaseInfluence;this.mesh.geometry.morphTargetsRelative?e.value=1:e.value=1-this.mesh.morphTargetInfluences.reduce((t,i)=>t+i,0)}}const DM=Pe(DV);class FM extends ut{static get type(){return"LightingNode"}constructor(){super("vec3"),this.isLightingNode=!0}}class FV extends FM{static get type(){return"AONode"}constructor(e=null){super(),this.aoNode=e}setup(e){e.context.ambientOcclusion.mulAssign(this.aoNode)}}class OV extends CE{static get type(){return"LightingContextNode"}constructor(e,t=null,i=null,r=null){super(e),this.lightingModel=t,this.backdropNode=i,this.backdropAlphaNode=r,this._value=null}getContext(){const{backdropNode:e,backdropAlphaNode:t}=this,i=ve().toVar("directDiffuse"),r=ve().toVar("directSpecular"),s=ve().toVar("indirectDiffuse"),o=ve().toVar("indirectSpecular"),a={directDiffuse:i,directSpecular:r,indirectDiffuse:s,indirectSpecular:o};return{radiance:ve().toVar("radiance"),irradiance:ve().toVar("irradiance"),iblIrradiance:ve().toVar("iblIrradiance"),ambientOcclusion:ce(1).toVar("ambientOcclusion"),reflectedLight:a,backdrop:e,backdropAlpha:t}}setup(e){return this.value=this._value||(this._value=this.getContext()),this.value.lightingModel=this.lightingModel||e.context.lightingModel,super.setup(e)}}const OM=Pe(OV);class BV extends FM{static get type(){return"IrradianceNode"}constructor(e){super(),this.node=e}setup(e){e.context.irradiance.addAssign(this.node)}}let ud,dd;class Vn extends ut{static get type(){return"ScreenNode"}constructor(e){super(),this.scope=e,this.isViewportNode=!0}getNodeType(){return this.scope===Vn.VIEWPORT?"vec4":"vec2"}getUpdateType(){let e=Wt.NONE;return(this.scope===Vn.SIZE||this.scope===Vn.VIEWPORT)&&(e=Wt.RENDER),this.updateType=e,e}update({renderer:e}){const t=e.getRenderTarget();this.scope===Vn.VIEWPORT?t!==null?dd.copy(t.viewport):(e.getViewport(dd),dd.multiplyScalar(e.getPixelRatio())):t!==null?(ud.width=t.width,ud.height=t.height):e.getDrawingBufferSize(ud)}setup(){const e=this.scope;let t=null;return e===Vn.SIZE?t=Rt(ud||(ud=new qe)):e===Vn.VIEWPORT?t=Rt(dd||(dd=new Mt)):t=He(Yh.div(bm)),t}generate(e){if(this.scope===Vn.COORDINATE){let t=e.getFragCoord();if(e.isFlipY()){const i=e.getNodeProperties(bm).outputNode.build(e);t="".concat(e.getType("vec2"),"( ").concat(t,".x, ").concat(i,".y - ").concat(t,".y )")}return t}return super.generate(e)}}Vn.COORDINATE="coordinate";Vn.VIEWPORT="viewport";Vn.SIZE="size";Vn.UV="uv";const Va=Qe(Vn,Vn.UV),bm=Qe(Vn,Vn.SIZE),Yh=Qe(Vn,Vn.COORDINATE),xx=Qe(Vn,Vn.VIEWPORT),BM=xx.zw,kM=Yh.sub(xx.xy),kV=kM.div(BM),UV=_e(()=>(console.warn('TSL.ViewportNode: "viewportResolution" is deprecated. Use "screenSize" instead.'),bm),"vec2").once()(),zV=_e(()=>(console.warn('TSL.ViewportNode: "viewportTopLeft" is deprecated. Use "screenUV" instead.'),Va),"vec2").once()(),VV=_e(()=>(console.warn('TSL.ViewportNode: "viewportBottomLeft" is deprecated. Use "screenUV.flipY()" instead.'),Va.flipY()),"vec2").once()(),hd=new qe;class f0 extends Zo{static get type(){return"ViewportTextureNode"}constructor(e=Va,t=null,i=null){i===null&&(i=new O5,i.minFilter=Hs),super(i,e,t),this.generateMipmaps=!1,this.isOutputTextureNode=!0,this.updateBeforeType=Wt.FRAME}updateBefore(e){const t=e.renderer;t.getDrawingBufferSize(hd);const i=this.value;(i.image.width!==hd.width||i.image.height!==hd.height)&&(i.image.width=hd.width,i.image.height=hd.height,i.needsUpdate=!0);const r=i.generateMipmaps;i.generateMipmaps=this.generateMipmaps,t.copyFramebufferToTexture(i),i.generateMipmaps=r}clone(){const e=new this.constructor(this.uvNode,this.levelNode,this.value);return e.generateMipmaps=this.generateMipmaps,e}}const HV=Pe(f0),$V=Pe(f0,null,null,{generateMipmaps:!0});let qg=null;class GV extends f0{static get type(){return"ViewportDepthTextureNode"}constructor(e=Va,t=null){qg===null&&(qg=new Ua),super(e,t,qg)}}const Sx=Pe(GV);class or extends ut{static get type(){return"ViewportDepthNode"}constructor(e,t=null){super("float"),this.scope=e,this.valueNode=t,this.isViewportDepthNode=!0}generate(e){const{scope:t}=this;return t===or.DEPTH_BASE?e.getFragDepth():super.generate(e)}setup({camera:e}){const{scope:t}=this,i=this.valueNode;let r=null;if(t===or.DEPTH_BASE)i!==null&&(r=zM().assign(i));else if(t===or.DEPTH)e.isPerspectiveCamera?r=UM(Yn.z,_a,xa):r=Xc(Yn.z,_a,xa);else if(t===or.LINEAR_DEPTH)if(i!==null)if(e.isPerspectiveCamera){const s=Ax(i,_a,xa);r=Xc(s,_a,xa)}else r=i;else r=Xc(Yn.z,_a,xa);return r}}or.DEPTH_BASE="depthBase";or.DEPTH="depth";or.LINEAR_DEPTH="linearDepth";const Xc=(n,e,t)=>n.add(e).div(e.sub(t)),WV=(n,e,t)=>e.sub(t).mul(n).sub(e),UM=(n,e,t)=>e.add(n).mul(t).div(t.sub(e).mul(n)),Ax=(n,e,t)=>e.mul(t).div(t.sub(e).mul(n).sub(t)),bx=(n,e,t)=>{e=e.max(1e-6).toVar();const i=Ho(n.negate().div(e)),r=Ho(t.div(e));return i.div(r)},QV=(n,e,t)=>{const i=n.mul(J_(t.div(e)));return ce(Math.E).pow(i).mul(e).negate()},zM=Pe(or,or.DEPTH_BASE),Tx=Qe(or,or.DEPTH),Tm=Pe(or,or.LINEAR_DEPTH),jV=Tm(Sx());Tx.assign=n=>zM(n);class qV extends ut{constructor(e){super("float"),this.name=e,this.isBuiltinNode=!0}generate(){return this.name}}const XV=Pe(qV);class ts extends ut{static get type(){return"ClippingNode"}constructor(e=ts.DEFAULT){super(),this.scope=e}setup(e){super.setup(e);const t=e.clippingContext,{intersectionPlanes:i,unionPlanes:r}=t;return this.hardwareClipping=e.material.hardwareClipping,this.scope===ts.ALPHA_TO_COVERAGE?this.setupAlphaToCoverage(i,r):this.scope===ts.HARDWARE?this.setupHardwareClipping(r,e):this.setupDefault(i,r)}setupAlphaToCoverage(e,t){return _e(()=>{const i=ce().toVar("distanceToPlane"),r=ce().toVar("distanceToGradient"),s=ce(1).toVar("clipOpacity"),o=t.length;if(this.hardwareClipping===!1&&o>0){const l=Do(t);cn(o,({i:c})=>{const u=l.element(c);i.assign(Yn.dot(u.xyz).negate().add(u.w)),r.assign(i.fwidth().div(2)),s.mulAssign(Vl(r.negate(),r,i))})}const a=e.length;if(a>0){const l=Do(e),c=ce(1).toVar("intersectionClipOpacity");cn(a,({i:u})=>{const d=l.element(u);i.assign(Yn.dot(d.xyz).negate().add(d.w)),r.assign(i.fwidth().div(2)),c.mulAssign(Vl(r.negate(),r,i).oneMinus())}),s.mulAssign(c.oneMinus())}hs.a.mulAssign(s),hs.a.equal(0).discard()})()}setupDefault(e,t){return _e(()=>{const i=t.length;if(this.hardwareClipping===!1&&i>0){const s=Do(t);cn(i,({i:o})=>{const a=s.element(o);Yn.dot(a.xyz).greaterThan(a.w).discard()})}const r=e.length;if(r>0){const s=Do(e),o=qo(!0).toVar("clipped");cn(r,({i:a})=>{const l=s.element(a);o.assign(Yn.dot(l.xyz).greaterThan(l.w).and(o))}),o.discard()}})()}setupHardwareClipping(e,t){const i=e.length;return t.enableHardwareClipping(i),_e(()=>{const r=Do(e),s=XV(t.getClipDistance());cn(i,({i:o})=>{const a=r.element(o),l=Yn.dot(a.xyz).sub(a.w).negate();s.element(o).assign(l)})})()}}ts.ALPHA_TO_COVERAGE="alphaToCoverage";ts.DEFAULT="default";ts.HARDWARE="hardware";const KV=()=>Fe(new ts),YV=()=>Fe(new ts(ts.ALPHA_TO_COVERAGE)),ZV=()=>Fe(new ts(ts.HARDWARE)),JV=.05,cb=_e(([n])=>na(St(1e4,wr(St(17,n.x).add(St(.1,n.y)))).mul(On(.1,mn(wr(St(13,n.y).add(n.x))))))),ub=_e(([n])=>cb(He(cb(n.xy),n.z))),eH=_e(([n])=>{const e=ui(xm(ix(n.xyz)),xm(rx(n.xyz))),t=ce(1).div(ce(JV).mul(e)).toVar("pixScale"),i=He(xu(js(Ho(t))),xu(l0(Ho(t)))),r=He(ub(js(i.x.mul(n.xyz))),ub(js(i.y.mul(n.xyz)))),s=na(Ho(t)),o=On(St(s.oneMinus(),r.x),St(s,r.y)),a=Fr(s,s.oneMinus()),l=ve(o.mul(o).div(St(2,a).mul(Bt(1,a))),o.sub(St(.5,a)).div(Bt(1,a)),Bt(1,Bt(1,o).mul(Bt(1,o)).div(St(2,a).mul(Bt(1,a))))),c=o.lessThan(a.oneMinus()).select(o.lessThan(a).select(l.x,l.y),l.z);return Ko(c,1e-6,1)}).setLayout({name:"getAlphaHashThreshold",type:"float",inputs:[{name:"position",type:"vec3"}]});class yh extends es{static get type(){return"NodeMaterial"}get type(){return this.constructor.type}set type(e){}constructor(){super(),this.isNodeMaterial=!0,this.fog=!0,this.lights=!1,this.hardwareClipping=!1,this.lightsNode=null,this.envNode=null,this.aoNode=null,this.colorNode=null,this.normalNode=null,this.opacityNode=null,this.backdropNode=null,this.backdropAlphaNode=null,this.alphaTestNode=null,this.positionNode=null,this.geometryNode=null,this.depthNode=null,this.shadowPositionNode=null,this.receivedShadowNode=null,this.castShadowNode=null,this.outputNode=null,this.mrtNode=null,this.fragmentNode=null,this.vertexNode=null}customProgramCacheKey(){return this.type+nC(this)}build(e){this.setup(e)}setupObserver(e){return new jk(e)}setup(e){e.context.setupNormal=()=>this.setupNormal(e),e.context.setupPositionView=()=>this.setupPositionView(e),e.context.setupModelViewProjection=()=>this.setupModelViewProjection(e);const t=e.renderer,i=t.getRenderTarget();e.addStack();const r=this.vertexNode||this.setupVertex(e);e.stack.outputNode=r,this.setupHardwareClipping(e),this.geometryNode!==null&&(e.stack.outputNode=e.stack.outputNode.bypass(this.geometryNode)),e.addFlow("vertex",e.removeStack()),e.addStack();let s;const o=this.setupClipping(e);if((this.depthWrite===!0||this.depthTest===!0)&&(i!==null?i.depthBuffer===!0&&this.setupDepth(e):t.depth===!0&&this.setupDepth(e)),this.fragmentNode===null){this.setupDiffuseColor(e),this.setupVariants(e);const a=this.setupLighting(e);o!==null&&e.stack.add(o);const l=vt(a,hs.a).max(0);if(s=this.setupOutput(e,l),gh.assign(s),this.outputNode!==null&&(s=this.outputNode),i!==null){const c=t.getMRT(),u=this.mrtNode;c!==null?(s=c,u!==null&&(s=c.merge(u))):u!==null&&(s=u)}}else{let a=this.fragmentNode;a.isOutputStructNode!==!0&&(a=vt(a)),s=this.setupOutput(e,a)}e.stack.outputNode=s,e.addFlow("fragment",e.removeStack()),e.observer=this.setupObserver(e)}setupClipping(e){if(e.clippingContext===null)return null;const{unionPlanes:t,intersectionPlanes:i}=e.clippingContext;let r=null;if(t.length>0||i.length>0){const s=e.renderer.samples;this.alphaToCoverage&&s>1?r=YV():e.stack.add(KV())}return r}setupHardwareClipping(e){if(this.hardwareClipping=!1,e.clippingContext===null)return;const t=e.clippingContext.unionPlanes.length;t>0&&t<=8&&e.isAvailable("clipDistance")&&(e.stack.add(ZV()),this.hardwareClipping=!0)}setupDepth(e){const{renderer:t,camera:i}=e;let r=this.depthNode;if(r===null){const s=t.getMRT();s&&s.has("depth")?r=s.get("depth"):t.logarithmicDepthBuffer===!0&&(i.isPerspectiveCamera?r=bx(Yn.z,_a,xa):r=Xc(Yn.z,_a,xa))}r!==null&&Tx.assign(r).append()}setupPositionView(){return Wh.mul(Nn).xyz}setupModelViewProjection(){return Gh.mul(Yn)}setupVertex(e){return e.addStack(),this.setupPosition(e),e.context.vertex=e.removeStack(),wM}setupPosition(e){const{object:t,geometry:i}=e;if((i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color)&&DM(t).append(),t.isSkinnedMesh===!0&&PM(t).append(),this.displacementMap){const r=ml("displacementMap","texture"),s=ml("displacementScale","float"),o=ml("displacementBias","float");Nn.addAssign(cr.normalize().mul(r.x.mul(s).add(o)))}return t.isBatchedMesh&&IM(t).append(),t.isInstancedMesh&&t.instanceMatrix&&t.instanceMatrix.isInstancedBufferAttribute===!0&&RM(t).append(),this.positionNode!==null&&Nn.assign(this.positionNode.context({isPositionNodeInput:!0})),Nn}setupDiffuseColor({object:e,geometry:t}){let i=this.colorNode?vt(this.colorNode):_M;this.vertexColors===!0&&t.hasAttribute("color")&&(i=vt(i.xyz.mul(Yo("color","vec3")),i.a)),e.instanceColor&&(i=mh("vec3","vInstanceColor").mul(i)),e.isBatchedMesh&&e._colorsTexture&&(i=mh("vec3","vBatchColor").mul(i)),hs.assign(i);const r=this.opacityNode?ce(this.opacityNode):SM;if(hs.a.assign(hs.a.mul(r)),this.alphaTestNode!==null||this.alphaTest>0){const s=this.alphaTestNode!==null?ce(this.alphaTestNode):vM;hs.a.lessThanEqual(s).discard()}this.alphaHash===!0&&hs.a.lessThan(eH(Nn)).discard(),this.transparent===!1&&this.blending===zo&&this.alphaToCoverage===!1&&hs.a.assign(1)}setupVariants(){}setupOutgoingLight(){return this.lights===!0?ve(0):hs.rgb}setupNormal(){return this.normalNode?ve(this.normalNode):AM}setupEnvironment(){let e=null;return this.envNode?e=this.envNode:this.envMap&&(e=this.envMap.isCubeTexture?ml("envMap","cubeTexture"):ml("envMap","texture")),e}setupLightMap(e){let t=null;return e.material.lightMap&&(t=new BV(bM)),t}setupLights(e){const t=[],i=this.setupEnvironment(e);i&&i.isLightingNode&&t.push(i);const r=this.setupLightMap(e);if(r&&r.isLightingNode&&t.push(r),this.aoNode!==null||e.material.aoMap){const o=this.aoNode!==null?this.aoNode:TM;t.push(new FV(o))}let s=this.lightsNode||e.lightsNode;return t.length>0&&(s=e.renderer.lighting.createNode([...s.getLights(),...t])),s}setupLightingModel(){}setupLighting(e){const{material:t}=e,{backdropNode:i,backdropAlphaNode:r,emissiveNode:s}=this,a=this.lights===!0||this.lightsNode!==null?this.setupLights(e):null;let l=this.setupOutgoingLight(e);if(a&&a.getScope().hasLights){const c=this.setupLightingModel(e);l=OM(a,c,i,r)}else i!==null&&(l=ve(r!==null?Ln(l,i,r):i));return(s&&s.isNode===!0||t.emissive&&t.emissive.isColor===!0)&&(Qy.assign(ve(s||xM)),l=l.add(Qy)),l}setupOutput(e,t){if(this.fog===!0){const i=e.fogNode;i&&(gh.assign(t),t=vt(i))}return t}setDefaultValues(e){for(const i in e){const r=e[i];this[i]===void 0&&(this[i]=r,r&&r.clone&&(this[i]=r.clone()))}const t=Object.getOwnPropertyDescriptors(e.constructor.prototype);for(const i in t)Object.getOwnPropertyDescriptor(this.constructor.prototype,i)===void 0&&t[i].get!==void 0&&Object.defineProperty(this.constructor.prototype,i,t[i])}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{},nodes:{}});const i=es.prototype.toJSON.call(this,e),r=ym(this);i.inputNodes={};for(const{property:o,childNode:a}of r)i.inputNodes[o]=a.toJSON(e).uuid;function s(o){const a=[];for(const l in o){const c=o[l];delete c.metadata,a.push(c)}return a}if(t){const o=s(e.textures),a=s(e.images),l=s(e.nodes);o.length>0&&(i.textures=o),a.length>0&&(i.images=a),l.length>0&&(i.nodes=l)}return i}copy(e){return this.lightsNode=e.lightsNode,this.envNode=e.envNode,this.colorNode=e.colorNode,this.normalNode=e.normalNode,this.opacityNode=e.opacityNode,this.backdropNode=e.backdropNode,this.backdropAlphaNode=e.backdropAlphaNode,this.alphaTestNode=e.alphaTestNode,this.positionNode=e.positionNode,this.geometryNode=e.geometryNode,this.depthNode=e.depthNode,this.shadowPositionNode=e.shadowPositionNode,this.receivedShadowNode=e.receivedShadowNode,this.castShadowNode=e.castShadowNode,this.outputNode=e.outputNode,this.mrtNode=e.mrtNode,this.fragmentNode=e.fragmentNode,this.vertexNode=e.vertexNode,super.copy(e)}}let Xg=null;class tH extends f0{static get type(){return"ViewportSharedTextureNode"}constructor(e=Va,t=null){Xg===null&&(Xg=new O5),super(e,t,Xg)}updateReference(){return this}}const nH=Pe(tH),iH=n=>Fe(n).mul(.5).add(.5),rH=n=>Fe(n).mul(2).sub(1);class sH extends kn{static get type(){return"EquirectUVNode"}constructor(e=tM){super("vec2"),this.dirNode=e}setup(){const e=this.dirNode,t=e.z.atan(e.x).mul(1/(Math.PI*2)).add(.5),i=e.y.clamp(-1,1).asin().mul(1/Math.PI).add(.5);return He(t,i)}}const oH=Pe(sH),VM=_e(({f0:n,f90:e,dotVH:t})=>{const i=t.mul(-5.55473).sub(6.98316).mul(t).exp2();return n.mul(i.oneMinus()).add(e.mul(i))}),aH=_e(n=>n.diffuseColor.mul(1/Math.PI)),HM=_e(n=>{if(n.geometry.hasAttribute("normal")===!1)return ce(0);const e=to.dFdx().abs().max(to.dFdy().abs());return e.x.max(e.y).max(e.z)}),lH=_e(n=>{const{roughness:e}=n,t=HM();let i=e.max(.0525);return i=i.add(t),i=i.min(1),i}),$M=_e(({alpha:n,dotNL:e,dotNV:t})=>{const i=n.pow2(),r=e.mul(i.add(i.oneMinus().mul(t.pow2())).sqrt()),s=t.mul(i.add(i.oneMinus().mul(e.pow2())).sqrt());return Xo(.5,r.add(s).max(KC))}).setLayout({name:"V_GGX_SmithCorrelated",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNL",type:"float"},{name:"dotNV",type:"float"}]}),cH=_e(({alphaT:n,alphaB:e,dotTV:t,dotBV:i,dotTL:r,dotBL:s,dotNV:o,dotNL:a})=>{const l=a.mul(ve(n.mul(t),e.mul(i),o).length()),c=o.mul(ve(n.mul(r),e.mul(s),a).length());return Xo(.5,l.add(c)).saturate()}).setLayout({name:"V_GGX_SmithCorrelated_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotTV",type:"float",qualifier:"in"},{name:"dotBV",type:"float",qualifier:"in"},{name:"dotTL",type:"float",qualifier:"in"},{name:"dotBL",type:"float",qualifier:"in"},{name:"dotNV",type:"float",qualifier:"in"},{name:"dotNL",type:"float",qualifier:"in"}]}),GM=_e(({alpha:n,dotNH:e})=>{const t=n.pow2(),i=e.pow2().mul(t.oneMinus()).oneMinus();return t.div(i.pow2()).mul(1/Math.PI)}).setLayout({name:"D_GGX",type:"float",inputs:[{name:"alpha",type:"float"},{name:"dotNH",type:"float"}]}),uH=ce(1/Math.PI),dH=_e(({alphaT:n,alphaB:e,dotNH:t,dotTH:i,dotBH:r})=>{const s=n.mul(e),o=ve(e.mul(i),n.mul(r),s.mul(t)),a=o.dot(o),l=s.div(a);return uH.mul(s.mul(l.pow2()))}).setLayout({name:"D_GGX_Anisotropic",type:"float",inputs:[{name:"alphaT",type:"float",qualifier:"in"},{name:"alphaB",type:"float",qualifier:"in"},{name:"dotNH",type:"float",qualifier:"in"},{name:"dotTH",type:"float",qualifier:"in"},{name:"dotBH",type:"float",qualifier:"in"}]}),hH=_e(n=>{const{lightDirection:e,f0:t,f90:i,roughness:r,f:s,USE_IRIDESCENCE:o,USE_ANISOTROPY:a}=n,l=n.normalView||Jo,c=r.pow2(),u=e.add(Er).normalize(),d=l.dot(e).clamp(),h=l.dot(Er).clamp(),f=l.dot(u).clamp(),p=Er.dot(u).clamp();let g=VM({f0:t,f90:i,dotVH:p}),y,m;if(ph(o)&&(g=IC.mix(g,s)),ph(a)){const v=Ip.dot(e),x=Ip.dot(Er),_=Ip.dot(u),S=qc.dot(e),E=qc.dot(Er),A=qc.dot(u);y=cH({alphaT:jy,alphaB:c,dotTV:x,dotBV:E,dotTL:v,dotBL:S,dotNV:h,dotNL:d}),m=dH({alphaT:jy,alphaB:c,dotNH:f,dotTH:_,dotBH:A})}else y=$M({alpha:c,dotNL:d,dotNV:h}),m=GM({alpha:c,dotNH:f});return g.mul(y).mul(m)}),fH=_e(({roughness:n,dotNV:e})=>{const t=vt(-1,-.0275,-.572,.022),i=vt(1,.0425,1.04,-.04),r=n.mul(t).add(i),s=r.x.mul(r.x).min(e.mul(-9.28).exp2()).mul(r.x).add(r.y);return He(-1.04,1.04).mul(s).add(r.zw)}).setLayout({name:"DFGApprox",type:"vec2",inputs:[{name:"roughness",type:"float"},{name:"dotNV",type:"vec3"}]}),pH=_e(({f:n,f90:e,dotVH:t})=>{const i=t.oneMinus().saturate(),r=i.mul(i),s=i.mul(r,r).clamp(0,.9999);return n.sub(ve(e).mul(s)).div(s.oneMinus())}).setLayout({name:"Schlick_to_F0",type:"vec3",inputs:[{name:"f",type:"vec3"},{name:"f90",type:"float"},{name:"dotVH",type:"float"}]}),p0=1/6,WM=n=>St(p0,St(n,St(n,n.negate().add(3)).sub(3)).add(1)),Yy=n=>St(p0,St(n,St(n,St(3,n).sub(6))).add(4)),QM=n=>St(p0,St(n,St(n,St(-3,n).add(3)).add(3)).add(1)),Zy=n=>St(p0,gs(n,3)),db=n=>WM(n).add(Yy(n)),hb=n=>QM(n).add(Zy(n)),fb=n=>On(-1,Yy(n).div(WM(n).add(Yy(n)))),pb=n=>On(1,Zy(n).div(QM(n).add(Zy(n)))),mb=(n,e,t)=>{const i=n.uvNode,r=St(i,e.zw).add(.5),s=js(r),o=na(r),a=db(o.x),l=hb(o.x),c=fb(o.x),u=pb(o.x),d=fb(o.y),h=pb(o.y),f=He(s.x.add(c),s.y.add(d)).sub(.5).mul(e.xy),p=He(s.x.add(u),s.y.add(d)).sub(.5).mul(e.xy),g=He(s.x.add(c),s.y.add(h)).sub(.5).mul(e.xy),y=He(s.x.add(u),s.y.add(h)).sub(.5).mul(e.xy),m=db(o.y).mul(On(a.mul(n.sample(f).level(t)),l.mul(n.sample(p).level(t)))),v=hb(o.y).mul(On(a.mul(n.sample(g).level(t)),l.mul(n.sample(y).level(t))));return m.add(v)},mH=_e(([n,e=ce(3)])=>{const t=He(n.size(de(e))),i=He(n.size(de(e.add(1)))),r=Xo(1,t),s=Xo(1,i),o=mb(n,vt(r,t),js(e)),a=mb(n,vt(s,i),l0(e));return na(e).mix(o,a)});ve(.04);ce(1);const gb=ce(1),Jy=ce(-2),Kf=ce(.8),Kg=ce(-1),Yf=ce(.4),Yg=ce(2),Zf=ce(.305),Zg=ce(3),yb=ce(.21),gH=ce(4),vb=ce(4),yH=ce(16),vH=_e(([n])=>{const e=ve(mn(n)).toVar(),t=ce(-1).toVar();return Dt(e.x.greaterThan(e.z),()=>{Dt(e.x.greaterThan(e.y),()=>{t.assign(sr(n.x.greaterThan(0),0,3))}).Else(()=>{t.assign(sr(n.y.greaterThan(0),1,4))})}).Else(()=>{Dt(e.z.greaterThan(e.y),()=>{t.assign(sr(n.z.greaterThan(0),2,5))}).Else(()=>{t.assign(sr(n.y.greaterThan(0),1,4))})}),t}).setLayout({name:"getFace",type:"float",inputs:[{name:"direction",type:"vec3"}]}),_H=_e(([n,e])=>{const t=He().toVar();return Dt(e.equal(0),()=>{t.assign(He(n.z,n.y).div(mn(n.x)))}).ElseIf(e.equal(1),()=>{t.assign(He(n.x.negate(),n.z.negate()).div(mn(n.y)))}).ElseIf(e.equal(2),()=>{t.assign(He(n.x.negate(),n.y).div(mn(n.z)))}).ElseIf(e.equal(3),()=>{t.assign(He(n.z.negate(),n.y).div(mn(n.x)))}).ElseIf(e.equal(4),()=>{t.assign(He(n.x.negate(),n.z).div(mn(n.y)))}).Else(()=>{t.assign(He(n.x,n.y).div(mn(n.z)))}),St(.5,t.add(1))}).setLayout({name:"getUV",type:"vec2",inputs:[{name:"direction",type:"vec3"},{name:"face",type:"float"}]}),xH=_e(([n])=>{const e=ce(0).toVar();return Dt(n.greaterThanEqual(Kf),()=>{e.assign(gb.sub(n).mul(Kg.sub(Jy)).div(gb.sub(Kf)).add(Jy))}).ElseIf(n.greaterThanEqual(Yf),()=>{e.assign(Kf.sub(n).mul(Yg.sub(Kg)).div(Kf.sub(Yf)).add(Kg))}).ElseIf(n.greaterThanEqual(Zf),()=>{e.assign(Yf.sub(n).mul(Zg.sub(Yg)).div(Yf.sub(Zf)).add(Yg))}).ElseIf(n.greaterThanEqual(yb),()=>{e.assign(Zf.sub(n).mul(gH.sub(Zg)).div(Zf.sub(yb)).add(Zg))}).Else(()=>{e.assign(ce(-2).mul(Ho(St(1.16,n))))}),e}).setLayout({name:"roughnessToMip",type:"float",inputs:[{name:"roughness",type:"float"}]}),jM=_e(([n,e])=>{const t=n.toVar();t.assign(St(2,t).sub(1));const i=ve(t,1).toVar();return Dt(e.equal(0),()=>{i.assign(i.zyx)}).ElseIf(e.equal(1),()=>{i.assign(i.xzy),i.xz.mulAssign(-1)}).ElseIf(e.equal(2),()=>{i.x.mulAssign(-1)}).ElseIf(e.equal(3),()=>{i.assign(i.zyx),i.xz.mulAssign(-1)}).ElseIf(e.equal(4),()=>{i.assign(i.xzy),i.xy.mulAssign(-1)}).ElseIf(e.equal(5),()=>{i.z.mulAssign(-1)}),i}).setLayout({name:"getDirection",type:"vec3",inputs:[{name:"uv",type:"vec2"},{name:"face",type:"float"}]}),qM=_e(([n,e,t,i,r,s])=>{const o=ce(t),a=ve(e),l=Ko(xH(o),Jy,s),c=na(l),u=js(l),d=ve(ev(n,a,u,i,r,s)).toVar();return Dt(c.notEqual(0),()=>{const h=ve(ev(n,a,u.add(1),i,r,s)).toVar();d.assign(Ln(d,h,c))}),d}),ev=_e(([n,e,t,i,r,s])=>{const o=ce(t).toVar(),a=ve(e),l=ce(vH(a)).toVar(),c=ce(ui(vb.sub(o),0)).toVar();o.assign(ui(o,vb));const u=ce(xu(o)).toVar(),d=He(_H(a,l).mul(u.sub(2)).add(1)).toVar();return Dt(l.greaterThan(2),()=>{d.y.addAssign(u),l.subAssign(3)}),d.x.addAssign(l.mul(u)),d.x.addAssign(c.mul(St(3,yH))),d.y.addAssign(St(4,xu(s).sub(u))),d.x.mulAssign(i),d.y.mulAssign(r),n.sample(d).grad(He(),He())}),Jg=_e(({envMap:n,mipInt:e,outputDirection:t,theta:i,axis:r,CUBEUV_TEXEL_WIDTH:s,CUBEUV_TEXEL_HEIGHT:o,CUBEUV_MAX_MIP:a})=>{const l=Mo(i),c=t.mul(l).add(r.cross(t).mul(wr(i))).add(r.mul(r.dot(t).mul(l.oneMinus())));return ev(n,c,e,s,o,a)}),SH=_e(({n,latitudinal:e,poleAxis:t,outputDirection:i,weights:r,samples:s,dTheta:o,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:d})=>{const h=ve(sr(e,t,u0(t,i))).toVar();Dt(Z_(h.equals(ve(0))),()=>{h.assign(ve(i.z,0,i.x.negate()))}),h.assign(jl(h));const f=ve().toVar();return f.addAssign(r.element(0).mul(Jg({theta:0,axis:h,outputDirection:i,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:d}))),cn({start:de(1),end:n},({i:p})=>{Dt(p.greaterThanEqual(s),()=>{LM()});const g=ce(o.mul(ce(p))).toVar();f.addAssign(r.element(p).mul(Jg({theta:g.mul(-1),axis:h,outputDirection:i,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:d}))),f.addAssign(r.element(p).mul(Jg({theta:g,axis:h,outputDirection:i,mipInt:a,envMap:l,CUBEUV_TEXEL_WIDTH:c,CUBEUV_TEXEL_HEIGHT:u,CUBEUV_MAX_MIP:d})))}),vt(f,1)});let wm=null;const _b=new WeakMap;function AH(n){const e=Math.log2(n)-2,t=1/n;return{texelWidth:1/(3*Math.max(Math.pow(2,e),7*16)),texelHeight:t,maxMip:e}}function bH(n){let e=_b.get(n);if((e!==void 0?e.pmremVersion:-1)!==n.pmremVersion){const i=n.image;if(n.isCubeTexture)if(wH(i))e=wm.fromCubemap(n,e);else return null;else if(CH(i))e=wm.fromEquirectangular(n,e);else return null;e.pmremVersion=n.pmremVersion,_b.set(n,e)}return e.texture}class TH extends kn{static get type(){return"PMREMNode"}constructor(e,t=null,i=null){super("vec3"),this._value=e,this._pmrem=null,this.uvNode=t,this.levelNode=i,this._generator=null;const r=new Wn;r.isRenderTargetTexture=!0,this._texture=er(r),this._width=Rt(0),this._height=Rt(0),this._maxMip=Rt(0),this.updateBeforeType=Wt.RENDER}set value(e){this._value=e,this._pmrem=null}get value(){return this._value}updateFromTexture(e){const t=AH(e.image.height);this._texture.value=e,this._width.value=t.texelWidth,this._height.value=t.texelHeight,this._maxMip.value=t.maxMip}updateBefore(){let e=this._pmrem;const t=e?e.pmremVersion:-1,i=this._value;t!==i.pmremVersion&&(i.isPMREMTexture===!0?e=i:e=bH(i),e!==null&&(this._pmrem=e,this.updateFromTexture(e)))}setup(e){wm===null&&(wm=e.createPMREMGenerator()),this.updateBefore(e);let t=this.uvNode;t===null&&e.context.getUV&&(t=e.context.getUV(this));const i=this.value;e.renderer.coordinateSystem===Ir&&i.isPMREMTexture!==!0&&i.isRenderTargetTexture===!0&&(t=ve(t.x.negate(),t.yz)),t=ve(t.x,t.y.negate(),t.z);let r=this.levelNode;return r===null&&e.context.getTextureLevel&&(r=e.context.getTextureLevel(this)),qM(this._texture,t,r,this._width,this._height,this._maxMip)}}function wH(n){if(n==null)return!1;let e=0;const t=6;for(let i=0;i0}const EH=Pe(TH);class MH extends kn{static get type(){return"MatcapUVNode"}constructor(){super("vec2")}setup(){const e=ve(Er.z,0,Er.x.negate()).normalize(),t=Er.cross(e);return He(e.dot(Jo),t.dot(Jo)).mul(.495).add(.5)}}const RH=Qe(MH);class IH extends kn{static get type(){return"RotateNode"}constructor(e,t){super(),this.positionNode=e,this.rotationNode=t}getNodeType(e){return this.positionNode.getNodeType(e)}setup(e){const{rotationNode:t,positionNode:i}=this;if(this.getNodeType(e)==="vec2"){const s=t.cos(),o=t.sin();return o0(s,o,o.negate(),s).mul(i)}else{const s=t,o=Il(vt(1,0,0,0),vt(0,Mo(s.x),wr(s.x).negate(),0),vt(0,wr(s.x),Mo(s.x),0),vt(0,0,0,1)),a=Il(vt(Mo(s.y),0,wr(s.y),0),vt(0,1,0,0),vt(wr(s.y).negate(),0,Mo(s.y),0),vt(0,0,0,1)),l=Il(vt(Mo(s.z),wr(s.z).negate(),0,0),vt(wr(s.z),Mo(s.z),0,0),vt(0,0,1,0),vt(0,0,0,1));return o.mul(a).mul(l).mul(vt(i,1)).xyz}}}const XM=Pe(IH),NH=_e(({texture:n,uv:e})=>{const i=ve().toVar();return Dt(e.x.lessThan(1e-4),()=>{i.assign(ve(1,0,0))}).ElseIf(e.y.lessThan(1e-4),()=>{i.assign(ve(0,1,0))}).ElseIf(e.z.lessThan(1e-4),()=>{i.assign(ve(0,0,1))}).ElseIf(e.x.greaterThan(1-1e-4),()=>{i.assign(ve(-1,0,0))}).ElseIf(e.y.greaterThan(1-1e-4),()=>{i.assign(ve(0,-1,0))}).ElseIf(e.z.greaterThan(1-1e-4),()=>{i.assign(ve(0,0,-1))}).Else(()=>{const s=n.sample(e.add(ve(-.01,0,0))).r.sub(n.sample(e.add(ve(.01,0,0))).r),o=n.sample(e.add(ve(0,-.01,0))).r.sub(n.sample(e.add(ve(0,.01,0))).r),a=n.sample(e.add(ve(0,0,-.01))).r.sub(n.sample(e.add(ve(0,0,.01))).r);i.assign(ve(s,o,a))}),i.normalize()});class PH extends Zo{static get type(){return"Texture3DNode"}constructor(e,t=null,i=null){super(e,t,i),this.isTexture3DNode=!0}getInputType(){return"texture3D"}getDefaultUV(){return ve(.5,.5,.5)}setUpdateMatrix(){}setupUV(e,t){const i=this.value;return e.isFlipY()&&(i.isRenderTargetTexture===!0||i.isFramebufferTexture===!0)&&(this.sampler?t=t.flipY():t=t.setY(de(Pa(this,this.levelNode).y).sub(t.y).sub(1))),t}generateUV(e,t){return t.build(e,"vec3")}normal(e){return NH({texture:this,uv:e})}}const LH=Pe(PH);class DH extends qt{static get type(){return"ParameterNode"}constructor(e,t=null){super(e,t),this.isParameterNode=!0}getHash(){return this.uuid}generate(){return this.name}}const FH=(n,e)=>Fe(new DH(n,e));class OH extends ut{static get type(){return"StackNode"}constructor(e=null){super(),this.nodes=[],this.outputNode=null,this.parent=e,this._currentCond=null,this.isStackNode=!0}getNodeType(e){return this.outputNode?this.outputNode.getNodeType(e):"void"}getMemberType(e,t){return this.outputNode?this.outputNode.getMemberType(e,t):"void"}add(e){return this.nodes.push(e),this}If(e,t){const i=new $d(t);return this._currentCond=sr(e,i),this.add(this._currentCond)}ElseIf(e,t){const i=new $d(t),r=sr(e,i);return this._currentCond.elseNode=r,this._currentCond=r,this}Else(e){return this._currentCond.elseNode=new $d(e),this}build(e,...t){const i=fC();Wy(this);for(const r of this.nodes)r.build(e,"void");return Wy(i),this.outputNode?this.outputNode.build(e,...t):super.build(e,...t)}else(...e){return console.warn("TSL.StackNode: .else() has been renamed to .Else()."),this.Else(...e)}elseif(...e){return console.warn("TSL.StackNode: .elseif() has been renamed to .ElseIf()."),this.ElseIf(...e)}}const BH=Pe(OH);function kH(n){return Object.entries(n).map(([e,t])=>typeof t=="string"?{name:e,type:t,atomic:!1}:{name:e,type:t.type,atomic:t.atomic||!1})}class UH extends ut{static get type(){return"StructTypeNode"}constructor(e,t=null){super("struct"),this.membersLayout=kH(e),this.name=t,this.isStructLayoutNode=!0}getLength(){let e=0;for(const t of this.membersLayout)e+=G_(t.type);return e}getMemberType(e,t){const i=this.membersLayout.find(r=>r.name===t);return i?i.type:"void"}getNodeType(e){return e.getStructTypeFromNode(this,this.membersLayout,this.name).name}generate(e){return this.getNodeType(e)}}class zH extends ut{static get type(){return"StructNode"}constructor(e,t){super("vec3"),this.structLayoutNode=e,this.values=t,this.isStructNode=!0}getNodeType(e){return this.structLayoutNode.getNodeType(e)}getMemberType(e,t){return this.structLayoutNode.getMemberType(e,t)}generate(e){const t=e.getVarFromNode(this),i=t.type,r=e.getPropertyName(t);return e.addLineFlowCode("".concat(r," = ").concat(e.generateStruct(i,this.structLayoutNode.membersLayout,this.values)),this),t.name}}const VH=(n,e=null)=>{const t=new UH(n,e),i=(...r)=>{let s=null;if(r.length>0)if(r[0].isNode){s={};const o=Object.keys(n);for(let a=0;a{const e=n.toUint().mul(747796405).add(2891336453),t=e.shiftRight(e.shiftRight(28).add(4)).bitXor(e).mul(277803737);return t.shiftRight(22).bitXor(t).toFloat().mul(1/2**32)}),tv=(n,e)=>gs(St(4,n.mul(Bt(1,n))),e),WH=(n,e)=>n.lessThan(.5)?tv(n.mul(2),e).div(2):Bt(1,tv(St(Bt(1,n),2),e).div(2)),QH=(n,e,t)=>gs(Xo(gs(n,e),On(gs(n,e),gs(Bt(1,n),t))),1/e),jH=(n,e)=>wr(_m.mul(e.mul(n).sub(1))).div(_m.mul(e.mul(n).sub(1))),Ro=_e(([n])=>n.fract().sub(.5).abs()).setLayout({name:"tri",type:"float",inputs:[{name:"x",type:"float"}]}),qH=_e(([n])=>ve(Ro(n.z.add(Ro(n.y.mul(1)))),Ro(n.z.add(Ro(n.x.mul(1)))),Ro(n.y.add(Ro(n.x.mul(1)))))).setLayout({name:"tri3",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),XH=_e(([n,e,t])=>{const i=ve(n).toVar(),r=ce(1.4).toVar(),s=ce(0).toVar(),o=ve(i).toVar();return cn({start:ce(0),end:ce(3),type:"float",condition:"<="},()=>{const a=ve(qH(o.mul(2))).toVar();i.addAssign(a.add(t.mul(ce(.1).mul(e)))),o.mulAssign(1.8),r.mulAssign(1.5),i.mulAssign(1.2);const l=ce(Ro(i.z.add(Ro(i.x.add(Ro(i.y)))))).toVar();s.addAssign(l.div(r)),o.addAssign(.14)}),s}).setLayout({name:"triNoise3D",type:"float",inputs:[{name:"position",type:"vec3"},{name:"speed",type:"float"},{name:"time",type:"float"}]});class KH extends ut{static get type(){return"FunctionOverloadingNode"}constructor(e=[],...t){super(),this.functionNodes=e,this.parametersNodes=t,this._candidateFnCall=null,this.global=!0}getNodeType(){return this.functionNodes[0].shaderNode.layout.type}setup(e){const t=this.parametersNodes;let i=this._candidateFnCall;if(i===null){let r=null,s=-1;for(const o of this.functionNodes){const l=o.shaderNode.layout;if(l===null)throw new Error("FunctionOverloadingNode: FunctionNode must be a layout.");const c=l.inputs;if(t.length===c.length){let u=0;for(let d=0;ds&&(r=o,s=u)}}this._candidateFnCall=i=r(...t)}return i}}const YH=Pe(KH),bi=n=>(...e)=>YH(n,...e),ql=Rt(0).setGroup(kt).onRenderUpdate(n=>n.time),JM=Rt(0).setGroup(kt).onRenderUpdate(n=>n.deltaTime),ZH=Rt(0,"uint").setGroup(kt).onRenderUpdate(n=>n.frameId),JH=(n=1)=>(console.warn('TSL: timerLocal() is deprecated. Use "time" instead.'),ql.mul(n)),e$=(n=1)=>(console.warn('TSL: timerGlobal() is deprecated. Use "time" instead.'),ql.mul(n)),t$=(n=1)=>(console.warn('TSL: timerDelta() is deprecated. Use "deltaTime" instead.'),JM.mul(n)),n$=(n=ql)=>n.add(.75).mul(Math.PI*2).sin().mul(.5).add(.5),i$=(n=ql)=>n.fract().round(),r$=(n=ql)=>n.add(.5).fract().mul(2).sub(1).abs(),s$=(n=ql)=>n.fract(),o$=_e(([n,e,t=He(.5)])=>XM(n.sub(t),e).add(t)),a$=_e(([n,e,t=He(.5)])=>{const i=n.sub(t),r=i.dot(i),o=r.mul(r).mul(e);return n.add(i.mul(o))}),l$=_e(({position:n=null,horizontal:e=!0,vertical:t=!1})=>{let i;n!==null?(i=Fo.toVar(),i[3][0]=n.x,i[3][1]=n.y,i[3][2]=n.z):i=Fo;const r=ss.mul(i);return ph(e)&&(r[0][0]=Fo[0].length(),r[0][1]=0,r[0][2]=0),ph(t)&&(r[1][0]=0,r[1][1]=Fo[1].length(),r[1][2]=0),r[2][0]=0,r[2][1]=0,r[2][2]=1,Gh.mul(r).mul(Nn)}),c$=_e(([n=null])=>{const e=Tm();return Tm(Sx(n)).sub(e).lessThan(0).select(Va,n)});class u$ extends ut{static get type(){return"SpriteSheetUVNode"}constructor(e,t=xn(),i=ce(0)){super("vec2"),this.countNode=e,this.uvNode=t,this.frameNode=i}setup(){const{frameNode:e,uvNode:t,countNode:i}=this,{width:r,height:s}=i,o=e.mod(r.mul(s)).floor(),a=o.mod(r),l=s.sub(o.add(1).div(r).ceil()),c=i.reciprocal(),u=He(a,l);return t.add(u).mul(c)}}const d$=Pe(u$);class h$ extends ut{static get type(){return"TriplanarTexturesNode"}constructor(e,t=null,i=null,r=ce(1),s=Nn,o=cr){super("vec4"),this.textureXNode=e,this.textureYNode=t,this.textureZNode=i,this.scaleNode=r,this.positionNode=s,this.normalNode=o}setup(){const{textureXNode:e,textureYNode:t,textureZNode:i,scaleNode:r,positionNode:s,normalNode:o}=this;let a=o.abs().normalize();a=a.div(a.dot(ve(1)));const l=s.yz.mul(r),c=s.zx.mul(r),u=s.xy.mul(r),d=e.value,h=t!==null?t.value:d,f=i!==null?i.value:d,p=er(d,l).mul(a.x),g=er(h,c).mul(a.y),y=er(f,u).mul(a.z);return On(p,g,y)}}const e4=Pe(h$),f$=(...n)=>e4(...n),Sc=new Co,il=new Y,Ac=new Y,e1=new Y,fd=new Xe,Jf=new Y(0,0,-1),Rs=new Mt,pd=new Y,ep=new Y,md=new Mt,tp=new qe,Cm=new Fh,p$=Va.flipX();Cm.depthTexture=new Ua(1,1);let t1=!1;class wx extends Zo{static get type(){return"ReflectorNode"}constructor(e={}){super(e.defaultTexture||Cm.texture,p$),this._reflectorBaseNode=e.reflector||new m$(this,e),this._depthNode=null,this.setUpdateMatrix(!1)}get reflector(){return this._reflectorBaseNode}get target(){return this._reflectorBaseNode.target}getDepthNode(){if(this._depthNode===null){if(this._reflectorBaseNode.depth!==!0)throw new Error("THREE.ReflectorNode: Depth node can only be requested when the reflector is created with { depth: true }. ");this._depthNode=Fe(new wx({defaultTexture:Cm.depthTexture,reflector:this._reflectorBaseNode}))}return this._depthNode}setup(e){return e.object.isQuadMesh||this._reflectorBaseNode.build(e),super.setup(e)}clone(){const e=new this.constructor(this.reflectorNode);return e._reflectorBaseNode=this._reflectorBaseNode,e}}class m$ extends ut{static get type(){return"ReflectorBaseNode"}constructor(e,t={}){super();const{target:i=new nn,resolution:r=1,generateMipmaps:s=!1,bounces:o=!0,depth:a=!1}=t;this.textureNode=e,this.target=i,this.resolution=r,this.generateMipmaps=s,this.bounces=o,this.depth=a,this.updateBeforeType=o?Wt.RENDER:Wt.FRAME,this.virtualCameras=new WeakMap,this.renderTargets=new WeakMap}_updateResolution(e,t){const i=this.resolution;t.getDrawingBufferSize(tp),e.setSize(Math.round(tp.width*i),Math.round(tp.height*i))}setup(e){return this._updateResolution(Cm,e.renderer),super.setup(e)}getVirtualCamera(e){let t=this.virtualCameras.get(e);return t===void 0&&(t=e.clone(),this.virtualCameras.set(e,t)),t}getRenderTarget(e){let t=this.renderTargets.get(e);return t===void 0&&(t=new Fh(0,0,{type:Ts}),this.generateMipmaps===!0&&(t.texture.minFilter=eP,t.texture.generateMipmaps=!0),this.depth===!0&&(t.depthTexture=new Ua),this.renderTargets.set(e,t)),t}updateBefore(e){if(this.bounces===!1&&t1)return!1;t1=!0;const{scene:t,camera:i,renderer:r,material:s}=e,{target:o}=this,a=this.getVirtualCamera(i),l=this.getRenderTarget(a);if(r.getDrawingBufferSize(tp),this._updateResolution(l,r),Ac.setFromMatrixPosition(o.matrixWorld),e1.setFromMatrixPosition(i.matrixWorld),fd.extractRotation(o.matrixWorld),il.set(0,0,1),il.applyMatrix4(fd),pd.subVectors(Ac,e1),pd.dot(il)>0)return;pd.reflect(il).negate(),pd.add(Ac),fd.extractRotation(i.matrixWorld),Jf.set(0,0,-1),Jf.applyMatrix4(fd),Jf.add(e1),ep.subVectors(Ac,Jf),ep.reflect(il).negate(),ep.add(Ac),a.coordinateSystem=i.coordinateSystem,a.position.copy(pd),a.up.set(0,1,0),a.up.applyMatrix4(fd),a.up.reflect(il),a.lookAt(ep),a.near=i.near,a.far=i.far,a.updateMatrixWorld(),a.projectionMatrix.copy(i.projectionMatrix),Sc.setFromNormalAndCoplanarPoint(il,Ac),Sc.applyMatrix4(a.matrixWorldInverse),Rs.set(Sc.normal.x,Sc.normal.y,Sc.normal.z,Sc.constant);const c=a.projectionMatrix;md.x=(Math.sign(Rs.x)+c.elements[8])/c.elements[0],md.y=(Math.sign(Rs.y)+c.elements[9])/c.elements[5],md.z=-1,md.w=(1+c.elements[10])/c.elements[14],Rs.multiplyScalar(1/Rs.dot(md));const u=0;c.elements[2]=Rs.x,c.elements[6]=Rs.y,c.elements[10]=r.coordinateSystem===Qo?Rs.z-u:Rs.z+1-u,c.elements[14]=Rs.w,this.textureNode.value=l.texture,this.depth===!0&&(this.textureNode.getDepthNode().value=l.depthTexture),s.visible=!1;const d=r.getRenderTarget(),h=r.getMRT(),f=r.autoClear;r.setMRT(null),r.setRenderTarget(l),r.autoClear=!0,r.render(t,a),r.setMRT(h),r.setRenderTarget(d),r.autoClear=f,s.visible=!0,t1=!1}}const g$=n=>Fe(new wx(n)),n1=new Ou(-1,1,1,-1,0,1);class y$ extends ki{constructor(e=!1){super();const t=e===!1?[0,-1,0,1,2,1]:[0,2,0,0,2,0];this.setAttribute("position",new Si([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new Si(t,2))}}const v$=new y$;class t4 extends pn{constructor(e=null){super(v$,e),this.camera=n1,this.isQuadMesh=!0}async renderAsync(e){return e.renderAsync(this,n1)}render(e){e.render(this,n1)}}const _$=new qe;class x$ extends Zo{static get type(){return"RTTNode"}constructor(e,t=null,i=null,r={type:Ts}){const s=new Fh(t,i,r);super(s.texture,xn()),this.node=e,this.width=t,this.height=i,this.pixelRatio=1,this.renderTarget=s,this.textureNeedsUpdate=!0,this.autoUpdate=!0,this._rttNode=null,this._quadMesh=new t4(new yh),this.updateBeforeType=Wt.RENDER}get autoSize(){return this.width===null}setup(e){return this._rttNode=this.node.context(e.getSharedContext()),this._quadMesh.material.name="RTT",this._quadMesh.material.needsUpdate=!0,super.setup(e)}setSize(e,t){this.width=e,this.height=t;const i=e*this.pixelRatio,r=t*this.pixelRatio;this.renderTarget.setSize(i,r),this.textureNeedsUpdate=!0}setPixelRatio(e){this.pixelRatio=e,this.setSize(this.width,this.height)}updateBefore({renderer:e}){if(this.textureNeedsUpdate===!1&&this.autoUpdate===!1)return;if(this.textureNeedsUpdate=!1,this.autoSize===!0){this.pixelRatio=e.getPixelRatio();const i=e.getSize(_$);this.setSize(i.width,i.height)}this._quadMesh.material.fragmentNode=this._rttNode;const t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),this._quadMesh.render(e),e.setRenderTarget(t)}clone(){const e=new Zo(this.value,this.uvNode,this.levelNode);return e.sampler=this.sampler,e.referenceNode=this,e}}const n4=(n,...e)=>Fe(new x$(Fe(n),...e)),S$=(n,...e)=>n.isTextureNode?n:n.isPassNode?n.getTextureNode():n4(n,...e),Rc=_e(([n,e,t],i)=>{let r;i.renderer.coordinateSystem===Qo?(n=He(n.x,n.y.oneMinus()).mul(2).sub(1),r=vt(ve(n,e),1)):r=vt(ve(n.x,n.y.oneMinus(),e).mul(2).sub(1),1);const s=vt(t.mul(r));return s.xyz.div(s.w)}),A$=_e(([n,e])=>{const t=e.mul(vt(n,1)),i=t.xy.div(t.w).mul(.5).add(.5).toVar();return He(i.x,i.y.oneMinus())}),b$=_e(([n,e,t])=>{const i=Pa(Rn(e)),r=Xn(n.mul(i)).toVar(),s=Rn(e,r).toVar(),o=Rn(e,r.sub(Xn(2,0))).toVar(),a=Rn(e,r.sub(Xn(1,0))).toVar(),l=Rn(e,r.add(Xn(1,0))).toVar(),c=Rn(e,r.add(Xn(2,0))).toVar(),u=Rn(e,r.add(Xn(0,2))).toVar(),d=Rn(e,r.add(Xn(0,1))).toVar(),h=Rn(e,r.sub(Xn(0,1))).toVar(),f=Rn(e,r.sub(Xn(0,2))).toVar(),p=mn(Bt(ce(2).mul(a).sub(o),s)).toVar(),g=mn(Bt(ce(2).mul(l).sub(c),s)).toVar(),y=mn(Bt(ce(2).mul(d).sub(u),s)).toVar(),m=mn(Bt(ce(2).mul(h).sub(f),s)).toVar(),v=Rc(n,s,t).toVar(),x=p.lessThan(g).select(v.sub(Rc(n.sub(He(ce(1).div(i.x),0)),a,t)),v.negate().add(Rc(n.add(He(ce(1).div(i.x),0)),l,t))),_=y.lessThan(m).select(v.sub(Rc(n.add(He(0,ce(1).div(i.y))),d,t)),v.negate().add(Rc(n.sub(He(0,ce(1).div(i.y))),h,t)));return jl(u0(x,_))});class T$ extends jo{constructor(e,t,i=Float32Array){const r=ArrayBuffer.isView(e)?e:new i(e*t);super(r,t),this.isStorageInstancedBufferAttribute=!0}}class w$ extends xi{constructor(e,t,i=Float32Array){const r=ArrayBuffer.isView(e)?e:new i(e*t);super(r,t),this.isStorageBufferAttribute=!0}}class C$ extends Ql{static get type(){return"StorageArrayElementNode"}constructor(e,t){super(e,t),this.isStorageArrayElementNode=!0}set storageBufferNode(e){this.node=e}get storageBufferNode(){return this.node}getMemberType(e,t){const i=this.storageBufferNode.structTypeNode;return i?i.getMemberType(e,t):"void"}setup(e){return e.isAvailable("storageBuffer")===!1&&this.node.isPBO===!0&&e.setupPBO(this.node),super.setup(e)}generate(e,t){let i;const r=e.context.assign;if(e.isAvailable("storageBuffer")===!1?this.node.isPBO===!0&&r!==!0&&(this.node.value.isInstancedBufferAttribute||e.shaderStage!=="compute")?i=e.generatePBO(this):i=this.node.build(e):i=super.generate(e),r!==!0){const s=this.getNodeType(e);i=e.format(i,s,t)}return i}}const E$=Pe(C$);class M$ extends fx{static get type(){return"StorageBufferNode"}constructor(e,t=null,i=0){let r,s=null;t&&t.isStruct?(r="struct",s=t.layout):t===null&&(e.isStorageBufferAttribute||e.isStorageInstancedBufferAttribute)?(r=Kk(e.itemSize),i=e.count):r=t,super(e,r,i),this.isStorageBufferNode=!0,this.structTypeNode=s,this.access=Gs.READ_WRITE,this.isAtomic=!1,this.isPBO=!1,this._attribute=null,this._varying=null,this.global=!0,e.isStorageBufferAttribute!==!0&&e.isStorageInstancedBufferAttribute!==!0&&(e.isInstancedBufferAttribute?e.isStorageInstancedBufferAttribute=!0:e.isStorageBufferAttribute=!0)}getHash(e){if(this.bufferCount===0){let t=e.globalCache.getData(this.value);return t===void 0&&(t={node:this},e.globalCache.setData(this.value,t)),t.node.uuid}return this.uuid}getInputType(){return this.value.isIndirectStorageBufferAttribute?"indirectStorageBuffer":"storageBuffer"}element(e){return E$(this,e)}setPBO(e){return this.isPBO=e,this}getPBO(){return this.isPBO}setAccess(e){return this.access=e,this}toReadOnly(){return this.setAccess(Gs.READ_ONLY)}setAtomic(e){return this.isAtomic=e,this}toAtomic(){return this.setAtomic(!0)}getAttributeData(){return this._attribute===null&&(this._attribute=Hh(this.value),this._varying=tr(this._attribute)),{attribute:this._attribute,varying:this._varying}}getNodeType(e){if(this.structTypeNode!==null)return this.structTypeNode.getNodeType(e);if(e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.getNodeType(e);const{attribute:t}=this.getAttributeData();return t.getNodeType(e)}generate(e){if(this.structTypeNode!==null&&this.structTypeNode.build(e),e.isAvailable("storageBuffer")||e.isAvailable("indirectStorageBuffer"))return super.generate(e);const{attribute:t,varying:i}=this.getAttributeData(),r=i.build(e);return e.registerTransform(r,t),r}}const m0=(n,e=null,t=0)=>Fe(new M$(n,e,t)),R$=(n,e,t)=>(console.warn('THREE.TSL: "storageObject()" is deprecated. Use "storage().setPBO( true )" instead.'),m0(n,e,t).setPBO(!0)),I$=(n,e="float")=>{let t,i;e.isStruct===!0?(t=e.layout.getLength(),i=vm("float")):(t=G_(e),i=vm(e));const r=new w$(n,t,i);return m0(r,e,n)},N$=(n,e="float")=>{let t,i;e.isStruct===!0?(t=e.layout.getLength(),i=vm("float")):(t=G_(e),i=vm(e));const r=new T$(n,t,i);return m0(r,e,n)};class P$ extends XE{static get type(){return"VertexColorNode"}constructor(e=0){super(null,"vec4"),this.isVertexColorNode=!0,this.index=e}getAttributeName(){const e=this.index;return"color"+(e>0?e:"")}generate(e){const t=this.getAttributeName(e),i=e.hasGeometryAttribute(t);let r;return i===!0?r=super.generate(e):r=e.generateConst(this.nodeType,new Mt(1,1,1,1)),r}serialize(e){super.serialize(e),e.index=this.index}deserialize(e){super.deserialize(e),this.index=e.index}}const L$=n=>Fe(new P$(n));class D$ extends ut{static get type(){return"PointUVNode"}constructor(){super("vec2"),this.isPointUVNode=!0}generate(){return"vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y )"}}const F$=Qe(D$),gd=new ws,i1=new Xe;class ar extends ut{static get type(){return"SceneNode"}constructor(e=ar.BACKGROUND_BLURRINESS,t=null){super(),this.scope=e,this.scene=t}setup(e){const t=this.scope,i=this.scene!==null?this.scene:e.scene;let r;return t===ar.BACKGROUND_BLURRINESS?r=Pn("backgroundBlurriness","float",i):t===ar.BACKGROUND_INTENSITY?r=Pn("backgroundIntensity","float",i):t===ar.BACKGROUND_ROTATION?r=Rt("mat4").label("backgroundRotation").setGroup(kt).onRenderUpdate(()=>{const s=i.background;return s!==null&&s.isTexture&&s.mapping!==h_?(gd.copy(i.backgroundRotation),gd.x*=-1,gd.y*=-1,gd.z*=-1,i1.makeRotationFromEuler(gd)):i1.identity(),i1}):console.error("THREE.SceneNode: Unknown scope:",t),r}}ar.BACKGROUND_BLURRINESS="backgroundBlurriness";ar.BACKGROUND_INTENSITY="backgroundIntensity";ar.BACKGROUND_ROTATION="backgroundRotation";const O$=Qe(ar,ar.BACKGROUND_BLURRINESS),B$=Qe(ar,ar.BACKGROUND_INTENSITY),k$=Qe(ar,ar.BACKGROUND_ROTATION);class U$ extends Zo{static get type(){return"StorageTextureNode"}constructor(e,t,i=null){super(e,t),this.storeNode=i,this.isStorageTextureNode=!0,this.access=Gs.WRITE_ONLY}getInputType(){return"storageTexture"}setup(e){super.setup(e);const t=e.getNodeProperties(this);t.storeNode=this.storeNode}setAccess(e){return this.access=e,this}generate(e,t){let i;return this.storeNode!==null?i=this.generateStore(e):i=super.generate(e,t),i}toReadWrite(){return this.setAccess(Gs.READ_WRITE)}toReadOnly(){return this.setAccess(Gs.READ_ONLY)}toWriteOnly(){return this.setAccess(Gs.WRITE_ONLY)}generateStore(e){const t=e.getNodeProperties(this),{uvNode:i,storeNode:r}=t,s=super.generate(e,"property"),o=i.build(e,"uvec2"),a=r.build(e,"vec4"),l=e.generateTextureStore(e,s,o,a);e.addLineFlowCode(l,this)}}const i4=Pe(U$),z$=(n,e,t)=>{const i=i4(n,e,t);return t!==null&&i.append(),i};class V$ extends d0{static get type(){return"UserDataNode"}constructor(e,t,i=null){super(e,t,i),this.userData=i}updateReference(e){return this.reference=this.userData!==null?this.userData:e.object.userData,this.reference}}const H$=(n,e,t)=>Fe(new V$(n,e,t)),xb=new WeakMap;class $$ extends kn{static get type(){return"VelocityNode"}constructor(){super("vec2"),this.projectionMatrix=null,this.updateType=Wt.OBJECT,this.updateAfterType=Wt.OBJECT,this.previousModelWorldMatrix=Rt(new Xe),this.previousProjectionMatrix=Rt(new Xe).setGroup(kt),this.previousCameraViewMatrix=Rt(new Xe)}setProjectionMatrix(e){this.projectionMatrix=e}update({frameId:e,camera:t,object:i}){const r=Sb(i);this.previousModelWorldMatrix.value.copy(r);const s=r4(t);s.frameId!==e&&(s.frameId=e,s.previousProjectionMatrix===void 0?(s.previousProjectionMatrix=new Xe,s.previousCameraViewMatrix=new Xe,s.currentProjectionMatrix=new Xe,s.currentCameraViewMatrix=new Xe,s.previousProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.previousCameraViewMatrix.copy(t.matrixWorldInverse)):(s.previousProjectionMatrix.copy(s.currentProjectionMatrix),s.previousCameraViewMatrix.copy(s.currentCameraViewMatrix)),s.currentProjectionMatrix.copy(this.projectionMatrix||t.projectionMatrix),s.currentCameraViewMatrix.copy(t.matrixWorldInverse),this.previousProjectionMatrix.value.copy(s.previousProjectionMatrix),this.previousCameraViewMatrix.value.copy(s.previousCameraViewMatrix))}updateAfter({object:e}){Sb(e).copy(e.matrixWorld)}setup(){const e=this.projectionMatrix===null?Gh:Rt(this.projectionMatrix),t=this.previousCameraViewMatrix.mul(this.previousModelWorldMatrix),i=e.mul(Wh).mul(Nn),r=this.previousProjectionMatrix.mul(t).mul(Am),s=i.xy.div(i.w),o=r.xy.div(r.w);return Bt(s,o)}}function r4(n){let e=xb.get(n);return e===void 0&&(e={},xb.set(n,e)),e}function Sb(n,e=0){const t=r4(n);let i=t[e];return i===void 0&&(t[e]=i=new Xe),i}const G$=Qe($$),s4=_e(([n,e])=>Fr(1,n.oneMinus().div(e)).oneMinus()).setLayout({name:"blendBurn",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),o4=_e(([n,e])=>Fr(n.div(e.oneMinus()),1)).setLayout({name:"blendDodge",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),a4=_e(([n,e])=>n.oneMinus().mul(e.oneMinus()).oneMinus()).setLayout({name:"blendScreen",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),l4=_e(([n,e])=>Ln(n.mul(2).mul(e),n.oneMinus().mul(2).mul(e.oneMinus()).oneMinus(),c0(.5,n))).setLayout({name:"blendOverlay",type:"vec3",inputs:[{name:"base",type:"vec3"},{name:"blend",type:"vec3"}]}),W$=_e(([n,e])=>{const t=e.a.add(n.a.mul(e.a.oneMinus()));return vt(e.rgb.mul(e.a).add(n.rgb.mul(n.a).mul(e.a.oneMinus())).div(t),t)}).setLayout({name:"blendColor",type:"vec4",inputs:[{name:"base",type:"vec4"},{name:"blend",type:"vec4"}]}),Q$=(...n)=>(console.warn('THREE.TSL: "burn" has been renamed. Use "blendBurn" instead.'),s4(n)),j$=(...n)=>(console.warn('THREE.TSL: "dodge" has been renamed. Use "blendDodge" instead.'),o4(n)),q$=(...n)=>(console.warn('THREE.TSL: "screen" has been renamed. Use "blendScreen" instead.'),a4(n)),X$=(...n)=>(console.warn('THREE.TSL: "overlay" has been renamed. Use "blendOverlay" instead.'),l4(n)),K$=_e(([n])=>Cx(n.rgb)),Y$=_e(([n,e=ce(1)])=>e.mix(Cx(n.rgb),n.rgb)),Z$=_e(([n,e=ce(1)])=>{const t=On(n.r,n.g,n.b).div(3),i=n.r.max(n.g.max(n.b)),r=i.sub(t).mul(e).mul(-3);return Ln(n.rgb,i,r)}),J$=_e(([n,e=ce(1)])=>{const t=ve(.57735,.57735,.57735),i=e.cos();return ve(n.rgb.mul(i).add(t.cross(n.rgb).mul(e.sin()).add(t.mul(za(t,n.rgb).mul(i.oneMinus())))))}),Cx=(n,e=ve(wt.getLuminanceCoefficients(new Y)))=>za(n,e),eG=_e(([n,e=ve(1),t=ve(0),i=ve(1),r=ce(1),s=ve(wt.getLuminanceCoefficients(new Y,Bi))])=>{const o=n.rgb.dot(ve(s)),a=ui(n.rgb.mul(e).add(t),0).toVar(),l=a.pow(i).toVar();return Dt(a.r.greaterThan(0),()=>{a.r.assign(l.r)}),Dt(a.g.greaterThan(0),()=>{a.g.assign(l.g)}),Dt(a.b.greaterThan(0),()=>{a.b.assign(l.b)}),a.assign(o.add(a.sub(o).mul(r))),vt(a.rgb,n.a)});class tG extends kn{static get type(){return"PosterizeNode"}constructor(e,t){super(),this.sourceNode=e,this.stepsNode=t}setup(){const{sourceNode:e,stepsNode:t}=this;return e.mul(t).floor().div(t)}}const nG=Pe(tG),iG=new qe;class c4 extends Zo{static get type(){return"PassTextureNode"}constructor(e,t){super(t),this.passNode=e,this.setUpdateMatrix(!1)}setup(e){return e.object.isQuadMesh&&this.passNode.build(e),super.setup(e)}clone(){return new this.constructor(this.passNode,this.value)}}class Ab extends c4{static get type(){return"PassMultipleTextureNode"}constructor(e,t,i=!1){super(e,null),this.textureName=t,this.previousTexture=i}updateTexture(){this.value=this.previousTexture?this.passNode.getPreviousTexture(this.textureName):this.passNode.getTexture(this.textureName)}setup(e){return this.updateTexture(),super.setup(e)}clone(){return new this.constructor(this.passNode,this.textureName,this.previousTexture)}}class no extends kn{static get type(){return"PassNode"}constructor(e,t,i,r={}){super("vec4"),this.scope=e,this.scene=t,this.camera=i,this.options=r,this._pixelRatio=1,this._width=1,this._height=1;const s=new Ua;s.isRenderTargetTexture=!0,s.name="depth";const o=new Fh(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:Ts,...r});o.texture.name="output",o.depthTexture=s,this.renderTarget=o,this._textures={output:o.texture,depth:s},this._textureNodes={},this._linearDepthNodes={},this._viewZNodes={},this._previousTextures={},this._previousTextureNodes={},this._cameraNear=Rt(0),this._cameraFar=Rt(0),this._mrt=null,this.isPassNode=!0,this.updateBeforeType=Wt.FRAME}setMRT(e){return this._mrt=e,this}getMRT(){return this._mrt}isGlobal(){return!0}getTexture(e){let t=this._textures[e];return t===void 0&&(t=this.renderTarget.texture.clone(),t.name=e,this._textures[e]=t,this.renderTarget.textures.push(t)),t}getPreviousTexture(e){let t=this._previousTextures[e];return t===void 0&&(t=this.getTexture(e).clone(),this._previousTextures[e]=t),t}toggleTexture(e){const t=this._previousTextures[e];if(t!==void 0){const i=this._textures[e],r=this.renderTarget.textures.indexOf(i);this.renderTarget.textures[r]=t,this._textures[e]=t,this._previousTextures[e]=i,this._textureNodes[e].updateTexture(),this._previousTextureNodes[e].updateTexture()}}getTextureNode(e="output"){let t=this._textureNodes[e];return t===void 0&&(t=Fe(new Ab(this,e)),t.updateTexture(),this._textureNodes[e]=t),t}getPreviousTextureNode(e="output"){let t=this._previousTextureNodes[e];return t===void 0&&(this._textureNodes[e]===void 0&&this.getTextureNode(e),t=Fe(new Ab(this,e,!0)),t.updateTexture(),this._previousTextureNodes[e]=t),t}getViewZNode(e="depth"){let t=this._viewZNodes[e];if(t===void 0){const i=this._cameraNear,r=this._cameraFar;this._viewZNodes[e]=t=Ax(this.getTextureNode(e),i,r)}return t}getLinearDepthNode(e="depth"){let t=this._linearDepthNodes[e];if(t===void 0){const i=this._cameraNear,r=this._cameraFar,s=this.getViewZNode(e);this._linearDepthNodes[e]=t=Xc(s,i,r)}return t}setup({renderer:e}){return this.renderTarget.samples=this.options.samples===void 0?e.samples:this.options.samples,e.backend.isWebGLBackend===!0&&(this.renderTarget.samples=0),this.renderTarget.texture.type=e.getColorBufferType(),this.scope===no.COLOR?this.getTextureNode():this.getLinearDepthNode()}updateBefore(e){const{renderer:t}=e,{scene:i,camera:r}=this;this._pixelRatio=t.getPixelRatio();const s=t.getSize(iG);this.setSize(s.width,s.height);const o=t.getRenderTarget(),a=t.getMRT();this._cameraNear.value=r.near,this._cameraFar.value=r.far;for(const l in this._previousTextures)this.toggleTexture(l);t.setRenderTarget(this.renderTarget),t.setMRT(this._mrt),t.render(i,r),t.setRenderTarget(o),t.setMRT(a)}setSize(e,t){this._width=e,this._height=t;const i=this._width*this._pixelRatio,r=this._height*this._pixelRatio;this.renderTarget.setSize(i,r)}setPixelRatio(e){this._pixelRatio=e,this.setSize(this._width,this._height)}dispose(){this.renderTarget.dispose()}}no.COLOR="color";no.DEPTH="depth";const rG=(n,e,t)=>Fe(new no(no.COLOR,n,e,t)),sG=(n,e)=>Fe(new c4(n,e)),oG=(n,e,t)=>Fe(new no(no.DEPTH,n,e,t));class aG extends no{static get type(){return"ToonOutlinePassNode"}constructor(e,t,i,r,s){super(no.COLOR,e,t),this.colorNode=i,this.thicknessNode=r,this.alphaNode=s,this._materialCache=new WeakMap}updateBefore(e){const{renderer:t}=e,i=t.getRenderObjectFunction();t.setRenderObjectFunction((r,s,o,a,l,c,u,d)=>{if((l.isMeshToonMaterial||l.isMeshToonNodeMaterial)&&l.wireframe===!1){const h=this._getOutlineMaterial(l);t.renderObject(r,s,o,a,h,c,u,d)}t.renderObject(r,s,o,a,l,c,u,d)}),super.updateBefore(e),t.setRenderObjectFunction(i)}_createMaterial(){const e=new yh;e.isMeshToonOutlineMaterial=!0,e.name="Toon_Outline",e.side=Fi;const t=cr.negate(),i=Gh.mul(Wh),r=ce(1),s=i.mul(vt(Nn,1)),o=i.mul(vt(Nn.add(t),1)),a=jl(s.sub(o));return e.vertexNode=s.add(a.mul(this.thicknessNode).mul(s.w).mul(r)),e.colorNode=vt(this.colorNode,this.alphaNode),e}_getOutlineMaterial(e){let t=this._materialCache.get(e);return t===void 0&&(t=this._createMaterial(),this._materialCache.set(e,t)),t}}const lG=(n,e,t=new gt(0,0,0),i=.003,r=1)=>Fe(new aG(n,e,Fe(t),Fe(i),Fe(r))),cG=_e(([n,e])=>n.mul(e).clamp()).setLayout({name:"linearToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),uG=_e(([n,e])=>(n=n.mul(e),n.div(n.add(1)).clamp())).setLayout({name:"reinhardToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),dG=_e(([n,e])=>{n=n.mul(e),n=n.sub(.004).max(0);const t=n.mul(n.mul(6.2).add(.5)),i=n.mul(n.mul(6.2).add(1.7)).add(.06);return t.div(i).pow(2.2)}).setLayout({name:"cineonToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),hG=_e(([n])=>{const e=n.mul(n.add(.0245786)).sub(90537e-9),t=n.mul(n.add(.432951).mul(.983729)).add(.238081);return e.div(t)}),fG=_e(([n,e])=>{const t=is(.59719,.35458,.04823,.076,.90834,.01566,.0284,.13383,.83777),i=is(1.60475,-.53108,-.07367,-.10208,1.10813,-.00605,-.00327,-.07276,1.07602);return n=n.mul(e).div(.6),n=t.mul(n),n=hG(n),n=i.mul(n),n.clamp()}).setLayout({name:"acesFilmicToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),pG=is(ve(1.6605,-.1246,-.0182),ve(-.5876,1.1329,-.1006),ve(-.0728,-.0083,1.1187)),mG=is(ve(.6274,.0691,.0164),ve(.3293,.9195,.088),ve(.0433,.0113,.8956)),gG=_e(([n])=>{const e=ve(n).toVar(),t=ve(e.mul(e)).toVar(),i=ve(t.mul(t)).toVar();return ce(15.5).mul(i.mul(t)).sub(St(40.14,i.mul(e))).add(St(31.96,i).sub(St(6.868,t.mul(e))).add(St(.4298,t).add(St(.1191,e).sub(.00232))))}),yG=_e(([n,e])=>{const t=ve(n).toVar(),i=is(ve(.856627153315983,.137318972929847,.11189821299995),ve(.0951212405381588,.761241990602591,.0767994186031903),ve(.0482516061458583,.101439036467562,.811302368396859)),r=is(ve(1.1271005818144368,-.1413297634984383,-.14132976349843826),ve(-.11060664309660323,1.157823702216272,-.11060664309660294),ve(-.016493938717834573,-.016493938717834257,1.2519364065950405)),s=ce(-12.47393),o=ce(4.026069);return t.mulAssign(e),t.assign(mG.mul(t)),t.assign(i.mul(t)),t.assign(ui(t,1e-10)),t.assign(Ho(t)),t.assign(t.sub(s).div(o.sub(s))),t.assign(Ko(t,0,1)),t.assign(gG(t)),t.assign(r.mul(t)),t.assign(gs(ui(ve(0),t),ve(2.2))),t.assign(pG.mul(t)),t.assign(Ko(t,0,1)),t}).setLayout({name:"agxToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]}),vG=_e(([n,e])=>{const t=ce(.76),i=ce(.15);n=n.mul(e);const r=Fr(n.r,Fr(n.g,n.b)),s=sr(r.lessThan(.08),r.sub(St(6.25,r.mul(r))),.04);n.subAssign(s);const o=ui(n.r,ui(n.g,n.b));Dt(o.lessThan(t),()=>n);const a=Bt(1,t),l=Bt(1,a.mul(a).div(o.add(a.sub(t))));n.mulAssign(l.div(o));const c=Bt(1,Xo(1,i.mul(o.sub(l)).add(1)));return Ln(n,ve(l),c)}).setLayout({name:"neutralToneMapping",type:"vec3",inputs:[{name:"color",type:"vec3"},{name:"exposure",type:"float"}]});class qn extends ut{static get type(){return"CodeNode"}constructor(e="",t=[],i=""){super("code"),this.isCodeNode=!0,this.code=e,this.includes=t,this.language=i}isGlobal(){return!0}setIncludes(e){return this.includes=e,this}getIncludes(){return this.includes}generate(e){const t=this.getIncludes(e);for(const r of t)r.build(e);const i=e.getCodeFromNode(this,this.getNodeType(e));return i.code=this.code,i.code}serialize(e){super.serialize(e),e.code=this.code,e.language=this.language}deserialize(e){super.deserialize(e),this.code=e.code,this.language=e.language}}const g0=Pe(qn),_G=(n,e)=>g0(n,e,"js"),xG=(n,e)=>g0(n,e,"wgsl"),SG=(n,e)=>g0(n,e,"glsl");class AG extends qn{static get type(){return"FunctionNode"}constructor(e="",t=[],i=""){super(e,t,i)}getNodeType(e){return this.getNodeFunction(e).type}getInputs(e){return this.getNodeFunction(e).inputs}getNodeFunction(e){const t=e.getDataFromNode(this);let i=t.nodeFunction;return i===void 0&&(i=e.parser.parseFunction(this.code),t.nodeFunction=i),i}generate(e,t){super.generate(e);const i=this.getNodeFunction(e),r=i.name,s=i.type,o=e.getCodeFromNode(this,s);r!==""&&(o.name=r);const a=e.getPropertyName(o),l=this.getNodeFunction(e).getCode(a);return o.code=l+"\n",t==="property"?a:e.format("".concat(a,"()"),s,t)}}const u4=(n,e=[],t="")=>{for(let s=0;si.call(...s);return r.functionNode=i,r},bG=(n,e)=>u4(n,e,"glsl"),TG=(n,e)=>u4(n,e,"wgsl");class wG extends ut{static get type(){return"ScriptableValueNode"}constructor(e=null){super(),this._value=e,this._cache=null,this.inputType=null,this.outputType=null,this.events=new ro,this.isScriptableValueNode=!0}get isScriptableOutputNode(){return this.outputType!==null}set value(e){this._value!==e&&(this._cache&&this.inputType==="URL"&&this.value.value instanceof ArrayBuffer&&(URL.revokeObjectURL(this._cache),this._cache=null),this._value=e,this.events.dispatchEvent({type:"change"}),this.refresh())}get value(){return this._value}refresh(){this.events.dispatchEvent({type:"refresh"})}getValue(){const e=this.value;if(e&&this._cache===null&&this.inputType==="URL"&&e.value instanceof ArrayBuffer)this._cache=URL.createObjectURL(new Blob([e.value]));else if(e&&e.value!==null&&e.value!==void 0&&((this.inputType==="URL"||this.inputType==="String")&&typeof e.value=="string"||this.inputType==="Number"&&typeof e.value=="number"||this.inputType==="Vector2"&&e.value.isVector2||this.inputType==="Vector3"&&e.value.isVector3||this.inputType==="Vector4"&&e.value.isVector4||this.inputType==="Color"&&e.value.isColor||this.inputType==="Matrix3"&&e.value.isMatrix3||this.inputType==="Matrix4"&&e.value.isMatrix4))return e.value;return this._cache||e}getNodeType(e){return this.value&&this.value.isNode?this.value.getNodeType(e):"float"}setup(){return this.value&&this.value.isNode?this.value:ce()}serialize(e){super.serialize(e),this.value!==null?this.inputType==="ArrayBuffer"?e.value=sC(this.value):e.value=this.value?this.value.toJSON(e.meta).uuid:null:e.value=null,e.inputType=this.inputType,e.outputType=this.outputType}deserialize(e){super.deserialize(e);let t=null;e.value!==null&&(e.inputType==="ArrayBuffer"?t=oC(e.value):e.inputType==="Texture"?t=e.meta.textures[e.value]:t=e.meta.nodes[e.value]||null),this.value=t,this.inputType=e.inputType,this.outputType=e.outputType}}const Np=Pe(wG);class d4 extends Map{get(e,t=null,...i){if(this.has(e))return super.get(e);if(t!==null){const r=t(...i);return this.set(e,r),r}}}class CG{constructor(e){this.scriptableNode=e}get parameters(){return this.scriptableNode.parameters}get layout(){return this.scriptableNode.getLayout()}getInputLayout(e){return this.scriptableNode.getInputLayout(e)}get(e){const t=this.parameters[e];return t?t.getValue():null}}const Pp=new d4;class EG extends ut{static get type(){return"ScriptableNode"}constructor(e=null,t={}){super(),this.codeNode=e,this.parameters=t,this._local=new d4,this._output=Np(),this._outputs={},this._source=this.source,this._method=null,this._object=null,this._value=null,this._needsOutputUpdate=!0,this.onRefresh=this.onRefresh.bind(this),this.isScriptableNode=!0}get source(){return this.codeNode?this.codeNode.code:""}setLocal(e,t){return this._local.set(e,t)}getLocal(e){return this._local.get(e)}onRefresh(){this._refresh()}getInputLayout(e){for(const t of this.getLayout())if(t.inputType&&(t.id===e||t.name===e))return t}getOutputLayout(e){for(const t of this.getLayout())if(t.outputType&&(t.id===e||t.name===e))return t}setOutput(e,t){const i=this._outputs;return i[e]===void 0?i[e]=Np(t):i[e].value=t,this}getOutput(e){return this._outputs[e]}getParameter(e){return this.parameters[e]}setParameter(e,t){const i=this.parameters;return t&&t.isScriptableNode?(this.deleteParameter(e),i[e]=t,i[e].getDefaultOutput().events.addEventListener("refresh",this.onRefresh)):t&&t.isScriptableValueNode?(this.deleteParameter(e),i[e]=t,i[e].events.addEventListener("refresh",this.onRefresh)):i[e]===void 0?(i[e]=Np(t),i[e].events.addEventListener("refresh",this.onRefresh)):i[e].value=t,this}getValue(){return this.getDefaultOutput().getValue()}deleteParameter(e){let t=this.parameters[e];return t&&(t.isScriptableNode&&(t=t.getDefaultOutput()),t.events.removeEventListener("refresh",this.onRefresh)),this}clearParameters(){for(const e of Object.keys(this.parameters))this.deleteParameter(e);return this.needsUpdate=!0,this}call(e,...t){const r=this.getObject()[e];if(typeof r=="function")return r(...t)}async callAsync(e,...t){const r=this.getObject()[e];if(typeof r=="function")return r.constructor.name==="AsyncFunction"?await r(...t):r(...t)}getNodeType(e){return this.getDefaultOutputNode().getNodeType(e)}refresh(e=null){e!==null?this.getOutput(e).refresh():this._refresh()}getObject(){if(this.needsUpdate&&this.dispose(),this._object!==null)return this._object;const e=()=>this.refresh(),t=(c,u)=>this.setOutput(c,u),i=new CG(this),r=Pp.get("THREE"),s=Pp.get("TSL"),o=this.getMethod(),a=[i,this._local,Pp,e,t,r,s];this._object=o(...a);const l=this._object.layout;if(l&&(l.cache===!1&&this._local.clear(),this._output.outputType=l.outputType||null,Array.isArray(l.elements)))for(const c of l.elements){const u=c.id||c.name;c.inputType&&(this.getParameter(u)===void 0&&this.setParameter(u,null),this.getParameter(u).inputType=c.inputType),c.outputType&&(this.getOutput(u)===void 0&&this.setOutput(u,null),this.getOutput(u).outputType=c.outputType)}return this._object}deserialize(e){super.deserialize(e);for(const t in this.parameters){let i=this.parameters[t];i.isScriptableNode&&(i=i.getDefaultOutput()),i.events.addEventListener("refresh",this.onRefresh)}}getLayout(){return this.getObject().layout}getDefaultOutputNode(){const e=this.getDefaultOutput().value;return e&&e.isNode?e:ce()}getDefaultOutput(){return this._exec()._output}getMethod(){if(this.needsUpdate&&this.dispose(),this._method!==null)return this._method;const e=["parameters","local","global","refresh","setOutput","THREE","TSL"],i=["layout","init","main","dispose"].join(", "),r="var "+i+"; var output = {};\n",s="\nreturn { ...output, "+i+" };",o=r+this.codeNode.code+s;return this._method=new Function(...e,o),this._method}dispose(){this._method!==null&&(this._object&&typeof this._object.dispose=="function"&&this._object.dispose(),this._method=null,this._object=null,this._source=null,this._value=null,this._needsOutputUpdate=!0,this._output.value=null,this._outputs={})}setup(){return this.getDefaultOutputNode()}getCacheKey(e){const t=[qk(this.source),this.getDefaultOutputNode().getCacheKey(e)];for(const i in this.parameters)t.push(this.parameters[i].getCacheKey(e));return eC(t)}set needsUpdate(e){e===!0&&this.dispose()}get needsUpdate(){return this.source!==this._source}_exec(){return this.codeNode===null?this:(this._needsOutputUpdate===!0&&(this._value=this.call("main"),this._needsOutputUpdate=!1),this._output.value=this._value,this)}_refresh(){this.needsUpdate=!0,this._exec(),this._output.refresh()}}const MG=Pe(EG);function h4(n){let e;const t=n.context.getViewZ;return t!==void 0&&(e=t(this)),(e||Yn.z).negate()}const f4=_e(([n,e],t)=>{const i=h4(t);return Vl(n,e,i)}),p4=_e(([n],e)=>{const t=h4(e);return n.mul(n,t,t).negate().exp().oneMinus()}),Ex=_e(([n,e])=>vt(e.toFloat().mix(gh.rgb,n.toVec3()),gh.a));function RG(n,e,t){return console.warn('THREE.TSL: "rangeFog( color, near, far )" is deprecated. Use "fog( color, rangeFogFactor( near, far ) )" instead.'),Ex(n,f4(e,t))}function IG(n,e){return console.warn('THREE.TSL: "densityFog( color, density )" is deprecated. Use "fog( color, densityFogFactor( density ) )" instead.'),Ex(n,p4(e))}let rl=null,sl=null;class NG extends ut{static get type(){return"RangeNode"}constructor(e=ce(),t=ce()){super(),this.minNode=e,this.maxNode=t}getVectorLength(e){const t=e.getTypeLength(Ca(this.minNode.value)),i=e.getTypeLength(Ca(this.maxNode.value));return t>i?t:i}getNodeType(e){return e.object.count>1?e.getTypeFromLength(this.getVectorLength(e)):"float"}setup(e){const t=e.object;let i=null;if(t.count>1){const r=this.minNode.value,s=this.maxNode.value,o=e.getTypeLength(Ca(r)),a=e.getTypeLength(Ca(s));rl=rl||new Mt,sl=sl||new Mt,rl.setScalar(0),sl.setScalar(0),o===1?rl.setScalar(r):r.isColor?rl.set(r.r,r.g,r.b,1):rl.set(r.x,r.y,r.z||0,r.w||0),a===1?sl.setScalar(s):s.isColor?sl.set(s.r,s.g,s.b,1):sl.set(s.x,s.y,s.z||0,s.w||0);const l=4,c=l*t.count,u=new Float32Array(c);for(let h=0;hFe(new LG(n,e)),DG=Zh("numWorkgroups","uvec3"),FG=Zh("workgroupId","uvec3"),OG=Zh("globalId","uvec3"),BG=Zh("localId","uvec3"),kG=Zh("subgroupSize","uint");class UG extends ut{constructor(e){super(),this.scope=e}generate(e){const{scope:t}=this,{renderer:i}=e;i.backend.isWebGLBackend===!0?e.addFlowCode(" // ".concat(t,"Barrier \n")):e.addLineFlowCode("".concat(t,"Barrier()"),this)}}const Mx=Pe(UG),zG=()=>Mx("workgroup").append(),VG=()=>Mx("storage").append(),HG=()=>Mx("texture").append();class $G extends Ql{constructor(e,t){super(e,t),this.isWorkgroupInfoElementNode=!0}generate(e,t){let i;const r=e.context.assign;if(i=super.generate(e),r!==!0){const s=this.getNodeType(e);i=e.format(i,s,t)}return i}}class GG extends ut{constructor(e,t,i=0){super(t),this.bufferType=t,this.bufferCount=i,this.isWorkgroupInfoNode=!0,this.elementType=t,this.scope=e}label(e){return this.name=e,this}setScope(e){return this.scope=e,this}getElementType(){return this.elementType}getInputType(){return"".concat(this.scope,"Array")}element(e){return Fe(new $G(this,e))}generate(e){return e.getScopedArray(this.name||"".concat(this.scope,"Array_").concat(this.id),this.scope.toLowerCase(),this.bufferType,this.bufferCount)}}const WG=(n,e)=>Fe(new GG("Workgroup",n,e));class ni extends kn{static get type(){return"AtomicFunctionNode"}constructor(e,t,i,r=null){super("uint"),this.method=e,this.pointerNode=t,this.valueNode=i,this.storeNode=r}getInputType(e){return this.pointerNode.getNodeType(e)}getNodeType(e){return this.getInputType(e)}generate(e){const t=this.method,i=this.getNodeType(e),r=this.getInputType(e),s=this.pointerNode,o=this.valueNode,a=[];a.push("&".concat(s.build(e,r))),o!==null&&a.push(o.build(e,r));const l="".concat(e.getMethod(t,i),"( ").concat(a.join(", ")," )");if(this.storeNode!==null){const c=this.storeNode.build(e,r);e.addLineFlowCode("".concat(c," = ").concat(l),this)}else e.addLineFlowCode(l,this)}}ni.ATOMIC_LOAD="atomicLoad";ni.ATOMIC_STORE="atomicStore";ni.ATOMIC_ADD="atomicAdd";ni.ATOMIC_SUB="atomicSub";ni.ATOMIC_MAX="atomicMax";ni.ATOMIC_MIN="atomicMin";ni.ATOMIC_AND="atomicAnd";ni.ATOMIC_OR="atomicOr";ni.ATOMIC_XOR="atomicXor";const QG=Pe(ni),co=(n,e,t,i=null)=>{const r=QG(n,e,t,i);return r.append(),r},jG=(n,e=null)=>co(ni.ATOMIC_LOAD,n,null,e),qG=(n,e,t=null)=>co(ni.ATOMIC_STORE,n,e,t),XG=(n,e,t=null)=>co(ni.ATOMIC_ADD,n,e,t),KG=(n,e,t=null)=>co(ni.ATOMIC_SUB,n,e,t),YG=(n,e,t=null)=>co(ni.ATOMIC_MAX,n,e,t),ZG=(n,e,t=null)=>co(ni.ATOMIC_MIN,n,e,t),JG=(n,e,t=null)=>co(ni.ATOMIC_AND,n,e,t),eW=(n,e,t=null)=>co(ni.ATOMIC_OR,n,e,t),tW=(n,e,t=null)=>co(ni.ATOMIC_XOR,n,e,t);let np;function Jh(n){np=np||new WeakMap;let e=np.get(n);return e===void 0&&np.set(n,e={}),e}function Rx(n){const e=Jh(n);return e.shadowMatrix||(e.shadowMatrix=Rt("mat4").setGroup(kt).onRenderUpdate(()=>(n.castShadow!==!0&&n.shadow.updateMatrices(n),n.shadow.matrix)))}function nW(n){const e=Jh(n);if(e.projectionUV===void 0){const t=Rx(n).mul(Nl);e.projectionUV=t.xyz.div(t.w)}return e.projectionUV}function m4(n){const e=Jh(n);return e.position||(e.position=Rt(new Y).setGroup(kt).onRenderUpdate((t,i)=>i.value.setFromMatrixPosition(n.matrixWorld)))}function g4(n){const e=Jh(n);return e.targetPosition||(e.targetPosition=Rt(new Y).setGroup(kt).onRenderUpdate((t,i)=>i.value.setFromMatrixPosition(n.target.matrixWorld)))}function iW(n){const e=Jh(n);return e.viewPosition||(e.viewPosition=Rt(new Y).setGroup(kt).onRenderUpdate(({camera:t},i)=>{i.value=i.value||new Y,i.value.setFromMatrixPosition(n.matrixWorld),i.value.applyMatrix4(t.matrixWorldInverse)}))}const rW=n=>ss.transformDirection(m4(n).sub(g4(n))),sW=n=>n.sort((e,t)=>e.id-t.id),oW=(n,e)=>{for(const t of e)if(t.isAnalyticLightNode&&t.light.id===n)return t;return null},r1=new WeakMap;class aW extends ut{static get type(){return"LightsNode"}constructor(){super("vec3"),this.totalDiffuseNode=ve().toVar("totalDiffuse"),this.totalSpecularNode=ve().toVar("totalSpecular"),this.outgoingLightNode=ve().toVar("outgoingLight"),this._lights=[],this._lightNodes=null,this._lightNodesHash=null,this.global=!0}customCacheKey(){const e=[],t=this._lights;for(let i=0;i0}}const lW=(n=[])=>Fe(new aW).setLights(n);class cW extends ut{static get type(){return"ShadowBaseNode"}constructor(e){super(),this.light=e,this.updateBeforeType=Wt.RENDER,this.isShadowBaseNode=!0}setupShadowPosition({material:e}){Ix.assign(e.shadowPositionNode||Nl)}dispose(){this.updateBeforeType=Wt.NONE}}const Ix=ve().toVar("shadowPositionWorld");function uW(n,e={}){return e.toneMapping=n.toneMapping,e.toneMappingExposure=n.toneMappingExposure,e.outputColorSpace=n.outputColorSpace,e.renderTarget=n.getRenderTarget(),e.activeCubeFace=n.getActiveCubeFace(),e.activeMipmapLevel=n.getActiveMipmapLevel(),e.renderObjectFunction=n.getRenderObjectFunction(),e.pixelRatio=n.getPixelRatio(),e.mrt=n.getMRT(),e.clearColor=n.getClearColor(e.clearColor||new gt),e.clearAlpha=n.getClearAlpha(),e.autoClear=n.autoClear,e.scissorTest=n.getScissorTest(),e}function dW(n,e){return e=uW(n,e),n.setMRT(null),n.setRenderObjectFunction(null),n.setClearColor(0,1),n.autoClear=!0,e}function hW(n,e){n.toneMapping=e.toneMapping,n.toneMappingExposure=e.toneMappingExposure,n.outputColorSpace=e.outputColorSpace,n.setRenderTarget(e.renderTarget,e.activeCubeFace,e.activeMipmapLevel),n.setRenderObjectFunction(e.renderObjectFunction),n.setPixelRatio(e.pixelRatio),n.setMRT(e.mrt),n.setClearColor(e.clearColor,e.clearAlpha),n.autoClear=e.autoClear,n.setScissorTest(e.scissorTest)}function fW(n,e={}){return e.background=n.background,e.backgroundNode=n.backgroundNode,e.overrideMaterial=n.overrideMaterial,e}function pW(n,e){return e=fW(n,e),n.background=null,n.backgroundNode=null,n.overrideMaterial=null,e}function mW(n,e){n.background=e.background,n.backgroundNode=e.backgroundNode,n.overrideMaterial=e.overrideMaterial}function gW(n,e,t){return t=dW(n,t),t=pW(e,t),t}function yW(n,e,t){hW(n,t),mW(e,t)}const bb=new WeakMap,vW=_e(([n,e,t])=>{let i=Nl.sub(n).length();return i=i.sub(e).div(t.sub(e)),i=i.saturate(),i}),_W=n=>{const e=n.shadow.camera,t=Pn("near","float",e).setGroup(kt),i=Pn("far","float",e).setGroup(kt),r=ZE(n);return vW(r,t,i)},xW=n=>{let e=bb.get(n);if(e===void 0){const t=n.isPointLight?_W(n):null;e=new yh,e.colorNode=vt(0,0,0,1),e.depthNode=t,e.isShadowPassMaterial=!0,e.name="ShadowMaterial",e.fog=!1,bb.set(n,e)}return e},y4=_e(({depthTexture:n,shadowCoord:e})=>er(n,e.xy).compare(e.z)),v4=_e(({depthTexture:n,shadowCoord:e,shadow:t})=>{const i=(g,y)=>er(n,g).compare(y),r=Pn("mapSize","vec2",t).setGroup(kt),s=Pn("radius","float",t).setGroup(kt),o=He(1).div(r),a=o.x.negate().mul(s),l=o.y.negate().mul(s),c=o.x.mul(s),u=o.y.mul(s),d=a.div(2),h=l.div(2),f=c.div(2),p=u.div(2);return On(i(e.xy.add(He(a,l)),e.z),i(e.xy.add(He(0,l)),e.z),i(e.xy.add(He(c,l)),e.z),i(e.xy.add(He(d,h)),e.z),i(e.xy.add(He(0,h)),e.z),i(e.xy.add(He(f,h)),e.z),i(e.xy.add(He(a,0)),e.z),i(e.xy.add(He(d,0)),e.z),i(e.xy,e.z),i(e.xy.add(He(f,0)),e.z),i(e.xy.add(He(c,0)),e.z),i(e.xy.add(He(d,p)),e.z),i(e.xy.add(He(0,p)),e.z),i(e.xy.add(He(f,p)),e.z),i(e.xy.add(He(a,u)),e.z),i(e.xy.add(He(0,u)),e.z),i(e.xy.add(He(c,u)),e.z)).mul(1/17)}),_4=_e(({depthTexture:n,shadowCoord:e,shadow:t})=>{const i=(u,d)=>er(n,u).compare(d),r=Pn("mapSize","vec2",t).setGroup(kt),s=He(1).div(r),o=s.x,a=s.y,l=e.xy,c=na(l.mul(r).add(.5));return l.subAssign(c.mul(s)),On(i(l,e.z),i(l.add(He(o,0)),e.z),i(l.add(He(0,a)),e.z),i(l.add(s),e.z),Ln(i(l.add(He(o.negate(),0)),e.z),i(l.add(He(o.mul(2),0)),e.z),c.x),Ln(i(l.add(He(o.negate(),a)),e.z),i(l.add(He(o.mul(2),a)),e.z),c.x),Ln(i(l.add(He(0,a.negate())),e.z),i(l.add(He(0,a.mul(2))),e.z),c.y),Ln(i(l.add(He(o,a.negate())),e.z),i(l.add(He(o,a.mul(2))),e.z),c.y),Ln(Ln(i(l.add(He(o.negate(),a.negate())),e.z),i(l.add(He(o.mul(2),a.negate())),e.z),c.x),Ln(i(l.add(He(o.negate(),a.mul(2))),e.z),i(l.add(He(o.mul(2),a.mul(2))),e.z),c.x),c.y)).mul(1/9)}),x4=_e(({depthTexture:n,shadowCoord:e})=>{const t=ce(1).toVar(),i=er(n).sample(e.xy).rg,r=c0(e.z,i.x);return Dt(r.notEqual(ce(1)),()=>{const s=e.z.sub(i.x),o=ui(0,i.y.mul(i.y));let a=o.div(o.add(s.mul(s)));a=Ko(Bt(a,.3).div(.95-.3)),t.assign(Ko(ui(r,a)))}),t}),SW=_e(({samples:n,radius:e,size:t,shadowPass:i})=>{const r=ce(0).toVar(),s=ce(0).toVar(),o=n.lessThanEqual(ce(1)).select(ce(0),ce(2).div(n.sub(1))),a=n.lessThanEqual(ce(1)).select(ce(0),ce(-1));cn({start:de(0),end:de(n),type:"int",condition:"<"},({i:c})=>{const u=a.add(ce(c).mul(o)),d=i.sample(On(Yh.xy,He(0,u).mul(e)).div(t)).x;r.addAssign(d),s.addAssign(d.mul(d))}),r.divAssign(n),s.divAssign(n);const l=lo(s.sub(r.mul(r)));return He(r,l)}),AW=_e(({samples:n,radius:e,size:t,shadowPass:i})=>{const r=ce(0).toVar(),s=ce(0).toVar(),o=n.lessThanEqual(ce(1)).select(ce(0),ce(2).div(n.sub(1))),a=n.lessThanEqual(ce(1)).select(ce(0),ce(-1));cn({start:de(0),end:de(n),type:"int",condition:"<"},({i:c})=>{const u=a.add(ce(c).mul(o)),d=i.sample(On(Yh.xy,He(u,0).mul(e)).div(t));r.addAssign(d.x),s.addAssign(On(d.y.mul(d.y),d.x.mul(d.x)))}),r.divAssign(n),s.divAssign(n);const l=lo(s.sub(r.mul(r)));return He(r,l)}),bW=[y4,v4,_4,x4];let s1;const ip=new t4;class TW extends cW{static get type(){return"ShadowNode"}constructor(e,t=null){super(e),this.shadow=t||e.shadow,this.shadowMap=null,this.vsmShadowMapVertical=null,this.vsmShadowMapHorizontal=null,this.vsmMaterialVertical=null,this.vsmMaterialHorizontal=null,this._node=null,this.isShadowNode=!0}setupShadowFilter(e,{filterFn:t,depthTexture:i,shadowCoord:r,shadow:s}){const o=r.x.greaterThanEqual(0).and(r.x.lessThanEqual(1)).and(r.y.greaterThanEqual(0)).and(r.y.lessThanEqual(1)).and(r.z.lessThanEqual(1)),a=t({depthTexture:i,shadowCoord:r,shadow:s});return o.select(a,ce(1))}setupShadowCoord(e,t){const{shadow:i}=this,{renderer:r}=e,s=Pn("bias","float",i).setGroup(kt);let o=t,a;if(i.camera.isOrthographicCamera||r.logarithmicDepthBuffer!==!0)o=o.xyz.div(o.w),a=o.z,r.coordinateSystem===Qo&&(a=a.mul(2).sub(1));else{const l=o.w;o=o.xy.div(l);const c=Pn("near","float",i.camera).setGroup(kt),u=Pn("far","float",i.camera).setGroup(kt);a=bx(l.negate(),c,u)}return o=ve(o.x,o.y.oneMinus(),a.add(s)),o}getShadowFilterFn(e){return bW[e]}setupShadow(e){const{renderer:t}=e,{light:i,shadow:r}=this,s=t.shadowMap.type,o=new Ua(r.mapSize.width,r.mapSize.height);o.compareFunction=b5;const a=e.createRenderTarget(r.mapSize.width,r.mapSize.height);if(a.depthTexture=o,r.camera.updateProjectionMatrix(),s===Ar){o.compareFunction=null,this.vsmShadowMapVertical=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:oh,type:Ts}),this.vsmShadowMapHorizontal=e.createRenderTarget(r.mapSize.width,r.mapSize.height,{format:oh,type:Ts});const m=er(o),v=er(this.vsmShadowMapVertical.texture),x=Pn("blurSamples","float",r).setGroup(kt),_=Pn("radius","float",r).setGroup(kt),S=Pn("mapSize","vec2",r).setGroup(kt);let E=this.vsmMaterialVertical||(this.vsmMaterialVertical=new yh);E.fragmentNode=SW({samples:x,radius:_,size:S,shadowPass:m}).context(e.getSharedContext()),E.name="VSMVertical",E=this.vsmMaterialHorizontal||(this.vsmMaterialHorizontal=new yh),E.fragmentNode=AW({samples:x,radius:_,size:S,shadowPass:v}).context(e.getSharedContext()),E.name="VSMHorizontal"}const l=Pn("intensity","float",r).setGroup(kt),c=Pn("normalBias","float",r).setGroup(kt),u=Rx(i).mul(Ix.add(sM.mul(c))),d=this.setupShadowCoord(e,u),h=r.filterNode||this.getShadowFilterFn(t.shadowMap.type)||null;if(h===null)throw new Error("THREE.WebGPURenderer: Shadow map type not supported yet.");const f=s===Ar?this.vsmShadowMapHorizontal.texture:o,p=this.setupShadowFilter(e,{filterFn:h,shadowTexture:a.texture,depthTexture:f,shadowCoord:d,shadow:r}),g=er(a.texture,d),y=Ln(1,p.rgb.mix(g,1),l.mul(g.a)).toVar();return this.shadowMap=a,this.shadow.map=a,y}setup(e){if(e.renderer.shadowMap.enabled!==!1)return _e(()=>{let t=this._node;return this.setupShadowPosition(e),t===null&&(this._node=t=this.setupShadow(e)),e.material.shadowNode&&console.warn('THREE.NodeMaterial: ".shadowNode" is deprecated. Use ".castShadowNode" instead.'),e.material.receivedShadowNode&&(t=e.material.receivedShadowNode(t)),t})()}renderShadow(e){const{shadow:t,shadowMap:i,light:r}=this,{renderer:s,scene:o}=e;t.updateMatrices(r),i.setSize(t.mapSize.width,t.mapSize.height),s.render(o,t.camera)}updateShadow(e){const{shadowMap:t,light:i,shadow:r}=this,{renderer:s,scene:o,camera:a}=e,l=s.shadowMap.type,c=t.depthTexture.version;this._depthVersionCached=c,r.camera.layers.mask=a.layers.mask;const u=s.getRenderObjectFunction(),d=s.getMRT(),h=d?d.has("velocity"):!1;s1=gW(s,o,s1),o.overrideMaterial=xW(i),s.setRenderObjectFunction((f,p,g,y,m,v,...x)=>{(f.castShadow===!0||f.receiveShadow&&l===Ar)&&(h&&(rC(f).useVelocity=!0),f.onBeforeShadow(s,f,a,r.camera,y,p.overrideMaterial,v),s.renderObject(f,p,g,y,m,v,...x),f.onAfterShadow(s,f,a,r.camera,y,p.overrideMaterial,v))}),s.setRenderTarget(t),this.renderShadow(e),s.setRenderObjectFunction(u),i.isPointLight!==!0&&l===Ar&&this.vsmPass(s),yW(s,o,s1)}vsmPass(e){const{shadow:t}=this;this.vsmShadowMapVertical.setSize(t.mapSize.width,t.mapSize.height),this.vsmShadowMapHorizontal.setSize(t.mapSize.width,t.mapSize.height),e.setRenderTarget(this.vsmShadowMapVertical),ip.material=this.vsmMaterialVertical,ip.render(e),e.setRenderTarget(this.vsmShadowMapHorizontal),ip.material=this.vsmMaterialHorizontal,ip.render(e)}dispose(){this.shadowMap.dispose(),this.shadowMap=null,this.vsmShadowMapVertical!==null&&(this.vsmShadowMapVertical.dispose(),this.vsmShadowMapVertical=null,this.vsmMaterialVertical.dispose(),this.vsmMaterialVertical=null),this.vsmShadowMapHorizontal!==null&&(this.vsmShadowMapHorizontal.dispose(),this.vsmShadowMapHorizontal=null,this.vsmMaterialHorizontal.dispose(),this.vsmMaterialHorizontal=null),super.dispose()}updateBefore(e){const{shadow:t}=this;(t.needsUpdate||t.autoUpdate)&&(this.updateShadow(e),this.shadowMap.depthTexture.version===this._depthVersionCached&&(t.needsUpdate=!1))}}const wW=(n,e)=>Fe(new TW(n,e)),S4=_e(n=>{const{lightDistance:e,cutoffDistance:t,decayExponent:i}=n,r=e.pow(i).max(.01).reciprocal();return t.greaterThan(0).select(r.mul(e.div(t).pow4().oneMinus().clamp().pow2()),r)}),CW=_e(({color:n,lightViewPosition:e,cutoffDistance:t,decayExponent:i},r)=>{const s=r.context.lightingModel,o=e.sub(Yn),a=o.normalize(),l=o.length(),c=S4({lightDistance:l,cutoffDistance:t,decayExponent:i}),u=n.mul(c),d=r.context.reflectedLight;s.direct({lightDirection:a,lightColor:u,reflectedLight:d},r.stack,r)}),EW=_e(([n=xn()])=>{const e=n.mul(2),t=e.x.floor(),i=e.y.floor();return t.add(i).mod(2).sign()}),MW=_e(([n=xn()],{renderer:e,material:t})=>{const i=ce(1).toVar(),r=ax(n.mul(2).sub(1));if(t.alphaToCoverage&&e.samples>1){const s=ce(r.fwidth()).toVar();i.assign(Vl(s.oneMinus(),s.add(1),r).oneMinus())}else r.greaterThan(1).discard();return i}),Gd=_e(([n,e,t])=>{const i=ce(t).toVar(),r=ce(e).toVar(),s=qo(n).toVar();return sr(s,r,i)}).setLayout({name:"mx_select",type:"float",inputs:[{name:"b",type:"bool"},{name:"t",type:"float"},{name:"f",type:"float"}]}),Em=_e(([n,e])=>{const t=qo(e).toVar(),i=ce(n).toVar();return sr(t,i.negate(),i)}).setLayout({name:"mx_negate_if",type:"float",inputs:[{name:"val",type:"float"},{name:"b",type:"bool"}]}),Fn=_e(([n])=>{const e=ce(n).toVar();return de(js(e))}).setLayout({name:"mx_floor",type:"int",inputs:[{name:"x",type:"float"}]}),_n=_e(([n,e])=>{const t=ce(n).toVar();return e.assign(Fn(t)),t.sub(ce(e))}),RW=_e(([n,e,t,i,r,s])=>{const o=ce(s).toVar(),a=ce(r).toVar(),l=ce(i).toVar(),c=ce(t).toVar(),u=ce(e).toVar(),d=ce(n).toVar(),h=ce(Bt(1,a)).toVar();return Bt(1,o).mul(d.mul(h).add(u.mul(a))).add(o.mul(c.mul(h).add(l.mul(a))))}).setLayout({name:"mx_bilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"}]}),IW=_e(([n,e,t,i,r,s])=>{const o=ce(s).toVar(),a=ce(r).toVar(),l=ve(i).toVar(),c=ve(t).toVar(),u=ve(e).toVar(),d=ve(n).toVar(),h=ce(Bt(1,a)).toVar();return Bt(1,o).mul(d.mul(h).add(u.mul(a))).add(o.mul(c.mul(h).add(l.mul(a))))}).setLayout({name:"mx_bilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"}]}),A4=bi([RW,IW]),NW=_e(([n,e,t,i,r,s,o,a,l,c,u])=>{const d=ce(u).toVar(),h=ce(c).toVar(),f=ce(l).toVar(),p=ce(a).toVar(),g=ce(o).toVar(),y=ce(s).toVar(),m=ce(r).toVar(),v=ce(i).toVar(),x=ce(t).toVar(),_=ce(e).toVar(),S=ce(n).toVar(),E=ce(Bt(1,f)).toVar(),A=ce(Bt(1,h)).toVar();return ce(Bt(1,d)).toVar().mul(A.mul(S.mul(E).add(_.mul(f))).add(h.mul(x.mul(E).add(v.mul(f))))).add(d.mul(A.mul(m.mul(E).add(y.mul(f))).add(h.mul(g.mul(E).add(p.mul(f))))))}).setLayout({name:"mx_trilerp_0",type:"float",inputs:[{name:"v0",type:"float"},{name:"v1",type:"float"},{name:"v2",type:"float"},{name:"v3",type:"float"},{name:"v4",type:"float"},{name:"v5",type:"float"},{name:"v6",type:"float"},{name:"v7",type:"float"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),PW=_e(([n,e,t,i,r,s,o,a,l,c,u])=>{const d=ce(u).toVar(),h=ce(c).toVar(),f=ce(l).toVar(),p=ve(a).toVar(),g=ve(o).toVar(),y=ve(s).toVar(),m=ve(r).toVar(),v=ve(i).toVar(),x=ve(t).toVar(),_=ve(e).toVar(),S=ve(n).toVar(),E=ce(Bt(1,f)).toVar(),A=ce(Bt(1,h)).toVar();return ce(Bt(1,d)).toVar().mul(A.mul(S.mul(E).add(_.mul(f))).add(h.mul(x.mul(E).add(v.mul(f))))).add(d.mul(A.mul(m.mul(E).add(y.mul(f))).add(h.mul(g.mul(E).add(p.mul(f))))))}).setLayout({name:"mx_trilerp_1",type:"vec3",inputs:[{name:"v0",type:"vec3"},{name:"v1",type:"vec3"},{name:"v2",type:"vec3"},{name:"v3",type:"vec3"},{name:"v4",type:"vec3"},{name:"v5",type:"vec3"},{name:"v6",type:"vec3"},{name:"v7",type:"vec3"},{name:"s",type:"float"},{name:"t",type:"float"},{name:"r",type:"float"}]}),b4=bi([NW,PW]),LW=_e(([n,e,t])=>{const i=ce(t).toVar(),r=ce(e).toVar(),s=Ye(n).toVar(),o=Ye(s.bitAnd(Ye(7))).toVar(),a=ce(Gd(o.lessThan(Ye(4)),r,i)).toVar(),l=ce(St(2,Gd(o.lessThan(Ye(4)),i,r))).toVar();return Em(a,qo(o.bitAnd(Ye(1)))).add(Em(l,qo(o.bitAnd(Ye(2)))))}).setLayout({name:"mx_gradient_float_0",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"}]}),DW=_e(([n,e,t,i])=>{const r=ce(i).toVar(),s=ce(t).toVar(),o=ce(e).toVar(),a=Ye(n).toVar(),l=Ye(a.bitAnd(Ye(15))).toVar(),c=ce(Gd(l.lessThan(Ye(8)),o,s)).toVar(),u=ce(Gd(l.lessThan(Ye(4)),s,Gd(l.equal(Ye(12)).or(l.equal(Ye(14))),o,r))).toVar();return Em(c,qo(l.bitAnd(Ye(1)))).add(Em(u,qo(l.bitAnd(Ye(2)))))}).setLayout({name:"mx_gradient_float_1",type:"float",inputs:[{name:"hash",type:"uint"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),ai=bi([LW,DW]),FW=_e(([n,e,t])=>{const i=ce(t).toVar(),r=ce(e).toVar(),s=Uu(n).toVar();return ve(ai(s.x,r,i),ai(s.y,r,i),ai(s.z,r,i))}).setLayout({name:"mx_gradient_vec3_0",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"}]}),OW=_e(([n,e,t,i])=>{const r=ce(i).toVar(),s=ce(t).toVar(),o=ce(e).toVar(),a=Uu(n).toVar();return ve(ai(a.x,o,s,r),ai(a.y,o,s,r),ai(a.z,o,s,r))}).setLayout({name:"mx_gradient_vec3_1",type:"vec3",inputs:[{name:"hash",type:"uvec3"},{name:"x",type:"float"},{name:"y",type:"float"},{name:"z",type:"float"}]}),jr=bi([FW,OW]),BW=_e(([n])=>{const e=ce(n).toVar();return St(.6616,e)}).setLayout({name:"mx_gradient_scale2d_0",type:"float",inputs:[{name:"v",type:"float"}]}),kW=_e(([n])=>{const e=ce(n).toVar();return St(.982,e)}).setLayout({name:"mx_gradient_scale3d_0",type:"float",inputs:[{name:"v",type:"float"}]}),UW=_e(([n])=>{const e=ve(n).toVar();return St(.6616,e)}).setLayout({name:"mx_gradient_scale2d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),T4=bi([BW,UW]),zW=_e(([n])=>{const e=ve(n).toVar();return St(.982,e)}).setLayout({name:"mx_gradient_scale3d_1",type:"vec3",inputs:[{name:"v",type:"vec3"}]}),w4=bi([kW,zW]),Tr=_e(([n,e])=>{const t=de(e).toVar(),i=Ye(n).toVar();return i.shiftLeft(t).bitOr(i.shiftRight(de(32).sub(t)))}).setLayout({name:"mx_rotl32",type:"uint",inputs:[{name:"x",type:"uint"},{name:"k",type:"int"}]}),C4=_e(([n,e,t])=>{n.subAssign(t),n.bitXorAssign(Tr(t,de(4))),t.addAssign(e),e.subAssign(n),e.bitXorAssign(Tr(n,de(6))),n.addAssign(t),t.subAssign(e),t.bitXorAssign(Tr(e,de(8))),e.addAssign(n),n.subAssign(t),n.bitXorAssign(Tr(t,de(16))),t.addAssign(e),e.subAssign(n),e.bitXorAssign(Tr(n,de(19))),n.addAssign(t),t.subAssign(e),t.bitXorAssign(Tr(e,de(4))),e.addAssign(n)}),ef=_e(([n,e,t])=>{const i=Ye(t).toVar(),r=Ye(e).toVar(),s=Ye(n).toVar();return i.bitXorAssign(r),i.subAssign(Tr(r,de(14))),s.bitXorAssign(i),s.subAssign(Tr(i,de(11))),r.bitXorAssign(s),r.subAssign(Tr(s,de(25))),i.bitXorAssign(r),i.subAssign(Tr(r,de(16))),s.bitXorAssign(i),s.subAssign(Tr(i,de(4))),r.bitXorAssign(s),r.subAssign(Tr(s,de(14))),i.bitXorAssign(r),i.subAssign(Tr(r,de(24))),i}).setLayout({name:"mx_bjfinal",type:"uint",inputs:[{name:"a",type:"uint"},{name:"b",type:"uint"},{name:"c",type:"uint"}]}),Oi=_e(([n])=>{const e=Ye(n).toVar();return ce(e).div(ce(Ye(de(4294967295))))}).setLayout({name:"mx_bits_to_01",type:"float",inputs:[{name:"bits",type:"uint"}]}),qs=_e(([n])=>{const e=ce(n).toVar();return e.mul(e).mul(e).mul(e.mul(e.mul(6).sub(15)).add(10))}).setLayout({name:"mx_fade",type:"float",inputs:[{name:"t",type:"float"}]}),VW=_e(([n])=>{const e=de(n).toVar(),t=Ye(Ye(1)).toVar(),i=Ye(Ye(de(3735928559)).add(t.shiftLeft(Ye(2))).add(Ye(13))).toVar();return ef(i.add(Ye(e)),i,i)}).setLayout({name:"mx_hash_int_0",type:"uint",inputs:[{name:"x",type:"int"}]}),HW=_e(([n,e])=>{const t=de(e).toVar(),i=de(n).toVar(),r=Ye(Ye(2)).toVar(),s=Ye().toVar(),o=Ye().toVar(),a=Ye().toVar();return s.assign(o.assign(a.assign(Ye(de(3735928559)).add(r.shiftLeft(Ye(2))).add(Ye(13))))),s.addAssign(Ye(i)),o.addAssign(Ye(t)),ef(s,o,a)}).setLayout({name:"mx_hash_int_1",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),$W=_e(([n,e,t])=>{const i=de(t).toVar(),r=de(e).toVar(),s=de(n).toVar(),o=Ye(Ye(3)).toVar(),a=Ye().toVar(),l=Ye().toVar(),c=Ye().toVar();return a.assign(l.assign(c.assign(Ye(de(3735928559)).add(o.shiftLeft(Ye(2))).add(Ye(13))))),a.addAssign(Ye(s)),l.addAssign(Ye(r)),c.addAssign(Ye(i)),ef(a,l,c)}).setLayout({name:"mx_hash_int_2",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),GW=_e(([n,e,t,i])=>{const r=de(i).toVar(),s=de(t).toVar(),o=de(e).toVar(),a=de(n).toVar(),l=Ye(Ye(4)).toVar(),c=Ye().toVar(),u=Ye().toVar(),d=Ye().toVar();return c.assign(u.assign(d.assign(Ye(de(3735928559)).add(l.shiftLeft(Ye(2))).add(Ye(13))))),c.addAssign(Ye(a)),u.addAssign(Ye(o)),d.addAssign(Ye(s)),C4(c,u,d),c.addAssign(Ye(r)),ef(c,u,d)}).setLayout({name:"mx_hash_int_3",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"}]}),WW=_e(([n,e,t,i,r])=>{const s=de(r).toVar(),o=de(i).toVar(),a=de(t).toVar(),l=de(e).toVar(),c=de(n).toVar(),u=Ye(Ye(5)).toVar(),d=Ye().toVar(),h=Ye().toVar(),f=Ye().toVar();return d.assign(h.assign(f.assign(Ye(de(3735928559)).add(u.shiftLeft(Ye(2))).add(Ye(13))))),d.addAssign(Ye(c)),h.addAssign(Ye(l)),f.addAssign(Ye(a)),C4(d,h,f),d.addAssign(Ye(o)),h.addAssign(Ye(s)),ef(d,h,f)}).setLayout({name:"mx_hash_int_4",type:"uint",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xx",type:"int"},{name:"yy",type:"int"}]}),tn=bi([VW,HW,$W,GW,WW]),QW=_e(([n,e])=>{const t=de(e).toVar(),i=de(n).toVar(),r=Ye(tn(i,t)).toVar(),s=Uu().toVar();return s.x.assign(r.bitAnd(de(255))),s.y.assign(r.shiftRight(de(8)).bitAnd(de(255))),s.z.assign(r.shiftRight(de(16)).bitAnd(de(255))),s}).setLayout({name:"mx_hash_vec3_0",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"}]}),jW=_e(([n,e,t])=>{const i=de(t).toVar(),r=de(e).toVar(),s=de(n).toVar(),o=Ye(tn(s,r,i)).toVar(),a=Uu().toVar();return a.x.assign(o.bitAnd(de(255))),a.y.assign(o.shiftRight(de(8)).bitAnd(de(255))),a.z.assign(o.shiftRight(de(16)).bitAnd(de(255))),a}).setLayout({name:"mx_hash_vec3_1",type:"uvec3",inputs:[{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"}]}),qr=bi([QW,jW]),qW=_e(([n])=>{const e=He(n).toVar(),t=de().toVar(),i=de().toVar(),r=ce(_n(e.x,t)).toVar(),s=ce(_n(e.y,i)).toVar(),o=ce(qs(r)).toVar(),a=ce(qs(s)).toVar(),l=ce(A4(ai(tn(t,i),r,s),ai(tn(t.add(de(1)),i),r.sub(1),s),ai(tn(t,i.add(de(1))),r,s.sub(1)),ai(tn(t.add(de(1)),i.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return T4(l)}).setLayout({name:"mx_perlin_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"}]}),XW=_e(([n])=>{const e=ve(n).toVar(),t=de().toVar(),i=de().toVar(),r=de().toVar(),s=ce(_n(e.x,t)).toVar(),o=ce(_n(e.y,i)).toVar(),a=ce(_n(e.z,r)).toVar(),l=ce(qs(s)).toVar(),c=ce(qs(o)).toVar(),u=ce(qs(a)).toVar(),d=ce(b4(ai(tn(t,i,r),s,o,a),ai(tn(t.add(de(1)),i,r),s.sub(1),o,a),ai(tn(t,i.add(de(1)),r),s,o.sub(1),a),ai(tn(t.add(de(1)),i.add(de(1)),r),s.sub(1),o.sub(1),a),ai(tn(t,i,r.add(de(1))),s,o,a.sub(1)),ai(tn(t.add(de(1)),i,r.add(de(1))),s.sub(1),o,a.sub(1)),ai(tn(t,i.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),ai(tn(t.add(de(1)),i.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return w4(d)}).setLayout({name:"mx_perlin_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"}]}),Nx=bi([qW,XW]),KW=_e(([n])=>{const e=He(n).toVar(),t=de().toVar(),i=de().toVar(),r=ce(_n(e.x,t)).toVar(),s=ce(_n(e.y,i)).toVar(),o=ce(qs(r)).toVar(),a=ce(qs(s)).toVar(),l=ve(A4(jr(qr(t,i),r,s),jr(qr(t.add(de(1)),i),r.sub(1),s),jr(qr(t,i.add(de(1))),r,s.sub(1)),jr(qr(t.add(de(1)),i.add(de(1))),r.sub(1),s.sub(1)),o,a)).toVar();return T4(l)}).setLayout({name:"mx_perlin_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),YW=_e(([n])=>{const e=ve(n).toVar(),t=de().toVar(),i=de().toVar(),r=de().toVar(),s=ce(_n(e.x,t)).toVar(),o=ce(_n(e.y,i)).toVar(),a=ce(_n(e.z,r)).toVar(),l=ce(qs(s)).toVar(),c=ce(qs(o)).toVar(),u=ce(qs(a)).toVar(),d=ve(b4(jr(qr(t,i,r),s,o,a),jr(qr(t.add(de(1)),i,r),s.sub(1),o,a),jr(qr(t,i.add(de(1)),r),s,o.sub(1),a),jr(qr(t.add(de(1)),i.add(de(1)),r),s.sub(1),o.sub(1),a),jr(qr(t,i,r.add(de(1))),s,o,a.sub(1)),jr(qr(t.add(de(1)),i,r.add(de(1))),s.sub(1),o,a.sub(1)),jr(qr(t,i.add(de(1)),r.add(de(1))),s,o.sub(1),a.sub(1)),jr(qr(t.add(de(1)),i.add(de(1)),r.add(de(1))),s.sub(1),o.sub(1),a.sub(1)),l,c,u)).toVar();return w4(d)}).setLayout({name:"mx_perlin_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),Px=bi([KW,YW]),ZW=_e(([n])=>{const e=ce(n).toVar(),t=de(Fn(e)).toVar();return Oi(tn(t))}).setLayout({name:"mx_cell_noise_float_0",type:"float",inputs:[{name:"p",type:"float"}]}),JW=_e(([n])=>{const e=He(n).toVar(),t=de(Fn(e.x)).toVar(),i=de(Fn(e.y)).toVar();return Oi(tn(t,i))}).setLayout({name:"mx_cell_noise_float_1",type:"float",inputs:[{name:"p",type:"vec2"}]}),eQ=_e(([n])=>{const e=ve(n).toVar(),t=de(Fn(e.x)).toVar(),i=de(Fn(e.y)).toVar(),r=de(Fn(e.z)).toVar();return Oi(tn(t,i,r))}).setLayout({name:"mx_cell_noise_float_2",type:"float",inputs:[{name:"p",type:"vec3"}]}),tQ=_e(([n])=>{const e=vt(n).toVar(),t=de(Fn(e.x)).toVar(),i=de(Fn(e.y)).toVar(),r=de(Fn(e.z)).toVar(),s=de(Fn(e.w)).toVar();return Oi(tn(t,i,r,s))}).setLayout({name:"mx_cell_noise_float_3",type:"float",inputs:[{name:"p",type:"vec4"}]}),nQ=bi([ZW,JW,eQ,tQ]),iQ=_e(([n])=>{const e=ce(n).toVar(),t=de(Fn(e)).toVar();return ve(Oi(tn(t,de(0))),Oi(tn(t,de(1))),Oi(tn(t,de(2))))}).setLayout({name:"mx_cell_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"float"}]}),rQ=_e(([n])=>{const e=He(n).toVar(),t=de(Fn(e.x)).toVar(),i=de(Fn(e.y)).toVar();return ve(Oi(tn(t,i,de(0))),Oi(tn(t,i,de(1))),Oi(tn(t,i,de(2))))}).setLayout({name:"mx_cell_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec2"}]}),sQ=_e(([n])=>{const e=ve(n).toVar(),t=de(Fn(e.x)).toVar(),i=de(Fn(e.y)).toVar(),r=de(Fn(e.z)).toVar();return ve(Oi(tn(t,i,r,de(0))),Oi(tn(t,i,r,de(1))),Oi(tn(t,i,r,de(2))))}).setLayout({name:"mx_cell_noise_vec3_2",type:"vec3",inputs:[{name:"p",type:"vec3"}]}),oQ=_e(([n])=>{const e=vt(n).toVar(),t=de(Fn(e.x)).toVar(),i=de(Fn(e.y)).toVar(),r=de(Fn(e.z)).toVar(),s=de(Fn(e.w)).toVar();return ve(Oi(tn(t,i,r,s,de(0))),Oi(tn(t,i,r,s,de(1))),Oi(tn(t,i,r,s,de(2))))}).setLayout({name:"mx_cell_noise_vec3_3",type:"vec3",inputs:[{name:"p",type:"vec4"}]}),E4=bi([iQ,rQ,sQ,oQ]),Mm=_e(([n,e,t,i])=>{const r=ce(i).toVar(),s=ce(t).toVar(),o=de(e).toVar(),a=ve(n).toVar(),l=ce(0).toVar(),c=ce(1).toVar();return cn(o,()=>{l.addAssign(c.mul(Nx(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_float",type:"float",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),M4=_e(([n,e,t,i])=>{const r=ce(i).toVar(),s=ce(t).toVar(),o=de(e).toVar(),a=ve(n).toVar(),l=ve(0).toVar(),c=ce(1).toVar();return cn(o,()=>{l.addAssign(c.mul(Px(a))),c.mulAssign(r),a.mulAssign(s)}),l}).setLayout({name:"mx_fractal_noise_vec3",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),aQ=_e(([n,e,t,i])=>{const r=ce(i).toVar(),s=ce(t).toVar(),o=de(e).toVar(),a=ve(n).toVar();return He(Mm(a,o,s,r),Mm(a.add(ve(de(19),de(193),de(17))),o,s,r))}).setLayout({name:"mx_fractal_noise_vec2",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),lQ=_e(([n,e,t,i])=>{const r=ce(i).toVar(),s=ce(t).toVar(),o=de(e).toVar(),a=ve(n).toVar(),l=ve(M4(a,o,s,r)).toVar(),c=ce(Mm(a.add(ve(de(19),de(193),de(17))),o,s,r)).toVar();return vt(l,c)}).setLayout({name:"mx_fractal_noise_vec4",type:"vec4",inputs:[{name:"p",type:"vec3"},{name:"octaves",type:"int"},{name:"lacunarity",type:"float"},{name:"diminish",type:"float"}]}),cQ=_e(([n,e,t,i,r,s,o])=>{const a=de(o).toVar(),l=ce(s).toVar(),c=de(r).toVar(),u=de(i).toVar(),d=de(t).toVar(),h=de(e).toVar(),f=He(n).toVar(),p=ve(E4(He(h.add(u),d.add(c)))).toVar(),g=He(p.x,p.y).toVar();g.subAssign(.5),g.mulAssign(l),g.addAssign(.5);const y=He(He(ce(h),ce(d)).add(g)).toVar(),m=He(y.sub(f)).toVar();return Dt(a.equal(de(2)),()=>mn(m.x).add(mn(m.y))),Dt(a.equal(de(3)),()=>ui(mn(m.x),mn(m.y))),za(m,m)}).setLayout({name:"mx_worley_distance_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),uQ=_e(([n,e,t,i,r,s,o,a,l])=>{const c=de(l).toVar(),u=ce(a).toVar(),d=de(o).toVar(),h=de(s).toVar(),f=de(r).toVar(),p=de(i).toVar(),g=de(t).toVar(),y=de(e).toVar(),m=ve(n).toVar(),v=ve(E4(ve(y.add(f),g.add(h),p.add(d)))).toVar();v.subAssign(.5),v.mulAssign(u),v.addAssign(.5);const x=ve(ve(ce(y),ce(g),ce(p)).add(v)).toVar(),_=ve(x.sub(m)).toVar();return Dt(c.equal(de(2)),()=>mn(_.x).add(mn(_.y)).add(mn(_.z))),Dt(c.equal(de(3)),()=>ui(ui(mn(_.x),mn(_.y)),mn(_.z))),za(_,_)}).setLayout({name:"mx_worley_distance_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"x",type:"int"},{name:"y",type:"int"},{name:"z",type:"int"},{name:"xoff",type:"int"},{name:"yoff",type:"int"},{name:"zoff",type:"int"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),zu=bi([cQ,uQ]),dQ=_e(([n,e,t])=>{const i=de(t).toVar(),r=ce(e).toVar(),s=He(n).toVar(),o=de().toVar(),a=de().toVar(),l=He(_n(s.x,o),_n(s.y,a)).toVar(),c=ce(1e6).toVar();return cn({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{cn({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{const h=ce(zu(l,u,d,o,a,r,i)).toVar();c.assign(Fr(c,h))})}),Dt(i.equal(de(0)),()=>{c.assign(lo(c))}),c}).setLayout({name:"mx_worley_noise_float_0",type:"float",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),hQ=_e(([n,e,t])=>{const i=de(t).toVar(),r=ce(e).toVar(),s=He(n).toVar(),o=de().toVar(),a=de().toVar(),l=He(_n(s.x,o),_n(s.y,a)).toVar(),c=He(1e6,1e6).toVar();return cn({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{cn({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{const h=ce(zu(l,u,d,o,a,r,i)).toVar();Dt(h.lessThan(c.x),()=>{c.y.assign(c.x),c.x.assign(h)}).ElseIf(h.lessThan(c.y),()=>{c.y.assign(h)})})}),Dt(i.equal(de(0)),()=>{c.assign(lo(c))}),c}).setLayout({name:"mx_worley_noise_vec2_0",type:"vec2",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),fQ=_e(([n,e,t])=>{const i=de(t).toVar(),r=ce(e).toVar(),s=He(n).toVar(),o=de().toVar(),a=de().toVar(),l=He(_n(s.x,o),_n(s.y,a)).toVar(),c=ve(1e6,1e6,1e6).toVar();return cn({start:-1,end:de(1),name:"x",condition:"<="},({x:u})=>{cn({start:-1,end:de(1),name:"y",condition:"<="},({y:d})=>{const h=ce(zu(l,u,d,o,a,r,i)).toVar();Dt(h.lessThan(c.x),()=>{c.z.assign(c.y),c.y.assign(c.x),c.x.assign(h)}).ElseIf(h.lessThan(c.y),()=>{c.z.assign(c.y),c.y.assign(h)}).ElseIf(h.lessThan(c.z),()=>{c.z.assign(h)})})}),Dt(i.equal(de(0)),()=>{c.assign(lo(c))}),c}).setLayout({name:"mx_worley_noise_vec3_0",type:"vec3",inputs:[{name:"p",type:"vec2"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),pQ=_e(([n,e,t])=>{const i=de(t).toVar(),r=ce(e).toVar(),s=ve(n).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=ve(_n(s.x,o),_n(s.y,a),_n(s.z,l)).toVar(),u=ce(1e6).toVar();return cn({start:-1,end:de(1),name:"x",condition:"<="},({x:d})=>{cn({start:-1,end:de(1),name:"y",condition:"<="},({y:h})=>{cn({start:-1,end:de(1),name:"z",condition:"<="},({z:f})=>{const p=ce(zu(c,d,h,f,o,a,l,r,i)).toVar();u.assign(Fr(u,p))})})}),Dt(i.equal(de(0)),()=>{u.assign(lo(u))}),u}).setLayout({name:"mx_worley_noise_float_1",type:"float",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),mQ=bi([dQ,pQ]),gQ=_e(([n,e,t])=>{const i=de(t).toVar(),r=ce(e).toVar(),s=ve(n).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=ve(_n(s.x,o),_n(s.y,a),_n(s.z,l)).toVar(),u=He(1e6,1e6).toVar();return cn({start:-1,end:de(1),name:"x",condition:"<="},({x:d})=>{cn({start:-1,end:de(1),name:"y",condition:"<="},({y:h})=>{cn({start:-1,end:de(1),name:"z",condition:"<="},({z:f})=>{const p=ce(zu(c,d,h,f,o,a,l,r,i)).toVar();Dt(p.lessThan(u.x),()=>{u.y.assign(u.x),u.x.assign(p)}).ElseIf(p.lessThan(u.y),()=>{u.y.assign(p)})})})}),Dt(i.equal(de(0)),()=>{u.assign(lo(u))}),u}).setLayout({name:"mx_worley_noise_vec2_1",type:"vec2",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),yQ=bi([hQ,gQ]),vQ=_e(([n,e,t])=>{const i=de(t).toVar(),r=ce(e).toVar(),s=ve(n).toVar(),o=de().toVar(),a=de().toVar(),l=de().toVar(),c=ve(_n(s.x,o),_n(s.y,a),_n(s.z,l)).toVar(),u=ve(1e6,1e6,1e6).toVar();return cn({start:-1,end:de(1),name:"x",condition:"<="},({x:d})=>{cn({start:-1,end:de(1),name:"y",condition:"<="},({y:h})=>{cn({start:-1,end:de(1),name:"z",condition:"<="},({z:f})=>{const p=ce(zu(c,d,h,f,o,a,l,r,i)).toVar();Dt(p.lessThan(u.x),()=>{u.z.assign(u.y),u.y.assign(u.x),u.x.assign(p)}).ElseIf(p.lessThan(u.y),()=>{u.z.assign(u.y),u.y.assign(p)}).ElseIf(p.lessThan(u.z),()=>{u.z.assign(p)})})})}),Dt(i.equal(de(0)),()=>{u.assign(lo(u))}),u}).setLayout({name:"mx_worley_noise_vec3_1",type:"vec3",inputs:[{name:"p",type:"vec3"},{name:"jitter",type:"float"},{name:"metric",type:"int"}]}),_Q=bi([fQ,vQ]),xQ=_e(([n])=>{const e=n.y,t=n.z,i=ve().toVar();return Dt(e.lessThan(1e-4),()=>{i.assign(ve(t,t,t))}).Else(()=>{let r=n.x;r=r.sub(js(r)).mul(6).toVar();const s=de(sx(r)),o=r.sub(ce(s)),a=t.mul(e.oneMinus()),l=t.mul(e.mul(o).oneMinus()),c=t.mul(e.mul(o.oneMinus()).oneMinus());Dt(s.equal(de(0)),()=>{i.assign(ve(t,c,a))}).ElseIf(s.equal(de(1)),()=>{i.assign(ve(l,t,a))}).ElseIf(s.equal(de(2)),()=>{i.assign(ve(a,t,c))}).ElseIf(s.equal(de(3)),()=>{i.assign(ve(a,l,t))}).ElseIf(s.equal(de(4)),()=>{i.assign(ve(c,a,t))}).Else(()=>{i.assign(ve(t,a,l))})}),i}).setLayout({name:"mx_hsvtorgb",type:"vec3",inputs:[{name:"hsv",type:"vec3"}]}),SQ=_e(([n])=>{const e=ve(n).toVar(),t=ce(e.x).toVar(),i=ce(e.y).toVar(),r=ce(e.z).toVar(),s=ce(Fr(t,Fr(i,r))).toVar(),o=ce(ui(t,ui(i,r))).toVar(),a=ce(o.sub(s)).toVar(),l=ce().toVar(),c=ce().toVar(),u=ce().toVar();return u.assign(o),Dt(o.greaterThan(0),()=>{c.assign(a.div(o))}).Else(()=>{c.assign(0)}),Dt(c.lessThanEqual(0),()=>{l.assign(0)}).Else(()=>{Dt(t.greaterThanEqual(o),()=>{l.assign(i.sub(r).div(a))}).ElseIf(i.greaterThanEqual(o),()=>{l.assign(On(2,r.sub(t).div(a)))}).Else(()=>{l.assign(On(4,t.sub(i).div(a)))}),l.mulAssign(1/6),Dt(l.lessThan(0),()=>{l.addAssign(1)})}),ve(l,c,u)}).setLayout({name:"mx_rgbtohsv",type:"vec3",inputs:[{name:"c",type:"vec3"}]}),AQ=_e(([n])=>{const e=ve(n).toVar(),t=X_(Y_(e,ve(.04045))).toVar(),i=ve(e.div(12.92)).toVar(),r=ve(gs(ui(e.add(ve(.055)),ve(0)).div(1.055),ve(2.4))).toVar();return Ln(i,r,t)}).setLayout({name:"mx_srgb_texture_to_lin_rec709",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),R4=(n,e)=>{n=ce(n),e=ce(e);const t=He(e.dFdx(),e.dFdy()).length().mul(.7071067811865476);return Vl(n.sub(t),n.add(t),e)},I4=(n,e,t,i)=>Ln(n,e,t[i].clamp()),bQ=(n,e,t=xn())=>I4(n,e,t,"x"),TQ=(n,e,t=xn())=>I4(n,e,t,"y"),N4=(n,e,t,i,r)=>Ln(n,e,R4(t,i[r])),wQ=(n,e,t,i=xn())=>N4(n,e,t,i,"x"),CQ=(n,e,t,i=xn())=>N4(n,e,t,i,"y"),EQ=(n=1,e=0,t=xn())=>t.mul(n).add(e),MQ=(n,e=1)=>(n=ce(n),n.abs().pow(e).mul(n.sign())),RQ=(n,e=1,t=.5)=>ce(n).sub(t).mul(e).add(t),IQ=(n=xn(),e=1,t=0)=>Nx(n.convert("vec2|vec3")).mul(e).add(t),NQ=(n=xn(),e=1,t=0)=>Px(n.convert("vec2|vec3")).mul(e).add(t),PQ=(n=xn(),e=1,t=0)=>(n=n.convert("vec2|vec3"),vt(Px(n),Nx(n.add(He(19,73)))).mul(e).add(t)),LQ=(n=xn(),e=1)=>mQ(n.convert("vec2|vec3"),e,de(1)),DQ=(n=xn(),e=1)=>yQ(n.convert("vec2|vec3"),e,de(1)),FQ=(n=xn(),e=1)=>_Q(n.convert("vec2|vec3"),e,de(1)),OQ=(n=xn())=>nQ(n.convert("vec2|vec3")),BQ=(n=xn(),e=3,t=2,i=.5,r=1)=>Mm(n,de(e),t,i).mul(r),kQ=(n=xn(),e=3,t=2,i=.5,r=1)=>aQ(n,de(e),t,i).mul(r),UQ=(n=xn(),e=3,t=2,i=.5,r=1)=>M4(n,de(e),t,i).mul(r),zQ=(n=xn(),e=3,t=2,i=.5,r=1)=>lQ(n,de(e),t,i).mul(r),VQ=_e(([n,e,t])=>{const i=jl(n).toVar("nDir"),r=Bt(ce(.5).mul(e.sub(t)),Nl).div(i).toVar("rbmax"),s=Bt(ce(-.5).mul(e.sub(t)),Nl).div(i).toVar("rbmin"),o=ve().toVar("rbminmax");o.x=i.x.greaterThan(ce(0)).select(r.x,s.x),o.y=i.y.greaterThan(ce(0)).select(r.y,s.y),o.z=i.z.greaterThan(ce(0)).select(r.z,s.z);const a=Fr(Fr(o.x,o.y),o.z).toVar("correction");return Nl.add(i.mul(a)).toVar("boxIntersection").sub(t)}),HQ=_e(([n,e])=>{const t=n.x,i=n.y,r=n.z;let s=e.element(0).mul(.886227);return s=s.add(e.element(1).mul(2*.511664).mul(i)),s=s.add(e.element(2).mul(2*.511664).mul(r)),s=s.add(e.element(3).mul(2*.511664).mul(t)),s=s.add(e.element(4).mul(2*.429043).mul(t).mul(i)),s=s.add(e.element(5).mul(2*.429043).mul(i).mul(r)),s=s.add(e.element(6).mul(r.mul(r).mul(.743125).sub(.247708))),s=s.add(e.element(7).mul(2*.429043).mul(t).mul(r)),s=s.add(e.element(8).mul(.429043).mul(St(t,t).sub(St(i,i)))),s});var O=Object.freeze({__proto__:null,BRDF_GGX:hH,BRDF_Lambert:aH,BasicShadowFilter:y4,Break:LM,Const:RE,Continue:NV,DFGApprox:fH,D_GGX:GM,Discard:jE,EPSILON:KC,F_Schlick:VM,Fn:_e,INFINITY:$U,If:Dt,Loop:cn,NodeAccess:Gs,NodeShaderStage:Hy,NodeType:Yk,NodeUpdateType:Wt,PCFShadowFilter:v4,PCFSoftShadowFilter:_4,PI:_m,PI2:GU,Return:az,Schlick_to_F0:pH,ScriptableNodeResources:Pp,ShaderNode:$d,TBNViewMatrix:_x,VSMShadowFilter:x4,V_GGX_SmithCorrelated:$M,Var:ME,abs:mn,acesFilmicToneMapping:fG,acos:iE,add:On,addMethodChaining:Ne,addNodeElement:cz,agxToneMapping:yG,all:Z_,alphaT:jy,and:UC,anisotropy:NC,anisotropyB:qc,anisotropyT:Ip,any:YC,append:pC,array:TC,arrayBuffer:_U,asin:nE,assign:PC,atan:tx,atan2:TE,atomicAdd:XG,atomicAnd:JG,atomicFunc:co,atomicLoad:jG,atomicMax:YG,atomicMin:ZG,atomicOr:eW,atomicStore:qG,atomicSub:KG,atomicXor:tW,attenuationColor:UU,attenuationDistance:kU,attribute:Yo,attributeArray:I$,backgroundBlurriness:O$,backgroundIntensity:B$,backgroundRotation:k$,batch:IM,billboarding:l$,bitAnd:$C,bitNot:GC,bitOr:WC,bitXor:QC,bitangentGeometry:Oz,bitangentLocal:Bz,bitangentView:pM,bitangentWorld:kz,bitcast:WU,blendBurn:s4,blendColor:W$,blendDodge:o4,blendOverlay:l4,blendScreen:a4,blur:SH,bool:qo,buffer:$h,bufferAttribute:Hh,bumpMap:yM,burn:Q$,bvec2:yC,bvec3:X_,bvec4:SC,bypass:$E,cache:HE,call:LC,cameraFar:xa,cameraIndex:px,cameraNear:_a,cameraNormalMatrix:yz,cameraPosition:vz,cameraProjectionMatrix:Gh,cameraProjectionMatrixInverse:mz,cameraViewMatrix:ss,cameraWorldMatrix:gz,cbrt:vE,cdl:eG,ceil:l0,checker:EW,cineonToneMapping:dG,clamp:Ko,clearcoat:bU,clearcoatRoughness:TU,code:g0,color:mC,colorSpaceToWorking:hx,colorToDirection:rH,compute:VE,cond:wE,context:cx,convert:bC,convertColorSpace:YU,convertToTexture:S$,cos:Mo,cross:u0,cubeTexture:hM,dFdx:ix,dFdy:rx,dashSize:PU,defaultBuildStages:Zk,defaultShaderStages:aC,defined:ph,degrees:JC,deltaTime:JM,densityFog:IG,densityFogFactor:p4,depth:Tx,depthPass:oG,difference:fE,diffuseColor:hs,directPointLight:CW,directionToColor:iH,dispersion:zU,distance:hE,div:Xo,dodge:j$,dot:za,drawIndex:EM,dynamicBufferAttribute:zE,element:AC,emissive:Qy,equal:DC,equals:uE,equirectUV:oH,exp:eE,exp2:xu,expression:Oa,faceDirection:Qh,faceForward:lx,faceforward:QU,float:ce,floor:js,fog:Ex,fract:na,frameGroup:SU,frameId:ZH,frontFacing:nM,fwidth:lE,gain:WH,gapSize:LU,getConstNodeType:hC,getCurrentStack:fC,getDirection:jM,getDistanceAttenuation:S4,getGeometryRoughness:HM,getNormalFromDepth:b$,getParallaxCorrectNormal:VQ,getRoughness:lH,getScreenPosition:A$,getShIrradianceAt:HQ,getTextureIndex:YM,getViewPosition:Rc,globalId:OG,glsl:SG,glslFn:bG,grayscale:K$,greaterThan:Y_,greaterThanEqual:kC,hash:GH,highpModelNormalViewMatrix:Rz,highpModelViewMatrix:Mz,hue:J$,instance:CV,instanceIndex:Kh,instancedArray:N$,instancedBufferAttribute:Sm,instancedDynamicBufferAttribute:qy,instancedMesh:RM,int:de,inverseSqrt:ex,inversesqrt:jU,invocationLocalIndex:wV,invocationSubgroupIndex:TV,ior:FU,iridescence:IC,iridescenceIOR:EU,iridescenceThickness:MU,ivec2:Xn,ivec3:vC,ivec4:_C,js:_G,label:EE,length:xm,lengthSq:ax,lessThan:OC,lessThanEqual:BC,lightPosition:m4,lightProjectionUV:nW,lightShadowMatrix:Rx,lightTargetDirection:rW,lightTargetPosition:g4,lightViewPosition:iW,lightingContext:OM,lights:lW,linearDepth:Tm,linearToneMapping:cG,localId:BG,log:J_,log2:Ho,logarithmicDepthToViewZ:QV,loop:PV,luminance:Cx,mat2:o0,mat3:is,mat4:Il,matcapUV:RH,materialAO:TM,materialAlphaTest:vM,materialAnisotropy:aV,materialAnisotropyVector:Mc,materialAttenuationColor:mV,materialAttenuationDistance:pV,materialClearcoat:tV,materialClearcoatNormal:iV,materialClearcoatRoughness:nV,materialColor:_M,materialDispersion:AV,materialEmissive:xM,materialIOR:fV,materialIridescence:lV,materialIridescenceIOR:cV,materialIridescenceThickness:uV,materialLightMap:bM,materialLineDashOffset:xV,materialLineDashSize:yV,materialLineGapSize:vV,materialLineScale:gV,materialLineWidth:_V,materialMetalness:eV,materialNormal:AM,materialOpacity:SM,materialPointSize:SV,materialReference:ml,materialReflectivity:Zz,materialRefractionRatio:aM,materialRotation:rV,materialRoughness:Jz,materialSheen:sV,materialSheenRoughness:oV,materialShininess:jz,materialSpecular:qz,materialSpecularColor:Kz,materialSpecularIntensity:Xz,materialSpecularStrength:Yz,materialThickness:hV,materialTransmission:dV,max:ui,maxMipLevel:KE,mediumpModelViewMatrix:eM,metalness:AU,min:Fr,mix:Ln,mixElement:AE,mod:ox,modInt:K_,modelDirection:bz,modelNormalMatrix:JE,modelPosition:Tz,modelScale:wz,modelViewMatrix:Wh,modelViewPosition:Cz,modelViewProjection:wM,modelWorldMatrix:Fo,modelWorldMatrixInverse:Ez,morphReference:DM,mrt:ZM,mul:St,mx_aastep:R4,mx_cell_noise_float:OQ,mx_contrast:RQ,mx_fractal_noise_float:BQ,mx_fractal_noise_vec2:kQ,mx_fractal_noise_vec3:UQ,mx_fractal_noise_vec4:zQ,mx_hsvtorgb:xQ,mx_noise_float:IQ,mx_noise_vec3:NQ,mx_noise_vec4:PQ,mx_ramplr:bQ,mx_ramptb:TQ,mx_rgbtohsv:SQ,mx_safepower:MQ,mx_splitlr:wQ,mx_splittb:CQ,mx_srgb_texture_to_lin_rec709:AQ,mx_transform_uv:EQ,mx_worley_noise_float:LQ,mx_worley_noise_vec2:DQ,mx_worley_noise_vec3:FQ,negate:rE,neutralToneMapping:vG,nodeArray:Rl,nodeImmutable:Qe,nodeObject:Fe,nodeObjects:kh,nodeProxy:Pe,normalFlat:iM,normalGeometry:gx,normalLocal:cr,normalMap:Ky,normalView:to,normalWorld:rM,normalize:jl,not:VC,notEqual:FC,numWorkgroups:DG,objectDirection:_z,objectGroup:EC,objectPosition:ZE,objectScale:Sz,objectViewPosition:Az,objectWorldMatrix:xz,oneMinus:sE,or:zC,orthographicDepthToViewZ:WV,oscSawtooth:s$,oscSine:n$,oscSquare:i$,oscTriangle:r$,output:gh,outputStruct:HH,overlay:X$,overloadingFn:bi,parabola:tv,parallaxDirection:gM,parallaxUV:zz,parameter:FH,pass:rG,passTexture:sG,pcurve:QH,perspectiveDepthToViewZ:Ax,pmremTexture:EH,pointUV:F$,pointWidth:DU,positionGeometry:mx,positionLocal:Nn,positionPrevious:Am,positionView:Yn,positionViewDirection:Er,positionWorld:Nl,positionWorldDirection:tM,posterize:nG,pow:gs,pow2:pE,pow3:mE,pow4:gE,property:MC,radians:ZC,rand:SE,range:PG,rangeFog:RG,rangeFogFactor:f4,reciprocal:aE,reference:Pn,referenceBuffer:Xy,reflect:dE,reflectVector:uM,reflectView:lM,reflector:g$,refract:xE,refractVector:dM,refractView:cM,reinhardToneMapping:uG,remainder:XC,remap:WE,remapClamp:QE,renderGroup:kt,renderOutput:qE,rendererReference:BE,rotate:XM,rotateUV:o$,roughness:RC,round:oE,rtt:n4,sRGBTransferEOTF:PE,sRGBTransferOETF:LE,sampler:hz,saturate:_E,saturation:Y$,screen:q$,screenCoordinate:Yh,screenSize:bm,screenUV:Va,scriptable:MG,scriptableValue:Np,select:sr,setCurrentStack:Wy,shaderStages:Jk,shadow:wW,shadowPositionWorld:Ix,shapeCircle:MW,sharedUniformGroup:a0,sheen:wU,sheenRoughness:CU,shiftLeft:jC,shiftRight:qC,shininess:NU,sign:nx,sin:wr,sinc:jH,skinning:RV,skinningReference:PM,smoothstep:Vl,smoothstepElement:bE,specularColor:RU,specularF90:IU,spherizeUV:a$,split:xU,spritesheetUV:d$,sqrt:lo,stack:BH,step:c0,storage:m0,storageBarrier:VG,storageObject:R$,storageTexture:i4,string:vU,struct:VH,sub:Bt,subgroupIndex:bV,subgroupSize:kG,tan:tE,tangentGeometry:h0,tangentLocal:jh,tangentView:qh,tangentWorld:fM,temp:IE,texture:er,texture3D:LH,textureBarrier:HG,textureBicubic:mH,textureCubeUV:qM,textureLoad:Rn,textureSize:Pa,textureStore:z$,thickness:BU,time:ql,timerDelta:t$,timerGlobal:e$,timerLocal:JH,toOutputColorSpace:DE,toWorkingColorSpace:FE,toneMapping:kE,toneMappingExposure:UE,toonOutlinePass:lG,transformDirection:yE,transformNormal:oM,transformNormalToView:yx,transformedBentNormalView:Vz,transformedBitangentView:mM,transformedBitangentWorld:Uz,transformedClearcoatNormalView:Nz,transformedNormalView:Jo,transformedNormalWorld:sM,transformedTangentView:vx,transformedTangentWorld:Fz,transmission:OU,transpose:cE,triNoise3D:XH,triplanarTexture:f$,triplanarTextures:e4,trunc:sx,tslFn:yU,uint:Ye,uniform:Rt,uniformArray:Do,uniformGroup:CC,uniforms:pz,userData:H$,uv:xn,uvec2:gC,uvec3:Uu,uvec4:xC,varying:tr,varyingProperty:mh,vec2:He,vec3:ve,vec4:vt,vectorComponents:ku,velocity:G$,vertexColor:L$,vertexIndex:CM,vertexStage:NE,vibrance:Z$,viewZToLogarithmicDepth:bx,viewZToOrthographicDepth:Xc,viewZToPerspectiveDepth:UM,viewport:xx,viewportBottomLeft:VV,viewportCoordinate:kM,viewportDepthTexture:Sx,viewportLinearDepth:jV,viewportMipTexture:$V,viewportResolution:UV,viewportSafeUV:c$,viewportSharedTexture:nH,viewportSize:BM,viewportTexture:HV,viewportTopLeft:zV,viewportUV:kV,wgsl:xG,wgslFn:TG,workgroupArray:WG,workgroupBarrier:zG,workgroupId:FG,workingToColorSpace:OE,xor:HC});const o1=jM(xn(),Yo("faceIndex")).normalize();o1.x,o1.y,o1.z;const bc=typeof self<"u"?self.GPUShaderStage:{VERTEX:1,FRAGMENT:2,COMPUTE:4};Gs.READ_ONLY+"",Gs.WRITE_ONLY+"",Gs.READ_WRITE+"";bc&&bc.VERTEX,bc&&bc.FRAGMENT,bc&&bc.COMPUTE;const ol={tsl_xor:new qn("fn tsl_xor( a : bool, b : bool ) -> bool { return ( a || b ) && !( a && b ); }"),mod_float:new qn("fn tsl_mod_float( x : f32, y : f32 ) -> f32 { return x - y * floor( x / y ); }"),mod_vec2:new qn("fn tsl_mod_vec2( x : vec2f, y : vec2f ) -> vec2f { return x - y * floor( x / y ); }"),mod_vec3:new qn("fn tsl_mod_vec3( x : vec3f, y : vec3f ) -> vec3f { return x - y * floor( x / y ); }"),mod_vec4:new qn("fn tsl_mod_vec4( x : vec4f, y : vec4f ) -> vec4f { return x - y * floor( x / y ); }"),equals_bool:new qn("fn tsl_equals_bool( a : bool, b : bool ) -> bool { return a == b; }"),equals_bvec2:new qn("fn tsl_equals_bvec2( a : vec2f, b : vec2f ) -> vec2 { return vec2( a.x == b.x, a.y == b.y ); }"),equals_bvec3:new qn("fn tsl_equals_bvec3( a : vec3f, b : vec3f ) -> vec3 { return vec3( a.x == b.x, a.y == b.y, a.z == b.z ); }"),equals_bvec4:new qn("fn tsl_equals_bvec4( a : vec4f, b : vec4f ) -> vec4 { return vec4( a.x == b.x, a.y == b.y, a.z == b.z, a.w == b.w ); }"),repeatWrapping_float:new qn("fn tsl_repeatWrapping_float( coord: f32 ) -> f32 { return fract( coord ); }"),mirrorWrapping_float:new qn("fn tsl_mirrorWrapping_float( coord: f32 ) -> f32 { let mirrored = fract( coord * 0.5 ) * 2.0; return 1.0 - abs( 1.0 - mirrored ); }"),clampWrapping_float:new qn("fn tsl_clampWrapping_float( coord: f32 ) -> f32 { return clamp( coord, 0.0, 1.0 ); }"),biquadraticTexture:new qn("\nfn tsl_biquadraticTexture( map : texture_2d, coord : vec2f, iRes : vec2u, level : u32 ) -> vec4f {\n\n let res = vec2f( iRes );\n\n let uvScaled = coord * res;\n let uvWrapping = ( ( uvScaled % res ) + res ) % res;\n\n // https://www.shadertoy.com/view/WtyXRy\n\n let uv = uvWrapping - 0.5;\n let iuv = floor( uv );\n let f = fract( uv );\n\n let rg1 = textureLoad( map, vec2u( iuv + vec2( 0.5, 0.5 ) ) % iRes, level );\n let rg2 = textureLoad( map, vec2u( iuv + vec2( 1.5, 0.5 ) ) % iRes, level );\n let rg3 = textureLoad( map, vec2u( iuv + vec2( 0.5, 1.5 ) ) % iRes, level );\n let rg4 = textureLoad( map, vec2u( iuv + vec2( 1.5, 1.5 ) ) % iRes, level );\n\n return mix( mix( rg1, rg2, f.x ), mix( rg3, rg4, f.x ), f.y );\n\n}\n")};typeof navigator<"u"&&/Windows/g.test(navigator.userAgent)&&(ol.pow_float=new qn("fn tsl_pow_float( a : f32, b : f32 ) -> f32 { return select( -pow( -a, b ), pow( a, b ), a > 0.0 ); }"),ol.pow_vec2=new qn("fn tsl_pow_vec2( a : vec2f, b : vec2f ) -> vec2f { return vec2f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ) ); }",[ol.pow_float]),ol.pow_vec3=new qn("fn tsl_pow_vec3( a : vec3f, b : vec3f ) -> vec3f { return vec3f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ) ); }",[ol.pow_float]),ol.pow_vec4=new qn("fn tsl_pow_vec4( a : vec4f, b : vec4f ) -> vec4f { return vec4f( tsl_pow_float( a.x, b.x ), tsl_pow_float( a.y, b.y ), tsl_pow_float( a.z, b.z ), tsl_pow_float( a.w, b.w ) ); }",[ol.pow_float]));/** * @license * Copyright 2010-2025 Three.js Authors * SPDX-License-Identifier: MIT */O.BRDF_GGX;O.BRDF_Lambert;O.BasicShadowFilter;O.Break;O.Continue;O.DFGApprox;O.D_GGX;O.Discard;O.EPSILON;O.F_Schlick;O.Fn;O.INFINITY;O.If;O.Loop;O.NodeShaderStage;O.NodeType;O.NodeUpdateType;O.NodeAccess;O.PCFShadowFilter;O.PCFSoftShadowFilter;O.PI;O.PI2;O.Return;O.Schlick_to_F0;O.ScriptableNodeResources;O.ShaderNode;O.TBNViewMatrix;O.VSMShadowFilter;O.V_GGX_SmithCorrelated;O.abs;O.acesFilmicToneMapping;O.acos;O.add;O.addNodeElement;O.agxToneMapping;O.all;O.alphaT;O.and;O.anisotropy;O.anisotropyB;O.anisotropyT;O.any;O.append;O.array;O.arrayBuffer;O.asin;O.assign;O.atan;O.atan2;O.atomicAdd;O.atomicAnd;O.atomicFunc;O.atomicMax;O.atomicMin;O.atomicOr;O.atomicStore;O.atomicSub;O.atomicXor;O.atomicLoad;O.attenuationColor;O.attenuationDistance;O.attribute;O.attributeArray;O.backgroundBlurriness;O.backgroundIntensity;O.backgroundRotation;O.batch;O.billboarding;O.bitAnd;O.bitNot;O.bitOr;O.bitXor;O.bitangentGeometry;O.bitangentLocal;O.bitangentView;O.bitangentWorld;O.bitcast;O.blendBurn;O.blendColor;O.blendDodge;O.blendOverlay;O.blendScreen;O.blur;O.bool;O.buffer;O.bufferAttribute;O.bumpMap;O.burn;O.bvec2;O.bvec3;O.bvec4;O.bypass;O.cache;O.call;O.cameraFar;O.cameraIndex;O.cameraNear;O.cameraNormalMatrix;O.cameraPosition;O.cameraProjectionMatrix;O.cameraProjectionMatrixInverse;O.cameraViewMatrix;O.cameraWorldMatrix;O.cbrt;O.cdl;O.ceil;O.checker;O.cineonToneMapping;O.clamp;O.clearcoat;O.clearcoatRoughness;O.code;O.color;O.colorSpaceToWorking;O.colorToDirection;O.compute;O.cond;O.Const;O.context;O.convert;O.convertColorSpace;O.convertToTexture;O.cos;O.cross;O.cubeTexture;O.dFdx;O.dFdy;O.dashSize;O.defaultBuildStages;O.defaultShaderStages;O.defined;O.degrees;O.deltaTime;O.densityFog;O.densityFogFactor;O.depth;O.depthPass;O.difference;O.diffuseColor;O.directPointLight;O.directionToColor;O.dispersion;O.distance;O.div;O.dodge;O.dot;O.drawIndex;O.dynamicBufferAttribute;O.element;O.emissive;O.equal;O.equals;O.equirectUV;O.exp;O.exp2;O.expression;O.faceDirection;O.faceForward;O.faceforward;O.float;O.floor;O.fog;O.fract;O.frameGroup;O.frameId;O.frontFacing;O.fwidth;O.gain;O.gapSize;O.getConstNodeType;O.getCurrentStack;O.getDirection;O.getDistanceAttenuation;O.getGeometryRoughness;O.getNormalFromDepth;O.getParallaxCorrectNormal;O.getRoughness;O.getScreenPosition;O.getShIrradianceAt;O.getTextureIndex;O.getViewPosition;O.glsl;O.glslFn;O.grayscale;O.greaterThan;O.greaterThanEqual;O.hash;O.highpModelNormalViewMatrix;O.highpModelViewMatrix;O.hue;O.instance;O.instanceIndex;O.instancedArray;O.instancedBufferAttribute;O.instancedDynamicBufferAttribute;O.instancedMesh;O.int;O.inverseSqrt;O.inversesqrt;O.invocationLocalIndex;O.invocationSubgroupIndex;O.ior;O.iridescence;O.iridescenceIOR;O.iridescenceThickness;O.ivec2;O.ivec3;O.ivec4;O.js;O.label;O.length;O.lengthSq;O.lessThan;O.lessThanEqual;O.lightPosition;O.lightTargetDirection;O.lightTargetPosition;O.lightViewPosition;O.lightingContext;O.lights;O.linearDepth;O.linearToneMapping;O.localId;O.globalId;O.log;O.log2;O.logarithmicDepthToViewZ;O.loop;O.luminance;O.mediumpModelViewMatrix;O.mat2;O.mat3;O.mat4;O.matcapUV;O.materialAO;O.materialAlphaTest;O.materialAnisotropy;O.materialAnisotropyVector;O.materialAttenuationColor;O.materialAttenuationDistance;O.materialClearcoat;O.materialClearcoatNormal;O.materialClearcoatRoughness;O.materialColor;O.materialDispersion;O.materialEmissive;O.materialIOR;O.materialIridescence;O.materialIridescenceIOR;O.materialIridescenceThickness;O.materialLightMap;O.materialLineDashOffset;O.materialLineDashSize;O.materialLineGapSize;O.materialLineScale;O.materialLineWidth;O.materialMetalness;O.materialNormal;O.materialOpacity;O.materialPointSize;O.materialReference;O.materialReflectivity;O.materialRefractionRatio;O.materialRotation;O.materialRoughness;O.materialSheen;O.materialSheenRoughness;O.materialShininess;O.materialSpecular;O.materialSpecularColor;O.materialSpecularIntensity;O.materialSpecularStrength;O.materialThickness;O.materialTransmission;O.max;O.maxMipLevel;O.metalness;O.min;O.mix;O.mixElement;O.mod;O.modInt;O.modelDirection;O.modelNormalMatrix;O.modelPosition;O.modelScale;O.modelViewMatrix;O.modelViewPosition;O.modelViewProjection;O.modelWorldMatrix;O.modelWorldMatrixInverse;O.morphReference;O.mrt;O.mul;O.mx_aastep;O.mx_cell_noise_float;O.mx_contrast;O.mx_fractal_noise_float;O.mx_fractal_noise_vec2;O.mx_fractal_noise_vec3;O.mx_fractal_noise_vec4;O.mx_hsvtorgb;O.mx_noise_float;O.mx_noise_vec3;O.mx_noise_vec4;O.mx_ramplr;O.mx_ramptb;O.mx_rgbtohsv;O.mx_safepower;O.mx_splitlr;O.mx_splittb;O.mx_srgb_texture_to_lin_rec709;O.mx_transform_uv;O.mx_worley_noise_float;O.mx_worley_noise_vec2;O.mx_worley_noise_vec3;O.negate;O.neutralToneMapping;O.nodeArray;O.nodeImmutable;O.nodeObject;O.nodeObjects;O.nodeProxy;O.normalFlat;O.normalGeometry;O.normalLocal;O.normalMap;O.normalView;O.normalWorld;O.normalize;O.not;O.notEqual;O.numWorkgroups;O.objectDirection;O.objectGroup;O.objectPosition;O.objectScale;O.objectViewPosition;O.objectWorldMatrix;O.oneMinus;O.or;O.orthographicDepthToViewZ;O.oscSawtooth;O.oscSine;O.oscSquare;O.oscTriangle;O.output;O.outputStruct;O.overlay;O.overloadingFn;O.parabola;O.parallaxDirection;O.parallaxUV;O.parameter;O.pass;O.passTexture;O.pcurve;O.perspectiveDepthToViewZ;O.pmremTexture;O.pointUV;O.pointWidth;O.positionGeometry;O.positionLocal;O.positionPrevious;O.positionView;O.positionViewDirection;O.positionWorld;O.positionWorldDirection;O.posterize;O.pow;O.pow2;O.pow3;O.pow4;O.property;O.radians;O.rand;O.range;O.rangeFog;O.rangeFogFactor;O.reciprocal;O.reference;O.referenceBuffer;O.reflect;O.reflectVector;O.reflectView;O.reflector;O.refract;O.refractVector;O.refractView;O.reinhardToneMapping;O.remainder;O.remap;O.remapClamp;O.renderGroup;O.renderOutput;O.rendererReference;O.rotate;O.rotateUV;O.roughness;O.round;O.rtt;O.sRGBTransferEOTF;O.sRGBTransferOETF;O.sampler;O.saturate;O.saturation;O.screen;O.screenCoordinate;O.screenSize;O.screenUV;O.scriptable;O.scriptableValue;O.select;O.setCurrentStack;O.shaderStages;O.shadow;O.shadowPositionWorld;O.sharedUniformGroup;O.shapeCircle;O.sheen;O.sheenRoughness;O.shiftLeft;O.shiftRight;O.shininess;O.sign;O.sin;O.sinc;O.skinning;O.skinningReference;O.smoothstep;O.smoothstepElement;O.specularColor;O.specularF90;O.spherizeUV;O.split;O.spritesheetUV;O.sqrt;O.stack;O.step;O.storage;O.storageBarrier;O.storageObject;O.storageTexture;O.string;O.struct;O.sub;O.subgroupIndex;O.subgroupSize;O.tan;O.tangentGeometry;O.tangentLocal;O.tangentView;O.tangentWorld;O.temp;O.texture;O.texture3D;O.textureBarrier;O.textureBicubic;O.textureCubeUV;O.textureLoad;O.textureSize;O.textureStore;O.thickness;O.threshold;O.time;O.timerDelta;O.timerGlobal;O.timerLocal;O.toOutputColorSpace;O.toWorkingColorSpace;O.toneMapping;O.toneMappingExposure;O.toonOutlinePass;O.transformDirection;O.transformNormal;O.transformNormalToView;O.transformedBentNormalView;O.transformedBitangentView;O.transformedBitangentWorld;O.transformedClearcoatNormalView;O.transformedNormalView;O.transformedNormalWorld;O.transformedTangentView;O.transformedTangentWorld;O.transmission;O.transpose;O.tri;O.tri3;O.triNoise3D;O.triplanarTexture;O.triplanarTextures;O.trunc;O.tslFn;O.uint;O.uniform;O.uniformArray;O.uniformGroup;O.uniforms;O.userData;O.uv;O.uvec2;O.uvec3;O.uvec4;O.Var;O.varying;O.varyingProperty;O.vec2;O.vec3;O.vec4;O.vectorComponents;O.velocity;O.vertexColor;O.vertexIndex;O.vibrance;O.viewZToLogarithmicDepth;O.viewZToOrthographicDepth;O.viewZToPerspectiveDepth;O.viewport;O.viewportBottomLeft;O.viewportCoordinate;O.viewportDepthTexture;O.viewportLinearDepth;O.viewportMipTexture;O.viewportResolution;O.viewportSafeUV;O.viewportSharedTexture;O.viewportSize;O.viewportTexture;O.viewportTopLeft;O.viewportUV;O.wgsl;O.wgslFn;O.workgroupArray;O.workgroupBarrier;O.workgroupId;O.workingToColorSpace;O.xor;const $Q=50,GQ=.75,WQ=15e5,QQ=10,jQ=2.5,qQ=60,va=class va{constructor(e={}){xe(this,"tempForward",new Y);xe(this,"tempMatrixLeft",new Xe);xe(this,"tempMatrixRight",new Xe);xe(this,"onKeyDown",e=>{switch(this.tempForward.set(0,0,-1),this.tempForward.transformDirection(this.camera.matrixWorld),this.tempMatrixLeft.makeRotationAxis(this.tempForward,Math.PI/128),this.tempMatrixRight.makeRotationAxis(this.tempForward,-Math.PI/128),e.code){case"KeyG":this.focalAdjustment+=.02,this.forceRenderNextFrame();break;case"KeyF":this.focalAdjustment-=.02,this.forceRenderNextFrame();break;case"ArrowLeft":this.camera.up.transformDirection(this.tempMatrixLeft);break;case"ArrowRight":this.camera.up.transformDirection(this.tempMatrixRight);break;case"KeyC":this.showMeshCursor=!this.showMeshCursor;break;case"KeyU":this.showControlPlane=!this.showControlPlane;break;case"KeyI":this.showInfo=!this.showInfo,this.showInfo;break;case"KeyO":this.usingExternalCamera||this.setOrthographicMode(!this.camera.isOrthographicCamera);break;case"KeyP":this.usingExternalCamera||this.splatMesh.setPointCloudModeEnabled(!this.splatMesh.getPointCloudModeEnabled());break;case"Equal":this.usingExternalCamera||this.splatMesh.setSplatScale(this.splatMesh.getSplatScale()+.05);break;case"Minus":this.usingExternalCamera||this.splatMesh.setSplatScale(Math.max(this.splatMesh.getSplatScale()-.05,0));break}});xe(this,"onMouseUp",function(){const e=new qe;return function(t){e.copy(this.mousePosition).sub(this.mouseDownPosition),ec()-this.mouseDownTime<.5&&e.length()<2&&this.onMouseClick(t)}}());xe(this,"checkPointRenderDimensions",new qe);xe(this,"checkPointToNewFocalPoint",new Y);xe(this,"checkPointOutHits",[]);xe(this,"checkForFocalPointChange",()=>{if(!this.transitioningCameraTarget&&(this.getRenderDimensions(this.checkPointRenderDimensions),this.checkPointOutHits.length=0,this.raycaster.setFromCameraAndScreenPosition(this.camera,this.mousePosition,this.checkPointRenderDimensions),this.raycaster.intersectSplatMesh(this.splatMesh,this.checkPointOutHits),this.checkPointOutHits.length>0)){const t=this.checkPointOutHits[0].origin;this.checkPointToNewFocalPoint.copy(t).sub(this.camera.position),this.checkPointToNewFocalPoint.length()>GQ&&(this.previousCameraTarget.copy(this.controls.target),this.nextCameraTarget.copy(t),this.transitioningCameraTarget=!0,this.transitioningCameraTargetStartTime=ec())}});xe(this,"updateSplatMesh",function(){const e=new qe;return function(){if(!this.splatMesh)return;if(this.splatMesh.getSplatCount()>0){this.splatMesh.updateVisibleRegionFadeDistance(this.sceneRevealMode),this.splatMesh.updateTransforms(),this.getRenderDimensions(e);const i=this.camera.projectionMatrix.elements[0]*.5*this.devicePixelRatio*e.x,r=this.camera.projectionMatrix.elements[5]*.5*this.devicePixelRatio*e.y,s=this.camera.isOrthographicCamera?1/this.devicePixelRatio:1,o=this.focalAdjustment*s,a=1/o;this.adjustForWebXRStereo(e),this.splatMesh.updateUniforms(e,i*o,r*o,this.camera.isOrthographicCamera,this.camera.zoom||1,a)}}}());xe(this,"addSplatBuffers",(e,t=[],i=!0,r=!0,s=!0,o=!1,a=!1,l=!0)=>{if(this.isDisposingOrDisposed())return Promise.resolve();let c=null;const u=()=>{c!==null&&(this.loadingSpinner.removeTask(c),c=null)};return this.splatRenderReady=!1,new Promise(d=>{r&&(c=this.loadingSpinner.addTask("Processing splats...")),ms(()=>{if(this.isDisposingOrDisposed())d();else{const h=this.addSplatBuffersToMesh(e,t,i,s,o,l),f=this.splatMesh.getMaxSplatCount();this.sortWorker&&this.sortWorker.maxSplatCount!==f&&this.disposeSortWorker(),this.gpuAcceleratedSort||this.preSortMessages.push({centers:h.centers.buffer,sceneIndexes:h.sceneIndexes.buffer,range:{from:h.from,to:h.to,count:h.count}}),(!this.sortWorker&&f>0?this.setupSortWorker(this.splatMesh):Promise.resolve()).then(()=>{this.isDisposingOrDisposed()||this.runSplatSort(!0,!0).then(g=>{!this.sortWorker||!g?(this.splatRenderReady=!0,u(),d()):(a?this.splatRenderReady=!0:this.runAfterNextSort.push(()=>{this.splatRenderReady=!0}),this.runAfterNextSort.push(()=>{u(),d()}))})})}},!0)})});xe(this,"addSplatBuffersToMesh",function(){let e;return function(t,i,r=!0,s=!1,o=!1,a=!0){if(this.isDisposingOrDisposed())return;let l=[],c=[];o||(l=this.splatMesh.scenes.map(f=>f.splatBuffer)||[],c=this.splatMesh.sceneOptions?this.splatMesh.sceneOptions.map(f=>f):[]),l.push(...t),c.push(...i),this.renderer&&this.splatMesh.setRenderer(this.renderer);const u=f=>{if(this.isDisposingOrDisposed())return;const p=this.splatMesh.getSplatCount();s&&p>=WQ&&!f&&!e&&(this.loadingSpinner.setMinimized(!0,!0),e=this.loadingSpinner.addTask("Optimizing data structures..."))},d=f=>{this.isDisposingOrDisposed()||f&&e&&(this.loadingSpinner.removeTask(e),e=null)},h=this.splatMesh.build(l,c,!0,r,u,d,a);return r&&this.freeIntermediateSplatData&&this.splatMesh.freeIntermediateSplatData(),h}}());xe(this,"vsyncNum",4);xe(this,"shouldRender",function(){let e=0;const t=new Y,i=new Qt,r=1e-4;return function(){if(!this.initialized||!this.splatRenderReady||this.isDisposingOrDisposed())return!1;let s=!1,o=!1;if(this.camera){const a=this.camera.position,l=this.camera.quaternion;o=Math.abs(a.x-t.x)>r||Math.abs(a.y-t.y)>r||Math.abs(a.z-t.z)>r||Math.abs(l.x-i.x)>r||Math.abs(l.y-i.y)>r||Math.abs(l.z-i.z)>r||Math.abs(l.w-i.w)>r}return s=this.renderMode!==Wg.Never&&(e===0||this.splatMesh.visibleRegionChanging||o||this.renderMode===Wg.Always||this.dynamicMode===!0||this.renderNextFrame),this.camera&&(t.copy(this.camera.position),i.copy(this.camera.quaternion)),e++,s}}());xe(this,"render",function(){return function(){if(!this.initialized||!this.splatRenderReady||this.isDisposingOrDisposed())return;const e=i=>{for(let r of i.children)if(r.visible)return!0;return!1},t=this.renderer.autoClear;e(this.threeScene)&&(this.renderer.render(this.threeScene,this.camera),this.renderer.autoClear=!1),this.renderer.render(this.splatMesh,this.camera),this.renderer.autoClear=!1,this.sceneHelper.getFocusMarkerOpacity()>0&&this.renderer.render(this.sceneHelper.focusMarker,this.camera),this.showControlPlane&&this.renderer.render(this.sceneHelper.controlPlane,this.camera),this.renderer.autoClear=t}}());xe(this,"sortedIndexes");xe(this,"lastCalcTime",ec());xe(this,"fpsFrameCount",0);xe(this,"updateFPS",()=>{if(this.consecutiveRenderFrames>qQ){const e=ec();e-this.lastCalcTime>=1?(this.currentFPS=this.fpsFrameCount,this.fpsFrameCount=0,this.lastCalcTime=e):this.fpsFrameCount++}else this.currentFPS=null});xe(this,"updateForRendererSizeChanges",function(){const e=new qe,t=new qe;let i;return function(){this.usingExternalCamera||(this.renderer.getSize(t),(i===void 0||i!==this.camera.isOrthographicCamera||t.x!==e.x||t.y!==e.y)&&(this.camera.isOrthographicCamera?(this.camera.left=-t.x/2,this.camera.right=t.x/2,this.camera.top=t.y/2,this.camera.bottom=-t.y/2):this.camera.aspect=t.x/t.y,this.camera.updateProjectionMatrix(),e.copy(t),i=this.camera.isOrthographicCamera))}}());xe(this,"timingSensitiveUpdates",function(){let e;return function(){const t=ec();e||(e=t);const i=t-e;this.updateCameraTransition(t),this.updateFocusMarker(i),e=t}}());xe(this,"tempCameraTarget",new Y);xe(this,"toPreviousTarget",new Y);xe(this,"toNextTarget",new Y);xe(this,"updateCameraTransition",e=>{if(this.transitioningCameraTarget){this.toPreviousTarget.copy(this.previousCameraTarget).sub(this.camera.position).normalize(),this.toNextTarget.copy(this.nextCameraTarget).sub(this.camera.position).normalize();const t=Math.acos(this.toPreviousTarget.dot(this.toNextTarget)),r=(t/(Math.PI/3)*.65+.3)/t*(e-this.transitioningCameraTargetStartTime);this.tempCameraTarget.copy(this.previousCameraTarget).lerp(this.nextCameraTarget,r),this.camera.lookAt(this.tempCameraTarget),this.controls.target.copy(this.tempCameraTarget),r>=1&&(this.transitioningCameraTarget=!1)}});xe(this,"updateFocusMarker",function(){const e=new qe;let t=!1;return function(i){if(this.getRenderDimensions(e),this.transitioningCameraTarget){this.sceneHelper.setFocusMarkerVisibility(!0);const r=Math.max(this.sceneHelper.getFocusMarkerOpacity(),0);let s=Math.min(r+QQ*i,1);this.sceneHelper.setFocusMarkerOpacity(s),this.sceneHelper.updateFocusMarker(this.nextCameraTarget,this.camera,e),t=!0,this.forceRenderNextFrame()}else{let r;if(t?r=1:r=Math.min(this.sceneHelper.getFocusMarkerOpacity(),1),r>0){this.sceneHelper.updateFocusMarker(this.nextCameraTarget,this.camera,e);let s=Math.max(r-jQ*i,0);this.sceneHelper.setFocusMarkerOpacity(s),s===0&&this.sceneHelper.setFocusMarkerVisibility(!1)}r>0&&this.forceRenderNextFrame(),t=!1}}}());xe(this,"updateMeshCursor",function(){const e=[],t=new qe;return function(){this.showMeshCursor?(this.forceRenderNextFrame(),this.getRenderDimensions(t),e.length=0,this.raycaster.setFromCameraAndScreenPosition(this.camera,this.mousePosition,t),this.raycaster.intersectSplatMesh(this.splatMesh,e),e.length>0?(this.sceneHelper.setMeshCursorVisibility(!0),this.sceneHelper.positionAndOrientMeshCursor(e[0].origin,this.camera)):this.sceneHelper.setMeshCursorVisibility(!1)):(this.sceneHelper.getMeschCursorVisibility()&&this.forceRenderNextFrame(),this.sceneHelper.setMeshCursorVisibility(!1))}}());xe(this,"updateInfoPanel",function(){const e=new qe;return function(){if(!this.showInfo)return;const t=this.splatMesh.getSplatCount();this.getRenderDimensions(e),this.controls&&this.controls.target,this.showMeshCursor&&this.sceneHelper.meshCursor.position,t>0&&this.splatRenderCount/t*100}}());xe(this,"mvpMatrix",new Xe);xe(this,"cameraPositionArray",[]);xe(this,"lastSortViewDir",new Y(0,0,-1));xe(this,"sortViewDir",new Y(0,0,-1));xe(this,"lastSortViewPos",new Y);xe(this,"sortViewOffset",new Y);xe(this,"queuedSorts",[]);xe(this,"partialSorts",[{angleThreshold:.55,sortFractions:[.125,.33333,.75]},{angleThreshold:.65,sortFractions:[.33333,.66667]},{angleThreshold:.8,sortFractions:[.5]}]);xe(this,"runSplatSort",(e=!1,t=!1)=>{if(!this.initialized)return Promise.resolve(!1);if(this.sortRunning)return Promise.resolve(!0);if(this.splatMesh.getSplatCount()<=0)return this.splatRenderCount=0,Promise.resolve(!1);let i=0,r=0,s=!1,o=!1;if(this.sortViewDir.set(0,0,-1).applyQuaternion(this.camera.quaternion),i=this.sortViewDir.dot(this.lastSortViewDir),r=this.sortViewOffset.copy(this.camera.position).sub(this.lastSortViewPos).length(),!e&&!this.splatMesh.dynamicMode&&this.queuedSorts.length===0&&(i<=.99&&(s=!0),r>=1&&(o=!0),!s&&!o))return Promise.resolve(!1);this.sortRunning=!0;let{splatRenderCount:a,shouldSortAll:l}=this.gatherSceneNodesForSort();l=l||t,this.splatRenderCount=a,this.mvpMatrix.copy(this.camera.matrixWorld).invert();const c=this.perspectiveCamera||this.camera;this.mvpMatrix.premultiply(c.projectionMatrix),this.splatMesh.dynamicMode||this.mvpMatrix.multiply(this.splatMesh.matrixWorld);let u=Promise.resolve(!0);return this.gpuAcceleratedSort&&(this.queuedSorts.length<=1||this.queuedSorts.length%2===0)&&(u=this.splatMesh.computeDistancesOnGPU(this.mvpMatrix,this.sortWorkerPrecomputedDistances)),u.then(()=>{if(this.queuedSorts.length===0)if(this.splatMesh.dynamicMode||l)this.queuedSorts.push(this.splatRenderCount);else{for(let f of partialSorts)if(i{this.sortPromiseResolver=f}),this.preSortMessages.length>0&&(this.preSortMessages.forEach(f=>{this.sortWorker.postMessage(f)}),this.preSortMessages=[]),this.sortWorker.postMessage({sort:h}),this.queuedSorts.length===0&&(this.lastSortViewPos.copy(this.camera.position),this.lastSortViewDir.copy(this.sortViewDir)),!0}),u});xe(this,"gatherSceneNodesForSort",function(){const e=[];let t=null;const i=new Y,r=new Y,s=new Y,o=new Xe,a=new Xe,l=new Xe,c=new Y,u=new Y(0,0,-1),d=new Y,h=f=>d.copy(f.max).sub(f.min).length();return function(f=!1){this.getRenderDimensions(c);const p=c.y/2/Math.tan(this.camera.fov/2*Ta.DEG2RAD),g=Math.atan(c.x/2/p),y=Math.atan(c.y/2/p),m=Math.cos(g),v=Math.cos(y),x=this.splatMesh.getSplatTree();if(x){a.copy(this.camera.matrixWorld).invert(),this.splatMesh.dynamicMode||a.multiply(this.splatMesh.matrixWorld);let _=0,S=0;for(let A=0;AF||(S+=I.data.indexes.length,e[_]=I,I.data.distanceToNode=L,_++)}}e.length=_,e.sort((A,R)=>A.data.distanceToNode{this.getRenderDimensions(e),this.renderer.setSize(e.x,e.y),this.forceRenderNextFrame()}),this.resizeObserver.observe(this.rootElement),this.rootElement.appendChild(this.renderer.domElement)}}setupWebXR(e){this.webXRMode&&(this.webXRMode===xc.VR?this.rootElement.appendChild(vu.createButton(this.renderer,e)):this.webXRMode===xc.AR&&this.rootElement.appendChild(Wk.createButton(this.renderer,e)),this.renderer.xr.addEventListener("sessionstart",t=>{this.webXRActive=!0}),this.renderer.xr.addEventListener("sessionend",t=>{this.webXRActive=!1}),this.renderer.xr.enabled=!0,this.camera.position.copy(this.initialCameraPosition),this.camera.up.copy(this.cameraUp).normalize(),this.camera.lookAt(this.initialCameraLookAt))}setupControls(){if(this.useBuiltInControls&&this.webXRMode===xc.None){this.usingExternalCamera?this.camera.isOrthographicCamera?this.orthographicControls=new qf(this.camera,this.renderer.domElement):this.perspectiveControls=new qf(this.camera,this.renderer.domElement):(this.perspectiveControls=new qf(this.perspectiveCamera,this.renderer.domElement),this.orthographicControls=new qf(this.orthographicCamera,this.renderer.domElement));for(let e of[this.orthographicControls,this.perspectiveControls])e&&(e.listenToKeyEvents(window),e.rotateSpeed=.5,e.maxPolarAngle=Math.PI*.5,e.minPolarAngle=Math.PI*.5,e.enableDamping=!0,e.dampingFactor=.05,e.target.copy(this.initialCameraLookAt),e.update());this.controls=this.camera.isOrthographicCamera?this.orthographicControls:this.perspectiveControls,this.controls.update()}}setupEventHandlers(){this.useBuiltInControls&&this.webXRMode===xc.None&&(this.mouseMoveListener=this.onMouseMove.bind(this),this.renderer.domElement.addEventListener("pointermove",this.mouseMoveListener,!1),this.mouseDownListener=this.onMouseDown.bind(this),this.renderer.domElement.addEventListener("pointerdown",this.mouseDownListener,!1),this.mouseUpListener=this.onMouseUp.bind(this),this.renderer.domElement.addEventListener("pointerup",this.mouseUpListener,!1),this.keyDownListener=this.onKeyDown.bind(this))}removeEventHandlers(){this.useBuiltInControls&&(this.renderer.domElement.removeEventListener("pointermove",this.mouseMoveListener),this.mouseMoveListener=null,this.renderer.domElement.removeEventListener("pointerdown",this.mouseDownListener),this.mouseDownListener=null,this.renderer.domElement.removeEventListener("pointerup",this.mouseUpListener),this.mouseUpListener=null,window.removeEventListener("keydown",this.keyDownListener),this.keyDownListener=null)}setRenderMode(e){this.renderMode=e}setActiveSphericalHarmonicsDegrees(e){this.splatMesh.material.uniforms.sphericalHarmonicsDegree.value=e,this.splatMesh.material.uniformsNeedUpdate=!0}onSplatMeshChanged(e){this.onSplatMeshChangedCallback=e}onMouseMove(e){this.mousePosition.set(e.offsetX,e.offsetY)}onMouseDown(){this.mouseDownPosition.copy(this.mousePosition),this.mouseDownTime=ec()}onMouseClick(e){this.mousePosition.set(e.offsetX,e.offsetY),this.checkForFocalPointChange()}getRenderDimensions(e){this.rootElement?(e.x=this.rootElement.offsetWidth,e.y=this.rootElement.offsetHeight):this.renderer.getSize(e)}setOrthographicMode(e){if(e===this.camera.isOrthographicCamera)return;const t=this.camera,i=e?this.orthographicCamera:this.perspectiveCamera;if(i.position.copy(t.position),i.up.copy(t.up),i.rotation.copy(t.rotation),i.quaternion.copy(t.quaternion),i.matrix.copy(t.matrix),this.camera=i,this.controls){const r=a=>{a.saveState(),a.reset()},s=this.controls,o=e?this.orthographicControls:this.perspectiveControls;r(o),r(s),o.target.copy(s.target),e?va.setCameraZoomFromPosition(i,t,s):va.setCameraPositionFromZoom(i,t,o),this.controls=o,this.camera.lookAt(this.controls.target)}}adjustForWebXRStereo(e){if(this.camera&&this.webXRActive){const i=this.renderer.xr.getCamera().projectionMatrix.elements[0],r=this.camera.projectionMatrix.elements[0];e.x*=r/i}}isLoadingOrUnloading(){return Object.keys(this.splatSceneDownloadPromises).length>0||this.splatSceneDownloadAndBuildPromise!==null||this.splatSceneRemovalPromise!==null}isDisposingOrDisposed(){return this.disposing||this.disposed}addSplatSceneDownloadPromise(e){this.splatSceneDownloadPromises[e.id]=e}removeSplatSceneDownloadPromise(e){delete this.splatSceneDownloadPromises[e.id]}setSplatSceneDownloadAndBuildPromise(e){this.splatSceneDownloadAndBuildPromise=e}clearSplatSceneDownloadAndBuildPromise(){this.splatSceneDownloadAndBuildPromise=null}addSplatScene(e,t={}){if(this.isLoadingOrUnloading())throw new Error("Cannot add splat scene while another load or unload is already in progress.");if(this.isDisposingOrDisposed())throw new Error("Cannot add splat scene after dispose() is called.");t.progressiveLoad&&this.splatMesh.scenes&&this.splatMesh.scenes.length>0&&(console.log('addSplatScene(): "progressiveLoad" option ignore because there are multiple splat scenes'),t.progressiveLoad=!1);const i=t.format!==void 0&&t.format!==null?t.format:GA(e),r=va.isProgressivelyLoadable(i)&&t.progressiveLoad,s=t.showLoadingUI!==void 0&&t.showLoadingUI!==null?t.showLoadingUI:!0;let o=null;s&&(this.loadingSpinner.removeAllTasks(),o=this.loadingSpinner.addTask("Downloading..."));const a=()=>{this.loadingProgressBar.hide(),this.loadingSpinner.removeAllTasks()},l=(g,y,m)=>{if(s)if(m===Kn.Downloading)if(g==100)this.loadingSpinner.setMessageForTask(o,"Download complete!");else if(r)this.loadingSpinner.setMessageForTask(o,"Downloading splats...");else{const v=y?": ".concat(y):"...";this.loadingSpinner.setMessageForTask(o,"Downloading".concat(v))}else m===Kn.Processing&&(console.log("loaderStatus === LoaderStatus.Processing"),this.loadingSpinner.setMessageForTask(o,"Processing splats..."))};let c=!1,u=0;const d=(g,y)=>{s&&((g&&r||y&&!r)&&(this.loadingSpinner.removeTask(o),!y&&!c&&this.loadingProgressBar.show()),r&&(y?(c=!0,this.loadingProgressBar.hide()):this.loadingProgressBar.setProgress(u)))},h=(g,y,m)=>{u=g,l(g,y,m),t.onProgress&&t.onProgress(g,y,m)},f=(g,y,m)=>{!r&&t.onProgress&&t.onProgress(0,"0%",Kn.Processing);const v={rotation:t.rotation||t.orientation,position:t.position,scale:t.scale,splatAlphaRemovalThreshold:t.splatAlphaRemovalThreshold};return this.addSplatBuffers([g],[v],m,y&&s,s,r,r).then(()=>{!r&&t.onProgress&&t.onProgress(100,"100%",Kn.Processing),d(y,m)})};return(r?this.downloadAndBuildSingleSplatSceneProgressiveLoad.bind(this):this.downloadAndBuildSingleSplatSceneStandardLoad.bind(this))(e,i,t.splatAlphaRemovalThreshold,f.bind(this),h,a.bind(this),t.headers)}downloadAndBuildSingleSplatSceneStandardLoad(e,t,i,r,s,o,a){const l=this.downloadSplatSceneToSplatBuffer(e,i,s,!1,void 0,t,a),c=rg(l.abortHandler);return l.then(u=>(this.removeSplatSceneDownloadPromise(l),r(u,!0,!0).then(()=>{c.resolve(),this.clearSplatSceneDownloadAndBuildPromise()}))).catch(u=>{o&&o(),this.clearSplatSceneDownloadAndBuildPromise(),this.removeSplatSceneDownloadPromise(l);const d=u instanceof Ap?u:new Error("Viewer::addSplatScene -> Could not load file ".concat(e));c.reject(d)}),this.addSplatSceneDownloadPromise(l),this.setSplatSceneDownloadAndBuildPromise(c.promise),c.promise}downloadAndBuildSingleSplatSceneProgressiveLoad(e,t,i,r,s,o,a){let l=0,c=!1;const u=[],d=()=>{if(u.length>0&&!c&&!this.isDisposingOrDisposed()){c=!0;const y=u.shift();r(y.splatBuffer,y.firstBuild,y.finalBuild).then(()=>{c=!1,y.firstBuild?p.resolve():y.finalBuild&&(g.resolve(),this.clearSplatSceneDownloadAndBuildPromise()),u.length>0&&ms(()=>d())})}},h=(y,m)=>{this.isDisposingOrDisposed()||(m||u.length===0||y.getSplatCount()>u[0].splatBuffer.getSplatCount())&&(u.push({splatBuffer:y,firstBuild:l===0,finalBuild:m}),l++,d())},f=this.downloadSplatSceneToSplatBuffer(e,i,s,!0,h,t,a),p=rg(f.abortHandler),g=rg();return this.addSplatSceneDownloadPromise(f),this.setSplatSceneDownloadAndBuildPromise(g.promise),f.then(()=>{this.removeSplatSceneDownloadPromise(f)}).catch(y=>{this.clearSplatSceneDownloadAndBuildPromise(),this.removeSplatSceneDownloadPromise(f);const m=y instanceof Ap?y:new Error("Viewer::addSplatScene -> Could not load one or more scenes");p.reject(m),o&&o(m)}),p.promise}addSplatScenes(e,t=!0,i=void 0){if(this.isLoadingOrUnloading())throw new Error("Cannot add splat scene while another load or unload is already in progress.");if(this.isDisposingOrDisposed())throw new Error("Cannot add splat scene after dispose() is called.");const r=e.length,s=[];let o;t&&(this.loadingSpinner.removeAllTasks(),o=this.loadingSpinner.addTask("Downloading..."));const a=(d,h,f,p)=>{s[d]=h;let g=0;for(let y=0;y{Promise.all(c).then(f=>{t&&this.loadingSpinner.removeTask(o),i&&i(0,"0%",Kn.Processing),this.addSplatBuffers(f,e,!0,t,t,!1,!1).then(()=>{i&&i(100,"100%",Kn.Processing),this.clearSplatSceneDownloadAndBuildPromise(),d()})}).catch(f=>{t&&this.loadingSpinner.removeTask(o),this.clearSplatSceneDownloadAndBuildPromise();const p=f instanceof Ap?f:new Error("Viewer::addSplatScenes -> Could not load one or more splat scenes.");h(p)}).finally(()=>{this.removeSplatSceneDownloadPromise(u)})},d=>{for(let h of l)h.abort(d)});return this.addSplatSceneDownloadPromise(u),this.setSplatSceneDownloadAndBuildPromise(u),u}downloadSplatSceneToSplatBuffer(e,t=1,i=void 0,r=!1,s=void 0,o,a){const l=r?!1:this.optimizeSplatData;try{if(o===zs.Splat)return H_.loadFromURL(e,i,r,s,t,this.inMemoryCompressionLevel,l,a);if(o===zs.KSplat)return Uy.loadFromURL(e,i,r,s,a);if(o===zs.Ply)return V_.loadFromURL(e,i,r,s,t,this.inMemoryCompressionLevel,l,this.sphericalHarmonicsDegree,a)}catch(c){throw c instanceof z_?new Error("File type or server does not support progressive loading."):c}throw new Error("Viewer::downloadSplatSceneToSplatBuffer -> File format not supported: ".concat(e))}static isProgressivelyLoadable(e){return e===zs.Splat||e===zs.KSplat||e===zs.Ply}async setupSortWorker(e){if(!this.isDisposingOrDisposed())return new Promise(async t=>{const i=this.integerBasedSort?Int32Array:Float32Array,r=e.getSplatCount(),s=e.getMaxSplatCount();this.sortWorker=await Gk(s,this.sharedMemoryForWorkers,this.enableSIMDInSort,this.integerBasedSort,this.splatMesh.dynamicMode,this.splatSortDistanceMapPrecision),this.sortWorker.onmessage=o=>{if(o.data.sortDone){if(this.sortRunning=!1,Array.from({length:this.gaussianSplatCount},(a,l)=>l),this.sharedMemoryForWorkers)this.splatMesh.updateRenderIndexes(this.sortWorkerSortedIndexes,o.data.splatRenderCount);else{const a=new Uint32Array(o.data.sortedIndexes.buffer,0,o.data.splatRenderCount);this.splatMesh.updateRenderIndexes(a,o.data.splatRenderCount)}this.lastSplatSortCount=this.splatSortCount,this.lastSortTime=o.data.sortTime,this.sortPromiseResolver(),this.sortPromiseResolver=null,this.forceRenderNextFrame(),this.runAfterNextSort.length>0&&(this.runAfterNextSort.forEach(a=>{a()}),this.runAfterNextSort.length=0)}else if(o.data.sortCanceled)this.sortRunning=!1;else if(o.data.sortSetupPhase1Complete){this.logLevel>=jc.Info&&console.log("Sorting web worker WASM setup complete."),this.sharedMemoryForWorkers?(this.sortWorkerSortedIndexes=new Uint32Array(o.data.sortedIndexesBuffer,o.data.sortedIndexesOffset,s),this.sortWorkerIndexesToSort=new Uint32Array(o.data.indexesToSortBuffer,o.data.indexesToSortOffset,s),this.sortWorkerPrecomputedDistances=new i(o.data.precomputedDistancesBuffer,o.data.precomputedDistancesOffset,s),this.sortWorkerTransforms=new Float32Array(o.data.transformsBuffer,o.data.transformsOffset,Ft.MaxScenes*16)):(this.sortWorkerIndexesToSort=new Uint32Array(s),this.sortWorkerPrecomputedDistances=new i(s),this.sortWorkerTransforms=new Float32Array(Ft.MaxScenes*16));for(let a=0;a=jc.Info){console.log("Sorting web worker ready.");const a=this.splatMesh.getSplatDataTextures(),l=a.covariances.size,c=a.centerColors.size;console.log("Covariances texture size: "+l.x+" x "+l.y),console.log("Centers/colors texture size: "+c.x+" x "+c.y)}t()}}})}disposeSortWorker(){this.sortWorker&&this.sortWorker.terminate(),this.sortWorker=null,this.sortPromise=null,this.sortPromiseResolver&&(this.sortPromiseResolver(),this.sortPromiseResolver=null),this.preSortMessages=[],this.sortRunning=!1}removeSplatScene(e,t=!0){return this.removeSplatScenes([e],t)}removeSplatScenes(e,t=!0){if(this.isLoadingOrUnloading())throw new Error("Cannot remove splat scene while another load or unload is already in progress.");if(this.isDisposingOrDisposed())throw new Error("Cannot remove splat scene after dispose() is called.");let i;return this.splatSceneRemovalPromise=new Promise((r,s)=>{let o;t&&(this.loadingSpinner.removeAllTasks(),this.loadingSpinner.show(),o=this.loadingSpinner.addTask("Removing splat scene..."));const a=()=>{t&&(this.loadingSpinner.hide(),this.loadingSpinner.removeTask(o))},l=u=>{a(),this.splatSceneRemovalPromise=null,u?s(u):r()},c=()=>this.isDisposingOrDisposed()?(l(),!0):!1;i=this.sortPromise||Promise.resolve(),i.then(()=>{if(c())return;const u=[],d=[],h=[];for(let f=0;f{c()||(a(),this.splatMesh.scenes.forEach((f,p)=>{f.position.copy(h[p].position),f.quaternion.copy(h[p].quaternion),f.scale.copy(h[p].scale)}),this.splatMesh.updateTransforms(),this.splatRenderReady=!1,this.runSplatSort(!0).then(()=>{if(c()){this.splatRenderReady=!0;return}i=this.sortPromise||Promise.resolve(),i.then(()=>{this.splatRenderReady=!0,l()})}))}).catch(f=>{l(f)})})}),this.splatSceneRemovalPromise}start(){if(this.selfDrivenMode)this.webXRMode?this.renderer.setAnimationLoop(this.selfDrivenUpdateFunc):this.requestFrameId=requestAnimationFrame(this.selfDrivenUpdateFunc),this.selfDrivenModeRunning=!0;else throw new Error("Cannot start viewer unless it is in self driven mode.")}stop(){this.selfDrivenMode&&this.selfDrivenModeRunning&&(this.webXRMode?this.renderer.setAnimationLoop(null):cancelAnimationFrame(this.requestFrameId),this.selfDrivenModeRunning=!1)}async dispose(){if(this.isDisposingOrDisposed())return this.disposePromise;let e=[],t=[];for(let i in this.splatSceneDownloadPromises)if(this.splatSceneDownloadPromises.hasOwnProperty(i)){const r=this.splatSceneDownloadPromises[i];t.push(r),e.push(r.promise)}return this.sortPromise&&e.push(this.sortPromise),this.disposing=!0,this.disposePromise=Promise.all(e).finally(()=>{this.stop(),this.orthographicControls&&(this.orthographicControls.dispose(),this.orthographicControls=null),this.perspectiveControls&&(this.perspectiveControls.dispose(),this.perspectiveControls=null),this.controls=null,this.splatMesh&&(this.splatMesh.dispose(),this.splatMesh=null),this.sceneHelper&&(this.sceneHelper.dispose(),this.sceneHelper=null),this.resizeObserver&&(this.resizeObserver.unobserve(this.rootElement),this.resizeObserver=null),this.disposeSortWorker(),this.removeEventHandlers(),this.loadingSpinner.removeAllTasks(),this.loadingSpinner.setContainer(null),this.loadingProgressBar.hide(),this.loadingProgressBar.setContainer(null),this.camera=null,this.threeScene=null,this.splatRenderReady=!1,this.initialized=!1,this.renderer&&(this.usingExternalRenderer||(this.rootElement.removeChild(this.renderer.domElement),this.renderer.dispose()),this.renderer=null),this.usingExternalRenderer,this.sortWorkerSortedIndexes=null,this.sortWorkerIndexesToSort=null,this.sortWorkerPrecomputedDistances=null,this.sortWorkerTransforms=null,this.disposed=!0,this.disposing=!1,this.disposePromise=null}),t.forEach(i=>{i.abort("Scene disposed")}),this.disposePromise}selfDrivenUpdate(){this.selfDrivenMode&&!this.webXRMode&&(this.requestFrameId=requestAnimationFrame(this.selfDrivenUpdateFunc)),this.vsyncCount++,!(this.vsyncCount=this.totalFrames&&(this.frame=0),this.dropInMode&&this.updateForDropInMode(e,t),!(!this.initialized||!this.splatRenderReady||this.isDisposingOrDisposed())&&(this.controls&&(this.controls.update(),this.camera.isOrthographicCamera&&!this.usingExternalCamera&&va.setCameraPositionFromZoom(this.camera,this.camera,this.controls)),this.runMorphUpdate(),this.runSplatSort(!0,!0),this.updateForRendererSizeChanges(),this.updateSplatMesh(),this.updateMeshCursor(),this.updateFPS(),this.timingSensitiveUpdates(),this.updateControlPlane())}updateForDropInMode(e,t){this.renderer=e,this.splatMesh&&this.splatMesh.setRenderer(this.renderer),this.camera=t,this.controls&&(this.controls.object=t),this.init()}updateControlPlane(){this.showControlPlane?(this.sceneHelper.setControlPlaneVisibility(!0),this.sceneHelper.positionAndOrientControlPlane(this.controls.target,this.camera.up)):this.sceneHelper.setControlPlaneVisibility(!1)}getSplatMesh(){return this.splatMesh}getSplatScene(e){return this.splatMesh.getScene(e)}getSceneCount(){return this.splatMesh.getSceneCount()}isMobile(){return navigator.userAgent.includes("Mobi")}createBonesFromJson(e){const t=[];function i(r,s=null){const o=new dh;return o.name=r.name,s&&s.add(o),o.position.set(...r.position),t.push(o),r.children&&r.children.forEach(a=>i(a,o)),o}return e.forEach(r=>i(r)),t}updateMorphTarget(e){if(this.avatarMesh=e,this.splatMesh.flameModel=e,this.splatMesh.useFlameModel=this.useFlame,this.useFlame==!0){this.bones=this.createBonesFromJson(this.bone_tree.bones);const t=[new Y(this.bones[0].position.x,this.bones[0].position.y,this.bones[0].position.z),new Y(this.bones[1].position.x,this.bones[1].position.y,this.bones[1].position.z),new Y(this.bones[2].position.x,this.bones[2].position.y,this.bones[2].position.z),new Y(this.bones[3].position.x,this.bones[3].position.y,this.bones[3].position.z),new Y(this.bones[4].position.x,this.bones[4].position.y,this.bones[4].position.z)];this.bones[1].position.copy(new Y(t[1].x-t[0].x,t[1].y-t[0].y,t[1].z-t[0].z)),this.bones[2].position.copy(new Y(t[2].x-t[1].x,t[2].y-t[1].y,t[2].z-t[1].z)),this.bones[3].position.copy(new Y(t[3].x-t[1].x,t[3].y-t[1].y,t[3].z-t[1].z)),this.bones[4].position.copy(new Y(t[4].x-t[1].x,t[4].y-t[1].y,t[4].z-t[1].z)),this.bones[0].updateMatrixWorld(!0);const i=[this.bones[0].matrixWorld.clone().invert(),this.bones[1].matrixWorld.clone().invert(),this.bones[2].matrixWorld.clone().invert(),this.bones[3].matrixWorld.clone().invert(),this.bones[4].matrixWorld.clone().invert()];this.skeleton=new t0(this.bones,i)}this.runMorphUpdate(),this.splatMesh.gaussianSplatCount=this.gaussianSplatCount}updatedBoneMatrices(e){let t=[];for(let r=0;re=>{const t=XQ.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Es=n=>(n=n.toLowerCase(),e=>y0(e)===n),v0=n=>e=>typeof e===n,{isArray:Vu}=Array,vh=v0("undefined");function KQ(n){return n!==null&&!vh(n)&&n.constructor!==null&&!vh(n.constructor)&&Lr(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const L4=Es("ArrayBuffer");function YQ(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&L4(n.buffer),e}const ZQ=v0("string"),Lr=v0("function"),D4=v0("number"),_0=n=>n!==null&&typeof n=="object",JQ=n=>n===!0||n===!1,Lp=n=>{if(y0(n)!=="object")return!1;const e=Lx(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},ej=Es("Date"),tj=Es("File"),nj=Es("Blob"),ij=Es("FileList"),rj=n=>_0(n)&&Lr(n.pipe),sj=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Lr(n.append)&&((e=y0(n))==="formdata"||e==="object"&&Lr(n.toString)&&n.toString()==="[object FormData]"))},oj=Es("URLSearchParams"),[aj,lj,cj,uj]=["ReadableStream","Request","Response","Headers"].map(Es),dj=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function tf(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let i,r;if(typeof n!="object"&&(n=[n]),Vu(n))for(i=0,r=n.length;i0;)if(r=t[i],e===r.toLowerCase())return r;return null}const Al=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,O4=n=>!vh(n)&&n!==Al;function iv(){const{caseless:n}=O4(this)&&this||{},e={},t=(i,r)=>{const s=n&&F4(e,r)||r;Lp(e[s])&&Lp(i)?e[s]=iv(e[s],i):Lp(i)?e[s]=iv({},i):Vu(i)?e[s]=i.slice():e[s]=i};for(let i=0,r=arguments.length;i(tf(e,(r,s)=>{t&&Lr(r)?n[s]=P4(r,t):n[s]=r},{allOwnKeys:i}),n),fj=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),pj=(n,e,t,i)=>{n.prototype=Object.create(e.prototype,i),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},mj=(n,e,t,i)=>{let r,s,o;const a={};if(e=e||{},n==null)return e;do{for(r=Object.getOwnPropertyNames(n),s=r.length;s-- >0;)o=r[s],(!i||i(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&Lx(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},gj=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const i=n.indexOf(e,t);return i!==-1&&i===t},yj=n=>{if(!n)return null;if(Vu(n))return n;let e=n.length;if(!D4(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},vj=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&Lx(Uint8Array)),_j=(n,e)=>{const i=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=i.next())&&!r.done;){const s=r.value;e.call(n,s[0],s[1])}},xj=(n,e)=>{let t;const i=[];for(;(t=n.exec(e))!==null;)i.push(t);return i},Sj=Es("HTMLFormElement"),Aj=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,i,r){return i.toUpperCase()+r}),Tb=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),bj=Es("RegExp"),B4=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),i={};tf(t,(r,s)=>{let o;(o=e(r,s,n))!==!1&&(i[s]=o||r)}),Object.defineProperties(n,i)},Tj=n=>{B4(n,(e,t)=>{if(Lr(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const i=n[t];if(Lr(i)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},wj=(n,e)=>{const t={},i=r=>{r.forEach(s=>{t[s]=!0})};return Vu(n)?i(n):i(String(n).split(e)),t},Cj=()=>{},Ej=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e;function Mj(n){return!!(n&&Lr(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const Rj=n=>{const e=new Array(10),t=(i,r)=>{if(_0(i)){if(e.indexOf(i)>=0)return;if(!("toJSON"in i)){e[r]=i;const s=Vu(i)?[]:{};return tf(i,(o,a)=>{const l=t(o,r+1);!vh(l)&&(s[a]=l)}),e[r]=void 0,s}}return i};return t(n,0)},Ij=Es("AsyncFunction"),Nj=n=>n&&(_0(n)||Lr(n))&&Lr(n.then)&&Lr(n.catch),k4=((n,e)=>n?setImmediate:e?((t,i)=>(Al.addEventListener("message",({source:r,data:s})=>{r===Al&&s===t&&i.length&&i.shift()()},!1),r=>{i.push(r),Al.postMessage(t,"*")}))("axios@".concat(Math.random()),[]):t=>setTimeout(t))(typeof setImmediate=="function",Lr(Al.postMessage)),Pj=typeof queueMicrotask<"u"?queueMicrotask.bind(Al):typeof process<"u"&&process.nextTick||k4;var Me={isArray:Vu,isArrayBuffer:L4,isBuffer:KQ,isFormData:sj,isArrayBufferView:YQ,isString:ZQ,isNumber:D4,isBoolean:JQ,isObject:_0,isPlainObject:Lp,isReadableStream:aj,isRequest:lj,isResponse:cj,isHeaders:uj,isUndefined:vh,isDate:ej,isFile:tj,isBlob:nj,isRegExp:bj,isFunction:Lr,isStream:rj,isURLSearchParams:oj,isTypedArray:vj,isFileList:ij,forEach:tf,merge:iv,extend:hj,trim:dj,stripBOM:fj,inherits:pj,toFlatObject:mj,kindOf:y0,kindOfTest:Es,endsWith:gj,toArray:yj,forEachEntry:_j,matchAll:xj,isHTMLForm:Sj,hasOwnProperty:Tb,hasOwnProp:Tb,reduceDescriptors:B4,freezeMethods:Tj,toObjectSet:wj,toCamelCase:Aj,noop:Cj,toFiniteNumber:Ej,findKey:F4,global:Al,isContextDefined:O4,isSpecCompliantForm:Mj,toJSONObject:Rj,isAsyncFn:Ij,isThenable:Nj,setImmediate:k4,asap:Pj};function Et(n,e,t,i,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),i&&(this.request=i),r&&(this.response=r,this.status=r.status?r.status:null)}Me.inherits(Et,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Me.toJSONObject(this.config),code:this.code,status:this.status}}});const U4=Et.prototype,z4={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{z4[n]={value:n}});Object.defineProperties(Et,z4);Object.defineProperty(U4,"isAxiosError",{value:!0});Et.from=(n,e,t,i,r,s)=>{const o=Object.create(U4);return Me.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),Et.call(o,n.message,e,t,i,r),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};var Lj=null;function rv(n){return Me.isPlainObject(n)||Me.isArray(n)}function V4(n){return Me.endsWith(n,"[]")?n.slice(0,-2):n}function wb(n,e,t){return n?n.concat(e).map(function(r,s){return r=V4(r),!t&&s?"["+r+"]":r}).join(t?".":""):e}function Dj(n){return Me.isArray(n)&&!n.some(rv)}const Fj=Me.toFlatObject(Me,{},null,function(e){return/^is[A-Z]/.test(e)});function x0(n,e,t){if(!Me.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Me.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,y){return!Me.isUndefined(y[g])});const i=t.metaTokens,r=t.visitor||u,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Me.isSpecCompliantForm(e);if(!Me.isFunction(r))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(Me.isDate(p))return p.toISOString();if(!l&&Me.isBlob(p))throw new Et("Blob is not supported. Use a Buffer instead.");return Me.isArrayBuffer(p)||Me.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function u(p,g,y){let m=p;if(p&&!y&&typeof p=="object"){if(Me.endsWith(g,"{}"))g=i?g:g.slice(0,-2),p=JSON.stringify(p);else if(Me.isArray(p)&&Dj(p)||(Me.isFileList(p)||Me.endsWith(g,"[]"))&&(m=Me.toArray(p)))return g=V4(g),m.forEach(function(x,_){!(Me.isUndefined(x)||x===null)&&e.append(o===!0?wb([g],_,s):o===null?g:g+"[]",c(x))}),!1}return rv(p)?!0:(e.append(wb(y,g,s),c(p)),!1)}const d=[],h=Object.assign(Fj,{defaultVisitor:u,convertValue:c,isVisitable:rv});function f(p,g){if(!Me.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(p),Me.forEach(p,function(m,v){(!(Me.isUndefined(m)||m===null)&&r.call(e,m,Me.isString(v)?v.trim():v,g,h))===!0&&f(m,g?g.concat(v):[v])}),d.pop()}}if(!Me.isObject(n))throw new TypeError("data must be an object");return f(n),e}function Cb(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(i){return e[i]})}function Dx(n,e){this._pairs=[],n&&x0(n,this,e)}const H4=Dx.prototype;H4.append=function(e,t){this._pairs.push([e,t])};H4.toString=function(e){const t=e?function(i){return e.call(this,i,Cb)}:Cb;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function Oj(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function $4(n,e,t){if(!e)return n;const i=t&&t.encode||Oj;Me.isFunction(t)&&(t={serialize:t});const r=t&&t.serialize;let s;if(r?s=r(e,t):s=Me.isURLSearchParams(e)?e.toString():new Dx(e,t).toString(i),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class Eb{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Me.forEach(this.handlers,function(i){i!==null&&e(i)})}}var G4={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Bj=typeof URLSearchParams<"u"?URLSearchParams:Dx,kj=typeof FormData<"u"?FormData:null,Uj=typeof Blob<"u"?Blob:null,zj={isBrowser:!0,classes:{URLSearchParams:Bj,FormData:kj,Blob:Uj},protocols:["http","https","file","blob","url","data"]};const Fx=typeof window<"u"&&typeof document<"u",sv=typeof navigator=="object"&&navigator||void 0,Vj=Fx&&(!sv||["ReactNative","NativeScript","NS"].indexOf(sv.product)<0),Hj=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$j=Fx&&window.location.href||"http://localhost";var Gj=Object.freeze({__proto__:null,hasBrowserEnv:Fx,hasStandardBrowserEnv:Vj,hasStandardBrowserWebWorkerEnv:Hj,navigator:sv,origin:$j}),Li={...Gj,...zj};function Wj(n,e){return x0(n,new Li.classes.URLSearchParams,Object.assign({visitor:function(t,i,r,s){return Li.isNode&&Me.isBuffer(t)?(this.append(i,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function Qj(n){return Me.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function jj(n){const e={},t=Object.keys(n);let i;const r=t.length;let s;for(i=0;i=t.length;return o=!o&&Me.isArray(r)?r.length:o,l?(Me.hasOwnProp(r,o)?r[o]=[r[o],i]:r[o]=i,!a):((!r[o]||!Me.isObject(r[o]))&&(r[o]=[]),e(t,i,r[o],s)&&Me.isArray(r[o])&&(r[o]=jj(r[o])),!a)}if(Me.isFormData(n)&&Me.isFunction(n.entries)){const t={};return Me.forEachEntry(n,(i,r)=>{e(Qj(i),r,t,0)}),t}return null}function qj(n,e,t){if(Me.isString(n))try{return(e||JSON.parse)(n),Me.trim(n)}catch(i){if(i.name!=="SyntaxError")throw i}return(t||JSON.stringify)(n)}const nf={transitional:G4,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const i=t.getContentType()||"",r=i.indexOf("application/json")>-1,s=Me.isObject(e);if(s&&Me.isHTMLForm(e)&&(e=new FormData(e)),Me.isFormData(e))return r?JSON.stringify(W4(e)):e;if(Me.isArrayBuffer(e)||Me.isBuffer(e)||Me.isStream(e)||Me.isFile(e)||Me.isBlob(e)||Me.isReadableStream(e))return e;if(Me.isArrayBufferView(e))return e.buffer;if(Me.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Wj(e,this.formSerializer).toString();if((a=Me.isFileList(e))||i.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return x0(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||r?(t.setContentType("application/json",!1),qj(e)):e}],transformResponse:[function(e){const t=this.transitional||nf.transitional,i=t&&t.forcedJSONParsing,r=this.responseType==="json";if(Me.isResponse(e)||Me.isReadableStream(e))return e;if(e&&Me.isString(e)&&(i&&!this.responseType||r)){const o=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?Et.from(a,Et.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Li.classes.FormData,Blob:Li.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Me.forEach(["delete","get","head","post","put","patch"],n=>{nf.headers[n]={}});const Xj=Me.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var Kj=n=>{const e={};let t,i,r;return n&&n.split("\n").forEach(function(o){r=o.indexOf(":"),t=o.substring(0,r).trim().toLowerCase(),i=o.substring(r+1).trim(),!(!t||e[t]&&Xj[t])&&(t==="set-cookie"?e[t]?e[t].push(i):e[t]=[i]:e[t]=e[t]?e[t]+", "+i:i)}),e};const Mb=Symbol("internals");function yd(n){return n&&String(n).trim().toLowerCase()}function Dp(n){return n===!1||n==null?n:Me.isArray(n)?n.map(Dp):String(n)}function Yj(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=t.exec(n);)e[i[1]]=i[2];return e}const Zj=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function a1(n,e,t,i,r){if(Me.isFunction(i))return i.call(this,e,t);if(r&&(e=t),!!Me.isString(e)){if(Me.isString(i))return e.indexOf(i)!==-1;if(Me.isRegExp(i))return i.test(e)}}function Jj(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,i)=>t.toUpperCase()+i)}function eq(n,e){const t=Me.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(n,i+t,{value:function(r,s,o){return this[i].call(this,e,r,s,o)},configurable:!0})})}let lr=class{constructor(e){e&&this.set(e)}set(e,t,i){const r=this;function s(a,l,c){const u=yd(l);if(!u)throw new Error("header name must be a non-empty string");const d=Me.findKey(r,u);(!d||r[d]===void 0||c===!0||c===void 0&&r[d]!==!1)&&(r[d||l]=Dp(a))}const o=(a,l)=>Me.forEach(a,(c,u)=>s(c,u,l));if(Me.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Me.isString(e)&&(e=e.trim())&&!Zj(e))o(Kj(e),t);else if(Me.isHeaders(e))for(const[a,l]of e.entries())s(l,a,i);else e!=null&&s(t,e,i);return this}get(e,t){if(e=yd(e),e){const i=Me.findKey(this,e);if(i){const r=this[i];if(!t)return r;if(t===!0)return Yj(r);if(Me.isFunction(t))return t.call(this,r,i);if(Me.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=yd(e),e){const i=Me.findKey(this,e);return!!(i&&this[i]!==void 0&&(!t||a1(this,this[i],i,t)))}return!1}delete(e,t){const i=this;let r=!1;function s(o){if(o=yd(o),o){const a=Me.findKey(i,o);a&&(!t||a1(i,i[a],a,t))&&(delete i[a],r=!0)}}return Me.isArray(e)?e.forEach(s):s(e),r}clear(e){const t=Object.keys(this);let i=t.length,r=!1;for(;i--;){const s=t[i];(!e||a1(this,this[s],s,e,!0))&&(delete this[s],r=!0)}return r}normalize(e){const t=this,i={};return Me.forEach(this,(r,s)=>{const o=Me.findKey(i,s);if(o){t[o]=Dp(r),delete t[s];return}const a=e?Jj(s):String(s).trim();a!==s&&delete t[s],t[a]=Dp(r),i[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Me.forEach(this,(i,r)=>{i!=null&&i!==!1&&(t[r]=e&&Me.isArray(i)?i.join(", "):i)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach(r=>i.set(r)),i}static accessor(e){const i=(this[Mb]=this[Mb]={accessors:{}}).accessors,r=this.prototype;function s(o){const a=yd(o);i[a]||(eq(r,o),i[a]=!0)}return Me.isArray(e)?e.forEach(s):s(e),this}};lr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Me.reduceDescriptors(lr.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(i){this[t]=i}}});Me.freezeMethods(lr);function l1(n,e){const t=this||nf,i=e||t,r=lr.from(i.headers);let s=i.data;return Me.forEach(n,function(a){s=a.call(t,s,r.normalize(),e?e.status:void 0)}),r.normalize(),s}function Q4(n){return!!(n&&n.__CANCEL__)}function Hu(n,e,t){Et.call(this,n==null?"canceled":n,Et.ERR_CANCELED,e,t),this.name="CanceledError"}Me.inherits(Hu,Et,{__CANCEL__:!0});function j4(n,e,t){const i=t.config.validateStatus;!t.status||!i||i(t.status)?n(t):e(new Et("Request failed with status code "+t.status,[Et.ERR_BAD_REQUEST,Et.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function tq(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function nq(n,e){n=n||10;const t=new Array(n),i=new Array(n);let r=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=i[s];o||(o=c),t[r]=l,i[r]=c;let d=s,h=0;for(;d!==r;)h+=t[d++],d=d%n;if(r=(r+1)%n,r===s&&(s=(s+1)%n),c-o{t=u,r=null,s&&(clearTimeout(s),s=null),n.apply(null,c)};return[(...c)=>{const u=Date.now(),d=u-t;d>=i?o(c,u):(r=c,s||(s=setTimeout(()=>{s=null,o(r)},i-d)))},()=>r&&o(r)]}const Rm=(n,e,t=3)=>{let i=0;const r=nq(50,250);return iq(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-i,c=r(l),u=o<=a;i=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(d)},t)},Rb=(n,e)=>{const t=n!=null;return[i=>e[0]({lengthComputable:t,total:n,loaded:i}),e[1]]},Ib=n=>(...e)=>Me.asap(()=>n(...e));var rq=Li.hasStandardBrowserEnv?((n,e)=>t=>(t=new URL(t,Li.origin),n.protocol===t.protocol&&n.host===t.host&&(e||n.port===t.port)))(new URL(Li.origin),Li.navigator&&/(msie|trident)/i.test(Li.navigator.userAgent)):()=>!0,sq=Li.hasStandardBrowserEnv?{write(n,e,t,i,r,s){const o=[n+"="+encodeURIComponent(e)];Me.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Me.isString(i)&&o.push("path="+i),Me.isString(r)&&o.push("domain="+r),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function oq(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function aq(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function q4(n,e,t){let i=!oq(e);return n&&(i||t==!1)?aq(n,e):e}const Nb=n=>n instanceof lr?{...n}:n;function Hl(n,e){e=e||{};const t={};function i(c,u,d,h){return Me.isPlainObject(c)&&Me.isPlainObject(u)?Me.merge.call({caseless:h},c,u):Me.isPlainObject(u)?Me.merge({},u):Me.isArray(u)?u.slice():u}function r(c,u,d,h){if(Me.isUndefined(u)){if(!Me.isUndefined(c))return i(void 0,c,d,h)}else return i(c,u,d,h)}function s(c,u){if(!Me.isUndefined(u))return i(void 0,u)}function o(c,u){if(Me.isUndefined(u)){if(!Me.isUndefined(c))return i(void 0,c)}else return i(void 0,u)}function a(c,u,d){if(d in e)return i(c,u);if(d in n)return i(void 0,c)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,u,d)=>r(Nb(c),Nb(u),d,!0)};return Me.forEach(Object.keys(Object.assign({},n,e)),function(u){const d=l[u]||r,h=d(n[u],e[u],u);Me.isUndefined(h)&&d!==a||(t[u]=h)}),t}var X4=n=>{const e=Hl({},n);let{data:t,withXSRFToken:i,xsrfHeaderName:r,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=lr.from(o),e.url=$4(q4(e.baseURL,e.url,e.allowAbsoluteUrls),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let l;if(Me.isFormData(t)){if(Li.hasStandardBrowserEnv||Li.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((l=o.getContentType())!==!1){const[c,...u]=l?l.split(";").map(d=>d.trim()).filter(Boolean):[];o.setContentType([c||"multipart/form-data",...u].join("; "))}}if(Li.hasStandardBrowserEnv&&(i&&Me.isFunction(i)&&(i=i(e)),i||i!==!1&&rq(e.url))){const c=r&&s&&sq.read(s);c&&o.set(r,c)}return e};const lq=typeof XMLHttpRequest<"u";var cq=lq&&function(n){return new Promise(function(t,i){const r=X4(n);let s=r.data;const o=lr.from(r.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=r,u,d,h,f,p;function g(){f&&f(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let y=new XMLHttpRequest;y.open(r.method.toUpperCase(),r.url,!0),y.timeout=r.timeout;function m(){if(!y)return;const x=lr.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),S={data:!a||a==="text"||a==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:x,config:n,request:y};j4(function(A){t(A),g()},function(A){i(A),g()},S),y=null}"onloadend"in y?y.onloadend=m:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(m)},y.onabort=function(){y&&(i(new Et("Request aborted",Et.ECONNABORTED,n,y)),y=null)},y.onerror=function(){i(new Et("Network Error",Et.ERR_NETWORK,n,y)),y=null},y.ontimeout=function(){let _=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const S=r.transitional||G4;r.timeoutErrorMessage&&(_=r.timeoutErrorMessage),i(new Et(_,S.clarifyTimeoutError?Et.ETIMEDOUT:Et.ECONNABORTED,n,y)),y=null},s===void 0&&o.setContentType(null),"setRequestHeader"in y&&Me.forEach(o.toJSON(),function(_,S){y.setRequestHeader(S,_)}),Me.isUndefined(r.withCredentials)||(y.withCredentials=!!r.withCredentials),a&&a!=="json"&&(y.responseType=r.responseType),c&&([h,p]=Rm(c,!0),y.addEventListener("progress",h)),l&&y.upload&&([d,f]=Rm(l),y.upload.addEventListener("progress",d),y.upload.addEventListener("loadend",f)),(r.cancelToken||r.signal)&&(u=x=>{y&&(i(!x||x.type?new Hu(null,n,y):x),y.abort(),y=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const v=tq(r.url);if(v&&Li.protocols.indexOf(v)===-1){i(new Et("Unsupported protocol "+v+":",Et.ERR_BAD_REQUEST,n));return}y.send(s||null)})};const uq=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let i=new AbortController,r;const s=function(c){if(!r){r=!0,a();const u=c instanceof Error?c:this.reason;i.abort(u instanceof Et?u:new Hu(u instanceof Error?u.message:u))}};let o=e&&setTimeout(()=>{o=null,s(new Et("timeout ".concat(e," of ms exceeded"),Et.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),n=null)};n.forEach(c=>c.addEventListener("abort",s));const{signal:l}=i;return l.unsubscribe=()=>Me.asap(a),l}},dq=function*(n,e){let t=n.byteLength;if(t{const r=hq(n,e);let s=0,o,a=l=>{o||(o=!0,i&&i(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await r.next();if(c){a(),l.close();return}let d=u.byteLength;if(t){let h=s+=d;t(h)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),r.return()}},{highWaterMark:2})},S0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",K4=S0&&typeof ReadableStream=="function",pq=S0&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),Y4=(n,...e)=>{try{return!!n(...e)}catch(t){return!1}},mq=K4&&Y4(()=>{let n=!1;const e=new Request(Li.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e}),Lb=64*1024,ov=K4&&Y4(()=>Me.isReadableStream(new Response("").body)),Im={stream:ov&&(n=>n.body)};S0&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Im[e]&&(Im[e]=Me.isFunction(n[e])?t=>t[e]():(t,i)=>{throw new Et("Response type '".concat(e,"' is not supported"),Et.ERR_NOT_SUPPORT,i)})})})(new Response);const gq=async n=>{if(n==null)return 0;if(Me.isBlob(n))return n.size;if(Me.isSpecCompliantForm(n))return(await new Request(Li.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(Me.isArrayBufferView(n)||Me.isArrayBuffer(n))return n.byteLength;if(Me.isURLSearchParams(n)&&(n=n+""),Me.isString(n))return(await pq(n)).byteLength},yq=async(n,e)=>{const t=Me.toFiniteNumber(n.getContentLength());return t==null?gq(e):t};var vq=S0&&(async n=>{let{url:e,method:t,data:i,signal:r,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:u,withCredentials:d="same-origin",fetchOptions:h}=X4(n);c=c?(c+"").toLowerCase():"text";let f=uq([r,s&&s.toAbortSignal()],o),p;const g=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let y;try{if(l&&mq&&t!=="get"&&t!=="head"&&(y=await yq(u,i))!==0){let S=new Request(e,{method:"POST",body:i,duplex:"half"}),E;if(Me.isFormData(i)&&(E=S.headers.get("content-type"))&&u.setContentType(E),S.body){const[A,R]=Rb(y,Rm(Ib(l)));i=Pb(S.body,Lb,A,R)}}Me.isString(d)||(d=d?"include":"omit");const m="credentials"in Request.prototype;p=new Request(e,{...h,signal:f,method:t.toUpperCase(),headers:u.normalize().toJSON(),body:i,duplex:"half",credentials:m?d:void 0});let v=await fetch(p);const x=ov&&(c==="stream"||c==="response");if(ov&&(a||x&&g)){const S={};["status","statusText","headers"].forEach(w=>{S[w]=v[w]});const E=Me.toFiniteNumber(v.headers.get("content-length")),[A,R]=a&&Rb(E,Rm(Ib(a),!0))||[];v=new Response(Pb(v.body,Lb,A,()=>{R&&R(),g&&g()}),S)}c=c||"text";let _=await Im[Me.findKey(Im,c)||"text"](v,n);return!x&&g&&g(),await new Promise((S,E)=>{j4(S,E,{data:_,headers:lr.from(v.headers),status:v.status,statusText:v.statusText,config:n,request:p})})}catch(m){throw g&&g(),m&&m.name==="TypeError"&&/fetch/i.test(m.message)?Object.assign(new Et("Network Error",Et.ERR_NETWORK,n,p),{cause:m.cause||m}):Et.from(m,m&&m.code,n,p)}});const av={http:Lj,xhr:cq,fetch:vq};Me.forEach(av,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch(t){}Object.defineProperty(n,"adapterName",{value:e})}});const Db=n=>"- ".concat(n),_q=n=>Me.isFunction(n)||n===null||n===!1;var Z4={getAdapter:n=>{n=Me.isArray(n)?n:[n];const{length:e}=n;let t,i;const r={};for(let s=0;s"adapter ".concat(a," ")+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?"since :\n"+s.map(Db).join("\n"):" "+Db(s[0]):"as no adapter specified";throw new Et("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return i},adapters:av};function c1(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Hu(null,n)}function Fb(n){return c1(n),n.headers=lr.from(n.headers),n.data=l1.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Z4.getAdapter(n.adapter||nf.adapter)(n).then(function(i){return c1(n),i.data=l1.call(n,n.transformResponse,i),i.headers=lr.from(i.headers),i},function(i){return Q4(i)||(c1(n),i&&i.response&&(i.response.data=l1.call(n,n.transformResponse,i.response),i.response.headers=lr.from(i.response.headers))),Promise.reject(i)})}const J4="1.8.4",A0={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{A0[n]=function(i){return typeof i===n||"a"+(e<1?"n ":" ")+n}});const Ob={};A0.transitional=function(e,t,i){function r(s,o){return"[Axios v"+J4+"] Transitional option '"+s+"'"+o+(i?". "+i:"")}return(s,o,a)=>{if(e===!1)throw new Et(r(o," has been removed"+(t?" in "+t:"")),Et.ERR_DEPRECATED);return t&&!Ob[o]&&(Ob[o]=!0,console.warn(r(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};A0.spelling=function(e){return(t,i)=>(console.warn("".concat(i," is likely a misspelling of ").concat(e)),!0)};function xq(n,e,t){if(typeof n!="object")throw new Et("options must be an object",Et.ERR_BAD_OPTION_VALUE);const i=Object.keys(n);let r=i.length;for(;r-- >0;){const s=i[r],o=e[s];if(o){const a=n[s],l=a===void 0||o(a,s,n);if(l!==!0)throw new Et("option "+s+" must be "+l,Et.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Et("Unknown option "+s,Et.ERR_BAD_OPTION)}}var Fp={assertOptions:xq,validators:A0};const Is=Fp.validators;let Pl=class{constructor(e){this.defaults=e,this.interceptors={request:new Eb,response:new Eb}}async request(e,t){try{return await this._request(e,t)}catch(i){if(i instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const s=r.stack?r.stack.replace(/^.+\n/,""):"";try{i.stack?s&&!String(i.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(i.stack+="\n"+s):i.stack=s}catch(o){}}throw i}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Hl(this.defaults,t);const{transitional:i,paramsSerializer:r,headers:s}=t;i!==void 0&&Fp.assertOptions(i,{silentJSONParsing:Is.transitional(Is.boolean),forcedJSONParsing:Is.transitional(Is.boolean),clarifyTimeoutError:Is.transitional(Is.boolean)},!1),r!=null&&(Me.isFunction(r)?t.paramsSerializer={serialize:r}:Fp.assertOptions(r,{encode:Is.function,serialize:Is.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Fp.assertOptions(t,{baseUrl:Is.spelling("baseURL"),withXsrfToken:Is.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Me.merge(s.common,s[t.method]);s&&Me.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),t.headers=lr.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(t)===!1||(l=l&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,d=0,h;if(!l){const p=[Fb.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,c),h=p.length,u=Promise.resolve(t);d{if(!i._listeners)return;let s=i._listeners.length;for(;s-- >0;)i._listeners[s](r);i._listeners=null}),this.promise.then=r=>{let s;const o=new Promise(a=>{i.subscribe(a),s=a}).then(r);return o.cancel=function(){i.unsubscribe(s)},o},e(function(s,o,a){i.reason||(i.reason=new Hu(s,o,a),t(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=i=>{e.abort(i)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new e6(function(r){e=r}),cancel:e}}};function Aq(n){return function(t){return n.apply(null,t)}}function bq(n){return Me.isObject(n)&&n.isAxiosError===!0}const lv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(lv).forEach(([n,e])=>{lv[e]=n});function t6(n){const e=new Pl(n),t=P4(Pl.prototype.request,e);return Me.extend(t,Pl.prototype,e,{allOwnKeys:!0}),Me.extend(t,e,null,{allOwnKeys:!0}),t.create=function(r){return t6(Hl(n,r))},t}const Bn=t6(nf);Bn.Axios=Pl;Bn.CanceledError=Hu;Bn.CancelToken=Sq;Bn.isCancel=Q4;Bn.VERSION=J4;Bn.toFormData=x0;Bn.AxiosError=Et;Bn.Cancel=Bn.CanceledError;Bn.all=function(e){return Promise.all(e)};Bn.spread=Aq;Bn.isAxiosError=bq;Bn.mergeConfig=Hl;Bn.AxiosHeaders=lr;Bn.formToJSON=n=>W4(Me.isHTMLForm(n)?new FormData(n):n);Bn.getAdapter=Z4.getAdapter;Bn.HttpStatusCode=lv;Bn.default=Bn;const{Axios:rre,AxiosError:sre,CanceledError:ore,isCancel:are,CancelToken:lre,VERSION:cre,all:ure,Cancel:dre,isAxiosError:hre,spread:fre,toFormData:pre,AxiosHeaders:mre,HttpStatusCode:gre,formToJSON:yre,getAdapter:vre,mergeConfig:_re}=Bn;var Bc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function n6(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function rp(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var u1={exports:{}},Bb;function Tq(){return Bb||(Bb=1,function(n,e){(function(t){n.exports=t()})(function(){return function t(i,r,s){function o(c,u){if(!r[c]){if(!i[c]){var d=typeof rp=="function"&&rp;if(!u&&d)return d(c,!0);if(a)return a(c,!0);var h=new Error("Cannot find module '"+c+"'");throw h.code="MODULE_NOT_FOUND",h}var f=r[c]={exports:{}};i[c][0].call(f.exports,function(p){var g=i[c][1][p];return o(g||p)},f,f.exports,t,i,r,s)}return r[c].exports}for(var a=typeof rp=="function"&&rp,l=0;l>2,f=(3&c)<<4|u>>4,p=1>6:64,g=2>4,u=(15&h)<<4|(f=a.indexOf(l.charAt(g++)))>>2,d=(3&f)<<6|(p=a.indexOf(l.charAt(g++))),v[y++]=c,f!==64&&(v[y++]=u),p!==64&&(v[y++]=d);return v}},{"./support":30,"./utils":32}],2:[function(t,i,r){var s=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(u,d,h,f,p){this.compressedSize=u,this.uncompressedSize=d,this.crc32=h,this.compression=f,this.compressedContent=p}c.prototype={getContentWorker:function(){var u=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),d=this;return u.on("end",function(){if(this.streamInfo.data_length!==d.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(u,d,h){return u.pipe(new a).pipe(new l("uncompressedSize")).pipe(d.compressWorker(h)).pipe(new l("compressedSize")).withStreamInfo("compression",d)},i.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,i,r){var s=t("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},r.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,i,r){var s=t("./utils"),o=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var u=0;u<8;u++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();i.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(c,u,d,h){var f=o,p=h+d;c^=-1;for(var g=h;g>>8^f[255&(c^u[g])];return-1^c}(0|l,a,a.length,0):function(c,u,d,h){var f=o,p=h+d;c^=-1;for(var g=h;g>>8^f[255&(c^u.charCodeAt(g))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(t,i,r){r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(t,i,r){var s=null;s=typeof Promise<"u"?Promise:t("lie"),i.exports={Promise:s}},{lie:37}],7:[function(t,i,r){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),l=t("./stream/GenericWorker"),c=s?"uint8array":"array";function u(d,h){l.call(this,"FlateWorker/"+d),this._pako=null,this._pakoAction=d,this._pakoOptions=h,this.meta={}}r.magic="\b\0",a.inherits(u,l),u.prototype.processChunk=function(d){this.meta=d.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,d.data),!1)},u.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var d=this;this._pako.onData=function(h){d.push({data:h,meta:d.meta})}},r.compressWorker=function(d){return new u("Deflate",d)},r.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,i,r){function s(f,p){var g,y="";for(g=0;g>>=8;return y}function o(f,p,g,y,m,v){var x,_,S=f.file,E=f.compression,A=v!==c.utf8encode,R=a.transformTo("string",v(S.name)),w=a.transformTo("string",c.utf8encode(S.name)),M=S.comment,I=a.transformTo("string",v(M)),L=a.transformTo("string",c.utf8encode(M)),k=w.length!==S.name.length,T=L.length!==M.length,F="",V="",Q="",ee=S.dir,se=S.date,he={crc32:0,compressedSize:0,uncompressedSize:0};p&&!g||(he.crc32=f.crc32,he.compressedSize=f.compressedSize,he.uncompressedSize=f.uncompressedSize);var ie=0;p&&(ie|=8),A||!k&&!T||(ie|=2048);var re=0,be=0;ee&&(re|=16),m==="UNIX"?(be=798,re|=function(fe,Te){var Ce=fe;return fe||(Ce=Te?16893:33204),(65535&Ce)<<16}(S.unixPermissions,ee)):(be=20,re|=function(fe){return 63&(fe||0)}(S.dosPermissions)),x=se.getUTCHours(),x<<=6,x|=se.getUTCMinutes(),x<<=5,x|=se.getUTCSeconds()/2,_=se.getUTCFullYear()-1980,_<<=4,_|=se.getUTCMonth()+1,_<<=5,_|=se.getUTCDate(),k&&(V=s(1,1)+s(u(R),4)+w,F+="up"+s(V.length,2)+V),T&&(Q=s(1,1)+s(u(I),4)+L,F+="uc"+s(Q.length,2)+Q);var le="";return le+="\n\0",le+=s(ie,2),le+=E.magic,le+=s(x,2),le+=s(_,2),le+=s(he.crc32,4),le+=s(he.compressedSize,4),le+=s(he.uncompressedSize,4),le+=s(R.length,2),le+=s(F.length,2),{fileRecord:d.LOCAL_FILE_HEADER+le+R+F,dirRecord:d.CENTRAL_FILE_HEADER+s(be,2)+le+s(I.length,2)+"\0\0\0\0"+s(re,4)+s(y,4)+R+F+I}}var a=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),u=t("../crc32"),d=t("../signature");function h(f,p,g,y){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=g,this.encodeFileName=y,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(h,l),h.prototype.push=function(f){var p=f.meta.percent||0,g=this.entriesCount,y=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:g?(p+100*(g-y-1))/g:100}}))},h.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var p=this.streamFiles&&!f.file.dir;if(p){var g=o(f,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(f){this.accumulate=!1;var p=this.streamFiles&&!f.file.dir,g=o(f,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),p)this.push({data:function(y){return d.DATA_DESCRIPTOR+s(y.crc32,4)+s(y.compressedSize,4)+s(y.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var f=this.bytesWritten,p=0;p=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},readString:function(a){return s.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},i.exports=o},{"../utils":32}],19:[function(t,i,r){var s=t("./Uint8ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,i,r){var s=t("./DataReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,i,r){var s=t("./ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,i,r){var s=t("../utils"),o=t("../support"),a=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),u=t("./Uint8ArrayReader");i.exports=function(d){var h=s.getTypeOf(d);return s.checkSupport(h),h!=="string"||o.uint8array?h==="nodebuffer"?new c(d):o.uint8array?new u(s.transformTo("uint8array",d)):new a(s.transformTo("array",d)):new l(d)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,i,r){r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,i,r){var s=t("./GenericWorker"),o=t("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},i.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,i,r){var s=t("./GenericWorker"),o=t("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},i.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,i,r){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}o.prototype.processChunk.call(this,l)},i.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,i,r){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(u){c.dataIsReady=!0,c.data=u,c.max=u&&u.length||0,c.type=s.getTypeOf(u),c.isPaused||c._tickAndRepeat()},function(u){c.error(u)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,i,r){function s(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l "+o:o}},i.exports=s},{}],29:[function(t,i,r){var s=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),l=t("../base64"),c=t("../support"),u=t("../external"),d=null;if(c.nodestream)try{d=t("../nodejs/NodejsStreamOutputAdapter")}catch(p){}function h(p,g){return new u.Promise(function(y,m){var v=[],x=p._internalType,_=p._outputType,S=p._mimeType;p.on("data",function(E,A){v.push(E),g&&g(A)}).on("error",function(E){v=[],m(E)}).on("end",function(){try{var E=function(A,R,w){switch(A){case"blob":return s.newBlob(s.transformTo("arraybuffer",R),w);case"base64":return l.encode(R);default:return s.transformTo(A,R)}}(_,function(A,R){var w,M=0,I=null,L=0;for(w=0;w"u")r.blob=!1;else{var s=new ArrayBuffer(0);try{r.blob=new Blob([s],{type:"application/zip"}).size===0}catch(a){try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),r.blob=o.getBlob("application/zip").size===0}catch(l){r.blob=!1}}}try{r.nodestream=!!t("readable-stream").Readable}catch(a){r.nodestream=!1}},{"readable-stream":16}],31:[function(t,i,r){for(var s=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;c[254]=c[254]=1;function d(){l.call(this,"utf-8 decode"),this.leftOver=null}function h(){l.call(this,"utf-8 encode")}r.utf8encode=function(f){return o.nodebuffer?a.newBufferFrom(f,"utf-8"):function(p){var g,y,m,v,x,_=p.length,S=0;for(v=0;v<_;v++)(64512&(y=p.charCodeAt(v)))==55296&&v+1<_&&(64512&(m=p.charCodeAt(v+1)))==56320&&(y=65536+(y-55296<<10)+(m-56320),v++),S+=y<128?1:y<2048?2:y<65536?3:4;for(g=o.uint8array?new Uint8Array(S):new Array(S),v=x=0;x>>6:(y<65536?g[x++]=224|y>>>12:(g[x++]=240|y>>>18,g[x++]=128|y>>>12&63),g[x++]=128|y>>>6&63),g[x++]=128|63&y);return g}(f)},r.utf8decode=function(f){return o.nodebuffer?s.transformTo("nodebuffer",f).toString("utf-8"):function(p){var g,y,m,v,x=p.length,_=new Array(2*x);for(g=y=0;g>10&1023,_[y++]=56320|1023&m)}return _.length!==y&&(_.subarray?_=_.subarray(0,y):_.length=y),s.applyFromCharCode(_)}(f=s.transformTo(o.uint8array?"uint8array":"array",f))},s.inherits(d,l),d.prototype.processChunk=function(f){var p=s.transformTo(o.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var g=p;(p=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),p.set(g,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var y=function(v,x){var _;for((x=x||v.length)>v.length&&(x=v.length),_=x-1;0<=_&&(192&v[_])==128;)_--;return _<0||_===0?x:_+c[v[_]]>x?_:x}(p),m=p;y!==p.length&&(o.uint8array?(m=p.subarray(0,y),this.leftOver=p.subarray(y,p.length)):(m=p.slice(0,y),this.leftOver=p.slice(y,p.length))),this.push({data:r.utf8decode(m),meta:f.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=d,s.inherits(h,l),h.prototype.processChunk=function(f){this.push({data:r.utf8encode(f.data),meta:f.meta})},r.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,i,r){var s=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),l=t("./external");function c(g){return g}function u(g,y){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var p,g,y,m=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4>>6:(f<65536?h[y++]=224|f>>>12:(h[y++]=240|f>>>18,h[y++]=128|f>>>12&63),h[y++]=128|f>>>6&63),h[y++]=128|63&f);return h},r.buf2binstring=function(d){return u(d,d.length)},r.binstring2buf=function(d){for(var h=new s.Buf8(d.length),f=0,p=h.length;f>10&1023,v[p++]=56320|1023&g)}return u(v,p)},r.utf8border=function(d,h){var f;for((h=h||d.length)>d.length&&(h=d.length),f=h-1;0<=f&&(192&d[f])==128;)f--;return f<0||f===0?h:f+l[d[f]]>h?f:h}},{"./common":41}],43:[function(t,i,r){i.exports=function(s,o,a,l){for(var c=65535&s|0,u=s>>>16&65535|0,d=0;a!==0;){for(a-=d=2e3>>1:o>>>1;a[l]=o}return a}();i.exports=function(o,a,l,c){var u=s,d=c+l;o^=-1;for(var h=c;h>>8^u[255&(o^a[h])];return-1^o}},{}],46:[function(t,i,r){var s,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),c=t("./crc32"),u=t("./messages"),d=0,h=4,f=0,p=-2,g=-1,y=4,m=2,v=8,x=9,_=286,S=30,E=19,A=2*_+1,R=15,w=3,M=258,I=M+w+1,L=42,k=113,T=1,F=2,V=3,Q=4;function ee(b,oe){return b.msg=u[oe],oe}function se(b){return(b<<1)-(4b.avail_out&&(J=b.avail_out),J!==0&&(o.arraySet(b.output,oe.pending_buf,oe.pending_out,J,b.next_out),b.next_out+=J,oe.pending_out+=J,b.total_out+=J,b.avail_out-=J,oe.pending-=J,oe.pending===0&&(oe.pending_out=0))}function re(b,oe){a._tr_flush_block(b,0<=b.block_start?b.block_start:-1,b.strstart-b.block_start,oe),b.block_start=b.strstart,ie(b.strm)}function be(b,oe){b.pending_buf[b.pending++]=oe}function le(b,oe){b.pending_buf[b.pending++]=oe>>>8&255,b.pending_buf[b.pending++]=255&oe}function fe(b,oe){var J,H,P=b.max_chain_length,U=b.strstart,j=b.prev_length,B=b.nice_match,D=b.strstart>b.w_size-I?b.strstart-(b.w_size-I):0,W=b.window,G=b.w_mask,X=b.prev,ue=b.strstart+M,z=W[U+j-1],C=W[U+j];b.prev_length>=b.good_match&&(P>>=2),B>b.lookahead&&(B=b.lookahead);do if(W[(J=oe)+j]===C&&W[J+j-1]===z&&W[J]===W[U]&&W[++J]===W[U+1]){U+=2,J++;do;while(W[++U]===W[++J]&&W[++U]===W[++J]&&W[++U]===W[++J]&&W[++U]===W[++J]&&W[++U]===W[++J]&&W[++U]===W[++J]&&W[++U]===W[++J]&&W[++U]===W[++J]&&UD&&--P!=0);return j<=b.lookahead?j:b.lookahead}function Te(b){var oe,J,H,P,U,j,B,D,W,G,X=b.w_size;do{if(P=b.window_size-b.lookahead-b.strstart,b.strstart>=X+(X-I)){for(o.arraySet(b.window,b.window,X,X,0),b.match_start-=X,b.strstart-=X,b.block_start-=X,oe=J=b.hash_size;H=b.head[--oe],b.head[oe]=X<=H?H-X:0,--J;);for(oe=J=X;H=b.prev[--oe],b.prev[oe]=X<=H?H-X:0,--J;);P+=X}if(b.strm.avail_in===0)break;if(j=b.strm,B=b.window,D=b.strstart+b.lookahead,W=P,G=void 0,G=j.avail_in,W=w)for(U=b.strstart-b.insert,b.ins_h=b.window[U],b.ins_h=(b.ins_h<=w&&(b.ins_h=(b.ins_h<=w)if(H=a._tr_tally(b,b.strstart-b.match_start,b.match_length-w),b.lookahead-=b.match_length,b.match_length<=b.max_lazy_match&&b.lookahead>=w){for(b.match_length--;b.strstart++,b.ins_h=(b.ins_h<=w&&(b.ins_h=(b.ins_h<=w&&b.match_length<=b.prev_length){for(P=b.strstart+b.lookahead-w,H=a._tr_tally(b,b.strstart-1-b.prev_match,b.prev_length-w),b.lookahead-=b.prev_length-1,b.prev_length-=2;++b.strstart<=P&&(b.ins_h=(b.ins_h<b.pending_buf_size-5&&(J=b.pending_buf_size-5);;){if(b.lookahead<=1){if(Te(b),b.lookahead===0&&oe===d)return T;if(b.lookahead===0)break}b.strstart+=b.lookahead,b.lookahead=0;var H=b.block_start+J;if((b.strstart===0||b.strstart>=H)&&(b.lookahead=b.strstart-H,b.strstart=H,re(b,!1),b.strm.avail_out===0)||b.strstart-b.block_start>=b.w_size-I&&(re(b,!1),b.strm.avail_out===0))return T}return b.insert=0,oe===h?(re(b,!0),b.strm.avail_out===0?V:Q):(b.strstart>b.block_start&&(re(b,!1),b.strm.avail_out),T)}),new ze(4,4,8,4,Ce),new ze(4,5,16,8,Ce),new ze(4,6,32,32,Ce),new ze(4,4,16,16,Ie),new ze(8,16,32,32,Ie),new ze(8,16,128,128,Ie),new ze(8,32,128,256,Ie),new ze(32,128,258,1024,Ie),new ze(32,258,258,4096,Ie)],r.deflateInit=function(b,oe){return ne(b,oe,v,15,8,0)},r.deflateInit2=ne,r.deflateReset=te,r.deflateResetKeep=it,r.deflateSetHeader=function(b,oe){return b&&b.state?b.state.wrap!==2?p:(b.state.gzhead=oe,f):p},r.deflate=function(b,oe){var J,H,P,U;if(!b||!b.state||5>8&255),be(H,H.gzhead.time>>16&255),be(H,H.gzhead.time>>24&255),be(H,H.level===9?2:2<=H.strategy||H.level<2?4:0),be(H,255&H.gzhead.os),H.gzhead.extra&&H.gzhead.extra.length&&(be(H,255&H.gzhead.extra.length),be(H,H.gzhead.extra.length>>8&255)),H.gzhead.hcrc&&(b.adler=c(b.adler,H.pending_buf,H.pending,0)),H.gzindex=0,H.status=69):(be(H,0),be(H,0),be(H,0),be(H,0),be(H,0),be(H,H.level===9?2:2<=H.strategy||H.level<2?4:0),be(H,3),H.status=k);else{var j=v+(H.w_bits-8<<4)<<8;j|=(2<=H.strategy||H.level<2?0:H.level<6?1:H.level===6?2:3)<<6,H.strstart!==0&&(j|=32),j+=31-j%31,H.status=k,le(H,j),H.strstart!==0&&(le(H,b.adler>>>16),le(H,65535&b.adler)),b.adler=1}if(H.status===69)if(H.gzhead.extra){for(P=H.pending;H.gzindex<(65535&H.gzhead.extra.length)&&(H.pending!==H.pending_buf_size||(H.gzhead.hcrc&&H.pending>P&&(b.adler=c(b.adler,H.pending_buf,H.pending-P,P)),ie(b),P=H.pending,H.pending!==H.pending_buf_size));)be(H,255&H.gzhead.extra[H.gzindex]),H.gzindex++;H.gzhead.hcrc&&H.pending>P&&(b.adler=c(b.adler,H.pending_buf,H.pending-P,P)),H.gzindex===H.gzhead.extra.length&&(H.gzindex=0,H.status=73)}else H.status=73;if(H.status===73)if(H.gzhead.name){P=H.pending;do{if(H.pending===H.pending_buf_size&&(H.gzhead.hcrc&&H.pending>P&&(b.adler=c(b.adler,H.pending_buf,H.pending-P,P)),ie(b),P=H.pending,H.pending===H.pending_buf_size)){U=1;break}U=H.gzindexP&&(b.adler=c(b.adler,H.pending_buf,H.pending-P,P)),U===0&&(H.gzindex=0,H.status=91)}else H.status=91;if(H.status===91)if(H.gzhead.comment){P=H.pending;do{if(H.pending===H.pending_buf_size&&(H.gzhead.hcrc&&H.pending>P&&(b.adler=c(b.adler,H.pending_buf,H.pending-P,P)),ie(b),P=H.pending,H.pending===H.pending_buf_size)){U=1;break}U=H.gzindexP&&(b.adler=c(b.adler,H.pending_buf,H.pending-P,P)),U===0&&(H.status=103)}else H.status=103;if(H.status===103&&(H.gzhead.hcrc?(H.pending+2>H.pending_buf_size&&ie(b),H.pending+2<=H.pending_buf_size&&(be(H,255&b.adler),be(H,b.adler>>8&255),b.adler=0,H.status=k)):H.status=k),H.pending!==0){if(ie(b),b.avail_out===0)return H.last_flush=-1,f}else if(b.avail_in===0&&se(oe)<=se(J)&&oe!==h)return ee(b,-5);if(H.status===666&&b.avail_in!==0)return ee(b,-5);if(b.avail_in!==0||H.lookahead!==0||oe!==d&&H.status!==666){var B=H.strategy===2?function(D,W){for(var G;;){if(D.lookahead===0&&(Te(D),D.lookahead===0)){if(W===d)return T;break}if(D.match_length=0,G=a._tr_tally(D,0,D.window[D.strstart]),D.lookahead--,D.strstart++,G&&(re(D,!1),D.strm.avail_out===0))return T}return D.insert=0,W===h?(re(D,!0),D.strm.avail_out===0?V:Q):D.last_lit&&(re(D,!1),D.strm.avail_out===0)?T:F}(H,oe):H.strategy===3?function(D,W){for(var G,X,ue,z,C=D.window;;){if(D.lookahead<=M){if(Te(D),D.lookahead<=M&&W===d)return T;if(D.lookahead===0)break}if(D.match_length=0,D.lookahead>=w&&0D.lookahead&&(D.match_length=D.lookahead)}if(D.match_length>=w?(G=a._tr_tally(D,1,D.match_length-w),D.lookahead-=D.match_length,D.strstart+=D.match_length,D.match_length=0):(G=a._tr_tally(D,0,D.window[D.strstart]),D.lookahead--,D.strstart++),G&&(re(D,!1),D.strm.avail_out===0))return T}return D.insert=0,W===h?(re(D,!0),D.strm.avail_out===0?V:Q):D.last_lit&&(re(D,!1),D.strm.avail_out===0)?T:F}(H,oe):s[H.level].func(H,oe);if(B!==V&&B!==Q||(H.status=666),B===T||B===V)return b.avail_out===0&&(H.last_flush=-1),f;if(B===F&&(oe===1?a._tr_align(H):oe!==5&&(a._tr_stored_block(H,0,0,!1),oe===3&&(he(H.head),H.lookahead===0&&(H.strstart=0,H.block_start=0,H.insert=0))),ie(b),b.avail_out===0))return H.last_flush=-1,f}return oe!==h?f:H.wrap<=0?1:(H.wrap===2?(be(H,255&b.adler),be(H,b.adler>>8&255),be(H,b.adler>>16&255),be(H,b.adler>>24&255),be(H,255&b.total_in),be(H,b.total_in>>8&255),be(H,b.total_in>>16&255),be(H,b.total_in>>24&255)):(le(H,b.adler>>>16),le(H,65535&b.adler)),ie(b),0=J.w_size&&(U===0&&(he(J.head),J.strstart=0,J.block_start=0,J.insert=0),W=new o.Buf8(J.w_size),o.arraySet(W,oe,G-J.w_size,J.w_size,0),oe=W,G=J.w_size),j=b.avail_in,B=b.next_in,D=b.input,b.avail_in=G,b.next_in=0,b.input=oe,Te(J);J.lookahead>=w;){for(H=J.strstart,P=J.lookahead-(w-1);J.ins_h=(J.ins_h<>>=w=R>>>24,x-=w,(w=R>>>16&255)===0)F[u++]=65535&R;else{if(!(16&w)){if((64&w)==0){R=_[(65535&R)+(v&(1<>>=w,x-=w),x<15&&(v+=T[l++]<>>=w=R>>>24,x-=w,!(16&(w=R>>>16&255))){if((64&w)==0){R=S[(65535&R)+(v&(1<>>=w,x-=w,(w=u-d)>3,v&=(1<<(x-=M<<3))-1,s.next_in=l,s.next_out=u,s.avail_in=l>>24&255)+(L>>>8&65280)+((65280&L)<<8)+((255&L)<<24)}function v(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function x(L){var k;return L&&L.state?(k=L.state,L.total_in=L.total_out=k.total=0,L.msg="",k.wrap&&(L.adler=1&k.wrap),k.mode=p,k.last=0,k.havedict=0,k.dmax=32768,k.head=null,k.hold=0,k.bits=0,k.lencode=k.lendyn=new s.Buf32(g),k.distcode=k.distdyn=new s.Buf32(y),k.sane=1,k.back=-1,h):f}function _(L){var k;return L&&L.state?((k=L.state).wsize=0,k.whave=0,k.wnext=0,x(L)):f}function S(L,k){var T,F;return L&&L.state?(F=L.state,k<0?(T=0,k=-k):(T=1+(k>>4),k<48&&(k&=15)),k&&(k<8||15=Q.wsize?(s.arraySet(Q.window,k,T-Q.wsize,Q.wsize,0),Q.wnext=0,Q.whave=Q.wsize):(F<(V=Q.wsize-Q.wnext)&&(V=F),s.arraySet(Q.window,k,T-F,V,Q.wnext),(F-=V)?(s.arraySet(Q.window,k,T-F,F,0),Q.wnext=F,Q.whave=Q.wsize):(Q.wnext+=V,Q.wnext===Q.wsize&&(Q.wnext=0),Q.whave>>8&255,T.check=a(T.check,U,2,0),re=ie=0,T.mode=2;break}if(T.flags=0,T.head&&(T.head.done=!1),!(1&T.wrap)||(((255&ie)<<8)+(ie>>8))%31){L.msg="incorrect header check",T.mode=30;break}if((15&ie)!=8){L.msg="unknown compression method",T.mode=30;break}if(re-=4,b=8+(15&(ie>>>=4)),T.wbits===0)T.wbits=b;else if(b>T.wbits){L.msg="invalid window size",T.mode=30;break}T.dmax=1<>8&1),512&T.flags&&(U[0]=255&ie,U[1]=ie>>>8&255,T.check=a(T.check,U,2,0)),re=ie=0,T.mode=3;case 3:for(;re<32;){if(se===0)break e;se--,ie+=F[Q++]<>>8&255,U[2]=ie>>>16&255,U[3]=ie>>>24&255,T.check=a(T.check,U,4,0)),re=ie=0,T.mode=4;case 4:for(;re<16;){if(se===0)break e;se--,ie+=F[Q++]<>8),512&T.flags&&(U[0]=255&ie,U[1]=ie>>>8&255,T.check=a(T.check,U,2,0)),re=ie=0,T.mode=5;case 5:if(1024&T.flags){for(;re<16;){if(se===0)break e;se--,ie+=F[Q++]<>>8&255,T.check=a(T.check,U,2,0)),re=ie=0}else T.head&&(T.head.extra=null);T.mode=6;case 6:if(1024&T.flags&&(se<(fe=T.length)&&(fe=se),fe&&(T.head&&(b=T.head.extra_len-T.length,T.head.extra||(T.head.extra=new Array(T.head.extra_len)),s.arraySet(T.head.extra,F,Q,fe,b)),512&T.flags&&(T.check=a(T.check,F,fe,Q)),se-=fe,Q+=fe,T.length-=fe),T.length))break e;T.length=0,T.mode=7;case 7:if(2048&T.flags){if(se===0)break e;for(fe=0;b=F[Q+fe++],T.head&&b&&T.length<65536&&(T.head.name+=String.fromCharCode(b)),b&&fe>9&1,T.head.done=!0),L.adler=T.check=0,T.mode=12;break;case 10:for(;re<32;){if(se===0)break e;se--,ie+=F[Q++]<>>=7&re,re-=7&re,T.mode=27;break}for(;re<3;){if(se===0)break e;se--,ie+=F[Q++]<>>=1)){case 0:T.mode=14;break;case 1:if(M(T),T.mode=20,k!==6)break;ie>>>=2,re-=2;break e;case 2:T.mode=17;break;case 3:L.msg="invalid block type",T.mode=30}ie>>>=2,re-=2;break;case 14:for(ie>>>=7&re,re-=7&re;re<32;){if(se===0)break e;se--,ie+=F[Q++]<>>16^65535)){L.msg="invalid stored block lengths",T.mode=30;break}if(T.length=65535&ie,re=ie=0,T.mode=15,k===6)break e;case 15:T.mode=16;case 16:if(fe=T.length){if(se>>=5,re-=5,T.ndist=1+(31&ie),ie>>>=5,re-=5,T.ncode=4+(15&ie),ie>>>=4,re-=4,286>>=3,re-=3}for(;T.have<19;)T.lens[j[T.have++]]=0;if(T.lencode=T.lendyn,T.lenbits=7,J={bits:T.lenbits},oe=c(0,T.lens,0,19,T.lencode,0,T.work,J),T.lenbits=J.bits,oe){L.msg="invalid code lengths set",T.mode=30;break}T.have=0,T.mode=19;case 19:for(;T.have>>16&255,Be=65535&P,!((Ie=P>>>24)<=re);){if(se===0)break e;se--,ie+=F[Q++]<>>=Ie,re-=Ie,T.lens[T.have++]=Be;else{if(Be===16){for(H=Ie+2;re>>=Ie,re-=Ie,T.have===0){L.msg="invalid bit length repeat",T.mode=30;break}b=T.lens[T.have-1],fe=3+(3&ie),ie>>>=2,re-=2}else if(Be===17){for(H=Ie+3;re>>=Ie)),ie>>>=3,re-=3}else{for(H=Ie+7;re>>=Ie)),ie>>>=7,re-=7}if(T.have+fe>T.nlen+T.ndist){L.msg="invalid bit length repeat",T.mode=30;break}for(;fe--;)T.lens[T.have++]=b}}if(T.mode===30)break;if(T.lens[256]===0){L.msg="invalid code -- missing end-of-block",T.mode=30;break}if(T.lenbits=9,J={bits:T.lenbits},oe=c(u,T.lens,0,T.nlen,T.lencode,0,T.work,J),T.lenbits=J.bits,oe){L.msg="invalid literal/lengths set",T.mode=30;break}if(T.distbits=6,T.distcode=T.distdyn,J={bits:T.distbits},oe=c(d,T.lens,T.nlen,T.ndist,T.distcode,0,T.work,J),T.distbits=J.bits,oe){L.msg="invalid distances set",T.mode=30;break}if(T.mode=20,k===6)break e;case 20:T.mode=21;case 21:if(6<=se&&258<=he){L.next_out=ee,L.avail_out=he,L.next_in=Q,L.avail_in=se,T.hold=ie,T.bits=re,l(L,le),ee=L.next_out,V=L.output,he=L.avail_out,Q=L.next_in,F=L.input,se=L.avail_in,ie=T.hold,re=T.bits,T.mode===12&&(T.back=-1);break}for(T.back=0;ze=(P=T.lencode[ie&(1<>>16&255,Be=65535&P,!((Ie=P>>>24)<=re);){if(se===0)break e;se--,ie+=F[Q++]<>it)])>>>16&255,Be=65535&P,!(it+(Ie=P>>>24)<=re);){if(se===0)break e;se--,ie+=F[Q++]<>>=it,re-=it,T.back+=it}if(ie>>>=Ie,re-=Ie,T.back+=Ie,T.length=Be,ze===0){T.mode=26;break}if(32&ze){T.back=-1,T.mode=12;break}if(64&ze){L.msg="invalid literal/length code",T.mode=30;break}T.extra=15&ze,T.mode=22;case 22:if(T.extra){for(H=T.extra;re>>=T.extra,re-=T.extra,T.back+=T.extra}T.was=T.length,T.mode=23;case 23:for(;ze=(P=T.distcode[ie&(1<>>16&255,Be=65535&P,!((Ie=P>>>24)<=re);){if(se===0)break e;se--,ie+=F[Q++]<>it)])>>>16&255,Be=65535&P,!(it+(Ie=P>>>24)<=re);){if(se===0)break e;se--,ie+=F[Q++]<>>=it,re-=it,T.back+=it}if(ie>>>=Ie,re-=Ie,T.back+=Ie,64&ze){L.msg="invalid distance code",T.mode=30;break}T.offset=Be,T.extra=15&ze,T.mode=24;case 24:if(T.extra){for(H=T.extra;re>>=T.extra,re-=T.extra,T.back+=T.extra}if(T.offset>T.dmax){L.msg="invalid distance too far back",T.mode=30;break}T.mode=25;case 25:if(he===0)break e;if(fe=le-he,T.offset>fe){if((fe=T.offset-fe)>T.whave&&T.sane){L.msg="invalid distance too far back",T.mode=30;break}Te=fe>T.wnext?(fe-=T.wnext,T.wsize-fe):T.wnext-fe,fe>T.length&&(fe=T.length),Ce=T.window}else Ce=V,Te=ee-T.offset,fe=T.length;for(heA?(w=Te[Ce+y[k]],re[be+y[k]]):(w=96,0),v=1<>ee)+(x-=v)]=R<<24|w<<16|M|0,x!==0;);for(v=1<>=1;if(v!==0?(ie&=v-1,ie+=v):ie=0,k++,--le[L]==0){if(L===F)break;L=d[h+y[k]]}if(V>>7)]}function be(P,U){P.pending_buf[P.pending++]=255&U,P.pending_buf[P.pending++]=U>>>8&255}function le(P,U,j){P.bi_valid>m-j?(P.bi_buf|=U<>m-P.bi_valid,P.bi_valid+=j-m):(P.bi_buf|=U<>>=1,j<<=1,0<--U;);return j>>>1}function Ce(P,U,j){var B,D,W=new Array(y+1),G=0;for(B=1;B<=y;B++)W[B]=G=G+j[B-1]<<1;for(D=0;D<=U;D++){var X=P[2*D+1];X!==0&&(P[2*D]=Te(W[X]++,X))}}function Ie(P){var U;for(U=0;U>1;1<=j;j--)it(P,W,j);for(D=ue;j=P.heap[1],P.heap[1]=P.heap[P.heap_len--],it(P,W,1),B=P.heap[1],P.heap[--P.heap_max]=j,P.heap[--P.heap_max]=B,W[2*D]=W[2*j]+W[2*B],P.depth[D]=(P.depth[j]>=P.depth[B]?P.depth[j]:P.depth[B])+1,W[2*j+1]=W[2*B+1]=D,P.heap[1]=D++,it(P,W,1),2<=P.heap_len;);P.heap[--P.heap_max]=P.heap[1],function(C,N){var q,Z,$,ae,ke,Le,Ve=N.dyn_tree,Je=N.max_code,st=N.stat_desc.static_tree,pe=N.stat_desc.has_stree,Ze=N.stat_desc.extra_bits,we=N.stat_desc.extra_base,De=N.stat_desc.max_length,Ke=0;for(ae=0;ae<=y;ae++)C.bl_count[ae]=0;for(Ve[2*C.heap[C.heap_max]+1]=0,q=C.heap_max+1;q>=7;D>>=1)if(1&z&&X.dyn_ltree[2*ue]!==0)return o;if(X.dyn_ltree[18]!==0||X.dyn_ltree[20]!==0||X.dyn_ltree[26]!==0)return a;for(ue=32;ue>>3,(W=P.static_len+3+7>>>3)<=D&&(D=W)):D=W=j+5,j+4<=D&&U!==-1?H(P,U,j,B):P.strategy===4||W===D?(le(P,2+(B?1:0),3),te(P,I,L)):(le(P,4+(B?1:0),3),function(X,ue,z,C){var N;for(le(X,ue-257,5),le(X,z-1,5),le(X,C-4,4),N=0;N>>8&255,P.pending_buf[P.d_buf+2*P.last_lit+1]=255&U,P.pending_buf[P.l_buf+P.last_lit]=255&j,P.last_lit++,U===0?P.dyn_ltree[2*j]++:(P.matches++,U--,P.dyn_ltree[2*(T[j]+d+1)]++,P.dyn_dtree[2*re(U)]++),P.last_lit===P.lit_bufsize-1},r._tr_align=function(P){le(P,2,3),fe(P,x,I),function(U){U.bi_valid===16?(be(U,U.bi_buf),U.bi_buf=0,U.bi_valid=0):8<=U.bi_valid&&(U.pending_buf[U.pending++]=255&U.bi_buf,U.bi_buf>>=8,U.bi_valid-=8)}(P)}},{"../utils/common":41}],53:[function(t,i,r){i.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,i,r){(function(s){(function(o,a){if(!o.setImmediate){var l,c,u,d,h=1,f={},p=!1,g=o.document,y=Object.getPrototypeOf&&Object.getPrototypeOf(o);y=y&&y.setTimeout?y:o,l={}.toString.call(o.process)==="[object process]"?function(_){process.nextTick(function(){v(_)})}:function(){if(o.postMessage&&!o.importScripts){var _=!0,S=o.onmessage;return o.onmessage=function(){_=!1},o.postMessage("","*"),o.onmessage=S,_}}()?(d="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",x,!1):o.attachEvent("onmessage",x),function(_){o.postMessage(d+_,"*")}):o.MessageChannel?((u=new MessageChannel).port1.onmessage=function(_){v(_.data)},function(_){u.port2.postMessage(_)}):g&&"onreadystatechange"in g.createElement("script")?(c=g.documentElement,function(_){var S=g.createElement("script");S.onreadystatechange=function(){v(_),S.onreadystatechange=null,c.removeChild(S),S=null},c.appendChild(S)}):function(_){setTimeout(v,0,_)},y.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var S=new Array(arguments.length-1),E=0;E"u"?s===void 0?this:s:self)}).call(this,typeof Bc<"u"?Bc:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}(u1)),u1.exports}var wq=Tq(),d1,kb;function Cq(){return kb||(kb=1,d1=function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}),d1}var sp={},Ub;function Eq(){if(Ub)return sp;Ub=1;var n=Object.prototype.hasOwnProperty,e;function t(o){try{return decodeURIComponent(o.replace(/\+/g," "))}catch(a){return null}}function i(o){try{return encodeURIComponent(o)}catch(a){return null}}function r(o){for(var a=/([^=?#&]+)=?([^&]*)/g,l={},c;c=a.exec(o);){var u=t(c[1]),d=t(c[2]);u===null||d===null||u in l||(l[u]=d)}return l}function s(o,a){a=a||"";var l=[],c,u;typeof a!="string"&&(a="?");for(u in o)if(n.call(o,u)){if(c=o[u],!c&&(c===null||c===e||isNaN(c))&&(c=""),u=i(u),c=i(c),u===null||c===null)continue;l.push(u+"="+c)}return l.length?a+l.join("&"):""}return sp.stringify=s,sp.parse=r,sp}var h1,zb;function Mq(){if(zb)return h1;zb=1;var n=Cq(),e=Eq(),t=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,i=/[\n\r\t]/g,r=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,s=/:\d+$/,o=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,a=/^[a-zA-Z]:/;function l(v){return(v||"").toString().replace(t,"")}var c=[["#","hash"],["?","query"],function(x,_){return h(_.protocol)?x.replace(/\\/g,"/"):x},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],u={hash:1,query:1};function d(v){var x;typeof window<"u"?x=window:typeof Bc<"u"?x=Bc:typeof self<"u"?x=self:x={};var _=x.location||{};v=v||_;var S={},E=typeof v,A;if(v.protocol==="blob:")S=new g(unescape(v.pathname),{});else if(E==="string"){S=new g(v,{});for(A in u)delete S[A]}else if(E==="object"){for(A in v)A in u||(S[A]=v[A]);S.slashes===void 0&&(S.slashes=r.test(v.href))}return S}function h(v){return v==="file:"||v==="ftp:"||v==="http:"||v==="https:"||v==="ws:"||v==="wss:"}function f(v,x){v=l(v),v=v.replace(i,""),x=x||{};var _=o.exec(v),S=_[1]?_[1].toLowerCase():"",E=!!_[2],A=!!_[3],R=0,w;return E?A?(w=_[2]+_[3]+_[4],R=_[2].length+_[3].length):(w=_[2]+_[4],R=_[2].length):A?(w=_[3]+_[4],R=_[3].length):w=_[4],S==="file:"?R>=2&&(w=w.slice(2)):h(S)?w=_[4]:S?E&&(w=w.slice(2)):R>=2&&h(x.protocol)&&(w=_[4]),{protocol:S,slashes:E||h(S),slashesCount:R,rest:w}}function p(v,x){if(v==="")return x;for(var _=(x||"/").split("/").slice(0,-1).concat(v.split("/")),S=_.length,E=_[S-1],A=!1,R=0;S--;)_[S]==="."?_.splice(S,1):_[S]===".."?(_.splice(S,1),R++):R&&(S===0&&(A=!0),_.splice(S,1),R--);return A&&_.unshift(""),(E==="."||E==="..")&&_.push(""),_.join("/")}function g(v,x,_){if(v=l(v),v=v.replace(i,""),!(this instanceof g))return new g(v,x,_);var S,E,A,R,w,M,I=c.slice(),L=typeof x,k=this,T=0;for(L!=="object"&&L!=="string"&&(_=x,x=null),_&&typeof _!="function"&&(_=e.parse),x=d(x),E=f(v||"",x),S=!E.protocol&&!E.slashes,k.slashes=E.slashes||S&&x.slashes,k.protocol=E.protocol||x.protocol||"",v=E.rest,(E.protocol==="file:"&&(E.slashesCount!==2||a.test(v))||!E.slashes&&(E.protocol||E.slashesCount<2||!h(k.protocol)))&&(I[3]=[/(.*)/,"pathname"]);T
'};t.configure=function(p){var g,y;for(g in p)y=p[g],y!==void 0&&p.hasOwnProperty(g)&&(i[g]=y);return this},t.status=null,t.set=function(p){var g=t.isStarted();p=r(p,i.minimum,1),t.status=p===1?null:p;var y=t.render(!g),m=y.querySelector(i.barSelector),v=i.speed,x=i.easing;return y.offsetWidth,a(function(_){i.positionUsing===""&&(i.positionUsing=t.getPositioningCSS()),l(m,o(p,v,x)),p===1?(l(y,{transition:"none",opacity:1}),y.offsetWidth,setTimeout(function(){l(y,{transition:"all "+v+"ms linear",opacity:0}),setTimeout(function(){t.remove(),_()},v)},v)):setTimeout(_,v)}),this},t.isStarted=function(){return typeof t.status=="number"},t.start=function(){t.status||t.set(0);var p=function(){setTimeout(function(){t.status&&(t.trickle(),p())},i.trickleSpeed)};return i.trickle&&p(),this},t.done=function(p){return!p&&!t.status?this:t.inc(.3+.5*Math.random()).set(1)},t.inc=function(p){var g=t.status;return g?(typeof p!="number"&&(p=(1-g)*r(Math.random()*g,.1,.95)),g=r(g+p,0,.994),t.set(g)):t.start()},t.trickle=function(){return t.inc(Math.random()*i.trickleRate)},function(){var p=0,g=0;t.promise=function(y){return!y||y.state()==="resolved"?this:(g===0&&t.start(),p++,g++,y.always(function(){g--,g===0?(p=0,t.done()):t.set((p-g)/p)}),this)}}(),t.render=function(p){if(t.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var g=document.createElement("div");g.id="nprogress",g.innerHTML=i.template;var y=g.querySelector(i.barSelector),m=p?"-100":s(t.status||0),v=document.querySelector(i.parent),x;return l(y,{transition:"all 0 linear",transform:"translate3d("+m+"%,0,0)"}),i.showSpinner||(x=g.querySelector(i.spinnerSelector),x&&f(x)),v!=document.body&&u(v,"nprogress-custom-parent"),v.appendChild(g),g},t.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(i.parent),"nprogress-custom-parent");var p=document.getElementById("nprogress");p&&f(p)},t.isRendered=function(){return!!document.getElementById("nprogress")},t.getPositioningCSS=function(){var p=document.body.style,g="WebkitTransform"in p?"Webkit":"MozTransform"in p?"Moz":"msTransform"in p?"ms":"OTransform"in p?"O":"";return g+"Perspective"in p?"translate3d":g+"Transform"in p?"translate":"margin"};function r(p,g,y){return py?y:p}function s(p){return(-1+p)*100}function o(p,g,y){var m;return i.positionUsing==="translate3d"?m={transform:"translate3d("+s(p)+"%,0,0)"}:i.positionUsing==="translate"?m={transform:"translate("+s(p)+"%,0)"}:m={"margin-left":s(p)+"%"},m.transition="all "+g+"ms "+y,m}var a=function(){var p=[];function g(){var y=p.shift();y&&y(g)}return function(y){p.push(y),p.length==1&&g()}}(),l=function(){var p=["Webkit","O","Moz","ms"],g={};function y(_){return _.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,function(S,E){return E.toUpperCase()})}function m(_){var S=document.body.style;if(_ in S)return _;for(var E=p.length,A=_.charAt(0).toUpperCase()+_.slice(1),R;E--;)if(R=p[E]+A,R in S)return R;return _}function v(_){return _=y(_),g[_]||(g[_]=m(_))}function x(_,S,E){S=v(S),_.style[S]=E}return function(_,S){var E=arguments,A,R;if(E.length==2)for(A in S)R=S[A],R!==void 0&&S.hasOwnProperty(A)&&x(_,A,R);else x(_,E[1],E[2])}}();function c(p,g){var y=typeof p=="string"?p:h(p);return y.indexOf(" "+g+" ")>=0}function u(p,g){var y=h(p),m=y+g;c(y,g)||(p.className=m.substring(1))}function d(p,g){var y=h(p),m;c(p,g)&&(m=y.replace(" "+g+" "," "),p.className=m.substring(1,m.length-1))}function h(p){return(" "+(p.className||"")+" ").replace(/\s+/gi," ")}function f(p){p&&p.parentNode&&p.parentNode.removeChild(p)}return t})}(Op)),Op.exports}var Lq=Pq(),f1=n6(Lq),bt;(function(n){n.Idle="Idle",n.Listening="Listening",n.Responding="Responding",n.Thinking="Thinking"})(bt||(bt={}));var Hb;(function(n){n.cpu="cpu",n.gpu="gpu"})(Hb||(Hb={}));var $b;(function(n){n.High="High",n.Low="Low",n.Standard="Standard"})($b||($b={}));var Gb;(function(n){n.GAUSSIAN_SPLATTING_3D="GAUSSIAN_SPLATTING_3D",n.REALTIME_AVATAR_3D="REALTIME_AVATAR_3D",n.REALTIME_AVATAR_LIVE2D="REALTIME_AVATAR_LIVE2D",n.REALTIME_AVATAR_MOBILE2D="REALTIME_AVATAR_MOBILE2D"})(Gb||(Gb={}));var Wb;(function(n){n.Idle="idle",n.Listening="listen",n.Responding="speak",n.Thinking="think"})(Wb||(Wb={}));class je{static SetWeight(e,t){e.enabled=!0,e.setEffectiveTimeScale(1),e.setEffectiveWeight(t)}static PrepareCrossFade(e,t,i){const r=i;je.UnPauseAllActions(),je.ExecuteCrossFade(e,t,r),je.IsBlending=!0,setTimeout(()=>{je.IsBlending=!1},i+.1)}static PauseAllActions(){je.actions.forEach(function(e){e.paused=!0})}static UnPauseAllActions(){je.actions.forEach(function(e){e.paused=!1})}static ExecuteCrossFade(e,t,i){je.SetWeight(t,1),t.time=0,e.crossFadeTo(t,i,!0)}constructor(e,t,i){const r=[],s=[],o=[],a=[],l=[];this.mixer=e;const c=i.hello.size,u=i.idle.size+c,d=i.listen.size+u,h=i.speak.size+d,f=i.think.size+h;for(let p=0;pthis.actions[this.stage].getClip().duration-this.blendingTime){let t=this.stage+1;t>=this.actions.length&&(t=0),this.actions[t].time=0,je.SetWeight(this.actions[t],1),this.actions[t].loop=zl,this.actions[t].play(),je.PrepareCrossFade(this.actions[this.stage],this.actions[t],this.blendingTime),this.stage=t}}}class Fq extends rf{constructor(e,t){super(e,t)}update(e){je.CurPlaying==null&&e==bt.Idle&&this.isPlaying==!1&&(this.stage=0,this.actions[this.stage].time=0,je.SetWeight(this.actions[this.stage],1),this.actions[this.stage].loop=zl,this.actions[this.stage].clampWhenFinished=!1,this.actions[this.stage].paused=!1,this.actions[this.stage].play(),je.LastAction!=null&&je.PrepareCrossFade(je.LastAction,this.actions[this.stage],this.blendingTime),this.isPlaying=!0),je.CurPlaying==bt.Idle&&e!=bt.Idle&&this.isPlaying==!0&&this.stage==0&&(this.actions[this.stage].loop=Jr,this.actions[this.stage].clampWhenFinished=!0,this.isPlaying=!1,je.LastAction=this.actions[this.stage])}}class Oq extends rf{constructor(e,t){super(e,t)}update(e){je.CurPlaying==null&&e==bt.Listening&&this.isPlaying==!1&&(this.stage=0,this.actions[this.stage].time=0,this.actions[this.stage].play(),je.SetWeight(this.actions[this.stage],1),this.actions[this.stage].loop=this.isGroup?Jr:zl,this.actions[this.stage].clampWhenFinished=!!this.isGroup,je.LastAction!=null&&je.PrepareCrossFade(je.LastAction,this.actions[this.stage],this.blendingTime),this.isPlaying=!0),this.isGroup&&(je.CurPlaying==bt.Listening&&e==bt.Listening&&this.isPlaying==!0&&this.stage==0&&this.actions[this.stage].time>this.actions[this.stage].getClip().duration-this.blendingTime&&(this.actions[this.stage+1].time=0,je.SetWeight(this.actions[this.stage+1],1),this.actions[this.stage+1].loop=zl,this.actions[this.stage+1].play(),je.PrepareCrossFade(this.actions[this.stage],this.actions[this.stage+1],this.blendingTime),this.stage=1),je.CurPlaying==bt.Listening&&e!=bt.Listening&&this.isPlaying==!0&&(this.stage==0||this.stage==1)&&(this.actions[2].time=0,this.actions[2].play(),je.SetWeight(this.actions[2],1),this.actions[2].loop=Jr,je.PrepareCrossFade(this.actions[this.stage],this.actions[2],this.blendingTime),this.stage=2)),je.CurPlaying==bt.Listening&&e!=bt.Listening&&this.isPlaying==!0&&this.stage==(this.isGroup?this.actions.length-1:0)&&(this.actions[this.stage].loop=Jr,this.actions[this.stage].clampWhenFinished=!0,this.isPlaying=!1,je.LastAction=this.actions[this.stage])}}class Bq extends rf{constructor(e,t){super(e,t)}update(e){je.CurPlaying==null&&e==bt.Thinking&&this.isPlaying==!1&&(this.stage=0,this.actions[this.stage].time=0,this.actions[this.stage].play(),je.SetWeight(this.actions[this.stage],1),this.actions[this.stage].loop=Jr,je.LastAction!=null&&je.PrepareCrossFade(je.LastAction,this.actions[this.stage],this.blendingTime),this.isPlaying=!0),this.isGroup&&(je.CurPlaying==bt.Thinking&&e==bt.Thinking&&this.isPlaying==!0&&this.stage==0&&this.actions[this.stage].time>this.actions[this.stage].getClip().duration-this.blendingTime&&(this.actions[this.stage+1].time=0,this.actions[this.stage+1].play(),je.SetWeight(this.actions[this.stage+1],1),this.actions[this.stage+1].loop=zl,je.PrepareCrossFade(this.actions[this.stage],this.actions[this.stage+1],this.blendingTime),this.stage=1),je.CurPlaying==bt.Thinking&&e!=bt.Thinking&&this.isPlaying==!0&&(this.stage==0||this.stage==1)&&(this.actions[2].time=0,this.actions[2].play(),je.SetWeight(this.actions[2],1),this.actions[2].loop=Jr,je.PrepareCrossFade(this.actions[this.stage],this.actions[2],this.blendingTime),this.stage=2)),je.CurPlaying==bt.Thinking&&e!=bt.Thinking&&this.isPlaying==!0&&this.stage==(this.isGroup?this.actions.length-1:0)&&(this.actions[this.stage].loop=Jr,this.actions[this.stage].clampWhenFinished=!0,this.actions[this.stage].time>this.actions[this.stage].getClip().duration-.3&&(this.isPlaying=!1,je.LastAction=this.actions[this.stage]))}}class kq extends rf{constructor(e,t){super(e,t)}getRandonNumber(e,t){const i=e-t;return t+Math.round(Math.random()*i)}update(e){if(je.CurPlaying==null&&e==bt.Responding&&this.isPlaying==!1&&(this.stage=Math.ceil(this.getRandonNumber(0,this.actions.length-1)),this.actions[this.stage].time=0,this.actions[this.stage].play(),je.SetWeight(this.actions[this.stage],1),this.actions[this.stage].loop=Jr,this.actions[this.stage].clampWhenFinished=!0,je.LastAction!=null&&je.PrepareCrossFade(je.LastAction,this.actions[this.stage],this.blendingTime),this.isPlaying=!0),je.CurPlaying==bt.Responding&&e==bt.Responding&&this.isPlaying==!0&&this.actions[this.stage].time>=this.actions[this.stage].getClip().duration-this.blendingTime){const t=this.actions[this.stage];this.stage=(this.stage+Math.ceil(this.getRandonNumber(1,this.actions.length-1)))%this.actions.length,this.actions[this.stage].time=0,this.actions[this.stage].play(),je.SetWeight(this.actions[this.stage],1),this.actions[this.stage].loop=Jr,this.actions[this.stage].clampWhenFinished=!0,je.PrepareCrossFade(t,this.actions[this.stage],this.blendingTime)}je.CurPlaying==bt.Responding&&e!=bt.Responding&&this.isPlaying==!0&&(this.actions[this.stage].loop=Jr,this.actions[this.stage].clampWhenFinished=!0,this.isPlaying=!1,je.LastAction=this.actions[this.stage])}}function Qb(n,e){if(e===iP)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),n;if(e===Py||e===S5){let t=n.getIndex();if(t===null){const o=[],a=n.getAttribute("position");if(a!==void 0){for(let l=0;l=2.0 are supported."));return}const c=new vX(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[d]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+d+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(i,r)}parseAsync(e,t){const i=this;return new Promise(function(r,s){i.parse(e,t,r,s)})}}function zq(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Pt={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Vq{constructor(e){this.parser=e,this.name=Pt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,r=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class tX{constructor(e){this.parser=e,this.name=Pt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class nX{constructor(e){this.parser=e,this.name=Pt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,r=i.json,s=r.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=r.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class iX{constructor(e){this.name=Pt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const r=i.extensions[this.name],s=this.parser.getDependency("buffer",r.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=r.byteOffset||0,c=r.byteLength||0,u=r.count,d=r.byteStride,h=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(u,d,h,r.mode,r.filter).then(function(f){return f.buffer}):o.ready.then(function(){const f=new ArrayBuffer(u*d);return o.decodeGltfBuffer(new Uint8Array(f),u,d,h,r.mode,r.filter),f})})}else return null}}class rX{constructor(e){this.name=Pt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const r=t.meshes[i.mesh];for(const c of r.primitives)if(c.mode!==$r.TRIANGLES&&c.mode!==$r.TRIANGLE_STRIP&&c.mode!==$r.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=i.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(u=>(l[c]=u,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const u=c.pop(),d=u.isGroup?u.children:[u],h=c[0].count,f=[];for(const p of d){const g=new Xe,y=new Y,m=new Qt,v=new Y(1,1,1),x=new cL(p.geometry,p.material,h);for(let _=0;_0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":n.search(/\.ktx2($|\?)/i)>0||n.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const yX=new Xe;class vX{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new zq,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,r=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);r=i&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&r<17||s&&o<98?this.textureLoader=new ML(this.options.manager):this.textureLoader=new OL(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new z5(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,r=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][r.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:r.asset,parser:i,userData:{}};return ll(s,a,r),To(a,r),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let r=0,s=t.length;r{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,u]of o.children.entries())s(u,a.children[c])};return s(i,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&y.setY(w,E[A*l+1]),l>=3&&y.setZ(w,E[A*l+2]),l>=4&&y.setW(w,E[A*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}y.normalized=p}return y})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,i){const r=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,i).then(function(u){u.flipY=!1,u.name=o.name||a.name||"",u.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(u.name=a.uri);const h=(s.samplers||{})[o.sampler]||{};return u.magFilter=qb[h.magFilter]||Rr,u.minFilter=qb[h.minFilter]||Hs,u.wrapS=Xb[h.wrapS]||cu,u.wrapT=Xb[h.wrapT]||cu,u.generateMipmaps=!u.isCompressedTexture&&u.minFilter!==_i&&u.minFilter!==Rr,r.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this,r=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(d=>d.clone());const o=r.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(d){c=!0;const h=new Blob([d],{type:o.mimeType});return l=a.createObjectURL(h),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(d){return new Promise(function(h,f){let p=h;t.isImageBitmapLoader===!0&&(p=function(g){const y=new Wn(g);y.needsUpdate=!0,h(y)}),t.load(kd.resolveURL(d,s.path),p,void 0,f)})}).then(function(d){return c===!0&&a.revokeObjectURL(l),To(d,o),d.userData.mimeType=o.mimeType||gX(o.uri),d}).catch(function(d){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),d});return this.sourceCache[e]=u,u}assignTexture(e,t,i,r){const s=this;return this.getDependency("texture",i.index).then(function(o){if(!o)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(o=o.clone(),o.channel=i.texCoord),s.extensions[Pt.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[Pt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Pt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return r!==void 0&&(o.colorSpace=r),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const r=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new F5,es.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new D5,es.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,this.cache.add(a,l)),i=l}if(r||s||o){let a="ClonedMaterial:"+i.uuid+":";r&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),r&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}e.material=i}getMaterialType(){return T_}loadMaterial(e){const t=this,i=this.json,r=this.extensions,s=i.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[Pt.KHR_MATERIALS_UNLIT]){const d=r[Pt.KHR_MATERIALS_UNLIT];o=d.getMaterialType(),c.push(d.extendParams(a,s,t))}else{const d=s.pbrMetallicRoughness||{};if(a.color=new gt(1,1,1),a.opacity=1,Array.isArray(d.baseColorFactor)){const h=d.baseColorFactor;a.color.setRGB(h[0],h[1],h[2],Bi),a.opacity=h[3]}d.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",d.baseColorTexture,fi)),a.metalness=d.metallicFactor!==void 0?d.metallicFactor:1,a.roughness=d.roughnessFactor!==void 0?d.roughnessFactor:1,d.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",d.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",d.metallicRoughnessTexture))),o=this._invokeOne(function(h){return h.getMaterialType&&h.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(h){return h.extendMaterialParams&&h.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=Cr);const u=s.alphaMode||m1.OPAQUE;if(u===m1.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===m1.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Yr&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new qe(1,1),s.normalTexture.scale!==void 0)){const d=s.normalTexture.scale;a.normalScale.set(d,d)}if(s.occlusionTexture!==void 0&&o!==Yr&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Yr){const d=s.emissiveFactor;a.emissive=new gt().setRGB(d[0],d[1],d[2],Bi)}return s.emissiveTexture!==void 0&&o!==Yr&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,fi)),Promise.all(c).then(function(){const d=new o(a);return s.name&&(d.name=s.name),To(d,s),t.associations.set(d,{materials:e}),s.extensions&&ll(r,d,s),d})}createUniqueName(e){const t=en.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,r=this.primitiveCache;function s(a){return i[Pt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return Kb(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&pX(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),To(m,s),y.extensions&&ll(r,m,y),t.assignFinalMaterial(m),d.push(m)}for(let f=0,p=d.length;f1?u=new xl:c.length===1?u=c[0]:u=new nn,u!==c[0])for(let d=0,h=c.length;d{const d=new Map;for(const[h,f]of r.associations)(h instanceof es||h instanceof Wn)&&d.set(h,f);return u.traverse(h=>{const f=r.associations.get(h);f!=null&&d.set(h,f)}),d};return r.associations=c(s),s})}_createAnimationTracks(e,t,i,r,s){const o=[],a=e.name?e.name:e.uuid,l=[];da[s.path]===da.weights?e.traverse(function(h){h.morphTargetInfluences&&l.push(h.name?h.name:h.uuid)}):l.push(a);let c;switch(da[s.path]){case da.weights:c=mu;break;case da.rotation:c=gu;break;case da.position:case da.scale:c=yu;break;default:switch(i.itemSize){case 1:c=mu;break;case 2:case 3:default:c=yu;break}break}const u=r.interpolation!==void 0?dX[r.interpolation]:lh,d=this._getArrayFromAccessor(i);for(let h=0,f=l.length;h{if(A.lengthComputable&&A&&A.total){const R=A.loaded/A.total;f1.set(R),i!=null&&i.downloadProgress&&(i==null||i.downloadProgress(R))}}});i!=null&&i.loadProgress&&(i==null||i.loadProgress(.1)),f1.done(),console.log("download completed:",p.data);const g=p.data,y=yield wq.loadAsync(g);let m="";if(Object.values(y.files).forEach(A=>{var R,w;A.dir&&(m=(R=A.name)===null||R===void 0?void 0:R.slice(0,((w=A.name)===null||w===void 0?void 0:w.length)-1))}),!m)throw new Error("file fold is not found");const v=new Os(e,y),x=new Y;x.x=((r=Ns.camPos)===null||r===void 0?void 0:r.x)||0,x.y=((s=Ns.camPos)===null||s===void 0?void 0:s.y)||0,x.z=((o=Ns.camPos)===null||o===void 0?void 0:o.z)||1;const _=new Y;_.x=((a=Ns.camRot)===null||a===void 0?void 0:a.x)||0,_.y=((l=Ns.camRot)===null||l===void 0?void 0:l.y)||0,_.z=((c=Ns.camRot)===null||c===void 0?void 0:c.z)||0;let S=16777215;Ns.backgroundColor&&(S=parseInt(Ns.backgroundColor,16)),i&&i.backgroundColor&&v.isHexColorStrict(i.backgroundColor)&&(S=parseInt(i.backgroundColor,16)),v.getChatState=i==null?void 0:i.getChatState,v.getExpressionData=i==null?void 0:i.getExpressionData,Ns.useFlame&&(v.useFlame=Ns.useFlame!="false"),console.log(x,S),v.viewer=new nv({rootElement:e,threejsCanvas:Os._canvas,cameraUp:[0,1,0],initialCameraPosition:[x.x,x.y,x.z],initialCameraRotation:[_.x,_.y,_.z],sphericalHarmonicsDegree:0,backgroundColor:S}),v.viewer.useFlame=v.useFlame,v.viewer.useFlame==!0?yield v.loadFlameModel(m,Yb):yield v.loadModel(m,MX,Yb),i!=null&&i.loadProgress&&(i==null||i.loadProgress(.2));const E=yield v.unpackFileAsBlob(m+"/offset.ply");return i!=null&&i.loadProgress&&(i==null||i.loadProgress(.3)),v.viewer.addSplatScene(E,{progressiveLoad:!0,sharedMemoryForWorkers:!1,showLoadingUI:!1,format:zs.Ply}).then(()=>{v.render(),i!=null&&i.loadProgress&&(i==null||i.loadProgress(1))}),v}catch(u){console.error(u)}})}constructor(e,t){this.zipUrls={urls:new Map},this.useFlame=!1,this.lastTime=0,this.startTime=0,this.expressionData={},this.chatState=bt.Idle,Object.assign(this.zipUrls,{zip:t});const{width:i,height:r}=e.getBoundingClientRect();Os._canvas.style.visibility="visible",Os._canvas.width=i,Os._canvas.height=r,e.appendChild(Os._canvas),this.clock=new kL,this.startTime=performance.now()/1e3}dispose(){Os._canvas.style.visibility="hidden",this.disposeModel(),this.zipUrls.urls.forEach(e=>{URL.revokeObjectURL(e)})}disposeModel(){var e,t;this.mixer&&(this.mixer.stopAllAction(),this.viewer&&this.viewer.avatarMesh&&this.mixer.uncacheRoot(this.viewer.avatarMesh),this.mixer=void 0,(e=this.animManager)===null||e===void 0||e.dispose()),(t=this.viewer)===null||t===void 0||t.dispose()}getCamera(){var e;return(e=this.viewer)===null||e===void 0?void 0:e.camera}updateBS(e){let t={browDownLeft:0,browDownRight:0,browInnerUp:0,browOuterUpLeft:0,browOuterUpRight:0,mouthCheekPuff:0,cheekSquintLeft:0,cheekSquintRight:0,eyeBlinkLeft:0,eyeBlinkRight:0,eyeLookDownLeft:0,eyeLookDownRight:0,eyeLookInLeft:0,eyeLookInRight:0,eyeLookOutLeft:0,eyeLookOutRight:0,eyeLookUpLeft:0,eyeLookUpRight:0,eyeSquintLeft:0,eyeSquintRight:0,eyeWideLeft:0,eyeWideRight:0,jawForward:0,jawLeft:0,jawOpen:0,jawRight:0,mouthClose:0,mouthDimpleLeft:0,mouthDimpleRight:0,mouthFrownLeft:0,mouthFrownRight:0,mouthFunnel:0,mouthLeft:0,mouthLowerDownLeft:0,mouthLowerDownRight:0,mouthPressLeft:0,mouthPressRight:0,mouthPucker:0,mouthRight:0,mouthRollLower:0,mouthRollUpper:0,mouthShrugLower:0,mouthShrugUpper:0,mouthSmileLeft:0,mouthSmileRight:0,mouthStretchLeft:0,mouthStretchRight:0,mouthUpperUpLeft:0,mouthUpperUpRight:0,noseSneerLeft:0,noseSneerRight:0,tongueOut:0};return e!=null&&(t=e),t}render(){var e;if(this.viewer&&this.viewer.selfDrivenMode){if(this.viewer.webXRMode)this.viewer.renderer.setAnimationLoop(this.viewer.selfDrivenUpdateFunc);else{this.viewer.requestFrameId=requestAnimationFrame(()=>this.render());const t=1/30,r=(performance.now()/1e3-this.startTime)%(this.viewer.totalFrames*t),s=Math.floor(r/t);if(this.viewer.frame=s,this.getChatState&&(this.chatState=this.getChatState(),(e=this.animManager)===null||e===void 0||e.update(this.chatState)),this.getExpressionData&&(this.expressionData=this.updateBS(this.getExpressionData())),this.viewer.useFlame==!1){if(!this.mixer||!this.animManager)return;const o=this.clock.getDelta();if(this.mixer.update(o),this.motioncfg)for(const a in this.expressionData){const l=this.motioncfg.offset[a],c=this.motioncfg.scale[a];l!==void 0&&c!==void 0&&(this.expressionData[a]=this.expressionData[a]*c+l)}this.setExpression()}this.viewer.update(this.viewer.renderer,this.viewer.camera),this.viewer.shouldRender()?(this.viewer.render(),this.viewer.consecutiveRenderFrames++):this.viewer.consecutiveRenderFrames=0,this.viewer.renderNextFrame=!1}this.viewer.selfDrivenModeRunning=!0}else throw new Error("Cannot start viewer unless it is in self driven mode.")}isHexColorStrict(e){return typeof e!="string"?!1:/^(#|0x)[0-9A-Fa-f]{6}$/i.test(e)}setExpression(){this.viewer&&this.viewer.splatMesh&&(this.viewer.splatMesh.bsWeight=this.expressionData),this.model&&this.model.traverse(e=>{if(e.isMesh||e.isSkinnedMesh){const t=e.geometry.morphAttributes;if(Object.keys(t).length>0===!0){const r=e.morphTargetDictionary;for(const s in r){const o=r[s],a=this.expressionData[s];a!==void 0&&(e.morphTargetInfluences[o]=Math.max(0,Math.min(1,a)))}}}})}loadFlameModel(e,t){return al(this,void 0,void 0,function*(){const[i,r,s,o,a]=yield Promise.all([this.unpackAndLoadGlb(e+"/skin.glb"),this.unpackAndLoadJson(e+"/lbs_weight_20k.json"),this.unpackAndLoadJson(e+"/flame_params.json"),this.unpackAndLoadJson(e+"/vertex_order.json"),this.unpackAndLoadJson(e+"/bone_tree.json")]);if(!this.viewer)throw new Error("render viewer is not initialized");let l,c;i.traverse(u=>{u.isSkinnedMesh&&(l=u),u instanceof dh&&u.name=="hip"&&(c=u)}),this.viewer.sortedIndexes=o,this.viewer.flame_params=s,this.viewer.lbs_weight_80k=r,this.viewer.bone_tree=a,this.viewer.totalFrames=s.expr.length,l!=null&&(this.viewer.gaussianSplatCount=l.geometry.attributes.position.count),this.viewer.avatarMesh=i,this.viewer.skinModel=l,this.viewer.boneRoot=c,this.motioncfg=t,l!=null&&this.viewer.updateMorphTarget(l),this.viewer.threeScene.add(i),i.visible=!1,l!=null&&l.skeleton.computeBoneTexture()})}loadModel(e,t,i){return al(this,void 0,void 0,function*(){const[r,s,o]=yield Promise.all([this.unpackAndLoadGlb(e+"/skin.glb"),this.unpackAndLoadGlb(e+"/animation.glb"),this.unpackAndLoadJson(e+"/vertex_order.json")]);if(!this.viewer)throw new Error("render viewer is not initialized");let a,l;r.traverse(c=>{c.isSkinnedMesh&&(a=c),c instanceof dh&&c.name=="hip"&&(l=c)}),this.viewer.sortedIndexes=o,a!=null&&(this.viewer.gaussianSplatCount=a.geometry.attributes.position.count),this.viewer.avatarMesh=r,this.viewer.skinModel=a,this.viewer.boneRoot=l,this.mixer=new YL(r),this.animManager=new je(this.mixer,s,t),this.motioncfg=i,a!=null&&this.viewer.updateMorphTarget(a),this.viewer.threeScene.add(r),r.visible=!1,a!=null&&a.skeleton.computeBoneTexture()})}unpackFileAsBlob(e){var t,i;return al(this,void 0,void 0,function*(){if(!this.zipUrls.urls.has(e)){const r=yield(i=(t=this.zipUrls.zip)===null||t===void 0?void 0:t.file(e))===null||i===void 0?void 0:i.async("blob"),s=URL.createObjectURL(r);this.zipUrls.urls.set(e,s)}return this.zipUrls.urls.get(e)})}unpackAndLoadGlb(e){var t,i;return al(this,void 0,void 0,function*(){if(!this.zipUrls.urls.has(e)){const r=yield(i=(t=this.zipUrls.zip)===null||t===void 0?void 0:t.file(e))===null||i===void 0?void 0:i.async("arraybuffer"),s=new Blob([r],{type:"model/gltf-binary"}),o=URL.createObjectURL(s);this.zipUrls.urls.set(e,o)}return this.LoadGLTF(this.zipUrls.urls.get(e))})}unpackAndLoadJson(e){var t,i;return al(this,void 0,void 0,function*(){const r=yield(i=(t=this.zipUrls.zip)===null||t===void 0?void 0:t.file(e))===null||i===void 0?void 0:i.async("string");return JSON.parse(r)})}LoadGLTF(e){return al(this,void 0,void 0,function*(){return new Promise((t,i)=>{new Uq(void 0).load(e,s=>{s.animations.length>0?t(s.animations):t(s.scene)},void 0,s=>{i(s)})})})}}Os._canvas=document.createElement("canvas");class OX extends o_{constructor(t){const{container:i,assetsPath:r,ws:s,downloadProgress:o,loadProgress:a}=t;super();xe(this,"_avatarDivEle");xe(this,"_assetsPath","");xe(this,"_ws");xe(this,"_downloadProgress");xe(this,"_loadProgress");xe(this,"_loadPercent",0);xe(this,"_downloadPercent",0);xe(this,"_processor");xe(this,"_renderer");xe(this,"_audioMute",!1);xe(this,"curState",ma.Idle);this._avatarDivEle=i,this._assetsPath=r,this._ws=s,o?this._downloadProgress=l=>{this._downloadPercent=l,o(l)}:this._downloadProgress=l=>{this._downloadPercent=l},a?this._loadProgress=l=>{this._loadPercent=l,a(l)}:this._loadProgress=l=>{this._loadPercent=l},this._init()}_init(){if(!this._avatarDivEle||!this._assetsPath||!this._ws)throw new Error("Lack of necessary initialization parameters for gaussian render");this._processor=new xN(this),this._bindEventTypes()}start(){this.getData(),this.render()}async getData(){this._ws.on(Kr.WS_MESSAGE,t=>{this._downloadPercent<1||this._loadPercent<1||(this.emit(xr.MessageReceived,this.curState),this._processor.add({avatar_motion_data:{first_package:!0,segment_num:1,binary_size:t.size,use_binary_frame:!1}}),this._processor.add({avatar_motion_data:{first_package:!1,motion_data_slice:t,is_audio_mute:this._audioMute}}))})}async render(){this._renderer=await Os.getInstance(this._avatarDivEle,this._assetsPath,{getChatState:this.getChatState.bind(this),getExpressionData:this.getArkitFaceFrame.bind(this),downloadProgress:this._downloadProgress.bind(this),loadProgress:this._loadProgress.bind(this)})}setAvatarMute(t){this._processor.setMute(t),this._audioMute=t}getChatState(){return this.curState}getArkitFaceFrame(){var t;return(t=this._processor)==null?void 0:t.getArkitFaceFrame().arkitFace}interrupt(){var t;this._ws.send("%interrupt%"),(t=this._processor)==null||t.interrupt(),this.curState=ma.Idle,this.emit(xr.StateChanged,this.curState)}sendSpeech(t){var i;this._ws.send(t),this.curState=ma.Listening,this.emit(xr.StateChanged,this.curState),(i=this._processor)==null||i.clear()}exit(){var t,i;(t=this._renderer)==null||t.dispose(),this.curState=ma.Idle,this._downloadPercent=0,this._loadPercent=0,(i=this._processor)==null||i.clear(),this.removeAllListeners()}_bindEventTypes(){this.on(Bl.Player_StartSpeaking,t=>{console.log("startSpeach"),this.curState=ma.Responding,this.emit(xr.StateChanged,this.curState),this._ws.send(JSON.stringify({header:{name:xr.StartSpeech},payload:{}}))}),this.on(Bl.Player_EndSpeaking,t=>{console.log("endSpeach"),this.curState=ma.Idle,this.emit(xr.StateChanged,this.curState),this._ws.send(JSON.stringify({header:{name:xr.EndSpeech},payload:{}}))}),this.on(xr.ErrorReceived,t=>{console.log("ErrorReceived",t),this.curState=ma.Idle,this.emit(xr.StateChanged,this.curState),this._ws.send(JSON.stringify({header:{name:xr.ErrorReceived},payload:{...t}}))}),this._ws.on(Kr.WS_CLOSE,()=>{this.exit()})}}function y1(){return navigator.mediaDevices.enumerateDevices()}async function BX(n,e,t){const i=(t==null?void 0:t.video)||t||{width:{ideal:500},height:{ideal:500}},r=(t==null?void 0:t.audio)||t||{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0},s={video:typeof e=="object"?{...e,...i}:e,audio:typeof n=="object"?{...n,...r}:n};return console.log(s,"constraints"),navigator.mediaDevices.getUserMedia(s).then(o=>(console.log(o),o))}function Zb(n,e="videoinput"){return n.filter(i=>i.kind===e)}let cl=null,_o=null;function kX(n=1,e=1){const t=document.createElement("canvas");document.body.appendChild(t),t.width=n||500,t.height=e||500,t.style.width="1px",t.style.height="1px",t.style.position="fixed",t.style.visibility="hidden";const i=t.getContext("2d");i.fillStyle="hsl(0,0, 0, 1)",i.fillRect(0,0,t.width,t.height);function r(){i.fillStyle="rgb(255, 255, 255)",i.fillRect(0,0,t.width,t.height),requestAnimationFrame(r)}return r(),cl=t.captureStream(30).getVideoTracks()[0],cl.stop=()=>{t.remove()},cl.onended=()=>{cl==null||cl.stop()},cl}function UX(){if(_o)return _o;const n=new(window.AudioContext||window.webkitAudioContext),e=n.createOscillator();e.frequency.setValueAtTime(0,n.currentTime);const t=n.createGain();t.gain.setValueAtTime(0,n.currentTime);const i=n.createMediaStreamDestination();return e.connect(t),t.connect(i),e.start(),_o=i.stream.getAudioTracks()[0],_o.stop=()=>{n.close()},_o.onended=()=>{_o==null||_o.stop()},_o}function Jb(n){console.debug("Stopping peer connection"),n.getTransceivers&&n.getTransceivers().forEach(e=>{e.stop&&e.stop()}),n.getSenders()&&n.getSenders().forEach(e=>{console.log("sender",e),e.track&&e.track.stop&&e.track.stop()}),setTimeout(()=>{n.close()},500)}async function zX(n,e,t){n.getTracks().forEach(async l=>{e.addTrack(l,n)}),e.addEventListener("track",l=>{t&&t.srcObject!==l.streams[0]&&(t.srcObject=l.streams[0])});const i=e.createDataChannel("text"),r=await e.createOffer();await e.setLocalDescription(r);const s=Math.random().toString(36).substring(7);e.onicecandidate=({candidate:l})=>{l&&(console.debug("Sending ICE candidate",l),fetch("/webrtc/offer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({candidate:l.toJSON(),webrtc_id:s,type:"ice-candidate"})}))};const a=await(await fetch("/webrtc/offer",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sdp:r.sdp,type:r.type,webrtc_id:s})})).json();return await e.setRemoteDescription(a),[i,s]}function _h(n){"@babel/helpers - typeof";return _h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_h(n)}function VX(n,e){if(_h(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e);if(_h(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function HX(n){var e=VX(n,"string");return _h(e)=="symbol"?e:e+""}function $X(n,e,t){return(e=HX(e))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function e3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable})),t.push.apply(t,i)}return t}function yi(n){for(var e=1;etypeof n=="string",QX=n=>n!==null&&typeof n=="object";function kc(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return typeof n=="function"?n(e):n!=null?n:t}function jX(n){let e;const t=new Promise(r=>{e=n(()=>{r(!0)})}),i=()=>{e==null||e()};return i.then=(r,s)=>t.then(r,s),i.promise=t,i}function kr(){const n=[];for(let e=0;e0&&arguments[0]!==void 0?arguments[0]:[];const e=[];return n.forEach(t=>{Array.isArray(t)?e.push(...t):(t==null?void 0:t.type)===Hn?e.push(...s6(t.children)):e.push(t)}),e.filter(t=>!qX(t))}const XX=function(){for(var n=arguments.length,e=new Array(n),t=0;t{const e=n;return e.install=function(t){t.component(e.displayName||e.name,n)},n};function Sr(n){return{type:Object,default:n}}function v1(n){return{type:Boolean,default:n}}function dv(n,e){const t={validator:()=>!0,default:n};return t}function t3(n){return{type:Array,default:n}}function n3(n){return{type:String,default:n}}function KX(n,e){return n?{type:n,default:e}:dv(e)}const Bx="anticon",YX=Symbol("GlobalFormContextKey"),ZX=n=>{ta(YX,n)},JX=()=>({iconPrefixCls:String,getTargetContainer:{type:Function},getPopupContainer:{type:Function},prefixCls:String,getPrefixCls:{type:Function},renderEmpty:{type:Function},transformCellText:{type:Function},csp:Sr(),input:Sr(),autoInsertSpaceInButton:{type:Boolean,default:void 0},locale:Sr(),pageHeader:Sr(),componentSize:{type:String},componentDisabled:{type:Boolean,default:void 0},direction:{type:String,default:"ltr"},space:Sr(),virtual:{type:Boolean,default:void 0},dropdownMatchSelectWidth:{type:[Number,Boolean],default:!0},form:Sr(),pagination:Sr(),theme:Sr(),select:Sr(),wave:Sr()}),kx=Symbol("configProvider"),o6={getPrefixCls:(n,e)=>e||(n?"ant-".concat(n):"ant"),iconPrefixCls:Ge(()=>Bx),getPopupContainer:Ge(()=>()=>document.body),direction:Ge(()=>"ltr")},a6=()=>Ji(kx,o6),eK=n=>ta(kx,n),l6=Symbol("DisabledContextKey"),c6=()=>Ji(l6,Dn(void 0)),tK=n=>{const e=c6();return ta(l6,Ge(()=>{var t;return(t=n.value)!==null&&t!==void 0?t:e.value})),n},nK={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages"},iK={locale:"en_US",today:"Today",now:"Now",backToToday:"Back to today",ok:"Ok",clear:"Clear",month:"Month",year:"Year",timeSelect:"select time",dateSelect:"select date",weekSelect:"Choose a week",monthSelect:"Choose a month",yearSelect:"Choose a year",decadeSelect:"Choose a decade",yearFormat:"YYYY",dateFormat:"M/D/YYYY",dayFormat:"D",dateTimeFormat:"M/D/YYYY HH:mm:ss",monthBeforeYear:!0,previousMonth:"Previous month (PageUp)",nextMonth:"Next month (PageDown)",previousYear:"Last year (Control + left)",nextYear:"Next year (Control + right)",previousDecade:"Last decade",nextDecade:"Next decade",previousCentury:"Last century",nextCentury:"Next century"},u6={placeholder:"Select time",rangePlaceholder:["Start time","End time"]},i3={lang:Ue({placeholder:"Select date",yearPlaceholder:"Select year",quarterPlaceholder:"Select quarter",monthPlaceholder:"Select month",weekPlaceholder:"Select week",rangePlaceholder:["Start date","End date"],rangeYearPlaceholder:["Start year","End year"],rangeQuarterPlaceholder:["Start quarter","End quarter"],rangeMonthPlaceholder:["Start month","End month"],rangeWeekPlaceholder:["Start week","End week"]},iK),timePickerLocale:Ue({},u6)},mr="${label} is not a valid ${type}",Su={locale:"en",Pagination:nK,DatePicker:i3,TimePicker:u6,Calendar:i3,global:{placeholder:"Please select"},Table:{filterTitle:"Filter menu",filterConfirm:"OK",filterReset:"Reset",filterEmptyText:"No filters",filterCheckall:"Select all items",filterSearchPlaceholder:"Search in filters",emptyText:"No data",selectAll:"Select current page",selectInvert:"Invert current page",selectNone:"Clear all data",selectionAll:"Select all data",sortTitle:"Sort",expand:"Expand row",collapse:"Collapse row",triggerDesc:"Click to sort descending",triggerAsc:"Click to sort ascending",cancelSort:"Click to cancel sorting"},Tour:{Next:"Next",Previous:"Previous",Finish:"Finish"},Modal:{okText:"OK",cancelText:"Cancel",justOkText:"OK"},Popconfirm:{okText:"OK",cancelText:"Cancel"},Transfer:{titles:["",""],searchPlaceholder:"Search here",itemUnit:"item",itemsUnit:"items",remove:"Remove",selectCurrent:"Select current page",removeCurrent:"Remove current page",selectAll:"Select all data",removeAll:"Remove all data",selectInvert:"Invert current page"},Upload:{uploading:"Uploading...",removeFile:"Remove file",uploadError:"Upload error",previewFile:"Preview file",downloadFile:"Download file"},Empty:{description:"No data"},Icon:{icon:"icon"},Text:{edit:"Edit",copy:"Copy",copied:"Copied",expand:"Expand"},PageHeader:{back:"Back"},Form:{optional:"(optional)",defaultValidateMessages:{default:"Field validation error for ${label}",required:"Please enter ${label}",enum:"${label} must be one of [${enum}]",whitespace:"${label} cannot be a blank character",date:{format:"${label} date format is invalid",parse:"${label} cannot be converted to a date",invalid:"${label} is an invalid date"},types:{string:mr,method:mr,array:mr,object:mr,number:mr,date:mr,boolean:mr,integer:mr,float:mr,regexp:mr,email:mr,url:mr,hex:mr},string:{len:"${label} must be ${len} characters",min:"${label} must be at least ${min} characters",max:"${label} must be up to ${max} characters",range:"${label} must be between ${min}-${max} characters"},number:{len:"${label} must be equal to ${len}",min:"${label} must be minimum ${min}",max:"${label} must be maximum ${max}",range:"${label} must be between ${min}-${max}"},array:{len:"Must be ${len} ${label}",min:"At least ${min} ${label}",max:"At most ${max} ${label}",range:"The amount of ${label} must be between ${min}-${max}"},pattern:{mismatch:"${label} does not match the pattern ${pattern}"}}},Image:{preview:"Preview"},QRCode:{expired:"QR code expired",refresh:"Refresh",scanned:"Scanned"}},d6=rn({compatConfig:{MODE:3},name:"LocaleReceiver",props:{componentName:String,defaultLocale:{type:[Object,Function]},children:{type:Function}},setup(n,e){let{slots:t}=e;const i=Ji("localeData",{}),r=Ge(()=>{const{componentName:o="global",defaultLocale:a}=n,l=a||Su[o||"global"],{antLocale:c}=i,u=o&&c?c[o]:{};return Ue(Ue({},typeof l=="function"?l():l),u||{})}),s=Ge(()=>{const{antLocale:o}=i,a=o&&o.locale;return o&&o.exist&&!a?Su.locale:a});return()=>{const o=n.children||t.default,{antLocale:a}=i;return o==null?void 0:o(r.value,s.value,a)}}});function Ux(n){for(var e=0,t,i=0,r=n.length;r>=4;++i,r-=4)t=n.charCodeAt(i)&255|(n.charCodeAt(++i)&255)<<8|(n.charCodeAt(++i)&255)<<16|(n.charCodeAt(++i)&255)<<24,t=(t&65535)*1540483477+((t>>>16)*59797<<16),t^=t>>>24,e=(t&65535)*1540483477+((t>>>16)*59797<<16)^(e&65535)*1540483477+((e>>>16)*59797<<16);switch(r){case 3:e^=(n.charCodeAt(i+2)&255)<<16;case 2:e^=(n.charCodeAt(i+1)&255)<<8;case 1:e^=n.charCodeAt(i)&255,e=(e&65535)*1540483477+((e>>>16)*59797<<16)}return e^=e>>>13,e=(e&65535)*1540483477+((e>>>16)*59797<<16),((e^e>>>15)>>>0).toString(36)}const r3="%";class rK{constructor(e){this.cache=new Map,this.instanceId=e}get(e){return this.cache.get(Array.isArray(e)?e.join(r3):e)||null}update(e,t){const i=Array.isArray(e)?e.join(r3):e,r=this.cache.get(i),s=t(r);s===null?this.cache.delete(i):this.cache.set(i,s)}}const h6="data-token-hash",Ll="data-css-hash",Uc="__cssinjs_instance__";function xh(){const n=Math.random().toString(12).slice(2);if(typeof document<"u"&&document.head&&document.body){const e=document.body.querySelectorAll("style[".concat(Ll,"]"))||[],{firstChild:t}=document.head;Array.from(e).forEach(r=>{r[Uc]=r[Uc]||n,r[Uc]===n&&document.head.insertBefore(r,t)});const i={};Array.from(document.querySelectorAll("style[".concat(Ll,"]"))).forEach(r=>{var s;const o=r.getAttribute(Ll);i[o]?r[Uc]===n&&((s=r.parentNode)===null||s===void 0||s.removeChild(r)):i[o]=!0})}return new rK(n)}const f6=Symbol("StyleContextKey"),sK=()=>{var n,e,t;const i=Wo();let r;if(i&&i.appContext){const s=(t=(e=(n=i.appContext)===null||n===void 0?void 0:n.config)===null||e===void 0?void 0:e.globalProperties)===null||t===void 0?void 0:t.__ANTDV_CSSINJS_CACHE__;s?r=s:(r=xh(),i.appContext.config.globalProperties&&(i.appContext.config.globalProperties.__ANTDV_CSSINJS_CACHE__=r))}else r=xh();return r},p6={cache:xh(),defaultCache:!0,hashPriority:"low"},b0=()=>{const n=sK();return Ji(f6,Nr(Ue(Ue({},p6),{cache:n})))},oK=n=>{const e=b0(),t=Nr(Ue(Ue({},p6),{cache:xh()}));return ci([()=>We(n),e],()=>{const i=Ue({},e.value),r=We(n);Object.keys(r).forEach(o=>{const a=r[o];r[o]!==void 0&&(i[o]=a)});const{cache:s}=r;i.cache=i.cache||xh(),i.defaultCache=!s&&e.value.defaultCache,t.value=i},{immediate:!0}),ta(f6,t),t},aK=()=>({autoClear:v1(),mock:n3(),cache:Sr(),defaultCache:v1(),hashPriority:n3(),container:KX(),ssrInline:v1(),transformers:t3(),linters:t3()});Ox(rn({name:"AStyleProvider",inheritAttrs:!1,props:aK(),setup(n,e){let{slots:t}=e;return oK(n),()=>{var i;return(i=t.default)===null||i===void 0?void 0:i.call(t)}}}));function m6(n,e,t,i){const r=b0(),s=Nr(""),o=Nr();jm(()=>{s.value=[n,...e.value].join("%")});const a=l=>{r.value.cache.update(l,c=>{const[u=0,d]=c||[];return u-1===0?(i==null||i(d,!1),null):[u-1,d]})};return ci(s,(l,c)=>{c&&a(c),r.value.cache.update(l,u=>{const[d=0,h]=u||[],p=h||t();return[d+1,p]}),o.value=r.value.cache.get(s.value)[1]},{immediate:!0}),Jv(()=>{a(s.value)}),o}function $u(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function lK(n,e){return n&&n.contains?n.contains(e):!1}const s3="data-vc-order",cK="vc-util-key",hv=new Map;function g6(){let{mark:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return n?n.startsWith("data-")?n:"data-".concat(n):cK}function T0(n){return n.attachTo?n.attachTo:document.querySelector("head")||document.body}function uK(n){return n==="queue"?"prependQueue":n?"prepend":"append"}function y6(n){return Array.from((hv.get(n)||n).children).filter(e=>e.tagName==="STYLE")}function v6(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!$u())return null;const{csp:t,prepend:i}=e,r=document.createElement("style");r.setAttribute(s3,uK(i)),t!=null&&t.nonce&&(r.nonce=t==null?void 0:t.nonce),r.innerHTML=n;const s=T0(e),{firstChild:o}=s;if(i){if(i==="queue"){const a=y6(s).filter(l=>["prepend","prependQueue"].includes(l.getAttribute(s3)));if(a.length)return s.insertBefore(r,a[a.length-1].nextSibling),r}s.insertBefore(r,o)}else s.appendChild(r);return r}function _6(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const t=T0(e);return y6(t).find(i=>i.getAttribute(g6(e))===n)}function x6(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const t=_6(n,e);t&&T0(e).removeChild(t)}function dK(n,e){const t=hv.get(n);if(!t||!lK(document,t)){const i=v6("",e),{parentNode:r}=i;hv.set(n,r),n.removeChild(i)}}function Nm(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var i,r,s;const o=T0(t);dK(o,t);const a=_6(e,t);if(a)return!((i=t.csp)===null||i===void 0)&&i.nonce&&a.nonce!==((r=t.csp)===null||r===void 0?void 0:r.nonce)&&(a.nonce=(s=t.csp)===null||s===void 0?void 0:s.nonce),a.innerHTML!==n&&(a.innerHTML=n),a;const l=v6(n,t);return l.setAttribute(g6(t),e),l}function hK(n,e){if(n.length!==e.length)return!1;for(let t=0;t1&&arguments[1]!==void 0?arguments[1]:!1,i={map:this.cache};return e.forEach(r=>{var s;i?i=(s=i==null?void 0:i.map)===null||s===void 0?void 0:s.get(r):i=void 0}),i!=null&&i.value&&t&&(i.value[1]=this.cacheCallTimes++),i==null?void 0:i.value}get(e){var t;return(t=this.internalGet(e,!0))===null||t===void 0?void 0:t[0]}has(e){return!!this.internalGet(e)}set(e,t){if(!this.has(e)){if(this.size()+1>Au.MAX_CACHE_SIZE+Au.MAX_CACHE_OFFSET){const[r]=this.keys.reduce((s,o)=>{const[,a]=s;return this.internalGet(o)[1]{if(s===e.length-1)i.set(r,{value:[t,this.cacheCallTimes++]});else{const o=i.get(r);o?o.map||(o.map=new Map):i.set(r,{map:new Map}),i=i.get(r).map}})}deleteByPath(e,t){var i;const r=e.get(t[0]);if(t.length===1)return r.map?e.set(t[0],{map:r.map}):e.delete(t[0]),(i=r.value)===null||i===void 0?void 0:i[0];const s=this.deleteByPath(r.map,t.slice(1));return(!r.map||r.map.size===0)&&!r.value&&e.delete(t[0]),s}delete(e){if(this.has(e))return this.keys=this.keys.filter(t=>!hK(t,e)),this.deleteByPath(this.cache,e)}}Au.MAX_CACHE_SIZE=20;Au.MAX_CACHE_OFFSET=5;function fK(){}let S6=fK,o3=0;class A6{constructor(e){this.derivatives=Array.isArray(e)?e:[e],this.id=o3,e.length===0&&S6(e.length>0),o3+=1}getDerivativeToken(e){return this.derivatives.reduce((t,i)=>i(e,t),void 0)}}const _1=new Au;function b6(n){const e=Array.isArray(n)?n:[n];return _1.has(e)||_1.set(e,new A6(e)),_1.get(e)}const a3=new WeakMap;function Pm(n){let e=a3.get(n)||"";return e||(Object.keys(n).forEach(t=>{const i=n[t];e+=t,i instanceof A6?e+=i.id:i&&typeof i=="object"?e+=Pm(i):e+=i}),a3.set(n,e)),e}function pK(n,e){return Ux("".concat(e,"_").concat(Pm(n)))}const Wd="random-".concat(Date.now(),"-").concat(Math.random()).replace(/\./g,""),T6="_bAmBoO_";function mK(n,e,t){var i,r;if($u()){Nm(n,Wd);const s=document.createElement("div");s.style.position="fixed",s.style.left="0",s.style.top="0",e==null||e(s),document.body.appendChild(s);const o=t?t(s):(i=getComputedStyle(s).content)===null||i===void 0?void 0:i.includes(T6);return(r=s.parentNode)===null||r===void 0||r.removeChild(s),x6(Wd),o}return!1}let x1;function gK(){return x1===void 0&&(x1=mK("@layer ".concat(Wd," { .").concat(Wd,' { content: "').concat(T6,'"!important; } }'),n=>{n.className=Wd})),x1}const l3={},yK="css",gl=new Map;function vK(n){gl.set(n,(gl.get(n)||0)+1)}function _K(n,e){typeof document<"u"&&document.querySelectorAll("style[".concat(h6,'="').concat(n,'"]')).forEach(i=>{var r;i[Uc]===e&&((r=i.parentNode)===null||r===void 0||r.removeChild(i))})}const xK=0;function SK(n,e){gl.set(n,(gl.get(n)||0)-1);const t=Array.from(gl.keys()),i=t.filter(r=>(gl.get(r)||0)<=0);t.length-i.length>xK&&i.forEach(r=>{_K(r,e),gl.delete(r)})}const AK=(n,e,t,i)=>{const r=t.getDerivativeToken(n);let s=Ue(Ue({},r),e);return i&&(s=i(s)),s};function bK(n,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Dn({});const i=b0(),r=Ge(()=>Ue({},...e.value)),s=Ge(()=>Pm(r.value)),o=Ge(()=>Pm(t.value.override||l3));return m6("token",Ge(()=>[t.value.salt||"",n.value.id,s.value,o.value]),()=>{const{salt:l="",override:c=l3,formatToken:u,getComputedToken:d}=t.value,h=d?d(r.value,c,n.value):AK(r.value,c,n.value,u),f=pK(h,l);h._tokenKey=f,vK(f);const p="".concat(yK,"-").concat(Ux(f));return h._hashId=p,[h,p]},l=>{var c;SK(l[0]._tokenKey,(c=i.value)===null||c===void 0?void 0:c.cache.instanceId)})}var TK={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},w6="comm",C6="rule",E6="decl",wK="@import",CK="@namespace",EK="@keyframes",MK="@layer",M6=Math.abs,zx=String.fromCharCode;function R6(n){return n.trim()}function Bp(n,e,t){return n.replace(e,t)}function RK(n,e,t){return n.indexOf(e,t)}function Yc(n,e){return n.charCodeAt(e)|0}function bu(n,e,t){return n.slice(e,t)}function Bs(n){return n.length}function IK(n){return n.length}function op(n,e){return e.push(n),n}var w0=1,Tu=1,I6=0,rs=0,$n=0,Gu="";function Vx(n,e,t,i,r,s,o,a){return{value:n,root:e,parent:t,type:i,props:r,children:s,line:w0,column:Tu,length:o,return:"",siblings:a}}function NK(){return $n}function PK(){return $n=rs>0?Yc(Gu,--rs):0,Tu--,$n===10&&(Tu=1,w0--),$n}function Ss(){return $n=rs2||Sh($n)>3?"":" "}function OK(n,e){for(;--e&&Ss()&&!($n<48||$n>102||$n>57&&$n<65||$n>70&&$n<97););return C0(n,kp()+(e<6&&Ea()==32&&Ss()==32))}function fv(n){for(;Ss();)switch($n){case n:return rs;case 34:case 39:n!==34&&n!==39&&fv($n);break;case 40:n===41&&fv(n);break;case 92:Ss();break}return rs}function BK(n,e){for(;Ss()&&n+$n!==57;)if(n+$n===84&&Ea()===47)break;return"/*"+C0(e,rs-1)+"*"+zx(n===47?n:Ss())}function kK(n){for(;!Sh(Ea());)Ss();return C0(n,rs)}function UK(n){return DK(Up("",null,null,null,[""],n=LK(n),0,[0],n))}function Up(n,e,t,i,r,s,o,a,l){for(var c=0,u=0,d=o,h=0,f=0,p=0,g=1,y=1,m=1,v=0,x="",_=r,S=s,E=i,A=x;y;)switch(p=v,v=Ss()){case 40:if(p!=108&&Yc(A,d-1)==58){RK(A+=Bp(S1(v),"&","&\f"),"&\f",M6(c?a[c-1]:0))!=-1&&(m=-1);break}case 34:case 39:case 91:A+=S1(v);break;case 9:case 10:case 13:case 32:A+=FK(p);break;case 92:A+=OK(kp()-1,7);continue;case 47:switch(Ea()){case 42:case 47:op(zK(BK(Ss(),kp()),e,t,l),l),(Sh(p||1)==5||Sh(Ea()||1)==5)&&Bs(A)&&bu(A,-1,void 0)!==" "&&(A+=" ");break;default:A+="/"}break;case 123*g:a[c++]=Bs(A)*m;case 125*g:case 59:case 0:switch(v){case 0:case 125:y=0;case 59+u:m==-1&&(A=Bp(A,/\f/g,"")),f>0&&(Bs(A)-d||g===0&&p===47)&&op(f>32?u3(A+";",i,t,d-1,l):u3(Bp(A," ","")+";",i,t,d-2,l),l);break;case 59:A+=";";default:if(op(E=c3(A,e,t,c,u,r,a,x,_=[],S=[],d,s),s),v===123)if(u===0)Up(A,e,E,E,_,s,d,a,S);else{switch(h){case 99:if(Yc(A,3)===110)break;case 108:if(Yc(A,2)===97)break;default:u=0;case 100:case 109:case 115:}u?Up(n,E,E,i&&op(c3(n,E,E,0,0,r,a,x,r,_=[],d,S),S),r,S,d,a,i?_:S):Up(A,E,E,E,[""],S,0,a,S)}}c=u=f=0,g=m=1,x=A="",d=o;break;case 58:d=1+Bs(A),f=p;default:if(g<1){if(v==123)--g;else if(v==125&&g++==0&&PK()==125)continue}switch(A+=zx(v),v*g){case 38:m=u>0?1:(A+="\f",-1);break;case 44:a[c++]=(Bs(A)-1)*m,m=1;break;case 64:Ea()===45&&(A+=S1(Ss())),h=Ea(),u=d=Bs(x=A+=kK(kp())),v++;break;case 45:p===45&&Bs(A)==2&&(g=0)}}return s}function c3(n,e,t,i,r,s,o,a,l,c,u,d){for(var h=r-1,f=r===0?s:[""],p=IK(f),g=0,y=0,m=0;g0?f[v]+" "+x:Bp(x,/&\f/g,f[v])))&&(l[m++]=_);return Vx(n,e,t,r===0?C6:a,l,c,u,d)}function zK(n,e,t,i){return Vx(n,e,t,w6,zx(NK()),bu(n,2,-2),0,i)}function u3(n,e,t,i,r){return Vx(n,e,t,E6,bu(n,0,i),bu(n,i+1,-1),i,r)}function pv(n,e){for(var t="",i=0;i{const[s,o]=r.split(":");Dl[s]=o});const i=document.querySelector("style[".concat(d3,"]"));i&&(N6=!1,(n=i.parentNode)===null||n===void 0||n.removeChild(i)),document.body.removeChild(e)}}function GK(n){return $K(),!!Dl[n]}function WK(n){const e=Dl[n];let t=null;if(e&&$u())if(N6)t=HK;else{const i=document.querySelector("style[".concat(Ll,'="').concat(Dl[n],'"]'));i?t=i.innerHTML:delete Dl[n]}return[t,e]}const h3=$u(),QK="_skip_check_",P6="_multi_value_";function f3(n){return pv(UK(n),VK).replace(/\{%%%\:[^;];}/g,";")}function jK(n){return typeof n=="object"&&n&&(QK in n||P6 in n)}function qK(n,e,t){if(!e)return n;const i=".".concat(e),r=t==="low"?":where(".concat(i,")"):i;return n.split(",").map(o=>{var a;const l=o.trim().split(/\s+/);let c=l[0]||"";const u=((a=c.match(/^\w+/))===null||a===void 0?void 0:a[0])||"";return c="".concat(u).concat(r).concat(c.slice(u.length)),[c,...l.slice(1)].join(" ")}).join(",")}const p3=new Set,mv=function(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},{root:t,injectHash:i,parentSelectors:r}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{root:!0,parentSelectors:[]};const{hashId:s,layer:o,path:a,hashPriority:l,transformers:c=[],linters:u=[]}=e;let d="",h={};function f(y){const m=y.getName(s);if(!h[m]){const[v]=mv(y.style,e,{root:!1,parentSelectors:r});h[m]="@keyframes ".concat(y.getName(s)).concat(v)}}function p(y){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return y.forEach(v=>{Array.isArray(v)?p(v,m):v&&m.push(v)}),m}if(p(Array.isArray(n)?n:[n]).forEach(y=>{const m=typeof y=="string"&&!t?{}:y;if(typeof m=="string")d+="".concat(m,"\n");else if(m._keyframe)f(m);else{const v=c.reduce((x,_)=>{var S;return((S=_==null?void 0:_.visit)===null||S===void 0?void 0:S.call(_,x))||x},m);Object.keys(v).forEach(x=>{var _;const S=v[x];if(typeof S=="object"&&S&&(x!=="animationName"||!S._keyframe)&&!jK(S)){let E=!1,A=x.trim(),R=!1;(t||i)&&s?A.startsWith("@")?E=!0:A=qK(x,s,l):t&&!s&&(A==="&"||A==="")&&(A="",R=!0);const[w,M]=mv(S,e,{root:R,injectHash:E,parentSelectors:[...r,A]});h=Ue(Ue({},h),M),d+="".concat(A).concat(w)}else{let E=function(R,w){const M=R.replace(/[A-Z]/g,L=>"-".concat(L.toLowerCase()));let I=w;!TK[R]&&typeof I=="number"&&I!==0&&(I="".concat(I,"px")),R==="animationName"&&(w!=null&&w._keyframe)&&(f(w),I=w.getName(s)),d+="".concat(M,":").concat(I,";")};const A=(_=S==null?void 0:S.value)!==null&&_!==void 0?_:S;typeof S=="object"&&(S!=null&&S[P6])&&Array.isArray(A)?A.forEach(R=>{E(x,R)}):E(x,A)}})}}),!t)d="{".concat(d,"}");else if(o&&gK()){const y=o.split(","),m=y[y.length-1].trim();d="@layer ".concat(m," {").concat(d,"}"),y.length>1&&(d="@layer ".concat(o,"{%%%:%}").concat(d))}return[d,h]};function XK(n,e){return Ux("".concat(n.join("%")).concat(e))}function gv(n,e){const t=b0(),i=Ge(()=>n.value.token._tokenKey),r=Ge(()=>[i.value,...n.value.path]);let s=h3;return m6("style",r,()=>{const{path:o,hashId:a,layer:l,nonce:c,clientOnly:u,order:d=0}=n.value,h=r.value.join("|");if(GK(h)){const[A,R]=WK(h);if(A)return[A,i.value,R,{},u,d]}const f=e(),{hashPriority:p,container:g,transformers:y,linters:m,cache:v}=t.value,[x,_]=mv(f,{hashId:a,hashPriority:p,layer:l,path:o.join("-"),transformers:y,linters:m}),S=f3(x),E=XK(r.value,S);if(s){const A={mark:Ll,prepend:"queue",attachTo:g,priority:d},R=typeof c=="function"?c():c;R&&(A.csp={nonce:R});const w=Nm(S,E,A);w[Uc]=v.instanceId,w.setAttribute(h6,i.value),Object.keys(_).forEach(M=>{p3.has(M)||(p3.add(M),Nm(f3(_[M]),"_effect-".concat(M),{mark:Ll,prepend:"queue",attachTo:g}))})}return[S,i.value,E,_,u,d]},(o,a)=>{let[,,l]=o;(a||t.value.autoClear)&&h3&&x6(l,{mark:Ll})}),o=>o}class Fl{constructor(e,t){this._keyframe=!0,this.name=e,this.style=t}getName(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return e?"".concat(e,"-").concat(this.name):this.name}}const KK="4.2.6";function Ai(n,e){YK(n)&&(n="100%");var t=ZK(n);return n=e===360?n:Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(String(n*e),10)/100),Math.abs(n-e)<1e-6?1:(e===360?n=(n<0?n%e+e:n%e)/parseFloat(String(e)):n=n%e/parseFloat(String(e)),n)}function ap(n){return Math.min(1,Math.max(0,n))}function YK(n){return typeof n=="string"&&n.indexOf(".")!==-1&&parseFloat(n)===1}function ZK(n){return typeof n=="string"&&n.indexOf("%")!==-1}function L6(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function lp(n){return n<=1?"".concat(Number(n)*100,"%"):n}function bl(n){return n.length===1?"0"+n:String(n)}function JK(n,e,t){return{r:Ai(n,255)*255,g:Ai(e,255)*255,b:Ai(t,255)*255}}function m3(n,e,t){n=Ai(n,255),e=Ai(e,255),t=Ai(t,255);var i=Math.max(n,e,t),r=Math.min(n,e,t),s=0,o=0,a=(i+r)/2;if(i===r)o=0,s=0;else{var l=i-r;switch(o=a>.5?l/(2-i-r):l/(i+r),i){case n:s=(e-t)/l+(e1&&(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 eY(n,e,t){var i,r,s;if(n=Ai(n,360),e=Ai(e,100),t=Ai(t,100),e===0)r=t,s=t,i=t;else{var o=t<.5?t*(1+e):t+e-t*e,a=2*t-o;i=A1(a,o,n+1/3),r=A1(a,o,n),s=A1(a,o,n-1/3)}return{r:i*255,g:r*255,b:s*255}}function yv(n,e,t){n=Ai(n,255),e=Ai(e,255),t=Ai(t,255);var i=Math.max(n,e,t),r=Math.min(n,e,t),s=0,o=i,a=i-r,l=i===0?0:a/i;if(i===r)s=0;else{switch(i){case n:s=(e-t)/a+(e>16,g:(n&65280)>>8,b:n&255}}var _v={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Ic(n){var e={r:0,g:0,b:0},t=1,i=null,r=null,s=null,o=!1,a=!1;return typeof n=="string"&&(n=aY(n)),typeof n=="object"&&(xo(n.r)&&xo(n.g)&&xo(n.b)?(e=JK(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):xo(n.h)&&xo(n.s)&&xo(n.v)?(i=lp(n.s),r=lp(n.v),e=tY(n.h,i,r),o=!0,a="hsv"):xo(n.h)&&xo(n.s)&&xo(n.l)&&(i=lp(n.s),s=lp(n.l),e=eY(n.h,i,s),o=!0,a="hsl"),Object.prototype.hasOwnProperty.call(n,"a")&&(t=n.a)),t=L6(t),{ok:o,format:n.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}var sY="[-\\+]?\\d+%?",oY="[-\\+]?\\d*\\.\\d+%?",Ma="(?:".concat(oY,")|(?:").concat(sY,")"),b1="[\\s|\\(]+(".concat(Ma,")[,|\\s]+(").concat(Ma,")[,|\\s]+(").concat(Ma,")\\s*\\)?"),T1="[\\s|\\(]+(".concat(Ma,")[,|\\s]+(").concat(Ma,")[,|\\s]+(").concat(Ma,")[,|\\s]+(").concat(Ma,")\\s*\\)?"),ds={CSS_UNIT:new RegExp(Ma),rgb:new RegExp("rgb"+b1),rgba:new RegExp("rgba"+T1),hsl:new RegExp("hsl"+b1),hsla:new RegExp("hsla"+T1),hsv:new RegExp("hsv"+b1),hsva:new RegExp("hsva"+T1),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function aY(n){if(n=n.trim().toLowerCase(),n.length===0)return!1;var e=!1;if(_v[n])n=_v[n],e=!0;else if(n==="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t=ds.rgb.exec(n);return t?{r:t[1],g:t[2],b:t[3]}:(t=ds.rgba.exec(n),t?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=ds.hsl.exec(n),t?{h:t[1],s:t[2],l:t[3]}:(t=ds.hsla.exec(n),t?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=ds.hsv.exec(n),t?{h:t[1],s:t[2],v:t[3]}:(t=ds.hsva.exec(n),t?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=ds.hex8.exec(n),t?{r:yr(t[1]),g:yr(t[2]),b:yr(t[3]),a:g3(t[4]),format:e?"name":"hex8"}:(t=ds.hex6.exec(n),t?{r:yr(t[1]),g:yr(t[2]),b:yr(t[3]),format:e?"name":"hex"}:(t=ds.hex4.exec(n),t?{r:yr(t[1]+t[1]),g:yr(t[2]+t[2]),b:yr(t[3]+t[3]),a:g3(t[4]+t[4]),format:e?"name":"hex8"}:(t=ds.hex3.exec(n),t?{r:yr(t[1]+t[1]),g:yr(t[2]+t[2]),b:yr(t[3]+t[3]),format:e?"name":"hex"}:!1)))))))))}function xo(n){return!!ds.CSS_UNIT.exec(String(n))}var vi=function(){function n(e,t){e===void 0&&(e=""),t===void 0&&(t={});var i;if(e instanceof n)return e;typeof e=="number"&&(e=rY(e)),this.originalInput=e;var r=Ic(e);this.originalInput=e,this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this.roundA=Math.round(100*this.a)/100,this.format=(i=t.format)!==null&&i!==void 0?i:r.format,this.gradientType=t.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=r.ok}return n.prototype.isDark=function(){return this.getBrightness()<128},n.prototype.isLight=function(){return!this.isDark()},n.prototype.getBrightness=function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},n.prototype.getLuminance=function(){var e=this.toRgb(),t,i,r,s=e.r/255,o=e.g/255,a=e.b/255;return s<=.03928?t=s/12.92:t=Math.pow((s+.055)/1.055,2.4),o<=.03928?i=o/12.92:i=Math.pow((o+.055)/1.055,2.4),a<=.03928?r=a/12.92:r=Math.pow((a+.055)/1.055,2.4),.2126*t+.7152*i+.0722*r},n.prototype.getAlpha=function(){return this.a},n.prototype.setAlpha=function(e){return this.a=L6(e),this.roundA=Math.round(100*this.a)/100,this},n.prototype.isMonochrome=function(){var e=this.toHsl().s;return e===0},n.prototype.toHsv=function(){var e=yv(this.r,this.g,this.b);return{h:e.h*360,s:e.s,v:e.v,a:this.a}},n.prototype.toHsvString=function(){var e=yv(this.r,this.g,this.b),t=Math.round(e.h*360),i=Math.round(e.s*100),r=Math.round(e.v*100);return this.a===1?"hsv(".concat(t,", ").concat(i,"%, ").concat(r,"%)"):"hsva(".concat(t,", ").concat(i,"%, ").concat(r,"%, ").concat(this.roundA,")")},n.prototype.toHsl=function(){var e=m3(this.r,this.g,this.b);return{h:e.h*360,s:e.s,l:e.l,a:this.a}},n.prototype.toHslString=function(){var e=m3(this.r,this.g,this.b),t=Math.round(e.h*360),i=Math.round(e.s*100),r=Math.round(e.l*100);return this.a===1?"hsl(".concat(t,", ").concat(i,"%, ").concat(r,"%)"):"hsla(".concat(t,", ").concat(i,"%, ").concat(r,"%, ").concat(this.roundA,")")},n.prototype.toHex=function(e){return e===void 0&&(e=!1),vv(this.r,this.g,this.b,e)},n.prototype.toHexString=function(e){return e===void 0&&(e=!1),"#"+this.toHex(e)},n.prototype.toHex8=function(e){return e===void 0&&(e=!1),nY(this.r,this.g,this.b,this.a,e)},n.prototype.toHex8String=function(e){return e===void 0&&(e=!1),"#"+this.toHex8(e)},n.prototype.toHexShortString=function(e){return e===void 0&&(e=!1),this.a===1?this.toHexString(e):this.toHex8String(e)},n.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},n.prototype.toRgbString=function(){var e=Math.round(this.r),t=Math.round(this.g),i=Math.round(this.b);return this.a===1?"rgb(".concat(e,", ").concat(t,", ").concat(i,")"):"rgba(".concat(e,", ").concat(t,", ").concat(i,", ").concat(this.roundA,")")},n.prototype.toPercentageRgb=function(){var e=function(t){return"".concat(Math.round(Ai(t,255)*100),"%")};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},n.prototype.toPercentageRgbString=function(){var e=function(t){return Math.round(Ai(t,255)*100)};return this.a===1?"rgb(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%)"):"rgba(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%, ").concat(this.roundA,")")},n.prototype.toName=function(){if(this.a===0)return"transparent";if(this.a<1)return!1;for(var e="#"+vv(this.r,this.g,this.b,!1),t=0,i=Object.entries(_v);t=0,s=!t&&r&&(e.startsWith("hex")||e==="name");return s?e==="name"&&this.a===0?this.toName():this.toRgbString():(e==="rgb"&&(i=this.toRgbString()),e==="prgb"&&(i=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(i=this.toHexString()),e==="hex3"&&(i=this.toHexString(!0)),e==="hex4"&&(i=this.toHex8String(!0)),e==="hex8"&&(i=this.toHex8String()),e==="name"&&(i=this.toName()),e==="hsl"&&(i=this.toHslString()),e==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},n.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},n.prototype.clone=function(){return new n(this.toString())},n.prototype.lighten=function(e){e===void 0&&(e=10);var t=this.toHsl();return t.l+=e/100,t.l=ap(t.l),new n(t)},n.prototype.brighten=function(e){e===void 0&&(e=10);var t=this.toRgb();return t.r=Math.max(0,Math.min(255,t.r-Math.round(255*-(e/100)))),t.g=Math.max(0,Math.min(255,t.g-Math.round(255*-(e/100)))),t.b=Math.max(0,Math.min(255,t.b-Math.round(255*-(e/100)))),new n(t)},n.prototype.darken=function(e){e===void 0&&(e=10);var t=this.toHsl();return t.l-=e/100,t.l=ap(t.l),new n(t)},n.prototype.tint=function(e){return e===void 0&&(e=10),this.mix("white",e)},n.prototype.shade=function(e){return e===void 0&&(e=10),this.mix("black",e)},n.prototype.desaturate=function(e){e===void 0&&(e=10);var t=this.toHsl();return t.s-=e/100,t.s=ap(t.s),new n(t)},n.prototype.saturate=function(e){e===void 0&&(e=10);var t=this.toHsl();return t.s+=e/100,t.s=ap(t.s),new n(t)},n.prototype.greyscale=function(){return this.desaturate(100)},n.prototype.spin=function(e){var t=this.toHsl(),i=(t.h+e)%360;return t.h=i<0?360+i:i,new n(t)},n.prototype.mix=function(e,t){t===void 0&&(t=50);var i=this.toRgb(),r=new n(e).toRgb(),s=t/100,o={r:(r.r-i.r)*s+i.r,g:(r.g-i.g)*s+i.g,b:(r.b-i.b)*s+i.b,a:(r.a-i.a)*s+i.a};return new n(o)},n.prototype.analogous=function(e,t){e===void 0&&(e=6),t===void 0&&(t=30);var i=this.toHsl(),r=360/t,s=[this];for(i.h=(i.h-(r*e>>1)+720)%360;--e;)i.h=(i.h+r)%360,s.push(new n(i));return s},n.prototype.complement=function(){var e=this.toHsl();return e.h=(e.h+180)%360,new n(e)},n.prototype.monochromatic=function(e){e===void 0&&(e=6);for(var t=this.toHsv(),i=t.h,r=t.s,s=t.v,o=[],a=1/e;e--;)o.push(new n({h:i,s:r,v:s})),s=(s+a)%1;return o},n.prototype.splitcomplement=function(){var e=this.toHsl(),t=e.h;return[this,new n({h:(t+72)%360,s:e.s,l:e.l}),new n({h:(t+216)%360,s:e.s,l:e.l})]},n.prototype.onBackground=function(e){var t=this.toRgb(),i=new n(e).toRgb(),r=t.a+i.a*(1-t.a);return new n({r:(t.r*t.a+i.r*i.a*(1-t.a))/r,g:(t.g*t.a+i.g*i.a*(1-t.a))/r,b:(t.b*t.a+i.b*i.a*(1-t.a))/r,a:r})},n.prototype.triad=function(){return this.polyad(3)},n.prototype.tetrad=function(){return this.polyad(4)},n.prototype.polyad=function(e){for(var t=this.toHsl(),i=t.h,r=[this],s=360/e,o=1;o=60&&Math.round(n.h)<=240?i=t?Math.round(n.h)-cp*e:Math.round(n.h)+cp*e:i=t?Math.round(n.h)+cp*e:Math.round(n.h)-cp*e,i<0?i+=360:i>=360&&(i-=360),i}function x3(n,e,t){if(n.h===0&&n.s===0)return n.s;var i;return t?i=n.s-y3*e:e===F6?i=n.s+y3:i=n.s+lY*e,i>1&&(i=1),t&&e===D6&&i>.1&&(i=.1),i<.06&&(i=.06),Number(i.toFixed(2))}function S3(n,e,t){var i;return t?i=n.v+cY*e:i=n.v-uY*e,i>1&&(i=1),Number(i.toFixed(2))}function $l(n){for(var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=[],i=Ic(n),r=D6;r>0;r-=1){var s=v3(i),o=up(Ic({h:_3(s,r,!0),s:x3(s,r,!0),v:S3(s,r,!0)}));t.push(o)}t.push(up(i));for(var a=1;a<=F6;a+=1){var l=v3(i),c=up(Ic({h:_3(l,a),s:x3(l,a),v:S3(l,a)}));t.push(c)}return e.theme==="dark"?dY.map(function(u){var d=u.index,h=u.opacity,f=up(hY(Ic(e.backgroundColor||"#141414"),Ic(t[d]),h*100));return f}):t}var w1={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},zp={},C1={};Object.keys(w1).forEach(function(n){zp[n]=$l(w1[n]),zp[n].primary=zp[n][5],C1[n]=$l(w1[n],{theme:"dark",backgroundColor:"#141414"}),C1[n].primary=C1[n][5]});var fY=zp.blue;const pY=n=>{const{controlHeight:e}=n;return{controlHeightSM:e*.75,controlHeightXS:e*.5,controlHeightLG:e*1.25}};function mY(n){const{sizeUnit:e,sizeStep:t}=n;return{sizeXXL:e*(t+8),sizeXL:e*(t+4),sizeLG:e*(t+2),sizeMD:e*(t+1),sizeMS:e*t,size:e*t,sizeSM:e*(t-1),sizeXS:e*(t-2),sizeXXS:e*(t-3)}}const O6={blue:"#1677ff",purple:"#722ED1",cyan:"#13C2C2",green:"#52C41A",magenta:"#EB2F96",pink:"#eb2f96",red:"#F5222D",orange:"#FA8C16",yellow:"#FADB14",volcano:"#FA541C",geekblue:"#2F54EB",gold:"#FAAD14",lime:"#A0D911"},E0=Ue(Ue({},O6),{colorPrimary:"#1677ff",colorSuccess:"#52c41a",colorWarning:"#faad14",colorError:"#ff4d4f",colorInfo:"#1677ff",colorTextBase:"",colorBgBase:"",fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,\n'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',\n'Noto Color Emoji'",fontSize:14,lineWidth:1,lineType:"solid",motionUnit:.1,motionBase:0,motionEaseOutCirc:"cubic-bezier(0.08, 0.82, 0.17, 1)",motionEaseInOutCirc:"cubic-bezier(0.78, 0.14, 0.15, 0.86)",motionEaseOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",motionEaseInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",motionEaseOutBack:"cubic-bezier(0.12, 0.4, 0.29, 1.46)",motionEaseInBack:"cubic-bezier(0.71, -0.46, 0.88, 0.6)",motionEaseInQuint:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",motionEaseOutQuint:"cubic-bezier(0.23, 1, 0.32, 1)",borderRadius:6,sizeUnit:4,sizeStep:4,sizePopupArrow:16,controlHeight:32,zIndexBase:0,zIndexPopupBase:1e3,opacityImage:1,wireframe:!1});function gY(n,e){let{generateColorPalettes:t,generateNeutralColorPalettes:i}=e;const{colorSuccess:r,colorWarning:s,colorError:o,colorInfo:a,colorPrimary:l,colorBgBase:c,colorTextBase:u}=n,d=t(l),h=t(r),f=t(s),p=t(o),g=t(a),y=i(c,u);return Ue(Ue({},y),{colorPrimaryBg:d[1],colorPrimaryBgHover:d[2],colorPrimaryBorder:d[3],colorPrimaryBorderHover:d[4],colorPrimaryHover:d[5],colorPrimary:d[6],colorPrimaryActive:d[7],colorPrimaryTextHover:d[8],colorPrimaryText:d[9],colorPrimaryTextActive:d[10],colorSuccessBg:h[1],colorSuccessBgHover:h[2],colorSuccessBorder:h[3],colorSuccessBorderHover:h[4],colorSuccessHover:h[4],colorSuccess:h[6],colorSuccessActive:h[7],colorSuccessTextHover:h[8],colorSuccessText:h[9],colorSuccessTextActive:h[10],colorErrorBg:p[1],colorErrorBgHover:p[2],colorErrorBorder:p[3],colorErrorBorderHover:p[4],colorErrorHover:p[5],colorError:p[6],colorErrorActive:p[7],colorErrorTextHover:p[8],colorErrorText:p[9],colorErrorTextActive:p[10],colorWarningBg:f[1],colorWarningBgHover:f[2],colorWarningBorder:f[3],colorWarningBorderHover:f[4],colorWarningHover:f[4],colorWarning:f[6],colorWarningActive:f[7],colorWarningTextHover:f[8],colorWarningText:f[9],colorWarningTextActive:f[10],colorInfoBg:g[1],colorInfoBgHover:g[2],colorInfoBorder:g[3],colorInfoBorderHover:g[4],colorInfoHover:g[4],colorInfo:g[6],colorInfoActive:g[7],colorInfoTextHover:g[8],colorInfoText:g[9],colorInfoTextActive:g[10],colorBgMask:new vi("#000").setAlpha(.45).toRgbString(),colorWhite:"#fff"})}const yY=n=>{let e=n,t=n,i=n,r=n;return n<6&&n>=5?e=n+1:n<16&&n>=6?e=n+2:n>=16&&(e=16),n<7&&n>=5?t=4:n<8&&n>=7?t=5:n<14&&n>=8?t=6:n<16&&n>=14?t=7:n>=16&&(t=8),n<6&&n>=2?i=1:n>=6&&(i=2),n>4&&n<8?r=4:n>=8&&(r=6),{borderRadius:n>16?16:n,borderRadiusXS:i,borderRadiusSM:t,borderRadiusLG:e,borderRadiusOuter:r}};function vY(n){const{motionUnit:e,motionBase:t,borderRadius:i,lineWidth:r}=n;return Ue({motionDurationFast:"".concat((t+e).toFixed(1),"s"),motionDurationMid:"".concat((t+e*2).toFixed(1),"s"),motionDurationSlow:"".concat((t+e*3).toFixed(1),"s"),lineWidthBold:r+1},yY(i))}const So=(n,e)=>new vi(n).setAlpha(e).toRgbString(),_d=(n,e)=>new vi(n).darken(e).toHexString(),_Y=n=>{const e=$l(n);return{1:e[0],2:e[1],3:e[2],4:e[3],5:e[4],6:e[5],7:e[6],8:e[4],9:e[5],10:e[6]}},xY=(n,e)=>{const t=n||"#fff",i=e||"#000";return{colorBgBase:t,colorTextBase:i,colorText:So(i,.88),colorTextSecondary:So(i,.65),colorTextTertiary:So(i,.45),colorTextQuaternary:So(i,.25),colorFill:So(i,.15),colorFillSecondary:So(i,.06),colorFillTertiary:So(i,.04),colorFillQuaternary:So(i,.02),colorBgLayout:_d(t,4),colorBgContainer:_d(t,0),colorBgElevated:_d(t,0),colorBgSpotlight:So(i,.85),colorBorder:_d(t,15),colorBorderSecondary:_d(t,6)}};function SY(n){const e=new Array(10).fill(null).map((t,i)=>{const r=i-1,s=n*Math.pow(2.71828,r/5),o=i>1?Math.floor(s):Math.ceil(s);return Math.floor(o/2)*2});return e[1]=n,e.map(t=>{const i=t+8;return{size:t,lineHeight:i/t}})}const AY=n=>{const e=SY(n),t=e.map(r=>r.size),i=e.map(r=>r.lineHeight);return{fontSizeSM:t[0],fontSize:t[1],fontSizeLG:t[2],fontSizeXL:t[3],fontSizeHeading1:t[6],fontSizeHeading2:t[5],fontSizeHeading3:t[4],fontSizeHeading4:t[3],fontSizeHeading5:t[2],lineHeight:i[1],lineHeightLG:i[2],lineHeightSM:i[0],lineHeightHeading1:i[6],lineHeightHeading2:i[5],lineHeightHeading3:i[4],lineHeightHeading4:i[3],lineHeightHeading5:i[2]}};function bY(n){const e=Object.keys(O6).map(t=>{const i=$l(n[t]);return new Array(10).fill(1).reduce((r,s,o)=>(r["".concat(t,"-").concat(o+1)]=i[o],r),{})}).reduce((t,i)=>(t=Ue(Ue({},t),i),t),{});return Ue(Ue(Ue(Ue(Ue(Ue(Ue({},n),e),gY(n,{generateColorPalettes:_Y,generateNeutralColorPalettes:xY})),AY(n.fontSize)),mY(n)),pY(n)),vY(n))}function E1(n){return n>=0&&n<=255}function dp(n,e){const{r:t,g:i,b:r,a:s}=new vi(n).toRgb();if(s<1)return n;const{r:o,g:a,b:l}=new vi(e).toRgb();for(let c=.01;c<=1;c+=.01){const u=Math.round((t-o*(1-c))/c),d=Math.round((i-a*(1-c))/c),h=Math.round((r-l*(1-c))/c);if(E1(u)&&E1(d)&&E1(h))return new vi({r:u,g:d,b:h,a:Math.round(c*100)/100}).toRgbString()}return new vi({r:t,g:i,b:r,a:1}).toRgbString()}var TY=function(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{delete i[f]});const r=Ue(Ue({},t),i),s=480,o=576,a=768,l=992,c=1200,u=1600,d=2e3;return Ue(Ue(Ue({},r),{colorLink:r.colorInfoText,colorLinkHover:r.colorInfoHover,colorLinkActive:r.colorInfoActive,colorFillContent:r.colorFillSecondary,colorFillContentHover:r.colorFill,colorFillAlter:r.colorFillQuaternary,colorBgContainerDisabled:r.colorFillTertiary,colorBorderBg:r.colorBgContainer,colorSplit:dp(r.colorBorderSecondary,r.colorBgContainer),colorTextPlaceholder:r.colorTextQuaternary,colorTextDisabled:r.colorTextQuaternary,colorTextHeading:r.colorText,colorTextLabel:r.colorTextSecondary,colorTextDescription:r.colorTextTertiary,colorTextLightSolid:r.colorWhite,colorHighlight:r.colorError,colorBgTextHover:r.colorFillSecondary,colorBgTextActive:r.colorFill,colorIcon:r.colorTextTertiary,colorIconHover:r.colorText,colorErrorOutline:dp(r.colorErrorBg,r.colorBgContainer),colorWarningOutline:dp(r.colorWarningBg,r.colorBgContainer),fontSizeIcon:r.fontSizeSM,lineWidth:r.lineWidth,controlOutlineWidth:r.lineWidth*2,controlInteractiveSize:r.controlHeight/2,controlItemBgHover:r.colorFillTertiary,controlItemBgActive:r.colorPrimaryBg,controlItemBgActiveHover:r.colorPrimaryBgHover,controlItemBgActiveDisabled:r.colorFill,controlTmpOutline:r.colorFillQuaternary,controlOutline:dp(r.colorPrimaryBg,r.colorBgContainer),lineType:r.lineType,borderRadius:r.borderRadius,borderRadiusXS:r.borderRadiusXS,borderRadiusSM:r.borderRadiusSM,borderRadiusLG:r.borderRadiusLG,fontWeightStrong:600,opacityLoading:.65,linkDecoration:"none",linkHoverDecoration:"none",linkFocusDecoration:"none",controlPaddingHorizontal:12,controlPaddingHorizontalSM:8,paddingXXS:r.sizeXXS,paddingXS:r.sizeXS,paddingSM:r.sizeSM,padding:r.size,paddingMD:r.sizeMD,paddingLG:r.sizeLG,paddingXL:r.sizeXL,paddingContentHorizontalLG:r.sizeLG,paddingContentVerticalLG:r.sizeMS,paddingContentHorizontal:r.sizeMS,paddingContentVertical:r.sizeSM,paddingContentHorizontalSM:r.size,paddingContentVerticalSM:r.sizeXS,marginXXS:r.sizeXXS,marginXS:r.sizeXS,marginSM:r.sizeSM,margin:r.size,marginMD:r.sizeMD,marginLG:r.sizeLG,marginXL:r.sizeXL,marginXXL:r.sizeXXL,boxShadow:"\n 0 1px 2px 0 rgba(0, 0, 0, 0.03),\n 0 1px 6px -1px rgba(0, 0, 0, 0.02),\n 0 2px 4px 0 rgba(0, 0, 0, 0.02)\n ",boxShadowSecondary:"\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowTertiary:"\n 0 1px 2px 0 rgba(0, 0, 0, 0.03),\n 0 1px 6px -1px rgba(0, 0, 0, 0.02),\n 0 2px 4px 0 rgba(0, 0, 0, 0.02)\n ",screenXS:s,screenXSMin:s,screenXSMax:o-1,screenSM:o,screenSMMin:o,screenSMMax:a-1,screenMD:a,screenMDMin:a,screenMDMax:l-1,screenLG:l,screenLGMin:l,screenLGMax:c-1,screenXL:c,screenXLMin:c,screenXLMax:u-1,screenXXL:u,screenXXLMin:u,screenXXLMax:d-1,screenXXXL:d,screenXXXLMin:d,boxShadowPopoverArrow:"3px 3px 7px rgba(0, 0, 0, 0.1)",boxShadowCard:"\n 0 1px 2px -2px ".concat(new vi("rgba(0, 0, 0, 0.16)").toRgbString(),",\n 0 3px 6px 0 ").concat(new vi("rgba(0, 0, 0, 0.12)").toRgbString(),",\n 0 5px 12px 4px ").concat(new vi("rgba(0, 0, 0, 0.09)").toRgbString(),"\n "),boxShadowDrawerRight:"\n -6px 0 16px 0 rgba(0, 0, 0, 0.08),\n -3px 0 6px -4px rgba(0, 0, 0, 0.12),\n -9px 0 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowDrawerLeft:"\n 6px 0 16px 0 rgba(0, 0, 0, 0.08),\n 3px 0 6px -4px rgba(0, 0, 0, 0.12),\n 9px 0 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowDrawerUp:"\n 0 6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 9px 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowDrawerDown:"\n 0 -6px 16px 0 rgba(0, 0, 0, 0.08),\n 0 -3px 6px -4px rgba(0, 0, 0, 0.12),\n 0 -9px 28px 8px rgba(0, 0, 0, 0.05)\n ",boxShadowTabsOverflowLeft:"inset 10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowRight:"inset -10px 0 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowTop:"inset 0 10px 8px -8px rgba(0, 0, 0, 0.08)",boxShadowTabsOverflowBottom:"inset 0 -10px 8px -8px rgba(0, 0, 0, 0.08)"}),i)}const B6=n=>({boxSizing:"border-box",margin:0,padding:0,color:n.colorText,fontSize:n.fontSize,lineHeight:n.lineHeight,listStyle:"none",fontFamily:n.fontFamily}),CY=()=>({display:"inline-flex",alignItems:"center",color:"inherit",fontStyle:"normal",lineHeight:0,textAlign:"center",textTransform:"none",verticalAlign:"-0.125em",textRendering:"optimizeLegibility","-webkit-font-smoothing":"antialiased","-moz-osx-font-smoothing":"grayscale","> *":{lineHeight:1},svg:{display:"inline-block"}}),EY=n=>({a:{color:n.colorLink,textDecoration:n.linkDecoration,backgroundColor:"transparent",outline:"none",cursor:"pointer",transition:"color ".concat(n.motionDurationSlow),"-webkit-text-decoration-skip":"objects","&:hover":{color:n.colorLinkHover},"&:active":{color:n.colorLinkActive},"&:active,\n &:hover":{textDecoration:n.linkHoverDecoration,outline:0},"&:focus":{textDecoration:n.linkFocusDecoration,outline:0},"&[disabled]":{color:n.colorTextDisabled,cursor:"not-allowed"}}}),MY=(n,e)=>{const{fontFamily:t,fontSize:i}=n,r='[class^="'.concat(e,'"], [class*=" ').concat(e,'"]');return{[r]:{fontFamily:t,fontSize:i,boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"},[r]:{boxSizing:"border-box","&::before, &::after":{boxSizing:"border-box"}}}}};function Hx(n,e,t){return i=>{const r=Ge(()=>i==null?void 0:i.value),[s,o,a]=R0(),{getPrefixCls:l,iconPrefixCls:c}=a6(),u=Ge(()=>l()),d=Ge(()=>({theme:s.value,token:o.value,hashId:a.value,path:["Shared",u.value]}));gv(d,()=>[{"&":EY(o.value)}]);const h=Ge(()=>({theme:s.value,token:o.value,hashId:a.value,path:[n,r.value,c.value]}));return[gv(h,()=>{const{token:f,flush:p}=IY(o.value),g=typeof t=="function"?t(f):t,y=Ue(Ue({},g),o.value[n]),m=".".concat(r.value),v=M0(f,{componentCls:m,prefixCls:r.value,iconCls:".".concat(c.value),antCls:".".concat(u.value)},y),x=e(v,{hashId:a.value,prefixCls:r.value,rootPrefixCls:u.value,iconPrefixCls:c.value,overrideComponentToken:o.value[n]});return p(n,y),[MY(o.value,r.value),x]}),a]}}const k6=typeof CSSINJS_STATISTIC<"u";let xv=!0;function M0(){for(var n=arguments.length,e=new Array(n),t=0;t{Object.keys(r).forEach(o=>{Object.defineProperty(i,o,{configurable:!0,enumerable:!0,get:()=>r[o]})})}),xv=!0,i}function RY(){}function IY(n){let e,t=n,i=RY;return k6&&(e=new Set,t=new Proxy(n,{get(r,s){return xv&&e.add(s),r[s]}}),i=(r,s)=>{Array.from(e)}),{token:t,keys:e,flush:i}}const NY=b6(bY),U6={token:E0,hashed:!0},z6=Symbol("DesignTokenContext"),Sv=Nr(),PY=n=>{ta(z6,n),ci(n,()=>{Sv.value=We(n),XI(Sv)},{immediate:!0,deep:!0})},LY=rn({props:{value:Sr()},setup(n,e){let{slots:t}=e;return PY(Ge(()=>n.value)),()=>{var i;return(i=t.default)===null||i===void 0?void 0:i.call(t)}}});function R0(){const n=Ji(z6,Ge(()=>Sv.value||U6)),e=Ge(()=>"".concat(KK,"-").concat(n.value.hashed||"")),t=Ge(()=>n.value.theme||NY),i=bK(t,Ge(()=>[E0,n.value.token]),Ge(()=>({salt:e.value,override:Ue({override:n.value.token},n.value.components),formatToken:wY})));return[t,Ge(()=>i.value[0]),Ge(()=>n.value.hashed?i.value[1]:"")]}const $x=rn({compatConfig:{MODE:3},setup(){const[,n]=R0(),e=Ge(()=>new vi(n.value.colorBgBase).toHsl().l<.5?{opacity:.65}:{});return()=>Re("svg",{style:e.value,width:"184",height:"152",viewBox:"0 0 184 152",xmlns:"http://www.w3.org/2000/svg"},[Re("g",{fill:"none","fill-rule":"evenodd"},[Re("g",{transform:"translate(24 31.67)"},[Re("ellipse",{"fill-opacity":".8",fill:"#F5F5F7",cx:"67.797",cy:"106.89",rx:"67.797",ry:"12.668"},null),Re("path",{d:"M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",fill:"#AEB8C2"},null),Re("path",{d:"M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",fill:"url(#linearGradient-1)",transform:"translate(13.56)"},null),Re("path",{d:"M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",fill:"#F5F5F7"},null),Re("path",{d:"M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",fill:"#DCE0E6"},null)]),Re("path",{d:"M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",fill:"#DCE0E6"},null),Re("g",{transform:"translate(149.65 15.383)",fill:"#FFF"},[Re("ellipse",{cx:"20.654",cy:"3.167",rx:"2.849",ry:"2.815"},null),Re("path",{d:"M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z"},null)])])])}});$x.PRESENTED_IMAGE_DEFAULT=!0;const V6=rn({compatConfig:{MODE:3},setup(){const[,n]=R0(),e=Ge(()=>{const{colorFill:t,colorFillTertiary:i,colorFillQuaternary:r,colorBgContainer:s}=n.value;return{borderColor:new vi(t).onBackground(s).toHexString(),shadowColor:new vi(i).onBackground(s).toHexString(),contentColor:new vi(r).onBackground(s).toHexString()}});return()=>Re("svg",{width:"64",height:"41",viewBox:"0 0 64 41",xmlns:"http://www.w3.org/2000/svg"},[Re("g",{transform:"translate(0 1)",fill:"none","fill-rule":"evenodd"},[Re("ellipse",{fill:e.value.shadowColor,cx:"32",cy:"33",rx:"32",ry:"7"},null),Re("g",{"fill-rule":"nonzero",stroke:e.value.borderColor},[Re("path",{d:"M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"},null),Re("path",{d:"M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z",fill:e.value.contentColor},null)])])])}});V6.PRESENTED_IMAGE_SIMPLE=!0;const DY=n=>{const{componentCls:e,margin:t,marginXS:i,marginXL:r,fontSize:s,lineHeight:o}=n;return{[e]:{marginInline:i,fontSize:s,lineHeight:o,textAlign:"center",["".concat(e,"-image")]:{height:n.emptyImgHeight,marginBottom:i,opacity:n.opacityImage,img:{height:"100%"},svg:{height:"100%",margin:"auto"}},["".concat(e,"-footer")]:{marginTop:t},"&-normal":{marginBlock:r,color:n.colorTextDisabled,["".concat(e,"-image")]:{height:n.emptyImgHeightMD}},"&-small":{marginBlock:i,color:n.colorTextDisabled,["".concat(e,"-image")]:{height:n.emptyImgHeightSM}}}}},FY=Hx("Empty",n=>{const{componentCls:e,controlHeightLG:t}=n,i=M0(n,{emptyImgCls:"".concat(e,"-img"),emptyImgHeight:t*2.5,emptyImgHeightMD:t,emptyImgHeightSM:t*.875});return[DY(i)]});var OY=function(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({prefixCls:String,imageStyle:Sr(),image:dv(),description:dv()}),Gx=rn({name:"AEmpty",compatConfig:{MODE:3},inheritAttrs:!1,props:BY(),setup(n,e){let{slots:t={},attrs:i}=e;const{direction:r,prefixCls:s}=I0("empty",n),[o,a]=FY(s);return()=>{var l,c;const u=s.value,d=Ue(Ue({},n),i),{image:h=((l=t.image)===null||l===void 0?void 0:l.call(t))||Da($x),description:f=((c=t.description)===null||c===void 0?void 0:c.call(t))||void 0,imageStyle:p,class:g=""}=d,y=OY(d,["image","description","imageStyle","class"]),m=typeof h=="function"?h():h,v=typeof m=="object"&&"type"in m&&m.type.PRESENTED_IMAGE_SIMPLE;return o(Re(d6,{componentName:"Empty",children:x=>{const _=typeof f<"u"?f:x.description,S=typeof _=="string"?_:"empty";let E=null;return typeof m=="string"?E=Re("img",{alt:S,src:m},null):E=m,Re("div",yi({class:kr(u,g,a.value,{["".concat(u,"-normal")]:v,["".concat(u,"-rtl")]:r.value==="rtl"})},y),[Re("div",{class:"".concat(u,"-image"),style:p},[E]),_&&Re("p",{class:"".concat(u,"-description")},[_]),t.default&&Re("div",{class:"".concat(u,"-footer")},[s6(t.default())])])}},null))}}});Gx.PRESENTED_IMAGE_DEFAULT=()=>Da($x);Gx.PRESENTED_IMAGE_SIMPLE=()=>Da(V6);const xd=Ox(Gx),H6=n=>{const{prefixCls:e}=I0("empty",n);return(i=>{switch(i){case"Table":case"List":return Re(xd,{image:xd.PRESENTED_IMAGE_SIMPLE},null);case"Select":case"TreeSelect":case"Cascader":case"Transfer":case"Mentions":return Re(xd,{image:xd.PRESENTED_IMAGE_SIMPLE,class:"".concat(e.value,"-small")},null);default:return Re(xd,null,null)}})(n.componentName)};function kY(n){return Re(H6,{componentName:n},null)}const $6=Symbol("SizeContextKey"),G6=()=>Ji($6,Dn(void 0)),UY=n=>{const e=G6();return ta($6,Ge(()=>n.value||e.value)),n},I0=(n,e)=>{const t=G6(),i=c6(),r=Ji(kx,Ue(Ue({},o6),{renderEmpty:A=>Da(H6,{componentName:A})})),s=Ge(()=>r.getPrefixCls(n,e.prefixCls)),o=Ge(()=>{var A,R;return(A=e.direction)!==null&&A!==void 0?A:(R=r.direction)===null||R===void 0?void 0:R.value}),a=Ge(()=>{var A;return(A=e.iconPrefixCls)!==null&&A!==void 0?A:r.iconPrefixCls.value}),l=Ge(()=>r.getPrefixCls()),c=Ge(()=>{var A;return(A=r.autoInsertSpaceInButton)===null||A===void 0?void 0:A.value}),u=r.renderEmpty,d=r.space,h=r.pageHeader,f=r.form,p=Ge(()=>{var A,R;return(A=e.getTargetContainer)!==null&&A!==void 0?A:(R=r.getTargetContainer)===null||R===void 0?void 0:R.value}),g=Ge(()=>{var A,R,w;return(R=(A=e.getContainer)!==null&&A!==void 0?A:e.getPopupContainer)!==null&&R!==void 0?R:(w=r.getPopupContainer)===null||w===void 0?void 0:w.value}),y=Ge(()=>{var A,R;return(A=e.dropdownMatchSelectWidth)!==null&&A!==void 0?A:(R=r.dropdownMatchSelectWidth)===null||R===void 0?void 0:R.value}),m=Ge(()=>{var A;return(e.virtual===void 0?((A=r.virtual)===null||A===void 0?void 0:A.value)!==!1:e.virtual!==!1)&&y.value!==!1}),v=Ge(()=>e.size||t.value),x=Ge(()=>{var A,R,w;return(A=e.autocomplete)!==null&&A!==void 0?A:(w=(R=r.input)===null||R===void 0?void 0:R.value)===null||w===void 0?void 0:w.autocomplete}),_=Ge(()=>{var A;return(A=e.disabled)!==null&&A!==void 0?A:i.value}),S=Ge(()=>{var A;return(A=e.csp)!==null&&A!==void 0?A:r.csp}),E=Ge(()=>{var A,R;return(A=e.wave)!==null&&A!==void 0?A:(R=r.wave)===null||R===void 0?void 0:R.value});return{configProvider:r,prefixCls:s,direction:o,size:v,getTargetContainer:p,getPopupContainer:g,space:d,pageHeader:h,form:f,autoInsertSpaceInButton:c,renderEmpty:u,virtual:m,dropdownMatchSelectWidth:y,rootPrefixCls:l,getPrefixCls:r.getPrefixCls,autocomplete:x,csp:S,iconPrefixCls:a,disabled:_,select:r.select,wave:E}};function zY(n,e){for(var t=0;t=0||(r[t]=n[t]);return r}function A3(n){return((e=n)!=null&&typeof e=="object"&&Array.isArray(e)===!1)==1&&Object.prototype.toString.call(n)==="[object Object]";var e}var q6=Object.prototype,X6=q6.toString,VY=q6.hasOwnProperty,K6=/^\s*function (\w+)/;function b3(n){var e,t=(e=n==null?void 0:n.type)!==null&&e!==void 0?e:n;if(t){var i=t.toString().match(K6);return i?i[1]:""}return""}var Gl=function(n){var e,t;return A3(n)!==!1&&typeof(e=n.constructor)=="function"&&A3(t=e.prototype)!==!1&&t.hasOwnProperty("isPrototypeOf")!==!1},HY=function(n){return n},Dr=HY,Ah=function(n,e){return VY.call(n,e)},$Y=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n},wu=Array.isArray||function(n){return X6.call(n)==="[object Array]"},Cu=function(n){return X6.call(n)==="[object Function]"},Lm=function(n){return Gl(n)&&Ah(n,"_vueTypes_name")},Y6=function(n){return Gl(n)&&(Ah(n,"type")||["_vueTypes_name","validator","default","required"].some(function(e){return Ah(n,e)}))};function Wx(n,e){return Object.defineProperty(n.bind(e),"__original",{value:n})}function Xl(n,e,t){var i,r=!0,s="";i=Gl(n)?n:{type:n};var o=Lm(i)?i._vueTypes_name+" - ":"";if(Y6(i)&&i.type!==null){if(i.type===void 0||i.type===!0||!i.required&&e===void 0)return r;wu(i.type)?(r=i.type.some(function(d){return Xl(d,e)===!0}),s=i.type.map(function(d){return b3(d)}).join(" or ")):r=(s=b3(i))==="Array"?wu(e):s==="Object"?Gl(e):s==="String"||s==="Number"||s==="Boolean"||s==="Function"?function(d){if(d==null)return"";var h=d.constructor.toString().match(K6);return h?h[1]:""}(e)===s:e instanceof i.type}if(!r){var a=o+'value "'+e+'" should be of type "'+s+'"';return a}if(Ah(i,"validator")&&Cu(i.validator)){var l=Dr,c=[];if(Dr=function(d){c.push(d)},r=i.validator(e),Dr=l,!r){var u=(c.length>1?"* ":"")+c.join("\n* ");return c.length=0,u}}return r}function Or(n,e){var t=Object.defineProperties(e,{_vueTypes_name:{value:n,writable:!0},isRequired:{get:function(){return this.required=!0,this}},def:{value:function(r){return r!==void 0||this.default?Cu(r)||Xl(this,r)===!0?(this.default=wu(r)?function(){return[].concat(r)}:Gl(r)?function(){return Object.assign({},r)}:r,this):(Dr(this._vueTypes_name+' - invalid default value: "'+r+'"'),this):this}}}),i=t.validator;return Cu(i)&&(t.validator=Wx(i,t)),t}function io(n,e){var t=Or(n,e);return Object.defineProperty(t,"validate",{value:function(i){return Cu(this.validator)&&Dr(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=Wx(i,this),this}})}function T3(n,e,t){var i,r,s=(i=e,r={},Object.getOwnPropertyNames(i).forEach(function(d){r[d]=Object.getOwnPropertyDescriptor(i,d)}),Object.defineProperties({},r));if(s._vueTypes_name=n,!Gl(t))return s;var o,a,l=t.validator,c=j6(t,["validator"]);if(Cu(l)){var u=s.validator;u&&(u=(a=(o=u).__original)!==null&&a!==void 0?a:o),s.validator=Wx(u?function(d){return u.call(this,d)&&l.call(this,d)}:l,s)}return Object.assign(s,c)}function N0(n){return n.replace(/^(?!\s*$)/gm," ")}var GY=function(){return io("any",{})},WY=function(){return io("function",{type:Function})},QY=function(){return io("boolean",{type:Boolean})},jY=function(){return io("string",{type:String})},qY=function(){return io("number",{type:Number})},XY=function(){return io("array",{type:Array})},KY=function(){return io("object",{type:Object})},YY=function(){return Or("integer",{type:Number,validator:function(n){return $Y(n)}})},ZY=function(){return Or("symbol",{validator:function(n){return typeof n=="symbol"}})};function JY(n,e){if(e===void 0&&(e="custom validation failed"),typeof n!="function")throw new TypeError("[VueTypes error]: You must provide a function as argument");return Or(n.name||"<>",{validator:function(t){var i=n(t);return i||Dr(this._vueTypes_name+" - "+e),i}})}function eZ(n){if(!wu(n))throw new TypeError("[VueTypes error]: You must provide an array as argument.");var e='oneOf - value should be one of "'+n.join('", "')+'".',t=n.reduce(function(i,r){if(r!=null){var s=r.constructor;i.indexOf(s)===-1&&i.push(s)}return i},[]);return Or("oneOf",{type:t.length>0?t:void 0,validator:function(i){var r=n.indexOf(i)!==-1;return r||Dr(e),r}})}function tZ(n){if(!wu(n))throw new TypeError("[VueTypes error]: You must provide an array as argument");for(var e=!1,t=[],i=0;i0&&t.some(function(l){return o.indexOf(l)===-1})){var a=t.filter(function(l){return o.indexOf(l)===-1});return Dr(a.length===1?'shape - required property "'+a[0]+'" is not defined.':'shape - required properties "'+a.join('", "')+'" are not defined.'),!1}return o.every(function(l){if(e.indexOf(l)===-1)return s._vueTypes_isLoose===!0||(Dr('shape - shape definition does not include a "'+l+'" property. Allowed keys: "'+e.join('", "')+'".'),!1);var c=Xl(n[l],r[l]);return typeof c=="string"&&Dr('shape - "'+l+'" property validation error:\n '+N0(c)),c===!0})}});return Object.defineProperty(i,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(i,"loose",{get:function(){return this._vueTypes_isLoose=!0,this}}),i}var Ds=function(){function n(){}return n.extend=function(e){var t=this;if(wu(e))return e.forEach(function(d){return t.extend(d)}),this;var i=e.name,r=e.validate,s=r!==void 0&&r,o=e.getter,a=o!==void 0&&o,l=j6(e,["name","validate","getter"]);if(Ah(this,i))throw new TypeError('[VueTypes error]: Type "'+i+'" already defined');var c,u=l.type;return Lm(u)?(delete l.type,Object.defineProperty(this,i,a?{get:function(){return T3(i,u,l)}}:{value:function(){var d,h=T3(i,u,l);return h.validator&&(h.validator=(d=h.validator).bind.apply(d,[h].concat([].slice.call(arguments)))),h}})):(c=a?{get:function(){var d=Object.assign({},l);return s?io(i,d):Or(i,d)},enumerable:!0}:{value:function(){var d,h,f=Object.assign({},l);return d=s?io(i,f):Or(i,f),f.validator&&(d.validator=(h=f.validator).bind.apply(h,[d].concat([].slice.call(arguments)))),d},enumerable:!0},Object.defineProperty(this,i,c))},W6(n,null,[{key:"any",get:function(){return GY()}},{key:"func",get:function(){return WY().def(this.defaults.func)}},{key:"bool",get:function(){return QY().def(this.defaults.bool)}},{key:"string",get:function(){return jY().def(this.defaults.string)}},{key:"number",get:function(){return qY().def(this.defaults.number)}},{key:"array",get:function(){return XY().def(this.defaults.array)}},{key:"object",get:function(){return KY().def(this.defaults.object)}},{key:"integer",get:function(){return YY().def(this.defaults.integer)}},{key:"symbol",get:function(){return ZY()}}]),n}();function Z6(n){var e;return n===void 0&&(n={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(e=function(t){function i(){return t.apply(this,arguments)||this}return Q6(i,t),W6(i,null,[{key:"sensibleDefaults",get:function(){return Vp({},this.defaults)},set:function(r){this.defaults=r!==!1?Vp({},r!==!0?r:n):{}}}]),i}(Ds)).defaults=Vp({},n),e}Ds.defaults={},Ds.custom=JY,Ds.oneOf=eZ,Ds.instanceOf=iZ,Ds.oneOfType=tZ,Ds.arrayOf=nZ,Ds.objectOf=rZ,Ds.shape=sZ,Ds.utils={validate:function(n,e){return Xl(e,n)===!0},toType:function(n,e,t){return t===void 0&&(t=!1),t?io(n,e):Or(n,e)}};(function(n){function e(){return n.apply(this,arguments)||this}return Q6(e,n),e})(Z6());const J6=Z6({func:void 0,bool:void 0,string:void 0,number:void 0,array:void 0,object:void 0,integer:void 0});J6.extend([{name:"looseBool",getter:!0,type:Boolean,default:void 0},{name:"style",getter:!0,type:[String,Object],default:void 0},{name:"VueNode",getter:!0,type:null}]);function oZ(n){let{prefixCls:e,animation:t,transitionName:i}=n;return t?{name:"".concat(e,"-").concat(t)}:i?{name:i}:{}}XX("bottomLeft","bottomRight","topLeft","topRight");const eR=function(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Ue(n?{name:n,appear:!0,appearActiveClass:"".concat(n),appearToClass:"".concat(n,"-appear ").concat(n,"-appear-active"),enterFromClass:"".concat(n,"-appear ").concat(n,"-enter ").concat(n,"-appear-prepare ").concat(n,"-enter-prepare"),enterActiveClass:"".concat(n),enterToClass:"".concat(n,"-enter ").concat(n,"-appear ").concat(n,"-appear-active ").concat(n,"-enter-active"),leaveActiveClass:"".concat(n," ").concat(n,"-leave"),leaveToClass:"".concat(n,"-leave-active")}:{css:!1},e)},tR=Symbol("PortalContextKey"),aZ=function(n){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{inTriggerContext:!0};ta(tR,{inTriggerContext:e.inTriggerContext,shouldRender:Ge(()=>{const{sPopupVisible:t,popupRef:i,forceRender:r,autoDestroy:s}=n||{};let o=!1;return(t||i||r)&&(o=!0),!t&&s&&(o=!1),o})})},lZ=()=>{aZ({},{inTriggerContext:!1});const n=Ji(tR,{shouldRender:Ge(()=>!1),inTriggerContext:!1});return{shouldRender:Ge(()=>n.shouldRender.value||n.inTriggerContext===!1)}},cZ=rn({compatConfig:{MODE:3},name:"Portal",inheritAttrs:!1,props:{getContainer:J6.func.isRequired,didUpdate:Function},setup(n,e){let{slots:t}=e,i=!0,r;const{shouldRender:s}=lZ();function o(){s.value&&(r=n.getContainer())}yw(()=>{i=!1,o()}),ka(()=>{r||o()});const a=ci(s,()=>{s.value&&!r&&(r=n.getContainer()),r&&a()});return Zv(()=>{Ph(()=>{var l;s.value&&((l=n.didUpdate)===null||l===void 0||l.call(n,n))})}),()=>{var l;return s.value?i?(l=t.default)===null||l===void 0?void 0:l.call(t):r?Re(dw,{to:r},t):null:null}}});var uZ=Symbol("iconContext"),nR=function(){return Ji(uZ,{prefixCls:Dn("anticon"),rootClassName:Dn(""),csp:Dn()})};function Qx(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}function dZ(n,e){return n&&n.contains?n.contains(e):!1}var w3="data-vc-order",hZ="vc-icon-key",Av=new Map;function iR(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=n.mark;return e?e.startsWith("data-")?e:"data-".concat(e):hZ}function jx(n){if(n.attachTo)return n.attachTo;var e=document.querySelector("head");return e||document.body}function fZ(n){return n==="queue"?"prependQueue":n?"prepend":"append"}function rR(n){return Array.from((Av.get(n)||n).children).filter(function(e){return e.tagName==="STYLE"})}function sR(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!Qx())return null;var t=e.csp,i=e.prepend,r=document.createElement("style");r.setAttribute(w3,fZ(i)),t&&t.nonce&&(r.nonce=t.nonce),r.innerHTML=n;var s=jx(e),o=s.firstChild;if(i){if(i==="queue"){var a=rR(s).filter(function(l){return["prepend","prependQueue"].includes(l.getAttribute(w3))});if(a.length)return s.insertBefore(r,a[a.length-1].nextSibling),r}s.insertBefore(r,o)}else s.appendChild(r);return r}function pZ(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=jx(e);return rR(t).find(function(i){return i.getAttribute(iR(e))===n})}function mZ(n,e){var t=Av.get(n);if(!t||!dZ(document,t)){var i=sR("",e),r=i.parentNode;Av.set(n,r),n.removeChild(i)}}function gZ(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=jx(t);mZ(i,t);var r=pZ(e,t);if(r)return t.csp&&t.csp.nonce&&r.nonce!==t.csp.nonce&&(r.nonce=t.csp.nonce),r.innerHTML!==n&&(r.innerHTML=n),r;var s=sR(n,t);return s.setAttribute(iR(t),e),s}function C3(n){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function TZ(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}function Hp(n){for(var e=1;en.length)&&(e=n.length);for(var t=0,i=new Array(e);tn.length)&&(e=n.length);for(var t=0,i=new Array(e);t=0)&&Object.prototype.propertyIsEnumerable.call(n,i)&&(t[i]=n[i])}return t}function HZ(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}cR(fY.primary);var Ui=function(e,t){var i,r=I3({},e,t.attrs),s=r.class,o=r.icon,a=r.spin,l=r.rotate,c=r.tabindex,u=r.twoToneColor,d=r.onClick,h=VZ(r,FZ),f=nR(),p=f.prefixCls,g=f.rootClassName,y=(i={},wd(i,g.value,!!g.value),wd(i,p.value,!0),wd(i,"".concat(p.value,"-").concat(o.name),!!o.name),wd(i,"".concat(p.value,"-spin"),!!a||o.name==="loading"),i),m=c;m===void 0&&d&&(m=-1);var v=l?{msTransform:"rotate(".concat(l,"deg)"),transform:"rotate(".concat(l,"deg)")}:void 0,x=aR(u),_=OZ(x,2),S=_[0],E=_[1];return Re("span",I3({role:"img","aria-label":o.name},h,{onClick:d,class:[y,s],tabindex:m}),[Re(Ha,{icon:o,primaryColor:S,secondaryColor:E,style:v},null),Re(DZ,null,null)])};Ui.props={spin:Boolean,rotate:Number,icon:Object,twoToneColor:[String,Array]};Ui.displayName="AntdIcon";Ui.inheritAttrs=!1;Ui.getTwoToneColor=LZ;Ui.setTwoToneColor=cR;var $Z={icon:{tag:"svg",attrs:{viewBox:"0 0 1024 1024",focusable:"false"},children:[{tag:"path",attrs:{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"}}]},name:"loading",theme:"outlined"};function N3(n){for(var e=1;en.locale,r=>{cJ(r&&r.Modal),i.antLocale=Ue(Ue({},r),{exist:!0})},{immediate:!0}),()=>{var r;return(r=t.default)===null||r===void 0?void 0:r.call(t)}}});$p.install=function(n){return n.component($p.name,$p),n};const uJ=Ox($p),uR=rn({name:"Notice",inheritAttrs:!1,props:["prefixCls","duration","updateMark","noticeKey","closeIcon","closable","props","onClick","onClose","holder","visible"],setup(n,e){let{attrs:t,slots:i}=e,r,s=!1;const o=Ge(()=>n.duration===void 0?4.5:n.duration),a=()=>{o.value&&!s&&(r=setTimeout(()=>{c()},o.value*1e3))},l=()=>{r&&(clearTimeout(r),r=null)},c=d=>{d&&d.stopPropagation(),l();const{onClose:h,noticeKey:f}=n;h&&h(f)},u=()=>{l(),a()};return ka(()=>{a()}),Lh(()=>{s=!0,l()}),ci([o,()=>n.updateMark,()=>n.visible],(d,h)=>{let[f,p,g]=d,[y,m,v]=h;(f!==y||p!==m||g!==v&&v)&&u()},{flush:"post"}),()=>{var d,h;const{prefixCls:f,closable:p,closeIcon:g=(d=i.closeIcon)===null||d===void 0?void 0:d.call(i),onClick:y,holder:m}=n,{class:v,style:x}=t,_="".concat(f,"-notice"),S=Object.keys(t).reduce((A,R)=>((R.startsWith("data-")||R.startsWith("aria-")||R==="role")&&(A[R]=t[R]),A),{}),E=Re("div",yi({class:kr(_,v,{["".concat(_,"-closable")]:p}),style:x,onMouseenter:l,onMouseleave:a,onClick:y},S),[Re("div",{class:"".concat(_,"-content")},[(h=i.default)===null||h===void 0?void 0:h.call(i)]),p?Re("a",{tabindex:0,onClick:c,class:"".concat(_,"-close")},[g||Re("span",{class:"".concat(_,"-close-x")},null)]):null]);return m?Re(dw,{to:m},{default:()=>E}):E}}});var dJ=function(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{const{prefixCls:u,animation:d="fade"}=n;let h=n.transitionName;return!h&&d&&(h="".concat(u,"-").concat(d)),eR(h)}),l=(u,d)=>{const h=u.key||H3(),f=Ue(Ue({},u),{key:h}),{maxCount:p}=n,g=o.value.map(m=>m.notice.key).indexOf(h),y=o.value.concat();g!==-1?y.splice(g,1,{notice:f,holderCallback:d}):(p&&o.value.length>=p&&(f.key=y[0].notice.key,f.updateMark=H3(),f.userPassKey=h,y.shift()),y.push({notice:f,holderCallback:d})),o.value=y},c=u=>{o.value=Ot(o.value).filter(d=>{let{notice:{key:h,userPassKey:f}}=d;return(f||h)!==u})};return i({add:l,remove:c,notices:o}),()=>{var u;const{prefixCls:d,closeIcon:h=(u=r.closeIcon)===null||u===void 0?void 0:u.call(r,{prefixCls:d})}=n,f=o.value.map((g,y)=>{let{notice:m,holderCallback:v}=g;const x=y===o.value.length-1?m.updateMark:void 0,{key:_,userPassKey:S}=m,{content:E}=m,A=Ue(Ue(Ue({prefixCls:d,closeIcon:typeof h=="function"?h({prefixCls:d}):h},m),m.props),{key:_,noticeKey:S||_,updateMark:x,onClose:R=>{var w;c(R),(w=m.onClose)===null||w===void 0||w.call(m)},onClick:m.onClick});return v?Re("div",{key:_,class:"".concat(d,"-hook-holder"),ref:R=>{typeof _>"u"||(R?(s.set(_,R),v(R,A)):s.delete(_))}},null):Re(uR,yi(yi({},A),{},{class:kr(A.class,n.hashId)}),{default:()=>[typeof E=="function"?E({prefixCls:d}):E]})}),p={[d]:1,[t.class]:!!t.class,[n.hashId]:!0};return Re("div",{class:p,style:t.style||{top:"65px",left:"50%"}},[Re(Qw,yi({tag:"div"},a.value),{default:()=>[f]})])}}});Dm.newInstance=function(e,t){const i=e||{},{name:r="notification",getContainer:s,appContext:o,prefixCls:a,rootPrefixCls:l,transitionName:c,hasTransitionName:u,useStyle:d}=i,h=dJ(i,["name","getContainer","appContext","prefixCls","rootPrefixCls","transitionName","hasTransitionName","useStyle"]),f=document.createElement("div");s?s().appendChild(f):document.body.appendChild(f);const g=Re(rn({compatConfig:{MODE:3},name:"NotificationWrapper",setup(y,m){let{attrs:v}=m;const x=Nr(),_=Ge(()=>Ii.getPrefixCls(r,a)),[,S]=d(_);return ka(()=>{t({notice(E){var A;(A=x.value)===null||A===void 0||A.add(E)},removeNotice(E){var A;(A=x.value)===null||A===void 0||A.remove(E)},destroy(){eS(null,f),f.parentNode&&f.parentNode.removeChild(f)},component:x})}),()=>{const E=Ii,A=E.getRootPrefixCls(l,_.value),R=u?c:"".concat(_.value,"-").concat(c);return Re(Jc,yi(yi({},E),{},{prefixCls:A}),{default:()=>[Re(Dm,yi(yi({ref:x},v),{},{prefixCls:_.value,transitionName:R,hashId:S.value}),null)]})}}}),h);g.appContext=o||g.appContext,eS(g,f)};let $3=0;const fJ=Date.now();function G3(){const n=$3;return $3+=1,"rcNotification_".concat(fJ,"_").concat(n)}const pJ=rn({name:"HookNotification",inheritAttrs:!1,props:["prefixCls","transitionName","animation","maxCount","closeIcon","hashId","remove","notices","getStyles","getClassName","onAllRemoved","getContainer"],setup(n,e){let{attrs:t,slots:i}=e;const r=new Map,s=Ge(()=>n.notices),o=Ge(()=>{let u=n.transitionName;if(!u&&n.animation)switch(typeof n.animation){case"string":u=n.animation;break;case"function":u=n.animation().name;break;case"object":u=n.animation.name;break;default:u="".concat(n.prefixCls,"-fade");break}return eR(u)}),a=u=>n.remove(u),l=Dn({});ci(s,()=>{const u={};Object.keys(l.value).forEach(d=>{u[d]=[]}),n.notices.forEach(d=>{const{placement:h="topRight"}=d.notice;h&&(u[h]=u[h]||[],u[h].push(d))}),l.value=u});const c=Ge(()=>Object.keys(l.value));return()=>{var u;const{prefixCls:d,closeIcon:h=(u=i.closeIcon)===null||u===void 0?void 0:u.call(i,{prefixCls:d})}=n,f=c.value.map(p=>{var g,y;const m=l.value[p],v=(g=n.getClassName)===null||g===void 0?void 0:g.call(n,p),x=(y=n.getStyles)===null||y===void 0?void 0:y.call(n,p),_=m.map((A,R)=>{let{notice:w,holderCallback:M}=A;const I=R===s.value.length-1?w.updateMark:void 0,{key:L,userPassKey:k}=w,{content:T}=w,F=Ue(Ue(Ue({prefixCls:d,closeIcon:typeof h=="function"?h({prefixCls:d}):h},w),w.props),{key:L,noticeKey:k||L,updateMark:I,onClose:V=>{var Q;a(V),(Q=w.onClose)===null||Q===void 0||Q.call(w)},onClick:w.onClick});return M?Re("div",{key:L,class:"".concat(d,"-hook-holder"),ref:V=>{typeof L>"u"||(V?(r.set(L,V),M(V,F)):r.delete(L))}},null):Re(uR,yi(yi({},F),{},{class:kr(F.class,n.hashId)}),{default:()=>[typeof T=="function"?T({prefixCls:d}):T]})}),S={[d]:1,["".concat(d,"-").concat(p)]:1,[t.class]:!!t.class,[n.hashId]:!0,[v]:!!v};function E(){var A;m.length>0||(Reflect.deleteProperty(l.value,p),(A=n.onAllRemoved)===null||A===void 0||A.call(n))}return Re("div",{key:p,class:S,style:t.style||x||{top:"65px",left:"50%"}},[Re(Qw,yi(yi({tag:"div"},o.value),{},{onAfterLeave:E}),{default:()=>[_]})])});return Re(cZ,{getContainer:n.getContainer},{default:()=>[f]})}}});var mJ=function(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);rdocument.body;let W3=0;function yJ(){const n={};for(var e=arguments.length,t=new Array(e),i=0;i{r&&Object.keys(r).forEach(s=>{const o=r[s];o!==void 0&&(n[s]=o)})}),n}function dR(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{getContainer:e=gJ,motion:t,prefixCls:i,maxCount:r,getClassName:s,getStyles:o,onAllRemoved:a}=n,l=mJ(n,["getContainer","motion","prefixCls","maxCount","getClassName","getStyles","onAllRemoved"]),c=Nr([]),u=Nr(),d=(m,v)=>{const x=m.key||G3(),_=Ue(Ue({},m),{key:x}),S=c.value.map(A=>A.notice.key).indexOf(x),E=c.value.concat();S!==-1?E.splice(S,1,{notice:_,holderCallback:v}):(r&&c.value.length>=r&&(_.key=E[0].notice.key,_.updateMark=G3(),_.userPassKey=x,E.shift()),E.push({notice:_,holderCallback:v})),c.value=E},h=m=>{c.value=c.value.filter(v=>{let{notice:{key:x,userPassKey:_}}=v;return(_||x)!==m})},f=()=>{c.value=[]},p=()=>Re(pJ,{ref:u,prefixCls:i,maxCount:r,notices:c.value,remove:h,getClassName:s,getStyles:o,animation:t,hashId:n.hashId,onAllRemoved:a,getContainer:e},null),g=Nr([]),y={open:m=>{const v=yJ(l,m);(v.key===null||v.key===void 0)&&(v.key="vc-notification-".concat(W3),W3+=1),g.value=[...g.value,{type:"open",config:v}]},close:m=>{g.value=[...g.value,{type:"close",key:m}]},destroy:()=>{g.value=[...g.value,{type:"destroy"}]}};return ci(g,()=>{g.value.length&&(g.value.forEach(m=>{switch(m.type){case"open":d(m.config);break;case"close":h(m.key);break;case"destroy":f();break}}),g.value=[])}),[y,p]}const vJ=n=>{const{componentCls:e,iconCls:t,boxShadowSecondary:i,colorBgElevated:r,colorSuccess:s,colorError:o,colorWarning:a,colorInfo:l,fontSizeLG:c,motionEaseInOutCirc:u,motionDurationSlow:d,marginXS:h,paddingXS:f,borderRadiusLG:p,zIndexPopup:g,messageNoticeContentPadding:y}=n,m=new Fl("MessageMoveIn",{"0%":{padding:0,transform:"translateY(-100%)",opacity:0},"100%":{padding:f,transform:"translateY(0)",opacity:1}}),v=new Fl("MessageMoveOut",{"0%":{maxHeight:n.height,padding:f,opacity:1},"100%":{maxHeight:0,padding:0,opacity:0}});return[{[e]:Ue(Ue({},B6(n)),{position:"fixed",top:h,left:"50%",transform:"translateX(-50%)",width:"100%",pointerEvents:"none",zIndex:g,["".concat(e,"-move-up")]:{animationFillMode:"forwards"},["\n ".concat(e,"-move-up-appear,\n ").concat(e,"-move-up-enter\n ")]:{animationName:m,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},["\n ".concat(e,"-move-up-appear").concat(e,"-move-up-appear-active,\n ").concat(e,"-move-up-enter").concat(e,"-move-up-enter-active\n ")]:{animationPlayState:"running"},["".concat(e,"-move-up-leave")]:{animationName:v,animationDuration:d,animationPlayState:"paused",animationTimingFunction:u},["".concat(e,"-move-up-leave").concat(e,"-move-up-leave-active")]:{animationPlayState:"running"},"&-rtl":{direction:"rtl",span:{direction:"rtl"}}})},{["".concat(e,"-notice")]:{padding:f,textAlign:"center",[t]:{verticalAlign:"text-bottom",marginInlineEnd:h,fontSize:c},["".concat(e,"-notice-content")]:{display:"inline-block",padding:y,background:r,borderRadius:p,boxShadow:i,pointerEvents:"all"},["".concat(e,"-success ").concat(t)]:{color:s},["".concat(e,"-error ").concat(t)]:{color:o},["".concat(e,"-warning ").concat(t)]:{color:a},["\n ".concat(e,"-info ").concat(t,",\n ").concat(e,"-loading ").concat(t)]:{color:l}}},{["".concat(e,"-notice-pure-panel")]:{padding:0,textAlign:"start"}}]},hR=Hx("Message",n=>{const e=M0(n,{messageNoticeContentPadding:"".concat((n.controlHeightLG-n.fontSize*n.lineHeight)/2,"px ").concat(n.paddingSM,"px")});return[vJ(e)]},n=>({height:150,zIndexPopup:n.zIndexPopupBase+10})),_J={info:Re(qu,null,null),success:Re(Qu,null,null),error:Re(Wu,null,null),warning:Re(ju,null,null),loading:Re(sf,null,null)},xJ=rn({name:"PureContent",inheritAttrs:!1,props:["prefixCls","type","icon"],setup(n,e){let{slots:t}=e;return()=>{var i;return Re("div",{class:kr("".concat(n.prefixCls,"-custom-content"),"".concat(n.prefixCls,"-").concat(n.type))},[n.icon||_J[n.type],Re("span",null,[(i=t.default)===null||i===void 0?void 0:i.call(t)])])}}});var SJ=function(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);rs("message",n.prefixCls)),[,l]=hR(a),c=()=>{var g;const y=(g=n.top)!==null&&g!==void 0?g:AJ;return{left:"50%",transform:"translateX(-50%)",top:typeof y=="number"?"".concat(y,"px"):y}},u=()=>kr(l.value,n.rtl?"".concat(a.value,"-rtl"):""),d=()=>{var g;return oZ({prefixCls:a.value,animation:(g=n.animation)!==null&&g!==void 0?g:"move-up",transitionName:n.transitionName})},h=Re("span",{class:"".concat(a.value,"-close-x")},[Re(of,{class:"".concat(a.value,"-close-icon")},null)]),[f,p]=dR({getStyles:c,prefixCls:a.value,getClassName:u,motion:d,closable:!1,closeIcon:h,duration:(i=n.duration)!==null&&i!==void 0?i:bJ,getContainer:(r=n.staticGetContainer)!==null&&r!==void 0?r:o.value,maxCount:n.maxCount,onAllRemoved:n.onAllRemoved});return t(Ue(Ue({},f),{prefixCls:a,hashId:l})),p}});let Q3=0;function wJ(n){const e=Nr(null),t=Symbol("messageHolderKey"),i=l=>{var c;(c=e.value)===null||c===void 0||c.close(l)},r=l=>{if(!e.value){const S=()=>{};return S.then=()=>{},S}const{open:c,prefixCls:u,hashId:d}=e.value,h="".concat(u,"-notice"),{content:f,icon:p,type:g,key:y,class:m,onClose:v}=l,x=SJ(l,["content","icon","type","key","class","onClose"]);let _=y;return _==null&&(Q3+=1,_="antd-message-".concat(Q3)),jX(S=>(c(Ue(Ue({},x),{key:_,content:()=>Re(xJ,{prefixCls:u,type:g,icon:typeof p=="function"?p():p},{default:()=>[typeof f=="function"?f():f]}),placement:"top",class:kr(g&&"".concat(h,"-").concat(g),d,m),onClose:()=>{v==null||v(),S()}})),()=>{i(_)}))},o={open:r,destroy:l=>{var c;l!==void 0?i(l):(c=e.value)===null||c===void 0||c.destroy()}};return["info","success","warning","error","loading"].forEach(l=>{const c=(u,d,h)=>{let f;u&&typeof u=="object"&&"content"in u?f=u:f={content:u};let p,g;typeof d=="function"?g=d:(p=d,g=h);const y=Ue(Ue({onClose:g,duration:p},f),{type:l});return r(y)};o[l]=c}),[o,()=>Re(TJ,yi(yi({key:t},n),{},{ref:e}),null)]}function CJ(n){return wJ(n)}let fR=3,pR,Yi,EJ=1,mR="",gR="move-up",yR=!1,vR=()=>document.body,_R,xR=!1;function MJ(){return EJ++}function RJ(n){n.top!==void 0&&(pR=n.top,Yi=null),n.duration!==void 0&&(fR=n.duration),n.prefixCls!==void 0&&(mR=n.prefixCls),n.getContainer!==void 0&&(vR=n.getContainer,Yi=null),n.transitionName!==void 0&&(gR=n.transitionName,Yi=null,yR=!0),n.maxCount!==void 0&&(_R=n.maxCount,Yi=null),n.rtl!==void 0&&(xR=n.rtl)}function IJ(n,e){if(Yi){e(Yi);return}Dm.newInstance({appContext:n.appContext,prefixCls:n.prefixCls||mR,rootPrefixCls:n.rootPrefixCls,transitionName:gR,hasTransitionName:yR,style:{top:pR},getContainer:vR||n.getPopupContainer,maxCount:_R,name:"message",useStyle:hR},t=>{if(Yi){e(Yi);return}Yi=t,e(t)})}const SR={info:qu,success:Qu,error:Wu,warning:ju,loading:sf},NJ=Object.keys(SR);function PJ(n){const e=n.duration!==void 0?n.duration:fR,t=n.key||MJ(),i=new Promise(s=>{const o=()=>(typeof n.onClose=="function"&&n.onClose(),s(!0));IJ(n,a=>{a.notice({key:t,duration:e,style:n.style||{},class:n.class,content:l=>{let{prefixCls:c}=l;const u=SR[n.type],d=u?Re(u,null,null):"",h=kr("".concat(c,"-custom-content"),{["".concat(c,"-").concat(n.type)]:n.type,["".concat(c,"-rtl")]:xR===!0});return Re("div",{class:h},[typeof n.icon=="function"?n.icon():n.icon||d,Re("span",null,[typeof n.content=="function"?n.content():n.content])])},onClose:o,onClick:n.onClick})})}),r=()=>{Yi&&Yi.removeNotice(t)};return r.then=(s,o)=>i.then(s,o),r.promise=i,r}function LJ(n){return Object.prototype.toString.call(n)==="[object Object]"&&!!n.content}const Oo={open:PJ,config:RJ,destroy(n){if(Yi)if(n){const{removeNotice:e}=Yi;e(n)}else{const{destroy:e}=Yi;e(),Yi=null}}};function DJ(n,e){n[e]=(t,i,r)=>LJ(t)?n.open(Ue(Ue({},t),{type:e})):(typeof i=="function"&&(r=i,i=void 0),n.open({content:t,duration:i,type:e,onClose:r}))}NJ.forEach(n=>DJ(Oo,n));Oo.warn=Oo.warning;Oo.useMessage=CJ;const FJ=n=>{const{componentCls:e,width:t,notificationMarginEdge:i}=n,r=new Fl("antNotificationTopFadeIn",{"0%":{marginTop:"-100%",opacity:0},"100%":{marginTop:0,opacity:1}}),s=new Fl("antNotificationBottomFadeIn",{"0%":{marginBottom:"-100%",opacity:0},"100%":{marginBottom:0,opacity:1}}),o=new Fl("antNotificationLeftFadeIn",{"0%":{right:{_skip_check_:!0,value:t},opacity:0},"100%":{right:{_skip_check_:!0,value:0},opacity:1}});return{["&".concat(e,"-top, &").concat(e,"-bottom")]:{marginInline:0},["&".concat(e,"-top")]:{["".concat(e,"-fade-enter").concat(e,"-fade-enter-active, ").concat(e,"-fade-appear").concat(e,"-fade-appear-active")]:{animationName:r}},["&".concat(e,"-bottom")]:{["".concat(e,"-fade-enter").concat(e,"-fade-enter-active, ").concat(e,"-fade-appear").concat(e,"-fade-appear-active")]:{animationName:s}},["&".concat(e,"-topLeft, &").concat(e,"-bottomLeft")]:{marginInlineEnd:0,marginInlineStart:i,["".concat(e,"-fade-enter").concat(e,"-fade-enter-active, ").concat(e,"-fade-appear").concat(e,"-fade-appear-active")]:{animationName:o}}}},OJ=n=>{const{iconCls:e,componentCls:t,boxShadowSecondary:i,fontSizeLG:r,notificationMarginBottom:s,borderRadiusLG:o,colorSuccess:a,colorInfo:l,colorWarning:c,colorError:u,colorTextHeading:d,notificationBg:h,notificationPadding:f,notificationMarginEdge:p,motionDurationMid:g,motionEaseInOut:y,fontSize:m,lineHeight:v,width:x,notificationIconSize:_}=n,S="".concat(t,"-notice"),E=new Fl("antNotificationFadeIn",{"0%":{left:{_skip_check_:!0,value:x},opacity:0},"100%":{left:{_skip_check_:!0,value:0},opacity:1}}),A=new Fl("antNotificationFadeOut",{"0%":{maxHeight:n.animationMaxHeight,marginBottom:s,opacity:1},"100%":{maxHeight:0,marginBottom:0,paddingTop:0,paddingBottom:0,opacity:0}});return[{[t]:Ue(Ue(Ue(Ue({},B6(n)),{position:"fixed",zIndex:n.zIndexPopup,marginInlineEnd:p,["".concat(t,"-hook-holder")]:{position:"relative"},["&".concat(t,"-top, &").concat(t,"-bottom")]:{["".concat(t,"-notice")]:{marginInline:"auto auto"}},["&".concat(t,"-topLeft, &").concat(t,"-bottomLeft")]:{["".concat(t,"-notice")]:{marginInlineEnd:"auto",marginInlineStart:0}},["".concat(t,"-fade-enter, ").concat(t,"-fade-appear")]:{animationDuration:n.motionDurationMid,animationTimingFunction:y,animationFillMode:"both",opacity:0,animationPlayState:"paused"},["".concat(t,"-fade-leave")]:{animationTimingFunction:y,animationFillMode:"both",animationDuration:g,animationPlayState:"paused"},["".concat(t,"-fade-enter").concat(t,"-fade-enter-active, ").concat(t,"-fade-appear").concat(t,"-fade-appear-active")]:{animationName:E,animationPlayState:"running"},["".concat(t,"-fade-leave").concat(t,"-fade-leave-active")]:{animationName:A,animationPlayState:"running"}}),FJ(n)),{"&-rtl":{direction:"rtl",["".concat(t,"-notice-btn")]:{float:"left"}}})},{[S]:{position:"relative",width:x,maxWidth:"calc(100vw - ".concat(p*2,"px)"),marginBottom:s,marginInlineStart:"auto",padding:f,overflow:"hidden",lineHeight:v,wordWrap:"break-word",background:h,borderRadius:o,boxShadow:i,["".concat(t,"-close-icon")]:{fontSize:m,cursor:"pointer"},["".concat(S,"-message")]:{marginBottom:n.marginXS,color:d,fontSize:r,lineHeight:n.lineHeightLG},["".concat(S,"-description")]:{fontSize:m},["&".concat(S,"-closable ").concat(S,"-message")]:{paddingInlineEnd:n.paddingLG},["".concat(S,"-with-icon ").concat(S,"-message")]:{marginBottom:n.marginXS,marginInlineStart:n.marginSM+_,fontSize:r},["".concat(S,"-with-icon ").concat(S,"-description")]:{marginInlineStart:n.marginSM+_,fontSize:m},["".concat(S,"-icon")]:{position:"absolute",fontSize:_,lineHeight:0,["&-success".concat(e)]:{color:a},["&-info".concat(e)]:{color:l},["&-warning".concat(e)]:{color:c},["&-error".concat(e)]:{color:u}},["".concat(S,"-close")]:{position:"absolute",top:n.notificationPaddingVertical,insetInlineEnd:n.notificationPaddingHorizontal,color:n.colorIcon,outline:"none",width:n.notificationCloseButtonSize,height:n.notificationCloseButtonSize,borderRadius:n.borderRadiusSM,transition:"background-color ".concat(n.motionDurationMid,", color ").concat(n.motionDurationMid),display:"flex",alignItems:"center",justifyContent:"center","&:hover":{color:n.colorIconHover,backgroundColor:n.wireframe?"transparent":n.colorFillContent}},["".concat(S,"-btn")]:{float:"right",marginTop:n.marginSM}}},{["".concat(S,"-pure-panel")]:{margin:0}}]},AR=Hx("Notification",n=>{const e=n.paddingMD,t=n.paddingLG,i=M0(n,{notificationBg:n.colorBgElevated,notificationPaddingVertical:e,notificationPaddingHorizontal:t,notificationPadding:"".concat(n.paddingMD,"px ").concat(n.paddingContentHorizontalLG,"px"),notificationMarginBottom:n.margin,notificationMarginEdge:n.marginLG,animationMaxHeight:150,notificationIconSize:n.fontSizeLG*n.lineHeightLG,notificationCloseButtonSize:n.controlHeightLG*.55});return[OJ(i)]},n=>({zIndexPopup:n.zIndexPopupBase+50,width:384}));function BJ(n,e){return e||Re("span",{class:"".concat(n,"-close-x")},[Re(of,{class:"".concat(n,"-close-icon")},null)])}Re(qu,null,null),Re(Qu,null,null),Re(Wu,null,null),Re(ju,null,null),Re(sf,null,null);const kJ={success:Qu,info:qu,error:Wu,warning:ju};function UJ(n){let{prefixCls:e,icon:t,type:i,message:r,description:s,btn:o}=n,a=null;if(t)a=Re("span",{class:"".concat(e,"-icon")},[kc(t)]);else if(i){const l=kJ[i];a=Re(l,{class:"".concat(e,"-icon ").concat(e,"-icon-").concat(i)},null)}return Re("div",{class:kr({["".concat(e,"-with-icon")]:a}),role:"alert"},[a,Re("div",{class:"".concat(e,"-message")},[r]),Re("div",{class:"".concat(e,"-description")},[s]),o&&Re("div",{class:"".concat(e,"-btn")},[o])])}function bR(n,e,t){let i;switch(e=typeof e=="number"?"".concat(e,"px"):e,t=typeof t=="number"?"".concat(t,"px"):t,n){case"top":i={left:"50%",transform:"translateX(-50%)",right:"auto",top:e,bottom:"auto"};break;case"topLeft":i={left:0,top:e,bottom:"auto"};break;case"topRight":i={right:0,top:e,bottom:"auto"};break;case"bottom":i={left:"50%",transform:"translateX(-50%)",right:"auto",top:"auto",bottom:t};break;case"bottomLeft":i={left:0,top:"auto",bottom:t};break;default:i={right:0,top:"auto",bottom:t};break}return i}function zJ(n){return{name:"".concat(n,"-fade")}}var VJ=function(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);rn.prefixCls||i("notification")),o=h=>{var f,p;return bR(h,(f=n.top)!==null&&f!==void 0?f:j3,(p=n.bottom)!==null&&p!==void 0?p:j3)},[,a]=AR(s),l=()=>kr(a.value,{["".concat(s.value,"-rtl")]:n.rtl}),c=()=>zJ(s.value),[u,d]=dR({prefixCls:s.value,getStyles:o,getClassName:l,motion:c,closable:!0,closeIcon:BJ(s.value),duration:HJ,getContainer:()=>{var h,f;return((h=n.getPopupContainer)===null||h===void 0?void 0:h.call(n))||((f=r.value)===null||f===void 0?void 0:f.call(r))||document.body},maxCount:n.maxCount,hashId:a.value,onAllRemoved:n.onAllRemoved});return t(Ue(Ue({},u),{prefixCls:s.value,hashId:a})),d}});function GJ(n){const e=Nr(null),t=Symbol("notificationHolderKey"),i=a=>{if(!e.value)return;const{open:l,prefixCls:c,hashId:u}=e.value,d="".concat(c,"-notice"),{message:h,description:f,icon:p,type:g,btn:y,class:m}=a,v=VJ(a,["message","description","icon","type","btn","class"]);return l(Ue(Ue({placement:"topRight"},v),{content:()=>Re(UJ,{prefixCls:d,icon:typeof p=="function"?p():p,type:g,message:typeof h=="function"?h():h,description:typeof f=="function"?f():f,btn:typeof y=="function"?y():y},null),class:kr(g&&"".concat(d,"-").concat(g),u,m)}))},s={open:i,destroy:a=>{var l,c;a!==void 0?(l=e.value)===null||l===void 0||l.close(a):(c=e.value)===null||c===void 0||c.destroy()}};return["success","info","warning","error"].forEach(a=>{s[a]=l=>i(Ue(Ue({},l),{type:a}))}),[s,()=>Re($J,yi(yi({key:t},n),{},{ref:e}),null)]}function WJ(n){return GJ(n)}const yl={};let TR=4.5,wR="24px",CR="24px",wv="",ER="topRight",MR=()=>document.body,RR=null,Cv=!1,IR;function QJ(n){const{duration:e,placement:t,bottom:i,top:r,getContainer:s,closeIcon:o,prefixCls:a}=n;a!==void 0&&(wv=a),e!==void 0&&(TR=e),t!==void 0&&(ER=t),i!==void 0&&(CR=typeof i=="number"?"".concat(i,"px"):i),r!==void 0&&(wR=typeof r=="number"?"".concat(r,"px"):r),s!==void 0&&(MR=s),o!==void 0&&(RR=o),n.rtl!==void 0&&(Cv=n.rtl),n.maxCount!==void 0&&(IR=n.maxCount)}function jJ(n,e){let{prefixCls:t,placement:i=ER,getContainer:r=MR,top:s,bottom:o,closeIcon:a=RR,appContext:l}=n;const{getPrefixCls:c}=see(),u=c("notification",t||wv),d="".concat(u,"-").concat(i,"-").concat(Cv),h=yl[d];if(h){Promise.resolve(h).then(p=>{e(p)});return}const f=kr("".concat(u,"-").concat(i),{["".concat(u,"-rtl")]:Cv===!0});Dm.newInstance({name:"notification",prefixCls:t||wv,useStyle:AR,class:f,style:bR(i,s!=null?s:wR,o!=null?o:CR),appContext:l,getContainer:r,closeIcon:p=>{let{prefixCls:g}=p;return Re("span",{class:"".concat(g,"-close-x")},[kc(a,{},Re(of,{class:"".concat(g,"-close-icon")},null))])},maxCount:IR,hasTransitionName:!0},p=>{yl[d]=p,e(p)})}const qJ={success:qx,info:Kx,error:Yx,warning:Xx};function XJ(n){const{icon:e,type:t,description:i,message:r,btn:s}=n,o=n.duration===void 0?TR:n.duration;jJ(n,a=>{a.notice({content:l=>{let{prefixCls:c}=l;const u="".concat(c,"-notice");let d=null;if(e)d=()=>Re("span",{class:"".concat(u,"-icon")},[kc(e)]);else if(t){const h=qJ[t];d=()=>Re(h,{class:"".concat(u,"-icon ").concat(u,"-icon-").concat(t)},null)}return Re("div",{class:d?"".concat(u,"-with-icon"):""},[d&&d(),Re("div",{class:"".concat(u,"-message")},[!i&&d?Re("span",{class:"".concat(u,"-message-single-line-auto-margin")},null):null,kc(r)]),Re("div",{class:"".concat(u,"-description")},[kc(i)]),s?Re("span",{class:"".concat(u,"-btn")},[kc(s)]):null])},duration:o,closable:!0,onClose:n.onClose,onClick:n.onClick,key:n.key,style:n.style||{},class:n.class})})}const Eu={open:XJ,close(n){Object.keys(yl).forEach(e=>Promise.resolve(yl[e]).then(t=>{t.removeNotice(n)}))},config:QJ,destroy(){Object.keys(yl).forEach(n=>{Promise.resolve(yl[n]).then(e=>{e.destroy()}),delete yl[n]})}},KJ=["success","info","warning","error"];KJ.forEach(n=>{Eu[n]=e=>Eu.open(Ue(Ue({},e),{type:n}))});Eu.warn=Eu.warning;Eu.useNotification=WJ;const YJ="-ant-".concat(Date.now(),"-").concat(Math.random());function ZJ(n,e){const t={},i=(o,a)=>{let l=o.clone();return l=(a==null?void 0:a(l))||l,l.toRgbString()},r=(o,a)=>{const l=new vi(o),c=$l(l.toRgbString());t["".concat(a,"-color")]=i(l),t["".concat(a,"-color-disabled")]=c[1],t["".concat(a,"-color-hover")]=c[4],t["".concat(a,"-color-active")]=c[6],t["".concat(a,"-color-outline")]=l.clone().setAlpha(.2).toRgbString(),t["".concat(a,"-color-deprecated-bg")]=c[0],t["".concat(a,"-color-deprecated-border")]=c[2]};if(e.primaryColor){r(e.primaryColor,"primary");const o=new vi(e.primaryColor),a=$l(o.toRgbString());a.forEach((c,u)=>{t["primary-".concat(u+1)]=c}),t["primary-color-deprecated-l-35"]=i(o,c=>c.lighten(35)),t["primary-color-deprecated-l-20"]=i(o,c=>c.lighten(20)),t["primary-color-deprecated-t-20"]=i(o,c=>c.tint(20)),t["primary-color-deprecated-t-50"]=i(o,c=>c.tint(50)),t["primary-color-deprecated-f-12"]=i(o,c=>c.setAlpha(c.getAlpha()*.12));const l=new vi(a[0]);t["primary-color-active-deprecated-f-30"]=i(l,c=>c.setAlpha(c.getAlpha()*.3)),t["primary-color-active-deprecated-d-02"]=i(l,c=>c.darken(2))}e.successColor&&r(e.successColor,"success"),e.warningColor&&r(e.warningColor,"warning"),e.errorColor&&r(e.errorColor,"error"),e.infoColor&&r(e.infoColor,"info");const s=Object.keys(t).map(o=>"--".concat(n,"-").concat(o,": ").concat(t[o],";"));return"\n :root {\n ".concat(s.join("\n"),"\n }\n ").trim()}function JJ(n,e){const t=ZJ(n,e);$u()&&Nm(t,"".concat(YJ,"-dynamic-theme"))}const eee=n=>{const[e,t]=R0();return gv(Ge(()=>({theme:e.value,token:t.value,hashId:"",path:["ant-design-icons",n.value]})),()=>[{[".".concat(n.value)]:Ue(Ue({},CY()),{[".".concat(n.value," .").concat(n.value,"-icon")]:{display:"block"}})}])};function tee(n,e){const t=Ge(()=>(n==null?void 0:n.value)||{}),i=Ge(()=>t.value.inherit===!1||!(e!=null&&e.value)?U6:e.value);return Ge(()=>{if(!(n!=null&&n.value))return e==null?void 0:e.value;const s=Ue({},i.value.components);return Object.keys(n.value.components||{}).forEach(o=>{s[o]=Ue(Ue({},s[o]),n.value.components[o])}),Ue(Ue(Ue({},i.value),t.value),{token:Ue(Ue({},i.value.token),t.value.token),components:s})})}var nee=function(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{Ue(Ii,Zx),Ii.prefixCls=Zc(),Ii.iconPrefixCls=NR(),Ii.getPrefixCls=(n,e)=>e||(n?"".concat(Ii.prefixCls,"-").concat(n):Ii.prefixCls),Ii.getRootPrefixCls=()=>Ii.prefixCls?Ii.prefixCls:Zc()});let R1;const ree=n=>{R1&&R1(),R1=jm(()=>{Ue(Zx,Ys(n)),Ue(Ii,Ys(n))}),n.theme&&JJ(Zc(),n.theme)},see=()=>({getPrefixCls:(n,e)=>e||(n?"".concat(Zc(),"-").concat(n):Zc()),getIconPrefixCls:NR,getRootPrefixCls:()=>Ii.prefixCls?Ii.prefixCls:Zc()}),Jc=rn({compatConfig:{MODE:3},name:"AConfigProvider",inheritAttrs:!1,props:JX(),setup(n,e){let{slots:t}=e;const i=a6(),r=(F,V)=>{const{prefixCls:Q="ant"}=n;if(V)return V;const ee=Q||i.getPrefixCls("");return F?"".concat(ee,"-").concat(F):ee},s=Ge(()=>n.iconPrefixCls||i.iconPrefixCls.value||Bx),o=Ge(()=>s.value!==i.iconPrefixCls.value),a=Ge(()=>{var F;return n.csp||((F=i.csp)===null||F===void 0?void 0:F.value)}),l=eee(s),c=tee(Ge(()=>n.theme),Ge(()=>{var F;return(F=i.theme)===null||F===void 0?void 0:F.value})),u=F=>(n.renderEmpty||t.renderEmpty||i.renderEmpty||kY)(F),d=Ge(()=>{var F,V;return(F=n.autoInsertSpaceInButton)!==null&&F!==void 0?F:(V=i.autoInsertSpaceInButton)===null||V===void 0?void 0:V.value}),h=Ge(()=>{var F;return n.locale||((F=i.locale)===null||F===void 0?void 0:F.value)});ci(h,()=>{Zx.locale=h.value},{immediate:!0});const f=Ge(()=>{var F;return n.direction||((F=i.direction)===null||F===void 0?void 0:F.value)}),p=Ge(()=>{var F,V;return(F=n.space)!==null&&F!==void 0?F:(V=i.space)===null||V===void 0?void 0:V.value}),g=Ge(()=>{var F,V;return(F=n.virtual)!==null&&F!==void 0?F:(V=i.virtual)===null||V===void 0?void 0:V.value}),y=Ge(()=>{var F,V;return(F=n.dropdownMatchSelectWidth)!==null&&F!==void 0?F:(V=i.dropdownMatchSelectWidth)===null||V===void 0?void 0:V.value}),m=Ge(()=>{var F;return n.getTargetContainer!==void 0?n.getTargetContainer:(F=i.getTargetContainer)===null||F===void 0?void 0:F.value}),v=Ge(()=>{var F;return n.getPopupContainer!==void 0?n.getPopupContainer:(F=i.getPopupContainer)===null||F===void 0?void 0:F.value}),x=Ge(()=>{var F;return n.pageHeader!==void 0?n.pageHeader:(F=i.pageHeader)===null||F===void 0?void 0:F.value}),_=Ge(()=>{var F;return n.input!==void 0?n.input:(F=i.input)===null||F===void 0?void 0:F.value}),S=Ge(()=>{var F;return n.pagination!==void 0?n.pagination:(F=i.pagination)===null||F===void 0?void 0:F.value}),E=Ge(()=>{var F;return n.form!==void 0?n.form:(F=i.form)===null||F===void 0?void 0:F.value}),A=Ge(()=>{var F;return n.select!==void 0?n.select:(F=i.select)===null||F===void 0?void 0:F.value}),R=Ge(()=>n.componentSize),w=Ge(()=>n.componentDisabled),M=Ge(()=>{var F,V;return(F=n.wave)!==null&&F!==void 0?F:(V=i.wave)===null||V===void 0?void 0:V.value}),I={csp:a,autoInsertSpaceInButton:d,locale:h,direction:f,space:p,virtual:g,dropdownMatchSelectWidth:y,getPrefixCls:r,iconPrefixCls:s,theme:Ge(()=>{var F,V;return(F=c.value)!==null&&F!==void 0?F:(V=i.theme)===null||V===void 0?void 0:V.value}),renderEmpty:u,getTargetContainer:m,getPopupContainer:v,pageHeader:x,input:_,pagination:S,form:E,select:A,componentSize:R,componentDisabled:w,transformCellText:Ge(()=>n.transformCellText),wave:M},L=Ge(()=>{const F=c.value||{},{algorithm:V,token:Q}=F,ee=nee(F,["algorithm","token"]),se=V&&(!Array.isArray(V)||V.length>0)?b6(V):void 0;return Ue(Ue({},ee),{theme:se,token:Ue(Ue({},E0),Q)})}),k=Ge(()=>{var F,V;let Q={};return h.value&&(Q=((F=h.value.Form)===null||F===void 0?void 0:F.defaultValidateMessages)||((V=Su.Form)===null||V===void 0?void 0:V.defaultValidateMessages)||{}),n.form&&n.form.validateMessages&&(Q=Ue(Ue({},Q),n.form.validateMessages)),Q});eK(I),ZX({validateMessages:k}),UY(R),tK(w);const T=F=>{var V,Q;let ee=o.value?l((V=t.default)===null||V===void 0?void 0:V.call(t)):(Q=t.default)===null||Q===void 0?void 0:Q.call(t);if(n.theme){const se=function(){return ee}();ee=Re(LY,{value:L.value},{default:()=>[se]})}return Re(uJ,{locale:h.value||F,ANT_MARK__:Tv},{default:()=>[ee]})};return jm(()=>{f.value&&(Oo.config({rtl:f.value==="rtl"}),Eu.config({rtl:f.value==="rtl"}))}),()=>Re(d6,{children:(F,V,Q)=>T(Q)},null)}});Jc.config=ree;Jc.install=function(n){n.component(Jc.name,Jc)};const oee={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页"};var aee={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M912 302.3L784 376V224c0-35.3-28.7-64-64-64H128c-35.3 0-64 28.7-64 64v576c0 35.3 28.7 64 64 64h592c35.3 0 64-28.7 64-64V648l128 73.7c21.3 12.3 48-3.1 48-27.6V330c0-24.6-26.7-40-48-27.7zM712 792H136V232h576v560zm176-167l-104-59.8V458.9L888 399v226zM208 360h112c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H208c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8z"}}]},name:"video-camera",theme:"outlined"};function q3(n){for(var e=1;e({wrapperRect:{width:0,height:0},wrapperRef:void 0,localVideoRef:void 0,localVideoContainerRef:void 0,remoteVideoRef:void 0,remoteVideoContainerRef:void 0,isLandscape:!0,showChatRecords:!1}),actions:{}}),cee={video:{width:500,height:500},audio:!0},P0=Zw("videoChatStore",{state:()=>({devices:[],availableVideoDevices:[],availableAudioDevices:[],selectedVideoDevice:null,selectedAudioDevice:null,streamState:qi.closed,stream:null,peerConnection:null,localStream:null,webRTCId:"",webcamAccessed:!1,avatarType:"",avatarWSRoute:"",avatarAssetsPath:"",rtcConfig:void 0,trackConstraints:cee,gsLoadPercent:0,volumeMuted:!1,micMuted:!1,cameraOff:!1,hasCamera:!1,hasCameraPermission:!0,hasMic:!1,hasMicPermission:!0,showChatRecords:!1,localAvatarRenderer:null,chatDataChannel:null,replying:!1,chatRecords:[]}),getters:{},actions:{async accessDevice(){try{const e=Tl().localVideoRef;if(this.micMuted=!1,this.cameraOff=!1,this.volumeMuted=!1,!navigator.mediaDevices){Oo.error("无法获取媒体设备,请确保用localhost访问或https协议访问");return}await navigator.mediaDevices.getUserMedia({audio:!0}).catch(()=>{console.log("no audio permission"),this.hasMicPermission=!1}),await navigator.mediaDevices.getUserMedia({video:!0}).catch(()=>{console.log("no video permission"),this.hasCameraPermission=!1});const t=await y1();this.devices=t,console.log("🚀 ~ access_webcam ~ devices:",t);const i=this.selectedVideoDevice&&t.some(s=>{var o;return s.deviceId===((o=this.selectedVideoDevice)==null?void 0:o.deviceId)})?this.selectedVideoDevice.deviceId:"",r=this.selectedAudioDevice&&t.some(s=>{var o;return s.deviceId===((o=this.selectedAudioDevice)==null?void 0:o.deviceId)})?this.selectedAudioDevice.deviceId:"";console.log(i,r," access web device"),this.fillStream(r,i),this.webcamAccessed=!0}catch(n){console.log(n),Oo.error(n.message)}},async init(){fetch("/openavatarchat/init").then(n=>n.json()).then(n=>{n.rtc_configuration&&(this.rtcConfig=n.rtc_configuration),console.log(n),n.avatar_config&&(this.avatarType=n.avatar_config.avatar_type,this.avatarWSRoute=n.avatar_config.avatar_ws_route,this.avatarAssetsPath=n.avatar_config.avatar_assets_path),n.track_constraints&&(this.trackConstraints=n.track_constraints)}).catch(()=>{Oo.error("服务端链接失败,请检查是否能正确访问到 OpenAvatarChat 服务端")})},handleCameraOff(){var n;this.cameraOff=!this.cameraOff,(n=this.stream)==null||n.getTracks().forEach(e=>{e.kind.includes("video")&&(e.enabled=!this.cameraOff)})},handleMicMuted(){var n;this.micMuted=!this.micMuted,(n=this.stream)==null||n.getTracks().forEach(e=>{e.kind.includes("audio")&&(e.enabled=!this.micMuted)})},handleVolumeMute(){var n;this.volumeMuted=!this.volumeMuted,this.avatarType==="lam"&&((n=this.localAvatarRenderer)==null||n.setAvatarMute(this.volumeMuted))},async handleDeviceChange(n){const e=n,t=await y1();this.devices=t,console.log("🚀 ~ handle_device_change ~ devices:",t);let i=this.selectedVideoDevice&&t.some(s=>{var o;return s.deviceId===((o=this.selectedVideoDevice)==null?void 0:o.deviceId)})?this.selectedVideoDevice.deviceId:"",r=this.selectedAudioDevice&&t.some(s=>{var o;return s.deviceId===((o=this.selectedAudioDevice)==null?void 0:o.deviceId)})?this.selectedAudioDevice.deviceId:"";this.availableVideoDevices.find(s=>s.deviceId===e)?(i=e,this.cameraOff=!1):this.availableAudioDevices.find(s=>s.deviceId===e)&&(r=e,this.micMuted=!1),this.fillStream(r,i)},handleSubtitleToggle(){this.showChatRecords=!this.showChatRecords},async updateAvailableDevices(){const n=await y1();this.availableVideoDevices=Zb(n,"videoinput"),this.availableAudioDevices=Zb(n,"audioinput")},async fillStream(n,e){const{devices:t}=this,r=Tl().localVideoRef;this.hasMic=t.some(s=>s.kind==="audioinput"&&s.deviceId)&&this.hasMicPermission,this.hasCamera=t.some(s=>s.kind==="videoinput"&&s.deviceId)&&this.hasCameraPermission,await BX(n&&n!=="default"?{deviceId:{exact:n}}:this.hasMic,e&&e!=="default"?{deviceId:{exact:e}}:this.hasCamera,this.trackConstraints).then(async s=>{console.log("local_stream",s),this.stream=s,this.updateAvailableDevices()}).then(()=>{this.stream.getTracks().map(o=>{var a;return(a=o.getSettings())==null?void 0:a.deviceId}).forEach(o=>{const a=t.find(l=>l.deviceId===o);a&&(a!=null&&a.kind.includes("video"))?this.selectedVideoDevice=a:a&&(a!=null&&a.kind.includes("audio"))&&(this.selectedAudioDevice=a)}),!this.selectedVideoDevice&&(this.selectedVideoDevice=this.availableVideoDevices[0])}).catch(s=>{console.error("image.no_webcam_support",s)}).finally(()=>{console.log(this.stream),this.stream||(this.stream=new MediaStream),console.log(this.stream.getTracks()),this.stream.getTracks().find(s=>s.kind==="audio")||this.stream.addTrack(UX()),this.stream.getTracks().find(s=>s.kind==="video")||this.stream.addTrack(kX()),console.log(this.hasCamera,this.hasMic),this.webcamAccessed=!0,this.localStream=this.stream,r&&(r.srcObject=this.localStream,r.muted=!0,r==null||r.play())})},async startWebRTC(){var e;const n=Tl();this.streamState==="closed"?(this.chatRecords=[],this.peerConnection=new RTCPeerConnection,this.peerConnection.addEventListener("connectionstatechange",async t=>{switch(this.peerConnection.connectionState){case"connected":this.streamState=qi.open;break;case"disconnected":this.streamState=qi.closed,Jb(this.peerConnection);break}}),this.streamState=qi.waiting,await zX(this.stream,this.peerConnection,n.remoteVideoRef).then(([t,i])=>{if(this.streamState=qi.open,this.webRTCId=i,this.chatDataChannel=t,this.avatarType&&this.avatarWSRoute){const r=this.initWebsocket(this.avatarWSRoute,this.webRTCId);this.avatarType==="lam"&&(this.localAvatarRenderer=this.doGaussianRender(r))}}).catch(t=>{console.info("catching",t),this.streamState=qi.closed,Oo.error(t)})):this.streamState==="waiting"||(Jb(this.peerConnection),this.streamState=qi.closed,this.chatRecords=[],this.chatDataChannel=null,this.replying=!1,await this.accessDevice(),this.avatarType==="lam"&&((e=this.localAvatarRenderer)==null||e.exit(),this.gsLoadPercent=0))},initWebsocket(n,e){const t=new tN("".concat(window.location.protocol.includes("https")?"wss":"ws","://").concat(window.location.host).concat(n,"/").concat(e));return t.on(Kr.WS_OPEN,()=>{console.log("socket opened")}),t.on(Kr.WS_CLOSE,()=>{console.log("socket closed")}),t.on(Kr.WS_ERROR,i=>{console.log("socket error",i)}),t.on(Kr.WS_MESSAGE,i=>{console.log("socket on message",i)}),t},doGaussianRender(n){const e=Tl(),t=new OX({container:e.remoteVideoContainerRef,assetsPath:this.avatarAssetsPath,ws:n,loadProgress:i=>{console.log("gs loadProgress",i),this.gsLoadPercent=i}});return t.start(),t}}}),uee={class:"icon-wrap"},dee="点击允许访问摄像头和麦克风",hee=rn({__name:"WebcamPermission",emits:["click"],setup(n,{emit:e}){const t=P0();Tl();const i=async()=>{t.accessDevice()};return ka(()=>{}),(r,s)=>(ft(),xt("div",{class:"access-wrap",onClick:i},[zt("span",uee,[Re(We(Jx))]),em(" "+su(dee))]))}}),ii=(n,e)=>{const t=n.__vccOpts||n;for(const[i,r]of e)t[i]=r;return t},fee=ii(hee,[["__scopeId","data-v-3e18f301"]]);/*! * shared v11.1.9 * (c) 2025 kazuya kawaguchi * Released under the MIT License. */const Fm=typeof window<"u",$a=(n,e=!1)=>e?Symbol.for(n):Symbol(n),pee=(n,e,t)=>mee({l:n,k:e,s:t}),mee=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),Gn=n=>typeof n=="number"&&isFinite(n),gee=n=>e2(n)==="[object Date]",Mu=n=>e2(n)==="[object RegExp]",L0=n=>Lt(n)&&Object.keys(n).length===0,Zn=Object.assign,yee=Object.create,dn=(n=null)=>yee(n);let X3;const wl=()=>X3||(X3=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:dn());function K3(n){return n.replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}const vee=Object.prototype.hasOwnProperty;function ys(n,e){return vee.call(n,e)}const In=Array.isArray,yn=n=>typeof n=="function",rt=n=>typeof n=="string",$t=n=>typeof n=="boolean",jt=n=>n!==null&&typeof n=="object",_ee=n=>jt(n)&&yn(n.then)&&yn(n.catch),PR=Object.prototype.toString,e2=n=>PR.call(n),Lt=n=>e2(n)==="[object Object]",xee=n=>n==null?"":In(n)||Lt(n)&&n.toString===PR?JSON.stringify(n,null,2):String(n);function t2(n,e=""){return n.reduce((t,i,r)=>r===0?t+i:t+e+i,"")}function See(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const hp=n=>!jt(n)||In(n);function Gp(n,e){if(hp(n)||hp(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:i,des:r}=t.pop();Object.keys(i).forEach(s=>{s!=="__proto__"&&(jt(i[s])&&!jt(r[s])&&(r[s]=Array.isArray(i[s])?[]:dn()),hp(r[s])||hp(i[s])?r[s]=i[s]:t.push({src:i[s],des:r[s]}))})}}/*! * message-compiler v11.1.9 * (c) 2025 kazuya kawaguchi * Released under the MIT License. */function Aee(n,e,t){return{line:n,column:e,offset:t}}function Ev(n,e,t){return{start:n,end:e}}const an={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14},bee=17;function D0(n,e,t={}){const{domain:i,messages:r,args:s}=t,o=n,a=new SyntaxError(String(o));return a.code=n,e&&(a.location=e),a.domain=i,a}function Tee(n){throw n}const Ao=" ",wee="\r",Wi="\n",Cee="\u2028",Eee="\u2029";function Mee(n){const e=n;let t=0,i=1,r=1,s=0;const o=A=>e[A]===wee&&e[A+1]===Wi,a=A=>e[A]===Wi,l=A=>e[A]===Eee,c=A=>e[A]===Cee,u=A=>o(A)||a(A)||l(A)||c(A),d=()=>t,h=()=>i,f=()=>r,p=()=>s,g=A=>o(A)||l(A)||c(A)?Wi:e[A],y=()=>g(t),m=()=>g(t+s);function v(){return s=0,u(t)&&(i++,r=0),o(t)&&t++,t++,r++,e[t]}function x(){return o(t+s)&&s++,s++,e[t+s]}function _(){t=0,i=1,r=1,s=0}function S(A=0){s=A}function E(){const A=t+s;for(;A!==t;)v();s=0}return{index:d,line:h,column:f,peekOffset:p,charAt:g,currentChar:y,currentPeek:m,next:v,peek:x,reset:_,resetPeek:S,skipToPeek:E}}const ha=void 0,Ree=".",Y3="'",Iee="tokenizer";function Nee(n,e={}){const t=e.location!==!1,i=Mee(n),r=()=>i.index(),s=()=>Aee(i.line(),i.column(),i.index()),o=s(),a=r(),l={currentType:13,offset:a,startLoc:o,endLoc:o,lastType:13,lastOffset:a,lastStartLoc:o,lastEndLoc:o,braceNest:0,inLinked:!1,text:""},c=()=>l,{onError:u}=e;function d(P,U,j,...B){const D=c();if(U.column+=j,U.offset+=j,u){const W=t?Ev(D.startLoc,U):null,G=D0(P,W,{domain:Iee,args:B});u(G)}}function h(P,U,j){P.endLoc=s(),P.currentType=U;const B={type:U};return t&&(B.loc=Ev(P.startLoc,P.endLoc)),j!=null&&(B.value=j),B}const f=P=>h(P,13);function p(P,U){return P.currentChar()===U?(P.next(),U):(d(an.EXPECTED_TOKEN,s(),0,U),"")}function g(P){let U="";for(;P.currentPeek()===Ao||P.currentPeek()===Wi;)U+=P.currentPeek(),P.peek();return U}function y(P){const U=g(P);return P.skipToPeek(),U}function m(P){if(P===ha)return!1;const U=P.charCodeAt(0);return U>=97&&U<=122||U>=65&&U<=90||U===95}function v(P){if(P===ha)return!1;const U=P.charCodeAt(0);return U>=48&&U<=57}function x(P,U){const{currentType:j}=U;if(j!==2)return!1;g(P);const B=m(P.currentPeek());return P.resetPeek(),B}function _(P,U){const{currentType:j}=U;if(j!==2)return!1;g(P);const B=P.currentPeek()==="-"?P.peek():P.currentPeek(),D=v(B);return P.resetPeek(),D}function S(P,U){const{currentType:j}=U;if(j!==2)return!1;g(P);const B=P.currentPeek()===Y3;return P.resetPeek(),B}function E(P,U){const{currentType:j}=U;if(j!==7)return!1;g(P);const B=P.currentPeek()===".";return P.resetPeek(),B}function A(P,U){const{currentType:j}=U;if(j!==8)return!1;g(P);const B=m(P.currentPeek());return P.resetPeek(),B}function R(P,U){const{currentType:j}=U;if(!(j===7||j===11))return!1;g(P);const B=P.currentPeek()===":";return P.resetPeek(),B}function w(P,U){const{currentType:j}=U;if(j!==9)return!1;const B=()=>{const W=P.currentPeek();return W==="{"?m(P.peek()):W==="@"||W==="|"||W===":"||W==="."||W===Ao||!W?!1:W===Wi?(P.peek(),B()):I(P,!1)},D=B();return P.resetPeek(),D}function M(P){g(P);const U=P.currentPeek()==="|";return P.resetPeek(),U}function I(P,U=!0){const j=(D=!1,W="")=>{const G=P.currentPeek();return G==="{"||G==="@"||!G?D:G==="|"?!(W===Ao||W===Wi):G===Ao?(P.peek(),j(!0,Ao)):G===Wi?(P.peek(),j(!0,Wi)):!0},B=j();return U&&P.resetPeek(),B}function L(P,U){const j=P.currentChar();return j===ha?ha:U(j)?(P.next(),j):null}function k(P){const U=P.charCodeAt(0);return U>=97&&U<=122||U>=65&&U<=90||U>=48&&U<=57||U===95||U===36}function T(P){return L(P,k)}function F(P){const U=P.charCodeAt(0);return U>=97&&U<=122||U>=65&&U<=90||U>=48&&U<=57||U===95||U===36||U===45}function V(P){return L(P,F)}function Q(P){const U=P.charCodeAt(0);return U>=48&&U<=57}function ee(P){return L(P,Q)}function se(P){const U=P.charCodeAt(0);return U>=48&&U<=57||U>=65&&U<=70||U>=97&&U<=102}function he(P){return L(P,se)}function ie(P){let U="",j="";for(;U=ee(P);)j+=U;return j}function re(P){let U="";for(;;){const j=P.currentChar();if(j==="{"||j==="}"||j==="@"||j==="|"||!j)break;if(j===Ao||j===Wi)if(I(P))U+=j,P.next();else{if(M(P))break;U+=j,P.next()}else U+=j,P.next()}return U}function be(P){y(P);let U="",j="";for(;U=V(P);)j+=U;return P.currentChar()===ha&&d(an.UNTERMINATED_CLOSING_BRACE,s(),0),j}function le(P){y(P);let U="";return P.currentChar()==="-"?(P.next(),U+="-".concat(ie(P))):U+=ie(P),P.currentChar()===ha&&d(an.UNTERMINATED_CLOSING_BRACE,s(),0),U}function fe(P){return P!==Y3&&P!==Wi}function Te(P){y(P),p(P,"'");let U="",j="";for(;U=L(P,fe);)U==="\\"?j+=Ce(P):j+=U;const B=P.currentChar();return B===Wi||B===ha?(d(an.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,s(),0),B===Wi&&(P.next(),p(P,"'")),j):(p(P,"'"),j)}function Ce(P){const U=P.currentChar();switch(U){case"\\":case"'":return P.next(),"\\".concat(U);case"u":return Ie(P,U,4);case"U":return Ie(P,U,6);default:return d(an.UNKNOWN_ESCAPE_SEQUENCE,s(),0,U),""}}function Ie(P,U,j){p(P,U);let B="";for(let D=0;D{const B=P.currentChar();return B==="{"||B==="@"||B==="|"||B==="("||B===")"||!B||B===Ao?j:(j+=B,P.next(),U(j))};return U("")}function ne(P){y(P);const U=p(P,"|");return y(P),U}function b(P,U){let j=null;switch(P.currentChar()){case"{":return U.braceNest>=1&&d(an.NOT_ALLOW_NEST_PLACEHOLDER,s(),0),P.next(),j=h(U,2,"{"),y(P),U.braceNest++,j;case"}":return U.braceNest>0&&U.currentType===2&&d(an.EMPTY_PLACEHOLDER,s(),0),P.next(),j=h(U,3,"}"),U.braceNest--,U.braceNest>0&&y(P),U.inLinked&&U.braceNest===0&&(U.inLinked=!1),j;case"@":return U.braceNest>0&&d(an.UNTERMINATED_CLOSING_BRACE,s(),0),j=oe(P,U)||f(U),U.braceNest=0,j;default:{let D=!0,W=!0,G=!0;if(M(P))return U.braceNest>0&&d(an.UNTERMINATED_CLOSING_BRACE,s(),0),j=h(U,1,ne(P)),U.braceNest=0,U.inLinked=!1,j;if(U.braceNest>0&&(U.currentType===4||U.currentType===5||U.currentType===6))return d(an.UNTERMINATED_CLOSING_BRACE,s(),0),U.braceNest=0,J(P,U);if(D=x(P,U))return j=h(U,4,be(P)),y(P),j;if(W=_(P,U))return j=h(U,5,le(P)),y(P),j;if(G=S(P,U))return j=h(U,6,Te(P)),y(P),j;if(!D&&!W&&!G)return j=h(U,12,Be(P)),d(an.INVALID_TOKEN_IN_PLACEHOLDER,s(),0,j.value),y(P),j;break}}return j}function oe(P,U){const{currentType:j}=U;let B=null;const D=P.currentChar();switch((j===7||j===8||j===11||j===9)&&(D===Wi||D===Ao)&&d(an.INVALID_LINKED_FORMAT,s(),0),D){case"@":return P.next(),B=h(U,7,"@"),U.inLinked=!0,B;case".":return y(P),P.next(),h(U,8,".");case":":return y(P),P.next(),h(U,9,":");default:return M(P)?(B=h(U,1,ne(P)),U.braceNest=0,U.inLinked=!1,B):E(P,U)||R(P,U)?(y(P),oe(P,U)):A(P,U)?(y(P),h(U,11,it(P))):w(P,U)?(y(P),D==="{"?b(P,U)||B:h(U,10,te(P))):(j===7&&d(an.INVALID_LINKED_FORMAT,s(),0),U.braceNest=0,U.inLinked=!1,J(P,U))}}function J(P,U){let j={type:13};if(U.braceNest>0)return b(P,U)||f(U);if(U.inLinked)return oe(P,U)||f(U);switch(P.currentChar()){case"{":return b(P,U)||f(U);case"}":return d(an.UNBALANCED_CLOSING_BRACE,s(),0),P.next(),h(U,3,"}");case"@":return oe(P,U)||f(U);default:{if(M(P))return j=h(U,1,ne(P)),U.braceNest=0,U.inLinked=!1,j;if(I(P))return h(U,0,re(P));break}}return j}function H(){const{currentType:P,offset:U,startLoc:j,endLoc:B}=l;return l.lastType=P,l.lastOffset=U,l.lastStartLoc=j,l.lastEndLoc=B,l.offset=r(),l.startLoc=s(),i.currentChar()===ha?h(l,13):J(i,l)}return{nextToken:H,currentOffset:r,currentPosition:s,context:c}}const Pee="parser",Lee=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function Dee(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const i=parseInt(e||t,16);return i<=55295||i>=57344?String.fromCodePoint(i):"�"}}}function Fee(n={}){const e=n.location!==!1,{onError:t}=n;function i(m,v,x,_,...S){const E=m.currentPosition();if(E.offset+=_,E.column+=_,t){const A=e?Ev(x,E):null,R=D0(v,A,{domain:Pee,args:S});t(R)}}function r(m,v,x){const _={type:m};return e&&(_.start=v,_.end=v,_.loc={start:x,end:x}),_}function s(m,v,x,_){e&&(m.end=v,m.loc&&(m.loc.end=x))}function o(m,v){const x=m.context(),_=r(3,x.offset,x.startLoc);return _.value=v,s(_,m.currentOffset(),m.currentPosition()),_}function a(m,v){const x=m.context(),{lastOffset:_,lastStartLoc:S}=x,E=r(5,_,S);return E.index=parseInt(v,10),m.nextToken(),s(E,m.currentOffset(),m.currentPosition()),E}function l(m,v){const x=m.context(),{lastOffset:_,lastStartLoc:S}=x,E=r(4,_,S);return E.key=v,m.nextToken(),s(E,m.currentOffset(),m.currentPosition()),E}function c(m,v){const x=m.context(),{lastOffset:_,lastStartLoc:S}=x,E=r(9,_,S);return E.value=v.replace(Lee,Dee),m.nextToken(),s(E,m.currentOffset(),m.currentPosition()),E}function u(m){const v=m.nextToken(),x=m.context(),{lastOffset:_,lastStartLoc:S}=x,E=r(8,_,S);return v.type!==11?(i(m,an.UNEXPECTED_EMPTY_LINKED_MODIFIER,x.lastStartLoc,0),E.value="",s(E,_,S),{nextConsumeToken:v,node:E}):(v.value==null&&i(m,an.UNEXPECTED_LEXICAL_ANALYSIS,x.lastStartLoc,0,Ps(v)),E.value=v.value||"",s(E,m.currentOffset(),m.currentPosition()),{node:E})}function d(m,v){const x=m.context(),_=r(7,x.offset,x.startLoc);return _.value=v,s(_,m.currentOffset(),m.currentPosition()),_}function h(m){const v=m.context(),x=r(6,v.offset,v.startLoc);let _=m.nextToken();if(_.type===8){const S=u(m);x.modifier=S.node,_=S.nextConsumeToken||m.nextToken()}switch(_.type!==9&&i(m,an.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Ps(_)),_=m.nextToken(),_.type===2&&(_=m.nextToken()),_.type){case 10:_.value==null&&i(m,an.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Ps(_)),x.key=d(m,_.value||"");break;case 4:_.value==null&&i(m,an.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Ps(_)),x.key=l(m,_.value||"");break;case 5:_.value==null&&i(m,an.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Ps(_)),x.key=a(m,_.value||"");break;case 6:_.value==null&&i(m,an.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Ps(_)),x.key=c(m,_.value||"");break;default:{i(m,an.UNEXPECTED_EMPTY_LINKED_KEY,v.lastStartLoc,0);const S=m.context(),E=r(7,S.offset,S.startLoc);return E.value="",s(E,S.offset,S.startLoc),x.key=E,s(x,S.offset,S.startLoc),{nextConsumeToken:_,node:x}}}return s(x,m.currentOffset(),m.currentPosition()),{node:x}}function f(m){const v=m.context(),x=v.currentType===1?m.currentOffset():v.offset,_=v.currentType===1?v.endLoc:v.startLoc,S=r(2,x,_);S.items=[];let E=null;do{const w=E||m.nextToken();switch(E=null,w.type){case 0:w.value==null&&i(m,an.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Ps(w)),S.items.push(o(m,w.value||""));break;case 5:w.value==null&&i(m,an.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Ps(w)),S.items.push(a(m,w.value||""));break;case 4:w.value==null&&i(m,an.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Ps(w)),S.items.push(l(m,w.value||""));break;case 6:w.value==null&&i(m,an.UNEXPECTED_LEXICAL_ANALYSIS,v.lastStartLoc,0,Ps(w)),S.items.push(c(m,w.value||""));break;case 7:{const M=h(m);S.items.push(M.node),E=M.nextConsumeToken||null;break}}}while(v.currentType!==13&&v.currentType!==1);const A=v.currentType===1?v.lastOffset:m.currentOffset(),R=v.currentType===1?v.lastEndLoc:m.currentPosition();return s(S,A,R),S}function p(m,v,x,_){const S=m.context();let E=_.items.length===0;const A=r(1,v,x);A.cases=[],A.cases.push(_);do{const R=f(m);E||(E=R.items.length===0),A.cases.push(R)}while(S.currentType!==13);return E&&i(m,an.MUST_HAVE_MESSAGES_IN_PLURAL,x,0),s(A,m.currentOffset(),m.currentPosition()),A}function g(m){const v=m.context(),{offset:x,startLoc:_}=v,S=f(m);return v.currentType===13?S:p(m,x,_,S)}function y(m){const v=Nee(m,Zn({},n)),x=v.context(),_=r(0,x.offset,x.startLoc);return e&&_.loc&&(_.loc.source=m),_.body=g(v),n.onCacheKey&&(_.cacheKey=n.onCacheKey(m)),x.currentType!==13&&i(v,an.UNEXPECTED_LEXICAL_ANALYSIS,x.lastStartLoc,0,m[x.offset]||""),s(_,v.currentOffset(),v.currentPosition()),_}return{parse:y}}function Ps(n){if(n.type===13)return"EOF";const e=(n.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function Oee(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:s=>(t.helpers.add(s),s)}}function Z3(n,e){for(let t=0;tJ3(t)),n}function J3(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;to;function l(g,y){o.code+=g}function c(g,y=!0){const m=y?i:"";l(r?m+" ".repeat(g):m)}function u(g=!0){const y=++o.indentLevel;g&&c(y)}function d(g=!0){const y=--o.indentLevel;g&&c(y)}function h(){c(o.indentLevel)}return{context:a,push:l,indent:u,deindent:d,newline:h,helper:g=>"_".concat(g),needIndent:()=>o.needIndent}}function zee(n,e){const{helper:t}=n;n.push("".concat(t("linked"),"(")),Ru(n,e.key),e.modifier?(n.push(", "),Ru(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function Vee(n,e){const{helper:t,needIndent:i}=n;n.push("".concat(t("normalize"),"([")),n.indent(i());const r=e.items.length;for(let s=0;s1){n.push("".concat(t("plural"),"([")),n.indent(i());const r=e.cases.length;for(let s=0;s{const t=rt(e.mode)?e.mode:"normal",i=rt(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":"\n",s=e.needIndent?e.needIndent:t!=="arrow",o=n.helpers||[],a=Uee(n,{filename:i,breakLineCode:r,needIndent:s});a.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),a.indent(s),o.length>0&&(a.push("const { ".concat(t2(o.map(u=>"".concat(u,": _").concat(u)),", ")," } = ctx")),a.newline()),a.push("return "),Ru(a,n),a.deindent(s),a.push("}"),delete n.helpers;const{code:l,map:c}=a.context();return{ast:n,code:l,map:c?c.toJSON():void 0}};function Wee(n,e={}){const t=Zn({},e),i=!!t.jit,r=!!t.minify,s=t.optimize==null?!0:t.optimize,a=Fee(t).parse(n);return i?(s&&kee(a),r&&Nc(a),{ast:a,code:""}):(Bee(a,t),Gee(a,t))}/*! * core-base v11.1.9 * (c) 2025 kazuya kawaguchi * Released under the MIT License. */function Qee(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(wl().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(wl().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function Xs(n){return jt(n)&&i2(n)===0&&(ys(n,"b")||ys(n,"body"))}const LR=["b","body"];function jee(n){return Ga(n,LR)}const DR=["c","cases"];function qee(n){return Ga(n,DR,[])}const FR=["s","static"];function Xee(n){return Ga(n,FR)}const OR=["i","items"];function Kee(n){return Ga(n,OR,[])}const BR=["t","type"];function i2(n){return Ga(n,BR)}const kR=["v","value"];function fp(n,e){const t=Ga(n,kR);if(t!=null)return t;throw bh(e)}const UR=["m","modifier"];function Yee(n){return Ga(n,UR)}const zR=["k","key"];function Zee(n){const e=Ga(n,zR);if(e)return e;throw bh(6)}function Ga(n,e,t){for(let i=0;iJee(t,n)}function Jee(n,e){const t=jee(e);if(t==null)throw bh(0);if(i2(t)===1){const s=qee(t);return n.plural(s.reduce((o,a)=>[...o,eT(n,a)],[]))}else return eT(n,t)}function eT(n,e){const t=Xee(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const i=Kee(e).reduce((r,s)=>[...r,Mv(n,s)],[]);return n.normalize(i)}}function Mv(n,e){const t=i2(e);switch(t){case 3:return fp(e,t);case 9:return fp(e,t);case 4:{const i=e;if(ys(i,"k")&&i.k)return n.interpolate(n.named(i.k));if(ys(i,"key")&&i.key)return n.interpolate(n.named(i.key));throw bh(t)}case 5:{const i=e;if(ys(i,"i")&&Gn(i.i))return n.interpolate(n.list(i.i));if(ys(i,"index")&&Gn(i.index))return n.interpolate(n.list(i.index));throw bh(t)}case 6:{const i=e,r=Yee(i),s=Zee(i);return n.linked(Mv(n,s),r?Mv(n,r):void 0,n.type)}case 7:return fp(e,t);case 8:return fp(e,t);default:throw new Error("unhandled node on format message part: ".concat(t))}}const ete=n=>n;let pp=dn();function tte(n,e={}){let t=!1;const i=e.onError||Tee;return e.onError=r=>{t=!0,i(r)},{...Wee(n,e),detectError:t}}function nte(n,e){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&rt(n)){$t(e.warnHtmlMessage)&&e.warnHtmlMessage;const i=(e.onCacheKey||ete)(n),r=pp[i];if(r)return r;const{ast:s,detectError:o}=tte(n,{...e,location:!1,jit:!0}),a=I1(s);return o?a:pp[i]=a}else{const t=n.cacheKey;if(t){const i=pp[t];return i||(pp[t]=I1(n))}else return I1(n)}}let Th=null;function ite(n){Th=n}function rte(n,e,t){Th&&Th.emit("i18n:init",{timestamp:Date.now(),i18n:n,version:e,meta:t})}const ste=ote("function:translate");function ote(n){return e=>Th&&Th.emit(n,e)}const Bo={INVALID_ARGUMENT:bee,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},ate=24;function ko(n){return D0(n,null,void 0)}function r2(n,e){return e.locale!=null?tT(e.locale):tT(n.locale)}let N1;function tT(n){if(rt(n))return n;if(yn(n)){if(n.resolvedOnce&&N1!=null)return N1;if(n.constructor.name==="Function"){const e=n();if(_ee(e))throw ko(Bo.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return N1=e}else throw ko(Bo.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw ko(Bo.NOT_SUPPORT_LOCALE_TYPE)}function lte(n,e,t){return[...new Set([t,...In(e)?e:jt(e)?Object.keys(e):rt(e)?[e]:[t]])]}function HR(n,e,t){const i=rt(t)?t:wh,r=n;r.__localeChainCache||(r.__localeChainCache=new Map);let s=r.__localeChainCache.get(i);if(!s){s=[];let o=[t];for(;In(o);)o=nT(s,o,e);const a=In(e)||!Lt(e)?e:e.default?e.default:null;o=rt(a)?[a]:a,In(o)&&nT(s,o,!1),r.__localeChainCache.set(i,s)}return s}function nT(n,e,t){let i=!0;for(let r=0;r{o===void 0?o=a:o+=a},h[1]=()=>{o!==void 0&&(e.push(o),o=void 0)},h[2]=()=>{h[0](),r++},h[3]=()=>{if(r>0)r--,i=4,h[0]();else{if(r=0,o===void 0||(o=mte(o),o===!1))return!1;h[1]()}};function f(){const p=n[t+1];if(i===5&&p==="'"||i===6&&p==='"')return t++,a="\\"+p,h[0](),!0}for(;i!==null;)if(t++,s=n[t],!(s==="\\"&&f())){if(l=pte(s),d=Wa[i],c=d[l]||d.l||8,c===8||(i=c[0],c[1]!==void 0&&(u=h[c[1]],u&&(a=s,u()===!1))))return;if(i===7)return e}}const iT=new Map;function yte(n,e){return jt(n)?n[e]:null}function vte(n,e){if(!jt(n))return null;let t=iT.get(e);if(t||(t=gte(e),t&&iT.set(e,t)),!t)return null;const i=t.length;let r=n,s=0;for(;s"".concat(n.charAt(0).toLocaleUpperCase()).concat(n.substr(1));function xte(){return{upper:(n,e)=>e==="text"&&rt(n)?n.toUpperCase():e==="vnode"&&jt(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&rt(n)?n.toLowerCase():e==="vnode"&&jt(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&rt(n)?sT(n):e==="vnode"&&jt(n)&&"__v_isVNode"in n?sT(n.children):n}}let $R;function Ste(n){$R=n}let GR;function Ate(n){GR=n}let WR;function bte(n){WR=n}let QR=null;const Tte=n=>{QR=n},wte=()=>QR;let jR=null;const oT=n=>{jR=n},Cte=()=>jR;let aT=0;function Ete(n={}){const e=yn(n.onWarn)?n.onWarn:See,t=rt(n.version)?n.version:_te,i=rt(n.locale)||yn(n.locale)?n.locale:wh,r=yn(i)?wh:i,s=In(n.fallbackLocale)||Lt(n.fallbackLocale)||rt(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:r,o=Lt(n.messages)?n.messages:P1(r),a=Lt(n.datetimeFormats)?n.datetimeFormats:P1(r),l=Lt(n.numberFormats)?n.numberFormats:P1(r),c=Zn(dn(),n.modifiers,xte()),u=n.pluralRules||dn(),d=yn(n.missing)?n.missing:null,h=$t(n.missingWarn)||Mu(n.missingWarn)?n.missingWarn:!0,f=$t(n.fallbackWarn)||Mu(n.fallbackWarn)?n.fallbackWarn:!0,p=!!n.fallbackFormat,g=!!n.unresolving,y=yn(n.postTranslation)?n.postTranslation:null,m=Lt(n.processor)?n.processor:null,v=$t(n.warnHtmlMessage)?n.warnHtmlMessage:!0,x=!!n.escapeParameter,_=yn(n.messageCompiler)?n.messageCompiler:$R,S=yn(n.messageResolver)?n.messageResolver:GR||yte,E=yn(n.localeFallbacker)?n.localeFallbacker:WR||lte,A=jt(n.fallbackContext)?n.fallbackContext:void 0,R=n,w=jt(R.__datetimeFormatters)?R.__datetimeFormatters:new Map,M=jt(R.__numberFormatters)?R.__numberFormatters:new Map,I=jt(R.__meta)?R.__meta:{};aT++;const L={version:t,cid:aT,locale:i,fallbackLocale:s,messages:o,modifiers:c,pluralRules:u,missing:d,missingWarn:h,fallbackWarn:f,fallbackFormat:p,unresolving:g,postTranslation:y,processor:m,warnHtmlMessage:v,escapeParameter:x,messageCompiler:_,messageResolver:S,localeFallbacker:E,fallbackContext:A,onWarn:e,__meta:I};return L.datetimeFormats=a,L.numberFormats=l,L.__datetimeFormatters=w,L.__numberFormatters=M,__INTLIFY_PROD_DEVTOOLS__&&rte(L,t,I),L}const P1=n=>({[n]:dn()});function s2(n,e,t,i,r){const{missing:s,onWarn:o}=n;if(s!==null){const a=s(n,t,e,r);return rt(a)?a:e}else return e}function Sd(n,e,t){const i=n;i.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function Mte(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function Rte(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let i=t+1;i{qR.includes(l)?o[l]=t[l]:s[l]=t[l]}),rt(i)?s.locale=i:Lt(i)&&(o=i),Lt(r)&&(o=r),[s.key||"",a,s,o]}function cT(n,e,t){const i=n;for(const r in t){const s="".concat(e,"__").concat(r);i.__datetimeFormatters.has(s)&&i.__datetimeFormatters.delete(s)}}function uT(n,...e){const{numberFormats:t,unresolving:i,fallbackLocale:r,onWarn:s,localeFallbacker:o}=n,{__numberFormatters:a}=n,[l,c,u,d]=Iv(...e),h=$t(u.missingWarn)?u.missingWarn:n.missingWarn;$t(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn;const f=!!u.part,p=r2(n,u),g=o(n,r,p);if(!rt(l)||l==="")return new Intl.NumberFormat(p,d).format(c);let y={},m,v=null;const x="number format";for(let E=0;E{XR.includes(l)?o[l]=t[l]:s[l]=t[l]}),rt(i)?s.locale=i:Lt(i)&&(o=i),Lt(r)&&(o=r),[s.key||"",a,s,o]}function dT(n,e,t){const i=n;for(const r in t){const s="".concat(e,"__").concat(r);i.__numberFormatters.has(s)&&i.__numberFormatters.delete(s)}}const Ite=n=>n,Nte=n=>"",Pte="text",Lte=n=>n.length===0?"":t2(n),Dte=xee;function hT(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function Fte(n){const e=Gn(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(Gn(n.named.count)||Gn(n.named.n))?Gn(n.named.count)?n.named.count:Gn(n.named.n)?n.named.n:e:e}function Ote(n,e){e.count||(e.count=n),e.n||(e.n=n)}function Bte(n={}){const e=n.locale,t=Fte(n),i=jt(n.pluralRules)&&rt(e)&&yn(n.pluralRules[e])?n.pluralRules[e]:hT,r=jt(n.pluralRules)&&rt(e)&&yn(n.pluralRules[e])?hT:void 0,s=m=>m[i(t,m.length,r)],o=n.list||[],a=m=>o[m],l=n.named||dn();Gn(n.pluralIndex)&&Ote(t,l);const c=m=>l[m];function u(m,v){const x=yn(n.messages)?n.messages(m,!!v):jt(n.messages)?n.messages[m]:!1;return x||(n.parent?n.parent.message(m):Nte)}const d=m=>n.modifiers?n.modifiers[m]:Ite,h=Lt(n.processor)&&yn(n.processor.normalize)?n.processor.normalize:Lte,f=Lt(n.processor)&&yn(n.processor.interpolate)?n.processor.interpolate:Dte,p=Lt(n.processor)&&rt(n.processor.type)?n.processor.type:Pte,y={list:a,named:c,plural:s,linked:(m,...v)=>{const[x,_]=v;let S="text",E="";v.length===1?jt(x)?(E=x.modifier||E,S=x.type||S):rt(x)&&(E=x||E):v.length===2&&(rt(x)&&(E=x||E),rt(_)&&(S=_||S));const A=u(m,!0)(y),R=S==="vnode"&&In(A)&&E?A[0]:A;return E?d(E)(R,S):R},message:u,type:p,interpolate:f,normalize:h,values:Zn(dn(),o,l)};return y}const fT=()=>"",Xr=n=>yn(n);function pT(n,...e){const{fallbackFormat:t,postTranslation:i,unresolving:r,messageCompiler:s,fallbackLocale:o,messages:a}=n,[l,c]=Nv(...e),u=$t(c.missingWarn)?c.missingWarn:n.missingWarn,d=$t(c.fallbackWarn)?c.fallbackWarn:n.fallbackWarn,h=$t(c.escapeParameter)?c.escapeParameter:n.escapeParameter,f=!!c.resolvedMessage,p=rt(c.default)||$t(c.default)?$t(c.default)?s?l:()=>l:c.default:t?s?l:()=>l:null,g=t||p!=null&&(rt(p)||yn(p)),y=r2(n,c);h&&kte(c);let[m,v,x]=f?[l,y,a[y]||dn()]:KR(n,l,y,o,d,u),_=m,S=l;if(!f&&!(rt(_)||Xs(_)||Xr(_))&&g&&(_=p,S=_),!f&&(!(rt(_)||Xs(_)||Xr(_))||!rt(v)))return r?F0:l;let E=!1;const A=()=>{E=!0},R=Xr(_)?_:YR(n,l,v,_,S,A);if(E)return _;const w=Vte(n,v,x,c),M=Bte(w),I=Ute(n,R,M),L=i?i(I,l):I;if(__INTLIFY_PROD_DEVTOOLS__){const k={timestamp:Date.now(),key:rt(l)?l:Xr(_)?_.key:"",locale:v||(Xr(_)?_.locale:""),format:rt(_)?_:Xr(_)?_.source:"",message:L};k.meta=Zn({},n.__meta,wte()||{}),ste(k)}return L}function kte(n){In(n.list)?n.list=n.list.map(e=>rt(e)?K3(e):e):jt(n.named)&&Object.keys(n.named).forEach(e=>{rt(n.named[e])&&(n.named[e]=K3(n.named[e]))})}function KR(n,e,t,i,r,s){const{messages:o,onWarn:a,messageResolver:l,localeFallbacker:c}=n,u=c(n,i,t);let d=dn(),h,f=null;const p="translate";for(let g=0;gi;return c.locale=t,c.key=e,c}const l=o(i,zte(n,t,r,i,a,s));return l.locale=t,l.key=e,l.source=i,l}function Ute(n,e,t){return e(t)}function Nv(...n){const[e,t,i]=n,r=dn();if(!rt(e)&&!Gn(e)&&!Xr(e)&&!Xs(e))throw ko(Bo.INVALID_ARGUMENT);const s=Gn(e)?String(e):(Xr(e),e);return Gn(t)?r.plural=t:rt(t)?r.default=t:Lt(t)&&!L0(t)?r.named=t:In(t)&&(r.list=t),Gn(i)?r.plural=i:rt(i)?r.default=i:Lt(i)&&Zn(r,i),[s,r]}function zte(n,e,t,i,r,s){return{locale:e,key:t,warnHtmlMessage:r,onError:o=>{throw s&&s(o),o},onCacheKey:o=>pee(e,t,o)}}function Vte(n,e,t,i){const{modifiers:r,pluralRules:s,messageResolver:o,fallbackLocale:a,fallbackWarn:l,missingWarn:c,fallbackContext:u}=n,h={locale:e,modifiers:r,pluralRules:s,messages:(f,p)=>{let g=o(t,f);if(g==null&&(u||p)){const[,,y]=KR(u||n,f,e,a,l,c);g=o(y,f)}if(rt(g)||Xs(g)){let y=!1;const v=YR(n,f,e,g,f,()=>{y=!0});return y?fT:v}else return Xr(g)?g:fT}};return n.processor&&(h.processor=n.processor),i.list&&(h.list=i.list),i.named&&(h.named=i.named),Gn(i.plural)&&(h.pluralIndex=i.plural),h}Qee();/*! * vue-i18n v11.1.9 * (c) 2025 kazuya kawaguchi * Released under the MIT License. */const Hte="11.1.9";function $te(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(wl().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(wl().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(wl().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(wl().__INTLIFY_PROD_DEVTOOLS__=!1)}const ur={UNEXPECTED_RETURN_TYPE:ate,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32};function Br(n,...e){return D0(n,null,void 0)}const Pv=$a("__translateVNode"),Lv=$a("__datetimeParts"),Dv=$a("__numberParts"),ZR=$a("__setPluralRules"),JR=$a("__injectWithOption"),Fv=$a("__dispose");function Ch(n){if(!jt(n)||Xs(n))return n;for(const e in n)if(ys(n,e))if(!e.includes("."))jt(n[e])&&Ch(n[e]);else{const t=e.split("."),i=t.length-1;let r=n,s=!1;for(let o=0;o{if("locale"in a&&"resource"in a){const{locale:l,resource:c}=a;l?(o[l]=o[l]||dn(),Gp(c,o[l])):Gp(c,o)}else rt(a)&&Gp(JSON.parse(a),o)}),r==null&&s)for(const a in o)ys(o,a)&&Ch(o[a]);return o}function eI(n){return n.type}function tI(n,e,t){let i=jt(e.messages)?e.messages:dn();"__i18nGlobal"in t&&(i=o2(n.locale.value,{messages:i,__i18n:t.__i18nGlobal}));const r=Object.keys(i);r.length&&r.forEach(s=>{n.mergeLocaleMessage(s,i[s])});{if(jt(e.datetimeFormats)){const s=Object.keys(e.datetimeFormats);s.length&&s.forEach(o=>{n.mergeDateTimeFormat(o,e.datetimeFormats[o])})}if(jt(e.numberFormats)){const s=Object.keys(e.numberFormats);s.length&&s.forEach(o=>{n.mergeNumberFormat(o,e.numberFormats[o])})}}}function mT(n){return Re(Iu,null,n,0)}const gT="__INTLIFY_META__",yT=()=>[],Gte=()=>!1;let vT=0;function _T(n){return(e,t,i,r)=>n(t,i,Wo()||void 0,r)}const Wte=()=>{const n=Wo();let e=null;return n&&(e=eI(n)[gT])?{[gT]:e}:null};function a2(n={}){const{__root:e,__injectWithOption:t}=n,i=e===void 0,r=n.flatJson,s=Fm?Dn:Nr;let o=$t(n.inheritLocale)?n.inheritLocale:!0;const a=s(e&&o?e.locale.value:rt(n.locale)?n.locale:wh),l=s(e&&o?e.fallbackLocale.value:rt(n.fallbackLocale)||In(n.fallbackLocale)||Lt(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:a.value),c=s(o2(a.value,n)),u=s(Lt(n.datetimeFormats)?n.datetimeFormats:{[a.value]:{}}),d=s(Lt(n.numberFormats)?n.numberFormats:{[a.value]:{}});let h=e?e.missingWarn:$t(n.missingWarn)||Mu(n.missingWarn)?n.missingWarn:!0,f=e?e.fallbackWarn:$t(n.fallbackWarn)||Mu(n.fallbackWarn)?n.fallbackWarn:!0,p=e?e.fallbackRoot:$t(n.fallbackRoot)?n.fallbackRoot:!0,g=!!n.fallbackFormat,y=yn(n.missing)?n.missing:null,m=yn(n.missing)?_T(n.missing):null,v=yn(n.postTranslation)?n.postTranslation:null,x=e?e.warnHtmlMessage:$t(n.warnHtmlMessage)?n.warnHtmlMessage:!0,_=!!n.escapeParameter;const S=e?e.modifiers:Lt(n.modifiers)?n.modifiers:{};let E=n.pluralRules||e&&e.pluralRules,A;A=(()=>{i&&oT(null);const G={version:Hte,locale:a.value,fallbackLocale:l.value,messages:c.value,modifiers:S,pluralRules:E,missing:m===null?void 0:m,missingWarn:h,fallbackWarn:f,fallbackFormat:g,unresolving:!0,postTranslation:v===null?void 0:v,warnHtmlMessage:x,escapeParameter:_,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};G.datetimeFormats=u.value,G.numberFormats=d.value,G.__datetimeFormatters=Lt(A)?A.__datetimeFormatters:void 0,G.__numberFormatters=Lt(A)?A.__numberFormatters:void 0;const X=Ete(G);return i&&oT(X),X})(),Sd(A,a.value,l.value);function w(){return[a.value,l.value,c.value,u.value,d.value]}const M=Ge({get:()=>a.value,set:G=>{A.locale=G,a.value=G}}),I=Ge({get:()=>l.value,set:G=>{A.fallbackLocale=G,l.value=G,Sd(A,a.value,G)}}),L=Ge(()=>c.value),k=Ge(()=>u.value),T=Ge(()=>d.value);function F(){return yn(v)?v:null}function V(G){v=G,A.postTranslation=G}function Q(){return y}function ee(G){G!==null&&(m=_T(G)),y=G,A.missing=m}const se=(G,X,ue,z,C,N)=>{w();let q;try{__INTLIFY_PROD_DEVTOOLS__,i||(A.fallbackContext=e?Cte():void 0),q=G(A)}finally{__INTLIFY_PROD_DEVTOOLS__,i||(A.fallbackContext=void 0)}if(ue!=="translate exists"&&Gn(q)&&q===F0||ue==="translate exists"&&!q){const[Z,$]=X();return e&&p?z(e):C(Z)}else{if(N(q))return q;throw Br(ur.UNEXPECTED_RETURN_TYPE)}};function he(...G){return se(X=>Reflect.apply(pT,null,[X,...G]),()=>Nv(...G),"translate",X=>Reflect.apply(X.t,X,[...G]),X=>X,X=>rt(X))}function ie(...G){const[X,ue,z]=G;if(z&&!jt(z))throw Br(ur.INVALID_ARGUMENT);return he(X,ue,Zn({resolvedMessage:!0},z||{}))}function re(...G){return se(X=>Reflect.apply(lT,null,[X,...G]),()=>Rv(...G),"datetime format",X=>Reflect.apply(X.d,X,[...G]),()=>rT,X=>rt(X)||In(X))}function be(...G){return se(X=>Reflect.apply(uT,null,[X,...G]),()=>Iv(...G),"number format",X=>Reflect.apply(X.n,X,[...G]),()=>rT,X=>rt(X)||In(X))}function le(G){return G.map(X=>rt(X)||Gn(X)||$t(X)?mT(String(X)):X)}const Te={normalize:le,interpolate:G=>G,type:"vnode"};function Ce(...G){return se(X=>{let ue;const z=X;try{z.processor=Te,ue=Reflect.apply(pT,null,[z,...G])}finally{z.processor=null}return ue},()=>Nv(...G),"translate",X=>X[Pv](...G),X=>[mT(X)],X=>In(X))}function Ie(...G){return se(X=>Reflect.apply(uT,null,[X,...G]),()=>Iv(...G),"number format",X=>X[Dv](...G),yT,X=>rt(X)||In(X))}function ze(...G){return se(X=>Reflect.apply(lT,null,[X,...G]),()=>Rv(...G),"datetime format",X=>X[Lv](...G),yT,X=>rt(X)||In(X))}function Be(G){E=G,A.pluralRules=E}function it(G,X){return se(()=>{if(!G)return!1;const ue=rt(X)?X:a.value,z=b(ue),C=A.messageResolver(z,G);return Xs(C)||Xr(C)||rt(C)},()=>[G],"translate exists",ue=>Reflect.apply(ue.te,ue,[G,X]),Gte,ue=>$t(ue))}function te(G){let X=null;const ue=HR(A,l.value,a.value);for(let z=0;z{o&&(a.value=G,A.locale=G,Sd(A,a.value,l.value))}),ci(e.fallbackLocale,G=>{o&&(l.value=G,A.fallbackLocale=G,Sd(A,a.value,l.value))}));const W={id:vT,locale:M,fallbackLocale:I,get inheritLocale(){return o},set inheritLocale(G){o=G,G&&e&&(a.value=e.locale.value,l.value=e.fallbackLocale.value,Sd(A,a.value,l.value))},get availableLocales(){return Object.keys(c.value).sort()},messages:L,get modifiers(){return S},get pluralRules(){return E||{}},get isGlobal(){return i},get missingWarn(){return h},set missingWarn(G){h=G,A.missingWarn=h},get fallbackWarn(){return f},set fallbackWarn(G){f=G,A.fallbackWarn=f},get fallbackRoot(){return p},set fallbackRoot(G){p=G},get fallbackFormat(){return g},set fallbackFormat(G){g=G,A.fallbackFormat=g},get warnHtmlMessage(){return x},set warnHtmlMessage(G){x=G,A.warnHtmlMessage=G},get escapeParameter(){return _},set escapeParameter(G){_=G,A.escapeParameter=G},t:he,getLocaleMessage:b,setLocaleMessage:oe,mergeLocaleMessage:J,getPostTranslationHandler:F,setPostTranslationHandler:V,getMissingHandler:Q,setMissingHandler:ee,[ZR]:Be};return W.datetimeFormats=k,W.numberFormats=T,W.rt=ie,W.te=it,W.tm=ne,W.d=re,W.n=be,W.getDateTimeFormat=H,W.setDateTimeFormat=P,W.mergeDateTimeFormat=U,W.getNumberFormat=j,W.setNumberFormat=B,W.mergeNumberFormat=D,W[JR]=t,W[Pv]=Ce,W[Lv]=ze,W[Dv]=Ie,W}function Qte(n){const e=rt(n.locale)?n.locale:wh,t=rt(n.fallbackLocale)||In(n.fallbackLocale)||Lt(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:e,i=yn(n.missing)?n.missing:void 0,r=$t(n.silentTranslationWarn)||Mu(n.silentTranslationWarn)?!n.silentTranslationWarn:!0,s=$t(n.silentFallbackWarn)||Mu(n.silentFallbackWarn)?!n.silentFallbackWarn:!0,o=$t(n.fallbackRoot)?n.fallbackRoot:!0,a=!!n.formatFallbackMessages,l=Lt(n.modifiers)?n.modifiers:{},c=n.pluralizationRules,u=yn(n.postTranslation)?n.postTranslation:void 0,d=rt(n.warnHtmlInMessage)?n.warnHtmlInMessage!=="off":!0,h=!!n.escapeParameterHtml,f=$t(n.sync)?n.sync:!0;let p=n.messages;if(Lt(n.sharedMessages)){const S=n.sharedMessages;p=Object.keys(S).reduce((A,R)=>{const w=A[R]||(A[R]={});return Zn(w,S[R]),A},p||{})}const{__i18n:g,__root:y,__injectWithOption:m}=n,v=n.datetimeFormats,x=n.numberFormats,_=n.flatJson;return{locale:e,fallbackLocale:t,messages:p,flatJson:_,datetimeFormats:v,numberFormats:x,missing:i,missingWarn:r,fallbackWarn:s,fallbackRoot:o,fallbackFormat:a,modifiers:l,pluralRules:c,postTranslation:u,warnHtmlMessage:d,escapeParameter:h,messageResolver:n.messageResolver,inheritLocale:f,__i18n:g,__root:y,__injectWithOption:m}}function Ov(n={}){const e=a2(Qte(n)),{__extender:t}=n,i={id:e.id,get locale(){return e.locale.value},set locale(r){e.locale.value=r},get fallbackLocale(){return e.fallbackLocale.value},set fallbackLocale(r){e.fallbackLocale.value=r},get messages(){return e.messages.value},get datetimeFormats(){return e.datetimeFormats.value},get numberFormats(){return e.numberFormats.value},get availableLocales(){return e.availableLocales},get missing(){return e.getMissingHandler()},set missing(r){e.setMissingHandler(r)},get silentTranslationWarn(){return $t(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(r){e.missingWarn=$t(r)?!r:r},get silentFallbackWarn(){return $t(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(r){e.fallbackWarn=$t(r)?!r:r},get modifiers(){return e.modifiers},get formatFallbackMessages(){return e.fallbackFormat},set formatFallbackMessages(r){e.fallbackFormat=r},get postTranslation(){return e.getPostTranslationHandler()},set postTranslation(r){e.setPostTranslationHandler(r)},get sync(){return e.inheritLocale},set sync(r){e.inheritLocale=r},get warnHtmlInMessage(){return e.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(r){e.warnHtmlMessage=r!=="off"},get escapeParameterHtml(){return e.escapeParameter},set escapeParameterHtml(r){e.escapeParameter=r},get pluralizationRules(){return e.pluralRules||{}},__composer:e,t(...r){return Reflect.apply(e.t,e,[...r])},rt(...r){return Reflect.apply(e.rt,e,[...r])},te(r,s){return e.te(r,s)},tm(r){return e.tm(r)},getLocaleMessage(r){return e.getLocaleMessage(r)},setLocaleMessage(r,s){e.setLocaleMessage(r,s)},mergeLocaleMessage(r,s){e.mergeLocaleMessage(r,s)},d(...r){return Reflect.apply(e.d,e,[...r])},getDateTimeFormat(r){return e.getDateTimeFormat(r)},setDateTimeFormat(r,s){e.setDateTimeFormat(r,s)},mergeDateTimeFormat(r,s){e.mergeDateTimeFormat(r,s)},n(...r){return Reflect.apply(e.n,e,[...r])},getNumberFormat(r){return e.getNumberFormat(r)},setNumberFormat(r,s){e.setNumberFormat(r,s)},mergeNumberFormat(r,s){e.mergeNumberFormat(r,s)}};return i.__extender=t,i}function jte(n,e,t){return{beforeCreate(){const i=Wo();if(!i)throw Br(ur.UNEXPECTED_ERROR);const r=this.$options;if(r.i18n){const s=r.i18n;if(r.__i18n&&(s.__i18n=r.__i18n),s.__root=e,this===this.$root)this.$i18n=xT(n,s);else{s.__injectWithOption=!0,s.__extender=t.__vueI18nExtend,this.$i18n=Ov(s);const o=this.$i18n;o.__extender&&(o.__disposer=o.__extender(this.$i18n))}}else if(r.__i18n)if(this===this.$root)this.$i18n=xT(n,r);else{this.$i18n=Ov({__i18n:r.__i18n,__injectWithOption:!0,__extender:t.__vueI18nExtend,__root:e});const s=this.$i18n;s.__extender&&(s.__disposer=s.__extender(this.$i18n))}else this.$i18n=n;r.__i18nGlobal&&tI(e,r,r),this.$t=(...s)=>this.$i18n.t(...s),this.$rt=(...s)=>this.$i18n.rt(...s),this.$te=(s,o)=>this.$i18n.te(s,o),this.$d=(...s)=>this.$i18n.d(...s),this.$n=(...s)=>this.$i18n.n(...s),this.$tm=s=>this.$i18n.tm(s),t.__setInstance(i,this.$i18n)},mounted(){},unmounted(){const i=Wo();if(!i)throw Br(ur.UNEXPECTED_ERROR);const r=this.$i18n;delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,r.__disposer&&(r.__disposer(),delete r.__disposer,delete r.__extender),t.__deleteInstance(i),delete this.$i18n}}}function xT(n,e){n.locale=e.locale||n.locale,n.fallbackLocale=e.fallbackLocale||n.fallbackLocale,n.missing=e.missing||n.missing,n.silentTranslationWarn=e.silentTranslationWarn||n.silentFallbackWarn,n.silentFallbackWarn=e.silentFallbackWarn||n.silentFallbackWarn,n.formatFallbackMessages=e.formatFallbackMessages||n.formatFallbackMessages,n.postTranslation=e.postTranslation||n.postTranslation,n.warnHtmlInMessage=e.warnHtmlInMessage||n.warnHtmlInMessage,n.escapeParameterHtml=e.escapeParameterHtml||n.escapeParameterHtml,n.sync=e.sync||n.sync,n.__composer[ZR](e.pluralizationRules||n.pluralizationRules);const t=o2(n.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(t).forEach(i=>n.mergeLocaleMessage(i,t[i])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(i=>n.mergeDateTimeFormat(i,e.datetimeFormats[i])),e.numberFormats&&Object.keys(e.numberFormats).forEach(i=>n.mergeNumberFormat(i,e.numberFormats[i])),n}const l2={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function qte({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((i,r)=>[...i,...r.type===Hn?r.children:[r]],[]):e.reduce((t,i)=>{const r=n[i];return r&&(t[i]=r()),t},dn())}function nI(){return Hn}const Xte=rn({name:"i18n-t",props:Zn({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>Gn(n)||!isNaN(n)}},l2),setup(n,e){const{slots:t,attrs:i}=e,r=n.i18n||c2({useScope:n.scope,__useComponent:!0});return()=>{const s=Object.keys(t).filter(d=>d[0]!=="_"),o=dn();n.locale&&(o.locale=n.locale),n.plural!==void 0&&(o.plural=rt(n.plural)?+n.plural:n.plural);const a=qte(e,s),l=r[Pv](n.keypath,a,o),c=Zn(dn(),i),u=rt(n.tag)||jt(n.tag)?n.tag:nI();return Da(u,c,l)}}}),ST=Xte;function Kte(n){return In(n)&&!rt(n[0])}function iI(n,e,t,i){const{slots:r,attrs:s}=e;return()=>{const o={part:!0};let a=dn();n.locale&&(o.locale=n.locale),rt(n.format)?o.key=n.format:jt(n.format)&&(rt(n.format.key)&&(o.key=n.format.key),a=Object.keys(n.format).reduce((h,f)=>t.includes(f)?Zn(dn(),h,{[f]:n.format[f]}):h,dn()));const l=i(n.value,o,a);let c=[o.key];In(l)?c=l.map((h,f)=>{const p=r[h.type],g=p?p({[h.type]:h.value,index:f,parts:l}):[h.value];return Kte(g)&&(g[0].key="".concat(h.type,"-").concat(f)),g}):rt(l)&&(c=[l]);const u=Zn(dn(),s),d=rt(n.tag)||jt(n.tag)?n.tag:nI();return Da(d,u,c)}}const Yte=rn({name:"i18n-n",props:Zn({value:{type:Number,required:!0},format:{type:[String,Object]}},l2),setup(n,e){const t=n.i18n||c2({useScope:n.scope,__useComponent:!0});return iI(n,e,XR,(...i)=>t[Dv](...i))}}),AT=Yte;function Zte(n,e){const t=n;if(n.mode==="composition")return t.__getInstance(e)||n.global;{const i=t.__getInstance(e);return i!=null?i.__composer:n.global.__composer}}function Jte(n){const e=o=>{const{instance:a,value:l}=o;if(!a||!a.$)throw Br(ur.UNEXPECTED_ERROR);const c=Zte(n,a.$),u=bT(l);return[Reflect.apply(c.t,c,[...TT(u)]),c]};return{created:(o,a)=>{const[l,c]=e(a);Fm&&n.global===c&&(o.__i18nWatcher=ci(c.locale,()=>{a.instance&&a.instance.$forceUpdate()})),o.__composer=c,o.textContent=l},unmounted:o=>{Fm&&o.__i18nWatcher&&(o.__i18nWatcher(),o.__i18nWatcher=void 0,delete o.__i18nWatcher),o.__composer&&(o.__composer=void 0,delete o.__composer)},beforeUpdate:(o,{value:a})=>{if(o.__composer){const l=o.__composer,c=bT(a);o.textContent=Reflect.apply(l.t,l,[...TT(c)])}},getSSRProps:o=>{const[a]=e(o);return{textContent:a}}}}function bT(n){if(rt(n))return{path:n};if(Lt(n)){if(!("path"in n))throw Br(ur.REQUIRED_VALUE,"path");return n}else throw Br(ur.INVALID_VALUE)}function TT(n){const{path:e,locale:t,args:i,choice:r,plural:s}=n,o={},a=i||{};return rt(t)&&(o.locale=t),Gn(r)&&(o.plural=r),Gn(s)&&(o.plural=s),[e,a,o]}function ene(n,e,...t){const i=Lt(t[0])?t[0]:{};($t(i.globalInstall)?i.globalInstall:!0)&&([ST.name,"I18nT"].forEach(s=>n.component(s,ST)),[AT.name,"I18nN"].forEach(s=>n.component(s,AT)),[CT.name,"I18nD"].forEach(s=>n.component(s,CT))),n.directive("t",Jte(e))}const tne=$a("global-vue-i18n");function nne(n={}){const e=__VUE_I18N_LEGACY_API__&&$t(n.legacy)?n.legacy:__VUE_I18N_LEGACY_API__,t=$t(n.globalInjection)?n.globalInjection:!0,i=new Map,[r,s]=ine(n,e),o=$a("");function a(d){return i.get(d)||null}function l(d,h){i.set(d,h)}function c(d){i.delete(d)}const u={get mode(){return __VUE_I18N_LEGACY_API__&&e?"legacy":"composition"},async install(d,...h){if(d.__VUE_I18N_SYMBOL__=o,d.provide(d.__VUE_I18N_SYMBOL__,u),Lt(h[0])){const g=h[0];u.__composerExtend=g.__composerExtend,u.__vueI18nExtend=g.__vueI18nExtend}let f=null;!e&&t&&(f=dne(d,u.global)),__VUE_I18N_FULL_INSTALL__&&ene(d,u,...h),__VUE_I18N_LEGACY_API__&&e&&d.mixin(jte(s,s.__composer,u));const p=d.unmount;d.unmount=()=>{f&&f(),u.dispose(),p()}},get global(){return s},dispose(){r.stop()},__instances:i,__getInstance:a,__setInstance:l,__deleteInstance:c};return u}function c2(n={}){const e=Wo();if(e==null)throw Br(ur.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Br(ur.NOT_INSTALLED);const t=rne(e),i=one(t),r=eI(e),s=sne(n,r);if(s==="global")return tI(i,n,r),i;if(s==="parent"){let l=ane(t,e,n.__useComponent);return l==null&&(l=i),l}const o=t;let a=o.__getInstance(e);if(a==null){const l=Zn({},n);"__i18n"in r&&(l.__i18n=r.__i18n),i&&(l.__root=i),a=a2(l),o.__composerExtend&&(a[Fv]=o.__composerExtend(a)),cne(o,e,a),o.__setInstance(e,a)}return a}function ine(n,e){const t=Hv(),i=__VUE_I18N_LEGACY_API__&&e?t.run(()=>Ov(n)):t.run(()=>a2(n));if(i==null)throw Br(ur.UNEXPECTED_ERROR);return[t,i]}function rne(n){const e=Ji(n.isCE?tne:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Br(n.isCE?ur.NOT_INSTALLED_WITH_PROVIDE:ur.UNEXPECTED_ERROR);return e}function sne(n,e){return L0(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function one(n){return n.mode==="composition"?n.global:n.global.__composer}function ane(n,e,t=!1){let i=null;const r=e.root;let s=lne(e,t);for(;s!=null;){const o=n;if(n.mode==="composition")i=o.__getInstance(s);else if(__VUE_I18N_LEGACY_API__){const a=o.__getInstance(s);a!=null&&(i=a.__composer,t&&i&&!i[JR]&&(i=null))}if(i!=null||r===s)break;s=s.parent}return i}function lne(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function cne(n,e,t){ka(()=>{},e),Lh(()=>{const i=t;n.__deleteInstance(e);const r=i[Fv];r&&(r(),delete i[Fv])},e)}const une=["locale","fallbackLocale","availableLocales"],wT=["t","rt","d","n","tm","te"];function dne(n,e){const t=Object.create(null);return une.forEach(r=>{const s=Object.getOwnPropertyDescriptor(e,r);if(!s)throw Br(ur.UNEXPECTED_ERROR);const o=bn(s.value)?{get(){return s.value.value},set(a){s.value.value=a}}:{get(){return s.get&&s.get()}};Object.defineProperty(t,r,o)}),n.config.globalProperties.$i18n=t,wT.forEach(r=>{const s=Object.getOwnPropertyDescriptor(e,r);if(!s||!s.value)throw Br(ur.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,"$".concat(r),s)}),()=>{delete n.config.globalProperties.$i18n,wT.forEach(r=>{delete n.config.globalProperties["$".concat(r)]})}}const hne=rn({name:"i18n-d",props:Zn({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},l2),setup(n,e){const t=n.i18n||c2({useScope:n.scope,__useComponent:!0});return iI(n,e,qR,(...i)=>t[Lv](...i))}}),CT=hne;$te();Ste(nte);Ate(vte);bte(HR);if(__INTLIFY_PROD_DEVTOOLS__){const n=wl();n.__INTLIFY__=!0,ite(n.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}const fne={locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",yearFormat:"YYYY年",dayFormat:"D日",dateFormat:"YYYY年M月D日",dateTimeFormat:"YYYY年M月D日 HH时mm分ss秒",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪"},rI={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},Bv={lang:Ue({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},fne),timePickerLocale:Ue({},rI)};Bv.lang.ok="确定";const gr="${label}不是一个有效的${type}",pne={locale:"zh-cn",Pagination:oee,DatePicker:Bv,TimePicker:rI,Calendar:Bv,global:{placeholder:"请选择"},Table:{filterTitle:"筛选",filterConfirm:"确定",filterReset:"重置",filterEmptyText:"无筛选项",filterCheckall:"全选",filterSearchPlaceholder:"在筛选项中搜索",selectAll:"全选当页",selectInvert:"反选当页",selectNone:"清空所有",selectionAll:"全选所有",sortTitle:"排序",expand:"展开行",collapse:"关闭行",triggerDesc:"点击降序",triggerAsc:"点击升序",cancelSort:"取消排序"},Tour:{Next:"下一步",Previous:"上一步",Finish:"结束导览"},Modal:{okText:"确定",cancelText:"取消",justOkText:"知道了"},Popconfirm:{cancelText:"取消",okText:"确定"},Transfer:{searchPlaceholder:"请输入搜索内容",itemUnit:"项",itemsUnit:"项",remove:"删除",selectCurrent:"全选当页",removeCurrent:"删除当页",selectAll:"全选所有",removeAll:"删除全部",selectInvert:"反选当页"},Upload:{uploading:"文件上传中",removeFile:"删除文件",uploadError:"上传错误",previewFile:"预览文件",downloadFile:"下载文件"},Empty:{description:"暂无数据"},Icon:{icon:"图标"},Text:{edit:"编辑",copy:"复制",copied:"复制成功",expand:"展开"},PageHeader:{back:"返回"},Form:{optional:"(可选)",defaultValidateMessages:{default:"字段验证错误${label}",required:"请输入${label}",enum:"${label}必须是其中一个[${enum}]",whitespace:"${label}不能为空字符",date:{format:"${label}日期格式无效",parse:"${label}不能转换为日期",invalid:"${label}是一个无效日期"},types:{string:gr,method:gr,array:gr,object:gr,number:gr,date:gr,boolean:gr,integer:gr,float:gr,regexp:gr,email:gr,url:gr,hex:gr},string:{len:"${label}须为${len}个字符",min:"${label}最少${min}个字符",max:"${label}最多${max}个字符",range:"${label}须在${min}-${max}字符之间"},number:{len:"${label}必须等于${len}",min:"${label}最小值为${min}",max:"${label}最大值为${max}",range:"${label}须在${min}-${max}之间"},array:{len:"须为${len}个${label}",min:"最少${min}个${label}",max:"最多${max}个${label}",range:"${label}数量须在${min}-${max}之间"},pattern:{mismatch:"${label}与模式不匹配${pattern}"}}},Image:{preview:"预览"},QRCode:{expired:"二维码已过期",refresh:"点击刷新",scanned:"已扫描"}},mne={message:{hello:"hello world"}},gne={message:{hello:"你好,世界"}},sI=Dn("zh"),yne={zh:pne,en:Su},vne={en:mne,zh:gne},_ne=nne({legacy:!1,locale:sI.value,messages:vne}),xne=rn({__name:"index",props:{color:{},fontSize:{},icon:{}},emits:[],setup(n,{emit:e}){return(t,i)=>(ft(),ou(A8(t.icon),{class:"icon",style:Qs({fontSize:t.fontSize+"px",color:t.color})},null,8,["style"]))}}),Cd=ii(xne,[["__scopeId","data-v-91f3cb32"]]),Sne={},Ane={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"20",height:"20",viewBox:"0 0 20 20"};function bne(n,e){return ft(),xt("svg",Ane,e[0]||(e[0]=[Nu('',2)]))}const Tne=ii(Sne,[["render",bne]]),wne={},Cne={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"20",height:"20",viewBox:"0 0 20 20"};function Ene(n,e){return ft(),xt("svg",Cne,e[0]||(e[0]=[Nu('',2)]))}const Mne=ii(wne,[["render",Ene]]),Rne={},Ine={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"14.000000357627869",height:"10.000000357627869",viewBox:"0 0 14.000000357627869 10.000000357627869"};function Nne(n,e){return ft(),xt("svg",Ine,e[0]||(e[0]=[zt("g",null,[zt("path",{d:"M13.802466686534881,1.1380186865348816Q13.89646668653488,1.0444176865348815,13.947366686534881,0.9218876865348815Q13.998366686534881,0.7993576865348816,13.998366686534881,0.6666666865348816Q13.998366686534881,0.6011698865348816,13.98556668653488,0.5369316865348817Q13.972766686534882,0.4726936865348816,13.947666686534882,0.4121826865348816Q13.922666686534882,0.3516706865348816,13.886266686534881,0.2972126865348816Q13.849866686534881,0.2427536865348816,13.803566686534882,0.19644068653488161Q13.757266686534882,0.15012768653488162,13.702766686534881,0.11373968653488165Q13.648366686534882,0.07735168653488156,13.587866686534882,0.052286686534881555Q13.527266686534881,0.02722268653488158,13.463066686534882,0.014444686534881623Q13.398866686534882,0.0016666865348815563,13.333366686534882,0.0016666865348815563Q13.201466686534882,0.0016666865348815563,13.079566686534882,0.051981686534881555Q12.957666686534882,0.10229768653488158,12.864266686534881,0.1953146865348816L12.863066686534882,0.19413268653488158L4.624996686534882,8.392776686534882L1.1369396865348815,4.921396686534882L1.1357636865348817,4.922586686534881Q1.0422996865348817,4.829566686534881,0.9204146865348816,4.779246686534882Q0.7985286865348816,4.728936686534881,0.6666666865348816,4.728936686534881Q0.6011698865348816,4.728936686534881,0.5369316865348817,4.741706686534882Q0.4726936865348816,4.754486686534881,0.4121826865348816,4.779556686534882Q0.3516706865348816,4.804616686534882,0.2972126865348816,4.8410066865348815Q0.2427536865348816,4.8773966865348815,0.19644068653488161,4.9237066865348815Q0.15012768653488162,4.970016686534882,0.11373968653488165,5.024476686534881Q0.07735168653488156,5.078936686534882,0.052286686534881555,5.139446686534882Q0.02722268653488158,5.199956686534882,0.014444686534881623,5.2641966865348815Q0.0016666865348815563,5.328436686534881,0.0016666865348815563,5.3939366865348815Q0.0016666865348815563,5.526626686534882,0.05259268653488158,5.649156686534882Q0.10351768653488158,5.771686686534881,0.1975696865348816,5.865286686534882L0.1963936865348816,5.866466686534881L4.1547266865348815,9.805866686534882Q4.201126686534882,9.852046686534882,4.255616686534882,9.888306686534882Q4.310106686534882,9.924576686534882,4.3706166865348814,9.949556686534882Q4.431126686534881,9.974536686534881,4.495326686534882,9.987266686534882Q4.559536686534882,9.999996686534882,4.624996686534882,9.999996686534882Q4.690456686534882,9.999996686534882,4.754666686534882,9.987266686534882Q4.818876686534882,9.974536686534881,4.879386686534882,9.949556686534882Q4.939886686534882,9.924576686534882,4.994386686534882,9.888306686534882Q5.048876686534881,9.852046686534882,5.0952766865348815,9.805866686534882L13.803566686534882,1.1392006865348816L13.802466686534881,1.1380186865348816Z","fill-rule":"evenodd",fill:"#E0E0FC","fill-opacity":"1",style:{"mix-blend-mode":"passthrough"}})],-1)]))}const ET=ii(Rne,[["render",Nne]]),Pne={},Lne={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"20",height:"20",viewBox:"0 0 20 20"};function Dne(n,e){return ft(),xt("svg",Lne,e[0]||(e[0]=[Nu('',2)]))}const Fne=ii(Pne,[["render",Dne]]),One={},Bne={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"20",height:"20",viewBox:"0 0 20 20"};function kne(n,e){return ft(),xt("svg",Bne,e[0]||(e[0]=[Nu('',2)]))}const Une=ii(One,[["render",kne]]),zne={},Vne={class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg"};function Hne(n,e){return ft(),xt("svg",Vne,e[0]||(e[0]=[zt("path",{d:"M899.925333 172.080762a48.761905 48.761905 0 0 1 0 28.525714l-207.969523 679.448381a48.761905 48.761905 0 0 1-81.115429 20.187429l-150.552381-150.552381-96.304762 96.329143a24.380952 24.380952 0 0 1-41.593905-17.237334v-214.966857l275.821715-243.370667-355.57181 161.596953-103.253333-103.228953a48.761905 48.761905 0 0 1 20.23619-81.091047L838.997333 139.702857a48.761905 48.761905 0 0 1 60.903619 32.353524z"},null,-1)]))}const $ne=ii(zne,[["render",Hne]]),Gne={},Wne={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"20",height:"20",viewBox:"0 0 20 20"};function Qne(n,e){return ft(),xt("svg",Wne,e[0]||(e[0]=[Nu('',2)]))}const jne=ii(Gne,[["render",Qne]]),qne={},Xne={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",fill:"none",version:"1.1",width:"20",height:"20",viewBox:"0 0 20 20"};function Kne(n,e){return ft(),xt("svg",Xne,e[0]||(e[0]=[Nu('',2)]))}const Yne=ii(qne,[["render",Kne]]),Zne={},Jne={t:"1744352112173",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"16533","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"200",height:"200"};function eie(n,e){return ft(),xt("svg",Jne,e[0]||(e[0]=[zt("path",{d:"M824 466.56V213.12q0-13.6512-5.2928-26.1632-5.104-12.064-14.3904-21.3536-9.2864-9.2864-21.3504-14.3872-12.5152-5.2928-26.1664-5.2928H246.4q-13.6512 0-26.1664 5.2928-12.064 5.1008-21.3504 14.3872-9.2864 9.2864-14.3904 21.3536Q179.2 199.4688 179.2 213.12v607.296q0 12.8448 5.0592 24.608 4.8576 11.2896 13.6704 19.9552 8.7616 8.6176 20.1184 13.344Q229.7792 883.2 242.56 883.2h217.6a28.8 28.8 0 0 0 0-57.6h-217.6q-2.528 0-4.2432-1.6864-1.5168-1.4912-1.5168-3.4976V213.12q0-3.9744 2.8128-6.784 2.8096-2.816 6.7872-2.816h510.4q3.9776 0 6.7872 2.816 2.8128 2.8096 2.8128 6.784v253.44a28.8 28.8 0 0 0 28.8 28.8 28.8 28.8 0 0 0 28.8-28.8zM466.0064 338.08l-130.2016 278.784A32 32 0 0 0 364.8 662.4h0.176a31.9904 31.9904 0 0 0 28.8192-18.4576L418.048 592h165.4976l15.2896 32.736q3.1008-3.4144 6.3904-6.704 20.3584-20.3616 45.4816-33.472l-115.1168-246.4832q-4.9408-10.5792-14.8704-16.5952-9.168-5.5552-19.9232-5.5552-10.7552 0-19.9232 5.5552-9.9296 6.016-14.8704 16.5952z m34.7936 76.7456L553.6576 528h-105.7152l52.8576-113.1776zM896 750.4c0 87.4816-70.9184 158.4-158.4 158.4S579.2 837.8816 579.2 750.4s70.9184-158.4 158.4-158.4 158.4 70.9184 158.4 158.4z m-116.3648-82.7648a28.9152 28.9152 0 0 1 7.1648-5.232q-5.8048-3.232-12.096-5.7248Q756.8256 649.6 737.6 649.6q-19.2256 0-37.104 7.0784-19.4112 7.6832-34.1728 22.448-14.7616 14.7616-22.4448 34.1696Q636.8 731.1744 636.8 750.4q0 19.232 7.0784 37.104 2.4896 6.2944 5.7248 12.096a28.7552 28.7552 0 0 1 5.232-7.1648l124.8-124.8zM838.4 750.4q0-19.2256-7.0784-37.104-2.4896-6.2912-5.7248-12.096a28.6944 28.6944 0 0 1-5.232 7.168l-124.8 124.8a28.7552 28.7552 0 0 1-7.1648 5.2288q5.8048 3.2352 12.096 5.728Q718.3744 851.2 737.6 851.2q19.2256 0 37.104-7.072 19.4112-7.6896 34.1728-22.4512 14.7616-14.7616 22.4448-34.1728Q838.4 769.632 838.4 750.4z","p-id":"16534"},null,-1)]))}const tie=ii(Zne,[["render",eie]]),nie={},iie={t:"1744352097285",class:"icon",viewBox:"0 0 1024 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg","p-id":"16380","data-spm-anchor-id":"a313x.manage_type_myprojects.0.i0.60b03a81nz0mun","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"200",height:"200"};function rie(n,e){return ft(),xt("svg",iie,e[0]||(e[0]=[zt("path",{d:"M833.6 213.12v253.44a28.8 28.8 0 0 1-28.8 28.8 28.8 28.8 0 0 1-28.8-28.8V213.12q0-3.9744-2.8128-6.784-2.8096-2.816-6.7872-2.816H256q-3.9776 0-6.7872 2.816Q246.4 209.1424 246.4 213.12v607.296q0 2.0064 1.5168 3.4976 1.7152 1.6864 4.2432 1.6864h217.6a28.8 28.8 0 0 1 0 57.6h-217.6q-12.7808 0-24.512-4.8768-11.3568-4.7232-20.1184-13.3408-8.8128-8.6656-13.6704-19.9584Q188.8 833.264 188.8 820.416V213.12q0-13.6512 5.2928-26.1632 5.104-12.064 14.3904-21.3536 9.2864-9.2864 21.3504-14.3872Q242.3456 145.92 256 145.92h510.4q13.6512 0 26.1664 5.2928 12.064 5.1008 21.3504 14.3872 9.2864 9.2864 14.3904 21.3536 5.2928 12.512 5.2928 26.1664zM345.408 613.664l130.1984-278.784q4.9408-10.5824 14.8704-16.5984 9.168-5.5552 19.9232-5.5552 10.7552 0 19.9232 5.5552 9.9296 6.016 14.8704 16.5952l130.2016 278.784a32 32 0 0 1-28.672 45.5392l-0.3232 0.0032c-12.4288 0-23.7344-7.2-28.9952-18.4608L593.1488 588.8h-165.4976l-24.256 51.9424a32.0064 32.0064 0 0 1-28.8192 18.4576l-0.176 0.0032a32 32 0 0 1-28.992-45.5424z m164.992-202.0416L457.5424 524.8h105.7152L510.4 411.6224z m120.2784 329.44l61.3216 61.5872 162.1248-162.8256a31.9936 31.9936 0 0 1 22.608-9.424H876.8a32 32 0 0 1 32 31.936v0.064a32 32 0 0 1-9.3216 22.5792l-184.8 185.6-0.0992 0.0992a31.9936 31.9936 0 0 1-45.2544-0.096l-83.984-84.352-0.016-0.016a31.9904 31.9904 0 0 1-9.2896-21.1104l30.496-33.4336c0.4896-0.0224 0.9792-0.032 1.4688-0.032h0.0704a32 32 0 0 1 22.608 9.4208z","p-id":"16381","data-spm-anchor-id":"a313x.manage_type_myprojects.0.i1.60b03a81nz0mun",class:"selected"},null,-1)]))}const sie=ii(nie,[["render",rie]]),oie={class:"action-group"},aie={key:0},lie=["onClick"],cie={key:0,class:"active-icon"},uie={key:1},die=["onClick"],hie={key:0,class:"active-icon"},fie={key:2},pie=rn({__name:"ActionGroup",setup(n){const e=P0(),t=Tl(),{hasCamera:i,hasMic:r,cameraOff:s,micMuted:o,volumeMuted:a,showChatRecords:l,streamState:c,selectedAudioDevice:u,selectedVideoDevice:d,availableAudioDevices:h,availableVideoDevices:f}=sm(e),{handleCameraOff:p,handleMicMuted:g,handleVolumeMute:y,handleDeviceChange:m,handleSubtitleToggle:v}=e,{wrapperRect:x,isLandscape:_}=sm(t),S=Dn(!1),E=Dn(!1);return(A,R)=>{const w=b8("click-outside");return ft(),xt("div",oie,[We(i)?(ft(),xt("div",aie,[Pc((ft(),xt("div",{class:"action",onClick:R[1]||(R[1]=(...M)=>We(p)&&We(p)(...M))},[Re(We(Cd),{icon:We(s)?We(Tne):We(Mne)},null,8,["icon"]),We(c)==="closed"?(ft(),xt("div",{key:0,class:"corner",onClick:R[0]||(R[0]=pf(()=>E.value=!E.value,["stop","prevent"]))},R[6]||(R[6]=[zt("div",{class:"corner-inner"},null,-1)]))):br("",!0),Pc(zt("div",{class:Ks(["selectors",{left:We(_)}])},[(ft(!0),xt(Hn,null,Jd(We(f),M=>(ft(),xt("div",{key:M.deviceId,class:"selector",onClick:pf(()=>{We(m)(M.deviceId),E.value=!1},["stop"])},[em(su(M.label)+" ",1),We(d)&&M.deviceId===We(d).deviceId?(ft(),xt("div",cie,[Re(We(ET))])):br("",!0)],8,lie))),128))],2),[[im,E.value&&We(c)==="closed"]])])),[[w,()=>E.value=!1]])])):br("",!0),We(r)?(ft(),xt("div",uie,[Pc((ft(),xt("div",{class:"action",onClick:R[3]||(R[3]=(...M)=>We(g)&&We(g)(...M))},[Re(We(Cd),{icon:We(o)?We(Fne):We(Une)},null,8,["icon"]),We(c)==="closed"?(ft(),xt("div",{key:0,class:"corner",onClick:R[2]||(R[2]=pf(()=>S.value=!S.value,["stop","prevent"]))},R[7]||(R[7]=[zt("div",{class:"corner-inner"},null,-1)]))):br("",!0),Pc(zt("div",{class:Ks(["selectors",{left:We(_)}])},[(ft(!0),xt(Hn,null,Jd(We(h),M=>(ft(),xt("div",{key:M.deviceId,class:"selector",onClick:pf(I=>{We(m)(M.deviceId),S.value=!1},["stop"])},[em(su(M.label)+" ",1),We(u)&&M.deviceId===We(u).deviceId?(ft(),xt("div",hie,[Re(We(ET))])):br("",!0)],8,die))),128))],2),[[im,S.value&&We(c)==="closed"]])])),[[w,()=>S.value=!1]])])):br("",!0),zt("div",{class:"action",onClick:R[4]||(R[4]=(...M)=>We(y)&&We(y)(...M))},[Re(We(Cd),{icon:We(a)?We(jne):We(Yne)},null,8,["icon"])]),We(x).width>300?(ft(),xt("div",fie,[zt("div",{class:"action",onClick:R[5]||(R[5]=(...M)=>We(v)&&We(v)(...M))},[Re(We(Cd),{icon:We(l)?We(sie):We(tie)},null,8,["icon"])])])):br("",!0)])}}}),mie=ii(pie,[["__scopeId","data-v-1bca64ad"]]),gie={class:"gradio-webrtc-waveContainer"},yie=rn({__name:"AudioWave",props:{streamState:{default:qi.closed},audioSourceCallback:{},numBars:{default:16},icon:{},iconButtonColor:{default:"var(--color-accent)"},pulseColor:{default:"var(--color-accent)"},waveColor:{default:"var(--color-accent)"},pulseScale:{default:1}},emits:[],setup(n,{emit:e}){const t=n;let i,r,s,o;const a=Ge(()=>t.icon?"128px":"calc((var(--boxSize) + var(--gutter)) * ".concat(t.numBars," + 80px)"));ci(()=>t.streamState,()=>{console.log(111111),t.streamState==="open"&&l()},{immediate:!0}),Lh(()=>{o&&cancelAnimationFrame(o),i&&i.close()});function l(){i=new(window.AudioContext||window.webkitAudioContext),r=i.createAnalyser();const d=t.audioSourceCallback();if(!d)return;i.createMediaStreamSource(d).connect(r),r.fftSize=64,r.smoothingTimeConstant=.8,s=new Uint8Array(r.frequencyBinCount),c()}function c(){r.getByteFrequencyData(s);const d=document.querySelectorAll(".gradio-webrtc-waveContainer .gradio-webrtc-box");for(let h=0;h=h.length)throw new Error("Index must be between 0 and 15");return h[d]}return(d,h)=>(ft(),xt("div",gie,[zt("div",{class:"gradio-webrtc-boxContainer",style:Qs({width:a.value})},[(ft(!0),xt(Hn,null,Jd(Array(d.numBars/2),(f,p)=>(ft(),xt("div",{key:p,class:"gradio-webrtc-box"}))),128)),h[0]||(h[0]=zt("div",{class:"split-container"},null,-1)),(ft(!0),xt(Hn,null,Jd(Array(d.numBars/2),(f,p)=>(ft(),xt("div",{key:p,class:"gradio-webrtc-box"}))),128))],4)]))}}),vie=ii(yie,[["__scopeId","data-v-ba6f2cef"]]),_ie={class:"player-controls"},xie={key:0},Sie={key:1,class:"waiting-icon-text"},Aie={key:2,class:"stop-chat-inner"},bie={key:0,class:"input-audio-wave"},Tie=rn({__name:"ChatBtn",props:{streamState:{default:qi.closed},onStartChat:{},audioSourceCallback:{},waveColor:{}},emits:[],setup(n,{emit:e}){return(t,i)=>(ft(),xt("div",_ie,[zt("div",{class:Ks(["chat-btn",t.streamState===We(qi).closed&&"start-chat",t.streamState===We(qi).open&&"stop-chat"]),onClick:i[0]||(i[0]=(...r)=>t.onStartChat&&t.onStartChat(...r))},[t.streamState===We(qi).closed?(ft(),xt("span",xie,"点击开始对话")):t.streamState===We(qi).waiting?(ft(),xt("div",Sie,i[1]||(i[1]=[zt("div",{class:"icon",title:"spinner"},null,-1),zt("span",null,"等待中",-1)]))):(ft(),xt("div",Aie))],2),t.streamState===We(qi).open?(ft(),xt("div",bie,[Re(vie,{audioSourceCallback:t.audioSourceCallback,streamState:t.streamState,waveColor:t.waveColor},null,8,["audioSourceCallback","streamState","waveColor"])])):br("",!0)]))}}),wie=ii(Tie,[["__scopeId","data-v-b69ee979"]]);function Cie(n,e,t){return t<0||t>n.length?(console.error("索引超出范围"),n):n.substring(0,t)+e+n.substring(t)}const Eie={class:"chat-input-container"},Mie={class:"chat-input-inner"},Rie={class:"chat-input-wrapper"},Iie=rn({__name:"ChatInput",props:{replying:{type:Boolean}},emits:["send","stop","interrupt"],setup(n,{emit:e}){const t=e;let i=24,r=Yp("rowsDivRef"),s=Yp("chatInputRef"),o="";function a(h){h.key==="Enter"&&(h.altKey?s.value&&(s.value.value=Cie(s.value.value,"\n",s.value.selectionStart||0),s.value.dispatchEvent(new InputEvent("input"))):(h.preventDefault(),l()))}async function l(){s.value&&(t("send",s.value.value),s.value.value="")}function c(h){r.value&&(r.value.textContent=h.target.value.replace(/\n$/,"\n\n"),i=r.value.offsetHeight)}function u(){t("stop")}function d(){t("interrupt")}return(h,f)=>(ft(),xt("div",Eie,[zt("div",{class:"stop-chat-btn",onClick:u}),zt("div",Mie,[zt("div",Rie,[zt("textarea",{class:"chat-input",ref_key:"chatInputRef",ref:s,onKeydown:a,onInput:c,style:Qs("height:".concat(We(i),"px"))},null,36),zt("div",{class:"rowsDiv",ref_key:"rowsDivRef",ref:r},su(We(o)),513)]),h.replying?(ft(),xt("button",{key:0,class:"interrupt-btn",onClick:d})):(ft(),xt("button",{key:1,class:"send-btn",onClick:l},[Re(We(Cd),{icon:We($ne),color:"#fff"},null,8,["icon"])]))])]))}}),Nie=ii(Iie,[["__scopeId","data-v-32a58abc"]]),Pie={class:"answer-message-text"},Lie=rn({__name:"ChatMessage",props:{message:{},role:{},style:{}},setup(n){return(e,t)=>(ft(),xt("div",{class:Ks(["answer-message-container",e.role]),style:Qs(e.style)},[zt("div",Pie,su(e.message),1)],6))}}),Die=ii(Lie,[["__scopeId","data-v-dde1c5d3"]]),Fie={class:"chat-records-inner"},MT=rn({__name:"ChatRecords",props:{chatRecords:{}},setup(n,{expose:e}){const t=n;let i=Yp("containerRef");ci(()=>t.chatRecords,s=>{t.chatRecords&&Ph().then(()=>{r()})});function r(){i.value&&(i.value.scrollTop=i.value.scrollHeight)}return e({scrollToBottom:r}),(s,o)=>(ft(),xt("div",{class:"chat-records",ref_key:"containerRef",ref:i},[zt("div",Fie,[(ft(!0),xt(Hn,null,Jd(s.chatRecords,(a,l)=>(ft(),xt("div",{key:a.id,class:Ks("chat-message ".concat(a.role))},[Re(Die,{message:a.message,role:a.role},null,8,["message","role"])],2))),128))])],512))}}),Oie={class:"content-container"},Bie=["muted"],kie={class:"actions"},Uie={key:0,class:"chat-records-container"},zie=rn({__name:"index",setup(n){const e=Tl(),t=P0(),i=Dn(),r=Dn(),s=Dn(),o=Dn(),a=Dn(),l=Dn("9 / 16"),c=()=>{a.value&&(l.value="".concat(a.value.videoWidth," / ").concat(a.value.videoHeight))},u=()=>t.localStream;ka(()=>{const k=i.value;e.wrapperRef=k,k.getBoundingClientRect(),E.value.width=k.clientWidth,E.value.height=k.clientHeight,e.isLandscape=E.value.width>E.value.height,console.log(E),e.remoteVideoContainerRef=s.value,e.localVideoContainerRef=r.value,e.localVideoRef=o.value,e.remoteVideoRef=a.value,e.wrapperRef=i.value});const{hasCamera:d,hasMic:h,micMuted:f,cameraOff:p,webcamAccessed:g,streamState:y,avatarType:m,volumeMuted:v,replying:x,showChatRecords:_,chatRecords:S}=sm(t),{wrapperRect:E,isLandscape:A}=sm(e);function R(){t.startWebRTC().then(()=>{w()})}function w(){t.chatDataChannel&&t.chatDataChannel.addEventListener("message",k=>{const T=JSON.parse(k.data);if(T.type==="chat"){const F=t.chatRecords.findIndex(V=>V.id===T.id);if(F!==-1){const V=t.chatRecords[F];V.message+=T.message,t.chatRecords.splice(F,1,V),t.chatRecords=[...t.chatRecords]}else t.chatRecords=[...t.chatRecords,{id:T.id,role:T.role||"human",message:T.message}]}else T.type==="avatar_end"&&(t.replying=!1)})}function M(){t.chatDataChannel&&t.chatDataChannel.send(JSON.stringify({type:"stop_chat"}))}const I=Yp("chatRecordsInstanceRef");function L(k){var T;k&&t.chatDataChannel&&(t.chatDataChannel.send(JSON.stringify({type:"chat",data:k})),t.replying=!0,(T=I.value)==null||T.scrollToBottom())}return(k,T)=>(ft(),xt("div",{class:"page-container",ref_key:"wrapRef",ref:i},[zt("div",Oie,[zt("div",{class:"video-container",style:Qs({visibility:We(g)?"visible":"hidden",aspectRatio:l.value})},[Pc(zt("div",{class:Ks("local-video-container ".concat(We(y)==="open"?"scaled":"")),ref_key:"localVideoContainerRef",ref:r},[zt("video",{class:"local-video",ref_key:"localVideoRef",ref:o,autoplay:"",muted:"",playsinline:"",style:Qs({visibility:We(p)?"hidden":"visible",display:!We(d)||We(p)?"none":"block"})},null,4)],2),[[im,We(d)&&!We(p)]]),zt("div",{class:"remote-video-container",ref_key:"remoteVideoContainerRef",ref:s},[We(m)?br("",!0):Pc((ft(),xt("video",{key:0,class:"remote-video",onPlaying:c,ref_key:"remoteVideoRef",ref:a,autoplay:"",playsinline:"",muted:We(v)},null,40,Bie)),[[im,We(y)==="open"]]),We(y)==="open"&&We(_)&&!We(A)?(ft(),xt("div",{key:1,class:Ks("chat-records-container inline"),style:Qs(!We(d)||We(p)?"width:80%;padding-bottom:12px;":"padding-bottom:12px;")},[Re(MT,{ref_key:"chatRecordsInstanceRef",ref:I,chatRecords:We(S).filter((F,V)=>V>=We(S).length-4)},null,8,["chatRecords"])],4)):br("",!0)],512),zt("div",kie,[Re(mie)])],4),(!We(h)||We(f))&&We(y)==="open"?(ft(),ou(Nie,{key:0,replying:We(x),onInterrupt:M,onSend:L,onStop:We(t).startWebRTC},null,8,["replying","onStop"])):We(g)?(ft(),ou(wie,{key:1,onStartChat:R,"audio-source-callback":u,streamState:We(y),"wave-color":"#7873F6"},null,8,["streamState"])):br("",!0)]),We(y)==="open"&&We(_)&&We(A)?(ft(),xt("div",Uie,[Re(MT,{ref_key:"chatRecordsInstanceRef",ref:I,chatRecords:We(S)},null,8,["chatRecords"])])):br("",!0)],512))}}),Vie=ii(zie,[["__scopeId","data-v-269b506f"]]),Hie={class:"wrap"},$ie=rn({__name:"App",setup(n){const e=P0();return e.init(),(t,i)=>(ft(),ou(We(Jc),{locale:We(yne)[We(sI)]},{default:lw(()=>[zt("div",Hie,[We(e).webcamAccessed?br("",!0):(ft(),ou(fee,{key:0})),Re(Vie)])]),_:1},8,["locale"]))}}),Gie=ii($ie,[["__scopeId","data-v-746907b0"]]);var Wp={exports:{}},Wie=Wp.exports,RT;function Qie(){return RT||(RT=1,function(n,e){(function(t,i){n.exports=i()})(Wie,function(){var t="__v-click-outside",i=typeof window<"u",r=typeof navigator<"u",s=i&&("ontouchstart"in window||r&&navigator.msMaxTouchPoints>0)?["touchstart"]:["click"],o=function(u){var d=u.event,h=u.handler;(0,u.middleware)(d)&&h(d)},a=function(u,d){var h=function(v){var x=typeof v=="function";if(!x&&typeof v!="object")throw new Error("v-click-outside: Binding value must be a function or an object");return{handler:x?v:v.handler,middleware:v.middleware||function(_){return _},events:v.events||s,isActive:v.isActive!==!1,detectIframe:v.detectIframe!==!1,capture:!!v.capture}}(d.value),f=h.handler,p=h.middleware,g=h.detectIframe,y=h.capture;if(h.isActive){if(u[t]=h.events.map(function(v){return{event:v,srcTarget:document.documentElement,handler:function(x){return function(_){var S=_.el,E=_.event,A=_.handler,R=_.middleware,w=E.path||E.composedPath&&E.composedPath();(w?w.indexOf(S)<0:!S.contains(E.target))&&o({event:E,handler:A,middleware:R})}({el:u,event:x,handler:f,middleware:p})},capture:y}}),g){var m={event:"blur",srcTarget:window,handler:function(v){return function(x){var _=x.el,S=x.event,E=x.handler,A=x.middleware;setTimeout(function(){var R=document.activeElement;R&&R.tagName==="IFRAME"&&!_.contains(R)&&o({event:S,handler:E,middleware:A})},0)}({el:u,event:v,handler:f,middleware:p})},capture:y};u[t]=[].concat(u[t],[m])}u[t].forEach(function(v){var x=v.event,_=v.srcTarget,S=v.handler;return setTimeout(function(){u[t]&&_.addEventListener(x,S,y)},0)})}},l=function(u){(u[t]||[]).forEach(function(d){return d.srcTarget.removeEventListener(d.event,d.handler,d.capture)}),delete u[t]},c=i?{beforeMount:a,updated:function(u,d){var h=d.value,f=d.oldValue;JSON.stringify(h)!==JSON.stringify(f)&&(l(u),a(u,{value:h}))},unmounted:l}:{};return{install:function(u){u.directive("click-outside",c)},directive:c}})}(Wp)),Wp.exports}var jie=Qie();const qie=s_(jie),O0=G9(Gie),Xie=j9();O0.use(Xie);O0.use(_ne);O0.use(qie);O0.mount("#app");export{Yie as __vite_legacy_guard};