From 47a94b8cf1ac1aa8d8a36bd223959bae89e5d15d Mon Sep 17 00:00:00 2001 From: tillvit Date: Sat, 23 Sep 2023 17:58:51 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20tillvit/?= =?UTF-8?q?smeditor@e2a02f05b05f443f28634b792fd9d448c7a679cc=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...c5a059f.js => NodeFileHandler-345e443b.js} | 4 +- beta/assets/OggDec-2941c3fd.js | 4 + ...der-5b3f4b00.js => downloader-b3d29e83.js} | 2 +- ...{index-cf2356c2.css => index-3936f743.css} | 2 +- .../{index-92a586e7.js => index-abdbff68.js} | 157 +++++++++--------- ...{memory-52dcb63c.js => memory-7221a3c9.js} | 2 +- beta/assets/svg/highpass.svg | 4 + beta/assets/svg/highshelf.svg | 4 + beta/assets/svg/lowpass.svg | 4 + beta/assets/svg/lowshelf.svg | 4 + beta/assets/svg/peaking.svg | 4 + .../{util-83e43b90.js => util-849946d7.js} | 2 +- beta/index.html | 4 +- 13 files changed, 111 insertions(+), 86 deletions(-) rename beta/assets/{NodeFileHandler-5c5a059f.js => NodeFileHandler-345e443b.js} (98%) create mode 100644 beta/assets/OggDec-2941c3fd.js rename beta/assets/{downloader-5b3f4b00.js => downloader-b3d29e83.js} (95%) rename beta/assets/{index-cf2356c2.css => index-3936f743.css} (88%) rename beta/assets/{index-92a586e7.js => index-abdbff68.js} (55%) rename beta/assets/{memory-52dcb63c.js => memory-7221a3c9.js} (96%) create mode 100644 beta/assets/svg/highpass.svg create mode 100644 beta/assets/svg/highshelf.svg create mode 100644 beta/assets/svg/lowpass.svg create mode 100644 beta/assets/svg/lowshelf.svg create mode 100644 beta/assets/svg/peaking.svg rename beta/assets/{util-83e43b90.js => util-849946d7.js} (69%) diff --git a/beta/assets/NodeFileHandler-5c5a059f.js b/beta/assets/NodeFileHandler-345e443b.js similarity index 98% rename from beta/assets/NodeFileHandler-5c5a059f.js rename to beta/assets/NodeFileHandler-345e443b.js index 760a60e7..ca117908 100644 --- a/beta/assets/NodeFileHandler-5c5a059f.js +++ b/beta/assets/NodeFileHandler-345e443b.js @@ -1,6 +1,6 @@ -import{c as vr,r as jr,g as Bo,F as Hn,a as Yn}from"./index-92a586e7.js";import{errors as ri,isChunkObject as To}from"./util-83e43b90.js";var or={exports:{}},Qn;function Ao(){return Qn||(Qn=1,function(B,u){(function(p,d){d(u)})(vr,function(p){const d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:e=>`Symbol(${e})`;function _(){}function R(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof vr<"u")return vr}const E=R();function c(e){return typeof e=="object"&&e!==null||typeof e=="function"}const Y=_,Q=Promise,U=Promise.prototype.then,j=Promise.resolve.bind(Q),G=Promise.reject.bind(Q);function S(e){return new Q(e)}function g(e){return j(e)}function w(e){return G(e)}function k(e,t,i){return U.call(e,t,i)}function O(e,t,i){k(k(e,t,i),void 0,Y)}function L(e,t){O(e,t)}function V(e,t){O(e,void 0,t)}function ee(e,t,i){return k(e,t,i)}function z(e){k(e,void 0,Y)}const Fe=(()=>{const e=E&&E.queueMicrotask;if(typeof e=="function")return e;const t=g(void 0);return i=>k(t,i)})();function xe(e,t,i){if(typeof e!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,i)}function be(e,t,i){try{return g(xe(e,t,i))}catch(s){return w(s)}}const St=16384;class ae{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(t){const i=this._back;let s=i;i._elements.length===St-1&&(s={_elements:[],_next:void 0}),i._elements.push(t),s!==i&&(this._back=s,i._next=s),++this._size}shift(){const t=this._front;let i=t;const s=this._cursor;let f=s+1;const b=t._elements,y=b[s];return f===St&&(i=t._next,f=0),--this._size,this._cursor=f,t!==i&&(this._front=i),b[s]=void 0,y}forEach(t){let i=this._cursor,s=this._front,f=s._elements;for(;(i!==f.length||s._next!==void 0)&&!(i===f.length&&(s=s._next,f=s._elements,i=0,f.length===0));)t(f[i]),++i}peek(){const t=this._front,i=this._cursor;return t._elements[i]}}function Rt(e,t){e._ownerReadableStream=t,t._reader=e,t._state==="readable"?Ue(e):t._state==="closed"?lr(e):Et(e,t._storedError)}function rt(e,t){const i=e._ownerReadableStream;return de(i,t)}function fe(e){e._ownerReadableStream._state==="readable"?nt(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):fr(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function ye(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function Ue(e){e._closedPromise=S((t,i)=>{e._closedPromise_resolve=t,e._closedPromise_reject=i})}function Et(e,t){Ue(e),nt(e,t)}function lr(e){Ue(e),Ct(e)}function nt(e,t){e._closedPromise_reject!==void 0&&(z(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function fr(e,t){Et(e,t)}function Ct(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const N=d("[[AbortSteps]]"),X=d("[[ErrorSteps]]"),je=d("[[CancelSteps]]"),Le=d("[[PullSteps]]"),it=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},Bt=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function Tt(e){return typeof e=="object"||typeof e=="function"}function K(e,t){if(e!==void 0&&!Tt(e))throw new TypeError(`${t} is not an object.`)}function te(e,t){if(typeof e!="function")throw new TypeError(`${t} is not a function.`)}function At(e){return typeof e=="object"&&e!==null||typeof e=="function"}function Pt(e,t){if(!At(e))throw new TypeError(`${t} is not an object.`)}function ue(e,t,i){if(e===void 0)throw new TypeError(`Parameter ${t} is required in '${i}'.`)}function pe(e,t,i){if(e===void 0)throw new TypeError(`${t} is required in '${i}'.`)}function _e(e){return Number(e)}function It(e){return e===0?0:e}function cr(e){return It(Bt(e))}function $e(e,t){const s=Number.MAX_SAFE_INTEGER;let f=Number(e);if(f=It(f),!it(f))throw new TypeError(`${t} is not a finite number`);if(f=cr(f),f<0||f>s)throw new TypeError(`${t} is outside the accepted range of 0 to ${s}, inclusive`);return!it(f)||f===0?0:f}function ot(e,t){if(!Te(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Se(e){return new We(e)}function at(e,t){e._reader._readRequests.push(t)}function Re(e,t,i){const f=e._reader._readRequests.shift();i?f._closeSteps():f._chunkSteps(t)}function re(e){return e._reader._readRequests.length}function Ne(e){const t=e._reader;return!(t===void 0||!J(t))}class We{constructor(t){if(ue(t,1,"ReadableStreamDefaultReader"),ot(t,"First parameter"),Ae(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Rt(this,t),this._readRequests=new ae}get closed(){return J(this)?this._closedPromise:w(o("closed"))}cancel(t=void 0){return J(this)?this._ownerReadableStream===void 0?w(ye("cancel")):rt(this,t):w(o("cancel"))}read(){if(!J(this))return w(o("read"));if(this._ownerReadableStream===void 0)return w(ye("read from"));let t,i;const s=S((b,y)=>{t=b,i=y});return qe(this,{_chunkSteps:b=>t({value:b,done:!1}),_closeSteps:()=>t({value:void 0,done:!0}),_errorSteps:b=>i(b)}),s}releaseLock(){if(!J(this))throw o("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");fe(this)}}}Object.defineProperties(We.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(We.prototype,d.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function J(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_readRequests")?!1:e instanceof We}function qe(e,t){const i=e._ownerReadableStream;i._disturbed=!0,i._state==="closed"?t._closeSteps():i._state==="errored"?t._errorSteps(i._storedError):i._readableStreamController[Le](t)}function o(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}const r=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class n{constructor(t,i){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=t,this._preventCancel=i}next(){const t=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?ee(this._ongoingPromise,t,t):t(),this._ongoingPromise}return(t){const i=()=>this._returnSteps(t);return this._ongoingPromise?ee(this._ongoingPromise,i,i):i()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const t=this._reader;if(t._ownerReadableStream===void 0)return w(ye("iterate"));let i,s;const f=S((y,C)=>{i=y,s=C});return qe(t,{_chunkSteps:y=>{this._ongoingPromise=void 0,Fe(()=>i({value:y,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,fe(t),i({value:void 0,done:!0})},_errorSteps:y=>{this._ongoingPromise=void 0,this._isFinished=!0,fe(t),s(y)}}),f}_returnSteps(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;const i=this._reader;if(i._ownerReadableStream===void 0)return w(ye("finish iterating"));if(!this._preventCancel){const s=rt(i,t);return fe(i),ee(s,()=>({value:t,done:!0}))}return fe(i),g({value:t,done:!0})}}const a={next(){return h(this)?this._asyncIteratorImpl.next():w(m("next"))},return(e){return h(this)?this._asyncIteratorImpl.return(e):w(m("return"))}};r!==void 0&&Object.setPrototypeOf(a,r);function l(e,t){const i=Se(e),s=new n(i,t),f=Object.create(a);return f._asyncIteratorImpl=s,f}function h(e){if(!c(e)||!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof n}catch{return!1}}function m(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}const A=Number.isNaN||function(e){return e!==e};function v(e){return e.slice()}function D(e,t,i,s,f){new Uint8Array(e).set(new Uint8Array(i,s,f),t)}function $(e){return e}function x(e){return!1}function Qr(e,t,i){if(e.slice)return e.slice(t,i);const s=i-t,f=new ArrayBuffer(s);return D(f,0,e,t,s),f}function ai(e){return!(typeof e!="number"||A(e)||e<0)}function Gr(e){const t=Qr(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function dr(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function hr(e,t,i){if(!ai(i)||i===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:i}),e._queueTotalSize+=i}function si(e){return e._queue.peek().value}function Ee(e){e._queue=new ae,e._queueTotalSize=0}class st{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!pr(this))throw _r("view");return this._view}respond(t){if(!pr(this))throw _r("respond");if(ue(t,1,"respond"),t=$e(t,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");x(this._view.buffer),Ot(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!pr(this))throw _r("respondWithNewView");if(ue(t,1,"respondWithNewView"),!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");x(t.buffer),vt(this._associatedReadableByteStreamController,t)}}Object.defineProperties(st.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(st.prototype,d.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class He{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Oe(this))throw lt("byobRequest");return yr(this)}get desiredSize(){if(!Oe(this))throw lt("desiredSize");return rn(this)}close(){if(!Oe(this))throw lt("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const t=this._controlledReadableByteStream._state;if(t!=="readable")throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`);ut(this)}enqueue(t){if(!Oe(this))throw lt("enqueue");if(ue(t,1,"enqueue"),!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const i=this._controlledReadableByteStream._state;if(i!=="readable")throw new TypeError(`The stream (in ${i} state) is not in the readable state and cannot be enqueued to`);qt(this,t)}error(t=void 0){if(!Oe(this))throw lt("error");ce(this,t)}[je](t){Vr(this),Ee(this);const i=this._cancelAlgorithm(t);return Wt(this),i}[Le](t){const i=this._controlledReadableByteStream;if(this._queueTotalSize>0){const f=this._queue.shift();this._queueTotalSize-=f.byteLength,Kr(this);const b=new Uint8Array(f.buffer,f.byteOffset,f.byteLength);t._chunkSteps(b);return}const s=this._autoAllocateChunkSize;if(s!==void 0){let f;try{f=new ArrayBuffer(s)}catch(y){t._errorSteps(y);return}const b={buffer:f,bufferByteLength:s,byteOffset:0,byteLength:s,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(b)}at(i,t),ve(this)}}Object.defineProperties(He.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(He.prototype,d.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function Oe(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")?!1:e instanceof He}function pr(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")?!1:e instanceof st}function ve(e){if(!ci(e))return;if(e._pulling){e._pullAgain=!0;return}e._pulling=!0;const i=e._pullAlgorithm();O(i,()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,ve(e))},s=>{ce(e,s)})}function Vr(e){br(e),e._pendingPullIntos=new ae}function mr(e,t){let i=!1;e._state==="closed"&&(i=!0);const s=Xr(t);t.readerType==="default"?Re(e,s,i):pi(e,s,i)}function Xr(e){const t=e.bytesFilled,i=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/i)}function Ft(e,t,i,s){e._queue.push({buffer:t,byteOffset:i,byteLength:s}),e._queueTotalSize+=s}function Jr(e,t){const i=t.elementSize,s=t.bytesFilled-t.bytesFilled%i,f=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),b=t.bytesFilled+f,y=b-b%i;let C=f,P=!1;y>s&&(C=y-t.bytesFilled,P=!0);const F=e._queue;for(;C>0;){const W=F.peek(),q=Math.min(C,W.byteLength),H=t.byteOffset+t.bytesFilled;D(t.buffer,H,W.buffer,W.byteOffset,q),W.byteLength===q?F.shift():(W.byteOffset+=q,W.byteLength-=q),e._queueTotalSize-=q,Zr(e,q,t),C-=q}return P}function Zr(e,t,i){i.bytesFilled+=t}function Kr(e){e._queueTotalSize===0&&e._closeRequested?(Wt(e),yt(e._controlledReadableByteStream)):ve(e)}function br(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function en(e){for(;e._pendingPullIntos.length>0;){if(e._queueTotalSize===0)return;const t=e._pendingPullIntos.peek();Jr(e,t)&&(xt(e),mr(e._controlledReadableByteStream,t))}}function ui(e,t,i){const s=e._controlledReadableByteStream;let f=1;t.constructor!==DataView&&(f=t.constructor.BYTES_PER_ELEMENT);const b=t.constructor,y=t.buffer,C={buffer:y,bufferByteLength:y.byteLength,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:f,viewConstructor:b,readerType:"byob"};if(e._pendingPullIntos.length>0){e._pendingPullIntos.push(C),an(s,i);return}if(s._state==="closed"){const P=new b(C.buffer,C.byteOffset,0);i._closeSteps(P);return}if(e._queueTotalSize>0){if(Jr(e,C)){const P=Xr(C);Kr(e),i._chunkSteps(P);return}if(e._closeRequested){const P=new TypeError("Insufficient bytes to fill elements in the given buffer");ce(e,P),i._errorSteps(P);return}}e._pendingPullIntos.push(C),an(s,i),ve(e)}function li(e,t){const i=e._controlledReadableByteStream;if(wr(i))for(;sn(i)>0;){const s=xt(e);mr(i,s)}}function fi(e,t,i){if(Zr(e,t,i),i.bytesFilled0){const f=i.byteOffset+i.bytesFilled,b=Qr(i.buffer,f-s,f);Ft(e,b,0,b.byteLength)}i.bytesFilled-=s,mr(e._controlledReadableByteStream,i),en(e)}function tn(e,t){const i=e._pendingPullIntos.peek();br(e),e._controlledReadableByteStream._state==="closed"?li(e):fi(e,t,i),ve(e)}function xt(e){return e._pendingPullIntos.shift()}function ci(e){const t=e._controlledReadableByteStream;return t._state!=="readable"||e._closeRequested||!e._started?!1:!!(Ne(t)&&re(t)>0||wr(t)&&sn(t)>0||rn(e)>0)}function Wt(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function ut(e){const t=e._controlledReadableByteStream;if(!(e._closeRequested||t._state!=="readable")){if(e._queueTotalSize>0){e._closeRequested=!0;return}if(e._pendingPullIntos.length>0&&e._pendingPullIntos.peek().bytesFilled>0){const s=new TypeError("Insufficient bytes to fill elements in the given buffer");throw ce(e,s),s}Wt(e),yt(t)}}function qt(e,t){const i=e._controlledReadableByteStream;if(e._closeRequested||i._state!=="readable")return;const s=t.buffer,f=t.byteOffset,b=t.byteLength,y=s;if(e._pendingPullIntos.length>0){const C=e._pendingPullIntos.peek();x(C.buffer),C.buffer=C.buffer}if(br(e),Ne(i))if(re(i)===0)Ft(e,y,f,b);else{e._pendingPullIntos.length>0&&xt(e);const C=new Uint8Array(y,f,b);Re(i,C,!1)}else wr(i)?(Ft(e,y,f,b),en(e)):Ft(e,y,f,b);ve(e)}function ce(e,t){const i=e._controlledReadableByteStream;i._state==="readable"&&(Vr(e),Ee(e),Wt(e),xn(i,t))}function yr(e){if(e._byobRequest===null&&e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek(),i=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),s=Object.create(st.prototype);hi(s,e,i),e._byobRequest=s}return e._byobRequest}function rn(e){const t=e._controlledReadableByteStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function Ot(e,t){const i=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(t===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(i.bytesFilled+t>i.byteLength)throw new RangeError("bytesWritten out of range")}i.buffer=i.buffer,tn(e,t)}function vt(e,t){const i=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(t.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(i.byteOffset+i.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(i.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(i.bytesFilled+t.byteLength>i.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");const f=t.byteLength;i.buffer=t.buffer,tn(e,f)}function nn(e,t,i,s,f,b,y){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,Ee(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=b,t._pullAlgorithm=s,t._cancelAlgorithm=f,t._autoAllocateChunkSize=y,t._pendingPullIntos=new ae,e._readableStreamController=t;const C=i();O(g(C),()=>{t._started=!0,ve(t)},P=>{ce(t,P)})}function di(e,t,i){const s=Object.create(He.prototype);let f=()=>{},b=()=>g(void 0),y=()=>g(void 0);t.start!==void 0&&(f=()=>t.start(s)),t.pull!==void 0&&(b=()=>t.pull(s)),t.cancel!==void 0&&(y=P=>t.cancel(P));const C=t.autoAllocateChunkSize;if(C===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");nn(e,s,f,b,y,i,C)}function hi(e,t,i){e._associatedReadableByteStreamController=t,e._view=i}function _r(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function lt(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function on(e){return new ft(e)}function an(e,t){e._reader._readIntoRequests.push(t)}function pi(e,t,i){const f=e._reader._readIntoRequests.shift();i?f._closeSteps(t):f._chunkSteps(t)}function sn(e){return e._reader._readIntoRequests.length}function wr(e){const t=e._reader;return!(t===void 0||!ke(t))}class ft{constructor(t){if(ue(t,1,"ReadableStreamBYOBReader"),ot(t,"First parameter"),Ae(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Oe(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Rt(this,t),this._readIntoRequests=new ae}get closed(){return ke(this)?this._closedPromise:w(kt("closed"))}cancel(t=void 0){return ke(this)?this._ownerReadableStream===void 0?w(ye("cancel")):rt(this,t):w(kt("cancel"))}read(t){if(!ke(this))return w(kt("read"));if(!ArrayBuffer.isView(t))return w(new TypeError("view must be an array buffer view"));if(t.byteLength===0)return w(new TypeError("view must have non-zero byteLength"));if(t.buffer.byteLength===0)return w(new TypeError("view's buffer must have non-zero byteLength"));if(x(t.buffer),this._ownerReadableStream===void 0)return w(ye("read from"));let i,s;const f=S((y,C)=>{i=y,s=C});return un(this,t,{_chunkSteps:y=>i({value:y,done:!1}),_closeSteps:y=>i({value:y,done:!0}),_errorSteps:y=>s(y)}),f}releaseLock(){if(!ke(this))throw kt("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");fe(this)}}}Object.defineProperties(ft.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(ft.prototype,d.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function ke(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")?!1:e instanceof ft}function un(e,t,i){const s=e._ownerReadableStream;s._disturbed=!0,s._state==="errored"?i._errorSteps(s._storedError):ui(s._readableStreamController,t,i)}function kt(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function ct(e,t){const{highWaterMark:i}=e;if(i===void 0)return t;if(A(i)||i<0)throw new RangeError("Invalid highWaterMark");return i}function Dt(e){const{size:t}=e;return t||(()=>1)}function zt(e,t){K(e,t);const i=e?.highWaterMark,s=e?.size;return{highWaterMark:i===void 0?void 0:_e(i),size:s===void 0?void 0:mi(s,`${t} has member 'size' that`)}}function mi(e,t){return te(e,t),i=>_e(e(i))}function bi(e,t){K(e,t);const i=e?.abort,s=e?.close,f=e?.start,b=e?.type,y=e?.write;return{abort:i===void 0?void 0:yi(i,e,`${t} has member 'abort' that`),close:s===void 0?void 0:_i(s,e,`${t} has member 'close' that`),start:f===void 0?void 0:wi(f,e,`${t} has member 'start' that`),write:y===void 0?void 0:gi(y,e,`${t} has member 'write' that`),type:b}}function yi(e,t,i){return te(e,i),s=>be(e,t,[s])}function _i(e,t,i){return te(e,i),()=>be(e,t,[])}function wi(e,t,i){return te(e,i),s=>xe(e,t,[s])}function gi(e,t,i){return te(e,i),(s,f)=>be(e,t,[s,f])}function ln(e,t){if(!Ye(e))throw new TypeError(`${t} is not a WritableStream.`)}function Si(e){if(typeof e!="object"||e===null)return!1;try{return typeof e.aborted=="boolean"}catch{return!1}}const Ri=typeof AbortController=="function";function Ei(){if(Ri)return new AbortController}class dt{constructor(t={},i={}){t===void 0?t=null:Pt(t,"First parameter");const s=zt(i,"Second parameter"),f=bi(t,"First parameter");if(cn(this),f.type!==void 0)throw new RangeError("Invalid type is specified");const y=Dt(s),C=ct(s,1);Di(this,f,C,y)}get locked(){if(!Ye(this))throw $t("locked");return Qe(this)}abort(t=void 0){return Ye(this)?Qe(this)?w(new TypeError("Cannot abort a stream that already has a writer")):Mt(this,t):w($t("abort"))}close(){return Ye(this)?Qe(this)?w(new TypeError("Cannot close a stream that already has a writer")):me(this)?w(new TypeError("Cannot close an already-closing stream")):dn(this):w($t("close"))}getWriter(){if(!Ye(this))throw $t("getWriter");return fn(this)}}Object.defineProperties(dt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(dt.prototype,d.toStringTag,{value:"WritableStream",configurable:!0});function fn(e){return new ht(e)}function Ci(e,t,i,s,f=1,b=()=>1){const y=Object.create(dt.prototype);cn(y);const C=Object.create(Ge.prototype);return _n(y,C,e,t,i,s,f,b),y}function cn(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new ae,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Ye(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")?!1:e instanceof dt}function Qe(e){return e._writer!==void 0}function Mt(e,t){var i;if(e._state==="closed"||e._state==="errored")return g(void 0);e._writableStreamController._abortReason=t,(i=e._writableStreamController._abortController)===null||i===void 0||i.abort();const s=e._state;if(s==="closed"||s==="errored")return g(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let f=!1;s==="erroring"&&(f=!0,t=void 0);const b=S((y,C)=>{e._pendingAbortRequest={_promise:void 0,_resolve:y,_reject:C,_reason:t,_wasAlreadyErroring:f}});return e._pendingAbortRequest._promise=b,f||Sr(e,t),b}function dn(e){const t=e._state;if(t==="closed"||t==="errored")return w(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const i=S((f,b)=>{const y={_resolve:f,_reject:b};e._closeRequest=y}),s=e._writer;return s!==void 0&&e._backpressure&&t==="writable"&&Fr(s),zi(e._writableStreamController),i}function Bi(e){return S((i,s)=>{const f={_resolve:i,_reject:s};e._writeRequests.push(f)})}function gr(e,t){if(e._state==="writable"){Sr(e,t);return}Rr(e)}function Sr(e,t){const i=e._writableStreamController;e._state="erroring",e._storedError=t;const s=e._writer;s!==void 0&&pn(s,t),!Fi(e)&&i._started&&Rr(e)}function Rr(e){e._state="errored",e._writableStreamController[X]();const t=e._storedError;if(e._writeRequests.forEach(f=>{f._reject(t)}),e._writeRequests=new ae,e._pendingAbortRequest===void 0){Ut(e);return}const i=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,i._wasAlreadyErroring){i._reject(t),Ut(e);return}const s=e._writableStreamController[N](i._reason);O(s,()=>{i._resolve(),Ut(e)},f=>{i._reject(f),Ut(e)})}function Ti(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}function Ai(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,gr(e,t)}function Pi(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,e._state==="erroring"&&(e._storedError=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";const i=e._writer;i!==void 0&&Rn(i)}function Ii(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),gr(e,t)}function me(e){return!(e._closeRequest===void 0&&e._inFlightCloseRequest===void 0)}function Fi(e){return!(e._inFlightWriteRequest===void 0&&e._inFlightCloseRequest===void 0)}function xi(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0}function Wi(e){e._inFlightWriteRequest=e._writeRequests.shift()}function Ut(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;t!==void 0&&Pr(t,e._storedError)}function Er(e,t){const i=e._writer;i!==void 0&&t!==e._backpressure&&(t?Hi(i):Fr(i)),e._backpressure=t}class ht{constructor(t){if(ue(t,1,"WritableStreamDefaultWriter"),ln(t,"First parameter"),Qe(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;const i=t._state;if(i==="writable")!me(t)&&t._backpressure?Ht(this):En(this),Nt(this);else if(i==="erroring")Ir(this,t._storedError),Nt(this);else if(i==="closed")En(this),$i(this);else{const s=t._storedError;Ir(this,s),Sn(this,s)}}get closed(){return De(this)?this._closedPromise:w(ze("closed"))}get desiredSize(){if(!De(this))throw ze("desiredSize");if(this._ownerWritableStream===void 0)throw pt("desiredSize");return ki(this)}get ready(){return De(this)?this._readyPromise:w(ze("ready"))}abort(t=void 0){return De(this)?this._ownerWritableStream===void 0?w(pt("abort")):qi(this,t):w(ze("abort"))}close(){if(!De(this))return w(ze("close"));const t=this._ownerWritableStream;return t===void 0?w(pt("close")):me(t)?w(new TypeError("Cannot close an already-closing stream")):hn(this)}releaseLock(){if(!De(this))throw ze("releaseLock");this._ownerWritableStream!==void 0&&mn(this)}write(t=void 0){return De(this)?this._ownerWritableStream===void 0?w(pt("write to")):bn(this,t):w(ze("write"))}}Object.defineProperties(ht.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(ht.prototype,d.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function De(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")?!1:e instanceof ht}function qi(e,t){const i=e._ownerWritableStream;return Mt(i,t)}function hn(e){const t=e._ownerWritableStream;return dn(t)}function Oi(e){const t=e._ownerWritableStream,i=t._state;return me(t)||i==="closed"?g(void 0):i==="errored"?w(t._storedError):hn(e)}function vi(e,t){e._closedPromiseState==="pending"?Pr(e,t):Ni(e,t)}function pn(e,t){e._readyPromiseState==="pending"?Cn(e,t):Yi(e,t)}function ki(e){const t=e._ownerWritableStream,i=t._state;return i==="errored"||i==="erroring"?null:i==="closed"?0:wn(t._writableStreamController)}function mn(e){const t=e._ownerWritableStream,i=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");pn(e,i),vi(e,i),t._writer=void 0,e._ownerWritableStream=void 0}function bn(e,t){const i=e._ownerWritableStream,s=i._writableStreamController,f=Mi(s,t);if(i!==e._ownerWritableStream)return w(pt("write to"));const b=i._state;if(b==="errored")return w(i._storedError);if(me(i)||b==="closed")return w(new TypeError("The stream is closing or closed and cannot be written to"));if(b==="erroring")return w(i._storedError);const y=Bi(i);return Ui(s,t,f),y}const yn={};class Ge{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Cr(this))throw Ar("abortReason");return this._abortReason}get signal(){if(!Cr(this))throw Ar("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(t=void 0){if(!Cr(this))throw Ar("error");this._controlledWritableStream._state==="writable"&&gn(this,t)}[N](t){const i=this._abortAlgorithm(t);return jt(this),i}[X](){Ee(this)}}Object.defineProperties(Ge.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Ge.prototype,d.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function Cr(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")?!1:e instanceof Ge}function _n(e,t,i,s,f,b,y,C){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Ee(t),t._abortReason=void 0,t._abortController=Ei(),t._started=!1,t._strategySizeAlgorithm=C,t._strategyHWM=y,t._writeAlgorithm=s,t._closeAlgorithm=f,t._abortAlgorithm=b;const P=Tr(t);Er(e,P);const F=i(),W=g(F);O(W,()=>{t._started=!0,Lt(t)},q=>{t._started=!0,gr(e,q)})}function Di(e,t,i,s){const f=Object.create(Ge.prototype);let b=()=>{},y=()=>g(void 0),C=()=>g(void 0),P=()=>g(void 0);t.start!==void 0&&(b=()=>t.start(f)),t.write!==void 0&&(y=F=>t.write(F,f)),t.close!==void 0&&(C=()=>t.close()),t.abort!==void 0&&(P=F=>t.abort(F)),_n(e,f,b,y,C,P,i,s)}function jt(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function zi(e){hr(e,yn,0),Lt(e)}function Mi(e,t){try{return e._strategySizeAlgorithm(t)}catch(i){return Br(e,i),1}}function wn(e){return e._strategyHWM-e._queueTotalSize}function Ui(e,t,i){try{hr(e,t,i)}catch(f){Br(e,f);return}const s=e._controlledWritableStream;if(!me(s)&&s._state==="writable"){const f=Tr(e);Er(s,f)}Lt(e)}function Lt(e){const t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state==="erroring"){Rr(t);return}if(e._queue.length===0)return;const s=si(e);s===yn?ji(e):Li(e,s)}function Br(e,t){e._controlledWritableStream._state==="writable"&&gn(e,t)}function ji(e){const t=e._controlledWritableStream;xi(t),dr(e);const i=e._closeAlgorithm();jt(e),O(i,()=>{Pi(t)},s=>{Ii(t,s)})}function Li(e,t){const i=e._controlledWritableStream;Wi(i);const s=e._writeAlgorithm(t);O(s,()=>{Ti(i);const f=i._state;if(dr(e),!me(i)&&f==="writable"){const b=Tr(e);Er(i,b)}Lt(e)},f=>{i._state==="writable"&&jt(e),Ai(i,f)})}function Tr(e){return wn(e)<=0}function gn(e,t){const i=e._controlledWritableStream;jt(e),Sr(i,t)}function $t(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Ar(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function ze(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function pt(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Nt(e){e._closedPromise=S((t,i)=>{e._closedPromise_resolve=t,e._closedPromise_reject=i,e._closedPromiseState="pending"})}function Sn(e,t){Nt(e),Pr(e,t)}function $i(e){Nt(e),Rn(e)}function Pr(e,t){e._closedPromise_reject!==void 0&&(z(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function Ni(e,t){Sn(e,t)}function Rn(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function Ht(e){e._readyPromise=S((t,i)=>{e._readyPromise_resolve=t,e._readyPromise_reject=i}),e._readyPromiseState="pending"}function Ir(e,t){Ht(e),Cn(e,t)}function En(e){Ht(e),Fr(e)}function Cn(e,t){e._readyPromise_reject!==void 0&&(z(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function Hi(e){Ht(e)}function Yi(e,t){Ir(e,t)}function Fr(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}const Bn=typeof DOMException<"u"?DOMException:void 0;function Qi(e){if(!(typeof e=="function"||typeof e=="object"))return!1;try{return new e,!0}catch{return!1}}function Gi(){const e=function(i,s){this.message=i||"",this.name=s||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}const Vi=Qi(Bn)?Bn:Gi();function Tn(e,t,i,s,f,b){const y=Se(e),C=fn(t);e._disturbed=!0;let P=!1,F=g(void 0);return S((W,q)=>{let H;if(b!==void 0){if(H=()=>{const T=new Vi("Aborted","AbortError"),I=[];s||I.push(()=>t._state==="writable"?Mt(t,T):g(void 0)),f||I.push(()=>e._state==="readable"?de(e,T):g(void 0)),ie(()=>Promise.all(I.map(M=>M())),!0,T)},b.aborted){H();return}b.addEventListener("abort",H)}function he(){return S((T,I)=>{function M(se){se?T():k(Je(),M,I)}M(!1)})}function Je(){return P?g(!0):k(C._readyPromise,()=>S((T,I)=>{qe(y,{_chunkSteps:M=>{F=k(bn(C,M),void 0,_),T(!1)},_closeSteps:()=>T(!0),_errorSteps:I})}))}if(we(e,y._closedPromise,T=>{s?le(!0,T):ie(()=>Mt(t,T),!0,T)}),we(t,C._closedPromise,T=>{f?le(!0,T):ie(()=>de(e,T),!0,T)}),ne(e,y._closedPromise,()=>{i?le():ie(()=>Oi(C))}),me(t)||t._state==="closed"){const T=new TypeError("the destination writable stream closed before all data could be piped to it");f?le(!0,T):ie(()=>de(e,T),!0,T)}z(he());function Pe(){const T=F;return k(F,()=>T!==F?Pe():void 0)}function we(T,I,M){T._state==="errored"?M(T._storedError):V(I,M)}function ne(T,I,M){T._state==="closed"?M():L(I,M)}function ie(T,I,M){if(P)return;P=!0,t._state==="writable"&&!me(t)?L(Pe(),se):se();function se(){O(T(),()=>ge(I,M),Ze=>ge(!0,Ze))}}function le(T,I){P||(P=!0,t._state==="writable"&&!me(t)?L(Pe(),()=>ge(T,I)):ge(T,I))}function ge(T,I){mn(C),fe(y),b!==void 0&&b.removeEventListener("abort",H),T?q(I):W(void 0)}})}class Ve{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Yt(this))throw Vt("desiredSize");return xr(this)}close(){if(!Yt(this))throw Vt("close");if(!Xe(this))throw new TypeError("The stream is not in a state that permits close");bt(this)}enqueue(t=void 0){if(!Yt(this))throw Vt("enqueue");if(!Xe(this))throw new TypeError("The stream is not in a state that permits enqueue");return Gt(this,t)}error(t=void 0){if(!Yt(this))throw Vt("error");Ce(this,t)}[je](t){Ee(this);const i=this._cancelAlgorithm(t);return Qt(this),i}[Le](t){const i=this._controlledReadableStream;if(this._queue.length>0){const s=dr(this);this._closeRequested&&this._queue.length===0?(Qt(this),yt(i)):mt(this),t._chunkSteps(s)}else at(i,t),mt(this)}}Object.defineProperties(Ve.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Ve.prototype,d.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function Yt(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")?!1:e instanceof Ve}function mt(e){if(!An(e))return;if(e._pulling){e._pullAgain=!0;return}e._pulling=!0;const i=e._pullAlgorithm();O(i,()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,mt(e))},s=>{Ce(e,s)})}function An(e){const t=e._controlledReadableStream;return!Xe(e)||!e._started?!1:!!(Ae(t)&&re(t)>0||xr(e)>0)}function Qt(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function bt(e){if(!Xe(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(Qt(e),yt(t))}function Gt(e,t){if(!Xe(e))return;const i=e._controlledReadableStream;if(Ae(i)&&re(i)>0)Re(i,t,!1);else{let s;try{s=e._strategySizeAlgorithm(t)}catch(f){throw Ce(e,f),f}try{hr(e,t,s)}catch(f){throw Ce(e,f),f}}mt(e)}function Ce(e,t){const i=e._controlledReadableStream;i._state==="readable"&&(Ee(e),Qt(e),xn(i,t))}function xr(e){const t=e._controlledReadableStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function Xi(e){return!An(e)}function Xe(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&t==="readable"}function Pn(e,t,i,s,f,b,y){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Ee(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=y,t._strategyHWM=b,t._pullAlgorithm=s,t._cancelAlgorithm=f,e._readableStreamController=t;const C=i();O(g(C),()=>{t._started=!0,mt(t)},P=>{Ce(t,P)})}function Ji(e,t,i,s){const f=Object.create(Ve.prototype);let b=()=>{},y=()=>g(void 0),C=()=>g(void 0);t.start!==void 0&&(b=()=>t.start(f)),t.pull!==void 0&&(y=()=>t.pull(f)),t.cancel!==void 0&&(C=P=>t.cancel(P)),Pn(e,f,b,y,C,i,s)}function Vt(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function Zi(e,t){return Oe(e._readableStreamController)?eo(e):Ki(e)}function Ki(e,t){const i=Se(e);let s=!1,f=!1,b=!1,y=!1,C,P,F,W,q;const H=S(ne=>{q=ne});function he(){return s?(f=!0,g(void 0)):(s=!0,qe(i,{_chunkSteps:ie=>{Fe(()=>{f=!1;const le=ie,ge=ie;b||Gt(F._readableStreamController,le),y||Gt(W._readableStreamController,ge),s=!1,f&&he()})},_closeSteps:()=>{s=!1,b||bt(F._readableStreamController),y||bt(W._readableStreamController),(!b||!y)&&q(void 0)},_errorSteps:()=>{s=!1}}),g(void 0))}function Je(ne){if(b=!0,C=ne,y){const ie=v([C,P]),le=de(e,ie);q(le)}return H}function Pe(ne){if(y=!0,P=ne,b){const ie=v([C,P]),le=de(e,ie);q(le)}return H}function we(){}return F=Wr(we,he,Je),W=Wr(we,he,Pe),V(i._closedPromise,ne=>{Ce(F._readableStreamController,ne),Ce(W._readableStreamController,ne),(!b||!y)&&q(void 0)}),[F,W]}function eo(e){let t=Se(e),i=!1,s=!1,f=!1,b=!1,y=!1,C,P,F,W,q;const H=S(T=>{q=T});function he(T){V(T._closedPromise,I=>{T===t&&(ce(F._readableStreamController,I),ce(W._readableStreamController,I),(!b||!y)&&q(void 0))})}function Je(){ke(t)&&(fe(t),t=Se(e),he(t)),qe(t,{_chunkSteps:I=>{Fe(()=>{s=!1,f=!1;const M=I;let se=I;if(!b&&!y)try{se=Gr(I)}catch(Ze){ce(F._readableStreamController,Ze),ce(W._readableStreamController,Ze),q(de(e,Ze));return}b||qt(F._readableStreamController,M),y||qt(W._readableStreamController,se),i=!1,s?we():f&&ne()})},_closeSteps:()=>{i=!1,b||ut(F._readableStreamController),y||ut(W._readableStreamController),F._readableStreamController._pendingPullIntos.length>0&&Ot(F._readableStreamController,0),W._readableStreamController._pendingPullIntos.length>0&&Ot(W._readableStreamController,0),(!b||!y)&&q(void 0)},_errorSteps:()=>{i=!1}})}function Pe(T,I){J(t)&&(fe(t),t=on(e),he(t));const M=I?W:F,se=I?F:W;un(t,T,{_chunkSteps:Ke=>{Fe(()=>{s=!1,f=!1;const et=I?y:b;if(I?b:y)et||vt(M._readableStreamController,Ke);else{let Nn;try{Nn=Gr(Ke)}catch(Or){ce(M._readableStreamController,Or),ce(se._readableStreamController,Or),q(de(e,Or));return}et||vt(M._readableStreamController,Ke),qt(se._readableStreamController,Nn)}i=!1,s?we():f&&ne()})},_closeSteps:Ke=>{i=!1;const et=I?y:b,ir=I?b:y;et||ut(M._readableStreamController),ir||ut(se._readableStreamController),Ke!==void 0&&(et||vt(M._readableStreamController,Ke),!ir&&se._readableStreamController._pendingPullIntos.length>0&&Ot(se._readableStreamController,0)),(!et||!ir)&&q(void 0)},_errorSteps:()=>{i=!1}})}function we(){if(i)return s=!0,g(void 0);i=!0;const T=yr(F._readableStreamController);return T===null?Je():Pe(T._view,!1),g(void 0)}function ne(){if(i)return f=!0,g(void 0);i=!0;const T=yr(W._readableStreamController);return T===null?Je():Pe(T._view,!0),g(void 0)}function ie(T){if(b=!0,C=T,y){const I=v([C,P]),M=de(e,I);q(M)}return H}function le(T){if(y=!0,P=T,b){const I=v([C,P]),M=de(e,I);q(M)}return H}function ge(){}return F=Fn(ge,we,ie),W=Fn(ge,ne,le),he(t),[F,W]}function to(e,t){K(e,t);const i=e,s=i?.autoAllocateChunkSize,f=i?.cancel,b=i?.pull,y=i?.start,C=i?.type;return{autoAllocateChunkSize:s===void 0?void 0:$e(s,`${t} has member 'autoAllocateChunkSize' that`),cancel:f===void 0?void 0:ro(f,i,`${t} has member 'cancel' that`),pull:b===void 0?void 0:no(b,i,`${t} has member 'pull' that`),start:y===void 0?void 0:io(y,i,`${t} has member 'start' that`),type:C===void 0?void 0:oo(C,`${t} has member 'type' that`)}}function ro(e,t,i){return te(e,i),s=>be(e,t,[s])}function no(e,t,i){return te(e,i),s=>be(e,t,[s])}function io(e,t,i){return te(e,i),s=>xe(e,t,[s])}function oo(e,t){if(e=`${e}`,e!=="bytes")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function ao(e,t){K(e,t);const i=e?.mode;return{mode:i===void 0?void 0:so(i,`${t} has member 'mode' that`)}}function so(e,t){if(e=`${e}`,e!=="byob")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function uo(e,t){return K(e,t),{preventCancel:!!e?.preventCancel}}function In(e,t){K(e,t);const i=e?.preventAbort,s=e?.preventCancel,f=e?.preventClose,b=e?.signal;return b!==void 0&&lo(b,`${t} has member 'signal' that`),{preventAbort:!!i,preventCancel:!!s,preventClose:!!f,signal:b}}function lo(e,t){if(!Si(e))throw new TypeError(`${t} is not an AbortSignal.`)}function fo(e,t){K(e,t);const i=e?.readable;pe(i,"readable","ReadableWritablePair"),ot(i,`${t} has member 'readable' that`);const s=e?.writable;return pe(s,"writable","ReadableWritablePair"),ln(s,`${t} has member 'writable' that`),{readable:i,writable:s}}class Be{constructor(t={},i={}){t===void 0?t=null:Pt(t,"First parameter");const s=zt(i,"Second parameter"),f=to(t,"First parameter");if(qr(this),f.type==="bytes"){if(s.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");const b=ct(s,0);di(this,f,b)}else{const b=Dt(s),y=ct(s,1);Ji(this,f,y,b)}}get locked(){if(!Te(this))throw Me("locked");return Ae(this)}cancel(t=void 0){return Te(this)?Ae(this)?w(new TypeError("Cannot cancel a stream that already has a reader")):de(this,t):w(Me("cancel"))}getReader(t=void 0){if(!Te(this))throw Me("getReader");return ao(t,"First parameter").mode===void 0?Se(this):on(this)}pipeThrough(t,i={}){if(!Te(this))throw Me("pipeThrough");ue(t,1,"pipeThrough");const s=fo(t,"First parameter"),f=In(i,"Second parameter");if(Ae(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Qe(s.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");const b=Tn(this,s.writable,f.preventClose,f.preventAbort,f.preventCancel,f.signal);return z(b),s.readable}pipeTo(t,i={}){if(!Te(this))return w(Me("pipeTo"));if(t===void 0)return w("Parameter 1 is required in 'pipeTo'.");if(!Ye(t))return w(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let s;try{s=In(i,"Second parameter")}catch(f){return w(f)}return Ae(this)?w(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Qe(t)?w(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Tn(this,t,s.preventClose,s.preventAbort,s.preventCancel,s.signal)}tee(){if(!Te(this))throw Me("tee");const t=Zi(this);return v(t)}values(t=void 0){if(!Te(this))throw Me("values");const i=uo(t,"First parameter");return l(this,i.preventCancel)}}Object.defineProperties(Be.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Be.prototype,d.toStringTag,{value:"ReadableStream",configurable:!0}),typeof d.asyncIterator=="symbol"&&Object.defineProperty(Be.prototype,d.asyncIterator,{value:Be.prototype.values,writable:!0,configurable:!0});function Wr(e,t,i,s=1,f=()=>1){const b=Object.create(Be.prototype);qr(b);const y=Object.create(Ve.prototype);return Pn(b,y,e,t,i,s,f),b}function Fn(e,t,i){const s=Object.create(Be.prototype);qr(s);const f=Object.create(He.prototype);return nn(s,f,e,t,i,0,void 0),s}function qr(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Te(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")?!1:e instanceof Be}function Ae(e){return e._reader!==void 0}function de(e,t){if(e._disturbed=!0,e._state==="closed")return g(void 0);if(e._state==="errored")return w(e._storedError);yt(e);const i=e._reader;i!==void 0&&ke(i)&&(i._readIntoRequests.forEach(f=>{f._closeSteps(void 0)}),i._readIntoRequests=new ae);const s=e._readableStreamController[je](t);return ee(s,_)}function yt(e){e._state="closed";const t=e._reader;t!==void 0&&(Ct(t),J(t)&&(t._readRequests.forEach(i=>{i._closeSteps()}),t._readRequests=new ae))}function xn(e,t){e._state="errored",e._storedError=t;const i=e._reader;i!==void 0&&(nt(i,t),J(i)?(i._readRequests.forEach(s=>{s._errorSteps(t)}),i._readRequests=new ae):(i._readIntoRequests.forEach(s=>{s._errorSteps(t)}),i._readIntoRequests=new ae))}function Me(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function Wn(e,t){K(e,t);const i=e?.highWaterMark;return pe(i,"highWaterMark","QueuingStrategyInit"),{highWaterMark:_e(i)}}const qn=e=>e.byteLength;try{Object.defineProperty(qn,"name",{value:"size",configurable:!0})}catch{}class Xt{constructor(t){ue(t,1,"ByteLengthQueuingStrategy"),t=Wn(t,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!vn(this))throw On("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!vn(this))throw On("size");return qn}}Object.defineProperties(Xt.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Xt.prototype,d.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function On(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function vn(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")?!1:e instanceof Xt}const kn=()=>1;try{Object.defineProperty(kn,"name",{value:"size",configurable:!0})}catch{}class Jt{constructor(t){ue(t,1,"CountQueuingStrategy"),t=Wn(t,"First parameter"),this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!zn(this))throw Dn("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!zn(this))throw Dn("size");return kn}}Object.defineProperties(Jt.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Jt.prototype,d.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function Dn(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function zn(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")?!1:e instanceof Jt}function co(e,t){K(e,t);const i=e?.flush,s=e?.readableType,f=e?.start,b=e?.transform,y=e?.writableType;return{flush:i===void 0?void 0:ho(i,e,`${t} has member 'flush' that`),readableType:s,start:f===void 0?void 0:po(f,e,`${t} has member 'start' that`),transform:b===void 0?void 0:mo(b,e,`${t} has member 'transform' that`),writableType:y}}function ho(e,t,i){return te(e,i),s=>be(e,t,[s])}function po(e,t,i){return te(e,i),s=>xe(e,t,[s])}function mo(e,t,i){return te(e,i),(s,f)=>be(e,t,[s,f])}class Zt{constructor(t={},i={},s={}){t===void 0&&(t=null);const f=zt(i,"Second parameter"),b=zt(s,"Third parameter"),y=co(t,"First parameter");if(y.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(y.writableType!==void 0)throw new RangeError("Invalid writableType specified");const C=ct(b,0),P=Dt(b),F=ct(f,1),W=Dt(f);let q;const H=S(he=>{q=he});bo(this,H,F,W,C,P),_o(this,y),y.start!==void 0?q(y.start(this._transformStreamController)):q(void 0)}get readable(){if(!Mn(this))throw $n("readable");return this._readable}get writable(){if(!Mn(this))throw $n("writable");return this._writable}}Object.defineProperties(Zt.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Zt.prototype,d.toStringTag,{value:"TransformStream",configurable:!0});function bo(e,t,i,s,f,b){function y(){return t}function C(H){return So(e,H)}function P(H){return Ro(e,H)}function F(){return Eo(e)}e._writable=Ci(y,C,F,P,i,s);function W(){return Co(e)}function q(H){return er(e,H),g(void 0)}e._readable=Wr(y,W,q,f,b),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,tr(e,!0),e._transformStreamController=void 0}function Mn(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")?!1:e instanceof Zt}function Kt(e,t){Ce(e._readable._readableStreamController,t),er(e,t)}function er(e,t){Un(e._transformStreamController),Br(e._writable._writableStreamController,t),e._backpressure&&tr(e,!1)}function tr(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=S(i=>{e._backpressureChangePromise_resolve=i}),e._backpressure=t}class _t{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!rr(this))throw nr("desiredSize");const t=this._controlledTransformStream._readable._readableStreamController;return xr(t)}enqueue(t=void 0){if(!rr(this))throw nr("enqueue");jn(this,t)}error(t=void 0){if(!rr(this))throw nr("error");wo(this,t)}terminate(){if(!rr(this))throw nr("terminate");go(this)}}Object.defineProperties(_t.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(_t.prototype,d.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function rr(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")?!1:e instanceof _t}function yo(e,t,i,s){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=i,t._flushAlgorithm=s}function _o(e,t){const i=Object.create(_t.prototype);let s=b=>{try{return jn(i,b),g(void 0)}catch(y){return w(y)}},f=()=>g(void 0);t.transform!==void 0&&(s=b=>t.transform(b,i)),t.flush!==void 0&&(f=()=>t.flush(i)),yo(e,i,s,f)}function Un(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function jn(e,t){const i=e._controlledTransformStream,s=i._readable._readableStreamController;if(!Xe(s))throw new TypeError("Readable side is not in a state that permits enqueue");try{Gt(s,t)}catch(b){throw er(i,b),i._readable._storedError}Xi(s)!==i._backpressure&&tr(i,!0)}function wo(e,t){Kt(e._controlledTransformStream,t)}function Ln(e,t){const i=e._transformAlgorithm(t);return ee(i,void 0,s=>{throw Kt(e._controlledTransformStream,s),s})}function go(e){const t=e._controlledTransformStream,i=t._readable._readableStreamController;bt(i);const s=new TypeError("TransformStream terminated");er(t,s)}function So(e,t){const i=e._transformStreamController;if(e._backpressure){const s=e._backpressureChangePromise;return ee(s,()=>{const f=e._writable;if(f._state==="erroring")throw f._storedError;return Ln(i,t)})}return Ln(i,t)}function Ro(e,t){return Kt(e,t),g(void 0)}function Eo(e){const t=e._readable,i=e._transformStreamController,s=i._flushAlgorithm();return Un(i),ee(s,()=>{if(t._state==="errored")throw t._storedError;bt(t._readableStreamController)},f=>{throw Kt(e,f),t._storedError})}function Co(e){return tr(e,!1),e._backpressureChangePromise}function nr(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function $n(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}p.ByteLengthQueuingStrategy=Xt,p.CountQueuingStrategy=Jt,p.ReadableByteStreamController=He,p.ReadableStream=Be,p.ReadableStreamBYOBReader=ft,p.ReadableStreamBYOBRequest=st,p.ReadableStreamDefaultController=Ve,p.ReadableStreamDefaultReader=We,p.TransformStream=Zt,p.TransformStreamDefaultController=_t,p.WritableStream=dt,p.WritableStreamDefaultController=Ge,p.WritableStreamDefaultWriter=ht,Object.defineProperty(p,"__esModule",{value:!0})})}(or,or.exports)),or.exports}var kr={},wt={},Gn;function Po(){if(Gn)return wt;Gn=1,wt.byteLength=c,wt.toByteArray=Q,wt.fromByteArray=G;for(var B=[],u=[],p=typeof Uint8Array<"u"?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_=0,R=d.length;_0)throw new Error("Invalid string. Length must be a multiple of 4");var w=S.indexOf("=");w===-1&&(w=g);var k=w===g?0:4-w%4;return[w,k]}function c(S){var g=E(S),w=g[0],k=g[1];return(w+k)*3/4-k}function Y(S,g,w){return(g+w)*3/4-w}function Q(S){var g,w=E(S),k=w[0],O=w[1],L=new p(Y(S,k,O)),V=0,ee=O>0?k-4:k,z;for(z=0;z>16&255,L[V++]=g>>8&255,L[V++]=g&255;return O===2&&(g=u[S.charCodeAt(z)]<<2|u[S.charCodeAt(z+1)]>>4,L[V++]=g&255),O===1&&(g=u[S.charCodeAt(z)]<<10|u[S.charCodeAt(z+1)]<<4|u[S.charCodeAt(z+2)]>>2,L[V++]=g>>8&255,L[V++]=g&255),L}function U(S){return B[S>>18&63]+B[S>>12&63]+B[S>>6&63]+B[S&63]}function j(S,g,w){for(var k,O=[],L=g;Lee?ee:V+L));return k===1?(g=S[w-1],O.push(B[g>>2]+B[g<<4&63]+"==")):k===2&&(g=(S[w-2]<<8)+S[w-1],O.push(B[g>>10]+B[g>>4&63]+B[g<<2&63]+"=")),O.join("")}return wt}var ar={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */var Vn;function Io(){return Vn||(Vn=1,ar.read=function(B,u,p,d,_){var R,E,c=_*8-d-1,Y=(1<>1,U=-7,j=p?_-1:0,G=p?-1:1,S=B[u+j];for(j+=G,R=S&(1<<-U)-1,S>>=-U,U+=c;U>0;R=R*256+B[u+j],j+=G,U-=8);for(E=R&(1<<-U)-1,R>>=-U,U+=d;U>0;E=E*256+B[u+j],j+=G,U-=8);if(R===0)R=1-Q;else{if(R===Y)return E?NaN:(S?-1:1)*(1/0);E=E+Math.pow(2,d),R=R-Q}return(S?-1:1)*E*Math.pow(2,R-d)},ar.write=function(B,u,p,d,_,R){var E,c,Y,Q=R*8-_-1,U=(1<>1,G=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=d?0:R-1,g=d?1:-1,w=u<0||u===0&&1/u<0?1:0;for(u=Math.abs(u),isNaN(u)||u===1/0?(c=isNaN(u)?1:0,E=U):(E=Math.floor(Math.log(u)/Math.LN2),u*(Y=Math.pow(2,-E))<1&&(E--,Y*=2),E+j>=1?u+=G/Y:u+=G*Math.pow(2,1-j),u*Y>=2&&(E++,Y/=2),E+j>=U?(c=0,E=U):E+j>=1?(c=(u*Y-1)*Math.pow(2,_),E=E+j):(c=u*Math.pow(2,j-1)*Math.pow(2,_),E=0));_>=8;B[p+S]=c&255,S+=g,c/=256,_-=8);for(E=E<<_|c,Q+=_;Q>0;B[p+S]=E&255,S+=g,E/=256,Q-=8);B[p+S-g]|=w*128}),ar}/*! +import{c as vr,r as jr,g as Bo,F as Hn,a as Yn}from"./index-abdbff68.js";import{errors as ri,isChunkObject as To}from"./util-849946d7.js";var or={exports:{}},Qn;function Ao(){return Qn||(Qn=1,function(B,u){(function(p,d){d(u)})(vr,function(p){const d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol:e=>`Symbol(${e})`;function _(){}function R(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof vr<"u")return vr}const E=R();function c(e){return typeof e=="object"&&e!==null||typeof e=="function"}const Y=_,Q=Promise,U=Promise.prototype.then,j=Promise.resolve.bind(Q),G=Promise.reject.bind(Q);function S(e){return new Q(e)}function g(e){return j(e)}function w(e){return G(e)}function k(e,t,i){return U.call(e,t,i)}function O(e,t,i){k(k(e,t,i),void 0,Y)}function L(e,t){O(e,t)}function V(e,t){O(e,void 0,t)}function ee(e,t,i){return k(e,t,i)}function z(e){k(e,void 0,Y)}const Fe=(()=>{const e=E&&E.queueMicrotask;if(typeof e=="function")return e;const t=g(void 0);return i=>k(t,i)})();function xe(e,t,i){if(typeof e!="function")throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,i)}function be(e,t,i){try{return g(xe(e,t,i))}catch(s){return w(s)}}const St=16384;class ae{constructor(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}get length(){return this._size}push(t){const i=this._back;let s=i;i._elements.length===St-1&&(s={_elements:[],_next:void 0}),i._elements.push(t),s!==i&&(this._back=s,i._next=s),++this._size}shift(){const t=this._front;let i=t;const s=this._cursor;let f=s+1;const b=t._elements,y=b[s];return f===St&&(i=t._next,f=0),--this._size,this._cursor=f,t!==i&&(this._front=i),b[s]=void 0,y}forEach(t){let i=this._cursor,s=this._front,f=s._elements;for(;(i!==f.length||s._next!==void 0)&&!(i===f.length&&(s=s._next,f=s._elements,i=0,f.length===0));)t(f[i]),++i}peek(){const t=this._front,i=this._cursor;return t._elements[i]}}function Rt(e,t){e._ownerReadableStream=t,t._reader=e,t._state==="readable"?Ue(e):t._state==="closed"?lr(e):Et(e,t._storedError)}function rt(e,t){const i=e._ownerReadableStream;return de(i,t)}function fe(e){e._ownerReadableStream._state==="readable"?nt(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")):fr(e,new TypeError("Reader was released and can no longer be used to monitor the stream's closedness")),e._ownerReadableStream._reader=void 0,e._ownerReadableStream=void 0}function ye(e){return new TypeError("Cannot "+e+" a stream using a released reader")}function Ue(e){e._closedPromise=S((t,i)=>{e._closedPromise_resolve=t,e._closedPromise_reject=i})}function Et(e,t){Ue(e),nt(e,t)}function lr(e){Ue(e),Ct(e)}function nt(e,t){e._closedPromise_reject!==void 0&&(z(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}function fr(e,t){Et(e,t)}function Ct(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0)}const N=d("[[AbortSteps]]"),X=d("[[ErrorSteps]]"),je=d("[[CancelSteps]]"),Le=d("[[PullSteps]]"),it=Number.isFinite||function(e){return typeof e=="number"&&isFinite(e)},Bt=Math.trunc||function(e){return e<0?Math.ceil(e):Math.floor(e)};function Tt(e){return typeof e=="object"||typeof e=="function"}function K(e,t){if(e!==void 0&&!Tt(e))throw new TypeError(`${t} is not an object.`)}function te(e,t){if(typeof e!="function")throw new TypeError(`${t} is not a function.`)}function At(e){return typeof e=="object"&&e!==null||typeof e=="function"}function Pt(e,t){if(!At(e))throw new TypeError(`${t} is not an object.`)}function ue(e,t,i){if(e===void 0)throw new TypeError(`Parameter ${t} is required in '${i}'.`)}function pe(e,t,i){if(e===void 0)throw new TypeError(`${t} is required in '${i}'.`)}function _e(e){return Number(e)}function It(e){return e===0?0:e}function cr(e){return It(Bt(e))}function $e(e,t){const s=Number.MAX_SAFE_INTEGER;let f=Number(e);if(f=It(f),!it(f))throw new TypeError(`${t} is not a finite number`);if(f=cr(f),f<0||f>s)throw new TypeError(`${t} is outside the accepted range of 0 to ${s}, inclusive`);return!it(f)||f===0?0:f}function ot(e,t){if(!Te(e))throw new TypeError(`${t} is not a ReadableStream.`)}function Se(e){return new We(e)}function at(e,t){e._reader._readRequests.push(t)}function Re(e,t,i){const f=e._reader._readRequests.shift();i?f._closeSteps():f._chunkSteps(t)}function re(e){return e._reader._readRequests.length}function Ne(e){const t=e._reader;return!(t===void 0||!J(t))}class We{constructor(t){if(ue(t,1,"ReadableStreamDefaultReader"),ot(t,"First parameter"),Ae(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");Rt(this,t),this._readRequests=new ae}get closed(){return J(this)?this._closedPromise:w(o("closed"))}cancel(t=void 0){return J(this)?this._ownerReadableStream===void 0?w(ye("cancel")):rt(this,t):w(o("cancel"))}read(){if(!J(this))return w(o("read"));if(this._ownerReadableStream===void 0)return w(ye("read from"));let t,i;const s=S((b,y)=>{t=b,i=y});return qe(this,{_chunkSteps:b=>t({value:b,done:!1}),_closeSteps:()=>t({value:void 0,done:!0}),_errorSteps:b=>i(b)}),s}releaseLock(){if(!J(this))throw o("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");fe(this)}}}Object.defineProperties(We.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(We.prototype,d.toStringTag,{value:"ReadableStreamDefaultReader",configurable:!0});function J(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_readRequests")?!1:e instanceof We}function qe(e,t){const i=e._ownerReadableStream;i._disturbed=!0,i._state==="closed"?t._closeSteps():i._state==="errored"?t._errorSteps(i._storedError):i._readableStreamController[Le](t)}function o(e){return new TypeError(`ReadableStreamDefaultReader.prototype.${e} can only be used on a ReadableStreamDefaultReader`)}const r=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);class n{constructor(t,i){this._ongoingPromise=void 0,this._isFinished=!1,this._reader=t,this._preventCancel=i}next(){const t=()=>this._nextSteps();return this._ongoingPromise=this._ongoingPromise?ee(this._ongoingPromise,t,t):t(),this._ongoingPromise}return(t){const i=()=>this._returnSteps(t);return this._ongoingPromise?ee(this._ongoingPromise,i,i):i()}_nextSteps(){if(this._isFinished)return Promise.resolve({value:void 0,done:!0});const t=this._reader;if(t._ownerReadableStream===void 0)return w(ye("iterate"));let i,s;const f=S((y,C)=>{i=y,s=C});return qe(t,{_chunkSteps:y=>{this._ongoingPromise=void 0,Fe(()=>i({value:y,done:!1}))},_closeSteps:()=>{this._ongoingPromise=void 0,this._isFinished=!0,fe(t),i({value:void 0,done:!0})},_errorSteps:y=>{this._ongoingPromise=void 0,this._isFinished=!0,fe(t),s(y)}}),f}_returnSteps(t){if(this._isFinished)return Promise.resolve({value:t,done:!0});this._isFinished=!0;const i=this._reader;if(i._ownerReadableStream===void 0)return w(ye("finish iterating"));if(!this._preventCancel){const s=rt(i,t);return fe(i),ee(s,()=>({value:t,done:!0}))}return fe(i),g({value:t,done:!0})}}const a={next(){return h(this)?this._asyncIteratorImpl.next():w(m("next"))},return(e){return h(this)?this._asyncIteratorImpl.return(e):w(m("return"))}};r!==void 0&&Object.setPrototypeOf(a,r);function l(e,t){const i=Se(e),s=new n(i,t),f=Object.create(a);return f._asyncIteratorImpl=s,f}function h(e){if(!c(e)||!Object.prototype.hasOwnProperty.call(e,"_asyncIteratorImpl"))return!1;try{return e._asyncIteratorImpl instanceof n}catch{return!1}}function m(e){return new TypeError(`ReadableStreamAsyncIterator.${e} can only be used on a ReadableSteamAsyncIterator`)}const A=Number.isNaN||function(e){return e!==e};function v(e){return e.slice()}function D(e,t,i,s,f){new Uint8Array(e).set(new Uint8Array(i,s,f),t)}function $(e){return e}function x(e){return!1}function Qr(e,t,i){if(e.slice)return e.slice(t,i);const s=i-t,f=new ArrayBuffer(s);return D(f,0,e,t,s),f}function ai(e){return!(typeof e!="number"||A(e)||e<0)}function Gr(e){const t=Qr(e.buffer,e.byteOffset,e.byteOffset+e.byteLength);return new Uint8Array(t)}function dr(e){const t=e._queue.shift();return e._queueTotalSize-=t.size,e._queueTotalSize<0&&(e._queueTotalSize=0),t.value}function hr(e,t,i){if(!ai(i)||i===1/0)throw new RangeError("Size must be a finite, non-NaN, non-negative number.");e._queue.push({value:t,size:i}),e._queueTotalSize+=i}function si(e){return e._queue.peek().value}function Ee(e){e._queue=new ae,e._queueTotalSize=0}class st{constructor(){throw new TypeError("Illegal constructor")}get view(){if(!pr(this))throw _r("view");return this._view}respond(t){if(!pr(this))throw _r("respond");if(ue(t,1,"respond"),t=$e(t,"First parameter"),this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");x(this._view.buffer),Ot(this._associatedReadableByteStreamController,t)}respondWithNewView(t){if(!pr(this))throw _r("respondWithNewView");if(ue(t,1,"respondWithNewView"),!ArrayBuffer.isView(t))throw new TypeError("You can only respond with array buffer views");if(this._associatedReadableByteStreamController===void 0)throw new TypeError("This BYOB request has been invalidated");x(t.buffer),vt(this._associatedReadableByteStreamController,t)}}Object.defineProperties(st.prototype,{respond:{enumerable:!0},respondWithNewView:{enumerable:!0},view:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(st.prototype,d.toStringTag,{value:"ReadableStreamBYOBRequest",configurable:!0});class He{constructor(){throw new TypeError("Illegal constructor")}get byobRequest(){if(!Oe(this))throw lt("byobRequest");return yr(this)}get desiredSize(){if(!Oe(this))throw lt("desiredSize");return rn(this)}close(){if(!Oe(this))throw lt("close");if(this._closeRequested)throw new TypeError("The stream has already been closed; do not close it again!");const t=this._controlledReadableByteStream._state;if(t!=="readable")throw new TypeError(`The stream (in ${t} state) is not in the readable state and cannot be closed`);ut(this)}enqueue(t){if(!Oe(this))throw lt("enqueue");if(ue(t,1,"enqueue"),!ArrayBuffer.isView(t))throw new TypeError("chunk must be an array buffer view");if(t.byteLength===0)throw new TypeError("chunk must have non-zero byteLength");if(t.buffer.byteLength===0)throw new TypeError("chunk's buffer must have non-zero byteLength");if(this._closeRequested)throw new TypeError("stream is closed or draining");const i=this._controlledReadableByteStream._state;if(i!=="readable")throw new TypeError(`The stream (in ${i} state) is not in the readable state and cannot be enqueued to`);qt(this,t)}error(t=void 0){if(!Oe(this))throw lt("error");ce(this,t)}[je](t){Vr(this),Ee(this);const i=this._cancelAlgorithm(t);return Wt(this),i}[Le](t){const i=this._controlledReadableByteStream;if(this._queueTotalSize>0){const f=this._queue.shift();this._queueTotalSize-=f.byteLength,Kr(this);const b=new Uint8Array(f.buffer,f.byteOffset,f.byteLength);t._chunkSteps(b);return}const s=this._autoAllocateChunkSize;if(s!==void 0){let f;try{f=new ArrayBuffer(s)}catch(y){t._errorSteps(y);return}const b={buffer:f,bufferByteLength:s,byteOffset:0,byteLength:s,bytesFilled:0,elementSize:1,viewConstructor:Uint8Array,readerType:"default"};this._pendingPullIntos.push(b)}at(i,t),ve(this)}}Object.defineProperties(He.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},byobRequest:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(He.prototype,d.toStringTag,{value:"ReadableByteStreamController",configurable:!0});function Oe(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledReadableByteStream")?!1:e instanceof He}function pr(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_associatedReadableByteStreamController")?!1:e instanceof st}function ve(e){if(!ci(e))return;if(e._pulling){e._pullAgain=!0;return}e._pulling=!0;const i=e._pullAlgorithm();O(i,()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,ve(e))},s=>{ce(e,s)})}function Vr(e){br(e),e._pendingPullIntos=new ae}function mr(e,t){let i=!1;e._state==="closed"&&(i=!0);const s=Xr(t);t.readerType==="default"?Re(e,s,i):pi(e,s,i)}function Xr(e){const t=e.bytesFilled,i=e.elementSize;return new e.viewConstructor(e.buffer,e.byteOffset,t/i)}function Ft(e,t,i,s){e._queue.push({buffer:t,byteOffset:i,byteLength:s}),e._queueTotalSize+=s}function Jr(e,t){const i=t.elementSize,s=t.bytesFilled-t.bytesFilled%i,f=Math.min(e._queueTotalSize,t.byteLength-t.bytesFilled),b=t.bytesFilled+f,y=b-b%i;let C=f,P=!1;y>s&&(C=y-t.bytesFilled,P=!0);const F=e._queue;for(;C>0;){const W=F.peek(),q=Math.min(C,W.byteLength),H=t.byteOffset+t.bytesFilled;D(t.buffer,H,W.buffer,W.byteOffset,q),W.byteLength===q?F.shift():(W.byteOffset+=q,W.byteLength-=q),e._queueTotalSize-=q,Zr(e,q,t),C-=q}return P}function Zr(e,t,i){i.bytesFilled+=t}function Kr(e){e._queueTotalSize===0&&e._closeRequested?(Wt(e),yt(e._controlledReadableByteStream)):ve(e)}function br(e){e._byobRequest!==null&&(e._byobRequest._associatedReadableByteStreamController=void 0,e._byobRequest._view=null,e._byobRequest=null)}function en(e){for(;e._pendingPullIntos.length>0;){if(e._queueTotalSize===0)return;const t=e._pendingPullIntos.peek();Jr(e,t)&&(xt(e),mr(e._controlledReadableByteStream,t))}}function ui(e,t,i){const s=e._controlledReadableByteStream;let f=1;t.constructor!==DataView&&(f=t.constructor.BYTES_PER_ELEMENT);const b=t.constructor,y=t.buffer,C={buffer:y,bufferByteLength:y.byteLength,byteOffset:t.byteOffset,byteLength:t.byteLength,bytesFilled:0,elementSize:f,viewConstructor:b,readerType:"byob"};if(e._pendingPullIntos.length>0){e._pendingPullIntos.push(C),an(s,i);return}if(s._state==="closed"){const P=new b(C.buffer,C.byteOffset,0);i._closeSteps(P);return}if(e._queueTotalSize>0){if(Jr(e,C)){const P=Xr(C);Kr(e),i._chunkSteps(P);return}if(e._closeRequested){const P=new TypeError("Insufficient bytes to fill elements in the given buffer");ce(e,P),i._errorSteps(P);return}}e._pendingPullIntos.push(C),an(s,i),ve(e)}function li(e,t){const i=e._controlledReadableByteStream;if(wr(i))for(;sn(i)>0;){const s=xt(e);mr(i,s)}}function fi(e,t,i){if(Zr(e,t,i),i.bytesFilled0){const f=i.byteOffset+i.bytesFilled,b=Qr(i.buffer,f-s,f);Ft(e,b,0,b.byteLength)}i.bytesFilled-=s,mr(e._controlledReadableByteStream,i),en(e)}function tn(e,t){const i=e._pendingPullIntos.peek();br(e),e._controlledReadableByteStream._state==="closed"?li(e):fi(e,t,i),ve(e)}function xt(e){return e._pendingPullIntos.shift()}function ci(e){const t=e._controlledReadableByteStream;return t._state!=="readable"||e._closeRequested||!e._started?!1:!!(Ne(t)&&re(t)>0||wr(t)&&sn(t)>0||rn(e)>0)}function Wt(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0}function ut(e){const t=e._controlledReadableByteStream;if(!(e._closeRequested||t._state!=="readable")){if(e._queueTotalSize>0){e._closeRequested=!0;return}if(e._pendingPullIntos.length>0&&e._pendingPullIntos.peek().bytesFilled>0){const s=new TypeError("Insufficient bytes to fill elements in the given buffer");throw ce(e,s),s}Wt(e),yt(t)}}function qt(e,t){const i=e._controlledReadableByteStream;if(e._closeRequested||i._state!=="readable")return;const s=t.buffer,f=t.byteOffset,b=t.byteLength,y=s;if(e._pendingPullIntos.length>0){const C=e._pendingPullIntos.peek();x(C.buffer),C.buffer=C.buffer}if(br(e),Ne(i))if(re(i)===0)Ft(e,y,f,b);else{e._pendingPullIntos.length>0&&xt(e);const C=new Uint8Array(y,f,b);Re(i,C,!1)}else wr(i)?(Ft(e,y,f,b),en(e)):Ft(e,y,f,b);ve(e)}function ce(e,t){const i=e._controlledReadableByteStream;i._state==="readable"&&(Vr(e),Ee(e),Wt(e),xn(i,t))}function yr(e){if(e._byobRequest===null&&e._pendingPullIntos.length>0){const t=e._pendingPullIntos.peek(),i=new Uint8Array(t.buffer,t.byteOffset+t.bytesFilled,t.byteLength-t.bytesFilled),s=Object.create(st.prototype);hi(s,e,i),e._byobRequest=s}return e._byobRequest}function rn(e){const t=e._controlledReadableByteStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function Ot(e,t){const i=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t!==0)throw new TypeError("bytesWritten must be 0 when calling respond() on a closed stream")}else{if(t===0)throw new TypeError("bytesWritten must be greater than 0 when calling respond() on a readable stream");if(i.bytesFilled+t>i.byteLength)throw new RangeError("bytesWritten out of range")}i.buffer=i.buffer,tn(e,t)}function vt(e,t){const i=e._pendingPullIntos.peek();if(e._controlledReadableByteStream._state==="closed"){if(t.byteLength!==0)throw new TypeError("The view's length must be 0 when calling respondWithNewView() on a closed stream")}else if(t.byteLength===0)throw new TypeError("The view's length must be greater than 0 when calling respondWithNewView() on a readable stream");if(i.byteOffset+i.bytesFilled!==t.byteOffset)throw new RangeError("The region specified by view does not match byobRequest");if(i.bufferByteLength!==t.buffer.byteLength)throw new RangeError("The buffer of view has different capacity than byobRequest");if(i.bytesFilled+t.byteLength>i.byteLength)throw new RangeError("The region specified by view is larger than byobRequest");const f=t.byteLength;i.buffer=t.buffer,tn(e,f)}function nn(e,t,i,s,f,b,y){t._controlledReadableByteStream=e,t._pullAgain=!1,t._pulling=!1,t._byobRequest=null,t._queue=t._queueTotalSize=void 0,Ee(t),t._closeRequested=!1,t._started=!1,t._strategyHWM=b,t._pullAlgorithm=s,t._cancelAlgorithm=f,t._autoAllocateChunkSize=y,t._pendingPullIntos=new ae,e._readableStreamController=t;const C=i();O(g(C),()=>{t._started=!0,ve(t)},P=>{ce(t,P)})}function di(e,t,i){const s=Object.create(He.prototype);let f=()=>{},b=()=>g(void 0),y=()=>g(void 0);t.start!==void 0&&(f=()=>t.start(s)),t.pull!==void 0&&(b=()=>t.pull(s)),t.cancel!==void 0&&(y=P=>t.cancel(P));const C=t.autoAllocateChunkSize;if(C===0)throw new TypeError("autoAllocateChunkSize must be greater than 0");nn(e,s,f,b,y,i,C)}function hi(e,t,i){e._associatedReadableByteStreamController=t,e._view=i}function _r(e){return new TypeError(`ReadableStreamBYOBRequest.prototype.${e} can only be used on a ReadableStreamBYOBRequest`)}function lt(e){return new TypeError(`ReadableByteStreamController.prototype.${e} can only be used on a ReadableByteStreamController`)}function on(e){return new ft(e)}function an(e,t){e._reader._readIntoRequests.push(t)}function pi(e,t,i){const f=e._reader._readIntoRequests.shift();i?f._closeSteps(t):f._chunkSteps(t)}function sn(e){return e._reader._readIntoRequests.length}function wr(e){const t=e._reader;return!(t===void 0||!ke(t))}class ft{constructor(t){if(ue(t,1,"ReadableStreamBYOBReader"),ot(t,"First parameter"),Ae(t))throw new TypeError("This stream has already been locked for exclusive reading by another reader");if(!Oe(t._readableStreamController))throw new TypeError("Cannot construct a ReadableStreamBYOBReader for a stream not constructed with a byte source");Rt(this,t),this._readIntoRequests=new ae}get closed(){return ke(this)?this._closedPromise:w(kt("closed"))}cancel(t=void 0){return ke(this)?this._ownerReadableStream===void 0?w(ye("cancel")):rt(this,t):w(kt("cancel"))}read(t){if(!ke(this))return w(kt("read"));if(!ArrayBuffer.isView(t))return w(new TypeError("view must be an array buffer view"));if(t.byteLength===0)return w(new TypeError("view must have non-zero byteLength"));if(t.buffer.byteLength===0)return w(new TypeError("view's buffer must have non-zero byteLength"));if(x(t.buffer),this._ownerReadableStream===void 0)return w(ye("read from"));let i,s;const f=S((y,C)=>{i=y,s=C});return un(this,t,{_chunkSteps:y=>i({value:y,done:!1}),_closeSteps:y=>i({value:y,done:!0}),_errorSteps:y=>s(y)}),f}releaseLock(){if(!ke(this))throw kt("releaseLock");if(this._ownerReadableStream!==void 0){if(this._readIntoRequests.length>0)throw new TypeError("Tried to release a reader lock when that reader has pending read() calls un-settled");fe(this)}}}Object.defineProperties(ft.prototype,{cancel:{enumerable:!0},read:{enumerable:!0},releaseLock:{enumerable:!0},closed:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(ft.prototype,d.toStringTag,{value:"ReadableStreamBYOBReader",configurable:!0});function ke(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_readIntoRequests")?!1:e instanceof ft}function un(e,t,i){const s=e._ownerReadableStream;s._disturbed=!0,s._state==="errored"?i._errorSteps(s._storedError):ui(s._readableStreamController,t,i)}function kt(e){return new TypeError(`ReadableStreamBYOBReader.prototype.${e} can only be used on a ReadableStreamBYOBReader`)}function ct(e,t){const{highWaterMark:i}=e;if(i===void 0)return t;if(A(i)||i<0)throw new RangeError("Invalid highWaterMark");return i}function Dt(e){const{size:t}=e;return t||(()=>1)}function zt(e,t){K(e,t);const i=e?.highWaterMark,s=e?.size;return{highWaterMark:i===void 0?void 0:_e(i),size:s===void 0?void 0:mi(s,`${t} has member 'size' that`)}}function mi(e,t){return te(e,t),i=>_e(e(i))}function bi(e,t){K(e,t);const i=e?.abort,s=e?.close,f=e?.start,b=e?.type,y=e?.write;return{abort:i===void 0?void 0:yi(i,e,`${t} has member 'abort' that`),close:s===void 0?void 0:_i(s,e,`${t} has member 'close' that`),start:f===void 0?void 0:wi(f,e,`${t} has member 'start' that`),write:y===void 0?void 0:gi(y,e,`${t} has member 'write' that`),type:b}}function yi(e,t,i){return te(e,i),s=>be(e,t,[s])}function _i(e,t,i){return te(e,i),()=>be(e,t,[])}function wi(e,t,i){return te(e,i),s=>xe(e,t,[s])}function gi(e,t,i){return te(e,i),(s,f)=>be(e,t,[s,f])}function ln(e,t){if(!Ye(e))throw new TypeError(`${t} is not a WritableStream.`)}function Si(e){if(typeof e!="object"||e===null)return!1;try{return typeof e.aborted=="boolean"}catch{return!1}}const Ri=typeof AbortController=="function";function Ei(){if(Ri)return new AbortController}class dt{constructor(t={},i={}){t===void 0?t=null:Pt(t,"First parameter");const s=zt(i,"Second parameter"),f=bi(t,"First parameter");if(cn(this),f.type!==void 0)throw new RangeError("Invalid type is specified");const y=Dt(s),C=ct(s,1);Di(this,f,C,y)}get locked(){if(!Ye(this))throw $t("locked");return Qe(this)}abort(t=void 0){return Ye(this)?Qe(this)?w(new TypeError("Cannot abort a stream that already has a writer")):Mt(this,t):w($t("abort"))}close(){return Ye(this)?Qe(this)?w(new TypeError("Cannot close a stream that already has a writer")):me(this)?w(new TypeError("Cannot close an already-closing stream")):dn(this):w($t("close"))}getWriter(){if(!Ye(this))throw $t("getWriter");return fn(this)}}Object.defineProperties(dt.prototype,{abort:{enumerable:!0},close:{enumerable:!0},getWriter:{enumerable:!0},locked:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(dt.prototype,d.toStringTag,{value:"WritableStream",configurable:!0});function fn(e){return new ht(e)}function Ci(e,t,i,s,f=1,b=()=>1){const y=Object.create(dt.prototype);cn(y);const C=Object.create(Ge.prototype);return _n(y,C,e,t,i,s,f,b),y}function cn(e){e._state="writable",e._storedError=void 0,e._writer=void 0,e._writableStreamController=void 0,e._writeRequests=new ae,e._inFlightWriteRequest=void 0,e._closeRequest=void 0,e._inFlightCloseRequest=void 0,e._pendingAbortRequest=void 0,e._backpressure=!1}function Ye(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_writableStreamController")?!1:e instanceof dt}function Qe(e){return e._writer!==void 0}function Mt(e,t){var i;if(e._state==="closed"||e._state==="errored")return g(void 0);e._writableStreamController._abortReason=t,(i=e._writableStreamController._abortController)===null||i===void 0||i.abort();const s=e._state;if(s==="closed"||s==="errored")return g(void 0);if(e._pendingAbortRequest!==void 0)return e._pendingAbortRequest._promise;let f=!1;s==="erroring"&&(f=!0,t=void 0);const b=S((y,C)=>{e._pendingAbortRequest={_promise:void 0,_resolve:y,_reject:C,_reason:t,_wasAlreadyErroring:f}});return e._pendingAbortRequest._promise=b,f||Sr(e,t),b}function dn(e){const t=e._state;if(t==="closed"||t==="errored")return w(new TypeError(`The stream (in ${t} state) is not in the writable state and cannot be closed`));const i=S((f,b)=>{const y={_resolve:f,_reject:b};e._closeRequest=y}),s=e._writer;return s!==void 0&&e._backpressure&&t==="writable"&&Fr(s),zi(e._writableStreamController),i}function Bi(e){return S((i,s)=>{const f={_resolve:i,_reject:s};e._writeRequests.push(f)})}function gr(e,t){if(e._state==="writable"){Sr(e,t);return}Rr(e)}function Sr(e,t){const i=e._writableStreamController;e._state="erroring",e._storedError=t;const s=e._writer;s!==void 0&&pn(s,t),!Fi(e)&&i._started&&Rr(e)}function Rr(e){e._state="errored",e._writableStreamController[X]();const t=e._storedError;if(e._writeRequests.forEach(f=>{f._reject(t)}),e._writeRequests=new ae,e._pendingAbortRequest===void 0){Ut(e);return}const i=e._pendingAbortRequest;if(e._pendingAbortRequest=void 0,i._wasAlreadyErroring){i._reject(t),Ut(e);return}const s=e._writableStreamController[N](i._reason);O(s,()=>{i._resolve(),Ut(e)},f=>{i._reject(f),Ut(e)})}function Ti(e){e._inFlightWriteRequest._resolve(void 0),e._inFlightWriteRequest=void 0}function Ai(e,t){e._inFlightWriteRequest._reject(t),e._inFlightWriteRequest=void 0,gr(e,t)}function Pi(e){e._inFlightCloseRequest._resolve(void 0),e._inFlightCloseRequest=void 0,e._state==="erroring"&&(e._storedError=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._resolve(),e._pendingAbortRequest=void 0)),e._state="closed";const i=e._writer;i!==void 0&&Rn(i)}function Ii(e,t){e._inFlightCloseRequest._reject(t),e._inFlightCloseRequest=void 0,e._pendingAbortRequest!==void 0&&(e._pendingAbortRequest._reject(t),e._pendingAbortRequest=void 0),gr(e,t)}function me(e){return!(e._closeRequest===void 0&&e._inFlightCloseRequest===void 0)}function Fi(e){return!(e._inFlightWriteRequest===void 0&&e._inFlightCloseRequest===void 0)}function xi(e){e._inFlightCloseRequest=e._closeRequest,e._closeRequest=void 0}function Wi(e){e._inFlightWriteRequest=e._writeRequests.shift()}function Ut(e){e._closeRequest!==void 0&&(e._closeRequest._reject(e._storedError),e._closeRequest=void 0);const t=e._writer;t!==void 0&&Pr(t,e._storedError)}function Er(e,t){const i=e._writer;i!==void 0&&t!==e._backpressure&&(t?Hi(i):Fr(i)),e._backpressure=t}class ht{constructor(t){if(ue(t,1,"WritableStreamDefaultWriter"),ln(t,"First parameter"),Qe(t))throw new TypeError("This stream has already been locked for exclusive writing by another writer");this._ownerWritableStream=t,t._writer=this;const i=t._state;if(i==="writable")!me(t)&&t._backpressure?Ht(this):En(this),Nt(this);else if(i==="erroring")Ir(this,t._storedError),Nt(this);else if(i==="closed")En(this),$i(this);else{const s=t._storedError;Ir(this,s),Sn(this,s)}}get closed(){return De(this)?this._closedPromise:w(ze("closed"))}get desiredSize(){if(!De(this))throw ze("desiredSize");if(this._ownerWritableStream===void 0)throw pt("desiredSize");return ki(this)}get ready(){return De(this)?this._readyPromise:w(ze("ready"))}abort(t=void 0){return De(this)?this._ownerWritableStream===void 0?w(pt("abort")):qi(this,t):w(ze("abort"))}close(){if(!De(this))return w(ze("close"));const t=this._ownerWritableStream;return t===void 0?w(pt("close")):me(t)?w(new TypeError("Cannot close an already-closing stream")):hn(this)}releaseLock(){if(!De(this))throw ze("releaseLock");this._ownerWritableStream!==void 0&&mn(this)}write(t=void 0){return De(this)?this._ownerWritableStream===void 0?w(pt("write to")):bn(this,t):w(ze("write"))}}Object.defineProperties(ht.prototype,{abort:{enumerable:!0},close:{enumerable:!0},releaseLock:{enumerable:!0},write:{enumerable:!0},closed:{enumerable:!0},desiredSize:{enumerable:!0},ready:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(ht.prototype,d.toStringTag,{value:"WritableStreamDefaultWriter",configurable:!0});function De(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_ownerWritableStream")?!1:e instanceof ht}function qi(e,t){const i=e._ownerWritableStream;return Mt(i,t)}function hn(e){const t=e._ownerWritableStream;return dn(t)}function Oi(e){const t=e._ownerWritableStream,i=t._state;return me(t)||i==="closed"?g(void 0):i==="errored"?w(t._storedError):hn(e)}function vi(e,t){e._closedPromiseState==="pending"?Pr(e,t):Ni(e,t)}function pn(e,t){e._readyPromiseState==="pending"?Cn(e,t):Yi(e,t)}function ki(e){const t=e._ownerWritableStream,i=t._state;return i==="errored"||i==="erroring"?null:i==="closed"?0:wn(t._writableStreamController)}function mn(e){const t=e._ownerWritableStream,i=new TypeError("Writer was released and can no longer be used to monitor the stream's closedness");pn(e,i),vi(e,i),t._writer=void 0,e._ownerWritableStream=void 0}function bn(e,t){const i=e._ownerWritableStream,s=i._writableStreamController,f=Mi(s,t);if(i!==e._ownerWritableStream)return w(pt("write to"));const b=i._state;if(b==="errored")return w(i._storedError);if(me(i)||b==="closed")return w(new TypeError("The stream is closing or closed and cannot be written to"));if(b==="erroring")return w(i._storedError);const y=Bi(i);return Ui(s,t,f),y}const yn={};class Ge{constructor(){throw new TypeError("Illegal constructor")}get abortReason(){if(!Cr(this))throw Ar("abortReason");return this._abortReason}get signal(){if(!Cr(this))throw Ar("signal");if(this._abortController===void 0)throw new TypeError("WritableStreamDefaultController.prototype.signal is not supported");return this._abortController.signal}error(t=void 0){if(!Cr(this))throw Ar("error");this._controlledWritableStream._state==="writable"&&gn(this,t)}[N](t){const i=this._abortAlgorithm(t);return jt(this),i}[X](){Ee(this)}}Object.defineProperties(Ge.prototype,{abortReason:{enumerable:!0},signal:{enumerable:!0},error:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Ge.prototype,d.toStringTag,{value:"WritableStreamDefaultController",configurable:!0});function Cr(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledWritableStream")?!1:e instanceof Ge}function _n(e,t,i,s,f,b,y,C){t._controlledWritableStream=e,e._writableStreamController=t,t._queue=void 0,t._queueTotalSize=void 0,Ee(t),t._abortReason=void 0,t._abortController=Ei(),t._started=!1,t._strategySizeAlgorithm=C,t._strategyHWM=y,t._writeAlgorithm=s,t._closeAlgorithm=f,t._abortAlgorithm=b;const P=Tr(t);Er(e,P);const F=i(),W=g(F);O(W,()=>{t._started=!0,Lt(t)},q=>{t._started=!0,gr(e,q)})}function Di(e,t,i,s){const f=Object.create(Ge.prototype);let b=()=>{},y=()=>g(void 0),C=()=>g(void 0),P=()=>g(void 0);t.start!==void 0&&(b=()=>t.start(f)),t.write!==void 0&&(y=F=>t.write(F,f)),t.close!==void 0&&(C=()=>t.close()),t.abort!==void 0&&(P=F=>t.abort(F)),_n(e,f,b,y,C,P,i,s)}function jt(e){e._writeAlgorithm=void 0,e._closeAlgorithm=void 0,e._abortAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function zi(e){hr(e,yn,0),Lt(e)}function Mi(e,t){try{return e._strategySizeAlgorithm(t)}catch(i){return Br(e,i),1}}function wn(e){return e._strategyHWM-e._queueTotalSize}function Ui(e,t,i){try{hr(e,t,i)}catch(f){Br(e,f);return}const s=e._controlledWritableStream;if(!me(s)&&s._state==="writable"){const f=Tr(e);Er(s,f)}Lt(e)}function Lt(e){const t=e._controlledWritableStream;if(!e._started||t._inFlightWriteRequest!==void 0)return;if(t._state==="erroring"){Rr(t);return}if(e._queue.length===0)return;const s=si(e);s===yn?ji(e):Li(e,s)}function Br(e,t){e._controlledWritableStream._state==="writable"&&gn(e,t)}function ji(e){const t=e._controlledWritableStream;xi(t),dr(e);const i=e._closeAlgorithm();jt(e),O(i,()=>{Pi(t)},s=>{Ii(t,s)})}function Li(e,t){const i=e._controlledWritableStream;Wi(i);const s=e._writeAlgorithm(t);O(s,()=>{Ti(i);const f=i._state;if(dr(e),!me(i)&&f==="writable"){const b=Tr(e);Er(i,b)}Lt(e)},f=>{i._state==="writable"&&jt(e),Ai(i,f)})}function Tr(e){return wn(e)<=0}function gn(e,t){const i=e._controlledWritableStream;jt(e),Sr(i,t)}function $t(e){return new TypeError(`WritableStream.prototype.${e} can only be used on a WritableStream`)}function Ar(e){return new TypeError(`WritableStreamDefaultController.prototype.${e} can only be used on a WritableStreamDefaultController`)}function ze(e){return new TypeError(`WritableStreamDefaultWriter.prototype.${e} can only be used on a WritableStreamDefaultWriter`)}function pt(e){return new TypeError("Cannot "+e+" a stream using a released writer")}function Nt(e){e._closedPromise=S((t,i)=>{e._closedPromise_resolve=t,e._closedPromise_reject=i,e._closedPromiseState="pending"})}function Sn(e,t){Nt(e),Pr(e,t)}function $i(e){Nt(e),Rn(e)}function Pr(e,t){e._closedPromise_reject!==void 0&&(z(e._closedPromise),e._closedPromise_reject(t),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="rejected")}function Ni(e,t){Sn(e,t)}function Rn(e){e._closedPromise_resolve!==void 0&&(e._closedPromise_resolve(void 0),e._closedPromise_resolve=void 0,e._closedPromise_reject=void 0,e._closedPromiseState="resolved")}function Ht(e){e._readyPromise=S((t,i)=>{e._readyPromise_resolve=t,e._readyPromise_reject=i}),e._readyPromiseState="pending"}function Ir(e,t){Ht(e),Cn(e,t)}function En(e){Ht(e),Fr(e)}function Cn(e,t){e._readyPromise_reject!==void 0&&(z(e._readyPromise),e._readyPromise_reject(t),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="rejected")}function Hi(e){Ht(e)}function Yi(e,t){Ir(e,t)}function Fr(e){e._readyPromise_resolve!==void 0&&(e._readyPromise_resolve(void 0),e._readyPromise_resolve=void 0,e._readyPromise_reject=void 0,e._readyPromiseState="fulfilled")}const Bn=typeof DOMException<"u"?DOMException:void 0;function Qi(e){if(!(typeof e=="function"||typeof e=="object"))return!1;try{return new e,!0}catch{return!1}}function Gi(){const e=function(i,s){this.message=i||"",this.name=s||"Error",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)};return e.prototype=Object.create(Error.prototype),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,configurable:!0}),e}const Vi=Qi(Bn)?Bn:Gi();function Tn(e,t,i,s,f,b){const y=Se(e),C=fn(t);e._disturbed=!0;let P=!1,F=g(void 0);return S((W,q)=>{let H;if(b!==void 0){if(H=()=>{const T=new Vi("Aborted","AbortError"),I=[];s||I.push(()=>t._state==="writable"?Mt(t,T):g(void 0)),f||I.push(()=>e._state==="readable"?de(e,T):g(void 0)),ie(()=>Promise.all(I.map(M=>M())),!0,T)},b.aborted){H();return}b.addEventListener("abort",H)}function he(){return S((T,I)=>{function M(se){se?T():k(Je(),M,I)}M(!1)})}function Je(){return P?g(!0):k(C._readyPromise,()=>S((T,I)=>{qe(y,{_chunkSteps:M=>{F=k(bn(C,M),void 0,_),T(!1)},_closeSteps:()=>T(!0),_errorSteps:I})}))}if(we(e,y._closedPromise,T=>{s?le(!0,T):ie(()=>Mt(t,T),!0,T)}),we(t,C._closedPromise,T=>{f?le(!0,T):ie(()=>de(e,T),!0,T)}),ne(e,y._closedPromise,()=>{i?le():ie(()=>Oi(C))}),me(t)||t._state==="closed"){const T=new TypeError("the destination writable stream closed before all data could be piped to it");f?le(!0,T):ie(()=>de(e,T),!0,T)}z(he());function Pe(){const T=F;return k(F,()=>T!==F?Pe():void 0)}function we(T,I,M){T._state==="errored"?M(T._storedError):V(I,M)}function ne(T,I,M){T._state==="closed"?M():L(I,M)}function ie(T,I,M){if(P)return;P=!0,t._state==="writable"&&!me(t)?L(Pe(),se):se();function se(){O(T(),()=>ge(I,M),Ze=>ge(!0,Ze))}}function le(T,I){P||(P=!0,t._state==="writable"&&!me(t)?L(Pe(),()=>ge(T,I)):ge(T,I))}function ge(T,I){mn(C),fe(y),b!==void 0&&b.removeEventListener("abort",H),T?q(I):W(void 0)}})}class Ve{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!Yt(this))throw Vt("desiredSize");return xr(this)}close(){if(!Yt(this))throw Vt("close");if(!Xe(this))throw new TypeError("The stream is not in a state that permits close");bt(this)}enqueue(t=void 0){if(!Yt(this))throw Vt("enqueue");if(!Xe(this))throw new TypeError("The stream is not in a state that permits enqueue");return Gt(this,t)}error(t=void 0){if(!Yt(this))throw Vt("error");Ce(this,t)}[je](t){Ee(this);const i=this._cancelAlgorithm(t);return Qt(this),i}[Le](t){const i=this._controlledReadableStream;if(this._queue.length>0){const s=dr(this);this._closeRequested&&this._queue.length===0?(Qt(this),yt(i)):mt(this),t._chunkSteps(s)}else at(i,t),mt(this)}}Object.defineProperties(Ve.prototype,{close:{enumerable:!0},enqueue:{enumerable:!0},error:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Ve.prototype,d.toStringTag,{value:"ReadableStreamDefaultController",configurable:!0});function Yt(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledReadableStream")?!1:e instanceof Ve}function mt(e){if(!An(e))return;if(e._pulling){e._pullAgain=!0;return}e._pulling=!0;const i=e._pullAlgorithm();O(i,()=>{e._pulling=!1,e._pullAgain&&(e._pullAgain=!1,mt(e))},s=>{Ce(e,s)})}function An(e){const t=e._controlledReadableStream;return!Xe(e)||!e._started?!1:!!(Ae(t)&&re(t)>0||xr(e)>0)}function Qt(e){e._pullAlgorithm=void 0,e._cancelAlgorithm=void 0,e._strategySizeAlgorithm=void 0}function bt(e){if(!Xe(e))return;const t=e._controlledReadableStream;e._closeRequested=!0,e._queue.length===0&&(Qt(e),yt(t))}function Gt(e,t){if(!Xe(e))return;const i=e._controlledReadableStream;if(Ae(i)&&re(i)>0)Re(i,t,!1);else{let s;try{s=e._strategySizeAlgorithm(t)}catch(f){throw Ce(e,f),f}try{hr(e,t,s)}catch(f){throw Ce(e,f),f}}mt(e)}function Ce(e,t){const i=e._controlledReadableStream;i._state==="readable"&&(Ee(e),Qt(e),xn(i,t))}function xr(e){const t=e._controlledReadableStream._state;return t==="errored"?null:t==="closed"?0:e._strategyHWM-e._queueTotalSize}function Xi(e){return!An(e)}function Xe(e){const t=e._controlledReadableStream._state;return!e._closeRequested&&t==="readable"}function Pn(e,t,i,s,f,b,y){t._controlledReadableStream=e,t._queue=void 0,t._queueTotalSize=void 0,Ee(t),t._started=!1,t._closeRequested=!1,t._pullAgain=!1,t._pulling=!1,t._strategySizeAlgorithm=y,t._strategyHWM=b,t._pullAlgorithm=s,t._cancelAlgorithm=f,e._readableStreamController=t;const C=i();O(g(C),()=>{t._started=!0,mt(t)},P=>{Ce(t,P)})}function Ji(e,t,i,s){const f=Object.create(Ve.prototype);let b=()=>{},y=()=>g(void 0),C=()=>g(void 0);t.start!==void 0&&(b=()=>t.start(f)),t.pull!==void 0&&(y=()=>t.pull(f)),t.cancel!==void 0&&(C=P=>t.cancel(P)),Pn(e,f,b,y,C,i,s)}function Vt(e){return new TypeError(`ReadableStreamDefaultController.prototype.${e} can only be used on a ReadableStreamDefaultController`)}function Zi(e,t){return Oe(e._readableStreamController)?eo(e):Ki(e)}function Ki(e,t){const i=Se(e);let s=!1,f=!1,b=!1,y=!1,C,P,F,W,q;const H=S(ne=>{q=ne});function he(){return s?(f=!0,g(void 0)):(s=!0,qe(i,{_chunkSteps:ie=>{Fe(()=>{f=!1;const le=ie,ge=ie;b||Gt(F._readableStreamController,le),y||Gt(W._readableStreamController,ge),s=!1,f&&he()})},_closeSteps:()=>{s=!1,b||bt(F._readableStreamController),y||bt(W._readableStreamController),(!b||!y)&&q(void 0)},_errorSteps:()=>{s=!1}}),g(void 0))}function Je(ne){if(b=!0,C=ne,y){const ie=v([C,P]),le=de(e,ie);q(le)}return H}function Pe(ne){if(y=!0,P=ne,b){const ie=v([C,P]),le=de(e,ie);q(le)}return H}function we(){}return F=Wr(we,he,Je),W=Wr(we,he,Pe),V(i._closedPromise,ne=>{Ce(F._readableStreamController,ne),Ce(W._readableStreamController,ne),(!b||!y)&&q(void 0)}),[F,W]}function eo(e){let t=Se(e),i=!1,s=!1,f=!1,b=!1,y=!1,C,P,F,W,q;const H=S(T=>{q=T});function he(T){V(T._closedPromise,I=>{T===t&&(ce(F._readableStreamController,I),ce(W._readableStreamController,I),(!b||!y)&&q(void 0))})}function Je(){ke(t)&&(fe(t),t=Se(e),he(t)),qe(t,{_chunkSteps:I=>{Fe(()=>{s=!1,f=!1;const M=I;let se=I;if(!b&&!y)try{se=Gr(I)}catch(Ze){ce(F._readableStreamController,Ze),ce(W._readableStreamController,Ze),q(de(e,Ze));return}b||qt(F._readableStreamController,M),y||qt(W._readableStreamController,se),i=!1,s?we():f&&ne()})},_closeSteps:()=>{i=!1,b||ut(F._readableStreamController),y||ut(W._readableStreamController),F._readableStreamController._pendingPullIntos.length>0&&Ot(F._readableStreamController,0),W._readableStreamController._pendingPullIntos.length>0&&Ot(W._readableStreamController,0),(!b||!y)&&q(void 0)},_errorSteps:()=>{i=!1}})}function Pe(T,I){J(t)&&(fe(t),t=on(e),he(t));const M=I?W:F,se=I?F:W;un(t,T,{_chunkSteps:Ke=>{Fe(()=>{s=!1,f=!1;const et=I?y:b;if(I?b:y)et||vt(M._readableStreamController,Ke);else{let Nn;try{Nn=Gr(Ke)}catch(Or){ce(M._readableStreamController,Or),ce(se._readableStreamController,Or),q(de(e,Or));return}et||vt(M._readableStreamController,Ke),qt(se._readableStreamController,Nn)}i=!1,s?we():f&&ne()})},_closeSteps:Ke=>{i=!1;const et=I?y:b,ir=I?b:y;et||ut(M._readableStreamController),ir||ut(se._readableStreamController),Ke!==void 0&&(et||vt(M._readableStreamController,Ke),!ir&&se._readableStreamController._pendingPullIntos.length>0&&Ot(se._readableStreamController,0)),(!et||!ir)&&q(void 0)},_errorSteps:()=>{i=!1}})}function we(){if(i)return s=!0,g(void 0);i=!0;const T=yr(F._readableStreamController);return T===null?Je():Pe(T._view,!1),g(void 0)}function ne(){if(i)return f=!0,g(void 0);i=!0;const T=yr(W._readableStreamController);return T===null?Je():Pe(T._view,!0),g(void 0)}function ie(T){if(b=!0,C=T,y){const I=v([C,P]),M=de(e,I);q(M)}return H}function le(T){if(y=!0,P=T,b){const I=v([C,P]),M=de(e,I);q(M)}return H}function ge(){}return F=Fn(ge,we,ie),W=Fn(ge,ne,le),he(t),[F,W]}function to(e,t){K(e,t);const i=e,s=i?.autoAllocateChunkSize,f=i?.cancel,b=i?.pull,y=i?.start,C=i?.type;return{autoAllocateChunkSize:s===void 0?void 0:$e(s,`${t} has member 'autoAllocateChunkSize' that`),cancel:f===void 0?void 0:ro(f,i,`${t} has member 'cancel' that`),pull:b===void 0?void 0:no(b,i,`${t} has member 'pull' that`),start:y===void 0?void 0:io(y,i,`${t} has member 'start' that`),type:C===void 0?void 0:oo(C,`${t} has member 'type' that`)}}function ro(e,t,i){return te(e,i),s=>be(e,t,[s])}function no(e,t,i){return te(e,i),s=>be(e,t,[s])}function io(e,t,i){return te(e,i),s=>xe(e,t,[s])}function oo(e,t){if(e=`${e}`,e!=="bytes")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamType`);return e}function ao(e,t){K(e,t);const i=e?.mode;return{mode:i===void 0?void 0:so(i,`${t} has member 'mode' that`)}}function so(e,t){if(e=`${e}`,e!=="byob")throw new TypeError(`${t} '${e}' is not a valid enumeration value for ReadableStreamReaderMode`);return e}function uo(e,t){return K(e,t),{preventCancel:!!e?.preventCancel}}function In(e,t){K(e,t);const i=e?.preventAbort,s=e?.preventCancel,f=e?.preventClose,b=e?.signal;return b!==void 0&&lo(b,`${t} has member 'signal' that`),{preventAbort:!!i,preventCancel:!!s,preventClose:!!f,signal:b}}function lo(e,t){if(!Si(e))throw new TypeError(`${t} is not an AbortSignal.`)}function fo(e,t){K(e,t);const i=e?.readable;pe(i,"readable","ReadableWritablePair"),ot(i,`${t} has member 'readable' that`);const s=e?.writable;return pe(s,"writable","ReadableWritablePair"),ln(s,`${t} has member 'writable' that`),{readable:i,writable:s}}class Be{constructor(t={},i={}){t===void 0?t=null:Pt(t,"First parameter");const s=zt(i,"Second parameter"),f=to(t,"First parameter");if(qr(this),f.type==="bytes"){if(s.size!==void 0)throw new RangeError("The strategy for a byte stream cannot have a size function");const b=ct(s,0);di(this,f,b)}else{const b=Dt(s),y=ct(s,1);Ji(this,f,y,b)}}get locked(){if(!Te(this))throw Me("locked");return Ae(this)}cancel(t=void 0){return Te(this)?Ae(this)?w(new TypeError("Cannot cancel a stream that already has a reader")):de(this,t):w(Me("cancel"))}getReader(t=void 0){if(!Te(this))throw Me("getReader");return ao(t,"First parameter").mode===void 0?Se(this):on(this)}pipeThrough(t,i={}){if(!Te(this))throw Me("pipeThrough");ue(t,1,"pipeThrough");const s=fo(t,"First parameter"),f=In(i,"Second parameter");if(Ae(this))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked ReadableStream");if(Qe(s.writable))throw new TypeError("ReadableStream.prototype.pipeThrough cannot be used on a locked WritableStream");const b=Tn(this,s.writable,f.preventClose,f.preventAbort,f.preventCancel,f.signal);return z(b),s.readable}pipeTo(t,i={}){if(!Te(this))return w(Me("pipeTo"));if(t===void 0)return w("Parameter 1 is required in 'pipeTo'.");if(!Ye(t))return w(new TypeError("ReadableStream.prototype.pipeTo's first argument must be a WritableStream"));let s;try{s=In(i,"Second parameter")}catch(f){return w(f)}return Ae(this)?w(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked ReadableStream")):Qe(t)?w(new TypeError("ReadableStream.prototype.pipeTo cannot be used on a locked WritableStream")):Tn(this,t,s.preventClose,s.preventAbort,s.preventCancel,s.signal)}tee(){if(!Te(this))throw Me("tee");const t=Zi(this);return v(t)}values(t=void 0){if(!Te(this))throw Me("values");const i=uo(t,"First parameter");return l(this,i.preventCancel)}}Object.defineProperties(Be.prototype,{cancel:{enumerable:!0},getReader:{enumerable:!0},pipeThrough:{enumerable:!0},pipeTo:{enumerable:!0},tee:{enumerable:!0},values:{enumerable:!0},locked:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Be.prototype,d.toStringTag,{value:"ReadableStream",configurable:!0}),typeof d.asyncIterator=="symbol"&&Object.defineProperty(Be.prototype,d.asyncIterator,{value:Be.prototype.values,writable:!0,configurable:!0});function Wr(e,t,i,s=1,f=()=>1){const b=Object.create(Be.prototype);qr(b);const y=Object.create(Ve.prototype);return Pn(b,y,e,t,i,s,f),b}function Fn(e,t,i){const s=Object.create(Be.prototype);qr(s);const f=Object.create(He.prototype);return nn(s,f,e,t,i,0,void 0),s}function qr(e){e._state="readable",e._reader=void 0,e._storedError=void 0,e._disturbed=!1}function Te(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_readableStreamController")?!1:e instanceof Be}function Ae(e){return e._reader!==void 0}function de(e,t){if(e._disturbed=!0,e._state==="closed")return g(void 0);if(e._state==="errored")return w(e._storedError);yt(e);const i=e._reader;i!==void 0&&ke(i)&&(i._readIntoRequests.forEach(f=>{f._closeSteps(void 0)}),i._readIntoRequests=new ae);const s=e._readableStreamController[je](t);return ee(s,_)}function yt(e){e._state="closed";const t=e._reader;t!==void 0&&(Ct(t),J(t)&&(t._readRequests.forEach(i=>{i._closeSteps()}),t._readRequests=new ae))}function xn(e,t){e._state="errored",e._storedError=t;const i=e._reader;i!==void 0&&(nt(i,t),J(i)?(i._readRequests.forEach(s=>{s._errorSteps(t)}),i._readRequests=new ae):(i._readIntoRequests.forEach(s=>{s._errorSteps(t)}),i._readIntoRequests=new ae))}function Me(e){return new TypeError(`ReadableStream.prototype.${e} can only be used on a ReadableStream`)}function Wn(e,t){K(e,t);const i=e?.highWaterMark;return pe(i,"highWaterMark","QueuingStrategyInit"),{highWaterMark:_e(i)}}const qn=e=>e.byteLength;try{Object.defineProperty(qn,"name",{value:"size",configurable:!0})}catch{}class Xt{constructor(t){ue(t,1,"ByteLengthQueuingStrategy"),t=Wn(t,"First parameter"),this._byteLengthQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!vn(this))throw On("highWaterMark");return this._byteLengthQueuingStrategyHighWaterMark}get size(){if(!vn(this))throw On("size");return qn}}Object.defineProperties(Xt.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Xt.prototype,d.toStringTag,{value:"ByteLengthQueuingStrategy",configurable:!0});function On(e){return new TypeError(`ByteLengthQueuingStrategy.prototype.${e} can only be used on a ByteLengthQueuingStrategy`)}function vn(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_byteLengthQueuingStrategyHighWaterMark")?!1:e instanceof Xt}const kn=()=>1;try{Object.defineProperty(kn,"name",{value:"size",configurable:!0})}catch{}class Jt{constructor(t){ue(t,1,"CountQueuingStrategy"),t=Wn(t,"First parameter"),this._countQueuingStrategyHighWaterMark=t.highWaterMark}get highWaterMark(){if(!zn(this))throw Dn("highWaterMark");return this._countQueuingStrategyHighWaterMark}get size(){if(!zn(this))throw Dn("size");return kn}}Object.defineProperties(Jt.prototype,{highWaterMark:{enumerable:!0},size:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Jt.prototype,d.toStringTag,{value:"CountQueuingStrategy",configurable:!0});function Dn(e){return new TypeError(`CountQueuingStrategy.prototype.${e} can only be used on a CountQueuingStrategy`)}function zn(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_countQueuingStrategyHighWaterMark")?!1:e instanceof Jt}function co(e,t){K(e,t);const i=e?.flush,s=e?.readableType,f=e?.start,b=e?.transform,y=e?.writableType;return{flush:i===void 0?void 0:ho(i,e,`${t} has member 'flush' that`),readableType:s,start:f===void 0?void 0:po(f,e,`${t} has member 'start' that`),transform:b===void 0?void 0:mo(b,e,`${t} has member 'transform' that`),writableType:y}}function ho(e,t,i){return te(e,i),s=>be(e,t,[s])}function po(e,t,i){return te(e,i),s=>xe(e,t,[s])}function mo(e,t,i){return te(e,i),(s,f)=>be(e,t,[s,f])}class Zt{constructor(t={},i={},s={}){t===void 0&&(t=null);const f=zt(i,"Second parameter"),b=zt(s,"Third parameter"),y=co(t,"First parameter");if(y.readableType!==void 0)throw new RangeError("Invalid readableType specified");if(y.writableType!==void 0)throw new RangeError("Invalid writableType specified");const C=ct(b,0),P=Dt(b),F=ct(f,1),W=Dt(f);let q;const H=S(he=>{q=he});bo(this,H,F,W,C,P),_o(this,y),y.start!==void 0?q(y.start(this._transformStreamController)):q(void 0)}get readable(){if(!Mn(this))throw $n("readable");return this._readable}get writable(){if(!Mn(this))throw $n("writable");return this._writable}}Object.defineProperties(Zt.prototype,{readable:{enumerable:!0},writable:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(Zt.prototype,d.toStringTag,{value:"TransformStream",configurable:!0});function bo(e,t,i,s,f,b){function y(){return t}function C(H){return So(e,H)}function P(H){return Ro(e,H)}function F(){return Eo(e)}e._writable=Ci(y,C,F,P,i,s);function W(){return Co(e)}function q(H){return er(e,H),g(void 0)}e._readable=Wr(y,W,q,f,b),e._backpressure=void 0,e._backpressureChangePromise=void 0,e._backpressureChangePromise_resolve=void 0,tr(e,!0),e._transformStreamController=void 0}function Mn(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_transformStreamController")?!1:e instanceof Zt}function Kt(e,t){Ce(e._readable._readableStreamController,t),er(e,t)}function er(e,t){Un(e._transformStreamController),Br(e._writable._writableStreamController,t),e._backpressure&&tr(e,!1)}function tr(e,t){e._backpressureChangePromise!==void 0&&e._backpressureChangePromise_resolve(),e._backpressureChangePromise=S(i=>{e._backpressureChangePromise_resolve=i}),e._backpressure=t}class _t{constructor(){throw new TypeError("Illegal constructor")}get desiredSize(){if(!rr(this))throw nr("desiredSize");const t=this._controlledTransformStream._readable._readableStreamController;return xr(t)}enqueue(t=void 0){if(!rr(this))throw nr("enqueue");jn(this,t)}error(t=void 0){if(!rr(this))throw nr("error");wo(this,t)}terminate(){if(!rr(this))throw nr("terminate");go(this)}}Object.defineProperties(_t.prototype,{enqueue:{enumerable:!0},error:{enumerable:!0},terminate:{enumerable:!0},desiredSize:{enumerable:!0}}),typeof d.toStringTag=="symbol"&&Object.defineProperty(_t.prototype,d.toStringTag,{value:"TransformStreamDefaultController",configurable:!0});function rr(e){return!c(e)||!Object.prototype.hasOwnProperty.call(e,"_controlledTransformStream")?!1:e instanceof _t}function yo(e,t,i,s){t._controlledTransformStream=e,e._transformStreamController=t,t._transformAlgorithm=i,t._flushAlgorithm=s}function _o(e,t){const i=Object.create(_t.prototype);let s=b=>{try{return jn(i,b),g(void 0)}catch(y){return w(y)}},f=()=>g(void 0);t.transform!==void 0&&(s=b=>t.transform(b,i)),t.flush!==void 0&&(f=()=>t.flush(i)),yo(e,i,s,f)}function Un(e){e._transformAlgorithm=void 0,e._flushAlgorithm=void 0}function jn(e,t){const i=e._controlledTransformStream,s=i._readable._readableStreamController;if(!Xe(s))throw new TypeError("Readable side is not in a state that permits enqueue");try{Gt(s,t)}catch(b){throw er(i,b),i._readable._storedError}Xi(s)!==i._backpressure&&tr(i,!0)}function wo(e,t){Kt(e._controlledTransformStream,t)}function Ln(e,t){const i=e._transformAlgorithm(t);return ee(i,void 0,s=>{throw Kt(e._controlledTransformStream,s),s})}function go(e){const t=e._controlledTransformStream,i=t._readable._readableStreamController;bt(i);const s=new TypeError("TransformStream terminated");er(t,s)}function So(e,t){const i=e._transformStreamController;if(e._backpressure){const s=e._backpressureChangePromise;return ee(s,()=>{const f=e._writable;if(f._state==="erroring")throw f._storedError;return Ln(i,t)})}return Ln(i,t)}function Ro(e,t){return Kt(e,t),g(void 0)}function Eo(e){const t=e._readable,i=e._transformStreamController,s=i._flushAlgorithm();return Un(i),ee(s,()=>{if(t._state==="errored")throw t._storedError;bt(t._readableStreamController)},f=>{throw Kt(e,f),t._storedError})}function Co(e){return tr(e,!1),e._backpressureChangePromise}function nr(e){return new TypeError(`TransformStreamDefaultController.prototype.${e} can only be used on a TransformStreamDefaultController`)}function $n(e){return new TypeError(`TransformStream.prototype.${e} can only be used on a TransformStream`)}p.ByteLengthQueuingStrategy=Xt,p.CountQueuingStrategy=Jt,p.ReadableByteStreamController=He,p.ReadableStream=Be,p.ReadableStreamBYOBReader=ft,p.ReadableStreamBYOBRequest=st,p.ReadableStreamDefaultController=Ve,p.ReadableStreamDefaultReader=We,p.TransformStream=Zt,p.TransformStreamDefaultController=_t,p.WritableStream=dt,p.WritableStreamDefaultController=Ge,p.WritableStreamDefaultWriter=ht,Object.defineProperty(p,"__esModule",{value:!0})})}(or,or.exports)),or.exports}var kr={},wt={},Gn;function Po(){if(Gn)return wt;Gn=1,wt.byteLength=c,wt.toByteArray=Q,wt.fromByteArray=G;for(var B=[],u=[],p=typeof Uint8Array<"u"?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_=0,R=d.length;_0)throw new Error("Invalid string. Length must be a multiple of 4");var w=S.indexOf("=");w===-1&&(w=g);var k=w===g?0:4-w%4;return[w,k]}function c(S){var g=E(S),w=g[0],k=g[1];return(w+k)*3/4-k}function Y(S,g,w){return(g+w)*3/4-w}function Q(S){var g,w=E(S),k=w[0],O=w[1],L=new p(Y(S,k,O)),V=0,ee=O>0?k-4:k,z;for(z=0;z>16&255,L[V++]=g>>8&255,L[V++]=g&255;return O===2&&(g=u[S.charCodeAt(z)]<<2|u[S.charCodeAt(z+1)]>>4,L[V++]=g&255),O===1&&(g=u[S.charCodeAt(z)]<<10|u[S.charCodeAt(z+1)]<<4|u[S.charCodeAt(z+2)]>>2,L[V++]=g>>8&255,L[V++]=g&255),L}function U(S){return B[S>>18&63]+B[S>>12&63]+B[S>>6&63]+B[S&63]}function j(S,g,w){for(var k,O=[],L=g;Lee?ee:V+L));return k===1?(g=S[w-1],O.push(B[g>>2]+B[g<<4&63]+"==")):k===2&&(g=(S[w-2]<<8)+S[w-1],O.push(B[g>>10]+B[g>>4&63]+B[g<<2&63]+"=")),O.join("")}return wt}var ar={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */var Vn;function Io(){return Vn||(Vn=1,ar.read=function(B,u,p,d,_){var R,E,c=_*8-d-1,Y=(1<>1,U=-7,j=p?_-1:0,G=p?-1:1,S=B[u+j];for(j+=G,R=S&(1<<-U)-1,S>>=-U,U+=c;U>0;R=R*256+B[u+j],j+=G,U-=8);for(E=R&(1<<-U)-1,R>>=-U,U+=d;U>0;E=E*256+B[u+j],j+=G,U-=8);if(R===0)R=1-Q;else{if(R===Y)return E?NaN:(S?-1:1)*(1/0);E=E+Math.pow(2,d),R=R-Q}return(S?-1:1)*E*Math.pow(2,R-d)},ar.write=function(B,u,p,d,_,R){var E,c,Y,Q=R*8-_-1,U=(1<>1,G=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=d?0:R-1,g=d?1:-1,w=u<0||u===0&&1/u<0?1:0;for(u=Math.abs(u),isNaN(u)||u===1/0?(c=isNaN(u)?1:0,E=U):(E=Math.floor(Math.log(u)/Math.LN2),u*(Y=Math.pow(2,-E))<1&&(E--,Y*=2),E+j>=1?u+=G/Y:u+=G*Math.pow(2,1-j),u*Y>=2&&(E++,Y/=2),E+j>=U?(c=0,E=U):E+j>=1?(c=(u*Y-1)*Math.pow(2,_),E=E+j):(c=u*Math.pow(2,j-1)*Math.pow(2,_),E=0));_>=8;B[p+S]=c&255,S+=g,c/=256,_-=8);for(E=E<<_|c,Q+=_;Q>0;B[p+S]=E&255,S+=g,E/=256,Q-=8);B[p+S-g]|=w*128}),ar}/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */var Xn;function Fo(){return Xn||(Xn=1,function(B){const u=Po(),p=Io(),d=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=c,B.SlowBuffer=L,B.INSPECT_MAX_BYTES=50;const _=2147483647;B.kMaxLength=_,c.TYPED_ARRAY_SUPPORT=R(),!c.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function R(){try{const o=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(o,r),o.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function E(o){if(o>_)throw new RangeError('The value "'+o+'" is invalid for option "size"');const r=new Uint8Array(o);return Object.setPrototypeOf(r,c.prototype),r}function c(o,r,n){if(typeof o=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return j(o)}return Y(o,r,n)}c.poolSize=8192;function Y(o,r,n){if(typeof o=="string")return G(o,r);if(ArrayBuffer.isView(o))return g(o);if(o==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o);if(re(o,ArrayBuffer)||o&&re(o.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(re(o,SharedArrayBuffer)||o&&re(o.buffer,SharedArrayBuffer)))return w(o,r,n);if(typeof o=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const a=o.valueOf&&o.valueOf();if(a!=null&&a!==o)return c.from(a,r,n);const l=k(o);if(l)return l;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof o[Symbol.toPrimitive]=="function")return c.from(o[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o)}c.from=function(o,r,n){return Y(o,r,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function Q(o){if(typeof o!="number")throw new TypeError('"size" argument must be of type number');if(o<0)throw new RangeError('The value "'+o+'" is invalid for option "size"')}function U(o,r,n){return Q(o),o<=0?E(o):r!==void 0?typeof n=="string"?E(o).fill(r,n):E(o).fill(r):E(o)}c.alloc=function(o,r,n){return U(o,r,n)};function j(o){return Q(o),E(o<0?0:O(o)|0)}c.allocUnsafe=function(o){return j(o)},c.allocUnsafeSlow=function(o){return j(o)};function G(o,r){if((typeof r!="string"||r==="")&&(r="utf8"),!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);const n=V(o,r)|0;let a=E(n);const l=a.write(o,r);return l!==n&&(a=a.slice(0,l)),a}function S(o){const r=o.length<0?0:O(o.length)|0,n=E(r);for(let a=0;a=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return o|0}function L(o){return+o!=o&&(o=0),c.alloc(+o)}c.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==c.prototype},c.compare=function(r,n){if(re(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),re(n,Uint8Array)&&(n=c.from(n,n.offset,n.byteLength)),!c.isBuffer(r)||!c.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let a=r.length,l=n.length;for(let h=0,m=Math.min(a,l);hl.length?(c.isBuffer(m)||(m=c.from(m)),m.copy(l,h)):Uint8Array.prototype.set.call(l,m,h);else if(c.isBuffer(m))m.copy(l,h);else throw new TypeError('"list" argument must be an Array of Buffers');h+=m.length}return l};function V(o,r){if(c.isBuffer(o))return o.length;if(ArrayBuffer.isView(o)||re(o,ArrayBuffer))return o.byteLength;if(typeof o!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof o);const n=o.length,a=arguments.length>2&&arguments[2]===!0;if(!a&&n===0)return 0;let l=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return $e(o).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return at(o).length;default:if(l)return a?-1:$e(o).length;r=(""+r).toLowerCase(),l=!0}}c.byteLength=V;function ee(o,r,n){let a=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(o||(o="utf8");;)switch(o){case"hex":return fr(this,r,n);case"utf8":case"utf-8":return ye(this,r,n);case"ascii":return lr(this,r,n);case"latin1":case"binary":return nt(this,r,n);case"base64":return fe(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ct(this,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(o+"").toLowerCase(),a=!0}}c.prototype._isBuffer=!0;function z(o,r,n){const a=o[r];o[r]=o[n],o[n]=a}c.prototype.swap16=function(){const r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;nn&&(r+=" ... "),""},d&&(c.prototype[d]=c.prototype.inspect),c.prototype.compare=function(r,n,a,l,h){if(re(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),!c.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(n===void 0&&(n=0),a===void 0&&(a=r?r.length:0),l===void 0&&(l=0),h===void 0&&(h=this.length),n<0||a>r.length||l<0||h>this.length)throw new RangeError("out of range index");if(l>=h&&n>=a)return 0;if(l>=h)return-1;if(n>=a)return 1;if(n>>>=0,a>>>=0,l>>>=0,h>>>=0,this===r)return 0;let m=h-l,A=a-n;const v=Math.min(m,A),D=this.slice(l,h),$=r.slice(n,a);for(let x=0;x2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ne(n)&&(n=l?0:o.length-1),n<0&&(n=o.length+n),n>=o.length){if(l)return-1;n=o.length-1}else if(n<0)if(l)n=0;else return-1;if(typeof r=="string"&&(r=c.from(r,a)),c.isBuffer(r))return r.length===0?-1:xe(o,r,n,a,l);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?l?Uint8Array.prototype.indexOf.call(o,r,n):Uint8Array.prototype.lastIndexOf.call(o,r,n):xe(o,[r],n,a,l);throw new TypeError("val must be string, number or Buffer")}function xe(o,r,n,a,l){let h=1,m=o.length,A=r.length;if(a!==void 0&&(a=String(a).toLowerCase(),a==="ucs2"||a==="ucs-2"||a==="utf16le"||a==="utf-16le")){if(o.length<2||r.length<2)return-1;h=2,m/=2,A/=2,n/=2}function v($,x){return h===1?$[x]:$.readUInt16BE(x*h)}let D;if(l){let $=-1;for(D=n;Dm&&(n=m-A),D=n;D>=0;D--){let $=!0;for(let x=0;xl&&(a=l)):a=l;const h=r.length;a>h/2&&(a=h/2);let m;for(m=0;m>>0,isFinite(a)?(a=a>>>0,l===void 0&&(l="utf8")):(l=a,a=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const h=this.length-n;if((a===void 0||a>h)&&(a=h),r.length>0&&(a<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");l||(l="utf8");let m=!1;for(;;)switch(l){case"hex":return be(this,r,n,a);case"utf8":case"utf-8":return St(this,r,n,a);case"ascii":case"latin1":case"binary":return ae(this,r,n,a);case"base64":return Rt(this,r,n,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rt(this,r,n,a);default:if(m)throw new TypeError("Unknown encoding: "+l);l=(""+l).toLowerCase(),m=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function fe(o,r,n){return r===0&&n===o.length?u.fromByteArray(o):u.fromByteArray(o.slice(r,n))}function ye(o,r,n){n=Math.min(o.length,n);const a=[];let l=r;for(;l239?4:h>223?3:h>191?2:1;if(l+A<=n){let v,D,$,x;switch(A){case 1:h<128&&(m=h);break;case 2:v=o[l+1],(v&192)===128&&(x=(h&31)<<6|v&63,x>127&&(m=x));break;case 3:v=o[l+1],D=o[l+2],(v&192)===128&&(D&192)===128&&(x=(h&15)<<12|(v&63)<<6|D&63,x>2047&&(x<55296||x>57343)&&(m=x));break;case 4:v=o[l+1],D=o[l+2],$=o[l+3],(v&192)===128&&(D&192)===128&&($&192)===128&&(x=(h&15)<<18|(v&63)<<12|(D&63)<<6|$&63,x>65535&&x<1114112&&(m=x))}}m===null?(m=65533,A=1):m>65535&&(m-=65536,a.push(m>>>10&1023|55296),m=56320|m&1023),a.push(m),l+=A}return Et(a)}const Ue=4096;function Et(o){const r=o.length;if(r<=Ue)return String.fromCharCode.apply(String,o);let n="",a=0;for(;aa)&&(n=a);let l="";for(let h=r;ha&&(r=a),n<0?(n+=a,n<0&&(n=0)):n>a&&(n=a),nn)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(r,n,a){r=r>>>0,n=n>>>0,a||N(r,n,this.length);let l=this[r],h=1,m=0;for(;++m>>0,n=n>>>0,a||N(r,n,this.length);let l=this[r+--n],h=1;for(;n>0&&(h*=256);)l+=this[r+--n]*h;return l},c.prototype.readUint8=c.prototype.readUInt8=function(r,n){return r=r>>>0,n||N(r,1,this.length),this[r]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(r,n){return r=r>>>0,n||N(r,2,this.length),this[r]|this[r+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(r,n){return r=r>>>0,n||N(r,2,this.length),this[r]<<8|this[r+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(r,n){return r=r>>>0,n||N(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(r,n){return r=r>>>0,n||N(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},c.prototype.readBigUInt64LE=J(function(r){r=r>>>0,pe(r,"offset");const n=this[r],a=this[r+7];(n===void 0||a===void 0)&&_e(r,this.length-8);const l=n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,h=this[++r]+this[++r]*2**8+this[++r]*2**16+a*2**24;return BigInt(l)+(BigInt(h)<>>0,pe(r,"offset");const n=this[r],a=this[r+7];(n===void 0||a===void 0)&&_e(r,this.length-8);const l=n*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],h=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+a;return(BigInt(l)<>>0,n=n>>>0,a||N(r,n,this.length);let l=this[r],h=1,m=0;for(;++m=h&&(l-=Math.pow(2,8*n)),l},c.prototype.readIntBE=function(r,n,a){r=r>>>0,n=n>>>0,a||N(r,n,this.length);let l=n,h=1,m=this[r+--l];for(;l>0&&(h*=256);)m+=this[r+--l]*h;return h*=128,m>=h&&(m-=Math.pow(2,8*n)),m},c.prototype.readInt8=function(r,n){return r=r>>>0,n||N(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},c.prototype.readInt16LE=function(r,n){r=r>>>0,n||N(r,2,this.length);const a=this[r]|this[r+1]<<8;return a&32768?a|4294901760:a},c.prototype.readInt16BE=function(r,n){r=r>>>0,n||N(r,2,this.length);const a=this[r+1]|this[r]<<8;return a&32768?a|4294901760:a},c.prototype.readInt32LE=function(r,n){return r=r>>>0,n||N(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},c.prototype.readInt32BE=function(r,n){return r=r>>>0,n||N(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},c.prototype.readBigInt64LE=J(function(r){r=r>>>0,pe(r,"offset");const n=this[r],a=this[r+7];(n===void 0||a===void 0)&&_e(r,this.length-8);const l=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(a<<24);return(BigInt(l)<>>0,pe(r,"offset");const n=this[r],a=this[r+7];(n===void 0||a===void 0)&&_e(r,this.length-8);const l=(n<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(l)<>>0,n||N(r,4,this.length),p.read(this,r,!0,23,4)},c.prototype.readFloatBE=function(r,n){return r=r>>>0,n||N(r,4,this.length),p.read(this,r,!1,23,4)},c.prototype.readDoubleLE=function(r,n){return r=r>>>0,n||N(r,8,this.length),p.read(this,r,!0,52,8)},c.prototype.readDoubleBE=function(r,n){return r=r>>>0,n||N(r,8,this.length),p.read(this,r,!1,52,8)};function X(o,r,n,a,l,h){if(!c.isBuffer(o))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>l||ro.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(r,n,a,l){if(r=+r,n=n>>>0,a=a>>>0,!l){const A=Math.pow(2,8*a)-1;X(this,r,n,a,A,0)}let h=1,m=0;for(this[n]=r&255;++m>>0,a=a>>>0,!l){const A=Math.pow(2,8*a)-1;X(this,r,n,a,A,0)}let h=a-1,m=1;for(this[n+h]=r&255;--h>=0&&(m*=256);)this[n+h]=r/m&255;return n+a},c.prototype.writeUint8=c.prototype.writeUInt8=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,1,255,0),this[n]=r&255,n+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,4,4294967295,0),this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255,n+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,4,4294967295,0),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4};function je(o,r,n,a,l){ue(r,a,l,o,n,7);let h=Number(r&BigInt(4294967295));o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h;let m=Number(r>>BigInt(32)&BigInt(4294967295));return o[n++]=m,m=m>>8,o[n++]=m,m=m>>8,o[n++]=m,m=m>>8,o[n++]=m,n}function Le(o,r,n,a,l){ue(r,a,l,o,n,7);let h=Number(r&BigInt(4294967295));o[n+7]=h,h=h>>8,o[n+6]=h,h=h>>8,o[n+5]=h,h=h>>8,o[n+4]=h;let m=Number(r>>BigInt(32)&BigInt(4294967295));return o[n+3]=m,m=m>>8,o[n+2]=m,m=m>>8,o[n+1]=m,m=m>>8,o[n]=m,n+8}c.prototype.writeBigUInt64LE=J(function(r,n=0){return je(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=J(function(r,n=0){return Le(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(r,n,a,l){if(r=+r,n=n>>>0,!l){const v=Math.pow(2,8*a-1);X(this,r,n,a,v-1,-v)}let h=0,m=1,A=0;for(this[n]=r&255;++h>0)-A&255;return n+a},c.prototype.writeIntBE=function(r,n,a,l){if(r=+r,n=n>>>0,!l){const v=Math.pow(2,8*a-1);X(this,r,n,a,v-1,-v)}let h=a-1,m=1,A=0;for(this[n+h]=r&255;--h>=0&&(m*=256);)r<0&&A===0&&this[n+h+1]!==0&&(A=1),this[n+h]=(r/m>>0)-A&255;return n+a},c.prototype.writeInt8=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},c.prototype.writeInt16LE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},c.prototype.writeInt16BE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},c.prototype.writeInt32LE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,4,2147483647,-2147483648),this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24,n+4},c.prototype.writeInt32BE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},c.prototype.writeBigInt64LE=J(function(r,n=0){return je(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=J(function(r,n=0){return Le(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function it(o,r,n,a,l,h){if(n+a>o.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Bt(o,r,n,a,l){return r=+r,n=n>>>0,l||it(o,r,n,4),p.write(o,r,n,a,23,4),n+4}c.prototype.writeFloatLE=function(r,n,a){return Bt(this,r,n,!0,a)},c.prototype.writeFloatBE=function(r,n,a){return Bt(this,r,n,!1,a)};function Tt(o,r,n,a,l){return r=+r,n=n>>>0,l||it(o,r,n,8),p.write(o,r,n,a,52,8),n+8}c.prototype.writeDoubleLE=function(r,n,a){return Tt(this,r,n,!0,a)},c.prototype.writeDoubleBE=function(r,n,a){return Tt(this,r,n,!1,a)},c.prototype.copy=function(r,n,a,l){if(!c.isBuffer(r))throw new TypeError("argument should be a Buffer");if(a||(a=0),!l&&l!==0&&(l=this.length),n>=r.length&&(n=r.length),n||(n=0),l>0&&l=this.length)throw new RangeError("Index out of range");if(l<0)throw new RangeError("sourceEnd out of bounds");l>this.length&&(l=this.length),r.length-n>>0,a=a===void 0?this.length:a>>>0,r||(r=0);let h;if(typeof r=="number")for(h=n;h2**32?l=At(String(n)):typeof n=="bigint"&&(l=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(l=At(l)),l+="n"),a+=` It must be ${r}. Received ${l}`,a},RangeError);function At(o){let r="",n=o.length;const a=o[0]==="-"?1:0;for(;n>=a+4;n-=3)r=`_${o.slice(n-3,n)}${r}`;return`${o.slice(0,n)}${r}`}function Pt(o,r,n){pe(r,"offset"),(o[r]===void 0||o[r+n]===void 0)&&_e(r,o.length-(n+1))}function ue(o,r,n,a,l,h){if(o>n||o3?r===0||r===BigInt(0)?A=`>= 0${m} and < 2${m} ** ${(h+1)*8}${m}`:A=`>= -(2${m} ** ${(h+1)*8-1}${m}) and < 2 ** ${(h+1)*8-1}${m}`:A=`>= ${r}${m} and <= ${n}${m}`,new K.ERR_OUT_OF_RANGE("value",A,o)}Pt(a,l,h)}function pe(o,r){if(typeof o!="number")throw new K.ERR_INVALID_ARG_TYPE(r,"number",o)}function _e(o,r,n){throw Math.floor(o)!==o?(pe(o,n),new K.ERR_OUT_OF_RANGE(n||"offset","an integer",o)):r<0?new K.ERR_BUFFER_OUT_OF_BOUNDS:new K.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${r}`,o)}const It=/[^+/0-9A-Za-z-_]/g;function cr(o){if(o=o.split("=")[0],o=o.trim().replace(It,""),o.length<2)return"";for(;o.length%4!==0;)o=o+"=";return o}function $e(o,r){r=r||1/0;let n;const a=o.length;let l=null;const h=[];for(let m=0;m55295&&n<57344){if(!l){if(n>56319){(r-=3)>-1&&h.push(239,191,189);continue}else if(m+1===a){(r-=3)>-1&&h.push(239,191,189);continue}l=n;continue}if(n<56320){(r-=3)>-1&&h.push(239,191,189),l=n;continue}n=(l-55296<<10|n-56320)+65536}else l&&(r-=3)>-1&&h.push(239,191,189);if(l=null,n<128){if((r-=1)<0)break;h.push(n)}else if(n<2048){if((r-=2)<0)break;h.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;h.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;h.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return h}function ot(o){const r=[];for(let n=0;n>8,l=n%256,h.push(l),h.push(a);return h}function at(o){return u.toByteArray(cr(o))}function Re(o,r,n,a){let l;for(l=0;l=r.length||l>=o.length);++l)r[l+n]=o[l];return l}function re(o,r){return o instanceof r||o!=null&&o.constructor!=null&&o.constructor.name!=null&&o.constructor.name===r.name}function Ne(o){return o!==o}const We=function(){const o="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){const a=n*16;for(let l=0;l<16;++l)r[a+l]=o[n]+o[l]}return r}();function J(o){return typeof BigInt>"u"?qe:o}function qe(){throw new Error("BigInt not supported")}}(kr)),kr}const xo=65536;if(!globalThis.ReadableStream)try{const B=jr,{emitWarning:u}=B;try{B.emitWarning=()=>{},Object.assign(globalThis,jr),B.emitWarning=u}catch(p){throw B.emitWarning=u,p}}catch{Object.assign(globalThis,Ao())}try{const{Blob:B}=Fo();B&&!B.prototype.stream&&(B.prototype.stream=function(p){let d=0;const _=this;return new ReadableStream({type:"bytes",async pull(R){const c=await _.slice(d,Math.min(_.size,d+xo)).arrayBuffer();d+=c.byteLength,R.enqueue(new Uint8Array(c)),d===_.size&&R.close()}})})}catch{}/*! fetch-blob. MIT License. Jimmy Wärting */const Jn=65536;async function*Dr(B,u=!0){for(const p of B)if("stream"in p)yield*p.stream();else if(ArrayBuffer.isView(p))if(u){let d=p.byteOffset;const _=p.byteOffset+p.byteLength;for(;d!==_;){const R=Math.min(_-d,Jn),E=p.buffer.slice(d,d+R);d+=E.byteLength,yield new Uint8Array(E)}}else yield p;else{let d=0,_=p;for(;d!==_.size;){const E=await _.slice(d,Math.min(_.size,d+Jn)).arrayBuffer();d+=E.byteLength,yield new Uint8Array(E)}}}const ni=class Lr{#e=[];#t="";#r=0;#n="transparent";constructor(u=[],p={}){if(typeof u!="object"||u===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof u[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof p!="object"&&typeof p!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");p===null&&(p={});const d=new TextEncoder;for(const R of u){let E;ArrayBuffer.isView(R)?E=new Uint8Array(R.buffer.slice(R.byteOffset,R.byteOffset+R.byteLength)):R instanceof ArrayBuffer?E=new Uint8Array(R.slice(0)):R instanceof Lr?E=R:E=d.encode(`${R}`),this.#r+=ArrayBuffer.isView(E)?E.byteLength:E.size,this.#e.push(E)}this.#n=`${p.endings===void 0?"transparent":p.endings}`;const _=p.type===void 0?"":String(p.type);this.#t=/^[\x20-\x7E]*$/.test(_)?_:""}get size(){return this.#r}get type(){return this.#t}async text(){const u=new TextDecoder;let p="";for await(const d of Dr(this.#e,!1))p+=u.decode(d,{stream:!0});return p+=u.decode(),p}async arrayBuffer(){const u=new Uint8Array(this.size);let p=0;for await(const d of Dr(this.#e,!1))u.set(d,p),p+=d.length;return u.buffer}stream(){const u=Dr(this.#e,!0);return new globalThis.ReadableStream({type:"bytes",async pull(p){const d=await u.next();d.done?p.close():p.enqueue(d.value)},async cancel(){await u.return()}})}slice(u=0,p=this.size,d=""){const{size:_}=this;let R=u<0?Math.max(_+u,0):Math.min(u,_),E=p<0?Math.max(_+p,0):Math.min(p,_);const c=Math.max(E-R,0),Y=this.#e,Q=[];let U=0;for(const G of Y){if(U>=c)break;const S=ArrayBuffer.isView(G)?G.byteLength:G.size;if(R&&S<=R)R-=S,E-=S;else{let g;ArrayBuffer.isView(G)?(g=G.subarray(R,Math.min(S,E)),U+=g.byteLength):(g=G.slice(R,Math.min(S,E)),U+=g.size),E-=S,Q.push(g),R=0}}const j=new Lr([],{type:String(d).toLowerCase()});return j.#r=c,j.#e=Q,j}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](u){return u&&typeof u=="object"&&typeof u.constructor=="function"&&(typeof u.stream=="function"||typeof u.arrayBuffer=="function")&&/^(Blob|File)$/.test(u[Symbol.toStringTag])}};Object.defineProperties(ni.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});const $r=ni;/*! node-domexception. MIT License. Jimmy Wärting */if(!globalThis.DOMException)try{const{MessageChannel:B}=jr,u=new B().port1,p=new ArrayBuffer;u.postMessage(p,[p,p])}catch(B){B.constructor.name==="DOMException"&&(globalThis.DOMException=B.constructor)}var Wo=globalThis.DOMException;const Z=Bo(Wo),qo=class extends $r{#e=0;#t="";constructor(u,p,d={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(u,d),d===null&&(d={});const _=d.lastModified===void 0?Date.now():Number(d.lastModified);Number.isNaN(_)||(this.#e=_),this.#t=String(p)}get name(){return this.#t}get lastModified(){return this.#e}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](u){return!!u&&u instanceof $r&&/^(File)$/.test(u[Symbol.toStringTag])}},Oo=qo;var Hr=nw.require("fs");Hr.statSync;const vo=Hr.createReadStream,ko=Hr.promises;var Do=nw.require("path");const zo=Do.basename,{stat:ii}=ko,Mo=(B,u)=>ii(B).then(p=>Uo(p,B,u)),Uo=(B,u,p="")=>new Oo([new Yr({path:u,size:B.size,lastModified:B.mtimeMs,start:0})],zo(u),{type:p,lastModified:B.mtimeMs});class Yr{#e;#t;constructor(u){this.#e=u.path,this.#t=u.start,this.size=u.size,this.lastModified=u.lastModified}slice(u,p){return new Yr({path:this.#e,lastModified:this.lastModified,size:p-u,start:this.#t+u})}async*stream(){const{mtimeMs:u}=await ii(this.#e);if(u>this.lastModified)throw new Z("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*vo(this.#e,{start:this.#t,end:this.#t+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}const jo=globalThis&&globalThis.__classPrivateFieldGet||function(B,u,p,d){if(p==="a"&&!d)throw new TypeError("Private accessor was defined without a getter");if(typeof u=="function"?B!==u||!d:!u.has(B))throw new TypeError("Cannot read private member from an object whose class did not declare it");return p==="m"?d:p==="a"?d.call(B):d?d.value:u.get(B)};let Nr,oi;var Lo=nw.require("path");const sr=Lo.join;var oe=nw.require("fs").promises;const{INVALID:$o,GONE:Ie,MISMATCH:Zn,MOD_ERR:Kn,SYNTAX:zr}=ri;class No{constructor(u,p,d){this.position=0,this.fileHandle=u,this.path=p,this.size=d,this.position=0}async abort(){await this.fileHandle.close()}async write(u){try{await oe.stat(this.path)}catch(d){if(d.code==="ENOENT")throw await this.fileHandle.close().catch(),new Z(...Ie)}if(To(u)){if(u.type==="write"){if(typeof u.position=="number"&&u.position>=0&&(this.position=u.position),!("data"in u))throw await this.fileHandle.close(),new Z(...zr("write requires a data argument"));u=u.data}else if(u.type==="seek")if(Number.isInteger(u.position)&&u.position>=0){if(this.size=0){await this.fileHandle.truncate(u.size),this.size=u.size,this.position>this.size&&(this.position=this.size);return}else throw await this.fileHandle.close(),new Z(...zr("truncate requires a size argument"))}if(u instanceof ArrayBuffer)u=new Uint8Array(u);else if(typeof u=="string")u=Buffer.from(u);else if(u instanceof $r){for await(const d of u.stream()){const _=await this.fileHandle.writev([d],this.position);this.position+=_.bytesWritten,this.size+=_.bytesWritten}return}const p=await this.fileHandle.writev([u],this.position);this.position+=p.bytesWritten,this.size+=p.bytesWritten}async close(){await this.fileHandle.close(),await oe.stat(this.path).catch(u=>{if(u.code==="ENOENT")throw new Z(...Ie)})}}class gt{constructor(u,p){Nr.add(this),this.kind="file",this.writable=!0,this._path=u,this.name=p}async getFile(){return await oe.stat(this._path).catch(u=>{if(u.code==="ENOENT")throw new Z(...Ie)}),await Mo(this._path)}async isSameEntry(u){return this._path===jo(this,Nr,"m",oi).apply(u)}async createWritable(){const u=await oe.open(this._path,"r+").catch(d=>{throw d.code==="ENOENT"?new Z(...Ie):d}),{size:p}=await u.stat();return new No(u,this._path,p)}}Nr=new WeakSet,oi=function(){return this._path};class tt{constructor(u="",p=""){this.kind="directory",this.writable=!0,this.name=p,this._path=u}async isSameEntry(u){return this._path===u._path}async*entries(){const u=this._path,p=await oe.readdir(u).catch(d=>{throw d.code==="ENOENT"?new Z(...Ie):d});for(const d of p){const _=sr(u,d),R=await oe.lstat(_);R.isFile()?yield[d,new gt(_,d)]:R.isDirectory()&&(yield[d,new tt(_,d)])}}async getDirectoryHandle(u,p={}){const d=sr(this._path,u),_=await oe.lstat(d).catch(E=>{if(E.code!=="ENOENT")throw E}),R=_?.isDirectory();if(_&&R)return new tt(d,u);if(_&&!R)throw new Z(...Zn);if(!p.create)throw new Z(...Ie);return await oe.mkdir(d),new tt(d,u)}async getFileHandle(u,p={}){const d=sr(this._path,u),_=await oe.lstat(d).catch(E=>{if(E.code!=="ENOENT")throw E}),R=_?.isFile();if(_&&R)return new gt(d,u);if(_&&!R)throw new Z(...Zn);if(!p.create)throw new Z(...Ie);return await(await oe.open(d,"w")).close(),new gt(d,u)}async queryPermission(){return"granted"}async removeEntry(u,p){const d=sr(this._path,u);(await oe.lstat(d).catch(R=>{throw R.code==="ENOENT"?new Z(...Ie):R})).isDirectory()?p.recursive?await oe.rm(d,{recursive:!0}).catch(R=>{throw R.code==="ENOTEMPTY"?new Z(...Kn):R}):await oe.rmdir(d).catch(R=>{throw R.code==="ENOTEMPTY"?new Z(...Kn):R}):await oe.unlink(d)}}const{join:Ho,dirname:Mr,extname:Yo,basename:ei}=window.nw.require("path"),ur=window.nw.require("fs").promises,{GONE:Ur,MISMATCH:ti}=ri;class Jo{async handleDropEvent(u,p){u.stopPropagation(),u.preventDefault();const d=u.dataTransfer.items;return console.log(d),""}async getDirectoryHandle(u,p){try{const d=await ur.lstat(u).catch(R=>{if(R.code!=="ENOENT")throw R}),_=d?.isDirectory();if(d&&_)return new Hn(new tt(u,Mr(u)));if(d&&!_)throw new DOMException(...ti);if(!p?.create)throw new DOMException(...Ur);return await ur.mkdir(u),new Hn(new tt(u,Mr(u)))}catch(d){console.error(`Failed to get directory ${u}): `+d);return}}async getFileHandle(u,p){try{const d=await ur.lstat(u).catch(R=>{if(R.code!=="ENOENT")throw R}),_=d?.isFile();if(d&&_)return new Yn(new gt(u,ei(u)));if(d&&!_)throw new DOMException(...ti);if(!p?.create)throw new DOMException(...Ur);return await(await ur.open(u,"w")).close(),new Yn(new gt(u,ei(u)))}catch(d){console.error("Failed to get file "+u+": "+d);return}}async getFileHandleRelativeTo(u,p){try{Yo(u)!=""&&(u=Mr(u));const d=await this.getDirectoryHandle(u);if(!d)throw new DOMException(...Ur);return d.getFileHandle(p)}catch(d){console.error("Failed to get relative file "+p+": "+d);return}}async getDirectoryFiles(u){try{let p;if(typeof u=="string"){if(p=await this.getDirectoryHandle(u),!p)return[]}else p=u;const d=[];for await(const _ of p.values())_.kind=="file"&&d.push(_);return d}catch(p){return console.error(p),[]}}async getDirectoryFolders(u){try{let p;if(typeof u=="string"){if(p=await this.getDirectoryHandle(u),!p)return[]}else p=u;const d=[];for await(const _ of p.values())_.kind=="directory"&&d.push(_);return d}catch(p){return console.error(p),[]}}async writeFile(u,p){let d;if(typeof u=="string"){if(d=await this.getFileHandle(u,{create:!0}),!d)return}else d=u;await this.writeHandle(d,p)}async writeHandle(u,p){const d=await u.createWritable();await d.write(p),await d.close()}getRelativePath(u,p){return Ho(u,p)}}export{Jo as NodeFileHandler}; + */var Xn;function Fo(){return Xn||(Xn=1,function(B){const u=Po(),p=Io(),d=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;B.Buffer=c,B.SlowBuffer=L,B.INSPECT_MAX_BYTES=50;const _=2147483647;B.kMaxLength=_,c.TYPED_ARRAY_SUPPORT=R(),!c.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function R(){try{const o=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(o,r),o.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function E(o){if(o>_)throw new RangeError('The value "'+o+'" is invalid for option "size"');const r=new Uint8Array(o);return Object.setPrototypeOf(r,c.prototype),r}function c(o,r,n){if(typeof o=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return j(o)}return Y(o,r,n)}c.poolSize=8192;function Y(o,r,n){if(typeof o=="string")return G(o,r);if(ArrayBuffer.isView(o))return g(o);if(o==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o);if(re(o,ArrayBuffer)||o&&re(o.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(re(o,SharedArrayBuffer)||o&&re(o.buffer,SharedArrayBuffer)))return w(o,r,n);if(typeof o=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const a=o.valueOf&&o.valueOf();if(a!=null&&a!==o)return c.from(a,r,n);const l=k(o);if(l)return l;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof o[Symbol.toPrimitive]=="function")return c.from(o[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof o)}c.from=function(o,r,n){return Y(o,r,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function Q(o){if(typeof o!="number")throw new TypeError('"size" argument must be of type number');if(o<0)throw new RangeError('The value "'+o+'" is invalid for option "size"')}function U(o,r,n){return Q(o),o<=0?E(o):r!==void 0?typeof n=="string"?E(o).fill(r,n):E(o).fill(r):E(o)}c.alloc=function(o,r,n){return U(o,r,n)};function j(o){return Q(o),E(o<0?0:O(o)|0)}c.allocUnsafe=function(o){return j(o)},c.allocUnsafeSlow=function(o){return j(o)};function G(o,r){if((typeof r!="string"||r==="")&&(r="utf8"),!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);const n=V(o,r)|0;let a=E(n);const l=a.write(o,r);return l!==n&&(a=a.slice(0,l)),a}function S(o){const r=o.length<0?0:O(o.length)|0,n=E(r);for(let a=0;a=_)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+_.toString(16)+" bytes");return o|0}function L(o){return+o!=o&&(o=0),c.alloc(+o)}c.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==c.prototype},c.compare=function(r,n){if(re(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),re(n,Uint8Array)&&(n=c.from(n,n.offset,n.byteLength)),!c.isBuffer(r)||!c.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let a=r.length,l=n.length;for(let h=0,m=Math.min(a,l);hl.length?(c.isBuffer(m)||(m=c.from(m)),m.copy(l,h)):Uint8Array.prototype.set.call(l,m,h);else if(c.isBuffer(m))m.copy(l,h);else throw new TypeError('"list" argument must be an Array of Buffers');h+=m.length}return l};function V(o,r){if(c.isBuffer(o))return o.length;if(ArrayBuffer.isView(o)||re(o,ArrayBuffer))return o.byteLength;if(typeof o!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof o);const n=o.length,a=arguments.length>2&&arguments[2]===!0;if(!a&&n===0)return 0;let l=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return $e(o).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return at(o).length;default:if(l)return a?-1:$e(o).length;r=(""+r).toLowerCase(),l=!0}}c.byteLength=V;function ee(o,r,n){let a=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(o||(o="utf8");;)switch(o){case"hex":return fr(this,r,n);case"utf8":case"utf-8":return ye(this,r,n);case"ascii":return lr(this,r,n);case"latin1":case"binary":return nt(this,r,n);case"base64":return fe(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ct(this,r,n);default:if(a)throw new TypeError("Unknown encoding: "+o);o=(o+"").toLowerCase(),a=!0}}c.prototype._isBuffer=!0;function z(o,r,n){const a=o[r];o[r]=o[n],o[n]=a}c.prototype.swap16=function(){const r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;nn&&(r+=" ... "),""},d&&(c.prototype[d]=c.prototype.inspect),c.prototype.compare=function(r,n,a,l,h){if(re(r,Uint8Array)&&(r=c.from(r,r.offset,r.byteLength)),!c.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(n===void 0&&(n=0),a===void 0&&(a=r?r.length:0),l===void 0&&(l=0),h===void 0&&(h=this.length),n<0||a>r.length||l<0||h>this.length)throw new RangeError("out of range index");if(l>=h&&n>=a)return 0;if(l>=h)return-1;if(n>=a)return 1;if(n>>>=0,a>>>=0,l>>>=0,h>>>=0,this===r)return 0;let m=h-l,A=a-n;const v=Math.min(m,A),D=this.slice(l,h),$=r.slice(n,a);for(let x=0;x2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Ne(n)&&(n=l?0:o.length-1),n<0&&(n=o.length+n),n>=o.length){if(l)return-1;n=o.length-1}else if(n<0)if(l)n=0;else return-1;if(typeof r=="string"&&(r=c.from(r,a)),c.isBuffer(r))return r.length===0?-1:xe(o,r,n,a,l);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?l?Uint8Array.prototype.indexOf.call(o,r,n):Uint8Array.prototype.lastIndexOf.call(o,r,n):xe(o,[r],n,a,l);throw new TypeError("val must be string, number or Buffer")}function xe(o,r,n,a,l){let h=1,m=o.length,A=r.length;if(a!==void 0&&(a=String(a).toLowerCase(),a==="ucs2"||a==="ucs-2"||a==="utf16le"||a==="utf-16le")){if(o.length<2||r.length<2)return-1;h=2,m/=2,A/=2,n/=2}function v($,x){return h===1?$[x]:$.readUInt16BE(x*h)}let D;if(l){let $=-1;for(D=n;Dm&&(n=m-A),D=n;D>=0;D--){let $=!0;for(let x=0;xl&&(a=l)):a=l;const h=r.length;a>h/2&&(a=h/2);let m;for(m=0;m>>0,isFinite(a)?(a=a>>>0,l===void 0&&(l="utf8")):(l=a,a=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const h=this.length-n;if((a===void 0||a>h)&&(a=h),r.length>0&&(a<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");l||(l="utf8");let m=!1;for(;;)switch(l){case"hex":return be(this,r,n,a);case"utf8":case"utf-8":return St(this,r,n,a);case"ascii":case"latin1":case"binary":return ae(this,r,n,a);case"base64":return Rt(this,r,n,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rt(this,r,n,a);default:if(m)throw new TypeError("Unknown encoding: "+l);l=(""+l).toLowerCase(),m=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function fe(o,r,n){return r===0&&n===o.length?u.fromByteArray(o):u.fromByteArray(o.slice(r,n))}function ye(o,r,n){n=Math.min(o.length,n);const a=[];let l=r;for(;l239?4:h>223?3:h>191?2:1;if(l+A<=n){let v,D,$,x;switch(A){case 1:h<128&&(m=h);break;case 2:v=o[l+1],(v&192)===128&&(x=(h&31)<<6|v&63,x>127&&(m=x));break;case 3:v=o[l+1],D=o[l+2],(v&192)===128&&(D&192)===128&&(x=(h&15)<<12|(v&63)<<6|D&63,x>2047&&(x<55296||x>57343)&&(m=x));break;case 4:v=o[l+1],D=o[l+2],$=o[l+3],(v&192)===128&&(D&192)===128&&($&192)===128&&(x=(h&15)<<18|(v&63)<<12|(D&63)<<6|$&63,x>65535&&x<1114112&&(m=x))}}m===null?(m=65533,A=1):m>65535&&(m-=65536,a.push(m>>>10&1023|55296),m=56320|m&1023),a.push(m),l+=A}return Et(a)}const Ue=4096;function Et(o){const r=o.length;if(r<=Ue)return String.fromCharCode.apply(String,o);let n="",a=0;for(;aa)&&(n=a);let l="";for(let h=r;ha&&(r=a),n<0?(n+=a,n<0&&(n=0)):n>a&&(n=a),nn)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(r,n,a){r=r>>>0,n=n>>>0,a||N(r,n,this.length);let l=this[r],h=1,m=0;for(;++m>>0,n=n>>>0,a||N(r,n,this.length);let l=this[r+--n],h=1;for(;n>0&&(h*=256);)l+=this[r+--n]*h;return l},c.prototype.readUint8=c.prototype.readUInt8=function(r,n){return r=r>>>0,n||N(r,1,this.length),this[r]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(r,n){return r=r>>>0,n||N(r,2,this.length),this[r]|this[r+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(r,n){return r=r>>>0,n||N(r,2,this.length),this[r]<<8|this[r+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(r,n){return r=r>>>0,n||N(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(r,n){return r=r>>>0,n||N(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},c.prototype.readBigUInt64LE=J(function(r){r=r>>>0,pe(r,"offset");const n=this[r],a=this[r+7];(n===void 0||a===void 0)&&_e(r,this.length-8);const l=n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,h=this[++r]+this[++r]*2**8+this[++r]*2**16+a*2**24;return BigInt(l)+(BigInt(h)<>>0,pe(r,"offset");const n=this[r],a=this[r+7];(n===void 0||a===void 0)&&_e(r,this.length-8);const l=n*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],h=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+a;return(BigInt(l)<>>0,n=n>>>0,a||N(r,n,this.length);let l=this[r],h=1,m=0;for(;++m=h&&(l-=Math.pow(2,8*n)),l},c.prototype.readIntBE=function(r,n,a){r=r>>>0,n=n>>>0,a||N(r,n,this.length);let l=n,h=1,m=this[r+--l];for(;l>0&&(h*=256);)m+=this[r+--l]*h;return h*=128,m>=h&&(m-=Math.pow(2,8*n)),m},c.prototype.readInt8=function(r,n){return r=r>>>0,n||N(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},c.prototype.readInt16LE=function(r,n){r=r>>>0,n||N(r,2,this.length);const a=this[r]|this[r+1]<<8;return a&32768?a|4294901760:a},c.prototype.readInt16BE=function(r,n){r=r>>>0,n||N(r,2,this.length);const a=this[r+1]|this[r]<<8;return a&32768?a|4294901760:a},c.prototype.readInt32LE=function(r,n){return r=r>>>0,n||N(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},c.prototype.readInt32BE=function(r,n){return r=r>>>0,n||N(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},c.prototype.readBigInt64LE=J(function(r){r=r>>>0,pe(r,"offset");const n=this[r],a=this[r+7];(n===void 0||a===void 0)&&_e(r,this.length-8);const l=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(a<<24);return(BigInt(l)<>>0,pe(r,"offset");const n=this[r],a=this[r+7];(n===void 0||a===void 0)&&_e(r,this.length-8);const l=(n<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(l)<>>0,n||N(r,4,this.length),p.read(this,r,!0,23,4)},c.prototype.readFloatBE=function(r,n){return r=r>>>0,n||N(r,4,this.length),p.read(this,r,!1,23,4)},c.prototype.readDoubleLE=function(r,n){return r=r>>>0,n||N(r,8,this.length),p.read(this,r,!0,52,8)},c.prototype.readDoubleBE=function(r,n){return r=r>>>0,n||N(r,8,this.length),p.read(this,r,!1,52,8)};function X(o,r,n,a,l,h){if(!c.isBuffer(o))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>l||ro.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(r,n,a,l){if(r=+r,n=n>>>0,a=a>>>0,!l){const A=Math.pow(2,8*a)-1;X(this,r,n,a,A,0)}let h=1,m=0;for(this[n]=r&255;++m>>0,a=a>>>0,!l){const A=Math.pow(2,8*a)-1;X(this,r,n,a,A,0)}let h=a-1,m=1;for(this[n+h]=r&255;--h>=0&&(m*=256);)this[n+h]=r/m&255;return n+a},c.prototype.writeUint8=c.prototype.writeUInt8=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,1,255,0),this[n]=r&255,n+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,4,4294967295,0),this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255,n+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,4,4294967295,0),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4};function je(o,r,n,a,l){ue(r,a,l,o,n,7);let h=Number(r&BigInt(4294967295));o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h,h=h>>8,o[n++]=h;let m=Number(r>>BigInt(32)&BigInt(4294967295));return o[n++]=m,m=m>>8,o[n++]=m,m=m>>8,o[n++]=m,m=m>>8,o[n++]=m,n}function Le(o,r,n,a,l){ue(r,a,l,o,n,7);let h=Number(r&BigInt(4294967295));o[n+7]=h,h=h>>8,o[n+6]=h,h=h>>8,o[n+5]=h,h=h>>8,o[n+4]=h;let m=Number(r>>BigInt(32)&BigInt(4294967295));return o[n+3]=m,m=m>>8,o[n+2]=m,m=m>>8,o[n+1]=m,m=m>>8,o[n]=m,n+8}c.prototype.writeBigUInt64LE=J(function(r,n=0){return je(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=J(function(r,n=0){return Le(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(r,n,a,l){if(r=+r,n=n>>>0,!l){const v=Math.pow(2,8*a-1);X(this,r,n,a,v-1,-v)}let h=0,m=1,A=0;for(this[n]=r&255;++h>0)-A&255;return n+a},c.prototype.writeIntBE=function(r,n,a,l){if(r=+r,n=n>>>0,!l){const v=Math.pow(2,8*a-1);X(this,r,n,a,v-1,-v)}let h=a-1,m=1,A=0;for(this[n+h]=r&255;--h>=0&&(m*=256);)r<0&&A===0&&this[n+h+1]!==0&&(A=1),this[n+h]=(r/m>>0)-A&255;return n+a},c.prototype.writeInt8=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},c.prototype.writeInt16LE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},c.prototype.writeInt16BE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},c.prototype.writeInt32LE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,4,2147483647,-2147483648),this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24,n+4},c.prototype.writeInt32BE=function(r,n,a){return r=+r,n=n>>>0,a||X(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},c.prototype.writeBigInt64LE=J(function(r,n=0){return je(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=J(function(r,n=0){return Le(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function it(o,r,n,a,l,h){if(n+a>o.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Bt(o,r,n,a,l){return r=+r,n=n>>>0,l||it(o,r,n,4),p.write(o,r,n,a,23,4),n+4}c.prototype.writeFloatLE=function(r,n,a){return Bt(this,r,n,!0,a)},c.prototype.writeFloatBE=function(r,n,a){return Bt(this,r,n,!1,a)};function Tt(o,r,n,a,l){return r=+r,n=n>>>0,l||it(o,r,n,8),p.write(o,r,n,a,52,8),n+8}c.prototype.writeDoubleLE=function(r,n,a){return Tt(this,r,n,!0,a)},c.prototype.writeDoubleBE=function(r,n,a){return Tt(this,r,n,!1,a)},c.prototype.copy=function(r,n,a,l){if(!c.isBuffer(r))throw new TypeError("argument should be a Buffer");if(a||(a=0),!l&&l!==0&&(l=this.length),n>=r.length&&(n=r.length),n||(n=0),l>0&&l=this.length)throw new RangeError("Index out of range");if(l<0)throw new RangeError("sourceEnd out of bounds");l>this.length&&(l=this.length),r.length-n>>0,a=a===void 0?this.length:a>>>0,r||(r=0);let h;if(typeof r=="number")for(h=n;h2**32?l=At(String(n)):typeof n=="bigint"&&(l=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(l=At(l)),l+="n"),a+=` It must be ${r}. Received ${l}`,a},RangeError);function At(o){let r="",n=o.length;const a=o[0]==="-"?1:0;for(;n>=a+4;n-=3)r=`_${o.slice(n-3,n)}${r}`;return`${o.slice(0,n)}${r}`}function Pt(o,r,n){pe(r,"offset"),(o[r]===void 0||o[r+n]===void 0)&&_e(r,o.length-(n+1))}function ue(o,r,n,a,l,h){if(o>n||o3?r===0||r===BigInt(0)?A=`>= 0${m} and < 2${m} ** ${(h+1)*8}${m}`:A=`>= -(2${m} ** ${(h+1)*8-1}${m}) and < 2 ** ${(h+1)*8-1}${m}`:A=`>= ${r}${m} and <= ${n}${m}`,new K.ERR_OUT_OF_RANGE("value",A,o)}Pt(a,l,h)}function pe(o,r){if(typeof o!="number")throw new K.ERR_INVALID_ARG_TYPE(r,"number",o)}function _e(o,r,n){throw Math.floor(o)!==o?(pe(o,n),new K.ERR_OUT_OF_RANGE(n||"offset","an integer",o)):r<0?new K.ERR_BUFFER_OUT_OF_BOUNDS:new K.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${r}`,o)}const It=/[^+/0-9A-Za-z-_]/g;function cr(o){if(o=o.split("=")[0],o=o.trim().replace(It,""),o.length<2)return"";for(;o.length%4!==0;)o=o+"=";return o}function $e(o,r){r=r||1/0;let n;const a=o.length;let l=null;const h=[];for(let m=0;m55295&&n<57344){if(!l){if(n>56319){(r-=3)>-1&&h.push(239,191,189);continue}else if(m+1===a){(r-=3)>-1&&h.push(239,191,189);continue}l=n;continue}if(n<56320){(r-=3)>-1&&h.push(239,191,189),l=n;continue}n=(l-55296<<10|n-56320)+65536}else l&&(r-=3)>-1&&h.push(239,191,189);if(l=null,n<128){if((r-=1)<0)break;h.push(n)}else if(n<2048){if((r-=2)<0)break;h.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;h.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;h.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return h}function ot(o){const r=[];for(let n=0;n>8,l=n%256,h.push(l),h.push(a);return h}function at(o){return u.toByteArray(cr(o))}function Re(o,r,n,a){let l;for(l=0;l=r.length||l>=o.length);++l)r[l+n]=o[l];return l}function re(o,r){return o instanceof r||o!=null&&o.constructor!=null&&o.constructor.name!=null&&o.constructor.name===r.name}function Ne(o){return o!==o}const We=function(){const o="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){const a=n*16;for(let l=0;l<16;++l)r[a+l]=o[n]+o[l]}return r}();function J(o){return typeof BigInt>"u"?qe:o}function qe(){throw new Error("BigInt not supported")}}(kr)),kr}const xo=65536;if(!globalThis.ReadableStream)try{const B=jr,{emitWarning:u}=B;try{B.emitWarning=()=>{},Object.assign(globalThis,jr),B.emitWarning=u}catch(p){throw B.emitWarning=u,p}}catch{Object.assign(globalThis,Ao())}try{const{Blob:B}=Fo();B&&!B.prototype.stream&&(B.prototype.stream=function(p){let d=0;const _=this;return new ReadableStream({type:"bytes",async pull(R){const c=await _.slice(d,Math.min(_.size,d+xo)).arrayBuffer();d+=c.byteLength,R.enqueue(new Uint8Array(c)),d===_.size&&R.close()}})})}catch{}/*! fetch-blob. MIT License. Jimmy Wärting */const Jn=65536;async function*Dr(B,u=!0){for(const p of B)if("stream"in p)yield*p.stream();else if(ArrayBuffer.isView(p))if(u){let d=p.byteOffset;const _=p.byteOffset+p.byteLength;for(;d!==_;){const R=Math.min(_-d,Jn),E=p.buffer.slice(d,d+R);d+=E.byteLength,yield new Uint8Array(E)}}else yield p;else{let d=0,_=p;for(;d!==_.size;){const E=await _.slice(d,Math.min(_.size,d+Jn)).arrayBuffer();d+=E.byteLength,yield new Uint8Array(E)}}}const ni=class Lr{#e=[];#t="";#r=0;#n="transparent";constructor(u=[],p={}){if(typeof u!="object"||u===null)throw new TypeError("Failed to construct 'Blob': The provided value cannot be converted to a sequence.");if(typeof u[Symbol.iterator]!="function")throw new TypeError("Failed to construct 'Blob': The object must have a callable @@iterator property.");if(typeof p!="object"&&typeof p!="function")throw new TypeError("Failed to construct 'Blob': parameter 2 cannot convert to dictionary.");p===null&&(p={});const d=new TextEncoder;for(const R of u){let E;ArrayBuffer.isView(R)?E=new Uint8Array(R.buffer.slice(R.byteOffset,R.byteOffset+R.byteLength)):R instanceof ArrayBuffer?E=new Uint8Array(R.slice(0)):R instanceof Lr?E=R:E=d.encode(`${R}`),this.#r+=ArrayBuffer.isView(E)?E.byteLength:E.size,this.#e.push(E)}this.#n=`${p.endings===void 0?"transparent":p.endings}`;const _=p.type===void 0?"":String(p.type);this.#t=/^[\x20-\x7E]*$/.test(_)?_:""}get size(){return this.#r}get type(){return this.#t}async text(){const u=new TextDecoder;let p="";for await(const d of Dr(this.#e,!1))p+=u.decode(d,{stream:!0});return p+=u.decode(),p}async arrayBuffer(){const u=new Uint8Array(this.size);let p=0;for await(const d of Dr(this.#e,!1))u.set(d,p),p+=d.length;return u.buffer}stream(){const u=Dr(this.#e,!0);return new globalThis.ReadableStream({type:"bytes",async pull(p){const d=await u.next();d.done?p.close():p.enqueue(d.value)},async cancel(){await u.return()}})}slice(u=0,p=this.size,d=""){const{size:_}=this;let R=u<0?Math.max(_+u,0):Math.min(u,_),E=p<0?Math.max(_+p,0):Math.min(p,_);const c=Math.max(E-R,0),Y=this.#e,Q=[];let U=0;for(const G of Y){if(U>=c)break;const S=ArrayBuffer.isView(G)?G.byteLength:G.size;if(R&&S<=R)R-=S,E-=S;else{let g;ArrayBuffer.isView(G)?(g=G.subarray(R,Math.min(S,E)),U+=g.byteLength):(g=G.slice(R,Math.min(S,E)),U+=g.size),E-=S,Q.push(g),R=0}}const j=new Lr([],{type:String(d).toLowerCase()});return j.#r=c,j.#e=Q,j}get[Symbol.toStringTag](){return"Blob"}static[Symbol.hasInstance](u){return u&&typeof u=="object"&&typeof u.constructor=="function"&&(typeof u.stream=="function"||typeof u.arrayBuffer=="function")&&/^(Blob|File)$/.test(u[Symbol.toStringTag])}};Object.defineProperties(ni.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}});const $r=ni;/*! node-domexception. MIT License. Jimmy Wärting */if(!globalThis.DOMException)try{const{MessageChannel:B}=jr,u=new B().port1,p=new ArrayBuffer;u.postMessage(p,[p,p])}catch(B){B.constructor.name==="DOMException"&&(globalThis.DOMException=B.constructor)}var Wo=globalThis.DOMException;const Z=Bo(Wo),qo=class extends $r{#e=0;#t="";constructor(u,p,d={}){if(arguments.length<2)throw new TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(u,d),d===null&&(d={});const _=d.lastModified===void 0?Date.now():Number(d.lastModified);Number.isNaN(_)||(this.#e=_),this.#t=String(p)}get name(){return this.#t}get lastModified(){return this.#e}get[Symbol.toStringTag](){return"File"}static[Symbol.hasInstance](u){return!!u&&u instanceof $r&&/^(File)$/.test(u[Symbol.toStringTag])}},Oo=qo;var Hr=nw.require("fs");Hr.statSync;const vo=Hr.createReadStream,ko=Hr.promises;var Do=nw.require("path");const zo=Do.basename,{stat:ii}=ko,Mo=(B,u)=>ii(B).then(p=>Uo(p,B,u)),Uo=(B,u,p="")=>new Oo([new Yr({path:u,size:B.size,lastModified:B.mtimeMs,start:0})],zo(u),{type:p,lastModified:B.mtimeMs});class Yr{#e;#t;constructor(u){this.#e=u.path,this.#t=u.start,this.size=u.size,this.lastModified=u.lastModified}slice(u,p){return new Yr({path:this.#e,lastModified:this.lastModified,size:p-u,start:this.#t+u})}async*stream(){const{mtimeMs:u}=await ii(this.#e);if(u>this.lastModified)throw new Z("The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.","NotReadableError");yield*vo(this.#e,{start:this.#t,end:this.#t+this.size-1})}get[Symbol.toStringTag](){return"Blob"}}const jo=globalThis&&globalThis.__classPrivateFieldGet||function(B,u,p,d){if(p==="a"&&!d)throw new TypeError("Private accessor was defined without a getter");if(typeof u=="function"?B!==u||!d:!u.has(B))throw new TypeError("Cannot read private member from an object whose class did not declare it");return p==="m"?d:p==="a"?d.call(B):d?d.value:u.get(B)};let Nr,oi;var Lo=nw.require("path");const sr=Lo.join;var oe=nw.require("fs").promises;const{INVALID:$o,GONE:Ie,MISMATCH:Zn,MOD_ERR:Kn,SYNTAX:zr}=ri;class No{constructor(u,p,d){this.position=0,this.fileHandle=u,this.path=p,this.size=d,this.position=0}async abort(){await this.fileHandle.close()}async write(u){try{await oe.stat(this.path)}catch(d){if(d.code==="ENOENT")throw await this.fileHandle.close().catch(),new Z(...Ie)}if(To(u)){if(u.type==="write"){if(typeof u.position=="number"&&u.position>=0&&(this.position=u.position),!("data"in u))throw await this.fileHandle.close(),new Z(...zr("write requires a data argument"));u=u.data}else if(u.type==="seek")if(Number.isInteger(u.position)&&u.position>=0){if(this.size=0){await this.fileHandle.truncate(u.size),this.size=u.size,this.position>this.size&&(this.position=this.size);return}else throw await this.fileHandle.close(),new Z(...zr("truncate requires a size argument"))}if(u instanceof ArrayBuffer)u=new Uint8Array(u);else if(typeof u=="string")u=Buffer.from(u);else if(u instanceof $r){for await(const d of u.stream()){const _=await this.fileHandle.writev([d],this.position);this.position+=_.bytesWritten,this.size+=_.bytesWritten}return}const p=await this.fileHandle.writev([u],this.position);this.position+=p.bytesWritten,this.size+=p.bytesWritten}async close(){await this.fileHandle.close(),await oe.stat(this.path).catch(u=>{if(u.code==="ENOENT")throw new Z(...Ie)})}}class gt{constructor(u,p){Nr.add(this),this.kind="file",this.writable=!0,this._path=u,this.name=p}async getFile(){return await oe.stat(this._path).catch(u=>{if(u.code==="ENOENT")throw new Z(...Ie)}),await Mo(this._path)}async isSameEntry(u){return this._path===jo(this,Nr,"m",oi).apply(u)}async createWritable(){const u=await oe.open(this._path,"r+").catch(d=>{throw d.code==="ENOENT"?new Z(...Ie):d}),{size:p}=await u.stat();return new No(u,this._path,p)}}Nr=new WeakSet,oi=function(){return this._path};class tt{constructor(u="",p=""){this.kind="directory",this.writable=!0,this.name=p,this._path=u}async isSameEntry(u){return this._path===u._path}async*entries(){const u=this._path,p=await oe.readdir(u).catch(d=>{throw d.code==="ENOENT"?new Z(...Ie):d});for(const d of p){const _=sr(u,d),R=await oe.lstat(_);R.isFile()?yield[d,new gt(_,d)]:R.isDirectory()&&(yield[d,new tt(_,d)])}}async getDirectoryHandle(u,p={}){const d=sr(this._path,u),_=await oe.lstat(d).catch(E=>{if(E.code!=="ENOENT")throw E}),R=_?.isDirectory();if(_&&R)return new tt(d,u);if(_&&!R)throw new Z(...Zn);if(!p.create)throw new Z(...Ie);return await oe.mkdir(d),new tt(d,u)}async getFileHandle(u,p={}){const d=sr(this._path,u),_=await oe.lstat(d).catch(E=>{if(E.code!=="ENOENT")throw E}),R=_?.isFile();if(_&&R)return new gt(d,u);if(_&&!R)throw new Z(...Zn);if(!p.create)throw new Z(...Ie);return await(await oe.open(d,"w")).close(),new gt(d,u)}async queryPermission(){return"granted"}async removeEntry(u,p){const d=sr(this._path,u);(await oe.lstat(d).catch(R=>{throw R.code==="ENOENT"?new Z(...Ie):R})).isDirectory()?p.recursive?await oe.rm(d,{recursive:!0}).catch(R=>{throw R.code==="ENOTEMPTY"?new Z(...Kn):R}):await oe.rmdir(d).catch(R=>{throw R.code==="ENOTEMPTY"?new Z(...Kn):R}):await oe.unlink(d)}}const{join:Ho,dirname:Mr,extname:Yo,basename:ei}=window.nw.require("path"),ur=window.nw.require("fs").promises,{GONE:Ur,MISMATCH:ti}=ri;class Jo{async handleDropEvent(u,p){u.stopPropagation(),u.preventDefault();const d=u.dataTransfer.items;return console.log(d),""}async getDirectoryHandle(u,p){try{const d=await ur.lstat(u).catch(R=>{if(R.code!=="ENOENT")throw R}),_=d?.isDirectory();if(d&&_)return new Hn(new tt(u,Mr(u)));if(d&&!_)throw new DOMException(...ti);if(!p?.create)throw new DOMException(...Ur);return await ur.mkdir(u),new Hn(new tt(u,Mr(u)))}catch(d){console.error(`Failed to get directory ${u}): `+d);return}}async hasFile(u){try{return await this.getFileHandle(u),!0}catch{return!1}}async getFileHandle(u,p){try{const d=await ur.lstat(u).catch(R=>{if(R.code!=="ENOENT")throw R}),_=d?.isFile();if(d&&_)return new Yn(new gt(u,ei(u)));if(d&&!_)throw new DOMException(...ti);if(!p?.create)throw new DOMException(...Ur);return await(await ur.open(u,"w")).close(),new Yn(new gt(u,ei(u)))}catch(d){console.error("Failed to get file "+u+": "+d);return}}async getFileHandleRelativeTo(u,p){try{Yo(u)!=""&&(u=Mr(u));const d=await this.getDirectoryHandle(u);if(!d)throw new DOMException(...Ur);return d.getFileHandle(p)}catch(d){console.error("Failed to get relative file "+p+": "+d);return}}async getDirectoryFiles(u){try{let p;if(typeof u=="string"){if(p=await this.getDirectoryHandle(u),!p)return[]}else p=u;const d=[];for await(const _ of p.values())_.kind=="file"&&d.push(_);return d}catch(p){return console.error(p),[]}}async getDirectoryFolders(u){try{let p;if(typeof u=="string"){if(p=await this.getDirectoryHandle(u),!p)return[]}else p=u;const d=[];for await(const _ of p.values())_.kind=="directory"&&d.push(_);return d}catch(p){return console.error(p),[]}}async writeFile(u,p){let d;if(typeof u=="string"){if(d=await this.getFileHandle(u,{create:!0}),!d)return}else d=u;await this.writeHandle(d,p)}async writeHandle(u,p){const d=await u.createWritable();await d.write(p),await d.close()}getRelativePath(u,p){return Ho(u,p)}}export{Jo as NodeFileHandler}; diff --git a/beta/assets/OggDec-2941c3fd.js b/beta/assets/OggDec-2941c3fd.js new file mode 100644 index 00000000..90b5e1cc --- /dev/null +++ b/beta/assets/OggDec-2941c3fd.js @@ -0,0 +1,4 @@ +var wI=function(){var hA=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(q){q=q||{};function FA(A){var I=0;return function(){return I=C);)++g;if(16Q?C+=String.fromCharCode(Q):(Q-=65536,C+=String.fromCharCode(55296|Q>>10,56320|Q&1023))}}else C+=String.fromCharCode(Q)}return C}function CA(A,I,g,C){if(!(0=i){var o=A.charCodeAt(++E);i=65536+((i&1023)<<10)|o&1023}if(127>=i){if(g>=C)break;I[g++]=i}else{if(2047>=i){if(g+1>=C)break;I[g++]=192|i>>6}else{if(65535>=i){if(g+2>=C)break;I[g++]=224|i>>12}else{if(g+3>=C)break;I[g++]=240|i>>18,I[g++]=128|i>>12&63}I[g++]=128|i>>6&63}I[g++]=128|i&63}}return I[g]=0,g-Q}function QA(A){for(var I=0,g=0;g=C&&(C=65536+((C&1023)<<10)|A.charCodeAt(++g)&1023),127>=C?++I:I=2047>=C?I+2:65535>=C?I+3:I+4}return I}typeof TextDecoder<"u"&&new TextDecoder("utf-16le");function rA(A){var I=QA(A)+1,g=zA(I);return CA(A,H,g,I),g}var x,H,Z,SA,e,EA=D.TOTAL_MEMORY||16777216;D.wasmMemory?m=D.wasmMemory:m=new WebAssembly.Memory({initial:EA/65536,maximum:EA/65536}),m&&(x=m.buffer),EA=x.byteLength;var S=x;x=S,D.HEAP8=H=new Int8Array(S),D.HEAP16=SA=new Int16Array(S),D.HEAP32=e=new Int32Array(S),D.HEAPU8=Z=new Uint8Array(S),D.HEAPU16=new Uint16Array(S),D.HEAPU32=new Uint32Array(S),D.HEAPF32=new Float32Array(S),D.HEAPF64=new Float64Array(S),e[13152]=5295696;function v(A){for(;0>2]=A),A}function J(){for(var A="",I=!1,g=arguments.length-1;-1<=g&&!I;g--){if(I=0<=g?arguments[g]:B.Ra(),typeof I!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!I)return"";A=I+"/"+A,I=I.charAt(0)==="/"}return A=wA(A.split("/").filter(function(C){return!!C}),!I).join("/"),(I?"/":"")+A||"."}function JA(A,I){function g(i){for(var o=0;oP?[]:i.slice(o,P-o+1)}A=J(A).substr(1),I=J(I).substr(1),A=g(A.split("/")),I=g(I.split("/"));for(var C=Math.min(A.length,I.length),Q=C,E=0;E=I||(I=Math.max(I,g*(1048576>g?2:1.125)|0),g!=0&&(I=Math.max(I,256)),g=A.v,A.v=new Uint8Array(I),0I)A.v.length=I;else for(;A.v.length=A.node.D)return 0;if(A=Math.min(A.node.D-Q,C),8I)throw new B.u(28);return I},pa:function(A,I,g){t.vb(A.node,I+g),A.node.D=Math.max(A.node.D,I+g)},wa:function(A,I,g,C,Q,E,i){if(!B.isFile(A.node.mode))throw new B.u(43);if(g=A.node.v,i&2||g.buffer!==I&&g.buffer!==I.buffer){if((0h.timestamp)&&(E.push(w),Q++)});var i=[];if(Object.keys(I.entries).forEach(function(w){A.entries[w]||(i.push(w),Q++)}),!Q)return g(null);var o=!1,P=(A.type==="remote"?A.db:I.db).transaction([s.M],"readwrite"),n=P.objectStore(s.M);P.onerror=function(w){C(this.error),w.preventDefault()},P.oncomplete=function(){o||g(null)},E.sort().forEach(function(w){I.type==="local"?s.nc(n,w,function(F,h){if(F)return C(F);s.Ec(w,h,C)}):s.mc(w,function(F,h){if(F)return C(F);s.Fc(n,w,h,C)})}),i.sort().reverse().forEach(function(w){I.type==="local"?s.zc(w,C):s.Ac(n,w,C)})}},y={Oa:16895,oa:33279,fb:null,F:function(A){function I(E){E=E.split("/");for(var i=C,o=0;o=A.node.size?0:(A=A.node.v.slice(Q,Q+C),C=y.fb.readAsArrayBuffer(A),I.set(new Uint8Array(C),g),A.size)},write:function(){throw new B.u(29)},R:function(A,I,g){if(g===1?I+=A.position:g===2&&B.isFile(A.node.mode)&&(I+=A.node.size),0>I)throw new B.u(28);return I}}},B={root:null,Aa:[],tb:{},streams:[],rc:1,U:null,rb:"/",Ya:!1,Cb:!0,K:{},Fb:{Eb:{Nb:1,Ob:2}},u:null,Va:{},ac:null,Na:0,Xc:function(A){if(!(A instanceof B.u)){A:{var I=Error();if(!I.stack){try{throw Error(0)}catch(g){I=g}if(!I.stack){I="(no stack trace available)";break A}}I=I.stack.toString()}throw D.extraStackTrace&&(I+=` +`+D.extraStackTrace()),I=gI(I),A+" : "+I}return O(A.O)},C:function(A,I){if(A=J(B.Ra(),A),I=I||{},!A)return{path:"",node:null};var g={Ua:!0,gb:0},C;for(C in g)I[C]===void 0&&(I[C]=g[C]);if(8>>0)%B.U.length},Ab:function(A){var I=B.Xa(A.parent.id,A.name);A.ga=B.U[I],B.U[I]=A},Bb:function(A){var I=B.Xa(A.parent.id,A.name);if(B.U[I]===A)B.U[I]=A.ga;else for(I=B.U[I];I;){if(I.ga===A){I.ga=A.ga;break}I=I.ga}},Y:function(A,I){var g=B.oc(A);if(g)throw new B.u(g,A);for(g=B.U[B.Xa(A.id,I)];g;g=g.ga){var C=g.name;if(g.parent.id===A.id&&C===I)return g}return B.$(A,I)},createNode:function(A,I,g,C){return B.Ea||(B.Ea=function(Q,E,i,o){Q||(Q=this),this.parent=Q,this.F=Q.F,this.ya=null,this.id=B.rc++,this.name=E,this.mode=i,this.A={},this.B={},this.Ca=o},B.Ea.prototype={},Object.defineProperties(B.Ea.prototype,{read:{get:function(){return(this.mode&365)===365},set:function(Q){Q?this.mode|=365:this.mode&=-366}},write:{get:function(){return(this.mode&146)===146},set:function(Q){Q?this.mode|=146:this.mode&=-147}},lc:{get:function(){return B.G(this.mode)}},Db:{get:function(){return B.Ia(this.mode)}}})),A=new B.Ea(A,I,g,C),B.Ab(A),A},Sa:function(A){B.Bb(A)},Ja:function(A){return A===A.parent},ea:function(A){return!!A.ya},isFile:function(A){return(A&61440)===32768},G:function(A){return(A&61440)===16384},va:function(A){return(A&61440)===40960},Ia:function(A){return(A&61440)===8192},jc:function(A){return(A&61440)===24576},kc:function(A){return(A&61440)===4096},Yc:function(A){return(A&49152)===49152},bc:{r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218},qc:function(A){var I=B.bc[A];if(typeof I>"u")throw Error("Unknown file open mode: "+A);return I},wb:function(A){var I=["r","w","rw"][A&3];return A&512&&(I+="w"),I},ha:function(A,I){if(B.Cb)return 0;if(I.indexOf("r")===-1||A.mode&292){if(I.indexOf("w")!==-1&&!(A.mode&146)||I.indexOf("x")!==-1&&!(A.mode&73))return 2}else return 2;return 0},oc:function(A){var I=B.ha(A,"x");return I||(A.A.$?0:2)},ab:function(A,I){try{return B.Y(A,I),20}catch{}return B.ha(A,"wx")},Ka:function(A,I,g){try{var C=B.Y(A,I)}catch(Q){return Q.O}if(A=B.ha(A,"wx"))return A;if(g){if(!B.G(C.mode))return 54;if(B.Ja(C)||B.X(C)===B.Ra())return 10}else if(B.G(C.mode))return 31;return 0},pc:function(A,I){return A?B.va(A.mode)?32:B.G(A.mode)&&(B.wb(I)!=="r"||I&512)?31:B.ha(A,B.wb(I)):44},Mb:4096,sc:function(A,I){for(I=I||B.Mb,A=A||0;A<=I;A++)if(!B.streams[A])return A;throw new B.u(33)},sa:function(A){return B.streams[A]},Yb:function(A,I,g){B.Fa||(B.Fa=function(){},B.Fa.prototype={},Object.defineProperties(B.Fa.prototype,{object:{get:function(){return this.node},set:function(E){this.node=E}}}));var C=new B.Fa,Q;for(Q in A)C[Q]=A[Q];return A=C,I=B.sc(I,g),A.ra=I,B.streams[I]=A},Sb:function(A){B.streams[A]=null},Rb:{open:function(A){A.B=B.dc(A.node.Ca).B,A.B.open&&A.B.open(A)},R:function(){throw new B.u(70)}},$a:function(A){return A>>8},dd:function(A){return A&255},fa:function(A,I){return A<<8|I},hb:function(A,I){B.tb[A]={B:I}},dc:function(A){return B.tb[A]},yb:function(A){var I=[];for(A=[A];A.length;){var g=A.pop();I.push(g),A.push.apply(A,g.Aa)}return I},ib:function(A,I){function g(i){return B.Na--,I(i)}function C(i){if(i){if(!C.I)return C.I=!0,g(i)}else++E>=Q.length&&g(null)}typeof A=="function"&&(I=A,A=!1),B.Na++,1"u"&&(g=I,I=438),B.T(A,I|8192,g)},W:function(A,I){if(!J(A))throw new B.u(44);var g=B.C(I,{parent:!0}).node;if(!g)throw new B.u(44);I=Y(I);var C=B.ab(g,I);if(C)throw new B.u(C);if(!g.A.W)throw new B.u(63);return g.A.W(g,I,A)},la:function(A,I){var g=b(A),C=b(I),Q=Y(A),E=Y(I);try{var i=B.C(A,{parent:!0}),o=i.node;i=B.C(I,{parent:!0});var P=i.node}catch{throw new B.u(10)}if(!o||!P)throw new B.u(44);if(o.F!==P.F)throw new B.u(75);if(i=B.Y(o,Q),C=JA(A,C),C.charAt(0)!==".")throw new B.u(28);if(C=JA(I,g),C.charAt(0)!==".")throw new B.u(55);try{var n=B.Y(P,E)}catch{}if(i!==n){if(g=B.G(i.mode),Q=B.Ka(o,Q,g))throw new B.u(Q);if(Q=n?B.Ka(P,E,g):B.ab(P,E))throw new B.u(Q);if(!o.A.la)throw new B.u(63);if(B.ea(i)||n&&B.ea(n))throw new B.u(10);if(P!==o&&(Q=B.ha(o,"w")))throw new B.u(Q);try{B.K.willMovePath&&B.K.willMovePath(A,I)}catch(w){console.log("FS.trackingDelegate['willMovePath']('"+A+"', '"+I+"') threw an exception: "+w.message)}B.Bb(i);try{o.A.la(i,P,E)}catch(w){throw w}finally{B.Ab(i)}try{B.K.onMovePath&&B.K.onMovePath(A,I)}catch(w){console.log("FS.trackingDelegate['onMovePath']('"+A+"', '"+I+"') threw an exception: "+w.message)}}},ia:function(A){var I=B.C(A,{parent:!0}).node,g=Y(A),C=B.Y(I,g),Q=B.Ka(I,g,!0);if(Q)throw new B.u(Q);if(!I.A.ia)throw new B.u(63);if(B.ea(C))throw new B.u(10);try{B.K.willDeletePath&&B.K.willDeletePath(A)}catch(E){console.log("FS.trackingDelegate['willDeletePath']('"+A+"') threw an exception: "+E.message)}I.A.ia(I,g),B.Sa(C);try{B.K.onDeletePath&&B.K.onDeletePath(A)}catch(E){console.log("FS.trackingDelegate['onDeletePath']('"+A+"') threw an exception: "+E.message)}},aa:function(A){if(A=B.C(A,{S:!0}).node,!A.A.aa)throw new B.u(54);return A.A.aa(A)},ca:function(A){var I=B.C(A,{parent:!0}).node,g=Y(A),C=B.Y(I,g),Q=B.Ka(I,g,!1);if(Q)throw new B.u(Q);if(!I.A.ca)throw new B.u(63);if(B.ea(C))throw new B.u(10);try{B.K.willDeletePath&&B.K.willDeletePath(A)}catch(E){console.log("FS.trackingDelegate['willDeletePath']('"+A+"') threw an exception: "+E.message)}I.A.ca(I,g),B.Sa(C);try{B.K.onDeletePath&&B.K.onDeletePath(A)}catch(E){console.log("FS.trackingDelegate['onDeletePath']('"+A+"') threw an exception: "+E.message)}},ba:function(A){if(A=B.C(A).node,!A)throw new B.u(44);if(!A.A.ba)throw new B.u(28);return J(B.X(A.parent),A.A.ba(A))},stat:function(A,I){if(A=B.C(A,{S:!I}).node,!A)throw new B.u(44);if(!A.A.P)throw new B.u(63);return A.A.P(A)},cd:function(A){return B.stat(A,!0)},qa:function(A,I,g){var C;if(typeof A=="string"?C=B.C(A,{S:!g}).node:C=A,!C.A.J)throw new B.u(63);C.A.J(C,{mode:I&4095|C.mode&-4096,timestamp:Date.now()})},$c:function(A,I){B.qa(A,I,!0)},Rc:function(A,I){if(A=B.sa(A),!A)throw new B.u(8);B.qa(A.node,I)},ob:function(A,I,g,C){var Q;if(typeof A=="string"?Q=B.C(A,{S:!C}).node:Q=A,!Q.A.J)throw new B.u(63);Q.A.J(Q,{timestamp:Date.now()})},ad:function(A,I,g){B.ob(A,I,g,!0)},Sc:function(A,I,g){if(A=B.sa(A),!A)throw new B.u(8);B.ob(A.node,I,g)},truncate:function(A,I){if(0>I)throw new B.u(28);var g;if(typeof A=="string"?g=B.C(A,{S:!0}).node:g=A,!g.A.J)throw new B.u(63);if(B.G(g.mode))throw new B.u(31);if(!B.isFile(g.mode))throw new B.u(28);if(A=B.ha(g,"w"))throw new B.u(A);g.A.J(g,{size:I,timestamp:Date.now()})},Uc:function(A,I){if(A=B.sa(A),!A)throw new B.u(8);if(!(A.flags&2097155))throw new B.u(28);B.truncate(A.node,I)},Hc:function(A,I,g){A=B.C(A,{S:!0}).node,A.A.J(A,{timestamp:Math.max(I,g)})},open:function(A,I,g,C,Q){if(A==="")throw new B.u(44);if(I=typeof I=="string"?B.qc(I):I,g=I&64?(typeof g>"u"?438:g)&4095|32768:0,typeof A=="object")var E=A;else{A=W(A);try{E=B.C(A,{S:!(I&131072)}).node}catch{}}var i=!1;if(I&64)if(E){if(I&128)throw new B.u(20)}else E=B.T(A,g,0),i=!0;if(!E)throw new B.u(44);if(B.Ia(E.mode)&&(I&=-513),I&65536&&!B.G(E.mode))throw new B.u(54);if(!i&&(g=B.pc(E,I)))throw new B.u(g);I&512&&B.truncate(E,0),I&=-641,C=B.Yb({node:E,path:B.X(E),flags:I,seekable:!0,position:0,B:E.B,Gc:[],error:!1},C,Q),C.B.open&&C.B.open(C),!D.logReadFiles||I&1||(B.eb||(B.eb={}),A in B.eb||(B.eb[A]=1,console.log("FS.trackingDelegate error on read file: "+A)));try{B.K.onOpenFile&&(Q=0,(I&2097155)!==1&&(Q|=B.Fb.Eb.Nb),I&2097155&&(Q|=B.Fb.Eb.Ob),B.K.onOpenFile(A,Q))}catch(o){console.log("FS.trackingDelegate['onOpenFile']('"+A+"', flags) threw an exception: "+o.message)}return C},close:function(A){if(B.ua(A))throw new B.u(8);A.Wa&&(A.Wa=null);try{A.B.close&&A.B.close(A)}catch(I){throw I}finally{B.Sb(A.ra)}A.ra=null},ua:function(A){return A.ra===null},R:function(A,I,g){if(B.ua(A))throw new B.u(8);if(!A.seekable||!A.B.R)throw new B.u(70);if(g!=0&&g!=1&&g!=2)throw new B.u(28);return A.position=A.B.R(A,I,g),A.Gc=[],A.position},read:function(A,I,g,C,Q){if(0>C||0>Q)throw new B.u(28);if(B.ua(A))throw new B.u(8);if((A.flags&2097155)===1)throw new B.u(8);if(B.G(A.node.mode))throw new B.u(31);if(!A.B.read)throw new B.u(28);var E=typeof Q<"u";if(!E)Q=A.position;else if(!A.seekable)throw new B.u(70);return I=A.B.read(A,I,g,C,Q),E||(A.position+=I),I},write:function(A,I,g,C,Q,E){if(0>C||0>Q)throw new B.u(28);if(B.ua(A))throw new B.u(8);if(!(A.flags&2097155))throw new B.u(8);if(B.G(A.node.mode))throw new B.u(31);if(!A.B.write)throw new B.u(28);A.flags&1024&&B.R(A,0,2);var i=typeof Q<"u";if(!i)Q=A.position;else if(!A.seekable)throw new B.u(70);I=A.B.write(A,I,g,C,Q,E),i||(A.position+=I);try{A.path&&B.K.onWriteToFile&&B.K.onWriteToFile(A.path)}catch(o){console.log("FS.trackingDelegate['onWriteToFile']('"+A.path+"') threw an exception: "+o.message)}return I},pa:function(A,I,g){if(B.ua(A))throw new B.u(8);if(0>I||0>=g)throw new B.u(28);if(!(A.flags&2097155))throw new B.u(8);if(!B.isFile(A.node.mode)&&!B.G(A.node.mode))throw new B.u(43);if(!A.B.pa)throw new B.u(138);A.B.pa(A,I,g)},wa:function(A,I,g,C,Q,E,i){if(E&2&&!(i&2)&&(A.flags&2097155)!==2)throw new B.u(2);if((A.flags&2097155)===1)throw new B.u(2);if(!A.B.wa)throw new B.u(43);return A.B.wa(A,I,g,C,Q,E,i)},Ba:function(A,I,g,C,Q){return A&&A.B.Ba?A.B.Ba(A,I,g,C,Q):0},fd:function(){return 0},Za:function(A,I,g){if(!A.B.Za)throw new B.u(59);return A.B.Za(A,I,g)},xc:function(A,I){if(I=I||{},I.flags=I.flags||"r",I.encoding=I.encoding||"binary",I.encoding!=="utf8"&&I.encoding!=="binary")throw Error('Invalid encoding type "'+I.encoding+'"');var g,C=B.open(A,I.flags);A=B.stat(A).size;var Q=new Uint8Array(A);return B.read(C,Q,0,A,0),I.encoding==="utf8"?g=z(Q,0):I.encoding==="binary"&&(g=Q),B.close(C),g},Gb:function(A,I,g){if(g=g||{},g.flags=g.flags||"w",A=B.open(A,g.flags,g.mode),typeof I=="string"){var C=new Uint8Array(QA(I)+1);I=CA(I,C,0,C.length),B.write(A,C,0,I,void 0,g.nb)}else if(ArrayBuffer.isView(I))B.write(A,I,0,I.byteLength,void 0,g.nb);else throw Error("Unsupported data type");B.close(A)},Ra:function(){return B.rb},Lc:function(A){if(A=B.C(A,{S:!0}),A.node===null)throw new B.u(44);if(!B.G(A.node.mode))throw new B.u(54);var I=B.ha(A.node,"x");if(I)throw new B.u(I);B.rb=A.path},Ub:function(){B.N("/tmp"),B.N("/home"),B.N("/home/web_user")},Tb:function(){if(B.N("/dev"),B.hb(B.fa(1,3),{read:function(){return 0},write:function(g,C,Q,E){return E}}),B.La("/dev/null",B.fa(1,3)),HA(B.fa(5,0),QI),HA(B.fa(6,0),EI),B.La("/dev/tty",B.fa(5,0)),B.La("/dev/tty1",B.fa(6,0)),typeof crypto=="object"&&typeof crypto.getRandomValues=="function")var A=new Uint8Array(1),I=function(){return crypto.getRandomValues(A),A[0]};I||(I=function(){c("random_device")}),B.Z("/dev","random",I),B.Z("/dev","urandom",I),B.N("/dev/shm"),B.N("/dev/shm/tmp")},Wb:function(){B.N("/proc"),B.N("/proc/self"),B.N("/proc/self/fd"),B.F({F:function(){var A=B.createNode("/proc/self","fd",16895,73);return A.A={$:function(I,g){var C=B.sa(+g);if(!C)throw new B.u(8);return I={parent:null,F:{za:"fake"},A:{ba:function(){return C.path}}},I.parent=I}},A}},{},"/proc/self/fd")},Xb:function(){D.stdin?B.Z("/dev","stdin",D.stdin):B.W("/dev/tty","/dev/stdin"),D.stdout?B.Z("/dev","stdout",null,D.stdout):B.W("/dev/tty","/dev/stdout"),D.stderr?B.Z("/dev","stderr",null,D.stderr):B.W("/dev/tty1","/dev/stderr"),B.open("/dev/stdin","r"),B.open("/dev/stdout","w"),B.open("/dev/stderr","w")},ub:function(){B.u||(B.u=function(A,I){this.node=I,this.Cc=function(g){this.O=g},this.Cc(A),this.message="FS error"},B.u.prototype=Error(),B.u.prototype.constructor=B.u,[44].forEach(function(A){B.Va[A]=new B.u(A),B.Va[A].stack=""}))},Dc:function(){B.ub(),B.U=Array(4096),B.F(t,{},"/"),B.Ub(),B.Tb(),B.Wb(),B.ac={MEMFS:t,IDBFS:s,WORKERFS:y}},ta:function(A,I,g){B.ta.Ya=!0,B.ub(),D.stdin=A||D.stdin,D.stdout=I||D.stdout,D.stderr=g||D.stderr,B.Xb()},hd:function(){B.ta.Ya=!1;var A=D._fflush;for(A&&A(0),A=0;A=o.length)return 0;if(w=Math.min(o.length-F,w),o.slice)for(var h=0;h>2]}function j(A){if(A||(A=R()),A=B.sa(A),!A)throw new B.u(8);return A}function iI(A){try{var I=j(A);return B.close(I),0}catch(g){return typeof B<"u"&&g instanceof B.u||c(g),g.O}}function oI(A,I,g,C){try{A:{for(var Q=j(A),E=A=0;E>2],e[I+(8*E+4)>>2],void 0);if(0>i){var o=-1;break A}A+=i}o=A}return e[C>>2]=o,0}catch(P){return typeof B<"u"&&P instanceof B.u||c(P),P.O}}B.Dc();function dA(A){var I=Array(QA(A)+1);return A=CA(A,I,0,I.length),I.length=A,I}var DI=typeof atob=="function"?atob:function(A){var I="",g=0;A=A.replace(/[^A-Za-z0-9\+\/=]/g,"");do{var C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(A.charAt(g++)),Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(A.charAt(g++)),E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(A.charAt(g++)),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(A.charAt(g++));C=C<<2|Q>>4,Q=(Q&15)<<4|E>>2;var o=(E&3)<<6|i;I+=String.fromCharCode(C),E!==64&&(I+=String.fromCharCode(Q)),i!==64&&(I+=String.fromCharCode(o))}while(g>>0),-9007199254740992>=A||9007199254740992<=A?-61:(B.R(g,A,i),PA=[g.position>>>0,(u=g.position,1<=+OA(u)?0>>0:~~+_A((u-+(~~u>>>0))/4294967296)>>>0:0)],e[E>>2]=PA[0],e[E+4>>2]=PA[1],g.Wa&&A===0&&i===0&&(g.Wa=null),0)}catch(o){return typeof B<"u"&&o instanceof B.u||c(o),-o.O}},k:function(A,I){L=I;try{var g=j(),C=R();A:{var Q=R();for(I=A=0;I>2],i=B.read(g,H,e[C+8*I>>2],E,void 0);if(0>i){var o=-1;break A}if(A+=i,iC?-28:B.open(g.path,g.flags,0,C).ra;case 1:case 2:return 0;case 3:return g.flags;case 4:return C=R(),g.flags|=C,0;case 12:return C=R(),SA[C+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return O(28),-1;default:return-28}}catch(Q){return typeof B<"u"&&Q instanceof B.u||c(Q),-Q.O}},j:function(A,I){L=I;try{var g=R(),C=g?z(Z,g,void 0):"",Q=R(),E=R();return B.open(C,Q,E).ra}catch(i){return typeof B<"u"&&i instanceof B.u||c(i),-i.O}},i:function(A,I){L=I;try{var g=j(),C=R();switch(C){case 21509:case 21505:return g.H?0:-59;case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:return g.H?0:-59;case 21519:if(!g.H)return-59;var Q=R();return e[Q>>2]=0;case 21520:return g.H?-28:-59;case 21531:return Q=R(),B.Za(g,C,Q);case 21523:return g.H?0:-59;case 21524:return g.H?0:-59;default:c("bad ioctl syscall "+C)}}catch(E){return typeof B<"u"&&E instanceof B.u||c(E),-E.O}},e:function(){},h:function(){},g:function(){return iI.apply(null,arguments)},o:function(){return oI.apply(null,arguments)},__memory_base:1024,__table_base:0,c:function(){return H.length},n:function(A,I,g){Z.set(Z.subarray(I,I+g),A)},b:function(){c("OOM")},m:function(A){qA(A)},a:c,memory:m,table:ZA},KA=D.asm({},nA,x);D.asm=KA,D.___errno_location=function(){return D.asm.p.apply(null,arguments)},D._main=function(){return D.asm.q.apply(null,arguments)};var PI=D._malloc=function(){return D.asm.r.apply(null,arguments)},zA=D.stackAlloc=function(){return D.asm.t.apply(null,arguments)};D.dynCall_vi=function(){return D.asm.s.apply(null,arguments)},D.asm=KA,D.FS=B,D.callMain=jA;var V;D.then=function(A){if(V)A(D);else{var I=D.onRuntimeInitialized;D.onRuntimeInitialized=function(){I&&I(),A(D)}}return D};function uA(A){this.name="ExitStatus",this.message="Program terminated with exit("+A+")",this.status=A}X=function A(){V||tA(),V||(X=A)};function jA(A){A=A||[];var I=A.length+1,g=zA(4*(I+1));e[g>>2]=rA(fA);for(var C=1;C>2)+C]=rA(A[C-1]);e[(g>>2)+I]=0;try{var Q=D._main(I,g);qA(Q,!0)}catch(E){E instanceof uA||(E=="SimulateInfiniteLoop"?p=!0:((A=E)&&typeof E=="object"&&E.stack&&(A=[E,E.stack]),r("exception thrown: "+A),$(1,E)))}finally{}}function tA(A){function I(){if(!V&&(V=!0,!gA)){if(D.noFSInit||B.ta.Ya||B.ta(),v(vA),B.Cb=!1,v(WA),D.onRuntimeInitialized&&D.onRuntimeInitialized(),TA&&jA(A),D.postRun)for(typeof D.postRun=="function"&&(D.postRun=[D.postRun]);D.postRun.length;){var g=D.postRun.shift();GA.unshift(g)}v(GA)}}if(A=A||cA,!(0import("./web-streams-ponyfill-4a0f4950.js"),[],import.meta.url)).TransformStream,h=globalThis.WritableStream||(await u(()=>import("./web-streams-ponyfill-4a0f4950.js"),[],import.meta.url)).WritableStream,s=await((t=navigator.serviceWorker)===null||t===void 0?void 0:t.getRegistration()),a=document.createElement("a"),i=new p,w=i.writable;if(a.download=this.name,E||!s){let o=[];i.readable.pipeTo(new h({write(r){o.push(new Blob([r]))},close(){const r=new Blob(o,{type:"application/octet-stream; charset=utf-8"});o=[],a.href=URL.createObjectURL(r),a.click(),setTimeout(()=>URL.revokeObjectURL(a.href),1e4)}}))}else{const{writable:o,readablePort:r}=new k(h),n=encodeURIComponent(this.name).replace(/['()]/g,escape).replace(/\*/g,"%2A"),f={"content-disposition":"attachment; filename*=UTF-8''"+n,"content-type":"application/octet-stream; charset=utf-8",...e.size?{"content-length":e.size}:{}},g=setTimeout(()=>s.active.postMessage(0),1e4);i.readable.pipeThrough(new p({transform(l,m){if(l instanceof Uint8Array)return m.enqueue(l);const R=new Response(l).body.getReader(),_=W=>R.read().then(y=>y.done?0:_(m.enqueue(y.value)));return _()}})).pipeTo(o).finally(()=>{clearInterval(g)}),s.active.postMessage({url:s.scope+n,headers:f,readablePort:r},[r]);const c=document.createElement("iframe");c.hidden=!0,c.src=s.scope+n,document.body.appendChild(c)}return w.getWriter()}async isSameEntry(e){return this===e}}const P=0,T=0,M=1,S=1,L=2;class O{constructor(e){this._readyPending=!1,this._port=e,this._resetReady(),this._port.onmessage=t=>this._onMessage(t.data)}start(e){return this._controller=e,this._readyPromise}write(e){const t={type:P,chunk:e};return this._port.postMessage(t,[e.buffer]),this._resetReady(),this._readyPromise}close(){this._port.postMessage({type:L}),this._port.close()}abort(e){this._port.postMessage({type:S,reason:e}),this._port.close()}_onMessage(e){e.type===T&&this._resolveReady(),e.type===M&&this._onError(e.reason)}_onError(e){this._controller.error(e),this._rejectReady(e),this._port.close()}_resetReady(){this._readyPromise=new Promise((e,t)=>{this._readyResolve=e,this._readyReject=t}),this._readyPending=!0}_resolveReady(){this._readyResolve(),this._readyPending=!1}_rejectReady(e){this._readyPending||this._resetReady(),this._readyPromise.catch(()=>{}),this._readyReject(e),this._readyPending=!1}}class k{constructor(e){const t=new MessageChannel;this.readablePort=t.port1,this.writable=new e(new O(t.port2))}}export{A as FileHandle}; +import{_ as u}from"./index-abdbff68.js";import{errors as b}from"./util-849946d7.js";const{GONE:v}=b,E=/constructor/i.test(window.HTMLElement)||window.safari||window.WebKitPoint;class A{constructor(e="unknown"){this.kind="file",this.writable=!0,this.name=e}async getFile(){throw new DOMException(...v)}async createWritable(e={}){var t;if(e.keepExistingData)throw new TypeError("Option keepExistingData is not implemented");const p=globalThis.TransformStream||(await u(()=>import("./web-streams-ponyfill-4a0f4950.js"),[],import.meta.url)).TransformStream,h=globalThis.WritableStream||(await u(()=>import("./web-streams-ponyfill-4a0f4950.js"),[],import.meta.url)).WritableStream,s=await((t=navigator.serviceWorker)===null||t===void 0?void 0:t.getRegistration()),a=document.createElement("a"),i=new p,w=i.writable;if(a.download=this.name,E||!s){let o=[];i.readable.pipeTo(new h({write(r){o.push(new Blob([r]))},close(){const r=new Blob(o,{type:"application/octet-stream; charset=utf-8"});o=[],a.href=URL.createObjectURL(r),a.click(),setTimeout(()=>URL.revokeObjectURL(a.href),1e4)}}))}else{const{writable:o,readablePort:r}=new k(h),n=encodeURIComponent(this.name).replace(/['()]/g,escape).replace(/\*/g,"%2A"),f={"content-disposition":"attachment; filename*=UTF-8''"+n,"content-type":"application/octet-stream; charset=utf-8",...e.size?{"content-length":e.size}:{}},g=setTimeout(()=>s.active.postMessage(0),1e4);i.readable.pipeThrough(new p({transform(l,m){if(l instanceof Uint8Array)return m.enqueue(l);const R=new Response(l).body.getReader(),_=W=>R.read().then(y=>y.done?0:_(m.enqueue(y.value)));return _()}})).pipeTo(o).finally(()=>{clearInterval(g)}),s.active.postMessage({url:s.scope+n,headers:f,readablePort:r},[r]);const c=document.createElement("iframe");c.hidden=!0,c.src=s.scope+n,document.body.appendChild(c)}return w.getWriter()}async isSameEntry(e){return this===e}}const P=0,T=0,M=1,S=1,L=2;class O{constructor(e){this._readyPending=!1,this._port=e,this._resetReady(),this._port.onmessage=t=>this._onMessage(t.data)}start(e){return this._controller=e,this._readyPromise}write(e){const t={type:P,chunk:e};return this._port.postMessage(t,[e.buffer]),this._resetReady(),this._readyPromise}close(){this._port.postMessage({type:L}),this._port.close()}abort(e){this._port.postMessage({type:S,reason:e}),this._port.close()}_onMessage(e){e.type===T&&this._resolveReady(),e.type===M&&this._onError(e.reason)}_onError(e){this._controller.error(e),this._rejectReady(e),this._port.close()}_resetReady(){this._readyPromise=new Promise((e,t)=>{this._readyResolve=e,this._readyReject=t}),this._readyPending=!0}_resolveReady(){this._readyResolve(),this._readyPending=!1}_rejectReady(e){this._readyPending||this._resetReady(),this._readyPromise.catch(()=>{}),this._readyReject(e),this._readyPending=!1}}class k{constructor(e){const t=new MessageChannel;this.readablePort=t.port1,this.writable=new e(new O(t.port2))}}export{A as FileHandle}; diff --git a/beta/assets/index-cf2356c2.css b/beta/assets/index-3936f743.css similarity index 88% rename from beta/assets/index-cf2356c2.css rename to beta/assets/index-3936f743.css index 3287e827..a6e9a51f 100644 --- a/beta/assets/index-cf2356c2.css +++ b/beta/assets/index-3936f743.css @@ -1 +1 @@ -*{box-sizing:border-box;font-family:Assistant;margin:0;padding:0;line-height:1.15em;color:var(--text-color)}body{--accent-color: rgb(16, 98, 156);--text-color: white;--text-color-secondary: #ddd;--text-color-tertiary: #888;--text-color-detail: #757a89;--text-color-disabled: #888;--bg-primary: #555;--bg-primary-border: #444;--bg-primary-active: #555;--bg-primary-hover: #666;--bg-window: #3d3d3d;--bg-secondary: #373737;--bg-secondary-border: #333;--bg-secondary-active: #555;--bg-secondary-hover: #454545;--bg-tertiary: #333;--bg-tertiary-border: #2c2c2c;--bg-tertiary-active: #444;--bg-tertiary-hover: #353535;--bg-editable-overlay: rgb(255, 255, 255, .2);--bg-editable-overlay-active: rgb(255, 255, 255, .1);--bg-input: rgba(35, 35, 35, .309);--bg-widget: rgba(0, 0, 0, .5);--danger: rgb(172, 54, 54)}body{overflow:hidden;overscroll-behavior-x:none;overscroll-behavior-y:none;background-color:#18191c;height:100%;width:100%}html{height:100%;width:100%}.browser-unsupported{align-items:center;display:flex;flex-direction:row;height:100%;width:100%}.browser-unsupported-item{text-align:center;width:100%}.browser-unsupported-detail{font-size:12px;color:var(--text-color-detail)}#view-wrapper{display:flex;flex-direction:column;height:100%;width:100%;caret-color:transparent}.window{border-radius:5px;position:fixed;box-shadow:0 0 5px #0009}.navbar{align-items:center;background:var(--bg-window);border-bottom:.5px solid #2f2f2f;border-top-left-radius:5px;border-top-right-radius:5px;display:flex;flex-direction:row;font-size:15px;width:100%}.window:not(.focused)>.navbar{background:rgb(98,98,98);border-bottom:none}.navbar *{margin:3px}.title:empty{margin:0}.navbar .title{color:var(--text-color);flex:1 1 auto;overflow:hidden;padding-left:5px;text-overflow:ellipsis;white-space:nowrap}.navbar img{flex:0 0 auto;height:15px;width:15px;cursor:pointer}.animated .navbar img{transition:.1s cubic-bezier(.39,.575,.565,1)}.navbar img:hover{filter:invert(.35)}button{background:rgb(83,82,82);border:.5px solid rgb(35,34,34);border-radius:5px;padding:4px 7px;display:flex;align-items:center;justify-content:center;transform:translateY(-.5px);box-shadow:0 .5px #000000e6,0 3px 5px -3px #0009;cursor:pointer;column-gap:5px}.animated button{transition:.2s cubic-bezier(.175,.885,.32,1.875)}.animated button:hover:enabled{transform:translateY(-1.5px);box-shadow:0 1.5px #000000e6,0 3px 5px -2px #0009}.animated button:active:enabled{transform:translateY(.2px);box-shadow:none}button:hover:enabled{filter:brightness(1.3)}button:active:enabled{filter:brightness(.8)}button.confirm{background:rgb(36,109,161)}button.delete{background:var(--danger)}button:disabled{filter:brightness(.8);transform:none;box-shadow:none;cursor:not-allowed}.view{background-color:var(--bg-window);font-size:15px;overflow:hidden}.animated .view{transition:.3s cubic-bezier(.445,.05,.55,.95)}.window.focused .view{box-shadow:inset 0 2px 3px -1px #0000001a}.view .padding{display:flex;flex-direction:column;padding:20px;height:100%}.open-container{display:grid;grid-template-rows:2fr auto 5fr;height:100%}.open-container .top-container{display:grid;grid-template-columns:1fr 1fr;gap:20px}.open-container .bottom-container{display:flex;flex-direction:column;gap:5px;overflow:hidden}.open-container .title{font-size:17px;text-transform:uppercase}.open-container .container{align-items:center;display:flex;flex-direction:row}.container+.title{border-top:solid 1px #555;margin-top:10px;padding-top:10px}.window.exiting{filter:blur(20px);opacity:0}.animated .exiting{transition:.06s cubic-bezier(.6,.04,.98,.335)}.unselectable{-moz-user-select:none;-webkit-user-drag:none;-webkit-user-select:none;user-select:none}.folder>.children{margin-left:20px}.folder.collapsed>.children{display:none}.item .info{align-items:center;display:flex;flex-direction:row}.item .info .title{background:none;border:none;border-radius:5px;flex:1 1 auto;outline:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:1px 5px}.folder.collapsed>.info>.folder-icon{transform:rotate(-90deg)}.pref-label.collapsed>.folder-icon{transform:rotate(-90deg)}.animated .folder-icon{transition:.2s cubic-bezier(.39,.575,.565,1)}img.icon{filter:invert();height:15px}.dir-selector{background-color:var(--bg-secondary);border-radius:5px 5px 0 0;flex:1;height:100%;overflow:auto;padding:5px}.file-options{display:flex;flex-direction:row;column-gap:5px;background-color:var(--bg-tertiary);margin-bottom:5px;padding:4px;border-radius:0 0 5px 5px}.info.disabled>.title{color:var(--text-color-disabled)}.info.disabled>.icon{opacity:.3}.info.selected,.info.selected:hover{background-color:var(--bg-secondary-active)}.info:hover{background-color:var(--bg-secondary-hover)}.options-icon{display:none}.info:hover>.options-icon{display:block;opacity:.3}.info.selected>.options-icon{display:block;opacity:.3}textarea{-moz-user-select:none;-webkit-user-select:none;resize:none;user-select:none}.dir-selector:empty:before{color:var(--text-color-disabled);content:"No files! Add a file by dragging a folder/file or using the buttons below.";height:100%;display:flex;justify-content:center;align-items:center}.recent-selector{background-color:var(--bg-secondary);border-radius:5px 5px 0 0;flex:1;height:100%;overflow:auto;overflow-x:hidden;padding:5px;width:360px}.recent-selector:empty:before{color:var(--text-color-disabled);content:"No recent files";height:100%;display:flex;justify-content:center;align-items:center}.recent-item{align-items:center;display:flex;flex-direction:row;padding:1px 5px;text-overflow:ellipsis;white-space:nowrap;gap:8px;font-size:14px}.recent-item.selected,.recent-item.selected:hover{background-color:var(--bg-secondary-active)}.recent-item:hover{background-color:var(--bg-secondary-hover)}.recent-item .recent-path{font-style:italic;color:var(--text-color-tertiary);text-overflow:ellipsis;overflow:hidden}.recent-item .recent-name{text-overflow:ellipsis;overflow:hidden;flex:0 0 auto}.menu-options{display:flex;margin-top:5px;flex:0;justify-content:space-between}.menu-left{display:flex;width:50%}.menu-right{display:flex;flex-direction:row-reverse;width:50%}.outlined{box-shadow:inset 0 0 3px 2px #10629ccc}.outlined>.info{box-shadow:inset 0 0 3px 2px #10629ccc}#menubar{display:flex;background-color:var(--bg-primary)}.menu-item>.menu-item-title{padding:4px 0;display:flex;align-items:center}#menubar>.menu-item>.title{padding:4px 10px}#menubar .menubar-dropdown{display:none;background-color:var(--bg-primary);border:1px solid var(--bg-primary-border);position:absolute;border-radius:5px}#menubar .menu-item:not(.disabled):hover>.menubar-dropdown,#menubar .menubar-dropdown:not(.disabled):hover{display:block}.menu-item-title .title{flex:1;margin-left:10px;margin-right:15px;white-space:nowrap}.menu-item-title .keybind,.menu-item-title .icon{margin-right:10px;color:var(--text-color-tertiary);white-space:nowrap}.menu-item.disabled .menu-item-title .title{color:var(--text-color-disabled)}.menu-item.checked>.menu-item-title .title{font-weight:800}.menu-item:not(.disabled)>.menu-hover:hover{background-color:var(--bg-primary-hover)}.animated .menu-hover{transition:.1s cubic-bezier(.215,.61,.355,1)}.seperator{border:.2px solid #333;margin:4px;height:1px}.check-icon{position:relative;right:16px}.chart-view-scroller{display:grid;grid-template-columns:4fr 6fr;gap:4px;width:100%;height:100%;overflow:auto}.chart-list{height:100%;background-color:var(--bg-secondary);border-radius:5px;overflow:scroll}.chart-info{height:100%;background-color:var(--bg-secondary);border-radius:5px;word-break:break-all;padding:15px;overflow:scroll}.chart-info .label{padding:2px 0}.chart-info:empty:before{color:var(--text-color-disabled);height:100%;display:flex;justify-content:center;align-items:center;content:"Select a chart for more details"}.chart-list-item{display:flex;align-items:center;border:.2px solid var(--bg-secondary-border);cursor:pointer}.animated .chart-list-item{transition:.1s cubic-bezier(.215,.61,.355,1)}.chart-list-item.selected,.chart-list-item:active{background-color:var(--bg-secondary-active)}.chart-list-item:not(.selected):hover{background-color:var(--bg-secondary-hover)}.chart-list-item .Beginner{background-color:#3b6c80}.chart-list-item .Easy{background-color:#308655}.chart-list-item .Medium{background-color:#a08f45}.chart-list-item .Hard{background-color:#8e2921}.chart-list-item .Challenge{background-color:#8b1b9e}.chart-list-item .Edit{background-color:#757575}.chart-list-item>.title{padding:4px;text-align:center;align-content:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;min-width:25px}.chart-list-item.extended .chart-list-info{margin:0;opacity:0}.chart-list-info{opacity:1;display:flex;width:100%;align-items:center;margin:0 5px;place-content:space-between;min-width:0px;column-gap:5px;flex:1}.animated .chart-list-info{transition:.2s cubic-bezier(.215,.61,.355,1)}.chart-attributes{display:flex;padding:2px 2px 2px 0}.chart-properties{display:grid;grid-template-columns:100px minmax(0,1fr);align-items:center;flex:1;row-gap:2px;margin-bottom:12px}.chart-properties ul .label{font-weight:700}.chart-properties ul>*:last-child{flex:1}div.inlineEdit[contenteditable=true]{min-width:8px;text-align:right;border-radius:3px;padding:0 3px;border:1px solid transparent;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-overflow-style:none;scrollbar-width:none;caret-color:auto;cursor:text}div.inlineEdit{cursor:default}.animated div.inlineEdit{transition:.2s cubic-bezier(.39,.575,.565,1)}div.inlineEdit[contenteditable=true]:hover{background:var(--bg-editable-overlay)}div.inlineEdit[contenteditable=true]:focus{background:var(--bg-editable-overlay-active);outline:none;overflow:auto;text-overflow:clip}::-webkit-scrollbar{display:none}.chart-credit,.chart-difficulty,.chart-info-grid-label{flex:1;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;padding:1px 0}.chart-step-count{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.chart-info-main{display:flex;font-size:18px;margin-bottom:5px;align-items:center;place-content:space-between}.chart-info-grid-item{display:flex}.chart-info-grid{display:grid;grid-template-columns:1fr 1fr;row-gap:2px;column-gap:15px;margin-top:5px}.timing-data>.padding{display:grid;row-gap:3px;grid-template-columns:auto 170px;align-items:center}.timing-data>.padding>div:not(.label){display:flex;align-items:center;height:100%}.sm-properties .padding{display:flex;flex-direction:column}.sm-properties .property-grid{display:grid;row-gap:3px;grid-template-columns:auto 250px;align-items:center;flex:1}.sm-properties .property-grid>div:not(.label){display:flex;align-items:center}input[type=text],input[type=number]{background:var(--bg-input);border:1px solid rgba(0,0,0,.3);border-radius:3px;padding:0 3px;flex:1;height:100%;user-select:text;caret-color:auto}input:disabled{color:var(--text-color-disabled);pointer-events:none}input:focus{outline:1px solid var(--accent-color)}input.short{width:40px}input.right{text-align:right}.chart-view-type-wrapper{display:flex;flex-direction:row;align-items:center;column-gap:10px;margin-bottom:10px}.dropdown{height:100%;position:relative}.dropdown.no-border .dropdown-selected{border:none;padding:1px}.dropdown.no-border .dropdown-selected:not(:hover):after{opacity:0}.dropdown-selected{border:1px solid rgba(0,0,0,.3);border-radius:3px;width:100%;height:100%;padding:1px 7px;margin-right:3px;display:flex;align-items:center;white-space:nowrap;cursor:pointer}.animated .dropdown-selected{transition:.1s cubic-bezier(.215,.61,.355,1)}.dropdown-selected.disabled{color:var(--text-color-disabled);pointer-events:none;cursor:not-allowed}.dropdown-selected:empty{display:none}.dropdown.white .dropdown-selected:after{filter:invert()}.dropdown-selected:after{content:"";background:right center no-repeat;background-size:contain;width:12px;height:12px;flex:1;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRIie2PMQqAMAxFXwfP6qJVPIjYzcOKdUkhQ0BaCoLkLS3k818CjuN8ztApYzIDl7xvmalFsAIZuIFozKPMMrC0CAJwKIkuGVX5KdkmLEm3ci1JSlLKU49yLSmXVG1es0EANvnvInKcP/AA784fpjlWwNQAAAAASUVORK5CYII=)}.dropdown-selected:hover:not(.disabled):not(:active){background:var(--bg-editable-overlay)}.dropdown-selected:active{background:var(--bg-editable-overlay)}.dropdown-items{position:absolute;background:#555;max-height:200px;overflow:auto;z-index:5;border-radius:5px;height:0px;box-shadow:0 3px 15px #0009;cursor:pointer;top:100%}.dropdown-right>.dropdown-items{right:0}.animated .dropdown-items{transition:height .07s cubic-bezier(.215,.61,.355,1)}.dropdown-item{padding:3px 7px;white-space:nowrap}.animated .dropdown-item{opacity:0;transform:translateY(-10px);animation:.2s dropdown-enter cubic-bezier(.175,.885,.32,1.575) forwards;transition:height .07s cubic-bezier(.215,.61,.355,1)}.dropdown-item:hover{background:#666}.dropdown-item:active{background:#5c5c5c}@keyframes dropdown-enter{0%{transform:translateY(-10px);opacity:0}to{opacity:1;transform:none}}.pref-selector{background-color:var(--bg-secondary);border-radius:0 0 5px 5px/0px 0px 5px 5px;flex:1;height:100%;overflow:auto;padding:5px;font-size:15px}.pref-label{display:flex;flex-direction:row;align-items:center;margin-right:5px;padding:1px 0}.pref-label:hover{background-color:var(--bg-secondary-active)}.flex-row{display:flex;flex-direction:row;align-items:center;justify-content:space-between;height:100%;width:100%}.flex-column-gap{column-gap:5px}.flex-row-gap{row-gap:5px}.flex-grow{flex:1}.flex-static{flex:0}#blocker{width:100%;height:100%;background-color:#00000080;position:absolute;top:0;z-index:10000;caret-color:transparent}.spinner{display:flex;flex-direction:row;height:100%;flex:1}.spinner-input[type=text]{border-top-right-radius:0;border-bottom-right-radius:0;width:100%;height:100%;min-width:0;flex:1}.spinner-input:disabled+.spinner-btns{pointer-events:none}.spinner-btns{display:grid;grid-template-rows:1fr 1fr;border:1px solid #272727;border-left:none;border-top-right-radius:3px;border-bottom-right-radius:3px;flex:0;height:100%;min-height:20px}.spinner-btns button{padding:0 2px;flex:1;border-radius:0;height:100%;width:10px;border:none;min-width:auto}.spinner-btns button:after{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRIie2PMQqAMAxFXwfP6qJVPIjYzcOKdUkhQ0BaCoLkLS3k818CjuN8ztApYzIDl7xvmalFsAIZuIFozKPMMrC0CAJwKIkuGVX5KdkmLEm3ci1JSlLKU49yLSmXVG1es0EANvnvInKcP/AA784fpjlWwNQAAAAASUVORK5CYII=) no-repeat;background-position:center center;background-size:contain;position:absolute;width:10px;height:10px;content:""}.spinner-btns .spinner-up:after{transform:rotate(180deg)}.spinner-up{background:linear-gradient(0deg,#484848,#444)}.spinner-down{background:linear-gradient(180deg,#484848,#555)}#popups{position:absolute;top:35px}#waterfall{position:absolute;top:35px;display:flex;flex-direction:column;text-align:right;padding:0 10px;width:100%;pointer-events:none;user-select:none;caret-color:transparent}.waterfall-item{pointer-events:none}.animated .waterfall-item{transition:cubic-bezier(.455,.03,.515,.955) .5s;animation:waterfall-enter .3s cubic-bezier(.455,.03,.515,.955)}.waterfall-warn{color:#f6ca39;display:inline-block;margin-right:4px}.waterfall-error{color:#b72323;display:inline-block;margin-right:4px}@keyframes waterfall-enter{0%{opacity:0;transform:translate(200px,10px)}to{opacity:1;transform:none}}.waterfall-exiting{opacity:0;transform:translate(200px)}.confirmation .padding .label{flex:1;text-align:center}.confirmation button{min-width:55px}input[type=range]{width:100px;margin-right:10px}.hide-buttons button{display:none}.hide-buttons:hover button,.hide-buttons div:focus+button{display:flex}#status-widget{position:absolute;bottom:30px;display:flex;flex-direction:column;left:50%;transform:translate(-50%);border-radius:5px;align-items:center;height:96px;overflow:hidden;user-select:none}#status-widget.collapsed{height:48px}.playback-bar,.edit-bar{display:flex;flex-direction:row;height:48px;align-items:center;border-radius:5px;justify-content:flex-start;width:100%}.playback-bar{background-color:var(--bg-widget)}#status-widget:not(.collapsed) .playback-bar{border-bottom:1px rgba(55,55,55,.2) solid;border-radius:0}.animated #status-widget{transition:.3s cubic-bezier(.11,.72,.51,1.14)}#status-widget button{background:none;box-shadow:none;transform:none;border:none;width:48px;height:48px;outline:none}#status-widget button img{height:100%}#status-widget button:hover{filter:brightness(.6)}#status-widget button:active{filter:brightness(.4)}#status-widget button:disabled{filter:brightness(.2) saturate(.4)}.animated #status-widget button{transition:.2s cubic-bezier(.39,.575,.565,1)}#status-widget .playback-seperator{padding:0 2px;height:48px;display:flex;align-items:center}#status-widget .playback-seperator:after{border:.5px rgba(134,134,134,.5) solid;height:30px;content:" "}#status-widget .playback-counter{display:flex;flex-direction:column;align-items:center;width:100px;margin:0 4px}#status-widget .playback-counter .playback-counter-label{font-size:10px;color:var(--text-color-tertiary)}#status-widget .playback-counter .playback-counter-label:after{filter:invert() brightness(.4)}#status-widget .playback-counter .playback-counter-main{font-size:18px;line-height:18px;max-width:100px;align-items:baseline}#status-widget .playback-counter .playback-counter-main,#status-widget .playback-counter .playback-counter-main *{padding:0;border:none;text-overflow:clip;overflow:hidden}#status-widget .dropdown-selected{border:none}#status-widget .edit-fancy-button{font-size:9px;padding:0 4px;width:56px;height:48px;display:flex;flex-direction:column;align-content:center}#status-widget .edit-fancy-button img{height:23px}.note-placeholder{border-radius:5px}.edit-choice-container{display:flex;flex-direction:column;height:96px;position:relative;top:0;align-self:flex-start;width:100%;overflow:hidden}.edit-steps-container,.edit-timing-container{display:flex;flex-direction:row;align-items:center;height:48px;width:100%}.animated .edit-choice-container,.animated .edit-steps-container,.animated .edit-timing-container{transition:.2s cubic-bezier(.39,.575,.565,1)}.edit-timing-container{background-color:var(--bg-widget);height:48px}#status-widget .edit-bar .edit-bar-left{background-color:var(--bg-widget);display:flex;flex-direction:row}.note-placeholder-right{flex:1;background-color:var(--bg-widget);height:48px}.popup{user-select:none;position:absolute;transform:translate(-50%)}.popup-zoomer{transform-origin:top middle;display:flex;flex-direction:column;background-color:var(--bg-window);border-radius:5px;padding:8px;align-items:center;border:1px solid black;animation:1ms popup-enter cubic-bezier(.47,.02,0,.95) forwards;box-shadow:0 0 5px #0009}.popup-zoomer.selected{filter:saturate(1.2) brightness(1.4);border:1px solid rgb(14,83,104)}.popup.exiting .popup-zoomer{animation:.01s popup-exit cubic-bezier(.47,.02,0,.95) forwards;pointer-events:none}.animated .popup-zoomer{animation:.1s popup-enter cubic-bezier(.47,.02,0,.95) forwards;transition:.2s cubic-bezier(.47,.02,0,.95)}.animated .popup.exiting .popup-zoomer{animation:.1s popup-exit cubic-bezier(.47,.02,0,.95) forwards;pointer-events:none}.popup-row{display:flex;flex-direction:row;gap:5px;color:var(--text-color-secondary);white-space:nowrap;font-size:14px;align-items:center}.popup-flex{display:flex;flex-direction:column;gap:4px;margin-top:4px}@keyframes popup-enter{0%{transform:scale(.8);opacity:0}to{transform:scale(1);opacity:1}}@keyframes popup-exit{0%{transform:scale(1);opacity:1}to{transform:scale(.8);opacity:0}}.popup .popup-desc{font-size:10px;font-style:italic;text-align:center;color:var(--text-color-detail)}.animated .popup-desc{transition:.2s cubic-bezier(.47,.02,0,.95)}.popup .popup-title{text-align:center}.popup .popup-label{color:var(--text-color-secondary);white-space:nowrap;font-size:14px}.popup .popup-grid input[type=text]{min-width:0;text-align:right}.popup .popup-grid input[type=checkbox]{min-width:0;justify-self:end}.popup .popup-grid{margin-top:4px;display:grid;grid-template-columns:auto auto;column-gap:15px;row-gap:4px;width:100%;justify-content:end;align-items:center}.animated .popup-options{transition:.2s cubic-bezier(.47,.02,0,.95)}.popup-options{margin-top:0;width:100%;justify-content:space-around;transform:scale(0);height:0px;display:flex}.popup-options button{min-width:40px}.popup-zoomer.selected .popup-options{margin-top:5px;transform:scale(1);height:24.5px;filter:saturate(.8) brightness(.7)}.draggable-track{writing-mode:vertical-rl;text-align:center;padding:20px 4px;height:200px;display:flex;align-items:center;justify-content:space-around;box-shadow:0 .5px #000000e6,0 3px 5px -3px #0009;cursor:grab}.draggable-track.left .draggable-track-text{transform:rotate(180deg)}.draggable-track img{position:absolute;display:none}.draggable-track:hover img{display:block;bottom:10px;backface-visibility:hidden;filter:invert() brightness(.5);cursor:pointer}.draggable-track:hover img:hover{filter:invert() brightness(.5) sepia() hue-rotate(-50deg) saturate(6)}.draggable-track:hover{filter:brightness(1.3) saturate(2.5);transform:translateY(-1.5px);box-shadow:0 1.5px #000000e6,0 3px 5px -2px #0009}.draggable-track:active{cursor:grabbing;filter:brightness(1.1) saturate(2.5);transform:none;box-shadow:0 0 #000000e6,0 3px 5px -2px #0009}@keyframes draggable-exit{0%{width:26px}to{width:0px;padding:0;opacity:0}}@keyframes draggable-enter{0%{opacity:0;width:0px;padding:0}to{opacity:1;width:26px}}.draggable-track.entering,.draggable-option.entering{animation:draggable-enter 0s cubic-bezier(0,.91,.34,1.05) forwards}.draggable-track.exiting,.draggable-option.exiting{animation:draggable-exit 0s cubic-bezier(0,.91,.34,1.05) forwards}.animated .draggable-track.entering,.animated .draggable-option.entering{animation:draggable-enter .4s cubic-bezier(0,.91,.34,1.05) forwards}.animated .draggable-track.exiting,.animated .draggable-option.exiting{animation:draggable-exit .4s cubic-bezier(0,.91,.34,1.05) forwards}@keyframes leftover-enter{0%{opacity:0;transform:scale(0);padding:0}to{opacity:1;transform:scale(1)}}.leftover-track.entering,.leftover-option.entering{animation:leftover-enter 0s cubic-bezier(0,.91,.34,1.05) forwards}.animated .leftover-track.entering,.animated .leftover-option.entering{animation:leftover-enter .4s cubic-bezier(0,.91,.34,1.05) forwards}#timing-track-order .title{text-align:center;padding:6px}.track-grid{display:flex;flex-direction:row;background-color:var(--bg-secondary);padding:4px;border-radius:3px;width:468.08px;justify-content:center}.track-grid-options{display:flex;flex-direction:row;column-gap:8px;padding:4px 0}.track-selector{flex:1;height:30px;display:flex;flex-direction:row;background-color:var(--bg-tertiary);padding:4px;border-radius:3px;gap:4px;overflow-x:auto}.leftover-track{display:flex;justify-content:center;align-items:center;border-radius:3px;padding:4px;gap:3px;box-shadow:0 .5px #000000e6,0 3px 5px -3px #0009;font-size:13px;cursor:grab}.leftover-track img{filter:invert();vertical-align:baseline;width:10px}.leftover-track:hover{filter:brightness(1.3) saturate(2.5);transform:translateY(-1.5px);box-shadow:0 1.5px #000000e6,0 3px 5px -2px #0009}.leftover-track:active{filter:brightness(1.1) saturate(2.5);transform:none;box-shadow:0 0 #000000e6,0 3px 5px -2px #0009;cursor:grabbing}.animated .draggable-track,.animated .draggable-track img,.animated .leftover-track,.animated .track-selector,.animated .draggable-option,.animated .draggable-option img,.animated .leftover-option{transition:.2s cubic-bezier(0,.91,.34,1.05)}.sm-title{font-weight:700;margin-bottom:3px}.sm-container{margin-bottom:15px}#context-menu{display:flex;position:absolute;flex-direction:column;background-color:var(--bg-primary);border:1px solid var(--bg-primary-border);caret-color:transparent;font-size:15px;border-radius:5px;transform-origin:top left;opacity:.95}.animated #context-menu.entering{animation:context-enter .15s cubic-bezier(.13,.61,.07,.98)}#context-menu.exiting{transform:scale(.8);opacity:0}.animated #context-menu.exiting{transition:.1s cubic-bezier(.15,.73,.62,.75)}@keyframes context-enter{0%{opacity:0;transform:scale(.8)}to{opacity:.95;transform:scale(1)}}.menu-item{position:relative;z-index:9999}.menu-item>.menu-item-title{padding:3px 0;display:flex;align-items:center}.menu-item:first-child>.menu-item-title{border-top-left-radius:5px;border-top-right-radius:5px}.menu-item:last-child>.menu-item-title{border-bottom-left-radius:5px;border-bottom-right-radius:5px}#context-menu .menubar-dropdown{background-color:var(--bg-primary);border:1px solid var(--bg-primary-border);position:absolute;left:100%;top:0;border-radius:5px;transform-origin:left;transform:scale(0);opacity:0}@keyframes context-dropdown-enter{0%{transform:scale(.8)}to{transform:scale(1)}}@keyframes context-dropdown-exit{0%{transform:scale(1)}to{transform:scale(.8)}}#context-menu .menu-item:not(.disabled):hover>.menubar-dropdown,#context-menu .menubar-dropdown:not(.disabled):hover{opacity:.95;transform:scale(1)}.animated #context-menu .menu-item:not(.disabled):hover>.menubar-dropdown,.animated #context-menu .menubar-dropdown:not(.disabled):hover{animation:context-dropdown-enter .08s cubic-bezier(.215,.61,.355,1) forwards}.animated #context-menu .menubar-dropdown{animation:context-dropdown-exit .08s cubic-bezier(.215,.61,.355,1);transition:.08s cubic-bezier(.215,.61,.355,1)}.menu-item .menubar-dropdown .menubar-dropdown{left:100%;top:0}.pref-container{display:flex;flex-direction:column;gap:10px;height:100%}.pref-search{display:flex;flex-direction:row;gap:10px}.pref-scrollers{display:flex;gap:20px;flex:1;min-height:0}.pref-section-scroller,.pref-option-scroller{background-color:var(--bg-secondary);overflow:auto;padding:5px;border-radius:5px}.animated .pref-option-scroller{scroll-behavior:smooth}.pref-section{padding:3px 5px;border-radius:2px;cursor:pointer}.pref-section-scroller{width:150px}.pref-option-scroller:empty:before{color:var(--text-color-disabled);content:"No keybinds matched the search term.";height:100%;display:flex;justify-content:center;align-items:center}.animated .pref-section,.animated .pref-keybind-combo,.animated .pref-keybind,.animated .pref-item,.animated .pref-item-tooltip{transition:.1s cubic-bezier(.445,.05,.55,.95)}.pref-section.selected,.pref-section.selected:hover{background-color:var(--bg-secondary-active)}.pref-section:hover,.pref-keybind:hover,.pref-item:hover{background-color:var(--bg-secondary-hover)}.pref-option-scroller{display:flex;flex-direction:column;gap:20px;flex:1;padding:3px 5px}.pref-keybind{padding:3px 5px;border-radius:2px;display:flex;flex-direction:row;align-items:center;width:100%;cursor:pointer}.pref-item{padding:3px 5px;border-radius:2px;display:flex;flex-direction:row;align-items:center;width:100%}.pref-item-input{margin-left:auto;max-width:160px;display:flex}.pref-item>.spinner{max-width:50px}.pref-item .spinner-input{text-align:right}.pref-keybind img,.pref-item>img{margin-left:5px;display:block;bottom:10px;backface-visibility:hidden;filter:invert() brightness(.5);cursor:pointer}.pref-keybind img:hover{filter:invert() brightness(.5) sepia() hue-rotate(-50deg) saturate(6)}.pref-keybind-label{padding:2px 0}.pref-label{padding:10px 0}.pref-keybind-combos{display:flex;flex-direction:row;align-items:center;gap:3px;margin-left:auto}.pref-keybind-combo{background-color:#0003;padding:2px 5px;font-size:13px}.pref-keybind-combo.conflict{background:rgb(187,93,31)}.pref-keybind-combo:hover{background-color:var(--danger)}.pref-group-label{font-size:18px;margin-bottom:6px}.pref-subgroup-label{font-weight:700;margin-bottom:6px}.pref-group{padding:3px 5px}.pref-children .pref-group-label{font-size:17px}.pref-search .dropdown{width:70px}.pref-group-label+.pref-children{margin-left:15px}.pref-children{display:flex;flex-direction:column;gap:5px}.pref-subgroup{margin:8px 0}.detail{font-size:12px;font-style:italic;text-align:center;color:var(--text-color-detail)}.tippy-box[data-theme~=sm]{background-color:#1e1e1e;color:#fff}.tippy-box[data-theme~=sm][data-placement^=top]>.tippy-arrow:before{border-top-color:#1e1e1e}.tippy-box[data-theme~=sm][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#1e1e1e}.tippy-box[data-theme~=sm][data-placement^=left]>.tippy-arrow:before{border-left-color:#1e1e1e}.tippy-box[data-theme~=sm][data-placement^=right]>.tippy-arrow:before{border-right-color:#1e1e1e}.export-container{display:flex;flex-direction:row;gap:15px;height:100%;overflow:hidden}.export-section-label{font-weight:700;margin-bottom:6px;margin-top:6px}.export-option{display:flex;flex-direction:row;gap:5px;align-items:center;padding:3px 5px}.export-output{flex:1;border-radius:5px;background-color:var(--bg-secondary);padding:5px;white-space:pre-wrap;word-break:break-all;font-family:monospace;font-size:12px;overflow:auto;tab-size:2}.export-output:hover{background-color:var(--bg-secondary-hover)}.animated .export-output{transition:.1s cubic-bezier(.39,.575,.565,1)}.logo{text-align:center;font-size:26px}.tippy-box[data-animation=scale-subtle][data-placement^=top]{transform-origin:bottom}.tippy-box[data-animation=scale-subtle][data-placement^=bottom]{transform-origin:top}.tippy-box[data-animation=scale-subtle][data-placement^=left]{transform-origin:right}.tippy-box[data-animation=scale-subtle][data-placement^=right]{transform-origin:left}.tippy-box[data-animation=scale-subtle][data-state=hidden]{transform:scale(.8);opacity:0}.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1} +*{box-sizing:border-box;font-family:Assistant;margin:0;padding:0;line-height:1.15em;color:var(--text-color)}body{--accent-color: rgb(16, 98, 156);--text-color: white;--text-color-secondary: #ddd;--text-color-tertiary: #888;--text-color-detail: #757a89;--text-color-disabled: #888;--bg-primary: #555;--bg-primary-border: #444;--bg-primary-active: #555;--bg-primary-hover: #666;--bg-window: #3d3d3d;--bg-secondary: #373737;--bg-secondary-border: #333;--bg-secondary-active: #555;--bg-secondary-hover: #454545;--bg-tertiary: #333;--bg-tertiary-border: #2c2c2c;--bg-tertiary-active: #444;--bg-tertiary-hover: #353535;--bg-editable-overlay: rgb(255, 255, 255, .2);--bg-editable-overlay-active: rgb(255, 255, 255, .1);--bg-input: rgba(35, 35, 35, .309);--bg-widget: rgba(0, 0, 0, .5);--danger: rgb(172, 54, 54)}body{overflow:hidden;overscroll-behavior-x:none;overscroll-behavior-y:none;background-color:#18191c;height:100%;width:100%}html{height:100%;width:100%}.browser-unsupported{align-items:center;display:flex;flex-direction:row;height:100%;width:100%}.browser-unsupported-item{text-align:center;width:100%}.browser-unsupported-detail{font-size:12px;color:var(--text-color-detail)}#view-wrapper{display:flex;flex-direction:column;height:100%;width:100%;caret-color:transparent}.window{border-radius:5px;position:fixed;box-shadow:0 0 5px #0009}.navbar{align-items:center;background:var(--bg-window);border-bottom:.5px solid #2f2f2f;border-top-left-radius:5px;border-top-right-radius:5px;display:flex;flex-direction:row;font-size:15px;width:100%}.window:not(.focused)>.navbar{background:rgb(98,98,98);border-bottom:none}.navbar *{margin:3px}.title:empty{margin:0}.navbar .title{color:var(--text-color);flex:1 1 auto;overflow:hidden;padding-left:5px;text-overflow:ellipsis;white-space:nowrap}.navbar img{flex:0 0 auto;height:15px;width:15px;cursor:pointer}.animated .navbar img{transition:.1s cubic-bezier(.39,.575,.565,1)}.navbar img:hover{filter:invert(.35)}button{background:rgb(83,82,82);border:.5px solid rgb(35,34,34);border-radius:5px;padding:4px 7px;display:flex;align-items:center;justify-content:center;transform:translateY(-.5px);box-shadow:0 .5px #000000e6,0 3px 5px -3px #0009;cursor:pointer;column-gap:5px}.animated button{transition:.2s cubic-bezier(.175,.885,.32,1.875)}.animated button:hover:enabled{transform:translateY(-1.5px);box-shadow:0 1.5px #000000e6,0 3px 5px -2px #0009}.animated button:active:enabled{transform:translateY(.2px);box-shadow:none}button:hover:enabled{filter:brightness(1.3)}button:active:enabled{filter:brightness(.8)}button.confirm{background:rgb(36,109,161)}button.delete{background:var(--danger)}button:disabled{filter:brightness(.8);transform:none;box-shadow:none;cursor:not-allowed}.view{background-color:var(--bg-window);font-size:15px;overflow:hidden}.animated .view{transition:.3s cubic-bezier(.445,.05,.55,.95)}.window.focused .view{box-shadow:inset 0 2px 3px -1px #0000001a}.view .padding{display:flex;flex-direction:column;padding:20px;height:100%}.open-container{display:grid;grid-template-rows:2fr auto 5fr;height:100%}.open-container .top-container{display:grid;grid-template-columns:1fr 1fr;gap:20px}.open-container .bottom-container{display:flex;flex-direction:column;gap:5px;overflow:hidden}.open-container .title{font-size:17px;text-transform:uppercase}.open-container .container{align-items:center;display:flex;flex-direction:row}.container+.title{border-top:solid 1px #555;margin-top:10px;padding-top:10px}.window.exiting{filter:blur(20px);opacity:0}.animated .exiting{transition:.06s cubic-bezier(.6,.04,.98,.335)}.unselectable{-moz-user-select:none;-webkit-user-drag:none;-webkit-user-select:none;user-select:none}.folder>.children{margin-left:20px}.folder.collapsed>.children{display:none}.item .info{align-items:center;display:flex;flex-direction:row}.item .info .title{background:none;border:none;border-radius:5px;flex:1 1 auto;outline:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:1px 5px}.folder.collapsed>.info>.folder-icon{transform:rotate(-90deg)}.pref-label.collapsed>.folder-icon{transform:rotate(-90deg)}.animated .folder-icon{transition:.2s cubic-bezier(.39,.575,.565,1)}img.icon{filter:invert();height:15px}.dir-selector{background-color:var(--bg-secondary);border-radius:5px 5px 0 0;flex:1;height:100%;overflow:auto;padding:5px}.file-options{display:flex;flex-direction:row;column-gap:5px;background-color:var(--bg-tertiary);margin-bottom:5px;padding:4px;border-radius:0 0 5px 5px}.info.disabled>.title{color:var(--text-color-disabled)}.info.disabled>.icon{opacity:.3}.info.selected,.info.selected:hover{background-color:var(--bg-secondary-active)}.info:hover{background-color:var(--bg-secondary-hover)}.options-icon{display:none}.info:hover>.options-icon{display:block;opacity:.3}.info.selected>.options-icon{display:block;opacity:.3}textarea{-moz-user-select:none;-webkit-user-select:none;resize:none;user-select:none}.dir-selector:empty:before{color:var(--text-color-disabled);content:"No files! Add a file by dragging a folder/file or using the buttons below.";height:100%;display:flex;justify-content:center;align-items:center}.recent-selector{background-color:var(--bg-secondary);border-radius:5px 5px 0 0;flex:1;height:100%;overflow:auto;overflow-x:hidden;padding:5px;width:360px}.recent-selector:empty:before{color:var(--text-color-disabled);content:"No recent files";height:100%;display:flex;justify-content:center;align-items:center}.recent-item{align-items:center;display:flex;flex-direction:row;padding:1px 5px;text-overflow:ellipsis;white-space:nowrap;gap:8px;font-size:14px}.recent-item.selected,.recent-item.selected:hover{background-color:var(--bg-secondary-active)}.recent-item:hover{background-color:var(--bg-secondary-hover)}.recent-item .recent-path{font-style:italic;color:var(--text-color-tertiary);text-overflow:ellipsis;overflow:hidden}.recent-item .recent-name{text-overflow:ellipsis;overflow:hidden;flex:0 0 auto}.menu-options{display:flex;margin-top:5px;flex:0;justify-content:space-between}.menu-left{display:flex;width:50%}.menu-right{display:flex;flex-direction:row-reverse;width:50%}.outlined{box-shadow:inset 0 0 3px 2px #10629ccc}.outlined>.info{box-shadow:inset 0 0 3px 2px #10629ccc}#menubar{display:flex;background-color:var(--bg-primary)}.menu-item>.menu-item-title{padding:4px 0;display:flex;align-items:center}#menubar>.menu-item>.title{padding:4px 10px}#menubar .menubar-dropdown{display:none;background-color:var(--bg-primary);border:1px solid var(--bg-primary-border);position:absolute;border-radius:5px}#menubar .menu-item:not(.disabled):hover>.menubar-dropdown,#menubar .menubar-dropdown:not(.disabled):hover{display:block}.menu-item-title .title{flex:1;margin-left:10px;margin-right:15px;white-space:nowrap}.menu-item-title .keybind,.menu-item-title .icon{margin-right:10px;color:var(--text-color-tertiary);white-space:nowrap}.menu-item.disabled .menu-item-title .title{color:var(--text-color-disabled)}.menu-item.checked>.menu-item-title .title{font-weight:800}.menu-item:not(.disabled)>.menu-hover:hover{background-color:var(--bg-primary-hover)}.animated .menu-hover{transition:.1s cubic-bezier(.215,.61,.355,1)}.seperator{border:.2px solid #333;margin:4px;height:1px}.check-icon{position:relative;right:16px}.chart-view-scroller{display:grid;grid-template-columns:4fr 6fr;gap:4px;width:100%;height:100%;overflow:auto}.chart-list{height:100%;background-color:var(--bg-secondary);border-radius:5px;overflow:scroll}.chart-info{height:100%;background-color:var(--bg-secondary);border-radius:5px;word-break:break-all;padding:15px;overflow:scroll}.chart-info .label{padding:2px 0}.chart-info:empty:before{color:var(--text-color-disabled);height:100%;display:flex;justify-content:center;align-items:center;content:"Select a chart for more details"}.chart-list-item{display:flex;align-items:center;border:.2px solid var(--bg-secondary-border);cursor:pointer}.animated .chart-list-item{transition:.1s cubic-bezier(.215,.61,.355,1)}.chart-list-item.selected,.chart-list-item:active{background-color:var(--bg-secondary-active)}.chart-list-item:not(.selected):hover{background-color:var(--bg-secondary-hover)}.chart-list-item .Beginner{background-color:#3b6c80}.chart-list-item .Easy{background-color:#308655}.chart-list-item .Medium{background-color:#a08f45}.chart-list-item .Hard{background-color:#8e2921}.chart-list-item .Challenge{background-color:#8b1b9e}.chart-list-item .Edit{background-color:#757575}.chart-list-item>.title{padding:4px;text-align:center;align-content:center;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;min-width:25px}.chart-list-item.extended .chart-list-info{margin:0;opacity:0}.chart-list-info{opacity:1;display:flex;width:100%;align-items:center;margin:0 5px;place-content:space-between;min-width:0px;column-gap:5px;flex:1}.animated .chart-list-info{transition:.2s cubic-bezier(.215,.61,.355,1)}.chart-attributes{display:flex;padding:2px 2px 2px 0}.chart-properties{display:grid;grid-template-columns:100px minmax(0,1fr);align-items:center;flex:1;row-gap:2px;margin-bottom:12px}.chart-properties ul .label{font-weight:700}.chart-properties ul>*:last-child{flex:1}div.inlineEdit[contenteditable=true]{min-width:8px;text-align:right;border-radius:3px;padding:0 3px;border:1px solid transparent;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-overflow-style:none;scrollbar-width:none;caret-color:auto;cursor:text}div.inlineEdit{cursor:default}.animated div.inlineEdit{transition:.2s cubic-bezier(.39,.575,.565,1)}div.inlineEdit[contenteditable=true]:hover{background:var(--bg-editable-overlay)}div.inlineEdit[contenteditable=true]:focus{background:var(--bg-editable-overlay-active);outline:none;overflow:auto;text-overflow:clip}::-webkit-scrollbar{display:none}.chart-credit,.chart-difficulty,.chart-info-grid-label{flex:1;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;padding:1px 0}.chart-step-count{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.chart-info-main{display:flex;font-size:18px;margin-bottom:5px;align-items:center;place-content:space-between}.chart-info-grid-item{display:flex}.chart-info-grid{display:grid;grid-template-columns:1fr 1fr;row-gap:2px;column-gap:15px;margin-top:5px}.timing-data>.padding{display:grid;row-gap:3px;grid-template-columns:auto 170px;align-items:center}.timing-data>.padding>div:not(.label){display:flex;align-items:center;height:100%}.sm-properties .padding{display:flex;flex-direction:column}.sm-properties .property-grid{display:grid;row-gap:3px;grid-template-columns:auto 250px;align-items:center;flex:1}.sm-properties .property-grid>div:not(.label){display:flex;align-items:center}input[type=text],input[type=number]{background:var(--bg-input);border:1px solid rgba(0,0,0,.3);border-radius:3px;padding:0 3px;flex:1;height:100%;user-select:text;caret-color:auto}input:disabled{color:var(--text-color-disabled);pointer-events:none}input:focus{outline:1px solid var(--accent-color)}input.short{width:40px}input.right{text-align:right}.chart-view-type-wrapper{display:flex;flex-direction:row;align-items:center;column-gap:10px;margin-bottom:10px}.dropdown{height:100%;position:relative}.dropdown.no-border .dropdown-selected{border:none;padding:1px}.dropdown.no-border .dropdown-selected:not(:hover):after{opacity:0}.dropdown-selected{border:1px solid rgba(0,0,0,.3);border-radius:3px;width:100%;height:100%;padding:1px 7px;margin-right:3px;display:flex;align-items:center;white-space:nowrap;cursor:pointer}.animated .dropdown-selected{transition:.1s cubic-bezier(.215,.61,.355,1)}.dropdown-selected.disabled{color:var(--text-color-disabled);pointer-events:none;cursor:not-allowed}.dropdown-selected:empty{display:none}.dropdown.white .dropdown-selected:after{filter:invert()}.dropdown-selected:after{content:"";background:right center no-repeat;background-size:contain;width:12px;height:12px;flex:1;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRIie2PMQqAMAxFXwfP6qJVPIjYzcOKdUkhQ0BaCoLkLS3k818CjuN8ztApYzIDl7xvmalFsAIZuIFozKPMMrC0CAJwKIkuGVX5KdkmLEm3ci1JSlLKU49yLSmXVG1es0EANvnvInKcP/AA784fpjlWwNQAAAAASUVORK5CYII=)}.dropdown-selected:hover:not(.disabled):not(:active){background:var(--bg-editable-overlay)}.dropdown-selected:active{background:var(--bg-editable-overlay)}.dropdown-items{position:absolute;background:#555;max-height:200px;overflow:auto;z-index:5;border-radius:5px;height:0px;box-shadow:0 3px 15px #0009;cursor:pointer;top:100%}.dropdown-right>.dropdown-items{right:0}.animated .dropdown-items{transition:height .07s cubic-bezier(.215,.61,.355,1)}.dropdown-item{padding:3px 7px;white-space:nowrap}.animated .dropdown-item{opacity:0;transform:translateY(-10px);animation:.2s dropdown-enter cubic-bezier(.175,.885,.32,1.575) forwards;transition:height .07s cubic-bezier(.215,.61,.355,1)}.dropdown-item:hover{background:#666}.dropdown-item:active{background:#5c5c5c}@keyframes dropdown-enter{0%{transform:translateY(-10px);opacity:0}to{opacity:1;transform:none}}.pref-selector{background-color:var(--bg-secondary);border-radius:0 0 5px 5px/0px 0px 5px 5px;flex:1;height:100%;overflow:auto;padding:5px;font-size:15px}.pref-label{display:flex;flex-direction:row;align-items:center;margin-right:5px;padding:1px 0}.pref-label:hover{background-color:var(--bg-secondary-active)}.flex-row{display:flex;flex-direction:row;align-items:center;justify-content:space-between;height:100%;width:100%}.flex-column-gap{column-gap:5px}.flex-row-gap{row-gap:5px}.flex-grow{flex:1}.flex-static{flex:0}#blocker{width:100%;height:100%;background-color:#00000080;position:absolute;top:0;z-index:10000;caret-color:transparent}.spinner{display:flex;flex-direction:row;height:100%;flex:1}.spinner-input[type=text]{border-top-right-radius:0;border-bottom-right-radius:0;width:100%;height:100%;min-width:0;flex:1}.spinner-input:disabled+.spinner-btns{pointer-events:none}.spinner-btns{display:grid;grid-template-rows:1fr 1fr;border:1px solid #272727;border-left:none;border-top-right-radius:3px;border-bottom-right-radius:3px;flex:0;height:100%;min-height:20px}.spinner-btns button{padding:0 2px;flex:1;border-radius:0;height:100%;width:10px;border:none;min-width:auto}.spinner-btns button:after{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRIie2PMQqAMAxFXwfP6qJVPIjYzcOKdUkhQ0BaCoLkLS3k818CjuN8ztApYzIDl7xvmalFsAIZuIFozKPMMrC0CAJwKIkuGVX5KdkmLEm3ci1JSlLKU49yLSmXVG1es0EANvnvInKcP/AA784fpjlWwNQAAAAASUVORK5CYII=) no-repeat;background-position:center center;background-size:contain;position:absolute;width:10px;height:10px;content:""}.spinner-btns .spinner-up:after{transform:rotate(180deg)}.spinner-up{background:linear-gradient(0deg,#484848,#444)}.spinner-down{background:linear-gradient(180deg,#484848,#555)}#popups{position:absolute;top:35px}#waterfall{position:absolute;top:35px;display:flex;flex-direction:column;text-align:right;padding:0 10px;width:100%;pointer-events:none;user-select:none;caret-color:transparent}.waterfall-item{pointer-events:none}.animated .waterfall-item{transition:cubic-bezier(.455,.03,.515,.955) .5s;animation:waterfall-enter .3s cubic-bezier(.455,.03,.515,.955)}.waterfall-warn{color:#f6ca39;display:inline-block;margin-right:4px}.waterfall-error{color:#b72323;display:inline-block;margin-right:4px}@keyframes waterfall-enter{0%{opacity:0;transform:translate(200px,10px)}to{opacity:1;transform:none}}.waterfall-exiting{opacity:0;transform:translate(200px)}.confirmation .padding .label{flex:1;text-align:center}.confirmation button{min-width:55px}input[type=range]{width:100px;margin-right:10px}.hide-buttons button{display:none}.hide-buttons:hover button,.hide-buttons div:focus+button{display:flex}#status-widget{position:absolute;bottom:30px;display:flex;flex-direction:column;left:50%;transform:translate(-50%);border-radius:5px;align-items:center;height:96px;overflow:hidden;user-select:none}#status-widget.collapsed{height:48px}.playback-bar,.edit-bar{display:flex;flex-direction:row;height:48px;align-items:center;border-radius:5px;justify-content:flex-start;width:100%}.playback-bar{background-color:var(--bg-widget)}#status-widget:not(.collapsed) .playback-bar{border-bottom:1px rgba(55,55,55,.2) solid;border-radius:0}.animated #status-widget{transition:.3s cubic-bezier(.11,.72,.51,1.14)}#status-widget button{background:none;box-shadow:none;transform:none;border:none;width:48px;height:48px;outline:none}#status-widget button img{height:100%}#status-widget button:hover{filter:brightness(.6)}#status-widget button:active{filter:brightness(.4)}#status-widget button:disabled{filter:brightness(.2) saturate(.4)}.animated #status-widget button{transition:.2s cubic-bezier(.39,.575,.565,1)}#status-widget .playback-seperator{padding:0 2px;height:48px;display:flex;align-items:center}#status-widget .playback-seperator:after{border:.5px rgba(134,134,134,.5) solid;height:30px;content:" "}#status-widget .playback-counter{display:flex;flex-direction:column;align-items:center;width:100px;margin:0 4px}#status-widget .playback-counter .playback-counter-label{font-size:10px;color:var(--text-color-tertiary)}#status-widget .playback-counter .playback-counter-label:after{filter:invert() brightness(.4)}#status-widget .playback-counter .playback-counter-main{font-size:18px;line-height:18px;max-width:100px;align-items:baseline}#status-widget .playback-counter .playback-counter-main,#status-widget .playback-counter .playback-counter-main *{padding:0;border:none;text-overflow:clip;overflow:hidden}#status-widget .dropdown-selected{border:none}#status-widget .edit-fancy-button{font-size:9px;padding:0 4px;width:56px;height:48px;display:flex;flex-direction:column;align-content:center}#status-widget .edit-fancy-button img{height:23px}.note-placeholder{border-radius:5px}.edit-choice-container{display:flex;flex-direction:column;height:96px;position:relative;top:0;align-self:flex-start;width:100%;overflow:hidden}.edit-steps-container,.edit-timing-container{display:flex;flex-direction:row;align-items:center;height:48px;width:100%}.animated .edit-choice-container,.animated .edit-steps-container,.animated .edit-timing-container{transition:.2s cubic-bezier(.39,.575,.565,1)}.edit-timing-container{background-color:var(--bg-widget);height:48px}#status-widget .edit-bar .edit-bar-left{background-color:var(--bg-widget);display:flex;flex-direction:row}.note-placeholder-right{flex:1;background-color:var(--bg-widget);height:48px}.popup{user-select:none;position:absolute;transform:translate(-50%)}.popup-zoomer{transform-origin:top middle;display:flex;flex-direction:column;background-color:var(--bg-window);border-radius:5px;padding:8px;align-items:center;border:1px solid black;animation:1ms popup-enter cubic-bezier(.47,.02,0,.95) forwards;box-shadow:0 0 5px #0009}.popup-zoomer.selected{filter:saturate(1.2) brightness(1.4);border:1px solid rgb(14,83,104)}.popup.exiting .popup-zoomer{animation:.01s popup-exit cubic-bezier(.47,.02,0,.95) forwards;pointer-events:none}.animated .popup-zoomer{animation:.1s popup-enter cubic-bezier(.47,.02,0,.95) forwards;transition:.2s cubic-bezier(.47,.02,0,.95)}.animated .popup.exiting .popup-zoomer{animation:.1s popup-exit cubic-bezier(.47,.02,0,.95) forwards;pointer-events:none}.popup-row{display:flex;flex-direction:row;gap:5px;color:var(--text-color-secondary);white-space:nowrap;font-size:14px;align-items:center}.popup-flex{display:flex;flex-direction:column;gap:4px;margin-top:4px}@keyframes popup-enter{0%{transform:scale(.8);opacity:0}to{transform:scale(1);opacity:1}}@keyframes popup-exit{0%{transform:scale(1);opacity:1}to{transform:scale(.8);opacity:0}}.popup .popup-desc{font-size:10px;font-style:italic;text-align:center;color:var(--text-color-detail)}.animated .popup-desc{transition:.2s cubic-bezier(.47,.02,0,.95)}.popup .popup-title{text-align:center}.popup .popup-label{color:var(--text-color-secondary);white-space:nowrap;font-size:14px}.popup .popup-grid input[type=text]{min-width:0;text-align:right}.popup .popup-grid input[type=checkbox]{min-width:0;justify-self:end}.popup .popup-grid{margin-top:4px;display:grid;grid-template-columns:auto auto;column-gap:15px;row-gap:4px;width:100%;justify-content:end;align-items:center}.animated .popup-options{transition:.2s cubic-bezier(.47,.02,0,.95)}.popup-options{margin-top:0;width:100%;justify-content:space-around;transform:scale(0);height:0px;display:flex}.popup-options button{min-width:40px}.popup-zoomer.selected .popup-options{margin-top:5px;transform:scale(1);height:24.5px;filter:saturate(.8) brightness(.7)}.draggable-track{writing-mode:vertical-rl;text-align:center;padding:20px 4px;height:200px;display:flex;align-items:center;justify-content:space-around;box-shadow:0 .5px #000000e6,0 3px 5px -3px #0009;cursor:grab}.draggable-track.left .draggable-track-text{transform:rotate(180deg)}.draggable-track img{position:absolute;display:none}.draggable-track:hover img{display:block;bottom:10px;backface-visibility:hidden;filter:invert() brightness(.5);cursor:pointer}.draggable-track:hover img:hover{filter:invert() brightness(.5) sepia() hue-rotate(-50deg) saturate(6)}.draggable-track:hover{filter:brightness(1.3) saturate(2.5);transform:translateY(-1.5px);box-shadow:0 1.5px #000000e6,0 3px 5px -2px #0009}.draggable-track:active{cursor:grabbing;filter:brightness(1.1) saturate(2.5);transform:none;box-shadow:0 0 #000000e6,0 3px 5px -2px #0009}@keyframes draggable-exit{0%{width:26px}to{width:0px;padding:0;opacity:0}}@keyframes draggable-enter{0%{opacity:0;width:0px;padding:0}to{opacity:1;width:26px}}.draggable-track.entering,.draggable-option.entering{animation:draggable-enter 0s cubic-bezier(0,.91,.34,1.05) forwards}.draggable-track.exiting,.draggable-option.exiting{animation:draggable-exit 0s cubic-bezier(0,.91,.34,1.05) forwards}.animated .draggable-track.entering,.animated .draggable-option.entering{animation:draggable-enter .4s cubic-bezier(0,.91,.34,1.05) forwards}.animated .draggable-track.exiting,.animated .draggable-option.exiting{animation:draggable-exit .4s cubic-bezier(0,.91,.34,1.05) forwards}@keyframes leftover-enter{0%{opacity:0;transform:scale(0);padding:0}to{opacity:1;transform:scale(1)}}.leftover-track.entering,.leftover-option.entering{animation:leftover-enter 0s cubic-bezier(0,.91,.34,1.05) forwards}.animated .leftover-track.entering,.animated .leftover-option.entering{animation:leftover-enter .4s cubic-bezier(0,.91,.34,1.05) forwards}#timing-track-order .title{text-align:center;padding:6px}.track-grid{display:flex;flex-direction:row;background-color:var(--bg-secondary);padding:4px;border-radius:3px;width:468.08px;justify-content:center}.track-grid-options{display:flex;flex-direction:row;column-gap:8px;padding:4px 0}.track-selector{flex:1;height:30px;display:flex;flex-direction:row;background-color:var(--bg-tertiary);padding:4px;border-radius:3px;gap:4px;overflow-x:auto}.leftover-track{display:flex;justify-content:center;align-items:center;border-radius:3px;padding:4px;gap:3px;box-shadow:0 .5px #000000e6,0 3px 5px -3px #0009;font-size:13px;cursor:grab}.leftover-track img{filter:invert();vertical-align:baseline;width:10px}.leftover-track:hover{filter:brightness(1.3) saturate(2.5);transform:translateY(-1.5px);box-shadow:0 1.5px #000000e6,0 3px 5px -2px #0009}.leftover-track:active{filter:brightness(1.1) saturate(2.5);transform:none;box-shadow:0 0 #000000e6,0 3px 5px -2px #0009;cursor:grabbing}.animated .draggable-track,.animated .draggable-track img,.animated .leftover-track,.animated .track-selector,.animated .draggable-option,.animated .draggable-option img,.animated .leftover-option{transition:.2s cubic-bezier(0,.91,.34,1.05)}.sm-title{font-weight:700;margin-bottom:3px}.sm-container{margin-bottom:15px}#context-menu{display:flex;position:absolute;flex-direction:column;background-color:var(--bg-primary);border:1px solid var(--bg-primary-border);caret-color:transparent;font-size:15px;border-radius:5px;transform-origin:top left;opacity:.95}.animated #context-menu.entering{animation:context-enter .15s cubic-bezier(.13,.61,.07,.98)}#context-menu.exiting{transform:scale(.8);opacity:0}.animated #context-menu.exiting{transition:.1s cubic-bezier(.15,.73,.62,.75)}@keyframes context-enter{0%{opacity:0;transform:scale(.8)}to{opacity:.95;transform:scale(1)}}.menu-item{position:relative;z-index:9999}.menu-item>.menu-item-title{padding:3px 0;display:flex;align-items:center}.menu-item:first-child>.menu-item-title{border-top-left-radius:5px;border-top-right-radius:5px}.menu-item:last-child>.menu-item-title{border-bottom-left-radius:5px;border-bottom-right-radius:5px}#context-menu .menubar-dropdown{background-color:var(--bg-primary);border:1px solid var(--bg-primary-border);position:absolute;left:100%;top:0;border-radius:5px;transform-origin:left;transform:scale(0);opacity:0}@keyframes context-dropdown-enter{0%{transform:scale(.8)}to{transform:scale(1)}}@keyframes context-dropdown-exit{0%{transform:scale(1)}to{transform:scale(.8)}}#context-menu .menu-item:not(.disabled):hover>.menubar-dropdown,#context-menu .menubar-dropdown:not(.disabled):hover{opacity:.95;transform:scale(1)}.animated #context-menu .menu-item:not(.disabled):hover>.menubar-dropdown,.animated #context-menu .menubar-dropdown:not(.disabled):hover{animation:context-dropdown-enter .08s cubic-bezier(.215,.61,.355,1) forwards}.animated #context-menu .menubar-dropdown{animation:context-dropdown-exit .08s cubic-bezier(.215,.61,.355,1);transition:.08s cubic-bezier(.215,.61,.355,1)}.menu-item .menubar-dropdown .menubar-dropdown{left:100%;top:0}.pref-container{display:flex;flex-direction:column;gap:10px;height:100%}.pref-search{display:flex;flex-direction:row;gap:10px}.pref-scrollers{display:flex;gap:20px;flex:1;min-height:0}.pref-section-scroller,.pref-option-scroller{background-color:var(--bg-secondary);overflow:auto;padding:5px;border-radius:5px}.animated .pref-option-scroller{scroll-behavior:smooth}.pref-section{padding:3px 5px;border-radius:2px;cursor:pointer}.pref-section-scroller{width:150px}.pref-option-scroller:empty:before{color:var(--text-color-disabled);content:"No keybinds matched the search term.";height:100%;display:flex;justify-content:center;align-items:center}.animated .pref-section,.animated .pref-keybind-combo,.animated .pref-keybind,.animated .pref-item,.animated .pref-item-tooltip{transition:.1s cubic-bezier(.445,.05,.55,.95)}.pref-section.selected,.pref-section.selected:hover{background-color:var(--bg-secondary-active)}.pref-section:hover,.pref-keybind:hover,.pref-item:hover{background-color:var(--bg-secondary-hover)}.pref-option-scroller{display:flex;flex-direction:column;gap:20px;flex:1;padding:3px 5px}.pref-keybind{padding:3px 5px;border-radius:2px;display:flex;flex-direction:row;align-items:center;width:100%;cursor:pointer}.pref-item{padding:3px 5px;border-radius:2px;display:flex;flex-direction:row;align-items:center;width:100%}.pref-item-input{margin-left:auto;max-width:160px;display:flex}.pref-item>.spinner{max-width:50px}.pref-item .spinner-input{text-align:right}.pref-keybind img,.pref-item>img{margin-left:5px;display:block;bottom:10px;backface-visibility:hidden;filter:invert() brightness(.5);cursor:pointer}.pref-keybind img:hover{filter:invert() brightness(.5) sepia() hue-rotate(-50deg) saturate(6)}.pref-keybind-label{padding:2px 0}.pref-label{padding:10px 0}.pref-keybind-combos{display:flex;flex-direction:row;align-items:center;gap:3px;margin-left:auto}.pref-keybind-combo{background-color:#0003;padding:2px 5px;font-size:13px}.pref-keybind-combo.conflict{background:rgb(187,93,31)}.pref-keybind-combo:hover{background-color:var(--danger)}.pref-group-label{font-size:18px;margin-bottom:6px}.pref-subgroup-label{font-weight:700;margin-bottom:6px}.pref-group{padding:3px 5px}.pref-children .pref-group-label{font-size:17px}.pref-search .dropdown{width:70px}.pref-group-label+.pref-children{margin-left:15px}.pref-children{display:flex;flex-direction:column;gap:5px}.pref-subgroup{margin:8px 0}.detail{font-size:12px;font-style:italic;text-align:center;color:var(--text-color-detail)}.tippy-box[data-theme~=sm]{background-color:#1e1e1e;color:#fff}.tippy-box[data-theme~=sm][data-placement^=top]>.tippy-arrow:before{border-top-color:#1e1e1e}.tippy-box[data-theme~=sm][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#1e1e1e}.tippy-box[data-theme~=sm][data-placement^=left]>.tippy-arrow:before{border-left-color:#1e1e1e}.tippy-box[data-theme~=sm][data-placement^=right]>.tippy-arrow:before{border-right-color:#1e1e1e}.export-container{display:flex;flex-direction:row;gap:15px;height:100%;overflow:hidden}.export-section-label{font-weight:700;margin-bottom:6px;margin-top:6px}.export-option{display:flex;flex-direction:row;gap:5px;align-items:center;padding:3px 5px}.export-output{flex:1;border-radius:5px;background-color:var(--bg-secondary);padding:5px;white-space:pre-wrap;word-break:break-all;font-family:monospace;font-size:12px;overflow:auto;tab-size:2}.export-output:hover{background-color:var(--bg-secondary-hover)}.animated .export-output{transition:.1s cubic-bezier(.39,.575,.565,1)}.logo{text-align:center;font-size:26px}.icon-container{display:flex;align-items:center;justify-content:space-evenly;background-color:#0b0e1a;padding-top:2px;border-bottom:1px solid;border-image-slice:1;border-width:1px;border-image-source:linear-gradient(to right,rgb(11,14,26),rgb(49,57,88),rgb(11,14,26))}.eq-icon{border-radius:3px}.animated .eq-icon{transition:.1s cubic-bezier(.39,.575,.565,1)}.eq-icon.disabled:not(:hover){fill:#888}.eq-icon:not(:hover){background-color:#0000!important}.eq-icon:hover{background-color:attr(fill,color)}.eq-icon:after{content:"hello"}.eq-info-container{border-top:1px solid;border-image-slice:1;border-width:1px;border-image-source:linear-gradient(to right,rgb(11,14,26),rgb(49,57,88),rgb(11,14,26));background-color:#0b0e1a;display:flex;flex-direction:row;align-items:center;gap:10px;padding:2px 10px;margin:0;font-size:12px}.eq-info{display:flex;flex-direction:row;align-items:center;gap:5px}.eq-info-label{color:#0087cbcc}.eq-info-value{width:80px}.eq-info-value.inlineEdit[contenteditable=true]{border:none;min-width:80px;text-align:left;border-radius:3px;padding:0;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;-ms-overflow-style:none;scrollbar-width:none;caret-color:auto}.eq-info-value.inlineEdit[contenteditable=true]:hover{background:rgba(0,135,203,.082)}.eq-info-value.inlineEdit[contenteditable=true]:focus{background:rgba(0,135,203,.082)}.eq-container{display:flex;flex-direction:column}input[type=color]{appearance:none;-moz-appearance:none;-webkit-appearance:none;background:none;border:0;cursor:pointer;height:19.5px;padding:0;width:29.5px}::-webkit-color-swatch-wrapper{padding:0}::-webkit-color-swatch{border:1px rgb(105,105,105) solid;border-radius:3px}::-moz-color-swatch,::-moz-focus-inner{border:0}::-moz-focus-inner{padding:0}.tippy-box[data-animation=scale-subtle][data-placement^=top]{transform-origin:bottom}.tippy-box[data-animation=scale-subtle][data-placement^=bottom]{transform-origin:top}.tippy-box[data-animation=scale-subtle][data-placement^=left]{transform-origin:right}.tippy-box[data-animation=scale-subtle][data-placement^=right]{transform-origin:left}.tippy-box[data-animation=scale-subtle][data-state=hidden]{transform:scale(.8);opacity:0}.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{position:relative;background-color:#333;color:#fff;border-radius:4px;font-size:14px;line-height:1.4;white-space:normal;outline:0;transition-property:transform,visibility,opacity}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{bottom:-7px;left:0;border-width:8px 8px 0;border-top-color:initial;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{top:-7px;left:0;border-width:0 8px 8px;border-bottom-color:initial;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-width:8px 0 8px 8px;border-left-color:initial;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{left:-7px;border-width:8px 8px 8px 0;border-right-color:initial;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{width:16px;height:16px;color:#333}.tippy-arrow:before{content:"";position:absolute;border-color:transparent;border-style:solid}.tippy-content{position:relative;padding:5px 9px;z-index:1} diff --git a/beta/assets/index-92a586e7.js b/beta/assets/index-abdbff68.js similarity index 55% rename from beta/assets/index-92a586e7.js rename to beta/assets/index-abdbff68.js index cc683152..1ca6a216 100644 --- a/beta/assets/index-92a586e7.js +++ b/beta/assets/index-abdbff68.js @@ -1,15 +1,16 @@ -var Dm=Object.defineProperty;var Lm=(i,e,t)=>e in i?Dm(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var Yo=(i,e,t)=>(Lm(i,typeof e!="symbol"?e+"":e,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const n of s)if(n.type==="childList")for(const a of n.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function t(s){const n={};return s.integrity&&(n.integrity=s.integrity),s.referrerPolicy&&(n.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?n.credentials="include":s.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function r(s){if(s.ep)return;s.ep=!0;const n=t(s);fetch(s.href,n)}})();var hs=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(hs||{}),of=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(of||{}),zl=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(zl||{}),Ae=(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))(Ae||{}),Fi=(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))(Fi||{}),ce=(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))(ce||{}),Os=(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))(Os||{}),Ee=(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))(Ee||{}),Vl=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(Vl||{}),qi=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(qi||{}),Ar=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(Ar||{}),Kt=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))(Kt||{}),ki=(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))(ki||{}),Di=(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))(Di||{}),Vh=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(Vh||{}),si=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(si||{}),gt=(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))(gt||{}),ft=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(ft||{}),Ui=(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))(Ui||{});const Om={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")},fe={ADAPTER:Om,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Ko=/iPhone/i,Lc=/iPod/i,Oc=/iPad/i,Fc=/\biOS-universal(?:.+)Mac\b/i,$o=/\bAndroid(?:.+)Mobile\b/i,Nc=/Android/i,ps=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,na=/Silk/i,ji=/Windows Phone/i,Uc=/\bWindows(?:.+)ARM\b/i,Hc=/BlackBerry/i,Gc=/BB10/i,Wc=/Opera Mini/i,zc=/\b(CriOS|Chrome)(?:.+)Mobile/i,Vc=/Mobile(?:.+)Firefox\b/i,jc=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};function Fm(i){return function(e){return e.test(i)}}function Xc(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,r=t.split("[FBAN");typeof r[1]<"u"&&(t=r[0]),r=t.split("Twitter"),typeof r[1]<"u"&&(t=r[0]);var s=Fm(t),n={apple:{phone:s(Ko)&&!s(ji),ipod:s(Lc),tablet:!s(Ko)&&(s(Oc)||jc(e))&&!s(ji),universal:s(Fc),device:(s(Ko)||s(Lc)||s(Oc)||s(Fc)||jc(e))&&!s(ji)},amazon:{phone:s(ps),tablet:!s(ps)&&s(na),device:s(ps)||s(na)},android:{phone:!s(ji)&&s(ps)||!s(ji)&&s($o),tablet:!s(ji)&&!s(ps)&&!s($o)&&(s(na)||s(Nc)),device:!s(ji)&&(s(ps)||s(na)||s($o)||s(Nc))||s(/\bokhttp\b/i)},windows:{phone:s(ji),tablet:s(Uc),device:s(ji)||s(Uc)},other:{blackberry:s(Hc),blackberry10:s(Gc),opera:s(Wc),firefox:s(Vc),chrome:s(zc),device:s(Hc)||s(Gc)||s(Wc)||s(Vc)||s(zc)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const Nm=Xc.default??Xc,Qi=Nm(globalThis.navigator);fe.RETINA_PREFIX=/@([0-9\.]+)x/;fe.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ii=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $n(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Um(i){if(i.__esModule)return i;var e=i.default;if(typeof e=="function"){var t=function r(){return this instanceof r?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(r){var s=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return i[r]}})}),t}var lf={exports:{}};(function(i){var e=Object.prototype.hasOwnProperty,t="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(t=!1));function s(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function n(l,c,u,h,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new s(u,h||l,d),p=t?t+c:c;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],f]:l._events[p].push(f):(l._events[p]=f,l._eventsCount++),l}function a(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],u,h;if(this._eventsCount===0)return c;for(h in u=this._events)e.call(u,h)&&c.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},o.prototype.listeners=function(c){var u=t?t+c:c,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,f=h.length,p=new Array(f);d80*t){o=c=i[0],l=u=i[1];for(var p=t;pc&&(c=h),d>u&&(u=d);f=Math.max(c-o,u-l),f=f!==0?32767/f:0}return Hn(n,a,t,o,l,f,0),a}function hf(i,e,t,r,s){var n,a;if(s===Yl(i,e,t,r)>0)for(n=e;n=e;n-=r)a=Yc(n,i[n],i[n+1],a);return a&&xo(a,a.next)&&(Wn(a),a=a.next),a}function is(i,e){if(!i)return i;e||(e=i);var t=i,r;do if(r=!1,!t.steiner&&(xo(t,t.next)||ct(t.prev,t,t.next)===0)){if(Wn(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Hn(i,e,t,r,s,n,a){if(i){!a&&n&&qm(i,r,s,n);for(var o=i,l,c;i.prev!==i.next;){if(l=i.prev,c=i.next,n?Wm(i,r,s,n):Gm(i)){e.push(l.i/t|0),e.push(i.i/t|0),e.push(c.i/t|0),Wn(i),i=c.next,o=c.next;continue}if(i=c,i===o){a?a===1?(i=zm(is(i),e,t),Hn(i,e,t,r,s,n,2)):a===2&&Vm(i,e,t,r,s,n):Hn(is(i),e,t,r,s,n,1);break}}}}function Gm(i){var e=i.prev,t=i,r=i.next;if(ct(e,t,r)>=0)return!1;for(var s=e.x,n=t.x,a=r.x,o=e.y,l=t.y,c=r.y,u=sn?s>a?s:a:n>a?n:a,f=o>l?o>c?o:c:l>c?l:c,p=r.next;p!==e;){if(p.x>=u&&p.x<=d&&p.y>=h&&p.y<=f&&ks(s,o,n,l,a,c,p.x,p.y)&&ct(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Wm(i,e,t,r){var s=i.prev,n=i,a=i.next;if(ct(s,n,a)>=0)return!1;for(var o=s.x,l=n.x,c=a.x,u=s.y,h=n.y,d=a.y,f=ol?o>c?o:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,y=jl(f,p,e,t,r),b=jl(m,g,e,t,r),_=i.prevZ,v=i.nextZ;_&&_.z>=y&&v&&v.z<=b;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==a&&ks(o,u,l,h,c,d,_.x,_.y)&&ct(_.prev,_,_.next)>=0||(_=_.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==a&&ks(o,u,l,h,c,d,v.x,v.y)&&ct(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;_&&_.z>=y;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=g&&_!==s&&_!==a&&ks(o,u,l,h,c,d,_.x,_.y)&&ct(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;v&&v.z<=b;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==a&&ks(o,u,l,h,c,d,v.x,v.y)&&ct(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function zm(i,e,t){var r=i;do{var s=r.prev,n=r.next.next;!xo(s,n)&&cf(s,r,r.next,n)&&Gn(s,n)&&Gn(n,s)&&(e.push(s.i/t|0),e.push(r.i/t|0),e.push(n.i/t|0),Wn(r),Wn(r.next),r=i=n),r=r.next}while(r!==i);return is(r)}function Vm(i,e,t,r,s,n){var a=i;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&Jm(a,o)){var l=df(a,o);a=is(a,a.next),l=is(l,l.next),Hn(a,e,t,r,s,n,0),Hn(l,e,t,r,s,n,0);return}o=o.next}a=a.next}while(a!==i)}function jm(i,e,t,r){var s=[],n,a,o,l,c;for(n=0,a=e.length;n=t.next.y&&t.next.y!==t.y){var o=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(o<=r&&o>n&&(n=o,a=t.x=t.x&&t.x>=c&&r!==t.x&&ks(sa.x||t.x===a.x&&$m(a,t)))&&(a=t,h=d)),t=t.next;while(t!==l);return a}function $m(i,e){return ct(i.prev,i,e.prev)<0&&ct(e.next,i,i.next)<0}function qm(i,e,t,r){var s=i;do s.z===0&&(s.z=jl(s.x,s.y,e,t,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,Qm(s)}function Qm(i){var e,t,r,s,n,a,o,l,c=1;do{for(t=i,i=null,n=null,a=0;t;){for(a++,r=t,o=0,e=0;e0||l>0&&r;)o!==0&&(l===0||!r||t.z<=r.z)?(s=t,t=t.nextZ,o--):(s=r,r=r.nextZ,l--),n?n.nextZ=s:i=s,s.prevZ=n,n=s;t=r}n.nextZ=null,c*=2}while(a>1);return i}function jl(i,e,t,r,s){return i=(i-t)*s|0,e=(e-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function Zm(i){var e=i,t=i;do(e.x=(i-a)*(n-o)&&(i-a)*(r-o)>=(t-a)*(e-o)&&(t-a)*(n-o)>=(s-a)*(r-o)}function Jm(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!eg(i,e)&&(Gn(i,e)&&Gn(e,i)&&tg(i,e)&&(ct(i.prev,i,e.prev)||ct(i,e.prev,e))||xo(i,e)&&ct(i.prev,i,i.next)>0&&ct(e.prev,e,e.next)>0)}function ct(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function xo(i,e){return i.x===e.x&&i.y===e.y}function cf(i,e,t,r){var s=oa(ct(i,e,t)),n=oa(ct(i,e,r)),a=oa(ct(t,r,i)),o=oa(ct(t,r,e));return!!(s!==n&&a!==o||s===0&&aa(i,t,e)||n===0&&aa(i,r,e)||a===0&&aa(t,i,r)||o===0&&aa(t,e,r))}function aa(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function oa(i){return i>0?1:i<0?-1:0}function eg(i,e){var t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&cf(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Gn(i,e){return ct(i.prev,i,i.next)<0?ct(i,e,i.next)>=0&&ct(i,i.prev,e)>=0:ct(i,e,i.prev)<0||ct(i,i.next,e)<0}function tg(i,e){var t=i,r=!1,s=(i.x+e.x)/2,n=(i.y+e.y)/2;do t.y>n!=t.next.y>n&&t.next.y!==t.y&&s<(t.next.x-t.x)*(n-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==i);return r}function df(i,e){var t=new Xl(i.i,i.x,i.y),r=new Xl(e.i,e.x,e.y),s=i.next,n=e.prev;return i.next=e,e.prev=i,t.next=s,s.prev=t,r.next=t,t.prev=r,n.next=r,r.prev=n,r}function Yc(i,e,t,r){var s=new Xl(i,e,t);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function Wn(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Xl(i,e,t){this.i=i,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}_o.deviation=function(i,e,t,r){var s=e&&e.length,n=s?e[0]*t:i.length,a=Math.abs(Yl(i,0,n,t));if(s)for(var o=0,l=e.length;o0&&(r+=i[s-1].length,t.holes.push(r))}return t};var ig=jh.exports;const rg=$n(ig);var Qa={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Qa.exports;(function(i,e){(function(t){var r=e&&!e.nodeType&&e,s=i&&!i.nodeType&&i,n=typeof ii=="object"&ⅈ(n.global===n||n.window===n||n.self===n)&&(t=n);var a,o=2147483647,l=36,c=1,u=26,h=38,d=700,f=72,p=128,m="-",g=/^xn--/,y=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=l-c,E=Math.floor,I=String.fromCharCode,S;function R(q){throw new RangeError(_[q])}function P(q,F){for(var N=q.length,ae=[];N--;)ae[N]=F(q[N]);return ae}function L(q,F){var N=q.split("@"),ae="";N.length>1&&(ae=N[0]+"@",q=N[1]),q=q.replace(b,".");var ee=q.split("."),Q=P(ee,F).join(".");return ae+Q}function W(q){for(var F=[],N=0,ae=q.length,ee,Q;N=55296&&ee<=56319&&N65535&&(F-=65536,N+=I(F>>>10&1023|55296),F=56320|F&1023),N+=I(F),N}).join("")}function C(q){return q-48<10?q-22:q-65<26?q-65:q-97<26?q-97:l}function w(q,F){return q+22+75*(q<26)-((F!=0)<<5)}function G(q,F,N){var ae=0;for(q=N?E(q/d):q>>1,q+=E(q/F);q>v*u>>1;ae+=l)q=E(q/v);return E(ae+(v+1)*q/(q+h))}function $(q){var F=[],N=q.length,ae,ee=0,Q=p,ge=f,Te,me,be,Se,we,Re,Le,x,K;for(Te=q.lastIndexOf(m),Te<0&&(Te=0),me=0;me=128&&R("not-basic"),F.push(q.charCodeAt(me));for(be=Te>0?Te+1:0;be=N&&R("invalid-input"),Le=C(q.charCodeAt(be++)),(Le>=l||Le>E((o-ee)/we))&&R("overflow"),ee+=Le*we,x=Re<=ge?c:Re>=ge+u?u:Re-ge,!(LeE(o/K)&&R("overflow"),we*=K;ae=F.length+1,ge=G(ee-Se,ae,Se==0),E(ee/ae)>o-Q&&R("overflow"),Q+=E(ee/ae),ee%=ae,F.splice(ee++,0,Q)}return T(F)}function z(q){var F,N,ae,ee,Q,ge,Te,me,be,Se,we,Re=[],Le,x,K,j;for(q=W(q),Le=q.length,F=p,N=0,Q=f,ge=0;ge=F&&weE((o-N)/x)&&R("overflow"),N+=(Te-F)*x,F=Te,ge=0;geo&&R("overflow"),we==F){for(me=N,be=l;Se=be<=Q?c:be>=Q+u?u:be-Q,!(me"u"||!wt?Ne:wt(Uint8Array),$r={"%AggregateError%":typeof AggregateError>"u"?Ne:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Ne:ArrayBuffer,"%ArrayIteratorPrototype%":ms&&wt?wt([][Symbol.iterator]()):Ne,"%AsyncFromSyncIteratorPrototype%":Ne,"%AsyncFunction%":ws,"%AsyncGenerator%":ws,"%AsyncGeneratorFunction%":ws,"%AsyncIteratorPrototype%":ws,"%Atomics%":typeof Atomics>"u"?Ne:Atomics,"%BigInt%":typeof BigInt>"u"?Ne:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Ne:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Ne:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Ne:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Ne:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Ne:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Ne:FinalizationRegistry,"%Function%":uf,"%GeneratorFunction%":ws,"%Int8Array%":typeof Int8Array>"u"?Ne:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Ne:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Ne:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ms&&wt?wt(wt([][Symbol.iterator]())):Ne,"%JSON%":typeof JSON=="object"?JSON:Ne,"%Map%":typeof Map>"u"?Ne:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ms||!wt?Ne:wt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Ne:Promise,"%Proxy%":typeof Proxy>"u"?Ne:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Ne:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Ne:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ms||!wt?Ne:wt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Ne:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ms&&wt?wt(""[Symbol.iterator]()):Ne,"%Symbol%":ms?Symbol:Ne,"%SyntaxError%":zs,"%ThrowTypeError%":yg,"%TypedArray%":bg,"%TypeError%":Fs,"%Uint8Array%":typeof Uint8Array>"u"?Ne:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Ne:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Ne:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Ne:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Ne:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Ne:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Ne:WeakSet};if(wt)try{null.error}catch(i){var wg=wt(wt(i));$r["%Error.prototype%"]=wg}var _g=function i(e){var t;if(e==="%AsyncFunction%")t=Qo("async function () {}");else if(e==="%GeneratorFunction%")t=Qo("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Qo("async function* () {}");else if(e==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&wt&&(t=wt(s.prototype))}return $r[e]=t,t},qc={"%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"]},qn=Xh,Za=gg,xg=qn.call(Function.call,Array.prototype.concat),Ag=qn.call(Function.apply,Array.prototype.splice),Qc=qn.call(Function.call,String.prototype.replace),Ja=qn.call(Function.call,String.prototype.slice),Eg=qn.call(Function.call,RegExp.prototype.exec),Tg=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Sg=/\\(\\)?/g,Cg=function(e){var t=Ja(e,0,1),r=Ja(e,-1);if(t==="%"&&r!=="%")throw new zs("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new zs("invalid intrinsic syntax, expected opening `%`");var s=[];return Qc(e,Tg,function(n,a,o,l){s[s.length]=o?Qc(l,Sg,"$1"):a||n}),s},Mg=function(e,t){var r=e,s;if(Za(qc,r)&&(s=qc[r],r="%"+s[0]+"%"),Za($r,r)){var n=$r[r];if(n===ws&&(n=_g(r)),typeof n>"u"&&!t)throw new Fs("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:n}}throw new zs("intrinsic "+e+" does not exist!")},Yh=function(e,t){if(typeof e!="string"||e.length===0)throw new Fs("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Fs('"allowMissing" argument must be a boolean');if(Eg(/^%?[^%]*%?$/,e)===null)throw new zs("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Cg(e),s=r.length>0?r[0]:"",n=Mg("%"+s+"%",t),a=n.name,o=n.value,l=!1,c=n.alias;c&&(s=c[0],Ag(r,xg([0,1],c)));for(var u=1,h=!0;u=r.length){var m=Kr(o,d);h=!!m,h&&"get"in m&&!("originalValue"in m.get)?o=m.get:o=o[d]}else h=Za(o,d),o=o[d];h&&!l&&($r[a]=o)}}return o},ff={exports:{}};(function(i){var e=Xh,t=Yh,r=t("%Function.prototype.apply%"),s=t("%Function.prototype.call%"),n=t("%Reflect.apply%",!0)||e.call(s,r),a=t("%Object.getOwnPropertyDescriptor%",!0),o=t("%Object.defineProperty%",!0),l=t("%Math.max%");if(o)try{o({},"a",{value:1})}catch{o=null}i.exports=function(h){var d=n(e,s,arguments);if(a&&o){var f=a(d,"length");f.configurable&&o(d,"length",{value:1+l(0,h.length-(arguments.length-1))})}return d};var c=function(){return n(e,r,arguments)};o?o(i.exports,"apply",{value:c}):i.exports.apply=c})(ff);var kg=ff.exports,pf=Yh,mf=kg,Ig=mf(pf("String.prototype.indexOf")),Pg=function(e,t){var r=pf(e,!!t);return typeof r=="function"&&Ig(e,".prototype.")>-1?mf(r):r};const Bg={},Rg=Object.freeze(Object.defineProperty({__proto__:null,default:Bg},Symbol.toStringTag,{value:"Module"})),Dg=Um(Rg);var Kh=typeof Map=="function"&&Map.prototype,Jo=Object.getOwnPropertyDescriptor&&Kh?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,eo=Kh&&Jo&&typeof Jo.get=="function"?Jo.get:null,Zc=Kh&&Map.prototype.forEach,$h=typeof Set=="function"&&Set.prototype,el=Object.getOwnPropertyDescriptor&&$h?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,to=$h&&el&&typeof el.get=="function"?el.get:null,Jc=$h&&Set.prototype.forEach,Lg=typeof WeakMap=="function"&&WeakMap.prototype,In=Lg?WeakMap.prototype.has:null,Og=typeof WeakSet=="function"&&WeakSet.prototype,Pn=Og?WeakSet.prototype.has:null,Fg=typeof WeakRef=="function"&&WeakRef.prototype,ed=Fg?WeakRef.prototype.deref:null,Ng=Boolean.prototype.valueOf,Ug=Object.prototype.toString,Hg=Function.prototype.toString,Gg=String.prototype.match,qh=String.prototype.slice,br=String.prototype.replace,Wg=String.prototype.toUpperCase,td=String.prototype.toLowerCase,gf=RegExp.prototype.test,id=Array.prototype.concat,Li=Array.prototype.join,zg=Array.prototype.slice,rd=Math.floor,Kl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,tl=Object.getOwnPropertySymbols,$l=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Vs=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Dt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Vs||"symbol")?Symbol.toStringTag:null,yf=Object.prototype.propertyIsEnumerable,sd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function nd(i,e){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||gf.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-rd(-i):rd(i);if(r!==i){var s=String(r),n=qh.call(e,s.length+1);return br.call(s,t,"$&_")+"."+br.call(br.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return br.call(e,t,"$&_")}var ql=Dg,ad=ql.custom,od=bf(ad)?ad:null,Vg=function i(e,t,r,s){var n=t||{};if(dr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(dr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=dr(n,"customInspect")?n.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(dr(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(dr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=n.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return _f(e,n);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return o?nd(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return o?nd(e,c):c}var u=typeof n.depth>"u"?5:n.depth;if(typeof r>"u"&&(r=0),r>=u&&u>0&&typeof e=="object")return Ql(e)?"[Array]":"[Object]";var h=ly(n,r);if(typeof s>"u")s=[];else if(wf(s,e)>=0)return"[Circular]";function d(C,w,G){if(w&&(s=zg.call(s),s.push(w)),G){var $={depth:n.depth};return dr(n,"quoteStyle")&&($.quoteStyle=n.quoteStyle),i(C,$,r+1,s)}return i(C,n,r+1,s)}if(typeof e=="function"&&!ld(e)){var f=Jg(e),p=la(e,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Li.call(p,", ")+" }":"")}if(bf(e)){var m=Vs?br.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):$l.call(e);return typeof e=="object"&&!Vs?un(m):m}if(ny(e)){for(var g="<"+td.call(String(e.nodeName)),y=e.attributes||[],b=0;b",g}if(Ql(e)){if(e.length===0)return"[]";var _=la(e,d);return h&&!oy(_)?"["+Zl(_,h)+"]":"[ "+Li.call(_,", ")+" ]"}if(Yg(e)){var v=la(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!yf.call(e,"cause")?"{ ["+String(e)+"] "+Li.call(id.call("[cause]: "+d(e.cause),v),", ")+" }":v.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Li.call(v,", ")+" }"}if(typeof e=="object"&&a){if(od&&typeof e[od]=="function"&&ql)return ql(e,{depth:u-r});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(ey(e)){var E=[];return Zc&&Zc.call(e,function(C,w){E.push(d(w,e,!0)+" => "+d(C,e))}),hd("Map",eo.call(e),E,h)}if(ry(e)){var I=[];return Jc&&Jc.call(e,function(C){I.push(d(C,e))}),hd("Set",to.call(e),I,h)}if(ty(e))return il("WeakMap");if(sy(e))return il("WeakSet");if(iy(e))return il("WeakRef");if($g(e))return un(d(Number(e)));if(Qg(e))return un(d(Kl.call(e)));if(qg(e))return un(Ng.call(e));if(Kg(e))return un(d(String(e)));if(!Xg(e)&&!ld(e)){var S=la(e,d),R=sd?sd(e)===Object.prototype:e instanceof Object||e.constructor===Object,P=e instanceof Object?"":"null prototype",L=!R&&Dt&&Object(e)===e&&Dt in e?qh.call(Pr(e),8,-1):P?"Object":"",W=R||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",T=W+(L||P?"["+Li.call(id.call([],L||[],P||[]),": ")+"] ":"");return S.length===0?T+"{}":h?T+"{"+Zl(S,h)+"}":T+"{ "+Li.call(S,", ")+" }"}return String(e)};function vf(i,e,t){var r=(t.quoteStyle||e)==="double"?'"':"'";return r+i+r}function jg(i){return br.call(String(i),/"/g,""")}function Ql(i){return Pr(i)==="[object Array]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function Xg(i){return Pr(i)==="[object Date]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function ld(i){return Pr(i)==="[object RegExp]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function Yg(i){return Pr(i)==="[object Error]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function Kg(i){return Pr(i)==="[object String]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function $g(i){return Pr(i)==="[object Number]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function qg(i){return Pr(i)==="[object Boolean]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function bf(i){if(Vs)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!$l)return!1;try{return $l.call(i),!0}catch{}return!1}function Qg(i){if(!i||typeof i!="object"||!Kl)return!1;try{return Kl.call(i),!0}catch{}return!1}var Zg=Object.prototype.hasOwnProperty||function(i){return i in this};function dr(i,e){return Zg.call(i,e)}function Pr(i){return Ug.call(i)}function Jg(i){if(i.name)return i.name;var e=Gg.call(Hg.call(i),/^function\s*([\w$]+)/);return e?e[1]:null}function wf(i,e){if(i.indexOf)return i.indexOf(e);for(var t=0,r=i.length;te.maxStringLength){var t=i.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return _f(qh.call(i,0,e.maxStringLength),e)+r}var s=br.call(br.call(i,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ay);return vf(s,"single",e)}function ay(i){var e=i.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+Wg.call(e.toString(16))}function un(i){return"Object("+i+")"}function il(i){return i+" { ? }"}function hd(i,e,t,r){var s=r?Zl(t,r):Li.call(t,", ");return i+" ("+e+") {"+s+"}"}function oy(i){for(var e=0;e=0)return!1;return!0}function ly(i,e){var t;if(i.indent===" ")t=" ";else if(typeof i.indent=="number"&&i.indent>0)t=Li.call(Array(i.indent+1)," ");else return null;return{base:t,prev:Li.call(Array(e+1),t)}}function Zl(i,e){if(i.length===0)return"";var t=` -`+e.prev+e.base;return t+Li.call(i,","+t)+` -`+e.prev}function la(i,e){var t=Ql(i),r=[];if(t){r.length=i.length;for(var s=0;s1;){var t=e.pop(),r=t.obj[t.prop];if(zr(r)){for(var s=[],n=0;n=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||n===Ay.RFC1738&&(c===40||c===41)){o+=a.charAt(l);continue}if(c<128){o=o+Ii[c];continue}if(c<2048){o=o+(Ii[192|c>>6]+Ii[128|c&63]);continue}if(c<55296||c>=57344){o=o+(Ii[224|c>>12]+Ii[128|c>>6&63]+Ii[128|c&63]);continue}l+=1,c=65536+((c&1023)<<10|a.charCodeAt(l)&1023),o+=Ii[240|c>>18]+Ii[128|c>>12&63]+Ii[128|c>>6&63]+Ii[128|c&63]}return o},ky=function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],s=0;s"u"&&(_=0)}if(typeof l=="function"?y=l(t,y):y instanceof Date?y=h(y):r==="comma"&&$i(y)&&(y=Ga.maybeMap(y,function($){return $ instanceof Date?h($):$})),y===null){if(n)return o&&!p?o(t,Pt.encoder,m,"key",d):t;y=""}if(Fy(y)||Ga.isBuffer(y)){if(o){var I=p?t:o(t,Pt.encoder,m,"key",d);return[f(I)+"="+f(o(y,Pt.encoder,m,"value",d))]}return[f(t)+"="+f(String(y))]}var S=[];if(typeof y>"u")return S;var R;if(r==="comma"&&$i(y))p&&o&&(y=Ga.maybeMap(y,o)),R=[{value:y.length>0?y.join(",")||null:void 0}];else if($i(l))R=l;else{var P=Object.keys(y);R=c?P.sort(c):P}for(var L=s&&$i(y)&&y.length===1?t+"[]":t,W=0;W"u"?Pt.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Pt.charsetSentinel,delimiter:typeof e.delimiter>"u"?Pt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Pt.encode,encoder:typeof e.encoder=="function"?e.encoder:Pt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Pt.encodeValuesOnly,filter:n,format:r,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Pt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Pt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Pt.strictNullHandling}},Hy=function(i,e){var t=i,r=Uy(e),s,n;typeof r.filter=="function"?(n=r.filter,t=n("",t)):$i(r.filter)&&(n=r.filter,s=n);var a=[];if(typeof t!="object"||t===null)return"";var o;e&&e.arrayFormat in cd?o=e.arrayFormat:e&&"indices"in e?o=e.indices?"indices":"repeat":o="indices";var l=cd[o];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var c=l==="comma"&&e&&e.commaRoundTrip;s||(s=Object.keys(t)),r.sort&&s.sort(r.sort);for(var u=Ef(),h=0;h0?p+f:""},js=Af,Jl=Object.prototype.hasOwnProperty,Gy=Array.isArray,bt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:js.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Wy=function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Sf=function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},zy="utf8=%26%2310003%3B",Vy="utf8=%E2%9C%93",jy=function(e,t){var r={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,n=t.parameterLimit===1/0?void 0:t.parameterLimit,a=s.split(t.delimiter,n),o=-1,l,c=t.charset;if(t.charsetSentinel)for(l=0;l-1&&(p=Gy(p)?[p]:p),Jl.call(r,f)?r[f]=js.combine(r[f],p):r[f]=p}return r},Xy=function(i,e,t,r){for(var s=r?e:Sf(e,t),n=i.length-1;n>=0;--n){var a,o=i[n];if(o==="[]"&&t.parseArrays)a=[].concat(s);else{a=t.plainObjects?Object.create(null):{};var l=o.charAt(0)==="["&&o.charAt(o.length-1)==="]"?o.slice(1,-1):o,c=parseInt(l,10);!t.parseArrays&&l===""?a={0:s}:!isNaN(c)&&o!==l&&String(c)===l&&c>=0&&t.parseArrays&&c<=t.arrayLimit?(a=[],a[c]=s):l!=="__proto__"&&(a[l]=s)}s=a}return s},Yy=function(e,t,r,s){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,o=/(\[[^[\]]*])/g,l=r.depth>0&&a.exec(n),c=l?n.slice(0,l.index):n,u=[];if(c){if(!r.plainObjects&&Jl.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}for(var h=0;r.depth>0&&(l=o.exec(n))!==null&&h"u"?bt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?bt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:bt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:bt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:bt.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:bt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:bt.comma,decoder:typeof e.decoder=="function"?e.decoder:bt.decoder,delimiter:typeof e.delimiter=="string"||js.isRegExp(e.delimiter)?e.delimiter:bt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:bt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:bt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:bt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:bt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:bt.strictNullHandling}},$y=function(i,e){var t=Ky(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?jy(i,t):i,s=t.plainObjects?Object.create(null):{},n=Object.keys(r),a=0;a",'"',"`"," ","\r",` -`," "],nv=["{","}","|","\\","^","`"].concat(sv),eh=["'"].concat(nv),ud=["%","/","?",";","#"].concat(eh),fd=["/","?","#"],av=255,pd=/^[+a-z0-9A-Z_-]{0,63}$/,ov=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,lv={javascript:!0,"javascript:":!0},th={javascript:!0,"javascript:":!0},Ns={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},ih=Jy;function Ao(i,e,t){if(i&&typeof i=="object"&&i instanceof Ei)return i;var r=new Ei;return r.parse(i,e,t),r}Ei.prototype.parse=function(i,e,t){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var r=i.indexOf("?"),s=r!==-1&&r127?E+="x":E+=v[I];if(!E.match(pd)){var R=b.slice(0,f),P=b.slice(f+1),L=v.match(ov);L&&(R.push(L[1]),P.unshift(L[2])),P.length&&(o="/"+P.join(".")+o),this.hostname=R.join(".");break}}}this.hostname.length>av?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=ev.toASCII(this.hostname));var W=this.port?":"+this.port:"",T=this.hostname||"";this.host=T+W,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!lv[u])for(var f=0,_=eh.length;f<_;f++){var C=eh[f];if(o.indexOf(C)!==-1){var w=encodeURIComponent(C);w===C&&(w=escape(C)),o=o.split(C).join(w)}}var G=o.indexOf("#");G!==-1&&(this.hash=o.substr(G),o=o.slice(0,G));var $=o.indexOf("?");if($!==-1?(this.search=o.substr($),this.query=o.substr($+1),e&&(this.query=ih.parse(this.query)),o=o.slice(0,$)):e&&(this.search="",this.query={}),o&&(this.pathname=o),Ns[u]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var W=this.pathname||"",z=this.search||"";this.path=W+z}return this.href=this.format(),this};function hv(i){return typeof i=="string"&&(i=Ao(i)),i instanceof Ei?i.format():Ei.prototype.format.call(i)}Ei.prototype.format=function(){var i=this.auth||"";i&&(i=encodeURIComponent(i),i=i.replace(/%3A/i,":"),i+="@");var e=this.protocol||"",t=this.pathname||"",r=this.hash||"",s=!1,n="";this.host?s=i+this.host:this.hostname&&(s=i+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(n=ih.stringify(this.query));var a=this.search||n&&"?"+n||"";return e&&e.substr(-1)!==":"&&(e+=":"),this.slashes||(!e||Ns[e])&&s!==!1?(s="//"+(s||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):s||(s=""),r&&r.charAt(0)!=="#"&&(r="#"+r),a&&a.charAt(0)!=="?"&&(a="?"+a),t=t.replace(/[?#]/g,function(o){return encodeURIComponent(o)}),a=a.replace("#","%23"),e+s+t+a+r};function cv(i,e){return Ao(i,!1,!0).resolve(e)}Ei.prototype.resolve=function(i){return this.resolveObject(Ao(i,!1,!0)).format()};Ei.prototype.resolveObject=function(i){if(typeof i=="string"){var e=new Ei;e.parse(i,!1,!0),i=e}for(var t=new Ei,r=Object.keys(this),s=0;s0?t.host.split("@"):!1;E&&(t.auth=E.shift(),t.hostname=E.shift(),t.host=t.hostname)}return t.search=i.search,t.query=i.query,(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!b.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var I=b.slice(-1)[0],S=(t.host||i.host||b.length>1)&&(I==="."||I==="..")||I==="",R=0,P=b.length;P>=0;P--)I=b[P],I==="."?b.splice(P,1):I===".."?(b.splice(P,1),R++):R&&(b.splice(P,1),R--);if(!g&&!y)for(;R--;R)b.unshift("..");g&&b[0]!==""&&(!b[0]||b[0].charAt(0)!=="/")&&b.unshift(""),S&&b.join("/").substr(-1)!=="/"&&b.push("");var L=b[0]===""||b[0]&&b[0].charAt(0)==="/";if(v){t.hostname=L?"":b.length?b.shift():"",t.host=t.hostname;var E=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;E&&(t.auth=E.shift(),t.hostname=E.shift(),t.host=t.hostname)}return g=g||t.host&&b.length,g&&!L&&b.unshift(""),b.length>0?t.pathname=b.join("/"):(t.pathname=null,t.path=null),(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=i.auth||t.auth,t.slashes=t.slashes||i.slashes,t.href=t.format(),t};Ei.prototype.parseHost=function(){var i=this.host,e=iv.exec(i);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),i=i.substr(0,i.length-e.length)),i&&(this.hostname=i)};var dv=Ao,uv=cv,fv=hv;const pv={parse:dv,format:fv,resolve:uv};function di(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function fn(i){return i.split("?")[0].split("#")[0]}function mv(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function gv(i,e,t){return i.replace(new RegExp(mv(e),"g"),t)}function yv(i,e){let t="",r=0,s=-1,n=0,a=-1;for(let o=0;o<=i.length;++o){if(o2){const l=t.lastIndexOf("/");if(l!==t.length-1){l===-1?(t="",r=0):(t=t.slice(0,l),r=t.length-1-t.lastIndexOf("/")),s=o,n=0;continue}}else if(t.length===2||t.length===1){t="",r=0,s=o,n=0;continue}}e&&(t.length>0?t+="/..":t="..",r=2)}else t.length>0?t+=`/${i.slice(s+1,o)}`:t=i.slice(s+1,o),r=o-s-1;s=o,n=0}else a===46&&n!==-1?++n:n=-1}return t}const Rt={toPosix(i){return gv(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)},hasProtocol(i){return/^[^/:]+:\//.test(this.toPosix(i))},getProtocol(i){di(i),i=this.toPosix(i);let e="";const t=/^file:\/\/\//.exec(i),r=/^[^/:]+:\/\//.exec(i),s=/^[^/:]+:\//.exec(i);if(t||r||s){const n=t?.[0]||r?.[0]||s?.[0];e=n,i=i.slice(n.length)}return e},toAbsolute(i,e,t){if(this.isDataUrl(i))return i;const r=fn(this.toPosix(e??fe.ADAPTER.getBaseUrl())),s=fn(this.toPosix(t??this.rootname(r)));return di(i),i=this.toPosix(i),i.startsWith("/")?Rt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(i=this.toPosix(i),di(i),i.length===0)return".";let e="";const t=i.startsWith("/");this.hasProtocol(i)&&(e=this.rootname(i),i=i.slice(e.length));const r=i.endsWith("/");return i=yv(i,!1),i.length>0&&r&&(i+="/"),t?`/${i}`:e+i},isAbsolute(i){return di(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=r;else{const s=i[t-1]??"";this.extname(s)?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(i){if(di(i),i.length===0)return".";i=this.toPosix(i);let e=i.charCodeAt(0);const t=e===47;let r=-1,s=!0;const n=this.getProtocol(i),a=i;i=i.slice(n.length);for(let o=i.length-1;o>=1;--o)if(e=i.charCodeAt(o),e===47){if(!s){r=o;break}}else s=!1;return r===-1?t?"/":this.isUrl(a)?n+i:n:t&&r===1?"//":n+i.slice(0,r)},rootname(i){di(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){di(i),e&&di(e),i=fn(this.toPosix(i));let t=0,r=-1,s=!0,n;if(e!==void 0&&e.length>0&&e.length<=i.length){if(e.length===i.length&&e===i)return"";let a=e.length-1,o=-1;for(n=i.length-1;n>=0;--n){const l=i.charCodeAt(n);if(l===47){if(!s){t=n+1;break}}else o===-1&&(s=!1,o=n+1),a>=0&&(l===e.charCodeAt(a)?--a===-1&&(r=n):(a=-1,r=o))}return t===r?r=o:r===-1&&(r=i.length),i.slice(t,r)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!s){t=n+1;break}}else r===-1&&(s=!1,r=n+1);return r===-1?"":i.slice(t,r)},extname(i){di(i),i=fn(this.toPosix(i));let e=-1,t=0,r=-1,s=!0,n=0;for(let a=i.length-1;a>=0;--a){const o=i.charCodeAt(a);if(o===47){if(!s){t=a+1;break}continue}r===-1&&(s=!1,r=a+1),o===46?e===-1?e=a:n!==1&&(n=1):e!==-1&&(n=-1)}return e===-1||r===-1||n===0||n===1&&e===r-1&&e===t+1?"":i.slice(e,r)},parse(i){di(i);const e={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return e;i=fn(this.toPosix(i));let t=i.charCodeAt(0);const r=this.isAbsolute(i);let s;e.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,o=-1,l=!0,c=i.length-1,u=0;for(;c>=s;--c){if(t=i.charCodeAt(c),t===47){if(!l){a=c+1;break}continue}o===-1&&(l=!1,o=c+1),t===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||o===-1||u===0||u===1&&n===o-1&&n===a+1?o!==-1&&(a===0&&r?e.base=e.name=i.slice(1,o):e.base=e.name=i.slice(a,o)):(a===0&&r?(e.name=i.slice(1,n),e.base=i.slice(1,o)):(e.name=i.slice(a,n),e.base=i.slice(a,o)),e.ext=i.slice(n,o)),e.dir=this.dirname(i),e},sep:"/",delimiter:":"},md={};function Ue(i,e,t=3){if(md[e])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${e} +var Rm=Object.defineProperty;var Dm=(i,e,t)=>e in i?Rm(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var qo=(i,e,t)=>(Dm(i,typeof e!="symbol"?e+"":e,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const n of s)if(n.type==="childList")for(const a of n.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function t(s){const n={};return s.integrity&&(n.integrity=s.integrity),s.referrerPolicy&&(n.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?n.credentials="include":s.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function r(s){if(s.ep)return;s.ep=!0;const n=t(s);fetch(s.href,n)}})();(()=>{var i={701:r=>{let s=0;r.exports={incr:()=>++s,decr:()=>--s,curr:()=>s}},941:r=>{r.exports=(s,n,a="")=>{const o=/url\(['"]?#([\w:.-]+)['"]?\)/g,l=/#([\w:.-]+)/g;return n.match(o)&&(n=n.replace(o,function(c,u){return s[u]?`url(#${s[u]})`:c})),["href","xlink:href"].includes(a)&&n.match(l)&&(n=n.replace(l,function(c,u){return s[u]?`#${s[u]}`:c})),n}},905:r=>{r.exports=(s,n,a)=>{const o=new RegExp(`([^\r +,{}]+)(,(?=[^}]*{)|s*{)`,"g");return s.replace(o,function(l,c,u){if(c.match(/^\s*(@media|@.*keyframes|to|from|@font-face|1?[0-9]?[0-9])/))return c+u;const h=c.match(/#(\w+)/);return h&&a[h[1]]&&(c=c.replace(h[0],`#${a[h[1]]}`)),(c=c.replace(/^(\s*)/,"$1"+n+" "))+u})}},678:(r,s,n)=>{function a(S){return new Promise((T,B)=>{S.oncomplete=S.onsuccess=()=>T(S.result),S.onabort=S.onerror=()=>B(S.error)})}function o(S,T){const B=indexedDB.open(S);B.onupgradeneeded=()=>B.result.createObjectStore(T);const k=a(B);return(D,W)=>k.then(C=>W(C.transaction(T,D).objectStore(T)))}let l;function c(){return l||(l=o("keyval-store","keyval")),l}function u(S,T=c()){return T("readonly",B=>a(B.get(S)))}function h(S,T,B=c()){return B("readwrite",k=>(k.put(T,S),a(k.transaction)))}function d(S,T=c()){return T("readwrite",B=>(S.forEach(k=>B.put(k[1],k[0])),a(B.transaction)))}function f(S,T=c()){return T("readonly",B=>Promise.all(S.map(k=>a(B.get(k)))))}function p(S,T,B=c()){return B("readwrite",k=>new Promise((D,W)=>{k.get(S).onsuccess=function(){try{k.put(T(this.result),S),D(a(k.transaction))}catch(C){W(C)}}}))}function m(S,T=c()){return T("readwrite",B=>(B.delete(S),a(B.transaction)))}function g(S,T=c()){return T("readwrite",B=>(S.forEach(k=>B.delete(k)),a(B.transaction)))}function y(S=c()){return S("readwrite",T=>(T.clear(),a(T.transaction)))}function b(S,T){return S.openCursor().onsuccess=function(){this.result&&(T(this.result),this.result.continue())},a(S.transaction)}function w(S=c()){return S("readonly",T=>{if(T.getAllKeys)return a(T.getAllKeys());const B=[];return b(T,k=>B.push(k.key)).then(()=>B)})}function v(S=c()){return S("readonly",T=>{if(T.getAll)return a(T.getAll());const B=[];return b(T,k=>B.push(k.value)).then(()=>B)})}function E(S=c()){return S("readonly",T=>{if(T.getAll&&T.getAllKeys)return Promise.all([a(T.getAllKeys()),a(T.getAll())]).then(([k,D])=>k.map((W,C)=>[W,D[C]]));const B=[];return S("readonly",k=>b(k,D=>B.push([D.key,D.value])).then(()=>B))})}n.r(s),n.d(s,{clear:()=>y,createStore:()=>o,del:()=>m,delMany:()=>g,entries:()=>E,get:()=>u,getMany:()=>f,keys:()=>w,promisifyRequest:()=>a,set:()=>h,setMany:()=>d,update:()=>p,values:()=>v})}},e={};function t(r){var s=e[r];if(s!==void 0)return s.exports;var n=e[r]={exports:{}};return i[r](n,n.exports,t),n.exports}t.d=(r,s)=>{for(var n in s)t.o(s,n)&&!t.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:s[n]})},t.o=(r,s)=>Object.prototype.hasOwnProperty.call(r,s),t.r=r=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},(()=>{const{get:r,set:s,del:n,entries:a}=t(678),o=t(905),l=t(941),c=t(701),u=[],h={},d=(v,E,S)=>{const{enableJs:T,disableUniqueIds:B,disableCssScoping:k,spriteIconId:D}=E,W=!!D,C=new DOMParser().parseFromString(S,"text/html"),M=W?C.getElementById(D):C.querySelector("svg"),_=(()=>{if(u.length)return u;for(const V in document.body)V.startsWith("on")&&u.push(V);return u.push("onbegin","onend","onrepeat"),u.push("onfocusin","onfocusout","onbounce","onfinish","onshow"),u})(),U=h[v.getAttribute("data-id")]||new Set,Y=v.getAttribute("data-id")||`svg-loader_${c.incr()}`,z={};if(B||Array.from(M.querySelectorAll("[id]")).forEach(V=>{const $=V.getAttribute("id"),O=`${$}_${c.incr()}`;V.setAttribute("id",O),z[$]=O}),Array.from(M.querySelectorAll("*")).concat(M).forEach(V=>{if(V.tagName==="script"){if(V.remove(),!T)return;{const O=document.createElement("script");O.appendChild(V.childNodes[0]),v.appendChild(O)}}const $=[];for(let O=0;OV.removeAttribute(O)),V.tagName==="style"&&!k){let O=o(V.innerHTML,`[data-id="${Y}"]`,z);O=l(z,O),O!==V.innerHTML&&(V.innerHTML=O)}}),v.innerHTML=D?M.outerHTML:M.innerHTML,!W)for(let V=0;V{const E=new URL(v.getAttribute("data-src"),globalThis.location),S=E.toString().replace(E.hash,""),T=E.hash.replace("#",""),B=v.getAttribute("data-cache"),k=v.getAttribute("data-js")==="enabled",D=v.getAttribute("data-unique-ids")==="disabled",W=v.getAttribute("data-css-scoping")==="disabled",C=await(async U=>{let Y;try{Y=await r(`loader_${U}`)}catch{}if(!Y)try{Y=localStorage.getItem(`loader_${U}`)}catch{}if(Y)return Y=JSON.parse(Y),Date.now()m(v),20);f[S]=!0,fetch(S).then(U=>{if(!U.ok)throw Error(`Request for '${S}' returned ${U.status} (${U.statusText})`);return U.text()}).then(U=>{const Y=U.toLowerCase().trim();if(!(Y.startsWith("{const $=parseInt(V,10),O=JSON.stringify({data:ne,expiry:Date.now()+(Number.isNaN($)?2592e6:1e3*$)});try{await s(`loader_${z}`,O)}catch{try{localStorage.setItem(`loader_${z}`,O)}catch(re){console.warn("Failed to set cache: ",re)}}})(S,U,B),p[S]=U,_(U)}).catch(U=>{console.error(U)}).finally(()=>{delete f[S]})}};let g;globalThis.IntersectionObserver&&(g=new IntersectionObserver(v=>{v.forEach(E=>{E.isIntersecting&&(m(E.target),g.unobserve(E.target))})},{rootMargin:"1200px"}));const y=[];function b(){Array.from(document.querySelectorAll("svg[data-src]:not([data-id])")).forEach(v=>{y.indexOf(v)===-1&&(y.push(v),v.getAttribute("data-loading")==="lazy"?g.observe(v):m(v))})}let w=!1;if(globalThis.addEventListener){let E=function(){clearInterval(v),b(),w||(w=!0,new MutationObserver(S=>{S.some(T=>Array.from(T.addedNodes).some(B=>B.nodeType===Node.ELEMENT_NODE&&(B.getAttribute("data-src")&&!B.getAttribute("data-id")||B.querySelector("svg[data-src]:not([data-id])"))))&&b(),S.forEach(T=>{T.type==="attributes"&&m(T.target)})}).observe(document.documentElement,{attributeFilter:["data-src"],attributes:!0,childList:!0,subtree:!0}))};const v=setInterval(()=>{b()},100);document.readyState==="interactive"?E():globalThis.addEventListener("DOMContentLoaded",()=>{E()})}globalThis.SVGLoader={},globalThis.SVGLoader.destroyCache=async()=>{try{const v=await a();for(const E of v)E[0].startsWith("loader_")&&await n(E[0])}catch{}Object.keys(localStorage).forEach(v=>{v.startsWith("loader_")&&localStorage.removeItem(v)})}})()})();var ds=(i=>(i[i.WEBGL_LEGACY=0]="WEBGL_LEGACY",i[i.WEBGL=1]="WEBGL",i[i.WEBGL2=2]="WEBGL2",i))(ds||{}),af=(i=>(i[i.UNKNOWN=0]="UNKNOWN",i[i.WEBGL=1]="WEBGL",i[i.CANVAS=2]="CANVAS",i))(af||{}),jl=(i=>(i[i.COLOR=16384]="COLOR",i[i.DEPTH=256]="DEPTH",i[i.STENCIL=1024]="STENCIL",i))(jl||{}),Ae=(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))(Ae||{}),Ni=(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))(Ni||{}),ce=(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))(ce||{}),Fs=(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))(Fs||{}),Ee=(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))(Ee||{}),Xl=(i=>(i[i.FLOAT=0]="FLOAT",i[i.INT=1]="INT",i[i.UINT=2]="UINT",i))(Xl||{}),Ki=(i=>(i[i.NEAREST=0]="NEAREST",i[i.LINEAR=1]="LINEAR",i))(Ki||{}),Ar=(i=>(i[i.CLAMP=33071]="CLAMP",i[i.REPEAT=10497]="REPEAT",i[i.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",i))(Ar||{}),$t=(i=>(i[i.OFF=0]="OFF",i[i.POW2=1]="POW2",i[i.ON=2]="ON",i[i.ON_MANUAL=3]="ON_MANUAL",i))($t||{}),Ii=(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))(Ii||{}),Li=(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))(Li||{}),jh=(i=>(i[i.AUTO=0]="AUTO",i[i.MANUAL=1]="MANUAL",i))(jh||{}),si=(i=>(i.LOW="lowp",i.MEDIUM="mediump",i.HIGH="highp",i))(si||{}),mt=(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))(mt||{}),ft=(i=>(i[i.NONE=0]="NONE",i[i.LOW=2]="LOW",i[i.MEDIUM=4]="MEDIUM",i[i.HIGH=8]="HIGH",i))(ft||{}),Ui=(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))(Ui||{});const Lm={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")},fe={ADAPTER:Lm,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1};var Ko=/iPhone/i,Lc=/iPod/i,Oc=/iPad/i,Fc=/\biOS-universal(?:.+)Mac\b/i,Qo=/\bAndroid(?:.+)Mobile\b/i,Nc=/Android/i,gs=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,aa=/Silk/i,ji=/Windows Phone/i,Uc=/\bWindows(?:.+)ARM\b/i,Hc=/BlackBerry/i,Gc=/BB10/i,Wc=/Opera Mini/i,zc=/\b(CriOS|Chrome)(?:.+)Mobile/i,Vc=/Mobile(?:.+)Firefox\b/i,jc=function(i){return typeof i<"u"&&i.platform==="MacIntel"&&typeof i.maxTouchPoints=="number"&&i.maxTouchPoints>1&&typeof MSStream>"u"};function Om(i){return function(e){return e.test(i)}}function Xc(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,r=t.split("[FBAN");typeof r[1]<"u"&&(t=r[0]),r=t.split("Twitter"),typeof r[1]<"u"&&(t=r[0]);var s=Om(t),n={apple:{phone:s(Ko)&&!s(ji),ipod:s(Lc),tablet:!s(Ko)&&(s(Oc)||jc(e))&&!s(ji),universal:s(Fc),device:(s(Ko)||s(Lc)||s(Oc)||s(Fc)||jc(e))&&!s(ji)},amazon:{phone:s(gs),tablet:!s(gs)&&s(aa),device:s(gs)||s(aa)},android:{phone:!s(ji)&&s(gs)||!s(ji)&&s(Qo),tablet:!s(ji)&&!s(gs)&&!s(Qo)&&(s(aa)||s(Nc)),device:!s(ji)&&(s(gs)||s(aa)||s(Qo)||s(Nc))||s(/\bokhttp\b/i)},windows:{phone:s(ji),tablet:s(Uc),device:s(ji)||s(Uc)},other:{blackberry:s(Hc),blackberry10:s(Gc),opera:s(Wc),firefox:s(Vc),chrome:s(zc),device:s(Hc)||s(Gc)||s(Wc)||s(Vc)||s(zc)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}const Fm=Xc.default??Xc,Qi=Fm(globalThis.navigator);fe.RETINA_PREFIX=/@([0-9\.]+)x/;fe.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ii=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kn(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Nm(i){if(i.__esModule)return i;var e=i.default;if(typeof e=="function"){var t=function r(){return this instanceof r?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(r){var s=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:function(){return i[r]}})}),t}var of={exports:{}};(function(i){var e=Object.prototype.hasOwnProperty,t="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(t=!1));function s(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function n(l,c,u,h,d){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new s(u,h||l,d),p=t?t+c:c;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],f]:l._events[p].push(f):(l._events[p]=f,l._eventsCount++),l}function a(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var c=[],u,h;if(this._eventsCount===0)return c;for(h in u=this._events)e.call(u,h)&&c.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},o.prototype.listeners=function(c){var u=t?t+c:c,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,f=h.length,p=new Array(f);d80*t){o=c=i[0],l=u=i[1];for(var p=t;pc&&(c=h),d>u&&(u=d);f=Math.max(c-o,u-l),f=f!==0?32767/f:0}return Hn(n,a,t,o,l,f,0),a}function lf(i,e,t,r,s){var n,a;if(s===ql(i,e,t,r)>0)for(n=e;n=e;n-=r)a=Yc(n,i[n],i[n+1],a);return a&&Eo(a,a.next)&&(Wn(a),a=a.next),a}function ns(i,e){if(!i)return i;e||(e=i);var t=i,r;do if(r=!1,!t.steiner&&(Eo(t,t.next)||ct(t.prev,t,t.next)===0)){if(Wn(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Hn(i,e,t,r,s,n,a){if(i){!a&&n&&qm(i,r,s,n);for(var o=i,l,c;i.prev!==i.next;){if(l=i.prev,c=i.next,n?Gm(i,r,s,n):Hm(i)){e.push(l.i/t|0),e.push(i.i/t|0),e.push(c.i/t|0),Wn(i),i=c.next,o=c.next;continue}if(i=c,i===o){a?a===1?(i=Wm(ns(i),e,t),Hn(i,e,t,r,s,n,2)):a===2&&zm(i,e,t,r,s,n):Hn(ns(i),e,t,r,s,n,1);break}}}}function Hm(i){var e=i.prev,t=i,r=i.next;if(ct(e,t,r)>=0)return!1;for(var s=e.x,n=t.x,a=r.x,o=e.y,l=t.y,c=r.y,u=sn?s>a?s:a:n>a?n:a,f=o>l?o>c?o:c:l>c?l:c,p=r.next;p!==e;){if(p.x>=u&&p.x<=d&&p.y>=h&&p.y<=f&&Ps(s,o,n,l,a,c,p.x,p.y)&&ct(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Gm(i,e,t,r){var s=i.prev,n=i,a=i.next;if(ct(s,n,a)>=0)return!1;for(var o=s.x,l=n.x,c=a.x,u=s.y,h=n.y,d=a.y,f=ol?o>c?o:c:l>c?l:c,g=u>h?u>d?u:d:h>d?h:d,y=Yl(f,p,e,t,r),b=Yl(m,g,e,t,r),w=i.prevZ,v=i.nextZ;w&&w.z>=y&&v&&v.z<=b;){if(w.x>=f&&w.x<=m&&w.y>=p&&w.y<=g&&w!==s&&w!==a&&Ps(o,u,l,h,c,d,w.x,w.y)&&ct(w.prev,w,w.next)>=0||(w=w.prevZ,v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==a&&Ps(o,u,l,h,c,d,v.x,v.y)&&ct(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;w&&w.z>=y;){if(w.x>=f&&w.x<=m&&w.y>=p&&w.y<=g&&w!==s&&w!==a&&Ps(o,u,l,h,c,d,w.x,w.y)&&ct(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;v&&v.z<=b;){if(v.x>=f&&v.x<=m&&v.y>=p&&v.y<=g&&v!==s&&v!==a&&Ps(o,u,l,h,c,d,v.x,v.y)&&ct(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function Wm(i,e,t){var r=i;do{var s=r.prev,n=r.next.next;!Eo(s,n)&&hf(s,r,r.next,n)&&Gn(s,n)&&Gn(n,s)&&(e.push(s.i/t|0),e.push(r.i/t|0),e.push(n.i/t|0),Wn(r),Wn(r.next),r=i=n),r=r.next}while(r!==i);return ns(r)}function zm(i,e,t,r,s,n){var a=i;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&Zm(a,o)){var l=cf(a,o);a=ns(a,a.next),l=ns(l,l.next),Hn(a,e,t,r,s,n,0),Hn(l,e,t,r,s,n,0);return}o=o.next}a=a.next}while(a!==i)}function Vm(i,e,t,r){var s=[],n,a,o,l,c;for(n=0,a=e.length;n=t.next.y&&t.next.y!==t.y){var o=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(o<=r&&o>n&&(n=o,a=t.x=t.x&&t.x>=c&&r!==t.x&&Ps(sa.x||t.x===a.x&&$m(a,t)))&&(a=t,h=d)),t=t.next;while(t!==l);return a}function $m(i,e){return ct(i.prev,i,e.prev)<0&&ct(e.next,i,i.next)<0}function qm(i,e,t,r){var s=i;do s.z===0&&(s.z=Yl(s.x,s.y,e,t,r)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==i);s.prevZ.nextZ=null,s.prevZ=null,Km(s)}function Km(i){var e,t,r,s,n,a,o,l,c=1;do{for(t=i,i=null,n=null,a=0;t;){for(a++,r=t,o=0,e=0;e0||l>0&&r;)o!==0&&(l===0||!r||t.z<=r.z)?(s=t,t=t.nextZ,o--):(s=r,r=r.nextZ,l--),n?n.nextZ=s:i=s,s.prevZ=n,n=s;t=r}n.nextZ=null,c*=2}while(a>1);return i}function Yl(i,e,t,r,s){return i=(i-t)*s|0,e=(e-r)*s|0,i=(i|i<<8)&16711935,i=(i|i<<4)&252645135,i=(i|i<<2)&858993459,i=(i|i<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,i|e<<1}function Qm(i){var e=i,t=i;do(e.x=(i-a)*(n-o)&&(i-a)*(r-o)>=(t-a)*(e-o)&&(t-a)*(n-o)>=(s-a)*(r-o)}function Zm(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!Jm(i,e)&&(Gn(i,e)&&Gn(e,i)&&eg(i,e)&&(ct(i.prev,i,e.prev)||ct(i,e.prev,e))||Eo(i,e)&&ct(i.prev,i,i.next)>0&&ct(e.prev,e,e.next)>0)}function ct(i,e,t){return(e.y-i.y)*(t.x-e.x)-(e.x-i.x)*(t.y-e.y)}function Eo(i,e){return i.x===e.x&&i.y===e.y}function hf(i,e,t,r){var s=la(ct(i,e,t)),n=la(ct(i,e,r)),a=la(ct(t,r,i)),o=la(ct(t,r,e));return!!(s!==n&&a!==o||s===0&&oa(i,t,e)||n===0&&oa(i,r,e)||a===0&&oa(t,i,r)||o===0&&oa(t,e,r))}function oa(i,e,t){return e.x<=Math.max(i.x,t.x)&&e.x>=Math.min(i.x,t.x)&&e.y<=Math.max(i.y,t.y)&&e.y>=Math.min(i.y,t.y)}function la(i){return i>0?1:i<0?-1:0}function Jm(i,e){var t=i;do{if(t.i!==i.i&&t.next.i!==i.i&&t.i!==e.i&&t.next.i!==e.i&&hf(t,t.next,i,e))return!0;t=t.next}while(t!==i);return!1}function Gn(i,e){return ct(i.prev,i,i.next)<0?ct(i,e,i.next)>=0&&ct(i,i.prev,e)>=0:ct(i,e,i.prev)<0||ct(i,i.next,e)<0}function eg(i,e){var t=i,r=!1,s=(i.x+e.x)/2,n=(i.y+e.y)/2;do t.y>n!=t.next.y>n&&t.next.y!==t.y&&s<(t.next.x-t.x)*(n-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==i);return r}function cf(i,e){var t=new $l(i.i,i.x,i.y),r=new $l(e.i,e.x,e.y),s=i.next,n=e.prev;return i.next=e,e.prev=i,t.next=s,s.prev=t,r.next=t,t.prev=r,n.next=r,r.prev=n,r}function Yc(i,e,t,r){var s=new $l(i,e,t);return r?(s.next=r.next,s.prev=r,r.next.prev=s,r.next=s):(s.prev=s,s.next=s),s}function Wn(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function $l(i,e,t){this.i=i,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ao.deviation=function(i,e,t,r){var s=e&&e.length,n=s?e[0]*t:i.length,a=Math.abs(ql(i,0,n,t));if(s)for(var o=0,l=e.length;o0&&(r+=i[s-1].length,t.holes.push(r))}return t};var tg=Xh.exports;const ig=Kn(tg);var Za={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */Za.exports;(function(i,e){(function(t){var r=e&&!e.nodeType&&e,s=i&&!i.nodeType&&i,n=typeof ii=="object"&ⅈ(n.global===n||n.window===n||n.self===n)&&(t=n);var a,o=2147483647,l=36,c=1,u=26,h=38,d=700,f=72,p=128,m="-",g=/^xn--/,y=/[^\x20-\x7E]/,b=/[\x2E\u3002\uFF0E\uFF61]/g,w={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=l-c,E=Math.floor,S=String.fromCharCode,T;function B($){throw new RangeError(w[$])}function k($,O){for(var N=$.length,re=[];N--;)re[N]=O($[N]);return re}function D($,O){var N=$.split("@"),re="";N.length>1&&(re=N[0]+"@",$=N[1]),$=$.replace(b,".");var ee=$.split("."),Q=k(ee,O).join(".");return re+Q}function W($){for(var O=[],N=0,re=$.length,ee,Q;N=55296&&ee<=56319&&N65535&&(O-=65536,N+=S(O>>>10&1023|55296),O=56320|O&1023),N+=S(O),N}).join("")}function M($){return $-48<10?$-22:$-65<26?$-65:$-97<26?$-97:l}function _($,O){return $+22+75*($<26)-((O!=0)<<5)}function U($,O,N){var re=0;for($=N?E($/d):$>>1,$+=E($/O);$>v*u>>1;re+=l)$=E($/v);return E(re+(v+1)*$/($+h))}function Y($){var O=[],N=$.length,re,ee=0,Q=p,ge=f,Te,me,be,Se,we,Re,Le,x,K;for(Te=$.lastIndexOf(m),Te<0&&(Te=0),me=0;me=128&&B("not-basic"),O.push($.charCodeAt(me));for(be=Te>0?Te+1:0;be=N&&B("invalid-input"),Le=M($.charCodeAt(be++)),(Le>=l||Le>E((o-ee)/we))&&B("overflow"),ee+=Le*we,x=Re<=ge?c:Re>=ge+u?u:Re-ge,!(LeE(o/K)&&B("overflow"),we*=K;re=O.length+1,ge=U(ee-Se,re,Se==0),E(ee/re)>o-Q&&B("overflow"),Q+=E(ee/re),ee%=re,O.splice(ee++,0,Q)}return C(O)}function z($){var O,N,re,ee,Q,ge,Te,me,be,Se,we,Re=[],Le,x,K,X;for($=W($),Le=$.length,O=p,N=0,Q=f,ge=0;ge=O&&weE((o-N)/x)&&B("overflow"),N+=(Te-O)*x,O=Te,ge=0;geo&&B("overflow"),we==O){for(me=N,be=l;Se=be<=Q?c:be>=Q+u?u:be-Q,!(me"u"||!wt?Ne:wt(Uint8Array),Zr={"%AggregateError%":typeof AggregateError>"u"?Ne:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?Ne:ArrayBuffer,"%ArrayIteratorPrototype%":ys&&wt?wt([][Symbol.iterator]()):Ne,"%AsyncFromSyncIteratorPrototype%":Ne,"%AsyncFunction%":xs,"%AsyncGenerator%":xs,"%AsyncGeneratorFunction%":xs,"%AsyncIteratorPrototype%":xs,"%Atomics%":typeof Atomics>"u"?Ne:Atomics,"%BigInt%":typeof BigInt>"u"?Ne:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?Ne:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?Ne:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?Ne:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?Ne:Float32Array,"%Float64Array%":typeof Float64Array>"u"?Ne:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?Ne:FinalizationRegistry,"%Function%":df,"%GeneratorFunction%":xs,"%Int8Array%":typeof Int8Array>"u"?Ne:Int8Array,"%Int16Array%":typeof Int16Array>"u"?Ne:Int16Array,"%Int32Array%":typeof Int32Array>"u"?Ne:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ys&&wt?wt(wt([][Symbol.iterator]())):Ne,"%JSON%":typeof JSON=="object"?JSON:Ne,"%Map%":typeof Map>"u"?Ne:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ys||!wt?Ne:wt(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?Ne:Promise,"%Proxy%":typeof Proxy>"u"?Ne:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?Ne:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?Ne:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ys||!wt?Ne:wt(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?Ne:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ys&&wt?wt(""[Symbol.iterator]()):Ne,"%Symbol%":ys?Symbol:Ne,"%SyntaxError%":Vs,"%ThrowTypeError%":gg,"%TypedArray%":vg,"%TypeError%":Ns,"%Uint8Array%":typeof Uint8Array>"u"?Ne:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?Ne:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?Ne:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?Ne:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?Ne:WeakMap,"%WeakRef%":typeof WeakRef>"u"?Ne:WeakRef,"%WeakSet%":typeof WeakSet>"u"?Ne:WeakSet};if(wt)try{null.error}catch(i){var bg=wt(wt(i));Zr["%Error.prototype%"]=bg}var wg=function i(e){var t;if(e==="%AsyncFunction%")t=Jo("async function () {}");else if(e==="%GeneratorFunction%")t=Jo("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Jo("async function* () {}");else if(e==="%AsyncGenerator%"){var r=i("%AsyncGeneratorFunction%");r&&(t=r.prototype)}else if(e==="%AsyncIteratorPrototype%"){var s=i("%AsyncGenerator%");s&&wt&&(t=wt(s.prototype))}return Zr[e]=t,t},Kc={"%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"]},Qn=Yh,Ja=mg,_g=Qn.call(Function.call,Array.prototype.concat),xg=Qn.call(Function.apply,Array.prototype.splice),Qc=Qn.call(Function.call,String.prototype.replace),eo=Qn.call(Function.call,String.prototype.slice),Ag=Qn.call(Function.call,RegExp.prototype.exec),Eg=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Tg=/\\(\\)?/g,Sg=function(e){var t=eo(e,0,1),r=eo(e,-1);if(t==="%"&&r!=="%")throw new Vs("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&t!=="%")throw new Vs("invalid intrinsic syntax, expected opening `%`");var s=[];return Qc(e,Eg,function(n,a,o,l){s[s.length]=o?Qc(l,Tg,"$1"):a||n}),s},Cg=function(e,t){var r=e,s;if(Ja(Kc,r)&&(s=Kc[r],r="%"+s[0]+"%"),Ja(Zr,r)){var n=Zr[r];if(n===xs&&(n=wg(r)),typeof n>"u"&&!t)throw new Ns("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:s,name:r,value:n}}throw new Vs("intrinsic "+e+" does not exist!")},$h=function(e,t){if(typeof e!="string"||e.length===0)throw new Ns("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new Ns('"allowMissing" argument must be a boolean');if(Ag(/^%?[^%]*%?$/,e)===null)throw new Vs("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Sg(e),s=r.length>0?r[0]:"",n=Cg("%"+s+"%",t),a=n.name,o=n.value,l=!1,c=n.alias;c&&(s=c[0],xg(r,_g([0,1],c)));for(var u=1,h=!0;u=r.length){var m=Qr(o,d);h=!!m,h&&"get"in m&&!("originalValue"in m.get)?o=m.get:o=o[d]}else h=Ja(o,d),o=o[d];h&&!l&&(Zr[a]=o)}}return o},uf={exports:{}};(function(i){var e=Yh,t=$h,r=t("%Function.prototype.apply%"),s=t("%Function.prototype.call%"),n=t("%Reflect.apply%",!0)||e.call(s,r),a=t("%Object.getOwnPropertyDescriptor%",!0),o=t("%Object.defineProperty%",!0),l=t("%Math.max%");if(o)try{o({},"a",{value:1})}catch{o=null}i.exports=function(h){var d=n(e,s,arguments);if(a&&o){var f=a(d,"length");f.configurable&&o(d,"length",{value:1+l(0,h.length-(arguments.length-1))})}return d};var c=function(){return n(e,r,arguments)};o?o(i.exports,"apply",{value:c}):i.exports.apply=c})(uf);var Mg=uf.exports,ff=$h,pf=Mg,kg=pf(ff("String.prototype.indexOf")),Ig=function(e,t){var r=ff(e,!!t);return typeof r=="function"&&kg(e,".prototype.")>-1?pf(r):r};const Pg={},Bg=Object.freeze(Object.defineProperty({__proto__:null,default:Pg},Symbol.toStringTag,{value:"Module"})),Rg=Nm(Bg);var qh=typeof Map=="function"&&Map.prototype,tl=Object.getOwnPropertyDescriptor&&qh?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,to=qh&&tl&&typeof tl.get=="function"?tl.get:null,Zc=qh&&Map.prototype.forEach,Kh=typeof Set=="function"&&Set.prototype,il=Object.getOwnPropertyDescriptor&&Kh?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,io=Kh&&il&&typeof il.get=="function"?il.get:null,Jc=Kh&&Set.prototype.forEach,Dg=typeof WeakMap=="function"&&WeakMap.prototype,Pn=Dg?WeakMap.prototype.has:null,Lg=typeof WeakSet=="function"&&WeakSet.prototype,Bn=Lg?WeakSet.prototype.has:null,Og=typeof WeakRef=="function"&&WeakRef.prototype,ed=Og?WeakRef.prototype.deref:null,Fg=Boolean.prototype.valueOf,Ng=Object.prototype.toString,Ug=Function.prototype.toString,Hg=String.prototype.match,Qh=String.prototype.slice,br=String.prototype.replace,Gg=String.prototype.toUpperCase,td=String.prototype.toLowerCase,mf=RegExp.prototype.test,id=Array.prototype.concat,Oi=Array.prototype.join,Wg=Array.prototype.slice,rd=Math.floor,Kl=typeof BigInt=="function"?BigInt.prototype.valueOf:null,rl=Object.getOwnPropertySymbols,Ql=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,js=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Dt=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===js||"symbol")?Symbol.toStringTag:null,gf=Object.prototype.propertyIsEnumerable,sd=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(i){return i.__proto__}:null);function nd(i,e){if(i===1/0||i===-1/0||i!==i||i&&i>-1e3&&i<1e3||mf.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof i=="number"){var r=i<0?-rd(-i):rd(i);if(r!==i){var s=String(r),n=Qh.call(e,s.length+1);return br.call(s,t,"$&_")+"."+br.call(br.call(n,/([0-9]{3})/g,"$&_"),/_$/,"")}}return br.call(e,t,"$&_")}var Zl=Rg,ad=Zl.custom,od=vf(ad)?ad:null,zg=function i(e,t,r,s){var n=t||{};if(dr(n,"quoteStyle")&&n.quoteStyle!=="single"&&n.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(dr(n,"maxStringLength")&&(typeof n.maxStringLength=="number"?n.maxStringLength<0&&n.maxStringLength!==1/0:n.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var a=dr(n,"customInspect")?n.customInspect:!0;if(typeof a!="boolean"&&a!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(dr(n,"indent")&&n.indent!==null&&n.indent!==" "&&!(parseInt(n.indent,10)===n.indent&&n.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(dr(n,"numericSeparator")&&typeof n.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var o=n.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return wf(e,n);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return o?nd(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return o?nd(e,c):c}var u=typeof n.depth>"u"?5:n.depth;if(typeof r>"u"&&(r=0),r>=u&&u>0&&typeof e=="object")return Jl(e)?"[Array]":"[Object]";var h=oy(n,r);if(typeof s>"u")s=[];else if(bf(s,e)>=0)return"[Circular]";function d(M,_,U){if(_&&(s=Wg.call(s),s.push(_)),U){var Y={depth:n.depth};return dr(n,"quoteStyle")&&(Y.quoteStyle=n.quoteStyle),i(M,Y,r+1,s)}return i(M,n,r+1,s)}if(typeof e=="function"&&!ld(e)){var f=Zg(e),p=ha(e,d);return"[Function"+(f?": "+f:" (anonymous)")+"]"+(p.length>0?" { "+Oi.call(p,", ")+" }":"")}if(vf(e)){var m=js?br.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ql.call(e);return typeof e=="object"&&!js?fn(m):m}if(sy(e)){for(var g="<"+td.call(String(e.nodeName)),y=e.attributes||[],b=0;b",g}if(Jl(e)){if(e.length===0)return"[]";var w=ha(e,d);return h&&!ay(w)?"["+eh(w,h)+"]":"[ "+Oi.call(w,", ")+" ]"}if(Xg(e)){var v=ha(e,d);return!("cause"in Error.prototype)&&"cause"in e&&!gf.call(e,"cause")?"{ ["+String(e)+"] "+Oi.call(id.call("[cause]: "+d(e.cause),v),", ")+" }":v.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+Oi.call(v,", ")+" }"}if(typeof e=="object"&&a){if(od&&typeof e[od]=="function"&&Zl)return Zl(e,{depth:u-r});if(a!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Jg(e)){var E=[];return Zc&&Zc.call(e,function(M,_){E.push(d(_,e,!0)+" => "+d(M,e))}),hd("Map",to.call(e),E,h)}if(iy(e)){var S=[];return Jc&&Jc.call(e,function(M){S.push(d(M,e))}),hd("Set",io.call(e),S,h)}if(ey(e))return sl("WeakMap");if(ry(e))return sl("WeakSet");if(ty(e))return sl("WeakRef");if($g(e))return fn(d(Number(e)));if(Kg(e))return fn(d(Kl.call(e)));if(qg(e))return fn(Fg.call(e));if(Yg(e))return fn(d(String(e)));if(!jg(e)&&!ld(e)){var T=ha(e,d),B=sd?sd(e)===Object.prototype:e instanceof Object||e.constructor===Object,k=e instanceof Object?"":"null prototype",D=!B&&Dt&&Object(e)===e&&Dt in e?Qh.call(Br(e),8,-1):k?"Object":"",W=B||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",C=W+(D||k?"["+Oi.call(id.call([],D||[],k||[]),": ")+"] ":"");return T.length===0?C+"{}":h?C+"{"+eh(T,h)+"}":C+"{ "+Oi.call(T,", ")+" }"}return String(e)};function yf(i,e,t){var r=(t.quoteStyle||e)==="double"?'"':"'";return r+i+r}function Vg(i){return br.call(String(i),/"/g,""")}function Jl(i){return Br(i)==="[object Array]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function jg(i){return Br(i)==="[object Date]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function ld(i){return Br(i)==="[object RegExp]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function Xg(i){return Br(i)==="[object Error]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function Yg(i){return Br(i)==="[object String]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function $g(i){return Br(i)==="[object Number]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function qg(i){return Br(i)==="[object Boolean]"&&(!Dt||!(typeof i=="object"&&Dt in i))}function vf(i){if(js)return i&&typeof i=="object"&&i instanceof Symbol;if(typeof i=="symbol")return!0;if(!i||typeof i!="object"||!Ql)return!1;try{return Ql.call(i),!0}catch{}return!1}function Kg(i){if(!i||typeof i!="object"||!Kl)return!1;try{return Kl.call(i),!0}catch{}return!1}var Qg=Object.prototype.hasOwnProperty||function(i){return i in this};function dr(i,e){return Qg.call(i,e)}function Br(i){return Ng.call(i)}function Zg(i){if(i.name)return i.name;var e=Hg.call(Ug.call(i),/^function\s*([\w$]+)/);return e?e[1]:null}function bf(i,e){if(i.indexOf)return i.indexOf(e);for(var t=0,r=i.length;te.maxStringLength){var t=i.length-e.maxStringLength,r="... "+t+" more character"+(t>1?"s":"");return wf(Qh.call(i,0,e.maxStringLength),e)+r}var s=br.call(br.call(i,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,ny);return yf(s,"single",e)}function ny(i){var e=i.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+Gg.call(e.toString(16))}function fn(i){return"Object("+i+")"}function sl(i){return i+" { ? }"}function hd(i,e,t,r){var s=r?eh(t,r):Oi.call(t,", ");return i+" ("+e+") {"+s+"}"}function ay(i){for(var e=0;e=0)return!1;return!0}function oy(i,e){var t;if(i.indent===" ")t=" ";else if(typeof i.indent=="number"&&i.indent>0)t=Oi.call(Array(i.indent+1)," ");else return null;return{base:t,prev:Oi.call(Array(e+1),t)}}function eh(i,e){if(i.length===0)return"";var t=` +`+e.prev+e.base;return t+Oi.call(i,","+t)+` +`+e.prev}function ha(i,e){var t=Jl(i),r=[];if(t){r.length=i.length;for(var s=0;s1;){var t=e.pop(),r=t.obj[t.prop];if(jr(r)){for(var s=[],n=0;n=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||n===xy.RFC1738&&(c===40||c===41)){o+=a.charAt(l);continue}if(c<128){o=o+Pi[c];continue}if(c<2048){o=o+(Pi[192|c>>6]+Pi[128|c&63]);continue}if(c<55296||c>=57344){o=o+(Pi[224|c>>12]+Pi[128|c>>6&63]+Pi[128|c&63]);continue}l+=1,c=65536+((c&1023)<<10|a.charCodeAt(l)&1023),o+=Pi[240|c>>18]+Pi[128|c>>12&63]+Pi[128|c>>6&63]+Pi[128|c&63]}return o},My=function(e){for(var t=[{obj:{o:e},prop:"o"}],r=[],s=0;s"u"&&(w=0)}if(typeof l=="function"?y=l(t,y):y instanceof Date?y=h(y):r==="comma"&&qi(y)&&(y=Wa.maybeMap(y,function(Y){return Y instanceof Date?h(Y):Y})),y===null){if(n)return o&&!p?o(t,Pt.encoder,m,"key",d):t;y=""}if(Oy(y)||Wa.isBuffer(y)){if(o){var S=p?t:o(t,Pt.encoder,m,"key",d);return[f(S)+"="+f(o(y,Pt.encoder,m,"value",d))]}return[f(t)+"="+f(String(y))]}var T=[];if(typeof y>"u")return T;var B;if(r==="comma"&&qi(y))p&&o&&(y=Wa.maybeMap(y,o)),B=[{value:y.length>0?y.join(",")||null:void 0}];else if(qi(l))B=l;else{var k=Object.keys(y);B=c?k.sort(c):k}for(var D=s&&qi(y)&&y.length===1?t+"[]":t,W=0;W"u"?Pt.allowDots:!!e.allowDots,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:Pt.charsetSentinel,delimiter:typeof e.delimiter>"u"?Pt.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:Pt.encode,encoder:typeof e.encoder=="function"?e.encoder:Pt.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:Pt.encodeValuesOnly,filter:n,format:r,formatter:s,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:Pt.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:Pt.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:Pt.strictNullHandling}},Uy=function(i,e){var t=i,r=Ny(e),s,n;typeof r.filter=="function"?(n=r.filter,t=n("",t)):qi(r.filter)&&(n=r.filter,s=n);var a=[];if(typeof t!="object"||t===null)return"";var o;e&&e.arrayFormat in cd?o=e.arrayFormat:e&&"indices"in e?o=e.indices?"indices":"repeat":o="indices";var l=cd[o];if(e&&"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var c=l==="comma"&&e&&e.commaRoundTrip;s||(s=Object.keys(t)),r.sort&&s.sort(r.sort);for(var u=Af(),h=0;h0?p+f:""},Xs=xf,th=Object.prototype.hasOwnProperty,Hy=Array.isArray,bt={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:Xs.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Gy=function(i){return i.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Tf=function(i,e){return i&&typeof i=="string"&&e.comma&&i.indexOf(",")>-1?i.split(","):i},Wy="utf8=%26%2310003%3B",zy="utf8=%E2%9C%93",Vy=function(e,t){var r={__proto__:null},s=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,n=t.parameterLimit===1/0?void 0:t.parameterLimit,a=s.split(t.delimiter,n),o=-1,l,c=t.charset;if(t.charsetSentinel)for(l=0;l-1&&(p=Hy(p)?[p]:p),th.call(r,f)?r[f]=Xs.combine(r[f],p):r[f]=p}return r},jy=function(i,e,t,r){for(var s=r?e:Tf(e,t),n=i.length-1;n>=0;--n){var a,o=i[n];if(o==="[]"&&t.parseArrays)a=[].concat(s);else{a=t.plainObjects?Object.create(null):{};var l=o.charAt(0)==="["&&o.charAt(o.length-1)==="]"?o.slice(1,-1):o,c=parseInt(l,10);!t.parseArrays&&l===""?a={0:s}:!isNaN(c)&&o!==l&&String(c)===l&&c>=0&&t.parseArrays&&c<=t.arrayLimit?(a=[],a[c]=s):l!=="__proto__"&&(a[l]=s)}s=a}return s},Xy=function(e,t,r,s){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,o=/(\[[^[\]]*])/g,l=r.depth>0&&a.exec(n),c=l?n.slice(0,l.index):n,u=[];if(c){if(!r.plainObjects&&th.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}for(var h=0;r.depth>0&&(l=o.exec(n))!==null&&h"u"?bt.charset:e.charset;return{allowDots:typeof e.allowDots>"u"?bt.allowDots:!!e.allowDots,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:bt.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:bt.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:bt.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:bt.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:bt.comma,decoder:typeof e.decoder=="function"?e.decoder:bt.decoder,delimiter:typeof e.delimiter=="string"||Xs.isRegExp(e.delimiter)?e.delimiter:bt.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:bt.depth,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:bt.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:bt.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:bt.plainObjects,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:bt.strictNullHandling}},$y=function(i,e){var t=Yy(e);if(i===""||i===null||typeof i>"u")return t.plainObjects?Object.create(null):{};for(var r=typeof i=="string"?Vy(i,t):i,s=t.plainObjects?Object.create(null):{},n=Object.keys(r),a=0;a",'"',"`"," ","\r",` +`," "],sv=["{","}","|","\\","^","`"].concat(rv),ih=["'"].concat(sv),ud=["%","/","?",";","#"].concat(ih),fd=["/","?","#"],nv=255,pd=/^[+a-z0-9A-Z_-]{0,63}$/,av=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ov={javascript:!0,"javascript:":!0},rh={javascript:!0,"javascript:":!0},Us={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},sh=Zy;function To(i,e,t){if(i&&typeof i=="object"&&i instanceof Ti)return i;var r=new Ti;return r.parse(i,e,t),r}Ti.prototype.parse=function(i,e,t){if(typeof i!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var r=i.indexOf("?"),s=r!==-1&&r127?E+="x":E+=v[S];if(!E.match(pd)){var B=b.slice(0,f),k=b.slice(f+1),D=v.match(av);D&&(B.push(D[1]),k.unshift(D[2])),k.length&&(o="/"+k.join(".")+o),this.hostname=B.join(".");break}}}this.hostname.length>nv?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=Jy.toASCII(this.hostname));var W=this.port?":"+this.port:"",C=this.hostname||"";this.host=C+W,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!ov[u])for(var f=0,w=ih.length;f0?t.host.split("@"):!1;E&&(t.auth=E.shift(),t.hostname=E.shift(),t.host=t.hostname)}return t.search=i.search,t.query=i.query,(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!b.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var S=b.slice(-1)[0],T=(t.host||i.host||b.length>1)&&(S==="."||S==="..")||S==="",B=0,k=b.length;k>=0;k--)S=b[k],S==="."?b.splice(k,1):S===".."?(b.splice(k,1),B++):B&&(b.splice(k,1),B--);if(!g&&!y)for(;B--;B)b.unshift("..");g&&b[0]!==""&&(!b[0]||b[0].charAt(0)!=="/")&&b.unshift(""),T&&b.join("/").substr(-1)!=="/"&&b.push("");var D=b[0]===""||b[0]&&b[0].charAt(0)==="/";if(v){t.hostname=D?"":b.length?b.shift():"",t.host=t.hostname;var E=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;E&&(t.auth=E.shift(),t.hostname=E.shift(),t.host=t.hostname)}return g=g||t.host&&b.length,g&&!D&&b.unshift(""),b.length>0?t.pathname=b.join("/"):(t.pathname=null,t.path=null),(t.pathname!==null||t.search!==null)&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=i.auth||t.auth,t.slashes=t.slashes||i.slashes,t.href=t.format(),t};Ti.prototype.parseHost=function(){var i=this.host,e=tv.exec(i);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),i=i.substr(0,i.length-e.length)),i&&(this.hostname=i)};var cv=To,dv=hv,uv=lv;const fv={parse:cv,format:uv,resolve:dv};function di(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function pn(i){return i.split("?")[0].split("#")[0]}function pv(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function mv(i,e,t){return i.replace(new RegExp(pv(e),"g"),t)}function gv(i,e){let t="",r=0,s=-1,n=0,a=-1;for(let o=0;o<=i.length;++o){if(o2){const l=t.lastIndexOf("/");if(l!==t.length-1){l===-1?(t="",r=0):(t=t.slice(0,l),r=t.length-1-t.lastIndexOf("/")),s=o,n=0;continue}}else if(t.length===2||t.length===1){t="",r=0,s=o,n=0;continue}}e&&(t.length>0?t+="/..":t="..",r=2)}else t.length>0?t+=`/${i.slice(s+1,o)}`:t=i.slice(s+1,o),r=o-s-1;s=o,n=0}else a===46&&n!==-1?++n:n=-1}return t}const Rt={toPosix(i){return mv(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)},hasProtocol(i){return/^[^/:]+:\//.test(this.toPosix(i))},getProtocol(i){di(i),i=this.toPosix(i);let e="";const t=/^file:\/\/\//.exec(i),r=/^[^/:]+:\/\//.exec(i),s=/^[^/:]+:\//.exec(i);if(t||r||s){const n=t?.[0]||r?.[0]||s?.[0];e=n,i=i.slice(n.length)}return e},toAbsolute(i,e,t){if(this.isDataUrl(i))return i;const r=pn(this.toPosix(e??fe.ADAPTER.getBaseUrl())),s=pn(this.toPosix(t??this.rootname(r)));return di(i),i=this.toPosix(i),i.startsWith("/")?Rt.join(s,i.slice(1)):this.isAbsolute(i)?i:this.join(r,i)},normalize(i){if(i=this.toPosix(i),di(i),i.length===0)return".";let e="";const t=i.startsWith("/");this.hasProtocol(i)&&(e=this.rootname(i),i=i.slice(e.length));const r=i.endsWith("/");return i=gv(i,!1),i.length>0&&r&&(i+="/"),t?`/${i}`:e+i},isAbsolute(i){return di(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=r;else{const s=i[t-1]??"";this.extname(s)?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(i){if(di(i),i.length===0)return".";i=this.toPosix(i);let e=i.charCodeAt(0);const t=e===47;let r=-1,s=!0;const n=this.getProtocol(i),a=i;i=i.slice(n.length);for(let o=i.length-1;o>=1;--o)if(e=i.charCodeAt(o),e===47){if(!s){r=o;break}}else s=!1;return r===-1?t?"/":this.isUrl(a)?n+i:n:t&&r===1?"//":n+i.slice(0,r)},rootname(i){di(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){di(i),e&&di(e),i=pn(this.toPosix(i));let t=0,r=-1,s=!0,n;if(e!==void 0&&e.length>0&&e.length<=i.length){if(e.length===i.length&&e===i)return"";let a=e.length-1,o=-1;for(n=i.length-1;n>=0;--n){const l=i.charCodeAt(n);if(l===47){if(!s){t=n+1;break}}else o===-1&&(s=!1,o=n+1),a>=0&&(l===e.charCodeAt(a)?--a===-1&&(r=n):(a=-1,r=o))}return t===r?r=o:r===-1&&(r=i.length),i.slice(t,r)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!s){t=n+1;break}}else r===-1&&(s=!1,r=n+1);return r===-1?"":i.slice(t,r)},extname(i){di(i),i=pn(this.toPosix(i));let e=-1,t=0,r=-1,s=!0,n=0;for(let a=i.length-1;a>=0;--a){const o=i.charCodeAt(a);if(o===47){if(!s){t=a+1;break}continue}r===-1&&(s=!1,r=a+1),o===46?e===-1?e=a:n!==1&&(n=1):e!==-1&&(n=-1)}return e===-1||r===-1||n===0||n===1&&e===r-1&&e===t+1?"":i.slice(e,r)},parse(i){di(i);const e={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return e;i=pn(this.toPosix(i));let t=i.charCodeAt(0);const r=this.isAbsolute(i);let s;e.root=this.rootname(i),r||this.hasProtocol(i)?s=1:s=0;let n=-1,a=0,o=-1,l=!0,c=i.length-1,u=0;for(;c>=s;--c){if(t=i.charCodeAt(c),t===47){if(!l){a=c+1;break}continue}o===-1&&(l=!1,o=c+1),t===46?n===-1?n=c:u!==1&&(u=1):n!==-1&&(u=-1)}return n===-1||o===-1||u===0||u===1&&n===o-1&&n===a+1?o!==-1&&(a===0&&r?e.base=e.name=i.slice(1,o):e.base=e.name=i.slice(a,o)):(a===0&&r?(e.name=i.slice(1,n),e.base=i.slice(1,o)):(e.name=i.slice(a,n),e.base=i.slice(a,o)),e.ext=i.slice(n,o)),e.dir=this.dirname(i),e},sep:"/",delimiter:":"},md={};function Ue(i,e,t=3){if(md[e])return;let r=new Error().stack;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",`${e} Deprecated since v${i}`):(r=r.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(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${e} -Deprecated since v${i}`),console.warn(r))),md[e]=!0}let al;function vv(){return typeof al>"u"&&(al=function(){const e={stencil:!0,failIfMajorPerformanceCaveat:fe.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!fe.ADAPTER.getWebGLRenderingContext())return!1;const t=fe.ADAPTER.createCanvas();let r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e);const s=!!r?.getContextAttributes()?.stencil;if(r){const n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,s}catch{return!1}}()),al}var bv={grad:.9,turn:360,rad:360/(2*Math.PI)},Xi=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},_t=function(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*i)/t+0},ni=function(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),i>t?t:i>e?i:e},Cf=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},gd=function(i){return{r:ni(i.r,0,255),g:ni(i.g,0,255),b:ni(i.b,0,255),a:ni(i.a)}},ol=function(i){return{r:_t(i.r),g:_t(i.g),b:_t(i.b),a:_t(i.a,3)}},wv=/^#([0-9a-f]{3,8})$/i,da=function(i){var e=i.toString(16);return e.length<2?"0"+e:e},Mf=function(i){var e=i.r,t=i.g,r=i.b,s=i.a,n=Math.max(e,t,r),a=n-Math.min(e,t,r),o=a?n===e?(t-r)/a:n===t?2+(r-e)/a:4+(e-t)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:s}},kf=function(i){var e=i.h,t=i.s,r=i.v,s=i.a;e=e/360*6,t/=100,r/=100;var n=Math.floor(e),a=r*(1-t),o=r*(1-(e-n)*t),l=r*(1-(1-e+n)*t),c=n%6;return{r:255*[r,o,a,a,l,r][c],g:255*[l,r,r,o,a,a][c],b:255*[a,a,l,r,r,o][c],a:s}},yd=function(i){return{h:Cf(i.h),s:ni(i.s,0,100),l:ni(i.l,0,100),a:ni(i.a)}},vd=function(i){return{h:_t(i.h),s:_t(i.s),l:_t(i.l),a:_t(i.a,3)}},bd=function(i){return kf((t=(e=i).s,{h:e.h,s:(t*=((r=e.l)<50?r:100-r)/100)>0?2*t/(r+t)*100:0,v:r+t,a:e.a}));var e,t,r},Rn=function(i){return{h:(e=Mf(i)).h,s:(s=(200-(t=e.s))*(r=e.v)/100)>0&&s<200?t*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,t,r,s},_v=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Av=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ev=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rh={string:[[function(i){var e=wv.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?_t(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?_t(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var e=Av.exec(i)||Ev.exec(i);return e?e[2]!==e[4]||e[4]!==e[6]?null:gd({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=_v.exec(i)||xv.exec(i);if(!e)return null;var t,r,s=yd({h:(t=e[1],r=e[2],r===void 0&&(r="deg"),Number(t)*(bv[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return bd(s)},"hsl"]],object:[[function(i){var e=i.r,t=i.g,r=i.b,s=i.a,n=s===void 0?1:s;return Xi(e)&&Xi(t)&&Xi(r)?gd({r:Number(e),g:Number(t),b:Number(r),a:Number(n)}):null},"rgb"],[function(i){var e=i.h,t=i.s,r=i.l,s=i.a,n=s===void 0?1:s;if(!Xi(e)||!Xi(t)||!Xi(r))return null;var a=yd({h:Number(e),s:Number(t),l:Number(r),a:Number(n)});return bd(a)},"hsl"],[function(i){var e=i.h,t=i.s,r=i.v,s=i.a,n=s===void 0?1:s;if(!Xi(e)||!Xi(t)||!Xi(r))return null;var a=function(o){return{h:Cf(o.h),s:ni(o.s,0,100),v:ni(o.v,0,100),a:ni(o.a)}}({h:Number(e),s:Number(t),v:Number(r),a:Number(n)});return kf(a)},"hsv"]]},wd=function(i,e){for(var t=0;t=.5},i.prototype.toHex=function(){return e=ol(this.rgba),t=e.r,r=e.g,s=e.b,a=(n=e.a)<1?da(_t(255*n)):"","#"+da(t)+da(r)+da(s)+a;var e,t,r,s,n,a},i.prototype.toRgb=function(){return ol(this.rgba)},i.prototype.toRgbString=function(){return e=ol(this.rgba),t=e.r,r=e.g,s=e.b,(n=e.a)<1?"rgba("+t+", "+r+", "+s+", "+n+")":"rgb("+t+", "+r+", "+s+")";var e,t,r,s,n},i.prototype.toHsl=function(){return vd(Rn(this.rgba))},i.prototype.toHslString=function(){return e=vd(Rn(this.rgba)),t=e.h,r=e.s,s=e.l,(n=e.a)<1?"hsla("+t+", "+r+"%, "+s+"%, "+n+")":"hsl("+t+", "+r+"%, "+s+"%)";var e,t,r,s,n},i.prototype.toHsv=function(){return e=Mf(this.rgba),{h:_t(e.h),s:_t(e.s),v:_t(e.v),a:_t(e.a,3)};var e},i.prototype.invert=function(){return Pi({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),Pi(ll(this.rgba,e))},i.prototype.desaturate=function(e){return e===void 0&&(e=.1),Pi(ll(this.rgba,-e))},i.prototype.grayscale=function(){return Pi(ll(this.rgba,-1))},i.prototype.lighten=function(e){return e===void 0&&(e=.1),Pi(_d(this.rgba,e))},i.prototype.darken=function(e){return e===void 0&&(e=.1),Pi(_d(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"?Pi({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):_t(this.rgba.a,3);var t},i.prototype.hue=function(e){var t=Rn(this.rgba);return typeof e=="number"?Pi({h:e,s:t.s,l:t.l,a:t.a}):_t(t.h)},i.prototype.isEqual=function(e){return this.toHex()===Pi(e).toHex()},i}(),Pi=function(i){return i instanceof sh?i:new sh(i)},xd=[],Sv=function(i){i.forEach(function(e){xd.indexOf(e)<0&&(e(sh,rh),xd.push(e))})};function Cv(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"},r={};for(var s in t)r[t[s]]=s;var n={};i.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,l,c=r[this.toHex()];if(c)return c;if(a?.closest){var u=this.toRgb(),h=1/0,d="black";if(!n.length)for(var f in t)n[f]=new i(t[f]).toRgb();for(var p in t){var m=(o=u,l=n[p],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));ms===e[n]);if(i!==null&&e!==null){const s=Object.keys(i),n=Object.keys(e);return s.length!==n.length?!1:s.every(a=>i[a]===e[a])}return i===e}toRgba(){const[i,e,t,r]=this._components;return{r:i,g:e,b:t,a:r}}toRgb(){const[i,e,t]=this._components;return{r:i,g:e,b:t}}toRgbaString(){const[i,e,t]=this.toUint8RgbArray();return`rgba(${i},${e},${t},${this.alpha})`}toUint8RgbArray(i){const[e,t,r]=this._components;return i=i??[],i[0]=Math.round(e*255),i[1]=Math.round(t*255),i[2]=Math.round(r*255),i}toRgbArray(i){i=i??[];const[e,t,r]=this._components;return i[0]=e,i[1]=t,i[2]=r,i}toNumber(){return this._int}toLittleEndianNumber(){const i=this._int;return(i>>16)+(i&65280)+((i&255)<<16)}multiply(i){const[e,t,r,s]=Us.temp.setValue(i)._components;return this._components[0]*=e,this._components[1]*=t,this._components[2]*=r,this._components[3]*=s,this.refreshInt(),this._value=null,this}premultiply(i,e=!0){return e&&(this._components[0]*=i,this._components[1]*=i,this._components[2]*=i),this._components[3]=i,this.refreshInt(),this._value=null,this}toPremultiplied(i,e=!0){if(i===1)return(255<<24)+this._int;if(i===0)return e?0:this._int;let t=this._int>>16&255,r=this._int>>8&255,s=this._int&255;return e&&(t=t*i+.5|0,r=r*i+.5|0,s=s*i+.5|0),(i*255<<24)+(t<<16)+(r<<8)+s}toHex(){const i=this._int.toString(16);return`#${"000000".substring(0,6-i.length)+i}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(i){return this._components[3]=this._clamp(i),this}round(i){const[e,t,r]=this._components;return this._components[0]=Math.round(e*i)/i,this._components[1]=Math.round(t*i)/i,this._components[2]=Math.round(r*i)/i,this.refreshInt(),this._value=null,this}toArray(i){i=i??[];const[e,t,r,s]=this._components;return i[0]=e,i[1]=t,i[2]=r,i[3]=s,i}normalize(i){let e,t,r,s;if((typeof i=="number"||i instanceof Number)&&i>=0&&i<=16777215){const n=i;e=(n>>16&255)/255,t=(n>>8&255)/255,r=(n&255)/255,s=1}else if((Array.isArray(i)||i instanceof Float32Array)&&i.length>=3&&i.length<=4)i=this._clamp(i),[e,t,r,s=1]=i;else if((i instanceof Uint8Array||i instanceof Uint8ClampedArray)&&i.length>=3&&i.length<=4)i=this._clamp(i,0,255),[e,t,r,s=255]=i,e/=255,t/=255,r/=255,s/=255;else if(typeof i=="string"||typeof i=="object"){if(typeof i=="string"){const a=Us.HEX_PATTERN.exec(i);a&&(i=`#${a[2]}`)}const n=Pi(i);n.isValid()&&({r:e,g:t,b:r,a:s}=n.rgba,e/=255,t/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=t,this._components[2]=r,this._components[3]=s,this.refreshInt();else throw new Error(`Unable to convert color ${i}`)}refreshInt(){this._clamp(this._components);const[i,e,t]=this._components;this._int=(i*255<<16)+(e*255<<8)+(t*255|0)}_clamp(i,e=0,t=1){return typeof i=="number"?Math.min(Math.max(i,e),t):(i.forEach((r,s)=>{i[s]=Math.min(Math.max(r,e),t)}),i)}};let qe=Us;qe.shared=new Us;qe.temp=new Us;qe.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;function Mv(i){return Ue("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),qe.shared.setValue(i).toHex()}function kv(i){return Ue("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),qe.shared.setValue(i).toNumber()}function Iv(){const i=[],e=[];for(let r=0;r<32;r++)i[r]=r,e[r]=r;i[Ae.NORMAL_NPM]=Ae.NORMAL,i[Ae.ADD_NPM]=Ae.ADD,i[Ae.SCREEN_NPM]=Ae.SCREEN,e[Ae.NORMAL]=Ae.NORMAL_NPM,e[Ae.ADD]=Ae.ADD_NPM,e[Ae.SCREEN]=Ae.SCREEN_NPM;const t=[];return t.push(e),t.push(i),t}const If=Iv();function Pf(i,e){return If[e?1:0][i]}function Pv(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 r=0,s=0;r>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Ad(i){return!(i&i-1)&&!!i}function Ed(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 Hs(i,e,t){const r=i.length;let s;if(e>=r||t===0)return;t=e+t>r?r-e:t;const n=r-t;for(s=e;s(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))(pe||{});const ah=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},Md=(i,e)=>ah(i).priority??e,_e={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(ah).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...i){return i.map(ah).forEach(e=>{e.type.forEach(t=>{const r=this._addHandlers,s=this._queue;r[t]?r[t](e):(s[t]=s[t]||[],s[t].push(e))})}),this},handle(i,e,t){const r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=e,s[i]=t;const n=this._queue;return n[i]&&(n[i].forEach(a=>e(a)),delete n[i]),this},handleByMap(i,e){return this.handle(i,t=>{e[t.name]=t.ref},t=>{delete e[t.name]})},handleByList(i,e,t=-1){return this.handle(i,r=>{e.includes(r.ref)||(e.push(r.ref),e.sort((s,n)=>Md(n,t)-Md(s,t)))},r=>{const s=e.indexOf(r.ref);s!==-1&&e.splice(s,1)})}};class oh{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 Fv=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` -`);function Nv(i){let e="";for(let t=0;t0&&(e+=` -else `),t=0;--r){const s=lh[r];if(s.test&&s.test(i,t))return new s(i,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class Ti{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,r,s,n,a,o,l){if(arguments.length>8)throw new Error("max arguments reached");const{name:c,items:u}=this;this._aliasCount++;for(let h=0,d=u.length;h0&&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=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(Ti.prototype,{dispatch:{value:Ti.prototype.emit},run:{value:Ti.prototype.emit}});class zn{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new Ti("setRealSize"),this.onUpdate=new Ti("update"),this.onError=new Ti("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,r){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 Qn extends zn{constructor(e,t){const{width:r,height:s}=t||{};if(!r||!s)throw new Error("BufferResource width or height invalid");super(r,s),this.data=e}upload(e,t,r){const s=e.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===ki.UNPACK);const n=t.realWidth,a=t.realHeight;return r.width===n&&r.height===a?s.texSubImage2D(t.target,0,0,0,n,a,t.format,r.type,this.data):(r.width=n,r.height=a,s.texImage2D(t.target,0,r.internalFormat,n,a,0,t.format,r.type,this.data)),!0}dispose(){this.data=null}static test(e){return e instanceof Float32Array||e instanceof Uint8Array||e instanceof Uint32Array}}const Hv={scaleMode:qi.NEAREST,format:ce.RGBA,alphaMode:ki.NPM},_s=class extends sn{constructor(i=null,e=null){super(),e=Object.assign({},_s.defaultOptions,e);const{alphaMode:t,mipmap:r,anisotropicLevel:s,scaleMode:n,width:a,height:o,wrapMode:l,format:c,type:u,target:h,resolution:d,resourceOptions:f}=e;i&&!(i instanceof zn)&&(i=Df(i,f),i.internal=!0),this.resolution=d||fe.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((o||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=s,this._wrapMode=l,this._scaleMode=n,this.format=c,this.type=u,this.target=h,this.alphaMode=t,this.uid=rs(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&o>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(i)}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(i){this._mipmap!==i&&(this._mipmap=i,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(i){this._scaleMode!==i&&(this._scaleMode=i,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(i){this._wrapMode!==i&&(this._wrapMode=i,this.dirtyStyleId++)}setStyle(i,e){let t;return i!==void 0&&i!==this.scaleMode&&(this.scaleMode=i,t=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,t=!0),t&&this.dirtyStyleId++,this}setSize(i,e,t){return t=t||this.resolution,this.setRealSize(i*t,e*t,t)}setRealSize(i,e,t){return this.resolution=t||this.resolution,this.width=Math.round(i)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Ad(this.realWidth)&&Ad(this.realHeight)}setResolution(i){const e=this.resolution;return e===i?this:(this.resolution=i,this.valid&&(this.width=Math.round(this.width*e)/i,this.height=Math.round(this.height*e)/i,this.emit("update",this)),this._refreshPOT(),this)}setResource(i){if(this.resource===i)return this;if(this.resource)throw new Error("Resource can be set only once");return i.bind(this),this.resource=i,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(i){this.emit("error",this,i)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete ar[this.cacheId],delete Bi[this.cacheId],this.cacheId=null),this.dispose(),_s.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(i,e,t=fe.STRICT_TEXTURE_CACHE){const r=typeof i=="string";let s=null;if(r)s=i;else{if(!i._pixiId){const a=e?.pixiIdPrefix||"pixiid";i._pixiId=`${a}_${rs()}`}s=i._pixiId}let n=ar[s];if(r&&t&&!n)throw new Error(`The cacheId "${s}" does not exist in BaseTextureCache.`);return n||(n=new _s(i,e),n.cacheId=s,_s.addToCache(n,s)),n}static fromBuffer(i,e,t,r){i=i||new Float32Array(e*t*4);const s=new Qn(i,{width:e,height:t}),n=i instanceof Float32Array?Ee.FLOAT:Ee.UNSIGNED_BYTE;return new _s(s,Object.assign({},Hv,{type:n},r))}static addToCache(i,e){e&&(i.textureCacheIds.includes(e)||i.textureCacheIds.push(e),ar[e]&&ar[e]!==i&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),ar[e]=i)}static removeFromCache(i){if(typeof i=="string"){const e=ar[i];if(e){const t=e.textureCacheIds.indexOf(i);return t>-1&&e.textureCacheIds.splice(t,1),delete ar[i],e}}else if(i?.textureCacheIds){for(let e=0;e1){for(let h=0;h(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))(Mt||{});class ze{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new ze(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}toString(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`}}const fa=[new ze,new ze,new ze,new ze];class Ie{constructor(e=0,t=0,r=0,s=0){this.x=Number(e),this.y=Number(t),this.width=Number(r),this.height=Number(s),this.type=Mt.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 Ie(0,0,0,0)}clone(){return new Ie(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)<=R)return!1;const L=this.ye.bottom?e.bottom:this.bottom)>L}const r=this.left,s=this.right,n=this.top,a=this.bottom;if(s<=r||a<=n)return!1;const o=fa[0].set(e.left,e.top),l=fa[1].set(e.left,e.bottom),c=fa[2].set(e.right,e.top),u=fa[3].set(e.right,e.bottom);if(c.x<=o.x||l.y<=o.y)return!1;const h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(o,o),t.apply(l,l),t.apply(c,c),t.apply(u,u),Math.max(o.x,l.x,c.x,u.x)<=r||Math.min(o.x,l.x,c.x,u.x)>=s||Math.max(o.y,l.y,c.y,u.y)<=n||Math.min(o.y,l.y,c.y,u.y)>=a))return!1;const d=h*(l.y-o.y),f=h*(o.x-l.x),p=d*r+f*n,m=d*s+f*n,g=d*r+f*a,y=d*s+f*a;if(Math.max(p,m,g,y)<=d*o.x+f*o.y||Math.min(p,m,g,y)>=d*u.x+f*u.y)return!1;const b=h*(o.y-c.y),_=h*(c.x-o.x),v=b*r+_*n,E=b*s+_*n,I=b*r+_*a,S=b*s+_*a;return!(Math.max(v,E,I,S)<=b*o.x+_*o.y||Math.min(v,E,I,S)>=b*u.x+_*u.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),r=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),n=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(r-t,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(e=1,t=.001){const r=Math.ceil((this.x+this.width-t)*e)/e,s=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=r-this.x,this.height=s-this.y,this}enlarge(e){const t=Math.min(this.x,e.x),r=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),n=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=r-t,this.y=s,this.height=n-s,this}toString(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}class ec{constructor(e=0,t=0,r=0){this.x=e,this.y=t,this.radius=r,this.type=Mt.CIRC}clone(){return new ec(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;const r=this.radius*this.radius;let s=this.x-e,n=this.y-t;return s*=s,n*=n,s+n<=r}getBounds(){return new Ie(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}toString(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class tc{constructor(e=0,t=0,r=0,s=0){this.x=e,this.y=t,this.width=r,this.height=s,this.type=Mt.ELIP}clone(){return new tc(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let r=(e-this.x)/this.width,s=(t-this.y)/this.height;return r*=r,s*=s,r+s<=1}getBounds(){return new Ie(this.x-this.width,this.y-this.height,this.width,this.height)}toString(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}class Gs{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){const r=[];for(let s=0,n=t.length;st!=u>t&&e<(c-o)*((t-l)/(u-l))+o&&(r=!r)}return r}toString(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((e,t)=>`${e}, ${t}`,"")}]`}}class ic{constructor(e=0,t=0,r=0,s=0,n=20){this.x=e,this.y=t,this.width=r,this.height=s,this.radius=n,this.type=Mt.RREC}clone(){return new ic(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 r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+r&&t<=this.y+this.height-r||e>=this.x+r&&e<=this.x+this.width-r)return!0;let s=e-(this.x+r),n=t-(this.y+r);const a=r*r;if(s*s+n*n<=a||(s=e-(this.x+this.width-r),s*s+n*n<=a)||(n=t-(this.y+this.height-r),s*s+n*n<=a)||(s=e-(this.x+r),s*s+n*n<=a))return!0}return!1}toString(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}class nt{constructor(e=1,t=0,r=0,s=1,n=0,a=0){this.array=null,this.a=e,this.b=t,this.c=r,this.d=s,this.tx=n,this.ty=a}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,r,s,n,a){return this.a=e,this.b=t,this.c=r,this.d=s,this.tx=n,this.ty=a,this}toArray(e,t){this.array||(this.array=new Float32Array(9));const r=t||this.array;return e?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(e,t){t=t||new ze;const r=e.x,s=e.y;return t.x=this.a*r+this.c*s+this.tx,t.y=this.b*r+this.d*s+this.ty,t}applyInverse(e,t){t=t||new ze;const r=1/(this.a*this.d+this.c*-this.b),s=e.x,n=e.y;return t.x=this.d*r*s+-this.c*r*n+(this.ty*this.c-this.tx*this.d)*r,t.y=this.a*r*n+-this.b*r*s+(-this.ty*this.a+this.tx*this.b)*r,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),r=Math.sin(e),s=this.a,n=this.c,a=this.tx;return this.a=s*t-this.b*r,this.b=s*r+this.b*t,this.c=n*t-this.d*r,this.d=n*r+this.d*t,this.tx=a*t-this.ty*r,this.ty=a*r+this.ty*t,this}append(e){const t=this.a,r=this.b,s=this.c,n=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*r+e.b*n,this.c=e.c*t+e.d*s,this.d=e.c*r+e.d*n,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*r+e.ty*n+this.ty,this}setTransform(e,t,r,s,n,a,o,l,c){return this.a=Math.cos(o+c)*n,this.b=Math.sin(o+c)*n,this.c=-Math.sin(o-l)*a,this.d=Math.cos(o-l)*a,this.tx=e-(r*this.a+s*this.c),this.ty=t-(r*this.b+s*this.d),this}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const r=this.a,s=this.c;this.a=r*e.a+this.b*e.c,this.b=r*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*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,r=this.b,s=this.c,n=this.d,a=e.pivot,o=-Math.atan2(-s,n),l=Math.atan2(r,t),c=Math.abs(o+l);return c<1e-5||Math.abs(so-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=l),e.scale.x=Math.sqrt(t*t+r*r),e.scale.y=Math.sqrt(s*s+n*n),e.position.x=this.tx+(a.x*t+a.y*s),e.position.y=this.ty+(a.x*r+a.y*n),e}invert(){const e=this.a,t=this.b,r=this.c,s=this.d,n=this.tx,a=e*s-t*r;return this.a=s/a,this.b=-t/a,this.c=-r/a,this.d=e/a,this.tx=(r*this.ty-s*n)/a,this.ty=-(e*this.ty-t*n)/a,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 nt;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}toString(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return new nt}static get TEMP_MATRIX(){return new nt}}const Or=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Fr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Nr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Ur=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ch=[],Ff=[],pa=Math.sign;function Kv(){for(let i=0;i<16;i++){const e=[];ch.push(e);for(let t=0;t<16;t++){const r=pa(Or[i]*Or[t]+Nr[i]*Fr[t]),s=pa(Fr[i]*Or[t]+Ur[i]*Fr[t]),n=pa(Or[i]*Nr[t]+Nr[i]*Ur[t]),a=pa(Fr[i]*Nr[t]+Ur[i]*Ur[t]);for(let o=0;o<16;o++)if(Or[o]===r&&Fr[o]===s&&Nr[o]===n&&Ur[o]===a){e.push(o);break}}}for(let i=0;i<16;i++){const e=new nt;e.set(Or[i],Fr[i],Nr[i],Ur[i],0,0),Ff.push(e)}}Kv();const lt={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=>Or[i],uY:i=>Fr[i],vX:i=>Nr[i],vY:i=>Ur[i],inv:i=>i&8?i&15:-i&7,add:(i,e)=>ch[i][e],sub:(i,e)=>ch[i][lt.inv(e)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,e)=>Math.abs(i)*2<=Math.abs(e)?e>=0?lt.S:lt.N:Math.abs(e)*2<=Math.abs(i)?i>0?lt.E:lt.W:e>0?i>0?lt.SE:lt.SW:i>0?lt.NE:lt.NW,matrixAppendRotationInv:(i,e,t=0,r=0)=>{const s=Ff[lt.inv(e)];s.tx=t,s.ty=r,i.append(s)}};class _r{constructor(e,t,r=0,s=0){this._x=r,this._y=s,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new _r(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}toString(){return`[@pixi/math:ObservablePoint x=0 y=0 scope=${this.scope}]`}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))}}const Nf=class{constructor(){this.worldTransform=new nt,this.localTransform=new nt,this.position=new _r(this.onChange,this,0,0),this.scale=new _r(this.onChange,this,1,1),this.pivot=new _r(this.onChange,this,0,0),this.skew=new _r(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++}toString(){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}) ]`}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,r=this.worldTransform;r.a=e.a*t.a+e.b*t.c,r.b=e.a*t.b+e.b*t.d,r.c=e.c*t.a+e.d*t.c,r.d=e.c*t.b+e.d*t.d,r.tx=e.tx*t.a+e.ty*t.c+t.tx,r.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())}};let Eo=Nf;Eo.IDENTITY=new Nf;var $v=`varying vec2 vTextureCoord; +Deprecated since v${i}`),console.warn(r))),md[e]=!0}let ll;function yv(){return typeof ll>"u"&&(ll=function(){const e={stencil:!0,failIfMajorPerformanceCaveat:fe.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!fe.ADAPTER.getWebGLRenderingContext())return!1;const t=fe.ADAPTER.createCanvas();let r=t.getContext("webgl",e)||t.getContext("experimental-webgl",e);const s=!!r?.getContextAttributes()?.stencil;if(r){const n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,s}catch{return!1}}()),ll}var vv={grad:.9,turn:360,rad:360/(2*Math.PI)},Xi=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},_t=function(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=Math.pow(10,e)),Math.round(t*i)/t+0},ni=function(i,e,t){return e===void 0&&(e=0),t===void 0&&(t=1),i>t?t:i>e?i:e},Sf=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},gd=function(i){return{r:ni(i.r,0,255),g:ni(i.g,0,255),b:ni(i.b,0,255),a:ni(i.a)}},hl=function(i){return{r:_t(i.r),g:_t(i.g),b:_t(i.b),a:_t(i.a,3)}},bv=/^#([0-9a-f]{3,8})$/i,ua=function(i){var e=i.toString(16);return e.length<2?"0"+e:e},Cf=function(i){var e=i.r,t=i.g,r=i.b,s=i.a,n=Math.max(e,t,r),a=n-Math.min(e,t,r),o=a?n===e?(t-r)/a:n===t?2+(r-e)/a:4+(e-t)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:s}},Mf=function(i){var e=i.h,t=i.s,r=i.v,s=i.a;e=e/360*6,t/=100,r/=100;var n=Math.floor(e),a=r*(1-t),o=r*(1-(e-n)*t),l=r*(1-(1-e+n)*t),c=n%6;return{r:255*[r,o,a,a,l,r][c],g:255*[l,r,r,o,a,a][c],b:255*[a,a,l,r,r,o][c],a:s}},yd=function(i){return{h:Sf(i.h),s:ni(i.s,0,100),l:ni(i.l,0,100),a:ni(i.a)}},vd=function(i){return{h:_t(i.h),s:_t(i.s),l:_t(i.l),a:_t(i.a,3)}},bd=function(i){return Mf((t=(e=i).s,{h:e.h,s:(t*=((r=e.l)<50?r:100-r)/100)>0?2*t/(r+t)*100:0,v:r+t,a:e.a}));var e,t,r},Dn=function(i){return{h:(e=Cf(i)).h,s:(s=(200-(t=e.s))*(r=e.v)/100)>0&&s<200?t*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:e.a};var e,t,r,s},wv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_v=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Av=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,nh={string:[[function(i){var e=bv.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?_t(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?_t(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var e=xv.exec(i)||Av.exec(i);return e?e[2]!==e[4]||e[4]!==e[6]?null:gd({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=wv.exec(i)||_v.exec(i);if(!e)return null;var t,r,s=yd({h:(t=e[1],r=e[2],r===void 0&&(r="deg"),Number(t)*(vv[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return bd(s)},"hsl"]],object:[[function(i){var e=i.r,t=i.g,r=i.b,s=i.a,n=s===void 0?1:s;return Xi(e)&&Xi(t)&&Xi(r)?gd({r:Number(e),g:Number(t),b:Number(r),a:Number(n)}):null},"rgb"],[function(i){var e=i.h,t=i.s,r=i.l,s=i.a,n=s===void 0?1:s;if(!Xi(e)||!Xi(t)||!Xi(r))return null;var a=yd({h:Number(e),s:Number(t),l:Number(r),a:Number(n)});return bd(a)},"hsl"],[function(i){var e=i.h,t=i.s,r=i.v,s=i.a,n=s===void 0?1:s;if(!Xi(e)||!Xi(t)||!Xi(r))return null;var a=function(o){return{h:Sf(o.h),s:ni(o.s,0,100),v:ni(o.v,0,100),a:ni(o.a)}}({h:Number(e),s:Number(t),v:Number(r),a:Number(n)});return Mf(a)},"hsv"]]},wd=function(i,e){for(var t=0;t=.5},i.prototype.toHex=function(){return e=hl(this.rgba),t=e.r,r=e.g,s=e.b,a=(n=e.a)<1?ua(_t(255*n)):"","#"+ua(t)+ua(r)+ua(s)+a;var e,t,r,s,n,a},i.prototype.toRgb=function(){return hl(this.rgba)},i.prototype.toRgbString=function(){return e=hl(this.rgba),t=e.r,r=e.g,s=e.b,(n=e.a)<1?"rgba("+t+", "+r+", "+s+", "+n+")":"rgb("+t+", "+r+", "+s+")";var e,t,r,s,n},i.prototype.toHsl=function(){return vd(Dn(this.rgba))},i.prototype.toHslString=function(){return e=vd(Dn(this.rgba)),t=e.h,r=e.s,s=e.l,(n=e.a)<1?"hsla("+t+", "+r+"%, "+s+"%, "+n+")":"hsl("+t+", "+r+"%, "+s+"%)";var e,t,r,s,n},i.prototype.toHsv=function(){return e=Cf(this.rgba),{h:_t(e.h),s:_t(e.s),v:_t(e.v),a:_t(e.a,3)};var e},i.prototype.invert=function(){return Bi({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),Bi(cl(this.rgba,e))},i.prototype.desaturate=function(e){return e===void 0&&(e=.1),Bi(cl(this.rgba,-e))},i.prototype.grayscale=function(){return Bi(cl(this.rgba,-1))},i.prototype.lighten=function(e){return e===void 0&&(e=.1),Bi(_d(this.rgba,e))},i.prototype.darken=function(e){return e===void 0&&(e=.1),Bi(_d(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"?Bi({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):_t(this.rgba.a,3);var t},i.prototype.hue=function(e){var t=Dn(this.rgba);return typeof e=="number"?Bi({h:e,s:t.s,l:t.l,a:t.a}):_t(t.h)},i.prototype.isEqual=function(e){return this.toHex()===Bi(e).toHex()},i}(),Bi=function(i){return i instanceof ah?i:new ah(i)},xd=[],Tv=function(i){i.forEach(function(e){xd.indexOf(e)<0&&(e(ah,nh),xd.push(e))})};function Sv(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"},r={};for(var s in t)r[t[s]]=s;var n={};i.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,l,c=r[this.toHex()];if(c)return c;if(a?.closest){var u=this.toRgb(),h=1/0,d="black";if(!n.length)for(var f in t)n[f]=new i(t[f]).toRgb();for(var p in t){var m=(o=u,l=n[p],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));ms===e[n]);if(i!==null&&e!==null){const s=Object.keys(i),n=Object.keys(e);return s.length!==n.length?!1:s.every(a=>i[a]===e[a])}return i===e}toRgba(){const[i,e,t,r]=this._components;return{r:i,g:e,b:t,a:r}}toRgb(){const[i,e,t]=this._components;return{r:i,g:e,b:t}}toRgbaString(){const[i,e,t]=this.toUint8RgbArray();return`rgba(${i},${e},${t},${this.alpha})`}toUint8RgbArray(i){const[e,t,r]=this._components;return i=i??[],i[0]=Math.round(e*255),i[1]=Math.round(t*255),i[2]=Math.round(r*255),i}toRgbArray(i){i=i??[];const[e,t,r]=this._components;return i[0]=e,i[1]=t,i[2]=r,i}toNumber(){return this._int}toLittleEndianNumber(){const i=this._int;return(i>>16)+(i&65280)+((i&255)<<16)}multiply(i){const[e,t,r,s]=Hs.temp.setValue(i)._components;return this._components[0]*=e,this._components[1]*=t,this._components[2]*=r,this._components[3]*=s,this.refreshInt(),this._value=null,this}premultiply(i,e=!0){return e&&(this._components[0]*=i,this._components[1]*=i,this._components[2]*=i),this._components[3]=i,this.refreshInt(),this._value=null,this}toPremultiplied(i,e=!0){if(i===1)return(255<<24)+this._int;if(i===0)return e?0:this._int;let t=this._int>>16&255,r=this._int>>8&255,s=this._int&255;return e&&(t=t*i+.5|0,r=r*i+.5|0,s=s*i+.5|0),(i*255<<24)+(t<<16)+(r<<8)+s}toHex(){const i=this._int.toString(16);return`#${"000000".substring(0,6-i.length)+i}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(i){return this._components[3]=this._clamp(i),this}round(i){const[e,t,r]=this._components;return this._components[0]=Math.round(e*i)/i,this._components[1]=Math.round(t*i)/i,this._components[2]=Math.round(r*i)/i,this.refreshInt(),this._value=null,this}toArray(i){i=i??[];const[e,t,r,s]=this._components;return i[0]=e,i[1]=t,i[2]=r,i[3]=s,i}normalize(i){let e,t,r,s;if((typeof i=="number"||i instanceof Number)&&i>=0&&i<=16777215){const n=i;e=(n>>16&255)/255,t=(n>>8&255)/255,r=(n&255)/255,s=1}else if((Array.isArray(i)||i instanceof Float32Array)&&i.length>=3&&i.length<=4)i=this._clamp(i),[e,t,r,s=1]=i;else if((i instanceof Uint8Array||i instanceof Uint8ClampedArray)&&i.length>=3&&i.length<=4)i=this._clamp(i,0,255),[e,t,r,s=255]=i,e/=255,t/=255,r/=255,s/=255;else if(typeof i=="string"||typeof i=="object"){if(typeof i=="string"){const a=Hs.HEX_PATTERN.exec(i);a&&(i=`#${a[2]}`)}const n=Bi(i);n.isValid()&&({r:e,g:t,b:r,a:s}=n.rgba,e/=255,t/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=t,this._components[2]=r,this._components[3]=s,this.refreshInt();else throw new Error(`Unable to convert color ${i}`)}refreshInt(){this._clamp(this._components);const[i,e,t]=this._components;this._int=(i*255<<16)+(e*255<<8)+(t*255|0)}_clamp(i,e=0,t=1){return typeof i=="number"?Math.min(Math.max(i,e),t):(i.forEach((r,s)=>{i[s]=Math.min(Math.max(r,e),t)}),i)}};let Ke=Hs;Ke.shared=new Hs;Ke.temp=new Hs;Ke.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;function Cv(i){return Ue("7.2.0","utils.hex2string is deprecated, use Color#toHex instead"),Ke.shared.setValue(i).toHex()}function Mv(i){return Ue("7.2.0","utils.rgb2hex is deprecated, use Color#toNumber instead"),Ke.shared.setValue(i).toNumber()}function kv(){const i=[],e=[];for(let r=0;r<32;r++)i[r]=r,e[r]=r;i[Ae.NORMAL_NPM]=Ae.NORMAL,i[Ae.ADD_NPM]=Ae.ADD,i[Ae.SCREEN_NPM]=Ae.SCREEN,e[Ae.NORMAL]=Ae.NORMAL_NPM,e[Ae.ADD]=Ae.ADD_NPM,e[Ae.SCREEN]=Ae.SCREEN_NPM;const t=[];return t.push(e),t.push(i),t}const kf=kv();function If(i,e){return kf[e?1:0][i]}function Iv(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 r=0,s=0;r>>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Ad(i){return!(i&i-1)&&!!i}function Ed(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 Gs(i,e,t){const r=i.length;let s;if(e>=r||t===0)return;t=e+t>r?r-e:t;const n=r-t;for(s=e;s(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))(pe||{});const lh=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},Md=(i,e)=>lh(i).priority??e,_e={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(lh).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...i){return i.map(lh).forEach(e=>{e.type.forEach(t=>{const r=this._addHandlers,s=this._queue;r[t]?r[t](e):(s[t]=s[t]||[],s[t].push(e))})}),this},handle(i,e,t){const r=this._addHandlers,s=this._removeHandlers;if(r[i]||s[i])throw new Error(`Extension type ${i} already has a handler`);r[i]=e,s[i]=t;const n=this._queue;return n[i]&&(n[i].forEach(a=>e(a)),delete n[i]),this},handleByMap(i,e){return this.handle(i,t=>{e[t.name]=t.ref},t=>{delete e[t.name]})},handleByList(i,e,t=-1){return this.handle(i,r=>{e.includes(r.ref)||(e.push(r.ref),e.sort((s,n)=>Md(n,t)-Md(s,t)))},r=>{const s=e.indexOf(r.ref);s!==-1&&e.splice(s,1)})}};class hh{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 Ov=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` +`);function Fv(i){let e="";for(let t=0;t0&&(e+=` +else `),t=0;--r){const s=ch[r];if(s.test&&s.test(i,t))return new s(i,e)}throw new Error("Unrecognized source type to auto-detect Resource")}class Si{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,r,s,n,a,o,l){if(arguments.length>8)throw new Error("max arguments reached");const{name:c,items:u}=this;this._aliasCount++;for(let h=0,d=u.length;h0&&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=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(Si.prototype,{dispatch:{value:Si.prototype.emit},run:{value:Si.prototype.emit}});class zn{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new Si("setRealSize"),this.onUpdate=new Si("update"),this.onError=new Si("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,r){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 Zn extends zn{constructor(e,t){const{width:r,height:s}=t||{};if(!r||!s)throw new Error("BufferResource width or height invalid");super(r,s),this.data=e}upload(e,t,r){const s=e.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===Ii.UNPACK);const n=t.realWidth,a=t.realHeight;return r.width===n&&r.height===a?s.texSubImage2D(t.target,0,0,0,n,a,t.format,r.type,this.data):(r.width=n,r.height=a,s.texImage2D(t.target,0,r.internalFormat,n,a,0,t.format,r.type,this.data)),!0}dispose(){this.data=null}static test(e){return e instanceof Float32Array||e instanceof Uint8Array||e instanceof Uint32Array}}const Uv={scaleMode:Ki.NEAREST,format:ce.RGBA,alphaMode:Ii.NPM},As=class extends nn{constructor(i=null,e=null){super(),e=Object.assign({},As.defaultOptions,e);const{alphaMode:t,mipmap:r,anisotropicLevel:s,scaleMode:n,width:a,height:o,wrapMode:l,format:c,type:u,target:h,resolution:d,resourceOptions:f}=e;i&&!(i instanceof zn)&&(i=Rf(i,f),i.internal=!0),this.resolution=d||fe.RESOLUTION,this.width=Math.round((a||0)*this.resolution)/this.resolution,this.height=Math.round((o||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=s,this._wrapMode=l,this._scaleMode=n,this.format=c,this.type=u,this.target=h,this.alphaMode=t,this.uid=as(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=a>0&&o>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(i)}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(i){this._mipmap!==i&&(this._mipmap=i,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(i){this._scaleMode!==i&&(this._scaleMode=i,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(i){this._wrapMode!==i&&(this._wrapMode=i,this.dirtyStyleId++)}setStyle(i,e){let t;return i!==void 0&&i!==this.scaleMode&&(this.scaleMode=i,t=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,t=!0),t&&this.dirtyStyleId++,this}setSize(i,e,t){return t=t||this.resolution,this.setRealSize(i*t,e*t,t)}setRealSize(i,e,t){return this.resolution=t||this.resolution,this.width=Math.round(i)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Ad(this.realWidth)&&Ad(this.realHeight)}setResolution(i){const e=this.resolution;return e===i?this:(this.resolution=i,this.valid&&(this.width=Math.round(this.width*e)/i,this.height=Math.round(this.height*e)/i,this.emit("update",this)),this._refreshPOT(),this)}setResource(i){if(this.resource===i)return this;if(this.resource)throw new Error("Resource can be set only once");return i.bind(this),this.resource=i,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(i){this.emit("error",this,i)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete ar[this.cacheId],delete Ri[this.cacheId],this.cacheId=null),this.dispose(),As.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(i,e,t=fe.STRICT_TEXTURE_CACHE){const r=typeof i=="string";let s=null;if(r)s=i;else{if(!i._pixiId){const a=e?.pixiIdPrefix||"pixiid";i._pixiId=`${a}_${as()}`}s=i._pixiId}let n=ar[s];if(r&&t&&!n)throw new Error(`The cacheId "${s}" does not exist in BaseTextureCache.`);return n||(n=new As(i,e),n.cacheId=s,As.addToCache(n,s)),n}static fromBuffer(i,e,t,r){i=i||new Float32Array(e*t*4);const s=new Zn(i,{width:e,height:t}),n=i instanceof Float32Array?Ee.FLOAT:Ee.UNSIGNED_BYTE;return new As(s,Object.assign({},Uv,{type:n},r))}static addToCache(i,e){e&&(i.textureCacheIds.includes(e)||i.textureCacheIds.push(e),ar[e]&&ar[e]!==i&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),ar[e]=i)}static removeFromCache(i){if(typeof i=="string"){const e=ar[i];if(e){const t=e.textureCacheIds.indexOf(i);return t>-1&&e.textureCacheIds.splice(t,1),delete ar[i],e}}else if(i?.textureCacheIds){for(let e=0;e1){for(let h=0;h(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))(Mt||{});class ze{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new ze(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}toString(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`}}const pa=[new ze,new ze,new ze,new ze];class Ie{constructor(e=0,t=0,r=0,s=0){this.x=Number(e),this.y=Number(t),this.width=Number(r),this.height=Number(s),this.type=Mt.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 Ie(0,0,0,0)}clone(){return new Ie(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)<=B)return!1;const D=this.ye.bottom?e.bottom:this.bottom)>D}const r=this.left,s=this.right,n=this.top,a=this.bottom;if(s<=r||a<=n)return!1;const o=pa[0].set(e.left,e.top),l=pa[1].set(e.left,e.bottom),c=pa[2].set(e.right,e.top),u=pa[3].set(e.right,e.bottom);if(c.x<=o.x||l.y<=o.y)return!1;const h=Math.sign(t.a*t.d-t.b*t.c);if(h===0||(t.apply(o,o),t.apply(l,l),t.apply(c,c),t.apply(u,u),Math.max(o.x,l.x,c.x,u.x)<=r||Math.min(o.x,l.x,c.x,u.x)>=s||Math.max(o.y,l.y,c.y,u.y)<=n||Math.min(o.y,l.y,c.y,u.y)>=a))return!1;const d=h*(l.y-o.y),f=h*(o.x-l.x),p=d*r+f*n,m=d*s+f*n,g=d*r+f*a,y=d*s+f*a;if(Math.max(p,m,g,y)<=d*o.x+f*o.y||Math.min(p,m,g,y)>=d*u.x+f*u.y)return!1;const b=h*(o.y-c.y),w=h*(c.x-o.x),v=b*r+w*n,E=b*s+w*n,S=b*r+w*a,T=b*s+w*a;return!(Math.max(v,E,S,T)<=b*o.x+w*o.y||Math.min(v,E,S,T)>=b*u.x+w*u.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),r=Math.min(this.x+this.width,e.x+e.width),s=Math.max(this.y,e.y),n=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(r-t,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(e=1,t=.001){const r=Math.ceil((this.x+this.width-t)*e)/e,s=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=r-this.x,this.height=s-this.y,this}enlarge(e){const t=Math.min(this.x,e.x),r=Math.max(this.x+this.width,e.x+e.width),s=Math.min(this.y,e.y),n=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=r-t,this.y=s,this.height=n-s,this}toString(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}class tc{constructor(e=0,t=0,r=0){this.x=e,this.y=t,this.radius=r,this.type=Mt.CIRC}clone(){return new tc(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;const r=this.radius*this.radius;let s=this.x-e,n=this.y-t;return s*=s,n*=n,s+n<=r}getBounds(){return new Ie(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}toString(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class ic{constructor(e=0,t=0,r=0,s=0){this.x=e,this.y=t,this.width=r,this.height=s,this.type=Mt.ELIP}clone(){return new ic(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let r=(e-this.x)/this.width,s=(t-this.y)/this.height;return r*=r,s*=s,r+s<=1}getBounds(){return new Ie(this.x-this.width,this.y-this.height,this.width,this.height)}toString(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}class Ws{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!="number"){const r=[];for(let s=0,n=t.length;st!=u>t&&e<(c-o)*((t-l)/(u-l))+o&&(r=!r)}return r}toString(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((e,t)=>`${e}, ${t}`,"")}]`}}class rc{constructor(e=0,t=0,r=0,s=0,n=20){this.x=e,this.y=t,this.width=r,this.height=s,this.radius=n,this.type=Mt.RREC}clone(){return new rc(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 r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+r&&t<=this.y+this.height-r||e>=this.x+r&&e<=this.x+this.width-r)return!0;let s=e-(this.x+r),n=t-(this.y+r);const a=r*r;if(s*s+n*n<=a||(s=e-(this.x+this.width-r),s*s+n*n<=a)||(n=t-(this.y+this.height-r),s*s+n*n<=a)||(s=e-(this.x+r),s*s+n*n<=a))return!0}return!1}toString(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}class at{constructor(e=1,t=0,r=0,s=1,n=0,a=0){this.array=null,this.a=e,this.b=t,this.c=r,this.d=s,this.tx=n,this.ty=a}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,r,s,n,a){return this.a=e,this.b=t,this.c=r,this.d=s,this.tx=n,this.ty=a,this}toArray(e,t){this.array||(this.array=new Float32Array(9));const r=t||this.array;return e?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(e,t){t=t||new ze;const r=e.x,s=e.y;return t.x=this.a*r+this.c*s+this.tx,t.y=this.b*r+this.d*s+this.ty,t}applyInverse(e,t){t=t||new ze;const r=1/(this.a*this.d+this.c*-this.b),s=e.x,n=e.y;return t.x=this.d*r*s+-this.c*r*n+(this.ty*this.c-this.tx*this.d)*r,t.y=this.a*r*n+-this.b*r*s+(-this.ty*this.a+this.tx*this.b)*r,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),r=Math.sin(e),s=this.a,n=this.c,a=this.tx;return this.a=s*t-this.b*r,this.b=s*r+this.b*t,this.c=n*t-this.d*r,this.d=n*r+this.d*t,this.tx=a*t-this.ty*r,this.ty=a*r+this.ty*t,this}append(e){const t=this.a,r=this.b,s=this.c,n=this.d;return this.a=e.a*t+e.b*s,this.b=e.a*r+e.b*n,this.c=e.c*t+e.d*s,this.d=e.c*r+e.d*n,this.tx=e.tx*t+e.ty*s+this.tx,this.ty=e.tx*r+e.ty*n+this.ty,this}setTransform(e,t,r,s,n,a,o,l,c){return this.a=Math.cos(o+c)*n,this.b=Math.sin(o+c)*n,this.c=-Math.sin(o-l)*a,this.d=Math.cos(o-l)*a,this.tx=e-(r*this.a+s*this.c),this.ty=t-(r*this.b+s*this.d),this}prepend(e){const t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){const r=this.a,s=this.c;this.a=r*e.a+this.b*e.c,this.b=r*e.b+this.b*e.d,this.c=s*e.a+this.d*e.c,this.d=s*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,r=this.b,s=this.c,n=this.d,a=e.pivot,o=-Math.atan2(-s,n),l=Math.atan2(r,t),c=Math.abs(o+l);return c<1e-5||Math.abs(no-c)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=l),e.scale.x=Math.sqrt(t*t+r*r),e.scale.y=Math.sqrt(s*s+n*n),e.position.x=this.tx+(a.x*t+a.y*s),e.position.y=this.ty+(a.x*r+a.y*n),e}invert(){const e=this.a,t=this.b,r=this.c,s=this.d,n=this.tx,a=e*s-t*r;return this.a=s/a,this.b=-t/a,this.c=-r/a,this.d=e/a,this.tx=(r*this.ty-s*n)/a,this.ty=-(e*this.ty-t*n)/a,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 at;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}toString(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return new at}static get TEMP_MATRIX(){return new at}}const Fr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Nr=[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],Hr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],uh=[],Of=[],ma=Math.sign;function Yv(){for(let i=0;i<16;i++){const e=[];uh.push(e);for(let t=0;t<16;t++){const r=ma(Fr[i]*Fr[t]+Ur[i]*Nr[t]),s=ma(Nr[i]*Fr[t]+Hr[i]*Nr[t]),n=ma(Fr[i]*Ur[t]+Ur[i]*Hr[t]),a=ma(Nr[i]*Ur[t]+Hr[i]*Hr[t]);for(let o=0;o<16;o++)if(Fr[o]===r&&Nr[o]===s&&Ur[o]===n&&Hr[o]===a){e.push(o);break}}}for(let i=0;i<16;i++){const e=new at;e.set(Fr[i],Nr[i],Ur[i],Hr[i],0,0),Of.push(e)}}Yv();const lt={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=>Fr[i],uY:i=>Nr[i],vX:i=>Ur[i],vY:i=>Hr[i],inv:i=>i&8?i&15:-i&7,add:(i,e)=>uh[i][e],sub:(i,e)=>uh[i][lt.inv(e)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,e)=>Math.abs(i)*2<=Math.abs(e)?e>=0?lt.S:lt.N:Math.abs(e)*2<=Math.abs(i)?i>0?lt.E:lt.W:e>0?i>0?lt.SE:lt.SW:i>0?lt.NE:lt.NW,matrixAppendRotationInv:(i,e,t=0,r=0)=>{const s=Of[lt.inv(e)];s.tx=t,s.ty=r,i.append(s)}};class _r{constructor(e,t,r=0,s=0){this._x=r,this._y=s,this.cb=e,this.scope=t}clone(e=this.cb,t=this.scope){return new _r(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}toString(){return`[@pixi/math:ObservablePoint x=0 y=0 scope=${this.scope}]`}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))}}const Ff=class{constructor(){this.worldTransform=new at,this.localTransform=new at,this.position=new _r(this.onChange,this,0,0),this.scale=new _r(this.onChange,this,1,1),this.pivot=new _r(this.onChange,this,0,0),this.skew=new _r(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++}toString(){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}) ]`}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,r=this.worldTransform;r.a=e.a*t.a+e.b*t.c,r.b=e.a*t.b+e.b*t.d,r.c=e.c*t.a+e.d*t.c,r.d=e.c*t.b+e.d*t.d,r.tx=e.tx*t.a+e.ty*t.c+t.tx,r.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())}};let So=Ff;So.IDENTITY=new Ff;var $v=`varying vec2 vTextureCoord; uniform sampler2D uSampler; @@ -26,7 +27,7 @@ void main(void){ gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = aTextureCoord; } -`;function Id(i,e,t){const r=i.createShader(e);return i.shaderSource(r,t),i.compileShader(r),r}function gl(i){const e=new Array(i);for(let t=0;ti.type==="float"&&i.size===1&&!i.isArray,code:i=>` +`;function Id(i,e,t){const r=i.createShader(e);return i.shaderSource(r,t),i.compileShader(r),r}function vl(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}"] @@ -146,7 +147,7 @@ void main(void){ cv[3] = v[3]; gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3]) - }`}],Qv={float:` + }`}],Kv={float:` if (cv !== v) { cu.value = v; @@ -282,7 +283,7 @@ void main(void){ cu.value = v; gl.uniform1i(location, v); - }`},Zv={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 Jv(i,e){const t=[` + }`},Qv={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 Zv(i,e){const t=[` var v = null; var cv = null; var cu = null; @@ -292,18 +293,18 @@ void main(void){ renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}'); `):t.push(` renderer.shader.syncUniformGroup(uv.${r}, syncData); - `));continue}const n=i.uniforms[r];let a=!1;for(let o=0;o=hs.WEBGL2&&(e=i.getContext("webgl2",{})),e||(e=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),ma=e}return ma}let ga;function t0(){if(!ga){ga=si.MEDIUM;const i=e0();i&&i.getShaderPrecisionFormat&&(ga=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?si.HIGH:si.MEDIUM)}return ga}function Pd(i,e){const t=i.getShaderSource(e).split(` +`))}const Uf={};let ga=Uf;function Jv(){if(ga===Uf||ga?.isContextLost()){const i=fe.ADAPTER.createCanvas();let e;fe.PREFER_ENV>=ds.WEBGL2&&(e=i.getContext("webgl2",{})),e||(e=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),ga=e}return ga}let ya;function e0(){if(!ya){ya=si.MEDIUM;const i=Jv();i&&i.getShaderPrecisionFormat&&(ya=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT).precision?si.HIGH:si.MEDIUM)}return ya}function Pd(i,e){const t=i.getShaderSource(e).split(` `).map((c,u)=>`${u}: ${c}`),r=i.getShaderInfoLog(e),s=r.split(` `),n={},a=s.map(c=>parseFloat(c.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(c=>c&&!n[c]?(n[c]=!0,!0):!1),o=[""];a.forEach(c=>{t[c-1]=`%c${t[c-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const l=t.join(` -`);o[0]=l,console.error(r),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function i0(i,e,t,r){i.getProgramParameter(e,i.LINK_STATUS)||(i.getShaderParameter(t,i.COMPILE_STATUS)||Pd(i,t),i.getShaderParameter(r,i.COMPILE_STATUS)||Pd(i,r),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(e)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(e)))}const r0={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 Gf(i){return r0[i]}let ya=null;const Bd={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 Wf(i,e){if(!ya){const t=Object.keys(Bd);ya={};for(let r=0;r0&&(t+=` else `),rthis.size&&this.flush(),this._vertexCount+=i.vertexData.length/2,this._indexCount+=i.indices.length,this._bufferedTextures[this._bufferSize]=i._texture.baseTexture,this._bufferedElements[this._bufferSize++]=i)}buildTexturesAndDrawCalls(){const{_bufferedTextures:i,maxTextures:e}=this,t=pi._textureArrayPool,r=this.renderer.batch,s=this._tempBoundTextures,n=this.renderer.textureGC.count;let a=++Me._globalBatch,o=0,l=t[0],c=0;r.copyBoundTextures(s,e);for(let u=0;u=e&&(r.boundArray(l,s,a,e),this.buildDrawCalls(l,c,u),c=u,l=t[++o],++a),h._batchEnabled=a,h.touched=n,l.elements[l.count++]=h)}l.count>0&&(r.boundArray(l,s,a,e),this.buildDrawCalls(l,c,this._bufferSize),++o,++a);for(let u=0;u0);for(let p=0;pthis.size&&this.flush(),this._vertexCount+=i.vertexData.length/2,this._indexCount+=i.indices.length,this._bufferedTextures[this._bufferSize]=i._texture.baseTexture,this._bufferedElements[this._bufferSize++]=i)}buildTexturesAndDrawCalls(){const{_bufferedTextures:i,maxTextures:e}=this,t=pi._textureArrayPool,r=this.renderer.batch,s=this._tempBoundTextures,n=this.renderer.textureGC.count;let a=++Me._globalBatch,o=0,l=t[0],c=0;r.copyBoundTextures(s,e);for(let u=0;u=e&&(r.boundArray(l,s,a,e),this.buildDrawCalls(l,c,u),c=u,l=t[++o],++a),h._batchEnabled=a,h.touched=n,l.elements[l.count++]=h)}l.count>0&&(r.boundArray(l,s,a,e),this.buildDrawCalls(l,c,this._bufferSize),++o,++a);for(let u=0;u0);for(let p=0;p=0;--s)e[s]=r[s]||null,e[s]&&(e[s]._batchLocation=s)}boundArray(e,t,r,s){const{elements:n,ids:a,count:o}=e;let l=0;for(let c=0;c=0&&h=hs.WEBGL2&&(r=e.getContext("webgl2",t)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,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")};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(),r="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=r||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}Co.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"};Co.extension={type:pe.RendererSystem,name:"context"};_e.add(Co);class p0 extends Qn{upload(e,t,r){const s=e.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===ki.UNPACK);const n=t.realWidth,a=t.realHeight;return r.width===n&&r.height===a?s.texSubImage2D(t.target,0,0,0,n,a,t.format,r.type,this.data):(r.width=n,r.height=a,s.texImage2D(t.target,0,r.internalFormat,n,a,0,t.format,r.type,this.data)),!0}}class uh{constructor(e,t){this.width=Math.round(e||100),this.height=Math.round(t||100),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 Ti("disposeFramebuffer"),this.multisample=ft.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new Me(null,{scaleMode:qi.NEAREST,resolution:1,mipmap:Kt.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new Me(new p0(null,{width:this.width,height:this.height}),{scaleMode:qi.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Kt.OFF,format:ce.DEPTH_COMPONENT,type:Ee.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===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(let r=0;r{const s=this.source;this.url=s.src;const n=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.resize(s.width,s.height),this._load=null,this.createBitmap?t(this.process()):t(this))};s.complete&&s.src?n():(s.onload=n,s.onerror=a=>{r(a),this.onError.emit(a)})}),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,r=!e.crossOrigin||e.crossOrigin==="anonymous";return this._process=fetch(e.src,{mode:r?"cors":"no-cors"}).then(s=>s.blob()).then(s=>t(s,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ki.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,t,r){if(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,r,this.bitmap),!this.preserveBitmap){let s=!0;const n=t._glTextures;for(const a in n){const o=n[a];if(o!==r&&o.dirtyId!==t.dirtyId){s=!1;break}}s&&(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 Xf{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,r){const s=t.width,n=t.height;if(r){const a=e.width/2/s,o=e.height/2/n,l=e.x/s+a,c=e.y/n+o;r=lt.add(r,lt.NW),this.x0=l+a*lt.uX(r),this.y0=c+o*lt.uY(r),r=lt.add(r,2),this.x1=l+a*lt.uX(r),this.y1=c+o*lt.uY(r),r=lt.add(r,2),this.x2=l+a*lt.uX(r),this.y2=c+o*lt.uY(r),r=lt.add(r,2),this.x3=l+a*lt.uX(r),this.y3=c+o*lt.uY(r)}else this.x0=e.x/s,this.y0=e.y/n,this.x1=(e.x+e.width)/s,this.y1=e.y/n,this.x2=(e.x+e.width)/s,this.y2=(e.y+e.height)/n,this.x3=e.x/s,this.y3=(e.y+e.height)/n;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}toString(){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 Ld=new Xf;function ba(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}class ie extends sn{constructor(e,t,r,s,n,a,o){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new Ie(0,0,1,1)),e instanceof ie&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=s,this.valid=!1,this._uvs=Ld,this.uvMatrix=null,this.orig=r||t,this._rotate=Number(n||0),n===!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=a?new ze(a.x,a.y):new ze(0,0),this.defaultBorders=o,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?.url&&Bi[t.url]&&ie.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,ie.removeFromCache(this),this.textureCacheIds=null}clone(){const e=this._frame.clone(),t=this._frame===this.orig?e:this.orig.clone(),r=new ie(this.baseTexture,!this.noFrame&&e,t,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=e),r}updateUvs(){this._uvs===Ld&&(this._uvs=new Xf),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},r=fe.STRICT_TEXTURE_CACHE){const s=typeof e=="string";let n=null;if(s)n=e;else if(e instanceof Me){if(!e.cacheId){const o=t?.pixiIdPrefix||"pixiid";e.cacheId=`${o}-${rs()}`,Me.addToCache(e,e.cacheId)}n=e.cacheId}else{if(!e._pixiId){const o=t?.pixiIdPrefix||"pixiid";e._pixiId=`${o}_${rs()}`}n=e._pixiId}let a=Bi[n];if(s&&r&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(e instanceof Me)?(t.resolution||(t.resolution=Sr(e)),a=new ie(new Me(e,t)),a.baseTexture.cacheId=n,Me.addToCache(a.baseTexture,n),ie.addToCache(a,n)):!a&&e instanceof Me&&(a=new ie(e),ie.addToCache(a,n)),a}static fromURL(e,t){const r=Object.assign({autoLoad:!1},t?.resourceOptions),s=ie.from(e,Object.assign({resourceOptions:r},t),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(e,t,r,s){return new ie(Me.fromBuffer(e,t,r,s))}static fromLoader(e,t,r,s){const n=new Me(e,Object.assign({scaleMode:Me.defaultOptions.scaleMode,resolution:Sr(t)},s)),{resource:a}=n;a instanceof jf&&(a.url=t);const o=new ie(n);return r||(r=t),Me.addToCache(o.baseTexture,r),ie.addToCache(o,r),r!==t&&(Me.addToCache(o.baseTexture,t),ie.addToCache(o,t)),o.baseTexture.valid?Promise.resolve(o):new Promise(l=>{o.baseTexture.once("loaded",()=>l(o))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),Bi[t]&&Bi[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),Bi[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=Bi[e];if(t){const r=t.textureCacheIds.indexOf(e);return r>-1&&t.textureCacheIds.splice(r,1),delete Bi[e],t}}else if(e?.textureCacheIds){for(let t=0;tthis.baseTexture.width,o=r+n>this.baseTexture.height;if(a||o){const l=a&&o?"and":"or",c=`X: ${t} + ${s} = ${t+s} > ${this.baseTexture.width}`,u=`Y: ${r} + ${n} = ${r+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${c} ${l} ${u}`)}this.valid=s&&n&&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 ie._EMPTY||(ie._EMPTY=new ie(new Me),ba(ie._EMPTY),ba(ie._EMPTY.baseTexture)),ie._EMPTY}static get WHITE(){if(!ie._WHITE){const e=fe.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),ie._WHITE=new ie(Me.from(e)),ba(ie._WHITE),ba(ie._WHITE.baseTexture)}return ie._WHITE}}class pt extends ie{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,r=!0){const s=this.baseTexture.resolution,n=Math.round(e*s)/s,a=Math.round(t*s)/s;this.valid=n>0&&a>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=a,r&&this.baseTexture.resize(n,a),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 pt(new Vf(e))}}class Yf{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,r=ft.NONE){const s=new Vf(Object.assign({width:e,height:t,resolution:1,multisample:r},this.textureOptions));return new pt(s)}getOptimalTexture(e,t,r=1,s=ft.NONE){let n;e=Math.ceil(e*r-1e-6),t=Math.ceil(t*r-1e-6),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=io(e),t=io(t),n=((e&65535)<<16|t&65535)>>>0,s>1&&(n+=s*4294967296)):n=s>1?-s:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(e,t,s)),a.filterPoolKey=n,a.setResolution(r),a}getFilterTexture(e,t,r){const s=this.getOptimalTexture(e.width,e.height,t||e.resolution,r||ft.NONE);return s.filterFrame=e.filterFrame,s}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 r=this.texturePool[t];if(r)for(let s=0;s0&&e.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const r=this.texturePool[t];if(r)for(let s=0;s1&&(u=this.getOptimalFilterTexture(c.width,c.height,t.resolution),u.filterFrame=c.filterFrame),r[h].apply(this,c,u,Di.CLEAR,t);const d=c;c=u,u=d}r[h].apply(this,c,l.renderTexture,Di.BLEND,t),h>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(u)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=Di.CLEAR){const{renderTexture:r,state:s}=this.renderer;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e?.filterFrame){const a=this.tempRect;a.x=0,a.y=0,a.width=e.filterFrame.width,a.height=e.filterFrame.height,r.bind(e,e.filterFrame,a)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=s.stateId&1||this.forceClear;(t===Di.CLEAR||t===Di.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,r,s){const n=this.renderer;n.state.set(e.state),this.bindAndClear(r,s),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(Fi.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Fi.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){const{sourceFrame:r,destinationFrame:s}=this.activeState,{orig:n}=t._texture,a=e.set(s.width,0,0,s.height,r.x,r.y),o=t.worldTransform.copyTo(nt.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/n.width,1/n.height),a.translate(t.anchor.x,t.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,r=1,s=ft.NONE){return this.texturePool.getOptimalTexture(e,t,r,s)}getFilterTexture(e,t,r){if(typeof e=="number"){const n=e;e=t,t=n}e=e||this.activeState.renderTexture;const s=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,r||ft.NONE);return s.filterFrame=e.filterFrame,s}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,t){const r=wa[0],s=wa[1],n=wa[2],a=wa[3];r.set(t.left,t.top),s.set(t.left,t.bottom),n.set(t.right,t.top),a.set(t.right,t.bottom),e.apply(r,r),e.apply(s,s),e.apply(n,n),e.apply(a,a);const o=Math.min(r.x,s.x,n.x,a.x),l=Math.min(r.y,s.y,n.y,a.y),c=Math.max(r.x,s.x,n.x,a.x),u=Math.max(r.y,s.y,n.y,a.y);t.x=o,t.y=l,t.width=c-o,t.height=u-l}roundFrame(e,t,r,s,n){if(!(e.width<=0||e.height<=0||r.width<=0||r.height<=0)){if(n){const{a,b:o,c:l,d:c}=n;if((Math.abs(o)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(c)>1e-4))return}n=n?yl.copyFrom(n):yl.identity(),n.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.transformAABB(n,e),e.ceil(t),this.transformAABB(n.invert(),e)}}}$f.extension={type:pe.RendererSystem,name:"filter"};_e.add($f);class y0{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ft.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const v0=new Ie;class qf{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new uh(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 Ie,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;fe.PREFER_ENV===hs.WEBGL_LEGACY&&(t=null,r=null),t?e.drawBuffers=s=>t.drawBuffersWEBGL(s):(this.hasMRT=!1,e.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,r=0){const{gl:s}=this;if(e){const n=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,s.bindFramebuffer(s.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==r&&(e.dirtyId++,e.dirtyFormat++,n.mipLevel=r),n.dirtyId!==e.dirtyId&&(n.dirtyId=e.dirtyId,n.dirtyFormat!==e.dirtyFormat?(n.dirtyFormat=e.dirtyFormat,n.dirtySize=e.dirtySize,this.updateFramebuffer(e,r)):n.dirtySize!==e.dirtySize&&(n.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(let a=0;a>r,o=t.height>>r,l=a/t.width;this.setViewport(t.x*l,t.y*l,a,o)}else{const a=e.width>>r,o=e.height>>r;this.setViewport(0,0,a,o)}}else this.current&&(this.current=null,s.bindFramebuffer(s.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,r,s){const n=this.viewport;e=Math.round(e),t=Math.round(t),r=Math.round(r),s=Math.round(s),(n.width!==r||n.height!==s||n.x!==e||n.y!==t)&&(n.x=e,n.y=t,n.width=r,n.height=s,this.gl.viewport(e,t,r,s))}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,r,s,n=zl.COLOR|zl.DEPTH){const{gl:a}=this;a.clearColor(e,t,r,s),a.clear(n)}initFramebuffer(e){const{gl:t}=this,r=new y0(t.createFramebuffer());return r.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(e),e.disposeRunner.add(this),r}resizeFramebuffer(e){const{gl:t}=this,r=e.glFramebuffers[this.CONTEXT_UID];r.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,r.stencil),r.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,r.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height));const s=e.colorTextures;let n=s.length;t.drawBuffers||(n=Math.min(n,1));for(let a=0;a1&&this.canMultisampleFramebuffer(e)?s.msaaBuffer=s.msaaBuffer||r.createRenderbuffer():s.msaaBuffer&&(r.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));const o=[];for(let l=0;l1&&r.drawBuffers(o),e.depthTexture&&this.writeDepthTexture){const c=e.depthTexture;this.renderer.texture.bind(c,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,c._glTextures[this.CONTEXT_UID].texture,t)}(e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)?(s.stencil=s.stencil||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,s.stencil),s.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,r.DEPTH24_STENCIL8,e.width,e.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,e.width,e.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,s.stencil)):s.stencil&&(r.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){const{msaaSamples:t}=this;let r=ft.NONE;if(e<=1||t===null)return r;for(let s=0;s=0&&this.managedFramebuffers.splice(n,1),e.disposeRunner.remove(this),t||(s.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&s.deleteRenderbuffer(r.msaaBuffer),r.stencil&&s.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,t)}disposeAll(e){const t=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;rr.createVertexArrayOES(),e.bindVertexArray=s=>r.bindVertexArrayOES(s),e.deleteVertexArray=s=>r.deleteVertexArrayOES(s)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(t.webGLVersion!==2){const r=e.getExtension("ANGLE_instanced_arrays");r?(e.vertexAttribDivisor=(s,n)=>r.vertexAttribDivisorANGLE(s,n),e.drawElementsInstanced=(s,n,a,o,l)=>r.drawElementsInstancedANGLE(s,n,a,o,l),e.drawArraysInstanced=(s,n,a,o)=>r.drawArraysInstancedANGLE(s,n,a,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t=t||this.renderer.shader.shader;const{gl:r}=this;let s=e.glVertexArrayObjects[this.CONTEXT_UID],n=!1;s||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=s={},n=!0);const a=s[t.program.id]||this.initGeometryVao(e,t,n);this._activeGeometry=e,this._activeVao!==a&&(this._activeVao=a,this.hasVao?r.bindVertexArray(a):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const e=this._activeGeometry,t=this.renderer.buffer;for(let r=0;r"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 r=this.mapCoord;for(let s=0;s=0;--s)e[s]=r[s]||null,e[s]&&(e[s]._batchLocation=s)}boundArray(e,t,r,s){const{elements:n,ids:a,count:o}=e;let l=0;for(let c=0;c=0&&h=ds.WEBGL2&&(r=e.getContext("webgl2",t)),r)this.webGLVersion=2;else if(this.webGLVersion=1,r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!r)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=r,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")};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(),r="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const s=r||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=s,s||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}ko.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"};ko.extension={type:pe.RendererSystem,name:"context"};_e.add(ko);class f0 extends Zn{upload(e,t,r){const s=e.gl;s.pixelStorei(s.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===Ii.UNPACK);const n=t.realWidth,a=t.realHeight;return r.width===n&&r.height===a?s.texSubImage2D(t.target,0,0,0,n,a,t.format,r.type,this.data):(r.width=n,r.height=a,s.texImage2D(t.target,0,r.internalFormat,n,a,0,t.format,r.type,this.data)),!0}}class ph{constructor(e,t){this.width=Math.round(e||100),this.height=Math.round(t||100),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 Si("disposeFramebuffer"),this.multisample=ft.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new Me(null,{scaleMode:Ki.NEAREST,resolution:1,mipmap:$t.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new Me(new f0(null,{width:this.width,height:this.height}),{scaleMode:Ki.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:$t.OFF,format:ce.DEPTH_COMPONENT,type:Ee.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===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(let r=0;r{const s=this.source;this.url=s.src;const n=()=>{this.destroyed||(s.onload=null,s.onerror=null,this.resize(s.width,s.height),this._load=null,this.createBitmap?t(this.process()):t(this))};s.complete&&s.src?n():(s.onload=n,s.onerror=a=>{r(a),this.onError.emit(a)})}),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,r=!e.crossOrigin||e.crossOrigin==="anonymous";return this._process=fetch(e.src,{mode:r?"cors":"no-cors"}).then(s=>s.blob()).then(s=>t(s,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Ii.UNPACK?"premultiply":"none"})).then(s=>this.destroyed?Promise.reject():(this.bitmap=s,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,t,r){if(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,r);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,r,this.bitmap),!this.preserveBitmap){let s=!0;const n=t._glTextures;for(const a in n){const o=n[a];if(o!==r&&o.dirtyId!==t.dirtyId){s=!1;break}}s&&(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 jf{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,r){const s=t.width,n=t.height;if(r){const a=e.width/2/s,o=e.height/2/n,l=e.x/s+a,c=e.y/n+o;r=lt.add(r,lt.NW),this.x0=l+a*lt.uX(r),this.y0=c+o*lt.uY(r),r=lt.add(r,2),this.x1=l+a*lt.uX(r),this.y1=c+o*lt.uY(r),r=lt.add(r,2),this.x2=l+a*lt.uX(r),this.y2=c+o*lt.uY(r),r=lt.add(r,2),this.x3=l+a*lt.uX(r),this.y3=c+o*lt.uY(r)}else this.x0=e.x/s,this.y0=e.y/n,this.x1=(e.x+e.width)/s,this.y1=e.y/n,this.x2=(e.x+e.width)/s,this.y2=(e.y+e.height)/n,this.x3=e.x/s,this.y3=(e.y+e.height)/n;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}toString(){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 Ld=new jf;function wa(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}class ie extends nn{constructor(e,t,r,s,n,a,o){if(super(),this.noFrame=!1,t||(this.noFrame=!0,t=new Ie(0,0,1,1)),e instanceof ie&&(e=e.baseTexture),this.baseTexture=e,this._frame=t,this.trim=s,this.valid=!1,this._uvs=Ld,this.uvMatrix=null,this.orig=r||t,this._rotate=Number(n||0),n===!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=a?new ze(a.x,a.y):new ze(0,0),this.defaultBorders=o,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?.url&&Ri[t.url]&&ie.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,ie.removeFromCache(this),this.textureCacheIds=null}clone(){const e=this._frame.clone(),t=this._frame===this.orig?e:this.orig.clone(),r=new ie(this.baseTexture,!this.noFrame&&e,t,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=e),r}updateUvs(){this._uvs===Ld&&(this._uvs=new jf),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(e,t={},r=fe.STRICT_TEXTURE_CACHE){const s=typeof e=="string";let n=null;if(s)n=e;else if(e instanceof Me){if(!e.cacheId){const o=t?.pixiIdPrefix||"pixiid";e.cacheId=`${o}-${as()}`,Me.addToCache(e,e.cacheId)}n=e.cacheId}else{if(!e._pixiId){const o=t?.pixiIdPrefix||"pixiid";e._pixiId=`${o}_${as()}`}n=e._pixiId}let a=Ri[n];if(s&&r&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(e instanceof Me)?(t.resolution||(t.resolution=Sr(e)),a=new ie(new Me(e,t)),a.baseTexture.cacheId=n,Me.addToCache(a.baseTexture,n),ie.addToCache(a,n)):!a&&e instanceof Me&&(a=new ie(e),ie.addToCache(a,n)),a}static fromURL(e,t){const r=Object.assign({autoLoad:!1},t?.resourceOptions),s=ie.from(e,Object.assign({resourceOptions:r},t),!1),n=s.baseTexture.resource;return s.baseTexture.valid?Promise.resolve(s):n.load().then(()=>Promise.resolve(s))}static fromBuffer(e,t,r,s){return new ie(Me.fromBuffer(e,t,r,s))}static fromLoader(e,t,r,s){const n=new Me(e,Object.assign({scaleMode:Me.defaultOptions.scaleMode,resolution:Sr(t)},s)),{resource:a}=n;a instanceof Vf&&(a.url=t);const o=new ie(n);return r||(r=t),Me.addToCache(o.baseTexture,r),ie.addToCache(o,r),r!==t&&(Me.addToCache(o.baseTexture,t),ie.addToCache(o,t)),o.baseTexture.valid?Promise.resolve(o):new Promise(l=>{o.baseTexture.once("loaded",()=>l(o))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),Ri[t]&&Ri[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),Ri[t]=e)}static removeFromCache(e){if(typeof e=="string"){const t=Ri[e];if(t){const r=t.textureCacheIds.indexOf(e);return r>-1&&t.textureCacheIds.splice(r,1),delete Ri[e],t}}else if(e?.textureCacheIds){for(let t=0;tthis.baseTexture.width,o=r+n>this.baseTexture.height;if(a||o){const l=a&&o?"and":"or",c=`X: ${t} + ${s} = ${t+s} > ${this.baseTexture.width}`,u=`Y: ${r} + ${n} = ${r+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${c} ${l} ${u}`)}this.valid=s&&n&&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 ie._EMPTY||(ie._EMPTY=new ie(new Me),wa(ie._EMPTY),wa(ie._EMPTY.baseTexture)),ie._EMPTY}static get WHITE(){if(!ie._WHITE){const e=fe.ADAPTER.createCanvas(16,16),t=e.getContext("2d");e.width=16,e.height=16,t.fillStyle="white",t.fillRect(0,0,16,16),ie._WHITE=new ie(Me.from(e)),wa(ie._WHITE),wa(ie._WHITE.baseTexture)}return ie._WHITE}}class yt extends ie{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,r=!0){const s=this.baseTexture.resolution,n=Math.round(e*s)/s,a=Math.round(t*s)/s;this.valid=n>0&&a>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=a,r&&this.baseTexture.resize(n,a),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 yt(new zf(e))}}class Xf{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,r=ft.NONE){const s=new zf(Object.assign({width:e,height:t,resolution:1,multisample:r},this.textureOptions));return new yt(s)}getOptimalTexture(e,t,r=1,s=ft.NONE){let n;e=Math.ceil(e*r-1e-6),t=Math.ceil(t*r-1e-6),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=ro(e),t=ro(t),n=((e&65535)<<16|t&65535)>>>0,s>1&&(n+=s*4294967296)):n=s>1?-s:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(e,t,s)),a.filterPoolKey=n,a.setResolution(r),a}getFilterTexture(e,t,r){const s=this.getOptimalTexture(e.width,e.height,t||e.resolution,r||ft.NONE);return s.filterFrame=e.filterFrame,s}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 r=this.texturePool[t];if(r)for(let s=0;s0&&e.height>0;for(const t in this.texturePool){if(!(Number(t)<0))continue;const r=this.texturePool[t];if(r)for(let s=0;s1&&(u=this.getOptimalFilterTexture(c.width,c.height,t.resolution),u.filterFrame=c.filterFrame),r[h].apply(this,c,u,Li.CLEAR,t);const d=c;c=u,u=d}r[h].apply(this,c,l.renderTexture,Li.BLEND,t),h>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(u)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=Li.CLEAR){const{renderTexture:r,state:s}=this.renderer;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e?.filterFrame){const a=this.tempRect;a.x=0,a.y=0,a.width=e.filterFrame.width,a.height=e.filterFrame.height,r.bind(e,e.filterFrame,a)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?r.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=s.stateId&1||this.forceClear;(t===Li.CLEAR||t===Li.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,r,s){const n=this.renderer;n.state.set(e.state),this.bindAndClear(r,s),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(Ni.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Ni.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){const{sourceFrame:r,destinationFrame:s}=this.activeState,{orig:n}=t._texture,a=e.set(s.width,0,0,s.height,r.x,r.y),o=t.worldTransform.copyTo(at.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/n.width,1/n.height),a.translate(t.anchor.x,t.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,r=1,s=ft.NONE){return this.texturePool.getOptimalTexture(e,t,r,s)}getFilterTexture(e,t,r){if(typeof e=="number"){const n=e;e=t,t=n}e=e||this.activeState.renderTexture;const s=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,r||ft.NONE);return s.filterFrame=e.filterFrame,s}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,t){const r=_a[0],s=_a[1],n=_a[2],a=_a[3];r.set(t.left,t.top),s.set(t.left,t.bottom),n.set(t.right,t.top),a.set(t.right,t.bottom),e.apply(r,r),e.apply(s,s),e.apply(n,n),e.apply(a,a);const o=Math.min(r.x,s.x,n.x,a.x),l=Math.min(r.y,s.y,n.y,a.y),c=Math.max(r.x,s.x,n.x,a.x),u=Math.max(r.y,s.y,n.y,a.y);t.x=o,t.y=l,t.width=c-o,t.height=u-l}roundFrame(e,t,r,s,n){if(!(e.width<=0||e.height<=0||r.width<=0||r.height<=0)){if(n){const{a,b:o,c:l,d:c}=n;if((Math.abs(o)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(c)>1e-4))return}n=n?bl.copyFrom(n):bl.identity(),n.translate(-r.x,-r.y).scale(s.width/r.width,s.height/r.height).translate(s.x,s.y),this.transformAABB(n,e),e.ceil(t),this.transformAABB(n.invert(),e)}}}$f.extension={type:pe.RendererSystem,name:"filter"};_e.add($f);class g0{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=ft.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const y0=new Ie;class qf{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new ph(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 Ie,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,r=this.renderer.context.extensions.depthTexture;fe.PREFER_ENV===ds.WEBGL_LEGACY&&(t=null,r=null),t?e.drawBuffers=s=>t.drawBuffersWEBGL(s):(this.hasMRT=!1,e.drawBuffers=()=>{}),r||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,r=0){const{gl:s}=this;if(e){const n=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,s.bindFramebuffer(s.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==r&&(e.dirtyId++,e.dirtyFormat++,n.mipLevel=r),n.dirtyId!==e.dirtyId&&(n.dirtyId=e.dirtyId,n.dirtyFormat!==e.dirtyFormat?(n.dirtyFormat=e.dirtyFormat,n.dirtySize=e.dirtySize,this.updateFramebuffer(e,r)):n.dirtySize!==e.dirtySize&&(n.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(let a=0;a>r,o=t.height>>r,l=a/t.width;this.setViewport(t.x*l,t.y*l,a,o)}else{const a=e.width>>r,o=e.height>>r;this.setViewport(0,0,a,o)}}else this.current&&(this.current=null,s.bindFramebuffer(s.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,r,s){const n=this.viewport;e=Math.round(e),t=Math.round(t),r=Math.round(r),s=Math.round(s),(n.width!==r||n.height!==s||n.x!==e||n.y!==t)&&(n.x=e,n.y=t,n.width=r,n.height=s,this.gl.viewport(e,t,r,s))}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,r,s,n=jl.COLOR|jl.DEPTH){const{gl:a}=this;a.clearColor(e,t,r,s),a.clear(n)}initFramebuffer(e){const{gl:t}=this,r=new g0(t.createFramebuffer());return r.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(e),e.disposeRunner.add(this),r}resizeFramebuffer(e){const{gl:t}=this,r=e.glFramebuffers[this.CONTEXT_UID];r.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,r.stencil),r.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,r.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height));const s=e.colorTextures;let n=s.length;t.drawBuffers||(n=Math.min(n,1));for(let a=0;a1&&this.canMultisampleFramebuffer(e)?s.msaaBuffer=s.msaaBuffer||r.createRenderbuffer():s.msaaBuffer&&(r.deleteRenderbuffer(s.msaaBuffer),s.msaaBuffer=null,s.blitFramebuffer&&(s.blitFramebuffer.dispose(),s.blitFramebuffer=null));const o=[];for(let l=0;l1&&r.drawBuffers(o),e.depthTexture&&this.writeDepthTexture){const c=e.depthTexture;this.renderer.texture.bind(c,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,c._glTextures[this.CONTEXT_UID].texture,t)}(e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)?(s.stencil=s.stencil||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,s.stencil),s.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,s.multisample,r.DEPTH24_STENCIL8,e.width,e.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,e.width,e.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,s.stencil)):s.stencil&&(r.deleteRenderbuffer(s.stencil),s.stencil=null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){const{msaaSamples:t}=this;let r=ft.NONE;if(e<=1||t===null)return r;for(let s=0;s=0&&this.managedFramebuffers.splice(n,1),e.disposeRunner.remove(this),t||(s.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&s.deleteRenderbuffer(r.msaaBuffer),r.stencil&&s.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&this.disposeFramebuffer(r.blitFramebuffer,t)}disposeAll(e){const t=this.managedFramebuffers;this.managedFramebuffers=[];for(let r=0;rr.createVertexArrayOES(),e.bindVertexArray=s=>r.bindVertexArrayOES(s),e.deleteVertexArray=s=>r.deleteVertexArrayOES(s)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(t.webGLVersion!==2){const r=e.getExtension("ANGLE_instanced_arrays");r?(e.vertexAttribDivisor=(s,n)=>r.vertexAttribDivisorANGLE(s,n),e.drawElementsInstanced=(s,n,a,o,l)=>r.drawElementsInstancedANGLE(s,n,a,o,l),e.drawArraysInstanced=(s,n,a,o)=>r.drawArraysInstancedANGLE(s,n,a,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t=t||this.renderer.shader.shader;const{gl:r}=this;let s=e.glVertexArrayObjects[this.CONTEXT_UID],n=!1;s||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=s={},n=!0);const a=s[t.program.id]||this.initGeometryVao(e,t,n);this._activeGeometry=e,this._activeVao!==a&&(this._activeVao=a,this.hasVao?r.bindVertexArray(a):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const e=this._activeGeometry,t=this.renderer.buffer;for(let r=0;r"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 r=this.mapCoord;for(let s=0;s0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==t&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}destroy(){this.renderer=null}}Zf.extension={type:pe.RendererSystem,name:"mask"};_e.add(Zf);class Jf{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){const{gl:t}=this.renderer,r=this.getStackLength();this.maskStack=e;const s=this.getStackLength();s!==r&&(s===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Fd=new nt,Nd=[],Wa=class extends Jf{constructor(i){super(i),this.glConst=fe.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const i=this.maskStack[this.maskStack.length-1];return i?i._scissorCounter:0}calcScissorRect(i){if(i._scissorRectLocal)return;const e=i._scissorRect,{maskObject:t}=i,{renderer:r}=this,s=r.renderTexture,n=t.getBounds(!0,Nd.pop()??new Ie);this.roundFrameToPixels(n,s.current?s.current.resolution:r.resolution,s.sourceFrame,s.destinationFrame,r.projection.transform),e&&n.fit(e),i._scissorRectLocal=n}static isMatrixRotated(i){if(!i)return!1;const{a:e,b:t,c:r,d:s}=i;return(Math.abs(t)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(s)>1e-4)}testScissor(i){const{maskObject:e}=i;if(!e.isFastRect||!e.isFastRect()||Wa.isMatrixRotated(e.worldTransform)||Wa.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(i);const t=i._scissorRectLocal;return t.width>0&&t.height>0}roundFrameToPixels(i,e,t,r,s){Wa.isMatrixRotated(s)||(s=s?Fd.copyFrom(s):Fd.identity(),s.translate(-t.x,-t.y).scale(r.width/t.width,r.height/t.height).translate(r.x,r.y),this.renderer.filter.transformAABB(s,i),i.fit(r),i.x=Math.round(i.x*e),i.y=Math.round(i.y*e),i.width=Math.round(i.width*e),i.height=Math.round(i.height*e))}push(i){i._scissorRectLocal||this.calcScissorRect(i);const{gl:e}=this.renderer;i._scissorRect||e.enable(e.SCISSOR_TEST),i._scissorCounter++,i._scissorRect=i._scissorRectLocal,this._useCurrent()}pop(i){const{gl:e}=this.renderer;i&&Nd.push(i._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const i=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=i.y:e=this.renderer.height-i.height-i.y,this.renderer.gl.scissor(i.x,e,i.width,i.height)}};let ep=Wa;ep.extension={type:pe.RendererSystem,name:"scissor"};_e.add(ep);class tp extends Jf{constructor(e){super(e),this.glConst=fe.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:r}=this.renderer,s=e._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),e._stencilCounter++;const n=e._colorMask;n!==0&&(e._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,s,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,n!==0&&(e._colorMask=n,r.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(e){const t=this.renderer.gl;if(this.getStackLength()===0)t.disable(t.STENCIL_TEST);else{const r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=r?r._colorMask:15;s!==0&&(r._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,s!==0&&(r._colorMask=s,t.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&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)}}tp.extension={type:pe.RendererSystem,name:"stencil"};_e.add(tp);class ip{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return Ue("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return Ue("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return Ue("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}}ip.extension={type:[pe.RendererSystem,pe.CanvasRendererSystem],name:"_plugin"};_e.add(ip);class rp{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new nt,this.transform=null}update(e,t,r,s){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,s),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(e,t,r,s){const n=this.projectionMatrix,a=s?-1:1;n.identity(),n.a=1/t.width*2,n.d=a*(1/t.height*2),n.tx=-1-t.x*n.a,n.ty=-a-t.y*n.d}setTransform(e){}destroy(){this.renderer=null}}rp.extension={type:pe.RendererSystem,name:"projection"};_e.add(rp);const A0=new Eo;class sp{constructor(e){this.renderer=e,this._tempMatrix=new nt}generateTexture(e,t){const{region:r,...s}=t||{},n=r||e.getLocalBounds(null,!0);n.width===0&&(n.width=1),n.height===0&&(n.height=1);const a=pt.create({width:n.width,height:n.height,...s});this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const o=e.transform;return e.transform=A0,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=o,a}destroy(){}}sp.extension={type:[pe.RendererSystem,pe.CanvasRendererSystem],name:"textureGenerator"};_e.add(sp);const Dr=new Ie,mn=new Ie;class np{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new Ie,this.destinationFrame=new Ie,this.viewportFrame=new Ie}contextChange(){const e=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,t,r){const s=this.renderer;this.current=e;let n,a,o;e?(n=e.baseTexture,o=n.resolution,t||(Dr.width=e.frame.width,Dr.height=e.frame.height,t=Dr),r||(mn.x=e.frame.x,mn.y=e.frame.y,mn.width=t.width,mn.height=t.height,r=mn),a=n.framebuffer):(o=s.resolution,t||(Dr.width=s._view.screen.width,Dr.height=s._view.screen.height,t=Dr),r||(r=Dr,r.width=t.width,r.height=t.height));const l=this.viewportFrame;l.x=r.x*o,l.y=r.y*o,l.width=r.width*o,l.height=r.height*o,e||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(a,l),this.renderer.projection.update(r,t,o,!a),e?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(r)}clear(e,t){const r=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=qe.shared.setValue(e||r);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==a.width||n.height!==a.height;if(o){let{x:l,y:c,width:u,height:h}=this.viewportFrame;l=Math.round(l),c=Math.round(c),u=Math.round(u),h=Math.round(h),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,c,u,h)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,t),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}np.extension={type:pe.RendererSystem,name:"renderTexture"};_e.add(np);class E0{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 T0(i,e){const t={},r=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let s=0;sc>u?1:-1);for(let c=0;c0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==t&&this.renderer.gl.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)}destroy(){this.renderer=null}}Qf.extension={type:pe.RendererSystem,name:"mask"};_e.add(Qf);class Zf{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){const{gl:t}=this.renderer,r=this.getStackLength();this.maskStack=e;const s=this.getStackLength();s!==r&&(s===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const Fd=new at,Nd=[],za=class extends Zf{constructor(i){super(i),this.glConst=fe.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const i=this.maskStack[this.maskStack.length-1];return i?i._scissorCounter:0}calcScissorRect(i){if(i._scissorRectLocal)return;const e=i._scissorRect,{maskObject:t}=i,{renderer:r}=this,s=r.renderTexture,n=t.getBounds(!0,Nd.pop()??new Ie);this.roundFrameToPixels(n,s.current?s.current.resolution:r.resolution,s.sourceFrame,s.destinationFrame,r.projection.transform),e&&n.fit(e),i._scissorRectLocal=n}static isMatrixRotated(i){if(!i)return!1;const{a:e,b:t,c:r,d:s}=i;return(Math.abs(t)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(s)>1e-4)}testScissor(i){const{maskObject:e}=i;if(!e.isFastRect||!e.isFastRect()||za.isMatrixRotated(e.worldTransform)||za.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(i);const t=i._scissorRectLocal;return t.width>0&&t.height>0}roundFrameToPixels(i,e,t,r,s){za.isMatrixRotated(s)||(s=s?Fd.copyFrom(s):Fd.identity(),s.translate(-t.x,-t.y).scale(r.width/t.width,r.height/t.height).translate(r.x,r.y),this.renderer.filter.transformAABB(s,i),i.fit(r),i.x=Math.round(i.x*e),i.y=Math.round(i.y*e),i.width=Math.round(i.width*e),i.height=Math.round(i.height*e))}push(i){i._scissorRectLocal||this.calcScissorRect(i);const{gl:e}=this.renderer;i._scissorRect||e.enable(e.SCISSOR_TEST),i._scissorCounter++,i._scissorRect=i._scissorRectLocal,this._useCurrent()}pop(i){const{gl:e}=this.renderer;i&&Nd.push(i._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const i=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=i.y:e=this.renderer.height-i.height-i.y,this.renderer.gl.scissor(i.x,e,i.width,i.height)}};let Jf=za;Jf.extension={type:pe.RendererSystem,name:"scissor"};_e.add(Jf);class ep extends Zf{constructor(e){super(e),this.glConst=fe.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:r}=this.renderer,s=e._stencilCounter;s===0&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),e._stencilCounter++;const n=e._colorMask;n!==0&&(e._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,s,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,n!==0&&(e._colorMask=n,r.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(e){const t=this.renderer.gl;if(this.getStackLength()===0)t.disable(t.STENCIL_TEST);else{const r=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,s=r?r._colorMask:15;s!==0&&(r._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,s!==0&&(r._colorMask=s,t.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&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)}}ep.extension={type:pe.RendererSystem,name:"stencil"};_e.add(ep);class tp{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return Ue("7.0.0","renderer.plugins.extract has moved to renderer.extract"),e.extract}},prepare:{enumerable:!1,get(){return Ue("7.0.0","renderer.plugins.prepare has moved to renderer.prepare"),e.prepare}},interaction:{enumerable:!1,get(){return Ue("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}}tp.extension={type:[pe.RendererSystem,pe.CanvasRendererSystem],name:"_plugin"};_e.add(tp);class ip{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new at,this.transform=null}update(e,t,r,s){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,s),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(e,t,r,s){const n=this.projectionMatrix,a=s?-1:1;n.identity(),n.a=1/t.width*2,n.d=a*(1/t.height*2),n.tx=-1-t.x*n.a,n.ty=-a-t.y*n.d}setTransform(e){}destroy(){this.renderer=null}}ip.extension={type:pe.RendererSystem,name:"projection"};_e.add(ip);const x0=new So;class rp{constructor(e){this.renderer=e,this._tempMatrix=new at}generateTexture(e,t){const{region:r,...s}=t||{},n=r||e.getLocalBounds(null,!0);n.width===0&&(n.width=1),n.height===0&&(n.height=1);const a=yt.create({width:n.width,height:n.height,...s});this._tempMatrix.tx=-n.x,this._tempMatrix.ty=-n.y;const o=e.transform;return e.transform=x0,this.renderer.render(e,{renderTexture:a,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=o,a}destroy(){}}rp.extension={type:[pe.RendererSystem,pe.CanvasRendererSystem],name:"textureGenerator"};_e.add(rp);const Lr=new Ie,gn=new Ie;class sp{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new Ie,this.destinationFrame=new Ie,this.viewportFrame=new Ie}contextChange(){const e=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,t,r){const s=this.renderer;this.current=e;let n,a,o;e?(n=e.baseTexture,o=n.resolution,t||(Lr.width=e.frame.width,Lr.height=e.frame.height,t=Lr),r||(gn.x=e.frame.x,gn.y=e.frame.y,gn.width=t.width,gn.height=t.height,r=gn),a=n.framebuffer):(o=s.resolution,t||(Lr.width=s._view.screen.width,Lr.height=s._view.screen.height,t=Lr),r||(r=Lr,r.width=t.width,r.height=t.height));const l=this.viewportFrame;l.x=r.x*o,l.y=r.y*o,l.width=r.width*o,l.height=r.height*o,e||(l.y=s.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(a,l),this.renderer.projection.update(r,t,o,!a),e?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(r)}clear(e,t){const r=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,s=Ke.shared.setValue(e||r);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&s.premultiply(s.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==a.width||n.height!==a.height;if(o){let{x:l,y:c,width:u,height:h}=this.viewportFrame;l=Math.round(l),c=Math.round(c),u=Math.round(u),h=Math.round(h),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(l,c,u,h)}this.renderer.framebuffer.clear(s.red,s.green,s.blue,s.alpha,t),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}sp.extension={type:pe.RendererSystem,name:"renderTexture"};_e.add(sp);class A0{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 E0(i,e){const t={},r=e.getProgramParameter(i,e.ACTIVE_ATTRIBUTES);for(let s=0;sc>u?1:-1);for(let c=0;c({data:n,offset:0,dataLen:0,dirty:0}));let t=0,r=0,s=0;for(let n=0;n1&&(t=Math.max(t,16)*a.data.size),a.dataLen=t,r%t!==0&&r<16){const o=r%t%16;r+=o,s+=o}r+t>16?(s=Math.ceil(s/16)*16,a.offset=s,s+=t,r=t):(a.offset=s,r+=t,s+=t)}return s=Math.ceil(s/16)*16,{uboElements:e,size:s}}function P0(i,e){const t=[];for(const r in i)e[r]&&t.push(e[r]);return t.sort((r,s)=>r.index-s.index),t}function B0(i,e){if(!i.autoManage)return{size:0,syncFunc:M0};const t=P0(i.uniforms,e),{uboElements:r,size:s}=I0(t),n=[` + `},np={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function k0(i){const e=i.map(n=>({data:n,offset:0,dataLen:0,dirty:0}));let t=0,r=0,s=0;for(let n=0;n1&&(t=Math.max(t,16)*a.data.size),a.dataLen=t,r%t!==0&&r<16){const o=r%t%16;r+=o,s+=o}r+t>16?(s=Math.ceil(s/16)*16,a.offset=s,s+=t,r=t):(a.offset=s,r+=t,s+=t)}return s=Math.ceil(s/16)*16,{uboElements:e,size:s}}function I0(i,e){const t=[];for(const r in i)e[r]&&t.push(e[r]);return t.sort((r,s)=>r.index-s.index),t}function P0(i,e){if(!i.autoManage)return{size:0,syncFunc:C0};const t=I0(i.uniforms,e),{uboElements:r,size:s}=k0(t),n=[` var v = null; var v2 = null; var cv = null; @@ -462,7 +463,7 @@ void main(void) var gl = renderer.gl var index = 0; var data = buffer.data; - `];for(let a=0;a1){const h=Gf(o.data.type),d=Math.max(ap[o.data.type]/16,1),f=h/d,p=(4-f%4)%4;n.push(` + `];for(let a=0;a1){const h=Hf(o.data.type),d=Math.max(np[o.data.type]/16,1),f=h/d,p=(4-f%4)%4;n.push(` cv = ud.${c}.value; v = uv.${c}; offset = ${o.offset/4}; @@ -478,7 +479,7 @@ void main(void) offset += ${p}; } - `)}else{const h=k0[o.data.type];n.push(` + `)}else{const h=M0[o.data.type];n.push(` cv = ud.${c}.value; v = uv.${c}; offset = ${o.offset/4}; @@ -486,7 +487,7 @@ void main(void) `)}}return n.push(` renderer.buffer.update(buffer); `),{size:s,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(` -`))}}let R0=0;const _a={textureCount:0,uboCount:0};class op{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=R0++}systemCheck(){if(!s0())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 r=e.program,s=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==r&&(this.program=r,this.gl.useProgram(s.program)),t||(_a.textureCount=0,_a.uboCount=0,this.syncUniformGroup(e.uniformGroup,_a)),s}setUniforms(e){const t=this.shader.program,r=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(r.uniformData,e,this.renderer)}syncUniformGroup(e,t){const r=this.getGlProgram();(!e.static||e.dirtyId!==r.uniformDirtyGroups[e.id])&&(r.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,r,t))}syncUniforms(e,t,r){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,r)}createSyncGroups(e){const t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=Jv(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){const r=this.getGlProgram();if(!e.static||e.dirtyId!==0||!r.uniformGroups[e.id]){e.dirtyId=0;const s=r.uniformGroups[e.id]||this.createSyncBufferGroup(e,r,t);e.buffer.update(),s(r.uniformData,e.uniforms,this.renderer,_a,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,r.uniformBufferBindings[t])}createSyncBufferGroup(e,t,r){const{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);const n=this.gl.getUniformBlockIndex(t.program,r);t.uniformBufferBindings[r]=this.shader.uniformBindCount,s.uniformBlockBinding(t.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(e,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=B0(e,this.shader.program.uniformData)),e.autoManage){const l=new Float32Array(o.size/4);e.buffer.update(l)}return t.uniformGroups[e.id]=o.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,r){const s=e.uniforms,n=[`${r}-`];for(const a in s)n.push(a),t[a]&&n.push(t[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){const t=this.gl,r=e.program,s=C0(t,r);return r.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}op.extension={type:pe.RendererSystem,name:"shader"};_e.add(op);class Mo{constructor(e){this.renderer=e}run(e){const{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.2.4 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}}Mo.defaultOptions={hello:!1};Mo.extension={type:[pe.RendererSystem,pe.CanvasRendererSystem],name:"startup"};_e.add(Mo);function D0(i,e=[]){return e[Ae.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.ADD]=[i.ONE,i.ONE],e[Ae.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.NONE]=[0,0],e[Ae.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],e[Ae.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.SRC_IN]=[i.DST_ALPHA,i.ZERO],e[Ae.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],e[Ae.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],e[Ae.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],e[Ae.DST_IN]=[i.ZERO,i.SRC_ALPHA],e[Ae.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],e[Ae.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],e[Ae.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],e[Ae.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],e}const L0=0,O0=1,F0=2,N0=3,U0=4,H0=5,fh=class{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Ae.NONE,this._blendEq=!1,this.map=[],this.map[L0]=this.setBlend,this.map[O0]=this.setOffset,this.map[F0]=this.setCullFace,this.map[N0]=this.setDepthTest,this.map[U0]=this.setFrontFace,this.map[H0]=this.setDepthMask,this.checks=[],this.defaultState=new rr,this.defaultState.blend=!0}contextChange(i){this.gl=i,this.blendModes=D0(i),this.set(this.defaultState),this.reset()}set(i){if(i=i||this.defaultState,this.stateId!==i.data){let e=this.stateId^i.data,t=0;for(;e;)e&1&&this.map[t].call(this,!!(i.data&1<>1,t++;this.stateId=i.data}for(let e=0;ee.systems[s]),r=[...t,...Object.keys(e.systems).filter(s=>!t.includes(s))];for(const s of r)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(t=>{this.runners[t]=new Ti(t)})}addSystem(e,t){const r=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=r,this._systemsHash[t]=r;for(const s in this.runners)this.runners[s].add(r);return this}emitWithCustomOptions(e,t){const r=Object.keys(this._systemsHash);e.items.forEach(s=>{const n=r.find(a=>this._systemsHash[a]===s);s[e.name](t[n])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}}const za=class{constructor(i){this.renderer=i,this.count=0,this.checkCount=0,this.maxIdle=za.defaultMaxIdle,this.checkCountMax=za.defaultCheckCountMax,this.mode=za.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==Vh.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const i=this.renderer.texture,e=i.managedTextures;let t=!1;for(let r=0;rthis.maxIdle&&(i.destroyTexture(s,!0),e[r]=null,t=!0)}if(t){let r=0;for(let s=0;s=0;r--)this.unload(i.children[r])}destroy(){this.renderer=null}};let bi=za;bi.defaultMode=Vh.AUTO;bi.defaultMaxIdle=60*60;bi.defaultCheckCountMax=60*10;bi.extension={type:pe.RendererSystem,name:"textureGC"};_e.add(bi);class bl{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=Ee.UNSIGNED_BYTE,this.internalFormat=ce.RGBA,this.samplerType=0}}function W0(i){let e;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?e={[Ee.UNSIGNED_BYTE]:{[ce.RGBA]:i.RGBA8,[ce.RGB]:i.RGB8,[ce.RG]:i.RG8,[ce.RED]:i.R8,[ce.RGBA_INTEGER]:i.RGBA8UI,[ce.RGB_INTEGER]:i.RGB8UI,[ce.RG_INTEGER]:i.RG8UI,[ce.RED_INTEGER]:i.R8UI,[ce.ALPHA]:i.ALPHA,[ce.LUMINANCE]:i.LUMINANCE,[ce.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[Ee.BYTE]:{[ce.RGBA]:i.RGBA8_SNORM,[ce.RGB]:i.RGB8_SNORM,[ce.RG]:i.RG8_SNORM,[ce.RED]:i.R8_SNORM,[ce.RGBA_INTEGER]:i.RGBA8I,[ce.RGB_INTEGER]:i.RGB8I,[ce.RG_INTEGER]:i.RG8I,[ce.RED_INTEGER]:i.R8I},[Ee.UNSIGNED_SHORT]:{[ce.RGBA_INTEGER]:i.RGBA16UI,[ce.RGB_INTEGER]:i.RGB16UI,[ce.RG_INTEGER]:i.RG16UI,[ce.RED_INTEGER]:i.R16UI,[ce.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[Ee.SHORT]:{[ce.RGBA_INTEGER]:i.RGBA16I,[ce.RGB_INTEGER]:i.RGB16I,[ce.RG_INTEGER]:i.RG16I,[ce.RED_INTEGER]:i.R16I},[Ee.UNSIGNED_INT]:{[ce.RGBA_INTEGER]:i.RGBA32UI,[ce.RGB_INTEGER]:i.RGB32UI,[ce.RG_INTEGER]:i.RG32UI,[ce.RED_INTEGER]:i.R32UI,[ce.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[Ee.INT]:{[ce.RGBA_INTEGER]:i.RGBA32I,[ce.RGB_INTEGER]:i.RGB32I,[ce.RG_INTEGER]:i.RG32I,[ce.RED_INTEGER]:i.R32I},[Ee.FLOAT]:{[ce.RGBA]:i.RGBA32F,[ce.RGB]:i.RGB32F,[ce.RG]:i.RG32F,[ce.RED]:i.R32F,[ce.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[Ee.HALF_FLOAT]:{[ce.RGBA]:i.RGBA16F,[ce.RGB]:i.RGB16F,[ce.RG]:i.RG16F,[ce.RED]:i.R16F},[Ee.UNSIGNED_SHORT_5_6_5]:{[ce.RGB]:i.RGB565},[Ee.UNSIGNED_SHORT_4_4_4_4]:{[ce.RGBA]:i.RGBA4},[Ee.UNSIGNED_SHORT_5_5_5_1]:{[ce.RGBA]:i.RGB5_A1},[Ee.UNSIGNED_INT_2_10_10_10_REV]:{[ce.RGBA]:i.RGB10_A2,[ce.RGBA_INTEGER]:i.RGB10_A2UI},[Ee.UNSIGNED_INT_10F_11F_11F_REV]:{[ce.RGB]:i.R11F_G11F_B10F},[Ee.UNSIGNED_INT_5_9_9_9_REV]:{[ce.RGB]:i.RGB9_E5},[Ee.UNSIGNED_INT_24_8]:{[ce.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[Ee.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[ce.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:e={[Ee.UNSIGNED_BYTE]:{[ce.RGBA]:i.RGBA,[ce.RGB]:i.RGB,[ce.ALPHA]:i.ALPHA,[ce.LUMINANCE]:i.LUMINANCE,[ce.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[Ee.UNSIGNED_SHORT_5_6_5]:{[ce.RGB]:i.RGB},[Ee.UNSIGNED_SHORT_4_4_4_4]:{[ce.RGBA]:i.RGBA},[Ee.UNSIGNED_SHORT_5_5_5_1]:{[ce.RGBA]:i.RGBA}},e}class hp{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Me,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=W0(e);const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s=0;--n){const a=t[n];a&&a._glTextures[s].samplerType!==Vl.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(e){const t=new bl(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){t.internalFormat=this.internalFormats[e.type]?.[e.format]??e.format,this.webGLVersion===2&&e.type===Ee.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){const t=e._glTextures[this.CONTEXT_UID];if(!t)return;const r=this.renderer;if(this.initTextureType(e,t),e.resource?.upload(r,e,t))t.samplerType!==Vl.FLOAT&&(this.hasIntegerTextures=!0);else{const s=e.realWidth,n=e.realHeight,a=r.gl;(t.width!==s||t.height!==n||t.dirtyId<0)&&(t.width=s,t.height=n,a.texImage2D(e.target,0,t.internalFormat,s,n,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){const{gl:r}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),r.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){const s=this.managedTextures.indexOf(e);s!==-1&&Hs(this.managedTextures,s,1)}}updateTextureStyle(e){const t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===Kt.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=Ar.CLAMP:t.wrapMode=e.wrapMode,e.resource?.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){const r=this.gl;if(t.mipmap&&e.mipmap!==Kt.ON_MANUAL&&r.generateMipmap(e.target),r.texParameteri(e.target,r.TEXTURE_WRAP_S,t.wrapMode),r.texParameteri(e.target,r.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){r.texParameteri(e.target,r.TEXTURE_MIN_FILTER,e.scaleMode===qi.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===qi.LINEAR){const n=Math.min(e.anisotropicLevel,r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(e.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else r.texParameteri(e.target,r.TEXTURE_MIN_FILTER,e.scaleMode===qi.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(e.target,r.TEXTURE_MAG_FILTER,e.scaleMode===qi.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}}hp.extension={type:pe.RendererSystem,name:"texture"};_e.add(hp);class cp{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:r}=this,s=e._glTransformFeedbacks[r]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){const{gl:r,renderer:s}=this;t&&s.shader.bind(t),r.beginTransformFeedback(e)}endTransformFeedback(){const{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){const{gl:t,renderer:r,CONTEXT_UID:s}=this,n=t.createTransformFeedback();e._glTransformFeedbacks[s]=n,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,n);for(let a=0;a(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))(Mr||{});class wl{constructor(e,t=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=r,this.once=s}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 jt=class{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 wl(null,null,1/0),this.deltaMS=1/jt.targetFPMS,this.elapsedMS=1/jt.targetFPMS,this._tick=i=>{this._requestId=null,this.started&&(this.update(i),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(i,e,t=Mr.NORMAL){return this._addListener(new wl(i,e,t))}addOnce(i,e,t=Mr.NORMAL){return this._addListener(new wl(i,e,t,!0))}_addListener(i){let e=this._head.next,t=this._head;if(!e)i.connect(t);else{for(;e;){if(i.priority>e.priority){i.connect(t);break}t=e,e=e.next}i.previous||i.connect(t)}return this._startIfPossible(),this}remove(i,e){let t=this._head.next;for(;t;)t.match(i,e)?t=t.destroy():t=t.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let i=0,e=this._head;for(;e=e.next;)i++;return i}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let i=this._head.next;for(;i;)i=i.destroy(!0);this._head.destroy(),this._head=null}}update(i=performance.now()){let e;if(i>this.lastTime){if(e=this.elapsedMS=i-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const s=i-this._lastFrame|0;if(s{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Et.shared:new Et,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}dp.extension=pe.Application;_e.add(dp);const up=[];_e.handleByList(pe.Renderer,up);function z0(i){for(const e of up)if(e.test(i))return new e(i);throw new Error("Unable to auto-detect a suitable renderer.")}var V0=`attribute vec2 aVertexPosition; +`))}}let B0=0;const xa={textureCount:0,uboCount:0};class ap{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=B0++}systemCheck(){if(!r0())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 r=e.program,s=r.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==r&&(this.program=r,this.gl.useProgram(s.program)),t||(xa.textureCount=0,xa.uboCount=0,this.syncUniformGroup(e.uniformGroup,xa)),s}setUniforms(e){const t=this.shader.program,r=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(r.uniformData,e,this.renderer)}syncUniformGroup(e,t){const r=this.getGlProgram();(!e.static||e.dirtyId!==r.uniformDirtyGroups[e.id])&&(r.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,r,t))}syncUniforms(e,t,r){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,r)}createSyncGroups(e){const t=this.getSignature(e,this.shader.program.uniformData,"u");return this.cache[t]||(this.cache[t]=Zv(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){const r=this.getGlProgram();if(!e.static||e.dirtyId!==0||!r.uniformGroups[e.id]){e.dirtyId=0;const s=r.uniformGroups[e.id]||this.createSyncBufferGroup(e,r,t);e.buffer.update(),s(r.uniformData,e.uniforms,this.renderer,xa,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,r.uniformBufferBindings[t])}createSyncBufferGroup(e,t,r){const{gl:s}=this.renderer;this.renderer.buffer.bind(e.buffer);const n=this.gl.getUniformBlockIndex(t.program,r);t.uniformBufferBindings[r]=this.shader.uniformBindCount,s.uniformBlockBinding(t.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(e,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=P0(e,this.shader.program.uniformData)),e.autoManage){const l=new Float32Array(o.size/4);e.buffer.update(l)}return t.uniformGroups[e.id]=o.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,r){const s=e.uniforms,n=[`${r}-`];for(const a in s)n.push(a),t[a]&&n.push(t[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){const t=this.gl,r=e.program,s=S0(t,r);return r.glPrograms[this.renderer.CONTEXT_UID]=s,s}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}ap.extension={type:pe.RendererSystem,name:"shader"};_e.add(ap);class Io{constructor(e){this.renderer=e}run(e){const{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.2.4 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}}Io.defaultOptions={hello:!1};Io.extension={type:[pe.RendererSystem,pe.CanvasRendererSystem],name:"startup"};_e.add(Io);function R0(i,e=[]){return e[Ae.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.ADD]=[i.ONE,i.ONE],e[Ae.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.NONE]=[0,0],e[Ae.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],e[Ae.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],e[Ae.SRC_IN]=[i.DST_ALPHA,i.ZERO],e[Ae.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],e[Ae.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],e[Ae.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],e[Ae.DST_IN]=[i.ZERO,i.SRC_ALPHA],e[Ae.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],e[Ae.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],e[Ae.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],e[Ae.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],e}const D0=0,L0=1,O0=2,F0=3,N0=4,U0=5,mh=class{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=Ae.NONE,this._blendEq=!1,this.map=[],this.map[D0]=this.setBlend,this.map[L0]=this.setOffset,this.map[O0]=this.setCullFace,this.map[F0]=this.setDepthTest,this.map[N0]=this.setFrontFace,this.map[U0]=this.setDepthMask,this.checks=[],this.defaultState=new rr,this.defaultState.blend=!0}contextChange(i){this.gl=i,this.blendModes=R0(i),this.set(this.defaultState),this.reset()}set(i){if(i=i||this.defaultState,this.stateId!==i.data){let e=this.stateId^i.data,t=0;for(;e;)e&1&&this.map[t].call(this,!!(i.data&1<>1,t++;this.stateId=i.data}for(let e=0;ee.systems[s]),r=[...t,...Object.keys(e.systems).filter(s=>!t.includes(s))];for(const s of r)this.addSystem(e.systems[s],s)}addRunners(...e){e.forEach(t=>{this.runners[t]=new Si(t)})}addSystem(e,t){const r=new e(this);if(this[t])throw new Error(`Whoops! The name "${t}" is already in use`);this[t]=r,this._systemsHash[t]=r;for(const s in this.runners)this.runners[s].add(r);return this}emitWithCustomOptions(e,t){const r=Object.keys(this._systemsHash);e.items.forEach(s=>{const n=r.find(a=>this._systemsHash[a]===s);s[e.name](t[n])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}}const Va=class{constructor(i){this.renderer=i,this.count=0,this.checkCount=0,this.maxIdle=Va.defaultMaxIdle,this.checkCountMax=Va.defaultCheckCountMax,this.mode=Va.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==jh.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const i=this.renderer.texture,e=i.managedTextures;let t=!1;for(let r=0;rthis.maxIdle&&(i.destroyTexture(s,!0),e[r]=null,t=!0)}if(t){let r=0;for(let s=0;s=0;r--)this.unload(i.children[r])}destroy(){this.renderer=null}};let bi=Va;bi.defaultMode=jh.AUTO;bi.defaultMaxIdle=60*60;bi.defaultCheckCountMax=60*10;bi.extension={type:pe.RendererSystem,name:"textureGC"};_e.add(bi);class _l{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=Ee.UNSIGNED_BYTE,this.internalFormat=ce.RGBA,this.samplerType=0}}function G0(i){let e;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?e={[Ee.UNSIGNED_BYTE]:{[ce.RGBA]:i.RGBA8,[ce.RGB]:i.RGB8,[ce.RG]:i.RG8,[ce.RED]:i.R8,[ce.RGBA_INTEGER]:i.RGBA8UI,[ce.RGB_INTEGER]:i.RGB8UI,[ce.RG_INTEGER]:i.RG8UI,[ce.RED_INTEGER]:i.R8UI,[ce.ALPHA]:i.ALPHA,[ce.LUMINANCE]:i.LUMINANCE,[ce.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[Ee.BYTE]:{[ce.RGBA]:i.RGBA8_SNORM,[ce.RGB]:i.RGB8_SNORM,[ce.RG]:i.RG8_SNORM,[ce.RED]:i.R8_SNORM,[ce.RGBA_INTEGER]:i.RGBA8I,[ce.RGB_INTEGER]:i.RGB8I,[ce.RG_INTEGER]:i.RG8I,[ce.RED_INTEGER]:i.R8I},[Ee.UNSIGNED_SHORT]:{[ce.RGBA_INTEGER]:i.RGBA16UI,[ce.RGB_INTEGER]:i.RGB16UI,[ce.RG_INTEGER]:i.RG16UI,[ce.RED_INTEGER]:i.R16UI,[ce.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[Ee.SHORT]:{[ce.RGBA_INTEGER]:i.RGBA16I,[ce.RGB_INTEGER]:i.RGB16I,[ce.RG_INTEGER]:i.RG16I,[ce.RED_INTEGER]:i.R16I},[Ee.UNSIGNED_INT]:{[ce.RGBA_INTEGER]:i.RGBA32UI,[ce.RGB_INTEGER]:i.RGB32UI,[ce.RG_INTEGER]:i.RG32UI,[ce.RED_INTEGER]:i.R32UI,[ce.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[Ee.INT]:{[ce.RGBA_INTEGER]:i.RGBA32I,[ce.RGB_INTEGER]:i.RGB32I,[ce.RG_INTEGER]:i.RG32I,[ce.RED_INTEGER]:i.R32I},[Ee.FLOAT]:{[ce.RGBA]:i.RGBA32F,[ce.RGB]:i.RGB32F,[ce.RG]:i.RG32F,[ce.RED]:i.R32F,[ce.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[Ee.HALF_FLOAT]:{[ce.RGBA]:i.RGBA16F,[ce.RGB]:i.RGB16F,[ce.RG]:i.RG16F,[ce.RED]:i.R16F},[Ee.UNSIGNED_SHORT_5_6_5]:{[ce.RGB]:i.RGB565},[Ee.UNSIGNED_SHORT_4_4_4_4]:{[ce.RGBA]:i.RGBA4},[Ee.UNSIGNED_SHORT_5_5_5_1]:{[ce.RGBA]:i.RGB5_A1},[Ee.UNSIGNED_INT_2_10_10_10_REV]:{[ce.RGBA]:i.RGB10_A2,[ce.RGBA_INTEGER]:i.RGB10_A2UI},[Ee.UNSIGNED_INT_10F_11F_11F_REV]:{[ce.RGB]:i.R11F_G11F_B10F},[Ee.UNSIGNED_INT_5_9_9_9_REV]:{[ce.RGB]:i.RGB9_E5},[Ee.UNSIGNED_INT_24_8]:{[ce.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[Ee.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[ce.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:e={[Ee.UNSIGNED_BYTE]:{[ce.RGBA]:i.RGBA,[ce.RGB]:i.RGB,[ce.ALPHA]:i.ALPHA,[ce.LUMINANCE]:i.LUMINANCE,[ce.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[Ee.UNSIGNED_SHORT_5_6_5]:{[ce.RGB]:i.RGB},[Ee.UNSIGNED_SHORT_4_4_4_4]:{[ce.RGBA]:i.RGBA},[Ee.UNSIGNED_SHORT_5_5_5_1]:{[ce.RGBA]:i.RGBA}},e}class lp{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new Me,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=G0(e);const t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let s=0;s=0;--n){const a=t[n];a&&a._glTextures[s].samplerType!==Xl.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(e){const t=new _l(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){t.internalFormat=this.internalFormats[e.type]?.[e.format]??e.format,this.webGLVersion===2&&e.type===Ee.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type}updateTexture(e){const t=e._glTextures[this.CONTEXT_UID];if(!t)return;const r=this.renderer;if(this.initTextureType(e,t),e.resource?.upload(r,e,t))t.samplerType!==Xl.FLOAT&&(this.hasIntegerTextures=!0);else{const s=e.realWidth,n=e.realHeight,a=r.gl;(t.width!==s||t.height!==n||t.dirtyId<0)&&(t.width=s,t.height=n,a.texImage2D(e.target,0,t.internalFormat,s,n,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){const{gl:r}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),r.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){const s=this.managedTextures.indexOf(e);s!==-1&&Gs(this.managedTextures,s,1)}}updateTextureStyle(e){const t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===$t.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=Ar.CLAMP:t.wrapMode=e.wrapMode,e.resource?.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){const r=this.gl;if(t.mipmap&&e.mipmap!==$t.ON_MANUAL&&r.generateMipmap(e.target),r.texParameteri(e.target,r.TEXTURE_WRAP_S,t.wrapMode),r.texParameteri(e.target,r.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){r.texParameteri(e.target,r.TEXTURE_MIN_FILTER,e.scaleMode===Ki.LINEAR?r.LINEAR_MIPMAP_LINEAR:r.NEAREST_MIPMAP_NEAREST);const s=this.renderer.context.extensions.anisotropicFiltering;if(s&&e.anisotropicLevel>0&&e.scaleMode===Ki.LINEAR){const n=Math.min(e.anisotropicLevel,r.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));r.texParameterf(e.target,s.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else r.texParameteri(e.target,r.TEXTURE_MIN_FILTER,e.scaleMode===Ki.LINEAR?r.LINEAR:r.NEAREST);r.texParameteri(e.target,r.TEXTURE_MAG_FILTER,e.scaleMode===Ki.LINEAR?r.LINEAR:r.NEAREST)}destroy(){this.renderer=null}}lp.extension={type:pe.RendererSystem,name:"texture"};_e.add(lp);class hp{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:r}=this,s=e._glTransformFeedbacks[r]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,s)}unbind(){const{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){const{gl:r,renderer:s}=this;t&&s.shader.bind(t),r.beginTransformFeedback(e)}endTransformFeedback(){const{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){const{gl:t,renderer:r,CONTEXT_UID:s}=this,n=t.createTransformFeedback();e._glTransformFeedbacks[s]=n,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,n);for(let a=0;a(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))(Mr||{});class xl{constructor(e,t=null,r=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=r,this.once=s}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 jt=class{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 xl(null,null,1/0),this.deltaMS=1/jt.targetFPMS,this.elapsedMS=1/jt.targetFPMS,this._tick=i=>{this._requestId=null,this.started&&(this.update(i),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(i,e,t=Mr.NORMAL){return this._addListener(new xl(i,e,t))}addOnce(i,e,t=Mr.NORMAL){return this._addListener(new xl(i,e,t,!0))}_addListener(i){let e=this._head.next,t=this._head;if(!e)i.connect(t);else{for(;e;){if(i.priority>e.priority){i.connect(t);break}t=e,e=e.next}i.previous||i.connect(t)}return this._startIfPossible(),this}remove(i,e){let t=this._head.next;for(;t;)t.match(i,e)?t=t.destroy():t=t.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let i=0,e=this._head;for(;e=e.next;)i++;return i}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let i=this._head.next;for(;i;)i=i.destroy(!0);this._head.destroy(),this._head=null}}update(i=performance.now()){let e;if(i>this.lastTime){if(e=this.elapsedMS=i-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const s=i-this._lastFrame|0;if(s{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?At.shared:new At,e.autoStart&&this.start()}static destroy(){if(this._ticker){const e=this._ticker;this.ticker=null,e.destroy()}}}cp.extension=pe.Application;_e.add(cp);const dp=[];_e.handleByList(pe.Renderer,dp);function W0(i){for(const e of dp)if(e.test(i))return new e(i);throw new Error("Unable to auto-detect a suitable renderer.")}var z0=`attribute vec2 aVertexPosition; attribute vec2 aTextureCoord; uniform mat3 projectionMatrix; @@ -497,7 +498,7 @@ void main(void) { gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); vTextureCoord = aTextureCoord; -}`,j0=`attribute vec2 aVertexPosition; +}`,V0=`attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; @@ -523,7 +524,7 @@ void main(void) gl_Position = filterVertexPosition(); vTextureCoord = filterTextureCoord(); } -`;const X0=V0,fp=j0;class pp{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){const r=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,r)}else{const r=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,r)}t>=ft.HIGH?this.multisample=ft.HIGH:t>=ft.MEDIUM?this.multisample=ft.MEDIUM:t>=ft.LOW?this.multisample=ft.LOW:this.multisample=ft.NONE}destroy(){}}pp.extension={type:pe.RendererSystem,name:"_multisample"};_e.add(pp);class Y0{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class mp{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:r}=this,s=e._glBuffers[r]||this.createGLBuffer(e);t.bindBuffer(e.type,s.buffer)}unbind(e){const{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){const{gl:r,CONTEXT_UID:s}=this;if(this.boundBufferBases[t]!==e){const n=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,r.bindBufferBase(r.UNIFORM_BUFFER,t,n.buffer)}}bindBufferRange(e,t,r){const{gl:s,CONTEXT_UID:n}=this;r=r||0;const a=e._glBuffers[n]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,a.buffer,r*256,256)}update(e){const{gl:t,CONTEXT_UID:r}=this,s=e._glBuffers[r]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,t.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{const n=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,n)}}dispose(e,t){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];const r=e._glBuffers[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this),r&&(t||s.deleteBuffer(r.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){const t=Object.keys(this.managedBuffers);for(let r=0;rr.resource).filter(r=>r).map(r=>r.load());return this._load=Promise.all(t).then(()=>{const{realWidth:r,realHeight:s}=this.items[0];return this.resize(r,s),Promise.resolve(this)}),this._load}}class K0 extends yp{constructor(e,t){const{width:r,height:s}=t||{};let n,a;Array.isArray(e)?(n=e,a=e.length):a=e,super(a,{width:r,height:s}),n&&this.initFromArray(n,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=Os.TEXTURE_2D_ARRAY}upload(e,t,r){const{length:s,itemDirtyIds:n,items:a}=this,{gl:o}=e;r.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,s,0,t.format,r.type,null);for(let l=0;l0)if(i.resource)this.addResourceAt(i.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else i.target=Os.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.parentTextureArray=this.baseTexture,this.items[e]=i;return i.valid&&!this.valid&&this.resize(i.realWidth,i.realHeight),this.items[e]=i,this}upload(i,e,t){const r=this.itemDirtyIds;for(let s=0;s{if(this.url===null){e(this);return}try{const r=await fe.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await r.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===ki.UNPACK?"premultiply":"none"});if(this.destroyed)return;this.source=n,this.update(),e(this)}catch(r){if(this.destroyed)return;t(r),this.onError.emit(r)}}),this._load)}upload(e,t,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,r)):(this.load(),!1)}dispose(){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 Is._EMPTY=Is._EMPTY??fe.ADAPTER.createCanvas(0,0),Is._EMPTY}}const Va=class extends Cr{constructor(i,e){e=e||{},super(fe.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=i,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(i=>{if(this._resolve=()=>{this.resize(this.source.width,this.source.height),i(this)},Va.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 i=new Image;Cr.crossOrigin(i,this.svg,this._crossorigin),i.src=this.svg,i.onerror=e=>{this._resolve&&(i.onerror=null,this.onError.emit(e))},i.onload=()=>{if(!this._resolve)return;const e=i.width,t=i.height;if(!e||!t)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,s=t*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/t*e,s=this._overrideHeight||this._overrideWidth/e*t),r=Math.round(r),s=Math.round(s);const n=this.source;n.width=r,n.height=s,n._pixiId=`canvas_${rs()}`,n.getContext("2d").drawImage(i,0,0,e,t,0,0,r,s),this._resolve(),this._resolve=null}}static getSize(i){const e=Va.SVG_SIZE.exec(i),t={};return e&&(t[e[1]]=Math.round(parseFloat(e[3])),t[e[5]]=Math.round(parseFloat(e[7]))),t}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(i,e){return e==="svg"||typeof i=="string"&&i.startsWith("data:image/svg+xml")||typeof i=="string"&&Va.SVG_XML.test(i)}};let Vn=Va;Vn.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;const mh=class extends Cr{constructor(i,e){if(e=e||{},!(i instanceof HTMLVideoElement)){const t=document.createElement("video");t.setAttribute("preload","auto"),t.setAttribute("webkit-playsinline",""),t.setAttribute("playsinline",""),typeof i=="string"&&(i=[i]);const r=i[0].src||i[0];Cr.crossOrigin(t,r,e.crossorigin);for(let s=0;s{this.valid?e(this):(this._resolve=e,i.load())}),this._load}_onError(i){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(i)}_isSourcePlaying(){const i=this.source;return!i.paused&&!i.ended&&this._isSourceReady()}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(Et.shared.add(this.update,this),this._isConnectedToTicker=!0)}_onPlayStop(){this._isConnectedToTicker&&(Et.shared.remove(this.update,this),this._isConnectedToTicker=!1)}_onCanPlay(){const i=this.source;i.removeEventListener("canplay",this._onCanPlay),i.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this.resize(i.videoWidth,i.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&i.play()}dispose(){this._isConnectedToTicker&&(Et.shared.remove(this.update,this),this._isConnectedToTicker=!1);const i=this.source;i&&(i.removeEventListener("error",this._onError,!0),i.pause(),i.src="",i.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(i){i!==this._autoUpdate&&(this._autoUpdate=i,!this._autoUpdate&&this._isConnectedToTicker?(Et.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(Et.shared.add(this.update,this),this._isConnectedToTicker=!0))}get updateFPS(){return this._updateFPS}set updateFPS(i){i!==this._updateFPS&&(this._updateFPS=i)}static test(i,e){return globalThis.HTMLVideoElement&&i instanceof HTMLVideoElement||mh.TYPES.includes(e)}};let sc=mh;sc.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"];sc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};lh.push(Is,jf,$0,sc,Vn,Qn,vp,K0);class no{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?Ie.EMPTY:(e=e||new Ie(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:r,b:s,c:n,d:a,tx:o,ty:l}=e,c=r*t.x+n*t.y+o,u=s*t.x+a*t.y+l;this.minX=Math.min(this.minX,c),this.maxX=Math.max(this.maxX,c),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(e){let t=this.minX,r=this.minY,s=this.maxX,n=this.maxY,a=e[0],o=e[1];t=as?a:s,n=o>n?o:n,a=e[2],o=e[3],t=as?a:s,n=o>n?o:n,a=e[4],o=e[5],t=as?a:s,n=o>n?o:n,a=e[6],o=e[7],t=as?a:s,n=o>n?o:n,this.minX=t,this.minY=r,this.maxX=s,this.maxY=n}addFrame(e,t,r,s,n){this.addFrameMatrix(e.worldTransform,t,r,s,n)}addFrameMatrix(e,t,r,s,n){const a=e.a,o=e.b,l=e.c,c=e.d,u=e.tx,h=e.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=a*t+l*r+u,y=o*t+c*r+h;d=gp?g:p,m=y>m?y:m,g=a*s+l*r+u,y=o*s+c*r+h,d=gp?g:p,m=y>m?y:m,g=a*t+l*n+u,y=o*t+c*n+h,d=gp?g:p,m=y>m?y:m,g=a*s+l*n+u,y=o*s+c*n+h,d=gp?g:p,m=y>m?y:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(e,t,r){let s=this.minX,n=this.minY,a=this.maxX,o=this.maxY;for(let l=t;la?c:a,o=u>o?u:o}this.minX=s,this.minY=n,this.maxX=a,this.maxY=o}addVertices(e,t,r,s){this.addVerticesMatrix(e.worldTransform,t,r,s)}addVerticesMatrix(e,t,r,s,n=0,a=n){const o=e.a,l=e.b,c=e.c,u=e.d,h=e.tx,d=e.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let y=r;ys?e.maxX:s,this.maxY=e.maxY>n?e.maxY:n}addBoundsMask(e,t){const r=e.minX>t.minX?e.minX:t.minX,s=e.minY>t.minY?e.minY:t.minY,n=e.maxXc?n:c,this.maxY=a>u?a:u}}addBoundsMatrix(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)}addBoundsArea(e,t){const r=e.minX>t.x?e.minX:t.x,s=e.minY>t.y?e.minY:t.y,n=e.maxXc?n:c,this.maxY=a>u?a:u}}pad(e=0,t=e){this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)}addFramePad(e,t,r,s,n,a){e-=n,t-=a,r+=n,s+=a,this.minX=this.minXr?this.maxX:r,this.minY=this.minYs?this.maxY:s}}class dt extends sn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new Eo,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 no,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 r=0;r1)for(let e=0;ethis.children.length)throw new Error(`${i}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return i.parent&&i.parent.removeChild(i),i.parent=this,this.sortDirty=!0,i.transform._parentID=-1,this.children.splice(e,0,i),this._boundsID++,this.onChildrenChange(e),i.emit("added",this),this.emit("childAdded",i,this,e),i}swapChildren(i,e){if(i===e)return;const t=this.getChildIndex(i),r=this.getChildIndex(e);this.children[t]=e,this.children[r]=i,this.onChildrenChange(t=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const t=this.getChildIndex(i);Hs(this.children,t,1),this.children.splice(e,0,i),this.onChildrenChange(e)}getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]}removeChild(...i){if(i.length>1)for(let e=0;e0&&s<=r){n=this.children.splice(t,s);for(let a=0;a1&&this.children.sort(Z0),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 i=0,e=this.children.length;i0&&e.height>0))return;let t,r;this.cullArea?(t=this.cullArea,r=this.worldTransform):this._render!==gh.prototype._render&&(t=this.getBounds(!0));const s=i.projection.transform;if(s&&(r?(r=Q0.copyFrom(r),r.prepend(s)):r=s),t&&e.intersects(t,r))this._render(i);else if(this.cullArea)return;for(let n=0,a=this.children.length;n=s&&gn.x=n&&gn.y=ft.HIGH?this.multisample=ft.HIGH:t>=ft.MEDIUM?this.multisample=ft.MEDIUM:t>=ft.LOW?this.multisample=ft.LOW:this.multisample=ft.NONE}destroy(){}}fp.extension={type:pe.RendererSystem,name:"_multisample"};_e.add(fp);class X0{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class pp{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:r}=this,s=e._glBuffers[r]||this.createGLBuffer(e);t.bindBuffer(e.type,s.buffer)}unbind(e){const{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){const{gl:r,CONTEXT_UID:s}=this;if(this.boundBufferBases[t]!==e){const n=e._glBuffers[s]||this.createGLBuffer(e);this.boundBufferBases[t]=e,r.bindBufferBase(r.UNIFORM_BUFFER,t,n.buffer)}}bindBufferRange(e,t,r){const{gl:s,CONTEXT_UID:n}=this;r=r||0;const a=e._glBuffers[n]||this.createGLBuffer(e);s.bindBufferRange(s.UNIFORM_BUFFER,t||0,a.buffer,r*256,256)}update(e){const{gl:t,CONTEXT_UID:r}=this,s=e._glBuffers[r]||this.createGLBuffer(e);if(e._updateID!==s.updateID)if(s.updateID=e._updateID,t.bindBuffer(e.type,s.buffer),s.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{const n=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;s.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,n)}}dispose(e,t){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];const r=e._glBuffers[this.CONTEXT_UID],s=this.gl;e.disposeRunner.remove(this),r&&(t||s.deleteBuffer(r.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){const t=Object.keys(this.managedBuffers);for(let r=0;rr.resource).filter(r=>r).map(r=>r.load());return this._load=Promise.all(t).then(()=>{const{realWidth:r,realHeight:s}=this.items[0];return this.resize(r,s),Promise.resolve(this)}),this._load}}class Y0 extends gp{constructor(e,t){const{width:r,height:s}=t||{};let n,a;Array.isArray(e)?(n=e,a=e.length):a=e,super(a,{width:r,height:s}),n&&this.initFromArray(n,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=Fs.TEXTURE_2D_ARRAY}upload(e,t,r){const{length:s,itemDirtyIds:n,items:a}=this,{gl:o}=e;r.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,r.internalFormat,this._width,this._height,s,0,t.format,r.type,null);for(let l=0;l0)if(i.resource)this.addResourceAt(i.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else i.target=Fs.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.parentTextureArray=this.baseTexture,this.items[e]=i;return i.valid&&!this.valid&&this.resize(i.realWidth,i.realHeight),this.items[e]=i,this}upload(i,e,t){const r=this.itemDirtyIds;for(let s=0;s{if(this.url===null){e(this);return}try{const r=await fe.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const s=await r.blob();if(this.destroyed)return;const n=await createImageBitmap(s,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Ii.UNPACK?"premultiply":"none"});if(this.destroyed)return;this.source=n,this.update(),e(this)}catch(r){if(this.destroyed)return;t(r),this.onError.emit(r)}}),this._load)}upload(e,t,r){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(t.alphaMode=this.alphaMode),super.upload(e,t,r)):(this.load(),!1)}dispose(){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 Bs._EMPTY=Bs._EMPTY??fe.ADAPTER.createCanvas(0,0),Bs._EMPTY}}const ja=class extends Cr{constructor(i,e){e=e||{},super(fe.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=i,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(i=>{if(this._resolve=()=>{this.resize(this.source.width,this.source.height),i(this)},ja.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 i=new Image;Cr.crossOrigin(i,this.svg,this._crossorigin),i.src=this.svg,i.onerror=e=>{this._resolve&&(i.onerror=null,this.onError.emit(e))},i.onload=()=>{if(!this._resolve)return;const e=i.width,t=i.height;if(!e||!t)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,s=t*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/t*e,s=this._overrideHeight||this._overrideWidth/e*t),r=Math.round(r),s=Math.round(s);const n=this.source;n.width=r,n.height=s,n._pixiId=`canvas_${as()}`,n.getContext("2d").drawImage(i,0,0,e,t,0,0,r,s),this._resolve(),this._resolve=null}}static getSize(i){const e=ja.SVG_SIZE.exec(i),t={};return e&&(t[e[1]]=Math.round(parseFloat(e[3])),t[e[5]]=Math.round(parseFloat(e[7]))),t}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(i,e){return e==="svg"||typeof i=="string"&&i.startsWith("data:image/svg+xml")||typeof i=="string"&&ja.SVG_XML.test(i)}};let Vn=ja;Vn.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;const yh=class extends Cr{constructor(i,e){if(e=e||{},!(i instanceof HTMLVideoElement)){const t=document.createElement("video");t.setAttribute("preload","auto"),t.setAttribute("webkit-playsinline",""),t.setAttribute("playsinline",""),typeof i=="string"&&(i=[i]);const r=i[0].src||i[0];Cr.crossOrigin(t,r,e.crossorigin);for(let s=0;s{this.valid?e(this):(this._resolve=e,i.load())}),this._load}_onError(i){this.source.removeEventListener("error",this._onError,!0),this.onError.emit(i)}_isSourcePlaying(){const i=this.source;return!i.paused&&!i.ended&&this._isSourceReady()}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(At.shared.add(this.update,this),this._isConnectedToTicker=!0)}_onPlayStop(){this._isConnectedToTicker&&(At.shared.remove(this.update,this),this._isConnectedToTicker=!1)}_onCanPlay(){const i=this.source;i.removeEventListener("canplay",this._onCanPlay),i.removeEventListener("canplaythrough",this._onCanPlay);const e=this.valid;this.resize(i.videoWidth,i.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&i.play()}dispose(){this._isConnectedToTicker&&(At.shared.remove(this.update,this),this._isConnectedToTicker=!1);const i=this.source;i&&(i.removeEventListener("error",this._onError,!0),i.pause(),i.src="",i.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(i){i!==this._autoUpdate&&(this._autoUpdate=i,!this._autoUpdate&&this._isConnectedToTicker?(At.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(At.shared.add(this.update,this),this._isConnectedToTicker=!0))}get updateFPS(){return this._updateFPS}set updateFPS(i){i!==this._updateFPS&&(this._updateFPS=i)}static test(i,e){return globalThis.HTMLVideoElement&&i instanceof HTMLVideoElement||yh.TYPES.includes(e)}};let nc=yh;nc.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"];nc.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};ch.push(Bs,Vf,$0,nc,Vn,Zn,yp,Y0);class ao{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?Ie.EMPTY:(e=e||new Ie(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:r,b:s,c:n,d:a,tx:o,ty:l}=e,c=r*t.x+n*t.y+o,u=s*t.x+a*t.y+l;this.minX=Math.min(this.minX,c),this.maxX=Math.max(this.maxX,c),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)}addQuad(e){let t=this.minX,r=this.minY,s=this.maxX,n=this.maxY,a=e[0],o=e[1];t=as?a:s,n=o>n?o:n,a=e[2],o=e[3],t=as?a:s,n=o>n?o:n,a=e[4],o=e[5],t=as?a:s,n=o>n?o:n,a=e[6],o=e[7],t=as?a:s,n=o>n?o:n,this.minX=t,this.minY=r,this.maxX=s,this.maxY=n}addFrame(e,t,r,s,n){this.addFrameMatrix(e.worldTransform,t,r,s,n)}addFrameMatrix(e,t,r,s,n){const a=e.a,o=e.b,l=e.c,c=e.d,u=e.tx,h=e.ty;let d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,g=a*t+l*r+u,y=o*t+c*r+h;d=gp?g:p,m=y>m?y:m,g=a*s+l*r+u,y=o*s+c*r+h,d=gp?g:p,m=y>m?y:m,g=a*t+l*n+u,y=o*t+c*n+h,d=gp?g:p,m=y>m?y:m,g=a*s+l*n+u,y=o*s+c*n+h,d=gp?g:p,m=y>m?y:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(e,t,r){let s=this.minX,n=this.minY,a=this.maxX,o=this.maxY;for(let l=t;la?c:a,o=u>o?u:o}this.minX=s,this.minY=n,this.maxX=a,this.maxY=o}addVertices(e,t,r,s){this.addVerticesMatrix(e.worldTransform,t,r,s)}addVerticesMatrix(e,t,r,s,n=0,a=n){const o=e.a,l=e.b,c=e.c,u=e.d,h=e.tx,d=e.ty;let f=this.minX,p=this.minY,m=this.maxX,g=this.maxY;for(let y=r;ys?e.maxX:s,this.maxY=e.maxY>n?e.maxY:n}addBoundsMask(e,t){const r=e.minX>t.minX?e.minX:t.minX,s=e.minY>t.minY?e.minY:t.minY,n=e.maxXc?n:c,this.maxY=a>u?a:u}}addBoundsMatrix(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)}addBoundsArea(e,t){const r=e.minX>t.x?e.minX:t.x,s=e.minY>t.y?e.minY:t.y,n=e.maxXc?n:c,this.maxY=a>u?a:u}}pad(e=0,t=e){this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)}addFramePad(e,t,r,s,n,a){e-=n,t-=a,r+=n,s+=a,this.minX=this.minXr?this.maxX:r,this.minY=this.minYs?this.maxY:s}}class dt extends nn{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new So,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 ao,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 r=0;r1)for(let e=0;ethis.children.length)throw new Error(`${i}addChildAt: The index ${e} supplied is out of bounds ${this.children.length}`);return i.parent&&i.parent.removeChild(i),i.parent=this,this.sortDirty=!0,i.transform._parentID=-1,this.children.splice(e,0,i),this._boundsID++,this.onChildrenChange(e),i.emit("added",this),this.emit("childAdded",i,this,e),i}swapChildren(i,e){if(i===e)return;const t=this.getChildIndex(i),r=this.getChildIndex(e);this.children[t]=e,this.children[r]=i,this.onChildrenChange(t=this.children.length)throw new Error(`The index ${e} supplied is out of bounds ${this.children.length}`);const t=this.getChildIndex(i);Gs(this.children,t,1),this.children.splice(e,0,i),this.onChildrenChange(e)}getChildAt(i){if(i<0||i>=this.children.length)throw new Error(`getChildAt: Index (${i}) does not exist.`);return this.children[i]}removeChild(...i){if(i.length>1)for(let e=0;e0&&s<=r){n=this.children.splice(t,s);for(let a=0;a1&&this.children.sort(Q0),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 i=0,e=this.children.length;i0&&e.height>0))return;let t,r;this.cullArea?(t=this.cullArea,r=this.worldTransform):this._render!==vh.prototype._render&&(t=this.getBounds(!0));const s=i.projection.transform;if(s&&(r?(r=K0.copyFrom(r),r.prepend(s)):r=s),t&&e.intersects(t,r))this._render(i);else if(this.cullArea)return;for(let n=0,a=this.children.length;n=s&&yn.x=n&&yn.y=t&&(a=i-o-1),l=l.replace("%value%",e[a].toString()),s+=l,s+=` -`}return r=r.replace("%blur%",s),r=r.replace("%size%",i.toString()),r}const ab=` +`;class tb extends kt{constructor(e=1){super(j0,eb,{uAlpha:1}),this.alpha=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}}const ib={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},rb=["varying vec2 vBlurTexCoords[%size%];","uniform sampler2D uSampler;","void main(void)","{"," gl_FragColor = vec4(0.0);"," %blur%","}"].join(` +`);function sb(i){const e=ib[i],t=e.length;let r=rb,s="";const n="gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;";let a;for(let o=0;o=t&&(a=i-o-1),l=l.replace("%value%",e[a].toString()),s+=l,s+=` +`}return r=r.replace("%blur%",s),r=r.replace("%size%",i.toString()),r}const nb=` attribute vec2 aVertexPosition; uniform mat3 projectionMatrix; @@ -564,8 +565,8 @@ void main(void) vec2 textureCoord = filterTextureCoord(); %blur% - }`;function ob(i,e){const t=Math.ceil(i/2);let r=ab,s="",n;e?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(let a=0;a{Object.defineProperty(Ud,i,{get(){return Ue("7.1.0",`filters.${i} has moved to ${i}`),e}})});class yb{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||(Et.system.add(this.tickerUpdate,this,Mr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(Et.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._deltaTimer.priority-s.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 r=0,s=t.length;r=0;s--)if(e.currentTarget=r[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,r=this._allInteractiveElements){if(r.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const s=Array.isArray(t)?t:[t];for(let n=r.length-1;n>=0;n--)s.forEach(a=>{e.currentTarget=r[n],this.notifyTarget(e,a)})}propagationPath(e){const t=[e];for(let r=0;r=0;h--){const d=u[h],f=this.hitTestMoveRecursive(d,this._isInteractive(t)?t:d.eventMode,r,s,n,a||n(e,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=e.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),o=!0}}}const l=this._isInteractive(t),c=e.isInteractive();return c&&c&&this._allInteractiveElements.push(e),a||this._hitElements.length>0?null:o?this._hitElements:l&&!n(e,r)&&s(e,r)?c?[e]:[]:null}hitTestRecursive(e,t,r,s,n){if(this._interactivePrune(e)||n(e,r))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(fr.pauseUpdate=!1),e.interactiveChildren&&e.children){const l=e.children;for(let c=l.length-1;c>=0;c--){const u=l[c],h=this.hitTestRecursive(u,this._isInteractive(t)?t:u.eventMode,r,s,n);if(h){if(h.length>0&&!h[h.length-1].parent)continue;const d=e.isInteractive();return(h.length>0||d)&&h.push(e),h}}}const a=this._isInteractive(t),o=e.isInteractive();return a&&s(e,r)?o?[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){if(e.hitArea&&(e.worldTransform.applyInverse(t,_l),!e.hitArea.contains(_l.x,_l.y)))return!0;if(e._mask){const r=e._mask.isMaskData?e._mask.maskObject:e._mask;if(r&&!r.containsPoint?.(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){t=t??e.type;const r=`on${t}`;e.currentTarget[r]?.(e);const s=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this.notifyListeners(e,s),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof mi)){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 s=t.button===2;this.dispatchEvent(t,s?"rightdown":"mousedown")}const r=this.trackingData(e.pointerId);r.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){if(!(e instanceof mi)){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 r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&n!==t.target){const l=e.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(e,l,n);if(this.dispatchEvent(c,"pointerout"),r&&this.dispatchEvent(c,"mouseout"),!t.composedPath().includes(n)){const u=this.createPointerEvent(e,"pointerleave",n);for(u.eventPhase=u.AT_TARGET;u.target&&!t.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),r&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(c)}if(n!==t.target){const l=e.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(t,l);this.dispatchEvent(c,"pointerover"),r&&this.dispatchEvent(c,"mouseover");let u=n?.parent;for(;u&&u!==this.rootTarget.parent&&u!==t.target;)u=u.parent;if(!u||u===this.rootTarget.parent){const d=this.clonePointerEvent(t,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==n&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}const a=[],o=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(t,"pointermove"),o&&a.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),o&&a.push("globaltouchmove")),r&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),o&&a.push("globalmousemove"),this.cursor=t.target?.cursor),a.length>0&&this.all(t,a),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof mi)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),r=this.createPointerEvent(e),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);const n=this.clonePointerEvent(r,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;t.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(n)}mapPointerOut(e){if(!(e instanceof mi)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.findMountedTarget(t.overTargets),n=this.createPointerEvent(e,"pointerout",s);this.dispatchEvent(n),r&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(e,"pointerleave",s);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),r&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;t.overTargets=null,this.freeEvent(n),this.freeEvent(a)}this.cursor=null}mapPointerUp(e){if(!(e instanceof mi)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),r=this.createPointerEvent(e);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){const o=r.button===2;this.dispatchEvent(r,o?"rightup":"mouseup")}const s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[e.button]);let a=n;if(n&&!r.composedPath().includes(n)){let o=n;for(;o&&!r.composedPath().includes(o);){if(r.currentTarget=o,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){const l=r.button===2;this.notifyTarget(r,l?"rightupoutside":"mouseupoutside")}o=o.parent}delete s.pressTargetsByButton[e.button],a=o}if(a){const o=this.clonePointerEvent(r,"click");o.target=a,o.path=null,s.clicksByButton[e.button]||(s.clicksByButton[e.button]={clickCount:0,target:o.target,timeStamp:t});const l=s.clicksByButton[e.button];if(l.target===o.target&&t-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=o.target,l.timeStamp=t,o.detail=l.clickCount,o.pointerType==="mouse"){const c=o.button===2;this.dispatchEvent(o,c?"rightclick":"click")}else o.pointerType==="touch"&&this.dispatchEvent(o,"tap");this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(r)}mapPointerUpOutside(e){if(!(e instanceof mi)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),r=this.findMountedTarget(t.pressTargetsByButton[e.button]),s=this.createPointerEvent(e);if(r){let n=r;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(s)}mapWheel(e){if(!(e instanceof Xs)){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 r=1;r(t==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[t]=r,!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(i){const{view:e,resolution:t}=this.renderer;this.setTargetElement(e),this.resolution=t,wh._defaultEventMode=i.eventMode??"auto",Object.assign(this.features,i.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(i){this.resolution=i}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(i){i=i||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===i)return;this.currentCursor=i;const t=this.cursorStyles[i];if(t)switch(typeof t){case"string":e&&(this.domElement.style.cursor=t);break;case"function":t(i);break;case"object":e&&Object.assign(this.domElement.style,t);break}else e&&typeof i=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,i)&&(this.domElement.style.cursor=i)}get pointer(){return this.rootPointerEvent}onPointerDown(i){if(!this.features.click||(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&i.pointerType==="touch"))return;const e=this.normalizeToPointerData(i);this.autoPreventDefault&&e[0].isNormalized&&(i.cancelable||!("cancelable"in i))&&i.preventDefault();for(let t=0,r=e.length;t0&&(e=i.composedPath()[0]);const t=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(i);for(let s=0,n=r.length;s"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=i.touches.length===1&&i.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=i.type,e.push(s)}else if(!globalThis.MouseEvent||i instanceof MouseEvent&&(!this.supportsPointerEvents||!(i instanceof globalThis.PointerEvent))){const t=i;typeof t.isPrimary>"u"&&(t.isPrimary=!0),typeof t.width>"u"&&(t.width=1),typeof t.height>"u"&&(t.height=1),typeof t.tiltX>"u"&&(t.tiltX=0),typeof t.tiltY>"u"&&(t.tiltY=0),typeof t.pointerType>"u"&&(t.pointerType="mouse"),typeof t.pointerId>"u"&&(t.pointerId=_b),typeof t.pressure>"u"&&(t.pressure=.5),typeof t.twist>"u"&&(t.twist=0),typeof t.tangentialPressure>"u"&&(t.tangentialPressure=0),t.isNormalized=!0,e.push(t)}else e.push(i);return e}normalizeWheelEvent(i){const e=this.rootWheelEvent;return this.transferMouseData(e,i),e.deltaX=i.deltaX,e.deltaY=i.deltaY,e.deltaZ=i.deltaZ,e.deltaMode=i.deltaMode,this.mapPositionToPoint(e.screen,i.clientX,i.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=i,e.type=i.type,e}bootstrapEvent(i,e){return i.originalEvent=null,i.nativeEvent=e,i.pointerId=e.pointerId,i.width=e.width,i.height=e.height,i.isPrimary=e.isPrimary,i.pointerType=e.pointerType,i.pressure=e.pressure,i.tangentialPressure=e.tangentialPressure,i.tiltX=e.tiltX,i.tiltY=e.tiltY,i.twist=e.twist,this.transferMouseData(i,e),this.mapPositionToPoint(i.screen,e.clientX,e.clientY),i.global.copyFrom(i.screen),i.offset.copyFrom(i.screen),i.isTrusted=e.isTrusted,i.type==="pointerleave"&&(i.type="pointerout"),i.type.startsWith("mouse")&&(i.type=i.type.replace("mouse","pointer")),i.type.startsWith("touch")&&(i.type=xb[i.type]||i.type),i}transferMouseData(i,e){i.isTrusted=e.isTrusted,i.srcElement=e.srcElement,i.timeStamp=performance.now(),i.type=e.type,i.altKey=e.altKey,i.button=e.button,i.buttons=e.buttons,i.client.x=e.clientX,i.client.y=e.clientY,i.ctrlKey=e.ctrlKey,i.metaKey=e.metaKey,i.movement.x=e.movementX,i.movement.y=e.movementY,i.page.x=e.pageX,i.page.y=e.pageY,i.relatedTarget=null,i.shiftKey=e.shiftKey}};let jn=wh;jn.extension={name:"events",type:[pe.RendererSystem,pe.CanvasRendererSystem]};jn.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};_e.add(jn);function Hd(i){return i==="dynamic"||i==="static"}const Ab={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??Hd(jn.defaultEventMode)},set interactive(i){Ue("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??jn.defaultEventMode},set eventMode(i){this._internalInteractive=Hd(i),this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,e,t){const r=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof e=="function"?void 0:e;i=r?`${i}capture`:i,e=typeof e=="function"?e:e.handleEvent,this.on(i,e,s)},removeEventListener(i,e,t){const r=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof e=="function"?void 0:e;i=r?`${i}capture`:i,e=typeof e=="function"?e:e.handleEvent,this.off(i,e,s)},dispatchEvent(i){if(!(i instanceof Zn))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}};dt.mixin(Ab);const Eb={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};dt.mixin(Eb);const Tb=9,xa=100,Sb=0,Cb=0,Gd=2,Wd=1,Mb=-1e3,kb=-1e3,Ib=2;class wp{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,(Qi.tablet||Qi.phone)&&this.createTouchHook();const t=document.createElement("div");t.style.width=`${xa}px`,t.style.height=`${xa}px`,t.style.position="absolute",t.style.top=`${Sb}px`,t.style.left=`${Cb}px`,t.style.zIndex=Gd.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=`${Wd}px`,e.style.height=`${Wd}px`,e.style.position="absolute",e.style.top=`${Mb}px`,e.style.left=`${kb}px`,e.style.zIndex=Ib.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(){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),this.renderer.view.parentNode?.appendChild(this.div))}deactivate(){!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),this.div.parentNode?.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 r=0;r 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:r}=this.renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>r&&(e.height=r-e.y)}addChild(e){let t=this.pool.pop();t||(t=document.createElement("button"),t.style.width=`${xa}px`,t.style.height=`${xa}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=Gd.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:r}=e.target,s=this.renderer.events.rootBoundary,n=Object.assign(new Zn(s),{target:r});s.rootTarget=this.renderer.lastObjectRendered,t.forEach(a=>s.dispatchEvent(n,a))}_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===Tb&&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}}wp.extension={name:"accessibility",type:[pe.RendererPlugin,pe.CanvasRendererPlugin]};_e.add(wp);const _h=class{constructor(i){this.stage=new xe,i=Object.assign({forceCanvas:!1},i),this.renderer=z0(i),_h._plugins.forEach(e=>{e.init.call(this,i)})}render(){this.renderer.render(this.stage)}get view(){return this.renderer.view}get screen(){return this.renderer.screen}destroy(i,e){const t=_h._plugins.slice(0);t.reverse(),t.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(i),this.renderer=null}};let _p=_h;_p._plugins=[];_e.handleByList(pe.Application,_p._plugins);class xp{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,r;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,r=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;t=s,r=n}this.renderer.resize(t,r),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}}xp.extension=pe.Application;_e.add(xp);const zd={loader:pe.LoadParser,resolver:pe.ResolveParser,cache:pe.CacheParser,detection:pe.DetectionParser};_e.handle(pe.Asset,i=>{const e=i.ref;Object.entries(zd).filter(([t])=>!!e[t]).forEach(([t,r])=>_e.add(Object.assign(e[t],{extension:e[t].extension??r})))},i=>{const e=i.ref;Object.keys(zd).filter(t=>!!e[t]).forEach(t=>_e.remove(e[t]))});class Pb{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 r=0;r(Array.isArray(i)||(i=[i]),e?i.map(t=>typeof t=="string"?e(t):t):i),xh=(i,e)=>{const t=e.split("?")[1];return t&&(i+=`?${t}`),i};function Ap(i,e,t,r,s){const n=e[t];for(let a=0;a{const a=n.substring(1,n.length-1).split(",");s.push(a)}),Ap(i,s,0,t,r)}else r.push(i);return r}const oo=i=>!Array.isArray(i);class Rb{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 r=Zi(e);let s;for(let o=0;o{s[o]=t}));const n=Object.keys(s),a={cacheKeys:n,keys:r};if(r.forEach(o=>{this._cacheMap.set(o,a)}),n.forEach(o=>{this._cache.has(o)&&this._cache.get(o)!==t&&console.warn("[Cache] already has key:",o),this._cache.set(o,s[o])}),t instanceof ie){const o=t;r.forEach(l=>{o.baseTexture!==ie.EMPTY.baseTexture&&Me.addToCache(o.baseTexture,l),ie.addToCache(o,l)})}}remove(e){if(this._cacheMap.get(e),!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 yn=new Rb;class Db{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,r)=>(this._parsersValidated=!1,e[t]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){const r={promise:null,parser:null};return r.promise=(async()=>{let s=null,n=null;if(t.loadParser&&(n=this._parserHash[t.loadParser],n||console.warn(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!n){for(let a=0;a({src:c})),o=a.length,l=a.map(async c=>{const u=Rt.toAbsolute(c.src);if(!s[c.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,c)),s[c.src]=await this.promiseCache[u].promise,t&&t(++r/o)}catch(h){throw delete this.promiseCache[u],delete s[c.src],new Error(`[Loader.load] Failed to load ${u}. -${h}`)}});return await Promise.all(l),n?s[a[0].src]:s}async unload(e){const r=Zi(e,s=>({src:s})).map(async s=>{const n=Rt.toAbsolute(s.src),a=this.promiseCache[n];if(a){const o=await a.promise;a.parser?.unload?.(o,s,this),delete this.promiseCache[n]}});await Promise.all(r)}_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 Vi=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Vi||{});const Lb=".json",Ob="application/json",Fb={extension:{type:pe.LoadParser,priority:Vi.Low},name:"loadJson",test(i){return Jn(i,Ob)||ds(i,Lb)},async load(i){return await(await fe.ADAPTER.fetch(i)).json()}};_e.add(Fb);const Nb=".txt",Ub="text/plain",Hb={name:"loadTxt",extension:{type:pe.LoadParser,priority:Vi.Low},test(i){return Jn(i,Ub)||ds(i,Nb)},async load(i){return await(await fe.ADAPTER.fetch(i)).text()}};_e.add(Hb);const Gb=["normal","bold","100","200","300","400","500","600","700","800","900"],Wb=[".ttf",".otf",".woff",".woff2"],zb=["font/ttf","font/otf","font/woff","font/woff2"],Vb=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function jb(i){const e=Rt.extname(i),s=Rt.basename(i,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1));let n=s.length>0;for(const o of s)if(!o.match(Vb)){n=!1;break}let a=s.join(" ");return n||(a=`"${a.replace(/[\\"]/g,"\\$&")}"`),a}const Xb={extension:{type:pe.LoadParser,priority:Vi.Low},name:"loadWebFont",test(i){return Jn(i,zb)||ds(i,Wb)},async load(i,e){const t=fe.ADAPTER.getFontFaceSet();if(t){const r=[],s=e.data?.family??jb(i),n=e.data?.weights?.filter(o=>Gb.includes(o))??["normal"],a=e.data??{};for(let o=0;ofe.ADAPTER.getFontFaceSet().delete(e))}};_e.add(Xb);let Vd=0,xl;const Yb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",Kb={id:"checkImageBitmap",code:` +`;class mb extends kt{constructor(e=.5,t=Math.random()){super(up,pb,{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 Ud={AlphaFilter:tb,BlurFilter:ob,BlurFilterPass:bh,ColorMatrixFilter:wh,DisplacementFilter:db,FXAAFilter:_h,NoiseFilter:mb};Object.entries(Ud).forEach(([i,e])=>{Object.defineProperty(Ud,i,{get(){return Ue("7.1.0",`filters.${i} has moved to ${i}`),e}})});class gb{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||(At.system.add(this.tickerUpdate,this,Mr.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&(At.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._deltaTimer.priority-s.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 r=0,s=t.length;r=0;s--)if(e.currentTarget=r[s],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,r=this._allInteractiveElements){if(r.length===0)return;e.eventPhase=e.BUBBLING_PHASE;const s=Array.isArray(t)?t:[t];for(let n=r.length-1;n>=0;n--)s.forEach(a=>{e.currentTarget=r[n],this.notifyTarget(e,a)})}propagationPath(e){const t=[e];for(let r=0;r=0;h--){const d=u[h],f=this.hitTestMoveRecursive(d,this._isInteractive(t)?t:d.eventMode,r,s,n,a||n(e,r));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const p=e.isInteractive();(f.length>0||p)&&(p&&this._allInteractiveElements.push(e),f.push(e)),this._hitElements.length===0&&(this._hitElements=f),o=!0}}}const l=this._isInteractive(t),c=e.isInteractive();return c&&c&&this._allInteractiveElements.push(e),a||this._hitElements.length>0?null:o?this._hitElements:l&&!n(e,r)&&s(e,r)?c?[e]:[]:null}hitTestRecursive(e,t,r,s,n){if(this._interactivePrune(e)||n(e,r))return null;if((e.eventMode==="dynamic"||t==="dynamic")&&(fr.pauseUpdate=!1),e.interactiveChildren&&e.children){const l=e.children;for(let c=l.length-1;c>=0;c--){const u=l[c],h=this.hitTestRecursive(u,this._isInteractive(t)?t:u.eventMode,r,s,n);if(h){if(h.length>0&&!h[h.length-1].parent)continue;const d=e.isInteractive();return(h.length>0||d)&&h.push(e),h}}}const a=this._isInteractive(t),o=e.isInteractive();return a&&s(e,r)?o?[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){if(e.hitArea&&(e.worldTransform.applyInverse(t,Al),!e.hitArea.contains(Al.x,Al.y)))return!0;if(e._mask){const r=e._mask.isMaskData?e._mask.maskObject:e._mask;if(r&&!r.containsPoint?.(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){t=t??e.type;const r=`on${t}`;e.currentTarget[r]?.(e);const s=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this.notifyListeners(e,s),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof mi)){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 s=t.button===2;this.dispatchEvent(t,s?"rightdown":"mousedown")}const r=this.trackingData(e.pointerId);r.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){if(!(e instanceof mi)){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 r=t.pointerType==="mouse"||t.pointerType==="pen",s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.overTargets);if(s.overTargets?.length>0&&n!==t.target){const l=e.type==="mousemove"?"mouseout":"pointerout",c=this.createPointerEvent(e,l,n);if(this.dispatchEvent(c,"pointerout"),r&&this.dispatchEvent(c,"mouseout"),!t.composedPath().includes(n)){const u=this.createPointerEvent(e,"pointerleave",n);for(u.eventPhase=u.AT_TARGET;u.target&&!t.composedPath().includes(u.target);)u.currentTarget=u.target,this.notifyTarget(u),r&&this.notifyTarget(u,"mouseleave"),u.target=u.target.parent;this.freeEvent(u)}this.freeEvent(c)}if(n!==t.target){const l=e.type==="mousemove"?"mouseover":"pointerover",c=this.clonePointerEvent(t,l);this.dispatchEvent(c,"pointerover"),r&&this.dispatchEvent(c,"mouseover");let u=n?.parent;for(;u&&u!==this.rootTarget.parent&&u!==t.target;)u=u.parent;if(!u||u===this.rootTarget.parent){const d=this.clonePointerEvent(t,"pointerenter");for(d.eventPhase=d.AT_TARGET;d.target&&d.target!==n&&d.target!==this.rootTarget.parent;)d.currentTarget=d.target,this.notifyTarget(d),r&&this.notifyTarget(d,"mouseenter"),d.target=d.target.parent;this.freeEvent(d)}this.freeEvent(c)}const a=[],o=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push("pointermove"):this.dispatchEvent(t,"pointermove"),o&&a.push("globalpointermove"),t.pointerType==="touch"&&(this.moveOnAll?a.splice(1,0,"touchmove"):this.dispatchEvent(t,"touchmove"),o&&a.push("globaltouchmove")),r&&(this.moveOnAll?a.splice(1,0,"mousemove"):this.dispatchEvent(t,"mousemove"),o&&a.push("globalmousemove"),this.cursor=t.target?.cursor),a.length>0&&this.all(t,a),this._allInteractiveElements.length=0,this._hitElements.length=0,s.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof mi)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),r=this.createPointerEvent(e),s=r.pointerType==="mouse"||r.pointerType==="pen";this.dispatchEvent(r,"pointerover"),s&&this.dispatchEvent(r,"mouseover"),r.pointerType==="mouse"&&(this.cursor=r.target?.cursor);const n=this.clonePointerEvent(r,"pointerenter");for(n.eventPhase=n.AT_TARGET;n.target&&n.target!==this.rootTarget.parent;)n.currentTarget=n.target,this.notifyTarget(n),s&&this.notifyTarget(n,"mouseenter"),n.target=n.target.parent;t.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(n)}mapPointerOut(e){if(!(e instanceof mi)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId);if(t.overTargets){const r=e.pointerType==="mouse"||e.pointerType==="pen",s=this.findMountedTarget(t.overTargets),n=this.createPointerEvent(e,"pointerout",s);this.dispatchEvent(n),r&&this.dispatchEvent(n,"mouseout");const a=this.createPointerEvent(e,"pointerleave",s);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),r&&this.notifyTarget(a,"mouseleave"),a.target=a.target.parent;t.overTargets=null,this.freeEvent(n),this.freeEvent(a)}this.cursor=null}mapPointerUp(e){if(!(e instanceof mi)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=performance.now(),r=this.createPointerEvent(e);if(this.dispatchEvent(r,"pointerup"),r.pointerType==="touch")this.dispatchEvent(r,"touchend");else if(r.pointerType==="mouse"||r.pointerType==="pen"){const o=r.button===2;this.dispatchEvent(r,o?"rightup":"mouseup")}const s=this.trackingData(e.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[e.button]);let a=n;if(n&&!r.composedPath().includes(n)){let o=n;for(;o&&!r.composedPath().includes(o);){if(r.currentTarget=o,this.notifyTarget(r,"pointerupoutside"),r.pointerType==="touch")this.notifyTarget(r,"touchendoutside");else if(r.pointerType==="mouse"||r.pointerType==="pen"){const l=r.button===2;this.notifyTarget(r,l?"rightupoutside":"mouseupoutside")}o=o.parent}delete s.pressTargetsByButton[e.button],a=o}if(a){const o=this.clonePointerEvent(r,"click");o.target=a,o.path=null,s.clicksByButton[e.button]||(s.clicksByButton[e.button]={clickCount:0,target:o.target,timeStamp:t});const l=s.clicksByButton[e.button];if(l.target===o.target&&t-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=o.target,l.timeStamp=t,o.detail=l.clickCount,o.pointerType==="mouse"){const c=o.button===2;this.dispatchEvent(o,c?"rightclick":"click")}else o.pointerType==="touch"&&this.dispatchEvent(o,"tap");this.dispatchEvent(o,"pointertap"),this.freeEvent(o)}this.freeEvent(r)}mapPointerUpOutside(e){if(!(e instanceof mi)){console.warn("EventBoundary cannot map a non-pointer event as a pointer event");return}const t=this.trackingData(e.pointerId),r=this.findMountedTarget(t.pressTargetsByButton[e.button]),s=this.createPointerEvent(e);if(r){let n=r;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(s)}mapWheel(e){if(!(e instanceof Ys)){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 r=1;r(t==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=r),e[t]=r,!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(i){const{view:e,resolution:t}=this.renderer;this.setTargetElement(e),this.resolution=t,xh._defaultEventMode=i.eventMode??"auto",Object.assign(this.features,i.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(i){this.resolution=i}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(i){i=i||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this.currentCursor===i)return;this.currentCursor=i;const t=this.cursorStyles[i];if(t)switch(typeof t){case"string":e&&(this.domElement.style.cursor=t);break;case"function":t(i);break;case"object":e&&Object.assign(this.domElement.style,t);break}else e&&typeof i=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,i)&&(this.domElement.style.cursor=i)}get pointer(){return this.rootPointerEvent}onPointerDown(i){if(!this.features.click||(this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.supportsTouchEvents&&i.pointerType==="touch"))return;const e=this.normalizeToPointerData(i);this.autoPreventDefault&&e[0].isNormalized&&(i.cancelable||!("cancelable"in i))&&i.preventDefault();for(let t=0,r=e.length;t0&&(e=i.composedPath()[0]);const t=e!==this.domElement?"outside":"",r=this.normalizeToPointerData(i);for(let s=0,n=r.length;s"u"&&(s.button=0),typeof s.buttons>"u"&&(s.buttons=1),typeof s.isPrimary>"u"&&(s.isPrimary=i.touches.length===1&&i.type==="touchstart"),typeof s.width>"u"&&(s.width=s.radiusX||1),typeof s.height>"u"&&(s.height=s.radiusY||1),typeof s.tiltX>"u"&&(s.tiltX=0),typeof s.tiltY>"u"&&(s.tiltY=0),typeof s.pointerType>"u"&&(s.pointerType="touch"),typeof s.pointerId>"u"&&(s.pointerId=s.identifier||0),typeof s.pressure>"u"&&(s.pressure=s.force||.5),typeof s.twist>"u"&&(s.twist=0),typeof s.tangentialPressure>"u"&&(s.tangentialPressure=0),typeof s.layerX>"u"&&(s.layerX=s.offsetX=s.clientX),typeof s.layerY>"u"&&(s.layerY=s.offsetY=s.clientY),s.isNormalized=!0,s.type=i.type,e.push(s)}else if(!globalThis.MouseEvent||i instanceof MouseEvent&&(!this.supportsPointerEvents||!(i instanceof globalThis.PointerEvent))){const t=i;typeof t.isPrimary>"u"&&(t.isPrimary=!0),typeof t.width>"u"&&(t.width=1),typeof t.height>"u"&&(t.height=1),typeof t.tiltX>"u"&&(t.tiltX=0),typeof t.tiltY>"u"&&(t.tiltY=0),typeof t.pointerType>"u"&&(t.pointerType="mouse"),typeof t.pointerId>"u"&&(t.pointerId=wb),typeof t.pressure>"u"&&(t.pressure=.5),typeof t.twist>"u"&&(t.twist=0),typeof t.tangentialPressure>"u"&&(t.tangentialPressure=0),t.isNormalized=!0,e.push(t)}else e.push(i);return e}normalizeWheelEvent(i){const e=this.rootWheelEvent;return this.transferMouseData(e,i),e.deltaX=i.deltaX,e.deltaY=i.deltaY,e.deltaZ=i.deltaZ,e.deltaMode=i.deltaMode,this.mapPositionToPoint(e.screen,i.clientX,i.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.nativeEvent=i,e.type=i.type,e}bootstrapEvent(i,e){return i.originalEvent=null,i.nativeEvent=e,i.pointerId=e.pointerId,i.width=e.width,i.height=e.height,i.isPrimary=e.isPrimary,i.pointerType=e.pointerType,i.pressure=e.pressure,i.tangentialPressure=e.tangentialPressure,i.tiltX=e.tiltX,i.tiltY=e.tiltY,i.twist=e.twist,this.transferMouseData(i,e),this.mapPositionToPoint(i.screen,e.clientX,e.clientY),i.global.copyFrom(i.screen),i.offset.copyFrom(i.screen),i.isTrusted=e.isTrusted,i.type==="pointerleave"&&(i.type="pointerout"),i.type.startsWith("mouse")&&(i.type=i.type.replace("mouse","pointer")),i.type.startsWith("touch")&&(i.type=_b[i.type]||i.type),i}transferMouseData(i,e){i.isTrusted=e.isTrusted,i.srcElement=e.srcElement,i.timeStamp=performance.now(),i.type=e.type,i.altKey=e.altKey,i.button=e.button,i.buttons=e.buttons,i.client.x=e.clientX,i.client.y=e.clientY,i.ctrlKey=e.ctrlKey,i.metaKey=e.metaKey,i.movement.x=e.movementX,i.movement.y=e.movementY,i.page.x=e.pageX,i.page.y=e.pageY,i.relatedTarget=null,i.shiftKey=e.shiftKey}};let jn=xh;jn.extension={name:"events",type:[pe.RendererSystem,pe.CanvasRendererSystem]};jn.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};_e.add(jn);function Hd(i){return i==="dynamic"||i==="static"}const xb={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??Hd(jn.defaultEventMode)},set interactive(i){Ue("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??jn.defaultEventMode},set eventMode(i){this._internalInteractive=Hd(i),this._internalEventMode=i},isInteractive(){return this.eventMode==="static"||this.eventMode==="dynamic"},interactiveChildren:!0,hitArea:null,addEventListener(i,e,t){const r=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof e=="function"?void 0:e;i=r?`${i}capture`:i,e=typeof e=="function"?e:e.handleEvent,this.on(i,e,s)},removeEventListener(i,e,t){const r=typeof t=="boolean"&&t||typeof t=="object"&&t.capture,s=typeof e=="function"?void 0:e;i=r?`${i}capture`:i,e=typeof e=="function"?e:e.handleEvent,this.off(i,e,s)},dispatchEvent(i){if(!(i instanceof Jn))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}};dt.mixin(xb);const Ab={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,renderId:-1};dt.mixin(Ab);const Eb=9,Aa=100,Tb=0,Sb=0,Gd=2,Wd=1,Cb=-1e3,Mb=-1e3,kb=2;class bp{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,(Qi.tablet||Qi.phone)&&this.createTouchHook();const t=document.createElement("div");t.style.width=`${Aa}px`,t.style.height=`${Aa}px`,t.style.position="absolute",t.style.top=`${Tb}px`,t.style.left=`${Sb}px`,t.style.zIndex=Gd.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=`${Wd}px`,e.style.height=`${Wd}px`,e.style.position="absolute",e.style.top=`${Cb}px`,e.style.left=`${Mb}px`,e.style.zIndex=kb.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(){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),this.renderer.view.parentNode?.appendChild(this.div))}deactivate(){!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),this.div.parentNode?.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 r=0;r 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:r}=this.renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>r&&(e.height=r-e.y)}addChild(e){let t=this.pool.pop();t||(t=document.createElement("button"),t.style.width=`${Aa}px`,t.style.height=`${Aa}px`,t.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",t.style.position="absolute",t.style.zIndex=Gd.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:r}=e.target,s=this.renderer.events.rootBoundary,n=Object.assign(new Jn(s),{target:r});s.rootTarget=this.renderer.lastObjectRendered,t.forEach(a=>s.dispatchEvent(n,a))}_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===Eb&&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}}bp.extension={name:"accessibility",type:[pe.RendererPlugin,pe.CanvasRendererPlugin]};_e.add(bp);const Ah=class{constructor(i){this.stage=new xe,i=Object.assign({forceCanvas:!1},i),this.renderer=W0(i),Ah._plugins.forEach(e=>{e.init.call(this,i)})}render(){this.renderer.render(this.stage)}get view(){return this.renderer.view}get screen(){return this.renderer.screen}destroy(i,e){const t=Ah._plugins.slice(0);t.reverse(),t.forEach(r=>{r.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(i),this.renderer=null}};let wp=Ah;wp._plugins=[];_e.handleByList(pe.Application,wp._plugins);class _p{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,r;if(this._resizeTo===globalThis.window)t=globalThis.innerWidth,r=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;t=s,r=n}this.renderer.resize(t,r),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}}_p.extension=pe.Application;_e.add(_p);const zd={loader:pe.LoadParser,resolver:pe.ResolveParser,cache:pe.CacheParser,detection:pe.DetectionParser};_e.handle(pe.Asset,i=>{const e=i.ref;Object.entries(zd).filter(([t])=>!!e[t]).forEach(([t,r])=>_e.add(Object.assign(e[t],{extension:e[t].extension??r})))},i=>{const e=i.ref;Object.keys(zd).filter(t=>!!e[t]).forEach(t=>_e.remove(e[t]))});class Ib{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 r=0;r(Array.isArray(i)||(i=[i]),e?i.map(t=>typeof t=="string"?e(t):t):i),Eh=(i,e)=>{const t=e.split("?")[1];return t&&(i+=`?${t}`),i};function xp(i,e,t,r,s){const n=e[t];for(let a=0;a{const a=n.substring(1,n.length-1).split(",");s.push(a)}),xp(i,s,0,t,r)}else r.push(i);return r}const lo=i=>!Array.isArray(i);class Bb{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 r=Zi(e);let s;for(let o=0;o{s[o]=t}));const n=Object.keys(s),a={cacheKeys:n,keys:r};if(r.forEach(o=>{this._cacheMap.set(o,a)}),n.forEach(o=>{this._cache.has(o)&&this._cache.get(o)!==t&&console.warn("[Cache] already has key:",o),this._cache.set(o,s[o])}),t instanceof ie){const o=t;r.forEach(l=>{o.baseTexture!==ie.EMPTY.baseTexture&&Me.addToCache(o.baseTexture,l),ie.addToCache(o,l)})}}remove(e){if(this._cacheMap.get(e),!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 vn=new Bb;class Rb{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,r)=>(this._parsersValidated=!1,e[t]=r,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){const r={promise:null,parser:null};return r.promise=(async()=>{let s=null,n=null;if(t.loadParser&&(n=this._parserHash[t.loadParser],n||console.warn(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!n){for(let a=0;a({src:c})),o=a.length,l=a.map(async c=>{const u=Rt.toAbsolute(c.src);if(!s[c.src])try{this.promiseCache[u]||(this.promiseCache[u]=this._getLoadPromiseAndParser(u,c)),s[c.src]=await this.promiseCache[u].promise,t&&t(++r/o)}catch(h){throw delete this.promiseCache[u],delete s[c.src],new Error(`[Loader.load] Failed to load ${u}. +${h}`)}});return await Promise.all(l),n?s[a[0].src]:s}async unload(e){const r=Zi(e,s=>({src:s})).map(async s=>{const n=Rt.toAbsolute(s.src),a=this.promiseCache[n];if(a){const o=await a.promise;a.parser?.unload?.(o,s,this),delete this.promiseCache[n]}});await Promise.all(r)}_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 Vi=(i=>(i[i.Low=0]="Low",i[i.Normal=1]="Normal",i[i.High=2]="High",i))(Vi||{});const Db=".json",Lb="application/json",Ob={extension:{type:pe.LoadParser,priority:Vi.Low},name:"loadJson",test(i){return ea(i,Lb)||fs(i,Db)},async load(i){return await(await fe.ADAPTER.fetch(i)).json()}};_e.add(Ob);const Fb=".txt",Nb="text/plain",Ub={name:"loadTxt",extension:{type:pe.LoadParser,priority:Vi.Low},test(i){return ea(i,Nb)||fs(i,Fb)},async load(i){return await(await fe.ADAPTER.fetch(i)).text()}};_e.add(Ub);const Hb=["normal","bold","100","200","300","400","500","600","700","800","900"],Gb=[".ttf",".otf",".woff",".woff2"],Wb=["font/ttf","font/otf","font/woff","font/woff2"],zb=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Vb(i){const e=Rt.extname(i),s=Rt.basename(i,e).replace(/(-|_)/g," ").toLowerCase().split(" ").map(o=>o.charAt(0).toUpperCase()+o.slice(1));let n=s.length>0;for(const o of s)if(!o.match(zb)){n=!1;break}let a=s.join(" ");return n||(a=`"${a.replace(/[\\"]/g,"\\$&")}"`),a}const jb={extension:{type:pe.LoadParser,priority:Vi.Low},name:"loadWebFont",test(i){return ea(i,Wb)||fs(i,Gb)},async load(i,e){const t=fe.ADAPTER.getFontFaceSet();if(t){const r=[],s=e.data?.family??Vb(i),n=e.data?.weights?.filter(o=>Hb.includes(o))??["normal"],a=e.data??{};for(let o=0;ofe.ADAPTER.getFontFaceSet().delete(e))}};_e.add(jb);let Vd=0,El;const Xb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=",Yb={id:"checkImageBitmap",code:` async function checkImageBitmap() { try { if (typeof createImageBitmap !== 'function') return false; - const response = await fetch('${Yb}'); + const response = await fetch('${Xb}'); const imageBlob = await response.blob(); const imageBitmap = await createImageBitmap(imageBlob); @@ -919,7 +920,7 @@ ${h}`)}});return await Promise.all(l),n?s[a[0].src]:s}async unload(e){const r=Zi id: event.data.id, }); } - };`};let Al;class qb{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 t=URL.createObjectURL(new Blob([Kb.code],{type:"application/javascript"})),r=new Worker(t);r.addEventListener("message",s=>{r.terminate(),URL.revokeObjectURL(t),e(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e){return this._run("loadImageBitmap",[e])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){xl===void 0&&(xl=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 r=new Promise((s,n)=>{this.queue.push({id:e,arguments:t,resolve:s,reject:n})});return this.next(),r}next(){if(!this.queue.length)return;const e=this.getWorker();if(!e)return;const t=this.queue.pop(),r=t.id;this.resolveHash[Vd]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:Vd++,id:r})}}const jd=new qb;function Io(i,e,t){const r=new ie(i);return r.baseTexture.on("dispose",()=>{delete e.promiseCache[t]}),r}const Qb=[".jpeg",".jpg",".png",".webp",".avif"],Zb=["image/jpeg","image/png","image/webp","image/avif"];async function Jb(i){const e=await fe.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 Po={name:"loadTextures",extension:{type:pe.LoadParser,priority:Vi.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return Jn(i,Zb)||ds(i,Qb)},async load(i,e,t){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await jd.isImageBitmapSupported()?r=await jd.loadImageBitmap(i):r=await Jb(i):r=await new Promise(n=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?n(r):r.onload=()=>{n(r)}});const s=new Me(r,{resolution:Sr(i),...e.data});return s.resource.src=i,Io(s,t,i)},unload(i){i.destroy(!0)}};_e.add(Po);const ew=".svg",tw="image/svg+xml",iw={extension:{type:pe.LoadParser,priority:Vi.High},name:"loadSVG",test(i){return Jn(i,tw)||ds(i,ew)},async testParse(i){return Vn.test(i)},async parse(i,e,t){const r=new Vn(i,e?.data?.resourceOptions);await r.load();const s=new Me(r,{resolution:Sr(i),...e?.data});return s.resource.src=i,Io(s,t,i)},async load(i,e){return(await fe.ADAPTER.fetch(i)).text()},unload:Po.unload};_e.add(iw);class rw{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(r=>`${encodeURIComponent(r)}=${encodeURIComponent(t[r])}`).join("&")}}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 r=[];Array.isArray(t)?t.forEach(s=>{if(typeof s.name=="string"){const n=this._createBundleAssetId(e,s.name);r.push(n),this.add([s.name,n],s.srcs,s.data)}else{const n=s.name.map(a=>this._createBundleAssetId(e,a));n.forEach(a=>{r.push(a)}),this.add([...s.name,...n],s.srcs)}}):Object.keys(t).forEach(s=>{r.push(this._createBundleAssetId(e,s)),this.add([s,this._createBundleAssetId(e,s)],t[s])}),this._bundles[e]=r}add(e,t,r){const s=Zi(e);s.forEach(a=>{this.hasKey(a)&&console.warn(`[Resolver] already has key: ${a} overwriting`)}),Array.isArray(t)||(typeof t=="string"?t=Bb(t):t=[t]);const n=t.map(a=>{let o=a;if(typeof a=="string"){let l=!1;for(let c=0;c{this._assetMap[a]=n})}resolveBundle(e){const t=oo(e);e=Zi(e);const r={};return e.forEach(s=>{const n=this._bundles[s];if(n){const a=this.resolve(n),o={};for(const l in a){const c=a[l];o[this._extractAssetIdFromBundle(s,l)]=c}r[s]=o}}),t?r[e[0]]:r}resolveUrl(e){const t=this.resolve(e);if(typeof e!="string"){const r={};for(const s in t)r[s]=t[s].src;return r}return t.src}resolve(e){const t=oo(e);e=Zi(e);const r={};return e.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const a=this._getPreferredOrder(n),o=n[0];a?.priority.forEach(l=>{a.params[l].forEach(c=>{const u=n.filter(h=>h[l]?h[l]===c:!1);u.length&&(n=u)})}),this._resolverHash[s]=n[0]??o}else{let n=s;(this._basePath||this._rootPath)&&(n=Rt.toAbsolute(n,this._basePath,this._rootPath)),n=this._appendDefaultSearchParams(n),this._resolverHash[s]={src:n}}r[s]=this._resolverHash[s]}),t?r[e[0]]:r}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;tn.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}}class sw{constructor(){this._detections=[],this._initialized=!1,this.resolver=new rw,this.loader=new Db,this.cache=yn,this._backgroundLoader=new Pb(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.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 n=e.manifest;typeof n=="string"&&(n=await this.load(n)),this.resolver.addManifest(n)}const t=e.texturePreference?.resolution??1,r=typeof t=="number"?[t]:t;let s=[];if(e.texturePreference?.format){const n=e.texturePreference?.format;s=typeof n=="string"?[n]:n;for(const a of this._detections)await a.test()||(s=await a.remove(s))}else for(const n of this._detections)await n.test()&&(s=await n.add(s));this.resolver.prefer({params:{format:s,resolution:r}}),e.preferences&&this.setPreferences(e.preferences)}add(e,t,r){this.resolver.add(e,t,r)}async load(e,t){this._initialized||await this.init();const r=oo(e),s=Zi(e).map(o=>typeof o!="string"?(this.resolver.add(o.src,o),o.src):(this.resolver.hasKey(o)||this.resolver.add(o,o),o)),n=this.resolver.resolve(s),a=await this._mapLoadToResolve(n,t);return r?a[s[0]]:a}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let r=!1;typeof e=="string"&&(r=!0,e=[e]);const s=this.resolver.resolveBundle(e),n={},a=Object.keys(s);let o=0,l=0;const c=()=>{t?.(++o/l)},u=a.map(h=>{const d=s[h];return l+=Object.keys(d).length,this._mapLoadToResolve(d,c).then(f=>{n[h]=f})});return await Promise.all(u),r?n[e[0]]:n}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(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return yn.get(e);const t={};for(let r=0;r{const c=n[o.src],u=[o.src];o.alias&&u.push(...o.alias),a[s[l]]=c,yn.set(u,c)}),a}async unload(e){this._initialized||await this.init();const t=Zi(e).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(t);await this._unloadFromResolved(r)}async unloadBundle(e){this._initialized||await this.init(),e=Zi(e);const t=this.resolver.resolveBundle(e),r=Object.keys(t).map(s=>this._unloadFromResolved(t[s]));await Promise.all(r)}async _unloadFromResolved(e){const t=Object.values(e);t.forEach(r=>{yn.remove(r.src)}),await this.loader.unload(t)}get detections(){return this._detections}get preferWorkers(){return Po.config.preferWorkers}set preferWorkers(e){Ue("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(r=>r in e).forEach(r=>{t.config[r]=e[r]})})}}const Ps=new sw;_e.handleByList(pe.LoadParser,Ps.loader.parsers).handleByList(pe.ResolveParser,Ps.resolver.parsers).handleByList(pe.CacheParser,Ps.cache.parsers).handleByList(pe.DetectionParser,Ps.detections);const aw={extension:pe.CacheParser,test:i=>Array.isArray(i)&&i.every(e=>e instanceof ie),getCacheableAssets:(i,e)=>{const t={};return i.forEach(r=>{e.forEach((s,n)=>{t[r+(n===0?"":n+1)]=s})}),t}};_e.add(aw);const ow={extension:{type:pe.DetectionParser,priority:1},test:async()=>{if(!globalThis.createImageBitmap)return!1;const i="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=",e=await fe.ADAPTER.fetch(i).then(t=>t.blob());return createImageBitmap(e).then(()=>!0,()=>!1)},add:async i=>[...i,"avif"],remove:async i=>i.filter(e=>e!=="avif")};_e.add(ow);const lw={extension:{type:pe.DetectionParser,priority:0},test:async()=>{if(!globalThis.createImageBitmap)return!1;const i="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=",e=await fe.ADAPTER.fetch(i).then(t=>t.blob());return createImageBitmap(e).then(()=>!0,()=>!1)},add:async i=>[...i,"webp"],remove:async i=>i.filter(e=>e!=="webp")};_e.add(lw);const Xd=["png","jpg","jpeg"],hw={extension:{type:pe.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...Xd],remove:async i=>i.filter(e=>!Xd.includes(e))};_e.add(hw);const cw={extension:pe.ResolveParser,test:Po.test,parse:i=>({resolution:parseFloat(fe.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};_e.add(cw);var Xt=(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=35986]="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))(Xt||{});const lo={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,35986:1,34798:1,37808:1};let Ki,As;function Yd(){As={s3tc:Ki.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:Ki.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:Ki.getExtension("WEBGL_compressed_texture_etc"),etc1:Ki.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:Ki.getExtension("WEBGL_compressed_texture_pvrtc")||Ki.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:Ki.getExtension("WEBGL_compressed_texture_atc"),astc:Ki.getExtension("WEBGL_compressed_texture_astc")}}const dw={extension:{type:pe.DetectionParser,priority:2},test:async()=>{const e=fe.ADAPTER.createCanvas().getContext("webgl");return e?(Ki=e,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async i=>{As||Yd();const e=[];for(const t in As)As[t]&&e.push(t);return[...e,...i]},remove:async i=>(As||Yd(),i.filter(e=>!(e in As)))};_e.add(dw);class uw extends Qn{constructor(e,t={width:1,height:1,autoLoad:!0}){let r,s;typeof e=="string"?(r=e,s=new Uint8Array):(r=null,s=e),super(s,t),this.origin=r,this.buffer=s?new oh(s):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 oh(e),this.loaded=!0,this.onBlobLoaded(e),this.update(),this)),this._load)}}class qr extends uw{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=qr._formatToExtension(this.format),(t.levelBuffers||this.buffer)&&(this._levelBuffers=t.levelBuffers||qr._createLevelBuffers(e instanceof Uint8Array?e:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(e,t,r){const s=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;for(let a=0,o=this.levels;a=33776&&e<=33779)return"s3tc";if(e>=37488&&e<=37497)return"etc";if(e>=35840&&e<=35843)return"pvrtc";if(e>=36196)return"etc1";if(e>=35986&&e<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(e,t,r,s,n,a,o){const l=new Array(r);let c=e.byteOffset,u=a,h=o,d=u+s-1&~(s-1),f=h+n-1&~(n-1),p=d*f*lo[t];for(let m=0;m1?u:d,levelHeight:r>1?h:f,levelBuffer:new Uint8Array(e.buffer,c,p)},c+=p,u=u>>1||1,h=h>>1||1,d=u+s-1&~(s-1),f=h+n-1&~(n-1),p=d*f*lo[t];return l}}const El=4,Aa=124,fw=32,Kd=20,pw=542327876,Ea={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},mw={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Ta={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},gw=1,yw=2,vw=4,bw=64,ww=512,_w=131072,xw=827611204,Aw=861165636,Ew=894720068,Tw=808540228,Sw=4,Cw={[xw]:Xt.COMPRESSED_RGBA_S3TC_DXT1_EXT,[Aw]:Xt.COMPRESSED_RGBA_S3TC_DXT3_EXT,[Ew]:Xt.COMPRESSED_RGBA_S3TC_DXT5_EXT},Mw={70:Xt.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Xt.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Xt.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Xt.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Xt.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Xt.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Xt.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Xt.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Xt.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function kw(i){const e=new Uint32Array(i);if(e[0]!==pw)throw new Error("Invalid DDS file magic word");const r=new Uint32Array(i,0,Aa/Uint32Array.BYTES_PER_ELEMENT),s=r[Ea.HEIGHT],n=r[Ea.WIDTH],a=r[Ea.MIPMAP_COUNT],o=new Uint32Array(i,Ea.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,fw/Uint32Array.BYTES_PER_ELEMENT),l=o[gw];if(l&vw){const c=o[mw.FOURCC];if(c!==Tw){const _=Cw[c],v=El+Aa,E=new Uint8Array(i,v);return[new qr(E,{format:_,width:n,height:s,levels:a})]}const u=El+Aa,h=new Uint32Array(e.buffer,u,Kd/Uint32Array.BYTES_PER_ELEMENT),d=h[Ta.DXGI_FORMAT],f=h[Ta.RESOURCE_DIMENSION],p=h[Ta.MISC_FLAG],m=h[Ta.ARRAY_SIZE],g=Mw[d];if(g===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${d}`);if(p===Sw)throw new Error("DDSParser does not support cubemap textures");if(f===6)throw new Error("DDSParser does not supported 3D texture data");const y=new Array,b=El+Aa+Kd;if(m===1)y.push(new Uint8Array(i,b));else{const _=lo[g];let v=0,E=n,I=s;for(let R=0;R>>1,I=I>>>1}let S=b;for(let R=0;Rnew qr(_,{format:g,width:n,height:s,levels:a}))}throw l&bw?new Error("DDSParser does not support uncompressed texture data."):l&ww?new Error("DDSParser does not supported YUV uncompressed texture data."):l&_w?new Error("DDSParser does not support single-channel (lumninance) texture data!"):l&yw?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 $d=[171,75,84,88,32,49,49,187,13,10,26,10],Iw=67305985,ui={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,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},Ah=64,qd={[Ee.UNSIGNED_BYTE]:1,[Ee.UNSIGNED_SHORT]:2,[Ee.INT]:4,[Ee.UNSIGNED_INT]:4,[Ee.FLOAT]:4,[Ee.HALF_FLOAT]:8},Pw={[ce.RGBA]:4,[ce.RGB]:3,[ce.RG]:2,[ce.RED]:1,[ce.LUMINANCE]:1,[ce.LUMINANCE_ALPHA]:2,[ce.ALPHA]:1},Bw={[Ee.UNSIGNED_SHORT_4_4_4_4]:2,[Ee.UNSIGNED_SHORT_5_5_5_1]:2,[Ee.UNSIGNED_SHORT_5_6_5]:2};function Rw(i,e,t=!1){const r=new DataView(e);if(!Dw(i,r))return null;const s=r.getUint32(ui.ENDIANNESS,!0)===Iw,n=r.getUint32(ui.GL_TYPE,s),a=r.getUint32(ui.GL_FORMAT,s),o=r.getUint32(ui.GL_INTERNAL_FORMAT,s),l=r.getUint32(ui.PIXEL_WIDTH,s),c=r.getUint32(ui.PIXEL_HEIGHT,s)||1,u=r.getUint32(ui.PIXEL_DEPTH,s)||1,h=r.getUint32(ui.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=r.getUint32(ui.NUMBER_OF_FACES,s),f=r.getUint32(ui.NUMBER_OF_MIPMAP_LEVELS,s),p=r.getUint32(ui.BYTES_OF_KEY_VALUE_DATA,s);if(c===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(h!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,y=l+3&-4,b=c+3&-4,_=new Array(h);let v=l*c;n===0&&(v=y*b);let E;if(n!==0?qd[n]?E=qd[n]*Pw[a]:E=Bw[n]:E=lo[o],E===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const I=t?Ow(r,p,s):null;let R=v*E,P=l,L=c,W=y,T=b,C=Ah+p;for(let w=0;w1||n!==0?P:W,levelHeight:f>1||n!==0?L:T,levelBuffer:new Uint8Array(e,$,R)},$+=R}C+=G+4,C=C%4!==0?C+4-C%4:C,P=P>>1||1,L=L>>1||1,W=P+m-1&~(m-1),T=L+g-1&~(g-1),R=W*T*E}return n!==0?{uncompressed:_.map(w=>{let G=w[0].levelBuffer,$=!1;return n===Ee.FLOAT?G=new Float32Array(w[0].levelBuffer.buffer,w[0].levelBuffer.byteOffset,w[0].levelBuffer.byteLength/4):n===Ee.UNSIGNED_INT?($=!0,G=new Uint32Array(w[0].levelBuffer.buffer,w[0].levelBuffer.byteOffset,w[0].levelBuffer.byteLength/4)):n===Ee.INT&&($=!0,G=new Int32Array(w[0].levelBuffer.buffer,w[0].levelBuffer.byteOffset,w[0].levelBuffer.byteLength/4)),{resource:new Qn(G,{width:w[0].levelWidth,height:w[0].levelHeight}),type:n,format:$?Lw(a):a}}),kvData:I}:{compressed:_.map(w=>new qr(null,{format:o,width:l,height:c,levels:f,levelBuffers:w})),kvData:I}}function Dw(i,e){for(let t=0;t<$d.length;t++)if(e.getUint8(t)!==$d[t])return console.error(`${i} is not a valid *.ktx file!`),!1;return!0}function Lw(i){switch(i){case ce.RGBA:return ce.RGBA_INTEGER;case ce.RGB:return ce.RGB_INTEGER;case ce.RG:return ce.RG_INTEGER;case ce.RED:return ce.RED_INTEGER;default:return i}}function Ow(i,e,t){const r=new Map;let s=0;for(;se-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let l=0;for(;l{const l=new Me(o,{mipmap:Kt.OFF,alphaMode:ki.NO_PREMULTIPLIED_ALPHA,resolution:Sr(i),...e.data});return Io(l,t,i)});return a.length===1?a[0]:a},unload(i){Array.isArray(i)?i.forEach(e=>e.destroy(!0)):i.destroy(!0)}};_e.add(Fw);const Nw={extension:{type:pe.LoadParser,priority:Vi.High},name:"loadKTX",test(i){return ds(i,".ktx")},async load(i,e,t){const s=await(await fe.ADAPTER.fetch(i)).arrayBuffer(),{compressed:n,uncompressed:a,kvData:o}=Rw(i,s),l=n??a,c={mipmap:Kt.OFF,alphaMode:ki.NO_PREMULTIPLIED_ALPHA,resolution:Sr(i),...e.data},u=l.map(h=>{l===a&&Object.assign(c,{type:h.type,format:h.format});const d=new Me(h,c);return d.ktxKeyValueData=o,Io(d,t,i)});return u.length===1?u[0]:u},unload(i){Array.isArray(i)?i.forEach(e=>e.destroy(!0)):i.destroy(!0)}};_e.add(Nw);const Uw={extension:pe.ResolveParser,test:i=>{const t=i.split("?")[0].split(".").pop();return["basis","ktx","dds"].includes(t)},parse:i=>{if(i.split("?")[0].split(".").pop()==="ktx"){const r=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(r.some(s=>i.endsWith(s)))return{resolution:parseFloat(fe.RETINA_PREFIX.exec(i)?.[1]??"1"),format:r.find(s=>i.endsWith(s)),src:i}}return{resolution:parseFloat(fe.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i}}};_e.add(Uw);const Hw=new Ie,Gw=4,An=class{constructor(i){this.renderer=i}async image(i,e,t){const r=new Image;return r.src=await this.base64(i,e,t),r}async base64(i,e,t){const r=this.canvas(i);if(r.toBlob!==void 0)return new Promise((s,n)=>{r.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}const o=new FileReader;o.onload=()=>s(o.result),o.onerror=n,o.readAsDataURL(a)},e,t)});if(r.toDataURL!==void 0)return r.toDataURL(e,t);if(r.convertToBlob!==void 0){const s=await r.convertToBlob({type:e,quality:t});return new Promise((n,a)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=a,o.readAsDataURL(s)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(i,e){const{pixels:t,width:r,height:s,flipY:n}=this._rawPixels(i,e);n&&An._flipY(t,r,s),An._unpremultiplyAlpha(t);const a=new Rv(r,s,1),o=new ImageData(new Uint8ClampedArray(t.buffer),r,s);return a.context.putImageData(o,0,0),a.canvas}pixels(i,e){const{pixels:t,width:r,height:s,flipY:n}=this._rawPixels(i,e);return n&&An._flipY(t,r,s),An._unpremultiplyAlpha(t),t}_rawPixels(i,e){const t=this.renderer;if(!t)throw new Error("The Extract has already been destroyed");let r,s=!1,n,a=!1;if(i&&(i instanceof pt?n=i:(n=t.generateTexture(i,{resolution:t.resolution,multisample:t.multisample}),a=!0)),n){if(r=n.baseTexture.resolution,e=e??n.frame,s=!1,!a){t.renderTexture.bind(n);const h=n.framebuffer.glFramebuffers[t.CONTEXT_UID];h.blitFramebuffer&&t.framebuffer.bind(h.blitFramebuffer)}}else r=t.resolution,e||(e=Hw,e.width=t.width/r,e.height=t.height/r),s=!0,t.renderTexture.bind();const o=Math.round(e.width*r),l=Math.round(e.height*r),c=new Uint8Array(Gw*o*l),u=t.gl;return u.readPixels(Math.round(e.x*r),Math.round(e.y*r),o,l,u.RGBA,u.UNSIGNED_BYTE,c),a&&n?.destroy(!0),{pixels:c,width:o,height:l,flipY:s}}destroy(){this.renderer=null}static _flipY(i,e,t){const r=e<<2,s=t>>1,n=new Uint8Array(r);for(let a=0;a=0&&o>=0&&s>=0&&n>=0)){e.length=0;return}const l=Math.ceil(2.3*Math.sqrt(a+o)),c=l*8+(s?4:0)+(n?4:0);if(e.length=c,c===0)return;if(l===0){e.length=8,e[0]=e[6]=t+s,e[1]=e[3]=r+n,e[2]=e[4]=t-s,e[5]=e[7]=r-n;return}let u=0,h=l*4+(s?2:0)+2,d=h,f=c;{const p=s+a,m=n,g=t+p,y=t-p,b=r+m;if(e[u++]=g,e[u++]=b,e[--h]=b,e[--h]=y,n){const _=r-m;e[d++]=y,e[d++]=_,e[--f]=_,e[--f]=g}}for(let p=1;p0||e&&r<=0){const s=t/2;for(let n=s+s%2;n=6){Qd(t,!1);const a=[];for(let c=0;c=0&&n>=0&&a.push(t,r,t+s,r,t+s,r+n,t,r+n)},triangulate(i,e){const t=i.points,r=e.points;if(t.length===0)return;const s=r.length/2;r.push(t[0],t[1],t[2],t[3],t[6],t[7],t[4],t[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},zw={build(i){ho.build(i)},triangulate(i,e){ho.triangulate(i,e)}};var yi=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(yi||{}),Xr=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(Xr||{});const Ys={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 Zd{static curveTo(e,t,r,s,n,a){const o=a[a.length-2],c=a[a.length-1]-t,u=o-e,h=s-t,d=r-e,f=Math.abs(c*d-u*h);if(f<1e-8||n===0)return(a[a.length-2]!==e||a[a.length-1]!==t)&&a.push(e,t),null;const p=c*c+u*u,m=h*h+d*d,g=c*h+u*d,y=n*Math.sqrt(p)/f,b=n*Math.sqrt(m)/f,_=y*g/p,v=b*g/m,E=y*d+b*u,I=y*h+b*c,S=u*(b+_),R=c*(b+_),P=d*(y+v),L=h*(y+v),W=Math.atan2(R-I,S-E),T=Math.atan2(L-I,P-E);return{cx:E+e,cy:I+t,radius:n,startAngle:W,endAngle:T,anticlockwise:u*h>d*c}}static arc(e,t,r,s,n,a,o,l,c){const u=o-a,h=Ys._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/so)*40),d=u/(h*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=h-1,y=g%1/g;for(let b=0;b<=g;++b){const _=b+y*b,v=d+a+f*_,E=Math.cos(v),I=-Math.sin(v);c.push((p*E+m*I)*n+r,(p*-I+m*E)*n+s)}}}class Vw{constructor(){this.reset()}begin(e,t,r){this.reset(),this.style=e,this.start=t,this.attribStart=r}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 nc{static curveLength(e,t,r,s,n,a,o,l){let u=0,h=0,d=0,f=0,p=0,m=0,g=0,y=0,b=0,_=0,v=0,E=e,I=t;for(let S=1;S<=10;++S)h=S/10,d=h*h,f=d*h,p=1-h,m=p*p,g=m*p,y=g*e+3*m*h*r+3*p*d*n+f*o,b=g*t+3*m*h*s+3*p*d*a+f*l,_=E-y,v=I-b,E=y,I=b,u+=Math.sqrt(_*_+v*v);return u}static curveTo(e,t,r,s,n,a,o){const l=o[o.length-2],c=o[o.length-1];o.length-=2;const u=Ys._segmentsCount(nc.curveLength(l,c,e,t,r,s,n,a));let h=0,d=0,f=0,p=0,m=0;o.push(l,c);for(let g=1,y=0;g<=u;++g)y=g/u,h=1-y,d=h*h,f=d*h,p=y*y,m=p*y,o.push(f*l+3*d*y*e+3*h*p*r+m*n,f*c+3*d*y*t+3*h*p*s+m*a)}}function Jd(i,e,t,r,s,n,a,o){const l=i-t*s,c=e-r*s,u=i+t*n,h=e+r*n;let d,f;a?(d=r,f=-t):(d=-r,f=t);const p=l+d,m=c+f,g=u+d,y=h+f;return o.push(p,m,g,y),2}function Lr(i,e,t,r,s,n,a,o){const l=t-i,c=r-e;let u=Math.atan2(l,c),h=Math.atan2(s-i,n-e);o&&uh&&(h+=Math.PI*2);let d=u;const f=h-u,p=Math.abs(f),m=Math.sqrt(l*l+c*c),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/g;if(d+=y,o){a.push(i,e,t,r);for(let b=1,_=d;b=0&&(n.join===yi.ROUND?d+=Lr(_,v,_-S*C,v-R*C,_-P*C,v-L*C,u,!1)+4:d+=2,u.push(_-P*w,v-L*w,_+P*C,v+L*C));continue}const Q=(-S+y)*(-R+v)-(-S+_)*(-R+b),ge=(-P+E)*(-L+v)-(-P+_)*(-L+I),Te=(ne*ge-q*Q)/ae,me=(F*Q-X*ge)/ae,be=(Te-_)*(Te-_)+(me-v)*(me-v),Se=_+(Te-_)*C,we=v+(me-v)*C,Re=_-(Te-_)*w,Le=v-(me-v)*w,x=Math.min(ne*ne+X*X,q*q+F*F),K=ee?C:w,j=x+K*K*m,B=be<=j;let k=n.join;if(k===yi.MITER&&be/m>g&&(k=yi.BEVEL),B)switch(k){case yi.MITER:{u.push(Se,we,Re,Le);break}case yi.BEVEL:{ee?u.push(Se,we,_+S*w,v+R*w,Se,we,_+P*w,v+L*w):u.push(_-S*C,v-R*C,Re,Le,_-P*C,v-L*C,Re,Le),d+=2;break}case yi.ROUND:{ee?(u.push(Se,we,_+S*w,v+R*w),d+=Lr(_,v,_+S*w,v+R*w,_+P*w,v+L*w,u,!0)+4,u.push(Se,we,_+P*w,v+L*w)):(u.push(_-S*C,v-R*C,Re,Le),d+=Lr(_,v,_-S*C,v-R*C,_-P*C,v-L*C,u,!1)+4,u.push(_-P*C,v-L*C,Re,Le));break}}else{switch(u.push(_-S*C,v-R*C,_+S*w,v+R*w),k){case yi.MITER:{ee?u.push(Re,Le,Re,Le):u.push(Se,we,Se,we),d+=2;break}case yi.ROUND:{ee?d+=Lr(_,v,_+S*w,v+R*w,_+P*w,v+L*w,u,!0)+2:d+=Lr(_,v,_-S*C,v-R*C,_-P*C,v-L*C,u,!1)+2;break}}u.push(_-P*C,v-L*C,_+P*w,v+L*w),d+=2}}y=r[(h-2)*2],b=r[(h-2)*2+1],_=r[(h-1)*2],v=r[(h-1)*2+1],S=-(b-v),R=y-_,W=Math.sqrt(S*S+R*R),S/=W,R/=W,S*=p,R*=p,u.push(_-S*C,v-R*C,_+S*w,v+R*w),l||(n.cap===Xr.ROUND?d+=Lr(_-S*(C-w)*.5,v-R*(C-w)*.5,_-S*C,v-R*C,_+S*w,v+R*w,u,!1)+2:n.cap===Xr.SQUARE&&(d+=Jd(_,v,S,R,C,w,!1,u)));const G=e.indices,$=Ys.epsilon*Ys.epsilon;for(let z=f;z0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(i,e=null,t=null,r=null){const s=new co(i,e,t,r);return this.graphicsData.push(s),this.dirty++,this}drawHole(i,e=null){if(!this.graphicsData.length)return null;const t=new co(i,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return t.lineStyle=r.lineStyle,r.holes.push(t),this.dirty++,this}destroy(){super.destroy();for(let i=0;i0&&(t=this.batches[this.batches.length-1],r=t.style);for(let o=this.shapeIndex;o65535;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(i,e){return!(!i||!e||i.texture.baseTexture!==e.texture.baseTexture||i.color+i.alpha!==e.color+e.alpha||!!i.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let i=0,e=this.graphicsData.length;i65535*2)return!1;const i=this.batches;for(let e=0;e0&&(r=Sa.pop(),r||(r=new hh,r.texArray=new dh),this.drawCalls.push(r)),r.start=c,r.size=0,r.texArray.count=0,r.type=l),p.touched=1,p._batchEnabled=i,p._batchLocation=s,p.wrapMode=Ar.REPEAT,r.texArray.elements[r.texArray.count++]=p,s++)),r.size+=h.size,c+=h.size,a=p._batchLocation,this.addColors(e,f.color,f.alpha,h.attribSize,h.attribStart),this.addTextureIds(t,a,h.attribSize,h.attribStart)}Me._globalBatch=i,this.packAttributes()}packAttributes(){const i=this.points,e=this.uvs,t=this.colors,r=this.textureIds,s=new ArrayBuffer(i.length*3*4),n=new Float32Array(s),a=new Uint32Array(s);let o=0;for(let l=0;l0&&i.alpha>0;return t?(i.matrix&&(i.matrix=i.matrix.clone(),i.matrix.invert()),Object.assign(this._lineStyle,{visible:t},i)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const i=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Gs,this.currentPath.closeStroke=!1,this.currentPath.points.push(i[e-2],i[e-1]))}else this.currentPath=new Gs,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(i,e){return this.startPoly(),this.currentPath.points[0]=i,this.currentPath.points[1]=e,this}lineTo(i,e){this.currentPath||this.moveTo(0,0);const t=this.currentPath.points,r=t[t.length-2],s=t[t.length-1];return(r!==i||s!==e)&&t.push(i,e),this}_initCurve(i=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[i,e]):this.moveTo(i,e)}quadraticCurveTo(i,e,t,r){this._initCurve();const s=this.currentPath.points;return s.length===0&&this.moveTo(0,0),ac.curveTo(i,e,t,r,s),this}bezierCurveTo(i,e,t,r,s,n){return this._initCurve(),nc.curveTo(i,e,t,r,s,n,this.currentPath.points),this}arcTo(i,e,t,r,s){this._initCurve(i,e);const n=this.currentPath.points,a=Zd.curveTo(i,e,t,r,s,n);if(a){const{cx:o,cy:l,radius:c,startAngle:u,endAngle:h,anticlockwise:d}=a;this.arc(o,l,c,u,h,d)}return this}arc(i,e,t,r,s,n=!1){if(r===s)return this;if(!n&&s<=r?s+=so:n&&r<=s&&(r+=so),s-r===0)return this;const o=i+Math.cos(r)*t,l=e+Math.sin(r)*t,c=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const h=Math.abs(u[u.length-2]-o),d=Math.abs(u[u.length-1]-l);h0;return t?(i.matrix&&(i.matrix=i.matrix.clone(),i.matrix.invert()),Object.assign(this._fillStyle,{visible:t},i)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(i,e,t,r){return this.drawShape(new Ie(i,e,t,r))}drawRoundedRect(i,e,t,r,s){return this.drawShape(new ic(i,e,t,r,s))}drawCircle(i,e,t){return this.drawShape(new ec(i,e,t))}drawEllipse(i,e,t,r){return this.drawShape(new tc(i,e,t,r))}drawPolygon(...i){let e,t=!0;const r=i[0];r.points?(t=r.closeStroke,e=r.points):Array.isArray(i[0])?e=i[0]:e=i;const s=new Gs(e);return s.closeStroke=t,this.drawShape(s),this}drawShape(i){return this._holeMode?this._geometry.drawHole(i,this._matrix):this._geometry.drawShape(i,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 i=this._geometry.graphicsData;return i.length===1&&i[0].shape.type===Mt.RECT&&!i[0].matrix&&!i[0].holes.length&&!(i[0].lineStyle.visible&&i[0].lineStyle.width)}_render(i){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(i)):(i.batch.flush(),this._renderDirect(i))}_populateBatches(){const i=this._geometry,e=this.blendMode,t=i.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=i.batchDirty,this.batches.length=t,this.vertexData=new Float32Array(i.points);for(let r=0;r{const t=URL.createObjectURL(new Blob([Yb.code],{type:"application/javascript"})),r=new Worker(t);r.addEventListener("message",s=>{r.terminate(),URL.revokeObjectURL(t),e(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(e){return this._run("loadImageBitmap",[e])}async _initWorkers(){this._initialized||(this._initialized=!0)}getWorker(){El===void 0&&(El=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 r=new Promise((s,n)=>{this.queue.push({id:e,arguments:t,resolve:s,reject:n})});return this.next(),r}next(){if(!this.queue.length)return;const e=this.getWorker();if(!e)return;const t=this.queue.pop(),r=t.id;this.resolveHash[Vd]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:Vd++,id:r})}}const jd=new qb;function Bo(i,e,t){const r=new ie(i);return r.baseTexture.on("dispose",()=>{delete e.promiseCache[t]}),r}const Kb=[".jpeg",".jpg",".png",".webp",".avif"],Qb=["image/jpeg","image/png","image/webp","image/avif"];async function Zb(i){const e=await fe.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 Ro={name:"loadTextures",extension:{type:pe.LoadParser,priority:Vi.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(i){return ea(i,Qb)||fs(i,Kb)},async load(i,e,t){let r=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await jd.isImageBitmapSupported()?r=await jd.loadImageBitmap(i):r=await Zb(i):r=await new Promise(n=>{r=new Image,r.crossOrigin=this.config.crossOrigin,r.src=i,r.complete?n(r):r.onload=()=>{n(r)}});const s=new Me(r,{resolution:Sr(i),...e.data});return s.resource.src=i,Bo(s,t,i)},unload(i){i.destroy(!0)}};_e.add(Ro);const Jb=".svg",ew="image/svg+xml",tw={extension:{type:pe.LoadParser,priority:Vi.High},name:"loadSVG",test(i){return ea(i,ew)||fs(i,Jb)},async testParse(i){return Vn.test(i)},async parse(i,e,t){const r=new Vn(i,e?.data?.resourceOptions);await r.load();const s=new Me(r,{resolution:Sr(i),...e?.data});return s.resource.src=i,Bo(s,t,i)},async load(i,e){return(await fe.ADAPTER.fetch(i)).text()},unload:Ro.unload};_e.add(tw);class iw{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(r=>`${encodeURIComponent(r)}=${encodeURIComponent(t[r])}`).join("&")}}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 r=[];Array.isArray(t)?t.forEach(s=>{if(typeof s.name=="string"){const n=this._createBundleAssetId(e,s.name);r.push(n),this.add([s.name,n],s.srcs,s.data)}else{const n=s.name.map(a=>this._createBundleAssetId(e,a));n.forEach(a=>{r.push(a)}),this.add([...s.name,...n],s.srcs)}}):Object.keys(t).forEach(s=>{r.push(this._createBundleAssetId(e,s)),this.add([s,this._createBundleAssetId(e,s)],t[s])}),this._bundles[e]=r}add(e,t,r){const s=Zi(e);s.forEach(a=>{this.hasKey(a)&&console.warn(`[Resolver] already has key: ${a} overwriting`)}),Array.isArray(t)||(typeof t=="string"?t=Pb(t):t=[t]);const n=t.map(a=>{let o=a;if(typeof a=="string"){let l=!1;for(let c=0;c{this._assetMap[a]=n})}resolveBundle(e){const t=lo(e);e=Zi(e);const r={};return e.forEach(s=>{const n=this._bundles[s];if(n){const a=this.resolve(n),o={};for(const l in a){const c=a[l];o[this._extractAssetIdFromBundle(s,l)]=c}r[s]=o}}),t?r[e[0]]:r}resolveUrl(e){const t=this.resolve(e);if(typeof e!="string"){const r={};for(const s in t)r[s]=t[s].src;return r}return t.src}resolve(e){const t=lo(e);e=Zi(e);const r={};return e.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const a=this._getPreferredOrder(n),o=n[0];a?.priority.forEach(l=>{a.params[l].forEach(c=>{const u=n.filter(h=>h[l]?h[l]===c:!1);u.length&&(n=u)})}),this._resolverHash[s]=n[0]??o}else{let n=s;(this._basePath||this._rootPath)&&(n=Rt.toAbsolute(n,this._basePath,this._rootPath)),n=this._appendDefaultSearchParams(n),this._resolverHash[s]={src:n}}r[s]=this._resolverHash[s]}),t?r[e[0]]:r}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;tn.params.format.includes(r.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(e){if(!this._defaultSearchParams)return e;const t=/\?/.test(e)?"&":"?";return`${e}${t}${this._defaultSearchParams}`}}class rw{constructor(){this._detections=[],this._initialized=!1,this.resolver=new iw,this.loader=new Rb,this.cache=vn,this._backgroundLoader=new Ib(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){if(this._initialized){console.warn("[Assets]AssetManager already initialized, did you load before calling this Asset.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 n=e.manifest;typeof n=="string"&&(n=await this.load(n)),this.resolver.addManifest(n)}const t=e.texturePreference?.resolution??1,r=typeof t=="number"?[t]:t;let s=[];if(e.texturePreference?.format){const n=e.texturePreference?.format;s=typeof n=="string"?[n]:n;for(const a of this._detections)await a.test()||(s=await a.remove(s))}else for(const n of this._detections)await n.test()&&(s=await n.add(s));this.resolver.prefer({params:{format:s,resolution:r}}),e.preferences&&this.setPreferences(e.preferences)}add(e,t,r){this.resolver.add(e,t,r)}async load(e,t){this._initialized||await this.init();const r=lo(e),s=Zi(e).map(o=>typeof o!="string"?(this.resolver.add(o.src,o),o.src):(this.resolver.hasKey(o)||this.resolver.add(o,o),o)),n=this.resolver.resolve(s),a=await this._mapLoadToResolve(n,t);return r?a[s[0]]:a}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let r=!1;typeof e=="string"&&(r=!0,e=[e]);const s=this.resolver.resolveBundle(e),n={},a=Object.keys(s);let o=0,l=0;const c=()=>{t?.(++o/l)},u=a.map(h=>{const d=s[h];return l+=Object.keys(d).length,this._mapLoadToResolve(d,c).then(f=>{n[h]=f})});return await Promise.all(u),r?n[e[0]]:n}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(r=>{this._backgroundLoader.add(Object.values(r))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e=="string")return vn.get(e);const t={};for(let r=0;r{const c=n[o.src],u=[o.src];o.alias&&u.push(...o.alias),a[s[l]]=c,vn.set(u,c)}),a}async unload(e){this._initialized||await this.init();const t=Zi(e).map(s=>typeof s!="string"?s.src:s),r=this.resolver.resolve(t);await this._unloadFromResolved(r)}async unloadBundle(e){this._initialized||await this.init(),e=Zi(e);const t=this.resolver.resolveBundle(e),r=Object.keys(t).map(s=>this._unloadFromResolved(t[s]));await Promise.all(r)}async _unloadFromResolved(e){const t=Object.values(e);t.forEach(r=>{vn.remove(r.src)}),await this.loader.unload(t)}get detections(){return this._detections}get preferWorkers(){return Ro.config.preferWorkers}set preferWorkers(e){Ue("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(r=>r in e).forEach(r=>{t.config[r]=e[r]})})}}const Rs=new rw;_e.handleByList(pe.LoadParser,Rs.loader.parsers).handleByList(pe.ResolveParser,Rs.resolver.parsers).handleByList(pe.CacheParser,Rs.cache.parsers).handleByList(pe.DetectionParser,Rs.detections);const sw={extension:pe.CacheParser,test:i=>Array.isArray(i)&&i.every(e=>e instanceof ie),getCacheableAssets:(i,e)=>{const t={};return i.forEach(r=>{e.forEach((s,n)=>{t[r+(n===0?"":n+1)]=s})}),t}};_e.add(sw);const aw={extension:{type:pe.DetectionParser,priority:1},test:async()=>{if(!globalThis.createImageBitmap)return!1;const i="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=",e=await fe.ADAPTER.fetch(i).then(t=>t.blob());return createImageBitmap(e).then(()=>!0,()=>!1)},add:async i=>[...i,"avif"],remove:async i=>i.filter(e=>e!=="avif")};_e.add(aw);const ow={extension:{type:pe.DetectionParser,priority:0},test:async()=>{if(!globalThis.createImageBitmap)return!1;const i="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=",e=await fe.ADAPTER.fetch(i).then(t=>t.blob());return createImageBitmap(e).then(()=>!0,()=>!1)},add:async i=>[...i,"webp"],remove:async i=>i.filter(e=>e!=="webp")};_e.add(ow);const Xd=["png","jpg","jpeg"],lw={extension:{type:pe.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async i=>[...i,...Xd],remove:async i=>i.filter(e=>!Xd.includes(e))};_e.add(lw);const hw={extension:pe.ResolveParser,test:Ro.test,parse:i=>({resolution:parseFloat(fe.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i})};_e.add(hw);var Xt=(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=35986]="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))(Xt||{});const ho={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,35986:1,34798:1,37808:1};let $i,Ts;function Yd(){Ts={s3tc:$i.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:$i.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:$i.getExtension("WEBGL_compressed_texture_etc"),etc1:$i.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:$i.getExtension("WEBGL_compressed_texture_pvrtc")||$i.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:$i.getExtension("WEBGL_compressed_texture_atc"),astc:$i.getExtension("WEBGL_compressed_texture_astc")}}const cw={extension:{type:pe.DetectionParser,priority:2},test:async()=>{const e=fe.ADAPTER.createCanvas().getContext("webgl");return e?($i=e,!0):(console.warn("WebGL not available for compressed textures."),!1)},add:async i=>{Ts||Yd();const e=[];for(const t in Ts)Ts[t]&&e.push(t);return[...e,...i]},remove:async i=>(Ts||Yd(),i.filter(e=>!(e in Ts)))};_e.add(cw);class dw extends Zn{constructor(e,t={width:1,height:1,autoLoad:!0}){let r,s;typeof e=="string"?(r=e,s=new Uint8Array):(r=null,s=e),super(s,t),this.origin=r,this.buffer=s?new hh(s):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 hh(e),this.loaded=!0,this.onBlobLoaded(e),this.update(),this)),this._load)}}class Jr extends dw{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=Jr._formatToExtension(this.format),(t.levelBuffers||this.buffer)&&(this._levelBuffers=t.levelBuffers||Jr._createLevelBuffers(e instanceof Uint8Array?e:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(e,t,r){const s=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;for(let a=0,o=this.levels;a=33776&&e<=33779)return"s3tc";if(e>=37488&&e<=37497)return"etc";if(e>=35840&&e<=35843)return"pvrtc";if(e>=36196)return"etc1";if(e>=35986&&e<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")}static _createLevelBuffers(e,t,r,s,n,a,o){const l=new Array(r);let c=e.byteOffset,u=a,h=o,d=u+s-1&~(s-1),f=h+n-1&~(n-1),p=d*f*ho[t];for(let m=0;m1?u:d,levelHeight:r>1?h:f,levelBuffer:new Uint8Array(e.buffer,c,p)},c+=p,u=u>>1||1,h=h>>1||1,d=u+s-1&~(s-1),f=h+n-1&~(n-1),p=d*f*ho[t];return l}}const Sl=4,Ea=124,uw=32,$d=20,fw=542327876,Ta={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},pw={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},Sa={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},mw=1,gw=2,yw=4,vw=64,bw=512,ww=131072,_w=827611204,xw=861165636,Aw=894720068,Ew=808540228,Tw=4,Sw={[_w]:Xt.COMPRESSED_RGBA_S3TC_DXT1_EXT,[xw]:Xt.COMPRESSED_RGBA_S3TC_DXT3_EXT,[Aw]:Xt.COMPRESSED_RGBA_S3TC_DXT5_EXT},Cw={70:Xt.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Xt.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Xt.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Xt.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Xt.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Xt.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Xt.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Xt.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Xt.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT};function Mw(i){const e=new Uint32Array(i);if(e[0]!==fw)throw new Error("Invalid DDS file magic word");const r=new Uint32Array(i,0,Ea/Uint32Array.BYTES_PER_ELEMENT),s=r[Ta.HEIGHT],n=r[Ta.WIDTH],a=r[Ta.MIPMAP_COUNT],o=new Uint32Array(i,Ta.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,uw/Uint32Array.BYTES_PER_ELEMENT),l=o[mw];if(l&yw){const c=o[pw.FOURCC];if(c!==Ew){const w=Sw[c],v=Sl+Ea,E=new Uint8Array(i,v);return[new Jr(E,{format:w,width:n,height:s,levels:a})]}const u=Sl+Ea,h=new Uint32Array(e.buffer,u,$d/Uint32Array.BYTES_PER_ELEMENT),d=h[Sa.DXGI_FORMAT],f=h[Sa.RESOURCE_DIMENSION],p=h[Sa.MISC_FLAG],m=h[Sa.ARRAY_SIZE],g=Cw[d];if(g===void 0)throw new Error(`DDSParser cannot parse texture data with DXGI format ${d}`);if(p===Tw)throw new Error("DDSParser does not support cubemap textures");if(f===6)throw new Error("DDSParser does not supported 3D texture data");const y=new Array,b=Sl+Ea+$d;if(m===1)y.push(new Uint8Array(i,b));else{const w=ho[g];let v=0,E=n,S=s;for(let B=0;B>>1,S=S>>>1}let T=b;for(let B=0;Bnew Jr(w,{format:g,width:n,height:s,levels:a}))}throw l&vw?new Error("DDSParser does not support uncompressed texture data."):l&bw?new Error("DDSParser does not supported YUV uncompressed texture data."):l&ww?new Error("DDSParser does not support single-channel (lumninance) texture data!"):l&gw?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 qd=[171,75,84,88,32,49,49,187,13,10,26,10],kw=67305985,ui={FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,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},Th=64,Kd={[Ee.UNSIGNED_BYTE]:1,[Ee.UNSIGNED_SHORT]:2,[Ee.INT]:4,[Ee.UNSIGNED_INT]:4,[Ee.FLOAT]:4,[Ee.HALF_FLOAT]:8},Iw={[ce.RGBA]:4,[ce.RGB]:3,[ce.RG]:2,[ce.RED]:1,[ce.LUMINANCE]:1,[ce.LUMINANCE_ALPHA]:2,[ce.ALPHA]:1},Pw={[Ee.UNSIGNED_SHORT_4_4_4_4]:2,[Ee.UNSIGNED_SHORT_5_5_5_1]:2,[Ee.UNSIGNED_SHORT_5_6_5]:2};function Bw(i,e,t=!1){const r=new DataView(e);if(!Rw(i,r))return null;const s=r.getUint32(ui.ENDIANNESS,!0)===kw,n=r.getUint32(ui.GL_TYPE,s),a=r.getUint32(ui.GL_FORMAT,s),o=r.getUint32(ui.GL_INTERNAL_FORMAT,s),l=r.getUint32(ui.PIXEL_WIDTH,s),c=r.getUint32(ui.PIXEL_HEIGHT,s)||1,u=r.getUint32(ui.PIXEL_DEPTH,s)||1,h=r.getUint32(ui.NUMBER_OF_ARRAY_ELEMENTS,s)||1,d=r.getUint32(ui.NUMBER_OF_FACES,s),f=r.getUint32(ui.NUMBER_OF_MIPMAP_LEVELS,s),p=r.getUint32(ui.BYTES_OF_KEY_VALUE_DATA,s);if(c===0||u!==1)throw new Error("Only 2D textures are supported");if(d!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(h!==1)throw new Error("WebGL does not support array textures");const m=4,g=4,y=l+3&-4,b=c+3&-4,w=new Array(h);let v=l*c;n===0&&(v=y*b);let E;if(n!==0?Kd[n]?E=Kd[n]*Iw[a]:E=Pw[n]:E=ho[o],E===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");const S=t?Lw(r,p,s):null;let B=v*E,k=l,D=c,W=y,C=b,M=Th+p;for(let _=0;_1||n!==0?k:W,levelHeight:f>1||n!==0?D:C,levelBuffer:new Uint8Array(e,Y,B)},Y+=B}M+=U+4,M=M%4!==0?M+4-M%4:M,k=k>>1||1,D=D>>1||1,W=k+m-1&~(m-1),C=D+g-1&~(g-1),B=W*C*E}return n!==0?{uncompressed:w.map(_=>{let U=_[0].levelBuffer,Y=!1;return n===Ee.FLOAT?U=new Float32Array(_[0].levelBuffer.buffer,_[0].levelBuffer.byteOffset,_[0].levelBuffer.byteLength/4):n===Ee.UNSIGNED_INT?(Y=!0,U=new Uint32Array(_[0].levelBuffer.buffer,_[0].levelBuffer.byteOffset,_[0].levelBuffer.byteLength/4)):n===Ee.INT&&(Y=!0,U=new Int32Array(_[0].levelBuffer.buffer,_[0].levelBuffer.byteOffset,_[0].levelBuffer.byteLength/4)),{resource:new Zn(U,{width:_[0].levelWidth,height:_[0].levelHeight}),type:n,format:Y?Dw(a):a}}),kvData:S}:{compressed:w.map(_=>new Jr(null,{format:o,width:l,height:c,levels:f,levelBuffers:_})),kvData:S}}function Rw(i,e){for(let t=0;te-s){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}let l=0;for(;l{const l=new Me(o,{mipmap:$t.OFF,alphaMode:Ii.NO_PREMULTIPLIED_ALPHA,resolution:Sr(i),...e.data});return Bo(l,t,i)});return a.length===1?a[0]:a},unload(i){Array.isArray(i)?i.forEach(e=>e.destroy(!0)):i.destroy(!0)}};_e.add(Ow);const Fw={extension:{type:pe.LoadParser,priority:Vi.High},name:"loadKTX",test(i){return fs(i,".ktx")},async load(i,e,t){const s=await(await fe.ADAPTER.fetch(i)).arrayBuffer(),{compressed:n,uncompressed:a,kvData:o}=Bw(i,s),l=n??a,c={mipmap:$t.OFF,alphaMode:Ii.NO_PREMULTIPLIED_ALPHA,resolution:Sr(i),...e.data},u=l.map(h=>{l===a&&Object.assign(c,{type:h.type,format:h.format});const d=new Me(h,c);return d.ktxKeyValueData=o,Bo(d,t,i)});return u.length===1?u[0]:u},unload(i){Array.isArray(i)?i.forEach(e=>e.destroy(!0)):i.destroy(!0)}};_e.add(Fw);const Nw={extension:pe.ResolveParser,test:i=>{const t=i.split("?")[0].split(".").pop();return["basis","ktx","dds"].includes(t)},parse:i=>{if(i.split("?")[0].split(".").pop()==="ktx"){const r=[".s3tc.ktx",".s3tc_sRGB.ktx",".etc.ktx",".etc1.ktx",".pvrt.ktx",".atc.ktx",".astc.ktx"];if(r.some(s=>i.endsWith(s)))return{resolution:parseFloat(fe.RETINA_PREFIX.exec(i)?.[1]??"1"),format:r.find(s=>i.endsWith(s)),src:i}}return{resolution:parseFloat(fe.RETINA_PREFIX.exec(i)?.[1]??"1"),format:i.split(".").pop(),src:i}}};_e.add(Nw);const Uw=new Ie,Hw=4,En=class{constructor(i){this.renderer=i}async image(i,e,t){const r=new Image;return r.src=await this.base64(i,e,t),r}async base64(i,e,t){const r=this.canvas(i);if(r.toBlob!==void 0)return new Promise((s,n)=>{r.toBlob(a=>{if(!a){n(new Error("ICanvas.toBlob failed!"));return}const o=new FileReader;o.onload=()=>s(o.result),o.onerror=n,o.readAsDataURL(a)},e,t)});if(r.toDataURL!==void 0)return r.toDataURL(e,t);if(r.convertToBlob!==void 0){const s=await r.convertToBlob({type:e,quality:t});return new Promise((n,a)=>{const o=new FileReader;o.onload=()=>n(o.result),o.onerror=a,o.readAsDataURL(s)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(i,e){const{pixels:t,width:r,height:s,flipY:n}=this._rawPixels(i,e);n&&En._flipY(t,r,s),En._unpremultiplyAlpha(t);const a=new Bv(r,s,1),o=new ImageData(new Uint8ClampedArray(t.buffer),r,s);return a.context.putImageData(o,0,0),a.canvas}pixels(i,e){const{pixels:t,width:r,height:s,flipY:n}=this._rawPixels(i,e);return n&&En._flipY(t,r,s),En._unpremultiplyAlpha(t),t}_rawPixels(i,e){const t=this.renderer;if(!t)throw new Error("The Extract has already been destroyed");let r,s=!1,n,a=!1;if(i&&(i instanceof yt?n=i:(n=t.generateTexture(i,{resolution:t.resolution,multisample:t.multisample}),a=!0)),n){if(r=n.baseTexture.resolution,e=e??n.frame,s=!1,!a){t.renderTexture.bind(n);const h=n.framebuffer.glFramebuffers[t.CONTEXT_UID];h.blitFramebuffer&&t.framebuffer.bind(h.blitFramebuffer)}}else r=t.resolution,e||(e=Uw,e.width=t.width/r,e.height=t.height/r),s=!0,t.renderTexture.bind();const o=Math.round(e.width*r),l=Math.round(e.height*r),c=new Uint8Array(Hw*o*l),u=t.gl;return u.readPixels(Math.round(e.x*r),Math.round(e.y*r),o,l,u.RGBA,u.UNSIGNED_BYTE,c),a&&n?.destroy(!0),{pixels:c,width:o,height:l,flipY:s}}destroy(){this.renderer=null}static _flipY(i,e,t){const r=e<<2,s=t>>1,n=new Uint8Array(r);for(let a=0;a=0&&o>=0&&s>=0&&n>=0)){e.length=0;return}const l=Math.ceil(2.3*Math.sqrt(a+o)),c=l*8+(s?4:0)+(n?4:0);if(e.length=c,c===0)return;if(l===0){e.length=8,e[0]=e[6]=t+s,e[1]=e[3]=r+n,e[2]=e[4]=t-s,e[5]=e[7]=r-n;return}let u=0,h=l*4+(s?2:0)+2,d=h,f=c;{const p=s+a,m=n,g=t+p,y=t-p,b=r+m;if(e[u++]=g,e[u++]=b,e[--h]=b,e[--h]=y,n){const w=r-m;e[d++]=y,e[d++]=w,e[--f]=w,e[--f]=g}}for(let p=1;p0||e&&r<=0){const s=t/2;for(let n=s+s%2;n=6){Qd(t,!1);const a=[];for(let c=0;c=0&&n>=0&&a.push(t,r,t+s,r,t+s,r+n,t,r+n)},triangulate(i,e){const t=i.points,r=e.points;if(t.length===0)return;const s=r.length/2;r.push(t[0],t[1],t[2],t[3],t[6],t[7],t[4],t[5]),e.indices.push(s,s+1,s+2,s+1,s+2,s+3)}},Ww={build(i){co.build(i)},triangulate(i,e){co.triangulate(i,e)}};var yi=(i=>(i.MITER="miter",i.BEVEL="bevel",i.ROUND="round",i))(yi||{}),qr=(i=>(i.BUTT="butt",i.ROUND="round",i.SQUARE="square",i))(qr||{});const $s={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 Zd{static curveTo(e,t,r,s,n,a){const o=a[a.length-2],c=a[a.length-1]-t,u=o-e,h=s-t,d=r-e,f=Math.abs(c*d-u*h);if(f<1e-8||n===0)return(a[a.length-2]!==e||a[a.length-1]!==t)&&a.push(e,t),null;const p=c*c+u*u,m=h*h+d*d,g=c*h+u*d,y=n*Math.sqrt(p)/f,b=n*Math.sqrt(m)/f,w=y*g/p,v=b*g/m,E=y*d+b*u,S=y*h+b*c,T=u*(b+w),B=c*(b+w),k=d*(y+v),D=h*(y+v),W=Math.atan2(B-S,T-E),C=Math.atan2(D-S,k-E);return{cx:E+e,cy:S+t,radius:n,startAngle:W,endAngle:C,anticlockwise:u*h>d*c}}static arc(e,t,r,s,n,a,o,l,c){const u=o-a,h=$s._segmentsCount(Math.abs(u)*n,Math.ceil(Math.abs(u)/no)*40),d=u/(h*2),f=d*2,p=Math.cos(d),m=Math.sin(d),g=h-1,y=g%1/g;for(let b=0;b<=g;++b){const w=b+y*b,v=d+a+f*w,E=Math.cos(v),S=-Math.sin(v);c.push((p*E+m*S)*n+r,(p*-S+m*E)*n+s)}}}class zw{constructor(){this.reset()}begin(e,t,r){this.reset(),this.style=e,this.start=t,this.attribStart=r}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 ac{static curveLength(e,t,r,s,n,a,o,l){let u=0,h=0,d=0,f=0,p=0,m=0,g=0,y=0,b=0,w=0,v=0,E=e,S=t;for(let T=1;T<=10;++T)h=T/10,d=h*h,f=d*h,p=1-h,m=p*p,g=m*p,y=g*e+3*m*h*r+3*p*d*n+f*o,b=g*t+3*m*h*s+3*p*d*a+f*l,w=E-y,v=S-b,E=y,S=b,u+=Math.sqrt(w*w+v*v);return u}static curveTo(e,t,r,s,n,a,o){const l=o[o.length-2],c=o[o.length-1];o.length-=2;const u=$s._segmentsCount(ac.curveLength(l,c,e,t,r,s,n,a));let h=0,d=0,f=0,p=0,m=0;o.push(l,c);for(let g=1,y=0;g<=u;++g)y=g/u,h=1-y,d=h*h,f=d*h,p=y*y,m=p*y,o.push(f*l+3*d*y*e+3*h*p*r+m*n,f*c+3*d*y*t+3*h*p*s+m*a)}}function Jd(i,e,t,r,s,n,a,o){const l=i-t*s,c=e-r*s,u=i+t*n,h=e+r*n;let d,f;a?(d=r,f=-t):(d=-r,f=t);const p=l+d,m=c+f,g=u+d,y=h+f;return o.push(p,m,g,y),2}function Or(i,e,t,r,s,n,a,o){const l=t-i,c=r-e;let u=Math.atan2(l,c),h=Math.atan2(s-i,n-e);o&&uh&&(h+=Math.PI*2);let d=u;const f=h-u,p=Math.abs(f),m=Math.sqrt(l*l+c*c),g=(15*p*Math.sqrt(m)/Math.PI>>0)+1,y=f/g;if(d+=y,o){a.push(i,e,t,r);for(let b=1,w=d;b=0&&(n.join===yi.ROUND?d+=Or(w,v,w-T*M,v-B*M,w-k*M,v-D*M,u,!1)+4:d+=2,u.push(w-k*_,v-D*_,w+k*M,v+D*M));continue}const Q=(-T+y)*(-B+v)-(-T+w)*(-B+b),ge=(-k+E)*(-D+v)-(-k+w)*(-D+S),Te=(ne*ge-$*Q)/re,me=(O*Q-V*ge)/re,be=(Te-w)*(Te-w)+(me-v)*(me-v),Se=w+(Te-w)*M,we=v+(me-v)*M,Re=w-(Te-w)*_,Le=v-(me-v)*_,x=Math.min(ne*ne+V*V,$*$+O*O),K=ee?M:_,X=x+K*K*m,R=be<=X;let P=n.join;if(P===yi.MITER&&be/m>g&&(P=yi.BEVEL),R)switch(P){case yi.MITER:{u.push(Se,we,Re,Le);break}case yi.BEVEL:{ee?u.push(Se,we,w+T*_,v+B*_,Se,we,w+k*_,v+D*_):u.push(w-T*M,v-B*M,Re,Le,w-k*M,v-D*M,Re,Le),d+=2;break}case yi.ROUND:{ee?(u.push(Se,we,w+T*_,v+B*_),d+=Or(w,v,w+T*_,v+B*_,w+k*_,v+D*_,u,!0)+4,u.push(Se,we,w+k*_,v+D*_)):(u.push(w-T*M,v-B*M,Re,Le),d+=Or(w,v,w-T*M,v-B*M,w-k*M,v-D*M,u,!1)+4,u.push(w-k*M,v-D*M,Re,Le));break}}else{switch(u.push(w-T*M,v-B*M,w+T*_,v+B*_),P){case yi.MITER:{ee?u.push(Re,Le,Re,Le):u.push(Se,we,Se,we),d+=2;break}case yi.ROUND:{ee?d+=Or(w,v,w+T*_,v+B*_,w+k*_,v+D*_,u,!0)+2:d+=Or(w,v,w-T*M,v-B*M,w-k*M,v-D*M,u,!1)+2;break}}u.push(w-k*M,v-D*M,w+k*_,v+D*_),d+=2}}y=r[(h-2)*2],b=r[(h-2)*2+1],w=r[(h-1)*2],v=r[(h-1)*2+1],T=-(b-v),B=y-w,W=Math.sqrt(T*T+B*B),T/=W,B/=W,T*=p,B*=p,u.push(w-T*M,v-B*M,w+T*_,v+B*_),l||(n.cap===qr.ROUND?d+=Or(w-T*(M-_)*.5,v-B*(M-_)*.5,w-T*M,v-B*M,w+T*_,v+B*_,u,!1)+2:n.cap===qr.SQUARE&&(d+=Jd(w,v,T,B,M,_,!1,u)));const U=e.indices,Y=$s.epsilon*$s.epsilon;for(let z=f;z0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(i,e=null,t=null,r=null){const s=new uo(i,e,t,r);return this.graphicsData.push(s),this.dirty++,this}drawHole(i,e=null){if(!this.graphicsData.length)return null;const t=new uo(i,null,null,e),r=this.graphicsData[this.graphicsData.length-1];return t.lineStyle=r.lineStyle,r.holes.push(t),this.dirty++,this}destroy(){super.destroy();for(let i=0;i0&&(t=this.batches[this.batches.length-1],r=t.style);for(let o=this.shapeIndex;o65535;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(i,e){return!(!i||!e||i.texture.baseTexture!==e.texture.baseTexture||i.color+i.alpha!==e.color+e.alpha||!!i.native!=!!e.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let i=0,e=this.graphicsData.length;i65535*2)return!1;const i=this.batches;for(let e=0;e0&&(r=Ca.pop(),r||(r=new dh,r.texArray=new fh),this.drawCalls.push(r)),r.start=c,r.size=0,r.texArray.count=0,r.type=l),p.touched=1,p._batchEnabled=i,p._batchLocation=s,p.wrapMode=Ar.REPEAT,r.texArray.elements[r.texArray.count++]=p,s++)),r.size+=h.size,c+=h.size,a=p._batchLocation,this.addColors(e,f.color,f.alpha,h.attribSize,h.attribStart),this.addTextureIds(t,a,h.attribSize,h.attribStart)}Me._globalBatch=i,this.packAttributes()}packAttributes(){const i=this.points,e=this.uvs,t=this.colors,r=this.textureIds,s=new ArrayBuffer(i.length*3*4),n=new Float32Array(s),a=new Uint32Array(s);let o=0;for(let l=0;l0&&i.alpha>0;return t?(i.matrix&&(i.matrix=i.matrix.clone(),i.matrix.invert()),Object.assign(this._lineStyle,{visible:t},i)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){const i=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Ws,this.currentPath.closeStroke=!1,this.currentPath.points.push(i[e-2],i[e-1]))}else this.currentPath=new Ws,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(i,e){return this.startPoly(),this.currentPath.points[0]=i,this.currentPath.points[1]=e,this}lineTo(i,e){this.currentPath||this.moveTo(0,0);const t=this.currentPath.points,r=t[t.length-2],s=t[t.length-1];return(r!==i||s!==e)&&t.push(i,e),this}_initCurve(i=0,e=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[i,e]):this.moveTo(i,e)}quadraticCurveTo(i,e,t,r){this._initCurve();const s=this.currentPath.points;return s.length===0&&this.moveTo(0,0),oc.curveTo(i,e,t,r,s),this}bezierCurveTo(i,e,t,r,s,n){return this._initCurve(),ac.curveTo(i,e,t,r,s,n,this.currentPath.points),this}arcTo(i,e,t,r,s){this._initCurve(i,e);const n=this.currentPath.points,a=Zd.curveTo(i,e,t,r,s,n);if(a){const{cx:o,cy:l,radius:c,startAngle:u,endAngle:h,anticlockwise:d}=a;this.arc(o,l,c,u,h,d)}return this}arc(i,e,t,r,s,n=!1){if(r===s)return this;if(!n&&s<=r?s+=no:n&&r<=s&&(r+=no),s-r===0)return this;const o=i+Math.cos(r)*t,l=e+Math.sin(r)*t,c=this._geometry.closePointEps;let u=this.currentPath?this.currentPath.points:null;if(u){const h=Math.abs(u[u.length-2]-o),d=Math.abs(u[u.length-1]-l);h0;return t?(i.matrix&&(i.matrix=i.matrix.clone(),i.matrix.invert()),Object.assign(this._fillStyle,{visible:t},i)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(i,e,t,r){return this.drawShape(new Ie(i,e,t,r))}drawRoundedRect(i,e,t,r,s){return this.drawShape(new rc(i,e,t,r,s))}drawCircle(i,e,t){return this.drawShape(new tc(i,e,t))}drawEllipse(i,e,t,r){return this.drawShape(new ic(i,e,t,r))}drawPolygon(...i){let e,t=!0;const r=i[0];r.points?(t=r.closeStroke,e=r.points):Array.isArray(i[0])?e=i[0]:e=i;const s=new Ws(e);return s.closeStroke=t,this.drawShape(s),this}drawShape(i){return this._holeMode?this._geometry.drawHole(i,this._matrix):this._geometry.drawShape(i,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 i=this._geometry.graphicsData;return i.length===1&&i[0].shape.type===Mt.RECT&&!i[0].matrix&&!i[0].holes.length&&!(i[0].lineStyle.visible&&i[0].lineStyle.width)}_render(i){this.finishPoly();const e=this._geometry;e.updateBatches(),e.batchable?(this.batchDirty!==e.batchDirty&&this._populateBatches(),this._renderBatched(i)):(i.batch.flush(),this._renderDirect(i))}_populateBatches(){const i=this._geometry,e=this.blendMode,t=i.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=i.batchDirty,this.batches.length=t,this.vertexData=new Float32Array(i.points);for(let r=0;re?1:this._width/e,r=this._topHeight+this._bottomHeight,s=this._height>r?1:this._height/r;return Math.min(t,s)}get width(){return this._width}set width(e){this._width=e,this._refresh()}get height(){return this._height}set height(e){this._height=e,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(e){this._leftWidth=e,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(e){this._rightWidth=e,this._refresh()}get topHeight(){return this._topHeight}set topHeight(e){this._topHeight=e,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(e){this._bottomHeight=e,this._refresh()}_refresh(){const e=this.texture,t=this.geometry.buffers[1].data;this._origWidth=e.orig.width,this._origHeight=e.orig.height;const r=1/this._origWidth,s=1/this._origHeight;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1,t[2]=t[10]=t[18]=t[26]=r*this._leftWidth,t[4]=t[12]=t[20]=t[28]=1-r*this._rightWidth,t[9]=t[11]=t[13]=t[15]=s*this._topHeight,t[17]=t[19]=t[21]=t[23]=1-s*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class lc extends xe{constructor(e=1500,t,r=16384,s=!1){super();const n=16384;r>n&&(r=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=e,this._batchSize=r,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=Ae.NORMAL,this.autoResize=s,this.roundPixels=!0,this.baseTexture=null,this.setProperties(t),this._tintColor=new qe(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(e){e&&(this._properties[0]="vertices"in e||"scale"in e?!!e.vertices||!!e.scale:this._properties[0],this._properties[1]="position"in e?!!e.position:this._properties[1],this._properties[2]="rotation"in e?!!e.rotation:this._properties[2],this._properties[3]="uvs"in e?!!e.uvs:this._properties[3],this._properties[4]="tint"in e||"alpha"in e?!!e.tint||!!e.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e),this._tintColor.toRgbArray(this.tintRgb)}render(e){!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",()=>this.onChildrenChange(0))),e.batch.setObjectRenderer(e.plugins.particle),e.plugins.particle.render(this))}onChildrenChange(e){const t=Math.floor(e/this._batchSize);for(;this._bufferUpdateIDs.lengthe?1:this._width/e,r=this._topHeight+this._bottomHeight,s=this._height>r?1:this._height/r;return Math.min(t,s)}get width(){return this._width}set width(e){this._width=e,this._refresh()}get height(){return this._height}set height(e){this._height=e,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(e){this._leftWidth=e,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(e){this._rightWidth=e,this._refresh()}get topHeight(){return this._topHeight}set topHeight(e){this._topHeight=e,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(e){this._bottomHeight=e,this._refresh()}_refresh(){const e=this.texture,t=this.geometry.buffers[1].data;this._origWidth=e.orig.width,this._origHeight=e.orig.height;const r=1/this._origWidth,s=1/this._origHeight;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1,t[2]=t[10]=t[18]=t[26]=r*this._leftWidth,t[4]=t[12]=t[20]=t[28]=1-r*this._rightWidth,t[9]=t[11]=t[13]=t[15]=s*this._topHeight,t[17]=t[19]=t[21]=t[23]=1-s*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}}class hc extends xe{constructor(e=1500,t,r=16384,s=!1){super();const n=16384;r>n&&(r=n),this._properties=[!1,!0,!1,!1,!1],this._maxSize=e,this._batchSize=r,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=Ae.NORMAL,this.autoResize=s,this.roundPixels=!0,this.baseTexture=null,this.setProperties(t),this._tintColor=new Ke(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(e){e&&(this._properties[0]="vertices"in e||"scale"in e?!!e.vertices||!!e.scale:this._properties[0],this._properties[1]="position"in e?!!e.position:this._properties[1],this._properties[2]="rotation"in e?!!e.rotation:this._properties[2],this._properties[3]="uvs"in e?!!e.uvs:this._properties[3],this._properties[4]="tint"in e||"alpha"in e?!!e.tint||!!e.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e),this._tintColor.toRgbArray(this.tintRgb)}render(e){!this.visible||this.worldAlpha<=0||!this.children.length||!this.renderable||(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",()=>this.onChildrenChange(0))),e.batch.setObjectRenderer(e.plugins.particle),e.plugins.particle.render(this))}onChildrenChange(e){const t=Math.floor(e/this._batchSize);for(;this._bufferUpdateIDs.lengthr&&!e.autoResize&&(a=r);let o=e._buffers;o||(o=e._buffers=this.generateBuffers(e));const l=t[0]._texture.baseTexture,c=l.alphaMode>0;this.state.blendMode=Pf(e.blendMode,c),n.state.set(this.state);const u=n.gl,h=e.worldTransform.copyTo(this.tempMatrix);h.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=h.toArray(!0),this.shader.uniforms.uColor=qe.shared.setValue(e.tintRgb).premultiply(e.worldAlpha,c).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=l,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;fs&&(m=s),p>=o.length&&o.push(this._generateOneMoreBuffer(e));const g=o[p];g.uploadDynamic(t,f,m);const y=e._bufferUpdateIDs[p]||0;d=d||g._updateID0);s[a]=c,s[a+n]=c,s[a+n*2]=c,s[a+n*3]=c,a+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}Ip.extension={name:"particle",type:pe.RendererPlugin};_e.add(Ip);var ea=(i=>(i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",i))(ea||{});const Ma={willReadFrequently:!0},ve=class{static get experimentalLetterSpacingSupported(){let i=ve._experimentalLetterSpacingSupported;if(i!==void 0){const e=fe.ADAPTER.getCanvasRenderingContext2D().prototype;i=ve._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return i}constructor(i,e,t,r,s,n,a,o,l){this.text=i,this.style=e,this.width=t,this.height=r,this.lines=s,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=o,this.fontProperties=l}static measureText(i,e,t,r=ve._canvas){t=t??e.wordWrap;const s=e.toFontString(),n=ve.measureFont(s);n.fontSize===0&&(n.fontSize=e.fontSize,n.ascent=e.fontSize);const a=r.getContext("2d",Ma);a.font=s;const l=(t?ve.wordWrap(i,e,r):i).split(/(?:\r\n|\r|\n)/),c=new Array(l.length);let u=0;for(let p=0;p0&&(r?s-=e:s+=(ve.graphemeSegmenter(i).length-1)*e),s}static wordWrap(i,e,t=ve._canvas){const r=t.getContext("2d",Ma);let s=0,n="",a="";const o=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=ve.collapseSpaces(c),h=ve.collapseNewlines(c);let d=!u;const f=e.wordWrapWidth+l,p=ve.tokenize(i);for(let m=0;mf)if(n!==""&&(a+=ve.addLine(n),n="",s=0),ve.canBreakWords(g,e.breakWords)){const b=ve.wordWrapSplit(g);for(let _=0;_f&&(a+=ve.addLine(n),d=!1,n="",s=0),n+=v,s+=S}}else{n.length>0&&(a+=ve.addLine(n),n="",s=0);const b=m===p.length-1;a+=ve.addLine(g,!b),d=!1,n="",s=0}else y+s>f&&(d=!1,a+=ve.addLine(n),n="",s=0),(n.length>0||!ve.isBreakingSpace(g)||d)&&(n+=g,s+=y)}return a+=ve.addLine(n,!1),a}static addLine(i,e=!0){return i=ve.trimRight(i),i=e?`${i} -`:i,i}static getFromCache(i,e,t,r){let s=t[i];return typeof s!="number"&&(s=ve._measureText(i,e,r)+e,t[i]=s),s}static collapseSpaces(i){return i==="normal"||i==="pre-line"}static collapseNewlines(i){return i==="normal"}static trimRight(i){if(typeof i!="string")return"";for(let e=i.length-1;e>=0;e--){const t=i[e];if(!ve.isBreakingSpace(t))break;i=i.slice(0,-1)}return i}static isNewline(i){return typeof i!="string"?!1:ve._newlines.includes(i.charCodeAt(0))}static isBreakingSpace(i,e){return typeof i!="string"?!1:ve._breakingSpaces.includes(i.charCodeAt(0))}static tokenize(i){const e=[];let t="";if(typeof i!="string")return e;for(let r=0;ra;--h){for(let p=0;p{if(typeof Intl?.Segmenter=="function"){const i=new Intl.Segmenter;return e=>[...i.segment(e)].map(t=>t.segment)}return i=>[...i]})();Ct.experimentalLetterSpacing=!1;Ct._fonts={};Ct._newlines=[10,13];Ct._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];const t_=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],En=class{constructor(i){this.styleID=0,this.reset(),kl(this,i,i)}clone(){const i={};return kl(i,this,En.defaultStyle),new En(i)}reset(){kl(this,En.defaultStyle,En.defaultStyle)}get align(){return this._align}set align(i){this._align!==i&&(this._align=i,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(i){this._breakWords!==i&&(this._breakWords=i,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(i){this._dropShadow!==i&&(this._dropShadow=i,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(i){this._dropShadowAlpha!==i&&(this._dropShadowAlpha=i,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(i){this._dropShadowAngle!==i&&(this._dropShadowAngle=i,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(i){this._dropShadowBlur!==i&&(this._dropShadowBlur=i,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(i){const e=Ml(i);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(i){this._dropShadowDistance!==i&&(this._dropShadowDistance=i,this.styleID++)}get fill(){return this._fill}set fill(i){const e=Ml(i);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(i){this._fillGradientType!==i&&(this._fillGradientType=i,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(i){i_(this._fillGradientStops,i)||(this._fillGradientStops=i,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(i){this.fontFamily!==i&&(this._fontFamily=i,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(i){this._fontSize!==i&&(this._fontSize=i,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(i){this._fontStyle!==i&&(this._fontStyle=i,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(i){this._fontVariant!==i&&(this._fontVariant=i,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(i){this._fontWeight!==i&&(this._fontWeight=i,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(i){this._letterSpacing!==i&&(this._letterSpacing=i,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(i){this._lineHeight!==i&&(this._lineHeight=i,this.styleID++)}get leading(){return this._leading}set leading(i){this._leading!==i&&(this._leading=i,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(i){this._lineJoin!==i&&(this._lineJoin=i,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(i){this._miterLimit!==i&&(this._miterLimit=i,this.styleID++)}get padding(){return this._padding}set padding(i){this._padding!==i&&(this._padding=i,this.styleID++)}get stroke(){return this._stroke}set stroke(i){const e=Ml(i);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(i){this._strokeThickness!==i&&(this._strokeThickness=i,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(i){this._textBaseline!==i&&(this._textBaseline=i,this.styleID++)}get trim(){return this._trim}set trim(i){this._trim!==i&&(this._trim=i,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(i){this._whiteSpace!==i&&(this._whiteSpace=i,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(i){this._wordWrap!==i&&(this._wordWrap=i,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(i){this._wordWrapWidth!==i&&(this._wordWrapWidth=i,this.styleID++)}toFontString(){const i=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let t=e.length-1;t>=0;t--){let r=e[t].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!t_.includes(r)&&(r=`"${r}"`),e[t]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${i} ${e.join(",")}`}};let Ji=En;Ji.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:ea.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};function Ml(i){const e=qe.shared;return Array.isArray(i)?i.map(t=>e.setValue(t).toHex()):e.setValue(i).toHex()}function i_(i,e){if(!Array.isArray(i)||!Array.isArray(e)||i.length!==e.length)return!1;for(let t=0;t0&&f>p&&(m=(p+f)/2);const g=p+h,y=t.lineHeight*(d+1);let b=g;d+10}}function n_(i,e){let t=!1;if(i?._textures?.length){for(let r=0;r{this.queue&&this.prepareItems()},this.registerFindHook(c_),this.registerFindHook(d_),this.registerFindHook(n_),this.registerFindHook(a_),this.registerFindHook(o_),this.registerUploadHook(l_),this.registerUploadHook(h_)}upload(i){return new Promise(e=>{i&&this.add(i),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,Et.system.addOnce(this.tick,this,Mr.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const i=this.queue[0];let e=!1;if(i&&!i._destroyed){for(let t=0,r=this.uploadHooks.length;t=0;e--)this.add(i.children[e]);return this}destroy(){this.ticking&&Et.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}};let uo=Pp;uo.uploadsPerFrame=4;Object.defineProperties(fe,{UPLOADS_PER_FRAME:{get(){return uo.uploadsPerFrame},set(i){Ue("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),uo.uploadsPerFrame=i}}});function Bp(i,e){return e instanceof Me?(e._glTextures[i.CONTEXT_UID]||i.texture.bind(e),!0):!1}function u_(i,e){if(!(e instanceof us))return!1;const{geometry:t}=e;e.finishPoly(),t.updateBatches();const{batches:r}=t;for(let s=0;s=s&&vn.x=n&&vn.yr&&!e.autoResize&&(a=r);let o=e._buffers;o||(o=e._buffers=this.generateBuffers(e));const l=t[0]._texture.baseTexture,c=l.alphaMode>0;this.state.blendMode=If(e.blendMode,c),n.state.set(this.state);const u=n.gl,h=e.worldTransform.copyTo(this.tempMatrix);h.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=h.toArray(!0),this.shader.uniforms.uColor=Ke.shared.setValue(e.tintRgb).premultiply(e.worldAlpha,c).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=l,this.renderer.shader.bind(this.shader);let d=!1;for(let f=0,p=0;fs&&(m=s),p>=o.length&&o.push(this._generateOneMoreBuffer(e));const g=o[p];g.uploadDynamic(t,f,m);const y=e._bufferUpdateIDs[p]||0;d=d||g._updateID0);s[a]=c,s[a+n]=c,s[a+n*2]=c,s[a+n*3]=c,a+=n*4}}destroy(){super.destroy(),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null}}kp.extension={name:"particle",type:pe.RendererPlugin};_e.add(kp);var ta=(i=>(i[i.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",i[i.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL",i))(ta||{});const ka={willReadFrequently:!0},ve=class{static get experimentalLetterSpacingSupported(){let i=ve._experimentalLetterSpacingSupported;if(i!==void 0){const e=fe.ADAPTER.getCanvasRenderingContext2D().prototype;i=ve._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return i}constructor(i,e,t,r,s,n,a,o,l){this.text=i,this.style=e,this.width=t,this.height=r,this.lines=s,this.lineWidths=n,this.lineHeight=a,this.maxLineWidth=o,this.fontProperties=l}static measureText(i,e,t,r=ve._canvas){t=t??e.wordWrap;const s=e.toFontString(),n=ve.measureFont(s);n.fontSize===0&&(n.fontSize=e.fontSize,n.ascent=e.fontSize);const a=r.getContext("2d",ka);a.font=s;const l=(t?ve.wordWrap(i,e,r):i).split(/(?:\r\n|\r|\n)/),c=new Array(l.length);let u=0;for(let p=0;p0&&(r?s-=e:s+=(ve.graphemeSegmenter(i).length-1)*e),s}static wordWrap(i,e,t=ve._canvas){const r=t.getContext("2d",ka);let s=0,n="",a="";const o=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,u=ve.collapseSpaces(c),h=ve.collapseNewlines(c);let d=!u;const f=e.wordWrapWidth+l,p=ve.tokenize(i);for(let m=0;mf)if(n!==""&&(a+=ve.addLine(n),n="",s=0),ve.canBreakWords(g,e.breakWords)){const b=ve.wordWrapSplit(g);for(let w=0;wf&&(a+=ve.addLine(n),d=!1,n="",s=0),n+=v,s+=T}}else{n.length>0&&(a+=ve.addLine(n),n="",s=0);const b=m===p.length-1;a+=ve.addLine(g,!b),d=!1,n="",s=0}else y+s>f&&(d=!1,a+=ve.addLine(n),n="",s=0),(n.length>0||!ve.isBreakingSpace(g)||d)&&(n+=g,s+=y)}return a+=ve.addLine(n,!1),a}static addLine(i,e=!0){return i=ve.trimRight(i),i=e?`${i} +`:i,i}static getFromCache(i,e,t,r){let s=t[i];return typeof s!="number"&&(s=ve._measureText(i,e,r)+e,t[i]=s),s}static collapseSpaces(i){return i==="normal"||i==="pre-line"}static collapseNewlines(i){return i==="normal"}static trimRight(i){if(typeof i!="string")return"";for(let e=i.length-1;e>=0;e--){const t=i[e];if(!ve.isBreakingSpace(t))break;i=i.slice(0,-1)}return i}static isNewline(i){return typeof i!="string"?!1:ve._newlines.includes(i.charCodeAt(0))}static isBreakingSpace(i,e){return typeof i!="string"?!1:ve._breakingSpaces.includes(i.charCodeAt(0))}static tokenize(i){const e=[];let t="";if(typeof i!="string")return e;for(let r=0;ra;--h){for(let p=0;p{if(typeof Intl?.Segmenter=="function"){const i=new Intl.Segmenter;return e=>[...i.segment(e)].map(t=>t.segment)}return i=>[...i]})();Ct.experimentalLetterSpacing=!1;Ct._fonts={};Ct._newlines=[10,13];Ct._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];const e_=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Tn=class{constructor(i){this.styleID=0,this.reset(),Pl(this,i,i)}clone(){const i={};return Pl(i,this,Tn.defaultStyle),new Tn(i)}reset(){Pl(this,Tn.defaultStyle,Tn.defaultStyle)}get align(){return this._align}set align(i){this._align!==i&&(this._align=i,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(i){this._breakWords!==i&&(this._breakWords=i,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(i){this._dropShadow!==i&&(this._dropShadow=i,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(i){this._dropShadowAlpha!==i&&(this._dropShadowAlpha=i,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(i){this._dropShadowAngle!==i&&(this._dropShadowAngle=i,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(i){this._dropShadowBlur!==i&&(this._dropShadowBlur=i,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(i){const e=Il(i);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(i){this._dropShadowDistance!==i&&(this._dropShadowDistance=i,this.styleID++)}get fill(){return this._fill}set fill(i){const e=Il(i);this._fill!==e&&(this._fill=e,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(i){this._fillGradientType!==i&&(this._fillGradientType=i,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(i){t_(this._fillGradientStops,i)||(this._fillGradientStops=i,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(i){this.fontFamily!==i&&(this._fontFamily=i,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(i){this._fontSize!==i&&(this._fontSize=i,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(i){this._fontStyle!==i&&(this._fontStyle=i,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(i){this._fontVariant!==i&&(this._fontVariant=i,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(i){this._fontWeight!==i&&(this._fontWeight=i,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(i){this._letterSpacing!==i&&(this._letterSpacing=i,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(i){this._lineHeight!==i&&(this._lineHeight=i,this.styleID++)}get leading(){return this._leading}set leading(i){this._leading!==i&&(this._leading=i,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(i){this._lineJoin!==i&&(this._lineJoin=i,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(i){this._miterLimit!==i&&(this._miterLimit=i,this.styleID++)}get padding(){return this._padding}set padding(i){this._padding!==i&&(this._padding=i,this.styleID++)}get stroke(){return this._stroke}set stroke(i){const e=Il(i);this._stroke!==e&&(this._stroke=e,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(i){this._strokeThickness!==i&&(this._strokeThickness=i,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(i){this._textBaseline!==i&&(this._textBaseline=i,this.styleID++)}get trim(){return this._trim}set trim(i){this._trim!==i&&(this._trim=i,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(i){this._whiteSpace!==i&&(this._whiteSpace=i,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(i){this._wordWrap!==i&&(this._wordWrap=i,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(i){this._wordWrapWidth!==i&&(this._wordWrapWidth=i,this.styleID++)}toFontString(){const i=typeof this.fontSize=="number"?`${this.fontSize}px`:this.fontSize;let e=this.fontFamily;Array.isArray(this.fontFamily)||(e=this.fontFamily.split(","));for(let t=e.length-1;t>=0;t--){let r=e[t].trim();!/([\"\'])[^\'\"]+\1/.test(r)&&!e_.includes(r)&&(r=`"${r}"`),e[t]=r}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${i} ${e.join(",")}`}};let Ji=Tn;Ji.defaultStyle={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:ta.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};function Il(i){const e=Ke.shared;return Array.isArray(i)?i.map(t=>e.setValue(t).toHex()):e.setValue(i).toHex()}function t_(i,e){if(!Array.isArray(i)||!Array.isArray(e)||i.length!==e.length)return!1;for(let t=0;t0&&f>p&&(m=(p+f)/2);const g=p+h,y=t.lineHeight*(d+1);let b=g;d+10}}function s_(i,e){let t=!1;if(i?._textures?.length){for(let r=0;r{this.queue&&this.prepareItems()},this.registerFindHook(h_),this.registerFindHook(c_),this.registerFindHook(s_),this.registerFindHook(n_),this.registerFindHook(a_),this.registerUploadHook(o_),this.registerUploadHook(l_)}upload(i){return new Promise(e=>{i&&this.add(i),this.queue.length?(this.completes.push(e),this.ticking||(this.ticking=!0,At.system.addOnce(this.tick,this,Mr.UTILITY))):e()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){const i=this.queue[0];let e=!1;if(i&&!i._destroyed){for(let t=0,r=this.uploadHooks.length;t=0;e--)this.add(i.children[e]);return this}destroy(){this.ticking&&At.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}};let fo=Ip;fo.uploadsPerFrame=4;Object.defineProperties(fe,{UPLOADS_PER_FRAME:{get(){return fo.uploadsPerFrame},set(i){Ue("7.1.0","settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame"),fo.uploadsPerFrame=i}}});function Pp(i,e){return e instanceof Me?(e._glTextures[i.CONTEXT_UID]||i.texture.bind(e),!0):!1}function d_(i,e){if(!(e instanceof ps))return!1;const{geometry:t}=e;e.finishPoly(),t.updateBatches();const{batches:r}=t;for(let s=0;s=s&&bn.x=n&&bn.y1?Ut.from(m_,p_,t):Ut.from(su,g_,t)}render(e){const t=this.renderer,r=this.quad;let s=r.vertices;s[0]=s[6]=e._width*-e.anchor.x,s[1]=s[3]=e._height*-e.anchor.y,s[2]=s[4]=e._width*(1-e.anchor.x),s[5]=s[7]=e._height*(1-e.anchor.y);const n=e.uvRespectAnchor?e.anchor.x:0,a=e.uvRespectAnchor?e.anchor.y:0;s=r.uvs,s[0]=s[6]=-n,s[1]=s[3]=-a,s[2]=s[4]=1-n,s[5]=s[7]=1-a,r.invalidate();const o=e._texture,l=o.baseTexture,c=l.alphaMode>0,u=e.tileTransform.localTransform,h=e.uvMatrix;let d=l.isPowerOfTwo&&o.frame.width===l.width&&o.frame.height===l.height;d&&(l._glTextures[t.CONTEXT_UID]?d=l.wrapMode!==Ar.CLAMP:l.wrapMode===Ar.CLAMP&&(l.wrapMode=Ar.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=e._width,y=e._height;ka.set(u.a*p/g,u.b*p/y,u.c*m/g,u.d*m/y,u.tx/g,u.ty/y),ka.invert(),d?ka.prepend(h.mapCoord):(f.uniforms.uMapCoord=h.mapCoord.toArray(!0),f.uniforms.uClampFrame=h.uClampFrame,f.uniforms.uClampOffset=h.uClampOffset),f.uniforms.uTransform=ka.toArray(!0),f.uniforms.uColor=qe.shared.setValue(e.tint).premultiply(e.worldAlpha,c).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,t.shader.bind(f),t.geometry.bind(r),this.state.blendMode=Pf(e.blendMode,c),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Dp.extension={name:"tilingSprite",type:pe.RendererPlugin};_e.add(Dp);const Tn=class{constructor(i,e,t=null){this.linkedSheets=[],this._texture=i instanceof ie?i:null,this.baseTexture=i instanceof Me?i:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const r=this.baseTexture.resource;this.resolution=this._updateResolution(t||(r?r.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(i=null){const{scale:e}=this.data.meta;let t=Sr(i,null);return t===null&&(t=parseFloat(e??"1")),t!==1&&this.baseTexture.setResolution(t),t}parse(){return new Promise(i=>{this._callback=i,this._batchIndex=0,this._frameKeys.length<=Tn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(i){let e=i;const t=Tn.BATCH_SIZE;for(;e-i{this._batchIndex*Tn.BATCH_SIZE{r[s]=e}),Object.keys(e.textures).forEach(s=>{r[s]=e.textures[s]}),!t){const s=Rt.dirname(i[0]);e.linkedSheets.forEach((n,a)=>{const o=Lp([`${s}/${e.data.meta.related_multi_packs[a]}`],n,!0);Object.assign(r,o)})}return r}const b_={extension:pe.Asset,cache:{test:i=>i instanceof Sh,getCacheableAssets:(i,e)=>Lp(i,e,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),r=t.pop(),s=t.pop();return r==="json"&&v_.includes(s)},parse:i=>{const e=i.split(".");return{resolution:parseFloat(fe.RETINA_PREFIX.exec(i)?.[1]??"1"),format:e[e.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:pe.LoadParser,priority:Vi.Normal},async testParse(i,e){return Rt.extname(e.src).toLowerCase()===".json"&&!!i.frames},async parse(i,e,t){let r=Rt.dirname(e.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");let s=r+i.meta.image;s=xh(s,e.src);const a=(await t.load([s]))[s],o=new Sh(a.baseTexture,i,e.src);await o.parse();const l=i?.meta?.related_multi_packs;if(Array.isArray(l)){const c=[];for(const h of l){if(typeof h!="string")continue;let d=r+h;e.data?.ignoreMultiPack||(d=xh(d,e.src),c.push(t.load({src:d,data:{ignoreMultiPack:!0}})))}const u=await Promise.all(c);o.linkedSheets=u,u.forEach(h=>{h.linkedSheets=[o].concat(o.linkedSheets.filter(d=>d!==h))})}return o},unload(i){i.destroy(!0)}}};_e.add(b_);class fo{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Xa{static test(e){return typeof e=="string"&&e.startsWith("info face=")}static parse(e){const t=e.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in t){const a=t[n].match(/^[a-z]+/gm)[0],o=t[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),l={};for(const c in o){const u=o[c].split("="),h=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;l[h]=p}r[a].push(l)}const s=new fo;return r.info.forEach(n=>s.info.push({face:n.face,size:parseInt(n.size,10)})),r.common.forEach(n=>s.common.push({lineHeight:parseInt(n.lineHeight,10)})),r.page.forEach(n=>s.page.push({id:parseInt(n.id,10),file:n.file})),r.char.forEach(n=>s.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),r.kerning.forEach(n=>s.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),r.distanceField.forEach(n=>s.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),s}}class Ch{static test(e){const t=e;return"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(e){const t=new fo,r=e.getElementsByTagName("info"),s=e.getElementsByTagName("common"),n=e.getElementsByTagName("page"),a=e.getElementsByTagName("char"),o=e.getElementsByTagName("kerning"),l=e.getElementsByTagName("distanceField");for(let c=0;c")?Ch.test(fe.ADAPTER.parseXML(e)):!1}static parse(e){return Ch.parse(fe.ADAPTER.parseXML(e))}}const Il=[Xa,Ch,Mh];function w_(i){for(let e=0;e=o-P*n){if(p===0)throw new Error(`[BitmapFont] textureHeight ${o}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${I}')`);--E,m=null,g=null,y=null,p=0,f=0,b=0;continue}if(b=Math.max(P+S.fontProperties.descent,b),L*n+f>=h){if(f===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${I}')`);--E,p+=b*n,p=Math.ceil(p),f=0,b=0;continue}x_(m,g,S,f,p,n,u);const W=Ya(S.text);d.char.push({id:W,page:_.length-1,x:f/n,y:p/n,width:L,height:P,xoffset:0,yoffset:0,xadvance:R-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),f+=(L+2*s)*n,f=Math.ceil(f)}for(let E=0,I=c.length;E1?Ut.from(p_,f_,t):Ut.from(su,m_,t)}render(e){const t=this.renderer,r=this.quad;let s=r.vertices;s[0]=s[6]=e._width*-e.anchor.x,s[1]=s[3]=e._height*-e.anchor.y,s[2]=s[4]=e._width*(1-e.anchor.x),s[5]=s[7]=e._height*(1-e.anchor.y);const n=e.uvRespectAnchor?e.anchor.x:0,a=e.uvRespectAnchor?e.anchor.y:0;s=r.uvs,s[0]=s[6]=-n,s[1]=s[3]=-a,s[2]=s[4]=1-n,s[5]=s[7]=1-a,r.invalidate();const o=e._texture,l=o.baseTexture,c=l.alphaMode>0,u=e.tileTransform.localTransform,h=e.uvMatrix;let d=l.isPowerOfTwo&&o.frame.width===l.width&&o.frame.height===l.height;d&&(l._glTextures[t.CONTEXT_UID]?d=l.wrapMode!==Ar.CLAMP:l.wrapMode===Ar.CLAMP&&(l.wrapMode=Ar.REPEAT));const f=d?this.simpleShader:this.shader,p=o.width,m=o.height,g=e._width,y=e._height;Ia.set(u.a*p/g,u.b*p/y,u.c*m/g,u.d*m/y,u.tx/g,u.ty/y),Ia.invert(),d?Ia.prepend(h.mapCoord):(f.uniforms.uMapCoord=h.mapCoord.toArray(!0),f.uniforms.uClampFrame=h.uClampFrame,f.uniforms.uClampOffset=h.uClampOffset),f.uniforms.uTransform=Ia.toArray(!0),f.uniforms.uColor=Ke.shared.setValue(e.tint).premultiply(e.worldAlpha,c).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,t.shader.bind(f),t.geometry.bind(r),this.state.blendMode=If(e.blendMode,c),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}}Rp.extension={name:"tilingSprite",type:pe.RendererPlugin};_e.add(Rp);const Sn=class{constructor(i,e,t=null){this.linkedSheets=[],this._texture=i instanceof ie?i:null,this.baseTexture=i instanceof Me?i:this._texture.baseTexture,this.textures={},this.animations={},this.data=e;const r=this.baseTexture.resource;this.resolution=this._updateResolution(t||(r?r.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(i=null){const{scale:e}=this.data.meta;let t=Sr(i,null);return t===null&&(t=parseFloat(e??"1")),t!==1&&this.baseTexture.setResolution(t),t}parse(){return new Promise(i=>{this._callback=i,this._batchIndex=0,this._frameKeys.length<=Sn.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(i){let e=i;const t=Sn.BATCH_SIZE;for(;e-i{this._batchIndex*Sn.BATCH_SIZE{r[s]=e}),Object.keys(e.textures).forEach(s=>{r[s]=e.textures[s]}),!t){const s=Rt.dirname(i[0]);e.linkedSheets.forEach((n,a)=>{const o=Dp([`${s}/${e.data.meta.related_multi_packs[a]}`],n,!0);Object.assign(r,o)})}return r}const v_={extension:pe.Asset,cache:{test:i=>i instanceof Mh,getCacheableAssets:(i,e)=>Dp(i,e,!1)},resolver:{test:i=>{const t=i.split("?")[0].split("."),r=t.pop(),s=t.pop();return r==="json"&&y_.includes(s)},parse:i=>{const e=i.split(".");return{resolution:parseFloat(fe.RETINA_PREFIX.exec(i)?.[1]??"1"),format:e[e.length-2],src:i}}},loader:{name:"spritesheetLoader",extension:{type:pe.LoadParser,priority:Vi.Normal},async testParse(i,e){return Rt.extname(e.src).toLowerCase()===".json"&&!!i.frames},async parse(i,e,t){let r=Rt.dirname(e.src);r&&r.lastIndexOf("/")!==r.length-1&&(r+="/");let s=r+i.meta.image;s=Eh(s,e.src);const a=(await t.load([s]))[s],o=new Mh(a.baseTexture,i,e.src);await o.parse();const l=i?.meta?.related_multi_packs;if(Array.isArray(l)){const c=[];for(const h of l){if(typeof h!="string")continue;let d=r+h;e.data?.ignoreMultiPack||(d=Eh(d,e.src),c.push(t.load({src:d,data:{ignoreMultiPack:!0}})))}const u=await Promise.all(c);o.linkedSheets=u,u.forEach(h=>{h.linkedSheets=[o].concat(o.linkedSheets.filter(d=>d!==h))})}return o},unload(i){i.destroy(!0)}}};_e.add(v_);class po{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}}class Ya{static test(e){return typeof e=="string"&&e.startsWith("info face=")}static parse(e){const t=e.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const n in t){const a=t[n].match(/^[a-z]+/gm)[0],o=t[n].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),l={};for(const c in o){const u=o[c].split("="),h=u[0],d=u[1].replace(/"/gm,""),f=parseFloat(d),p=isNaN(f)?d:f;l[h]=p}r[a].push(l)}const s=new po;return r.info.forEach(n=>s.info.push({face:n.face,size:parseInt(n.size,10)})),r.common.forEach(n=>s.common.push({lineHeight:parseInt(n.lineHeight,10)})),r.page.forEach(n=>s.page.push({id:parseInt(n.id,10),file:n.file})),r.char.forEach(n=>s.char.push({id:parseInt(n.id,10),page:parseInt(n.page,10),x:parseInt(n.x,10),y:parseInt(n.y,10),width:parseInt(n.width,10),height:parseInt(n.height,10),xoffset:parseInt(n.xoffset,10),yoffset:parseInt(n.yoffset,10),xadvance:parseInt(n.xadvance,10)})),r.kerning.forEach(n=>s.kerning.push({first:parseInt(n.first,10),second:parseInt(n.second,10),amount:parseInt(n.amount,10)})),r.distanceField.forEach(n=>s.distanceField.push({distanceRange:parseInt(n.distanceRange,10),fieldType:n.fieldType})),s}}class kh{static test(e){const t=e;return"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null}static parse(e){const t=new po,r=e.getElementsByTagName("info"),s=e.getElementsByTagName("common"),n=e.getElementsByTagName("page"),a=e.getElementsByTagName("char"),o=e.getElementsByTagName("kerning"),l=e.getElementsByTagName("distanceField");for(let c=0;c")?kh.test(fe.ADAPTER.parseXML(e)):!1}static parse(e){return kh.parse(fe.ADAPTER.parseXML(e))}}const Bl=[Ya,kh,Ih];function b_(i){for(let e=0;e=o-k*n){if(p===0)throw new Error(`[BitmapFont] textureHeight ${o}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${S}')`);--E,m=null,g=null,y=null,p=0,f=0,b=0;continue}if(b=Math.max(k+T.fontProperties.descent,b),D*n+f>=h){if(f===0)throw new Error(`[BitmapFont] textureWidth ${a}px is too small (fontFamily: '${u.fontFamily}', fontSize: ${u.fontSize}px, char: '${S}')`);--E,p+=b*n,p=Math.ceil(p),f=0,b=0;continue}__(m,g,T,f,p,n,u);const W=$a(T.text);d.char.push({id:W,page:w.length-1,x:f/n,y:p/n,width:D,height:k,xoffset:0,yoffset:0,xadvance:B-(u.dropShadow?u.dropShadowDistance:0)-(u.stroke?u.strokeThickness:0)}),f+=(D+2*s)*n,f=Math.ceil(f)}for(let E=0,S=c.length;E{this.dirty=!0},this,0,0),this._roundPixels=fe.ROUND_PIXELS,this.dirty=!0,this._resolution=fe.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){const i=Bt.available[this._fontName],e=this.fontSize,t=e/i.size,r=new ze,s=[],n=[],a=[],o=this._text.replace(/(?:\r\n|\r)/g,` -`)||" ",l=Op(o),c=this._maxWidth*i.size/e,u=i.distanceFieldType==="none"?nu:au;let h=null,d=0,f=0,p=0,m=-1,g=0,y=0,b=0,_=0;for(let L=0;L0&&r.x>c&&(++y,Hs(s,1+m-y,1+L-m),L=m,m=-1,n.push(g),a.push(s.length>0?s[s.length-1].prevSpaces:0),f=Math.max(f,g),p++,r.x=0,r.y+=i.lineHeight,h=null,_=0)}const v=l[l.length-1];v!=="\r"&&v!==` -`&&(/(?:\s)/.test(v)&&(d=g),n.push(d),f=Math.max(f,d),a.push(-1));const E=[];for(let L=0;L<=p;L++){let W=0;this._align==="right"?W=f-n[L]:this._align==="center"?W=(f-n[L])/2:this._align==="justify"&&(W=a[L]<0?0:(f-n[L])/a[L]),E.push(W)}const I=s.length,S={},R=[],P=this._activePagesMeshData;u.push(...P);for(let L=0;L6*T)||W.vertices.lengthe[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=ie.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(i)}};let Fe=Fp;Fe.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const S_=[".xml",".fnt"],C_={extension:{type:pe.LoadParser,priority:Vi.Normal},name:"loadBitmapFont",test(i){return S_.includes(Rt.extname(i).toLowerCase())},async testParse(i){return Xa.test(i)||Mh.test(i)},async parse(i,e,t){const r=Xa.test(i)?Xa.parse(i):Mh.parse(i),{src:s}=e,{page:n}=r,a=[];for(let c=0;co[c]);return Bt.install(r,l,!0)},async load(i,e){return(await fe.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};_e.add(C_);const Es=class extends Ji{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(i){return new Es(Object.keys(Es.defaultOptions).reduce((e,t)=>({...e,[t]:i[t]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(i=>{URL.revokeObjectURL(i.src),i.refs--,i.refs===0&&(i.fontFace&&document.fonts.delete(i.fontFace),delete Es.availableFonts[i.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(i,e={}){const{availableFonts:t}=Es;if(t[i]){const r=t[i];return this._fonts.push(r),r.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return fe.ADAPTER.fetch(i).then(r=>r.blob()).then(async r=>new Promise((s,n)=>{const a=URL.createObjectURL(r),o=new FileReader;o.onload=()=>s([a,o.result]),o.onerror=n,o.readAsDataURL(r)})).then(async([r,s])=>{const n=Object.assign({family:Rt.basename(i,Rt.extname(i)),weight:"normal",style:"normal",src:r,dataSrc:s,refs:1,originalUrl:i,fontFace:null},e);t[i]=n,this._fonts.push(n),this.styleID++;const a=new FontFace(n.family,`url(${n.src})`,{weight:n.weight,style:n.style});n.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...i){const e=i.filter(t=>!this._overrides.includes(t));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...i){const e=i.filter(t=>this._overrides.includes(t));e.length>0&&(this._overrides=this._overrides.filter(t=>!e.includes(t)),this.styleID++)}toCSS(i){return[`transform: scale(${i})`,"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((i,e)=>`${i} +`;const nu=[],au=[],ou=[],Op=class extends xe{constructor(i,e={}){super();const{align:t,tint:r,maxWidth:s,letterSpacing:n,fontName:a,fontSize:o}=Object.assign({},Op.styleDefaults,e);if(!Bt.available[a])throw new Error(`Missing BitmapFont "${a}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=t,this._tintColor=new Ke(r),this._font=void 0,this._fontName=a,this._fontSize=o,this.text=i,this._maxWidth=s,this._maxLineHeight=0,this._letterSpacing=n,this._anchor=new _r(()=>{this.dirty=!0},this,0,0),this._roundPixels=fe.ROUND_PIXELS,this.dirty=!0,this._resolution=fe.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){const i=Bt.available[this._fontName],e=this.fontSize,t=e/i.size,r=new ze,s=[],n=[],a=[],o=this._text.replace(/(?:\r\n|\r)/g,` +`)||" ",l=Lp(o),c=this._maxWidth*i.size/e,u=i.distanceFieldType==="none"?nu:au;let h=null,d=0,f=0,p=0,m=-1,g=0,y=0,b=0,w=0;for(let D=0;D0&&r.x>c&&(++y,Gs(s,1+m-y,1+D-m),D=m,m=-1,n.push(g),a.push(s.length>0?s[s.length-1].prevSpaces:0),f=Math.max(f,g),p++,r.x=0,r.y+=i.lineHeight,h=null,w=0)}const v=l[l.length-1];v!=="\r"&&v!==` +`&&(/(?:\s)/.test(v)&&(d=g),n.push(d),f=Math.max(f,d),a.push(-1));const E=[];for(let D=0;D<=p;D++){let W=0;this._align==="right"?W=f-n[D]:this._align==="center"?W=(f-n[D])/2:this._align==="justify"&&(W=a[D]<0?0:(f-n[D])/a[D]),E.push(W)}const S=s.length,T={},B=[],k=this._activePagesMeshData;u.push(...k);for(let D=0;D6*C)||W.vertices.lengthe[s.mesh.texture.baseTexture.uid]).forEach(s=>{s.mesh.texture=ie.EMPTY});for(const s in e)e[s].destroy(),delete e[s];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(i)}};let Fe=Op;Fe.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0};const T_=[".xml",".fnt"],S_={extension:{type:pe.LoadParser,priority:Vi.Normal},name:"loadBitmapFont",test(i){return T_.includes(Rt.extname(i).toLowerCase())},async testParse(i){return Ya.test(i)||Ih.test(i)},async parse(i,e,t){const r=Ya.test(i)?Ya.parse(i):Ih.parse(i),{src:s}=e,{page:n}=r,a=[];for(let c=0;co[c]);return Bt.install(r,l,!0)},async load(i,e){return(await fe.ADAPTER.fetch(i)).text()},unload(i){i.destroy()}};_e.add(S_);const Ss=class extends Ji{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet="",this.fontsDirty=!1}static from(i){return new Ss(Object.keys(Ss.defaultOptions).reduce((e,t)=>({...e,[t]:i[t]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(i=>{URL.revokeObjectURL(i.src),i.refs--,i.refs===0&&(i.fontFace&&document.fonts.delete(i.fontFace),delete Ss.availableFonts[i.originalUrl])}),this.fontFamily="Arial",this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(i,e={}){const{availableFonts:t}=Ss;if(t[i]){const r=t[i];return this._fonts.push(r),r.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return fe.ADAPTER.fetch(i).then(r=>r.blob()).then(async r=>new Promise((s,n)=>{const a=URL.createObjectURL(r),o=new FileReader;o.onload=()=>s([a,o.result]),o.onerror=n,o.readAsDataURL(r)})).then(async([r,s])=>{const n=Object.assign({family:Rt.basename(i,Rt.extname(i)),weight:"normal",style:"normal",src:r,dataSrc:s,refs:1,originalUrl:i,fontFace:null},e);t[i]=n,this._fonts.push(n),this.styleID++;const a=new FontFace(n.family,`url(${n.src})`,{weight:n.weight,style:n.style});n.fontFace=a,await a.load(),document.fonts.add(a),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...i){const e=i.filter(t=>!this._overrides.includes(t));e.length>0&&(this._overrides.push(...e),this.styleID++)}removeOverride(...i){const e=i.filter(t=>this._overrides.includes(t));e.length>0&&(this._overrides=this._overrides.filter(t=>!e.includes(t)),this.styleID++)}toCSS(i){return[`transform: scale(${i})`,"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((i,e)=>`${i} @font-face { font-family: "${e.family}"; src: url('${e.dataSrc}'); font-weight: ${e.weight}; font-style: ${e.style}; - }`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(i){this._stylesheet!==i&&(this._stylesheet=i,this.styleID++)}normalizeColor(i){return Array.isArray(i)&&(i=kv(i)),typeof i=="number"?Mv(i):i}dropShadowToCSS(){let i=this.normalizeColor(this.dropShadowColor);const e=this.dropShadowAlpha,t=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);i.startsWith("#")&&e<1&&(i+=(e*255|0).toString(16).padStart(2,"0"));const s=`${t}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${s} ${this.dropShadowBlur}px ${i}`:`text-shadow: ${s} ${i}`}reset(){Object.assign(this,Es.defaultOptions)}onBeforeDraw(){const{fontsDirty:i}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&i?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:i}=fe.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}set fillGradientStops(i){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(i){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(i){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(i){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(i){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(i){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(i){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};let Dn=Es;Dn.availableFonts={};Dn.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};const Ts=class extends Pe{constructor(i="",e={}){super(ie.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this._loading=!1,this.localStyleID=-1,this.dirty=!1,this.ownsStyle=!1;const t=new Image,r=ie.from(t,{scaleMode:fe.SCALE_MODE,resourceOptions:{autoLoad:!1}});r.orig=new Ie,r.trim=new Ie,this.texture=r;const s="http://www.w3.org/2000/svg",n="http://www.w3.org/1999/xhtml",a=document.createElementNS(s,"svg"),o=document.createElementNS(s,"foreignObject"),l=document.createElementNS(n,"div"),c=document.createElementNS(n,"style");o.setAttribute("width","10000"),o.setAttribute("height","10000"),o.style.overflow="hidden",a.appendChild(o),this.maxWidth=Ts.defaultMaxWidth,this.maxHeight=Ts.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=a,this._foreignObject=o,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=t,this._loadImage=new Image,this._autoResolution=Ts.defaultAutoResolution,this._resolution=Ts.defaultResolution??fe.RESOLUTION,this.text=i,this.style=e}measureText(i){const{text:e,style:t,resolution:r}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},i);Object.assign(this._domElement,{innerHTML:e,style:t.toCSS(r)}),this._styleElement.textContent=t.toGlobalCSS(),document.body.appendChild(this._svgRoot);const s=this._domElement.getBoundingClientRect();this._svgRoot.remove();const n=Math.min(this.maxWidth,Math.ceil(s.width)),a=Math.min(this.maxHeight,Math.ceil(s.height));return this._svgRoot.setAttribute("width",n.toString()),this._svgRoot.setAttribute("height",a.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),t!==this._style&&(Object.assign(this._domElement,{style:this._style?.toCSS(r)}),this._styleElement.textContent=this._style?.toGlobalCSS()),{width:n+t.padding*2,height:a+t.padding*2}}async updateText(i=!0){const{style:e,_image:t,_loadImage:r}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&i)return;const{width:s,height:n}=this.measureText();t.width=r.width=Math.ceil(Math.max(1,s)),t.height=r.height=Math.ceil(Math.max(1,n)),this._loading||(this._loading=!0,await new Promise(a=>{r.onload=async()=>{await e.onBeforeDraw(),this._loading=!1,t.src=r.src,r.onload=null,r.src="",this.updateTexture(),a()};const o=new XMLSerializer().serializeToString(this._svgRoot);r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(o)}`}))}get source(){return this._image}updateTexture(){const{style:i,texture:e,_image:t,resolution:r}=this,{padding:s}=i,{baseTexture:n}=e;e.trim.width=e._frame.width=t.width/r,e.trim.height=e._frame.height=t.height/r,e.trim.x=-s,e.trim.y=-s,e.orig.width=e._frame.width-s*2,e.orig.height=e._frame.height-s*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,r),this.dirty=!1}_render(i){this._autoResolution&&this._resolution!==i.resolution&&(this._resolution=i.resolution,this.dirty=!0),this.updateText(!0),super._render(i)}_renderCanvas(i){this._autoResolution&&this._resolution!==i.resolution&&(this._resolution=i.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(i)}getLocalBounds(i){return this.updateText(!0),super.getLocalBounds(i)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(i){typeof i=="boolean"&&(i={children:i}),i=Object.assign({},Ts.defaultDestroyOptions,i),super.destroy(i);const e=null;this.ownsStyle&&this._style?.cleanFonts(),this._style=e,this._svgRoot?.remove(),this._svgRoot=e,this._domElement?.remove(),this._domElement=e,this._foreignObject?.remove(),this._foreignObject=e,this._styleElement?.remove(),this._styleElement=e,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=e,this._image.src="",this._image=e}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(i){this.updateText(!0);const e=wr(this.scale.x)||1;this.scale.x=e*i/this._image.width/this.resolution,this._width=i}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(i){this.updateText(!0);const e=wr(this.scale.y)||1;this.scale.y=e*i/this._image.height/this.resolution,this._height=i}get style(){return this._style}set style(i){this._style!==i&&(i=i||{},i instanceof Dn?(this.ownsStyle=!1,this._style=i):i instanceof Ji?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Dn.from(i)):(this.ownsStyle=!0,this._style=new Dn(i)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(i){i=String(i===""||i===null||i===void 0?" ":i),i=this.sanitiseText(i),this._text!==i&&(this._text=i,this.dirty=!0)}get resolution(){return this._resolution}set resolution(i){this._autoResolution=!1,this._resolution!==i&&(this._resolution=i,this.dirty=!0)}sanitiseText(i){return i.replace(/

/gi,"
").replace(/
/gi,"
").replace(/ /gi," ")}};let Ro=Ts;Ro.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0};Ro.defaultMaxWidth=2024;Ro.defaultMaxHeight=2024;Ro.defaultAutoResolution=!0;var Gt="top",oi="bottom",li="right",Wt="left",dc="auto",ta=[Gt,oi,li,Wt],Ks="start",Xn="end",M_="clippingParents",Np="viewport",bn="popper",k_="reference",lu=ta.reduce(function(i,e){return i.concat([e+"-"+Ks,e+"-"+Xn])},[]),Up=[].concat(ta,[dc]).reduce(function(i,e){return i.concat([e,e+"-"+Ks,e+"-"+Xn])},[]),I_="beforeRead",P_="read",B_="afterRead",R_="beforeMain",D_="main",L_="afterMain",O_="beforeWrite",F_="write",N_="afterWrite",U_=[I_,P_,B_,R_,D_,L_,O_,F_,N_];function zi(i){return i?(i.nodeName||"").toLowerCase():null}function $t(i){if(i==null)return window;if(i.toString()!=="[object Window]"){var e=i.ownerDocument;return e&&e.defaultView||window}return i}function ss(i){var e=$t(i).Element;return i instanceof e||i instanceof Element}function ai(i){var e=$t(i).HTMLElement;return i instanceof e||i instanceof HTMLElement}function uc(i){if(typeof ShadowRoot>"u")return!1;var e=$t(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function H_(i){var e=i.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},s=e.attributes[t]||{},n=e.elements[t];!ai(n)||!zi(n)||(Object.assign(n.style,r),Object.keys(s).forEach(function(a){var o=s[a];o===!1?n.removeAttribute(a):n.setAttribute(a,o===!0?"":o)}))})}function G_(i){var e=i.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var s=e.elements[r],n=e.attributes[r]||{},a=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),o=a.reduce(function(l,c){return l[c]="",l},{});!ai(s)||!zi(s)||(Object.assign(s.style,o),Object.keys(n).forEach(function(l){s.removeAttribute(l)}))})}}const Hp={name:"applyStyles",enabled:!0,phase:"write",fn:H_,effect:G_,requires:["computeStyles"]};function Hi(i){return i.split("-")[0]}var Qr=Math.max,po=Math.min,$s=Math.round;function kh(){var i=navigator.userAgentData;return i!=null&&i.brands&&Array.isArray(i.brands)?i.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Gp(){return!/^((?!chrome|android).)*safari/i.test(kh())}function qs(i,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=i.getBoundingClientRect(),s=1,n=1;e&&ai(i)&&(s=i.offsetWidth>0&&$s(r.width)/i.offsetWidth||1,n=i.offsetHeight>0&&$s(r.height)/i.offsetHeight||1);var a=ss(i)?$t(i):window,o=a.visualViewport,l=!Gp()&&t,c=(r.left+(l&&o?o.offsetLeft:0))/s,u=(r.top+(l&&o?o.offsetTop:0))/n,h=r.width/s,d=r.height/n;return{width:h,height:d,top:u,right:c+h,bottom:u+d,left:c,x:c,y:u}}function fc(i){var e=qs(i),t=i.offsetWidth,r=i.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:i.offsetLeft,y:i.offsetTop,width:t,height:r}}function Wp(i,e){var t=e.getRootNode&&e.getRootNode();if(i.contains(e))return!0;if(t&&uc(t)){var r=e;do{if(r&&i.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function er(i){return $t(i).getComputedStyle(i)}function W_(i){return["table","td","th"].indexOf(zi(i))>=0}function Br(i){return((ss(i)?i.ownerDocument:i.document)||window.document).documentElement}function Do(i){return zi(i)==="html"?i:i.assignedSlot||i.parentNode||(uc(i)?i.host:null)||Br(i)}function hu(i){return!ai(i)||er(i).position==="fixed"?null:i.offsetParent}function z_(i){var e=/firefox/i.test(kh()),t=/Trident/i.test(kh());if(t&&ai(i)){var r=er(i);if(r.position==="fixed")return null}var s=Do(i);for(uc(s)&&(s=s.host);ai(s)&&["html","body"].indexOf(zi(s))<0;){var n=er(s);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return s;s=s.parentNode}return null}function ia(i){for(var e=$t(i),t=hu(i);t&&W_(t)&&er(t).position==="static";)t=hu(t);return t&&(zi(t)==="html"||zi(t)==="body"&&er(t).position==="static")?e:t||z_(i)||e}function pc(i){return["top","bottom"].indexOf(i)>=0?"x":"y"}function Ln(i,e,t){return Qr(i,po(e,t))}function V_(i,e,t){var r=Ln(i,e,t);return r>t?t:r}function zp(){return{top:0,right:0,bottom:0,left:0}}function Vp(i){return Object.assign({},zp(),i)}function jp(i,e){return e.reduce(function(t,r){return t[r]=i,t},{})}var j_=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,Vp(typeof e!="number"?e:jp(e,ta))};function X_(i){var e,t=i.state,r=i.name,s=i.options,n=t.elements.arrow,a=t.modifiersData.popperOffsets,o=Hi(t.placement),l=pc(o),c=[Wt,li].indexOf(o)>=0,u=c?"height":"width";if(!(!n||!a)){var h=j_(s.padding,t),d=fc(n),f=l==="y"?Gt:Wt,p=l==="y"?oi:li,m=t.rects.reference[u]+t.rects.reference[l]-a[l]-t.rects.popper[u],g=a[l]-t.rects.reference[l],y=ia(n),b=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,_=m/2-g/2,v=h[f],E=b-d[u]-h[p],I=b/2-d[u]/2+_,S=Ln(v,I,E),R=l;t.modifiersData[r]=(e={},e[R]=S,e.centerOffset=S-I,e)}}function Y_(i){var e=i.state,t=i.options,r=t.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||Wp(e.elements.popper,s)&&(e.elements.arrow=s))}const K_={name:"arrow",enabled:!0,phase:"main",fn:X_,effect:Y_,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Qs(i){return i.split("-")[1]}var $_={top:"auto",right:"auto",bottom:"auto",left:"auto"};function q_(i,e){var t=i.x,r=i.y,s=e.devicePixelRatio||1;return{x:$s(t*s)/s||0,y:$s(r*s)/s||0}}function cu(i){var e,t=i.popper,r=i.popperRect,s=i.placement,n=i.variation,a=i.offsets,o=i.position,l=i.gpuAcceleration,c=i.adaptive,u=i.roundOffsets,h=i.isFixed,d=a.x,f=d===void 0?0:d,p=a.y,m=p===void 0?0:p,g=typeof u=="function"?u({x:f,y:m}):{x:f,y:m};f=g.x,m=g.y;var y=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),_=Wt,v=Gt,E=window;if(c){var I=ia(t),S="clientHeight",R="clientWidth";if(I===$t(t)&&(I=Br(t),er(I).position!=="static"&&o==="absolute"&&(S="scrollHeight",R="scrollWidth")),I=I,s===Gt||(s===Wt||s===li)&&n===Xn){v=oi;var P=h&&I===E&&E.visualViewport?E.visualViewport.height:I[S];m-=P-r.height,m*=l?1:-1}if(s===Wt||(s===Gt||s===oi)&&n===Xn){_=li;var L=h&&I===E&&E.visualViewport?E.visualViewport.width:I[R];f-=L-r.width,f*=l?1:-1}}var W=Object.assign({position:o},c&&$_),T=u===!0?q_({x:f,y:m},$t(t)):{x:f,y:m};if(f=T.x,m=T.y,l){var C;return Object.assign({},W,(C={},C[v]=b?"0":"",C[_]=y?"0":"",C.transform=(E.devicePixelRatio||1)<=1?"translate("+f+"px, "+m+"px)":"translate3d("+f+"px, "+m+"px, 0)",C))}return Object.assign({},W,(e={},e[v]=b?m+"px":"",e[_]=y?f+"px":"",e.transform="",e))}function Q_(i){var e=i.state,t=i.options,r=t.gpuAcceleration,s=r===void 0?!0:r,n=t.adaptive,a=n===void 0?!0:n,o=t.roundOffsets,l=o===void 0?!0:o,c={placement:Hi(e.placement),variation:Qs(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,cu(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,cu(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Z_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Q_,data:{}};var Ia={passive:!0};function J_(i){var e=i.state,t=i.instance,r=i.options,s=r.scroll,n=s===void 0?!0:s,a=r.resize,o=a===void 0?!0:a,l=$t(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&c.forEach(function(u){u.addEventListener("scroll",t.update,Ia)}),o&&l.addEventListener("resize",t.update,Ia),function(){n&&c.forEach(function(u){u.removeEventListener("scroll",t.update,Ia)}),o&&l.removeEventListener("resize",t.update,Ia)}}const ex={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:J_,data:{}};var tx={left:"right",right:"left",bottom:"top",top:"bottom"};function Ka(i){return i.replace(/left|right|bottom|top/g,function(e){return tx[e]})}var ix={start:"end",end:"start"};function du(i){return i.replace(/start|end/g,function(e){return ix[e]})}function mc(i){var e=$t(i),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function gc(i){return qs(Br(i)).left+mc(i).scrollLeft}function rx(i,e){var t=$t(i),r=Br(i),s=t.visualViewport,n=r.clientWidth,a=r.clientHeight,o=0,l=0;if(s){n=s.width,a=s.height;var c=Gp();(c||!c&&e==="fixed")&&(o=s.offsetLeft,l=s.offsetTop)}return{width:n,height:a,x:o+gc(i),y:l}}function sx(i){var e,t=Br(i),r=mc(i),s=(e=i.ownerDocument)==null?void 0:e.body,n=Qr(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),a=Qr(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),o=-r.scrollLeft+gc(i),l=-r.scrollTop;return er(s||t).direction==="rtl"&&(o+=Qr(t.clientWidth,s?s.clientWidth:0)-n),{width:n,height:a,x:o,y:l}}function yc(i){var e=er(i),t=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+r)}function Xp(i){return["html","body","#document"].indexOf(zi(i))>=0?i.ownerDocument.body:ai(i)&&yc(i)?i:Xp(Do(i))}function On(i,e){var t;e===void 0&&(e=[]);var r=Xp(i),s=r===((t=i.ownerDocument)==null?void 0:t.body),n=$t(r),a=s?[n].concat(n.visualViewport||[],yc(r)?r:[]):r,o=e.concat(a);return s?o:o.concat(On(Do(a)))}function Ih(i){return Object.assign({},i,{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height})}function nx(i,e){var t=qs(i,!1,e==="fixed");return t.top=t.top+i.clientTop,t.left=t.left+i.clientLeft,t.bottom=t.top+i.clientHeight,t.right=t.left+i.clientWidth,t.width=i.clientWidth,t.height=i.clientHeight,t.x=t.left,t.y=t.top,t}function uu(i,e,t){return e===Np?Ih(rx(i,t)):ss(e)?nx(e,t):Ih(sx(Br(i)))}function ax(i){var e=On(Do(i)),t=["absolute","fixed"].indexOf(er(i).position)>=0,r=t&&ai(i)?ia(i):i;return ss(r)?e.filter(function(s){return ss(s)&&Wp(s,r)&&zi(s)!=="body"}):[]}function ox(i,e,t,r){var s=e==="clippingParents"?ax(i):[].concat(e),n=[].concat(s,[t]),a=n[0],o=n.reduce(function(l,c){var u=uu(i,c,r);return l.top=Qr(u.top,l.top),l.right=po(u.right,l.right),l.bottom=po(u.bottom,l.bottom),l.left=Qr(u.left,l.left),l},uu(i,a,r));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function Yp(i){var e=i.reference,t=i.element,r=i.placement,s=r?Hi(r):null,n=r?Qs(r):null,a=e.x+e.width/2-t.width/2,o=e.y+e.height/2-t.height/2,l;switch(s){case Gt:l={x:a,y:e.y-t.height};break;case oi:l={x:a,y:e.y+e.height};break;case li:l={x:e.x+e.width,y:o};break;case Wt:l={x:e.x-t.width,y:o};break;default:l={x:e.x,y:e.y}}var c=s?pc(s):null;if(c!=null){var u=c==="y"?"height":"width";switch(n){case Ks:l[c]=l[c]-(e[u]/2-t[u]/2);break;case Xn:l[c]=l[c]+(e[u]/2-t[u]/2);break}}return l}function Yn(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=r===void 0?i.placement:r,n=t.strategy,a=n===void 0?i.strategy:n,o=t.boundary,l=o===void 0?M_:o,c=t.rootBoundary,u=c===void 0?Np:c,h=t.elementContext,d=h===void 0?bn:h,f=t.altBoundary,p=f===void 0?!1:f,m=t.padding,g=m===void 0?0:m,y=Vp(typeof g!="number"?g:jp(g,ta)),b=d===bn?k_:bn,_=i.rects.popper,v=i.elements[p?b:d],E=ox(ss(v)?v:v.contextElement||Br(i.elements.popper),l,u,a),I=qs(i.elements.reference),S=Yp({reference:I,element:_,strategy:"absolute",placement:s}),R=Ih(Object.assign({},_,S)),P=d===bn?R:I,L={top:E.top-P.top+y.top,bottom:P.bottom-E.bottom+y.bottom,left:E.left-P.left+y.left,right:P.right-E.right+y.right},W=i.modifiersData.offset;if(d===bn&&W){var T=W[s];Object.keys(L).forEach(function(C){var w=[li,oi].indexOf(C)>=0?1:-1,G=[Gt,oi].indexOf(C)>=0?"y":"x";L[C]+=T[G]*w})}return L}function lx(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=t.boundary,n=t.rootBoundary,a=t.padding,o=t.flipVariations,l=t.allowedAutoPlacements,c=l===void 0?Up:l,u=Qs(r),h=u?o?lu:lu.filter(function(p){return Qs(p)===u}):ta,d=h.filter(function(p){return c.indexOf(p)>=0});d.length===0&&(d=h);var f=d.reduce(function(p,m){return p[m]=Yn(i,{placement:m,boundary:s,rootBoundary:n,padding:a})[Hi(m)],p},{});return Object.keys(f).sort(function(p,m){return f[p]-f[m]})}function hx(i){if(Hi(i)===dc)return[];var e=Ka(i);return[du(i),e,du(e)]}function cx(i){var e=i.state,t=i.options,r=i.name;if(!e.modifiersData[r]._skip){for(var s=t.mainAxis,n=s===void 0?!0:s,a=t.altAxis,o=a===void 0?!0:a,l=t.fallbackPlacements,c=t.padding,u=t.boundary,h=t.rootBoundary,d=t.altBoundary,f=t.flipVariations,p=f===void 0?!0:f,m=t.allowedAutoPlacements,g=e.options.placement,y=Hi(g),b=y===g,_=l||(b||!p?[Ka(g)]:hx(g)),v=[g].concat(_).reduce(function(ee,Q){return ee.concat(Hi(Q)===dc?lx(e,{placement:Q,boundary:u,rootBoundary:h,padding:c,flipVariations:p,allowedAutoPlacements:m}):Q)},[]),E=e.rects.reference,I=e.rects.popper,S=new Map,R=!0,P=v[0],L=0;L=0,G=w?"width":"height",$=Yn(e,{placement:W,boundary:u,rootBoundary:h,altBoundary:d,padding:c}),z=w?C?li:Wt:C?oi:Gt;E[G]>I[G]&&(z=Ka(z));var ne=Ka(z),X=[];if(n&&X.push($[T]<=0),o&&X.push($[z]<=0,$[ne]<=0),X.every(function(ee){return ee})){P=W,R=!1;break}S.set(W,X)}if(R)for(var q=p?3:1,F=function(Q){var ge=v.find(function(Te){var me=S.get(Te);if(me)return me.slice(0,Q).every(function(be){return be})});if(ge)return P=ge,"break"},N=q;N>0;N--){var ae=F(N);if(ae==="break")break}e.placement!==P&&(e.modifiersData[r]._skip=!0,e.placement=P,e.reset=!0)}}const dx={name:"flip",enabled:!0,phase:"main",fn:cx,requiresIfExists:["offset"],data:{_skip:!1}};function fu(i,e,t){return t===void 0&&(t={x:0,y:0}),{top:i.top-e.height-t.y,right:i.right-e.width+t.x,bottom:i.bottom-e.height+t.y,left:i.left-e.width-t.x}}function pu(i){return[Gt,li,oi,Wt].some(function(e){return i[e]>=0})}function ux(i){var e=i.state,t=i.name,r=e.rects.reference,s=e.rects.popper,n=e.modifiersData.preventOverflow,a=Yn(e,{elementContext:"reference"}),o=Yn(e,{altBoundary:!0}),l=fu(a,r),c=fu(o,s,n),u=pu(l),h=pu(c);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":h})}const fx={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:ux};function px(i,e,t){var r=Hi(i),s=[Wt,Gt].indexOf(r)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:i})):t,a=n[0],o=n[1];return a=a||0,o=(o||0)*s,[Wt,li].indexOf(r)>=0?{x:o,y:a}:{x:a,y:o}}function mx(i){var e=i.state,t=i.options,r=i.name,s=t.offset,n=s===void 0?[0,0]:s,a=Up.reduce(function(u,h){return u[h]=px(h,e.rects,n),u},{}),o=a[e.placement],l=o.x,c=o.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=a}const gx={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:mx};function yx(i){var e=i.state,t=i.name;e.modifiersData[t]=Yp({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const vx={name:"popperOffsets",enabled:!0,phase:"read",fn:yx,data:{}};function bx(i){return i==="x"?"y":"x"}function wx(i){var e=i.state,t=i.options,r=i.name,s=t.mainAxis,n=s===void 0?!0:s,a=t.altAxis,o=a===void 0?!1:a,l=t.boundary,c=t.rootBoundary,u=t.altBoundary,h=t.padding,d=t.tether,f=d===void 0?!0:d,p=t.tetherOffset,m=p===void 0?0:p,g=Yn(e,{boundary:l,rootBoundary:c,padding:h,altBoundary:u}),y=Hi(e.placement),b=Qs(e.placement),_=!b,v=pc(y),E=bx(v),I=e.modifiersData.popperOffsets,S=e.rects.reference,R=e.rects.popper,P=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,L=typeof P=="number"?{mainAxis:P,altAxis:P}:Object.assign({mainAxis:0,altAxis:0},P),W=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,T={x:0,y:0};if(I){if(n){var C,w=v==="y"?Gt:Wt,G=v==="y"?oi:li,$=v==="y"?"height":"width",z=I[v],ne=z+g[w],X=z-g[G],q=f?-R[$]/2:0,F=b===Ks?S[$]:R[$],N=b===Ks?-R[$]:-S[$],ae=e.elements.arrow,ee=f&&ae?fc(ae):{width:0,height:0},Q=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:zp(),ge=Q[w],Te=Q[G],me=Ln(0,S[$],ee[$]),be=_?S[$]/2-q-me-ge-L.mainAxis:F-me-ge-L.mainAxis,Se=_?-S[$]/2+q+me+Te+L.mainAxis:N+me+Te+L.mainAxis,we=e.elements.arrow&&ia(e.elements.arrow),Re=we?v==="y"?we.clientTop||0:we.clientLeft||0:0,Le=(C=W?.[v])!=null?C:0,x=z+be-Le-Re,K=z+Se-Le,j=Ln(f?po(ne,x):ne,z,f?Qr(X,K):X);I[v]=j,T[v]=j-z}if(o){var B,k=v==="x"?Gt:Wt,U=v==="x"?oi:li,J=I[E],te=E==="y"?"height":"width",V=J+g[k],se=J-g[U],ue=[Gt,Wt].indexOf(y)!==-1,oe=(B=W?.[E])!=null?B:0,ye=ue?V:J-S[te]-R[te]-oe+L.altAxis,Ve=ue?J+S[te]+R[te]-oe-L.altAxis:se,Be=f&&ue?V_(ye,J,Ve):Ln(f?ye:V,J,f?Ve:se);I[E]=Be,T[E]=Be-J}e.modifiersData[r]=T}}const _x={name:"preventOverflow",enabled:!0,phase:"main",fn:wx,requiresIfExists:["offset"]};function xx(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function Ax(i){return i===$t(i)||!ai(i)?mc(i):xx(i)}function Ex(i){var e=i.getBoundingClientRect(),t=$s(e.width)/i.offsetWidth||1,r=$s(e.height)/i.offsetHeight||1;return t!==1||r!==1}function Tx(i,e,t){t===void 0&&(t=!1);var r=ai(e),s=ai(e)&&Ex(e),n=Br(e),a=qs(i,s,t),o={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((zi(e)!=="body"||yc(n))&&(o=Ax(e)),ai(e)?(l=qs(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):n&&(l.x=gc(n))),{x:a.left+o.scrollLeft-l.x,y:a.top+o.scrollTop-l.y,width:a.width,height:a.height}}function Sx(i){var e=new Map,t=new Set,r=[];i.forEach(function(n){e.set(n.name,n)});function s(n){t.add(n.name);var a=[].concat(n.requires||[],n.requiresIfExists||[]);a.forEach(function(o){if(!t.has(o)){var l=e.get(o);l&&s(l)}}),r.push(n)}return i.forEach(function(n){t.has(n.name)||s(n)}),r}function Cx(i){var e=Sx(i);return U_.reduce(function(t,r){return t.concat(e.filter(function(s){return s.phase===r}))},[])}function Mx(i){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(i())})})),e}}function kx(i){var e=i.reduce(function(t,r){var s=t[r.name];return t[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var mu={placement:"bottom",modifiers:[],strategy:"absolute"};function gu(){for(var i=arguments.length,e=new Array(i),t=0;t-1}function Zp(i,e){return typeof i=="function"?i.apply(void 0,e):i}function yu(i,e){if(e===0)return i;var t;return function(r){clearTimeout(t),t=setTimeout(function(){i(r)},e)}}function Lx(i){return i.split(/\s+/).filter(Boolean)}function Ss(i){return[].concat(i)}function vu(i,e){i.indexOf(e)===-1&&i.push(e)}function Ox(i){return i.filter(function(e,t){return i.indexOf(e)===t})}function Fx(i){return i.split("-")[0]}function mo(i){return[].slice.call(i)}function bu(i){return Object.keys(i).reduce(function(e,t){return i[t]!==void 0&&(e[t]=i[t]),e},{})}function Fn(){return document.createElement("div")}function Lo(i){return["Element","Fragment"].some(function(e){return vc(i,e)})}function Nx(i){return vc(i,"NodeList")}function Ux(i){return vc(i,"MouseEvent")}function Hx(i){return!!(i&&i._tippy&&i._tippy.reference===i)}function Gx(i){return Lo(i)?[i]:Nx(i)?mo(i):Array.isArray(i)?i:mo(document.querySelectorAll(i))}function Bl(i,e){i.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function wu(i,e){i.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Wx(i){var e,t=Ss(i),r=t[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function zx(i,e){var t=e.clientX,r=e.clientY;return i.every(function(s){var n=s.popperRect,a=s.popperState,o=s.props,l=o.interactiveBorder,c=Fx(a.placement),u=a.modifiersData.offset;if(!u)return!0;var h=c==="bottom"?u.top.y:0,d=c==="top"?u.bottom.y:0,f=c==="right"?u.left.x:0,p=c==="left"?u.right.x:0,m=n.top-r+h>l,g=r-n.bottom-d>l,y=n.left-t+f>l,b=t-n.right-p>l;return m||g||y||b})}function Rl(i,e,t){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(s){i[r](s,t)})}function _u(i,e){for(var t=e;t;){var r;if(i.contains(t))return!0;t=t.getRootNode==null||(r=t.getRootNode())==null?void 0:r.host}return!1}var Oi={isTouch:!1},xu=0;function Vx(){Oi.isTouch||(Oi.isTouch=!0,window.performance&&document.addEventListener("mousemove",Jp))}function Jp(){var i=performance.now();i-xu<20&&(Oi.isTouch=!1,document.removeEventListener("mousemove",Jp)),xu=i}function jx(){var i=document.activeElement;if(Hx(i)){var e=i._tippy;i.blur&&!e.state.isVisible&&i.blur()}}function Xx(){document.addEventListener("touchstart",Vx,Hr),window.addEventListener("blur",jx)}var Yx=typeof window<"u"&&typeof document<"u",Kx=Yx?!!window.msCrypto:!1,$x={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},qx={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ai=Object.assign({appendTo:Qp,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},$x,qx),Qx=Object.keys(Ai),Zx=function(e){var t=Object.keys(e);t.forEach(function(r){Ai[r]=e[r]})};function em(i){var e=i.plugins||[],t=e.reduce(function(r,s){var n=s.name,a=s.defaultValue;if(n){var o;r[n]=i[n]!==void 0?i[n]:(o=Ai[n])!=null?o:a}return r},{});return Object.assign({},i,t)}function Jx(i,e){var t=e?Object.keys(em(Object.assign({},Ai,{plugins:e}))):Qx,r=t.reduce(function(s,n){var a=(i.getAttribute("data-tippy-"+n)||"").trim();if(!a)return s;if(n==="content")s[n]=a;else try{s[n]=JSON.parse(a)}catch{s[n]=a}return s},{});return r}function Au(i,e){var t=Object.assign({},e,{content:Zp(e.content,[i])},e.ignoreAttributes?{}:Jx(i,e.plugins));return t.aria=Object.assign({},Ai.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var eA=function(){return"innerHTML"};function Ph(i,e){i[eA()]=e}function Eu(i){var e=Fn();return i===!0?e.className=$p:(e.className=qp,Lo(i)?e.appendChild(i):Ph(e,i)),e}function Tu(i,e){Lo(e.content)?(Ph(i,""),i.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Ph(i,e.content):i.textContent=e.content)}function Bh(i){var e=i.firstElementChild,t=mo(e.children);return{box:e,content:t.find(function(r){return r.classList.contains(Kp)}),arrow:t.find(function(r){return r.classList.contains($p)||r.classList.contains(qp)}),backdrop:t.find(function(r){return r.classList.contains(Dx)})}}function tm(i){var e=Fn(),t=Fn();t.className=Rx,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var r=Fn();r.className=Kp,r.setAttribute("data-state","hidden"),Tu(r,i.props),e.appendChild(t),t.appendChild(r),s(i.props,i.props);function s(n,a){var o=Bh(e),l=o.box,c=o.content,u=o.arrow;a.theme?l.setAttribute("data-theme",a.theme):l.removeAttribute("data-theme"),typeof a.animation=="string"?l.setAttribute("data-animation",a.animation):l.removeAttribute("data-animation"),a.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof a.maxWidth=="number"?a.maxWidth+"px":a.maxWidth,a.role?l.setAttribute("role",a.role):l.removeAttribute("role"),(n.content!==a.content||n.allowHTML!==a.allowHTML)&&Tu(c,i.props),a.arrow?u?n.arrow!==a.arrow&&(l.removeChild(u),l.appendChild(Eu(a.arrow))):l.appendChild(Eu(a.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:s}}tm.$$tippy=!0;var tA=1,Pa=[],Dl=[];function iA(i,e){var t=Au(i,Object.assign({},Ai,em(bu(e)))),r,s,n,a=!1,o=!1,l=!1,c=!1,u,h,d,f=[],p=yu(x,t.interactiveDebounce),m,g=tA++,y=null,b=Ox(t.plugins),_={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:g,reference:i,popper:Fn(),popperInstance:y,props:t,state:_,plugins:b,clearDelayTimeouts:ye,setProps:Ve,setContent:Be,show:Tt,hide:It,hideWithInteractivity:Lt,enable:ue,disable:oe,unmount:M,destroy:O};if(!t.render)return v;var E=t.render(v),I=E.popper,S=E.onUpdate;I.setAttribute("data-tippy-root",""),I.id="tippy-"+v.id,v.popper=I,i._tippy=v,I._tippy=v;var R=b.map(function(D){return D.fn(v)}),P=i.hasAttribute("aria-expanded");return we(),q(),z(),ne("onCreate",[v]),t.showOnCreate&&V(),I.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),I.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&w().addEventListener("mousemove",p)}),v;function L(){var D=v.props.touch;return Array.isArray(D)?D:[D,0]}function W(){return L()[0]==="hold"}function T(){var D;return!!((D=v.props.render)!=null&&D.$$tippy)}function C(){return m||i}function w(){var D=C().parentNode;return D?Wx(D):document}function G(){return Bh(I)}function $(D){return v.state.isMounted&&!v.state.isVisible||Oi.isTouch||u&&u.type==="focus"?0:Pl(v.props.delay,D?0:1,Ai.delay)}function z(D){D===void 0&&(D=!1),I.style.pointerEvents=v.props.interactive&&!D?"":"none",I.style.zIndex=""+v.props.zIndex}function ne(D,H,Y){if(Y===void 0&&(Y=!0),R.forEach(function(he){he[D]&&he[D].apply(he,H)}),Y){var le;(le=v.props)[D].apply(le,H)}}function X(){var D=v.props.aria;if(D.content){var H="aria-"+D.content,Y=I.id,le=Ss(v.props.triggerTarget||i);le.forEach(function(he){var Ce=he.getAttribute(H);if(v.state.isVisible)he.setAttribute(H,Ce?Ce+" "+Y:Y);else{var ke=Ce&&Ce.replace(Y,"").trim();ke?he.setAttribute(H,ke):he.removeAttribute(H)}})}}function q(){if(!(P||!v.props.aria.expanded)){var D=Ss(v.props.triggerTarget||i);D.forEach(function(H){v.props.interactive?H.setAttribute("aria-expanded",v.state.isVisible&&H===C()?"true":"false"):H.removeAttribute("aria-expanded")})}}function F(){w().removeEventListener("mousemove",p),Pa=Pa.filter(function(D){return D!==p})}function N(D){if(!(Oi.isTouch&&(l||D.type==="mousedown"))){var H=D.composedPath&&D.composedPath()[0]||D.target;if(!(v.props.interactive&&_u(I,H))){if(Ss(v.props.triggerTarget||i).some(function(Y){return _u(Y,H)})){if(Oi.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else ne("onClickOutside",[v,D]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),o=!0,setTimeout(function(){o=!1}),v.state.isMounted||ge())}}}function ae(){l=!0}function ee(){l=!1}function Q(){var D=w();D.addEventListener("mousedown",N,!0),D.addEventListener("touchend",N,Hr),D.addEventListener("touchstart",ee,Hr),D.addEventListener("touchmove",ae,Hr)}function ge(){var D=w();D.removeEventListener("mousedown",N,!0),D.removeEventListener("touchend",N,Hr),D.removeEventListener("touchstart",ee,Hr),D.removeEventListener("touchmove",ae,Hr)}function Te(D,H){be(D,function(){!v.state.isVisible&&I.parentNode&&I.parentNode.contains(I)&&H()})}function me(D,H){be(D,H)}function be(D,H){var Y=G().box;function le(he){he.target===Y&&(Rl(Y,"remove",le),H())}if(D===0)return H();Rl(Y,"remove",h),Rl(Y,"add",le),h=le}function Se(D,H,Y){Y===void 0&&(Y=!1);var le=Ss(v.props.triggerTarget||i);le.forEach(function(he){he.addEventListener(D,H,Y),f.push({node:he,eventType:D,handler:H,options:Y})})}function we(){W()&&(Se("touchstart",Le,{passive:!0}),Se("touchend",K,{passive:!0})),Lx(v.props.trigger).forEach(function(D){if(D!=="manual")switch(Se(D,Le),D){case"mouseenter":Se("mouseleave",K);break;case"focus":Se(Kx?"focusout":"blur",j);break;case"focusin":Se("focusout",j);break}})}function Re(){f.forEach(function(D){var H=D.node,Y=D.eventType,le=D.handler,he=D.options;H.removeEventListener(Y,le,he)}),f=[]}function Le(D){var H,Y=!1;if(!(!v.state.isEnabled||B(D)||o)){var le=((H=u)==null?void 0:H.type)==="focus";u=D,m=D.currentTarget,q(),!v.state.isVisible&&Ux(D)&&Pa.forEach(function(he){return he(D)}),D.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||a)&&v.props.hideOnClick!==!1&&v.state.isVisible?Y=!0:V(D),D.type==="click"&&(a=!Y),Y&&!le&&se(D)}}function x(D){var H=D.target,Y=C().contains(H)||I.contains(H);if(!(D.type==="mousemove"&&Y)){var le=te().concat(I).map(function(he){var Ce,ke=he._tippy,Xe=(Ce=ke.popperInstance)==null?void 0:Ce.state;return Xe?{popperRect:he.getBoundingClientRect(),popperState:Xe,props:t}:null}).filter(Boolean);zx(le,D)&&(F(),se(D))}}function K(D){var H=B(D)||v.props.trigger.indexOf("click")>=0&&a;if(!H){if(v.props.interactive){v.hideWithInteractivity(D);return}se(D)}}function j(D){v.props.trigger.indexOf("focusin")<0&&D.target!==C()||v.props.interactive&&D.relatedTarget&&I.contains(D.relatedTarget)||se(D)}function B(D){return Oi.isTouch?W()!==D.type.indexOf("touch")>=0:!1}function k(){U();var D=v.props,H=D.popperOptions,Y=D.placement,le=D.offset,he=D.getReferenceClientRect,Ce=D.moveTransition,ke=T()?Bh(I).arrow:null,Xe=he?{getBoundingClientRect:he,contextElement:he.contextElement||C()}:i,Ye={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(ci){var nr=ci.state;if(T()){var Rm=G(),Xo=Rm.box;["placement","reference-hidden","escaped"].forEach(function(sa){sa==="placement"?Xo.setAttribute("data-placement",nr.placement):nr.attributes.popper["data-popper-"+sa]?Xo.setAttribute("data-"+sa,""):Xo.removeAttribute("data-"+sa)}),nr.attributes.popper={}}}},Qe=[{name:"offset",options:{offset:le}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Ce}},Ye];T()&&ke&&Qe.push({name:"arrow",options:{element:ke,padding:3}}),Qe.push.apply(Qe,H?.modifiers||[]),v.popperInstance=Bx(Xe,I,Object.assign({},H,{placement:Y,onFirstUpdate:d,modifiers:Qe}))}function U(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function J(){var D=v.props.appendTo,H,Y=C();v.props.interactive&&D===Qp||D==="parent"?H=Y.parentNode:H=Zp(D,[Y]),H.contains(I)||H.appendChild(I),v.state.isMounted=!0,k()}function te(){return mo(I.querySelectorAll("[data-tippy-root]"))}function V(D){v.clearDelayTimeouts(),D&&ne("onTrigger",[v,D]),Q();var H=$(!0),Y=L(),le=Y[0],he=Y[1];Oi.isTouch&&le==="hold"&&he&&(H=he),H?r=setTimeout(function(){v.show()},H):v.show()}function se(D){if(v.clearDelayTimeouts(),ne("onUntrigger",[v,D]),!v.state.isVisible){ge();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(D.type)>=0&&a)){var H=$(!1);H?s=setTimeout(function(){v.state.isVisible&&v.hide()},H):n=requestAnimationFrame(function(){v.hide()})}}function ue(){v.state.isEnabled=!0}function oe(){v.hide(),v.state.isEnabled=!1}function ye(){clearTimeout(r),clearTimeout(s),cancelAnimationFrame(n)}function Ve(D){if(!v.state.isDestroyed){ne("onBeforeUpdate",[v,D]),Re();var H=v.props,Y=Au(i,Object.assign({},H,bu(D),{ignoreAttributes:!0}));v.props=Y,we(),H.interactiveDebounce!==Y.interactiveDebounce&&(F(),p=yu(x,Y.interactiveDebounce)),H.triggerTarget&&!Y.triggerTarget?Ss(H.triggerTarget).forEach(function(le){le.removeAttribute("aria-expanded")}):Y.triggerTarget&&i.removeAttribute("aria-expanded"),q(),z(),S&&S(H,Y),v.popperInstance&&(k(),te().forEach(function(le){requestAnimationFrame(le._tippy.popperInstance.forceUpdate)})),ne("onAfterUpdate",[v,D])}}function Be(D){v.setProps({content:D})}function Tt(){var D=v.state.isVisible,H=v.state.isDestroyed,Y=!v.state.isEnabled,le=Oi.isTouch&&!v.props.touch,he=Pl(v.props.duration,0,Ai.duration);if(!(D||H||Y||le)&&!C().hasAttribute("disabled")&&(ne("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,T()&&(I.style.visibility="visible"),z(),Q(),v.state.isMounted||(I.style.transition="none"),T()){var Ce=G(),ke=Ce.box,Xe=Ce.content;Bl([ke,Xe],0)}d=function(){var Qe;if(!(!v.state.isVisible||c)){if(c=!0,I.offsetHeight,I.style.transition=v.props.moveTransition,T()&&v.props.animation){var Ot=G(),ci=Ot.box,nr=Ot.content;Bl([ci,nr],he),wu([ci,nr],"visible")}X(),q(),vu(Dl,v),(Qe=v.popperInstance)==null||Qe.forceUpdate(),ne("onMount",[v]),v.props.animation&&T()&&me(he,function(){v.state.isShown=!0,ne("onShown",[v])})}},J()}}function It(){var D=!v.state.isVisible,H=v.state.isDestroyed,Y=!v.state.isEnabled,le=Pl(v.props.duration,1,Ai.duration);if(!(D||H||Y)&&(ne("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,c=!1,a=!1,T()&&(I.style.visibility="hidden"),F(),ge(),z(!0),T()){var he=G(),Ce=he.box,ke=he.content;v.props.animation&&(Bl([Ce,ke],le),wu([Ce,ke],"hidden"))}X(),q(),v.props.animation?T()&&Te(le,v.unmount):v.unmount()}}function Lt(D){w().addEventListener("mousemove",p),vu(Pa,p),p(D)}function M(){v.state.isVisible&&v.hide(),v.state.isMounted&&(U(),te().forEach(function(D){D._tippy.unmount()}),I.parentNode&&I.parentNode.removeChild(I),Dl=Dl.filter(function(D){return D!==v}),v.state.isMounted=!1,ne("onHidden",[v]))}function O(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Re(),delete i._tippy,v.state.isDestroyed=!0,ne("onDestroy",[v]))}}function kr(i,e){e===void 0&&(e={});var t=Ai.plugins.concat(e.plugins||[]);Xx();var r=Object.assign({},e,{plugins:t}),s=Gx(i),n=s.reduce(function(a,o){var l=o&&iA(o,r);return l&&a.push(l),a},[]);return Lo(i)?n[0]:n}kr.defaultProps=Ai;kr.setDefaultProps=Zx;kr.currentInput=Oi;Object.assign({},Hp,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}});kr.setDefaultProps({render:tm});var im={exports:{}};(function(i){(function(){function e(M,O,D){return M.call.apply(M.bind,arguments)}function t(M,O,D){if(!M)throw Error();if(2=O.f?Ce():M.fonts.load(E(O.a),O.h).then(function(Xe){1<=Xe.length?he():setTimeout(ke,25)},function(){Ce()})}ke()}),Y=null,le=new Promise(function(he,Ce){Y=setTimeout(Ce,O.f)});Promise.race([le,H]).then(function(){Y&&(clearTimeout(Y),Y=null),O.g(O.a)},function(){O.j(O.a)})};function q(M,O,D,H,Y,le,he){this.v=M,this.B=O,this.c=D,this.a=H,this.s=he||"BESbswy",this.f={},this.w=Y||3e3,this.u=le||null,this.m=this.j=this.h=this.g=null,this.g=new $(this.c,this.s),this.h=new $(this.c,this.s),this.j=new $(this.c,this.s),this.m=new $(this.c,this.s),M=new v(this.a.c+",serif",S(this.a)),M=ne(M),this.g.a.style.cssText=M,M=new v(this.a.c+",sans-serif",S(this.a)),M=ne(M),this.h.a.style.cssText=M,M=new v("serif",S(this.a)),M=ne(M),this.j.a.style.cssText=M,M=new v("sans-serif",S(this.a)),M=ne(M),this.m.a.style.cssText=M,z(this.g),z(this.h),z(this.j),z(this.m)}var F={D:"serif",C:"sans-serif"},N=null;function ae(){if(N===null){var M=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);N=!!M&&(536>parseInt(M[1],10)||parseInt(M[1],10)===536&&11>=parseInt(M[2],10))}return N}q.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=s(),Q(this)};function ee(M,O,D){for(var H in F)if(F.hasOwnProperty(H)&&O===M.f[F[H]]&&D===M.f[F[H]])return!0;return!1}function Q(M){var O=M.g.a.offsetWidth,D=M.h.a.offsetWidth,H;(H=O===M.f.serif&&D===M.f["sans-serif"])||(H=ae()&&ee(M,O,D)),H?s()-M.A>=M.w?ae()&&ee(M,O,D)&&(M.u===null||M.u.hasOwnProperty(M.a.c))?Te(M,M.v):Te(M,M.B):ge(M):Te(M,M.v)}function ge(M){setTimeout(r(function(){Q(this)},M),50)}function Te(M,O){setTimeout(r(function(){c(this.g.a),c(this.h.a),c(this.j.a),c(this.m.a),O(this.a)},M),0)}function me(M,O,D){this.c=M,this.a=O,this.f=0,this.m=this.j=!1,this.s=D}var be=null;me.prototype.g=function(M){var O=this.a;O.g&&u(O.f,[O.a.c("wf",M.c,S(M).toString(),"active")],[O.a.c("wf",M.c,S(M).toString(),"loading"),O.a.c("wf",M.c,S(M).toString(),"inactive")]),C(O,"fontactive",M),this.m=!0,Se(this)},me.prototype.h=function(M){var O=this.a;if(O.g){var D=h(O.f,O.a.c("wf",M.c,S(M).toString(),"active")),H=[],Y=[O.a.c("wf",M.c,S(M).toString(),"loading")];D||H.push(O.a.c("wf",M.c,S(M).toString(),"inactive")),u(O.f,H,Y)}C(O,"fontinactive",M),Se(this)};function Se(M){--M.f==0&&M.j&&(M.m?(M=M.a,M.g&&u(M.f,[M.a.c("wf","active")],[M.a.c("wf","loading"),M.a.c("wf","inactive")]),C(M,"active")):T(M.a))}function we(M){this.j=M,this.a=new w,this.h=0,this.f=this.g=!0}we.prototype.load=function(M){this.c=new n(this.j,M.context||this.j),this.g=M.events!==!1,this.f=M.classes!==!1,Le(this,new L(this.c,M),M)};function Re(M,O,D,H,Y){var le=--M.h==0;(M.f||M.g)&&setTimeout(function(){var he=Y||null,Ce=H||null||{};if(D.length===0&&le)T(O.a);else{O.f+=D.length,le&&(O.j=le);var ke,Xe=[];for(ke=0;ke=0&&h<=1){if(d._volume=h,d._muted)return d;d.usingWebAudio&&d.masterGain.gain.setValueAtTime(h,t.ctx.currentTime);for(var f=0;f=0;d--)h._howls[d].unload();return h.usingWebAudio&&h.ctx&&h.ctx.close!==void 0&&(h.ctx.close(),h.ctx=null,u()),h},codecs:function(h){return(this||t)._codecs[h.replace(/^x-/,"")]},_setup:function(){var h=this||t;if(h.state=h.ctx&&h.ctx.state||"suspended",h._autoSuspend(),!h.usingWebAudio)if(typeof Audio<"u")try{var d=new Audio;d.oncanplaythrough===void 0&&(h._canPlayEvent="canplay")}catch{h.noAudio=!0}else h.noAudio=!0;try{var d=new Audio;d.muted&&(h.noAudio=!0)}catch{}return h.noAudio||h._setupCodecs(),h},_setupCodecs:function(){var h=this||t,d=null;try{d=typeof Audio<"u"?new Audio:null}catch{return h}if(!d||typeof d.canPlayType!="function")return h;var f=d.canPlayType("audio/mpeg;").replace(/^no$/,""),p=h._navigator?h._navigator.userAgent:"",m=p.match(/OPR\/([0-6].)/g),g=m&&parseInt(m[0].split("/")[1],10)<33,y=p.indexOf("Safari")!==-1&&p.indexOf("Chrome")===-1,b=p.match(/Version\/(.*?) /),_=y&&b&&parseInt(b[1],10)<15;return h._codecs={mp3:!(g||!f&&!d.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!f,opus:!!d.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(d.canPlayType('audio/wav; codecs="1"')||d.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!d.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!d.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(d.canPlayType("audio/x-m4a;")||d.canPlayType("audio/m4a;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(d.canPlayType("audio/x-m4b;")||d.canPlayType("audio/m4b;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(d.canPlayType("audio/x-mp4;")||d.canPlayType("audio/mp4;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(_||!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(_||!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!d.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(d.canPlayType("audio/x-flac;")||d.canPlayType("audio/flac;")).replace(/^no$/,"")},h},_unlockAudio:function(){var h=this||t;if(!h._audioUnlocked&&h.ctx){h._audioUnlocked=!1,h.autoUnlock=!1,h._mobileUnloaded||h.ctx.sampleRate===44100||(h._mobileUnloaded=!0,h.unload()),h._scratchBuffer=h.ctx.createBuffer(1,1,22050);var d=function(f){for(;h._html5AudioPool.length0?y._seek:f._sprite[h][0]/1e3),v=Math.max(0,(f._sprite[h][0]+f._sprite[h][1])/1e3-_),E=1e3*v/Math.abs(y._rate),I=f._sprite[h][0]/1e3,S=(f._sprite[h][0]+f._sprite[h][1])/1e3;y._sprite=h,y._ended=!1;var R=function(){y._paused=!1,y._seek=_,y._start=I,y._stop=S,y._loop=!(!y._loop&&!f._sprite[h][2])};if(_>=S)return void f._ended(y);var P=y._node;if(f._webAudio){var L=function(){f._playLock=!1,R(),f._refreshBuffer(y);var w=y._muted||f._muted?0:y._volume;P.gain.setValueAtTime(w,t.ctx.currentTime),y._playStart=t.ctx.currentTime,P.bufferSource.start===void 0?y._loop?P.bufferSource.noteGrainOn(0,_,86400):P.bufferSource.noteGrainOn(0,_,v):y._loop?P.bufferSource.start(0,_,86400):P.bufferSource.start(0,_,v),E!==1/0&&(f._endTimers[y._id]=setTimeout(f._ended.bind(f,y),E)),d||setTimeout(function(){f._emit("play",y._id),f._loadQueue()},0)};t.state==="running"&&t.ctx.state!=="interrupted"?L():(f._playLock=!0,f.once("resume",L),f._clearTimer(y._id))}else{var W=function(){P.currentTime=_,P.muted=y._muted||f._muted||t._muted||P.muted,P.volume=y._volume*t.volume(),P.playbackRate=y._rate;try{var w=P.play();if(w&&typeof Promise<"u"&&(w instanceof Promise||typeof w.then=="function")?(f._playLock=!0,R(),w.then(function(){f._playLock=!1,P._unlocked=!0,d?f._loadQueue():f._emit("play",y._id)}).catch(function(){f._playLock=!1,f._emit("playerror",y._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),y._ended=!0,y._paused=!0})):d||(f._playLock=!1,R(),f._emit("play",y._id)),P.playbackRate=y._rate,P.paused)return void f._emit("playerror",y._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");h!=="__default"||y._loop?f._endTimers[y._id]=setTimeout(f._ended.bind(f,y),E):(f._endTimers[y._id]=function(){f._ended(y),P.removeEventListener("ended",f._endTimers[y._id],!1)},P.addEventListener("ended",f._endTimers[y._id],!1))}catch(G){f._emit("playerror",y._id,G)}};P.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(P.src=f._src,P.load());var T=window&&window.ejecta||!P.readyState&&t._navigator.isCocoonJS;if(P.readyState>=3||T)W();else{f._playLock=!0,f._state="loading";var C=function(){f._state="loaded",W(),P.removeEventListener(t._canPlayEvent,C,!1)};P.addEventListener(t._canPlayEvent,C,!1),f._clearTimer(y._id)}}return y._id},pause:function(h){var d=this;if(d._state!=="loaded"||d._playLock)return d._queue.push({event:"pause",action:function(){d.pause(h)}}),d;for(var f=d._getSoundIds(h),p=0;p=0?d=parseInt(p[0],10):h=parseFloat(p[0]):p.length>=2&&(h=parseFloat(p[0]),d=parseInt(p[1],10));var m;if(!(h!==void 0&&h>=0&&h<=1))return m=d?f._soundById(d):f._sounds[0],m?m._volume:0;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"volume",action:function(){f.volume.apply(f,p)}}),f;d===void 0&&(f._volume=h),d=f._getSoundIds(d);for(var g=0;g0?p/v:p),I=Date.now();h._fadeTo=f,h._interval=setInterval(function(){var S=(Date.now()-I)/p;I=Date.now(),b+=_*S,b=Math.round(100*b)/100,b=_<0?Math.max(f,b):Math.min(f,b),y._webAudio?h._volume=b:y.volume(b,h._id,!0),g&&(y._volume=b),(fd&&b>=f)&&(clearInterval(h._interval),h._interval=null,h._fadeTo=null,y.volume(f,h._id),y._emit("fade",h._id))},E)},_stopFade:function(h){var d=this,f=d._soundById(h);return f&&f._interval&&(d._webAudio&&f._node.gain.cancelScheduledValues(t.ctx.currentTime),clearInterval(f._interval),f._interval=null,d.volume(f._fadeTo,h),f._fadeTo=null,d._emit("fade",h)),d},loop:function(){var h,d,f,p=this,m=arguments;if(m.length===0)return p._loop;if(m.length===1){if(typeof m[0]!="boolean")return!!(f=p._soundById(parseInt(m[0],10)))&&f._loop;h=m[0],p._loop=h}else m.length===2&&(h=m[0],d=parseInt(m[1],10));for(var g=p._getSoundIds(d),y=0;y=0?d=parseInt(p[0],10):h=parseFloat(p[0])}else p.length===2&&(h=parseFloat(p[0]),d=parseInt(p[1],10));var y;if(typeof h!="number")return y=f._soundById(d),y?y._rate:f._rate;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"rate",action:function(){f.rate.apply(f,p)}}),f;d===void 0&&(f._rate=h),d=f._getSoundIds(d);for(var b=0;b=0?d=parseInt(p[0],10):f._sounds.length&&(d=f._sounds[0]._id,h=parseFloat(p[0]))}else p.length===2&&(h=parseFloat(p[0]),d=parseInt(p[1],10));if(d===void 0)return 0;if(typeof h=="number"&&(f._state!=="loaded"||f._playLock))return f._queue.push({event:"seek",action:function(){f.seek.apply(f,p)}}),f;var y=f._soundById(d);if(y){if(!(typeof h=="number"&&h>=0)){if(f._webAudio){var b=f.playing(d)?t.ctx.currentTime-y._playStart:0,_=y._rateSeek?y._rateSeek-y._seek:0;return y._seek+(_+b*Math.abs(y._rate))}return y._node.currentTime}var v=f.playing(d);v&&f.pause(d,!0),y._seek=h,y._ended=!1,f._clearTimer(d),f._webAudio||!y._node||isNaN(y._node.duration)||(y._node.currentTime=h);var E=function(){v&&f.play(d,!0),f._emit("seek",d)};if(v&&!f._webAudio){var I=function(){f._playLock?setTimeout(I,0):E()};setTimeout(I,0)}else E()}return f},playing:function(h){var d=this;if(typeof h=="number"){var f=d._soundById(h);return!!f&&!f._paused}for(var p=0;p=0&&t._howls.splice(p,1);var m=!0;for(f=0;f=0){m=!1;break}return n&&m&&delete n[h._src],t.noAudio=!1,h._state="unloaded",h._sounds=[],h=null,null},on:function(h,d,f,p){var m=this,g=m["_on"+h];return typeof d=="function"&&g.push(p?{id:f,fn:d,once:p}:{id:f,fn:d}),m},off:function(h,d,f){var p=this,m=p["_on"+h],g=0;if(typeof d=="number"&&(f=d,d=null),d||f)for(g=0;g=0;g--)m[g].id&&m[g].id!==d&&h!=="load"||(setTimeout(function(y){y.call(this,d,f)}.bind(p,m[g].fn),0),m[g].once&&p.off(h,m[g].fn,m[g].id));return p._loadQueue(h),p},_loadQueue:function(h){var d=this;if(d._queue.length>0){var f=d._queue[0];f.event===h&&(d._queue.shift(),d._loadQueue()),h||f.action()}return d},_ended:function(h){var d=this,f=h._sprite;if(!d._webAudio&&h._node&&!h._node.paused&&!h._node.ended&&h._node.currentTime=0;p--){if(f<=d)return;h._sounds[p]._ended&&(h._webAudio&&h._sounds[p]._node&&h._sounds[p]._node.disconnect(0),h._sounds.splice(p,1),f--)}}},_getSoundIds:function(h){var d=this;if(h===void 0){for(var f=[],p=0;p=0;if(t._scratchBuffer&&h.bufferSource&&(h.bufferSource.onended=null,h.bufferSource.disconnect(0),f))try{h.bufferSource.buffer=t._scratchBuffer}catch{}return h.bufferSource=null,d},_clearSound:function(h){/MSIE |Trident\//.test(t._navigator&&t._navigator.userAgent)||(h.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var s=function(h){this._parent=h,this.init()};s.prototype={init:function(){var h=this,d=h._parent;return h._muted=d._muted,h._loop=d._loop,h._volume=d._volume,h._rate=d._rate,h._seek=0,h._paused=!0,h._ended=!0,h._sprite="__default",h._id=++t._counter,d._sounds.push(h),h.create(),h},create:function(){var h=this,d=h._parent,f=t._muted||h._muted||h._parent._muted?0:h._volume;return d._webAudio?(h._node=t.ctx.createGain===void 0?t.ctx.createGainNode():t.ctx.createGain(),h._node.gain.setValueAtTime(f,t.ctx.currentTime),h._node.paused=!0,h._node.connect(t.masterGain)):t.noAudio||(h._node=t._obtainHtml5Audio(),h._errorFn=h._errorListener.bind(h),h._node.addEventListener("error",h._errorFn,!1),h._loadFn=h._loadListener.bind(h),h._node.addEventListener(t._canPlayEvent,h._loadFn,!1),h._endFn=h._endListener.bind(h),h._node.addEventListener("ended",h._endFn,!1),h._node.src=d._src,h._node.preload=d._preload===!0?"auto":d._preload,h._node.volume=f*t.volume(),h._node.load()),h},reset:function(){var h=this,d=h._parent;return h._muted=d._muted,h._loop=d._loop,h._volume=d._volume,h._rate=d._rate,h._seek=0,h._rateSeek=0,h._paused=!0,h._ended=!0,h._sprite="__default",h._id=++t._counter,h},_errorListener:function(){var h=this;h._parent._emit("loaderror",h._id,h._node.error?h._node.error.code:0),h._node.removeEventListener("error",h._errorFn,!1)},_loadListener:function(){var h=this,d=h._parent;d._duration=Math.ceil(10*h._node.duration)/10,Object.keys(d._sprite).length===0&&(d._sprite={__default:[0,1e3*d._duration]}),d._state!=="loaded"&&(d._state="loaded",d._emit("load"),d._loadQueue()),h._node.removeEventListener(t._canPlayEvent,h._loadFn,!1)},_endListener:function(){var h=this,d=h._parent;d._duration===1/0&&(d._duration=Math.ceil(10*h._node.duration)/10,d._sprite.__default[1]===1/0&&(d._sprite.__default[1]=1e3*d._duration),d._ended(h)),h._node.removeEventListener("ended",h._endFn,!1)}};var n={},a=function(h){var d=h._src;if(n[d])return h._duration=n[d].duration,void c(h);if(/^data:[^;]+;base64,/.test(d)){for(var f=atob(d.split(",")[1]),p=new Uint8Array(f.length),m=0;m0?(n[d._src]=m,c(d,m)):f()};typeof Promise<"u"&&t.ctx.decodeAudioData.length===1?t.ctx.decodeAudioData(h).then(p).catch(f):t.ctx.decodeAudioData(h,p,f)},c=function(h,d){d&&!h._duration&&(h._duration=d.duration),Object.keys(h._sprite).length===0&&(h._sprite={__default:[0,1e3*h._duration]}),h._state!=="loaded"&&(h._state="loaded",h._emit("load"),h._loadQueue())},u=function(){if(t.usingWebAudio){try{typeof AudioContext<"u"?t.ctx=new AudioContext:typeof webkitAudioContext<"u"?t.ctx=new webkitAudioContext:t.usingWebAudio=!1}catch{t.usingWebAudio=!1}t.ctx||(t.usingWebAudio=!1);var h=/iP(hone|od|ad)/.test(t._navigator&&t._navigator.platform),d=t._navigator&&t._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),f=d?parseInt(d[1],10):null;if(h&&f&&f<9){var p=/safari/.test(t._navigator&&t._navigator.userAgent.toLowerCase());t._navigator&&!p&&(t.usingWebAudio=!1)}t.usingWebAudio&&(t.masterGain=t.ctx.createGain===void 0?t.ctx.createGainNode():t.ctx.createGain(),t.masterGain.gain.setValueAtTime(t._muted?0:t._volume,t.ctx.currentTime),t.masterGain.connect(t.ctx.destination)),t._setup()}};i.Howler=t,i.Howl=r,typeof ii<"u"?(ii.HowlerGlobal=e,ii.Howler=t,ii.Howl=r,ii.Sound=s):typeof window<"u"&&(window.HowlerGlobal=e,window.Howler=t,window.Howl=r,window.Sound=s)})()})(Yr);const Oo=[".aac",".mid",".midi",".mp3",".oga",".ogg",".opus",".wav",".webm",".weba",".flac",".aiff"],Gr=[".bmp",".gif",".jpeg",".jpg",".png",".tif",".tiff",".webp"];function nA(i){return i.hold==null}function De(i){return i.hold!=null}var Jt="INUMBER",an="IOP1",on="IOP2",ln="IOP3",tr="IVAR",ns="IVARNAME",Zs="IFUNCALL",Fo="IFUNDEF",zt="IEXPR",bc="IEXPREVAL",fs="IMEMBER",No="IENDSTATEMENT",Js="IARRAY";function je(i,e){this.type=i,this.value=e??0}je.prototype.toString=function(){switch(this.type){case Jt:case an:case on:case ln:case tr:case ns:case No:return this.value;case Zs:return"CALL "+this.value;case Fo:return"DEF "+this.value;case Js:return"ARRAY "+this.value;case fs:return"."+this.value;default:return"Invalid Instruction"}};function Uo(i){return new je(an,i)}function sr(i){return new je(on,i)}function rm(i){return new je(ln,i)}function Rh(i,e,t,r,s){for(var n=[],a=[],o,l,c,u,h=0;h1)l=n.pop(),o=n.pop(),u=t[d.value],d=new je(Jt,u(o.value,l.value)),n.push(d);else if(f===ln&&n.length>2)c=n.pop(),l=n.pop(),o=n.pop(),d.value==="?"?n.push(o.value?l.value:c.value):(u=r[d.value],d=new je(Jt,u(o.value,l.value,c.value)),n.push(d));else if(f===an&&n.length>0)o=n.pop(),u=e[d.value],d=new je(Jt,u(o.value)),n.push(d);else if(f===zt){for(;n.length>0;)a.push(n.shift());a.push(new je(zt,Rh(d.value,e,t,r,s)))}else if(f===fs&&n.length>0)o=n.pop(),n.push(new je(Jt,o.value[d.value]));else{for(;n.length>0;)a.push(n.shift());a.push(d)}}for(;n.length>0;)a.push(n.shift());return a}function sm(i,e,t){for(var r=[],s=0;s0;)l.unshift(Yi(r.pop(),t));if(o=r.pop(),o.apply&&o.call)r.push(o.apply(void 0,l));else throw new Error(o+" is not a function")}else if(f===Fo)r.push(function(){for(var m=r.pop(),g=[],y=d.value;y-- >0;)g.unshift(r.pop());var b=r.pop(),_=function(){for(var v=Object.assign({},t),E=0,I=g.length;E0;)l.unshift(r.pop());r.push(l)}else throw new Error("invalid Expression")}if(r.length>1)throw new Error("invalid Expression (parity)");return r[0]===0?0:Yi(r[0],t)}function aA(i,e,t){return wc(i)?i:{type:bc,value:function(r){return Vr(i.value,e,r)}}}function wc(i){return i&&i.type===bc}function Yi(i,e){return wc(i)?i.value(e):i}function _c(i,e){for(var t=[],r,s,n,a,o,l,c=0;c0;)o.unshift(t.pop());a=t.pop(),t.push(a+"("+o.join(", ")+")")}else if(h===Fo){for(s=t.pop(),l=u.value,o=[];l-- >0;)o.unshift(t.pop());r=t.pop(),e?t.push("("+r+" = function("+o.join(", ")+") { return "+s+" })"):t.push("("+r+"("+o.join(", ")+") = "+s+")")}else if(h===fs)r=t.pop(),t.push(r+"."+u.value);else if(h===Js){for(l=u.value,o=[];l-- >0;)o.unshift(t.pop());t.push("["+o.join(", ")+"]")}else if(h===zt)t.push("("+_c(u.value,e)+")");else if(h!==No)throw new Error("invalid Expression")}return t.length>1&&(e?t=[t.join(",")]:t=[t.join(";")]),String(t[0])}function Su(i){return typeof i=="string"?JSON.stringify(i).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"):i}function Bs(i,e){for(var t=0;t=this.expression.length)return this.newToken(Kn,"EOF");if(this.isWhitespace()||this.isComment())return this.next();if(this.isRadixInteger()||this.isNumber()||this.isOperator()||this.isString()||this.isParen()||this.isBracket()||this.isComma()||this.isSemicolon()||this.isNamedOp()||this.isConst()||this.isName())return this.current;this.parseError('Unknown character "'+this.expression.charAt(this.pos)+'"')};ut.prototype.isString=function(){var i=!1,e=this.pos,t=this.expression.charAt(e);if(t==="'"||t==='"')for(var r=this.expression.indexOf(t,e+1);r>=0&&this.pos"9")))break}if(e>i){var r=this.expression.substring(i,e);if(r in this.consts)return this.current=this.newToken(Ho,this.consts[r]),this.pos+=r.length,!0}return!1};ut.prototype.isNamedOp=function(){for(var i=this.pos,e=i;e"9")))break}if(e>i){var r=this.expression.substring(i,e);if(this.isOperatorEnabled(r)&&(r in this.binaryOps||r in this.unaryOps||r in this.ternaryOps))return this.current=this.newToken(et,r),this.pos+=r.length,!0}return!1};ut.prototype.isName=function(){for(var i=this.pos,e=i,t=!1;e"9"))break}else t=!0}if(t){var s=this.expression.substring(i,e);return this.current=this.newToken(Ac,s),this.pos+=s.length,!0}return!1};ut.prototype.isWhitespace=function(){for(var i=!1,e=this.expression.charAt(this.pos);(e===" "||e===" "||e===` -`||e==="\r")&&(i=!0,this.pos++,!(this.pos>=this.expression.length));)e=this.expression.charAt(this.pos);return i};var oA=/^[0-9a-f]{4}$/i;ut.prototype.unescape=function(i){var e=i.indexOf("\\");if(e<0)return i;for(var t=i.substring(0,e);e>=0;){var r=i.charAt(++e);switch(r){case"'":t+="'";break;case'"':t+='"';break;case"\\":t+="\\";break;case"/":t+="/";break;case"b":t+="\b";break;case"f":t+="\f";break;case"n":t+=` -`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"u":var s=i.substring(e+1,e+5);oA.test(s)||this.parseError("Illegal escape sequence: \\u"+s),t+=String.fromCharCode(parseInt(s,16)),e+=4;break;default:throw this.parseError('Illegal escape sequence: "\\'+r+'"')}++e;var n=i.indexOf("\\",e);t+=i.substring(e,n<0?i.length:n),e=n}return t};ut.prototype.isComment=function(){var i=this.expression.charAt(this.pos);return i==="/"&&this.expression.charAt(this.pos+1)==="*"?(this.pos=this.expression.indexOf("*/",this.pos)+2,this.pos===1&&(this.pos=this.expression.length),!0):!1};ut.prototype.isRadixInteger=function(){var i=this.pos;if(i>=this.expression.length-2||this.expression.charAt(i)!=="0")return!1;++i;var e,t;if(this.expression.charAt(i)==="x")e=16,t=/^[0-9a-f]$/i,++i;else if(this.expression.charAt(i)==="b")e=2,t=/^[01]$/i,++i;else return!1;for(var r=!1,s=i;i="0"&&a<="9"||!s&&a===".");)a==="."?s=!0:n=!0,e++,i=n;if(i&&(r=e),a==="e"||a==="E"){e++;for(var o=!0,l=!1;e="0"&&a<="9")l=!0,o=!1;else break;e++}l||(e=r)}return i?(this.current=this.newToken(Ho,parseFloat(this.expression.substring(t,e))),this.pos=e):this.pos=r,i};ut.prototype.isOperator=function(){var i=this.pos,e=this.expression.charAt(this.pos);if(e==="+"||e==="-"||e==="*"||e==="/"||e==="%"||e==="^"||e==="?"||e===":"||e===".")this.current=this.newToken(et,e);else if(e==="∙"||e==="•")this.current=this.newToken(et,"*");else if(e===">")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(et,">="),this.pos++):this.current=this.newToken(et,">");else if(e==="<")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(et,"<="),this.pos++):this.current=this.newToken(et,"<");else if(e==="|")if(this.expression.charAt(this.pos+1)==="|")this.current=this.newToken(et,"||"),this.pos++;else return!1;else if(e==="=")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(et,"=="),this.pos++):this.current=this.newToken(et,e);else if(e==="!")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(et,"!="),this.pos++):this.current=this.newToken(et,e);else return!1;return this.pos++,this.isOperatorEnabled(this.current.value)?!0:(this.pos=i,!1)};ut.prototype.isOperatorEnabled=function(i){return this.parser.isOperatorEnabled(i)};ut.prototype.getCoordinates=function(){var i=0,e,t=-1;do i++,e=this.pos-t,t=this.expression.indexOf(` -`,t+1);while(t>=0&&t"u"?!0:Array.isArray(e)?Bs(e,i.value):typeof e=="function"?e(i):i.value===e};it.prototype.save=function(){this.savedCurrent=this.current,this.savedNextToken=this.nextToken,this.tokens.save()};it.prototype.restore=function(){this.tokens.restore(),this.current=this.savedCurrent,this.nextToken=this.savedNextToken};it.prototype.accept=function(i,e){return this.nextToken.type===i&&this.tokenMatches(this.nextToken,e)?(this.next(),!0):!1};it.prototype.expect=function(i,e){if(!this.accept(i,e)){var t=this.tokens.getCoordinates();throw new Error("parse error ["+t.line+":"+t.column+"]: Expected "+(e||i))}};it.prototype.parseAtom=function(i){var e=this.tokens.unaryOps;function t(s){return s.value in e}if(this.accept(Ac)||this.accept(et,t))i.push(new je(tr,this.current.value));else if(this.accept(Ho))i.push(new je(Jt,this.current.value));else if(this.accept(nm))i.push(new je(Jt,this.current.value));else if(this.accept(ir,"("))this.parseExpression(i),this.expect(ir,")");else if(this.accept(en,"["))if(this.accept(en,"]"))i.push(new je(Js,0));else{var r=this.parseArrayList(i);i.push(new je(Js,r))}else throw new Error("unexpected "+this.nextToken)};it.prototype.parseExpression=function(i){var e=[];this.parseUntilEndStatement(i,e)||(this.parseVariableAssignmentExpression(e),!this.parseUntilEndStatement(i,e)&&this.pushExpression(i,e))};it.prototype.pushExpression=function(i,e){for(var t=0,r=e.length;t=",">","in"];it.prototype.parseComparison=function(i){for(this.parseAddSub(i);this.accept(et,lA);){var e=this.current;this.parseAddSub(i),i.push(sr(e.value))}};var hA=["+","-","||"];it.prototype.parseAddSub=function(i){for(this.parseTerm(i);this.accept(et,hA);){var e=this.current;this.parseTerm(i),i.push(sr(e.value))}};var cA=["*","/","%"];it.prototype.parseTerm=function(i){for(this.parseFactor(i);this.accept(et,cA);){var e=this.current;this.parseFactor(i),i.push(sr(e.value))}};it.prototype.parseFactor=function(i){var e=this.tokens.unaryOps;function t(s){return s.value in e}if(this.save(),this.accept(et,t)){if(this.current.value!=="-"&&this.current.value!=="+"){if(this.nextToken.type===ir&&this.nextToken.value==="("){this.restore(),this.parseExponential(i);return}else if(this.nextToken.type===Ec||this.nextToken.type===Go||this.nextToken.type===Kn||this.nextToken.type===ir&&this.nextToken.value===")"){this.restore(),this.parseAtom(i);return}}var r=this.current;this.parseFactor(i),i.push(Uo(r.value))}else this.parseExponential(i)};it.prototype.parseExponential=function(i){for(this.parsePostfixExpression(i);this.accept(et,"^");)this.parseFactor(i),i.push(sr("^"))};it.prototype.parsePostfixExpression=function(i){for(this.parseFunctionCall(i);this.accept(et,"!");)i.push(Uo("!"))};it.prototype.parseFunctionCall=function(i){var e=this.tokens.unaryOps;function t(n){return n.value in e}if(this.accept(et,t)){var r=this.current;this.parseAtom(i),i.push(Uo(r.value))}else for(this.parseMemberExpression(i);this.accept(ir,"(");)if(this.accept(ir,")"))i.push(new je(Zs,0));else{var s=this.parseArgumentList(i);i.push(new je(Zs,s))}};it.prototype.parseArgumentList=function(i){for(var e=0;!this.accept(ir,")");)for(this.parseExpression(i),++e;this.accept(Go);)this.parseExpression(i),++e;return e};it.prototype.parseMemberExpression=function(i){for(this.parseAtom(i);this.accept(et,".")||this.accept(en,"[");){var e=this.current;if(e.value==="."){if(!this.allowMemberAccess)throw new Error('unexpected ".", member access is not permitted');this.expect(Ac),i.push(new je(fs,this.current.value))}else if(e.value==="["){if(!this.tokens.isOperatorEnabled("["))throw new Error('unexpected "[]", arrays are disabled');this.parseExpression(i),this.expect(en,"]"),i.push(sr("["))}else throw new Error("unexpected symbol: "+e.value)}};function dA(i,e){return Number(i)+Number(e)}function uA(i,e){return i-e}function fA(i,e){return i*e}function pA(i,e){return i/e}function mA(i,e){return i%e}function gA(i,e){return Array.isArray(i)&&Array.isArray(e)?i.concat(e):""+i+e}function yA(i,e){return i===e}function vA(i,e){return i!==e}function bA(i,e){return i>e}function wA(i,e){return i=e}function xA(i,e){return i<=e}function AA(i,e){return!!(i&&e)}function EA(i,e){return!!(i||e)}function TA(i,e){return Bs(e,i)}function SA(i){return(Math.exp(i)-Math.exp(-i))/2}function CA(i){return(Math.exp(i)+Math.exp(-i))/2}function MA(i){return i===1/0?1:i===-1/0?-1:(Math.exp(i)-Math.exp(-i))/(Math.exp(i)+Math.exp(-i))}function kA(i){return i===-1/0?i:Math.log(i+Math.sqrt(i*i+1))}function IA(i){return Math.log(i+Math.sqrt(i*i-1))}function PA(i){return Math.log((1+i)/(1-i))/2}function Cu(i){return Math.log(i)*Math.LOG10E}function BA(i){return-i}function RA(i){return!i}function DA(i){return i<0?Math.ceil(i):Math.floor(i)}function LA(i){return Math.random()*(i||1)}function Mu(i){return Tc(i+1)}function OA(i){return isFinite(i)&&i===Math.round(i)}var FA=4.7421875,Ll=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function Tc(i){var e,t;if(OA(i)){if(i<=0)return isFinite(i)?1/0:NaN;if(i>171)return 1/0;for(var r=i-2,s=i-1;r>1;)s*=r,r--;return s===0&&(s=1),s}if(i<.5)return Math.PI/(Math.sin(Math.PI*i)*Tc(1-i));if(i>=171.35)return 1/0;if(i>85){var n=i*i,a=n*i,o=a*i,l=o*i;return Math.sqrt(2*Math.PI/i)*Math.pow(i/Math.E,i)*(1+1/(12*i)+1/(288*n)-139/(51840*a)-571/(2488320*o)+163879/(209018880*l)+5246819/(75246796800*l*i))}--i,t=Ll[0];for(var c=1;c0?(s=r/e,i+=s*s):i+=r}return e===1/0?1/0:e*Math.sqrt(i)}function Iu(i,e,t){return i?e:t}function UA(i,e){return typeof e>"u"||+e==0?Math.round(i):(i=+i,e=-+e,isNaN(i)||!(typeof e=="number"&&e%1===0)?NaN:(i=i.toString().split("e"),i=Math.round(+(i[0]+"e"+(i[1]?+i[1]-e:-e))),i=i.toString().split("e"),+(i[0]+"e"+(i[1]?+i[1]+e:e))))}function HA(i,e,t){return t&&(t[i]=e),e}function GA(i,e){return i[e|0]}function WA(i){return arguments.length===1&&Array.isArray(i)?Math.max.apply(Math,i):Math.max.apply(Math,arguments)}function zA(i){return arguments.length===1&&Array.isArray(i)?Math.min.apply(Math,i):Math.min.apply(Math,arguments)}function VA(i,e){if(typeof i!="function")throw new Error("First argument to map is not a function");if(!Array.isArray(e))throw new Error("Second argument to map is not an array");return e.map(function(t,r){return i(t,r)})}function jA(i,e,t){if(typeof i!="function")throw new Error("First argument to fold is not a function");if(!Array.isArray(t))throw new Error("Second argument to fold is not an array");return t.reduce(function(r,s,n){return i(r,s,n)},e)}function XA(i,e){if(typeof i!="function")throw new Error("First argument to filter is not a function");if(!Array.isArray(e))throw new Error("Second argument to filter is not an array");return e.filter(function(t,r){return i(t,r)})}function YA(i,e){if(!(Array.isArray(e)||typeof e=="string"))throw new Error("Second argument to indexOf is not a string or array");return e.indexOf(i)}function KA(i,e){if(!Array.isArray(e))throw new Error("Second argument to join is not an array");return e.join(i)}function $A(i){return(i>0)-(i<0)||+i}var Pu=1/3;function qA(i){return i<0?-Math.pow(-i,Pu):Math.pow(i,Pu)}function QA(i){return Math.exp(i)-1}function ZA(i){return Math.log(1+i)}function JA(i){return Math.log(i)/Math.LN2}function Rr(i){this.options=i||{},this.unaryOps={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,sinh:Math.sinh||SA,cosh:Math.cosh||CA,tanh:Math.tanh||MA,asinh:Math.asinh||kA,acosh:Math.acosh||IA,atanh:Math.atanh||PA,sqrt:Math.sqrt,cbrt:Math.cbrt||qA,log:Math.log,log2:Math.log2||JA,ln:Math.log,lg:Math.log10||Cu,log10:Math.log10||Cu,expm1:Math.expm1||QA,log1p:Math.log1p||ZA,abs:Math.abs,ceil:Math.ceil,floor:Math.floor,round:Math.round,trunc:Math.trunc||DA,"-":BA,"+":Number,exp:Math.exp,not:RA,length:NA,"!":Mu,sign:Math.sign||$A},this.binaryOps={"+":dA,"-":uA,"*":fA,"/":pA,"%":mA,"^":Math.pow,"||":gA,"==":yA,"!=":vA,">":bA,"<":wA,">=":_A,"<=":xA,and:AA,or:EA,in:TA,"=":HA,"[":GA},this.ternaryOps={"?":Iu},this.functions={random:LA,fac:Mu,min:zA,max:WA,hypot:Math.hypot||ku,pyt:Math.hypot||ku,pow:Math.pow,atan2:Math.atan2,if:Iu,gamma:Tc,roundTo:UA,map:VA,fold:jA,filter:XA,indexOf:YA,join:KA},this.consts={E:Math.E,PI:Math.PI,true:!0,false:!1}}Rr.prototype.parse=function(i){var e=[],t=new it(this,new ut(this,i),{allowMemberAccess:this.options.allowMemberAccess});return t.parseExpression(e),t.expect(Kn,"EOF"),new Ci(e,this)};Rr.prototype.evaluate=function(i,e){return this.parse(i).evaluate(e)};var om=new Rr;Rr.parse=function(i){return om.parse(i)};Rr.evaluate=function(i,e){return om.parse(i).evaluate(e)};var Bu={"+":"add","-":"subtract","*":"multiply","/":"divide","%":"remainder","^":"power","!":"factorial","<":"comparison",">":"comparison","<=":"comparison",">=":"comparison","==":"comparison","!=":"comparison","||":"concatenate",and:"logical",or:"logical",not:"logical","?":"conditional",":":"conditional","=":"assignment","[":"array","()=":"fndef"};function eE(i){return Bu.hasOwnProperty(i)?Bu[i]:i}Rr.prototype.isOperatorEnabled=function(i){var e=eE(i),t=this.options.operators||{};return!(e in t)||!!t[e]};const $a=[1,1/2,1/3,1/4,1/6,1/8,1/12,1/16,1/24,1/48];function Sc(i){for(let e=0;e<$a.length;e++)if(Math.abs(i-Math.round(i/$a[e])*$a[e])<.01)return e;return 9}function Dh(i){return 4/$a[Sc(i)]}function lm(){const{userAgent:i}=navigator;let e=i.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[],t;if(/trident/i.test(e[1]))return t=/\brv[ :]+(\d+)/g.exec(i)||[],`IE ${t[1]||""}`;if(e[1]==="Chrome"){if(t=i.match(/\b(OPR|Edge)\/(\d+)/),t!==null)return t.slice(1).join(" ").replace("OPR","Opera");if(t=i.match(/\b(Edg)\/(\d+)/),t!==null)return t.slice(1).join(" ").replace("Edg","Edge (Chromium)")}return e=e[2]?[e[1],e[2]]:[navigator.appName,navigator.appVersion,"-?"],t=i.match(/version\/(\d+)/i),t!==null&&e.splice(1,1,t[1]),e.join(" ")}function Mi(i,e,t){if(t=t??(n=>n),i.length==0)return-1;if(e>=t(i[i.length-1])){let n=i.length-1;for(;n>0&&t(i[n-1])==e;)n--;return n}let r=0,s=i.length;for(;r<=s&&r>>1;if(t(i[n])==e){for(;n>0&&t(i[n-1])==e;)n--;return n}t(i[n])e&&(s=n-1)}return Math.max(0,s)}function Cc(i){try{return Rr.evaluate(i)}catch{return 0}}function Ht(i,e){let t=i.length;if(i.length!=0)for(;t--;)e(i[t],t)&&i[t].destroy()}function Lh(i){return i==""?"":i.slice(0,1).toUpperCase()+i.slice(1).toLowerCase()}function Rs(i){return!(!["Backspace","Tab","Escape","Enter","1","2","3","4","5","6","7","8","9","0","+","-","*","/",".","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Delete","x","c","a","A","C","X"].includes(i.key)||["X","C","A","a","c","x"].includes(i.key)&&!i.metaKey&&!i.ctrlKey)}function Oh(i){return i.button==2||i.getModifierState("Control")&&ts}class Oe{static _view;static messages={};static get view(){return this._view||(this._view=document.getElementById("waterfall")),this._view}static create(e){let t=1;if(this.messages[e]&&this.messages[e].type==""){const s=this.messages[e];clearTimeout(s.timeoutID),t=++s.count,this.view.removeChild(s.container)}const r=document.createElement("div");r.innerHTML=e,t>1&&(r.innerHTML+=` (${t})`),r.classList.add("waterfall-item"),Oe.messages[e]={type:"",container:r,timeoutID:setTimeout(()=>{r.classList.add("waterfall-exiting"),setTimeout(()=>{delete this.messages[e],this.view.removeChild(r)},500)},5e3),count:t},this.view.appendChild(r)}static createFormatted(e,t){let r=1;if(this.messages[e]&&this.messages[e].type==t){const n=this.messages[e];clearTimeout(n.timeoutID),r=++n.count,this.view.removeChild(n.container)}const s=document.createElement("div");s.innerHTML=`
${Lh(t)}:
`+e,r>1&&(s.innerHTML+=` (${r})`),s.classList.add("waterfall-item"),console[t](e),Oe.messages[e]={type:t,container:s,timeoutID:setTimeout(()=>{s.classList.add("waterfall-exiting"),setTimeout(()=>{delete this.messages[e],this.view.removeChild(s)},500)},5e3),count:r},this.view.appendChild(s)}}class hm{cols=[];keyDown(e){this.cols[e]=(this.cols[e]??0)+1}keyUp(e){this.cols[e]=(this.cols[e]??1)-1,this.cols[e]=Math.max(this.cols[e],0)}isPressed(e){return!!this.cols[e]}getHeldCols(){return this.cols.map((e,t)=>t).filter(e=>this.isPressed(e))}reset(){this.cols=[]}}const Ru=["audio.rate","chart.snap","chart.CMod","play.timingCollection"];class go{static general={spinnerStep:1,smoothAnimations:!0,warnBeforeExit:!0};static chart={CMod:!1,reverse:!1,mousePlacement:!1,zoom:1,speed:250,snap:1,hideWarpedArrows:!1,doSpeedChanges:!0,drawNoteFlash:!0,receptorYPos:-200,maxDrawBeats:20,maxDrawBeatsBack:10,scroll:{scrollSensitivity:1,scrollSnapEveryScroll:!1,invertZoomScroll:!1,invertReverseScroll:!0},waveform:{enabled:!0,antialiasing:!0,color:6316402,opacity:.5,lineHeight:1,speedChanges:!0},timingEventOrder:{left:["LABELS","FAKES","TIMESIGNATURES","DELAYS","WARPS","STOPS","BPMS"],right:["SPEEDS","SCROLLS","TICKCOUNTS","COMBOS","ATTACKS","BGCHANGES","FGCHANGES"]},renderTimingEvent:{BPMS:!0,STOPS:!0,DELAYS:!0,WARPS:!0,FAKES:!0,COMBOS:!0,SPEEDS:!0,LABELS:!0,SCROLLS:!0,TIMESIGNATURES:!0,TICKCOUNTS:!0,BGCHANGES:!0,FGCHANGES:!0,ATTACKS:!0}};static audio={assistTick:!1,metronome:!1,rate:1,masterVolume:1,songVolume:.2,soundEffectVolume:.5};static play={offset:0,effectOffset:0,visualOffset:0,hideBarlines:!1,judgmentTilt:!0,timingCollection:"ITG",timingWindowScale:1,timingWindowAdd:0,defaultTimingCollection:{"dance-single":"ITG","dance-double":"ITG","dance-3panel":"ITG","dance-solo":"ITG","dance-solodouble":"ITG"}};static performance={antialiasing:!1,resolution:window.devicePixelRatio};static debug={showFPS:!1,showTimers:!1};static experimental={}}class A extends go{static extractOptions(e,t){return Object.entries(e).reduce((r,s)=>{const n=t?t+".":"";return typeof s[1]=="object"&&!Array.isArray(s[1])?r=r.concat(this.extractOptions(s[1],n+s[0])):(s[0]=n+s[0],r.push([s[0],s[1]])),r},[])}static applyOption(e){if(typeof this.getDefaultOption(e[0])!=typeof e[1])return console.warn("Couldn't load option "+e[0]+": the value "+e[1]+" ("+typeof e[1]+") does not match the type "+typeof this.getDefaultOption(e[0]));const t=e[0].split("."),r=t.pop();let s=this;for(const n of t)if(n in s)s=s[n];else return console.warn("Couldn't load option "+e[0]+": the id doesn't exist");s[r]=e[1]}static getDefaultOption(e){const t=e.split(".");let r=go;for(const s of t)if(s in r)r=r[s];else return;if(!(typeof r=="object"&&!Array.isArray(r)))return r}static getOption(e){const t=e.split(".");let r=this;for(const s of t)if(s in r)r=r[s];else return;if(!(typeof r=="object"&&!Array.isArray(r)))return r}static saveOptions(){const e={};for(const t of this.extractOptions(this)){if(Ru.includes(t[0]))continue;const r=this.getDefaultOption(t[0]);if(r==null){console.warn("Couldn't save option "+t[0]+": the id doesn't exist");continue}typeof r!=typeof t[1]?(console.warn("Couldn't save option "+t[0]+": the value "+t[1]+" does not match the type "+typeof this.getDefaultOption(t[0])),e[t[0]]=r):e[t[0]]=t[1]}localStorage.setItem("options",JSON.stringify(e))}static loadOptions(){const e=localStorage.getItem("options");if(!e)return;const t=JSON.parse(e);if(typeof t!="object")return console.error("Couldn't load options from storage");for(const r of Object.entries(t))Ru.includes(r[0])||this.applyOption(r)}static clearSave(){localStorage.removeItem("options")}}const cm={};for(const i of Object.entries(go))cm[i[0]]=JSON.parse(JSON.stringify(i[1]));Object.assign(A,cm);class Wo{timingWindowMS;dancePoints;lifeChange;constructor(e,t,r){this.timingWindowMS=e,this.dancePoints=t,this.lifeChange=r}getTimingWindowMS(){return this.timingWindowMS*A.play.timingWindowScale+A.play.timingWindowAdd}}class Ba extends Wo{target="dropped";constructor(e,t){super(0,e,t)}}class Wr extends Wo{noteType;constructor(e,t,r,s){super(t,r,s),this.noteType=e}}new Wr("Hold",0,0,0);class st{static ITG=new st("assets/judgment/judgmentITG.png",["w0","w1","w2","w3","w4","w5","miss"]);static WATERFALL=new st("assets/judgment/judgmentWaterfall.png",["w0","w1","w2","w3","w4","w5","miss"]);texHeight=0;texWidth=0;texture;judgeNames=[];constructor(e,t){this.judgeNames=t,this.loadTex(e)}async loadTex(e){const t=await Ps.load(e);this.texture=t,this.texHeight=t.height,this.texWidth=t.width}getTexture(e,t){if(!this.judgeNames.includes(t.id))return;let r=0;const s=this.judgeNames.indexOf(t.id)*this.texHeight/this.judgeNames.length;return e>=0&&(r+=this.texWidth/2),this.texture.frame=new Ie(r,s,this.texWidth/2,this.texHeight/this.judgeNames.length),this.texture}}class Ra extends Wo{target="mine";constructor(e,t,r){super(e,t,r)}}class vt extends Wo{id;name;color;judgmentTexture;constructor(e,t,r,s,n,a,o){super(s,n,a),this.id=e,this.name=t,this.color=r,this.judgmentTexture=o}}const dm=new vt("w0","Fantastic",183528,0,0,0,st.ITG);class Da extends vt{constructor(e,t,r,s,n){super("miss",e,t,0,r,s,n)}}function Gi(i){return i.color!=null&&i.id!="miss"}function ri(i){return i.color!=null&&i.id=="miss"}function Er(i){return!!i.noteType}function tn(i){return i.target=="dropped"}function Zr(i){return i.target=="mine"}class Je{static COLLECTIONS={ITG:new Je([new vt("w0","Fantastic",2215144,23,5,.008,st.ITG),new vt("w2","Excellent",14851096,44.5,4,.008,st.ITG),new vt("w3","Great",6736213,103.5,2,.004,st.ITG),new vt("w4","Decent",11820287,136.5,0,0,st.ITG),new vt("w5","Way Off",13206878,181.5,-6,-.05,st.ITG),new Da("Miss",16724016,-12,-.1,st.ITG),new Wr("Hold",321.5,5,-.008),new Wr("Roll",351.5,5,-.008),new Ba(0,-.08),new Ra(71.5,-6,-.05)],103.5),FA:new Je([new vt("w0","Fantastic",2215144,15,3.5,.008,st.ITG),new vt("w1","Fantastic",16777215,23,3,.008,st.ITG),new vt("w2","Excellent",14851096,44.5,2,.008,st.ITG),new vt("w3","Great",6736213,103.5,1,.004,st.ITG),new vt("w4","Decent",11820287,136.5,0,0,st.ITG),new vt("w5","Way Off",13206878,181.5,0,-.05,st.ITG),new Da("Miss",16724016,0,-.1,st.ITG),new Wr("Hold",321.5,1,-.008),new Wr("Roll",351.5,1,-.008),new Ba(0,-.08),new Ra(71.5,-1,-.05)],103.5),WATERFALL:new Je([new vt("w0","Masterful",16711870,15,10,.008,st.WATERFALL),new vt("w2","Awesome",16776960,30,9,.008,st.WATERFALL),new vt("w3","Solid",51200,50,6,.008,st.WATERFALL),new vt("w4","OK",33023,100,3,.004,st.WATERFALL),new vt("w5","Fault",8421504,160,0,0,st.WATERFALL),new Da("Miss",16724016,0,-.1,st.WATERFALL),new Wr("Hold",300,6,-.008),new Wr("Roll",350,6,-.008),new Ba(0,-.08),new Ra(71.5,-3,-.05)],100)};windows=[];holdWindows={};missWindow;droppedWindow;mineWindow;hideLimitMS;constructor(e,t){this.missWindow=new Da("Miss",16724016,-12,-.1,st.ITG),this.droppedWindow=new Ba(0,-.08),this.mineWindow=new Ra(71.5,-1,-.05);for(const r of e)Gi(r)?this.windows.push(r):ri(r)?this.missWindow=r:Er(r)?this.holdWindows[r.noteType]=r:tn(r)?this.droppedWindow=r:Zr(r)&&(this.mineWindow=r);this.windows.sort((r,s)=>r.timingWindowMS-s.timingWindowMS),this.hideLimitMS=t}judgeInput(e){for(const t of this.windows)if(t.getTimingWindowMS()/1e3>=Math.abs(e))return t;return this.missWindow}getHeldJudgement(e){return this.holdWindows[e.type]}getMissJudgment(){return this.missWindow}getDroppedJudgment(){return this.droppedWindow}getMineJudgment(){return this.mineWindow}shouldHideNote(e){return e.id!="miss"&&e.timingWindowMS<=this.hideLimitMS}maxWindowMS(){return this.windows.at(-1)?.getTimingWindowMS()??0}getMaxDancePoints(){return Math.max(...this.windows.map(e=>e.dancePoints),this.missWindow.dancePoints)}getMaxHoldDancePoints(e){return Math.max(this.holdWindows[e].dancePoints??0,this.droppedWindow.dancePoints)}getStandardWindows(){return[...this.windows]}getHoldWindows(){return[...Object.values(this.holdWindows)]}static getCollection(e){return this.COLLECTIONS[e]??this.COLLECTIONS.ITG}static getCollections(){return Je.COLLECTIONS}}class tE{}class hn extends tE{chordCohesion=new Map;missNoteIndex=0;holdProgress=[];heldCols=new hm;collection=Je.getCollection("ITG");update(e){if(!e.loadedChart||!e.chartView)return;const r=e.chartView.getTimeWithOffset()-this.collection.maxWindowMS()/1e3*A.audio.rate;let s=-1;for(;e.loadedChart.getNotedata()[this.missNoteIndex]&&e.loadedChart.getNotedata()[this.missNoteIndex].second=e.chartView.chart.getSecondsFromBeat(n.beat+n.hold)&&(n.gameplay.hideNote=!0,e.chartView.doJudgment(n,0,this.collection.getHeldJudgement(n)),this.holdProgress.splice(this.holdProgress.indexOf(n),1),e.gameStats?.addHoldDataPoint(n,this.collection.getHeldJudgement(n)))}for(const n of this.heldCols.getHeldCols()){const a=this.getClosestNote(e.loadedChart.getNotedata(),e.chartView.getTimeWithOffset()-this.collection.getMineJudgment().getTimingWindowMS()/2e3,n,["Mine"],this.collection.getMineJudgment().getTimingWindowMS()/2);a&&(a.gameplay.hasHit=!0,a.gameplay.hideNote=!0,e.chartView.doJudgment(a,0,this.collection.getMineJudgment()),e.gameStats?.addDataPoint([a],this.collection.getMineJudgment(),0),e.mine.play())}}endPlay(e){if(!e.loadedChart||!e.chartView)return;this.collection=Je.getCollection(A.play.timingCollection),this.chordCohesion.clear();for(const n of e.loadedChart.getNotedata())n.type=="Mine"||n.fake||(this.chordCohesion.has(n.beat)||this.chordCohesion.set(n.beat,[]),this.chordCohesion.get(n.beat).push(n));const r=e.chartView.getTimeWithOffset()-this.collection.maxWindowMS()/1e3*A.audio.rate;let s=Mi(e.loadedChart.getNotedata(),r,n=>n.second)+1;s>=1&&r<=e.loadedChart.getNotedata()[s-1].second&&s--,this.missNoteIndex=s,this.holdProgress=[],this.heldCols.reset()}keyDown(e,t){if(!e.loadedChart||!e.chartView)return;const r=e.chartView.getTimeWithOffset(),s=this.getClosestNote(e.loadedChart.getNotedata(),r,t,["Tap","Hold","Roll"]);this.heldCols.keyDown(t);for(const n of this.holdProgress)n.type=="Roll"&&n.col==t&&(n.gameplay.lastHoldActivation=Date.now());s?this.hitNote(e,s,r):e.chartView.keyDown(t)}keyUp(e,t){if(!e.loadedChart||!e.chartView)return;const r=e.chartView.getTimeWithOffset(),s=this.getClosestNote(e.loadedChart.getNotedata(),r,t,["Lift"]);this.heldCols.keyUp(t),e.chartView.keyUp(t),s&&this.hitNote(e,s,r)}shouldAssistTick(e){return!e.fake&&e.type!="Mine"}hitNote(e,t,r){t.gameplay.hasHit=!0,De(t)&&(t.gameplay.lastHoldActivation=Date.now(),e.chartView.activateHold(t.col),this.holdProgress.push(t));const s=this.chordCohesion.get(t.beat);if(s.every(n=>n.gameplay.hasHit)){const n=this.collection.judgeInput((r-t.second)/A.audio.rate),a=this.collection.shouldHideNote(n);s.forEach(o=>{e.chartView.doJudgment(o,(r-o.second)/A.audio.rate,n),a&&nA(o)&&(o.gameplay.hideNote=!0)}),e.gameStats?.addDataPoint(s,n,(r-t.second)/A.audio.rate)}}getClosestNote(e,t,r,s,n){n=n??this.collection.maxWindowMS(),n*=A.audio.rate;const a=t-n/1e3,o=t+n/1e3;let l=Mi(e,a,u=>u.second)+1;l>=1&&a<=e[l-1].second&&l--;let c;for(;e[l]&&e[l].second<=o;){const u=e[l];if(u.gameplay.hasHit||u.col!=r||u.fake||!s.includes(u.type)){l++;continue}(!c||Math.abs(u.second-t)=r.getTimingWindowMS():!1}}function Ds(i,e,t){return i*(1-t)+e*t}function ys(i,e,t){return(t-i)/(e-i)}function de(i,e){return Math.round(i*Math.pow(10,e))/Math.pow(10,e)}function at(i,e,t){return Math.max(e,Math.min(t,i))}function um(i){if(i.length==0)return 0;const e=i.length,t=i.reduce((r,s)=>r+s)/e;return Math.sqrt(i.map(r=>Math.pow(r-t,2)).reduce((r,s)=>r+s)/e)}function zo(i){if(i.length==0)return 0;i=[...i],i.sort((t,r)=>t-r);const e=Math.floor(i.length/2);return i.length%2?i[e]:(i[e-1]+i[e])/2}function iE(i){return i.length==0?0:i.reduce((e,t)=>e+t)/i.length}function fm(i,e){return e?fm(e,i%e):e===0?i:NaN}function pm(i,e){return i*e/fm(i,e)}function Du(i){let e=1;for(let t=0;tDh(p.beat))),Du(d.map(p=>Dh(p.beat+p.hold)))));for(let p=0;p0?`text-shadow: ${s} ${this.dropShadowBlur}px ${i}`:`text-shadow: ${s} ${i}`}reset(){Object.assign(this,Ss.defaultOptions)}onBeforeDraw(){const{fontsDirty:i}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&i?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){const{userAgent:i}=fe.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(i)}set fillGradientStops(i){console.warn("[HTMLTextStyle] fillGradientStops is not supported by HTMLText")}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(i){console.warn("[HTMLTextStyle] fillGradientType is not supported by HTMLText")}get fillGradientType(){return super.fillGradientType}set miterLimit(i){console.warn("[HTMLTextStyle] miterLimit is not supported by HTMLText")}get miterLimit(){return super.miterLimit}set trim(i){console.warn("[HTMLTextStyle] trim is not supported by HTMLText")}get trim(){return super.trim}set textBaseline(i){console.warn("[HTMLTextStyle] textBaseline is not supported by HTMLText")}get textBaseline(){return super.textBaseline}set leading(i){console.warn("[HTMLTextStyle] leading is not supported by HTMLText")}get leading(){return super.leading}set lineJoin(i){console.warn("[HTMLTextStyle] lineJoin is not supported by HTMLText")}get lineJoin(){return super.lineJoin}};let Ln=Ss;Ln.availableFonts={};Ln.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};const Cs=class extends Be{constructor(i="",e={}){super(ie.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this._loading=!1,this.localStyleID=-1,this.dirty=!1,this.ownsStyle=!1;const t=new Image,r=ie.from(t,{scaleMode:fe.SCALE_MODE,resourceOptions:{autoLoad:!1}});r.orig=new Ie,r.trim=new Ie,this.texture=r;const s="http://www.w3.org/2000/svg",n="http://www.w3.org/1999/xhtml",a=document.createElementNS(s,"svg"),o=document.createElementNS(s,"foreignObject"),l=document.createElementNS(n,"div"),c=document.createElementNS(n,"style");o.setAttribute("width","10000"),o.setAttribute("height","10000"),o.style.overflow="hidden",a.appendChild(o),this.maxWidth=Cs.defaultMaxWidth,this.maxHeight=Cs.defaultMaxHeight,this._domElement=l,this._styleElement=c,this._svgRoot=a,this._foreignObject=o,this._foreignObject.appendChild(c),this._foreignObject.appendChild(l),this._image=t,this._loadImage=new Image,this._autoResolution=Cs.defaultAutoResolution,this._resolution=Cs.defaultResolution??fe.RESOLUTION,this.text=i,this.style=e}measureText(i){const{text:e,style:t,resolution:r}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},i);Object.assign(this._domElement,{innerHTML:e,style:t.toCSS(r)}),this._styleElement.textContent=t.toGlobalCSS(),document.body.appendChild(this._svgRoot);const s=this._domElement.getBoundingClientRect();this._svgRoot.remove();const n=Math.min(this.maxWidth,Math.ceil(s.width)),a=Math.min(this.maxHeight,Math.ceil(s.height));return this._svgRoot.setAttribute("width",n.toString()),this._svgRoot.setAttribute("height",a.toString()),e!==this._text&&(this._domElement.innerHTML=this._text),t!==this._style&&(Object.assign(this._domElement,{style:this._style?.toCSS(r)}),this._styleElement.textContent=this._style?.toGlobalCSS()),{width:n+t.padding*2,height:a+t.padding*2}}async updateText(i=!0){const{style:e,_image:t,_loadImage:r}=this;if(this.localStyleID!==e.styleID&&(this.dirty=!0,this.localStyleID=e.styleID),!this.dirty&&i)return;const{width:s,height:n}=this.measureText();t.width=r.width=Math.ceil(Math.max(1,s)),t.height=r.height=Math.ceil(Math.max(1,n)),this._loading||(this._loading=!0,await new Promise(a=>{r.onload=async()=>{await e.onBeforeDraw(),this._loading=!1,t.src=r.src,r.onload=null,r.src="",this.updateTexture(),a()};const o=new XMLSerializer().serializeToString(this._svgRoot);r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(o)}`}))}get source(){return this._image}updateTexture(){const{style:i,texture:e,_image:t,resolution:r}=this,{padding:s}=i,{baseTexture:n}=e;e.trim.width=e._frame.width=t.width/r,e.trim.height=e._frame.height=t.height/r,e.trim.x=-s,e.trim.y=-s,e.orig.width=e._frame.width-s*2,e.orig.height=e._frame.height-s*2,this._onTextureUpdate(),n.setRealSize(t.width,t.height,r),this.dirty=!1}_render(i){this._autoResolution&&this._resolution!==i.resolution&&(this._resolution=i.resolution,this.dirty=!0),this.updateText(!0),super._render(i)}_renderCanvas(i){this._autoResolution&&this._resolution!==i.resolution&&(this._resolution=i.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(i)}getLocalBounds(i){return this.updateText(!0),super.getLocalBounds(i)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(i){typeof i=="boolean"&&(i={children:i}),i=Object.assign({},Cs.defaultDestroyOptions,i),super.destroy(i);const e=null;this.ownsStyle&&this._style?.cleanFonts(),this._style=e,this._svgRoot?.remove(),this._svgRoot=e,this._domElement?.remove(),this._domElement=e,this._foreignObject?.remove(),this._foreignObject=e,this._styleElement?.remove(),this._styleElement=e,this._loadImage.src="",this._loadImage.onload=null,this._loadImage=e,this._image.src="",this._image=e}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(i){this.updateText(!0);const e=wr(this.scale.x)||1;this.scale.x=e*i/this._image.width/this.resolution,this._width=i}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(i){this.updateText(!0);const e=wr(this.scale.y)||1;this.scale.y=e*i/this._image.height/this.resolution,this._height=i}get style(){return this._style}set style(i){this._style!==i&&(i=i||{},i instanceof Ln?(this.ownsStyle=!1,this._style=i):i instanceof Ji?(console.warn("[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle"),this.ownsStyle=!0,this._style=Ln.from(i)):(this.ownsStyle=!0,this._style=new Ln(i)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(i){i=String(i===""||i===null||i===void 0?" ":i),i=this.sanitiseText(i),this._text!==i&&(this._text=i,this.dirty=!0)}get resolution(){return this._resolution}set resolution(i){this._autoResolution=!1,this._resolution!==i&&(this._resolution=i,this.dirty=!0)}sanitiseText(i){return i.replace(/
/gi,"
").replace(/
/gi,"
").replace(/ /gi," ")}};let Lo=Cs;Lo.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0};Lo.defaultMaxWidth=2024;Lo.defaultMaxHeight=2024;Lo.defaultAutoResolution=!0;var Gt="top",oi="bottom",li="right",Wt="left",uc="auto",ia=[Gt,oi,li,Wt],qs="start",Xn="end",C_="clippingParents",Fp="viewport",wn="popper",M_="reference",lu=ia.reduce(function(i,e){return i.concat([e+"-"+qs,e+"-"+Xn])},[]),Np=[].concat(ia,[uc]).reduce(function(i,e){return i.concat([e,e+"-"+qs,e+"-"+Xn])},[]),k_="beforeRead",I_="read",P_="afterRead",B_="beforeMain",R_="main",D_="afterMain",L_="beforeWrite",O_="write",F_="afterWrite",N_=[k_,I_,P_,B_,R_,D_,L_,O_,F_];function zi(i){return i?(i.nodeName||"").toLowerCase():null}function qt(i){if(i==null)return window;if(i.toString()!=="[object Window]"){var e=i.ownerDocument;return e&&e.defaultView||window}return i}function os(i){var e=qt(i).Element;return i instanceof e||i instanceof Element}function ai(i){var e=qt(i).HTMLElement;return i instanceof e||i instanceof HTMLElement}function fc(i){if(typeof ShadowRoot>"u")return!1;var e=qt(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function U_(i){var e=i.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},s=e.attributes[t]||{},n=e.elements[t];!ai(n)||!zi(n)||(Object.assign(n.style,r),Object.keys(s).forEach(function(a){var o=s[a];o===!1?n.removeAttribute(a):n.setAttribute(a,o===!0?"":o)}))})}function H_(i){var e=i.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var s=e.elements[r],n=e.attributes[r]||{},a=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),o=a.reduce(function(l,c){return l[c]="",l},{});!ai(s)||!zi(s)||(Object.assign(s.style,o),Object.keys(n).forEach(function(l){s.removeAttribute(l)}))})}}const Up={name:"applyStyles",enabled:!0,phase:"write",fn:U_,effect:H_,requires:["computeStyles"]};function Hi(i){return i.split("-")[0]}var es=Math.max,mo=Math.min,Ks=Math.round;function Ph(){var i=navigator.userAgentData;return i!=null&&i.brands&&Array.isArray(i.brands)?i.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function Hp(){return!/^((?!chrome|android).)*safari/i.test(Ph())}function Qs(i,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=i.getBoundingClientRect(),s=1,n=1;e&&ai(i)&&(s=i.offsetWidth>0&&Ks(r.width)/i.offsetWidth||1,n=i.offsetHeight>0&&Ks(r.height)/i.offsetHeight||1);var a=os(i)?qt(i):window,o=a.visualViewport,l=!Hp()&&t,c=(r.left+(l&&o?o.offsetLeft:0))/s,u=(r.top+(l&&o?o.offsetTop:0))/n,h=r.width/s,d=r.height/n;return{width:h,height:d,top:u,right:c+h,bottom:u+d,left:c,x:c,y:u}}function pc(i){var e=Qs(i),t=i.offsetWidth,r=i.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:i.offsetLeft,y:i.offsetTop,width:t,height:r}}function Gp(i,e){var t=e.getRootNode&&e.getRootNode();if(i.contains(e))return!0;if(t&&fc(t)){var r=e;do{if(r&&i.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function er(i){return qt(i).getComputedStyle(i)}function G_(i){return["table","td","th"].indexOf(zi(i))>=0}function Rr(i){return((os(i)?i.ownerDocument:i.document)||window.document).documentElement}function Oo(i){return zi(i)==="html"?i:i.assignedSlot||i.parentNode||(fc(i)?i.host:null)||Rr(i)}function hu(i){return!ai(i)||er(i).position==="fixed"?null:i.offsetParent}function W_(i){var e=/firefox/i.test(Ph()),t=/Trident/i.test(Ph());if(t&&ai(i)){var r=er(i);if(r.position==="fixed")return null}var s=Oo(i);for(fc(s)&&(s=s.host);ai(s)&&["html","body"].indexOf(zi(s))<0;){var n=er(s);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return s;s=s.parentNode}return null}function ra(i){for(var e=qt(i),t=hu(i);t&&G_(t)&&er(t).position==="static";)t=hu(t);return t&&(zi(t)==="html"||zi(t)==="body"&&er(t).position==="static")?e:t||W_(i)||e}function mc(i){return["top","bottom"].indexOf(i)>=0?"x":"y"}function On(i,e,t){return es(i,mo(e,t))}function z_(i,e,t){var r=On(i,e,t);return r>t?t:r}function Wp(){return{top:0,right:0,bottom:0,left:0}}function zp(i){return Object.assign({},Wp(),i)}function Vp(i,e){return e.reduce(function(t,r){return t[r]=i,t},{})}var V_=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,zp(typeof e!="number"?e:Vp(e,ia))};function j_(i){var e,t=i.state,r=i.name,s=i.options,n=t.elements.arrow,a=t.modifiersData.popperOffsets,o=Hi(t.placement),l=mc(o),c=[Wt,li].indexOf(o)>=0,u=c?"height":"width";if(!(!n||!a)){var h=V_(s.padding,t),d=pc(n),f=l==="y"?Gt:Wt,p=l==="y"?oi:li,m=t.rects.reference[u]+t.rects.reference[l]-a[l]-t.rects.popper[u],g=a[l]-t.rects.reference[l],y=ra(n),b=y?l==="y"?y.clientHeight||0:y.clientWidth||0:0,w=m/2-g/2,v=h[f],E=b-d[u]-h[p],S=b/2-d[u]/2+w,T=On(v,S,E),B=l;t.modifiersData[r]=(e={},e[B]=T,e.centerOffset=T-S,e)}}function X_(i){var e=i.state,t=i.options,r=t.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||Gp(e.elements.popper,s)&&(e.elements.arrow=s))}const Y_={name:"arrow",enabled:!0,phase:"main",fn:j_,effect:X_,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Zs(i){return i.split("-")[1]}var $_={top:"auto",right:"auto",bottom:"auto",left:"auto"};function q_(i,e){var t=i.x,r=i.y,s=e.devicePixelRatio||1;return{x:Ks(t*s)/s||0,y:Ks(r*s)/s||0}}function cu(i){var e,t=i.popper,r=i.popperRect,s=i.placement,n=i.variation,a=i.offsets,o=i.position,l=i.gpuAcceleration,c=i.adaptive,u=i.roundOffsets,h=i.isFixed,d=a.x,f=d===void 0?0:d,p=a.y,m=p===void 0?0:p,g=typeof u=="function"?u({x:f,y:m}):{x:f,y:m};f=g.x,m=g.y;var y=a.hasOwnProperty("x"),b=a.hasOwnProperty("y"),w=Wt,v=Gt,E=window;if(c){var S=ra(t),T="clientHeight",B="clientWidth";if(S===qt(t)&&(S=Rr(t),er(S).position!=="static"&&o==="absolute"&&(T="scrollHeight",B="scrollWidth")),S=S,s===Gt||(s===Wt||s===li)&&n===Xn){v=oi;var k=h&&S===E&&E.visualViewport?E.visualViewport.height:S[T];m-=k-r.height,m*=l?1:-1}if(s===Wt||(s===Gt||s===oi)&&n===Xn){w=li;var D=h&&S===E&&E.visualViewport?E.visualViewport.width:S[B];f-=D-r.width,f*=l?1:-1}}var W=Object.assign({position:o},c&&$_),C=u===!0?q_({x:f,y:m},qt(t)):{x:f,y:m};if(f=C.x,m=C.y,l){var M;return Object.assign({},W,(M={},M[v]=b?"0":"",M[w]=y?"0":"",M.transform=(E.devicePixelRatio||1)<=1?"translate("+f+"px, "+m+"px)":"translate3d("+f+"px, "+m+"px, 0)",M))}return Object.assign({},W,(e={},e[v]=b?m+"px":"",e[w]=y?f+"px":"",e.transform="",e))}function K_(i){var e=i.state,t=i.options,r=t.gpuAcceleration,s=r===void 0?!0:r,n=t.adaptive,a=n===void 0?!0:n,o=t.roundOffsets,l=o===void 0?!0:o,c={placement:Hi(e.placement),variation:Zs(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,cu(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:a,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,cu(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const Q_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:K_,data:{}};var Pa={passive:!0};function Z_(i){var e=i.state,t=i.instance,r=i.options,s=r.scroll,n=s===void 0?!0:s,a=r.resize,o=a===void 0?!0:a,l=qt(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&c.forEach(function(u){u.addEventListener("scroll",t.update,Pa)}),o&&l.addEventListener("resize",t.update,Pa),function(){n&&c.forEach(function(u){u.removeEventListener("scroll",t.update,Pa)}),o&&l.removeEventListener("resize",t.update,Pa)}}const J_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Z_,data:{}};var ex={left:"right",right:"left",bottom:"top",top:"bottom"};function qa(i){return i.replace(/left|right|bottom|top/g,function(e){return ex[e]})}var tx={start:"end",end:"start"};function du(i){return i.replace(/start|end/g,function(e){return tx[e]})}function gc(i){var e=qt(i),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function yc(i){return Qs(Rr(i)).left+gc(i).scrollLeft}function ix(i,e){var t=qt(i),r=Rr(i),s=t.visualViewport,n=r.clientWidth,a=r.clientHeight,o=0,l=0;if(s){n=s.width,a=s.height;var c=Hp();(c||!c&&e==="fixed")&&(o=s.offsetLeft,l=s.offsetTop)}return{width:n,height:a,x:o+yc(i),y:l}}function rx(i){var e,t=Rr(i),r=gc(i),s=(e=i.ownerDocument)==null?void 0:e.body,n=es(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),a=es(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),o=-r.scrollLeft+yc(i),l=-r.scrollTop;return er(s||t).direction==="rtl"&&(o+=es(t.clientWidth,s?s.clientWidth:0)-n),{width:n,height:a,x:o,y:l}}function vc(i){var e=er(i),t=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+r)}function jp(i){return["html","body","#document"].indexOf(zi(i))>=0?i.ownerDocument.body:ai(i)&&vc(i)?i:jp(Oo(i))}function Fn(i,e){var t;e===void 0&&(e=[]);var r=jp(i),s=r===((t=i.ownerDocument)==null?void 0:t.body),n=qt(r),a=s?[n].concat(n.visualViewport||[],vc(r)?r:[]):r,o=e.concat(a);return s?o:o.concat(Fn(Oo(a)))}function Bh(i){return Object.assign({},i,{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height})}function sx(i,e){var t=Qs(i,!1,e==="fixed");return t.top=t.top+i.clientTop,t.left=t.left+i.clientLeft,t.bottom=t.top+i.clientHeight,t.right=t.left+i.clientWidth,t.width=i.clientWidth,t.height=i.clientHeight,t.x=t.left,t.y=t.top,t}function uu(i,e,t){return e===Fp?Bh(ix(i,t)):os(e)?sx(e,t):Bh(rx(Rr(i)))}function nx(i){var e=Fn(Oo(i)),t=["absolute","fixed"].indexOf(er(i).position)>=0,r=t&&ai(i)?ra(i):i;return os(r)?e.filter(function(s){return os(s)&&Gp(s,r)&&zi(s)!=="body"}):[]}function ax(i,e,t,r){var s=e==="clippingParents"?nx(i):[].concat(e),n=[].concat(s,[t]),a=n[0],o=n.reduce(function(l,c){var u=uu(i,c,r);return l.top=es(u.top,l.top),l.right=mo(u.right,l.right),l.bottom=mo(u.bottom,l.bottom),l.left=es(u.left,l.left),l},uu(i,a,r));return o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}function Xp(i){var e=i.reference,t=i.element,r=i.placement,s=r?Hi(r):null,n=r?Zs(r):null,a=e.x+e.width/2-t.width/2,o=e.y+e.height/2-t.height/2,l;switch(s){case Gt:l={x:a,y:e.y-t.height};break;case oi:l={x:a,y:e.y+e.height};break;case li:l={x:e.x+e.width,y:o};break;case Wt:l={x:e.x-t.width,y:o};break;default:l={x:e.x,y:e.y}}var c=s?mc(s):null;if(c!=null){var u=c==="y"?"height":"width";switch(n){case qs:l[c]=l[c]-(e[u]/2-t[u]/2);break;case Xn:l[c]=l[c]+(e[u]/2-t[u]/2);break}}return l}function Yn(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=r===void 0?i.placement:r,n=t.strategy,a=n===void 0?i.strategy:n,o=t.boundary,l=o===void 0?C_:o,c=t.rootBoundary,u=c===void 0?Fp:c,h=t.elementContext,d=h===void 0?wn:h,f=t.altBoundary,p=f===void 0?!1:f,m=t.padding,g=m===void 0?0:m,y=zp(typeof g!="number"?g:Vp(g,ia)),b=d===wn?M_:wn,w=i.rects.popper,v=i.elements[p?b:d],E=ax(os(v)?v:v.contextElement||Rr(i.elements.popper),l,u,a),S=Qs(i.elements.reference),T=Xp({reference:S,element:w,strategy:"absolute",placement:s}),B=Bh(Object.assign({},w,T)),k=d===wn?B:S,D={top:E.top-k.top+y.top,bottom:k.bottom-E.bottom+y.bottom,left:E.left-k.left+y.left,right:k.right-E.right+y.right},W=i.modifiersData.offset;if(d===wn&&W){var C=W[s];Object.keys(D).forEach(function(M){var _=[li,oi].indexOf(M)>=0?1:-1,U=[Gt,oi].indexOf(M)>=0?"y":"x";D[M]+=C[U]*_})}return D}function ox(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=t.boundary,n=t.rootBoundary,a=t.padding,o=t.flipVariations,l=t.allowedAutoPlacements,c=l===void 0?Np:l,u=Zs(r),h=u?o?lu:lu.filter(function(p){return Zs(p)===u}):ia,d=h.filter(function(p){return c.indexOf(p)>=0});d.length===0&&(d=h);var f=d.reduce(function(p,m){return p[m]=Yn(i,{placement:m,boundary:s,rootBoundary:n,padding:a})[Hi(m)],p},{});return Object.keys(f).sort(function(p,m){return f[p]-f[m]})}function lx(i){if(Hi(i)===uc)return[];var e=qa(i);return[du(i),e,du(e)]}function hx(i){var e=i.state,t=i.options,r=i.name;if(!e.modifiersData[r]._skip){for(var s=t.mainAxis,n=s===void 0?!0:s,a=t.altAxis,o=a===void 0?!0:a,l=t.fallbackPlacements,c=t.padding,u=t.boundary,h=t.rootBoundary,d=t.altBoundary,f=t.flipVariations,p=f===void 0?!0:f,m=t.allowedAutoPlacements,g=e.options.placement,y=Hi(g),b=y===g,w=l||(b||!p?[qa(g)]:lx(g)),v=[g].concat(w).reduce(function(ee,Q){return ee.concat(Hi(Q)===uc?ox(e,{placement:Q,boundary:u,rootBoundary:h,padding:c,flipVariations:p,allowedAutoPlacements:m}):Q)},[]),E=e.rects.reference,S=e.rects.popper,T=new Map,B=!0,k=v[0],D=0;D=0,U=_?"width":"height",Y=Yn(e,{placement:W,boundary:u,rootBoundary:h,altBoundary:d,padding:c}),z=_?M?li:Wt:M?oi:Gt;E[U]>S[U]&&(z=qa(z));var ne=qa(z),V=[];if(n&&V.push(Y[C]<=0),o&&V.push(Y[z]<=0,Y[ne]<=0),V.every(function(ee){return ee})){k=W,B=!1;break}T.set(W,V)}if(B)for(var $=p?3:1,O=function(Q){var ge=v.find(function(Te){var me=T.get(Te);if(me)return me.slice(0,Q).every(function(be){return be})});if(ge)return k=ge,"break"},N=$;N>0;N--){var re=O(N);if(re==="break")break}e.placement!==k&&(e.modifiersData[r]._skip=!0,e.placement=k,e.reset=!0)}}const cx={name:"flip",enabled:!0,phase:"main",fn:hx,requiresIfExists:["offset"],data:{_skip:!1}};function fu(i,e,t){return t===void 0&&(t={x:0,y:0}),{top:i.top-e.height-t.y,right:i.right-e.width+t.x,bottom:i.bottom-e.height+t.y,left:i.left-e.width-t.x}}function pu(i){return[Gt,li,oi,Wt].some(function(e){return i[e]>=0})}function dx(i){var e=i.state,t=i.name,r=e.rects.reference,s=e.rects.popper,n=e.modifiersData.preventOverflow,a=Yn(e,{elementContext:"reference"}),o=Yn(e,{altBoundary:!0}),l=fu(a,r),c=fu(o,s,n),u=pu(l),h=pu(c);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:u,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":h})}const ux={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:dx};function fx(i,e,t){var r=Hi(i),s=[Wt,Gt].indexOf(r)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:i})):t,a=n[0],o=n[1];return a=a||0,o=(o||0)*s,[Wt,li].indexOf(r)>=0?{x:o,y:a}:{x:a,y:o}}function px(i){var e=i.state,t=i.options,r=i.name,s=t.offset,n=s===void 0?[0,0]:s,a=Np.reduce(function(u,h){return u[h]=fx(h,e.rects,n),u},{}),o=a[e.placement],l=o.x,c=o.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=a}const mx={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:px};function gx(i){var e=i.state,t=i.name;e.modifiersData[t]=Xp({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const yx={name:"popperOffsets",enabled:!0,phase:"read",fn:gx,data:{}};function vx(i){return i==="x"?"y":"x"}function bx(i){var e=i.state,t=i.options,r=i.name,s=t.mainAxis,n=s===void 0?!0:s,a=t.altAxis,o=a===void 0?!1:a,l=t.boundary,c=t.rootBoundary,u=t.altBoundary,h=t.padding,d=t.tether,f=d===void 0?!0:d,p=t.tetherOffset,m=p===void 0?0:p,g=Yn(e,{boundary:l,rootBoundary:c,padding:h,altBoundary:u}),y=Hi(e.placement),b=Zs(e.placement),w=!b,v=mc(y),E=vx(v),S=e.modifiersData.popperOffsets,T=e.rects.reference,B=e.rects.popper,k=typeof m=="function"?m(Object.assign({},e.rects,{placement:e.placement})):m,D=typeof k=="number"?{mainAxis:k,altAxis:k}:Object.assign({mainAxis:0,altAxis:0},k),W=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,C={x:0,y:0};if(S){if(n){var M,_=v==="y"?Gt:Wt,U=v==="y"?oi:li,Y=v==="y"?"height":"width",z=S[v],ne=z+g[_],V=z-g[U],$=f?-B[Y]/2:0,O=b===qs?T[Y]:B[Y],N=b===qs?-B[Y]:-T[Y],re=e.elements.arrow,ee=f&&re?pc(re):{width:0,height:0},Q=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:Wp(),ge=Q[_],Te=Q[U],me=On(0,T[Y],ee[Y]),be=w?T[Y]/2-$-me-ge-D.mainAxis:O-me-ge-D.mainAxis,Se=w?-T[Y]/2+$+me+Te+D.mainAxis:N+me+Te+D.mainAxis,we=e.elements.arrow&&ra(e.elements.arrow),Re=we?v==="y"?we.clientTop||0:we.clientLeft||0:0,Le=(M=W?.[v])!=null?M:0,x=z+be-Le-Re,K=z+Se-Le,X=On(f?mo(ne,x):ne,z,f?es(V,K):V);S[v]=X,C[v]=X-z}if(o){var R,P=v==="x"?Gt:Wt,H=v==="x"?oi:li,J=S[E],te=E==="y"?"height":"width",j=J+g[P],ae=J-g[H],ue=[Gt,Wt].indexOf(y)!==-1,oe=(R=W?.[E])!=null?R:0,ye=ue?j:J-T[te]-B[te]-oe+D.altAxis,Ve=ue?J+T[te]+B[te]-oe-D.altAxis:ae,Pe=f&&ue?z_(ye,J,Ve):On(f?ye:j,J,f?Ve:ae);S[E]=Pe,C[E]=Pe-J}e.modifiersData[r]=C}}const wx={name:"preventOverflow",enabled:!0,phase:"main",fn:bx,requiresIfExists:["offset"]};function _x(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function xx(i){return i===qt(i)||!ai(i)?gc(i):_x(i)}function Ax(i){var e=i.getBoundingClientRect(),t=Ks(e.width)/i.offsetWidth||1,r=Ks(e.height)/i.offsetHeight||1;return t!==1||r!==1}function Ex(i,e,t){t===void 0&&(t=!1);var r=ai(e),s=ai(e)&&Ax(e),n=Rr(e),a=Qs(i,s,t),o={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((zi(e)!=="body"||vc(n))&&(o=xx(e)),ai(e)?(l=Qs(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):n&&(l.x=yc(n))),{x:a.left+o.scrollLeft-l.x,y:a.top+o.scrollTop-l.y,width:a.width,height:a.height}}function Tx(i){var e=new Map,t=new Set,r=[];i.forEach(function(n){e.set(n.name,n)});function s(n){t.add(n.name);var a=[].concat(n.requires||[],n.requiresIfExists||[]);a.forEach(function(o){if(!t.has(o)){var l=e.get(o);l&&s(l)}}),r.push(n)}return i.forEach(function(n){t.has(n.name)||s(n)}),r}function Sx(i){var e=Tx(i);return N_.reduce(function(t,r){return t.concat(e.filter(function(s){return s.phase===r}))},[])}function Cx(i){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(i())})})),e}}function Mx(i){var e=i.reduce(function(t,r){var s=t[r.name];return t[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var mu={placement:"bottom",modifiers:[],strategy:"absolute"};function gu(){for(var i=arguments.length,e=new Array(i),t=0;t-1}function Qp(i,e){return typeof i=="function"?i.apply(void 0,e):i}function yu(i,e){if(e===0)return i;var t;return function(r){clearTimeout(t),t=setTimeout(function(){i(r)},e)}}function Dx(i){return i.split(/\s+/).filter(Boolean)}function Ms(i){return[].concat(i)}function vu(i,e){i.indexOf(e)===-1&&i.push(e)}function Lx(i){return i.filter(function(e,t){return i.indexOf(e)===t})}function Ox(i){return i.split("-")[0]}function go(i){return[].slice.call(i)}function bu(i){return Object.keys(i).reduce(function(e,t){return i[t]!==void 0&&(e[t]=i[t]),e},{})}function Nn(){return document.createElement("div")}function Fo(i){return["Element","Fragment"].some(function(e){return bc(i,e)})}function Fx(i){return bc(i,"NodeList")}function Nx(i){return bc(i,"MouseEvent")}function Ux(i){return!!(i&&i._tippy&&i._tippy.reference===i)}function Hx(i){return Fo(i)?[i]:Fx(i)?go(i):Array.isArray(i)?i:go(document.querySelectorAll(i))}function Dl(i,e){i.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function wu(i,e){i.forEach(function(t){t&&t.setAttribute("data-state",e)})}function Gx(i){var e,t=Ms(i),r=t[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function Wx(i,e){var t=e.clientX,r=e.clientY;return i.every(function(s){var n=s.popperRect,a=s.popperState,o=s.props,l=o.interactiveBorder,c=Ox(a.placement),u=a.modifiersData.offset;if(!u)return!0;var h=c==="bottom"?u.top.y:0,d=c==="top"?u.bottom.y:0,f=c==="right"?u.left.x:0,p=c==="left"?u.right.x:0,m=n.top-r+h>l,g=r-n.bottom-d>l,y=n.left-t+f>l,b=t-n.right-p>l;return m||g||y||b})}function Ll(i,e,t){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(s){i[r](s,t)})}function _u(i,e){for(var t=e;t;){var r;if(i.contains(t))return!0;t=t.getRootNode==null||(r=t.getRootNode())==null?void 0:r.host}return!1}var Fi={isTouch:!1},xu=0;function zx(){Fi.isTouch||(Fi.isTouch=!0,window.performance&&document.addEventListener("mousemove",Zp))}function Zp(){var i=performance.now();i-xu<20&&(Fi.isTouch=!1,document.removeEventListener("mousemove",Zp)),xu=i}function Vx(){var i=document.activeElement;if(Ux(i)){var e=i._tippy;i.blur&&!e.state.isVisible&&i.blur()}}function jx(){document.addEventListener("touchstart",zx,Gr),window.addEventListener("blur",Vx)}var Xx=typeof window<"u"&&typeof document<"u",Yx=Xx?!!window.msCrypto:!1,$x={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},qx={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},Ai=Object.assign({appendTo:Kp,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},$x,qx),Kx=Object.keys(Ai),Qx=function(e){var t=Object.keys(e);t.forEach(function(r){Ai[r]=e[r]})};function Jp(i){var e=i.plugins||[],t=e.reduce(function(r,s){var n=s.name,a=s.defaultValue;if(n){var o;r[n]=i[n]!==void 0?i[n]:(o=Ai[n])!=null?o:a}return r},{});return Object.assign({},i,t)}function Zx(i,e){var t=e?Object.keys(Jp(Object.assign({},Ai,{plugins:e}))):Kx,r=t.reduce(function(s,n){var a=(i.getAttribute("data-tippy-"+n)||"").trim();if(!a)return s;if(n==="content")s[n]=a;else try{s[n]=JSON.parse(a)}catch{s[n]=a}return s},{});return r}function Au(i,e){var t=Object.assign({},e,{content:Qp(e.content,[i])},e.ignoreAttributes?{}:Zx(i,e.plugins));return t.aria=Object.assign({},Ai.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}var Jx=function(){return"innerHTML"};function Rh(i,e){i[Jx()]=e}function Eu(i){var e=Nn();return i===!0?e.className=$p:(e.className=qp,Fo(i)?e.appendChild(i):Rh(e,i)),e}function Tu(i,e){Fo(e.content)?(Rh(i,""),i.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?Rh(i,e.content):i.textContent=e.content)}function Dh(i){var e=i.firstElementChild,t=go(e.children);return{box:e,content:t.find(function(r){return r.classList.contains(Yp)}),arrow:t.find(function(r){return r.classList.contains($p)||r.classList.contains(qp)}),backdrop:t.find(function(r){return r.classList.contains(Rx)})}}function em(i){var e=Nn(),t=Nn();t.className=Bx,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var r=Nn();r.className=Yp,r.setAttribute("data-state","hidden"),Tu(r,i.props),e.appendChild(t),t.appendChild(r),s(i.props,i.props);function s(n,a){var o=Dh(e),l=o.box,c=o.content,u=o.arrow;a.theme?l.setAttribute("data-theme",a.theme):l.removeAttribute("data-theme"),typeof a.animation=="string"?l.setAttribute("data-animation",a.animation):l.removeAttribute("data-animation"),a.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof a.maxWidth=="number"?a.maxWidth+"px":a.maxWidth,a.role?l.setAttribute("role",a.role):l.removeAttribute("role"),(n.content!==a.content||n.allowHTML!==a.allowHTML)&&Tu(c,i.props),a.arrow?u?n.arrow!==a.arrow&&(l.removeChild(u),l.appendChild(Eu(a.arrow))):l.appendChild(Eu(a.arrow)):u&&l.removeChild(u)}return{popper:e,onUpdate:s}}em.$$tippy=!0;var eA=1,Ba=[],Ol=[];function tA(i,e){var t=Au(i,Object.assign({},Ai,Jp(bu(e)))),r,s,n,a=!1,o=!1,l=!1,c=!1,u,h,d,f=[],p=yu(x,t.interactiveDebounce),m,g=eA++,y=null,b=Lx(t.plugins),w={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},v={id:g,reference:i,popper:Nn(),popperInstance:y,props:t,state:w,plugins:b,clearDelayTimeouts:ye,setProps:Ve,setContent:Pe,show:Et,hide:It,hideWithInteractivity:Lt,enable:ue,disable:oe,unmount:I,destroy:F};if(!t.render)return v;var E=t.render(v),S=E.popper,T=E.onUpdate;S.setAttribute("data-tippy-root",""),S.id="tippy-"+v.id,v.popper=S,i._tippy=v,S._tippy=v;var B=b.map(function(L){return L.fn(v)}),k=i.hasAttribute("aria-expanded");return we(),$(),z(),ne("onCreate",[v]),t.showOnCreate&&j(),S.addEventListener("mouseenter",function(){v.props.interactive&&v.state.isVisible&&v.clearDelayTimeouts()}),S.addEventListener("mouseleave",function(){v.props.interactive&&v.props.trigger.indexOf("mouseenter")>=0&&_().addEventListener("mousemove",p)}),v;function D(){var L=v.props.touch;return Array.isArray(L)?L:[L,0]}function W(){return D()[0]==="hold"}function C(){var L;return!!((L=v.props.render)!=null&&L.$$tippy)}function M(){return m||i}function _(){var L=M().parentNode;return L?Gx(L):document}function U(){return Dh(S)}function Y(L){return v.state.isMounted&&!v.state.isVisible||Fi.isTouch||u&&u.type==="focus"?0:Rl(v.props.delay,L?0:1,Ai.delay)}function z(L){L===void 0&&(L=!1),S.style.pointerEvents=v.props.interactive&&!L?"":"none",S.style.zIndex=""+v.props.zIndex}function ne(L,G,q){if(q===void 0&&(q=!0),B.forEach(function(he){he[L]&&he[L].apply(he,G)}),q){var le;(le=v.props)[L].apply(le,G)}}function V(){var L=v.props.aria;if(L.content){var G="aria-"+L.content,q=S.id,le=Ms(v.props.triggerTarget||i);le.forEach(function(he){var Ce=he.getAttribute(G);if(v.state.isVisible)he.setAttribute(G,Ce?Ce+" "+q:q);else{var ke=Ce&&Ce.replace(q,"").trim();ke?he.setAttribute(G,ke):he.removeAttribute(G)}})}}function $(){if(!(k||!v.props.aria.expanded)){var L=Ms(v.props.triggerTarget||i);L.forEach(function(G){v.props.interactive?G.setAttribute("aria-expanded",v.state.isVisible&&G===M()?"true":"false"):G.removeAttribute("aria-expanded")})}}function O(){_().removeEventListener("mousemove",p),Ba=Ba.filter(function(L){return L!==p})}function N(L){if(!(Fi.isTouch&&(l||L.type==="mousedown"))){var G=L.composedPath&&L.composedPath()[0]||L.target;if(!(v.props.interactive&&_u(S,G))){if(Ms(v.props.triggerTarget||i).some(function(q){return _u(q,G)})){if(Fi.isTouch||v.state.isVisible&&v.props.trigger.indexOf("click")>=0)return}else ne("onClickOutside",[v,L]);v.props.hideOnClick===!0&&(v.clearDelayTimeouts(),v.hide(),o=!0,setTimeout(function(){o=!1}),v.state.isMounted||ge())}}}function re(){l=!0}function ee(){l=!1}function Q(){var L=_();L.addEventListener("mousedown",N,!0),L.addEventListener("touchend",N,Gr),L.addEventListener("touchstart",ee,Gr),L.addEventListener("touchmove",re,Gr)}function ge(){var L=_();L.removeEventListener("mousedown",N,!0),L.removeEventListener("touchend",N,Gr),L.removeEventListener("touchstart",ee,Gr),L.removeEventListener("touchmove",re,Gr)}function Te(L,G){be(L,function(){!v.state.isVisible&&S.parentNode&&S.parentNode.contains(S)&&G()})}function me(L,G){be(L,G)}function be(L,G){var q=U().box;function le(he){he.target===q&&(Ll(q,"remove",le),G())}if(L===0)return G();Ll(q,"remove",h),Ll(q,"add",le),h=le}function Se(L,G,q){q===void 0&&(q=!1);var le=Ms(v.props.triggerTarget||i);le.forEach(function(he){he.addEventListener(L,G,q),f.push({node:he,eventType:L,handler:G,options:q})})}function we(){W()&&(Se("touchstart",Le,{passive:!0}),Se("touchend",K,{passive:!0})),Dx(v.props.trigger).forEach(function(L){if(L!=="manual")switch(Se(L,Le),L){case"mouseenter":Se("mouseleave",K);break;case"focus":Se(Yx?"focusout":"blur",X);break;case"focusin":Se("focusout",X);break}})}function Re(){f.forEach(function(L){var G=L.node,q=L.eventType,le=L.handler,he=L.options;G.removeEventListener(q,le,he)}),f=[]}function Le(L){var G,q=!1;if(!(!v.state.isEnabled||R(L)||o)){var le=((G=u)==null?void 0:G.type)==="focus";u=L,m=L.currentTarget,$(),!v.state.isVisible&&Nx(L)&&Ba.forEach(function(he){return he(L)}),L.type==="click"&&(v.props.trigger.indexOf("mouseenter")<0||a)&&v.props.hideOnClick!==!1&&v.state.isVisible?q=!0:j(L),L.type==="click"&&(a=!q),q&&!le&&ae(L)}}function x(L){var G=L.target,q=M().contains(G)||S.contains(G);if(!(L.type==="mousemove"&&q)){var le=te().concat(S).map(function(he){var Ce,ke=he._tippy,Xe=(Ce=ke.popperInstance)==null?void 0:Ce.state;return Xe?{popperRect:he.getBoundingClientRect(),popperState:Xe,props:t}:null}).filter(Boolean);Wx(le,L)&&(O(),ae(L))}}function K(L){var G=R(L)||v.props.trigger.indexOf("click")>=0&&a;if(!G){if(v.props.interactive){v.hideWithInteractivity(L);return}ae(L)}}function X(L){v.props.trigger.indexOf("focusin")<0&&L.target!==M()||v.props.interactive&&L.relatedTarget&&S.contains(L.relatedTarget)||ae(L)}function R(L){return Fi.isTouch?W()!==L.type.indexOf("touch")>=0:!1}function P(){H();var L=v.props,G=L.popperOptions,q=L.placement,le=L.offset,he=L.getReferenceClientRect,Ce=L.moveTransition,ke=C()?Dh(S).arrow:null,Xe=he?{getBoundingClientRect:he,contextElement:he.contextElement||M()}:i,Ye={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(ci){var nr=ci.state;if(C()){var Bm=U(),$o=Bm.box;["placement","reference-hidden","escaped"].forEach(function(na){na==="placement"?$o.setAttribute("data-placement",nr.placement):nr.attributes.popper["data-popper-"+na]?$o.setAttribute("data-"+na,""):$o.removeAttribute("data-"+na)}),nr.attributes.popper={}}}},Qe=[{name:"offset",options:{offset:le}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Ce}},Ye];C()&&ke&&Qe.push({name:"arrow",options:{element:ke,padding:3}}),Qe.push.apply(Qe,G?.modifiers||[]),v.popperInstance=Px(Xe,S,Object.assign({},G,{placement:q,onFirstUpdate:d,modifiers:Qe}))}function H(){v.popperInstance&&(v.popperInstance.destroy(),v.popperInstance=null)}function J(){var L=v.props.appendTo,G,q=M();v.props.interactive&&L===Kp||L==="parent"?G=q.parentNode:G=Qp(L,[q]),G.contains(S)||G.appendChild(S),v.state.isMounted=!0,P()}function te(){return go(S.querySelectorAll("[data-tippy-root]"))}function j(L){v.clearDelayTimeouts(),L&&ne("onTrigger",[v,L]),Q();var G=Y(!0),q=D(),le=q[0],he=q[1];Fi.isTouch&&le==="hold"&&he&&(G=he),G?r=setTimeout(function(){v.show()},G):v.show()}function ae(L){if(v.clearDelayTimeouts(),ne("onUntrigger",[v,L]),!v.state.isVisible){ge();return}if(!(v.props.trigger.indexOf("mouseenter")>=0&&v.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(L.type)>=0&&a)){var G=Y(!1);G?s=setTimeout(function(){v.state.isVisible&&v.hide()},G):n=requestAnimationFrame(function(){v.hide()})}}function ue(){v.state.isEnabled=!0}function oe(){v.hide(),v.state.isEnabled=!1}function ye(){clearTimeout(r),clearTimeout(s),cancelAnimationFrame(n)}function Ve(L){if(!v.state.isDestroyed){ne("onBeforeUpdate",[v,L]),Re();var G=v.props,q=Au(i,Object.assign({},G,bu(L),{ignoreAttributes:!0}));v.props=q,we(),G.interactiveDebounce!==q.interactiveDebounce&&(O(),p=yu(x,q.interactiveDebounce)),G.triggerTarget&&!q.triggerTarget?Ms(G.triggerTarget).forEach(function(le){le.removeAttribute("aria-expanded")}):q.triggerTarget&&i.removeAttribute("aria-expanded"),$(),z(),T&&T(G,q),v.popperInstance&&(P(),te().forEach(function(le){requestAnimationFrame(le._tippy.popperInstance.forceUpdate)})),ne("onAfterUpdate",[v,L])}}function Pe(L){v.setProps({content:L})}function Et(){var L=v.state.isVisible,G=v.state.isDestroyed,q=!v.state.isEnabled,le=Fi.isTouch&&!v.props.touch,he=Rl(v.props.duration,0,Ai.duration);if(!(L||G||q||le)&&!M().hasAttribute("disabled")&&(ne("onShow",[v],!1),v.props.onShow(v)!==!1)){if(v.state.isVisible=!0,C()&&(S.style.visibility="visible"),z(),Q(),v.state.isMounted||(S.style.transition="none"),C()){var Ce=U(),ke=Ce.box,Xe=Ce.content;Dl([ke,Xe],0)}d=function(){var Qe;if(!(!v.state.isVisible||c)){if(c=!0,S.offsetHeight,S.style.transition=v.props.moveTransition,C()&&v.props.animation){var Ot=U(),ci=Ot.box,nr=Ot.content;Dl([ci,nr],he),wu([ci,nr],"visible")}V(),$(),vu(Ol,v),(Qe=v.popperInstance)==null||Qe.forceUpdate(),ne("onMount",[v]),v.props.animation&&C()&&me(he,function(){v.state.isShown=!0,ne("onShown",[v])})}},J()}}function It(){var L=!v.state.isVisible,G=v.state.isDestroyed,q=!v.state.isEnabled,le=Rl(v.props.duration,1,Ai.duration);if(!(L||G||q)&&(ne("onHide",[v],!1),v.props.onHide(v)!==!1)){if(v.state.isVisible=!1,v.state.isShown=!1,c=!1,a=!1,C()&&(S.style.visibility="hidden"),O(),ge(),z(!0),C()){var he=U(),Ce=he.box,ke=he.content;v.props.animation&&(Dl([Ce,ke],le),wu([Ce,ke],"hidden"))}V(),$(),v.props.animation?C()&&Te(le,v.unmount):v.unmount()}}function Lt(L){_().addEventListener("mousemove",p),vu(Ba,p),p(L)}function I(){v.state.isVisible&&v.hide(),v.state.isMounted&&(H(),te().forEach(function(L){L._tippy.unmount()}),S.parentNode&&S.parentNode.removeChild(S),Ol=Ol.filter(function(L){return L!==v}),v.state.isMounted=!1,ne("onHidden",[v]))}function F(){v.state.isDestroyed||(v.clearDelayTimeouts(),v.unmount(),Re(),delete i._tippy,v.state.isDestroyed=!0,ne("onDestroy",[v]))}}function kr(i,e){e===void 0&&(e={});var t=Ai.plugins.concat(e.plugins||[]);jx();var r=Object.assign({},e,{plugins:t}),s=Hx(i),n=s.reduce(function(a,o){var l=o&&tA(o,r);return l&&a.push(l),a},[]);return Fo(i)?n[0]:n}kr.defaultProps=Ai;kr.setDefaultProps=Qx;kr.currentInput=Fi;Object.assign({},Up,{effect:function(e){var t=e.state,r={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,r.popper),t.styles=r,t.elements.arrow&&Object.assign(t.elements.arrow.style,r.arrow)}});kr.setDefaultProps({render:em});var tm={exports:{}};(function(i){(function(){function e(I,F,L){return I.call.apply(I.bind,arguments)}function t(I,F,L){if(!I)throw Error();if(2=F.f?Ce():I.fonts.load(E(F.a),F.h).then(function(Xe){1<=Xe.length?he():setTimeout(ke,25)},function(){Ce()})}ke()}),q=null,le=new Promise(function(he,Ce){q=setTimeout(Ce,F.f)});Promise.race([le,G]).then(function(){q&&(clearTimeout(q),q=null),F.g(F.a)},function(){F.j(F.a)})};function $(I,F,L,G,q,le,he){this.v=I,this.B=F,this.c=L,this.a=G,this.s=he||"BESbswy",this.f={},this.w=q||3e3,this.u=le||null,this.m=this.j=this.h=this.g=null,this.g=new Y(this.c,this.s),this.h=new Y(this.c,this.s),this.j=new Y(this.c,this.s),this.m=new Y(this.c,this.s),I=new v(this.a.c+",serif",T(this.a)),I=ne(I),this.g.a.style.cssText=I,I=new v(this.a.c+",sans-serif",T(this.a)),I=ne(I),this.h.a.style.cssText=I,I=new v("serif",T(this.a)),I=ne(I),this.j.a.style.cssText=I,I=new v("sans-serif",T(this.a)),I=ne(I),this.m.a.style.cssText=I,z(this.g),z(this.h),z(this.j),z(this.m)}var O={D:"serif",C:"sans-serif"},N=null;function re(){if(N===null){var I=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);N=!!I&&(536>parseInt(I[1],10)||parseInt(I[1],10)===536&&11>=parseInt(I[2],10))}return N}$.prototype.start=function(){this.f.serif=this.j.a.offsetWidth,this.f["sans-serif"]=this.m.a.offsetWidth,this.A=s(),Q(this)};function ee(I,F,L){for(var G in O)if(O.hasOwnProperty(G)&&F===I.f[O[G]]&&L===I.f[O[G]])return!0;return!1}function Q(I){var F=I.g.a.offsetWidth,L=I.h.a.offsetWidth,G;(G=F===I.f.serif&&L===I.f["sans-serif"])||(G=re()&&ee(I,F,L)),G?s()-I.A>=I.w?re()&&ee(I,F,L)&&(I.u===null||I.u.hasOwnProperty(I.a.c))?Te(I,I.v):Te(I,I.B):ge(I):Te(I,I.v)}function ge(I){setTimeout(r(function(){Q(this)},I),50)}function Te(I,F){setTimeout(r(function(){c(this.g.a),c(this.h.a),c(this.j.a),c(this.m.a),F(this.a)},I),0)}function me(I,F,L){this.c=I,this.a=F,this.f=0,this.m=this.j=!1,this.s=L}var be=null;me.prototype.g=function(I){var F=this.a;F.g&&u(F.f,[F.a.c("wf",I.c,T(I).toString(),"active")],[F.a.c("wf",I.c,T(I).toString(),"loading"),F.a.c("wf",I.c,T(I).toString(),"inactive")]),M(F,"fontactive",I),this.m=!0,Se(this)},me.prototype.h=function(I){var F=this.a;if(F.g){var L=h(F.f,F.a.c("wf",I.c,T(I).toString(),"active")),G=[],q=[F.a.c("wf",I.c,T(I).toString(),"loading")];L||G.push(F.a.c("wf",I.c,T(I).toString(),"inactive")),u(F.f,G,q)}M(F,"fontinactive",I),Se(this)};function Se(I){--I.f==0&&I.j&&(I.m?(I=I.a,I.g&&u(I.f,[I.a.c("wf","active")],[I.a.c("wf","loading"),I.a.c("wf","inactive")]),M(I,"active")):C(I.a))}function we(I){this.j=I,this.a=new _,this.h=0,this.f=this.g=!0}we.prototype.load=function(I){this.c=new n(this.j,I.context||this.j),this.g=I.events!==!1,this.f=I.classes!==!1,Le(this,new D(this.c,I),I)};function Re(I,F,L,G,q){var le=--I.h==0;(I.f||I.g)&&setTimeout(function(){var he=q||null,Ce=G||null||{};if(L.length===0&&le)C(F.a);else{F.f+=L.length,le&&(F.j=le);var ke,Xe=[];for(ke=0;ke=0&&h<=1){if(d._volume=h,d._muted)return d;d.usingWebAudio&&d.masterGain.gain.setValueAtTime(h,t.ctx.currentTime);for(var f=0;f=0;d--)h._howls[d].unload();return h.usingWebAudio&&h.ctx&&h.ctx.close!==void 0&&(h.ctx.close(),h.ctx=null,u()),h},codecs:function(h){return(this||t)._codecs[h.replace(/^x-/,"")]},_setup:function(){var h=this||t;if(h.state=h.ctx&&h.ctx.state||"suspended",h._autoSuspend(),!h.usingWebAudio)if(typeof Audio<"u")try{var d=new Audio;d.oncanplaythrough===void 0&&(h._canPlayEvent="canplay")}catch{h.noAudio=!0}else h.noAudio=!0;try{var d=new Audio;d.muted&&(h.noAudio=!0)}catch{}return h.noAudio||h._setupCodecs(),h},_setupCodecs:function(){var h=this||t,d=null;try{d=typeof Audio<"u"?new Audio:null}catch{return h}if(!d||typeof d.canPlayType!="function")return h;var f=d.canPlayType("audio/mpeg;").replace(/^no$/,""),p=h._navigator?h._navigator.userAgent:"",m=p.match(/OPR\/([0-6].)/g),g=m&&parseInt(m[0].split("/")[1],10)<33,y=p.indexOf("Safari")!==-1&&p.indexOf("Chrome")===-1,b=p.match(/Version\/(.*?) /),w=y&&b&&parseInt(b[1],10)<15;return h._codecs={mp3:!(g||!f&&!d.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!f,opus:!!d.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(d.canPlayType('audio/wav; codecs="1"')||d.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!d.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!d.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(d.canPlayType("audio/x-m4a;")||d.canPlayType("audio/m4a;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(d.canPlayType("audio/x-m4b;")||d.canPlayType("audio/m4b;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(d.canPlayType("audio/x-mp4;")||d.canPlayType("audio/mp4;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(w||!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(w||!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!d.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(d.canPlayType("audio/x-flac;")||d.canPlayType("audio/flac;")).replace(/^no$/,"")},h},_unlockAudio:function(){var h=this||t;if(!h._audioUnlocked&&h.ctx){h._audioUnlocked=!1,h.autoUnlock=!1,h._mobileUnloaded||h.ctx.sampleRate===44100||(h._mobileUnloaded=!0,h.unload()),h._scratchBuffer=h.ctx.createBuffer(1,1,22050);var d=function(f){for(;h._html5AudioPool.length0?y._seek:f._sprite[h][0]/1e3),v=Math.max(0,(f._sprite[h][0]+f._sprite[h][1])/1e3-w),E=1e3*v/Math.abs(y._rate),S=f._sprite[h][0]/1e3,T=(f._sprite[h][0]+f._sprite[h][1])/1e3;y._sprite=h,y._ended=!1;var B=function(){y._paused=!1,y._seek=w,y._start=S,y._stop=T,y._loop=!(!y._loop&&!f._sprite[h][2])};if(w>=T)return void f._ended(y);var k=y._node;if(f._webAudio){var D=function(){f._playLock=!1,B(),f._refreshBuffer(y);var _=y._muted||f._muted?0:y._volume;k.gain.setValueAtTime(_,t.ctx.currentTime),y._playStart=t.ctx.currentTime,k.bufferSource.start===void 0?y._loop?k.bufferSource.noteGrainOn(0,w,86400):k.bufferSource.noteGrainOn(0,w,v):y._loop?k.bufferSource.start(0,w,86400):k.bufferSource.start(0,w,v),E!==1/0&&(f._endTimers[y._id]=setTimeout(f._ended.bind(f,y),E)),d||setTimeout(function(){f._emit("play",y._id),f._loadQueue()},0)};t.state==="running"&&t.ctx.state!=="interrupted"?D():(f._playLock=!0,f.once("resume",D),f._clearTimer(y._id))}else{var W=function(){k.currentTime=w,k.muted=y._muted||f._muted||t._muted||k.muted,k.volume=y._volume*t.volume(),k.playbackRate=y._rate;try{var _=k.play();if(_&&typeof Promise<"u"&&(_ instanceof Promise||typeof _.then=="function")?(f._playLock=!0,B(),_.then(function(){f._playLock=!1,k._unlocked=!0,d?f._loadQueue():f._emit("play",y._id)}).catch(function(){f._playLock=!1,f._emit("playerror",y._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),y._ended=!0,y._paused=!0})):d||(f._playLock=!1,B(),f._emit("play",y._id)),k.playbackRate=y._rate,k.paused)return void f._emit("playerror",y._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");h!=="__default"||y._loop?f._endTimers[y._id]=setTimeout(f._ended.bind(f,y),E):(f._endTimers[y._id]=function(){f._ended(y),k.removeEventListener("ended",f._endTimers[y._id],!1)},k.addEventListener("ended",f._endTimers[y._id],!1))}catch(U){f._emit("playerror",y._id,U)}};k.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(k.src=f._src,k.load());var C=window&&window.ejecta||!k.readyState&&t._navigator.isCocoonJS;if(k.readyState>=3||C)W();else{f._playLock=!0,f._state="loading";var M=function(){f._state="loaded",W(),k.removeEventListener(t._canPlayEvent,M,!1)};k.addEventListener(t._canPlayEvent,M,!1),f._clearTimer(y._id)}}return y._id},pause:function(h){var d=this;if(d._state!=="loaded"||d._playLock)return d._queue.push({event:"pause",action:function(){d.pause(h)}}),d;for(var f=d._getSoundIds(h),p=0;p=0?d=parseInt(p[0],10):h=parseFloat(p[0]):p.length>=2&&(h=parseFloat(p[0]),d=parseInt(p[1],10));var m;if(!(h!==void 0&&h>=0&&h<=1))return m=d?f._soundById(d):f._sounds[0],m?m._volume:0;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"volume",action:function(){f.volume.apply(f,p)}}),f;d===void 0&&(f._volume=h),d=f._getSoundIds(d);for(var g=0;g0?p/v:p),S=Date.now();h._fadeTo=f,h._interval=setInterval(function(){var T=(Date.now()-S)/p;S=Date.now(),b+=w*T,b=Math.round(100*b)/100,b=w<0?Math.max(f,b):Math.min(f,b),y._webAudio?h._volume=b:y.volume(b,h._id,!0),g&&(y._volume=b),(fd&&b>=f)&&(clearInterval(h._interval),h._interval=null,h._fadeTo=null,y.volume(f,h._id),y._emit("fade",h._id))},E)},_stopFade:function(h){var d=this,f=d._soundById(h);return f&&f._interval&&(d._webAudio&&f._node.gain.cancelScheduledValues(t.ctx.currentTime),clearInterval(f._interval),f._interval=null,d.volume(f._fadeTo,h),f._fadeTo=null,d._emit("fade",h)),d},loop:function(){var h,d,f,p=this,m=arguments;if(m.length===0)return p._loop;if(m.length===1){if(typeof m[0]!="boolean")return!!(f=p._soundById(parseInt(m[0],10)))&&f._loop;h=m[0],p._loop=h}else m.length===2&&(h=m[0],d=parseInt(m[1],10));for(var g=p._getSoundIds(d),y=0;y=0?d=parseInt(p[0],10):h=parseFloat(p[0])}else p.length===2&&(h=parseFloat(p[0]),d=parseInt(p[1],10));var y;if(typeof h!="number")return y=f._soundById(d),y?y._rate:f._rate;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"rate",action:function(){f.rate.apply(f,p)}}),f;d===void 0&&(f._rate=h),d=f._getSoundIds(d);for(var b=0;b=0?d=parseInt(p[0],10):f._sounds.length&&(d=f._sounds[0]._id,h=parseFloat(p[0]))}else p.length===2&&(h=parseFloat(p[0]),d=parseInt(p[1],10));if(d===void 0)return 0;if(typeof h=="number"&&(f._state!=="loaded"||f._playLock))return f._queue.push({event:"seek",action:function(){f.seek.apply(f,p)}}),f;var y=f._soundById(d);if(y){if(!(typeof h=="number"&&h>=0)){if(f._webAudio){var b=f.playing(d)?t.ctx.currentTime-y._playStart:0,w=y._rateSeek?y._rateSeek-y._seek:0;return y._seek+(w+b*Math.abs(y._rate))}return y._node.currentTime}var v=f.playing(d);v&&f.pause(d,!0),y._seek=h,y._ended=!1,f._clearTimer(d),f._webAudio||!y._node||isNaN(y._node.duration)||(y._node.currentTime=h);var E=function(){v&&f.play(d,!0),f._emit("seek",d)};if(v&&!f._webAudio){var S=function(){f._playLock?setTimeout(S,0):E()};setTimeout(S,0)}else E()}return f},playing:function(h){var d=this;if(typeof h=="number"){var f=d._soundById(h);return!!f&&!f._paused}for(var p=0;p=0&&t._howls.splice(p,1);var m=!0;for(f=0;f=0){m=!1;break}return n&&m&&delete n[h._src],t.noAudio=!1,h._state="unloaded",h._sounds=[],h=null,null},on:function(h,d,f,p){var m=this,g=m["_on"+h];return typeof d=="function"&&g.push(p?{id:f,fn:d,once:p}:{id:f,fn:d}),m},off:function(h,d,f){var p=this,m=p["_on"+h],g=0;if(typeof d=="number"&&(f=d,d=null),d||f)for(g=0;g=0;g--)m[g].id&&m[g].id!==d&&h!=="load"||(setTimeout(function(y){y.call(this,d,f)}.bind(p,m[g].fn),0),m[g].once&&p.off(h,m[g].fn,m[g].id));return p._loadQueue(h),p},_loadQueue:function(h){var d=this;if(d._queue.length>0){var f=d._queue[0];f.event===h&&(d._queue.shift(),d._loadQueue()),h||f.action()}return d},_ended:function(h){var d=this,f=h._sprite;if(!d._webAudio&&h._node&&!h._node.paused&&!h._node.ended&&h._node.currentTime=0;p--){if(f<=d)return;h._sounds[p]._ended&&(h._webAudio&&h._sounds[p]._node&&h._sounds[p]._node.disconnect(0),h._sounds.splice(p,1),f--)}}},_getSoundIds:function(h){var d=this;if(h===void 0){for(var f=[],p=0;p=0;if(t._scratchBuffer&&h.bufferSource&&(h.bufferSource.onended=null,h.bufferSource.disconnect(0),f))try{h.bufferSource.buffer=t._scratchBuffer}catch{}return h.bufferSource=null,d},_clearSound:function(h){/MSIE |Trident\//.test(t._navigator&&t._navigator.userAgent)||(h.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var s=function(h){this._parent=h,this.init()};s.prototype={init:function(){var h=this,d=h._parent;return h._muted=d._muted,h._loop=d._loop,h._volume=d._volume,h._rate=d._rate,h._seek=0,h._paused=!0,h._ended=!0,h._sprite="__default",h._id=++t._counter,d._sounds.push(h),h.create(),h},create:function(){var h=this,d=h._parent,f=t._muted||h._muted||h._parent._muted?0:h._volume;return d._webAudio?(h._node=t.ctx.createGain===void 0?t.ctx.createGainNode():t.ctx.createGain(),h._node.gain.setValueAtTime(f,t.ctx.currentTime),h._node.paused=!0,h._node.connect(t.masterGain)):t.noAudio||(h._node=t._obtainHtml5Audio(),h._errorFn=h._errorListener.bind(h),h._node.addEventListener("error",h._errorFn,!1),h._loadFn=h._loadListener.bind(h),h._node.addEventListener(t._canPlayEvent,h._loadFn,!1),h._endFn=h._endListener.bind(h),h._node.addEventListener("ended",h._endFn,!1),h._node.src=d._src,h._node.preload=d._preload===!0?"auto":d._preload,h._node.volume=f*t.volume(),h._node.load()),h},reset:function(){var h=this,d=h._parent;return h._muted=d._muted,h._loop=d._loop,h._volume=d._volume,h._rate=d._rate,h._seek=0,h._rateSeek=0,h._paused=!0,h._ended=!0,h._sprite="__default",h._id=++t._counter,h},_errorListener:function(){var h=this;h._parent._emit("loaderror",h._id,h._node.error?h._node.error.code:0),h._node.removeEventListener("error",h._errorFn,!1)},_loadListener:function(){var h=this,d=h._parent;d._duration=Math.ceil(10*h._node.duration)/10,Object.keys(d._sprite).length===0&&(d._sprite={__default:[0,1e3*d._duration]}),d._state!=="loaded"&&(d._state="loaded",d._emit("load"),d._loadQueue()),h._node.removeEventListener(t._canPlayEvent,h._loadFn,!1)},_endListener:function(){var h=this,d=h._parent;d._duration===1/0&&(d._duration=Math.ceil(10*h._node.duration)/10,d._sprite.__default[1]===1/0&&(d._sprite.__default[1]=1e3*d._duration),d._ended(h)),h._node.removeEventListener("ended",h._endFn,!1)}};var n={},a=function(h){var d=h._src;if(n[d])return h._duration=n[d].duration,void c(h);if(/^data:[^;]+;base64,/.test(d)){for(var f=atob(d.split(",")[1]),p=new Uint8Array(f.length),m=0;m0?(n[d._src]=m,c(d,m)):f()};typeof Promise<"u"&&t.ctx.decodeAudioData.length===1?t.ctx.decodeAudioData(h).then(p).catch(f):t.ctx.decodeAudioData(h,p,f)},c=function(h,d){d&&!h._duration&&(h._duration=d.duration),Object.keys(h._sprite).length===0&&(h._sprite={__default:[0,1e3*h._duration]}),h._state!=="loaded"&&(h._state="loaded",h._emit("load"),h._loadQueue())},u=function(){if(t.usingWebAudio){try{typeof AudioContext<"u"?t.ctx=new AudioContext:typeof webkitAudioContext<"u"?t.ctx=new webkitAudioContext:t.usingWebAudio=!1}catch{t.usingWebAudio=!1}t.ctx||(t.usingWebAudio=!1);var h=/iP(hone|od|ad)/.test(t._navigator&&t._navigator.platform),d=t._navigator&&t._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),f=d?parseInt(d[1],10):null;if(h&&f&&f<9){var p=/safari/.test(t._navigator&&t._navigator.userAgent.toLowerCase());t._navigator&&!p&&(t.usingWebAudio=!1)}t.usingWebAudio&&(t.masterGain=t.ctx.createGain===void 0?t.ctx.createGainNode():t.ctx.createGain(),t.masterGain.gain.setValueAtTime(t._muted?0:t._volume,t.ctx.currentTime),t.masterGain.connect(t.ctx.destination)),t._setup()}};i.Howler=t,i.Howl=r,typeof ii<"u"?(ii.HowlerGlobal=e,ii.Howler=t,ii.Howl=r,ii.Sound=s):typeof window<"u"&&(window.HowlerGlobal=e,window.Howler=t,window.Howl=r,window.Sound=s)})()})(Kr);const No=[".aac",".mid",".midi",".mp3",".oga",".ogg",".opus",".wav",".webm",".weba",".flac",".aiff"],Wr=[".bmp",".gif",".jpeg",".jpg",".png",".tif",".tiff",".webp"];function sA(i){return i.type!="Hold"&&i.type!="Roll"}function De(i){return i.type=="Hold"||i.type=="Roll"}var Jt="INUMBER",on="IOP1",ln="IOP2",hn="IOP3",tr="IVAR",ls="IVARNAME",Js="IFUNCALL",Uo="IFUNDEF",zt="IEXPR",wc="IEXPREVAL",ms="IMEMBER",Ho="IENDSTATEMENT",en="IARRAY";function je(i,e){this.type=i,this.value=e??0}je.prototype.toString=function(){switch(this.type){case Jt:case on:case ln:case hn:case tr:case ls:case Ho:return this.value;case Js:return"CALL "+this.value;case Uo:return"DEF "+this.value;case en:return"ARRAY "+this.value;case ms:return"."+this.value;default:return"Invalid Instruction"}};function Go(i){return new je(on,i)}function sr(i){return new je(ln,i)}function im(i){return new je(hn,i)}function Lh(i,e,t,r,s){for(var n=[],a=[],o,l,c,u,h=0;h1)l=n.pop(),o=n.pop(),u=t[d.value],d=new je(Jt,u(o.value,l.value)),n.push(d);else if(f===hn&&n.length>2)c=n.pop(),l=n.pop(),o=n.pop(),d.value==="?"?n.push(o.value?l.value:c.value):(u=r[d.value],d=new je(Jt,u(o.value,l.value,c.value)),n.push(d));else if(f===on&&n.length>0)o=n.pop(),u=e[d.value],d=new je(Jt,u(o.value)),n.push(d);else if(f===zt){for(;n.length>0;)a.push(n.shift());a.push(new je(zt,Lh(d.value,e,t,r,s)))}else if(f===ms&&n.length>0)o=n.pop(),n.push(new je(Jt,o.value[d.value]));else{for(;n.length>0;)a.push(n.shift());a.push(d)}}for(;n.length>0;)a.push(n.shift());return a}function rm(i,e,t){for(var r=[],s=0;s0;)l.unshift(Yi(r.pop(),t));if(o=r.pop(),o.apply&&o.call)r.push(o.apply(void 0,l));else throw new Error(o+" is not a function")}else if(f===Uo)r.push(function(){for(var m=r.pop(),g=[],y=d.value;y-- >0;)g.unshift(r.pop());var b=r.pop(),w=function(){for(var v=Object.assign({},t),E=0,S=g.length;E0;)l.unshift(r.pop());r.push(l)}else throw new Error("invalid Expression")}if(r.length>1)throw new Error("invalid Expression (parity)");return r[0]===0?0:Yi(r[0],t)}function nA(i,e,t){return _c(i)?i:{type:wc,value:function(r){return Xr(i.value,e,r)}}}function _c(i){return i&&i.type===wc}function Yi(i,e){return _c(i)?i.value(e):i}function xc(i,e){for(var t=[],r,s,n,a,o,l,c=0;c0;)o.unshift(t.pop());a=t.pop(),t.push(a+"("+o.join(", ")+")")}else if(h===Uo){for(s=t.pop(),l=u.value,o=[];l-- >0;)o.unshift(t.pop());r=t.pop(),e?t.push("("+r+" = function("+o.join(", ")+") { return "+s+" })"):t.push("("+r+"("+o.join(", ")+") = "+s+")")}else if(h===ms)r=t.pop(),t.push(r+"."+u.value);else if(h===en){for(l=u.value,o=[];l-- >0;)o.unshift(t.pop());t.push("["+o.join(", ")+"]")}else if(h===zt)t.push("("+xc(u.value,e)+")");else if(h!==Ho)throw new Error("invalid Expression")}return t.length>1&&(e?t=[t.join(",")]:t=[t.join(";")]),String(t[0])}function Su(i){return typeof i=="string"?JSON.stringify(i).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"):i}function Ds(i,e){for(var t=0;t=this.expression.length)return this.newToken($n,"EOF");if(this.isWhitespace()||this.isComment())return this.next();if(this.isRadixInteger()||this.isNumber()||this.isOperator()||this.isString()||this.isParen()||this.isBracket()||this.isComma()||this.isSemicolon()||this.isNamedOp()||this.isConst()||this.isName())return this.current;this.parseError('Unknown character "'+this.expression.charAt(this.pos)+'"')};ut.prototype.isString=function(){var i=!1,e=this.pos,t=this.expression.charAt(e);if(t==="'"||t==='"')for(var r=this.expression.indexOf(t,e+1);r>=0&&this.pos"9")))break}if(e>i){var r=this.expression.substring(i,e);if(r in this.consts)return this.current=this.newToken(Wo,this.consts[r]),this.pos+=r.length,!0}return!1};ut.prototype.isNamedOp=function(){for(var i=this.pos,e=i;e"9")))break}if(e>i){var r=this.expression.substring(i,e);if(this.isOperatorEnabled(r)&&(r in this.binaryOps||r in this.unaryOps||r in this.ternaryOps))return this.current=this.newToken(tt,r),this.pos+=r.length,!0}return!1};ut.prototype.isName=function(){for(var i=this.pos,e=i,t=!1;e"9"))break}else t=!0}if(t){var s=this.expression.substring(i,e);return this.current=this.newToken(Ec,s),this.pos+=s.length,!0}return!1};ut.prototype.isWhitespace=function(){for(var i=!1,e=this.expression.charAt(this.pos);(e===" "||e===" "||e===` +`||e==="\r")&&(i=!0,this.pos++,!(this.pos>=this.expression.length));)e=this.expression.charAt(this.pos);return i};var aA=/^[0-9a-f]{4}$/i;ut.prototype.unescape=function(i){var e=i.indexOf("\\");if(e<0)return i;for(var t=i.substring(0,e);e>=0;){var r=i.charAt(++e);switch(r){case"'":t+="'";break;case'"':t+='"';break;case"\\":t+="\\";break;case"/":t+="/";break;case"b":t+="\b";break;case"f":t+="\f";break;case"n":t+=` +`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"u":var s=i.substring(e+1,e+5);aA.test(s)||this.parseError("Illegal escape sequence: \\u"+s),t+=String.fromCharCode(parseInt(s,16)),e+=4;break;default:throw this.parseError('Illegal escape sequence: "\\'+r+'"')}++e;var n=i.indexOf("\\",e);t+=i.substring(e,n<0?i.length:n),e=n}return t};ut.prototype.isComment=function(){var i=this.expression.charAt(this.pos);return i==="/"&&this.expression.charAt(this.pos+1)==="*"?(this.pos=this.expression.indexOf("*/",this.pos)+2,this.pos===1&&(this.pos=this.expression.length),!0):!1};ut.prototype.isRadixInteger=function(){var i=this.pos;if(i>=this.expression.length-2||this.expression.charAt(i)!=="0")return!1;++i;var e,t;if(this.expression.charAt(i)==="x")e=16,t=/^[0-9a-f]$/i,++i;else if(this.expression.charAt(i)==="b")e=2,t=/^[01]$/i,++i;else return!1;for(var r=!1,s=i;i="0"&&a<="9"||!s&&a===".");)a==="."?s=!0:n=!0,e++,i=n;if(i&&(r=e),a==="e"||a==="E"){e++;for(var o=!0,l=!1;e="0"&&a<="9")l=!0,o=!1;else break;e++}l||(e=r)}return i?(this.current=this.newToken(Wo,parseFloat(this.expression.substring(t,e))),this.pos=e):this.pos=r,i};ut.prototype.isOperator=function(){var i=this.pos,e=this.expression.charAt(this.pos);if(e==="+"||e==="-"||e==="*"||e==="/"||e==="%"||e==="^"||e==="?"||e===":"||e===".")this.current=this.newToken(tt,e);else if(e==="∙"||e==="•")this.current=this.newToken(tt,"*");else if(e===">")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(tt,">="),this.pos++):this.current=this.newToken(tt,">");else if(e==="<")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(tt,"<="),this.pos++):this.current=this.newToken(tt,"<");else if(e==="|")if(this.expression.charAt(this.pos+1)==="|")this.current=this.newToken(tt,"||"),this.pos++;else return!1;else if(e==="=")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(tt,"=="),this.pos++):this.current=this.newToken(tt,e);else if(e==="!")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(tt,"!="),this.pos++):this.current=this.newToken(tt,e);else return!1;return this.pos++,this.isOperatorEnabled(this.current.value)?!0:(this.pos=i,!1)};ut.prototype.isOperatorEnabled=function(i){return this.parser.isOperatorEnabled(i)};ut.prototype.getCoordinates=function(){var i=0,e,t=-1;do i++,e=this.pos-t,t=this.expression.indexOf(` +`,t+1);while(t>=0&&t"u"?!0:Array.isArray(e)?Ds(e,i.value):typeof e=="function"?e(i):i.value===e};rt.prototype.save=function(){this.savedCurrent=this.current,this.savedNextToken=this.nextToken,this.tokens.save()};rt.prototype.restore=function(){this.tokens.restore(),this.current=this.savedCurrent,this.nextToken=this.savedNextToken};rt.prototype.accept=function(i,e){return this.nextToken.type===i&&this.tokenMatches(this.nextToken,e)?(this.next(),!0):!1};rt.prototype.expect=function(i,e){if(!this.accept(i,e)){var t=this.tokens.getCoordinates();throw new Error("parse error ["+t.line+":"+t.column+"]: Expected "+(e||i))}};rt.prototype.parseAtom=function(i){var e=this.tokens.unaryOps;function t(s){return s.value in e}if(this.accept(Ec)||this.accept(tt,t))i.push(new je(tr,this.current.value));else if(this.accept(Wo))i.push(new je(Jt,this.current.value));else if(this.accept(sm))i.push(new je(Jt,this.current.value));else if(this.accept(ir,"("))this.parseExpression(i),this.expect(ir,")");else if(this.accept(tn,"["))if(this.accept(tn,"]"))i.push(new je(en,0));else{var r=this.parseArrayList(i);i.push(new je(en,r))}else throw new Error("unexpected "+this.nextToken)};rt.prototype.parseExpression=function(i){var e=[];this.parseUntilEndStatement(i,e)||(this.parseVariableAssignmentExpression(e),!this.parseUntilEndStatement(i,e)&&this.pushExpression(i,e))};rt.prototype.pushExpression=function(i,e){for(var t=0,r=e.length;t=",">","in"];rt.prototype.parseComparison=function(i){for(this.parseAddSub(i);this.accept(tt,oA);){var e=this.current;this.parseAddSub(i),i.push(sr(e.value))}};var lA=["+","-","||"];rt.prototype.parseAddSub=function(i){for(this.parseTerm(i);this.accept(tt,lA);){var e=this.current;this.parseTerm(i),i.push(sr(e.value))}};var hA=["*","/","%"];rt.prototype.parseTerm=function(i){for(this.parseFactor(i);this.accept(tt,hA);){var e=this.current;this.parseFactor(i),i.push(sr(e.value))}};rt.prototype.parseFactor=function(i){var e=this.tokens.unaryOps;function t(s){return s.value in e}if(this.save(),this.accept(tt,t)){if(this.current.value!=="-"&&this.current.value!=="+"){if(this.nextToken.type===ir&&this.nextToken.value==="("){this.restore(),this.parseExponential(i);return}else if(this.nextToken.type===Tc||this.nextToken.type===zo||this.nextToken.type===$n||this.nextToken.type===ir&&this.nextToken.value===")"){this.restore(),this.parseAtom(i);return}}var r=this.current;this.parseFactor(i),i.push(Go(r.value))}else this.parseExponential(i)};rt.prototype.parseExponential=function(i){for(this.parsePostfixExpression(i);this.accept(tt,"^");)this.parseFactor(i),i.push(sr("^"))};rt.prototype.parsePostfixExpression=function(i){for(this.parseFunctionCall(i);this.accept(tt,"!");)i.push(Go("!"))};rt.prototype.parseFunctionCall=function(i){var e=this.tokens.unaryOps;function t(n){return n.value in e}if(this.accept(tt,t)){var r=this.current;this.parseAtom(i),i.push(Go(r.value))}else for(this.parseMemberExpression(i);this.accept(ir,"(");)if(this.accept(ir,")"))i.push(new je(Js,0));else{var s=this.parseArgumentList(i);i.push(new je(Js,s))}};rt.prototype.parseArgumentList=function(i){for(var e=0;!this.accept(ir,")");)for(this.parseExpression(i),++e;this.accept(zo);)this.parseExpression(i),++e;return e};rt.prototype.parseMemberExpression=function(i){for(this.parseAtom(i);this.accept(tt,".")||this.accept(tn,"[");){var e=this.current;if(e.value==="."){if(!this.allowMemberAccess)throw new Error('unexpected ".", member access is not permitted');this.expect(Ec),i.push(new je(ms,this.current.value))}else if(e.value==="["){if(!this.tokens.isOperatorEnabled("["))throw new Error('unexpected "[]", arrays are disabled');this.parseExpression(i),this.expect(tn,"]"),i.push(sr("["))}else throw new Error("unexpected symbol: "+e.value)}};function cA(i,e){return Number(i)+Number(e)}function dA(i,e){return i-e}function uA(i,e){return i*e}function fA(i,e){return i/e}function pA(i,e){return i%e}function mA(i,e){return Array.isArray(i)&&Array.isArray(e)?i.concat(e):""+i+e}function gA(i,e){return i===e}function yA(i,e){return i!==e}function vA(i,e){return i>e}function bA(i,e){return i=e}function _A(i,e){return i<=e}function xA(i,e){return!!(i&&e)}function AA(i,e){return!!(i||e)}function EA(i,e){return Ds(e,i)}function TA(i){return(Math.exp(i)-Math.exp(-i))/2}function SA(i){return(Math.exp(i)+Math.exp(-i))/2}function CA(i){return i===1/0?1:i===-1/0?-1:(Math.exp(i)-Math.exp(-i))/(Math.exp(i)+Math.exp(-i))}function MA(i){return i===-1/0?i:Math.log(i+Math.sqrt(i*i+1))}function kA(i){return Math.log(i+Math.sqrt(i*i-1))}function IA(i){return Math.log((1+i)/(1-i))/2}function Cu(i){return Math.log(i)*Math.LOG10E}function PA(i){return-i}function BA(i){return!i}function RA(i){return i<0?Math.ceil(i):Math.floor(i)}function DA(i){return Math.random()*(i||1)}function Mu(i){return Sc(i+1)}function LA(i){return isFinite(i)&&i===Math.round(i)}var OA=4.7421875,Fl=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function Sc(i){var e,t;if(LA(i)){if(i<=0)return isFinite(i)?1/0:NaN;if(i>171)return 1/0;for(var r=i-2,s=i-1;r>1;)s*=r,r--;return s===0&&(s=1),s}if(i<.5)return Math.PI/(Math.sin(Math.PI*i)*Sc(1-i));if(i>=171.35)return 1/0;if(i>85){var n=i*i,a=n*i,o=a*i,l=o*i;return Math.sqrt(2*Math.PI/i)*Math.pow(i/Math.E,i)*(1+1/(12*i)+1/(288*n)-139/(51840*a)-571/(2488320*o)+163879/(209018880*l)+5246819/(75246796800*l*i))}--i,t=Fl[0];for(var c=1;c0?(s=r/e,i+=s*s):i+=r}return e===1/0?1/0:e*Math.sqrt(i)}function Iu(i,e,t){return i?e:t}function NA(i,e){return typeof e>"u"||+e==0?Math.round(i):(i=+i,e=-+e,isNaN(i)||!(typeof e=="number"&&e%1===0)?NaN:(i=i.toString().split("e"),i=Math.round(+(i[0]+"e"+(i[1]?+i[1]-e:-e))),i=i.toString().split("e"),+(i[0]+"e"+(i[1]?+i[1]+e:e))))}function UA(i,e,t){return t&&(t[i]=e),e}function HA(i,e){return i[e|0]}function GA(i){return arguments.length===1&&Array.isArray(i)?Math.max.apply(Math,i):Math.max.apply(Math,arguments)}function WA(i){return arguments.length===1&&Array.isArray(i)?Math.min.apply(Math,i):Math.min.apply(Math,arguments)}function zA(i,e){if(typeof i!="function")throw new Error("First argument to map is not a function");if(!Array.isArray(e))throw new Error("Second argument to map is not an array");return e.map(function(t,r){return i(t,r)})}function VA(i,e,t){if(typeof i!="function")throw new Error("First argument to fold is not a function");if(!Array.isArray(t))throw new Error("Second argument to fold is not an array");return t.reduce(function(r,s,n){return i(r,s,n)},e)}function jA(i,e){if(typeof i!="function")throw new Error("First argument to filter is not a function");if(!Array.isArray(e))throw new Error("Second argument to filter is not an array");return e.filter(function(t,r){return i(t,r)})}function XA(i,e){if(!(Array.isArray(e)||typeof e=="string"))throw new Error("Second argument to indexOf is not a string or array");return e.indexOf(i)}function YA(i,e){if(!Array.isArray(e))throw new Error("Second argument to join is not an array");return e.join(i)}function $A(i){return(i>0)-(i<0)||+i}var Pu=1/3;function qA(i){return i<0?-Math.pow(-i,Pu):Math.pow(i,Pu)}function KA(i){return Math.exp(i)-1}function QA(i){return Math.log(1+i)}function ZA(i){return Math.log(i)/Math.LN2}function Dr(i){this.options=i||{},this.unaryOps={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,sinh:Math.sinh||TA,cosh:Math.cosh||SA,tanh:Math.tanh||CA,asinh:Math.asinh||MA,acosh:Math.acosh||kA,atanh:Math.atanh||IA,sqrt:Math.sqrt,cbrt:Math.cbrt||qA,log:Math.log,log2:Math.log2||ZA,ln:Math.log,lg:Math.log10||Cu,log10:Math.log10||Cu,expm1:Math.expm1||KA,log1p:Math.log1p||QA,abs:Math.abs,ceil:Math.ceil,floor:Math.floor,round:Math.round,trunc:Math.trunc||RA,"-":PA,"+":Number,exp:Math.exp,not:BA,length:FA,"!":Mu,sign:Math.sign||$A},this.binaryOps={"+":cA,"-":dA,"*":uA,"/":fA,"%":pA,"^":Math.pow,"||":mA,"==":gA,"!=":yA,">":vA,"<":bA,">=":wA,"<=":_A,and:xA,or:AA,in:EA,"=":UA,"[":HA},this.ternaryOps={"?":Iu},this.functions={random:DA,fac:Mu,min:WA,max:GA,hypot:Math.hypot||ku,pyt:Math.hypot||ku,pow:Math.pow,atan2:Math.atan2,if:Iu,gamma:Sc,roundTo:NA,map:zA,fold:VA,filter:jA,indexOf:XA,join:YA},this.consts={E:Math.E,PI:Math.PI,true:!0,false:!1}}Dr.prototype.parse=function(i){var e=[],t=new rt(this,new ut(this,i),{allowMemberAccess:this.options.allowMemberAccess});return t.parseExpression(e),t.expect($n,"EOF"),new Mi(e,this)};Dr.prototype.evaluate=function(i,e){return this.parse(i).evaluate(e)};var am=new Dr;Dr.parse=function(i){return am.parse(i)};Dr.evaluate=function(i,e){return am.parse(i).evaluate(e)};var Bu={"+":"add","-":"subtract","*":"multiply","/":"divide","%":"remainder","^":"power","!":"factorial","<":"comparison",">":"comparison","<=":"comparison",">=":"comparison","==":"comparison","!=":"comparison","||":"concatenate",and:"logical",or:"logical",not:"logical","?":"conditional",":":"conditional","=":"assignment","[":"array","()=":"fndef"};function JA(i){return Bu.hasOwnProperty(i)?Bu[i]:i}Dr.prototype.isOperatorEnabled=function(i){var e=JA(i),t=this.options.operators||{};return!(e in t)||!!t[e]};const Ka=[1,1/2,1/3,1/4,1/6,1/8,1/12,1/16,1/24,1/48];function Cc(i){for(let e=0;en),i.length==0)return-1;if(e>=t(i[i.length-1])){let n=i.length-1;for(;n>0&&t(i[n-1])==e;)n--;return n}let r=0,s=i.length;for(;r<=s&&r>>1;if(t(i[n])==e){for(;n>0&&t(i[n-1])==e;)n--;return n}t(i[n])e&&(s=n-1)}return Math.max(0,s)}function qn(i){try{return Dr.evaluate(i)}catch{return null}}function Ht(i,e){let t=i.length;if(i.length!=0)for(;t--;)e(i[t],t)&&i[t].destroy()}function Fh(i){return i==""?"":i.slice(0,1).toUpperCase()+i.slice(1).toLowerCase()}function Nh(i){return i.button==2||i.getModifierState("Control")&&ss}class Oe{static _view;static messages={};static get view(){return this._view||(this._view=document.getElementById("waterfall")),this._view}static create(e){let t=1;if(this.messages[e]&&this.messages[e].type==""){const s=this.messages[e];clearTimeout(s.timeoutID),t=++s.count,this.view.removeChild(s.container)}const r=document.createElement("div");r.innerHTML=e,t>1&&(r.innerHTML+=` (${t})`),r.classList.add("waterfall-item"),Oe.messages[e]={type:"",container:r,timeoutID:setTimeout(()=>{r.classList.add("waterfall-exiting"),setTimeout(()=>{delete this.messages[e],this.view.removeChild(r)},500)},5e3),count:t},this.view.appendChild(r)}static createFormatted(e,t){let r=1;if(this.messages[e]&&this.messages[e].type==t){const n=this.messages[e];clearTimeout(n.timeoutID),r=++n.count,this.view.removeChild(n.container)}const s=document.createElement("div");s.innerHTML=`
${Fh(t)}:
`+e,r>1&&(s.innerHTML+=` (${r})`),s.classList.add("waterfall-item"),console[t](e),Oe.messages[e]={type:t,container:s,timeoutID:setTimeout(()=>{s.classList.add("waterfall-exiting"),setTimeout(()=>{delete this.messages[e],this.view.removeChild(s)},500)},5e3),count:r},this.view.appendChild(s)}}class lm{cols=[];keyDown(e){this.cols[e]=(this.cols[e]??0)+1}keyUp(e){this.cols[e]=(this.cols[e]??1)-1,this.cols[e]=Math.max(this.cols[e],0)}isPressed(e){return!!this.cols[e]}getHeldCols(){return this.cols.map((e,t)=>t).filter(e=>this.isPressed(e))}reset(){this.cols=[]}}const Ru=["audio.rate","chart.snap","chart.CMod","play.timingCollection"];class yo{static general={spinnerStep:1,smoothAnimations:!0,warnBeforeExit:!0};static chart={CMod:!1,reverse:!1,mousePlacement:!1,zoom:1,speed:250,snap:1,hideWarpedArrows:!1,doSpeedChanges:!0,drawNoteFlash:!0,receptorYPos:-200,maxDrawBeats:20,maxDrawBeatsBack:10,scroll:{scrollSensitivity:1,scrollSnapEveryScroll:!1,invertZoomScroll:!1,invertReverseScroll:!0},waveform:{enabled:!0,antialiasing:!0,color:6316402,opacity:.5,allowFilter:!0,filteredColor:1987134,filteredOpacity:.5,lineHeight:1,speedChanges:!0},timingEventOrder:{left:["LABELS","FAKES","TIMESIGNATURES","DELAYS","WARPS","STOPS","BPMS"],right:["SPEEDS","SCROLLS","TICKCOUNTS","COMBOS","ATTACKS","BGCHANGES","FGCHANGES"]},renderTimingEvent:{BPMS:!0,STOPS:!0,DELAYS:!0,WARPS:!0,FAKES:!0,COMBOS:!0,SPEEDS:!0,LABELS:!0,SCROLLS:!0,TIMESIGNATURES:!0,TICKCOUNTS:!0,BGCHANGES:!0,FGCHANGES:!0,ATTACKS:!0}};static audio={assistTick:!1,metronome:!1,rate:1,masterVolume:1,songVolume:.2,soundEffectVolume:.5,allowFilter:!0};static play={offset:0,effectOffset:0,visualOffset:0,hideBarlines:!1,judgmentTilt:!0,timingCollection:"ITG",timingWindowScale:1,timingWindowAdd:0,defaultTimingCollection:{"dance-single":"ITG","dance-double":"ITG","dance-3panel":"ITG","dance-solo":"ITG","dance-solodouble":"ITG"}};static performance={antialiasing:!1,resolution:window.devicePixelRatio};static debug={showFPS:!1,showTimers:!1};static experimental={}}class A extends yo{static extractOptions(e,t){return Object.entries(e).reduce((r,s)=>{const n=t?t+".":"";return typeof s[1]=="object"&&!Array.isArray(s[1])?r=r.concat(this.extractOptions(s[1],n+s[0])):(s[0]=n+s[0],r.push([s[0],s[1]])),r},[])}static applyOption(e){if(typeof this.getDefaultOption(e[0])!=typeof e[1])return console.warn("Couldn't load option "+e[0]+": the value "+e[1]+" ("+typeof e[1]+") does not match the type "+typeof this.getDefaultOption(e[0]));const t=e[0].split("."),r=t.pop();let s=this;for(const n of t)if(n in s)s=s[n];else return console.warn("Couldn't load option "+e[0]+": the id doesn't exist");s[r]=e[1]}static getDefaultOption(e){const t=e.split(".");let r=yo;for(const s of t)if(s in r)r=r[s];else return;if(!(typeof r=="object"&&!Array.isArray(r)))return r}static getOption(e){const t=e.split(".");let r=this;for(const s of t)if(s in r)r=r[s];else return;if(!(typeof r=="object"&&!Array.isArray(r)))return r}static saveOptions(){const e={};for(const t of this.extractOptions(this)){if(Ru.includes(t[0]))continue;const r=this.getDefaultOption(t[0]);if(r==null){console.warn("Couldn't save option "+t[0]+": the id doesn't exist");continue}typeof r!=typeof t[1]?(console.warn("Couldn't save option "+t[0]+": the value "+t[1]+" does not match the type "+typeof this.getDefaultOption(t[0])),e[t[0]]=r):e[t[0]]=t[1]}localStorage.setItem("options",JSON.stringify(e))}static loadOptions(){const e=localStorage.getItem("options");if(!e)return;const t=JSON.parse(e);if(typeof t!="object")return console.error("Couldn't load options from storage");for(const r of Object.entries(t))Ru.includes(r[0])||this.applyOption(r)}static clearSave(){localStorage.removeItem("options")}}const hm={};for(const i of Object.entries(yo))hm[i[0]]=JSON.parse(JSON.stringify(i[1]));Object.assign(A,hm);class Vo{timingWindowMS;dancePoints;lifeChange;constructor(e,t,r){this.timingWindowMS=e,this.dancePoints=t,this.lifeChange=r}getTimingWindowMS(){return this.timingWindowMS*A.play.timingWindowScale+A.play.timingWindowAdd}}class Ra extends Vo{target="dropped";constructor(e,t){super(0,e,t)}}class zr extends Vo{noteType;constructor(e,t,r,s){super(t,r,s),this.noteType=e}}new zr("Hold",0,0,0);class nt{static ITG=new nt("assets/judgment/judgmentITG.png",["w0","w1","w2","w3","w4","w5","miss"]);static WATERFALL=new nt("assets/judgment/judgmentWaterfall.png",["w0","w1","w2","w3","w4","w5","miss"]);texHeight=0;texWidth=0;texture;judgeNames=[];constructor(e,t){this.judgeNames=t,this.loadTex(e)}async loadTex(e){const t=await Rs.load(e);this.texture=t,this.texHeight=t.height,this.texWidth=t.width}getTexture(e,t){if(!this.judgeNames.includes(t.id))return;let r=0;const s=this.judgeNames.indexOf(t.id)*this.texHeight/this.judgeNames.length;return e>=0&&(r+=this.texWidth/2),this.texture.frame=new Ie(r,s,this.texWidth/2,this.texHeight/this.judgeNames.length),this.texture}}class Da extends Vo{target="mine";constructor(e,t,r){super(e,t,r)}}class vt extends Vo{id;name;color;judgmentTexture;constructor(e,t,r,s,n,a,o){super(s,n,a),this.id=e,this.name=t,this.color=r,this.judgmentTexture=o}}const cm=new vt("w0","Fantastic",183528,0,0,0,nt.ITG);class La extends vt{constructor(e,t,r,s,n){super("miss",e,t,0,r,s,n)}}function Gi(i){return i.color!=null&&i.id!="miss"}function ri(i){return i.color!=null&&i.id=="miss"}function Er(i){return!!i.noteType}function rn(i){return i.target=="dropped"}function ts(i){return i.target=="mine"}class et{static COLLECTIONS={ITG:new et([new vt("w0","Fantastic",2215144,23,5,.008,nt.ITG),new vt("w2","Excellent",14851096,44.5,4,.008,nt.ITG),new vt("w3","Great",6736213,103.5,2,.004,nt.ITG),new vt("w4","Decent",11820287,136.5,0,0,nt.ITG),new vt("w5","Way Off",13206878,181.5,-6,-.05,nt.ITG),new La("Miss",16724016,-12,-.1,nt.ITG),new zr("Hold",321.5,5,-.008),new zr("Roll",351.5,5,-.008),new Ra(0,-.08),new Da(71.5,-6,-.05)],103.5),FA:new et([new vt("w0","Fantastic",2215144,15,3.5,.008,nt.ITG),new vt("w1","Fantastic",16777215,23,3,.008,nt.ITG),new vt("w2","Excellent",14851096,44.5,2,.008,nt.ITG),new vt("w3","Great",6736213,103.5,1,.004,nt.ITG),new vt("w4","Decent",11820287,136.5,0,0,nt.ITG),new vt("w5","Way Off",13206878,181.5,0,-.05,nt.ITG),new La("Miss",16724016,0,-.1,nt.ITG),new zr("Hold",321.5,1,-.008),new zr("Roll",351.5,1,-.008),new Ra(0,-.08),new Da(71.5,-1,-.05)],103.5),WATERFALL:new et([new vt("w0","Masterful",16711870,15,10,.008,nt.WATERFALL),new vt("w2","Awesome",16776960,30,9,.008,nt.WATERFALL),new vt("w3","Solid",51200,50,6,.008,nt.WATERFALL),new vt("w4","OK",33023,100,3,.004,nt.WATERFALL),new vt("w5","Fault",8421504,160,0,0,nt.WATERFALL),new La("Miss",16724016,0,-.1,nt.WATERFALL),new zr("Hold",300,6,-.008),new zr("Roll",350,6,-.008),new Ra(0,-.08),new Da(71.5,-3,-.05)],100)};windows=[];holdWindows={};missWindow;droppedWindow;mineWindow;hideLimitMS;constructor(e,t){this.missWindow=new La("Miss",16724016,-12,-.1,nt.ITG),this.droppedWindow=new Ra(0,-.08),this.mineWindow=new Da(71.5,-1,-.05);for(const r of e)Gi(r)?this.windows.push(r):ri(r)?this.missWindow=r:Er(r)?this.holdWindows[r.noteType]=r:rn(r)?this.droppedWindow=r:ts(r)&&(this.mineWindow=r);this.windows.sort((r,s)=>r.timingWindowMS-s.timingWindowMS),this.hideLimitMS=t}judgeInput(e){for(const t of this.windows)if(t.getTimingWindowMS()/1e3>=Math.abs(e))return t;return this.missWindow}getHeldJudgement(e){return this.holdWindows[e.type]}getMissJudgment(){return this.missWindow}getDroppedJudgment(){return this.droppedWindow}getMineJudgment(){return this.mineWindow}shouldHideNote(e){return e.id!="miss"&&e.timingWindowMS<=this.hideLimitMS}maxWindowMS(){return this.windows.at(-1)?.getTimingWindowMS()??0}getMaxDancePoints(){return Math.max(...this.windows.map(e=>e.dancePoints),this.missWindow.dancePoints)}getMaxHoldDancePoints(e){return Math.max(this.holdWindows[e].dancePoints??0,this.droppedWindow.dancePoints)}getStandardWindows(){return[...this.windows]}getHoldWindows(){return[...Object.values(this.holdWindows)]}static getCollection(e){return this.COLLECTIONS[e]??this.COLLECTIONS.ITG}static getCollections(){return et.COLLECTIONS}}class eE{}class cn extends eE{chordCohesion=new Map;missNoteIndex=0;holdProgress=[];heldCols=new lm;collection=et.getCollection("ITG");update(e){if(!e.loadedChart||!e.chartView)return;const r=e.chartView.getTimeWithOffset()-this.collection.maxWindowMS()/1e3*A.audio.rate;let s=-1;for(;e.loadedChart.getNotedata()[this.missNoteIndex]&&e.loadedChart.getNotedata()[this.missNoteIndex].second=e.chartView.chart.getSecondsFromBeat(n.beat+n.hold)&&(n.gameplay.hideNote=!0,e.chartView.doJudgment(n,0,this.collection.getHeldJudgement(n)),this.holdProgress.splice(this.holdProgress.indexOf(n),1),e.gameStats?.addHoldDataPoint(n,this.collection.getHeldJudgement(n)))}for(const n of this.heldCols.getHeldCols()){const a=this.getClosestNote(e.loadedChart.getNotedata(),e.chartView.getTimeWithOffset()-this.collection.getMineJudgment().getTimingWindowMS()/2e3,n,["Mine"],this.collection.getMineJudgment().getTimingWindowMS()/2);a&&(a.gameplay.hasHit=!0,a.gameplay.hideNote=!0,e.chartView.doJudgment(a,0,this.collection.getMineJudgment()),e.gameStats?.addDataPoint([a],this.collection.getMineJudgment(),0),e.mine.play())}}endPlay(e){if(!e.loadedChart||!e.chartView)return;this.collection=et.getCollection(A.play.timingCollection),this.chordCohesion.clear();for(const n of e.loadedChart.getNotedata())n.type=="Mine"||n.fake||(this.chordCohesion.has(n.beat)||this.chordCohesion.set(n.beat,[]),this.chordCohesion.get(n.beat).push(n));const r=e.chartView.getTimeWithOffset()-this.collection.maxWindowMS()/1e3*A.audio.rate;let s=ki(e.loadedChart.getNotedata(),r,n=>n.second)+1;s>=1&&r<=e.loadedChart.getNotedata()[s-1].second&&s--,this.missNoteIndex=s,this.holdProgress=[],this.heldCols.reset()}keyDown(e,t){if(!e.loadedChart||!e.chartView)return;const r=e.chartView.getTimeWithOffset(),s=this.getClosestNote(e.loadedChart.getNotedata(),r,t,["Tap","Hold","Roll"]);this.heldCols.keyDown(t);for(const n of this.holdProgress)n.type=="Roll"&&n.col==t&&(n.gameplay.lastHoldActivation=Date.now());s?this.hitNote(e,s,r):e.chartView.keyDown(t)}keyUp(e,t){if(!e.loadedChart||!e.chartView)return;const r=e.chartView.getTimeWithOffset(),s=this.getClosestNote(e.loadedChart.getNotedata(),r,t,["Lift"]);this.heldCols.keyUp(t),e.chartView.keyUp(t),s&&this.hitNote(e,s,r)}shouldAssistTick(e){return!e.fake&&e.type!="Mine"}hitNote(e,t,r){t.gameplay.hasHit=!0,De(t)&&(t.gameplay.lastHoldActivation=Date.now(),e.chartView.activateHold(t.col),this.holdProgress.push(t));const s=this.chordCohesion.get(t.beat);if(s.every(n=>n.gameplay.hasHit)){const n=this.collection.judgeInput((r-t.second)/A.audio.rate),a=this.collection.shouldHideNote(n);s.forEach(o=>{e.chartView.doJudgment(o,(r-o.second)/A.audio.rate,n),a&&sA(o)&&(o.gameplay.hideNote=!0)}),e.gameStats?.addDataPoint(s,n,(r-t.second)/A.audio.rate)}}getClosestNote(e,t,r,s,n){n=n??this.collection.maxWindowMS(),n*=A.audio.rate;const a=t-n/1e3,o=t+n/1e3;let l=ki(e,a,u=>u.second)+1;l>=1&&a<=e[l-1].second&&l--;let c;for(;e[l]&&e[l].second<=o;){const u=e[l];if(u.gameplay.hasHit||u.col!=r||u.fake||!s.includes(u.type)){l++;continue}(!c||Math.abs(u.second-t)=r.getTimingWindowMS():!1}}function Ls(i,e,t){return i*(1-t)+e*t}function bs(i,e,t){return(t-i)/(e-i)}function de(i,e){return Math.round(i*Math.pow(10,e))/Math.pow(10,e)}function Je(i,e,t){return Math.max(e,Math.min(t,i))}function dm(i){if(i.length==0)return 0;const e=i.length,t=i.reduce((r,s)=>r+s)/e;return Math.sqrt(i.map(r=>Math.pow(r-t,2)).reduce((r,s)=>r+s)/e)}function jo(i){if(i.length==0)return 0;i=[...i],i.sort((t,r)=>t-r);const e=Math.floor(i.length/2);return i.length%2?i[e]:(i[e-1]+i[e])/2}function tE(i){return i.length==0?0:i.reduce((e,t)=>e+t)/i.length}function um(i,e){return e?um(e,i%e):e===0?i:NaN}function fm(i,e){return i*e/um(i,e)}function Du(i){let e=1;for(let t=0;tOh(p.beat))),Du(d.map(p=>Oh(p.beat+p.hold)))));for(let p=0;pa[u]?a[u]=void 0:a[u]1&&r.counts.Jumps++,n+c>2&&r.counts.Hands++,n=0,s=l.beat}if(l.type!="Mine"&&!l.fake&&n++,l.fake){r.counts.Fakes++;continue}switch(l.type){case"Tap":r.counts.Taps++;break;case"Hold":r.counts.Holds++;break;case"Roll":r.counts.Rolls++;break;case"Lift":r.counts.Lifts++;break;case"Mine":r.counts.Mines++;break}De(l)&&(a[l.col]=l.beat+l.hold)}let o=0;for(let l=0;l1&&r.counts.Jumps++,n+o>2&&r.counts.Hands++,r}getNPSPerMeasure(e,t){const r=e[e.length-1]?.beat??0,s=[];let n=0;for(let a=0;a>16,r=i>>8&255,s=i&255;return t=at(t*e,0,255),r=at(r*e,0,255),s=at(s*e,0,255),yo(t,r,s)}function Fh(i,e,t){const[r,s,n]=i.match(/\w\w/g).map(d=>parseInt(d,16)),[a,o,l]=e.match(/\w\w/g).map(d=>parseInt(d,16)),c=Math.round(r+(a-r)*t).toString(16).padStart(2,"0"),u=Math.round(s+(o-s)*t).toString(16).padStart(2,"0"),h=Math.round(n+(l-n)*t).toString(16).padStart(2,"0");return"#"+c+u+h}const oE=ie.from("assets/noteskin/dance/mine/frame.png");class We{static noop_frag;static noop_vert;static arrow_gradient_frag;static mine_gradient_frag;static lift_gradient_frag;static arrow_parts_texture=Me.from("assets/noteskin/dance/tap/parts.png",{mipmap:Kt.OFF});static mine_parts_texture=Me.from("assets/noteskin/dance/mine/parts.png",{mipmap:Kt.OFF});static lift_parts_texture=Me.from("assets/noteskin/dance/lift/parts.png",{mipmap:Kt.OFF});static arrow_body_geometry;static arrow_frame_geometry;static lift_body_geometry;static mine_body_geometry;static arrow_frame_tex;static arrow_frame;static arrow_tex;static arrow_container=new xe;static lift_tex;static lift_container=new xe;static mine_tex;static mine_container=new xe;static loaded=!1;static async initArrowTex(e){if(!this.loaded){We.arrow_frame_tex=pt.create({width:64,height:64,resolution:A.performance.resolution}),We.arrow_tex=pt.create({width:256,height:320,resolution:A.performance.resolution}),We.lift_tex=pt.create({width:256,height:320,resolution:A.performance.resolution}),We.mine_tex=pt.create({width:64,height:64,resolution:A.performance.resolution}),this.noop_frag=await fetch("assets/noteskin/dance/shader/noop.frag").then(t=>t.text()),this.noop_vert=await fetch("assets/noteskin/dance/shader/noop.vert").then(t=>t.text()),this.arrow_gradient_frag=await fetch("assets/noteskin/dance/shader/arrow_gradient.frag").then(t=>t.text()),this.mine_gradient_frag=await fetch("assets/noteskin/dance/shader/mine_gradient.frag").then(t=>t.text()),this.lift_gradient_frag=await fetch("assets/noteskin/dance/shader/lift_gradient.frag").then(t=>t.text()),this.arrow_body_geometry=await this.loadGeometry("assets/noteskin/dance/tap/body.txt"),this.arrow_frame_geometry=await this.loadGeometry("assets/noteskin/dance/tap/frame.txt"),this.mine_body_geometry=await this.loadGeometry("assets/noteskin/dance/mine/body.txt"),this.lift_body_geometry=await this.loadGeometry("assets/noteskin/dance/lift/body.txt");{const t=Ut.from(this.noop_vert,this.noop_frag,{sampler0:this.arrow_parts_texture}),r=new xr(We.arrow_frame_geometry,t);r.x=32,r.y=32,r.rotation=-Math.PI/2,this.arrow_frame=r}for(let t=0;t<10;t++){const r=Ut.from(this.noop_vert,this.arrow_gradient_frag,{sampler0:this.arrow_parts_texture,time:0,quant:t}),s=new Pe(We.arrow_frame_tex);s.x=t%3*64,s.y=Math.floor(t/3)*64;const n=new xr(We.arrow_body_geometry,r);n.x=t%3*64+32,n.y=Math.floor(t/3)*64+32,n.rotation=-Math.PI/2,n.name="body"+t,We.arrow_container.addChild(s),We.arrow_container.addChild(n)}for(let t=0;t<10;t++){const r=Ut.from(this.noop_vert,this.lift_gradient_frag,{sampler0:this.lift_parts_texture,time:0,quant:t}),s=new xr(We.lift_body_geometry,r);s.x=t%3*64+32,s.y=Math.floor(t/3)*64+32,s.rotation=-Math.PI/2,s.name="body"+t,We.lift_container.addChild(s)}{const t=Ut.from(this.noop_vert,this.mine_gradient_frag,{sampler0:this.mine_parts_texture,time:0}),r=new xr(We.mine_body_geometry,t),s=new Pe(oE);s.width=64,s.height=64,s.anchor.set(.5),s.pivot.y=3,We.mine_container.position.set(32),We.mine_container.addChild(r),We.mine_container.addChild(s)}e.ticker.add(()=>{e.renderer.render(We.arrow_frame,{renderTexture:We.arrow_frame_tex}),e.renderer.render(We.arrow_container,{renderTexture:We.arrow_tex}),e.renderer.render(We.mine_container,{renderTexture:We.mine_tex}),e.renderer.render(We.lift_container,{renderTexture:We.lift_tex})}),this.loaded=!0}}static async loadGeometry(e){try{const r=(await fetch(e).then(c=>c.text())).split(` -`),s=parseInt(r[0]),n=parseInt(r[s+1]),a=[],o=[],l=[];for(let c=0;c.6&&t<.8){const r=(t-.6)/.2*(t-.6)/.2;e.scale.set(.3*(1-r))}}Ht(this.children,e=>Date.now()-e.createTime>800)}addJudge(e,t){if(!tn(t)&&!Er(t))return;const r=new Pe(tn(t)?jr.dropped_tex:jr.held_tex);r.anchor.set(.5),r.x=this.notefield.getColX(e),r.createTime=Date.now(),r.scale.set(0),this.addChild(r)}}class as extends xe{pool=[];options;constructor(e){super(),this.options=e}createChild(){if(this.pool.length==0&&this.options.maxPoolSize!==void 0&&this.children.length>=this.options.maxPoolSize)return;const e=this.pool.pop()??this.options.create();return this.addChild(e),e._disabledTime=Date.now(),e}destroyChild(e){this.children.includes(e)&&(e.removeFromParent(),e.removeAllListeners(),e.eventMode="auto",e._disabledTime=Date.now(),this.pool.push(e))}destroyAll(){this.children.forEach(e=>e._disabledTime=Date.now()),this.pool.push(...this.children),this.children.forEach(e=>{e.removeAllListeners(),e.eventMode="auto"}),this.removeChildren()}_render(e){super._render(e);const t=Date.now();for(;t-this.pool[0]?._disabledTime>(this.options.destroyTimer??5e3);)this.pool.shift().destroy()}getPoolSize(){return this.pool.length+this.children.length}}class re extends sn{static _instance;static get instance(){return re._instance||(re._instance=new re),re._instance}static emit(e,...t){return re.instance.emit(e,...t)}static on(e,t,r){re.instance.on(e,t,r)}static off(e,t,r,s){re.instance.off(e,t,r,s)}}class mE extends xe{children=[];notefield;arrowMap=new Map;arrowPool=new as({create:()=>At.createArrow()});notesDirty=!1;constructor(e){super(),this.notefield=e,this.arrowPool.sortableChildren=!0,this.addChild(this.arrowPool);const t=()=>{for(const[s,n]of this.arrowMap.entries())At.setData(this.notefield,n,s,this.notefield.getTimingData())},r=()=>this.notesDirty=!0;re.on("timeSigChanged",t),re.on("chartModified",r),this.on("destroyed",()=>{re.off("timeSigChanged",t),re.on("chartModified",r)})}update(e,t){if(this.notesDirty){const r=this.notefield.getNotedata();for(const[s,n]of this.arrowMap.entries())r.includes(s)||(this.arrowPool.destroyChild(n),this.arrowMap.delete(s))}We.setArrowTexTime(this.notefield.getBeat(),this.notefield.getTime());for(const r of this.notefield.getNotedata()){if(r.beat>t)break;if(this.shouldDisplayNote(r,e,t)&&!this.arrowMap.has(r)){const s=this.arrowPool.createChild();if(!s)continue;s.x=this.notefield.getColX(r.col),s.zIndex=r.beat,Object.assign(s,{zIndex:r.beat}),At.setData(this.notefield,s,r,this.notefield.getTimingData()),this.notefield.getRenderer().registerDragNote(s,r),this.arrowMap.set(r,s)}}for(const[r,s]of this.arrowMap.entries()){if(!this.shouldDisplayNote(r,e,t)){this.arrowPool.destroyChild(s),this.arrowMap.delete(r);continue}if(s.y=A.chart.receptorYPos/A.chart.zoom,(!De(r)||!r.gameplay?.lastHoldActivation||this.notefield.getBeat()r)}}const gE=ie.from("assets/noteskin/dance/flash/hold.png"),Ol={w0:ie.from("assets/noteskin/dance/flash/fantastic.png"),w1:ie.from("assets/noteskin/dance/flash/white_fantastic.png"),w2:ie.from("assets/noteskin/dance/flash/excellent.png"),w3:ie.from("assets/noteskin/dance/flash/great.png"),w4:ie.from("assets/noteskin/dance/flash/decent.png"),w5:ie.from("assets/noteskin/dance/flash/way_off.png"),mine:ie.from("assets/noteskin/dance/flash/mine.png")};class yE extends xe{notefield;children=[];constructor(e){super(),this.notefield=e}update(){this.y=A.chart.receptorYPos/A.chart.zoom,this.scale.y=A.chart.reverse?-1:1;for(const e of this.children)switch(e.type){case"flash":{const t=(Date.now()-e.createTime)/150;e.scale.set(1.1-t*.1),e.alpha=1.2-t*1.2;break}case"mine":{const t=(Date.now()-e.createTime)/600;e.rotation=t*-Math.PI,e.alpha=Math.min(1,2-2*t);break}case"hold":e.alpha=Math.sin(Date.now())*.2+1.2}Ht(this.children,e=>Date.now()-e.createTime>150&&e.type=="flash"),Ht(this.children,e=>Date.now()-e.createTime>600&&e.type=="hold")}addFlash(e,t){if(!A.chart.drawNoteFlash)return;let r;if(Gi(t)&&(r=Ol[t.id]),Zr(t)&&(r=Ol.mine),Er(t)&&(r=Ol.w2),(Er(t)||tn(t))&&Ht(this.children,n=>n.type=="hold"&&n.col==e),!r)return;const s=new Pe(r);s.anchor.set(.5),s.rotation=this.notefield.getRotFromCol(e),s.x=this.notefield.getColX(e),s.createTime=Date.now(),s.type="flash",s.col=e,Zr(t)&&(s.type="mine",s.blendMode=Ae.ADD),this.addChild(s)}activateHold(e){if(!A.chart.drawNoteFlash)return;const t=new Pe(gE);t.anchor.set(.5),t.rotation=this.notefield.getRotFromCol(e),t.x=this.notefield.getColX(e),t.type="hold",t.col=e,this.addChild(t)}reset(){Ht(this.children,e=>e.type=="hold")}}const vE=ie.from("assets/noteskin/dance/receptor.png");class bE extends xe{notefield;receptors=new xe;pressedCols=new hm;children=[];constructor(e){super(),this.notefield=e;for(let t=0;tAt.createArrow()});lastBeatShift=0;lastColShift=0;constructor(e){super(),this.notefield=e,this.arrowPool.sortableChildren=!0,this.addChild(this.arrowPool)}update(e,t){if(!this.notefield.getRenderer().chartManager.selection.shift){this.arrowPool.destroyAll(),this.arrowMap.clear(),this.lastBeatShift;return}const r=this.notefield.getRenderer().chartManager.selection.shift.beatShift,s=this.notefield.getRenderer().chartManager.selection.shift.columnShift;if(this.lastBeatShift!=r||this.lastColShift!=s){this.lastBeatShift=r,this.lastColShift=s;for(const[n,a]of this.arrowMap.entries())At.setData(this.notefield,a,{beat:n.beat+r,col:n.col+s,type:n.type},this.notefield.getRenderer().chart.timingData),a.x=this.notefield.getColX(n.col+s)}for(const n of this.notefield.getRenderer().chartManager.selection.notes)if(!(n.beat+r+(De(n)?n.hold:0)t)&&!this.arrowMap.has(n)){const a=this.arrowPool.createChild();if(!a)continue;a.x=this.notefield.getColX(n.col+s),a.zIndex=n.beat,a.alpha=.4,At.setData(this.notefield,a,{beat:n.beat+r,col:n.col+s,type:n.type},this.notefield.getRenderer().chart.timingData),this.arrowMap.set(n,a)}for(const[n,a]of this.arrowMap.entries()){if(n.beat+r+(De(n)?n.hold:0)t){this.arrowPool.destroyChild(a),this.arrowMap.delete(n);continue}const o=n.beat+r;if(a.y=this.notefield.getRenderer().getYPosFromBeat(o),a.selection.alpha=Math.sin(Date.now()/320)*.1+.3,a.item.scale.y=A.chart.reverse?-1:1,De(n)){const l=this.notefield.getRenderer().getYPosFromBeat(o+(De(n)?n.hold:0))-a.y;At.setHoldLength(a,l),At.setHoldBrightness(a,.8)}}}}class dn extends aE{receptors;notes;selectionNotes;flashes;holdJudges;ghostNote;ghostNoteEntry;constructor(e){super(e),We.initArrowTex(e.chartManager.app),this.receptors=new bE(this),this.notes=new mE(this),this.selectionNotes=new wE(this),this.flashes=new yE(this),this.holdJudges=new jr(this),this.ghostNote=At.createArrow(),this.ghostNote.visible=!1,this.ghostNote.alpha=.4,this.addChild(this.receptors,this.ghostNote,this.notes,this.selectionNotes,this.flashes,this.holdJudges)}setGhostNote(e){if(this.ghostNoteEntry=e,!e){this.ghostNote.visible=!1;return}At.setData(this,this.ghostNote,e,this.renderer.chart.timingData),this.ghostNote.x=this.getColX(e.col)}getNoteSprite(e){const t=At.createArrow();return At.setData(this,t,e,this.renderer.chart.timingData),t}update(e,t){this.receptors.update(),this.notes.update(e,t),this.selectionNotes.update(e,t),this.flashes.update(),this.holdJudges.update(),this.ghostNoteEntry&&(this.ghostNote.y=this.renderer.getYPosFromBeat(this.ghostNoteEntry.beat),this.ghostNote.item.scale.y=A.chart.reverse?-1:1,this.ghostNote.visible=A.chart.mousePlacement&&this.renderer.chartManager.getMode()==Z.Edit&&this.renderer.chartManager.editTimingMode==He.Off&&this.ghostNoteEntry.beat>=e&&this.ghostNoteEntry.beat<=t&&this.ghostNoteEntry.beat>=0)}doJudge(e,t){this.flashes.addFlash(e,t),this.holdJudges.addJudge(e,t)}endPlay(){this.flashes.reset()}keyDown(e){this.receptors.keyDown(e)}keyUp(e){this.receptors.keyUp(e)}activateHold(e){this.flashes.activateHold(e)}getColX(e){return(e-this.getNumCols()/2+.5)*64}getNumCols(){return this.renderer.chart.gameType.numCols}getRotFromCol(e){let t=[0,-90,90,180];return this.getNumCols()==3&&(t=[45,-90,135]),(this.getNumCols()==6||this.getNumCols()==12)&&(t=[0,45,-90,90,135,180]),this.getNumCols()==8&&(t=[0,-90,90,180,0,-90,90,180]),t[e%t.length]/180*Math.PI}}class Ze{static gameTypes={};static priority=[];static register(e){Ze.gameTypes[e.id]=e,this.priority.push(e)}static getPriority(){return this.priority}static getGameType(e){return Ze.gameTypes[e]}static getTypes(){return this.gameTypes}}Ze.register({id:"dance-single",numCols:4,notefieldWidth:4*64,gameLogic:new hn,parser:new cn,notefield:dn,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[3,1,2,0],vertical:[0,2,1,3]}});Ze.register({id:"dance-double",numCols:8,notefieldWidth:8*64,gameLogic:new hn,parser:new cn,notefield:dn,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[3,1,2,0,7,5,6,4],vertical:[0,2,1,3,4,6,5,7]}});Ze.register({id:"dance-couple",numCols:8,notefieldWidth:8*64,gameLogic:new hn,parser:new cn,notefield:dn,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[3,1,2,0,7,5,6,4],vertical:[0,2,1,3,4,6,5,7]}});Ze.register({id:"dance-solo",numCols:6,notefieldWidth:6*64,gameLogic:new hn,parser:new cn,notefield:dn,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[5,4,2,3,1,0],vertical:[0,1,3,2,4,5]}});Ze.register({id:"dance-solodouble",numCols:12,notefieldWidth:12*64,gameLogic:new hn,parser:new cn,notefield:dn,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[5,4,2,3,1,0,11,10,8,9,7,6],vertical:[0,1,3,2,4,5,6,7,9,8,10,11]}});Ze.register({id:"dance-3panel",numCols:3,notefieldWidth:3*64,gameLogic:new hn,parser:new cn,notefield:dn,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[2,1,0],vertical:[0,1,2]}});const _i=["Beginner","Easy","Medium","Hard","Challenge","Edit"];class mt{items=[];itemIndex=0;limit=0;app;static instance;constructor(e){this.app=e,mt.instance||(mt.instance=this)}run(e){e.action(this.app),this.items.splice(this.itemIndex,this.items.length-this.itemIndex,e),this.itemIndex++}undo(){this.items[this.itemIndex-1]&&(this.items[this.itemIndex-1].undo(this.app),this.itemIndex--,re.emit("undo"))}redo(){this.items[this.itemIndex]&&(this.items[this.itemIndex].redo?this.items[this.itemIndex].redo(this.app):this.items[this.itemIndex].action(this.app),this.itemIndex++,re.emit("redo"))}reset(){this.itemIndex=0,this.items=[]}canUndo(){return this.itemIndex>0}canRedo(){return this.itemIndex!=this.items.length}setLimit(){this.limit=this.itemIndex}isDirty(){return this.itemIndex!=this.limit}}const Jr=["BPMS","STOPS","WARPS","DELAYS","LABELS","SPEEDS","SCROLLS","TICKCOUNTS","TIMESIGNATURES","COMBOS","FAKES","ATTACKS","BGCHANGES","FGCHANGES"];class gm{_fallback;_cache={events:{},warpedBeats:new Map,beatsToSeconds:new Map};_chart;events={};offset;constructor(e,t){this._fallback=e,this._chart=t}parse(e,t){if(e=="OFFSET"){this.offset=parseFloat(t);return}this.events[e]||=[];let r=t.replaceAll(/[\n\r\t]/g,"").split(",");e=="ATTACKS"&&(r=[t.replaceAll(/[\n\r\t]/g,"")]);for(const s of r){if(e=="ATTACKS"){let o;const l=/TIME=([\d.]+):(END|LEN)=([\d.]+):MODS=([^:]+)/g;for(;(o=l.exec(s))!=null;){const c={type:"ATTACKS",second:parseFloat(o[1]),endType:o[2],value:parseFloat(o[3]),mods:o[4]};this._insert("ATTACKS",c,!1)}return}const n=s.split("=");if(n.length<2)continue;let a;switch(e){case"BPMS":case"STOPS":case"WARPS":case"DELAYS":case"SCROLLS":case"TICKCOUNTS":case"FAKES":a={type:e,beat:parseFloat(n[0]),value:parseFloat(n[1])};break;case"LABELS":a={type:e,beat:parseFloat(n[0]),value:n[1]};break;case"SPEEDS":a={type:e,beat:parseFloat(n[0]),value:parseFloat(n[1]),delay:parseFloat(n[2]),unit:n[3]=="0"?"B":"T"};break;case"TIMESIGNATURES":a={type:e,beat:parseFloat(n[0]),upper:parseInt(n[1]),lower:parseInt(n[2])};break;case"COMBOS":a={type:e,beat:parseFloat(n[0]),hitMult:parseInt(n[1]),missMult:parseInt(n[2]??n[1])};break;case"BGCHANGES":case"FGCHANGES":a={type:e,beat:parseFloat(n[0]),file:n[1],updateRate:parseFloat(n[2]),crossFade:n[3]=="1",stretchRewind:n[4]=="1",stretchNoLoop:n[5]=="1",effect:n[6]??"",file2:n[7]??"",transition:n[8]??"",color1:n[9]??"",color2:n[10]??""}}this._insert(e,a,!1)}}_insert(e,t,r){this.binsert(e,t),(r??!0)&&this.reloadCache(e)}delete(e,t,r){const s=e?this:this._fallback;if(!s.events[t])return;r=de(r,3);const n=s.bindex(t,{type:t,beat:r,second:r});if(n==-1||n==0&&t=="BPMS")return;const a=s.events[t][n];mt.instance.run({action:()=>{s._delete(a),s.reloadCache(t),this!=s&&this.reloadCache(t),re.emit("timingModified")},undo:()=>{s._insert(a.type,a),s.reloadCache(t),this!=s&&this.reloadCache(t),re.emit("timingModified")}})}_delete(e,t){if(!this.events[e.type])return;const r=this.bindex(e.type,e);r>-1&&(this.events[e.type].splice(r,1),(t??!0)&&this.reloadCache(e.type))}isDuplicate(e,t){if(["STOPS","WARPS","DELAYS","FAKES","BGCHANGES","FGCHANGES"].includes(e.type)||t.type!=e.type)return!1;switch(e.type){case"BPMS":case"SCROLLS":case"TICKCOUNTS":case"LABELS":return t.type==e.type&&e.value==t.value;case"SPEEDS":return t.type==e.type&&e.value==t.value&&e.delay==t.delay&&e.unit==t.unit;case"TIMESIGNATURES":return t.type==e.type&&e.upper==t.upper&&e.lower==t.lower;case"COMBOS":return t.type==e.type&&e.hitMult==t.hitMult&&e.missMult==t.missMult;default:return!1}}isSimilar(e,t){if(["STOPS","WARPS","DELAYS","FAKES","BGCHANGES","FGCHANGES"].includes(e.type)||t.type!=e.type)return!1;switch(e.type){case"BPMS":case"SCROLLS":case"TICKCOUNTS":case"SPEEDS":case"LABELS":return t.type==e.type&&e.value==t.value;case"TIMESIGNATURES":return t.type==e.type&&e.upper==t.upper&&e.lower==t.lower;case"COMBOS":return t.type==e.type&&e.hitMult==t.hitMult&&e.missMult==t.missMult;default:return!1}}isNullEvent(e){switch(e.type){case"BPMS":case"TICKCOUNTS":case"TIMESIGNATURES":case"COMBOS":return!1;case"STOPS":case"WARPS":case"DELAYS":case"SCROLLS":case"FAKES":return e.value==0;case"LABELS":case"ATTACKS":return e.value=="";case"SPEEDS":return!1;case"FGCHANGES":case"BGCHANGES":return e.file==""&&e.file2==""}}insert(e,t,r,s){const n=e?this:this._fallback;if(t=="OFFSET"){n.offset=r,this.reloadCache("OFFSET");return}if(Object.keys(r).length==0)return;n.events[t]||(e?n.events[t]=JSON.parse(JSON.stringify(this._fallback.events[t])):n.events[t]=[]),s=de(s,3);const a=n.getTimingEventAtBeat(t,s),o={type:t,beat:s},l=[],c=[];if(Object.assign(o,r),a&&this.isDuplicate(o,a))return;a?.beat==s&&l.push(a);const u=n.getTimingEventAtBeat(t,s-.001);if(this.isNullEvent(o))return;(!u||!this.isSimilar(u,o)||a&&this.isDuplicate(u,a))&&c.push(o);const h=this.getTimingData(t),d=h[n.searchCache(h,"beat",s)+1];d&&this.isDuplicate(o,d)&&l.push(d),(l.length||c.length)&&mt.instance.run({action:()=>{for(const f of l)n._delete(f);for(const f of c)n._insert(t,f);this.reloadCache(t),re.emit("timingModified"),re.emit("chartModified"),t=="TIMESIGNATURES"&&re.emit("timeSigChanged")},undo:()=>{for(const f of c)n._delete(f);for(const f of l)n._insert(t,f);this.reloadCache(t),re.emit("timingModified"),re.emit("chartModified"),t=="TIMESIGNATURES"&&re.emit("timeSigChanged")}})}rawDeleteMultiple(e){for(const t of e){const s=this.events[t.type]?this:this._fallback;t.beat=de(t.beat,3),s._delete(t)}this.reloadCache()}rawInsertMultiple(e){for(const t of e){const r=this.events[t.type],s=r?this:this._fallback;s.events[t.type]||(r?s.events[t.type]=JSON.parse(JSON.stringify(this._fallback.events[t.type])):s.events[t.type]=[]),t.beat=de(t.beat,3),s._insert(t.type,t)}this.reloadCache()}findConflicts(){const e=[];for(const t of Jr){const r=this.getTimingData(t);if(r.length<2)continue;let s=r[0];for(let n=1;n({type:"WARP_DEST",beat:n.beat+n.value,value:n.value})));const r=["WARP_DEST","BPMS","STOPS","WARPS","DELAYS"];t.sort((n,a)=>n.beat==a.beat?r.indexOf(n.type)-r.indexOf(a.type):n.beat-a.beat);const s=this.getTimingData("OFFSET");e.push({beat:0,secondBefore:-s,secondOf:-s,secondAfter:-s,secondClamp:-s,bpm:this.getTimingData("BPMS")[0]?.value??120,warped:!1});for(const n of t){if(e.at(-1)?.beat!=n.beat){e.at(-1).secondClamp=Math.max(Math.max(e.at(-2)?.secondClamp??-s,e.at(-2)?.secondAfter??-s),e.at(-1).secondBefore);let a=(n.beat-e.at(-1).beat)*60/e.at(-1).bpm;e.at(-1).warped&&(a=0),e.push({beat:n.beat,secondBefore:e.at(-1).secondAfter+a,secondOf:e.at(-1).secondAfter+a,secondAfter:e.at(-1).secondAfter+a,secondClamp:0,bpm:e.at(-1).bpm,warped:e.at(-1).warped})}n.type=="WARPS"&&(e.at(-1).warped=!0),n.type=="WARP_DEST"&&(e.at(-1).warped=!1),n.type=="BPMS"&&(e.at(-1).bpm=n.value),n.type=="STOPS"&&(e.at(-1).secondAfter+=n.value),n.type=="DELAYS"&&(e.at(-1).secondOf+=n.value,e.at(-1).secondAfter+=n.value)}e.at(-1).secondClamp=Math.max(e.at(-2)?.secondClamp??-s,e.at(-1).secondBefore),this._cache.beatTiming=e,this._cache.warpedBeats.clear(),this._cache.beatsToSeconds.clear()}buildEffectiveBeatTimingDataCache(){const e=[...this.getTimingData("SCROLLS")];let t=0;if(e.length==0){this._cache.effectiveBeatTiming=[];return}e[0].beat!=0&&e.unshift({type:"SCROLLS",beat:0,value:1}),t=e[0].beat;for(let r=0;r({type:t.type,beat:t.beat,value:t.value,delay:t.delay,unit:t.unit,second:this.getSecondsFromBeat(t.beat)}));this._cache.speeds=e}buildTimingDataCache(){Jr.forEach(e=>{this._cache.events[e]=this.events[e]??this._fallback?.events[e]??[]}),this._cache.sortedEvents=Jr.map(e=>this._cache.events[e]).flat().sort((e,t)=>e.beat-t.beat);for(const e of this._cache.sortedEvents)e.type=="DELAYS"?e.second=this.getSecondsFromBeat(e.beat,"before"):e.type=="ATTACKS"?e.beat=this.getBeatFromSeconds(e.second):e.second=this.getSecondsFromBeat(e.beat);this._cache.sortedEvents.sort((e,t)=>e.beat-t.beat)}searchCache(e,t,r){return Mi(e,r,s=>s[t])}getBeatFromSeconds(e){if(!isFinite(e))return 0;if(this._cache.beatTiming==null&&this.buildBeatTimingDataCache(),e+this.getTimingData("OFFSET")<0)return(e+this.getTimingData("OFFSET"))*this._cache.beatTiming[0].bpm/60;const t=this._cache.beatTiming,r=this.searchCache(t,"secondClamp",e),s=t[r],n=Math.max(0,e-s.secondAfter);return s.beat+n*s.bpm/60}getSecondsFromBeat(e,t){if(t||="",!isFinite(e))return 0;this._cache.beatTiming==null&&this.buildBeatTimingDataCache();const r=Math.floor(e*1e3)/1e3;if(e<=0){const u=this._cache.beatTiming[0].bpm;return-this.getTimingData("OFFSET")+e*60/u}const s=`${e}-${t}`;if(this._cache.beatsToSeconds.has(s))return this._cache.beatsToSeconds.get(s);const n=this._cache.beatTiming,a=this.searchCache(n,"beat",r),o=n[a];if(o.beat==r){if(t=="noclamp"||t=="")return this._cache.beatsToSeconds.set(s,o.secondOf),o.secondOf;if(t=="before")return this._cache.beatsToSeconds.set(s,o.secondBefore),o.secondBefore;if(t=="after")return this._cache.beatsToSeconds.set(s,o.secondAfter),o.secondAfter}let c=(e-o.beat)*60/o.bpm;return o.warped&&(c=0),t=="noclamp"?(this._cache.beatsToSeconds.set(s,o.secondAfter+c),o.secondAfter+c):(this._cache.beatsToSeconds.set(s,Math.max(o.secondClamp,o.secondAfter+c)),Math.max(o.secondClamp,o.secondAfter+c))}isBeatWarped(e){if(!isFinite(e))return!1;const t=Math.floor(e*1e3)/1e3;if(this._cache.warpedBeats.has(t))return this._cache.warpedBeats.get(t);this._cache.beatTiming==null&&this.buildBeatTimingDataCache();const r=this._cache.beatTiming,s=this.searchCache(r,"beat",t),n=r[s],a=n.beat==t?n.secondClamp:Math.max(n.secondAfter,n.secondClamp);return n.secondOf=s.beat&&te&&s.beat>0)return e;let n=s.effectiveBeat;const a=e-s.beat;return n+=a*s.value,n}getBeatFromEffectiveBeat(e){if(!isFinite(e))return 0;this._cache.effectiveBeatTiming==null&&this.buildEffectiveBeatTimingDataCache();const t=this._cache.effectiveBeatTiming;if(t.length==0)return e;let r=0;for(;t[r+1]&&(t[r].value<=0||t[r+1].effectiveBeat<=e);)r++;let n=(e-t[r].effectiveBeat)/t[r].value;return isFinite(n)||(n=0),t[r].beat+n}getSpeedMult(e,t){if(!isFinite(e)||!isFinite(t))return 0;this._cache.speeds==null&&this.buildSpeedsTimingDataCache();const r=this._cache.speeds;if(r.length==0)return 1;const s=this.searchCache(r,"beat",e),n=r[s];if(n==null)return 1;let a=e-n.beat;n.unit=="T"&&(a=t-n.second);let o=at(a/n.delay,0,1);n.delay==0&&(o=1);const l=r[s-1]?.value??1;return o*(n.value-l)+l}getBPM(e){return this.getBPMEvent(e)?.value??120}getBPMEvent(e){if(!isFinite(e))return;this._cache.beatTiming==null&&this.buildBeatTimingDataCache();const t=this.getTimingData("BPMS");if(t.length!=0)return t[this.searchCache(t,"beat",e)]}getTimingEventAtBeat(e,t){const r=this.getTimingData(e);if(!Array.isArray(r))return;const s=r[this.searchCache(r,"beat",t)];if(!(s?.beat&&s.beat>t))return s}reloadCache(e){this.buildTimingDataCache(),(e==null||e=="OFFSET"||["WARPS","STOPS","DELAYS","BPMS"].includes(e))&&this.buildBeatTimingDataCache(),(e==null||e=="SCROLLS")&&this.buildEffectiveBeatTimingDataCache(),(e==null||e=="TIMESIGNATURES")&&this.buildMeasureTimingCache(),(e==null||e=="SPEEDS")&&this.buildSpeedsTimingDataCache(),this._chart?.recalculateNotes()}binsert(e,t){let r="beat";const s=this.events[e];e=="ATTACKS"&&(r="second");let n=0,a=s.length;for(;n>>1;s[o][r]>>1;if(s[o][r]==t[r])return o;s[o][r]t[r]&&(a=o-1)}return-1}getBeatTiming(){return[...this._cache.beatTiming]}getTimingData(...e){return e.length==0?this._cache.sortedEvents:e.includes("OFFSET")?this.offset??this._fallback?.offset??0:e.length==1&&e[0]in this._cache.events?this._cache.events[e[0]]:(this._cache.sortedEvents==null&&this.buildTimingDataCache(),this._cache.sortedEvents.filter(r=>e.includes(r.type)))}isEmpty(){for(const e of Object.values(this.events))if(e)return!1;return!0}isTypeChartSpecific(e){return!!this.events[e]}requiresSSC(){return this.getTimingData("WARPS","DELAYS","SCROLLS","TICKCOUNTS","FAKES","LABELS","SPEEDS","TIMESIGNATURES","COMBOS").length!=0}serialize(e){let t="";this.offset&&(t+="#OFFSET:"+this.offset+`; +`);for(let o=0;oa[u]?a[u]=void 0:a[u]1&&r.counts.Jumps++,n+c>2&&r.counts.Hands++,n=0,s=l.beat}if(l.type!="Mine"&&!l.fake&&n++,l.fake){r.counts.Fakes++;continue}switch(l.type){case"Tap":r.counts.Taps++;break;case"Hold":r.counts.Holds++;break;case"Roll":r.counts.Rolls++;break;case"Lift":r.counts.Lifts++;break;case"Mine":r.counts.Mines++;break}De(l)&&(a[l.col]=l.beat+l.hold)}let o=0;for(let l=0;l1&&r.counts.Jumps++,n+o>2&&r.counts.Hands++,r}getNPSPerMeasure(e,t){const r=e[e.length-1]?.beat??0,s=[];let n=0;for(let a=0;a>16,r=i>>8&255,s=i&255;return t=Je(t*e,0,255),r=Je(r*e,0,255),s=Je(s*e,0,255),vo(t,r,s)}function Uh(i,e,t){const[r,s,n]=i.match(/\w\w/g).map(d=>parseInt(d,16)),[a,o,l]=e.match(/\w\w/g).map(d=>parseInt(d,16)),c=Math.round(r+(a-r)*t).toString(16).padStart(2,"0"),u=Math.round(s+(o-s)*t).toString(16).padStart(2,"0"),h=Math.round(n+(l-n)*t).toString(16).padStart(2,"0");return"#"+c+u+h}const aE=ie.from("assets/noteskin/dance/mine/frame.png");class We{static noop_frag;static noop_vert;static arrow_gradient_frag;static mine_gradient_frag;static lift_gradient_frag;static arrow_parts_texture=Me.from("assets/noteskin/dance/tap/parts.png",{mipmap:$t.OFF});static mine_parts_texture=Me.from("assets/noteskin/dance/mine/parts.png",{mipmap:$t.OFF});static lift_parts_texture=Me.from("assets/noteskin/dance/lift/parts.png",{mipmap:$t.OFF});static arrow_body_geometry;static arrow_frame_geometry;static lift_body_geometry;static mine_body_geometry;static arrow_frame_tex;static arrow_frame;static arrow_tex;static arrow_container=new xe;static lift_tex;static lift_container=new xe;static mine_tex;static mine_container=new xe;static loaded=!1;static async initArrowTex(e){if(!this.loaded){We.arrow_frame_tex=yt.create({width:64,height:64,resolution:A.performance.resolution}),We.arrow_tex=yt.create({width:256,height:320,resolution:A.performance.resolution}),We.lift_tex=yt.create({width:256,height:320,resolution:A.performance.resolution}),We.mine_tex=yt.create({width:64,height:64,resolution:A.performance.resolution}),this.noop_frag=await fetch("assets/noteskin/dance/shader/noop.frag").then(t=>t.text()),this.noop_vert=await fetch("assets/noteskin/dance/shader/noop.vert").then(t=>t.text()),this.arrow_gradient_frag=await fetch("assets/noteskin/dance/shader/arrow_gradient.frag").then(t=>t.text()),this.mine_gradient_frag=await fetch("assets/noteskin/dance/shader/mine_gradient.frag").then(t=>t.text()),this.lift_gradient_frag=await fetch("assets/noteskin/dance/shader/lift_gradient.frag").then(t=>t.text()),this.arrow_body_geometry=await this.loadGeometry("assets/noteskin/dance/tap/body.txt"),this.arrow_frame_geometry=await this.loadGeometry("assets/noteskin/dance/tap/frame.txt"),this.mine_body_geometry=await this.loadGeometry("assets/noteskin/dance/mine/body.txt"),this.lift_body_geometry=await this.loadGeometry("assets/noteskin/dance/lift/body.txt");{const t=Ut.from(this.noop_vert,this.noop_frag,{sampler0:this.arrow_parts_texture}),r=new xr(We.arrow_frame_geometry,t);r.x=32,r.y=32,r.rotation=-Math.PI/2,this.arrow_frame=r}for(let t=0;t<10;t++){const r=Ut.from(this.noop_vert,this.arrow_gradient_frag,{sampler0:this.arrow_parts_texture,time:0,quant:t}),s=new Be(We.arrow_frame_tex);s.x=t%3*64,s.y=Math.floor(t/3)*64;const n=new xr(We.arrow_body_geometry,r);n.x=t%3*64+32,n.y=Math.floor(t/3)*64+32,n.rotation=-Math.PI/2,n.name="body"+t,We.arrow_container.addChild(s),We.arrow_container.addChild(n)}for(let t=0;t<10;t++){const r=Ut.from(this.noop_vert,this.lift_gradient_frag,{sampler0:this.lift_parts_texture,time:0,quant:t}),s=new xr(We.lift_body_geometry,r);s.x=t%3*64+32,s.y=Math.floor(t/3)*64+32,s.rotation=-Math.PI/2,s.name="body"+t,We.lift_container.addChild(s)}{const t=Ut.from(this.noop_vert,this.mine_gradient_frag,{sampler0:this.mine_parts_texture,time:0}),r=new xr(We.mine_body_geometry,t),s=new Be(aE);s.width=64,s.height=64,s.anchor.set(.5),s.pivot.y=3,We.mine_container.position.set(32),We.mine_container.addChild(r),We.mine_container.addChild(s)}e.ticker.add(()=>{e.renderer.render(We.arrow_frame,{renderTexture:We.arrow_frame_tex}),e.renderer.render(We.arrow_container,{renderTexture:We.arrow_tex}),e.renderer.render(We.mine_container,{renderTexture:We.mine_tex}),e.renderer.render(We.lift_container,{renderTexture:We.lift_tex})}),this.loaded=!0}}static async loadGeometry(e){try{const r=(await fetch(e).then(c=>c.text())).split(` +`),s=parseInt(r[0]),n=parseInt(r[s+1]),a=[],o=[],l=[];for(let c=0;c.6&&t<.8){const r=(t-.6)/.2*(t-.6)/.2;e.scale.set(.3*(1-r))}}Ht(this.children,e=>Date.now()-e.createTime>800)}addJudge(e,t){if(!rn(t)&&!Er(t))return;const r=new Be(rn(t)?Yr.dropped_tex:Yr.held_tex);r.anchor.set(.5),r.x=this.notefield.getColX(e),r.createTime=Date.now(),r.scale.set(0),this.addChild(r)}}class hs extends xe{pool=[];options;constructor(e){super(),this.options=e}createChild(){if(this.pool.length==0&&this.options.maxPoolSize!==void 0&&this.children.length>=this.options.maxPoolSize)return;const e=this.pool.pop()??this.options.create();return this.addChild(e),e._disabledTime=Date.now(),e}destroyChild(e){this.children.includes(e)&&(e.removeFromParent(),e.removeAllListeners(),e.eventMode="auto",e._disabledTime=Date.now(),this.pool.push(e))}destroyAll(){this.children.forEach(e=>e._disabledTime=Date.now()),this.pool.push(...this.children),this.children.forEach(e=>{e.removeAllListeners(),e.eventMode="auto"}),this.removeChildren()}_render(e){super._render(e);const t=Date.now();for(;t-this.pool[0]?._disabledTime>(this.options.destroyTimer??5e3);)this.pool.shift().destroy()}getPoolSize(){return this.pool.length+this.children.length}}class se extends nn{static _instance;static get instance(){return se._instance||(se._instance=new se),se._instance}static emit(e,...t){return se.instance.emit(e,...t)}static on(e,t,r){se.instance.on(e,t,r)}static off(e,t,r,s){se.instance.off(e,t,r,s)}}class pE extends xe{children=[];notefield;arrowMap=new Map;arrowPool=new hs({create:()=>xt.createArrow()});notesDirty=!1;constructor(e){super(),this.notefield=e,this.arrowPool.sortableChildren=!0,this.addChild(this.arrowPool);const t=()=>{for(const[s,n]of this.arrowMap.entries())xt.setData(this.notefield,n,s,this.notefield.getTimingData())},r=()=>this.notesDirty=!0;se.on("timeSigChanged",t),se.on("chartModified",r),this.on("destroyed",()=>{se.off("timeSigChanged",t),se.on("chartModified",r)})}update(e,t){if(this.notesDirty){const r=this.notefield.getNotedata();for(const[s,n]of this.arrowMap.entries())r.includes(s)||(this.arrowPool.destroyChild(n),this.arrowMap.delete(s))}We.setArrowTexTime(this.notefield.getBeat(),this.notefield.getTime());for(const r of this.notefield.getNotedata()){if(r.beat>t)break;if(this.shouldDisplayNote(r,e,t)&&!this.arrowMap.has(r)){const s=this.arrowPool.createChild();if(!s)continue;s.x=this.notefield.getColX(r.col),s.zIndex=r.beat,Object.assign(s,{zIndex:r.beat}),xt.setData(this.notefield,s,r,this.notefield.getTimingData()),this.notefield.getRenderer().registerDragNote(s,r),this.arrowMap.set(r,s)}}for(const[r,s]of this.arrowMap.entries()){if(!this.shouldDisplayNote(r,e,t)){this.arrowPool.destroyChild(s),this.arrowMap.delete(r);continue}if(s.y=A.chart.receptorYPos/A.chart.zoom,(!De(r)||!r.gameplay?.lastHoldActivation||this.notefield.getBeat()r)}}const mE=ie.from("assets/noteskin/dance/flash/hold.png"),Nl={w0:ie.from("assets/noteskin/dance/flash/fantastic.png"),w1:ie.from("assets/noteskin/dance/flash/white_fantastic.png"),w2:ie.from("assets/noteskin/dance/flash/excellent.png"),w3:ie.from("assets/noteskin/dance/flash/great.png"),w4:ie.from("assets/noteskin/dance/flash/decent.png"),w5:ie.from("assets/noteskin/dance/flash/way_off.png"),mine:ie.from("assets/noteskin/dance/flash/mine.png")};class gE extends xe{notefield;children=[];constructor(e){super(),this.notefield=e}update(){this.y=A.chart.receptorYPos/A.chart.zoom,this.scale.y=A.chart.reverse?-1:1;for(const e of this.children)switch(e.type){case"flash":{const t=(Date.now()-e.createTime)/150;e.scale.set(1.1-t*.1),e.alpha=1.2-t*1.2;break}case"mine":{const t=(Date.now()-e.createTime)/600;e.rotation=t*-Math.PI,e.alpha=Math.min(1,2-2*t);break}case"hold":e.alpha=Math.sin(Date.now())*.2+1.2}Ht(this.children,e=>Date.now()-e.createTime>150&&e.type=="flash"),Ht(this.children,e=>Date.now()-e.createTime>600&&e.type=="hold")}addFlash(e,t){if(!A.chart.drawNoteFlash)return;let r;if(Gi(t)&&(r=Nl[t.id]),ts(t)&&(r=Nl.mine),Er(t)&&(r=Nl.w2),(Er(t)||rn(t))&&Ht(this.children,n=>n.type=="hold"&&n.col==e),!r)return;const s=new Be(r);s.anchor.set(.5),s.rotation=this.notefield.getRotFromCol(e),s.x=this.notefield.getColX(e),s.createTime=Date.now(),s.type="flash",s.col=e,ts(t)&&(s.type="mine",s.blendMode=Ae.ADD),this.addChild(s)}activateHold(e){if(!A.chart.drawNoteFlash)return;const t=new Be(mE);t.anchor.set(.5),t.rotation=this.notefield.getRotFromCol(e),t.x=this.notefield.getColX(e),t.type="hold",t.col=e,this.addChild(t)}reset(){Ht(this.children,e=>e.type=="hold")}}const yE=ie.from("assets/noteskin/dance/receptor.png");class vE extends xe{notefield;receptors=new xe;pressedCols=new lm;children=[];constructor(e){super(),this.notefield=e;for(let t=0;txt.createArrow()});lastBeatShift=0;lastColShift=0;constructor(e){super(),this.notefield=e,this.arrowPool.sortableChildren=!0,this.addChild(this.arrowPool)}update(e,t){if(!this.notefield.getRenderer().chartManager.selection.shift){this.arrowPool.destroyAll(),this.arrowMap.clear(),this.lastBeatShift;return}const r=this.notefield.getRenderer().chartManager.selection.shift.beatShift,s=this.notefield.getRenderer().chartManager.selection.shift.columnShift;if(this.lastBeatShift!=r||this.lastColShift!=s){this.lastBeatShift=r,this.lastColShift=s;for(const[n,a]of this.arrowMap.entries())xt.setData(this.notefield,a,{beat:n.beat+r,col:n.col+s,type:n.type},this.notefield.getRenderer().chart.timingData),a.x=this.notefield.getColX(n.col+s)}for(const n of this.notefield.getRenderer().chartManager.selection.notes)if(!(n.beat+r+(De(n)?n.hold:0)t)&&!this.arrowMap.has(n)){const a=this.arrowPool.createChild();if(!a)continue;a.x=this.notefield.getColX(n.col+s),a.zIndex=n.beat,a.alpha=.4,xt.setData(this.notefield,a,{beat:n.beat+r,col:n.col+s,type:n.type},this.notefield.getRenderer().chart.timingData),this.arrowMap.set(n,a)}for(const[n,a]of this.arrowMap.entries()){if(n.beat+r+(De(n)?n.hold:0)t){this.arrowPool.destroyChild(a),this.arrowMap.delete(n);continue}const o=n.beat+r;if(a.y=this.notefield.getRenderer().getYPosFromBeat(o),a.selection.alpha=Math.sin(Date.now()/320)*.1+.3,a.item.scale.y=A.chart.reverse?-1:1,De(n)){const l=this.notefield.getRenderer().getYPosFromBeat(o+(De(n)?n.hold:0))-a.y;xt.setHoldLength(a,l),xt.setHoldBrightness(a,.8)}}}}class un extends nE{receptors;notes;selectionNotes;flashes;holdJudges;ghostNote;ghostNoteEntry;constructor(e){super(e),We.initArrowTex(e.chartManager.app),this.receptors=new vE(this),this.notes=new pE(this),this.selectionNotes=new bE(this),this.flashes=new gE(this),this.holdJudges=new Yr(this),this.ghostNote=xt.createArrow(),this.ghostNote.visible=!1,this.ghostNote.alpha=.4,this.addChild(this.receptors,this.ghostNote,this.notes,this.selectionNotes,this.flashes,this.holdJudges)}setGhostNote(e){if(this.ghostNoteEntry=e,!e){this.ghostNote.visible=!1;return}xt.setData(this,this.ghostNote,e,this.renderer.chart.timingData),this.ghostNote.x=this.getColX(e.col)}getNoteSprite(e){const t=xt.createArrow();return xt.setData(this,t,e,this.renderer.chart.timingData),t}update(e,t){this.receptors.update(),this.notes.update(e,t),this.selectionNotes.update(e,t),this.flashes.update(),this.holdJudges.update(),this.ghostNoteEntry&&(this.ghostNote.y=this.renderer.getYPosFromBeat(this.ghostNoteEntry.beat),this.ghostNote.item.scale.y=A.chart.reverse?-1:1,this.ghostNote.visible=A.chart.mousePlacement&&this.renderer.chartManager.getMode()==Z.Edit&&this.renderer.chartManager.editTimingMode==He.Off&&this.ghostNoteEntry.beat>=e&&this.ghostNoteEntry.beat<=t&&this.ghostNoteEntry.beat>=0)}doJudge(e,t){this.flashes.addFlash(e,t),this.holdJudges.addJudge(e,t)}endPlay(){this.flashes.reset()}keyDown(e){this.receptors.keyDown(e)}keyUp(e){this.receptors.keyUp(e)}activateHold(e){this.flashes.activateHold(e)}getColX(e){return(e-this.getNumCols()/2+.5)*64}getNumCols(){return this.renderer.chart.gameType.numCols}getRotFromCol(e){let t=[0,-90,90,180];return this.getNumCols()==3&&(t=[45,-90,135]),(this.getNumCols()==6||this.getNumCols()==12)&&(t=[0,45,-90,90,135,180]),this.getNumCols()==8&&(t=[0,-90,90,180,0,-90,90,180]),t[e%t.length]/180*Math.PI}}class Ze{static gameTypes={};static priority=[];static register(e){Ze.gameTypes[e.id]=e,this.priority.push(e)}static getPriority(){return this.priority}static getGameType(e){return Ze.gameTypes[e]}static getTypes(){return this.gameTypes}}Ze.register({id:"dance-single",numCols:4,notefieldWidth:4*64,gameLogic:new cn,parser:new dn,notefield:un,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[3,1,2,0],vertical:[0,2,1,3]}});Ze.register({id:"dance-double",numCols:8,notefieldWidth:8*64,gameLogic:new cn,parser:new dn,notefield:un,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[3,1,2,0,7,5,6,4],vertical:[0,2,1,3,4,6,5,7]}});Ze.register({id:"dance-couple",numCols:8,notefieldWidth:8*64,gameLogic:new cn,parser:new dn,notefield:un,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[3,1,2,0,7,5,6,4],vertical:[0,2,1,3,4,6,5,7]}});Ze.register({id:"dance-solo",numCols:6,notefieldWidth:6*64,gameLogic:new cn,parser:new dn,notefield:un,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[5,4,2,3,1,0],vertical:[0,1,3,2,4,5]}});Ze.register({id:"dance-solodouble",numCols:12,notefieldWidth:12*64,gameLogic:new cn,parser:new dn,notefield:un,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[5,4,2,3,1,0,11,10,8,9,7,6],vertical:[0,1,3,2,4,5,6,7,9,8,10,11]}});Ze.register({id:"dance-3panel",numCols:3,notefieldWidth:3*64,gameLogic:new cn,parser:new dn,notefield:un,editNoteTypes:["Tap","Mine","Fake","Lift"],flipColumns:{horizontal:[2,1,0],vertical:[0,1,2]}});const _i=["Beginner","Easy","Medium","Hard","Challenge","Edit"];class pt{items=[];itemIndex=0;limit=0;app;static instance;constructor(e){this.app=e,pt.instance||(pt.instance=this)}run(e){e.action(this.app),this.items.splice(this.itemIndex,this.items.length-this.itemIndex,e),this.itemIndex++}undo(){this.items[this.itemIndex-1]&&(this.items[this.itemIndex-1].undo(this.app),this.itemIndex--,se.emit("undo"))}redo(){this.items[this.itemIndex]&&(this.items[this.itemIndex].redo?this.items[this.itemIndex].redo(this.app):this.items[this.itemIndex].action(this.app),this.itemIndex++,se.emit("redo"))}reset(){this.itemIndex=0,this.items=[]}canUndo(){return this.itemIndex>0}canRedo(){return this.itemIndex!=this.items.length}setLimit(){this.limit=this.itemIndex}isDirty(){return this.itemIndex!=this.limit}}const is=["BPMS","STOPS","WARPS","DELAYS","LABELS","SPEEDS","SCROLLS","TICKCOUNTS","TIMESIGNATURES","COMBOS","FAKES","ATTACKS","BGCHANGES","FGCHANGES"];class mm{_fallback;_cache={events:{},warpedBeats:new Map,beatsToSeconds:new Map};_chart;events={};offset;constructor(e,t){this._fallback=e,this._chart=t}parse(e,t){if(e=="OFFSET"){this.offset=parseFloat(t);return}this.events[e]||=[];let r=t.replaceAll(/[\n\r\t]/g,"").split(",");e=="ATTACKS"&&(r=[t.replaceAll(/[\n\r\t]/g,"")]);for(const s of r){if(e=="ATTACKS"){let o;const l=/TIME=([\d.]+):(END|LEN)=([\d.]+):MODS=([^:]+)/g;for(;(o=l.exec(s))!=null;){const c={type:"ATTACKS",second:parseFloat(o[1]),endType:o[2],value:parseFloat(o[3]),mods:o[4]};this._insert("ATTACKS",c,!1)}return}const n=s.split("=");if(n.length<2)continue;let a;switch(e){case"BPMS":case"STOPS":case"WARPS":case"DELAYS":case"SCROLLS":case"TICKCOUNTS":case"FAKES":a={type:e,beat:parseFloat(n[0]),value:parseFloat(n[1])};break;case"LABELS":a={type:e,beat:parseFloat(n[0]),value:n[1]};break;case"SPEEDS":a={type:e,beat:parseFloat(n[0]),value:parseFloat(n[1]),delay:parseFloat(n[2]),unit:n[3]=="0"?"B":"T"};break;case"TIMESIGNATURES":a={type:e,beat:parseFloat(n[0]),upper:parseInt(n[1]),lower:parseInt(n[2])};break;case"COMBOS":a={type:e,beat:parseFloat(n[0]),hitMult:parseInt(n[1]),missMult:parseInt(n[2]??n[1])};break;case"BGCHANGES":case"FGCHANGES":a={type:e,beat:parseFloat(n[0]),file:n[1],updateRate:parseFloat(n[2]),crossFade:n[3]=="1",stretchRewind:n[4]=="1",stretchNoLoop:n[5]=="1",effect:n[6]??"",file2:n[7]??"",transition:n[8]??"",color1:n[9]??"",color2:n[10]??""}}this._insert(e,a,!1)}}_insert(e,t,r){this.binsert(e,t),(r??!0)&&this.reloadCache(e)}delete(e,t,r){const s=e?this:this._fallback;if(!s.events[t])return;r=de(r,3);const n=s.bindex(t,{type:t,beat:r,second:r});if(n==-1||n==0&&t=="BPMS")return;const a=s.events[t][n];pt.instance.run({action:()=>{s._delete(a),s.reloadCache(t),this!=s&&this.reloadCache(t),se.emit("timingModified")},undo:()=>{s._insert(a.type,a),s.reloadCache(t),this!=s&&this.reloadCache(t),se.emit("timingModified")}})}_delete(e,t){if(!this.events[e.type])return;const r=this.bindex(e.type,e);r>-1&&(this.events[e.type].splice(r,1),(t??!0)&&this.reloadCache(e.type))}isDuplicate(e,t){if(["STOPS","WARPS","DELAYS","FAKES","BGCHANGES","FGCHANGES"].includes(e.type)||t.type!=e.type)return!1;switch(e.type){case"BPMS":case"SCROLLS":case"TICKCOUNTS":case"LABELS":return t.type==e.type&&e.value==t.value;case"SPEEDS":return t.type==e.type&&e.value==t.value&&e.delay==t.delay&&e.unit==t.unit;case"TIMESIGNATURES":return t.type==e.type&&e.upper==t.upper&&e.lower==t.lower;case"COMBOS":return t.type==e.type&&e.hitMult==t.hitMult&&e.missMult==t.missMult;default:return!1}}isSimilar(e,t){if(["STOPS","WARPS","DELAYS","FAKES","BGCHANGES","FGCHANGES"].includes(e.type)||t.type!=e.type)return!1;switch(e.type){case"BPMS":case"SCROLLS":case"TICKCOUNTS":case"SPEEDS":case"LABELS":return t.type==e.type&&e.value==t.value;case"TIMESIGNATURES":return t.type==e.type&&e.upper==t.upper&&e.lower==t.lower;case"COMBOS":return t.type==e.type&&e.hitMult==t.hitMult&&e.missMult==t.missMult;default:return!1}}isNullEvent(e){switch(e.type){case"BPMS":case"TICKCOUNTS":case"TIMESIGNATURES":case"COMBOS":return!1;case"STOPS":case"WARPS":case"DELAYS":case"SCROLLS":case"FAKES":return e.value==0;case"LABELS":case"ATTACKS":return e.value=="";case"SPEEDS":return!1;case"FGCHANGES":case"BGCHANGES":return e.file==""&&e.file2==""}}insert(e,t,r,s){const n=e?this:this._fallback;if(t=="OFFSET"){n.offset=r,this.reloadCache("OFFSET");return}if(Object.keys(r).length==0)return;n.events[t]||(e?n.events[t]=JSON.parse(JSON.stringify(this._fallback.events[t])):n.events[t]=[]),s=de(s,3);const a=n.getTimingEventAtBeat(t,s),o={type:t,beat:s},l=[],c=[];if(Object.assign(o,r),a&&this.isDuplicate(o,a))return;a?.beat==s&&l.push(a);const u=n.getTimingEventAtBeat(t,s-.001);if(this.isNullEvent(o))return;(!u||!this.isSimilar(u,o)||a&&this.isDuplicate(u,a))&&c.push(o);const h=this.getTimingData(t),d=h[n.searchCache(h,"beat",s)+1];d&&this.isDuplicate(o,d)&&l.push(d),(l.length||c.length)&&pt.instance.run({action:()=>{for(const f of l)n._delete(f);for(const f of c)n._insert(t,f);this.reloadCache(t),se.emit("timingModified"),se.emit("chartModified"),t=="TIMESIGNATURES"&&se.emit("timeSigChanged")},undo:()=>{for(const f of c)n._delete(f);for(const f of l)n._insert(t,f);this.reloadCache(t),se.emit("timingModified"),se.emit("chartModified"),t=="TIMESIGNATURES"&&se.emit("timeSigChanged")}})}rawDeleteMultiple(e){for(const t of e){const s=this.events[t.type]?this:this._fallback;t.beat=de(t.beat,3),s._delete(t)}this.reloadCache()}rawInsertMultiple(e){for(const t of e){const r=this.events[t.type],s=r?this:this._fallback;s.events[t.type]||(r?s.events[t.type]=JSON.parse(JSON.stringify(this._fallback.events[t.type])):s.events[t.type]=[]),t.beat=de(t.beat,3),s._insert(t.type,t)}this.reloadCache()}findConflicts(){const e=[];for(const t of is){const r=this.getTimingData(t);if(r.length<2)continue;let s=r[0];for(let n=1;n({type:"WARP_DEST",beat:n.beat+n.value,value:n.value})));const r=["WARP_DEST","BPMS","STOPS","WARPS","DELAYS"];t.sort((n,a)=>n.beat==a.beat?r.indexOf(n.type)-r.indexOf(a.type):n.beat-a.beat);const s=this.getTimingData("OFFSET");e.push({beat:0,secondBefore:-s,secondOf:-s,secondAfter:-s,secondClamp:-s,bpm:this.getTimingData("BPMS")[0]?.value??120,warped:!1});for(const n of t){if(e.at(-1)?.beat!=n.beat){e.at(-1).secondClamp=Math.max(Math.max(e.at(-2)?.secondClamp??-s,e.at(-2)?.secondAfter??-s),e.at(-1).secondBefore);let a=(n.beat-e.at(-1).beat)*60/e.at(-1).bpm;e.at(-1).warped&&(a=0),e.push({beat:n.beat,secondBefore:e.at(-1).secondAfter+a,secondOf:e.at(-1).secondAfter+a,secondAfter:e.at(-1).secondAfter+a,secondClamp:0,bpm:e.at(-1).bpm,warped:e.at(-1).warped})}n.type=="WARPS"&&(e.at(-1).warped=!0),n.type=="WARP_DEST"&&(e.at(-1).warped=!1),n.type=="BPMS"&&(e.at(-1).bpm=n.value),n.type=="STOPS"&&(e.at(-1).secondAfter+=n.value),n.type=="DELAYS"&&(e.at(-1).secondOf+=n.value,e.at(-1).secondAfter+=n.value)}e.at(-1).secondClamp=Math.max(e.at(-2)?.secondClamp??-s,e.at(-1).secondBefore),this._cache.beatTiming=e,this._cache.warpedBeats.clear(),this._cache.beatsToSeconds.clear()}buildEffectiveBeatTimingDataCache(){const e=[...this.getTimingData("SCROLLS")];let t=0;if(e.length==0){this._cache.effectiveBeatTiming=[];return}e[0].beat!=0&&e.unshift({type:"SCROLLS",beat:0,value:1}),t=e[0].beat;for(let r=0;r({type:t.type,beat:t.beat,value:t.value,delay:t.delay,unit:t.unit,second:this.getSecondsFromBeat(t.beat)}));this._cache.speeds=e}buildTimingDataCache(){is.forEach(e=>{this._cache.events[e]=this.events[e]??this._fallback?.events[e]??[]}),this._cache.sortedEvents=is.map(e=>this._cache.events[e]).flat().sort((e,t)=>e.beat-t.beat);for(const e of this._cache.sortedEvents)e.type=="DELAYS"?e.second=this.getSecondsFromBeat(e.beat,"before"):e.type=="ATTACKS"?e.beat=this.getBeatFromSeconds(e.second):e.second=this.getSecondsFromBeat(e.beat);this._cache.sortedEvents.sort((e,t)=>e.beat-t.beat)}searchCache(e,t,r){return ki(e,r,s=>s[t])}getBeatFromSeconds(e){if(!isFinite(e))return 0;if(this._cache.beatTiming==null&&this.buildBeatTimingDataCache(),e+this.getTimingData("OFFSET")<0)return(e+this.getTimingData("OFFSET"))*this._cache.beatTiming[0].bpm/60;const t=this._cache.beatTiming,r=this.searchCache(t,"secondClamp",e),s=t[r],n=Math.max(0,e-s.secondAfter);return s.beat+n*s.bpm/60}getSecondsFromBeat(e,t){if(t||="",!isFinite(e))return 0;this._cache.beatTiming==null&&this.buildBeatTimingDataCache();const r=Math.floor(e*1e3)/1e3;if(e<=0){const u=this._cache.beatTiming[0].bpm;return-this.getTimingData("OFFSET")+e*60/u}const s=`${e}-${t}`;if(this._cache.beatsToSeconds.has(s))return this._cache.beatsToSeconds.get(s);const n=this._cache.beatTiming,a=this.searchCache(n,"beat",r),o=n[a];if(o.beat==r){if(t=="noclamp"||t=="")return this._cache.beatsToSeconds.set(s,o.secondOf),o.secondOf;if(t=="before")return this._cache.beatsToSeconds.set(s,o.secondBefore),o.secondBefore;if(t=="after")return this._cache.beatsToSeconds.set(s,o.secondAfter),o.secondAfter}let c=(e-o.beat)*60/o.bpm;return o.warped&&(c=0),t=="noclamp"?(this._cache.beatsToSeconds.set(s,o.secondAfter+c),o.secondAfter+c):(this._cache.beatsToSeconds.set(s,Math.max(o.secondClamp,o.secondAfter+c)),Math.max(o.secondClamp,o.secondAfter+c))}isBeatWarped(e){if(!isFinite(e))return!1;const t=Math.floor(e*1e3)/1e3;if(this._cache.warpedBeats.has(t))return this._cache.warpedBeats.get(t);this._cache.beatTiming==null&&this.buildBeatTimingDataCache();const r=this._cache.beatTiming,s=this.searchCache(r,"beat",t),n=r[s],a=n.beat==t?n.secondClamp:Math.max(n.secondAfter,n.secondClamp);return n.secondOf=s.beat&&te&&s.beat>0)return e;let n=s.effectiveBeat;const a=e-s.beat;return n+=a*s.value,n}getBeatFromEffectiveBeat(e){if(!isFinite(e))return 0;this._cache.effectiveBeatTiming==null&&this.buildEffectiveBeatTimingDataCache();const t=this._cache.effectiveBeatTiming;if(t.length==0)return e;let r=0;for(;t[r+1]&&(t[r].value<=0||t[r+1].effectiveBeat<=e);)r++;let n=(e-t[r].effectiveBeat)/t[r].value;return isFinite(n)||(n=0),t[r].beat+n}getSpeedMult(e,t){if(!isFinite(e)||!isFinite(t))return 0;this._cache.speeds==null&&this.buildSpeedsTimingDataCache();const r=this._cache.speeds;if(r.length==0)return 1;const s=this.searchCache(r,"beat",e),n=r[s];if(n==null)return 1;let a=e-n.beat;n.unit=="T"&&(a=t-n.second);let o=Je(a/n.delay,0,1);n.delay==0&&(o=1);const l=r[s-1]?.value??1;return o*(n.value-l)+l}getBPM(e){return this.getBPMEvent(e)?.value??120}getBPMEvent(e){if(!isFinite(e))return;this._cache.beatTiming==null&&this.buildBeatTimingDataCache();const t=this.getTimingData("BPMS");if(t.length!=0)return t[this.searchCache(t,"beat",e)]}getTimingEventAtBeat(e,t){const r=this.getTimingData(e);if(!Array.isArray(r))return;const s=r[this.searchCache(r,"beat",t)];if(!(s?.beat&&s.beat>t))return s}reloadCache(e){this.buildTimingDataCache(),(e==null||e=="OFFSET"||["WARPS","STOPS","DELAYS","BPMS"].includes(e))&&this.buildBeatTimingDataCache(),(e==null||e=="SCROLLS")&&this.buildEffectiveBeatTimingDataCache(),(e==null||e=="TIMESIGNATURES")&&this.buildMeasureTimingCache(),(e==null||e=="SPEEDS")&&this.buildSpeedsTimingDataCache(),this._chart?.recalculateNotes()}binsert(e,t){let r="beat";const s=this.events[e];e=="ATTACKS"&&(r="second");let n=0,a=s.length;for(;n>>1;s[o][r]>>1;if(s[o][r]==t[r])return o;s[o][r]t[r]&&(a=o-1)}return-1}getBeatTiming(){return[...this._cache.beatTiming]}getTimingData(...e){return e.length==0?this._cache.sortedEvents:e.includes("OFFSET")?this.offset??this._fallback?.offset??0:e.length==1&&e[0]in this._cache.events?this._cache.events[e[0]]:(this._cache.sortedEvents==null&&this.buildTimingDataCache(),this._cache.sortedEvents.filter(r=>e.includes(r.type)))}isEmpty(){for(const e of Object.values(this.events))if(e)return!1;return!0}isTypeChartSpecific(e){return!!this.events[e]}requiresSSC(){return this.getTimingData("WARPS","DELAYS","SCROLLS","TICKCOUNTS","FAKES","LABELS","SPEEDS","TIMESIGNATURES","COMBOS").length!=0}serialize(e){let t="";this.offset&&(t+="#OFFSET:"+this.offset+`; `);let r=["BPMS","STOPS","WARPS","DELAYS","SPEEDS","SCROLLS","TICKCOUNTS","TIMESIGNATURES","LABELS","COMBOS","FAKES","BGCHANGES","FGCHANGES","ATTACKS"];e=="sm"&&(r=["BPMS","STOPS","TIMESIGNATURES","BGCHANGES","FGCHANGES","ATTACKS"]);for(const s of r)t+=this.formatProperty(e,s);return t}formatProperty(e,t){if(!this._fallback&&!this.events[t])return"";let s="";switch(t){case"ATTACKS":{s=this.getTimingData(t).map(a=>`TIME=${a.second}${a.endType}=${a.value}:MODS=${a.mods}`).join(`: `);break}case"BGCHANGES":case"FGCHANGES":{s=this.getTimingData(t).map(a=>`${a.beat}=${a.file}=${de(a.updateRate,3).toFixed(3)}=${Number(a.crossFade)}=${Number(a.stretchRewind)}=${Number(a.stretchNoLoop)}=${a.effect}=${a.file2}=${a.transition}=${a.color1}=${a.color2}`).join(`, `);break}case"BPMS":case"DELAYS":case"FAKES":case"SCROLLS":case"WARPS":{s=this.getTimingData(t).map(a=>`${de(a.beat,3).toFixed(3)}=${de(a.value,3).toFixed(3)}`).join(`, @@ -1172,7 +1173,7 @@ void main(void)\r `);break}case"TIMESIGNATURES":{s=this.getTimingData(t).map(a=>`${de(a.beat,3).toFixed(3)}=${a.upper}=${a.lower}`).join(`, `);break}}return s.includes(",")&&(s+=` `),"#"+t+":"+s+`; -`}getDefaultEvent(e,t){switch(e){case"BPMS":return{type:e,beat:t,value:120};case"STOPS":case"WARPS":case"DELAYS":case"FAKES":return{type:e,beat:t,value:0};case"LABELS":return{type:e,beat:t,value:""};case"SPEEDS":return{type:e,beat:t,value:1,delay:0,unit:"B"};case"SCROLLS":return{type:e,beat:t,value:1};case"TICKCOUNTS":return{type:e,beat:t,value:4};case"TIMESIGNATURES":return{type:e,beat:t,upper:4,lower:4};case"COMBOS":return{type:e,beat:t,hitMult:1,missMult:1};case"ATTACKS":return{type:e,second:this.getSecondsFromBeat(t),endType:"LEN",value:1,mods:""};case"BGCHANGES":case"FGCHANGES":return{type:e,beat:t,file:"",updateRate:1,crossFade:!1,stretchRewind:!1,stretchNoLoop:!1,effect:"",file2:"",transition:"",color1:"",color2:""}}}}class ym{gameType=Ze.getPriority()[0];description="";difficulty="Beginner";meter=1;meterF=1;radarValues="0,0,0,0,0";chartName="";chartStyle="";credit="";music;timingData;sm;other_properties={};notedata=[];_notedataStats;constructor(e,t){if(this.timingData=new gm(e.timingData,this),this.sm=e,!t){this.recalculateStats();return}if(e._type=="ssc"){const r=t;for(const n in r)(n=="OFFSET"||Jr.includes(n))&&this.timingData.parse(n,r[n]);this.timingData.reloadCache();const s=Ze.getGameType(r.STEPSTYPE);if(!s)throw Error("Unknown step type "+r.STEPSTYPE);if(this.gameType=s,this.description=r.DESCRIPTION??"",_i.includes(r.DIFFICULTY))this.difficulty=r.DIFFICULTY;else throw Error("Unknown chart difficulty "+r.DIFFICULTY);this.meter=parseInt(r.METER),(!isFinite(this.meter)||this.meter<0)&&(this.meter=0),this.meterF=parseFloat(r.METERF),(!isFinite(this.meterF)||this.meterF<0)&&(this.meterF=this.meter),this.radarValues=r.RADARVALUES??"",this.notedata=s.parser.fromString(r.NOTES).map(n=>this.computeNote(n))??[],this.credit=r.CREDIT??"",this.chartName=r.CHARTNAME??"",this.chartStyle=r.CHARTSTYLE??"",this.music=r.MUSIC;for(const n in r)["STEPSTYPE","DESCRIPTION","DIFFICULTY","METER","METERF","RADARVALUES","CREDIT","CHARTNAME","CHARTSTYLE","MUSIC","NOTES","NOTEDATA"].includes(n)||(this.other_properties[n]=r[n])}else{const r=/([\w\d-]+):[\s ]*([^:]*):[\s ]*([\w\d]+):[\s ]*([\d]+):[\s ]*([\d.,]*):[\s ]*([\w\d\s, ]*)/g.exec(t.trim());if(r!=null){const s=Ze.getGameType(r[1]);if(!s)throw Error("Unknown step type "+r[1]);if(this.gameType=s,this.description=r[2]??"",_i.includes(r[3]))this.difficulty=r[3];else throw Error("Unknown chart difficulty "+r[3]);this.meter=parseInt(r[4]),(!isFinite(this.meter)||this.meter<0)&&(this.meter=0),this.meterF=this.meter,this.radarValues=r[5]??"",this.notedata=s.parser.fromString(r[6]).map(n=>this.computeNote(n))??[]}else throw Error("Failed to load sm chart!")}this.recalculateStats()}getNotedataStats(){return this._notedataStats}getSecondsFromBeat(e,t){return this.timingData.getSecondsFromBeat(e,t)}getBeatFromSeconds(e){return this.timingData.getBeatFromSeconds(e)}getBeatFromEffectiveBeat(e){return this.timingData.getBeatFromEffectiveBeat(e)}isBeatWarped(e){return this.timingData.isBeatWarped(e)}isBeatFaked(e){return this.timingData.isBeatFaked(e)}getNoteIndex(e){if(this.notedata.includes(e))return this.notedata.indexOf(e);for(let t=0;ts.beat)+1;return r>=1&&this.notedata[r-1].beat>e.beat&&r--,this.notedata.splice(r,0,t),re.emit("chartModified"),t}addNotes(e){const t=e.map(r=>{r.beat=Math.round(r.beat*48)/48,De(r)&&(r.hold=Math.round(r.hold*48)/48);const s=this.computeNote(r);let n=Mi(this.notedata,r.beat,a=>a.beat)+1;return n>=1&&this.notedata[n-1].beat>r.beat&&n--,this.notedata.splice(n,0,s),s});return re.emit("chartModified"),t}computeNote(e){return Object.assign(e,{warped:this.timingData.isBeatWarped(e.beat),fake:e.type=="Fake"||this.timingData.isBeatFaked(e.beat),second:this.timingData.getSecondsFromBeat(e.beat)})}modifyNote(e,t){const r=this.getNoteIndex(e);if(r==-1)return;const s=Object.assign({},this.notedata[r]);this.notedata.splice(r,1),t.type=="Tap"&&(t.hold=void 0),Object.assign(s,t),this.addNote(s),re.emit("chartModified")}removeNote(e){const t=this.getNoteIndex(e);if(t==-1)return;const r=this.notedata.splice(t,1);return re.emit("chartModified"),r[0]}removeNotes(e){const t=e.map(r=>{const s=this.getNoteIndex(r);return s==-1?void 0:this.notedata.splice(s,1)[0]}).filter(r=>r!=null);return re.emit("chartModified"),t}setNotedata(e){this.notedata=e,re.emit("chartModified")}getNotedata(){return this.notedata}recalculateNotes(){this.notedata=this.notedata.map(e=>this.computeNote(e))}recalculateStats(){this._notedataStats=this.gameType.parser.getStats(this.notedata,this.timingData)}getMusicPath(){return this.music??this.sm.properties.MUSIC??""}toString(){return this.difficulty+" "+this.meter}serialize(e){let t="//---------------"+this.gameType.id+" - "+this.description+`--------------- +`}getDefaultEvent(e,t){switch(e){case"BPMS":return{type:e,beat:t,value:120};case"STOPS":case"WARPS":case"DELAYS":case"FAKES":return{type:e,beat:t,value:0};case"LABELS":return{type:e,beat:t,value:""};case"SPEEDS":return{type:e,beat:t,value:1,delay:0,unit:"B"};case"SCROLLS":return{type:e,beat:t,value:1};case"TICKCOUNTS":return{type:e,beat:t,value:4};case"TIMESIGNATURES":return{type:e,beat:t,upper:4,lower:4};case"COMBOS":return{type:e,beat:t,hitMult:1,missMult:1};case"ATTACKS":return{type:e,second:this.getSecondsFromBeat(t),endType:"LEN",value:1,mods:""};case"BGCHANGES":case"FGCHANGES":return{type:e,beat:t,file:"",updateRate:1,crossFade:!1,stretchRewind:!1,stretchNoLoop:!1,effect:"",file2:"",transition:"",color1:"",color2:""}}}}class gm{gameType=Ze.getPriority()[0];description="";difficulty="Beginner";meter=1;meterF=1;radarValues="0,0,0,0,0";chartName="";chartStyle="";credit="";music;timingData;sm;other_properties={};notedata=[];_notedataStats;constructor(e,t){if(this.timingData=new mm(e.timingData,this),this.sm=e,!t){this.recalculateStats();return}if(e._type=="ssc"){const r=t;for(const n in r)(n=="OFFSET"||is.includes(n))&&this.timingData.parse(n,r[n]);this.timingData.reloadCache();const s=Ze.getGameType(r.STEPSTYPE);if(!s)throw Error("Unknown step type "+r.STEPSTYPE);if(this.gameType=s,this.description=r.DESCRIPTION??"",_i.includes(r.DIFFICULTY))this.difficulty=r.DIFFICULTY;else throw Error("Unknown chart difficulty "+r.DIFFICULTY);this.meter=parseInt(r.METER),(!isFinite(this.meter)||this.meter<0)&&(this.meter=0),this.meterF=parseFloat(r.METERF),(!isFinite(this.meterF)||this.meterF<0)&&(this.meterF=this.meter),this.radarValues=r.RADARVALUES??"",this.notedata=s.parser.fromString(r.NOTES).map(n=>this.computeNote(n))??[],this.credit=r.CREDIT??"",this.chartName=r.CHARTNAME??"",this.chartStyle=r.CHARTSTYLE??"",this.music=r.MUSIC;for(const n in r)["STEPSTYPE","DESCRIPTION","DIFFICULTY","METER","METERF","RADARVALUES","CREDIT","CHARTNAME","CHARTSTYLE","MUSIC","NOTES","NOTEDATA"].includes(n)||(this.other_properties[n]=r[n])}else{const r=/([\w\d-]+):[\s ]*([^:]*):[\s ]*([\w\d]+):[\s ]*([\d]+):[\s ]*([\d.,]*):[\s ]*([\w\d\s, ]*)/g.exec(t.trim());if(r!=null){const s=Ze.getGameType(r[1]);if(!s)throw Error("Unknown step type "+r[1]);if(this.gameType=s,this.description=r[2]??"",_i.includes(r[3]))this.difficulty=r[3];else throw Error("Unknown chart difficulty "+r[3]);this.meter=parseInt(r[4]),(!isFinite(this.meter)||this.meter<0)&&(this.meter=0),this.meterF=this.meter,this.radarValues=r[5]??"",this.notedata=s.parser.fromString(r[6]).map(n=>this.computeNote(n))??[]}else throw Error("Failed to load sm chart!")}this.recalculateStats()}getNotedataStats(){return this._notedataStats}getSecondsFromBeat(e,t){return this.timingData.getSecondsFromBeat(e,t)}getBeatFromSeconds(e){return this.timingData.getBeatFromSeconds(e)}getBeatFromEffectiveBeat(e){return this.timingData.getBeatFromEffectiveBeat(e)}isBeatWarped(e){return this.timingData.isBeatWarped(e)}isBeatFaked(e){return this.timingData.isBeatFaked(e)}getNoteIndex(e){if(this.notedata.includes(e))return this.notedata.indexOf(e);for(let t=0;ts.beat)+1;return r>=1&&this.notedata[r-1].beat>e.beat&&r--,this.notedata.splice(r,0,t),se.emit("chartModified"),t}addNotes(e){const t=e.map(r=>{r.beat=Math.round(r.beat*48)/48,De(r)&&(r.hold=Math.round(r.hold*48)/48);const s=this.computeNote(r);let n=ki(this.notedata,r.beat,a=>a.beat)+1;return n>=1&&this.notedata[n-1].beat>r.beat&&n--,this.notedata.splice(n,0,s),s});return se.emit("chartModified"),t}computeNote(e){return Object.assign(e,{warped:this.timingData.isBeatWarped(e.beat),fake:e.type=="Fake"||this.timingData.isBeatFaked(e.beat),second:this.timingData.getSecondsFromBeat(e.beat)})}modifyNote(e,t){const r=this.getNoteIndex(e);if(r==-1)return;const s=Object.assign({},this.notedata[r]);this.notedata.splice(r,1),De(t)||(t.hold=void 0),Object.assign(s,t),this.addNote(s),se.emit("chartModified")}removeNote(e){const t=this.getNoteIndex(e);if(t==-1)return;const r=this.notedata.splice(t,1);return se.emit("chartModified"),r[0]}removeNotes(e){const t=e.map(r=>{const s=this.getNoteIndex(r);return s==-1?void 0:this.notedata.splice(s,1)[0]}).filter(r=>r!=null);return se.emit("chartModified"),t}setNotedata(e){this.notedata=e,se.emit("chartModified")}getNotedata(){return this.notedata}recalculateNotes(){this.notedata=this.notedata.map(e=>this.computeNote(e))}recalculateStats(){this._notedataStats=this.gameType.parser.getStats(this.notedata,this.timingData)}getMusicPath(){return this.music??this.sm.properties.MUSIC??""}toString(){return this.difficulty+" "+this.meter}serialize(e){let t="//---------------"+this.gameType.id+" - "+this.description+`--------------- `;if(e=="sm")t+=`#NOTES: `,t+=` ${this.gameType.id}: `,t+=` ${this.description}: @@ -1193,7 +1194,7 @@ void main(void)\r `;for(const r in this.other_properties)t+=`#${r}:${this.other_properties[r]}; `;this.timingData.isEmpty()||(t+=this.timingData.serialize("ssc")),t+=`#NOTES: `}return t+=this.gameType.parser.serialize(this.notedata,this.gameType)+`; -`,t}requiresSSC(){return this.timingData.requiresSSC()}}var Ge=(i=>(i.SELECT_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAArUlEQVR4nO3YQQ6CQBBE0X8PXKrn9DqGcDNNZC5QhGR2agQk6Z5QL+l9FwULGszMzN6dgB4ogFbOjQTLPzcsniZE/+fy4SHKTgHCQijZFGAALq0GUJ35u+xaDiDg3nqA15YA0bR2HwfYmdxAMLmBYHIDweQGgskNBJMbCCY3EExuIJgO18DY+k/9kGBRfZn57PnTFXgkWFYfDltnFurqESnD6zTWJ794eTMzO44JY84XrlhT/UgAAAAASUVORK5CYII=",i.REVERT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAAACY0lEQVR4nO2aTUhVQRiGn1pYSVqLBM0WbQpNuLcoRIhS3AVFEEWLtiEKRRAUghAXidyoRNAf7XPhwqSfRW2jRVw0cpVCBJrR36KIfggqDswFGQY7Z+65986Zbx74tud+73PnnDNnZiAQCAQCgYAFm4BuYCMC2QO8B/4CS8BWBLEb+KTCl+ocQsgbwkc1hJDwHw3hRQjIrxLeewH5/4T3WkAuRnhvBeRihvdSQC5BeO8EtAPvEoT3SkC7RXhvBHQAHyzCR/UWKFahngJTwE01++wBNqQloGgZvtb1HXgInATqyhHw2YEw5dYycMZWxJADAdKqOWCfjYRRyx+8DeytQu0Hjqp/+Q4wv0pPv4DT1ZJQoHa0qZ6/pvmGGsuQgBJb1Kj4Y+jvbKUlFHCHE8BPrb/f6pWZmCsZFIAK+0Xr8Q3QUKmRUMA9jhhuh8u2FxvLoICIa1qf34CmSkgo4Cbr1eRoZa+D5VxwPGMCIi4aJkmkLeES7tKohn6p1+i50Jy2hMO4zSOt31NpXHQAmAb6cZ/zmoAbCKNHE3APYezSBDxDGE2agAWEsV0T8AJhdGoCHiOM45qAuwjjuiZgGGG80gQcQhBdhmX0egTxQBMwiSAOGhZFehHCZrUMtjL8c2ANAqgD7mvho5FwAAE0AE8MaxbRq9B7OoBZQ/himrvILtICXDXsB5Q+fFrxjLXATrX3N602PkxrlS+BbTjMOmBEfZ/HPSQRzep+xNirmMjCQe7BGEGS1mvgGBnhVorBZ4C+ck+J1OLkue3JlEV1NOaCevpnlsaEhyR2ZOHeDgQCgUAA9/kHkepiJFq7BJgAAAAASUVORK5CYII=",i.ADD_FOLDER="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAvUlEQVRIie2UTQ7CIBBGnz8rb+Mt2hqv4TGMmt4Kexl7gUa3TXBRTAALQqGJJr5kNpR+r8ykwJ9vogJaQDrqlCrwhWeRfAoPrRYo5xRI4OYTpGLkLDMEevl9wXqGzC2wH3uQa8gGOVpUAALoVAmGW+GNKSc44v4XLqmCwgpcqfVeWzNOEisQAYJGfyHkspPARu3vrGCbHrjrQz4oSSiLiL2TuBLZoljKAMEuRQBwxj2rOjX8RcXQioeqBu3Ln4QChU8M4+FlAAAAAElFTkSuQmCC",i.CHEVRON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRIie2PMQqAMAxFXwfP6qJVPIjYzcOKdUkhQ0BaCoLkLS3k818CjuN8ztApYzIDl7xvmalFsAIZuIFozKPMMrC0CAJwKIkuGVX5KdkmLEm3ci1JSlLKU49yLSmXVG1es0EANvnvInKcP/AA784fpjlWwNQAAAAASUVORK5CYII=",i.EDIT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABOElEQVR4nO2WQUoDMRSGP5duWgpS157BhQuheAR7mOrSuKviPbqQit5CaC9QEOxO2k2XhaJEAhkoZZLpVJy8wPvgrSaB73+TFwKKokjiAngGlsAG+ACegFMy4Ab4AWxJLXw4sZiA+G6ILpnKW1+PZB5ghlDMngHWCMbsEeALIaIm8s1GatSwa1Swbohv4Lxh30oxU2PtoGHfSqGihoE9t1tr7hA+nCayN/RN3B0/RBh15K20EIfIWykh/iJvcxhYlf8PtPOp0M6nQjufCqP3fEJaQA8YH/AXkj6Jy3jJWd5xlbO840T6w6zgAWhTzjFwGZgJEZ0/AlbAeyREwViavONsS6oqRE+avON651jEQrSlyTvuS872FOiQCW+B2yWbEPNAgJW/ncQzAT6BV3+++36wFUVRFAp+AZvenA82VBInAAAAAElFTkSuQmCC",i.ADD_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAABiElEQVRoge2YMU7DMBSGvwQJVO7CwN1YYEFUMAMdYCpHYUMcgg49A3SgEggGE2GskNh5frYr+ZOsppWS93+q9WIbKpWKD4fAHFgBH8BX4NgCt0CbOjiY8M8BYYfGkgwS8wjBs0qsrOKnwH7g/dkl7DkfGh4K+CfsotL7lz3f1SViCjTAnfPbA8oSMQUgg0RsAUgsoSEACSW0BCCRhFRgrA23KHcnqYD9Ijwjg4RU4MJ5RshYSIJ3SAVmwNM/AcfGuyR4h1QAjMQ58EL4cnyQxqO4279T4F0zywYjJlUgN1VgF4jRRkM5Ag5+PgcptY16U+IUajFLiA2RzpJSTqEGuHdqipfXqQT6wkeRSCEwFF4soS3gE14koS2wcGr0bWxEewRtgTf+hm2dmu5u7TW0gLbAFaZl3vA7PdyaLaalboBL++ZSX2R1P7Az+Ah8WtdTjtdV8RFYW9cnFCgxhuRcJ3R0RO18knOdIgQ6iannOkUIpGaLCT96Mrenn2USM+AYuAYeM2epDPINL56D04/lX9sAAAAASUVORK5CYII=",i.MENU_VERTICAL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA+ElEQVR4nO3XS04CQRSF4X+kYx8h0UWIM5vFoIxVdkCgmbMDlSWBsAchLMLWVHI76ZC2pnLgfMlNOqlJn1TdeoCZmZnZSbqNknUPrICfqCXQRcw1sG2EqGsHdBAybAlR1wtCZpkgaUzGUyZIHyFne43ebPg0JuUSeAe+ot6Ai//+KTsWPaCMKhBVAlWj0dP3GMGZqFp2rUptZqaZcyTNlIwyE2SCkOKPpfUNPCBmvBcmhRghqohlNlGcCTtUV8Ac2ER9xEVSyjmwbtm1PtWu8YPMOfKIkNmxPHVfM0GeEWv0bUuIjWLDd+ONXodYAHcIu4kyMzMzOzW/IiF2pLfCTcAAAAAASUVORK5CYII=",i.COPY="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABZklEQVR4nO2YQUoDQRBFHwiDB5AsXCSexYxeIVfwCDlE1hoXuUBuodl4CDGOgSyySrIKGGgZ6EAxTBZOVzc21oPe9OJX/eqqgSkwDMPIiT4wBhbAGjgCTuFsgBnQi5X4JTABDkoJnzvvwJV28nVV3iIn7sSZa1e+mfwrMAKugQv+OBOR+DfwQGYDexAGZPI3wDOwUhxk58/R606BQYiBsRB9Eff3wD7RPOyAsquBhRAaicqnSt4JE3U3/Jq1EKkHFt82p7sP4BYo0KUAhsBSxHrqIiR7+/S1WYm7OvmYDEWsqouAfMY2U9qVb1I0BlvFQNtdTFxIPDOggLMXwGYgCGcthLVQEM5aCGuhIJy1ENZCQbh/3UKb3A3McjfQ87vKbA3gF63zXP+J2/hKuJUoRaxPLdGpEF36IDH2QneNvdCjlvjAb8pSbua2XTdz5ygTmtj6BZc6ff+sVaTtdOX1VStvGIaBOj8GcNhDDTqXrgAAAABJRU5ErkJggg==",i.TRASH="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAABdElEQVRoge2YsU7DMBRFDwxlgb0wlB9BLMDXtFvhE2BAogNDxR+1S+ETEBJiLqVSU6lVGOwoJsQhDnEc0DvSU63c+OXeuElVgyAIddMBBsAUWOqaAH2ttZoj4AmILfWoz2kleyiDNvNJzWjpSgxITUbAEDjUdamPJXo/kMdCpqQGhzn6laFPGvRVmg9Sg90cvWvoiyYM3QArfv5O+64VcG0zuVNwfAHsu+f2whI4yBN2LRNi4B714IUmQnnJxbYCecQV57ngfA3bCvwZJEBoJECGO9R7+9ZRawTzx8XGWutrR83lGl+o+zVadM5v5+ciz0BoJEBoJEBoJEBoJEBoJEBoJECGKPNZVqtM3QFGqD2ckaNWGdlWCY1LgK0x9rG/b/bcWs/K4BLgzRifOMwry6kxfvXQnwfSP9zPwDn1rEQHuNA9k/7jGvp+4xh4x21rvErNgZ6PAKDuus8Qc+DMl/mEHmqJX4BNDaY3utcYj3deEP4rn4hExm+tmh+HAAAAAElFTkSuQmCC",i.IMAGE_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAB8UlEQVRYhd3WTYjNURjH8c9IozRlwUITTbMRNlNWxksWjKxkYbJQY6mUTCKxmDSkZiezm421KQsRFkgpL7Eg2Si3RJOFl5SIzVicc5t7p/9xz//O/5r41el2nnOe83zv8/zPC4usrgLbBPrbXO8DTuHHQgBm8QjvSwZfg0HcxV58L+nfBDDcht9w9P2IO1ie47SkjUCttBMDuIWexQB4gV3YiJutIDoB0AixoRVEpwCyIaoE+BV/Zxvac6zCdlwoclpaIcBt7EN3wdhxrO40wE9cS4wlt3Unv4EslQE4g5nYTlcFkFuCAxjH2dg/hzeY/lsAQ7iH87G/A7sbAPqFe6VWFiC3BDXheF0v7OsBIQOwEvdxpWzwlIouox48Mbe/H0dbF67jU7RvSaw5LVGu3Ax8w9aGti3aTmCPcP0+xdHM9f6o1HXcHQPXoQeF0+9k7I/Efm+BbzIDZQDG4tjLGOwtbph71CwTXkTjZQByS7ACo5jCK1yOgQ9FKMJJOIXDEaZtFWVgDF8iCKxDX4Fvr1CGkXn2BWWg/u8v4mu0vRZKMF8zuIpjGetmA4zGeZcy15zEJukt2aSck/CIkIXPmQB1HcTDKgD2S9zlLfQsZ1IOwIM2gmfrn3oP/J8AqW9gc8Vx1uJd7uSa5qd1VW2iKNhvOK12/OBuEgoAAAAASUVORK5CYII=",i.AUDIO_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAADFElEQVRoge2ZzWsTQQDFf200qVrBUBAURU/aVgTFSvUoXsQqgoIUFDx68SKieBILeujJFhH/AD0VRBD8REHBD/zCIqUm6kG0UqltE0FFqqkedif7Nuymm2bTbWUfLLy8+dj3kpndmQnEiBEjxv+KDuAx8BroBlLR2qkMx4BJ4K9c5yN1FBD1QA9u4+bKVdjXPOA6kAf2h+jRFymgD7fp+yWfK0GztPsKNIbm1ANp4AFus31YoaYbIAG8l7YnwzJbiuVAP26jvVjDCaYfAOCQtB0FFldrthTrgSG5ySTWBFYEDbAHa7zfBBpsLQFkpf2JUFzb2Gbf0HT+C+j0qBc0wFWpd1j0g6K/qc6yg04sw6bjPFYgLwQNcETqZXGGYAoYk7JN5TpZAHRhTZ4/JTf3u4awhpIfggZYhDXOTd1dUnZR9HPlzD8MaNpcA8DKKYxVMonPSN3Lom8V/aNf464KjBewXjLpAKa8AqSAO8AXYIfoLVI3DyRtvQ4YlrIVXjfSZ+5xYH4Ac0HgFaBNtIxt0GBAyraLrpN8rxHrpcJq4b3A7+q9+2IQ+GHztcAWKbstXCfsE+HthmiAhPCJKg1OhZ/ANfm8U/hL4RuFPxfeYogGmGlcEd4uvF/4GuHDwpsMiTKAvpTU6IhwfUiMCm/CA9WsWcrBr99G0b+JnsDZS+RK9IKtF0NG+Qso6ny435dZ1KMMsEr4uPAlOCHyoqdx/BbrRxmgWXhW+FLhOoR03M+KAPuEPxW+Qfhb4cuEjxmiAQrCk9QWC4Hd8vmGcH15vRK+WfigIRrgg/Cj1DZEK84eN4P7F9C10Qvh+rZ+5tXpaWZuMZcE7mI9DvUt3Cp1c7i/xM9S5rmYmw3L6bNS95Lo7aJ/KtdBA3AKeEc0GxrdeXVI2QXRfTc0laDWW8oMzvxM4t6ptVVjXDFTm/oDooe2qTcI+1glB9zCfaySkfahHqsYzOmDLYM5fbRoEPbh7jppN0KND3cNyh2vj5dp54UkcA/4jvfDoabw+oOjZ5p9Rbbg7AAeYT1Fuqn9AjFGjBgxIsA/jvJ6jenUZ2YAAAAASUVORK5CYII=",i.SM_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAcpJREFUeF7tmFGOwkAMQ+H+h95V2S2qqlKcsZ101PADQpPEfnFHgufj5q/nzf0/GkAn4OYE+hG4eQD6EuxHIOER+CFnWJdkbf5vfAEwOoephbiPCoOaN4A/AswWmVpoSZ0ACBN3iNkiUwup7gRAmLhDzBaZWkh1JwDCxB1itsjUQqo7ARAm7hCzRaYWUq1KwJlQxoSr7xuOAsD2x85RPweAbzOh7S+HWACrkKXP9vNWgBoAMjMFwJHhT9+Ngt7DQ2faAXza9vrjZ5suVQIiM60AzoSsg/cxZRMQnWkDgAjZQ2DumuhlF9H30hnZTLj5ycWIbsg+EwUwIgQ16TgH60UAwM0cToiekG4EwNHNTuhKKYXMZ9wBKW53Q2DzUQAzJCFkfgTAlSGEzY8CuCKEIfMMgCtBGDbPArgCBMq8AkAlBNq8CkAFBIl5JYBMCDLzagAZEKTmHQCcEOTmXQAcECzmnQCUEGzm3QAUEKzmMwAwEOzmswCMQEgxnwkgAiHNfDYABEKq+QoAZxDSzVcBOIJQYr4SwBbC8rlMC/qv8CpS/V62+VLqaopMv+oEMNoltQ1AgnHiJp2AiZcnkd4JkGCcuEknYOLlSaT/AqRIb0Fn6qw5AAAAAElFTkSuQmCC",i.UNKNOWN_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/wD/AP+gvaeTAAAA+UlEQVR4nO2awQqCQBgGv6KeM+rU+1/L7F4RreY/W86ABw/ujsMPImwiIiLSwlh0XZIcit6piaoAY5JbknPNa31OZYAuI1QH6C7Co9zS63cXgQrQTYTqAMOL+9MC+35MdYBjniOgk1AdIOksAhEg6SgCFSDpJAIZIOkgAvkZfHcNmfDvsJkoOHeNlvVbuCbZtzzwbwGSRp/tzM1+nh0t8ILWiZo1MaufAAPQAjQGoAVoDEAL0BiAFqAxAC1AYwBagMYAtACNAWgBGgPQAjQGoAVoDEAL0BiAFqAxAC1AYwBagMYAtADNN84HLHFOqIzVT4ABaAERERGOO8QV911rDPw7AAAAAElFTkSuQmCC",i.MINIMIZE_WINDOW="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAANtJREFUaEPtlbsNwlAQBMcRLQC10QZEiAAi0wa0xqcMdIiICGmejZ60znfPN3OWBzp/hs7fnyzwb4MxEAOSQE5IAtTxGNAIZUEMSIA6HgMaoSyIAQlQx2NAI5QFMSAB6ngMaISyIAYkQB2PAY1QFsSABKjjMaARyoIYkAB1PAY0QlkQAxKgjseARigLysACOAEbYCX75oo/gCuwrwXOwHauyY3njLVAbbNsXDxX3bMWuHd0Ot9gbrXACOzmQtZ4zvuE6iM+fj7ideMBU9XV1VyAQ/4DUyH+tbd7Ay+Srg0YYU5a1gAAAABJRU5ErkJggg==",i.CLOSE_WINDOW="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA35JREFUaEPtmbfrFUEQxz+/0pwwFNoqmMCcc46olY1/m7U2Ys45IWIuDFiJCYyYC0X5ypwcx93t7O57yIO37c3Ofr8zszvhBujxNdDj+OkT+N8e7HugVzywGtgLPAB2A1+6BHw4sB+YBuwBLoTO8YTQMuAYMNSUXQM2AZ9CyiO/jwBOAAtt3zdgG3CuTU+IwFLgeAl8oesWsA74EAmySVzgTwILKgJBEm0ElpvlhzScegPYCHzMJDEKOAXMbdDzFdgMXKr73kbgFTAhAO4msCHDE6OB08DswDkvgImxBK4ASxzWVTitB947ZMsiYwz8LMc+XeZVsQRGmmvnOQ64a3firUNWIgobWX6OQ/6O6X4XS0DyIqHLNd9x0D076E1AdixwBpjp0HnbdDZ6N/QK6YymF6Lu/IfAGkD3p26NM/AzHOBdoekhUJAov9Ft5z8ClPiqJAT+LDDdAd6da7wEdKaypEgscgB4bCRemux4A68MG1pu8FIUQ0DyyglHgJUhFMATI/HTsulUx56rluU/O2T/isQS0J5hluCUpUNLJLQmhwSBi8AWQInLvVIISPlg4LBZ2H1Yi+Bly7bRRWIqgYLEIXt1ckioRJDlo8GnhlAZrDxxEFibyEA10A7ge+L+pDtQPWuQkVB1GrOUIHfmgO+EBwrAInHACjsPCZXou4AfHuE2mZw7UNYbk621TyWCwi67n+gEASU4hUPRSXmN2pGmKJdAKviCZDaJHALKyuqV1bnlrOvW2SX12KkEOgW+IJ5MIoWASgkVdYsdZlfLqeVpilTEqcd210Epz6gsfxRY4QCvTkovza+GiUOdimgSMR6IqUQL8EUnpWdWWdfT2UWR8BKIAa/+WJav9rBdIeEhoHpHYePpAZrAF+ESQ8LVG4QICLwamNqRRiWIQ+AL8ZhpR5BEG4EY8JpIqJmvHX3U3NaOkWgjoFpfw9XQ8lq+qsc7ldM+NU/b64C0EXgGTAqgj7V8HQnNiELTuedNWNoIKO4V/wqluiXwem2807gmW8gTbSQ0od4KnI/1gOSr/wYKHfct5nPBly+2Ro3VCbU6NYWx5km1K/QKaVN1zK7BlbzzOnQ5Ir/rYpdJCLziXt5pXB4C2qxQ2Qc8NXeG5p+R2P+Ja2Ktx2OK/cpqBa9dXgKF7O9UZN3aF0OgWxiy9PYJZJmvA5v7HuiAEbNU/AEymbExfA8cowAAAABJRU5ErkJggg==",i.SKIP_START="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABEklEQVR4nO3YPy4FURTH8asQFBKvsAeNbQixBxqVxi70lqK2BZUlPKJ50SlQ+Ih4JMZ48+fOTDKT8+2/v3PO5M6deyelIAiCIAiC4A84xgPucZTGhq/Gv5m3zJhhO6OHWWtfgYbuOi7xhlecDelnDYA93Bb0xVB+1gA4wXPRHcr/RZMA7OK6rPAQfil1A3CAx1XF+/T/pSoAW7jCe1XxPvxKVgVgH3d1Cvfh16IsAGu4WG5tjejCb0RJxiZumhbuyk9NKck4z2g+208xgJEvoTT2lzhNYRudzIdsEkeJyRzmJnGcrnEheUoD+T/kPIHClfAFp0P6XV7qd7DRxs32P3+lLIeY47BVSBAEQRAEQZD65ANrrC3m/GFNbwAAAABJRU5ErkJggg==",i.SKIP_END="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABBklEQVR4nO3XPWpCQRTF8RskEBBBy+wgvZuICNlCKgsrt5AqC3m7kGzB3l6tREgnUYt/GHyveJBq7pvRIefXn8sceB9zzURERETk7gBTYAdsgUnskAEwchwiOs/14I1NzIAZcALOwCfwmDnfElPg0B7BCnjJmHcX+MsRWAAPufPWUYHGEnjOmbeOCwR74C1X3hIUaFRAP3XeEhYI1sA4Zd4SFwguwAfQS5G3DAUaX8BT13nLWCCYd503FfgHj9Cl5Jd4XfJntCr1R7Yv+SqxLPUydyzpOv3tXEi8eXeBd+CnXgtjVkJv3legHhJ+KMOosDOPd6m/NWBSl9gAr7c+j4iIiIjdoV+nEzteGs3QogAAAABJRU5ErkJggg==",i.PLAY="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA40lEQVR4nO3YMS5EURQG4ENBr9dKsAMq9qCdLdgBSh1rsIVZAjZhelrTITGf3GIiCsm8mZd593K+7nXnb/7890WklFJKKQ0HGzjGKTajNbj17R770RK8+al8X2IrWuB3TziJhgMUM9xhJ2plMc84i4YDzI2xGzXR3SvOq6lcy3vAQcsBig9cY7vVAMNXrv584qLlAHN7GaAL/ZmVDRXr1tPxkzLH1378f6/RRxwOdvgKAaYtT4lxq2PuBaOokT/8oJkMVo0rPurfcTVoNXaBm+o2/hI/to7KHK6mGlNKKaWUYiFft4ARJbTJcIwAAAAASUVORK5CYII=",i.STOP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAo0lEQVR4nO3YQQrCQAyF4XcQXffsFsGLqdhe4C8BFzLgYiAJFN53gc4/6WYimZmZ2UkAV+AO7OTbgQewVB7+Rb13fKsiIG6+y1oRUPHb/LNVBLSSAwaewCRlo5kcMPAEJikbzeSAgScwSdloJgcMPIFJykYzOWDgCUzSyR/1n4qAWDp1uVUELN+lU7UncEkP+NnOrbG3KTj4FjdfdngzMzNTvgMULRo3zp7/ZwAAAABJRU5ErkJggg==",i.RECORD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABMElEQVR4nO2XPU7DQBBG3yUo+AniOkgQcQ3ID2ehA4EoKOlDuAmOcgpiOhJ9yNIUlguwE+/YEfOkkSxX39sdz3ohCIIgCIIgaAXBqWAieBdkgi+rzN6NBQP6huBY8CBYC/RHbQSvgjP6gOBKkNcIXq2VYNh1+Ftb0abhy7sx7XLldwlflvDdCcHJlm3zWzsdeQo8txheVo+eo7LOtGla62JnPQSmCcLLauQhME8oMPMQWCYUyDwE2pw+qlS+7wKfHgKLhAIfHgJ7/xGPEwpcewgMEh1k3y4HmUk8JRC4dwlfusCs2pw+gkM3AZM4b6mVNoJL1/CV/6JdLzSTTsKXJIZbtlPRNhf0AcGB4M4mSZ1Vf3Hv+QY3tZHgrThV7bcjt+eZ4MZtVAZBEARBEPwDfgDcyqJBiCPoQAAAAABJRU5ErkJggg==",i.PLAYTEST="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABdklEQVR4nO2XSUoDURCGW0FvoBtbL2AQT+KAwZXgCfQK4srhGA7gQsVFMF5AjyBOOYBiUBK38ZMHDTb60nn1MlWgvn1V/V+6Kp0kiWEYhmEYCgFKwBVQZ3jUswzz0vALwCd6+HCZJAI36KMaGn4KaKGPFjAdIrCJXjZCBM7Qy0mn8OPAO3p5A8aKBBbRT6lIYFvQqALMAClwHREktn6rSOBS0CjN1c1GCMTWXxQJuB0LwlM7KIHXduHnJNN7IODWJs3CV2Pl8wGWQ3a27eP77RN7ExKWfIN3xdbtJWJuQsJOzAFrEjj3Db0L2dnA8NKdlnLrG1yTdPDUd0tF8F548Ql8DVkgFaxg0yfQ6OPAXvdr+AQeB/g93m2/B5/AKaPDkU9gndGh7BOYAJ7RTw2Y/CeQSayim2/vz4g/EofoZa8wfO5v5QH6Pvl9l62jQE5kRclNPHVcmwIJd9hl4Bi4d2/AAQRuZrPczDWXISq8YRiGYRhJ//kBnszTFsS/lqcAAAAASUVORK5CYII=",i.ADD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB7UlEQVR4nO2ZS07CUBSGCT4GDn2MQHch0YUYjC4EwwLAuRA0LsGIAxUHrkKjC/AxEnBMnXzm6DUhFeJ9tb3EfkmTJoXb/2/a03P+Fgo5OTnOAHPANlAHzoFH4B34UJvsP6hj8pstoBiC8HXgEHjFnBegCZSzEL4GnAAR7kRAB1hNS/weMMQ/A2A3SeELwCnJcyzn8i1+CeiRHtdyTp9XPk3xP9wCiz4MpHHbTKPjKn6f7Knail8B+lmr57vimZdYVedDoW0qvuzpJeWLCNgwMSDtgStXQEldDB9VrGnSmNn0NnHKsZ7JlWetBlB1lc5MWNcHFR0D0u6GauBAx0A3YANnOgZk8AjVwL2OgaFNtflz4d/nsalOfZ2FTeu/9USFeXUa/QsDQ8NFezYmlPibJG6hmX+Iu7NeRusBG6jpGJDQKVQDmzoGiip0Cq2Ze9JO81Ri5spXdbKsNpNoaIkPdKAZGb/tVdwXCkdG4pWB5UCG+oF1bipZZdbqgR0r8WMmJKvMipaT+LEZ+SID8VfAvLOBsXBXAte0uPQW7sZC3jQqU8vblZ9ipJpQdXpzfmANc9O2esG4MpI6L2U7FfExIyXVdkjoZIr8p2EzTydhRBrAiuQ20rPL4KEmu0htsn+njtWkqwziM2tOTmH2+QRxCeic7ZLqUgAAAABJRU5ErkJggg==",i.SPEED="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAACYklEQVR4nO2ZS04bQRCGrcAmu0BWAYM4BCE5R4QQJ+G55bEFEZQLZIEgCYiHcw4QF0hgQWJgazubLyqpIjWOx1M93fNAml8aaTRWd/9/TXVP/eVGo0aNGsEAXgDvgTXgK3ANPAJ/9HrUZ1+AVeCdjGmUDaAJbAO3+OMG2AImyyD+GvgE9AhHF9gHxosivwjcEx9tYCFP4qMadSvOJT00zVoe4z7KWrHJvwTOPCPadMZPeY49lTVjRt6XfKiAfyLC34Rn2rhoafoI+e8Z59iLsWH7cQFMa37LfSiOVWjSXpkPOSrvU1JDhITgwE0TFdGP38BYzNSZiiTgCfmUveKXShqJXkpuz3gej2nkRzWdkj52Ez4CpDzIC0nkD1LGbfoUZj9zIn84gPwI8NkwVuqtEYsAqSqrFHkXcxYB61Qr8i6WLQK+UU3ygiOLADEeoZATbGnQyZEhbVxcWQQ8RKgqB75qI/nzIeu1LQJ6EYqygWe2MfLNIet1SxMgz4xjm6ECHiJUlf+lELBiHNsasl67yE28rFGf0PsY/vnKIkDaIlXFoUWA9HaqiiWLAGk6VRWzZRdzIfhh7uZpx6xq2DCRVwGTaiIowBNfGObreBkaFSHtPnL2xNb5dr3IO6Ze2n15eWLrfL8ymXqdcCEnT+wz34dM5B0R0qssCztB5B3zUcbX+Sxak1ebu9KrLAon0Zq7fWZkrwDyu6buQ4CQeT0ZYuMueMN6iBjTt5H0sfNBR6P+qhDyfUKk1t/MWDtJbbMBvCmceEIBOKeu60iMhzq7nl5yf6m/ibl5W4m/WWvUaDx//AV2V/CQip4uIQAAAABJRU5ErkJggg==",i.UNDO="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABeklEQVR4nO3Wv0tXURjH8dtgEuJaoEMSguBQBNUiVGv9D41uTg3S9EWiobGpv6Gh0Mk/IAyKnIxoq8SiEm0Q7IdErzh4S9Hvr6vnDMHzXi/3+Zz3c89zzq2qIAiCIAiCIAiCGixhGaerBmAA19HCAl7jK3bwDR+wgnnM4ipONsnodyF/edWPBCbxEBuas44HuFBCoKsEJupO/5aHJ6lmboFDEvVWuVtvjdzs4H7KyCnwTwIjeKE8zzGWU0A9lGkQu5GGdREzmMI4hnAKo7hcP3uE7R61vuB8ToFufMLttNgGOcOYxvsuddPBcLGkwC/MpQ437tRe3iDu4GeHjM/p65UQ+JjO/aMuvE3uJbztkPWs78FuINDXPdFQYgRvOuTdyy1QSuIMVttkfce53AKlJK7gR5usxyUESkm02uSkQR8sIZBdwu7d8e5AxiZO9Hpx7RgSL3MJJHANW/u6f6vqBW4cQ+JplRm7vzA3cTZ37SAIgiAIgiAIqv+aP0/ezoLd5BjTAAAAAElFTkSuQmCC",i.REDO="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABi0lEQVR4nO3WPWsUURSH8Y2oIJKYRhdiEa1SCJqXVvAzuEXMB5B8BEuLiKRIk8pSLC1WSJMqBEIgasoglmKRYBaVFEGEpPAnK7dY193ZndlZWOE87cw59/nfe+alUgmCIAiCIAiCICgILuM+nmADBzjET5zjBB/Ttad4gEs51xjHduqTqzar6V2s45v8fMcL3OlTfq+ltjqo+EzazTL4lXrN9ClfPEAalbU0FmVzjmet49FFvlgATON9hsBXvMIy5nETV5pCuI4FPMYbnGb02cdUhnz+AJhLM9uJXdSap5PzJBfxoUvPoxTEwAFwr4v8JzzMtRP/9r6AR/iSIVs8QBqbTm+YOiYGkW9bp4qtUgOk2X3boXilLPG29a6hUWaA1Q6Fz4ckP57xwOYPgNs4ayuqD0n+KnZyyPcV4HVbwWdMjsDO9w6AW+nr2EpthOR7Bpj1N+8wNkLyPQOM4eWf2zhu/rCVKZ/W2FScH339jeIGLpYtn3o3vyNFaGBpGE5BEARBEARBEFT+S34DOXeCiMi4hZkAAAAASUVORK5CYII=",i.CUT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAACxElEQVR4nO2YvWsUQRiHRwMKKojkQxMUOzWiXbCxU7BQMRFRrCKKtQqXiF8EY+dfYEQrxcZW/QdEbMydWhhQLERR8QPWJIrBmHtk2PdgGXZnZ/d2zyn2gYMQZmZ/M/N+zatURUVFhbcAvcA1oAH8lJ/+exLoUT4DHAZmSeYHMKI8Fr9EOkvebYLQbGwnbxJ4ZU6ENh9lAagB/fKryf+iXC1Jy3JgFHgDfAGOu0x6boirxYwZN8Y0ShC/B6gb3/nsMnHOmNQfM2bAGDNXoPBB4EGCub5yWUDbdJR1DhsIChC+HrgBLCaI15axw2Uh89rOOJjQszaErwIux9x8i4/AKe0PrgteMhbQDnsO6JaTH49x4gs5HfQE8CFB+C8JKGuyLtwHfMOdr1nDKLBXMnpSbrkDbMx6KNEPHLLYYpQ/wIEM624HHlnWewwM5RZufGw/MJ+ygVHHtTYANy2H8hY4Uohw48Pa5u8CTUs9dB5YaXHQK5aDCCQxrihcvCFkCHhquYn3kjGXRRz0KPAuYfyi3EhfqcKNTWhRpyWlJ/EEOAm8sIzRSWpbx4Sb6LCma5+YUJrGjPYr5QvAlpSI0kKH5LNAl/IJYDUwIaE0jt/AdWCt8gmgS1K7TvFx6Ih1D9isfAPYB7xMceJdlvm7gVu64uy08EHgvmsYjZm/ScqDZkfDKOEL7DbwN08ikzW2At8tiWyslESma5yCS4mpjpUSwLDl1KNoQQe9KuYIy+mkK08qp3tzlNPm27tFs61yWl5HWbsSF3160NRzdCWms24gw5PyU9YnZZCjK1HUo34q5VG/s6y2ymy7GzAc/WHCJmZUGjHONeZgQnVVTmOrYZqTy0TdOo+yIMlmwNKVKLu1+Fpqr2Muk3okw7qifaZb+QQwkqG9Pqx8hHATQcrJ+yneMKdJyQ3zEqGm5Unpl9lUVFRUqP/BP5CqMiH1c5cpAAAAAElFTkSuQmCC",i.COPY_WHITE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA2klEQVR4nO2YQQrCMBBFcxBd9yr2qBbBO9mtis0FngS60CiV4JAx9b9tFpmX+WFgQhBCvABsgQMQqccI9MGo+As+nCwE0svTskD0Kh7YWQg8EVoDCTjDP3SAunMiAkegMxFwnBPXdLeFgOecGCwEvOZEYrIQWDy3htL7JGAM6kCG/kAhKEIZilAhKEIZilAhKEIZilAhKEIZilCFCI1Lu8oWOtDPEm93lT8v8AkJFII6sMIIRfy4WQikRasXewuBbl601uYMbL4WeNhQD2lXWaHwKb28WfFCrIw7KN2RSPl95zsAAAAASUVORK5CYII=",i.PASTE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABHklEQVR4nO3ZQUoDQRCF4Ua8gC41rnMVPYSoxzMIgopXEPUWcatiZuH2l4JeTBokdlXsacL7YFYz01PVr1bTKcmOAfaBK+AV+M7XC3Bp91LPgMNc7G+egYPUI2AvF7jJkz2begNc8HfnrYo6AW6AgXoPwDEwAx4d7w/ALTCPFP+B36xYy+vT3vc0YDsfcTRay5KIWHga8IzN2F0eH7vug2utPA2s2XQ/KlV+Xw0Ab1sMYDlFAmdbamIJnDZv4L+hBgpKoPUGogRiUAKF4IYqgdR8BpXAOiWQNEJ10AgVUmNEv68GglACheiOKoFaSiCI6AjvQgID/fjyNGCHC7249jQwz4cLU3sfH5bUNmEnKwv7Pz9B4SvbeXfxIiKphR8IWaCtfT4/XAAAAABJRU5ErkJggg==",i.UPLOAD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIWXMAAAsTAAALEwEAmpwYAAACYElEQVR4nO3dO48NcRjH8e+6NbrtCI2Iuyi20aHQigQlXoDE5Q2IUqKgFC0SkbhWVqXyAiRqFHYRbOy6LvHIiZnkSBZnZ2bn9v9+kl8/8/zyzDlnTjIDkiRJktQNa4BbwEfgLfAIOAOMN31gKZgAXgGxQJ5m5WiJ7AE+/GX4eZ4BG2ygegeAz/8Zfp4XwEZLqM5R4PuIw88zDeywhPJOAj8XOfw8r4FdllDMGHCu4OCHMwPstoTFWQ5cqWD4eeaAfZYwmlXAzQqHn+cTsN8S/m01MLkEw8/zFThoCQsbBx4v4fDzfAMOW8Kf1gJPahh+nh/AcUv4bUv2wylqzuCr7QkSNwG8aWD4wyWcJlF7R7ivU1fOkuB9nS8tGPxwzpOIYwXu60RNuZD9Au+tUyXu60RNuQwso2fGshWPjuQasIKeqPq+TtSUG8BKeuBiC4YZBXOJHnjegkFGwQz+3uy86RYMMgpmih44kp1IF4d/qOnhtUGUjCyg28INsICkhRtgAUkLN8ACkhZugAUkLdwAC0hauAEWkLRwAywgaeEGWEDSwg2wgKSFG2ABSQs3wAKSFm6ABSQt3AALSFq4ARaQtHADLCBpUyU24GXTB98H10sUcLXpg++D9cD7AsN/B6xr+uD7YjNwB5gdYfCDB4DcBjY1fdCSJEmSJElSEduB+y160m20OIMZ3QO2UZGd2Rsomj6x6FjmstmV9rAFJxMdzeBlFKWf+TnfghOJjmY+m6EF0NECvARRqoAHVMAPYQoNf7aqD2Gyr1R3s5eiNX1djZZnJvv/emtVw5ckSZJEr/wCliFWxPec8VIAAAAASUVORK5CYII=",i.DOWNLOAD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIWXMAAAsTAAALEwEAmpwYAAACWklEQVR4nO3cO2hUURCH8U9FEUEQC0EwhYWIijY2giIIgqj4ADs7Szs7W0tLO0urWEh8VmpjY2WhhY2FhRgRQVTc+IyPkQs3hZKYze4m59xzvh9MExKY85872WX37oIkSZIk5WkMmAB6QMxTze/cALambrqk8N/1Efy/1fzNptTNl2BigPBn6lrq5kvQG2IAH1M3X4IYsuQAui3cAAdQtXADHEDVwg1wAFULN8ABVC3cAAdQtXADHEDVwg1wAFULN8ABVC3cAAdQtXADHEDVwg1wAFULN8ABVC3cAAdQtXADHEDVwg1wAJ12FHg1gis5lrgmgcMUYDKDMGPAekkBHEBiJ4DpDK7mWGB9B45TiCPAlwxCjT7rG3CSwuxvP7UYmdcn4CCF2g28zSDkmKPeA3so3PZMn5a+AXZRic3A8wxCn6kXwBYqsxF4mkH4z9rvo6jSBuBJwvAftz1UbR3wMEH4j4D1qQ+fizXAvSUM/wGwNvWhc7MKuL4E4d8BVqc+bK5WAFcWMfxxYGXqQ+ZuGXBpEcK/DCxPfbguuTDC8C+mPkxXnTf89M4CvwYYxG/gXOrmS3Ea+LGA8H8CZ1I3XZpjwNc+30g5lbrZUh0Apv4T/mfgUOomS7cP+DBL+M3P9qZurhZjwFXgdVvjNb+iKUmSJEmSpLLsaG/n6MLt5ZG4moxutzchj8TOeV6Dt5g1g6k2u6HdN2QGvciau/2GvlGqi5/vikxqus3QAdDRAfgviKEGcJcR8EGYgcLvjepBmPYp1a053gy3+CuDJqObwLZRhS9JkiSJovwByQJHhbd7qEkAAAAASUVORK5CYII=",i.PLUS="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAYAAAA4qEECAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB1UlEQVR4nO3byUoDURSE4do5D+/g9HgOIILDQvDpVNxonBLwEYygy1DScHUhIumm23v75P/gbMzm3KIWEU4kAAAAALNgQdJ87iWiWpd0IelFktOMJJ1LWsu9XBQ7PwL+OVXg27mX7LtlScM/Qv6aJ0lLuZfts6MpQv6aw9zL9tlNjaCvcy/bZx81gn7PvWyfueagIYL+J6bRBB2KaTRBh2IaTdChmEYTdCim0QQdimk0QYdiGk3QoZhGE3QoptEEHYppNEGHYhpN0J2q7tsO0lXQW4PGueczTm/f7/LWr7rYvC/gsS5kBpI2u7jqJGT9esXa6n32WQENcqFz2mbQowIe5EKnut9uxZykSQEPcqEzSRkRtHoStKb8ecOszlAtOi3gQS50jtv+ejco4FEubB4lrapl1ZdzwtZ3yLeSNtSRRUl7kq7Sv6OesRlLupS0m7IIwzUHDRH0PzGNJuhQTKMJOhTTaIIOxTSaoEMxjSboUEyjCToU02iCDsU0mqBDMY0m6FBMowk6FNNogg5lXKPRr7mX7bPrGkFXF0Ro6KBG0NWZFhpamvKw8i7aLVwOW5Ie/gj5vsurzlmzIukkXddP0jynv1WfoQNzbf5mBAAAAICK9QkSkO5NnQjE8wAAAABJRU5ErkJggg==",i.ADD_EVENT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB4UlEQVR4nO2Xy0oDMRSGi6Ib6UpxpUu1TyC6E19AqW19murWqm+hiDd8A0Vw6WVrpdo3KNjWdT85EHEImWk6kzazyAcDZeYk+f/pOZmTQiEQCAQCgUAgEMgVwDJwC/TwTw+4A9ZGEd8hf3SAJRsD8ubzyrWNgTykTRxdGwO5phAMxDMAXoA6sCW7BjCnrpK6dwC8krN/YABcAatDJ/9fQ8zdqLFeDXwC67bCDWttAG1fBp6AxbTiI+vNA/eTNvAAzBjGzgL7wAXQBH7U1VT3ahITM+5xUgYkbeYN4/aAL8vxZcP4BZt0ympgoOc8MA2cMjonwJQ21+awws5q4NIQn0b8H41RW5ksBgb6VqnSxmqhhHl3tbjSuAw8Gwrv04GBtl7YwFsWA3HNXF2Lk90GBwaEqhZ7iJlvGwNyeDCxpcXJtujKwLkWux0Td2v7mTcdaPT8/0gSbLFOlKZBg45oWrGdfEkOD9J/RyYoJqVaRgM97Vkx8qyrdiY78SMI6Ds00HUqzlKAyxR6H4/KZAEui/jMh4GaQwMVHwZmgJYDA1+mDnVSJsoODOx4ER8RJl1lWo68ilcGpoDjFOIbejvtFekqk2oiQst72gwp7Kr0NrK3q49dX/2WexXTUTQQCBRS8ws6Beac36b8wwAAAABJRU5ErkJggg==",i.SELECT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABdElEQVR4nO2ZUU6DQBCGOUf73LsIRL2mPnglobCaaGNivcDXEKcp0F2Q3S6VZr6kT/+Gf4ZM2d2ZJFEURfm3ABvgBfjhRAGklrUZUIqeOXQzohctn8bzGViHBP+FndqyftvStx66cXjtvJKQN8+EBEygXg/4Pfkk0C6bNq/AnWV9LkFWjhI56k2guUVP5dk2vn0S6JDMDKH+t5BA0S6bKFHG9JearOV3VvOx4cr+irJ4OJ1dStvGNIN/Lt5+/r2tvYoSZUz/scNXbAj1HzvbxIbu2Wl2f0VZPIzccWfwvwfe5E+cLvEz+h66DwzeYWPD79sPSiCXPeBa+0Am5dP4631AUaYCPAKfwAfwkCzNn+5nzESJMqb/LTS2OkSJcoBLJLDHjms+cLzDuvr/uWilo7mb9bpxwc3dZrjgYqw9Xnno5tLt9bUMF/6agJkw4JgyH9gBq8kJyENXTfa9chqaDzjPTlIiQ3ramw/sxdsveEVRlGQODgnFtCEN6s0TAAAAAElFTkSuQmCC",i.EDIT_WHITE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABRklEQVR4nO3WMUoDQRSH8bG0UQTR2jNYWAjiEfQwapm1S8R7WEhEbyHoBQRBO9HGUhDlJwMJhLC7ZCPszsJ85c4MfP/HvLcTQiaTSQbs4Rof+MYzLrEdUgen+FXOewwXUgVFhfh8iK3QU/kpF6HnAZ5Cilg8xFdIFYuFeEtFtKhZq+OqfeNqwaYhfrDbvnW9WNFg70n71vVCU4YVZ85m9gzat27WnEXN2dK1FGf8MKREQ/m0Qiwpn0aIf8r3omHrGGT5ZciV74pc+a7Ile8Kec53CNZwgPESf9junsRl4Ka38hEc9lY+gs2kH2ZTMMJ6KAGr2K/oie4rjxV84r4qxMzecVLyEezMSNWGmEyndOQjOJq7FpUh4vek5CM4L7nbj9gIfQB3FdOlHyHwWhEgNvYopA4e8ILbySPuODZ2116ZTCYTkuIPW58e4VQyzE8AAAAASUVORK5CYII=",i.EYE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAACjklEQVR4nO2YTUuUURTHrcW0mLQPELnIyfGz9E5RIIUIbatNVqsGl1YEvXyAaqeppVKboqxNLyuDXtfRxkqIlNAh+8WBI0wP1/GceV5EuX+4MNznnv/5n3nuuec+p60tIiIiIiIiJYB24CBwBXgEfAbmgCUdczr3UNccALavt+itKmQSqOOH2EwA+4WrSOFbgOPAR7LDB+CYcOctvht4Rn54CuzJS/xJYIH88Rs4lfVev0bxuJo6N1T8XYdTOXGGgV6gCpR1VHVuRNdYcSdVXgC3HM7GgN0Gzi5g3MF7s1Xxg0YHf4BzLfAPAMtGH4Necjmb/xrJ3eIb/Fww+hAth62knVo5LRgL2G8DzgKv9dRa0N9n5Flg/QOjL9HUaSlSL4yES8k9D+wE3jaxmZE1CZuKI7GfN01qoB87hgP/fDPxjUH89yaAew6//auJ3wF8cxD1Juxl21hxOmF7wmErGjtCAdTwoTth/8Zh+yphW3X6roUC+OokaU/YzztsfwWu4x582ZQB1Db6FuoAZlMksZzzRSTxbDCJlajPQTQSOEbliFwLsqaUsB11+O0Lim8oZNNGIik+XYFCNtNCIasbfU6veTsFdjmuEuMB+5JsEdnnmtgyXupcKbB+wujrh2hrKr6BdJ/jMjdgIg37uWj0IVoOecmtp5Jcic+3eBNdNvq45OVfcXIDO+RWWTFwVhzbRnC9JfENSS2fdVbU9WImx2KPNK909OjcqLOHdDt1q0WDkA/sojGUaZ8IOAr8LED4fLJIZhmE7N8nOYp/nKwteQUib+N9hsLfAUdyFx7oGUm9uO/s9axgUdsrewtt7q4STFmDuQxMaSv9u4pc1N+f9NmQii6vq+iIiIiIiE2BfxdHH8YQSpqkAAAAAElFTkSuQmCC",i.WEB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIWXMAAAsTAAALEwEAmpwYAAAC70lEQVR4nO2dzWoUQRSFzyLoygiudRlGUB9GBl/KqBjw5x2GYXZZ6kNohODSWQvmZ2WUKw0FQnS6qzK36tyePh/cTajqPuee7qphKiGAEEIIIYQQQgghhBD5PAFwBOAEwCUA2/G6TF5fA3jMfFBuA3gH4HeAphipOu9vAdxiNP9jgAZYkPrQOoT3AUxbsHrTcs2f8rJjG+oXgEctAjgKYNaC1qsWAXwJYNSC1ucWAVwEMGpB67xFADlCvgGYA7iT6imAU8fx1jPfm1I91clpxr3/zOt+tnYYb5nzvcnVU50hAd2TuIlnDuOtYL43OXqqMySgbxnYdxhvBfO9ydFTnW0actdhvBEDyNFTnSEB3Ya1ibnDeCuY702OnuoMCTjt2VS/Ooy3zPne5OqpjmXUOm1Y+6nmA+LXheP75ntTqqc6uU2ZalWHbdCClwKAAqA/haY3gN8I0xLEb4YRSnsAFAD9KbQpvwG7jrH90wWQofunCyBD908XQIbuny6ADN0/XQAZun+6ADJ0/3QBZOj+PQQ8ALBMv8hkhdXNWQGYFWjuu1/p9UYfQNeM7zdovF2r7hr3He+Xe73RB7B0aL6lWjjfbzGFAG6y7NiGOnO+X871FAD+NuGHQ8NKH6DRB7ByfAOWDnonF8DMcRM+cNA7uQCQPm0s0ppb2qCz9OQfOOmdZAAtMQWgAFzRGwAtQSVoCSJj2gMUgCvaA6A9oAQtQeTzANMewD0PMAXAPQ8wBcA9DzAFwD0POHe+Hv1T4NjOA1bO1xt9AK3PA2YFh/Ie5wvVGdt5wND9vM8XqkMXQIbuny6ADN0/XQAZun+6ADJ0/3QBZOj+6QLI0P3TBZCh+6cLIEP37/ldju1Y5Xw5uDUnAYxa0PrUIoCXAYxa0HreIoCHAK4CmLVg9bPwz6a2Qm8B/gngEA3ZA3Ac4KmzIHWcetKUvfQmTHk5ukpPfvPmX98TXqR/XjCF/y1wkbwetlzzhRBCCCGEEEIIIQRGzx/seDvzE8oqSwAAAABJRU5ErkJggg==",i))(Ge||{});const _E="modulepreload",xE=function(i,e){return new URL(i,e).href},Ou={},os=function(e,t,r){if(!t||t.length===0)return e();const s=document.getElementsByTagName("link");return Promise.all(t.map(n=>{if(n=xE(n,r),n in Ou)return;Ou[n]=!0;const a=n.endsWith(".css"),o=a?'[rel="stylesheet"]':"";if(!!r)for(let u=s.length-1;u>=0;u--){const h=s[u];if(h.href===n&&(!a||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${o}`))return;const c=document.createElement("link");if(c.rel=a?"stylesheet":_E,a||(c.as="script",c.crossOrigin=""),c.href=n,document.head.appendChild(c),a)return new Promise((u,h)=>{c.addEventListener("load",u),c.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${n}`)))})})).then(()=>e()).catch(n=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=n,window.dispatchEvent(a),!a.defaultPrevented)throw n})},Fu=globalThis.showDirectoryPicker;async function AE(i={}){if(Fu&&!i._preferPolyfill)return Fu(i);const e=document.createElement("input");e.type="file",e.webkitdirectory=!0,e.multiple=!0,e.style.position="fixed",e.style.top="-100000px",e.style.left="-100000px",document.body.appendChild(e);const{makeDirHandleFromFileList:t}=await os(()=>import("./util-83e43b90.js"),[],import.meta.url);return new Promise((r,s)=>{e.addEventListener("change",()=>{t(e.files).then(r).catch(s),document.body.removeChild(e)}),e.click()})}const Nu=globalThis.showOpenFilePicker;async function EE(i={}){if(Nu&&!i._preferPolyfill)return Nu(i);const e=document.createElement("input");e.type="file",e.multiple=!!i.multiple,e.accept=(i.accepts||[]).map(r=>[...(r.extensions||[]).map(s=>"."+s),...r.mimeTypes||[]]).flat().join(","),e.style.position="fixed",e.style.top="-100000px",e.style.left="-100000px",document.body.appendChild(e);const{makeFileHandlesFromFileList:t}=await os(()=>import("./util-83e43b90.js"),[],import.meta.url);return new Promise((r,s)=>{e.addEventListener("change",()=>{t(e.files).then(r).catch(s),document.body.removeChild(e)}),e.click()})}const Uu=globalThis.showSaveFilePicker;async function TE(i={}){if(Uu&&!i._preferPolyfill)return Uu(i);const{FileSystemFileHandle:e}=await os(()=>Promise.resolve().then(()=>SE),void 0,import.meta.url),{FileHandle:t}=await os(()=>import("./downloader-5b3f4b00.js"),["./downloader-5b3f4b00.js","./util-83e43b90.js"],import.meta.url);return new e(new t(i.suggestedName))}const vs=Symbol("adapter");class Mc{constructor(e){this.kind=e.kind,this.name=e.name,this[vs]=e}get isFile(){return this.kind==="file"}get isDirectory(){return this.kind==="directory"}async queryPermission(e={mode:"read"}){const t=this[vs];if(t.queryPermission)return t.queryPermission(e);if(e.mode==="read")return"granted";if(e.mode==="readwrite")return t.writable?"granted":"denied";throw new TypeError(`Mode ${e.mode} must be 'read' or 'readwrite'`)}async requestPermission(e={mode:"read"}){const t=this[vs];if(t.requestPermission)return t.requestPermission(e);if(e.mode==="read")return"granted";if(e.mode==="readwrite")return t.writable?"granted":"denied";throw new TypeError(`Mode ${e.mode} must be 'read' or 'readwrite'`)}async isSameEntry(e){return this===e?!0:this.kind!==e.kind||!e[vs]?!1:await this[vs].isSameEntry(e[vs])}}Object.defineProperty(Mc.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});const Fl=Symbol("adapter");class rn extends Mc{constructor(e){super(e),this.kind="file",this[Fl]=e}async createWritable(e={}){const{FileSystemWritableFileStream:t}=await os(()=>import("./FileSystemWritableFileStream-e4c13ad9.js"),["./FileSystemWritableFileStream-e4c13ad9.js","./web-streams-ponyfill-4a0f4950.js"],import.meta.url);return new t(await this[Fl].createWritable(e))}async getFile(){return this[Fl].getFile()}}Object.defineProperty(rn.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(rn.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}});const SE=Object.freeze(Object.defineProperty({__proto__:null,FileSystemFileHandle:rn,default:rn},Symbol.toStringTag,{value:"Module"})),bs=Symbol("adapter");class Ir extends Mc{constructor(e){super(e),this.kind="directory",this[bs]=e}async getDirectoryHandle(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");return new Ir(await this[bs].getDirectoryHandle(e,t))}getDirectory(e,t={}){return this.getDirectoryHandle(e,t)}async*entries(){for await(const[e,t]of this[bs].entries())yield[t.name,t.kind==="file"?new rn(t):new Ir(t)]}async*getEntries(){return this.entries()}async*keys(){for await(const[e]of this[bs].entries())yield e}async*values(){for await(const[e,t]of this.entries())yield t}async getFileHandle(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");return t.create=!!t.create,new rn(await this[bs].getFileHandle(e,t))}getFile(e,t={}){return this.getFileHandle(e,t)}async removeEntry(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");return t.recursive=!!t.recursive,this[bs].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];const t=[{handle:this,path:[]}];for(;t.length;){let{handle:r,path:s}=t.pop();for await(const n of r.values()){if(await n.isSameEntry(e))return[...s,n.name];n.kind==="directory"&&t.push({handle:n,path:[...s,n.name]})}}return null}[Symbol.asyncIterator](){return this.entries()}}Object.defineProperty(Ir.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(Ir.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}});const $1=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:Ir,default:Ir},Symbol.toStringTag,{value:"Module"}));async function Hu(i,e={}){var t,r,s,n;if(!i){if(!(!((t=globalThis.navigator)===null||t===void 0)&&t.storage)&&((r=globalThis.location)===null||r===void 0?void 0:r.protocol)==="http:")throw new Error("Native getDirectory not supported in HTTP context. Please use HTTPS instead or provide an adapter.");if(!(!((n=(s=globalThis.navigator)===null||s===void 0?void 0:s.storage)===null||n===void 0)&&n.getDirectory))throw new Error("Native StorageManager.getDirectory() is not supported in current environment. Please provide an adapter instead.");return globalThis.navigator.storage.getDirectory()}const a=await i,o=typeof a=="function"?await a(e):await a.default(e);return new Ir(o)}var Nl,Ul;const CE={adapter:{cache:!!(globalThis.CacheStorage&&globalThis.caches instanceof CacheStorage),native:typeof((Ul=(Nl=globalThis.navigator)===null||Nl===void 0?void 0:Nl.storage)===null||Ul===void 0?void 0:Ul.getDirectory)=="function",sandbox:typeof window<"u"&&typeof window.webkitRequestFileSystem=="function"}},Gu=i=>typeof i=="object"&&i!=null&&i.nodeType===1,Wu=(i,e)=>(!e||i!=="hidden")&&i!=="visible"&&i!=="clip",Hl=(i,e)=>{if(i.clientHeight{const s=(n=>{if(!n.ownerDocument||!n.ownerDocument.defaultView)return null;try{return n.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!s&&(s.clientHeightne||n>i&&a=e&&o>=t?n-i-r:a>e&&ot?a-e+s:0,ME=i=>{const e=i.parentElement;return e??(i.getRootNode().host||null)},zu=(i,e)=>{var t,r,s,n;if(typeof document>"u")return[];const{scrollMode:a,block:o,inline:l,boundary:c,skipOverflowHiddenElements:u}=e,h=typeof c=="function"?c:T=>T!==c;if(!Gu(i))throw new TypeError("Invalid target");const d=document.scrollingElement||document.documentElement,f=[];let p=i;for(;Gu(p)&&h(p);){if(p=ME(p),p===d){f.push(p);break}p!=null&&p===document.body&&Hl(p)&&!Hl(document.documentElement)||p!=null&&Hl(p,u)&&f.push(p)}const m=(r=(t=window.visualViewport)==null?void 0:t.width)!=null?r:innerWidth,g=(n=(s=window.visualViewport)==null?void 0:s.height)!=null?n:innerHeight,{scrollX:y,scrollY:b}=window,{height:_,width:v,top:E,right:I,bottom:S,left:R}=i.getBoundingClientRect();let P=o==="start"||o==="nearest"?E:o==="end"?S:E+_/2,L=l==="center"?R+v/2:l==="end"?I:R;const W=[];for(let T=0;T=0&&R>=0&&S<=g&&I<=m&&E>=$&&S<=ne&&R>=X&&I<=z)return W;const q=getComputedStyle(C),F=parseInt(q.borderLeftWidth,10),N=parseInt(q.borderTopWidth,10),ae=parseInt(q.borderRightWidth,10),ee=parseInt(q.borderBottomWidth,10);let Q=0,ge=0;const Te="offsetWidth"in C?C.offsetWidth-C.clientWidth-F-ae:0,me="offsetHeight"in C?C.offsetHeight-C.clientHeight-N-ee:0,be="offsetWidth"in C?C.offsetWidth===0?0:G/C.offsetWidth:0,Se="offsetHeight"in C?C.offsetHeight===0?0:w/C.offsetHeight:0;if(d===C)Q=o==="start"?P:o==="end"?P-g:o==="nearest"?La(b,b+g,g,N,ee,b+P,b+P+_,_):P-g/2,ge=l==="start"?L:l==="center"?L-m/2:l==="end"?L-m:La(y,y+m,m,F,ae,y+L,y+L+v,v),Q=Math.max(0,Q+b),ge=Math.max(0,ge+y);else{Q=o==="start"?P-$-N:o==="end"?P-ne+ee+me:o==="nearest"?La($,ne,w,N,ee+me,P,P+_,_):P-($+w/2)+me/2,ge=l==="start"?L-X-F:l==="center"?L-(X+G/2)+Te/2:l==="end"?L-z+ae+Te:La(X,z,G,F,ae+Te,L,L+v,v);const{scrollLeft:we,scrollTop:Re}=C;Q=Math.max(0,Math.min(Re+Q/Se,C.scrollHeight-w/Se+me)),ge=Math.max(0,Math.min(we+ge/be,C.scrollWidth-G/be+Te)),P+=Re-Q,L+=we-ge}W.push({el:C,top:Q,left:ge})}return W},kE=i=>i===!1?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&Object.keys(e).length!==0)(i)?i:{block:"start",inline:"nearest"};function Nn(i,e){if(!i.isConnected||!(r=>{let s=r;for(;s&&s.parentNode;){if(s.parentNode===document)return!0;s=s.parentNode instanceof ShadowRoot?s.parentNode.host:s.parentNode}return!1})(i))return;if((r=>typeof r=="object"&&typeof r.behavior=="function")(e))return e.behavior(zu(i,e));const t=typeof e=="boolean"||e==null?void 0:e.behavior;for(const{el:r,top:s,left:n}of zu(i,kE(e)))r.scroll({top:s,left:n,behavior:t})}function Oa(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var vm={exports:{}};/*! +`,t}requiresSSC(){return this.timingData.requiresSSC()}}var Ge=(i=>(i.SELECT_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAArUlEQVR4nO3YQQ6CQBBE0X8PXKrn9DqGcDNNZC5QhGR2agQk6Z5QL+l9FwULGszMzN6dgB4ogFbOjQTLPzcsniZE/+fy4SHKTgHCQijZFGAALq0GUJ35u+xaDiDg3nqA15YA0bR2HwfYmdxAMLmBYHIDweQGgskNBJMbCCY3EExuIJgO18DY+k/9kGBRfZn57PnTFXgkWFYfDltnFurqESnD6zTWJ794eTMzO44JY84XrlhT/UgAAAAASUVORK5CYII=",i.REVERT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAAAsTAAALEwEAmpwYAAACY0lEQVR4nO2aTUhVQRiGn1pYSVqLBM0WbQpNuLcoRIhS3AVFEEWLtiEKRRAUghAXidyoRNAf7XPhwqSfRW2jRVw0cpVCBJrR36KIfggqDswFGQY7Z+65986Zbx74tud+73PnnDNnZiAQCAQCgYAFm4BuYCMC2QO8B/4CS8BWBLEb+KTCl+ocQsgbwkc1hJDwHw3hRQjIrxLeewH5/4T3WkAuRnhvBeRihvdSQC5BeO8EtAPvEoT3SkC7RXhvBHQAHyzCR/UWKFahngJTwE01++wBNqQloGgZvtb1HXgInATqyhHw2YEw5dYycMZWxJADAdKqOWCfjYRRyx+8DeytQu0Hjqp/+Q4wv0pPv4DT1ZJQoHa0qZ6/pvmGGsuQgBJb1Kj4Y+jvbKUlFHCHE8BPrb/f6pWZmCsZFIAK+0Xr8Q3QUKmRUMA9jhhuh8u2FxvLoICIa1qf34CmSkgo4Cbr1eRoZa+D5VxwPGMCIi4aJkmkLeES7tKohn6p1+i50Jy2hMO4zSOt31NpXHQAmAb6cZ/zmoAbCKNHE3APYezSBDxDGE2agAWEsV0T8AJhdGoCHiOM45qAuwjjuiZgGGG80gQcQhBdhmX0egTxQBMwiSAOGhZFehHCZrUMtjL8c2ANAqgD7mvho5FwAAE0AE8MaxbRq9B7OoBZQ/himrvILtICXDXsB5Q+fFrxjLXATrX3N602PkxrlS+BbTjMOmBEfZ/HPSQRzep+xNirmMjCQe7BGEGS1mvgGBnhVorBZ4C+ck+J1OLkue3JlEV1NOaCevpnlsaEhyR2ZOHeDgQCgUAA9/kHkepiJFq7BJgAAAAASUVORK5CYII=",i.ADD_FOLDER="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAvUlEQVRIie2UTQ7CIBBGnz8rb+Mt2hqv4TGMmt4Kexl7gUa3TXBRTAALQqGJJr5kNpR+r8ykwJ9vogJaQDrqlCrwhWeRfAoPrRYo5xRI4OYTpGLkLDMEevl9wXqGzC2wH3uQa8gGOVpUAALoVAmGW+GNKSc44v4XLqmCwgpcqfVeWzNOEisQAYJGfyHkspPARu3vrGCbHrjrQz4oSSiLiL2TuBLZoljKAMEuRQBwxj2rOjX8RcXQioeqBu3Ln4QChU8M4+FlAAAAAElFTkSuQmCC",i.CHEVRON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRIie2PMQqAMAxFXwfP6qJVPIjYzcOKdUkhQ0BaCoLkLS3k818CjuN8ztApYzIDl7xvmalFsAIZuIFozKPMMrC0CAJwKIkuGVX5KdkmLEm3ci1JSlLKU49yLSmXVG1es0EANvnvInKcP/AA784fpjlWwNQAAAAASUVORK5CYII=",i.EDIT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABOElEQVR4nO2WQUoDMRSGP5duWgpS157BhQuheAR7mOrSuKviPbqQit5CaC9QEOxO2k2XhaJEAhkoZZLpVJy8wPvgrSaB73+TFwKKokjiAngGlsAG+ACegFMy4Ab4AWxJLXw4sZiA+G6ILpnKW1+PZB5ghlDMngHWCMbsEeALIaIm8s1GatSwa1Swbohv4Lxh30oxU2PtoGHfSqGihoE9t1tr7hA+nCayN/RN3B0/RBh15K20EIfIWykh/iJvcxhYlf8PtPOp0M6nQjufCqP3fEJaQA8YH/AXkj6Jy3jJWd5xlbO840T6w6zgAWhTzjFwGZgJEZ0/AlbAeyREwViavONsS6oqRE+avON651jEQrSlyTvuS872FOiQCW+B2yWbEPNAgJW/ncQzAT6BV3+++36wFUVRFAp+AZvenA82VBInAAAAAElFTkSuQmCC",i.ADD_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAABiElEQVRoge2YMU7DMBSGvwQJVO7CwN1YYEFUMAMdYCpHYUMcgg49A3SgEggGE2GskNh5frYr+ZOsppWS93+q9WIbKpWKD4fAHFgBH8BX4NgCt0CbOjiY8M8BYYfGkgwS8wjBs0qsrOKnwH7g/dkl7DkfGh4K+CfsotL7lz3f1SViCjTAnfPbA8oSMQUgg0RsAUgsoSEACSW0BCCRhFRgrA23KHcnqYD9Ijwjg4RU4MJ5RshYSIJ3SAVmwNM/AcfGuyR4h1QAjMQ58EL4cnyQxqO4279T4F0zywYjJlUgN1VgF4jRRkM5Ag5+PgcptY16U+IUajFLiA2RzpJSTqEGuHdqipfXqQT6wkeRSCEwFF4soS3gE14koS2wcGr0bWxEewRtgTf+hm2dmu5u7TW0gLbAFaZl3vA7PdyaLaalboBL++ZSX2R1P7Az+Ah8WtdTjtdV8RFYW9cnFCgxhuRcJ3R0RO18knOdIgQ6iannOkUIpGaLCT96Mrenn2USM+AYuAYeM2epDPINL56D04/lX9sAAAAASUVORK5CYII=",i.MENU_VERTICAL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA+ElEQVR4nO3XS04CQRSF4X+kYx8h0UWIM5vFoIxVdkCgmbMDlSWBsAchLMLWVHI76ZC2pnLgfMlNOqlJn1TdeoCZmZnZSbqNknUPrICfqCXQRcw1sG2EqGsHdBAybAlR1wtCZpkgaUzGUyZIHyFne43ebPg0JuUSeAe+ot6Ai//+KTsWPaCMKhBVAlWj0dP3GMGZqFp2rUptZqaZcyTNlIwyE2SCkOKPpfUNPCBmvBcmhRghqohlNlGcCTtUV8Ac2ER9xEVSyjmwbtm1PtWu8YPMOfKIkNmxPHVfM0GeEWv0bUuIjWLDd+ONXodYAHcIu4kyMzMzOzW/IiF2pLfCTcAAAAAASUVORK5CYII=",i.COPY="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABZklEQVR4nO2YQUoDQRBFHwiDB5AsXCSexYxeIVfwCDlE1hoXuUBuodl4CDGOgSyySrIKGGgZ6EAxTBZOVzc21oPe9OJX/eqqgSkwDMPIiT4wBhbAGjgCTuFsgBnQi5X4JTABDkoJnzvvwJV28nVV3iIn7sSZa1e+mfwrMAKugQv+OBOR+DfwQGYDexAGZPI3wDOwUhxk58/R606BQYiBsRB9Eff3wD7RPOyAsquBhRAaicqnSt4JE3U3/Jq1EKkHFt82p7sP4BYo0KUAhsBSxHrqIiR7+/S1WYm7OvmYDEWsqouAfMY2U9qVb1I0BlvFQNtdTFxIPDOggLMXwGYgCGcthLVQEM5aCGuhIJy1ENZCQbh/3UKb3A3McjfQ87vKbA3gF63zXP+J2/hKuJUoRaxPLdGpEF36IDH2QneNvdCjlvjAb8pSbua2XTdz5ygTmtj6BZc6ff+sVaTtdOX1VStvGIaBOj8GcNhDDTqXrgAAAABJRU5ErkJggg==",i.TRASH="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAABdElEQVRoge2YsU7DMBRFDwxlgb0wlB9BLMDXtFvhE2BAogNDxR+1S+ETEBJiLqVSU6lVGOwoJsQhDnEc0DvSU63c+OXeuElVgyAIddMBBsAUWOqaAH2ttZoj4AmILfWoz2kleyiDNvNJzWjpSgxITUbAEDjUdamPJXo/kMdCpqQGhzn6laFPGvRVmg9Sg90cvWvoiyYM3QArfv5O+64VcG0zuVNwfAHsu+f2whI4yBN2LRNi4B714IUmQnnJxbYCecQV57ngfA3bCvwZJEBoJECGO9R7+9ZRawTzx8XGWutrR83lGl+o+zVadM5v5+ciz0BoJEBoJEBoJEBoJEBoJEBoJECGKPNZVqtM3QFGqD2ckaNWGdlWCY1LgK0x9rG/b/bcWs/K4BLgzRifOMwry6kxfvXQnwfSP9zPwDn1rEQHuNA9k/7jGvp+4xh4x21rvErNgZ6PAKDuus8Qc+DMl/mEHmqJX4BNDaY3utcYj3deEP4rn4hExm+tmh+HAAAAAElFTkSuQmCC",i.IMAGE_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAB8UlEQVRYhd3WTYjNURjH8c9IozRlwUITTbMRNlNWxksWjKxkYbJQY6mUTCKxmDSkZiezm421KQsRFkgpL7Eg2Si3RJOFl5SIzVicc5t7p/9xz//O/5r41el2nnOe83zv8/zPC4usrgLbBPrbXO8DTuHHQgBm8QjvSwZfg0HcxV58L+nfBDDcht9w9P2IO1ie47SkjUCttBMDuIWexQB4gV3YiJutIDoB0AixoRVEpwCyIaoE+BV/Zxvac6zCdlwoclpaIcBt7EN3wdhxrO40wE9cS4wlt3Unv4EslQE4g5nYTlcFkFuCAxjH2dg/hzeY/lsAQ7iH87G/A7sbAPqFe6VWFiC3BDXheF0v7OsBIQOwEvdxpWzwlIouox48Mbe/H0dbF67jU7RvSaw5LVGu3Ax8w9aGti3aTmCPcP0+xdHM9f6o1HXcHQPXoQeF0+9k7I/Efm+BbzIDZQDG4tjLGOwtbph71CwTXkTjZQByS7ACo5jCK1yOgQ9FKMJJOIXDEaZtFWVgDF8iCKxDX4Fvr1CGkXn2BWWg/u8v4mu0vRZKMF8zuIpjGetmA4zGeZcy15zEJukt2aSck/CIkIXPmQB1HcTDKgD2S9zlLfQsZ1IOwIM2gmfrn3oP/J8AqW9gc8Vx1uJd7uSa5qd1VW2iKNhvOK12/OBuEgoAAAAASUVORK5CYII=",i.AUDIO_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAADFElEQVRoge2ZzWsTQQDFf200qVrBUBAURU/aVgTFSvUoXsQqgoIUFDx68SKieBILeujJFhH/AD0VRBD8REHBD/zCIqUm6kG0UqltE0FFqqkedif7Nuymm2bTbWUfLLy8+dj3kpndmQnEiBEjxv+KDuAx8BroBlLR2qkMx4BJ4K9c5yN1FBD1QA9u4+bKVdjXPOA6kAf2h+jRFymgD7fp+yWfK0GztPsKNIbm1ANp4AFus31YoaYbIAG8l7YnwzJbiuVAP26jvVjDCaYfAOCQtB0FFldrthTrgSG5ySTWBFYEDbAHa7zfBBpsLQFkpf2JUFzb2Gbf0HT+C+j0qBc0wFWpd1j0g6K/qc6yg04sw6bjPFYgLwQNcETqZXGGYAoYk7JN5TpZAHRhTZ4/JTf3u4awhpIfggZYhDXOTd1dUnZR9HPlzD8MaNpcA8DKKYxVMonPSN3Lom8V/aNf464KjBewXjLpAKa8AqSAO8AXYIfoLVI3DyRtvQ4YlrIVXjfSZ+5xYH4Ac0HgFaBNtIxt0GBAyraLrpN8rxHrpcJq4b3A7+q9+2IQ+GHztcAWKbstXCfsE+HthmiAhPCJKg1OhZ/ANfm8U/hL4RuFPxfeYogGmGlcEd4uvF/4GuHDwpsMiTKAvpTU6IhwfUiMCm/CA9WsWcrBr99G0b+JnsDZS+RK9IKtF0NG+Qso6ny435dZ1KMMsEr4uPAlOCHyoqdx/BbrRxmgWXhW+FLhOoR03M+KAPuEPxW+Qfhb4cuEjxmiAQrCk9QWC4Hd8vmGcH15vRK+WfigIRrgg/Cj1DZEK84eN4P7F9C10Qvh+rZ+5tXpaWZuMZcE7mI9DvUt3Cp1c7i/xM9S5rmYmw3L6bNS95Lo7aJ/KtdBA3AKeEc0GxrdeXVI2QXRfTc0laDWW8oMzvxM4t6ptVVjXDFTm/oDooe2qTcI+1glB9zCfaySkfahHqsYzOmDLYM5fbRoEPbh7jppN0KND3cNyh2vj5dp54UkcA/4jvfDoabw+oOjZ5p9Rbbg7AAeYT1Fuqn9AjFGjBgxIsA/jvJ6jenUZ2YAAAAASUVORK5CYII=",i.SM_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAcpJREFUeF7tmFGOwkAMQ+H+h95V2S2qqlKcsZ101PADQpPEfnFHgufj5q/nzf0/GkAn4OYE+hG4eQD6EuxHIOER+CFnWJdkbf5vfAEwOoephbiPCoOaN4A/AswWmVpoSZ0ACBN3iNkiUwup7gRAmLhDzBaZWkh1JwDCxB1itsjUQqo7ARAm7hCzRaYWUq1KwJlQxoSr7xuOAsD2x85RPweAbzOh7S+HWACrkKXP9vNWgBoAMjMFwJHhT9+Ngt7DQ2faAXza9vrjZ5suVQIiM60AzoSsg/cxZRMQnWkDgAjZQ2DumuhlF9H30hnZTLj5ycWIbsg+EwUwIgQ16TgH60UAwM0cToiekG4EwNHNTuhKKYXMZ9wBKW53Q2DzUQAzJCFkfgTAlSGEzY8CuCKEIfMMgCtBGDbPArgCBMq8AkAlBNq8CkAFBIl5JYBMCDLzagAZEKTmHQCcEOTmXQAcECzmnQCUEGzm3QAUEKzmMwAwEOzmswCMQEgxnwkgAiHNfDYABEKq+QoAZxDSzVcBOIJQYr4SwBbC8rlMC/qv8CpS/V62+VLqaopMv+oEMNoltQ1AgnHiJp2AiZcnkd4JkGCcuEknYOLlSaT/AqRIb0Fn6qw5AAAAAElFTkSuQmCC",i.UNKNOWN_FILE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABmJLR0QA/wD/AP+gvaeTAAAA+UlEQVR4nO2awQqCQBgGv6KeM+rU+1/L7F4RreY/W86ABw/ujsMPImwiIiLSwlh0XZIcit6piaoAY5JbknPNa31OZYAuI1QH6C7Co9zS63cXgQrQTYTqAMOL+9MC+35MdYBjniOgk1AdIOksAhEg6SgCFSDpJAIZIOkgAvkZfHcNmfDvsJkoOHeNlvVbuCbZtzzwbwGSRp/tzM1+nh0t8ILWiZo1MaufAAPQAjQGoAVoDEAL0BiAFqAxAC1AYwBagMYAtACNAWgBGgPQAjQGoAVoDEAL0BiAFqAxAC1AYwBagMYAtADNN84HLHFOqIzVT4ABaAERERGOO8QV911rDPw7AAAAAElFTkSuQmCC",i.MINIMIZE_WINDOW="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAANtJREFUaEPtlbsNwlAQBMcRLQC10QZEiAAi0wa0xqcMdIiICGmejZ60znfPN3OWBzp/hs7fnyzwb4MxEAOSQE5IAtTxGNAIZUEMSIA6HgMaoSyIAQlQx2NAI5QFMSAB6ngMaISyIAYkQB2PAY1QFsSABKjjMaARyoIYkAB1PAY0QlkQAxKgjseARigLysACOAEbYCX75oo/gCuwrwXOwHauyY3njLVAbbNsXDxX3bMWuHd0Ot9gbrXACOzmQtZ4zvuE6iM+fj7ideMBU9XV1VyAQ/4DUyH+tbd7Ay+Srg0YYU5a1gAAAABJRU5ErkJggg==",i.CLOSE_WINDOW="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAA35JREFUaEPtmbfrFUEQxz+/0pwwFNoqmMCcc46olY1/m7U2Ys45IWIuDFiJCYyYC0X5ypwcx93t7O57yIO37c3Ofr8zszvhBujxNdDj+OkT+N8e7HugVzywGtgLPAB2A1+6BHw4sB+YBuwBLoTO8YTQMuAYMNSUXQM2AZ9CyiO/jwBOAAtt3zdgG3CuTU+IwFLgeAl8oesWsA74EAmySVzgTwILKgJBEm0ElpvlhzScegPYCHzMJDEKOAXMbdDzFdgMXKr73kbgFTAhAO4msCHDE6OB08DswDkvgImxBK4ASxzWVTitB947ZMsiYwz8LMc+XeZVsQRGmmvnOQ64a3firUNWIgobWX6OQ/6O6X4XS0DyIqHLNd9x0D076E1AdixwBpjp0HnbdDZ6N/QK6YymF6Lu/IfAGkD3p26NM/AzHOBdoekhUJAov9Ft5z8ClPiqJAT+LDDdAd6da7wEdKaypEgscgB4bCRemux4A68MG1pu8FIUQ0DyyglHgJUhFMATI/HTsulUx56rluU/O2T/isQS0J5hluCUpUNLJLQmhwSBi8AWQInLvVIISPlg4LBZ2H1Yi+Bly7bRRWIqgYLEIXt1ckioRJDlo8GnhlAZrDxxEFibyEA10A7ge+L+pDtQPWuQkVB1GrOUIHfmgO+EBwrAInHACjsPCZXou4AfHuE2mZw7UNYbk621TyWCwi67n+gEASU4hUPRSXmN2pGmKJdAKviCZDaJHALKyuqV1bnlrOvW2SX12KkEOgW+IJ5MIoWASgkVdYsdZlfLqeVpilTEqcd210Epz6gsfxRY4QCvTkovza+GiUOdimgSMR6IqUQL8EUnpWdWWdfT2UWR8BKIAa/+WJav9rBdIeEhoHpHYePpAZrAF+ESQ8LVG4QICLwamNqRRiWIQ+AL8ZhpR5BEG4EY8JpIqJmvHX3U3NaOkWgjoFpfw9XQ8lq+qsc7ldM+NU/b64C0EXgGTAqgj7V8HQnNiELTuedNWNoIKO4V/wqluiXwem2807gmW8gTbSQ0od4KnI/1gOSr/wYKHfct5nPBly+2Ro3VCbU6NYWx5km1K/QKaVN1zK7BlbzzOnQ5Ir/rYpdJCLziXt5pXB4C2qxQ2Qc8NXeG5p+R2P+Ja2Ktx2OK/cpqBa9dXgKF7O9UZN3aF0OgWxiy9PYJZJmvA5v7HuiAEbNU/AEymbExfA8cowAAAABJRU5ErkJggg==",i.SKIP_START="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABEklEQVR4nO3YPy4FURTH8asQFBKvsAeNbQixBxqVxi70lqK2BZUlPKJ50SlQ+Ih4JMZ48+fOTDKT8+2/v3PO5M6deyelIAiCIAiC4A84xgPucZTGhq/Gv5m3zJhhO6OHWWtfgYbuOi7xhlecDelnDYA93Bb0xVB+1gA4wXPRHcr/RZMA7OK6rPAQfil1A3CAx1XF+/T/pSoAW7jCe1XxPvxKVgVgH3d1Cvfh16IsAGu4WG5tjejCb0RJxiZumhbuyk9NKck4z2g+208xgJEvoTT2lzhNYRudzIdsEkeJyRzmJnGcrnEheUoD+T/kPIHClfAFp0P6XV7qd7DRxs32P3+lLIeY47BVSBAEQRAEQZD65ANrrC3m/GFNbwAAAABJRU5ErkJggg==",i.SKIP_END="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABBklEQVR4nO3XPWpCQRTF8RskEBBBy+wgvZuICNlCKgsrt5AqC3m7kGzB3l6tREgnUYt/GHyveJBq7pvRIefXn8sceB9zzURERETk7gBTYAdsgUnskAEwchwiOs/14I1NzIAZcALOwCfwmDnfElPg0B7BCnjJmHcX+MsRWAAPufPWUYHGEnjOmbeOCwR74C1X3hIUaFRAP3XeEhYI1sA4Zd4SFwguwAfQS5G3DAUaX8BT13nLWCCYd503FfgHj9Cl5Jd4XfJntCr1R7Yv+SqxLPUydyzpOv3tXEi8eXeBd+CnXgtjVkJv3legHhJ+KMOosDOPd6m/NWBSl9gAr7c+j4iIiIjdoV+nEzteGs3QogAAAABJRU5ErkJggg==",i.PLAY="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA40lEQVR4nO3YMS5EURQG4ENBr9dKsAMq9qCdLdgBSh1rsIVZAjZhelrTITGf3GIiCsm8mZd593K+7nXnb/7890WklFJKKQ0HGzjGKTajNbj17R770RK8+al8X2IrWuB3TziJhgMUM9xhJ2plMc84i4YDzI2xGzXR3SvOq6lcy3vAQcsBig9cY7vVAMNXrv584qLlAHN7GaAL/ZmVDRXr1tPxkzLH1378f6/RRxwOdvgKAaYtT4lxq2PuBaOokT/8oJkMVo0rPurfcTVoNXaBm+o2/hI/to7KHK6mGlNKKaWUYiFft4ARJbTJcIwAAAAASUVORK5CYII=",i.STOP="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAo0lEQVR4nO3YQQrCQAyF4XcQXffsFsGLqdhe4C8BFzLgYiAJFN53gc4/6WYimZmZ2UkAV+AO7OTbgQewVB7+Rb13fKsiIG6+y1oRUPHb/LNVBLSSAwaewCRlo5kcMPAEJikbzeSAgScwSdloJgcMPIFJykYzOWDgCUzSyR/1n4qAWDp1uVUELN+lU7UncEkP+NnOrbG3KTj4FjdfdngzMzNTvgMULRo3zp7/ZwAAAABJRU5ErkJggg==",i.RECORD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABMElEQVR4nO2XPU7DQBBG3yUo+AniOkgQcQ3ID2ehA4EoKOlDuAmOcgpiOhJ9yNIUlguwE+/YEfOkkSxX39sdz3ohCIIgCIIgaAXBqWAieBdkgi+rzN6NBQP6huBY8CBYC/RHbQSvgjP6gOBKkNcIXq2VYNh1+Ftb0abhy7sx7XLldwlflvDdCcHJlm3zWzsdeQo8txheVo+eo7LOtGla62JnPQSmCcLLauQhME8oMPMQWCYUyDwE2pw+qlS+7wKfHgKLhAIfHgJ7/xGPEwpcewgMEh1k3y4HmUk8JRC4dwlfusCs2pw+gkM3AZM4b6mVNoJL1/CV/6JdLzSTTsKXJIZbtlPRNhf0AcGB4M4mSZ1Vf3Hv+QY3tZHgrThV7bcjt+eZ4MZtVAZBEARBEPwDfgDcyqJBiCPoQAAAAABJRU5ErkJggg==",i.PLAYTEST="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABdklEQVR4nO2XSUoDURCGW0FvoBtbL2AQT+KAwZXgCfQK4srhGA7gQsVFMF5AjyBOOYBiUBK38ZMHDTb60nn1MlWgvn1V/V+6Kp0kiWEYhmEYCgFKwBVQZ3jUswzz0vALwCd6+HCZJAI36KMaGn4KaKGPFjAdIrCJXjZCBM7Qy0mn8OPAO3p5A8aKBBbRT6lIYFvQqALMAClwHREktn6rSOBS0CjN1c1GCMTWXxQJuB0LwlM7KIHXduHnJNN7IODWJs3CV2Pl8wGWQ3a27eP77RN7ExKWfIN3xdbtJWJuQsJOzAFrEjj3Db0L2dnA8NKdlnLrG1yTdPDUd0tF8F548Ql8DVkgFaxg0yfQ6OPAXvdr+AQeB/g93m2/B5/AKaPDkU9gndGh7BOYAJ7RTw2Y/CeQSayim2/vz4g/EofoZa8wfO5v5QH6Pvl9l62jQE5kRclNPHVcmwIJd9hl4Bi4d2/AAQRuZrPczDWXISq8YRiGYRhJ//kBnszTFsS/lqcAAAAASUVORK5CYII=",i.ADD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB7UlEQVR4nO2ZS07CUBSGCT4GDn2MQHch0YUYjC4EwwLAuRA0LsGIAxUHrkKjC/AxEnBMnXzm6DUhFeJ9tb3EfkmTJoXb/2/a03P+Fgo5OTnOAHPANlAHzoFH4B34UJvsP6hj8pstoBiC8HXgEHjFnBegCZSzEL4GnAAR7kRAB1hNS/weMMQ/A2A3SeELwCnJcyzn8i1+CeiRHtdyTp9XPk3xP9wCiz4MpHHbTKPjKn6f7Knail8B+lmr57vimZdYVedDoW0qvuzpJeWLCNgwMSDtgStXQEldDB9VrGnSmNn0NnHKsZ7JlWetBlB1lc5MWNcHFR0D0u6GauBAx0A3YANnOgZk8AjVwL2OgaFNtflz4d/nsalOfZ2FTeu/9USFeXUa/QsDQ8NFezYmlPibJG6hmX+Iu7NeRusBG6jpGJDQKVQDmzoGiip0Cq2Ze9JO81Ri5spXdbKsNpNoaIkPdKAZGb/tVdwXCkdG4pWB5UCG+oF1bipZZdbqgR0r8WMmJKvMipaT+LEZ+SID8VfAvLOBsXBXAte0uPQW7sZC3jQqU8vblZ9ipJpQdXpzfmANc9O2esG4MpI6L2U7FfExIyXVdkjoZIr8p2EzTydhRBrAiuQ20rPL4KEmu0htsn+njtWkqwziM2tOTmH2+QRxCeic7ZLqUgAAAABJRU5ErkJggg==",i.SPEED="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAACYklEQVR4nO2ZS04bQRCGrcAmu0BWAYM4BCE5R4QQJ+G55bEFEZQLZIEgCYiHcw4QF0hgQWJgazubLyqpIjWOx1M93fNAml8aaTRWd/9/TXVP/eVGo0aNGsEAXgDvgTXgK3ANPAJ/9HrUZ1+AVeCdjGmUDaAJbAO3+OMG2AImyyD+GvgE9AhHF9gHxosivwjcEx9tYCFP4qMadSvOJT00zVoe4z7KWrHJvwTOPCPadMZPeY49lTVjRt6XfKiAfyLC34Rn2rhoafoI+e8Z59iLsWH7cQFMa37LfSiOVWjSXpkPOSrvU1JDhITgwE0TFdGP38BYzNSZiiTgCfmUveKXShqJXkpuz3gej2nkRzWdkj52Ez4CpDzIC0nkD1LGbfoUZj9zIn84gPwI8NkwVuqtEYsAqSqrFHkXcxYB61Qr8i6WLQK+UU3ygiOLADEeoZATbGnQyZEhbVxcWQQ8RKgqB75qI/nzIeu1LQJ6EYqygWe2MfLNIet1SxMgz4xjm6ECHiJUlf+lELBiHNsasl67yE28rFGf0PsY/vnKIkDaIlXFoUWA9HaqiiWLAGk6VRWzZRdzIfhh7uZpx6xq2DCRVwGTaiIowBNfGObreBkaFSHtPnL2xNb5dr3IO6Ze2n15eWLrfL8ymXqdcCEnT+wz34dM5B0R0qssCztB5B3zUcbX+Sxak1ebu9KrLAon0Zq7fWZkrwDyu6buQ4CQeT0ZYuMueMN6iBjTt5H0sfNBR6P+qhDyfUKk1t/MWDtJbbMBvCmceEIBOKeu60iMhzq7nl5yf6m/ibl5W4m/WWvUaDx//AV2V/CQip4uIQAAAABJRU5ErkJggg==",i.UNDO="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABeklEQVR4nO3Wv0tXURjH8dtgEuJaoEMSguBQBNUiVGv9D41uTg3S9EWiobGpv6Gh0Mk/IAyKnIxoq8SiEm0Q7IdErzh4S9Hvr6vnDMHzXi/3+Zz3c89zzq2qIAiCIAiCIAiCGixhGaerBmAA19HCAl7jK3bwDR+wgnnM4ipONsnodyF/edWPBCbxEBuas44HuFBCoKsEJupO/5aHJ6lmboFDEvVWuVtvjdzs4H7KyCnwTwIjeKE8zzGWU0A9lGkQu5GGdREzmMI4hnAKo7hcP3uE7R61vuB8ToFufMLttNgGOcOYxvsuddPBcLGkwC/MpQ437tRe3iDu4GeHjM/p65UQ+JjO/aMuvE3uJbztkPWs78FuINDXPdFQYgRvOuTdyy1QSuIMVttkfce53AKlJK7gR5usxyUESkm02uSkQR8sIZBdwu7d8e5AxiZO9Hpx7RgSL3MJJHANW/u6f6vqBW4cQ+JplRm7vzA3cTZ37SAIgiAIgiAIqv+aP0/ezoLd5BjTAAAAAElFTkSuQmCC",i.REDO="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABi0lEQVR4nO3WPWsUURSH8Y2oIJKYRhdiEa1SCJqXVvAzuEXMB5B8BEuLiKRIk8pSLC1WSJMqBEIgasoglmKRYBaVFEGEpPAnK7dY193ZndlZWOE87cw59/nfe+alUgmCIAiCIAiCICgILuM+nmADBzjET5zjBB/Ttad4gEs51xjHduqTqzar6V2s45v8fMcL3OlTfq+ltjqo+EzazTL4lXrN9ClfPEAalbU0FmVzjmet49FFvlgATON9hsBXvMIy5nETV5pCuI4FPMYbnGb02cdUhnz+AJhLM9uJXdSap5PzJBfxoUvPoxTEwAFwr4v8JzzMtRP/9r6AR/iSIVs8QBqbTm+YOiYGkW9bp4qtUgOk2X3boXilLPG29a6hUWaA1Q6Fz4ckP57xwOYPgNs4ayuqD0n+KnZyyPcV4HVbwWdMjsDO9w6AW+nr2EpthOR7Bpj1N+8wNkLyPQOM4eWf2zhu/rCVKZ/W2FScH339jeIGLpYtn3o3vyNFaGBpGE5BEARBEARBEFT+S34DOXeCiMi4hZkAAAAASUVORK5CYII=",i.CUT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAACxElEQVR4nO2YvWsUQRiHRwMKKojkQxMUOzWiXbCxU7BQMRFRrCKKtQqXiF8EY+dfYEQrxcZW/QdEbMydWhhQLERR8QPWJIrBmHtk2PdgGXZnZ/d2zyn2gYMQZmZ/M/N+zatURUVFhbcAvcA1oAH8lJ/+exLoUT4DHAZmSeYHMKI8Fr9EOkvebYLQbGwnbxJ4ZU6ENh9lAagB/fKryf+iXC1Jy3JgFHgDfAGOu0x6boirxYwZN8Y0ShC/B6gb3/nsMnHOmNQfM2bAGDNXoPBB4EGCub5yWUDbdJR1DhsIChC+HrgBLCaI15axw2Uh89rOOJjQszaErwIux9x8i4/AKe0PrgteMhbQDnsO6JaTH49x4gs5HfQE8CFB+C8JKGuyLtwHfMOdr1nDKLBXMnpSbrkDbMx6KNEPHLLYYpQ/wIEM624HHlnWewwM5RZufGw/MJ+ygVHHtTYANy2H8hY4Uohw48Pa5u8CTUs9dB5YaXHQK5aDCCQxrihcvCFkCHhquYn3kjGXRRz0KPAuYfyi3EhfqcKNTWhRpyWlJ/EEOAm8sIzRSWpbx4Sb6LCma5+YUJrGjPYr5QvAlpSI0kKH5LNAl/IJYDUwIaE0jt/AdWCt8gmgS1K7TvFx6Ih1D9isfAPYB7xMceJdlvm7gVu64uy08EHgvmsYjZm/ScqDZkfDKOEL7DbwN08ikzW2At8tiWyslESma5yCS4mpjpUSwLDl1KNoQQe9KuYIy+mkK08qp3tzlNPm27tFs61yWl5HWbsSF3160NRzdCWms24gw5PyU9YnZZCjK1HUo34q5VG/s6y2ymy7GzAc/WHCJmZUGjHONeZgQnVVTmOrYZqTy0TdOo+yIMlmwNKVKLu1+Fpqr2Muk3okw7qifaZb+QQwkqG9Pqx8hHATQcrJ+yneMKdJyQ3zEqGm5Unpl9lUVFRUqP/BP5CqMiH1c5cpAAAAAElFTkSuQmCC",i.COPY_WHITE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAA2klEQVR4nO2YQQrCMBBFcxBd9yr2qBbBO9mtis0FngS60CiV4JAx9b9tFpmX+WFgQhBCvABsgQMQqccI9MGo+As+nCwE0svTskD0Kh7YWQg8EVoDCTjDP3SAunMiAkegMxFwnBPXdLeFgOecGCwEvOZEYrIQWDy3htL7JGAM6kCG/kAhKEIZilAhKEIZilAhKEIZilAhKEIZilCFCI1Lu8oWOtDPEm93lT8v8AkJFII6sMIIRfy4WQikRasXewuBbl601uYMbL4WeNhQD2lXWaHwKb28WfFCrIw7KN2RSPl95zsAAAAASUVORK5CYII=",i.PASTE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABHklEQVR4nO3ZQUoDQRCF4Ua8gC41rnMVPYSoxzMIgopXEPUWcatiZuH2l4JeTBokdlXsacL7YFYz01PVr1bTKcmOAfaBK+AV+M7XC3Bp91LPgMNc7G+egYPUI2AvF7jJkz2begNc8HfnrYo6AW6AgXoPwDEwAx4d7w/ALTCPFP+B36xYy+vT3vc0YDsfcTRay5KIWHga8IzN2F0eH7vug2utPA2s2XQ/KlV+Xw0Ab1sMYDlFAmdbamIJnDZv4L+hBgpKoPUGogRiUAKF4IYqgdR8BpXAOiWQNEJ10AgVUmNEv68GglACheiOKoFaSiCI6AjvQgID/fjyNGCHC7249jQwz4cLU3sfH5bUNmEnKwv7Pz9B4SvbeXfxIiKphR8IWaCtfT4/XAAAAABJRU5ErkJggg==",i.UPLOAD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIWXMAAAsTAAALEwEAmpwYAAACYElEQVR4nO3dO48NcRjH8e+6NbrtCI2Iuyi20aHQigQlXoDE5Q2IUqKgFC0SkbhWVqXyAiRqFHYRbOy6LvHIiZnkSBZnZ2bn9v9+kl8/8/zyzDlnTjIDkiRJktQNa4BbwEfgLfAIOAOMN31gKZgAXgGxQJ5m5WiJ7AE+/GX4eZ4BG2ygegeAz/8Zfp4XwEZLqM5R4PuIw88zDeywhPJOAj8XOfw8r4FdllDMGHCu4OCHMwPstoTFWQ5cqWD4eeaAfZYwmlXAzQqHn+cTsN8S/m01MLkEw8/zFThoCQsbBx4v4fDzfAMOW8Kf1gJPahh+nh/AcUv4bUv2wylqzuCr7QkSNwG8aWD4wyWcJlF7R7ivU1fOkuB9nS8tGPxwzpOIYwXu60RNuZD9Au+tUyXu60RNuQwso2fGshWPjuQasIKeqPq+TtSUG8BKeuBiC4YZBXOJHnjegkFGwQz+3uy86RYMMgpmih44kp1IF4d/qOnhtUGUjCyg28INsICkhRtgAUkLN8ACkhZugAUkLdwAC0hauAEWkLRwAywgaeEGWEDSwg2wgKSFG2ABSQs3wAKSFm6ABSQt3AALSFq4ARaQtHADLCBpUyU24GXTB98H10sUcLXpg++D9cD7AsN/B6xr+uD7YjNwB5gdYfCDB4DcBjY1fdCSJEmSJElSEduB+y160m20OIMZ3QO2UZGd2Rsomj6x6FjmstmV9rAFJxMdzeBlFKWf+TnfghOJjmY+m6EF0NECvARRqoAHVMAPYQoNf7aqD2Gyr1R3s5eiNX1djZZnJvv/emtVw5ckSZJEr/wCliFWxPec8VIAAAAASUVORK5CYII=",i.DOWNLOAD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIWXMAAAsTAAALEwEAmpwYAAACWklEQVR4nO3cO2hUURCH8U9FEUEQC0EwhYWIijY2giIIgqj4ADs7Szs7W0tLO0urWEh8VmpjY2WhhY2FhRgRQVTc+IyPkQs3hZKYze4m59xzvh9MExKY85872WX37oIkSZIk5WkMmAB6QMxTze/cALambrqk8N/1Efy/1fzNptTNl2BigPBn6lrq5kvQG2IAH1M3X4IYsuQAui3cAAdQtXADHEDVwg1wAFULN8ABVC3cAAdQtXADHEDVwg1wAFULN8ABVC3cAAdQtXADHEDVwg1wAFULN8ABVC3cAAdQtXADHEDVwg1wAJ12FHg1gis5lrgmgcMUYDKDMGPAekkBHEBiJ4DpDK7mWGB9B45TiCPAlwxCjT7rG3CSwuxvP7UYmdcn4CCF2g28zSDkmKPeA3so3PZMn5a+AXZRic3A8wxCn6kXwBYqsxF4mkH4z9rvo6jSBuBJwvAftz1UbR3wMEH4j4D1qQ+fizXAvSUM/wGwNvWhc7MKuL4E4d8BVqc+bK5WAFcWMfxxYGXqQ+ZuGXBpEcK/DCxPfbguuTDC8C+mPkxXnTf89M4CvwYYxG/gXOrmS3Ea+LGA8H8CZ1I3XZpjwNc+30g5lbrZUh0Apv4T/mfgUOomS7cP+DBL+M3P9qZurhZjwFXgdVvjNb+iKUmSJEmSpLLsaG/n6MLt5ZG4moxutzchj8TOeV6Dt5g1g6k2u6HdN2QGvciau/2GvlGqi5/vikxqus3QAdDRAfgviKEGcJcR8EGYgcLvjepBmPYp1a053gy3+CuDJqObwLZRhS9JkiSJovwByQJHhbd7qEkAAAAASUVORK5CYII=",i.PLUS="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAYAAAA4qEECAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB1UlEQVR4nO3byUoDURSE4do5D+/g9HgOIILDQvDpVNxonBLwEYygy1DScHUhIumm23v75P/gbMzm3KIWEU4kAAAAALNgQdJ87iWiWpd0IelFktOMJJ1LWsu9XBQ7PwL+OVXg27mX7LtlScM/Qv6aJ0lLuZfts6MpQv6aw9zL9tlNjaCvcy/bZx81gn7PvWyfueagIYL+J6bRBB2KaTRBh2IaTdChmEYTdCim0QQdimk0QYdiGk3QoZhGE3QoptEEHYppNEGHYhpN0J2q7tsO0lXQW4PGueczTm/f7/LWr7rYvC/gsS5kBpI2u7jqJGT9esXa6n32WQENcqFz2mbQowIe5EKnut9uxZykSQEPcqEzSRkRtHoStKb8ecOszlAtOi3gQS50jtv+ejco4FEubB4lrapl1ZdzwtZ3yLeSNtSRRUl7kq7Sv6OesRlLupS0m7IIwzUHDRH0PzGNJuhQTKMJOhTTaIIOxTSaoEMxjSboUEyjCToU02iCDsU0mqBDMY0m6FBMowk6FNNogg5lXKPRr7mX7bPrGkFXF0Ro6KBG0NWZFhpamvKw8i7aLVwOW5Ie/gj5vsurzlmzIukkXddP0jynv1WfoQNzbf5mBAAAAICK9QkSkO5NnQjE8wAAAABJRU5ErkJggg==",i.ADD_EVENT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAB4UlEQVR4nO2Xy0oDMRSGi6Ib6UpxpUu1TyC6E19AqW19murWqm+hiDd8A0Vw6WVrpdo3KNjWdT85EHEImWk6kzazyAcDZeYk+f/pOZmTQiEQCAQCgUAgEMgVwDJwC/TwTw+4A9ZGEd8hf3SAJRsD8ubzyrWNgTykTRxdGwO5phAMxDMAXoA6sCW7BjCnrpK6dwC8krN/YABcAatDJ/9fQ8zdqLFeDXwC67bCDWttAG1fBp6AxbTiI+vNA/eTNvAAzBjGzgL7wAXQBH7U1VT3ahITM+5xUgYkbeYN4/aAL8vxZcP4BZt0ympgoOc8MA2cMjonwJQ21+awws5q4NIQn0b8H41RW5ksBgb6VqnSxmqhhHl3tbjSuAw8Gwrv04GBtl7YwFsWA3HNXF2Lk90GBwaEqhZ7iJlvGwNyeDCxpcXJtujKwLkWux0Td2v7mTcdaPT8/0gSbLFOlKZBg45oWrGdfEkOD9J/RyYoJqVaRgM97Vkx8qyrdiY78SMI6Ds00HUqzlKAyxR6H4/KZAEui/jMh4GaQwMVHwZmgJYDA1+mDnVSJsoODOx4ER8RJl1lWo68ilcGpoDjFOIbejvtFekqk2oiQst72gwp7Kr0NrK3q49dX/2WexXTUTQQCBRS8ws6Beac36b8wwAAAABJRU5ErkJggg==",i.SELECT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABdElEQVR4nO2ZUU6DQBCGOUf73LsIRL2mPnglobCaaGNivcDXEKcp0F2Q3S6VZr6kT/+Gf4ZM2d2ZJFEURfm3ABvgBfjhRAGklrUZUIqeOXQzohctn8bzGViHBP+FndqyftvStx66cXjtvJKQN8+EBEygXg/4Pfkk0C6bNq/AnWV9LkFWjhI56k2guUVP5dk2vn0S6JDMDKH+t5BA0S6bKFHG9JearOV3VvOx4cr+irJ4OJ1dStvGNIN/Lt5+/r2tvYoSZUz/scNXbAj1HzvbxIbu2Wl2f0VZPIzccWfwvwfe5E+cLvEz+h66DwzeYWPD79sPSiCXPeBa+0Am5dP4631AUaYCPAKfwAfwkCzNn+5nzESJMqb/LTS2OkSJcoBLJLDHjms+cLzDuvr/uWilo7mb9bpxwc3dZrjgYqw9Xnno5tLt9bUMF/6agJkw4JgyH9gBq8kJyENXTfa9chqaDzjPTlIiQ3ramw/sxdsveEVRlGQODgnFtCEN6s0TAAAAAElFTkSuQmCC",i.EDIT_WHITE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAABRklEQVR4nO3WMUoDQRSH8bG0UQTR2jNYWAjiEfQwapm1S8R7WEhEbyHoBQRBO9HGUhDlJwMJhLC7ZCPszsJ85c4MfP/HvLcTQiaTSQbs4Rof+MYzLrEdUgen+FXOewwXUgVFhfh8iK3QU/kpF6HnAZ5Cilg8xFdIFYuFeEtFtKhZq+OqfeNqwaYhfrDbvnW9WNFg70n71vVCU4YVZ85m9gzat27WnEXN2dK1FGf8MKREQ/m0Qiwpn0aIf8r3omHrGGT5ZciV74pc+a7Ile8Kec53CNZwgPESf9junsRl4Ka38hEc9lY+gs2kH2ZTMMJ6KAGr2K/oie4rjxV84r4qxMzecVLyEezMSNWGmEyndOQjOJq7FpUh4vek5CM4L7nbj9gIfQB3FdOlHyHwWhEgNvYopA4e8ILbySPuODZ2116ZTCYTkuIPW58e4VQyzE8AAAAASUVORK5CYII=",i.EYE="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAACjklEQVR4nO2YTUuUURTHrcW0mLQPELnIyfGz9E5RIIUIbatNVqsGl1YEvXyAaqeppVKboqxNLyuDXtfRxkqIlNAh+8WBI0wP1/GceV5EuX+4MNznnv/5n3nuuec+p60tIiIiIiIiJYB24CBwBXgEfAbmgCUdczr3UNccALavt+itKmQSqOOH2EwA+4WrSOFbgOPAR7LDB+CYcOctvht4Rn54CuzJS/xJYIH88Rs4lfVev0bxuJo6N1T8XYdTOXGGgV6gCpR1VHVuRNdYcSdVXgC3HM7GgN0Gzi5g3MF7s1Xxg0YHf4BzLfAPAMtGH4Necjmb/xrJ3eIb/Fww+hAth62knVo5LRgL2G8DzgKv9dRa0N9n5Flg/QOjL9HUaSlSL4yES8k9D+wE3jaxmZE1CZuKI7GfN01qoB87hgP/fDPxjUH89yaAew6//auJ3wF8cxD1Juxl21hxOmF7wmErGjtCAdTwoTth/8Zh+yphW3X6roUC+OokaU/YzztsfwWu4x582ZQB1Db6FuoAZlMksZzzRSTxbDCJlajPQTQSOEbliFwLsqaUsB11+O0Lim8oZNNGIik+XYFCNtNCIasbfU6veTsFdjmuEuMB+5JsEdnnmtgyXupcKbB+wujrh2hrKr6BdJ/jMjdgIg37uWj0IVoOecmtp5Jcic+3eBNdNvq45OVfcXIDO+RWWTFwVhzbRnC9JfENSS2fdVbU9WImx2KPNK909OjcqLOHdDt1q0WDkA/sojGUaZ8IOAr8LED4fLJIZhmE7N8nOYp/nKwteQUib+N9hsLfAUdyFx7oGUm9uO/s9axgUdsrewtt7q4STFmDuQxMaSv9u4pc1N+f9NmQii6vq+iIiIiIiE2BfxdHH8YQSpqkAAAAAElFTkSuQmCC",i.WEB="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAACXBIWXMAAAsTAAALEwEAmpwYAAAC70lEQVR4nO2dzWoUQRSFzyLoygiudRlGUB9GBl/KqBjw5x2GYXZZ6kNohODSWQvmZ2WUKw0FQnS6qzK36tyePh/cTajqPuee7qphKiGAEEIIIYQQQgghhBD5PAFwBOAEwCUA2/G6TF5fA3jMfFBuA3gH4HeAphipOu9vAdxiNP9jgAZYkPrQOoT3AUxbsHrTcs2f8rJjG+oXgEctAjgKYNaC1qsWAXwJYNSC1ucWAVwEMGpB67xFADlCvgGYA7iT6imAU8fx1jPfm1I91clpxr3/zOt+tnYYb5nzvcnVU50hAd2TuIlnDuOtYL43OXqqMySgbxnYdxhvBfO9ydFTnW0actdhvBEDyNFTnSEB3Ya1ibnDeCuY702OnuoMCTjt2VS/Ooy3zPne5OqpjmXUOm1Y+6nmA+LXheP75ntTqqc6uU2ZalWHbdCClwKAAqA/haY3gN8I0xLEb4YRSnsAFAD9KbQpvwG7jrH90wWQofunCyBD908XQIbuny6ADN0/XQAZun+6ADJ0/3QBZOj+PQQ8ALBMv8hkhdXNWQGYFWjuu1/p9UYfQNeM7zdovF2r7hr3He+Xe73RB7B0aL6lWjjfbzGFAG6y7NiGOnO+X871FAD+NuGHQ8NKH6DRB7ByfAOWDnonF8DMcRM+cNA7uQCQPm0s0ppb2qCz9OQfOOmdZAAtMQWgAFzRGwAtQSVoCSJj2gMUgCvaA6A9oAQtQeTzANMewD0PMAXAPQ8wBcA9DzAFwD0POHe+Hv1T4NjOA1bO1xt9AK3PA2YFh/Ie5wvVGdt5wND9vM8XqkMXQIbuny6ADN0/XQAZun+6ADJ0/3QBZOj+6QLI0P3TBZCh+6cLIEP37/ldju1Y5Xw5uDUnAYxa0PrUIoCXAYxa0HreIoCHAK4CmLVg9bPwz6a2Qm8B/gngEA3ZA3Ac4KmzIHWcetKUvfQmTHk5ukpPfvPmX98TXqR/XjCF/y1wkbwetlzzhRBCCCGEEEIIIQRGzx/seDvzE8oqSwAAAABJRU5ErkJggg==",i))(Ge||{});const wE="modulepreload",_E=function(i,e){return new URL(i,e).href},Ou={},Ir=function(e,t,r){if(!t||t.length===0)return e();const s=document.getElementsByTagName("link");return Promise.all(t.map(n=>{if(n=_E(n,r),n in Ou)return;Ou[n]=!0;const a=n.endsWith(".css"),o=a?'[rel="stylesheet"]':"";if(!!r)for(let u=s.length-1;u>=0;u--){const h=s[u];if(h.href===n&&(!a||h.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${n}"]${o}`))return;const c=document.createElement("link");if(c.rel=a?"stylesheet":wE,a||(c.as="script",c.crossOrigin=""),c.href=n,document.head.appendChild(c),a)return new Promise((u,h)=>{c.addEventListener("load",u),c.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${n}`)))})})).then(()=>e()).catch(n=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=n,window.dispatchEvent(a),!a.defaultPrevented)throw n})},Fu=globalThis.showDirectoryPicker;async function xE(i={}){if(Fu&&!i._preferPolyfill)return Fu(i);const e=document.createElement("input");e.type="file",e.webkitdirectory=!0,e.multiple=!0,e.style.position="fixed",e.style.top="-100000px",e.style.left="-100000px",document.body.appendChild(e);const{makeDirHandleFromFileList:t}=await Ir(()=>import("./util-849946d7.js"),[],import.meta.url);return new Promise((r,s)=>{e.addEventListener("change",()=>{t(e.files).then(r).catch(s),document.body.removeChild(e)}),e.click()})}const Nu=globalThis.showOpenFilePicker;async function AE(i={}){if(Nu&&!i._preferPolyfill)return Nu(i);const e=document.createElement("input");e.type="file",e.multiple=!!i.multiple,e.accept=(i.accepts||[]).map(r=>[...(r.extensions||[]).map(s=>"."+s),...r.mimeTypes||[]]).flat().join(","),e.style.position="fixed",e.style.top="-100000px",e.style.left="-100000px",document.body.appendChild(e);const{makeFileHandlesFromFileList:t}=await Ir(()=>import("./util-849946d7.js"),[],import.meta.url);return new Promise((r,s)=>{e.addEventListener("change",()=>{t(e.files).then(r).catch(s),document.body.removeChild(e)}),e.click()})}const Uu=globalThis.showSaveFilePicker;async function EE(i={}){if(Uu&&!i._preferPolyfill)return Uu(i);const{FileSystemFileHandle:e}=await Ir(()=>Promise.resolve().then(()=>TE),void 0,import.meta.url),{FileHandle:t}=await Ir(()=>import("./downloader-b3d29e83.js"),["./downloader-b3d29e83.js","./util-849946d7.js"],import.meta.url);return new e(new t(i.suggestedName))}const ws=Symbol("adapter");class Mc{constructor(e){this.kind=e.kind,this.name=e.name,this[ws]=e}get isFile(){return this.kind==="file"}get isDirectory(){return this.kind==="directory"}async queryPermission(e={mode:"read"}){const t=this[ws];if(t.queryPermission)return t.queryPermission(e);if(e.mode==="read")return"granted";if(e.mode==="readwrite")return t.writable?"granted":"denied";throw new TypeError(`Mode ${e.mode} must be 'read' or 'readwrite'`)}async requestPermission(e={mode:"read"}){const t=this[ws];if(t.requestPermission)return t.requestPermission(e);if(e.mode==="read")return"granted";if(e.mode==="readwrite")return t.writable?"granted":"denied";throw new TypeError(`Mode ${e.mode} must be 'read' or 'readwrite'`)}async isSameEntry(e){return this===e?!0:this.kind!==e.kind||!e[ws]?!1:await this[ws].isSameEntry(e[ws])}}Object.defineProperty(Mc.prototype,Symbol.toStringTag,{value:"FileSystemHandle",writable:!1,enumerable:!1,configurable:!0});const Ul=Symbol("adapter");class sn extends Mc{constructor(e){super(e),this.kind="file",this[Ul]=e}async createWritable(e={}){const{FileSystemWritableFileStream:t}=await Ir(()=>import("./FileSystemWritableFileStream-e4c13ad9.js"),["./FileSystemWritableFileStream-e4c13ad9.js","./web-streams-ponyfill-4a0f4950.js"],import.meta.url);return new t(await this[Ul].createWritable(e))}async getFile(){return this[Ul].getFile()}}Object.defineProperty(sn.prototype,Symbol.toStringTag,{value:"FileSystemFileHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(sn.prototype,{createWritable:{enumerable:!0},getFile:{enumerable:!0}});const TE=Object.freeze(Object.defineProperty({__proto__:null,FileSystemFileHandle:sn,default:sn},Symbol.toStringTag,{value:"Module"})),_s=Symbol("adapter");class Pr extends Mc{constructor(e){super(e),this.kind="directory",this[_s]=e}async getDirectoryHandle(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");return new Pr(await this[_s].getDirectoryHandle(e,t))}getDirectory(e,t={}){return this.getDirectoryHandle(e,t)}async*entries(){for await(const[e,t]of this[_s].entries())yield[t.name,t.kind==="file"?new sn(t):new Pr(t)]}async*getEntries(){return this.entries()}async*keys(){for await(const[e]of this[_s].entries())yield e}async*values(){for await(const[e,t]of this.entries())yield t}async getFileHandle(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");return t.create=!!t.create,new sn(await this[_s].getFileHandle(e,t))}getFile(e,t={}){return this.getFileHandle(e,t)}async removeEntry(e,t={}){if(e==="")throw new TypeError("Name can't be an empty string.");if(e==="."||e===".."||e.includes("/"))throw new TypeError("Name contains invalid characters.");return t.recursive=!!t.recursive,this[_s].removeEntry(e,t)}async resolve(e){if(await e.isSameEntry(this))return[];const t=[{handle:this,path:[]}];for(;t.length;){let{handle:r,path:s}=t.pop();for await(const n of r.values()){if(await n.isSameEntry(e))return[...s,n.name];n.kind==="directory"&&t.push({handle:n,path:[...s,n.name]})}}return null}[Symbol.asyncIterator](){return this.entries()}}Object.defineProperty(Pr.prototype,Symbol.toStringTag,{value:"FileSystemDirectoryHandle",writable:!1,enumerable:!1,configurable:!0});Object.defineProperties(Pr.prototype,{getDirectoryHandle:{enumerable:!0},entries:{enumerable:!0},getFileHandle:{enumerable:!0},removeEntry:{enumerable:!0}});const qT=Object.freeze(Object.defineProperty({__proto__:null,FileSystemDirectoryHandle:Pr,default:Pr},Symbol.toStringTag,{value:"Module"}));async function Hu(i,e={}){var t,r,s,n;if(!i){if(!(!((t=globalThis.navigator)===null||t===void 0)&&t.storage)&&((r=globalThis.location)===null||r===void 0?void 0:r.protocol)==="http:")throw new Error("Native getDirectory not supported in HTTP context. Please use HTTPS instead or provide an adapter.");if(!(!((n=(s=globalThis.navigator)===null||s===void 0?void 0:s.storage)===null||n===void 0)&&n.getDirectory))throw new Error("Native StorageManager.getDirectory() is not supported in current environment. Please provide an adapter instead.");return globalThis.navigator.storage.getDirectory()}const a=await i,o=typeof a=="function"?await a(e):await a.default(e);return new Pr(o)}var Hl,Gl;const SE={adapter:{cache:!!(globalThis.CacheStorage&&globalThis.caches instanceof CacheStorage),native:typeof((Gl=(Hl=globalThis.navigator)===null||Hl===void 0?void 0:Hl.storage)===null||Gl===void 0?void 0:Gl.getDirectory)=="function",sandbox:typeof window<"u"&&typeof window.webkitRequestFileSystem=="function"}},Gu=i=>typeof i=="object"&&i!=null&&i.nodeType===1,Wu=(i,e)=>(!e||i!=="hidden")&&i!=="visible"&&i!=="clip",Wl=(i,e)=>{if(i.clientHeight{const s=(n=>{if(!n.ownerDocument||!n.ownerDocument.defaultView)return null;try{return n.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!s&&(s.clientHeightne||n>i&&a=e&&o>=t?n-i-r:a>e&&ot?a-e+s:0,CE=i=>{const e=i.parentElement;return e??(i.getRootNode().host||null)},zu=(i,e)=>{var t,r,s,n;if(typeof document>"u")return[];const{scrollMode:a,block:o,inline:l,boundary:c,skipOverflowHiddenElements:u}=e,h=typeof c=="function"?c:C=>C!==c;if(!Gu(i))throw new TypeError("Invalid target");const d=document.scrollingElement||document.documentElement,f=[];let p=i;for(;Gu(p)&&h(p);){if(p=CE(p),p===d){f.push(p);break}p!=null&&p===document.body&&Wl(p)&&!Wl(document.documentElement)||p!=null&&Wl(p,u)&&f.push(p)}const m=(r=(t=window.visualViewport)==null?void 0:t.width)!=null?r:innerWidth,g=(n=(s=window.visualViewport)==null?void 0:s.height)!=null?n:innerHeight,{scrollX:y,scrollY:b}=window,{height:w,width:v,top:E,right:S,bottom:T,left:B}=i.getBoundingClientRect();let k=o==="start"||o==="nearest"?E:o==="end"?T:E+w/2,D=l==="center"?B+v/2:l==="end"?S:B;const W=[];for(let C=0;C=0&&B>=0&&T<=g&&S<=m&&E>=Y&&T<=ne&&B>=V&&S<=z)return W;const $=getComputedStyle(M),O=parseInt($.borderLeftWidth,10),N=parseInt($.borderTopWidth,10),re=parseInt($.borderRightWidth,10),ee=parseInt($.borderBottomWidth,10);let Q=0,ge=0;const Te="offsetWidth"in M?M.offsetWidth-M.clientWidth-O-re:0,me="offsetHeight"in M?M.offsetHeight-M.clientHeight-N-ee:0,be="offsetWidth"in M?M.offsetWidth===0?0:U/M.offsetWidth:0,Se="offsetHeight"in M?M.offsetHeight===0?0:_/M.offsetHeight:0;if(d===M)Q=o==="start"?k:o==="end"?k-g:o==="nearest"?Oa(b,b+g,g,N,ee,b+k,b+k+w,w):k-g/2,ge=l==="start"?D:l==="center"?D-m/2:l==="end"?D-m:Oa(y,y+m,m,O,re,y+D,y+D+v,v),Q=Math.max(0,Q+b),ge=Math.max(0,ge+y);else{Q=o==="start"?k-Y-N:o==="end"?k-ne+ee+me:o==="nearest"?Oa(Y,ne,_,N,ee+me,k,k+w,w):k-(Y+_/2)+me/2,ge=l==="start"?D-V-O:l==="center"?D-(V+U/2)+Te/2:l==="end"?D-z+re+Te:Oa(V,z,U,O,re+Te,D,D+v,v);const{scrollLeft:we,scrollTop:Re}=M;Q=Math.max(0,Math.min(Re+Q/Se,M.scrollHeight-_/Se+me)),ge=Math.max(0,Math.min(we+ge/be,M.scrollWidth-U/be+Te)),k+=Re-Q,D+=we-ge}W.push({el:M,top:Q,left:ge})}return W},ME=i=>i===!1?{block:"end",inline:"nearest"}:(e=>e===Object(e)&&Object.keys(e).length!==0)(i)?i:{block:"start",inline:"nearest"};function Un(i,e){if(!i.isConnected||!(r=>{let s=r;for(;s&&s.parentNode;){if(s.parentNode===document)return!0;s=s.parentNode instanceof ShadowRoot?s.parentNode.host:s.parentNode}return!1})(i))return;if((r=>typeof r=="object"&&typeof r.behavior=="function")(e))return e.behavior(zu(i,e));const t=typeof e=="boolean"||e==null?void 0:e.behavior;for(const{el:r,top:s,left:n}of zu(i,ME(e)))r.scroll({top:s,left:n,behavior:t})}function Fa(i){throw new Error('Could not dynamically require "'+i+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ym={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -1203,8 +1204,8 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(i,e){(function(t){i.exports=t()})(function(){return function t(r,s,n){function a(c,u){if(!s[c]){if(!r[c]){var h=typeof Oa=="function"&&Oa;if(!u&&h)return h(c,!0);if(o)return o(c,!0);var d=new Error("Cannot find module '"+c+"'");throw d.code="MODULE_NOT_FOUND",d}var f=s[c]={exports:{}};r[c][0].call(f.exports,function(p){var m=r[c][1][p];return a(m||p)},f,f.exports,t,r,s,n)}return s[c].exports}for(var o=typeof Oa=="function"&&Oa,l=0;l>2,f=(3&c)<<4|u>>4,p=1<_?(15&u)<<2|h>>6:64,m=2<_?63&h:64,g.push(o.charAt(d)+o.charAt(f)+o.charAt(p)+o.charAt(m));return g.join("")},s.decode=function(l){var c,u,h,d,f,p,m=0,g=0,y="data:";if(l.substr(0,y.length)===y)throw new Error("Invalid base64 input, it looks like a data url.");var b,_=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===o.charAt(64)&&_--,l.charAt(l.length-2)===o.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=a.uint8array?new Uint8Array(0|_):new Array(0|_);m>4,u=(15&d)<<4|(f=o.indexOf(l.charAt(m++)))>>2,h=(3&f)<<6|(p=o.indexOf(l.charAt(m++))),b[g++]=c,f!==64&&(b[g++]=u),p!==64&&(b[g++]=h);return b}},{"./support":30,"./utils":32}],2:[function(t,r,s){var n=t("./external"),a=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(u,h,d,f,p){this.compressedSize=u,this.uncompressedSize=h,this.crc32=d,this.compression=f,this.compressedContent=p}c.prototype={getContentWorker:function(){var u=new a(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),h=this;return u.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new a(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(u,h,d){return u.pipe(new o).pipe(new l("uncompressedSize")).pipe(h.compressWorker(d)).pipe(new l("compressedSize")).withStreamInfo("compression",h)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,s){var n=t("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},s.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,s){var n=t("./utils"),a=function(){for(var o,l=[],c=0;c<256;c++){o=c;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l}();r.exports=function(o,l){return o!==void 0&&o.length?n.getTypeOf(o)!=="string"?function(c,u,h,d){var f=a,p=d+h;c^=-1;for(var m=d;m>>8^f[255&(c^u[m])];return-1^c}(0|l,o,o.length,0):function(c,u,h,d){var f=a,p=d+h;c^=-1;for(var m=d;m>>8^f[255&(c^u.charCodeAt(m))];return-1^c}(0|l,o,o.length,0):0}},{"./utils":32}],5:[function(t,r,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(t,r,s){var n=null;n=typeof Promise<"u"?Promise:t("lie"),r.exports={Promise:n}},{lie:37}],7:[function(t,r,s){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=t("pako"),o=t("./utils"),l=t("./stream/GenericWorker"),c=n?"uint8array":"array";function u(h,d){l.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=d,this.meta={}}s.magic="\b\0",o.inherits(u,l),u.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(c,h.data),!1)},u.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(d){h.push({data:d,meta:h.meta})}},s.compressWorker=function(h){return new u("Deflate",h)},s.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,s){function n(f,p){var m,g="";for(m=0;m>>=8;return g}function a(f,p,m,g,y,b){var _,v,E=f.file,I=f.compression,S=b!==c.utf8encode,R=o.transformTo("string",b(E.name)),P=o.transformTo("string",c.utf8encode(E.name)),L=E.comment,W=o.transformTo("string",b(L)),T=o.transformTo("string",c.utf8encode(L)),C=P.length!==E.name.length,w=T.length!==L.length,G="",$="",z="",ne=E.dir,X=E.date,q={crc32:0,compressedSize:0,uncompressedSize:0};p&&!m||(q.crc32=f.crc32,q.compressedSize=f.compressedSize,q.uncompressedSize=f.uncompressedSize);var F=0;p&&(F|=8),S||!C&&!w||(F|=2048);var N=0,ae=0;ne&&(N|=16),y==="UNIX"?(ae=798,N|=function(Q,ge){var Te=Q;return Q||(Te=ge?16893:33204),(65535&Te)<<16}(E.unixPermissions,ne)):(ae=20,N|=function(Q){return 63&(Q||0)}(E.dosPermissions)),_=X.getUTCHours(),_<<=6,_|=X.getUTCMinutes(),_<<=5,_|=X.getUTCSeconds()/2,v=X.getUTCFullYear()-1980,v<<=4,v|=X.getUTCMonth()+1,v<<=5,v|=X.getUTCDate(),C&&($=n(1,1)+n(u(R),4)+P,G+="up"+n($.length,2)+$),w&&(z=n(1,1)+n(u(W),4)+T,G+="uc"+n(z.length,2)+z);var ee="";return ee+=` -\0`,ee+=n(F,2),ee+=I.magic,ee+=n(_,2),ee+=n(v,2),ee+=n(q.crc32,4),ee+=n(q.compressedSize,4),ee+=n(q.uncompressedSize,4),ee+=n(R.length,2),ee+=n(G.length,2),{fileRecord:h.LOCAL_FILE_HEADER+ee+R+G,dirRecord:h.CENTRAL_FILE_HEADER+n(ae,2)+ee+n(W.length,2)+"\0\0\0\0"+n(N,4)+n(g,4)+R+G+W}}var o=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),u=t("../crc32"),h=t("../signature");function d(f,p,m,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=m,this.encodeFileName=g,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(d,l),d.prototype.push=function(f){var p=f.meta.percent||0,m=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(p+100*(m-g-1))/m:100}}))},d.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var p=this.streamFiles&&!f.file.dir;if(p){var m=a(f,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(f){this.accumulate=!1;var p=this.streamFiles&&!f.file.dir,m=a(f,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),p)this.push({data:function(g){return h.DATA_DESCRIPTOR+n(g.crc32,4)+n(g.compressedSize,4)+n(g.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var f=this.bytesWritten,p=0;p=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=o,c},readString:function(o){return n.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},r.exports=a},{"../utils":32}],19:[function(t,r,s){var n=t("./Uint8ArrayReader");function a(o){n.call(this,o)}t("../utils").inherits(a,n),a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,s){var n=t("./DataReader");function a(o){n.call(this,o)}t("../utils").inherits(a,n),a.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},a.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},a.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(t,r,s){var n=t("./ArrayReader");function a(o){n.call(this,o)}t("../utils").inherits(a,n),a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,s){var n=t("../utils"),a=t("../support"),o=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),u=t("./Uint8ArrayReader");r.exports=function(h){var d=n.getTypeOf(h);return n.checkSupport(d),d!=="string"||a.uint8array?d==="nodebuffer"?new c(h):a.uint8array?new u(n.transformTo("uint8array",h)):new o(n.transformTo("array",h)):new l(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,r,s){var n=t("./GenericWorker"),a=t("../utils");function o(l){n.call(this,"ConvertWorker to "+l),this.destType=l}a.inherits(o,n),o.prototype.processChunk=function(l){this.push({data:a.transformTo(this.destType,l.data),meta:l.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,s){var n=t("./GenericWorker"),a=t("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,n),o.prototype.processChunk=function(l){this.streamInfo.crc32=a(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,s){var n=t("../utils"),a=t("./GenericWorker");function o(l){a.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}n.inherits(o,a),o.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}a.prototype.processChunk.call(this,l)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,s){var n=t("../utils"),a=t("./GenericWorker");function o(l){a.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(u){c.dataIsReady=!0,c.data=u,c.max=u&&u.length||0,c.type=n.getTypeOf(u),c.isPaused||c._tickAndRepeat()},function(u){c.error(u)})}n.inherits(o,a),o.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,s){function n(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,o){return this._listeners[a].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,o){if(this._listeners[a])for(var l=0;l "+a:a}},r.exports=n},{}],29:[function(t,r,s){var n=t("../utils"),a=t("./ConvertWorker"),o=t("./GenericWorker"),l=t("../base64"),c=t("../support"),u=t("../external"),h=null;if(c.nodestream)try{h=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function d(p,m){return new u.Promise(function(g,y){var b=[],_=p._internalType,v=p._outputType,E=p._mimeType;p.on("data",function(I,S){b.push(I),m&&m(S)}).on("error",function(I){b=[],y(I)}).on("end",function(){try{var I=function(S,R,P){switch(S){case"blob":return n.newBlob(n.transformTo("arraybuffer",R),P);case"base64":return l.encode(R);default:return n.transformTo(S,R)}}(v,function(S,R){var P,L=0,W=null,T=0;for(P=0;P"u")s.blob=!1;else{var n=new ArrayBuffer(0);try{s.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(n),s.blob=a.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!t("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(t,r,s){for(var n=t("./utils"),a=t("./support"),o=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;c[254]=c[254]=1;function h(){l.call(this,"utf-8 decode"),this.leftOver=null}function d(){l.call(this,"utf-8 encode")}s.utf8encode=function(f){return a.nodebuffer?o.newBufferFrom(f,"utf-8"):function(p){var m,g,y,b,_,v=p.length,E=0;for(b=0;b>>6:(g<65536?m[_++]=224|g>>>12:(m[_++]=240|g>>>18,m[_++]=128|g>>>12&63),m[_++]=128|g>>>6&63),m[_++]=128|63&g);return m}(f)},s.utf8decode=function(f){return a.nodebuffer?n.transformTo("nodebuffer",f).toString("utf-8"):function(p){var m,g,y,b,_=p.length,v=new Array(2*_);for(m=g=0;m<_;)if((y=p[m++])<128)v[g++]=y;else if(4<(b=c[y]))v[g++]=65533,m+=b-1;else{for(y&=b===2?31:b===3?15:7;1>10&1023,v[g++]=56320|1023&y)}return v.length!==g&&(v.subarray?v=v.subarray(0,g):v.length=g),n.applyFromCharCode(v)}(f=n.transformTo(a.uint8array?"uint8array":"array",f))},n.inherits(h,l),h.prototype.processChunk=function(f){var p=n.transformTo(a.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var m=p;(p=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),p.set(m,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var g=function(b,_){var v;for((_=_||b.length)>b.length&&(_=b.length),v=_-1;0<=v&&(192&b[v])==128;)v--;return v<0||v===0?_:v+c[b[v]]>_?v:_}(p),y=p;g!==p.length&&(a.uint8array?(y=p.subarray(0,g),this.leftOver=p.subarray(g,p.length)):(y=p.slice(0,g),this.leftOver=p.slice(g,p.length))),this.push({data:s.utf8decode(y),meta:f.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=h,n.inherits(d,l),d.prototype.processChunk=function(f){this.push({data:s.utf8encode(f.data),meta:f.meta})},s.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,r,s){var n=t("./support"),a=t("./base64"),o=t("./nodejsUtils"),l=t("./external");function c(m){return m}function u(m,g){for(var y=0;y>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=n(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var p,m,g,y=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4>>6:(f<65536?d[g++]=224|f>>>12:(d[g++]=240|f>>>18,d[g++]=128|f>>>12&63),d[g++]=128|f>>>6&63),d[g++]=128|63&f);return d},s.buf2binstring=function(h){return u(h,h.length)},s.binstring2buf=function(h){for(var d=new n.Buf8(h.length),f=0,p=d.length;f>10&1023,b[p++]=56320|1023&m)}return u(b,p)},s.utf8border=function(h,d){var f;for((d=d||h.length)>h.length&&(d=h.length),f=d-1;0<=f&&(192&h[f])==128;)f--;return f<0||f===0?d:f+l[h[f]]>d?f:d}},{"./common":41}],43:[function(t,r,s){r.exports=function(n,a,o,l){for(var c=65535&n|0,u=n>>>16&65535|0,h=0;o!==0;){for(o-=h=2e3>>1:a>>>1;o[l]=a}return o}();r.exports=function(a,o,l,c){var u=n,h=c+l;a^=-1;for(var d=c;d>>8^u[255&(a^o[d])];return-1^a}},{}],46:[function(t,r,s){var n,a=t("../utils/common"),o=t("./trees"),l=t("./adler32"),c=t("./crc32"),u=t("./messages"),h=0,d=4,f=0,p=-2,m=-1,g=4,y=2,b=8,_=9,v=286,E=30,I=19,S=2*v+1,R=15,P=3,L=258,W=L+P+1,T=42,C=113,w=1,G=2,$=3,z=4;function ne(x,K){return x.msg=u[K],K}function X(x){return(x<<1)-(4x.avail_out&&(j=x.avail_out),j!==0&&(a.arraySet(x.output,K.pending_buf,K.pending_out,j,x.next_out),x.next_out+=j,K.pending_out+=j,x.total_out+=j,x.avail_out-=j,K.pending-=j,K.pending===0&&(K.pending_out=0))}function N(x,K){o._tr_flush_block(x,0<=x.block_start?x.block_start:-1,x.strstart-x.block_start,K),x.block_start=x.strstart,F(x.strm)}function ae(x,K){x.pending_buf[x.pending++]=K}function ee(x,K){x.pending_buf[x.pending++]=K>>>8&255,x.pending_buf[x.pending++]=255&K}function Q(x,K){var j,B,k=x.max_chain_length,U=x.strstart,J=x.prev_length,te=x.nice_match,V=x.strstart>x.w_size-W?x.strstart-(x.w_size-W):0,se=x.window,ue=x.w_mask,oe=x.prev,ye=x.strstart+L,Ve=se[U+J-1],Be=se[U+J];x.prev_length>=x.good_match&&(k>>=2),te>x.lookahead&&(te=x.lookahead);do if(se[(j=K)+J]===Be&&se[j+J-1]===Ve&&se[j]===se[U]&&se[++j]===se[U+1]){U+=2,j++;do;while(se[++U]===se[++j]&&se[++U]===se[++j]&&se[++U]===se[++j]&&se[++U]===se[++j]&&se[++U]===se[++j]&&se[++U]===se[++j]&&se[++U]===se[++j]&&se[++U]===se[++j]&&UV&&--k!=0);return J<=x.lookahead?J:x.lookahead}function ge(x){var K,j,B,k,U,J,te,V,se,ue,oe=x.w_size;do{if(k=x.window_size-x.lookahead-x.strstart,x.strstart>=oe+(oe-W)){for(a.arraySet(x.window,x.window,oe,oe,0),x.match_start-=oe,x.strstart-=oe,x.block_start-=oe,K=j=x.hash_size;B=x.head[--K],x.head[K]=oe<=B?B-oe:0,--j;);for(K=j=oe;B=x.prev[--K],x.prev[K]=oe<=B?B-oe:0,--j;);k+=oe}if(x.strm.avail_in===0)break;if(J=x.strm,te=x.window,V=x.strstart+x.lookahead,se=k,ue=void 0,ue=J.avail_in,se=P)for(U=x.strstart-x.insert,x.ins_h=x.window[U],x.ins_h=(x.ins_h<=P&&(x.ins_h=(x.ins_h<=P)if(B=o._tr_tally(x,x.strstart-x.match_start,x.match_length-P),x.lookahead-=x.match_length,x.match_length<=x.max_lazy_match&&x.lookahead>=P){for(x.match_length--;x.strstart++,x.ins_h=(x.ins_h<=P&&(x.ins_h=(x.ins_h<=P&&x.match_length<=x.prev_length){for(k=x.strstart+x.lookahead-P,B=o._tr_tally(x,x.strstart-1-x.prev_match,x.prev_length-P),x.lookahead-=x.prev_length-1,x.prev_length-=2;++x.strstart<=k&&(x.ins_h=(x.ins_h<x.pending_buf_size-5&&(j=x.pending_buf_size-5);;){if(x.lookahead<=1){if(ge(x),x.lookahead===0&&K===h)return w;if(x.lookahead===0)break}x.strstart+=x.lookahead,x.lookahead=0;var B=x.block_start+j;if((x.strstart===0||x.strstart>=B)&&(x.lookahead=x.strstart-B,x.strstart=B,N(x,!1),x.strm.avail_out===0)||x.strstart-x.block_start>=x.w_size-W&&(N(x,!1),x.strm.avail_out===0))return w}return x.insert=0,K===d?(N(x,!0),x.strm.avail_out===0?$:z):(x.strstart>x.block_start&&(N(x,!1),x.strm.avail_out),w)}),new be(4,4,8,4,Te),new be(4,5,16,8,Te),new be(4,6,32,32,Te),new be(4,4,16,16,me),new be(8,16,32,32,me),new be(8,16,128,128,me),new be(8,32,128,256,me),new be(32,128,258,1024,me),new be(32,258,258,4096,me)],s.deflateInit=function(x,K){return Le(x,K,b,15,8,0)},s.deflateInit2=Le,s.deflateReset=Re,s.deflateResetKeep=we,s.deflateSetHeader=function(x,K){return x&&x.state?x.state.wrap!==2?p:(x.state.gzhead=K,f):p},s.deflate=function(x,K){var j,B,k,U;if(!x||!x.state||5>8&255),ae(B,B.gzhead.time>>16&255),ae(B,B.gzhead.time>>24&255),ae(B,B.level===9?2:2<=B.strategy||B.level<2?4:0),ae(B,255&B.gzhead.os),B.gzhead.extra&&B.gzhead.extra.length&&(ae(B,255&B.gzhead.extra.length),ae(B,B.gzhead.extra.length>>8&255)),B.gzhead.hcrc&&(x.adler=c(x.adler,B.pending_buf,B.pending,0)),B.gzindex=0,B.status=69):(ae(B,0),ae(B,0),ae(B,0),ae(B,0),ae(B,0),ae(B,B.level===9?2:2<=B.strategy||B.level<2?4:0),ae(B,3),B.status=C);else{var J=b+(B.w_bits-8<<4)<<8;J|=(2<=B.strategy||B.level<2?0:B.level<6?1:B.level===6?2:3)<<6,B.strstart!==0&&(J|=32),J+=31-J%31,B.status=C,ee(B,J),B.strstart!==0&&(ee(B,x.adler>>>16),ee(B,65535&x.adler)),x.adler=1}if(B.status===69)if(B.gzhead.extra){for(k=B.pending;B.gzindex<(65535&B.gzhead.extra.length)&&(B.pending!==B.pending_buf_size||(B.gzhead.hcrc&&B.pending>k&&(x.adler=c(x.adler,B.pending_buf,B.pending-k,k)),F(x),k=B.pending,B.pending!==B.pending_buf_size));)ae(B,255&B.gzhead.extra[B.gzindex]),B.gzindex++;B.gzhead.hcrc&&B.pending>k&&(x.adler=c(x.adler,B.pending_buf,B.pending-k,k)),B.gzindex===B.gzhead.extra.length&&(B.gzindex=0,B.status=73)}else B.status=73;if(B.status===73)if(B.gzhead.name){k=B.pending;do{if(B.pending===B.pending_buf_size&&(B.gzhead.hcrc&&B.pending>k&&(x.adler=c(x.adler,B.pending_buf,B.pending-k,k)),F(x),k=B.pending,B.pending===B.pending_buf_size)){U=1;break}U=B.gzindexk&&(x.adler=c(x.adler,B.pending_buf,B.pending-k,k)),U===0&&(B.gzindex=0,B.status=91)}else B.status=91;if(B.status===91)if(B.gzhead.comment){k=B.pending;do{if(B.pending===B.pending_buf_size&&(B.gzhead.hcrc&&B.pending>k&&(x.adler=c(x.adler,B.pending_buf,B.pending-k,k)),F(x),k=B.pending,B.pending===B.pending_buf_size)){U=1;break}U=B.gzindexk&&(x.adler=c(x.adler,B.pending_buf,B.pending-k,k)),U===0&&(B.status=103)}else B.status=103;if(B.status===103&&(B.gzhead.hcrc?(B.pending+2>B.pending_buf_size&&F(x),B.pending+2<=B.pending_buf_size&&(ae(B,255&x.adler),ae(B,x.adler>>8&255),x.adler=0,B.status=C)):B.status=C),B.pending!==0){if(F(x),x.avail_out===0)return B.last_flush=-1,f}else if(x.avail_in===0&&X(K)<=X(j)&&K!==d)return ne(x,-5);if(B.status===666&&x.avail_in!==0)return ne(x,-5);if(x.avail_in!==0||B.lookahead!==0||K!==h&&B.status!==666){var te=B.strategy===2?function(V,se){for(var ue;;){if(V.lookahead===0&&(ge(V),V.lookahead===0)){if(se===h)return w;break}if(V.match_length=0,ue=o._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++,ue&&(N(V,!1),V.strm.avail_out===0))return w}return V.insert=0,se===d?(N(V,!0),V.strm.avail_out===0?$:z):V.last_lit&&(N(V,!1),V.strm.avail_out===0)?w:G}(B,K):B.strategy===3?function(V,se){for(var ue,oe,ye,Ve,Be=V.window;;){if(V.lookahead<=L){if(ge(V),V.lookahead<=L&&se===h)return w;if(V.lookahead===0)break}if(V.match_length=0,V.lookahead>=P&&0V.lookahead&&(V.match_length=V.lookahead)}if(V.match_length>=P?(ue=o._tr_tally(V,1,V.match_length-P),V.lookahead-=V.match_length,V.strstart+=V.match_length,V.match_length=0):(ue=o._tr_tally(V,0,V.window[V.strstart]),V.lookahead--,V.strstart++),ue&&(N(V,!1),V.strm.avail_out===0))return w}return V.insert=0,se===d?(N(V,!0),V.strm.avail_out===0?$:z):V.last_lit&&(N(V,!1),V.strm.avail_out===0)?w:G}(B,K):n[B.level].func(B,K);if(te!==$&&te!==z||(B.status=666),te===w||te===$)return x.avail_out===0&&(B.last_flush=-1),f;if(te===G&&(K===1?o._tr_align(B):K!==5&&(o._tr_stored_block(B,0,0,!1),K===3&&(q(B.head),B.lookahead===0&&(B.strstart=0,B.block_start=0,B.insert=0))),F(x),x.avail_out===0))return B.last_flush=-1,f}return K!==d?f:B.wrap<=0?1:(B.wrap===2?(ae(B,255&x.adler),ae(B,x.adler>>8&255),ae(B,x.adler>>16&255),ae(B,x.adler>>24&255),ae(B,255&x.total_in),ae(B,x.total_in>>8&255),ae(B,x.total_in>>16&255),ae(B,x.total_in>>24&255)):(ee(B,x.adler>>>16),ee(B,65535&x.adler)),F(x),0=j.w_size&&(U===0&&(q(j.head),j.strstart=0,j.block_start=0,j.insert=0),se=new a.Buf8(j.w_size),a.arraySet(se,K,ue-j.w_size,j.w_size,0),K=se,ue=j.w_size),J=x.avail_in,te=x.next_in,V=x.input,x.avail_in=ue,x.next_in=0,x.input=K,ge(j);j.lookahead>=P;){for(B=j.strstart,k=j.lookahead-(P-1);j.ins_h=(j.ins_h<>>=P=R>>>24,_-=P,(P=R>>>16&255)===0)G[u++]=65535&R;else{if(!(16&P)){if(!(64&P)){R=v[(65535&R)+(b&(1<>>=P,_-=P),_<15&&(b+=w[l++]<<_,_+=8,b+=w[l++]<<_,_+=8),R=E[b&S];i:for(;;){if(b>>>=P=R>>>24,_-=P,!(16&(P=R>>>16&255))){if(!(64&P)){R=E[(65535&R)+(b&(1<>>=P,_-=P,(P=u-h)>3,b&=(1<<(_-=L<<3))-1,n.next_in=l,n.next_out=u,n.avail_in=l>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(T){var C;return T&&T.state?(C=T.state,T.total_in=T.total_out=C.total=0,T.msg="",C.wrap&&(T.adler=1&C.wrap),C.mode=p,C.last=0,C.havedict=0,C.dmax=32768,C.head=null,C.hold=0,C.bits=0,C.lencode=C.lendyn=new n.Buf32(m),C.distcode=C.distdyn=new n.Buf32(g),C.sane=1,C.back=-1,d):f}function v(T){var C;return T&&T.state?((C=T.state).wsize=0,C.whave=0,C.wnext=0,_(T)):f}function E(T,C){var w,G;return T&&T.state?(G=T.state,C<0?(w=0,C=-C):(w=1+(C>>4),C<48&&(C&=15)),C&&(C<8||15=z.wsize?(n.arraySet(z.window,C,w-z.wsize,z.wsize,0),z.wnext=0,z.whave=z.wsize):(G<($=z.wsize-z.wnext)&&($=G),n.arraySet(z.window,C,w-G,$,z.wnext),(G-=$)?(n.arraySet(z.window,C,w-G,G,0),z.wnext=G,z.whave=z.wsize):(z.wnext+=$,z.wnext===z.wsize&&(z.wnext=0),z.whave>>8&255,w.check=o(w.check,U,2,0),N=F=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&F)<<8)+(F>>8))%31){T.msg="incorrect header check",w.mode=30;break}if((15&F)!=8){T.msg="unknown compression method",w.mode=30;break}if(N-=4,x=8+(15&(F>>>=4)),w.wbits===0)w.wbits=x;else if(x>w.wbits){T.msg="invalid window size",w.mode=30;break}w.dmax=1<>8&1),512&w.flags&&(U[0]=255&F,U[1]=F>>>8&255,w.check=o(w.check,U,2,0)),N=F=0,w.mode=3;case 3:for(;N<32;){if(X===0)break e;X--,F+=G[z++]<>>8&255,U[2]=F>>>16&255,U[3]=F>>>24&255,w.check=o(w.check,U,4,0)),N=F=0,w.mode=4;case 4:for(;N<16;){if(X===0)break e;X--,F+=G[z++]<>8),512&w.flags&&(U[0]=255&F,U[1]=F>>>8&255,w.check=o(w.check,U,2,0)),N=F=0,w.mode=5;case 5:if(1024&w.flags){for(;N<16;){if(X===0)break e;X--,F+=G[z++]<>>8&255,w.check=o(w.check,U,2,0)),N=F=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&(X<(Q=w.length)&&(Q=X),Q&&(w.head&&(x=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),n.arraySet(w.head.extra,G,z,Q,x)),512&w.flags&&(w.check=o(w.check,G,Q,z)),X-=Q,z+=Q,w.length-=Q),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if(X===0)break e;for(Q=0;x=G[z+Q++],w.head&&x&&w.length<65536&&(w.head.name+=String.fromCharCode(x)),x&&Q>9&1,w.head.done=!0),T.adler=w.check=0,w.mode=12;break;case 10:for(;N<32;){if(X===0)break e;X--,F+=G[z++]<>>=7&N,N-=7&N,w.mode=27;break}for(;N<3;){if(X===0)break e;X--,F+=G[z++]<>>=1)){case 0:w.mode=14;break;case 1:if(L(w),w.mode=20,C!==6)break;F>>>=2,N-=2;break e;case 2:w.mode=17;break;case 3:T.msg="invalid block type",w.mode=30}F>>>=2,N-=2;break;case 14:for(F>>>=7&N,N-=7&N;N<32;){if(X===0)break e;X--,F+=G[z++]<>>16^65535)){T.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&F,N=F=0,w.mode=15,C===6)break e;case 15:w.mode=16;case 16:if(Q=w.length){if(X>>=5,N-=5,w.ndist=1+(31&F),F>>>=5,N-=5,w.ncode=4+(15&F),F>>>=4,N-=4,286>>=3,N-=3}for(;w.have<19;)w.lens[J[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,j={bits:w.lenbits},K=c(0,w.lens,0,19,w.lencode,0,w.work,j),w.lenbits=j.bits,K){T.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have>>16&255,Se=65535&k,!((me=k>>>24)<=N);){if(X===0)break e;X--,F+=G[z++]<>>=me,N-=me,w.lens[w.have++]=Se;else{if(Se===16){for(B=me+2;N>>=me,N-=me,w.have===0){T.msg="invalid bit length repeat",w.mode=30;break}x=w.lens[w.have-1],Q=3+(3&F),F>>>=2,N-=2}else if(Se===17){for(B=me+3;N>>=me)),F>>>=3,N-=3}else{for(B=me+7;N>>=me)),F>>>=7,N-=7}if(w.have+Q>w.nlen+w.ndist){T.msg="invalid bit length repeat",w.mode=30;break}for(;Q--;)w.lens[w.have++]=x}}if(w.mode===30)break;if(w.lens[256]===0){T.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,j={bits:w.lenbits},K=c(u,w.lens,0,w.nlen,w.lencode,0,w.work,j),w.lenbits=j.bits,K){T.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,j={bits:w.distbits},K=c(h,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,j),w.distbits=j.bits,K){T.msg="invalid distances set",w.mode=30;break}if(w.mode=20,C===6)break e;case 20:w.mode=21;case 21:if(6<=X&&258<=q){T.next_out=ne,T.avail_out=q,T.next_in=z,T.avail_in=X,w.hold=F,w.bits=N,l(T,ee),ne=T.next_out,$=T.output,q=T.avail_out,z=T.next_in,G=T.input,X=T.avail_in,F=w.hold,N=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;be=(k=w.lencode[F&(1<>>16&255,Se=65535&k,!((me=k>>>24)<=N);){if(X===0)break e;X--,F+=G[z++]<>we)])>>>16&255,Se=65535&k,!(we+(me=k>>>24)<=N);){if(X===0)break e;X--,F+=G[z++]<>>=we,N-=we,w.back+=we}if(F>>>=me,N-=me,w.back+=me,w.length=Se,be===0){w.mode=26;break}if(32&be){w.back=-1,w.mode=12;break}if(64&be){T.msg="invalid literal/length code",w.mode=30;break}w.extra=15&be,w.mode=22;case 22:if(w.extra){for(B=w.extra;N>>=w.extra,N-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;be=(k=w.distcode[F&(1<>>16&255,Se=65535&k,!((me=k>>>24)<=N);){if(X===0)break e;X--,F+=G[z++]<>we)])>>>16&255,Se=65535&k,!(we+(me=k>>>24)<=N);){if(X===0)break e;X--,F+=G[z++]<>>=we,N-=we,w.back+=we}if(F>>>=me,N-=me,w.back+=me,64&be){T.msg="invalid distance code",w.mode=30;break}w.offset=Se,w.extra=15&be,w.mode=24;case 24:if(w.extra){for(B=w.extra;N>>=w.extra,N-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){T.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(q===0)break e;if(Q=ee-q,w.offset>Q){if((Q=w.offset-Q)>w.whave&&w.sane){T.msg="invalid distance too far back",w.mode=30;break}ge=Q>w.wnext?(Q-=w.wnext,w.wsize-Q):w.wnext-Q,Q>w.length&&(Q=w.length),Te=w.window}else Te=$,ge=ne-w.offset,Q=w.length;for(qS?(P=ge[Te+g[C]],N[ae+g[C]]):(P=96,0),b=1<>ne)+(_-=b)]=R<<24|P<<16|L|0,_!==0;);for(b=1<>=1;if(b!==0?(F&=b-1,F+=b):F=0,C++,--ee[T]==0){if(T===G)break;T=h[d+g[C]]}if($>>7)]}function ae(k,U){k.pending_buf[k.pending++]=255&U,k.pending_buf[k.pending++]=U>>>8&255}function ee(k,U,J){k.bi_valid>y-J?(k.bi_buf|=U<>y-k.bi_valid,k.bi_valid+=J-y):(k.bi_buf|=U<>>=1,J<<=1,0<--U;);return J>>>1}function Te(k,U,J){var te,V,se=new Array(g+1),ue=0;for(te=1;te<=g;te++)se[te]=ue=ue+J[te-1]<<1;for(V=0;V<=U;V++){var oe=k[2*V+1];oe!==0&&(k[2*V]=ge(se[oe]++,oe))}}function me(k){var U;for(U=0;U>1;1<=J;J--)we(k,se,J);for(V=ye;J=k.heap[1],k.heap[1]=k.heap[k.heap_len--],we(k,se,1),te=k.heap[1],k.heap[--k.heap_max]=J,k.heap[--k.heap_max]=te,se[2*V]=se[2*J]+se[2*te],k.depth[V]=(k.depth[J]>=k.depth[te]?k.depth[J]:k.depth[te])+1,se[2*J+1]=se[2*te+1]=V,k.heap[1]=V++,we(k,se,1),2<=k.heap_len;);k.heap[--k.heap_max]=k.heap[1],function(Be,Tt){var It,Lt,M,O,D,H,Y=Tt.dyn_tree,le=Tt.max_code,he=Tt.stat_desc.static_tree,Ce=Tt.stat_desc.has_stree,ke=Tt.stat_desc.extra_bits,Xe=Tt.stat_desc.extra_base,Ye=Tt.stat_desc.max_length,Qe=0;for(O=0;O<=g;O++)Be.bl_count[O]=0;for(Y[2*Be.heap[Be.heap_max]+1]=0,It=Be.heap_max+1;It>=7;V>>=1)if(1&Ve&&oe.dyn_ltree[2*ye]!==0)return a;if(oe.dyn_ltree[18]!==0||oe.dyn_ltree[20]!==0||oe.dyn_ltree[26]!==0)return o;for(ye=32;ye>>3,(se=k.static_len+3+7>>>3)<=V&&(V=se)):V=se=J+5,J+4<=V&&U!==-1?B(k,U,J,te):k.strategy===4||se===V?(ee(k,2+(te?1:0),3),Re(k,W,T)):(ee(k,4+(te?1:0),3),function(oe,ye,Ve,Be){var Tt;for(ee(oe,ye-257,5),ee(oe,Ve-1,5),ee(oe,Be-4,4),Tt=0;Tt>>8&255,k.pending_buf[k.d_buf+2*k.last_lit+1]=255&U,k.pending_buf[k.l_buf+k.last_lit]=255&J,k.last_lit++,U===0?k.dyn_ltree[2*J]++:(k.matches++,U--,k.dyn_ltree[2*(w[J]+h+1)]++,k.dyn_dtree[2*N(U)]++),k.last_lit===k.lit_bufsize-1},s._tr_align=function(k){ee(k,2,3),Q(k,_,W),function(U){U.bi_valid===16?(ae(U,U.bi_buf),U.bi_buf=0,U.bi_valid=0):8<=U.bi_valid&&(U.pending_buf[U.pending++]=255&U.bi_buf,U.bi_buf>>=8,U.bi_valid-=8)}(k)}},{"../utils/common":41}],53:[function(t,r,s){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,r,s){(function(n){(function(a,o){if(!a.setImmediate){var l,c,u,h,d=1,f={},p=!1,m=a.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(a);g=g&&g.setTimeout?g:a,l={}.toString.call(a.process)==="[object process]"?function(v){process.nextTick(function(){b(v)})}:function(){if(a.postMessage&&!a.importScripts){var v=!0,E=a.onmessage;return a.onmessage=function(){v=!1},a.postMessage("","*"),a.onmessage=E,v}}()?(h="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",_,!1):a.attachEvent("onmessage",_),function(v){a.postMessage(h+v,"*")}):a.MessageChannel?((u=new MessageChannel).port1.onmessage=function(v){b(v.data)},function(v){u.port2.postMessage(v)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(v){var E=m.createElement("script");E.onreadystatechange=function(){b(v),E.onreadystatechange=null,c.removeChild(E),E=null},c.appendChild(E)}):function(v){setTimeout(b,0,v)},g.setImmediate=function(v){typeof v!="function"&&(v=new Function(""+v));for(var E=new Array(arguments.length-1),I=0;I"u"?n===void 0?this:n:self)}).call(this,typeof ii<"u"?ii:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(vm);var IE=vm.exports;const PE=$n(IE);function pr(i,e){let t=kc(i)[2];return e&&t.slice(-1*e.length)===e&&(t=t.slice(0,t.length-e.length)),t}function Zt(i){const e=kc(i),t=e[0];let r=e[1];return!t&&!r?"":(r&&(r=r.slice(0,r.length-1)),t+r)}function Ni(i){return kc(i)[3]}const BE=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/;function kc(i){return BE.exec(i).slice(1)}class RE{static _worker;static workID=0;static map=new Map;static _init(){const e=` +*/(function(i,e){(function(t){i.exports=t()})(function(){return function t(r,s,n){function a(c,u){if(!s[c]){if(!r[c]){var h=typeof Fa=="function"&&Fa;if(!u&&h)return h(c,!0);if(o)return o(c,!0);var d=new Error("Cannot find module '"+c+"'");throw d.code="MODULE_NOT_FOUND",d}var f=s[c]={exports:{}};r[c][0].call(f.exports,function(p){var m=r[c][1][p];return a(m||p)},f,f.exports,t,r,s,n)}return s[c].exports}for(var o=typeof Fa=="function"&&Fa,l=0;l>2,f=(3&c)<<4|u>>4,p=1>6:64,m=2>4,u=(15&d)<<4|(f=o.indexOf(l.charAt(m++)))>>2,h=(3&f)<<6|(p=o.indexOf(l.charAt(m++))),b[g++]=c,f!==64&&(b[g++]=u),p!==64&&(b[g++]=h);return b}},{"./support":30,"./utils":32}],2:[function(t,r,s){var n=t("./external"),a=t("./stream/DataWorker"),o=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(u,h,d,f,p){this.compressedSize=u,this.uncompressedSize=h,this.crc32=d,this.compression=f,this.compressedContent=p}c.prototype={getContentWorker:function(){var u=new a(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),h=this;return u.on("end",function(){if(this.streamInfo.data_length!==h.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),u},getCompressedWorker:function(){return new a(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(u,h,d){return u.pipe(new o).pipe(new l("uncompressedSize")).pipe(h.compressWorker(d)).pipe(new l("compressedSize")).withStreamInfo("compression",h)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,s){var n=t("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},s.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,s){var n=t("./utils"),a=function(){for(var o,l=[],c=0;c<256;c++){o=c;for(var u=0;u<8;u++)o=1&o?3988292384^o>>>1:o>>>1;l[c]=o}return l}();r.exports=function(o,l){return o!==void 0&&o.length?n.getTypeOf(o)!=="string"?function(c,u,h,d){var f=a,p=d+h;c^=-1;for(var m=d;m>>8^f[255&(c^u[m])];return-1^c}(0|l,o,o.length,0):function(c,u,h,d){var f=a,p=d+h;c^=-1;for(var m=d;m>>8^f[255&(c^u.charCodeAt(m))];return-1^c}(0|l,o,o.length,0):0}},{"./utils":32}],5:[function(t,r,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(t,r,s){var n=null;n=typeof Promise<"u"?Promise:t("lie"),r.exports={Promise:n}},{lie:37}],7:[function(t,r,s){var n=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",a=t("pako"),o=t("./utils"),l=t("./stream/GenericWorker"),c=n?"uint8array":"array";function u(h,d){l.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=d,this.meta={}}s.magic="\b\0",o.inherits(u,l),u.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(o.transformTo(c,h.data),!1)},u.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},u.prototype._createPako=function(){this._pako=new a[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var h=this;this._pako.onData=function(d){h.push({data:d,meta:h.meta})}},s.compressWorker=function(h){return new u("Deflate",h)},s.uncompressWorker=function(){return new u("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,s){function n(f,p){var m,g="";for(m=0;m>>=8;return g}function a(f,p,m,g,y,b){var w,v,E=f.file,S=f.compression,T=b!==c.utf8encode,B=o.transformTo("string",b(E.name)),k=o.transformTo("string",c.utf8encode(E.name)),D=E.comment,W=o.transformTo("string",b(D)),C=o.transformTo("string",c.utf8encode(D)),M=k.length!==E.name.length,_=C.length!==D.length,U="",Y="",z="",ne=E.dir,V=E.date,$={crc32:0,compressedSize:0,uncompressedSize:0};p&&!m||($.crc32=f.crc32,$.compressedSize=f.compressedSize,$.uncompressedSize=f.uncompressedSize);var O=0;p&&(O|=8),T||!M&&!_||(O|=2048);var N=0,re=0;ne&&(N|=16),y==="UNIX"?(re=798,N|=function(Q,ge){var Te=Q;return Q||(Te=ge?16893:33204),(65535&Te)<<16}(E.unixPermissions,ne)):(re=20,N|=function(Q){return 63&(Q||0)}(E.dosPermissions)),w=V.getUTCHours(),w<<=6,w|=V.getUTCMinutes(),w<<=5,w|=V.getUTCSeconds()/2,v=V.getUTCFullYear()-1980,v<<=4,v|=V.getUTCMonth()+1,v<<=5,v|=V.getUTCDate(),M&&(Y=n(1,1)+n(u(B),4)+k,U+="up"+n(Y.length,2)+Y),_&&(z=n(1,1)+n(u(W),4)+C,U+="uc"+n(z.length,2)+z);var ee="";return ee+=` +\0`,ee+=n(O,2),ee+=S.magic,ee+=n(w,2),ee+=n(v,2),ee+=n($.crc32,4),ee+=n($.compressedSize,4),ee+=n($.uncompressedSize,4),ee+=n(B.length,2),ee+=n(U.length,2),{fileRecord:h.LOCAL_FILE_HEADER+ee+B+U,dirRecord:h.CENTRAL_FILE_HEADER+n(re,2)+ee+n(W.length,2)+"\0\0\0\0"+n(N,4)+n(g,4)+B+U+W}}var o=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),u=t("../crc32"),h=t("../signature");function d(f,p,m,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=m,this.encodeFileName=g,this.streamFiles=f,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}o.inherits(d,l),d.prototype.push=function(f){var p=f.meta.percent||0,m=this.entriesCount,g=this._sources.length;this.accumulate?this.contentBuffer.push(f):(this.bytesWritten+=f.data.length,l.prototype.push.call(this,{data:f.data,meta:{currentFile:this.currentFile,percent:m?(p+100*(m-g-1))/m:100}}))},d.prototype.openedSource=function(f){this.currentSourceOffset=this.bytesWritten,this.currentFile=f.file.name;var p=this.streamFiles&&!f.file.dir;if(p){var m=a(f,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},d.prototype.closedSource=function(f){this.accumulate=!1;var p=this.streamFiles&&!f.file.dir,m=a(f,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),p)this.push({data:function(g){return h.DATA_DESCRIPTOR+n(g.crc32,4)+n(g.compressedSize,4)+n(g.uncompressedSize,4)}(f),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},d.prototype.flush=function(){for(var f=this.bytesWritten,p=0;p=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=o,c},readString:function(o){return n.transformTo("string",this.readData(o))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var o=this.readInt(4);return new Date(Date.UTC(1980+(o>>25&127),(o>>21&15)-1,o>>16&31,o>>11&31,o>>5&63,(31&o)<<1))}},r.exports=a},{"../utils":32}],19:[function(t,r,s){var n=t("./Uint8ArrayReader");function a(o){n.call(this,o)}t("../utils").inherits(a,n),a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,s){var n=t("./DataReader");function a(o){n.call(this,o)}t("../utils").inherits(a,n),a.prototype.byteAt=function(o){return this.data.charCodeAt(this.zero+o)},a.prototype.lastIndexOfSignature=function(o){return this.data.lastIndexOf(o)-this.zero},a.prototype.readAndCheckSignature=function(o){return o===this.readData(4)},a.prototype.readData=function(o){this.checkOffset(o);var l=this.data.slice(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./DataReader":18}],21:[function(t,r,s){var n=t("./ArrayReader");function a(o){n.call(this,o)}t("../utils").inherits(a,n),a.prototype.readData=function(o){if(this.checkOffset(o),o===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+o);return this.index+=o,l},r.exports=a},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,s){var n=t("../utils"),a=t("../support"),o=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),u=t("./Uint8ArrayReader");r.exports=function(h){var d=n.getTypeOf(h);return n.checkSupport(d),d!=="string"||a.uint8array?d==="nodebuffer"?new c(h):a.uint8array?new u(n.transformTo("uint8array",h)):new o(n.transformTo("array",h)):new l(h)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,r,s){var n=t("./GenericWorker"),a=t("../utils");function o(l){n.call(this,"ConvertWorker to "+l),this.destType=l}a.inherits(o,n),o.prototype.processChunk=function(l){this.push({data:a.transformTo(this.destType,l.data),meta:l.meta})},r.exports=o},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,s){var n=t("./GenericWorker"),a=t("../crc32");function o(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(o,n),o.prototype.processChunk=function(l){this.streamInfo.crc32=a(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=o},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,s){var n=t("../utils"),a=t("./GenericWorker");function o(l){a.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}n.inherits(o,a),o.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}a.prototype.processChunk.call(this,l)},r.exports=o},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,s){var n=t("../utils"),a=t("./GenericWorker");function o(l){a.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(u){c.dataIsReady=!0,c.data=u,c.max=u&&u.length||0,c.type=n.getTypeOf(u),c.isPaused||c._tickAndRepeat()},function(u){c.error(u)})}n.inherits(o,a),o.prototype.cleanUp=function(){a.prototype.cleanUp.call(this),this.data=null},o.prototype.resume=function(){return!!a.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},o.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},o.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=o},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,s){function n(a){this.name=a||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}n.prototype={push:function(a){this.emit("data",a)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(a){this.emit("error",a)}return!0},error:function(a){return!this.isFinished&&(this.isPaused?this.generatedError=a:(this.isFinished=!0,this.emit("error",a),this.previous&&this.previous.error(a),this.cleanUp()),!0)},on:function(a,o){return this._listeners[a].push(o),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(a,o){if(this._listeners[a])for(var l=0;l "+a:a}},r.exports=n},{}],29:[function(t,r,s){var n=t("../utils"),a=t("./ConvertWorker"),o=t("./GenericWorker"),l=t("../base64"),c=t("../support"),u=t("../external"),h=null;if(c.nodestream)try{h=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function d(p,m){return new u.Promise(function(g,y){var b=[],w=p._internalType,v=p._outputType,E=p._mimeType;p.on("data",function(S,T){b.push(S),m&&m(T)}).on("error",function(S){b=[],y(S)}).on("end",function(){try{var S=function(T,B,k){switch(T){case"blob":return n.newBlob(n.transformTo("arraybuffer",B),k);case"base64":return l.encode(B);default:return n.transformTo(T,B)}}(v,function(T,B){var k,D=0,W=null,C=0;for(k=0;k"u")s.blob=!1;else{var n=new ArrayBuffer(0);try{s.blob=new Blob([n],{type:"application/zip"}).size===0}catch{try{var a=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);a.append(n),s.blob=a.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!t("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(t,r,s){for(var n=t("./utils"),a=t("./support"),o=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),u=0;u<256;u++)c[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;c[254]=c[254]=1;function h(){l.call(this,"utf-8 decode"),this.leftOver=null}function d(){l.call(this,"utf-8 encode")}s.utf8encode=function(f){return a.nodebuffer?o.newBufferFrom(f,"utf-8"):function(p){var m,g,y,b,w,v=p.length,E=0;for(b=0;b>>6:(g<65536?m[w++]=224|g>>>12:(m[w++]=240|g>>>18,m[w++]=128|g>>>12&63),m[w++]=128|g>>>6&63),m[w++]=128|63&g);return m}(f)},s.utf8decode=function(f){return a.nodebuffer?n.transformTo("nodebuffer",f).toString("utf-8"):function(p){var m,g,y,b,w=p.length,v=new Array(2*w);for(m=g=0;m>10&1023,v[g++]=56320|1023&y)}return v.length!==g&&(v.subarray?v=v.subarray(0,g):v.length=g),n.applyFromCharCode(v)}(f=n.transformTo(a.uint8array?"uint8array":"array",f))},n.inherits(h,l),h.prototype.processChunk=function(f){var p=n.transformTo(a.uint8array?"uint8array":"array",f.data);if(this.leftOver&&this.leftOver.length){if(a.uint8array){var m=p;(p=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),p.set(m,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var g=function(b,w){var v;for((w=w||b.length)>b.length&&(w=b.length),v=w-1;0<=v&&(192&b[v])==128;)v--;return v<0||v===0?w:v+c[b[v]]>w?v:w}(p),y=p;g!==p.length&&(a.uint8array?(y=p.subarray(0,g),this.leftOver=p.subarray(g,p.length)):(y=p.slice(0,g),this.leftOver=p.slice(g,p.length))),this.push({data:s.utf8decode(y),meta:f.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=h,n.inherits(d,l),d.prototype.processChunk=function(f){this.push({data:s.utf8encode(f.data),meta:f.meta})},s.Utf8EncodeWorker=d},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,r,s){var n=t("./support"),a=t("./base64"),o=t("./nodejsUtils"),l=t("./external");function c(m){return m}function u(m,g){for(var y=0;y>8;this.dir=!!(16&this.externalFileAttributes),f==0&&(this.dosPermissions=63&this.externalFileAttributes),f==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var f=n(this.extraFields[1].value);this.uncompressedSize===a.MAX_VALUE_32BITS&&(this.uncompressedSize=f.readInt(8)),this.compressedSize===a.MAX_VALUE_32BITS&&(this.compressedSize=f.readInt(8)),this.localHeaderOffset===a.MAX_VALUE_32BITS&&(this.localHeaderOffset=f.readInt(8)),this.diskNumberStart===a.MAX_VALUE_32BITS&&(this.diskNumberStart=f.readInt(4))}},readExtraFields:function(f){var p,m,g,y=f.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});f.index+4>>6:(f<65536?d[g++]=224|f>>>12:(d[g++]=240|f>>>18,d[g++]=128|f>>>12&63),d[g++]=128|f>>>6&63),d[g++]=128|63&f);return d},s.buf2binstring=function(h){return u(h,h.length)},s.binstring2buf=function(h){for(var d=new n.Buf8(h.length),f=0,p=d.length;f>10&1023,b[p++]=56320|1023&m)}return u(b,p)},s.utf8border=function(h,d){var f;for((d=d||h.length)>h.length&&(d=h.length),f=d-1;0<=f&&(192&h[f])==128;)f--;return f<0||f===0?d:f+l[h[f]]>d?f:d}},{"./common":41}],43:[function(t,r,s){r.exports=function(n,a,o,l){for(var c=65535&n|0,u=n>>>16&65535|0,h=0;o!==0;){for(o-=h=2e3>>1:a>>>1;o[l]=a}return o}();r.exports=function(a,o,l,c){var u=n,h=c+l;a^=-1;for(var d=c;d>>8^u[255&(a^o[d])];return-1^a}},{}],46:[function(t,r,s){var n,a=t("../utils/common"),o=t("./trees"),l=t("./adler32"),c=t("./crc32"),u=t("./messages"),h=0,d=4,f=0,p=-2,m=-1,g=4,y=2,b=8,w=9,v=286,E=30,S=19,T=2*v+1,B=15,k=3,D=258,W=D+k+1,C=42,M=113,_=1,U=2,Y=3,z=4;function ne(x,K){return x.msg=u[K],K}function V(x){return(x<<1)-(4x.avail_out&&(X=x.avail_out),X!==0&&(a.arraySet(x.output,K.pending_buf,K.pending_out,X,x.next_out),x.next_out+=X,K.pending_out+=X,x.total_out+=X,x.avail_out-=X,K.pending-=X,K.pending===0&&(K.pending_out=0))}function N(x,K){o._tr_flush_block(x,0<=x.block_start?x.block_start:-1,x.strstart-x.block_start,K),x.block_start=x.strstart,O(x.strm)}function re(x,K){x.pending_buf[x.pending++]=K}function ee(x,K){x.pending_buf[x.pending++]=K>>>8&255,x.pending_buf[x.pending++]=255&K}function Q(x,K){var X,R,P=x.max_chain_length,H=x.strstart,J=x.prev_length,te=x.nice_match,j=x.strstart>x.w_size-W?x.strstart-(x.w_size-W):0,ae=x.window,ue=x.w_mask,oe=x.prev,ye=x.strstart+D,Ve=ae[H+J-1],Pe=ae[H+J];x.prev_length>=x.good_match&&(P>>=2),te>x.lookahead&&(te=x.lookahead);do if(ae[(X=K)+J]===Pe&&ae[X+J-1]===Ve&&ae[X]===ae[H]&&ae[++X]===ae[H+1]){H+=2,X++;do;while(ae[++H]===ae[++X]&&ae[++H]===ae[++X]&&ae[++H]===ae[++X]&&ae[++H]===ae[++X]&&ae[++H]===ae[++X]&&ae[++H]===ae[++X]&&ae[++H]===ae[++X]&&ae[++H]===ae[++X]&&Hj&&--P!=0);return J<=x.lookahead?J:x.lookahead}function ge(x){var K,X,R,P,H,J,te,j,ae,ue,oe=x.w_size;do{if(P=x.window_size-x.lookahead-x.strstart,x.strstart>=oe+(oe-W)){for(a.arraySet(x.window,x.window,oe,oe,0),x.match_start-=oe,x.strstart-=oe,x.block_start-=oe,K=X=x.hash_size;R=x.head[--K],x.head[K]=oe<=R?R-oe:0,--X;);for(K=X=oe;R=x.prev[--K],x.prev[K]=oe<=R?R-oe:0,--X;);P+=oe}if(x.strm.avail_in===0)break;if(J=x.strm,te=x.window,j=x.strstart+x.lookahead,ae=P,ue=void 0,ue=J.avail_in,ae=k)for(H=x.strstart-x.insert,x.ins_h=x.window[H],x.ins_h=(x.ins_h<=k&&(x.ins_h=(x.ins_h<=k)if(R=o._tr_tally(x,x.strstart-x.match_start,x.match_length-k),x.lookahead-=x.match_length,x.match_length<=x.max_lazy_match&&x.lookahead>=k){for(x.match_length--;x.strstart++,x.ins_h=(x.ins_h<=k&&(x.ins_h=(x.ins_h<=k&&x.match_length<=x.prev_length){for(P=x.strstart+x.lookahead-k,R=o._tr_tally(x,x.strstart-1-x.prev_match,x.prev_length-k),x.lookahead-=x.prev_length-1,x.prev_length-=2;++x.strstart<=P&&(x.ins_h=(x.ins_h<x.pending_buf_size-5&&(X=x.pending_buf_size-5);;){if(x.lookahead<=1){if(ge(x),x.lookahead===0&&K===h)return _;if(x.lookahead===0)break}x.strstart+=x.lookahead,x.lookahead=0;var R=x.block_start+X;if((x.strstart===0||x.strstart>=R)&&(x.lookahead=x.strstart-R,x.strstart=R,N(x,!1),x.strm.avail_out===0)||x.strstart-x.block_start>=x.w_size-W&&(N(x,!1),x.strm.avail_out===0))return _}return x.insert=0,K===d?(N(x,!0),x.strm.avail_out===0?Y:z):(x.strstart>x.block_start&&(N(x,!1),x.strm.avail_out),_)}),new be(4,4,8,4,Te),new be(4,5,16,8,Te),new be(4,6,32,32,Te),new be(4,4,16,16,me),new be(8,16,32,32,me),new be(8,16,128,128,me),new be(8,32,128,256,me),new be(32,128,258,1024,me),new be(32,258,258,4096,me)],s.deflateInit=function(x,K){return Le(x,K,b,15,8,0)},s.deflateInit2=Le,s.deflateReset=Re,s.deflateResetKeep=we,s.deflateSetHeader=function(x,K){return x&&x.state?x.state.wrap!==2?p:(x.state.gzhead=K,f):p},s.deflate=function(x,K){var X,R,P,H;if(!x||!x.state||5>8&255),re(R,R.gzhead.time>>16&255),re(R,R.gzhead.time>>24&255),re(R,R.level===9?2:2<=R.strategy||R.level<2?4:0),re(R,255&R.gzhead.os),R.gzhead.extra&&R.gzhead.extra.length&&(re(R,255&R.gzhead.extra.length),re(R,R.gzhead.extra.length>>8&255)),R.gzhead.hcrc&&(x.adler=c(x.adler,R.pending_buf,R.pending,0)),R.gzindex=0,R.status=69):(re(R,0),re(R,0),re(R,0),re(R,0),re(R,0),re(R,R.level===9?2:2<=R.strategy||R.level<2?4:0),re(R,3),R.status=M);else{var J=b+(R.w_bits-8<<4)<<8;J|=(2<=R.strategy||R.level<2?0:R.level<6?1:R.level===6?2:3)<<6,R.strstart!==0&&(J|=32),J+=31-J%31,R.status=M,ee(R,J),R.strstart!==0&&(ee(R,x.adler>>>16),ee(R,65535&x.adler)),x.adler=1}if(R.status===69)if(R.gzhead.extra){for(P=R.pending;R.gzindex<(65535&R.gzhead.extra.length)&&(R.pending!==R.pending_buf_size||(R.gzhead.hcrc&&R.pending>P&&(x.adler=c(x.adler,R.pending_buf,R.pending-P,P)),O(x),P=R.pending,R.pending!==R.pending_buf_size));)re(R,255&R.gzhead.extra[R.gzindex]),R.gzindex++;R.gzhead.hcrc&&R.pending>P&&(x.adler=c(x.adler,R.pending_buf,R.pending-P,P)),R.gzindex===R.gzhead.extra.length&&(R.gzindex=0,R.status=73)}else R.status=73;if(R.status===73)if(R.gzhead.name){P=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>P&&(x.adler=c(x.adler,R.pending_buf,R.pending-P,P)),O(x),P=R.pending,R.pending===R.pending_buf_size)){H=1;break}H=R.gzindexP&&(x.adler=c(x.adler,R.pending_buf,R.pending-P,P)),H===0&&(R.gzindex=0,R.status=91)}else R.status=91;if(R.status===91)if(R.gzhead.comment){P=R.pending;do{if(R.pending===R.pending_buf_size&&(R.gzhead.hcrc&&R.pending>P&&(x.adler=c(x.adler,R.pending_buf,R.pending-P,P)),O(x),P=R.pending,R.pending===R.pending_buf_size)){H=1;break}H=R.gzindexP&&(x.adler=c(x.adler,R.pending_buf,R.pending-P,P)),H===0&&(R.status=103)}else R.status=103;if(R.status===103&&(R.gzhead.hcrc?(R.pending+2>R.pending_buf_size&&O(x),R.pending+2<=R.pending_buf_size&&(re(R,255&x.adler),re(R,x.adler>>8&255),x.adler=0,R.status=M)):R.status=M),R.pending!==0){if(O(x),x.avail_out===0)return R.last_flush=-1,f}else if(x.avail_in===0&&V(K)<=V(X)&&K!==d)return ne(x,-5);if(R.status===666&&x.avail_in!==0)return ne(x,-5);if(x.avail_in!==0||R.lookahead!==0||K!==h&&R.status!==666){var te=R.strategy===2?function(j,ae){for(var ue;;){if(j.lookahead===0&&(ge(j),j.lookahead===0)){if(ae===h)return _;break}if(j.match_length=0,ue=o._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++,ue&&(N(j,!1),j.strm.avail_out===0))return _}return j.insert=0,ae===d?(N(j,!0),j.strm.avail_out===0?Y:z):j.last_lit&&(N(j,!1),j.strm.avail_out===0)?_:U}(R,K):R.strategy===3?function(j,ae){for(var ue,oe,ye,Ve,Pe=j.window;;){if(j.lookahead<=D){if(ge(j),j.lookahead<=D&&ae===h)return _;if(j.lookahead===0)break}if(j.match_length=0,j.lookahead>=k&&0j.lookahead&&(j.match_length=j.lookahead)}if(j.match_length>=k?(ue=o._tr_tally(j,1,j.match_length-k),j.lookahead-=j.match_length,j.strstart+=j.match_length,j.match_length=0):(ue=o._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++),ue&&(N(j,!1),j.strm.avail_out===0))return _}return j.insert=0,ae===d?(N(j,!0),j.strm.avail_out===0?Y:z):j.last_lit&&(N(j,!1),j.strm.avail_out===0)?_:U}(R,K):n[R.level].func(R,K);if(te!==Y&&te!==z||(R.status=666),te===_||te===Y)return x.avail_out===0&&(R.last_flush=-1),f;if(te===U&&(K===1?o._tr_align(R):K!==5&&(o._tr_stored_block(R,0,0,!1),K===3&&($(R.head),R.lookahead===0&&(R.strstart=0,R.block_start=0,R.insert=0))),O(x),x.avail_out===0))return R.last_flush=-1,f}return K!==d?f:R.wrap<=0?1:(R.wrap===2?(re(R,255&x.adler),re(R,x.adler>>8&255),re(R,x.adler>>16&255),re(R,x.adler>>24&255),re(R,255&x.total_in),re(R,x.total_in>>8&255),re(R,x.total_in>>16&255),re(R,x.total_in>>24&255)):(ee(R,x.adler>>>16),ee(R,65535&x.adler)),O(x),0=X.w_size&&(H===0&&($(X.head),X.strstart=0,X.block_start=0,X.insert=0),ae=new a.Buf8(X.w_size),a.arraySet(ae,K,ue-X.w_size,X.w_size,0),K=ae,ue=X.w_size),J=x.avail_in,te=x.next_in,j=x.input,x.avail_in=ue,x.next_in=0,x.input=K,ge(X);X.lookahead>=k;){for(R=X.strstart,P=X.lookahead-(k-1);X.ins_h=(X.ins_h<>>=k=B>>>24,w-=k,(k=B>>>16&255)===0)U[u++]=65535&B;else{if(!(16&k)){if(!(64&k)){B=v[(65535&B)+(b&(1<>>=k,w-=k),w<15&&(b+=_[l++]<>>=k=B>>>24,w-=k,!(16&(k=B>>>16&255))){if(!(64&k)){B=E[(65535&B)+(b&(1<>>=k,w-=k,(k=u-h)>3,b&=(1<<(w-=D<<3))-1,n.next_in=l,n.next_out=u,n.avail_in=l>>24&255)+(C>>>8&65280)+((65280&C)<<8)+((255&C)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(C){var M;return C&&C.state?(M=C.state,C.total_in=C.total_out=M.total=0,C.msg="",M.wrap&&(C.adler=1&M.wrap),M.mode=p,M.last=0,M.havedict=0,M.dmax=32768,M.head=null,M.hold=0,M.bits=0,M.lencode=M.lendyn=new n.Buf32(m),M.distcode=M.distdyn=new n.Buf32(g),M.sane=1,M.back=-1,d):f}function v(C){var M;return C&&C.state?((M=C.state).wsize=0,M.whave=0,M.wnext=0,w(C)):f}function E(C,M){var _,U;return C&&C.state?(U=C.state,M<0?(_=0,M=-M):(_=1+(M>>4),M<48&&(M&=15)),M&&(M<8||15=z.wsize?(n.arraySet(z.window,M,_-z.wsize,z.wsize,0),z.wnext=0,z.whave=z.wsize):(U<(Y=z.wsize-z.wnext)&&(Y=U),n.arraySet(z.window,M,_-U,Y,z.wnext),(U-=Y)?(n.arraySet(z.window,M,_-U,U,0),z.wnext=U,z.whave=z.wsize):(z.wnext+=Y,z.wnext===z.wsize&&(z.wnext=0),z.whave>>8&255,_.check=o(_.check,H,2,0),N=O=0,_.mode=2;break}if(_.flags=0,_.head&&(_.head.done=!1),!(1&_.wrap)||(((255&O)<<8)+(O>>8))%31){C.msg="incorrect header check",_.mode=30;break}if((15&O)!=8){C.msg="unknown compression method",_.mode=30;break}if(N-=4,x=8+(15&(O>>>=4)),_.wbits===0)_.wbits=x;else if(x>_.wbits){C.msg="invalid window size",_.mode=30;break}_.dmax=1<>8&1),512&_.flags&&(H[0]=255&O,H[1]=O>>>8&255,_.check=o(_.check,H,2,0)),N=O=0,_.mode=3;case 3:for(;N<32;){if(V===0)break e;V--,O+=U[z++]<>>8&255,H[2]=O>>>16&255,H[3]=O>>>24&255,_.check=o(_.check,H,4,0)),N=O=0,_.mode=4;case 4:for(;N<16;){if(V===0)break e;V--,O+=U[z++]<>8),512&_.flags&&(H[0]=255&O,H[1]=O>>>8&255,_.check=o(_.check,H,2,0)),N=O=0,_.mode=5;case 5:if(1024&_.flags){for(;N<16;){if(V===0)break e;V--,O+=U[z++]<>>8&255,_.check=o(_.check,H,2,0)),N=O=0}else _.head&&(_.head.extra=null);_.mode=6;case 6:if(1024&_.flags&&(V<(Q=_.length)&&(Q=V),Q&&(_.head&&(x=_.head.extra_len-_.length,_.head.extra||(_.head.extra=new Array(_.head.extra_len)),n.arraySet(_.head.extra,U,z,Q,x)),512&_.flags&&(_.check=o(_.check,U,Q,z)),V-=Q,z+=Q,_.length-=Q),_.length))break e;_.length=0,_.mode=7;case 7:if(2048&_.flags){if(V===0)break e;for(Q=0;x=U[z+Q++],_.head&&x&&_.length<65536&&(_.head.name+=String.fromCharCode(x)),x&&Q>9&1,_.head.done=!0),C.adler=_.check=0,_.mode=12;break;case 10:for(;N<32;){if(V===0)break e;V--,O+=U[z++]<>>=7&N,N-=7&N,_.mode=27;break}for(;N<3;){if(V===0)break e;V--,O+=U[z++]<>>=1)){case 0:_.mode=14;break;case 1:if(D(_),_.mode=20,M!==6)break;O>>>=2,N-=2;break e;case 2:_.mode=17;break;case 3:C.msg="invalid block type",_.mode=30}O>>>=2,N-=2;break;case 14:for(O>>>=7&N,N-=7&N;N<32;){if(V===0)break e;V--,O+=U[z++]<>>16^65535)){C.msg="invalid stored block lengths",_.mode=30;break}if(_.length=65535&O,N=O=0,_.mode=15,M===6)break e;case 15:_.mode=16;case 16:if(Q=_.length){if(V>>=5,N-=5,_.ndist=1+(31&O),O>>>=5,N-=5,_.ncode=4+(15&O),O>>>=4,N-=4,286<_.nlen||30<_.ndist){C.msg="too many length or distance symbols",_.mode=30;break}_.have=0,_.mode=18;case 18:for(;_.have<_.ncode;){for(;N<3;){if(V===0)break e;V--,O+=U[z++]<>>=3,N-=3}for(;_.have<19;)_.lens[J[_.have++]]=0;if(_.lencode=_.lendyn,_.lenbits=7,X={bits:_.lenbits},K=c(0,_.lens,0,19,_.lencode,0,_.work,X),_.lenbits=X.bits,K){C.msg="invalid code lengths set",_.mode=30;break}_.have=0,_.mode=19;case 19:for(;_.have<_.nlen+_.ndist;){for(;be=(P=_.lencode[O&(1<<_.lenbits)-1])>>>16&255,Se=65535&P,!((me=P>>>24)<=N);){if(V===0)break e;V--,O+=U[z++]<>>=me,N-=me,_.lens[_.have++]=Se;else{if(Se===16){for(R=me+2;N>>=me,N-=me,_.have===0){C.msg="invalid bit length repeat",_.mode=30;break}x=_.lens[_.have-1],Q=3+(3&O),O>>>=2,N-=2}else if(Se===17){for(R=me+3;N>>=me)),O>>>=3,N-=3}else{for(R=me+7;N>>=me)),O>>>=7,N-=7}if(_.have+Q>_.nlen+_.ndist){C.msg="invalid bit length repeat",_.mode=30;break}for(;Q--;)_.lens[_.have++]=x}}if(_.mode===30)break;if(_.lens[256]===0){C.msg="invalid code -- missing end-of-block",_.mode=30;break}if(_.lenbits=9,X={bits:_.lenbits},K=c(u,_.lens,0,_.nlen,_.lencode,0,_.work,X),_.lenbits=X.bits,K){C.msg="invalid literal/lengths set",_.mode=30;break}if(_.distbits=6,_.distcode=_.distdyn,X={bits:_.distbits},K=c(h,_.lens,_.nlen,_.ndist,_.distcode,0,_.work,X),_.distbits=X.bits,K){C.msg="invalid distances set",_.mode=30;break}if(_.mode=20,M===6)break e;case 20:_.mode=21;case 21:if(6<=V&&258<=$){C.next_out=ne,C.avail_out=$,C.next_in=z,C.avail_in=V,_.hold=O,_.bits=N,l(C,ee),ne=C.next_out,Y=C.output,$=C.avail_out,z=C.next_in,U=C.input,V=C.avail_in,O=_.hold,N=_.bits,_.mode===12&&(_.back=-1);break}for(_.back=0;be=(P=_.lencode[O&(1<<_.lenbits)-1])>>>16&255,Se=65535&P,!((me=P>>>24)<=N);){if(V===0)break e;V--,O+=U[z++]<>we)])>>>16&255,Se=65535&P,!(we+(me=P>>>24)<=N);){if(V===0)break e;V--,O+=U[z++]<>>=we,N-=we,_.back+=we}if(O>>>=me,N-=me,_.back+=me,_.length=Se,be===0){_.mode=26;break}if(32&be){_.back=-1,_.mode=12;break}if(64&be){C.msg="invalid literal/length code",_.mode=30;break}_.extra=15&be,_.mode=22;case 22:if(_.extra){for(R=_.extra;N>>=_.extra,N-=_.extra,_.back+=_.extra}_.was=_.length,_.mode=23;case 23:for(;be=(P=_.distcode[O&(1<<_.distbits)-1])>>>16&255,Se=65535&P,!((me=P>>>24)<=N);){if(V===0)break e;V--,O+=U[z++]<>we)])>>>16&255,Se=65535&P,!(we+(me=P>>>24)<=N);){if(V===0)break e;V--,O+=U[z++]<>>=we,N-=we,_.back+=we}if(O>>>=me,N-=me,_.back+=me,64&be){C.msg="invalid distance code",_.mode=30;break}_.offset=Se,_.extra=15&be,_.mode=24;case 24:if(_.extra){for(R=_.extra;N>>=_.extra,N-=_.extra,_.back+=_.extra}if(_.offset>_.dmax){C.msg="invalid distance too far back",_.mode=30;break}_.mode=25;case 25:if($===0)break e;if(Q=ee-$,_.offset>Q){if((Q=_.offset-Q)>_.whave&&_.sane){C.msg="invalid distance too far back",_.mode=30;break}ge=Q>_.wnext?(Q-=_.wnext,_.wsize-Q):_.wnext-Q,Q>_.length&&(Q=_.length),Te=_.window}else Te=Y,ge=ne-_.offset,Q=_.length;for($T?(k=ge[Te+g[M]],N[re+g[M]]):(k=96,0),b=1<>ne)+(w-=b)]=B<<24|k<<16|D|0,w!==0;);for(b=1<>=1;if(b!==0?(O&=b-1,O+=b):O=0,M++,--ee[C]==0){if(C===U)break;C=h[d+g[M]]}if(Y>>7)]}function re(P,H){P.pending_buf[P.pending++]=255&H,P.pending_buf[P.pending++]=H>>>8&255}function ee(P,H,J){P.bi_valid>y-J?(P.bi_buf|=H<>y-P.bi_valid,P.bi_valid+=J-y):(P.bi_buf|=H<>>=1,J<<=1,0<--H;);return J>>>1}function Te(P,H,J){var te,j,ae=new Array(g+1),ue=0;for(te=1;te<=g;te++)ae[te]=ue=ue+J[te-1]<<1;for(j=0;j<=H;j++){var oe=P[2*j+1];oe!==0&&(P[2*j]=ge(ae[oe]++,oe))}}function me(P){var H;for(H=0;H>1;1<=J;J--)we(P,ae,J);for(j=ye;J=P.heap[1],P.heap[1]=P.heap[P.heap_len--],we(P,ae,1),te=P.heap[1],P.heap[--P.heap_max]=J,P.heap[--P.heap_max]=te,ae[2*j]=ae[2*J]+ae[2*te],P.depth[j]=(P.depth[J]>=P.depth[te]?P.depth[J]:P.depth[te])+1,ae[2*J+1]=ae[2*te+1]=j,P.heap[1]=j++,we(P,ae,1),2<=P.heap_len;);P.heap[--P.heap_max]=P.heap[1],function(Pe,Et){var It,Lt,I,F,L,G,q=Et.dyn_tree,le=Et.max_code,he=Et.stat_desc.static_tree,Ce=Et.stat_desc.has_stree,ke=Et.stat_desc.extra_bits,Xe=Et.stat_desc.extra_base,Ye=Et.stat_desc.max_length,Qe=0;for(F=0;F<=g;F++)Pe.bl_count[F]=0;for(q[2*Pe.heap[Pe.heap_max]+1]=0,It=Pe.heap_max+1;It>=7;j>>=1)if(1&Ve&&oe.dyn_ltree[2*ye]!==0)return a;if(oe.dyn_ltree[18]!==0||oe.dyn_ltree[20]!==0||oe.dyn_ltree[26]!==0)return o;for(ye=32;ye>>3,(ae=P.static_len+3+7>>>3)<=j&&(j=ae)):j=ae=J+5,J+4<=j&&H!==-1?R(P,H,J,te):P.strategy===4||ae===j?(ee(P,2+(te?1:0),3),Re(P,W,C)):(ee(P,4+(te?1:0),3),function(oe,ye,Ve,Pe){var Et;for(ee(oe,ye-257,5),ee(oe,Ve-1,5),ee(oe,Pe-4,4),Et=0;Et>>8&255,P.pending_buf[P.d_buf+2*P.last_lit+1]=255&H,P.pending_buf[P.l_buf+P.last_lit]=255&J,P.last_lit++,H===0?P.dyn_ltree[2*J]++:(P.matches++,H--,P.dyn_ltree[2*(_[J]+h+1)]++,P.dyn_dtree[2*N(H)]++),P.last_lit===P.lit_bufsize-1},s._tr_align=function(P){ee(P,2,3),Q(P,w,W),function(H){H.bi_valid===16?(re(H,H.bi_buf),H.bi_buf=0,H.bi_valid=0):8<=H.bi_valid&&(H.pending_buf[H.pending++]=255&H.bi_buf,H.bi_buf>>=8,H.bi_valid-=8)}(P)}},{"../utils/common":41}],53:[function(t,r,s){r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,r,s){(function(n){(function(a,o){if(!a.setImmediate){var l,c,u,h,d=1,f={},p=!1,m=a.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(a);g=g&&g.setTimeout?g:a,l={}.toString.call(a.process)==="[object process]"?function(v){process.nextTick(function(){b(v)})}:function(){if(a.postMessage&&!a.importScripts){var v=!0,E=a.onmessage;return a.onmessage=function(){v=!1},a.postMessage("","*"),a.onmessage=E,v}}()?(h="setImmediate$"+Math.random()+"$",a.addEventListener?a.addEventListener("message",w,!1):a.attachEvent("onmessage",w),function(v){a.postMessage(h+v,"*")}):a.MessageChannel?((u=new MessageChannel).port1.onmessage=function(v){b(v.data)},function(v){u.port2.postMessage(v)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(v){var E=m.createElement("script");E.onreadystatechange=function(){b(v),E.onreadystatechange=null,c.removeChild(E),E=null},c.appendChild(E)}):function(v){setTimeout(b,0,v)},g.setImmediate=function(v){typeof v!="function"&&(v=new Function(""+v));for(var E=new Array(arguments.length-1),S=0;S"u"?n===void 0?this:n:self)}).call(this,typeof ii<"u"?ii:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(ym);var kE=ym.exports;const IE=Kn(kE);function pr(i,e){let t=kc(i)[2];return e&&t.slice(-1*e.length)===e&&(t=t.slice(0,t.length-e.length)),t}function Zt(i){const e=kc(i),t=e[0];let r=e[1];return!t&&!r?"":(r&&(r=r.slice(0,r.length-1)),t+r)}function Ei(i){return kc(i)[3]}const PE=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^/]+?|)(\.[^./]*|))(?:[/]*)$/;function kc(i){return PE.exec(i).slice(1)}class BE{static _worker;static workID=0;static map=new Map;static _init(){const e=` function resolvePath(path) { let pathParts = path.split("/") pathParts = pathParts.filter(item => item != "." && item != "") @@ -1268,10 +1269,10 @@ https://github.com/nodeca/pako/blob/main/LICENSE postMessage(e.data[0]) }) } - `,t=new Blob([e],{type:"application/javascript"});this._worker=new Worker(URL.createObjectURL(t)),this._worker.onmessage=r=>{const s=r.data;console.log("Finished job "+s),this.map.has(s)&&this.map.get(s)()}}static get worker(){return this._worker||this._init(),this._worker}static async writeHandle(e,t){const r=this.workID++;console.log("Starting work write "+e+", id: "+r);const s=new Promise(o=>this.map.set(r,o)),n=new TextEncoder,a=typeof t=="string"?n.encode(t):await t.arrayBuffer();return this.worker.postMessage([r,e,a]),s}}class DE{root;constructor(){CE.adapter.native&&!lm().includes("Safari")?Hu().then(e=>this.root=e):Hu(os(()=>import("./memory-52dcb63c.js"),["./memory-52dcb63c.js","./util-83e43b90.js"],import.meta.url)).then(e=>this.root=e)}async uploadHandle(e,t){let r;if(typeof t=="string"){const s=await this.getDirectoryHandle(t,{create:!0});if(!s)return;r=s}else r=t??this.root;if(e.kind=="file"){const s=await r.getFileHandle(e.name,{create:!0});await this.writeFile(s,await e.getFile())}else{const s=await r.getDirectoryHandle(e.name,{create:!0}),n=[];for await(const a of e.values())n.push(this.uploadHandle(a,s));await Promise.all(n)}}async uploadFiles(e,t){let r;if(typeof t=="string"){const s=await this.getDirectoryHandle(t,{create:!0});if(!s)return;r=s}else r=t??this.root;if(e.isFile){const s=e;if(s.name==".DS_Store")return;s.file(async n=>{const a=await r.getFileHandle(n.name,{create:!0});await this.writeHandle(a,n)})}else if(e.isDirectory){const s=e.createReader(),n=await r.getDirectoryHandle(e.name,{create:!0});for await(const a of n.values())await n.removeEntry(a.name,{recursive:!0});s.readEntries(async a=>{const o=[];for(let l=0;lr!="."&&r!="");t.indexOf("..")>-1;){const r=t.indexOf("..");if(r==0)throw Error("Path"+t.join("/")+"is invalid!");t.splice(r-1,2)}return t.join("/")}async zipDirectory(e,t){const r=t??new PE,s=Ni(e)==""?e:Zt(e),n=await this.getDirectoryHandle(s);if(n){for(const a of await this.getDirectoryFiles(n))r.file(a.name,await a.getFile());for(const a of await this.getDirectoryFolders(n)){const o=r.folder(a.name);if(!o){console.error("Failed to zip folder "+e+"/"+a.name);continue}await this.zipDirectory(e+"/"+a.name,o)}return r}}async saveDirectory(e){const t=Ni(e)==""?e:Zt(e);Oe.create("Exporting "+t+".zip");const r=await TE({_preferPolyfill:!1,suggestedName:`${t}.zip`,types:[{accept:{"application/zip":[".zip"]}}],excludeAcceptAllOption:!1}),s=await this.zipDirectory(e);s&&await s.generateAsync({type:"blob"}).then(async n=>{await this.writeHandle(r,n)})}async renameFile(e,t){if(e!=t)try{const r=await this.getDirectoryHandle(Zt(e)),s=await this.getDirectoryHandle(Zt(t),{create:!0}),n=await this.getFileHandle(e);if(!r||!s||!n)return;await this.copyToHandle(s,n,pr(t)),await r.removeEntry(pr(e))}catch(r){console.error(r)}}async renameDirectory(e,t){if(!t.startsWith(e))try{const r=await this.getDirectoryHandle(Zt(e)),s=await this.getDirectoryHandle(Zt(t),{create:!0}),n=await this.getDirectoryHandle(e);if(!r||!s||!n)return;await this.copyToHandle(s,n,pr(t)),await r.removeEntry(pr(e),{recursive:!0})}catch(r){console.error(r)}}async copyToHandle(e,t,r){try{if(t.kind=="directory"){const s=await e.getDirectoryHandle(r??t.name,{create:!0}),n=[];for await(const a of t.values())n.push(this.copyToHandle(s,a));await Promise.all(n)}else{const s=await t.getFile(),n=await e.getFileHandle(r??t.name,{create:!0});await this.writeHandle(n,s)}}catch(s){console.error(s)}}getRelativePath(e,t){const r=e.split("/"),s=t.split("/"),n=Math.min(r.length,s.length);let a=n;for(let l=0;limport("./NodeFileHandler-5c5a059f.js"),["./NodeFileHandler-5c5a059f.js","./util-83e43b90.js"],import.meta.url)).NodeFileHandler:new DE;class Vt{windowManager;options;windowElement;viewElement;constructor(e){this.options=e;const t=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),n=document.createElement("div");if(t.appendChild(s),t.appendChild(r),t.style.width=e.width+"px",t.style.left=window.innerWidth/2-e.width/2+"px",t.style.top=window.innerHeight/2-e.height/2+"px",t.classList.add("unselectable","window"),e.win_id&&(t.dataset.win_id=e.win_id),r.classList.add("view"),r.style.height=e.height+"px",r.style.width=e.width+"px",s.classList.add("navbar"),s.appendChild(n),!e.disableClose){const a=document.createElement("img"),o=document.createElement("img");a.classList.add("unselectable"),a.draggable=!1,a.src=Ge.MINIMIZE_WINDOW,a.onclick=()=>{r.style.height!="0px"?r.style.height="0px":r.style.height=e.height+"px",this.clampPosition()},o.classList.add("unselectable"),o.draggable=!1,o.src=Ge.CLOSE_WINDOW,o.onclick=()=>this.closeWindow(),s.appendChild(a),s.appendChild(o)}n.innerText=e.title,n.classList.add("title"),t.addEventListener("mousedown",()=>this.focus()),e.blocking&&(window.addEventListener("mousedown",this.block,!0),document.getElementById("blocker").style.display="block",t.dataset.blocking="block"),n.addEventListener("mousedown",()=>{window.addEventListener("mousemove",this.handleDrag),window.addEventListener("mouseup",()=>window.removeEventListener("mousemove",this.handleDrag))}),this.focus(),t.classList.add("focused"),this.windowElement=t,this.viewElement=r}addToManager(e){this.windowManager=e,e.view.appendChild(this.windowElement),this.focus()}onClose(){}closeWindow(){this.windowManager&&(this.onClose(),this.windowManager.removeWindow(this),this.windowElement.classList.add("exiting"),window.removeEventListener("mousedown",this.block,!0),this.options.blocking&&this.windowManager.windows.filter(e=>e.options.blocking).length==0&&(document.getElementById("blocker").style.display="none"),setTimeout(()=>this.windowManager.view.removeChild(this.windowElement),40))}focus(){if(this.windowManager==null)return;this.windowManager.unfocusAll(),this.windowElement.classList.add("focused");const e=Array.from(this.windowManager.view.children).map(t=>t).filter(t=>t!=this.windowElement);e.sort((t,r)=>parseInt(t.style.zIndex)-parseInt(r.style.zIndex)),e.push(this.windowElement);for(let t=0;t{!e.target||this.windowElement.contains(e.target)||(e.stopImmediatePropagation(),e.preventDefault())};handleDrag=e=>{const t=parseInt(this.windowElement.style.left.slice(0,-2))+e.movementX,r=parseInt(this.windowElement.style.top.slice(0,-2))+e.movementY;this.windowElement.style.left=t+"px",this.windowElement.style.top=r+"px",this.clampPosition()};clampPosition(){if(this.windowManager==null)return;const e=parseInt(this.windowElement.style.left.slice(0,-2)),t=parseInt(this.windowElement.style.top.slice(0,-2)),r=this.windowManager.app.view.getBoundingClientRect();this.windowElement.style.left=at(e,r.left,r.width-this.windowElement.clientWidth+r.left)+"px",this.windowElement.style.top=at(t,r.top,r.height-this.windowElement.clientHeight+r.top)+"px"}}class ra extends Vt{app;dirOptions;fileDropPath="";draggedElement;draggedCopy;keyHandler;dropHandler;mouseHandler;dragHandler;constructor(e,t,r){super({title:t.title,width:500,height:400,disableClose:t.disableClose,win_id:"file_selector"+Math.random(),blocking:!0}),this.app=e,this.dirOptions=t,t.accepted_file_types||=[],this.keyHandler=this.handleKeyEvent.bind(this),this.dropHandler=this.handleDropEvent.bind(this),this.mouseHandler=this.handleMouseEvent.bind(this),this.dragHandler=this.handleDragEvent.bind(this),this.initView().then(()=>{r&&this.selectPath(r),t.onload?.()})}async initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("menu-options");const r=document.createElement("div");r.classList.add("menu-left");const s=document.createElement("div");s.classList.add("menu-right"),t.appendChild(r),t.appendChild(s);const n=document.createElement("button");n.innerText="Cancel",n.onclick=()=>{window.removeEventListener("keydown",this.keyHandler,!0),window.removeEventListener("drop",this.dropHandler,!0),this.closeWindow()};const a=document.createElement("button");a.innerText="Select",a.classList.add("confirm"),a.onclick=()=>this.confirmFile(),a.disabled=!0,r.appendChild(n),s.appendChild(a);const o=document.createElement("div");o.classList.add("dir-selector"),o.onclick=y=>{y.target==o&&this.selectElement(void 0)};const l=document.createElement("div");l.classList.add("file-options");const c=document.createElement("button"),u=document.createElement("img");u.src=Ge.ADD_FILE,u.classList.add("icon"),c.appendChild(u),c.appendChild(document.createTextNode("Upload files")),l.appendChild(c),c.onclick=async()=>{const y=this.fileDropPath,b=await EE({_preferPolyfill:!1,excludeAcceptAllOption:!1,multiple:!0}),v=this.viewElement.querySelector(".info.selected")?.dataset.path??"",E=[];for(const I of b)E.push($e.uploadHandle(I,v));await Promise.all(E),await this.refreshDirectory(y),this.getAcceptableFile(y).then(I=>this.selectPath(I))};const h=document.createElement("button"),d=document.createElement("img");d.src=Ge.ADD_FOLDER,d.classList.add("icon"),h.appendChild(d),h.appendChild(document.createTextNode("Upload folder")),l.appendChild(h),h.onclick=async()=>{const y=this.fileDropPath,b=await AE({_preferPolyfill:!1}),v=this.viewElement.querySelector(".info.selected")?.dataset.path??"";await $e.uploadHandle(b,v),await this.refreshDirectory(y),this.getAcceptableFile(y==""?b.name:y+"/"+b.name).then(E=>this.selectPath(E))};const f=document.createElement("button");f.classList.add("rename");const p=document.createElement("img");p.src=Ge.EDIT,p.classList.add("icon"),f.appendChild(p),f.appendChild(document.createTextNode("Rename")),f.disabled=!0,f.onclick=()=>{const y=this.viewElement.querySelector(".info.selected");y?.dataset.path&&this.startEditing(y.querySelector("textarea"))},l.appendChild(f);const m=document.createElement("button");m.classList.add("delete");const g=document.createElement("img");g.src=Ge.TRASH,g.classList.add("icon"),m.appendChild(g),m.appendChild(document.createTextNode("Delete")),m.disabled=!0,m.onclick=()=>{const y=this.viewElement.querySelector(".info.selected"),b=y?.dataset.path;if(!b)return;const _=y.parentElement.classList.contains("folder");$e[_?"removeDirectory":"removeFile"](b).then(()=>{const v=this.getElement(b);v&&(v.parentElement?.remove(),m.disabled=!0,f.disabled=!0)})},l.appendChild(m),e.appendChild(o),e.appendChild(l),e.appendChild(t),this.viewElement.appendChild(e),window.addEventListener("keydown",this.keyHandler,!0),window.addEventListener("drop",this.dropHandler,!0),window.addEventListener("mousemove",this.dragHandler,!0),this.viewElement.addEventListener("dragover",this.mouseHandler),await this.createDiv("").then(y=>o.replaceChildren(...y))}async expand(e){if(!e.parentElement.classList.contains("folder"))return;e.parentElement.classList.remove("collapsed");const t=e.nextSibling;await this.createDiv(e.dataset.path).then(r=>{t.replaceChildren(...r)})}collapse(e){if(!e.parentElement.classList.contains("folder"))return;e.parentElement.classList.add("collapsed"),e.nextSibling.replaceChildren()}selectElement(e){if(this.viewElement.querySelector(".info.selected")?.classList.remove("selected"),!e){this.viewElement.querySelector(".delete").disabled=!0,this.viewElement.querySelector(".rename").disabled=!0;return}e.classList.add("selected"),Nn(e,{scrollMode:"if-needed",block:"nearest",inline:"nearest"});const t=this.viewElement.querySelector("button.confirm"),r=e.dataset.path;t.disabled=!0,r&&(t.disabled=!this.acceptableFileType(r),this.viewElement.querySelector(".delete").disabled=!1,this.viewElement.querySelector(".rename").disabled=!1)}async createDiv(e){const t=await $e.getDirectoryFolders(e);let r=await $e.getDirectoryFiles(e);return t.sort((s,n)=>s.name.toLowerCase().localeCompare(n.name.toLowerCase())),r.sort((s,n)=>s.name.toLowerCase().localeCompare(n.name.toLowerCase())),r=r.filter(s=>Ni(s.name)!=".crswap"),t.map(s=>this.createBaseElement(e,s)).concat(r.map(s=>this.createBaseElement(e,s)))}createBaseElement(e,t){e!=""&&(e+="/");const r=document.createElement("div");r.classList.add("item");const s=document.createElement("div");if(s.classList.add("info"),r.appendChild(s),t.kind=="directory"){const a=document.createElement("img");a.classList.add("icon"),a.classList.add("folder-icon"),a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRIie2PMQqAMAxFXwfP6qJVPIjYzcOKdUkhQ0BaCoLkLS3k818CjuN8ztApYzIDl7xvmalFsAIZuIFozKPMMrC0CAJwKIkuGVX5KdkmLEm3ci1JSlLKU49yLSmXVG1es0EANvnvInKcP/AA784fpjlWwNQAAAAASUVORK5CYII=",s.appendChild(a);const o=document.createElement("div");o.classList.add("children"),r.appendChild(o),r.classList.add("folder"),r.classList.add("collapsed"),s.addEventListener("click",l=>{const c=l.target;c?.classList.contains("options-icon")||c.tagName=="TEXTAREA"&&!c.disabled||(r.classList.contains("collapsed")?this.expand(s):this.collapse(s))})}else{this.acceptableFileType(t.name)||s.classList.add("disabled");const a=document.createElement("img");a.src=this.getIcon(t.name),a.classList.add("icon"),s.appendChild(a)}s.dataset.path=e+t.name;const n=document.createElement("textarea");return n.rows=1,n.disabled=!0,n.autocomplete="off",n.autocapitalize="off",n.spellcheck=!1,n.innerText=t.name,n.style.pointerEvents="none",n.classList.add("title"),s.appendChild(n),s.addEventListener("click",()=>this.selectElement(s)),s.addEventListener("mousedown",()=>this.startDragging(s)),s.ondblclick=()=>this.confirmFile(),r}confirmFile(){const t=this.viewElement.querySelector(".info.selected")?.dataset.path;t&&this.acceptableFileType(t)&&(this.dirOptions.callback?.(t),window.removeEventListener("keydown",this.keyHandler,!0),window.removeEventListener("drop",this.dropHandler,!0),window.removeEventListener("mousemove",this.dragHandler,!0),this.closeWindow())}acceptableFileType(e){return this.dirOptions.accepted_file_types.length==0||this.dirOptions.accepted_file_types.includes(Ni(e))}getIcon(e){const t=Ni(e);return t==""&&!e.startsWith(".")?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAY0lEQVRIiWNgGAWDCXgwMDA8ZmBg+I8DN1BqwSM8hlPFEpgh2EA4AwPDbyIc8B/qUA9SLSDHEpItIBagmMNEBQPxglELRi0YtQDVgsdQmpiiAB9GNgsFeDAQV6KSXdiNgoEBAG+iU6T/ixEpAAAAAElFTkSuQmCC":Gr.includes(t)?Ge.IMAGE_FILE:Oo.includes(t)?Ge.AUDIO_FILE:[".sm",".ssc"].includes(t)?Ge.SM_FILE:Ge.UNKNOWN_FILE}startEditing(e){const t=e.value,r=!!e.parentElement?.parentElement?.classList.contains("folder"),s=e.parentElement?.dataset.path??"",n=Zt(s);e.value=s.split("/").at(-1)??"",window.removeEventListener("keydown",this.keyHandler,!0),e.disabled=!1,e.style.pointerEvents="",e.focus(),e.addEventListener("keypress",a=>{a.code=="Enter"&&(a.preventDefault(),a.stopImmediatePropagation(),e.blur())},!0),e.addEventListener("blur",async()=>{if(window.addEventListener("keydown",this.keyHandler,!0),e.disabled=!0,e.style.pointerEvents="none",e.value.startsWith(".")){e.value=t;return}e.value=e.value.replaceAll("/","");const a=n==""?e.value:n+"/"+e.value;a!=s&&(e.parentElement.dataset.path=a,await $e[r?"renameDirectory":"renameFile"](s,a),this.refreshDirectory(n),e.value.length>32&&(e.value=e.value.slice(0,32)+"..."))})}async refreshDirectory(e){const t=this.viewElement.querySelector(".dir-selector");if(!t)return;let r=t.querySelector("div[data-path='"+this.escapeSelector(e)+"']")?.nextSibling;if(e==""&&(r=t),!r)return;const s=Array.from(r.parentElement.querySelectorAll(".folder:not(.collapsed)")).map(n=>n.children[0].dataset.path);await this.createDiv(e).then(n=>r.replaceChildren(...n)),await Promise.all(s.map(n=>this.expand(t.querySelector("div[data-path='"+this.escapeSelector(n)+"']"))))}getElement(e){const t=this.viewElement.querySelector(".dir-selector");return t?t.querySelector("div[data-path='"+this.escapeSelector(e)+"']"):null}async getAcceptableFile(e){const t=await $e.getDirectoryHandle(e);if(!t)return;const r=[{path:e,handle:t}];for(;r.length>0;){const s=r.shift(),n=s.handle;for await(const a of n.values()){const o=s.path==""?"":s.path+"/";if(a.kind=="directory")r.push({path:o+a.name,handle:a});else if(this.acceptableFileType(a.name))return o+a.name}}}async selectPath(e){if(!e)return;const t=this.viewElement.querySelector(".dir-selector");if(!t)return;const r=e.split("/");r.pop();const s=[];for(;r.length>0;){s.push(r.shift());const a=t.querySelector("div[data-path='"+this.escapeSelector(s.join("/"))+"']");if(!a)return;await this.expand(a)}const n=t.querySelector("div[data-path='"+this.escapeSelector(e)+"']");n&&this.selectElement(n)}handleKeyEvent(e){if(!this.windowElement.classList.contains("focused"))return;const t=this.viewElement.querySelector(".info.selected");if(t==null){if(e.code.startsWith("Arrow")){const r=this.viewElement.querySelector(".info");r&&this.selectElement(r)}return}if(e.code=="ArrowUp"){e.preventDefault(),e.stopImmediatePropagation();const r=t.parentElement;let s=r.previousSibling?.querySelector(".info");s&&!s.parentElement.classList.contains("collapsed")&&s.parentElement.classList.contains("folder")&&(s=s.parentElement.querySelector(".children").lastChild.querySelector(".info")),!s&&r.parentElement.classList.contains("children")&&(s=r.parentElement.parentElement.querySelector(".info")),s&&(this.selectElement(s),Nn(s,{scrollMode:"if-needed",block:"nearest",inline:"nearest"}))}if(e.code=="ArrowDown"){e.preventDefault(),e.stopImmediatePropagation();const r=t.parentElement;let s;r.classList.contains("folder")&&!r.classList.contains("collapsed")&&(s=r.querySelector(".children").children[0].querySelector(".info")),s||(s=t.parentElement.nextSibling?.querySelector(".info")),!s&&r.parentElement.classList.contains("children")&&(s=r.parentElement.parentElement.nextSibling.querySelector(".info")),s&&(this.selectElement(s),Nn(s,{scrollMode:"if-needed",block:"nearest",inline:"nearest"}))}if(e.code=="ArrowLeft"&&(e.preventDefault(),e.stopImmediatePropagation(),this.collapse(t)),e.code=="ArrowRight"&&(e.preventDefault(),e.stopImmediatePropagation(),this.expand(t)),e.code=="Enter"&&(e.preventDefault(),e.stopImmediatePropagation(),t.parentElement?.querySelector(".title")&&this.startEditing(t.parentElement?.querySelector(".title"))),e.code=="Delete"||e.code=="Backspace"){const r=this.viewElement.querySelector(".info.selected"),s=r?.dataset.path;if(!s)return;const n=r.parentElement.classList.contains("folder");$e[n?"removeDirectory":"removeFile"](s).then(()=>{const a=this.getElement(s);a&&(a.parentElement?.remove(),this.viewElement.querySelector(".delete").disabled=!0,this.viewElement.querySelector(".rename").disabled=!0)})}}startDragging(e){const t=e;t.totalMovementX=0,t.totalMovementY=0,this.draggedElement=t;const r=()=>{this.stopDragging(),window.removeEventListener("mouseup",r)};window.addEventListener("mouseup",r)}handleDragEvent(e){if(this.draggedElement){if(this.draggedElement.totalMovementX+=e.movementX,this.draggedElement.totalMovementY+=e.movementY,!this.draggedCopy)if(Math.abs(this.draggedElement.totalMovementX)+Math.abs(this.draggedElement.totalMovementY)>8){this.viewElement.addEventListener("mousemove",this.mouseHandler),this.draggedCopy=this.draggedElement.parentElement.cloneNode(!0),this.draggedCopy.style.position="fixed";const t=this.draggedElement.getBoundingClientRect();this.draggedCopy.style.top=t.top+this.draggedElement.totalMovementY+"px",this.draggedCopy.style.left=t.left+this.draggedElement.totalMovementX+"px",this.draggedCopy.style.width=t.width+"px",this.draggedCopy.style.boxShadow="3px 3px 3px #222",this.draggedCopy.querySelector(".children")&&this.draggedCopy.removeChild(this.draggedCopy.querySelector(".children")),this.viewElement.appendChild(this.draggedCopy)}else return;this.draggedCopy.style.top=parseFloat(this.draggedCopy.style.top.slice(0,-2))+e.movementY+"px",this.draggedCopy.style.left=parseFloat(this.draggedCopy.style.left.slice(0,-2))+e.movementX+"px"}}async stopDragging(){if(this.draggedCopy){this.draggedCopy.remove(),this.viewElement.removeEventListener("mousemove",this.mouseHandler);const e=this.draggedCopy.classList.contains("folder"),t=this.draggedElement.dataset.path,r=this.fileDropPath==""?pr(this.draggedElement.dataset.path):this.fileDropPath+"/"+pr(this.draggedElement.dataset.path);t!=r&&await $e[e?"renameDirectory":"renameFile"](t,r),await this.refreshDirectory(Zt(t)),await this.refreshDirectory(Zt(r)),this.viewElement.querySelector(".outlined")?.classList.remove("outlined"),this.fileDropPath=""}this.draggedCopy=void 0,this.draggedElement=void 0}handleDropEvent(e){e.preventDefault(),e.stopImmediatePropagation(),this.viewElement.querySelector(".outlined")?.classList.remove("outlined"),e.target.closest(".dir-selector")&&$e.handleDropEvent(e,this.fileDropPath).then(async t=>{await this.refreshDirectory(this.fileDropPath),this.getAcceptableFile(t??this.fileDropPath).then(r=>this.selectPath(r)),this.fileDropPath=""})}handleMouseEvent(e){const t=this.viewElement.querySelector(".dir-selector");let r=Array.from(t.querySelectorAll("div.item.folder"));const s=this.viewElement.querySelector(".outlined");r=r.filter(n=>!n.parentElement.closest(".collapsed")),r.reverse(),r.push(t);for(const n of r){const a=n.getBoundingClientRect();if(e.clientX>=a.x&&e.clientX<=a.x+a.width&&e.clientY>=a.y&&e.clientY<=a.y+a.height){s!=n&&s?.classList.remove("outlined");const o=n.querySelector(".info");this.fileDropPath=o?.dataset.path??"",n.classList.contains("dir-selector")&&(this.fileDropPath=""),n.classList.add("outlined");return}}this.viewElement.querySelector(".outlined")?.classList.remove("outlined"),this.fileDropPath=""}escapeSelector(e){return e.replaceAll(/'/g,"\\'")}}function bm(){const i=document.createElement("div");return i.spellcheck=!1,i.contentEditable="true",i.classList.add("inlineEdit"),i.onkeydown=e=>{e.key=="Enter"&&i.blur()},i}function Fa(i,e){return{title:i,element:t=>{const r=bm();return r.onblur=()=>{const s=t[e];mt.instance.run({action:()=>{t[e]=r.innerText},undo:()=>{t[e]=s}}),r.scrollLeft=0},r.innerText=t[e],r}}}const LE={name:Fa("Name","chartName"),credit:Fa("Artist","credit"),style:Fa("Style","chartStyle"),description:Fa("Description","description"),music:{title:"Music File",element:(i,e)=>{const t=document.createElement("div");t.classList.add("flex-row","flex-column-gap","flex-static","hide-buttons");const r=()=>{if(s.innerText==(i.music??e.chartManager.loadedSM.properties.MUSIC??""))return;const c=e.chartManager.chartAudio.isPlaying();if(s.innerText==""||s.innerText==e.chartManager.loadedSM.properties.MUSIC){i.music=void 0,s.innerText=e.chartManager.loadedSM.properties.MUSIC+"",e.chartManager.loadAudio(),c&&e.chartManager.chartAudio.play();return}const u=i.music;mt.instance.run({action:()=>i.music=s.innerText==e.chartManager.loadedSM.properties.MUSIC?void 0:s.innerText,undo:()=>i.music=u}),e.chartManager.loadAudio(),c&&e.chartManager.chartAudio.play()},s=bm();s.style.flex="1",s.onblur=r,s.innerText=i.music??e.chartManager.loadedSM.properties.MUSIC??"";const n=document.createElement("button");n.onclick=()=>{const c=e.chartManager.smPath.split("/").slice(0,-1).join("/");if(window.nw){const u=document.createElement("input");u.type="file",u.accept="audio/*",u.onchange=()=>{s.innerText=$e.getRelativePath(c,u.value),r()},u.click()}else e.windowManager.openWindow(new ra(e,{title:"Select an audio file...",accepted_file_types:Oo,disableClose:!0,callback:u=>{s.innerText=$e.getRelativePath(c,u),r()}},c+"/"+(i.music??e.chartManager.loadedSM.properties.MUSIC??"")))};const a=document.createElement("img");a.classList.add("icon"),a.style.height="12px",a.src=Ge.SELECT_FILE,n.appendChild(a);const o=document.createElement("button");o.onclick=()=>{s.innerText!=(e.chartManager.loadedSM.properties.MUSIC??"")&&(s.innerText=e.chartManager.loadedSM.properties.MUSIC??"",r())};const l=document.createElement("img");return l.classList.add("icon"),l.style.height="12px",l.src=Ge.REVERT,o.appendChild(l),t.appendChild(s),t.appendChild(n),t.appendChild(o),t}}};class hi{view;items=[];selectedItem;onChangeHandlers=[];static create(e,t){return new hi(document.createElement("div"),e,t)}constructor(e,t,r){this.view=e,e.classList.add("dropdown"),this.items=t??[],this.selectedItem=r??this.items[0];const s=document.createElement("div");s.classList.add("dropdown-selected");const n=document.createElement("div");n.classList.add("dropdown-items"),n.style.height="",s.onclick=()=>{if(!s.classList.contains("disabled")){if(this.items.length==0){n.style.height="";return}this.createDropdown(),n.style.height==""?(n.style.width=Math.max(n.scrollWidth,s.clientWidth)+"px",n.style.height=n.scrollHeight+"px",Array.from(n.children).forEach((a,o)=>{a.style.animationDelay=o*.02+"s"})):n.style.height=""}},window.addEventListener("click",a=>{const o=a.target;(!o.closest(".dropdown")||o.closest(".dropdown")!=e)&&(n.style.height="")}),this.view.appendChild(s),this.view.appendChild(n),this.setSelected()}onChange(e){this.onChangeHandlers.push(e)}removeHandler(e){this.onChangeHandlers.includes(e)&&this.onChangeHandlers.splice(this.onChangeHandlers.indexOf(e),1)}setItems(e){this.items=e,e.includes(this.selectedItem)||(this.selectedItem=this.items[0],this.setSelected())}setSelected(e){this.selectedItem=e??this.selectedItem;const t=this.view.querySelector(".dropdown-selected");t.innerText=this.selectedItem?this.selectedItem+"":""}closeDropdown(){const e=this.view.querySelector(".dropdown-items");e&&(e.style.height="")}get value(){return this.selectedItem}get disabled(){return this.view.querySelector(".dropdown-selected").classList.contains("disabled")}set disabled(e){e?this.view.querySelector(".dropdown-selected").classList.add("disabled"):this.view.querySelector(".dropdown-selected").classList.remove("disabled")}createDropdown(){const e=this.view.querySelector(".dropdown-items"),t=this.items.map(r=>{const s=document.createElement("div");return s.classList.add("dropdown-item"),s.innerText=r+"",s.onclick=()=>{e.style.height="",this.selectedItem!=r&&(this.setSelected(r),this.onChangeHandlers.forEach(n=>n(r)))},s});e.replaceChildren(...t)}}class Ic extends Vt{app;buttonOptions;message;resolve;resolved=new Promise(e=>this.resolve=e);constructor(e,t,r,s){super({title:t,width:300,height:100,disableClose:!0,win_id:"confirm",blocking:!0}),this.app=e,this.message=r,this.buttonOptions=s,this.initView()}initView(){this.viewElement.replaceChildren(),this.viewElement.classList.add("confirmation");const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("label"),t.innerText=this.message,e.appendChild(t);const r=document.createElement("div");r.classList.add("menu-options"),this.buttonOptions.forEach(s=>{const n=document.createElement("button");n.innerText=s.label,n.onclick=()=>{s.callback?.(),this.resolve?.(s.label),this.closeWindow()},s.type!="default"&&n.classList.add(s.type),r.append(n)}),e.appendChild(r),this.viewElement.appendChild(e)}}class wm extends Vt{app;gameType;chartList;chartInfo;gameTypeDropdown;smLoadHandler=()=>{this.gameTypeDropdown.setItems(Ze.getPriority().map(e=>{const t=this.app.chartManager.loadedSM?.charts[e.id]??[];return e.id+" ("+t.length+")"})),this.gameTypeDropdown.setSelected(this.gameType.id+" ("+(this.app.chartManager.loadedSM?.charts[this.gameType.id]??[]).length+") "),this.gameType=this.app.chartManager.loadedChart?.gameType??this.gameType,this.loadCharts()};constructor(e,t){super({title:"Chart List",width:500,height:400,win_id:"chart_list"}),this.app=e,this.gameType=t??e.chartManager.loadedChart?.gameType??Ze.getPriority()[0],this.initView(),re.on("smLoadedAfter",this.smLoadHandler)}initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("chart-view-type-wrapper");const r=document.createElement("div");r.classList.add("chart-view-type-label"),r.innerText="Game Type:",this.gameTypeDropdown=hi.create(Ze.getPriority().map(n=>{const a=this.app.chartManager.loadedSM?.charts[n.id]??[];return n.id+" ("+a.length+")"}),this.gameType.id+" ("+(this.app.chartManager.loadedSM?.charts[this.gameType.id]??[]).length+") "),this.gameTypeDropdown.onChange(n=>{this.gameType=Ze.getGameType(n.split(" ")[0])??this.gameType,this.loadCharts()}),t.appendChild(r),t.appendChild(this.gameTypeDropdown.view);const s=document.createElement("div");s.classList.add("chart-view-scroller"),e.appendChild(t),e.appendChild(s),this.chartList=document.createElement("div"),this.chartList.classList.add("chart-list"),this.chartInfo=document.createElement("div"),this.chartInfo.classList.add("chart-info"),s.appendChild(this.chartList),s.appendChild(this.chartInfo),this.viewElement.appendChild(e),this.loadCharts()}onClose(){re.off("smLoadedAfter",this.smLoadHandler)}loadCharts(){const e=this.app.chartManager.loadedSM?.charts[this.gameType.id]??[],t=[];this.gameTypeDropdown.setItems(Ze.getPriority().map(a=>{const o=this.app.chartManager.loadedSM?.charts[a.id]??[];return a.id+" ("+o.length+")"})),this.gameTypeDropdown.setSelected(this.gameType.id+" ("+(this.app.chartManager.loadedSM?.charts[this.gameType.id]??[]).length+") "),e.forEach(a=>{const o=document.createElement("div");o.classList.add("chart-list-item"),o.chart=a,this.app.chartManager.loadedChart==a&&o.classList.add("selected"),o.onclick=()=>{o.chart!=this.app.chartManager.loadedChart&&(this.app.chartManager.loadChart(o.chart),this.chartList.querySelectorAll(".selected").forEach(d=>d.classList.remove("selected")),o.classList.add("selected"))},o.onmouseenter=()=>{this.loadChartDetails(o.chart)},o.onmouseleave=()=>{this.loadChartDetails()};const l=document.createElement("div");l.innerText=a.meter+"",l.classList.add("title",a.difficulty);const c=document.createElement("div");c.classList.add("chart-list-info");const u=document.createElement("div");u.innerText=a.credit,u.classList.add("title","chart-credit");const h=document.createElement("div");h.innerText=a.getNotedata().length+"",h.classList.add("title","chart-step-count"),c.appendChild(u),c.appendChild(h),o.appendChild(l),o.appendChild(c),t.push(o)});const r=document.createElement("div");r.classList.add("chart-list-item");const s=document.createElement("div");s.innerText="+",s.classList.add("title");const n=document.createElement("div");n.classList.add("chart-list-info"),n.innerText="New Blank Chart",r.appendChild(s),r.appendChild(n),r.onclick=()=>{const a=new ym(this.app.chartManager.loadedSM);a.gameType=this.gameType,this.app.chartManager.loadedSM.addChart(a),this.app.chartManager.loadChart(a),this.loadCharts()},this.chartList.replaceChildren(...t,r),this.loadChartDetails()}loadChartDetails(e){if(e=e??this.app.chartManager.loadedChart,e?.gameType.id!=this.gameType.id){this.chartInfo.replaceChildren();return}if(!e)return;const t=()=>this.app.chartManager.loadedSM.charts[e.gameType.id].sort((m,g)=>_i.indexOf(m.difficulty)==_i.indexOf(g.difficulty)?m.meter-g.meter:_i.indexOf(m.difficulty)-_i.indexOf(g.difficulty)),r=document.createElement("div");r.classList.add("chart-info-main");const s=hi.create(_i,e.difficulty);s.view.classList.add("no-border","white"),s.onChange(m=>{const g=e.difficulty;mt.instance.run({action:()=>{e.difficulty=m,t(),this.loadCharts()},undo:()=>{e.difficulty=g,t(),this.loadCharts()}})});const n=document.createElement("div");n.spellcheck=!1,n.contentEditable="true",n.classList.add("inlineEdit","chart-meter"),n.onkeydown=m=>{Rs(m)||m.preventDefault(),m.key=="Enter"&&n.blur()},n.onblur=()=>{let m=Math.round(Cc(n.innerText));m=at(1,m,2**31-1);const g=e.meter;mt.instance.run({action:()=>{e.meter=m,t(),this.loadCharts()},undo:()=>{e.meter=g,t(),this.loadCharts()}}),n.scrollLeft=0},n.innerText=e.meter+"";const a=document.createElement("div");a.classList.add("chart-properties"),r.appendChild(s.view),r.appendChild(n),Object.values(LE).forEach(m=>{const g=document.createElement("div");g.classList.add("label"),g.innerText=m.title;const y=m.element(e,this.app);m.title=="Artist"&&y.addEventListener("blur",()=>this.loadCharts()),a.appendChild(g),a.appendChild(y)});const o=e.getNotedataStats(),l=document.createElement("div");l.classList.add("chart-info-grid-item");const c=document.createElement("div");c.innerText="Peak NPS",c.classList.add("title","chart-info-grid-label");const u=document.createElement("div");u.innerText=Math.max(Math.max(...o.npsGraph),0).toFixed(2)+"",u.classList.add("title","chart-info-grid-count"),l.appendChild(c),l.appendChild(u);const h=document.createElement("div");h.classList.add("chart-info-grid"),Object.entries(o.counts).forEach(m=>{const g=document.createElement("div");g.classList.add("chart-info-grid-item");const y=document.createElement("div");y.innerText=m[0],y.classList.add("title","chart-info-grid-label");const b=document.createElement("div");b.innerText=m[1]+"",b.classList.add("title","chart-info-grid-count"),g.appendChild(y),g.appendChild(b),h.appendChild(g)});const d=document.createElement("div");d.classList.add("menu-options");const f=document.createElement("button");f.innerText="Duplicate Chart",f.onclick=()=>{const m=Object.assign(Object.create(Object.getPrototypeOf(e)),e);m.setNotedata(e.getNotedata().map(g=>e.computeNote(g))??[]),this.app.chartManager.loadedSM.addChart(m),this.app.chartManager.loadChart(m),this.loadCharts()},d.append(f);const p=document.createElement("button");p.innerText="Delete Chart",p.onclick=()=>{this.app.windowManager.openWindow(new Ic(this.app,"Delete chart","Are you sure you want to delete this chart?",[{type:"default",label:"Cancel"},{type:"delete",label:"Delete",callback:()=>{this.app.chartManager.loadedSM.removeChart(e)&&(this.app.chartManager.loadChart(),this.gameType=this.app.chartManager.loadedChart?.gameType??this.gameType,this.loadCharts())}}]))},p.classList.add("delete"),d.append(p),this.chartInfo.replaceChildren(r,a,l,h,d)}}var OE=4,FE=.001,NE=1e-7,UE=10,Sn=11,Na=1/(Sn-1),HE=typeof Float32Array=="function";function _m(i,e){return 1-3*e+3*i}function xm(i,e){return 3*e-6*i}function Am(i){return 3*i}function vo(i,e,t){return((_m(e,t)*i+xm(e,t))*i+Am(e))*i}function Em(i,e,t){return 3*_m(e,t)*i*i+2*xm(e,t)*i+Am(e)}function GE(i,e,t,r,s){var n,a,o=0;do a=e+(t-e)/2,n=vo(a,r,s)-i,n>0?t=a:e=a;while(Math.abs(n)>NE&&++o=FE?WE(l,f,e,r):p===0?f:GE(l,c,c+Na,e,r)}return function(c){return c===0?0:c===1?1:vo(o(c),t,s)}};const Yt=$n(VE),jE=Yt(0,0,1,1);function Vu(i,e){const t=e?e.split("."):[];for(;t.length&&i;){const r=t.shift(),s=new RegExp("(.+)\\[([0-9]*)\\]").exec(r);if(s!==null&&s.length==3){const n={arrName:s[1],arrIndex:s[2]};i[n.arrName]!==void 0?i=i[n.arrName][n.arrIndex]:i=void 0;continue}i=i[r]}return i}function XE(i,e,t){const r=e?e.split("."):[];for(;r.length&&i;){const s=r.shift(),n=new RegExp("(.+)\\[([0-9]*)\\]").exec(s);if(n!==null&&n.length==3){const a={arrName:n[1],arrIndex:n[2]};i[a.arrName]!==void 0&&r.length===0&&(i[a.arrName][a.arrIndex]=t);continue}i[s]===void 0&&(i[s]={}),r.length===0&&(i[s]=t),i=i[s]}return i}const ur=class ur{static updateObject(e,t,r){const s=Object.keys(t).sort((o,l)=>parseFloat(o)-parseFloat(l));let n="0";for(let o=s.length-2;o>=0;o--)if(parseFloat(s[o])<=r){n=s[o];break}let a="1";for(let o=1;or){a=s[o];break}Object.keys(t[0]).forEach(o=>{let l=t[n][o],c=t[a][o];l==="inherit"&&(t[n][o]=Vu(e,o),l=t[n][o]),c==="inherit"&&(t[a][o]=Vu(e,o),c=t[a][o]);const u=l+(r-parseFloat(n))/(parseFloat(a)-parseFloat(n))*(c-l);XE(e,o,u)})}static stop(e,t=null){e!==void 0&&(t!==null&&this.animations.get(e)?.obj&&!this.animations.get(e).obj.destroyed&&this.updateObject(this.animations.get(e).obj,this.animations.get(e).animation,t),this.animations.delete(e))}static animate(e,t,r,s,n=()=>{},a){return a||=`${++this._id}`,this.animations.set(a,{obj:e,animation:t,speed:1/(60*r),progress:0,curve:s!==void 0?s:jE,onend:n}),a}};Yo(ur,"animations",new Map),Yo(ur,"_id",0),Et.shared.add(e=>{for(const[t,r]of ur.animations.entries())r.obj._destroyed?ur.stop(t):(r.progress=Math.min(1,r.progress+r.speed*e),ur.updateObject(r.obj,r.animation,r.curve(r.progress)),r.progress>=1&&(r.onend(r.obj),ur.stop(t,1)))});let Ft=ur;const ju=[{freq:20,label:"20"},{freq:30,label:"30"},{freq:40,label:"40"},{freq:50,label:"50"},{freq:60,label:"60"},{freq:70,label:""},{freq:80,label:"80"},{freq:90,label:""},{freq:100,label:"100"},{freq:200,label:"200"},{freq:300,label:"300"},{freq:400,label:"400"},{freq:500,label:"500"},{freq:600,label:"600"},{freq:700,label:""},{freq:800,label:"800"},{freq:900,label:""},{freq:1e3,label:"1k"},{freq:2e3,label:"2k"},{freq:3e3,label:"3k"},{freq:4e3,label:"4k"},{freq:5e3,label:"5k"},{freq:6e3,label:"6k"},{freq:7e3,label:""},{freq:8e3,label:"8k"},{freq:9e3,label:""},{freq:1e4,label:"10k"},{freq:15e3,label:""},{freq:2e4,label:"20k"}],Cs=0,Ms=0,es=1200,xt=400,bo=new Array(es).fill(0).map((i,e)=>Pc(e)),YE=new Float32Array(bo);function Nh(i){return Math.log(i/20)/Math.log(1102.5)*es}function Pc(i){return Math.pow(1102.5,i/es)*20}function Un(i){return-i*6+xt/2}function Xu(i){return-(i-xt/2)/6}class KE extends Vt{app;cachedReponse=new Array(es).fill(0);onAudioLoad=this.onAudio.bind(this);points=[];constructor(e){super({title:"Audio Equalizer",width:600,height:200,win_id:"audio-eq"}),this.app=e,this.initView(),this.onAudioLoad(),re.on("audioLoaded",this.onAudioLoad)}destroy(){re.off("audioLoaded",this.onAudioLoad)}initView(){this.viewElement.replaceChildren();const e=document.createElement("canvas");e.style.width="600px",e.style.height="200px",e.onmousedown=r=>this.points.filter(s=>s.hitTest(r.offsetX*2,r.offsetY*2)).at(-1)?.mouseDown(r),this.viewElement.appendChild(e);const t=this.drawEQ(e);requestAnimationFrame(t)}onAudio(){this.points=this.app.chartManager.chartAudio.getFilters().map((e,t)=>new $E(this,t)),this.getResponse()}getResponse(){this.cachedReponse=this.app.chartManager.chartAudio.getFrequencyResponse(bo)}drawEQ(e){const t=e.getContext("2d");t.canvas.width=1200,t.canvas.height=400;const r=()=>{this.app.chartManager.chartAudio&&(t.fillStyle="rgba(0, 0, 0, 1)",t.fillRect(0,0,e.width,e.height),t.fillStyle="rgb(0, 50, 150)",this.drawFrequencies(t,this.app.chartManager.chartAudio.getFrequencyData()),t.fillStyle="rgba(0, 150, 50, 0.3)",this.drawFrequencies(t,this.app.chartManager.chartAudio.getFilteredFrequencyData()),t.fillStyle="rgba(200, 200, 200, 0.5)",this.drawResponse(t),t.fillStyle="rgba(0, 100, 150, 0.5)",t.font="22px Assistant",this.drawGrid(t),this.points.forEach(s=>s.draw(t)),e.closest("#windows")&&requestAnimationFrame(r))};return r}drawFrequencies(e,t){for(let r=0;r{this.x=(l.clientX-s)*2+t,this.canChangeGain()?this.y=(l.clientY-n)*2+r:this.y=xt/2,this.x=at(this.x,0,es),this.y=at(this.y,this.type.endsWith("shelf")?xt/4:0,this.type.endsWith("shelf")?3*xt/4:xt),this.window.app.chartManager.chartAudio.updateFilter(this.filterIndex,{frequency:Pc(this.x),gain:this.getGain()}),this.window.getResponse(),this.calcResponse()},o=()=>{Ft.animate(this,{0:{pointSize:"inherit"},1:{pointSize:.3}},.3,Yt(.11,.71,.41,.86),()=>{},`eq-point${this.filterIndex}`),this.dragging=!1,window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",o)};Ft.animate(this,{0:{pointSize:"inherit"},1:{pointSize:.9}},.3,Yt(.11,.71,.41,.86),()=>{},`eq-point${this.filterIndex}`),window.addEventListener("mousemove",a),window.addEventListener("mouseup",o)}calcResponse(){this.window.app.chartManager.chartAudio.getFilter(this.filterIndex).getFrequencyResponse(YE,this.response,this._empty)}draw(e){if(e.fillStyle=Yu[this.filterIndex]+"60",this.dragging)for(let t=0;t{navigator.clipboard.writeText(s.innerText)}),this.outputDiv=s;const n=document.createElement("div");n.classList.add("export-section-label"),n.innerText="Include",r.appendChild(n),Object.keys(this.exportOptions.include).forEach(o=>{const l=document.createElement("input");l.type="checkbox",l.checked=this.exportOptions.include[o],l.onchange=()=>{this.exportOptions.include[o]=l.checked,this.export()};const c=document.createElement("div");c.classList.add("export-label"),c.innerText=o;const u=document.createElement("div");u.replaceChildren(l,c),u.classList.add("export-option"),r.appendChild(u)});const a=document.createElement("div");a.classList.add("export-section-label"),a.innerText="Options",r.appendChild(a),Object.keys(this.exportOptions.options).forEach(o=>{const l=document.createElement("input");l.type="checkbox",l.checked=this.exportOptions.options[o],l.onchange=()=>{this.exportOptions.options[o]=l.checked,this.export()};const c=document.createElement("div");c.classList.add("export-label"),c.innerText=QE[o];const u=document.createElement("div");u.replaceChildren(l,c),u.classList.add("export-option"),r.appendChild(u)}),t.replaceChildren(r,s),e.appendChild(t),this.viewElement.appendChild(e)}export(){let e=`{ -`+this.selection.map(t=>{let r=" {";return this.exportOptions.include.Beat&&(r+=this.padNum(t.beat)+","),this.exportOptions.include.Second&&(r+=this.padNum(t.second)+","),this.exportOptions.include.Column&&(this.exportOptions.options.columnOneBased?r+=t.col+1+",":r+=t.col+","),this.exportOptions.include.Type&&(r+='"'+t.type+'",'),this.exportOptions.include.Quantization&&(r+=qE[Sc(t.beat)]+","),this.exportOptions.include.Length&&De(t)&&(this.exportOptions.options.lengthAsNumberIndex?r+=this.padNum(t.hold)+",":r+="length="+this.padNum(t.hold)+","),r.endsWith(",")&&(r=r.slice(0,-1)),r+="}",r}).join(`, + `,t=new Blob([e],{type:"application/javascript"});this._worker=new Worker(URL.createObjectURL(t)),this._worker.onmessage=r=>{const s=r.data;console.log("Finished job "+s),this.map.has(s)&&this.map.get(s)()}}static get worker(){return this._worker||this._init(),this._worker}static async writeHandle(e,t){const r=this.workID++;console.log("Starting work write "+e+", id: "+r);const s=new Promise(o=>this.map.set(r,o)),n=new TextEncoder,a=typeof t=="string"?n.encode(t):await t.arrayBuffer();return this.worker.postMessage([r,e,a]),s}}class RE{root;constructor(){SE.adapter.native&&!om().includes("Safari")?Hu().then(e=>this.root=e):Hu(Ir(()=>import("./memory-7221a3c9.js"),["./memory-7221a3c9.js","./util-849946d7.js"],import.meta.url)).then(e=>this.root=e)}async uploadHandle(e,t){let r;if(typeof t=="string"){const s=await this.getDirectoryHandle(t,{create:!0});if(!s)return;r=s}else r=t??this.root;if(e.kind=="file"){const s=await r.getFileHandle(e.name,{create:!0});await this.writeFile(s,await e.getFile())}else{const s=await r.getDirectoryHandle(e.name,{create:!0}),n=[];for await(const a of e.values())n.push(this.uploadHandle(a,s));await Promise.all(n)}}async uploadFiles(e,t){let r;if(typeof t=="string"){const s=await this.getDirectoryHandle(t,{create:!0});if(!s)return;r=s}else r=t??this.root;if(e.isFile){const s=e;if(s.name==".DS_Store")return;s.file(async n=>{const a=await r.getFileHandle(n.name,{create:!0});await this.writeHandle(a,n)})}else if(e.isDirectory){const s=e.createReader(),n=await r.getDirectoryHandle(e.name,{create:!0});for await(const a of n.values())await n.removeEntry(a.name,{recursive:!0});s.readEntries(async a=>{const o=[];for(let l=0;lr!="."&&r!="");t.indexOf("..")>-1;){const r=t.indexOf("..");if(r==0)throw Error("Path"+t.join("/")+"is invalid!");t.splice(r-1,2)}return t.join("/")}async zipDirectory(e,t){const r=t??new IE,s=Ei(e)==""?e:Zt(e),n=await this.getDirectoryHandle(s);if(n){for(const a of await this.getDirectoryFiles(n))r.file(a.name,await a.getFile());for(const a of await this.getDirectoryFolders(n)){const o=r.folder(a.name);if(!o){console.error("Failed to zip folder "+e+"/"+a.name);continue}await this.zipDirectory(e+"/"+a.name,o)}return r}}async saveDirectory(e){const t=Ei(e)==""?e:Zt(e);Oe.create("Exporting "+t+".zip");const r=await EE({_preferPolyfill:!1,suggestedName:`${t}.zip`,types:[{accept:{"application/zip":[".zip"]}}],excludeAcceptAllOption:!1}),s=await this.zipDirectory(e);s&&await s.generateAsync({type:"blob"}).then(async n=>{await this.writeHandle(r,n)})}async renameFile(e,t){if(e!=t)try{const r=await this.getDirectoryHandle(Zt(e)),s=await this.getDirectoryHandle(Zt(t),{create:!0}),n=await this.getFileHandle(e);if(!r||!s||!n)return;await this.copyToHandle(s,n,pr(t)),await r.removeEntry(pr(e))}catch(r){console.error(r)}}async renameDirectory(e,t){if(!t.startsWith(e))try{const r=await this.getDirectoryHandle(Zt(e)),s=await this.getDirectoryHandle(Zt(t),{create:!0}),n=await this.getDirectoryHandle(e);if(!r||!s||!n)return;await this.copyToHandle(s,n,pr(t)),await r.removeEntry(pr(e),{recursive:!0})}catch(r){console.error(r)}}async copyToHandle(e,t,r){try{if(t.kind=="directory"){const s=await e.getDirectoryHandle(r??t.name,{create:!0}),n=[];for await(const a of t.values())n.push(this.copyToHandle(s,a));await Promise.all(n)}else{const s=await t.getFile(),n=await e.getFileHandle(r??t.name,{create:!0});await this.writeHandle(n,s)}}catch(s){console.error(s)}}getRelativePath(e,t){const r=e.split("/"),s=t.split("/"),n=Math.min(r.length,s.length);let a=n;for(let l=0;limport("./NodeFileHandler-345e443b.js"),["./NodeFileHandler-345e443b.js","./util-849946d7.js"],import.meta.url)).NodeFileHandler:new RE;class Vt{windowManager;options;windowElement;viewElement;constructor(e){this.options=e;const t=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div"),n=document.createElement("div");if(t.appendChild(s),t.appendChild(r),t.style.width=e.width+"px",t.style.left=window.innerWidth/2-e.width/2+"px",t.style.top=window.innerHeight/2-e.height/2+"px",t.classList.add("unselectable","window"),e.win_id&&(t.dataset.win_id=e.win_id),r.classList.add("view"),r.style.height=e.height+"px",r.style.width=e.width+"px",s.classList.add("navbar"),s.appendChild(n),!e.disableClose){const a=document.createElement("img"),o=document.createElement("img");a.classList.add("unselectable"),a.draggable=!1,a.src=Ge.MINIMIZE_WINDOW,a.onclick=()=>{r.style.height!="0px"?r.style.height="0px":r.style.height=e.height+"px",this.clampPosition()},o.classList.add("unselectable"),o.draggable=!1,o.src=Ge.CLOSE_WINDOW,o.onclick=()=>this.closeWindow(),s.appendChild(a),s.appendChild(o)}n.innerText=e.title,n.classList.add("title"),t.addEventListener("mousedown",()=>this.focus()),e.blocking&&(window.addEventListener("mousedown",this.block,!0),document.getElementById("blocker").style.display="block",t.dataset.blocking="block"),n.addEventListener("mousedown",()=>{window.addEventListener("mousemove",this.handleDrag),window.addEventListener("mouseup",()=>window.removeEventListener("mousemove",this.handleDrag))}),this.focus(),t.classList.add("focused"),this.windowElement=t,this.viewElement=r}addToManager(e){this.windowManager=e,e.view.appendChild(this.windowElement),this.focus()}onClose(){}closeWindow(){this.windowManager&&(this.onClose(),this.windowManager.removeWindow(this),this.windowElement.classList.add("exiting"),window.removeEventListener("mousedown",this.block,!0),this.options.blocking&&this.windowManager.windows.filter(e=>e.options.blocking).length==0&&(document.getElementById("blocker").style.display="none"),setTimeout(()=>this.windowManager.view.removeChild(this.windowElement),40))}focus(){if(this.windowManager==null)return;this.windowManager.unfocusAll(),this.windowElement.classList.add("focused");const e=Array.from(this.windowManager.view.children).map(t=>t).filter(t=>t!=this.windowElement);e.sort((t,r)=>parseInt(t.style.zIndex)-parseInt(r.style.zIndex)),e.push(this.windowElement);for(let t=0;t{!e.target||this.windowElement.contains(e.target)||(e.stopImmediatePropagation(),e.preventDefault())};handleDrag=e=>{const t=parseInt(this.windowElement.style.left.slice(0,-2))+e.movementX,r=parseInt(this.windowElement.style.top.slice(0,-2))+e.movementY;this.windowElement.style.left=t+"px",this.windowElement.style.top=r+"px",this.clampPosition()};clampPosition(){if(this.windowManager==null)return;const e=parseInt(this.windowElement.style.left.slice(0,-2)),t=parseInt(this.windowElement.style.top.slice(0,-2)),r=this.windowManager.app.view.getBoundingClientRect();this.windowElement.style.left=Je(e,r.left,r.width-this.windowElement.clientWidth+r.left)+"px",this.windowElement.style.top=Je(t,r.top,r.height-this.windowElement.clientHeight+r.top)+"px"}}class sa extends Vt{app;dirOptions;fileDropPath="";draggedElement;draggedCopy;keyHandler;dropHandler;mouseHandler;dragHandler;constructor(e,t,r){super({title:t.title,width:500,height:400,disableClose:t.disableClose,win_id:"file_selector"+Math.random(),blocking:!0}),this.app=e,this.dirOptions=t,t.accepted_file_types||=[],this.keyHandler=this.handleKeyEvent.bind(this),this.dropHandler=this.handleDropEvent.bind(this),this.mouseHandler=this.handleMouseEvent.bind(this),this.dragHandler=this.handleDragEvent.bind(this),this.initView().then(()=>{r&&this.selectPath(r),t.onload?.()})}async initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("menu-options");const r=document.createElement("div");r.classList.add("menu-left");const s=document.createElement("div");s.classList.add("menu-right"),t.appendChild(r),t.appendChild(s);const n=document.createElement("button");n.innerText="Cancel",n.onclick=()=>{window.removeEventListener("keydown",this.keyHandler,!0),window.removeEventListener("drop",this.dropHandler,!0),this.closeWindow()};const a=document.createElement("button");a.innerText="Select",a.classList.add("confirm"),a.onclick=()=>this.confirmFile(),a.disabled=!0,r.appendChild(n),s.appendChild(a);const o=document.createElement("div");o.classList.add("dir-selector"),o.onclick=y=>{y.target==o&&this.selectElement(void 0)};const l=document.createElement("div");l.classList.add("file-options");const c=document.createElement("button"),u=document.createElement("img");u.src=Ge.ADD_FILE,u.classList.add("icon"),c.appendChild(u),c.appendChild(document.createTextNode("Upload files")),l.appendChild(c),c.onclick=async()=>{const y=this.fileDropPath,b=await AE({_preferPolyfill:!1,excludeAcceptAllOption:!1,multiple:!0}),v=this.viewElement.querySelector(".info.selected")?.dataset.path??"",E=[];for(const S of b)E.push(qe.uploadHandle(S,v));await Promise.all(E),await this.refreshDirectory(y),this.getAcceptableFile(y).then(S=>this.selectPath(S))};const h=document.createElement("button"),d=document.createElement("img");d.src=Ge.ADD_FOLDER,d.classList.add("icon"),h.appendChild(d),h.appendChild(document.createTextNode("Upload folder")),l.appendChild(h),h.onclick=async()=>{const y=this.fileDropPath,b=await xE({_preferPolyfill:!1}),v=this.viewElement.querySelector(".info.selected")?.dataset.path??"";await qe.uploadHandle(b,v),await this.refreshDirectory(y),this.getAcceptableFile(y==""?b.name:y+"/"+b.name).then(E=>this.selectPath(E))};const f=document.createElement("button");f.classList.add("rename");const p=document.createElement("img");p.src=Ge.EDIT,p.classList.add("icon"),f.appendChild(p),f.appendChild(document.createTextNode("Rename")),f.disabled=!0,f.onclick=()=>{const y=this.viewElement.querySelector(".info.selected");y?.dataset.path&&this.startEditing(y.querySelector("textarea"))},l.appendChild(f);const m=document.createElement("button");m.classList.add("delete");const g=document.createElement("img");g.src=Ge.TRASH,g.classList.add("icon"),m.appendChild(g),m.appendChild(document.createTextNode("Delete")),m.disabled=!0,m.onclick=()=>{const y=this.viewElement.querySelector(".info.selected"),b=y?.dataset.path;if(!b)return;const w=y.parentElement.classList.contains("folder");qe[w?"removeDirectory":"removeFile"](b).then(()=>{const v=this.getElement(b);v&&(v.parentElement?.remove(),m.disabled=!0,f.disabled=!0)})},l.appendChild(m),e.appendChild(o),e.appendChild(l),e.appendChild(t),this.viewElement.appendChild(e),window.addEventListener("keydown",this.keyHandler,!0),window.addEventListener("drop",this.dropHandler,!0),window.addEventListener("mousemove",this.dragHandler,!0),this.viewElement.addEventListener("dragover",this.mouseHandler),await this.createDiv("").then(y=>o.replaceChildren(...y))}async expand(e){if(!e.parentElement.classList.contains("folder"))return;e.parentElement.classList.remove("collapsed");const t=e.nextSibling;await this.createDiv(e.dataset.path).then(r=>{t.replaceChildren(...r)})}collapse(e){if(!e.parentElement.classList.contains("folder"))return;e.parentElement.classList.add("collapsed"),e.nextSibling.replaceChildren()}selectElement(e){if(this.viewElement.querySelector(".info.selected")?.classList.remove("selected"),!e){this.viewElement.querySelector(".delete").disabled=!0,this.viewElement.querySelector(".rename").disabled=!0;return}e.classList.add("selected"),Un(e,{scrollMode:"if-needed",block:"nearest",inline:"nearest"});const t=this.viewElement.querySelector("button.confirm"),r=e.dataset.path;t.disabled=!0,r&&(t.disabled=!this.acceptableFileType(r),this.viewElement.querySelector(".delete").disabled=!1,this.viewElement.querySelector(".rename").disabled=!1)}async createDiv(e){const t=await qe.getDirectoryFolders(e);let r=await qe.getDirectoryFiles(e);return t.sort((s,n)=>s.name.toLowerCase().localeCompare(n.name.toLowerCase())),r.sort((s,n)=>s.name.toLowerCase().localeCompare(n.name.toLowerCase())),r=r.filter(s=>Ei(s.name)!=".crswap"),t.map(s=>this.createBaseElement(e,s)).concat(r.map(s=>this.createBaseElement(e,s)))}createBaseElement(e,t){e!=""&&(e+="/");const r=document.createElement("div");r.classList.add("item");const s=document.createElement("div");if(s.classList.add("info"),r.appendChild(s),t.kind=="directory"){const a=document.createElement("img");a.classList.add("icon"),a.classList.add("folder-icon"),a.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAbklEQVRIie2PMQqAMAxFXwfP6qJVPIjYzcOKdUkhQ0BaCoLkLS3k818CjuN8ztApYzIDl7xvmalFsAIZuIFozKPMMrC0CAJwKIkuGVX5KdkmLEm3ci1JSlLKU49yLSmXVG1es0EANvnvInKcP/AA784fpjlWwNQAAAAASUVORK5CYII=",s.appendChild(a);const o=document.createElement("div");o.classList.add("children"),r.appendChild(o),r.classList.add("folder"),r.classList.add("collapsed"),s.addEventListener("click",l=>{const c=l.target;c?.classList.contains("options-icon")||c.tagName=="TEXTAREA"&&!c.disabled||(r.classList.contains("collapsed")?this.expand(s):this.collapse(s))})}else{this.acceptableFileType(t.name)||s.classList.add("disabled");const a=document.createElement("img");a.src=this.getIcon(t.name),a.classList.add("icon"),s.appendChild(a)}s.dataset.path=e+t.name;const n=document.createElement("textarea");return n.rows=1,n.disabled=!0,n.autocomplete="off",n.autocapitalize="off",n.spellcheck=!1,n.innerText=t.name,n.style.pointerEvents="none",n.classList.add("title"),s.appendChild(n),s.addEventListener("click",()=>this.selectElement(s)),s.addEventListener("mousedown",()=>this.startDragging(s)),s.ondblclick=()=>this.confirmFile(),r}confirmFile(){const t=this.viewElement.querySelector(".info.selected")?.dataset.path;t&&this.acceptableFileType(t)&&(this.dirOptions.callback?.(t),window.removeEventListener("keydown",this.keyHandler,!0),window.removeEventListener("drop",this.dropHandler,!0),window.removeEventListener("mousemove",this.dragHandler,!0),this.closeWindow())}acceptableFileType(e){return this.dirOptions.accepted_file_types.length==0||this.dirOptions.accepted_file_types.includes(Ei(e))}getIcon(e){const t=Ei(e);return t==""&&!e.startsWith(".")?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAY0lEQVRIiWNgGAWDCXgwMDA8ZmBg+I8DN1BqwSM8hlPFEpgh2EA4AwPDbyIc8B/qUA9SLSDHEpItIBagmMNEBQPxglELRi0YtQDVgsdQmpiiAB9GNgsFeDAQV6KSXdiNgoEBAG+iU6T/ixEpAAAAAElFTkSuQmCC":Wr.includes(t)?Ge.IMAGE_FILE:No.includes(t)?Ge.AUDIO_FILE:[".sm",".ssc"].includes(t)?Ge.SM_FILE:Ge.UNKNOWN_FILE}startEditing(e){const t=e.value,r=!!e.parentElement?.parentElement?.classList.contains("folder"),s=e.parentElement?.dataset.path??"",n=Zt(s);e.value=s.split("/").at(-1)??"",window.removeEventListener("keydown",this.keyHandler,!0),e.disabled=!1,e.style.pointerEvents="",e.focus(),e.addEventListener("keypress",a=>{a.code=="Enter"&&(a.preventDefault(),a.stopImmediatePropagation(),e.blur())},!0),e.addEventListener("blur",async()=>{if(window.addEventListener("keydown",this.keyHandler,!0),e.disabled=!0,e.style.pointerEvents="none",e.value.startsWith(".")){e.value=t;return}e.value=e.value.replaceAll("/","");const a=n==""?e.value:n+"/"+e.value;a!=s&&(e.parentElement.dataset.path=a,await qe[r?"renameDirectory":"renameFile"](s,a),this.refreshDirectory(n),e.value.length>32&&(e.value=e.value.slice(0,32)+"..."))})}async refreshDirectory(e){const t=this.viewElement.querySelector(".dir-selector");if(!t)return;let r=t.querySelector("div[data-path='"+this.escapeSelector(e)+"']")?.nextSibling;if(e==""&&(r=t),!r)return;const s=Array.from(r.parentElement.querySelectorAll(".folder:not(.collapsed)")).map(n=>n.children[0].dataset.path);await this.createDiv(e).then(n=>r.replaceChildren(...n)),await Promise.all(s.map(n=>this.expand(t.querySelector("div[data-path='"+this.escapeSelector(n)+"']"))))}getElement(e){const t=this.viewElement.querySelector(".dir-selector");return t?t.querySelector("div[data-path='"+this.escapeSelector(e)+"']"):null}async getAcceptableFile(e){const t=await qe.getDirectoryHandle(e);if(!t)return;const r=[{path:e,handle:t}];for(;r.length>0;){const s=r.shift(),n=s.handle;for await(const a of n.values()){const o=s.path==""?"":s.path+"/";if(a.kind=="directory")r.push({path:o+a.name,handle:a});else if(this.acceptableFileType(a.name))return o+a.name}}}async selectPath(e){if(!e)return;const t=this.viewElement.querySelector(".dir-selector");if(!t)return;const r=e.split("/");r.pop();const s=[];for(;r.length>0;){s.push(r.shift());const a=t.querySelector("div[data-path='"+this.escapeSelector(s.join("/"))+"']");if(!a)return;await this.expand(a)}const n=t.querySelector("div[data-path='"+this.escapeSelector(e)+"']");n&&this.selectElement(n)}handleKeyEvent(e){if(!this.windowElement.classList.contains("focused"))return;const t=this.viewElement.querySelector(".info.selected");if(t==null){if(e.code.startsWith("Arrow")){const r=this.viewElement.querySelector(".info");r&&this.selectElement(r)}return}if(e.code=="ArrowUp"){e.preventDefault(),e.stopImmediatePropagation();const r=t.parentElement;let s=r.previousSibling?.querySelector(".info");s&&!s.parentElement.classList.contains("collapsed")&&s.parentElement.classList.contains("folder")&&(s=s.parentElement.querySelector(".children").lastChild.querySelector(".info")),!s&&r.parentElement.classList.contains("children")&&(s=r.parentElement.parentElement.querySelector(".info")),s&&(this.selectElement(s),Un(s,{scrollMode:"if-needed",block:"nearest",inline:"nearest"}))}if(e.code=="ArrowDown"){e.preventDefault(),e.stopImmediatePropagation();const r=t.parentElement;let s;r.classList.contains("folder")&&!r.classList.contains("collapsed")&&(s=r.querySelector(".children").children[0].querySelector(".info")),s||(s=t.parentElement.nextSibling?.querySelector(".info")),!s&&r.parentElement.classList.contains("children")&&(s=r.parentElement.parentElement.nextSibling.querySelector(".info")),s&&(this.selectElement(s),Un(s,{scrollMode:"if-needed",block:"nearest",inline:"nearest"}))}if(e.code=="ArrowLeft"&&(e.preventDefault(),e.stopImmediatePropagation(),this.collapse(t)),e.code=="ArrowRight"&&(e.preventDefault(),e.stopImmediatePropagation(),this.expand(t)),e.code=="Enter"&&(e.preventDefault(),e.stopImmediatePropagation(),t.parentElement?.querySelector(".title")&&this.startEditing(t.parentElement?.querySelector(".title"))),e.code=="Delete"||e.code=="Backspace"){const r=this.viewElement.querySelector(".info.selected"),s=r?.dataset.path;if(!s)return;const n=r.parentElement.classList.contains("folder");qe[n?"removeDirectory":"removeFile"](s).then(()=>{const a=this.getElement(s);a&&(a.parentElement?.remove(),this.viewElement.querySelector(".delete").disabled=!0,this.viewElement.querySelector(".rename").disabled=!0)})}}startDragging(e){const t=e;t.totalMovementX=0,t.totalMovementY=0,this.draggedElement=t;const r=()=>{this.stopDragging(),window.removeEventListener("mouseup",r)};window.addEventListener("mouseup",r)}handleDragEvent(e){if(this.draggedElement){if(this.draggedElement.totalMovementX+=e.movementX,this.draggedElement.totalMovementY+=e.movementY,!this.draggedCopy)if(Math.abs(this.draggedElement.totalMovementX)+Math.abs(this.draggedElement.totalMovementY)>8){this.viewElement.addEventListener("mousemove",this.mouseHandler),this.draggedCopy=this.draggedElement.parentElement.cloneNode(!0),this.draggedCopy.style.position="fixed";const t=this.draggedElement.getBoundingClientRect();this.draggedCopy.style.top=t.top+this.draggedElement.totalMovementY+"px",this.draggedCopy.style.left=t.left+this.draggedElement.totalMovementX+"px",this.draggedCopy.style.width=t.width+"px",this.draggedCopy.style.boxShadow="3px 3px 3px #222",this.draggedCopy.querySelector(".children")&&this.draggedCopy.removeChild(this.draggedCopy.querySelector(".children")),this.viewElement.appendChild(this.draggedCopy)}else return;this.draggedCopy.style.top=parseFloat(this.draggedCopy.style.top.slice(0,-2))+e.movementY+"px",this.draggedCopy.style.left=parseFloat(this.draggedCopy.style.left.slice(0,-2))+e.movementX+"px"}}async stopDragging(){if(this.draggedCopy){this.draggedCopy.remove(),this.viewElement.removeEventListener("mousemove",this.mouseHandler);const e=this.draggedCopy.classList.contains("folder"),t=this.draggedElement.dataset.path,r=this.fileDropPath==""?pr(this.draggedElement.dataset.path):this.fileDropPath+"/"+pr(this.draggedElement.dataset.path);t!=r&&await qe[e?"renameDirectory":"renameFile"](t,r),await this.refreshDirectory(Zt(t)),await this.refreshDirectory(Zt(r)),this.viewElement.querySelector(".outlined")?.classList.remove("outlined"),this.fileDropPath=""}this.draggedCopy=void 0,this.draggedElement=void 0}handleDropEvent(e){e.preventDefault(),e.stopImmediatePropagation(),this.viewElement.querySelector(".outlined")?.classList.remove("outlined"),e.target.closest(".dir-selector")&&qe.handleDropEvent(e,this.fileDropPath).then(async t=>{await this.refreshDirectory(this.fileDropPath),this.getAcceptableFile(t??this.fileDropPath).then(r=>this.selectPath(r)),this.fileDropPath=""})}handleMouseEvent(e){const t=this.viewElement.querySelector(".dir-selector");let r=Array.from(t.querySelectorAll("div.item.folder"));const s=this.viewElement.querySelector(".outlined");r=r.filter(n=>!n.parentElement.closest(".collapsed")),r.reverse(),r.push(t);for(const n of r){const a=n.getBoundingClientRect();if(e.clientX>=a.x&&e.clientX<=a.x+a.width&&e.clientY>=a.y&&e.clientY<=a.y+a.height){s!=n&&s?.classList.remove("outlined");const o=n.querySelector(".info");this.fileDropPath=o?.dataset.path??"",n.classList.contains("dir-selector")&&(this.fileDropPath=""),n.classList.add("outlined");return}}this.viewElement.querySelector(".outlined")?.classList.remove("outlined"),this.fileDropPath=""}escapeSelector(e){return e.replaceAll(/'/g,"\\'")}}function vm(){const i=document.createElement("div");return i.spellcheck=!1,i.contentEditable="true",i.classList.add("inlineEdit"),i.onkeydown=e=>{e.key=="Enter"&&i.blur()},i}function Na(i,e){return{title:i,element:t=>{const r=vm();return r.onblur=()=>{const s=t[e];pt.instance.run({action:()=>{t[e]=r.innerText},undo:()=>{t[e]=s}}),r.scrollLeft=0},r.innerText=t[e],r}}}const DE={name:Na("Name","chartName"),credit:Na("Artist","credit"),style:Na("Style","chartStyle"),description:Na("Description","description"),music:{title:"Music File",element:(i,e)=>{const t=document.createElement("div");t.classList.add("flex-row","flex-column-gap","flex-static","hide-buttons");const r=()=>{if(s.innerText==(i.music??e.chartManager.loadedSM.properties.MUSIC??""))return;const c=e.chartManager.chartAudio.isPlaying();if(s.innerText==""||s.innerText==e.chartManager.loadedSM.properties.MUSIC){i.music=void 0,s.innerText=e.chartManager.loadedSM.properties.MUSIC+"",e.chartManager.loadAudio(),c&&e.chartManager.chartAudio.play();return}const u=i.music;pt.instance.run({action:()=>i.music=s.innerText==e.chartManager.loadedSM.properties.MUSIC?void 0:s.innerText,undo:()=>i.music=u}),e.chartManager.loadAudio(),c&&e.chartManager.chartAudio.play()},s=vm();s.style.flex="1",s.onblur=r,s.innerText=i.music??e.chartManager.loadedSM.properties.MUSIC??"";const n=document.createElement("button");n.onclick=()=>{const c=e.chartManager.smPath.split("/").slice(0,-1).join("/");if(window.nw){const u=document.createElement("input");u.type="file",u.accept="audio/*",u.onchange=()=>{s.innerText=qe.getRelativePath(c,u.value),r()},u.click()}else e.windowManager.openWindow(new sa(e,{title:"Select an audio file...",accepted_file_types:No,disableClose:!0,callback:u=>{s.innerText=qe.getRelativePath(c,u),r()}},c+"/"+(i.music??e.chartManager.loadedSM.properties.MUSIC??"")))};const a=document.createElement("img");a.classList.add("icon"),a.style.height="12px",a.src=Ge.SELECT_FILE,n.appendChild(a);const o=document.createElement("button");o.onclick=()=>{s.innerText!=(e.chartManager.loadedSM.properties.MUSIC??"")&&(s.innerText=e.chartManager.loadedSM.properties.MUSIC??"",r())};const l=document.createElement("img");return l.classList.add("icon"),l.style.height="12px",l.src=Ge.REVERT,o.appendChild(l),t.appendChild(s),t.appendChild(n),t.appendChild(o),t}}};class hi{view;items=[];selectedItem;onChangeHandlers=[];static create(e,t){return new hi(document.createElement("div"),e,t)}constructor(e,t,r){this.view=e,e.classList.add("dropdown"),this.items=t??[],this.selectedItem=r??this.items[0];const s=document.createElement("div");s.classList.add("dropdown-selected");const n=document.createElement("div");n.classList.add("dropdown-items"),n.style.height="",s.onclick=()=>{if(!s.classList.contains("disabled")){if(this.items.length==0){n.style.height="";return}this.createDropdown(),n.style.height==""?(n.style.width=Math.max(n.scrollWidth,s.clientWidth)+"px",n.style.height=n.scrollHeight+"px",Array.from(n.children).forEach((a,o)=>{a.style.animationDelay=o*.02+"s"})):n.style.height=""}},window.addEventListener("click",a=>{const o=a.target;(!o.closest(".dropdown")||o.closest(".dropdown")!=e)&&(n.style.height="")}),this.view.appendChild(s),this.view.appendChild(n),this.setSelected()}onChange(e){this.onChangeHandlers.push(e)}removeHandler(e){this.onChangeHandlers.includes(e)&&this.onChangeHandlers.splice(this.onChangeHandlers.indexOf(e),1)}setItems(e){this.items=e,e.includes(this.selectedItem)||(this.selectedItem=this.items[0],this.setSelected())}setSelected(e){this.selectedItem=e??this.selectedItem;const t=this.view.querySelector(".dropdown-selected");t.innerText=this.selectedItem?this.selectedItem+"":""}closeDropdown(){const e=this.view.querySelector(".dropdown-items");e&&(e.style.height="")}get value(){return this.selectedItem}get disabled(){return this.view.querySelector(".dropdown-selected").classList.contains("disabled")}set disabled(e){e?this.view.querySelector(".dropdown-selected").classList.add("disabled"):this.view.querySelector(".dropdown-selected").classList.remove("disabled")}createDropdown(){const e=this.view.querySelector(".dropdown-items"),t=this.items.map(r=>{const s=document.createElement("div");return s.classList.add("dropdown-item"),s.innerText=r+"",s.onclick=()=>{e.style.height="",this.selectedItem!=r&&(this.setSelected(r),this.onChangeHandlers.forEach(n=>n(r)))},s});e.replaceChildren(...t)}}class Ic extends Vt{app;buttonOptions;message;resolve;resolved=new Promise(e=>this.resolve=e);constructor(e,t,r,s){super({title:t,width:300,height:100,disableClose:!0,win_id:"confirm",blocking:!0}),this.app=e,this.message=r,this.buttonOptions=s,this.initView()}initView(){this.viewElement.replaceChildren(),this.viewElement.classList.add("confirmation");const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("label"),t.innerText=this.message,e.appendChild(t);const r=document.createElement("div");r.classList.add("menu-options"),this.buttonOptions.forEach(s=>{const n=document.createElement("button");n.innerText=s.label,n.onclick=()=>{s.callback?.(),this.resolve?.(s.label),this.closeWindow()},s.type!="default"&&n.classList.add(s.type),r.append(n)}),e.appendChild(r),this.viewElement.appendChild(e)}}class bm extends Vt{app;gameType;chartList;chartInfo;gameTypeDropdown;smLoadHandler=()=>{this.gameTypeDropdown.setItems(Ze.getPriority().map(e=>{const t=this.app.chartManager.loadedSM?.charts[e.id]??[];return e.id+" ("+t.length+")"})),this.gameTypeDropdown.setSelected(this.gameType.id+" ("+(this.app.chartManager.loadedSM?.charts[this.gameType.id]??[]).length+") "),this.gameType=this.app.chartManager.loadedChart?.gameType??this.gameType,this.loadCharts()};constructor(e,t){super({title:"Chart List",width:500,height:400,win_id:"chart_list"}),this.app=e,this.gameType=t??e.chartManager.loadedChart?.gameType??Ze.getPriority()[0],this.initView(),se.on("smLoadedAfter",this.smLoadHandler)}initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("chart-view-type-wrapper");const r=document.createElement("div");r.classList.add("chart-view-type-label"),r.innerText="Game Type:",this.gameTypeDropdown=hi.create(Ze.getPriority().map(n=>{const a=this.app.chartManager.loadedSM?.charts[n.id]??[];return n.id+" ("+a.length+")"}),this.gameType.id+" ("+(this.app.chartManager.loadedSM?.charts[this.gameType.id]??[]).length+") "),this.gameTypeDropdown.onChange(n=>{this.gameType=Ze.getGameType(n.split(" ")[0])??this.gameType,this.loadCharts()}),t.appendChild(r),t.appendChild(this.gameTypeDropdown.view);const s=document.createElement("div");s.classList.add("chart-view-scroller"),e.appendChild(t),e.appendChild(s),this.chartList=document.createElement("div"),this.chartList.classList.add("chart-list"),this.chartInfo=document.createElement("div"),this.chartInfo.classList.add("chart-info"),s.appendChild(this.chartList),s.appendChild(this.chartInfo),this.viewElement.appendChild(e),this.loadCharts()}onClose(){se.off("smLoadedAfter",this.smLoadHandler)}loadCharts(){const e=this.app.chartManager.loadedSM?.charts[this.gameType.id]??[],t=[];this.gameTypeDropdown.setItems(Ze.getPriority().map(a=>{const o=this.app.chartManager.loadedSM?.charts[a.id]??[];return a.id+" ("+o.length+")"})),this.gameTypeDropdown.setSelected(this.gameType.id+" ("+(this.app.chartManager.loadedSM?.charts[this.gameType.id]??[]).length+") "),e.forEach(a=>{const o=document.createElement("div");o.classList.add("chart-list-item"),o.chart=a,this.app.chartManager.loadedChart==a&&o.classList.add("selected"),o.onclick=()=>{o.chart!=this.app.chartManager.loadedChart&&(this.app.chartManager.loadChart(o.chart),this.chartList.querySelectorAll(".selected").forEach(d=>d.classList.remove("selected")),o.classList.add("selected"))},o.onmouseenter=()=>{this.loadChartDetails(o.chart)},o.onmouseleave=()=>{this.loadChartDetails()};const l=document.createElement("div");l.innerText=a.meter+"",l.classList.add("title",a.difficulty);const c=document.createElement("div");c.classList.add("chart-list-info");const u=document.createElement("div");u.innerText=a.credit,u.classList.add("title","chart-credit");const h=document.createElement("div");h.innerText=a.getNotedata().length+"",h.classList.add("title","chart-step-count"),c.appendChild(u),c.appendChild(h),o.appendChild(l),o.appendChild(c),t.push(o)});const r=document.createElement("div");r.classList.add("chart-list-item");const s=document.createElement("div");s.innerText="+",s.classList.add("title");const n=document.createElement("div");n.classList.add("chart-list-info"),n.innerText="New Blank Chart",r.appendChild(s),r.appendChild(n),r.onclick=()=>{const a=new gm(this.app.chartManager.loadedSM);a.gameType=this.gameType,this.app.chartManager.loadedSM.addChart(a),this.app.chartManager.loadChart(a),this.loadCharts()},this.chartList.replaceChildren(...t,r),this.loadChartDetails()}loadChartDetails(e){if(e=e??this.app.chartManager.loadedChart,e?.gameType.id!=this.gameType.id){this.chartInfo.replaceChildren();return}if(!e)return;const t=()=>this.app.chartManager.loadedSM.charts[e.gameType.id].sort((m,g)=>_i.indexOf(m.difficulty)==_i.indexOf(g.difficulty)?m.meter-g.meter:_i.indexOf(m.difficulty)-_i.indexOf(g.difficulty)),r=document.createElement("div");r.classList.add("chart-info-main");const s=hi.create(_i,e.difficulty);s.view.classList.add("no-border","white"),s.onChange(m=>{const g=e.difficulty;pt.instance.run({action:()=>{e.difficulty=m,t(),this.loadCharts()},undo:()=>{e.difficulty=g,t(),this.loadCharts()}})});const n=document.createElement("div");n.spellcheck=!1,n.contentEditable="true",n.classList.add("inlineEdit","chart-meter"),n.onkeydown=m=>{m.key=="Enter"&&n.blur()},n.onblur=()=>{let m=qn(n.innerText);if(m===null){n.innerText=e?.meter+"";return}m=Math.round(Je(1,m,2**31-1));const g=e.meter;pt.instance.run({action:()=>{e.meter=m,t(),this.loadCharts()},undo:()=>{e.meter=g,t(),this.loadCharts()}}),n.scrollLeft=0},n.innerText=e.meter+"";const a=document.createElement("div");a.classList.add("chart-properties"),r.appendChild(s.view),r.appendChild(n),Object.values(DE).forEach(m=>{const g=document.createElement("div");g.classList.add("label"),g.innerText=m.title;const y=m.element(e,this.app);m.title=="Artist"&&y.addEventListener("blur",()=>this.loadCharts()),a.appendChild(g),a.appendChild(y)});const o=e.getNotedataStats(),l=document.createElement("div");l.classList.add("chart-info-grid-item");const c=document.createElement("div");c.innerText="Peak NPS",c.classList.add("title","chart-info-grid-label");const u=document.createElement("div");u.innerText=Math.max(Math.max(...o.npsGraph),0).toFixed(2)+"",u.classList.add("title","chart-info-grid-count"),l.appendChild(c),l.appendChild(u);const h=document.createElement("div");h.classList.add("chart-info-grid"),Object.entries(o.counts).forEach(m=>{const g=document.createElement("div");g.classList.add("chart-info-grid-item");const y=document.createElement("div");y.innerText=m[0],y.classList.add("title","chart-info-grid-label");const b=document.createElement("div");b.innerText=m[1]+"",b.classList.add("title","chart-info-grid-count"),g.appendChild(y),g.appendChild(b),h.appendChild(g)});const d=document.createElement("div");d.classList.add("menu-options");const f=document.createElement("button");f.innerText="Duplicate Chart",f.onclick=()=>{const m=Object.assign(Object.create(Object.getPrototypeOf(e)),e);m.setNotedata(e.getNotedata().map(g=>e.computeNote(g))??[]),this.app.chartManager.loadedSM.addChart(m),this.app.chartManager.loadChart(m),this.loadCharts()},d.append(f);const p=document.createElement("button");p.innerText="Delete Chart",p.onclick=()=>{this.app.windowManager.openWindow(new Ic(this.app,"Delete chart","Are you sure you want to delete this chart?",[{type:"default",label:"Cancel"},{type:"delete",label:"Delete",callback:()=>{this.app.chartManager.loadedSM.removeChart(e)&&(this.app.chartManager.loadChart(),this.gameType=this.app.chartManager.loadedChart?.gameType??this.gameType,this.loadCharts())}}]))},p.classList.add("delete"),d.append(p),this.chartInfo.replaceChildren(r,a,l,h,d)}}var LE=4,OE=.001,FE=1e-7,NE=10,Cn=11,Ua=1/(Cn-1),UE=typeof Float32Array=="function";function wm(i,e){return 1-3*e+3*i}function _m(i,e){return 3*e-6*i}function xm(i){return 3*i}function bo(i,e,t){return((wm(e,t)*i+_m(e,t))*i+xm(e))*i}function Am(i,e,t){return 3*wm(e,t)*i*i+2*_m(e,t)*i+xm(e)}function HE(i,e,t,r,s){var n,a,o=0;do a=e+(t-e)/2,n=bo(a,r,s)-i,n>0?t=a:e=a;while(Math.abs(n)>FE&&++o=OE?GE(l,f,e,r):p===0?f:HE(l,c,c+Ua,e,r)}return function(c){return c===0?0:c===1?1:bo(o(c),t,s)}};const Yt=Kn(zE),VE=Yt(0,0,1,1);function Vu(i,e){const t=e?e.split("."):[];for(;t.length&&i;){const r=t.shift(),s=new RegExp("(.+)\\[([0-9]*)\\]").exec(r);if(s!==null&&s.length==3){const n={arrName:s[1],arrIndex:s[2]};i[n.arrName]!==void 0?i=i[n.arrName][n.arrIndex]:i=void 0;continue}i=i[r]}return i}function jE(i,e,t){const r=e?e.split("."):[];for(;r.length&&i;){const s=r.shift(),n=new RegExp("(.+)\\[([0-9]*)\\]").exec(s);if(n!==null&&n.length==3){const a={arrName:n[1],arrIndex:n[2]};i[a.arrName]!==void 0&&r.length===0&&(i[a.arrName][a.arrIndex]=t);continue}i[s]===void 0&&(i[s]={}),r.length===0&&(i[s]=t),i=i[s]}return i}const ur=class ur{static updateObject(e,t,r){const s=Object.keys(t).sort((o,l)=>parseFloat(o)-parseFloat(l));let n="0";for(let o=s.length-2;o>=0;o--)if(parseFloat(s[o])<=r){n=s[o];break}let a="1";for(let o=1;or){a=s[o];break}Object.keys(t[0]).forEach(o=>{let l=t[n][o],c=t[a][o];l==="inherit"&&(t[n][o]=Vu(e,o),l=t[n][o]),c==="inherit"&&(t[a][o]=Vu(e,o),c=t[a][o]);const u=l+(r-parseFloat(n))/(parseFloat(a)-parseFloat(n))*(c-l);jE(e,o,u)})}static stop(e,t=null){e!==void 0&&(t!==null&&this.animations.get(e)?.obj&&!this.animations.get(e).obj.destroyed&&this.updateObject(this.animations.get(e).obj,this.animations.get(e).animation,t),this.animations.delete(e))}static animate(e,t,r,s,n=()=>{},a){return a||=`${++this._id}`,this.animations.set(a,{obj:e,animation:t,speed:1/(60*r),progress:0,curve:s!==void 0?s:VE,onend:n}),a}};qo(ur,"animations",new Map),qo(ur,"_id",0),At.shared.add(e=>{for(const[t,r]of ur.animations.entries())r.obj._destroyed?ur.stop(t):(r.progress=Math.min(1,r.progress+r.speed*e),ur.updateObject(r.obj,r.animation,r.curve(r.progress)),r.progress>=1&&(r.onend(r.obj),ur.stop(t,1)))});let Ft=ur;const ju=[{freq:20,label:"20"},{freq:30,label:"30"},{freq:40,label:"40"},{freq:50,label:"50"},{freq:60,label:"60"},{freq:70,label:""},{freq:80,label:"80"},{freq:90,label:""},{freq:100,label:"100"},{freq:200,label:"200"},{freq:300,label:"300"},{freq:400,label:"400"},{freq:500,label:"500"},{freq:600,label:"600"},{freq:700,label:""},{freq:800,label:"800"},{freq:900,label:""},{freq:1e3,label:"1k"},{freq:2e3,label:"2k"},{freq:3e3,label:"3k"},{freq:4e3,label:"4k"},{freq:5e3,label:"5k"},{freq:6e3,label:"6k"},{freq:7e3,label:""},{freq:8e3,label:"8k"},{freq:9e3,label:""},{freq:1e4,label:"10k"},{freq:15e3,label:""},{freq:2e4,label:"20k"}],ks=0,Is=0,rs=1200,St=400,wo=new Array(rs).fill(0).map((i,e)=>Pc(e)),XE=new Float32Array(wo);function _o(i){return Math.log(i/20)/Math.log(1102.5)*rs}function Pc(i){return Math.pow(1102.5,i/rs)*20}function $r(i){return-i*6+St/2}function Xu(i){return-(i-St/2)/6}class YE extends Vt{app;cachedReponse=new Array(rs).fill(0);onAudioLoad=this.onAudio.bind(this);points=[];icons;info;trackedFilter=null;constructor(e){super({title:"Audio Equalizer",width:600,height:245,win_id:"audio-eq"}),this.app=e,this.initView(),this.onAudioLoad(),se.on("audioLoaded",this.onAudioLoad)}destroy(){se.off("audioLoaded",this.onAudioLoad)}initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("eq-container");const t=document.createElement("div");t.classList.add("icon-container"),this.app.chartManager.chartAudio.getFilters().forEach((b,w)=>{const v=document.createElementNS("http://www.w3.org/2000/svg","svg");v.dataset.src=`assets/svg/${b.type}.svg`,v.classList.add("eq-icon"),v.setAttribute("fill",Vr[w]),v.style.backgroundColor=`${Vr[w]}40`,v.setAttribute("width","36px"),v.setAttribute("height","24px"),v.onclick=()=>{this.app.chartManager.chartAudio.getFilter(w).enabled?this.app.chartManager.chartAudio.disableFilter(w):this.app.chartManager.chartAudio.enableFilter(w),this.endTrack(),this.updateIcons()},v.onmouseenter=()=>this.points[w].highlight(),v.onmouseleave=()=>this.points[w].unhighlight(),t.appendChild(v)}),this.icons=t,this.updateIcons();const r=document.createElement("canvas");r.style.width="600px",r.style.height="200px",r.onmousedown=b=>{const w=this.points.filter(v=>v.hitTest(b.offsetX*2,b.offsetY*2)).at(-1);this.endTrack(),w?.mouseDown(b)};const s=document.createElement("div");s.classList.add("eq-info-container");const n=document.createElement("div");n.classList.add("eq-info");const a=document.createElement("div");a.innerText="Type",a.classList.add("eq-info-label");const o=document.createElement("div");o.classList.add("eq-info-value"),n.replaceChildren(a,o);const l=document.createElement("div");l.classList.add("eq-info");const c=document.createElement("div");c.innerText="Frequency",c.classList.add("eq-info-label");const u=document.createElement("div");u.contentEditable="false",u.classList.add("eq-info-value","inlineEdit"),l.replaceChildren(c,u),this.setupInput(u,"frequency",20,22050," Hz");const h=document.createElement("div");h.classList.add("eq-info");const d=document.createElement("div");d.innerText="Gain",d.classList.add("eq-info-label");const f=document.createElement("div");f.contentEditable="false",f.classList.add("eq-info-value","inlineEdit"),h.replaceChildren(d,f),this.setupInput(f,"gain",-24,24," dB",1);const p=document.createElement("div");p.classList.add("eq-info");const m=document.createElement("div");m.innerText="Q",m.classList.add("eq-info-label");const g=document.createElement("div");g.contentEditable="false",g.classList.add("eq-info-value","inlineEdit"),p.replaceChildren(m,g),this.setupInput(g,"Q",1e-4,1e3,"",4),s.replaceChildren(n,l,h,p),this.info=s,e.replaceChildren(t,r,s),this.viewElement.appendChild(e);const y=this.drawEQ(r);requestAnimationFrame(y)}selectText(e){const t=window.getSelection(),r=document.createRange();!t||!r||(r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r))}setupInput(e,t,r,s,n="",a=0){let o=0;e.onfocus=()=>{o=this.app.chartManager.chartAudio.getFilter(this.trackedFilter)[t].value,e.innerText=de(o,a)+"",this.selectText(e)},e.onkeydown=l=>{if(l.key=="Enter"){e.blur();return}if(l.key=="Tab"){const u=[...e.parentElement.parentElement.children],h=u.indexOf(e.parentElement);for(let d=1;d{const c=qn(e.innerText);c!==null&&(this.app.chartManager.chartAudio.updateFilter(this.trackedFilter,{[t]:Je(c,r,s)}),this.points[this.trackedFilter].refreshPoint(),this.getResponse())})},e.onblur=()=>{qn(e.innerText)===null&&(this.app.chartManager.chartAudio.updateFilter(this.trackedFilter,{[t]:Je(o,r,s)}),this.points[this.trackedFilter].refreshPoint(),this.getResponse()),e.innerText=de(this.app.chartManager.chartAudio.getFilter(this.trackedFilter)[t].value,a)+n}}onAudio(){this.points=this.app.chartManager.chartAudio.getFilters().map((e,t)=>new $E(this,t)),this.getResponse(),this.updateIcons(),this.endTrack()}getResponse(){this.cachedReponse=this.app.chartManager.chartAudio.getFrequencyResponse(wo)}drawEQ(e){const t=e.getContext("2d");t.canvas.width=1200,t.canvas.height=400;const r=()=>{this.app.chartManager.chartAudio&&(t.fillStyle="rgb(11, 14, 26)",t.fillRect(0,0,e.width,e.height),t.fillStyle="rgb(0, 50, 150)",this.drawFrequencies(t,this.app.chartManager.chartAudio.getFrequencyData()),this.app.chartManager.chartAudio.hasFilters()&&(t.fillStyle="rgba(200, 200, 200, 0.2)",this.drawFrequencies(t,this.app.chartManager.chartAudio.getFilteredFrequencyData())),t.fillStyle="rgba(200, 200, 200, 0.5)",this.drawResponse(t),t.fillStyle="rgba(0, 100, 150, 0.5)",t.font="22px Assistant",this.drawGrid(t),this.points.forEach(s=>s.draw(t)),e.closest("#windows")&&requestAnimationFrame(r))};return r}drawFrequencies(e,t){for(let r=0;r{this.app.chartManager.chartAudio.getFilter(t).enabled?e.classList.remove("disabled"):e.classList.add("disabled")}),this.getResponse()}trackFilter(e){this.trackedFilter=e;const t=this.app.chartManager.chartAudio.getFilter(e),[r,s,n,a]=[...this.info.children].map(o=>o.children[1]);r.innerText=t.type,s.innerText=Math.round(t.frequency.value)+" Hz",n.innerText=t.type.endsWith("pass")?"-":de(t.gain.value,1)+" dB",a.innerText=t.type.endsWith("shelf")?"-":de(t.Q.value,2)+"",r.style.color=Vr[e],s.style.color=Vr[e],n.style.color=Vr[e],a.style.color=Vr[e],s.contentEditable="true",n.contentEditable=`${!t.type.endsWith("pass")}`,a.contentEditable=`${!t.type.endsWith("shelf")}`}endTrack(){setTimeout(()=>{this.trackedFilter=null,this.points.forEach(n=>n.unhighlight());const[e,t,r,s]=[...this.info.children].map(n=>n.children[1]);e.innerText="",t.innerText="",r.innerText="",s.innerText="",t.contentEditable="false",r.contentEditable="false",s.contentEditable="false"})}}const Ha=16,Vr=["#a3001b","#a34f00","#d6d606","#19c402","#02c4ba","#022fc4","#5602c4","#c402b4"];class $E{filterIndex;window;dragging=!1;x=0;y=0;type;response=new Float32Array(wo.length);_empty=new Float32Array(wo.length);highlighted=!1;pointSize=.4;constructor(e,t){this.filterIndex=t,this.window=e,this.type=this.window.app.chartManager.chartAudio.getFilter(t).type,this.x=_o(this.window.app.chartManager.chartAudio.getFilter(t).frequency.value??10),this.getY()}hitTest(e,t){return(e-this.x)*(e-this.x)+(t-this.y)*(t-this.y)<=Ha*Ha}canChangeGain(){return this.type=="lowshelf"||this.type=="highshelf"||this.type=="peaking"}canChangeQ(){return!this.type.endsWith("shelf")}getY(){this.type.endsWith("shelf")?this.y=$r(this.window.app.chartManager.chartAudio.getFilter(this.filterIndex).gain.value/2):this.canChangeGain()?this.y=$r(this.window.app.chartManager.chartAudio.getFilter(this.filterIndex).gain.value??0):this.y=St/2}getGain(){if(this.canChangeGain())return this.type.endsWith("shelf")?Xu(this.y)*2:Xu(this.y)}mouseDown(e){this.calcResponse(),this.dragging=!0,this.highlighted=!0,this.window.app.chartManager.chartAudio.getFilter(this.filterIndex).enabled||(this.window.app.chartManager.chartAudio.enableFilter(this.filterIndex),this.window.updateIcons());const t=this.x,r=this.y,s=e.clientX,n=e.clientY,a=l=>{this.x=(l.clientX-s)*2+t,this.canChangeGain()?this.y=(l.clientY-n)*2+r:this.y=St/2,this.x=Je(this.x,0,rs),this.y=Je(this.y,this.type.endsWith("shelf")?St/4:$r(24),this.type.endsWith("shelf")?3*St/4:$r(-24)),this.window.app.chartManager.chartAudio.updateFilter(this.filterIndex,{frequency:Pc(this.x),gain:this.getGain()}),this.window.getResponse(),this.window.trackFilter(this.filterIndex),this.calcResponse()};this.window.trackFilter(this.filterIndex);const o=()=>{Ft.animate(this,{0:{pointSize:"inherit"},1:{pointSize:.3}},.3,Yt(.11,.71,.41,.86),()=>{},`eq-point${this.filterIndex}`),this.dragging=!1,window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",o)};Ft.animate(this,{0:{pointSize:"inherit"},1:{pointSize:.9}},.3,Yt(.11,.71,.41,.86),()=>{},`eq-point${this.filterIndex}`),window.addEventListener("mousemove",a),window.addEventListener("mouseup",o)}calcResponse(){this.window.app.chartManager.chartAudio.getFilter(this.filterIndex).getFrequencyResponse(XE,this.response,this._empty)}draw(e){const t=this.highlighted||this.window.app.chartManager.chartAudio.getFilter(this.filterIndex).enabled?Vr[this.filterIndex]:"#888888";if(e.fillStyle=t+"60",this.dragging)for(let r=0;r{navigator.clipboard.writeText(s.innerText)}),this.outputDiv=s;const n=document.createElement("div");n.classList.add("export-section-label"),n.innerText="Include",r.appendChild(n),Object.keys(this.exportOptions.include).forEach(o=>{const l=document.createElement("input");l.type="checkbox",l.checked=this.exportOptions.include[o],l.onchange=()=>{this.exportOptions.include[o]=l.checked,this.export()};const c=document.createElement("div");c.classList.add("export-label"),c.innerText=o;const u=document.createElement("div");u.replaceChildren(l,c),u.classList.add("export-option"),r.appendChild(u)});const a=document.createElement("div");a.classList.add("export-section-label"),a.innerText="Options",r.appendChild(a),Object.keys(this.exportOptions.options).forEach(o=>{const l=document.createElement("input");l.type="checkbox",l.checked=this.exportOptions.options[o],l.onchange=()=>{this.exportOptions.options[o]=l.checked,this.export()};const c=document.createElement("div");c.classList.add("export-label"),c.innerText=KE[o];const u=document.createElement("div");u.replaceChildren(l,c),u.classList.add("export-option"),r.appendChild(u)}),t.replaceChildren(r,s),e.appendChild(t),this.viewElement.appendChild(e)}export(){let e=`{ +`+this.selection.map(t=>{let r=" {";return this.exportOptions.include.Beat&&(r+=this.padNum(t.beat)+","),this.exportOptions.include.Second&&(r+=this.padNum(t.second)+","),this.exportOptions.include.Column&&(this.exportOptions.options.columnOneBased?r+=t.col+1+",":r+=t.col+","),this.exportOptions.include.Type&&(r+='"'+t.type+'",'),this.exportOptions.include.Quantization&&(r+=qE[Cc(t.beat)]+","),this.exportOptions.include.Length&&De(t)&&(this.exportOptions.options.lengthAsNumberIndex?r+=this.padNum(t.hold)+",":r+="length="+this.padNum(t.hold)+","),r.endsWith(",")&&(r=r.slice(0,-1)),r+="}",r}).join(`, `)+` -}`;this.exportOptions.options.minify&&(e=e.replaceAll(/\s/g,"")),this.outputDiv.innerText=e}padNum(e){return this.exportOptions.options.padNumbers?(Math.round(e*1e3)/1e3).toFixed(3):Math.round(e*1e3)/1e3}}const mr={"dance-single":[{label:"Left",keys:["Left","A"]},{label:"Down",keys:["Down","S"]},{label:"Up",keys:["Up","W"]},{label:"Right",keys:["Right","D"]}],"dance-double":[{label:"P1 Left",keys:["Left"]},{label:"P1 Down",keys:["Down"]},{label:"P1 Up",keys:["Up"]},{label:"P1 Right",keys:["Right"]},{label:"P2 Left",keys:["A"]},{label:"P2 Down",keys:["S"]},{label:"P2 Up",keys:["W"]},{label:"P2 Right",keys:["D"]}],"dance-couple":[{label:"P1 Left",keys:["Left"]},{label:"P1 Down",keys:["Down"]},{label:"P1 Up",keys:["Up"]},{label:"P1 Right",keys:["Right"]},{label:"P2 Left",keys:["A"]},{label:"P2 Down",keys:["S"]},{label:"P2 Up",keys:["W"]},{label:"P2 Right",keys:["D"]}],"dance-solo":[{label:"Left",keys:["Left","A"]},{label:"UpLeft",keys:["Q"]},{label:"Down",keys:["Down","S"]},{label:"Up",keys:["Up","W"]},{label:"UpRight",keys:["E"]},{label:"Right",keys:["Right","D"]}],"dance-solodouble":[{label:"P1 Left",keys:["A"]},{label:"P1 UpLeft",keys:["Q"]},{label:"P1 Down",keys:["S"]},{label:"P1 Up",keys:["W"]},{label:"P1 UpRight",keys:["E"]},{label:"P1 Right",keys:["D"]},{label:"P2 Left",keys:["J"]},{label:"P2 UpLeft",keys:["U"]},{label:"P2 Down",keys:["K"]},{label:"P2 Up",keys:["I"]},{label:"P2 UpRight",keys:["O"]},{label:"P2 Right",keys:["L"]}],"dance-3panel":[{label:"UpLeft",keys:["Left","Q"]},{label:"Down",keys:["Down","S"]},{label:"UpRight",keys:["Right","E"]}]};class tt{static app;static userKeybinds=new Map;static userGameplayKeybinds=new Map;static load(e){this.app=e;try{this.loadKeybinds()}catch(t){console.error("Failed to load user keybinds!"),console.error(t.stack),this.userKeybinds.clear(),this.userGameplayKeybinds.clear()}window.addEventListener("keydown",t=>this.checkKey(t,"keydown")),window.addEventListener("keyup",t=>this.checkKey(t,"keyup"))}static checkKey(e,t){if(e.target.classList.contains("inlineEdit")||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLInputElement||["Meta","Control","Shift","Alt"].includes(e.key))return;const r=[];for(let a=0;a(o[u]??c.keys).some(h=>s==h));if(l!=-1){if(e.preventDefault(),this.app.windowManager.getFocusedWindow()?.options?.win_id=="keybind_options"||this.app.windowManager.isBlocked())return;this.app.chartManager[t=="keydown"?"judgeCol":"judgeColUp"](l);return}}const n=Object.keys(ht).filter(a=>{for(const o of this.getCombosForKeybind(a))if(this.compareModifiers(o.mods,r)&&o.key==s)return!0;return!1}).map(a=>ht[a]);if(n.length>0){if(n.every(a=>a.preventDefault!=!1)&&e.preventDefault(),this.app.windowManager.getFocusedWindow()?.options?.win_id=="keybind_options"||this.app.windowManager.isBlocked())return;for(const a of n){let o=a.disabled;if(o instanceof Function&&(o=o(this.app)),!o&&!(a.disableRepeat&&e.repeat)){t=="keydown"?a.callback(this.app):a.callbackKeyUp?.(this.app);return}}}}static getKeyNameFromCode(e){let t=e;return t.startsWith("Digit")&&(t=t.slice(5)),t.startsWith("Key")&&(t=t.slice(3)),t in Zu&&(t=Zu[t]),t}static getKeybindString(e){return e in ht?ht[e].combos.map(r=>this.getComboString(r)).join(" / "):(console.warn("Couldn't find keybind with id "+e),"")}static getComboString(e){const t=qa.filter(r=>e.mods.includes(r)).map(r=>a1[r]).join("");return t+(t!=""?" ":"")+e.key}static getCombosForKeybind(e){return e in ht?this.userKeybinds.get(e)??ht[e].combos:(console.log("Couldn't find keybind with id "+e),[])}static getKeysForGameType(e){const t=Ze.getGameType(e);return t?new Array(t.numCols).fill(null).map((r,s)=>this.userGameplayKeybinds.get(e)?.[s]??mr[e]?.[s].keys??[]):(console.log("Couldn't find game type with id "+e),[])}static compareModifiers(e,t){if(e.length!=t.length)return!1;for(const r of qa)if((e.includes(r)?1:0)+(t.includes(r)?1:0)==1)return!1;return!0}static compareCombos(e,t){return e.key==t.key&&this.compareModifiers(e.mods,t.mods)}static loadKeybinds(){const e=localStorage.getItem("keybinds");if(e){const r=JSON.parse(e);if(typeof r!="object")return console.error("Couldn't load keybinds from storage");for(const[s,n]of Object.entries(r)){if(!(s in ht)){console.warn("Couldn't load keybind "+s+": key doesn't exist");continue}Array.isArray(n)||console.warn("Couldn't load keybind "+s+": value is not an array"),this.userKeybinds.set(s,n.filter(a=>typeof a.key!="string"||!Array.isArray(a.mods)?(console.warn("Couldn't load keycombo for keybind "+s+": "+JSON.stringify(a)),!1):!0))}}const t=localStorage.getItem("keybindsGP");if(t){const r=JSON.parse(t);if(typeof r!="object")return console.error("Couldn't load gameplay keybinds from storage");for(const[s,n]of Object.entries(r)){if(!Ze.getGameType(s)){console.warn("Couldn't load gameplay keybinds for gameType "+s+": gameType doesn't exist");continue}Array.isArray(n)||console.warn("Couldn't load gameplay keybind "+s+": value is not an array"),this.userGameplayKeybinds.set(s,n.map((a,o)=>!Array.isArray(a)&&a!==null?(console.warn("Couldn't load gameplay keys for type "+s+" col "+o+": "+JSON.stringify(a)),null):a))}}}static clearSave(){localStorage.removeItem("keybinds"),localStorage.removeItem("keybindsGP")}static setKeybind(e,t){this.userKeybinds.has(e)||this.userKeybinds.set(e,[...ht[e].combos]),this.userKeybinds.get(e)?.push(t),this.checkIsDefault(e),this.saveKeybinds()}static removeKeybind(e,t){this.userKeybinds.has(e)||this.userKeybinds.set(e,[...ht[e].combos]),this.userKeybinds.set(e,this.userKeybinds.get(e).filter(r=>!this.compareCombos(r,t))),this.checkIsDefault(e),this.saveKeybinds()}static revertKeybind(e){this.userKeybinds.delete(e),this.saveKeybinds()}static revertGameplayKeybind(e,t){this.userGameplayKeybinds.has(e)&&(this.userGameplayKeybinds.get(e)[t]=null,this.userGameplayKeybinds.get(e).every(r=>r===null)&&this.userGameplayKeybinds.delete(e)),this.saveKeybinds()}static setGameplayKeybind(e,t,r){this.userGameplayKeybinds.has(e)||this.userGameplayKeybinds.set(e,new Array(Ze.getGameType(e).numCols).fill(null)),this.userGameplayKeybinds.get(e)[t]==null&&(this.userGameplayKeybinds.get(e)[t]=[...mr[e]?.[t].keys??[]]),this.userGameplayKeybinds.get(e)[t].push(r),this.checkIsDefaultGameplay(e,t),this.saveKeybinds()}static removeGameplayKeybind(e,t,r){this.userGameplayKeybinds.has(e)||this.userGameplayKeybinds.set(e,new Array(Ze.getGameType(e).numCols).fill(null)),this.userGameplayKeybinds.get(e)[t]==null&&(this.userGameplayKeybinds.get(e)[t]=[...mr[e]?.[t].keys??[]]),this.userGameplayKeybinds.get(e)[t]=this.userGameplayKeybinds.get(e)[t].filter(s=>s!=r),this.checkIsDefaultGameplay(e,t),this.saveKeybinds()}static checkIsDefault(e){if(!this.userKeybinds.has(e))return!0;const t=this.userKeybinds.get(e),r=[...ht[e].combos];return t.length!=r.length?!1:t.map(s=>this.getComboString(s)).sort().join("∆")==r.map(s=>this.getComboString(s)).sort().join("∆")?(this.userKeybinds.delete(e),!0):!1}static checkIsDefaultGameplay(e,t){if(!this.userGameplayKeybinds.has(e)||this.userGameplayKeybinds.get(e)[t]===null)return!0;const r=this.userGameplayKeybinds.get(e)[t],s=[...mr[e]?.[t].keys??[]];return r.length!=s.length?!1:r.sort().join("∆")==s.sort().join("∆")?(this.userGameplayKeybinds.get(e)[t]=null,this.userGameplayKeybinds.get(e).every(n=>n===null)&&this.userGameplayKeybinds.delete(e),!0):!1}static saveKeybinds(){const e={};for(const[r,s]of this.userKeybinds.entries())e[r]=s;localStorage.setItem("keybinds",JSON.stringify(e));const t={};for(const[r,s]of this.userGameplayKeybinds.entries())t[r]=s;localStorage.setItem("keybindsGP",JSON.stringify(t))}}class Tm extends Vt{app;allowMods;callback;combo={mods:[],key:""};conflictCheck;listener;constructor(e,t,r,s){super({title:"",width:300,height:168,disableClose:!0,win_id:"keyComboSelector",blocking:!0}),this.app=e,this.allowMods=t,this.callback=r,this.conflictCheck=s??(()=>[]),this.initView()}initView(){this.viewElement.replaceChildren(),this.viewElement.classList.add("confirmation");const e=document.createElement("div");e.classList.add("padding"),e.style.gap="8px";const t=document.createElement("div");t.classList.add("label"),t.innerText="Input a key combo and select Ok when finished.",e.appendChild(t);const r=document.createElement("input");r.type="text",r.disabled=!0,r.style.fontSize="18px",r.style.height="24px",r.style.flex="0",r.style.textAlign="center",e.appendChild(r);const s=document.createElement("div");s.classList.add("detail"),s.innerText="No conflicts",s.style.flex="1",e.appendChild(s);const n=document.createElement("div");n.classList.add("menu-options");const a=document.createElement("button");a.innerText="Ok",a.onclick=()=>{this.callback(this.combo),this.closeWindow()},a.classList.add("confirm"),a.disabled=!0;const o=document.createElement("button");o.innerText="Cancel",o.onclick=()=>{this.closeWindow()},n.append(a),n.append(o),e.appendChild(n),this.viewElement.appendChild(e),this.listener=l=>{if(["Meta","Control","Shift","Alt","Escape"].includes(l.key))return;if(this.combo.key=tt.getKeyNameFromCode(l.code),this.allowMods){const u=[];for(let h=0;h=3?s.innerText=`Conflicts with ${c.length} keybinds`:c.length>=1?s.innerText=`Conflicts with ${c.join(",")}`:s.innerText="No conflicts"),l.preventDefault()},window.addEventListener("keydown",this.listener)}onClose(){window.removeEventListener("keydown",this.listener)}}class JE extends Vt{app;observer;conflictMap=this.calculateConflicts();constructor(e){super({title:"Gameplay Keybind Options",width:600,height:400,disableClose:!1,win_id:"gameplay_keybind_options",blocking:!1}),this.app=e,this.initView()}initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("pref-container");const r=document.createElement("div");r.classList.add("pref-scrollers");const s=document.createElement("div");s.classList.add("pref-section-scroller");const n=document.createElement("div");n.classList.add("pref-option-scroller"),r.replaceChildren(s,n),this.observer=new IntersectionObserver(a=>{a.forEach(o=>{const l=o.target.dataset.id,c=s.querySelector(`.pref-section[data-id=${l}]`);c&&(o.intersectionRatio>0?c.classList.add("selected"):c.classList.remove("selected"))})},{}),t.replaceChildren(r),s.replaceChildren(...this.createSections()),n.replaceChildren(...this.createOptions()),e.appendChild(t),this.viewElement.appendChild(e)}createSections(){return Object.keys(Ze.getTypes()).map(e=>this.createEmptySection(e))}createOptions(){return Object.keys(Ze.getTypes()).map(e=>{const t=new Array(Ze.getTypes()[e].numCols).fill(null).map((n,a)=>this.createKeybindItem(e,a)),r=document.createElement("div");r.classList.add("pref-group"),r.dataset.id=e;const s=document.createElement("div");return s.classList.add("pref-group-label"),s.innerText=e,r.replaceChildren(s,...t),this.observer.observe(r),r})}createEmptySection(e){const t=document.createElement("div");return t.classList.add("pref-section"),t.dataset.id=e,t.innerText=e,t.onclick=()=>{t.parentElement.parentElement.querySelector(`.pref-group[data-id=${e}]`).scrollIntoView()},t}createKeybindItem(e,t){const r=document.createElement("div");r.classList.add("pref-keybind"),r.dataset.id=e+"-"+t,r.onclick=o=>{o.target.classList.contains("pref-keybind-combo")||o.target.tagName=="IMG"||this.app.windowManager.openWindow(new Tm(this.app,!1,l=>{tt.setGameplayKeybind(e,t,l.key),this.conflictMap=this.calculateConflicts(),r.replaceWith(this.createKeybindItem(e,t))},l=>{const c=this.conflictMap.get(e)?.get(l.key)?.map(u=>mr[u[0]]?.[u[1]].label??"Column "+u[1])??[];return c.includes(mr[e]?.[t].label??"Column "+t)?"self":c}))};const s=document.createElement("div");s.classList.add("pref-keybind-label"),s.innerText=mr[e]?.[t].label??"Column "+t;const n=document.createElement("img");n.src=Ge.REVERT,n.style.width="12px",n.addEventListener("click",()=>{tt.revertGameplayKeybind(e,t),this.conflictMap=this.calculateConflicts(),r.replaceWith(this.createKeybindItem(e,t))}),n.style.display=tt.checkIsDefaultGameplay(e,t)?"none":"block";const a=document.createElement("div");return a.classList.add("pref-keybind-combos"),a.replaceChildren(...tt.getKeysForGameType(e)[t].map(o=>{const l=document.createElement("button");return l.classList.add("pref-keybind-combo"),l.innerText=o,this.conflictMap.get(e).get(o).length>1&&l.classList.add("conflict"),l.onclick=()=>{tt.removeGameplayKeybind(e,t,o),this.conflictMap=this.calculateConflicts(),r.replaceWith(this.createKeybindItem(e,t))},l})),r.replaceChildren(s,n,a),r}calculateConflicts(){const e=new Map;Object.keys(Ze.getTypes()).forEach(t=>{const r=new Map;tt.getKeysForGameType(t).forEach((s,n)=>{s.forEach((a,o)=>{r.has(a)||r.set(a,[]),r.get(a).push([t,n,o])})}),e.set(t,r)}),[...this.viewElement.querySelectorAll(".pref-keybind-combo.conflict")].forEach(t=>t.classList.remove("conflict"));for(const t of e.values())for(const r of t.values())r.length!=1&&r.forEach(s=>{const n=this.viewElement.querySelector(`.pref-keybind[data-id=${s[0]}-${s[1]}] .pref-keybind-combos`);n?.children[s[2]]&&n.children[s[2]].classList.add("conflict")});return e}onClose(){this.observer?.disconnect()}}const Ls={file:{type:"menu",title:"File",options:[{type:"selection",id:"newSong"},{type:"selection",id:"openSong"},{type:"seperator"},{type:"selection",id:"save"},{type:"selection",id:"export"}]},edit:{type:"menu",title:"Edit",options:[{type:"selection",id:"cut"},{type:"selection",id:"copy"},{type:"selection",id:"paste"},{type:"seperator"},{type:"selection",id:"undo"},{type:"selection",id:"redo"},{type:"seperator"},{type:"checkbox",id:"mousePlacement",checked:()=>A.chart.mousePlacement}]},view:{type:"menu",title:"View",options:[{type:"dropdown",title:"Cursor",options:[{type:"selection",id:"cursorUp"},{type:"selection",id:"cursorDown"},{type:"seperator"},{type:"selection",id:"previousNote"},{type:"selection",id:"nextNote"},{type:"seperator"},{type:"selection",id:"previousMeasure"},{type:"selection",id:"nextMeasure"},{type:"seperator"},{type:"selection",id:"jumpChartStart"},{type:"selection",id:"jumpChartEnd"},{type:"seperator"},{type:"selection",id:"jumpSongStart"},{type:"selection",id:"jumpSongEnd"}]},{type:"dropdown",title:"Snap",options:[{type:"selection",id:"decreaseSnap"},{type:"selection",id:"increaseSnap"}]},{type:"dropdown",title:"Scroll",options:[{type:"checkbox",id:"XMod",checked:()=>!A.chart.CMod},{type:"checkbox",id:"CMod",checked:()=>A.chart.CMod},{type:"seperator"},{type:"selection",id:"increaseScrollSpeed"},{type:"selection",id:"decreaseScrollSpeed"}]},{type:"dropdown",title:"Zoom",options:[{type:"selection",id:"zoomIn"},{type:"selection",id:"zoomOut"},{type:"seperator"},{type:"selection",id:"zoomDefault"}]},{type:"dropdown",title:"Waveform",options:[{type:"checkbox",id:"renderWaveform",checked:()=>A.chart.waveform.enabled},{type:"selection",id:"waveformOptions"}]},{type:"seperator"},{type:"selection",id:"playMode"},{type:"selection",id:"playModeStart"},{type:"seperator"},{type:"selection",id:"recordMode"},{type:"selection",id:"recordModeStart"},{type:"seperator"},{type:"checkbox",id:"hideWarpedArrows",checked:()=>A.chart.hideWarpedArrows},{type:"checkbox",id:"doSpeedChanges",checked:()=>A.chart.doSpeedChanges}]},chart:{type:"menu",title:"Chart",options:[{type:"selection",id:"openChart"},{type:"seperator"},{type:"selection",id:"songProperties"},{type:"seperator"},{type:"selection",id:"timingDataRow"}]},selection:{type:"menu",title:"Selection",options:[{type:"dropdown",title:"Convert",options:[{type:"selection",id:"convertHoldsRolls"},{type:"selection",id:"convertRollsHolds"},{type:"selection",id:"swapHoldsRolls"},{type:"seperator"},{type:"selection",id:"convertHoldsTaps"},{type:"selection",id:"convertNotesMines"},{type:"selection",id:"convertNotesLifts"},{type:"selection",id:"convertTapsFakes"}]},{type:"dropdown",title:"Mirror",options:[{type:"selection",id:"mirrorHorizontally"},{type:"selection",id:"mirrorVertically"},{type:"selection",id:"mirrorBoth"}]},{type:"dropdown",title:"Stretch",options:[{type:"selection",id:"expand2to1"},{type:"selection",id:"expand3to2"},{type:"selection",id:"expand4to3"},{type:"seperator"},{type:"selection",id:"compress1to2"},{type:"selection",id:"compress2to3"},{type:"selection",id:"compress3to4"}]},{type:"seperator"},{type:"selection",id:"setSongPreview"},{type:"seperator"},{type:"selection",id:"exportNotedata"},{type:"seperator"},{type:"selection",id:"selectAll"}]},audio:{type:"menu",title:"Audio",options:[{type:"selection",id:"adjustOffset"},{type:"checkbox",id:"assistTick",checked:()=>A.audio.assistTick},{type:"checkbox",id:"metronome",checked:()=>A.audio.metronome},{type:"seperator"},{type:"dropdown",title:()=>"Master Volume ("+Math.round(A.audio.masterVolume*100)+"%)",options:[{type:"selection",id:"volumeUp"},{type:"selection",id:"volumeDown"}]},{type:"dropdown",title:()=>"Song Volume ("+Math.round(A.audio.songVolume*100)+"%)",options:[{type:"selection",id:"songVolumeUp"},{type:"selection",id:"songVolumeDown"}]},{type:"dropdown",title:()=>"Effect Volume ("+Math.round(A.audio.soundEffectVolume*100)+"%)",options:[{type:"selection",id:"effectvolumeUp"},{type:"selection",id:"effectvolumeDown"}]},{type:"dropdown",title:()=>"Playback rate ("+Math.round(A.audio.rate*100)+"%)",options:[{type:"selection",id:"rateUp"},{type:"selection",id:"rateDown"},{type:"seperator"},{type:"selection",id:"rateDefault"}]},{type:"seperator"},{type:"selection",id:"showEq"}]},preferences:{type:"menu",title:"Preferences",options:[{type:"selection",id:"options"},{type:"selection",id:"keybinds"},{type:"selection",id:"gameplayKeybinds"}]}},Ku=["cut","copy","paste","undo","redo","delete"],$u={edit:[{ids:["previousNoteType","nextNoteType","noteTypeTap","noteTypeMine","noteTypeFake","noteTypeLift","quant4","quant8","quant12","quant16","quant24","quant32","quant48","quant96","quant192"],after:"mousePlacement"}],view:[{ids:["playback","selectRegion"]}],debug:[{ids:["showFPSCounter","showDebugTimers"]}]};class Ri extends Vt{static GROUPS;app;observer;searchDropdown;conflictMap=this.calculateConflicts();constructor(e){super({title:"Keybind Options",width:600,height:400,disableClose:!1,win_id:"keybind_options",blocking:!1}),this.app=e,Ri.GROUPS||(Ri.GROUPS=Ri.createGroups()),this.initView()}initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("pref-container");const r=document.createElement("div");r.classList.add("pref-search");const s=document.createElement("input");s.classList.add("pref-search-bar"),s.type="text",s.placeholder="Search for a keybind...",s.oninput=()=>{o.replaceChildren(...this.createSections(s.value)),l.replaceChildren(...this.createOptions(s.value))};const n=hi.create(["Name","Key"],"Name");n.onChange(()=>{o.replaceChildren(...this.createSections(s.value)),l.replaceChildren(...this.createOptions(s.value))}),this.searchDropdown=n,r.replaceChildren(s,n.view);const a=document.createElement("div");a.classList.add("pref-scrollers");const o=document.createElement("div");o.classList.add("pref-section-scroller");const l=document.createElement("div");l.classList.add("pref-option-scroller"),a.replaceChildren(o,l),this.observer=new IntersectionObserver(c=>{c.forEach(u=>{const h=u.target.dataset.id,d=o.querySelector(`.pref-section[data-id=${h}]`);d&&(u.intersectionRatio>0?d.classList.add("selected"):d.classList.remove("selected"))})},{}),t.replaceChildren(r,a),o.replaceChildren(...this.createSections()),l.replaceChildren(...this.createOptions()),e.appendChild(t),this.viewElement.appendChild(e)}createSections(e=""){return Object.keys(Ri.GROUPS).filter(t=>Ri.GROUPS[t].some(r=>this.filterID(e,r))).map(t=>this.createEmptySection(Ls[t]?.title??Lh(t),t))}createOptions(e=""){return Object.keys(Ri.GROUPS).filter(t=>Ri.GROUPS[t].some(r=>this.filterID(e,r))).map(t=>{const r=Ri.GROUPS[t].filter(a=>this.filterID(e,a)).map(a=>this.createKeybindItem(a)),s=document.createElement("div");s.classList.add("pref-group"),s.dataset.id=t;const n=document.createElement("div");return n.classList.add("pref-group-label"),n.innerText=Ls[t]?.title??Lh(t),s.replaceChildren(n,...r),this.observer.observe(s),s})}static createGroups(){const e=Object.keys(ht),t={};return Object.keys(Ls).forEach(r=>{t[r]=this.expandMenubarOptions(Ls[r]).map(s=>{const n=e.indexOf(s);return n!=-1&&e.splice(n,1),s}).filter(s=>!Ku.includes(s))}),Object.keys($u).forEach(r=>{t[r]===void 0&&(t[r]=[]),$u[r].forEach(s=>{const n=s.after?t[r].findIndex(a=>s.after==a)+1:0;t[r].splice(n,0,...s.ids),s.ids.forEach(a=>{const o=e.indexOf(a);o!=-1&&e.splice(o,1)})})}),Ku.forEach(r=>{const s=e.indexOf(r);s!=-1&&e.splice(s,1)}),e.length>0&&(console.warn("Missing keybinds not shown:"),console.warn(e)),t}filterID(e,t){if((this.searchDropdown?.value??"Name")=="Name")return(ht[t].bindLabel??ht[t].label).toLowerCase().includes(e.toLowerCase());{const r=tt.getCombosForKeybind(t);if(r.some(n=>n.key.toLowerCase().includes(e.toLowerCase())))return!0;let s=e.split(" ").map(n=>n.toLowerCase());return r.some(n=>(s.includes("shift")||s.includes("⇧"))&&!n.mods.includes(Cn.SHIFT)||(s.includes("ctrl")||s.includes("control")||s.includes("⌃"))&&!n.mods.includes(Cn.CTRL)||(s.includes("meta")||s.includes("cmd")||s.includes("command")||s.includes("⌘"))&&!n.mods.includes(Cn.META)||(s.includes("alt")||s.includes("⌥"))&&!n.mods.includes(Cn.ALT)?!1:(s=s.filter(a=>!["shift","ctrl","control","meta","cmd","command","alt","⇧","⌃","⌘","⌥",""].includes(a)),s.length==0||s.length==1&&n.key.toLowerCase().includes(s[0])))}}static expandMenubarOptions(e){switch(e.type){case"menu":case"dropdown":return e.options.map(t=>this.expandMenubarOptions(t)).flat();case"selection":case"checkbox":return[e.id];case"seperator":return[]}}createEmptySection(e,t){const r=document.createElement("div");return r.classList.add("pref-section"),r.dataset.id=t,r.innerText=e,r.onclick=()=>{r.parentElement.parentElement.querySelector(`.pref-group[data-id=${t}]`).scrollIntoView()},r}createKeybindItem(e){const t=document.createElement("div");t.classList.add("pref-keybind"),t.dataset.id=e,t.onclick=a=>{a.target.classList.contains("pref-keybind-combo")||a.target.tagName=="IMG"||this.app.windowManager.openWindow(new Tm(this.app,!0,o=>{tt.setKeybind(e,o),this.conflictMap=this.calculateConflicts(),t.replaceWith(this.createKeybindItem(e))},o=>{const l=this.conflictMap.get(tt.getComboString(o))?.map(c=>c[0]).map(c=>ht[c].bindLabel??ht[c].label)??[];return l.includes(e)?"self":l}))};const r=document.createElement("div");r.classList.add("pref-keybind-label"),r.innerText=ht[e].bindLabel??ht[e].label;const s=document.createElement("img");s.src=Ge.REVERT,s.style.width="12px",s.addEventListener("click",()=>{tt.revertKeybind(e),this.conflictMap=this.calculateConflicts(),t.replaceWith(this.createKeybindItem(e))}),s.style.display=tt.checkIsDefault(e)?"none":"block";const n=document.createElement("div");return n.classList.add("pref-keybind-combos"),n.replaceChildren(...tt.getCombosForKeybind(e).map(a=>{const o=document.createElement("button");return o.classList.add("pref-keybind-combo"),o.innerText=tt.getComboString(a),this.conflictMap.get(tt.getComboString(a)).length>1&&o.classList.add("conflict"),o.onclick=()=>{tt.removeKeybind(e,a),this.conflictMap=this.calculateConflicts(),t.replaceWith(this.createKeybindItem(e))},o})),t.replaceChildren(r,s,n),t}calculateConflicts(){const e=new Map;Object.keys(ht).forEach(t=>{tt.getCombosForKeybind(t).forEach((r,s)=>{const n=tt.getComboString(r);e.has(n)||e.set(n,[]),e.get(n).push([t,s])})}),[...this.viewElement.querySelectorAll(".pref-keybind-combo.conflict")].forEach(t=>t.classList.remove("conflict"));for(const t of e.values())t.length!=1&&t.forEach(r=>{const s=this.viewElement.querySelector(`.pref-keybind[data-id=${r[0]}] .pref-keybind-combos`);s?.children[r[1]]&&s.children[r[1]].classList.add("conflict")});return e}onClose(){this.observer?.disconnect()}}const e1=["TITLE","SUBTITLE","ARTIST","TITLETRANSLIT","SUBTITLETRANSLIT","ARTISTTRANSLIT","GENRE","CREDIT","ORIGIN","BACKGROUND","BANNER","MUSIC","CDTITLE","JACKET","DISCIMAGE","CDIMAGE","PREVIEW","LYRICSPATH","SAMPLESTART","SAMPLELENGTH","SELECTABLE"];class Sm{charts={};_type;other_properties={};properties={};timingData=new gm;unloadedCharts=[];loaded;constructor(e){this.loaded=new Promise(t=>{const r=e.name.split(".").pop();r=="sm"||r=="ssc"?this._type=r:t(),e.text().then(s=>{s=s.replaceAll(/\/\/.+/g,"");const n=[...s.matchAll(/#([A-Z]+):([^;]*);/g)];let a=!1,o={};const l=[];for(const c of n)c[1]=="NOTEDATA"&&r=="ssc"||a?(a=!0,o[c[1]]=c[2],c[1]=="NOTES"&&(l.push(o),o={},a=!1)):c[1]=="NOTES"?l.push(c[2]):e1.includes(c[1])?this.properties[c[1]]=c[2]:c[1]=="OFFSET"||Jr.includes(c[1])?this.timingData.parse(c[1],c[2]):this.other_properties[c[1]]=c[2];this.timingData.reloadCache(),this.charts={};for(const c of l){let u;try{u=new ym(this,c)}catch(h){this.unloadedCharts.push(c),Oe.createFormatted(h instanceof Error?h.message:String(h),"warn");continue}this.addChart(u)}t()})})}addChart(e){this.charts[e.gameType.id]||=[],this.charts[e.gameType.id].push(e),this.charts[e.gameType.id].sort((t,r)=>_i.indexOf(t.difficulty)==_i.indexOf(r.difficulty)?t.meter-r.meter:_i.indexOf(t.difficulty)-_i.indexOf(r.difficulty))}removeChart(e){if(!this.charts[e.gameType.id])return!1;const t=this.charts[e.gameType.id].indexOf(e);return t==-1?!1:(this.charts[e.gameType.id].splice(t,1),!0)}serialize(e){let t="";e=="sm"?(this.other_properties.NITGVERSION&&(t+=this.formatProperty("NITGVERSION",this.other_properties.NITGVERSION)),t+=this.formatProperty("TITLE",this.properties.TITLE),t+=this.formatProperty("SUBTITLE",this.properties.SUBTITLE),t+=this.formatProperty("ARTIST",this.properties.ARTIST),t+=this.formatProperty("MUSIC",this.properties.MUSIC??""),t+=this.formatProperty("BANNER",this.properties.GENRE),t+=this.formatProperty("BACKGROUND",this.properties.BACKGROUND),t+=this.formatProperty("LYRICSPATH",this.properties.LYRICSPATH),t+=this.formatProperty("CDTITLE",this.properties.CDTITLE),t+=this.formatProperty("SAMPLESTART",this.properties.SAMPLESTART),t+=this.formatProperty("SAMPLELENGTH",this.properties.SAMPLELENGTH)):(t+=this.formatProperty("VERSION",this.other_properties.VERSION??.83),t+=this.formatProperty("TITLE",this.properties.TITLE),t+=this.formatProperty("SUBTITLE",this.properties.SUBTITLE),t+=this.formatProperty("ARTIST",this.properties.ARTIST),t+=this.formatProperty("TITLETRANSLIT",this.properties.TITLETRANSLIT),t+=this.formatProperty("SUBTITLETRANSLIT",this.properties.SUBTITLETRANSLIT),t+=this.formatProperty("ARTISTTRANSLIT",this.properties.ARTISTTRANSLIT),t+=this.formatProperty("GENRE",this.properties.GENRE),t+=this.formatProperty("CREDIT",this.properties.CREDIT),t+=this.formatProperty("MUSIC",this.properties.MUSIC??""),t+=this.formatProperty("BANNER",this.properties.BANNER),t+=this.formatProperty("BACKGROUND",this.properties.BACKGROUND),t+=this.formatProperty("JACKET",this.properties.JACKET),t+=this.formatProperty("DISCIMAGE",this.properties.DISCIMAGE),t+=this.formatProperty("CDIMAGE",this.properties.CDIMAGE),t+=this.formatProperty("SELECTABLE",this.properties.SELECTABLE??"YES"),t+=this.formatProperty("LYRICSPATH",this.properties.LYRICSPATH),t+=this.formatProperty("CDTITLE",this.properties.CDTITLE),t+=this.formatProperty("SAMPLESTART",this.properties.SAMPLESTART),t+=this.formatProperty("SAMPLELENGTH",this.properties.SAMPLELENGTH)),t+=this.timingData.serialize(e);for(const r in this.other_properties)r=="VERSION"||r=="NITGVERSION"||(t+=this.formatProperty(r,this.other_properties[r]));t+=` +}`;this.exportOptions.options.minify&&(e=e.replaceAll(/\s/g,"")),this.outputDiv.innerText=e}padNum(e){return this.exportOptions.options.padNumbers?(Math.round(e*1e3)/1e3).toFixed(3):Math.round(e*1e3)/1e3}}const mr={"dance-single":[{label:"Left",keys:["Left","A"]},{label:"Down",keys:["Down","S"]},{label:"Up",keys:["Up","W"]},{label:"Right",keys:["Right","D"]}],"dance-double":[{label:"P1 Left",keys:["Left"]},{label:"P1 Down",keys:["Down"]},{label:"P1 Up",keys:["Up"]},{label:"P1 Right",keys:["Right"]},{label:"P2 Left",keys:["A"]},{label:"P2 Down",keys:["S"]},{label:"P2 Up",keys:["W"]},{label:"P2 Right",keys:["D"]}],"dance-couple":[{label:"P1 Left",keys:["Left"]},{label:"P1 Down",keys:["Down"]},{label:"P1 Up",keys:["Up"]},{label:"P1 Right",keys:["Right"]},{label:"P2 Left",keys:["A"]},{label:"P2 Down",keys:["S"]},{label:"P2 Up",keys:["W"]},{label:"P2 Right",keys:["D"]}],"dance-solo":[{label:"Left",keys:["Left","A"]},{label:"UpLeft",keys:["Q"]},{label:"Down",keys:["Down","S"]},{label:"Up",keys:["Up","W"]},{label:"UpRight",keys:["E"]},{label:"Right",keys:["Right","D"]}],"dance-solodouble":[{label:"P1 Left",keys:["A"]},{label:"P1 UpLeft",keys:["Q"]},{label:"P1 Down",keys:["S"]},{label:"P1 Up",keys:["W"]},{label:"P1 UpRight",keys:["E"]},{label:"P1 Right",keys:["D"]},{label:"P2 Left",keys:["J"]},{label:"P2 UpLeft",keys:["U"]},{label:"P2 Down",keys:["K"]},{label:"P2 Up",keys:["I"]},{label:"P2 UpRight",keys:["O"]},{label:"P2 Right",keys:["L"]}],"dance-3panel":[{label:"UpLeft",keys:["Left","Q"]},{label:"Down",keys:["Down","S"]},{label:"UpRight",keys:["Right","E"]}]};class it{static app;static userKeybinds=new Map;static userGameplayKeybinds=new Map;static load(e){this.app=e;try{this.loadKeybinds()}catch(t){console.error("Failed to load user keybinds!"),console.error(t.stack),this.userKeybinds.clear(),this.userGameplayKeybinds.clear()}window.addEventListener("keydown",t=>this.checkKey(t,"keydown")),window.addEventListener("keyup",t=>this.checkKey(t,"keyup"))}static checkKey(e,t){if(e.target.classList.contains("inlineEdit")||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLInputElement||["Meta","Control","Shift","Alt"].includes(e.key))return;const r=[];for(let a=0;a(o[u]??c.keys).some(h=>s==h));if(l!=-1){if(e.preventDefault(),this.app.windowManager.getFocusedWindow()?.options?.win_id=="keybind_options"||this.app.windowManager.isBlocked())return;this.app.chartManager[t=="keydown"?"judgeCol":"judgeColUp"](l);return}}const n=Object.keys(ht).filter(a=>{for(const o of this.getCombosForKeybind(a))if(this.compareModifiers(o.mods,r)&&o.key==s)return!0;return!1}).map(a=>ht[a]);if(n.length>0){if(n.every(a=>a.preventDefault!=!1)&&e.preventDefault(),this.app.windowManager.getFocusedWindow()?.options?.win_id=="keybind_options"||this.app.windowManager.isBlocked())return;for(const a of n){let o=a.disabled;if(o instanceof Function&&(o=o(this.app)),!o&&!(a.disableRepeat&&e.repeat)){t=="keydown"?a.callback(this.app):a.callbackKeyUp?.(this.app);return}}}}static getKeyNameFromCode(e){let t=e;return t.startsWith("Digit")&&(t=t.slice(5)),t.startsWith("Key")&&(t=t.slice(3)),t in Qu&&(t=Qu[t]),t}static getKeybindString(e){return e in ht?ht[e].combos.map(r=>this.getComboString(r)).join(" / "):(console.warn("Couldn't find keybind with id "+e),"")}static getComboString(e){const t=Qa.filter(r=>e.mods.includes(r)).map(r=>nT[r]).join("");return t+(t!=""?" ":"")+e.key}static getCombosForKeybind(e){return e in ht?this.userKeybinds.get(e)??ht[e].combos:(console.log("Couldn't find keybind with id "+e),[])}static getKeysForGameType(e){const t=Ze.getGameType(e);return t?new Array(t.numCols).fill(null).map((r,s)=>this.userGameplayKeybinds.get(e)?.[s]??mr[e]?.[s].keys??[]):(console.log("Couldn't find game type with id "+e),[])}static compareModifiers(e,t){if(e.length!=t.length)return!1;for(const r of Qa)if((e.includes(r)?1:0)+(t.includes(r)?1:0)==1)return!1;return!0}static compareCombos(e,t){return e.key==t.key&&this.compareModifiers(e.mods,t.mods)}static loadKeybinds(){const e=localStorage.getItem("keybinds");if(e){const r=JSON.parse(e);if(typeof r!="object")return console.error("Couldn't load keybinds from storage");for(const[s,n]of Object.entries(r)){if(!(s in ht)){console.warn("Couldn't load keybind "+s+": key doesn't exist");continue}Array.isArray(n)||console.warn("Couldn't load keybind "+s+": value is not an array"),this.userKeybinds.set(s,n.filter(a=>typeof a.key!="string"||!Array.isArray(a.mods)?(console.warn("Couldn't load keycombo for keybind "+s+": "+JSON.stringify(a)),!1):!0))}}const t=localStorage.getItem("keybindsGP");if(t){const r=JSON.parse(t);if(typeof r!="object")return console.error("Couldn't load gameplay keybinds from storage");for(const[s,n]of Object.entries(r)){if(!Ze.getGameType(s)){console.warn("Couldn't load gameplay keybinds for gameType "+s+": gameType doesn't exist");continue}Array.isArray(n)||console.warn("Couldn't load gameplay keybind "+s+": value is not an array"),this.userGameplayKeybinds.set(s,n.map((a,o)=>!Array.isArray(a)&&a!==null?(console.warn("Couldn't load gameplay keys for type "+s+" col "+o+": "+JSON.stringify(a)),null):a))}}}static clearSave(){localStorage.removeItem("keybinds"),localStorage.removeItem("keybindsGP")}static setKeybind(e,t){this.userKeybinds.has(e)||this.userKeybinds.set(e,[...ht[e].combos]),this.userKeybinds.get(e)?.push(t),this.checkIsDefault(e),this.saveKeybinds()}static removeKeybind(e,t){this.userKeybinds.has(e)||this.userKeybinds.set(e,[...ht[e].combos]),this.userKeybinds.set(e,this.userKeybinds.get(e).filter(r=>!this.compareCombos(r,t))),this.checkIsDefault(e),this.saveKeybinds()}static revertKeybind(e){this.userKeybinds.delete(e),this.saveKeybinds()}static revertGameplayKeybind(e,t){this.userGameplayKeybinds.has(e)&&(this.userGameplayKeybinds.get(e)[t]=null,this.userGameplayKeybinds.get(e).every(r=>r===null)&&this.userGameplayKeybinds.delete(e)),this.saveKeybinds()}static setGameplayKeybind(e,t,r){this.userGameplayKeybinds.has(e)||this.userGameplayKeybinds.set(e,new Array(Ze.getGameType(e).numCols).fill(null)),this.userGameplayKeybinds.get(e)[t]==null&&(this.userGameplayKeybinds.get(e)[t]=[...mr[e]?.[t].keys??[]]),this.userGameplayKeybinds.get(e)[t].push(r),this.checkIsDefaultGameplay(e,t),this.saveKeybinds()}static removeGameplayKeybind(e,t,r){this.userGameplayKeybinds.has(e)||this.userGameplayKeybinds.set(e,new Array(Ze.getGameType(e).numCols).fill(null)),this.userGameplayKeybinds.get(e)[t]==null&&(this.userGameplayKeybinds.get(e)[t]=[...mr[e]?.[t].keys??[]]),this.userGameplayKeybinds.get(e)[t]=this.userGameplayKeybinds.get(e)[t].filter(s=>s!=r),this.checkIsDefaultGameplay(e,t),this.saveKeybinds()}static checkIsDefault(e){if(!this.userKeybinds.has(e))return!0;const t=this.userKeybinds.get(e),r=[...ht[e].combos];return t.length!=r.length?!1:t.map(s=>this.getComboString(s)).sort().join("∆")==r.map(s=>this.getComboString(s)).sort().join("∆")?(this.userKeybinds.delete(e),!0):!1}static checkIsDefaultGameplay(e,t){if(!this.userGameplayKeybinds.has(e)||this.userGameplayKeybinds.get(e)[t]===null)return!0;const r=this.userGameplayKeybinds.get(e)[t],s=[...mr[e]?.[t].keys??[]];return r.length!=s.length?!1:r.sort().join("∆")==s.sort().join("∆")?(this.userGameplayKeybinds.get(e)[t]=null,this.userGameplayKeybinds.get(e).every(n=>n===null)&&this.userGameplayKeybinds.delete(e),!0):!1}static saveKeybinds(){const e={};for(const[r,s]of this.userKeybinds.entries())e[r]=s;localStorage.setItem("keybinds",JSON.stringify(e));const t={};for(const[r,s]of this.userGameplayKeybinds.entries())t[r]=s;localStorage.setItem("keybindsGP",JSON.stringify(t))}}class Em extends Vt{app;allowMods;callback;combo={mods:[],key:""};conflictCheck;listener;constructor(e,t,r,s){super({title:"",width:300,height:168,disableClose:!0,win_id:"keyComboSelector",blocking:!0}),this.app=e,this.allowMods=t,this.callback=r,this.conflictCheck=s??(()=>[]),this.initView()}initView(){this.viewElement.replaceChildren(),this.viewElement.classList.add("confirmation");const e=document.createElement("div");e.classList.add("padding"),e.style.gap="8px";const t=document.createElement("div");t.classList.add("label"),t.innerText="Input a key combo and select Ok when finished.",e.appendChild(t);const r=document.createElement("input");r.type="text",r.disabled=!0,r.style.fontSize="18px",r.style.height="24px",r.style.flex="0",r.style.textAlign="center",e.appendChild(r);const s=document.createElement("div");s.classList.add("detail"),s.innerText="No conflicts",s.style.flex="1",e.appendChild(s);const n=document.createElement("div");n.classList.add("menu-options");const a=document.createElement("button");a.innerText="Ok",a.onclick=()=>{this.callback(this.combo),this.closeWindow()},a.classList.add("confirm"),a.disabled=!0;const o=document.createElement("button");o.innerText="Cancel",o.onclick=()=>{this.closeWindow()},n.append(a),n.append(o),e.appendChild(n),this.viewElement.appendChild(e),this.listener=l=>{if(["Meta","Control","Shift","Alt","Escape"].includes(l.key))return;if(this.combo.key=it.getKeyNameFromCode(l.code),this.allowMods){const u=[];for(let h=0;h=3?s.innerText=`Conflicts with ${c.length} keybinds`:c.length>=1?s.innerText=`Conflicts with ${c.join(",")}`:s.innerText="No conflicts"),l.preventDefault()},window.addEventListener("keydown",this.listener)}onClose(){window.removeEventListener("keydown",this.listener)}}class ZE extends Vt{app;observer;conflictMap=this.calculateConflicts();constructor(e){super({title:"Gameplay Keybind Options",width:600,height:400,disableClose:!1,win_id:"gameplay_keybind_options",blocking:!1}),this.app=e,this.initView()}initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("pref-container");const r=document.createElement("div");r.classList.add("pref-scrollers");const s=document.createElement("div");s.classList.add("pref-section-scroller");const n=document.createElement("div");n.classList.add("pref-option-scroller"),r.replaceChildren(s,n),this.observer=new IntersectionObserver(a=>{a.forEach(o=>{const l=o.target.dataset.id,c=s.querySelector(`.pref-section[data-id=${l}]`);c&&(o.intersectionRatio>0?c.classList.add("selected"):c.classList.remove("selected"))})},{}),t.replaceChildren(r),s.replaceChildren(...this.createSections()),n.replaceChildren(...this.createOptions()),e.appendChild(t),this.viewElement.appendChild(e)}createSections(){return Object.keys(Ze.getTypes()).map(e=>this.createEmptySection(e))}createOptions(){return Object.keys(Ze.getTypes()).map(e=>{const t=new Array(Ze.getTypes()[e].numCols).fill(null).map((n,a)=>this.createKeybindItem(e,a)),r=document.createElement("div");r.classList.add("pref-group"),r.dataset.id=e;const s=document.createElement("div");return s.classList.add("pref-group-label"),s.innerText=e,r.replaceChildren(s,...t),this.observer.observe(r),r})}createEmptySection(e){const t=document.createElement("div");return t.classList.add("pref-section"),t.dataset.id=e,t.innerText=e,t.onclick=()=>{t.parentElement.parentElement.querySelector(`.pref-group[data-id=${e}]`).scrollIntoView()},t}createKeybindItem(e,t){const r=document.createElement("div");r.classList.add("pref-keybind"),r.dataset.id=e+"-"+t,r.onclick=o=>{o.target.classList.contains("pref-keybind-combo")||o.target.tagName=="IMG"||this.app.windowManager.openWindow(new Em(this.app,!1,l=>{it.setGameplayKeybind(e,t,l.key),this.conflictMap=this.calculateConflicts(),r.replaceWith(this.createKeybindItem(e,t))},l=>{const c=this.conflictMap.get(e)?.get(l.key)?.map(u=>mr[u[0]]?.[u[1]].label??"Column "+u[1])??[];return c.includes(mr[e]?.[t].label??"Column "+t)?"self":c}))};const s=document.createElement("div");s.classList.add("pref-keybind-label"),s.innerText=mr[e]?.[t].label??"Column "+t;const n=document.createElement("img");n.src=Ge.REVERT,n.style.width="12px",n.addEventListener("click",()=>{it.revertGameplayKeybind(e,t),this.conflictMap=this.calculateConflicts(),r.replaceWith(this.createKeybindItem(e,t))}),n.style.display=it.checkIsDefaultGameplay(e,t)?"none":"block";const a=document.createElement("div");return a.classList.add("pref-keybind-combos"),a.replaceChildren(...it.getKeysForGameType(e)[t].map(o=>{const l=document.createElement("button");return l.classList.add("pref-keybind-combo"),l.innerText=o,this.conflictMap.get(e).get(o).length>1&&l.classList.add("conflict"),l.onclick=()=>{it.removeGameplayKeybind(e,t,o),this.conflictMap=this.calculateConflicts(),r.replaceWith(this.createKeybindItem(e,t))},l})),r.replaceChildren(s,n,a),r}calculateConflicts(){const e=new Map;Object.keys(Ze.getTypes()).forEach(t=>{const r=new Map;it.getKeysForGameType(t).forEach((s,n)=>{s.forEach((a,o)=>{r.has(a)||r.set(a,[]),r.get(a).push([t,n,o])})}),e.set(t,r)}),[...this.viewElement.querySelectorAll(".pref-keybind-combo.conflict")].forEach(t=>t.classList.remove("conflict"));for(const t of e.values())for(const r of t.values())r.length!=1&&r.forEach(s=>{const n=this.viewElement.querySelector(`.pref-keybind[data-id=${s[0]}-${s[1]}] .pref-keybind-combos`);n?.children[s[2]]&&n.children[s[2]].classList.add("conflict")});return e}onClose(){this.observer?.disconnect()}}const Os={file:{type:"menu",title:"File",options:[{type:"selection",id:"newSong"},{type:"selection",id:"openSong"},{type:"seperator"},{type:"selection",id:"save"},{type:"selection",id:"export"}]},edit:{type:"menu",title:"Edit",options:[{type:"selection",id:"cut"},{type:"selection",id:"copy"},{type:"selection",id:"paste"},{type:"seperator"},{type:"selection",id:"undo"},{type:"selection",id:"redo"},{type:"seperator"},{type:"checkbox",id:"mousePlacement",checked:()=>A.chart.mousePlacement}]},view:{type:"menu",title:"View",options:[{type:"dropdown",title:"Cursor",options:[{type:"selection",id:"cursorUp"},{type:"selection",id:"cursorDown"},{type:"seperator"},{type:"selection",id:"previousNote"},{type:"selection",id:"nextNote"},{type:"seperator"},{type:"selection",id:"previousMeasure"},{type:"selection",id:"nextMeasure"},{type:"seperator"},{type:"selection",id:"jumpChartStart"},{type:"selection",id:"jumpChartEnd"},{type:"seperator"},{type:"selection",id:"jumpSongStart"},{type:"selection",id:"jumpSongEnd"}]},{type:"dropdown",title:"Snap",options:[{type:"selection",id:"decreaseSnap"},{type:"selection",id:"increaseSnap"}]},{type:"dropdown",title:"Scroll",options:[{type:"checkbox",id:"XMod",checked:()=>!A.chart.CMod},{type:"checkbox",id:"CMod",checked:()=>A.chart.CMod},{type:"seperator"},{type:"selection",id:"increaseScrollSpeed"},{type:"selection",id:"decreaseScrollSpeed"}]},{type:"dropdown",title:"Zoom",options:[{type:"selection",id:"zoomIn"},{type:"selection",id:"zoomOut"},{type:"seperator"},{type:"selection",id:"zoomDefault"}]},{type:"dropdown",title:"Waveform",options:[{type:"checkbox",id:"renderWaveform",checked:()=>A.chart.waveform.enabled},{type:"selection",id:"waveformOptions"}]},{type:"seperator"},{type:"selection",id:"playMode"},{type:"selection",id:"playModeStart"},{type:"seperator"},{type:"selection",id:"recordMode"},{type:"selection",id:"recordModeStart"},{type:"seperator"},{type:"checkbox",id:"hideWarpedArrows",checked:()=>A.chart.hideWarpedArrows},{type:"checkbox",id:"doSpeedChanges",checked:()=>A.chart.doSpeedChanges}]},chart:{type:"menu",title:"Chart",options:[{type:"selection",id:"openChart"},{type:"seperator"},{type:"selection",id:"songProperties"},{type:"seperator"},{type:"selection",id:"timingDataRow"}]},selection:{type:"menu",title:"Selection",options:[{type:"dropdown",title:"Convert",options:[{type:"selection",id:"convertHoldsRolls"},{type:"selection",id:"convertRollsHolds"},{type:"selection",id:"swapHoldsRolls"},{type:"seperator"},{type:"selection",id:"convertHoldsTaps"},{type:"selection",id:"convertTapsMines"},{type:"selection",id:"convertTapsLifts"},{type:"selection",id:"convertTapsFakes"}]},{type:"dropdown",title:"Mirror",options:[{type:"selection",id:"mirrorHorizontally"},{type:"selection",id:"mirrorVertically"},{type:"selection",id:"mirrorBoth"}]},{type:"dropdown",title:"Stretch",options:[{type:"selection",id:"expand2to1"},{type:"selection",id:"expand3to2"},{type:"selection",id:"expand4to3"},{type:"seperator"},{type:"selection",id:"compress1to2"},{type:"selection",id:"compress2to3"},{type:"selection",id:"compress3to4"}]},{type:"seperator"},{type:"selection",id:"setSongPreview"},{type:"seperator"},{type:"selection",id:"exportNotedata"},{type:"seperator"},{type:"selection",id:"selectAll"}]},audio:{type:"menu",title:"Audio",options:[{type:"selection",id:"adjustOffset"},{type:"checkbox",id:"assistTick",checked:()=>A.audio.assistTick},{type:"checkbox",id:"metronome",checked:()=>A.audio.metronome},{type:"seperator"},{type:"dropdown",title:()=>"Master Volume ("+Math.round(A.audio.masterVolume*100)+"%)",options:[{type:"selection",id:"volumeUp"},{type:"selection",id:"volumeDown"}]},{type:"dropdown",title:()=>"Song Volume ("+Math.round(A.audio.songVolume*100)+"%)",options:[{type:"selection",id:"songVolumeUp"},{type:"selection",id:"songVolumeDown"}]},{type:"dropdown",title:()=>"Effect Volume ("+Math.round(A.audio.soundEffectVolume*100)+"%)",options:[{type:"selection",id:"effectvolumeUp"},{type:"selection",id:"effectvolumeDown"}]},{type:"dropdown",title:()=>"Playback rate ("+Math.round(A.audio.rate*100)+"%)",options:[{type:"selection",id:"rateUp"},{type:"selection",id:"rateDown"},{type:"seperator"},{type:"selection",id:"rateDefault"}]},{type:"seperator"},{type:"selection",id:"showEq"}]},preferences:{type:"menu",title:"Preferences",options:[{type:"selection",id:"options"},{type:"selection",id:"keybinds"},{type:"selection",id:"gameplayKeybinds"}]}},Yu=["cut","copy","paste","undo","redo","delete"],$u={edit:[{ids:["previousNoteType","nextNoteType","noteTypeTap","noteTypeMine","noteTypeFake","noteTypeLift","quant4","quant8","quant12","quant16","quant24","quant32","quant48","quant96","quant192"],after:"mousePlacement"}],view:[{ids:["playback","selectRegion"]}],debug:[{ids:["showFPSCounter","showDebugTimers"]}]};class Di extends Vt{static GROUPS;app;observer;searchDropdown;conflictMap=this.calculateConflicts();constructor(e){super({title:"Keybind Options",width:600,height:400,disableClose:!1,win_id:"keybind_options",blocking:!1}),this.app=e,Di.GROUPS||(Di.GROUPS=Di.createGroups()),this.initView()}initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("pref-container");const r=document.createElement("div");r.classList.add("pref-search");const s=document.createElement("input");s.classList.add("pref-search-bar"),s.type="text",s.placeholder="Search for a keybind...",s.oninput=()=>{o.replaceChildren(...this.createSections(s.value)),l.replaceChildren(...this.createOptions(s.value))};const n=hi.create(["Name","Key"],"Name");n.onChange(()=>{o.replaceChildren(...this.createSections(s.value)),l.replaceChildren(...this.createOptions(s.value))}),this.searchDropdown=n,r.replaceChildren(s,n.view);const a=document.createElement("div");a.classList.add("pref-scrollers");const o=document.createElement("div");o.classList.add("pref-section-scroller");const l=document.createElement("div");l.classList.add("pref-option-scroller"),a.replaceChildren(o,l),this.observer=new IntersectionObserver(c=>{c.forEach(u=>{const h=u.target.dataset.id,d=o.querySelector(`.pref-section[data-id=${h}]`);d&&(u.intersectionRatio>0?d.classList.add("selected"):d.classList.remove("selected"))})},{}),t.replaceChildren(r,a),o.replaceChildren(...this.createSections()),l.replaceChildren(...this.createOptions()),e.appendChild(t),this.viewElement.appendChild(e)}createSections(e=""){return Object.keys(Di.GROUPS).filter(t=>Di.GROUPS[t].some(r=>this.filterID(e,r))).map(t=>this.createEmptySection(Os[t]?.title??Fh(t),t))}createOptions(e=""){return Object.keys(Di.GROUPS).filter(t=>Di.GROUPS[t].some(r=>this.filterID(e,r))).map(t=>{const r=Di.GROUPS[t].filter(a=>this.filterID(e,a)).map(a=>this.createKeybindItem(a)),s=document.createElement("div");s.classList.add("pref-group"),s.dataset.id=t;const n=document.createElement("div");return n.classList.add("pref-group-label"),n.innerText=Os[t]?.title??Fh(t),s.replaceChildren(n,...r),this.observer.observe(s),s})}static createGroups(){const e=Object.keys(ht),t={};return Object.keys(Os).forEach(r=>{t[r]=this.expandMenubarOptions(Os[r]).map(s=>{const n=e.indexOf(s);return n!=-1&&e.splice(n,1),s}).filter(s=>!Yu.includes(s))}),Object.keys($u).forEach(r=>{t[r]===void 0&&(t[r]=[]),$u[r].forEach(s=>{const n=s.after?t[r].findIndex(a=>s.after==a)+1:0;t[r].splice(n,0,...s.ids),s.ids.forEach(a=>{const o=e.indexOf(a);o!=-1&&e.splice(o,1)})})}),Yu.forEach(r=>{const s=e.indexOf(r);s!=-1&&e.splice(s,1)}),e.length>0&&(console.warn("Missing keybinds not shown:"),console.warn(e)),t}filterID(e,t){if((this.searchDropdown?.value??"Name")=="Name")return(ht[t].bindLabel??ht[t].label).toLowerCase().includes(e.toLowerCase());{const r=it.getCombosForKeybind(t);if(r.some(n=>n.key.toLowerCase().includes(e.toLowerCase())))return!0;let s=e.split(" ").map(n=>n.toLowerCase());return r.some(n=>(s.includes("shift")||s.includes("⇧"))&&!n.mods.includes(Mn.SHIFT)||(s.includes("ctrl")||s.includes("control")||s.includes("⌃"))&&!n.mods.includes(Mn.CTRL)||(s.includes("meta")||s.includes("cmd")||s.includes("command")||s.includes("⌘"))&&!n.mods.includes(Mn.META)||(s.includes("alt")||s.includes("⌥"))&&!n.mods.includes(Mn.ALT)?!1:(s=s.filter(a=>!["shift","ctrl","control","meta","cmd","command","alt","⇧","⌃","⌘","⌥",""].includes(a)),s.length==0||s.length==1&&n.key.toLowerCase().includes(s[0])))}}static expandMenubarOptions(e){switch(e.type){case"menu":case"dropdown":return e.options.map(t=>this.expandMenubarOptions(t)).flat();case"selection":case"checkbox":return[e.id];case"seperator":return[]}}createEmptySection(e,t){const r=document.createElement("div");return r.classList.add("pref-section"),r.dataset.id=t,r.innerText=e,r.onclick=()=>{r.parentElement.parentElement.querySelector(`.pref-group[data-id=${t}]`).scrollIntoView()},r}createKeybindItem(e){const t=document.createElement("div");t.classList.add("pref-keybind"),t.dataset.id=e,t.onclick=a=>{a.target.classList.contains("pref-keybind-combo")||a.target.tagName=="IMG"||this.app.windowManager.openWindow(new Em(this.app,!0,o=>{it.setKeybind(e,o),this.conflictMap=this.calculateConflicts(),t.replaceWith(this.createKeybindItem(e))},o=>{const l=this.conflictMap.get(it.getComboString(o))?.map(c=>c[0]).map(c=>ht[c].bindLabel??ht[c].label)??[];return l.includes(e)?"self":l}))};const r=document.createElement("div");r.classList.add("pref-keybind-label"),r.innerText=ht[e].bindLabel??ht[e].label;const s=document.createElement("img");s.src=Ge.REVERT,s.style.width="12px",s.addEventListener("click",()=>{it.revertKeybind(e),this.conflictMap=this.calculateConflicts(),t.replaceWith(this.createKeybindItem(e))}),s.style.display=it.checkIsDefault(e)?"none":"block";const n=document.createElement("div");return n.classList.add("pref-keybind-combos"),n.replaceChildren(...it.getCombosForKeybind(e).map(a=>{const o=document.createElement("button");return o.classList.add("pref-keybind-combo"),o.innerText=it.getComboString(a),this.conflictMap.get(it.getComboString(a)).length>1&&o.classList.add("conflict"),o.onclick=()=>{it.removeKeybind(e,a),this.conflictMap=this.calculateConflicts(),t.replaceWith(this.createKeybindItem(e))},o})),t.replaceChildren(r,s,n),t}calculateConflicts(){const e=new Map;Object.keys(ht).forEach(t=>{it.getCombosForKeybind(t).forEach((r,s)=>{const n=it.getComboString(r);e.has(n)||e.set(n,[]),e.get(n).push([t,s])})}),[...this.viewElement.querySelectorAll(".pref-keybind-combo.conflict")].forEach(t=>t.classList.remove("conflict"));for(const t of e.values())t.length!=1&&t.forEach(r=>{const s=this.viewElement.querySelector(`.pref-keybind[data-id=${r[0]}] .pref-keybind-combos`);s?.children[r[1]]&&s.children[r[1]].classList.add("conflict")});return e}onClose(){this.observer?.disconnect()}}const JE=["TITLE","SUBTITLE","ARTIST","TITLETRANSLIT","SUBTITLETRANSLIT","ARTISTTRANSLIT","GENRE","CREDIT","ORIGIN","BACKGROUND","BANNER","MUSIC","CDTITLE","JACKET","DISCIMAGE","CDIMAGE","PREVIEW","LYRICSPATH","SAMPLESTART","SAMPLELENGTH","SELECTABLE"];class Tm{charts={};_type;other_properties={};properties={};timingData=new mm;unloadedCharts=[];loaded;constructor(e){this.loaded=new Promise(t=>{const r=e.name.split(".").pop();r=="sm"||r=="ssc"?this._type=r:t(),e.text().then(s=>{s=s.replaceAll(/\/\/.+/g,"");const n=[...s.matchAll(/#([A-Z]+):([^;]*);/g)];let a=!1,o={};const l=[];for(const c of n)c[1]=="NOTEDATA"&&r=="ssc"||a?(a=!0,o[c[1]]=c[2],c[1]=="NOTES"&&(l.push(o),o={},a=!1)):c[1]=="NOTES"?l.push(c[2]):JE.includes(c[1])?this.properties[c[1]]=c[2]:c[1]=="OFFSET"||is.includes(c[1])?this.timingData.parse(c[1],c[2]):this.other_properties[c[1]]=c[2];this.timingData.reloadCache(),this.charts={};for(const c of l){let u;try{u=new gm(this,c)}catch(h){this.unloadedCharts.push(c),Oe.createFormatted(h instanceof Error?h.message:String(h),"warn");continue}this.addChart(u)}t()})})}addChart(e){this.charts[e.gameType.id]||=[],this.charts[e.gameType.id].push(e),this.charts[e.gameType.id].sort((t,r)=>_i.indexOf(t.difficulty)==_i.indexOf(r.difficulty)?t.meter-r.meter:_i.indexOf(t.difficulty)-_i.indexOf(r.difficulty))}removeChart(e){if(!this.charts[e.gameType.id])return!1;const t=this.charts[e.gameType.id].indexOf(e);return t==-1?!1:(this.charts[e.gameType.id].splice(t,1),!0)}serialize(e){let t="";e=="sm"?(this.other_properties.NITGVERSION&&(t+=this.formatProperty("NITGVERSION",this.other_properties.NITGVERSION)),t+=this.formatProperty("TITLE",this.properties.TITLE),t+=this.formatProperty("SUBTITLE",this.properties.SUBTITLE),t+=this.formatProperty("ARTIST",this.properties.ARTIST),t+=this.formatProperty("MUSIC",this.properties.MUSIC??""),t+=this.formatProperty("BANNER",this.properties.GENRE),t+=this.formatProperty("BACKGROUND",this.properties.BACKGROUND),t+=this.formatProperty("LYRICSPATH",this.properties.LYRICSPATH),t+=this.formatProperty("CDTITLE",this.properties.CDTITLE),t+=this.formatProperty("SAMPLESTART",this.properties.SAMPLESTART),t+=this.formatProperty("SAMPLELENGTH",this.properties.SAMPLELENGTH)):(t+=this.formatProperty("VERSION",this.other_properties.VERSION??.83),t+=this.formatProperty("TITLE",this.properties.TITLE),t+=this.formatProperty("SUBTITLE",this.properties.SUBTITLE),t+=this.formatProperty("ARTIST",this.properties.ARTIST),t+=this.formatProperty("TITLETRANSLIT",this.properties.TITLETRANSLIT),t+=this.formatProperty("SUBTITLETRANSLIT",this.properties.SUBTITLETRANSLIT),t+=this.formatProperty("ARTISTTRANSLIT",this.properties.ARTISTTRANSLIT),t+=this.formatProperty("GENRE",this.properties.GENRE),t+=this.formatProperty("CREDIT",this.properties.CREDIT),t+=this.formatProperty("MUSIC",this.properties.MUSIC??""),t+=this.formatProperty("BANNER",this.properties.BANNER),t+=this.formatProperty("BACKGROUND",this.properties.BACKGROUND),t+=this.formatProperty("JACKET",this.properties.JACKET),t+=this.formatProperty("DISCIMAGE",this.properties.DISCIMAGE),t+=this.formatProperty("CDIMAGE",this.properties.CDIMAGE),t+=this.formatProperty("SELECTABLE",this.properties.SELECTABLE??"YES"),t+=this.formatProperty("LYRICSPATH",this.properties.LYRICSPATH),t+=this.formatProperty("CDTITLE",this.properties.CDTITLE),t+=this.formatProperty("SAMPLESTART",this.properties.SAMPLESTART),t+=this.formatProperty("SAMPLELENGTH",this.properties.SAMPLELENGTH)),t+=this.timingData.serialize(e);for(const r in this.other_properties)r=="VERSION"||r=="NITGVERSION"||(t+=this.formatProperty(r,this.other_properties[r]));t+=` `;for(const r in this.charts)for(const s of this.charts[r])t+=s.serialize(e)+` `;for(const r of this.unloadedCharts)if(typeof r=="string")t+="#NOTES:"+r+` `;else{t+="//---------------"+r.STEPSTYPE+" - "+r.DESCRIPTION+`--------------- @@ -1289,7 +1290,7 @@ https://github.com/nodeca/pako/blob/main/LICENSE `,t+="#NOTES:";for(const s in r)["NOTEDATA","CHARTNAME","CHARTSTYLE","CREDIT","MUSIC","STEPSTYPE","DESCRIPTION","DIFFICULTY","METER","METERF","RADARVALUES"].includes(s)||(t+=`#${s}:${r[s]}; `)}return t}usesSplitTiming(){for(const e in this.charts)for(const t of this.charts[e])if(!t.timingData.isEmpty())return!0;return!1}requiresSSC(){if(this.timingData.requiresSSC()||this.usesSplitTiming())return!0;for(const e in this.charts)for(const t of this.charts[e])if(t.requiresSSC())return!0;return!1}formatProperty(e,t){return t||="","#"+e.toUpperCase()+":"+t+`; -`}}const t1=`#TITLE:New Song; +`}}const eT=`#TITLE:New Song; #SUBTITLE:; #ARTIST:; #TITLETRANSLIT:; @@ -1312,11 +1313,11 @@ https://github.com/nodeca/pako/blob/main/LICENSE #FGCHANGES:; #KEYSOUNDS:; #ATTACKS:; -`;class ot{view;input;onChange;min=-Number.MAX_VALUE;max=Number.MAX_VALUE;precision;step=1;lastVal="";constructor(e,t,r,s,n,a){this.view=e,this.view.classList.add("spinner");const o=document.createElement("input");o.classList.add("spinner-input"),o.type="text",o.autocomplete="off",o.spellcheck=!1,o.onblur=()=>{if(o.value===this.lastVal)return;if(o.value===""){this.onChange?.(void 0);return}let h=de(Cc(o.value),this.precision??3);h=at(h,this.min,this.max),o.value=this.formatValue(h),this.onChange?.(h)},o.onkeydown=h=>{Rs(h)||h.preventDefault(),h.key=="Enter"&&o.blur(),h.key=="Escape"&&(o.value=this.lastVal,o.blur())},o.onfocus=()=>{this.lastVal=o.value},this.input=o,this.min=n??this.min,this.max=a??this.max,this.step=r,this.precision=s,this.setValue(t),e.appendChild(o);const l=document.createElement("div");l.classList.add("spinner-btns"),e.appendChild(l);const c=document.createElement("button");c.classList.add("spinner-up"),c.onclick=()=>{a!==void 0&&parseFloat(o.value)+(r??A.general.spinnerStep)>a||(o.value=this.formatValue(parseFloat(o.value)+(r??A.general.spinnerStep)),this.onChange?.(parseFloat(o.value)))},l.appendChild(c);const u=document.createElement("button");u.classList.add("spinner-down"),u.onclick=()=>{n!==void 0&&parseFloat(o.value)-(r??A.general.spinnerStep)i.chartManager.loadAudio()}},{title:"Background Image",propName:"BACKGROUND",input:{type:"file",typeName:"image",accept:Gr}},{title:"Banner Image",propName:"BANNER",input:{type:"file",typeName:"image",accept:Gr}},{title:"CD Title",propName:"CDTITLE",input:{type:"file",typeName:"image",accept:Gr}},{title:"CD Image",propName:"CDIMAGE",input:{type:"file",typeName:"image",accept:Gr}},{title:"Jacket",propName:"JACKET",input:{type:"file",typeName:"image",accept:Gr}},{title:"Disc Image",propName:"DISCIMAGE",input:{type:"file",typeName:"image",accept:Gr}}]},{title:"Song",items:[{title:"Song Preview",propName:"SAMPLESTART",input:{type:"custom",create:(i,e,t)=>{const r=t??mt.instance,s=()=>{a.value{(e??f.chartManager.loadedSM).properties.SAMPLESTART=h,(e??f.chartManager.loadedSM).properties.SAMPLELENGTH=d,n.setValue(parseFloat(h)),a.setValue(parseFloat(h)+parseFloat(d))},undo:()=>{(e??i.chartManager.loadedSM).properties.SAMPLESTART=c,(e??i.chartManager.loadedSM).properties.SAMPLELENGTH=u,n.setValue(parseFloat(c)),a.setValue(parseFloat(c)+parseFloat(u))}})},n=ot.create(parseFloat((e??i.chartManager.loadedSM).properties.SAMPLESTART??"0"),void 0,3,0);n.onChange=c=>{if(c===void 0){n.setValue(parseFloat((e??i.chartManager.loadedSM).properties.SAMPLESTART??"0"));return}s()};const a=ot.create(parseFloat((e??i.chartManager.loadedSM).properties.SAMPLESTART??"0")+parseFloat((e??i.chartManager.loadedSM).properties.SAMPLELENGTH??"10"),void 0,3,0);a.onChange=c=>{if(c===void 0){a.setValue(parseFloat((e??i.chartManager.loadedSM).properties.SAMPLESTART??"0")+parseFloat((e??i.chartManager.loadedSM).properties.SAMPLELENGTH??"10"));return}s()};const o=document.createElement("div"),l=document.createElement("div");return l.innerText="to",o.classList.add("flex-row","flex-column-gap"),o.replaceChildren(n.view,l,a.view),o}}}]}];function Mm(i,e,t,r){const s=r??mt.instance;switch(e.input.type){case"custom":return e.input.create(i,t,r);case"string":{const n=document.createElement("input");return n.type="text",n.autocomplete="off",n.spellcheck=!1,n.onkeydown=a=>{a.key=="Enter"&&n.blur()},n.onblur=()=>{const a=(t??i.chartManager.loadedSM).properties[e.propName],o=n.value;s.run({action:l=>{(t??l.chartManager.loadedSM).properties[e.propName]=o,n.value=o},undo:()=>{(t??i.chartManager.loadedSM).properties[e.propName]=a,n.value=a??""}})},n.value=(t??i.chartManager.loadedSM).properties[e.propName]??"",n}case"number":{const n=e.input,a=ot.create(parseFloat((t??i.chartManager.loadedSM).properties[e.propName])??15,n.step,n.precision,n.min,n.max);return a.onChange=o=>{if(o===void 0){a.setValue(parseFloat((t??i.chartManager.loadedSM).properties[e.propName]??"0"));return}const l=(t??i.chartManager.loadedSM).properties[e.propName],c=o.toString();s.run({action:u=>{(t??u.chartManager.loadedSM).properties[e.propName]=c,a.setValue(parseFloat(c))},undo:()=>{(t??i.chartManager.loadedSM).properties[e.propName]=l,a.setValue(parseFloat(l??"0"))}})},a.view}case"file":{const n=e.input,a=e.input.onChange,o=document.createElement("div");o.classList.add("flex-row","flex-column-gap");const l=document.createElement("input");l.type="text",l.autocomplete="off",l.spellcheck=!1,l.placeholder="click to select a file",l.onclick=h=>{h.preventDefault(),l.blur();const d=i.chartManager.smPath.split("/").slice(0,-1).join("/");if(window.nw){const f=document.createElement("input");f.type="file",f.accept=n.accept.join(","),f.onchange=()=>{const p=$e.getRelativePath(d,f.value),m=(t??i.chartManager.loadedSM).properties[e.propName]??"";s.run({action:g=>{(t??g.chartManager.loadedSM).properties[e.propName]=p,l.value=p},undo:()=>{(t??i.chartManager.loadedSM).properties[e.propName]=m,l.value=m}}),a?.(i)},f.click()}else i.windowManager.openWindow(new ra(i,{title:`Select a${n.typeName.match(/^[aieouAIEOU].*/)?"n":""} ${n.typeName} file...`,accepted_file_types:n.accept,disableClose:!0,callback:f=>{const p=$e.getRelativePath(d,f),m=(t??i.chartManager.loadedSM).properties[e.propName]??"";s.run({action:g=>{(t??g.chartManager.loadedSM).properties[e.propName]=p,l.value=p},undo:()=>{(t??i.chartManager.loadedSM).properties[e.propName]=m,l.value=m}}),a?.(i)}},(t??i.chartManager.loadedSM).properties[e.propName]?d+"/"+(t??i.chartManager.loadedSM).properties[e.propName]:i.chartManager.smPath))},l.value=(t??i.chartManager.loadedSM).properties[e.propName]??"",o.appendChild(l);const c=document.createElement("button");c.style.height="100%",c.classList.add("delete"),c.disabled=!0,c.onclick=()=>{l.value="",c.disabled=!0};const u=document.createElement("img");return u.classList.add("icon"),u.style.height="12px",u.src=Ge.TRASH,c.appendChild(u),o.appendChild(c),o}}}class km extends Vt{app;sm;actionHistory;fileTable={};constructor(e){super({title:"New Song",width:450,height:492,disableClose:!0,win_id:"sm_properties",blocking:!0});const t=new Blob([t1],{type:"text/plain"}),r=new File([t],"song.sm",{type:"text/plain"});this.sm=new Sm(r),this.app=e,this.actionHistory=new mt(this.app),this.initView()}initView(){this.viewElement.replaceChildren(),this.viewElement.classList.add("sm-properties");const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("label"),t.innerText="Apply to",Cm.forEach(l=>{const c=document.createElement("div");c.classList.add("sm-container");const u=document.createElement("div");u.classList.add("sm-title"),u.innerText=l.title;const h=document.createElement("div");h.classList.add("property-grid"),l.items.forEach(d=>{const f=document.createElement("div");f.classList.add("label"),f.innerText=d.title,h.appendChild(f),d.input.type=="file"?h.appendChild(this.createFileElement(d.propName,d.input.typeName)):h.appendChild(Mm(this.app,d,this.sm,this.actionHistory))}),c.appendChild(u),c.appendChild(h),e.appendChild(c)});const r=document.createElement("div");r.classList.add("menu-options");const s=document.createElement("div");s.classList.add("menu-left");const n=document.createElement("div");n.classList.add("menu-right"),r.appendChild(s),r.appendChild(n);const a=document.createElement("button");a.innerText="Cancel",a.onclick=()=>{this.closeWindow()};const o=document.createElement("button");o.innerText="Create",o.classList.add("confirm"),o.onclick=()=>{this.sm.properties.MUSIC===void 0||this.sm.properties.MUSIC===""?this.app.windowManager.openWindow(new Ic(this.app,"No audio file uploaded","Are you sure you want to create a file with no audio?",[{type:"confirm",label:"Yes",callback:()=>{this.createSong(),this.closeWindow()}},{type:"default",label:"No"}])):(this.createSong(),this.closeWindow())},s.appendChild(a),n.appendChild(o),e.appendChild(r),this.viewElement.appendChild(e)}async createSong(){let e=this.sm.properties.TITLE;if(window.nw){const t=document.createElement("input");t.type="file",t.onchange=()=>{Oe.create(t.value),console.log(t.value)},t.click()}else if(await $e.getDirectoryHandle(e)){let t=2;for(;await $e.getDirectoryHandle(e);)e=`${this.sm.properties.TITLE} ${t++}`}await $e.writeFile(e+"/song.sm",this.sm.serialize("sm")),await Promise.all(Object.entries(this.fileTable).map(t=>$e.writeFile(e+`/${t[0]}`,t[1]))),await this.app.chartManager.loadSM(e+"/song.sm"),this.app.windowManager?.getWindowById("select_sm_initial")?.closeWindow()}isValid(){return this.sm.properties.TITLE!==void 0&&this.sm.properties.TITLE!==""&&this.sm.properties.MUSIC!==void 0&&this.sm.properties.MUSIC!==""}createFileElement(e,t){const r=document.createElement("div");r.classList.add("flex-row","flex-column-gap");const s=document.createElement("input");s.type="text",s.autocomplete="off",s.spellcheck=!1,s.placeholder="click to upload a file",s.onclick=o=>{o.preventDefault(),s.blur();const l=document.createElement("input");l.type="file",l.accept=t=="audio"?"audio/*":"image/*",l.onchange=()=>{const c=l.files?.[0];if(!c)return;this.sm.properties[e]&&this.fileTable[this.sm.properties[e]]&&delete this.fileTable[this.sm.properties[e]];let u=c.name;for(;this.fileTable[c.name]&&(this.fileTable[c.name].size!=c.size||this.fileTable[c.name].type!=c.type);)u="_"+u;this.fileTable[u]=c,s.value=u,this.sm.properties[e]=s.value,n.disabled=!1},l.click()},s.value=this.sm.properties[e]??"",r.appendChild(s);const n=document.createElement("button");n.style.height="100%",n.classList.add("delete"),n.disabled=!0,n.onclick=()=>{this.sm.properties[e]&&this.fileTable[this.sm.properties[e]]&&delete this.fileTable[this.sm.properties[e]],this.sm.properties[e]=void 0,s.value="",n.disabled=!0};const a=document.createElement("img");return a.classList.add("icon"),a.style.height="12px",a.src=Ge.TRASH,n.appendChild(a),r.appendChild(n),r}}class i1 extends Vt{app;metronomeInterval;startTime;me_high=new Yr.Howl({src:"assets/sound/metronome_high.ogg",volume:A.audio.soundEffectVolume});me_low=new Yr.Howl({src:"assets/sound/metronome_low.ogg",volume:A.audio.soundEffectVolume});tickLines=[];resultLines=[];previousOffsets=[];keyHandler;constructor(e){super({title:"Offset Adjuster",width:300,height:200,win_id:"offset",blocking:!0}),this.app=e,this.initView(),this.startTime=performance.now();let t=this.startTime+500;this.tickLines.push({time:t+500*1,beat:0}),this.tickLines.push({time:t+500*2,beat:1}),this.tickLines.push({time:t+500*3,beat:2}),this.tickLines.push({time:t+500*4,beat:3});let r=0;this.metronomeInterval=setInterval(()=>{const s=performance.now();if(s-t>500){for(t=s,(r%4==0?this.me_high:this.me_low).play();this.tickLines[0]?.time+1e3s-n.startTime<8e3)},5),this.keyHandler=s=>{if(s.code.startsWith("Digit")||s.code.startsWith("Key")||s.code=="Space"){let n=this.tickLines[0];const a=performance.now();for(const l of this.tickLines)if(a-l.time+A.play.offset*1e3<300){n=l;break}s.preventDefault();const o=a-n.time+A.play.offset*1e3;o>-300&&(this.tickLines.splice(this.tickLines.indexOf(n),1),this.resultLines.push({startTime:performance.now(),offset:o}),this.previousOffsets.push(o),this.previousOffsets.length==16&&(um(this.previousOffsets)<70&&(A.play.offset-=zo(this.previousOffsets)/1e3),this.previousOffsets=[]))}},window.addEventListener("keydown",this.keyHandler)}initView(){this.viewElement.replaceChildren();const e=document.createElement("canvas");this.viewElement.appendChild(e);const t=this.drawEQ(e);requestAnimationFrame(t)}drawEQ(e){const t=e.getContext("2d");t.canvas.width=250,t.canvas.height=100;const r=()=>{t.fillStyle="rgba(0, 0, 0, 1)",t.fillRect(0,0,e.width,e.height),t.fillStyle="rgb(255, 255, 255)",t.fillRect(e.width/2-1,8,2,e.height-16);const s=performance.now();for(const n of this.resultLines){t.fillStyle="rgba(255, 255, 255, 1)";const a=Math.min(1,4-(s-n.startTime)/2e3);if(n.offset<0&&(t.fillStyle=`rgba(160, ${Ds(160,0,-n.offset/250)}, ${Ds(160,0,-n.offset/250)}, ${a})`),n.offset>0&&(t.fillStyle=`rgba(${Ds(160,0,n.offset/250)}, ${Ds(160,0,n.offset/250)}, 160, ${a})`),t.fillRect(e.width/2-.5+n.offset/4,12,1,e.height-24),s-n.startTime<250){const o=(s-n.startTime)/250;t.globalAlpha=1-o,t.fillRect(e.width/2-.5-o*3+n.offset/4,12-o*10,1+o*6,e.height-24+o*20)}t.globalAlpha=1}for(const n of this.tickLines){const a=n.time-s-A.play.offset*1e3;t.fillStyle="rgba(255, 255, 255, 0.8)",n.beat%4!=0?t.fillRect(e.width/2-1-a/4,12,2,e.height-24):t.fillRect(e.width/2-2-a/4,12,4,e.height-24)}e.closest("#windows")&&requestAnimationFrame(r)};return r}onClose(){clearInterval(this.metronomeInterval),window.removeEventListener("keydown",this.keyHandler)}}class r1 extends Vt{app;changeHandler=()=>this.initView();constructor(e){super({title:"Song Properties",width:450,height:486,disableClose:!1,win_id:"sm_properties",blocking:!1}),this.app=e,this.initView(),re.on("smLoaded",this.changeHandler),re.on("undo",this.changeHandler),re.on("redo",this.changeHandler)}onClose(){re.off("smLoaded",this.changeHandler),re.off("undo",this.changeHandler),re.off("redo",this.changeHandler)}initView(){this.viewElement.replaceChildren(),this.viewElement.classList.add("sm-properties");const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("label"),t.innerText="Apply to",Cm.forEach(r=>{const s=document.createElement("div");s.classList.add("sm-container");const n=document.createElement("div");n.classList.add("sm-title"),n.innerText=r.title;const a=document.createElement("div");a.classList.add("property-grid"),r.items.forEach(o=>{const l=document.createElement("div");l.classList.add("label"),l.innerText=o.title,a.appendChild(l),a.appendChild(Mm(this.app,o))}),s.appendChild(n),s.appendChild(a),e.appendChild(s)}),this.viewElement.appendChild(e)}}const qt=i=>i,qu={offset:{title:"Offset",element:qt({create:(i,e)=>{const t=ot.create(0,.001,3);return t.onChange=r=>{r!=null&&(i.chartManager.loadedChart?.timingData.insert(e(),"OFFSET",r),i.chartManager.setBeat(i.chartManager.getBeat()))},t.view},update:(i,e)=>{const t=i.querySelector(".spinner-input");if(document.activeElement==t)return;const r=e.getTimingData("OFFSET");t.value!=de(r,3).toFixed(3)&&(t.value=de(r,3).toFixed(3))}})},bpm:{title:"BPM",element:qt({create:(i,e)=>{const t=ot.create(120,void 0,3);return t.onChange=r=>{if(r==null){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"BPMS",s);return}i.chartManager.loadedChart?.timingData.insert(e(),"BPMS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("BPMS",t)?.value??120;r.value!=de(s,3).toFixed(3)&&(r.value=de(s,3).toFixed(3))}})},stop:{title:"Stop",element:qt({create:(i,e)=>{const t=ot.create(0,void 0,3);return t.onChange=r=>{if(r==null||r==0){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"STOPS",s);return}i.chartManager.loadedChart?.timingData.insert(e(),"STOPS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("STOPS",t);let n=s?.value??0;t!=s?.beat&&(n=0),r.value!=de(n,3).toFixed(3)&&(r.value=de(n,3).toFixed(3))}})},delay:{title:"Delay",element:qt({create:(i,e)=>{const t=ot.create(0,void 0,3);return t.onChange=r=>{if(r==null||r==0){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"DELAYS",s);return}i.chartManager.loadedChart?.timingData.insert(e(),"DELAYS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("DELAYS",t);let n=s?.value??0;t!=s?.beat&&(n=0),r.value!=de(n,3).toFixed(3)&&(r.value=de(n,3).toFixed(3))}})},warp:{title:"Warp",element:qt({create:(i,e)=>{const t=ot.create(0,void 0,3,0);return t.onChange=r=>{if(r==null||r==0){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"WARPS",s);return}r<0||i.chartManager.loadedChart?.timingData.insert(e(),"WARPS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("WARPS",t);let n=s?.value??0;t!=s?.beat&&(n=0),r.value!=de(n,3).toFixed(3)&&(r.value=de(n,3).toFixed(3))}})},timeSig:{title:"Time Sig.",element:qt({create:(i,e)=>{const t=document.createElement("div");t.classList.add("flex-column-gap");const r=ot.create(4,1,0,1);r.onChange=n=>{if(n==null){const a=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"TIMESIGNATURES",a);return}n<1||i.chartManager.loadedChart?.timingData.insert(e(),"TIMESIGNATURES",{upper:n,lower:s.value},i.chartManager.getBeat())};const s=ot.create(4,1,0,1);return s.onChange=n=>{if(n==null){const a=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"TIMESIGNATURES",a);return}n<1||i.chartManager.loadedChart?.timingData.insert(e(),"TIMESIGNATURES",{upper:r.value,lower:n},i.chartManager.getBeat())},t.appendChild(r.view),t.appendChild(s.view),t},update:(i,e,t)=>{const r=i.firstElementChild.querySelector(".spinner-input"),s=i.lastElementChild.querySelector(".spinner-input"),n=e.getTimingEventAtBeat("TIMESIGNATURES",t),a=n?.upper??4,o=n?.lower??4;document.activeElement!=r&&r.value!=Math.round(a).toString()&&(r.value=Math.round(a).toString()),document.activeElement!=s&&s.value!=Math.round(o).toString()&&(s.value=Math.round(o).toString())}})},tick:{title:"Tickcount",element:qt({create:(i,e)=>{const t=ot.create(4,1,0,0);return t.onChange=r=>{if(r==null){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"TICKCOUNTS",s);return}r<0||i.chartManager.loadedChart?.timingData.insert(e(),"TICKCOUNTS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("TICKCOUNTS",t)?.value??4;r.value!=Math.round(s).toString()&&(r.value=Math.round(s).toString())}})},combo:{title:"Combo",element:qt({create:(i,e)=>{const t=document.createElement("div");t.classList.add("flex-column-gap");const r=ot.create(1,1,0,0);r.onChange=n=>{if(n==null){const a=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"COMBOS",a);return}n<0||i.chartManager.loadedChart?.timingData.insert(e(),"COMBOS",{hitMult:n,missMult:s.value},i.chartManager.getBeat())};const s=ot.create(1,1,0,0);return s.onChange=n=>{if(n==null){const a=i.chartManager.getBeat();s.setValue(i.chartManager.loadedChart?.timingData.getTimingEventAtBeat("COMBOS",a)?.missMult??1);return}n<0||i.chartManager.loadedChart?.timingData.insert(e(),"COMBOS",{hitMult:n,missMult:s.value},i.chartManager.getBeat())},t.appendChild(r.view),t.appendChild(s.view),t},update:(i,e,t)=>{const r=i.firstElementChild.querySelector(".spinner-input"),s=i.lastElementChild.querySelector(".spinner-input"),n=e.getTimingEventAtBeat("COMBOS",t),a=n?.hitMult??1,o=n?.missMult??1;document.activeElement!=r&&r.value!=Math.round(a).toString()&&(r.value=Math.round(a).toString()),document.activeElement!=s&&s.value!=Math.round(o).toString()&&(s.value=Math.round(o).toString())}})},speed:{title:"Speed",element:qt({create:(i,e)=>{const t=document.createElement("div");t.classList.add("flex-column-gap");const r=()=>{i.chartManager.loadedChart?.timingData.insert(e(),"SPEEDS",{value:s.value,delay:n.value,unit:a.value=="Beats"?"B":"T"},i.chartManager.getBeat())},s=ot.create(1,.1,0);s.onChange=o=>{if(o==null){const l=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"SPEEDS",l);return}r()};const n=ot.create(1,.1,0);n.onChange=o=>{o==null||o<0||r()};const a=hi.create(["Beat","Time"],"Beats");return a.onChange=r,t.appendChild(s.view),t.appendChild(n.view),t.appendChild(a.view),t},update:(i,e,t)=>{const r=i.firstElementChild.querySelector(".spinner-input"),s=i.children[1].querySelector(".spinner-input"),n=e.getTimingEventAtBeat("SPEEDS",t),a=n?.value??1,o=n?.delay??0,l=n?.unit=="B"?"Beat":"Time";document.activeElement!=r&&r.value!=de(a,3).toFixed(3)&&(r.value=de(a,3).toFixed(3)),document.activeElement!=s&&s.value!=de(o,3).toFixed(3)&&(s.value=de(o,3).toFixed(3)),s.disabled=n?.beat!=t;const c=i.lastElementChild.querySelector(".dropdown-selected");c.innerText!=l&&(c.innerText=l),n?.beat!=t?c.classList.add("disabled"):c.classList.remove("disabled")}})},scroll:{title:"Scroll",element:qt({create:(i,e)=>{const t=ot.create(1,void 0,3);return t.onChange=r=>{if(r==null){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"SCROLLS",s);return}i.chartManager.loadedChart?.timingData.insert(e(),"SCROLLS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("SCROLLS",t)?.value??1;r.value!=de(s,3).toFixed(3)&&(r.value=de(s,3).toFixed(3))}})},fake:{title:"Fake",element:qt({create:(i,e)=>{const t=ot.create(1,void 0,3,0);return t.onChange=r=>{if(r==null){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"FAKES",s);return}r<0||i.chartManager.loadedChart?.timingData.insert(e(),"FAKES",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("FAKES",t);let n=s?.value??1;t!=s?.beat&&(n=0),r.value!=de(n,3).toFixed(3)&&(r.value=de(n,3).toFixed(3))}})},label:{title:"Label",element:qt({create:(i,e)=>{const t=document.createElement("input");return t.type="text",t.autocomplete="off",t.spellcheck=!1,t.onkeydown=r=>{r.key=="Enter"&&t.blur()},t.onblur=()=>{if(t.value==""){const r=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"LABELS",r);return}i.chartManager.loadedChart?.timingData.insert(e(),"LABELS",{value:t.value},i.chartManager.getBeat())},t},update:(i,e,t)=>{const r=i;if(document.activeElement==r)return;const n=e.getTimingEventAtBeat("LABELS",t)?.value??"";r.value!=n&&(r.value=n)}})}};class s1 extends Vt{app;lastBeat;songTiming=!1;interval;changeHandler=()=>this.setData();constructor(e){super({title:"Edit Timing Data",width:300,height:340,disableClose:!1,win_id:"timing_data",blocking:!1}),this.app=e,this.lastBeat=Math.round(this.app.chartManager.getBeat()*1e3)/1e3,this.songTiming=!this.app.chartManager.loadedChart.timingData.isEmpty(),this.initView(),this.interval=setInterval(()=>{Math.round(this.app.chartManager.getBeat()*1e3)/1e3!=this.lastBeat&&(this.lastBeat=Math.round(this.app.chartManager.getBeat()*1e3)/1e3,this.setData())},17),re.on("timingModified",this.changeHandler),re.on("chartLoaded",this.changeHandler)}onClose(){re.off("timingModified",this.changeHandler),clearInterval(this.interval)}initView(){this.viewElement.replaceChildren(),this.viewElement.classList.add("timing-data");const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("label"),t.innerText="Apply to";const r=hi.create(["All charts","This chart"],this.songTiming?"This chart":"All charts");r.onChange(s=>{this.songTiming=s=="This chart"}),e.appendChild(t),e.appendChild(r.view),Object.values(qu).forEach(s=>{const n=document.createElement("div");n.classList.add("label"),n.innerText=s.title;const a=s.element.create(this.app,()=>this.songTiming);e.appendChild(n),e.appendChild(a)}),this.viewElement.appendChild(e),this.setData()}setData(){this.app.chartManager.loadedChart&&Object.values(qu).forEach((e,t)=>{const r=this.viewElement.children[0].children[t*2+3];e.element.update(r,this.app.chartManager.loadedChart.timingData,this.lastBeat)})}}const Qu=[{type:"group",id:"general",label:"General",children:[{type:"subgroup",children:[{type:"item",label:"Smooth Animations",id:"general.smoothAnimations",input:{type:"checkbox",onChange:i=>{i?document.body.classList.add("animated"):document.body.classList.remove("animated")}}},{type:"item",label:"Warn before exit",id:"general.warnBeforeExit",input:{type:"checkbox"},tooltip:"Warn before exiting the editor if you have unsaved changes."},{type:"item",label:"Spinner step",id:"general.spinnerStep",input:{type:"slider",min:0,step:.1,max:5,hardMin:0,hardMax:2**31-1},tooltip:"The default increment for all number spinners."}]}]},{type:"group",id:"chart",label:"Chart",children:[{type:"subgroup",label:"Playfield",children:[{type:"subgroup",children:[{type:"item",label:"Enable mouse placement",id:"chart.mousePlacement",input:{type:"checkbox"}}]},{type:"subgroup",children:[{type:"item",label:"Zoom",id:"chart.zoom",input:{type:"slider",min:50,step:1,max:200,hardMax:2**31-1,transformers:{serialize:i=>i*100,deserialize:i=>i/100}}},{type:"item",label:"Reverse playfield",id:"chart.reverse",input:{type:"checkbox"}}]},{type:"subgroup",children:[{type:"item",label:"Y position",id:"chart.receptorYPos",input:{type:"slider",min:-400,max:0,hardMin:-(2**31-1),hardMax:2**31-1}},{type:"item",label:"Draw length",id:"chart.maxDrawBeats",input:{type:"slider",min:0,max:30,hardMax:2**31-1},tooltip:"Maximum number of beats to draw notes. Increasing this works well for songs with high bpm but can affect performance. Only applies to XMod."},{type:"item",label:"Draw length past receptors",id:"chart.maxDrawBeatsBack",input:{type:"slider",min:0,max:30,hardMax:2**31-1},tooltip:"Maximum number of beats to draw notes past the receptors. Increasing this can affect performance. Only applies to XMod."}]},{type:"subgroup",children:[{type:"item",label:"Draw noteflashes",id:"chart.drawNoteFlash",input:{type:"checkbox"}}]}]},{type:"subgroup",label:"Scrolling",children:[{type:"item",label:"Scroll sensitivity",id:"chart.scroll.scrollSensitivity",input:{type:"slider",min:0,step:1,max:200,hardMax:2**31-1,transformers:{serialize:i=>i*100,deserialize:i=>i/100}},tooltip:"Adjust the scroll sensitivity when scrolling through the chart."},{type:"item",label:"Snap every scroll",id:"chart.scroll.scrollSnapEveryScroll",input:{type:"checkbox"},tooltip:"Whether each scroll movement corresponds to moving one snap unit when scrolling. Turning this on will have the same behavior as ArrowVortex."},{type:"item",label:"Invert zoom in/out",id:"chart.scroll.invertZoomScroll",input:{type:"checkbox"},tooltip:"Inverts the zoom in/out control when scrolling."},{type:"item",label:"Invert scroll direction when in reverse",id:"chart.scroll.invertReverseScroll",input:{type:"checkbox"}}]},{type:"subgroup",label:"Waveform",children:[{type:"item",label:"Draw waveform",id:"chart.waveform.enabled",input:{type:"checkbox"}},{type:"item",label:"Opacity",id:"chart.waveform.opacity",input:{type:"slider",min:0,max:1,step:.01}},{type:"item",label:"Line height",id:"chart.waveform.lineHeight",input:{type:"slider",min:1,max:3,step:.1,hardMax:100},tooltip:"The height of each line of the waveform. Increasing this can help performance."},{type:"item",label:"Antialiasing",id:"chart.waveform.antialiasing",input:{type:"checkbox"}},{type:"item",label:"Allow speed changes",id:"chart.waveform.speedChanges",input:{type:"checkbox"},tooltip:"Allows the waveform to be affected by SPEEDS and SCROLLS."}]}]},{type:"group",id:"audio",label:"Audio",children:[{type:"subgroup",children:[{type:"item",label:"Master volume",id:"audio.masterVolume",input:{type:"slider",min:0,step:1,max:100,hardMax:2**31-1,transformers:{serialize:i=>i*100,deserialize:i=>i/100}}},{type:"item",label:"Song volume",id:"audio.songVolume",input:{type:"slider",min:0,step:1,max:100,hardMax:2**31-1,transformers:{serialize:i=>i*100,deserialize:i=>i/100}}},{type:"item",label:"Sound effect volume",id:"audio.soundEffectVolume",input:{type:"slider",min:0,step:1,max:100,hardMax:2**31-1,transformers:{serialize:i=>i*100,deserialize:i=>i/100}}}]},{type:"subgroup",children:[{type:"item",label:"Enable assist tick",id:"audio.assistTick",input:{type:"checkbox"},tooltip:"Plays a sound when a note passes the receptors"},{type:"item",label:"Enable metronome",id:"audio.metronome",input:{type:"checkbox"}}]}]},{type:"group",id:"play",label:"Play mode",children:[{type:"subgroup",label:"Calibration",children:[{type:"item",label:"Global offset",id:"play.offset",input:{type:"slider",min:-1,step:.001,max:1,hardMin:-(2**31-1),hardMax:2**31-1},tooltip:"Offset in seconds when playing a chart. Set to positive if you are hitting early and negative if you are hitting late."},{type:"item",label:"Sound effect offset",id:"play.effectOffset",input:{type:"slider",min:-1,step:.001,max:1,hardMin:-(2**31-1),hardMax:2**31-1},tooltip:"Offset in seconds when playing sound effects like assist tick and metronome."},{type:"item",label:"Visual offset",id:"play.visualOffset",input:{type:"slider",min:-1,step:.001,max:1,hardMin:-(2**31-1),hardMax:2**31-1},tooltip:"Offset in seconds when displaying notes."}]},{type:"subgroup",children:[{type:"item",label:"Judgment tilt",id:"play.judgmentTilt",input:{type:"checkbox"},tooltip:"Tilts the judgement text left if you are hitting early and right if you are hitting late."},{type:"item",label:"Hide barlines during play",id:"play.hideBarlines",input:{type:"checkbox"}}]},{type:"subgroup",label:"Timing windows",children:[{type:"item",id:"play.timingCollection",label:"Timing window collection",input:{type:"dropdown",advanced:!1,get items(){return Object.keys(Je.getCollections())}}},{type:"item",id:"play.timingWindowScale",label:"Timing window scale",input:{type:"slider",min:0,step:.001,max:2,hardMax:2**31-1},tooltip:"Scales all timing windows by the given amount."},{type:"item",id:"play.timingWindowAdd",label:"Timing window add",input:{type:"slider",min:0,step:.001,max:1,hardMax:2**31-1},tooltip:"Adds this value (in seconds) to all timing windows."}]}]},{type:"group",id:"performance",label:"Performance",children:[{type:"item",label:"Antialiasing",id:"performance.antialiasing",input:{type:"checkbox"}},{type:"item",label:"Resolution",id:"performance.resolution",input:{type:"slider",min:1,step:1,max:4,hardMin:0,hardMax:2**31-1},tooltip:"Requires a reload."}]},{type:"group",id:"debug",label:"Debug",children:[{type:"item",label:"Show FPS",id:"debug.showFPS",input:{type:"checkbox"}},{type:"item",label:"Show rendering timers",id:"debug.showTimers",input:{type:"checkbox"}}]}];class n1 extends Vt{app;observer;sectionContainer;constructor(e){super({title:"Options",width:600,height:400,disableClose:!1,win_id:"user_options",blocking:!1}),this.app=e,this.initView()}initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("pref-container");const r=document.createElement("div");r.classList.add("pref-search");const s=document.createElement("input");s.classList.add("pref-search-bar"),s.type="text",s.placeholder="Search for an option...",s.oninput=()=>{a.replaceChildren(),o.replaceChildren(...this.createOptions(this.filterOptions(s.value)))},r.appendChild(s);const n=document.createElement("div");n.classList.add("pref-scrollers");const a=document.createElement("div");a.classList.add("pref-section-scroller"),this.sectionContainer=a;const o=document.createElement("div");o.classList.add("pref-option-scroller"),n.replaceChildren(a,o),this.observer=new IntersectionObserver(l=>{l.forEach(c=>{const u=c.target.dataset.id,h=a.querySelector(`.pref-section[data-id=${u}]`);h&&(c.intersectionRatio>0?h.classList.add("selected"):h.classList.remove("selected"))})},{}),t.replaceChildren(r,n),a.replaceChildren(),o.replaceChildren(...this.createOptions(Qu)),e.appendChild(t),this.viewElement.appendChild(e)}createOptions(e){return e.map(t=>{const r=this.makeOption(t);return t.type=="group"&&(this.observer.observe(r),this.sectionContainer?.appendChild(this.createEmptyGroup(t))),r})}makeOption(e){const t=document.createElement("div");t.classList.add("pref-"+e.type),(e.type=="group"||e.type=="item")&&(t.dataset.id=e.id);const r=document.createElement("div");r.classList.add(`pref-${e.type}-label`),e.label!==void 0&&(r.innerText=e.label,t.appendChild(r));const s=document.createElement("img");if(e.type=="item"&&(s.src=Ge.REVERT,s.style.width="12px",s.addEventListener("click",()=>{A.applyOption([e.id,A.getDefaultOption(e.id)]),t.replaceWith(this.makeOption(e))}),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",t.appendChild(s)),e.type=="item"){const n=A.getOption(e.id);let a;if(!e.input)return t;switch(r.innerText=e.label,e.input.type){case"checkbox":{const o=document.createElement("input"),l=e.input.onChange;o.type="checkbox",o.checked=n,o.onblur=null,o.onchange=()=>{A.applyOption([e.id,o.checked]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",l?.(o.checked)},o.classList.add("pref-input","right"),o.onkeydown=c=>{c.key=="Enter"&&o.blur()},a=o;break}case"dropdown":{if(e.input.advanced){const o=e.input.transformers.deserialize,l=e.input.transformers.serialize,c=e.input.onChange,u=hi.create(e.input.items,l(n));u.onChange(h=>{A.applyOption([e.id,o(h)]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",c?.(o(h))}),u.view.classList.add("pref-input","dropdown-right"),a=u.view}else{const o=e.input.onChange,l=hi.create(e.input.items,n);l.onChange(c=>{A.applyOption([e.id,c]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",o?.(c)}),l.view.classList.add("pref-input","dropdown-right"),a=l.view}break}case"number":{const o=e.input.transformers?.deserialize??(h=>h),l=e.input.transformers?.serialize??(h=>h),c=e.input.onChange,u=ot.create(l(n),e.input.step,e.input.precision,e.input.min,e.input.max);u.onChange=h=>{if(!h){u.setValue(l(h));return}A.applyOption([e.id,o(h)]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",c?.(o(h))},a=u.view;break}case"slider":{const o=e.input.transformers?.deserialize??(m=>m),l=e.input.transformers?.serialize??(m=>m),c=e.input.onChange,u=document.createElement("div");u.style.display="flex",u.style.alignItems="center";const h=document.createElement("input");h.type="range",h.min=e.input.min?.toString()??"",h.max=e.input.max?.toString()??"",h.step=e.input.step?.toString()??"1",h.value=l(n).toString();const d=document.createElement("input");d.type="text",d.value=(Math.round(l(n)*1e3)/1e3).toString();const f=e.input.min??e.input.hardMin??-Number.MAX_VALUE,p=e.input.max??e.input.hardMax??Number.MAX_VALUE;d.onblur=()=>{let m=Cc(d.value);m=at(m,f,p),d.value=de(m,3).toString(),d.blur(),d.value==""?d.value=l(m).toString():A.applyOption([e.id,o(m)]),h.value=m.toString(),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",c?.(o(m))},d.oninput=()=>{d.value=d.value.replaceAll(/[^.0-9+-/*]/g,"")},h.oninput=()=>{const m=parseFloat(h.value);d.value=de(m,3).toString(),A.applyOption([e.id,o(m)]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block"},d.style.width="50px",d.onkeydown=m=>{m.key=="Enter"&&d.blur()},u.appendChild(h),u.appendChild(d),a=u;break}case"text":{const o=e.input.onChange,l=document.createElement("input");l.type="text",l.value=n.toString(),l.onblur=()=>{A.applyOption([e.id,l.value]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",o?.(l.value)},l.onkeydown=c=>{c.key=="Enter"&&l.blur()},a=l;break}}a.classList.add("pref-item-input"),t.appendChild(a)}else{const n=document.createElement("div");n.classList.add("pref-children"),t.appendChild(n),n.replaceChildren(...this.createOptions(e.children))}return e.type=="item"&&e.tooltip!==void 0&&kr(t,{content:e.tooltip}),t}filterOptions(e,t=Qu){const r=[];return t.forEach(s=>{if(s.label&&s.label.toLowerCase().includes(e.toLowerCase())){r.push(s);return}if(s.type=="group"||s.type=="subgroup"){const n=this.filterOptions(e,s.children);n.length!=0&&r.push({...s,children:n})}}),r}static expandMenubarOptions(e){switch(e.type){case"menu":case"dropdown":return e.options.map(t=>this.expandMenubarOptions(t)).flat();case"selection":case"checkbox":return[e.id];case"seperator":return[]}}createEmptyGroup(e){const t=document.createElement("div");return t.classList.add("pref-section"),t.dataset.id=e.id,t.innerText=e.label,t.onclick=()=>{t.parentElement.parentElement.querySelector(`.pref-group[data-id=${e.id}]`).scrollIntoView()},t}onClose(){this.observer?.disconnect()}}var Cn=(i=>(i.SHIFT="Shift",i.CTRL="Ctrl",i.ALT="Alt",i.META="Command",i))(Cn||{});const ts=navigator.userAgent.indexOf("Mac OS X")>-1,St=ts?"Command":"Ctrl",a1={Shift:ts?"⇧":"Shift",Ctrl:ts?"⌃":"Ctrl",Alt:ts?"⌥":"Alt",Command:"⌘"},Zu={ArrowLeft:"Left",ArrowUp:"Up",ArrowRight:"Right",ArrowDown:"Down",BracketLeft:"[",BracketRight:"]",Semicolon:";",Quote:"'",Backslash:"\\",Slash:"/",Period:".",Comma:",",Backquote:"`",Minus:"-",Equal:"+"},wo=["ctrlKey","altKey","shiftKey","metaKey"],qa=["Ctrl","Alt","Shift","Command"],ht={playback:{label:"Play/Pause",combos:[{key:"Space",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.playPause()},decreaseSnap:{label:"Decrease snap",combos:[{key:"Left",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.previousSnap()},increaseSnap:{label:"Increase snap",combos:[{key:"Right",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.nextSnap()},cursorUp:{label:"Move cursor up",combos:[{key:"Up",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>{const e=Math.max(.001,A.chart.snap),t=Math.round(i.chartManager.getBeat()/e)*e,r=Math.abs(t-i.chartManager.getBeat())<5e-4?e:e/2;i.chartManager.setAndSnapBeat(i.chartManager.getBeat()-r)}},cursorDown:{label:"Move cursor down",combos:[{key:"Down",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>{const e=Math.max(.001,A.chart.snap),t=Math.round(i.chartManager.getBeat()/e)*e,r=Math.abs(t-i.chartManager.getBeat())<5e-4?e:e/2;i.chartManager.setAndSnapBeat(i.chartManager.getBeat()+r)}},increaseScrollSpeed:{label:"Increase scroll speed",combos:[{key:"Up",mods:[St]}],disabled:i=>!i.chartManager.chartView,callback:()=>A.chart.speed=Math.max(10,A.chart.speed*Math.pow(1.01,30))},decreaseScrollSpeed:{label:"Decrease scroll speed",combos:[{key:"Down",mods:[St]}],disabled:i=>!i.chartManager.chartView,callback:()=>A.chart.speed=Math.max(10,A.chart.speed*Math.pow(1.01,-30))},zoomIn:{label:"Zoom in",combos:[{key:"+",mods:[St]}],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.zoom+=.1,Oe.create("Zoom: "+Math.round(A.chart.zoom*100)+"%")}},zoomOut:{label:"Zoom out",combos:[{key:"-",mods:[St]}],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.zoom=Math.max(.1,A.chart.zoom-.1),Oe.create("Zoom: "+Math.round(A.chart.zoom*100)+"%")}},zoomDefault:{label:"Reset zoom",combos:[{key:"0",mods:[St]}],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.zoom=1,Oe.create("Zoom: "+Math.round(A.chart.zoom*100)+"%")}},newSong:{label:"New song...",bindLabel:"New song",combos:[{key:"N",mods:[St]}],disabled:i=>!i.chartManager.loadedSM,callback:i=>{i.windowManager.openWindow(new km(i))}},openSong:{label:"Open song...",bindLabel:"Open song",combos:[{key:"O",mods:[St]}],disabled:i=>!i.chartManager.loadedSM,callback:i=>{if(window.nw){const e=document.createElement("input");e.type="file",e.accept=".sm,.ssc",e.onchange=()=>{i.chartManager.loadSM(e.value)},e.click()}else i.windowManager.openWindow(new ra(i,{title:"Select an sm/ssc file...",accepted_file_types:[".sm",".ssc"],disableClose:!0,callback:e=>{i.chartManager.loadSM(e)}}))}},songProperties:{label:"Song properties...",bindLabel:"Open song properties",combos:[{key:"O",mods:["Shift"]}],disabled:i=>!i.chartManager.loadedSM,callback:i=>i.windowManager.openWindow(new r1(i))},save:{label:"Save...",bindLabel:"Save",combos:[{key:"S",mods:[St]}],disabled:i=>!i.chartManager.loadedSM,callback:i=>i.chartManager.save()},export:{label:"Save and export current song",combos:[{key:"E",mods:[St]}],disabled:i=>!!window.nw||!i.chartManager.loadedSM,callback:i=>{i.chartManager.save(),$e.saveDirectory(i.chartManager.smPath)}},exportNotedata:{label:"Export to notedata...",bindLabel:"Export to notedata",combos:[{key:"E",mods:[St,"Shift"]}],disabled:i=>!!window.nw||!i.chartManager.loadedSM,callback:i=>i.windowManager.openWindow(new ZE(i,i.chartManager.selection.notes))},openChart:{label:"Chart list",bindLabel:"Open chart list",combos:[{key:"O",mods:[St,"Shift"]}],disabled:i=>!i.chartManager.loadedSM,callback:i=>i.windowManager.openWindow(new wm(i))},timingDataRow:{label:"Edit timing data at row",combos:[{key:"T",mods:["Shift"]}],disabled:i=>!i.chartManager.chartView,callback:i=>i.windowManager.openWindow(new s1(i))},selectRegion:{label:"Select region",combos:[{key:"Tab",mods:[]}],disabled:i=>!i.chartManager.loadedChart,callback:i=>i.chartManager.selectRegion()},volumeUp:{label:"Increase master volume",combos:[{key:"Up",mods:["Alt"]}],disabled:!1,callback:()=>{A.audio.masterVolume=Math.min(A.audio.masterVolume+.05,1),Oe.create("Master volume: "+Math.round(A.audio.masterVolume*100)+"%")}},volumeDown:{label:"Decrease master volume",combos:[{key:"Down",mods:["Alt"]}],disabled:!1,callback:()=>{A.audio.masterVolume=Math.max(A.audio.masterVolume-.05,0),Oe.create("Master volume: "+Math.round(A.audio.masterVolume*100)+"%")}},songVolumeUp:{label:"Increase song volume",combos:[{key:"Up",mods:["Shift","Alt"]}],disabled:!1,callback:()=>{A.audio.songVolume=Math.min(A.audio.songVolume+.05,1),Oe.create("Song volume: "+Math.round(A.audio.songVolume*100)+"%")}},songVolumeDown:{label:"Decrease song volume",combos:[{key:"Down",mods:["Shift","Alt"]}],disabled:!1,callback:()=>{A.audio.songVolume=Math.max(A.audio.songVolume-.05,0),Oe.create("Song volume: "+Math.round(A.audio.songVolume*100)+"%")}},effectvolumeUp:{label:"Increase tick/metronome volume",combos:[{key:"Up",mods:["Shift",St,"Alt"]}],disabled:!1,callback:()=>{A.audio.soundEffectVolume=Math.min(A.audio.soundEffectVolume+.05,1),Oe.create("Effect volume: "+Math.round(A.audio.soundEffectVolume*100)+"%")}},effectvolumeDown:{label:"Decrease tick/metronome volume",combos:[{key:"Down",mods:["Shift",St,"Alt"]}],disabled:!1,callback:()=>{A.audio.soundEffectVolume=Math.max(A.audio.soundEffectVolume-.05,0),Oe.create("Effect Volume: "+Math.round(A.audio.soundEffectVolume*100)+"%")}},rateUp:{label:"Increase playback rate",combos:[{key:"Right",mods:["Shift"]}],disabled:i=>i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:()=>{A.audio.rate+=.05,Oe.create("Playback Rate: "+Math.round(A.audio.rate*100)+"%")}},rateDown:{label:"Decrease playback rate",combos:[{key:"Left",mods:["Shift"]}],disabled:i=>i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:()=>{A.audio.rate=Math.max(A.audio.rate-.05,.1),Oe.create("Playback Rate: "+Math.round(A.audio.rate*100)+"%")}},rateDefault:{label:"Reset playback rate",combos:[],disabled:!1,callback:()=>{A.audio.rate=1,Oe.create("Playback Rate: "+Math.round(A.audio.rate)+"%")}},previousMeasure:{label:"Previous measure",combos:[{key:"PageUp",mods:[]},{key:";",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>{const e=i.chartManager.getBeat(),t=i.chartManager.loadedChart.timingData.getMeasureLength(e-.001);i.chartManager.setAndSnapBeat(Math.max(0,e-t))}},nextMeasure:{label:"Next measure",combos:[{key:"PageDown",mods:[]},{key:"'",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>{const e=i.chartManager.getBeat(),t=i.chartManager.loadedChart.timingData.getMeasureLength(e);i.chartManager.setAndSnapBeat(Math.max(0,e+t))}},previousNote:{label:"Previous note",combos:[{key:",",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.previousNote()},nextNote:{label:"Next note",combos:[{key:".",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.nextNote()},jumpChartStart:{label:"Jump to first note",combos:[{key:"Home",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.firstNote()},jumpChartEnd:{label:"Jump to last note",combos:[{key:"End",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.lastNote()},jumpSongStart:{label:"Jump to song start",combos:[{key:"Home",mods:["Shift"]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.setBeat(Math.max(0,i.chartManager.loadedChart.getBeatFromSeconds(0)))},jumpSongEnd:{label:"Jump to song end",combos:[{key:"End",mods:["Shift"]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.setBeat(i.chartManager.loadedChart.getBeatFromSeconds(i.chartManager.chartAudio.getSongLength()))},assistTick:{label:"Assist tick",combos:[{key:"F7",mods:[]}],disabled:!1,callback:()=>{A.audio.assistTick=!A.audio.assistTick,Oe.create("Assist Tick: "+(A.audio.assistTick?"on":"off"))}},metronome:{label:"Metronome",combos:[{key:"F7",mods:["Alt"]}],disabled:!1,callback:()=>{A.audio.metronome=!A.audio.metronome,Oe.create("Metronome: "+(A.audio.metronome?"on":"off"))}},renderWaveform:{label:"Render waveform",combos:[],disabled:!1,callback:()=>{A.chart.waveform.enabled=!A.chart.waveform.enabled,Oe.create("Waveform: "+(A.chart.waveform.enabled?"on":"off"))}},waveformOptions:{label:"Waveform options...",bindLabel:"Waveform options",combos:[],disabled:!0,callback:()=>0},XMod:{label:"XMod (Beat-based)",combos:[{key:"X",mods:["Shift"]}],disabled:!1,callback:()=>{A.chart.CMod=!1,Oe.create("Switched to XMod")}},CMod:{label:"CMod (Time-based)",combos:[{key:"C",mods:["Shift"]}],disabled:!1,callback:()=>{A.chart.CMod=!0,Oe.create("Switched to CMod")}},hideWarpedArrows:{label:"Hide warped arrows (CMod only)",combos:[{key:"W",mods:["Shift"]}],disabled:!1,callback:()=>{A.chart.hideWarpedArrows=!A.chart.hideWarpedArrows,Oe.create("Hide Warped Arrows: "+(A.chart.hideWarpedArrows?"on":"off"))}},doSpeedChanges:{label:"Do speed changes (XMod only)",combos:[{key:"S",mods:["Shift"]}],disabled:!1,callback:()=>{A.chart.doSpeedChanges=!A.chart.doSpeedChanges,Oe.create("Speed Changes: "+(A.chart.doSpeedChanges?"on":"off"))}},showEq:{label:"Equalizer",combos:[{key:"E",mods:["Shift"]}],disabled:i=>!i.chartManager.chartAudio,callback:i=>i.windowManager.openWindow(new KE(i))},previousNoteType:{label:"Previous note type",combos:[{key:"N",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.previousNoteType()},nextNoteType:{label:"Next note type",combos:[{key:"M",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.nextNoteType()},undo:{label:"Undo",combos:[{key:"Z",mods:[St]}],disabled:i=>!i.actionHistory.canUndo()||i.chartManager.getMode()!=Z.Edit,callback:i=>i.actionHistory.undo()},redo:{label:"Redo",combos:[{key:"Y",mods:[St]}],disabled:i=>!i.actionHistory.canRedo()||i.chartManager.getMode()!=Z.Edit,callback:i=>i.actionHistory.redo()},mousePlacement:{label:"Enable Mouse Note Placement",combos:[{key:"M",mods:["Shift"]}],disabled:!1,callback:()=>{A.chart.mousePlacement=!A.chart.mousePlacement,Oe.create("Mouse Note Placement: "+(A.chart.mousePlacement?"on":"off"))}},playMode:{label:"Enter/Exit Play Mode",combos:[{key:"P",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.setMode(Z.Play)},recordMode:{label:"Enter/Exit Record Mode",combos:[{key:"R",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play,callback:i=>i.chartManager.setMode(Z.Record)},playModeStart:{label:"Play from start",combos:[{key:"P",mods:["Shift"]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Record,callback:i=>{i.chartManager.setBeat(0),i.chartManager.setMode(Z.Play)}},recordModeStart:{label:"Record from start",combos:[{key:"R",mods:["Shift"]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play,callback:i=>i.chartManager.setMode(Z.Record)},options:{label:"Options...",bindLabel:"Edit options",combos:[{key:",",mods:[St]}],disabled:!1,callback:i=>{i.windowManager.openWindow(new n1(i))}},keybinds:{label:"Keybinds...",bindLabel:"Edit keybinds",combos:[],disabled:!1,callback:i=>{i.windowManager.openWindow(new Ri(i))}},gameplayKeybinds:{label:"Gameplay keybinds...",bindLabel:"Edit gameplay keybinds",combos:[],disabled:!1,callback:i=>{i.windowManager.openWindow(new JE(i))}},convertHoldsRolls:{label:"Holds to rolls",bindLabel:"Convert holds to rolls",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type=="Hold"&&(e.type="Roll"),e))}},convertRollsHolds:{label:"Rolls to holds",bindLabel:"Convert rolls to holds",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type=="Roll"&&(e.type="Hold"),e))}},swapHoldsRolls:{label:"Swap holds and rolls",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type=="Hold"?e.type="Roll":e.type=="Roll"&&(e.type="Hold"),e))}},convertHoldsTaps:{label:"Holds/rolls to taps",bindLabel:"Convert holds/rolls to taps",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>((e.type=="Hold"||e.type=="Roll")&&(e.type="Tap"),e))}},convertNotesMines:{label:"Notes to mines",bindLabel:"Convert notes to mines",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type="Mine",e))}},convertNotesLifts:{label:"Notes to lifts",bindLabel:"Convert notes to lifts",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type="Lift",e))}},convertTapsFakes:{label:"Taps to fakes",bindLabel:"Convert taps to fakes",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type=="Tap"&&(e.type="Fake"),e))}},mirrorHorizontally:{label:"Horizontally",bindLabel:"Mirror horizontally",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.col=i.chartManager.loadedChart.gameType.flipColumns.horizontal[e.col],e))}},mirrorVertically:{label:"Vertically",bindLabel:"Mirror vertically",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.col=i.chartManager.loadedChart.gameType.flipColumns.vertical[e.col],e))}},mirrorBoth:{label:"Both",bindLabel:"Mirror both",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.col=i.chartManager.loadedChart.gameType.flipColumns.horizontal[e.col],e.col=i.chartManager.loadedChart.gameType.flipColumns.vertical[e.col],e))}},selectAll:{label:"Select all",combos:[{key:"A",mods:[St]}],disabled:i=>!i.chartManager.loadedChart,callback:i=>{i.chartManager.selection.notes=[...i.chartManager.loadedChart.getNotedata()]}},expand2to1:{label:"Expand 2:1 (8th to 4th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)*2+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold*=2,t.hold=Math.round(t.hold*48)/48),t))}},expand3to2:{label:"Expand 3:2 (12th to 8th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)*1.5+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold*=1.5,t.hold=Math.round(t.hold*48)/48),t))}},expand4to3:{label:"Expand 4:3 (16th to 2th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)*4/3+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold*=4/3,t.hold=Math.round(t.hold*48)/48),t))}},compress1to2:{label:"Compress 1:2 (4th to 8th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)/2+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold/=2,t.hold=Math.round(t.hold*48)/48),t))}},compress2to3:{label:"Compress 2:3 (8th to 12th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)/1.5+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold/=1.5,t.hold=Math.round(t.hold*48)/48),t))}},compress3to4:{label:"Compress 3:4 (12th to 16th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)*.75+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold*=.75,t.hold=Math.round(t.hold*48)/48),t))}},delete:{label:"Delete",combos:[{key:"Backspace",mods:[]},{key:"Delete",mods:[]}],disabled:i=>i.chartManager.getMode()!=Z.Edit||i.chartManager.selection.notes.length==0&&i.chartManager.eventSelection.timingEvents.length==0,callback:i=>{i.chartManager.deleteSelection(),i.chartManager.deleteEventSelection()}},paste:{label:"Paste",combos:[],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()!=Z.Edit,callback:async i=>{const e=await navigator.clipboard.readText();i.chartManager.paste(e)}},copy:{label:"Copy",combos:[],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()!=Z.Edit||!i.chartManager.hasSelection(),callback:async i=>{const e=i.chartManager.copy();e&&await navigator.clipboard.writeText(e)}},cut:{label:"Cut",combos:[],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()!=Z.Edit||!i.chartManager.hasSelection(),callback:async i=>{const e=i.chartManager.copy();e&&await navigator.clipboard.writeText(e),i.chartManager.deleteSelection()}},adjustOffset:{label:"Adjust offset",combos:[],disabled:!1,callback:i=>i.windowManager.openWindow(new i1(i))},setSongPreview:{label:"Set as song preview",combos:[],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()!=Z.Edit||!i.chartManager.hasRange(),callback:i=>{const e=i.chartManager.loadedChart,t=i.chartManager.loadedSM.properties.SAMPLESTART??"0",r=i.chartManager.loadedSM.properties.SAMPLELENGTH??"10";if(i.chartManager.startRegion!==void 0&&i.chartManager.endRegion!==void 0){const u=e.getSecondsFromBeat(i.chartManager.startRegion),h=e.getSecondsFromBeat(i.chartManager.endRegion),d=de(u,3).toString(),f=de(h-u,3).toString();mt.instance.run({action:p=>{p.chartManager.loadedSM.properties.SAMPLESTART=d,p.chartManager.loadedSM.properties.SAMPLELENGTH=f},undo:()=>{i.chartManager.loadedSM.properties.SAMPLESTART=t,i.chartManager.loadedSM.properties.SAMPLELENGTH=r}});return}const n=(i.chartManager.selection.notes.length>0?i.chartManager.selection.notes:i.chartManager.eventSelection.timingEvents).map(u=>u.beat),a=e.getSecondsFromBeat(Math.min(...n)),o=e.getSecondsFromBeat(Math.max(...n)),l=de(a,3).toString(),c=de(o-a,3).toString();mt.instance.run({action:u=>{u.chartManager.loadedSM.properties.SAMPLESTART=l,u.chartManager.loadedSM.properties.SAMPLELENGTH=c},undo:()=>{i.chartManager.loadedSM.properties.SAMPLESTART=t,i.chartManager.loadedSM.properties.SAMPLELENGTH=r}})}},showDebugTimers:{label:"Toggle Debug Timers",combos:[{key:"F3",mods:["Shift"]}],disabled:!1,callback:()=>{A.debug.showTimers=!A.debug.showTimers}},showFPSCounter:{label:"Toggle FPS Counter",combos:[{key:"F3",mods:[]}],disabled:!1,callback:()=>{A.debug.showFPS=!A.debug.showFPS}},noteTypeTap:{label:"Switch to Taps",combos:[],disabled:i=>!i.chartManager.chartView,callback:i=>{i.chartManager.setEditingNoteType("Tap")}},noteTypeLift:{label:"Switch to Lifts",combos:[],disabled:i=>!i.chartManager.chartView,callback:i=>{i.chartManager.setEditingNoteType("Lift")}},noteTypeMine:{label:"Switch to Mines",combos:[],disabled:i=>!i.chartManager.chartView,callback:i=>{i.chartManager.setEditingNoteType("Mine")}},noteTypeFake:{label:"Switch to Fakes",combos:[],disabled:i=>!i.chartManager.chartView,callback:i=>{i.chartManager.setEditingNoteType("Fake")}},quant4:{label:"Switch to 4ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1}},quant8:{label:"Switch to 8ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/2}},quant12:{label:"Switch to 12ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/3}},quant16:{label:"Switch to 16ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/4}},quant24:{label:"Switch to 24ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/6}},quant32:{label:"Switch to 32ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/8}},quant48:{label:"Switch to 48ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/12}},quant96:{label:"Switch to 96ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/24}},quant192:{label:"Switch to 192nds",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/48}}};class Nt extends Zw{static graphics=new us;static textures={default:pt.create({width:50,height:50}),noBorder:pt.create({width:50,height:50}),onlyBorder:pt.create({width:50,height:50})};static init(e){this.textures.default=pt.create({width:50,height:50,resolution:e.resolution}),this.textures.noBorder=pt.create({width:50,height:50,resolution:e.resolution}),this.textures.onlyBorder=pt.create({width:50,height:50,resolution:e.resolution}),this.graphics.beginFill(16777215,1),this.graphics.lineStyle(1,0),this.graphics.drawRoundedRect(0,0,50,50,5),this.graphics.endFill(),e.render(this.graphics,{renderTexture:this.textures.default}),this.graphics.clear(),this.graphics.beginFill(16777215,1),this.graphics.lineStyle(1,16777215),this.graphics.drawRoundedRect(0,0,50,50,5),this.graphics.endFill(),e.render(this.graphics,{renderTexture:this.textures.noBorder}),this.graphics.clear(),this.graphics.beginFill(16777215,0),this.graphics.lineStyle(2,16777215),this.graphics.drawRoundedRect(0,0,50,50,5),this.graphics.endFill(),e.render(this.graphics,{renderTexture:this.textures.onlyBorder})}constructor(e){super(Nt.textures[e??"default"],5,5,5,5)}}class Vo extends xe{manager;constructor(e){super(),this.manager=e}startPlay(){}endPlay(){}}const Mn=[];function Ju(){return Mn.length}function o1(){for(Mn.push(Date.now());Mn.length>0&&Mn[0]0&&kn[0]Ju()+" FPS"});drawUpdateTimeGraph=new wn({width:300,height:fi,color:6034982,min:0,unit:"ms",label:"DrawUpdate",precision:1});updateTimeGraph=new wn({width:300,height:fi,color:1516101,min:0,unit:"ms",label:"Update",precision:1,sublabel:()=>ef()+" TPS"});memoryTimeGraph=new wn({width:300,height:fi,color:6626406,min:0,formatter:e=>Math.round(e/1048576)+" MB",label:"Memory"});cpuGraph=new wn({width:300,height:fi,color:5190685,min:0,label:"CPU"});graphs=new xe;fpsCounter=new xe;fpsBg=new Nt;fpsText=new Fe("",{fontName:"Main",fontSize:12});lastFrameTime=0;constructor(e){super(e),this.drawUpdateTimeGraph.y+=fi+5,this.updateTimeGraph.y+=(fi+5)*2,this.memoryTimeGraph.y+=(fi+5)*3,this.cpuGraph.y+=(fi+5)*4,ls.instance=this,this.fpsBg.tint=0,this.fpsBg.alpha=.5,this.fpsText.x=5,this.fpsBg.y=-5,this.graphs.addChild(this.frameTimeGraph,this.drawUpdateTimeGraph,this.updateTimeGraph),performance.memory&&this.graphs.addChild(this.memoryTimeGraph),this.fpsCounter.addChild(this.fpsBg,this.fpsText),this.addChild(this.graphs,this.fpsCounter)}update(){this.x=-this.manager.app.renderer.screen.width/2+20,this.y=-this.manager.app.renderer.screen.height/2+20,this.graphs.children.forEach(e=>e.update()),this.graphs.visible=A.debug.showTimers,this.fpsCounter.visible=A.debug.showFPS,this.fpsText.text=`${Ju()} FPS -${ef()} TPS +`;class ot{view;input;onChange;min=-Number.MAX_VALUE;max=Number.MAX_VALUE;precision;step=1;lastVal="";constructor(e,t,r,s,n,a){this.view=e,this.view.classList.add("spinner");const o=document.createElement("input");o.classList.add("spinner-input"),o.type="text",o.autocomplete="off",o.spellcheck=!1,o.onblur=()=>{if(o.value===this.lastVal)return;if(o.value===""){this.onChange?.(void 0);return}const h=qn(o.value);if(h===null){o.value=this.lastVal;return}let d=de(h,this.precision??3);d=Je(d,this.min,this.max),o.value=this.formatValue(d),this.onChange?.(d)},o.onkeydown=h=>{h.key=="Enter"&&o.blur(),h.key=="Escape"&&(o.value=this.lastVal,o.blur())},o.onfocus=()=>{this.lastVal=o.value},this.input=o,this.min=n??this.min,this.max=a??this.max,this.step=r,this.precision=s,this.setValue(t),e.appendChild(o);const l=document.createElement("div");l.classList.add("spinner-btns"),e.appendChild(l);const c=document.createElement("button");c.classList.add("spinner-up"),c.onclick=()=>{a!==void 0&&parseFloat(o.value)+(r??A.general.spinnerStep)>a||(o.value=this.formatValue(parseFloat(o.value)+(r??A.general.spinnerStep)),this.onChange?.(parseFloat(o.value)))},l.appendChild(c);const u=document.createElement("button");u.classList.add("spinner-down"),u.onclick=()=>{n!==void 0&&parseFloat(o.value)-(r??A.general.spinnerStep)i.chartManager.loadAudio()}},{title:"Background Image",propName:"BACKGROUND",input:{type:"file",typeName:"image",accept:Wr}},{title:"Banner Image",propName:"BANNER",input:{type:"file",typeName:"image",accept:Wr}},{title:"CD Title",propName:"CDTITLE",input:{type:"file",typeName:"image",accept:Wr}},{title:"CD Image",propName:"CDIMAGE",input:{type:"file",typeName:"image",accept:Wr}},{title:"Jacket",propName:"JACKET",input:{type:"file",typeName:"image",accept:Wr}},{title:"Disc Image",propName:"DISCIMAGE",input:{type:"file",typeName:"image",accept:Wr}}]},{title:"Song",items:[{title:"Song Preview",propName:"SAMPLESTART",input:{type:"custom",create:(i,e,t)=>{const r=t??pt.instance,s=()=>{a.value{(e??f.chartManager.loadedSM).properties.SAMPLESTART=h,(e??f.chartManager.loadedSM).properties.SAMPLELENGTH=d,n.setValue(parseFloat(h)),a.setValue(parseFloat(h)+parseFloat(d))},undo:()=>{(e??i.chartManager.loadedSM).properties.SAMPLESTART=c,(e??i.chartManager.loadedSM).properties.SAMPLELENGTH=u,n.setValue(parseFloat(c)),a.setValue(parseFloat(c)+parseFloat(u))}})},n=ot.create(parseFloat((e??i.chartManager.loadedSM).properties.SAMPLESTART??"0"),void 0,3,0);n.onChange=c=>{if(c===void 0){n.setValue(parseFloat((e??i.chartManager.loadedSM).properties.SAMPLESTART??"0"));return}s()};const a=ot.create(parseFloat((e??i.chartManager.loadedSM).properties.SAMPLESTART??"0")+parseFloat((e??i.chartManager.loadedSM).properties.SAMPLELENGTH??"10"),void 0,3,0);a.onChange=c=>{if(c===void 0){a.setValue(parseFloat((e??i.chartManager.loadedSM).properties.SAMPLESTART??"0")+parseFloat((e??i.chartManager.loadedSM).properties.SAMPLELENGTH??"10"));return}s()};const o=document.createElement("div"),l=document.createElement("div");return l.innerText="to",o.classList.add("flex-row","flex-column-gap"),o.replaceChildren(n.view,l,a.view),o}}}]}];function Cm(i,e,t,r){const s=r??pt.instance;switch(e.input.type){case"custom":return e.input.create(i,t,r);case"string":{const n=document.createElement("input");return n.type="text",n.autocomplete="off",n.spellcheck=!1,n.onkeydown=a=>{a.key=="Enter"&&n.blur()},n.onblur=()=>{const a=(t??i.chartManager.loadedSM).properties[e.propName],o=n.value;s.run({action:l=>{(t??l.chartManager.loadedSM).properties[e.propName]=o,n.value=o},undo:()=>{(t??i.chartManager.loadedSM).properties[e.propName]=a,n.value=a??""}})},n.value=(t??i.chartManager.loadedSM).properties[e.propName]??"",n}case"number":{const n=e.input,a=ot.create(parseFloat((t??i.chartManager.loadedSM).properties[e.propName])??15,n.step,n.precision,n.min,n.max);return a.onChange=o=>{if(o===void 0){a.setValue(parseFloat((t??i.chartManager.loadedSM).properties[e.propName]??"0"));return}const l=(t??i.chartManager.loadedSM).properties[e.propName],c=o.toString();s.run({action:u=>{(t??u.chartManager.loadedSM).properties[e.propName]=c,a.setValue(parseFloat(c))},undo:()=>{(t??i.chartManager.loadedSM).properties[e.propName]=l,a.setValue(parseFloat(l??"0"))}})},a.view}case"file":{const n=e.input,a=e.input.onChange,o=document.createElement("div");o.classList.add("flex-row","flex-column-gap");const l=document.createElement("input");l.type="text",l.autocomplete="off",l.spellcheck=!1,l.placeholder="click to select a file",l.onclick=h=>{h.preventDefault(),l.blur();const d=i.chartManager.smPath.split("/").slice(0,-1).join("/");if(window.nw){const f=document.createElement("input");f.type="file",f.accept=n.accept.join(","),f.onchange=()=>{const p=qe.getRelativePath(d,f.value),m=(t??i.chartManager.loadedSM).properties[e.propName]??"";s.run({action:g=>{(t??g.chartManager.loadedSM).properties[e.propName]=p,l.value=p},undo:()=>{(t??i.chartManager.loadedSM).properties[e.propName]=m,l.value=m}}),a?.(i)},f.click()}else i.windowManager.openWindow(new sa(i,{title:`Select a${n.typeName.match(/^[aieouAIEOU].*/)?"n":""} ${n.typeName} file...`,accepted_file_types:n.accept,disableClose:!0,callback:f=>{const p=qe.getRelativePath(d,f),m=(t??i.chartManager.loadedSM).properties[e.propName]??"";s.run({action:g=>{(t??g.chartManager.loadedSM).properties[e.propName]=p,l.value=p},undo:()=>{(t??i.chartManager.loadedSM).properties[e.propName]=m,l.value=m}}),a?.(i)}},(t??i.chartManager.loadedSM).properties[e.propName]?d+"/"+(t??i.chartManager.loadedSM).properties[e.propName]:i.chartManager.smPath))},l.value=(t??i.chartManager.loadedSM).properties[e.propName]??"",o.appendChild(l);const c=document.createElement("button");c.style.height="100%",c.classList.add("delete"),c.disabled=!0,c.onclick=()=>{l.value="",c.disabled=!0};const u=document.createElement("img");return u.classList.add("icon"),u.style.height="12px",u.src=Ge.TRASH,c.appendChild(u),o.appendChild(c),o}}}class Mm extends Vt{app;sm;actionHistory;fileTable={};constructor(e){super({title:"New Song",width:450,height:492,disableClose:!0,win_id:"sm_properties",blocking:!0});const t=new Blob([eT],{type:"text/plain"}),r=new File([t],"song.sm",{type:"text/plain"});this.sm=new Tm(r),this.app=e,this.actionHistory=new pt(this.app),this.initView()}initView(){this.viewElement.replaceChildren(),this.viewElement.classList.add("sm-properties");const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("label"),t.innerText="Apply to",Sm.forEach(l=>{const c=document.createElement("div");c.classList.add("sm-container");const u=document.createElement("div");u.classList.add("sm-title"),u.innerText=l.title;const h=document.createElement("div");h.classList.add("property-grid"),l.items.forEach(d=>{const f=document.createElement("div");f.classList.add("label"),f.innerText=d.title,h.appendChild(f),d.input.type=="file"?h.appendChild(this.createFileElement(d.propName,d.input.typeName)):h.appendChild(Cm(this.app,d,this.sm,this.actionHistory))}),c.appendChild(u),c.appendChild(h),e.appendChild(c)});const r=document.createElement("div");r.classList.add("menu-options");const s=document.createElement("div");s.classList.add("menu-left");const n=document.createElement("div");n.classList.add("menu-right"),r.appendChild(s),r.appendChild(n);const a=document.createElement("button");a.innerText="Cancel",a.onclick=()=>{this.closeWindow()};const o=document.createElement("button");o.innerText="Create",o.classList.add("confirm"),o.onclick=()=>{this.sm.properties.MUSIC===void 0||this.sm.properties.MUSIC===""?this.app.windowManager.openWindow(new Ic(this.app,"No audio file uploaded","Are you sure you want to create a file with no audio?",[{type:"confirm",label:"Yes",callback:()=>{this.createSong(),this.closeWindow()}},{type:"default",label:"No"}])):(this.createSong(),this.closeWindow())},s.appendChild(a),n.appendChild(o),e.appendChild(r),this.viewElement.appendChild(e)}async createSong(){let e=this.sm.properties.TITLE;if(window.nw){const t=document.createElement("input");t.type="file",t.onchange=()=>{Oe.create(t.value),console.log(t.value)},t.click()}else if(await qe.getDirectoryHandle(e)){let t=2;for(;await qe.getDirectoryHandle(e);)e=`${this.sm.properties.TITLE} ${t++}`}await qe.writeFile(e+"/song.sm",this.sm.serialize("sm")),await Promise.all(Object.entries(this.fileTable).map(t=>qe.writeFile(e+`/${t[0]}`,t[1]))),await this.app.chartManager.loadSM(e+"/song.sm"),this.app.windowManager?.getWindowById("select_sm_initial")?.closeWindow()}isValid(){return this.sm.properties.TITLE!==void 0&&this.sm.properties.TITLE!==""&&this.sm.properties.MUSIC!==void 0&&this.sm.properties.MUSIC!==""}createFileElement(e,t){const r=document.createElement("div");r.classList.add("flex-row","flex-column-gap");const s=document.createElement("input");s.type="text",s.autocomplete="off",s.spellcheck=!1,s.placeholder="click to upload a file",s.onclick=o=>{o.preventDefault(),s.blur();const l=document.createElement("input");l.type="file",l.accept=t=="audio"?"audio/*":"image/*",l.onchange=()=>{const c=l.files?.[0];if(!c)return;this.sm.properties[e]&&this.fileTable[this.sm.properties[e]]&&delete this.fileTable[this.sm.properties[e]];let u=c.name;for(;this.fileTable[c.name]&&(this.fileTable[c.name].size!=c.size||this.fileTable[c.name].type!=c.type);)u="_"+u;this.fileTable[u]=c,s.value=u,this.sm.properties[e]=s.value,n.disabled=!1},l.click()},s.value=this.sm.properties[e]??"",r.appendChild(s);const n=document.createElement("button");n.style.height="100%",n.classList.add("delete"),n.disabled=!0,n.onclick=()=>{this.sm.properties[e]&&this.fileTable[this.sm.properties[e]]&&delete this.fileTable[this.sm.properties[e]],this.sm.properties[e]=void 0,s.value="",n.disabled=!0};const a=document.createElement("img");return a.classList.add("icon"),a.style.height="12px",a.src=Ge.TRASH,n.appendChild(a),r.appendChild(n),r}}class tT extends Vt{app;metronomeInterval;startTime;me_high=new Kr.Howl({src:"assets/sound/metronome_high.ogg",volume:A.audio.soundEffectVolume});me_low=new Kr.Howl({src:"assets/sound/metronome_low.ogg",volume:A.audio.soundEffectVolume});tickLines=[];resultLines=[];previousOffsets=[];keyHandler;constructor(e){super({title:"Offset Adjuster",width:300,height:200,win_id:"offset",blocking:!0}),this.app=e,this.initView(),this.startTime=performance.now();let t=this.startTime+500;this.tickLines.push({time:t+500*1,beat:0}),this.tickLines.push({time:t+500*2,beat:1}),this.tickLines.push({time:t+500*3,beat:2}),this.tickLines.push({time:t+500*4,beat:3});let r=0;this.metronomeInterval=setInterval(()=>{const s=performance.now();if(s-t>500){for(t=s,(r%4==0?this.me_high:this.me_low).play();this.tickLines[0]?.time+1e3s-n.startTime<8e3)},5),this.keyHandler=s=>{if(s.code.startsWith("Digit")||s.code.startsWith("Key")||s.code=="Space"){let n=this.tickLines[0];const a=performance.now();for(const l of this.tickLines)if(a-l.time+A.play.offset*1e3<300){n=l;break}s.preventDefault();const o=a-n.time+A.play.offset*1e3;o>-300&&(this.tickLines.splice(this.tickLines.indexOf(n),1),this.resultLines.push({startTime:performance.now(),offset:o}),this.previousOffsets.push(o),this.previousOffsets.length==16&&(dm(this.previousOffsets)<70&&(A.play.offset-=jo(this.previousOffsets)/1e3),this.previousOffsets=[]))}},window.addEventListener("keydown",this.keyHandler)}initView(){this.viewElement.replaceChildren();const e=document.createElement("canvas");this.viewElement.appendChild(e);const t=this.drawEQ(e);requestAnimationFrame(t)}drawEQ(e){const t=e.getContext("2d");t.canvas.width=250,t.canvas.height=100;const r=()=>{t.fillStyle="rgba(0, 0, 0, 1)",t.fillRect(0,0,e.width,e.height),t.fillStyle="rgb(255, 255, 255)",t.fillRect(e.width/2-1,8,2,e.height-16);const s=performance.now();for(const n of this.resultLines){t.fillStyle="rgba(255, 255, 255, 1)";const a=Math.min(1,4-(s-n.startTime)/2e3);if(n.offset<0&&(t.fillStyle=`rgba(160, ${Ls(160,0,-n.offset/250)}, ${Ls(160,0,-n.offset/250)}, ${a})`),n.offset>0&&(t.fillStyle=`rgba(${Ls(160,0,n.offset/250)}, ${Ls(160,0,n.offset/250)}, 160, ${a})`),t.fillRect(e.width/2-.5+n.offset/4,12,1,e.height-24),s-n.startTime<250){const o=(s-n.startTime)/250;t.globalAlpha=1-o,t.fillRect(e.width/2-.5-o*3+n.offset/4,12-o*10,1+o*6,e.height-24+o*20)}t.globalAlpha=1}for(const n of this.tickLines){const a=n.time-s-A.play.offset*1e3;t.fillStyle="rgba(255, 255, 255, 0.8)",n.beat%4!=0?t.fillRect(e.width/2-1-a/4,12,2,e.height-24):t.fillRect(e.width/2-2-a/4,12,4,e.height-24)}e.closest("#windows")&&requestAnimationFrame(r)};return r}onClose(){clearInterval(this.metronomeInterval),window.removeEventListener("keydown",this.keyHandler)}}class iT extends Vt{app;changeHandler=()=>this.initView();constructor(e){super({title:"Song Properties",width:450,height:486,disableClose:!1,win_id:"sm_properties",blocking:!1}),this.app=e,this.initView(),se.on("smLoaded",this.changeHandler),se.on("undo",this.changeHandler),se.on("redo",this.changeHandler)}onClose(){se.off("smLoaded",this.changeHandler),se.off("undo",this.changeHandler),se.off("redo",this.changeHandler)}initView(){this.viewElement.replaceChildren(),this.viewElement.classList.add("sm-properties");const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("label"),t.innerText="Apply to",Sm.forEach(r=>{const s=document.createElement("div");s.classList.add("sm-container");const n=document.createElement("div");n.classList.add("sm-title"),n.innerText=r.title;const a=document.createElement("div");a.classList.add("property-grid"),r.items.forEach(o=>{const l=document.createElement("div");l.classList.add("label"),l.innerText=o.title,a.appendChild(l),a.appendChild(Cm(this.app,o))}),s.appendChild(n),s.appendChild(a),e.appendChild(s)}),this.viewElement.appendChild(e)}}const Kt=i=>i,qu={offset:{title:"Offset",element:Kt({create:(i,e)=>{const t=ot.create(0,.001,3);return t.onChange=r=>{r!=null&&(i.chartManager.loadedChart?.timingData.insert(e(),"OFFSET",r),i.chartManager.setBeat(i.chartManager.getBeat()))},t.view},update:(i,e)=>{const t=i.querySelector(".spinner-input");if(document.activeElement==t)return;const r=e.getTimingData("OFFSET");t.value!=de(r,3).toFixed(3)&&(t.value=de(r,3).toFixed(3))}})},bpm:{title:"BPM",element:Kt({create:(i,e)=>{const t=ot.create(120,void 0,3);return t.onChange=r=>{if(r==null){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"BPMS",s);return}i.chartManager.loadedChart?.timingData.insert(e(),"BPMS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("BPMS",t)?.value??120;r.value!=de(s,3).toFixed(3)&&(r.value=de(s,3).toFixed(3))}})},stop:{title:"Stop",element:Kt({create:(i,e)=>{const t=ot.create(0,void 0,3);return t.onChange=r=>{if(r==null||r==0){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"STOPS",s);return}i.chartManager.loadedChart?.timingData.insert(e(),"STOPS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("STOPS",t);let n=s?.value??0;t!=s?.beat&&(n=0),r.value!=de(n,3).toFixed(3)&&(r.value=de(n,3).toFixed(3))}})},delay:{title:"Delay",element:Kt({create:(i,e)=>{const t=ot.create(0,void 0,3);return t.onChange=r=>{if(r==null||r==0){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"DELAYS",s);return}i.chartManager.loadedChart?.timingData.insert(e(),"DELAYS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("DELAYS",t);let n=s?.value??0;t!=s?.beat&&(n=0),r.value!=de(n,3).toFixed(3)&&(r.value=de(n,3).toFixed(3))}})},warp:{title:"Warp",element:Kt({create:(i,e)=>{const t=ot.create(0,void 0,3,0);return t.onChange=r=>{if(r==null||r==0){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"WARPS",s);return}r<0||i.chartManager.loadedChart?.timingData.insert(e(),"WARPS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("WARPS",t);let n=s?.value??0;t!=s?.beat&&(n=0),r.value!=de(n,3).toFixed(3)&&(r.value=de(n,3).toFixed(3))}})},timeSig:{title:"Time Sig.",element:Kt({create:(i,e)=>{const t=document.createElement("div");t.classList.add("flex-column-gap");const r=ot.create(4,1,0,1);r.onChange=n=>{if(n==null){const a=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"TIMESIGNATURES",a);return}n<1||i.chartManager.loadedChart?.timingData.insert(e(),"TIMESIGNATURES",{upper:n,lower:s.value},i.chartManager.getBeat())};const s=ot.create(4,1,0,1);return s.onChange=n=>{if(n==null){const a=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"TIMESIGNATURES",a);return}n<1||i.chartManager.loadedChart?.timingData.insert(e(),"TIMESIGNATURES",{upper:r.value,lower:n},i.chartManager.getBeat())},t.appendChild(r.view),t.appendChild(s.view),t},update:(i,e,t)=>{const r=i.firstElementChild.querySelector(".spinner-input"),s=i.lastElementChild.querySelector(".spinner-input"),n=e.getTimingEventAtBeat("TIMESIGNATURES",t),a=n?.upper??4,o=n?.lower??4;document.activeElement!=r&&r.value!=Math.round(a).toString()&&(r.value=Math.round(a).toString()),document.activeElement!=s&&s.value!=Math.round(o).toString()&&(s.value=Math.round(o).toString())}})},tick:{title:"Tickcount",element:Kt({create:(i,e)=>{const t=ot.create(4,1,0,0);return t.onChange=r=>{if(r==null){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"TICKCOUNTS",s);return}r<0||i.chartManager.loadedChart?.timingData.insert(e(),"TICKCOUNTS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("TICKCOUNTS",t)?.value??4;r.value!=Math.round(s).toString()&&(r.value=Math.round(s).toString())}})},combo:{title:"Combo",element:Kt({create:(i,e)=>{const t=document.createElement("div");t.classList.add("flex-column-gap");const r=ot.create(1,1,0,0);r.onChange=n=>{if(n==null){const a=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"COMBOS",a);return}n<0||i.chartManager.loadedChart?.timingData.insert(e(),"COMBOS",{hitMult:n,missMult:s.value},i.chartManager.getBeat())};const s=ot.create(1,1,0,0);return s.onChange=n=>{if(n==null){const a=i.chartManager.getBeat();s.setValue(i.chartManager.loadedChart?.timingData.getTimingEventAtBeat("COMBOS",a)?.missMult??1);return}n<0||i.chartManager.loadedChart?.timingData.insert(e(),"COMBOS",{hitMult:n,missMult:s.value},i.chartManager.getBeat())},t.appendChild(r.view),t.appendChild(s.view),t},update:(i,e,t)=>{const r=i.firstElementChild.querySelector(".spinner-input"),s=i.lastElementChild.querySelector(".spinner-input"),n=e.getTimingEventAtBeat("COMBOS",t),a=n?.hitMult??1,o=n?.missMult??1;document.activeElement!=r&&r.value!=Math.round(a).toString()&&(r.value=Math.round(a).toString()),document.activeElement!=s&&s.value!=Math.round(o).toString()&&(s.value=Math.round(o).toString())}})},speed:{title:"Speed",element:Kt({create:(i,e)=>{const t=document.createElement("div");t.classList.add("flex-column-gap");const r=()=>{i.chartManager.loadedChart?.timingData.insert(e(),"SPEEDS",{value:s.value,delay:n.value,unit:a.value=="Beats"?"B":"T"},i.chartManager.getBeat())},s=ot.create(1,.1,0);s.onChange=o=>{if(o==null){const l=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"SPEEDS",l);return}r()};const n=ot.create(1,.1,0);n.onChange=o=>{o==null||o<0||r()};const a=hi.create(["Beat","Time"],"Beats");return a.onChange=r,t.appendChild(s.view),t.appendChild(n.view),t.appendChild(a.view),t},update:(i,e,t)=>{const r=i.firstElementChild.querySelector(".spinner-input"),s=i.children[1].querySelector(".spinner-input"),n=e.getTimingEventAtBeat("SPEEDS",t),a=n?.value??1,o=n?.delay??0,l=n?.unit=="B"?"Beat":"Time";document.activeElement!=r&&r.value!=de(a,3).toFixed(3)&&(r.value=de(a,3).toFixed(3)),document.activeElement!=s&&s.value!=de(o,3).toFixed(3)&&(s.value=de(o,3).toFixed(3)),s.disabled=n?.beat!=t;const c=i.lastElementChild.querySelector(".dropdown-selected");c.innerText!=l&&(c.innerText=l),n?.beat!=t?c.classList.add("disabled"):c.classList.remove("disabled")}})},scroll:{title:"Scroll",element:Kt({create:(i,e)=>{const t=ot.create(1,void 0,3);return t.onChange=r=>{if(r==null){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"SCROLLS",s);return}i.chartManager.loadedChart?.timingData.insert(e(),"SCROLLS",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("SCROLLS",t)?.value??1;r.value!=de(s,3).toFixed(3)&&(r.value=de(s,3).toFixed(3))}})},fake:{title:"Fake",element:Kt({create:(i,e)=>{const t=ot.create(1,void 0,3,0);return t.onChange=r=>{if(r==null){const s=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"FAKES",s);return}r<0||i.chartManager.loadedChart?.timingData.insert(e(),"FAKES",{value:r},i.chartManager.getBeat())},t.view},update:(i,e,t)=>{const r=i.querySelector(".spinner-input");if(document.activeElement==r)return;const s=e.getTimingEventAtBeat("FAKES",t);let n=s?.value??1;t!=s?.beat&&(n=0),r.value!=de(n,3).toFixed(3)&&(r.value=de(n,3).toFixed(3))}})},label:{title:"Label",element:Kt({create:(i,e)=>{const t=document.createElement("input");return t.type="text",t.autocomplete="off",t.spellcheck=!1,t.onkeydown=r=>{r.key=="Enter"&&t.blur()},t.onblur=()=>{if(t.value==""){const r=i.chartManager.getBeat();i.chartManager.loadedChart?.timingData.delete(e(),"LABELS",r);return}i.chartManager.loadedChart?.timingData.insert(e(),"LABELS",{value:t.value},i.chartManager.getBeat())},t},update:(i,e,t)=>{const r=i;if(document.activeElement==r)return;const n=e.getTimingEventAtBeat("LABELS",t)?.value??"";r.value!=n&&(r.value=n)}})}};class rT extends Vt{app;lastBeat;songTiming=!1;interval;changeHandler=()=>this.setData();constructor(e){super({title:"Edit Timing Data",width:300,height:340,disableClose:!1,win_id:"timing_data",blocking:!1}),this.app=e,this.lastBeat=Math.round(this.app.chartManager.getBeat()*1e3)/1e3,this.songTiming=!this.app.chartManager.loadedChart.timingData.isEmpty(),this.initView(),this.interval=setInterval(()=>{Math.round(this.app.chartManager.getBeat()*1e3)/1e3!=this.lastBeat&&(this.lastBeat=Math.round(this.app.chartManager.getBeat()*1e3)/1e3,this.setData())},17),se.on("timingModified",this.changeHandler),se.on("chartLoaded",this.changeHandler)}onClose(){se.off("timingModified",this.changeHandler),clearInterval(this.interval)}initView(){this.viewElement.replaceChildren(),this.viewElement.classList.add("timing-data");const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("label"),t.innerText="Apply to";const r=hi.create(["All charts","This chart"],this.songTiming?"This chart":"All charts");r.onChange(s=>{this.songTiming=s=="This chart"}),e.appendChild(t),e.appendChild(r.view),Object.values(qu).forEach(s=>{const n=document.createElement("div");n.classList.add("label"),n.innerText=s.title;const a=s.element.create(this.app,()=>this.songTiming);e.appendChild(n),e.appendChild(a)}),this.viewElement.appendChild(e),this.setData()}setData(){this.app.chartManager.loadedChart&&Object.values(qu).forEach((e,t)=>{const r=this.viewElement.children[0].children[t*2+3];e.element.update(r,this.app.chartManager.loadedChart.timingData,this.lastBeat)})}}const Ku=[{type:"group",id:"general",label:"General",children:[{type:"subgroup",children:[{type:"item",label:"Smooth Animations",id:"general.smoothAnimations",input:{type:"checkbox",onChange:(i,e)=>{e?document.body.classList.add("animated"):document.body.classList.remove("animated")}}},{type:"item",label:"Warn before exit",id:"general.warnBeforeExit",input:{type:"checkbox"},tooltip:"Warn before exiting the editor if you have unsaved changes."},{type:"item",label:"Spinner step",id:"general.spinnerStep",input:{type:"slider",min:0,step:.1,max:5,hardMin:0,hardMax:2**31-1},tooltip:"The default increment for all number spinners."}]}]},{type:"group",id:"chart",label:"Chart",children:[{type:"subgroup",label:"Playfield",children:[{type:"subgroup",children:[{type:"item",label:"Enable mouse placement",id:"chart.mousePlacement",input:{type:"checkbox"}}]},{type:"subgroup",children:[{type:"item",label:"Zoom",id:"chart.zoom",input:{type:"slider",min:50,step:1,max:200,hardMax:2**31-1,transformers:{serialize:i=>i*100,deserialize:i=>i/100}}},{type:"item",label:"Reverse playfield",id:"chart.reverse",input:{type:"checkbox"}}]},{type:"subgroup",children:[{type:"item",label:"Y position",id:"chart.receptorYPos",input:{type:"slider",min:-400,max:0,hardMin:-(2**31-1),hardMax:2**31-1}},{type:"item",label:"Draw length",id:"chart.maxDrawBeats",input:{type:"slider",min:0,max:30,hardMax:2**31-1},tooltip:"Maximum number of beats to draw notes. Increasing this works well for songs with high bpm but can affect performance. Only applies to XMod."},{type:"item",label:"Draw length past receptors",id:"chart.maxDrawBeatsBack",input:{type:"slider",min:0,max:30,hardMax:2**31-1},tooltip:"Maximum number of beats to draw notes past the receptors. Increasing this can affect performance. Only applies to XMod."}]},{type:"subgroup",children:[{type:"item",label:"Draw noteflashes",id:"chart.drawNoteFlash",input:{type:"checkbox"}}]}]},{type:"subgroup",label:"Scrolling",children:[{type:"item",label:"Scroll sensitivity",id:"chart.scroll.scrollSensitivity",input:{type:"slider",min:0,step:1,max:200,hardMax:2**31-1,transformers:{serialize:i=>i*100,deserialize:i=>i/100}},tooltip:"Adjust the scroll sensitivity when scrolling through the chart."},{type:"item",label:"Snap every scroll",id:"chart.scroll.scrollSnapEveryScroll",input:{type:"checkbox"},tooltip:"Whether each scroll movement corresponds to moving one snap unit when scrolling. Turning this on will have the same behavior as ArrowVortex."},{type:"item",label:"Invert zoom in/out",id:"chart.scroll.invertZoomScroll",input:{type:"checkbox"},tooltip:"Inverts the zoom in/out control when scrolling."},{type:"item",label:"Invert scroll direction when in reverse",id:"chart.scroll.invertReverseScroll",input:{type:"checkbox"}}]},{type:"subgroup",label:"Waveform",children:[{type:"item",label:"Draw waveform",id:"chart.waveform.enabled",input:{type:"checkbox"}},{type:"subgroup",children:[{type:"item",label:"Color",id:"chart.waveform.color",input:{type:"color"}},{type:"item",label:"Opacity",id:"chart.waveform.opacity",input:{type:"slider",min:0,max:1,step:.01}}]},{type:"subgroup",children:[{type:"item",label:"Draw filtered waveform",id:"chart.waveform.allowFilter",input:{type:"checkbox"}},{type:"item",label:"Filtered color",id:"chart.waveform.filteredColor",input:{type:"color"}},{type:"item",label:"Filtered opacity",id:"chart.waveform.filteredOpacity",input:{type:"slider",min:0,max:1,step:.01}}]},{type:"item",label:"Line height",id:"chart.waveform.lineHeight",input:{type:"slider",min:1,max:3,step:.1,hardMax:100},tooltip:"The height of each line of the waveform. Increasing this can help performance."},{type:"item",label:"Antialiasing",id:"chart.waveform.antialiasing",input:{type:"checkbox"}},{type:"item",label:"Allow speed changes",id:"chart.waveform.speedChanges",input:{type:"checkbox"},tooltip:"Allows the waveform to be affected by SPEEDS and SCROLLS."}]}]},{type:"group",id:"audio",label:"Audio",children:[{type:"subgroup",children:[{type:"item",label:"Master volume",id:"audio.masterVolume",input:{type:"slider",min:0,step:1,max:100,hardMax:2**31-1,transformers:{serialize:i=>i*100,deserialize:i=>i/100}}},{type:"item",label:"Song volume",id:"audio.songVolume",input:{type:"slider",min:0,step:1,max:100,hardMax:2**31-1,transformers:{serialize:i=>i*100,deserialize:i=>i/100}}},{type:"item",label:"Sound effect volume",id:"audio.soundEffectVolume",input:{type:"slider",min:0,step:1,max:100,hardMax:2**31-1,transformers:{serialize:i=>i*100,deserialize:i=>i/100}}}]},{type:"subgroup",children:[{type:"item",label:"Enable assist tick",id:"audio.assistTick",input:{type:"checkbox"},tooltip:"Plays a sound when a note passes the receptors"},{type:"item",label:"Enable metronome",id:"audio.metronome",input:{type:"checkbox"}}]},{type:"subgroup",children:[{type:"item",label:"Allow filters to affect audio",id:"audio.allowFilter",input:{type:"checkbox",onChange:i=>{i.chartManager.chartAudio.reload()}}},{type:"item",label:"Enable metronome",id:"audio.metronome",input:{type:"checkbox"}}]}]},{type:"group",id:"play",label:"Play mode",children:[{type:"subgroup",label:"Calibration",children:[{type:"item",label:"Global offset",id:"play.offset",input:{type:"slider",min:-1,step:.001,max:1,hardMin:-(2**31-1),hardMax:2**31-1},tooltip:"Offset in seconds when playing a chart. Set to positive if you are hitting early and negative if you are hitting late."},{type:"item",label:"Sound effect offset",id:"play.effectOffset",input:{type:"slider",min:-1,step:.001,max:1,hardMin:-(2**31-1),hardMax:2**31-1},tooltip:"Offset in seconds when playing sound effects like assist tick and metronome."},{type:"item",label:"Visual offset",id:"play.visualOffset",input:{type:"slider",min:-1,step:.001,max:1,hardMin:-(2**31-1),hardMax:2**31-1},tooltip:"Offset in seconds when displaying notes."}]},{type:"subgroup",children:[{type:"item",label:"Judgment tilt",id:"play.judgmentTilt",input:{type:"checkbox"},tooltip:"Tilts the judgement text left if you are hitting early and right if you are hitting late."},{type:"item",label:"Hide barlines during play",id:"play.hideBarlines",input:{type:"checkbox"}}]},{type:"subgroup",label:"Timing windows",children:[{type:"item",id:"play.timingCollection",label:"Timing window collection",input:{type:"dropdown",advanced:!1,get items(){return Object.keys(et.getCollections())}}},{type:"item",id:"play.timingWindowScale",label:"Timing window scale",input:{type:"slider",min:0,step:.001,max:2,hardMax:2**31-1},tooltip:"Scales all timing windows by the given amount."},{type:"item",id:"play.timingWindowAdd",label:"Timing window add",input:{type:"slider",min:0,step:.001,max:1,hardMax:2**31-1},tooltip:"Adds this value (in seconds) to all timing windows."}]}]},{type:"group",id:"performance",label:"Performance",children:[{type:"item",label:"Antialiasing",id:"performance.antialiasing",input:{type:"checkbox"}},{type:"item",label:"Resolution",id:"performance.resolution",input:{type:"slider",min:1,step:1,max:4,hardMin:0,hardMax:2**31-1},tooltip:"Requires a reload."}]},{type:"group",id:"debug",label:"Debug",children:[{type:"item",label:"Show FPS",id:"debug.showFPS",input:{type:"checkbox"}},{type:"item",label:"Show rendering timers",id:"debug.showTimers",input:{type:"checkbox"}}]}];class sT extends Vt{app;observer;sectionContainer;constructor(e){super({title:"Options",width:600,height:400,disableClose:!1,win_id:"user_options",blocking:!1}),this.app=e,this.initView()}initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("pref-container");const r=document.createElement("div");r.classList.add("pref-search");const s=document.createElement("input");s.classList.add("pref-search-bar"),s.type="text",s.placeholder="Search for an option...",s.oninput=()=>{a.replaceChildren(),o.replaceChildren(...this.createOptions(this.filterOptions(s.value)))},r.appendChild(s);const n=document.createElement("div");n.classList.add("pref-scrollers");const a=document.createElement("div");a.classList.add("pref-section-scroller"),this.sectionContainer=a;const o=document.createElement("div");o.classList.add("pref-option-scroller"),n.replaceChildren(a,o),this.observer=new IntersectionObserver(l=>{l.forEach(c=>{const u=c.target.dataset.id,h=a.querySelector(`.pref-section[data-id=${u}]`);h&&(c.intersectionRatio>0?h.classList.add("selected"):h.classList.remove("selected"))})},{}),t.replaceChildren(r,n),a.replaceChildren(),o.replaceChildren(...this.createOptions(Ku)),e.appendChild(t),this.viewElement.appendChild(e)}createOptions(e){return e.map(t=>{const r=this.makeOption(t);return t.type=="group"&&(this.observer.observe(r),this.sectionContainer?.appendChild(this.createEmptyGroup(t))),r})}makeOption(e){const t=document.createElement("div");t.classList.add("pref-"+e.type),(e.type=="group"||e.type=="item")&&(t.dataset.id=e.id);const r=document.createElement("div");r.classList.add(`pref-${e.type}-label`),e.label!==void 0&&(r.innerText=e.label,t.appendChild(r));const s=document.createElement("img");if(e.type=="item"&&(s.src=Ge.REVERT,s.style.width="12px",s.addEventListener("click",()=>{A.applyOption([e.id,A.getDefaultOption(e.id)]),t.replaceWith(this.makeOption(e))}),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",t.appendChild(s)),e.type=="item"){const n=A.getOption(e.id);let a;if(!e.input)return t;switch(r.innerText=e.label,e.input.type){case"checkbox":{const o=document.createElement("input"),l=e.input.onChange;o.type="checkbox",o.checked=n,o.onblur=null,o.onchange=()=>{A.applyOption([e.id,o.checked]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",l?.(this.app,o.checked)},o.classList.add("pref-input","right"),o.onkeydown=c=>{c.key=="Enter"&&o.blur()},a=o;break}case"dropdown":{if(e.input.advanced){const o=e.input.transformers.deserialize,l=e.input.transformers.serialize,c=e.input.onChange,u=hi.create(e.input.items,l(n));u.onChange(h=>{A.applyOption([e.id,o(h)]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",c?.(o(h))}),u.view.classList.add("pref-input","dropdown-right"),a=u.view}else{const o=e.input.onChange,l=hi.create(e.input.items,n);l.onChange(c=>{A.applyOption([e.id,c]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",o?.(c)}),l.view.classList.add("pref-input","dropdown-right"),a=l.view}break}case"number":{const o=e.input.transformers?.deserialize??(h=>h),l=e.input.transformers?.serialize??(h=>h),c=e.input.onChange,u=ot.create(l(n),e.input.step,e.input.precision,e.input.min,e.input.max);u.onChange=h=>{if(!h){u.setValue(l(h));return}A.applyOption([e.id,o(h)]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",c?.(o(h))},a=u.view;break}case"slider":{const o=e.input.transformers?.deserialize??(m=>m),l=e.input.transformers?.serialize??(m=>m),c=e.input.onChange,u=document.createElement("div");u.style.display="flex",u.style.alignItems="center";const h=document.createElement("input");h.type="range",h.min=e.input.min?.toString()??"",h.max=e.input.max?.toString()??"",h.step=e.input.step?.toString()??"1",h.value=l(n).toString();const d=document.createElement("input");d.type="text",d.value=(Math.round(l(n)*1e3)/1e3).toString();const f=e.input.min??e.input.hardMin??-Number.MAX_VALUE,p=e.input.max??e.input.hardMax??Number.MAX_VALUE;d.onblur=()=>{let m=qn(d.value);if(!m){d.value=(Math.round(l(n)*1e3)/1e3).toString();return}m=Je(m,f,p),d.value=de(m,3).toString(),d.blur(),d.value==""?d.value=l(m).toString():A.applyOption([e.id,o(m)]),h.value=m.toString(),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",c?.(o(m))},d.oninput=()=>{d.value=d.value.replaceAll(/[^.0-9+-/*]/g,"")},h.oninput=()=>{const m=parseFloat(h.value);d.value=de(m,3).toString(),A.applyOption([e.id,o(m)]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block"},d.style.width="50px",d.onkeydown=m=>{m.key=="Enter"&&d.blur()},u.appendChild(h),u.appendChild(d),a=u;break}case"text":{const o=e.input.onChange,l=document.createElement("input");l.type="text",l.value=n.toString(),l.onblur=()=>{A.applyOption([e.id,l.value]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block",o?.(l.value)},l.onkeydown=c=>{c.key=="Enter"&&l.blur()},a=l;break}case"color":{const o=document.createElement("input");o.type="color",o.value="#"+n.toString(16),o.onblur=()=>{A.applyOption([e.id,parseInt(o.value.slice(1),16)]),s.style.display=A.getDefaultOption(e.id)===A.getOption(e.id)?"none":"block"},a=o}}a.classList.add("pref-item-input"),t.appendChild(a)}else{const n=document.createElement("div");n.classList.add("pref-children"),t.appendChild(n),n.replaceChildren(...this.createOptions(e.children))}return e.type=="item"&&e.tooltip!==void 0&&kr(t,{content:e.tooltip}),t}filterOptions(e,t=Ku){const r=[];return t.forEach(s=>{if(s.label&&s.label.toLowerCase().includes(e.toLowerCase())){r.push(s);return}if(s.type=="group"||s.type=="subgroup"){const n=this.filterOptions(e,s.children);n.length!=0&&r.push({...s,children:n})}}),r}static expandMenubarOptions(e){switch(e.type){case"menu":case"dropdown":return e.options.map(t=>this.expandMenubarOptions(t)).flat();case"selection":case"checkbox":return[e.id];case"seperator":return[]}}createEmptyGroup(e){const t=document.createElement("div");return t.classList.add("pref-section"),t.dataset.id=e.id,t.innerText=e.label,t.onclick=()=>{t.parentElement.parentElement.querySelector(`.pref-group[data-id=${e.id}]`).scrollIntoView()},t}onClose(){this.observer?.disconnect()}}var Mn=(i=>(i.SHIFT="Shift",i.CTRL="Ctrl",i.ALT="Alt",i.META="Command",i))(Mn||{});const ss=navigator.userAgent.indexOf("Mac OS X")>-1,Tt=ss?"Command":"Ctrl",nT={Shift:ss?"⇧":"Shift",Ctrl:ss?"⌃":"Ctrl",Alt:ss?"⌥":"Alt",Command:"⌘"},Qu={ArrowLeft:"Left",ArrowUp:"Up",ArrowRight:"Right",ArrowDown:"Down",BracketLeft:"[",BracketRight:"]",Semicolon:";",Quote:"'",Backslash:"\\",Slash:"/",Period:".",Comma:",",Backquote:"`",Minus:"-",Equal:"+"},xo=["ctrlKey","altKey","shiftKey","metaKey"],Qa=["Ctrl","Alt","Shift","Command"],ht={playback:{label:"Play/Pause",combos:[{key:"Space",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.playPause()},decreaseSnap:{label:"Decrease snap",combos:[{key:"Left",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.previousSnap()},increaseSnap:{label:"Increase snap",combos:[{key:"Right",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.nextSnap()},cursorUp:{label:"Move cursor up",combos:[{key:"Up",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>{const e=Math.max(.001,A.chart.snap),t=Math.round(i.chartManager.getBeat()/e)*e,r=Math.abs(t-i.chartManager.getBeat())<5e-4?e:e/2;i.chartManager.setAndSnapBeat(i.chartManager.getBeat()-r)}},cursorDown:{label:"Move cursor down",combos:[{key:"Down",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>{const e=Math.max(.001,A.chart.snap),t=Math.round(i.chartManager.getBeat()/e)*e,r=Math.abs(t-i.chartManager.getBeat())<5e-4?e:e/2;i.chartManager.setAndSnapBeat(i.chartManager.getBeat()+r)}},increaseScrollSpeed:{label:"Increase scroll speed",combos:[{key:"Up",mods:[Tt]}],disabled:i=>!i.chartManager.chartView,callback:()=>A.chart.speed=Math.max(10,A.chart.speed*Math.pow(1.01,30))},decreaseScrollSpeed:{label:"Decrease scroll speed",combos:[{key:"Down",mods:[Tt]}],disabled:i=>!i.chartManager.chartView,callback:()=>A.chart.speed=Math.max(10,A.chart.speed*Math.pow(1.01,-30))},zoomIn:{label:"Zoom in",combos:[{key:"+",mods:[Tt]}],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.zoom+=.1,Oe.create("Zoom: "+Math.round(A.chart.zoom*100)+"%")}},zoomOut:{label:"Zoom out",combos:[{key:"-",mods:[Tt]}],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.zoom=Math.max(.1,A.chart.zoom-.1),Oe.create("Zoom: "+Math.round(A.chart.zoom*100)+"%")}},zoomDefault:{label:"Reset zoom",combos:[{key:"0",mods:[Tt]}],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.zoom=1,Oe.create("Zoom: "+Math.round(A.chart.zoom*100)+"%")}},newSong:{label:"New song...",bindLabel:"New song",combos:[{key:"N",mods:[Tt]}],disabled:i=>!i.chartManager.loadedSM,callback:i=>{i.windowManager.openWindow(new Mm(i))}},openSong:{label:"Open song...",bindLabel:"Open song",combos:[{key:"O",mods:[Tt]}],disabled:i=>!i.chartManager.loadedSM,callback:i=>{if(window.nw){const e=document.createElement("input");e.type="file",e.accept=".sm,.ssc",e.onchange=()=>{i.chartManager.loadSM(e.value)},e.click()}else i.windowManager.openWindow(new sa(i,{title:"Select an sm/ssc file...",accepted_file_types:[".sm",".ssc"],disableClose:!0,callback:e=>{i.chartManager.loadSM(e)}}))}},songProperties:{label:"Song properties...",bindLabel:"Open song properties",combos:[{key:"O",mods:["Shift"]}],disabled:i=>!i.chartManager.loadedSM,callback:i=>i.windowManager.openWindow(new iT(i))},save:{label:"Save...",bindLabel:"Save",combos:[{key:"S",mods:[Tt]}],disabled:i=>!i.chartManager.loadedSM,callback:i=>i.chartManager.save()},export:{label:"Save and export current song",combos:[{key:"E",mods:[Tt]}],disabled:i=>!!window.nw||!i.chartManager.loadedSM,callback:i=>{i.chartManager.save(),qe.saveDirectory(i.chartManager.smPath)}},exportNotedata:{label:"Export to notedata...",bindLabel:"Export to notedata",combos:[{key:"E",mods:[Tt,"Shift"]}],disabled:i=>!!window.nw||!i.chartManager.loadedSM,callback:i=>i.windowManager.openWindow(new QE(i,i.chartManager.selection.notes))},openChart:{label:"Chart list",bindLabel:"Open chart list",combos:[{key:"O",mods:[Tt,"Shift"]}],disabled:i=>!i.chartManager.loadedSM,callback:i=>i.windowManager.openWindow(new bm(i))},timingDataRow:{label:"Edit timing data at row",combos:[{key:"T",mods:["Shift"]}],disabled:i=>!i.chartManager.chartView,callback:i=>i.windowManager.openWindow(new rT(i))},selectRegion:{label:"Select region",combos:[{key:"Tab",mods:[]}],disabled:i=>!i.chartManager.loadedChart,callback:i=>i.chartManager.selectRegion()},volumeUp:{label:"Increase master volume",combos:[{key:"Up",mods:["Alt"]}],disabled:!1,callback:()=>{A.audio.masterVolume=Math.min(A.audio.masterVolume+.05,1),Oe.create("Master volume: "+Math.round(A.audio.masterVolume*100)+"%")}},volumeDown:{label:"Decrease master volume",combos:[{key:"Down",mods:["Alt"]}],disabled:!1,callback:()=>{A.audio.masterVolume=Math.max(A.audio.masterVolume-.05,0),Oe.create("Master volume: "+Math.round(A.audio.masterVolume*100)+"%")}},songVolumeUp:{label:"Increase song volume",combos:[{key:"Up",mods:["Shift","Alt"]}],disabled:!1,callback:()=>{A.audio.songVolume=Math.min(A.audio.songVolume+.05,1),Oe.create("Song volume: "+Math.round(A.audio.songVolume*100)+"%")}},songVolumeDown:{label:"Decrease song volume",combos:[{key:"Down",mods:["Shift","Alt"]}],disabled:!1,callback:()=>{A.audio.songVolume=Math.max(A.audio.songVolume-.05,0),Oe.create("Song volume: "+Math.round(A.audio.songVolume*100)+"%")}},effectvolumeUp:{label:"Increase tick/metronome volume",combos:[{key:"Up",mods:["Shift",Tt,"Alt"]}],disabled:!1,callback:()=>{A.audio.soundEffectVolume=Math.min(A.audio.soundEffectVolume+.05,1),Oe.create("Effect volume: "+Math.round(A.audio.soundEffectVolume*100)+"%")}},effectvolumeDown:{label:"Decrease tick/metronome volume",combos:[{key:"Down",mods:["Shift",Tt,"Alt"]}],disabled:!1,callback:()=>{A.audio.soundEffectVolume=Math.max(A.audio.soundEffectVolume-.05,0),Oe.create("Effect Volume: "+Math.round(A.audio.soundEffectVolume*100)+"%")}},rateUp:{label:"Increase playback rate",combos:[{key:"Right",mods:["Shift"]}],disabled:i=>i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:()=>{A.audio.rate+=.05,Oe.create("Playback Rate: "+Math.round(A.audio.rate*100)+"%")}},rateDown:{label:"Decrease playback rate",combos:[{key:"Left",mods:["Shift"]}],disabled:i=>i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:()=>{A.audio.rate=Math.max(A.audio.rate-.05,.1),Oe.create("Playback Rate: "+Math.round(A.audio.rate*100)+"%")}},rateDefault:{label:"Reset playback rate",combos:[],disabled:!1,callback:()=>{A.audio.rate=1,Oe.create("Playback Rate: "+Math.round(A.audio.rate)+"%")}},previousMeasure:{label:"Previous measure",combos:[{key:"PageUp",mods:[]},{key:";",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>{const e=i.chartManager.getBeat(),t=i.chartManager.loadedChart.timingData.getMeasureLength(e-.001);i.chartManager.setAndSnapBeat(Math.max(0,e-t))}},nextMeasure:{label:"Next measure",combos:[{key:"PageDown",mods:[]},{key:"'",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>{const e=i.chartManager.getBeat(),t=i.chartManager.loadedChart.timingData.getMeasureLength(e);i.chartManager.setAndSnapBeat(Math.max(0,e+t))}},previousNote:{label:"Previous note",combos:[{key:",",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.previousNote()},nextNote:{label:"Next note",combos:[{key:".",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.nextNote()},jumpChartStart:{label:"Jump to first note",combos:[{key:"Home",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.firstNote()},jumpChartEnd:{label:"Jump to last note",combos:[{key:"End",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.lastNote()},jumpSongStart:{label:"Jump to song start",combos:[{key:"Home",mods:["Shift"]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.setBeat(Math.max(0,i.chartManager.loadedChart.getBeatFromSeconds(0)))},jumpSongEnd:{label:"Jump to song end",combos:[{key:"End",mods:["Shift"]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.setBeat(i.chartManager.loadedChart.getBeatFromSeconds(i.chartManager.chartAudio.getSongLength()))},assistTick:{label:"Assist tick",combos:[{key:"F7",mods:[]}],disabled:!1,callback:()=>{A.audio.assistTick=!A.audio.assistTick,Oe.create("Assist Tick: "+(A.audio.assistTick?"on":"off"))}},metronome:{label:"Metronome",combos:[{key:"F7",mods:["Alt"]}],disabled:!1,callback:()=>{A.audio.metronome=!A.audio.metronome,Oe.create("Metronome: "+(A.audio.metronome?"on":"off"))}},renderWaveform:{label:"Render waveform",combos:[],disabled:!1,callback:()=>{A.chart.waveform.enabled=!A.chart.waveform.enabled,Oe.create("Waveform: "+(A.chart.waveform.enabled?"on":"off"))}},waveformOptions:{label:"Waveform options...",bindLabel:"Waveform options",combos:[],disabled:!0,callback:()=>0},XMod:{label:"XMod (Beat-based)",combos:[{key:"X",mods:["Shift"]}],disabled:!1,callback:()=>{A.chart.CMod=!1,Oe.create("Switched to XMod")}},CMod:{label:"CMod (Time-based)",combos:[{key:"C",mods:["Shift"]}],disabled:!1,callback:()=>{A.chart.CMod=!0,Oe.create("Switched to CMod")}},hideWarpedArrows:{label:"Hide warped arrows (CMod only)",combos:[{key:"W",mods:["Shift"]}],disabled:!1,callback:()=>{A.chart.hideWarpedArrows=!A.chart.hideWarpedArrows,Oe.create("Hide Warped Arrows: "+(A.chart.hideWarpedArrows?"on":"off"))}},doSpeedChanges:{label:"Do speed changes (XMod only)",combos:[{key:"S",mods:["Shift"]}],disabled:!1,callback:()=>{A.chart.doSpeedChanges=!A.chart.doSpeedChanges,Oe.create("Speed Changes: "+(A.chart.doSpeedChanges?"on":"off"))}},showEq:{label:"Equalizer",combos:[{key:"E",mods:["Shift"]}],disabled:i=>!i.chartManager.chartAudio,callback:i=>i.windowManager.openWindow(new YE(i))},previousNoteType:{label:"Previous note type",combos:[{key:"N",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.previousNoteType()},nextNoteType:{label:"Next note type",combos:[{key:"M",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.nextNoteType()},undo:{label:"Undo",combos:[{key:"Z",mods:[Tt]}],disabled:i=>!i.actionHistory.canUndo()||i.chartManager.getMode()!=Z.Edit,callback:i=>i.actionHistory.undo()},redo:{label:"Redo",combos:[{key:"Y",mods:[Tt]}],disabled:i=>!i.actionHistory.canRedo()||i.chartManager.getMode()!=Z.Edit,callback:i=>i.actionHistory.redo()},mousePlacement:{label:"Enable Mouse Note Placement",combos:[{key:"M",mods:["Shift"]}],disabled:!1,callback:()=>{A.chart.mousePlacement=!A.chart.mousePlacement,Oe.create("Mouse Note Placement: "+(A.chart.mousePlacement?"on":"off"))}},playMode:{label:"Enter/Exit Play Mode",combos:[{key:"P",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Record,callback:i=>i.chartManager.setMode(Z.Play)},recordMode:{label:"Enter/Exit Record Mode",combos:[{key:"R",mods:[]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play,callback:i=>i.chartManager.setMode(Z.Record)},playModeStart:{label:"Play from start",combos:[{key:"P",mods:["Shift"]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Record,callback:i=>{i.chartManager.setBeat(0),i.chartManager.setMode(Z.Play)}},recordModeStart:{label:"Record from start",combos:[{key:"R",mods:["Shift"]}],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()==Z.Play,callback:i=>i.chartManager.setMode(Z.Record)},options:{label:"Options...",bindLabel:"Edit options",combos:[{key:",",mods:[Tt]}],disabled:!1,callback:i=>{i.windowManager.openWindow(new sT(i))}},keybinds:{label:"Keybinds...",bindLabel:"Edit keybinds",combos:[],disabled:!1,callback:i=>{i.windowManager.openWindow(new Di(i))}},gameplayKeybinds:{label:"Gameplay keybinds...",bindLabel:"Edit gameplay keybinds",combos:[],disabled:!1,callback:i=>{i.windowManager.openWindow(new ZE(i))}},convertHoldsRolls:{label:"Holds to rolls",bindLabel:"Convert holds to rolls",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type=="Hold"&&(e.type="Roll"),e))}},convertRollsHolds:{label:"Rolls to holds",bindLabel:"Convert rolls to holds",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type=="Roll"&&(e.type="Hold"),e))}},swapHoldsRolls:{label:"Swap holds and rolls",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type=="Hold"?e.type="Roll":e.type=="Roll"&&(e.type="Hold"),e))}},convertHoldsTaps:{label:"Holds/rolls to taps",bindLabel:"Convert holds/rolls to taps",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>((e.type=="Hold"||e.type=="Roll")&&(e.type="Tap"),e))}},convertTapsMines:{label:"Taps to mines",bindLabel:"Convert ntapsotes to mines",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type=="Tap"&&(e.type="Mine"),e))}},convertTapsLifts:{label:"Taps to lifts",bindLabel:"Convert taps to lifts",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type=="Tap"&&(e.type="Lift"),e))}},convertTapsFakes:{label:"Taps to fakes",bindLabel:"Convert taps to fakes",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.type=="Tap"&&(e.type="Fake"),e))}},mirrorHorizontally:{label:"Horizontally",bindLabel:"Mirror horizontally",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.col=i.chartManager.loadedChart.gameType.flipColumns.horizontal[e.col],e))}},mirrorVertically:{label:"Vertically",bindLabel:"Mirror vertically",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.col=i.chartManager.loadedChart.gameType.flipColumns.vertical[e.col],e))}},mirrorBoth:{label:"Both",bindLabel:"Mirror both",combos:[],disabled:i=>i.chartManager.selection.notes.length==0||i.chartManager.getMode()!=Z.Edit,callback:i=>{i.chartManager.modifySelection(e=>(e.col=i.chartManager.loadedChart.gameType.flipColumns.horizontal[e.col],e.col=i.chartManager.loadedChart.gameType.flipColumns.vertical[e.col],e))}},selectAll:{label:"Select all",combos:[{key:"A",mods:[Tt]}],disabled:i=>!i.chartManager.loadedChart,callback:i=>{i.chartManager.selection.notes=[...i.chartManager.loadedChart.getNotedata()]}},expand2to1:{label:"Expand 2:1 (8th to 4th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)*2+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold*=2,t.hold=Math.round(t.hold*48)/48),t))}},expand3to2:{label:"Expand 3:2 (12th to 8th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)*1.5+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold*=1.5,t.hold=Math.round(t.hold*48)/48),t))}},expand4to3:{label:"Expand 4:3 (16th to 2th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)*4/3+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold*=4/3,t.hold=Math.round(t.hold*48)/48),t))}},compress1to2:{label:"Compress 1:2 (4th to 8th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)/2+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold/=2,t.hold=Math.round(t.hold*48)/48),t))}},compress2to3:{label:"Compress 2:3 (8th to 12th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)/1.5+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold/=1.5,t.hold=Math.round(t.hold*48)/48),t))}},compress3to4:{label:"Compress 3:4 (12th to 16th)",combos:[],disabled:i=>i.chartManager.selection.notes.length<2||i.chartManager.getMode()!=Z.Edit,callback:i=>{const e=Math.min(...i.chartManager.selection.notes.map(t=>t.beat));i.chartManager.modifySelection(t=>(t.beat=(t.beat-e)*.75+e,t.beat=Math.round(t.beat*48)/48,De(t)&&(t.hold*=.75,t.hold=Math.round(t.hold*48)/48),t))}},delete:{label:"Delete",combos:[{key:"Backspace",mods:[]},{key:"Delete",mods:[]}],disabled:i=>i.chartManager.getMode()!=Z.Edit||i.chartManager.selection.notes.length==0&&i.chartManager.eventSelection.timingEvents.length==0,callback:i=>{i.chartManager.deleteSelection(),i.chartManager.deleteEventSelection()}},paste:{label:"Paste",combos:[],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()!=Z.Edit,callback:async i=>{const e=await navigator.clipboard.readText();i.chartManager.paste(e)}},copy:{label:"Copy",combos:[],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()!=Z.Edit||!i.chartManager.hasSelection(),callback:async i=>{const e=i.chartManager.copy();e&&await navigator.clipboard.writeText(e)}},cut:{label:"Cut",combos:[],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()!=Z.Edit||!i.chartManager.hasSelection(),callback:async i=>{const e=i.chartManager.copy();e&&await navigator.clipboard.writeText(e),i.chartManager.deleteSelection()}},adjustOffset:{label:"Adjust offset",combos:[],disabled:!1,callback:i=>i.windowManager.openWindow(new tT(i))},setSongPreview:{label:"Set as song preview",combos:[],disabled:i=>!i.chartManager.chartView||i.chartManager.getMode()!=Z.Edit||!i.chartManager.hasRange(),callback:i=>{const e=i.chartManager.loadedChart,t=i.chartManager.loadedSM.properties.SAMPLESTART??"0",r=i.chartManager.loadedSM.properties.SAMPLELENGTH??"10";if(i.chartManager.startRegion!==void 0&&i.chartManager.endRegion!==void 0){const u=e.getSecondsFromBeat(i.chartManager.startRegion),h=e.getSecondsFromBeat(i.chartManager.endRegion),d=de(u,3).toString(),f=de(h-u,3).toString();pt.instance.run({action:p=>{p.chartManager.loadedSM.properties.SAMPLESTART=d,p.chartManager.loadedSM.properties.SAMPLELENGTH=f},undo:()=>{i.chartManager.loadedSM.properties.SAMPLESTART=t,i.chartManager.loadedSM.properties.SAMPLELENGTH=r}});return}const n=(i.chartManager.selection.notes.length>0?i.chartManager.selection.notes:i.chartManager.eventSelection.timingEvents).map(u=>u.beat),a=e.getSecondsFromBeat(Math.min(...n)),o=e.getSecondsFromBeat(Math.max(...n)),l=de(a,3).toString(),c=de(o-a,3).toString();pt.instance.run({action:u=>{u.chartManager.loadedSM.properties.SAMPLESTART=l,u.chartManager.loadedSM.properties.SAMPLELENGTH=c},undo:()=>{i.chartManager.loadedSM.properties.SAMPLESTART=t,i.chartManager.loadedSM.properties.SAMPLELENGTH=r}})}},showDebugTimers:{label:"Toggle Debug Timers",combos:[{key:"F3",mods:["Shift"]}],disabled:!1,callback:()=>{A.debug.showTimers=!A.debug.showTimers}},showFPSCounter:{label:"Toggle FPS Counter",combos:[{key:"F3",mods:[]}],disabled:!1,callback:()=>{A.debug.showFPS=!A.debug.showFPS}},noteTypeTap:{label:"Switch to Taps",combos:[],disabled:i=>!i.chartManager.chartView,callback:i=>{i.chartManager.setEditingNoteType("Tap")}},noteTypeLift:{label:"Switch to Lifts",combos:[],disabled:i=>!i.chartManager.chartView,callback:i=>{i.chartManager.setEditingNoteType("Lift")}},noteTypeMine:{label:"Switch to Mines",combos:[],disabled:i=>!i.chartManager.chartView,callback:i=>{i.chartManager.setEditingNoteType("Mine")}},noteTypeFake:{label:"Switch to Fakes",combos:[],disabled:i=>!i.chartManager.chartView,callback:i=>{i.chartManager.setEditingNoteType("Fake")}},quant4:{label:"Switch to 4ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1}},quant8:{label:"Switch to 8ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/2}},quant12:{label:"Switch to 12ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/3}},quant16:{label:"Switch to 16ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/4}},quant24:{label:"Switch to 24ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/6}},quant32:{label:"Switch to 32ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/8}},quant48:{label:"Switch to 48ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/12}},quant96:{label:"Switch to 96ths",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/24}},quant192:{label:"Switch to 192nds",combos:[],disabled:i=>!i.chartManager.chartView,callback:()=>{A.chart.snap=1/48}}};class Nt extends Qw{static graphics=new ps;static textures={default:yt.create({width:50,height:50}),noBorder:yt.create({width:50,height:50}),onlyBorder:yt.create({width:50,height:50})};static init(e){this.textures.default=yt.create({width:50,height:50,resolution:e.resolution}),this.textures.noBorder=yt.create({width:50,height:50,resolution:e.resolution}),this.textures.onlyBorder=yt.create({width:50,height:50,resolution:e.resolution}),this.graphics.beginFill(16777215,1),this.graphics.lineStyle(1,0),this.graphics.drawRoundedRect(0,0,50,50,5),this.graphics.endFill(),e.render(this.graphics,{renderTexture:this.textures.default}),this.graphics.clear(),this.graphics.beginFill(16777215,1),this.graphics.lineStyle(1,16777215),this.graphics.drawRoundedRect(0,0,50,50,5),this.graphics.endFill(),e.render(this.graphics,{renderTexture:this.textures.noBorder}),this.graphics.clear(),this.graphics.beginFill(16777215,0),this.graphics.lineStyle(2,16777215),this.graphics.drawRoundedRect(0,0,50,50,5),this.graphics.endFill(),e.render(this.graphics,{renderTexture:this.textures.onlyBorder})}constructor(e){super(Nt.textures[e??"default"],5,5,5,5)}}class Xo extends xe{manager;constructor(e){super(),this.manager=e}startPlay(){}endPlay(){}}const kn=[];function Zu(){return kn.length}function aT(){for(kn.push(Date.now());kn.length>0&&kn[0]0&&In[0]Zu()+" FPS"});drawUpdateTimeGraph=new _n({width:300,height:fi,color:6034982,min:0,unit:"ms",label:"DrawUpdate",precision:1});updateTimeGraph=new _n({width:300,height:fi,color:1516101,min:0,unit:"ms",label:"Update",precision:1,sublabel:()=>Ju()+" TPS"});memoryTimeGraph=new _n({width:300,height:fi,color:6626406,min:0,formatter:e=>Math.round(e/1048576)+" MB",label:"Memory"});cpuGraph=new _n({width:300,height:fi,color:5190685,min:0,label:"CPU"});graphs=new xe;fpsCounter=new xe;fpsBg=new Nt;fpsText=new Fe("",{fontName:"Main",fontSize:12});lastFrameTime=0;constructor(e){super(e),this.drawUpdateTimeGraph.y+=fi+5,this.updateTimeGraph.y+=(fi+5)*2,this.memoryTimeGraph.y+=(fi+5)*3,this.cpuGraph.y+=(fi+5)*4,cs.instance=this,this.fpsBg.tint=0,this.fpsBg.alpha=.5,this.fpsText.x=5,this.fpsBg.y=-5,this.graphs.addChild(this.frameTimeGraph,this.drawUpdateTimeGraph,this.updateTimeGraph),performance.memory&&this.graphs.addChild(this.memoryTimeGraph),this.fpsCounter.addChild(this.fpsBg,this.fpsText),this.addChild(this.graphs,this.fpsCounter)}update(){this.x=-this.manager.app.renderer.screen.width/2+20,this.y=-this.manager.app.renderer.screen.height/2+20,this.graphs.children.forEach(e=>e.update()),this.graphs.visible=A.debug.showTimers,this.fpsCounter.visible=A.debug.showFPS,this.fpsText.text=`${Zu()} FPS +${Ju()} TPS ${this.lastFrameTime.toFixed(2)} ms -`,this.fpsBg.width=this.fpsText.width+10,this.fpsBg.height=this.fpsText.height+10,A.debug.showTimers?(this.fpsBg.y=(fi+5)*(this.children.length+2)-5,this.fpsText.y=(fi+5)*(this.children.length+2)):(this.fpsBg.y=-5,this.fpsText.y=0)}addMemoryTimeValue(e){this.memoryTimeGraph.addValue(e)}addFrameTimeValue(e){this.lastFrameTime=e,this.frameTimeGraph.addValue(e)}addUpdateTimeValue(e){this.updateTimeGraph.addValue(e)}addDrawUpdateTimeValue(e){this.drawUpdateTimeGraph.addValue(e)}}class wn extends xe{graphWidth;graphHeight;color;unit;precision;formatter;sublabel;maxEase=1;targetMax=1;minEase=1;targetMin=1;constrainedMin=null;constrainedMax=null;dataPoints=[];linePool=[];lineContainer;labelText;sublabelText;topText;bottomText;constructor(e){super();const{width:t,height:r,color:s=16777215,unit:n="",label:a="",min:o=null,max:l=null,precision:c=0,formatter:u=null,sublabel:h=()=>""}=e;this.graphWidth=t,this.graphHeight=r,this.color=s,this.unit=n,this.constrainedMax=l,this.constrainedMin=o,this.precision=c,this.formatter=u,this.sublabel=h,this.lineContainer=new lc(t,{position:!0},16384,!0);const d=new Nt;d.tint=0,d.alpha=.3,d.width=this.graphWidth,d.height=this.graphHeight,this.labelText=new Fe(a,{fontName:"Main",fontSize:Math.min(r/5,16)}),this.labelText.alpha=.8,this.sublabelText=new Fe("",{fontName:"Main",fontSize:Math.min(r/5,16)}),this.topText=new Fe("",{fontName:"Main",fontSize:Math.min(r/7,12)}),this.topText.anchor.x=1,this.topText.alpha=.5,this.topText.x=this.graphWidth,this.bottomText=new Fe("",{fontName:"Main",fontSize:Math.min(r/7,12)}),this.bottomText.anchor.x=1,this.bottomText.anchor.y=1,this.bottomText.alpha=.5,this.bottomText.x=this.graphWidth,this.bottomText.y=this.graphHeight,this.sublabelText.y=this.graphHeight,this.sublabelText.anchor.y=1,this.sublabelText.alpha=.5,this.addChild(d,this.lineContainer,this.labelText,this.sublabelText,this.topText,this.bottomText)}addValue(e){if(this.lineContainer.children[0]?.x+this.lineContainer.x<0){const r=this.lineContainer.children[0];this.dataPoints.shift(),this.removeChild(r),this.linePool.push(r)}this.lineContainer.x-=1,this.lineContainer.x<-1e7&&(this.lineContainer.children.forEach(r=>{r.x-=1e7}),this.lineContainer.x+=1e7);const t=this.linePool.shift()??new Pe(ie.WHITE);t.width=1,t.anchor.x=.5,t.anchor.y=1,t.tint=this.color,t.alpha=.6,t.x=this.graphWidth-this.lineContainer.x,t.y=this.graphHeight,t.value=e,this.dataPoints.push(e),this.targetMax=this.constrainedMax!==null?this.constrainedMax:Math.max(...this.dataPoints),this.targetMin=this.constrainedMin!==null?this.constrainedMin:Math.min(...this.dataPoints),this.lineContainer.addChild(t)}update(){this.dataPoints.length!=0&&(this.maxEase=(this.maxEase-this.targetMax)*.1+this.targetMax,this.minEase=(this.minEase-this.targetMin)*.1+this.targetMin,this.lineContainer.children.forEach(e=>{e.height=at((e.value-this.minEase)/this.maxEase,0,1)*this.graphHeight}),this.topText.text=this.formatter?.(this.maxEase)??`${de(this.maxEase,this.precision)} ${this.unit}`,this.bottomText.text=this.formatter?.(this.minEase)??`${de(this.minEase,this.precision)} ${this.unit}`,this.sublabelText.text=this.sublabel())}}class Gl{static active=!1;static persistent=!1;static popup;static clickOutside;static onSnapChange=this.updateValues.bind(this);static moveInterval;static updateInterval;static exitTimeout;static editText;static zoomer;static divInput;static divLabel;static beatInput;static open(e){this.active||(this.popup=this.build(),document.getElementById("popups")?.appendChild(this.popup),this.clickOutside=t=>{this.popup?.contains(t.target)||(this.persistent=!1,this.close())},re.on("snapChanged",this.onSnapChange),this.popup.style.display="none",setTimeout(()=>this.movePosition(e)),clearTimeout(this.exitTimeout),this.moveInterval=setInterval(()=>this.movePosition(e),150),this.active=!0)}static movePosition(e){this.popup.style.display="";const t=e.getBounds(),r=t.left+t.width/2,s=200,n=s/2+15,a=window.innerWidth-s/2-15;this.popup.style.left=`${at(r,n,a)}px`;const o=t.top+t.height/2;this.popup.style.top=`${t.top+t.height}px`,o+this.popup.clientHeight>window.innerHeight-15&&(this.popup.style.transform="translate(-50%, -100%)",this.popup.style.top=`${t.top-t.height/2}px`)}static build(){const e=document.createElement("div");e.classList.add("popup");const t=document.createElement("div");t.classList.add("popup-zoomer"),t.style.width="200px",t.style.backgroundColor="#333333",e.appendChild(t),this.zoomer=t;const r=document.createElement("div");r.innerText="Snap Options",r.classList.add("popup-title"),t.appendChild(r);const s=document.createElement("div");s.classList.add("popup-flex"),t.appendChild(s);const n=document.createElement("div");n.classList.add("popup-row");const a=document.createElement("div");a.innerText="Snap to nearest ";const o=ot.create(A.chart.snap==0?0:Math.round(4/A.chart.snap),1,0,0,1e3);o.onChange=p=>{if(p===void 0){this.updateValues();return}p==0?A.chart.snap=0:A.chart.snap=4/p,this.updateValues()};const l=document.createElement("div");l.innerText=this.suffixSnap()+" note",n.replaceChildren(a,o.view,l);const c=document.createElement("div");c.classList.add("popup-row");const u=document.createElement("div");u.innerText="Snap every";const h=ot.create(A.chart.snap,.001,3,0);h.onChange=p=>{if(p===void 0){this.updateValues();return}p==0?A.chart.snap=0:A.chart.snap=p,this.updateValues()};const d=document.createElement("div");d.innerText=" beats",c.replaceChildren(u,h.view,d),s.replaceChildren(n,c),this.beatInput=h,this.divInput=o,this.divLabel=l;const f=document.createElement("div");return f.innerText="click to edit",f.style.marginTop="4px",f.style.height="10px",t.appendChild(f),f.classList.add("popup-desc"),this.editText=f,e}static updateValues(){document.activeElement==this.divInput.input||document.activeElement==this.beatInput.input||(this.divInput.setValue(A.chart.snap==0?0:Math.round(4/A.chart.snap)),this.divLabel.innerText=this.suffixSnap()+" note",this.beatInput.setValue(A.chart.snap))}static suffixSnap(){const e=A.chart.snap==0?0:Math.round(4/A.chart.snap);return e%10==1&&e!=11?"st":e%10==2&&e!=12?"nd":e%10==3&&e!=13?"rd":"th"}static close(){!this.popup||!this.active||this.persistent||(window.removeEventListener("click",this.clickOutside,!0),this.popup.classList.add("exiting"),this.exitTimeout=setTimeout(()=>this.popup.remove(),200),this.active=!1,this.persistent=!1,clearInterval(this.moveInterval),clearInterval(this.updateInterval),re.off("timingModified",this.onSnapChange))}static select(){this.persistent=!0,this.zoomer.classList.add("selected"),this.editText.style.transform="scale(0)",this.editText.style.height="0px",setTimeout(()=>window.addEventListener("click",this.clickOutside,!0),200)}}const h1={fontName:"Main",fontSize:10,fill:["#ffffff"]},Im={4:15157287,8:4033015,12:11152884,16:8577607,24:14167723,32:15376696,48:15699179,64:7071886,96:8553090,192:8553090};class c1 extends xe{renderer;children=[];constructor(e){super(),this.renderer=e;for(let t=0;t<2;t++){const r=new xe,s=new us,n=new Fe("4",h1);r.x=(t-.5)*(this.renderer.chart.gameType.notefieldWidth+48),s.rotation=Math.PI/4,s.lineStyle(1,0,1),s.beginFill(16777215),s.drawRect(-12,-12,24,24),s.endFill(),n.anchor.set(.5),r.addChild(s,n),this.addChild(r),r.eventMode="static",r.on("mouseenter",()=>Gl.open(s)),r.on("mousedown",()=>Gl.select()),r.on("mouseleave",()=>Gl.close())}}update(){this.y=A.chart.receptorYPos/A.chart.zoom,this.visible=this.renderer.chartManager.getMode()==Z.Edit||this.renderer.chartManager.getMode()==Z.Record;for(let e=0;e<2;e++){const t=this.children[e],r=t.children[0];r.tint=Im[4/A.chart.snap]??7368816;const s=t.children[1];s.text=""+(A.chart.snap==0||4/A.chart.snap%1!=0?"":4/A.chart.snap),s.scale.y=A.chart.reverse?-1:1}}}class d1 extends Vo{barContainer=new lc(1500,{position:!0,scale:!0,tint:!0},16384,!0);backing=new Nt;bars;barTexture;overlay=new Pe(ie.WHITE);lastHeight=0;lastCMod;mouseDown=!1;queued=!1;constructor(e){super(e),this.addChild(this.backing),this.visible=!1,this.backing.tint=0,this.backing.alpha=.3,this.barTexture=pt.create({resolution:this.manager.app.renderer.resolution}),this.bars=new Pe(this.barTexture),this.bars.anchor.set(.5),this.addChild(this.bars),this.overlay.anchor.x=.5,this.overlay.anchor.y=0,this.overlay.alpha=.3,this.lastCMod=A.chart.CMod,this.addChild(this.overlay),this.x=this.manager.app.renderer.screen.width/2-20,re.on("chartLoaded",()=>{this.queued=!1,this.populate()}),re.on("chartModifiedAfter",()=>{this.queued||this.populate(),this.queued=!0});const t=setInterval(()=>{this.queued&&(this.queued=!1,this.populate())},3e3);this.on("destroyed",()=>clearInterval(t)),this.populate(),this.eventMode="static",this.on("mousedown",r=>{this.mouseDown=!0,this.handleMouse(r)}),this.on("mousemove",r=>{this.mouseDown&&this.handleMouse(r)}),window.onmouseup=()=>{this.mouseDown=!1}}handleMouse(e){if(this.manager.chartManager.getMode()==Z.Play||!this.getChart())return;let t=(this.bars.toLocal(e.global).y+this.bars.height/2)/this.bars.height;t=at(t,0,1);const r=this.getChart().getNotedata().at(-1);if(!r)return;const s=r.beat+(De(r)?r.hold:0),n=this.getChart().getSecondsFromBeat(s);A.chart.CMod?this.manager.chartManager.setTime(Ds(-this.getChart().timingData.getTimingData("OFFSET"),n,t)):this.manager.chartManager.setBeat(s*t)}update(){const e=this.manager.app.renderer.screen.height-40;this.backing.height=e+10,this.backing.position.y=-this.backing.height/2,this.backing.position.x=-this.backing.width/2,this.bars.height=e,this.x=this.manager.app.renderer.screen.width/2-20;const t=this.getChart(),r=this.manager.chartManager.chartView;if(!t||!r){this.visible=!1;return}this.visible=!0;const s=t.getNotedata().at(-1);if(!s){this.overlay.height=0;return}const n=s.beat+(De(s)?s.hold:0),a=t.getSecondsFromBeat(n),o=A.chart.CMod?r.getSecondFromYPos(-this.manager.app.renderer.screen.height/2):r.getBeatFromYPos(-this.manager.app.renderer.screen.height/2,!0),l=A.chart.CMod?r.getSecondFromYPos(this.manager.app.renderer.screen.height/2):r.getBeatFromYPos(this.manager.app.renderer.screen.height/2,!0);let c=ys(0,n,o),u=ys(0,n,l);A.chart.CMod&&(c=ys(-t.timingData.getTimingData("OFFSET"),a,o),u=ys(-t.timingData.getTimingData("OFFSET"),a,l)),c=at(c,0,1),u=at(u,0,1);const h=(c-.5)*(this.backing.height-10),d=(u-.5)*(this.backing.height-10);this.overlay.y=h,this.overlay.height=d-h,this.overlay.height=Math.max(2,this.overlay.height),(this.manager.app.renderer.screen.height!=this.lastHeight||this.lastCMod!=A.chart.CMod)&&(this.lastCMod=A.chart.CMod,this.lastHeight=this.manager.app.renderer.screen.height,this.populate()),this.scale.y=A.chart.reverse?-1:1}populate(){const e=this.getChart();if(!e){Ht(this.barContainer.children,()=>!0),this.manager.app.renderer.render(this.barContainer,{renderTexture:this.barTexture});return}this.visible=!0;let t=0;const r=e.gameType.numCols,s=e.getNotedata().at(-1),n=this.manager.app.renderer.screen.height-40;if(this.backing.height=n,this.backing.width=r*6+8,this.overlay.width=r*6+8,this.pivot.x=this.backing.width/2,this.barTexture.resize(r*6,n),!s){Ht(this.barContainer.children,()=>!0),this.manager.app.renderer.render(this.barContainer,{renderTexture:this.barTexture});return}const a=s.beat+(De(s)?s.hold:0),o=e.getSecondsFromBeat(a),l=e.timingData.getTimingData("OFFSET");e.getNotedata().forEach(c=>{let u=this.barContainer.children[t];u||(u=new Pe(ie.WHITE),u.width=4,this.barContainer.addChild(u)),u.anchor.set(.5),u.height=1,u.x=(c.col+.5)*6;let h=ys(0,a,c.beat);if(A.chart.CMod&&(h=ys(l,o,c.second)),u.y=h*n,u.tint=Im[Dh(c.beat)],c.type=="Mine"&&(u.tint=8421504),t++,De(c)){let d=this.barContainer.children[t];d||(d=new Pe(ie.WHITE),d.width=4,d.height=2,this.barContainer.addChild(d)),d.anchor.x=.5,d.anchor.y=0,d.x=(c.col+.5)*6;const f=(A.chart.CMod?e.getSecondsFromBeat(c.beat+c.hold)/o:(c.beat+c.hold)/a)*n+1;d.y=u.y,d.height=f-u.y,c.type=="Hold"&&(d.tint=10526880),c.type=="Roll"&&(d.tint=11379586),t++}}),Ht(this.barContainer.children,(c,u)=>u>=t),this.manager.app.renderer.render(this.barContainer,{renderTexture:this.barTexture})}getChart(){return this.manager.chartManager.loadedChart}}const Ke=300,rt=150,tf=[.045,.09,.18,.37,.18,.09,.045];class u1 extends Vo{max=0;barlines=new xe;backgroundRect=new Nt;background=new xe;backgroundLines=new xe;statText=new xe;meanText;medianText;modeText;stddevText;errorMS=[];texts=new xe;showEase=0;toggled=!1;drag=!1;dragStart=0;lastMode=this.manager.chartManager.getMode();constructor(e){super(e),this.visible=!1,this.backgroundRect.tint=0,this.backgroundRect.alpha=.3,this.background.addChild(this.backgroundRect),this.addChild(this.background),this.addChild(this.backgroundLines),this.eventMode="static",this.on("mousedown",()=>{this.manager.chartManager.getMode()!=Z.Play&&(this.drag=!0,this.dragStart=Date.now(),Ft.stop("play-widget"))}),window.addEventListener("mousemove",p=>{this.drag&&(this.showEase+=p.movementY/-400)}),window.addEventListener("mouseup",()=>{this.drag&&(Date.now()-this.dragStart>400?this.toggled=this.showEase>.5:this.toggled=!this.toggled,Ft.animate(this,{0:{showEase:"inherit"},1:{showEase:this.toggled?1:0}},.6,Yt(.11,.71,.33,1.39),()=>{},"play-widget")),this.drag=!1}),this.on("mouseenter",()=>{!this.toggled&&this.manager.chartManager.getMode()!=Z.Play&&Ft.animate(this,{0:{showEase:"inherit"},1:{showEase:.05}},.6,Yt(.11,.71,.33,1.39),()=>{},"play-widget")}),this.on("mouseleave",()=>{!this.toggled&&this.manager.chartManager.getMode()!=Z.Play&&Ft.animate(this,{0:{showEase:"inherit"},1:{showEase:0}},.6,Yt(.11,.71,.33,1.39),()=>{},"play-widget")});const t=new Fe("Early",{fontName:"Main",fontSize:15});t.x=-Ke/2+5,t.y=-rt-40,t.alpha=.3,this.background.addChild(t);const r=new Fe("Late",{fontName:"Main",fontSize:15});r.anchor.x=1,r.x=Ke/2-5,r.y=-rt-40,r.alpha=.3,this.background.addChild(r),this.meanText=new Fe("-",{fontName:"Main",fontSize:15}),this.meanText.anchor.x=.5,this.meanText.x=Ke/4*-1.5,this.meanText.y=-rt-70,this.statText.addChild(this.meanText),this.medianText=new Fe("-",{fontName:"Main",fontSize:15}),this.medianText.anchor.x=.5,this.medianText.x=Ke/4*-.5,this.medianText.y=-rt-70,this.statText.addChild(this.medianText),this.modeText=new Fe("-",{fontName:"Main",fontSize:15}),this.modeText.anchor.x=.5,this.modeText.x=Ke/4*.5,this.modeText.y=-rt-70,this.statText.addChild(this.modeText),this.stddevText=new Fe("-",{fontName:"Main",fontSize:15}),this.stddevText.anchor.x=.5,this.stddevText.x=Ke/4*1.5,this.stddevText.y=-rt-70,this.statText.addChild(this.stddevText);const s=new Fe("Mean",{fontName:"Main",fontSize:10});s.anchor.x=.5,s.x=Ke/4*-1.5,s.y=-rt-80,this.statText.addChild(s);const n=new Fe("Median",{fontName:"Main",fontSize:10});n.anchor.x=.5,n.x=Ke/4*-.5,n.y=-rt-80,this.statText.addChild(n);const a=new Fe("Mode",{fontName:"Main",fontSize:10});a.anchor.x=.5,a.x=Ke/4*.5,a.y=-rt-80,this.statText.addChild(a);const o=new Fe("Std Dev.",{fontName:"Main",fontSize:10});o.anchor.x=.5,o.x=Ke/4*1.5,o.y=-rt-80,this.statText.addChild(o);const l=new xe,c=new Nt;c.tint=3355443,c.alpha=.3,c.width=Ke/2-10,c.height=30,c.y=-25,c.x=-Ke/4,c.pivot.x=(Ke/2-10)/2,c.pivot.y=15;const u=new Fe("Adjust song offset",{fontName:"Main",fontSize:12});u.anchor.set(.5),u.x=-Ke/4,u.y=-25,l.addChild(c,u),l.eventMode="static",l.addEventListener("mouseenter",()=>{c.alpha=.6}),l.addEventListener("mousedown",p=>{p.stopImmediatePropagation(),this.adjustOffset("song")}),l.addEventListener("mouseleave",()=>{c.alpha=.3}),this.statText.addChild(l);const h=new xe,d=new Nt;d.tint=3355443,d.alpha=.3,d.width=Ke/2-10,d.height=30,d.y=-25,d.x=Ke/4,d.pivot.x=(Ke/2-10)/2,d.pivot.y=15,d.eventMode="static",h.addEventListener("mouseenter",()=>{d.alpha=.6}),h.addEventListener("mouseleave",()=>{d.alpha=.3});const f=new Fe("Adjust global offset",{fontName:"Main",fontSize:12});f.anchor.set(.5),f.x=Ke/4,f.y=-25,h.addChild(d,f),h.eventMode="static",h.addEventListener("mouseenter",()=>{d.alpha=.6}),h.addEventListener("mousedown",p=>{p.stopImmediatePropagation(),this.adjustOffset("global")}),h.addEventListener("mouseleave",()=>{d.alpha=.3}),this.statText.addChild(h),this.addChild(this.background),this.addChild(this.backgroundLines),this.eventMode="static",this.addChild(this.statText),this.addChild(this.barlines),this.addChild(this.texts)}update(){this.visible=!!this.manager.chartManager.gameStats,this.x=-this.manager.chartManager.app.renderer.screen.width/2+20+Ke/2,this.y=this.manager.chartManager.app.renderer.screen.height/2-20,this.backgroundRect.width=Ke+10,this.backgroundRect.height=rt+260,this.backgroundRect.x=-Ke/2-5,this.backgroundRect.y=-rt-260,this.visible=!!this.manager.chartManager.gameStats;for(const e of this.barlines.children)A.general.smoothAnimations?e.height=(e.targetHeight-e.height)*.2+e.height:e.height=e.targetHeight;this.lastMode!=this.manager.chartManager.getMode()&&(this.lastMode=this.manager.chartManager.getMode(),Ft.animate(this,{0:{showEase:"inherit"},1:{showEase:this.manager.chartManager.getMode()==Z.Play?1:0}},.6,Yt(.11,.71,.33,1.39),()=>{},"play-widget")),A.general.smoothAnimations?this.y+=(1-Math.abs(this.showEase))*400:this.manager.chartManager.getMode()!=Z.Play&&(this.y+=400)}newLine(){const e=new Pe(ie.WHITE);return e.smoothCount=0,e.targetHeight=0,e.anchor.y=1,e.anchor.x=.5,e.height=0,e.visible=!1,e}startPlay(){const e=this.manager.chartManager.gameStats;this.max=0,this.errorMS=[],this.meanText.text="-",this.medianText.text="-",this.modeText.text="-",this.stddevText.text="-",Ht(this.barlines.children,()=>!0),Ht(this.backgroundLines.children,()=>!0),Ht(this.texts.children,()=>!0);const t=Je.getCollection(A.play.timingCollection),r=t.getStandardWindows().length+1,s=Math.round(t.maxWindowMS());for(let f=0;fy.type==p&&!y.fake).length),m.tint=14540253,g.tint=14540253,g.name=p,this.texts.addChild(m),this.texts.addChild(g),m.x=-Ke/2+160,g.x=-Ke/2+290,m.y=80/o*n-rt-220,g.y=80/o*n++-rt-220,m.anchor.y=.5,g.anchor.y=.5,g.anchor.x=1}const l=new Fe("Max Combo",{fontName:"Main",fontSize:15}),c=new Fe("0",{fontName:"Main",fontSize:15});l.tint=14540253,c.tint=14540253,c.name="Combo",this.texts.addChild(l),this.texts.addChild(c),l.x=-Ke/2+160,c.x=-Ke/2+290,l.y=80/o*n-rt-220,c.y=80/o*n++-rt-220,l.anchor.y=.5,c.anchor.y=.5,c.anchor.x=1;const u=new Fe("0.00 / 0.00",{fontName:"Main",fontSize:20});u.tint=14540253,u.x=-Ke/2+225,u.y=-rt-112,u.name="Score",this.texts.addChild(u),u.anchor.set(.5);const h=new Fe("Score / Current Score",{fontName:"Main",fontSize:13});h.tint=8947848,h.x=-Ke/2+225,h.y=-rt-135,this.texts.addChild(h),h.anchor.set(.5);const d=new Fe("Play Statistics",{fontName:"Main",fontSize:13});d.y=-rt-245,d.anchor.set(.5),this.texts.addChild(d),e.onJudge((f,p)=>{let m="";(ri(p)||Gi(p))&&(m=p.id),Er(p)&&(m=p.noteType),Zr(p)&&(m="Mine");const g=this.texts.getChildByName(m);if(Er(p)){const b=g.text.split(" / ")[1];g.text=e.getCount(p)+" / "+b}else tn(p)||(g.text=e.getCount(p)+"");if(this.texts.getChildByName("Combo").text=e.getMaxCombo()+"",this.texts.getChildByName("Score").text=de(e.getScore()*100,2).toFixed(2)+" / "+de(e.getCumulativeScore()*100,2).toFixed(2),ri(p)||!Gi(p))return;const y=Math.round(f*1e3);for(let b=-3;b<=3;b++)this.barlines.children[y+s+b]&&(this.barlines.children[y+s+b].smoothCount+=tf[b+3],this.barlines.children[y+s+b].visible=!0,this.barlines.children[y+s+b].smoothCount>this.max&&(this.modeText.text=y+"ms",this.max=this.barlines.children[y+s+b].smoothCount));this.errorMS.push(f*1e3),this.meanText.text=iE(this.errorMS).toFixed(2)+"ms",this.medianText.text=zo(this.errorMS).toFixed(2)+"ms",this.stddevText.text=um(this.errorMS).toFixed(2)+"ms",this.redraw()})}redraw(){for(const e of this.barlines.children)e.targetHeight=e.smoothCount*(rt-20)/this.max}adjustOffset(e){const t=this.manager.chartManager.gameStats;if(!t)return;const r=Math.round(t.getMedian()*1e3)/1e3;if(r==0)return;t.applyOffset(-r),this.barlines.children.forEach(o=>{o.smoothCount=0});const s=Je.getCollection(A.play.timingCollection),n=Math.round(s.maxWindowMS());t.getDataPoints().forEach(o=>{if(ri(o.judgment)||!Gi(o.judgment))return;const l=Math.round(o.error*1e3);for(let c=-3;c<=3;c++)this.barlines.children[l+n+c]&&(this.barlines.children[l+n+c].smoothCount+=tf[c+3],this.barlines.children[l+n+c].visible=!0,this.barlines.children[l+n+c].smoothCount>this.max&&(this.modeText.text=l+"ms",this.max=this.barlines.children[l+n+c].smoothCount))}),this.redraw();const a=e=="global"?A.play.offset:this.manager.app.chartManager.loadedChart.timingData.getTimingData("OFFSET");e=="global"?A.play.offset=de(A.play.offset-r,3):e=="song"&&this.manager.app.chartManager.loadedChart?.timingData.insert(this.manager.app.chartManager.loadedChart?.timingData.offset!==void 0,"OFFSET",de(this.manager.app.chartManager.loadedChart.timingData.getTimingData("OFFSET")-r,3)),Oe.create(`Adjusted ${e} offset from ${de(a,3).toFixed(3)} to ${de(a-r,3).toFixed(3)}`),this.manager.app.chartManager.setBeat(this.manager.app.chartManager.getBeat())}}const Tr={BPMS:9182254,STOPS:4934913,DELAYS:217453,WARPS:9243998,FAKES:4868682,COMBOS:939078,SPEEDS:2968693,LABELS:7747359,SCROLLS:3557006,TIMESIGNATURES:5392684,TICKCOUNTS:1594906,BGCHANGES:8460415,FGCHANGES:8857115,ATTACKS:1856083};class f1 extends xe{renderer;areaPool=new as({create:()=>{const e=new Pe(ie.WHITE);return Object.assign(e,{alpha:.2,width:this.renderer.chart.gameType.notefieldWidth+128}),e.anchor.set(.5,0),e}});timingAreaMap=new Map;timingDirty=!1;constructor(e){super(),this.renderer=e,this.addChild(this.areaPool);const t=()=>this.timingDirty=!0;re.on("timingModified",t),this.on("destroyed",()=>re.off("timingModified",t))}update(e,t){this.timingDirty&&(this.timingAreaMap.clear(),this.areaPool.destroyAll(),this.timingDirty=!1),this.visible=this.renderer.chartManager.getMode()!=Z.Play||!A.play.hideBarlines;for(const r of this.renderer.chart.timingData.getTimingData("STOPS","WARPS","DELAYS","FAKES")){if(r.beat>t)break;if(this.shouldDrawEvent(r,e,t)&&!this.timingAreaMap.has(r)){const s=this.areaPool.createChild();if(!s)break;s.tint=Tr[r.type],this.timingAreaMap.set(r,s)}}for(const[r,s]of this.timingAreaMap.entries()){if(!this.shouldDrawEvent(r,e,t)){this.timingAreaMap.delete(r),this.areaPool.destroyChild(s);continue}let n=A.chart.CMod?this.renderer.getYPosFromSecond(r.second):this.renderer.getYPosFromBeat(r.beat),a=n;switch(r.type){case"STOPS":case"DELAYS":{A.chart.CMod&&r.value>0?a=this.renderer.getYPosFromSecond(r.second+r.value):r.value<0&&(a=this.renderer.getYPosFromBeat(this.renderer.chart.getBeatFromSeconds(r.second+1e-4)));break}case"FAKES":{a=this.renderer.getYPosFromBeat(r.beat+r.value);break}case"WARPS":{A.chart.CMod||(a=this.renderer.getYPosFromBeat(r.beat+r.value));break}}a0)||e.type=="WARPS"&&A.chart.CMod||e.beat>r)}}class Wl{static active=!1;static popup;static clickOutside;static moveInterval;static exitTimeout;static draggedElement;static dragOffsetX=0;static dragOffsetY=0;static grid;static leftovers;static boundaryCache=[];static open(){this.active||(this.popup=this.build(),document.getElementById("popups")?.appendChild(this.popup),this.clickOutside=e=>{!this.popup?.contains(e.target)&&!this.draggedElement?.contains(e.target)&&!document.getElementById("arrange-tracks")?.contains(e.target)&&this.close()},setTimeout(()=>window.addEventListener("click",this.clickOutside,!0)),this.popup.style.display="none",setTimeout(()=>this.movePosition()),clearTimeout(this.exitTimeout),this.moveInterval=setInterval(()=>this.movePosition(),150),this.active=!0)}static build(){const e=document.createElement("div");e.classList.add("popup"),e.id="timing-track-order";const t=document.createElement("div");t.classList.add("popup-zoomer"),e.appendChild(t);const r=document.createElement("div");r.classList.add("container"),t.appendChild(r);const s=document.createElement("div");s.classList.add("title"),s.innerText="Arrange Timing Tracks";const n=document.createElement("div");n.classList.add("track-grid-options");const a=document.createElement("button");a.classList.add("delete"),a.innerText="Reset",a.onclick=()=>{A.chart.timingEventOrder=structuredClone(go.chart.timingEventOrder),this.clearBoundaries(),this.grid?.replaceChildren(),this.leftovers?.replaceChildren();const c=[...Jr];for(const h of A.chart.timingEventOrder.left){const d=this.makeDraggableTrack(h);d.classList.add("left"),this.grid?.appendChild(d),c.splice(c.indexOf(h),1)}const u=document.createElement("div");u.classList.add("draggable-track"),u.innerText="PLAYFIELD",u.style.backgroundColor="#2D2D2D",u.style.padding="20px 10px",u.style.writingMode="horizontal-tb",u.addEventListener("mousedown",h=>this.startDragging(h,u)),u.dataset.type="PLAYFIELD",this.grid?.appendChild(u);for(const h of A.chart.timingEventOrder.right){const d=this.makeDraggableTrack(h);d.classList.add("right"),this.grid?.appendChild(d),c.splice(c.indexOf(h),1)}for(const h of c)this.leftovers?.appendChild(this.makeLeftoverTrack(h))},this.grid=document.createElement("div"),this.grid.classList.add("track-grid"),r.appendChild(s),r.appendChild(this.grid),r.appendChild(n);const o=[...Jr];for(const c of A.chart.timingEventOrder.left){const u=this.makeDraggableTrack(c);u.classList.add("left"),this.grid.appendChild(u),o.splice(o.indexOf(c),1)}const l=document.createElement("div");l.classList.add("draggable-track"),l.innerText="PLAYFIELD",l.style.backgroundColor="#2D2D2D",l.style.padding="20px 10px",l.style.writingMode="horizontal-tb",l.addEventListener("mousedown",c=>this.startDragging(c,l)),l.dataset.type="PLAYFIELD",this.grid.appendChild(l);for(const c of A.chart.timingEventOrder.right){const u=this.makeDraggableTrack(c);u.classList.add("right"),this.grid.appendChild(u),o.splice(o.indexOf(c),1)}this.leftovers=document.createElement("div"),this.leftovers.classList.add("track-selector"),n.appendChild(this.leftovers),n.appendChild(a);for(const c of o)this.leftovers.appendChild(this.makeLeftoverTrack(c));return e}static makeDraggableTrack(e){const t=document.createElement("div");t.classList.add("draggable-track");const r=document.createElement("div");r.classList.add("draggable-track-text"),r.innerText=e,t.style.backgroundColor=Fh(Tr[e].toString(16).padStart(6,"0"),"#333333",.7),t.appendChild(r);let s=!0;const n=document.createElement("img");return n.src=Ge.TRASH,n.style.width="16px",n.addEventListener("click",()=>{if(!s)return;s=!1,this.deleteTrack(e),t.classList.add("exiting"),setTimeout(()=>t.remove(),400);const a=this.makeLeftoverTrack(e);a.classList.add("entering"),setTimeout(()=>a.classList.remove("entering"),400),this.leftovers?.appendChild(a),this.clearBoundaries()}),t.appendChild(n),t.addEventListener("mousedown",a=>{s&&a.target!=n&&this.startDragging(a,t)}),t.dataset.type=e,t}static makeLeftoverTrack(e){const t=document.createElement("div");t.classList.add("leftover-track");const r=document.createElement("img");r.src=Ge.PLUS,t.append(r);const s=document.createElement("div");s.classList.add("leftover-track-text"),s.innerText=e,t.style.backgroundColor=Fh(Tr[e].toString(16).padStart(6,"0"),"#333333",.7),t.appendChild(s);let n=0,a=0,o=!1,l=!1;return t.addEventListener("mousedown",()=>{o=!0}),t.addEventListener("mousemove",c=>{if(!(!o||l)&&(n+=c.movementX,a+=c.movementY,n*n+a*a>15)){l=!0;const u=this.makeDraggableTrack(e);this.grid?.appendChild(u),this.clearBoundaries();const h=t.getBoundingClientRect(),d=this.getClosestSlot(h.left),f=A.chart.timingEventOrder.left.concat(["PLAYFIELD"],A.chart.timingEventOrder.right);f.splice(d,0,e),this.saveOptions(f),f.forEach(p=>{const m=this.grid?.querySelector(`div[data-type=${p}]`);this.grid?.appendChild(m),p!="PLAYFIELD"&&(m?.classList.remove("left","right"),A.chart.timingEventOrder.left.includes(p)&&m?.classList.add("left"),A.chart.timingEventOrder.right.includes(p)&&m?.classList.add("right"))}),this.startDragging(c,u,c.clientX,c.clientY),A.general.smoothAnimations?(t.style.width=t.clientWidth+"px",t.style.transition="0.4s cubic-bezier(0, 0.91, 0.34, 1.05)",setTimeout(()=>{t.style.width="0px",t.style.opacity="0",t.style.padding="0",t.style.fontSize="0"},10),setTimeout(()=>t.remove(),400)):t.remove()}}),t.addEventListener("mouseup",()=>{if(!o||l)return;l=!0,A.chart.timingEventOrder.right.push(e),A.general.smoothAnimations?(t.style.width=t.clientWidth+"px",t.style.transition="0.4s cubic-bezier(0, 0.91, 0.34, 1.05)",setTimeout(()=>{t.style.width="0px",t.style.opacity="0",t.style.padding="0",t.style.fontSize="0"},10),setTimeout(()=>t.remove(),400)):t.remove();const c=this.makeDraggableTrack(e);c.classList.add("entering"),c.classList.add("right"),setTimeout(()=>c.classList.remove("entering"),400),this.grid?.appendChild(c),this.clearBoundaries()}),t}static startDragging(e,t,r,s){if(!this.popup)return;this.draggedElement=t.cloneNode(!0),this.draggedElement.style.position="fixed";const n=t.getBoundingClientRect(),a=this.popup.getBoundingClientRect();!r||!s?(this.dragOffsetX=e.clientX-n.left,this.dragOffsetY=e.clientY-n.top,this.draggedElement.style.left=n.left-a.left+"px",this.draggedElement.style.top=n.top-a.top+"px"):(this.dragOffsetX=n.width/2,this.dragOffsetY=n.height/4*3,this.draggedElement.style.left=r-n.width/2-a.left+"px",this.draggedElement.style.top=s-n.height/4*3-a.top+"px",this.draggedElement.classList.add("entering")),this.draggedElement.style.boxShadow="6px 6px 6px #222",this.draggedElement.style.transition="none",t.style.opacity="0.03",this.popup.appendChild(this.draggedElement);const o=A.chart.timingEventOrder.left.concat(["PLAYFIELD"],A.chart.timingEventOrder.right),l=t.dataset.type;let c=o.indexOf(l);const u=o.indexOf(l),h=f=>{this.draggedElement.style.left=f.clientX-this.dragOffsetX-a.left+"px",this.draggedElement.style.top=f.clientY-this.dragOffsetY-a.top+"px";let p=this.getClosestSlot(f.clientX-this.dragOffsetX);Math.abs(f.clientY-this.dragOffsetY-a.top-(n.top-a.top))>140&&(p=u),c!=p&&(o.splice(c,1),o.splice(p,0,l),this.saveOptions(o),o.forEach(m=>{const g=this.grid?.querySelector(`div[data-type=${m}]`);this.grid?.appendChild(g),m!="PLAYFIELD"&&(g?.classList.remove("left","right"),A.chart.timingEventOrder.left.includes(m)&&g?.classList.add("left"),A.chart.timingEventOrder.right.includes(m)&&g?.classList.add("right"))}),l!="PLAYFIELD"&&(this.draggedElement?.classList.remove("left","right"),A.chart.timingEventOrder.left.includes(l)&&this.draggedElement?.classList.add("left"),A.chart.timingEventOrder.right.includes(l)&&this.draggedElement?.classList.add("right")),c=p)};window.addEventListener("mousemove",h);const d=()=>{this.draggedElement?.remove(),this.draggedElement=void 0,window.removeEventListener("mousemove",h),t.style.opacity="",this.clearBoundaries(),window.removeEventListener("mouseup",d)};window.addEventListener("mouseup",d)}static saveOptions(e){const t=e.indexOf("PLAYFIELD");t!=-1&&(A.chart.timingEventOrder.left=e.slice(0,t),A.chart.timingEventOrder.right=e.slice(t+1))}static deleteTrack(e){const t=A.chart.timingEventOrder.left.indexOf(e);t!=-1&&A.chart.timingEventOrder.left.splice(t,1);const r=A.chart.timingEventOrder.right.indexOf(e);r!=-1&&A.chart.timingEventOrder.right.splice(r,1)}static movePosition(){if(!this.popup)return;const e=document.getElementById("arrange-tracks");if(!e)return;this.popup.style.display="";const t=e.getBoundingClientRect(),r=t.left+t.width/2,s=this.popup.clientWidth,n=s/2+15,a=window.innerWidth-s/2-15;this.popup.style.left=`${at(r,n,a)}px`;const o=t.top+t.height/2;this.popup.style.top=`${t.top+t.height}px`,o+this.popup.clientHeight>window.innerHeight-15&&(this.popup.style.transform="translate(-50%, -100%)",this.popup.style.top=`${t.top-t.height/2}px`)}static getClosestSlot(e){this.boundaryCache.length==0&&this.getBoundaries();let t=-1,r=999999,s=999999;for(let n=0;ns)break;s=a}return t}static getBoundaries(){if(this.grid){for(const e of this.grid.children)this.boundaryCache.push([e,e.getBoundingClientRect()]);this.boundaryCache.sort((e,t)=>e[1].left-t[1].left)}}static clearBoundaries(){this.boundaryCache=[]}static close(){!this.popup||!this.active||(window.removeEventListener("click",this.clickOutside,!0),this.popup.classList.add("exiting"),this.exitTimeout=setTimeout(()=>this.popup.remove(),200),this.active=!1,clearInterval(this.moveInterval),this.clearBoundaries())}}class p1 extends Vo{view;playbackBar;skipStart;skipEnd;play;playIcon;record;playtest;timeCounter;beatCounter;min;sec;millis;beat;beatDropdown;editBar;editSteps;editTiming;stepsContainer;timingContainer;editChoiceContainer;addTimingEvent;arrangeTimingTracks;noteArrows=[];noteArrowMask;lastTime=-1;lastBeat=-1;lastMode=Z.Edit;lastTimingMode=He.Off;lastHover=0;lastPlaying=!1;hovering=!1;trackingMovement=!0;idleFrames=0;lastBounds;constructor(e){super(e);const t=document.createElement("div");t.id="status-widget",document.getElementById("view-wrapper")?.appendChild(t),this.playbackBar=document.createElement("div"),this.playbackBar.classList.add("playback-bar"),this.editBar=document.createElement("div"),this.editBar.classList.add("edit-bar"),this.skipStart=document.createElement("button");const r=document.createElement("img");r.src=Ge.SKIP_START,r.style.height="36px",this.skipStart.appendChild(r),this.skipStart.onclick=()=>{this.manager.chartManager.setBeat(0)},this.skipEnd=document.createElement("button");const s=document.createElement("img");s.style.height="36px",s.src=Ge.SKIP_END,this.skipEnd.appendChild(s),this.skipStart.appendChild(r),this.skipEnd.onclick=()=>{this.manager.chartManager.lastNote()},this.play=document.createElement("button");const n=document.createElement("img");n.src=Ge.PLAY,this.play.appendChild(n),this.playIcon=n,this.play.onclick=()=>{(this.manager.chartManager.getMode()==Z.Record||this.manager.chartManager.getMode()==Z.Play)&&this.manager.chartManager.setMode(Z.Edit),this.manager.chartManager.playPause()},this.record=document.createElement("button");const a=document.createElement("img");a.style.height="36px",a.src=Ge.RECORD,this.record.appendChild(a),this.record.onclick=()=>{this.manager.chartManager.setMode(Z.Record)},this.playtest=document.createElement("button");const o=document.createElement("img");o.style.height="30px",o.src=Ge.PLAYTEST,this.playtest.appendChild(o),this.playtest.onclick=()=>{this.manager.chartManager.setMode(Z.Play)};const l=document.createElement("div");l.classList.add("playback-seperator"),this.timeCounter=document.createElement("div"),this.timeCounter.classList.add("playback-counter");const c=document.createElement("div");c.style.display="flex",c.classList.add("playback-counter-main");const u=document.createElement("div");u.classList.add("inlineEdit"),u.innerText="-",u.spellcheck=!1,u.contentEditable="true",u.onkeydown=S=>{Rs(S)||S.preventDefault(),S.key=="Enter"&&u.blur(),S.key=="Tab"&&h.focus(),S.key=="Escape"&&(u.innerText=Math.floor(Math.abs(this.manager.chartManager.getTime())/60).toString().padStart(2,"0"),u.blur())},u.onfocus=()=>this.selectText(u),u.onblur=()=>this.updateTime(),u.ondragstart=S=>S.preventDefault();const h=document.createElement("div");h.classList.add("inlineEdit"),h.innerText="-",h.spellcheck=!1,h.contentEditable="true",h.onkeydown=S=>{Rs(S)||S.preventDefault(),S.key=="Enter"&&h.blur(),S.key=="Tab"&&d.focus(),S.key=="Escape"&&(h.innerText=Math.floor(Math.abs(this.manager.chartManager.getTime())%60).toString().padStart(2,"0"),h.blur())},h.onfocus=()=>this.selectText(h),h.onblur=()=>this.updateTime(),h.ondragstart=S=>S.preventDefault();const d=document.createElement("div");d.classList.add("inlineEdit"),d.innerText="-",d.spellcheck=!1,d.contentEditable="true",d.onkeydown=S=>{Rs(S)||S.preventDefault(),S.key=="Enter"&&d.blur(),S.key=="Tab"&&u.focus(),S.key=="Escape"&&(d.innerText=(de(Math.abs(this.manager.chartManager.getTime())%1,3)*1e3).toString().padStart(3,"0"),d.blur())},d.onfocus=()=>this.selectText(d),d.onblur=()=>this.updateTime(),d.ondragstart=S=>S.preventDefault(),this.min=u,this.sec=h,this.millis=d;const f=document.createElement("div");f.classList.add("playback-counter-label"),f.innerText="Time",c.appendChild(u),c.appendChild(document.createTextNode(":")),c.appendChild(h),c.appendChild(document.createTextNode(".")),c.appendChild(d),this.timeCounter.appendChild(c),this.timeCounter.appendChild(f);const p=document.createElement("div");p.classList.add("playback-seperator"),this.beatCounter=document.createElement("div"),this.beatCounter.classList.add("playback-counter");const m=document.createElement("div");m.classList.add("playback-counter-main","inlineEdit"),m.innerText="-",m.spellcheck=!1,m.contentEditable="true",m.onkeydown=S=>{if(Rs(S)||S.preventDefault(),S.key=="Enter"&&m.blur(),S.key=="Escape"){if(this.beatDropdown.value=="Measure"){const R=this.manager.chartManager.loadedChart?.timingData?.getMeasure(this.manager.chartManager.getBeat())??this.manager.chartManager.getBeat()/4;m.innerText=de(R,3).toFixed(3)}else m.innerText=de(this.manager.chartManager.getBeat(),3).toFixed(3);m.blur()}},m.onfocus=()=>{this.selectText(m)},m.onblur=()=>this.updateBeat(),m.ondragstart=S=>S.preventDefault(),this.beat=m,this.beatDropdown=hi.create(["Beat","Measure"],"Beat"),this.beatDropdown.view.querySelector(".dropdown-selected").classList.add("playback-counter-label"),this.beatCounter.appendChild(m),this.beatCounter.appendChild(this.beatDropdown.view),this.beatDropdown.onChange(()=>{if(this.beatDropdown.value=="Measure"){const S=this.manager.chartManager.loadedChart?.timingData?.getMeasure(this.manager.chartManager.getBeat())??this.manager.chartManager.getBeat()/4;m.innerText=de(S,3).toFixed(3)}else m.innerText=de(this.manager.chartManager.getBeat(),3).toFixed(3)}),this.playbackBar.appendChild(this.skipStart),this.playbackBar.appendChild(this.skipEnd),this.playbackBar.appendChild(this.play),this.playbackBar.appendChild(this.record),this.playbackBar.appendChild(this.playtest),this.playbackBar.appendChild(l),this.playbackBar.appendChild(this.timeCounter),this.playbackBar.appendChild(p),this.playbackBar.appendChild(this.beatCounter),this.editSteps=document.createElement("button"),this.editSteps.classList.add("edit-fancy-button");const g=document.createElement("img");g.src=Ge.ADD,this.editSteps.appendChild(g),this.editSteps.appendChild(document.createTextNode("Edit Steps")),this.editSteps.onclick=()=>{this.manager.chartManager.editTimingMode=He.Off},this.editSteps.style.background="rgba(255,255,255,0.15)",this.editTiming=document.createElement("button"),this.editTiming.classList.add("edit-fancy-button");const y=document.createElement("img");y.src=Ge.SPEED,this.editTiming.appendChild(y),this.editTiming.appendChild(document.createTextNode("Edit Timing")),this.editTiming.onclick=()=>{this.manager.chartManager.editTimingMode=He.Edit};const b=document.createElement("div");b.classList.add("playback-seperator");const _=document.createElement("div");_.classList.add("edit-bar-left"),_.appendChild(this.editSteps),_.appendChild(this.editTiming),_.appendChild(b),this.editBar.appendChild(_),this.editChoiceContainer=document.createElement("div"),this.editChoiceContainer.classList.add("edit-choice-container"),this.stepsContainer=document.createElement("div"),this.stepsContainer.classList.add("edit-steps-container"),this.timingContainer=document.createElement("div"),this.timingContainer.classList.add("edit-timing-container"),this.editChoiceContainer.appendChild(this.stepsContainer),this.editChoiceContainer.appendChild(this.timingContainer),this.addTimingEvent=document.createElement("button");const v=document.createElement("img");v.style.height="32px",v.src=Ge.ADD_EVENT,this.addTimingEvent.appendChild(v),this.addTimingEvent.onclick=()=>{this.manager.chartManager.editTimingMode==He.Add?this.manager.chartManager.editTimingMode=He.Edit:this.manager.chartManager.editTimingMode=He.Add},this.timingContainer.appendChild(this.addTimingEvent),this.arrangeTimingTracks=document.createElement("button");const E=document.createElement("img");E.style.height="32px",E.src=Ge.EYE,this.arrangeTimingTracks.appendChild(E),this.arrangeTimingTracks.onclick=()=>{Wl.active?Wl.close():Wl.open()},this.arrangeTimingTracks.id="arrange-tracks",this.timingContainer.appendChild(this.arrangeTimingTracks),this.editBar.appendChild(this.editChoiceContainer);const I=document.createElement("div");I.classList.add("note-placeholder-right"),this.stepsContainer.appendChild(I),re.on("resize",()=>{this.trackingMovement=!0,this.idleFrames=5}),re.on("chartLoaded",()=>{this.stepsContainer.replaceChildren(),this.noteArrows.forEach(R=>{this.removeChild(R.sprite),this.removeChild(R.bg),this.removeChild(R.highlight)}),this.noteArrows=[];const S=document.createElement("div");if(S.classList.add("note-placeholder-right"),this.stepsContainer.appendChild(S),!!this.manager.chartManager.loadedChart){for(const R of this.manager.chartManager.loadedChart.gameType.editNoteTypes){const P=this.manager.chartManager.chartView.getNotefield().getNoteSprite({type:R,beat:0,col:0});P.width=32,P.height=32;const L=new Pe(ie.WHITE);L.tint=0,L.alpha=.5,L.width=48,L.height=48,L.anchor.set(.5);const W=new Nt("noBorder");W.alpha=0,W.width=48,W.height=48,W.pivot.x=24,W.pivot.y=24;const T=document.createElement("button");T.style.height="48px",T.style.width="48px",T.classList.add("note-placeholder"),T.onclick=()=>{this.manager.chartManager.setEditingNoteType(R)};const C={element:T,sprite:P,type:R,bg:L,highlight:W,hovered:!1};T.onmouseover=()=>{C.hovered=!0},T.onmouseleave=()=>{C.hovered=!1},this.addChild(L),this.addChild(P),this.addChild(W);const w=T.getBoundingClientRect();P.position.y=w.top-this.manager.app.view.clientHeight/2-this.manager.app.view.getBoundingClientRect().top+24,P.position.x=w.left-this.manager.app.view.clientWidth/2+24,L.position=P.position,this.noteArrows.push(C)}this.stepsContainer.replaceChildren(...this.noteArrows.map(R=>R.element),S),this.trackingMovement=!0,this.idleFrames=5}}),this.noteArrowMask=new Pe(ie.WHITE),this.noteArrowMask.height=48,this.noteArrowMask.width=2500,this.noteArrowMask.anchor.y=1,this.noteArrowMask.anchor.x=.5,this.addChild(this.noteArrowMask),this.mask=this.noteArrowMask,t.onmouseenter=()=>{this.lastHover=Date.now(),this.hovering=!0,this.view.style.opacity="",this.view.style.transition=""},t.onmouseleave=()=>this.hovering=!1,t.appendChild(this.playbackBar),t.appendChild(this.editBar),this.view=t,t.style.display="none"}update(){this.view.style.display=this.manager.chartManager.loadedSM?"":"none";const e=this.manager.chartManager.getTime();this.lastTime!=e&&(document.activeElement!=this.min&&(this.min.innerText=(e<0?"-":"")+Math.floor(Math.abs(e)/60).toString().padStart(2,"0")),document.activeElement!=this.sec&&(this.sec.innerText=Math.floor(Math.abs(e)%60).toString().padStart(2,"0")),document.activeElement!=this.millis&&(this.millis.innerText=(de(Math.abs(e)%1,3)*1e3).toString().padStart(3,"0")),this.lastTime=e);const t=this.manager.chartManager.getBeat();if(this.lastBeat!=t){if(document.activeElement!=this.beat)if(this.beatDropdown.value=="Measure"){const o=this.manager.chartManager.loadedChart?.timingData?.getMeasure(t)??t/4;this.beat.innerText=de(o,3).toFixed(3)}else this.beat.innerText=de(t,3).toFixed(3);this.lastBeat=t}const r=this.manager.chartManager.getMode(),s=this.manager.chartManager.editTimingMode;if(this.lastMode!=r){switch(r){case Z.Edit:case Z.View:this.skipStart.disabled=!1,this.skipEnd.disabled=!1,this.record.disabled=!1,this.playtest.disabled=!1,this.min.contentEditable="true",this.sec.contentEditable="true",this.millis.contentEditable="true",this.beat.contentEditable="true",this.record.style.background="",this.playtest.style.background="",this.view.style.opacity="",this.view.style.transition="",this.view.classList.remove("collapsed"),this.beatDropdown.disabled=!1;break;case Z.Record:this.lastHover=Date.now(),this.skipStart.disabled=!0,this.skipEnd.disabled=!0,this.record.disabled=!1,this.record.style.background="rgba(170, 0, 0, 0.35)",this.playtest.disabled=!0,this.min.contentEditable="false",this.sec.contentEditable="false",this.millis.contentEditable="false",this.beat.contentEditable="false",s!=He.Off&&(this.visible=!1),this.view.classList.add("collapsed"),this.beatDropdown.closeDropdown(),this.beatDropdown.disabled=!0;break;case Z.Play:this.lastHover=Date.now(),this.skipStart.disabled=!0,this.skipEnd.disabled=!0,this.record.disabled=!0,this.playtest.disabled=!1,this.playtest.style.background="rgba(12, 97, 31, 0.35)",this.min.contentEditable="false",this.sec.contentEditable="false",this.millis.contentEditable="false",this.beat.contentEditable="false",s!=He.Off&&(this.visible=!1),this.view.classList.add("collapsed"),this.beatDropdown.closeDropdown(),this.beatDropdown.disabled=!0}this.trackingMovement=!0,this.idleFrames=5,this.lastMode=r}if(this.lastTimingMode!=s){switch(s){case He.Off:this.visible=!0,this.stepsContainer.style.transform="",this.timingContainer.style.transform="",this.editSteps.style.background="rgba(255,255,255,0.15)",this.editTiming.style.background="";break;case He.Add:this.addTimingEvent.style.background="rgba(255,255,255,0.15)";break;case He.Edit:this.addTimingEvent.style.background=""}(this.lastTimingMode==He.Off&&s!=He.Off||this.lastTimingMode!=He.Off&&s==He.Off)&&this.manager.chartManager.clearSelections(),this.trackingMovement=!0,this.idleFrames=5,this.lastTimingMode=s,this.stepsContainer.style.transform=s==He.Off?"":"translateY(-48px)",this.timingContainer.style.transform=s==He.Off?"":"translateY(-48px)",this.editSteps.style.background=s==He.Off?"rgba(255,255,255,0.15)":"",this.editTiming.style.background=s==He.Off?"":"rgba(255,255,255,0.15)"}const n=this.manager.chartManager.chartAudio.isPlaying();if(this.lastPlaying!=n&&(this.playIcon.src=n?Ge.STOP:Ge.PLAY,this.lastPlaying=n),this.playIcon.style.height=this.manager.chartManager.chartAudio.isPlaying()?"28px":"",(r==Z.Play||r==Z.Record)&&this.view.style.opacity==""&&!this.hovering&&Date.now()-this.lastHover>3e3&&(this.view.style.opacity="0.2",this.view.style.transition="2s cubic-bezier(.11,.72,.51,1.14)"),this.trackingMovement){const o=this.noteArrows[0];if(o){const c=o.element.getBoundingClientRect();this.noteArrows.forEach((u,h)=>{u.sprite.position.y=c.top-this.manager.app.view.clientHeight/2-this.manager.app.view.getBoundingClientRect().top+24,u.sprite.position.x=c.left-this.manager.app.view.clientWidth/2+24+h*48,u.bg.position=u.sprite.position,u.highlight.position=u.sprite.position}),this.lastBounds&&Math.abs(this.lastBounds.top-c.top)+Math.abs(this.lastBounds.left-c.left)==0&&(this.idleFrames--,this.idleFrames<0&&(this.trackingMovement=!1,this.lastBounds=void 0,s!=He.Off&&(this.visible=!1))),this.lastBounds=c}const l=this.view.getBoundingClientRect();this.noteArrowMask.y=l.bottom-this.manager.app.view.clientHeight/2-this.manager.app.view.getBoundingClientRect().top}const a=this.manager.chartManager.getEditingNoteType();this.noteArrows.forEach(o=>{if(A.general.smoothAnimations){const l=a==o.type?.15:o.hovered?.05:0;o.highlight.alpha=(l-o.highlight.alpha)*.3+o.highlight.alpha}else o.highlight.alpha=a==o.type?.15:o.hovered?.05:0})}selectText(e){const t=window.getSelection(),r=document.createRange();!t||!r||(r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r))}updateTime(){this.millis.innerText=this.millis.innerText.padEnd(3,"0").slice(0,3);let e=this.safeParse(this.min)*60+this.safeParse(this.sec)+this.safeParse(this.millis)/1e3;e>9999999&&(e=9999999),this.manager.chartManager.setTime(e),this.lastTime=-999}updateBeat(){let e=this.safeParse(this.beat);this.beatDropdown.value=="Measure"&&(e=this.manager.chartManager.loadedChart?.timingData?.getBeatFromMeasure(e)??e*4),e>9999999&&(e=9999999),this.manager.chartManager.setBeat(e),this.lastBeat=-999}safeParse(e){try{const t=Rr.evaluate(e.innerText);return!isFinite(t)||t<0?0:t}catch{return 0}}}class m1 extends xe{app;chartManager;children=[];constructor(e){super(),this.app=e.app,this.chartManager=e,this.addChild(new d1(this)),this.addChild(new u1(this)),this.addChild(new p1(this)),this.addChild(new ls(this)),this.zIndex=2}update(){this.x=this.app.renderer.screen.width/2,this.y=this.app.renderer.screen.height/2,this.children.forEach(e=>e.update())}startPlay(){this.children.forEach(e=>e.startPlay())}endPlay(){this.children.forEach(e=>e.endPlay())}}const Uh=Array(85).fill(void 0).map((i,e)=>33+e),Pm=[];for(const i of Uh)for(const e of Uh)Pm.push([i,e]);const Hh="<~".split("").map(i=>i.charCodeAt(0)),Gh="~>".split("").map(i=>i.charCodeAt(0));function g1(i,e,t,r=!1,s=!1,n=!1){let a=[];typeof i=="string"?a=i.split("").map(h=>h.charCodeAt(0)):a=[...new Uint8Array(i)];const o=4-a.length%4;for(let h=0;ho.charCodeAt(0)):r=[...new Uint8Array(i)],e){if(r.at(-1)!=Gh.at(-1)||r.at(-2)!=Gh.at(-2))return!1;r.at(0)==Hh.at(0)&&r.at(1)==Hh.at(1)?r=r.slice(2,-2):r=r.slice(void 0,-2)}for(let o=0;o<4;o++)r.push("u".charCodeAt(0));let s=[],n=[];for(const o of r)if(o>=33&&117>=o){if(n.push(o),n.length==5){let l=0;for(const c of n)l=85*l+(c-33);if(l>2**32-1)return!1;s.push(l>>24&255),s.push(l>>16&255),s.push(l>>8&255),s.push(l&255),n=[]}}else if(o==122){if(n.length!=0)return!1;s.push(0),s.push(0),s.push(0),s.push(0)}else if(o==121){if(n.length!=0)return!1;s.push(32),s.push(32),s.push(32),s.push(32)}else{if(t.includes(String.fromCharCode(o)))continue;return!1}const a=4-n.length;return a&&(s=s.slice(void 0,-a)),s}function ei(i){let e=0,t=0,r=129;for(;r&128;){const s=i.shift();if(!s)break;e=e|(s&127)<<7*t++,r=s}return e}function ti(i){const e=[];let t=!1;for(;!t;){let r=i&127;i=i>>7,t=i==0,t||(r=r|128),e.push(r)}return e}const y1=["Hold","Mine","Roll","Lift","Fake"];function v1(i){if(i.startsWith("ArrowVortex:notes:")){const e=Rc(i.slice(18));if(e!==!1){const t=Array.from(e);if(t.shift()!=0)return;const r=ei(t),s=[];for(let n=0;n4)continue;const h=y1[u];if(l==c){if(h=="Hold"||h=="Roll")continue;s.push({type:h,beat:l/48,col:o})}else{if(h=="Mine"||h=="Fake"||h=="Lift")continue;s.push({type:h,beat:l/48,hold:(c-l)/48,col:o})}}else s.push({type:"Tap",beat:ei(t)/48,col:o})}return s}}}function b1(i){const e=[0];e.push(...ti(i.length));for(const t of i)if(t.type=="Tap"){const r=Math.round(t.beat*48);e.push(t.col),e.push(...ti(r))}else{e.push(t.col+128);const r=Math.round(t.beat*48);let s=0;De(t)&&(s=t.hold);const n=Math.round(s*48)+r;e.push(...ti(r)),e.push(...ti(n)),e.push(["Hold","Mine","Roll","Lift","Fake"].indexOf(t.type))}return"ArrowVortex:notes:"+Bc(e).map(t=>String.fromCharCode(t)).join("")}const jo=["BPMS","STOPS","DELAYS","WARPS","TIMESIGNATURES","TICKCOUNTS","COMBOS","SPEEDS","SCROLLS","FAKES","LABELS","ATTACKS","BGCHANGES","FGCHANGES"];function or(i){const e=new ArrayBuffer(4);return new DataView(e).setUint32(0,i,!0),Array.from(new Uint8Array(e))}function lr(i){const e=new Uint8Array(i.splice(0,4));return new DataView(e.buffer).getUint32(0,!0)}function gr(i){const e=new ArrayBuffer(8);return new DataView(e).setFloat64(0,i,!0),Array.from(new Uint8Array(e))}function yr(i){const e=new Uint8Array(i.splice(0,8)),t=new DataView(e.buffer);return de(t.getFloat64(0,!0),3)}function w1(i){return[i.length,...i.split("").map(e=>e.charCodeAt(0))]}function _1(i){const e=i.shift();if(!e)return"";let t="";for(let r=0;re.charCodeAt(0)))}function cr(i){const e=ei(i);if(!e)return"";let t="";for(let r=0;r{if(e.type=="ATTACKS"||e.type=="BGCHANGES"||e.type=="FGCHANGES")return!0;const t=Math.round(e.beat*48)/48;if(Math.abs(t-e.beat)>5e-4)return!0;if(e.type=="FAKES"||e.type=="WARPS"){const r=Math.round(e.value*48)/48;if(Math.abs(r-e.value)>5e-4)return!0}return e.type=="LABELS"&&e.value.length>255||e.type=="TIMESIGNATURES"&&(e.upper>2**32-1||e.lower>2**32-1)||e.type=="COMBOS"&&(e.hitMult>2**32-1||e.missMult>2**32-1)||e.type=="TICKCOUNTS"&&e.value>2**32-1})?E1(i):A1(i)}function A1(i){const e=[],t=new Map;i.forEach(r=>{t.has(r.type)||t.set(r.type,[]),t.get(r.type)?.push(r)});for(const[r,s]of t.entries())if(!(r=="ATTACKS"||r=="BGCHANGES"||r=="FGCHANGES")){e.push(s.length),e.push(jo.indexOf(r));for(const n of s)switch(e.push(...or(Math.round(n.beat*48))),n.type){case"BPMS":case"STOPS":case"DELAYS":case"SCROLLS":e.push(...gr(n.value));break;case"FAKES":case"WARPS":e.push(...or(Math.round(n.value*48)));break;case"TIMESIGNATURES":e.push(...or(Math.round(n.upper))),e.push(...or(Math.round(n.lower)));break;case"COMBOS":e.push(...or(Math.round(n.hitMult))),e.push(...or(Math.round(n.missMult)));break;case"TICKCOUNTS":e.push(...or(Math.round(n.value)));break;case"SPEEDS":e.push(...gr(n.value)),e.push(...gr(n.delay)),e.push(...or(n.unit=="B"?0:1));break;case"LABELS":e.push(...w1(n.value))}}return e.push(0),"ArrowVortex:tempo:"+Bc(e).map(r=>String.fromCharCode(r)).join("")}function E1(i){const e=[],t=new Map;i.forEach(r=>{t.has(r.type)||t.set(r.type,[]),t.get(r.type)?.push(r)});for(const[r,s]of t.entries()){e.push(...ti(s.length)),e.push(jo.indexOf(r));for(const n of s)switch(e.push(...ti(Math.round((n.type=="ATTACKS"?n.second:n.beat)*1e3))),n.type){case"BPMS":case"STOPS":case"DELAYS":case"SCROLLS":case"FAKES":case"WARPS":e.push(...gr(n.value));break;case"TIMESIGNATURES":e.push(...ti(Math.round(n.upper))),e.push(...ti(Math.round(n.lower)));break;case"COMBOS":e.push(...ti(Math.round(n.hitMult))),e.push(...ti(Math.round(n.missMult)));break;case"TICKCOUNTS":e.push(...ti(Math.round(n.value)));break;case"SPEEDS":e.push(...gr(n.value)),e.push(...gr(n.delay)),e.push(n.unit=="B"?0:1);break;case"LABELS":e.push(...hr(n.value));break;case"ATTACKS":e.push(...gr(n.value)),e.push(n.endType=="LEN"?0:1),e.push(...hr(n.mods));break;case"BGCHANGES":case"FGCHANGES":e.push((n.crossFade?1:0)+((n.stretchRewind?1:0)<<1)+((n.stretchNoLoop?1:0)<<2)),e.push(...hr(n.file)),e.push(...gr(n.updateRate)),e.push(...hr(n.effect)),e.push(...hr(n.file2)),e.push(...hr(n.transition)),e.push(...hr(n.color1)),e.push(...hr(n.color2))}}return"SMEditor:tempo:"+Bc(e).map(r=>String.fromCharCode(r)).join("")}function T1(i){if(i.startsWith("SMEditor:tempo:"))return C1(i);if(i.startsWith("ArrowVortex:tempo:"))return S1(i)}function S1(i){if(!i.startsWith("ArrowVortex:tempo:"))return;const e=Rc(i.slice(18)),t=[];if(e===!1)return;const r=Array.from(e);try{for(;;){const s=r.shift();if(s===void 0)return;if(s==0)break;const n=r.shift();if(n===void 0)return;const a=jo[n];for(let o=0;o0,stretchRewind:(c&2)>0,stretchNoLoop:(c&4)>0,effect:cr(r),file2:cr(r),transition:cr(r),color1:cr(r),color2:cr(r)})}}}}}catch{return}return t}class Bm{static _model;static get model(){return this._model||this._load(),this._model}static _load(){this._model=[];const e=localStorage.getItem("recentFiles");if(e){try{const t=JSON.parse(e);if(!Array.isArray(t))return;for(const r of t)typeof r!="object"||Array.isArray(r)||typeof r?.name!="string"||typeof r?.path!="string"||this._model.find(s=>s.path==r.path)||this._model.push({name:r.name,path:r.path})}catch{console.log("failed to load entries");return}this.saveEntries()}}static getRecents(){return this.model}static addSM(e,t){const r=this.model,s=r.findIndex(n=>n.path==e);s!=-1&&r.splice(s,1),this.model.unshift({name:t.properties.TITLE??"Untitled Song",path:e}),this.saveEntries()}static limitEntries(){this.model.splice(15)}static async saveEntries(){this.limitEntries();const e=await Promise.all(this._model.map(async t=>await $e.getFileHandle(t.path)!==void 0));this._model=this._model.filter((t,r)=>e[r]),localStorage.setItem("recentFiles",JSON.stringify(this._model))}}class Wh{static menuElement;static closeTimeout;static open(e,t){this.buildMenu(e),this.menuElement.style.display="none",setTimeout(()=>this.fitContextMenu(t)),this.menuElement.classList.add("entering"),clearTimeout(this.closeTimeout),setTimeout(()=>this.menuElement?.classList.remove("entering"),300),this.menuElement.style.left=t.clientX+"px",this.menuElement.style.top=t.clientY+"px"}static fitContextMenu(e){this.menuElement.style.display="";const t=this.menuElement.getBoundingClientRect(),r=window.innerHeight-t.bottom-20,s=window.innerWidth-t.right-20;r<0&&(this.menuElement.style.top=e.clientY+r+"px"),s<0&&(this.menuElement.style.left=e.clientX+s+"px"),this.menuElement.style.transformOrigin=`${Math.max(0,-s)}px ${Math.max(0,-r)}px`}static close(){this.menuElement&&(this.menuElement.classList.add("exiting"),this.closeTimeout=setTimeout(()=>this.menuElement.replaceChildren(),300))}static buildMenu(e){const t=document.createElement("div");if(t.appendChild(this.createElement(e,{type:"selection",id:"cut"})),t.appendChild(this.createElement(e,{type:"selection",id:"copy"})),t.appendChild(this.createElement(e,{type:"selection",id:"paste"})),e.chartManager.getMode()==Z.Edit&&e.chartManager.hasSelection()){const r=document.createElement("div");r.classList.add("seperator"),t.appendChild(r),Ls.selection.options.slice(0,-2).forEach(s=>{t.appendChild(this.createElement(e,s))})}this.menuElement=t,t.id="context-menu",document.getElementById("context-menu")?.replaceWith(this.menuElement)}static createElement(e,t){if(t.type=="seperator"){const r=document.createElement("div");return r.classList.add("seperator"),r}if(t.type=="selection"||t.type=="checkbox"||t.type=="dropdown"){const r=document.createElement("div"),s=document.createElement("div"),n=document.createElement("div");let a;if(t.type=="selection"||t.type=="checkbox"){const o=ht[t.id];a=document.createElement("div"),a.innerText=tt.getKeybindString(t.id),a.classList.add("keybind","unselectable"),n.innerText=o.label;let l=o.disabled;typeof l=="function"&&(l=l(e)),l&&r.classList.add("disabled"),r.addEventListener("click",()=>{l||(o.callback(e),this.close())})}else a=document.createElement("img"),a.classList.add("icon"),a.src=Ge.CHEVRON,a.style.transform="rotate(-90deg)",n.innerText=typeof t.title=="function"?t.title(e):t.title;if(s.appendChild(n),s.appendChild(a),r.appendChild(s),r.classList.add("menu-item"),s.classList.add("menu-item-title","menu-hover"),n.classList.add("title","unselectable"),t.type=="dropdown"){const o=document.createElement("div");r.appendChild(o),o.classList.add("menubar-dropdown"),t.options.map(l=>this.createElement(e,l)).forEach(l=>o.appendChild(l))}if(t.type=="checkbox"){let o=t.checked;typeof o=="function"&&(o=o(e)),o&&(n.innerText="✓ "+n.innerText)}return r}if(t.type=="menu"){const r=document.createElement("div"),s=document.createElement("div"),n=document.createElement("div");return r.appendChild(s),s.innerText=t.title,r.appendChild(n),s.classList.add("title","unselectable"),r.classList.add("menu-item","menu-main"),s.classList.add("menu-hover"),n.classList.add("menubar-dropdown","unselectable"),r.onmouseenter=()=>{n.replaceChildren(...t.options.map(a=>this.createElement(e,a)))},r.onmouseleave=()=>{n.replaceChildren()},r}return document.createElement("div")}}const M1={fontName:"Main",fontSize:20,fill:["#ffffff"]};class k1 extends xe{renderer;barlineMap=new Map;barlineLabelMap=new Map;barlinePool=new as({create:()=>new Pe(ie.WHITE)});barlineLabelPool=new as({create:()=>new Fe("",M1)});constructor(e){super(),this.renderer=e;const t=()=>{this.barlineMap.clear(),this.barlineLabelMap.clear(),this.barlinePool.destroyAll(),this.barlineLabelPool.destroyAll()};re.on("timeSigChanged",t),this.on("destroyed",()=>re.off("timeSigChanged",t)),this.addChild(this.barlinePool,this.barlineLabelPool)}update(e,t){this.visible=this.renderer.chartManager.getMode()!=Z.Play||!A.play.hideBarlines;for(const[r,s]of this.getBarlineBeats(e,t)){if(!this.barlineMap.has(r)){const n=this.barlinePool.createChild();if(!n)continue;Object.assign(n,{width:this.renderer.chart.gameType.notefieldWidth+128,height:s?4:1,visible:!0}),n.anchor.set(.5),this.barlineMap.set(r,n)}if(s&&!this.barlineLabelMap.has(r)){const n=this.barlineLabelPool.createChild();if(!n)continue;Object.assign(n,{x:(this.renderer.chart.gameType.notefieldWidth+128)/-2-16,text:`${Math.round(this.renderer.chart.timingData.getMeasure(r))}`,visible:!0}),n.anchor.set(1,.5),this.barlineLabelMap.set(r,n)}}for(const[r,s]of this.barlineMap.entries()){if(rt){this.barlineMap.delete(r),this.barlinePool.destroyChild(s);continue}s.y=this.renderer.getYPosFromBeat(r)}for(const[r,s]of this.barlineLabelMap.entries()){if(rt){this.barlineLabelMap.delete(r),this.barlineLabelPool.destroyChild(s);continue}s.y=this.renderer.getYPosFromBeat(r),s.scale.y=A.chart.reverse?-1:1}}*getBarlineBeats(e,t){e=Math.max(0,e);const r=this.renderer.chart.timingData,s=r.getTimingData("TIMESIGNATURES");let n=r.getTimingEventAtBeat("TIMESIGNATURES",e),a=n?s.findIndex(d=>d.beat==n.beat):-1,o=r.getDivisionLength(e);const l=r.getDivisionOfMeasure(e)%1*o;let c=Math.max(0,e-l);c=s[a+1]?.beat&&(a++,n=s[a],c=n.beat,o=r.getDivisionLength(c),u=0,h=n.upper)}}class I1 extends Fe{renderer;constructor(e){super("",{fontName:"Fancy"}),this.y=50,this.anchor.set(.5),this.renderer=e}update(){const e=this.renderer.chartManager.gameStats;if(this.visible=this.renderer.chartManager.getMode()==Z.Play,this.scale.y=A.chart.reverse?-1:1,!e)return;const t=e.getCombo()==0?e.getMissCombo():e.getCombo();t<4?this.text="":this.text=t+"",e.getCombo()==0?this.tint=Je.getCollection(A.play.timingCollection).getMissJudgment().color:e.getBestJudge()?this.tint=mm(e.getBestJudge().color,Math.sin(Date.now()/225)*.2+1.2):this.tint=16777215}}const P1=1,rf=15,B1={fontName:"Fancy",fontSize:12};class R1 extends xe{barlines=new xe;barline;currentMedian;errorText=new Fe("",B1);errorTextTime=-1;renderer;target=0;constructor(e){super(),this.y=10,this.renderer=e,this.barline=new Pe(ie.WHITE),this.barline.anchor.set(.5),this.barline.height=1,this.barline.alpha=.5;const t=new Pe(ie.WHITE);t.width=2,t.height=rf,t.anchor.set(.5),this.currentMedian=new us,this.currentMedian.beginFill(16777215),this.currentMedian.moveTo(0,-10),this.currentMedian.lineTo(5,-15),this.currentMedian.lineTo(-5,-15),this.currentMedian.lineTo(0,-10),this.errorText.y=-25,this.errorText.anchor.set(.5),this.addChild(this.barline,t,this.barlines,this.currentMedian,this.errorText)}update(){this.visible=this.renderer.chartManager.getMode()==Z.Play;for(const e of this.barlines.children){const t=e,r=(Date.now()-t.createTime)/5e3;r<.05?e.alpha=1:r<.3?e.alpha=Ds(1,.2,(r-.05)/.25):r<.9?e.alpha=.2:e.alpha=(1-r)*3}this.errorText.alpha=at((2e3-(Date.now()-this.errorTextTime))/1e3,0,1),this.barline.width=Je.getCollection(A.play.timingCollection).maxWindowMS()/1e3*2*400,Ht(this.barlines.children,e=>Date.now()-e.createTime>5e3),A.general.smoothAnimations?this.currentMedian.x=(this.currentMedian.x-this.target)*.8+this.target:this.currentMedian.x=this.target,this.errorText.scale.y=A.chart.reverse?-1:1,this.currentMedian.scale.y=A.chart.reverse?-1:1}addBar(e,t){if(!ri(t)&&!Gi(t))return;const r=new Pe(ie.WHITE);r.width=P1,r.height=rf,r.anchor.set(.5),r.x=e*400,r.tint=t.color,r.createTime=Date.now(),r.miss=ri(t),r.ms=Math.round(e*1e3),this.errorText.tint=t.color,this.errorText.text=(e*1e3).toFixed(1)+"ms",this.errorTextTime=Date.now(),this.barlines.addChild(r),this.target=zo(this.barlines.children.filter(s=>!s.miss).map(s=>s.ms))*.4}reset(){this.currentMedian.x=0,this.target=0,Ht(this.barlines.children,()=>!0)}}class D1 extends Pe{createTime=-1;active=!1;type=dm;constructor(){super(),this.y=-40,this.anchor.set(.5)}update(){if(this.visible=this.active,this.active){const e=(Date.now()-this.createTime)/1e3;let t=1.2;if(Je.getCollection(A.play.timingCollection).shouldHideNote(this.type)||(t=.8),e<.1){const r=1-(1-e/.1)*(1-e/.1),s=(1-t)*r+t;this.scale.x=.4*s,this.scale.y=.4*s*(A.chart.reverse?-1:1)}else if(e>.6&&e<.8){const r=(e-.6)/.2*(e-.6)/.2;this.scale.x=.4*(1-r),this.scale.y=.4*(1-r)*(A.chart.reverse?-1:1)}else e>.8&&(this.active=!1)}}doJudge(e,t){if(!Gi(t)&&!ri(t))return;const r=t.judgmentTexture.getTexture(e,t);r&&(this.texture=r,this.texture.updateUvs(),this.active=!0,this.type=t,this.createTime=Date.now(),A.play.judgmentTilt?this.rotation=at(e,-.05,.05)*300/180*Math.PI:this.rotation=0)}reset(){this.active=!1}}class L1 extends xe{previewArea=new Pe(ie.WHITE);previewText=new Fe("SONG PREVIEW",{fontName:"Main",fontSize:13});renderer;constructor(e){super(),this.renderer=e,Object.assign(this.previewArea,{alpha:.2,tint:11052482,width:this.renderer.chart.gameType.notefieldWidth+96,height:64}),this.previewText.x=-this.previewArea.width/2+5,this.previewArea.anchor.x=.5,this.addChild(this.previewArea,this.previewText)}update(){const e=Number(this.renderer.chart.sm.properties.SAMPLESTART),t=Number(this.renderer.chart.sm.properties.SAMPLELENGTH);if(Number.isNaN(e)||Number.isNaN(t)||this.renderer.chartManager.getMode()==Z.Play&&A.play.hideBarlines){this.visible=!1;return}this.visible=!0;let r=this.renderer.getYPosFromSecond(e),s=this.renderer.getYPosFromSecond(e+t);si=="B"?"Beats":"Seconds",deserialize:i=>i=="Beats"?"B":"T"}}}]},TIMESIGNATURES:{title:"Time Signature Event",width:200,rows:[{label:"Upper",key:"upper",input:{type:"spinner",step:1,precision:0,min:1}},{label:"Lower",key:"lower",input:{type:"spinner",step:1,precision:0,min:1}}]},COMBOS:{title:"Combo Event",width:200,description:"Multiplies the combo gained from hitting/missing notes after this event.",rows:[{label:"Hit multiplier",key:"hitMult",input:{type:"spinner",step:1,precision:0,min:0}},{label:"Miss multiplier",key:"missMult",input:{type:"spinner",step:1,precision:0,min:0}}]},ATTACKS:{title:"Attack Event",width:200,description:"Applies a modifier to the playfield. Can specify the length of the applied attack in seconds or the end time of the attack.",rows:[{label:"Timing type",key:"endType",input:{type:"dropdown",items:["Length","End"],transformers:{serialize:i=>i=="LEN"?"Length":"End",deserialize:i=>i=="Length"?"LEN":"END"}}},{label:"Seconds",key:"value",input:{type:"spinner",precision:3}},{label:"Mods",key:"mods",input:{type:"text"}}]},BGCHANGES:{title:"BG Change Event",width:250,rows:[{label:"File",key:"file",input:{type:"text"}},{label:"Update rate",key:"updateRate",input:{type:"spinner",precision:3,min:0}},{label:"Crossfade",key:"crossfade",input:{type:"checkbox"}},{label:"StretchRewind",key:"stretchRewind",input:{type:"checkbox"}},{label:"StretchNoLoop",key:"StretchNoLoop",input:{type:"checkbox"}},{label:"Effect",key:"effect",input:{type:"text"}},{label:"File2",key:"file2",input:{type:"text"}},{label:"Transition",key:"transition",input:{type:"text"}},{label:"Color1",key:"color1",input:{type:"text"}},{label:"Color2",key:"color2",input:{type:"text"}}]},FGCHANGES:{title:"FG Change Event",width:250,rows:[{label:"File",key:"file",input:{type:"text"}},{label:"Update rate",key:"updateRate",input:{type:"spinner",precision:3,min:0}},{label:"Crossfade",key:"crossfade",input:{type:"checkbox"}},{label:"StretchRewind",key:"stretchRewind",input:{type:"checkbox"}},{label:"StretchNoLoop",key:"StretchNoLoop",input:{type:"checkbox"}},{label:"Effect",key:"effect",input:{type:"text"}},{label:"File2",key:"file2",input:{type:"text"}},{label:"Transition",key:"transition",input:{type:"text"}},{label:"Color1",key:"color1",input:{type:"text"}},{label:"Color2",key:"color2",input:{type:"text"}}]}};class wi{static activePopup;timingBox;popup;zoomer;editText;timingData;rows=[];onTimingChange;clickOutside;moveInterval;modifyBox;onConfirm=()=>{};persistent=!1;constructor(e,t,r=!1){e.popup=this,this.timingBox=e,this.timingData=t,this.modifyBox=r,this.popup=this.build(),this.popup.style.display="none",setTimeout(()=>this.movePosition()),this.onTimingChange=this.updateValues.bind(this),this.clickOutside=s=>{this.popup.contains(s.target)||this.close()},re.on("timingModified",this.onTimingChange),wi.activePopup?.persistent?e.popup=void 0:(document.getElementById("popups")?.appendChild(this.popup),this.moveInterval=setInterval(()=>this.movePosition(),150),wi.activePopup?.close(),wi.activePopup=this)}movePosition(){this.popup.style.display="";const e=this.timingBox.backgroundObj.getBounds(),t=e.left+e.width/2,r=sf[this.timingBox.event.type].width??150,s=r/2+15,n=window.innerWidth-r/2-15;this.popup.style.left=`${at(t,s,n)}px`;const a=e.top+e.height/2;this.popup.style.top=`${e.top+e.height}px`,a+this.popup.clientHeight>window.innerHeight-15&&(this.popup.style.transform="translate(-50%, -100%)",this.popup.style.top=`${e.top-e.height/2}px`)}build(){const e=sf[this.timingBox.event.type],t=document.createElement("div");t.classList.add("popup");const r=document.createElement("div");r.classList.add("popup-zoomer"),r.style.width=e.width?`${e.width}px`:"150px",r.style.backgroundColor=Fh(Tr[this.timingBox.event.type].toString(16).padStart(6,"0"),"#333333",.75),this.zoomer=r,t.appendChild(r);const s=document.createElement("div");if(s.innerText=e.title,s.classList.add("popup-title"),r.appendChild(s),e.description){const u=document.createElement("div");u.innerText=e.description,r.appendChild(u),u.classList.add("popup-desc")}const n=document.createElement("div");n.classList.add("popup-grid"),r.appendChild(n),e.rows.forEach(u=>n.append(...this.buildRow(u)));const a=document.createElement("div");a.innerText="click to edit",a.style.marginTop="4px",a.style.height="10px",r.appendChild(a),a.classList.add("popup-desc"),this.editText=a;const o=document.createElement("div");o.classList.add("popup-options");const l=document.createElement("button");l.innerText="Ok",l.onclick=()=>{this.close(),this.onConfirm(this.timingBox.event)},l.classList.add("confirm"),o.append(l);const c=document.createElement("button");return c.innerText="Delete",c.onclick=()=>{this.modifyBox||this.timingData.delete(this.timingBox.songTiming,this.timingBox.event.type,this.timingBox.event.type=="ATTACKS"?this.timingBox.event.second:this.timingBox.event.beat),this.close()},c.classList.add("delete"),o.append(c),r.append(o),t}buildRow(e){const t=structuredClone(this.timingBox.event),r=document.createElement("div");r.innerText=e.label,r.classList.add("popup-label");const s=[];switch(s.push(r),e.input.type){case"spinner":{const n=ot.create(t[e.key],e.input.step,e.input.precision,e.input.min,e.input.max);n.onChange=a=>{a!==void 0&&(this.modifyBox?Object.assign(this.timingBox.event,{[e.key]:a}):this.timingData.insert(this.timingBox.songTiming,this.timingBox.event.type,Object.assign(t,{[e.key]:a}),this.timingBox.event.beat))},this.rows.push({data:e,el:n}),s.push(n.view);break}case"text":{const n=document.createElement("input");n.type="text",n.autocomplete="off",n.spellcheck=!1,n.onkeydown=a=>{a.key=="Enter"&&n.blur()},n.onblur=()=>{this.modifyBox?Object.assign(this.timingBox.event,{[e.key]:n.value}):this.timingData.insert(this.timingBox.songTiming,this.timingBox.event.type,Object.assign(t,{[e.key]:n.value}),this.timingBox.event.beat)},n.value=t[e.key],this.rows.push({data:e,el:n}),s.push(n);break}case"dropdown":{if(e.input.transformers){const n=e.input.transformers.deserialize,a=e.input.transformers.serialize,o=hi.create(e.input.items,a(t[e.key]));o.onChange(l=>{this.modifyBox?Object.assign(this.timingBox.event,{[e.key]:n(l)}):this.timingData.insert(this.timingBox.songTiming,this.timingBox.event.type,Object.assign(t,{[e.key]:n(l)}),this.timingBox.event.beat)}),this.rows.push({data:e,el:o}),s.push(o.view)}else{const n=hi.create(e.input.items,t[e.key]);n.onChange(a=>{this.timingData.insert(this.timingBox.songTiming,this.timingBox.event.type,{[e.key]:a},this.timingBox.event.beat)}),this.rows.push({data:e,el:n}),s.push(n.view)}break}case"checkbox":{const n=document.createElement("input");n.type="checkbox",n.checked=t[e.key],n.onchange=()=>{this.modifyBox?Object.assign(this.timingBox.event,{[e.key]:n.checked}):this.timingData.insert(this.timingBox.songTiming,this.timingBox.event.type,Object.assign(t,{[e.key]:n.checked}),this.timingBox.event.beat)},this.rows.push({data:e,el:n}),s.push(n);break}}return s}updateValues(){const e=this.timingData.getTimingEventAtBeat(this.timingBox.event.type,this.timingBox.event.beat);if(!this.timingBox||!e||e.beat!=this.timingBox.event.beat){this.close();return}this.rows.forEach(t=>{switch(t.data.input.type){case"spinner":{t.el.setValue(e[t.data.key]);break}case"text":{t.el.value=e[t.data.key];break}case"dropdown":{const r=t.el;t.data.input.transformers?r.setSelected(t.data.input.transformers.serialize(e[t.data.key])):r.setSelected(e[t.data.key]);break}case"checkbox":{t.el.checked=e[t.data.key];break}}})}close(){this.persistent=!1,re.off("timingModified",this.onTimingChange),window.removeEventListener("click",this.clickOutside),clearInterval(this.moveInterval),this.popup.classList.add("exiting"),setTimeout(()=>this.popup.remove(),200),this.timingBox.popup=void 0,wi.activePopup=void 0}select(){this.persistent=!0,this.zoomer.classList.add("selected"),this.editText.style.transform="scale(0)",this.editText.style.height="0px",setTimeout(()=>window.addEventListener("click",this.clickOutside),200)}detach(){clearInterval(this.moveInterval)}}const zh={fontName:"Main",fontSize:15},vr={BPMS:55,STOPS:55,DELAYS:55,WARPS:55,FAKES:55,COMBOS:40,SPEEDS:80,LABELS:80,SCROLLS:55,TIMESIGNATURES:40,TICKCOUNTS:40,BGCHANGES:55,FGCHANGES:55,ATTACKS:55};class N1 extends xe{tracks=new xe;renderer;timingBoxMap=new Map;wasEditingTiming=!1;boxPool=new as({create:()=>{const e=new xe;return e.textObj=new Fe("",zh),e.backgroundObj=new Nt,e.selection=new Nt("onlyBorder"),e.selection.tint=3841008,e.addChild(e.backgroundObj,e.textObj,e.selection),e}});ghostBox;timingDirty=!1;constructor(e){super(),this.renderer=e,this.boxPool.sortableChildren=!0,this.sortableChildren=!0,this.addChild(this.tracks,this.boxPool);const t=()=>this.timingDirty=!0;re.on("timingModified",t),this.on("destroyed",()=>re.off("timingModified",t))}update(e,t){this.renderer.chartManager.editTimingMode!=He.Add&&(this.ghostBox?.removeFromParent(),this.ghostBox?.destroy(),this.ghostBox=void 0),this.updateTracks(),this.updateBoxes(e,t)}createTrack(e,t){const r=Object.assign(new Pe(ie.WHITE),{alpha:0,width:vr[e],name:e,height:5e3,x:t,type:e,lastX:0,tint:2503250,targetAlpha:0});return r.anchor.y=.5,this.tracks.addChild(r),r}initializeBox(e,t){Object.assign(e,{event:t,songTiming:this.renderer.chart.timingData.isTypeChartSpecific(t.type),lastX:void 0,lastAnchor:void 0,animationId:void 0,zIndex:t.beat,eventMode:"static"}),e.textObj.text=this.getLabelFromEvent(t),e.textObj.anchor.set(.5,.55),e.backgroundObj.width=e.textObj.width+10,e.backgroundObj.height=25,e.backgroundObj.position.x=-e.backgroundObj.width/2,e.backgroundObj.position.y=-25/2,e.selection.width=e.textObj.width+10,e.selection.height=25,e.selection.position=e.backgroundObj.position,e?.popup?.persistent!==!0&&e.popup?.close(),e.popup=void 0}addDragListeners(e,t){e.on("mouseenter",()=>{e?.popup?.persistent!==!0&&(this.renderer.chartManager.eventSelection.timingEvents.length>0||this.renderer.isDragSelecting()||(e.popup?.close(),this.renderer.chartManager.getMode()==Z.Edit&&(new wi(e,this.renderer.chart.timingData),e.popup&&(e.popup.onConfirm=()=>{this.renderer.chartManager.removeEventFromSelection(t)}))))}),e.on("mouseleave",()=>{e?.popup?.persistent!==!0&&e.popup?.close()});let r=0,s;const n=a=>{const o=s,l=this.toLocal(a.global);if(Math.abs(l.y-r)<32){this.renderer.chartManager.eventSelection.shift&&(this.renderer.chartManager.eventSelection.shift={beatShift:0});return}e.popup?.close();const c=this.renderer.getBeatFromYPos(l.y),u=A.chart.snap==0?1/1e3:A.chart.snap;let h=Math.round(c/u)*u;Math.abs(h-c)>Math.abs(c-o.beat)&&(h=o.beat),this.renderer.chartManager.eventSelection.shift||={beatShift:0},this.renderer.chartManager.eventSelection.shift.beatShift=Math.max(-Math.min(...this.renderer.chartManager.eventSelection.timingEvents.map(d=>d.beat)),h-o.beat)};e.on("pointerdown",a=>{if(Oh(a)){this.renderer.chartManager.clearSelections(),this.renderer.chartManager.addEventToSelection(t),wi.activePopup?.close();return}if(a.stopImmediatePropagation(),this.renderer.chartManager.eventSelection.timingEvents.includes(t)?(a.getModifierState("Control")||a.getModifierState("Meta"))&&this.renderer.chartManager.removeEventFromSelection(t):(!a.getModifierState("Control")&&!a.getModifierState("Meta")&&!a.getModifierState("Shift")&&this.renderer.chartManager.clearSelections(),this.renderer.chartManager.addEventToSelection(t)),this.renderer.chartManager.getMode()==Z.Edit&&this.renderer.chartManager.eventSelection.timingEvents.length==1&&(e?.popup||(wi.activePopup?.close(),new wi(e,this.renderer.chart.timingData),e.popup.onConfirm=()=>{this.renderer.chartManager.removeEventFromSelection(t)})),e.popup&&!a.getModifierState("Control")&&!a.getModifierState("Meta")&&!a.getModifierState("Shift")?e.popup.select():e.popup?.close(),r=e.y,s=t,this.renderer.chartManager.editTimingMode==He.Add)return;this.renderer.on("pointermove",n);const o=()=>{this.renderer.off("pointermove",n),this.renderer.off("pointerup",o),(this.renderer.chartManager.eventSelection.shift?.beatShift??0)!=0&&this.renderer.chartManager.modifyEventSelection(l=>(l.type=="ATTACKS"&&(l.second=this.renderer.chart.timingData.getSecondsFromBeat(l.beat+this.renderer.chartManager.eventSelection.shift.beatShift)),l.beat+=this.renderer.chartManager.eventSelection.shift.beatShift,l)),this.renderer.chartManager.eventSelection.shift=void 0};this.renderer.on("pointerup",o)})}updateTracks(){const e=A.chart.timingEventOrder.left,t=A.chart.timingEventOrder.right,r=this.renderer.chartManager.editTimingMode!=He.Off&&this.renderer.chartManager.getMode()==Z.Edit;let s=-this.renderer.chart.gameType.notefieldWidth*.5-128;for(let n=e.length-1;n>=0;n--){const a=e[n],o=this.tracks.getChildByName(a)??this.createTrack(a,s);o.lastX!=s&&(o.lastX=s,o.targetAlpha=n%2==0?.1:0,Ft.animate(o,{0:{x:"inherit","anchor.x":"inherit"},1:{x:s,"anchor.x":1}},.3,Yt(0,0,.16,1.01),()=>{},`track-${a}-x`),Ft.animate(o,{0:{alpha:"inherit"},1:{alpha:r?o.targetAlpha:0}},.3,Yt(0,0,.16,1.01),()=>{},`track-${a}-alpha`)),s-=vr[a]}s=this.renderer.chart.gameType.notefieldWidth*.5+128;for(let n=0;n{},`track-${a}-x`),Ft.animate(o,{0:{alpha:"inherit"},1:{alpha:r?o.targetAlpha:0}},.3,Yt(0,0,.16,1.01),()=>{},`track-${a}-alpha`)),s+=vr[a]}if(this.wasEditingTiming!=r){this.wasEditingTiming=r;for(const n of this.tracks.children)Ft.animate(n,{0:{alpha:"inherit"},1:{alpha:r?n.targetAlpha:0}},.3,Yt(0,0,.16,1.01),()=>{},`track-${n.type}-alpha`)}}updateBoxes(e,t){this.timingDirty&&(this.timingBoxMap.clear(),this.boxPool.destroyAll(),this.timingDirty=!1,wi.activePopup?.close());const r=this.renderer.chartManager.editTimingMode!=He.Off&&this.renderer.chartManager.getMode()==Z.Edit;this.boxPool.visible=this.renderer.chartManager.getMode()!=Z.Play||!A.play.hideBarlines;const s=this.renderer.chart.timingData.getSecondsFromBeat(e),n=this.renderer.chart.timingData.getSecondsFromBeat(t);for(const o of this.renderer.chart.timingData.getTimingData()){if(to.beat||s>o.second)&&!this.timingBoxMap.has(o)){const l=this.boxPool.createChild();if(!l)break;this.initializeBox(l,o),this.addDragListeners(l,o),this.timingBoxMap.set(o,l)}}const a={beat:-Number.MAX_SAFE_INTEGER,second:-Number.MAX_SAFE_INTEGER,leftOffset:0,rightOffset:0};for(const[o,l]of this.timingBoxMap.entries()){if(o.beatt){this.timingBoxMap.delete(o),this.boxPool.destroyChild(l);continue}let c=0,u=0;const h=l.backgroundObj.width,d=A.chart.timingEventOrder.right.includes(o.type)?"right":"left";r?(c=this.tracks.getChildByName(o.type)?.x??l.x,c+=vr[o.type]/2*(c>0?1:-1),u=.5):(c=(d=="right"?1:-1)*(this.renderer.chart.gameType.notefieldWidth*.5+80),d=="left"&&(c-=30),(a.beat!=o.beat||o.second&&a.second!=o.second)&&(a.leftOffset=0,a.rightOffset=0,a.beat=o.beat,a.second=o.second),d=="left"?(c-=a.leftOffset,a.leftOffset+=h+5):(c+=a.rightOffset,a.rightOffset+=h+5),u=d=="right"?0:1),l.lastX===void 0||l.lastAnchor===void 0?(l.position.x=c,l.pivot.x=(u-.5)*h):(l.lastX!=c||l.lastAnchor!=u)&&(l.animationId=Ft.animate(l,{0:{x:"inherit","pivot.x":"inherit"},1:{x:c,"pivot.x":(u-.5)*h}},.3,Yt(0,0,.16,1.01),()=>{},l.animationId)),l.lastX=c,l.lastAnchor=u,l.y=A.chart.CMod&&o.type=="ATTACKS"?this.renderer.getYPosFromSecond(o.second):this.renderer.getYPosFromBeat(o.beat),l.textObj.scale.y=A.chart.reverse?-1:1;const f=this.renderer.chartManager.getMode()!=Z.Play&&(this.renderer.chartManager.eventSelection.timingEvents.includes(o)||this.renderer.chartManager.eventSelection.inProgressTimingEvents.includes(o));if(l.backgroundObj.tint=f?mm(Tr[o.type]??0,Math.sin(Date.now()/320)*.4+1.5):Tr[o.type]??0,l.selection.alpha=f?1:0,l.visible=!f||!this.renderer.chartManager.eventSelection.shift,this.renderer.chartManager.editTimingMode!=He.Off){const p=this.renderer.selectionTest(l);!f&&p&&this.renderer.chartManager.addEventToDragSelection(o),f&&!p&&this.renderer.chartManager.removeEventFromDragSelection(o)}}}updateGhostEvent(e){const t=A.chart.snap==0?.001:A.chart.snap,r=Math.round(this.renderer.getBeatFromYPos(e.y)/t)*t,s=this.ghostBox?.popup?this.ghostBox.event.type:this.getClosestTrack(e.x)?.name;if(!s){this.ghostBox?.removeFromParent(),this.ghostBox?.destroy(),this.ghostBox=void 0;return}if(!this.ghostBox){const o=new xe;o.textObj=new Fe("",zh),o.backgroundObj=new Nt,o.selection=new Nt("onlyBorder"),o.guideLine=new Pe(ie.WHITE),o.selection.tint=3841008,o.selection.alpha=0,o.addChild(o.guideLine,o.backgroundObj,o.textObj,o.selection),this.addChild(o),o.visible=!0,o.textObj.anchor.set(.5,.55),o.backgroundObj.height=25,o.selection.height=25,o.guideLine.height=1,o.guideLine.anchor.y=.5,this.ghostBox=o}!this.ghostBox?.popup&&(this.ghostBox.event?.beat!=r||this.ghostBox.event?.type!=s)&&(this.ghostBox.event=structuredClone(this.renderer.chart.timingData.getTimingEventAtBeat(s,r))??this.renderer.chart.timingData.getDefaultEvent(s,r),this.ghostBox.event.beat=r,s=="ATTACKS"&&(this.ghostBox.event.second=this.renderer.chart.getSecondsFromBeat(r)),this.ghostBox.textObj.text=this.getLabelFromEvent(this.ghostBox.event),this.ghostBox.backgroundObj.width=this.ghostBox.textObj.width+10,this.ghostBox.selection.width=this.ghostBox.textObj.width+10),this.ghostBox.alpha=this.ghostBox?.popup?1:.4,this.ghostBox.selection.alpha=this.ghostBox?.popup?1:0,this.ghostBox.name=s;const n=this.renderer.getYPosFromBeat(this.ghostBox?.popup?this.ghostBox.event.beat:r);let a=this.tracks.getChildByName(s).x;a+=vr[s]/2*(a>0?1:-1),this.ghostBox.position.x=a,this.ghostBox.backgroundObj.tint=Tr[s]??0,this.ghostBox.backgroundObj.position.x=-this.ghostBox.backgroundObj.width/2,this.ghostBox.backgroundObj.position.y=-25/2,this.ghostBox.guideLine.anchor.x=a<0?0:1,this.ghostBox.guideLine.width=Math.abs(this.ghostBox.position.x)+192-this.ghostBox.backgroundObj.width/2,this.ghostBox.guideLine.position.x=(a<0?1:-1)*this.ghostBox.backgroundObj.width/2,this.ghostBox.y=n,this.ghostBox.selection.position=this.ghostBox.backgroundObj.position,this.ghostBox.textObj.scale.y=A.chart.reverse?-1:1}placeGhostEvent(){if(!this.ghostBox)return;const e=this.renderer.chart.timingData.getTimingEventAtBeat(this.ghostBox.event.type,this.ghostBox.event.beat);this.ghostBox.event.type=="ATTACKS"&&this.ghostBox.event.second==e?.second||this.ghostBox.event.type!="ATTACKS"&&this.ghostBox.event.beat==e?.beat||(this.renderer.chartManager.clearSelections(),this.ghostBox.songTiming=this.renderer.chart.timingData.isTypeChartSpecific(this.ghostBox.event.type),new wi(this.ghostBox,this.renderer.chart.timingData,!0),this.ghostBox.popup?.select(),this.ghostBox.popup.onConfirm=t=>{this.renderer.chart.timingData.insert(this.ghostBox.songTiming,t.type,t,t.beat)})}getClosestTrack(e){let t=Number.MAX_SAFE_INTEGER,r=this.tracks.children[0];for(const s of this.tracks.children){const n=Math.abs(s.x+(.5-s.anchor.x)*s.width-e);nr.width))return r}getLabelFromEvent(e){let t="";switch(e.type){case"BPMS":case"STOPS":case"WARPS":case"DELAYS":case"TICKCOUNTS":case"FAKES":case"SCROLLS":t=de(e.value,3).toString();break;case"SPEEDS":t=`${de(e.value,3)}/${de(e.delay,3)}/${e.unit}`;break;case"LABELS":t=e.value;break;case"TIMESIGNATURES":t=`${de(e.upper,3)}/${de(e.lower,3)}`;break;case"COMBOS":t=`${de(e.hitMult,3)}/${de(e.missMult,3)}`;break;case"BGCHANGES":case"FGCHANGES":t=e.file;break;case"ATTACKS":t=`${e.mods}`}return t}}class U1 extends xe{children=[];renderer;timingBoxMap=new Map;trackPosCache=new Map;timingBoxPool=new as({create:()=>{const e=new xe;return e.guideLine=new Pe(ie.WHITE),e.textObj=new Fe("",zh),e.backgroundObj=new Nt,e.addChild(e.guideLine,e.backgroundObj,e.textObj),e}});constructor(e){super(),this.renderer=e,this.timingBoxPool.sortableChildren=!0,this.addChild(this.timingBoxPool)}update(e,t){if(!this.renderer.chartManager.eventSelection.shift){this.timingBoxPool.destroyAll(),this.timingBoxMap.clear(),this.trackPosCache.clear();return}const r=this.renderer.chartManager.eventSelection.shift.beatShift;for(const s of this.renderer.chartManager.eventSelection.timingEvents)if(!(ts.beat+r)&&!this.timingBoxMap.has(s)){const n=this.timingBoxPool.createChild();if(!n)continue;this.timingBoxMap.set(s,n);let a="";switch(s.type){case"BPMS":case"STOPS":case"WARPS":case"DELAYS":case"TICKCOUNTS":case"FAKES":case"SCROLLS":a=de(s.value,3).toString();break;case"SPEEDS":a=`${de(s.value,3)}/${de(s.delay,3)}/${s.unit}`;break;case"LABELS":a=s.value;break;case"TIMESIGNATURES":a=`${de(s.upper,3)}/${de(s.lower,3)}`;break;case"COMBOS":a=`${de(s.hitMult,3)}/${de(s.missMult,3)}`;break;case"BGCHANGES":case"FGCHANGES":a=s.file;break;case"ATTACKS":a=`${s.mods} (${s.endType}=${s.value})`}const o=A.chart.timingEventOrder.right.includes(s.type)?"right":"left";if(Object.assign(n,{alpha:.4,songTiming:this.renderer.chart.timingData.isTypeChartSpecific(s.type),zIndex:s.beat}),n.textObj.text=a,n.textObj.anchor.set(.5,.55),n.backgroundObj.width=n.textObj.width+10,n.backgroundObj.height=25,n.backgroundObj.tint=Tr[s.type]??0,n.backgroundObj.position.x=-n.backgroundObj.width/2,n.backgroundObj.position.y=-n.backgroundObj.height/2,n.guideLine.height=1,n.guideLine.anchor.set(o=="left"?0:1,.5),n.guideLine.width=Math.abs(n.position.x)+192-n.backgroundObj.width/2,n.guideLine.position.x=(o=="left"?1:-1)*n.backgroundObj.width/2,this.renderer.chartManager.editTimingMode!=He.Off){let l=this.getTrackPos(s.type);l+=vr[s.type]/2*(l>0?1:-1),n.position.x=l,n.pivot.x=0}else{let l=(o=="right"?1:-1)*(this.renderer.chart.gameType.notefieldWidth*.5+80);o=="left"&&(l-=30),n.position.x=l,n.pivot.x=o=="right"?-n.backgroundObj.width/2:n.backgroundObj.width/2}}for(const[s,n]of this.timingBoxMap.entries()){if(ts.beat+r){this.timingBoxPool.destroyChild(n),this.timingBoxMap.delete(s);continue}n.textObj.scale.y=A.chart.reverse?-1:1,n.y=A.chart.CMod&&s.second?this.renderer.getYPosFromSecond(s.second):this.renderer.getYPosFromBeat(s.beat+r)}}getTrackPos(e){if(this.trackPosCache.has(e))return this.trackPosCache.get(e);const t=A.chart.timingEventOrder.left,r=A.chart.timingEventOrder.right;let s=-this.renderer.chart.gameType.notefieldWidth*.5-128;for(let n=t.length-1;n>=0;n--){const a=t[n];this.trackPosCache.set(a,s),s-=vr[a]}s=this.renderer.chart.gameType.notefieldWidth*.5+128;for(let n=0;nthis.renderer.getVisualBeat()),this.trackVariable(()=>this.renderer.getVisualTime()),this.trackVariable(()=>this.getSpeed(),s=>{this.speed=s,clearTimeout(this.lastSpeedTimeout),this.lastSpeedTimeout=setTimeout(()=>{this.blockCache.clear(),this.lastSpeed=this.speed,this.drawDirty=!0},200)}),this.trackVariable(()=>A.chart.zoom),this.trackVariable(()=>A.chart.CMod),this.trackVariable(()=>A.chart.doSpeedChanges),this.trackVariable(()=>A.chart.waveform.antialiasing,s=>{this.filters=s?[new bh]:[]}),this.trackVariable(()=>this.renderer.chartManager.app.renderer.screen.height,()=>this.resizeWaveform()),this.trackVariable(()=>A.chart.waveform.opacity,s=>{this.white.alpha=s,this.renderer.chartManager.app.renderer.render(this.white,{renderTexture:this.lineTex})}),this.trackVariable(()=>A.chart.waveform.lineHeight,()=>{A.chart.waveform.lineHeight<=0&&(A.chart.waveform.lineHeight=1),this.updateLineHeight()}),this.anchor.set(.5),this.renderer.chartManager.chartAudio.onUpdate(()=>this.getData()),this.getData(),this.resizeWaveform(),this.filters=A.chart.waveform.antialiasing?[new bh]:[];const t=()=>this.drawDirty=!0,r=()=>{this.getData(),this.resizeWaveform(),this.renderer.chartManager.chartAudio.onUpdate(()=>this.getData())};re.on("timingModified",t),this.on("destroyed",()=>{re.off("timingModified",t)}),re.on("audioLoaded",r),this.on("destroyed",()=>{re.off("audioLoaded",r)})}getData(){this.rawData=this.renderer.chartManager.chartAudio.getRawData(),this.filteredRawData=this.renderer.chartManager.chartAudio.getFilteredRawData(),this.sampleRate=this.renderer.chartManager.chartAudio.getSampleRate(),this.blockCache.clear(),this.drawDirty=!0}resizeWaveform(){this.waveformTex.resize(at((this.rawData?.length??0)*288*A.chart.zoom,1,this.renderer.chartManager.app.renderer.screen.width),this.renderer.chartManager.app.renderer.screen.height)}update(){this.visible=A.chart.waveform.enabled&&(this.renderer.chartManager.getMode()!=Z.Play||!A.play.hideBarlines),A.chart.waveform.enabled&&((this.drawDirty||this.variableChanged())&&(this.drawDirty=!1,this.renderData(),this.renderer.chartManager.app.renderer.render(this.lineContainer,{renderTexture:this.waveformTex}),this.tint=A.chart.waveform.color),this.scale.set(1/A.chart.zoom))}trackVariable(e,t){this.trackedVariables.set(e,{value:e(),cb:t})}variableChanged(){let e=!1;for(const[t,r]of this.trackedVariables.entries())t()!=r.value&&(this.trackedVariables.get(t).value=t(),this.trackedVariables.get(t).cb?.(t()),e=!0);return e}getSample(e,t,r){if(t<0)return 0;const s=this.sampleRate/(this.lastSpeed*4),n=Math.floor(t*this.lastSpeed*4);if(this.blockCache.get(r)?.[n]!==void 0)return this.blockCache.get(r)[n];const a=Math.floor(n*s),o=e.slice(a,Math.floor(a+s)).reduce((l,c)=>l+Math.abs(c),0)/s;return this.blockCache.has(r)||this.blockCache.set(r,[]),this.blockCache.get(r)[n]=o,o}renderData(){if(this.resetPool(),A.chart.waveform.speedChanges&&!A.chart.CMod&&A.chart.doSpeedChanges){const e=A.chart.speed,t=this.renderer.chart.timingData.getSpeedMult(this.renderer.getVisualBeat(),this.renderer.getVisualTime()),r=this.renderer.getVisualBeat()+A.chart.maxDrawBeats,s=this.renderer.chart.timingData.getTimingData("SCROLLS"),n=this.renderer.chart.timingData.getTimingData("OFFSET"),a=this.renderer.chart.timingData.getBPM(0),o=this.renderer.chart.timingData.getBeatTiming(),l=100/e/t/64/A.chart.zoom,c=this.renderer.chartManager.app.renderer.screen.height;let u=!1,h=Mi(s,this.renderer.getVisualBeat()-A.chart.maxDrawBeatsBack,m=>m.beat),d=s[h]?.beat??0;d==0&&(d=-A.chart.maxDrawBeatsBack);let f=this.renderer.chart.getSecondsFromBeat(d),p=Math.round(this.renderer.getYPosFromBeat(d)*A.chart.zoom+this.parent.y);for(;dc||m.value>0&&y<0)){h++,d=s[h].beat,p=Math.round(y);continue}const b=l/Math.abs(m.value);for(;dc){if(m.value>0){u=!0;break}d+=b*(p-c),p=c;continue}d+=b*A.chart.waveform.lineHeight,p+=(m.value>0?1:-1)*A.chart.waveform.lineHeight;const _=Math.floor(d*1e3)/1e3;if(d<=0)f=-n+d*60/a;else if(_>=o[1]?.beat){for(;_>=o[1]?.beat;)o.shift();f=this.renderer.chart.getSecondsFromBeat(d)}else{let E=(d-o[0].beat)*60/o[0].bpm;o[0].warped&&(E=0),f=Math.max(o[0].secondClamp,o[0].secondAfter+E)}if(!(f<0))for(let v=0;v=s[1]?.beat){for(;l>=s[1]?.beat;)s.shift();a=this.renderer.chart.getSecondsFromBeat(e)}else{let u=(e-s[0].beat)*60/s[0].bpm;s[0].warped&&(u=0),a=Math.max(s[0].secondClamp,s[0].secondAfter+u)}for(let c=0;ct>=this.poolSearch)}updateLineHeight(){for(const e of this.lineContainer.children){const t=e;t.height=A.chart.waveform.lineHeight}}getLine(){for(;this.lineContainer.children[this.poolSearch];){const t=this.lineContainer.children[this.poolSearch];return t.visible=!0,this.poolSearch++,t}const e=new Pe(this.lineTex);return e.height=A.chart.waveform.lineHeight,e.anchor.set(.5),e.visible=!0,this.poolSearch++,this.lineContainer.addChild(e),e}getSpeed(){return Math.min(A.chart.speed,H1)}}class W1 extends xe{chartManager;chart;speedMult=1;lastMousePos;lastMouseBeat=-1;lastMouseCol=-1;lastNoteType=null;editingCol=-1;waveform;barlines;timingAreas;timingTracks;selectedEvents;timingBar;notefield;snapDisplay;judgment;combo;selectionBoundary;selectionArea;previewArea;selectionBounds;constructor(e){super(),this.chartManager=e,this.chart=e.loadedChart,this.waveform=new G1(this),this.barlines=new k1(this),this.timingAreas=new f1(this),this.timingTracks=new N1(this),this.selectedEvents=new U1(this),this.timingBar=new R1(this),this.notefield=new this.chart.gameType.notefield(this),this.snapDisplay=new c1(this),this.previewArea=new L1(this),this.selectionArea=new O1(this),this.judgment=new D1,this.combo=new I1(this),this.selectionBoundary=new F1(this),this.addChild(this.waveform,this.barlines,this.timingAreas,this.previewArea,this.selectionArea,this.timingTracks,this.selectedEvents,this.timingBar,this.combo,this.notefield,this.snapDisplay,this.judgment,this.selectionBoundary),this.chartManager.app.stage.addChild(this),this.x=this.chartManager.app.renderer.screen.width/2,this.y=this.chartManager.app.renderer.screen.height/2,this.eventMode="static",this.hitArea=new Ie(-1e5,-1e5,2e5,2e5);const t=n=>{if(this.editingCol!=-1){const a=A.chart.snap==0?.020833333333333332:A.chart.snap,o=Math.round(this.getBeatFromYPos(this.lastMousePos.y)/a)*a;this.chartManager.editHoldBeat(this.editingCol,o,n.shiftKey)}};let r=0;const s=()=>{if(!this.chartManager.selection.shift&&!this.selectionBounds||r==0)return;const n=this.getYPosFromBeat(Math.max(0,this.chartManager.getBeat()+r));this.chartManager.setBeat(Math.max(0,this.chartManager.getBeat()+r)),this.selectionBounds&&(this.selectionBounds.start.y+=A.chart.receptorYPos/A.chart.zoom-n)};this.chartManager.app.ticker.add(s),window.addEventListener("keydown",t),this.on("destroyed",()=>{window.removeEventListener("keydown",t),this.removeAllListeners(),this.chartManager.app.ticker.remove(s)}),this.on("pointerdown",n=>{Oh(n)||this.chartManager.getMode()!=Z.Play&&(this.chartManager.editTimingMode==He.Add&&this.lastMousePos?this.timingTracks.placeGhostEvent():this.chartManager.editTimingMode==He.Off&&A.chart.mousePlacement&&this.lastMouseBeat!=-1&&this.lastMouseCol!=-1&&!n.getModifierState("Shift")?(this.chartManager.clearSelections(),this.editingCol=this.lastMouseCol,this.chartManager.setNote(this.lastMouseCol,"mouse",this.lastMouseBeat)):(!n.getModifierState("Control")&&!n.getModifierState("Meta")&&!n.getModifierState("Shift")&&this.chartManager.clearSelections(),this.chartManager[this.chartManager.editTimingMode==He.Off?"startDragSelection":"startDragEventSelection"](),this.selectionBounds={start:this.toLocal(n.global),end:this.toLocal(n.global)}))}),this.on("mousemove",n=>{if(this.lastMousePos=this.toLocal(n.global),this.editingCol!=-1){const a=A.chart.snap==0?.020833333333333332:A.chart.snap,o=Math.round(this.getBeatFromYPos(this.lastMousePos.y)/a)*a;this.chartManager.editHoldBeat(this.editingCol,o,n.shiftKey)}this.selectionBounds&&(this.selectionBounds.end=this.toLocal(n.global)),r=Math.max(0,this.lastMousePos.y-this.getLowerBound()+100)/600,this.lastMousePos.y<0&&(r=Math.min(0,this.lastMousePos.y-this.getUpperBound()-100)/600)}),this.on("pointerup",()=>{this.editingCol!=-1&&(this.chartManager.endEditing(this.editingCol),this.editingCol=-1),this.chartManager[this.chartManager.editTimingMode==He.Off?"endDragSelection":"endDragEventSelection"](),this.selectionBounds=void 0,r=0})}isDragSelecting(){return!!this.selectionBounds}doJudgment(e,t,r){this.chartManager.getMode()==Z.Play&&(this.judgment.doJudge(t,r),this.timingBar.addBar(t,r)),this.notefield.doJudge(e.col,r)}activateHold(e){this.notefield.activateHold(e)}keyDown(e){this.notefield.keyDown(e)}keyUp(e){this.notefield.keyUp(e)}endPlay(){this.notefield.endPlay(),this.timingBar.reset(),this.judgment.reset()}update(){const e=this.getVisualBeat(),t=this.getVisualTime();this.speedMult=A.chart.doSpeedChanges?this.chart.timingData.getSpeedMult(e,t):1;const r=this.getUpperBoundBeat(),s=this.getLowerBoundBeat();if(this.scale.x=A.chart.zoom,this.scale.y=(A.chart.reverse?-1:1)*A.chart.zoom,this.children.forEach(n=>n.update(r,s)),this.notefield.alpha=this.chartManager.editTimingMode==He.Off||this.chartManager.getMode()==Z.Play?1:.3,A.chart.mousePlacement&&this.lastMousePos&&this.chartManager.getMode()!=Z.Play){const n=A.chart.snap==0?.020833333333333332:A.chart.snap,a=Math.round(this.getBeatFromYPos(this.lastMousePos.y)/n)*n,o=Math.round((this.lastMousePos.x+96)/64);(a!=this.lastMouseBeat||o!=this.lastMouseCol||this.chartManager.getEditingNoteType()!=this.lastNoteType)&&(this.lastMouseBeat=a,this.lastMouseCol=o,this.lastNoteType=this.chartManager.getEditingNoteType(),this.editingCol!=-1&&this.chartManager.editHoldBeat(this.editingCol,a,!1),o>3||o<0?(this.lastMouseBeat=-1,this.lastMouseCol=-1,this.notefield.setGhostNote()):this.notefield.setGhostNote({beat:a,col:this.lastMouseCol,type:this.chartManager.getEditingNoteType()}))}this.lastMousePos&&this.chartManager.editTimingMode==He.Add&&this.timingTracks.updateGhostEvent(this.lastMousePos)}getTimeWithOffset(){let e=this.chartManager.getTime();return(this.chartManager.getMode()==Z.Play||this.chartManager.getMode()==Z.Record)&&(e+=A.play.offset),e}getBeatWithOffset(){let e=this.chartManager.getBeat();return(this.chartManager.getMode()==Z.Play||this.chartManager.getMode()==Z.Record)&&(e=this.chart.getBeatFromSeconds(this.getTimeWithOffset())),e}getVisualTime(){let e=this.chartManager.getTime();return(this.chartManager.getMode()==Z.Play||this.chartManager.getMode()==Z.Record)&&(e+=A.play.offset+A.play.visualOffset),e}getVisualBeat(){let e=this.chartManager.getBeat();return(this.chartManager.getMode()==Z.Play||this.chartManager.getMode()==Z.Record)&&(e=this.chart.getBeatFromSeconds(this.getVisualTime())),e}getYPosFromBeat(e){const t=this.getVisualTime(),r=this.getVisualBeat();return A.chart.CMod?(this.chart.getSecondsFromBeat(e)-t)*this.getSecondsToPixelsRatio()+this.getActualReceptorYPos():r==e?this.getActualReceptorYPos():(A.chart.doSpeedChanges?this.chart.timingData.getEffectiveBeat(e)-this.chart.timingData.getEffectiveBeat(r):e-r)*this.getEffectiveBeatsToPixelsRatio()+this.getActualReceptorYPos()}getYPosFromSecond(e){const t=this.getVisualTime();return A.chart.CMod?(e-t)*this.getSecondsToPixelsRatio()+this.getActualReceptorYPos():this.getYPosFromBeat(this.chart.timingData.getBeatFromSeconds(e))}getSecondFromYPos(e){if(A.chart.CMod){const t=this.getPixelsToSecondsRatio(),r=this.getVisualTime(),n=(e-A.chart.receptorYPos/A.chart.zoom)*t;return r+n}return this.chart.getSecondsFromBeat(this.getBeatFromYPos(e))}getBeatFromYPos(e,t){const r=this.getVisualBeat();if(A.chart.CMod)return this.chart.getBeatFromSeconds(this.getSecondFromYPos(e));const n=(e-this.getActualReceptorYPos())*this.getPixelsToEffectiveBeatsRatio();if(A.chart.doSpeedChanges&&!t){const a=this.chart.timingData.getEffectiveBeat(r)+n;return this.chart.getBeatFromEffectiveBeat(a)}return r+n}getActualReceptorYPos(){return A.chart.receptorYPos/A.chart.zoom}getEffectiveBeatsToPixelsRatio(){return A.chart.speed/100*64*this.speedMult}getPixelsToEffectiveBeatsRatio(){return 1/this.getEffectiveBeatsToPixelsRatio()}getSecondsToPixelsRatio(){return A.chart.speed/100*64*4}getPixelsToSecondsRatio(){return 1/this.getSecondsToPixelsRatio()}isNegScroll(e){return A.chart.doSpeedChanges&&(this.speedMult<0||(this.chart.timingData.getTimingEventAtBeat("SCROLLS",e)?.value??1)<0||this.chart.timingData.getBPM(e)<0)}getLowerBound(){return(this.chartManager.app.renderer.screen.height-this.y)/A.chart.zoom+32}getUpperBoundBeat(){if(A.chart.waveform.speedChanges&&!A.chart.CMod&&A.chart.doSpeedChanges){const e=A.chart.speed,t=this.chart.timingData.getSpeedMult(this.getVisualBeat(),this.getVisualTime()),r=this.chart.timingData.getTimingData("SCROLLS"),s=100/e/t/64/A.chart.zoom,n=this.getUpperBound(),a=this.getLowerBound();let o=Mi(r,this.getVisualBeat()-A.chart.maxDrawBeatsBack,d=>d.beat);for(;r[o]?.beat0&&m>n&&(fa||!r[o-1]||r[o-1].beat0?Math.max(this.getVisualBeat()-A.chart.maxDrawBeatsBack,l+h*(n-c)):Math.max(this.getVisualBeat()-A.chart.maxDrawBeatsBack,l+h*(c-a))}return A.chart.CMod?this.getBeatFromYPos(this.getUpperBound()):Math.max(this.getVisualBeat()-A.chart.maxDrawBeatsBack,this.getBeatFromYPos(this.getUpperBound()))}getLowerBoundBeat(){if(A.chart.waveform.speedChanges&&!A.chart.CMod&&A.chart.doSpeedChanges){const e=A.chart.speed,t=this.chart.timingData.getSpeedMult(this.getVisualBeat(),this.getVisualTime()),r=this.chart.timingData.getTimingData("SCROLLS"),s=100/e/t/64/A.chart.zoom,n=this.getUpperBound(),a=this.getLowerBound();let o=Mi(r,this.getVisualBeat()+A.chart.maxDrawBeats,d=>d.beat);for(;r[o]?.beat>this.getVisualBeat()-A.chart.maxDrawBeatsBack;){const d=r[o],f=this.getYPosFromBeat(d.beat)*A.chart.zoom,p=r[o+1]?.beat??this.getVisualBeat()+A.chart.maxDrawBeats,m=this.getYPosFromBeat(p)*A.chart.zoom;if(d.value>0&&fa||!r[o+1]||r[o+1].beat>this.getVisualBeat()+A.chart.maxDrawBeatsBack)||d.value<0&&f>n&&(mthis.getVisualBeat()+A.chart.maxDrawBeatsBack))break;o--}const l=r[o]?.beat??0,c=this.getYPosFromBeat(l)*A.chart.zoom,u=r[o]?.value??1,h=s/Math.abs(u);return u>0?Math.min(this.getVisualBeat()+A.chart.maxDrawBeats,l+h*(a-c)):Math.min(this.getVisualBeat()+A.chart.maxDrawBeats,l+h*(c-n))}return A.chart.CMod?this.getBeatFromYPos(this.getLowerBound()):Math.min(this.getVisualBeat()+A.chart.maxDrawBeats,this.getBeatFromYPos(this.getLowerBound()))}getUpperBound(){return-32-this.y/A.chart.zoom}selectionTest(e){if(!this.selectionBounds)return!1;const t=this.selectionBoundary.getBounds(),r=e.getBounds(),s=16*A.chart.zoom;return t.x+t.width>r.x+s&&t.xr.y+s&&t.y{const u=o,h=this.toLocal(c.global);if(Math.abs(h.y-a-n)**2+Math.abs(h.x-s)**2<32*32){this.chartManager.selection.shift&&(this.chartManager.selection.shift={columnShift:0,beatShift:0});return}const d=this.getBeatFromYPos(h.y-a),f=A.chart.snap==0?1/48:A.chart.snap;let p=Math.round(d/f)*f;Math.abs(p-d)>Math.abs(d-u.beat)&&(p=u.beat);const m=Math.round((h.x+96)/64);this.chartManager.selection.shift||={columnShift:0,beatShift:0},r!=m-u.col&&(r=m-u.col,this.chartManager.selection.notes.every(g=>{const y=g.col+r;return y>=0&&yg.beat)),p-u.beat)};e.on("pointerdown",c=>{if(Oh(c)){this.chartManager.selection.notes.includes(t)||(this.chartManager.clearSelections(),this.chartManager.addNoteToSelection(t)),Wh.open(this.chartManager.app,c),c.preventDefault();return}if(A.chart.mousePlacement&&!c.getModifierState("Meta")&&!c.getModifierState("Control")&&!c.getModifierState("Shift")&&!this.chartManager.selection.notes.includes(t))return;c.stopImmediatePropagation(),this.chartManager.selection.notes.includes(t)?(c.getModifierState("Control")||c.getModifierState("Meta"))&&this.chartManager.removeNoteFromSelection(t):(!c.getModifierState("Control")&&!c.getModifierState("Meta")&&!c.getModifierState("Shift")&&this.chartManager.clearSelections(),this.chartManager.addNoteToSelection(t)),s=e.x,n=e.y,a=this.toLocal(c.global).y-e.y,o=t,this.on("pointermove",l);const u=()=>{this.off("pointermove",l),this.off("pointerup",u),e.visible=!0,((this.chartManager.selection.shift?.beatShift??0)!=0||(this.chartManager.selection.shift?.columnShift??0)!=0)&&this.chartManager.modifySelection(h=>(h.beat+=this.chartManager.selection.shift.beatShift,h.col+=this.chartManager.selection.shift.columnShift,h)),this.chartManager.selection.shift=void 0};this.on("pointerup",u)}),e.on("destroyed",()=>{e?.removeAllListeners()})}getNotefield(){return this.notefield}getSelectionBounds(){return this.selectionBounds}}class Dc extends AudioBufferSourceNode{started=!1;start(e,t,r){this.started||super.start(e,t,r),this.started=!0}stop(e){this.started&&super.stop(e),this.started=!1}static create(e){const t=e;return t.started=!1,Object.setPrototypeOf(t,Dc.prototype),t}}class Ha{_audioContext=new AudioContext;_audioAnalyzer;_filteredAudioAnalyzer;_freqData;_filteredFreqData;_gainNode;_source;_playbackTime=0;_startTimestamp=0;_rate=1;_isPlaying=!1;_buffer;_filteredBuffer;_loadedBuffer;_delay;_listeners=[];_volume=1;_destroyed=!1;_renderTimeout;_filters=[this.createFilter({type:"highpass",frequency:20,Q:.71}),this.createFilter({type:"lowshelf",frequency:75,gain:0}),this.createFilter({type:"peaking",frequency:100,gain:0,Q:.6}),this.createFilter({type:"peaking",frequency:250,gain:0,Q:.3}),this.createFilter({type:"peaking",frequency:1040,gain:0,Q:.41}),this.createFilter({type:"peaking",frequency:2500,gain:0,Q:.2}),this.createFilter({type:"highshelf",frequency:7500,gain:0}),this.createFilter({type:"lowpass",frequency:2e4,Q:.71})];loaded;constructor(e){this._filters[0].gain.value=-25,this._audioAnalyzer=this._audioContext.createAnalyser(),this._audioAnalyzer.fftSize=8192,this._audioAnalyzer.maxDecibels=0,this._freqData=new Uint8Array(this._audioAnalyzer.frequencyBinCount),this._filteredAudioAnalyzer=this._audioContext.createAnalyser(),this._filteredAudioAnalyzer.fftSize=8192,this._filteredAudioAnalyzer.maxDecibels=0,this._filteredFreqData=new Uint8Array(this._filteredAudioAnalyzer.frequencyBinCount),this._gainNode=this._audioContext.createGain(),this._buffer=this._audioContext.createBuffer(2,1,44100),this._filteredBuffer=this._audioContext.createBuffer(2,1,44100),this._loadedBuffer=this._audioContext.createBuffer(2,1,44100),this.initSource(),this.loaded=new Promise(t=>{this.decodeData(e).then(r=>{if(r)return this._loadedBuffer=r,r}).then(async r=>(await this.renderBuffer(r),await this.renderFilteredBuffer(r),r)).catch(r=>{r.name=="EncodingError"?Oe.createFormatted("Failed to load audio: file format not supported","error"):Oe.createFormatted("Failed to load audio: "+r.message,"error")}).finally(()=>{this.initSource(),this.callListeners(),t()})})}async renderBuffer(e){if(!e)return;const t=new OfflineAudioContext(e.numberOfChannels,e.length,e.sampleRate),r=t.createBufferSource();return r.buffer=e,r.connect(t.destination),r.start(),await t.startRendering().then(s=>{this._buffer=s}).catch(()=>{Oe.createFormatted("Failed to load audio: audio rendering failed","error")})}async renderFilteredBuffer(e){if(!e)return;const t=new OfflineAudioContext(e.numberOfChannels,e.length,e.sampleRate),r=t.createBufferSource();r.buffer=e;let s=r;for(const n of this._filters){const a=t.createBiquadFilter();a.type=n.type,a.Q.setValueAtTime(n.Q.value,0),a.frequency.setValueAtTime(n.frequency.value,0),a.gain.setValueAtTime(n.gain.value,0),s.connect(a),s=a}return s.connect(t.destination),r.start(),await t.startRendering().then(n=>{this._filteredBuffer=n}).catch(()=>{Oe.createFormatted("Failed to load audio: audio rendering failed","error")})}createFilter(e){const t=this._audioContext.createBiquadFilter();return t.type=e.type,e.Q!==void 0&&(t.Q.value=e.Q),e.gain!==void 0&&(t.gain.value=e.gain),e.frequency!==void 0&&(t.frequency.value=e.frequency),t}getFilters(){return this._filters}getFilter(e){return this._filters[e]}updateFilter(e,t){this._filters[e]&&(t.Q!==void 0&&(this._filters[e].Q.value=t.Q),t.frequency!==void 0&&(this._filters[e].frequency.value=t.frequency),t.gain!==void 0&&(this._filters[e].gain.value=t.gain),clearTimeout(this._renderTimeout),this._renderTimeout=setTimeout(()=>this.renderFilteredBuffer(this._loadedBuffer).then(()=>this.callListeners()),500))}onUpdate(e){this._listeners.push(e)}getSongLength(){return this._buffer.length/this._buffer.sampleRate}getFrequencyData(){return this._destroyed?new Uint8Array:(this._audioAnalyzer.getByteFrequencyData(this._freqData),this._freqData)}getFilteredFrequencyData(){return this._destroyed?new Uint8Array:(this._filteredAudioAnalyzer.getByteFrequencyData(this._filteredFreqData),this._filteredFreqData)}getSampleRate(){return this._buffer.sampleRate}getFFTSize(){return this._audioAnalyzer.fftSize}getRawData(){if(this._destroyed)return[];const e=[];for(let t=0;t{const s=new Float32Array(e.length);return r.getFrequencyResponse(t,s,new Float32Array(e.length)),[...s]}).reduce((r,s)=>r.map((n,a)=>n*s[a]))}callListeners(){this._listeners.forEach(e=>e())}async decodeData(e){return new Promise((t,r)=>{if(!e){t();return}this._audioContext.decodeAudioData(e).then(s=>t(s)).catch(s=>r(s))})}initSource(){this._source?.stop(),this._source=Dc.create(this._audioContext.createBufferSource()),this._source.buffer=this._buffer,this._source.connect(this._audioAnalyzer);let e=this._audioAnalyzer;for(const t of this._filters)e.connect(t),e=t;e.connect(this._filteredAudioAnalyzer),this._filteredAudioAnalyzer.connect(this._gainNode),this._gainNode.connect(this._audioContext.destination),this._source.playbackRate.value=this._rate,this._isPlaying&&(this.pause(),this.play())}volume(e){this._destroyed||this._volume!=e&&(this._volume=e,this._gainNode.gain.setValueAtTime(e,this._audioContext.currentTime))}rate(e){this._destroyed||this._rate!=e&&(this._rate=e,this._source&&(this._isPlaying&&(this._playbackTime+=(this._audioContext.currentTime-this._startTimestamp)*this._source.playbackRate.value),this._startTimestamp=this._audioContext.currentTime,this._source.playbackRate.value=e))}play(){this._destroyed||this._source&&(this._isPlaying||(this.initSource(),this._playbackTime<=this._filteredBuffer.duration&&(this._playbackTime<0?(clearTimeout(this._delay),this._delay=setInterval(()=>{this.seek()>0&&(clearInterval(this._delay),this._source?.start(0,0))})):this._source.start(0,this._playbackTime)),this._startTimestamp=this._audioContext.currentTime,this._isPlaying=!0))}seek(e){if(!this._destroyed&&this._source){if(e===void 0)return this._isPlaying?(this._audioContext.currentTime-this._startTimestamp)*this._source.playbackRate.value+this._playbackTime:this._playbackTime;this._isPlaying?(this.stop(),this._playbackTime=e,this.play()):this._playbackTime=e}}pause(){this._destroyed||this.stop(!0)}stop(e){this._destroyed||this._source&&this._isPlaying&&(clearTimeout(this._delay),this._isPlaying=!1,this._playbackTime<=this._buffer.duration&&this._source.stop(),this._playbackTime=e?(this._audioContext.currentTime-this._startTimestamp)*this._source.playbackRate.value+this._playbackTime:0)}}class z1{judgmentCounts=new Map;holdJudgmentCounts=new Map;dancePoints=0;maxCumulativeDancePoints=0;maxDancePoints=0;chartManager;notedata;dataPoints=[];handlers=[];combo=0;missCombo=0;maxCombo=0;bestJudge;constructor(e){this.notedata=e.loadedChart.getNotedata(),this.chartManager=e,this.bestJudge=Je.getCollection(A.play.timingCollection).getStandardWindows()[0],this.calculateMaxDP()}onJudge(e){this.handlers.push(e)}applyOffset(e){this.dataPoints=this.dataPoints.map(t=>ri(t.judgment)||!Gi(t.judgment)?t:{...t,error:t.error+e}),this.recalculate()}addDataPoint(e,t,r){this.judgmentCounts.has(t)||this.judgmentCounts.set(t,0),this.judgmentCounts.set(t,this.judgmentCounts.get(t)+1),this.dancePoints+=t.dancePoints;const s=this.chartManager.loadedChart.timingData.getTimingEventAtBeat("COMBOS",e[0].beat),n=s?.hitMult??1,a=s?.missMult??1;Zr(t)||(this.maxCumulativeDancePoints+=Je.getCollection(A.play.timingCollection).getMaxDancePoints()),ri(t)?(this.maxCumulativeDancePoints+=e.filter(De).reduce((o,l)=>o+Je.getCollection(A.play.timingCollection).getMaxHoldDancePoints(l.type),0),this.combo=0,this.missCombo+=a,this.bestJudge=void 0):Gi(t)&&(Je.getCollection(A.play.timingCollection).shouldHideNote(t)?(this.combo+=e.length*n,this.combo>this.maxCombo&&(this.maxCombo=this.combo),this.missCombo=0,this.bestJudge&&t.getTimingWindowMS()>this.bestJudge.getTimingWindowMS()&&(this.bestJudge=t)):(this.bestJudge=void 0,this.combo=0)),this.handlers.forEach(o=>o(r,t)),this.dataPoints.push({second:e[0].second,error:r,judgment:t,notes:e})}addHoldDataPoint(e,t){this.judgmentCounts.has(t)||this.judgmentCounts.set(t,0),this.judgmentCounts.set(t,this.judgmentCounts.get(t)+1);const r=Je.getCollection(A.play.timingCollection).getHeldJudgement(e);this.holdJudgmentCounts.has(r)||this.holdJudgmentCounts.set(r,[0,0]);const s=this.holdJudgmentCounts.get(r);Er(t)?s[0]++:s[1]++,this.holdJudgmentCounts.set(r,s),this.dancePoints+=t.dancePoints,this.maxCumulativeDancePoints+=Je.getCollection(A.play.timingCollection).getMaxHoldDancePoints(e.type),this.handlers.forEach(n=>n(0,t)),tn(t)&&(this.bestJudge=void 0)}getScore(){return this.maxDancePoints==0?0:this.dancePoints/this.maxDancePoints}getCumulativeScore(){return this.maxCumulativeDancePoints==0?0:this.dancePoints/this.maxCumulativeDancePoints}getDataPoints(){return this.dataPoints}getMedian(){return zo(this.dataPoints.filter(e=>!ri(e.judgment)&&Gi(e.judgment)).map(e=>e.error))}getMaxCombo(){return this.maxCombo}recalculate(){this.calculateMaxDP(),this.dancePoints=0,this.maxCumulativeDancePoints=0;for(const e of this.holdJudgmentCounts.entries()){const t=e[0];this.dancePoints+=e[0].dancePoints*e[1][0],this.maxCumulativeDancePoints+=(e[1][0]+e[1][1])*Je.getCollection(A.play.timingCollection).getMaxHoldDancePoints(t.noteType)}this.judgmentCounts.clear();for(const e of this.dataPoints){let t=Je.getCollection(A.play.timingCollection).judgeInput(e.error);(ri(e.judgment)||Zr(e.judgment))&&(t=e.judgment),this.judgmentCounts.has(t)||this.judgmentCounts.set(t,0),this.judgmentCounts.set(t,this.judgmentCounts.get(t)+1),this.dancePoints+=t.dancePoints,e.judgment=t,Zr(t)||(this.maxCumulativeDancePoints+=Je.getCollection(A.play.timingCollection).getMaxDancePoints()),ri(t)&&(this.maxCumulativeDancePoints+=e.notes.filter(De).reduce((r,s)=>r+Je.getCollection(A.play.timingCollection).getMaxHoldDancePoints(s.type),0))}}calculateMaxDP(){const e=new Map,t=new Map;for(const r of this.notedata)r.type=="Mine"||r.fake||(De(r)&&(t.has(r.type)||t.set(r.type,0),t.set(r.type,t.get(r.type)+1)),e.has(r.beat)||e.set(r.beat,[]),e.get(r.beat).push(r));this.maxDancePoints=e.size*Je.getCollection(A.play.timingCollection).getMaxDancePoints(),this.maxDancePoints+=Array.from(t.entries()).reduce((r,s)=>r+s[1]*Je.getCollection(A.play.timingCollection).getMaxHoldDancePoints(s[0]),0)}getCount(e){return this.judgmentCounts.get(e)??0}getCombo(){return this.combo}getMissCombo(){return this.missCombo}getBestJudge(){return this.bestJudge}}const Qt=[1,2,3,4,6,8,12,16,24,48,-1];var Z=(i=>(i.View="View Mode",i.Edit="Edit Mode",i.Play="Play Mode",i.Record="Record Mode",i))(Z||{}),He=(i=>(i[i.Off=0]="Off",i[i.Edit=1]="Edit",i[i.Add=2]="Add",i))(He||{});class V1{app;chartAudio=new Ha;chartView;widgetManager;assistTick=new Yr.Howl({src:"assets/sound/assist_tick.ogg",volume:.5});me_high=new Yr.Howl({src:"assets/sound/metronome_high.ogg",volume:.5});me_low=new Yr.Howl({src:"assets/sound/metronome_low.ogg",volume:.5});mine=new Yr.Howl({src:"assets/sound/mine.ogg",volume:.5});loadedSM;smPath="";loadedChart;selection={notes:[],inProgressNotes:[]};eventSelection={timingEvents:[],inProgressTimingEvents:[]};editTimingMode=0;beat=0;time=0;holdEditing=[];editNoteTypeIndex=0;partialScroll=0;noteIndex=0;lastMetronomeDivision=-1;lastMetronomeMeasure=-1;lastSong="";mode="Edit Mode";lastMode="Edit Mode";noChartTextA;noChartTextB;virtualClipboard="";startRegion;endRegion;gameStats;constructor(e){this.app=e,document.addEventListener("cut",t=>{if(t.target.classList.contains("inlineEdit")||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLInputElement||this.mode!="Edit Mode")return;const r=this.copy();r&&t.clipboardData?.setData("text/plain",r),this.deleteSelection(),t.preventDefault()},!0),document.addEventListener("copy",t=>{if(t.target.classList.contains("inlineEdit")||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLInputElement||this.mode!="Edit Mode")return;const r=this.copy();r&&t.clipboardData?.setData("text/plain",r),t.preventDefault(),t.stopImmediatePropagation()},!0),document.addEventListener("paste",t=>{if(t.target.classList.contains("inlineEdit")||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLInputElement||this.mode!="Edit Mode")return;const r=t.clipboardData?.getData("text/plain");r&&this.paste(r),t.preventDefault(),t.stopImmediatePropagation()},!0),e.view.addEventListener?.("wheel",t=>{if(!(this.loadedSM==null||this.loadedChart==null||this.chartView==null))if(t.preventDefault(),ts&&t.metaKey||!ts&&t.ctrlKey){const r=t.deltaY/5*A.chart.scroll.scrollSensitivity*(A.chart.scroll.invertZoomScroll?-1:1);A.chart.speed=at(A.chart.speed*Math.pow(1.01,r),10,35e3)}else{if(this.mode=="Play Mode"||this.mode=="Record Mode")return;let r=this.beat;const s=A.chart.snap,n=A.chart.speed*(A.chart.reverse&&A.chart.scroll.invertZoomScroll?-1:1),a=t.deltaY/n*A.chart.scroll.scrollSensitivity;if(s==0?(this.partialScroll=0,r=this.beat+a):A.chart.scroll.scrollSnapEveryScroll?t.deltaY<0?r=Math.round((this.beat-s)/s)*s:r=Math.round((this.beat+s)/s)*s:(this.partialScroll+=a,Math.abs(this.partialScroll)>s&&(this.partialScroll<0?r=Math.round((this.beat+Math.ceil(this.partialScroll/s)*s)/s)*s:r=Math.round((this.beat+Math.floor(this.partialScroll/s)*s)/s)*s,this.partialScroll%=s)),r=Math.max(0,r),r!=this.beat&&this.setBeat(r),!this.holdEditing.every(o=>o==null))for(let o=0;o{this.noChartTextB.tint=8952234}),this.noChartTextB.on("mouseleave",()=>{this.noChartTextB.tint=5596791}),this.noChartTextB.on("mousedown",()=>{this.app.windowManager.openWindow(new wm(e,Ze.getGameType("dance-single")))}),this.noChartTextA.visible=!1,this.noChartTextB.visible=!1,this.noChartTextA.x=this.app.renderer.screen.width/2,this.noChartTextA.y=this.app.renderer.screen.height/2-20,this.noChartTextB.x=this.app.renderer.screen.width/2,this.noChartTextB.y=this.app.renderer.screen.height/2+10,this.app.stage.addChild(this.noChartTextB),this.app.ticker.add(()=>{const t=performance.now();this.widgetManager.update(),this.loadedSM&&this.loadedChart&&this.chartView&&this.chartView.update(),ls.instance?.addDrawUpdateTimeValue(performance.now()-t)}),setInterval(()=>{if(!this.loadedSM||!this.loadedChart||!this.chartView)return;const t=performance.now(),r=this.chartAudio.seek();if(this.chartAudio.isPlaying()&&(this.setTime(r,!0),!this.holdEditing.every(c=>!c)))for(let c=0;c.3&&this.editHoldBeat(c,d,!1)}const s=this.loadedChart.getNotedata();let n=!1;for(;this.noteIndexs[this.noteIndex].second+A.play.effectOffset;)this.mode!="Record Mode"&&this.chartAudio.isPlaying()&&this.loadedChart.gameType.gameLogic.shouldAssistTick(s[this.noteIndex])&&(this.mode!="Play Mode"&&this.chartView.doJudgment(s[this.noteIndex],0,dm),!n&&A.audio.assistTick&&(this.assistTick.play(),n=!0)),this.noteIndex++;const a=this.loadedChart.getBeatFromSeconds(this.time+A.play.effectOffset),o=Math.floor(this.loadedChart.timingData.getDivisionOfMeasure(a)),l=Math.floor(this.loadedChart.timingData.getMeasure(a));(l!=this.lastMetronomeMeasure||o!=this.lastMetronomeDivision)&&(this.lastMetronomeDivision=o,this.lastMetronomeMeasure=l,this.chartAudio.isPlaying()&&A.audio.metronome&&(o==0?this.me_high.play():this.me_low.play())),this.mode=="Play Mode"&&this.loadedChart.gameType.gameLogic.update(this),this.updateSoundProperties(),l1(),ls.instance?.addUpdateTimeValue(performance.now()-t)},5),re.on("resize",()=>{this.chartView&&(this.chartView.x=this.app.renderer.screen.width/2,this.chartView.y=this.app.renderer.screen.height/2),this.noChartTextA.x=this.app.renderer.screen.width/2,this.noChartTextA.y=this.app.renderer.screen.height/2-20,this.noChartTextB.x=this.app.renderer.screen.width/2,this.noChartTextB.y=this.app.renderer.screen.height/2+10}),re.on("chartModified",()=>{this.loadedChart&&(this.loadedChart.recalculateStats(),re.emit("chartModifiedAfter"))}),window.addEventListener("keyup",t=>{if(this.mode=="Edit Mode"&&t.code.startsWith("Digit")){const r=parseInt(t.code.slice(5))-1;this.endEditing(r)}},!0),window.addEventListener("keydown",t=>{const r=tt.getKeyNameFromCode(t.code);if(this.mode=="Edit Mode"&&!t.target.classList.contains("inlineEdit")&&!(t.target instanceof HTMLTextAreaElement)&&!(t.target instanceof HTMLInputElement)){if(t.code.startsWith("Digit")&&!t.repeat&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.ctrlKey){const s=parseInt(t.code.slice(5))-1;s<(this.loadedChart?.gameType.numCols??4)&&s>-1&&(this.setNote(s,"key"),t.preventDefault(),t.stopImmediatePropagation())}if(!this.holdEditing.every(s=>s==null)){const s=["cursorUp","cursorDown","previousNote","nextNote","previousMeasure","nextMeasure","jumpChartStart","jumpChartEnd","jumpSongStart","jumpSongEnd"];for(const n of s)if(ht[n].combos.map(a=>a.key).includes(r)){t.preventDefault(),t.stopImmediatePropagation(),ht[n].callback(this.app);for(let a=0;aa.key).includes(r)){this.holdEditing=[];return}}}},!0),window.addEventListener("keydown",t=>{this.mode!="Play Mode"&&this.mode!="Record Mode"||t.key=="Escape"&&(this.setMode(this.lastMode),this.chartAudio.pause())},!0)}getBeat(){return this.beat}getTime(){return this.time}setBeat(e){this.loadedChart&&(this.beat=e,this.time=this.loadedChart.getSecondsFromBeat(this.beat),this.chartAudio.seek(this.time),this.getAssistTickIndex())}setTime(e,t){this.loadedChart&&(this.time=e,this.beat=this.loadedChart.getBeatFromSeconds(this.time),t||(this.chartAudio.seek(this.time),this.getAssistTickIndex()))}async loadSM(e){if(mt.instance.isDirty()){const s=new Ic(this.app,"Save","Do you wish to save the current file?",[{label:"Cancel",type:"default"},{label:"No",type:"default"},{label:"Yes",type:"confirm"}]);this.app.windowManager.openWindow(s);const n=await s.resolved;if(n=="Cancel")return;n=="Yes"&&this.save()}if(!e){this.smPath="",this.loadedSM=void 0,this.chartAudio.stop(),this.noChartTextA.visible=!1,this.noChartTextB.visible=!1,this.chartView?.destroy({children:!0});return}this.chartAudio.stop(),this.lastSong="",this.smPath=e,this.time=0,this.beat=0;const r=await(await $e.getFileHandle(this.smPath)).getFile();this.loadedSM=new Sm(r),await this.loadedSM.loaded,this.noChartTextA.visible=!0,this.noChartTextB.visible=!0,this.editTimingMode=0,re.emit("smLoaded"),await this.loadChart(),re.emit("smLoadedAfter"),this.time==0&&this.setBeat(0),Bm.addSM(this.smPath,this.loadedSM)}async loadChart(e){if(this.loadedSM!=null){if(e==null){if(this.loadedChart){const t=this.loadedSM.charts[this.loadedChart.gameType.id];t&&t.length>0&&(e=t.at(-1))}if(!e)for(const t of Ze.getPriority()){const r=this.loadedSM.charts[t.id];if(r&&r.length>0){e=r.at(-1);break}}if(!e){this.chartView?.destroy({children:!0}),this.chartView?.removeChildren(),this.beat=0,this.time=0,this.loadedChart=void 0,this.chartView=void 0,this.noChartTextA.visible=!0,this.noChartTextB.visible=!0,re.emit("chartLoaded"),re.emit("chartModified");return}}if(e!=this.loadedChart){if(this.chartView?.destroy({children:!0}),this.chartView?.removeChildren(),this.clearSelections(),this.loadedChart=e,this.beat=this.loadedChart.getBeatFromSeconds(this.time),mt.instance.reset(),A.play.timingCollection=A.play.defaultTimingCollection[e.gameType.id]??"ITG",this.getAssistTickIndex(),this.chartView=new W1(this),this.chartView.x=this.app.renderer.screen.width/2,this.chartView.y=this.app.renderer.screen.height/2,(this.mode=="Play Mode"||this.mode=="Record Mode")&&this.setMode(this.lastMode),this.loadedChart.getMusicPath()!=this.lastSong){this.lastSong=this.loadedChart.getMusicPath();const t=this.chartAudio.isPlaying();await this.loadAudio(),re.emit("audioLoaded"),t&&this.chartAudio.play()}this.noChartTextA.visible=!1,this.noChartTextB.visible=!1,Oe.create("Loaded chart "+e.difficulty+" "+e.meter+" "+e.gameType.id),re.emit("chartLoaded"),re.emit("audioLoaded"),re.emit("chartModified")}}}async loadAudio(){if(!this.loadedSM||!this.loadedChart)return;this.chartAudio.stop(),this.chartAudio?.destroy();const e=this.loadedChart.getMusicPath();if(e==""){Oe.createFormatted("Failed to load audio: no audio file","error"),this.chartAudio=new Ha(void 0);return}const t=await this.getAudioHandle(e);if(t==null){Oe.createFormatted("Failed to load audio: couldn't find audio file "+e,"error"),this.chartAudio=new Ha(void 0);return}const r=await t.getFile();this.chartAudio=new Ha(await r.arrayBuffer()),this.chartAudio.seek(this.time),this.getAssistTickIndex()}async getAudioHandle(e){let t=await $e.getFileHandleRelativeTo(this.smPath,e);if(t)return t;const r=await $e.getDirectoryFiles(Zt(this.smPath));return t=r.filter(s=>s.name.toLowerCase()==pr(e).toLowerCase())[0],t?(Oe.createFormatted("Failed to locate audio file "+e+", using file "+t.name+" instead","warn"),t):(t=r.filter(s=>Oo.includes(Ni(s.name)))[0],t&&Oe.createFormatted("Failed to locate audio file "+e+", using file "+t.name+" instead","warn"),t)}getAudio(){return this.chartAudio}updateSoundProperties(){this.setEffectVolume(A.audio.soundEffectVolume*A.audio.masterVolume),this.setVolume(A.audio.songVolume*A.audio.masterVolume),this.setRate(A.audio.rate)}setRate(e){this.chartAudio.rate(e)}setVolume(e){this.chartAudio.volume(e)}setEffectVolume(e){this.assistTick.volume()!=e&&this.assistTick.volume(e),this.me_high.volume()!=e&&this.me_high.volume(e),this.me_low.volume()!=e&&this.me_low.volume(e),this.mine.volume()!=e&&this.mine.volume(e)}getAssistTickIndex(){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null||this.loadedChart.getNotedata().length==0){this.noteIndex=0;return}this.noteIndex=Mi(this.loadedChart.getNotedata(),this.time,e=>e.second)+1,this.noteIndex>=1&&this.time<=this.loadedChart.getNotedata()[this.noteIndex-1].second&&this.noteIndex--}playPause(){this.chartAudio.isPlaying()?this.chartAudio.pause():this.chartAudio.play()}setAndSnapBeat(e){if(!this.loadedChart)return;const t=Math.max(.001,A.chart.snap),r=this.loadedChart.timingData.getBeatOfMeasure(e),s=e-r,n=Math.round(r/t)*t;let a=s+n;a=Math.max(0,a),this.setBeat(a)}previousSnap(){let e=this.getSnapIndex()-1;e=(e+Qt.length)%Qt.length,A.chart.snap=Qt[e]==-1?0:1/Qt[e],re.emit("snapChanged")}nextSnap(){let e=this.getSnapIndex();(e==Qt.length-1||Math.abs(1/A.chart.snap-Qt[e])<=5e-4)&&e++,e=(e+Qt.length)%Qt.length,A.chart.snap=Qt[e]==-1?0:1/Qt[e],re.emit("snapChanged")}getSnapIndex(){return A.chart.snap==0?Qt.length-1:Qt.findIndex(e=>1/e<=A.chart.snap)}removeDuplicateBeats(e){if(e.length===0)return e;const t=[e[0]];for(let r=1;rs.beat+s.hold);let t=this.loadedChart.getNotedata().map(s=>s.beat).concat(e).sort((s,n)=>s-n);t=this.removeDuplicateBeats(t);let r=Mi(t,this.beat);this.beat==t[r]&&r--,this.setBeat(t[Math.max(0,r)])}nextNote(){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null||this.loadedChart.getNotedata().length==0)return;const e=this.loadedChart.getNotedata().filter(De).map(s=>s.beat+s.hold);let t=this.loadedChart.getNotedata().map(s=>s.beat).concat(e).sort((s,n)=>s-n);t=this.removeDuplicateBeats(t);let r=Mi(t,this.beat);this.beat>=t[r]&&r++,this.setBeat(t[Math.min(t.length-1,r)])}firstNote(){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null)return;const e=this.loadedChart.getNotedata();e.length!=0&&this.setBeat(e[0].beat)}lastNote(){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null)return;const e=this.loadedChart.getNotedata();if(e.length==0)return;const t=e[e.length-1];this.setBeat(t.beat+(De(t)?t.hold:0))}truncateHold(e,t){const r=at(Math.round((t-A.chart.snap)*48)/48,e.beat,e.beat+e.hold-.020833333333333332);return r==e.beat?{beat:e.beat,col:e.col,type:"Tap"}:{beat:e.beat,col:e.col,type:e.type,hold:r-e.beat}}setNote(e,t,r=this.beat){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null)return;r=Math.max(0,Math.round(r*48)/48);const s=this.loadedChart.getNotedata().filter(o=>o.col!=e?!1:Math.abs(o.beat-r)<.003?!0:De(o)&&o.beat==r),n=this.loadedChart.getNotedata().filter(o=>De(o)&&o.col==e&&r>o.beat&&r<=o.beat+o.hold).map(o=>({oldNote:o,newNote:this.truncateHold(o,r)})),a={startBeat:r,endBeat:r,roll:!1,originalNote:void 0,type:t,removedNotes:s,truncatedHolds:n};this.holdEditing[e]=a,s.length==0&&(a.originalNote={beat:r,col:e,type:this.getEditingNoteType()}),this.getAssistTickIndex(),this.app.actionHistory.run({action:()=>{a.removedNotes.forEach(o=>this.loadedChart.removeNote(o)),a.truncatedHolds.forEach(o=>this.loadedChart.modifyNote(o.oldNote,o.newNote)),a.originalNote&&this.loadedChart.addNote(a.originalNote)},undo:()=>{a.originalNote&&this.loadedChart.removeNote(a.originalNote),a.truncatedHolds.forEach(o=>this.loadedChart.modifyNote(o.newNote,o.oldNote)),a.removedNotes.forEach(o=>this.loadedChart.addNote(o))}})}editHoldBeat(e,t,r){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null)return;const s=this.holdEditing[e];if(s==null||t==s.startBeat&&t==s.endBeat)return;if(s.endBeat=Math.max(s.startBeat,Math.round(t*48)/48),s.roll||=r,!s.originalNote)this.loadedChart.addNote({beat:s.startBeat,col:e,type:s.roll?"Roll":"Hold",hold:s.endBeat-s.startBeat});else{const a={beat:s.startBeat,type:s.roll?"Roll":"Hold",hold:s.endBeat-s.startBeat};s.endBeat-s.startBeat==0&&(a.hold=void 0,a.type="Tap"),(a.beat!=s.originalNote.beat||a.type!=s.originalNote.type||De(s.originalNote)&&a.hold!=s.originalNote.hold)&&this.loadedChart.modifyNote(s.originalNote,a)}s.originalNote={beat:s.startBeat,col:e,type:s.endBeat-s.startBeat==0?"Tap":s.roll?"Roll":"Hold",hold:s.endBeat-s.startBeat==0?void 0:s.endBeat-s.startBeat};const n=this.loadedChart.getNotedata().filter(a=>a.beat==s.originalNote.beat&&a.col==s.originalNote.col||a.col!=e?!1:a.beat>=s.startBeat&&a.beat<=s.endBeat?!0:De(a)&&a.beat+a.hold>=s.startBeat&&a.beat+a.hold<=s.endBeat);s.removedNotes=s.removedNotes.concat(n),n.forEach(a=>this.loadedChart.removeNote(a)),this.getAssistTickIndex()}endEditing(e){this.holdEditing[e]=void 0}previousNoteType(){const e=this.loadedChart?.gameType.editNoteTypes.length??0;this.editNoteTypeIndex=(this.editNoteTypeIndex-1+e)%e}nextNoteType(){const e=this.loadedChart?.gameType.editNoteTypes.length??0;this.editNoteTypeIndex=(this.editNoteTypeIndex+1+e)%e}getEditingNoteType(){return this.loadedChart?.gameType.editNoteTypes[this.editNoteTypeIndex]??null}setEditingNoteType(e){if(!this.loadedChart)return;const r=(this.loadedChart?.gameType.editNoteTypes).indexOf(e);r!=-1&&(this.editNoteTypeIndex=r)}getMode(){return this.mode}setMode(e){if(!this.loadedChart||!this.chartView)return;if(this.mode==e){(e=="Play Mode"||e=="Record Mode")&&(this.setMode(this.lastMode),this.getAssistTickIndex(),this.chartAudio.pause());return}(this.mode=="View Mode"||this.mode=="Edit Mode")&&(this.lastMode=this.mode),this.mode=e;const t=this.loadedChart.getNotedata();if(this.mode=="Play Mode"){t.forEach(r=>{r.gameplay={hideNote:!1,hasHit:!1}});for(const r of t)if(r.secondr.gameplay=void 0))}judgeCol(e){if(!(!this.loadedChart||!this.chartView)){if(this.mode=="Play Mode")this.loadedChart.gameType.gameLogic.keyDown(this,e);else if(this.mode=="Record Mode"){const t=this.loadedChart.getBeatFromSeconds(this.time+A.play.offset),r=A.chart.snap==0?1/48:A.chart.snap,s=Math.round(t/r)*r;this.setNote(e,"key",s)}}}judgeColUp(e){!this.loadedChart||!this.chartView||(this.mode=="Play Mode"?this.loadedChart.gameType.gameLogic.keyUp(this,e):this.mode=="Record Mode"&&this.endEditing(e))}async save(){if(!this.loadedSM)return;if(!mt.instance.isDirty()){Oe.create("Saved");return}const e=this.smPath.split("/"),t=e.pop().split(".").slice(0,-1).join("."),r=e.join("/");!this.loadedSM.usesSplitTiming()&&await $e.getFileHandle(r+"/"+t+".sm")&&$e.writeFile(r+"/"+t+".sm",this.loadedSM.serialize("sm")),(this.loadedSM.requiresSSC()||await $e.getFileHandle(r+"/"+t+".ssc"))&&$e.writeFile(r+"/"+t+".ssc",this.loadedSM.serialize("ssc")),this.loadedSM.usesSplitTiming()?Oe.create("Saved. No SM file since split timing was used."):Oe.create("Saved"),mt.instance.setLimit()}hasSelection(){return this.selection.notes.length>0||this.eventSelection.timingEvents.length>0||this.startRegion!==void 0&&this.endRegion!==void 0}hasRange(){return this.selection.notes.length>1||this.eventSelection.timingEvents.length>1||this.startRegion!==void 0&&this.endRegion!==void 0}clearSelections(){this.selection={notes:[],inProgressNotes:[]},this.eventSelection={timingEvents:[],inProgressTimingEvents:[]}}startDragSelection(){this.selection.inProgressNotes=[]}endDragSelection(){this.selection.notes=this.selection.notes.concat(this.selection.inProgressNotes)}startDragEventSelection(){this.eventSelection.inProgressTimingEvents=[]}endDragEventSelection(){this.eventSelection.timingEvents=this.eventSelection.timingEvents.concat(this.eventSelection.inProgressTimingEvents)}addNoteToDragSelection(e){this.selection.inProgressNotes.push(e)}removeNoteFromDragSelection(e){const t=this.selection.inProgressNotes.indexOf(e);t!=-1&&this.selection.inProgressNotes.splice(t,1)}addEventToDragSelection(e){this.eventSelection.inProgressTimingEvents.push(e)}removeEventFromDragSelection(e){const t=this.eventSelection.inProgressTimingEvents.indexOf(e);t!=-1&&this.eventSelection.inProgressTimingEvents.splice(t,1)}addNoteToSelection(e){this.selection.notes.push(e)}removeNoteFromSelection(e){const t=this.selection.notes.indexOf(e);t!=-1&&this.selection.notes.splice(t,1)}addEventToSelection(e){this.eventSelection.timingEvents.push(e)}removeEventFromSelection(e){const t=this.eventSelection.timingEvents.indexOf(e);t!=-1&&this.eventSelection.timingEvents.splice(t,1)}selectRegion(){if(this.loadedChart){if(this.endRegion!==void 0&&(this.startRegion=void 0,this.endRegion=void 0),this.startRegion===void 0){this.clearSelections(),this.startRegion=this.beat;return}if(this.endRegion===void 0){this.endRegion=this.beat,this.endRegione.beat>=this.startRegion&&e.beat<=this.endRegion).filter(e=>!this.selection.notes.includes(e)).forEach(e=>this.addNoteToSelection(e));return}}}modifySelection(e){if(!this.loadedChart)return;const t=this.selection.notes,r=structuredClone(this.selection.notes).map(e).sort((a,o)=>a.beat==o.beat?a.col-o.col:a.beat-o.beat);if(r.length==0)return;const{removedNotes:s,truncatedHolds:n}=this.checkConflicts(r,t);this.app.actionHistory.run({action:()=>{this.loadedChart.removeNotes(t.concat(s)),n.forEach(a=>this.loadedChart.modifyNote(a.oldNote,a.newNote)),this.clearSelections(),this.selection.notes=this.loadedChart.addNotes(r)},undo:()=>{this.loadedChart.removeNotes(r),n.forEach(a=>this.loadedChart.modifyNote(a.newNote,a.oldNote)),this.loadedChart.addNotes(s),this.clearSelections(),this.selection.notes=this.loadedChart.addNotes(t)}})}checkConflicts(e,t=[]){const r=this.loadedChart.getNotedata();let s=r.findIndex(l=>e[0].beat<=(De(l)?l.beat+l.hold:l.beat));const n=[],a=[],o=[];for(const l of e)for(;r[s];){const c=r[s],u=De(l)?l.beat+l.hold:l.beat;if(c.col==l.col&&!t.includes(c)&&!o.includes(c)&&(l.beat<=c.beat&&u>=c.beat?(o.push(c),n.push(c)):De(c)&&c.beat+c.hold>=l.beat&&c.beatu){s--;break}}return{removedNotes:n,truncatedHolds:a}}modifyEventSelection(e){if(!this.loadedChart)return;const t=this.loadedChart.timingData,r=this.eventSelection.timingEvents,s=structuredClone(this.eventSelection.timingEvents).map(e);if(s.length==0)return;let n=[];this.app.actionHistory.run({action:()=>{t.rawDeleteMultiple(r),t.rawInsertMultiple(s),n=t.findConflicts(),t.rawDeleteMultiple(n),this.clearSelections(),this.eventSelection.timingEvents=s,re.emit("timingModified"),re.emit("chartModified"),s.find(a=>a.type=="TIMESIGNATURES")&&re.emit("timeSigChanged")},undo:()=>{t.rawInsertMultiple(n),t.rawDeleteMultiple(s),t.rawInsertMultiple(r),this.clearSelections(),this.eventSelection.timingEvents=r,re.emit("timingModified"),re.emit("chartModified"),s.find(a=>a.type=="TIMESIGNATURES")&&re.emit("timeSigChanged")},redo:()=>{t.rawDeleteMultiple(r),t.rawInsertMultiple(s),t.rawDeleteMultiple(n),this.clearSelections(),this.eventSelection.timingEvents=s,re.emit("timingModified"),re.emit("chartModified"),s.find(a=>a.type=="TIMESIGNATURES")&&re.emit("timeSigChanged")}})}deleteSelection(){if(this.selection.notes.length==0)return;const e=this.selection.notes;this.app.actionHistory.run({action:()=>{this.loadedChart.removeNotes(e),this.clearSelections()},undo:()=>{this.selection.notes=this.loadedChart.addNotes(e)}})}deleteEventSelection(){if(this.eventSelection.timingEvents.length==0)return;const e=this.eventSelection.timingEvents,t=this.loadedChart.timingData;let r=[];this.app.actionHistory.run({action:()=>{t.rawDeleteMultiple(e),r=t.findConflicts(),t.rawDeleteMultiple(r),this.clearSelections(),re.emit("timingModified"),re.emit("chartModified"),e.find(s=>s.type=="TIMESIGNATURES")&&re.emit("timeSigChanged")},undo:()=>{t.rawInsertMultiple(r),t.rawInsertMultiple(e),this.eventSelection.timingEvents=e,re.emit("timingModified"),re.emit("chartModified"),e.find(s=>s.type=="TIMESIGNATURES")&&re.emit("timeSigChanged")},redo:()=>{t.rawDeleteMultiple(e),t.rawDeleteMultiple(r),this.clearSelections(),re.emit("timingModified"),re.emit("chartModified"),e.find(s=>s.type=="TIMESIGNATURES")&&re.emit("timeSigChanged")}})}paste(e){if(this.loadedChart&&(e.startsWith("ArrowVortex:notes:")&&(this.pasteNotes(e)||this.pasteNotes(this.virtualClipboard)),e.startsWith("ArrowVortex:tempo:")||e.startsWith("SMEditor:tempo:"))){this.pasteTempo(e)||this.pasteTempo(this.virtualClipboard);return}}pasteNotes(e){if(!this.loadedChart)return!0;const t=v1(e);if(!t||t.length==0)return!1;t.map(n=>(n.beat+=this.beat,n.beat=Math.round(n.beat*48)/48,n)).sort((n,a)=>n.beat==a.beat?n.col-a.col:n.beat-a.beat);const{removedNotes:r,truncatedHolds:s}=this.checkConflicts(t);return this.app.actionHistory.run({action:()=>{this.loadedChart.removeNotes(r),s.forEach(n=>{this.loadedChart.modifyNote(n.oldNote,n.newNote)}),this.clearSelections(),this.selection.notes=this.loadedChart.addNotes(t)},undo:()=>{this.loadedChart.removeNotes(t),s.forEach(n=>{this.loadedChart.modifyNote(n.newNote,n.oldNote)}),this.loadedChart.addNotes(r),this.clearSelections()}}),!0}pasteTempo(e){if(!this.loadedChart)return!0;const t=T1(e);if(!t||t.length==0)return!1;const r=this.loadedChart.timingData;let s=[];return t.forEach(n=>{n.type=="ATTACKS"?n.second+=this.time:n.beat+=this.beat}),this.app.actionHistory.run({action:()=>{r.rawInsertMultiple(t),s=r.findConflicts(),r.rawDeleteMultiple(s),this.clearSelections(),this.eventSelection.timingEvents=t,re.emit("timingModified"),re.emit("chartModified"),t.find(n=>n.type=="TIMESIGNATURES")&&re.emit("timeSigChanged")},undo:()=>{r.rawInsertMultiple(s),r.rawDeleteMultiple(t),this.clearSelections(),re.emit("timingModified"),re.emit("chartModified"),t.find(n=>n.type=="TIMESIGNATURES")&&re.emit("timeSigChanged")},redo:()=>{r.rawInsertMultiple(t),r.rawDeleteMultiple(s),this.clearSelections(),this.eventSelection.timingEvents=t,re.emit("timingModified"),re.emit("chartModified"),t.find(n=>n.type=="TIMESIGNATURES")&&re.emit("timeSigChanged")}}),!0}copy(){if(this.selection.notes.length!=0){const e=Math.min(...this.selection.notes.map(s=>s.beat)),t=structuredClone(this.selection.notes).map(s=>(s.beat-=e,s)).sort((s,n)=>s.beat==n.beat?s.col-n.col:s.beat-n.beat),r=b1(t);return this.virtualClipboard=r,r}else if(this.eventSelection.timingEvents.length!=0){const e=Math.min(...this.eventSelection.timingEvents.map(n=>n.beat)),t=this.loadedChart.timingData.getSecondsFromBeat(e),r=structuredClone(this.eventSelection.timingEvents).map(n=>n.type=="ATTACKS"?(n.second-=t,n):(n.beat-=e,n)).sort((n,a)=>n.type!=a.type?n.type.localeCompare(a.type):n.type=="ATTACKS"?n.second-a.second:n.beat-a.beat),s=x1(r);return this.virtualClipboard=s,s}}}class j1{app;view;constructor(e,t){this.app=e,this.view=t;const r=Object.values(Ls).map(s=>this.createElement(s));t.replaceChildren(...r)}createElement(e){if(e.type=="seperator"){const t=document.createElement("div");return t.classList.add("seperator"),t}if(e.type=="selection"||e.type=="checkbox"||e.type=="dropdown"){const t=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div");let n;if(e.type=="selection"||e.type=="checkbox"){const a=ht[e.id]??{label:e.id,combos:[],callback:()=>{}};n=document.createElement("div"),n.innerText=tt.getKeybindString(e.id),n.classList.add("keybind","unselectable"),s.innerText=a.label;let o=a.disabled;typeof o=="function"&&(o=o(this.app)),o&&t.classList.add("disabled"),t.addEventListener("click",()=>{if(o)return;a.callback(this.app),t.closest(".menu-main").querySelector(".menubar-dropdown").replaceChildren()})}else n=document.createElement("img"),n.classList.add("icon"),n.src=Ge.CHEVRON,n.style.transform="rotate(-90deg)",s.innerText=typeof e.title=="function"?e.title(this.app):e.title;if(r.appendChild(s),r.appendChild(n),t.appendChild(r),t.classList.add("menu-item"),r.classList.add("menu-item-title","menu-hover"),s.classList.add("title","unselectable"),e.type=="dropdown"){const a=document.createElement("div");t.appendChild(a),a.classList.add("menubar-dropdown"),e.options.map(o=>this.createElement(o)).forEach(o=>a.appendChild(o))}if(e.type=="checkbox"){let a=e.checked;typeof a=="function"&&(a=a(this.app)),a&&(s.innerText="✓ "+s.innerText)}return t}if(e.type=="menu"){const t=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div");return t.appendChild(r),r.innerText=e.title,t.appendChild(s),r.classList.add("title","unselectable"),t.classList.add("menu-item","menu-main"),r.classList.add("menu-hover"),s.classList.add("menubar-dropdown","unselectable"),t.onmouseenter=()=>{s.replaceChildren(...e.options.map(n=>this.createElement(n)))},t.onmouseleave=()=>{s.replaceChildren()},t}return document.createElement("div")}}class X1 extends Vt{app;keyHandler;constructor(e){super({title:"Open a Song",width:400,height:320,disableClose:!0,win_id:"select_sm_initial"}),this.app=e,this.keyHandler=this.handleKeyEvent.bind(this),window.addEventListener("keydown",this.keyHandler),this.initView()}onClose(){window.removeEventListener("keydown",this.keyHandler)}initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("open-container"),e.appendChild(t);const r=document.createElement("div");r.classList.add("top-container");const s=document.createElement("div");s.classList.add("seperator"),s.style.margin="10px";const n=document.createElement("div");n.classList.add("bottom-container"),t.appendChild(r),t.appendChild(s),t.appendChild(n);const a=document.createElement("button");a.style.display="flex",a.style.flexDirection="column",a.style.padding="10px",a.style.backgroundColor="#414352",r.appendChild(a);const o=document.createElement("img");o.src=Ge.UPLOAD,o.classList.add("icon"),o.style.width="30px",o.style.height="30px",a.appendChild(o);const l=document.createElement("div");l.innerText=window.nw?"Open an existing song":"Import a song folder",a.appendChild(l),a.onclick=()=>{if(window.nw){const p=document.createElement("input");p.type="file",p.accept=".sm,.ssc",p.onchange=()=>{this.app.chartManager.loadSM(p.value),this.closeWindow()},p.click()}else this.app.windowManager.openWindow(new ra(this.app,{title:"Select an sm/ssc file...",accepted_file_types:[".sm",".ssc"],disableClose:!0,callback:p=>{this.app.chartManager.loadSM(p),this.closeWindow()}}))};const c=document.createElement("button");c.style.display="flex",c.style.flexDirection="column",c.style.padding="10px",c.style.backgroundColor="#506352",r.appendChild(c);const u=document.createElement("img");u.src=Ge.PLUS,u.classList.add("icon"),u.style.width="30px",u.style.height="30px",c.appendChild(u);const h=document.createElement("div");h.innerText="New Song",c.appendChild(h),c.onclick=()=>{this.app.windowManager.openWindow(new km(this.app))};const d=document.createElement("div");d.innerText="Recently Opened",d.classList.add("title"),n.appendChild(d);const f=document.createElement("div");f.classList.add("recent-selector"),n.appendChild(f),Bm.getRecents().forEach(p=>{const m=document.createElement("div");m.classList.add("recent-item");const g=document.createElement("div");g.classList.add("recent-name"),g.innerText=p.name;const y=document.createElement("div");y.classList.add("recent-path"),y.innerText=p.path,m.appendChild(g),m.appendChild(y),m.onclick=()=>{f.querySelectorAll(".selected").forEach(b=>b.classList.remove("selected")),m.classList.add("selected")},m.ondblclick=()=>{this.app.chartManager.loadSM(p.path),this.closeWindow()},f.appendChild(m)}),this.viewElement.appendChild(e)}handleKeyEvent(e){if(!this.windowElement.classList.contains("focused"))return;const t=this.viewElement.querySelector(".selected");if(t){if(e.code=="ArrowUp"){e.preventDefault(),e.stopImmediatePropagation();const r=t.previousElementSibling;r&&(t.parentElement.querySelectorAll(".selected").forEach(s=>s.classList.remove("selected")),r.classList.add("selected"),Nn(r,{scrollMode:"if-needed",block:"nearest",inline:"nearest"}))}if(e.code=="ArrowDown"){e.preventDefault(),e.stopImmediatePropagation();const r=t.nextElementSibling;r&&(t.parentElement.querySelectorAll(".selected").forEach(s=>s.classList.remove("selected")),r.classList.add("selected"),Nn(r,{scrollMode:"if-needed",block:"nearest",inline:"nearest"}))}}}}class Y1{view;windows=[];app;constructor(e,t){this.app=e,this.view=t}unfocusAll(){for(const e of this.view.querySelectorAll(".focused"))e.classList.remove("focused")}getFocusedWindow(){for(const e of this.windows)if(e.windowElement.classList.contains("focused"))return e;return null}isBlocked(){return!this.windows.every(e=>!e.options.blocking)}openWindow(e){if(e.options.win_id){const t=this.getWindowById(e.options.win_id);if(t){t.focus();return}}e.addToManager(this),this.windows.push(e)}removeWindow(e){this.windows.splice(this.windows.indexOf(e),1)}getWindowById(e){for(const t of this.windows)if(t.options.win_id==e)return t}}class nf{renderer;ticker;stage;view;chartManager;windowManager;menubarManager;actionHistory;lastWidth=window.innerWidth;lastHeight=window.innerHeight;constructor(){if(kr.setDefaultProps({duration:[200,100],theme:"sm"}),window.nw){const e=nw.Window.get();window.addEventListener("keydown",t=>{(t.key=="r"&&(t.metaKey||t.ctrlKey)||t.key=="F5")&&(t.preventDefault(),e.reload())})}A.loadOptions(),tt.load(this),setInterval(()=>A.saveOptions(),1e4),A.general.smoothAnimations&&document.body.classList.add("animated"),this.registerFonts(),this.view=document.getElementById("pixi"),document.oncontextmenu=e=>{e.preventDefault(),this.chartManager.loadedChart&&e.target==this.view&&Wh.open(this,e)},this.view.onmousedown=()=>{Wh.close()},this.stage=new xe,this.stage.sortableChildren=!0,this.renderer=new cs({backgroundColor:1579292,antialias:A.performance.antialiasing,width:this.view.clientWidth,height:this.view.clientHeight,resolution:A.performance.resolution,autoDensity:!0,view:this.view,powerPreference:"low-power"}),this.ticker=new Et,this.ticker.maxFPS=120,this.ticker.add(()=>{const e=performance.now();this.renderer.render(this.stage),ls.instance?.addFrameTimeValue(performance.now()-e),performance.memory?.usedJSHeapSize&&ls.instance?.addMemoryTimeValue(performance.memory.usedJSHeapSize),o1()},Mr.LOW),this.ticker.start(),Nt.init(this.renderer),this.chartManager=new V1(this),this.menubarManager=new j1(this,document.getElementById("menubar")),this.windowManager=new Y1(this,document.getElementById("windows")),this.actionHistory=new mt(this),this.registerListeners(),this.onResize(),this.windowManager.openWindow(new X1(this)),window.onbeforeunload=e=>{if(mt.instance.isDirty()&&A.general.warnBeforeExit)return e.preventDefault(),e.returnValue="Are you sure you want to exit?"},window.onunload=()=>{A.saveOptions()}}registerFonts(){Bt.from("Main",{fontFamily:"Assistant",fontSize:20,fill:"white"},{chars:[["a","z"],["A","Z"],"!@#$%^&*()~{}[]:.-?=,_","0123456789/"," "],resolution:window.devicePixelRatio}),Bt.from("Fancy",{fontFamily:"Assistant",fontSize:40,fontWeight:"700",fill:["#dddddd","#ffffff"],fillGradientType:ea.LINEAR_VERTICAL,stroke:11184810,strokeThickness:3},{chars:[["a","z"],["A","Z"],"!@#$%^&*()~{}[]:.-?=,_","0123456789/"," "],resolution:window.devicePixelRatio})}registerListeners(){window.addEventListener("keydown",function(e){e.code=="Tab"&&e.preventDefault(),e.code=="Enter"&&e.target instanceof HTMLButtonElement&&e.preventDefault()}),window.addEventListener("dragstart",function(e){e.target instanceof HTMLImageElement&&e.preventDefault()}),setInterval(()=>{(this.lastHeight!=window.innerHeight||this.lastWidth!=window.innerWidth)&&(this.lastHeight=window.innerHeight,this.lastWidth=window.innerWidth,this.onResize(),re.emit("resize"))},100),window.addEventListener("dragover",e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy"}),window.addEventListener("drop",e=>{if(window.nw){e.stopPropagation(),e.preventDefault();let t="";for(const r of e.dataTransfer.files)if(r.path)if(Ni(r.path)==".ssc"){t=r.path;break}else t==""&&Ni(r.path)==".sm"&&(t=r.path);t!=""&&(this.chartManager.loadSM(t),this.windowManager.getWindowById("select_sm_initial")?.closeWindow())}else $e.handleDropEvent(e).then(t=>{const r=new ra(this,{title:"Select an sm/ssc file...",accepted_file_types:[".sm",".ssc"],disableClose:!0,callback:s=>{this.chartManager.loadSM(s),this.windowManager.getWindowById("select_sm_initial")?.closeWindow()},onload:()=>{r.getAcceptableFile(t??"").then(s=>r.selectPath(s))}});this.windowManager.openWindow(r)})})}onResize(){const e=window.innerWidth,t=window.innerHeight-document.getElementById("menubar").clientHeight;this.renderer.screen.width=e,this.renderer.screen.height=t,this.view.width=e*this.renderer.resolution,this.view.height=t*this.renderer.resolution,this.view.style.width=`${e}px`,this.view.style.height=`${t}px`}}document.querySelector("body").innerHTML=`
+`,this.fpsBg.width=this.fpsText.width+10,this.fpsBg.height=this.fpsText.height+10,A.debug.showTimers?(this.fpsBg.y=(fi+5)*(this.children.length+2)-5,this.fpsText.y=(fi+5)*(this.children.length+2)):(this.fpsBg.y=-5,this.fpsText.y=0)}addMemoryTimeValue(e){this.memoryTimeGraph.addValue(e)}addFrameTimeValue(e){this.lastFrameTime=e,this.frameTimeGraph.addValue(e)}addUpdateTimeValue(e){this.updateTimeGraph.addValue(e)}addDrawUpdateTimeValue(e){this.drawUpdateTimeGraph.addValue(e)}}class _n extends xe{graphWidth;graphHeight;color;unit;precision;formatter;sublabel;maxEase=1;targetMax=1;minEase=1;targetMin=1;constrainedMin=null;constrainedMax=null;dataPoints=[];linePool=[];lineContainer;labelText;sublabelText;topText;bottomText;constructor(e){super();const{width:t,height:r,color:s=16777215,unit:n="",label:a="",min:o=null,max:l=null,precision:c=0,formatter:u=null,sublabel:h=()=>""}=e;this.graphWidth=t,this.graphHeight=r,this.color=s,this.unit=n,this.constrainedMax=l,this.constrainedMin=o,this.precision=c,this.formatter=u,this.sublabel=h,this.lineContainer=new hc(t,{position:!0},16384,!0);const d=new Nt;d.tint=0,d.alpha=.3,d.width=this.graphWidth,d.height=this.graphHeight,this.labelText=new Fe(a,{fontName:"Main",fontSize:Math.min(r/5,16)}),this.labelText.alpha=.8,this.sublabelText=new Fe("",{fontName:"Main",fontSize:Math.min(r/5,16)}),this.topText=new Fe("",{fontName:"Main",fontSize:Math.min(r/7,12)}),this.topText.anchor.x=1,this.topText.alpha=.5,this.topText.x=this.graphWidth,this.bottomText=new Fe("",{fontName:"Main",fontSize:Math.min(r/7,12)}),this.bottomText.anchor.x=1,this.bottomText.anchor.y=1,this.bottomText.alpha=.5,this.bottomText.x=this.graphWidth,this.bottomText.y=this.graphHeight,this.sublabelText.y=this.graphHeight,this.sublabelText.anchor.y=1,this.sublabelText.alpha=.5,this.addChild(d,this.lineContainer,this.labelText,this.sublabelText,this.topText,this.bottomText)}addValue(e){if(this.lineContainer.children[0]?.x+this.lineContainer.x<0){const r=this.lineContainer.children[0];this.dataPoints.shift(),this.removeChild(r),this.linePool.push(r)}this.lineContainer.x-=1,this.lineContainer.x<-1e7&&(this.lineContainer.children.forEach(r=>{r.x-=1e7}),this.lineContainer.x+=1e7);const t=this.linePool.shift()??new Be(ie.WHITE);t.width=1,t.anchor.x=.5,t.anchor.y=1,t.tint=this.color,t.alpha=.6,t.x=this.graphWidth-this.lineContainer.x,t.y=this.graphHeight,t.value=e,this.dataPoints.push(e),this.targetMax=this.constrainedMax!==null?this.constrainedMax:Math.max(...this.dataPoints),this.targetMin=this.constrainedMin!==null?this.constrainedMin:Math.min(...this.dataPoints),this.lineContainer.addChild(t)}update(){this.dataPoints.length!=0&&(this.maxEase=(this.maxEase-this.targetMax)*.1+this.targetMax,this.minEase=(this.minEase-this.targetMin)*.1+this.targetMin,this.lineContainer.children.forEach(e=>{e.height=Je((e.value-this.minEase)/this.maxEase,0,1)*this.graphHeight}),this.topText.text=this.formatter?.(this.maxEase)??`${de(this.maxEase,this.precision)} ${this.unit}`,this.bottomText.text=this.formatter?.(this.minEase)??`${de(this.minEase,this.precision)} ${this.unit}`,this.sublabelText.text=this.sublabel())}}class zl{static active=!1;static persistent=!1;static popup;static clickOutside;static onSnapChange=this.updateValues.bind(this);static moveInterval;static updateInterval;static exitTimeout;static editText;static zoomer;static divInput;static divLabel;static beatInput;static open(e){this.active||(this.popup=this.build(),document.getElementById("popups")?.appendChild(this.popup),this.clickOutside=t=>{this.popup?.contains(t.target)||(this.persistent=!1,this.close())},se.on("snapChanged",this.onSnapChange),this.popup.style.display="none",setTimeout(()=>this.movePosition(e)),clearTimeout(this.exitTimeout),this.moveInterval=setInterval(()=>this.movePosition(e),150),this.active=!0)}static movePosition(e){this.popup.style.display="";const t=e.getBounds(),r=t.left+t.width/2,s=200,n=s/2+15,a=window.innerWidth-s/2-15;this.popup.style.left=`${Je(r,n,a)}px`;const o=t.top+t.height/2;this.popup.style.top=`${t.top+t.height}px`,o+this.popup.clientHeight>window.innerHeight-15&&(this.popup.style.transform="translate(-50%, -100%)",this.popup.style.top=`${t.top-t.height/2}px`)}static build(){const e=document.createElement("div");e.classList.add("popup");const t=document.createElement("div");t.classList.add("popup-zoomer"),t.style.width="200px",t.style.backgroundColor="#333333",e.appendChild(t),this.zoomer=t;const r=document.createElement("div");r.innerText="Snap Options",r.classList.add("popup-title"),t.appendChild(r);const s=document.createElement("div");s.classList.add("popup-flex"),t.appendChild(s);const n=document.createElement("div");n.classList.add("popup-row");const a=document.createElement("div");a.innerText="Snap to nearest ";const o=ot.create(A.chart.snap==0?0:Math.round(4/A.chart.snap),1,0,0,1e3);o.onChange=p=>{if(p===void 0){this.updateValues();return}p==0?A.chart.snap=0:A.chart.snap=4/p,this.updateValues()};const l=document.createElement("div");l.innerText=this.suffixSnap()+" note",n.replaceChildren(a,o.view,l);const c=document.createElement("div");c.classList.add("popup-row");const u=document.createElement("div");u.innerText="Snap every";const h=ot.create(A.chart.snap,.001,3,0);h.onChange=p=>{if(p===void 0){this.updateValues();return}p==0?A.chart.snap=0:A.chart.snap=p,this.updateValues()};const d=document.createElement("div");d.innerText=" beats",c.replaceChildren(u,h.view,d),s.replaceChildren(n,c),this.beatInput=h,this.divInput=o,this.divLabel=l;const f=document.createElement("div");return f.innerText="click to edit",f.style.marginTop="4px",f.style.height="10px",t.appendChild(f),f.classList.add("popup-desc"),this.editText=f,e}static updateValues(){document.activeElement==this.divInput.input||document.activeElement==this.beatInput.input||(this.divInput.setValue(A.chart.snap==0?0:Math.round(4/A.chart.snap)),this.divLabel.innerText=this.suffixSnap()+" note",this.beatInput.setValue(A.chart.snap))}static suffixSnap(){const e=A.chart.snap==0?0:Math.round(4/A.chart.snap);return e%10==1&&e!=11?"st":e%10==2&&e!=12?"nd":e%10==3&&e!=13?"rd":"th"}static close(){!this.popup||!this.active||this.persistent||(window.removeEventListener("click",this.clickOutside,!0),this.popup.classList.add("exiting"),this.exitTimeout=setTimeout(()=>this.popup.remove(),200),this.active=!1,this.persistent=!1,clearInterval(this.moveInterval),clearInterval(this.updateInterval),se.off("timingModified",this.onSnapChange))}static select(){this.persistent=!0,this.zoomer.classList.add("selected"),this.editText.style.transform="scale(0)",this.editText.style.height="0px",setTimeout(()=>window.addEventListener("click",this.clickOutside,!0),200)}}const lT={fontName:"Main",fontSize:10,fill:["#ffffff"]},km={4:15157287,8:4033015,12:11152884,16:8577607,24:14167723,32:15376696,48:15699179,64:7071886,96:8553090,192:8553090};class hT extends xe{renderer;children=[];constructor(e){super(),this.renderer=e;for(let t=0;t<2;t++){const r=new xe,s=new ps,n=new Fe("4",lT);r.x=(t-.5)*(this.renderer.chart.gameType.notefieldWidth+48),s.rotation=Math.PI/4,s.lineStyle(1,0,1),s.beginFill(16777215),s.drawRect(-12,-12,24,24),s.endFill(),n.anchor.set(.5),r.addChild(s,n),this.addChild(r),r.eventMode="static",r.on("mouseenter",()=>zl.open(s)),r.on("mousedown",()=>zl.select()),r.on("mouseleave",()=>zl.close())}}update(){this.y=A.chart.receptorYPos/A.chart.zoom,this.visible=this.renderer.chartManager.getMode()==Z.Edit||this.renderer.chartManager.getMode()==Z.Record;for(let e=0;e<2;e++){const t=this.children[e],r=t.children[0];r.tint=km[4/A.chart.snap]??7368816;const s=t.children[1];s.text=""+(A.chart.snap==0||4/A.chart.snap%1!=0?"":4/A.chart.snap),s.scale.y=A.chart.reverse?-1:1}}}class cT extends Xo{barContainer=new hc(1500,{position:!0,scale:!0,tint:!0},16384,!0);backing=new Nt;bars;barTexture;overlay=new Be(ie.WHITE);lastHeight=0;lastCMod;mouseDown=!1;queued=!1;constructor(e){super(e),this.addChild(this.backing),this.visible=!1,this.backing.tint=0,this.backing.alpha=.3,this.barTexture=yt.create({resolution:this.manager.app.renderer.resolution}),this.bars=new Be(this.barTexture),this.bars.anchor.set(.5),this.addChild(this.bars),this.overlay.anchor.x=.5,this.overlay.anchor.y=0,this.overlay.alpha=.3,this.lastCMod=A.chart.CMod,this.addChild(this.overlay),this.x=this.manager.app.renderer.screen.width/2-20,se.on("chartLoaded",()=>{this.queued=!1,this.populate()}),se.on("chartModifiedAfter",()=>{this.queued||this.populate(),this.queued=!0});const t=setInterval(()=>{this.queued&&(this.queued=!1,this.populate())},3e3);this.on("destroyed",()=>clearInterval(t)),this.populate(),this.eventMode="static",this.on("mousedown",r=>{this.mouseDown=!0,this.handleMouse(r)}),this.on("mousemove",r=>{this.mouseDown&&this.handleMouse(r)}),window.onmouseup=()=>{this.mouseDown=!1}}handleMouse(e){if(this.manager.chartManager.getMode()==Z.Play||!this.getChart())return;let t=(this.bars.toLocal(e.global).y+this.bars.height/2)/this.bars.height;t=Je(t,0,1);const r=this.getChart().getNotedata().at(-1);if(!r)return;const s=r.beat+(De(r)?r.hold:0),n=this.getChart().getSecondsFromBeat(s);A.chart.CMod?this.manager.chartManager.setTime(Ls(-this.getChart().timingData.getTimingData("OFFSET"),n,t)):this.manager.chartManager.setBeat(s*t)}update(){const e=this.manager.app.renderer.screen.height-40;this.backing.height=e+10,this.backing.position.y=-this.backing.height/2,this.backing.position.x=-this.backing.width/2,this.bars.height=e,this.x=this.manager.app.renderer.screen.width/2-20;const t=this.getChart(),r=this.manager.chartManager.chartView;if(!t||!r){this.visible=!1;return}this.visible=!0;const s=t.getNotedata().at(-1);if(!s){this.overlay.height=0;return}const n=s.beat+(De(s)?s.hold:0),a=t.getSecondsFromBeat(n),o=A.chart.CMod?r.getSecondFromYPos(-this.manager.app.renderer.screen.height/2):r.getBeatFromYPos(-this.manager.app.renderer.screen.height/2,!0),l=A.chart.CMod?r.getSecondFromYPos(this.manager.app.renderer.screen.height/2):r.getBeatFromYPos(this.manager.app.renderer.screen.height/2,!0);let c=bs(0,n,o),u=bs(0,n,l);A.chart.CMod&&(c=bs(-t.timingData.getTimingData("OFFSET"),a,o),u=bs(-t.timingData.getTimingData("OFFSET"),a,l)),c=Je(c,0,1),u=Je(u,0,1);const h=(c-.5)*(this.backing.height-10),d=(u-.5)*(this.backing.height-10);this.overlay.y=h,this.overlay.height=d-h,this.overlay.height=Math.max(2,this.overlay.height),(this.manager.app.renderer.screen.height!=this.lastHeight||this.lastCMod!=A.chart.CMod)&&(this.lastCMod=A.chart.CMod,this.lastHeight=this.manager.app.renderer.screen.height,this.populate()),this.scale.y=A.chart.reverse?-1:1}populate(){const e=this.getChart();if(!e){Ht(this.barContainer.children,()=>!0),this.manager.app.renderer.render(this.barContainer,{renderTexture:this.barTexture});return}this.visible=!0;let t=0;const r=e.gameType.numCols,s=e.getNotedata().at(-1),n=this.manager.app.renderer.screen.height-40;if(this.backing.height=n,this.backing.width=r*6+8,this.overlay.width=r*6+8,this.pivot.x=this.backing.width/2,this.barTexture.resize(r*6,n),!s){Ht(this.barContainer.children,()=>!0),this.manager.app.renderer.render(this.barContainer,{renderTexture:this.barTexture});return}const a=s.beat+(De(s)?s.hold:0),o=e.getSecondsFromBeat(a),l=e.timingData.getTimingData("OFFSET");e.getNotedata().forEach(c=>{let u=this.barContainer.children[t];u||(u=new Be(ie.WHITE),u.width=4,this.barContainer.addChild(u)),u.anchor.set(.5),u.height=1,u.x=(c.col+.5)*6;let h=bs(0,a,c.beat);if(A.chart.CMod&&(h=bs(l,o,c.second)),u.y=h*n,u.tint=km[Oh(c.beat)],c.type=="Mine"&&(u.tint=8421504),t++,De(c)){let d=this.barContainer.children[t];d||(d=new Be(ie.WHITE),d.width=4,d.height=2,this.barContainer.addChild(d)),d.anchor.x=.5,d.anchor.y=0,d.x=(c.col+.5)*6;const f=(A.chart.CMod?e.getSecondsFromBeat(c.beat+c.hold)/o:(c.beat+c.hold)/a)*n+1;d.y=u.y,d.height=f-u.y,c.type=="Hold"&&(d.tint=10526880),c.type=="Roll"&&(d.tint=11379586),t++}}),Ht(this.barContainer.children,(c,u)=>u>=t),this.manager.app.renderer.render(this.barContainer,{renderTexture:this.barTexture})}getChart(){return this.manager.chartManager.loadedChart}}const $e=300,st=150,ef=[.045,.09,.18,.37,.18,.09,.045];class dT extends Xo{max=0;barlines=new xe;backgroundRect=new Nt;background=new xe;backgroundLines=new xe;statText=new xe;meanText;medianText;modeText;stddevText;errorMS=[];texts=new xe;showEase=0;toggled=!1;drag=!1;dragStart=0;lastMode=this.manager.chartManager.getMode();constructor(e){super(e),this.visible=!1,this.backgroundRect.tint=0,this.backgroundRect.alpha=.3,this.background.addChild(this.backgroundRect),this.addChild(this.background),this.addChild(this.backgroundLines),this.eventMode="static",this.on("mousedown",()=>{this.manager.chartManager.getMode()!=Z.Play&&(this.drag=!0,this.dragStart=Date.now(),Ft.stop("play-widget"))}),window.addEventListener("mousemove",p=>{this.drag&&(this.showEase+=p.movementY/-400)}),window.addEventListener("mouseup",()=>{this.drag&&(Date.now()-this.dragStart>400?this.toggled=this.showEase>.5:this.toggled=!this.toggled,Ft.animate(this,{0:{showEase:"inherit"},1:{showEase:this.toggled?1:0}},.6,Yt(.11,.71,.33,1.39),()=>{},"play-widget")),this.drag=!1}),this.on("mouseenter",()=>{!this.toggled&&this.manager.chartManager.getMode()!=Z.Play&&Ft.animate(this,{0:{showEase:"inherit"},1:{showEase:.05}},.6,Yt(.11,.71,.33,1.39),()=>{},"play-widget")}),this.on("mouseleave",()=>{!this.toggled&&this.manager.chartManager.getMode()!=Z.Play&&Ft.animate(this,{0:{showEase:"inherit"},1:{showEase:0}},.6,Yt(.11,.71,.33,1.39),()=>{},"play-widget")});const t=new Fe("Early",{fontName:"Main",fontSize:15});t.x=-$e/2+5,t.y=-st-40,t.alpha=.3,this.background.addChild(t);const r=new Fe("Late",{fontName:"Main",fontSize:15});r.anchor.x=1,r.x=$e/2-5,r.y=-st-40,r.alpha=.3,this.background.addChild(r),this.meanText=new Fe("-",{fontName:"Main",fontSize:15}),this.meanText.anchor.x=.5,this.meanText.x=$e/4*-1.5,this.meanText.y=-st-70,this.statText.addChild(this.meanText),this.medianText=new Fe("-",{fontName:"Main",fontSize:15}),this.medianText.anchor.x=.5,this.medianText.x=$e/4*-.5,this.medianText.y=-st-70,this.statText.addChild(this.medianText),this.modeText=new Fe("-",{fontName:"Main",fontSize:15}),this.modeText.anchor.x=.5,this.modeText.x=$e/4*.5,this.modeText.y=-st-70,this.statText.addChild(this.modeText),this.stddevText=new Fe("-",{fontName:"Main",fontSize:15}),this.stddevText.anchor.x=.5,this.stddevText.x=$e/4*1.5,this.stddevText.y=-st-70,this.statText.addChild(this.stddevText);const s=new Fe("Mean",{fontName:"Main",fontSize:10});s.anchor.x=.5,s.x=$e/4*-1.5,s.y=-st-80,this.statText.addChild(s);const n=new Fe("Median",{fontName:"Main",fontSize:10});n.anchor.x=.5,n.x=$e/4*-.5,n.y=-st-80,this.statText.addChild(n);const a=new Fe("Mode",{fontName:"Main",fontSize:10});a.anchor.x=.5,a.x=$e/4*.5,a.y=-st-80,this.statText.addChild(a);const o=new Fe("Std Dev.",{fontName:"Main",fontSize:10});o.anchor.x=.5,o.x=$e/4*1.5,o.y=-st-80,this.statText.addChild(o);const l=new xe,c=new Nt;c.tint=3355443,c.alpha=.3,c.width=$e/2-10,c.height=30,c.y=-25,c.x=-$e/4,c.pivot.x=($e/2-10)/2,c.pivot.y=15;const u=new Fe("Adjust song offset",{fontName:"Main",fontSize:12});u.anchor.set(.5),u.x=-$e/4,u.y=-25,l.addChild(c,u),l.eventMode="static",l.addEventListener("mouseenter",()=>{c.alpha=.6}),l.addEventListener("mousedown",p=>{p.stopImmediatePropagation(),this.adjustOffset("song")}),l.addEventListener("mouseleave",()=>{c.alpha=.3}),this.statText.addChild(l);const h=new xe,d=new Nt;d.tint=3355443,d.alpha=.3,d.width=$e/2-10,d.height=30,d.y=-25,d.x=$e/4,d.pivot.x=($e/2-10)/2,d.pivot.y=15,d.eventMode="static",h.addEventListener("mouseenter",()=>{d.alpha=.6}),h.addEventListener("mouseleave",()=>{d.alpha=.3});const f=new Fe("Adjust global offset",{fontName:"Main",fontSize:12});f.anchor.set(.5),f.x=$e/4,f.y=-25,h.addChild(d,f),h.eventMode="static",h.addEventListener("mouseenter",()=>{d.alpha=.6}),h.addEventListener("mousedown",p=>{p.stopImmediatePropagation(),this.adjustOffset("global")}),h.addEventListener("mouseleave",()=>{d.alpha=.3}),this.statText.addChild(h),this.addChild(this.background),this.addChild(this.backgroundLines),this.eventMode="static",this.addChild(this.statText),this.addChild(this.barlines),this.addChild(this.texts)}update(){this.visible=!!this.manager.chartManager.gameStats,this.x=-this.manager.chartManager.app.renderer.screen.width/2+20+$e/2,this.y=this.manager.chartManager.app.renderer.screen.height/2-20,this.backgroundRect.width=$e+10,this.backgroundRect.height=st+260,this.backgroundRect.x=-$e/2-5,this.backgroundRect.y=-st-260,this.visible=!!this.manager.chartManager.gameStats;for(const e of this.barlines.children)A.general.smoothAnimations?e.height=(e.targetHeight-e.height)*.2+e.height:e.height=e.targetHeight;this.lastMode!=this.manager.chartManager.getMode()&&(this.lastMode=this.manager.chartManager.getMode(),Ft.animate(this,{0:{showEase:"inherit"},1:{showEase:this.manager.chartManager.getMode()==Z.Play?1:0}},.6,Yt(.11,.71,.33,1.39),()=>{},"play-widget")),A.general.smoothAnimations?this.y+=(1-Math.abs(this.showEase))*400:this.manager.chartManager.getMode()!=Z.Play&&(this.y+=400)}newLine(){const e=new Be(ie.WHITE);return e.smoothCount=0,e.targetHeight=0,e.anchor.y=1,e.anchor.x=.5,e.height=0,e.visible=!1,e}startPlay(){const e=this.manager.chartManager.gameStats;this.max=0,this.errorMS=[],this.meanText.text="-",this.medianText.text="-",this.modeText.text="-",this.stddevText.text="-",Ht(this.barlines.children,()=>!0),Ht(this.backgroundLines.children,()=>!0),Ht(this.texts.children,()=>!0);const t=et.getCollection(A.play.timingCollection),r=t.getStandardWindows().length+1,s=Math.round(t.maxWindowMS());for(let f=0;fy.type==p&&!y.fake).length),m.tint=14540253,g.tint=14540253,g.name=p,this.texts.addChild(m),this.texts.addChild(g),m.x=-$e/2+160,g.x=-$e/2+290,m.y=80/o*n-st-220,g.y=80/o*n++-st-220,m.anchor.y=.5,g.anchor.y=.5,g.anchor.x=1}const l=new Fe("Max Combo",{fontName:"Main",fontSize:15}),c=new Fe("0",{fontName:"Main",fontSize:15});l.tint=14540253,c.tint=14540253,c.name="Combo",this.texts.addChild(l),this.texts.addChild(c),l.x=-$e/2+160,c.x=-$e/2+290,l.y=80/o*n-st-220,c.y=80/o*n++-st-220,l.anchor.y=.5,c.anchor.y=.5,c.anchor.x=1;const u=new Fe("0.00 / 0.00",{fontName:"Main",fontSize:20});u.tint=14540253,u.x=-$e/2+225,u.y=-st-112,u.name="Score",this.texts.addChild(u),u.anchor.set(.5);const h=new Fe("Score / Current Score",{fontName:"Main",fontSize:13});h.tint=8947848,h.x=-$e/2+225,h.y=-st-135,this.texts.addChild(h),h.anchor.set(.5);const d=new Fe("Play Statistics",{fontName:"Main",fontSize:13});d.y=-st-245,d.anchor.set(.5),this.texts.addChild(d),e.onJudge((f,p)=>{let m="";(ri(p)||Gi(p))&&(m=p.id),Er(p)&&(m=p.noteType),ts(p)&&(m="Mine");const g=this.texts.getChildByName(m);if(Er(p)){const b=g.text.split(" / ")[1];g.text=e.getCount(p)+" / "+b}else rn(p)||(g.text=e.getCount(p)+"");if(this.texts.getChildByName("Combo").text=e.getMaxCombo()+"",this.texts.getChildByName("Score").text=de(e.getScore()*100,2).toFixed(2)+" / "+de(e.getCumulativeScore()*100,2).toFixed(2),ri(p)||!Gi(p))return;const y=Math.round(f*1e3);for(let b=-3;b<=3;b++)this.barlines.children[y+s+b]&&(this.barlines.children[y+s+b].smoothCount+=ef[b+3],this.barlines.children[y+s+b].visible=!0,this.barlines.children[y+s+b].smoothCount>this.max&&(this.modeText.text=y+"ms",this.max=this.barlines.children[y+s+b].smoothCount));this.errorMS.push(f*1e3),this.meanText.text=tE(this.errorMS).toFixed(2)+"ms",this.medianText.text=jo(this.errorMS).toFixed(2)+"ms",this.stddevText.text=dm(this.errorMS).toFixed(2)+"ms",this.redraw()})}redraw(){for(const e of this.barlines.children)e.targetHeight=e.smoothCount*(st-20)/this.max}adjustOffset(e){const t=this.manager.chartManager.gameStats;if(!t)return;const r=Math.round(t.getMedian()*1e3)/1e3;if(r==0)return;t.applyOffset(-r),this.barlines.children.forEach(o=>{o.smoothCount=0});const s=et.getCollection(A.play.timingCollection),n=Math.round(s.maxWindowMS());t.getDataPoints().forEach(o=>{if(ri(o.judgment)||!Gi(o.judgment))return;const l=Math.round(o.error*1e3);for(let c=-3;c<=3;c++)this.barlines.children[l+n+c]&&(this.barlines.children[l+n+c].smoothCount+=ef[c+3],this.barlines.children[l+n+c].visible=!0,this.barlines.children[l+n+c].smoothCount>this.max&&(this.modeText.text=l+"ms",this.max=this.barlines.children[l+n+c].smoothCount))}),this.redraw();const a=e=="global"?A.play.offset:this.manager.app.chartManager.loadedChart.timingData.getTimingData("OFFSET");e=="global"?A.play.offset=de(A.play.offset-r,3):e=="song"&&this.manager.app.chartManager.loadedChart?.timingData.insert(this.manager.app.chartManager.loadedChart?.timingData.offset!==void 0,"OFFSET",de(this.manager.app.chartManager.loadedChart.timingData.getTimingData("OFFSET")-r,3)),Oe.create(`Adjusted ${e} offset from ${de(a,3).toFixed(3)} to ${de(a-r,3).toFixed(3)}`),this.manager.app.chartManager.setBeat(this.manager.app.chartManager.getBeat())}}const Tr={BPMS:9182254,STOPS:4934913,DELAYS:217453,WARPS:9243998,FAKES:4868682,COMBOS:939078,SPEEDS:2968693,LABELS:7747359,SCROLLS:3557006,TIMESIGNATURES:5392684,TICKCOUNTS:1594906,BGCHANGES:8460415,FGCHANGES:8857115,ATTACKS:1856083};class uT extends xe{renderer;areaPool=new hs({create:()=>{const e=new Be(ie.WHITE);return Object.assign(e,{alpha:.2,width:this.renderer.chart.gameType.notefieldWidth+128}),e.anchor.set(.5,0),e}});timingAreaMap=new Map;timingDirty=!1;constructor(e){super(),this.renderer=e,this.addChild(this.areaPool);const t=()=>this.timingDirty=!0;se.on("timingModified",t),this.on("destroyed",()=>se.off("timingModified",t))}update(e,t){this.timingDirty&&(this.timingAreaMap.clear(),this.areaPool.destroyAll(),this.timingDirty=!1),this.visible=this.renderer.chartManager.getMode()!=Z.Play||!A.play.hideBarlines;for(const r of this.renderer.chart.timingData.getTimingData("STOPS","WARPS","DELAYS","FAKES")){if(r.beat>t)break;if(this.shouldDrawEvent(r,e,t)&&!this.timingAreaMap.has(r)){const s=this.areaPool.createChild();if(!s)break;s.tint=Tr[r.type],this.timingAreaMap.set(r,s)}}for(const[r,s]of this.timingAreaMap.entries()){if(!this.shouldDrawEvent(r,e,t)){this.timingAreaMap.delete(r),this.areaPool.destroyChild(s);continue}let n=A.chart.CMod?this.renderer.getYPosFromSecond(r.second):this.renderer.getYPosFromBeat(r.beat),a=n;switch(r.type){case"STOPS":case"DELAYS":{A.chart.CMod&&r.value>0?a=this.renderer.getYPosFromSecond(r.second+r.value):r.value<0&&(a=this.renderer.getYPosFromBeat(this.renderer.chart.getBeatFromSeconds(r.second+1e-4)));break}case"FAKES":{a=this.renderer.getYPosFromBeat(r.beat+r.value);break}case"WARPS":{A.chart.CMod||(a=this.renderer.getYPosFromBeat(r.beat+r.value));break}}a0)||e.type=="WARPS"&&A.chart.CMod||e.beat>r)}}class Vl{static active=!1;static popup;static clickOutside;static moveInterval;static exitTimeout;static draggedElement;static dragOffsetX=0;static dragOffsetY=0;static grid;static leftovers;static boundaryCache=[];static open(){this.active||(this.popup=this.build(),document.getElementById("popups")?.appendChild(this.popup),this.clickOutside=e=>{!this.popup?.contains(e.target)&&!this.draggedElement?.contains(e.target)&&!document.getElementById("arrange-tracks")?.contains(e.target)&&this.close()},setTimeout(()=>window.addEventListener("click",this.clickOutside,!0)),this.popup.style.display="none",setTimeout(()=>this.movePosition()),clearTimeout(this.exitTimeout),this.moveInterval=setInterval(()=>this.movePosition(),150),this.active=!0)}static build(){const e=document.createElement("div");e.classList.add("popup"),e.id="timing-track-order";const t=document.createElement("div");t.classList.add("popup-zoomer"),e.appendChild(t);const r=document.createElement("div");r.classList.add("container"),t.appendChild(r);const s=document.createElement("div");s.classList.add("title"),s.innerText="Arrange Timing Tracks";const n=document.createElement("div");n.classList.add("track-grid-options");const a=document.createElement("button");a.classList.add("delete"),a.innerText="Reset",a.onclick=()=>{A.chart.timingEventOrder=structuredClone(yo.chart.timingEventOrder),this.clearBoundaries(),this.grid?.replaceChildren(),this.leftovers?.replaceChildren();const c=[...is];for(const h of A.chart.timingEventOrder.left){const d=this.makeDraggableTrack(h);d.classList.add("left"),this.grid?.appendChild(d),c.splice(c.indexOf(h),1)}const u=document.createElement("div");u.classList.add("draggable-track"),u.innerText="PLAYFIELD",u.style.backgroundColor="#2D2D2D",u.style.padding="20px 10px",u.style.writingMode="horizontal-tb",u.addEventListener("mousedown",h=>this.startDragging(h,u)),u.dataset.type="PLAYFIELD",this.grid?.appendChild(u);for(const h of A.chart.timingEventOrder.right){const d=this.makeDraggableTrack(h);d.classList.add("right"),this.grid?.appendChild(d),c.splice(c.indexOf(h),1)}for(const h of c)this.leftovers?.appendChild(this.makeLeftoverTrack(h))},this.grid=document.createElement("div"),this.grid.classList.add("track-grid"),r.appendChild(s),r.appendChild(this.grid),r.appendChild(n);const o=[...is];for(const c of A.chart.timingEventOrder.left){const u=this.makeDraggableTrack(c);u.classList.add("left"),this.grid.appendChild(u),o.splice(o.indexOf(c),1)}const l=document.createElement("div");l.classList.add("draggable-track"),l.innerText="PLAYFIELD",l.style.backgroundColor="#2D2D2D",l.style.padding="20px 10px",l.style.writingMode="horizontal-tb",l.addEventListener("mousedown",c=>this.startDragging(c,l)),l.dataset.type="PLAYFIELD",this.grid.appendChild(l);for(const c of A.chart.timingEventOrder.right){const u=this.makeDraggableTrack(c);u.classList.add("right"),this.grid.appendChild(u),o.splice(o.indexOf(c),1)}this.leftovers=document.createElement("div"),this.leftovers.classList.add("track-selector"),n.appendChild(this.leftovers),n.appendChild(a);for(const c of o)this.leftovers.appendChild(this.makeLeftoverTrack(c));return e}static makeDraggableTrack(e){const t=document.createElement("div");t.classList.add("draggable-track");const r=document.createElement("div");r.classList.add("draggable-track-text"),r.innerText=e,t.style.backgroundColor=Uh(Tr[e].toString(16).padStart(6,"0"),"#333333",.7),t.appendChild(r);let s=!0;const n=document.createElement("img");return n.src=Ge.TRASH,n.style.width="16px",n.addEventListener("click",()=>{if(!s)return;s=!1,this.deleteTrack(e),t.classList.add("exiting"),setTimeout(()=>t.remove(),400);const a=this.makeLeftoverTrack(e);a.classList.add("entering"),setTimeout(()=>a.classList.remove("entering"),400),this.leftovers?.appendChild(a),this.clearBoundaries()}),t.appendChild(n),t.addEventListener("mousedown",a=>{s&&a.target!=n&&this.startDragging(a,t)}),t.dataset.type=e,t}static makeLeftoverTrack(e){const t=document.createElement("div");t.classList.add("leftover-track");const r=document.createElement("img");r.src=Ge.PLUS,t.append(r);const s=document.createElement("div");s.classList.add("leftover-track-text"),s.innerText=e,t.style.backgroundColor=Uh(Tr[e].toString(16).padStart(6,"0"),"#333333",.7),t.appendChild(s);let n=0,a=0,o=!1,l=!1;return t.addEventListener("mousedown",()=>{o=!0}),t.addEventListener("mousemove",c=>{if(!(!o||l)&&(n+=c.movementX,a+=c.movementY,n*n+a*a>15)){l=!0;const u=this.makeDraggableTrack(e);this.grid?.appendChild(u),this.clearBoundaries();const h=t.getBoundingClientRect(),d=this.getClosestSlot(h.left),f=A.chart.timingEventOrder.left.concat(["PLAYFIELD"],A.chart.timingEventOrder.right);f.splice(d,0,e),this.saveOptions(f),f.forEach(p=>{const m=this.grid?.querySelector(`div[data-type=${p}]`);this.grid?.appendChild(m),p!="PLAYFIELD"&&(m?.classList.remove("left","right"),A.chart.timingEventOrder.left.includes(p)&&m?.classList.add("left"),A.chart.timingEventOrder.right.includes(p)&&m?.classList.add("right"))}),this.startDragging(c,u,c.clientX,c.clientY),A.general.smoothAnimations?(t.style.width=t.clientWidth+"px",t.style.transition="0.4s cubic-bezier(0, 0.91, 0.34, 1.05)",setTimeout(()=>{t.style.width="0px",t.style.opacity="0",t.style.padding="0",t.style.fontSize="0"},10),setTimeout(()=>t.remove(),400)):t.remove()}}),t.addEventListener("mouseup",()=>{if(!o||l)return;l=!0,A.chart.timingEventOrder.right.push(e),A.general.smoothAnimations?(t.style.width=t.clientWidth+"px",t.style.transition="0.4s cubic-bezier(0, 0.91, 0.34, 1.05)",setTimeout(()=>{t.style.width="0px",t.style.opacity="0",t.style.padding="0",t.style.fontSize="0"},10),setTimeout(()=>t.remove(),400)):t.remove();const c=this.makeDraggableTrack(e);c.classList.add("entering"),c.classList.add("right"),setTimeout(()=>c.classList.remove("entering"),400),this.grid?.appendChild(c),this.clearBoundaries()}),t}static startDragging(e,t,r,s){if(!this.popup)return;this.draggedElement=t.cloneNode(!0),this.draggedElement.style.position="fixed";const n=t.getBoundingClientRect(),a=this.popup.getBoundingClientRect();!r||!s?(this.dragOffsetX=e.clientX-n.left,this.dragOffsetY=e.clientY-n.top,this.draggedElement.style.left=n.left-a.left+"px",this.draggedElement.style.top=n.top-a.top+"px"):(this.dragOffsetX=n.width/2,this.dragOffsetY=n.height/4*3,this.draggedElement.style.left=r-n.width/2-a.left+"px",this.draggedElement.style.top=s-n.height/4*3-a.top+"px",this.draggedElement.classList.add("entering")),this.draggedElement.style.boxShadow="6px 6px 6px #222",this.draggedElement.style.transition="none",t.style.opacity="0.03",this.popup.appendChild(this.draggedElement);const o=A.chart.timingEventOrder.left.concat(["PLAYFIELD"],A.chart.timingEventOrder.right),l=t.dataset.type;let c=o.indexOf(l);const u=o.indexOf(l),h=f=>{this.draggedElement.style.left=f.clientX-this.dragOffsetX-a.left+"px",this.draggedElement.style.top=f.clientY-this.dragOffsetY-a.top+"px";let p=this.getClosestSlot(f.clientX-this.dragOffsetX);Math.abs(f.clientY-this.dragOffsetY-a.top-(n.top-a.top))>140&&(p=u),c!=p&&(o.splice(c,1),o.splice(p,0,l),this.saveOptions(o),o.forEach(m=>{const g=this.grid?.querySelector(`div[data-type=${m}]`);this.grid?.appendChild(g),m!="PLAYFIELD"&&(g?.classList.remove("left","right"),A.chart.timingEventOrder.left.includes(m)&&g?.classList.add("left"),A.chart.timingEventOrder.right.includes(m)&&g?.classList.add("right"))}),l!="PLAYFIELD"&&(this.draggedElement?.classList.remove("left","right"),A.chart.timingEventOrder.left.includes(l)&&this.draggedElement?.classList.add("left"),A.chart.timingEventOrder.right.includes(l)&&this.draggedElement?.classList.add("right")),c=p)};window.addEventListener("mousemove",h);const d=()=>{this.draggedElement?.remove(),this.draggedElement=void 0,window.removeEventListener("mousemove",h),t.style.opacity="",this.clearBoundaries(),window.removeEventListener("mouseup",d)};window.addEventListener("mouseup",d)}static saveOptions(e){const t=e.indexOf("PLAYFIELD");t!=-1&&(A.chart.timingEventOrder.left=e.slice(0,t),A.chart.timingEventOrder.right=e.slice(t+1))}static deleteTrack(e){const t=A.chart.timingEventOrder.left.indexOf(e);t!=-1&&A.chart.timingEventOrder.left.splice(t,1);const r=A.chart.timingEventOrder.right.indexOf(e);r!=-1&&A.chart.timingEventOrder.right.splice(r,1)}static movePosition(){if(!this.popup)return;const e=document.getElementById("arrange-tracks");if(!e)return;this.popup.style.display="";const t=e.getBoundingClientRect(),r=t.left+t.width/2,s=this.popup.clientWidth,n=s/2+15,a=window.innerWidth-s/2-15;this.popup.style.left=`${Je(r,n,a)}px`;const o=t.top+t.height/2;this.popup.style.top=`${t.top+t.height}px`,o+this.popup.clientHeight>window.innerHeight-15&&(this.popup.style.transform="translate(-50%, -100%)",this.popup.style.top=`${t.top-t.height/2}px`)}static getClosestSlot(e){this.boundaryCache.length==0&&this.getBoundaries();let t=-1,r=999999,s=999999;for(let n=0;ns)break;s=a}return t}static getBoundaries(){if(this.grid){for(const e of this.grid.children)this.boundaryCache.push([e,e.getBoundingClientRect()]);this.boundaryCache.sort((e,t)=>e[1].left-t[1].left)}}static clearBoundaries(){this.boundaryCache=[]}static close(){!this.popup||!this.active||(window.removeEventListener("click",this.clickOutside,!0),this.popup.classList.add("exiting"),this.exitTimeout=setTimeout(()=>this.popup.remove(),200),this.active=!1,clearInterval(this.moveInterval),this.clearBoundaries())}}class fT extends Xo{view;playbackBar;skipStart;skipEnd;play;playIcon;record;playtest;timeCounter;beatCounter;min;sec;millis;beat;beatDropdown;editBar;editSteps;editTiming;stepsContainer;timingContainer;editChoiceContainer;addTimingEvent;arrangeTimingTracks;noteArrows=[];noteArrowMask;lastTime=-1;lastBeat=-1;lastMode=Z.Edit;lastTimingMode=He.Off;lastHover=0;lastPlaying=!1;hovering=!1;trackingMovement=!0;idleFrames=0;lastBounds;constructor(e){super(e);const t=document.createElement("div");t.id="status-widget",document.getElementById("view-wrapper")?.appendChild(t),this.playbackBar=document.createElement("div"),this.playbackBar.classList.add("playback-bar"),this.editBar=document.createElement("div"),this.editBar.classList.add("edit-bar"),this.skipStart=document.createElement("button");const r=document.createElement("img");r.src=Ge.SKIP_START,r.style.height="36px",this.skipStart.appendChild(r),this.skipStart.onclick=()=>{this.manager.chartManager.setBeat(0)},this.skipEnd=document.createElement("button");const s=document.createElement("img");s.style.height="36px",s.src=Ge.SKIP_END,this.skipEnd.appendChild(s),this.skipStart.appendChild(r),this.skipEnd.onclick=()=>{this.manager.chartManager.lastNote()},this.play=document.createElement("button");const n=document.createElement("img");n.src=Ge.PLAY,this.play.appendChild(n),this.playIcon=n,this.play.onclick=()=>{(this.manager.chartManager.getMode()==Z.Record||this.manager.chartManager.getMode()==Z.Play)&&this.manager.chartManager.setMode(Z.Edit),this.manager.chartManager.playPause()},this.record=document.createElement("button");const a=document.createElement("img");a.style.height="36px",a.src=Ge.RECORD,this.record.appendChild(a),this.record.onclick=()=>{this.manager.chartManager.setMode(Z.Record)},this.playtest=document.createElement("button");const o=document.createElement("img");o.style.height="30px",o.src=Ge.PLAYTEST,this.playtest.appendChild(o),this.playtest.onclick=()=>{this.manager.chartManager.setMode(Z.Play)};const l=document.createElement("div");l.classList.add("playback-seperator"),this.timeCounter=document.createElement("div"),this.timeCounter.classList.add("playback-counter");const c=document.createElement("div");c.style.display="flex",c.classList.add("playback-counter-main");const u=document.createElement("div");u.classList.add("inlineEdit"),u.innerText="-",u.spellcheck=!1,u.contentEditable="true",u.style.maxWidth="27px",u.onkeydown=T=>{T.key=="Enter"&&u.blur(),T.key=="Tab"&&h.focus(),T.key=="Escape"&&(u.innerText=Math.floor(Math.abs(this.manager.chartManager.getTime())/60).toString().padStart(2,"0"),u.blur())},u.onfocus=()=>this.selectText(u),u.onblur=()=>this.updateTime(),u.ondragstart=T=>T.preventDefault();const h=document.createElement("div");h.classList.add("inlineEdit"),h.innerText="-",h.spellcheck=!1,h.contentEditable="true",h.style.maxWidth="18px",h.onkeydown=T=>{T.key=="Enter"&&h.blur(),T.key=="Tab"&&d.focus(),T.key=="Escape"&&(h.innerText=Math.floor(Math.abs(this.manager.chartManager.getTime())%60).toString().padStart(2,"0"),h.blur())},h.onfocus=()=>this.selectText(h),h.onblur=()=>this.updateTime(),h.ondragstart=T=>T.preventDefault();const d=document.createElement("div");d.classList.add("inlineEdit"),d.innerText="-",d.spellcheck=!1,d.contentEditable="true",d.style.maxWidth="27px",d.onkeydown=T=>{T.key=="Enter"&&d.blur(),T.key=="Tab"&&u.focus(),T.key=="Escape"&&(d.innerText=(de(Math.abs(this.manager.chartManager.getTime())%1,3)*1e3).toString().padStart(3,"0"),d.blur())},d.onfocus=()=>this.selectText(d),d.onblur=()=>this.updateTime(),d.ondragstart=T=>T.preventDefault(),this.min=u,this.sec=h,this.millis=d;const f=document.createElement("div");f.classList.add("playback-counter-label"),f.innerText="Time",c.appendChild(u),c.appendChild(document.createTextNode(":")),c.appendChild(h),c.appendChild(document.createTextNode(".")),c.appendChild(d),this.timeCounter.appendChild(c),this.timeCounter.appendChild(f);const p=document.createElement("div");p.classList.add("playback-seperator"),this.beatCounter=document.createElement("div"),this.beatCounter.classList.add("playback-counter");const m=document.createElement("div");m.classList.add("playback-counter-main","inlineEdit"),m.innerText="-",m.spellcheck=!1,m.contentEditable="true",m.onkeydown=T=>{if(T.key=="Enter"&&m.blur(),T.key=="Escape"){if(this.beatDropdown.value=="Measure"){const B=this.manager.chartManager.loadedChart?.timingData?.getMeasure(this.manager.chartManager.getBeat())??this.manager.chartManager.getBeat()/4;m.innerText=de(B,3).toFixed(3)}else m.innerText=de(this.manager.chartManager.getBeat(),3).toFixed(3);m.blur()}},m.onfocus=()=>{this.selectText(m)},m.onblur=()=>this.updateBeat(),m.ondragstart=T=>T.preventDefault(),this.beat=m,this.beatDropdown=hi.create(["Beat","Measure"],"Beat"),this.beatDropdown.view.querySelector(".dropdown-selected").classList.add("playback-counter-label"),this.beatCounter.appendChild(m),this.beatCounter.appendChild(this.beatDropdown.view),this.beatDropdown.onChange(()=>{if(this.beatDropdown.value=="Measure"){const T=this.manager.chartManager.loadedChart?.timingData?.getMeasure(this.manager.chartManager.getBeat())??this.manager.chartManager.getBeat()/4;m.innerText=de(T,3).toFixed(3)}else m.innerText=de(this.manager.chartManager.getBeat(),3).toFixed(3)}),this.playbackBar.appendChild(this.skipStart),this.playbackBar.appendChild(this.skipEnd),this.playbackBar.appendChild(this.play),this.playbackBar.appendChild(this.record),this.playbackBar.appendChild(this.playtest),this.playbackBar.appendChild(l),this.playbackBar.appendChild(this.timeCounter),this.playbackBar.appendChild(p),this.playbackBar.appendChild(this.beatCounter),this.editSteps=document.createElement("button"),this.editSteps.classList.add("edit-fancy-button");const g=document.createElement("img");g.src=Ge.ADD,this.editSteps.appendChild(g),this.editSteps.appendChild(document.createTextNode("Edit Steps")),this.editSteps.onclick=()=>{this.manager.chartManager.editTimingMode=He.Off},this.editSteps.style.background="rgba(255,255,255,0.15)",this.editTiming=document.createElement("button"),this.editTiming.classList.add("edit-fancy-button");const y=document.createElement("img");y.src=Ge.SPEED,this.editTiming.appendChild(y),this.editTiming.appendChild(document.createTextNode("Edit Timing")),this.editTiming.onclick=()=>{this.manager.chartManager.editTimingMode=He.Edit};const b=document.createElement("div");b.classList.add("playback-seperator");const w=document.createElement("div");w.classList.add("edit-bar-left"),w.appendChild(this.editSteps),w.appendChild(this.editTiming),w.appendChild(b),this.editBar.appendChild(w),this.editChoiceContainer=document.createElement("div"),this.editChoiceContainer.classList.add("edit-choice-container"),this.stepsContainer=document.createElement("div"),this.stepsContainer.classList.add("edit-steps-container"),this.timingContainer=document.createElement("div"),this.timingContainer.classList.add("edit-timing-container"),this.editChoiceContainer.appendChild(this.stepsContainer),this.editChoiceContainer.appendChild(this.timingContainer),this.addTimingEvent=document.createElement("button");const v=document.createElement("img");v.style.height="32px",v.src=Ge.ADD_EVENT,this.addTimingEvent.appendChild(v),this.addTimingEvent.onclick=()=>{this.manager.chartManager.editTimingMode==He.Add?this.manager.chartManager.editTimingMode=He.Edit:this.manager.chartManager.editTimingMode=He.Add},this.timingContainer.appendChild(this.addTimingEvent),this.arrangeTimingTracks=document.createElement("button");const E=document.createElement("img");E.style.height="32px",E.src=Ge.EYE,this.arrangeTimingTracks.appendChild(E),this.arrangeTimingTracks.onclick=()=>{Vl.active?Vl.close():Vl.open()},this.arrangeTimingTracks.id="arrange-tracks",this.timingContainer.appendChild(this.arrangeTimingTracks),this.editBar.appendChild(this.editChoiceContainer);const S=document.createElement("div");S.classList.add("note-placeholder-right"),this.stepsContainer.appendChild(S),se.on("resize",()=>{this.trackingMovement=!0,this.idleFrames=5}),se.on("chartLoaded",()=>{this.stepsContainer.replaceChildren(),this.noteArrows.forEach(B=>{this.removeChild(B.sprite),this.removeChild(B.bg),this.removeChild(B.highlight)}),this.noteArrows=[];const T=document.createElement("div");if(T.classList.add("note-placeholder-right"),this.stepsContainer.appendChild(T),!!this.manager.chartManager.loadedChart){for(const B of this.manager.chartManager.loadedChart.gameType.editNoteTypes){const k=this.manager.chartManager.chartView.getNotefield().getNoteSprite({type:B,beat:0,col:0});k.width=32,k.height=32;const D=new Be(ie.WHITE);D.tint=0,D.alpha=.5,D.width=48,D.height=48,D.anchor.set(.5);const W=new Nt("noBorder");W.alpha=0,W.width=48,W.height=48,W.pivot.x=24,W.pivot.y=24;const C=document.createElement("button");C.style.height="48px",C.style.width="48px",C.classList.add("note-placeholder"),C.onclick=()=>{this.manager.chartManager.setEditingNoteType(B)};const M={element:C,sprite:k,type:B,bg:D,highlight:W,hovered:!1};C.onmouseover=()=>{M.hovered=!0},C.onmouseleave=()=>{M.hovered=!1},this.addChild(D),this.addChild(k),this.addChild(W);const _=C.getBoundingClientRect();k.position.y=_.top-this.manager.app.view.clientHeight/2-this.manager.app.view.getBoundingClientRect().top+24,k.position.x=_.left-this.manager.app.view.clientWidth/2+24,D.position=k.position,this.noteArrows.push(M)}this.stepsContainer.replaceChildren(...this.noteArrows.map(B=>B.element),T),this.trackingMovement=!0,this.idleFrames=5}}),this.noteArrowMask=new Be(ie.WHITE),this.noteArrowMask.height=48,this.noteArrowMask.width=2500,this.noteArrowMask.anchor.y=1,this.noteArrowMask.anchor.x=.5,this.addChild(this.noteArrowMask),this.mask=this.noteArrowMask,t.onmouseenter=()=>{this.lastHover=Date.now(),this.hovering=!0,this.view.style.opacity="",this.view.style.transition=""},t.onmouseleave=()=>this.hovering=!1,t.appendChild(this.playbackBar),t.appendChild(this.editBar),this.view=t,t.style.display="none"}update(){this.view.style.display=this.manager.chartManager.loadedSM?"":"none";const e=this.manager.chartManager.getTime();this.lastTime!=e&&(document.activeElement!=this.min&&(this.min.innerText=(e<0?"-":"")+Math.floor(Math.abs(e)/60).toString().padStart(2,"0")),document.activeElement!=this.sec&&(this.sec.innerText=Math.floor(Math.abs(e)%60).toString().padStart(2,"0")),document.activeElement!=this.millis&&(this.millis.innerText=(de(Math.abs(e)%1,3)*1e3).toString().padStart(3,"0")),this.lastTime=e);const t=this.manager.chartManager.getBeat();if(this.lastBeat!=t){if(document.activeElement!=this.beat)if(this.beatDropdown.value=="Measure"){const o=this.manager.chartManager.loadedChart?.timingData?.getMeasure(t)??t/4;this.beat.innerText=de(o,3).toFixed(3)}else this.beat.innerText=de(t,3).toFixed(3);this.lastBeat=t}const r=this.manager.chartManager.getMode(),s=this.manager.chartManager.editTimingMode;if(this.lastMode!=r){switch(r){case Z.Edit:case Z.View:this.skipStart.disabled=!1,this.skipEnd.disabled=!1,this.record.disabled=!1,this.playtest.disabled=!1,this.min.contentEditable="true",this.sec.contentEditable="true",this.millis.contentEditable="true",this.beat.contentEditable="true",this.record.style.background="",this.playtest.style.background="",this.view.style.opacity="",this.view.style.transition="",this.view.classList.remove("collapsed"),this.beatDropdown.disabled=!1;break;case Z.Record:this.lastHover=Date.now(),this.skipStart.disabled=!0,this.skipEnd.disabled=!0,this.record.disabled=!1,this.record.style.background="rgba(170, 0, 0, 0.35)",this.playtest.disabled=!0,this.min.contentEditable="false",this.sec.contentEditable="false",this.millis.contentEditable="false",this.beat.contentEditable="false",s!=He.Off&&(this.visible=!1),this.view.classList.add("collapsed"),this.beatDropdown.closeDropdown(),this.beatDropdown.disabled=!0;break;case Z.Play:this.lastHover=Date.now(),this.skipStart.disabled=!0,this.skipEnd.disabled=!0,this.record.disabled=!0,this.playtest.disabled=!1,this.playtest.style.background="rgba(12, 97, 31, 0.35)",this.min.contentEditable="false",this.sec.contentEditable="false",this.millis.contentEditable="false",this.beat.contentEditable="false",s!=He.Off&&(this.visible=!1),this.view.classList.add("collapsed"),this.beatDropdown.closeDropdown(),this.beatDropdown.disabled=!0}this.trackingMovement=!0,this.idleFrames=5,this.lastMode=r}if(this.lastTimingMode!=s){switch(s){case He.Off:this.visible=!0,this.stepsContainer.style.transform="",this.timingContainer.style.transform="",this.editSteps.style.background="rgba(255,255,255,0.15)",this.editTiming.style.background="";break;case He.Add:this.addTimingEvent.style.background="rgba(255,255,255,0.15)";break;case He.Edit:this.addTimingEvent.style.background=""}(this.lastTimingMode==He.Off&&s!=He.Off||this.lastTimingMode!=He.Off&&s==He.Off)&&this.manager.chartManager.clearSelections(),this.trackingMovement=!0,this.idleFrames=5,this.lastTimingMode=s,this.stepsContainer.style.transform=s==He.Off?"":"translateY(-48px)",this.timingContainer.style.transform=s==He.Off?"":"translateY(-48px)",this.editSteps.style.background=s==He.Off?"rgba(255,255,255,0.15)":"",this.editTiming.style.background=s==He.Off?"":"rgba(255,255,255,0.15)"}const n=this.manager.chartManager.chartAudio.isPlaying();if(this.lastPlaying!=n&&(this.playIcon.src=n?Ge.STOP:Ge.PLAY,this.lastPlaying=n),this.playIcon.style.height=this.manager.chartManager.chartAudio.isPlaying()?"28px":"",(r==Z.Play||r==Z.Record)&&this.view.style.opacity==""&&!this.hovering&&Date.now()-this.lastHover>3e3&&(this.view.style.opacity="0.2",this.view.style.transition="2s cubic-bezier(.11,.72,.51,1.14)"),this.trackingMovement){const o=this.noteArrows[0];if(o){const c=o.element.getBoundingClientRect();this.noteArrows.forEach((u,h)=>{u.sprite.position.y=c.top-this.manager.app.view.clientHeight/2-this.manager.app.view.getBoundingClientRect().top+24,u.sprite.position.x=c.left-this.manager.app.view.clientWidth/2+24+h*48,u.bg.position=u.sprite.position,u.highlight.position=u.sprite.position}),this.lastBounds&&Math.abs(this.lastBounds.top-c.top)+Math.abs(this.lastBounds.left-c.left)==0&&(this.idleFrames--,this.idleFrames<0&&(this.trackingMovement=!1,this.lastBounds=void 0,s!=He.Off&&(this.visible=!1))),this.lastBounds=c}const l=this.view.getBoundingClientRect();this.noteArrowMask.y=l.bottom-this.manager.app.view.clientHeight/2-this.manager.app.view.getBoundingClientRect().top}const a=this.manager.chartManager.getEditingNoteType();this.noteArrows.forEach(o=>{if(A.general.smoothAnimations){const l=a==o.type?.15:o.hovered?.05:0;o.highlight.alpha=(l-o.highlight.alpha)*.3+o.highlight.alpha}else o.highlight.alpha=a==o.type?.15:o.hovered?.05:0})}selectText(e){const t=window.getSelection(),r=document.createRange();!t||!r||(r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r))}updateTime(){this.millis.innerText=this.millis.innerText.padEnd(3,"0").slice(0,3);const e=this.parseString(this.min),t=this.parseString(this.sec),r=this.parseString(this.millis);if(e===null||t===null||r===null){this.lastTime=-999;return}let s=e*60+t+r/1e3;s>9999999&&(s=9999999),this.manager.chartManager.setTime(s),this.lastTime=-999}updateBeat(){let e=this.parseString(this.beat);if(e===null){this.lastBeat=-999;return}this.beatDropdown.value=="Measure"&&(e=this.manager.chartManager.loadedChart?.timingData?.getBeatFromMeasure(e)??e*4),e>9999999&&(e=9999999),this.manager.chartManager.setBeat(e),this.lastBeat=-999}parseString(e){try{const t=Dr.evaluate(e.innerText);return!isFinite(t)||t<0?0:t}catch{return null}}}class pT extends xe{app;chartManager;children=[];constructor(e){super(),this.app=e.app,this.chartManager=e,this.addChild(new cT(this)),this.addChild(new dT(this)),this.addChild(new fT(this)),this.addChild(new cs(this)),this.zIndex=2}update(){this.x=this.app.renderer.screen.width/2,this.y=this.app.renderer.screen.height/2,this.children.forEach(e=>e.update())}startPlay(){this.children.forEach(e=>e.startPlay())}endPlay(){this.children.forEach(e=>e.endPlay())}}const Hh=Array(85).fill(void 0).map((i,e)=>33+e),Im=[];for(const i of Hh)for(const e of Hh)Im.push([i,e]);const Gh="<~".split("").map(i=>i.charCodeAt(0)),Wh="~>".split("").map(i=>i.charCodeAt(0));function mT(i,e,t,r=!1,s=!1,n=!1){let a=[];typeof i=="string"?a=i.split("").map(h=>h.charCodeAt(0)):a=[...new Uint8Array(i)];const o=4-a.length%4;for(let h=0;ho.charCodeAt(0)):r=[...new Uint8Array(i)],e){if(r.at(-1)!=Wh.at(-1)||r.at(-2)!=Wh.at(-2))return!1;r.at(0)==Gh.at(0)&&r.at(1)==Gh.at(1)?r=r.slice(2,-2):r=r.slice(void 0,-2)}for(let o=0;o<4;o++)r.push("u".charCodeAt(0));let s=[],n=[];for(const o of r)if(o>=33&&117>=o){if(n.push(o),n.length==5){let l=0;for(const c of n)l=85*l+(c-33);if(l>2**32-1)return!1;s.push(l>>24&255),s.push(l>>16&255),s.push(l>>8&255),s.push(l&255),n=[]}}else if(o==122){if(n.length!=0)return!1;s.push(0),s.push(0),s.push(0),s.push(0)}else if(o==121){if(n.length!=0)return!1;s.push(32),s.push(32),s.push(32),s.push(32)}else{if(t.includes(String.fromCharCode(o)))continue;return!1}const a=4-n.length;return a&&(s=s.slice(void 0,-a)),s}function ei(i){let e=0,t=0,r=129;for(;r&128;){const s=i.shift();if(!s)break;e=e|(s&127)<<7*t++,r=s}return e}function ti(i){const e=[];let t=!1;for(;!t;){let r=i&127;i=i>>7,t=i==0,t||(r=r|128),e.push(r)}return e}const gT=["Hold","Mine","Roll","Lift","Fake"];function yT(i){if(i.startsWith("ArrowVortex:notes:")){const e=Rc(i.slice(18));if(e!==!1){const t=Array.from(e);if(t.shift()!=0)return;const r=ei(t),s=[];for(let n=0;n4)continue;const h=gT[u];if(l==c){if(h=="Hold"||h=="Roll")continue;s.push({type:h,beat:l/48,col:o})}else{if(h=="Mine"||h=="Fake"||h=="Lift")continue;s.push({type:h,beat:l/48,hold:(c-l)/48,col:o})}}else s.push({type:"Tap",beat:ei(t)/48,col:o})}return s}}}function vT(i){const e=[0];e.push(...ti(i.length));for(const t of i)if(t.type=="Tap"){const r=Math.round(t.beat*48);e.push(t.col),e.push(...ti(r))}else{e.push(t.col+128);const r=Math.round(t.beat*48);let s=0;De(t)&&(s=t.hold);const n=Math.round(s*48)+r;e.push(...ti(r)),e.push(...ti(n)),e.push(["Hold","Mine","Roll","Lift","Fake"].indexOf(t.type))}return"ArrowVortex:notes:"+Bc(e).map(t=>String.fromCharCode(t)).join("")}const Yo=["BPMS","STOPS","DELAYS","WARPS","TIMESIGNATURES","TICKCOUNTS","COMBOS","SPEEDS","SCROLLS","FAKES","LABELS","ATTACKS","BGCHANGES","FGCHANGES"];function or(i){const e=new ArrayBuffer(4);return new DataView(e).setUint32(0,i,!0),Array.from(new Uint8Array(e))}function lr(i){const e=new Uint8Array(i.splice(0,4));return new DataView(e.buffer).getUint32(0,!0)}function gr(i){const e=new ArrayBuffer(8);return new DataView(e).setFloat64(0,i,!0),Array.from(new Uint8Array(e))}function yr(i){const e=new Uint8Array(i.splice(0,8)),t=new DataView(e.buffer);return de(t.getFloat64(0,!0),3)}function bT(i){return[i.length,...i.split("").map(e=>e.charCodeAt(0))]}function wT(i){const e=i.shift();if(!e)return"";let t="";for(let r=0;re.charCodeAt(0)))}function cr(i){const e=ei(i);if(!e)return"";let t="";for(let r=0;r{if(e.type=="ATTACKS"||e.type=="BGCHANGES"||e.type=="FGCHANGES")return!0;const t=Math.round(e.beat*48)/48;if(Math.abs(t-e.beat)>5e-4)return!0;if(e.type=="FAKES"||e.type=="WARPS"){const r=Math.round(e.value*48)/48;if(Math.abs(r-e.value)>5e-4)return!0}return e.type=="LABELS"&&e.value.length>255||e.type=="TIMESIGNATURES"&&(e.upper>2**32-1||e.lower>2**32-1)||e.type=="COMBOS"&&(e.hitMult>2**32-1||e.missMult>2**32-1)||e.type=="TICKCOUNTS"&&e.value>2**32-1})?AT(i):xT(i)}function xT(i){const e=[],t=new Map;i.forEach(r=>{t.has(r.type)||t.set(r.type,[]),t.get(r.type)?.push(r)});for(const[r,s]of t.entries())if(!(r=="ATTACKS"||r=="BGCHANGES"||r=="FGCHANGES")){e.push(s.length),e.push(Yo.indexOf(r));for(const n of s)switch(e.push(...or(Math.round(n.beat*48))),n.type){case"BPMS":case"STOPS":case"DELAYS":case"SCROLLS":e.push(...gr(n.value));break;case"FAKES":case"WARPS":e.push(...or(Math.round(n.value*48)));break;case"TIMESIGNATURES":e.push(...or(Math.round(n.upper))),e.push(...or(Math.round(n.lower)));break;case"COMBOS":e.push(...or(Math.round(n.hitMult))),e.push(...or(Math.round(n.missMult)));break;case"TICKCOUNTS":e.push(...or(Math.round(n.value)));break;case"SPEEDS":e.push(...gr(n.value)),e.push(...gr(n.delay)),e.push(...or(n.unit=="B"?0:1));break;case"LABELS":e.push(...bT(n.value))}}return e.push(0),"ArrowVortex:tempo:"+Bc(e).map(r=>String.fromCharCode(r)).join("")}function AT(i){const e=[],t=new Map;i.forEach(r=>{t.has(r.type)||t.set(r.type,[]),t.get(r.type)?.push(r)});for(const[r,s]of t.entries()){e.push(...ti(s.length)),e.push(Yo.indexOf(r));for(const n of s)switch(e.push(...ti(Math.round((n.type=="ATTACKS"?n.second:n.beat)*1e3))),n.type){case"BPMS":case"STOPS":case"DELAYS":case"SCROLLS":case"FAKES":case"WARPS":e.push(...gr(n.value));break;case"TIMESIGNATURES":e.push(...ti(Math.round(n.upper))),e.push(...ti(Math.round(n.lower)));break;case"COMBOS":e.push(...ti(Math.round(n.hitMult))),e.push(...ti(Math.round(n.missMult)));break;case"TICKCOUNTS":e.push(...ti(Math.round(n.value)));break;case"SPEEDS":e.push(...gr(n.value)),e.push(...gr(n.delay)),e.push(n.unit=="B"?0:1);break;case"LABELS":e.push(...hr(n.value));break;case"ATTACKS":e.push(...gr(n.value)),e.push(n.endType=="LEN"?0:1),e.push(...hr(n.mods));break;case"BGCHANGES":case"FGCHANGES":e.push((n.crossFade?1:0)+((n.stretchRewind?1:0)<<1)+((n.stretchNoLoop?1:0)<<2)),e.push(...hr(n.file)),e.push(...gr(n.updateRate)),e.push(...hr(n.effect)),e.push(...hr(n.file2)),e.push(...hr(n.transition)),e.push(...hr(n.color1)),e.push(...hr(n.color2))}}return"SMEditor:tempo:"+Bc(e).map(r=>String.fromCharCode(r)).join("")}function ET(i){if(i.startsWith("SMEditor:tempo:"))return ST(i);if(i.startsWith("ArrowVortex:tempo:"))return TT(i)}function TT(i){if(!i.startsWith("ArrowVortex:tempo:"))return;const e=Rc(i.slice(18)),t=[];if(e===!1)return;const r=Array.from(e);try{for(;;){const s=r.shift();if(s===void 0)return;if(s==0)break;const n=r.shift();if(n===void 0)return;const a=Yo[n];for(let o=0;o0,stretchRewind:(c&2)>0,stretchNoLoop:(c&4)>0,effect:cr(r),file2:cr(r),transition:cr(r),color1:cr(r),color2:cr(r)})}}}}}catch{return}return t}class Pm{static _model;static async getModel(){return this._model||await this._load(),this._model}static async _load(){this._model=[];const e=localStorage.getItem("recentFiles");if(e){try{const t=JSON.parse(e);if(!Array.isArray(t))return;for(const r of t)typeof r!="object"||Array.isArray(r)||typeof r?.name!="string"||typeof r?.path!="string"||this._model.find(s=>s.path==r.path)||this._model.push({name:r.name,path:r.path})}catch{console.log("failed to load entries");return}await this.saveEntries()}}static async getRecents(){return await this.getModel()}static async addSM(e,t){const r=await this.getModel(),s=r.findIndex(n=>n.path==e);s!=-1&&r.splice(s,1),r.unshift({name:t.properties.TITLE??"Untitled Song",path:e}),this.saveEntries()}static async limitEntries(){(await this.getModel()).splice(15)}static async saveEntries(){this.limitEntries();const e=await Promise.all(this._model.map(async t=>await qe.hasFile(t.path)));this._model=this._model.filter((t,r)=>e[r]),localStorage.setItem("recentFiles",JSON.stringify(this._model))}}class zh{static menuElement;static closeTimeout;static open(e,t){this.buildMenu(e),this.menuElement.style.display="none",setTimeout(()=>this.fitContextMenu(t)),this.menuElement.classList.add("entering"),clearTimeout(this.closeTimeout),setTimeout(()=>this.menuElement?.classList.remove("entering"),300),this.menuElement.style.left=t.clientX+"px",this.menuElement.style.top=t.clientY+"px"}static fitContextMenu(e){this.menuElement.style.display="";const t=this.menuElement.getBoundingClientRect(),r=window.innerHeight-t.bottom-20,s=window.innerWidth-t.right-20;r<0&&(this.menuElement.style.top=e.clientY+r+"px"),s<0&&(this.menuElement.style.left=e.clientX+s+"px"),this.menuElement.style.transformOrigin=`${Math.max(0,-s)}px ${Math.max(0,-r)}px`}static close(){this.menuElement&&(this.menuElement.classList.add("exiting"),this.closeTimeout=setTimeout(()=>this.menuElement.replaceChildren(),300))}static buildMenu(e){const t=document.createElement("div");if(t.appendChild(this.createElement(e,{type:"selection",id:"cut"})),t.appendChild(this.createElement(e,{type:"selection",id:"copy"})),t.appendChild(this.createElement(e,{type:"selection",id:"paste"})),e.chartManager.getMode()==Z.Edit&&e.chartManager.hasSelection()){const r=document.createElement("div");r.classList.add("seperator"),t.appendChild(r),Os.selection.options.slice(0,-2).forEach(s=>{t.appendChild(this.createElement(e,s))})}this.menuElement=t,t.id="context-menu",document.getElementById("context-menu")?.replaceWith(this.menuElement)}static createElement(e,t){if(t.type=="seperator"){const r=document.createElement("div");return r.classList.add("seperator"),r}if(t.type=="selection"||t.type=="checkbox"||t.type=="dropdown"){const r=document.createElement("div"),s=document.createElement("div"),n=document.createElement("div");let a;if(t.type=="selection"||t.type=="checkbox"){const o=ht[t.id];a=document.createElement("div"),a.innerText=it.getKeybindString(t.id),a.classList.add("keybind","unselectable"),n.innerText=o.label;let l=o.disabled;typeof l=="function"&&(l=l(e)),l&&r.classList.add("disabled"),r.addEventListener("click",()=>{l||(o.callback(e),this.close())})}else a=document.createElement("img"),a.classList.add("icon"),a.src=Ge.CHEVRON,a.style.transform="rotate(-90deg)",n.innerText=typeof t.title=="function"?t.title(e):t.title;if(s.appendChild(n),s.appendChild(a),r.appendChild(s),r.classList.add("menu-item"),s.classList.add("menu-item-title","menu-hover"),n.classList.add("title","unselectable"),t.type=="dropdown"){const o=document.createElement("div");r.appendChild(o),o.classList.add("menubar-dropdown"),t.options.map(l=>this.createElement(e,l)).forEach(l=>o.appendChild(l))}if(t.type=="checkbox"){let o=t.checked;typeof o=="function"&&(o=o(e)),o&&(n.innerText="✓ "+n.innerText)}return r}if(t.type=="menu"){const r=document.createElement("div"),s=document.createElement("div"),n=document.createElement("div");return r.appendChild(s),s.innerText=t.title,r.appendChild(n),s.classList.add("title","unselectable"),r.classList.add("menu-item","menu-main"),s.classList.add("menu-hover"),n.classList.add("menubar-dropdown","unselectable"),r.onmouseenter=()=>{n.replaceChildren(...t.options.map(a=>this.createElement(e,a)))},r.onmouseleave=()=>{n.replaceChildren()},r}return document.createElement("div")}}const CT={fontName:"Main",fontSize:20,fill:["#ffffff"]};class MT extends xe{renderer;barlineMap=new Map;barlineLabelMap=new Map;barlinePool=new hs({create:()=>new Be(ie.WHITE)});barlineLabelPool=new hs({create:()=>new Fe("",CT)});constructor(e){super(),this.renderer=e;const t=()=>{this.barlineMap.clear(),this.barlineLabelMap.clear(),this.barlinePool.destroyAll(),this.barlineLabelPool.destroyAll()};se.on("timeSigChanged",t),this.on("destroyed",()=>se.off("timeSigChanged",t)),this.addChild(this.barlinePool,this.barlineLabelPool)}update(e,t){this.visible=this.renderer.chartManager.getMode()!=Z.Play||!A.play.hideBarlines;for(const[r,s]of this.getBarlineBeats(e,t)){if(!this.barlineMap.has(r)){const n=this.barlinePool.createChild();if(!n)continue;Object.assign(n,{width:this.renderer.chart.gameType.notefieldWidth+128,height:s?4:1,visible:!0}),n.anchor.set(.5),this.barlineMap.set(r,n)}if(s&&!this.barlineLabelMap.has(r)){const n=this.barlineLabelPool.createChild();if(!n)continue;Object.assign(n,{x:(this.renderer.chart.gameType.notefieldWidth+128)/-2-16,text:`${Math.round(this.renderer.chart.timingData.getMeasure(r))}`,visible:!0}),n.anchor.set(1,.5),this.barlineLabelMap.set(r,n)}}for(const[r,s]of this.barlineMap.entries()){if(rt){this.barlineMap.delete(r),this.barlinePool.destroyChild(s);continue}s.y=this.renderer.getYPosFromBeat(r)}for(const[r,s]of this.barlineLabelMap.entries()){if(rt){this.barlineLabelMap.delete(r),this.barlineLabelPool.destroyChild(s);continue}s.y=this.renderer.getYPosFromBeat(r),s.scale.y=A.chart.reverse?-1:1}}*getBarlineBeats(e,t){e=Math.max(0,e);const r=this.renderer.chart.timingData,s=r.getTimingData("TIMESIGNATURES");let n=r.getTimingEventAtBeat("TIMESIGNATURES",e),a=n?s.findIndex(d=>d.beat==n.beat):-1,o=r.getDivisionLength(e);const l=r.getDivisionOfMeasure(e)%1*o;let c=Math.max(0,e-l);c=s[a+1]?.beat&&(a++,n=s[a],c=n.beat,o=r.getDivisionLength(c),u=0,h=n.upper)}}class kT extends Fe{renderer;constructor(e){super("",{fontName:"Fancy"}),this.y=50,this.anchor.set(.5),this.renderer=e}update(){const e=this.renderer.chartManager.gameStats;if(this.visible=this.renderer.chartManager.getMode()==Z.Play,this.scale.y=A.chart.reverse?-1:1,!e)return;const t=e.getCombo()==0?e.getMissCombo():e.getCombo();t<4?this.text="":this.text=t+"",e.getCombo()==0?this.tint=et.getCollection(A.play.timingCollection).getMissJudgment().color:e.getBestJudge()?this.tint=pm(e.getBestJudge().color,Math.sin(Date.now()/225)*.2+1.2):this.tint=16777215}}const IT=1,tf=15,PT={fontName:"Fancy",fontSize:12};class BT extends xe{barlines=new xe;barline;currentMedian;errorText=new Fe("",PT);errorTextTime=-1;renderer;target=0;constructor(e){super(),this.y=10,this.renderer=e,this.barline=new Be(ie.WHITE),this.barline.anchor.set(.5),this.barline.height=1,this.barline.alpha=.5;const t=new Be(ie.WHITE);t.width=2,t.height=tf,t.anchor.set(.5),this.currentMedian=new ps,this.currentMedian.beginFill(16777215),this.currentMedian.moveTo(0,-10),this.currentMedian.lineTo(5,-15),this.currentMedian.lineTo(-5,-15),this.currentMedian.lineTo(0,-10),this.errorText.y=-25,this.errorText.anchor.set(.5),this.addChild(this.barline,t,this.barlines,this.currentMedian,this.errorText)}update(){this.visible=this.renderer.chartManager.getMode()==Z.Play;for(const e of this.barlines.children){const t=e,r=(Date.now()-t.createTime)/5e3;r<.05?e.alpha=1:r<.3?e.alpha=Ls(1,.2,(r-.05)/.25):r<.9?e.alpha=.2:e.alpha=(1-r)*3}this.errorText.alpha=Je((2e3-(Date.now()-this.errorTextTime))/1e3,0,1),this.barline.width=et.getCollection(A.play.timingCollection).maxWindowMS()/1e3*2*400,Ht(this.barlines.children,e=>Date.now()-e.createTime>5e3),A.general.smoothAnimations?this.currentMedian.x=(this.currentMedian.x-this.target)*.8+this.target:this.currentMedian.x=this.target,this.errorText.scale.y=A.chart.reverse?-1:1,this.currentMedian.scale.y=A.chart.reverse?-1:1}addBar(e,t){if(!ri(t)&&!Gi(t))return;const r=new Be(ie.WHITE);r.width=IT,r.height=tf,r.anchor.set(.5),r.x=e*400,r.tint=t.color,r.createTime=Date.now(),r.miss=ri(t),r.ms=Math.round(e*1e3),this.errorText.tint=t.color,this.errorText.text=(e*1e3).toFixed(1)+"ms",this.errorTextTime=Date.now(),this.barlines.addChild(r),this.target=jo(this.barlines.children.filter(s=>!s.miss).map(s=>s.ms))*.4}reset(){this.currentMedian.x=0,this.target=0,Ht(this.barlines.children,()=>!0)}}class RT extends Be{createTime=-1;active=!1;type=cm;constructor(){super(),this.y=-40,this.anchor.set(.5)}update(){if(this.visible=this.active,this.active){const e=(Date.now()-this.createTime)/1e3;let t=1.2;if(et.getCollection(A.play.timingCollection).shouldHideNote(this.type)||(t=.8),e<.1){const r=1-(1-e/.1)*(1-e/.1),s=(1-t)*r+t;this.scale.x=.4*s,this.scale.y=.4*s*(A.chart.reverse?-1:1)}else if(e>.6&&e<.8){const r=(e-.6)/.2*(e-.6)/.2;this.scale.x=.4*(1-r),this.scale.y=.4*(1-r)*(A.chart.reverse?-1:1)}else e>.8&&(this.active=!1)}}doJudge(e,t){if(!Gi(t)&&!ri(t))return;const r=t.judgmentTexture.getTexture(e,t);r&&(this.texture=r,this.texture.updateUvs(),this.active=!0,this.type=t,this.createTime=Date.now(),A.play.judgmentTilt?this.rotation=Je(e,-.05,.05)*300/180*Math.PI:this.rotation=0)}reset(){this.active=!1}}class DT extends xe{previewArea=new Be(ie.WHITE);previewText=new Fe("SONG PREVIEW",{fontName:"Main",fontSize:13});renderer;constructor(e){super(),this.renderer=e,Object.assign(this.previewArea,{alpha:.2,tint:11052482,width:this.renderer.chart.gameType.notefieldWidth+96,height:64}),this.previewText.x=-this.previewArea.width/2+5,this.previewArea.anchor.x=.5,this.addChild(this.previewArea,this.previewText)}update(){const e=Number(this.renderer.chart.sm.properties.SAMPLESTART),t=Number(this.renderer.chart.sm.properties.SAMPLELENGTH);if(Number.isNaN(e)||Number.isNaN(t)||this.renderer.chartManager.getMode()==Z.Play&&A.play.hideBarlines){this.visible=!1;return}this.visible=!0;let r=this.renderer.getYPosFromSecond(e),s=this.renderer.getYPosFromSecond(e+t);si=="B"?"Beats":"Seconds",deserialize:i=>i=="Beats"?"B":"T"}}}]},TIMESIGNATURES:{title:"Time Signature Event",width:200,rows:[{label:"Upper",key:"upper",input:{type:"spinner",step:1,precision:0,min:1}},{label:"Lower",key:"lower",input:{type:"spinner",step:1,precision:0,min:1}}]},COMBOS:{title:"Combo Event",width:200,description:"Multiplies the combo gained from hitting/missing notes after this event.",rows:[{label:"Hit multiplier",key:"hitMult",input:{type:"spinner",step:1,precision:0,min:0}},{label:"Miss multiplier",key:"missMult",input:{type:"spinner",step:1,precision:0,min:0}}]},ATTACKS:{title:"Attack Event",width:200,description:"Applies a modifier to the playfield. Can specify the length of the applied attack in seconds or the end time of the attack.",rows:[{label:"Timing type",key:"endType",input:{type:"dropdown",items:["Length","End"],transformers:{serialize:i=>i=="LEN"?"Length":"End",deserialize:i=>i=="Length"?"LEN":"END"}}},{label:"Seconds",key:"value",input:{type:"spinner",precision:3}},{label:"Mods",key:"mods",input:{type:"text"}}]},BGCHANGES:{title:"BG Change Event",width:250,rows:[{label:"File",key:"file",input:{type:"text"}},{label:"Update rate",key:"updateRate",input:{type:"spinner",precision:3,min:0}},{label:"Crossfade",key:"crossfade",input:{type:"checkbox"}},{label:"StretchRewind",key:"stretchRewind",input:{type:"checkbox"}},{label:"StretchNoLoop",key:"StretchNoLoop",input:{type:"checkbox"}},{label:"Effect",key:"effect",input:{type:"text"}},{label:"File2",key:"file2",input:{type:"text"}},{label:"Transition",key:"transition",input:{type:"text"}},{label:"Color1",key:"color1",input:{type:"text"}},{label:"Color2",key:"color2",input:{type:"text"}}]},FGCHANGES:{title:"FG Change Event",width:250,rows:[{label:"File",key:"file",input:{type:"text"}},{label:"Update rate",key:"updateRate",input:{type:"spinner",precision:3,min:0}},{label:"Crossfade",key:"crossfade",input:{type:"checkbox"}},{label:"StretchRewind",key:"stretchRewind",input:{type:"checkbox"}},{label:"StretchNoLoop",key:"StretchNoLoop",input:{type:"checkbox"}},{label:"Effect",key:"effect",input:{type:"text"}},{label:"File2",key:"file2",input:{type:"text"}},{label:"Transition",key:"transition",input:{type:"text"}},{label:"Color1",key:"color1",input:{type:"text"}},{label:"Color2",key:"color2",input:{type:"text"}}]}};class wi{static activePopup;timingBox;popup;zoomer;editText;timingData;rows=[];onTimingChange;clickOutside;moveInterval;modifyBox;onConfirm=()=>{};persistent=!1;constructor(e,t,r=!1){e.popup=this,this.timingBox=e,this.timingData=t,this.modifyBox=r,this.popup=this.build(),this.popup.style.display="none",setTimeout(()=>this.movePosition()),this.onTimingChange=this.updateValues.bind(this),this.clickOutside=s=>{this.popup.contains(s.target)||this.close()},se.on("timingModified",this.onTimingChange),wi.activePopup?.persistent?e.popup=void 0:(document.getElementById("popups")?.appendChild(this.popup),this.moveInterval=setInterval(()=>this.movePosition(),150),wi.activePopup?.close(),wi.activePopup=this)}movePosition(){this.popup.style.display="";const e=this.timingBox.backgroundObj.getBounds(),t=e.left+e.width/2,r=rf[this.timingBox.event.type].width??150,s=r/2+15,n=window.innerWidth-r/2-15;this.popup.style.left=`${Je(t,s,n)}px`;const a=e.top+e.height/2;this.popup.style.top=`${e.top+e.height}px`,a+this.popup.clientHeight>window.innerHeight-15&&(this.popup.style.transform="translate(-50%, -100%)",this.popup.style.top=`${e.top-e.height/2}px`)}build(){const e=rf[this.timingBox.event.type],t=document.createElement("div");t.classList.add("popup");const r=document.createElement("div");r.classList.add("popup-zoomer"),r.style.width=e.width?`${e.width}px`:"150px",r.style.backgroundColor=Uh(Tr[this.timingBox.event.type].toString(16).padStart(6,"0"),"#333333",.75),this.zoomer=r,t.appendChild(r);const s=document.createElement("div");if(s.innerText=e.title,s.classList.add("popup-title"),r.appendChild(s),e.description){const u=document.createElement("div");u.innerText=e.description,r.appendChild(u),u.classList.add("popup-desc")}const n=document.createElement("div");n.classList.add("popup-grid"),r.appendChild(n),e.rows.forEach(u=>n.append(...this.buildRow(u)));const a=document.createElement("div");a.innerText="click to edit",a.style.marginTop="4px",a.style.height="10px",r.appendChild(a),a.classList.add("popup-desc"),this.editText=a;const o=document.createElement("div");o.classList.add("popup-options");const l=document.createElement("button");l.innerText="Ok",l.onclick=()=>{this.close(),this.onConfirm(this.timingBox.event)},l.classList.add("confirm"),o.append(l);const c=document.createElement("button");return c.innerText="Delete",c.onclick=()=>{this.modifyBox||this.timingData.delete(this.timingBox.songTiming,this.timingBox.event.type,this.timingBox.event.type=="ATTACKS"?this.timingBox.event.second:this.timingBox.event.beat),this.close()},c.classList.add("delete"),o.append(c),r.append(o),t}buildRow(e){const t=structuredClone(this.timingBox.event),r=document.createElement("div");r.innerText=e.label,r.classList.add("popup-label");const s=[];switch(s.push(r),e.input.type){case"spinner":{const n=ot.create(t[e.key],e.input.step,e.input.precision,e.input.min,e.input.max);n.onChange=a=>{a!==void 0&&(this.modifyBox?Object.assign(this.timingBox.event,{[e.key]:a}):this.timingData.insert(this.timingBox.songTiming,this.timingBox.event.type,Object.assign(t,{[e.key]:a}),this.timingBox.event.beat))},this.rows.push({data:e,el:n}),s.push(n.view);break}case"text":{const n=document.createElement("input");n.type="text",n.autocomplete="off",n.spellcheck=!1,n.onkeydown=a=>{a.key=="Enter"&&n.blur()},n.onblur=()=>{this.modifyBox?Object.assign(this.timingBox.event,{[e.key]:n.value}):this.timingData.insert(this.timingBox.songTiming,this.timingBox.event.type,Object.assign(t,{[e.key]:n.value}),this.timingBox.event.beat)},n.value=t[e.key],this.rows.push({data:e,el:n}),s.push(n);break}case"dropdown":{if(e.input.transformers){const n=e.input.transformers.deserialize,a=e.input.transformers.serialize,o=hi.create(e.input.items,a(t[e.key]));o.onChange(l=>{this.modifyBox?Object.assign(this.timingBox.event,{[e.key]:n(l)}):this.timingData.insert(this.timingBox.songTiming,this.timingBox.event.type,Object.assign(t,{[e.key]:n(l)}),this.timingBox.event.beat)}),this.rows.push({data:e,el:o}),s.push(o.view)}else{const n=hi.create(e.input.items,t[e.key]);n.onChange(a=>{this.timingData.insert(this.timingBox.songTiming,this.timingBox.event.type,{[e.key]:a},this.timingBox.event.beat)}),this.rows.push({data:e,el:n}),s.push(n.view)}break}case"checkbox":{const n=document.createElement("input");n.type="checkbox",n.checked=t[e.key],n.onchange=()=>{this.modifyBox?Object.assign(this.timingBox.event,{[e.key]:n.checked}):this.timingData.insert(this.timingBox.songTiming,this.timingBox.event.type,Object.assign(t,{[e.key]:n.checked}),this.timingBox.event.beat)},this.rows.push({data:e,el:n}),s.push(n);break}}return s}updateValues(){const e=this.timingData.getTimingEventAtBeat(this.timingBox.event.type,this.timingBox.event.beat);if(!this.timingBox||!e||e.beat!=this.timingBox.event.beat){this.close();return}this.rows.forEach(t=>{switch(t.data.input.type){case"spinner":{t.el.setValue(e[t.data.key]);break}case"text":{t.el.value=e[t.data.key];break}case"dropdown":{const r=t.el;t.data.input.transformers?r.setSelected(t.data.input.transformers.serialize(e[t.data.key])):r.setSelected(e[t.data.key]);break}case"checkbox":{t.el.checked=e[t.data.key];break}}})}close(){this.persistent=!1,se.off("timingModified",this.onTimingChange),window.removeEventListener("click",this.clickOutside),clearInterval(this.moveInterval),this.popup.classList.add("exiting"),setTimeout(()=>this.popup.remove(),200),this.timingBox.popup=void 0,wi.activePopup=void 0}select(){this.persistent=!0,this.zoomer.classList.add("selected"),this.editText.style.transform="scale(0)",this.editText.style.height="0px",setTimeout(()=>window.addEventListener("click",this.clickOutside),200)}detach(){clearInterval(this.moveInterval)}}const Vh={fontName:"Main",fontSize:15},vr={BPMS:55,STOPS:55,DELAYS:55,WARPS:55,FAKES:55,COMBOS:40,SPEEDS:80,LABELS:80,SCROLLS:55,TIMESIGNATURES:40,TICKCOUNTS:40,BGCHANGES:55,FGCHANGES:55,ATTACKS:55};class FT extends xe{tracks=new xe;renderer;timingBoxMap=new Map;wasEditingTiming=!1;boxPool=new hs({create:()=>{const e=new xe;return e.textObj=new Fe("",Vh),e.backgroundObj=new Nt,e.selection=new Nt("onlyBorder"),e.selection.tint=3841008,e.addChild(e.backgroundObj,e.textObj,e.selection),e}});ghostBox;timingDirty=!1;constructor(e){super(),this.renderer=e,this.boxPool.sortableChildren=!0,this.sortableChildren=!0,this.addChild(this.tracks,this.boxPool);const t=()=>this.timingDirty=!0;se.on("timingModified",t),this.on("destroyed",()=>se.off("timingModified",t))}update(e,t){this.renderer.chartManager.editTimingMode!=He.Add&&(this.ghostBox?.removeFromParent(),this.ghostBox?.destroy(),this.ghostBox=void 0),this.updateTracks(),this.updateBoxes(e,t)}createTrack(e,t){const r=Object.assign(new Be(ie.WHITE),{alpha:0,width:vr[e],name:e,height:5e3,x:t,type:e,lastX:0,tint:2503250,targetAlpha:0});return r.anchor.y=.5,this.tracks.addChild(r),r}initializeBox(e,t){Object.assign(e,{event:t,songTiming:this.renderer.chart.timingData.isTypeChartSpecific(t.type),lastX:void 0,lastAnchor:void 0,animationId:void 0,zIndex:t.beat,eventMode:"static"}),e.textObj.text=this.getLabelFromEvent(t),e.textObj.anchor.set(.5,.55),e.backgroundObj.width=e.textObj.width+10,e.backgroundObj.height=25,e.backgroundObj.position.x=-e.backgroundObj.width/2,e.backgroundObj.position.y=-25/2,e.selection.width=e.textObj.width+10,e.selection.height=25,e.selection.position=e.backgroundObj.position,e?.popup?.persistent!==!0&&e.popup?.close(),e.popup=void 0}addDragListeners(e,t){e.on("mouseenter",()=>{e?.popup?.persistent!==!0&&(this.renderer.chartManager.eventSelection.timingEvents.length>0||this.renderer.isDragSelecting()||(e.popup?.close(),this.renderer.chartManager.getMode()==Z.Edit&&(new wi(e,this.renderer.chart.timingData),e.popup&&(e.popup.onConfirm=()=>{this.renderer.chartManager.removeEventFromSelection(t)}))))}),e.on("mouseleave",()=>{e?.popup?.persistent!==!0&&e.popup?.close()});let r=0,s;const n=a=>{const o=s,l=this.toLocal(a.global);if(Math.abs(l.y-r)<32){this.renderer.chartManager.eventSelection.shift&&(this.renderer.chartManager.eventSelection.shift={beatShift:0});return}e.popup?.close();const c=this.renderer.getBeatFromYPos(l.y),u=A.chart.snap==0?1/1e3:A.chart.snap;let h=Math.round(c/u)*u;Math.abs(h-c)>Math.abs(c-o.beat)&&(h=o.beat),this.renderer.chartManager.eventSelection.shift||={beatShift:0},this.renderer.chartManager.eventSelection.shift.beatShift=Math.max(-Math.min(...this.renderer.chartManager.eventSelection.timingEvents.map(d=>d.beat)),h-o.beat)};e.on("pointerdown",a=>{if(Nh(a)){this.renderer.chartManager.clearSelections(),this.renderer.chartManager.addEventToSelection(t),wi.activePopup?.close();return}if(a.stopImmediatePropagation(),this.renderer.chartManager.eventSelection.timingEvents.includes(t)?(a.getModifierState("Control")||a.getModifierState("Meta"))&&this.renderer.chartManager.removeEventFromSelection(t):(!a.getModifierState("Control")&&!a.getModifierState("Meta")&&!a.getModifierState("Shift")&&this.renderer.chartManager.clearSelections(),this.renderer.chartManager.addEventToSelection(t)),this.renderer.chartManager.getMode()==Z.Edit&&this.renderer.chartManager.eventSelection.timingEvents.length==1&&(e?.popup||(wi.activePopup?.close(),new wi(e,this.renderer.chart.timingData),e.popup.onConfirm=()=>{this.renderer.chartManager.removeEventFromSelection(t)})),e.popup&&!a.getModifierState("Control")&&!a.getModifierState("Meta")&&!a.getModifierState("Shift")?e.popup.select():e.popup?.close(),r=e.y,s=t,this.renderer.chartManager.editTimingMode==He.Add)return;this.renderer.on("pointermove",n);const o=()=>{this.renderer.off("pointermove",n),this.renderer.off("pointerup",o),(this.renderer.chartManager.eventSelection.shift?.beatShift??0)!=0&&this.renderer.chartManager.modifyEventSelection(l=>(l.type=="ATTACKS"&&(l.second=this.renderer.chart.timingData.getSecondsFromBeat(l.beat+this.renderer.chartManager.eventSelection.shift.beatShift)),l.beat+=this.renderer.chartManager.eventSelection.shift.beatShift,l)),this.renderer.chartManager.eventSelection.shift=void 0};this.renderer.on("pointerup",o)})}updateTracks(){const e=A.chart.timingEventOrder.left,t=A.chart.timingEventOrder.right,r=this.renderer.chartManager.editTimingMode!=He.Off&&this.renderer.chartManager.getMode()==Z.Edit;let s=-this.renderer.chart.gameType.notefieldWidth*.5-128;for(let n=e.length-1;n>=0;n--){const a=e[n],o=this.tracks.getChildByName(a)??this.createTrack(a,s);o.lastX!=s&&(o.lastX=s,o.targetAlpha=n%2==0?.1:0,Ft.animate(o,{0:{x:"inherit","anchor.x":"inherit"},1:{x:s,"anchor.x":1}},.3,Yt(0,0,.16,1.01),()=>{},`track-${a}-x`),Ft.animate(o,{0:{alpha:"inherit"},1:{alpha:r?o.targetAlpha:0}},.3,Yt(0,0,.16,1.01),()=>{},`track-${a}-alpha`)),s-=vr[a]}s=this.renderer.chart.gameType.notefieldWidth*.5+128;for(let n=0;n{},`track-${a}-x`),Ft.animate(o,{0:{alpha:"inherit"},1:{alpha:r?o.targetAlpha:0}},.3,Yt(0,0,.16,1.01),()=>{},`track-${a}-alpha`)),s+=vr[a]}if(this.wasEditingTiming!=r){this.wasEditingTiming=r;for(const n of this.tracks.children)Ft.animate(n,{0:{alpha:"inherit"},1:{alpha:r?n.targetAlpha:0}},.3,Yt(0,0,.16,1.01),()=>{},`track-${n.type}-alpha`)}}updateBoxes(e,t){this.timingDirty&&(this.timingBoxMap.clear(),this.boxPool.destroyAll(),this.timingDirty=!1,wi.activePopup?.close());const r=this.renderer.chartManager.editTimingMode!=He.Off&&this.renderer.chartManager.getMode()==Z.Edit;this.boxPool.visible=this.renderer.chartManager.getMode()!=Z.Play||!A.play.hideBarlines;const s=this.renderer.chart.timingData.getSecondsFromBeat(e),n=this.renderer.chart.timingData.getSecondsFromBeat(t);for(const o of this.renderer.chart.timingData.getTimingData()){if(to.beat||s>o.second)&&!this.timingBoxMap.has(o)){const l=this.boxPool.createChild();if(!l)break;this.initializeBox(l,o),this.addDragListeners(l,o),this.timingBoxMap.set(o,l)}}const a={beat:-Number.MAX_SAFE_INTEGER,second:-Number.MAX_SAFE_INTEGER,leftOffset:0,rightOffset:0};for(const[o,l]of this.timingBoxMap.entries()){if(o.beatt){this.timingBoxMap.delete(o),this.boxPool.destroyChild(l);continue}let c=0,u=0;const h=l.backgroundObj.width,d=A.chart.timingEventOrder.right.includes(o.type)?"right":"left";r?(c=this.tracks.getChildByName(o.type)?.x??l.x,c+=vr[o.type]/2*(c>0?1:-1),u=.5):(c=(d=="right"?1:-1)*(this.renderer.chart.gameType.notefieldWidth*.5+80),d=="left"&&(c-=30),(a.beat!=o.beat||o.second&&a.second!=o.second)&&(a.leftOffset=0,a.rightOffset=0,a.beat=o.beat,a.second=o.second),d=="left"?(c-=a.leftOffset,a.leftOffset+=h+5):(c+=a.rightOffset,a.rightOffset+=h+5),u=d=="right"?0:1),l.lastX===void 0||l.lastAnchor===void 0?(l.position.x=c,l.pivot.x=(u-.5)*h):(l.lastX!=c||l.lastAnchor!=u)&&(l.animationId=Ft.animate(l,{0:{x:"inherit","pivot.x":"inherit"},1:{x:c,"pivot.x":(u-.5)*h}},.3,Yt(0,0,.16,1.01),()=>{},l.animationId)),l.lastX=c,l.lastAnchor=u,l.y=A.chart.CMod&&o.type=="ATTACKS"?this.renderer.getYPosFromSecond(o.second):this.renderer.getYPosFromBeat(o.beat),l.textObj.scale.y=A.chart.reverse?-1:1;const f=this.renderer.chartManager.getMode()!=Z.Play&&(this.renderer.chartManager.eventSelection.timingEvents.includes(o)||this.renderer.chartManager.eventSelection.inProgressTimingEvents.includes(o));if(l.backgroundObj.tint=f?pm(Tr[o.type]??0,Math.sin(Date.now()/320)*.4+1.5):Tr[o.type]??0,l.selection.alpha=f?1:0,l.visible=!f||!this.renderer.chartManager.eventSelection.shift,this.renderer.chartManager.editTimingMode!=He.Off){const p=this.renderer.selectionTest(l);!f&&p&&this.renderer.chartManager.addEventToDragSelection(o),f&&!p&&this.renderer.chartManager.removeEventFromDragSelection(o)}}}updateGhostEvent(e){const t=A.chart.snap==0?.001:A.chart.snap,r=Math.round(this.renderer.getBeatFromYPos(e.y)/t)*t,s=this.ghostBox?.popup?this.ghostBox.event.type:this.getClosestTrack(e.x)?.name;if(!s){this.ghostBox?.removeFromParent(),this.ghostBox?.destroy(),this.ghostBox=void 0;return}if(!this.ghostBox){const o=new xe;o.textObj=new Fe("",Vh),o.backgroundObj=new Nt,o.selection=new Nt("onlyBorder"),o.guideLine=new Be(ie.WHITE),o.selection.tint=3841008,o.selection.alpha=0,o.addChild(o.guideLine,o.backgroundObj,o.textObj,o.selection),this.addChild(o),o.visible=!0,o.textObj.anchor.set(.5,.55),o.backgroundObj.height=25,o.selection.height=25,o.guideLine.height=1,o.guideLine.anchor.y=.5,this.ghostBox=o}!this.ghostBox?.popup&&(this.ghostBox.event?.beat!=r||this.ghostBox.event?.type!=s)&&(this.ghostBox.event=structuredClone(this.renderer.chart.timingData.getTimingEventAtBeat(s,r))??this.renderer.chart.timingData.getDefaultEvent(s,r),this.ghostBox.event.beat=r,s=="ATTACKS"&&(this.ghostBox.event.second=this.renderer.chart.getSecondsFromBeat(r)),this.ghostBox.textObj.text=this.getLabelFromEvent(this.ghostBox.event),this.ghostBox.backgroundObj.width=this.ghostBox.textObj.width+10,this.ghostBox.selection.width=this.ghostBox.textObj.width+10),this.ghostBox.alpha=this.ghostBox?.popup?1:.4,this.ghostBox.selection.alpha=this.ghostBox?.popup?1:0,this.ghostBox.name=s;const n=this.renderer.getYPosFromBeat(this.ghostBox?.popup?this.ghostBox.event.beat:r);let a=this.tracks.getChildByName(s).x;a+=vr[s]/2*(a>0?1:-1),this.ghostBox.position.x=a,this.ghostBox.backgroundObj.tint=Tr[s]??0,this.ghostBox.backgroundObj.position.x=-this.ghostBox.backgroundObj.width/2,this.ghostBox.backgroundObj.position.y=-25/2,this.ghostBox.guideLine.anchor.x=a<0?0:1,this.ghostBox.guideLine.width=Math.abs(this.ghostBox.position.x)+192-this.ghostBox.backgroundObj.width/2,this.ghostBox.guideLine.position.x=(a<0?1:-1)*this.ghostBox.backgroundObj.width/2,this.ghostBox.y=n,this.ghostBox.selection.position=this.ghostBox.backgroundObj.position,this.ghostBox.textObj.scale.y=A.chart.reverse?-1:1}placeGhostEvent(){if(!this.ghostBox)return;const e=this.renderer.chart.timingData.getTimingEventAtBeat(this.ghostBox.event.type,this.ghostBox.event.beat);this.ghostBox.event.type=="ATTACKS"&&this.ghostBox.event.second==e?.second||this.ghostBox.event.type!="ATTACKS"&&this.ghostBox.event.beat==e?.beat||(this.renderer.chartManager.clearSelections(),this.ghostBox.songTiming=this.renderer.chart.timingData.isTypeChartSpecific(this.ghostBox.event.type),new wi(this.ghostBox,this.renderer.chart.timingData,!0),this.ghostBox.popup?.select(),this.ghostBox.popup.onConfirm=t=>{this.renderer.chart.timingData.insert(this.ghostBox.songTiming,t.type,t,t.beat)})}getClosestTrack(e){let t=Number.MAX_SAFE_INTEGER,r=this.tracks.children[0];for(const s of this.tracks.children){const n=Math.abs(s.x+(.5-s.anchor.x)*s.width-e);nr.width))return r}getLabelFromEvent(e){let t="";switch(e.type){case"BPMS":case"STOPS":case"WARPS":case"DELAYS":case"TICKCOUNTS":case"FAKES":case"SCROLLS":t=de(e.value,3).toString();break;case"SPEEDS":t=`${de(e.value,3)}/${de(e.delay,3)}/${e.unit}`;break;case"LABELS":t=e.value;break;case"TIMESIGNATURES":t=`${de(e.upper,3)}/${de(e.lower,3)}`;break;case"COMBOS":t=`${de(e.hitMult,3)}/${de(e.missMult,3)}`;break;case"BGCHANGES":case"FGCHANGES":t=e.file;break;case"ATTACKS":t=`${e.mods}`}return t}}class NT extends xe{children=[];renderer;timingBoxMap=new Map;trackPosCache=new Map;timingBoxPool=new hs({create:()=>{const e=new xe;return e.guideLine=new Be(ie.WHITE),e.textObj=new Fe("",Vh),e.backgroundObj=new Nt,e.addChild(e.guideLine,e.backgroundObj,e.textObj),e}});constructor(e){super(),this.renderer=e,this.timingBoxPool.sortableChildren=!0,this.addChild(this.timingBoxPool)}update(e,t){if(!this.renderer.chartManager.eventSelection.shift){this.timingBoxPool.destroyAll(),this.timingBoxMap.clear(),this.trackPosCache.clear();return}const r=this.renderer.chartManager.eventSelection.shift.beatShift;for(const s of this.renderer.chartManager.eventSelection.timingEvents)if(!(ts.beat+r)&&!this.timingBoxMap.has(s)){const n=this.timingBoxPool.createChild();if(!n)continue;this.timingBoxMap.set(s,n);let a="";switch(s.type){case"BPMS":case"STOPS":case"WARPS":case"DELAYS":case"TICKCOUNTS":case"FAKES":case"SCROLLS":a=de(s.value,3).toString();break;case"SPEEDS":a=`${de(s.value,3)}/${de(s.delay,3)}/${s.unit}`;break;case"LABELS":a=s.value;break;case"TIMESIGNATURES":a=`${de(s.upper,3)}/${de(s.lower,3)}`;break;case"COMBOS":a=`${de(s.hitMult,3)}/${de(s.missMult,3)}`;break;case"BGCHANGES":case"FGCHANGES":a=s.file;break;case"ATTACKS":a=`${s.mods} (${s.endType}=${s.value})`}const o=A.chart.timingEventOrder.right.includes(s.type)?"right":"left";if(Object.assign(n,{alpha:.4,songTiming:this.renderer.chart.timingData.isTypeChartSpecific(s.type),zIndex:s.beat}),n.textObj.text=a,n.textObj.anchor.set(.5,.55),n.backgroundObj.width=n.textObj.width+10,n.backgroundObj.height=25,n.backgroundObj.tint=Tr[s.type]??0,n.backgroundObj.position.x=-n.backgroundObj.width/2,n.backgroundObj.position.y=-n.backgroundObj.height/2,n.guideLine.height=1,n.guideLine.anchor.set(o=="left"?0:1,.5),n.guideLine.width=Math.abs(n.position.x)+192-n.backgroundObj.width/2,n.guideLine.position.x=(o=="left"?1:-1)*n.backgroundObj.width/2,this.renderer.chartManager.editTimingMode!=He.Off){let l=this.getTrackPos(s.type);l+=vr[s.type]/2*(l>0?1:-1),n.position.x=l,n.pivot.x=0}else{let l=(o=="right"?1:-1)*(this.renderer.chart.gameType.notefieldWidth*.5+80);o=="left"&&(l-=30),n.position.x=l,n.pivot.x=o=="right"?-n.backgroundObj.width/2:n.backgroundObj.width/2}}for(const[s,n]of this.timingBoxMap.entries()){if(ts.beat+r){this.timingBoxPool.destroyChild(n),this.timingBoxMap.delete(s);continue}n.textObj.scale.y=A.chart.reverse?-1:1,n.y=A.chart.CMod&&s.second?this.renderer.getYPosFromSecond(s.second):this.renderer.getYPosFromBeat(s.beat+r)}}getTrackPos(e){if(this.trackPosCache.has(e))return this.trackPosCache.get(e);const t=A.chart.timingEventOrder.left,r=A.chart.timingEventOrder.right;let s=-this.renderer.chart.gameType.notefieldWidth*.5-128;for(let n=t.length-1;n>=0;n--){const a=t[n];this.trackPosCache.set(a,s),s-=vr[a]}s=this.renderer.chart.gameType.notefieldWidth*.5+128;for(let n=0;nthis.renderer.getVisualBeat()),this.trackVariable(()=>this.renderer.getVisualTime()),this.trackVariable(()=>this.getSpeed(),s=>{this.speed=s,clearTimeout(this.lastSpeedTimeout),this.lastSpeedTimeout=setTimeout(()=>{this.blockCache.clear(),this.lastSpeed=this.speed,this.drawDirty=!0},200)}),this.trackVariable(()=>A.chart.zoom),this.trackVariable(()=>A.chart.CMod),this.trackVariable(()=>A.chart.doSpeedChanges),this.trackVariable(()=>A.chart.waveform.allowFilter),this.trackVariable(()=>A.chart.waveform.antialiasing,s=>{this.filters=s?[new _h]:[]}),this.trackVariable(()=>this.renderer.chartManager.app.renderer.screen.height,()=>this.resizeWaveform()),this.trackVariable(()=>A.chart.waveform.opacity),this.trackVariable(()=>A.chart.waveform.filteredOpacity),this.trackVariable(()=>A.chart.waveform.filteredColor),this.trackVariable(()=>A.chart.waveform.color),this.trackVariable(()=>A.chart.waveform.speedChanges),this.trackVariable(()=>A.chart.waveform.lineHeight,()=>{A.chart.waveform.lineHeight<=0&&(A.chart.waveform.lineHeight=1),this.updateLineHeight()}),this.trackVariable(()=>A.chart.zoom,()=>this.resizeWaveform()),this.trackVariable(()=>this.renderer.chartManager.chartAudio.hasFilters()),this.anchor.set(.5),this.renderer.chartManager.chartAudio.onUpdate(()=>this.getData()),this.getData(),this.resizeWaveform(),this.filters=A.chart.waveform.antialiasing?[new _h]:[];const t=()=>this.drawDirty=!0,r=()=>{this.getData(),this.resizeWaveform(),this.renderer.chartManager.chartAudio.onUpdate(()=>this.getData())};se.on("timingModified",t),this.on("destroyed",()=>{se.off("timingModified",t)}),se.on("audioLoaded",r),this.on("destroyed",()=>{se.off("audioLoaded",r)})}getData(){this.rawData=this.renderer.chartManager.chartAudio.getRawData(),this.filteredRawData=this.renderer.chartManager.chartAudio.getFilteredRawData(),this.sampleRate=this.renderer.chartManager.chartAudio.getSampleRate(),this.blockCache.clear(),this.drawDirty=!0}resizeWaveform(){this.waveformTex.resize(Je((this.rawData?.length??0)*288*A.chart.zoom,1,this.renderer.chartManager.app.renderer.screen.width),this.renderer.chartManager.app.renderer.screen.height)}update(){this.visible=A.chart.waveform.enabled&&(this.renderer.chartManager.getMode()!=Z.Play||!A.play.hideBarlines),A.chart.waveform.enabled&&((this.drawDirty||this.variableChanged())&&(this.drawDirty=!1,this.renderData(),this.renderer.chartManager.app.renderer.render(this.lineContainer,{renderTexture:this.waveformTex})),this.scale.set(1/A.chart.zoom))}trackVariable(e,t){this.trackedVariables.set(e,{value:e(),cb:t})}variableChanged(){let e=!1;for(const[t,r]of this.trackedVariables.entries())t()!=r.value&&(this.trackedVariables.get(t).value=t(),this.trackedVariables.get(t).cb?.(t()),e=!0);return e}getSample(e,t,r){if(t<0)return 0;const s=this.sampleRate/(this.lastSpeed*4),n=Math.floor(t*this.lastSpeed*4);if(this.blockCache.get(r)?.[n]!==void 0)return this.blockCache.get(r)[n];const a=Math.floor(n*s),o=e.slice(a,Math.floor(a+s)).reduce((l,c)=>l+Math.abs(c),0)/s;return this.blockCache.has(r)||this.blockCache.set(r,[]),this.blockCache.get(r)[n]=o,o}renderData(){this.resetPool();const e=A.chart.waveform.allowFilter&&this.renderer.chartManager.chartAudio.hasFilters();if(A.chart.waveform.speedChanges&&!A.chart.CMod&&A.chart.doSpeedChanges){const t=A.chart.speed,r=this.renderer.chart.timingData.getSpeedMult(this.renderer.getVisualBeat(),this.renderer.getVisualTime()),s=this.renderer.getVisualBeat()+A.chart.maxDrawBeats,n=this.renderer.chart.timingData.getTimingData("SCROLLS"),a=this.renderer.chart.timingData.getTimingData("OFFSET"),o=this.renderer.chart.timingData.getBPM(0),l=this.renderer.chart.timingData.getBeatTiming(),c=100/t/r/64/A.chart.zoom,u=this.renderer.chartManager.app.renderer.screen.height;let h=!1,d=ki(n,this.renderer.getVisualBeat()-A.chart.maxDrawBeatsBack,g=>g.beat),f=n[d]?.beat??0;f==0&&(f=-A.chart.maxDrawBeatsBack);let p=this.renderer.chart.getSecondsFromBeat(f),m=Math.round(this.renderer.getYPosFromBeat(f)*A.chart.zoom+this.parent.y);for(;fu||g.value>0&&b<0)){d++,f=n[d].beat,m=Math.round(b);continue}const w=c/Math.abs(g.value);for(;fu){if(g.value>0){h=!0;break}f+=w*(m-u),m=u;continue}f+=w*A.chart.waveform.lineHeight,m+=(g.value>0?1:-1)*A.chart.waveform.lineHeight;const v=Math.floor(f*1e3)/1e3;if(f<=0)p=-a+f*60/o;else if(v>=l[1]?.beat){for(;v>=l[1]?.beat;)l.shift();p=this.renderer.chart.getSecondsFromBeat(f)}else{let S=(f-l[0].beat)*60/l[0].bpm;l[0].warped&&(S=0),p=Math.max(l[0].secondClamp,l[0].secondAfter+S)}if(!(p<0))for(let E=0;E=n[1]?.beat){for(;c>=n[1]?.beat;)n.shift();o=this.renderer.chart.getSecondsFromBeat(t)}else{let h=(t-n[0].beat)*60/n[0].bpm;n[0].warped&&(h=0),o=Math.max(n[0].secondClamp,n[0].secondAfter+h)}for(let u=0;ut>=this.poolSearch)}updateLineHeight(){for(const e of this.lineContainer.children){const t=e;t.height=A.chart.waveform.lineHeight}}getLine(){for(;this.lineContainer.children[this.poolSearch];){const t=this.lineContainer.children[this.poolSearch];return t.visible=!0,this.poolSearch++,t}const e=new Be(ie.WHITE);return e.height=A.chart.waveform.lineHeight,e.anchor.set(.5),e.visible=!0,this.poolSearch++,this.lineContainer.addChild(e),e}getSpeed(){return Math.min(A.chart.speed,UT)}}class GT extends xe{chartManager;chart;speedMult=1;lastMousePos;lastMouseBeat=-1;lastMouseCol=-1;lastNoteType=null;editingCol=-1;waveform;barlines;timingAreas;timingTracks;selectedEvents;timingBar;notefield;snapDisplay;judgment;combo;selectionBoundary;selectionArea;previewArea;selectionBounds;constructor(e){super(),this.chartManager=e,this.chart=e.loadedChart,this.waveform=new HT(this),this.barlines=new MT(this),this.timingAreas=new uT(this),this.timingTracks=new FT(this),this.selectedEvents=new NT(this),this.timingBar=new BT(this),this.notefield=new this.chart.gameType.notefield(this),this.snapDisplay=new hT(this),this.previewArea=new DT(this),this.selectionArea=new LT(this),this.judgment=new RT,this.combo=new kT(this),this.selectionBoundary=new OT(this),this.addChild(this.waveform,this.barlines,this.timingAreas,this.previewArea,this.selectionArea,this.timingTracks,this.selectedEvents,this.timingBar,this.combo,this.notefield,this.snapDisplay,this.judgment,this.selectionBoundary),this.chartManager.app.stage.addChild(this),this.x=this.chartManager.app.renderer.screen.width/2,this.y=this.chartManager.app.renderer.screen.height/2,this.eventMode="static",this.hitArea=new Ie(-1e5,-1e5,2e5,2e5);const t=n=>{if(this.editingCol!=-1){const a=A.chart.snap==0?.020833333333333332:A.chart.snap,o=Math.round(this.getBeatFromYPos(this.lastMousePos.y)/a)*a;this.chartManager.editHoldBeat(this.editingCol,o,n.shiftKey)}};let r=0;const s=()=>{if(!this.chartManager.selection.shift&&!this.selectionBounds||r==0)return;const n=this.getYPosFromBeat(Math.max(0,this.chartManager.getBeat()+r));this.chartManager.setBeat(Math.max(0,this.chartManager.getBeat()+r)),this.selectionBounds&&(this.selectionBounds.start.y+=A.chart.receptorYPos/A.chart.zoom-n)};this.chartManager.app.ticker.add(s),window.addEventListener("keydown",t),this.on("destroyed",()=>{window.removeEventListener("keydown",t),this.removeAllListeners(),this.chartManager.app.ticker.remove(s)}),this.on("pointerdown",n=>{Nh(n)||this.chartManager.getMode()!=Z.Play&&(this.chartManager.editTimingMode==He.Add&&this.lastMousePos?this.timingTracks.placeGhostEvent():this.chartManager.editTimingMode==He.Off&&A.chart.mousePlacement&&this.lastMouseBeat!=-1&&this.lastMouseCol!=-1&&!n.getModifierState("Shift")?(this.chartManager.clearSelections(),this.editingCol=this.lastMouseCol,this.chartManager.setNote(this.lastMouseCol,"mouse",this.lastMouseBeat)):(!n.getModifierState("Control")&&!n.getModifierState("Meta")&&!n.getModifierState("Shift")&&this.chartManager.clearSelections(),this.chartManager[this.chartManager.editTimingMode==He.Off?"startDragSelection":"startDragEventSelection"](),this.selectionBounds={start:this.toLocal(n.global),end:this.toLocal(n.global)}))}),this.on("mousemove",n=>{if(this.lastMousePos=this.toLocal(n.global),this.editingCol!=-1){const a=A.chart.snap==0?.020833333333333332:A.chart.snap,o=Math.round(this.getBeatFromYPos(this.lastMousePos.y)/a)*a;this.chartManager.editHoldBeat(this.editingCol,o,n.shiftKey)}this.selectionBounds&&(this.selectionBounds.end=this.toLocal(n.global)),r=Math.max(0,this.lastMousePos.y-this.getLowerBound()+100)/600,this.lastMousePos.y<0&&(r=Math.min(0,this.lastMousePos.y-this.getUpperBound()-100)/600)}),this.on("pointerup",()=>{this.editingCol!=-1&&(this.chartManager.endEditing(this.editingCol),this.editingCol=-1),this.chartManager[this.chartManager.editTimingMode==He.Off?"endDragSelection":"endDragEventSelection"](),this.selectionBounds=void 0,r=0})}isDragSelecting(){return!!this.selectionBounds}doJudgment(e,t,r){this.chartManager.getMode()==Z.Play&&(this.judgment.doJudge(t,r),this.timingBar.addBar(t,r)),this.notefield.doJudge(e.col,r)}activateHold(e){this.notefield.activateHold(e)}keyDown(e){this.notefield.keyDown(e)}keyUp(e){this.notefield.keyUp(e)}endPlay(){this.notefield.endPlay(),this.timingBar.reset(),this.judgment.reset()}update(){const e=this.getVisualBeat(),t=this.getVisualTime();this.speedMult=A.chart.doSpeedChanges?this.chart.timingData.getSpeedMult(e,t):1;const r=this.getUpperBoundBeat(),s=this.getLowerBoundBeat();if(this.scale.x=A.chart.zoom,this.scale.y=(A.chart.reverse?-1:1)*A.chart.zoom,this.children.forEach(n=>n.update(r,s)),this.notefield.alpha=this.chartManager.editTimingMode==He.Off||this.chartManager.getMode()==Z.Play?1:.3,A.chart.mousePlacement&&this.lastMousePos&&this.chartManager.getMode()!=Z.Play){const n=A.chart.snap==0?.020833333333333332:A.chart.snap,a=Math.round(this.getBeatFromYPos(this.lastMousePos.y)/n)*n,o=Math.round((this.lastMousePos.x+96)/64);(a!=this.lastMouseBeat||o!=this.lastMouseCol||this.chartManager.getEditingNoteType()!=this.lastNoteType)&&(this.lastMouseBeat=a,this.lastMouseCol=o,this.lastNoteType=this.chartManager.getEditingNoteType(),this.editingCol!=-1&&this.chartManager.editHoldBeat(this.editingCol,a,!1),o>3||o<0?(this.lastMouseBeat=-1,this.lastMouseCol=-1,this.notefield.setGhostNote()):this.notefield.setGhostNote({beat:a,col:this.lastMouseCol,type:this.chartManager.getEditingNoteType()}))}this.lastMousePos&&this.chartManager.editTimingMode==He.Add&&this.timingTracks.updateGhostEvent(this.lastMousePos)}getTimeWithOffset(){let e=this.chartManager.getTime();return(this.chartManager.getMode()==Z.Play||this.chartManager.getMode()==Z.Record)&&(e+=A.play.offset),e}getBeatWithOffset(){let e=this.chartManager.getBeat();return(this.chartManager.getMode()==Z.Play||this.chartManager.getMode()==Z.Record)&&(e=this.chart.getBeatFromSeconds(this.getTimeWithOffset())),e}getVisualTime(){let e=this.chartManager.getTime();return(this.chartManager.getMode()==Z.Play||this.chartManager.getMode()==Z.Record)&&(e+=A.play.offset+A.play.visualOffset),e}getVisualBeat(){let e=this.chartManager.getBeat();return(this.chartManager.getMode()==Z.Play||this.chartManager.getMode()==Z.Record)&&(e=this.chart.getBeatFromSeconds(this.getVisualTime())),e}getYPosFromBeat(e){const t=this.getVisualTime(),r=this.getVisualBeat();return A.chart.CMod?(this.chart.getSecondsFromBeat(e)-t)*this.getSecondsToPixelsRatio()+this.getActualReceptorYPos():r==e?this.getActualReceptorYPos():(A.chart.doSpeedChanges?this.chart.timingData.getEffectiveBeat(e)-this.chart.timingData.getEffectiveBeat(r):e-r)*this.getEffectiveBeatsToPixelsRatio()+this.getActualReceptorYPos()}getYPosFromSecond(e){const t=this.getVisualTime();return A.chart.CMod?(e-t)*this.getSecondsToPixelsRatio()+this.getActualReceptorYPos():this.getYPosFromBeat(this.chart.timingData.getBeatFromSeconds(e))}getSecondFromYPos(e){if(A.chart.CMod){const t=this.getPixelsToSecondsRatio(),r=this.getVisualTime(),n=(e-A.chart.receptorYPos/A.chart.zoom)*t;return r+n}return this.chart.getSecondsFromBeat(this.getBeatFromYPos(e))}getBeatFromYPos(e,t){const r=this.getVisualBeat();if(A.chart.CMod)return this.chart.getBeatFromSeconds(this.getSecondFromYPos(e));const n=(e-this.getActualReceptorYPos())*this.getPixelsToEffectiveBeatsRatio();if(A.chart.doSpeedChanges&&!t){const a=this.chart.timingData.getEffectiveBeat(r)+n;return this.chart.getBeatFromEffectiveBeat(a)}return r+n}getActualReceptorYPos(){return A.chart.receptorYPos/A.chart.zoom}getEffectiveBeatsToPixelsRatio(){return A.chart.speed/100*64*this.speedMult}getPixelsToEffectiveBeatsRatio(){return 1/this.getEffectiveBeatsToPixelsRatio()}getSecondsToPixelsRatio(){return A.chart.speed/100*64*4}getPixelsToSecondsRatio(){return 1/this.getSecondsToPixelsRatio()}isNegScroll(e){return A.chart.doSpeedChanges&&(this.speedMult<0||(this.chart.timingData.getTimingEventAtBeat("SCROLLS",e)?.value??1)<0||this.chart.timingData.getBPM(e)<0)}getLowerBound(){return(this.chartManager.app.renderer.screen.height-this.y)/A.chart.zoom+32}getUpperBoundBeat(){if(A.chart.waveform.speedChanges&&!A.chart.CMod&&A.chart.doSpeedChanges){const e=A.chart.speed,t=this.chart.timingData.getSpeedMult(this.getVisualBeat(),this.getVisualTime()),r=this.chart.timingData.getTimingData("SCROLLS"),s=100/e/t/64/A.chart.zoom,n=this.getUpperBound(),a=this.getLowerBound();let o=ki(r,this.getVisualBeat()-A.chart.maxDrawBeatsBack,d=>d.beat);for(;r[o]?.beat0&&m>n&&(fa||!r[o-1]||r[o-1].beat0?Math.max(this.getVisualBeat()-A.chart.maxDrawBeatsBack,l+h*(n-c)):Math.max(this.getVisualBeat()-A.chart.maxDrawBeatsBack,l+h*(c-a))}return A.chart.CMod?this.getBeatFromYPos(this.getUpperBound()):Math.max(this.getVisualBeat()-A.chart.maxDrawBeatsBack,this.getBeatFromYPos(this.getUpperBound()))}getLowerBoundBeat(){if(A.chart.waveform.speedChanges&&!A.chart.CMod&&A.chart.doSpeedChanges){const e=A.chart.speed,t=this.chart.timingData.getSpeedMult(this.getVisualBeat(),this.getVisualTime()),r=this.chart.timingData.getTimingData("SCROLLS"),s=100/e/t/64/A.chart.zoom,n=this.getUpperBound(),a=this.getLowerBound();let o=ki(r,this.getVisualBeat()+A.chart.maxDrawBeats,d=>d.beat);for(;r[o]?.beat>this.getVisualBeat()-A.chart.maxDrawBeatsBack;){const d=r[o],f=this.getYPosFromBeat(d.beat),p=r[o+1]?.beat??this.getVisualBeat()+A.chart.maxDrawBeats,m=this.getYPosFromBeat(p);if(d.value>0&&fa||!r[o+1]||r[o+1].beat>this.getVisualBeat()+A.chart.maxDrawBeatsBack||r[o-1].value==0)||d.value<0&&f>n&&(mthis.getVisualBeat()+A.chart.maxDrawBeatsBack||r[o-1].value==0))break;o--}const l=r[o]?.beat??0,c=this.getYPosFromBeat(l),u=r[o]?.value??1,h=s/Math.abs(u)*A.chart.zoom;return u>0?Math.min(this.getVisualBeat()+A.chart.maxDrawBeats,l+h*(a-c)):Math.min(this.getVisualBeat()+A.chart.maxDrawBeats,l+h*(c-n))}return A.chart.CMod?this.getBeatFromYPos(this.getLowerBound()):Math.min(this.getVisualBeat()+A.chart.maxDrawBeats,this.getBeatFromYPos(this.getLowerBound()))}getUpperBound(){return-32-this.y/A.chart.zoom}selectionTest(e){if(!this.selectionBounds)return!1;const t=this.selectionBoundary.getBounds(),r=e.getBounds(),s=16*A.chart.zoom;return t.x+t.width>r.x+s&&t.xr.y+s&&t.y{const u=o,h=this.toLocal(c.global);if(Math.abs(h.y-a-n)**2+Math.abs(h.x-s)**2<32*32){this.chartManager.selection.shift&&(this.chartManager.selection.shift={columnShift:0,beatShift:0});return}const d=this.getBeatFromYPos(h.y-a),f=A.chart.snap==0?1/48:A.chart.snap;let p=Math.round(d/f)*f;Math.abs(p-d)>Math.abs(d-u.beat)&&(p=u.beat);const m=Math.round((h.x+96)/64);this.chartManager.selection.shift||={columnShift:0,beatShift:0},r!=m-u.col&&(r=m-u.col,this.chartManager.selection.notes.every(g=>{const y=g.col+r;return y>=0&&yg.beat)),p-u.beat)};e.on("pointerdown",c=>{if(Nh(c)){this.chartManager.selection.notes.includes(t)||(this.chartManager.clearSelections(),this.chartManager.addNoteToSelection(t)),zh.open(this.chartManager.app,c),c.preventDefault();return}if(A.chart.mousePlacement&&!c.getModifierState("Meta")&&!c.getModifierState("Control")&&!c.getModifierState("Shift")&&!this.chartManager.selection.notes.includes(t))return;c.stopImmediatePropagation(),this.chartManager.selection.notes.includes(t)?(c.getModifierState("Control")||c.getModifierState("Meta"))&&this.chartManager.removeNoteFromSelection(t):(!c.getModifierState("Control")&&!c.getModifierState("Meta")&&!c.getModifierState("Shift")&&this.chartManager.clearSelections(),this.chartManager.addNoteToSelection(t)),s=e.x,n=e.y,a=this.toLocal(c.global).y-e.y,o=t,this.on("pointermove",l);const u=()=>{this.off("pointermove",l),this.off("pointerup",u),e.visible=!0,((this.chartManager.selection.shift?.beatShift??0)!=0||(this.chartManager.selection.shift?.columnShift??0)!=0)&&this.chartManager.modifySelection(h=>(h.beat+=this.chartManager.selection.shift.beatShift,h.col+=this.chartManager.selection.shift.columnShift,h)),this.chartManager.selection.shift=void 0};this.on("pointerup",u)}),e.on("destroyed",()=>{e?.removeAllListeners()})}getNotefield(){return this.notefield}getSelectionBounds(){return this.selectionBounds}}class Dc extends AudioBufferSourceNode{started=!1;start(e,t,r){this.started||super.start(e,t,r),this.started=!0}stop(e){this.started&&super.stop(e),this.started=!1}static create(e){const t=e;return t.started=!1,Object.setPrototypeOf(t,Dc.prototype),t}}class WT extends BiquadFilterNode{enabled=!1;static create(e){const t=e;return t.enabled=!1,t}}class Ga{_audioContext=new AudioContext;_audioAnalyzer;_filteredAudioAnalyzer;_freqData;_filteredFreqData;_gainNode;_source;_playbackTime=0;_startTimestamp=0;_rate=1;_isPlaying=!1;_buffer;_filteredBuffer;_loadedBuffer;_delay;_listeners=[];_volume=1;_destroyed=!1;_renderTimeout;_filters=[this.createFilter({type:"highpass",frequency:20,Q:.71}),this.createFilter({type:"lowshelf",frequency:75,gain:0}),this.createFilter({type:"peaking",frequency:100,gain:0,Q:.6}),this.createFilter({type:"peaking",frequency:250,gain:0,Q:.3}),this.createFilter({type:"peaking",frequency:1040,gain:0,Q:.41}),this.createFilter({type:"peaking",frequency:2500,gain:0,Q:.2}),this.createFilter({type:"highshelf",frequency:7500,gain:0}),this.createFilter({type:"lowpass",frequency:2e4,Q:.71})];_filtersEnabled=!1;type;loaded;constructor(e,t){this.type=t??"",this._filters[0].gain.value=-25,this._audioAnalyzer=this._audioContext.createAnalyser(),this._audioAnalyzer.fftSize=8192,this._audioAnalyzer.maxDecibels=0,this._freqData=new Uint8Array(this._audioAnalyzer.frequencyBinCount),this._filteredAudioAnalyzer=this._audioContext.createAnalyser(),this._filteredAudioAnalyzer.fftSize=8192,this._filteredAudioAnalyzer.maxDecibels=0,this._filteredFreqData=new Uint8Array(this._filteredAudioAnalyzer.frequencyBinCount),this._gainNode=this._audioContext.createGain(),this._buffer=this._audioContext.createBuffer(2,1,44100),this._filteredBuffer=this._audioContext.createBuffer(2,1,44100),this._loadedBuffer=this._audioContext.createBuffer(2,1,44100),this.initSource(),this.loaded=new Promise(r=>{this.decodeData(e).then(s=>{if(s)return this._loadedBuffer=s,s}).then(async s=>(await this.renderBuffer(s),await this.renderFilteredBuffer(s),s)).catch(s=>{s.name=="EncodingError"?Oe.createFormatted("Failed to load audio: file format not supported","error"):Oe.createFormatted("Failed to load audio: "+s.message,"error")}).finally(()=>{this.initSource(),this.callListeners(),r()})})}async renderBuffer(e){if(!e)return;const t=new OfflineAudioContext(e.numberOfChannels,e.length,e.sampleRate),r=t.createBufferSource();return r.buffer=e,r.connect(t.destination),r.start(),await t.startRendering().then(s=>{this._buffer=s}).catch(()=>{Oe.createFormatted("Failed to load audio: audio rendering failed","error")})}async renderFilteredBuffer(e){if(!e)return;const t=new OfflineAudioContext(e.numberOfChannels,e.length,e.sampleRate),r=t.createBufferSource();r.buffer=e;let s=r;for(const n of this._filters){if(!n.enabled)continue;const a=t.createBiquadFilter();a.type=n.type,a.Q.setValueAtTime(n.Q.value,0),a.frequency.setValueAtTime(n.frequency.value,0),a.gain.setValueAtTime(n.gain.value,0),s.connect(a),s=a}return s.connect(t.destination),r.start(),await t.startRendering().then(n=>{this._filteredBuffer=n}).catch(()=>{Oe.createFormatted("Failed to load audio: audio rendering failed","error")})}createFilter(e){const t=WT.create(this._audioContext.createBiquadFilter());return t.type=e.type,e.Q!==void 0&&(t.Q.value=e.Q),e.gain!==void 0&&(t.gain.value=e.gain),e.frequency!==void 0&&(t.frequency.value=e.frequency),t}getFilters(){return this._filters}getFilter(e){return this._filters[e]}updateFilter(e,t){this._filters[e]&&(t.Q!==void 0&&(this._filters[e].Q.value=t.Q),t.frequency!==void 0&&(this._filters[e].frequency.value=t.frequency),t.gain!==void 0&&(this._filters[e].gain.value=t.gain),clearTimeout(this._renderTimeout),this._renderTimeout=setTimeout(()=>this.renderFilteredBuffer(this._loadedBuffer).then(()=>this.callListeners()),500))}enableFilter(e){this._filters[e].enabled=!0,this.initSource(),clearTimeout(this._renderTimeout),this._renderTimeout=setTimeout(()=>this.renderFilteredBuffer(this._loadedBuffer).then(()=>this.callListeners()),500),this._filtersEnabled=!0}disableFilter(e){this._filters[e].enabled=!1,this.initSource(),clearTimeout(this._renderTimeout),this._renderTimeout=setTimeout(()=>this.renderFilteredBuffer(this._loadedBuffer).then(()=>this.callListeners()),500),this._filtersEnabled=this._filters.some(t=>t.enabled)}hasFilters(){return this._filtersEnabled}onUpdate(e){this._listeners.push(e)}getSongLength(){return this._buffer.length/this._buffer.sampleRate}getFrequencyData(){return this._destroyed?new Uint8Array:(this._audioAnalyzer.getByteFrequencyData(this._freqData),this._freqData)}getFilteredFrequencyData(){return this._destroyed?new Uint8Array:(this._filteredAudioAnalyzer.getByteFrequencyData(this._filteredFreqData),this._filteredFreqData)}getSampleRate(){return this._buffer.sampleRate}getFFTSize(){return this._audioAnalyzer.fftSize}getRawData(){if(this._destroyed)return[];const e=[];for(let t=0;tr.enabled)?this._filters.filter(r=>r.enabled).map(r=>{const s=new Float32Array(e.length);return r.getFrequencyResponse(t,s,new Float32Array(e.length)),[...s]}).reduce((r,s)=>r.map((n,a)=>n*s[a])):new Array(e.length).fill(1)}callListeners(){this._listeners.forEach(e=>e())}async decodeData(e){return new Promise((t,r)=>{if(!e){t();return}(async()=>{try{t(await this._audioContext.decodeAudioData(e))}catch(s){if(this.type==".ogg"){const n=await(await Ir(()=>import("./OggDec-2941c3fd.js"),[],import.meta.url)).default;try{t(await n.decodeOggData(e))}catch(a){r(a)}return}r(s)}})()})}initSource(){for(const t of this._filters)t.disconnect();this._audioAnalyzer.disconnect(),this._filteredAudioAnalyzer.disconnect(),this._gainNode.disconnect(),this._audioContext.destination.disconnect(),this._source?.stop(),this._source=Dc.create(this._audioContext.createBufferSource()),this._source.buffer=this._buffer,this._source.connect(this._audioAnalyzer);let e=this._audioAnalyzer;for(const t of this._filters)t.enabled&&(e.connect(t),e=t);e.connect(this._filteredAudioAnalyzer),A.audio.allowFilter?this._filteredAudioAnalyzer.connect(this._gainNode):this._audioAnalyzer.connect(this._gainNode),this._gainNode.connect(this._audioContext.destination),this._source.playbackRate.value=this._rate,this._isPlaying&&(this.pause(),this.play())}volume(e){this._destroyed||this._volume!=e&&(this._volume=e,this._gainNode.gain.setValueAtTime(e,this._audioContext.currentTime))}rate(e){this._destroyed||this._rate!=e&&(this._rate=e,this._source&&(this._isPlaying&&(this._playbackTime+=(this._audioContext.currentTime-this._startTimestamp)*this._source.playbackRate.value),this._startTimestamp=this._audioContext.currentTime,this._source.playbackRate.value=e))}play(){this._destroyed||this._source&&(this._isPlaying||(this.initSource(),this._playbackTime<=this._filteredBuffer.duration&&(this._playbackTime<0?(clearTimeout(this._delay),this._delay=setInterval(()=>{this.seek()>0&&(clearInterval(this._delay),this._source?.start(0,0))})):this._source.start(0,this._playbackTime)),this._startTimestamp=this._audioContext.currentTime,this._isPlaying=!0))}seek(e){if(!this._destroyed&&this._source){if(e===void 0)return this._isPlaying?(this._audioContext.currentTime-this._startTimestamp)*this._source.playbackRate.value+this._playbackTime:this._playbackTime;this._isPlaying?(this.stop(),this._playbackTime=e,this.play()):this._playbackTime=e}}pause(){this._destroyed||this.stop(!0)}stop(e){this._destroyed||this._source&&this._isPlaying&&(clearTimeout(this._delay),this._isPlaying=!1,this._playbackTime<=this._buffer.duration&&this._source.stop(),this._playbackTime=e?(this._audioContext.currentTime-this._startTimestamp)*this._source.playbackRate.value+this._playbackTime:0)}}class zT{judgmentCounts=new Map;holdJudgmentCounts=new Map;dancePoints=0;maxCumulativeDancePoints=0;maxDancePoints=0;chartManager;notedata;dataPoints=[];handlers=[];combo=0;missCombo=0;maxCombo=0;bestJudge;constructor(e){this.notedata=e.loadedChart.getNotedata(),this.chartManager=e,this.bestJudge=et.getCollection(A.play.timingCollection).getStandardWindows()[0],this.calculateMaxDP()}onJudge(e){this.handlers.push(e)}applyOffset(e){this.dataPoints=this.dataPoints.map(t=>ri(t.judgment)||!Gi(t.judgment)?t:{...t,error:t.error+e}),this.recalculate()}addDataPoint(e,t,r){this.judgmentCounts.has(t)||this.judgmentCounts.set(t,0),this.judgmentCounts.set(t,this.judgmentCounts.get(t)+1),this.dancePoints+=t.dancePoints;const s=this.chartManager.loadedChart.timingData.getTimingEventAtBeat("COMBOS",e[0].beat),n=s?.hitMult??1,a=s?.missMult??1;ts(t)||(this.maxCumulativeDancePoints+=et.getCollection(A.play.timingCollection).getMaxDancePoints()),ri(t)?(this.maxCumulativeDancePoints+=e.filter(De).reduce((o,l)=>o+et.getCollection(A.play.timingCollection).getMaxHoldDancePoints(l.type),0),this.combo=0,this.missCombo+=a,this.bestJudge=void 0):Gi(t)&&(et.getCollection(A.play.timingCollection).shouldHideNote(t)?(this.combo+=e.length*n,this.combo>this.maxCombo&&(this.maxCombo=this.combo),this.missCombo=0,this.bestJudge&&t.getTimingWindowMS()>this.bestJudge.getTimingWindowMS()&&(this.bestJudge=t)):(this.bestJudge=void 0,this.combo=0)),this.handlers.forEach(o=>o(r,t)),this.dataPoints.push({second:e[0].second,error:r,judgment:t,notes:e})}addHoldDataPoint(e,t){this.judgmentCounts.has(t)||this.judgmentCounts.set(t,0),this.judgmentCounts.set(t,this.judgmentCounts.get(t)+1);const r=et.getCollection(A.play.timingCollection).getHeldJudgement(e);this.holdJudgmentCounts.has(r)||this.holdJudgmentCounts.set(r,[0,0]);const s=this.holdJudgmentCounts.get(r);Er(t)?s[0]++:s[1]++,this.holdJudgmentCounts.set(r,s),this.dancePoints+=t.dancePoints,this.maxCumulativeDancePoints+=et.getCollection(A.play.timingCollection).getMaxHoldDancePoints(e.type),this.handlers.forEach(n=>n(0,t)),rn(t)&&(this.bestJudge=void 0)}getScore(){return this.maxDancePoints==0?0:this.dancePoints/this.maxDancePoints}getCumulativeScore(){return this.maxCumulativeDancePoints==0?0:this.dancePoints/this.maxCumulativeDancePoints}getDataPoints(){return this.dataPoints}getMedian(){return jo(this.dataPoints.filter(e=>!ri(e.judgment)&&Gi(e.judgment)).map(e=>e.error))}getMaxCombo(){return this.maxCombo}recalculate(){this.calculateMaxDP(),this.dancePoints=0,this.maxCumulativeDancePoints=0;for(const e of this.holdJudgmentCounts.entries()){const t=e[0];this.dancePoints+=e[0].dancePoints*e[1][0],this.maxCumulativeDancePoints+=(e[1][0]+e[1][1])*et.getCollection(A.play.timingCollection).getMaxHoldDancePoints(t.noteType)}this.judgmentCounts.clear();for(const e of this.dataPoints){let t=et.getCollection(A.play.timingCollection).judgeInput(e.error);(ri(e.judgment)||ts(e.judgment))&&(t=e.judgment),this.judgmentCounts.has(t)||this.judgmentCounts.set(t,0),this.judgmentCounts.set(t,this.judgmentCounts.get(t)+1),this.dancePoints+=t.dancePoints,e.judgment=t,ts(t)||(this.maxCumulativeDancePoints+=et.getCollection(A.play.timingCollection).getMaxDancePoints()),ri(t)&&(this.maxCumulativeDancePoints+=e.notes.filter(De).reduce((r,s)=>r+et.getCollection(A.play.timingCollection).getMaxHoldDancePoints(s.type),0))}}calculateMaxDP(){const e=new Map,t=new Map;for(const r of this.notedata)r.type=="Mine"||r.fake||(De(r)&&(t.has(r.type)||t.set(r.type,0),t.set(r.type,t.get(r.type)+1)),e.has(r.beat)||e.set(r.beat,[]),e.get(r.beat).push(r));this.maxDancePoints=e.size*et.getCollection(A.play.timingCollection).getMaxDancePoints(),this.maxDancePoints+=Array.from(t.entries()).reduce((r,s)=>r+s[1]*et.getCollection(A.play.timingCollection).getMaxHoldDancePoints(s[0]),0)}getCount(e){return this.judgmentCounts.get(e)??0}getCombo(){return this.combo}getMissCombo(){return this.missCombo}getBestJudge(){return this.bestJudge}}const Qt=[1,2,3,4,6,8,12,16,24,48,-1];var Z=(i=>(i.View="View Mode",i.Edit="Edit Mode",i.Play="Play Mode",i.Record="Record Mode",i))(Z||{}),He=(i=>(i[i.Off=0]="Off",i[i.Edit=1]="Edit",i[i.Add=2]="Add",i))(He||{});class VT{app;chartAudio=new Ga;chartView;widgetManager;assistTick=new Kr.Howl({src:"assets/sound/assist_tick.ogg",volume:.5});me_high=new Kr.Howl({src:"assets/sound/metronome_high.ogg",volume:.5});me_low=new Kr.Howl({src:"assets/sound/metronome_low.ogg",volume:.5});mine=new Kr.Howl({src:"assets/sound/mine.ogg",volume:.5});loadedSM;smPath="";loadedChart;selection={notes:[],inProgressNotes:[]};eventSelection={timingEvents:[],inProgressTimingEvents:[]};editTimingMode=0;beat=0;time=0;holdEditing=[];editNoteTypeIndex=0;partialScroll=0;noteIndex=0;lastMetronomeDivision=-1;lastMetronomeMeasure=-1;lastSong="";mode="Edit Mode";lastMode="Edit Mode";noChartTextA;noChartTextB;virtualClipboard="";startRegion;endRegion;gameStats;constructor(e){this.app=e,document.addEventListener("cut",t=>{if(t.target.classList.contains("inlineEdit")||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLInputElement||this.mode!="Edit Mode")return;const r=this.copy();r&&t.clipboardData?.setData("text/plain",r),this.deleteSelection(),t.preventDefault()},!0),document.addEventListener("copy",t=>{if(t.target.classList.contains("inlineEdit")||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLInputElement||this.mode!="Edit Mode")return;const r=this.copy();r&&t.clipboardData?.setData("text/plain",r),t.preventDefault(),t.stopImmediatePropagation()},!0),document.addEventListener("paste",t=>{if(t.target.classList.contains("inlineEdit")||t.target instanceof HTMLTextAreaElement||t.target instanceof HTMLInputElement||this.mode!="Edit Mode")return;const r=t.clipboardData?.getData("text/plain");r&&this.paste(r),t.preventDefault(),t.stopImmediatePropagation()},!0),e.view.addEventListener?.("wheel",t=>{if(!(this.loadedSM==null||this.loadedChart==null||this.chartView==null))if(t.preventDefault(),ss&&t.metaKey||!ss&&t.ctrlKey){const r=t.deltaY/5*A.chart.scroll.scrollSensitivity*(A.chart.scroll.invertZoomScroll?-1:1);A.chart.speed=Je(A.chart.speed*Math.pow(1.01,r),10,35e3)}else{if(this.mode=="Play Mode"||this.mode=="Record Mode")return;let r=this.beat;const s=A.chart.snap,n=A.chart.speed*(A.chart.reverse&&A.chart.scroll.invertZoomScroll?-1:1),a=t.deltaY/n*A.chart.scroll.scrollSensitivity;if(s==0?(this.partialScroll=0,r=this.beat+a):A.chart.scroll.scrollSnapEveryScroll?t.deltaY<0?r=Math.round((this.beat-s)/s)*s:r=Math.round((this.beat+s)/s)*s:(this.partialScroll+=a,Math.abs(this.partialScroll)>s&&(this.partialScroll<0?r=Math.round((this.beat+Math.ceil(this.partialScroll/s)*s)/s)*s:r=Math.round((this.beat+Math.floor(this.partialScroll/s)*s)/s)*s,this.partialScroll%=s)),r=Math.max(0,r),r!=this.beat&&this.setBeat(r),!this.holdEditing.every(o=>o==null))for(let o=0;o{this.noChartTextB.tint=8952234}),this.noChartTextB.on("mouseleave",()=>{this.noChartTextB.tint=5596791}),this.noChartTextB.on("mousedown",()=>{this.app.windowManager.openWindow(new bm(e,Ze.getGameType("dance-single")))}),this.noChartTextA.visible=!1,this.noChartTextB.visible=!1,this.noChartTextA.x=this.app.renderer.screen.width/2,this.noChartTextA.y=this.app.renderer.screen.height/2-20,this.noChartTextB.x=this.app.renderer.screen.width/2,this.noChartTextB.y=this.app.renderer.screen.height/2+10,this.app.stage.addChild(this.noChartTextB),this.app.ticker.add(()=>{const t=performance.now();this.widgetManager.update(),this.loadedSM&&this.loadedChart&&this.chartView&&this.chartView.update(),cs.instance?.addDrawUpdateTimeValue(performance.now()-t)}),setInterval(()=>{if(!this.loadedSM||!this.loadedChart||!this.chartView)return;const t=performance.now(),r=this.chartAudio.seek();if(this.chartAudio.isPlaying()&&(this.setTime(r,!0),!this.holdEditing.every(c=>!c)))for(let c=0;c.3&&this.editHoldBeat(c,d,!1)}const s=this.loadedChart.getNotedata();let n=!1;for(;this.noteIndexs[this.noteIndex].second+A.play.effectOffset;)this.mode!="Record Mode"&&this.chartAudio.isPlaying()&&this.loadedChart.gameType.gameLogic.shouldAssistTick(s[this.noteIndex])&&(this.mode!="Play Mode"&&this.chartView.doJudgment(s[this.noteIndex],0,cm),!n&&A.audio.assistTick&&(this.assistTick.play(),n=!0)),this.noteIndex++;const a=this.loadedChart.getBeatFromSeconds(this.time+A.play.effectOffset),o=Math.floor(this.loadedChart.timingData.getDivisionOfMeasure(a)),l=Math.floor(this.loadedChart.timingData.getMeasure(a));(l!=this.lastMetronomeMeasure||o!=this.lastMetronomeDivision)&&(this.lastMetronomeDivision=o,this.lastMetronomeMeasure=l,this.chartAudio.isPlaying()&&A.audio.metronome&&(o==0?this.me_high.play():this.me_low.play())),this.mode=="Play Mode"&&this.loadedChart.gameType.gameLogic.update(this),this.updateSoundProperties(),oT(),cs.instance?.addUpdateTimeValue(performance.now()-t)},5),se.on("resize",()=>{this.chartView&&(this.chartView.x=this.app.renderer.screen.width/2,this.chartView.y=this.app.renderer.screen.height/2),this.noChartTextA.x=this.app.renderer.screen.width/2,this.noChartTextA.y=this.app.renderer.screen.height/2-20,this.noChartTextB.x=this.app.renderer.screen.width/2,this.noChartTextB.y=this.app.renderer.screen.height/2+10}),se.on("chartModified",()=>{this.loadedChart&&(this.loadedChart.recalculateStats(),se.emit("chartModifiedAfter"))}),window.addEventListener("keyup",t=>{if(this.mode=="Edit Mode"&&t.code.startsWith("Digit")){const r=parseInt(t.code.slice(5))-1;this.endEditing(r)}},!0),window.addEventListener("keydown",t=>{const r=it.getKeyNameFromCode(t.code);if(this.mode=="Edit Mode"&&!t.target.classList.contains("inlineEdit")&&!(t.target instanceof HTMLTextAreaElement)&&!(t.target instanceof HTMLInputElement)){if(t.code.startsWith("Digit")&&!t.repeat&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&!t.ctrlKey){const s=parseInt(t.code.slice(5))-1;s<(this.loadedChart?.gameType.numCols??4)&&s>-1&&(this.setNote(s,"key"),t.preventDefault(),t.stopImmediatePropagation())}if(!this.holdEditing.every(s=>s==null)){const s=["cursorUp","cursorDown","previousNote","nextNote","previousMeasure","nextMeasure","jumpChartStart","jumpChartEnd","jumpSongStart","jumpSongEnd"];for(const n of s)if(ht[n].combos.map(a=>a.key).includes(r)){t.preventDefault(),t.stopImmediatePropagation(),ht[n].callback(this.app);for(let a=0;aa.key).includes(r)){this.holdEditing=[];return}}}},!0),window.addEventListener("keydown",t=>{this.mode!="Play Mode"&&this.mode!="Record Mode"||t.key=="Escape"&&(this.setMode(this.lastMode),this.chartAudio.pause())},!0)}getBeat(){return this.beat}getTime(){return this.time}setBeat(e){this.loadedChart&&(this.beat=e,this.time=this.loadedChart.getSecondsFromBeat(this.beat),this.chartAudio.seek(this.time),this.getAssistTickIndex())}setTime(e,t){this.loadedChart&&(this.time=e,this.beat=this.loadedChart.getBeatFromSeconds(this.time),t||(this.chartAudio.seek(this.time),this.getAssistTickIndex()))}async loadSM(e){if(pt.instance.isDirty()){const s=new Ic(this.app,"Save","Do you wish to save the current file?",[{label:"Cancel",type:"default"},{label:"No",type:"default"},{label:"Yes",type:"confirm"}]);this.app.windowManager.openWindow(s);const n=await s.resolved;if(n=="Cancel")return;n=="Yes"&&this.save()}if(!e){this.smPath="",this.loadedSM=void 0,this.chartAudio.stop(),this.noChartTextA.visible=!1,this.noChartTextB.visible=!1,this.chartView?.destroy({children:!0});return}this.chartAudio.stop(),this.lastSong="",this.smPath=e,this.time=0,this.beat=0;const r=await(await qe.getFileHandle(this.smPath)).getFile();this.loadedSM=new Tm(r),await this.loadedSM.loaded,this.noChartTextA.visible=!0,this.noChartTextB.visible=!0,this.editTimingMode=0,se.emit("smLoaded"),await this.loadChart(),se.emit("smLoadedAfter"),this.time==0&&this.setBeat(0),Pm.addSM(this.smPath,this.loadedSM)}async loadChart(e){if(this.loadedSM!=null){if(e==null){if(this.loadedChart){const t=this.loadedSM.charts[this.loadedChart.gameType.id];t&&t.length>0&&(e=t.at(-1))}if(!e)for(const t of Ze.getPriority()){const r=this.loadedSM.charts[t.id];if(r&&r.length>0){e=r.at(-1);break}}if(!e){this.chartView?.destroy({children:!0}),this.chartView?.removeChildren(),this.beat=0,this.time=0,this.loadedChart=void 0,this.chartView=void 0,this.noChartTextA.visible=!0,this.noChartTextB.visible=!0,se.emit("chartLoaded"),se.emit("chartModified");return}}if(e!=this.loadedChart){if(this.chartView?.destroy({children:!0}),this.chartView?.removeChildren(),this.clearSelections(),this.loadedChart=e,this.beat=this.loadedChart.getBeatFromSeconds(this.time),pt.instance.reset(),A.play.timingCollection=A.play.defaultTimingCollection[e.gameType.id]??"ITG",this.getAssistTickIndex(),this.chartView=new GT(this),this.chartView.x=this.app.renderer.screen.width/2,this.chartView.y=this.app.renderer.screen.height/2,(this.mode=="Play Mode"||this.mode=="Record Mode")&&this.setMode(this.lastMode),this.loadedChart.getMusicPath()!=this.lastSong){this.lastSong=this.loadedChart.getMusicPath();const t=this.chartAudio.isPlaying();await this.loadAudio(),se.emit("audioLoaded"),t&&this.chartAudio.play()}this.noChartTextA.visible=!1,this.noChartTextB.visible=!1,Oe.create("Loaded chart "+e.difficulty+" "+e.meter+" "+e.gameType.id),se.emit("chartLoaded"),se.emit("audioLoaded"),se.emit("chartModified")}}}async loadAudio(){if(!this.loadedSM||!this.loadedChart)return;this.chartAudio.stop(),this.chartAudio?.destroy();const e=this.loadedChart.getMusicPath();if(e==""){Oe.createFormatted("Failed to load audio: no audio file","error"),this.chartAudio=new Ga(void 0);return}const t=await this.getAudioHandle(e);if(t==null){Oe.createFormatted("Failed to load audio: couldn't find audio file "+e,"error"),this.chartAudio=new Ga(void 0);return}const r=await t.getFile();this.chartAudio=new Ga(await r.arrayBuffer(),Ei(r.name)),this.chartAudio.seek(this.time),this.getAssistTickIndex()}async getAudioHandle(e){let t=await qe.getFileHandleRelativeTo(this.smPath,e);if(t)return t;const r=await qe.getDirectoryFiles(Zt(this.smPath));return t=r.filter(s=>s.name.toLowerCase()==pr(e).toLowerCase())[0],t?(Oe.createFormatted("Failed to locate audio file "+e+", using file "+t.name+" instead","warn"),t):(t=r.filter(s=>No.includes(Ei(s.name)))[0],t&&Oe.createFormatted("Failed to locate audio file "+e+", using file "+t.name+" instead","warn"),t)}getAudio(){return this.chartAudio}updateSoundProperties(){this.setEffectVolume(A.audio.soundEffectVolume*A.audio.masterVolume),this.setVolume(A.audio.songVolume*A.audio.masterVolume),this.setRate(A.audio.rate)}setRate(e){this.chartAudio.rate(e)}setVolume(e){this.chartAudio.volume(e)}setEffectVolume(e){this.assistTick.volume()!=e&&this.assistTick.volume(e),this.me_high.volume()!=e&&this.me_high.volume(e),this.me_low.volume()!=e&&this.me_low.volume(e),this.mine.volume()!=e&&this.mine.volume(e)}getAssistTickIndex(){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null||this.loadedChart.getNotedata().length==0){this.noteIndex=0;return}this.noteIndex=ki(this.loadedChart.getNotedata(),this.time,e=>e.second)+1,this.noteIndex>=1&&this.time<=this.loadedChart.getNotedata()[this.noteIndex-1].second&&this.noteIndex--}playPause(){this.chartAudio.isPlaying()?this.chartAudio.pause():this.chartAudio.play()}setAndSnapBeat(e){if(!this.loadedChart)return;const t=Math.max(.001,A.chart.snap),r=this.loadedChart.timingData.getBeatOfMeasure(e),s=e-r,n=Math.round(r/t)*t;let a=s+n;a=Math.max(0,a),this.setBeat(a)}previousSnap(){let e=this.getSnapIndex()-1;e=(e+Qt.length)%Qt.length,A.chart.snap=Qt[e]==-1?0:1/Qt[e],se.emit("snapChanged")}nextSnap(){let e=this.getSnapIndex();(e==Qt.length-1||Math.abs(1/A.chart.snap-Qt[e])<=5e-4)&&e++,e=(e+Qt.length)%Qt.length,A.chart.snap=Qt[e]==-1?0:1/Qt[e],se.emit("snapChanged")}getSnapIndex(){return A.chart.snap==0?Qt.length-1:Qt.findIndex(e=>1/e<=A.chart.snap)}removeDuplicateBeats(e){if(e.length===0)return e;const t=[e[0]];for(let r=1;rs.beat+s.hold);let t=this.loadedChart.getNotedata().map(s=>s.beat).concat(e).sort((s,n)=>s-n);t=this.removeDuplicateBeats(t);let r=ki(t,this.beat);this.beat==t[r]&&r--,this.setBeat(t[Math.max(0,r)])}nextNote(){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null||this.loadedChart.getNotedata().length==0)return;const e=this.loadedChart.getNotedata().filter(De).map(s=>s.beat+s.hold);let t=this.loadedChart.getNotedata().map(s=>s.beat).concat(e).sort((s,n)=>s-n);t=this.removeDuplicateBeats(t);let r=ki(t,this.beat);this.beat>=t[r]&&r++,this.setBeat(t[Math.min(t.length-1,r)])}firstNote(){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null)return;const e=this.loadedChart.getNotedata();e.length!=0&&this.setBeat(e[0].beat)}lastNote(){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null)return;const e=this.loadedChart.getNotedata();if(e.length==0)return;const t=e[e.length-1];this.setBeat(t.beat+(De(t)?t.hold:0))}truncateHold(e,t){const r=Je(Math.round((t-A.chart.snap)*48)/48,e.beat,e.beat+e.hold-.020833333333333332);return r==e.beat?{beat:e.beat,col:e.col,type:"Tap"}:{beat:e.beat,col:e.col,type:e.type,hold:r-e.beat}}setNote(e,t,r=this.beat){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null)return;r=Math.max(0,Math.round(r*48)/48);const s=this.loadedChart.getNotedata().filter(o=>o.col!=e?!1:Math.abs(o.beat-r)<.003?!0:De(o)&&o.beat==r),n=this.loadedChart.getNotedata().filter(o=>De(o)&&o.col==e&&r>o.beat&&r<=o.beat+o.hold).map(o=>({oldNote:o,newNote:this.truncateHold(o,r)})),a={startBeat:r,endBeat:r,roll:!1,originalNote:void 0,type:t,removedNotes:s,truncatedHolds:n};this.holdEditing[e]=a,s.length==0&&(a.originalNote={beat:r,col:e,type:this.getEditingNoteType()}),this.getAssistTickIndex(),this.app.actionHistory.run({action:()=>{a.removedNotes.forEach(o=>this.loadedChart.removeNote(o)),a.truncatedHolds.forEach(o=>this.loadedChart.modifyNote(o.oldNote,o.newNote)),a.originalNote&&this.loadedChart.addNote(a.originalNote)},undo:()=>{a.originalNote&&this.loadedChart.removeNote(a.originalNote),a.truncatedHolds.forEach(o=>this.loadedChart.modifyNote(o.newNote,o.oldNote)),a.removedNotes.forEach(o=>this.loadedChart.addNote(o))}})}editHoldBeat(e,t,r){if(this.loadedSM==null||this.loadedChart==null||this.chartView==null)return;const s=this.holdEditing[e];if(s==null||t==s.startBeat&&t==s.endBeat)return;if(s.endBeat=Math.max(s.startBeat,Math.round(t*48)/48),s.roll||=r,!s.originalNote)this.loadedChart.addNote({beat:s.startBeat,col:e,type:s.roll?"Roll":"Hold",hold:s.endBeat-s.startBeat});else{const a={beat:s.startBeat,type:s.roll?"Roll":"Hold",hold:s.endBeat-s.startBeat};s.endBeat-s.startBeat==0&&(a.hold=void 0,a.type="Tap"),(a.beat!=s.originalNote.beat||a.type!=s.originalNote.type||De(s.originalNote)&&a.hold!=s.originalNote.hold)&&this.loadedChart.modifyNote(s.originalNote,a)}s.originalNote={beat:s.startBeat,col:e,type:s.endBeat-s.startBeat==0?"Tap":s.roll?"Roll":"Hold",hold:s.endBeat-s.startBeat==0?void 0:s.endBeat-s.startBeat};const n=this.loadedChart.getNotedata().filter(a=>a.beat==s.originalNote.beat&&a.col==s.originalNote.col||a.col!=e?!1:a.beat>=s.startBeat&&a.beat<=s.endBeat?!0:De(a)&&a.beat+a.hold>=s.startBeat&&a.beat+a.hold<=s.endBeat);s.removedNotes=s.removedNotes.concat(n),n.forEach(a=>this.loadedChart.removeNote(a)),this.getAssistTickIndex()}endEditing(e){this.holdEditing[e]=void 0}previousNoteType(){const e=this.loadedChart?.gameType.editNoteTypes.length??0;this.editNoteTypeIndex=(this.editNoteTypeIndex-1+e)%e}nextNoteType(){const e=this.loadedChart?.gameType.editNoteTypes.length??0;this.editNoteTypeIndex=(this.editNoteTypeIndex+1+e)%e}getEditingNoteType(){return this.loadedChart?.gameType.editNoteTypes[this.editNoteTypeIndex]??null}setEditingNoteType(e){if(!this.loadedChart)return;const r=(this.loadedChart?.gameType.editNoteTypes).indexOf(e);r!=-1&&(this.editNoteTypeIndex=r)}getMode(){return this.mode}setMode(e){if(!this.loadedChart||!this.chartView)return;if(this.mode==e){(e=="Play Mode"||e=="Record Mode")&&(this.setMode(this.lastMode),this.getAssistTickIndex(),this.chartAudio.pause());return}(this.mode=="View Mode"||this.mode=="Edit Mode")&&(this.lastMode=this.mode),this.mode=e;const t=this.loadedChart.getNotedata();if(this.mode=="Play Mode"){t.forEach(r=>{r.gameplay={hideNote:!1,hasHit:!1}});for(const r of t)if(r.secondr.gameplay=void 0))}judgeCol(e){if(!(!this.loadedChart||!this.chartView)){if(this.mode=="Play Mode")this.loadedChart.gameType.gameLogic.keyDown(this,e);else if(this.mode=="Record Mode"){const t=this.loadedChart.getBeatFromSeconds(this.time+A.play.offset),r=A.chart.snap==0?1/48:A.chart.snap,s=Math.round(t/r)*r;this.setNote(e,"key",s)}}}judgeColUp(e){!this.loadedChart||!this.chartView||(this.mode=="Play Mode"?this.loadedChart.gameType.gameLogic.keyUp(this,e):this.mode=="Record Mode"&&this.endEditing(e))}async save(){if(!this.loadedSM)return;if(!pt.instance.isDirty()){Oe.create("Saved");return}const e=this.smPath.split("/"),t=e.pop().split(".").slice(0,-1).join("."),r=e.join("/");!this.loadedSM.usesSplitTiming()&&await qe.getFileHandle(r+"/"+t+".sm")&&qe.writeFile(r+"/"+t+".sm",this.loadedSM.serialize("sm")),(this.loadedSM.requiresSSC()||await qe.getFileHandle(r+"/"+t+".ssc"))&&qe.writeFile(r+"/"+t+".ssc",this.loadedSM.serialize("ssc")),this.loadedSM.usesSplitTiming()?Oe.create("Saved. No SM file since split timing was used."):Oe.create("Saved"),pt.instance.setLimit()}hasSelection(){return this.selection.notes.length>0||this.eventSelection.timingEvents.length>0||this.startRegion!==void 0&&this.endRegion!==void 0}hasRange(){return this.selection.notes.length>1||this.eventSelection.timingEvents.length>1||this.startRegion!==void 0&&this.endRegion!==void 0}clearSelections(){this.selection={notes:[],inProgressNotes:[]},this.eventSelection={timingEvents:[],inProgressTimingEvents:[]}}startDragSelection(){this.selection.inProgressNotes=[]}endDragSelection(){this.selection.notes=this.selection.notes.concat(this.selection.inProgressNotes)}startDragEventSelection(){this.eventSelection.inProgressTimingEvents=[]}endDragEventSelection(){this.eventSelection.timingEvents=this.eventSelection.timingEvents.concat(this.eventSelection.inProgressTimingEvents)}addNoteToDragSelection(e){this.selection.inProgressNotes.push(e)}removeNoteFromDragSelection(e){const t=this.selection.inProgressNotes.indexOf(e);t!=-1&&this.selection.inProgressNotes.splice(t,1)}addEventToDragSelection(e){this.eventSelection.inProgressTimingEvents.push(e)}removeEventFromDragSelection(e){const t=this.eventSelection.inProgressTimingEvents.indexOf(e);t!=-1&&this.eventSelection.inProgressTimingEvents.splice(t,1)}addNoteToSelection(e){this.selection.notes.push(e)}removeNoteFromSelection(e){const t=this.selection.notes.indexOf(e);t!=-1&&this.selection.notes.splice(t,1)}addEventToSelection(e){this.eventSelection.timingEvents.push(e)}removeEventFromSelection(e){const t=this.eventSelection.timingEvents.indexOf(e);t!=-1&&this.eventSelection.timingEvents.splice(t,1)}selectRegion(){if(this.loadedChart){if(this.endRegion!==void 0&&(this.startRegion=void 0,this.endRegion=void 0),this.startRegion===void 0){this.clearSelections(),this.startRegion=this.beat;return}if(this.endRegion===void 0){this.endRegion=this.beat,this.endRegione.beat>=this.startRegion&&e.beat<=this.endRegion).filter(e=>!this.selection.notes.includes(e)).forEach(e=>this.addNoteToSelection(e));return}}}modifySelection(e){if(!this.loadedChart)return;const t=this.selection.notes,r=structuredClone(this.selection.notes).map(e).sort((a,o)=>a.beat==o.beat?a.col-o.col:a.beat-o.beat);if(r.length==0)return;const{removedNotes:s,truncatedHolds:n}=this.checkConflicts(r,t);this.app.actionHistory.run({action:()=>{this.loadedChart.removeNotes(t.concat(s)),n.forEach(a=>this.loadedChart.modifyNote(a.oldNote,a.newNote)),this.clearSelections(),this.selection.notes=this.loadedChart.addNotes(r)},undo:()=>{this.loadedChart.removeNotes(r),n.forEach(a=>this.loadedChart.modifyNote(a.newNote,a.oldNote)),this.loadedChart.addNotes(s),this.clearSelections(),this.selection.notes=this.loadedChart.addNotes(t)}})}checkConflicts(e,t=[]){const r=this.loadedChart.getNotedata();let s=r.findIndex(l=>e[0].beat<=(De(l)?l.beat+l.hold:l.beat));const n=[],a=[],o=[];for(const l of e)for(;r[s];){const c=r[s],u=De(l)?l.beat+l.hold:l.beat;c.col==l.col&&!t.includes(c)&&!o.includes(c)&&(l.beat<=c.beat&&u>=c.beat?(o.push(c),n.push(c)):De(c)&&c.beat+c.hold>=l.beat&&c.beatu){s--;break}}return{removedNotes:n,truncatedHolds:a}}modifyEventSelection(e){if(!this.loadedChart)return;const t=this.loadedChart.timingData,r=this.eventSelection.timingEvents,s=structuredClone(this.eventSelection.timingEvents).map(e);if(s.length==0)return;let n=[];this.app.actionHistory.run({action:()=>{t.rawDeleteMultiple(r),t.rawInsertMultiple(s),n=t.findConflicts(),t.rawDeleteMultiple(n),this.clearSelections(),this.eventSelection.timingEvents=s,se.emit("timingModified"),se.emit("chartModified"),s.find(a=>a.type=="TIMESIGNATURES")&&se.emit("timeSigChanged")},undo:()=>{t.rawInsertMultiple(n),t.rawDeleteMultiple(s),t.rawInsertMultiple(r),this.clearSelections(),this.eventSelection.timingEvents=r,se.emit("timingModified"),se.emit("chartModified"),s.find(a=>a.type=="TIMESIGNATURES")&&se.emit("timeSigChanged")},redo:()=>{t.rawDeleteMultiple(r),t.rawInsertMultiple(s),t.rawDeleteMultiple(n),this.clearSelections(),this.eventSelection.timingEvents=s,se.emit("timingModified"),se.emit("chartModified"),s.find(a=>a.type=="TIMESIGNATURES")&&se.emit("timeSigChanged")}})}deleteSelection(){if(this.selection.notes.length==0)return;const e=this.selection.notes;this.app.actionHistory.run({action:()=>{this.loadedChart.removeNotes(e),this.clearSelections()},undo:()=>{this.selection.notes=this.loadedChart.addNotes(e)}})}deleteEventSelection(){if(this.eventSelection.timingEvents.length==0)return;const e=this.eventSelection.timingEvents,t=this.loadedChart.timingData;let r=[];this.app.actionHistory.run({action:()=>{t.rawDeleteMultiple(e),r=t.findConflicts(),t.rawDeleteMultiple(r),this.clearSelections(),se.emit("timingModified"),se.emit("chartModified"),e.find(s=>s.type=="TIMESIGNATURES")&&se.emit("timeSigChanged")},undo:()=>{t.rawInsertMultiple(r),t.rawInsertMultiple(e),this.eventSelection.timingEvents=e,se.emit("timingModified"),se.emit("chartModified"),e.find(s=>s.type=="TIMESIGNATURES")&&se.emit("timeSigChanged")},redo:()=>{t.rawDeleteMultiple(e),t.rawDeleteMultiple(r),this.clearSelections(),se.emit("timingModified"),se.emit("chartModified"),e.find(s=>s.type=="TIMESIGNATURES")&&se.emit("timeSigChanged")}})}paste(e){if(this.loadedChart&&(e.startsWith("ArrowVortex:notes:")&&(this.pasteNotes(e)||this.pasteNotes(this.virtualClipboard)),e.startsWith("ArrowVortex:tempo:")||e.startsWith("SMEditor:tempo:"))){this.pasteTempo(e)||this.pasteTempo(this.virtualClipboard);return}}pasteNotes(e){if(!this.loadedChart)return!0;const t=yT(e);if(!t||t.length==0)return!1;t.map(n=>(n.beat+=this.beat,n.beat=Math.round(n.beat*48)/48,n)).sort((n,a)=>n.beat==a.beat?n.col-a.col:n.beat-a.beat);const{removedNotes:r,truncatedHolds:s}=this.checkConflicts(t);return this.app.actionHistory.run({action:()=>{this.loadedChart.removeNotes(r),s.forEach(n=>{this.loadedChart.modifyNote(n.oldNote,n.newNote)}),this.clearSelections(),this.selection.notes=this.loadedChart.addNotes(t)},undo:()=>{this.loadedChart.removeNotes(t),s.forEach(n=>{this.loadedChart.modifyNote(n.newNote,n.oldNote)}),this.loadedChart.addNotes(r),this.clearSelections()}}),!0}pasteTempo(e){if(!this.loadedChart)return!0;const t=ET(e);if(!t||t.length==0)return!1;const r=this.loadedChart.timingData;let s=[];return t.forEach(n=>{n.type=="ATTACKS"?n.second+=this.time:n.beat+=this.beat}),this.app.actionHistory.run({action:()=>{r.rawInsertMultiple(t),s=r.findConflicts(),r.rawDeleteMultiple(s),this.clearSelections(),this.eventSelection.timingEvents=t,se.emit("timingModified"),se.emit("chartModified"),t.find(n=>n.type=="TIMESIGNATURES")&&se.emit("timeSigChanged")},undo:()=>{r.rawInsertMultiple(s),r.rawDeleteMultiple(t),this.clearSelections(),se.emit("timingModified"),se.emit("chartModified"),t.find(n=>n.type=="TIMESIGNATURES")&&se.emit("timeSigChanged")},redo:()=>{r.rawInsertMultiple(t),r.rawDeleteMultiple(s),this.clearSelections(),this.eventSelection.timingEvents=t,se.emit("timingModified"),se.emit("chartModified"),t.find(n=>n.type=="TIMESIGNATURES")&&se.emit("timeSigChanged")}}),!0}copy(){if(this.selection.notes.length!=0){const e=Math.min(...this.selection.notes.map(s=>s.beat)),t=structuredClone(this.selection.notes).map(s=>(s.beat-=e,s)).sort((s,n)=>s.beat==n.beat?s.col-n.col:s.beat-n.beat),r=vT(t);return this.virtualClipboard=r,r}else if(this.eventSelection.timingEvents.length!=0){const e=Math.min(...this.eventSelection.timingEvents.map(n=>n.beat)),t=this.loadedChart.timingData.getSecondsFromBeat(e),r=structuredClone(this.eventSelection.timingEvents).map(n=>n.type=="ATTACKS"?(n.second-=t,n):(n.beat-=e,n)).sort((n,a)=>n.type!=a.type?n.type.localeCompare(a.type):n.type=="ATTACKS"?n.second-a.second:n.beat-a.beat),s=_T(r);return this.virtualClipboard=s,s}}}class jT{app;view;constructor(e,t){this.app=e,this.view=t;const r=Object.values(Os).map(s=>this.createElement(s));t.replaceChildren(...r)}createElement(e){if(e.type=="seperator"){const t=document.createElement("div");return t.classList.add("seperator"),t}if(e.type=="selection"||e.type=="checkbox"||e.type=="dropdown"){const t=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div");let n;if(e.type=="selection"||e.type=="checkbox"){const a=ht[e.id]??{label:e.id,combos:[],callback:()=>{}};n=document.createElement("div"),n.innerText=it.getKeybindString(e.id),n.classList.add("keybind","unselectable"),s.innerText=a.label;let o=a.disabled;typeof o=="function"&&(o=o(this.app)),o&&t.classList.add("disabled"),t.addEventListener("click",()=>{if(o)return;a.callback(this.app),t.closest(".menu-main").querySelector(".menubar-dropdown").replaceChildren()})}else n=document.createElement("img"),n.classList.add("icon"),n.src=Ge.CHEVRON,n.style.transform="rotate(-90deg)",s.innerText=typeof e.title=="function"?e.title(this.app):e.title;if(r.appendChild(s),r.appendChild(n),t.appendChild(r),t.classList.add("menu-item"),r.classList.add("menu-item-title","menu-hover"),s.classList.add("title","unselectable"),e.type=="dropdown"){const a=document.createElement("div");t.appendChild(a),a.classList.add("menubar-dropdown"),e.options.map(o=>this.createElement(o)).forEach(o=>a.appendChild(o))}if(e.type=="checkbox"){let a=e.checked;typeof a=="function"&&(a=a(this.app)),a&&(s.innerText="✓ "+s.innerText)}return t}if(e.type=="menu"){const t=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div");return t.appendChild(r),r.innerText=e.title,t.appendChild(s),r.classList.add("title","unselectable"),t.classList.add("menu-item","menu-main"),r.classList.add("menu-hover"),s.classList.add("menubar-dropdown","unselectable"),t.onmouseenter=()=>{s.replaceChildren(...e.options.map(n=>this.createElement(n)))},t.onmouseleave=()=>{s.replaceChildren()},t}return document.createElement("div")}}class XT extends Vt{app;keyHandler;constructor(e){super({title:"Open a Song",width:400,height:320,disableClose:!0,win_id:"select_sm_initial"}),this.app=e,this.keyHandler=this.handleKeyEvent.bind(this),window.addEventListener("keydown",this.keyHandler),this.initView()}onClose(){window.removeEventListener("keydown",this.keyHandler)}initView(){this.viewElement.replaceChildren();const e=document.createElement("div");e.classList.add("padding");const t=document.createElement("div");t.classList.add("open-container"),e.appendChild(t);const r=document.createElement("div");r.classList.add("top-container");const s=document.createElement("div");s.classList.add("seperator"),s.style.margin="10px";const n=document.createElement("div");n.classList.add("bottom-container"),t.appendChild(r),t.appendChild(s),t.appendChild(n);const a=document.createElement("button");a.style.display="flex",a.style.flexDirection="column",a.style.padding="10px",a.style.backgroundColor="#414352",r.appendChild(a);const o=document.createElement("img");o.src=Ge.UPLOAD,o.classList.add("icon"),o.style.width="30px",o.style.height="30px",a.appendChild(o);const l=document.createElement("div");l.innerText=window.nw?"Open an existing song":"Import a song folder",a.appendChild(l),a.onclick=()=>{if(window.nw){const p=document.createElement("input");p.type="file",p.accept=".sm,.ssc",p.onchange=()=>{this.app.chartManager.loadSM(p.value),this.closeWindow()},p.click()}else this.app.windowManager.openWindow(new sa(this.app,{title:"Select an sm/ssc file...",accepted_file_types:[".sm",".ssc"],disableClose:!0,callback:p=>{this.app.chartManager.loadSM(p),this.closeWindow()}}))};const c=document.createElement("button");c.style.display="flex",c.style.flexDirection="column",c.style.padding="10px",c.style.backgroundColor="#506352",r.appendChild(c);const u=document.createElement("img");u.src=Ge.PLUS,u.classList.add("icon"),u.style.width="30px",u.style.height="30px",c.appendChild(u);const h=document.createElement("div");h.innerText="New Song",c.appendChild(h),c.onclick=()=>{this.app.windowManager.openWindow(new Mm(this.app))};const d=document.createElement("div");d.innerText="Recently Opened",d.classList.add("title"),n.appendChild(d);const f=document.createElement("div");f.classList.add("recent-selector"),n.appendChild(f),Pm.getRecents().then(p=>p.forEach(m=>{const g=document.createElement("div");g.classList.add("recent-item");const y=document.createElement("div");y.classList.add("recent-name"),y.innerText=m.name;const b=document.createElement("div");b.classList.add("recent-path"),b.innerText=m.path,g.appendChild(y),g.appendChild(b),g.onclick=()=>{f.querySelectorAll(".selected").forEach(w=>w.classList.remove("selected")),g.classList.add("selected")},g.ondblclick=()=>{this.app.chartManager.loadSM(m.path),this.closeWindow()},f.appendChild(g)})),this.viewElement.appendChild(e)}handleKeyEvent(e){if(!this.windowElement.classList.contains("focused"))return;const t=this.viewElement.querySelector(".selected");if(t){if(e.code=="ArrowUp"){e.preventDefault(),e.stopImmediatePropagation();const r=t.previousElementSibling;r&&(t.parentElement.querySelectorAll(".selected").forEach(s=>s.classList.remove("selected")),r.classList.add("selected"),Un(r,{scrollMode:"if-needed",block:"nearest",inline:"nearest"}))}if(e.code=="ArrowDown"){e.preventDefault(),e.stopImmediatePropagation();const r=t.nextElementSibling;r&&(t.parentElement.querySelectorAll(".selected").forEach(s=>s.classList.remove("selected")),r.classList.add("selected"),Un(r,{scrollMode:"if-needed",block:"nearest",inline:"nearest"}))}}}}class YT{view;windows=[];app;constructor(e,t){this.app=e,this.view=t}unfocusAll(){for(const e of this.view.querySelectorAll(".focused"))e.classList.remove("focused")}getFocusedWindow(){for(const e of this.windows)if(e.windowElement.classList.contains("focused"))return e;return null}isBlocked(){return!this.windows.every(e=>!e.options.blocking)}openWindow(e){if(e.options.win_id){const t=this.getWindowById(e.options.win_id);if(t){t.focus();return}}e.addToManager(this),this.windows.push(e)}removeWindow(e){this.windows.splice(this.windows.indexOf(e),1)}getWindowById(e){for(const t of this.windows)if(t.options.win_id==e)return t}}class sf{renderer;ticker;stage;view;chartManager;windowManager;menubarManager;actionHistory;lastWidth=window.innerWidth;lastHeight=window.innerHeight;constructor(){if(kr.setDefaultProps({duration:[200,100],theme:"sm"}),window.nw){const e=nw.Window.get();window.addEventListener("keydown",t=>{(t.key=="r"&&(t.metaKey||t.ctrlKey)||t.key=="F5")&&(t.preventDefault(),e.reload())})}A.loadOptions(),it.load(this),setInterval(()=>A.saveOptions(),1e4),A.general.smoothAnimations&&document.body.classList.add("animated"),this.registerFonts(),this.view=document.getElementById("pixi"),document.oncontextmenu=e=>{e.preventDefault(),this.chartManager.loadedChart&&e.target==this.view&&zh.open(this,e)},this.view.onmousedown=()=>{zh.close()},this.stage=new xe,this.stage.sortableChildren=!0,this.renderer=new us({backgroundColor:1579292,antialias:A.performance.antialiasing,width:this.view.clientWidth,height:this.view.clientHeight,resolution:A.performance.resolution,autoDensity:!0,view:this.view,powerPreference:"low-power"}),this.ticker=new At,this.ticker.maxFPS=120,this.ticker.add(()=>{const e=performance.now();this.renderer.render(this.stage),cs.instance?.addFrameTimeValue(performance.now()-e),performance.memory?.usedJSHeapSize&&cs.instance?.addMemoryTimeValue(performance.memory.usedJSHeapSize),aT()},Mr.LOW),this.ticker.start(),Nt.init(this.renderer),this.chartManager=new VT(this),this.menubarManager=new jT(this,document.getElementById("menubar")),this.windowManager=new YT(this,document.getElementById("windows")),this.actionHistory=new pt(this),this.registerListeners(),this.onResize(),this.windowManager.openWindow(new XT(this)),window.onbeforeunload=e=>{if(pt.instance.isDirty()&&A.general.warnBeforeExit)return e.preventDefault(),e.returnValue="Are you sure you want to exit?"},window.onunload=()=>{A.saveOptions()}}registerFonts(){Bt.from("Main",{fontFamily:"Assistant",fontSize:20,fill:"white"},{chars:[["a","z"],["A","Z"],"!@#$%^&*()~{}[]:.-?=,_","0123456789/"," "],resolution:window.devicePixelRatio}),Bt.from("Fancy",{fontFamily:"Assistant",fontSize:40,fontWeight:"700",fill:["#dddddd","#ffffff"],fillGradientType:ta.LINEAR_VERTICAL,stroke:11184810,strokeThickness:3},{chars:[["a","z"],["A","Z"],"!@#$%^&*()~{}[]:.-?=,_","0123456789/"," "],resolution:window.devicePixelRatio})}registerListeners(){window.addEventListener("keydown",function(e){e.code=="Tab"&&e.preventDefault(),e.code=="Enter"&&e.target instanceof HTMLButtonElement&&e.preventDefault()}),window.addEventListener("dragstart",function(e){e.target instanceof HTMLImageElement&&e.preventDefault()}),setInterval(()=>{(this.lastHeight!=window.innerHeight||this.lastWidth!=window.innerWidth)&&(this.lastHeight=window.innerHeight,this.lastWidth=window.innerWidth,this.onResize(),se.emit("resize"))},100),window.addEventListener("dragover",e=>{e.preventDefault(),e.dataTransfer.dropEffect="copy"}),window.addEventListener("drop",e=>{if(window.nw){e.stopPropagation(),e.preventDefault();let t="";for(const r of e.dataTransfer.files)if(r.path)if(Ei(r.path)==".ssc"){t=r.path;break}else t==""&&Ei(r.path)==".sm"&&(t=r.path);t!=""&&(this.chartManager.loadSM(t),this.windowManager.getWindowById("select_sm_initial")?.closeWindow())}else qe.handleDropEvent(e).then(t=>{const r=new sa(this,{title:"Select an sm/ssc file...",accepted_file_types:[".sm",".ssc"],disableClose:!0,callback:s=>{this.chartManager.loadSM(s),this.windowManager.getWindowById("select_sm_initial")?.closeWindow()},onload:()=>{r.getAcceptableFile(t??"").then(s=>r.selectPath(s))}});this.windowManager.openWindow(r)})})}onResize(){const e=window.innerWidth,t=window.innerHeight-document.getElementById("menubar").clientHeight;this.renderer.screen.width=e,this.renderer.screen.height=t,this.view.width=e*this.renderer.resolution,this.view.height=t*this.renderer.resolution,this.view.style.width=`${e}px`,this.view.style.height=`${t}px`}}document.querySelector("body").innerHTML=`
@@ -1325,7 +1326,7 @@ ${this.lastFrameTime.toFixed(2)} ms
- `;sA.load({google:{families:["Assistant:200,300,400,500,600,700,800&display=swap"]},active:af,inactive:af,classes:!1});window.fs=$e;function af(){const i=document.createElement("canvas");i.getContext("webgl")||i.getContext("experimental-webgl")?lm().includes("Safari")?(document.querySelector("body").innerHTML=`
+ `;rA.load({google:{families:["Assistant:200,300,400,500,600,700,800&display=swap"]},active:nf,inactive:nf,classes:!1});window.fs=qe;function nf(){const i=document.createElement("canvas");i.getContext("webgl")||i.getContext("experimental-webgl")?om().includes("Safari")?(document.querySelector("body").innerHTML=`

Safari is currently not supported

Please use Chrome/Firefox instead.
@@ -1343,9 +1344,9 @@ ${this.lastFrameTime.toFixed(2)} ms
- `,window.app=new nf,window.runSafari=void 0}):window.app=new nf:document.querySelector("body").innerHTML=`
+ `,window.app=new sf,window.runSafari=void 0}):window.app=new sf:document.querySelector("body").innerHTML=`

WebGL is not enabled

Please visit your browser settings and enable WebGL.
-
`}export{Ir as F,os as _,rn as a,SE as b,ii as c,$1 as d,$n as g,Dg as r}; +
`}export{Pr as F,Ir as _,sn as a,TE as b,ii as c,qT as d,Kn as g,Rg as r}; diff --git a/beta/assets/memory-52dcb63c.js b/beta/assets/memory-7221a3c9.js similarity index 96% rename from beta/assets/memory-52dcb63c.js rename to beta/assets/memory-7221a3c9.js index 1b44ea9f..4cef5108 100644 --- a/beta/assets/memory-52dcb63c.js +++ b/beta/assets/memory-7221a3c9.js @@ -1 +1 @@ -import{errors as c,isChunkObject as y}from"./util-83e43b90.js";import"./index-92a586e7.js";let n=globalThis.File,p=globalThis.Blob;const m=o=>{n=o},g=o=>{p=o},{INVALID:z,GONE:s,MISMATCH:w,MOD_ERR:E,SYNTAX:l,DISALLOWED:O}=c;class D{constructor(e,i){this.fileHandle=e,this.file=i?e.file:new n([],e.file.name,e.file),this.size=i?e.file.size:0,this.position=0}async write(e){if(!this.fileHandle.file)throw new DOMException(...s);let i=this.file;if(y(e)){if(e.type==="write"){if(typeof e.position=="number"&&e.position>=0&&(this.position=e.position,this.size=0){if(this.size=0){i=e.sizei.size&&(this.position=i.size),this.file=i;return}else throw new DOMException(...l("truncate requires a size argument"))}e=new p([e]);let t=this.file;const a=t.slice(0,this.position),d=t.slice(this.position+e.size);let r=this.position-a.size;r<0&&(r=0),t=new n([a,new Uint8Array(r),e,d],t.name),this.size=t.size,this.position+=e.size,this.file=t}async close(){if(!this.fileHandle.file)throw new DOMException(...s);this.fileHandle.file=this.file,this.file=this.position=this.size=null,this.fileHandle.onclose&&this.fileHandle.onclose(this.fileHandle)}}class f{constructor(e="",i=new n([],e),t=!0){this.kind="file",this.deleted=!1,this.file=i,this.name=e,this.writable=t}async getFile(){if(this.deleted||this.file===null)throw new DOMException(...s);return this.file}async createWritable(e){if(!this.writable)throw new DOMException(...O);if(this.deleted)throw new DOMException(...s);return new D(this,!!e?.keepExistingData)}async isSameEntry(e){return this===e}destroy(){this.deleted=!0,this.file=null}}class h{constructor(e,i=!0){this.kind="directory",this.deleted=!1,this._entries={},this.name=e,this.writable=i}async*entries(){if(this.deleted)throw new DOMException(...s);yield*Object.entries(this._entries)}async isSameEntry(e){return this===e}async getDirectoryHandle(e,i={}){if(this.deleted)throw new DOMException(...s);const t=this._entries[e];if(t){if(t instanceof f)throw new DOMException(...w);return t}else{if(i.create)return this._entries[e]=new h(e);throw new DOMException(...s)}}async getFileHandle(e,i={}){const t=this._entries[e];if(t){if(t instanceof f)return t;throw new DOMException(...w)}else{if(i.create)return this._entries[e]=new f(e);throw new DOMException(...s)}}async removeEntry(e,i={}){const t=this._entries[e];if(!t)throw new DOMException(...s);t.destroy(i.recursive),delete this._entries[e]}destroy(e){for(let i of Object.values(this._entries)){if(!e)throw new DOMException(...E);i.destroy(e)}this._entries={},this.deleted=!0}}const M=new h(""),u=()=>M;export{f as FileHandle,h as FolderHandle,u as default,g as setBlobImpl,m as setFileImpl}; +import{errors as c,isChunkObject as y}from"./util-849946d7.js";import"./index-abdbff68.js";let n=globalThis.File,p=globalThis.Blob;const m=o=>{n=o},g=o=>{p=o},{INVALID:z,GONE:s,MISMATCH:w,MOD_ERR:E,SYNTAX:l,DISALLOWED:O}=c;class D{constructor(e,i){this.fileHandle=e,this.file=i?e.file:new n([],e.file.name,e.file),this.size=i?e.file.size:0,this.position=0}async write(e){if(!this.fileHandle.file)throw new DOMException(...s);let i=this.file;if(y(e)){if(e.type==="write"){if(typeof e.position=="number"&&e.position>=0&&(this.position=e.position,this.size=0){if(this.size=0){i=e.sizei.size&&(this.position=i.size),this.file=i;return}else throw new DOMException(...l("truncate requires a size argument"))}e=new p([e]);let t=this.file;const a=t.slice(0,this.position),d=t.slice(this.position+e.size);let r=this.position-a.size;r<0&&(r=0),t=new n([a,new Uint8Array(r),e,d],t.name),this.size=t.size,this.position+=e.size,this.file=t}async close(){if(!this.fileHandle.file)throw new DOMException(...s);this.fileHandle.file=this.file,this.file=this.position=this.size=null,this.fileHandle.onclose&&this.fileHandle.onclose(this.fileHandle)}}class f{constructor(e="",i=new n([],e),t=!0){this.kind="file",this.deleted=!1,this.file=i,this.name=e,this.writable=t}async getFile(){if(this.deleted||this.file===null)throw new DOMException(...s);return this.file}async createWritable(e){if(!this.writable)throw new DOMException(...O);if(this.deleted)throw new DOMException(...s);return new D(this,!!e?.keepExistingData)}async isSameEntry(e){return this===e}destroy(){this.deleted=!0,this.file=null}}class h{constructor(e,i=!0){this.kind="directory",this.deleted=!1,this._entries={},this.name=e,this.writable=i}async*entries(){if(this.deleted)throw new DOMException(...s);yield*Object.entries(this._entries)}async isSameEntry(e){return this===e}async getDirectoryHandle(e,i={}){if(this.deleted)throw new DOMException(...s);const t=this._entries[e];if(t){if(t instanceof f)throw new DOMException(...w);return t}else{if(i.create)return this._entries[e]=new h(e);throw new DOMException(...s)}}async getFileHandle(e,i={}){const t=this._entries[e];if(t){if(t instanceof f)return t;throw new DOMException(...w)}else{if(i.create)return this._entries[e]=new f(e);throw new DOMException(...s)}}async removeEntry(e,i={}){const t=this._entries[e];if(!t)throw new DOMException(...s);t.destroy(i.recursive),delete this._entries[e]}destroy(e){for(let i of Object.values(this._entries)){if(!e)throw new DOMException(...E);i.destroy(e)}this._entries={},this.deleted=!0}}const M=new h(""),u=()=>M;export{f as FileHandle,h as FolderHandle,u as default,g as setBlobImpl,m as setFileImpl}; diff --git a/beta/assets/svg/highpass.svg b/beta/assets/svg/highpass.svg new file mode 100644 index 00000000..3690296e --- /dev/null +++ b/beta/assets/svg/highpass.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/beta/assets/svg/highshelf.svg b/beta/assets/svg/highshelf.svg new file mode 100644 index 00000000..8fbd6a4e --- /dev/null +++ b/beta/assets/svg/highshelf.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/beta/assets/svg/lowpass.svg b/beta/assets/svg/lowpass.svg new file mode 100644 index 00000000..15126332 --- /dev/null +++ b/beta/assets/svg/lowpass.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/beta/assets/svg/lowshelf.svg b/beta/assets/svg/lowshelf.svg new file mode 100644 index 00000000..d8350773 --- /dev/null +++ b/beta/assets/svg/lowshelf.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/beta/assets/svg/peaking.svg b/beta/assets/svg/peaking.svg new file mode 100644 index 00000000..881de8cd --- /dev/null +++ b/beta/assets/svg/peaking.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/beta/assets/util-83e43b90.js b/beta/assets/util-849946d7.js similarity index 69% rename from beta/assets/util-83e43b90.js rename to beta/assets/util-849946d7.js index 54529f8b..c7dbfea8 100644 --- a/beta/assets/util-83e43b90.js +++ b/beta/assets/util-849946d7.js @@ -1 +1 @@ -import{_ as l}from"./index-92a586e7.js";const E={INVALID:["seeking position failed.","InvalidStateError"],GONE:["A requested file or directory could not be found at the time an operation was processed.","NotFoundError"],MISMATCH:["The path supplied exists, but was not an entry of requested type.","TypeMismatchError"],MOD_ERR:["The object can not be modified in this way.","InvalidModificationError"],SYNTAX:e=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${e}`,"SyntaxError"],ABORT:["The operation was aborted","AbortError"],SECURITY:["It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.","SecurityError"],DISALLOWED:["The request is not allowed by the user agent or the platform in the current context.","NotAllowedError"]},y=e=>typeof e=="object"&&typeof e.type<"u";async function v(e){var r,o,a;const{FolderHandle:t,FileHandle:u}=await l(()=>import("./memory-52dcb63c.js"),["./memory-52dcb63c.js","./index-92a586e7.js","./index-cf2356c2.css"],import.meta.url),{FileSystemDirectoryHandle:_}=await l(()=>import("./index-92a586e7.js").then(i=>i.d),["./index-92a586e7.js","./index-cf2356c2.css"],import.meta.url),p=(o=(r=e[0].webkitRelativePath)===null||r===void 0?void 0:r.split("/",1)[0])!==null&&o!==void 0?o:"",m=new t(p,!1);for(let i=0;i(c._entries[s]||(c._entries[s]=new t(s,!1)),c._entries[s]),m);w._entries[f]=new u(n.name,n,!1)}return new _(m)}async function b(e){const{FileHandle:r}=await l(()=>import("./memory-52dcb63c.js"),["./memory-52dcb63c.js","./index-92a586e7.js","./index-cf2356c2.css"],import.meta.url),{FileSystemFileHandle:o}=await l(()=>import("./index-92a586e7.js").then(t=>t.b),["./index-92a586e7.js","./index-cf2356c2.css"],import.meta.url);return Array.from(e).map(t=>new o(new r(t.name,t,!1)))}export{E as errors,y as isChunkObject,v as makeDirHandleFromFileList,b as makeFileHandlesFromFileList}; +import{_ as l}from"./index-abdbff68.js";const E={INVALID:["seeking position failed.","InvalidStateError"],GONE:["A requested file or directory could not be found at the time an operation was processed.","NotFoundError"],MISMATCH:["The path supplied exists, but was not an entry of requested type.","TypeMismatchError"],MOD_ERR:["The object can not be modified in this way.","InvalidModificationError"],SYNTAX:e=>[`Failed to execute 'write' on 'UnderlyingSinkBase': Invalid params passed. ${e}`,"SyntaxError"],ABORT:["The operation was aborted","AbortError"],SECURITY:["It was determined that certain files are unsafe for access within a Web application, or that too many calls are being made on file resources.","SecurityError"],DISALLOWED:["The request is not allowed by the user agent or the platform in the current context.","NotAllowedError"]},y=e=>typeof e=="object"&&typeof e.type<"u";async function v(e){var r,o,a;const{FolderHandle:t,FileHandle:u}=await l(()=>import("./memory-7221a3c9.js"),["./memory-7221a3c9.js","./index-abdbff68.js","./index-3936f743.css"],import.meta.url),{FileSystemDirectoryHandle:_}=await l(()=>import("./index-abdbff68.js").then(i=>i.d),["./index-abdbff68.js","./index-3936f743.css"],import.meta.url),p=(o=(r=e[0].webkitRelativePath)===null||r===void 0?void 0:r.split("/",1)[0])!==null&&o!==void 0?o:"",m=new t(p,!1);for(let i=0;i(c._entries[s]||(c._entries[s]=new t(s,!1)),c._entries[s]),m);w._entries[f]=new u(n.name,n,!1)}return new _(m)}async function b(e){const{FileHandle:r}=await l(()=>import("./memory-7221a3c9.js"),["./memory-7221a3c9.js","./index-abdbff68.js","./index-3936f743.css"],import.meta.url),{FileSystemFileHandle:o}=await l(()=>import("./index-abdbff68.js").then(t=>t.b),["./index-abdbff68.js","./index-3936f743.css"],import.meta.url);return Array.from(e).map(t=>new o(new r(t.name,t,!1)))}export{E as errors,y as isChunkObject,v as makeDirHandleFromFileList,b as makeFileHandlesFromFileList}; diff --git a/beta/index.html b/beta/index.html index 0fec645f..090795b1 100644 --- a/beta/index.html +++ b/beta/index.html @@ -23,8 +23,8 @@ SMEditor - - + +