var Tx=Object.defineProperty;var Mx=(i,e,t)=>e in i?Tx(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var A=(i,e,t)=>Mx(i,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))s(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const o of r.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function t(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function s(n){if(n.ep)return;n.ep=!0;const r=t(n);fetch(n.href,r)}})();/** * @vue/shared v3.5.41 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/function kd(i){const e=Object.create(null);for(const t of i.split(","))e[t]=1;return t=>t in e}const Ot={},io=[],Ys=()=>{},Mg=()=>!1,uh=i=>i.charCodeAt(0)===111&&i.charCodeAt(1)===110&&(i.charCodeAt(2)>122||i.charCodeAt(2)<97),dh=i=>i.startsWith("onUpdate:"),mi=Object.assign,Fd=(i,e)=>{const t=i.indexOf(e);t>-1&&i.splice(t,1)},Ex=Object.prototype.hasOwnProperty,Rt=(i,e)=>Ex.call(i,e),tt=Array.isArray,so=i=>xa(i)==="[object Map]",xo=i=>xa(i)==="[object Set]",xf=i=>xa(i)==="[object Date]",at=i=>typeof i=="function",qt=i=>typeof i=="string",Xi=i=>typeof i=="symbol",Ft=i=>i!==null&&typeof i=="object",Eg=i=>(Ft(i)||at(i))&&at(i.then)&&at(i.catch),Ag=Object.prototype.toString,xa=i=>Ag.call(i),Ax=i=>xa(i).slice(8,-1),Cg=i=>xa(i)==="[object Object]",fh=i=>qt(i)&&i!=="NaN"&&i[0]!=="-"&&""+parseInt(i,10)===i,Ko=kd(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ph=i=>{const e=Object.create(null);return(t=>e[t]||(e[t]=i(t)))},Cx=/-\w/g,ls=ph(i=>i.replace(Cx,e=>e.slice(1).toUpperCase())),Ix=/\B([A-Z])/g,Jn=ph(i=>i.replace(Ix,"-$1").toLowerCase()),Ig=ph(i=>i.charAt(0).toUpperCase()+i.slice(1)),Yh=ph(i=>i?`on${Ig(i)}`:""),Ds=(i,e)=>!Object.is(i,e),cl=(i,...e)=>{for(let t=0;t{Object.defineProperty(i,e,{configurable:!0,enumerable:!1,writable:s,value:t})},mh=i=>{const e=parseFloat(i);return isNaN(e)?i:e};let bf;const gh=()=>bf||(bf=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Pi(i){if(tt(i)){const e={};for(let t=0;t{if(t){const s=t.split(Px);s.length>1&&(e[s[0].trim()]=s[1].trim())}}),e}function Ze(i){let e="";if(qt(i))e=i;else if(tt(i))for(let t=0;tbo(t,e))}const kg=i=>!!(i&&i.__v_isRef===!0),Ye=i=>qt(i)?i:i==null?"":tt(i)||Ft(i)&&(i.toString===Ag||!at(i.toString))?kg(i)?Ye(i.value):JSON.stringify(i,Fg,2):String(i),Fg=(i,e)=>kg(e)?Fg(i,e.value):so(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((t,[s,n],r)=>(t[$h(s,r)+" =>"]=n,t),{})}:xo(e)?{[`Set(${e.size})`]:[...e.values()].map(t=>$h(t))}:Xi(e)?$h(e):Ft(e)&&!tt(e)&&!Cg(e)?String(e):e,$h=(i,e="")=>{var t;return Xi(i)?`Symbol(${(t=i.description)!=null?t:e})`:i};/** * @vue/reactivity v3.5.41 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/let ri;class Og{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&ri&&(ri.active?(this.parent=ri,this.index=(ri.scopes||(ri.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){const s=this.scopes.slice();for(e=0,t=s.length;e0&&--this._on===0){if(ri===this)ri=this.prevScope;else{let e=ri;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,s;for(t=0,s=this.effects.length;t0)return;if(Jo){let e=Jo;for(Jo=void 0;e;){const t=e.next;e.next=void 0,e.flags&=-9,e=t}}let i;for(;Zo;){let e=Zo;for(Zo=void 0;e;){const t=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(s){i||(i=s)}e=t}}if(i)throw i}function Vg(i){for(let e=i.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Xg(i){let e,t=i.depsTail,s=t;for(;s;){const n=s.prevDep;s.version===-1?(s===t&&(t=n),Dd(s),Nx(s)):e=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=n}i.deps=e,i.depsTail=t}function Iu(i){for(let e=i.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Yg(e.dep.computed)||e.dep.version!==e.version))return!0;return!!i._dirty}function Yg(i){if(i.flags&4&&!(i.flags&16)||(i.flags&=-17,i.globalVersion===ra)||(i.globalVersion=ra,!i.isSSR&&i.flags&128&&(!i.deps&&!i._dirty||!Iu(i))))return;i.flags|=2;const e=i.dep,t=Dt,s=hs;Dt=i,hs=!0;try{Vg(i);const n=i.fn(i._value);(e.version===0||Ds(n,i._value))&&(i.flags|=128,i._value=n,e.version++)}catch(n){throw e.version++,n}finally{Dt=t,hs=s,Xg(i),i.flags&=-3}}function Dd(i,e=!1){const{dep:t,prevSub:s,nextSub:n}=i;if(s&&(s.nextSub=n,i.prevSub=void 0),n&&(n.prevSub=s,i.nextSub=void 0),t.subs===i&&(t.subs=s,!s&&t.computed)){t.computed.flags&=-5;for(let r=t.computed.deps;r;r=r.nextDep)Dd(r,!0)}!e&&!--t.sc&&t.map&&t.map.delete(t.key)}function Nx(i){const{prevDep:e,nextDep:t}=i;e&&(e.nextDep=t,i.prevDep=void 0),t&&(t.prevDep=e,i.nextDep=void 0)}let hs=!0;const $g=[];function xn(){$g.push(hs),hs=!1}function bn(){const i=$g.pop();hs=i===void 0?!0:i}function wf(i){const{cleanup:e}=i;if(i.cleanup=void 0,e){const t=Dt;Dt=void 0;try{e()}finally{Dt=t}}}let ra=0;class Ux{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 Nd{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(!Dt||!hs||Dt===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Dt)t=this.activeLink=new Ux(Dt,this),Dt.deps?(t.prevDep=Dt.depsTail,Dt.depsTail.nextDep=t,Dt.depsTail=t):Dt.deps=Dt.depsTail=t,Gg(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const s=t.nextDep;s.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=s),t.prevDep=Dt.depsTail,t.nextDep=void 0,Dt.depsTail.nextDep=t,Dt.depsTail=t,Dt.deps===t&&(Dt.deps=s)}return t}trigger(e){this.version++,ra++,this.notify(e)}notify(e){Bd();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Ld()}}}function Gg(i){if(i.dep.sc++,i.sub.flags&4){const e=i.dep.computed;if(e&&!i.dep.subs){e.flags|=20;for(let s=e.deps;s;s=s.nextDep)Gg(s)}const t=i.dep.subs;t!==i&&(i.prevSub=t,t&&(t.nextSub=i)),i.dep.subs=i}}const _l=new WeakMap,mr=Symbol(""),Ru=Symbol(""),oa=Symbol("");function yi(i,e,t){if(hs&&Dt){let s=_l.get(i);s||_l.set(i,s=new Map);let n=s.get(t);n||(s.set(t,n=new Nd),n.map=s,n.key=t),n.track()}}function cn(i,e,t,s,n,r){const o=_l.get(i);if(!o){ra++;return}const a=h=>{h&&h.trigger()};if(Bd(),e==="clear")o.forEach(a);else{const h=tt(i),l=h&&fh(t);if(h&&t==="length"){const c=Number(s);o.forEach((u,f)=>{(f==="length"||f===oa||!Xi(f)&&f>=c)&&a(u)})}else switch((t!==void 0||o.has(void 0))&&a(o.get(t)),l&&a(o.get(oa)),e){case"add":h?l&&a(o.get("length")):(a(o.get(mr)),so(i)&&a(o.get(Ru)));break;case"delete":h||(a(o.get(mr)),so(i)&&a(o.get(Ru)));break;case"set":so(i)&&a(o.get(mr));break}}Ld()}function Vx(i,e){const t=_l.get(i);return t&&t.get(e)}function Or(i){const e=Tt(i);return e===i?e:(yi(e,"iterate",oa),Vi(i)?e:e.map(ms))}function vh(i){return yi(i=Tt(i),"iterate",oa),i}function Os(i,e){return wn(i)?po(gn(i)?ms(e):e):ms(e)}const Xx={__proto__:null,[Symbol.iterator](){return jh(this,Symbol.iterator,i=>Os(this,i))},concat(...i){return Or(this).concat(...i.map(e=>tt(e)?Or(e):e))},entries(){return jh(this,"entries",i=>(i[1]=Os(this,i[1]),i))},every(i,e){return en(this,"every",i,e,void 0,arguments)},filter(i,e){return en(this,"filter",i,e,t=>t.map(s=>Os(this,s)),arguments)},find(i,e){return en(this,"find",i,e,t=>Os(this,t),arguments)},findIndex(i,e){return en(this,"findIndex",i,e,void 0,arguments)},findLast(i,e){return en(this,"findLast",i,e,t=>Os(this,t),arguments)},findLastIndex(i,e){return en(this,"findLastIndex",i,e,void 0,arguments)},forEach(i,e){return en(this,"forEach",i,e,void 0,arguments)},includes(...i){return Hh(this,"includes",i)},indexOf(...i){return Hh(this,"indexOf",i)},join(i){return Or(this).join(i)},lastIndexOf(...i){return Hh(this,"lastIndexOf",i)},map(i,e){return en(this,"map",i,e,void 0,arguments)},pop(){return Io(this,"pop")},push(...i){return Io(this,"push",i)},reduce(i,...e){return _f(this,"reduce",i,e)},reduceRight(i,...e){return _f(this,"reduceRight",i,e)},shift(){return Io(this,"shift")},some(i,e){return en(this,"some",i,e,void 0,arguments)},splice(...i){return Io(this,"splice",i)},toReversed(){return Or(this).toReversed()},toSorted(i){return Or(this).toSorted(i)},toSpliced(...i){return Or(this).toSpliced(...i)},unshift(...i){return Io(this,"unshift",i)},values(){return jh(this,"values",i=>Os(this,i))}};function jh(i,e,t){const s=vh(i),n=s[e]();return s!==i&&!Vi(i)&&(n._next=n.next,n.next=()=>{const r=n._next();return r.done||(r.value=t(r.value)),r}),n}const Yx=Array.prototype;function en(i,e,t,s,n,r){const o=vh(i),a=o!==i&&!Vi(i),h=o[e];if(h!==Yx[e]){const u=h.apply(i,r);return a?ms(u):u}let l=t;o!==i&&(a?l=function(u,f){return t.call(this,Os(i,u),f,i)}:t.length>2&&(l=function(u,f){return t.call(this,u,f,i)}));const c=h.call(o,l,s);return a&&n?n(c):c}function _f(i,e,t,s){const n=vh(i),r=n!==i&&!Vi(i);let o=t,a=!1;n!==i&&(r?(a=s.length===0,o=function(l,c,u){return a&&(a=!1,l=Os(i,l)),t.call(this,l,Os(i,c),u,i)}):t.length>3&&(o=function(l,c,u){return t.call(this,l,c,u,i)}));const h=n[e](o,...s);return a?Os(i,h):h}function Hh(i,e,t){const s=Tt(i);yi(s,"iterate",oa);const n=s[e](...t);return(n===-1||n===!1)&&yh(t[0])?(t[0]=Tt(t[0]),s[e](...t)):n}function Io(i,e,t=[]){xn(),Bd();const s=Tt(i)[e].apply(i,t);return Ld(),bn(),s}const $x=kd("__proto__,__v_isRef,__isVue"),jg=new Set(Object.getOwnPropertyNames(Symbol).filter(i=>i!=="arguments"&&i!=="caller").map(i=>Symbol[i]).filter(Xi));function Gx(i){Xi(i)||(i=String(i));const e=Tt(this);return yi(e,"has",i),e.hasOwnProperty(i)}class Hg{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,s){if(t==="__v_skip")return e.__v_skip;const n=this._isReadonly,r=this._isShallow;if(t==="__v_isReactive")return!n;if(t==="__v_isReadonly")return n;if(t==="__v_isShallow")return r;if(t==="__v_raw")return s===(n?r?e1:Kg:r?qg:zg).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(s)?e:void 0;const o=tt(e);if(!n){let h;if(o&&(h=Xx[t]))return h;if(t==="hasOwnProperty")return Gx}const a=Reflect.get(e,t,Kt(e)?e:s);if((Xi(t)?jg.has(t):$x(t))||(n||yi(e,"get",t),r))return a;if(Kt(a)){const h=o&&fh(t)?a:a.value;return n&&Ft(h)?ku(h):h}return Ft(a)?n?ku(a):wo(a):a}}class Wg extends Hg{constructor(e=!1){super(!1,e)}set(e,t,s,n){let r=e[t];const o=tt(e)&&fh(t);if(!this._isShallow){const l=wn(r);if(!Vi(s)&&!wn(s)&&(r=Tt(r),s=Tt(s)),!o&&Kt(r)&&!Kt(s))return l||(r.value=s),!0}const a=o?Number(t)i,Ia=i=>Reflect.getPrototypeOf(i);function qx(i,e,t){return function(...s){const n=this.__v_raw,r=Tt(n),o=so(r),a=i==="entries"||i===Symbol.iterator&&o,h=i==="keys"&&o,l=n[i](...s),c=t?Pu:e?po:ms;return!e&&yi(r,"iterate",h?Ru:mr),mi(Object.create(l),{next(){const{value:u,done:f}=l.next();return f?{value:u,done:f}:{value:a?[c(u[0]),c(u[1])]:c(u),done:f}}})}}function Ra(i){return function(...e){return i==="delete"?!1:i==="clear"?void 0:this}}function Kx(i,e){const t={get(n){const r=this.__v_raw,o=Tt(r),a=Tt(n);i||(Ds(n,a)&&yi(o,"get",n),yi(o,"get",a));const{has:h}=Ia(o),l=e?Pu:i?po:ms;if(h.call(o,n))return l(r.get(n));if(h.call(o,a))return l(r.get(a));r!==o&&r.get(n)},get size(){const n=this.__v_raw;return!i&&yi(Tt(n),"iterate",mr),n.size},has(n){const r=this.__v_raw,o=Tt(r),a=Tt(n);return i||(Ds(n,a)&&yi(o,"has",n),yi(o,"has",a)),n===a?r.has(n):r.has(n)||r.has(a)},forEach(n,r){const o=this,a=o.__v_raw,h=Tt(a),l=e?Pu:i?po:ms;return!i&&yi(h,"iterate",mr),a.forEach((c,u)=>n.call(r,l(c),l(u),o))}};return mi(t,i?{add:Ra("add"),set:Ra("set"),delete:Ra("delete"),clear:Ra("clear")}:{add(n){const r=Tt(this),o=Ia(r),a=Tt(n),h=!e&&!Vi(n)&&!wn(n)?a:n;return o.has.call(r,h)||Ds(n,h)&&o.has.call(r,n)||Ds(a,h)&&o.has.call(r,a)||(r.add(h),cn(r,"add",h,h)),this},set(n,r){!e&&!Vi(r)&&!wn(r)&&(r=Tt(r));const o=Tt(this),{has:a,get:h}=Ia(o);let l=a.call(o,n);l||(n=Tt(n),l=a.call(o,n));const c=h.call(o,n);return o.set(n,r),l?Ds(r,c)&&cn(o,"set",n,r):cn(o,"add",n,r),this},delete(n){const r=Tt(this),{has:o,get:a}=Ia(r);let h=o.call(r,n);h||(n=Tt(n),h=o.call(r,n)),a&&a.call(r,n);const l=r.delete(n);return h&&cn(r,"delete",n,void 0),l},clear(){const n=Tt(this),r=n.size!==0,o=n.clear();return r&&cn(n,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(n=>{t[n]=qx(n,i,e)}),t}function Ud(i,e){const t=Kx(i,e);return(s,n,r)=>n==="__v_isReactive"?!i:n==="__v_isReadonly"?i:n==="__v_raw"?s:Reflect.get(Rt(t,n)&&n in s?t:s,n,r)}const Zx={get:Ud(!1,!1)},Jx={get:Ud(!1,!0)},Qx={get:Ud(!0,!1)};const zg=new WeakMap,qg=new WeakMap,Kg=new WeakMap,e1=new WeakMap;function t1(i){switch(i){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function wo(i){return wn(i)?i:Vd(i,!1,Hx,Zx,zg)}function i1(i){return Vd(i,!1,zx,Jx,qg)}function ku(i){return Vd(i,!0,Wx,Qx,Kg)}function Vd(i,e,t,s,n){if(!Ft(i)||i.__v_raw&&!(e&&i.__v_isReactive)||i.__v_skip||!Object.isExtensible(i))return i;const r=n.get(i);if(r)return r;const o=t1(Ax(i));if(o===0)return i;const a=new Proxy(i,o===2?s:t);return n.set(i,a),a}function gn(i){return wn(i)?gn(i.__v_raw):!!(i&&i.__v_isReactive)}function wn(i){return!!(i&&i.__v_isReadonly)}function Vi(i){return!!(i&&i.__v_isShallow)}function yh(i){return i?!!i.__v_raw:!1}function Tt(i){const e=i&&i.__v_raw;return e?Tt(e):i}function $n(i){return!Rt(i,"__v_skip")&&Object.isExtensible(i)&&Rg(i,"__v_skip",!0),i}const ms=i=>Ft(i)?wo(i):i,po=i=>Ft(i)?ku(i):i;function Kt(i){return i?i.__v_isRef===!0:!1}function it(i){return s1(i,!1)}function s1(i,e){return Kt(i)?i:new n1(i,e)}class n1{constructor(e,t){this.dep=new Nd,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Tt(e),this._value=t?e:ms(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,s=this.__v_isShallow||Vi(e)||wn(e);e=s?e:Tt(e),Ds(e,t)&&(this._rawValue=e,this._value=s?e:ms(e),this.dep.trigger())}}function Pe(i){return Kt(i)?i.value:i}const r1={get:(i,e,t)=>e==="__v_raw"?i:Pe(Reflect.get(i,e,t)),set:(i,e,t,s)=>{const n=i[e];return Kt(n)&&!Kt(t)?(n.value=t,!0):Reflect.set(i,e,t,s)}};function Zg(i){return gn(i)?i:new Proxy(i,r1)}function o1(i){const e=tt(i)?new Array(i.length):{};for(const t in i)e[t]=l1(i,t);return e}class a1{constructor(e,t,s){this._object=e,this._defaultValue=s,this.__v_isRef=!0,this._value=void 0,this._key=Xi(t)?t:String(t),this._raw=Tt(e);let n=!0,r=e;if(!tt(e)||Xi(this._key)||!fh(this._key))do n=!yh(r)||Vi(r);while(n&&(r=r.__v_raw));this._shallow=n}get value(){let e=this._object[this._key];return this._shallow&&(e=Pe(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Kt(this._raw[this._key])){const t=this._object[this._key];if(Kt(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return Vx(this._raw,this._key)}}function l1(i,e,t){return new a1(i,e,t)}class h1{constructor(e,t,s){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Nd(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ra-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&Dt!==this)return Ug(this,!0),!0}get value(){const e=this.dep.track();return Yg(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function c1(i,e,t=!1){let s,n;return at(i)?s=i:(s=i.get,n=i.set),new h1(s,n,t)}const Pa={},Sl=new WeakMap;let lr;function u1(i,e=!1,t=lr){if(t){let s=Sl.get(t);s||Sl.set(t,s=[]),s.push(i)}}function d1(i,e,t=Ot){const{immediate:s,deep:n,once:r,scheduler:o,augmentJob:a,call:h}=t,l=S=>n?S:Vi(S)||n===!1||n===0?un(S,1):un(S);let c,u,f,d,m=!1,g=!1;if(Kt(i)?(u=()=>i.value,m=Vi(i)):gn(i)?(u=()=>l(i),m=!0):tt(i)?(g=!0,m=i.some(S=>gn(S)||Vi(S)),u=()=>i.map(S=>{if(Kt(S))return S.value;if(gn(S))return l(S);if(at(S))return h?h(S,2):S()})):at(i)?e?u=h?()=>h(i,2):i:u=()=>{if(f){xn();try{f()}finally{bn()}}const S=lr;lr=c;try{return h?h(i,3,[d]):i(d)}finally{lr=S}}:u=Ys,e&&n){const S=u,y=n===!0?1/0:n;u=()=>un(S(),y)}const b=Lg(),_=()=>{c.stop(),b&&b.active&&Fd(b.effects,c)};if(r&&e){const S=e;e=(...y)=>{const I=S(...y);return _(),I}}let M=g?new Array(i.length).fill(Pa):Pa;const v=S=>{if(!(!(c.flags&1)||!c.dirty&&!S))if(e){const y=c.run();if(S||n||m||(g?y.some((I,E)=>Ds(I,M[E])):Ds(y,M))){f&&f();const I=lr;lr=c;try{const E=[y,M===Pa?void 0:g&&M[0]===Pa?[]:M,d];M=y,h?h(e,3,E):e(...E)}finally{lr=I}}}else c.run()};return a&&a(v),c=new Dg(u),c.scheduler=o?()=>o(v,!1):v,d=S=>u1(S,!1,c),f=c.onStop=()=>{const S=Sl.get(c);if(S){if(h)h(S,4);else for(const y of S)y();Sl.delete(c)}},e?s?v(!0):M=c.run():o?o(v.bind(null,!0),!0):c.run(),_.pause=c.pause.bind(c),_.resume=c.resume.bind(c),_.stop=_,_}function un(i,e=1/0,t){if(e<=0||!Ft(i)||i.__v_skip||(t=t||new Map,(t.get(i)||0)>=e))return i;if(t.set(i,e),e--,Kt(i))un(i.value,e,t);else if(tt(i))for(let s=0;s{un(s,e,t)});else if(Cg(i)){for(const s in i)un(i[s],e,t);for(const s of Object.getOwnPropertySymbols(i))Object.prototype.propertyIsEnumerable.call(i,s)&&un(i[s],e,t)}return i}/** * @vue/runtime-core v3.5.41 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/function ba(i,e,t,s){try{return s?i(...s):i()}catch(n){xh(n,e,t)}}function gs(i,e,t,s){if(at(i)){const n=ba(i,e,t,s);return n&&Eg(n)&&n.catch(r=>{xh(r,e,t)}),n}if(tt(i)){const n=[];for(let r=0;r>>1,n=Si[s],r=aa(n);r=aa(t)?Si.push(i):Si.splice(p1(e),0,i),i.flags|=1,Qg()}}function Qg(){Tl||(Tl=Jg.then(t0))}function m1(i){if(!tt(i))On&&i.id===-1?On.splice(Gr+1,0,i):i.flags&1||(no.push(i),i.flags|=1);else for(let e=0;eaa(t)-aa(s));if(no.length=0,On){for(let t=0;ti.id==null?i.flags&2?-1:1/0:i.id;function t0(i){try{for(Rs=0;Rs{s._d&&Of(-1);const r=Ml(e),o=vn.length;let a;try{a=i(...n)}finally{for(let h=vn.length;h>o;h--)zd();Ml(r),s._d&&Of(1)}return a};return s._n=!0,s._c=!0,s._d=!0,s}function xe(i,e){if(bi===null)return i;const t=Th(bi),s=i.dirs||(i.dirs=[]);for(let n=0;n1)return t&&at(e)?e.call(s&&s.proxy):e}}function v1(){return!!(C0()||gr)}const y1=Symbol.for("v-scx"),x1=()=>Qo(y1);function No(i,e){return $d(i,null,e)}function cs(i,e,t){return $d(i,e,t)}function $d(i,e,t=Ot){const{immediate:s,deep:n,flush:r,once:o}=t,a=mi({},t),h=e&&s||!e&&r!=="post";let l;if(ca){if(r==="sync"){const d=x1();l=d.__watcherHandles||(d.__watcherHandles=[])}else if(!h){const d=()=>{};return d.stop=Ys,d.resume=Ys,d.pause=Ys,d}}const c=Ti;a.call=(d,m,g)=>gs(d,c,m,g);let u=!1;r==="post"?a.scheduler=d=>{Ai(d,c&&c.suspense)}:r!=="sync"&&(u=!0,a.scheduler=(d,m)=>{m?d():Yd(d)}),a.augmentJob=d=>{e&&(d.flags|=4),u&&(d.flags|=2,c&&(d.id=c.uid,d.i=c))};const f=d1(i,e,a);return ca&&(l?l.push(f):h&&f()),f}function b1(i,e,t){const s=this.proxy,n=qt(i)?i.includes(".")?s0(s,i):()=>s[i]:i.bind(s,s);let r;at(e)?r=e:(r=e.handler,t=e);const o=_a(this),a=$d(n,r.bind(s),t);return o(),a}function s0(i,e){const t=e.split(".");return()=>{let s=i;for(let n=0;ni.__isTeleport,Wh=Symbol("_leaveCb");function _1(i){let e=i[0];if(i.length>1){for(const t of i)if(t.type!==js){e=t;break}}return e}function n0(i){if(!jd(i))return bh(i.type)&&i.children?_1(i.children):i;if(i.component)return i.component.subTree;const{shapeFlag:e,children:t}=i;if(t){if(e&16)return t[0];if(e&32&&at(t.default))return t.default()}}function Gd(i,e){if(i.shapeFlag&6&&i.component){i.transition=e;const t=i.component.subTree;Gd(bh(t.type)&&n0(t)||t,e)}else i.shapeFlag&128?(i.ssContent.transition=e.clone(i.ssContent),i.ssFallback.transition=e.clone(i.ssFallback)):i.transition=e}function Ws(i,e){return at(i)?mi({name:i.name},e,{setup:i}):i}function r0(i){i.ids=[i.ids[0]+i.ids[2]+++"-",0,0]}function Tf(i,e){let t;return!!((t=Object.getOwnPropertyDescriptor(i,e))&&!t.configurable)}const El=new WeakMap;function ea(i,e,t,s,n=!1){if(tt(i)){i.forEach((g,b)=>ea(g,e&&(tt(e)?e[b]:e),t,s,n));return}if(ro(s)&&!n){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&ea(i,e,t,s.component.subTree);return}const r=s.shapeFlag&4?Th(s.component):s.el,o=n?null:r,{i:a,r:h}=i,l=e&&e.r,c=a.refs===Ot?a.refs={}:a.refs,u=a.setupState,f=Tt(u),d=u===Ot?Mg:g=>Tf(c,g)?!1:Rt(f,g),m=(g,b)=>!(b&&Tf(c,b));if(l!=null&&l!==h){if(Mf(e),qt(l))c[l]=null,d(l)&&(u[l]=null);else if(Kt(l)){const g=e;m(l,g.k)&&(l.value=null),g.k&&(c[g.k]=null)}}if(at(h))ba(h,a,12,[o,c]);else{const g=qt(h),b=Kt(h);if(g||b){const _=()=>{if(i.f){const M=g?d(h)?u[h]:c[h]:m()||!i.k?h.value:c[i.k];if(n)tt(M)&&Fd(M,r);else if(tt(M))M.includes(r)||M.push(r);else if(g)c[h]=[r],d(h)&&(u[h]=c[h]);else{const v=[r];m(h,i.k)&&(h.value=v),i.k&&(c[i.k]=v)}}else g?(c[h]=o,d(h)&&(u[h]=o)):b&&(m(h,i.k)&&(h.value=o),i.k&&(c[i.k]=o))};if(o){const M=()=>{_(),El.delete(i)};M.id=-1,El.set(i,M),Ai(M,t)}else Mf(i),_()}}}function Mf(i){const e=El.get(i);e&&(e.flags|=8,El.delete(i))}gh().requestIdleCallback;gh().cancelIdleCallback;const ro=i=>!!i.type.__asyncLoader,jd=i=>i.type.__isKeepAlive;function S1(i,e){o0(i,"a",e)}function T1(i,e){o0(i,"da",e)}function o0(i,e,t=Ti){const s=i.__wdc||(i.__wdc=()=>{let n=t;for(;n;){if(n.isDeactivated)return;n=n.parent}return i()});if(wh(e,s,t),t){let n=t.parent;for(;n&&n.parent;)jd(n.parent.vnode)&&M1(s,e,t,n),n=n.parent}}function M1(i,e,t,s){const n=wh(e,i,s,!0);wa(()=>{Fd(s[e],n)},t)}function wh(i,e,t=Ti,s=!1){if(t){const n=t[i]||(t[i]=[]),r=e.__weh||(e.__weh=(...o)=>{xn();const a=_a(t),h=gs(e,t,i,o);return a(),bn(),h});return s?n.unshift(r):n.push(r),r}}const Tn=i=>(e,t=Ti)=>{(!ca||i==="sp")&&wh(i,(...s)=>e(...s),t)},E1=Tn("bm"),_o=Tn("m"),A1=Tn("bu"),C1=Tn("u"),a0=Tn("bum"),wa=Tn("um"),I1=Tn("sp"),R1=Tn("rtg"),P1=Tn("rtc");function k1(i,e=Ti){wh("ec",i,e)}const F1=Symbol.for("v-ndc");function Ht(i,e,t,s){let n;const r=t,o=tt(i);if(o||qt(i)){const a=o&&gn(i);let h=!1,l=!1;a&&(h=!Vi(i),l=wn(i),i=vh(i)),n=new Array(i.length);for(let c=0,u=i.length;ce(a,h,void 0,r));else{const a=Object.keys(i);n=new Array(a.length);for(let h=0,l=a.length;h0;return se(),Et(qe,null,[Ne("slot",l,s)],c?-2:64)}let o=i[e];o&&o._c&&(o._d=!1);const a=vn.length;se();let h;try{const l=o&&l0(o(t)),c=t.key||r||l&&l.key;h=Et(qe,{key:(c&&!Xi(c)?c:`_${e}`)+(!l&&s?"_fb":"")},l||(s?s():[]),l&&i._===1?64:-2)}catch(l){for(let c=vn.length;c>a;c--)zd();throw l}finally{o&&o._c&&(o._d=!0)}return h}function l0(i){return i.some(e=>qd(e)?!(e.type===js||e.type===qe&&!l0(e.children)):!0)?i:null}const Ou=i=>i?I0(i)?Th(i):Ou(i.parent):null,ta=mi(Object.create(null),{$:i=>i,$el:i=>i.vnode.el,$data:i=>i.data,$props:i=>i.props,$attrs:i=>i.attrs,$slots:i=>i.slots,$refs:i=>i.refs,$parent:i=>Ou(i.parent),$root:i=>Ou(i.root),$host:i=>i.ce,$emit:i=>i.emit,$options:i=>c0(i),$forceUpdate:i=>i.f||(i.f=()=>{Yd(i.update)}),$nextTick:i=>i.n||(i.n=Xd.bind(i.proxy)),$watch:i=>b1.bind(i)}),zh=(i,e)=>i!==Ot&&!i.__isScriptSetup&&Rt(i,e),B1={get({_:i},e){if(e==="__v_skip")return!0;const{ctx:t,setupState:s,data:n,props:r,accessCache:o,type:a,appContext:h}=i;if(e[0]!=="$"){const f=o[e];if(f!==void 0)switch(f){case 1:return s[e];case 2:return n[e];case 4:return t[e];case 3:return r[e]}else{if(zh(s,e))return o[e]=1,s[e];if(n!==Ot&&Rt(n,e))return o[e]=2,n[e];if(Rt(r,e))return o[e]=3,r[e];if(t!==Ot&&Rt(t,e))return o[e]=4,t[e];Bu&&(o[e]=0)}}const l=ta[e];let c,u;if(l)return e==="$attrs"&&yi(i.attrs,"get",""),l(i);if((c=a.__cssModules)&&(c=c[e]))return c;if(t!==Ot&&Rt(t,e))return o[e]=4,t[e];if(u=h.config.globalProperties,Rt(u,e))return u[e]},set({_:i},e,t){const{data:s,setupState:n,ctx:r}=i;return zh(n,e)?(n[e]=t,!0):s!==Ot&&Rt(s,e)?(s[e]=t,!0):Rt(i.props,e)||e[0]==="$"&&e.slice(1)in i?!1:(r[e]=t,!0)},has({_:{data:i,setupState:e,accessCache:t,ctx:s,appContext:n,props:r,type:o}},a){let h;return!!(t[a]||i!==Ot&&a[0]!=="$"&&Rt(i,a)||zh(e,a)||Rt(r,a)||Rt(s,a)||Rt(ta,a)||Rt(n.config.globalProperties,a)||(h=o.__cssModules)&&h[a])},defineProperty(i,e,t){return t.get!=null?i._.accessCache[e]=0:Rt(t,"value")&&this.set(i,e,t.value,null),Reflect.defineProperty(i,e,t)}};function Ef(i){return tt(i)?i.reduce((e,t)=>(e[t]=null,e),{}):i}let Bu=!0;function L1(i){const e=c0(i),t=i.proxy,s=i.ctx;Bu=!1,e.beforeCreate&&Af(e.beforeCreate,i,"bc");const{data:n,computed:r,methods:o,watch:a,provide:h,inject:l,created:c,beforeMount:u,mounted:f,beforeUpdate:d,updated:m,activated:g,deactivated:b,beforeDestroy:_,beforeUnmount:M,destroyed:v,unmounted:S,render:y,renderTracked:I,renderTriggered:E,errorCaptured:C,serverPrefetch:R,expose:B,inheritAttrs:k,components:F,directives:D,filters:N}=e;if(l&&D1(l,s,null),o)for(const L in o){const P=o[L];at(P)&&(s[L]=P.bind(t))}if(n){const L=n.call(t,t);Ft(L)&&(i.data=wo(L))}if(Bu=!0,r)for(const L in r){const P=r[L],X=at(P)?P.bind(t,t):at(P.get)?P.get.bind(t,t):Ys,U=!at(P)&&at(P.set)?P.set.bind(t):Ys,Y=ut({get:X,set:U});Object.defineProperty(s,L,{enumerable:!0,configurable:!0,get:()=>Y.value,set:q=>Y.value=q})}if(a)for(const L in a)h0(a[L],s,t,L);if(h){const L=at(h)?h.call(t):h;Reflect.ownKeys(L).forEach(P=>{g1(P,L[P])})}c&&Af(c,i,"c");function O(L,P){tt(P)?P.forEach(X=>L(X.bind(t))):P&&L(P.bind(t))}if(O(E1,u),O(_o,f),O(A1,d),O(C1,m),O(S1,g),O(T1,b),O(k1,C),O(P1,I),O(R1,E),O(a0,M),O(wa,S),O(I1,R),tt(B))if(B.length){const L=i.exposed||(i.exposed={});B.forEach(P=>{Object.defineProperty(L,P,{get:()=>t[P],set:X=>t[P]=X,enumerable:!0})})}else i.exposed||(i.exposed={});y&&i.render===Ys&&(i.render=y),k!=null&&(i.inheritAttrs=k),F&&(i.components=F),D&&(i.directives=D),R&&r0(i)}function D1(i,e,t=Ys){tt(i)&&(i=Lu(i));for(const s in i){const n=i[s];let r;Ft(n)?"default"in n?r=Qo(n.from||s,n.default,!0):r=Qo(n.from||s):r=Qo(n),Kt(r)?Object.defineProperty(e,s,{enumerable:!0,configurable:!0,get:()=>r.value,set:o=>r.value=o}):e[s]=r}}function Af(i,e,t){gs(tt(i)?i.map(s=>s.bind(e.proxy)):i.bind(e.proxy),e,t)}function h0(i,e,t,s){let n=s.includes(".")?s0(t,s):()=>t[s];if(qt(i)){const r=e[i];at(r)&&cs(n,r)}else if(at(i))cs(n,i.bind(t));else if(Ft(i))if(tt(i))i.forEach(r=>h0(r,e,t,s));else{const r=at(i.handler)?i.handler.bind(t):e[i.handler];at(r)&&cs(n,r,i)}}function c0(i){const e=i.type,{mixins:t,extends:s}=e,{mixins:n,optionsCache:r,config:{optionMergeStrategies:o}}=i.appContext,a=r.get(e);let h;return a?h=a:!n.length&&!t&&!s?h=e:(h={},n.length&&n.forEach(l=>Al(h,l,o,!0)),Al(h,e,o)),Ft(e)&&r.set(e,h),h}function Al(i,e,t,s=!1){const{mixins:n,extends:r}=e;r&&Al(i,r,t,!0),n&&n.forEach(o=>Al(i,o,t,!0));for(const o in e)if(!(s&&o==="expose")){const a=N1[o]||t&&t[o];i[o]=a?a(i[o],e[o]):e[o]}return i}const N1={data:Cf,props:If,emits:If,methods:Uo,computed:Uo,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:Uo,directives:Uo,watch:V1,provide:Cf,inject:U1};function Cf(i,e){return e?i?function(){return mi(at(i)?i.call(this,this):i,at(e)?e.call(this,this):e)}:e:i}function U1(i,e){return Uo(Lu(i),Lu(e))}function Lu(i){if(tt(i)){const e={};for(let t=0;te==="modelValue"||e==="model-value"?i.modelModifiers:i[`${e}Modifiers`]||i[`${ls(e)}Modifiers`]||i[`${Jn(e)}Modifiers`];function G1(i,e,...t){if(i.isUnmounted)return;const s=i.vnode.props||Ot;let n=t;const r=e.startsWith("update:"),o=r&&$1(s,e.slice(7));o&&(o.trim&&(n=t.map(c=>qt(c)?c.trim():c)),o.number&&(n=t.map(mh)));let a,h=s[a=Yh(e)]||s[a=Yh(ls(e))];!h&&r&&(h=s[a=Yh(Jn(e))]),h&&gs(h,i,6,n);const l=s[a+"Once"];if(l){if(!i.emitted)i.emitted={};else if(i.emitted[a])return;i.emitted[a]=!0,gs(l,i,6,n)}}const j1=new WeakMap;function d0(i,e,t=!1){const s=t?j1:e.emitsCache,n=s.get(i);if(n!==void 0)return n;const r=i.emits;let o={},a=!1;if(!at(i)){const h=l=>{const c=d0(l,e,!0);c&&(a=!0,mi(o,c))};!t&&e.mixins.length&&e.mixins.forEach(h),i.extends&&h(i.extends),i.mixins&&i.mixins.forEach(h)}return!r&&!a?(Ft(i)&&s.set(i,null),null):(tt(r)?r.forEach(h=>o[h]=null):mi(o,r),Ft(i)&&s.set(i,o),o)}function _h(i,e){return!i||!uh(e)?!1:(e=e.slice(2),e=e==="Once"?e:e.replace(/Once$/,""),Rt(i,e[0].toLowerCase()+e.slice(1))||Rt(i,Jn(e))||Rt(i,e))}function Rf(i){const{type:e,vnode:t,proxy:s,withProxy:n,propsOptions:[r],slots:o,attrs:a,emit:h,render:l,renderCache:c,props:u,data:f,setupState:d,ctx:m,inheritAttrs:g}=i,b=Ml(i);let _,M;try{if(t.shapeFlag&4){const S=n||s,y=S;_=Bs(l.call(y,S,c,u,d,f,m)),M=a}else{const S=e;_=Bs(S.length>1?S(u,{attrs:a,slots:o,emit:h}):S(u,null)),M=e.props?a:H1(a)}}catch(S){vn.length=0,xh(S,i,1),_=Ne(js)}let v=_;if(M&&g!==!1){const S=Object.keys(M),{shapeFlag:y}=v;S.length&&y&7&&(r&&S.some(dh)&&(M=W1(M,r)),v=mo(v,M,!1,!0))}if(t.dirs&&(v=mo(v,null,!1,!0),v.dirs=v.dirs?v.dirs.concat(t.dirs):t.dirs),t.transition){const S=bh(v.type)&&n0(v)||v;Gd(S,t.transition)}return _=v,Ml(b),_}const H1=i=>{let e;for(const t in i)(t==="class"||t==="style"||uh(t))&&((e||(e={}))[t]=i[t]);return e},W1=(i,e)=>{const t={};for(const s in i)(!dh(s)||!(s.slice(9)in e))&&(t[s]=i[s]);return t};function z1(i,e,t){const{props:s,children:n,component:r}=i,{props:o,children:a,patchFlag:h}=e,l=r.emitsOptions;if(e.dirs||e.transition)return!0;if(t&&h>=0){if(h&1024)return!0;if(h&16)return s?Pf(s,o,l):!!o;if(h&8){const c=e.dynamicProps;for(let u=0;uObject.create(p0),g0=i=>Object.getPrototypeOf(i)===p0;function K1(i,e,t,s=!1){const n={},r=m0();i.propsDefaults=Object.create(null),v0(i,e,n,r);for(const o in i.propsOptions[0])o in n||(n[o]=void 0);t?i.props=s?n:i1(n):i.type.props?i.props=n:i.props=r,i.attrs=r}function Z1(i,e,t,s){const{props:n,attrs:r,vnode:{patchFlag:o}}=i,a=Tt(n),[h]=i.propsOptions;let l=!1;if((s||o>0)&&!(o&16)){if(o&8){const c=i.vnode.dynamicProps;for(let u=0;u{h=!0;const[f,d]=y0(u,e,!0);mi(o,f),d&&a.push(...d)};!t&&e.mixins.length&&e.mixins.forEach(c),i.extends&&c(i.extends),i.mixins&&i.mixins.forEach(c)}if(!r&&!h)return Ft(i)&&s.set(i,io),io;if(tt(r))for(let c=0;ci==="_"||i==="_ctx"||i==="$stable",Wd=i=>tt(i)?i.map(Bs):[Bs(i)],Q1=(i,e,t)=>{if(e._n)return e;const s=Fu((...n)=>Wd(e(...n)),t);return s._c=!1,s},x0=(i,e,t)=>{const s=i._ctx;for(const n in i){if(Hd(n))continue;const r=i[n];if(at(r))e[n]=Q1(n,r,s);else if(r!=null){const o=Wd(r);e[n]=()=>o}}},b0=(i,e)=>{const t=Wd(e);i.slots.default=()=>t},w0=(i,e,t)=>{for(const s in e)(t||!Hd(s))&&(i[s]=e[s])},eb=(i,e,t)=>{const s=i.slots=m0();if(i.vnode.shapeFlag&32){const n=e._;n?(w0(s,e,t),t&&Rg(s,"_",n,!0)):x0(e,s)}else e&&b0(i,e)},tb=(i,e,t)=>{const{vnode:s,slots:n}=i;let r=!0,o=Ot;if(s.shapeFlag&32){const a=e._;a?t&&a===1?r=!1:w0(n,e,t):(r=!e.$stable,x0(e,n)),o=e}else e&&(b0(i,e),o={default:1});if(r)for(const a in n)!Hd(a)&&o[a]==null&&delete n[a]},Ai=ob;function ib(i){return sb(i)}function sb(i,e){const t=gh();t.__VUE__=!0;const{insert:s,remove:n,patchProp:r,createElement:o,createText:a,createComment:h,setText:l,setElementText:c,parentNode:u,nextSibling:f,setScopeId:d=Ys,insertStaticContent:m}=i,g=($,W,J,Q=null,ie=null,ue=null,Se=void 0,Me=null,Ee=!!W.dynamicChildren)=>{if($===W)return;$&&!Ro($,W)&&(Q=ae($),q($,ie,ue,!0),$=null),W.patchFlag===-2&&(Ee=!1,W.dynamicChildren=null);const{type:de,ref:De,shapeFlag:Ie}=W;switch(de){case Sh:b($,W,J,Q);break;case js:_($,W,J,Q);break;case ul:$==null&&M(W,J,Q,Se);break;case qe:F($,W,J,Q,ie,ue,Se,Me,Ee);break;default:Ie&1?y($,W,J,Q,ie,ue,Se,Me,Ee):Ie&6?D($,W,J,Q,ie,ue,Se,Me,Ee):(Ie&64||Ie&128)&&de.process($,W,J,Q,ie,ue,Se,Me,Ee,te)}De!=null&&ie?ea(De,$&&$.ref,ue,W||$,!W):De==null&&$&&$.ref!=null&&ea($.ref,null,ue,$,!0)},b=($,W,J,Q)=>{if($==null)s(W.el=a(W.children),J,Q);else{const ie=W.el=$.el;W.children!==$.children&&l(ie,W.children)}},_=($,W,J,Q)=>{$==null?s(W.el=h(W.children||""),J,Q):W.el=$.el},M=($,W,J,Q)=>{[$.el,$.anchor]=m($.children,W,J,Q,$.el,$.anchor)},v=({el:$,anchor:W},J,Q)=>{let ie;for(;$&&$!==W;)ie=f($),s($,J,Q),$=ie;s(W,J,Q)},S=({el:$,anchor:W})=>{let J;for(;$&&$!==W;)J=f($),n($),$=J;n(W)},y=($,W,J,Q,ie,ue,Se,Me,Ee)=>{if(W.type==="svg"?Se="svg":W.type==="math"&&(Se="mathml"),$==null)I(W,J,Q,ie,ue,Se,Me,Ee);else{const de=$.el&&$.el._isVueCE?$.el:null;try{de&&de._beginPatch(),R($,W,ie,ue,Se,Me,Ee)}finally{de&&de._endPatch()}}},I=($,W,J,Q,ie,ue,Se,Me)=>{let Ee,de;const{props:De,shapeFlag:Ie,transition:Be,dirs:Ke}=$;if(Ee=$.el=o($.type,ue,De&&De.is,De),Ie&8?c(Ee,$.children):Ie&16&&C($.children,Ee,null,Q,ie,qh($,ue),Se,Me),Ke&&sr($,null,Q,"created"),E(Ee,$,$.scopeId,Se,Q),De){for(const wt in De)wt!=="value"&&!Ko(wt)&&r(Ee,wt,null,De[wt],ue,Q);"value"in De&&r(Ee,"value",null,De.value,ue),(de=De.onVnodeBeforeMount)&&Ss(de,Q,$)}Ke&&sr($,null,Q,"beforeMount");const ct=nb(ie,Be);ct&&Be.beforeEnter(Ee),s(Ee,W,J),((de=De&&De.onVnodeMounted)||ct||Ke)&&Ai(()=>{try{de&&Ss(de,Q,$),ct&&Be.enter(Ee),Ke&&sr($,null,Q,"mounted")}finally{}},ie)},E=($,W,J,Q,ie)=>{if(J&&d($,J),Q)for(let ue=0;ue{for(let de=Ee;de<$.length;de++){const De=$[de]=Me?hn($[de]):Bs($[de]);g(null,De,W,J,Q,ie,ue,Se,Me)}},R=($,W,J,Q,ie,ue,Se)=>{const Me=W.el=$.el;let{patchFlag:Ee,dynamicChildren:de,dirs:De}=W;Ee|=$.patchFlag&16;const Ie=$.props||Ot,Be=W.props||Ot;let Ke;if(J&&nr(J,!1),(Ke=Be.onVnodeBeforeUpdate)&&Ss(Ke,J,W,$),De&&sr(W,$,J,"beforeUpdate"),J&&nr(J,!0),de&&(!$.dynamicChildren||$.dynamicChildren.length!==de.length)&&(Ee=0,Se=!1,de=null),(Ie.innerHTML&&Be.innerHTML==null||Ie.textContent&&Be.textContent==null)&&c(Me,""),de?B($.dynamicChildren,de,Me,J,Q,qh(W,ie),ue):Se||P($,W,Me,null,J,Q,qh(W,ie),ue,!1),Ee>0){if(Ee&16)k(Me,Ie,Be,J,ie);else if(Ee&2&&Ie.class!==Be.class&&r(Me,"class",null,Be.class,ie),Ee&4&&r(Me,"style",Ie.style,Be.style,ie),Ee&8){const ct=W.dynamicProps;for(let wt=0;wt{Ke&&Ss(Ke,J,W,$),De&&sr(W,$,J,"updated")},Q)},B=($,W,J,Q,ie,ue,Se)=>{for(let Me=0;Me{if(W!==J){if(W!==Ot)for(const ue in W)!Ko(ue)&&!(ue in J)&&r($,ue,W[ue],null,ie,Q);for(const ue in J){if(Ko(ue))continue;const Se=J[ue],Me=W[ue];Se!==Me&&ue!=="value"&&r($,ue,Me,Se,ie,Q)}"value"in J&&r($,"value",W.value,J.value,ie)}},F=($,W,J,Q,ie,ue,Se,Me,Ee)=>{const de=W.el=$?$.el:a(""),De=W.anchor=$?$.anchor:a("");let{patchFlag:Ie,dynamicChildren:Be,slotScopeIds:Ke}=W;Ke&&(Me=Me?Me.concat(Ke):Ke),$==null?(s(de,J,Q),s(De,J,Q),C(W.children||[],J,De,ie,ue,Se,Me,Ee)):Ie>0&&Ie&64&&Be&&$.dynamicChildren&&$.dynamicChildren.length===Be.length?(B($.dynamicChildren,Be,J,ie,ue,Se,Me),(W.key!=null||ie&&W===ie.subTree)&&_0($,W,!0)):P($,W,J,De,ie,ue,Se,Me,Ee)},D=($,W,J,Q,ie,ue,Se,Me,Ee)=>{W.slotScopeIds=Me,$==null?W.shapeFlag&512?ie.ctx.activate(W,J,Q,Se,Ee):N(W,J,Q,ie,ue,Se,Ee):j($,W,Ee)},N=($,W,J,Q,ie,ue,Se)=>{const Me=$.component=db($,Q,ie);if(jd($)&&(Me.ctx.renderer=te),fb(Me,!1,Se),Me.asyncDep){if(ie&&ie.registerDep(Me,O,Se),!$.el){const Ee=Me.subTree=Ne(js);_(null,Ee,W,J),$.placeholder=Ee.el}}else O(Me,$,W,J,ie,ue,Se)},j=($,W,J)=>{const Q=W.component=$.component;if(z1($,W,J))if(Q.asyncDep&&!Q.asyncResolved){L(Q,W,J);return}else Q.next=W,Q.update();else W.el=$.el,Q.vnode=W},O=($,W,J,Q,ie,ue,Se)=>{const Me=()=>{if($.isMounted){let{next:Ie,bu:Be,u:Ke,parent:ct,vnode:wt}=$;{const Jt=S0($);if(Jt){Ie&&(Ie.el=wt.el,L($,Ie,Se)),Jt.asyncDep.then(()=>{Ai(()=>{$.isUnmounted||de()},ie)});return}}let dt=Ie,Mt;nr($,!1),Ie?(Ie.el=wt.el,L($,Ie,Se)):Ie=wt,Be&&cl(Be),(Mt=Ie.props&&Ie.props.onVnodeBeforeUpdate)&&Ss(Mt,ct,Ie,wt),nr($,!0);const Ct=Rf($),ai=$.subTree;$.subTree=Ct,g(ai,Ct,u(ai.el),ae(ai),$,ie,ue),Ie.el=Ct.el,dt===null&&q1($,Ct.el),Ke&&Ai(Ke,ie),(Mt=Ie.props&&Ie.props.onVnodeUpdated)&&Ai(()=>Ss(Mt,ct,Ie,wt),ie)}else{let Ie;const{el:Be,props:Ke}=W,{bm:ct,m:wt,parent:dt,root:Mt,type:Ct}=$,ai=ro(W);nr($,!1),ct&&cl(ct),!ai&&(Ie=Ke&&Ke.onVnodeBeforeMount)&&Ss(Ie,dt,W),nr($,!0);{Mt.ce&&Mt.ce._hasShadowRoot()&&Mt.ce._injectChildStyle(Ct,$.parent?$.parent.type:void 0);const Jt=$.subTree=Rf($);g(null,Jt,J,Q,$,ie,ue),W.el=Jt.el}if(wt&&Ai(wt,ie),!ai&&(Ie=Ke&&Ke.onVnodeMounted)){const Jt=W;Ai(()=>Ss(Ie,dt,Jt),ie)}(W.shapeFlag&256||dt&&ro(dt.vnode)&&dt.vnode.shapeFlag&256)&&$.a&&Ai($.a,ie),$.isMounted=!0,W=J=Q=null}};$.scope.on();const Ee=$.effect=new Dg(Me);$.scope.off();const de=$.update=Ee.run.bind(Ee),De=$.job=Ee.runIfDirty.bind(Ee);De.i=$,De.id=$.uid,Ee.scheduler=()=>Yd(De),nr($,!0),de()},L=($,W,J)=>{W.component=$;const Q=$.vnode.props;$.vnode=W,$.next=null,Z1($,W.props,Q,J),tb($,W.children,J),xn(),Sf($),bn()},P=($,W,J,Q,ie,ue,Se,Me,Ee=!1)=>{const de=$&&$.children,De=$?$.shapeFlag:0,Ie=W.children,{patchFlag:Be,shapeFlag:Ke}=W;if(Be>0){if(Be&128){U(de,Ie,J,Q,ie,ue,Se,Me,Ee);return}else if(Be&256){X(de,Ie,J,Q,ie,ue,Se,Me,Ee);return}}Ke&8?(De&16&&Z(de,ie,ue),Ie!==de&&c(J,Ie)):De&16?Ke&16?U(de,Ie,J,Q,ie,ue,Se,Me,Ee):Z(de,ie,ue,!0):(De&8&&c(J,""),Ke&16&&C(Ie,J,Q,ie,ue,Se,Me,Ee))},X=($,W,J,Q,ie,ue,Se,Me,Ee)=>{$=$||io,W=W||io;const de=$.length,De=W.length,Ie=Math.min(de,De);let Be;for(Be=0;BeDe?Z($,ie,ue,!0,!1,Ie):C(W,J,Q,ie,ue,Se,Me,Ee,Ie)},U=($,W,J,Q,ie,ue,Se,Me,Ee)=>{let de=0;const De=W.length;let Ie=$.length-1,Be=De-1;for(;de<=Ie&&de<=Be;){const Ke=$[de],ct=W[de]=Ee?hn(W[de]):Bs(W[de]);if(Ro(Ke,ct))g(Ke,ct,J,null,ie,ue,Se,Me,Ee);else break;de++}for(;de<=Ie&&de<=Be;){const Ke=$[Ie],ct=W[Be]=Ee?hn(W[Be]):Bs(W[Be]);if(Ro(Ke,ct))g(Ke,ct,J,null,ie,ue,Se,Me,Ee);else break;Ie--,Be--}if(de>Ie){if(de<=Be){const Ke=Be+1,ct=KeBe)for(;de<=Ie;)q($[de],ie,ue,!0),de++;else{const Ke=de,ct=de,wt=new Map;for(de=ct;de<=Be;de++){const $t=W[de]=Ee?hn(W[de]):Bs(W[de]);$t.key!=null&&wt.set($t.key,de)}let dt,Mt=0;const Ct=Be-ct+1;let ai=!1,Jt=0;const Zi=new Array(Ct);for(de=0;de=Ct){q($t,ie,ue,!0);continue}let re;if($t.key!=null)re=wt.get($t.key);else for(dt=ct;dt<=Be;dt++)if(Zi[dt-ct]===0&&Ro($t,W[dt])){re=dt;break}re===void 0?q($t,ie,ue,!0):(Zi[re-ct]=de+1,re>=Jt?Jt=re:ai=!0,g($t,W[re],J,null,ie,ue,Se,Me,Ee),Mt++)}const xs=ai?rb(Zi):io;for(dt=xs.length-1,de=Ct-1;de>=0;de--){const $t=ct+de,re=W[$t],le=W[$t+1],ft=$t+1{const{el:ue,type:Se,transition:Me,children:Ee,shapeFlag:de}=$;if(de&6){Y($.component.subTree,W,J,Q);return}if(de&128){$.suspense.move(W,J,Q);return}if(de&64){Se.move($,W,J,te);return}if(Se===qe){s(ue,W,J);for(let Ie=0;IeMe.enter(ue),ie));else{const{leave:Ie,delayLeave:Be,afterLeave:Ke}=Me,ct=()=>{$.ctx.isUnmounted?n(ue):s(ue,W,J)},wt=()=>{const dt=ue._isLeaving||!!ue[Wh];ue._isLeaving&&ue[Wh](!0),Me.persisted&&!dt?ct():Ie(ue,()=>{ct(),Ke&&Ke()})};Be?Be(ue,ct,wt):wt()}else s(ue,W,J)},q=($,W,J,Q=!1,ie=!1)=>{const{type:ue,props:Se,ref:Me,children:Ee,dynamicChildren:de,shapeFlag:De,patchFlag:Ie,dirs:Be,cacheIndex:Ke,memo:ct}=$;if(Ie===-2&&(ie=!1),Me!=null&&(xn(),ea(Me,null,J,$,!0),bn()),Ke!=null&&(W.renderCache[Ke]=void 0),De&256){W.ctx.deactivate($);return}const wt=De&1&&Be,dt=!ro($);let Mt;if(dt&&(Mt=Se&&Se.onVnodeBeforeUnmount)&&Ss(Mt,W,$),De&6)H($.component,J,Q);else{if(De&128){$.suspense.unmount(J,Q);return}wt&&sr($,null,W,"beforeUnmount"),De&64?$.type.remove($,W,J,te,Q):de&&!de.hasOnce&&(ue!==qe||Ie>0&&Ie&64)?Z(de,W,J,!1,!0):(ue===qe&&Ie&384||!ie&&De&16)&&Z(Ee,W,J),Q&&z($)}const Ct=ct!=null&&Ke==null;(dt&&(Mt=Se&&Se.onVnodeUnmounted)||wt||Ct)&&Ai(()=>{Mt&&Ss(Mt,W,$),wt&&sr($,null,W,"unmounted"),Ct&&($.el=null)},J)},z=$=>{const{type:W,el:J,anchor:Q,transition:ie}=$;if(W===qe){ne(J,Q);return}if(W===ul){S($);return}const ue=()=>{n(J),ie&&!ie.persisted&&ie.afterLeave&&ie.afterLeave()};if($.shapeFlag&1&&ie&&!ie.persisted){const{leave:Se,delayLeave:Me}=ie,Ee=()=>Se(J,ue);Me?Me($.el,ue,Ee):Ee()}else ue()},ne=($,W)=>{let J;for(;$!==W;)J=f($),n($),$=J;n(W)},H=($,W,J)=>{const{bum:Q,scope:ie,job:ue,subTree:Se,um:Me,m:Ee,a:de}=$;Ff(Ee),Ff(de),Q&&cl(Q),ie.stop(),ue&&(ue.flags|=8,q(Se,$,W,J)),Me&&Ai(Me,W),Ai(()=>{$.isUnmounted=!0},W)},Z=($,W,J,Q=!1,ie=!1,ue=0)=>{for(let Se=ue;Se<$.length;Se++)q($[Se],W,J,Q,ie)},ae=$=>{if($.shapeFlag&6)return ae($.component.subTree);if($.shapeFlag&128)return $.suspense.next();const W=f($.anchor||$.el),J=W&&W[w1];return J?f(J):W};let me=!1;const _e=($,W,J)=>{let Q;$==null?W._vnode&&(q(W._vnode,null,null,!0),Q=W._vnode.component):g(W._vnode||null,$,W,null,null,null,J),W._vnode=$,me||(me=!0,Sf(Q),e0(),me=!1)},te={p:g,um:q,m:Y,r:z,mt:N,mc:C,pc:P,pbc:B,n:ae,o:i};return{render:_e,hydrate:void 0,createApp:Y1(_e)}}function qh({type:i,props:e},t){return t==="svg"&&i==="foreignObject"||t==="mathml"&&i==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:t}function nr({effect:i,job:e},t){t?(i.flags|=32,e.flags|=4):(i.flags&=-33,e.flags&=-5)}function nb(i,e){return(!i||i&&!i.pendingBranch)&&e&&!e.persisted}function _0(i,e,t=!1){const s=i.children,n=e.children;if(tt(s)&&tt(n))for(let r=0;r>1,i[t[a]]0&&(e[s]=t[r-1]),t[r]=s)}}for(r=t.length,o=t[r-1];r-- >0;)t[r]=o,o=e[o];return t}function S0(i){const e=i.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:S0(e)}function Ff(i){if(i)for(let e=0;ei.__isSuspense;function ob(i,e){e&&e.pendingBranch?tt(i)?e.effects.push(...i):e.effects.push(i):m1(i)}const qe=Symbol.for("v-fgt"),Sh=Symbol.for("v-txt"),js=Symbol.for("v-cmt"),ul=Symbol.for("v-stc"),vn=[];let Ui=null;function se(i=!1){vn.push(Ui=i?null:[])}function zd(){vn.pop(),Ui=vn[vn.length-1]||null}let la=1;function Of(i,e=!1){la+=i,i<0&&Ui&&e&&(Ui.hasOnce=!0)}function E0(i){return i.dynamicChildren=la>0?Ui||io:null,zd(),la>0&&Ui&&Ui.push(i),i}function ce(i,e,t,s,n,r){return E0(w(i,e,t,s,n,r,!0))}function Et(i,e,t,s,n){return E0(Ne(i,e,t,s,n,!0))}function qd(i){return i?i.__v_isVNode===!0:!1}function Ro(i,e){return i.type===e.type&&i.key===e.key}const A0=({key:i})=>i??null,dl=({ref:i,ref_key:e,ref_for:t})=>(typeof i=="number"&&(i=""+i),i!=null?qt(i)||Kt(i)||at(i)?{i:bi,r:i,k:e,f:!!t}:i:null);function w(i,e=null,t=null,s=0,n=null,r=i===qe?0:1,o=!1,a=!1){const h={__v_isVNode:!0,__v_skip:!0,type:i,props:e,key:e&&A0(e),ref:e&&dl(e),scopeId:i0,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:r,patchFlag:s,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:bi};return a?(Cl(h,t),r&128&&i.normalize(h)):t&&(h.shapeFlag|=qt(t)?8:16),la>0&&!o&&Ui&&(h.patchFlag>0||r&6)&&h.patchFlag!==32&&Ui.push(h),h}const Ne=ab;function ab(i,e=null,t=null,s=0,n=null,r=!1){if((!i||i===F1)&&(i=js),qd(i)){const a=mo(i,e,!0);return t&&Cl(a,t),la>0&&!r&&Ui&&(a.shapeFlag&6?Ui[Ui.indexOf(i)]=a:Ui.push(a)),a.patchFlag=-2,a}if(vb(i)&&(i=i.__vccOpts),e){e=lb(e);let{class:a,style:h}=e;a&&!qt(a)&&(e.class=Ze(a)),Ft(h)&&(yh(h)&&!tt(h)&&(h=mi({},h)),e.style=Pi(h))}const o=qt(i)?1:M0(i)?128:bh(i)?64:Ft(i)?4:at(i)?2:0;return w(i,e,t,s,n,o,r,!0)}function lb(i){return i?yh(i)||g0(i)?mi({},i):i:null}function mo(i,e,t=!1,s=!1){const{props:n,ref:r,patchFlag:o,children:a,transition:h}=i,l=e?hb(n||{},e):n,c={__v_isVNode:!0,__v_skip:!0,type:i.type,props:l,key:l&&A0(l),ref:e&&e.ref?t&&r?tt(r)?r.concat(dl(e)):[r,dl(e)]:dl(e):r,scopeId:i.scopeId,slotScopeIds:i.slotScopeIds,children:a,target:i.target,targetStart:i.targetStart,targetAnchor:i.targetAnchor,staticCount:i.staticCount,shapeFlag:i.shapeFlag,patchFlag:e&&i.type!==qe?o===-1?16:o|16:o,dynamicProps:i.dynamicProps,dynamicChildren:i.dynamicChildren,appContext:i.appContext,dirs:i.dirs,transition:h,component:i.component,suspense:i.suspense,ssContent:i.ssContent&&mo(i.ssContent),ssFallback:i.ssFallback&&mo(i.ssFallback),placeholder:i.placeholder,el:i.el,anchor:i.anchor,ctx:i.ctx,ce:i.ce};return h&&s&&Gd(c,h.clone(c)),c}function Yt(i=" ",e=0){return Ne(Sh,null,i,e)}function Vo(i,e){const t=Ne(ul,null,i);return t.staticCount=e,t}function $e(i="",e=!1){return e?(se(),Et(js,null,i)):Ne(js,null,i)}function Bs(i){return i==null||typeof i=="boolean"?Ne(js):tt(i)?Ne(qe,null,i.slice()):qd(i)?hn(i):Ne(Sh,null,String(i))}function hn(i){return i.el===null&&i.patchFlag!==-1||i.memo?i:mo(i)}function Cl(i,e){let t=0;const{shapeFlag:s}=i;if(e==null)e=null;else if(tt(e))t=16;else if(typeof e=="object")if(s&65){const n=e.default;n&&(n._c&&(n._d=!1),Cl(i,n()),n._c&&(n._d=!0));return}else{t=32;const n=e._;!n&&!g0(e)?e._ctx=bi:n===3&&bi&&(bi.slots._===1?e._=1:(e._=2,i.patchFlag|=1024))}else if(at(e)){if(s&65){Cl(i,{default:e});return}e={default:e,_ctx:bi},t=32}else e=String(e),s&64?(t=16,e=[Yt(e)]):t=8;i.children=e,i.shapeFlag|=t}function hb(...i){const e={};for(let t=0;tTi||bi;let Il,ha;{const i=gh(),e=(t,s)=>{let n;return(n=i[t])||(n=i[t]=[]),n.push(s),r=>{n.length>1?n.forEach(o=>o(r)):n[0](r)}};Il=e("__VUE_INSTANCE_SETTERS__",t=>Ti=t),ha=e("__VUE_SSR_SETTERS__",t=>ca=t)}const _a=i=>{const e=Ti;return Il(i),i.scope.on(),()=>{i.scope.off(),Il(e)}},Bf=()=>{Ti&&Ti.scope.off(),Il(null)};function I0(i){return i.vnode.shapeFlag&4}let ca=!1;function fb(i,e=!1,t=!1){e&&ha(e);const{props:s,children:n}=i.vnode,r=I0(i);K1(i,s,r,e),eb(i,n,t||e);const o=r?pb(i,e):void 0;return e&&ha(!1),o}function pb(i,e){const t=i.type;i.accessCache=Object.create(null),i.proxy=new Proxy(i.ctx,B1);const{setup:s}=t;if(s){xn();const n=i.setupContext=s.length>1?gb(i):null,r=_a(i),o=ba(s,i,0,[i.props,n]),a=Eg(o);if(bn(),r(),(a||i.sp)&&!ro(i)&&r0(i),a){if(o.then(Bf,Bf),e)return o.then(h=>{ha(!0);try{Lf(i,h,e)}finally{ha(!1)}}).catch(h=>{xh(h,i,0)});i.asyncDep=o}else Lf(i,o)}else R0(i)}function Lf(i,e,t){at(e)?i.type.__ssrInlineRender?i.ssrRender=e:i.render=e:Ft(e)&&(i.setupState=Zg(e)),R0(i)}function R0(i,e,t){const s=i.type;i.render||(i.render=s.render||Ys);{const n=_a(i);xn();try{L1(i)}finally{bn(),n()}}}const mb={get(i,e){return yi(i,"get",""),i[e]}};function gb(i){const e=t=>{i.exposed=t||{}};return{attrs:new Proxy(i.attrs,mb),slots:i.slots,emit:i.emit,expose:e}}function Th(i){return i.exposed?i.exposeProxy||(i.exposeProxy=new Proxy(Zg($n(i.exposed)),{get(e,t){if(t in e)return e[t];if(t in ta)return ta[t](i)},has(e,t){return t in e||t in ta}})):i.proxy}function vb(i){return at(i)&&"__vccOpts"in i}const ut=(i,e)=>c1(i,e,ca),yb="3.5.41";/** * @vue/runtime-dom v3.5.41 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT **/let Nu;const Df=typeof window<"u"&&window.trustedTypes;if(Df)try{Nu=Df.createPolicy("vue",{createHTML:i=>i})}catch{}const P0=Nu?i=>Nu.createHTML(i):i=>i,xb="http://www.w3.org/2000/svg",bb="http://www.w3.org/1998/Math/MathML",rn=typeof document<"u"?document:null,Nf=rn&&rn.createElement("template"),wb={insert:(i,e,t)=>{e.insertBefore(i,t||null)},remove:i=>{const e=i.parentNode;e&&e.removeChild(i)},createElement:(i,e,t,s)=>{const n=e==="svg"?rn.createElementNS(xb,i):e==="mathml"?rn.createElementNS(bb,i):t?rn.createElement(i,{is:t}):rn.createElement(i);return i==="select"&&s&&s.multiple!=null&&n.setAttribute("multiple",s.multiple),n},createText:i=>rn.createTextNode(i),createComment:i=>rn.createComment(i),setText:(i,e)=>{i.nodeValue=e},setElementText:(i,e)=>{i.textContent=e},parentNode:i=>i.parentNode,nextSibling:i=>i.nextSibling,querySelector:i=>rn.querySelector(i),setScopeId(i,e){i.setAttribute(e,"")},insertStaticContent(i,e,t,s,n,r){const o=t?t.previousSibling:e.lastChild;if(n&&(n===r||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),t),!(n===r||!(n=n.nextSibling)););else{Nf.innerHTML=P0(s==="svg"?`${i}`:s==="mathml"?`${i}`:i);const a=Nf.content;if(s==="svg"||s==="mathml"){const h=a.firstChild;for(;h.firstChild;)a.appendChild(h.firstChild);a.removeChild(h)}e.insertBefore(a,t)}return[o?o.nextSibling:e.firstChild,t?t.previousSibling:e.lastChild]}},_b=Symbol("_vtc");function Sb(i,e,t){const s=i[_b];s&&(e=(e?[e,...s]:[...s]).join(" ")),e==null?i.removeAttribute("class"):t?i.setAttribute("class",e):i.className=e}const Rl=Symbol("_vod"),k0=Symbol("_vsh"),Cn={name:"show",beforeMount(i,{value:e},{transition:t}){i[Rl]=i.style.display==="none"?"":i.style.display,t&&e?t.beforeEnter(i):Po(i,e)},mounted(i,{value:e},{transition:t}){t&&e&&t.enter(i)},updated(i,{value:e,oldValue:t},{transition:s}){!e!=!t&&(s?e?(s.beforeEnter(i),Po(i,!0),s.enter(i)):s.leave(i,()=>{Po(i,!1)}):Po(i,e))},beforeUnmount(i,{value:e}){Po(i,e)}};function Po(i,e){i.style.display=e?i[Rl]:"none",i[k0]=!e}const Tb=Symbol(""),Mb=/(?:^|;)\s*display\s*:/;function Eb(i,e,t){const s=i.style,n=qt(t);let r=!1;if(t&&!n){if(e)if(qt(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();t[a]==null&&Xo(s,a,"")}else for(const o in e)t[o]==null&&Xo(s,o,"");for(const o in t){o==="display"&&(r=!0);const a=t[o];a!=null?Cb(i,o,!qt(e)&&e?e[o]:void 0,a)||Xo(s,o,a):Xo(s,o,"")}}else if(n){if(e!==t){const o=s[Tb];o&&(t+=";"+o),s.cssText=t,r=Mb.test(t)}}else e&&i.removeAttribute("style");Rl in i&&(i[Rl]=r?s.display:"",i[k0]&&(s.display="none"))}const Uf=/\s*!important$/;function Xo(i,e,t){if(tt(t))t.forEach(s=>Xo(i,e,s));else if(t==null&&(t=""),e.startsWith("--"))i.setProperty(e,t);else{const s=Ab(i,e);Uf.test(t)?i.setProperty(Jn(s),t.replace(Uf,""),"important"):i[s]=t}}const Vf=["Webkit","Moz","ms"],Kh={};function Ab(i,e){const t=Kh[e];if(t)return t;let s=ls(e);if(s!=="filter"&&s in i)return Kh[e]=s;s=Ig(s);for(let n=0;nZh||(Ob.then(()=>Zh=0),Zh=Date.now());function Lb(i,e){const t=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=t.attached)return;const n=t.value;if(tt(n)){const r=s.stopImmediatePropagation;s.stopImmediatePropagation=()=>{r.call(s),s._stopped=!0};const o=n.slice(),a=[s];for(let h=0;hi.charCodeAt(0)===111&&i.charCodeAt(1)===110&&i.charCodeAt(2)>96&&i.charCodeAt(2)<123,Db=(i,e,t,s,n,r)=>{const o=n==="svg";e==="class"?Sb(i,s,o):e==="style"?Eb(i,t,s):uh(e)?dh(e)||Rb(i,e,t,s,r):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Nb(i,e,s,o))?($f(i,e,s),!i.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Yf(i,e,s,o,r,e!=="value")):i._isVueCE&&(Ub(i,e)||i._def.__asyncLoader&&(/[A-Z]/.test(e)||!qt(s)))?$f(i,ls(e),s,r,e):(e==="true-value"?i._trueValue=s:e==="false-value"&&(i._falseValue=s),Yf(i,e,s,o))};function Nb(i,e,t,s){if(s)return!!(e==="innerHTML"||e==="textContent"||e in i&&jf(e)&&at(t));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&i.tagName==="IFRAME"||e==="form"||e==="list"&&i.tagName==="INPUT"||e==="type"&&i.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const n=i.tagName;if(n==="IMG"||n==="VIDEO"||n==="CANVAS"||n==="SOURCE")return!1}return jf(e)&&qt(t)?!1:e in i}function Ub(i,e){const t=i._def.props;if(!t)return!1;const s=ls(e);return Array.isArray(t)?t.some(n=>ls(n)===s):Object.keys(t).some(n=>ls(n)===s)}const go=i=>{const e=i.props["onUpdate:modelValue"]||!1;return tt(e)?t=>cl(e,t):e};function Vb(i){i.target.composing=!0}function Hf(i){const e=i.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Ns=Symbol("_assign"),ka=Symbol("_initialValue");function Jh(i,e,t){return e&&(i=i.trim()),t&&(i=mh(i)),i}const Je={created(i,{modifiers:{lazy:e,trim:t,number:s}},n){i.parentNode&&(i.type==="text"?i[ka]=i.defaultValue.replace(/[\r\n]/g,""):i.type==="textarea"&&(i[ka]=i.defaultValue.replace(/\r\n?/g,` `))),i[Ns]=go(n);const r=s||n.props&&n.props.type==="number";Un(i,e?"change":"input",o=>{o.target.composing||i[Ns](Jh(i.value,t,r))}),(t||r)&&Un(i,"change",()=>{i.value=Jh(i.value,t,r)}),e||(Un(i,"compositionstart",Vb),Un(i,"compositionend",Hf),Un(i,"change",Hf))},mounted(i,{value:e,modifiers:{trim:t,number:s}}){const n=e??"",r=i[ka];delete i[ka],r!==void 0&&(i.type==="text"||i.type==="textarea")&&i.value!==r?i[Ns](Jh(i.value,t,s)):i.value=n},beforeUpdate(i,{value:e,oldValue:t,modifiers:{lazy:s,trim:n,number:r}},o){if(i[Ns]=go(o),i.composing)return;const a=(r||i.type==="number")&&!/^0\d/.test(i.value)?mh(i.value):i.value,h=e??"";if(a===h)return;const l=i.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===i&&i.type!=="range"&&(s&&e===t||n&&i.value.trim()===h)||(i.value=h)}},Lt={deep:!0,created(i,e,t){i[Ns]=go(t),Un(i,"change",()=>{const s=i._modelValue,n=ua(i),r=i.checked,o=i[Ns];if(tt(s)){const a=Od(s,n),h=a!==-1;if(r&&!h)o(s.concat(n));else if(!r&&h){const l=[...s];l.splice(a,1),o(l)}}else if(xo(s)){const a=new Set(s);r?a.add(n):a.delete(n),o(a)}else o(F0(i,r))})},mounted:Wf,beforeUpdate(i,e,t){i[Ns]=go(t),Wf(i,e,t)}};function Wf(i,{value:e,oldValue:t},s){i._modelValue=e;let n;if(tt(e))n=Od(e,s.props.value)>-1;else if(xo(e))n=e.has(s.props.value);else{if(e===t)return;n=bo(e,F0(i,!0))}i.checked!==n&&(i.checked=n)}const kt={deep:!0,created(i,{value:e,modifiers:{number:t}},s){i._modelValue=e,Un(i,"change",()=>{const n=Array.prototype.filter.call(i.options,r=>r.selected).map(r=>t?mh(ua(r)):ua(r));i[Ns](i.multiple?xo(i._modelValue)?new Set(n):n:n[0]),i._assigning=!0,Xd(()=>{i._assigning=!1})}),i[Ns]=go(s)},mounted(i,{value:e}){zf(i,e)},beforeUpdate(i,{value:e},t){i._modelValue=e,i[Ns]=go(t)},updated(i,{value:e}){i._assigning||zf(i,e)}};function zf(i,e){const t=i.multiple,s=tt(e);if(!(t&&!s&&!xo(e))){for(let n=0,r=i.options.length;nString(l)===String(a)):o.selected=Od(e,a)>-1}else o.selected=e.has(a);else if(bo(ua(o),e)){i.selectedIndex!==n&&(i.selectedIndex=n);return}}!t&&i.selectedIndex!==-1&&(i.selectedIndex=-1)}}function ua(i){return"_value"in i?i._value:i.value}function F0(i,e){const t=e?"_trueValue":"_falseValue";return t in i?i[t]:e}const Xb=["ctrl","shift","alt","meta"],Yb={stop:i=>i.stopPropagation(),prevent:i=>i.preventDefault(),self:i=>i.target!==i.currentTarget,ctrl:i=>!i.ctrlKey,shift:i=>!i.shiftKey,alt:i=>!i.altKey,meta:i=>!i.metaKey,left:i=>"button"in i&&i.button!==0,middle:i=>"button"in i&&i.button!==1,right:i=>"button"in i&&i.button!==2,exact:(i,e)=>Xb.some(t=>i[`${t}Key`]&&!e.includes(t))},xt=(i,e)=>{if(!i)return i;const t=i._withMods||(i._withMods={}),s=e.join(".");return t[s]||(t[s]=((n,...r)=>{for(let o=0;o{const t=i._withKeys||(i._withKeys={}),s=e.join(".");return t[s]||(t[s]=(n=>{if(!("key"in n))return;const r=Jn(n.key);if(e.some(o=>o===r||$b[o]===r))return i(n)}))},Gb=mi({patchProp:Db},wb);let qf;function jb(){return qf||(qf=ib(Gb))}const Hb=((...i)=>{const e=jb().createApp(...i),{mount:t}=e;return e.mount=s=>{const n=zb(s);if(!n)return;const r=e._component;!at(r)&&!r.render&&!r.template&&(r.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const o=t(n,!1,Wb(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e});function Wb(i){if(i instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&i instanceof MathMLElement)return"mathml"}function zb(i){return qt(i)?document.querySelector(i):i}/*! * pinia v4.0.3 * (c) 2026 Eduardo San Martin Morote * @license MIT */let O0;const Mh=i=>O0=i,B0=Symbol();function Kf(i){return i&&typeof i=="object"&&Object.prototype.toString.call(i)==="[object Object]"&&typeof i.toJSON!="function"}function qb(){const i=Bg(!0),e=i.run(()=>it({}));let t=[],s=[];const n=$n({install(r){Mh(n),n._a=r,r.provide(B0,n),r.config.globalProperties.$pinia=n,s.forEach(o=>t.push(o)),s=[]},use(r){return this._a?t.push(r):s.push(r),this},_p:t,_a:null,_e:i,_s:new Map,state:e});return n}const Uu=()=>{};function Zf(i,e,t,s=Uu){i.add(e);const n=()=>{i.delete(e)&&s()};return!t&&Lg()&&Dx(n),n}function Br(i,...e){i.forEach(t=>{t(...e)})}const Kb=i=>i(),Jf=Symbol(),Qh=Symbol();function Vu(i,e){i instanceof Map&&e instanceof Map?e.forEach((t,s)=>i.set(s,t)):i instanceof Set&&e instanceof Set&&e.forEach(i.add,i);for(const t in e){if(!Object.hasOwn(e,t))continue;const s=e[t],n=i[t];Kf(n)&&Kf(s)&&Object.hasOwn(i,t)&&!Kt(s)&&!gn(s)?i[t]=Vu(n,s):i[t]=s}return i}const Zb=Symbol();function Jb(i){return!i||typeof i!="object"||!Object.hasOwn(i,Zb)}const{assign:Pn}=Object;function Qb(i){return!!(Kt(i)&&i.effect)}function ew(i,e,t,s){const{state:n,actions:r,getters:o}=e,a=t.state.value[i];let h;function l(){a||(t.state.value[i]=n?n():{});const c=o1(t.state.value[i]);return Pn(c,r,Object.keys(o||{}).reduce((u,f)=>(u[f]=$n(ut(()=>{Mh(t);const d=t._s.get(i);return o[f].call(d,d)})),u),{}))}return h=L0(i,l,e,t,s,!0),h}function L0(i,e,t={},s,n,r){let o;const a=Pn({actions:{}},t),h={deep:!0};let l,c,u=new Set,f=new Set,d;const m=s.state.value[i];!r&&!m&&(s.state.value[i]={});let g;function b(E){let C;l=c=!1,typeof E=="function"?(E(s.state.value[i]),C={type:"patch function",storeId:i,events:d}):(Vu(s.state.value[i],E),C={type:"patch object",payload:E,storeId:i,events:d});const R=g=Symbol();Xd().then(()=>{g===R&&(l=!0)}),c=!0,Br(u,C,s.state.value[i])}const _=r?function(){const{state:C}=t,R=C?C():{};this.$patch(B=>{Pn(B,R)})}:Uu;function M(){o.stop(),u.clear(),f.clear(),s._s.delete(i)}const v=(E,C="")=>{if(Jf in E)return E[Qh]=C,E;const R=function(){Mh(s);const B=Array.from(arguments),k=new Set,F=new Set;function D(O){k.add(O)}function N(O){F.add(O)}Br(f,{args:B,name:R[Qh],store:y,after:D,onError:N});let j;try{j=E.apply(this&&this.$id===i?this:y,B)}catch(O){throw Br(F,O),O}return j instanceof Promise?j.then(O=>(Br(k,O),O)).catch(O=>(Br(F,O),Promise.reject(O))):(Br(k,j),j)};return R[Jf]=!0,R[Qh]=C,R},S={_p:s,$id:i,$onAction:Zf.bind(null,f),$patch:b,$reset:_,$subscribe(E,C={}){if(u.has(E))return Uu;const R=Zf(u,E,C.detached,()=>B()),B=o.run(()=>cs(()=>s.state.value[i],k=>{(C.flush==="sync"?c:l)&&E({storeId:i,type:"direct",events:d},k)},Pn({},h,C)));return R},$dispose:M},y=wo(S);s._s.set(i,y);const I=(s._a&&s._a.runWithContext||Kb)(()=>s._e.run(()=>(o=Bg()).run(()=>e({action:v}))));for(const E in I){const C=I[E];Kt(C)&&!Qb(C)||gn(C)?r||(m&&Jb(C)&&(Kt(C)?C.value=m[E]:((C instanceof Set||C instanceof Map)&&C.clear(),Vu(C,m[E]))),s.state.value[i][E]=C):typeof C=="function"&&(I[E]=v(C,E),a.actions[E]=C)}return Pn(y,I),Pn(Tt(y),I),Object.defineProperty(y,"$state",{get:()=>s.state.value[i],set:E=>{b(C=>{Pn(C,E)})}}),s._p.forEach(E=>{const C=o.run(()=>E({store:y,app:s._a,pinia:s,options:a}));Pn(y,C)}),m&&r&&t.hydrate&&t.hydrate(y.$state,m),l=!0,c=!0,y}/*! #__NO_SIDE_EFFECTS__ */function tw(i,e,t){let s;const n=typeof e=="function";s=n?t:e;function r(o,a){const h=v1();return o=o||(h?Qo(B0,null):null),o&&Mh(o),o=O0,o._s.has(i)||(n?L0(i,e,s,o):ew(i,s,o)),o._s.get(i)}return r.$id=i,r}var Cr=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(Cr||{}),D0=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(D0||{}),Xu=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(Xu||{}),Qe=(i=>(i[i.NORMAL=0]="NORMAL",i[i.ADD=1]="ADD",i[i.MULTIPLY=2]="MULTIPLY",i[i.SCREEN=3]="SCREEN",i[i.OVERLAY=4]="OVERLAY",i[i.DARKEN=5]="DARKEN",i[i.LIGHTEN=6]="LIGHTEN",i[i.COLOR_DODGE=7]="COLOR_DODGE",i[i.COLOR_BURN=8]="COLOR_BURN",i[i.HARD_LIGHT=9]="HARD_LIGHT",i[i.SOFT_LIGHT=10]="SOFT_LIGHT",i[i.DIFFERENCE=11]="DIFFERENCE",i[i.EXCLUSION=12]="EXCLUSION",i[i.HUE=13]="HUE",i[i.SATURATION=14]="SATURATION",i[i.COLOR=15]="COLOR",i[i.LUMINOSITY=16]="LUMINOSITY",i[i.NORMAL_NPM=17]="NORMAL_NPM",i[i.ADD_NPM=18]="ADD_NPM",i[i.SCREEN_NPM=19]="SCREEN_NPM",i[i.NONE=20]="NONE",i[i.SRC_OVER=0]="SRC_OVER",i[i.SRC_IN=21]="SRC_IN",i[i.SRC_OUT=22]="SRC_OUT",i[i.SRC_ATOP=23]="SRC_ATOP",i[i.DST_OVER=24]="DST_OVER",i[i.DST_IN=25]="DST_IN",i[i.DST_OUT=26]="DST_OUT",i[i.DST_ATOP=27]="DST_ATOP",i[i.ERASE=26]="ERASE",i[i.SUBTRACT=28]="SUBTRACT",i[i.XOR=29]="XOR",i))(Qe||{}),Us=(i=>(i[i.POINTS=0]="POINTS",i[i.LINES=1]="LINES",i[i.LINE_LOOP=2]="LINE_LOOP",i[i.LINE_STRIP=3]="LINE_STRIP",i[i.TRIANGLES=4]="TRIANGLES",i[i.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",i[i.TRIANGLE_FAN=6]="TRIANGLE_FAN",i))(Us||{}),Re=(i=>(i[i.RGBA=6408]="RGBA",i[i.RGB=6407]="RGB",i[i.RG=33319]="RG",i[i.RED=6403]="RED",i[i.RGBA_INTEGER=36249]="RGBA_INTEGER",i[i.RGB_INTEGER=36248]="RGB_INTEGER",i[i.RG_INTEGER=33320]="RG_INTEGER",i[i.RED_INTEGER=36244]="RED_INTEGER",i[i.ALPHA=6406]="ALPHA",i[i.LUMINANCE=6409]="LUMINANCE",i[i.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",i[i.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",i[i.DEPTH_STENCIL=34041]="DEPTH_STENCIL",i))(Re||{}),oo=(i=>(i[i.TEXTURE_2D=3553]="TEXTURE_2D",i[i.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",i[i.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",i[i.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",i[i.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",i[i.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",i[i.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",i[i.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",i))(oo||{}),je=(i=>(i[i.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",i[i.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",i[i.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",i[i.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",i[i.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",i[i.UNSIGNED_INT=5125]="UNSIGNED_INT",i[i.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",i[i.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",i[i.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",i[i.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",i[i.BYTE=5120]="BYTE",i[i.SHORT=5122]="SHORT",i[i.INT=5124]="INT",i[i.FLOAT=5126]="FLOAT",i[i.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",i[i.HALF_FLOAT=36193]="HALF_FLOAT",i))(je||{}),Xe=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(Xe||{}),as=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(as||{}),us=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(us||{}),Ki=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(Ki||{}),ui=(i=>(i[i.NPM=0]="NPM",i[i.UNPACK=1]="UNPACK",i[i.PMA=2]="PMA",i[i.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",i[i.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",i[i.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA",i))(ui||{}),Ls=(i=>(i[i.NO=0]="NO",i[i.YES=1]="YES",i[i.AUTO=2]="AUTO",i[i.BLEND=0]="BLEND",i[i.CLEAR=1]="CLEAR",i[i.BLIT=2]="BLIT",i))(Ls||{}),Kd=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(Kd||{}),zi=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(zi||{}),si=(i=>(i[i.NONE=0]="NONE",i[i.SCISSOR=1]="SCISSOR",i[i.STENCIL=2]="STENCIL",i[i.SPRITE=3]="SPRITE",i[i.COLOR=4]="COLOR",i))(si||{}),ei=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(ei||{}),$s=(i=>(i[i.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",i[i.ARRAY_BUFFER=34962]="ARRAY_BUFFER",i[i.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",i))($s||{});const iw={createCanvas:(i,e)=>{const t=document.createElement("canvas");return t.width=i,t.height=e,t},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(i,e)=>fetch(i,e),parseXML:i=>new DOMParser().parseFromString(i,"text/xml")},Ve={ADAPTER:iw,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var ec=/iPhone/i,Qf=/iPod/i,ep=/iPad/i,tp=/\biOS-universal(?:.+)Mac\b/i,tc=/\bAndroid(?:.+)Mobile\b/i,ip=/Android/i,Lr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Fa=/Silk/i,tn=/Windows Phone/i,sp=/\bWindows(?:.+)ARM\b/i,np=/BlackBerry/i,rp=/BB10/i,op=/Opera Mini/i,ap=/\b(CriOS|Chrome)(?:.+)Mobile/i,lp=/Mobile(?:.+)Firefox\b/i,hp=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};function sw(i){return function(e){return e.test(i)}}function cp(i){var e={userAgent:"",platform:"",maxTouchPoints:0};!i&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof i=="string"?e.userAgent=i:i&&i.userAgent&&(e={userAgent:i.userAgent,platform:i.platform,maxTouchPoints:i.maxTouchPoints||0});var t=e.userAgent,s=t.split("[FBAN");typeof s[1]<"u"&&(t=s[0]),s=t.split("Twitter"),typeof s[1]<"u"&&(t=s[0]);var n=sw(t),r={apple:{phone:n(ec)&&!n(tn),ipod:n(Qf),tablet:!n(ec)&&(n(ep)||hp(e))&&!n(tn),universal:n(tp),device:(n(ec)||n(Qf)||n(ep)||n(tp)||hp(e))&&!n(tn)},amazon:{phone:n(Lr),tablet:!n(Lr)&&n(Fa),device:n(Lr)||n(Fa)},android:{phone:!n(tn)&&n(Lr)||!n(tn)&&n(tc),tablet:!n(tn)&&!n(Lr)&&!n(tc)&&(n(Fa)||n(ip)),device:!n(tn)&&(n(Lr)||n(Fa)||n(tc)||n(ip))||n(/\bokhttp\b/i)},windows:{phone:n(tn),tablet:n(sp),device:n(tn)||n(sp)},other:{blackberry:n(np),blackberry10:n(rp),opera:n(op),firefox:n(lp),chrome:n(ap),device:n(np)||n(rp)||n(op)||n(lp)||n(ap)},any:!1,phone:!1,tablet:!1};return r.any=r.apple.device||r.android.device||r.windows.device||r.other.device,r.phone=r.apple.phone||r.android.phone||r.windows.phone,r.tablet=r.apple.tablet||r.android.tablet||r.windows.tablet,r}const nw=cp.default??cp,dn=nw(globalThis.navigator);Ve.RETINA_PREFIX=/@([0-9\.]+)x/;Ve.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var Pl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function N0(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function rw(i){if(Object.prototype.hasOwnProperty.call(i,"__esModule"))return i;var e=i.default;if(typeof e=="function"){var t=function s(){return this instanceof s?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(s){var n=Object.getOwnPropertyDescriptor(i,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:function(){return i[s]}})}),t}var ic={exports:{}},up;function ow(){return up||(up=1,(function(i){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function n(h,l,c){this.fn=h,this.context=l,this.once=c||!1}function r(h,l,c,u,f){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new n(c,u||h,f),m=t?t+l:l;return h._events[m]?h._events[m].fn?h._events[m]=[h._events[m],d]:h._events[m].push(d):(h._events[m]=d,h._eventsCount++),h}function o(h,l){--h._eventsCount===0?h._events=new s:delete h._events[l]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,u;if(this._eventsCount===0)return l;for(u in c=this._events)e.call(c,u)&&l.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=t?t+l:l,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var f=0,d=u.length,m=new Array(d);f80*P){z=H=O[0],ne=Z=O[1];for(var te=P;teH&&(H=ae),me>Z&&(Z=me);_e=Math.max(H-z,Z-ne),_e=_e!==0?32767/_e:0}return s(Y,q,P,z,ne,_e,0),q}function e(O,L,P,X,U){var Y,q;if(U===j(O,L,P,X)>0)for(Y=L;Y=L;Y-=X)q=F(Y,O[Y],O[Y+1],q);return q&&S(q,q.next)&&(D(q),q=q.next),q}function t(O,L){if(!O)return O;L||(L=O);var P=O,X;do if(X=!1,!P.steiner&&(S(P,P.next)||v(P.prev,P,P.next)===0)){if(D(P),P=L=P.prev,P===P.next)break;X=!0}else P=P.next;while(X||P!==L);return L}function s(O,L,P,X,U,Y,q){if(O){!q&&Y&&d(O,X,U,Y);for(var z=O,ne,H;O.prev!==O.next;){if(ne=O.prev,H=O.next,Y?r(O,X,U,Y):n(O)){L.push(ne.i/P|0),L.push(O.i/P|0),L.push(H.i/P|0),D(O),O=H.next,z=H.next;continue}if(O=H,O===z){q?q===1?(O=o(t(O),L,P),s(O,L,P,X,U,Y,2)):q===2&&a(O,L,P,X,U,Y):s(t(O),L,P,X,U,Y,1);break}}}}function n(O){var L=O.prev,P=O,X=O.next;if(v(L,P,X)>=0)return!1;for(var U=L.x,Y=P.x,q=X.x,z=L.y,ne=P.y,H=X.y,Z=UY?U>q?U:q:Y>q?Y:q,_e=z>ne?z>H?z:H:ne>H?ne:H,te=X.next;te!==L;){if(te.x>=Z&&te.x<=me&&te.y>=ae&&te.y<=_e&&_(U,z,Y,ne,q,H,te.x,te.y)&&v(te.prev,te,te.next)>=0)return!1;te=te.next}return!0}function r(O,L,P,X){var U=O.prev,Y=O,q=O.next;if(v(U,Y,q)>=0)return!1;for(var z=U.x,ne=Y.x,H=q.x,Z=U.y,ae=Y.y,me=q.y,_e=zne?z>H?z:H:ne>H?ne:H,$=Z>ae?Z>me?Z:me:ae>me?ae:me,W=g(_e,te,L,P,X),J=g(ve,$,L,P,X),Q=O.prevZ,ie=O.nextZ;Q&&Q.z>=W&&ie&&ie.z<=J;){if(Q.x>=_e&&Q.x<=ve&&Q.y>=te&&Q.y<=$&&Q!==U&&Q!==q&&_(z,Z,ne,ae,H,me,Q.x,Q.y)&&v(Q.prev,Q,Q.next)>=0||(Q=Q.prevZ,ie.x>=_e&&ie.x<=ve&&ie.y>=te&&ie.y<=$&&ie!==U&&ie!==q&&_(z,Z,ne,ae,H,me,ie.x,ie.y)&&v(ie.prev,ie,ie.next)>=0))return!1;ie=ie.nextZ}for(;Q&&Q.z>=W;){if(Q.x>=_e&&Q.x<=ve&&Q.y>=te&&Q.y<=$&&Q!==U&&Q!==q&&_(z,Z,ne,ae,H,me,Q.x,Q.y)&&v(Q.prev,Q,Q.next)>=0)return!1;Q=Q.prevZ}for(;ie&&ie.z<=J;){if(ie.x>=_e&&ie.x<=ve&&ie.y>=te&&ie.y<=$&&ie!==U&&ie!==q&&_(z,Z,ne,ae,H,me,ie.x,ie.y)&&v(ie.prev,ie,ie.next)>=0)return!1;ie=ie.nextZ}return!0}function o(O,L,P){var X=O;do{var U=X.prev,Y=X.next.next;!S(U,Y)&&y(U,X,X.next,Y)&&R(U,Y)&&R(Y,U)&&(L.push(U.i/P|0),L.push(X.i/P|0),L.push(Y.i/P|0),D(X),D(X.next),X=O=Y),X=X.next}while(X!==O);return t(X)}function a(O,L,P,X,U,Y){var q=O;do{for(var z=q.next.next;z!==q.prev;){if(q.i!==z.i&&M(q,z)){var ne=k(q,z);q=t(q,q.next),ne=t(ne,ne.next),s(q,L,P,X,U,Y,0),s(ne,L,P,X,U,Y,0);return}z=z.next}q=q.next}while(q!==O)}function h(O,L,P,X){var U=[],Y,q,z,ne,H;for(Y=0,q=L.length;Y=P.next.y&&P.next.y!==P.y){var z=P.x+(U-P.y)*(P.next.x-P.x)/(P.next.y-P.y);if(z<=X&&z>Y&&(Y=z,q=P.x=P.x&&P.x>=H&&X!==P.x&&_(Uq.x||P.x===q.x&&f(q,P)))&&(q=P,ae=me)),P=P.next;while(P!==ne);return q}function f(O,L){return v(O.prev,O,L.prev)<0&&v(L.next,O,O.next)<0}function d(O,L,P,X){var U=O;do U.z===0&&(U.z=g(U.x,U.y,L,P,X)),U.prevZ=U.prev,U.nextZ=U.next,U=U.next;while(U!==O);U.prevZ.nextZ=null,U.prevZ=null,m(U)}function m(O){var L,P,X,U,Y,q,z,ne,H=1;do{for(P=O,O=null,Y=null,q=0;P;){for(q++,X=P,z=0,L=0;L0||ne>0&&X;)z!==0&&(ne===0||!X||P.z<=X.z)?(U=P,P=P.nextZ,z--):(U=X,X=X.nextZ,ne--),Y?Y.nextZ=U:O=U,U.prevZ=Y,Y=U;P=X}Y.nextZ=null,H*=2}while(q>1);return O}function g(O,L,P,X,U){return O=(O-P)*U|0,L=(L-X)*U|0,O=(O|O<<8)&16711935,O=(O|O<<4)&252645135,O=(O|O<<2)&858993459,O=(O|O<<1)&1431655765,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,O|L<<1}function b(O){var L=O,P=O;do(L.x=(O-q)*(Y-z)&&(O-q)*(X-z)>=(P-q)*(L-z)&&(P-q)*(Y-z)>=(U-q)*(X-z)}function M(O,L){return O.next.i!==L.i&&O.prev.i!==L.i&&!C(O,L)&&(R(O,L)&&R(L,O)&&B(O,L)&&(v(O.prev,O,L.prev)||v(O,L.prev,L))||S(O,L)&&v(O.prev,O,O.next)>0&&v(L.prev,L,L.next)>0)}function v(O,L,P){return(L.y-O.y)*(P.x-L.x)-(L.x-O.x)*(P.y-L.y)}function S(O,L){return O.x===L.x&&O.y===L.y}function y(O,L,P,X){var U=E(v(O,L,P)),Y=E(v(O,L,X)),q=E(v(P,X,O)),z=E(v(P,X,L));return!!(U!==Y&&q!==z||U===0&&I(O,P,L)||Y===0&&I(O,X,L)||q===0&&I(P,O,X)||z===0&&I(P,L,X))}function I(O,L,P){return L.x<=Math.max(O.x,P.x)&&L.x>=Math.min(O.x,P.x)&&L.y<=Math.max(O.y,P.y)&&L.y>=Math.min(O.y,P.y)}function E(O){return O>0?1:O<0?-1:0}function C(O,L){var P=O;do{if(P.i!==O.i&&P.next.i!==O.i&&P.i!==L.i&&P.next.i!==L.i&&y(P,P.next,O,L))return!0;P=P.next}while(P!==O);return!1}function R(O,L){return v(O.prev,O,O.next)<0?v(O,L,O.next)>=0&&v(O,O.prev,L)>=0:v(O,L,O.prev)<0||v(O,O.next,L)<0}function B(O,L){var P=O,X=!1,U=(O.x+L.x)/2,Y=(O.y+L.y)/2;do P.y>Y!=P.next.y>Y&&P.next.y!==P.y&&U<(P.next.x-P.x)*(Y-P.y)/(P.next.y-P.y)+P.x&&(X=!X),P=P.next;while(P!==O);return X}function k(O,L){var P=new N(O.i,O.x,O.y),X=new N(L.i,L.x,L.y),U=O.next,Y=L.prev;return O.next=L,L.prev=O,P.next=U,U.prev=P,X.next=P,P.prev=X,Y.next=X,X.prev=Y,X}function F(O,L,P,X){var U=new N(O,L,P);return X?(U.next=X.next,U.prev=X,X.next.prev=U,X.next=U):(U.prev=U,U.next=U),U}function D(O){O.next.prev=O.prev,O.prev.next=O.next,O.prevZ&&(O.prevZ.nextZ=O.nextZ),O.nextZ&&(O.nextZ.prevZ=O.prevZ)}function N(O,L,P){this.i=O,this.x=L,this.y=P,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}i.deviation=function(O,L,P,X){var U=L&&L.length,Y=U?L[0]*P:O.length,q=Math.abs(j(O,0,Y,P));if(U)for(var z=0,ne=L.length;z0&&(X+=O[U-1].length,P.holes.push(X))}return P},Oa.exports}var hw=lw();const cw=N0(hw);var rr={},Yo={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var uw=Yo.exports,fp;function dw(){return fp||(fp=1,(function(i,e){(function(t){var s=e&&!e.nodeType&&e,n=i&&!i.nodeType&&i,r=typeof Pl=="object"&&Pl;(r.global===r||r.window===r||r.self===r)&&(t=r);var o,a=2147483647,h=36,l=1,c=26,u=38,f=700,d=72,m=128,g="-",b=/^xn--/,_=/[^\x20-\x7E]/,M=/[\x2E\u3002\uFF0E\uFF61]/g,v={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},S=h-l,y=Math.floor,I=String.fromCharCode,E;function C(U){throw new RangeError(v[U])}function R(U,Y){for(var q=U.length,z=[];q--;)z[q]=Y(U[q]);return z}function B(U,Y){var q=U.split("@"),z="";q.length>1&&(z=q[0]+"@",U=q[1]),U=U.replace(M,".");var ne=U.split("."),H=R(ne,Y).join(".");return z+H}function k(U){for(var Y=[],q=0,z=U.length,ne,H;q=55296&&ne<=56319&&q65535&&(Y-=65536,q+=I(Y>>>10&1023|55296),Y=56320|Y&1023),q+=I(Y),q}).join("")}function D(U){return U-48<10?U-22:U-65<26?U-65:U-97<26?U-97:h}function N(U,Y){return U+22+75*(U<26)-((Y!=0)<<5)}function j(U,Y,q){var z=0;for(U=q?y(U/f):U>>1,U+=y(U/Y);U>S*c>>1;z+=h)U=y(U/S);return y(z+(S+1)*U/(U+u))}function O(U){var Y=[],q=U.length,z,ne=0,H=m,Z=d,ae,me,_e,te,ve,$,W,J,Q;for(ae=U.lastIndexOf(g),ae<0&&(ae=0),me=0;me=128&&C("not-basic"),Y.push(U.charCodeAt(me));for(_e=ae>0?ae+1:0;_e=q&&C("invalid-input"),W=D(U.charCodeAt(_e++)),(W>=h||W>y((a-ne)/ve))&&C("overflow"),ne+=W*ve,J=$<=Z?l:$>=Z+c?c:$-Z,!(Wy(a/Q)&&C("overflow"),ve*=Q;z=Y.length+1,Z=j(ne-te,z,te==0),y(ne/z)>a-H&&C("overflow"),H+=y(ne/z),ne%=z,Y.splice(ne++,0,H)}return F(Y)}function L(U){var Y,q,z,ne,H,Z,ae,me,_e,te,ve,$=[],W,J,Q,ie;for(U=k(U),W=U.length,Y=m,q=0,H=d,Z=0;Z=Y&&vey((a-q)/J)&&C("overflow"),q+=(ae-Y)*J,Y=ae,Z=0;Za&&C("overflow"),ve==Y){for(me=q,_e=h;te=_e<=H?l:_e>=H+c?c:_e-H,!(me-1e3&&re<1e3||I.call(/e/,le))return le;var ft=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof re=="number"){var It=re<0?-B(-re):B(re);if(It!==re){var Pt=String(It),nt=M.call(le,Pt.length+1);return v.call(Pt,ft,"$&_")+"."+v.call(v.call(nt,/([0-9]{3})/g,"$&_"),/_$/,"")}}return v.call(le,ft,"$&_")}var X=mw,U=X.custom,Y=J(U)?U:null,q={__proto__:null,double:'"',single:"'"},z={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};nc=function re(le,ft,It,Pt){var nt=ft||{};if(ue(nt,"quoteStyle")&&!ue(q,nt.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(ue(nt,"maxStringLength")&&(typeof nt.maxStringLength=="number"?nt.maxStringLength<0&&nt.maxStringLength!==1/0:nt.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var $i=ue(nt,"customInspect")?nt.customInspect:!0;if(typeof $i!="boolean"&&$i!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(ue(nt,"indent")&&nt.indent!==null&&nt.indent!==" "&&!(parseInt(nt.indent,10)===nt.indent&&nt.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(ue(nt,"numericSeparator")&&typeof nt.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var Ji=nt.numericSeparator;if(typeof le>"u")return"undefined";if(le===null)return"null";if(typeof le=="boolean")return le?"true":"false";if(typeof le=="string")return wt(le,nt);if(typeof le=="number"){if(le===0)return 1/0/le>0?"0":"-0";var li=String(le);return Ji?P(le,li):li}if(typeof le=="bigint"){var Gi=String(le)+"n";return Ji?P(le,Gi):Gi}var er=typeof nt.depth>"u"?5:nt.depth;if(typeof It>"u"&&(It=0),It>=er&&er>0&&typeof le=="object")return ae(le)?"[Array]":"[Object]";var Oi=Zi(nt,It);if(typeof Pt>"u")Pt=[];else if(Ee(Pt,le)>=0)return"[Circular]";function Qt(V,K,oe){if(K&&(Pt=R.call(Pt),Pt.push(K)),oe){var pe={depth:nt.depth};return ue(nt,"quoteStyle")&&(pe.quoteStyle=nt.quoteStyle),re(V,pe,It+1,Pt)}return re(V,nt,It+1,Pt)}if(typeof le=="function"&&!_e(le)){var Pr=Me(le),kr=$t(le,Qt);return"[Function"+(Pr?": "+Pr:" (anonymous)")+"]"+(kr.length>0?" { "+C.call(kr,", ")+" }":"")}if(J(le)){var Mn=N?v.call(String(le),/^(Symbol\(.*\))_[^)]*$/,"$1"):D.call(le);return typeof le=="object"&&!N?Mt(Mn):Mn}if(ct(le)){for(var Zs="<"+y.call(String(le.nodeName)),En=le.attributes||[],Js=0;Js",Zs}if(ae(le)){if(le.length===0)return"[]";var An=$t(le,Qt);return Oi&&!Jt(An)?"["+xs(An,Oi)+"]":"[ "+C.call(An,", ")+" ]"}if(te(le)){var bs=$t(le,Qt);return!("cause"in Error.prototype)&&"cause"in le&&!O.call(le,"cause")?"{ ["+String(le)+"] "+C.call(E.call("[cause]: "+Qt(le.cause),bs),", ")+" }":bs.length===0?"["+String(le)+"]":"{ ["+String(le)+"] "+C.call(bs,", ")+" }"}if(typeof le=="object"&&$i){if(Y&&typeof le[Y]=="function"&&X)return X(le,{depth:er-It});if($i!=="symbol"&&typeof le.inspect=="function")return le.inspect()}if(de(le)){var Bi=[];return s&&s.call(le,function(V,K){Bi.push(Qt(K,le,!0)+" => "+Qt(V,le))}),ai("Map",t.call(le),Bi,Oi)}if(Be(le)){var Qi=[];return a&&a.call(le,function(V){Qi.push(Qt(V,le))}),ai("Set",o.call(le),Qi,Oi)}if(De(le))return Ct("WeakMap");if(Ke(le))return Ct("WeakSet");if(Ie(le))return Ct("WeakRef");if($(le))return Mt(Qt(Number(le)));if(Q(le))return Mt(Qt(k.call(le)));if(W(le))return Mt(m.call(le));if(ve(le))return Mt(Qt(String(le)));if(typeof window<"u"&&le===window)return"{ [object Window] }";if(typeof globalThis<"u"&&le===globalThis||typeof Pl<"u"&&le===Pl)return"{ [object globalThis] }";if(!me(le)&&!_e(le)){var ws=$t(le,Qt),tr=L?L(le)===Object.prototype:le instanceof Object||le.constructor===Object,G=le instanceof Object?"":"null prototype",T=!tr&&j&&Object(le)===le&&j in le?M.call(Se(le),8,-1):G?"Object":"",p=tr||typeof le.constructor!="function"?"":le.constructor.name?le.constructor.name+" ":"",x=p+(T||G?"["+C.call(E.call([],T||[],G||[]),": ")+"] ":"");return ws.length===0?x+"{}":Oi?x+"{"+xs(ws,Oi)+"}":x+"{ "+C.call(ws,", ")+" }"}return String(le)};function ne(re,le,ft){var It=ft.quoteStyle||le,Pt=q[It];return Pt+re+Pt}function H(re){return v.call(String(re),/"/g,""")}function Z(re){return!j||!(typeof re=="object"&&(j in re||typeof re[j]<"u"))}function ae(re){return Se(re)==="[object Array]"&&Z(re)}function me(re){return Se(re)==="[object Date]"&&Z(re)}function _e(re){return Se(re)==="[object RegExp]"&&Z(re)}function te(re){return Se(re)==="[object Error]"&&Z(re)}function ve(re){return Se(re)==="[object String]"&&Z(re)}function $(re){return Se(re)==="[object Number]"&&Z(re)}function W(re){return Se(re)==="[object Boolean]"&&Z(re)}function J(re){if(N)return re&&typeof re=="object"&&re instanceof Symbol;if(typeof re=="symbol")return!0;if(!re||typeof re!="object"||!D)return!1;try{return D.call(re),!0}catch{}return!1}function Q(re){if(!re||typeof re!="object"||!k)return!1;try{return k.call(re),!0}catch{}return!1}var ie=Object.prototype.hasOwnProperty||function(re){return re in this};function ue(re,le){return ie.call(re,le)}function Se(re){return g.call(re)}function Me(re){if(re.name)return re.name;var le=_.call(b.call(re),/^function\s*([\w$]+)/);return le?le[1]:null}function Ee(re,le){if(re.indexOf)return re.indexOf(le);for(var ft=0,It=re.length;ftle.maxStringLength){var ft=re.length-le.maxStringLength,It="... "+ft+" more character"+(ft>1?"s":"");return wt(M.call(re,0,le.maxStringLength),le)+It}var Pt=z[le.quoteStyle||"single"];Pt.lastIndex=0;var nt=v.call(v.call(re,Pt,"\\$1"),/[\x00-\x1f]/g,dt);return ne(nt,"single",le)}function dt(re){var le=re.charCodeAt(0),ft={8:"b",9:"t",10:"n",12:"f",13:"r"}[le];return ft?"\\"+ft:"\\x"+(le<16?"0":"")+S.call(le.toString(16))}function Mt(re){return"Object("+re+")"}function Ct(re){return re+" { ? }"}function ai(re,le,ft,It){var Pt=It?xs(ft,It):C.call(ft,", ");return re+" ("+le+") {"+Pt+"}"}function Jt(re){for(var le=0;le=0)return!1;return!0}function Zi(re,le){var ft;if(re.indent===" ")ft=" ";else if(typeof re.indent=="number"&&re.indent>0)ft=C.call(Array(re.indent+1)," ");else return null;return{base:ft,prev:C.call(Array(le+1),ft)}}function xs(re,le){if(re.length===0)return"";var ft=` `+le.prev+le.base;return ft+C.call(re,","+ft)+` `+le.prev}function $t(re,le){var ft=ae(re),It=[];if(ft){It.length=re.length;for(var Pt=0;Pt"u"||!E?i:E(Uint8Array),N={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?i:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?i:ArrayBuffer,"%ArrayIteratorPrototype%":I&&E?E([][Symbol.iterator]()):i,"%AsyncFromSyncIteratorPrototype%":i,"%AsyncFunction%":F,"%AsyncGenerator%":F,"%AsyncGeneratorFunction%":F,"%AsyncIteratorPrototype%":F,"%Atomics%":typeof Atomics>"u"?i:Atomics,"%BigInt%":typeof BigInt>"u"?i:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?i:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?i:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?i:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":t,"%eval%":eval,"%EvalError%":s,"%Float16Array%":typeof Float16Array>"u"?i:Float16Array,"%Float32Array%":typeof Float32Array>"u"?i:Float32Array,"%Float64Array%":typeof Float64Array>"u"?i:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?i:FinalizationRegistry,"%Function%":b,"%GeneratorFunction%":F,"%Int8Array%":typeof Int8Array>"u"?i:Int8Array,"%Int16Array%":typeof Int16Array>"u"?i:Int16Array,"%Int32Array%":typeof Int32Array>"u"?i:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":I&&E?E(E([][Symbol.iterator]())):i,"%JSON%":typeof JSON=="object"?JSON:i,"%Map%":typeof Map>"u"?i:Map,"%MapIteratorPrototype%":typeof Map>"u"||!I||!E?i:E(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":e,"%Object.getOwnPropertyDescriptor%":M,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?i:Promise,"%Proxy%":typeof Proxy>"u"?i:Proxy,"%RangeError%":n,"%ReferenceError%":r,"%Reflect%":typeof Reflect>"u"?i:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?i:Set,"%SetIteratorPrototype%":typeof Set>"u"||!I||!E?i:E(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?i:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":I&&E?E(""[Symbol.iterator]()):i,"%Symbol%":I?Symbol:i,"%SyntaxError%":o,"%ThrowTypeError%":y,"%TypedArray%":D,"%TypeError%":a,"%Uint8Array%":typeof Uint8Array>"u"?i:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?i:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?i:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?i:Uint32Array,"%URIError%":h,"%WeakMap%":typeof WeakMap>"u"?i:WeakMap,"%WeakRef%":typeof WeakRef>"u"?i:WeakRef,"%WeakSet%":typeof WeakSet>"u"?i:WeakSet,"%Function.prototype.call%":k,"%Function.prototype.apply%":B,"%Object.defineProperty%":v,"%Object.getPrototypeOf%":C,"%Math.abs%":l,"%Math.floor%":c,"%Math.max%":u,"%Math.min%":f,"%Math.pow%":d,"%Math.round%":m,"%Math.sign%":g,"%Reflect.getPrototypeOf%":R};if(E)try{null.error}catch(_e){var j=E(E(_e));N["%Error.prototype%"]=j}var O=function _e(te){var ve;if(te==="%AsyncFunction%")ve=_("async function () {}");else if(te==="%GeneratorFunction%")ve=_("function* () {}");else if(te==="%AsyncGeneratorFunction%")ve=_("async function* () {}");else if(te==="%AsyncGenerator%"){var $=_e("%AsyncGeneratorFunction%");$&&(ve=$.prototype)}else if(te==="%AsyncIteratorPrototype%"){var W=_e("%AsyncGenerator%");W&&E&&(ve=E(W.prototype))}return N[te]=ve,ve},L={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},P=Ah(),X=Uw(),U=P.call(k,Array.prototype.concat),Y=P.call(B,Array.prototype.splice),q=P.call(k,String.prototype.replace),z=P.call(k,String.prototype.slice),ne=P.call(k,RegExp.prototype.exec),H=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Z=/\\(\\)?/g,ae=function(te){var ve=z(te,0,1),$=z(te,-1);if(ve==="%"&&$!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if($==="%"&&ve!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var W=[];return q(te,H,function(J,Q,ie,ue){W[W.length]=ie?q(ue,Z,"$1"):Q||J}),W},me=function(te,ve){var $=te,W;if(X(L,$)&&(W=L[$],$="%"+W[0]+"%"),X(N,$)){var J=N[$];if(J===F&&(J=O($)),typeof J>"u"&&!ve)throw new a("intrinsic "+te+" exists, but is not available. Please file an issue!");return{alias:W,name:$,value:J}}throw new o("intrinsic "+te+" does not exist!")};return Nc=function(te,ve){if(typeof te!="string"||te.length===0)throw new a("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof ve!="boolean")throw new a('"allowMissing" argument must be a boolean');if(ne(/^%?[^%]*%?$/,te)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var $=ae(te),W=$.length>0?$[0]:"",J=me("%"+W+"%",ve),Q=J.name,ie=J.value,ue=!1,Se=J.alias;Se&&(W=Se[0],Y($,U([0,1],Se)));for(var Me=1,Ee=!0;Me<$.length;Me+=1){var de=$[Me],De=z(de,0,1),Ie=z(de,-1);if((De==='"'||De==="'"||De==="`"||Ie==='"'||Ie==="'"||Ie==="`")&&De!==Ie)throw new o("property names with quotes must have matching quotes");if((de==="constructor"||!Ee)&&(ue=!0),W+="."+de,Q="%"+W+"%",X(N,Q))ie=N[Q];else if(ie!=null){if(!(de in ie)){if(!ve)throw new a("base intrinsic for "+te+" exists, but the property is not available.");return}if(M&&Me+1>=$.length){var Be=M(ie,de);Ee=!!Be,Ee&&"get"in Be&&!("originalValue"in Be.get)?ie=Be.get:ie=ie[de]}else Ee=X(ie,de),ie=ie[de];Ee&&!ue&&(N[Q]=ie)}}return ie},Nc}var Uc,Kp;function H0(){if(Kp)return Uc;Kp=1;var i=Jd(),e=j0(),t=e([i("%String.prototype.indexOf%")]);return Uc=function(n,r){var o=i(n,!!r);return typeof o=="function"&&t(n,".prototype.")>-1?e([o]):o},Uc}var Vc,Zp;function W0(){if(Zp)return Vc;Zp=1;var i=Jd(),e=H0(),t=Eh(),s=So(),n=i("%Map%",!0),r=e("Map.prototype.get",!0),o=e("Map.prototype.set",!0),a=e("Map.prototype.has",!0),h=e("Map.prototype.delete",!0),l=e("Map.prototype.size",!0);return Vc=!!n&&function(){var u,f={assert:function(d){if(!f.has(d))throw new s("Side channel does not contain "+t(d))},delete:function(d){if(u){var m=h(u,d);return l(u)===0&&(u=void 0),m}return!1},get:function(d){if(u)return r(u,d)},has:function(d){return u?a(u,d):!1},set:function(d,m){u||(u=new n),o(u,d,m)}};return f},Vc}var Xc,Jp;function Vw(){if(Jp)return Xc;Jp=1;var i=Jd(),e=H0(),t=Eh(),s=W0(),n=So(),r=i("%WeakMap%",!0),o=e("WeakMap.prototype.get",!0),a=e("WeakMap.prototype.set",!0),h=e("WeakMap.prototype.has",!0),l=e("WeakMap.prototype.delete",!0);return Xc=r?function(){var u,f,d={assert:function(m){if(!d.has(m))throw new n("Side channel does not contain "+t(m))},delete:function(m){if(r&&m&&(typeof m=="object"||typeof m=="function")){if(u)return l(u,m)}else if(s&&f)return f.delete(m);return!1},get:function(m){return r&&m&&(typeof m=="object"||typeof m=="function")&&u?o(u,m):f&&f.get(m)},has:function(m){return r&&m&&(typeof m=="object"||typeof m=="function")&&u?h(u,m):!!f&&f.has(m)},set:function(m,g){r&&m&&(typeof m=="object"||typeof m=="function")?(u||(u=new r),a(u,m,g)):s&&(f||(f=s()),f.set(m,g))}};return d}:s,Xc}var Yc,Qp;function z0(){if(Qp)return Yc;Qp=1;var i=So(),e=Eh(),t=gw(),s=W0(),n=Vw(),r=n||s||t;return Yc=function(){var a,h={assert:function(l){if(!h.has(l)){var c=l&&Object(l)===l?"the given object key":e(l);throw new i("Side channel does not contain "+c)}},delete:function(l){return!!a&&a.delete(l)},get:function(l){return a&&a.get(l)},has:function(l){return!!a&&a.has(l)},set:function(l,c){a||(a=r()),a.set(l,c)}};return h},Yc}var $c,em;function Qd(){if(em)return $c;em=1;var i=String.prototype.replace,e=/%20/g,t={RFC1738:"RFC1738",RFC3986:"RFC3986"};return $c={default:t.RFC3986,formatters:{RFC1738:function(s){return i.call(s,e,"+")},RFC3986:function(s){return String(s)}},RFC1738:t.RFC1738,RFC3986:t.RFC3986},$c}var Gc,tm;function q0(){if(tm)return Gc;tm=1;var i=Qd(),e=z0(),t=X0(),s=Object.prototype.hasOwnProperty,n=Array.isArray,r=e(),o=function(R,B){return r.set(R,B),R},a=function(R){return r.has(R)},h=function(R){return r.get(R)},l=function(R,B){r.set(R,B)},c=(function(){for(var C=[],R=0;R<256;++R)C[C.length]="%"+((R<16?"0":"")+R.toString(16)).toUpperCase();return C})(),u=function(R){for(;R.length>1;){var B=R.pop(),k=B.obj[B.prop];if(n(k)){for(var F=[],D=0;D=k.arrayLimit){if(k.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+k.arrayLimit+" element"+(k.arrayLimit===1?"":"s")+" allowed in an array.");return o(f(R.concat(B),k),F)}R[F]=B}else if(R&&typeof R=="object")if(a(R)){var D=h(R)+1;R[D]=B,l(R,D)}else{if(k&&k.strictMerge)return[R,B];(k&&(k.plainObjects||k.allowPrototypes)||!s.call(Object.prototype,B))&&(R[B]=!0)}else return[R,B];return R}if(!R||typeof R!="object"){if(a(B)){for(var N=Object.keys(B),j=k&&k.plainObjects?{__proto__:null,0:R}:{0:R},O=0;Ok.arrayLimit){if(k.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+k.arrayLimit+" element"+(k.arrayLimit===1?"":"s")+" allowed in an array.");return o(f(P,k),P.length-1)}return P}var X=R;if(n(R)&&!n(B)&&(X=f(R,k)),n(R)&&n(B)){if(B.forEach(function(U,Y){if(s.call(R,Y)){var q=R[Y];q&&typeof q=="object"&&U&&typeof U=="object"?R[Y]=C(q,U,k):R[R.length]=U}else R[Y]=U}),k&&typeof k.arrayLimit=="number"&&R.length>k.arrayLimit){if(k.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+k.arrayLimit+" element"+(k.arrayLimit===1?"":"s")+" allowed in an array.");return o(f(R,k),R.length-1)}return R}return Object.keys(B).reduce(function(U,Y){var q=B[Y];if(s.call(U,Y)?d(U,Y,C(U[Y],q,k)):d(U,Y,q),a(B)&&!a(U)&&o(U,h(B)),a(U)){var z=parseInt(Y,10);String(z)===Y&&z>=0&&z>h(U)&&l(U,z)}return U},X)},g=function(R,B){return Object.keys(B).reduce(function(k,F){return d(k,F,B[F]),k},R)},b=function(C,R,B){var k=C.replace(/\+/g," ");if(B==="iso-8859-1")return k.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(k)}catch{return k}},_=1024,M=function(R,B,k,F,D){if(R.length===0)return R;var N=R;if(typeof R=="symbol"?N=Symbol.prototype.toString.call(R):typeof R!="string"&&(N=String(R)),k==="iso-8859-1")return escape(N).replace(/%u[0-9a-f]{4}/gi,function(q){return"%26%23"+parseInt(q.slice(2),16)+"%3B"});for(var j="",O=0;O=_?N.slice(O,O+_):N;if(O+_=55296&&P<=56319&&(L=L.slice(0,-1),O-=1)}for(var X=[],U=0;U=48&&Y<=57||Y>=65&&Y<=90||Y>=97&&Y<=122||D===i.RFC1738&&(Y===40||Y===41)){X[X.length]=L.charAt(U);continue}if(Y<128){X[X.length]=c[Y];continue}if(Y<2048){X[X.length]=c[192|Y>>6]+c[128|Y&63];continue}if(Y<55296||Y>=57344){X[X.length]=c[224|Y>>12]+c[128|Y>>6&63]+c[128|Y&63];continue}U+=1,Y=65536+((Y&1023)<<10|L.charCodeAt(U)&1023),X[X.length]=c[240|Y>>18]+c[128|Y>>12&63]+c[128|Y>>6&63]+c[128|Y&63]}j+=X.join("")}return j},v=function(R){for(var B=[{obj:{o:R},prop:"o"}],k=e(),F=0;Fk){if(D)throw new RangeError("Array limit exceeded. Only "+k+" element"+(k===1?"":"s")+" allowed in an array.");return o(f(j,{plainObjects:F}),j.length-1)}return j},E=function(R,B){if(n(R)){for(var k=[],F=0;F"u"&&(U=0)}if(typeof R=="function"?P=R(_,P):P instanceof Date?P=F(P):M==="comma"&&r(P)&&(P=e.maybeMap(P,function(Q){return Q instanceof Date?F(Q):Q})),P===null){if(y)return N(C&&!j?C(_,c.encoder,O,"key",D):_);P=""}if(u(P)||e.isBuffer(P)){if(C){var z=j?_:C(_,c.encoder,O,"key",D);return[N(z)+"="+N(C(P,c.encoder,O,"value",D))]}return[N(_)+"="+N(String(P))]}var ne=[];if(typeof P>"u")return ne;var H;if(M==="comma"&&r(P))j&&C&&(P=e.maybeMap(P,function(Q){return Q==null?Q:C(Q)})),H=[{value:P.length>0?P.join(",")||null:void 0}];else if(r(R))H=R;else{var Z=Object.keys(P);H=B?Z.sort(B):Z}var ae=E?String(_).replace(/\./g,"%2E"):String(_),me=v&&r(P)&&P.length===1?ae+"[]":ae;if(S&&r(P)&&P.length===0)return me+"[]";for(var _e=0;_e"u"?b.encodeDotInKeys===!0?!0:c.allowDots:!!b.allowDots;return{addQueryPrefix:typeof b.addQueryPrefix=="boolean"?b.addQueryPrefix:c.addQueryPrefix,allowDots:I,allowEmptyArrays:typeof b.allowEmptyArrays=="boolean"?!!b.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:y,charset:_,charsetSentinel:typeof b.charsetSentinel=="boolean"?b.charsetSentinel:c.charsetSentinel,commaRoundTrip:!!b.commaRoundTrip,delimiter:typeof b.delimiter>"u"?c.delimiter:b.delimiter,encode:typeof b.encode=="boolean"?b.encode:c.encode,encodeDotInKeys:typeof b.encodeDotInKeys=="boolean"?b.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof b.encoder=="function"?b.encoder:c.encoder,encodeValuesOnly:typeof b.encodeValuesOnly=="boolean"?b.encodeValuesOnly:c.encodeValuesOnly,filter:S,format:M,formatter:v,serializeDate:typeof b.serializeDate=="function"?b.serializeDate:c.serializeDate,skipNulls:typeof b.skipNulls=="boolean"?b.skipNulls:c.skipNulls,sort:typeof b.sort=="function"?b.sort:null,strictNullHandling:typeof b.strictNullHandling=="boolean"?b.strictNullHandling:c.strictNullHandling}};return jc=function(g,b){var _=g,M=m(b),v,S;typeof M.filter=="function"?(S=M.filter,_=S("",_)):r(M.filter)&&(S=M.filter,v=S);var y=[];if(typeof _!="object"||_===null)return"";var I=n[M.arrayFormat],E=I==="comma"&&M.commaRoundTrip;v||(v=Object.keys(_)),M.sort&&v.sort(M.sort);for(var C=i(),R=0;R"u"||B===null)){var k=_[B];M.skipNulls&&k===null||a(y,d(k,B,I,E,M.allowEmptyArrays,M.strictNullHandling,M.skipNulls,M.encodeDotInKeys,M.encode?M.encoder:null,M.filter,M.sort,M.allowDots,M.serializeDate,M.format,M.formatter,M.encodeValuesOnly,M.charset,C))}}var F=y.join(M.delimiter),D=M.addQueryPrefix===!0?"?":"";return M.charsetSentinel&&(M.charset==="iso-8859-1"?D+="utf8=%26%2310003%3B"+M.delimiter:D+="utf8=%E2%9C%93"+M.delimiter),F.length>0?D+F:""},jc}var Hc,sm;function Yw(){if(sm)return Hc;sm=1;var i=q0(),e=Object.prototype.hasOwnProperty,t=Array.isArray,s={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:i.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},n=function(d){return d.replace(/&#(\d+);/g,function(m,g){return String.fromCharCode(parseInt(g,10))})},r=function(d,m,g,b){if(d&&typeof d=="string"&&m.comma&&d.indexOf(",")>-1){if(b&&m.throwOnLimitExceeded)for(var _=0,M=d.indexOf(",");M>-1;){if(_+=1,_>=m.arrayLimit)throw new RangeError("Array limit exceeded. Only "+m.arrayLimit+" element"+(m.arrayLimit===1?"":"s")+" allowed in an array.");M=d.indexOf(",",M+1)}return d.split(",")}if(m.throwOnLimitExceeded&&g>=m.arrayLimit)throw new RangeError("Array limit exceeded. Only "+m.arrayLimit+" element"+(m.arrayLimit===1?"":"s")+" allowed in an array.");return d},o="utf8=%26%2310003%3B",a="utf8=%E2%9C%93",h=function(m,g){var b={__proto__:null},_=g.ignoreQueryPrefix?m.replace(/^\?/,""):m;_=_.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var M=g.parameterLimit===1/0?void 0:g.parameterLimit,v=_.split(g.delimiter,g.throwOnLimitExceeded&&typeof M<"u"?M+1:M);if(g.throwOnLimitExceeded&&typeof M<"u"&&v.length>M)throw new RangeError("Parameter limit exceeded. Only "+M+" parameter"+(M===1?"":"s")+" allowed.");var S=-1,y,I=g.charset;if(g.charsetSentinel)for(y=0;y-1&&(k=t(k)?[k]:k),g.comma&&t(k)&&k.length>g.arrayLimit&&(k=i.combine([],k,g.arrayLimit,g.plainObjects,g.throwOnLimitExceeded)),B!==null){var F=e.call(b,B);F&&(g.duplicates==="combine"||E.indexOf("[]=")>-1)?b[B]=i.combine(b[B],k,g.arrayLimit,g.plainObjects,g.throwOnLimitExceeded):(!F||g.duplicates==="last")&&(b[B]=k)}}return b},l=function(d,m,g,b){var _=0;if(d.length>0&&d[d.length-1]==="[]"){var M=d.slice(0,-1).join("");_=Array.isArray(m)&&m[M]?m[M].length:0}for(var v=b?m:r(m,g,_),S=d.length-1;S>=0;--S){var y,I=d[S];if(I==="[]"&&g.parseArrays)i.isOverflow(v)?y=v:y=g.allowEmptyArrays&&(v===""||g.strictNullHandling&&v===null)?[]:i.combine([],v,g.arrayLimit,g.plainObjects,g.throwOnLimitExceeded);else{y=g.plainObjects?{__proto__:null}:{};var E=I.charAt(0)==="["&&I.charAt(I.length-1)==="]"?I.slice(1,-1):I,C=g.decodeDotInKeys?E.replace(/%2E/g,"."):E,R=parseInt(C,10),B=!isNaN(R)&&I!==C&&String(R)===C&&R>=0&&g.parseArrays;if(!g.parseArrays&&C==="")y={0:v};else if(B&&R=0?b.slice(0,M):b;if(v){if(!g.plainObjects&&e.call(Object.prototype,v)&&!g.allowPrototypes)return;_[_.length]=v}for(var S=b.length,y=M,I=0;y>=0&&I=0){if(g.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+g.depth+" and strictDepth is true");_[_.length]="["+b.slice(y)+"]"}return _},u=function(m,g,b,_){if(m){var M=c(m,b);if(M)return l(M,g,b,_)}},f=function(m){if(!m)return s;if(typeof m.allowEmptyArrays<"u"&&typeof m.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof m.decodeDotInKeys<"u"&&typeof m.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(m.decoder!==null&&typeof m.decoder<"u"&&typeof m.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof m.charset<"u"&&m.charset!=="utf-8"&&m.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof m.throwOnLimitExceeded<"u"&&typeof m.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var g=typeof m.charset>"u"?s.charset:m.charset,b=typeof m.duplicates>"u"?s.duplicates:m.duplicates;if(b!=="combine"&&b!=="first"&&b!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var _=typeof m.allowDots>"u"?m.decodeDotInKeys===!0?!0:s.allowDots:!!m.allowDots;return{allowDots:_,allowEmptyArrays:typeof m.allowEmptyArrays=="boolean"?!!m.allowEmptyArrays:s.allowEmptyArrays,allowPrototypes:typeof m.allowPrototypes=="boolean"?m.allowPrototypes:s.allowPrototypes,allowSparse:typeof m.allowSparse=="boolean"?m.allowSparse:s.allowSparse,arrayLimit:typeof m.arrayLimit=="number"?m.arrayLimit:s.arrayLimit,charset:g,charsetSentinel:typeof m.charsetSentinel=="boolean"?m.charsetSentinel:s.charsetSentinel,comma:typeof m.comma=="boolean"?m.comma:s.comma,decodeDotInKeys:typeof m.decodeDotInKeys=="boolean"?m.decodeDotInKeys:s.decodeDotInKeys,decoder:typeof m.decoder=="function"?m.decoder:s.decoder,delimiter:typeof m.delimiter=="string"||i.isRegExp(m.delimiter)?m.delimiter:s.delimiter,depth:typeof m.depth=="number"||m.depth===!1?+m.depth:s.depth,duplicates:b,ignoreQueryPrefix:m.ignoreQueryPrefix===!0,interpretNumericEntities:typeof m.interpretNumericEntities=="boolean"?m.interpretNumericEntities:s.interpretNumericEntities,parameterLimit:typeof m.parameterLimit=="number"?m.parameterLimit:s.parameterLimit,parseArrays:m.parseArrays!==!1,plainObjects:typeof m.plainObjects=="boolean"?m.plainObjects:s.plainObjects,strictDepth:typeof m.strictDepth=="boolean"?!!m.strictDepth:s.strictDepth,strictMerge:typeof m.strictMerge=="boolean"?!!m.strictMerge:s.strictMerge,strictNullHandling:typeof m.strictNullHandling=="boolean"?m.strictNullHandling:s.strictNullHandling,throwOnLimitExceeded:typeof m.throwOnLimitExceeded=="boolean"?m.throwOnLimitExceeded:!1}};return Hc=function(d,m){var g=f(m);if(d===""||d===null||typeof d>"u")return g.plainObjects?{__proto__:null}:{};for(var b=typeof d=="string"?h(d,g):d,_=g.plainObjects?{__proto__:null}:{},M=Object.keys(b),v=0;v",'"',"`"," ","\r",` `," "],o=["{","}","|","\\","^","`"].concat(r),a=["'"].concat(o),h=["%","/","?",";","#"].concat(a),l=["/","?","#"],c=255,u=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,d={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=$w();function _(y,I,E){if(y&&typeof y=="object"&&y instanceof e)return y;var C=new e;return C.parse(y,I,E),C}e.prototype.parse=function(y,I,E){if(typeof y!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof y);var C=y.indexOf("?"),R=C!==-1&&C127?Z+="x":Z+=H[ae];if(!Z.match(u)){var _e=z.slice(0,P),te=z.slice(P+1),ve=H.match(f);ve&&(_e.push(ve[1]),te.unshift(ve[2])),te.length&&(F="/"+te.join(".")+F),this.hostname=_e.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),q||(this.hostname=i.toASCII(this.hostname));var $=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+$,this.href+=this.host,q&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),F[0]!=="/"&&(F="/"+F))}if(!d[j])for(var P=0,ne=a.length;P0?E.host.split("@"):!1;Z&&(E.auth=Z.shift(),E.hostname=Z.shift(),E.host=E.hostname)}return E.search=y.search,E.query=y.query,(E.pathname!==null||E.search!==null)&&(E.path=(E.pathname?E.pathname:"")+(E.search?E.search:"")),E.href=E.format(),E}if(!z.length)return E.pathname=null,E.search?E.path="/"+E.search:E.path=null,E.href=E.format(),E;for(var ae=z.slice(-1)[0],me=(E.host||y.host||z.length>1)&&(ae==="."||ae==="..")||ae==="",_e=0,te=z.length;te>=0;te--)ae=z[te],ae==="."?z.splice(te,1):ae===".."?(z.splice(te,1),_e++):_e&&(z.splice(te,1),_e--);if(!Y&&!q)for(;_e--;_e)z.unshift("..");Y&&z[0]!==""&&(!z[0]||z[0].charAt(0)!=="/")&&z.unshift(""),me&&z.join("/").substr(-1)!=="/"&&z.push("");var ve=z[0]===""||z[0]&&z[0].charAt(0)==="/";if(H){E.hostname=ve?"":z.length?z.shift():"",E.host=E.hostname;var Z=E.host&&E.host.indexOf("@")>0?E.host.split("@"):!1;Z&&(E.auth=Z.shift(),E.hostname=Z.shift(),E.host=E.hostname)}return Y=Y||E.host&&z.length,Y&&!ve&&z.unshift(""),z.length>0?E.pathname=z.join("/"):(E.pathname=null,E.path=null),(E.pathname!==null||E.search!==null)&&(E.path=(E.pathname?E.pathname:"")+(E.search?E.search:"")),E.auth=y.auth||E.auth,E.slashes=E.slashes||y.slashes,E.href=E.format(),E},e.prototype.parseHost=function(){var y=this.host,I=s.exec(y);I&&(I=I[0],I!==":"&&(this.port=I.substr(1)),y=y.substr(0,y.length-I.length)),y&&(this.hostname=y)},rr.parse=_,rr.resolve=v,rr.resolveObject=S,rr.format=M,rr.Url=e,rr}Gw();const om={};function pt(i,e,t=3){if(om[e])return;let s=new Error().stack;typeof s>"u"?console.warn("PixiJS Deprecation Warning: ",`${e} Deprecated since v${i}`):(s=s.split(` `).splice(t).join(` `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${e} Deprecated since v${i}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e} Deprecated since v${i}`),console.warn(s))),om[e]=!0}function ts(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function ko(i){return i.split("?")[0].split("#")[0]}function jw(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hw(i,e,t){return i.replace(new RegExp(jw(e),"g"),t)}function Ww(i,e){let t="",s=0,n=-1,r=0,o=-1;for(let a=0;a<=i.length;++a){if(a2){const h=t.lastIndexOf("/");if(h!==t.length-1){h===-1?(t="",s=0):(t=t.slice(0,h),s=t.length-1-t.lastIndexOf("/")),n=a,r=0;continue}}else if(t.length===2||t.length===1){t="",s=0,n=a,r=0;continue}}}else t.length>0?t+=`/${i.slice(n+1,a)}`:t=i.slice(n+1,a),s=a-n-1;n=a,r=0}else o===46&&r!==-1?++r:r=-1}return t}const zt={toPosix(i){return Hw(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){ts(i),i=this.toPosix(i);const e=/^file:\/\/\//.exec(i);if(e)return e[0];const t=/^[^/:]+:\/{0,2}/.exec(i);return t?t[0]:""},toAbsolute(i,e,t){if(ts(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=ko(this.toPosix(e??Ve.ADAPTER.getBaseUrl())),n=ko(this.toPosix(t??this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?zt.join(n,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(ts(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let e="";const t=i.startsWith("/");this.hasProtocol(i)&&(e=this.rootname(i),i=i.slice(e.length));const s=i.endsWith("/");return i=Ww(i),i.length>0&&s&&(i+="/"),t?`/${i}`:e+i},isAbsolute(i){return ts(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){if(i.length===0)return".";let e;for(let t=0;t0)if(e===void 0)e=s;else{const n=i[t-1]??"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${s}`:e+=`/${s}`}}return e===void 0?".":this.normalize(e)},dirname(i){if(ts(i),i.length===0)return".";i=this.toPosix(i);let e=i.charCodeAt(0);const t=e===47;let s=-1,n=!0;const r=this.getProtocol(i),o=i;i=i.slice(r.length);for(let a=i.length-1;a>=1;--a)if(e=i.charCodeAt(a),e===47){if(!n){s=a;break}}else n=!1;return s===-1?t?"/":this.isUrl(o)?r+i:r:t&&s===1?"//":r+i.slice(0,s)},rootname(i){ts(i),i=this.toPosix(i);let e="";if(i.startsWith("/")?e="/":e=this.getProtocol(i),this.isUrl(i)){const t=i.indexOf("/",e.length);t!==-1?e=i.slice(0,t):e=i,e.endsWith("/")||(e+="/")}return e},basename(i,e){ts(i),e&&ts(e),i=ko(this.toPosix(i));let t=0,s=-1,n=!0,r;if(e!==void 0&&e.length>0&&e.length<=i.length){if(e.length===i.length&&e===i)return"";let o=e.length-1,a=-1;for(r=i.length-1;r>=0;--r){const h=i.charCodeAt(r);if(h===47){if(!n){t=r+1;break}}else a===-1&&(n=!1,a=r+1),o>=0&&(h===e.charCodeAt(o)?--o===-1&&(s=r):(o=-1,s=a))}return t===s?s=a:s===-1&&(s=i.length),i.slice(t,s)}for(r=i.length-1;r>=0;--r)if(i.charCodeAt(r)===47){if(!n){t=r+1;break}}else s===-1&&(n=!1,s=r+1);return s===-1?"":i.slice(t,s)},extname(i){ts(i),i=ko(this.toPosix(i));let e=-1,t=0,s=-1,n=!0,r=0;for(let o=i.length-1;o>=0;--o){const a=i.charCodeAt(o);if(a===47){if(!n){t=o+1;break}continue}s===-1&&(n=!1,s=o+1),a===46?e===-1?e=o:r!==1&&(r=1):e!==-1&&(r=-1)}return e===-1||s===-1||r===0||r===1&&e===s-1&&e===t+1?"":i.slice(e,s)},parse(i){ts(i);const e={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return e;i=ko(this.toPosix(i));let t=i.charCodeAt(0);const s=this.isAbsolute(i);let n;e.root=this.rootname(i),s||this.hasProtocol(i)?n=1:n=0;let r=-1,o=0,a=-1,h=!0,l=i.length-1,c=0;for(;l>=n;--l){if(t=i.charCodeAt(l),t===47){if(!h){o=l+1;break}continue}a===-1&&(h=!1,a=l+1),t===46?r===-1?r=l:c!==1&&(c=1):r!==-1&&(c=-1)}return r===-1||a===-1||c===0||c===1&&r===a-1&&r===o+1?a!==-1&&(o===0&&s?e.base=e.name=i.slice(1,a):e.base=e.name=i.slice(o,a)):(o===0&&s?(e.name=i.slice(1,r),e.base=i.slice(1,a)):(e.name=i.slice(o,r),e.base=i.slice(o,a)),e.ext=i.slice(r,a)),e.dir=this.dirname(i),e},sep:"/",delimiter:":",joinExtensions:[".html"]};let zc;async function zw(){return zc??(zc=(async()=>{var r;const i=document.createElement("canvas").getContext("webgl");if(!i)return ui.UNPACK;const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return ui.UNPACK;const t=i.createTexture();i.bindTexture(i.TEXTURE_2D,t);const s=i.createFramebuffer();i.bindFramebuffer(i.FRAMEBUFFER,s),i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,t,0),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),i.pixelStorei(i.UNPACK_COLORSPACE_CONVERSION_WEBGL,i.NONE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return i.readPixels(0,0,1,1,i.RGBA,i.UNSIGNED_BYTE,n),i.deleteFramebuffer(s),i.deleteTexture(t),(r=i.getExtension("WEBGL_lose_context"))==null||r.loseContext(),n[0]<=n[3]?ui.PMA:ui.UNPACK})()),zc}let qc;function qw(){return typeof qc>"u"&&(qc=(function(){var e;const i={stencil:!0,failIfMajorPerformanceCaveat:Ve.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Ve.ADAPTER.getWebGLRenderingContext())return!1;const t=Ve.ADAPTER.createCanvas();let s=t.getContext("webgl",i)||t.getContext("experimental-webgl",i);const n=!!((e=s==null?void 0:s.getContextAttributes())!=null&&e.stencil);if(s){const r=s.getExtension("WEBGL_lose_context");r&&r.loseContext()}return s=null,n}catch{return!1}})()),qc}var Kw={grad:.9,turn:360,rad:360/(2*Math.PI)},sn=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},ci=function(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*i)/t+0},qi=function(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),i>t?t:i>e?i:e},K0=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},am=function(i){return{r:qi(i.r,0,255),g:qi(i.g,0,255),b:qi(i.b,0,255),a:qi(i.a)}},Kc=function(i){return{r:ci(i.r),g:ci(i.g),b:ci(i.b),a:ci(i.a,3)}},Zw=/^#([0-9a-f]{3,8})$/i,Ba=function(i){var e=i.toString(16);return e.length<2?"0"+e:e},Z0=function(i){var e=i.r,t=i.g,s=i.b,n=i.a,r=Math.max(e,t,s),o=r-Math.min(e,t,s),a=o?r===e?(t-s)/o:r===t?2+(s-e)/o:4+(e-t)/o:0;return{h:60*(a<0?a+6:a),s:r?o/r*100:0,v:r/255*100,a:n}},J0=function(i){var e=i.h,t=i.s,s=i.v,n=i.a;e=e/360*6,t/=100,s/=100;var r=Math.floor(e),o=s*(1-t),a=s*(1-(e-r)*t),h=s*(1-(1-e+r)*t),l=r%6;return{r:255*[s,a,o,o,h,s][l],g:255*[h,s,s,a,o,o][l],b:255*[o,o,h,s,s,a][l],a:n}},lm=function(i){return{h:K0(i.h),s:qi(i.s,0,100),l:qi(i.l,0,100),a:qi(i.a)}},hm=function(i){return{h:ci(i.h),s:ci(i.s),l:ci(i.l),a:ci(i.a,3)}},cm=function(i){return J0((t=(e=i).s,{h:e.h,s:(t*=((s=e.l)<50?s:100-s)/100)>0?2*t/(s+t)*100:0,v:s+t,a:e.a}));var e,t,s},ia=function(i){return{h:(e=Z0(i)).h,s:(n=(200-(t=e.s))*(s=e.v)/100)>0&&n<200?t*s/100/(n<=100?n:200-n)*100:0,l:n/2,a:e.a};var e,t,s,n},Jw=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qw=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,e_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,t_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Yu={string:[[function(i){var e=Zw.exec(i);return e?(i=e[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?ci(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?ci(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var e=e_.exec(i)||t_.exec(i);return e?e[2]!==e[4]||e[4]!==e[6]?null:am({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(i){var e=Jw.exec(i)||Qw.exec(i);if(!e)return null;var t,s,n=lm({h:(t=e[1],s=e[2],s===void 0&&(s="deg"),Number(t)*(Kw[s]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return cm(n)},"hsl"]],object:[[function(i){var e=i.r,t=i.g,s=i.b,n=i.a,r=n===void 0?1:n;return sn(e)&&sn(t)&&sn(s)?am({r:Number(e),g:Number(t),b:Number(s),a:Number(r)}):null},"rgb"],[function(i){var e=i.h,t=i.s,s=i.l,n=i.a,r=n===void 0?1:n;if(!sn(e)||!sn(t)||!sn(s))return null;var o=lm({h:Number(e),s:Number(t),l:Number(s),a:Number(r)});return cm(o)},"hsl"],[function(i){var e=i.h,t=i.s,s=i.v,n=i.a,r=n===void 0?1:n;if(!sn(e)||!sn(t)||!sn(s))return null;var o=(function(a){return{h:K0(a.h),s:qi(a.s,0,100),v:qi(a.v,0,100),a:qi(a.a)}})({h:Number(e),s:Number(t),v:Number(s),a:Number(r)});return J0(o)},"hsv"]]},um=function(i,e){for(var t=0;t=.5},i.prototype.toHex=function(){return e=Kc(this.rgba),t=e.r,s=e.g,n=e.b,o=(r=e.a)<1?Ba(ci(255*r)):"","#"+Ba(t)+Ba(s)+Ba(n)+o;var e,t,s,n,r,o},i.prototype.toRgb=function(){return Kc(this.rgba)},i.prototype.toRgbString=function(){return e=Kc(this.rgba),t=e.r,s=e.g,n=e.b,(r=e.a)<1?"rgba("+t+", "+s+", "+n+", "+r+")":"rgb("+t+", "+s+", "+n+")";var e,t,s,n,r},i.prototype.toHsl=function(){return hm(ia(this.rgba))},i.prototype.toHslString=function(){return e=hm(ia(this.rgba)),t=e.h,s=e.s,n=e.l,(r=e.a)<1?"hsla("+t+", "+s+"%, "+n+"%, "+r+")":"hsl("+t+", "+s+"%, "+n+"%)";var e,t,s,n,r},i.prototype.toHsv=function(){return e=Z0(this.rgba),{h:ci(e.h),s:ci(e.s),v:ci(e.v),a:ci(e.a,3)};var e},i.prototype.invert=function(){return Ts({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},i.prototype.saturate=function(e){return e===void 0&&(e=.1),Ts(Zc(this.rgba,e))},i.prototype.desaturate=function(e){return e===void 0&&(e=.1),Ts(Zc(this.rgba,-e))},i.prototype.grayscale=function(){return Ts(Zc(this.rgba,-1))},i.prototype.lighten=function(e){return e===void 0&&(e=.1),Ts(dm(this.rgba,e))},i.prototype.darken=function(e){return e===void 0&&(e=.1),Ts(dm(this.rgba,-e))},i.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},i.prototype.alpha=function(e){return typeof e=="number"?Ts({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):ci(this.rgba.a,3);var t},i.prototype.hue=function(e){var t=ia(this.rgba);return typeof e=="number"?Ts({h:e,s:t.s,l:t.l,a:t.a}):ci(t.h)},i.prototype.isEqual=function(e){return this.toHex()===Ts(e).toHex()},i})(),Ts=function(i){return i instanceof $u?i:new $u(i)},fm=[],s_=function(i){i.forEach(function(e){fm.indexOf(e)<0&&(e($u,Yu),fm.push(e))})};function n_(i,e){var t={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var n in t)s[t[n]]=n;var r={};i.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,h,l=s[this.toHex()];if(l)return l;if(o!=null&&o.closest){var c=this.toRgb(),u=1/0,f="black";if(!r.length)for(var d in t)r[d]=new i(t[d]).toRgb();for(var m in t){var g=(a=c,h=r[m],Math.pow(a.r-h.r,2)+Math.pow(a.g-h.g,2)+Math.pow(a.b-h.b,2));gn===t[r]);if(e!==null&&t!==null){const n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?!1:n.every(o=>e[o]===t[o])}return e===t}toRgba(){const[e,t,s,n]=this._components;return{r:e,g:t,b:s,a:n}}toRgb(){const[e,t,s]=this._components;return{r:e,g:t,b:s}}toRgbaString(){const[e,t,s]=this.toUint8RgbArray();return`rgba(${e},${t},${s},${this.alpha})`}toUint8RgbArray(e){const[t,s,n]=this._components;return e=e??[],e[0]=Math.round(t*255),e[1]=Math.round(s*255),e[2]=Math.round(n*255),e}toRgbArray(e){e=e??[];const[t,s,n]=this._components;return e[0]=t,e[1]=s,e[2]=n,e}toNumber(){return this._int}toLittleEndianNumber(){const e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(e){const[t,s,n,r]=fl.temp.setValue(e)._components;return this._components[0]*=t,this._components[1]*=s,this._components[2]*=n,this._components[3]*=r,this.refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let s=this._int>>16&255,n=this._int>>8&255,r=this._int&255;return t&&(s=s*e+.5|0,n=n*e+.5|0,r=r*e+.5|0),(e*255<<24)+(s<<16)+(n<<8)+r}toHex(){const e=this._int.toString(16);return`#${"000000".substring(0,6-e.length)+e}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}round(e){const[t,s,n]=this._components;return this._components[0]=Math.round(t*e)/e,this._components[1]=Math.round(s*e)/e,this._components[2]=Math.round(n*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e=e??[];const[t,s,n,r]=this._components;return e[0]=t,e[1]=s,e[2]=n,e[3]=r,e}normalize(e){let t,s,n,r;if((typeof e=="number"||e instanceof Number)&&e>=0&&e<=16777215){const o=e;t=(o>>16&255)/255,s=(o>>8&255)/255,n=(o&255)/255,r=1}else if((Array.isArray(e)||e instanceof Float32Array)&&e.length>=3&&e.length<=4)e=this._clamp(e),[t,s,n,r=1]=e;else if((e instanceof Uint8Array||e instanceof Uint8ClampedArray)&&e.length>=3&&e.length<=4)e=this._clamp(e,0,255),[t,s,n,r=255]=e,t/=255,s/=255,n/=255,r/=255;else if(typeof e=="string"||typeof e=="object"){if(typeof e=="string"){const a=fl.HEX_PATTERN.exec(e);a&&(e=`#${a[2]}`)}const o=Ts(e);o.isValid()&&({r:t,g:s,b:n,a:r}=o.rgba,t/=255,s/=255,n/=255)}if(t!==void 0)this._components[0]=t,this._components[1]=s,this._components[2]=n,this._components[3]=r,this.refreshInt();else throw new Error(`Unable to convert color ${e}`)}refreshInt(){this._clamp(this._components);const[e,t,s]=this._components;this._int=(e*255<<16)+(t*255<<8)+(s*255|0)}_clamp(e,t=0,s=1){return typeof e=="number"?Math.min(Math.max(e,t),s):(e.forEach((n,r)=>{e[r]=Math.min(Math.max(n,t),s)}),e)}};jr.shared=new jr,jr.temp=new jr,jr.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let At=jr;function r_(i){return pt("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),At.shared.setValue(i).toHex()}function o_(i){return pt("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),At.shared.setValue(i).toNumber()}function a_(){const i=[],e=[];for(let s=0;s<32;s++)i[s]=s,e[s]=s;i[Qe.NORMAL_NPM]=Qe.NORMAL,i[Qe.ADD_NPM]=Qe.ADD,i[Qe.SCREEN_NPM]=Qe.SCREEN,e[Qe.NORMAL]=Qe.NORMAL_NPM,e[Qe.ADD]=Qe.ADD_NPM,e[Qe.SCREEN]=Qe.SCREEN_NPM;const t=[];return t.push(e),t.push(i),t}const Q0=a_();function ev(i,e){return Q0[e?1:0][i]}function l_(i,e=null){const t=i*6;if(e=e||new Uint16Array(t),e.length!==t)throw new Error(`Out buffer length is incorrect, got ${e.length} and expected ${t}`);for(let s=0,n=0;s>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function pm(i){return!(i&i-1)&&!!i}function mm(i){let e=(i>65535?1:0)<<4;i>>>=e;let t=(i>255?1:0)<<3;return i>>>=t,e|=t,t=(i>15?1:0)<<2,i>>>=t,e|=t,t=(i>3?1:0)<<1,i>>>=t,e|=t,e|i>>1}function ao(i,e,t){const s=i.length;let n;if(e>=s||t===0)return;t=e+t>s?s-e:t;const r=s-t;for(n=e;n(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(Oe||{});const ju=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){if(!i.extension)throw new Error("Extension class must have an extension object");i={...typeof i.extension!="object"?{type:i.extension}:i.extension,ref:i}}if(typeof i=="object")i={...i};else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},bm=(i,e)=>ju(i).priority??e,He={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(ju).forEach(e=>{e.type.forEach(t=>{var s,n;return(n=(s=this._removeHandlers)[t])==null?void 0:n.call(s,e)})}),this},add(...i){return i.map(ju).forEach(e=>{e.type.forEach(t=>{var r,o;const s=this._addHandlers,n=this._queue;s[t]?(r=s[t])==null||r.call(s,e):(n[t]=n[t]||[],(o=n[t])==null||o.push(e))})}),this},handle(i,e,t){var o;const s=this._addHandlers,n=this._removeHandlers;if(s[i]||n[i])throw new Error(`Extension type ${i} already has a handler`);s[i]=e,n[i]=t;const r=this._queue;return r[i]&&((o=r[i])==null||o.forEach(a=>e(a)),delete r[i]),this},handleByMap(i,e){return this.handle(i,t=>{t.name&&(e[t.name]=t.ref)},t=>{t.name&&delete e[t.name]})},handleByList(i,e,t=-1){return this.handle(i,s=>{e.includes(s.ref)||(e.push(s.ref),e.sort((n,r)=>bm(r,t)-bm(n,t)))},s=>{const n=e.indexOf(s.ref);n!==-1&&e.splice(n,1)})}};class Hu{constructor(e){typeof e=="number"?this.rawBinaryData=new ArrayBuffer(e):e instanceof Uint8Array?this.rawBinaryData=e.buffer:this.rawBinaryData=e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(e){switch(e){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${e} isn't a valid view type`)}}}const p_=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` `);function m_(i){let e="";for(let t=0;t0&&(e+=` else `),t=0;--s){const n=Wu[s];if(n.test&&n.test(i,t))return new n(i,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class ds{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,s,n,r,o,a,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:c}=this;this._aliasCount++;for(let u=0,f=c.length;u0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this}remove(e){const t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this}contains(e){return this.items.includes(e)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(ds.prototype,{dispatch:{value:ds.prototype.emit},run:{value:ds.prototype.emit}});class fa{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new ds("setRealSize"),this.onUpdate=new ds("update"),this.onError=new ds("onError")}bind(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)}resize(e,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(e,t,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(e,t){return!1}}class Ch extends fa{constructor(e,t){const{width:s,height:n}=t||{};if(!s||!n)throw new Error("BufferResource width or height invalid");super(s,n),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,s){const n=e.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,this.unpackAlignment),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===ui.UNPACK);const r=t.realWidth,o=t.realHeight;return s.width===r&&s.height===o?n.texSubImage2D(t.target,0,0,0,r,o,t.format,s.type,this.data):(s.width=r,s.height=o,n.texImage2D(t.target,0,s.internalFormat,r,o,0,t.format,s.type,this.data)),!0}dispose(){this.data=null}static test(e){return e===null||e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}}const v_={scaleMode:as.NEAREST,alphaMode:ui.NPM},zu=class Hr extends Sa{constructor(e=null,t=null){super(),t=Object.assign({},Hr.defaultOptions,t);const{alphaMode:s,mipmap:n,anisotropicLevel:r,scaleMode:o,width:a,height:h,wrapMode:l,format:c,type:u,target:f,resolution:d,resourceOptions:m}=t;e&&!(e instanceof fa)&&(e=iv(e,m),e.internal=!0),this.resolution=d||Ve.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=n,this.anisotropicLevel=r,this._wrapMode=l,this._scaleMode=o,this.format=c,this.type=u,this.target=f,this.alphaMode=s,this.uid=_r(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(e)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)}setStyle(e,t){let s;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,s=!0),t!==void 0&&t!==this.mipmap&&(this.mipmap=t,s=!0),s&&this.dirtyStyleId++,this}setSize(e,t,s){return s=s||this.resolution,this.setRealSize(e*s,t*s,s)}setRealSize(e,t,s){return this.resolution=s||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=pm(this.realWidth)&&pm(this.realHeight)}setResolution(e){const t=this.resolution;return t===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/e,this.emit("update",this)),this._refreshPOT(),this)}setResource(e){if(this.resource===e)return this;if(this.resource)throw new Error("Resource can be set only once");return e.bind(this),this.resource=e,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(e){this.emit("error",this,e)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete In[this.cacheId],delete Ms[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),Hr.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(e,t,s=Ve.STRICT_TEXTURE_CACHE){const n=typeof e=="string";let r=null;if(n)r=e;else{if(!e._pixiId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${a}_${_r()}`}r=e._pixiId}let o=In[r];if(n&&s&&!o)throw new Error(`The cacheId "${r}" does not exist in BaseTextureCache.`);return o||(o=new Hr(e,t),o.cacheId=r,Hr.addToCache(o,r)),o}static fromBuffer(e,t,s,n){e=e||new Float32Array(t*s*4);const r=new Ch(e,{width:t,height:s,...n==null?void 0:n.resourceOptions});let o,a;return e instanceof Float32Array?(o=Re.RGBA,a=je.FLOAT):e instanceof Int32Array?(o=Re.RGBA_INTEGER,a=je.INT):e instanceof Uint32Array?(o=Re.RGBA_INTEGER,a=je.UNSIGNED_INT):e instanceof Int16Array?(o=Re.RGBA_INTEGER,a=je.SHORT):e instanceof Uint16Array?(o=Re.RGBA_INTEGER,a=je.UNSIGNED_SHORT):e instanceof Int8Array?(o=Re.RGBA,a=je.BYTE):(o=Re.RGBA,a=je.UNSIGNED_BYTE),r.internal=!0,new Hr(r,Object.assign({},v_,{type:a,format:o},n))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),In[t]&&In[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),In[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=In[e];if(t){const s=t.textureCacheIds.indexOf(e);return s>-1&&t.textureCacheIds.splice(s,1),delete In[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;t1){for(let u=0;u(i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(pi||{});class bt{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new bt(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}}bt.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};const La=[new bt,new bt,new bt,new bt];class lt{constructor(e=0,t=0,s=0,n=0){this.x=Number(e),this.y=Number(t),this.width=Number(s),this.height=Number(n),this.type=pi.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new lt(0,0,0,0)}clone(){return new lt(this.x,this.y,this.width,this.height)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e=this.y&&te.right?e.right:this.right)<=C)return!1;const R=this.ye.bottom?e.bottom:this.bottom)>R}const s=this.left,n=this.right,r=this.top,o=this.bottom;if(n<=s||o<=r)return!1;const a=La[0].set(e.left,e.top),h=La[1].set(e.left,e.bottom),l=La[2].set(e.right,e.top),c=La[3].set(e.right,e.bottom);if(l.x<=a.x||h.y<=a.y)return!1;const u=Math.sign(t.a*t.d-t.b*t.c);if(u===0||(t.apply(a,a),t.apply(h,h),t.apply(l,l),t.apply(c,c),Math.max(a.x,h.x,l.x,c.x)<=s||Math.min(a.x,h.x,l.x,c.x)>=n||Math.max(a.y,h.y,l.y,c.y)<=r||Math.min(a.y,h.y,l.y,c.y)>=o))return!1;const f=u*(h.y-a.y),d=u*(a.x-h.x),m=f*s+d*r,g=f*n+d*r,b=f*s+d*o,_=f*n+d*o;if(Math.max(m,g,b,_)<=f*a.x+d*a.y||Math.min(m,g,b,_)>=f*c.x+d*c.y)return!1;const M=u*(a.y-l.y),v=u*(l.x-a.x),S=M*s+v*r,y=M*n+v*r,I=M*s+v*o,E=M*n+v*o;return!(Math.max(S,y,I,E)<=M*a.x+v*a.y||Math.min(S,y,I,E)>=M*c.x+v*c.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){const t=Math.max(this.x,e.x),s=Math.min(this.x+this.width,e.x+e.width),n=Math.max(this.y,e.y),r=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(s-t,0),this.y=n,this.height=Math.max(r-n,0),this}ceil(e=1,t=.001){const s=Math.ceil((this.x+this.width-t)*e)/e,n=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=s-this.x,this.height=n-this.y,this}enlarge(e){const t=Math.min(this.x,e.x),s=Math.max(this.x+this.width,e.x+e.width),n=Math.min(this.y,e.y),r=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=s-t,this.y=n,this.height=r-n,this}}lt.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class Ih{constructor(e=0,t=0,s=0){this.x=e,this.y=t,this.radius=s,this.type=pi.CIRC}clone(){return new Ih(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;const s=this.radius*this.radius;let n=this.x-e,r=this.y-t;return n*=n,r*=r,n+r<=s}getBounds(){return new lt(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}Ih.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};class Rh{constructor(e=0,t=0,s=0,n=0){this.x=e,this.y=t,this.width=s,this.height=n,this.type=pi.ELIP}clone(){return new Rh(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let s=(e-this.x)/this.width,n=(t-this.y)/this.height;return s*=s,n*=n,s+n<=1}getBounds(){return new lt(this.x-this.width,this.y-this.height,this.width,this.height)}}Rh.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};class vr{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){const s=[];for(let n=0,r=t.length;nt!=c>t&&e<(l-a)*((t-h)/(c-h))+a&&(s=!s)}return s}}vr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((i,e)=>`${i}, ${e}`,"")}]`};class Ph{constructor(e=0,t=0,s=0,n=0,r=20){this.x=e,this.y=t,this.width=s,this.height=n,this.radius=r,this.type=pi.RREC}clone(){return new Ph(this.x,this.y,this.width,this.height,this.radius)}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+s&&t<=this.y+this.height-s||e>=this.x+s&&e<=this.x+this.width-s)return!0;let n=e-(this.x+s),r=t-(this.y+s);const o=s*s;if(n*n+r*r<=o||(n=e-(this.x+this.width-s),n*n+r*r<=o)||(r=t-(this.y+this.height-s),n*n+r*r<=o)||(n=e-(this.x+s),n*n+r*r<=o))return!0}return!1}}Ph.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};class Vt{constructor(e=1,t=0,s=0,n=1,r=0,o=0){this.array=null,this.a=e,this.b=t,this.c=s,this.d=n,this.tx=r,this.ty=o}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,s,n,r,o){return this.a=e,this.b=t,this.c=s,this.d=n,this.tx=r,this.ty=o,this}toArray(e,t){this.array||(this.array=new Float32Array(9));const s=t||this.array;return e?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(e,t){t=t||new bt;const s=e.x,n=e.y;return t.x=this.a*s+this.c*n+this.tx,t.y=this.b*s+this.d*n+this.ty,t}applyInverse(e,t){t=t||new bt;const s=1/(this.a*this.d+this.c*-this.b),n=e.x,r=e.y;return t.x=this.d*s*n+-this.c*s*r+(this.ty*this.c-this.tx*this.d)*s,t.y=this.a*s*r+-this.b*s*n+(-this.ty*this.a+this.tx*this.b)*s,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){const t=Math.cos(e),s=Math.sin(e),n=this.a,r=this.c,o=this.tx;return this.a=n*t-this.b*s,this.b=n*s+this.b*t,this.c=r*t-this.d*s,this.d=r*s+this.d*t,this.tx=o*t-this.ty*s,this.ty=o*s+this.ty*t,this}append(e){const t=this.a,s=this.b,n=this.c,r=this.d;return this.a=e.a*t+e.b*n,this.b=e.a*s+e.b*r,this.c=e.c*t+e.d*n,this.d=e.c*s+e.d*r,this.tx=e.tx*t+e.ty*n+this.tx,this.ty=e.tx*s+e.ty*r+this.ty,this}setTransform(e,t,s,n,r,o,a,h,l){return this.a=Math.cos(a+l)*r,this.b=Math.sin(a+l)*r,this.c=-Math.sin(a-h)*o,this.d=Math.cos(a-h)*o,this.tx=e-(s*this.a+n*this.c),this.ty=t-(s*this.b+n*this.d),this}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const s=this.a,n=this.c;this.a=s*e.a+this.b*e.c,this.b=s*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){const t=this.a,s=this.b,n=this.c,r=this.d,o=e.pivot,a=-Math.atan2(-n,r),h=Math.atan2(s,t),l=Math.abs(a+h);return l<1e-5||Math.abs(Ol-l)<1e-5?(e.rotation=h,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=h),e.scale.x=Math.sqrt(t*t+s*s),e.scale.y=Math.sqrt(n*n+r*r),e.position.x=this.tx+(o.x*t+o.y*n),e.position.y=this.ty+(o.x*s+o.y*r),e}invert(){const e=this.a,t=this.b,s=this.c,n=this.d,r=this.tx,o=e*n-t*s;return this.a=n/o,this.b=-t/o,this.c=-s/o,this.d=e/o,this.tx=(s*this.ty-n*r)/o,this.ty=-(e*this.ty-t*r)/o,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const e=new Vt;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyTo(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}static get IDENTITY(){return new Vt}static get TEMP_MATRIX(){return new Vt}}Vt.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};const hr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],cr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ur=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],dr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ku=[],nv=[],Da=Math.sign;function M_(){for(let i=0;i<16;i++){const e=[];Ku.push(e);for(let t=0;t<16;t++){const s=Da(hr[i]*hr[t]+ur[i]*cr[t]),n=Da(cr[i]*hr[t]+dr[i]*cr[t]),r=Da(hr[i]*ur[t]+ur[i]*dr[t]),o=Da(cr[i]*ur[t]+dr[i]*dr[t]);for(let a=0;a<16;a++)if(hr[a]===s&&cr[a]===n&&ur[a]===r&&dr[a]===o){e.push(a);break}}}for(let i=0;i<16;i++){const e=new Vt;e.set(hr[i],cr[i],ur[i],dr[i],0,0),nv.push(e)}}M_();const Gt={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>hr[i],uY:i=>cr[i],vX:i=>ur[i],vY:i=>dr[i],inv:i=>i&8?i&15:-i&7,add:(i,e)=>Ku[i][e],sub:(i,e)=>Ku[i][Gt.inv(e)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,e)=>Math.abs(i)*2<=Math.abs(e)?e>=0?Gt.S:Gt.N:Math.abs(e)*2<=Math.abs(i)?i>0?Gt.E:Gt.W:e>0?i>0?Gt.SE:Gt.SW:i>0?Gt.NE:Gt.NW,matrixAppendRotationInv:(i,e,t=0,s=0)=>{const n=nv[Gt.inv(e)];n.tx=t,n.ty=s,i.append(n)}};class fn{constructor(e,t,s=0,n=0){this._x=s,this._y=n,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new fn(e,t,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))}}fn.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};const Zu=class{constructor(){this.worldTransform=new Vt,this.localTransform=new Vt,this.position=new fn(this.onChange,this,0,0),this.scale=new fn(this.onChange,this,1,1),this.pivot=new fn(this.onChange,this,0,0),this.skew=new fn(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const i=this.localTransform;this._localID!==this._currentLocalID&&(i.a=this._cx*this.scale.x,i.b=this._sx*this.scale.x,i.c=this._cy*this.scale.y,i.d=this._sy*this.scale.y,i.tx=this.position.x-(this.pivot.x*i.a+this.pivot.y*i.c),i.ty=this.position.y-(this.pivot.x*i.b+this.pivot.y*i.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(i){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==i._worldID){const t=i.worldTransform,s=this.worldTransform;s.a=e.a*t.a+e.b*t.c,s.b=e.a*t.b+e.b*t.d,s.c=e.c*t.a+e.d*t.c,s.d=e.c*t.b+e.d*t.d,s.tx=e.tx*t.a+e.ty*t.c+t.tx,s.ty=e.tx*t.b+e.ty*t.d+t.ty,this._parentID=i._worldID,this._worldID++}}setFromMatrix(i){i.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(i){this._rotation!==i&&(this._rotation=i,this.updateSkew())}};Zu.IDENTITY=new Zu;let ef=Zu;ef.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var E_=`varying vec2 vTextureCoord; uniform sampler2D uSampler; void main(void){ gl_FragColor *= texture2D(uSampler, vTextureCoord); }`,A_=`attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; uniform mat3 projectionMatrix; varying vec2 vTextureCoord; void main(void){ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = aTextureCoord; } `;function _m(i,e,t){const s=i.createShader(e);return i.shaderSource(s,t),i.compileShader(s),s}function ru(i){const e=new Array(i);for(let t=0;ti.type==="float"&&i.size===1&&!i.isArray,code:i=>` if(uv["${i}"] !== ud["${i}"].value) { ud["${i}"].value = uv["${i}"] gl.uniform1f(ud["${i}"].location, uv["${i}"]) } `},{test:(i,e)=>(i.type==="sampler2D"||i.type==="samplerCube"||i.type==="sampler2DArray")&&i.size===1&&!i.isArray&&(e==null||e.castToBaseTexture!==void 0),code:i=>`t = syncData.textureCount++; renderer.texture.bind(uv["${i}"], t); if(ud["${i}"].value !== t) { ud["${i}"].value = t; gl.uniform1i(ud["${i}"].location, t); ; // eslint-disable-line max-len }`},{test:(i,e)=>i.type==="mat3"&&i.size===1&&!i.isArray&&e.a!==void 0,code:i=>` gl.uniformMatrix3fv(ud["${i}"].location, false, uv["${i}"].toArray(true)); `,codeUbo:i=>` var ${i}_matrix = uv.${i}.toArray(true); data[offset] = ${i}_matrix[0]; data[offset+1] = ${i}_matrix[1]; data[offset+2] = ${i}_matrix[2]; data[offset + 4] = ${i}_matrix[3]; data[offset + 5] = ${i}_matrix[4]; data[offset + 6] = ${i}_matrix[5]; data[offset + 8] = ${i}_matrix[6]; data[offset + 9] = ${i}_matrix[7]; data[offset + 10] = ${i}_matrix[8]; `},{test:(i,e)=>i.type==="vec2"&&i.size===1&&!i.isArray&&e.x!==void 0,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v.x || cv[1] !== v.y) { cv[0] = v.x; cv[1] = v.y; gl.uniform2f(ud["${i}"].location, v.x, v.y); }`,codeUbo:i=>` v = uv.${i}; data[offset] = v.x; data[offset+1] = v.y; `},{test:i=>i.type==="vec2"&&i.size===1&&!i.isArray,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2f(ud["${i}"].location, v[0], v[1]); } `},{test:(i,e)=>i.type==="vec4"&&i.size===1&&!i.isArray&&e.width!==void 0,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) { cv[0] = v.x; cv[1] = v.y; cv[2] = v.width; cv[3] = v.height; gl.uniform4f(ud["${i}"].location, v.x, v.y, v.width, v.height) }`,codeUbo:i=>` v = uv.${i}; data[offset] = v.x; data[offset+1] = v.y; data[offset+2] = v.width; data[offset+3] = v.height; `},{test:(i,e)=>i.type==="vec4"&&i.size===1&&!i.isArray&&e.red!==void 0,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) { cv[0] = v.red; cv[1] = v.green; cv[2] = v.blue; cv[3] = v.alpha; gl.uniform4f(ud["${i}"].location, v.red, v.green, v.blue, v.alpha) }`,codeUbo:i=>` v = uv.${i}; data[offset] = v.red; data[offset+1] = v.green; data[offset+2] = v.blue; data[offset+3] = v.alpha; `},{test:(i,e)=>i.type==="vec3"&&i.size===1&&!i.isArray&&e.red!==void 0,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a) { cv[0] = v.red; cv[1] = v.green; cv[2] = v.blue; gl.uniform3f(ud["${i}"].location, v.red, v.green, v.blue) }`,codeUbo:i=>` v = uv.${i}; data[offset] = v.red; data[offset+1] = v.green; data[offset+2] = v.blue; `},{test:i=>i.type==="vec4"&&i.size===1&&!i.isArray,code:i=>` cv = ud["${i}"].value; v = uv["${i}"]; if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3]) }`}],C_={float:` if (cv !== v) { cu.value = v; gl.uniform1f(location, v); }`,vec2:` if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2f(location, v[0], v[1]) }`,vec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3f(location, v[0], v[1], v[2]) }`,vec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4f(location, v[0], v[1], v[2], v[3]); }`,int:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,ivec2:` if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2i(location, v[0], v[1]); }`,ivec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3i(location, v[0], v[1], v[2]); }`,ivec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4i(location, v[0], v[1], v[2], v[3]); }`,uint:` if (cv !== v) { cu.value = v; gl.uniform1ui(location, v); }`,uvec2:` if (cv[0] !== v[0] || cv[1] !== v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2ui(location, v[0], v[1]); }`,uvec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3ui(location, v[0], v[1], v[2]); }`,uvec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4ui(location, v[0], v[1], v[2], v[3]); }`,bool:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,bvec2:` if (cv[0] != v[0] || cv[1] != v[1]) { cv[0] = v[0]; cv[1] = v[1]; gl.uniform2i(location, v[0], v[1]); }`,bvec3:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; gl.uniform3i(location, v[0], v[1], v[2]); }`,bvec4:` if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { cv[0] = v[0]; cv[1] = v[1]; cv[2] = v[2]; cv[3] = v[3]; gl.uniform4i(location, v[0], v[1], v[2], v[3]); }`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,samplerCube:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`,sampler2DArray:` if (cv !== v) { cu.value = v; gl.uniform1i(location, v); }`},I_={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function R_(i,e){var s;const t=[` var v = null; var cv = null; var cu = null; var t = 0; var gl = renderer.gl; `];for(const n in i.uniforms){const r=e[n];if(!r){((s=i.uniforms[n])==null?void 0:s.group)===!0&&(i.uniforms[n].ubo?t.push(` renderer.shader.syncUniformBufferGroup(uv.${n}, '${n}'); `):t.push(` renderer.shader.syncUniformGroup(uv.${n}, syncData); `));continue}const o=i.uniforms[n];let a=!1;for(let h=0;h=Cr.WEBGL2&&(e=i.getContext("webgl2",{})),e||(e=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),Dr=e}return Dr}let Na;function k_(){if(!Na){Na=zi.MEDIUM;const i=P_();if(i&&i.getShaderPrecisionFormat){const e=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);e&&(Na=e.precision?zi.HIGH:zi.MEDIUM)}}return Na}function Sm(i,e){const t=i.getShaderSource(e).split(` `).map((l,c)=>`${c}: ${l}`),s=i.getShaderInfoLog(e),n=s.split(` `),r={},o=n.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!r[l]?(r[l]=!0,!0):!1),a=[""];o.forEach(l=>{t[l-1]=`%c${t[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=t.join(` `);a[0]=h,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function F_(i,e,t,s){i.getProgramParameter(e,i.LINK_STATUS)||(i.getShaderParameter(t,i.COMPILE_STATUS)||Sm(i,t),i.getShaderParameter(s,i.COMPILE_STATUS)||Sm(i,s),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(e)))}const O_={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function av(i){return O_[i]}let Ua=null;const Tm={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function lv(i,e){if(!Ua){const t=Object.keys(Tm);Ua={};for(let s=0;s0&&(t+=` else `),sthis.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)}buildTexturesAndDrawCalls(){const{_bufferedTextures:e,maxTextures:t}=this,s=ns._textureArrayPool,n=this.renderer.batch,r=this._tempBoundTextures,o=this.renderer.textureGC.count;let a=++st._globalBatch,h=0,l=s[0],c=0;n.copyBoundTextures(r,t);for(let u=0;u=t&&(n.boundArray(l,r,a,t),this.buildDrawCalls(l,c,u),c=u,l=s[++h],++a),f._batchEnabled=a,f.touched=o,l.elements[l.count++]=f)}l.count>0&&(n.boundArray(l,r,a,t),this.buildDrawCalls(l,c,this._bufferSize),++h,++a);for(let u=0;u0);for(let g=0;g=0;--n)e[n]=s[n]||null,e[n]&&(e[n]._batchLocation=n)}boundArray(e,t,s,n){const{elements:r,ids:o,count:a}=e;let h=0;for(let l=0;l=0&&u=Cr.WEBGL2&&(s=e.getContext("webgl2",t)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:e}=this,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc"),bptc:e.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})}handleContextLost(e){e.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const e=this.renderer.view;this.renderer=null,e.removeEventListener!==void 0&&(e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(e){const t=e.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const n=s||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=n,n||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Ll.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},Ll.extension={type:Oe.RendererSystem,name:"context"};He.add(Ll);class td{constructor(e,t){if(this.width=Math.round(e),this.height=Math.round(t),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new ds("disposeFramebuffer"),this.multisample=ei.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new st(null,{scaleMode:as.NEAREST,resolution:1,mipmap:Ki.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new st(null,{scaleMode:as.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ki.OFF,format:Re.DEPTH_COMPONENT,type:je.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(e,t){if(e=Math.round(e),t=Math.round(t),!e||!t)throw new Error("Framebuffer width and height must not be zero");if(!(e===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(let s=0;s{const n=this.source;this.url=n.src;const r=()=>{this.destroyed||(n.onload=null,n.onerror=null,this.update(),this._load=null,this.createBitmap?t(this.process()):t(this))};n.complete&&n.src?r():(n.onload=r,n.onerror=o=>{s(o),this.onError.emit(o)})}),this._load)}process(){const e=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const t=globalThis.createImageBitmap,s=!e.crossOrigin||e.crossOrigin==="anonymous";return this._process=fetch(e.src,{mode:s?"cors":"no-cors"}).then(n=>n.blob()).then(n=>t(n,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ui.UNPACK?"premultiply":"none"})).then(n=>this.destroyed?Promise.reject():(this.bitmap=n,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,t,s){if(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,s,this.bitmap),!this.preserveBitmap){let n=!0;const r=t._glTextures;for(const o in r){const a=r[o];if(a!==s&&a.dirtyId!==t.dirtyId){n=!1;break}}n&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(e){return typeof HTMLImageElement<"u"&&(typeof e=="string"||e instanceof HTMLImageElement)}}class tf{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(e,t,s){const n=t.width,r=t.height;if(s){const o=e.width/2/n,a=e.height/2/r,h=e.x/n+o,l=e.y/r+a;s=Gt.add(s,Gt.NW),this.x0=h+o*Gt.uX(s),this.y0=l+a*Gt.uY(s),s=Gt.add(s,2),this.x1=h+o*Gt.uX(s),this.y1=l+a*Gt.uY(s),s=Gt.add(s,2),this.x2=h+o*Gt.uX(s),this.y2=l+a*Gt.uY(s),s=Gt.add(s,2),this.x3=h+o*Gt.uX(s),this.y3=l+a*Gt.uY(s)}else this.x0=e.x/n,this.y0=e.y/r,this.x1=(e.x+e.width)/n,this.y1=e.y/r,this.x2=(e.x+e.width)/n,this.y2=(e.y+e.height)/r,this.x3=e.x/n,this.y3=(e.y+e.height)/r;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}tf.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};const Am=new tf;function Xa(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}let et=class Bt extends Sa{constructor(e,t,s,n,r,o,a){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new lt(0,0,1,1)),e instanceof Bt&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=n,this.valid=!1,this.destroyed=!1,this._uvs=Am,this.uvMatrix=null,this.orig=s||t,this._rotate=Number(r||0),r===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=o?new bt(o.x,o.y):new bt(0,0),this.defaultBorders=a,this._updateID=0,this.textureCacheIds=[],e.valid?this.noFrame?e.valid&&this.onBaseTextureUpdated(e):this.frame=t:e.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&e.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(e){if(this.baseTexture){if(e){const{resource:t}=this.baseTexture;t!=null&&t.url&&Ms[t.url]&&Bt.removeFromCache(t.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,Bt.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var n;const e=this._frame.clone(),t=this._frame===this.orig?e:this.orig.clone(),s=new Bt(this.baseTexture,!this.noFrame&&e,t,(n=this.trim)==null?void 0:n.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(s._frame=e),s}updateUvs(){this._uvs===Am&&(this._uvs=new tf),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},s=Ve.STRICT_TEXTURE_CACHE){const n=typeof e=="string";let r=null;if(n)r=e;else if(e instanceof st){if(!e.cacheId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e.cacheId=`${a}-${_r()}`,st.addToCache(e,e.cacheId)}r=e.cacheId}else{if(!e._pixiId){const a=(t==null?void 0:t.pixiIdPrefix)||"pixiid";e._pixiId=`${a}_${_r()}`}r=e._pixiId}let o=Ms[r];if(n&&s&&!o)throw new Error(`The cacheId "${r}" does not exist in TextureCache.`);return!o&&!(e instanceof st)?(t.resolution||(t.resolution=_n(e)),o=new Bt(new st(e,t)),o.baseTexture.cacheId=r,st.addToCache(o.baseTexture,r),Bt.addToCache(o,r)):!o&&e instanceof st&&(o=new Bt(e),Bt.addToCache(o,r)),o}static fromURL(e,t){const s=Object.assign({autoLoad:!1},t==null?void 0:t.resourceOptions),n=Bt.from(e,Object.assign({resourceOptions:s},t),!1),r=n.baseTexture.resource;return n.baseTexture.valid?Promise.resolve(n):r.load().then(()=>Promise.resolve(n))}static fromBuffer(e,t,s,n){return new Bt(st.fromBuffer(e,t,s,n))}static fromLoader(e,t,s,n){const r=new st(e,Object.assign({scaleMode:st.defaultOptions.scaleMode,resolution:_n(t)},n)),{resource:o}=r;o instanceof dv&&(o.url=t);const a=new Bt(r);return s||(s=t),st.addToCache(a.baseTexture,s),Bt.addToCache(a,s),s!==t&&(st.addToCache(a.baseTexture,t),Bt.addToCache(a,t)),a.baseTexture.valid?Promise.resolve(a):new Promise(h=>{a.baseTexture.once("loaded",()=>h(a))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),Ms[t]&&Ms[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),Ms[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=Ms[e];if(t){const s=t.textureCacheIds.indexOf(e);return s>-1&&t.textureCacheIds.splice(s,1),delete Ms[e],t}}else if(e!=null&&e.textureCacheIds){for(let t=0;tthis.baseTexture.width,a=s+r>this.baseTexture.height;if(o||a){const h=o&&a?"and":"or",l=`X: ${t} + ${n} = ${t+n} > ${this.baseTexture.width}`,c=`Y: ${s} + ${r} = ${s+r} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${c}`)}this.valid=n&&r&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(e){this._rotate=e,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return Bt._EMPTY||(Bt._EMPTY=new Bt(new st),Xa(Bt._EMPTY),Xa(Bt._EMPTY.baseTexture)),Bt._EMPTY}static get WHITE(){if(!Bt._WHITE){const e=Ve.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),Bt._WHITE=new Bt(st.from(e)),Xa(Bt._WHITE),Xa(Bt._WHITE.baseTexture)}return Bt._WHITE}};class Ir extends et{constructor(e,t){super(e,t),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t,s=!0){const n=this.baseTexture.resolution,r=Math.round(e*n)/n,o=Math.round(t*n)/n;this.valid=r>0&&o>0,this._frame.width=this.orig.width=r,this._frame.height=this.orig.height=o,s&&this.baseTexture.resize(r,o),this.updateUvs()}setResolution(e){const{baseTexture:t}=this;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))}static create(e){return new Ir(new uv(e))}}class fv{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,s=ei.NONE){const n=new uv(Object.assign({width:e,height:t,resolution:1,multisample:s},this.textureOptions));return new Ir(n)}getOptimalTexture(e,t,s=1,n=ei.NONE){let r;e=Math.max(Math.ceil(e*s-1e-6),1),t=Math.max(Math.ceil(t*s-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=kl(e),t=kl(t),r=((e&65535)<<16|t&65535)>>>0,n>1&&(r+=n*4294967296)):r=n>1?-n:-1,this.texturePool[r]||(this.texturePool[r]=[]);let o=this.texturePool[r].pop();return o||(o=this.createTexture(e,t,n)),o.filterPoolKey=r,o.setResolution(s),o}getFilterTexture(e,t,s){const n=this.getOptimalTexture(e.width,e.height,t||e.resolution,s||ei.NONE);return n.filterFrame=e.filterFrame,n}returnTexture(e){const t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)}returnFilterTexture(e){this.returnTexture(e)}clear(e){if(e=e!==!1,e)for(const t in this.texturePool){const s=this.texturePool[t];if(s)for(let n=0;n0&&e.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const s=this.texturePool[t];if(s)for(let n=0;n1&&(c=this.getOptimalFilterTexture(l.width,l.height,t.resolution),c.filterFrame=l.filterFrame),s[u].apply(this,l,c,Ls.CLEAR,t);const f=l;l=c,c=f}s[u].apply(this,l,h.renderTexture,Ls.BLEND,t),u>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=Ls.CLEAR){const{renderTexture:s,state:n}=this.renderer;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e==null?void 0:e.filterFrame){const o=this.tempRect;o.x=0,o.y=0,o.width=e.filterFrame.width,o.height=e.filterFrame.height,s.bind(e,e.filterFrame,o)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const r=n.stateId&1||this.forceClear;(t===Ls.CLEAR||t===Ls.BLIT&&r)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,s,n){const r=this.renderer;r.state.set(e.state),this.bindAndClear(s,n),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,r.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),r.geometry.bind(this.quadUv),r.geometry.draw(Us.TRIANGLES)):(r.geometry.bind(this.quad),r.geometry.draw(Us.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){const{sourceFrame:s,destinationFrame:n}=this.activeState,{orig:r}=t._texture,o=e.set(n.width,0,0,n.height,s.x,s.y),a=t.worldTransform.copyTo(Vt.TEMP_MATRIX);return a.invert(),o.prepend(a),o.scale(1/r.width,1/r.height),o.translate(t.anchor.x,t.anchor.y),o}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,s=1,n=ei.NONE){return this.texturePool.getOptimalTexture(e,t,s,n)}getFilterTexture(e,t,s){if(typeof e=="number"){const r=e;e=t,t=r}e=e||this.activeState.renderTexture;const n=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,s||ei.NONE);return n.filterFrame=e.filterFrame,n}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,t){const s=Ya[0],n=Ya[1],r=Ya[2],o=Ya[3];s.set(t.left,t.top),n.set(t.left,t.bottom),r.set(t.right,t.top),o.set(t.right,t.bottom),e.apply(s,s),e.apply(n,n),e.apply(r,r),e.apply(o,o);const a=Math.min(s.x,n.x,r.x,o.x),h=Math.min(s.y,n.y,r.y,o.y),l=Math.max(s.x,n.x,r.x,o.x),c=Math.max(s.y,n.y,r.y,o.y);t.x=a,t.y=h,t.width=l-a,t.height=c-h}roundFrame(e,t,s,n,r){if(!(e.width<=0||e.height<=0||s.width<=0||s.height<=0)){if(r){const{a:o,b:a,c:h,d:l}=r;if((Math.abs(a)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(l)>1e-4))return}r=r?ou.copyFrom(r):ou.identity(),r.translate(-s.x,-s.y).scale(n.width/s.width,n.height/s.height).translate(n.x,n.y),this.transformAABB(r,e),e.ceil(t),this.transformAABB(r.invert(),e)}}}mv.extension={type:Oe.RendererSystem,name:"filter"};He.add(mv);class H_{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ei.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const W_=new lt;class gv{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new td(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new lt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;Ve.PREFER_ENV===Cr.WEBGL_LEGACY&&(t=null,s=null),t?e.drawBuffers=n=>t.drawBuffersWEBGL(n):(this.hasMRT=!1,e.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,s=0){const{gl:n}=this;if(e){const r=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,n.bindFramebuffer(n.FRAMEBUFFER,r.framebuffer)),r.mipLevel!==s&&(e.dirtyId++,e.dirtyFormat++,r.mipLevel=s),r.dirtyId!==e.dirtyId&&(r.dirtyId=e.dirtyId,r.dirtyFormat!==e.dirtyFormat?(r.dirtyFormat=e.dirtyFormat,r.dirtySize=e.dirtySize,this.updateFramebuffer(e,s)):r.dirtySize!==e.dirtySize&&(r.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(let o=0;o>s,a=t.height>>s,h=o/t.width;this.setViewport(t.x*h,t.y*h,o,a)}else{const o=e.width>>s,a=e.height>>s;this.setViewport(0,0,o,a)}}else this.current&&(this.current=null,n.bindFramebuffer(n.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(e,t,s,n){const r=this.viewport;e=Math.round(e),t=Math.round(t),s=Math.round(s),n=Math.round(n),(r.width!==s||r.height!==n||r.x!==e||r.y!==t)&&(r.x=e,r.y=t,r.width=s,r.height=n,this.gl.viewport(e,t,s,n))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(e,t,s,n,r=Xu.COLOR|Xu.DEPTH){const{gl:o}=this;o.clearColor(e,t,s,n),o.clear(r)}initFramebuffer(e){const{gl:t}=this,s=new H_(t.createFramebuffer());return s.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(e),e.disposeRunner.add(this),s}resizeFramebuffer(e){const{gl:t}=this,s=e.glFramebuffers[this.CONTEXT_UID];if(s.stencil){t.bindRenderbuffer(t.RENDERBUFFER,s.stencil);let o;this.renderer.context.webGLVersion===1?o=t.DEPTH_STENCIL:e.depth&&e.stencil?o=t.DEPTH24_STENCIL8:e.depth?o=t.DEPTH_COMPONENT24:o=t.STENCIL_INDEX8,s.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,s.multisample,o,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,o,e.width,e.height)}const n=e.colorTextures;let r=n.length;t.drawBuffers||(r=Math.min(r,1));for(let o=0;o1&&this.canMultisampleFramebuffer(e)?n.msaaBuffer=n.msaaBuffer||s.createRenderbuffer():n.msaaBuffer&&(s.deleteRenderbuffer(n.msaaBuffer),n.msaaBuffer=null,n.blitFramebuffer&&(n.blitFramebuffer.dispose(),n.blitFramebuffer=null));const a=[];for(let h=0;h1&&s.drawBuffers(a),e.depthTexture&&this.writeDepthTexture){const h=e.depthTexture;this.renderer.texture.bind(h,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,t)}if((e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)){n.stencil=n.stencil||s.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):e.depth&&e.stencil?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):e.depth?(h=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(h=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,n.stencil),n.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,n.multisample,l,e.width,e.height):s.renderbufferStorage(s.RENDERBUFFER,l,e.width,e.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,h,s.RENDERBUFFER,n.stencil)}else n.stencil&&(s.deleteRenderbuffer(n.stencil),n.stencil=null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){const{msaaSamples:t}=this;let s=ei.NONE;if(e<=1||t===null)return s;for(let n=0;n=0&&this.managedFramebuffers.splice(r,1),e.disposeRunner.remove(this),t||(n.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&n.deleteRenderbuffer(s.msaaBuffer),s.stencil&&n.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,t)}disposeAll(e){const t=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;ss.createVertexArrayOES(),e.bindVertexArray=n=>s.bindVertexArrayOES(n),e.deleteVertexArray=n=>s.deleteVertexArrayOES(n)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(t.webGLVersion!==2){const s=e.getExtension("ANGLE_instanced_arrays");s?(e.vertexAttribDivisor=(n,r)=>s.vertexAttribDivisorANGLE(n,r),e.drawElementsInstanced=(n,r,o,a,h)=>s.drawElementsInstancedANGLE(n,r,o,a,h),e.drawArraysInstanced=(n,r,o,a)=>s.drawArraysInstancedANGLE(n,r,o,a)):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t=t||this.renderer.shader.shader;const{gl:s}=this;let n=e.glVertexArrayObjects[this.CONTEXT_UID],r=!1;n||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=n={},r=!0);const o=n[t.program.id]||this.initGeometryVao(e,t,r);this._activeGeometry=e,this._activeVao!==o&&(this._activeVao=o,this.hasVao?s.bindVertexArray(o):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const e=this._activeGeometry,t=this.renderer.buffer;for(let s=0;s"u"?.5:t,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,t){t===void 0&&(t=e);const s=this.mapCoord;for(let n=0;n0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==t&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}destroy(){this.renderer=null}}yv.extension={type:Oe.RendererSystem,name:"mask"};He.add(yv);class xv{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){const{gl:t}=this.renderer,s=this.getStackLength();this.maskStack=e;const n=this.getStackLength();n!==s&&(n===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Im=new Vt,Rm=[],bv=class pl extends xv{constructor(e){super(e),this.glConst=Ve.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0}calcScissorRect(e){if(e._scissorRectLocal)return;const t=e._scissorRect,{maskObject:s}=e,{renderer:n}=this,r=n.renderTexture,o=s.getBounds(!0,Rm.pop()??new lt);this.roundFrameToPixels(o,r.current?r.current.resolution:n.resolution,r.sourceFrame,r.destinationFrame,n.projection.transform),t&&o.fit(t),e._scissorRectLocal=o}static isMatrixRotated(e){if(!e)return!1;const{a:t,b:s,c:n,d:r}=e;return(Math.abs(s)>1e-4||Math.abs(n)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(r)>1e-4)}testScissor(e){const{maskObject:t}=e;if(!t.isFastRect||!t.isFastRect()||pl.isMatrixRotated(t.worldTransform)||pl.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(e);const s=e._scissorRectLocal;return s.width>0&&s.height>0}roundFrameToPixels(e,t,s,n,r){pl.isMatrixRotated(r)||(r=r?Im.copyFrom(r):Im.identity(),r.translate(-s.x,-s.y).scale(n.width/s.width,n.height/s.height).translate(n.x,n.y),this.renderer.filter.transformAABB(r,e),e.fit(n),e.x=Math.round(e.x*t),e.y=Math.round(e.y*t),e.width=Math.round(e.width*t),e.height=Math.round(e.height*t))}push(e){e._scissorRectLocal||this.calcScissorRect(e);const{gl:t}=this.renderer;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()}pop(e){const{gl:t}=this.renderer;e&&Rm.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)}_useCurrent(){const e=this.maskStack[this.maskStack.length-1]._scissorRect;let t;this.renderer.renderTexture.current?t=e.y:t=this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,t,e.width,e.height)}};bv.extension={type:Oe.RendererSystem,name:"scissor"};let J_=bv;He.add(J_);class wv extends xv{constructor(e){super(e),this.glConst=Ve.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0}push(e){const t=e.maskObject,{gl:s}=this.renderer,n=e._stencilCounter;n===0&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),e._stencilCounter++;const r=e._colorMask;r!==0&&(e._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,n,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(e._colorMask=r,s.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)),this._useCurrent()}pop(e){const t=this.renderer.gl;if(this.getStackLength()===0)t.disable(t.STENCIL_TEST);else{const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,n=s?s._colorMask:15;n!==0&&(s._colorMask=0,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(s._colorMask=n,t.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}}_useCurrent(){const e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)}}wv.extension={type:Oe.RendererSystem,name:"stencil"};He.add(wv);class _v{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return pt("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return pt("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return pt("7.0.0","renderer.plugins.interaction has been deprecated, use renderer.events"),e.events}}})}init(){const e=this.rendererPlugins;for(const t in e)this.plugins[t]=new e[t](this.renderer)}destroy(){for(const e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}}_v.extension={type:[Oe.RendererSystem,Oe.CanvasRendererSystem],name:"_plugin"};He.add(_v);class Sv{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Vt,this.transform=null}update(e,t,s,n){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,n),this.transform&&this.projectionMatrix.append(this.transform);const r=this.renderer;r.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,r.globalUniforms.update(),r.shader.shader&&r.shader.syncUniformGroup(r.shader.shader.uniforms.globals)}calculateProjection(e,t,s,n){const r=this.projectionMatrix,o=n?-1:1;r.identity(),r.a=1/t.width*2,r.d=o*(1/t.height*2),r.tx=-1-t.x*r.a,r.ty=-o-t.y*r.d}setTransform(e){}destroy(){this.renderer=null}}Sv.extension={type:Oe.RendererSystem,name:"projection"};He.add(Sv);const Q_=new ef,Pm=new lt;class Tv{constructor(e){this.renderer=e,this._tempMatrix=new Vt}generateTexture(e,t){const{region:s,...n}=t||{},r=(s==null?void 0:s.copyTo(Pm))||e.getLocalBounds(Pm,!0),o=n.resolution||this.renderer.resolution;r.width=Math.max(r.width,1/o),r.height=Math.max(r.height,1/o),n.width=r.width,n.height=r.height,n.resolution=o,n.multisample??(n.multisample=this.renderer.multisample);const a=Ir.create(n);this._tempMatrix.tx=-r.x,this._tempMatrix.ty=-r.y;const h=e.transform;return e.transform=Q_,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=h,a}destroy(){}}Tv.extension={type:[Oe.RendererSystem,Oe.CanvasRendererSystem],name:"textureGenerator"};He.add(Tv);const or=new lt,Oo=new lt;class Mv{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new lt,this.destinationFrame=new lt,this.viewportFrame=new lt}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,t,s){const n=this.renderer;this.current=e;let r,o,a;e?(r=e.baseTexture,a=r.resolution,t||(or.width=e.frame.width,or.height=e.frame.height,t=or),s||(Oo.x=e.frame.x,Oo.y=e.frame.y,Oo.width=t.width,Oo.height=t.height,s=Oo),o=r.framebuffer):(a=n.resolution,t||(or.width=n._view.screen.width,or.height=n._view.screen.height,t=or),s||(s=or,s.width=t.width,s.height=t.height));const h=this.viewportFrame;h.x=s.x*a,h.y=s.y*a,h.width=s.width*a,h.height=s.height*a,e||(h.y=n.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(o,h),this.renderer.projection.update(s,t,a,!o),e?this.renderer.mask.setMaskStack(r.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(s)}clear(e,t){const s=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,n=At.shared.setValue(e||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&n.premultiply(n.alpha);const r=this.destinationFrame,o=this.current?this.current.baseTexture:this.renderer._view.screen,a=r.width!==o.width||r.height!==o.height;if(a){let{x:h,y:l,width:c,height:u}=this.viewportFrame;h=Math.round(h),l=Math.round(l),c=Math.round(c),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,c,u)}this.renderer.framebuffer.clear(n.red,n.green,n.blue,n.alpha,t),a&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}Mv.extension={type:Oe.RendererSystem,name:"renderTexture"};He.add(Mv);class eS{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function tS(i,e){const t={},s=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let n=0;nl>c?1:-1);for(let l=0;l({data:r,offset:0,dataLen:0,dirty:0}));let t=0,s=0,n=0;for(let r=0;r1&&(t=Math.max(t,16)*o.data.size),o.dataLen=t,s%t!==0&&s<16){const a=s%t%16;s+=a,n+=a}s+t>16?(n=Math.ceil(n/16)*16,o.offset=n,n+=t,s=t):(o.offset=n,s+=t,n+=t)}return n=Math.ceil(n/16)*16,{uboElements:e,size:n}}function aS(i,e){const t=[];for(const s in i)e[s]&&t.push(e[s]);return t.sort((s,n)=>s.index-n.index),t}function lS(i,e){if(!i.autoManage)return{size:0,syncFunc:nS};const t=aS(i.uniforms,e),{uboElements:s,size:n}=oS(t),r=[` var v = null; var v2 = null; var cv = null; var t = 0; var gl = renderer.gl var index = 0; var data = buffer.data; `];for(let o=0;o1){const u=av(a.data.type),f=Math.max(Ev[a.data.type]/16,1),d=u/f,m=(4-d%4)%4;r.push(` cv = ud.${l}.value; v = uv.${l}; offset = ${a.offset/4}; t = 0; for(var i=0; i < ${a.data.size*f}; i++) { for(var j = 0; j < ${d}; j++) { data[offset++] = v[t++]; } offset += ${m}; } `)}else{const u=rS[a.data.type];r.push(` cv = ud.${l}.value; v = uv.${l}; offset = ${a.offset/4}; ${u}; `)}}return r.push(` renderer.buffer.update(buffer); `),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",r.join(` `))}}let hS=0;const $a={textureCount:0,uboCount:0};class Av{constructor(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=hS++}systemCheck(){if(!B_())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(e){this.gl=e,this.reset()}bind(e,t){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;const s=e.program,n=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==s&&(this.program=s,this.gl.useProgram(n.program)),t||($a.textureCount=0,$a.uboCount=0,this.syncUniformGroup(e.uniformGroup,$a)),n}setUniforms(e){const t=this.shader.program,s=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(s.uniformData,e,this.renderer)}syncUniformGroup(e,t){const s=this.getGlProgram();(!e.static||e.dirtyId!==s.uniformDirtyGroups[e.id])&&(s.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,s,t))}syncUniforms(e,t,s){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,s)}createSyncGroups(e){const t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=R_(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){const s=this.getGlProgram();if(!e.static||e.dirtyId!==0||!s.uniformGroups[e.id]){e.dirtyId=0;const n=s.uniformGroups[e.id]||this.createSyncBufferGroup(e,s,t);e.buffer.update(),n(s.uniformData,e.uniforms,this.renderer,$a,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,s.uniformBufferBindings[t])}createSyncBufferGroup(e,t,s){const{gl:n}=this.renderer;this.renderer.buffer.bind(e.buffer);const r=this.gl.getUniformBlockIndex(t.program,s);t.uniformBufferBindings[s]=this.shader.uniformBindCount,n.uniformBlockBinding(t.program,r,this.shader.uniformBindCount),this.shader.uniformBindCount++;const o=this.getSignature(e,this.shader.program.uniformData,"ubo");let a=this._uboCache[o];if(a||(a=this._uboCache[o]=lS(e,this.shader.program.uniformData)),e.autoManage){const h=new Float32Array(a.size/4);e.buffer.update(h)}return t.uniformGroups[e.id]=a.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,s){const n=e.uniforms,r=[`${s}-`];for(const o in n)r.push(o),t[o]&&r.push(t[o].type);return r.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){const t=this.gl,s=e.program,n=sS(t,s);return s.glPrograms[this.renderer.CONTEXT_UID]=n,n}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}Av.extension={type:Oe.RendererSystem,name:"shader"};He.add(Av);class Dl{constructor(e){this.renderer=e}run(e){const{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.4.3 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}}Dl.defaultOptions={hello:!1},Dl.extension={type:[Oe.RendererSystem,Oe.CanvasRendererSystem],name:"startup"};He.add(Dl);function cS(i,e=[]){return e[Qe.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.ADD]=[i.ONE,i.ONE],e[Qe.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.NONE]=[0,0],e[Qe.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],e[Qe.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Qe.SRC_IN]=[i.DST_ALPHA,i.ZERO],e[Qe.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],e[Qe.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],e[Qe.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],e[Qe.DST_IN]=[i.ZERO,i.SRC_ALPHA],e[Qe.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],e[Qe.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],e[Qe.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],e[Qe.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],e}const uS=0,dS=1,fS=2,pS=3,mS=4,gS=5,Cv=class id{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Qe.NONE,this._blendEq=!1,this.map=[],this.map[uS]=this.setBlend,this.map[dS]=this.setOffset,this.map[fS]=this.setCullFace,this.map[pS]=this.setDepthTest,this.map[mS]=this.setFrontFace,this.map[gS]=this.setDepthMask,this.checks=[],this.defaultState=new zs,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=cS(e),this.set(this.defaultState),this.reset()}set(e){if(e=e||this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,s=0;for(;t;)t&1&&this.map[s].call(this,!!(e.data&1<>1,s++;this.stateId=e.data}for(let t=0;te.systems[n]),s=[...t,...Object.keys(e.systems).filter(n=>!t.includes(n))];for(const n of s)this.addSystem(e.systems[n],n)}addRunners(...e){e.forEach(t=>{this.runners[t]=new ds(t)})}addSystem(e,t){const s=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=s,this._systemsHash[t]=s;for(const n in this.runners)this.runners[n].add(s);return this}emitWithCustomOptions(e,t){const s=Object.keys(this._systemsHash);e.items.forEach(n=>{const r=s.find(o=>this._systemsHash[o]===n);n[e.name](t[r])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}}const jo=class ml{constructor(e){this.renderer=e,this.count=0,this.checkCount=0,this.maxIdle=ml.defaultMaxIdle,this.checkCountMax=ml.defaultCheckCountMax,this.mode=ml.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Kd.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const e=this.renderer.texture,t=e.managedTextures;let s=!1;for(let n=0;nthis.maxIdle&&(e.destroyTexture(r,!0),t[n]=null,s=!0)}if(s){let n=0;for(let r=0;r=0;n--)this.unload(e.children[n])}destroy(){this.renderer=null}};jo.defaultMode=Kd.AUTO,jo.defaultMaxIdle=3600,jo.defaultCheckCountMax=600,jo.extension={type:Oe.RendererSystem,name:"textureGC"};let fr=jo;He.add(fr);class lu{constructor(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=je.UNSIGNED_BYTE,this.internalFormat=Re.RGBA,this.samplerType=0}}function xS(i){let e;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?e={[i.RGB]:Xe.FLOAT,[i.RGBA]:Xe.FLOAT,[i.ALPHA]:Xe.FLOAT,[i.LUMINANCE]:Xe.FLOAT,[i.LUMINANCE_ALPHA]:Xe.FLOAT,[i.R8]:Xe.FLOAT,[i.R8_SNORM]:Xe.FLOAT,[i.RG8]:Xe.FLOAT,[i.RG8_SNORM]:Xe.FLOAT,[i.RGB8]:Xe.FLOAT,[i.RGB8_SNORM]:Xe.FLOAT,[i.RGB565]:Xe.FLOAT,[i.RGBA4]:Xe.FLOAT,[i.RGB5_A1]:Xe.FLOAT,[i.RGBA8]:Xe.FLOAT,[i.RGBA8_SNORM]:Xe.FLOAT,[i.RGB10_A2]:Xe.FLOAT,[i.RGB10_A2UI]:Xe.FLOAT,[i.SRGB8]:Xe.FLOAT,[i.SRGB8_ALPHA8]:Xe.FLOAT,[i.R16F]:Xe.FLOAT,[i.RG16F]:Xe.FLOAT,[i.RGB16F]:Xe.FLOAT,[i.RGBA16F]:Xe.FLOAT,[i.R32F]:Xe.FLOAT,[i.RG32F]:Xe.FLOAT,[i.RGB32F]:Xe.FLOAT,[i.RGBA32F]:Xe.FLOAT,[i.R11F_G11F_B10F]:Xe.FLOAT,[i.RGB9_E5]:Xe.FLOAT,[i.R8I]:Xe.INT,[i.R8UI]:Xe.UINT,[i.R16I]:Xe.INT,[i.R16UI]:Xe.UINT,[i.R32I]:Xe.INT,[i.R32UI]:Xe.UINT,[i.RG8I]:Xe.INT,[i.RG8UI]:Xe.UINT,[i.RG16I]:Xe.INT,[i.RG16UI]:Xe.UINT,[i.RG32I]:Xe.INT,[i.RG32UI]:Xe.UINT,[i.RGB8I]:Xe.INT,[i.RGB8UI]:Xe.UINT,[i.RGB16I]:Xe.INT,[i.RGB16UI]:Xe.UINT,[i.RGB32I]:Xe.INT,[i.RGB32UI]:Xe.UINT,[i.RGBA8I]:Xe.INT,[i.RGBA8UI]:Xe.UINT,[i.RGBA16I]:Xe.INT,[i.RGBA16UI]:Xe.UINT,[i.RGBA32I]:Xe.INT,[i.RGBA32UI]:Xe.UINT,[i.DEPTH_COMPONENT16]:Xe.FLOAT,[i.DEPTH_COMPONENT24]:Xe.FLOAT,[i.DEPTH_COMPONENT32F]:Xe.FLOAT,[i.DEPTH_STENCIL]:Xe.FLOAT,[i.DEPTH24_STENCIL8]:Xe.FLOAT,[i.DEPTH32F_STENCIL8]:Xe.FLOAT}:e={[i.RGB]:Xe.FLOAT,[i.RGBA]:Xe.FLOAT,[i.ALPHA]:Xe.FLOAT,[i.LUMINANCE]:Xe.FLOAT,[i.LUMINANCE_ALPHA]:Xe.FLOAT,[i.DEPTH_STENCIL]:Xe.FLOAT},e}function bS(i){let e;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?e={[je.UNSIGNED_BYTE]:{[Re.RGBA]:i.RGBA8,[Re.RGB]:i.RGB8,[Re.RG]:i.RG8,[Re.RED]:i.R8,[Re.RGBA_INTEGER]:i.RGBA8UI,[Re.RGB_INTEGER]:i.RGB8UI,[Re.RG_INTEGER]:i.RG8UI,[Re.RED_INTEGER]:i.R8UI,[Re.ALPHA]:i.ALPHA,[Re.LUMINANCE]:i.LUMINANCE,[Re.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[je.BYTE]:{[Re.RGBA]:i.RGBA8_SNORM,[Re.RGB]:i.RGB8_SNORM,[Re.RG]:i.RG8_SNORM,[Re.RED]:i.R8_SNORM,[Re.RGBA_INTEGER]:i.RGBA8I,[Re.RGB_INTEGER]:i.RGB8I,[Re.RG_INTEGER]:i.RG8I,[Re.RED_INTEGER]:i.R8I},[je.UNSIGNED_SHORT]:{[Re.RGBA_INTEGER]:i.RGBA16UI,[Re.RGB_INTEGER]:i.RGB16UI,[Re.RG_INTEGER]:i.RG16UI,[Re.RED_INTEGER]:i.R16UI,[Re.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[je.SHORT]:{[Re.RGBA_INTEGER]:i.RGBA16I,[Re.RGB_INTEGER]:i.RGB16I,[Re.RG_INTEGER]:i.RG16I,[Re.RED_INTEGER]:i.R16I},[je.UNSIGNED_INT]:{[Re.RGBA_INTEGER]:i.RGBA32UI,[Re.RGB_INTEGER]:i.RGB32UI,[Re.RG_INTEGER]:i.RG32UI,[Re.RED_INTEGER]:i.R32UI,[Re.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[je.INT]:{[Re.RGBA_INTEGER]:i.RGBA32I,[Re.RGB_INTEGER]:i.RGB32I,[Re.RG_INTEGER]:i.RG32I,[Re.RED_INTEGER]:i.R32I},[je.FLOAT]:{[Re.RGBA]:i.RGBA32F,[Re.RGB]:i.RGB32F,[Re.RG]:i.RG32F,[Re.RED]:i.R32F,[Re.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[je.HALF_FLOAT]:{[Re.RGBA]:i.RGBA16F,[Re.RGB]:i.RGB16F,[Re.RG]:i.RG16F,[Re.RED]:i.R16F},[je.UNSIGNED_SHORT_5_6_5]:{[Re.RGB]:i.RGB565},[je.UNSIGNED_SHORT_4_4_4_4]:{[Re.RGBA]:i.RGBA4},[je.UNSIGNED_SHORT_5_5_5_1]:{[Re.RGBA]:i.RGB5_A1},[je.UNSIGNED_INT_2_10_10_10_REV]:{[Re.RGBA]:i.RGB10_A2,[Re.RGBA_INTEGER]:i.RGB10_A2UI},[je.UNSIGNED_INT_10F_11F_11F_REV]:{[Re.RGB]:i.R11F_G11F_B10F},[je.UNSIGNED_INT_5_9_9_9_REV]:{[Re.RGB]:i.RGB9_E5},[je.UNSIGNED_INT_24_8]:{[Re.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[je.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[Re.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:e={[je.UNSIGNED_BYTE]:{[Re.RGBA]:i.RGBA,[Re.RGB]:i.RGB,[Re.ALPHA]:i.ALPHA,[Re.LUMINANCE]:i.LUMINANCE,[Re.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[je.UNSIGNED_SHORT_5_6_5]:{[Re.RGB]:i.RGB},[je.UNSIGNED_SHORT_4_4_4_4]:{[Re.RGBA]:i.RGBA},[je.UNSIGNED_SHORT_5_5_5_1]:{[Re.RGBA]:i.RGBA}},e}class Iv{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new st,this.hasIntegerTextures=!1}contextChange(){const e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=bS(e),this.samplerTypes=xS(e);const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let n=0;n=0;--r){const o=t[r];o&&o._glTextures[n].samplerType!==Xe.FLOAT&&this.renderer.texture.unbind(o)}}initTexture(e){const t=new lu(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t}initTextureType(e,t){var s;t.internalFormat=((s=this.internalFormats[e.type])==null?void 0:s[e.format])??e.format,t.samplerType=this.samplerTypes[t.internalFormat]??Xe.FLOAT,this.webGLVersion===2&&e.type===je.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){var n;const t=e._glTextures[this.CONTEXT_UID];if(!t)return;const s=this.renderer;if(this.initTextureType(e,t),(n=e.resource)==null?void 0:n.upload(s,e,t))t.samplerType!==Xe.FLOAT&&(this.hasIntegerTextures=!0);else{const r=e.realWidth,o=e.realHeight,a=s.gl;(t.width!==r||t.height!==o||t.dirtyId<0)&&(t.width=r,t.height=o,a.texImage2D(e.target,0,t.internalFormat,r,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){const{gl:s}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),s.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){const n=this.managedTextures.indexOf(e);n!==-1&&ao(this.managedTextures,n,1)}}updateTextureStyle(e){var s;const t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Ki.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=us.CLAMP:t.wrapMode=e.wrapMode,(s=e.resource)!=null&&s.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){const s=this.gl;if(t.mipmap&&e.mipmap!==Ki.ON_MANUAL&&s.generateMipmap(e.target),s.texParameteri(e.target,s.TEXTURE_WRAP_S,t.wrapMode),s.texParameteri(e.target,s.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){s.texParameteri(e.target,s.TEXTURE_MIN_FILTER,e.scaleMode===as.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===as.LINEAR){const r=Math.min(e.anisotropicLevel,s.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,r)}}else s.texParameteri(e.target,s.TEXTURE_MIN_FILTER,e.scaleMode===as.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(e.target,s.TEXTURE_MAG_FILTER,e.scaleMode===as.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}Iv.extension={type:Oe.RendererSystem,name:"texture"};He.add(Iv);class Rv{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){const{gl:t,CONTEXT_UID:s}=this,n=e._glTransformFeedbacks[s]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,n)}unbind(){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){const{gl:s,renderer:n}=this;t&&n.shader.bind(t),s.beginTransformFeedback(e)}endTransformFeedback(){const{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){const{gl:t,renderer:s,CONTEXT_UID:n}=this,r=t.createTransformFeedback();e._glTransformFeedbacks[n]=r,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,r);for(let o=0;o(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(Sr||{});class hu{constructor(e,t=null,s=0,n=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=s,this.once=n}match(e,t=null){return this.fn===e&&this.context===t}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));const t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const t=this.next;return this.next=e?null:t,this.previous=null,t}}const Pv=class Li{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new hu(null,null,1/0),this.deltaMS=1/Li.targetFPMS,this.elapsedMS=1/Li.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(e,t,s=Sr.NORMAL){return this._addListener(new hu(e,t,s))}addOnce(e,t,s=Sr.NORMAL){return this._addListener(new hu(e,t,s,!0))}_addListener(e){let t=this._head.next,s=this._head;if(!t)e.connect(s);else{for(;t;){if(e.priority>t.priority){e.connect(s);break}s=t,t=t.next}e.previous||e.connect(s)}return this._startIfPossible(),this}remove(e,t){let s=this._head.next;for(;s;)s.match(e,t)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(e=performance.now()){let t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){const r=e-this._lastFrame|0;if(r{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Ei.shared:new Ei,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}kv.extension=Oe.Application;He.add(kv);const Fv=[];He.handleByList(Oe.Renderer,Fv);function wS(i){for(const e of Fv)if(e.test(i))return new e(i);throw new Error("Unable to auto-detect a suitable renderer.")}var _S=`attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; uniform mat3 projectionMatrix; varying vec2 vTextureCoord; void main(void) { gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = aTextureCoord; }`,SS=`attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; varying vec2 vTextureCoord; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } vec2 filterTextureCoord( void ) { return aVertexPosition * (outputFrame.zw * inputSize.zw); } void main(void) { gl_Position = filterVertexPosition(); vTextureCoord = filterTextureCoord(); } `;const TS=_S,Ov=SS;class Bv{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){const s=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,s)}else{const s=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,s)}t>=ei.HIGH?this.multisample=ei.HIGH:t>=ei.MEDIUM?this.multisample=ei.MEDIUM:t>=ei.LOW?this.multisample=ei.LOW:this.multisample=ei.NONE}destroy(){}}Bv.extension={type:Oe.RendererSystem,name:"_multisample"};He.add(Bv);class MS{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class Lv{constructor(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){const{gl:t,CONTEXT_UID:s}=this,n=e._glBuffers[s]||this.createGLBuffer(e);t.bindBuffer(e.type,n.buffer)}unbind(e){const{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){const{gl:s,CONTEXT_UID:n}=this;if(this.boundBufferBases[t]!==e){const r=e._glBuffers[n]||this.createGLBuffer(e);this.boundBufferBases[t]=e,s.bindBufferBase(s.UNIFORM_BUFFER,t,r.buffer)}}bindBufferRange(e,t,s){const{gl:n,CONTEXT_UID:r}=this;s=s||0;const o=e._glBuffers[r]||this.createGLBuffer(e);n.bindBufferRange(n.UNIFORM_BUFFER,t||0,o.buffer,s*256,256)}update(e){const{gl:t,CONTEXT_UID:s}=this,n=e._glBuffers[s]||this.createGLBuffer(e);if(e._updateID!==n.updateID)if(n.updateID=e._updateID,t.bindBuffer(e.type,n.buffer),n.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{const r=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;n.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,r)}}dispose(e,t){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];const s=e._glBuffers[this.CONTEXT_UID],n=this.gl;e.disposeRunner.remove(this),s&&(t||n.deleteBuffer(s.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){const t=Object.keys(this.managedBuffers);for(let s=0;st.resource).filter(t=>t).map(t=>t.load());return this._load=Promise.all(e).then(()=>{const{realWidth:t,realHeight:s}=this.items[0];return this.resize(t,s),this.update(),Promise.resolve(this)}),this._load}}class ES extends Nv{constructor(e,t){const{width:s,height:n}=t||{};let r,o;Array.isArray(e)?(r=e,o=e.length):o=e,super(o,{width:s,height:n}),r&&this.initFromArray(r,t)}addBaseTextureAt(e,t){if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(e){super.bind(e),e.target=oo.TEXTURE_2D_ARRAY}upload(e,t,s){const{length:n,itemDirtyIds:r,items:o}=this,{gl:a}=e;s.dirtyId<0&&a.texImage3D(a.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,n,0,t.format,s.type,null);for(let h=0;h0)if(e.resource)this.addResourceAt(e.resource,t);else throw new Error("CubeResource does not support copying of renderTexture.");else e.target=oo.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(e,t,s){const n=this.itemDirtyIds;for(let r=0;r{if(this.url===null){e(this);return}try{const s=await Ve.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const n=await s.blob();if(this.destroyed)return;const r=await createImageBitmap(n,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ui.UNPACK?"premultiply":"none"});if(this.destroyed){r.close();return}this.source=r,this.update(),e(this)}catch(s){if(this.destroyed)return;t(s),this.onError.emit(s)}}),this._load)}upload(e,t,s){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,s)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&(typeof e=="string"||e instanceof ImageBitmap)}static get EMPTY(){return Zr._EMPTY=Zr._EMPTY??Ve.ADAPTER.createCanvas(0,0),Zr._EMPTY}}const nd=class vl extends Sn{constructor(e,t){t=t||{},super(Ve.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(e=>{if(this._resolve=()=>{this.update(),e(this)},vl.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const e=new Image;Sn.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{this._resolve&&(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;const t=e.width,s=e.height;if(!t||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let n=t*this.scale,r=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(n=this._overrideWidth||this._overrideHeight/s*t,r=this._overrideHeight||this._overrideWidth/t*s),n=Math.round(n),r=Math.round(r);const o=this.source;o.width=n,o.height=r,o._pixiId=`canvas_${_r()}`,o.getContext("2d").drawImage(e,0,0,t,s,0,0,n,r),this._resolve(),this._resolve=null}}static getSize(e){const t=vl.SVG_SIZE.exec(e),s={};return t&&(s[t[1]]=Math.round(parseFloat(t[3])),s[t[5]]=Math.round(parseFloat(t[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(e,t){return t==="svg"||typeof e=="string"&&e.startsWith("data:image/svg+xml")||typeof e=="string"&&vl.SVG_XML.test(e)}};nd.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;let rd=nd;class IS extends Sn{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}}const od=class ad extends Sn{constructor(e,t){if(t=t||{},!(e instanceof HTMLVideoElement)){const s=document.createElement("video");t.autoLoad!==!1&&s.setAttribute("preload","auto"),t.playsinline!==!1&&(s.setAttribute("webkit-playsinline",""),s.setAttribute("playsinline","")),t.muted===!0&&(s.setAttribute("muted",""),s.muted=!0),t.loop===!0&&s.setAttribute("loop",""),t.autoPlay!==!1&&s.setAttribute("autoplay",""),typeof e=="string"&&(e=[e]);const n=e[0].src||e[0];Sn.crossOrigin(s,n,t.crossorigin);for(let r=0;r{this.valid?t(this):(this._resolve=t,this._reject=s,e.load())}),this._load}_onError(e){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){const e=this.source;return!e.paused&&!e.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){const e=this.source;e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay);const t=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!t&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._configureAutoUpdate();const e=this.source;e&&(e.removeEventListener("play",this._onPlayStart),e.removeEventListener("pause",this._onPlayStop),e.removeEventListener("seeked",this._onSeeked),e.removeEventListener("canplay",this._onCanPlay),e.removeEventListener("canplaythrough",this._onCanPlay),e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ei.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Ei.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ei.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(e,t){return globalThis.HTMLVideoElement&&e instanceof HTMLVideoElement||ad.TYPES.includes(t)}};od.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],od.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Vv=od;Wu.push(Zr,dv,AS,Vv,IS,rd,Ch,CS,ES);class pa{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(e){return this.minX>this.maxX||this.minY>this.maxY?lt.EMPTY:(e=e||new lt(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)}addPoint(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)}addPointMatrix(e,t){const{a:s,b:n,c:r,d:o,tx:a,ty:h}=e,l=s*t.x+r*t.y+a,c=n*t.x+o*t.y+h;this.minX=Math.min(this.minX,l),this.maxX=Math.max(this.maxX,l),this.minY=Math.min(this.minY,c),this.maxY=Math.max(this.maxY,c)}addQuad(e){let t=this.minX,s=this.minY,n=this.maxX,r=this.maxY,o=e[0],a=e[1];t=on?o:n,r=a>r?a:r,o=e[2],a=e[3],t=on?o:n,r=a>r?a:r,o=e[4],a=e[5],t=on?o:n,r=a>r?a:r,o=e[6],a=e[7],t=on?o:n,r=a>r?a:r,this.minX=t,this.minY=s,this.maxX=n,this.maxY=r}addFrame(e,t,s,n,r){this.addFrameMatrix(e.worldTransform,t,s,n,r)}addFrameMatrix(e,t,s,n,r){const o=e.a,a=e.b,h=e.c,l=e.d,c=e.tx,u=e.ty;let f=this.minX,d=this.minY,m=this.maxX,g=this.maxY,b=o*t+h*s+c,_=a*t+l*s+u;f=bm?b:m,g=_>g?_:g,b=o*n+h*s+c,_=a*n+l*s+u,f=bm?b:m,g=_>g?_:g,b=o*t+h*r+c,_=a*t+l*r+u,f=bm?b:m,g=_>g?_:g,b=o*n+h*r+c,_=a*n+l*r+u,f=bm?b:m,g=_>g?_:g,this.minX=f,this.minY=d,this.maxX=m,this.maxY=g}addVertexData(e,t,s){let n=this.minX,r=this.minY,o=this.maxX,a=this.maxY;for(let h=t;ho?l:o,a=c>a?c:a}this.minX=n,this.minY=r,this.maxX=o,this.maxY=a}addVertices(e,t,s,n){this.addVerticesMatrix(e.worldTransform,t,s,n)}addVerticesMatrix(e,t,s,n,r=0,o=r){const a=e.a,h=e.b,l=e.c,c=e.d,u=e.tx,f=e.ty;let d=this.minX,m=this.minY,g=this.maxX,b=this.maxY;for(let _=s;_n?e.maxX:n,this.maxY=e.maxY>r?e.maxY:r}addBoundsMask(e,t){const s=e.minX>t.minX?e.minX:t.minX,n=e.minY>t.minY?e.minY:t.minY,r=e.maxXl?r:l,this.maxY=o>c?o:c}}addBoundsMatrix(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)}addBoundsArea(e,t){const s=e.minX>t.x?e.minX:t.x,n=e.minY>t.y?e.minY:t.y,r=e.maxXl?r:l,this.maxY=o>c?o:c}}pad(e=0,t=e){this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)}addFramePad(e,t,s,n,r,o){e-=r,t-=o,s+=r,n+=o,this.minX=this.minXs?this.maxX:s,this.minY=this.minYn?this.maxY:n}}class Wt extends Sa{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new ef,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new pa,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(e){const t=Object.keys(e);for(let s=0;s1)for(let t=0;tthis.children.length)throw new Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${this.children.length}`);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit("added",this),this.emit("childAdded",e,this,t),e}swapChildren(e,t){if(e===t)return;const s=this.getChildIndex(e),n=this.getChildIndex(t);this.children[s]=t,this.children[n]=e,this.onChildrenChange(s=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);const s=this.getChildIndex(e);ao(this.children,s,1),this.children.splice(t,0,e),this.onChildrenChange(t)}getChildAt(e){if(e<0||e>=this.children.length)throw new Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]}removeChild(...e){if(e.length>1)for(let t=0;t0&&r<=n){o=this.children.splice(s,r);for(let a=0;a1&&this.children.sort(kS),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let e=0,t=this.children.length;e0&&t.height>0))return;let s,n;this.cullArea?(s=this.cullArea,n=this.worldTransform):this._render!==ld.prototype._render&&(s=this.getBounds(!0));const r=e.projection.transform;if(r&&(n?(n=PS.copyFrom(n),n.prepend(r)):n=r),s&&t.intersects(s,n))this._render(e);else if(this.cullArea)return;for(let o=0,a=this.children.length;o=n&&Bo.x=r&&Bo.y=t&&(o=i-a-1),h=h.replace("%value%",e[o].toString()),n+=h,n+=` `}return s=s.replace("%blur%",n),s=s.replace("%size%",i.toString()),s}const VS=` attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; uniform float strength; varying vec2 vBlurTexCoords[%size%]; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } vec2 filterTextureCoord( void ) { return aVertexPosition * (outputFrame.zw * inputSize.zw); } void main(void) { gl_Position = filterVertexPosition(); vec2 textureCoord = filterTextureCoord(); %blur% }`;function XS(i,e){const t=Math.ceil(i/2);let s=VS,n="",r;e?r="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":r="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let o=0;o 0.0) { c.rgb /= c.a; } vec4 result; result.r = (m[0] * c.r); result.r += (m[1] * c.g); result.r += (m[2] * c.b); result.r += (m[3] * c.a); result.r += m[4]; result.g = (m[5] * c.r); result.g += (m[6] * c.g); result.g += (m[7] * c.b); result.g += (m[8] * c.a); result.g += m[9]; result.b = (m[10] * c.r); result.b += (m[11] * c.g); result.b += (m[12] * c.b); result.b += (m[13] * c.a); result.b += m[14]; result.a = (m[15] * c.r); result.a += (m[16] * c.g); result.a += (m[17] * c.b); result.a += (m[18] * c.a); result.a += m[19]; vec3 rgb = mix(c.rgb, result.rgb, uAlpha); // Premultiply alpha again. rgb *= result.a; gl_FragColor = vec4(rgb, result.a); } `;class cd extends Mi{constructor(){const e={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(Ov,$S,e),this.alpha=1}_loadMatrix(e,t=!1){let s=e;t&&(this._multiply(s,this.uniforms.m,e),s=this._colorMatrix(s)),this.uniforms.m=s}_multiply(e,t,s){return e[0]=t[0]*s[0]+t[1]*s[5]+t[2]*s[10]+t[3]*s[15],e[1]=t[0]*s[1]+t[1]*s[6]+t[2]*s[11]+t[3]*s[16],e[2]=t[0]*s[2]+t[1]*s[7]+t[2]*s[12]+t[3]*s[17],e[3]=t[0]*s[3]+t[1]*s[8]+t[2]*s[13]+t[3]*s[18],e[4]=t[0]*s[4]+t[1]*s[9]+t[2]*s[14]+t[3]*s[19]+t[4],e[5]=t[5]*s[0]+t[6]*s[5]+t[7]*s[10]+t[8]*s[15],e[6]=t[5]*s[1]+t[6]*s[6]+t[7]*s[11]+t[8]*s[16],e[7]=t[5]*s[2]+t[6]*s[7]+t[7]*s[12]+t[8]*s[17],e[8]=t[5]*s[3]+t[6]*s[8]+t[7]*s[13]+t[8]*s[18],e[9]=t[5]*s[4]+t[6]*s[9]+t[7]*s[14]+t[8]*s[19]+t[9],e[10]=t[10]*s[0]+t[11]*s[5]+t[12]*s[10]+t[13]*s[15],e[11]=t[10]*s[1]+t[11]*s[6]+t[12]*s[11]+t[13]*s[16],e[12]=t[10]*s[2]+t[11]*s[7]+t[12]*s[12]+t[13]*s[17],e[13]=t[10]*s[3]+t[11]*s[8]+t[12]*s[13]+t[13]*s[18],e[14]=t[10]*s[4]+t[11]*s[9]+t[12]*s[14]+t[13]*s[19]+t[14],e[15]=t[15]*s[0]+t[16]*s[5]+t[17]*s[10]+t[18]*s[15],e[16]=t[15]*s[1]+t[16]*s[6]+t[17]*s[11]+t[18]*s[16],e[17]=t[15]*s[2]+t[16]*s[7]+t[17]*s[12]+t[18]*s[17],e[18]=t[15]*s[3]+t[16]*s[8]+t[17]*s[13]+t[18]*s[18],e[19]=t[15]*s[4]+t[16]*s[9]+t[17]*s[14]+t[18]*s[19]+t[19],e}_colorMatrix(e){const t=new Float32Array(e);return t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,t}brightness(e,t){const s=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(s,t)}tint(e,t){const[s,n,r]=At.shared.setValue(e).toArray(),o=[s,0,0,0,0,0,n,0,0,0,0,0,r,0,0,0,0,0,1,0];this._loadMatrix(o,t)}greyscale(e,t){const s=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(s,t)}blackAndWhite(e){const t=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(t,e)}hue(e,t){e=(e||0)/180*Math.PI;const s=Math.cos(e),n=Math.sin(e),r=Math.sqrt,o=1/3,a=r(o),h=s+(1-s)*o,l=o*(1-s)-a*n,c=o*(1-s)+a*n,u=o*(1-s)+a*n,f=s+o*(1-s),d=o*(1-s)-a*n,m=o*(1-s)-a*n,g=o*(1-s)+a*n,b=s+o*(1-s),_=[h,l,c,0,0,u,f,d,0,0,m,g,b,0,0,0,0,0,1,0];this._loadMatrix(_,t)}contrast(e,t){const s=(e||0)+1,n=-.5*(s-1),r=[s,0,0,0,n,0,s,0,0,n,0,0,s,0,n,0,0,0,1,0];this._loadMatrix(r,t)}saturate(e=0,t){const s=e*2/3+1,n=(s-1)*-.5,r=[s,n,n,0,0,n,s,n,0,0,n,n,s,0,0,0,0,0,1,0];this._loadMatrix(r,t)}desaturate(){this.saturate(-1)}negative(e){const t=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(t,e)}sepia(e){const t=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(t,e)}technicolor(e){const t=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(t,e)}polaroid(e){const t=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(t,e)}toBGR(e){const t=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(t,e)}kodachrome(e){const t=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(t,e)}browni(e){const t=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(t,e)}vintage(e){const t=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(t,e)}colorTone(e,t,s,n,r){e=e||.2,t=t||.15,s=s||16770432,n=n||3375104;const o=At.shared,[a,h,l]=o.setValue(s).toArray(),[c,u,f]=o.setValue(n).toArray(),d=[.3,.59,.11,0,0,a,h,l,e,0,c,u,f,t,0,a-c,h-u,l-f,0,0];this._loadMatrix(d,r)}night(e,t){e=e||.1;const s=[e*-2,-e,0,0,0,-e,0,e,0,0,0,e,e*2,0,0,0,0,0,1,0];this._loadMatrix(s,t)}predator(e,t){const s=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(s,t)}lsd(e){const t=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(t,e)}reset(){const e=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(e,!1)}get matrix(){return this.uniforms.m}set matrix(e){this.uniforms.m=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}}cd.prototype.grayscale=cd.prototype.greyscale;var GS=`varying vec2 vFilterCoord; varying vec2 vTextureCoord; uniform vec2 scale; uniform mat2 rotation; uniform sampler2D uSampler; uniform sampler2D mapSampler; uniform highp vec4 inputSize; uniform vec4 inputClamp; void main(void) { vec4 map = texture2D(mapSampler, vFilterCoord); map -= 0.5; map.xy = scale * inputSize.zw * (rotation * map.xy); gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw)); } `,jS=`attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; uniform mat3 filterMatrix; varying vec2 vTextureCoord; varying vec2 vFilterCoord; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } vec2 filterTextureCoord( void ) { return aVertexPosition * (outputFrame.zw * inputSize.zw); } void main(void) { gl_Position = filterVertexPosition(); vTextureCoord = filterTextureCoord(); vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy; } `;class HS extends Mi{constructor(e,t){const s=new Vt;e.renderable=!1,super(jS,GS,{mapSampler:e._texture,filterMatrix:s,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=e,this.maskMatrix=s,t==null&&(t=20),this.scale=new bt(t,t)}apply(e,t,s,n){this.uniforms.filterMatrix=e.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;const r=this.maskSprite.worldTransform,o=Math.sqrt(r.a*r.a+r.b*r.b),a=Math.sqrt(r.c*r.c+r.d*r.d);o!==0&&a!==0&&(this.uniforms.rotation[0]=r.a/o,this.uniforms.rotation[1]=r.b/o,this.uniforms.rotation[2]=r.c/a,this.uniforms.rotation[3]=r.d/a),e.applyFilter(this,t,s,n)}get map(){return this.uniforms.mapSampler}set map(e){this.uniforms.mapSampler=e}}var WS=`varying vec2 v_rgbNW; varying vec2 v_rgbNE; varying vec2 v_rgbSW; varying vec2 v_rgbSE; varying vec2 v_rgbM; varying vec2 vFragCoord; uniform sampler2D uSampler; uniform highp vec4 inputSize; /** Basic FXAA implementation based on the code on geeks3d.com with the modification that the texture2DLod stuff was removed since it's unsupported by WebGL. -- From: https://github.com/mitsuhiko/webgl-meincraft Copyright (c) 2011 by Armin Ronacher. Some rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef FXAA_REDUCE_MIN #define FXAA_REDUCE_MIN (1.0/ 128.0) #endif #ifndef FXAA_REDUCE_MUL #define FXAA_REDUCE_MUL (1.0 / 8.0) #endif #ifndef FXAA_SPAN_MAX #define FXAA_SPAN_MAX 8.0 #endif //optimized version for mobile, where dependent //texture reads can be a bottleneck vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP, vec2 v_rgbNW, vec2 v_rgbNE, vec2 v_rgbSW, vec2 v_rgbSE, vec2 v_rgbM) { vec4 color; vec3 rgbNW = texture2D(tex, v_rgbNW).xyz; vec3 rgbNE = texture2D(tex, v_rgbNE).xyz; vec3 rgbSW = texture2D(tex, v_rgbSW).xyz; vec3 rgbSE = texture2D(tex, v_rgbSE).xyz; vec4 texColor = texture2D(tex, v_rgbM); vec3 rgbM = texColor.xyz; vec3 luma = vec3(0.299, 0.587, 0.114); float lumaNW = dot(rgbNW, luma); float lumaNE = dot(rgbNE, luma); float lumaSW = dot(rgbSW, luma); float lumaSE = dot(rgbSE, luma); float lumaM = dot(rgbM, luma); float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); mediump vec2 dir; dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN); float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce); dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * inverseVP; vec3 rgbA = 0.5 * ( texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz + texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz); vec3 rgbB = rgbA * 0.5 + 0.25 * ( texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz + texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz); float lumaB = dot(rgbB, luma); if ((lumaB < lumaMin) || (lumaB > lumaMax)) color = vec4(rgbA, texColor.a); else color = vec4(rgbB, texColor.a); return color; } void main() { vec4 color; color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); gl_FragColor = color; } `,zS=` attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; varying vec2 v_rgbNW; varying vec2 v_rgbNE; varying vec2 v_rgbSW; varying vec2 v_rgbSE; varying vec2 v_rgbM; varying vec2 vFragCoord; uniform vec4 inputSize; uniform vec4 outputFrame; vec4 filterVertexPosition( void ) { vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); } void texcoords(vec2 fragCoord, vec2 inverseVP, out vec2 v_rgbNW, out vec2 v_rgbNE, out vec2 v_rgbSW, out vec2 v_rgbSE, out vec2 v_rgbM) { v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP; v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP; v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP; v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP; v_rgbM = vec2(fragCoord * inverseVP); } void main(void) { gl_Position = filterVertexPosition(); vFragCoord = aVertexPosition * outputFrame.zw; texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM); } `;class qS extends Mi{constructor(){super(zS,WS)}}var KS=`precision highp float; varying vec2 vTextureCoord; varying vec4 vColor; uniform float uNoise; uniform float uSeed; uniform sampler2D uSampler; float rand(vec2 co) { return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); } void main() { vec4 color = texture2D(uSampler, vTextureCoord); float randomValue = rand(gl_FragCoord.xy * uSeed); float diff = (randomValue - 0.5) * uNoise; // Un-premultiply alpha before applying the color matrix. See issue #3539. if (color.a > 0.0) { color.rgb /= color.a; } color.r += diff; color.g += diff; color.b += diff; // Premultiply alpha again. color.rgb *= color.a; gl_FragColor = color; } `;class ZS extends Mi{constructor(e=.5,t=Math.random()){super(Ov,KS,{uNoise:0,uSeed:0}),this.noise=e,this.seed=t}get noise(){return this.uniforms.uNoise}set noise(e){this.uniforms.uNoise=e}get seed(){return this.uniforms.uSeed}set seed(e){this.uniforms.uSeed=e}}const km={AlphaFilter:LS,BlurFilter:YS,BlurFilterPass:hd,ColorMatrixFilter:cd,DisplacementFilter:HS,FXAAFilter:qS,NoiseFilter:ZS};Object.entries(km).forEach(([i,e])=>{Object.defineProperty(km,i,{get(){return pt("7.1.0",`filters.${i} has moved to ${i}`),e}})});class JS{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this.tickerAdded||!this.domElement||(Ei.system.add(this.tickerUpdate,this,Sr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Ei.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const e=this.events.rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:e.clientX,clientY:e.clientY}))}tickerUpdate(e){this._deltaTime+=e,!(this._deltaTimes.priority-n.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;const t=this.mappingTable[e.type];if(t)for(let s=0,n=t.length;s=0;n--)if(e.currentTarget=s[n],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,s=this._allInteractiveElements){if(s.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const n=Array.isArray(t)?t:[t];for(let r=s.length-1;r>=0;r--)n.forEach(o=>{e.currentTarget=s[r],this.notifyTarget(e,o)})}propagationPath(e){const t=[e];for(let s=0;s=0;u--){const f=c[u],d=this.hitTestMoveRecursive(f,this._isInteractive(t)?t:f.eventMode,s,n,r,o||r(e,s));if(d){if(d.length>0&&!d[d.length-1].parent)continue;const m=e.isInteractive();(d.length>0||m)&&(m&&this._allInteractiveElements.push(e),d.push(e)),this._hitElements.length===0&&(this._hitElements=d),a=!0}}}const h=this._isInteractive(t),l=e.isInteractive();return h&&l&&this._allInteractiveElements.push(e),o||this._hitElements.length>0?null:a?this._hitElements:h&&!r(e,s)&&n(e,s)?l?[e]:[]:null}hitTestRecursive(e,t,s,n,r){if(this._interactivePrune(e)||r(e,s))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(Vn.pauseUpdate=!1),e.interactiveChildren&&e.children){const h=e.children;for(let l=h.length-1;l>=0;l--){const c=h[l],u=this.hitTestRecursive(c,this._isInteractive(t)?t:c.eventMode,s,n,r);if(u){if(u.length>0&&!u[u.length-1].parent)continue;const f=e.isInteractive();return(u.length>0||f)&&u.push(e),u}}}const o=this._isInteractive(t),a=e.isInteractive();return o&&n(e,s)?a?[e]:[]:null}_isInteractive(e){return e==="static"||e==="dynamic"}_interactivePrune(e){return!!(!e||e.isMask||!e.visible||!e.renderable||e.eventMode==="none"||e.eventMode==="passive"&&!e.interactiveChildren||e.isMask)}hitPruneFn(e,t){var s;if(e.hitArea&&(e.worldTransform.applyInverse(t,cu),!e.hitArea.contains(cu.x,cu.y)))return!0;if(e._mask){const n=e._mask.isMaskData?e._mask.maskObject:e._mask;if(n&&!((s=n.containsPoint)!=null&&s.call(n,t)))return!0}return!1}hitTestFn(e,t){return e.eventMode==="passive"?!1:e.hitArea?!0:e.containsPoint?e.containsPoint(t):!1}notifyTarget(e,t){var r,o;t=t??e.type;const s=`on${t}`;(o=(r=e.currentTarget)[s])==null||o.call(r,e);const n=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this.notifyListeners(e,n),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.createPointerEvent(e);if(this.dispatchEvent(t,"pointerdown"),t.pointerType==="touch")this.dispatchEvent(t,"touchstart");else if(t.pointerType==="mouse"||t.pointerType==="pen"){const n=t.button===2;this.dispatchEvent(t,n?"rightdown":"mousedown")}const s=this.trackingData(e.pointerId);s.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){var h,l;if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;const t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;const s=t.pointerType==="mouse"||t.pointerType==="pen",n=this.trackingData(e.pointerId),r=this.findMountedTarget(n.overTargets);if(((h=n.overTargets)==null?void 0:h.length)>0&&r!==t.target){const c=e.type==="mousemove"?"mouseout":"pointerout",u=this.createPointerEvent(e,c,r);if(this.dispatchEvent(u,"pointerout"),s&&this.dispatchEvent(u,"mouseout"),!t.composedPath().includes(r)){const f=this.createPointerEvent(e,"pointerleave",r);for(f.eventPhase=f.AT_TARGET;f.target&&!t.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),s&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(u)}if(r!==t.target){const c=e.type==="mousemove"?"mouseover":"pointerover",u=this.clonePointerEvent(t,c);this.dispatchEvent(u,"pointerover"),s&&this.dispatchEvent(u,"mouseover");let f=r==null?void 0:r.parent;for(;f&&f!==this.rootTarget.parent&&f!==t.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const d=this.clonePointerEvent(t,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==r&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),s&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(u)}const o=[],a=this.enableGlobalMoveEvents??!0;this.moveOnAll?o.push("pointermove"):this.dispatchEvent(t,"pointermove"),a&&o.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?o.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),a&&o.push("globaltouchmove")),s&&(this.moveOnAll?o.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),a&&o.push("globalmousemove"),this.cursor=(l=t.target)==null?void 0:l.cursor),o.length>0&&this.all(t,o),this._allInteractiveElements.length=0,this._hitElements.length=0,n.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){var o;if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),s=this.createPointerEvent(e),n=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),n&&this.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(this.cursor=(o=s.target)==null?void 0:o.cursor);const r=this.clonePointerEvent(s,"pointerenter");for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,"mouseenter"),r.target=r.target.parent;t.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(r)}mapPointerOut(e){if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const s=e.pointerType==="mouse"||e.pointerType==="pen",n=this.findMountedTarget(t.overTargets),r=this.createPointerEvent(e,"pointerout",n);this.dispatchEvent(r),s&&this.dispatchEvent(r,"mouseout");const o=this.createPointerEvent(e,"pointerleave",n);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),s&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;t.overTargets=null,this.freeEvent(r),this.freeEvent(o)}this.cursor=null}mapPointerUp(e){if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),s=this.createPointerEvent(e);if(this.dispatchEvent(s,"pointerup"),s.pointerType==="touch")this.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const a=s.button===2;this.dispatchEvent(s,a?"rightup":"mouseup")}const n=this.trackingData(e.pointerId),r=this.findMountedTarget(n.pressTargetsByButton[e.button]);let o=r;if(r&&!s.composedPath().includes(r)){let a=r;for(;a&&!s.composedPath().includes(a);){if(s.currentTarget=a,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")this.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){const h=s.button===2;this.notifyTarget(s,h?"rightupoutside":"mouseupoutside")}a=a.parent}delete n.pressTargetsByButton[e.button],o=a}if(o){const a=this.clonePointerEvent(s,"click");a.target=o,a.path=null,n.clicksByButton[e.button]||(n.clicksByButton[e.button]={clickCount:0,target:a.target,timeStamp:t});const h=n.clicksByButton[e.button];if(h.target===a.target&&t-h.timeStamp<200?++h.clickCount:h.clickCount=1,h.target=a.target,h.timeStamp=t,a.detail=h.clickCount,a.pointerType==="mouse"){const l=a.button===2;this.dispatchEvent(a,l?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(s)}mapPointerUpOutside(e){if(!(e instanceof rs)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),s=this.findMountedTarget(t.pressTargetsByButton[e.button]),n=this.createPointerEvent(e);if(s){let r=s;for(;r;)n.currentTarget=r,this.notifyTarget(n,"pointerupoutside"),n.pointerType==="touch"?this.notifyTarget(n,"touchendoutside"):(n.pointerType==="mouse"||n.pointerType==="pen")&&this.notifyTarget(n,n.button===2?"rightupoutside":"mouseupoutside"),r=r.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(n)}mapWheel(e){if(!(e instanceof ho)){console.warn("EventBoundary cannot map a non-wheel event as a wheel event");return}const t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let s=1;s(s==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=n),t[s]=n,!0)}),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.onPointerOverOut=this.onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(e){const{view:t,resolution:s}=this.renderer;this.setTargetElement(t),this.resolution=s,dd._defaultEventMode=e.eventMode??"auto",Object.assign(this.features,e.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(e){e=e||"default";let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this.currentCursor===e)return;this.currentCursor=e;const s=this.cursorStyles[e];if(s)switch(typeof s){case"string":t&&(this.domElement.style.cursor=s);break;case"function":s(e);break;case"object":t&&Object.assign(this.domElement.style,s);break}else t&&typeof e=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this.rootPointerEvent}onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!("cancelable"in e))&&e.preventDefault();for(let s=0,n=t.length;s0&&(t=e.composedPath()[0]);const s=t!==this.domElement?"outside":"",n=this.normalizeToPointerData(e);for(let r=0,o=n.length;r"u"&&(r.button=0),typeof r.buttons>"u"&&(r.buttons=1),typeof r.isPrimary>"u"&&(r.isPrimary=e.touches.length===1&&e.type==="touchstart"),typeof r.width>"u"&&(r.width=r.radiusX||1),typeof r.height>"u"&&(r.height=r.radiusY||1),typeof r.tiltX>"u"&&(r.tiltX=0),typeof r.tiltY>"u"&&(r.tiltY=0),typeof r.pointerType>"u"&&(r.pointerType="touch"),typeof r.pointerId>"u"&&(r.pointerId=r.identifier||0),typeof r.pressure>"u"&&(r.pressure=r.force||.5),typeof r.twist>"u"&&(r.twist=0),typeof r.tangentialPressure>"u"&&(r.tangentialPressure=0),typeof r.layerX>"u"&&(r.layerX=r.offsetX=r.clientX),typeof r.layerY>"u"&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=e.type,t.push(r)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){const s=e;typeof s.isPrimary>"u"&&(s.isPrimary=!0),typeof s.width>"u"&&(s.width=1),typeof s.height>"u"&&(s.height=1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="mouse"),typeof s.pointerId>"u"&&(s.pointerId=iT),typeof s.pressure>"u"&&(s.pressure=.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),s.isNormalized=!0,t.push(s)}else t.push(e);return t}normalizeWheelEvent(e){const t=this.rootWheelEvent;return this.transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this.transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=sT[e.type]||e.type),e}transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};ud.extension={name:"events",type:[Oe.RendererSystem,Oe.CanvasRendererSystem]},ud.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};let fd=ud;He.add(fd);function Fm(i){return i==="dynamic"||i==="static"}const nT={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??Fm(fd.defaultEventMode)},set interactive(i){pt("7.2.0","Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead."),this._internalInteractive=i,this.eventMode=i?"static":"auto"},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??fd.defaultEventMode},set eventMode(i){this._internalInteractive=Fm(i),this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,e,t){const s=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof t=="object"?t.signal:void 0,r=typeof t=="object"?t.once===!0:!1,o=typeof e=="function"?void 0:e;i=s?`${i}capture`:i;const a=typeof e=="function"?e:e.handleEvent,h=this;n&&n.addEventListener("abort",()=>{h.off(i,a,o)}),r?h.once(i,a,o):h.on(i,a,o)},removeEventListener(i,e,t){const s=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,n=typeof e=="function"?void 0:e;i=s?`${i}capture`:i,e=typeof e=="function"?e:e.handleEvent,this.off(i,e,n)},dispatchEvent(i){if(!(i instanceof Ta))throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");return i.defaultPrevented=!1,i.path=null,i.target=this,i.manager.dispatchEvent(i),!i.defaultPrevented}};Wt.mixin(nT);const rT={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};Wt.mixin(rT);const oT=9,Ga=100,aT=0,lT=0,Om=2,Bm=1,hT=-1e3,cT=-1e3,uT=2;class $v{constructor(e){this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this.pool=[],this.renderId=0,this.children=[],this.androidUpdateCount=0,this.androidUpdateFrequency=500,this._hookDiv=null,(dn.tablet||dn.phone)&&this.createTouchHook();const t=document.createElement("div");t.style.width=`${Ga}px`,t.style.height=`${Ga}px`,t.style.position="absolute",t.style.top=`${aT}px`,t.style.left=`${lT}px`,t.style.zIndex=Om.toString(),this.div=t,this.renderer=e,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}createTouchHook(){const e=document.createElement("button");e.style.width=`${Bm}px`,e.style.height=`${Bm}px`,e.style.position="absolute",e.style.top=`${hT}px`,e.style.left=`${cT}px`,e.style.zIndex=uT.toString(),e.style.backgroundColor="#FF0000",e.title="select to enable accessibility for this content",e.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}activate(){var e;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this.renderer.on("postrender",this.update,this),(e=this.renderer.view.parentNode)==null||e.appendChild(this.div))}deactivate(){var e;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this.renderer.off("postrender",this.update),(e=this.div.parentNode)==null||e.removeChild(this.div))}updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&e.isInteractive()&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);const t=e.children;if(t)for(let s=0;s title : ${e.title}
tabIndex: ${e.tabIndex}`}capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);const{width:t,height:s}=this.renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>s&&(e.height=s-e.y)}addChild(e){let t=this.pool.pop();t||(t=document.createElement("button"),t.style.width=`${Ga}px`,t.style.height=`${Ga}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=Om.toString(),t.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?t.setAttribute("aria-live","off"):t.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute("aria-relevant","additions"):t.setAttribute("aria-relevant","text"),t.addEventListener("click",this._onClick.bind(this)),t.addEventListener("focus",this._onFocus.bind(this)),t.addEventListener("focusout",this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`displayObject ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute("aria-label",e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){const{displayObject:s}=e.target,n=this.renderer.events.rootBoundary,r=Object.assign(new Ta(n),{target:s});n.rootTarget=this.renderer.lastObjectRendered,t.forEach(o=>n.dispatchEvent(r,o))}_onClick(e){this._dispatchEvent(e,["click","pointertap","tap"])}_onFocus(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","assertive"),this._dispatchEvent(e,["mouseover"])}_onFocusOut(e){e.target.getAttribute("aria-live")||e.target.setAttribute("aria-live","polite"),this._dispatchEvent(e,["mouseout"])}_onKeyDown(e){e.keyCode===oT&&this.activate()}_onMouseMove(e){e.movementX===0&&e.movementY===0||this.deactivate()}destroy(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null}}$v.extension={name:"accessibility",type:[Oe.RendererPlugin,Oe.CanvasRendererPlugin]};He.add($v);const Gv=class pd{constructor(e){this.stage=new gi,e=Object.assign({forceCanvas:!1},e),this.renderer=wS(e),pd._plugins.forEach(t=>{t.init.call(this,e)})}render(){this.renderer.render(this.stage)}get view(){var e;return(e=this.renderer)==null?void 0:e.view}get screen(){var e;return(e=this.renderer)==null?void 0:e.screen}destroy(e,t){const s=pd._plugins.slice(0);s.reverse(),s.forEach(n=>{n.destroy.call(this)}),this.stage.destroy(t),this.stage=null,this.renderer.destroy(e),this.renderer=null}};Gv._plugins=[];let jv=Gv;He.handleByList(Oe.Application,jv._plugins);class Hv{static init(e){Object.defineProperty(this,"resizeTo",{set(t){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=t,t&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this.cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this.cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let t,s;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:n,clientHeight:r}=this._resizeTo;t=n,s=r}this.renderer.resize(t,s),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}Hv.extension=Oe.Application;He.add(Hv);const Lm={loader:Oe.LoadParser,resolver:Oe.ResolveParser,cache:Oe.CacheParser,detection:Oe.DetectionParser};He.handle(Oe.Asset,i=>{const e=i.ref;Object.entries(Lm).filter(([t])=>!!e[t]).forEach(([t,s])=>He.add(Object.assign(e[t],{extension:e[t].extension??s})))},i=>{const e=i.ref;Object.keys(Lm).filter(t=>!!e[t]).forEach(t=>He.remove(e[t]))});class dT{constructor(e,t=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=t}add(e){e.forEach(t=>{this._assetList.push(t)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const e=[],t=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s(Array.isArray(i)||(i=[i]),e?i.map(s=>typeof s=="string"||t?e(s):s):i),Vl=(i,e)=>{const t=e.split("?")[1];return t&&(i+=`?${t}`),i};function Wv(i,e,t,s,n){const r=e[t];for(let o=0;o{const o=r.substring(1,r.length-1).split(",");n.push(o)}),Wv(i,n,0,t,s)}else s.push(i);return s}const Xl=i=>!Array.isArray(i);class pT{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){const t=this._cache.get(e);return t||console.warn(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){const s=os(e);let n;for(let a=0;a{n[a]=t}));const r=Object.keys(n),o={cacheKeys:r,keys:s};if(s.forEach(a=>{this._cacheMap.set(a,o)}),r.forEach(a=>{const h=n?n[a]:t;this._cache.has(a)&&this._cache.get(a)!==h&&console.warn("[Cache] already has key:",a),this._cache.set(a,n[a])}),t instanceof et){const a=t;s.forEach(h=>{a.baseTexture!==et.EMPTY.baseTexture&&st.addToCache(a.baseTexture,h),et.addToCache(a,h)})}}remove(e){if(!this._cacheMap.has(e)){console.warn(`[Assets] Asset id ${e} was not found in the Cache`);return}const t=this._cacheMap.get(e);t.cacheKeys.forEach(s=>{this._cache.delete(s)}),t.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}}const pr=new pT;class mT{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,s)=>(this._parsersValidated=!1,e[t]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){const s={promise:null,parser:null};return s.promise=(async()=>{var o,a;let n=null,r=null;if(t.loadParser&&(r=this._parserHash[t.loadParser],r||console.warn(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!r){for(let h=0;h({alias:[l],src:l})),a=o.length,h=o.map(async l=>{const c=zt.toAbsolute(l.src);if(!n[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),n[l.src]=await this.promiseCache[c].promise,t&&t(++s/a)}catch(u){throw delete this.promiseCache[c],delete n[l.src],new Error(`[Loader.load] Failed to load ${c}. ${u}`)}});return await Promise.all(h),r?n[o[0].src]:n}async unload(e){const t=os(e,s=>({alias:[s],src:s})).map(async s=>{var o,a;const n=zt.toAbsolute(s.src),r=this.promiseCache[n];if(r){const h=await r.promise;delete this.promiseCache[n],(a=(o=r.parser)==null?void 0:o.unload)==null||a.call(o,h,s,this)}});await Promise.all(t)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(e=>e.name).reduce((e,t)=>(e[t.name]&&console.warn(`[Assets] loadParser name conflict "${t.name}"`),{...e,[t.name]:t}),{})}}var Yi=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Yi||{});const gT=".json",vT="application/json",yT={extension:{type:Oe.LoadParser,priority:Yi.Low},name:"loadJson",test(i){return To(i,vT)||Fi(i,gT)},async load(i){return await(await Ve.ADAPTER.fetch(i)).json()}};He.add(yT);const xT=".txt",bT="text/plain",wT={name:"loadTxt",extension:{type:Oe.LoadParser,priority:Yi.Low},test(i){return To(i,bT)||Fi(i,xT)},async load(i){return await(await Ve.ADAPTER.fetch(i)).text()}};He.add(wT);const _T=["normal","bold","100","200","300","400","500","600","700","800","900"],ST=[".ttf",".otf",".woff",".woff2"],TT=["font/ttf","font/otf","font/woff","font/woff2"],MT=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function ET(i){const e=zt.extname(i),t=zt.basename(i,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(r=>r.charAt(0).toUpperCase()+r.slice(1));let s=t.length>0;for(const r of t)if(!r.match(MT)){s=!1;break}let n=t.join(" ");return s||(n=`"${n.replace(/[\\"]/g,"\\$&")}"`),n}const AT=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function CT(i){return AT.test(i)?i:encodeURI(i)}const IT={extension:{type:Oe.LoadParser,priority:Yi.Low},name:"loadWebFont",test(i){return To(i,TT)||Fi(i,ST)},async load(i,e){var s,n,r;const t=Ve.ADAPTER.getFontFaceSet();if(t){const o=[],a=((s=e.data)==null?void 0:s.family)??ET(i),h=((r=(n=e.data)==null?void 0:n.weights)==null?void 0:r.filter(c=>_T.includes(c)))??["normal"],l=e.data??{};for(let c=0;cVe.ADAPTER.getFontFaceSet().delete(e))}};He.add(IT);const RT=`(function() { "use strict"; const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII="; async function checkImageBitmap() { try { if (typeof createImageBitmap != "function") return !1; const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob); return imageBitmap.width === 1 && imageBitmap.height === 1; } catch { return !1; } } checkImageBitmap().then((result) => { self.postMessage(result); }); })(); `;let co=null,md=class{constructor(){co||(co=URL.createObjectURL(new Blob([RT],{type:"application/javascript"}))),this.worker=new Worker(co)}};md.revokeObjectURL=function(){co&&(URL.revokeObjectURL(co),co=null)};const PT=`(function() { "use strict"; async function loadImageBitmap(url) { const response = await fetch(url); if (!response.ok) throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`); const imageBlob = await response.blob(); return await createImageBitmap(imageBlob); } self.onmessage = async (event) => { try { const imageBitmap = await loadImageBitmap(event.data.data[0]); self.postMessage({ data: imageBitmap, uuid: event.data.uuid, id: event.data.id }, [imageBitmap]); } catch (e) { self.postMessage({ error: e, uuid: event.data.uuid, id: event.data.id }); } }; })(); `;let uo=null;class zv{constructor(){uo||(uo=URL.createObjectURL(new Blob([PT],{type:"application/javascript"}))),this.worker=new Worker(uo)}}zv.revokeObjectURL=function(){uo&&(URL.revokeObjectURL(uo),uo=null)};let Dm=0,uu;class kT{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(e=>{const{worker:t}=new md;t.addEventListener("message",s=>{t.terminate(),md.revokeObjectURL(),e(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e){return this._run("loadImageBitmap",[e])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){uu===void 0&&(uu=navigator.hardwareConcurrency||4);let e=this.workerPool.pop();return!e&&this._createdWorkers{this.complete(t.data),this.returnWorker(t.target),this.next()})),e}returnWorker(e){this.workerPool.push(e)}complete(e){e.error!==void 0?this.resolveHash[e.uuid].reject(e.error):this.resolveHash[e.uuid].resolve(e.data),this.resolveHash[e.uuid]=null}async _run(e,t){await this._initWorkers();const s=new Promise((n,r)=>{this.queue.push({id:e,arguments:t,resolve:n,reject:r})});return this.next(),s}next(){if(!this.queue.length)return;const e=this.getWorker();if(!e)return;const t=this.queue.pop(),s=t.id;this.resolveHash[Dm]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:Dm++,id:s})}}const Nm=new kT;function Ma(i,e,t){i.resource.internal=!0;const s=new et(i),n=()=>{delete e.promiseCache[t],pr.has(t)&&pr.remove(t)};return s.baseTexture.once("destroyed",()=>{t in e.promiseCache&&(console.warn("[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture."),n())}),s.once("destroyed",()=>{i.destroyed||(console.warn("[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture."),n())}),s}const FT=[".jpeg",".jpg",".png",".webp",".avif"],OT=["image/jpeg","image/png","image/webp","image/avif"];async function BT(i){const e=await Ve.ADAPTER.fetch(i);if(!e.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${i}: ${e.status} ${e.statusText}`);const t=await e.blob();return await createImageBitmap(t)}const Fh={name:"loadTextures",extension:{type:Oe.LoadParser,priority:Yi.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return To(i,OT)||Fi(i,FT)},async load(i,e,t){var a;const s=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap;let n;s?this.config.preferWorkers&&await Nm.isImageBitmapSupported()?n=await Nm.loadImageBitmap(i):n=await BT(i):n=await new Promise((h,l)=>{const c=new Image;c.crossOrigin=this.config.crossOrigin,c.src=i,c.complete?h(c):(c.onload=()=>h(c),c.onerror=u=>l(u))});const r={...e.data};r.resolution??(r.resolution=_n(i)),s&&((a=r.resourceOptions)==null?void 0:a.ownsImageBitmap)===void 0&&(r.resourceOptions={...r.resourceOptions},r.resourceOptions.ownsImageBitmap=!0);const o=new st(n,r);return o.resource.src=i,Ma(o,t,i)},unload(i){i.destroy(!0)}};He.add(Fh);const LT=".svg",DT="image/svg+xml",NT={extension:{type:Oe.LoadParser,priority:Yi.High},name:"loadSVG",test(i){return To(i,DT)||Fi(i,LT)},async testParse(i){return rd.test(i)},async parse(i,e,t){var r;const s=new rd(i,(r=e==null?void 0:e.data)==null?void 0:r.resourceOptions);await s.load();const n=new st(s,{resolution:_n(i),...e==null?void 0:e.data});return n.resource.src=e.src,Ma(n,t,e.src)},async load(i,e){return(await Ve.ADAPTER.fetch(i)).text()},unload:Fh.unload};He.add(NT);const UT=[".mp4",".m4v",".webm",".ogv"],VT=["video/mp4","video/webm","video/ogg"],XT={name:"loadVideo",extension:{type:Oe.LoadParser,priority:Yi.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(i){return To(i,VT)||Fi(i,UT)},async load(i,e,t){var o;let s;const n=await(await Ve.ADAPTER.fetch(i)).blob(),r=URL.createObjectURL(n);try{const a={autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...(o=e==null?void 0:e.data)==null?void 0:o.resourceOptions,autoLoad:!0},h=new Vv(r,a);await h.load();const l=new st(h,{alphaMode:await zw(),resolution:_n(i),...e==null?void 0:e.data});l.resource.src=i,s=Ma(l,t,i),s.baseTexture.once("destroyed",()=>{URL.revokeObjectURL(r)})}catch(a){throw URL.revokeObjectURL(r),a}return s},unload(i){i.destroy(!0)}};He.add(XT);class YT{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...e){e.forEach(t=>{this._preferredOrder.push(t),t.priority||(t.priority=Object.keys(t.params))}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(e){if(typeof e=="string")this._defaultSearchParams=e;else{const t=e;this._defaultSearchParams=Object.keys(t).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(t[s])}`).join("&")}}getAlias(e){const{alias:t,name:s,src:n,srcs:r}=e;return os(t||s||n||r,o=>typeof o=="string"?o:Array.isArray(o)?o.map(a=>(a==null?void 0:a.src)??(a==null?void 0:a.srcs)??a):o!=null&&o.src||o!=null&&o.srcs?o.src??o.srcs:o,!0)}addManifest(e){this._manifest&&console.warn("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=e,e.bundles.forEach(t=>{this.addBundle(t.name,t.assets)})}addBundle(e,t){const s=[];Array.isArray(t)?t.forEach(n=>{const r=n.src??n.srcs,o=n.alias??n.name;let a;if(typeof o=="string"){const h=this._createBundleAssetId(e,o);s.push(h),a=[o,h]}else{const h=o.map(l=>this._createBundleAssetId(e,l));s.push(...h),a=[...o,...h]}this.add({...n,alias:a,src:r})}):Object.keys(t).forEach(n=>{const r=[n,this._createBundleAssetId(e,n)];if(typeof t[n]=="string")this.add({alias:r,src:t[n]});else if(Array.isArray(t[n]))this.add({alias:r,src:t[n]});else{const o=t[n],a=o.src??o.srcs;this.add({...o,alias:r,src:Array.isArray(a)?a:[a]})}s.push(...r)}),this._bundles[e]=s}add(e,t,s,n,r){const o=[];typeof e=="string"||Array.isArray(e)&&typeof e[0]=="string"?(pt("7.2.0",`Assets.add now uses an object instead of individual parameters. Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),o.push({alias:e,src:t,data:s,format:n,loadParser:r})):Array.isArray(e)?o.push(...e):o.push(e);let a;a=h=>{this.hasKey(h)&&console.warn(`[Resolver] already has key: ${h} overwriting`)},os(o).forEach(h=>{const{src:l,srcs:c}=h;let{data:u,format:f,loadParser:d}=h;const m=os(l||c).map(_=>typeof _=="string"?fT(_):Array.isArray(_)?_:[_]),g=this.getAlias(h);Array.isArray(g)?g.forEach(a):a(g);const b=[];m.forEach(_=>{_.forEach(M=>{let v={};if(typeof M!="object"){v.src=M;for(let S=0;S{this._assetMap[_]=b})})}resolveBundle(e){const t=Xl(e);e=os(e);const s={};return e.forEach(n=>{const r=this._bundles[n];if(r){const o=this.resolve(r),a={};for(const h in o){const l=o[h];a[this._extractAssetIdFromBundle(n,h)]=l}s[n]=a}}),t?s[e[0]]:s}resolveUrl(e){const t=this.resolve(e);if(typeof e!="string"){const s={};for(const n in t)s[n]=t[n].src;return s}return t.src}resolve(e){const t=Xl(e);e=os(e);const s={};return e.forEach(n=>{if(!this._resolverHash[n])if(this._assetMap[n]){let r=this._assetMap[n];const o=r[0],a=this._getPreferredOrder(r);a==null||a.priority.forEach(h=>{a.params[h].forEach(l=>{const c=r.filter(u=>u[h]?u[h]===l:!1);c.length&&(r=c)})}),this._resolverHash[n]=r[0]??o}else this._resolverHash[n]=this.buildResolvedAsset({alias:[n],src:n},{});s[n]=this._resolverHash[n]}),t?s[e[0]]:s}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;tr.params.format.includes(s.format));if(n)return n}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}buildResolvedAsset(e,t){const{aliases:s,data:n,loadParser:r,format:o}=t;return(this._basePath||this._rootPath)&&(e.src=zt.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=s??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...n||{},...e.data},e.loadParser=r??e.loadParser,e.format=o??e.format??zt.extname(e.src).slice(1),e.srcs=e.src,e.name=e.alias,e}}class $T{constructor(){this._detections=[],this._initialized=!1,this.resolver=new YT,this.loader=new mT,this.cache=pr,this._backgroundLoader=new dT(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){var r,o;if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Assets.init()?");return}if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let a=e.manifest;typeof a=="string"&&(a=await this.load(a)),this.resolver.addManifest(a)}const t=((r=e.texturePreference)==null?void 0:r.resolution)??1,s=typeof t=="number"?[t]:t,n=await this._detectFormats({preferredFormats:(o=e.texturePreference)==null?void 0:o.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:n,resolution:s}}),e.preferences&&this.setPreferences(e.preferences)}add(e,t,s,n,r){this.resolver.add(e,t,s,n,r)}async load(e,t){this._initialized||await this.init();const s=Xl(e),n=os(e).map(a=>{if(typeof a!="string"){const h=this.resolver.getAlias(a);return h.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(h)?h[0]:h}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),r=this.resolver.resolve(n),o=await this._mapLoadToResolve(r,t);return s?o[n[0]]:o}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let s=!1;typeof e=="string"&&(s=!0,e=[e]);const n=this.resolver.resolveBundle(e),r={},o=Object.keys(n);let a=0,h=0;const l=()=>{t==null||t(++a/h)},c=o.map(u=>{const f=n[u];return h+=Object.keys(f).length,this._mapLoadToResolve(f,l).then(d=>{r[u]=d})});return await Promise.all(c),s?r[e[0]]:r}async backgroundLoad(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);const t=this.resolver.resolve(e);this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(e){this._initialized||await this.init(),typeof e=="string"&&(e=[e]);const t=this.resolver.resolveBundle(e);Object.values(t).forEach(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return pr.get(e);const t={};for(let s=0;s{const l=r[a.src],c=[a.src];a.alias&&c.push(...a.alias),o[n[h]]=l,pr.set(c,l)}),o}async unload(e){this._initialized||await this.init();const t=os(e).map(n=>typeof n!="string"?n.src:n),s=this.resolver.resolve(t);await this._unloadFromResolved(s)}async unloadBundle(e){this._initialized||await this.init(),e=os(e);const t=this.resolver.resolveBundle(e),s=Object.keys(t).map(n=>this._unloadFromResolved(t[n]));await Promise.all(s)}async _unloadFromResolved(e){const t=Object.values(e);t.forEach(s=>{pr.remove(s.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(const s of e.detections)e.skipDetections||await s.test()?t=await s.add(t):e.skipDetections||(t=await s.remove(t));return t=t.filter((s,n)=>t.indexOf(s)===n),t}get detections(){return this._detections}get preferWorkers(){return Fh.config.preferWorkers}set preferWorkers(e){pt("7.2.0","Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead."),this.setPreferences({preferWorkers:e})}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(s=>s in e).forEach(s=>{t.config[s]=e[s]})})}}const Xs=new $T;He.handleByList(Oe.LoadParser,Xs.loader.parsers).handleByList(Oe.ResolveParser,Xs.resolver.parsers).handleByList(Oe.CacheParser,Xs.cache.parsers).handleByList(Oe.DetectionParser,Xs.detections);const GT={extension:Oe.CacheParser,test:i=>Array.isArray(i)&&i.every(e=>e instanceof et),getCacheableAssets:(i,e)=>{const t={};return i.forEach(s=>{e.forEach((n,r)=>{t[s+(r===0?"":r+1)]=n})}),t}};He.add(GT);async function qv(i){if("Image"in globalThis)return new Promise(e=>{const t=new Image;t.onload=()=>{e(!0)},t.onerror=()=>{e(!1)},t.src=i});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const e=await(await fetch(i)).blob();await createImageBitmap(e)}catch{return!1}return!0}return!1}const jT={extension:{type:Oe.DetectionParser,priority:1},test:async()=>qv("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async i=>[...i,"avif"],remove:async i=>i.filter(e=>e!=="avif")};He.add(jT);const HT={extension:{type:Oe.DetectionParser,priority:0},test:async()=>qv("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async i=>[...i,"webp"],remove:async i=>i.filter(e=>e!=="webp")};He.add(HT);const Um=["png","jpg","jpeg"],WT={extension:{type:Oe.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...Um],remove:async i=>i.filter(e=>!Um.includes(e))};He.add(WT);const zT="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function rf(i){return zT?!1:document.createElement("video").canPlayType(i)!==""}const qT={extension:{type:Oe.DetectionParser,priority:0},test:async()=>rf("video/webm"),add:async i=>[...i,"webm"],remove:async i=>i.filter(e=>e!=="webm")};He.add(qT);const KT={extension:{type:Oe.DetectionParser,priority:0},test:async()=>rf("video/mp4"),add:async i=>[...i,"mp4","m4v"],remove:async i=>i.filter(e=>e!=="mp4"&&e!=="m4v")};He.add(KT);const ZT={extension:{type:Oe.DetectionParser,priority:0},test:async()=>rf("video/ogg"),add:async i=>[...i,"ogv"],remove:async i=>i.filter(e=>e!=="ogv")};He.add(ZT);const JT={extension:Oe.ResolveParser,test:Fh.test,parse:i=>{var e;return{resolution:parseFloat(((e=Ve.RETINA_PREFIX.exec(i))==null?void 0:e[1])??"1"),format:zt.extname(i).slice(1),src:i}}};He.add(JT);var di=(i=>(i[i.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",i[i.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",i[i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",i[i.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",i[i.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",i[i.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",i[i.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",i[i.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",i[i.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",i[i.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",i[i.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",i[i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",i[i.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",i[i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",i[i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",i[i.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",i[i.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",i[i.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",i[i.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",i[i.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",i[i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",i[i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",i[i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",i))(di||{});const Yl={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1};let Es,zr;function Vm(){zr={bptc:Es.getExtension("EXT_texture_compression_bptc"),astc:Es.getExtension("WEBGL_compressed_texture_astc"),etc:Es.getExtension("WEBGL_compressed_texture_etc"),s3tc:Es.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Es.getExtension("WEBGL_compressed_texture_s3tc_srgb"),pvrtc:Es.getExtension("WEBGL_compressed_texture_pvrtc")||Es.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),etc1:Es.getExtension("WEBGL_compressed_texture_etc1"),atc:Es.getExtension("WEBGL_compressed_texture_atc")}}const QT={extension:{type:Oe.DetectionParser,priority:2},test:async()=>{const i=Ve.ADAPTER.createCanvas().getContext("webgl");return i?(Es=i,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async i=>{zr||Vm();const e=[];for(const t in zr)zr[t]&&e.push(t);return[...e,...i]},remove:async i=>(zr||Vm(),i.filter(e=>!(e in zr)))};He.add(QT);class eM extends Ch{constructor(e,t={width:1,height:1,autoLoad:!0}){let s,n;typeof e=="string"?(s=e,n=new Uint8Array):(s=null,n=e),super(n,t),this.origin=s,this.buffer=n?new Hu(n):null,this._load=null,this.loaded=!1,this.origin!==null&&t.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(e){}load(){return this._load?this._load:(this._load=fetch(this.origin).then(e=>e.blob()).then(e=>e.arrayBuffer()).then(e=>(this.data=new Uint32Array(e),this.buffer=new Hu(e),this.loaded=!0,this.onBlobLoaded(e),this.update(),this)),this._load)}}class yr extends eM{constructor(e,t){super(e,t),this.format=t.format,this.levels=t.levels||1,this._width=t.width,this._height=t.height,this._extension=yr._formatToExtension(this.format),(t.levelBuffers||this.buffer)&&(this._levelBuffers=t.levelBuffers||yr._createLevelBuffers(e instanceof Uint8Array?e:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(e,t,s){const n=e.gl;if(!e.context.extensions[this._extension])throw new Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;n.pixelStorei(n.UNPACK_ALIGNMENT,4);for(let r=0,o=this.levels;r=33776&&e<=33779)return"s3tc";if(e>=35916&&e<=35919)return"s3tc_sRGB";if(e>=37488&&e<=37497)return"etc";if(e>=35840&&e<=35843)return"pvrtc";if(e===36196)return"etc1";if(e===35986||e===35987||e===34798)return"atc";if(e>=36492&&e<=36495)return"bptc";if(e===37808)return"astc";throw new Error(`Invalid (compressed) texture format given: ${e}`)}static _createLevelBuffers(e,t,s,n,r,o,a){const h=new Array(s);let l=e.byteOffset,c=o,u=a,f=c+n-1&~(n-1),d=u+r-1&~(r-1),m=f*d*Yl[t];for(let g=0;g1?c:f,levelHeight:s>1?u:d,levelBuffer:new Uint8Array(e.buffer,l,m)},l+=m,c=c>>1||1,u=u>>1||1,f=c+n-1&~(n-1),d=u+r-1&~(r-1),m=f*d*Yl[t];return h}}const du=4,ja=124,tM=32,Xm=20,iM=542327876,Ha={HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},sM={FOURCC:2},Wa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3},nM=1,rM=2,oM=4,aM=64,lM=512,hM=131072,cM=827611204,uM=861165636,dM=894720068,fM=808540228,pM=4,mM={[cM]:di.COMPRESSED_RGBA_S3TC_DXT1_EXT,[uM]:di.COMPRESSED_RGBA_S3TC_DXT3_EXT,[dM]:di.COMPRESSED_RGBA_S3TC_DXT5_EXT},gM={70:di.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:di.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:di.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:di.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:di.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:di.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:di.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:di.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:di.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:di.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:di.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:di.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:di.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function vM(i){const e=new Uint32Array(i);if(e[0]!==iM)throw new Error("Invalid DDS file magic word");const t=new Uint32Array(i,0,ja/Uint32Array.BYTES_PER_ELEMENT),s=t[Ha.HEIGHT],n=t[Ha.WIDTH],r=t[Ha.MIPMAP_COUNT],o=new Uint32Array(i,Ha.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,tM/Uint32Array.BYTES_PER_ELEMENT),a=o[nM];if(a&oM){const h=o[sM.FOURCC];if(h!==fM){const M=mM[h],v=du+ja,S=new Uint8Array(i,v);return[new yr(S,{format:M,width:n,height:s,levels:r})]}const l=du+ja,c=new Uint32Array(e.buffer,l,Xm/Uint32Array.BYTES_PER_ELEMENT),u=c[Wa.DXGI_FORMAT],f=c[Wa.RESOURCE_DIMENSION],d=c[Wa.MISC_FLAG],m=c[Wa.ARRAY_SIZE],g=gM[u];if(g===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${u}`);if(d===pM)throw new Error("DDSParser does not support cubemap textures");if(f===6)throw new Error("DDSParser does not supported 3D texture data");const b=new Array,_=du+ja+Xm;if(m===1)b.push(new Uint8Array(i,_));else{const M=Yl[g];let v=0,S=n,y=s;for(let E=0;E>>1,y=y>>>1}let I=_;for(let E=0;Enew yr(M,{format:g,width:n,height:s,levels:r}))}throw a&aM?new Error("DDSParser does not support uncompressed texture data."):a&lM?new Error("DDSParser does not supported YUV uncompressed texture data."):a&hM?new Error("DDSParser does not support single-channel (lumninance) texture data!"):a&rM?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}const Ym=[171,75,84,88,32,49,49,187,13,10,26,10],yM=67305985,is={ENDIANNESS:12,GL_TYPE:16,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},gd=64,$m={[je.UNSIGNED_BYTE]:1,[je.UNSIGNED_SHORT]:2,[je.INT]:4,[je.UNSIGNED_INT]:4,[je.FLOAT]:4,[je.HALF_FLOAT]:8},xM={[Re.RGBA]:4,[Re.RGB]:3,[Re.RG]:2,[Re.RED]:1,[Re.LUMINANCE]:1,[Re.LUMINANCE_ALPHA]:2,[Re.ALPHA]:1},bM={[je.UNSIGNED_SHORT_4_4_4_4]:2,[je.UNSIGNED_SHORT_5_5_5_1]:2,[je.UNSIGNED_SHORT_5_6_5]:2};function wM(i,e,t=!1){const s=new DataView(e);if(!_M(i,s))return null;const n=s.getUint32(is.ENDIANNESS,!0)===yM,r=s.getUint32(is.GL_TYPE,n),o=s.getUint32(is.GL_FORMAT,n),a=s.getUint32(is.GL_INTERNAL_FORMAT,n),h=s.getUint32(is.PIXEL_WIDTH,n),l=s.getUint32(is.PIXEL_HEIGHT,n)||1,c=s.getUint32(is.PIXEL_DEPTH,n)||1,u=s.getUint32(is.NUMBER_OF_ARRAY_ELEMENTS,n)||1,f=s.getUint32(is.NUMBER_OF_FACES,n),d=s.getUint32(is.NUMBER_OF_MIPMAP_LEVELS,n),m=s.getUint32(is.BYTES_OF_KEY_VALUE_DATA,n);if(l===0||c!==1)throw new Error("Only 2D textures are supported");if(f!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(u!==1)throw new Error("WebGL does not support array textures");const g=4,b=4,_=h+3&-4,M=l+3&-4,v=new Array(u);let S=h*l;r===0&&(S=_*M);let y;if(r!==0?$m[r]?y=$m[r]*xM[o]:y=bM[r]:y=Yl[a],y===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const I=t?TM(s,m,n):null;let E=S*y,C=h,R=l,B=_,k=M,F=gd+m;for(let D=0;D1||r!==0?C:B,levelHeight:d>1||r!==0?R:k,levelBuffer:new Uint8Array(e,j,E)},j+=E}F+=N+4,F=F%4!==0?F+4-F%4:F,C=C>>1||1,R=R>>1||1,B=C+g-1&-4,k=R+b-1&-4,E=B*k*y}return r!==0?{uncompressed:v.map(D=>{let N=D[0].levelBuffer,j=!1;return r===je.FLOAT?N=new Float32Array(D[0].levelBuffer.buffer,D[0].levelBuffer.byteOffset,D[0].levelBuffer.byteLength/4):r===je.UNSIGNED_INT?(j=!0,N=new Uint32Array(D[0].levelBuffer.buffer,D[0].levelBuffer.byteOffset,D[0].levelBuffer.byteLength/4)):r===je.INT&&(j=!0,N=new Int32Array(D[0].levelBuffer.buffer,D[0].levelBuffer.byteOffset,D[0].levelBuffer.byteLength/4)),{resource:new Ch(N,{width:D[0].levelWidth,height:D[0].levelHeight}),type:r,format:j?SM(o):o}}),kvData:I}:{compressed:v.map(D=>new yr(null,{format:a,width:h,height:l,levels:d,levelBuffers:D})),kvData:I}}function _M(i,e){for(let t=0;te-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let h=0;for(;h{const o=new st(r,{mipmap:Ki.OFF,alphaMode:ui.NO_PREMULTIPLIED_ALPHA,resolution:_n(i),...e.data});return Ma(o,t,i)});return n.length===1?n[0]:n},unload(i){Array.isArray(i)?i.forEach(e=>e.destroy(!0)):i.destroy(!0)}};He.add(MM);const EM={extension:{type:Oe.LoadParser,priority:Yi.High},name:"loadKTX",test(i){return Fi(i,".ktx")},async load(i,e,t){const s=await(await Ve.ADAPTER.fetch(i)).arrayBuffer(),{compressed:n,uncompressed:r,kvData:o}=wM(i,s),a=n??r,h={mipmap:Ki.OFF,alphaMode:ui.NO_PREMULTIPLIED_ALPHA,resolution:_n(i),...e.data},l=a.map(c=>{a===r&&Object.assign(h,{type:c.type,format:c.format});const u=c.resource??c,f=new st(u,h);return f.ktxKeyValueData=o,Ma(f,t,i)});return l.length===1?l[0]:l},unload(i){Array.isArray(i)?i.forEach(e=>e.destroy(!0)):i.destroy(!0)}};He.add(EM);const AM=["s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","bptc"],CM={extension:Oe.ResolveParser,test:i=>{const e=zt.extname(i).slice(1);return["basis","ktx","dds"].includes(e)},parse:i=>{var s,n;const e=i.split("."),t=e.pop();if(["ktx","dds"].includes(t)){const r=e.pop();if(AM.includes(r))return{resolution:parseFloat(((s=Ve.RETINA_PREFIX.exec(i))==null?void 0:s[1])??"1"),format:r,src:i}}return{resolution:parseFloat(((n=Ve.RETINA_PREFIX.exec(i))==null?void 0:n[1])??"1"),format:t,src:i}}};He.add(CM);const za=new lt,IM=4,Kv=class Wo{constructor(e){this.renderer=e,this._rendererPremultipliedAlpha=!1}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(e,t,s,n){const r=new Image;return r.src=await this.base64(e,t,s,n),r}async base64(e,t,s,n){const r=this.canvas(e,n);if(r.toBlob!==void 0)return new Promise((o,a)=>{r.toBlob(h=>{if(!h){a(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(h)},t,s)});if(r.toDataURL!==void 0)return r.toDataURL(t,s);if(r.convertToBlob!==void 0){const o=await r.convertToBlob({type:t,quality:s});return new Promise((a,h)=>{const l=new FileReader;l.onload=()=>a(l.result),l.onerror=h,l.readAsDataURL(o)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(e,t){const{pixels:s,width:n,height:r,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,t);o&&Wo._flipY(s,n,r),a&&Wo._unpremultiplyAlpha(s);const h=new c_(n,r,1),l=new ImageData(new Uint8ClampedArray(s.buffer),n,r);return h.context.putImageData(l,0,0),h.canvas}pixels(e,t){const{pixels:s,width:n,height:r,flipY:o,premultipliedAlpha:a}=this._rawPixels(e,t);return o&&Wo._flipY(s,n,r),a&&Wo._unpremultiplyAlpha(s),s}_rawPixels(e,t){const s=this.renderer;if(!s)throw new Error("The Extract has already been destroyed");let n,r=!1,o=!1,a,h=!1;e&&(e instanceof Ir?a=e:(a=s.generateTexture(e,{region:t,resolution:s.resolution,multisample:s.multisample}),h=!0,t&&(za.width=t.width,za.height=t.height,t=za)));const l=s.gl;if(a){if(n=a.baseTexture.resolution,t=t??a.frame,r=!1,o=a.baseTexture.alphaMode>0&&a.baseTexture.format===Re.RGBA,!h){s.renderTexture.bind(a);const d=a.framebuffer.glFramebuffers[s.CONTEXT_UID];d.blitFramebuffer&&s.framebuffer.bind(d.blitFramebuffer)}}else n=s.resolution,t||(t=za,t.width=s.width/n,t.height=s.height/n),r=!0,o=this._rendererPremultipliedAlpha,s.renderTexture.bind();const c=Math.max(Math.round(t.width*n),1),u=Math.max(Math.round(t.height*n),1),f=new Uint8Array(IM*c*u);return l.readPixels(Math.round(t.x*n),Math.round(t.y*n),c,u,l.RGBA,l.UNSIGNED_BYTE,f),h&&(a==null||a.destroy(!0)),{pixels:f,width:c,height:u,flipY:r,premultipliedAlpha:o}}destroy(){this.renderer=null}static _flipY(e,t,s){const n=t<<2,r=s>>1,o=new Uint8Array(n);for(let a=0;a=0&&a>=0&&n>=0&&r>=0)){e.length=0;return}const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(n?4:0)+(r?4:0);if(e.length=l,l===0)return;if(h===0){e.length=8,e[0]=e[6]=t+n,e[1]=e[3]=s+r,e[2]=e[4]=t-n,e[5]=e[7]=s-r;return}let c=0,u=h*4+(n?2:0)+2,f=u,d=l;{const m=n+o,g=r,b=t+m,_=t-m,M=s+g;if(e[c++]=b,e[c++]=M,e[--u]=M,e[--u]=_,r){const v=s-g;e[f++]=_,e[f++]=v,e[--d]=v,e[--d]=b}}for(let m=1;m0||e&&s<=0){const n=t/2;for(let r=n+n%2;r=6){Gm(t,!1);const o=[];for(let l=0;l=0&&r>=0&&o.push(t,s,t+n,s,t+n,s+r,t,s+r)},triangulate(i,e){const t=i.points,s=e.points;if(t.length===0)return;const n=s.length/2;s.push(t[0],t[1],t[2],t[3],t[6],t[7],t[4],t[5]),e.indices.push(n,n+1,n+2,n+1,n+2,n+3)}},kM={build(i){$l.build(i)},triangulate(i,e){$l.triangulate(i,e)}};var Hi=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(Hi||{}),jn=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(jn||{});const vo={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(i,e=20){if(!this.adaptive||!i||isNaN(i))return e;let t=Math.ceil(i/this.maxLength);return tthis.maxSegments&&(t=this.maxSegments),t}};class jm{static curveTo(e,t,s,n,r,o){const a=o[o.length-2],h=o[o.length-1]-t,l=a-e,c=n-t,u=s-e,f=Math.abs(h*u-l*c);if(f<1e-8||r===0)return(o[o.length-2]!==e||o[o.length-1]!==t)&&o.push(e,t),null;const d=h*h+l*l,m=c*c+u*u,g=h*c+l*u,b=r*Math.sqrt(d)/f,_=r*Math.sqrt(m)/f,M=b*g/d,v=_*g/m,S=b*u+_*l,y=b*c+_*h,I=l*(_+M),E=h*(_+M),C=u*(b+v),R=c*(b+v),B=Math.atan2(E-y,I-S),k=Math.atan2(R-y,C-S);return{cx:S+e,cy:y+t,radius:r,startAngle:B,endAngle:k,anticlockwise:l*c>u*h}}static arc(e,t,s,n,r,o,a,h,l){const c=a-o,u=vo._segmentsCount(Math.abs(c)*r,Math.ceil(Math.abs(c)/Ol)*40),f=c/(u*2),d=f*2,m=Math.cos(f),g=Math.sin(f),b=u-1,_=b%1/b;for(let M=0;M<=b;++M){const v=M+_*M,S=f+o+d*v,y=Math.cos(S),I=-Math.sin(S);l.push((m*y+g*I)*r+s,(m*-I+g*y)*r+n)}}}class FM{constructor(){this.reset()}begin(e,t,s){this.reset(),this.style=e,this.start=t,this.attribStart=s}end(e,t){this.attribSize=t-this.attribStart,this.size=e-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}}class of{static curveLength(e,t,s,n,r,o,a,h){let l=0,c=0,u=0,f=0,d=0,m=0,g=0,b=0,_=0,M=0,v=0,S=e,y=t;for(let I=1;I<=10;++I)c=I/10,u=c*c,f=u*c,d=1-c,m=d*d,g=m*d,b=g*e+3*m*c*s+3*d*u*r+f*a,_=g*t+3*m*c*n+3*d*u*o+f*h,M=S-b,v=y-_,S=b,y=_,l+=Math.sqrt(M*M+v*v);return l}static curveTo(e,t,s,n,r,o,a){const h=a[a.length-2],l=a[a.length-1];a.length-=2;const c=vo._segmentsCount(of.curveLength(h,l,e,t,s,n,r,o));let u=0,f=0,d=0,m=0,g=0;a.push(h,l);for(let b=1,_=0;b<=c;++b)_=b/c,u=1-_,f=u*u,d=f*u,m=_*_,g=m*_,a.push(d*h+3*f*_*e+3*u*m*s+g*r,d*l+3*f*_*t+3*u*m*n+g*o)}}function Hm(i,e,t,s,n,r,o,a){const h=i-t*n,l=e-s*n,c=i+t*r,u=e+s*r;let f,d;o?(f=s,d=-t):(f=-s,d=t);const m=h+f,g=l+d,b=c+f,_=u+d;return a.push(m,g,b,_),2}function ar(i,e,t,s,n,r,o,a){const h=t-i,l=s-e;let c=Math.atan2(h,l),u=Math.atan2(n-i,r-e);a&&cu&&(u+=Math.PI*2);let f=c;const d=u-c,m=Math.abs(d),g=Math.sqrt(h*h+l*l),b=(15*m*Math.sqrt(g)/Math.PI>>0)+1,_=d/b;if(f+=_,a){o.push(i,e,t,s);for(let M=1,v=f;M=0&&(r.join===Hi.ROUND?f+=ar(v,S,v-E*D,S-C*D,v-R*D,S-B*D,c,!1)+4:f+=2,c.push(v-R*N,S-B*N,v+R*D,S+B*D));continue}const H=(-E+_)*(-C+S)-(-E+v)*(-C+M),Z=(-R+y)*(-B+S)-(-R+v)*(-B+I),ae=(P*Z-U*H)/z,me=(Y*H-X*Z)/z,_e=(ae-v)*(ae-v)+(me-S)*(me-S),te=v+(ae-v)*D,ve=S+(me-S)*D,$=v-(ae-v)*N,W=S-(me-S)*N,J=Math.min(P*P+X*X,U*U+Y*Y),Q=ne?D:N,ie=J+Q*Q*g,ue=_e<=ie;let Se=r.join;if(Se===Hi.MITER&&_e/g>b&&(Se=Hi.BEVEL),ue)switch(Se){case Hi.MITER:{c.push(te,ve,$,W);break}case Hi.BEVEL:{ne?c.push(te,ve,v+E*N,S+C*N,te,ve,v+R*N,S+B*N):c.push(v-E*D,S-C*D,$,W,v-R*D,S-B*D,$,W),f+=2;break}case Hi.ROUND:{ne?(c.push(te,ve,v+E*N,S+C*N),f+=ar(v,S,v+E*N,S+C*N,v+R*N,S+B*N,c,!0)+4,c.push(te,ve,v+R*N,S+B*N)):(c.push(v-E*D,S-C*D,$,W),f+=ar(v,S,v-E*D,S-C*D,v-R*D,S-B*D,c,!1)+4,c.push(v-R*D,S-B*D,$,W));break}}else{switch(c.push(v-E*D,S-C*D,v+E*N,S+C*N),Se){case Hi.MITER:{ne?c.push($,W,$,W):c.push(te,ve,te,ve),f+=2;break}case Hi.ROUND:{ne?f+=ar(v,S,v+E*N,S+C*N,v+R*N,S+B*N,c,!0)+2:f+=ar(v,S,v-E*D,S-C*D,v-R*D,S-B*D,c,!1)+2;break}}c.push(v-R*D,S-B*D,v+R*N,S+B*N),f+=2}}_=s[(u-2)*2],M=s[(u-2)*2+1],v=s[(u-1)*2],S=s[(u-1)*2+1],E=-(M-S),C=_-v,k=Math.sqrt(E*E+C*C),E/=k,C/=k,E*=m,C*=m,c.push(v-E*D,S-C*D,v+E*N,S+C*N),h||(r.cap===jn.ROUND?f+=ar(v-E*(D-N)*.5,S-C*(D-N)*.5,v-E*D,S-C*D,v+E*N,S+C*N,c,!1)+2:r.cap===jn.SQUARE&&(f+=Hm(v,S,E,C,D,N,!1,c)));const j=e.indices,O=vo.epsilon*vo.epsilon;for(let L=d;L0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(e,t=null,s=null,n=null){const r=new Gl(e,t,s,n);return this.graphicsData.push(r),this.dirty++,this}drawHole(e,t=null){if(!this.graphicsData.length)return null;const s=new Gl(e,null,null,t),n=this.graphicsData[this.graphicsData.length-1];return s.lineStyle=n.lineStyle,n.holes.push(s),this.dirty++,this}destroy(){super.destroy();for(let e=0;e0&&(s=this.batches[this.batches.length-1],n=s.style);for(let h=this.shapeIndex;h65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&a===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=a?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(e,t){return!(!e||!t||e.texture.baseTexture!==t.texture.baseTexture||e.color+e.alpha!==t.color+t.alpha||!!e.native!=!!t.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let e=0,t=this.graphicsData.length;e65535*2)return!1;const e=this.batches;for(let t=0;t0&&(n=qa.pop(),n||(n=new qu,n.texArray=new Qu),this.drawCalls.push(n)),n.start=c,n.size=0,n.texArray.count=0,n.type=l),g.touched=1,g._batchEnabled=e,g._batchLocation=r,g.wrapMode=us.REPEAT,n.texArray.elements[n.texArray.count++]=g,r++)),n.size+=f.size,c+=f.size,a=g._batchLocation,this.addColors(t,m.color,m.alpha,f.attribSize,f.attribStart),this.addTextureIds(s,a,f.attribSize,f.attribStart)}st._globalBatch=e,this.packAttributes()}packAttributes(){const e=this.points,t=this.uvs,s=this.colors,n=this.textureIds,r=new ArrayBuffer(e.length*3*4),o=new Float32Array(r),a=new Uint32Array(r);let h=0;for(let l=0;l0&&e.alpha>0;return s?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:s},e)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const e=this.currentPath.points,t=this.currentPath.points.length;t>2&&(this.drawShape(this.currentPath),this.currentPath=new vr,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[t-2],e[t-1]))}else this.currentPath=new vr,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(e,t){return this.startPoly(),this.currentPath.points[0]=e,this.currentPath.points[1]=t,this}lineTo(e,t){this.currentPath||this.moveTo(0,0);const s=this.currentPath.points,n=s[s.length-2],r=s[s.length-1];return(n!==e||r!==t)&&s.push(e,t),this}_initCurve(e=0,t=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[e,t]):this.moveTo(e,t)}quadraticCurveTo(e,t,s,n){this._initCurve();const r=this.currentPath.points;return r.length===0&&this.moveTo(0,0),af.curveTo(e,t,s,n,r),this}bezierCurveTo(e,t,s,n,r,o){return this._initCurve(),of.curveTo(e,t,s,n,r,o,this.currentPath.points),this}arcTo(e,t,s,n,r){this._initCurve(e,t);const o=this.currentPath.points,a=jm.curveTo(e,t,s,n,r,o);if(a){const{cx:h,cy:l,radius:c,startAngle:u,endAngle:f,anticlockwise:d}=a;this.arc(h,l,c,u,f,d)}return this}arc(e,t,s,n,r,o=!1){if(n===r)return this;if(!o&&r<=n?r+=Ol:o&&n<=r&&(n+=Ol),r-n===0)return this;const a=e+Math.cos(n)*s,h=t+Math.sin(n)*s,l=this._geometry.closePointEps;let c=this.currentPath?this.currentPath.points:null;if(c){const u=Math.abs(c[c.length-2]-a),f=Math.abs(c[c.length-1]-h);u0;return s?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:s},e)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(e,t,s,n){return this.drawShape(new lt(e,t,s,n))}drawRoundedRect(e,t,s,n,r){return this.drawShape(new Ph(e,t,s,n,r))}drawCircle(e,t,s){return this.drawShape(new Ih(e,t,s))}drawEllipse(e,t,s,n){return this.drawShape(new Rh(e,t,s,n))}drawPolygon(...e){let t,s=!0;const n=e[0];n.points?(s=n.closeStroke,t=n.points):Array.isArray(e[0])?t=e[0]:t=e;const r=new vr(t);return r.closeStroke=s,this.drawShape(r),this}drawShape(e){return this._holeMode?this._geometry.drawHole(e,this._matrix):this._geometry.drawShape(e,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){const e=this._geometry.graphicsData;return e.length===1&&e[0].shape.type===pi.RECT&&!e[0].matrix&&!e[0].holes.length&&!(e[0].lineStyle.visible&&e[0].lineStyle.width)}_render(e){this.finishPoly();const t=this._geometry;t.updateBatches(),t.batchable?(this.batchDirty!==t.batchDirty&&this._populateBatches(),this._renderBatched(e)):(e.batch.flush(),this._renderDirect(e))}_populateBatches(){const e=this._geometry,t=this.blendMode,s=e.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=e.batchDirty,this.batches.length=s,this.vertexData=new Float32Array(e.points);for(let n=0;ns&&!e.autoResize&&(o=s);let a=e._buffers;a||(a=e._buffers=this.generateBuffers(e));const h=t[0]._texture.baseTexture,l=h.alphaMode>0;this.state.blendMode=ev(e.blendMode,l),r.state.set(this.state);const c=r.gl,u=e.worldTransform.copyTo(this.tempMatrix);u.prepend(r.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=At.shared.setValue(e.tintRgb).premultiply(e.worldAlpha,l).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=h,this.renderer.shader.bind(this.shader);let f=!1;for(let d=0,m=0;dn&&(g=n),m>=a.length&&a.push(this._generateOneMoreBuffer(e));const b=a[m];b.uploadDynamic(t,d,g);const _=e._bufferUpdateIDs[m]||0;f=f||b._updateID<_,f&&(b._updateID=e._updateID,b.uploadStatic(t,d,g)),r.geometry.bind(b.geometry),c.drawElements(c.TRIANGLES,g*6,c.UNSIGNED_SHORT,0)}}generateBuffers(e){const t=[],s=e._maxSize,n=e._batchSize,r=e._properties;for(let o=0;o0);n[o]=l,n[o+r]=l,n[o+r*2]=l,n[o+r*3]=l,o+=r*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}iy.extension={name:"particle",type:Oe.RendererPlugin};He.add(iy);var Bh=(i=>(i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",i))(Bh||{});const Ka={willReadFrequently:!0},As=class ze{static get experimentalLetterSpacingSupported(){let e=ze._experimentalLetterSpacingSupported;if(e!==void 0){const t=Ve.ADAPTER.getCanvasRenderingContext2D().prototype;e=ze._experimentalLetterSpacingSupported="letterSpacing"in t||"textLetterSpacing"in t}return e}constructor(e,t,s,n,r,o,a,h,l){this.text=e,this.style=t,this.width=s,this.height=n,this.lines=r,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=h,this.fontProperties=l}static measureText(e,t,s,n=ze._canvas){s=s??t.wordWrap;const r=t.toFontString(),o=ze.measureFont(r);o.fontSize===0&&(o.fontSize=t.fontSize,o.ascent=t.fontSize);const a=n.getContext("2d",Ka);a.font=r;const h=(s?ze.wordWrap(e,t,n):e).split(/(?:\r\n|\r|\n)/),l=new Array(h.length);let c=0;for(let m=0;m0&&(n?r-=t:r+=(ze.graphemeSegmenter(e).length-1)*t),r}static wordWrap(e,t,s=ze._canvas){const n=s.getContext("2d",Ka);let r=0,o="",a="";const h=Object.create(null),{letterSpacing:l,whiteSpace:c}=t,u=ze.collapseSpaces(c),f=ze.collapseNewlines(c);let d=!u;const m=t.wordWrapWidth+l,g=ze.tokenize(e);for(let b=0;bm)if(o!==""&&(a+=ze.addLine(o),o="",r=0),ze.canBreakWords(_,t.breakWords)){const v=ze.wordWrapSplit(_);for(let S=0;Sm&&(a+=ze.addLine(o),d=!1,o="",r=0),o+=y,r+=C}}else{o.length>0&&(a+=ze.addLine(o),o="",r=0);const v=b===g.length-1;a+=ze.addLine(_,!v),d=!1,o="",r=0}else M+r>m&&(d=!1,a+=ze.addLine(o),o="",r=0),(o.length>0||!ze.isBreakingSpace(_)||d)&&(o+=_,r+=M)}return a+=ze.addLine(o,!1),a}static addLine(e,t=!0){return e=ze.trimRight(e),e=t?`${e} `:e,e}static getFromCache(e,t,s,n){let r=s[e];return typeof r!="number"&&(r=ze._measureText(e,t,n)+t,s[e]=r),r}static collapseSpaces(e){return e==="normal"||e==="pre-line"}static collapseNewlines(e){return e==="normal"}static trimRight(e){if(typeof e!="string")return"";for(let t=e.length-1;t>=0;t--){const s=e[t];if(!ze.isBreakingSpace(s))break;e=e.slice(0,-1)}return e}static isNewline(e){return typeof e!="string"?!1:ze._newlines.includes(e.charCodeAt(0))}static isBreakingSpace(e,t){return typeof e!="string"?!1:ze._breakingSpaces.includes(e.charCodeAt(0))}static tokenize(e){const t=[];let s="";if(typeof e!="string")return t;for(let n=0;na;--f){for(let g=0;g{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const i=new Intl.Segmenter;return e=>[...i.segment(e)].map(t=>t.segment)}return i=>[...i]})(),As.experimentalLetterSpacing=!1,As._fonts={},As._newlines=[10,13],As._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];let Ln=As;const $M=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],sy=class zo{constructor(e){this.styleID=0,this.reset(),vu(this,e,e)}clone(){const e={};return vu(e,this,zo.defaultStyle),new zo(e)}reset(){vu(this,zo.defaultStyle,zo.defaultStyle)}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(e){const t=gu(e);this._dropShadowColor!==t&&(this._dropShadowColor=t,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(e){this._dropShadowDistance!==e&&(this._dropShadowDistance=e,this.styleID++)}get fill(){return this._fill}set fill(e){const t=gu(e);this._fill!==t&&(this._fill=t,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(e){GM(this._fillGradientStops,e)||(this._fillGradientStops=e,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(e){this.fontFamily!==e&&(this._fontFamily=e,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize!==e&&(this._fontSize=e,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant!==e&&(this._fontVariant=e,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.styleID++)}get leading(){return this._leading}set leading(e){this._leading!==e&&(this._leading=e,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(e){this._lineJoin!==e&&(this._lineJoin=e,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(e){this._miterLimit!==e&&(this._miterLimit=e,this.styleID++)}get padding(){return this._padding}set padding(e){this._padding!==e&&(this._padding=e,this.styleID++)}get stroke(){return this._stroke}set stroke(e){const t=gu(e);this._stroke!==t&&(this._stroke=t,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(e){this._strokeThickness!==e&&(this._strokeThickness=e,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline!==e&&(this._textBaseline=e,this.styleID++)}get trim(){return this._trim}set trim(e){this._trim!==e&&(this._trim=e,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap!==e&&(this._wordWrap=e,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.styleID++)}toFontString(){const e=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let t=this.fontFamily;Array.isArray(this.fontFamily)||(t=this.fontFamily.split(","));for(let s=t.length-1;s>=0;s--){let n=t[s].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!$M.includes(n)&&(n=`"${n}"`),t[s]=n}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${e} ${t.join(",")}`}};sy.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:Bh.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Kn=sy;function gu(i){const e=At.shared,t=s=>{const n=e.setValue(s);return n.alpha===1?n.toHex():n.toRgbaString()};return Array.isArray(i)?i.map(t):t(i)}function GM(i,e){if(!Array.isArray(i)||!Array.isArray(e)||i.length!==e.length)return!1;for(let t=0;t0&&m>g&&(b=(g+m)/2);const _=g+f,M=s.lineHeight*(d+1);let v=_;d+10}}function WM(i,e){var s;let t=!1;if((s=i==null?void 0:i._textures)!=null&&s.length){for(let n=0;n{this.queue&&this.prepareItems()},this.registerFindHook(JM),this.registerFindHook(QM),this.registerFindHook(WM),this.registerFindHook(zM),this.registerFindHook(qM),this.registerUploadHook(KM),this.registerUploadHook(ZM)}upload(e){return new Promise(t=>{e&&this.add(e),this.queue.length?(this.completes.push(t),this.ticking||(this.ticking=!0,Ei.system.addOnce(this.tick,this,Sr.UTILITY))):t()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const e=this.queue[0];let t=!1;if(e&&!e._destroyed){for(let s=0,n=this.uploadHooks.length;s=0;t--)this.add(e.children[t]);return this}destroy(){this.ticking&&Ei.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null}};ry.uploadsPerFrame=4;let xd=ry;Object.defineProperties(Ve,{UPLOADS_PER_FRAME:{get(){return xd.uploadsPerFrame},set(i){pt("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),xd.uploadsPerFrame=i}}});function ay(i,e){return e instanceof st?(e._glTextures[i.CONTEXT_UID]||i.texture.bind(e),!0):!1}function eE(i,e){if(!(e instanceof Ri))return!1;const{geometry:t}=e;e.finishPoly(),t.updateBatches();const{batches:s}=t;for(let n=0;n1?ps.from(sE,iE,t):ps.from(Zm,nE,t)}render(e){const t=this.renderer,s=this.quad;let n=s.vertices;n[0]=n[6]=e._width*-e.anchor.x,n[1]=n[3]=e._height*-e.anchor.y,n[2]=n[4]=e._width*(1-e.anchor.x),n[5]=n[7]=e._height*(1-e.anchor.y);const r=e.uvRespectAnchor?e.anchor.x:0,o=e.uvRespectAnchor?e.anchor.y:0;n=s.uvs,n[0]=n[6]=-r,n[1]=n[3]=-o,n[2]=n[4]=1-r,n[5]=n[7]=1-o,s.invalidate();const a=e._texture,h=a.baseTexture,l=h.alphaMode>0,c=e.tileTransform.localTransform,u=e.uvMatrix;let f=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;f&&(h._glTextures[t.CONTEXT_UID]?f=h.wrapMode!==us.CLAMP:h.wrapMode===us.CLAMP&&(h.wrapMode=us.REPEAT));const d=f?this.simpleShader:this.shader,m=a.width,g=a.height,b=e._width,_=e._height;Za.set(c.a*m/b,c.b*m/_,c.c*g/b,c.d*g/_,c.tx/b,c.ty/_),Za.invert(),f?Za.prepend(u.mapCoord):(d.uniforms.uMapCoord=u.mapCoord.toArray(!0),d.uniforms.uClampFrame=u.uClampFrame,d.uniforms.uClampOffset=u.uClampOffset),d.uniforms.uTransform=Za.toArray(!0),d.uniforms.uColor=At.shared.setValue(e.tint).premultiply(e.worldAlpha,l).toArray(d.uniforms.uColor),d.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),d.uniforms.uSampler=a,t.shader.bind(d),t.geometry.bind(s),this.state.blendMode=ev(e.blendMode,l),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}hy.extension={name:"tilingSprite",type:Oe.RendererPlugin};He.add(hy);const cy=class qo{constructor(e,t,s){this.linkedSheets=[],(e instanceof st||e instanceof et)&&(e={texture:e,data:t,resolutionFilename:s});const{texture:n,data:r,resolutionFilename:o=null,cachePrefix:a=""}=e;this.cachePrefix=a,this._texture=n instanceof et?n:null,this.baseTexture=n instanceof st?n:this._texture.baseTexture,this.textures={},this.animations={},this.data=r;const h=this.baseTexture.resource;this.resolution=this._updateResolution(o||(h?h.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(e=null){const{scale:t}=this.data.meta;let s=_n(e,null);return s===null&&(s=typeof t=="number"?t:parseFloat(t??"1")),s!==1&&this.baseTexture.setResolution(s),s}parse(){return new Promise(e=>{this._callback=e,this._batchIndex=0,this._frameKeys.length<=qo.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(e){let t=e;const s=qo.BATCH_SIZE;for(;t-e{this._batchIndex*qo.BATCH_SIZE{s[n]=e}),Object.keys(e.textures).forEach(n=>{s[`${e.cachePrefix}${n}`]=e.textures[n]}),!t){const n=zt.dirname(i[0]);e.linkedSheets.forEach((r,o)=>{Object.assign(s,uy([`${n}/${e.data.meta.related_multi_packs[o]}`],r,!0))})}return s}const aE={extension:Oe.Asset,cache:{test:i=>i instanceof Jm,getCacheableAssets:(i,e)=>uy(i,e,!1)},resolver:{test:i=>{const e=i.split("?")[0].split("."),t=e.pop(),s=e.pop();return t==="json"&&oE.includes(s)},parse:i=>{var t;const e=i.split(".");return{resolution:parseFloat(((t=Ve.RETINA_PREFIX.exec(i))==null?void 0:t[1])??"1"),format:e[e.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:Oe.LoadParser,priority:Yi.Normal},async testParse(i,e){return zt.extname(e.src).toLowerCase()===".json"&&!!i.frames},async parse(i,e,t){var c,u;const{texture:s,imageFilename:n,cachePrefix:r}=(e==null?void 0:e.data)??{};let o=zt.dirname(e.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let a;if(s&&s.baseTexture)a=s;else{const f=Vl(o+(n??i.meta.image),e.src);a=(await t.load([f]))[f]}const h=new Jm({texture:a.baseTexture,data:i,resolutionFilename:e.src,cachePrefix:r});await h.parse();const l=(c=i==null?void 0:i.meta)==null?void 0:c.related_multi_packs;if(Array.isArray(l)){const f=[];for(const m of l){if(typeof m!="string")continue;let g=o+m;(u=e.data)!=null&&u.ignoreMultiPack||(g=Vl(g,e.src),f.push(t.load({src:g,data:{ignoreMultiPack:!0}})))}const d=await Promise.all(f);h.linkedSheets=d,d.forEach(m=>{m.linkedSheets=[h].concat(h.linkedSheets.filter(g=>g!==m))})}return h},unload(i){i.destroy(!0)}}};He.add(aE);class Hl{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class xl{static test(e){return typeof e=="string"&&e.startsWith("info face=")}static parse(e){const t=e.match(/^[a-z]+\s+.+$/gm),s={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const r in t){const o=t[r].match(/^[a-z]+/gm)[0],a=t[r].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(const l in a){const c=a[l].split("="),u=c[0],f=c[1].replace(/"/gm,""),d=parseFloat(f),m=isNaN(d)?f:d;h[u]=m}s[o].push(h)}const n=new Hl;return s.info.forEach(r=>n.info.push({face:r.face,size:parseInt(r.size,10)})),s.common.forEach(r=>n.common.push({lineHeight:parseInt(r.lineHeight,10)})),s.page.forEach(r=>n.page.push({id:parseInt(r.id,10),file:r.file})),s.char.forEach(r=>n.char.push({id:parseInt(r.id,10),page:parseInt(r.page,10),x:parseInt(r.x,10),y:parseInt(r.y,10),width:parseInt(r.width,10),height:parseInt(r.height,10),xoffset:parseInt(r.xoffset,10),yoffset:parseInt(r.yoffset,10),xadvance:parseInt(r.xadvance,10)})),s.kerning.forEach(r=>n.kerning.push({first:parseInt(r.first,10),second:parseInt(r.second,10),amount:parseInt(r.amount,10)})),s.distanceField.forEach(r=>n.distanceField.push({distanceRange:parseInt(r.distanceRange,10),fieldType:r.fieldType})),n}}class bd{static test(e){const t=e;return typeof e!="string"&&"getElementsByTagName"in e&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(e){const t=new Hl,s=e.getElementsByTagName("info"),n=e.getElementsByTagName("common"),r=e.getElementsByTagName("page"),o=e.getElementsByTagName("char"),a=e.getElementsByTagName("kerning"),h=e.getElementsByTagName("distanceField");for(let l=0;l")?bd.test(Ve.ADAPTER.parseXML(e)):!1}static parse(e){return bd.parse(Ve.ADAPTER.parseXML(e))}}const yu=[xl,bd,wd];function lE(i){for(let e=0;e=h-B*o){if(g===0)throw new Error(`[BitmapFont] textureHeight ${h}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${E}')`);--I,b=null,_=null,M=null,g=0,m=0,v=0;continue}if(v=Math.max(B+C.fontProperties.descent,v),k*o+m>=f){if(m===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${E}')`);--I,g+=v*o,g=Math.ceil(g),m=0,v=0;continue}cE(b,_,C,m,g,o,u);const F=bl(C.text);d.char.push({id:F,page:S.length-1,x:m/o,y:g/o,width:k,height:B,xoffset:0,yoffset:0,xadvance:R-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),m+=(k+2*r)*o,m=Math.ceil(m)}if(!(s!=null&&s.skipKerning))for(let I=0,E=c.length;I 0.99) {\r alpha = 1.0;\r }\r \r // Gamma correction for coverage-like alpha\r float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r float gamma = mix(1.0, 1.0 / 2.2, luma);\r float coverage = pow(uColor.a * alpha, gamma); \r \r // NPM Textures, NPM outputs\r gl_FragColor = vec4(uColor.rgb, coverage);\r }\r `,fE=`// Mesh material default fragment\r attribute vec2 aVertexPosition;\r attribute vec2 aTextureCoord;\r \r uniform mat3 projectionMatrix;\r uniform mat3 translationMatrix;\r uniform mat3 uTextureMatrix;\r \r varying vec2 vTextureCoord;\r \r void main(void)\r {\r gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r \r vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r }\r `;const Qm=[],eg=[],tg=[],pE=class fy extends gi{constructor(e,t={}){super();const{align:s,tint:n,maxWidth:r,letterSpacing:o,fontName:a,fontSize:h}=Object.assign({},fy.styleDefaults,t);if(!Fn.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=s,this._tintColor=new At(n),this._font=void 0,this._fontName=a,this._fontSize=h,this.text=e,this._maxWidth=r,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new fn(()=>{this.dirty=!0},this,0,0),this._roundPixels=Ve.ROUND_PIXELS,this.dirty=!0,this._resolution=Ve.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){var k;const e=Fn.available[this._fontName],t=this.fontSize,s=t/e.size,n=new bt,r=[],o=[],a=[],h=this._text.replace(/(?:\r\n|\r)/g,` `)||" ",l=dy(h),c=this._maxWidth*e.size/t,u=e.distanceFieldType==="none"?Qm:eg;let f=null,d=0,m=0,g=0,b=-1,_=0,M=0,v=0,S=0;for(let F=0;F0&&n.x>c&&(++M,ao(r,1+b-M,1+F-b),F=b,b=-1,o.push(_),a.push(r.length>0?r[r.length-1].prevSpaces:0),m=Math.max(m,_),g++,n.x=0,n.y+=e.lineHeight,f=null,S=0)}const y=l[l.length-1];y!=="\r"&&y!==` `&&(/(?:\s)/.test(y)&&(d=_),o.push(d),m=Math.max(m,d),a.push(-1));const I=[];for(let F=0;F<=g;F++){let D=0;this._align==="right"?D=m-o[F]:this._align==="center"?D=(m-o[F])/2:this._align==="justify"&&(D=a[F]<0?0:(m-o[F])/a[F]),I.push(D)}const E=r.length,C={},R=[],B=this._activePagesMeshData;u.push(...B);for(let F=0;F6*N)||D.vertices.lengtht[n.mesh.texture.baseTexture.uid]).forEach(n=>{n.mesh.texture=et.EMPTY});for(const n in t)t[n].destroy(),delete t[n];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(e)}};pE.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const mE=[".xml",".fnt"],gE={extension:{type:Oe.LoadParser,priority:Yi.Normal},name:"loadBitmapFont",test(i){return mE.includes(zt.extname(i).toLowerCase())},async testParse(i){return xl.test(i)||wd.test(i)},async parse(i,e,t){const s=xl.test(i)?xl.parse(i):wd.parse(i),{src:n}=e,{page:r}=s,o=[];for(let l=0;la[l]);return Fn.install(s,h,!0)},async load(i,e){return(await Ve.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};He.add(gE);const _d=class qr extends Kn{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(e){return new qr(Object.keys(qr.defaultOptions).reduce((t,s)=>({...t,[s]:e[s]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(e=>{URL.revokeObjectURL(e.src),e.refs--,e.refs===0&&(e.fontFace&&document.fonts.delete(e.fontFace),delete qr.availableFonts[e.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(e,t={}){const{availableFonts:s}=qr;if(s[e]){const n=s[e];return this._fonts.push(n),n.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return Ve.ADAPTER.fetch(e).then(n=>n.blob()).then(async n=>new Promise((r,o)=>{const a=URL.createObjectURL(n),h=new FileReader;h.onload=()=>r([a,h.result]),h.onerror=o,h.readAsDataURL(n)})).then(async([n,r])=>{const o=Object.assign({family:zt.basename(e,zt.extname(e)),weight:"normal",style:"normal",display:"auto",src:n,dataSrc:r,refs:1,originalUrl:e,fontFace:null},t);s[e]=o,this._fonts.push(o),this.styleID++;const a=new FontFace(o.family,`url(${o.src})`,{weight:o.weight,style:o.style,display:o.display});o.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...e){const t=e.filter(s=>!this._overrides.includes(s));t.length>0&&(this._overrides.push(...t),this.styleID++)}removeOverride(...e){const t=e.filter(s=>this._overrides.includes(s));t.length>0&&(this._overrides=this._overrides.filter(s=>!t.includes(s)),this.styleID++)}toCSS(e){return[`transform: scale(${e})`,"transform-origin: top left","display: inline-block",`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?"break-all":"break-word"}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,"paint-order: stroke"]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(";")}toGlobalCSS(){return this._fonts.reduce((e,t)=>`${e} @font-face { font-family: "${t.family}"; src: url('${t.dataSrc}'); font-weight: ${t.weight}; font-style: ${t.style}; font-display: ${t.display}; }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(e){this._stylesheet!==e&&(this._stylesheet=e,this.styleID++)}normalizeColor(e){return Array.isArray(e)&&(e=o_(e)),typeof e=="number"?r_(e):e}dropShadowToCSS(){let e=this.normalizeColor(this.dropShadowColor);const t=this.dropShadowAlpha,s=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),n=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);e.startsWith("#")&&t<1&&(e+=(t*255|0).toString(16).padStart(2,"0"));const r=`${s}px ${n}px`;return this.dropShadowBlur>0?`text-shadow: ${r} ${this.dropShadowBlur}px ${e}`:`text-shadow: ${r} ${e}`}reset(){Object.assign(this,qr.defaultOptions)}onBeforeDraw(){const{fontsDirty:e}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&e?new Promise(t=>setTimeout(t,100)):Promise.resolve()}get isSafari(){const{userAgent:e}=Ve.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(e)}set fillGradientStops(e){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(e){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(e){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(e){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(e){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(e){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(e){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};_d.availableFonts={},_d.defaultOptions={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,padding:0,stroke:"black",strokeThickness:0,whiteSpace:"normal",wordWrap:!1,wordWrapWidth:100};let xu=_d;const Ja=class Kr extends Qn{constructor(e="",t={}){super(et.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;const s=new Image,n=et.from(s,{scaleMode:Ve.SCALE_MODE,resourceOptions:{autoLoad:!1}});n.orig=new lt,n.trim=new lt,this.texture=n;const r="http://www.w3.org/2000/svg",o="http://www.w3.org/1999/xhtml",a=document.createElementNS(r,"svg"),h=document.createElementNS(r,"foreignObject"),l=document.createElementNS(o,"div"),c=document.createElementNS(o,"style");h.setAttribute("width","10000"),h.setAttribute("height","10000"),h.style.overflow="hidden",a.appendChild(h),this.maxWidth=Kr.defaultMaxWidth,this.maxHeight=Kr.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=a,this._foreignObject=h,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=s,this._loadImage=new Image,this._autoResolution=Kr.defaultAutoResolution,this._resolution=Kr.defaultResolution??Ve.RESOLUTION,this.text=e,this.style=t}measureText(e){var c,u;const{text:t,style:s,resolution:n}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},e);Object.assign(this._domElement,{innerHTML:t,style:s.toCSS(n)}),this._styleElement.textContent=s.toGlobalCSS(),document.body.appendChild(this._svgRoot);const r=this._domElement.getBoundingClientRect();this._svgRoot.remove();const{width:o,height:a}=r;(o>this.maxWidth||a>this.maxHeight)&&console.warn("[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.");const h=Math.min(this.maxWidth,Math.ceil(o)),l=Math.min(this.maxHeight,Math.ceil(a));return this._svgRoot.setAttribute("width",h.toString()),this._svgRoot.setAttribute("height",l.toString()),t!==this._text&&(this._domElement.innerHTML=this._text),s!==this._style&&(Object.assign(this._domElement,{style:(c=this._style)==null?void 0:c.toCSS(n)}),this._styleElement.textContent=(u=this._style)==null?void 0:u.toGlobalCSS()),{width:h+s.padding*2,height:l+s.padding*2}}async updateText(e=!0){const{style:t,_image:s,_loadImage:n}=this;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;const{width:r,height:o}=this.measureText();s.width=n.width=Math.ceil(Math.max(1,r)),s.height=n.height=Math.ceil(Math.max(1,o)),this._updateID++;const a=this._updateID;await new Promise(h=>{n.onload=async()=>{if(a/gi,"

").replace(/
/gi,"
").replace(/ /gi," ")}};Ja.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Ja.defaultMaxWidth=2024,Ja.defaultMaxHeight=2024,Ja.defaultAutoResolution=!0;function ga(){return{texture:null,imageResources:[{id:1,texture:null,textureName:"star",textureFolder:"",previewUrl:"/images/star.png",imageMode:"fixed",sequencePlayback:"loop-forward",sequenceFps:30,sequenceFrames:[],weight:100,locked:!1,scale:1,anchorX:.5,anchorY:.5,colorMode:"fixed",colorStart:"#ffffff",colorEnd:"#ff4d4d",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],blend:"normal",independentAlpha:"off",alpha:1,alphaCurveMode:"跟随导出",alphaCurve:[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}]}],imageWeightVersion:1,name:"ParticleSystem1",mode:"stream",rate:20,streamBehavior:"normal",loopDurationFrames:30,generateLoopStartAnimation:!1,generateLoopEndAnimation:!1,burstCount:50,burstLoop:!1,delay:0,duration:1,shape:"point",radius:30,rectW:60,rectH:40,centerX:0,centerY:0,rootRotation:0,rootScaleX:1,rootScaleY:1,direction:0,spread:360,coneAngle:60,lifeMin:.6,lifeMax:1.8,lifeMode:"random",lifeCurve:[{x:0,y:0},{x:1,y:1}],speedMin:30,speedMax:140,speedMode:"random",speedCurve:[{x:0,y:0},{x:1,y:1}],scaleMin:.3,scaleMax:.8,scaleMode:"random",scaleAxisMode:"uniform",scaleYMin:.3,scaleYMax:.8,scaleCurve:[{x:0,y:0},{x:1,y:1}],scaleYCurve:[{x:0,y:0},{x:1,y:1}],scaleEndRatio:.3,initialRotationMode:"random",initialRotationMin:0,initialRotationMax:360,initialRotationCurve:[{x:0,y:0},{x:1,y:1}],alpha:.9,alphaEnd:0,rotationSpeedMin:-180,rotationSpeedMax:180,speedOverLifeEnabled:!1,speedOverLifeMode:"fixed",speedOverLifeMin:1,speedOverLifeMax:1,speedOverLifeCurve:[{x:0,y:1},{x:1,y:1}],scaleOverLifeEnabled:!1,scaleOverLifeMode:"curve",scaleOverLifeAxisMode:"uniform",scaleOverLifeMin:0,scaleOverLifeMax:1,scaleYOverLifeMin:0,scaleYOverLifeMax:1,scaleOverLifeCurve:[{x:0,y:1},{x:1,y:1}],scaleYOverLifeCurve:[{x:0,y:1},{x:1,y:1}],rotationOverLifeEnabled:!1,rotationOverLifeMode:"random",rotationOverLifeCurve:[{x:0,y:0},{x:1,y:1}],gravity:980,gravityMode:"fixed",gravityMin:980,gravityMax:980,gravityDirection:-90,gravityCurve:[{x:0,y:1},{x:1,y:1}],damping:0,seed:0,colorStart:"#ffffff",colorEnd:"#ff4d4d",colorOverLife:!1,blend:"add",alphaMode:"curve",curveMode:"线性",alphaCurve:[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],textureName:"star",textureFolder:"",alphaScale:1,anchorX:.5,anchorY:.5,independentAlpha:"off",offsetX:0,offsetY:0,noise:!1,noiseAmt:30,noiseRange:100,noiseSpeed:1,useGravity:!1,wind:!1,windX:0,windY:0,windMode:"fixed",windMin:100,windMax:100,windDirection:0,windCurve:[{x:0,y:1},{x:1,y:1}],forceField:!1,forceStrength:10,forceRadius:100,forceCenterX:0,forceCenterY:0,forceFalloff:"linear",attraction:!1,attractionCenterX:200,attractionCenterY:0,attractionRadius:20,attractionDuration:.5,attractionDelay:.1,attractionDelayMode:"particle",attractionPath:"curve",trail:!1,trailConfigVersion:3,trailResources:[{id:1,texture:null,textureName:"trail",previewUrl:"/images/trail.png",weight:100,locked:!1,rotation:0,colorMode:"particle",color:"#ffffff",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],blend:"normal",alphaMode:"particle",alpha:1,alphaCurve:[{x:0,y:1},{x:1,y:1}],boneCount:3,trailRatio:100,lengthMode:"fixed",length:100,lengthMin:100,lengthMax:100,widthSizeMode:"fixed",width:100,widthMin:100,widthMax:100,widthMode:"particle",lifeLengthEnabled:!1,lifeLengthCurve:[{x:0,y:1},{x:1,y:1}],shapeEnabled:!1,shapeCurve:[{x:0,y:1},{x:1,y:1}]}],trailResourceVersion:6,trailTexture:null,trailTextureName:"trail",trailPreviewUrl:"/images/trail.png",trailColorMode:"particle",trailColor:"#ffffff",trailColorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],trailAlphaMode:"particle",trailAlpha:1,trailAlphaCurve:[{x:0,y:1},{x:1,y:1}],trailBoneCount:3,trailLength:100,trailWidth:100,trailWidthMode:"particle",trailLifeLengthEnabled:!1,trailLifeLengthCurve:[{x:0,y:1},{x:1,y:1}],trailShapeEnabled:!1,trailShapeCurve:[{x:0,y:1},{x:1,y:1}],trailGridRows:4,trailGridCols:4,collision:!1,pathFollow:!1,emitterFollow:!1,emitterFollowMode:"none",emitterFollowPathId:0,emitterFollowSpineId:0,emitterFollowBoneName:"",emitterFollowBoneOffsetX:0,emitterFollowBoneOffsetY:0,emitterFollowBoneRotation:0,emitterFollowBoneScaleX:1,emitterFollowBoneScaleY:1,emitterAngleMode:"fixed",emitterFollowCurve:[{x:0,y:0},{x:1,y:1}],emitterFollowDuration:2,emitterFollowSpace:"world",emitterFollowDirection:"forward",emitterFollowOffset:0}}function Tr(i){var M;const e=ga(),t=i,s=t.imageWeightVersion!==1,n=t.loopDurationFrames==null,r=t.gravityMode==null,o=Number(t.gravity),a=t.windMode==null,h=Number(t.windX),l=Number(t.windY),c=t.forceFalloff==null,u=Number(t.forceStrength),f=t.trailConfigVersion!==3,d=!Array.isArray(t.trailResources),m=t.trailResourceVersion!==6,g=t.trailTexture,b=String(t.trailTextureName||"trail"),_=String(t.trailPreviewUrl||"/images/trail.png").replace("/trails/trail.png","/images/trail.png");for(const[v,S]of Object.entries(e))t[v]!==void 0&&t[v]!==null||(t[v]=Array.isArray(S)?S.map(y=>typeof y=="object"&&y!==null?{...y}:y):S);i.streamBehavior!=="normal"&&i.streamBehavior!=="loop"&&(i.streamBehavior="normal"),(n||!Number.isFinite(i.loopDurationFrames))&&(i.loopDurationFrames=Math.ceil(Math.max(1/30,Number(i.duration)||1)*30)),i.loopDurationFrames=Math.min(1800,Math.max(1,Math.ceil(i.loopDurationFrames))),typeof i.generateLoopStartAnimation!="boolean"&&(i.generateLoopStartAnimation=!1),typeof i.generateLoopEndAnimation!="boolean"&&(i.generateLoopEndAnimation=!1),i.generateLoopStartAnimation&&i.generateLoopEndAnimation&&(i.generateLoopEndAnimation=!1),(!Array.isArray(i.imageResources)||i.imageResources.length===0)&&(i.imageResources=ga().imageResources);for(const v of i.imageResources){!v.texture&&i.texture&&(v.texture=i.texture),v.textureName||(v.textureName="star"),v.previewUrl==="/particles/star.png"&&(v.previewUrl="/images/star.png"),v.previewUrl||(v.previewUrl=v.textureName==="star"?"/images/star.png":""),v.imageMode!=="fixed"&&v.imageMode!=="sequence"&&(v.imageMode="fixed"),v.sequencePlayback==="once"?v.sequencePlayback="once-hold":v.sequencePlayback==="loop"?v.sequencePlayback="loop-forward":["once-hide","once-hold","loop-forward","loop-reverse"].includes(v.sequencePlayback)||(v.sequencePlayback="loop-forward"),Number.isFinite(v.sequenceFps)||(v.sequenceFps=30),v.sequenceFps=Math.min(120,Math.max(1,Number(v.sequenceFps)||30)),Array.isArray(v.sequenceFrames)||(v.sequenceFrames=[]);for(const S of v.sequenceFrames)typeof S.name!="string"&&(S.name=""),typeof S.previewUrl!="string"&&(S.previewUrl=""),S.texture===void 0&&(S.texture=null);Number.isFinite(v.weight)||(v.weight=100),typeof v.locked!="boolean"&&(v.locked=!1),Number.isFinite(v.scale)||(v.scale=1),Number.isFinite(v.anchorX)||(v.anchorX=.5),Number.isFinite(v.anchorY)||(v.anchorY=.5),v.colorMode!=="fixed"&&v.colorMode!=="lifetime"&&(v.colorMode=i.colorOverLife?"lifetime":"fixed"),v.colorStart||(v.colorStart=i.colorStart||"#ffffff"),v.colorEnd||(v.colorEnd=i.colorEnd||v.colorStart),(!Array.isArray(v.colorGradient)||v.colorGradient.length<2)&&(v.colorGradient=[{position:0,color:v.colorStart},{position:1,color:v.colorEnd}]),Object.prototype.hasOwnProperty.call(Dn,v.blend)||(v.blend=i.blend||"normal"),["off","fixed","curve"].includes(v.independentAlpha)||(v.independentAlpha=i.independentAlpha||"off"),Number.isFinite(v.alpha)||(v.alpha=Number.isFinite(i.alphaScale)?i.alphaScale:1),["跟随导出","线性","贝塞尔"].includes(v.alphaCurveMode)||(v.alphaCurveMode=i.curveMode||"跟随导出"),(!Array.isArray(v.alphaCurve)||v.alphaCurve.length<2)&&(v.alphaCurve=(i.alphaCurve||[{x:0,y:1},{x:1,y:1}]).map(S=>({...S})))}if(i.imageResources.length===1)i.imageResources[0].weight=100,i.imageResources[0].locked=!1;else if(s){const v=100/i.imageResources.length;i.imageResources.forEach((S,y)=>{S.weight=y===i.imageResources.length-1?100-v*(i.imageResources.length-1):v,S.locked=!1})}if(i.imageWeightVersion=1,r){const v=Number.isFinite(o)&&o!==0?o:980;i.gravity=v,i.gravityMin=v,i.gravityMax=v}if(a){const v=Number.isFinite(h)&&Number.isFinite(l)&&(h!==0||l!==0);i.windMin=v?Math.hypot(h,l):100,i.windMax=i.windMin,i.windDirection=v?Math.atan2(-l,h)*180/Math.PI:0}c&&(i.forceStrength=Number.isFinite(u)&&u!==0?u:10),f&&(i.trailConfigVersion=3,i.trailAlphaCurve=[{x:0,y:1},{x:1,y:1}],i.trailLifeLengthCurve=[{x:0,y:1},{x:1,y:1}],i.trailShapeCurve=[{x:0,y:1},{x:1,y:1}],i.trailGridRows=4,i.trailGridCols=4),(d||!i.trailResources.length)&&(i.trailResources=[{id:1,texture:g||null,textureName:b,previewUrl:_,weight:100,locked:!1,rotation:0,colorMode:i.trailColorMode,color:i.trailColor,colorGradient:i.trailColorGradient.map(v=>({...v})),blend:"normal",alphaMode:i.trailAlphaMode,alpha:i.trailAlpha,alphaCurve:i.trailAlphaCurve.map(v=>({...v})),boneCount:i.trailBoneCount,trailRatio:100,lengthMode:"fixed",length:i.trailLength,lengthMin:i.trailLength,lengthMax:i.trailLength,widthSizeMode:"fixed",width:i.trailWidth,widthMin:i.trailWidth,widthMax:i.trailWidth,widthMode:i.trailWidthMode,lifeLengthEnabled:i.trailLifeLengthEnabled,lifeLengthCurve:i.trailLifeLengthCurve.map(v=>({...v})),shapeEnabled:i.trailShapeEnabled,shapeCurve:i.trailShapeCurve.map(v=>({...v}))}]);for(const v of i.trailResources)v.textureName||(v.textureName="trail"),v.previewUrl==="/trails/trail.png"&&(v.previewUrl="/images/trail.png"),v.previewUrl||(v.previewUrl="/images/trail.png"),Number.isFinite(v.weight)||(v.weight=100),typeof v.locked!="boolean"&&(v.locked=!1),Number.isFinite(v.rotation)||(v.rotation=0),["particle","fixed","curve"].includes(v.colorMode)||(v.colorMode=i.trailColorMode||"particle"),v.color||(v.color=i.trailColor||"#ffffff"),(!Array.isArray(v.colorGradient)||v.colorGradient.length<2)&&(v.colorGradient=(i.trailColorGradient||[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}]).map(S=>({...S}))),Object.prototype.hasOwnProperty.call(Dn,v.blend)||(v.blend="normal"),["particle","fixed","curve"].includes(v.alphaMode)||(v.alphaMode=i.trailAlphaMode||"particle"),Number.isFinite(v.alpha)||(v.alpha=Number.isFinite(i.trailAlpha)?i.trailAlpha:1),(!Array.isArray(v.alphaCurve)||v.alphaCurve.length<2)&&(v.alphaCurve=(i.trailAlphaCurve||[{x:0,y:1},{x:1,y:1}]).map(S=>({...S}))),Number.isFinite(v.boneCount)||(v.boneCount=Number.isFinite(i.trailBoneCount)?i.trailBoneCount:3),Number.isFinite(v.trailRatio)||(v.trailRatio=100),v.trailRatio=Math.min(100,Math.max(0,v.trailRatio)),["fixed","random"].includes(v.lengthMode)||(v.lengthMode="fixed"),Number.isFinite(v.length)||(v.length=Number.isFinite(i.trailLength)?i.trailLength:100),Number.isFinite(v.lengthMin)||(v.lengthMin=v.length),Number.isFinite(v.lengthMax)||(v.lengthMax=v.length),["fixed","random"].includes(v.widthSizeMode)||(v.widthSizeMode="fixed"),Number.isFinite(v.width)||(v.width=Number.isFinite(i.trailWidth)?i.trailWidth:100),Number.isFinite(v.widthMin)||(v.widthMin=v.width),Number.isFinite(v.widthMax)||(v.widthMax=v.width),["particle","fixed"].includes(v.widthMode)||(v.widthMode=i.trailWidthMode||"particle"),typeof v.lifeLengthEnabled!="boolean"&&(v.lifeLengthEnabled=!!i.trailLifeLengthEnabled),(!Array.isArray(v.lifeLengthCurve)||v.lifeLengthCurve.length<2)&&(v.lifeLengthCurve=(i.trailLifeLengthCurve||[{x:0,y:1},{x:1,y:1}]).map(S=>({...S}))),typeof v.shapeEnabled!="boolean"&&(v.shapeEnabled=!!i.trailShapeEnabled),(!Array.isArray(v.shapeCurve)||v.shapeCurve.length<2)&&(v.shapeCurve=(i.trailShapeCurve||[{x:0,y:1},{x:1,y:1}]).map(S=>({...S})));if(i.trailResources.length===1&&(i.trailResources[0].weight=100,i.trailResources[0].locked=!1),m)for(const v of i.trailResources)v.alphaCurve=((M=v.alphaCurve)==null?void 0:M.length)>=2?v.alphaCurve:[{x:0,y:1},{x:1,y:1}];return i.trailResourceVersion=6,i}const Dn={normal:0,add:1,multiply:2,screen:3},vE=400;class yE extends gi{constructor(t,s=vE){super();A(this,"pool",[]);A(this,"cfg");A(this,"accumulator",0);A(this,"burstTimer",0);A(this,"_spawnSerial",0);A(this,"_elapsed",0);A(this,"_attractionEnabledAt",0);A(this,"_attractionWasEnabled",!1);A(this,"_emitterPos",null);A(this,"states",[]);A(this,"rng",Math.random);A(this,"_lastSeed",-1);A(this,"trailDebugGfx",new Ri);A(this,"colliders",[]);A(this,"followSpawnX",0);A(this,"followSpawnY",0);A(this,"followSpawnAngle",0);A(this,"followExportCurveMode","线性");A(this,"simulationTransform",null);this.cfg=Tr(t),this._ensurePool(s),this.addChild(this.trailDebugGfx)}setFollowExportCurveMode(t){this.followExportCurveMode=t}resolveCurveMode(t){return t==="跟随导出"?this.followExportCurveMode:t}reseed(){const t=this.cfg.seed;t!==this._lastSeed&&(this._lastSeed=t,this.rng=wu(t>>>0))}_ensurePool(t){for(;this.pool.length=n.delay),o=s==="force"||s==="normal"&&(n.mode==="burst"||this._elapsed=1;)this.accumulator-=1,this.spawnOne();else this.burstTimer+=t,n.burstLoop?this.burstTimer>=1&&(this.burstTimer=0,this.emitBurst()):t>0&&this.burstTimer<=t&&this.emitBurst();const a=[];for(let m=0;m0){const P=Math.max(1e-4,Math.abs(n.rootScaleX)),X=Math.max(1e-4,Math.abs(n.rootScaleY)),U=-(((h=this.simulationTransform)==null?void 0:h.rotation)??n.rootRotation)*Math.PI/180,Y=Math.cos(U),q=Math.sin(U),z=((l=this.simulationTransform)==null?void 0:l.centerX)??n.centerX,ne=((c=this.simulationTransform)==null?void 0:c.centerY)??n.centerY,H=z+Y*P*g.x-q*X*g.y,Z=-ne+q*P*g.x+Y*X*g.y,ae=H,me=-Z,_e=n.forceCenterX-ae,te=n.forceCenterY-me,ve=Math.hypot(_e,te);if(ve>1e-4&&ve<=n.forceRadius){let $=1;n.forceFalloff==="linear"?$=1-ve/n.forceRadius:n.forceFalloff==="inverse"&&($=Math.min(10,n.forceRadius/Math.max(ve,n.forceRadius*.1)));const W=n.forceStrength*$*10,J=_e/ve*W,Q=te/ve*W,ie=J,ue=-Q;g.vx+=(Y*ie+q*ue)/P*t,g.vy+=(-q*ie+Y*ue)/X*t}}if(!g.collisionPaused&&n.damping>0){const P=Math.max(0,1-n.damping*t);g.vx*=P,g.vy*=P}if(g.collisionPaused)g.vx=0,g.vy=0;else if(g.x+=g.vx*t,g.y+=g.vy*t,this.applyColliders(g,m))continue;if(n.attraction&&!g.collisionPaused){const P=g.maxLife-g.life;if(n.attractionDelayMode==="particle"?P>=Math.max(0,n.attractionDelay):this._elapsed-this._attractionEnabledAt>=Math.max(0,n.attractionDelay)){const U=Ur(n,g.x,g.y,this.simulationTransform),Y=n.attractionCenterX,q=n.attractionCenterY,z=Math.max(0,n.attractionRadius);if(!g.attractionActive){if(Math.hypot(Y-U.x,q-U.y)<=z){this.kill(m);continue}g.attractionActive=!0,g.attractionElapsed=0,g.attractionStartWorldX=U.x,g.attractionStartWorldY=U.y}g.attractionElapsed+=t;const ne=Math.max(1e-4,n.attractionDuration),H=Math.min(1,g.attractionElapsed/ne);let Z=ni(g.attractionStartWorldX,Y,H),ae=ni(g.attractionStartWorldY,q,H);if(n.attractionPath==="curve"){const te=Y-g.attractionStartWorldX,ve=q-g.attractionStartWorldY,$=Math.hypot(te,ve);if($>1e-4){const W=$*.25*g.attractionCurveSide,J=(g.attractionStartWorldX+Y)*.5-ve/$*W,Q=(g.attractionStartWorldY+q)*.5+te/$*W,ie=1-H;Z=ie*ie*g.attractionStartWorldX+2*ie*H*J+H*H*Y,ae=ie*ie*g.attractionStartWorldY+2*ie*H*Q+H*H*q}}const me=Math.hypot(Y-Z,q-ae);if(H>=1||me<=z){this.kill(m);continue}const _e=ig(n,Z,ae,this.simulationTransform);g.x=_e.x,g.y=_e.y,g.vx=0,g.vy=0}}const _=b,M=g.sprite,v=n.imageResources.find(P=>P.id===g.resourceId);if(v){const P=this.imageFrameState(v,g.maxLife-g.life);g.imageFrameIndex=P.index,M.texture=this.imageFrameTexture(v,g.imageFrameIndex),M.visible=P.visible}if(n.speedOverLifeEnabled){const P=Qa(bu(n.speedOverLifeMode,n.speedOverLifeMin,n.speedOverLifeMax,n.speedOverLifeCurve,_,g.speedScaleTarget),1),X=g.speedScale===0?P:P/g.speedScale;g.vx*=X,g.vy*=X,g.speedScale=P}let S=g.rotationSpeed;n.rotationOverLifeEnabled&&n.rotationOverLifeMode==="curve"&&(S=ni(n.rotationSpeedMin,n.rotationSpeedMax,Ps(n.rotationOverLifeCurve,_))),g.rotation+=S*t;let y=g.x,I=g.y;if(n.noise&&n.noiseAmt>0&&n.noiseRange>0&&n.noiseSpeed>0){const P=g.maxLife-g.life,X=Math.max(0,n.noiseRange)*Math.min(1,Math.max(0,n.noiseAmt)/100)*.5,U=P*Math.max(0,n.noiseSpeed)*Math.PI*2;y+=(Math.sin(g.noisePhaseX+U)-Math.sin(g.noisePhaseX))*X,I+=(Math.sin(g.noisePhaseY+U*.83)-Math.sin(g.noisePhaseY))*X}M.x=y,M.y=I,M.rotation=-g.rotation*Math.PI/180;let E=1,C=1;n.scaleOverLifeEnabled&&(E=bu(n.scaleOverLifeMode,n.scaleOverLifeMin,n.scaleOverLifeMax,n.scaleOverLifeCurve,_,g.scaleOverLifeX),C=n.scaleOverLifeAxisMode==="separate"?bu(n.scaleOverLifeMode,n.scaleYOverLifeMin,n.scaleYOverLifeMax,n.scaleYOverLifeCurve,_,g.scaleOverLifeY):E),M.scale.set(Qa(g.scaleStartX*E,1),Qa(g.scaleStartY*C,1));const R=n.alphaMode==="curve"?Ps(n.alphaCurve,_,this.resolveCurveMode(n.curveMode))*n.alphaScale:n.alpha*n.alphaScale;M.alpha=Qa((v==null?void 0:v.independentAlpha)==="fixed"?v.alpha:(v==null?void 0:v.independentAlpha)==="curve"?Ps(v.alphaCurve,_,this.resolveCurveMode(v.alphaCurveMode)):R,1);const B=(v==null?void 0:v.colorStart)||"#ffffff",k=(v==null?void 0:v.colorMode)==="lifetime"?ng(v.colorGradient,_):fo(B);M.tint=k,M.blendMode=Dn[(v==null?void 0:v.blend)||"normal"];const F=this.updateTrail(g,y,I,_,M),D=Ur(n,y,I,this.simulationTransform),N=((u=this.simulationTransform)==null?void 0:u.rotation)??n.rootRotation,j=Math.abs(((f=this.simulationTransform)==null?void 0:f.scaleX)??n.rootScaleX),O=Math.abs(((d=this.simulationTransform)==null?void 0:d.scaleY)??n.rootScaleY),L=F?{...F,bones:F.bones.map(P=>{const X=Ur(n,P.x,P.y,this.simulationTransform);return{...P,worldX:X.x,worldY:X.y,worldRotation:N-P.rotation}})}:void 0;a.push({boneName:g.boneName,spawnId:g.spawnId,x:y,y:I,rotation:g.rotation,scaleX:M.scale.x,scaleY:M.scale.y,worldX:D.x,worldY:D.y,worldRotation:N+g.rotation,worldScaleX:M.scale.x*j,worldScaleY:M.scale.y*O,alpha:M.alpha,colorHex:k,resourceId:g.resourceId,imageFrameIndex:g.imageFrameIndex,imageVisible:M.visible,trailState:L,active:!0})}return this.states=a,a}ensureTrailMesh(t){const s=this.cfg,n=s.trailResources.find(b=>b.id===t.trailResourceId)||s.trailResources[0],r=(n==null?void 0:n.texture)||et.EMPTY,o=Number(n==null?void 0:n.rotation)||0,a=Math.max(2,Math.min(16,Math.round(s.trailGridRows))),h=Math.max(2,Math.min(32,Math.round(s.trailGridCols))),l=Math.max(2,Math.min(16,Math.round((n==null?void 0:n.boneCount)??3))),c=`${a}:${h}:${l}:${(n==null?void 0:n.id)??0}:${o}`;if(t.trailMesh&&t.trailMeshSignature===c)return t.trailMesh.texture!==r&&(t.trailMesh.texture=r),t.trailMesh;t.trailMesh&&(this.removeChild(t.trailMesh),t.trailMesh.destroy()),t.trailMeshSignature&&t.trailMeshSignature!==c&&(t.trailHistory.length=0,t.trailBones.length=0);const u=new Float32Array(a*h*2),f=new Float32Array(a*h*2),d=[],m=[];for(let b=0;b.05?t.trailHistory.unshift({x:s,y:n}):(o.x=s,o.y=n);const a=Math.max(1,r)*1.5;let h=0,l=t.trailHistory.length;for(let c=1;c=a||c>=239){l=c+1;break}t.trailHistory.length>l&&(t.trailHistory.length=l)}sampleTrailBones(t,s,n){const r=Math.max(2,Math.min(16,Math.round(n))),o=t.trailHistory,a=[];if(!o.length)return a;let h=0;for(let c=1;c=u&&_>1e-4){const M=(u-f)/_;d={x:ni(g.x,b.x,M),y:ni(g.y,b.y,M)};break}f+=_}a.push({boneName:`${t.boneName}_trail_${c}`,x:d.x,y:d.y,rotation:0})}for(let c=0;c1){const c=a[0].rotation,f=(a[a.length-1].rotation-c+540)%360-180;for(let d=0;du.id===s.resourceId)||r.trailResources[0];if(!(o!=null&&o.texture)||s.bones.length<2){n.visible=!1;return}t.trailResourceId=o.id,n.texture!==o.texture&&(n.texture=o.texture);const a=Math.max(2,Math.min(16,Math.round(r.trailGridRows))),h=Math.max(2,Math.min(32,Math.round(r.trailGridCols))),l=n.vertices,c=[];for(let u=0;u.5&&s.alpha>0}updateTrail(t,s,n,r,o){const a=this.cfg;if(!a.trail||!t.trailEnabled||t.trailSampledLength<=0||t.trailSampledWidth<=0){t.trailHistory.length=0,t.trailBones.length=0,t.trailMesh&&(t.trailMesh.visible=!1);return}this.ensureTrailMesh(t);const h=a.trailResources.find(d=>d.id===t.trailResourceId)||a.trailResources[0];this.appendTrailPoint(t,s,n,t.trailSampledLength);const l=h!=null&&h.lifeLengthEnabled?Math.max(0,Ps(h.lifeLengthCurve,r)):1,c=Math.max(0,t.trailSampledLength)*l;t.trailBones=this.sampleTrailBones(t,c,(h==null?void 0:h.boneCount)??3),t.trailBones[0]&&(t.trailBones[0].x=s,t.trailBones[0].y=n);const u=(h==null?void 0:h.widthMode)==="particle"?(Math.abs(o.scale.x)+Math.abs(o.scale.y))*.5:1;t.trailCurrentWidth=Math.max(0,t.trailSampledWidth)*u,t.trailCurrentAlpha=(h==null?void 0:h.alphaMode)==="particle"?o.alpha:(h==null?void 0:h.alphaMode)==="curve"?Ps(h.alphaCurve,r):(h==null?void 0:h.alpha)??1,t.trailCurrentColor=(h==null?void 0:h.colorMode)==="particle"?o.tint:(h==null?void 0:h.colorMode)==="curve"?ng(h.colorGradient,r):fo((h==null?void 0:h.color)||"#ffffff");const f={bones:t.trailBones.map(d=>({...d})),activeBoneCount:t.trailBones.length,width:t.trailCurrentWidth,alpha:Math.min(1,Math.max(0,t.trailCurrentAlpha)),colorHex:t.trailCurrentColor,resourceId:t.trailResourceId};return this.skinTrailMesh(t,f),f}drawTrailMeshDebug(t){const s=this.trailDebugGfx;if(s.clear(),!t||!this.cfg.trail)return;const n=Math.max(2,Math.min(16,Math.round(this.cfg.trailGridRows))),r=Math.max(2,Math.min(32,Math.round(this.cfg.trailGridCols)));s.lineStyle(1,3790847,.72);for(const o of this.pool){const a=o.trailMesh;if(!(a!=null&&a.visible))continue;const h=a.vertices,l=(c,u)=>{const f=(c*n+u)*2;return{x:h[f],y:h[f+1]}};for(let c=0;c!v.active);if(s===-1)return;const{x:n,y:r}=this.spawnOrigin(),o=Xr(t.lifeMode,t.lifeMin,t.lifeMax,t.lifeCurve,this.rng()),a=Xr(t.speedMode,t.speedMin,t.speedMax,t.speedCurve,this.rng());let h;t.shape==="cone"?h=(t.direction+this.followSpawnAngle+ni(-t.coneAngle/2,t.coneAngle/2,this.rng()))*Math.PI/180:h=(t.direction+this.followSpawnAngle+ni(-t.spread/2,t.spread/2,this.rng()))*Math.PI/180;const l=this.pool[s],c=this.pickImageResource(),u=this._spawnSerial++;l.spawnId=u;const f=this.pickTrailResource(Vr(t.seed,u,1540483477));l.noisePhaseX=Vr(t.seed,u,1757159915)*Math.PI*2,l.noisePhaseY=Vr(t.seed,u,48610963)*Math.PI*2,l.gravityStrength=t.useGravity&&t.gravityMode==="random"?ni(t.gravityMin,t.gravityMax,this.rng()):t.gravityMin,l.windStrength=t.wind&&t.windMode==="random"?ni(t.windMin,t.windMax,this.rng()):t.windMin,l.attractionActive=!1,l.attractionElapsed=0,l.collisionPaused=!1,l.attractionCurveSide=Vr(t.seed,u,2738958700)<.5?-1:1,l.trailHistory.length=0,l.trailBones.length=0,l.trailCurrentWidth=0,l.trailCurrentAlpha=0,l.trailCurrentColor=16777215,l.trailResourceId=f.id;const d=Math.min(100,Math.max(0,Number(f.trailRatio)||0)),m=t.mode==="burst"?Math.max(0,Math.round(t.burstCount)):Math.max(0,Math.floor(t.rate*(t.streamBehavior==="loop"?Math.max(1,t.loopDurationFrames)/30:Math.max(0,t.duration)))),g=d>0&&m===1&&u===0,b=Vr(t.seed,u,668265261)*100,_=(v,S,y,I,E)=>{if(v!=="random")return Math.max(0,Number(S)||0);const C=Math.max(0,Math.min(Number(y)||0,Number(I)||0)),R=Math.max(0,Math.max(Number(y)||0,Number(I)||0));return ni(C,R,Vr(t.seed,u,E))};l.trailSampledLength=_(f.lengthMode,f.length,f.lengthMin,f.lengthMax,374761393),l.trailSampledWidth=_(f.widthSizeMode,f.width,f.widthMin,f.widthMax,3550635116),l.trailEnabled=t.trail&&(g||b0&&l.trailSampledWidth>0,l.trailMesh&&(l.trailMesh.visible=!1),l.active=!0,l.life=o,l.maxLife=o,l.x=n,l.y=r,l.trailEnabled&&l.trailHistory.push({x:n,y:r}),l.vx=Math.cos(h)*a,l.vy=(t.shape==="cone"?-Math.sin(h):Math.sin(h))*a,l.scaleStartX=Xr(t.scaleMode,t.scaleMin,t.scaleMax,t.scaleCurve,this.rng())*c.scale,l.scaleStartY=t.scaleAxisMode==="separate"?Xr(t.scaleMode,t.scaleYMin,t.scaleYMax,t.scaleYCurve,this.rng())*c.scale:l.scaleStartX,l.alphaStart=t.alpha,l.alphaEnd=t.alphaEnd,l.rotation=t.initialRotationMode==="direction"?-Math.atan2(l.vy,l.vx)*180/Math.PI+t.initialRotationMin:Xr(t.initialRotationMode,t.initialRotationMin,t.initialRotationMax,t.initialRotationCurve,this.rng()),l.rotationSpeed=t.rotationOverLifeEnabled?Xr(t.rotationOverLifeMode,t.rotationSpeedMin,t.rotationSpeedMax,t.rotationOverLifeCurve,this.rng()):0,l.speedScale=1,l.speedScaleTarget=t.speedOverLifeMode==="random"?ni(t.speedOverLifeMin,t.speedOverLifeMax,this.rng()):t.speedOverLifeMin,l.scaleOverLifeX=t.scaleOverLifeMode==="random"?ni(t.scaleOverLifeMin,t.scaleOverLifeMax,this.rng()):t.scaleOverLifeMin,l.scaleOverLifeY=t.scaleOverLifeMode==="random"?ni(t.scaleYOverLifeMin,t.scaleYOverLifeMax,this.rng()):t.scaleYOverLifeMin,l.resourceId=c.id;const M=this.imageFrameState(c,0);l.imageFrameIndex=M.index,l.sprite.texture=this.imageFrameTexture(c,M.index),l.sprite.anchor.set(c.anchorX,c.anchorY),l.sprite.blendMode=Dn[c.blend],l.sprite.tint=fo(c.colorStart),l.sprite.visible=!0}pickImageResource(){const t=this.cfg.imageResources.filter(r=>r.texture||r.sequenceFrames.some(o=>o.texture));if(!t.length)return{id:1,texture:this.cfg.texture,textureName:"star",textureFolder:"",previewUrl:"/images/star.png",imageMode:"fixed",sequencePlayback:"loop-forward",sequenceFps:30,sequenceFrames:[],weight:100,locked:!1,scale:1,anchorX:.5,anchorY:.5,colorMode:"fixed",colorStart:"#ffffff",colorEnd:"#ff4d4d",blend:"normal",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],independentAlpha:"off",alpha:1,alphaCurveMode:"跟随导出",alphaCurve:[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}]};const s=t.reduce((r,o)=>r+Math.max(0,o.weight),0);if(s<=0)return t[Math.floor(this.rng()*t.length)];let n=this.rng()*s;for(const r of t)if(n-=Math.max(0,r.weight),n<=0)return r;return t[t.length-1]}imageFrameState(t,s){if(t.imageMode!=="sequence"||t.sequenceFrames.length<=1)return{index:0,visible:!0};const n=Math.min(120,Math.max(1,Number(t.sequenceFps)||30)),r=Math.max(0,Math.floor(Math.max(0,s)*n)),o=t.sequenceFrames.length-1;return t.sequencePlayback==="once-hide"?{index:Math.min(o,r),visible:r<=o}:t.sequencePlayback==="once-hold"?{index:Math.min(o,r),visible:!0}:t.sequencePlayback==="loop-reverse"?{index:o-r%t.sequenceFrames.length,visible:!0}:{index:r%t.sequenceFrames.length,visible:!0}}imageFrameTexture(t,s){var n;return t.imageMode==="sequence"&&t.sequenceFrames.length?((n=t.sequenceFrames[Math.max(0,Math.min(t.sequenceFrames.length-1,s))])==null?void 0:n.texture)||t.texture||this.cfg.texture:t.texture||this.cfg.texture}pickTrailResource(t){const s=this.cfg.trailResources.filter(o=>o.texture);if(!s.length)return this.cfg.trailResources[0]||{id:1,texture:null,textureName:"trail",previewUrl:"/images/trail.png",weight:100,locked:!1,rotation:0,colorMode:"particle",color:"#ffffff",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],blend:"normal",alphaMode:"particle",alpha:1,alphaCurve:[{x:0,y:1},{x:1,y:1}],boneCount:3,trailRatio:100,lengthMode:"fixed",length:100,lengthMin:100,lengthMax:100,widthSizeMode:"fixed",width:100,widthMin:100,widthMax:100,widthMode:"particle",lifeLengthEnabled:!1,lifeLengthCurve:[{x:0,y:1},{x:1,y:1}],shapeEnabled:!1,shapeCurve:[{x:0,y:1},{x:1,y:1}]};const n=s.reduce((o,a)=>o+Math.max(0,a.weight),0);if(n<=0)return s[Math.min(s.length-1,Math.floor(t*s.length))];let r=t*n;for(const o of s)if(r-=Math.max(0,o.weight),r<=0)return o;return s[s.length-1]}kill(t){const s=this.pool[t];s.active=!1,s.sprite.visible=!1,s.trailHistory.length=0,s.trailBones.length=0,s.trailMesh&&(s.trailMesh.visible=!1)}clear(){for(const t of this.pool)t.active=!1,t.sprite.visible=!1,t.trailHistory.length=0,t.trailBones.length=0,t.trailMesh&&(t.trailMesh.visible=!1)}get activeCount(){let t=0;for(const s of this.pool)s.active&&t++;return t}capture(){const t=[];for(const s of this.pool)s.active&&t.push({boneName:s.boneName,spawnId:s.spawnId,x:s.sprite.x,y:s.sprite.y,rotation:s.rotation,scaleX:s.sprite.scale.x,scaleY:s.sprite.scale.y,...this.captureWorldTransform(s),alpha:s.sprite.alpha,colorHex:s.sprite.tint,resourceId:s.resourceId,imageFrameIndex:s.imageFrameIndex,imageVisible:s.sprite.visible,active:!0,trailState:this.cfg.trail&&s.trailBones.length?{bones:s.trailBones.map(n=>{var o;const r=Ur(this.cfg,n.x,n.y,this.simulationTransform);return{...n,worldX:r.x,worldY:r.y,worldRotation:(((o=this.simulationTransform)==null?void 0:o.rotation)??this.cfg.rootRotation)-n.rotation}}),activeBoneCount:s.trailBones.length,width:s.trailCurrentWidth,alpha:s.trailCurrentAlpha,colorHex:s.trailCurrentColor,resourceId:s.trailResourceId}:void 0});return t}captureWorldTransform(t){var r,o,a;const s=Ur(this.cfg,t.sprite.x,t.sprite.y,this.simulationTransform),n=((r=this.simulationTransform)==null?void 0:r.rotation)??this.cfg.rootRotation;return{worldX:s.x,worldY:s.y,worldRotation:n+t.rotation,worldScaleX:t.sprite.scale.x*Math.abs(((o=this.simulationTransform)==null?void 0:o.scaleX)??this.cfg.rootScaleX),worldScaleY:t.sprite.scale.y*Math.abs(((a=this.simulationTransform)==null?void 0:a.scaleY)??this.cfg.rootScaleY)}}apply(t){var n;const s=new Map;for(const r of t)s.set(r.boneName,r);for(const r of this.pool){const o=s.get(r.boneName);if(!o){r.active=!1,r.sprite.visible=!1,r.trailMesh&&(r.trailMesh.visible=!1);continue}r.active=o.active;const a=r.sprite;if(a.visible=o.active&&o.imageVisible!==!1,a.x=o.x,a.y=o.y,a.rotation=-o.rotation*Math.PI/180,a.scale.set(o.scaleX,o.scaleY),a.alpha=o.alpha,a.tint=o.colorHex,o.resourceId!=null){const h=this.cfg.imageResources.find(l=>l.id===o.resourceId);h&&(r.imageFrameIndex=o.imageFrameIndex??0,a.texture=this.imageFrameTexture(h,r.imageFrameIndex),a.anchor.set(h.anchorX,h.anchorY),a.blendMode=Dn[h.blend])}this.cfg.trail&&o.trailState?(r.trailResourceId=o.trailState.resourceId??((n=this.cfg.trailResources[0])==null?void 0:n.id)??1,r.trailBones=o.trailState.bones.map(h=>({...h})),r.trailCurrentWidth=o.trailState.width,r.trailCurrentAlpha=o.trailState.alpha,this.skinTrailMesh(r,o.trailState)):r.trailMesh&&(r.trailMesh.visible=!1)}}reset(){for(const t of this.pool)t.active=!1,t.sprite.visible=!1,t.trailHistory.length=0,t.trailBones.length=0,t.trailMesh&&(t.trailMesh.visible=!1);this.accumulator=0,this.burstTimer=0,this._spawnSerial=0,this._elapsed=0,this._attractionEnabledAt=0,this._attractionWasEnabled=!1,this._lastSeed=this.cfg.seed,this.rng=wu(this.cfg.seed>>>0)}restartEmissionCycle(){this.accumulator=0,this.burstTimer=0,this._spawnSerial=0,this._elapsed=0,this._attractionEnabledAt=0,this._attractionWasEnabled=this.cfg.attraction,this._lastSeed=this.cfg.seed,this.rng=wu(this.cfg.seed>>>0)}}function ni(i,e,t){return i+(e-i)*t}function Qa(i,e){return Number.isFinite(i)?i:e}function Ur(i,e,t,s=null){const n=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleX)??i.rootScaleX)),r=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleY)??i.rootScaleY)),o=-((s==null?void 0:s.rotation)??i.rootRotation)*Math.PI/180,a=Math.cos(o),h=Math.sin(o),l=(s==null?void 0:s.centerX)??i.centerX,c=(s==null?void 0:s.centerY)??i.centerY,u=l+a*n*e-h*r*t,f=-c+h*n*e+a*r*t;return{x:u,y:-f}}function ig(i,e,t,s=null){const n=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleX)??i.rootScaleX)),r=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleY)??i.rootScaleY)),o=-((s==null?void 0:s.rotation)??i.rootRotation)*Math.PI/180,a=Math.cos(o),h=Math.sin(o),l=e-((s==null?void 0:s.centerX)??i.centerX),c=-t+((s==null?void 0:s.centerY)??i.centerY);return{x:(a*l+h*c)/n,y:(-h*l+a*c)/r}}function xE(i,e,t,s=null){const n=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleX)??i.rootScaleX)),r=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleY)??i.rootScaleY)),o=-((s==null?void 0:s.rotation)??i.rootRotation)*Math.PI/180,a=Math.cos(o),h=Math.sin(o),l=a*n*e-h*r*t,c=h*n*e+a*r*t;return{x:l,y:-c}}function bE(i,e,t,s=null){const n=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleX)??i.rootScaleX)),r=Math.max(1e-4,Math.abs((s==null?void 0:s.scaleY)??i.rootScaleY)),o=-((s==null?void 0:s.rotation)??i.rootRotation)*Math.PI/180,a=Math.cos(o),h=Math.sin(o),l=-t;return{x:(a*e+h*l)/n,y:(-h*e+a*l)/r}}function wE(i,e,t){const s=i.rotation*Math.PI/180,n=Math.cos(s),r=Math.sin(s),o=Math.max(1e-4,Math.abs(i.scaleX??1)),a=Math.max(1e-4,Math.abs(i.scaleY??1)),h=e-i.x,l=t-i.y,c=(n*h+r*l)/o,u=(-r*h+n*l)/a,f=(I,E,C,R)=>{const B=C/o,k=R/a,F=Math.max(1e-4,Math.hypot(B,k)),D=B/F,N=k/F,j=n*D-r*N,O=r*D+n*N;return{x:i.x+n*I*o-r*E*a+j*.05,y:i.y+r*I*o+n*E*a+O*.05,nx:j,ny:O}};if(i.shape==="circle"){const I=Math.max(.001,i.radius),E=Math.hypot(c,u);if(E>=I)return null;const C=E>1e-4?c/E:1,R=E>1e-4?u/E:0;return f(C*I,R*I,C,R)}if(i.shape==="ellipse"){const I=Math.max(.001,i.radiusX),E=Math.max(.001,i.radiusY),C=Math.hypot(c/I,u/E);if(C>=1)return null;const R=C>1e-4?1/C:1,B=C>1e-4?c*R:I,k=C>1e-4?u*R:0,F=Math.max(1e-4,Math.hypot(B/(I*I),k/(E*E)));return f(B,k,B/(I*I)/F,k/(E*E)/F)}if(i.shape==="rect"){const I=Math.max(.001,i.width*.5),E=Math.max(.001,i.height*.5);if(Math.abs(c)>=I||Math.abs(u)>=E)return null;const C=I-Math.abs(c),R=E-Math.abs(u);if(C=0?1:-1;return f(k*I,u,k,0)}const B=u>=0?1:-1;return f(c,B*E,0,B)}const d=Math.max(3,Math.min(16,Math.round(i.sides||(i.shape==="custom"?5:6)))),m=Math.max(.001,i.width*.5),g=Math.max(.001,i.height*.5),b=Array.from({length:d},(I,E)=>{const C=Math.PI*.5+E/d*Math.PI*2;return{x:Math.cos(C)*m,y:Math.sin(C)*g}});let _=!1;for(let I=0,E=b.length-1;Iu!=R.y>u&&c<(R.x-C.x)*(u-C.y)/(R.y-C.y)+C.x&&(_=!_)}if(!_)return null;let M=b[0].x,v=b[0].y,S=1/0;for(let I=0;I>>0^Math.imul(e+1,2654435761)^t)>>>0;return s^=s>>>16,s=Math.imul(s,2146121005),s^=s>>>15,s=Math.imul(s,2221713035),s^=s>>>16,(s>>>0)/4294967296}function Xr(i,e,t,s,n){return i==="fixed"?e:i==="curve"?ni(e,t,Ps(s,n)):ni(e,t,n)}function bu(i,e,t,s,n,r){return i==="curve"?ni(e,t,Ps(s,n)):i==="random"?r:e}function sg(i,e,t,s,n){const r=1-n;return r*r*r*i+3*r*r*n*e+3*r*n*n*t+n*n*n*s}function Ps(i,e,t="线性"){if(!Array.isArray(i)||i.length===0)return 1;const s=[...i].sort((n,r)=>n.x-r.x);if(e<=s[0].x)return s[0].y;if(e>=s[s.length-1].x)return s[s.length-1].y;for(let n=0;n=s[n].x&&e<=s[n+1].x){const r=s[n],o=s[n+1],a=o.x-r.x||1;if(t!=="贝塞尔")return ni(r.y,o.y,(e-r.x)/a);const h=r.x+(r.outX??a/3),l=r.y+(r.outY??(o.y-r.y)/3),c=o.x+(o.inX??-a/3),u=o.y+(o.inY??-(o.y-r.y)/3);let f=0,d=1;for(let m=0;m<14;m++){const g=(f+d)/2;sg(r.x,h,c,o.x,g)>>0;return function(){e|=0,e=e+1831565813|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}function fo(i){let e=i.replace("#","");return e.length===3&&(e=e.split("").map(t=>t+t).join("")),parseInt(e,16)}function SE(i,e,t){const s=rg(i),n=rg(e),r=Math.round(s[0]+(n[0]-s[0])*t),o=Math.round(s[1]+(n[1]-s[1])*t),a=Math.round(s[2]+(n[2]-s[2])*t);return r<<16|o<<8|a}function ng(i,e){if(!Array.isArray(i)||i.length===0)return 16777215;const t=[...i].sort((s,n)=>s.position-n.position);if(e<=t[0].position)return fo(t[0].color);if(e>=t[t.length-1].position)return fo(t[t.length-1].color);for(let s=0;sr.position)continue;const o=(e-n.position)/Math.max(1e-4,r.position-n.position);return SE(n.color,r.color,o)}return fo(t[t.length-1].color)}function rg(i){let e=i.replace("#","");e.length===3&&(e=e.split("").map(s=>s+s).join(""));const t=parseInt(e,16);return[t>>16&255,t>>8&255,t&255]}const Mr=new Map,xr=new Map;function TE(i){return[...Mr.values()].some(e=>e===i)}function py(i){if(!(TE(i)||(xr.get(i)||0)>0)){xr.delete(i);for(const e of i.textures)e.destroy(!0)}}function ME(i){const e=xr.get(i)||0;e>1?xr.set(i,e-1):xr.delete(i),py(i)}function EE(i){return Mr.get(i)||null}function Lh(i,e){Ea(i),Mr.set(i,e)}function AE(i){const e=Mr.get(i);return e?(xr.set(e,(xr.get(e)||0)+1),e):null}function CE(i,e){const t=Mr.get(i);return t?(Lh(e,t),!0):!1}function Ea(i){const e=Mr.get(i);e&&(Mr.delete(i),py(e))}function Ut(i){if(Array.isArray(i))return i.map(e=>Ut(e));if(i&&typeof i=="object"){const e=Object.getPrototypeOf(i);if(e===Object.prototype||e===null){const t={};for(const[s,n]of Object.entries(i))t[s]=Ut(n);return t}}return i}const my=["3.8","4.0","4.1","4.2"];function Wl(i){const e=String(i||"").trim();return my.find(t=>e===t||e.startsWith(`${t}.`))||null}function Sd(){return my.join(" / ")}function uf(){return{imagesPath:"./images/",spineVersion:"4.2",keyframeCurve:"linear",fps:30,omitFps:!1,integerFrameAlignment:!0,bonePool:!0,excludeEmptyAnimations:!1,fileName:"SpineParticle.json"}}function gy(i){const e=Object.assign(uf(),i||{});return e.imagesPath=String(e.imagesPath||"./images/"),e.spineVersion=Wl(e.spineVersion)||"4.2",e.keyframeCurve=e.keyframeCurve==="bezier"?"bezier":"linear",e.fps=Math.min(240,Math.max(1,Math.round(Number(e.fps)||30))),e.omitFps=e.omitFps===!0,e.integerFrameAlignment=e.integerFrameAlignment!==!1,e.bonePool=e.bonePool!==!1,e.excludeEmptyAnimations=e.excludeEmptyAnimations===!0,e.fileName=String(e.fileName||"SpineParticle.json"),e}let el=1,tl=1,il=1,sl=1;function nl(i,e){const t=new Set(e),s=`${i} Copy`;if(!t.has(s))return s;let n=2;for(;t.has(`${s} ${n}`);)n++;return`${s} ${n}`}const Aa=tw("particle",{state:()=>({editor:{viewScale:1,viewX:0,viewY:0},systems:[],colliders:[],paths:[],spines:[],activeId:0,activeObjectType:"particle",activeObjectId:0,timeline:{playing:!0,loop:!0,frame:0,totalFrames:60,fps:30,recorded:!1,animation:"animation",animations:["animation"]},settings:{parameterPanelOnRight:!0,tickEnabled:!1,axisFontSize:12,tickWidth:1,showAxisLabels:!0,axisColor:"#7a86ad",undoLimit:20,backgroundX:0,backgroundY:0,backgroundOpacity:1,backgroundImageName:"",backgroundImageData:"",showEmitter:!0,showBones:!1,bonePointDrawSize:1,boneAxisDrawSize:2,showSkinMesh:!1,showGrid:!0,exportSettings:uf()}}),getters:{activeSystemCount:i=>i.systems.length},actions:{syncSceneSequences(){el=Math.max(el,...this.systems.map(i=>i.id+1),1),tl=Math.max(tl,...this.colliders.map(i=>i.id+1),1),il=Math.max(il,...this.paths.map(i=>i.id+1),1),sl=Math.max(sl,...this.spines.map(i=>i.id+1),1)},addSystem(i){const e=ga();i!=null&&i.config&&Object.assign(e,i.config);const t=new Set(this.systems.map(r=>r.config.name));if(t.has(e.name)){let r=0;for(const a of this.systems){const h=/^ParticleSystem(\d+)$/.exec(a.config.name);h&&(r=Math.max(r,parseInt(h[1],10)))}e.name=`ParticleSystem${r+1}`;let o=2;for(;t.has(e.name);)e.name=`ParticleSystem${r+o}`,o++}const s=this.timeline.animations.includes(this.timeline.animation)?this.timeline.animation:this.timeline.animations[0]||"animation",n={id:el++,visible:!0,animation:s,config:e};return this.systems.push(n),this.activeId=n.id,this.activeObjectType="particle",this.activeObjectId=n.id,n},removeSystem(i){var s;const e=this.systems.findIndex(n=>n.id===i);e>=0&&this.systems.splice(e,1),this.activeId===i&&(this.activeId=((s=this.systems[0])==null?void 0:s.id)??0);const t=this.systems.find(n=>n.id===this.activeId);if(t&&(this.timeline.animation=t.animation),this.activeObjectType==="particle"&&this.activeObjectId===i){const n=this.systems[0];this.activeObjectId=(n==null?void 0:n.id)??0}},selectSystem(i){this.activeId=i,this.activeObjectType="particle",this.activeObjectId=i;const e=this.systems.find(t=>t.id===i);e&&(this.timeline.animation=e.animation)},setSystemAnimation(i,e){if(!this.timeline.animations.includes(e))return;const t=this.systems.find(s=>s.id===i);t&&(t.animation=e,this.timeline.animation=e)},addAnimation(){const i=new Set(this.timeline.animations);let e=2,t=`animation${e}`;for(;i.has(t);)t=`animation${++e}`;this.timeline.animations.push(t),this.timeline.animation=t;const s=this.systems.find(n=>n.id===this.activeId);return s&&(s.animation=t),t},renameAnimation(i,e){const t=e.trim(),s=this.timeline.animations.indexOf(i);if(s<0||!t||t!==i&&this.timeline.animations.includes(t))return!1;this.timeline.animations[s]=t;for(const n of this.systems)n.animation===i&&(n.animation=t);return this.timeline.animation===i&&(this.timeline.animation=t),!0},removeAnimation(i){if(this.timeline.animations.length<=1)return!1;const e=this.timeline.animations.indexOf(i);if(e<0)return!1;this.timeline.animations.splice(e,1);const t=this.timeline.animations[Math.min(e,this.timeline.animations.length-1)];for(const s of this.systems)s.animation===i&&(s.animation=t);return this.timeline.animation===i&&(this.timeline.animation=t),!0},addCollider(){const i=tl++,e={id:i,name:`Collider${i}`,visible:!0,tags:["Default"],selectedTag:"Default",shape:"circle",enabled:!0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,radius:50,radiusX:70,radiusY:45,width:120,height:80,sides:6,response:"physics",elasticity:.8,friction:.3,followPath:!1,followPathId:0,followDuration:2,followPathRotation:!1,followCurveMode:"跟随导出",followCurve:[{x:0,y:0},{x:1,y:1}]};return this.colliders.push(e),this.activeObjectType="collision",this.activeObjectId=e.id,e},addPath(){const i=il++,e={id:i,name:`Path${i}`,visible:!0,enabled:!0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,closed:!1,color:"#ff933e",preset:"",points:[]};return this.paths.push(e),this.activeObjectType="path",this.activeObjectId=e.id,e},addSpine(){const i=sl++,e={id:i,name:`SpineSkeleton${i}`,enabled:!0,visible:!0,x:0,y:0,rotation:0,scaleX:1,scaleY:1,timeOffset:0,skeletonFileName:"",atlasFileName:"",textureFileNames:[],dataVersion:"",sourceBundle:null,selectedAnimation:"",selectedBone:"",animations:[],bones:[],assetVersion:0,status:"empty",error:""};return this.spines.push(e),this.activeObjectType="spine",this.activeObjectId=e.id,e},duplicateSelectedObject(){const i=this.activeObjectId;if(!i)return null;if(this.activeObjectType==="particle"){const s=this.systems.find(r=>r.id===i);if(!s)return null;const n=Ut(s);return n.id=el++,n.config.name=nl(s.config.name,this.systems.map(r=>r.config.name)),n.frames=void 0,this.systems.push(n),this.activeId=n.id,this.activeObjectId=n.id,this.timeline.animation=n.animation,n}if(this.activeObjectType==="collision"){const s=this.colliders.find(r=>r.id===i);if(!s)return null;const n=Ut(s);return n.id=tl++,n.name=nl(s.name,this.colliders.map(r=>r.name)),this.colliders.push(n),this.activeObjectId=n.id,n}if(this.activeObjectType==="path"){const s=this.paths.find(r=>r.id===i);if(!s)return null;const n=Ut(s);return n.id=il++,n.name=nl(s.name,this.paths.map(r=>r.name)),this.paths.push(n),this.activeObjectId=n.id,n}const e=this.spines.find(s=>s.id===i);if(!e)return null;const t=Ut(e);return t.id=sl++,t.name=nl(e.name,this.spines.map(s=>s.name)),t.selectedBone="",CE(e.id,t.id),this.spines.push(t),this.activeObjectId=t.id,t},selectSceneObject(i,e){if(this.activeObjectType=i,this.activeObjectId=e,i==="particle"){this.activeId=e;const t=this.systems.find(s=>s.id===e);t&&(this.timeline.animation=t.animation)}},removeCollider(i){var t;const e=this.colliders.findIndex(s=>s.id===i);if(e>=0&&this.colliders.splice(e,1),this.activeObjectType==="collision"&&this.activeObjectId===i){const s=this.systems[0];this.activeObjectType=s?"particle":"collision",this.activeObjectId=(s==null?void 0:s.id)??((t=this.colliders[0])==null?void 0:t.id)??0}},removePath(i){var t;const e=this.paths.findIndex(s=>s.id===i);if(e>=0&&this.paths.splice(e,1),this.activeObjectType==="path"&&this.activeObjectId===i){const s=this.systems[0];this.activeObjectType=s?"particle":"path",this.activeObjectId=(s==null?void 0:s.id)??((t=this.paths[0])==null?void 0:t.id)??0}},removeSpine(i){Ea(i);const e=this.spines.findIndex(t=>t.id===i);if(e>=0&&this.spines.splice(e,1),this.activeObjectType==="spine"&&this.activeObjectId===i){const t=this.systems[0],s=this.colliders[0],n=this.paths[0],r=this.spines[0];t?(this.activeObjectType="particle",this.activeObjectId=t.id,this.activeId=t.id):s?(this.activeObjectType="collision",this.activeObjectId=s.id):n?(this.activeObjectType="path",this.activeObjectId=n.id):(this.activeObjectType="spine",this.activeObjectId=(r==null?void 0:r.id)??0)}this.recalcTotalFrames()},play(){this.timeline.frame>=Math.max(0,this.timeline.totalFrames-1)&&(this.timeline.frame=0),this.timeline.playing=!0},pause(){this.timeline.playing=!1},togglePlay(){this.timeline.playing?this.pause():this.play()},toStart(){this.timeline.frame=0},previousFrame(){this.timeline.playing=!1,this.timeline.frame=Math.max(0,this.timeline.frame-1)},nextFrame(){this.timeline.playing=!1,this.timeline.frame=Math.min(Math.max(0,this.timeline.totalFrames-1),this.timeline.frame+1)},toEnd(){this.timeline.playing=!1,this.timeline.frame=Math.max(0,this.timeline.totalFrames-1)},toggleLoop(){this.timeline.loop=!this.timeline.loop},setFrame(i){this.timeline.frame=Math.max(0,Math.min(i,this.timeline.totalFrames-1))},recalcTotalFrames(){const i=this.timeline.fps||30;let e=0;for(const s of this.systems){const n=s.config,r=Math.max(0,Number(n.lifeMin)||0),o=Math.max(0,Number(n.lifeMax)||0),a=n.lifeMode==="fixed"?r:Math.max(r,o),h=n.mode==="stream"?n.streamBehavior==="loop"?Math.max(1/i,Math.ceil(Math.max(1,Number(n.loopDurationFrames)||1))/i):Math.max(1/i,Number(n.duration)||0):0;let l=Math.max(0,Number(n.delay)||0)+h+a;if(n.mode==="stream"&&n.streamBehavior==="loop")if(n.generateLoopEndAnimation)l=Math.max(0,Number(n.delay)||0)+a+1/i;else if(n.generateLoopStartAnimation){const c=Math.max(1,Math.ceil(a/h));l=Math.max(0,Number(n.delay)||0)+h*c}else l=Math.max(0,Number(n.delay)||0)+h;l>e&&(e=l)}for(const s of this.spines){const n=s.animations.find(o=>o.name===s.selectedAnimation);if(!n)continue;const r=Math.max(0,Number(s.timeOffset)||0)+Math.max(0,n.duration||0);r>e&&(e=r)}for(const s of this.colliders){if(!s.followPath||!s.followPathId)continue;const n=Math.max(0,Number(s.followDuration)||0);n>e&&(e=n)}const t=Math.max(1,Math.ceil(e*i)+1);return this.timeline.totalFrames=t,this.timeline.frame>=t&&(this.timeline.frame=t-1),t}}}),vy="SpineParticle.SystemSettings",yy=1,_u="SpineParticle.SystemSettings.v1";function Lo(i,e,t,s){const n=Number(i);return Math.min(t,Math.max(e,Number.isFinite(n)?n:s))}function IE(i){return{parameterPanelOnRight:i.parameterPanelOnRight,undoLimit:i.undoLimit,showEmitter:i.showEmitter,showBones:i.showBones,bonePointDrawSize:i.bonePointDrawSize,boneAxisDrawSize:i.boneAxisDrawSize,showSkinMesh:i.showSkinMesh,tickEnabled:i.tickEnabled,axisFontSize:i.axisFontSize,tickWidth:i.tickWidth,showAxisLabels:i.showAxisLabels,axisColor:i.axisColor}}function RE(i,e){const t=n=>i[n]==null?!!e[n]:i[n]===!0,s=typeof i.axisColor=="string"&&/^#[0-9a-f]{6}$/i.test(i.axisColor)?i.axisColor:e.axisColor;return{parameterPanelOnRight:t("parameterPanelOnRight"),undoLimit:Math.round(Lo(i.undoLimit,1,200,e.undoLimit)),showEmitter:t("showEmitter"),showBones:t("showBones"),bonePointDrawSize:Lo(i.bonePointDrawSize,.1,10,e.bonePointDrawSize),boneAxisDrawSize:Lo(i.boneAxisDrawSize,.1,10,e.boneAxisDrawSize),showSkinMesh:t("showSkinMesh"),tickEnabled:t("tickEnabled"),axisFontSize:Math.round(Lo(i.axisFontSize,8,40,e.axisFontSize)),tickWidth:Lo(i.tickWidth,1,5,e.tickWidth),showAxisLabels:t("showAxisLabels"),axisColor:s}}function PE(i){let e;try{e=JSON.parse(i)}catch{throw new Error("系统设置缓存不是有效的 JSON")}const t=e;if(t.format!==vy)throw new Error("不是 Spine粒子编辑器系统设置缓存");if(t.version!==yy)throw new Error(`暂不支持系统配置版本:${t.version??"未知"}`);if(!t.settings||typeof t.settings!="object")throw new Error("系统设置缓存缺少 settings");return t}function kE(i,e){Object.assign(i.settings,RE(e,i.settings))}let rl=null;function FE(i){rl==null||rl();try{const e=localStorage.getItem(_u);e&&kE(i,PE(e).settings)}catch{try{localStorage.removeItem(_u)}catch{}}rl=cs(()=>IE(i.settings),e=>{const t={format:vy,version:yy,savedAt:new Date().toISOString(),settings:e};try{localStorage.setItem(_u,JSON.stringify(t))}catch{}},{deep:!0})}if(typeof window<"u"&&window.PIXI){let i=window.require;window.require=e=>{if(i)return i(e);if(e.startsWith("@pixi/"))return window.PIXI}}class xy{constructor(){A(this,"entries",{});A(this,"size",0)}add(e){let t=this.entries[e];return this.entries[e]=!0,t?!1:(this.size++,!0)}addAll(e){let t=this.size;for(var s=0,n=e.length;s1&&(this.r=1),this.g<0?this.g=0:this.g>1&&(this.g=1),this.b<0?this.b=0:this.b>1&&(this.b=1),this.a<0?this.a=0:this.a>1&&(this.a=1),this}static rgba8888ToColor(e,t){e.r=((t&4278190080)>>>24)/255,e.g=((t&16711680)>>>16)/255,e.b=((t&65280)>>>8)/255,e.a=(t&255)/255}static rgb888ToColor(e,t){e.r=((t&16711680)>>>16)/255,e.g=((t&65280)>>>8)/255,e.b=(t&255)/255}toRgb888(){const e=t=>("0"+(t*255).toString(16)).slice(-2);return+("0x"+e(this.r)+e(this.g)+e(this.b))}static fromString(e,t=new Di){return t.setFromString(e)}};A(Di,"WHITE",new Di(1,1,1,1)),A(Di,"RED",new Di(1,0,0,1)),A(Di,"GREEN",new Di(0,1,0,1)),A(Di,"BLUE",new Di(0,0,1,1)),A(Di,"MAGENTA",new Di(1,0,1,1));let ot=Di;const ti=class ti{static clamp(e,t,s){return es?s:e}static cosDeg(e){return Math.cos(e*ti.degRad)}static sinDeg(e){return Math.sin(e*ti.degRad)}static atan2Deg(e,t){return Math.atan2(e,t)*ti.degRad}static signum(e){return e>0?1:e<0?-1:0}static toInt(e){return e>0?Math.floor(e):Math.ceil(e)}static cbrt(e){let t=Math.pow(Math.abs(e),.3333333333333333);return e<0?-t:t}static randomTriangular(e,t){return ti.randomTriangularWith(e,t,(e+t)*.5)}static randomTriangularWith(e,t,s){let n=Math.random(),r=t-e;return n<=(s-e)/r?e+Math.sqrt(n*r*(s-e)):t-Math.sqrt((1-n)*r*(t-s))}static isPowerOfTwo(e){return e&&(e&e-1)===0}};A(ti,"PI",3.1415927),A(ti,"PI2",ti.PI*2),A(ti,"invPI2",1/ti.PI2),A(ti,"radiansToDegrees",180/ti.PI),A(ti,"radDeg",ti.radiansToDegrees),A(ti,"degreesToRadians",ti.PI/180),A(ti,"degRad",ti.degreesToRadians);let ke=ti;const Nn=class Nn{static arrayCopy(e,t,s,n,r){for(let o=t,a=n;o=t?e:Nn.setArraySize(e,t,s)}static newArray(e,t){let s=new Array(e);for(let n=0;n0?this.items.pop():this.instantiator()}free(e){e.reset&&e.reset(),this.items.push(e)}freeAll(e){for(let t=0;t>1)*a;let h=t.bone.skeleton,l=t.deform,c=this.vertices,u=this.bones;if(!u){l.length>0&&(c=l);let g=t.bone,b=g.worldX,_=g.worldY,M=g.a,v=g.b,S=g.c,y=g.d;for(let I=s,E=o;E=this.regions.length&&(s=this.regions.length-1);let n=this.regions[s];t.region!=n&&(t.region=n,t.updateRegion())}getPath(e,t){let s=e,n=(this.start+t).toString();for(let r=this.digits-n.length;r>0;r--)s+="0";return s+=n,s}static nextID(){return Qr._nextID++}};A(Qr,"_nextID",0);let Kl=Qr;var fi;(function(i){i[i.hold=0]="hold",i[i.once=1]="once",i[i.loop=2]="loop",i[i.pingpong=3]="pingpong",i[i.onceReverse=4]="onceReverse",i[i.loopReverse=5]="loopReverse",i[i.pingpongReverse=6]="pingpongReverse"})(fi||(fi={}));const wy=[fi.hold,fi.once,fi.loop,fi.pingpong,fi.onceReverse,fi.loopReverse,fi.pingpongReverse];class df{constructor(e,t,s){A(this,"name");A(this,"timelines",[]);A(this,"timelineIds",new xy);A(this,"duration");if(!e)throw new Error("name cannot be null.");this.name=e,this.setTimelines(t),this.duration=s}setTimelines(e){if(!e)throw new Error("timelines cannot be null.");this.timelines=e,this.timelineIds.clear();for(var t=0;t0&&(t%=this.duration));let l=this.timelines;for(let c=0,u=l.length;ct)return n-1;return s-1}static search(e,t,s){let n=e.length;for(let r=s;rt)return r-s;return n-s}};class qs extends Xt{constructor(t,s,n){super(t,n);A(this,"curves");this.curves=Fe.newFloatArray(t+s*18),this.curves[t-1]=1}setLinear(t){this.curves[t]=0}setStepped(t){this.curves[t]=1}shrink(t){let s=this.getFrameCount()+t*18;if(this.curves.length>s){let n=Fe.newFloatArray(s);Fe.arrayCopy(this.curves,0,n,0,s),this.curves=n}}setBezier(t,s,n,r,o,a,h,l,c,u,f){let d=this.curves,m=this.getFrameCount()+t*18;n==0&&(d[s]=2+m);let g=(r-a*2+l)*.03,b=(o-h*2+c)*.03,_=((a-l)*3-r+u)*.006,M=((h-c)*3-o+f)*.006,v=g*2+_,S=b*2+M,y=(a-r)*.3+g+_*.16666667,I=(h-o)*.3+b+M*.16666667,E=r+y,C=o+I;for(let R=m+18;mt){let c=this.frames[s],u=this.frames[s+n];return u+(t-c)/(o[r]-c)*(o[r+1]-u)}let a=r+18;for(r+=2;r=t){let c=o[r-2],u=o[r-1];return u+(t-c)/(o[r]-c)*(o[r+1]-u)}s+=this.getFrameEntries();let h=o[a-2],l=o[a-1];return l+(t-h)/(this.frames[s]-h)*(this.frames[s+n]-l)}}class ys extends qs{constructor(e,t,s){super(e,t,[s])}getFrameEntries(){return 2}setFrame(e,t,s){e<<=1,this.frames[e]=t,this.frames[e+1]=s}getCurveValue(e){let t=this.frames,s=t.length-2;for(let r=2;r<=s;r+=2)if(t[r]>e){s=r-2;break}let n=this.curves[s>>1];switch(n){case 0:let r=t[s],o=t[s+1];return o+(e-r)/(t[s+2]-r)*(t[s+2+1]-o);case 1:return t[s+1]}return this.getBezierValue(e,s,1,n-2)}getRelativeValue(e,t,s,n,r){if(e>2];switch(b){case 0:let _=c[g];f=c[g+1],d=c[g+2],m=c[g+3];let M=(n-_)/(c[g+4]-_);f+=(c[g+4+1]-f)*M,d+=(c[g+4+2]-d)*M,m+=(c[g+4+3]-m)*M;break;case 1:f=c[g+1],d=c[g+2],m=c[g+3];break;default:f=this.getBezierValue(n,g,1,b-2),d=this.getBezierValue(n,g,2,b+18-2),m=this.getBezierValue(n,g,3,b+36-2)}if(o==1)u.r=f,u.g=d,u.b=m;else{if(a==we.setup){let _=l.data.color;u.r=_.r,u.g=_.g,u.b=_.b}u.r+=(f-u.r)*o,u.g+=(d-u.g)*o,u.b+=(m-u.b)*o}}}class Oy extends ys{constructor(t,s,n){super(t,s,ht.alpha+"|"+n);A(this,"slotIndex",0);this.slotIndex=n}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=l.color;if(n>3];switch(y){case 0:let I=c[S];d=c[S+1],m=c[S+2],g=c[S+3],b=c[S+4],_=c[S+5],M=c[S+6],v=c[S+7];let E=(n-I)/(c[S+8]-I);d+=(c[S+8+1]-d)*E,m+=(c[S+8+2]-m)*E,g+=(c[S+8+3]-g)*E,b+=(c[S+8+4]-b)*E,_+=(c[S+8+5]-_)*E,M+=(c[S+8+6]-M)*E,v+=(c[S+8+7]-v)*E;break;case 1:d=c[S+1],m=c[S+2],g=c[S+3],b=c[S+4],_=c[S+5],M=c[S+6],v=c[S+7];break;default:d=this.getBezierValue(n,S,1,y-2),m=this.getBezierValue(n,S,2,y+18-2),g=this.getBezierValue(n,S,3,y+36-2),b=this.getBezierValue(n,S,4,y+54-2),_=this.getBezierValue(n,S,5,y+72-2),M=this.getBezierValue(n,S,6,y+90-2),v=this.getBezierValue(n,S,7,y+108-2)}if(o==1)u.set(d,m,g,b),f.r=_,f.g=M,f.b=v;else{if(a==we.setup){u.setFromColor(l.data.color);let I=l.data.darkColor;f.r=I.r,f.g=I.g,f.b=I.b}u.add((d-u.r)*o,(m-u.g)*o,(g-u.b)*o,(b-u.a)*o),f.r+=(_-f.r)*o,f.g+=(M-f.g)*o,f.b+=(v-f.b)*o}}}class Ly extends qs{constructor(t,s,n){super(t,s,[ht.rgb+"|"+n,ht.rgb2+"|"+n]);A(this,"slotIndex",0);this.slotIndex=n}getFrameEntries(){return 7}setFrame(t,s,n,r,o,a,h,l){t*=7,this.frames[t]=s,this.frames[t+1]=n,this.frames[t+2]=r,this.frames[t+3]=o,this.frames[t+4]=a,this.frames[t+5]=h,this.frames[t+6]=l}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=this.frames,u=l.color,f=l.darkColor;if(nt){let l=this.frames[s];return n[r+1]*(t-l)/(n[r]-l)}let o=r+18;for(r+=2;r=t){let l=n[r-2],c=n[r-1];return c+(t-l)/(n[r]-l)*(n[r+1]-c)}let a=n[o-2],h=n[o-1];return h+(1-h)*(t-a)/(this.frames[s+this.getFrameEntries()]-a)}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=l.getAttachment();if(!c||!(c instanceof vs)||c.timelineAttachment!=this.attachment)return;let u=l.deform;u.length==0&&(a=we.setup);let f=this.vertices,d=f[0].length,m=this.frames;if(n=m[m.length-1]){let S=f[m.length-1];if(o==1)if(a==we.add){let y=c;if(y.bones)for(let I=0;In)this.apply(t,s,Number.MAX_VALUE,r,o,a,h),s=-1;else if(s>=l[c-1])return;if(n0&&l[u-1]==f;)u--}for(;u=l[u];u++)r.push(this.events[u])}};A(lh,"propertyIds",[""+ht.event]);let va=lh;const hh=class hh extends Xt{constructor(t){super(t,hh.propertyIds);A(this,"drawOrders");this.drawOrders=new Array(t)}getFrameCount(){return this.frames.length}setFrame(t,s,n){this.frames[t]=s,this.drawOrders[t]=n}apply(t,s,n,r,o,a,h){if(h==xi.mixOut){a==we.setup&&Fe.arrayCopy(t.slots,0,t.drawOrder,0,t.slots.length);return}if(n>2];switch(g){case 0:let b=c[m];u=c[m+1],f=c[m+2],d=c[m+3];let _=(n-b)/(c[m+4]-b);u+=(c[m+4+1]-u)*_,f+=(c[m+4+2]-f)*_,d+=(c[m+4+3]-d)*_;break;case 1:u=c[m+1],f=c[m+2],d=c[m+3];break;default:u=this.getBezierValue(n,m,1,g-2),f=this.getBezierValue(n,m,2,g+18-2),d=this.getBezierValue(n,m,3,g+36-2)}if(a==we.setup){let b=l.data;l.mixRotate=b.mixRotate+(u-b.mixRotate)*o,l.mixX=b.mixX+(f-b.mixX)*o,l.mixY=b.mixY+(d-b.mixY)*o}else l.mixRotate+=(u-l.mixRotate)*o,l.mixX+=(f-l.mixX)*o,l.mixY+=(d-l.mixY)*o}}class Rr extends ys{constructor(t,s,n,r){super(t,s,r+"|"+n);A(this,"constraintIndex",0);this.constraintIndex=n}apply(t,s,n,r,o,a,h){let l;if(this.constraintIndex==-1){const c=n>=this.frames[0]?this.getCurveValue(n):0;for(const u of t.physicsConstraints)u.active&&this.global(u.data)&&this.set(u,this.getAbsoluteValue2(n,o,a,this.get(u),this.setup(u),c))}else l=t.physicsConstraints[this.constraintIndex],l.active&&this.set(l,this.getAbsoluteValue(n,o,a,this.get(l),this.setup(l)))}}class $y extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintInertia)}setup(e){return e.data.inertia}get(e){return e.inertia}set(e,t){e.inertia=t}global(e){return e.inertiaGlobal}}class Gy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintStrength)}setup(e){return e.data.strength}get(e){return e.strength}set(e,t){e.strength=t}global(e){return e.strengthGlobal}}class jy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintDamping)}setup(e){return e.data.damping}get(e){return e.damping}set(e,t){e.damping=t}global(e){return e.dampingGlobal}}class Hy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintMass)}setup(e){return 1/e.data.massInverse}get(e){return 1/e.massInverse}set(e,t){e.massInverse=1/t}global(e){return e.massGlobal}}class Wy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintWind)}setup(e){return e.data.wind}get(e){return e.wind}set(e,t){e.wind=t}global(e){return e.windGlobal}}class zy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintGravity)}setup(e){return e.data.gravity}get(e){return e.gravity}set(e,t){e.gravity=t}global(e){return e.gravityGlobal}}class qy extends Rr{constructor(e,t,s){super(e,t,s,ht.physicsConstraintMix)}setup(e){return e.data.mix}get(e){return e.mix}set(e,t){e.mix=t}global(e){return e.mixGlobal}}const ch=class ch extends Xt{constructor(t,s){super(t,ch.propertyIds);A(this,"constraintIndex");this.constraintIndex=s}getFrameCount(){return this.frames.length}setFrame(t,s){this.frames[t]=s}apply(t,s,n,r,o,a,h){let l;if(this.constraintIndex!=-1&&(l=t.physicsConstraints[this.constraintIndex],!l.active))return;const c=this.frames;if(s>n)this.apply(t,s,Number.MAX_VALUE,[],o,a,h),s=-1;else if(s>=c[c.length-1])return;if(!(n=c[Xt.search1(c,s)+1]))if(l!=null)l.reset();else for(const u of t.physicsConstraints)u.active&&u.reset()}};A(ch,"propertyIds",[ht.physicsConstraintReset.toString()]);let Jl=ch;const ji=class ji extends Xt{constructor(t,s,n){super(t,[ht.sequence+"|"+s+"|"+n.sequence.id]);A(this,"slotIndex");A(this,"attachment");this.slotIndex=s,this.attachment=n}getFrameEntries(){return ji.ENTRIES}getSlotIndex(){return this.slotIndex}getAttachment(){return this.attachment}setFrame(t,s,n,r,o){let a=this.frames;t*=ji.ENTRIES,a[t]=s,a[t+ji.MODE]=n|r<<4,a[t+ji.DELAY]=o}apply(t,s,n,r,o,a,h){let l=t.slots[this.slotIndex];if(!l.bone.active)return;let c=l.attachment,u=this.attachment;if(c!=u&&(!(c instanceof vs)||c.timelineAttachment!=u))return;if(h==xi.mixOut){a==we.setup&&(l.sequenceIndex=-1);return}let f=this.frames;if(n>4,M=this.attachment.sequence.regions.length,v=wy[g&15];if(v!=fi.hold)switch(_+=(n-m)/b+1e-5|0,v){case fi.once:_=Math.min(M-1,_);break;case fi.loop:_%=M;break;case fi.pingpong:{let S=(M<<1)-2;_=S==0?0:_%S,_>=M&&(_=S-_);break}case fi.onceReverse:_=Math.max(M-1-_,0);break;case fi.loopReverse:_=M-1-_%M;break;case fi.pingpongReverse:{let S=(M<<1)-2;_=S==0?0:(_+M-1)%S,_>=M&&(_=S-_)}}l.sequenceIndex=_}};A(ji,"ENTRIES",3),A(ji,"MODE",1),A(ji,"DELAY",2);let Ql=ji;const eo=class eo{constructor(e){A(this,"data");A(this,"tracks",new Array);A(this,"timeScale",1);A(this,"unkeyedState",0);A(this,"events",new Array);A(this,"listeners",new Array);A(this,"queue",new BE(this));A(this,"propertyIDs",new xy);A(this,"animationsChanged",!1);A(this,"trackEntryPool",new zl(()=>new OE));this.data=e}static emptyAnimation(){return eo._emptyAnimation}update(e){e*=this.timeScale;let t=this.tracks;for(let s=0,n=t.length;s0){if(r.delay-=o,r.delay>0)continue;o=-r.delay,r.delay=0}let a=r.next;if(a){let h=r.trackLast-a.delay;if(h>=0){for(a.delay=0,a.trackTime+=r.timeScale==0?0:(h/r.timeScale+e)*a.timeScale,r.trackTime+=o,this.setCurrent(s,a,!0);a.mixingFrom;)a.mixTime+=e,a=a.mixingFrom;continue}}else if(r.trackLast>=r.trackEnd&&!r.mixingFrom){t[s]=null,this.queue.end(r),this.clearNext(r);continue}if(r.mixingFrom&&this.updateMixingFrom(r,e)){let h=r.mixingFrom;for(r.mixingFrom=null,h&&(h.mixingTo=null);h;)this.queue.end(h),h=h.mixingFrom}r.trackTime+=o}this.queue.drain()}updateMixingFrom(e,t){let s=e.mixingFrom;if(!s)return!0;let n=this.updateMixingFrom(s,t);return s.animationLast=s.nextAnimationLast,s.trackLast=s.nextTrackLast,e.nextTrackLast!=-1&&e.mixTime>=e.mixDuration?((s.totalAlpha==0||e.mixDuration==0)&&(e.mixingFrom=s.mixingFrom,s.mixingFrom!=null&&(s.mixingFrom.mixingTo=e),e.interruptAlpha=s.interruptAlpha,this.queue.end(s)),n):(s.trackTime+=t*s.timeScale,e.mixTime+=t,!1)}apply(e){if(!e)throw new Error("skeleton cannot be null.");this.animationsChanged&&this._animationsChanged();let t=this.events,s=this.tracks,n=!1;for(let f=0,d=s.length;f0)continue;n=!0;let g=f==0?we.first:m.mixBlend,b=m.alpha;m.mixingFrom?b*=this.applyMixingFrom(m,e,g):m.trackTime>=m.trackEnd&&!m.next&&(b=0);let _=b>=m.alphaAttachmentThreshold,M=m.animationLast,v=m.getAnimationTime(),S=v,y=t;m.reverse&&(S=m.animation.duration-S,y=null);let I=m.animation.timelines,E=I.length;if(f==0&&b==1||g==we.add){f==0&&(_=!0);for(let C=0;C1&&(r=1),s!=we.first&&(s=n.mixBlend));let o=r=n.alphaAttachmentThreshold):(a&&y instanceof br&&E==we.setup&&(I=xi.mixIn),y.apply(t,f,m,g,C,E,I))}}return e.mixDuration>0&&this.queueEvents(n,d),this.events.length=0,n.nextAnimationLast=d,n.nextTrackLast=n.trackTime,r}applyAttachmentTimeline(e,t,s,n,r){var o=t.slots[e.slotIndex];o.bone.active&&(s=0,v=g>=0;Math.abs(b)<=90&&ke.signum(b)!=ke.signum(m)&&(Math.abs(g-_)>180?(d+=360*ke.signum(g),v=M):_!=0?d-=360*ke.signum(g):v=M),v!=M&&(d+=360*ke.signum(g)),o[a]=d}o[a+1]=m,l.rotation=u+d*n}queueEvents(e,t){let s=e.animationStart,n=e.animationEnd,r=n-s,o=e.trackLast%r,a=this.events,h=0,l=a.length;for(;hn||this.queue.event(e,u)}let c=!1;if(e.loop)if(r==0)c=!0;else{const u=Math.floor(e.trackTime/r);c=u>0&&u>Math.floor(e.trackLast/r)}else c=t>=n&&e.animationLast=this.tracks.length)return;let t=this.tracks[e];if(!t)return;this.queue.end(t),this.clearNext(t);let s=t;for(;;){let n=s.mixingFrom;if(!n)break;this.queue.end(n),s.mixingFrom=null,s.mixingTo=null,s=n}this.tracks[t.trackIndex]=null,this.queue.drain()}setCurrent(e,t,s){let n=this.expandToIndex(e);this.tracks[e]=t,t.previous=null,n&&(s&&this.queue.interrupt(n),t.mixingFrom=n,n.mixingTo=t,t.mixTime=0,n.mixingFrom&&n.mixDuration>0&&(t.interruptAlpha*=Math.min(1,n.mixTime/n.mixDuration)),n.timelinesRotation.length=0),this.queue.start(t)}setAnimation(e,t,s=!1){let n=this.data.skeletonData.findAnimation(t);if(!n)throw new Error("Animation not found: "+t);return this.setAnimationWith(e,n,s)}setAnimationWith(e,t,s=!1){if(!t)throw new Error("animation cannot be null.");let n=!0,r=this.expandToIndex(e);r&&(r.nextTrackLast==-1?(this.tracks[e]=r.mixingFrom,this.queue.interrupt(r),this.queue.end(r),this.clearNext(r),r=r.mixingFrom,n=!1):this.clearNext(r));let o=this.trackEntry(e,t,s,r);return this.setCurrent(e,o,n),this.queue.drain(),o}addAnimation(e,t,s=!1,n=0){let r=this.data.skeletonData.findAnimation(t);if(!r)throw new Error("Animation not found: "+t);return this.addAnimationWith(e,r,s,n)}addAnimationWith(e,t,s=!1,n=0){if(!t)throw new Error("animation cannot be null.");let r=this.expandToIndex(e);if(r)for(;r.next;)r=r.next;let o=this.trackEntry(e,t,s,r);return r?(r.next=o,o.previous=r,n<=0&&(n=Math.max(n+r.getTrackComplete()-o.mixDuration,0))):(this.setCurrent(e,o,!0),this.queue.drain(),n<0&&(n=0)),o.delay=n,o}setEmptyAnimation(e,t=0){let s=this.setAnimationWith(e,eo.emptyAnimation(),!1);return s.mixDuration=t,s.trackEnd=t,s}addEmptyAnimation(e,t=0,s=0){let n=this.addAnimationWith(e,eo.emptyAnimation(),!1,s);return s<=0&&(n.delay=Math.max(n.delay+n.mixDuration-t,0)),n.mixDuration=t,n.trackEnd=t,n}setEmptyAnimations(e=0){let t=this.queue.drainDisabled;this.queue.drainDisabled=!0;for(let s=0,n=this.tracks.length;s0){r[h]=LE,o[h]=u;continue e}break}r[h]=Tu}}}getCurrent(e){return e>=this.tracks.length?null:this.tracks[e]}addListener(e){if(!e)throw new Error("listener cannot be null.");this.listeners.push(e)}removeListener(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}clearListeners(){this.listeners.length=0}clearListenerNotifications(){this.queue.clear()}};A(eo,"_emptyAnimation",new df("",[],0));let Td=eo;class OE{constructor(){A(this,"animation",null);A(this,"previous",null);A(this,"next",null);A(this,"mixingFrom",null);A(this,"mixingTo",null);A(this,"listener",null);A(this,"trackIndex",0);A(this,"loop",!1);A(this,"holdPrevious",!1);A(this,"reverse",!1);A(this,"shortestRotation",!1);A(this,"eventThreshold",0);A(this,"mixAttachmentThreshold",0);A(this,"alphaAttachmentThreshold",0);A(this,"mixDrawOrderThreshold",0);A(this,"animationStart",0);A(this,"animationEnd",0);A(this,"animationLast",0);A(this,"nextAnimationLast",0);A(this,"delay",0);A(this,"trackTime",0);A(this,"trackLast",0);A(this,"nextTrackLast",0);A(this,"trackEnd",0);A(this,"timeScale",0);A(this,"alpha",0);A(this,"mixTime",0);A(this,"_mixDuration",0);A(this,"interruptAlpha",0);A(this,"totalAlpha",0);A(this,"mixBlend",we.replace);A(this,"timelineMode",new Array);A(this,"timelineHoldMix",new Array);A(this,"timelinesRotation",new Array)}get mixDuration(){return this._mixDuration}set mixDuration(e){this._mixDuration=e}setMixDurationWithDelay(e,t){this._mixDuration=e,t<=0&&(this.previous!=null?t=Math.max(t+this.previous.getTrackComplete()-e,0):t=0),this.delay=t}reset(){this.next=null,this.previous=null,this.mixingFrom=null,this.mixingTo=null,this.animation=null,this.listener=null,this.timelineMode.length=0,this.timelineHoldMix.length=0,this.timelinesRotation.length=0}getAnimationTime(){if(this.loop){let e=this.animationEnd-this.animationStart;return e==0?this.animationStart:this.trackTime%e+this.animationStart}return Math.min(this.trackTime+this.animationStart,this.animationEnd)}setAnimationLast(e){this.animationLast=e,this.nextAnimationLast=e}isComplete(){return this.trackTime>=this.animationEnd-this.animationStart}resetRotationDirections(){this.timelinesRotation.length=0}getTrackComplete(){let e=this.animationEnd-this.animationStart;if(e!=0){if(this.loop)return e*(1+(this.trackTime/e|0));if(this.trackTime=0}}class BE{constructor(e){A(this,"objects",[]);A(this,"drainDisabled",!1);A(this,"animState");this.animState=e}start(e){this.objects.push(Ci.start),this.objects.push(e),this.animState.animationsChanged=!0}interrupt(e){this.objects.push(Ci.interrupt),this.objects.push(e)}end(e){this.objects.push(Ci.end),this.objects.push(e),this.animState.animationsChanged=!0}dispose(e){this.objects.push(Ci.dispose),this.objects.push(e)}complete(e){this.objects.push(Ci.complete),this.objects.push(e)}event(e,t){this.objects.push(Ci.event),this.objects.push(e),this.objects.push(t)}drain(){if(this.drainDisabled)return;this.drainDisabled=!0;let e=this.objects;for(let t=0;t{c.width=parseInt(s[1]),c.height=parseInt(s[2])},n.format=()=>{},n.filter=c=>{c.minFilter=Fe.enumValue(hi,s[1]),c.magFilter=Fe.enumValue(hi,s[2])},n.repeat=c=>{s[1].indexOf("x")!=-1&&(c.uWrap=yn.Repeat),s[1].indexOf("y")!=-1&&(c.vWrap=yn.Repeat)},n.pma=c=>{c.pma=s[1]=="true"};var r={};r.xy=c=>{c.x=parseInt(s[1]),c.y=parseInt(s[2])},r.size=c=>{c.width=parseInt(s[1]),c.height=parseInt(s[2])},r.bounds=c=>{c.x=parseInt(s[1]),c.y=parseInt(s[2]),c.width=parseInt(s[3]),c.height=parseInt(s[4])},r.offset=c=>{c.offsetX=parseInt(s[1]),c.offsetY=parseInt(s[2])},r.orig=c=>{c.originalWidth=parseInt(s[1]),c.originalHeight=parseInt(s[2])},r.offsets=c=>{c.offsetX=parseInt(s[1]),c.offsetY=parseInt(s[2]),c.originalWidth=parseInt(s[3]),c.originalHeight=parseInt(s[4])},r.rotate=c=>{let u=s[1];u=="true"?c.degrees=90:u!="false"&&(c.degrees=parseInt(u))},r.index=c=>{c.index=parseInt(s[1])};let o=t.readLine();for(;o&&o.trim().length==0;)o=t.readLine();for(;!(!o||o.trim().length==0||t.readEntry(s,o)==0);)o=t.readLine();let a=null,h=null,l=null;for(;o!==null;)if(o.trim().length==0)a=null,o=t.readLine();else if(a){let c=new Zy(a,o);for(;;){let u=t.readEntry(s,o=t.readLine());if(u==0)break;let f=r[s[0]];if(f)f(c);else{h||(h=[]),l||(l=[]),h.push(s[0]);let d=[];for(let m=0;m0&&l&&l.length>0&&(c.names=h,c.values=l,h=null,l=null),c.u=c.x/a.width,c.v=c.y/a.height,c.degrees==90?(c.u2=(c.x+c.height)/a.width,c.v2=(c.y+c.width)/a.height):(c.u2=(c.x+c.width)/a.width,c.v2=(c.y+c.height)/a.height),this.regions.push(c)}else{for(a=new YE(o.trim());t.readEntry(s,o=t.readLine())!=0;){let c=n[s[0]];c&&c(a)}this.pages.push(a)}}findRegion(e){for(let t=0;t=this.lines.length?null:this.lines[this.index++]}readEntry(e,t){if(!t||(t=t.trim(),t.length==0))return 0;let s=t.indexOf(":");if(s==-1)return 0;e[0]=t.substr(0,s).trim();for(let n=1,r=s+1;;n++){let o=t.indexOf(",",r);if(o==-1)return e[n]=t.substr(r).trim(),n;if(e[n]=t.substr(r,o-r).trim(),r=o+1,n==4)return 4}}}class YE{constructor(e){A(this,"name");A(this,"minFilter",hi.Nearest);A(this,"magFilter",hi.Nearest);A(this,"uWrap",yn.ClampToEdge);A(this,"vWrap",yn.ClampToEdge);A(this,"texture",null);A(this,"width",0);A(this,"height",0);A(this,"pma",!1);A(this,"regions",new Array);this.name=e}setTexture(e){this.texture=e,e.setFilters(this.minFilter,this.magFilter),e.setWraps(this.uWrap,this.vWrap);for(let t of this.regions)t.texture=e}}class Zy extends VE{constructor(t,s){super();A(this,"page");A(this,"name");A(this,"x",0);A(this,"y",0);A(this,"offsetX",0);A(this,"offsetY",0);A(this,"originalWidth",0);A(this,"originalHeight",0);A(this,"index",0);A(this,"degrees",0);A(this,"names",null);A(this,"values",null);this.page=t,this.name=s,t.regions.push(this)}}class Zn extends vs{constructor(t,s){super(t);A(this,"region",null);A(this,"path");A(this,"regionUVs",[]);A(this,"uvs",[]);A(this,"triangles",[]);A(this,"color",new ot(1,1,1,1));A(this,"width",0);A(this,"height",0);A(this,"hullLength",0);A(this,"edges",[]);A(this,"parentMesh",null);A(this,"sequence",null);A(this,"tempColor",new ot(0,0,0,0));this.path=s}updateRegion(){if(!this.region)throw new Error("Region not set.");let t=this.regionUVs;(!this.uvs||this.uvs.length!=t.length)&&(this.uvs=Fe.newFloatArray(t.length));let s=this.uvs,n=this.uvs.length,r=this.region.u,o=this.region.v,a=0,h=0;if(this.region instanceof Zy){let l=this.region,c=l.page,u=c.width,f=c.height;switch(l.degrees){case 90:r-=(l.originalHeight-l.offsetY-l.height)/u,o-=(l.originalWidth-l.offsetX-l.width)/f,a=l.originalHeight/u,h=l.originalWidth/f;for(let d=0;d= 0.");if(!t)throw new Error("name cannot be null.");this.index=e,this.name=t,this.parent=s}}var jt;(function(i){i[i.Normal=0]="Normal",i[i.OnlyTranslation=1]="OnlyTranslation",i[i.NoRotationOrReflection=2]="NoRotationOrReflection",i[i.NoScale=3]="NoScale",i[i.NoScaleOrReflection=4]="NoScaleOrReflection"})(jt||(jt={}));class hg{constructor(e,t,s){A(this,"data");A(this,"skeleton");A(this,"parent",null);A(this,"children",new Array);A(this,"x",0);A(this,"y",0);A(this,"rotation",0);A(this,"scaleX",0);A(this,"scaleY",0);A(this,"shearX",0);A(this,"shearY",0);A(this,"ax",0);A(this,"ay",0);A(this,"arotation",0);A(this,"ascaleX",0);A(this,"ascaleY",0);A(this,"ashearX",0);A(this,"ashearY",0);A(this,"a",0);A(this,"b",0);A(this,"c",0);A(this,"d",0);A(this,"worldY",0);A(this,"worldX",0);A(this,"inherit",jt.Normal);A(this,"sorted",!1);A(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.skeleton=t,this.parent=s,this.setToSetupPose()}isActive(){return this.active}update(e){this.updateWorldTransformWith(this.ax,this.ay,this.arotation,this.ascaleX,this.ascaleY,this.ashearX,this.ashearY)}updateWorldTransform(){this.updateWorldTransformWith(this.x,this.y,this.rotation,this.scaleX,this.scaleY,this.shearX,this.shearY)}updateWorldTransformWith(e,t,s,n,r,o,a){this.ax=e,this.ay=t,this.arotation=s,this.ascaleX=n,this.ascaleY=r,this.ashearX=o,this.ashearY=a;let h=this.parent;if(!h){let d=this.skeleton;const m=d.scaleX,g=d.scaleY,b=(s+o)*ke.degRad,_=(s+90+a)*ke.degRad;this.a=Math.cos(b)*n*m,this.b=Math.cos(_)*r*m,this.c=Math.sin(b)*n*g,this.d=Math.sin(_)*r*g,this.worldX=e*m+d.x,this.worldY=t*g+d.y;return}let l=h.a,c=h.b,u=h.c,f=h.d;switch(this.worldX=l*e+c*t+h.worldX,this.worldY=u*e+f*t+h.worldY,this.inherit){case jt.Normal:{const d=(s+o)*ke.degRad,m=(s+90+a)*ke.degRad,g=Math.cos(d)*n,b=Math.cos(m)*r,_=Math.sin(d)*n,M=Math.sin(m)*r;this.a=l*g+c*_,this.b=l*b+c*M,this.c=u*g+f*_,this.d=u*b+f*M;return}case jt.OnlyTranslation:{const d=(s+o)*ke.degRad,m=(s+90+a)*ke.degRad;this.a=Math.cos(d)*n,this.b=Math.cos(m)*r,this.c=Math.sin(d)*n,this.d=Math.sin(m)*r;break}case jt.NoRotationOrReflection:{let d=1/this.skeleton.scaleX,m=1/this.skeleton.scaleY;l*=d,u*=m;let g=l*l+u*u,b=0;g>1e-4?(g=Math.abs(l*f*m-c*d*u)/g,c=u*g,f=l*g,b=Math.atan2(u,l)*ke.radDeg):(l=0,u=0,b=90-Math.atan2(f,c)*ke.radDeg);const _=(s+o-b)*ke.degRad,M=(s+a-b+90)*ke.degRad,v=Math.cos(_)*n,S=Math.cos(M)*r,y=Math.sin(_)*n,I=Math.sin(M)*r;this.a=l*v-c*y,this.b=l*S-c*I,this.c=u*v+f*y,this.d=u*S+f*I;break}case jt.NoScale:case jt.NoScaleOrReflection:{s*=ke.degRad;const d=Math.cos(s),m=Math.sin(s);let g=(l*d+c*m)/this.skeleton.scaleX,b=(u*d+f*m)/this.skeleton.scaleY,_=Math.sqrt(g*g+b*b);_>1e-5&&(_=1/_),g*=_,b*=_,_=Math.sqrt(g*g+b*b),this.inherit==jt.NoScale&&l*f-c*u<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(_=-_),s=Math.PI/2+Math.atan2(b,g);const M=Math.cos(s)*_,v=Math.sin(s)*_;o*=ke.degRad,a=(90+a)*ke.degRad;const S=Math.cos(o)*n,y=Math.cos(a)*r,I=Math.sin(o)*n,E=Math.sin(a)*r;this.a=g*S+M*I,this.b=g*y+M*E,this.c=b*S+v*I,this.d=b*y+v*E;break}}this.a*=this.skeleton.scaleX,this.b*=this.skeleton.scaleX,this.c*=this.skeleton.scaleY,this.d*=this.skeleton.scaleY}setToSetupPose(){let e=this.data;this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY,this.inherit=e.inherit}updateAppliedTransform(){let e=this.parent;if(!e){this.ax=this.worldX-this.skeleton.x,this.ay=this.worldY-this.skeleton.y,this.arotation=Math.atan2(this.c,this.a)*ke.radDeg,this.ascaleX=Math.sqrt(this.a*this.a+this.c*this.c),this.ascaleY=Math.sqrt(this.b*this.b+this.d*this.d),this.ashearX=0,this.ashearY=Math.atan2(this.a*this.b+this.c*this.d,this.a*this.d-this.b*this.c)*ke.radDeg;return}let t=e.a,s=e.b,n=e.c,r=e.d,o=1/(t*r-s*n),a=r*o,h=s*o,l=n*o,c=t*o,u=this.worldX-e.worldX,f=this.worldY-e.worldY;this.ax=u*a-f*h,this.ay=f*c-u*l;let d,m,g,b;if(this.inherit==jt.OnlyTranslation)d=this.a,m=this.b,g=this.c,b=this.d;else{switch(this.inherit){case jt.NoRotationOrReflection:{let y=Math.abs(t*r-s*n)/(t*t+n*n);s=-n*this.skeleton.scaleX*y/this.skeleton.scaleY,r=t*this.skeleton.scaleY*y/this.skeleton.scaleX,o=1/(t*r-s*n),a=r*o,h=s*o;break}case jt.NoScale:case jt.NoScaleOrReflection:let _=ke.cosDeg(this.rotation),M=ke.sinDeg(this.rotation);t=(t*_+s*M)/this.skeleton.scaleX,n=(n*_+r*M)/this.skeleton.scaleY;let v=Math.sqrt(t*t+n*n);v>1e-5&&(v=1/v),t*=v,n*=v,v=Math.sqrt(t*t+n*n),this.inherit==jt.NoScale&&o<0!=(this.skeleton.scaleX<0!=this.skeleton.scaleY<0)&&(v=-v);let S=ke.PI/2+Math.atan2(n,t);s=Math.cos(S)*v,r=Math.sin(S)*v,o=1/(t*r-s*n),a=r*o,h=s*o,l=n*o,c=t*o}d=a*this.a-h*this.c,m=a*this.b-h*this.d,g=c*this.c-l*this.a,b=c*this.d-l*this.b}if(this.ashearX=0,this.ascaleX=Math.sqrt(d*d+g*g),this.ascaleX>1e-4){let _=d*b-m*g;this.ascaleY=_/this.ascaleX,this.ashearY=-Math.atan2(d*m+g*b,_)*ke.radDeg,this.arotation=Math.atan2(g,d)*ke.radDeg}else this.ascaleX=0,this.ascaleY=Math.sqrt(m*m+b*b),this.ashearY=0,this.arotation=90-Math.atan2(b,m)*ke.radDeg}getWorldRotationX(){return Math.atan2(this.c,this.a)*ke.radDeg}getWorldRotationY(){return Math.atan2(this.d,this.b)*ke.radDeg}getWorldScaleX(){return Math.sqrt(this.a*this.a+this.c*this.c)}getWorldScaleY(){return Math.sqrt(this.b*this.b+this.d*this.d)}worldToLocal(e){let t=1/(this.a*this.d-this.b*this.c),s=e.x-this.worldX,n=e.y-this.worldY;return e.x=s*this.d*t-n*this.b*t,e.y=n*this.a*t-s*this.c*t,e}localToWorld(e){let t=e.x,s=e.y;return e.x=t*this.a+s*this.b+this.worldX,e.y=t*this.c+s*this.d+this.worldY,e}worldToParent(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.worldToLocal(e)}parentToWorld(e){if(e==null)throw new Error("world cannot be null.");return this.parent==null?e:this.parent.localToWorld(e)}worldToLocalRotation(e){let t=ke.sinDeg(e),s=ke.cosDeg(e);return Math.atan2(this.a*t-this.c*s,this.d*s-this.b*t)*ke.radDeg+this.rotation-this.shearX}localToWorldRotation(e){e-=this.rotation-this.shearX;let t=ke.sinDeg(e),s=ke.cosDeg(e);return Math.atan2(s*this.c+t*this.d,s*this.a+t*this.b)*ke.radDeg}rotateWorld(e){e*=ke.degRad;const t=Math.sin(e),s=Math.cos(e),n=this.a,r=this.b;this.a=s*n-t*this.c,this.b=s*r-t*this.d,this.c=t*n+s*this.c,this.d=t*r+s*this.d}}class Uh{constructor(e,t,s){A(this,"name");A(this,"order");A(this,"skinRequired");this.name=e,this.order=t,this.skinRequired=s}}let Qy=class{constructor(e,t){A(this,"data");A(this,"intValue",0);A(this,"floatValue",0);A(this,"stringValue",null);A(this,"time",0);A(this,"volume",0);A(this,"balance",0);if(!t)throw new Error("data cannot be null.");this.time=e,this.data=t}};class ex{constructor(e){A(this,"name");A(this,"intValue",0);A(this,"floatValue",0);A(this,"stringValue",null);A(this,"audioPath",null);A(this,"volume",0);A(this,"balance",0);this.name=e}}class $E{constructor(e,t){A(this,"data");A(this,"bones");A(this,"target");A(this,"bendDirection",0);A(this,"compress",!1);A(this,"stretch",!1);A(this,"mix",1);A(this,"softness",0);A(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let n=0;n180?d-=360:d<-180&&(d+=360);let b=e.ascaleX,_=e.ascaleY;if(n||r){switch(e.inherit){case jt.NoScale:case jt.NoScaleOrReflection:m=t-e.worldX,g=s-e.worldY}const M=e.data.length*b;if(M>1e-4){const v=m*m+g*g;if(n&&vM*M){const S=(Math.sqrt(v)/M-1)*a+1;b*=S,o&&(_*=S)}}}e.updateWorldTransformWith(e.ax,e.ay,e.arotation+d*a,b,_,e.ashearX,e.ashearY)}apply2(e,t,s,n,r,o,a,h,l){if(e.inherit!=jt.Normal||t.inherit!=jt.Normal)return;let c=e.ax,u=e.ay,f=e.ascaleX,d=e.ascaleY,m=f,g=d,b=t.ascaleX,_=0,M=0,v=0;f<0?(f=-f,_=180,v=-1):(_=0,v=1),d<0&&(d=-d,v=-v),b<0?(b=-b,M=180):M=0;let S=t.ax,y=0,I=0,E=0,C=e.a,R=e.b,B=e.c,k=e.d,F=Math.abs(f-d)<=1e-4;!F||o?(y=0,I=C*S+e.worldX,E=B*S+e.worldY):(y=t.ay,I=C*S+R*y+e.worldX,E=B*S+k*y+e.worldY);let D=e.parent;if(!D)throw new Error("IK parent must itself have a parent.");C=D.a,R=D.b,B=D.c,k=D.d;let N=C*k-R*B,j=I-D.worldX,O=E-D.worldY;N=Math.abs(N)<=1e-4?0:1/N;let L=(j*k-O*R)*N-c,P=(O*C-j*B)*N-u,X=Math.sqrt(L*L+P*P),U=t.data.length*b,Y,q;if(X<1e-4){this.apply1(e,s,n,!1,o,!1,l),t.updateWorldTransformWith(S,y,0,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY);return}j=s-D.worldX,O=n-D.worldY;let z=(j*k-O*R)*N-c,ne=(O*C-j*B)*N-u,H=z*z+ne*ne;if(h!=0){h*=f*(b+1)*.5;let me=Math.sqrt(H),_e=me-X-U*f+h;if(_e>0){let te=Math.min(1,_e/(h*2))-1;te=(_e-h*(1-te*te))/me,z-=te*z,ne-=te*ne,H=z*z+ne*ne}}e:if(F){U*=f;let me=(H-X*X-U*U)/(2*X*U);me<-1?(me=-1,q=Math.PI*r):me>1?(me=1,q=0,o&&(C=(Math.sqrt(H)/(X+U)-1)*l+1,m*=C,a&&(g*=C))):q=Math.acos(me)*r,C=X+U*me,R=U*Math.sin(q),Y=Math.atan2(ne*C-z*R,z*C+ne*R)}else{C=f*U,R=d*U;let me=C*C,_e=R*R,te=Math.atan2(ne,z);B=_e*X*X+me*H-me*_e;let ve=-2*_e*X,$=_e-me;if(k=ve*ve-4*$*B,k>=0){let de=Math.sqrt(k);ve<0&&(de=-de),de=-(ve+de)*.5;let De=de/$,Ie=B/de,Be=Math.abs(De)=0){O=Math.sqrt(De)*r,Y=te-Math.atan2(O,Be),q=Math.atan2(O/d,(Be-X)/f);break e}}let W=ke.PI,J=X-C,Q=J*J,ie=0,ue=0,Se=X+C,Me=Se*Se,Ee=0;B=-C*X/(me-_e),B>=-1&&B<=1&&(B=Math.acos(B),j=C*Math.cos(B)+X,O=R*Math.sin(B),k=j*j+O*O,kMe&&(ue=B,Me=k,Se=j,Ee=O)),H<=(Q+Me)*.5?(Y=te-Math.atan2(ie*r,J),q=W*r):(Y=te-Math.atan2(Ee*r,Se),q=ue*r)}let Z=Math.atan2(y,S)*v,ae=e.arotation;Y=(Y-Z)*ke.radDeg+_-ae,Y>180?Y-=360:Y<-180&&(Y+=360),e.updateWorldTransformWith(c,u,ae+Y*l,m,g,0,0),ae=t.arotation,q=((q+Z)*ke.radDeg-t.ashearX)*v+M-ae,q>180?q-=360:q<-180&&(q+=360),t.updateWorldTransformWith(S,y,ae+q*l,t.ascaleX,t.ascaleY,t.ashearX,t.ashearY)}}class tx extends Uh{constructor(t){super(t,0,!1);A(this,"bones",new Array);A(this,"_target",null);A(this,"bendDirection",0);A(this,"compress",!1);A(this,"stretch",!1);A(this,"uniform",!1);A(this,"mix",0);A(this,"softness",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class ix extends Uh{constructor(t){super(t,0,!1);A(this,"bones",new Array);A(this,"_target",null);A(this,"positionMode",Gs.Fixed);A(this,"spacingMode",oi.Fixed);A(this,"rotateMode",wr.Chain);A(this,"offsetRotation",0);A(this,"position",0);A(this,"spacing",0);A(this,"mixRotate",0);A(this,"mixX",0);A(this,"mixY",0)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("SlotData not set.")}}var Gs;(function(i){i[i.Fixed=0]="Fixed",i[i.Percent=1]="Percent"})(Gs||(Gs={}));var oi;(function(i){i[i.Length=0]="Length",i[i.Fixed=1]="Fixed",i[i.Percent=2]="Percent",i[i.Proportional=3]="Proportional"})(oi||(oi={}));var wr;(function(i){i[i.Tangent=0]="Tangent",i[i.Chain=1]="Chain",i[i.ChainScale=2]="ChainScale"})(wr||(wr={}));const Ni=class Ni{constructor(e,t){A(this,"data");A(this,"bones");A(this,"target");A(this,"position",0);A(this,"spacing",0);A(this,"mixRotate",0);A(this,"mixX",0);A(this,"mixY",0);A(this,"spaces",new Array);A(this,"positions",new Array);A(this,"world",new Array);A(this,"curves",new Array);A(this,"lengths",new Array);A(this,"segments",new Array);A(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let n=0,r=e.bones.length;n0){S=u/S*m;for(let I=1;I0?ke.degRad:-.01745329277777778}for(let S=0,y=3;S0){let k=I.a,F=I.b,D=I.c,N=I.d,j=0,O=0,L=0;if(a?j=g[y-1]:f[S+1]==0?j=g[y+2]:j=Math.atan2(B,R),j-=Math.atan2(D,k),v){O=Math.cos(j),L=Math.sin(j);let P=I.data.length;b+=(P*(O*k-L*D)-R)*s,_+=(P*(L*k+O*D)-B)*s}else j+=M;j>ke.PI?j-=ke.PI2:j<-3.1415927&&(j+=ke.PI2),j*=s,O=Math.cos(j),L=Math.sin(j),I.a=O*k-L*D,I.b=O*F-L*N,I.c=L*k+O*D,I.d=L*F+O*N}I.updateAppliedTransform()}}computeWorldPositions(e,t,s){let n=this.target,r=this.position,o=this.spaces,a=Fe.setArraySize(this.positions,t*3+2),h=this.world,l=e.closed,c=e.worldVerticesLength,u=c/6,f=Ni.NONE;if(!e.constantSpeed){let P=e.lengths;u-=l?1:2;let X=P[u];this.data.positionMode==Gs.Percent&&(r*=X);let U;switch(this.data.spacingMode){case oi.Percent:U=X;break;case oi.Proportional:U=X/t;break;default:U=1}h=Fe.setArraySize(this.world,8);for(let Y=0,q=0,z=0;YX){f!=Ni.AFTER&&(f=Ni.AFTER,e.computeWorldVertices(n,c-6,4,h,0,2)),this.addAfterPosition(H-X,h,0,a,q);continue}for(;;z++){let Z=P[z];if(!(H>Z)){if(z==0)H/=Z;else{let ae=P[z-1];H=(H-ae)/(Z-ae)}break}}z!=f&&(f=z,l&&z==u?(e.computeWorldVertices(n,c-4,4,h,0,2),e.computeWorldVertices(n,0,4,h,4,2)):e.computeWorldVertices(n,z*6+2,8,h,0,2)),this.addCurvePosition(H,h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],a,q,s||Y>0&&ne==0)}return a}l?(c+=2,h=Fe.setArraySize(this.world,c),e.computeWorldVertices(n,2,c-4,h,0,2),e.computeWorldVertices(n,0,2,h,c-4,2),h[c-2]=h[0],h[c-1]=h[1]):(u--,c-=4,h=Fe.setArraySize(this.world,c),e.computeWorldVertices(n,2,c,h,0,2));let d=Fe.setArraySize(this.curves,u),m=0,g=h[0],b=h[1],_=0,M=0,v=0,S=0,y=0,I=0,E=0,C=0,R=0,B=0,k=0,F=0,D=0,N=0;for(let P=0,X=2;Pm){this.addAfterPosition(z-m,h,c-4,a,X);continue}for(;;U++){let ne=d[U];if(!(z>ne)){if(U==0)z/=ne;else{let H=d[U-1];z=(z-H)/(ne-H)}break}}if(U!=f){f=U;let ne=U*6;for(g=h[ne],b=h[ne+1],_=h[ne+2],M=h[ne+3],v=h[ne+4],S=h[ne+5],y=h[ne+6],I=h[ne+7],E=(g-_*2+v)*.03,C=(b-M*2+S)*.03,R=((_-v)*3-g+y)*.006,B=((M-S)*3-b+I)*.006,k=E*2+R,F=C*2+B,D=(_-g)*.3+E+R*.16666667,N=(M-b)*.3+C+B*.16666667,L=Math.sqrt(D*D+N*N),O[0]=L,ne=1;ne<8;ne++)D+=k,N+=F,k+=R,F+=B,L+=Math.sqrt(D*D+N*N),O[ne]=L;D+=k,N+=F,L+=Math.sqrt(D*D+N*N),O[8]=L,D+=k+R,N+=F+B,L+=Math.sqrt(D*D+N*N),O[9]=L,Y=0}for(z*=L;;Y++){let ne=O[Y];if(!(z>ne)){if(Y==0)z/=ne;else{let H=O[Y-1];z=Y+(z-H)/(ne-H)}break}}this.addCurvePosition(z*.1,g,b,_,M,v,S,y,I,a,X,s||P>0&&q==0)}return a}addBeforePosition(e,t,s,n,r){let o=t[s],a=t[s+1],h=t[s+2]-o,l=t[s+3]-a,c=Math.atan2(l,h);n[r]=o+e*Math.cos(c),n[r+1]=a+e*Math.sin(c),n[r+2]=c}addAfterPosition(e,t,s,n,r){let o=t[s+2],a=t[s+3],h=o-t[s],l=a-t[s+1],c=Math.atan2(l,h);n[r]=o+e*Math.cos(c),n[r+1]=a+e*Math.sin(c),n[r+2]=c}addCurvePosition(e,t,s,n,r,o,a,h,l,c,u,f){if(e==0||isNaN(e)){c[u]=t,c[u+1]=s,c[u+2]=Math.atan2(r-s,n-t);return}let d=e*e,m=d*e,g=1-e,b=g*g,_=b*g,M=g*e,v=M*3,S=g*v,y=v*e,I=t*_+n*S+o*y+h*m,E=s*_+r*S+a*y+l*m;c[u]=I,c[u+1]=E,f&&(e<.001?c[u+2]=Math.atan2(r-s,n-t):c[u+2]=Math.atan2(E-(s*b+r*M*2+a*d),I-(t*b+n*M*2+o*d)))}};A(Ni,"NONE",-1),A(Ni,"BEFORE",-2),A(Ni,"AFTER",-3),A(Ni,"epsilon",1e-5);let Ed=Ni;class GE{constructor(e,t){A(this,"data");A(this,"_bone",null);A(this,"inertia",0);A(this,"strength",0);A(this,"damping",0);A(this,"massInverse",0);A(this,"wind",0);A(this,"gravity",0);A(this,"mix",0);A(this,"_reset",!0);A(this,"ux",0);A(this,"uy",0);A(this,"cx",0);A(this,"cy",0);A(this,"tx",0);A(this,"ty",0);A(this,"xOffset",0);A(this,"xVelocity",0);A(this,"yOffset",0);A(this,"yVelocity",0);A(this,"rotateOffset",0);A(this,"rotateVelocity",0);A(this,"scaleOffset",0);A(this,"scaleVelocity",0);A(this,"active",!1);A(this,"skeleton");A(this,"remaining",0);A(this,"lastTime",0);this.data=e,this.skeleton=t,this.bone=t.bones[e.bone.index],this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}set bone(e){this._bone=e}get bone(){if(this._bone)return this._bone;throw new Error("Bone not set.")}reset(){this.remaining=0,this.lastTime=this.skeleton.time,this._reset=!0,this.xOffset=0,this.xVelocity=0,this.yOffset=0,this.yVelocity=0,this.rotateOffset=0,this.rotateVelocity=0,this.scaleOffset=0,this.scaleVelocity=0}setToSetupPose(){const e=this.data;this.inertia=e.inertia,this.strength=e.strength,this.damping=e.damping,this.massInverse=e.massInverse,this.wind=e.wind,this.gravity=e.gravity,this.mix=e.mix}isActive(){return this.active}update(e){const t=this.mix;if(t==0)return;const s=this.data.x>0,n=this.data.y>0,r=this.data.rotate>0||this.data.shearX>0,o=this.data.scaleX>0,a=this.bone,h=a.data.length;switch(e){case Xn.none:return;case Xn.reset:this.reset();case Xn.update:const l=this.skeleton,c=Math.max(this.skeleton.time-this.lastTime,0);this.remaining+=c,this.lastTime=l.time;const u=a.worldX,f=a.worldY;if(this._reset)this._reset=!1,this.ux=u,this.uy=f;else{let d=this.remaining,m=this.inertia,g=this.data.step,b=this.skeleton.data.referenceScale,_=-1,M=this.data.limit*c,v=M*Math.abs(l.scaleY);if(M*=Math.abs(l.scaleX),s||n){if(s){const S=(this.ux-u)*m;this.xOffset+=S>M?M:S<-M?-M:S,this.ux=u}if(n){const S=(this.uy-f)*m;this.yOffset+=S>v?v:S<-v?-v:S,this.uy=f}if(d>=g){_=Math.pow(this.damping,60*g);const S=this.massInverse*g,y=this.strength,I=this.wind*b*l.scaleX,E=this.gravity*b*l.scaleY;do s&&(this.xVelocity+=(I-this.xOffset*y)*S,this.xOffset+=this.xVelocity*g,this.xVelocity*=_),n&&(this.yVelocity-=(E+this.yOffset*y)*S,this.yOffset+=this.yVelocity*g,this.yVelocity*=_),d-=g;while(d>=g)}s&&(a.worldX+=this.xOffset*t*this.data.x),n&&(a.worldY+=this.yOffset*t*this.data.y)}if(r||o){let S=Math.atan2(a.c,a.a),y=0,I=0,E=0,C=this.cx-a.worldX,R=this.cy-a.worldY;if(C>M?C=M:C<-M&&(C=-M),R>v?R=v:R<-v&&(R=-v),r){E=(this.data.rotate+this.data.shearX)*t;let B=Math.atan2(R+this.ty,C+this.tx)-S-this.rotateOffset*E;this.rotateOffset+=(B-Math.ceil(B*ke.invPI2-.5)*ke.PI2)*m,B=this.rotateOffset*E+S,y=Math.cos(B),I=Math.sin(B),o&&(B=h*a.getWorldScaleX(),B>0&&(this.scaleOffset+=(C*y+R*I)*m/B))}else{y=Math.cos(S),I=Math.sin(S);const B=h*a.getWorldScaleX();B>0&&(this.scaleOffset+=(C*y+R*I)*m/B)}if(d=this.remaining,d>=g){_==-1&&(_=Math.pow(this.damping,60*g));const B=this.massInverse*g,k=this.strength,F=this.wind,D=ya.yDown?-this.gravity:this.gravity,N=h/b;for(;;)if(d-=g,o&&(this.scaleVelocity+=(F*y-D*I-this.scaleOffset*k)*B,this.scaleOffset+=this.scaleVelocity*g,this.scaleVelocity*=_),r){if(this.rotateVelocity-=((F*I+D*y)*N+this.rotateOffset*k)*B,this.rotateOffset+=this.rotateVelocity*g,this.rotateVelocity*=_,d0){let d=0;this.data.rotate>0&&(d=l*this.data.rotate,c=Math.sin(d),u=Math.cos(d),f=a.b,a.b=u*f-c*a.d,a.d=c*f+u*a.d),d+=l*this.data.shearX,c=Math.sin(d),u=Math.cos(d),f=a.a,a.a=u*f-c*a.c,a.c=c*f+u*a.c}else l*=this.data.rotate,c=Math.sin(l),u=Math.cos(l),f=a.a,a.a=u*f-c*a.c,a.c=c*f+u*a.c,f=a.b,a.b=u*f-c*a.d,a.d=c*f+u*a.d}if(o){const l=1+this.scaleOffset*t*this.data.scaleX;a.a*=l,a.c*=l}e!=Xn.pose&&(this.tx=h*a.a,this.ty=h*a.c),a.updateAppliedTransform()}translate(e,t){this.ux-=e,this.uy-=t,this.cx-=e,this.cy-=t}rotate(e,t,s){const n=s*ke.degRad,r=Math.cos(n),o=Math.sin(n),a=this.cx-e,h=this.cy-t;this.translate(a*r-h*o-a,a*o+h*r-h)}}class jE{constructor(e,t){A(this,"data");A(this,"bone");A(this,"color");A(this,"darkColor",null);A(this,"attachment",null);A(this,"attachmentState",0);A(this,"sequenceIndex",-1);A(this,"deform",new Array);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("bone cannot be null.");this.data=e,this.bone=t,this.color=new ot,this.darkColor=e.darkColor?new ot:null,this.setToSetupPose()}getSkeleton(){return this.bone.skeleton}getAttachment(){return this.attachment}setAttachment(e){this.attachment!=e&&((!(e instanceof vs)||!(this.attachment instanceof vs)||e.timelineAttachment!=this.attachment.timelineAttachment)&&(this.deform.length=0),this.attachment=e,this.sequenceIndex=-1)}setToSetupPose(){this.color.setFromColor(this.data.color),this.darkColor&&this.darkColor.setFromColor(this.data.darkColor),this.data.attachmentName?(this.attachment=null,this.setAttachment(this.bone.skeleton.getAttachment(this.data.index,this.data.attachmentName))):this.attachment=null}}class HE{constructor(e,t){A(this,"data");A(this,"bones");A(this,"target");A(this,"mixRotate",0);A(this,"mixX",0);A(this,"mixY",0);A(this,"mixScaleX",0);A(this,"mixScaleY",0);A(this,"mixShearY",0);A(this,"temp",new ql);A(this,"active",!1);if(!e)throw new Error("data cannot be null.");if(!t)throw new Error("skeleton cannot be null.");this.data=e,this.bones=new Array;for(let n=0;n0?ke.degRad:-.01745329277777778,m=this.data.offsetRotation*d,g=this.data.offsetShearY*d,b=this.bones;for(let _=0,M=b.length;_ke.PI?C-=ke.PI2:C<-3.1415927&&(C+=ke.PI2),C*=e;let R=Math.cos(C),B=Math.sin(C);v.a=R*S-B*I,v.b=R*y-B*E,v.c=B*S+R*I,v.d=B*y+R*E}if(a){let S=this.temp;h.localToWorld(S.set(this.data.offsetX,this.data.offsetY)),v.worldX+=(S.x-v.worldX)*t,v.worldY+=(S.y-v.worldY)*s}if(n!=0){let S=Math.sqrt(v.a*v.a+v.c*v.c);S!=0&&(S=(S+(Math.sqrt(l*l+u*u)-S+this.data.offsetScaleX)*n)/S),v.a*=S,v.c*=S}if(r!=0){let S=Math.sqrt(v.b*v.b+v.d*v.d);S!=0&&(S=(S+(Math.sqrt(c*c+f*f)-S+this.data.offsetScaleY)*r)/S),v.b*=S,v.d*=S}if(o>0){let S=v.b,y=v.d,I=Math.atan2(y,S),E=Math.atan2(f,c)-Math.atan2(u,l)-(I-Math.atan2(v.c,v.a));E>ke.PI?E-=ke.PI2:E<-3.1415927&&(E+=ke.PI2),E=I+(E+g)*o;let C=Math.sqrt(S*S+y*y);v.b=Math.cos(E)*C,v.d=Math.sin(E)*C}v.updateAppliedTransform()}}applyRelativeWorld(){let e=this.mixRotate,t=this.mixX,s=this.mixY,n=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=t!=0||s!=0,h=this.target,l=h.a,c=h.b,u=h.c,f=h.d,d=l*f-c*u>0?ke.degRad:-.01745329277777778,m=this.data.offsetRotation*d,g=this.data.offsetShearY*d,b=this.bones;for(let _=0,M=b.length;_ke.PI?C-=ke.PI2:C<-3.1415927&&(C+=ke.PI2),C*=e;let R=Math.cos(C),B=Math.sin(C);v.a=R*S-B*I,v.b=R*y-B*E,v.c=B*S+R*I,v.d=B*y+R*E}if(a){let S=this.temp;h.localToWorld(S.set(this.data.offsetX,this.data.offsetY)),v.worldX+=S.x*t,v.worldY+=S.y*s}if(n!=0){let S=(Math.sqrt(l*l+u*u)-1+this.data.offsetScaleX)*n+1;v.a*=S,v.c*=S}if(r!=0){let S=(Math.sqrt(c*c+f*f)-1+this.data.offsetScaleY)*r+1;v.b*=S,v.d*=S}if(o>0){let S=Math.atan2(f,c)-Math.atan2(u,l);S>ke.PI?S-=ke.PI2:S<-3.1415927&&(S+=ke.PI2);let y=v.b,I=v.d;S=Math.atan2(I,y)+(S-ke.PI/2+g)*o;let E=Math.sqrt(y*y+I*I);v.b=Math.cos(S)*E,v.d=Math.sin(S)*E}v.updateAppliedTransform()}}applyAbsoluteLocal(){let e=this.mixRotate,t=this.mixX,s=this.mixY,n=this.mixScaleX,r=this.mixScaleY,o=this.mixShearY,a=this.target,h=this.bones;for(let l=0,c=h.length;lt.data.name==e)??null}findTransformConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.transformConstraints.find(t=>t.data.name==e)??null}findPathConstraint(e){if(!e)throw new Error("constraintName cannot be null.");return this.pathConstraints.find(t=>t.data.name==e)??null}findPhysicsConstraint(e){if(e==null)throw new Error("constraintName cannot be null.");return this.physicsConstraints.find(t=>t.data.name==e)??null}getBoundsRect(e){let t=new ql,s=new ql;return this.getBounds(t,s,void 0,e),{x:t.x,y:t.y,width:s.x,height:s.y}}getBounds(e,t,s=new Array(2),n=null){if(!e)throw new Error("offset cannot be null.");if(!t)throw new Error("size cannot be null.");let r=this.drawOrder,o=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY;for(let c=0,u=r.length;c=n.length&&(n.length=e+1),n[e]||(n[e]={}),n[e][t]=s}addSkin(e){for(let n=0;n= 0.");if(!t)throw new Error("name cannot be null.");if(!s)throw new Error("boneData cannot be null.");this.index=e,this.name=t,this.boneData=s}}var Hn;(function(i){i[i.Normal=0]="Normal",i[i.Additive=1]="Additive",i[i.Multiply=2]="Multiply",i[i.Screen=3]="Screen"})(Hn||(Hn={}));class rx extends Uh{constructor(t){super(t,0,!1);A(this,"bones",new Array);A(this,"_target",null);A(this,"mixRotate",0);A(this,"mixX",0);A(this,"mixY",0);A(this,"mixScaleX",0);A(this,"mixScaleY",0);A(this,"mixShearY",0);A(this,"offsetRotation",0);A(this,"offsetX",0);A(this,"offsetY",0);A(this,"offsetScaleX",0);A(this,"offsetScaleY",0);A(this,"offsetShearY",0);A(this,"relative",!1);A(this,"local",!1)}set target(t){this._target=t}get target(){if(this._target)return this._target;throw new Error("BoneData not set.")}}class Cd{constructor(e){A(this,"scale",1);A(this,"attachmentLoader");A(this,"linkedMeshes",new Array);this.attachmentLoader=e}readSkeletonData(e){let t=this.scale,s=new eh;s.name="";let n=new WE(e),r=n.readInt32(),o=n.readInt32();s.hash=o==0&&r==0?null:o.toString(16)+r.toString(16),s.version=n.readString(),s.x=n.readFloat(),s.y=n.readFloat(),s.width=n.readFloat(),s.height=n.readFloat(),s.referenceScale=n.readFloat()*t;let a=n.readBoolean();a&&(s.fps=n.readFloat(),s.imagesPath=n.readString(),s.audioPath=n.readString());let h=0;h=n.readInt(!0);for(let c=0;c>1&3,d.rotateMode=m>>3&3,(m&128)!=0&&(d.offsetRotation=n.readFloat()),d.position=n.readFloat(),d.positionMode==Gs.Fixed&&(d.position*=t),d.spacing=n.readFloat(),(d.spacingMode==oi.Length||d.spacingMode==oi.Fixed)&&(d.spacing*=t),d.mixRotate=n.readFloat(),d.mixX=n.readFloat(),d.mixY=n.readFloat(),s.pathConstraints.push(d)}h=n.readInt(!0);for(let c=0,u;c>4,e.readFloat())}n.push(I);break}}}}}let o=e.readInt(!0);if(o>0){let l=new br(o),c=s.slots.length;for(let u=0;u=0;M--)m[M]=-1;let g=Fe.newArray(c-d,0),b=0,_=0;for(let M=0;M=0;M--)m[M]==-1&&(m[M]=g[--_]);l.setFrame(u,f,m)}n.push(l)}let a=e.readInt(!0);if(a>0){let l=new va(a);for(let c=0;c>>1^-(s&1)}readStringRef(){let e=this.readInt(!0);return e==0?null:this.strings[e-1]}readString(){let e=this.readInt(!0);switch(e){case 0:return null;case 1:return""}e--;let t="";for(let s=0;s>4){case 12:case 13:t+=String.fromCharCode((n&31)<<6|this.readByte()&63),s+=2;break;case 14:t+=String.fromCharCode((n&15)<<12|(this.readByte()&63)<<6|this.readByte()&63),s+=3;break;default:t+=String.fromCharCode(n),s++}}return t}readFloat(){let e=this.buffer.getFloat32(this.index);return this.index+=4,e}readBoolean(){return this.readByte()!=0}}let zE=class{constructor(e,t,s,n,r){A(this,"parent");A(this,"skinIndex");A(this,"slotIndex");A(this,"mesh");A(this,"inheritTimeline");this.mesh=e,this.skinIndex=t,this.slotIndex=s,this.parent=n,this.inheritTimeline=r}};class qE{constructor(e=null,t=null,s=0){A(this,"bones");A(this,"vertices");A(this,"length");this.bones=e,this.vertices=t,this.length=s}}var on;(function(i){i[i.Region=0]="Region",i[i.BoundingBox=1]="BoundingBox",i[i.Mesh=2]="Mesh",i[i.LinkedMesh=3]="LinkedMesh",i[i.Path=4]="Path",i[i.Point=5]="Point",i[i.Clipping=6]="Clipping"})(on||(on={}));function vi(i,e,t){let s=i.readFloat(),n=i.readFloat()*t;for(let r=0,o=0,a=e.getFrameCount()-1;e.setFrame(r,s,n),r!=a;r++){let h=i.readFloat(),l=i.readFloat()*t;switch(i.readByte()){case ks:e.setStepped(r);break;case Fs:gt(i,e,o++,r,0,s,h,n,l,t)}s=h,n=l}return e}function Mu(i,e,t){let s=i.readFloat(),n=i.readFloat()*t,r=i.readFloat()*t;for(let o=0,a=0,h=e.getFrameCount()-1;e.setFrame(o,s,n,r),o!=h;o++){let l=i.readFloat(),c=i.readFloat()*t,u=i.readFloat()*t;switch(i.readByte()){case ks:e.setStepped(o);break;case Fs:gt(i,e,a++,o,0,s,l,n,c,t),gt(i,e,a++,o,1,s,l,r,u,t)}s=l,n=c,r=u}return e}function gt(i,e,t,s,n,r,o,a,h,l){e.setBezier(t,s,n,r,a,i.readFloat(),i.readFloat()*l,i.readFloat(),i.readFloat()*l,o,h)}const KE=0,ZE=1,JE=2,QE=3,eA=4,tA=5,iA=6,sA=7,nA=8,rA=9,oA=10,aA=0,lA=1,hA=2,cA=3,uA=4,dA=5,fA=0,pA=1,mA=0,gA=1,vA=2,yA=0,xA=1,bA=2,wA=4,_A=5,SA=6,TA=7,MA=8,ks=1,Fs=2;class Ii{constructor(){A(this,"convexPolygons",new Array);A(this,"convexPolygonsIndices",new Array);A(this,"indicesArray",new Array);A(this,"isConcaveArray",new Array);A(this,"triangles",new Array);A(this,"polygonPool",new zl(()=>new Array));A(this,"polygonIndicesPool",new zl(()=>new Array))}triangulate(e){let t=e,s=e.length>>1,n=this.indicesArray;n.length=0;for(let a=0;a3;){let a=s-1,h=0,l=1;for(;;){e:if(!r[h]){let f=n[a]<<1,d=n[h]<<1,m=n[l]<<1,g=t[f],b=t[f+1],_=t[d],M=t[d+1],v=t[m],S=t[m+1];for(let y=(l+1)%s;y!=a;y=(y+1)%s){if(!r[y])continue;let I=n[y]<<1,E=t[I],C=t[I+1];if(Ii.positiveArea(v,S,g,b,E,C)&&Ii.positiveArea(g,b,_,M,E,C)&&Ii.positiveArea(_,M,v,S,E,C))break e}break}if(l==0){do{if(!r[h])break;h--}while(h>0);break}a=h,h=l,l=(l+1)%s}o.push(n[(s+h-1)%s]),o.push(n[h]),o.push(n[(h+1)%s]),n.splice(h,1),r.splice(h,1),s--;let c=(s+h-1)%s,u=h==s?0:h;r[c]=Ii.isConcave(c,s,t,n),r[u]=Ii.isConcave(u,s,t,n)}return s==3&&(o.push(n[2]),o.push(n[0]),o.push(n[1])),o}decompose(e,t){let s=e,n=this.convexPolygons;this.polygonPool.freeAll(n),n.length=0;let r=this.convexPolygonsIndices;this.polygonIndicesPool.freeAll(r),r.length=0;let o=this.polygonIndicesPool.obtain();o.length=0;let a=this.polygonPool.obtain();a.length=0;let h=-1,l=0;for(let c=0,u=t.length;c0?(n.push(a),r.push(o)):(this.polygonPool.free(a),this.polygonIndicesPool.free(o)),a=this.polygonPool.obtain(),a.length=0,a.push(g),a.push(b),a.push(_),a.push(M),a.push(v),a.push(S),o=this.polygonIndicesPool.obtain(),o.length=0,o.push(f),o.push(d),o.push(m),l=Ii.winding(g,b,_,M,v,S),h=f)}a.length>0&&(n.push(a),r.push(o));for(let c=0,u=n.length;c=0;c--)a=n[c],a.length==0&&(n.splice(c,1),this.polygonPool.free(a),o=r[c],r.splice(c,1),this.polygonIndicesPool.free(o));return n}static isConcave(e,t,s,n){let r=n[(t+e-1)%t]<<1,o=n[e]<<1,a=n[(e+1)%t]<<1;return!this.positiveArea(s[r],s[r+1],s[o],s[o+1],s[a],s[a+1])}static positiveArea(e,t,s,n,r,o){return e*(o-n)+s*(t-o)+r*(n-t)>=0}static winding(e,t,s,n,r,o){let a=s-e,h=n-t;return r*h-o*a+a*t-e*h>=0?1:-1}}class th{constructor(){A(this,"triangulator",new Ii);A(this,"clippingPolygon",new Array);A(this,"clipOutput",new Array);A(this,"clippedVertices",new Array);A(this,"clippedUVs",new Array);A(this,"clippedTriangles",new Array);A(this,"scratch",new Array);A(this,"clipAttachment",null);A(this,"clippingPolygons",null)}clipStart(e,t){if(this.clipAttachment)return 0;this.clipAttachment=t;let s=t.worldVerticesLength,n=Fe.setArraySize(this.clippingPolygon,s);t.computeWorldVertices(e,0,s,n,0,2);let r=this.clippingPolygon;th.makeClockwise(r);let o=this.clippingPolygons=this.triangulator.decompose(r,this.triangulator.triangulate(r));for(let a=0,h=o.length;a>1,I=this.clipOutput,E=Fe.setArraySize(r,v+y*2);for(let R=0;R>1,q=this.clipOutput,z=Fe.setArraySize(l,N+Y*d);for(let H=0;H>1,X=this.clipOutput,U=Fe.setArraySize(o,k+P*2),Y=Fe.setArraySize(a,k+P*2);for(let z=0;z=2?(u=h,h=this.scratch):u=this.scratch,u.length=0,u.push(e),u.push(t),u.push(s),u.push(n),u.push(r),u.push(o),u.push(e),u.push(t),h.length=0;let f=a.length-4,d=a;for(let m=0;;m+=2){let g=d[m],b=d[m+1],_=g-d[m+2],M=b-d[m+3],v=h.length,S=u;for(let I=0,E=u.length-2;I_*(b-k),D=M*(g-C)-_*(b-R);if(D>0){if(F){h.push(B),h.push(k);continue}let N=B-C,j=k-R,O=D/(N*M-j*_);if(O>=0&&O<=1)h.push(C+N*O),h.push(R+j*O);else{h.push(B),h.push(k);continue}}else if(F){let N=B-C,j=k-R,O=D/(N*M-j*_);if(O>=0&&O<=1)h.push(C+N*O),h.push(R+j*O),h.push(B),h.push(k);else{h.push(B),h.push(k);continue}}c=!0}if(v==h.length)return l.length=0,!0;if(h.push(h[0]),h.push(h[1]),m==f)break;let y=h;h=u,h.length=0,u=y}if(l!=h){l.length=0;for(let m=0,g=h.length-2;m>1;l0){let c=s.findPhysicsConstraint(a);if(!c)throw new Error("Physics constraint not found: "+a);l=s.physicsConstraints.indexOf(c)}for(let c in h){let u=h[c],f=u[0];if(!f)continue;let d=u.length;if(c=="reset"){const g=new Jl(d,l);for(let b=0;f!=null;f=u[b+1],b++)g.setFrame(b,ee(f,"time",0));r.push(g);continue}let m;if(c=="inertia")m=new $y(d,d,l);else if(c=="strength")m=new Gy(d,d,l);else if(c=="damping")m=new jy(d,d,l);else if(c=="mass")m=new Hy(d,d,l);else if(c=="wind")m=new Wy(d,d,l);else if(c=="gravity")m=new zy(d,d,l);else if(c=="mix")m=new qy(d,d,l);else continue;r.push(ss(u,m,0,1))}}if(e.attachments)for(let a in e.attachments){let h=e.attachments[a],l=s.findSkin(a);if(!l)throw new Error("Skin not found: "+a);for(let c in h){let u=h[c],f=s.findSlot(c);if(!f)throw new Error("Slot not found: "+c);let d=f.index;for(let m in u){let g=u[m],b=l.getAttachment(d,m);for(let _ in g){let M=g[_],v=M[0];if(v){if(_=="deform"){let S=b.bones,y=b.vertices,I=S?y.length/3*2:y.length,E=new Dy(M.length,M.length,d,b),C=ee(v,"time",0);for(let R=0,B=0;;R++){let k,F=ee(v,"vertices",null);if(!F)k=S?Fe.newFloatArray(I):y;else{k=Fe.newFloatArray(I);let O=ee(v,"offset",0);if(Fe.arrayCopy(F,0,k,O,F.length),n!=1)for(let L=O,P=L+F.length;L=0;_--)f[_]==-1&&(f[_]=m[--b])}a.setFrame(l,ee(u,"time",0),f)}r.push(a)}if(e.events){let a=new va(e.events.length),h=0;for(let l=0;l"u"&&(Math.fround=(function(i){return function(e){return i[0]=e,i[0]}})(new Float32Array(1)));const an=class an extends UE{constructor(t){super(t.resource.source);A(this,"texture");this.texture=et.from(t)}static from(t){return an.textureMap.has(t)?an.textureMap.get(t):new an(t)}setFilters(t,s){this.texture.baseTexture.scaleMode=an.toPixiTextureFilter(t),this.texture.baseTexture.mipmap=an.toPixiMipMap(t)}setWraps(t,s){this.texture.baseTexture.wrapMode=an.toPixiTextureWrap(t)}dispose(){this.texture.destroy()}static toPixiTextureFilter(t){switch(t){case hi.Nearest:case hi.MipMapNearestLinear:case hi.MipMapNearestNearest:return as.NEAREST;case hi.Linear:case hi.MipMapLinearLinear:case hi.MipMapLinearNearest:return as.LINEAR;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiMipMap(t){switch(t){case hi.Nearest:case hi.Linear:return Ki.OFF;case hi.MipMapNearestLinear:case hi.MipMapNearestNearest:case hi.MipMapLinearLinear:case hi.MipMapLinearNearest:return Ki.ON;default:throw new Error(`Unknown texture filter: ${String(t)}`)}}static toPixiTextureWrap(t){switch(t){case yn.ClampToEdge:return us.CLAMP;case yn.MirroredRepeat:return us.MIRRORED_REPEAT;case yn.Repeat:return us.REPEAT;default:throw new Error(`Unknown texture wrap: ${String(t)}`)}}static toPixiBlending(t){switch(t){case Hn.Normal:return Qe.NORMAL;case Hn.Additive:return Qe.ADD;case Hn.Multiply:return Qe.MULTIPLY;case Hn.Screen:return Qe.SCREEN;default:throw new Error(`Unknown blendMode: ${String(t)}`)}}};A(an,"textureMap",new Map);let Ar=an;const ln=class ln extends ma{constructor(){const t=new hf;t.getBuffer("aVertexPosition").static=!1,t.getBuffer("aTextureCoord").static=!1;const s=new jl(et.EMPTY);super(t,s);A(this,"name","");A(this,"warnedTwoTint",!1)}updateFromSpineData(t,s,n,r,o,a,h,l){var _,M;this.texture=t.texture;const c=o/(l?12:8)*2,u=this.geometry.getBuffer("aTextureCoord");((_=u.data)==null?void 0:_.length)!==c&&(u.data=new Float32Array(c));const f=this.geometry.getBuffer("aVertexPosition");((M=f.data)==null?void 0:M.length)!==c&&(f.data=new Float32Array(c));let d=0,m=u.data,g=f.data;for(let v=0;vnew Id);A(this,"beforeUpdateWorldTransforms",()=>{});A(this,"afterUpdateWorldTransforms",()=>{});A(this,"_autoUpdate",!1);A(this,"_ticker",Ei.shared);A(this,"meshesCache",new Map);A(this,"lightColor",new ot);A(this,"darkColor",new ot);A(this,"_boundsProvider");A(this,"_boundsPoint",new bt);A(this,"_boundsSpineID",-1);A(this,"_boundsSpineDirty",!0);A(this,"slotsObject",new Map);A(this,"verticesCache",Fe.newFloatArray(1024));A(this,"clippingSlotToPixiMasks",{});A(this,"currentClippingSlot");const n=t instanceof eh?t:t.skeletonData;this.skeleton=new ya(n);const r=new NE(n);this.state=new Td(r),(t==null?void 0:t.darkTint)!==void 0||(s==null?void 0:s.slotMeshFactory)===void 0?(this.darkTint=(t==null?void 0:t.darkTint)===void 0?this.skeleton.slots.some(o=>!!o.data.darkColor):t==null?void 0:t.darkTint,this.darkTint&&(this.slotMeshFactory=()=>new sa)):this.initializeMeshFactory(s==null?void 0:s.slotMeshFactory),t!=null&&t.ticker&&(this._ticker=t.ticker),this.autoUpdate=(t==null?void 0:t.autoUpdate)??!0,this.boundsProvider=t.boundsProvider}get debug(){return this._debug}set debug(t){this._debug&&this._debug.unregisterSpine(this),t&&t.registerSpine(this),this._debug=t}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t&&!this._autoUpdate?this._ticker.add(this.internalUpdate,this):!t&&this._autoUpdate&&this._ticker.remove(this.internalUpdate,this),this._autoUpdate=t}get ticker(){return this._ticker}set ticker(t){t=t??Ei.shared,this._ticker!==t&&(this._autoUpdate&&(this._ticker.remove(this.internalUpdate,this),t.add(this.internalUpdate,this)),this._ticker=t)}get boundsProvider(){return this._boundsProvider}set boundsProvider(t){this._boundsProvider=t,t?(this._boundsSpineID=-1,this._boundsSpineDirty=!0,this.interactiveChildren=!1):(this.interactiveChildren=!0,this.hitArea=null),this.hasNeverUpdated||this.calculateBounds()}initializeMeshFactory(t){if(t){this.slotMeshFactory=t;const s=this.slotMeshFactory();s instanceof sa&&(this.darkTint=!0),s.destroy()}else for(let s=0;snew sa,this.darkTint=!0;break}}update(t){this.internalUpdate(0,t)}internalUpdate(t,s){this.hasNeverUpdated=!1;const n=s??this._ticker.deltaMS/1e3;this.state.update(n),this.state.apply(this.skeleton),this.beforeUpdateWorldTransforms(this),this.skeleton.update(n),this.skeleton.updateWorldTransform(Xn.update),this.afterUpdateWorldTransforms(this)}updateTransform(){var t;this.renderMeshes(),this.sortChildren(),(t=this.debug)==null||t.renderDebug(this),super.updateTransform()}destroy(t){var s;this.autoUpdate&&(this.autoUpdate=!1),this._ticker=null;for(const[,n]of this.meshesCache)n==null||n.destroy();this.state.clearListeners(),this.debug=void 0,this.meshesCache.clear(),this.slotsObject.clear();for(let n in this.clippingSlotToPixiMasks)(s=this.clippingSlotToPixiMasks[n].mask)==null||s.destroy(),delete this.clippingSlotToPixiMasks[n];super.destroy(t)}resetMeshes(){for(const[,t]of this.meshesCache)t.zIndex=-1,t.visible=!1}_calculateBounds(){this.hasNeverUpdated&&(this.internalUpdate(0,0),this.renderMeshes())}hasMeshForSlot(t){return this.meshesCache.has(t)}getMeshForSlot(t){if(this.hasMeshForSlot(t)){let s=this.meshesCache.get(t);return s.visible=!0,s}else{let s=this.slotMeshFactory();return this.addChild(s),this.meshesCache.set(t,s),s}}getSlotFromRef(t){let s;if(typeof t=="number"?s=this.skeleton.slots[t]:typeof t=="string"?s=this.skeleton.findSlot(t):s=t,!s)throw new Error(`No slot found with the given slot reference: ${t}`);return s}addSlotObject(t,s,n){var a;let r=this.getSlotFromRef(t);const o=(a=this.slotsObject.get(r))==null?void 0:a.container;if(!(o&&o===s)){for(const[h,{container:l}]of this.slotsObject)if(h!==r&&l===s){this.removeSlotObject(h,s);break}o&&this.removeChild(o),this.slotsObject.set(r,{container:s,followAttachmentTimeline:(n==null?void 0:n.followAttachmentTimeline)||!1,followSlotColor:(n==null?void 0:n.followSlotColor)||!1}),this.addChild(s)}}getSlotObject(t){const s=this.slotsObject.get(this.getSlotFromRef(t));return s?s.container:void 0}removeSlotObject(t,s){var o;let n=this.getSlotFromRef(t),r=(o=this.slotsObject.get(n))==null?void 0:o.container;r&&(s&&s!==r||(this.removeChild(r),this.slotsObject.delete(n)))}removeSlotObjects(){for(const[,t]of this.slotsObject)t.container.removeFromParent();this.slotsObject.clear()}updateSlotObject(t,s,n){const{container:r,followAttachmentTimeline:o}=t,a=o?!!s.attachment:!0;if(r.visible=this.skeleton.drawOrder.includes(s)&&a,r.visible){let h=s.bone;const l=r.localTransform;l.a=h.a,l.b=h.c,l.c=-h.b,l.d=-h.d,l.tx=h.worldX,l.ty=h.worldY,r.transform.setFromMatrix(l),r.zIndex=n,r.alpha=this.skeleton.color.a*s.color.a,t.followSlotColor&&this.setSlotObjectTint(r,255*this.skeleton.color.r*s.color.r<<16|255*this.skeleton.color.g*s.color.g<<8|255*this.skeleton.color.b*s.color.b)}}setSlotObjectTint(t,s){const n=t;"tint"in n&&(n.tint=s);for(const r of n.children??[])this.setSlotObjectTint(r,s)}updateAndSetPixiMask(t,s){var a,h;const n=t.attachment;if(n&&n instanceof zn){const l=(a=this.clippingSlotToPixiMasks)[h=t.data.name]||(a[h]={slot:t,vertices:new Array});l.maskComputed=!1,this.currentClippingSlot=l;return}let r=this.currentClippingSlot;const o=this.slotsObject.get(t);if(r&&o){let l=r.mask;if(l||(l=ug.obtain(),r.mask=l,this.addChild(l)),!r.maskComputed){let c=r.slot,u=c.attachment;r.maskComputed=!0;const f=u.worldVerticesLength,d=r.vertices;u.computeWorldVertices(c,0,f,d,0,2),l.clear().lineStyle(0).beginFill(0).drawPolygon(d).endFill()}o.container.mask=l}else o!=null&&o.container.mask&&(o.container.mask=null);if(r&&r.slot.attachment.endSlot==t.data&&(this.currentClippingSlot=void 0),s){for(const l in this.clippingSlotToPixiMasks){const c=this.clippingSlotToPixiMasks[l];(!(c.slot.attachment instanceof zn)||!c.maskComputed)&&c.mask&&(this.removeChild(c.mask),ug.free(c.mask),c.mask=void 0)}this.currentClippingSlot=void 0}}renderMeshes(){var r,o;this.resetMeshes();let t=null,s=null;const n=this.skeleton.drawOrder;for(let a=0,h=n.length,l=0;a>1)*m,M>this.verticesCache.length&&(this.verticesCache=Fe.newFloatArray(M)),v.computeWorldVertices(c,0,v.worldVerticesLength,this.verticesCache,0,m),t=v.triangles,s=v.uvs,_=(o=v.region)==null?void 0:o.texture}else if(g instanceof zn){St.clipper.clipStart(c,g);continue}else{this.hasMeshForSlot(c)&&(this.getMeshForSlot(c).visible=!1),St.clipper.clipEndWithSlot(c);continue}if(_!=null){const S=c.bone.skeleton.color,y=c.color,I=S.a*y.a*b.a;this.lightColor.set(S.r*y.r*b.r,S.g*y.g*b.g,S.b*y.b*b.b,I),c.darkColor!=null?this.darkColor.set(c.darkColor.r,c.darkColor.g,c.darkColor.b,1):this.darkColor.set(0,0,0,1);let E,C,R,B;if(St.clipper.isClipping())St.clipper.clipTriangles(this.verticesCache,t,t.length,s,this.lightColor,this.darkColor,d),E=St.clipper.clippedVertices,C=E.length,R=St.clipper.clippedTriangles,B=R.length;else{const F=this.verticesCache;for(let D=2,N=0,j=M;Dnew Ri);ya.yDown=!0;const ol="spineTextureAtlasLoader",kA={extension:Oe.Asset,resolver:{test:i=>Fi(i,".atlas"),parse:i=>{var t,s;const e=i.split(".");return{resolution:parseFloat(((s=(t=Ve.RETINA_PREFIX)==null?void 0:t.exec(i))==null?void 0:s[1])??"1"),format:e[e.length-2],src:i}}},loader:{name:ol,extension:{type:Oe.LoadParser,priority:Yi.Normal,name:ol},test(i){return Fi(i,".atlas")},async load(i){const e=await Ve.ADAPTER.fetch(i);if(!e.ok)throw new Error(`[${ol}] Failed to fetch ${i}: ${e.status} ${e.statusText}`);return await e.text()},testParse(i,e){const t=Fi(e.src,".atlas"),s=typeof i=="string",n=e.loadParser===ol;return Promise.resolve((t||n)&&s)},unload(i){i.dispose()},async parse(i,e,t){var h;const s=e.data||{};let n=zt.dirname(e.src);n&&n.lastIndexOf("/")!==n.length-1&&(n+="/");const r=new Ky(i);if(s.images instanceof st||typeof s.images=="string"){const l=s.images;s.images={},s.images[r.pages[0].name]=l}const o=[];let a=!0;for(const l of t.parsers)if(l.name=="loadTextures"){a=(h=l.config)==null?void 0:h.preferCreateImageBitmap;break}Xs.setPreferences({preferCreateImageBitmap:!1});for(const l of r.pages){const c=l.name,u=s!=null&&s.images?s.images[c]:void 0;if(u instanceof st)l.setTexture(Ar.from(u));else{const f=u??zt.normalize([...n.split(zt.sep),c].join(zt.sep)),d={src:Vl(f,e.src),data:{...s.imageMetadata,alphaMode:l.pma?ui.PMA:ui.UNPACK}},m=t.load(d).then(g=>{l.setTexture(Ar.from(g.baseTexture))});o.push(m)}}return await Promise.all(o),Xs.setPreferences({preferCreateImageBitmap:a}),r}}};He.add(kA);const al="spineSkeletonLoader";function FA(i){return i.hasOwnProperty("bones")}function OA(i){return i instanceof Uint8Array}const BA={extension:Oe.Asset,loader:{name:al,extension:{type:Oe.LoadParser,priority:Yi.Normal,name:al},test(i){return Fi(i,".skel")},async load(i){const e=await Ve.ADAPTER.fetch(i);if(!e.ok)throw new Error(`[${al}] Failed to fetch ${i}: ${e.status} ${e.statusText}`);return new Uint8Array(await e.arrayBuffer())},testParse(i,e){const t=Fi(e.src,".json")&&FA(i),s=Fi(e.src,".skel")&&OA(i),n=e.loadParser===al;return Promise.resolve(t||s||n)}}};He.add(BA);class LA extends Hs{constructor(t=!1){super();A(this,"_buffer");A(this,"_indexBuffer");this._buffer=new Nt(void 0,t,!1),this._indexBuffer=new Nt(void 0,t,!0),this.addAttribute("aVertexPosition",this._buffer,2,!1,je.FLOAT).addAttribute("aTextureCoord",this._buffer,2,!1,je.FLOAT).addAttribute("aColor",this._buffer,4,!0,je.UNSIGNED_BYTE).addAttribute("aDarkColor",this._buffer,4,!0,je.UNSIGNED_BYTE).addAttribute("aTextureId",this._buffer,1,!0,je.FLOAT).addIndex(this._indexBuffer)}}const DA=` precision highp float; attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; attribute vec4 aColor; attribute vec4 aDarkColor; attribute float aTextureId; uniform mat3 projectionMatrix; uniform mat3 translationMatrix; uniform vec4 tint; varying vec2 vTextureCoord; varying vec4 vColor; varying vec4 vDarkColor; varying float vTextureId; void main(void){ gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = aTextureCoord; vTextureId = aTextureId; vColor = aColor * tint; vDarkColor = aDarkColor * tint; } `,NA=` varying vec2 vTextureCoord; varying vec4 vColor; varying vec4 vDarkColor; varying float vTextureId; uniform sampler2D uSamplers[%count%]; void main(void){ vec4 color; %forloop% gl_FragColor.a = color.a * vColor.a; gl_FragColor.rgb = ((color.a - 1.0) * vDarkColor.a + 1.0 - color.rgb) * vDarkColor.rgb + color.rgb * vColor.rgb; } `;class ox extends Bn{constructor(e){super(e),this.shaderGenerator=new hv(DA,NA),this.geometryClass=LA,this.vertexSize=7}packInterleavedGeometry(e,t,s,n,r){const{uint32View:o,float32View:a}=t,h=n/this.vertexSize,l=e.uvs,c=e.indices,u=e.vertexData,f=e._texture.baseTexture._batchLocation,d=Math.min(e.worldAlpha,1),m=At.shared.setValue(e._tintRGB).toPremultiplied(d,!0),g=At.shared.setValue(e._darkTintRGB).premultiply(d,!0).toPremultiplied(1,!1);for(let b=0;ba.id===r)||(this.container.removeChild(o.root),o.root.destroy({children:!0}),this.entries.delete(r));for(const r of e){const o=EE(r.id);let a=this.entries.get(r.id);if(a&&a.assetVersion!==r.assetVersion&&!o&&(this.container.removeChild(a.root),a.root.destroy({children:!0}),this.entries.delete(r.id),a=void 0),(!a||a.assetVersion!==r.assetVersion)&&o){a&&(this.container.removeChild(a.root),a.root.destroy({children:!0}));const f=new gi,d=new Rd({skeletonData:o.skeletonData,autoUpdate:!1,darkTint:!1});o.skeletonData.defaultSkin&&d.skeleton.setSkin(o.skeletonData.defaultSkin),d.skeleton.setSlotsToSetupPose(),f.addChild(d),this.container.addChild(f),a={root:f,spine:d,assetVersion:r.assetVersion,animation:""},this.entries.set(r.id,a)}if(!a)continue;const h=a.root,l=a.spine,c=r.visible!==!1&&r.enabled;h.visible=c,h.renderable=c,h.position.set(r.x,-r.y),h.rotation=-r.rotation*Math.PI/180,h.scale.set(r.scaleX,r.scaleY),a.animation!==r.selectedAnimation&&(a.animation=r.selectedAnimation,l.skeleton.setToSetupPose(),l.state.clearTracks(),a.animation&&l.state.setAnimation(0,a.animation,!1));const u=l.state.getCurrent(0);if(u){const f=((n=r.animations.find(m=>m.name===r.selectedAnimation))==null?void 0:n.duration)||0,d=Math.max(0,t/Math.max(1,s)-r.timeOffset);u.trackTime=f>0?Math.min(d,f):d}l.update(0)}}getBoneWorldTransform(e,t){const s=this.entries.get(e),n=s==null?void 0:s.spine.skeleton.findBone(t);if(!s||!n||!n.active)return null;const r=s.root,o=Math.cos(r.rotation),a=Math.sin(r.rotation),h=o*r.scale.x,l=-a*r.scale.y,c=a*r.scale.x,u=o*r.scale.y,f=h*n.a+l*n.c,d=h*n.b+l*n.d,m=c*n.a+u*n.c,g=c*n.b+u*n.d,b=r.position.x+h*n.worldX+l*n.worldY,_=r.position.y+c*n.worldX+u*n.worldY;return{x:b,y:-_,rotation:-Math.atan2(m,f)*180/Math.PI,scaleX:Math.max(1e-4,Math.hypot(f,m)),scaleY:Math.max(1e-4,Math.hypot(d,g))}}destroy(){for(const e of this.entries.values())e.root.removeFromParent(),e.root.destroy({children:!0});this.entries.clear(),this.container.removeFromParent(),this.container.destroy({children:!0})}}function Yn(i,e,t){const s=Number(i[e]);return Number.isFinite(s)?s:t}function ki(i,e,t,s){i[e]==null&&(i[e]=Yn(i,t,s))}function pf(i,e,t){if(typeof i.curve!="number")return;const s=Yn(i,"time",0),r=Yn(e,"time",0)-s,o=i.curve,a=Yn(i,"c2",0),h=Yn(i,"c3",1),l=Yn(i,"c4",1);i.curve=t.flatMap(([c,u])=>[s+r*o,c+(u-c)*a,s+r*h,c+(u-c)*l]),delete i.c2,delete i.c3,delete i.c4}function Wn(i,e){if(Array.isArray(i))for(let t=0;t[Yn(s,r,o),Yn(n,r,o)]))}}function VA(i){if(Array.isArray(i))for(let e=0;eNumber.parseInt(s.slice(r,r+2),16)/255);return e?n:n.slice(0,3)}function dg(i,e){if(Array.isArray(i))for(let t=0;t[a,o[h]]))}}function XA(i){for(const e of i.bones||[])e.inherit==null&&e.transform!=null&&(e.inherit=e.transform);for(const e of i.transform||[])ki(e,"mixRotate","rotateMix",1),ki(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX),ki(e,"mixScaleX","scaleMix",1),e.mixScaleY==null&&(e.mixScaleY=e.mixScaleX),ki(e,"mixShearY","shearMix",1);for(const e of i.path||[])ki(e,"mixRotate","rotateMix",1),ki(e,"mixX","translateMix",1),e.mixY==null&&(e.mixY=e.mixX)}function YA(i){for(const e of i.skins||[])for(const t of Object.values(e.attachments||{}))for(const s of Object.values(t||{}))s.parent!=null&&s.timelines==null&&s.deform!=null&&(s.timelines=s.deform)}function $A(i){for(const e of Object.values(i.slots||{}))e.color&&!e.rgba&&(e.rgba=e.color,delete e.color),e.twoColor&&!e.rgba2&&(e.rgba2=e.twoColor,delete e.twoColor),dg(e.rgba,!1),dg(e.rgba2,!0)}function GA(i){for(const e of Object.values(i.bones||{})){for(const t of e.rotate||[])ki(t,"value","angle",0);Wn(e.rotate,[{key:"value",fallback:0}]),Wn(e.translate,[{key:"x",fallback:0},{key:"y",fallback:0}]),Wn(e.scale,[{key:"x",fallback:1},{key:"y",fallback:1}]),Wn(e.shear,[{key:"x",fallback:0},{key:"y",fallback:0}])}}function jA(i){for(const e of Object.values(i.ik||{}))Wn(e,[{key:"mix",fallback:1},{key:"softness",fallback:0}])}function HA(i){for(const e of Object.values(i.transform||{})){for(const t of e)ki(t,"mixRotate","rotateMix",1),ki(t,"mixX","translateMix",1),t.mixY==null&&(t.mixY=t.mixX),ki(t,"mixScaleX","scaleMix",1),t.mixScaleY==null&&(t.mixScaleY=t.mixScaleX),ki(t,"mixShearY","shearMix",1);Wn(e,[{key:"mixRotate",fallback:1},{key:"mixX",fallback:1},{key:"mixY",fallback:1},{key:"mixScaleX",fallback:1},{key:"mixScaleY",fallback:1},{key:"mixShearY",fallback:1}])}}function WA(i){for(const e of Object.values(i.path||{})){for(const s of["position","spacing"]){const n=e[s];for(const r of n||[])ki(r,"value",s,0);Wn(n,[{key:"value",fallback:0}])}const t=e.mix;for(const s of t||[])ki(s,"mixRotate","rotateMix",1),ki(s,"mixX","translateMix",1),s.mixY==null&&(s.mixY=s.mixX);Wn(t,[{key:"mixRotate",fallback:1},{key:"mixX",fallback:1},{key:"mixY",fallback:1}])}}function zA(i){if(!i.deform)return;const e=i.attachments||(i.attachments={});for(const[t,s]of Object.entries(i.deform)){const n=e[t]||(e[t]={});for(const[r,o]of Object.entries(s)){const a=n[r]||(n[r]={});for(const[h,l]of Object.entries(o)){const c=a[h]||(a[h]={});c.deform=l,VA(l)}}}delete i.deform}function ax(i){XA(i),YA(i);for(const e of Object.values(i.animations||{}))$A(e),GA(e),jA(e),HA(e),WA(e),zA(e),!e.drawOrder&&e.draworder&&(e.drawOrder=e.draworder);return i}function fg(i){return i.replace(/\\/g,"/").split("/").pop()||i}async function qA(i){const e=URL.createObjectURL(i);return await et.fromURL(e)}function KA(i){const e=new Map;return i.bones.map(t=>{var r;const s=((r=t.parent)==null?void 0:r.name)||null,n=s?(e.get(s)||0)+1:0;return e.set(t.name,n),{name:t.name,parent:s,depth:n}})}async function lx(i,e,t){var o;if(!/\.(json|skel)$/i.test(i.name))throw new Error("Spine 数据仅支持 .json 或 .skel");if(!/\.atlas$/i.test(e.name))throw new Error("图集文件仅支持 .atlas");if(!t.length)throw new Error("请至少选择一张纹理图片");const s=new Ky(await e.text()),n=new Map(t.map(a=>[fg(a.name).toLowerCase(),a])),r=[];try{for(const c of s.pages){const u=n.get(fg(c.name).toLowerCase());if(!u)throw new Error(`Atlas 引用的纹理未选择:${c.name}`);const f=await qA(u);f.baseTexture.alphaMode=c.pma?ui.PMA:ui.UNPACK,r.push(f),c.setTexture(Ar.from(f.baseTexture))}const a=new Md(s);let h,l=null;if(/\.skel$/i.test(i.name))h=new Cd(a).readSkeletonData(await i.arrayBuffer()),l=Wl(h.version);else{let c;try{c=JSON.parse(await i.text())}catch{throw new Error("Spine JSON 文件格式无效")}if(l=Wl((o=c==null?void 0:c.skeleton)==null?void 0:o.spine),!l)throw new Error(`Spine JSON 版本不受支持,仅支持 ${Sd()}`);l==="3.8"&&ax(c),h=new ih(a).readSkeletonData(c)}if(!l)throw new Error(`Spine 数据版本不受支持,仅支持 ${Sd()}`);return{skeletonData:h,textures:r,dataVersion:l,animations:h.animations.map(c=>({name:c.name,duration:c.duration})),bones:KA(h)}}catch(a){for(const h of r)h.destroy(!0);throw a}}function wl(i){return new Promise((e,t)=>{const s=new FileReader;s.onload=()=>e(String(s.result||"")),s.onerror=()=>t(s.error),s.readAsDataURL(i)})}async function ZA(i,e,t){return{skeleton:{name:i.name,dataUrl:await wl(i)},atlas:{name:e.name,dataUrl:await wl(e)},textures:await Promise.all(t.map(async s=>({name:s.name,dataUrl:await wl(s)})))}}async function Au(i){const e=await fetch(i.dataUrl);if(!e.ok)throw new Error(`无法读取内嵌 Spine 文件:${i.name}`);return new File([await e.blob()],i.name)}async function JA(i){return{skeleton:await Au(i.skeleton),atlas:await Au(i.atlas),textures:await Promise.all(i.textures.map(Au))}}const hx="SpineParticle.EditorConfig",cx=1;function ux(i){return{backgroundX:i.backgroundX,backgroundY:i.backgroundY,backgroundOpacity:i.backgroundOpacity,backgroundImageName:i.backgroundImageName,backgroundImageData:i.backgroundImageData,showGrid:i.showGrid,exportSettings:Ut(i.exportSettings)}}function QA(i){return JSON.parse(JSON.stringify(i,(e,t)=>{if(!(e==="texture"||e==="trailTexture"||e==="frames"))return t}))}function eC(i){const e=ux(i.settings);return QA({format:hx,version:cx,savedAt:new Date().toISOString(),editor:Ut(i.editor),settings:e,timeline:{fps:i.timeline.fps,loop:i.timeline.loop,animations:[...i.timeline.animations]},selection:{type:i.activeObjectType,id:i.activeObjectId},scene:{systems:i.systems.map(t=>({...Ut(t),frames:void 0})),colliders:Ut(i.colliders),paths:Ut(i.paths),spines:Ut(i.spines)}})}function tC(){return`SpineParticle-${new Date().toISOString().replace(/[-:]/g,"").replace(/\.\d{3}Z$/,"").replace("T","-")}.json`}function dx(i){const e=eC(i),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json;charset=utf-8"}),s=URL.createObjectURL(t),n=document.createElement("a");return n.href=s,n.download=tC(),document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(s),0),e}function fx(i){let e;try{e=JSON.parse(i)}catch{throw new Error("配置文件不是有效的 JSON")}const t=e;if(t.format!==hx)throw new Error("不是 SpineParticle 编辑器配置文件");if(t.version!==cx)throw new Error(`暂不支持配置版本:${t.version??"未知"}`);if(!t.scene||!Array.isArray(t.scene.systems)||!Array.isArray(t.scene.colliders)||!Array.isArray(t.scene.paths)||!Array.isArray(t.scene.spines))throw new Error("配置文件缺少完整场景数据");return t}async function iC(i){const e=new Map,t=n=>{const r=n==="/particles/star.png"?"/images/star.png":n==="/trails/trail.png"?"/images/trail.png":n||"/images/star.png";let o=e.get(r);return o||(o=et.fromURL(r).then(a=>$n(a)),e.set(r,o)),o},s=await t("/images/star.png");await Promise.all(i.map(async n=>{var o;const r=Tr(n.config);r.texture=s,await Promise.all(r.imageResources.map(async a=>{a.texture=await t(a.previewUrl||"/images/star.png"),await Promise.all(a.sequenceFrames.map(async h=>{h.texture=await t(h.previewUrl||a.previewUrl||"/images/star.png")}))})),await Promise.all(r.trailResources.map(async a=>{a.texture=await t(a.previewUrl||"/images/trail.png")})),r.trailTexture=((o=r.trailResources[0])==null?void 0:o.texture)||null,n.frames=[]}))}async function sC(i){const e=new Map;try{for(const t of i){if(!t.sourceBundle)continue;const s=await JA(t.sourceBundle);e.set(t.id,await lx(s.skeleton,s.atlas,s.textures))}return e}catch(t){for(const s of e.values())for(const n of s.textures)n.destroy(!0);throw t}}function nC(i,e){const t=(e==null?void 0:e.type)||"particle",s=Number(e==null?void 0:e.id)||0;(t==="particle"?i.systems.some(r=>r.id===s):t==="collision"?i.colliders.some(r=>r.id===s):t==="path"?i.paths.some(r=>r.id===s):i.spines.some(r=>r.id===s))?i.selectSceneObject(t,s):i.systems[0]?i.selectSceneObject("particle",i.systems[0].id):i.colliders[0]?i.selectSceneObject("collision",i.colliders[0].id):i.paths[0]?i.selectSceneObject("path",i.paths[0].id):i.spines[0]?i.selectSceneObject("spine",i.spines[0].id):(i.activeObjectType="particle",i.activeObjectId=0,i.activeId=0)}async function rC(i,e){var c,u,f,d,m;const t=fx(JSON.stringify(e)),s=Ut(t.scene.systems),n=Ut(t.scene.colliders),r=Ut(t.scene.paths),o=Ut(t.scene.spines);for(const g of o)g.sourceBundle==null&&(g.sourceBundle=null),g.dataVersion==null&&(g.dataVersion="");await iC(s);const a=await sC(o),h=new Map(i.spines.map(g=>[g.id,g.assetVersion]));for(const g of i.spines)Ea(g.id);i.systems=s,i.colliders=n,i.paths=r,i.spines=o,Object.assign(i.editor,Ut(t.editor||{}));const l=t.settings;if(l)for(const g of["backgroundX","backgroundY","backgroundOpacity","backgroundImageName","backgroundImageData","showGrid"])Object.prototype.hasOwnProperty.call(l,g)&&(i.settings[g]=l[g]);i.settings.exportSettings=gy((c=t.settings)==null?void 0:c.exportSettings),i.settings.undoLimit=Math.min(200,Math.max(1,Math.round(Number(i.settings.undoLimit)||20))),i.timeline.fps=Math.max(1,Math.round(Number((u=t.timeline)==null?void 0:u.fps)||30)),i.timeline.loop=((f=t.timeline)==null?void 0:f.loop)!==!1,i.timeline.animations=Array.isArray((d=t.timeline)==null?void 0:d.animations)&&t.timeline.animations.length?[...new Set(t.timeline.animations.filter(g=>typeof g=="string"&&g.trim()).map(g=>g.trim()))]:["animation"];for(const g of i.spines){const b=a.get(g.id);if(g.assetVersion=Math.max(Number(g.assetVersion)||0,h.get(g.id)||0)+1,!b){g.status="empty",g.error=g.skeletonFileName?"配置未包含可复用的 Spine 原始资源":"",g.animations=[],g.bones=[],g.selectedAnimation="";continue}Lh(g.id,b),g.dataVersion=b.dataVersion,g.animations=b.animations,g.bones=b.bones,b.animations.some(_=>_.name===g.selectedAnimation)||(g.selectedAnimation=((m=b.animations[0])==null?void 0:m.name)||""),g.status="ready",g.error=""}i.syncSceneSequences(),nC(i,t.selection),i.timeline.frame=0,i.timeline.recorded=!1,i.timeline.playing=!0;for(const g of i.systems)i.timeline.animations.includes(g.animation)||(g.animation=i.timeline.animations[0]);return i.recalcTotalFrames(),t}async function px(i,e){return rC(i,fx(e))}async function oC(i,e){if(!/\.json$/i.test(e.name))throw new Error("请选择 .json 配置文件");return px(i,await e.text())}const Vh=wo({undoCount:0});let sh=null,pn=null,qn=[],Do=null,mn=null,nh=!1;function mf(i){return{systems:i.systems.map(t=>{const s=Ut(t);return s.frames=void 0,s}),colliders:Ut(i.colliders),paths:Ut(i.paths),spines:Ut(i.spines),animations:[...i.timeline.animations],settings:ux(i.settings)}}function gf(i){return JSON.stringify(i,(e,t)=>e==="texture"||e==="trailTexture"?null:typeof t=="string"&&t.startsWith("data:")&&t.length>256?`${t.length}:${t.slice(0,96)}:${t.slice(-48)}`:t)}function mx(i,e=mf(i),t=gf(e)){const s=new Map;for(const n of e.spines){const r=AE(n.id);r&&s.set(n.id,r)}return{data:e,signature:t,spineAssets:s}}function rh(i){if(i){for(const e of i.spineAssets.values())ME(e);i.spineAssets.clear()}}function gx(i){for(;qn.length>i;)rh(qn.shift()||null);Vh.undoCount=qn.length}function vx(){const i=sh;if(!i||!pn||nh)return;const e=mf(i),t=gf(e);t!==pn.signature&&(qn.push(pn),pn=mx(i,e,t),gx(i.settings.undoLimit))}function aC(){nh||(mn&&clearTimeout(mn),mn=setTimeout(()=>{mn=null,vx()},250))}function lC(i){const e=i.activeObjectId;return i.activeObjectType==="particle"?i.systems.some(t=>t.id===e):i.activeObjectType==="collision"?i.colliders.some(t=>t.id===e):i.activeObjectType==="path"?i.paths.some(t=>t.id===e):i.spines.some(t=>t.id===e)}function hC(i){var t,s;if(!lC(i)){const n=i.systems[0],r=i.colliders[0],o=i.paths[0],a=i.spines[0];n?(i.activeObjectType="particle",i.activeObjectId=n.id):r?(i.activeObjectType="collision",i.activeObjectId=r.id):o?(i.activeObjectType="path",i.activeObjectId=o.id):(i.activeObjectType="spine",i.activeObjectId=(a==null?void 0:a.id)||0)}const e=i.activeObjectType==="particle"?i.systems.find(n=>n.id===i.activeObjectId):i.systems.find(n=>n.id===i.activeId);i.activeId=(e==null?void 0:e.id)||((t=i.systems[0])==null?void 0:t.id)||0,i.timeline.animation=(e==null?void 0:e.animation)||((s=i.systems[0])==null?void 0:s.animation)||i.timeline.animations[0]||"animation"}function cC(i,e){const t=pn;nh=!0;try{for(const s of i.spines)Ea(s.id);i.systems=Ut(e.data.systems),i.colliders=Ut(e.data.colliders),i.paths=Ut(e.data.paths),i.spines=Ut(e.data.spines),i.timeline.animations=[...e.data.animations],Object.assign(i.settings,Ut(e.data.settings));for(const[s,n]of e.spineAssets)Lh(s,n);for(const s of i.systems)s.frames=[];i.timeline.recorded=!1,i.timeline.playing=!1,hC(i),i.recalcTotalFrames(),pn=e}finally{nh=!1,rh(t)}}function uC(i){if(!(sh===i&&Do)){Do==null||Do(),mn&&clearTimeout(mn),rh(pn);for(const e of qn)rh(e);qn=[],sh=i,pn=mx(i),Vh.undoCount=0,Do=cs(()=>gf(mf(i)),aC,{flush:"post"})}}function dC(i,e){const t=Math.min(200,Math.max(1,Math.round(Number(e)||20)));i.settings.undoLimit=t,gx(t)}function Cu(){const i=sh;if(!i||!pn)return!1;mn&&(clearTimeout(mn),mn=null),vx();const e=qn.pop();return e?(cC(i,e),Vh.undoCount=qn.length,!0):!1}function fC(i){const e=i instanceof HTMLElement?i:null;return!!(e!=null&&e.closest('input, textarea, select, [contenteditable="true"]'))}function pC(i){function e(s){var r;const n=s.target instanceof Node?s.target:null;i.canvasFocused.value=!!n&&!!((r=i.canvasElement.value)!=null&&r.contains(n))}function t(s){const n=s.key.toLowerCase();if((s.ctrlKey||s.metaKey)&&!s.altKey&&n==="s"){s.preventDefault(),s.stopPropagation(),i.save();return}if((s.ctrlKey||s.metaKey)&&!s.altKey&&n==="z"){s.preventDefault(),s.stopPropagation(),i.undo();return}if(s.ctrlKey||s.metaKey||s.altKey||fC(s.target))return;if(n==="d"){s.preventDefault(),i.togglePlay();return}if(n==="s"){s.preventDefault(),i.toStart();return}if(!i.canvasFocused.value)return;const r={q:"",w:"translate",e:"rotate",r:"scale"};n in r&&(s.preventDefault(),i.setTool(r[n]))}_o(()=>{document.addEventListener("pointerdown",e,!0),window.addEventListener("keydown",t,!0)}),wa(()=>{document.removeEventListener("pointerdown",e,!0),window.removeEventListener("keydown",t,!0)})}const mC={class:"stage-wrap"},gC={class:"topbar"},vC=["disabled"],yC={class:"tool-group"},xC={class:"tool-group"},bC={key:0,class:"background-panel"},wC=["disabled"],_C=["title"],SC={class:"background-position-row"},TC={class:"background-opacity-row"},MC={class:"zoom-pct"},EC={key:0,class:"settings-panel"},AC={class:"sp-head"},CC={class:"sp-switch-row"},IC={class:"sp-switch-control"},RC={class:"sp-row"},PC={class:"sp-chk"},kC={class:"sp-chk"},FC={class:"sp-row"},OC={class:"sp-row"},BC={class:"sp-chk"},LC={class:"sp-chk"},DC={class:"sp-row"},NC={class:"sp-row"},UC={class:"sp-row"},VC={class:"sp-hex"},XC={class:"sp-chk"},YC={class:"help-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"help-title"},$C={class:"help-head"},GC={key:2,class:"hud"},jC={class:"hud-number hud-system-count"},HC={class:"hud-number hud-particle-count"},WC=Ws({__name:"Stage",setup(i){const e=Aa(),t=it(null),s=it(null),n=it(!1),r=it(!1),o=it(!1),a=it(null),h=ut(()=>e.settings.backgroundImageName),l=it(""),c=it(!1);function u(G){l.value=l.value===G?"":G}e.settings.undoLimit>0||(e.settings.undoLimit=20),e.settings.parameterPanelOnRight==null&&(e.settings.parameterPanelOnRight=!0),Number.isFinite(e.settings.backgroundX)||(e.settings.backgroundX=0),Number.isFinite(e.settings.backgroundY)||(e.settings.backgroundY=0),Number.isFinite(e.settings.backgroundOpacity)||(e.settings.backgroundOpacity=1),e.settings.backgroundImageName==null&&(e.settings.backgroundImageName=""),e.settings.backgroundImageData==null&&(e.settings.backgroundImageData=""),e.settings.showEmitter==null&&(e.settings.showEmitter=!0),e.settings.showBones==null&&(e.settings.showBones=!1),e.settings.bonePointDrawSize>0||(e.settings.bonePointDrawSize=1),e.settings.boneAxisDrawSize>0||(e.settings.boneAxisDrawSize=2),e.settings.showSkinMesh==null&&(e.settings.showSkinMesh=!1),e.settings.showGrid==null&&(e.settings.showGrid=!0);function f(){e.settings.bonePointDrawSize=Math.min(10,Math.max(.1,Number(e.settings.bonePointDrawSize)||1)),e.settings.boneAxisDrawSize=Math.min(10,Math.max(.1,Number(e.settings.boneAxisDrawSize)||2))}pC({canvasElement:t,canvasFocused:c,undo:Cu,save:()=>dx(e),togglePlay:()=>e.togglePlay(),toStart:()=>e.toStart(),setTool:G=>{l.value=G}});let d=null,m=null,g=null,b=null,_=0,M=null,v=null,S=null,y=null,I=null,E=null,C=null,R=null,B=null,k=null,F=null,D=null,N=[],j=0,O=0,L=0,P=0,X=null,U=null;const Y=new Map,q=new Map;let z=[];const ne=new Map,H=new Set;let Z=!1;cs(()=>[e.activeObjectType,e.activeObjectId],()=>H.clear());async function ae(){if(X&&U)return X;const[G,T]=await Promise.all([et.fromURL("/images/star.png"),et.fromURL("/images/trail.png")]);return X=G,U=T,X}function me(){m=new gi,d.stage.addChild(m),F=new gi,d.stage.addChild(F),g=new Qn(et.EMPTY),g.anchor.set(.5),g.visible=!1,m.addChild(g),k=new Ri,m.addChild(k),D=new UA,m.addChild(D.container),v=new Ri,m.addChild(v),M=new Ri,m.addChild(M),y=new Ri,m.addChild(y),I=new Ri,m.addChild(I),E=new Ri,m.addChild(E),C=new Ri,m.addChild(C),R=new Ri,m.addChild(R),B=new Ri,m.addChild(B),S=new Ri,m.addChild(S)}function _e(){r.value=!r.value,r.value&&(n.value=!1)}function te(){o.value=!0,n.value=!1,r.value=!1}function ve(G){G.key==="Escape"&&o.value&&(o.value=!1)}function $(){n.value=!n.value,n.value&&(r.value=!1)}function W(G){dC(e,Number(G.target.value))}async function J(G){var x;const T=G.target,p=(x=T.files)==null?void 0:x[0];if(p)try{e.settings.backgroundImageData=await wl(p),e.settings.backgroundImageName=p.name}catch(V){console.error("背景图加载失败",V)}finally{T.value=""}}async function Q(G){const T=++_;if(!G){g&&(g.texture=et.EMPTY,g.visible=!1),b&&b.destroy(!0),b=null;return}try{const p=await et.fromURL(G);if(T!==_||!g){p.destroy(!0);return}const x=b;b=p,g.texture=p,g.visible=!0,x&&x.destroy(!0)}catch(p){console.error("背景图恢复失败",p)}}function ie(G=!0){e.settings.backgroundImageData="",e.settings.backgroundImageName="",a.value&&(a.value.value=""),G&&(e.settings.backgroundX=0,e.settings.backgroundY=0,e.settings.backgroundOpacity=1)}function ue(G,T=0){if(G<=0)return 1;const p=Math.pow(10,Math.floor(Math.log10(G))),x=[1,2,5,10,20,50,100];let V=1;for(const K of x)if(K*p>=G){V=K*p;break}return Math.max(V,T)}function Se(){if(!k)return;const G=k;G.clear();const T=e.settings;if(!T.tickEnabled){for(const ge of N)ge.visible=!1;return}const p=0,x=0,V=d.screen.width/e.editor.viewScale,K=d.screen.height/e.editor.viewScale,oe=+("0x"+T.axisColor.replace("#",""));G.lineStyle(1.5,oe,.35),G.moveTo(-V,x),G.lineTo(V,x),G.moveTo(p,-K),G.lineTo(p,K);const pe=e.editor.viewScale,he=ue(50/pe),be=V,fe=K,Te=Math.max(1,T.tickWidth);if(T.tickEnabled){for(let ge=0;ge<=V;ge+=he){const rt=Math.round(ge/he)*he;rt!==0&&(G.lineStyle(Te,oe,.25),G.moveTo(rt,x-4),G.lineTo(rt,x+4))}for(let ge=0;ge<=K;ge+=he)Math.round(ge/he)*he!==0&&(G.lineStyle(Te,oe,.25),G.moveTo(p-4,ge),G.lineTo(p+4,ge))}const Ce=d.screen.width/2+e.editor.viewX,Le=d.screen.height*.5+e.editor.viewY,Ue=T.axisFontSize,Ae=+("0x"+T.axisColor.replace("#",""));for(;N.length<64;){const ge=new cf("",{fontFamily:"monospace",fontSize:Ue,fill:Ae});ge.anchor.set(.5,.5),F.addChild(ge),N.push(ge)}let ye=0;const We=T.showAxisLabels&&T.tickEnabled;for(let ge=0;ge<=V;ge+=he){const rt=Math.round(ge/he)*he;if(rt===0||!We||rt>be)continue;const mt=N[ye++];if(!mt)break;mt.style.fontSize=Ue,mt.text=String(rt),mt.position.set(Ce+rt*pe,Le+9),mt.visible=!0;const _t=N[ye++];if(!_t)break;_t.style.fontSize=Ue,_t.text=String(-rt),_t.position.set(Ce-rt*pe,Le+9),_t.visible=!0}for(let ge=0;ge<=K;ge+=he){const rt=Math.round(ge/he)*he;if(rt===0||!We||rt>fe)continue;const mt=N[ye++];if(!mt)break;mt.style.fontSize=Ue,mt.text=String(rt),mt.position.set(Ce+8,Le-ge*pe),mt.visible=!0;const _t=N[ye++];if(!_t)break;_t.style.fontSize=Ue,_t.text=String(-rt),_t.position.set(Ce+8,Le+ge*pe),_t.visible=!0}for(;ye{e.editor.viewX=x+(pe.clientX-T),e.editor.viewY=V+(pe.clientY-p)},oe=()=>{window.removeEventListener("pointermove",K),window.removeEventListener("pointerup",oe),window.removeEventListener("pointercancel",oe)};window.addEventListener("pointermove",K),window.addEventListener("pointerup",oe),window.addEventListener("pointercancel",oe)}function de(G,T){const p=t.value.getBoundingClientRect(),x=Math.max(1e-4,e.editor.viewScale),V=G-p.left,K=T-p.top;return{x:(V-d.screen.width/2-e.editor.viewX)/x,y:-(K-d.screen.height*.5-e.editor.viewY)/x}}function De(G,T,p){const x=G.rotation*Math.PI/180,V=Math.cos(x),K=Math.sin(x),oe=Math.max(1e-4,Math.abs(G.scaleX??1)),pe=Math.max(1e-4,Math.abs(G.scaleY??1));return{x:G.x+V*T*oe-K*p*pe,y:G.y+K*T*oe+V*p*pe}}function Ie(G,T,p){const x=G.rotation*Math.PI/180,V=Math.cos(x),K=Math.sin(x),oe=Math.max(1e-4,Math.abs(G.scaleX??1)),pe=Math.max(1e-4,Math.abs(G.scaleY??1)),he=T-G.x,be=p-G.y;return{x:(V*he+K*be)/oe,y:(-K*he+V*be)/pe}}function Be(){if(e.activeObjectType!=="path")return null;const G=e.paths.find(T=>T.id===e.activeObjectId)||null;return(G==null?void 0:G.visible)===!1?null:G}function Ke(G,T,p){if(G.points.length<2)return G.points.length;const x=G.closed?G.points.length:G.points.length-1;let V=G.points.length,K=1/0;for(let oe=0;oeMath.hypot(pe.x-x.x,pe.y-x.y)<=V);if(K>=0){T.points.splice(K,1),H.clear();return}const oe=Ke(T,x.x,x.y);T.points.splice(oe,0,{x:x.x,y:x.y,inX:0,inY:0,outX:0,outY:0}),H.clear(),H.add(oe)}function wt(G){const T=Be();if(!T||!T.enabled)return!1;const p=de(G.clientX,G.clientY),x=Ie(T,p.x,p.y),V=9/Math.max(.01,e.editor.viewScale);if(G.detail>=2){if(T.points.findIndex(fe=>Math.hypot(fe.x-x.x,fe.y-x.y)<=V)>=0)return!0;const he={x:x.x,y:x.y,inX:0,inY:0,outX:0,outY:0},be=Ke(T,x.x,x.y);return T.points.splice(be,0,he),H.clear(),H.add(be),Z=!0,dt(fe=>{const Te=de(fe.clientX,fe.clientY),Ce=Ie(T,Te.x,Te.y);he.outX=Ce.x-he.x,he.outY=Ce.y-he.y,he.inX=-he.outX,he.inY=-he.outY}),!0}let K=null;for(const pe of H){const he=T.points[pe];he&&(Math.hypot(he.x+he.inX-x.x,he.y+he.inY-x.y)<=V&&(K={index:pe,side:"in"}),Math.hypot(he.x+he.outX-x.x,he.y+he.outY-x.y)<=V&&(K={index:pe,side:"out"}))}if(K){const pe=T.points[K.index],he=K.side==="in"?Math.hypot(pe.outX,pe.outY):Math.hypot(pe.inX,pe.inY);return dt(fe=>{const Te=de(fe.clientX,fe.clientY),Ce=Ie(T,Te.x,Te.y),Le=Ce.x-pe.x,Ue=Ce.y-pe.y;if(K.side==="in"?(pe.inX=Le,pe.inY=Ue):(pe.outX=Le,pe.outY=Ue),!fe.altKey){const Ae=Math.max(1e-4,Math.hypot(Le,Ue)),ye=fe.shiftKey?Ae:he;K.side==="in"?(pe.outX=-Le/Ae*ye,pe.outY=-Ue/Ae*ye):(pe.inX=-Le/Ae*ye,pe.inY=-Ue/Ae*ye)}}),!0}const oe=T.points.findIndex(pe=>Math.hypot(pe.x-x.x,pe.y-x.y)<=V);if(oe>=0){if(G.altKey)return H.delete(oe),!0;G.ctrlKey||G.metaKey?H.add(oe):H.has(oe)||(H.clear(),H.add(oe));const pe=x,he=[...H].map(fe=>({index:fe,x:T.points[fe].x,y:T.points[fe].y}));return dt(fe=>{const Te=de(fe.clientX,fe.clientY),Ce=Ie(T,Te.x,Te.y);for(const Le of he)T.points[Le.index].x=Le.x+Ce.x-pe.x,T.points[Le.index].y=Le.y+Ce.y-pe.y}),!0}if(G.altKey&&!G.ctrlKey&&!G.metaKey)return H.clear(),!0;if(G.ctrlKey||G.metaKey||G.altKey){const pe=x,he=G.altKey,be=fe=>{const Te=de(fe.clientX,fe.clientY),Ce=Ie(T,Te.x,Te.y),Le=Math.min(pe.x,Ce.x),Ue=Math.max(pe.x,Ce.x),Ae=Math.min(pe.y,Ce.y),ye=Math.max(pe.y,Ce.y);T.points.forEach((We,ge)=>{We.x>=Le&&We.x<=Ue&&We.y>=Ae&&We.y<=ye&&(he?H.delete(ge):H.add(ge))}),window.removeEventListener("pointerup",be),window.removeEventListener("pointercancel",be)};return window.addEventListener("pointerup",be),window.addEventListener("pointercancel",be),!0}return!1}function dt(G){const T=()=>{window.removeEventListener("pointermove",G),window.removeEventListener("pointerup",T),window.removeEventListener("pointercancel",T)};window.addEventListener("pointermove",G),window.addEventListener("pointerup",T),window.addEventListener("pointercancel",T)}function Mt(G){if(e.activeObjectType!=="collision")return!1;const T=e.colliders.find(ye=>ye.id===e.activeObjectId);if(!(T!=null&&T.enabled)||T.visible===!1)return!1;const p=de(G.clientX,G.clientY),x=T.rotation*Math.PI/180,V=Math.cos(x),K=Math.sin(x),oe=Math.max(1e-4,Math.abs(T.scaleX??1)),pe=Math.max(1e-4,Math.abs(T.scaleY??1)),he=p.x-T.x,be=p.y-T.y,fe=(V*he+K*be)/oe,Te=(-K*he+V*be)/pe;if(!(T.shape==="circle"?Math.hypot(fe,Te)<=T.radius:T.shape==="ellipse"?Math.hypot(fe/Math.max(1,T.radiusX),Te/Math.max(1,T.radiusY))<=1:Math.abs(fe)<=T.width*.5&&Math.abs(Te)<=T.height*.5))return!1;const Le=T.x,Ue=T.y,Ae=p;return dt(ye=>{const We=de(ye.clientX,ye.clientY);T.x=Le+We.x-Ae.x,T.y=Ue+We.y-Ae.y}),!0}function Ct(G){const T=e.systems.find(be=>be.id===e.activeId);if((T==null?void 0:T.visible)===!1)return!1;const p=T==null?void 0:T.config;if(!(p!=null&&p.forceField)||p.forceRadius<=0)return!1;const x=de(G.clientX,G.clientY);if(Math.hypot(x.x-p.forceCenterX,x.y-p.forceCenterY)>p.forceRadius)return!1;const K=p.forceCenterX,oe=p.forceCenterY;t.value&&(t.value.style.cursor="grabbing");const pe=be=>{const fe=de(be.clientX,be.clientY);p.forceCenterX=K+fe.x-x.x,p.forceCenterY=oe+fe.y-x.y},he=()=>{t.value&&(t.value.style.cursor=""),window.removeEventListener("pointermove",pe),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he)};return window.addEventListener("pointermove",pe),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",he),G.preventDefault(),!0}function ai(G){const T=e.systems.find(fe=>fe.id===e.activeId);if((T==null?void 0:T.visible)===!1)return!1;const p=T==null?void 0:T.config;if(!(p!=null&&p.attraction))return!1;const x=de(G.clientX,G.clientY),V=Math.max(p.attractionRadius,12/Math.max(1e-4,e.editor.viewScale));if(Math.hypot(x.x-p.attractionCenterX,x.y-p.attractionCenterY)>V)return!1;const oe=p.attractionCenterX,pe=p.attractionCenterY;t.value&&(t.value.style.cursor="grabbing");const he=fe=>{const Te=de(fe.clientX,fe.clientY);p.attractionCenterX=oe+Te.x-x.x,p.attractionCenterY=pe+Te.y-x.y},be=()=>{t.value&&(t.value.style.cursor=""),window.removeEventListener("pointermove",he),window.removeEventListener("pointerup",be),window.removeEventListener("pointercancel",be)};return window.addEventListener("pointermove",he),window.addEventListener("pointerup",be),window.addEventListener("pointercancel",be),G.preventDefault(),!0}function Jt(){const G=e.activeObjectId;if(e.activeObjectType==="particle"){const x=e.systems.find(K=>K.id===G);if(!x||x.visible===!1)return null;const V=x.config;return{x:V.centerX,y:V.centerY,rotation:V.rootRotation,scaleX:V.rootScaleX??1,scaleY:V.rootScaleY??1,setPosition:(K,oe)=>{V.centerX=K,V.centerY=oe},setRotation:K=>{V.rootRotation=K},setScale:(K,oe)=>{V.rootScaleX=K,V.rootScaleY=oe}}}const p=(e.activeObjectType==="collision"?e.colliders:e.activeObjectType==="path"?e.paths:e.spines).find(x=>x.id===G);return!p||p.visible===!1?null:{x:Number(p.x)||0,y:Number(p.y)||0,rotation:Number(p.rotation)||0,scaleX:Math.max(.05,Number(p.scaleX)||1),scaleY:Math.max(.05,Number(p.scaleY)||1),setPosition:(x,V)=>{p.x=x,p.y=V},setRotation:x=>{p.rotation=x},setScale:(x,V)=>{p.scaleX=x,p.scaleY=V}}}function Zi(G){const T=Jt();if(!T)return;const p=e.editor.viewScale,x=t.value.getBoundingClientRect(),V=x.left+d.screen.width/2+e.editor.viewX+T.x*p,K=x.top+d.screen.height*.5+e.editor.viewY+-T.y*p,oe=G.clientX,pe=G.clientY,he=l.value,be=T.x,fe=T.y,Te=T.rotation,Ce=T.scaleX,Le=T.scaleY,Ue=Math.hypot(oe-V,pe-K)||1,Ae=Math.atan2(pe-K,oe-V),ye=ge=>{const rt=(ge.clientX-oe)/p,mt=(ge.clientY-pe)/p;if(he==="translate")T.setPosition(be+rt,fe-mt);else if(he==="rotate"){const _t=Math.atan2(ge.clientY-K,ge.clientX-V);T.setRotation(Te-(_t-Ae)*180/Math.PI)}else if(he==="scale"){const wi=Math.hypot(ge.clientX-V,ge.clientY-K)/Ue;T.setScale(Math.max(.05,Ce*wi),Math.max(.05,Le*wi))}},We=()=>{window.removeEventListener("pointermove",ye),window.removeEventListener("pointerup",We),window.removeEventListener("pointercancel",We)};window.addEventListener("pointermove",ye),window.addEventListener("pointerup",We),window.addEventListener("pointercancel",We)}function xs(){re(1.2)}function $t(){re(1/1.2)}function re(G){const T=Math.max(.01,e.editor.viewScale*G);e.editor.viewScale=T}function le(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function ft(){e.editor.viewScale=1,e.editor.viewX=0,e.editor.viewY=0}function It(){e.settings.showGrid=!e.settings.showGrid}function Pt(){if(m){for(const[G,T]of Y){const p=e.systems.find(x=>x.id===G);(!p||q.get(G)!==p.config)&&(m.removeChild(T),T.destroy({children:!0}),Y.delete(G),q.delete(G))}for(const G of e.systems){X&&!G.config.texture&&(G.config.texture=X);const T=Tr(G.config);if(U)for(const x of T.trailResources)!x.texture&&(x.previewUrl==="/images/trail.png"||x.previewUrl==="/trails/trail.png")&&(x.texture=U);if(X)for(const x of T.imageResources)!x.texture&&x.textureName==="star"&&(x.texture=X);if(Y.has(G.id))continue;const p=new yE(G.config);p.setEmitterPos(()=>({x:G.config.centerX,y:G.config.centerY})),m.addChild(p),Y.set(G.id,p),q.set(G.id,G.config)}}}function nt(){if(!M)return;const G=M;if(G.clear(),!!e.settings.showEmitter&&e.systems.length)for(const T of e.systems){if(T.visible===!1)continue;const p=ne.get(T.id),x=(p==null?void 0:p.x)??T.config.centerX??0,V=-((p==null?void 0:p.y)??T.config.centerY??0),K=e.activeObjectType==="particle"&&T.id===e.activeId,oe=K?16763955:9082040,pe=K?.4:.2;G.lineStyle(1,oe,pe),G.drawCircle(x,V,10),G.beginFill(oe,K?.8:.4),G.drawCircle(x,V,3),G.endFill(),G.lineStyle(1,oe,K?.3:.15),G.moveTo(x-16,V),G.lineTo(x+16,V),G.moveTo(x,V-16),G.lineTo(x,V+16)}}function $i(){var p;if(!v)return;const G=v;(p=G.parent)==null||p.addChild(G),G.clear();const T=new Map;for(const x of e.spines)x.visible===!1||!x.selectedBone||x.status!=="ready"||T.set(`${x.id}:${x.selectedBone}`,{spineId:x.id,boneName:x.selectedBone});for(const x of e.systems){if(x.visible===!1)continue;const V=x.config;if(!V.emitterFollow||V.emitterFollowMode!=="bone"||!V.emitterFollowSpineId||!V.emitterFollowBoneName)continue;const K=e.spines.find(oe=>oe.id===V.emitterFollowSpineId);!K||K.visible===!1||T.set(`${V.emitterFollowSpineId}:${V.emitterFollowBoneName}`,{spineId:V.emitterFollowSpineId,boneName:V.emitterFollowBoneName})}for(const x of T.values()){const V=D==null?void 0:D.getBoneWorldTransform(x.spineId,x.boneName);if(!V)continue;const K=V.x,oe=-V.y;G.lineStyle(2,12881151,.95),G.beginFill(12881151,.2),G.drawCircle(K,oe,8),G.endFill(),G.beginFill(15919103,1),G.drawCircle(K,oe,3.5),G.endFill()}}function Ji(){if(!y)return;const G=y;if(G.clear(),!e.settings.showEmitter)return;const T=e.systems.find(Ae=>Ae.id===e.activeId);if(!T||T.visible===!1)return;const p=T.config,x=ne.get(T.id),V=(x==null?void 0:x.x)??p.centerX??0,K=-((x==null?void 0:x.y)??p.centerY??0),oe=p.shape;if(oe==="point"||oe==="orbit")return;const pe=p.rootScaleX??1,he=p.rootScaleY??1,be=-((x==null?void 0:x.rotation)??p.rootRotation??0)*Math.PI/180,fe=Math.cos(be),Te=Math.sin(be),Ce=p.offsetX??0,Le=p.offsetY??0,Ue=(Ae,ye)=>{const We=Ae+Ce,ge=-ye-Le,rt=We*pe,mt=ge*he;return[V+rt*fe-mt*Te,K+(rt*Te+mt*fe)]};if(oe==="circle"){G.lineStyle(2,3991658,.7);const Ae=48;for(let ye=0;ye<=Ae;ye++){const We=ye/Ae*Math.PI*2,[ge,rt]=Ue(Math.cos(We)*p.radius,Math.sin(We)*p.radius);ye===0?G.moveTo(ge,rt):G.lineTo(ge,rt)}}else if(oe==="rect"){const Ae=p.rectW/2,ye=p.rectH/2,We=Ue(-Ae,-ye),ge=Ue(Ae,-ye),rt=Ue(Ae,ye),mt=Ue(-Ae,ye);G.lineStyle(2,4885759,.7),G.moveTo(We[0],We[1]),G.lineTo(ge[0],ge[1]),G.lineTo(rt[0],rt[1]),G.lineTo(mt[0],mt[1]),G.lineTo(We[0],We[1])}else if(oe==="cone"){const Ae=p.radius,ye=p.coneAngle/2*Math.PI/180,We=p.direction*Math.PI/180,ge=Ue(Math.cos(We-ye)*Ae,Math.sin(We-ye)*Ae),rt=Ue(Math.cos(We+ye)*Ae,Math.sin(We+ye)*Ae);G.lineStyle(2,3991658,.7),G.moveTo(V,K),G.lineTo(ge[0],ge[1]),G.moveTo(V,K),G.lineTo(rt[0],rt[1]),G.lineStyle(1,3991658,.5);const mt=24;for(let _t=0;_t<=mt;_t++){const wi=We-ye+2*ye*_t/mt,[Mo,Qs]=Ue(Math.cos(wi)*Ae,Math.sin(wi)*Ae);_t===0?G.moveTo(Mo,Qs):G.lineTo(Mo,Qs)}}}function li(){if(!I)return;const G=I;G.clear();const T=e.systems.find(oe=>oe.id===e.activeId);if((T==null?void 0:T.visible)===!1)return;const p=T==null?void 0:T.config;if(!(p!=null&&p.forceField)||p.forceRadius<=0)return;const x=p.forceCenterX,V=-p.forceCenterY,K=p.forceStrength>=0?5818367:16739194;G.lineStyle(2,K,.85),G.beginFill(K,.08),G.drawCircle(x,V,p.forceRadius),G.endFill(),G.lineStyle(1,K,.7),G.moveTo(x-9,V),G.lineTo(x+9,V),G.moveTo(x,V-9),G.lineTo(x,V+9),G.beginFill(K,.95),G.drawCircle(x,V,4),G.endFill()}function Gi(){if(!E)return;const G=E;G.clear();const T=e.systems.find(pe=>pe.id===e.activeId);if((T==null?void 0:T.visible)===!1)return;const p=T==null?void 0:T.config;if(!(p!=null&&p.attraction))return;const x=p.attractionCenterX,V=-p.attractionCenterY,K=Math.max(0,p.attractionRadius),oe=16731487;K>0&&(G.lineStyle(2,oe,.95),G.beginFill(oe,.09),G.drawCircle(x,V,K),G.endFill()),G.lineStyle(1,oe,.85),G.moveTo(x-10,V),G.lineTo(x+10,V),G.moveTo(x,V-10),G.lineTo(x,V+10),G.beginFill(oe,1),G.drawCircle(x,V,K>0?4:6),G.endFill()}function er(){if(!B)return;const G=B;if(G.clear(),!l.value)return;const T=Jt();if(!T)return;const p=T.x,x=-T.y,V=T.scaleX,K=T.scaleY,oe=-T.rotation*Math.PI/180,pe=Math.cos(oe),he=Math.sin(oe),be=(Ce,Le)=>{const Ue=Ce*V,Ae=-Le*K;return[p+Ue*pe-Ae*he,x+(Ue*he+Ae*pe)]},fe=(Ce,Le,Ue,Ae)=>{const ye=be(Ce,Le),We=be(Ue,Ae);G.moveTo(ye[0],ye[1]),G.lineTo(We[0],We[1])},Te=26;if(G.lineStyle(2,3526911,.9),G.beginFill(3526911,.25),G.drawCircle(p,x,6),G.endFill(),l.value==="translate")G.lineStyle(2,3526911,.9),fe(-Te,0,Te,0),fe(0,-Te,0,Te),fe(Te-6,-4,Te,0),fe(Te,0,Te-6,4),fe(-20,-4,-Te,0),fe(-Te,0,-20,4),fe(-4,Te-6,0,Te),fe(0,Te,4,Te-6),fe(-4,-20,0,-Te),fe(0,-Te,4,-20);else if(l.value==="rotate"){G.lineStyle(2,3526911,.8);const Ce=48;for(let Ae=0;Ae<=Ce;Ae++){const ye=Ae/Ce*Math.PI*2,[We,ge]=be(Math.cos(ye)*Te,Math.sin(ye)*Te);Ae===0?G.moveTo(We,ge):G.lineTo(We,ge)}const[Le,Ue]=be(0,Te);G.beginFill(3526911,.95),G.drawCircle(Le,Ue,4),G.endFill()}else if(l.value==="scale"){G.lineStyle(2,3526911,.9);const Le=[[-Te,-Te],[Te,-Te],[Te,Te],[-Te,Te]].map(([Ue,Ae])=>be(Ue,Ae));G.moveTo(Le[0][0],Le[0][1]),G.lineTo(Le[1][0],Le[1][1]),G.lineTo(Le[2][0],Le[2][1]),G.lineTo(Le[3][0],Le[3][1]),G.lineTo(Le[0][0],Le[0][1]),G.beginFill(3526911,.9);for(const Ue of Le)G.drawRect(Ue[0]-3,Ue[1]-3,6,6);G.endFill()}}function Oi(G,T){var p;G.push({boneName:T.boneName,x:T.x,y:T.y,rotation:-T.rotation}),(p=T.trailState)!=null&&p.bones.length&&T.trailState.bones.forEach(x=>{G.push({boneName:x.boneName,x:x.x,y:x.y,rotation:x.rotation,parentX:0,parentY:0,trail:!0})})}function Qt(G){return G.map(T=>({...T,trailState:T.trailState?{...T.trailState,bones:T.trailState.bones.map(p=>({...p}))}:void 0}))}function Pr(G){const T=new Map;for(const x of G)for(const V of x)T.has(V.boneName)||T.set(V.boneName,Qt([V])[0]);const p=[...T.keys()].sort((x,V)=>{const K=Number(x.replace(/^p_/,"")),oe=Number(V.replace(/^p_/,""));return Number.isFinite(K)&&Number.isFinite(oe)?K-oe:x.localeCompare(V)});for(let x=0;x[K.boneName,K]));G[x]=p.map(K=>{const oe=V.get(K);return oe||{...Qt([T.get(K)])[0],alpha:0,imageVisible:!1,trailState:void 0,active:!0}})}}function kr(G,T,p,x){var Le;const V=G.config,K=1/Math.max(1,p),oe=V.lifeMode==="fixed"?Math.max(0,Number(V.lifeMin)||0):Math.max(0,Number(V.lifeMin)||0,Number(V.lifeMax)||0),pe=Math.max(1,Math.ceil(Number(V.loopDurationFrames)||1)),he=Math.max(1,Math.ceil(oe*p)),be=Math.max(1,Math.ceil(he/pe)),fe=Math.max(0,Math.ceil(Math.max(0,Number(V.delay)||0)*p)),Te=[];if(T.reset(),V.generateLoopStartAnimation){for(let Ue=0;Ue0&&T.restartEmissionCycle();for(let Ae=0;Ae0&&T.restartEmissionCycle();for(let ye=0;ye0;ye++)T.update(K,"off"),Te.push(T.capture());(Le=Te[Te.length-1])!=null&&Le.length&&Te.push([])}else{T.restartEmissionCycle();for(let Ae=0;Aex&&(Te.length=x);Te.length({x:T.x+K*Ce*pe-oe*Le*he,y:-(T.y+oe*Ce*pe+K*Le*he)});let fe=[];if(T.shape==="circle"||T.shape==="ellipse"){const Ce=T.shape==="circle"?T.radius:T.radiusX,Le=T.shape==="circle"?T.radius:T.radiusY;fe=Array.from({length:49},(Ue,Ae)=>{const ye=Ae/48*Math.PI*2;return be(Math.cos(ye)*Ce,Math.sin(ye)*Le)})}else if(T.shape==="rect"){const Ce=T.width*.5,Le=T.height*.5;fe=[be(-Ce,-Le),be(Ce,-Le),be(Ce,Le),be(-Ce,Le),be(-Ce,-Le)]}else{const Ce=Math.max(3,Math.min(16,Math.round(T.sides)));fe=Array.from({length:Ce+1},(Le,Ue)=>{const Ae=Math.PI*.5+Ue%Ce/Ce*Math.PI*2;return be(Math.cos(Ae)*T.width*.5,Math.sin(Ae)*T.height*.5)})}if(!fe.length)continue;G.lineStyle(p?2.5:1.5,x,T.enabled?.95:.45),G.beginFill(x,p?.12:.055),G.moveTo(fe[0].x,fe[0].y);for(let Ce=1;Ce{const fe=De(T,he,be);return{x:fe.x,y:-fe.y}},K=T.points[0],oe=V(K.x,K.y);G.lineStyle(p?2.5:1.8,x,p?1:.75),G.moveTo(oe.x,oe.y);const pe=T.closed?T.points.length:T.points.length-1;for(let he=0;he{const fe=V(he.x,he.y),Te=V(he.x+he.inX,he.y+he.inY),Ce=V(he.x+he.outX,he.y+he.outY),Le=Math.hypot(he.inX,he.inY)>.01,Ue=Math.hypot(he.outX,he.outY)>.01;G.lineStyle(1,11121867,.65),Le&&(G.moveTo(fe.x,fe.y),G.lineTo(Te.x,Te.y)),Ue&&(G.moveTo(fe.x,fe.y),G.lineTo(Ce.x,Ce.y)),Le&&(G.beginFill(14015724,.95),G.drawCircle(Te.x,Te.y,3),G.endFill()),Ue&&(G.beginFill(14015724,.95),G.drawCircle(Ce.x,Ce.y,3),G.endFill()),G.beginFill(H.has(be)?16777215:x,1),G.lineStyle(1.5,H.has(be)?6126847:16777215,.95),G.drawCircle(fe.x,fe.y,H.has(be)?5:4),G.endFill()})}}function An(G,T,p="linear"){if(!G.length)return T;const x=[...G].sort((V,K)=>V.x-K.x);if(T<=x[0].x)return x[0].y;for(let V=1;V0&&We===0)continue;const ge=We/20,rt=bs(Ae.x,Ae.x+Ae.outX,ye.x+ye.inX,ye.x,ge),mt=bs(Ae.y,Ae.y+Ae.outY,ye.y+ye.inY,ye.y,ge),_t=De(G,rt,mt),wi=x[x.length-1];wi&&(V+=Math.hypot(_t.x-wi.x,_t.y-wi.y)),x.push({..._t,distance:V})}}const K=Math.min(1,Math.max(0,T))*V;let oe=x.findIndex(Ue=>Ue.distance>=K);oe<0&&(oe=x.length-1);const pe=x[oe],he=x[Math.max(0,oe-1)],be=x[Math.min(x.length-1,oe+1)],fe=he.distance,Te=oe>0?(K-fe)/Math.max(1e-4,pe.distance-fe):0,Ce=he.x+(pe.x-he.x)*Math.min(1,Math.max(0,Te)),Le=he.y+(pe.y-he.y)*Math.min(1,Math.max(0,Te));return{x:Ce,y:Le,angle:Math.atan2(be.y-he.y,be.x-he.x)*180/Math.PI}}function Qi(G){z=e.colliders.map(T=>{if(!T.followPath||!T.followPathId)return T;const p=e.paths.find(be=>be.id===T.followPathId&&be.enabled);if(!(p!=null&&p.points.length))return T;const x=Math.max(.05,Number(T.followDuration)||2),V=Math.min(1,Math.max(0,G/x)),K=Array.isArray(T.followCurve)?T.followCurve:[{x:0,y:0},{x:1,y:1}],oe=T.followCurveMode==="跟随导出"?e.settings.exportSettings.keyframeCurve==="bezier"?"bezier":"linear":T.followCurveMode==="贝塞尔"?"bezier":"linear",pe=Math.min(1,Math.max(0,An(K,V,oe))),he=Bi(p,pe);return he?{...T,x:he.x,y:he.y,rotation:T.rotation+(T.followPathRotation?he.angle:0)}:T})}function ws(G,T,p,x=Math.max(1e-4,Math.abs(G.rootScaleX)),V=Math.max(1e-4,Math.abs(G.rootScaleY))){const K=-G.rootRotation*Math.PI/180,oe=Math.cos(K),pe=Math.sin(K),he=T-G.centerX,be=-p+G.centerY;return{x:(oe*he+pe*be)/x,y:(-pe*he+oe*be)/V}}function tr(){var p,x,V;P=requestAnimationFrame(tr);const G=performance.now()/1e3;let T=G-j;if(j=G,T>.1&&(T=.1),d&&m){m.scale.set(e.editor.viewScale),m.position.set(d.screen.width/2+e.editor.viewX,d.screen.height*.5+e.editor.viewY),g&&(g.position.set(Number(e.settings.backgroundX)||0,-(Number(e.settings.backgroundY)||0)),g.alpha=Math.min(1,Math.max(0,Number(e.settings.backgroundOpacity)||0))),Se(),Pt();const K=Math.max(1,e.timeline.fps),oe=e.timeline.frame,pe=oe/K;D==null||D.sync(e.spines,oe,K),Qi(pe);for(const Ae of e.systems){const ye=Y.get(Ae.id);if(!ye)continue;ye.setFollowExportCurveMode(e.settings.exportSettings.keyframeCurve==="bezier"?"贝塞尔":"线性");const We=Ae.visible!==!1;ye.visible=We,ye.renderable=We;const ge=Ae.config;ye.scale.set(ge.rootScaleX,ge.rootScaleY),ye.setColliders(z),ye.setEmitterFollowSpawn(0,0,0);let rt={x:ge.centerX,y:ge.centerY,rotation:ge.rootRotation};const mt=ge.emitterFollow&&ge.emitterFollowMode==="bone"?e.spines.find(es=>es.id===ge.emitterFollowSpineId&&es.enabled&&es.status==="ready"):null,_t=mt&&(D==null?void 0:D.getBoneWorldTransform(mt.id,ge.emitterFollowBoneName))||null,wi=ge.emitterFollow&&ge.emitterFollowMode==="path"?e.paths.find(es=>es.id===ge.emitterFollowPathId&&es.enabled):null,Mo=Math.max(.05,ge.emitterFollowDuration),Qs=Math.min(1,Math.max(0,pe/Mo)),vf=Math.min(1,Math.max(0,An(ge.emitterFollowCurve,Qs))),Xh=Math.min(1,Math.max(0,ge.emitterFollowOffset)),_x=ge.emitterFollowDirection==="reverse"?(1-Xh)*(1-vf):Xh+(1-Xh)*vf,_s=wi?Bi(wi,_x):null;if(_t){const es=ge.emitterFollowBoneOffsetX,Eo=ge.emitterFollowBoneOffsetY,ir=_t.x+es,Fr=_t.y+Eo,Ca=ge.rootRotation+ge.emitterFollowBoneRotation,Ao=Math.max(1e-4,Math.abs(ge.rootScaleX*ge.emitterFollowBoneScaleX)),Co=Math.max(1e-4,Math.abs(ge.rootScaleY*ge.emitterFollowBoneScaleY));if(rt={x:ir,y:Fr,rotation:Ca},ge.emitterFollowSpace==="local")ye.position.set(ir,-Fr),ye.rotation=-Ca*Math.PI/180,ye.scale.set(Ao,Co),ye.setSimulationTransform(ir,Fr,Ca,Ao,Co);else{ye.position.set(ge.centerX,-ge.centerY),ye.rotation=-ge.rootRotation*Math.PI/180,ye.scale.set(Ao,Co),ye.setSimulationTransform(ge.centerX,ge.centerY,ge.rootRotation,Ao,Co);const yf=ws(ge,ir,Fr,Ao,Co),Sx=-(Ca-ge.rootRotation);ye.setEmitterFollowSpawn(yf.x,yf.y,Sx)}}else if(_s){const es=_s.angle+(ge.emitterFollowDirection==="reverse"?180:0),Eo=ge.emitterAngleMode==="direction"?es:ge.rootRotation;if(rt={x:_s.x,y:_s.y,rotation:Eo},ge.emitterFollowSpace==="local")ye.position.set(_s.x,-_s.y),ye.rotation=-Eo*Math.PI/180,ye.setSimulationTransform(_s.x,_s.y,Eo);else{ye.position.set(ge.centerX,-ge.centerY),ye.rotation=-ge.rootRotation*Math.PI/180,ye.setSimulationTransform(ge.centerX,ge.centerY,ge.rootRotation);const ir=ws(ge,_s.x,_s.y),Fr=ge.emitterAngleMode==="direction"?-(es-ge.rootRotation):0;ye.setEmitterFollowSpawn(ir.x,ir.y,Fr)}}else ye.position.set(ge.centerX,-ge.centerY),ye.rotation=-ge.rootRotation*Math.PI/180,ye.setSimulationTransform(ge.centerX,ge.centerY,ge.rootRotation);ne.set(Ae.id,rt)}let he=0;const be=[],fe=e.timeline,Te=fe.fps,Ce=1/Math.max(1,Te);let Le=L,Ue=0;if(fe.playing?(O+=T,Ue=Math.floor(O/Ce),Ue>0&&(O-=Ue*Ce)):O=0,fe.playing&&Ue>0)for(let Ae=0;Ae=fe.totalFrames)if(fe.loop)fe.frame=0;else{fe.frame=fe.totalFrames-1,fe.playing=!1;break}}else{if(fe.frame===0)for(const ye of e.systems){const We=Y.get(ye.id);We&&(ye.config.mode==="stream"&&ye.config.streamBehavior==="loop"?kr(ye,We,Te,fe.totalFrames):We.reset())}for(const[ye,We]of Y){const ge=e.systems.find(Qs=>Qs.id===ye),rt=(ge==null?void 0:ge.config.mode)==="stream"&&ge.config.streamBehavior==="loop",mt=rt?(p=ge.frames)==null?void 0:p[fe.frame]:void 0,_t=fe.frame===0&&!rt,wi=_t?[]:mt||We.update(Ce);if(_t?We.apply([]):mt&&We.apply(mt),(ge==null?void 0:ge.visible)!==!1)for(const Qs of wi)Qs.active&&Oi(be,Qs);he+=wi.length}for(const ye of e.systems){if(!ye.config.texture)continue;ye.frames=ye.frames||[];const We=Y.get(ye.id);We&&!(ye.config.mode==="stream"&&ye.config.streamBehavior==="loop")&&(ye.frames[fe.frame]=We.capture())}fe.frame++,fe.frame>=fe.totalFrames&&(fe.frame=0,fe.recorded=!0)}else{fe.playing||(Le=fe.frame);for(const Ae of e.systems){const ye=Y.get(Ae.id),We=fe.playing?L:fe.frame,ge=(V=Ae.frames)==null?void 0:V[We],rt=Ae.config.mode==="stream"&&Ae.config.streamBehavior==="loop"&&!!ge;if((fe.recorded||rt)&&ye&&ge){ye.apply(ge);for(const mt of ge)mt.active&&(Ae.visible!==!1&&Oi(be,mt),he++)}else if(ye){const mt=fe.frame===0?[]:ye.update(0);if(fe.frame===0&&ye.apply([]),Ae.visible!==!1)for(const _t of mt)_t.active&&Oi(be,_t);he+=ye.activeCount}}}L=Le,D==null||D.sync(e.spines,Le,Te);for(const[,Ae]of Y)Ae.drawTrailMeshDebug(e.settings.showSkinMesh);En(),Js(),$i(),nt(),Ji(),li(),Gi(),er(),Mn(be),s.value&&(s.value.systems=e.systems.length,s.value.particles=he)}}return _o(async()=>{window.addEventListener("keydown",ve);const G=t.value;d=new jv({width:G.clientWidth||800,height:G.clientHeight||600,backgroundAlpha:0,antialias:!0}),G.appendChild(d.view),me(),cs(()=>e.settings.backgroundImageData,Q,{immediate:!0}),await ae();const T=X;for(const p of e.systems){p.config.texture=T;const x=Tr(p.config);if(U)for(const V of x.trailResources)!V.texture&&(V.previewUrl==="/images/trail.png"||V.previewUrl==="/trails/trail.png")&&(V.texture=U);for(const V of x.imageResources)!V.texture&&V.textureName==="star"&&(V.texture=T)}s.value={systems:e.systems.length,particles:0},e.timeline.recorded=!1,e.timeline.frame=0,O=0,L=0,e.timeline.playing=!0,e.timeline.loop=!0;for(const p of e.systems)p.frames=[];e.recalcTotalFrames(),j=performance.now()/1e3,tr(),cs(()=>e.systems.map(p=>JSON.stringify(p.config,(x,V)=>x==="texture"||x==="trailTexture"||x==="previewUrl"?void 0:V)).join("|")+`|colliders:${JSON.stringify(e.colliders)}|paths:${JSON.stringify(e.paths)}`,()=>{e.recalcTotalFrames(),e.timeline.recorded=!1,e.timeline.frame=0;for(const p of e.systems)p.frames=[];e.timeline.playing=!0,e.timeline.loop=!0}),uC(e)}),wa(()=>{window.removeEventListener("keydown",ve),cancelAnimationFrame(P),D==null||D.destroy(),D=null,_++,b&&b.destroy(!0),b=null,g=null,d&&(d.destroy(!0,{children:!0}),d=null)}),(G,T)=>(se(),ce("div",mC,[w("div",{ref_key:"holder",ref:t,class:Ze(["stage-holder",{grid:Pe(e).settings.showGrid}]),tabindex:"0",onWheel:xt(Me,["prevent"]),onPointerdown:Ee,onDblclick:xt(ct,["prevent"])},null,34),w("div",gC,[w("button",{class:"settings-btn",onClick:$,title:"系统设置"},"系统设置"),w("button",{class:"undo-btn",disabled:Pe(Vh).undoCount===0,onClick:T[0]||(T[0]=(...p)=>Pe(Cu)&&Pe(Cu)(...p)),title:"撤回上一步 (Ctrl+Z)"},"↶",8,vC),w("div",yC,[w("button",{class:Ze(["tool-btn",{on:l.value===""}]),onClick:T[1]||(T[1]=p=>u("")),title:"拖动画布 (Q)"},"✋",2),w("button",{class:Ze(["tool-btn",{on:l.value==="translate"}]),onClick:T[2]||(T[2]=p=>u("translate")),title:"位移 (W)"},"✥",2),w("button",{class:Ze(["tool-btn",{on:l.value==="rotate"}]),onClick:T[3]||(T[3]=p=>u("rotate")),title:"旋转 (E)"},"⟳",2),w("button",{class:Ze(["tool-btn",{on:l.value==="scale"}]),onClick:T[4]||(T[4]=p=>u("scale")),title:"缩放 (R)"},"⤢",2)]),w("div",xC,[w("button",{class:"tool-btn",onClick:xs,title:"放大"},"+"),w("button",{class:"tool-btn",onClick:$t,title:"缩小"},"-"),w("button",{class:"tool-btn",onClick:le,title:"适配画布"},"⤢"),w("button",{class:Ze(["tool-btn",{on:Pe(e).settings.showGrid}]),onClick:It,title:"切换网格"},"▦",2),w("button",{class:"tool-btn",onClick:ft,title:"重置视图"},"⟳")]),w("div",{class:"background-menu",onClick:T[10]||(T[10]=xt(()=>{},["stop"]))},[w("button",{class:Ze(["background-btn",{on:r.value}]),title:"背景图显示设置",onClick:_e},"背景图",2),r.value?(se(),ce("div",bC,[w("button",{class:"background-upload",onClick:T[5]||(T[5]=p=>{var x;return(x=a.value)==null?void 0:x.click()})},Ye(h.value?"更换图像":"上传图像"),1),w("button",{class:"background-clear",disabled:!h.value,onClick:T[6]||(T[6]=p=>ie())},"清除背景",8,wC),w("input",{ref_key:"backgroundFileInput",ref:a,class:"background-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:J},null,544),w("div",{class:"background-file-name",title:h.value},Ye(h.value||"未上传图像"),9,_C),w("div",SC,[w("label",null,[T[28]||(T[28]=w("span",null,"X",-1)),xe(w("input",{"onUpdate:modelValue":T[7]||(T[7]=p=>Pe(e).settings.backgroundX=p),type:"number",step:"1","aria-label":"背景图 X 偏移"},null,512),[[Je,Pe(e).settings.backgroundX,void 0,{number:!0}]])]),w("label",null,[T[29]||(T[29]=w("span",null,"Y",-1)),xe(w("input",{"onUpdate:modelValue":T[8]||(T[8]=p=>Pe(e).settings.backgroundY=p),type:"number",step:"1","aria-label":"背景图 Y 偏移"},null,512),[[Je,Pe(e).settings.backgroundY,void 0,{number:!0}]])])]),w("label",TC,[T[30]||(T[30]=w("span",null,"透明度",-1)),xe(w("input",{"onUpdate:modelValue":T[9]||(T[9]=p=>Pe(e).settings.backgroundOpacity=p),type:"range",min:"0",max:"1",step:"0.01","aria-label":"背景图透明度"},null,512),[[Je,Pe(e).settings.backgroundOpacity,void 0,{number:!0}]]),w("b",null,Ye(Math.round(Pe(e).settings.backgroundOpacity*100))+"%",1)])])):$e("",!0)]),w("button",{class:Ze(["help-btn",{on:o.value}]),title:"查看使用说明",onClick:te},"使用说明",2),w("span",MC,Ye(Math.round(Pe(e).editor.viewScale*100))+"%",1)]),n.value?(se(),ce("div",EC,[w("div",AC,[T[31]||(T[31]=Yt("系统设置 ",-1)),w("button",{class:"sp-close",onClick:T[11]||(T[11]=p=>n.value=!1)},"✕")]),T[45]||(T[45]=w("div",{class:"sp-section-title"},"界面布局",-1)),w("label",CC,[T[33]||(T[33]=w("span",null,"参数面板位置",-1)),w("span",IC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[12]||(T[12]=p=>Pe(e).settings.parameterPanelOnRight=p),"aria-label":"参数面板显示在右侧"},null,512),[[Lt,Pe(e).settings.parameterPanelOnRight]]),T[32]||(T[32]=w("span",{class:"sp-switch-ui","aria-hidden":"true"},null,-1)),w("b",null,Ye(Pe(e).settings.parameterPanelOnRight?"右侧":"左侧"),1)])]),T[46]||(T[46]=w("div",{class:"sp-divider"},null,-1)),T[47]||(T[47]=w("div",{class:"sp-section-title"},"操作历史",-1)),w("label",RC,[T[34]||(T[34]=w("span",null,"最大撤回步数",-1)),xe(w("input",{class:"sp-num sp-undo-limit",type:"number",min:"1",max:"200","onUpdate:modelValue":T[13]||(T[13]=p=>Pe(e).settings.undoLimit=p),"aria-label":"最大撤回步数",onChange:W},null,544),[[Je,Pe(e).settings.undoLimit,void 0,{number:!0}]])]),T[48]||(T[48]=w("div",{class:"sp-divider"},null,-1)),T[49]||(T[49]=w("div",{class:"sp-section-title"},"画布辅助显示",-1)),w("label",PC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[14]||(T[14]=p=>Pe(e).settings.showEmitter=p)},null,512),[[Lt,Pe(e).settings.showEmitter]]),T[35]||(T[35]=Yt("发射点",-1))]),w("label",kC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[15]||(T[15]=p=>Pe(e).settings.showBones=p)},null,512),[[Lt,Pe(e).settings.showBones]]),T[36]||(T[36]=Yt("骨骼连线",-1))]),Pe(e).settings.showBones?(se(),ce(qe,{key:0},[w("label",FC,[T[37]||(T[37]=w("span",null,"骨骼点绘制大小",-1)),xe(w("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":T[16]||(T[16]=p=>Pe(e).settings.bonePointDrawSize=p),"aria-label":"骨骼点绘制大小",onChange:f},null,544),[[Je,Pe(e).settings.bonePointDrawSize,void 0,{number:!0}]])]),w("label",OC,[T[38]||(T[38]=w("span",null,"坐标轴绘制大小",-1)),xe(w("input",{class:"sp-num",type:"number",min:"0.1",max:"10",step:"0.1","onUpdate:modelValue":T[17]||(T[17]=p=>Pe(e).settings.boneAxisDrawSize=p),"aria-label":"坐标轴绘制大小",onChange:f},null,544),[[Je,Pe(e).settings.boneAxisDrawSize,void 0,{number:!0}]])])],64)):$e("",!0),w("label",BC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[18]||(T[18]=p=>Pe(e).settings.showSkinMesh=p)},null,512),[[Lt,Pe(e).settings.showSkinMesh]]),T[39]||(T[39]=Yt("蒙皮网格",-1))]),T[50]||(T[50]=w("div",{class:"sp-divider"},null,-1)),w("label",LC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[19]||(T[19]=p=>Pe(e).settings.tickEnabled=p)},null,512),[[Lt,Pe(e).settings.tickEnabled]]),T[40]||(T[40]=Yt("启用刻度",-1))]),Pe(e).settings.tickEnabled?(se(),ce(qe,{key:1},[w("label",DC,[T[41]||(T[41]=w("span",null,"刻度文字大小",-1)),xe(w("input",{type:"range",min:"8",max:"40",step:"1","onUpdate:modelValue":T[20]||(T[20]=p=>Pe(e).settings.axisFontSize=p)},null,512),[[Je,Pe(e).settings.axisFontSize,void 0,{number:!0}]]),xe(w("input",{type:"number",min:"8",max:"40","onUpdate:modelValue":T[21]||(T[21]=p=>Pe(e).settings.axisFontSize=p),class:"sp-num"},null,512),[[Je,Pe(e).settings.axisFontSize,void 0,{number:!0}]])]),w("label",NC,[T[42]||(T[42]=w("span",null,"刻度线粗细",-1)),xe(w("input",{type:"range",min:"1",max:"5",step:"0.5","onUpdate:modelValue":T[22]||(T[22]=p=>Pe(e).settings.tickWidth=p)},null,512),[[Je,Pe(e).settings.tickWidth,void 0,{number:!0}]]),xe(w("input",{type:"number",min:"1",max:"5","onUpdate:modelValue":T[23]||(T[23]=p=>Pe(e).settings.tickWidth=p),class:"sp-num"},null,512),[[Je,Pe(e).settings.tickWidth,void 0,{number:!0}]])]),w("label",UC,[T[43]||(T[43]=w("span",null,"坐标轴颜色",-1)),xe(w("input",{type:"color","onUpdate:modelValue":T[24]||(T[24]=p=>Pe(e).settings.axisColor=p),class:"sp-colr"},null,512),[[Je,Pe(e).settings.axisColor]]),w("span",VC,Ye(Pe(e).settings.axisColor),1)]),w("label",XC,[xe(w("input",{type:"checkbox","onUpdate:modelValue":T[25]||(T[25]=p=>Pe(e).settings.showAxisLabels=p)},null,512),[[Lt,Pe(e).settings.showAxisLabels]]),T[44]||(T[44]=Yt("显示刻度数值",-1))])],64)):$e("",!0),T[51]||(T[51]=w("div",{class:"sp-cache-note"},"整个系统设置会自动保存到当前浏览器",-1))])):$e("",!0),o.value?(se(),ce("div",{key:1,class:"help-overlay",role:"presentation",onClick:T[27]||(T[27]=xt(p=>o.value=!1,["self"]))},[w("section",YC,[w("header",$C,[T[52]||(T[52]=w("div",null,[w("h2",{id:"help-title"},"使用说明"),w("p",null,"从创建粒子到保存、导出的快速入门")],-1)),w("button",{class:"help-close","aria-label":"关闭使用说明",title:"关闭 (Esc)",onClick:T[26]||(T[26]=p=>o.value=!1)},"✕")]),T[53]||(T[53]=Vo('

快速开始

  1. 创建对象:在左侧“场景对象”中添加粒子、碰撞、路径或 Spine。
  2. 编辑粒子:选中粒子系统,依次调整发射、形状、属性、外观资源和修改器。
  3. 查看效果:使用底部时间轴播放、暂停或拖动到指定帧;修改参数后会自动重新计算。
  4. 保存成果:配置文件用于继续编辑;“导出 Spine Json”支持 Spine 3.8、4.0、4.1 和 4.2。

常用功能

小眼睛
单独显示或隐藏场景对象;隐藏的粒子系统不会导出。
+Copy
完整复制当前选中对象,方便对比不同参数效果。
背景图
上传参考图并调整位置和透明度,只用于画布预览。
系统设置
管理界面与辅助显示,并自动保存在当前浏览器中。
配置管理
保存当前项目数据、加载配置,或直接使用预设文件;不包含系统设置。
Spine 骨骼
在层级树搜索并选择骨骼,可用于粒子发射器跟随。

快捷键

Ctrl/⌘+Z撤回上一步
Ctrl/⌘+S保存配置
Q拖动画布
W位移工具
E旋转工具
R缩放工具
D播放 / 暂停
S回到第一帧

Q / W / E / R 需要先点击画布。光标位于输入框时,单键快捷键不会触发。

配置与导出有什么区别?

保存配置会保存编辑器中的全部对象和参数,之后可以继续修改;导出 Spine Json只导出显示中的粒子系统,并把跟随、碰撞和拖尾结果烘焙为独立动画数据。

',1))])])):$e("",!0),s.value?(se(),ce("div",GC,[T[54]||(T[54]=Yt(" 系统: ",-1)),w("b",jC,Ye(s.value.systems),1),T[55]||(T[55]=Yt(" · 粒子(骨骼): ",-1)),w("b",HC,Ye(s.value.particles),1),T[56]||(T[56]=Yt(" · 根骨骼: ",-1)),T[57]||(T[57]=w("b",null,"root",-1)),T[58]||(T[58]=w("span",{class:"hud-tip"},"滚轮缩放 · 左键拖动画布",-1))])):$e("",!0)]))}}),Ks=(i,e)=>{const t=i.__vccOpts||i;for(const[s,n]of e)t[s]=n;return t},zC=Ks(WC,[["__scopeId","data-v-1b609e97"]]),qC={class:"ns-label"},KC=["min","max","step","value","disabled"],ZC=["min","max","step","value","disabled"],JC=Ws({__name:"NumSlider",props:{label:{},modelValue:{},min:{},max:{},step:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(i,{emit:e}){const t=i,s=e,n=it(String(t.modelValue));cs(()=>t.modelValue,h=>{n.value=String(h)});function r(h){const l=parseFloat(h.target.value);Number.isNaN(l)||s("update:modelValue",l)}function o(h){n.value=h.target.value;const l=parseFloat(n.value);Number.isNaN(l)||s("update:modelValue",l)}function a(){const h=parseFloat(n.value);Number.isNaN(h)&&(n.value=String(t.modelValue))}return(h,l)=>(se(),ce("div",{class:Ze(["ns",{disabled:i.disabled}])},[w("span",qC,Ye(i.label),1),w("input",{type:"range",class:"ns-range",min:i.min,max:i.max,step:i.step,value:i.modelValue,disabled:i.disabled,onInput:r},null,40,KC),w("input",{type:"number",class:"ns-num",min:i.min,max:i.max,step:i.step,value:n.value,disabled:i.disabled,onInput:o,onBlur:a},null,40,ZC)],2))}}),Ge=Ks(JC,[["__scopeId","data-v-7c2fbed0"]]),QC={class:"ce"},e2={class:"ce-editor"},t2={class:"ce-grid"},i2=["x1","x2","y2"],s2=["y1","x2","y2"],n2=["x","y","width","height"],r2=["d"],o2={key:0,class:"ce-handles"},a2=["x1","y1","x2","y2"],l2=["cx","cy","onPointerdown"],h2=["x1","y1","x2","y2"],c2=["cx","cy","onPointerdown"],u2=["cx","cy"],d2=["cx","cy","onPointerdown","onDblclick"],f2={class:"ce-nav"},p2={class:"ce-tip"},Rn=8,m2=Ws({__name:"CurveEditor",props:{modelValue:{},defaultValue:{default:()=>[{x:0,y:0},{x:1,y:1}]},mode:{default:"linear"}},emits:["update:modelValue"],setup(i,{emit:e}){const t=i,s=e,n=it(null),r=it(300),o=it(110);let a=null;function h(){if(!n.value)return;const k=n.value.getBoundingClientRect();r.value=k.width,o.value=k.height}function l(k){return Rn+k*(r.value-Rn*2)}function c(k){return Rn+(1-k)*(o.value-Rn*2)}function u(){return[...t.modelValue].sort((k,F)=>k.x-F.x)}function f(k){s("update:modelValue",[...k].sort((F,D)=>F.x-D.x))}function d(){f(t.defaultValue.map(k=>({...k})))}const m=ut(()=>u());function g(k){const F=m.value[k],D=m.value[Math.max(0,k-1)];return{x:F.x-(F.x-D.x)/3,y:F.y-(F.y-D.y)/3}}function b(k){const F=m.value[k],D=m.value[Math.min(m.value.length-1,k+1)];return{x:F.x+(D.x-F.x)/3,y:F.y+(D.y-F.y)/3}}function _(k){const F=m.value[k],D=g(k);return{x:F.x+(F.inX??D.x-F.x),y:F.y+(F.inY??D.y-F.y)}}function M(k){const F=m.value[k],D=b(k);return{x:F.x+(F.outX??D.x-F.x),y:F.y+(F.outY??D.y-F.y)}}const v=ut(()=>{if(!m.value.length)return"";let k=`M ${l(m.value[0].x)} ${c(m.value[0].y)}`;for(let F=1;FMath.abs(j.x-F)>.02);N.push({x:F,y:D}),f(N)}let E={t:0,i:-1,x:0,y:0};function C(k,F){k.stopPropagation();const D=u().findIndex(L=>Math.abs(L.x-m.value[F].x)<1e-6&&Math.abs(L.y-m.value[F].y)<1e-6);if(D<0)return;const N=Date.now();if(N-E.t<300&&E.i===F&&Math.abs(k.clientX-E.x)<8&&Math.abs(k.clientY-E.y)<8){E={t:0,i:-1,x:0,y:0},B(F);return}E={t:N,i:F,x:k.clientX,y:k.clientY};const j=L=>{(Math.abs(L.clientX-k.clientX)>8||Math.abs(L.clientY-k.clientY)>8)&&(E={t:0,i:-1,x:0,y:0});const{x:P,y:X}=S(L.clientX,L.clientY),U=u();U[D]={x:P,y:X},f(U)},O=()=>{window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",O)};window.addEventListener("pointermove",j),window.addEventListener("pointerup",O)}function R(k,F,D){k.stopPropagation();const N=O=>{const L=S(O.clientX,O.clientY),P=u(),X=P[F],U=D==="in"?P[Math.max(0,F-1)].x:X.x,Y=D==="in"?X.x:P[Math.min(P.length-1,F+1)].x,q=Math.min(Y,Math.max(U,L.x)),z=Math.round((q-X.x)*100)/100,ne=Math.round((L.y-X.y)*100)/100;P[F]=D==="in"?{...X,inX:z,inY:ne}:{...X,outX:z,outY:ne},f(P)},j=()=>{window.removeEventListener("pointermove",N),window.removeEventListener("pointerup",j)};window.addEventListener("pointermove",N),window.addEventListener("pointerup",j)}function B(k,F){F==null||F.stopPropagation();const D=u();D.length<=2||(y=Date.now(),f(D.filter((N,j)=>j!==k)))}return _o(()=>{h(),a=new ResizeObserver(h),n.value&&a.observe(n.value)}),wa(()=>{a==null||a.disconnect()}),(k,F)=>(se(),ce("div",QC,[w("div",e2,[(se(),ce("svg",{ref_key:"svg",ref:n,class:"ce-svg",onDblclick:I},[w("g",t2,[(se(),ce(qe,null,Ht([.25,.5,.75],D=>w("line",{key:"v"+D,x1:l(D),y1:"0",x2:l(D),y2:c(0)},null,8,i2)),64)),(se(),ce(qe,null,Ht([.25,.5,.75],D=>w("line",{key:"h"+D,x1:"0",y1:c(D),x2:l(1),y2:c(D)},null,8,s2)),64))]),w("rect",{x:l(0),y:c(1),width:l(1)-l(0),height:c(0)-c(1),class:"ce-frame",fill:"none"},null,8,n2),w("path",{d:v.value,class:"ce-line",fill:"none"},null,8,r2),i.mode==="bezier"?(se(),ce("g",o2,[(se(!0),ce(qe,null,Ht(m.value,(D,N)=>(se(),ce(qe,{key:"handles-"+N},[N>0?(se(),ce("line",{key:0,x1:l(D.x),y1:c(D.y),x2:l(_(N).x),y2:c(_(N).y)},null,8,a2)):$e("",!0),N>0?(se(),ce("circle",{key:1,cx:l(_(N).x),cy:c(_(N).y),r:"4",onPointerdown:j=>R(j,N,"in")},null,40,l2)):$e("",!0),NR(j,N,"out")},null,40,c2)):$e("",!0)],64))),128))])):$e("",!0),(se(!0),ce(qe,null,Ht(m.value,(D,N)=>(se(),ce("g",{key:N},[w("circle",{cx:l(D.x),cy:c(D.y),r:"5",class:"ce-node"},null,8,u2),w("circle",{cx:l(D.x),cy:c(D.y),r:"9",class:"ce-hit",onPointerdown:j=>C(j,N),onDblclick:j=>B(N,j)},null,40,d2)]))),128))],544)),w("div",f2,[w("span",p2,Ye(i.mode==="bezier"?"拖动方形手柄调整弧度·双击空白新建·双击节点删除":"双击空白新建·双击节点删除·拖动节点调整"),1)])]),w("button",{class:"ce-reset",type:"button",title:"恢复默认曲线",onClick:d},"重置")]))}}),Is=Ks(m2,[["__scopeId","data-v-9bfb7b31"]]),g2={class:"pac"},v2={class:"pac-head"},y2={class:"pac-label"},x2={key:0,class:"pac-modes"},b2=["onClick"],w2={class:"pac-range"},_2={class:"pac-curve"},S2={class:"pac-axis"},T2=Ws({__name:"ParticleAttributeControl",props:{label:{},mode:{},valueMin:{},valueMax:{},curve:{},defaultCurve:{default:()=>[{x:0,y:0},{x:1,y:1}]},min:{},max:{},step:{default:1},allowDirection:{type:Boolean,default:!1},allowCurve:{type:Boolean,default:!0},showModes:{type:Boolean,default:!0},curveLabel:{default:"曲线输入 →"}},emits:["update:mode","update:valueMin","update:valueMax","update:curve"],setup(i){const e=i,t=ut(()=>{const s=[{label:"固定",value:"fixed"},{label:"随机",value:"random"}];return e.allowCurve&&s.push({label:"曲线",value:"curve"}),e.allowDirection&&s.push({label:"发射方向",value:"direction"}),s});return(s,n)=>(se(),ce("div",g2,[w("div",v2,[w("span",y2,Ye(i.label),1),i.showModes?(se(),ce("div",x2,[(se(!0),ce(qe,null,Ht(t.value,r=>(se(),ce("button",{key:r.value,class:Ze(["pac-mode",{on:i.mode===r.value}]),onClick:o=>s.$emit("update:mode",r.value)},Ye(r.label),11,b2))),128))])):$e("",!0)]),i.mode==="fixed"||i.mode==="direction"?(se(),Et(Ge,{key:0,label:i.mode==="direction"?"角度偏移":"数值",min:i.min,max:i.max,step:i.step,"model-value":i.valueMin,"onUpdate:modelValue":n[0]||(n[0]=r=>s.$emit("update:valueMin",r))},null,8,["label","min","max","step","model-value"])):i.mode==="random"?(se(),ce(qe,{key:1},[Ne(Ge,{label:"下限",min:i.min,max:i.max,step:i.step,"model-value":i.valueMin,"onUpdate:modelValue":n[1]||(n[1]=r=>s.$emit("update:valueMin",r))},null,8,["min","max","step","model-value"]),Ne(Ge,{label:"上限",min:i.min,max:i.max,step:i.step,"model-value":i.valueMax,"onUpdate:modelValue":n[2]||(n[2]=r=>s.$emit("update:valueMax",r))},null,8,["min","max","step","model-value"])],64)):(se(),ce(qe,{key:2},[w("div",w2,[Ne(Ge,{label:"范围下限",min:i.min,max:i.max,step:i.step,"model-value":i.valueMin,"onUpdate:modelValue":n[3]||(n[3]=r=>s.$emit("update:valueMin",r))},null,8,["min","max","step","model-value"]),Ne(Ge,{label:"范围上限",min:i.min,max:i.max,step:i.step,"model-value":i.valueMax,"onUpdate:modelValue":n[4]||(n[4]=r=>s.$emit("update:valueMax",r))},null,8,["min","max","step","model-value"])]),w("div",_2,[Ne(Is,{"model-value":i.curve,"default-value":i.defaultCurve,"onUpdate:modelValue":n[5]||(n[5]=r=>s.$emit("update:curve",r))},null,8,["model-value","default-value"]),w("div",S2,[n[6]||(n[6]=w("span",null,"0",-1)),w("span",null,Ye(i.curveLabel),1),n[7]||(n[7]=w("span",null,"1",-1))])])],64))]))}}),nn=Ks(T2,[["__scopeId","data-v-238f838c"]]),M2={class:"gradient-editor"},E2=["title","onClick","onDblclick","onPointerdown"],A2={key:0,class:"gradient-controls"},C2=["value"],I2=["value"],R2={class:"gradient-position"},P2=["value"],k2=["disabled"],F2=Ws({__name:"ColorGradientEditor",props:{modelValue:{}},emits:["update:modelValue"],setup(i,{emit:e}){const t=i,s=e,n=it(null),r=it(0),o=ut(()=>t.modelValue[r.value]||null),a=ut(()=>[...t.modelValue].sort((C,R)=>C.position-R.position)),h=ut(()=>{const C=a.value;return C.length?`linear-gradient(90deg, ${C.map(R=>`${R.color} ${l(R.position)*100}%`).join(", ")})`:"#ffffff"});cs(()=>t.modelValue.length,C=>{r.value>=C&&(r.value=Math.max(0,C-1))});function l(C){return Math.min(1,Math.max(0,Number(C)||0))}function c(){return t.modelValue.map(C=>({position:l(C.position),color:C.color}))}function u(C,R){const B=c();B[C]&&(B[C]={...B[C],...R},s("update:modelValue",B))}function f(C){u(r.value,{color:C.target.value})}function d(C){var k;const R=C.target,B=E(R.value,((k=o.value)==null?void 0:k.color)||"#ffffff");R.value=B,u(r.value,{color:B})}function m(C){const R=C.target;d(C),R.blur()}function g(C){const R=Number(C.target.value);Number.isFinite(R)&&u(r.value,{position:l(R/100)})}function b(C){const R=c();R.push({position:l(C),color:y(R,C)}),r.value=R.length-1,s("update:modelValue",R)}function _(C){if(!n.value)return;const R=n.value.getBoundingClientRect();b((C.clientX-R.left)/Math.max(1,R.width))}function M(){const C=a.value;let R=.5;if(C.length>1){let B=-1;for(let k=0;kB&&(B=F,R=(C[k].position+C[k+1].position)/2)}}b(R)}function v(C){if(t.modelValue.length<=2||C<0)return;const R=c().filter((B,k)=>k!==C);r.value=Math.min(C,R.length-1),s("update:modelValue",R)}function S(C,R){if(!n.value)return;r.value=R;const B=F=>{const D=n.value.getBoundingClientRect();u(R,{position:l((F.clientX-D.left)/Math.max(1,D.width))})},k=()=>{window.removeEventListener("pointermove",B),window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k)};window.addEventListener("pointermove",B),window.addEventListener("pointerup",k),window.addEventListener("pointercancel",k),C.preventDefault()}function y(C,R){const B=[...C].sort((k,F)=>k.position-F.position);if(!B.length)return"#ffffff";if(R<=B[0].position)return B[0].color;if(R>=B[B.length-1].position)return B[B.length-1].color;for(let k=0;kD.position)continue;const N=(R-F.position)/Math.max(1e-4,D.position-F.position);return I(F.color,D.color,N)}return B[B.length-1].color}function I(C,R,B){const k=j=>{const O=parseInt(j.replace("#","").padEnd(6,"0").slice(0,6),16);return[O>>16&255,O>>8&255,O&255]},F=k(C),D=k(R),N=j=>Math.round(F[j]+(D[j]-F[j])*B);return`#${[N(0),N(1),N(2)].map(j=>j.toString(16).padStart(2,"0")).join("")}`}function E(C,R){let B=C.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(B)&&(B=B.split("").map(k=>k+k).join("")),/^[0-9a-f]{6}$/i.test(B)?`#${B.toLowerCase()}`:R}return(C,R)=>(se(),ce("div",M2,[w("div",{ref_key:"bar",ref:n,class:"gradient-bar",style:Pi({background:h.value}),title:"双击色带添加色标",onDblclick:_},[(se(!0),ce(qe,null,Ht(i.modelValue,(B,k)=>(se(),ce("button",{key:k,type:"button",class:Ze(["gradient-stop",{selected:k===r.value}]),style:Pi({left:`${l(B.position)*100}%`,"--stop-color":B.color}),title:`${Math.round(l(B.position)*100)}% · ${B.color}`,onClick:xt(F=>r.value=k,["stop"]),onDblclick:xt(F=>v(k),["stop"]),onPointerdown:xt(F=>S(F,k),["stop"])},null,46,E2))),128))],36),o.value?(se(),ce("div",A2,[w("input",{type:"color",class:"gradient-color",value:o.value.color,"aria-label":"色标颜色",onInput:f},null,40,C2),w("input",{type:"text",class:"gradient-hex-input",value:o.value.color,"aria-label":"色标颜色值",spellcheck:"false",onChange:d,onKeydown:da(m,["enter"])},null,40,I2),w("label",R2,[w("input",{type:"number",min:"0",max:"100",step:"1",value:Math.round(l(o.value.position)*100),"aria-label":"色标位置",onInput:g},null,40,P2),R[1]||(R[1]=w("span",null,"%",-1))]),w("button",{type:"button",class:"gradient-action",title:"在中间新增颜色",onClick:M},"+"),w("button",{type:"button",class:"gradient-action danger",title:"删除当前色标",disabled:i.modelValue.length<=2,onClick:R[0]||(R[0]=B=>v(r.value))},"×",8,k2)])):$e("",!0),R[2]||(R[2]=w("div",{class:"gradient-hint"},"双击色带新增 · 拖动色标调整位置 · 双击色标删除",-1))]))}}),pg=Ks(F2,[["__scopeId","data-v-f6ab10bf"]]),O2={class:"image-card"},B2={class:"imgrow"},L2=["title"],D2=["src","alt"],N2={key:1,viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"#8a93bb","stroke-width":"1.6"},U2={class:"img-fields"},V2={key:0,class:"row"},X2={class:"row"},Y2=["placeholder"],$2={class:"img-actions"},G2=["title"],j2=["disabled"],H2={class:"thumb-note"},W2={key:0,class:"row"},z2={class:"row"},q2={class:"row"},K2={class:"sequence-note"},Z2={class:"resource-weight-row"},J2=["disabled","title"],Q2={key:0,viewBox:"0 0 24 24","aria-hidden":"true"},eI={key:1,viewBox:"0 0 24 24","aria-hidden":"true"},tI=Ws({__name:"ImageResourceCard",props:{resource:{},resourceCount:{},defaultFile:{},namePlaceholder:{default:"particle"},showFolder:{type:Boolean,default:!0},supportsSequence:{type:Boolean,default:!1}},emits:["pick","pickSequence","reset","remove","updateWeight","toggleLock"],setup(i,{emit:e}){const t=i,s=e,n=ut(()=>{var l,c;if(t.resource.imageMode==="sequence"){const u=t.resource.sequenceFrames||[];if(!u.length)return"未选择序列帧";const f=((l=u[0])==null?void 0:l.name)||"第 1 帧",d=((c=u[u.length-1])==null?void 0:c.name)||f;return u.length===1?`1 帧 · ${f}`:`${u.length} 帧 · ${f} → ${d}`}const h=t.resource.textureName||t.defaultFile.replace(/\.[^.]+$/,"");return h.includes(".")?h:`${h}.png`}),r=ut(()=>{var h,l;return t.resource.imageMode==="sequence"?((l=(h=t.resource.sequenceFrames)==null?void 0:h[0])==null?void 0:l.previewUrl)||"":t.resource.previewUrl}),o=ut(()=>{var u,f;const h=t.resource.sequenceFrames||[];if(!h.length)return"未选择序列帧";const l=((u=h[0])==null?void 0:u.name)||"第一张图片",c=((f=h[h.length-1])==null?void 0:f.name)||"最后一张图片";return`已选择 ${h.length} 帧,按 ${l}-${c} 顺序播放`});function a(){t.supportsSequence&&t.resource.imageMode==="sequence"?s("pickSequence",t.resource.id):s("pick",t.resource.id)}return(h,l)=>(se(),ce("div",O2,[w("div",B2,[w("button",{class:"img-thumb",title:i.supportsSequence&&i.resource.imageMode==="sequence"?"选择序列帧图片":"选择本地图片",onClick:a},[r.value?(se(),ce("img",{key:0,src:r.value,alt:i.resource.textureName},null,8,D2)):(se(),ce("svg",N2,[...l[10]||(l[10]=[w("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"},null,-1),w("circle",{cx:"8.5",cy:"8.5",r:"1.6"},null,-1),w("path",{d:"M21 15l-5-5-9 9"},null,-1)])]))],8,L2),w("div",U2,[i.showFolder?(se(),ce("label",V2,[l[11]||(l[11]=w("span",null,"子文件夹",-1)),xe(w("input",{"onUpdate:modelValue":l[0]||(l[0]=c=>i.resource.textureFolder=c),type:"text",class:"inp",placeholder:"subfolder/"},null,512),[[Je,i.resource.textureFolder]])])):$e("",!0),w("label",X2,[l[12]||(l[12]=w("span",null,"名称",-1)),xe(w("input",{"onUpdate:modelValue":l[1]||(l[1]=c=>i.resource.textureName=c),type:"text",class:"inp",placeholder:i.namePlaceholder},null,8,Y2),[[Je,i.resource.textureName]])])]),w("div",$2,[w("button",{class:"mini-btn2",title:`恢复 ${i.defaultFile}`,onClick:l[2]||(l[2]=c=>h.$emit("reset",i.resource.id))},"⟳",8,G2),w("button",{class:"mini-btn2",title:"删除图片资源",disabled:i.resourceCount===1,onClick:l[3]||(l[3]=c=>h.$emit("remove",i.resource.id))},"🗑",8,j2)])]),w("div",H2,Ye(n.value),1),i.supportsSequence?(se(),ce("label",W2,[l[14]||(l[14]=w("span",null,"图片模式",-1)),xe(w("select",{"onUpdate:modelValue":l[4]||(l[4]=c=>i.resource.imageMode=c),class:"inp"},[...l[13]||(l[13]=[w("option",{value:"fixed"},"固定",-1),w("option",{value:"sequence"},"序列帧",-1)])],512),[[kt,i.resource.imageMode]])])):$e("",!0),i.supportsSequence&&i.resource.imageMode==="sequence"?(se(),ce(qe,{key:1},[w("label",z2,[l[16]||(l[16]=w("span",null,"播放模式",-1)),xe(w("select",{"onUpdate:modelValue":l[5]||(l[5]=c=>i.resource.sequencePlayback=c),class:"inp"},[...l[15]||(l[15]=[w("option",{value:"once-hide"},"单次-尾帧消失",-1),w("option",{value:"once-hold"},"单次-尾帧固定",-1),w("option",{value:"loop-forward"},"正向循环",-1),w("option",{value:"loop-reverse"},"反向循环",-1)])],512),[[kt,i.resource.sequencePlayback]])]),w("label",q2,[l[17]||(l[17]=w("span",null,"播放帧率",-1)),xe(w("input",{"onUpdate:modelValue":l[6]||(l[6]=c=>i.resource.sequenceFps=c),type:"number",min:"1",max:"120",step:"1",class:"inp"},null,512),[[Je,i.resource.sequenceFps,void 0,{number:!0}]])]),w("button",{class:"sequence-pick",onClick:l[7]||(l[7]=c=>h.$emit("pickSequence",i.resource.id))},"选择序列帧(多选)"),w("div",K2,Ye(o.value),1)],64)):$e("",!0),w("div",Z2,[Ne(Ge,{class:"resource-weight-control",label:"占比%",min:0,max:100,step:1,"model-value":i.resource.weight,disabled:i.resource.locked||i.resourceCount===1,"onUpdate:modelValue":l[8]||(l[8]=c=>h.$emit("updateWeight",i.resource.id,c))},null,8,["model-value","disabled"]),w("button",{class:Ze(["weight-lock",{on:i.resource.locked}]),disabled:i.resourceCount===1,title:i.resource.locked?"解除占比锁定":"锁定当前占比",onClick:l[9]||(l[9]=c=>h.$emit("toggleLock",i.resource.id))},[i.resource.locked?(se(),ce("svg",Q2,[...l[18]||(l[18]=[w("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),w("path",{d:"M8 10V7a4 4 0 0 1 8 0v3"},null,-1)])])):(se(),ce("svg",eI,[...l[19]||(l[19]=[w("rect",{x:"5",y:"10",width:"14",height:"10",rx:"2"},null,-1),w("path",{d:"M16 10V7a4 4 0 0 0-7.5-2"},null,-1)])]))],10,J2)]),O1(h.$slots,"default",{},void 0)]))}}),mg=Ks(tI,[["__scopeId","data-v-68ff5314"]]),iI={class:"spine-editor"},sI={class:"field wide"},nI={class:"grid three"},rI={class:"field"},oI={class:"field"},aI={class:"field"},lI={class:"grid three"},hI={class:"field"},cI={class:"field"},uI={class:"field"},dI=["disabled"],fI={class:"asset-row"},pI=["title"],mI={class:"asset-row"},gI=["title"],vI={class:"asset-row"},yI=["title"],xI={class:"asset-actions"},bI=["disabled"],wI={class:"runtime-note"},_I={key:0},SI={key:0,class:"error"},TI={class:"section-box"},MI={key:0,class:"empty"},EI={key:1,class:"field wide"},AI=["value"],CI={class:"section-box"},II={class:"tree-title-row"},RI=["disabled","title"],PI={key:0,class:"empty"},kI={key:1,class:"bone-search"},FI={key:2,class:"empty"},OI={key:3,class:"bone-tree"},BI=["onClick","onKeydown"],LI=["title","onClick"],DI={key:1,class:"bone-leaf"},NI={class:"bone-name"},UI=Ws({__name:"SpineObjectPanel",props:{spineObject:{}},setup(i){const e=i,t=Aa(),s=it(null),n=it(null),r=it(null),o=it(null),a=it(new Set),h=it(""),l=it(null),c=it(null),u=it([]);e.spineObject.selectedBone==null&&(e.spineObject.selectedBone=""),e.spineObject.sourceBundle==null&&(e.spineObject.sourceBundle=null),e.spineObject.dataVersion==null&&(e.spineObject.dataVersion="");const f=ut(()=>{var L;return((L=l.value)==null?void 0:L.name)||e.spineObject.skeletonFileName}),d=ut(()=>{var L;return((L=c.value)==null?void 0:L.name)||e.spineObject.atlasFileName}),m=ut(()=>u.value.length?u.value.map(L=>L.name):e.spineObject.textureFileNames),g=ut(()=>m.value.length?`${m.value.length} 张:${m.value.join(", ")}`:"PNG / JPEG / WebP..."),b=ut(()=>new Set(e.spineObject.bones.map(L=>L.parent).filter(L=>!!L))),_=ut(()=>new Map(e.spineObject.bones.map(L=>[L.name,L]))),M=ut(()=>e.spineObject.bones.filter(L=>{var U;const P=h.value.trim().toLocaleLowerCase();if(P)return L.name.toLocaleLowerCase().includes(P);let X=L.parent;for(;X;){if(a.value.has(X))return!1;X=((U=_.value.get(X))==null?void 0:U.parent)||null}return!0})),v=ut(()=>b.value.size>0&&[...b.value].every(L=>a.value.has(L)));function S(L){const P=e.spineObject.selectedBone===L;for(const X of t.spines)X.selectedBone="";P||(e.spineObject.selectedBone=L)}function y(L){a.value.has(L)?a.value.delete(L):a.value.add(L)}function I(){a.value=v.value?new Set:new Set(b.value)}function E(L){var P;return((P=L.target.files)==null?void 0:P[0])||null}function C(L){l.value=E(L)}function R(L){c.value=E(L)}function B(L){u.value=Array.from(L.target.files||[])}function k(L){return L.name.replace(/\.[^.]+$/,"").toLocaleLowerCase()}async function F(L){const P=Array.from(L.target.files||[]);if(!P.length)return;const X=P.filter(H=>/\.(json|skel)$/i.test(H.name)),U=P.filter(H=>/\.atlas$/i.test(H.name)),Y=P.filter(H=>/\.(png|jpe?g|webp|wepb)$/i.test(H.name)),q=U.map(H=>({atlas:H,skeleton:X.find(Z=>k(Z)===k(H))})).find(H=>H.skeleton),z=(q==null?void 0:q.skeleton)||X[0]||null,ne=(q==null?void 0:q.atlas)||U[0]||null;if(l.value=z,c.value=ne,u.value=Y,!z||!ne||!Y.length){const H=[!z&&"JSON / SKEL",!ne&&"Atlas",!Y.length&&"纹理图片"].filter(Boolean).join("、");e.spineObject.status="error",e.spineObject.error=`所选文件夹缺少:${H}`;return}await j()}function D(){t.recalcTotalFrames()}function N(){D(),t.timeline.frame=0}async function j(){var X;const L=l.value,P=c.value;if(!L||!P||!u.value.length){e.spineObject.status="error",e.spineObject.error="请依次选择 Spine 数据、Atlas 和全部纹理图片";return}e.spineObject.status="loading",e.spineObject.error="";try{const U=await lx(L,P,u.value);Lh(e.spineObject.id,U),e.spineObject.skeletonFileName=L.name,e.spineObject.atlasFileName=P.name,e.spineObject.textureFileNames=u.value.map(Y=>Y.name),e.spineObject.dataVersion=U.dataVersion,e.spineObject.animations=U.animations,e.spineObject.bones=U.bones,e.spineObject.selectedBone="",h.value="",a.value=new Set,e.spineObject.selectedAnimation=((X=U.animations[0])==null?void 0:X.name)||"",e.spineObject.assetVersion++,e.spineObject.status="ready",D(),t.timeline.frame=0;try{e.spineObject.sourceBundle=await ZA(L,P,u.value)}catch(Y){e.spineObject.sourceBundle=null,console.warn("Spine 配置资源嵌入失败",Y)}}catch(U){e.spineObject.status="error",e.spineObject.error=U instanceof Error?U.message:String(U)}}function O(){Ea(e.spineObject.id),l.value=null,c.value=null,u.value=[],s.value&&(s.value.value=""),n.value&&(n.value.value=""),r.value&&(r.value.value=""),o.value&&(o.value.value=""),e.spineObject.skeletonFileName="",e.spineObject.atlasFileName="",e.spineObject.textureFileNames=[],e.spineObject.dataVersion="",e.spineObject.sourceBundle=null,e.spineObject.animations=[],e.spineObject.bones=[],e.spineObject.selectedBone="",h.value="",a.value=new Set,e.spineObject.selectedAnimation="",e.spineObject.assetVersion++,e.spineObject.status="empty",e.spineObject.error="",D()}return(L,P)=>(se(),ce("div",iI,[P[30]||(P[30]=w("div",{class:"editor-title"},"Spine 属性",-1)),w("label",sI,[P[15]||(P[15]=w("span",null,"Spine 名称",-1)),xe(w("input",{"onUpdate:modelValue":P[0]||(P[0]=X=>i.spineObject.name=X)},null,512),[[Je,i.spineObject.name]])]),w("div",nI,[w("label",rI,[P[16]||(P[16]=w("span",null,"X 位置",-1)),xe(w("input",{"onUpdate:modelValue":P[1]||(P[1]=X=>i.spineObject.x=X),type:"number"},null,512),[[Je,i.spineObject.x,void 0,{number:!0}]])]),w("label",oI,[P[17]||(P[17]=w("span",null,"Y 位置",-1)),xe(w("input",{"onUpdate:modelValue":P[2]||(P[2]=X=>i.spineObject.y=X),type:"number"},null,512),[[Je,i.spineObject.y,void 0,{number:!0}]])]),w("label",aI,[P[18]||(P[18]=w("span",null,"旋转",-1)),xe(w("input",{"onUpdate:modelValue":P[3]||(P[3]=X=>i.spineObject.rotation=X),type:"number"},null,512),[[Je,i.spineObject.rotation,void 0,{number:!0}]])])]),w("div",lI,[w("label",hI,[P[19]||(P[19]=w("span",null,"Scale X",-1)),xe(w("input",{"onUpdate:modelValue":P[4]||(P[4]=X=>i.spineObject.scaleX=X),type:"number",step:"0.05"},null,512),[[Je,i.spineObject.scaleX,void 0,{number:!0}]])]),w("label",cI,[P[20]||(P[20]=w("span",null,"Scale Y",-1)),xe(w("input",{"onUpdate:modelValue":P[5]||(P[5]=X=>i.spineObject.scaleY=X),type:"number",step:"0.05"},null,512),[[Je,i.spineObject.scaleY,void 0,{number:!0}]])]),w("label",uI,[P[21]||(P[21]=w("span",null,"开始时间",-1)),xe(w("input",{"onUpdate:modelValue":P[6]||(P[6]=X=>i.spineObject.timeOffset=X),type:"number",min:"0",step:"0.033333",onChange:D},null,544),[[Je,i.spineObject.timeOffset,void 0,{number:!0}]])])]),P[31]||(P[31]=w("div",{class:"divider"},null,-1)),P[32]||(P[32]=w("div",{class:"section-title"},"Spine 资源",-1)),w("input",{ref_key:"skeletonInput",ref:s,hidden:"",type:"file",accept:".json,.skel,application/json,application/octet-stream",onChange:C},null,544),w("input",{ref_key:"atlasInput",ref:n,hidden:"",type:"file",accept:".atlas,text/plain",onChange:R},null,544),w("input",{ref_key:"textureInput",ref:r,hidden:"",type:"file",multiple:"",accept:".png,.jpg,.jpeg,.webp,.wepb,image/png,image/jpeg,image/webp",onChange:B},null,544),w("input",{ref_key:"folderInput",ref:o,hidden:"",type:"file",multiple:"",webkitdirectory:"",directory:"",onChange:F},null,544),w("button",{class:"folder-select",disabled:i.spineObject.status==="loading",onClick:P[7]||(P[7]=X=>{var U;return(U=o.value)==null?void 0:U.click()})},"选择文件夹并加载",8,dI),P[33]||(P[33]=w("div",{class:"folder-hint"},"一次读取文件夹中的 JSON / SKEL、Atlas 和全部纹理;仍可在下方单独替换资源。",-1)),w("div",fI,[w("div",{class:"asset-name",title:f.value},Ye(f.value||"JSON / SKEL..."),9,pI),w("button",{onClick:P[8]||(P[8]=X=>{var U;return(U=s.value)==null?void 0:U.click()})},"选择")]),w("div",mI,[w("div",{class:"asset-name",title:d.value},Ye(d.value||"Atlas..."),9,gI),w("button",{onClick:P[9]||(P[9]=X=>{var U;return(U=n.value)==null?void 0:U.click()})},"选择")]),w("div",vI,[w("div",{class:"asset-name",title:m.value.join(", ")},Ye(g.value),9,yI),w("button",{onClick:P[10]||(P[10]=X=>{var U;return(U=r.value)==null?void 0:U.click()})},"选择(多选)")]),w("div",xI,[w("button",{class:"load",disabled:i.spineObject.status==="loading",onClick:j},Ye(i.spineObject.status==="loading"?"加载中…":"↧ 加载"),9,bI),w("button",{class:"clear",onClick:O},"清除")]),w("div",wI,[P[22]||(P[22]=Yt(" 支持 Spine 3.8 / 4.0 / 4.1 / 4.2 JSON · 4.2.119 预览运行时 · 本地离线 ",-1)),i.spineObject.dataVersion?(se(),ce("span",_I," · 当前资源 "+Ye(i.spineObject.dataVersion),1)):$e("",!0)]),i.spineObject.error?(se(),ce("div",SI,Ye(i.spineObject.error),1)):$e("",!0),w("div",TI,[P[25]||(P[25]=w("div",{class:"section-title"},"Spine 动画",-1)),i.spineObject.animations.length?(se(),ce("label",EI,[P[24]||(P[24]=w("span",null,"时间轴播放动画",-1)),xe(w("select",{"onUpdate:modelValue":P[11]||(P[11]=X=>i.spineObject.selectedAnimation=X),onChange:N},[P[23]||(P[23]=w("option",{value:""},"无",-1)),(se(!0),ce(qe,null,Ht(i.spineObject.animations,X=>(se(),ce("option",{key:X.name,value:X.name},Ye(X.name)+"("+Ye(X.duration.toFixed(2))+"s) ",9,AI))),128))],544),[[kt,i.spineObject.selectedAnimation]])])):(se(),ce("div",MI,"无可用动画"))]),w("div",CI,[w("div",II,[P[29]||(P[29]=w("div",{class:"section-title"},"层级树",-1)),w("button",{class:Ze(["selected-bone",{active:i.spineObject.selectedBone}]),disabled:!i.spineObject.selectedBone,title:i.spineObject.selectedBone?"点击清除骨骼选择":"当前未选择骨骼",onClick:P[12]||(P[12]=X=>i.spineObject.selectedBone="")},[i.spineObject.selectedBone?(se(),ce(qe,{key:0},[P[26]||(P[26]=Yt("清除选中骨骼:",-1)),w("strong",null,Ye(i.spineObject.selectedBone),1)],64)):(se(),ce(qe,{key:1},[P[27]||(P[27]=Yt("当前骨骼:",-1)),P[28]||(P[28]=w("strong",null,"未选择",-1))],64))],10,RI),i.spineObject.bones.length?(se(),ce("button",{key:0,class:"tree-action",onClick:I},Ye(v.value?"全部展开":"全部折叠"),1)):$e("",!0)]),i.spineObject.bones.length?(se(),ce("div",kI,[xe(w("input",{"onUpdate:modelValue":P[13]||(P[13]=X=>h.value=X),type:"search","aria-label":"搜索骨骼",placeholder:"搜索骨骼名称…"},null,512),[[Je,h.value,void 0,{trim:!0}]]),h.value?(se(),ce("button",{key:0,title:"清空搜索","aria-label":"清空骨骼搜索",onClick:P[14]||(P[14]=X=>h.value="")},"✕")):$e("",!0)])):(se(),ce("div",PI,"未加载 Spine")),i.spineObject.bones.length&&!M.value.length?(se(),ce("div",FI,"未找到匹配的骨骼")):i.spineObject.bones.length?(se(),ce("div",OI,[(se(!0),ce(qe,null,Ht(M.value,X=>(se(),ce("div",{key:X.name,class:Ze(["bone",{selected:i.spineObject.selectedBone===X.name}]),style:Pi({paddingLeft:`${6+X.depth*16}px`}),role:"button",tabindex:"0",onClick:U=>S(X.name),onKeydown:da(xt(U=>S(X.name),["prevent"]),["enter"])},[b.value.has(X.name)?(se(),ce("button",{key:0,class:"bone-toggle",title:a.value.has(X.name)?"展开子骨骼":"折叠子骨骼",onClick:xt(U=>y(X.name),["stop"])},Ye(a.value.has(X.name)?"▸":"▾"),9,LI)):(se(),ce("span",DI,"•")),w("span",NI,Ye(X.name),1)],46,BI))),128))])):$e("",!0)])]))}}),VI=Ks(UI,[["__scopeId","data-v-af64e8e8"]]),XI="3.8";function Wi(i,e,t){i[e]==null&&i[t]!=null&&(i[e]=i[t]),delete i[t]}function Pd(i){if(!i||typeof i!="object")return;if(Array.isArray(i)){for(const t of i)Pd(t);return}const e=i;Array.isArray(e.curve)&&delete e.curve;for(const t of Object.values(e))Pd(t)}function YI(i){for(const e of i.bones)Wi(e,"transform","inherit");for(const e of i.transform||[])Wi(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),e.scaleMix==null&&(e.scaleMix=e.mixScaleX??e.mixScaleY),Wi(e,"shearMix","mixShearY"),delete e.mixX,delete e.mixY,delete e.mixScaleX,delete e.mixScaleY;for(const e of i.path||[])Wi(e,"rotateMix","mixRotate"),e.translateMix==null&&(e.translateMix=e.mixX??e.mixY),delete e.mixX,delete e.mixY;for(const e of i.skins)for(const t of Object.values(e.attachments||{}))for(const s of Object.values(t||{}))s.parent!=null&&Wi(s,"deform","timelines")}function $I(i){for(const e of Object.values(i.slots||{}))Wi(e,"color","rgba"),Wi(e,"twoColor","rgba2")}function GI(i){for(const e of Object.values(i.bones||{}))for(const t of e.rotate||[])Wi(t,"angle","value")}function jI(i){for(const e of Object.values(i.transform||{}))for(const t of e)Wi(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),t.scaleMix==null&&(t.scaleMix=t.mixScaleX??t.mixScaleY),Wi(t,"shearMix","mixShearY"),delete t.mixX,delete t.mixY,delete t.mixScaleX,delete t.mixScaleY}function HI(i){for(const e of Object.values(i.path||{})){for(const t of["position","spacing"])for(const s of e[t]||[])Wi(s,t,"value");for(const t of e.mix||[])Wi(t,"rotateMix","mixRotate"),t.translateMix==null&&(t.translateMix=t.mixX??t.mixY),delete t.mixX,delete t.mixY}}function WI(i){if(!i.attachments)return;const e=i.deform||(i.deform={});for(const[t,s]of Object.entries(i.attachments)){const n=e[t]||(e[t]={});for(const[r,o]of Object.entries(s)){const a=n[r]||(n[r]={});for(const[h,l]of Object.entries(o))l.deform&&(a[h]=l.deform)}}delete i.attachments}function zI(i){i.skeleton.spine=XI,YI(i);for(const e of Object.values(i.animations))$I(e),GI(e),jI(e),HI(e),WI(e);return Pd(i.animations),i}function qI(i,e,t,s){const n=t.frame-e.frame,r=n<=0?0:(i.frame-e.frame)/n;let o=0;for(let a=0;a[...s].sort((o,a)=>o-a);let r=!0;for(;r;){r=!1;const o=n();for(let a=0;au&&(u=d,c=f)}c>=0&&(s.add(c),r=!0)}}return n().map(o=>i[o])}function gg(i,e,t,s,n){const r=t-e+1;if(r<2)return 0;const o=n?e:t,a=n?e+1:t-1,h=n?e+2:t-2,l=Math.abs(i[a].frame-i[o].frame);if(r>=3&&l>0&&Math.abs(Math.abs(i[h].frame-i[a].frame)-l)<1e-6){const u=i[o].values[s],f=i[a].values[s],d=i[h].values[s];return n?(-3*u+4*f-d)/(2*l):(3*u-4*f+d)/(2*l)}const c=i[a].frame-i[o].frame;return c?(i[a].values[s]-i[o].values[s])/c:0}function vg(i,e,t){const s=i[t].frame-i[e].frame,n=[];for(let r=0;rf.values[r])),l=Math.max(...i.slice(e,t+1).map(f=>f.values[r])),c=o+gg(i,e,t,r,!0)*s/3,u=a-gg(i,e,t,r,!1)*s/3;n.push([Math.max(h,Math.min(l,c)),Math.max(h,Math.min(l,u))])}return{values:n}}function KI(i,e,t,s,n){const r=1-n;return r*r*r*i+3*r*r*n*e+3*r*n*n*t+n*n*n*s}function ZI(i,e,t,s,n){const r=t.frame-e.frame,o=r<=0?0:(i.frame-e.frame)/r;let a=0;for(let h=0;h[...s].sort((a,h)=>a-h);let r=!0;for(;r;){r=!1;const a=n();for(let h=0;hd&&(d=g,f=m)}f>=0&&(s.add(f),r=!0)}}const o=n();return{samples:o.map(a=>i[a]),controls:o.slice(0,-1).map((a,h)=>vg(i,a,o[h+1]))}}function JI(i){if(!i.length)return[];const e=[i[0]];for(let t=1;t180;)s-=360;for(;s-e[t-1]<-180;)s+=360;e.push(s)}return e}function Zt(i){if(!Number.isFinite(i))return 0;const e=Math.round(i*1e5)/1e5;return Object.is(e,-0)?0:e}function QI(i,e,t,s){const n=Math.max(2,Math.min(16,Math.round(Number(i.trailGridRows)||2))),r=Math.max(2,Math.min(32,Math.round(Number(i.trailGridCols)||2))),o=Math.max(2,t.length),a=e.lengthMode==="random"?Math.max(1,Number(e.lengthMin)||0,Number(e.lengthMax)||0):Math.max(.001,Number(e.length)||100),h=e.widthSizeMode==="random"?Math.max(1,Number(e.widthMin)||0,Number(e.widthMax)||0):Math.max(.001,Number(e.width)||100),l=(Number(e.rotation)||0)*Math.PI/180,c=Math.cos(l),u=Math.sin(l),f=[],d=[],m=[],g=[],b=[];for(let v=0;v=0;v--)b.push({col:v,row:n-1});for(let v=n-2;v>=1;v--)b.push({col:0,row:v});const _=b.length;for(let v=1;v|\s]+/g,"_").replace(/^_+|_+$/g,"")||e}function bx(i,e){let t=i,s=2;for(;e.has(t);)t=`${i}_${s++}`;return e.add(t),t}function tR(i){return i.replace(/\.[^./\\]+$/,"")}function wx(i,e){return tR([i,e].filter(Boolean).join("/").replace(/\\/g,"/").replace(/\/{2,}/g,"/").replace(/^\.\//,""))}function iR(i){var s,n;const e=Number(((s=i==null?void 0:i.orig)==null?void 0:s.width)??(i==null?void 0:i.width))||0,t=Number(((n=i==null?void 0:i.orig)==null?void 0:n.height)??(i==null?void 0:i.height))||0;return{width:e,height:t}}function hl(i){return Math.round(Math.max(0,Math.min(1,i))*255).toString(16).padStart(2,"0")}function _g(i,e){return[(i>>16&255)/255,(i>>8&255)/255,(i&255)/255,Math.max(0,Math.min(1,e))]}function na(i,e){return Zt(i/e)}function sR(i,e){const t=i.config,s=t.lifeMode==="fixed"?Math.max(0,Number(t.lifeMin)||0):Math.max(0,Number(t.lifeMin)||0,Number(t.lifeMax)||0),n=Math.max(0,Number(t.delay)||0);let r;if(t.mode!=="stream")r=n+s;else if(t.streamBehavior!=="loop")r=n+Math.max(1/e,Number(t.duration)||0)+s;else{const o=Math.max(1,Math.ceil(Number(t.loopDurationFrames)||1))/e;t.generateLoopEndAnimation?r=n+s+1/e:t.generateLoopStartAnimation?r=n+o*Math.max(1,Math.ceil(s/o)):r=n+o}return Math.max(1,Math.ceil(r*e)+1)}function oh(i,e){return e?i.boneName:`${i.spawnId??"legacy"}_${i.boneName}`}function nR(i,e,t){const s=new Set;for(const n of i)for(const r of n)s.add(oh(r,e));return[...s].sort().map((n,r)=>({key:n,name:bx(`_particle_${String(r).padStart(3,"0")}`,t),states:i.map(o=>o.find(a=>oh(a,e)===n)||null)}))}function rR(i,e,t,s){const n=e*t/s,r=Math.min(i.states.length-1,Math.max(0,Math.floor(n))),o=Math.min(i.states.length-1,r+1),a=i.states[r],h=i.states[o];if(!a||!h||oh(a,!0)!==oh(h,!0)||a.spawnId!==h.spawnId)return a;const l=n-r;if(l<=1e-6)return a;const c=(f,d)=>(f??0)+((d??f??0)-(f??0))*l,u=a.trailState&&h.trailState&&a.trailState.resourceId===h.trailState.resourceId?{...a.trailState,width:c(a.trailState.width,h.trailState.width),alpha:c(a.trailState.alpha,h.trailState.alpha),bones:a.trailState.bones.map((f,d)=>{const m=h.trailState.bones[d]||f;return{...f,worldX:c(f.worldX??f.x,m.worldX??m.x),worldY:c(f.worldY??f.y,m.worldY??m.y),worldRotation:c(f.worldRotation??-f.rotation,m.worldRotation??-m.rotation)}})}:a.trailState;return{...a,worldX:c(a.worldX,h.worldX),worldY:c(a.worldY,h.worldY),worldRotation:c(a.worldRotation,h.worldRotation),worldScaleX:c(a.worldScaleX,h.worldScaleX),worldScaleY:c(a.worldScaleY,h.worldScaleY),alpha:c(a.alpha,h.alpha),trailState:u}}function Sg(i,e){return!i||i==="跟随导出"?e.keyframeCurve:i==="贝塞尔"?"bezier":"linear"}function $r(i,e,t,s,n,r=new Set,o=n.keyframeCurve){if(!i.length)return[];const a=o==="bezier"&&n.spineVersion!=="3.8"?xx(i,s,r):{samples:yx(i,s,r),controls:[]},h=a.samples.map(l=>{const c={time:na(l.frame,e)};return t.forEach((u,f)=>{c[u]=Zt(l.values[f])}),c});for(let l=0;l0&&n&&e.add(t-1),s&&e.add(t))}return e}function aR(i){const e=new Set;for(let t=0;t0&&n&&e.add(t-1),s&&e.add(t))}return e}function lR(i,e){var s;if(!i.shapeEnabled||!((s=i.shapeCurve)!=null&&s.length))return 1;const t=[...i.shapeCurve].sort((n,r)=>n.x-r.x);if(e<=t[0].x)return Math.max(0,t[0].y);for(let n=1;n{r!==n&&(s.push(t(r,o)),n=r)}),s}function cR(i,e,t){const s=i.imageMode==="sequence"?i.sequenceFrames[e]:void 0,n=(s==null?void 0:s.name)||i.textureName||`image_${i.id}`,r=(s==null?void 0:s.texture)||i.texture,o=iR(r);(!o.width||!o.height)&&t.push({code:"missing-image",message:`图片“${n}”缺失或尺寸不可读,已保留路径。`});const a=o.width||1,h=o.height||1;return{path:wx(i.textureFolder,n),x:Zt((.5-i.anchorX)*a),y:Zt((i.anchorY-.5)*h),width:Zt(a),height:Zt(h)}}function uR(i,e,t,s,n=s.keyframeCurve){if(!i.length)return[];const r=new Set;for(let c=1;c({frame:u,values:c})),a=1/255,h=n==="bezier"&&s.spineVersion!=="3.8"?xx(o,[a,a,a,.01],r):{samples:yx(o,[a,a,a,.01],r),controls:[]},l=h.samples.map(c=>({time:na(c.frame,t),color:`${hl(c.values[0])}${hl(c.values[1])}${hl(c.values[2])}${hl(c.values[3])}`}));if(h.controls.length)for(let c=0;c({time:na(f,n),name:u??null}));h.length&&(a.attachment=h);const l=uR(s,t,n,r,o);l.length&&(a.rgba=l)}function dR(i){var m;const e=i.settings,t=Math.max(1,Number(i.timeline.fps)||30),s=Math.max(1,Math.round(e.fps||30)),n=e.integerFrameAlignment?s:t,r=[],o=i.systems.filter(g=>g.visible!==!1),a={skeleton:{hash:"",spine:e.spineVersion,x:0,y:0,width:0,height:0,images:e.imagesPath||"./images/"},bones:[{name:"root"}],slots:[],skins:[{name:"default",attachments:{}}],animations:{}};e.omitFps||(a.skeleton.fps=s);const h=a.skins[0].attachments,l=new Set(["root"]),c=[...new Set([...i.timeline.animations.length?i.timeline.animations:["animation"],...o.map(g=>g.animation||"animation")])],u=new Map;for(const g of o){const b=Math.min(((m=g.frames)==null?void 0:m.length)||0,sR(g,t)),_=(g.frames||[]).slice(0,b);_.length||r.push({code:"empty-cache",message:`“${g.config.name}”没有可用帧缓存。`});const M=bx(eR(g.config.name,`system_${g.id}`),l);a.bones.push({name:M,parent:"root"});const v=nR(_,e.bonePool,l),S=Math.max(0,(b-1)/t),y=Math.max(1,Math.ceil(S*n)+1),I=u.get(g.animation)||[];I.push({system:g,tracks:v,targetFrames:y}),u.set(g.animation,I);for(const E of v){a.bones.push({name:E.name,parent:M});const C=new Set(g.config.imageResources.map(F=>F.blend));for(const F of C){const D=`${E.name}_image_${F}`;a.slots.push({name:D,bone:E.name,color:"ffffff00",blend:yg[F]});const N=h[D]||(h[D]={});for(const j of g.config.imageResources.filter(O=>O.blend===F)){const O=j.imageMode==="sequence"?Math.max(1,j.sequenceFrames.length):1;for(let L=0;L{var X;return((X=P==null?void 0:P.trailState)==null?void 0:X.resourceId)===F.id}))continue;const D=Math.max(2,Math.min(16,Math.round(F.boneCount||3))),N=[];for(let P=0;Pa.bones.findIndex(X=>X.name===P)),L=wx("",F.textureName||`trail_${F.id}`);(h[j]||(h[j]={}))[`trail_${F.id}`]=QI(g.config,F,O,L),F.texture||r.push({code:"missing-image",message:`拖尾图片“${F.textureName||F.id}”缺失,已保留路径。`})}const R=`${E.name}_image_`,B=`${E.name}_trail_`,k=a.slots.filter(F=>String(F.name).startsWith(R)||String(F.name).startsWith(B));k.length&&(a.slots=a.slots.filter(F=>!k.includes(F)),a.slots.push(...k.filter(F=>String(F.name).startsWith(B)),...k.filter(F=>String(F.name).startsWith(R))))}}for(const g of c){const b=u.get(g)||[],_={bones:{},slots:{}};let M=!1;for(const{system:v,tracks:S,targetFrames:y}of b)for(const I of S){const E=Array.from({length:y},(U,Y)=>rR(I,Y,t,n)),C=E.map(U=>!!(U!=null&&U.active)),R=[],B=[],k=[];E.forEach((U,Y)=>{U!=null&&U.active&&(R.push({frame:Y,values:[U.worldX??U.x,U.worldY??U.y]}),B.push(U.worldRotation??U.rotation),k.push({frame:Y,values:[U.worldScaleX??U.scaleX,U.worldScaleY??U.scaleY]}))});const F=JI(B),D=R.map((U,Y)=>({frame:U.frame,values:[F[Y]??0]})),N=oR(E),j={},O=$r(R,n,["x","y"],[xg,xg],e,N),L=$r(D,n,["value"],[wg],e,N),P=$r(k,n,["x","y"],[ll,ll],e,N);O.length&&(j.translate=O),L.length&&(j.rotate=L),P.length&&(j.scale=P),Object.keys(j).length&&(_.bones[I.name]=j,M=!0);const X=new Set(v.config.imageResources.map(U=>U.blend));for(const U of X){const Y=[],q=[];let z=16777215;for(let ae=0;aeve.id===me.resourceId):void 0,te=!!me&&C[ae]&&me.imageVisible!==!1&&(_e==null?void 0:_e.blend)===U;me&&(_e==null?void 0:_e.blend)===U&&(z=me.colorHex),Y.push(te?`image_${_e.id}_${me.imageFrameIndex??0}`:null),q.push(_g(z,te?me.alpha:0))}const H=v.config.imageResources.filter(ae=>ae.blend===U).filter(ae=>ae.independentAlpha==="curve").map(ae=>Sg(ae.alphaCurveMode,e)),Z=H.length?H.includes("bezier")?"bezier":"linear":Sg(v.config.alphaMode==="curve"?v.config.curveMode:void 0,e);Tg(_,`${I.name}_image_${U}`,Y,q,n,e,Z),Y.some(Boolean)&&(M=!0)}if(v.config.trail)for(const U of v.config.trailResources){const Y=Math.max(2,Math.min(16,Math.round(U.boneCount||3))),q=E.map(ve=>{var $;return(($=ve==null?void 0:ve.trailState)==null?void 0:$.resourceId)===U.id?ve.trailState:void 0}),z=q.find(ve=>!!ve);if(!z)continue;const ne=aR(q),H=U.widthSizeMode==="random"?Math.max(1,Number(U.widthMin)||0,Number(U.widthMax)||0):Math.max(.001,Number(U.width)||100);let Z=z;const ae=q.map(ve=>(ve&&(Z=ve),Z));for(let ve=0;ve{const Be=De==null?void 0:De.bones[Math.min(De.bones.length-1,ve)];if(!Be)return;const Ke={x:Be.worldX??Be.x,y:Be.worldY??Be.y,rotation:Be.worldRotation??-Be.rotation};$.push({frame:Ie,values:[Ke.x,Ke.y]}),W.push({frame:Ie,values:[Ke.rotation]}),J.push({frame:Ie,values:[1,Math.max(0,De.width/H)*ie]})});const ue=`${I.name}_trail_${U.id}_${ve}`,Se={},Me=$r($,n,["x","y"],[bg,bg],e,Q),Ee=$r(W,n,["value"],[wg],e,Q),de=$r(J,n,["x","y"],[ll,ll],e,Q);Me.length&&(Se.translate=Me),Ee.length&&(Se.rotate=Ee),de.length&&(Se.scale=de),Object.keys(Se).length&&(_.bones[ue]=Se)}const me=q.map(()=>`trail_${U.id}`);let _e=z.colorHex;const te=q.map(ve=>(ve&&(_e=ve.colorHex),_g(_e,ve?ve.alpha:0)));Tg(_,`${I.name}_trail_${U.id}`,me,te,n,e),M=!0}}(M||!e.excludeEmptyAnimations)&&(a.animations[g]=_)}!Object.keys(a.animations).length&&!e.excludeEmptyAnimations&&(a.animations.animation={bones:{},slots:{}});const f=e.spineVersion==="3.8"?zI(a):a,d=JSON.stringify(f,null,2);return{json:f,text:d,warnings:r,particleSystemCount:o.length,animationCount:Object.keys(f.animations).length,boneCount:f.bones.length}}function fR(i,e){const t=new Blob([i.text],{type:"application/json;charset=utf-8"}),s=URL.createObjectURL(t),n=document.createElement("a");n.href=s,n.download=/\.json$/i.test(e)?e:`${e||"SpineParticle"}.json`,n.style.display="none",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(s),1e3)}class pR{newRegionAttachment(e,t,s,n){return new yo(t,s)}newMeshAttachment(e,t,s,n){return new Zn(t,s)}newBoundingBoxAttachment(e,t){return new Dh(t)}newPathAttachment(e,t){return new Er(t)}newPointAttachment(e,t){return new Nh(t)}newClippingAttachment(e,t){return new zn(t)}}const mR=new Set(["normal","onlyTranslation","noRotationOrReflection","noScale","noScaleOrReflection"]);function gR(i,e,t){const s=i.uvs,n=i.vertices,r=i.triangles;if(!Array.isArray(s)||!s.length||s.length%2)throw new Error(`拖尾网格“${e}”的 UV 数据无效`);if(!Array.isArray(n)||!n.length)throw new Error(`拖尾网格“${e}”缺少顶点数据`);const o=s.length/2;if(!Array.isArray(r)||r.some(c=>!Number.isInteger(c)||c<0||c>=o))throw new Error(`拖尾网格“${e}”的三角形索引越界`);const a=Number(i.hull)||0;if(!Number.isInteger(a)||a<0||a>o)throw new Error(`拖尾网格“${e}”的外轮廓数量无效`);if(Array.isArray(i.edges)&&i.edges.some(c=>!Number.isInteger(c)||c<0||c>=o*2||c%2))throw new Error(`拖尾网格“${e}”的外轮廓边索引越界`);if(n.length===s.length)return;let h=0,l=0;for(;h=t)throw new Error(`拖尾网格“${e}”引用了不存在的骨骼`);if(![m,g,b].every(Number.isFinite)||b<0)throw new Error(`拖尾网格“${e}”包含无效权重数据`);u+=b}if(Math.abs(u-1)>.001)throw new Error(`拖尾网格“${e}”的顶点权重之和不为 1`);l++}if(h!==n.length||l!==o)throw new Error(`拖尾网格“${e}”的顶点数量与 UV 不一致`)}function vR(i,e){var r,o,a,h;const t=Array.isArray(i.bones)?i.bones:[],s=new Map(t.map(l=>[String(l.name||""),l])),n=new Set;for(const l of t){if(l.inherit!=null&&!mR.has(l.inherit))throw new Error(`骨骼“${l.name||""}”的 inherit 值“${l.inherit}”不符合 Spine ${e} JSON 格式`);if(/_particle_\d+_trail_/.test(String(l.name||""))){const c=s.get(String(l.parent||""));if(!c||/_particle_\d+_trail_/.test(String(c.name||"")))throw new Error(`拖尾骨骼“${l.name||""}”必须直接挂在粒子系统骨骼下,不能组成骨骼链`)}}for(const l of Array.isArray(i.skins)?i.skins:[]){const c=(l==null?void 0:l.attachments)||{};for(const u of Object.keys(c))for(const f of Object.keys(c[u]||{})){const d=c[u][f];(d==null?void 0:d.type)==="mesh"&&(gR(d,f,t.length),((r=d.vertices)==null?void 0:r.length)!==((o=d.uvs)==null?void 0:o.length)&&n.add(u))}}for(const l of Object.values(i.animations||{}))for(const c of n){const u=(h=(a=l==null?void 0:l.slots)==null?void 0:a[c])==null?void 0:h.attachment;if(Array.isArray(u)&&u.some(f=>!(f!=null&&f.name)))throw new Error(`加权拖尾插槽“${c}”不能使用空附件,未出现或死亡阶段应将对应骨骼缩放设为 0`)}}function yR(i){var e;if(String(((e=i==null?void 0:i.skeleton)==null?void 0:e.spine)||"")!=="3.8")throw new Error("Spine 3.8 导出的版本标识必须为 3.8");for(const t of i.bones||[])if(t.inherit!=null)throw new Error(`Spine 3.8 骨骼“${t.name||""}”应使用 transform,不能使用 inherit`);for(const t of Object.values(i.animations||{})){for(const n of Object.values(t.slots||{})){if(n.rgba||n.rgba2)throw new Error("Spine 3.8 插槽颜色时间轴必须使用 color / twoColor");for(const r of n.attachment||[])if(!Object.prototype.hasOwnProperty.call(r,"name"))throw new Error("Spine 3.8 附件时间轴的隐藏帧必须显式写入 name: null")}for(const n of Object.values(t.bones||{}))for(const r of n.rotate||[])if(r.value!=null||r.angle==null)throw new Error("Spine 3.8 旋转时间轴必须使用 angle");const s=[t];for(;s.length;){const n=s.pop();if(!(!n||typeof n!="object")){if(!Array.isArray(n)&&Array.isArray(n.curve))throw new Error("Spine 3.8 不支持 4.x 数组曲线格式");s.push(...Object.values(n))}}}}function xR(i,e){var a;const t=JSON.parse(i),s=Wl((a=t==null?void 0:t.skeleton)==null?void 0:a.spine);if(!s)throw new Error(`导出版本不受支持,仅支持 Spine ${Sd()}`);if(e&&s!==e)throw new Error(`导出版本不一致:设置为 Spine ${e},JSON 标记为 Spine ${s}`);vR(t,s),s==="3.8"&&yR(t);const n=s==="3.8"?ax(JSON.parse(JSON.stringify(t))):t,o=new ih(new pR).readSkeletonData(n);if(!o.bones.length)throw new Error("导出结果缺少骨骼");return{version:s,bones:o.bones.length,slots:o.slots.length,animations:o.animations.length}}const bR={class:"panel"},wR={class:"panel-scroll"},_R={class:"group config-management"},SR={class:"caret"},TR={class:"group-body config-management-body"},MR={class:"config-toolbar"},ER=["disabled"],AR={value:""},CR=["value"],IR={class:"group"},RR={class:"caret"},PR={class:"scene-actions"},kR=["disabled"],FR={class:"group-body"},OR={class:"tree scene-tree"},BR=["onClick"],LR={class:"tlabel"},DR=["title","aria-label","onClick"],NR={viewBox:"0 0 24 24","aria-hidden":"true"},UR={key:0,class:"eye-slash",d:"M4 4l16 16"},VR=["onClick"],XR=["onClick"],YR={class:"tlabel"},$R=["title","aria-label","onClick"],GR={viewBox:"0 0 24 24","aria-hidden":"true"},jR={key:0,class:"eye-slash",d:"M4 4l16 16"},HR=["onClick"],WR=["onClick"],zR={class:"tlabel"},qR=["title","aria-label","onClick"],KR={viewBox:"0 0 24 24","aria-hidden":"true"},ZR={key:0,class:"eye-slash",d:"M4 4l16 16"},JR=["onClick"],QR=["onClick"],eP={class:"tlabel"},tP=["title","aria-label","onClick"],iP={viewBox:"0 0 24 24","aria-hidden":"true"},sP={key:0,class:"eye-slash",d:"M4 4l16 16"},nP=["onClick"],rP={key:0,class:"empty"},oP={class:"row"},aP={class:"seed-row scene-seed"},lP={class:"field-block"},hP={class:"field-block"},cP={class:"tag-editor"},uP=["onClick"],dP={class:"field-grid"},fP={class:"field-block"},pP={class:"field-block check-field"},mP={class:"field-grid"},gP={class:"compact-field"},vP={class:"compact-field"},yP={class:"field-grid"},xP={class:"compact-field"},bP={class:"compact-field"},wP={key:1,class:"field-grid"},_P={class:"compact-field"},SP={class:"compact-field"},TP={key:2,class:"field-grid"},MP={class:"compact-field"},EP={class:"compact-field"},AP={class:"field-block"},CP={key:4,class:"field-grid"},IP={class:"compact-field"},RP={class:"compact-field"},PP={class:"collider-follow-section"},kP={class:"follow-path"},FP={class:"field-block"},OP=["value"],BP={class:"field-grid"},LP={class:"compact-field"},DP={class:"compact-field"},NP={class:"follow-path"},UP={class:"field-block"},VP={class:"field-grid"},XP={class:"compact-field"},YP={class:"compact-field"},$P={class:"field-grid"},GP={class:"compact-field"},jP={class:"compact-field"},HP={class:"setting-line"},WP={class:"setting-line"},zP={class:"field-block"},qP={key:4,class:"panel-hint"},KP={class:"group"},ZP={class:"caret"},JP={class:"group-body"},QP={class:"segs"},ek={class:"segs stream-behavior-segs"},tk={key:2,class:"stream-loop-options"},ik={class:"switch-row"},sk=["checked"],nk={class:"switch-row"},rk=["checked"],ok={key:3,class:"modifier-hint stream-loop-hint"},ak={class:"group"},lk={class:"caret"},hk={class:"group-body"},ck={class:"row"},uk={class:"group"},dk={class:"caret"},fk={class:"group-body attr-body"},pk={class:"attr-axis-head"},mk={class:"axis-modes"},gk={class:"life-item"},vk={class:"switch-row"},yk={class:"life-item"},xk={class:"switch-row"},bk={class:"axis-modes life-axis"},wk={class:"life-item"},_k={class:"switch-row"},Sk={class:"group"},Tk={class:"caret"},Mk={class:"group-body"},Ek={class:"seg"},Ak={class:"row"},Ck={class:"curve-wrap"},Ik={class:"row"},Rk=["onUpdate:modelValue"],Pk=["onUpdate:modelValue"],kk={class:"row resource-color-row"},Fk=["onUpdate:modelValue"],Ok=["onUpdate:modelValue"],Bk={key:0,class:"row resource-color-picker"},Lk=["onUpdate:modelValue"],Dk=["value","onChange","onKeydown"],Nk={class:"resource-alpha-head"},Uk={class:"alpha-modes"},Vk=["onClick"],Xk=["onClick"],Yk=["onClick"],$k={class:"row"},Gk=["onUpdate:modelValue"],jk={class:"resource-alpha-curve"},Hk={class:"group"},Wk={class:"caret"},zk={class:"group-body"},qk={class:"modifier-item"},Kk={class:"switch-row modifier-switch"},Zk={key:0,class:"modifier-params"},Jk={class:"modifier-item"},Qk={class:"switch-row modifier-switch"},eF={key:0,class:"modifier-params gravity-params"},tF={class:"modifier-mode-row"},iF={class:"modifier-item"},sF={class:"switch-row modifier-switch"},nF={key:0,class:"modifier-params gravity-params"},rF={class:"modifier-mode-row"},oF={class:"modifier-item"},aF={class:"switch-row modifier-switch"},lF={key:0,class:"modifier-params"},hF={class:"row"},cF={class:"modifier-item"},uF={class:"switch-row modifier-switch"},dF={key:0,class:"modifier-params"},fF={class:"row"},pF={class:"row"},mF={class:"modifier-item"},gF={class:"switch-row modifier-switch"},vF={key:0,class:"modifier-params trail-params"},yF={class:"row"},xF=["onUpdate:modelValue"],bF={class:"row"},wF=["onUpdate:modelValue"],_F={class:"row"},SF=["onUpdate:modelValue"],TF={class:"switch-row trail-sub-switch"},MF=["onUpdate:modelValue"],EF={class:"switch-row trail-sub-switch"},AF=["onUpdate:modelValue"],CF={class:"trail-mode-head"},IF={class:"alpha-modes"},RF=["onClick"],PF=["onClick"],kF=["onClick"],FF={class:"row"},OF=["onUpdate:modelValue"],BF={key:6,class:"row trail-fixed-color"},LF=["onUpdate:modelValue"],DF=["value","onChange","onKeydown"],NF={class:"trail-mode-head"},UF={class:"alpha-modes"},VF=["onClick"],XF=["onClick"],YF=["onClick"],$F={class:"trail-grid-row"},GF={class:"modifier-item"},jF={class:"switch-row modifier-switch"},HF=["disabled"],WF={key:0,class:"modifier-params emitter-follow-params"},zF={class:"field-block"},qF=["value"],KF={key:0,value:"bone"},ZF={class:"field-block"},JF=["value"],QF={class:"field-block"},eO={class:"field-grid follow-grid"},tO={class:"compact-field"},iO={class:"compact-field"},sO={class:"field-block"},nO={key:0,class:"bone-follow-target"},rO={key:1,class:"bone-follow-missing"},oO={class:"field-block"},aO={class:"field-grid follow-grid"},lO={class:"compact-field"},hO={class:"compact-field"},cO={class:"bone-follow-transform-grid"},uO={class:"compact-field"},dO={class:"compact-field"},fO={class:"compact-field"},pO={class:"group"},mO={class:"caret"},gO={class:"group-body export-settings"},vO={class:"export-field"},yO={class:"export-field"},xO={class:"export-field"},bO={key:0,class:"export-help"},wO={class:"export-fps-row"},_O={class:"export-field export-fps-field"},SO={class:"export-checkbox"},TO={class:"export-switches"},MO={class:"switch-row export-switch"},EO={class:"switch-row export-switch"},AO={class:"switch-row export-switch export-switch-last"},CO=["disabled","title"],IO=Ws({__name:"ParticlePanel",setup(i){const e=Aa();e.settings.exportSettings=gy(e.settings.exportSettings);const t=ut(()=>e.settings.exportSettings),s=it(null),n=it(""),r=it([]),o=it(!1),a=it(""),h=it(!1),l=it(!1),c=it(""),u=it(!1);function f(T){return T==="跟随导出"?t.value.keyframeCurve==="bezier"?"bezier":"linear":T==="贝塞尔"?"bezier":"linear"}e.systems.length||e.addSystem();function d(){dx(e),h.value=!1,a.value="配置已保存到本地"}async function m(T){var V;const p=T.target,x=(V=p.files)==null?void 0:V[0];if(x){a.value="正在加载配置…",h.value=!1;try{await oC(e,x),a.value=`已加载:${x.name}`}catch(K){h.value=!0,a.value=K instanceof Error?K.message:String(K)}finally{p.value=""}}}async function g(){try{const T=await fetch(`/Preset/index.json?t=${Date.now()}`,{cache:"no-store"});if(!T.ok)throw new Error("无法读取预设列表");const p=await T.json();r.value=Array.isArray(p)?p.filter(x=>!!x&&typeof x.name=="string"&&typeof x.file=="string"):[]}catch{r.value=[]}}async function b(){const T=n.value;if(T){o.value=!0,h.value=!1,a.value="正在加载预设…";try{const p=await fetch(`/Preset/${encodeURIComponent(T)}`,{cache:"no-store"});if(!p.ok)throw new Error(`无法读取预设:${T}`);await px(e,await p.text()),a.value=`已加载预设:${T.replace(/\.json$/i,"")}`}catch(p){h.value=!0;const x=p instanceof Error?p.message:String(p);a.value=`${x},请检查预设文件命名`}finally{o.value=!1,n.value=""}}}_o(g);function _(){return new Promise(T=>requestAnimationFrame(()=>T()))}async function M(){e.timeline.playing=!1,e.timeline.frame=0,e.timeline.recorded=!1;for(const x of e.systems)x.frames=void 0;e.recalcTotalFrames(),await _(),e.timeline.playing=!0;const T=e.timeline.totalFrames/Math.max(1,e.timeline.fps)*1e3,p=performance.now()+Math.max(8e3,T*2.5+3e3);for(;!e.timeline.recorded;){if(performance.now()>p)throw new Error("重新计算动画超时,请确认页面仍在运行后重试");await new Promise(x=>setTimeout(x,50))}}async function v(){if(!l.value){l.value=!0,u.value=!1,c.value="正在重新计算粒子动画…";try{await M();const T=dR({systems:e.systems,timeline:e.timeline,settings:t.value});xR(T.text,t.value.spineVersion),fR(T,t.value.fileName);const p=T.warnings.length?`;${T.warnings.length} 条资源提示(缺图仍已导出)`:"";c.value=`已导出 Spine ${t.value.spineVersion}:${T.particleSystemCount} 个粒子系统、${T.animationCount} 个动画、${T.boneCount} 根骨骼${p}`}catch(T){u.value=!0,c.value=T instanceof Error?T.message:String(T)}finally{l.value=!1}}}const S=ut(()=>{const T=e.systems.findIndex(p=>p.id===e.activeId);return T>=0?T:0}),y=ut(()=>e.systems[S.value]||null),I=ut(()=>{var p;const T=(p=y.value)==null?void 0:p.config;return T?Math.max(1,Math.ceil(Number(T.loopDurationFrames)||1)):1}),E=ut(()=>e.activeObjectType),C=ut(()=>e.activeObjectType==="collision"&&e.colliders.find(T=>T.id===e.activeObjectId)||null),R=ut(()=>e.activeObjectType==="path"&&e.paths.find(T=>T.id===e.activeObjectId)||null),B=ut(()=>e.activeObjectType==="spine"&&e.spines.find(T=>T.id===e.activeObjectId)||null),k=ut(()=>e.activeObjectType==="particle"?e.systems.some(T=>T.id===e.activeObjectId):e.activeObjectType==="collision"?e.colliders.some(T=>T.id===e.activeObjectId):e.activeObjectType==="path"?e.paths.some(T=>T.id===e.activeObjectId):e.spines.some(T=>T.id===e.activeObjectId)),F=ut(()=>{const T=e.spines.find(p=>p.selectedBone&&p.bones.some(x=>x.name===p.selectedBone));return T?{spine:T,boneName:T.selectedBone}:null}),D=ut(()=>{var x;const T=(x=y.value)==null?void 0:x.config;if(!T||T.emitterFollowMode!=="bone")return null;const p=e.spines.find(V=>V.id===T.emitterFollowSpineId);return!p||!p.bones.some(V=>V.name===T.emitterFollowBoneName)?null:{spine:p,boneName:T.emitterFollowBoneName}});No(()=>{for(const T of e.systems)T.visible==null&&(T.visible=!0);for(const T of e.colliders)T.visible==null&&(T.visible=!0);for(const T of e.paths)T.visible==null&&(T.visible=!0);for(const T of e.spines)T.visible==null&&(T.visible=!0)}),No(()=>{if(!y.value)return;const T=Tr(y.value.config);T.lifeMode==="curve"&&(T.lifeMode="random"),T.speedMode==="curve"&&(T.speedMode="random"),T.scaleMode==="curve"&&(T.scaleMode="random"),T.initialRotationMode==="curve"&&(T.initialRotationMode="random"),T.mode==="stream"&&!(T.duration>0)&&(T.duration=1),T.streamBehavior==="loop"&&(T.emitterFollow||T.emitterFollowMode!=="none")&&ne(T)}),No(()=>{for(const T of e.systems){const p=Tr(T.config);if(p.emitterFollowMode!=="bone")continue;const x=e.spines.find(K=>K.id===p.emitterFollowSpineId);!!(x!=null&&x.bones.some(K=>K.name===p.emitterFollowBoneName))||(p.emitterFollowMode="none",p.emitterFollowSpineId=0,p.emitterFollowBoneName="")}}),No(()=>{for(const T of e.colliders)T.followPathId==null&&(T.followPathId=0),T.followDuration>0||(T.followDuration=2),T.followPathRotation==null&&(T.followPathRotation=!1),["跟随导出","线性","贝塞尔"].includes(T.followCurveMode)||(T.followCurveMode="跟随导出"),(!Array.isArray(T.followCurve)||T.followCurve.length<2)&&(T.followCurve=[{x:0,y:0},{x:1,y:1}])});const N=[{x:0,y:0},{x:1,y:1}],j=[{x:0,y:1},{x:1,y:1}],O=[{x:0,y:0},{x:.2,y:1},{x:.8,y:1},{x:1,y:0}],L=[{x:0,y:0},{x:.1,y:1},{x:.9,y:1},{x:1,y:0}],P=[{x:0,y:1},{x:1,y:1}],X=[{x:0,y:1},{x:1,y:1}],U=wo({config:!0,scene:!1,emitMode:!0,shape:!0,attr:!0,look:!0,mods:!0,export:!1});function Y(T){U[T]=!U[T]}function q(T){var x;const p=(x=y.value)==null?void 0:x.config;p&&(p.mode=T,T==="stream"&&!(p.duration>0)&&(p.duration=1))}function z(T){var V;const p=(V=y.value)==null?void 0:V.config;if(!p)return;const x=Math.min(1800,Math.max(1,Math.ceil(Number(T)||1)));p.loopDurationFrames=x}function ne(T){const p=ga();T.emitterFollow=!1,T.emitterFollowMode="none",T.emitterFollowPathId=p.emitterFollowPathId,T.emitterFollowSpineId=p.emitterFollowSpineId,T.emitterFollowBoneName=p.emitterFollowBoneName,T.emitterFollowBoneOffsetX=p.emitterFollowBoneOffsetX,T.emitterFollowBoneOffsetY=p.emitterFollowBoneOffsetY,T.emitterFollowBoneRotation=p.emitterFollowBoneRotation,T.emitterFollowBoneScaleX=p.emitterFollowBoneScaleX,T.emitterFollowBoneScaleY=p.emitterFollowBoneScaleY,T.emitterAngleMode=p.emitterAngleMode,T.emitterFollowCurve=p.emitterFollowCurve.map(x=>({...x})),T.emitterFollowDuration=p.emitterFollowDuration,T.emitterFollowSpace=p.emitterFollowSpace,T.emitterFollowDirection=p.emitterFollowDirection,T.emitterFollowOffset=p.emitterFollowOffset}function H(T){var K;const p=(K=y.value)==null?void 0:K.config;if(!p||p.streamBehavior===T)return;const x=T==="loop",V=x?"进入循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?":"退出循环持续模式后,粒子跟随设置会失效并恢复默认值。是否继续?";window.confirm(V)&&(ne(p),p.streamBehavior=T,x||(p.generateLoopStartAnimation=!1,p.generateLoopEndAnimation=!1))}function Z(T,p){var K;const x=(K=y.value)==null?void 0:K.config;if(!x)return;const V=p.target.checked;T==="start"?(x.generateLoopStartAnimation=V,V&&(x.generateLoopEndAnimation=!1)):(x.generateLoopEndAnimation=V,V&&(x.generateLoopStartAnimation=!1))}function ae(T,p){const x=T.target.value;if(p.emitterFollowMode=x,x!=="bone"){p.emitterFollowSpineId=0,p.emitterFollowBoneName="";return}me(p)}function me(T){const p=F.value;if(!p){T.emitterFollowMode="none",T.emitterFollowSpineId=0,T.emitterFollowBoneName="";return}T.emitterFollowMode="bone",T.emitterFollowSpineId=p.spine.id,T.emitterFollowBoneName=p.boneName}const _e={emitMode:["mode","rate","streamBehavior","loopDurationFrames","generateLoopStartAnimation","generateLoopEndAnimation","burstCount","burstLoop","delay","duration"],shape:["shape","radius","rectW","rectH","direction","spread","coneAngle"],attr:["lifeMin","lifeMax","lifeMode","lifeCurve","speedMin","speedMax","speedMode","speedCurve","scaleMin","scaleMax","scaleMode","scaleAxisMode","scaleYMin","scaleYMax","scaleCurve","scaleYCurve","scaleEndRatio","initialRotationMode","initialRotationMin","initialRotationMax","initialRotationCurve","rotationSpeedMin","rotationSpeedMax","speedOverLifeEnabled","speedOverLifeMode","speedOverLifeMin","speedOverLifeMax","speedOverLifeCurve","scaleOverLifeEnabled","scaleOverLifeMode","scaleOverLifeAxisMode","scaleOverLifeMin","scaleOverLifeMax","scaleYOverLifeMin","scaleYOverLifeMax","scaleOverLifeCurve","scaleYOverLifeCurve","rotationOverLifeEnabled","rotationOverLifeMode","rotationOverLifeCurve"],look:["texture","imageResources","imageWeightVersion","alpha","alphaEnd","colorStart","colorEnd","colorOverLife","blend","alphaMode","curveMode","alphaCurve","textureName","textureFolder","alphaScale","anchorX","anchorY","independentAlpha"],mods:["noise","noiseAmt","noiseRange","noiseSpeed","useGravity","gravity","gravityMode","gravityMin","gravityMax","gravityDirection","gravityCurve","wind","windX","windY","windMode","windMin","windMax","windDirection","windCurve","forceField","forceStrength","forceRadius","forceCenterX","forceCenterY","forceFalloff","attraction","attractionCenterX","attractionCenterY","attractionRadius","attractionDuration","attractionDelay","attractionDelayMode","attractionPath","trail","trailConfigVersion","trailResources","trailResourceVersion","trailTexture","trailTextureName","trailPreviewUrl","trailColorMode","trailColor","trailColorGradient","trailAlphaMode","trailAlpha","trailAlphaCurve","trailBoneCount","trailLength","trailWidth","trailWidthMode","trailLifeLengthEnabled","trailLifeLengthCurve","trailShapeEnabled","trailShapeCurve","trailGridRows","trailGridCols","collision","pathFollow","emitterFollow","emitterFollowMode","emitterFollowPathId","emitterFollowSpineId","emitterFollowBoneName","emitterFollowBoneOffsetX","emitterFollowBoneOffsetY","emitterFollowBoneRotation","emitterFollowBoneScaleX","emitterFollowBoneScaleY","emitterAngleMode","emitterFollowCurve","emitterFollowDuration","emitterFollowSpace","emitterFollowDirection","emitterFollowOffset","damping"]};function te(T){var V;const p=(V=y.value)==null?void 0:V.config;if(T==="export"){e.settings.exportSettings=uf();return}if(!p)return;const x=ga();for(const K of _e[T])p[K]=x[K]}function ve(){t.value.fps=Math.min(240,Math.max(1,Math.round(Number(t.value.fps)||30)))}function $(T){var p;e.selectSystem(((p=e.systems[T])==null?void 0:p.id)??0)}function W(){e.addSystem()}function J(){e.addCollider()}function Q(){e.addPath()}function ie(){e.addSpine()}function ue(){e.duplicateSelectedObject()}function Se(){const T=C.value;if(!T)return;let p=T.tags.length+1,x=`Tag ${p}`;for(;T.tags.includes(x);)x=`Tag ${++p}`;T.tags.push(x),T.selectedTag=x}function Me(T,p,x=0,V=0,K=0,oe=0){return{x:T,y:p,inX:x,inY:V,outX:K,outY:oe}}function Ee(){const T=R.value;if(!(!T||!T.preset))if(T.preset==="circle"){const x=60.751328;T.points=[Me(110,0,0,-x,0,x),Me(0,110,x,0,-x,0),Me(-110,0,0,x,0,-x),Me(0,-110,-x,0,x,0)],T.closed=!0}else if(T.preset==="square")T.points=[Me(-100,-100),Me(100,-100),Me(100,100),Me(-100,100)],T.closed=!0;else{const p=T.preset==="star"?10:6;T.points=Array.from({length:p},(x,V)=>{const K=T.preset==="star"&&V%2?50:110,oe=-Math.PI*.5+V/p*Math.PI*2;return Me(Math.cos(oe)*K,Math.sin(oe)*K)}),T.closed=!0}}function de(){R.value&&(R.value.points=[])}function De(){y.value&&(y.value.config.seed=Math.floor(Math.random()*999999)+1)}function Ie(T){var x;const p=(x=y.value)==null?void 0:x.config;!p||T==="direction"||(p.speedOverLifeMode=T,T==="curve"&&p.speedOverLifeMin===p.speedOverLifeMax&&(p.speedOverLifeMin=0,p.speedOverLifeMax=1))}function Be(){var p;const T=(p=y.value)==null?void 0:p.config;!T||T.scaleOverLifeMode!=="curve"||(T.scaleOverLifeMin===T.scaleOverLifeMax&&(T.scaleOverLifeMin=0,T.scaleOverLifeMax=1),T.scaleYOverLifeMin===T.scaleYOverLifeMax&&(T.scaleYOverLifeMin=0,T.scaleYOverLifeMax=1))}function Ke(T){var x;const p=(x=y.value)==null?void 0:x.config;!p||T==="direction"||(p.scaleOverLifeMode=T,Be())}const ct={point:{direction:0,spread:360},circle:{radius:100,direction:-90,spread:0},rect:{rectW:200,rectH:100,direction:-90,spread:0},cone:{radius:100,coneAngle:90,direction:90},orbit:{}};function wt(){var x;const T=(x=y.value)==null?void 0:x.config;if(!T)return;const p=ct[T.shape];p&&Object.assign(T,p)}const dt=it(null),Mt=it(null),Ct=it(null),ai=it(null),Jt=it(null);function Zi(){var x;const T=(x=y.value)==null?void 0:x.config;if(!T)return;const p=Math.max(0,...T.trailResources.map(V=>V.id))+1;T.trailResources.push({id:p,texture:null,textureName:"trail",previewUrl:"/images/trail.png",weight:100,locked:!1,rotation:0,colorMode:"particle",color:"#ffffff",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],blend:"normal",alphaMode:"particle",alpha:1,alphaCurve:P.map(V=>({...V})),boneCount:3,trailRatio:100,lengthMode:"fixed",length:100,lengthMin:100,lengthMax:100,widthSizeMode:"fixed",width:100,widthMin:100,widthMax:100,widthMode:"particle",lifeLengthEnabled:!1,lifeLengthCurve:j.map(V=>({...V})),shapeEnabled:!1,shapeCurve:X.map(V=>({...V}))}),nt()}function xs(T){var p;Jt.value=T,(p=ai.value)==null||p.click()}function $t(T,p){var K;const x=(K=y.value)==null?void 0:K.config;if(!x)return;const V=T==="trailGridCols"?32:16;x[T]=Math.min(V,Math.max(2,Math.round(Number(p)||2)))}function re(T,p){var V;const x=(V=y.value)==null?void 0:V.config.trailResources.find(K=>K.id===T);x&&(x.boneCount=Math.min(16,Math.max(2,Math.round(Number(p)||2))))}function le(T,p){var V;const x=(V=y.value)==null?void 0:V.config.trailResources.find(K=>K.id===T);x&&(x.rotation=Math.max(-360,Math.min(360,Number(p)||0)))}async function ft(T){var pe,he;const p=T.target,x=(pe=p.files)==null?void 0:pe[0],V=(he=y.value)==null?void 0:he.config,K=V==null?void 0:V.trailResources.find(be=>be.id===Jt.value);if(!x||!K){p.value="";return}const oe=await Mn(x);K.texture=$n(await et.fromURL(oe)),K.previewUrl=oe,K.textureName=x.name.replace(/\.[^.]+$/,"")||"trail",p.value="",Jt.value=null}async function It(T){var V;const p=(V=y.value)==null?void 0:V.config,x=p==null?void 0:p.trailResources.find(K=>K.id===T);x&&(x.texture=$n(await et.fromURL("/images/trail.png")),x.previewUrl="/images/trail.png",x.textureName="trail",x.weight=100,x.locked=!1,x.rotation=0,x.boneCount=3,x.trailRatio=100,x.lengthMode="fixed",x.length=100,x.lengthMin=100,x.lengthMax=100,x.widthSizeMode="fixed",x.width=100,x.widthMin=100,x.widthMax=100,x.widthMode="particle",x.lifeLengthEnabled=!1,x.lifeLengthCurve=j.map(K=>({...K})),x.shapeEnabled=!1,x.shapeCurve=X.map(K=>({...K})),x.colorMode="particle",x.color="#ffffff",x.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ffffff"}],x.blend="normal",x.alphaMode="particle",x.alpha=1,x.alphaCurve=P.map(K=>({...K})),nt())}function Pt(T){var V;const p=(V=y.value)==null?void 0:V.config.trailResources;if(!p||p.length<=1)return;const x=p.findIndex(K=>K.id===T);x>=0&&p.splice(x,1),nt()}function nt(){var K;const T=(K=y.value)==null?void 0:K.config.trailResources;if(!(T!=null&&T.length))return;if(T.length===1){T[0].weight=100,T[0].locked=!1;return}const p=T.filter(oe=>oe.locked),x=T.filter(oe=>!oe.locked);let V=p.reduce((oe,pe)=>oe+Math.max(0,Number(pe.weight)||0),0);V>100&&(Qi(p,100,!0),V=100),Qi(x,100-V)}function $i(T,p){var he;const x=(he=y.value)==null?void 0:he.config.trailResources;if(!(x!=null&&x.length))return;if(x.length===1){x[0].weight=100,x[0].locked=!1;return}const V=x.find(be=>be.id===T);if(!V||V.locked)return;const K=x.filter(be=>be.id!==T&&be.locked).reduce((be,fe)=>be+Math.max(0,Number(fe.weight)||0),0),oe=Math.max(0,100-K),pe=x.filter(be=>be.id!==T&&!be.locked);V.weight=Bi(Math.min(oe,Math.max(0,Number(p)||0))),pe.length?Qi(pe,oe-V.weight,!0):V.weight=Bi(oe)}function Ji(T){var V;const p=(V=y.value)==null?void 0:V.config.trailResources;if(!p||p.length===1)return;const x=p.find(K=>K.id===T);x&&(x.locked=!x.locked)}function li(T,p){const x=p.target;T.color=En(x.value,T.color),x.value=T.color}function Gi(T,p){li(T,p),p.target.blur()}function er(){var x;const T=(x=y.value)==null?void 0:x.config;if(!T)return;const p=Math.max(0,...T.imageResources.map(V=>V.id))+1;T.imageResources.push({id:p,texture:T.texture,textureName:"star",textureFolder:"",previewUrl:"/images/star.png",imageMode:"fixed",sequencePlayback:"loop-forward",sequenceFps:30,sequenceFrames:[],weight:100,locked:!1,scale:1,anchorX:.5,anchorY:.5,colorMode:"fixed",colorStart:"#ffffff",colorEnd:"#ff4d4d",colorGradient:[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],blend:"normal",independentAlpha:"off",alpha:1,alphaCurveMode:"跟随导出",alphaCurve:L.map(V=>({...V}))}),ws()}function Oi(T){var p;Ct.value=T,(p=dt.value)==null||p.click()}function Qt(T){var p;Ct.value=T,(p=Mt.value)==null||p.click()}async function Pr(T){var he,be;const p=T.target,x=(he=p.files)==null?void 0:he[0],V=(be=y.value)==null?void 0:be.config,K=V==null?void 0:V.imageResources.find(fe=>fe.id===Ct.value);if(!x||!K){p.value="";return}const oe=await Mn(x),pe=$n(await et.fromURL(oe));K.texture=pe,K.previewUrl=oe,K.textureFolder="",K.textureName=x.name.replace(/\.[^.]+$/,"")||"particle",p.value="",Ct.value=null}async function kr(T){var oe;const p=T.target,x=Array.from(p.files||[]).sort((pe,he)=>pe.name.localeCompare(he.name,void 0,{numeric:!0,sensitivity:"base"})),V=(oe=y.value)==null?void 0:oe.config,K=V==null?void 0:V.imageResources.find(pe=>pe.id===Ct.value);if(!x.length||!K){p.value="";return}K.sequenceFrames=await Promise.all(x.map(async pe=>{const he=await Mn(pe);return{name:pe.name,previewUrl:he,texture:$n(await et.fromURL(he))}})),K.imageMode="sequence",p.value="",Ct.value=null}function Mn(T){return new Promise((p,x)=>{const V=new FileReader;V.onload=()=>p(String(V.result||"")),V.onerror=()=>x(V.error),V.readAsDataURL(T)})}function Zs(T){var V;const p=(V=y.value)==null?void 0:V.config,x=p==null?void 0:p.imageResources.find(K=>K.id===T);!p||!x||(x.texture=p.texture,x.textureName="star",x.textureFolder="",x.previewUrl="/images/star.png",x.imageMode="fixed",x.sequencePlayback="loop-forward",x.sequenceFps=30,x.sequenceFrames=[],x.scale=1,x.anchorX=.5,x.anchorY=.5,x.colorMode="fixed",x.colorStart="#ffffff",x.colorEnd="#ff4d4d",x.colorGradient=[{position:0,color:"#ffffff"},{position:1,color:"#ff4d4d"}],x.blend="normal",x.independentAlpha="off",x.alpha=1,x.alphaCurveMode="跟随导出",x.alphaCurve=L.map(K=>({...K})),x.locked=!1,ws())}function En(T,p){let x=T.trim().replace(/^#/,"");return/^[0-9a-f]{3}$/i.test(x)&&(x=x.split("").map(V=>V+V).join("")),/^[0-9a-f]{6}$/i.test(x)?`#${x.toLowerCase()}`:p}function Js(T,p){const x=p.target;T.colorStart=En(x.value,T.colorStart),x.value=T.colorStart}function An(T,p){Js(T,p),p.target.blur()}function bs(T){var V;const p=(V=y.value)==null?void 0:V.config.imageResources;if(!p||p.length<=1)return;const x=p.findIndex(K=>K.id===T);x>=0&&p.splice(x,1),ws()}function Bi(T){return Math.round(T)}function Qi(T,p,x=!1){if(!T.length)return;const V=Math.max(0,Bi(p)),K=x?T.reduce((pe,he)=>pe+Math.max(0,Number(he.weight)||0),0):0;let oe=0;T.forEach((pe,he)=>{const be=he===T.length-1,fe=Bi(be?V-oe:K>0?V*Math.max(0,Number(pe.weight)||0)/K:V/T.length);pe.weight=fe,oe+=fe})}function ws(){var K;const T=(K=y.value)==null?void 0:K.config.imageResources;if(!(T!=null&&T.length))return;if(T.length===1){T[0].weight=100,T[0].locked=!1;return}const p=T.filter(oe=>oe.locked),x=T.filter(oe=>!oe.locked);let V=p.reduce((oe,pe)=>oe+Math.max(0,Number(pe.weight)||0),0);V>100&&(Qi(p,100,!0),V=100),Qi(x,100-V)}function tr(T,p){var he;const x=(he=y.value)==null?void 0:he.config.imageResources;if(!(x!=null&&x.length))return;if(x.length===1){x[0].weight=100,x[0].locked=!1;return}const V=x.find(be=>be.id===T);if(!V||V.locked)return;const K=x.filter(be=>be.id!==T&&be.locked).reduce((be,fe)=>be+Math.max(0,Number(fe.weight)||0),0),oe=Math.max(0,100-K),pe=x.filter(be=>be.id!==T&&!be.locked);if(V.weight=Bi(Math.min(oe,Math.max(0,Number(p)||0))),!pe.length){V.weight=Bi(oe);return}Qi(pe,oe-V.weight,!0)}function G(T){var V;const p=(V=y.value)==null?void 0:V.config.imageResources;if(!p||p.length===1)return;const x=p.find(K=>K.id===T);x&&(x.locked=!x.locked)}return(T,p)=>(se(),ce("div",bR,[p[362]||(p[362]=w("div",{class:"panel-header"},[w("span",null,"Spine粒子编辑器-Yeomai")],-1)),w("div",wR,[w("div",_R,[w("div",{class:"group-head",onClick:p[0]||(p[0]=x=>Y("config"))},[w("span",SR,Ye(U.config?"▸":"▾"),1),p[182]||(p[182]=w("span",null,"配置管理",-1))]),xe(w("div",TR,[w("div",MR,[w("button",{title:"保存全部编辑器配置 (Ctrl+S)",onClick:d},"保存配置"),w("button",{title:"加载本地编辑器配置",onClick:p[1]||(p[1]=x=>{var V;return(V=s.value)==null?void 0:V.click()})},"加载配置"),xe(w("select",{"onUpdate:modelValue":p[2]||(p[2]=x=>n.value=x),"aria-label":"预设列表",disabled:!r.value.length||o.value,onPointerdown:g,onFocus:g,onChange:b},[w("option",AR,Ye(r.value.length?"选择预设":"无预设文件"),1),(se(!0),ce(qe,null,Ht(r.value,x=>(se(),ce("option",{key:x.file,value:x.file},Ye(x.name),9,CR))),128))],40,ER),[[kt,n.value]]),w("input",{ref_key:"configFileInput",ref:s,hidden:"",type:"file",accept:".json,application/json",onChange:m},null,544)]),a.value?(se(),ce("div",{key:0,class:Ze(["config-message",{error:h.value}])},Ye(a.value),3)):$e("",!0)],512),[[Cn,!U.config]])]),w("div",IR,[w("div",{class:"group-head scene-head",onClick:p[3]||(p[3]=x=>Y("scene"))},[w("span",RR,Ye(U.scene?"▸":"▾"),1),p[183]||(p[183]=w("span",null,"场景对象",-1)),w("div",PR,[w("button",{class:"scene-add",title:"添加粒子系统",onClick:xt(W,["stop"])},"+粒子"),w("button",{class:"scene-add",title:"添加碰撞体",onClick:xt(J,["stop"])},"+碰撞"),w("button",{class:"scene-add",title:"添加路径",onClick:xt(Q,["stop"])},"+路径"),w("button",{class:"scene-add",title:"添加 Spine",onClick:xt(ie,["stop"])},"+Spine"),w("button",{class:"scene-add",disabled:!k.value,title:"复制当前选中的场景对象",onClick:xt(ue,["stop"])},"+Copy",8,kR)])]),xe(w("div",FR,[w("div",OR,[(se(!0),ce(qe,null,Ht(Pe(e).systems,(x,V)=>(se(),ce("div",{key:`particle-${x.id}`,class:Ze(["tree-item scene-object-item",{on:E.value==="particle"&&x.id===Pe(e).activeObjectId}]),onClick:K=>$(V)},[p[186]||(p[186]=w("span",{class:"tdot"},"●",-1)),w("span",LR,Ye(x.config.name||"ParticleSystem"+(V+1)),1),w("button",{class:Ze(["scene-object-eye",{off:x.visible===!1}]),title:x.visible===!1?"显示粒子系统":"隐藏粒子系统","aria-label":x.visible===!1?"显示粒子系统":"隐藏粒子系统",onClick:xt(K=>x.visible=x.visible===!1,["stop"])},[(se(),ce("svg",NR,[p[184]||(p[184]=w("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"},null,-1)),p[185]||(p[185]=w("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),x.visible===!1?(se(),ce("path",UR)):$e("",!0)]))],10,DR),p[187]||(p[187]=w("span",{class:"scene-object-kind"},"粒子",-1)),w("button",{class:"scene-object-delete",title:"删除粒子系统",onClick:xt(K=>Pe(e).removeSystem(x.id),["stop"])},"✕",8,VR)],10,BR))),128)),(se(!0),ce(qe,null,Ht(Pe(e).colliders,x=>(se(),ce("div",{key:`collision-${x.id}`,class:Ze(["tree-item scene-object-item",{on:E.value==="collision"&&x.id===Pe(e).activeObjectId}]),onClick:V=>Pe(e).selectSceneObject("collision",x.id)},[p[190]||(p[190]=w("span",{class:"tdot collision-dot"},"■",-1)),w("span",YR,Ye(x.name),1),w("button",{class:Ze(["scene-object-eye",{off:x.visible===!1}]),title:x.visible===!1?"显示碰撞体":"隐藏碰撞体","aria-label":x.visible===!1?"显示碰撞体":"隐藏碰撞体",onClick:xt(V=>x.visible=x.visible===!1,["stop"])},[(se(),ce("svg",GR,[p[188]||(p[188]=w("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"},null,-1)),p[189]||(p[189]=w("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),x.visible===!1?(se(),ce("path",jR)):$e("",!0)]))],10,$R),p[191]||(p[191]=w("span",{class:"scene-object-kind"},"碰撞",-1)),w("button",{class:"scene-object-delete",title:"删除碰撞体",onClick:xt(V=>Pe(e).removeCollider(x.id),["stop"])},"✕",8,HR)],10,XR))),128)),(se(!0),ce(qe,null,Ht(Pe(e).paths,x=>(se(),ce("div",{key:`path-${x.id}`,class:Ze(["tree-item scene-object-item",{on:E.value==="path"&&x.id===Pe(e).activeObjectId}]),onClick:V=>Pe(e).selectSceneObject("path",x.id)},[p[194]||(p[194]=w("span",{class:"tdot path-dot"},"◇",-1)),w("span",zR,Ye(x.name),1),w("button",{class:Ze(["scene-object-eye",{off:x.visible===!1}]),title:x.visible===!1?"显示路径":"隐藏路径","aria-label":x.visible===!1?"显示路径":"隐藏路径",onClick:xt(V=>x.visible=x.visible===!1,["stop"])},[(se(),ce("svg",KR,[p[192]||(p[192]=w("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"},null,-1)),p[193]||(p[193]=w("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),x.visible===!1?(se(),ce("path",ZR)):$e("",!0)]))],10,qR),p[195]||(p[195]=w("span",{class:"scene-object-kind"},"路径",-1)),w("button",{class:"scene-object-delete",title:"删除路径",onClick:xt(V=>Pe(e).removePath(x.id),["stop"])},"✕",8,JR)],10,WR))),128)),(se(!0),ce(qe,null,Ht(Pe(e).spines,x=>(se(),ce("div",{key:`spine-${x.id}`,class:Ze(["tree-item scene-object-item",{on:E.value==="spine"&&x.id===Pe(e).activeObjectId}]),onClick:V=>Pe(e).selectSceneObject("spine",x.id)},[p[198]||(p[198]=w("span",{class:"tdot spine-dot"},"◆",-1)),w("span",eP,Ye(x.name),1),w("button",{class:Ze(["scene-object-eye",{off:x.visible===!1}]),title:x.visible===!1?"显示 Spine":"隐藏 Spine","aria-label":x.visible===!1?"显示 Spine":"隐藏 Spine",onClick:xt(V=>x.visible=x.visible===!1,["stop"])},[(se(),ce("svg",iP,[p[196]||(p[196]=w("path",{d:"M2.5 12s3.5-6 9.5-6 9.5 6 9.5 6-3.5 6-9.5 6-9.5-6-9.5-6Z"},null,-1)),p[197]||(p[197]=w("circle",{cx:"12",cy:"12",r:"2.8"},null,-1)),x.visible===!1?(se(),ce("path",sP)):$e("",!0)]))],10,tP),p[199]||(p[199]=w("span",{class:"scene-object-kind"},"Spine",-1)),w("button",{class:"scene-object-delete",title:"删除 Spine",onClick:xt(V=>Pe(e).removeSpine(x.id),["stop"])},"✕",8,nP)],10,QR))),128)),!Pe(e).systems.length&&!Pe(e).colliders.length&&!Pe(e).paths.length&&!Pe(e).spines.length?(se(),ce("div",rP,"场景中暂无对象")):$e("",!0)]),E.value==="particle"&&y.value?(se(),ce(qe,{key:0},[w("label",oP,[p[200]||(p[200]=w("span",null,"名称",-1)),xe(w("input",{"onUpdate:modelValue":p[4]||(p[4]=x=>y.value.config.name=x),class:"inp"},null,512),[[Je,y.value.config.name]])]),Ne(Ge,{label:"位置X",min:-2e3,max:2e3,step:1,modelValue:y.value.config.centerX,"onUpdate:modelValue":p[5]||(p[5]=x=>y.value.config.centerX=x)},null,8,["modelValue"]),Ne(Ge,{label:"位置Y",min:-2e3,max:2e3,step:1,modelValue:y.value.config.centerY,"onUpdate:modelValue":p[6]||(p[6]=x=>y.value.config.centerY=x)},null,8,["modelValue"]),Ne(Ge,{label:"偏移X",min:-2e3,max:2e3,step:1,modelValue:y.value.config.offsetX,"onUpdate:modelValue":p[7]||(p[7]=x=>y.value.config.offsetX=x)},null,8,["modelValue"]),Ne(Ge,{label:"偏移Y",min:-2e3,max:2e3,step:1,modelValue:y.value.config.offsetY,"onUpdate:modelValue":p[8]||(p[8]=x=>y.value.config.offsetY=x)},null,8,["modelValue"]),Ne(Ge,{label:"旋转",min:-360,max:360,step:1,modelValue:y.value.config.rootRotation,"onUpdate:modelValue":p[9]||(p[9]=x=>y.value.config.rootRotation=x)},null,8,["modelValue"]),Ne(Ge,{label:"缩放X",min:.05,max:10,step:.05,modelValue:y.value.config.rootScaleX,"onUpdate:modelValue":p[10]||(p[10]=x=>y.value.config.rootScaleX=x)},null,8,["modelValue"]),Ne(Ge,{label:"缩放Y",min:.05,max:10,step:.05,modelValue:y.value.config.rootScaleY,"onUpdate:modelValue":p[11]||(p[11]=x=>y.value.config.rootScaleY=x)},null,8,["modelValue"]),w("div",aP,[p[201]||(p[201]=w("label",{for:"system-seed"},"随机种子",-1)),xe(w("input",{id:"system-seed",class:"seed-input",type:"number",min:"0",step:"1","onUpdate:modelValue":p[12]||(p[12]=x=>y.value.config.seed=x),title:"控制粒子系统内全部随机属性、资源选择与修改器随机采样"},null,512),[[Je,y.value.config.seed,void 0,{number:!0}]]),w("button",{class:"seed-random",title:"生成新的全局随机种子",onClick:De},"⚄")]),p[202]||(p[202]=w("div",{class:"seed-hint"},"控制初始随机参数、资源选择和修改器随机采样;相同种子可复现相同效果",-1))],64)):C.value?(se(),ce(qe,{key:1},[p[229]||(p[229]=w("div",{class:"object-editor-title"},"碰撞体属性",-1)),w("label",lP,[p[203]||(p[203]=w("span",null,"碰撞体名称",-1)),xe(w("input",{"onUpdate:modelValue":p[13]||(p[13]=x=>C.value.name=x),class:"inp"},null,512),[[Je,C.value.name]])]),w("div",hP,[p[204]||(p[204]=w("span",null,"碰撞体标签",-1)),w("div",cP,[(se(!0),ce(qe,null,Ht(C.value.tags,x=>(se(),ce("button",{key:x,class:Ze(["object-tag",{on:C.value.selectedTag===x}]),onClick:V=>C.value.selectedTag=x},Ye(x),11,uP))),128)),w("button",{class:"tag-add",title:"新增标签",onClick:Se},"+")]),p[205]||(p[205]=w("small",null,"点击标签为当前碰撞体选择标签;点击+新增标签。",-1))]),w("div",dP,[w("label",fP,[p[207]||(p[207]=w("span",null,"类型",-1)),xe(w("select",{"onUpdate:modelValue":p[14]||(p[14]=x=>C.value.shape=x),class:"inp"},[...p[206]||(p[206]=[Vo('',5)])],512),[[kt,C.value.shape]])]),w("label",pP,[p[208]||(p[208]=w("span",null,"启用",-1)),xe(w("input",{"onUpdate:modelValue":p[15]||(p[15]=x=>C.value.enabled=x),type:"checkbox"},null,512),[[Lt,C.value.enabled]])])]),w("div",mP,[w("label",gP,[p[209]||(p[209]=w("span",null,"X 位置",-1)),xe(w("input",{"onUpdate:modelValue":p[16]||(p[16]=x=>C.value.x=x),type:"number",class:"inp"},null,512),[[Je,C.value.x,void 0,{number:!0}]])]),w("label",vP,[p[210]||(p[210]=w("span",null,"Y 位置",-1)),xe(w("input",{"onUpdate:modelValue":p[17]||(p[17]=x=>C.value.y=x),type:"number",class:"inp"},null,512),[[Je,C.value.y,void 0,{number:!0}]])])]),Ne(Ge,{label:"旋转",min:-360,max:360,step:1,modelValue:C.value.rotation,"onUpdate:modelValue":p[18]||(p[18]=x=>C.value.rotation=x)},null,8,["modelValue"]),w("div",yP,[w("label",xP,[p[211]||(p[211]=w("span",null,"缩放 X",-1)),xe(w("input",{"onUpdate:modelValue":p[19]||(p[19]=x=>C.value.scaleX=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,C.value.scaleX,void 0,{number:!0}]])]),w("label",bP,[p[212]||(p[212]=w("span",null,"缩放 Y",-1)),xe(w("input",{"onUpdate:modelValue":p[20]||(p[20]=x=>C.value.scaleY=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,C.value.scaleY,void 0,{number:!0}]])])]),C.value.shape==="circle"?(se(),Et(Ge,{key:0,label:"半径",min:1,max:1e3,step:1,modelValue:C.value.radius,"onUpdate:modelValue":p[21]||(p[21]=x=>C.value.radius=x)},null,8,["modelValue"])):C.value.shape==="ellipse"?(se(),ce("div",wP,[w("label",_P,[p[213]||(p[213]=w("span",null,"X 半径",-1)),xe(w("input",{"onUpdate:modelValue":p[22]||(p[22]=x=>C.value.radiusX=x),type:"number",min:"1",class:"inp"},null,512),[[Je,C.value.radiusX,void 0,{number:!0}]])]),w("label",SP,[p[214]||(p[214]=w("span",null,"Y 半径",-1)),xe(w("input",{"onUpdate:modelValue":p[23]||(p[23]=x=>C.value.radiusY=x),type:"number",min:"1",class:"inp"},null,512),[[Je,C.value.radiusY,void 0,{number:!0}]])])])):(se(),ce("div",TP,[w("label",MP,[p[215]||(p[215]=w("span",null,"宽度",-1)),xe(w("input",{"onUpdate:modelValue":p[24]||(p[24]=x=>C.value.width=x),type:"number",min:"1",class:"inp"},null,512),[[Je,C.value.width,void 0,{number:!0}]])]),w("label",EP,[p[216]||(p[216]=w("span",null,"高度",-1)),xe(w("input",{"onUpdate:modelValue":p[25]||(p[25]=x=>C.value.height=x),type:"number",min:"1",class:"inp"},null,512),[[Je,C.value.height,void 0,{number:!0}]])])])),C.value.shape==="polygon"||C.value.shape==="custom"?(se(),Et(Ge,{key:3,label:"边数",min:3,max:16,step:1,modelValue:C.value.sides,"onUpdate:modelValue":p[26]||(p[26]=x=>C.value.sides=x)},null,8,["modelValue"])):$e("",!0),w("label",AP,[p[218]||(p[218]=w("span",null,"碰撞响应",-1)),xe(w("select",{"onUpdate:modelValue":p[27]||(p[27]=x=>C.value.response=x),class:"inp"},[...p[217]||(p[217]=[w("option",{value:"physics"},"物理(弹跳/摩擦)",-1),w("option",{value:"pause"},"暂停(停止不动)",-1),w("option",{value:"destroy"},"消失(立即销毁)",-1)])],512),[[kt,C.value.response]])]),C.value.response==="physics"?(se(),ce("div",CP,[w("label",IP,[p[219]||(p[219]=w("span",null,"弹性 (0-1)",-1)),xe(w("input",{"onUpdate:modelValue":p[28]||(p[28]=x=>C.value.elasticity=x),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[Je,C.value.elasticity,void 0,{number:!0}]])]),w("label",RP,[p[220]||(p[220]=w("span",null,"摩擦 (0-1)",-1)),xe(w("input",{"onUpdate:modelValue":p[29]||(p[29]=x=>C.value.friction=x),type:"number",min:"0",max:"1",step:"0.01",class:"inp"},null,512),[[Je,C.value.friction,void 0,{number:!0}]])])])):$e("",!0),w("div",PP,[w("label",kP,[xe(w("input",{"onUpdate:modelValue":p[30]||(p[30]=x=>C.value.followPath=x),type:"checkbox"},null,512),[[Lt,C.value.followPath]]),p[221]||(p[221]=Yt("跟随路径移动",-1))]),C.value.followPath?(se(),ce(qe,{key:0},[w("label",FP,[p[223]||(p[223]=w("span",null,"目标路径",-1)),xe(w("select",{"onUpdate:modelValue":p[31]||(p[31]=x=>C.value.followPathId=x),class:"inp"},[p[222]||(p[222]=w("option",{value:0},"(未选择)",-1)),(se(!0),ce(qe,null,Ht(Pe(e).paths,x=>(se(),ce("option",{key:x.id,value:x.id},Ye(x.name),9,OP))),128))],512),[[kt,C.value.followPathId,void 0,{number:!0}]])]),w("div",BP,[w("label",LP,[p[224]||(p[224]=w("span",null,"移动时长(秒)",-1)),xe(w("input",{"onUpdate:modelValue":p[32]||(p[32]=x=>C.value.followDuration=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,C.value.followDuration,void 0,{number:!0}]])]),w("label",DP,[p[226]||(p[226]=w("span",null,"曲线模式",-1)),xe(w("select",{"onUpdate:modelValue":p[33]||(p[33]=x=>C.value.followCurveMode=x),class:"inp"},[...p[225]||(p[225]=[w("option",null,"跟随导出",-1),w("option",null,"线性",-1),w("option",null,"贝塞尔",-1)])],512),[[kt,C.value.followCurveMode]])])]),w("label",NP,[xe(w("input",{"onUpdate:modelValue":p[34]||(p[34]=x=>C.value.followPathRotation=x),type:"checkbox"},null,512),[[Lt,C.value.followPathRotation]]),p[227]||(p[227]=Yt("方向沿路径",-1))]),p[228]||(p[228]=w("div",{class:"collider-curve-title"},[Yt("移动进度曲线 "),w("small",null,"横轴:实时/移动时长 纵轴:路径进度(0=起点 → 1=终点)")],-1)),Ne(Is,{"model-value":C.value.followCurve||N,"default-value":N,mode:f(C.value.followCurveMode),"onUpdate:modelValue":p[35]||(p[35]=x=>C.value.followCurve=x)},null,8,["model-value","mode"])],64)):$e("",!0)])],64)):R.value?(se(),ce(qe,{key:2},[p[239]||(p[239]=w("div",{class:"object-editor-title"},"路径属性",-1)),w("label",UP,[p[230]||(p[230]=w("span",null,"路径名称",-1)),xe(w("input",{"onUpdate:modelValue":p[36]||(p[36]=x=>R.value.name=x),class:"inp"},null,512),[[Je,R.value.name]])]),w("div",VP,[w("label",XP,[p[231]||(p[231]=w("span",null,"X 位置",-1)),xe(w("input",{"onUpdate:modelValue":p[37]||(p[37]=x=>R.value.x=x),type:"number",class:"inp"},null,512),[[Je,R.value.x,void 0,{number:!0}]])]),w("label",YP,[p[232]||(p[232]=w("span",null,"Y 位置",-1)),xe(w("input",{"onUpdate:modelValue":p[38]||(p[38]=x=>R.value.y=x),type:"number",class:"inp"},null,512),[[Je,R.value.y,void 0,{number:!0}]])])]),Ne(Ge,{label:"旋转",min:-360,max:360,step:1,modelValue:R.value.rotation,"onUpdate:modelValue":p[39]||(p[39]=x=>R.value.rotation=x)},null,8,["modelValue"]),w("div",$P,[w("label",GP,[p[233]||(p[233]=w("span",null,"缩放 X",-1)),xe(w("input",{"onUpdate:modelValue":p[40]||(p[40]=x=>R.value.scaleX=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,R.value.scaleX,void 0,{number:!0}]])]),w("label",jP,[p[234]||(p[234]=w("span",null,"缩放 Y",-1)),xe(w("input",{"onUpdate:modelValue":p[41]||(p[41]=x=>R.value.scaleY=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,R.value.scaleY,void 0,{number:!0}]])])]),w("label",HP,[p[235]||(p[235]=w("span",null,"闭合路径",-1)),xe(w("input",{"onUpdate:modelValue":p[42]||(p[42]=x=>R.value.closed=x),type:"checkbox"},null,512),[[Lt,R.value.closed]])]),w("label",WP,[p[236]||(p[236]=w("span",null,"路径颜色",-1)),xe(w("input",{"onUpdate:modelValue":p[43]||(p[43]=x=>R.value.color=x),type:"color",class:"path-color"},null,512),[[Je,R.value.color]])]),p[240]||(p[240]=Vo('
操作说明:
  • 双击空白处/曲线:新建锚点
  • 双击锚点:删除节点
  • 双击第二下按住拖动:新建并拉出手柄
  • 拖动锚点移动位置,拖动手柄调整曲线
  • Shift+拖动手柄:两侧完全对称
  • Alt+拖动手柄:独立控制单侧
  • Ctrl+点击/框选:加选节点
  • Alt+点击/框选:减选节点
  • Alt+单击空白处:清除全部选中
  • 选中多个节点后可整体拖动
',1)),w("label",zP,[p[238]||(p[238]=w("span",null,"应用预设形状",-1)),xe(w("select",{"onUpdate:modelValue":p[44]||(p[44]=x=>R.value.preset=x),class:"inp"},[...p[237]||(p[237]=[Vo('',5)])],512),[[kt,R.value.preset]])]),w("button",{class:"path-action primary",onClick:Ee},"应用预设"),w("button",{class:"path-action",onClick:de},"清空锚点")],64)):B.value?(se(),Et(VI,{key:3,"spine-object":B.value},null,8,["spine-object"])):(se(),ce("div",qP,"使用右上角按钮创建场景对象"))],512),[[Cn,!U.scene]])]),E.value==="particle"&&y.value?(se(),ce(qe,{key:0},[w("div",KP,[w("div",{class:"group-head",onClick:p[46]||(p[46]=x=>Y("emitMode"))},[w("span",ZP,Ye(U.emitMode?"▸":"▾"),1),p[241]||(p[241]=w("span",null,"发射模式",-1)),w("button",{class:"group-reset",title:"重置发射模式参数",onClick:p[45]||(p[45]=xt(x=>te("emitMode"),["stop"]))},"重置")]),xe(w("div",JP,[w("div",QP,[w("button",{class:Ze(["seg",{on:y.value.config.mode==="stream"}]),onClick:p[47]||(p[47]=x=>q("stream"))},"持续",2),w("button",{class:Ze(["seg",{on:y.value.config.mode==="burst"}]),onClick:p[48]||(p[48]=x=>q("burst"))},"爆发",2)]),y.value.config.mode==="stream"?(se(),ce(qe,{key:0},[w("div",ek,[w("button",{class:Ze(["seg",{on:y.value.config.streamBehavior==="normal"}]),onClick:p[49]||(p[49]=x=>H("normal"))},"常规持续",2),w("button",{class:Ze(["seg",{on:y.value.config.streamBehavior==="loop"}]),onClick:p[50]||(p[50]=x=>H("loop"))},"循环持续",2)]),Ne(Ge,{label:"发射速率",min:1,max:300,step:1,modelValue:y.value.config.rate,"onUpdate:modelValue":p[51]||(p[51]=x=>y.value.config.rate=x)},null,8,["modelValue"]),y.value.config.streamBehavior==="normal"?(se(),Et(Ge,{key:0,label:"发射时长",min:1/30,max:60,step:1/30,modelValue:y.value.config.duration,"onUpdate:modelValue":p[52]||(p[52]=x=>y.value.config.duration=x)},null,8,["modelValue"])):(se(),Et(Ge,{key:1,label:"发射时长 (f)",min:1,max:1800,step:1,"model-value":I.value,"onUpdate:modelValue":z},null,8,["model-value"])),y.value.config.streamBehavior==="loop"?(se(),ce("div",tk,[w("label",ik,[w("input",{type:"checkbox",checked:y.value.config.generateLoopStartAnimation,onChange:p[53]||(p[53]=x=>Z("start",x))},null,40,sk),p[242]||(p[242]=w("span",{class:"switch-ui"},null,-1)),p[243]||(p[243]=w("span",null,"生成开始循环动画",-1))]),w("label",nk,[w("input",{type:"checkbox",checked:y.value.config.generateLoopEndAnimation,onChange:p[54]||(p[54]=x=>Z("end",x))},null,40,rk),p[244]||(p[244]=w("span",{class:"switch-ui"},null,-1)),p[245]||(p[245]=w("span",null,"生成结束循环动画",-1))])])):$e("",!0),y.value.config.streamBehavior==="loop"?(se(),ce("div",ok,"循环持续模式不支持骨骼跟随和路径跟随;进入或退出时会将粒子跟随设置恢复默认值。")):$e("",!0)],64)):(se(),Et(Ge,{key:1,label:"单次数量",min:1,max:1e3,step:1,modelValue:y.value.config.burstCount,"onUpdate:modelValue":p[55]||(p[55]=x=>y.value.config.burstCount=x)},null,8,["modelValue"])),Ne(Ge,{label:"延迟时间",min:0,max:5,step:.1,modelValue:y.value.config.delay,"onUpdate:modelValue":p[56]||(p[56]=x=>y.value.config.delay=x)},null,8,["modelValue"])],512),[[Cn,!U.emitMode]])]),w("div",ak,[w("div",{class:"group-head",onClick:p[58]||(p[58]=x=>Y("shape"))},[w("span",lk,Ye(U.shape?"▸":"▾"),1),p[246]||(p[246]=w("span",null,"发射器形状",-1)),w("button",{class:"group-reset",title:"重置发射器形状参数",onClick:p[57]||(p[57]=xt(x=>te("shape"),["stop"]))},"重置")]),xe(w("div",hk,[w("label",ck,[p[248]||(p[248]=w("span",null,"形状",-1)),xe(w("select",{"onUpdate:modelValue":p[59]||(p[59]=x=>y.value.config.shape=x),class:"inp",onChange:wt},[...p[247]||(p[247]=[Vo('',5)])],544),[[kt,y.value.config.shape]])]),y.value.config.shape==="circle"||y.value.config.shape==="cone"?(se(),Et(Ge,{key:0,label:"半径",min:0,max:300,step:1,modelValue:y.value.config.radius,"onUpdate:modelValue":p[60]||(p[60]=x=>y.value.config.radius=x)},null,8,["modelValue"])):$e("",!0),y.value.config.shape==="cone"?(se(),Et(Ge,{key:1,label:"锥形开口角度",min:1,max:360,step:1,modelValue:y.value.config.coneAngle,"onUpdate:modelValue":p[61]||(p[61]=x=>y.value.config.coneAngle=x)},null,8,["modelValue"])):y.value.config.shape==="rect"?(se(),ce(qe,{key:2},[Ne(Ge,{label:"宽",min:1,max:400,step:1,modelValue:y.value.config.rectW,"onUpdate:modelValue":p[62]||(p[62]=x=>y.value.config.rectW=x)},null,8,["modelValue"]),Ne(Ge,{label:"高",min:1,max:400,step:1,modelValue:y.value.config.rectH,"onUpdate:modelValue":p[63]||(p[63]=x=>y.value.config.rectH=x)},null,8,["modelValue"])],64)):$e("",!0),p[249]||(p[249]=w("div",{class:"divider"},null,-1)),Ne(Ge,{label:y.value.config.shape==="cone"?"锥形朝向":"发射角度",min:-360,max:360,step:1,modelValue:y.value.config.direction,"onUpdate:modelValue":p[64]||(p[64]=x=>y.value.config.direction=x)},null,8,["label","modelValue"]),y.value.config.shape!=="cone"?(se(),Et(Ge,{key:3,label:"扩散角度",min:0,max:360,step:1,modelValue:y.value.config.spread,"onUpdate:modelValue":p[65]||(p[65]=x=>y.value.config.spread=x)},null,8,["modelValue"])):$e("",!0)],512),[[Cn,!U.shape]])]),w("div",uk,[w("div",{class:"group-head",onClick:p[67]||(p[67]=x=>Y("attr"))},[w("span",dk,Ye(U.attr?"▸":"▾"),1),p[250]||(p[250]=w("span",null,"粒子属性",-1)),w("button",{class:"group-reset",title:"重置粒子属性参数",onClick:p[66]||(p[66]=xt(x=>te("attr"),["stop"]))},"重置")]),xe(w("div",fk,[p[258]||(p[258]=w("div",{class:"attr-section-title"},"粒子初始参数",-1)),Ne(nn,{label:"初始生命周期","allow-curve":!1,mode:y.value.config.lifeMode,"onUpdate:mode":p[68]||(p[68]=x=>y.value.config.lifeMode=x),"value-min":y.value.config.lifeMin,"onUpdate:valueMin":p[69]||(p[69]=x=>y.value.config.lifeMin=x),"value-max":y.value.config.lifeMax,"onUpdate:valueMax":p[70]||(p[70]=x=>y.value.config.lifeMax=x),curve:y.value.config.lifeCurve,"onUpdate:curve":p[71]||(p[71]=x=>y.value.config.lifeCurve=x),min:.1,max:10,step:.1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),Ne(nn,{label:"初始速度","allow-curve":!1,mode:y.value.config.speedMode,"onUpdate:mode":p[72]||(p[72]=x=>y.value.config.speedMode=x),"value-min":y.value.config.speedMin,"onUpdate:valueMin":p[73]||(p[73]=x=>y.value.config.speedMin=x),"value-max":y.value.config.speedMax,"onUpdate:valueMax":p[74]||(p[74]=x=>y.value.config.speedMax=x),curve:y.value.config.speedCurve,"onUpdate:curve":p[75]||(p[75]=x=>y.value.config.speedCurve=x),min:0,max:1e3,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),w("div",pk,[p[251]||(p[251]=w("span",null,"初始缩放",-1)),w("div",mk,[w("button",{class:Ze(["axis-mode",{on:y.value.config.scaleAxisMode==="uniform"}]),onClick:p[76]||(p[76]=x=>y.value.config.scaleAxisMode="uniform")},"统一",2),w("button",{class:Ze(["axis-mode",{on:y.value.config.scaleAxisMode==="separate"}]),onClick:p[77]||(p[77]=x=>y.value.config.scaleAxisMode="separate")},"XY分离",2)])]),Ne(nn,{label:y.value.config.scaleAxisMode==="uniform"?"初始缩放":"缩放 X","allow-curve":!1,mode:y.value.config.scaleMode,"onUpdate:mode":p[78]||(p[78]=x=>y.value.config.scaleMode=x),"value-min":y.value.config.scaleMin,"onUpdate:valueMin":p[79]||(p[79]=x=>y.value.config.scaleMin=x),"value-max":y.value.config.scaleMax,"onUpdate:valueMax":p[80]||(p[80]=x=>y.value.config.scaleMax=x),curve:y.value.config.scaleCurve,"onUpdate:curve":p[81]||(p[81]=x=>y.value.config.scaleCurve=x),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["label","mode","value-min","value-max","curve"]),y.value.config.scaleAxisMode==="separate"?(se(),Et(nn,{key:0,label:"缩放 Y","show-modes":!1,"allow-curve":!1,mode:y.value.config.scaleMode,"onUpdate:mode":p[82]||(p[82]=x=>y.value.config.scaleMode=x),"value-min":y.value.config.scaleYMin,"onUpdate:valueMin":p[83]||(p[83]=x=>y.value.config.scaleYMin=x),"value-max":y.value.config.scaleYMax,"onUpdate:valueMax":p[84]||(p[84]=x=>y.value.config.scaleYMax=x),curve:y.value.config.scaleYCurve,"onUpdate:curve":p[85]||(p[85]=x=>y.value.config.scaleYCurve=x),min:0,max:5,step:.05,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"])):$e("",!0),Ne(nn,{label:"初始旋转","allow-direction":"","allow-curve":!1,mode:y.value.config.initialRotationMode,"onUpdate:mode":p[86]||(p[86]=x=>y.value.config.initialRotationMode=x),"value-min":y.value.config.initialRotationMin,"onUpdate:valueMin":p[87]||(p[87]=x=>y.value.config.initialRotationMin=x),"value-max":y.value.config.initialRotationMax,"onUpdate:valueMax":p[88]||(p[88]=x=>y.value.config.initialRotationMax=x),curve:y.value.config.initialRotationCurve,"onUpdate:curve":p[89]||(p[89]=x=>y.value.config.initialRotationCurve=x),min:-360,max:360,step:1,"curve-label":"随机采样 →"},null,8,["mode","value-min","value-max","curve"]),p[259]||(p[259]=w("div",{class:"attr-section-title life-title"},"粒子生命周期变化参数",-1)),w("div",gk,[w("label",vk,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[90]||(p[90]=x=>y.value.config.speedOverLifeEnabled=x)},null,512),[[Lt,y.value.config.speedOverLifeEnabled]]),p[252]||(p[252]=w("span",{class:"switch-ui"},null,-1)),p[253]||(p[253]=w("span",null,"生命周期内速度",-1))]),y.value.config.speedOverLifeEnabled?(se(),Et(nn,{key:0,label:"速度倍率",mode:y.value.config.speedOverLifeMode,"onUpdate:mode":Ie,"value-min":y.value.config.speedOverLifeMin,"onUpdate:valueMin":p[91]||(p[91]=x=>y.value.config.speedOverLifeMin=x),"value-max":y.value.config.speedOverLifeMax,"onUpdate:valueMax":p[92]||(p[92]=x=>y.value.config.speedOverLifeMax=x),curve:y.value.config.speedOverLifeCurve,"onUpdate:curve":p[93]||(p[93]=x=>y.value.config.speedOverLifeCurve=x),"default-curve":j,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):$e("",!0)]),w("div",yk,[w("label",xk,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[94]||(p[94]=x=>y.value.config.scaleOverLifeEnabled=x),onChange:Be},null,544),[[Lt,y.value.config.scaleOverLifeEnabled]]),p[254]||(p[254]=w("span",{class:"switch-ui"},null,-1)),p[255]||(p[255]=w("span",null,"生命周期内缩放",-1))]),y.value.config.scaleOverLifeEnabled?(se(),ce(qe,{key:0},[w("div",bk,[w("button",{class:Ze(["axis-mode",{on:y.value.config.scaleOverLifeAxisMode==="uniform"}]),onClick:p[95]||(p[95]=x=>y.value.config.scaleOverLifeAxisMode="uniform")},"统一",2),w("button",{class:Ze(["axis-mode",{on:y.value.config.scaleOverLifeAxisMode==="separate"}]),onClick:p[96]||(p[96]=x=>y.value.config.scaleOverLifeAxisMode="separate")},"XY分离",2)]),Ne(nn,{label:y.value.config.scaleOverLifeAxisMode==="uniform"?"缩放倍率":"倍率 X",mode:y.value.config.scaleOverLifeMode,"onUpdate:mode":Ke,"value-min":y.value.config.scaleOverLifeMin,"onUpdate:valueMin":p[97]||(p[97]=x=>y.value.config.scaleOverLifeMin=x),"value-max":y.value.config.scaleOverLifeMax,"onUpdate:valueMax":p[98]||(p[98]=x=>y.value.config.scaleOverLifeMax=x),curve:y.value.config.scaleOverLifeCurve,"onUpdate:curve":p[99]||(p[99]=x=>y.value.config.scaleOverLifeCurve=x),"default-curve":j,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["label","mode","value-min","value-max","curve"]),y.value.config.scaleOverLifeAxisMode==="separate"?(se(),Et(nn,{key:0,label:"倍率 Y","show-modes":!1,mode:y.value.config.scaleOverLifeMode,"onUpdate:mode":p[100]||(p[100]=x=>y.value.config.scaleOverLifeMode=x),"value-min":y.value.config.scaleYOverLifeMin,"onUpdate:valueMin":p[101]||(p[101]=x=>y.value.config.scaleYOverLifeMin=x),"value-max":y.value.config.scaleYOverLifeMax,"onUpdate:valueMax":p[102]||(p[102]=x=>y.value.config.scaleYOverLifeMax=x),curve:y.value.config.scaleYOverLifeCurve,"onUpdate:curve":p[103]||(p[103]=x=>y.value.config.scaleYOverLifeCurve=x),"default-curve":j,min:0,max:3,step:.05,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):$e("",!0)],64)):$e("",!0)]),w("div",wk,[w("label",_k,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[104]||(p[104]=x=>y.value.config.rotationOverLifeEnabled=x)},null,512),[[Lt,y.value.config.rotationOverLifeEnabled]]),p[256]||(p[256]=w("span",{class:"switch-ui"},null,-1)),p[257]||(p[257]=w("span",null,"生命周期内旋转",-1))]),y.value.config.rotationOverLifeEnabled?(se(),Et(nn,{key:0,label:"旋转速度",mode:y.value.config.rotationOverLifeMode,"onUpdate:mode":p[105]||(p[105]=x=>y.value.config.rotationOverLifeMode=x),"value-min":y.value.config.rotationSpeedMin,"onUpdate:valueMin":p[106]||(p[106]=x=>y.value.config.rotationSpeedMin=x),"value-max":y.value.config.rotationSpeedMax,"onUpdate:valueMax":p[107]||(p[107]=x=>y.value.config.rotationSpeedMax=x),curve:y.value.config.rotationOverLifeCurve,"onUpdate:curve":p[108]||(p[108]=x=>y.value.config.rotationOverLifeCurve=x),"default-curve":N,min:-720,max:720,step:10,"curve-label":"生命周期 →"},null,8,["mode","value-min","value-max","curve"])):$e("",!0)])],512),[[Cn,!U.attr]])]),w("div",Sk,[w("div",{class:"group-head",onClick:p[110]||(p[110]=x=>Y("look"))},[w("span",Tk,Ye(U.look?"▸":"▾"),1),p[260]||(p[260]=w("span",null,"外观与资源",-1)),w("button",{class:"group-reset",title:"重置外观与资源参数",onClick:p[109]||(p[109]=xt(x=>te("look"),["stop"]))},"重置")]),xe(w("div",Mk,[p[274]||(p[274]=w("div",{class:"look-title"},"透明度",-1)),w("div",Ek,[w("button",{class:Ze(["seg-btn",{active:y.value.config.alphaMode==="curve"}]),onClick:p[111]||(p[111]=x=>y.value.config.alphaMode="curve")},"曲线",2),w("button",{class:Ze(["seg-btn",{active:y.value.config.alphaMode==="fixed"}]),onClick:p[112]||(p[112]=x=>y.value.config.alphaMode="fixed")},"固定",2)]),y.value.config.alphaMode==="fixed"?(se(),Et(Ge,{key:0,label:"透明度",min:0,max:1,step:.01,modelValue:y.value.config.alpha,"onUpdate:modelValue":p[113]||(p[113]=x=>y.value.config.alpha=x)},null,8,["modelValue"])):(se(),ce(qe,{key:1},[w("label",Ak,[p[262]||(p[262]=w("span",null,"曲线模式",-1)),xe(w("select",{"onUpdate:modelValue":p[114]||(p[114]=x=>y.value.config.curveMode=x),class:"inp"},[...p[261]||(p[261]=[w("option",null,"跟随导出",-1),w("option",null,"线性",-1),w("option",null,"贝塞尔",-1)])],512),[[kt,y.value.config.curveMode]])]),w("div",Ck,[Ne(Is,{modelValue:y.value.config.alphaCurve,"onUpdate:modelValue":p[115]||(p[115]=x=>y.value.config.alphaCurve=x),"default-value":O,mode:f(y.value.config.curveMode)},null,8,["modelValue","mode"]),p[263]||(p[263]=w("div",{class:"curve-labels"},[w("span",null,"0(透明)"),w("span",null,"生命周期 →"),w("span",null,"1(不透明)")],-1))])],64)),w("div",{class:"look-title image-title"},[p[264]||(p[264]=w("span",null,"图片资源",-1)),w("button",{class:"image-add",title:"新增图片资源",onClick:er},"+")]),(se(!0),ce(qe,null,Ht(y.value.config.imageResources,x=>(se(),Et(mg,{key:x.id,resource:x,"resource-count":y.value.config.imageResources.length,"supports-sequence":"","default-file":"star.png",onPick:Oi,onPickSequence:Qt,onReset:Zs,onRemove:bs,onUpdateWeight:tr,onToggleLock:G},{default:Fu(()=>[Ne(Ge,{label:"缩放",min:.1,max:3,step:.05,modelValue:x.scale,"onUpdate:modelValue":V=>x.scale=V},null,8,["modelValue","onUpdate:modelValue"]),w("label",Ik,[p[265]||(p[265]=w("span",null,"轴心 x,y",-1)),xe(w("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":V=>x.anchorX=V},null,8,Rk),[[Je,x.anchorX,void 0,{number:!0}]]),xe(w("input",{type:"number",step:"0.05",class:"inp tiny","onUpdate:modelValue":V=>x.anchorY=V},null,8,Pk),[[Je,x.anchorY,void 0,{number:!0}]])]),p[273]||(p[273]=w("div",{class:"resource-divider"},null,-1)),w("label",kk,[p[268]||(p[268]=w("span",null,"颜色",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.colorMode=V,class:"inp"},[...p[266]||(p[266]=[w("option",{value:"fixed"},"固定色",-1),w("option",{value:"lifetime"},"生命周期",-1)])],8,Fk),[[kt,x.colorMode]]),xe(w("select",{"onUpdate:modelValue":V=>x.blend=V,class:"inp blend-select"},[...p[267]||(p[267]=[w("option",{value:"normal"},"正常",-1),w("option",{value:"add"},"相加",-1),w("option",{value:"multiply"},"相乘",-1),w("option",{value:"screen"},"滤色",-1)])],8,Ok),[[kt,x.blend]])]),x.colorMode==="fixed"?(se(),ce("label",Bk,[p[269]||(p[269]=w("span",null,"固定色",-1)),xe(w("input",{type:"color","onUpdate:modelValue":V=>x.colorStart=V,class:"colr"},null,8,Lk),[[Je,x.colorStart]]),w("input",{type:"text",class:"hex-input",value:x.colorStart,spellcheck:"false","aria-label":"固定颜色值",onChange:V=>Js(x,V),onKeydown:da(V=>An(x,V),["enter"])},null,40,Dk)])):(se(),Et(pg,{key:1,modelValue:x.colorGradient,"onUpdate:modelValue":V=>x.colorGradient=V},null,8,["modelValue","onUpdate:modelValue"])),w("div",Nk,[p[270]||(p[270]=w("span",null,"独立透明度",-1)),w("div",Uk,[w("button",{class:Ze({on:x.independentAlpha==="off"}),onClick:V=>x.independentAlpha="off"},"关闭",10,Vk),w("button",{class:Ze({on:x.independentAlpha==="fixed"}),onClick:V=>x.independentAlpha="fixed"},"固定",10,Xk),w("button",{class:Ze({on:x.independentAlpha==="curve"}),onClick:V=>x.independentAlpha="curve"},"曲线",10,Yk)])]),x.independentAlpha==="fixed"?(se(),Et(Ge,{key:2,label:"透明度",min:0,max:1,step:.01,modelValue:x.alpha,"onUpdate:modelValue":V=>x.alpha=V},null,8,["modelValue","onUpdate:modelValue"])):x.independentAlpha==="curve"?(se(),ce(qe,{key:3},[w("label",$k,[p[272]||(p[272]=w("span",null,"曲线模式",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.alphaCurveMode=V,class:"inp"},[...p[271]||(p[271]=[w("option",null,"跟随导出",-1),w("option",null,"线性",-1),w("option",null,"贝塞尔",-1)])],8,Gk),[[kt,x.alphaCurveMode]])]),w("div",jk,[Ne(Is,{modelValue:x.alphaCurve,"onUpdate:modelValue":V=>x.alphaCurve=V,"default-value":L,mode:f(x.alphaCurveMode)},null,8,["modelValue","onUpdate:modelValue","mode"])])],64)):$e("",!0)]),_:2},1032,["resource","resource-count"]))),128)),w("input",{ref_key:"textureFileInput",ref:dt,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:Pr},null,544),w("input",{ref_key:"sequenceFileInput",ref:Mt,class:"file-input",type:"file",multiple:"",accept:"image/png,image/jpeg,image/webp,image/gif",onChange:kr},null,544)],512),[[Cn,!U.look]])]),w("div",Hk,[w("div",{class:"group-head",onClick:p[117]||(p[117]=x=>Y("mods"))},[w("span",Wk,Ye(U.mods?"▸":"▾"),1),p[275]||(p[275]=w("span",null,"修改器",-1)),w("button",{class:"group-reset",title:"重置修改器参数",onClick:p[116]||(p[116]=xt(x=>te("mods"),["stop"]))},"重置")]),xe(w("div",zk,[w("div",qk,[w("label",Kk,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[118]||(p[118]=x=>y.value.config.noise=x)},null,512),[[Lt,y.value.config.noise]]),p[276]||(p[276]=w("span",{class:"switch-ui"},null,-1)),p[277]||(p[277]=w("span",null,"开启移动噪声",-1))]),y.value.config.noise?(se(),ce("div",Zk,[Ne(Ge,{label:"强度",min:0,max:100,step:1,modelValue:y.value.config.noiseAmt,"onUpdate:modelValue":p[119]||(p[119]=x=>y.value.config.noiseAmt=x)},null,8,["modelValue"]),Ne(Ge,{label:"波动范围",min:0,max:500,step:1,modelValue:y.value.config.noiseRange,"onUpdate:modelValue":p[120]||(p[120]=x=>y.value.config.noiseRange=x)},null,8,["modelValue"]),Ne(Ge,{label:"时间流速",min:0,max:10,step:.1,modelValue:y.value.config.noiseSpeed,"onUpdate:modelValue":p[121]||(p[121]=x=>y.value.config.noiseSpeed=x)},null,8,["modelValue"]),p[278]||(p[278]=w("div",{class:"modifier-hint"},"强度控制影响比例 · 波动范围控制最大偏移 · 时间流速控制变化速度",-1))])):$e("",!0)]),w("div",Jk,[w("label",Qk,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[122]||(p[122]=x=>y.value.config.useGravity=x)},null,512),[[Lt,y.value.config.useGravity]]),p[279]||(p[279]=w("span",{class:"switch-ui"},null,-1)),p[280]||(p[280]=w("span",null,"开启重力",-1))]),y.value.config.useGravity?(se(),ce("div",eF,[w("div",tF,[w("button",{class:Ze(["axis-mode",{on:y.value.config.gravityMode==="fixed"}]),onClick:p[123]||(p[123]=x=>y.value.config.gravityMode="fixed")},"固定",2),w("button",{class:Ze(["axis-mode",{on:y.value.config.gravityMode==="random"}]),onClick:p[124]||(p[124]=x=>y.value.config.gravityMode="random")},"随机",2)]),y.value.config.gravityMode==="fixed"?(se(),Et(Ge,{key:0,label:"重力强度",min:-3e3,max:3e3,step:10,modelValue:y.value.config.gravityMin,"onUpdate:modelValue":p[125]||(p[125]=x=>y.value.config.gravityMin=x)},null,8,["modelValue"])):(se(),ce(qe,{key:1},[Ne(Ge,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:y.value.config.gravityMin,"onUpdate:modelValue":p[126]||(p[126]=x=>y.value.config.gravityMin=x)},null,8,["modelValue"]),Ne(Ge,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:y.value.config.gravityMax,"onUpdate:modelValue":p[127]||(p[127]=x=>y.value.config.gravityMax=x)},null,8,["modelValue"])],64)),Ne(Ge,{label:"方向",min:-360,max:360,step:1,modelValue:y.value.config.gravityDirection,"onUpdate:modelValue":p[128]||(p[128]=x=>y.value.config.gravityDirection=x)},null,8,["modelValue"]),p[281]||(p[281]=w("div",{class:"gravity-curve-title"},[w("span",null,"生命周期内重力"),w("span",null,"纵轴:强度 0~1")],-1)),Ne(Is,{modelValue:y.value.config.gravityCurve,"onUpdate:modelValue":p[129]||(p[129]=x=>y.value.config.gravityCurve=x),"default-value":j},null,8,["modelValue"]),p[282]||(p[282]=w("div",{class:"gravity-curve-axis"},[w("span",null,"0"),w("span",null,"生命周期 →"),w("span",null,"1")],-1)),p[283]||(p[283]=w("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):$e("",!0)]),w("div",iF,[w("label",sF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[130]||(p[130]=x=>y.value.config.wind=x)},null,512),[[Lt,y.value.config.wind]]),p[284]||(p[284]=w("span",{class:"switch-ui"},null,-1)),p[285]||(p[285]=w("span",null,"开启风力",-1))]),y.value.config.wind?(se(),ce("div",nF,[w("div",rF,[w("button",{class:Ze(["axis-mode",{on:y.value.config.windMode==="fixed"}]),onClick:p[131]||(p[131]=x=>y.value.config.windMode="fixed")},"固定",2),w("button",{class:Ze(["axis-mode",{on:y.value.config.windMode==="random"}]),onClick:p[132]||(p[132]=x=>y.value.config.windMode="random")},"随机",2)]),y.value.config.windMode==="fixed"?(se(),Et(Ge,{key:0,label:"风力强度",min:-3e3,max:3e3,step:10,modelValue:y.value.config.windMin,"onUpdate:modelValue":p[133]||(p[133]=x=>y.value.config.windMin=x)},null,8,["modelValue"])):(se(),ce(qe,{key:1},[Ne(Ge,{label:"强度 min",min:-3e3,max:3e3,step:10,modelValue:y.value.config.windMin,"onUpdate:modelValue":p[134]||(p[134]=x=>y.value.config.windMin=x)},null,8,["modelValue"]),Ne(Ge,{label:"强度 max",min:-3e3,max:3e3,step:10,modelValue:y.value.config.windMax,"onUpdate:modelValue":p[135]||(p[135]=x=>y.value.config.windMax=x)},null,8,["modelValue"])],64)),Ne(Ge,{label:"方向",min:-360,max:360,step:1,modelValue:y.value.config.windDirection,"onUpdate:modelValue":p[136]||(p[136]=x=>y.value.config.windDirection=x)},null,8,["modelValue"]),p[286]||(p[286]=w("div",{class:"gravity-curve-title"},[w("span",null,"生命周期内风力"),w("span",null,"纵轴:强度 0~1")],-1)),Ne(Is,{modelValue:y.value.config.windCurve,"onUpdate:modelValue":p[137]||(p[137]=x=>y.value.config.windCurve=x),"default-value":j},null,8,["modelValue"]),p[287]||(p[287]=w("div",{class:"gravity-curve-axis"},[w("span",null,"0"),w("span",null,"生命周期 →"),w("span",null,"1")],-1)),p[288]||(p[288]=w("div",{class:"modifier-hint"},"0° 向右 · -90° 向下 · 负强度会反转方向",-1))])):$e("",!0)]),w("div",oF,[w("label",aF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[138]||(p[138]=x=>y.value.config.forceField=x)},null,512),[[Lt,y.value.config.forceField]]),p[289]||(p[289]=w("span",{class:"switch-ui"},null,-1)),p[290]||(p[290]=w("span",null,"开启力场",-1))]),y.value.config.forceField?(se(),ce("div",lF,[Ne(Ge,{label:"中心 X",min:-5e3,max:5e3,step:1,modelValue:y.value.config.forceCenterX,"onUpdate:modelValue":p[139]||(p[139]=x=>y.value.config.forceCenterX=x)},null,8,["modelValue"]),Ne(Ge,{label:"中心 Y",min:-5e3,max:5e3,step:1,modelValue:y.value.config.forceCenterY,"onUpdate:modelValue":p[140]||(p[140]=x=>y.value.config.forceCenterY=x)},null,8,["modelValue"]),Ne(Ge,{label:"力场强度",min:-300,max:300,step:1,modelValue:y.value.config.forceStrength,"onUpdate:modelValue":p[141]||(p[141]=x=>y.value.config.forceStrength=x)},null,8,["modelValue"]),Ne(Ge,{label:"力场半径",min:1,max:2e3,step:1,modelValue:y.value.config.forceRadius,"onUpdate:modelValue":p[142]||(p[142]=x=>y.value.config.forceRadius=x)},null,8,["modelValue"]),w("label",hF,[p[292]||(p[292]=w("span",null,"衰减模式",-1)),xe(w("select",{"onUpdate:modelValue":p[143]||(p[143]=x=>y.value.config.forceFalloff=x),class:"inp"},[...p[291]||(p[291]=[w("option",{value:"constant"},"恒定(范围内力度不变)",-1),w("option",{value:"linear"},"线性衰减(边缘为 0)",-1),w("option",{value:"inverse"},"距离反比(中心最强)",-1)])],512),[[kt,y.value.config.forceFalloff]])]),p[293]||(p[293]=w("div",{class:"modifier-hint"},"正数吸向中心 · 负数向外排斥 · 可在画布内拖动力场圆",-1))])):$e("",!0)]),w("div",cF,[w("label",uF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[144]||(p[144]=x=>y.value.config.attraction=x)},null,512),[[Lt,y.value.config.attraction]]),p[294]||(p[294]=w("span",{class:"switch-ui"},null,-1)),p[295]||(p[295]=w("span",null,"开启吸附",-1))]),y.value.config.attraction?(se(),ce("div",dF,[Ne(Ge,{label:"吸附点 X",min:-5e3,max:5e3,step:1,modelValue:y.value.config.attractionCenterX,"onUpdate:modelValue":p[145]||(p[145]=x=>y.value.config.attractionCenterX=x)},null,8,["modelValue"]),Ne(Ge,{label:"吸附点 Y",min:-5e3,max:5e3,step:1,modelValue:y.value.config.attractionCenterY,"onUpdate:modelValue":p[146]||(p[146]=x=>y.value.config.attractionCenterY=x)},null,8,["modelValue"]),Ne(Ge,{label:"吸附半径",min:0,max:2e3,step:1,modelValue:y.value.config.attractionRadius,"onUpdate:modelValue":p[147]||(p[147]=x=>y.value.config.attractionRadius=x)},null,8,["modelValue"]),Ne(Ge,{label:"吸附时长",min:.05,max:30,step:.05,modelValue:y.value.config.attractionDuration,"onUpdate:modelValue":p[148]||(p[148]=x=>y.value.config.attractionDuration=x)},null,8,["modelValue"]),Ne(Ge,{label:"延迟时间",min:0,max:30,step:.05,modelValue:y.value.config.attractionDelay,"onUpdate:modelValue":p[149]||(p[149]=x=>y.value.config.attractionDelay=x)},null,8,["modelValue"]),w("label",fF,[p[297]||(p[297]=w("span",null,"延迟方式",-1)),xe(w("select",{"onUpdate:modelValue":p[150]||(p[150]=x=>y.value.config.attractionDelayMode=x),class:"inp"},[...p[296]||(p[296]=[w("option",{value:"global"},"统一时间",-1),w("option",{value:"particle"},"单粒子生命",-1)])],512),[[kt,y.value.config.attractionDelayMode]])]),w("label",pF,[p[299]||(p[299]=w("span",null,"吸附方式",-1)),xe(w("select",{"onUpdate:modelValue":p[151]||(p[151]=x=>y.value.config.attractionPath=x),class:"inp"},[...p[298]||(p[298]=[w("option",{value:"linear"},"直线",-1),w("option",{value:"curve"},"曲线",-1)])],512),[[kt,y.value.config.attractionPath]])]),p[300]||(p[300]=w("div",{class:"modifier-hint"},"延迟后从当前位置开始吸附 · 到达红色范围即死亡 · 可在画布内拖动吸附圆",-1))])):$e("",!0)]),w("div",mF,[w("label",gF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[152]||(p[152]=x=>y.value.config.trail=x)},null,512),[[Lt,y.value.config.trail]]),p[301]||(p[301]=w("span",{class:"switch-ui"},null,-1)),p[302]||(p[302]=w("span",null,"开启拖尾",-1))]),y.value.config.trail?(se(),ce("div",vF,[w("div",{class:"trail-section-head"},[p[303]||(p[303]=w("div",{class:"trail-section-title"},"拖尾独立图片",-1)),w("button",{class:"image-add",title:"增加拖尾图片资源",onClick:Zi},"+")]),(se(!0),ce(qe,null,Ht(y.value.config.trailResources,x=>(se(),Et(mg,{key:x.id,resource:x,"resource-count":y.value.config.trailResources.length,"default-file":"trail.png","name-placeholder":"trail","show-folder":!1,onPick:xs,onReset:It,onRemove:Pt,onUpdateWeight:$i,onToggleLock:Ji},{default:Fu(()=>[p[319]||(p[319]=w("div",{class:"resource-divider"},null,-1)),Ne(Ge,{label:"旋转",min:-360,max:360,step:1,"model-value":x.rotation,"onUpdate:modelValue":V=>le(x.id,V)},null,8,["model-value","onUpdate:modelValue"]),Ne(Ge,{label:"拖尾骨骼数",min:2,max:16,step:1,"model-value":x.boneCount,"onUpdate:modelValue":V=>re(x.id,V)},null,8,["model-value","onUpdate:modelValue"]),Ne(Ge,{label:"拖尾比例 (%)",min:0,max:100,step:1,modelValue:x.trailRatio,"onUpdate:modelValue":V=>x.trailRatio=V},null,8,["modelValue","onUpdate:modelValue"]),w("label",yF,[p[305]||(p[305]=w("span",null,"拖尾长度",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.lengthMode=V,class:"inp"},[...p[304]||(p[304]=[w("option",{value:"fixed"},"固定",-1),w("option",{value:"random"},"随机范围",-1)])],8,xF),[[kt,x.lengthMode]])]),x.lengthMode==="fixed"?(se(),Et(Ge,{key:0,label:"长度比例 (%)",min:0,max:500,step:1,modelValue:x.length,"onUpdate:modelValue":V=>x.length=V},null,8,["modelValue","onUpdate:modelValue"])):(se(),ce(qe,{key:1},[Ne(Ge,{label:"长度最小 (%)",min:0,max:500,step:1,modelValue:x.lengthMin,"onUpdate:modelValue":V=>x.lengthMin=V},null,8,["modelValue","onUpdate:modelValue"]),Ne(Ge,{label:"长度最大 (%)",min:0,max:500,step:1,modelValue:x.lengthMax,"onUpdate:modelValue":V=>x.lengthMax=V},null,8,["modelValue","onUpdate:modelValue"])],64)),w("label",bF,[p[307]||(p[307]=w("span",null,"拖尾宽度",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.widthSizeMode=V,class:"inp"},[...p[306]||(p[306]=[w("option",{value:"fixed"},"固定",-1),w("option",{value:"random"},"随机范围",-1)])],8,wF),[[kt,x.widthSizeMode]])]),x.widthSizeMode==="fixed"?(se(),Et(Ge,{key:2,label:"宽度比例 (%)",min:0,max:500,step:1,modelValue:x.width,"onUpdate:modelValue":V=>x.width=V},null,8,["modelValue","onUpdate:modelValue"])):(se(),ce(qe,{key:3},[Ne(Ge,{label:"宽度最小 (%)",min:0,max:500,step:1,modelValue:x.widthMin,"onUpdate:modelValue":V=>x.widthMin=V},null,8,["modelValue","onUpdate:modelValue"]),Ne(Ge,{label:"宽度最大 (%)",min:0,max:500,step:1,modelValue:x.widthMax,"onUpdate:modelValue":V=>x.widthMax=V},null,8,["modelValue","onUpdate:modelValue"])],64)),w("label",_F,[p[309]||(p[309]=w("span",null,"宽度缩放",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.widthMode=V,class:"inp"},[...p[308]||(p[308]=[w("option",{value:"particle"},"跟随粒子",-1),w("option",{value:"fixed"},"固定",-1)])],8,SF),[[kt,x.widthMode]])]),w("label",TF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":V=>x.lifeLengthEnabled=V},null,8,MF),[[Lt,x.lifeLengthEnabled]]),p[310]||(p[310]=w("span",{class:"switch-ui"},null,-1)),p[311]||(p[311]=w("span",null,"生命周期长度曲线",-1))]),x.lifeLengthEnabled?(se(),Et(Is,{key:4,modelValue:x.lifeLengthCurve,"onUpdate:modelValue":V=>x.lifeLengthCurve=V,"default-value":j},null,8,["modelValue","onUpdate:modelValue"])):$e("",!0),w("label",EF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":V=>x.shapeEnabled=V},null,8,AF),[[Lt,x.shapeEnabled]]),p[312]||(p[312]=w("span",{class:"switch-ui"},null,-1)),p[313]||(p[313]=w("span",null,"形状曲线(首端 → 尾端宽度)",-1))]),x.shapeEnabled?(se(),Et(Is,{key:5,modelValue:x.shapeCurve,"onUpdate:modelValue":V=>x.shapeCurve=V,"default-value":X},null,8,["modelValue","onUpdate:modelValue"])):$e("",!0),w("div",CF,[p[314]||(p[314]=w("span",null,"颜色模式",-1)),w("div",IF,[w("button",{class:Ze(["axis-mode",{on:x.colorMode==="particle"}]),onClick:V=>x.colorMode="particle"},"跟随粒子",10,RF),w("button",{class:Ze(["axis-mode",{on:x.colorMode==="fixed"}]),onClick:V=>x.colorMode="fixed"},"固定",10,PF),w("button",{class:Ze(["axis-mode",{on:x.colorMode==="curve"}]),onClick:V=>x.colorMode="curve"},"曲线",10,kF)])]),w("label",FF,[p[316]||(p[316]=w("span",null,"混合模式",-1)),xe(w("select",{"onUpdate:modelValue":V=>x.blend=V,class:"inp"},[...p[315]||(p[315]=[w("option",{value:"normal"},"正常",-1),w("option",{value:"add"},"相加",-1),w("option",{value:"multiply"},"相乘",-1),w("option",{value:"screen"},"滤色",-1)])],8,OF),[[kt,x.blend]])]),x.colorMode==="fixed"?(se(),ce("label",BF,[p[317]||(p[317]=w("span",null,"固定颜色",-1)),xe(w("input",{class:"colr",type:"color","onUpdate:modelValue":V=>x.color=V},null,8,LF),[[Je,x.color]]),w("input",{class:"hex-input",value:x.color,onChange:V=>li(x,V),onKeydown:da(xt(V=>Gi(x,V),["prevent"]),["enter"])},null,40,DF)])):x.colorMode==="curve"?(se(),Et(pg,{key:7,modelValue:x.colorGradient,"onUpdate:modelValue":V=>x.colorGradient=V},null,8,["modelValue","onUpdate:modelValue"])):$e("",!0),w("div",NF,[p[318]||(p[318]=w("span",null,"透明度模式",-1)),w("div",UF,[w("button",{class:Ze(["axis-mode",{on:x.alphaMode==="particle"}]),onClick:V=>x.alphaMode="particle"},"跟随粒子",10,VF),w("button",{class:Ze(["axis-mode",{on:x.alphaMode==="fixed"}]),onClick:V=>x.alphaMode="fixed"},"固定",10,XF),w("button",{class:Ze(["axis-mode",{on:x.alphaMode==="curve"}]),onClick:V=>x.alphaMode="curve"},"曲线",10,YF)])]),x.alphaMode==="fixed"?(se(),Et(Ge,{key:8,label:"透明度",min:0,max:1,step:.01,modelValue:x.alpha,"onUpdate:modelValue":V=>x.alpha=V},null,8,["modelValue","onUpdate:modelValue"])):$e("",!0),x.alphaMode==="curve"?(se(),Et(Is,{key:9,modelValue:x.alphaCurve,"onUpdate:modelValue":V=>x.alphaCurve=V,"default-value":P},null,8,["modelValue","onUpdate:modelValue"])):$e("",!0)]),_:2},1032,["resource","resource-count"]))),128)),w("input",{ref_key:"trailTextureFileInput",ref:ai,class:"file-input",type:"file",accept:"image/png,image/jpeg,image/webp",onChange:ft},null,544),w("div",$F,[Ne(Ge,{label:"网格行数",min:2,max:16,step:1,"model-value":y.value.config.trailGridRows,"onUpdate:modelValue":p[153]||(p[153]=x=>$t("trailGridRows",x))},null,8,["model-value"]),Ne(Ge,{label:"网格列数",min:2,max:32,step:1,"model-value":y.value.config.trailGridCols,"onUpdate:modelValue":p[154]||(p[154]=x=>$t("trailGridCols",x))},null,8,["model-value"])]),p[320]||(p[320]=w("div",{class:"modifier-hint"},"每个粒子按资源比例生成一组同级拖尾骨骼;随机长度与宽度在粒子出生时确定,相同种子可稳定复现",-1))])):$e("",!0)]),w("div",GF,[w("label",jF,[xe(w("input",{type:"checkbox","onUpdate:modelValue":p[155]||(p[155]=x=>y.value.config.emitterFollow=x),disabled:y.value.config.streamBehavior==="loop"},null,8,HF),[[Lt,y.value.config.emitterFollow]]),p[321]||(p[321]=w("span",{class:"switch-ui"},null,-1)),p[322]||(p[322]=w("span",null,"开启发射器跟随",-1))]),y.value.config.emitterFollow&&y.value.config.streamBehavior!=="loop"?(se(),ce("div",WF,[w("label",zF,[p[325]||(p[325]=w("span",null,"跟随模式",-1)),w("select",{value:y.value.config.emitterFollowMode,class:"inp",onChange:p[156]||(p[156]=x=>ae(x,y.value.config))},[p[323]||(p[323]=w("option",{value:"none"},"无",-1)),p[324]||(p[324]=w("option",{value:"path"},"跟随路径",-1)),F.value||y.value.config.emitterFollowMode==="bone"?(se(),ce("option",KF,"选中的骨骼")):$e("",!0)],40,qF)]),y.value.config.emitterFollowMode==="path"?(se(),ce(qe,{key:0},[w("label",ZF,[p[327]||(p[327]=w("span",null,"跟随路径",-1)),xe(w("select",{"onUpdate:modelValue":p[157]||(p[157]=x=>y.value.config.emitterFollowPathId=x),class:"inp"},[p[326]||(p[326]=w("option",{value:0},"无",-1)),(se(!0),ce(qe,null,Ht(Pe(e).paths,x=>(se(),ce("option",{key:x.id,value:x.id},Ye(x.name),9,JF))),128))],512),[[kt,y.value.config.emitterFollowPathId,void 0,{number:!0}]])]),w("label",QF,[p[329]||(p[329]=w("span",null,"发射器角度模式",-1)),xe(w("select",{"onUpdate:modelValue":p[158]||(p[158]=x=>y.value.config.emitterAngleMode=x),class:"inp"},[...p[328]||(p[328]=[w("option",{value:"fixed"},"固定角度",-1),w("option",{value:"direction"},"跟随移动方向",-1)])],512),[[kt,y.value.config.emitterAngleMode]])]),p[335]||(p[335]=w("div",{class:"gravity-curve-title"},[w("span",null,"移动进度曲线 (0→1)")],-1)),Ne(Is,{modelValue:y.value.config.emitterFollowCurve,"onUpdate:modelValue":p[159]||(p[159]=x=>y.value.config.emitterFollowCurve=x),"default-value":N},null,8,["modelValue"]),w("div",eO,[w("label",tO,[p[330]||(p[330]=w("span",null,"移动时长 (s)",-1)),xe(w("input",{"onUpdate:modelValue":p[160]||(p[160]=x=>y.value.config.emitterFollowDuration=x),type:"number",min:"0.05",step:"0.05",class:"inp"},null,512),[[Je,y.value.config.emitterFollowDuration,void 0,{number:!0}]])]),w("label",iO,[p[332]||(p[332]=w("span",null,"跟随空间",-1)),xe(w("select",{"onUpdate:modelValue":p[161]||(p[161]=x=>y.value.config.emitterFollowSpace=x),class:"inp"},[...p[331]||(p[331]=[w("option",{value:"local"},"局部空间(GEN 移动)",-1),w("option",{value:"world"},"世界空间(粒子生成点移动)",-1)])],512),[[kt,y.value.config.emitterFollowSpace]])])]),w("label",sO,[p[334]||(p[334]=w("span",null,"移动方向",-1)),xe(w("select",{"onUpdate:modelValue":p[162]||(p[162]=x=>y.value.config.emitterFollowDirection=x),class:"inp"},[...p[333]||(p[333]=[w("option",{value:"forward"},"正向(起点 → 终点)",-1),w("option",{value:"reverse"},"反向(终点 → 起点)",-1)])],512),[[kt,y.value.config.emitterFollowDirection]])]),Ne(Ge,{label:"偏移起始点 (0-1)",min:0,max:1,step:.01,modelValue:y.value.config.emitterFollowOffset,"onUpdate:modelValue":p[163]||(p[163]=x=>y.value.config.emitterFollowOffset=x)},null,8,["modelValue"]),p[336]||(p[336]=w("div",{class:"modifier-hint"},"局部空间会移动整个发射器;世界空间只移动新粒子的生成点,已出生粒子留在世界位置。",-1))],64)):y.value.config.emitterFollowMode==="bone"?(se(),ce(qe,{key:1},[D.value?(se(),ce("div",nO,[p[337]||(p[337]=Yt("跟随目标:",-1)),w("strong",null,Ye(D.value.spine.name)+" / "+Ye(D.value.boneName),1)])):(se(),ce("div",rO,"尚未绑定有效骨骼,请先在 Spine 层级树中选择骨骼。")),F.value&&(!D.value||F.value.spine.id!==D.value.spine.id||F.value.boneName!==D.value.boneName)?(se(),ce("button",{key:2,class:"bone-follow-rebind",onClick:p[164]||(p[164]=x=>me(y.value.config))},Ye(D.value?"重新绑定":"绑定")+"当前选中骨骼:"+Ye(F.value.spine.name)+" / "+Ye(F.value.boneName),1)):$e("",!0),D.value?(se(),ce(qe,{key:3},[w("label",oO,[p[339]||(p[339]=w("span",null,"跟随空间",-1)),xe(w("select",{"onUpdate:modelValue":p[165]||(p[165]=x=>y.value.config.emitterFollowSpace=x),class:"inp"},[...p[338]||(p[338]=[w("option",{value:"local"},"本地空间(随骨骼移动)",-1),w("option",{value:"world"},"世界空间(粒子生成后保持位置)",-1)])],512),[[kt,y.value.config.emitterFollowSpace]])]),w("div",aO,[w("label",lO,[p[340]||(p[340]=w("span",null,"位移偏移 X",-1)),xe(w("input",{"onUpdate:modelValue":p[166]||(p[166]=x=>y.value.config.emitterFollowBoneOffsetX=x),type:"number",step:"1",class:"inp"},null,512),[[Je,y.value.config.emitterFollowBoneOffsetX,void 0,{number:!0}]])]),w("label",hO,[p[341]||(p[341]=w("span",null,"位移偏移 Y",-1)),xe(w("input",{"onUpdate:modelValue":p[167]||(p[167]=x=>y.value.config.emitterFollowBoneOffsetY=x),type:"number",step:"1",class:"inp"},null,512),[[Je,y.value.config.emitterFollowBoneOffsetY,void 0,{number:!0}]])])]),w("div",cO,[w("label",uO,[p[342]||(p[342]=w("span",null,"旋转偏移",-1)),xe(w("input",{"onUpdate:modelValue":p[168]||(p[168]=x=>y.value.config.emitterFollowBoneRotation=x),type:"number",step:"1",class:"inp"},null,512),[[Je,y.value.config.emitterFollowBoneRotation,void 0,{number:!0}]])]),w("label",dO,[p[343]||(p[343]=w("span",null,"缩放偏移 X",-1)),xe(w("input",{"onUpdate:modelValue":p[169]||(p[169]=x=>y.value.config.emitterFollowBoneScaleX=x),type:"number",step:"0.05",class:"inp"},null,512),[[Je,y.value.config.emitterFollowBoneScaleX,void 0,{number:!0}]])]),w("label",fO,[p[344]||(p[344]=w("span",null,"缩放偏移 Y",-1)),xe(w("input",{"onUpdate:modelValue":p[170]||(p[170]=x=>y.value.config.emitterFollowBoneScaleY=x),type:"number",step:"0.05",class:"inp"},null,512),[[Je,y.value.config.emitterFollowBoneScaleY,void 0,{number:!0}]])])]),p[345]||(p[345]=w("div",{class:"modifier-hint"},"发射器只跟随所选 Spine 骨骼的位置,不继承 Spine 的旋转或缩放;粒子变换使用粒子系统自身参数和上方偏移。",-1))],64)):$e("",!0)],64)):$e("",!0)])):$e("",!0)]),Ne(Ge,{label:"阻尼",min:0,max:2,step:.05,modelValue:y.value.config.damping,"onUpdate:modelValue":p[171]||(p[171]=x=>y.value.config.damping=x)},null,8,["modelValue"])],512),[[Cn,!U.mods]])]),w("div",pO,[w("div",{class:"group-head",onClick:p[173]||(p[173]=x=>Y("export"))},[w("span",mO,Ye(U.export?"▸":"▾"),1),p[346]||(p[346]=w("span",null,"导出设置",-1)),w("button",{class:"group-reset",title:"重置导出设置",onClick:p[172]||(p[172]=xt(x=>te("export"),["stop"]))},"重置")]),xe(w("div",gO,[w("label",vO,[p[347]||(p[347]=w("span",null,"图片路径 (Spine Images Path)",-1)),xe(w("input",{"onUpdate:modelValue":p[174]||(p[174]=x=>t.value.imagesPath=x),class:"inp export-input",type:"text",placeholder:"./images/"},null,512),[[Je,t.value.imagesPath,void 0,{trim:!0}]])]),w("label",yO,[p[349]||(p[349]=w("span",null,"Spine 版本",-1)),xe(w("select",{"onUpdate:modelValue":p[175]||(p[175]=x=>t.value.spineVersion=x),class:"inp export-input"},[...p[348]||(p[348]=[w("option",{value:"3.8"},"Spine 3.8",-1),w("option",{value:"4.0"},"Spine 4.0",-1),w("option",{value:"4.1"},"Spine 4.1",-1),w("option",{value:"4.2"},"Spine 4.2",-1)])],512),[[kt,t.value.spineVersion]])]),w("label",xO,[p[351]||(p[351]=w("span",null,"关键帧插值曲线",-1)),xe(w("select",{"onUpdate:modelValue":p[176]||(p[176]=x=>t.value.keyframeCurve=x),class:"inp export-input"},[...p[350]||(p[350]=[w("option",{value:"linear"},"线性 (Linear)",-1),w("option",{value:"bezier"},"平滑贝塞尔 (Smooth Bézier)",-1)])],512),[[kt,t.value.keyframeCurve]])]),p[360]||(p[360]=w("div",{class:"export-help"},"平滑贝塞尔会在误差允许范围内拟合连续运动;出生、死亡、附件切换和突变仍使用阶跃关键帧。",-1)),t.value.spineVersion==="3.8"?(se(),ce("div",bO,"Spine 3.8 不支持 4.x 的逐通道数组贝塞尔,导出时会转换为经过容差精简的分段线性关键帧。")):$e("",!0),w("div",wO,[w("label",_O,[p[352]||(p[352]=w("span",null,"导出 FPS",-1)),xe(w("input",{"onUpdate:modelValue":p[177]||(p[177]=x=>t.value.fps=x),class:"inp export-input",type:"number",min:"1",max:"240",step:"1",onChange:ve},null,544),[[Je,t.value.fps,void 0,{number:!0}]])]),w("label",SO,[xe(w("input",{"onUpdate:modelValue":p[178]||(p[178]=x=>t.value.omitFps=x),type:"checkbox"},null,512),[[Lt,t.value.omitFps]]),p[353]||(p[353]=Yt("不写 fps",-1))])]),p[361]||(p[361]=w("div",{class:"export-help"},"修改 FPS 时保持动画实际秒数不变;“不写 fps”只省略 Spine 的 fps 元数据。",-1)),w("div",TO,[w("label",MO,[xe(w("input",{"onUpdate:modelValue":p[179]||(p[179]=x=>t.value.integerFrameAlignment=x),type:"checkbox"},null,512),[[Lt,t.value.integerFrameAlignment]]),p[354]||(p[354]=w("span",{class:"switch-ui"},null,-1)),p[355]||(p[355]=w("span",null,"整数帧对齐",-1))]),w("label",EO,[xe(w("input",{"onUpdate:modelValue":p[180]||(p[180]=x=>t.value.bonePool=x),type:"checkbox"},null,512),[[Lt,t.value.bonePool]]),p[356]||(p[356]=w("span",{class:"switch-ui"},null,-1)),p[357]||(p[357]=w("span",null,"骨骼对象池",-1))]),w("label",AO,[xe(w("input",{"onUpdate:modelValue":p[181]||(p[181]=x=>t.value.excludeEmptyAnimations=x),type:"checkbox"},null,512),[[Lt,t.value.excludeEmptyAnimations]]),p[358]||(p[358]=w("span",{class:"switch-ui"},null,-1)),p[359]||(p[359]=w("span",null,"排除无内容动画",-1))])])],512),[[Cn,!U.export]])])],64)):$e("",!0)]),w("button",{type:"button",class:"export-spine-json",disabled:l.value,title:l.value?"正在重新计算并烘焙动画":`导出 Spine ${t.value.spineVersion} JSON`,onClick:v},Ye(l.value?"正在准备导出…":"导出Spine Json"),9,CO),c.value?(se(),ce("div",{key:0,class:Ze(["export-message",{error:u.value}])},Ye(c.value),3)):$e("",!0)]))}}),RO=Ks(IO,[["__scopeId","data-v-6eba135a"]]),PO={class:"timeline"},kO={class:"tl-controls"},FO=["title"],OO={class:"tl-frame"},BO=["disabled"],LO=["onClick"],DO={key:0},NO={class:"tl-animation-editor"},UO={key:0,class:"tl-animation-error"},VO={class:"tl-animation-actions"},XO=["disabled"],YO={key:1,class:"tl-animation-hint"},$O={class:"tl-anim tl-spine-preview"},GO=["value","disabled"],jO={value:""},HO=["value"],WO={class:"tl-zoom"},zO={class:"tl-ticks"},qO={class:"tl-ticklabel"},KO={class:"tl-lanes"},ZO=["onPointerdown"],JO={class:"lane-name"},QO=["onPointerdown"],e3=["onPointerdown"],t3={class:"lane-name"},i3={key:0,class:"tl-empty"},s3=Ws({__name:"Timeline",setup(i){const e=Aa(),t=it(null),s=it(null),n=it(!1),r=it("animation"),o=it("");No(()=>{(!Array.isArray(e.timeline.animations)||!e.timeline.animations.length)&&(e.timeline.animations=["animation"]),e.timeline.animations.includes(e.timeline.animation)||(e.timeline.animation=e.timeline.animations[0]);for(const H of e.systems)(!H.animation||!e.timeline.animations.includes(H.animation))&&(H.animation=e.timeline.animations[0])});const a=ut(()=>e.systems.find(H=>H.id===e.activeId)||null);function h(){a.value&&(n.value=!n.value,r.value=a.value.animation,o.value="")}function l(H){const Z=a.value;Z&&(e.setSystemAnimation(Z.id,H),r.value=H,o.value="")}function c(){const H=e.addAnimation();r.value=H,o.value=""}function u(){var ae;const H=((ae=a.value)==null?void 0:ae.animation)||e.timeline.animation,Z=r.value.trim();if(!Z){o.value="动画名称不能为空";return}if(Z!==H&&e.timeline.animations.includes(Z)){o.value="动画名称不能重复";return}if(!e.renameAnimation(H,Z)){o.value="无法修改动画名称";return}r.value=Z,o.value=""}function f(){var ae,me;const H=((ae=a.value)==null?void 0:ae.animation)||e.timeline.animation;if(!e.removeAnimation(H)){o.value="至少需要保留一个动画";return}const Z=((me=a.value)==null?void 0:me.animation)||e.timeline.animation;r.value=Z,o.value=""}function d(H){var Z;(Z=s.value)!=null&&Z.contains(H.target)||(n.value=!1)}_o(()=>document.addEventListener("pointerdown",d)),a0(()=>document.removeEventListener("pointerdown",d));const m=ut(()=>Math.max(1,e.timeline.fps||30)),g=it(120),b=it({}),_=it({}),M=it({}),v=ut(()=>e.timeline.totalFrames),S=ut(()=>g.value<=30?"放大":g.value>=300?"缩小":"适中"),y=ut(()=>e.spines.filter(H=>H.selectedAnimation&&H.animations.some(Z=>Z.name===H.selectedAnimation&&Z.duration>0))),I=ut(()=>(e.activeObjectType==="spine"?e.spines.find(Z=>Z.id===e.activeObjectId&&Z.animations.length):null)||e.spines.find(Z=>Z.animations.length)||null);function E(H){const Z=I.value;Z&&(Z.selectedAnimation=H.target.value,e.recalcTotalFrames(),e.timeline.frame=0)}function C(){var Z;const H=((Z=t.value)==null?void 0:Z.clientWidth)||600;return g.value/H}const R=ut(()=>{const H=[],Z=g.value;let ae=1;g.value<=10?ae=1:g.value<=50?ae=5:g.value<=200?ae=10:g.value<=500?ae=50:ae=100;for(let me=0;me<=Z;me+=ae)H.push({f:me,px:me/C()});return H}),B=ut(()=>e.timeline.frame/C());function k(H){const Z=H.config;return(b.value[H.id]??Math.max(0,Number(Z.delay)||0))*m.value/C()}function F(H){const Z=H.config,ae=Math.max(0,Number(Z.lifeMin)||0),me=Math.max(0,Number(Z.lifeMax)||0);return Z.lifeMode==="fixed"?ae:Math.max(ae,me)}function D(H){return j(H)}function N(H){if(H.config.mode!=="stream"||O(H))return 0;if(H.config.streamBehavior==="loop"){const ae=H.config,me=Math.max(1,Math.ceil(Number(ae.loopDurationFrames)||1));if(ae.generateLoopStartAnimation){const _e=Math.max(1,Math.ceil(F(H)*m.value/me));return me*_e/C()}return me/C()}return(_.value[H.id]??Math.max(1/m.value,Number(H.config.duration)||1))*m.value/C()}function j(H){const Z=H.config;return Z.mode==="stream"&&Z.streamBehavior==="loop"?Z.generateLoopEndAnimation?(F(H)*m.value+1)/C():N(H):N(H)+F(H)*m.value/C()}function O(H){const Z=H.config;return Z.mode==="stream"&&Z.streamBehavior==="loop"&&Z.generateLoopEndAnimation}function L(H){var Z;return((Z=H.animations.find(ae=>ae.name===H.selectedAnimation))==null?void 0:Z.duration)||0}function P(H){return(M.value[H.id]??Math.max(0,Number(H.timeOffset)||0))*m.value/C()}function X(H){return L(H)*m.value/C()}function U(H){const Z=H.deltaY<0?.8:1.25;let ae=g.value*Z;ae=Math.min(2e3,Math.max(10,ae)),g.value=Math.round(ae)}function Y(H){const Z=t.value,ae=_e=>{const te=Z.getBoundingClientRect(),ve=Math.floor((_e.clientX-te.left)/te.width*g.value);e.timeline.frame=Math.max(0,Math.min(ve,v.value-1))};ae(H);const me=()=>{window.removeEventListener("pointermove",ae),window.removeEventListener("pointerup",me)};window.addEventListener("pointermove",ae),window.addEventListener("pointerup",me)}function q(H,Z){H.stopPropagation();const ae=H.clientX,me=Math.max(0,Number(Z.config.delay)||0),_e=C()/m.value,te=J=>{const Q=(J.clientX-ae)*_e,ie=Math.max(0,Math.min(me+Q,600));b.value[Z.id]=Math.round(ie*m.value)/m.value},ve=J=>{window.removeEventListener("pointermove",te),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",W);const Q=b.value[Z.id];delete b.value[Z.id],J&&Q!=null&&Q!==me&&(Z.config.delay=Q)},$=()=>ve(!0),W=()=>ve(!1);window.addEventListener("pointermove",te),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",W)}function z(H,Z){var Q;if(H.stopPropagation(),O(Z))return;const ae=Math.max(0,Number(Z.config.duration)||0),me=C()/m.value,_e=((Q=H.currentTarget.closest(".lane-bar"))==null?void 0:Q.getBoundingClientRect().left)??H.clientX;let te=!1;const ve=ie=>{te=!0;const ue=Math.max(1/m.value,Math.min((ie.clientX-_e)*me,600));_.value[Z.id]=Math.round(ue*m.value)/m.value},$=ie=>{window.removeEventListener("pointermove",ve),window.removeEventListener("pointerup",W),window.removeEventListener("pointercancel",J);const ue=_.value[Z.id];delete _.value[Z.id],ie&&te&&ue!=null&&ue!==ae&&(Z.config.duration=ue)},W=()=>$(!0),J=()=>$(!1);window.addEventListener("pointermove",ve),window.addEventListener("pointerup",W),window.addEventListener("pointercancel",J)}function ne(H,Z){H.stopPropagation();const ae=H.clientX,me=Math.max(0,Number(Z.timeOffset)||0),_e=C()/m.value,te=J=>{const Q=Math.max(0,Math.min(me+(J.clientX-ae)*_e,600));M.value[Z.id]=Math.round(Q*m.value)/m.value},ve=J=>{window.removeEventListener("pointermove",te),window.removeEventListener("pointerup",$),window.removeEventListener("pointercancel",W);const Q=M.value[Z.id];delete M.value[Z.id],J&&Q!=null&&Q!==me&&(Z.timeOffset=Q,e.recalcTotalFrames())},$=()=>ve(!0),W=()=>ve(!1);window.addEventListener("pointermove",te),window.addEventListener("pointerup",$),window.addEventListener("pointercancel",W)}return(H,Z)=>{var ae,me,_e;return se(),ce("div",PO,[w("div",kO,[w("button",{class:Ze(["tl-btn",{on:Pe(e).timeline.playing}]),onClick:Z[0]||(Z[0]=te=>Pe(e).togglePlay()),title:Pe(e).timeline.playing?"暂停 (D)":"播放 (D)"},Ye(Pe(e).timeline.playing?"❚❚":"▶"),11,FO),w("button",{class:"tl-btn",onClick:Z[1]||(Z[1]=te=>Pe(e).toStart()),title:"回到第一帧 (S)"},"⏮"),w("button",{class:"tl-btn",onClick:Z[2]||(Z[2]=te=>Pe(e).previousFrame()),title:"前一帧"},"◀"),w("button",{class:"tl-btn",onClick:Z[3]||(Z[3]=te=>Pe(e).nextFrame()),title:"后一帧"},"▶"),w("button",{class:"tl-btn",onClick:Z[4]||(Z[4]=te=>Pe(e).toEnd()),title:"移动到最后一帧"},"⏭"),w("button",{class:Ze(["tl-btn",{on:Pe(e).timeline.loop}]),onClick:Z[5]||(Z[5]=te=>Pe(e).toggleLoop()),title:"循环"},"⟳",2),w("span",OO,[Z[8]||(Z[8]=Yt("帧 ",-1)),w("b",null,Ye(Pe(e).timeline.frame),1),Z[9]||(Z[9]=Yt(" / ",-1)),w("b",null,Ye(Math.max(0,Pe(e).timeline.totalFrames-1)),1)]),Z[14]||(Z[14]=w("span",{class:"tl-legend"},[w("i",{class:"legend-emission"}),Yt("持续发射 "),w("i",{class:"legend-life"}),Yt("粒子存在 "),w("i",{class:"legend-spine"}),Yt("Spine 动画")],-1)),w("div",{ref_key:"animationMenuRef",ref:s,class:"tl-anim tl-owner-animation"},[Z[12]||(Z[12]=w("span",null,"所属动画",-1)),w("button",{class:"tl-animation-trigger",disabled:!a.value,title:"设置当前粒子系统所属的动画",onClick:xt(h,["stop"])},[w("span",null,Ye(((ae=a.value)==null?void 0:ae.animation)||Pe(e).timeline.animation),1),Z[10]||(Z[10]=w("i",null,"⌄",-1))],8,BO),n.value?(se(),ce("div",{key:0,class:"tl-animation-menu",onPointerdown:Z[7]||(Z[7]=xt(()=>{},["stop"]))},[Z[11]||(Z[11]=w("div",{class:"tl-animation-menu-title"},"选择所属动画",-1)),(se(!0),ce(qe,null,Ht(Pe(e).timeline.animations,te=>{var ve,$;return se(),ce("button",{key:te,class:Ze(["tl-animation-option",{on:((ve=a.value)==null?void 0:ve.animation)===te}]),onClick:W=>l(te)},[w("span",null,Ye(te),1),(($=a.value)==null?void 0:$.animation)===te?(se(),ce("i",DO,"✓")):$e("",!0)],10,LO)}),128)),w("div",NO,[xe(w("input",{"onUpdate:modelValue":Z[6]||(Z[6]=te=>r.value=te),class:"tl-animation-name",maxlength:"64","aria-label":"动画名称",onKeydown:da(u,["enter"])},null,544),[[Je,r.value]]),w("button",{title:"重命名当前动画",onClick:u},"重命名")]),o.value?(se(),ce("div",UO,Ye(o.value),1)):$e("",!0),w("div",VO,[w("button",{onClick:c},"+ 新增"),w("button",{disabled:Pe(e).timeline.animations.length<=1,onClick:f},"删除",8,XO)]),Pe(e).timeline.animations.length<=1?(se(),ce("div",YO,"至少需要保留一个动画")):$e("",!0)],32)):$e("",!0)],512),w("label",$O,[Z[13]||(Z[13]=Yt("Spine 预览动画 ",-1)),w("select",{class:"tl-sel",value:((me=I.value)==null?void 0:me.selectedAnimation)||"",disabled:!I.value,onChange:E},[w("option",jO,Ye(I.value?"无":"无可用 Spine 动画"),1),(se(!0),ce(qe,null,Ht(((_e=I.value)==null?void 0:_e.animations)||[],te=>(se(),ce("option",{key:te.name,value:te.name},Ye(te.name)+"("+Ye(te.duration.toFixed(2))+"s) ",9,HO))),128))],40,GO)]),w("span",WO,Ye(S.value),1)]),w("div",{class:"tl-viewport",ref_key:"vpRef",ref:t,onWheel:xt(U,["prevent"]),onPointerdown:Y},[w("div",zO,[(se(!0),ce(qe,null,Ht(R.value,te=>(se(),ce("div",{key:te.f,class:"tl-tickline",style:Pi({left:te.px+"px"})},[w("span",qO,Ye(te.f)+"f",1)],4))),128))]),w("div",{class:"tl-playhead",style:Pi({left:B.value+"px"})},null,4),w("div",KO,[(se(!0),ce(qe,null,Ht(Pe(e).systems,(te,ve)=>(se(),ce("div",{key:te.id,class:"tl-lane"},[Z[15]||(Z[15]=w("span",{class:"lane-ico"},"●",-1)),w("div",{class:"lane-bar",style:Pi({left:k(te)+"px",width:D(te)+"px"}),onPointerdown:xt($=>q($,te),["stop"])},[w("span",JO,Ye(te.config.name||"系统 "+(ve+1)),1),w("span",{class:"bar-life",style:Pi({width:j(te)+"px"})},null,4),te.config.mode==="stream"&&!O(te)?(se(),ce("span",{key:0,class:"bar-emission",style:Pi({width:N(te)+"px"})},[w("span",{class:"bar-handle",title:"拖动持续发射时长",onPointerdown:xt($=>z($,te),["stop"])},null,40,QO)],4)):$e("",!0)],44,ZO)]))),128)),(se(!0),ce(qe,null,Ht(y.value,te=>(se(),ce("div",{key:`spine-${te.id}`,class:"tl-lane spine-lane"},[Z[16]||(Z[16]=w("span",{class:"lane-ico spine-ico"},"◆",-1)),w("div",{class:"spine-bar",style:Pi({left:P(te)+"px",width:X(te)+"px"}),title:"拖动调整动画开始时间",onPointerdown:xt(ve=>ne(ve,te),["stop"])},[w("span",t3,Ye(te.name)+" · "+Ye(te.selectedAnimation),1)],44,e3)]))),128)),!Pe(e).systems.length&&!y.value.length?(se(),ce("div",i3,"暂无可显示的动画数据")):$e("",!0)])],544)])}}}),n3=Ks(s3,[["__scopeId","data-v-0ef42eef"]]),r3={class:"right"},o3={class:"stage-area"},a3=Ws({__name:"App",setup(i){const e=Aa();FE(e);const t=it(360),s=it(180);function n(o){o.preventDefault();const a=l=>{const c=e.settings.parameterPanelOnRight?window.innerWidth-l.clientX:l.clientX,u=Math.max(240,Math.min(c,window.innerWidth-200));t.value=u},h=()=>{window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",h)};window.addEventListener("pointermove",a),window.addEventListener("pointerup",h)}function r(o){o.preventDefault();const a=o.clientY,h=s.value,l=u=>{const f=Math.max(80,Math.min(h+(a-u.clientY),window.innerHeight-200));s.value=f},c=()=>{window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",c)};window.addEventListener("pointermove",l),window.addEventListener("pointerup",c)}return(o,a)=>(se(),ce("div",{class:Ze(["layout",{"panel-right":Pe(e).settings.parameterPanelOnRight}])},[w("div",{class:"parameter-panel",style:Pi({width:t.value+"px"})},[Ne(RO)],4),w("div",{class:"resizer-col",onPointerdown:n},null,32),w("div",r3,[w("div",o3,[Ne(zC)]),w("div",{class:"resizer-row",onPointerdown:r,title:"拖动调整时间轴高度"},null,32),w("div",{class:"timeline-area",style:Pi({height:s.value+"px"})},[Ne(n3)],4)])],2))}}),l3=Ks(a3,[["__scopeId","data-v-8eacccdc"]]);Hb(l3).use(qb()).mount("#app");