@byloth/core 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +2 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +60 -61
- package/dist/core.esm.js.map +1 -1
- package/dist/core.global.js +2 -2
- package/dist/core.global.js.map +1 -1
- package/dist/core.umd.cjs +2 -2
- package/dist/core.umd.cjs.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +1 -1
- package/src/models/callbacks/callable-object.ts +1 -2
- package/src/models/callbacks/publisher.ts +9 -4
- package/src/models/collections/map-view.ts +7 -3
- package/src/models/collections/types.ts +2 -1
- package/src/utils/date.ts +1 -2
package/dist/core.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var Ze=Object.defineProperty;var We=(i,n,e)=>n in i?Ze(i,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[n]=e;var a=(i,n,e)=>We(i,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=typeof window<"u"&&typeof window.document<"u";var O;const Ue=typeof process<"u"&&!!((O=process.versions)!=null&&O.node);var z;const et=typeof self=="object"&&((z=self.constructor)==null?void 0:z.name)==="DedicatedWorkerGlobalScope";var
|
|
1
|
+
"use strict";var Ze=Object.defineProperty;var We=(i,n,e)=>n in i?Ze(i,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[n]=e;var a=(i,n,e)=>We(i,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=typeof window<"u"&&typeof window.document<"u";var O;const Ue=typeof process<"u"&&!!((O=process.versions)!=null&&O.node);var z;const et=typeof self=="object"&&((z=self.constructor)==null?void 0:z.name)==="DedicatedWorkerGlobalScope";var q,$;class c extends($=Error,q=Symbol.toStringTag,$){constructor(e,t,s="Exception"){super(e);a(this,q,"Exception");this.cause=t,this.name=s,t&&(t instanceof Error?this.stack+=`
|
|
2
2
|
|
|
3
3
|
Caused by ${t.stack}`:this.stack+=`
|
|
4
4
|
|
|
5
|
-
Caused by ${t}`)}static FromUnknown(e){if(e instanceof c)return e;if(e instanceof Error){const t=new c(e.message);return t.stack=e.stack,t.name=e.name,t}return new c(`${e}`)}}var D,V;class x extends(V=c,D=Symbol.toStringTag,V){constructor(e,t,s="FatalErrorException"){e===void 0&&(e="The program has encountered an unrecoverable error and cannot continue as expected. Please, try again later. If the problem persists, contact the support team.");super(e,t,s);a(this,D,"FatalErrorException")}}var B,J;class Je extends(J=x,B=Symbol.toStringTag,J){constructor(e,t,s="NotImplementedException"){e===void 0&&(e="This feature isn't implemented yet. Please, try again later.");super(e,t,s);a(this,B,"NotImplementedException")}}var L,Y;class C extends(Y=c,L=Symbol.toStringTag,Y){constructor(e,t,s="FileException"){super(e,t,s);a(this,L,"FileException")}}var G,K;class tt extends(K=C,G=Symbol.toStringTag,K){constructor(e,t,s="FileExistsException"){super(e,t,s);a(this,G,"FileExistsException")}}var H,Q;class nt extends(Q=C,H=Symbol.toStringTag,Q){constructor(e,t,s="FileNotFoundException"){super(e,t,s);a(this,H,"FileNotFoundException")}}var X,Z;class y extends(Z=c,X=Symbol.toStringTag,Z){constructor(e,t,s="KeyException"){super(e,t,s);a(this,X,"KeyException")}}var W,U;class st extends(U=c,W=Symbol.toStringTag,U){constructor(e,t,s="NetworkException"){super(e,t,s);a(this,W,"NetworkException")}}var ee,te;class rt extends(te=c,ee=Symbol.toStringTag,te){constructor(e,t,s="PermissionException"){super(e,t,s);a(this,ee,"PermissionException")}}var ne,se;class R extends(se=c,ne=Symbol.toStringTag,se){constructor(e,t,s="ReferenceException"){super(e,t,s);a(this,ne,"ReferenceException")}}var re,ie;class m extends(ie=c,re=Symbol.toStringTag,ie){constructor(e,t,s="RuntimeException"){super(e,t,s);a(this,re,"RuntimeException")}}var oe,ae;class Le extends(ae=m,oe=Symbol.toStringTag,ae){constructor(e,t,s="EnvironmentException"){super(e,t,s);a(this,oe,"EnvironmentException")}}var le,ue;class Ye extends(ue=c,le=Symbol.toStringTag,ue){constructor(e,t,s="TimeoutException"){super(e,t,s);a(this,le,"TimeoutException")}}var ce,he;class it extends(he=c,ce=Symbol.toStringTag,he){constructor(e,t,s="TypeException"){super(e,t,s);a(this,ce,"TypeException")}}var fe,de;class d extends(de=c,fe=Symbol.toStringTag,de){constructor(e,t,s="ValueException"){super(e,t,s);a(this,fe,"ValueException")}}var me,we;class b extends(we=d,me=Symbol.toStringTag,we){constructor(e,t,s="RangeException"){super(e,t,s);a(this,me,"RangeException")}}var pe;class u{constructor(n){a(this,"_iterator");a(this,pe,"SmartIterator");n instanceof Function?this._iterator=n():Symbol.iterator in n?this._iterator=n[Symbol.iterator]():this._iterator=n}every(n){let e=0;for(;;){const t=this._iterator.next();if(t.done)return!0;if(!n(t.value,e))return!1;e+=1}}some(n){let e=0;for(;;){const t=this._iterator.next();if(t.done)return!1;if(n(t.value,e))return!0;e+=1}}filter(n){const e=this._iterator;return new u(function*(){let t=0;for(;;){const s=e.next();if(s.done)return s.value;n(s.value,t)&&(yield s.value),t+=1}})}map(n){const e=this._iterator;return new u(function*(){let t=0;for(;;){const s=e.next();if(s.done)return s.value;yield n(s.value,t),t+=1}})}reduce(n,e){let t=0,s=e;if(s===void 0){const r=this._iterator.next();if(r.done)throw new d("Cannot reduce an empty iterator without an initial value.");s=r.value,t+=1}for(;;){const r=this._iterator.next();if(r.done)return s;s=n(s,r.value,t),t+=1}}flatMap(n){const e=this._iterator;return new u(function*(){let t=0;for(;;){const s=e.next();if(s.done)return s.value;const r=n(s.value,t);if(r instanceof Array)for(const o of r)yield o;else yield r;t+=1}})}drop(n){const e=this._iterator;return new u(function*(){let t=0;for(;t<n;){if(e.next().done)return;t+=1}for(;;){const s=e.next();if(s.done)return s.value;yield s.value}})}take(n){const e=this._iterator;return new u(function*(){let t=0;for(;t<n;){const s=e.next();if(s.done)return s.value;yield s.value,t+=1}})}find(n){let e=0;for(;;){const t=this._iterator.next();if(t.done)return;if(n(t.value,e))return t.value;e+=1}}enumerate(){return this.map((n,e)=>[e,n])}unique(){const n=this._iterator;return new u(function*(){const e=new Set;for(;;){const t=n.next();if(t.done)return t.value;e.has(t.value)||(e.add(t.value),yield t.value)}})}count(){let n=0;for(;;){if(this._iterator.next().done)return n;n+=1}}forEach(n){let e=0;for(;;){const t=this._iterator.next();if(t.done)return;n(t.value,e),e+=1}}next(...n){return this._iterator.next(...n)}return(n){return this._iterator.return?this._iterator.return(n):{done:!0,value:n}}throw(n){if(this._iterator.throw)return this._iterator.throw(n);throw n}groupBy(n){return new g(this.map((e,t)=>[n(e,t),e]))}toArray(){return Array.from(this)}[(pe=Symbol.toStringTag,Symbol.iterator)](){return this}}var ye;ye=Symbol.toStringTag;const _=class _{constructor(n){a(this,"_elements");a(this,ye,"ReducedIterator");this._elements=new u(n)}every(n){for(const[e,[t,s]]of this._elements.enumerate())if(!n(t,s,e))return!1;return!0}some(n){for(const[e,[t,s]]of this._elements.enumerate())if(n(t,s,e))return!0;return!1}filter(n){const e=this._elements.enumerate();return new _(function*(){for(const[t,[s,r]]of e)n(s,r,t)&&(yield[s,r])})}map(n){const e=this._elements.enumerate();return new _(function*(){for(const[t,[s,r]]of e)yield[s,n(s,r,t)]})}reduce(n,e){let t=0,s=e;if(s===void 0){const r=this._elements.next();if(r.done)throw new d("Cannot reduce an empty iterator without an initial value.");s=r.value[1],t+=1}for(const[r,o]of this._elements)s=n(r,s,o,t),t+=1;return s}flatMap(n){const e=this._elements.enumerate();return new g(function*(){for(const[t,[s,r]]of e){const o=n(s,r,t);if(o instanceof Array)for(const l of o)yield[s,l];else yield[s,o]}})}drop(n){const e=this._elements.enumerate();return new _(function*(){for(const[t,[s,r]]of e)t>=n&&(yield[s,r])})}take(n){const e=this._elements.enumerate();return new _(function*(){for(const[t,[s,r]]of e){if(t>=n)break;yield[s,r]}})}find(n){for(const[e,[t,s]]of this._elements.enumerate())if(n(t,s,e))return s}enumerate(){return this.map((n,e,t)=>[t,e])}unique(){const n=this._elements;return new _(function*(){const e=new Set;for(const[t,s]of n)e.has(s)||(e.add(s),yield[t,s])})}count(){let n=0;for(const e of this._elements)n+=1;return n}forEach(n){for(const[e,[t,s]]of this._elements.enumerate())n(t,s,e)}reorganizeBy(n){const e=this._elements.enumerate();return new g(function*(){for(const[t,[s,r]]of e)yield[n(s,r,t),r]})}keys(){const n=this._elements;return new u(function*(){for(const[e]of n)yield e})}entries(){return this._elements}values(){const n=this._elements;return new u(function*(){for(const[e,t]of n)yield t})}toArray(){return Array.from(this.values())}toMap(){return new Map(this.entries())}toObject(){return Object.fromEntries(this.entries())}};let h=_;var _e;_e=Symbol.toStringTag;const w=class w{constructor(n){a(this,"_elements");a(this,_e,"AggregatedAsyncIterator");this._elements=new f(n)}async every(n){const e=new Map;for await(const[t,s]of this._elements){const[r,o]=e.get(t)??[0,!0];o&&e.set(t,[r+1,await n(t,s,r)])}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}async some(n){const e=new Map;for await(const[t,s]of this._elements){const[r,o]=e.get(t)??[0,!1];o||e.set(t,[r+1,await n(t,s,r)])}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}filter(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0;await n(s,r,o)&&(yield[s,r]),t.set(s,o+1)}})}map(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0;yield[s,await n(s,r,o)],t.set(s,o+1)}})}async reduce(n,e){const t=new Map;for await(const[s,r]of this._elements){let o,l;if(t.has(s))[o,l]=t.get(s);else if(e!==void 0)o=0,e instanceof Function?l=await e(s):l=await e;else{t.set(s,[0,r]);continue}t.set(s,[o+1,await n(s,l,r,o)])}return new h(function*(){for(const[s,[r,o]]of t)yield[s,o]})}flatMap(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0,l=await n(s,r,o);if(l instanceof Array)for(const k of l)yield[s,k];else yield[s,l];t.set(s,o+1)}})}drop(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0;if(o<n){t.set(s,o+1);continue}yield[s,r]}})}take(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0;o>=n||(yield[s,r],t.set(s,o+1))}})}async find(n){const e=new Map;for await(const[t,s]of this._elements){let[r,o]=e.get(t)??[0,void 0];o===void 0&&(await n(t,s,r)&&(o=s),e.set(t,[r+1,o]))}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}enumerate(){return this.map((n,e,t)=>[t,e])}unique(){const n=this._elements;return new w(async function*(){const e=new Map;for await(const[t,s]of n){const r=e.get(t)??new Set;r.has(s)||(r.add(s),e.set(t,r),yield[t,s])}})}async count(){const n=new Map;for await(const[e]of this._elements){const t=n.get(e)??0;n.set(e,t+1)}return new h(function*(){for(const[e,t]of n)yield[e,t]})}async forEach(n){const e=new Map;for await(const[t,s]of this._elements){const r=e.get(t)??0;await n(t,s,r),e.set(t,r+1)}}reorganizeBy(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0;yield[await n(s,r,o),r],t.set(s,o+1)}})}keys(){const n=this._elements;return new f(async function*(){const e=new Set;for await(const[t]of n)e.has(t)||(e.add(t),yield t)})}entries(){return this._elements}values(){const n=this._elements;return new f(async function*(){for await(const[e,t]of n)yield t})}async toArray(){const n=await this.toMap();return Array.from(n.values())}async toMap(){const n=new Map;for await(const[e,t]of this._elements){const s=n.get(e)??[];s.push(t),n.set(e,s)}return n}async toObject(){const n={};for await(const[e,t]of this._elements){const s=n[e]??[];s.push(t),n[e]=s}return n}};let E=w;var be;class f{constructor(n){a(this,"_iterator");a(this,be,"SmartAsyncIterator");if(n instanceof Function){const e=n();Symbol.asyncIterator in e?this._iterator=e:this._iterator=async function*(){let t=[];for(;;){const s=e.next(...t);if(s.done)return s.value;t=[yield s.value]}}()}else if(Symbol.asyncIterator in n)this._iterator=n[Symbol.asyncIterator]();else if(Symbol.iterator in n){const e=n[Symbol.iterator]();this._iterator=async function*(){for(;;){const t=e.next();if(t.done)return t.value;yield t.value}}()}else this._iterator=async function*(){let e=[];for(;;){const t=await n.next(...e);if(t.done)return t.value;e=[yield t.value]}}()}async every(n){let e=0;for(;;){const t=await this._iterator.next();if(t.done)return!0;if(!await n(t.value,e))return!1;e+=1}}async some(n){let e=0;for(;;){const t=await this._iterator.next();if(t.done)return!1;if(await n(t.value,e))return!0;e+=1}}filter(n){const e=this._iterator;return new f(async function*(){let t=0;for(;;){const s=await e.next();if(s.done)return s.value;await n(s.value,t)&&(yield s.value),t+=1}})}map(n){const e=this._iterator;return new f(async function*(){let t=0;for(;;){const s=await e.next();if(s.done)return s.value;yield await n(s.value,t),t+=1}})}async reduce(n,e){let t=0,s=e;if(s===void 0){const r=await this._iterator.next();if(r.done)throw new d("Cannot reduce an empty iterator without an initial value.");s=r.value,t+=1}for(;;){const r=await this._iterator.next();if(r.done)return s;s=await n(s,r.value,t),t+=1}}flatMap(n){const e=this._iterator;return new f(async function*(){let t=0;for(;;){const s=await e.next();if(s.done)return s.value;const r=await n(s.value,t);if(r instanceof Array)for(const o of r)yield o;else yield r;t+=1}})}drop(n){const e=this._iterator;return new f(async function*(){let t=0;for(;t<n;){if((await e.next()).done)return;t+=1}for(;;){const s=await e.next();if(s.done)return s.value;yield s.value}})}take(n){const e=this._iterator;return new f(async function*(){let t=0;for(;t<n;){const s=await e.next();if(s.done)return s.value;yield s.value,t+=1}})}async find(n){let e=0;for(;;){const t=await this._iterator.next();if(t.done)return;if(await n(t.value,e))return t.value;e+=1}}enumerate(){return this.map((n,e)=>[e,n])}unique(){const n=this._iterator;return new f(async function*(){const e=new Set;for(;;){const t=await n.next();if(t.done)return t.value;e.has(t.value)||(e.add(t.value),yield t.value)}})}async count(){let n=0;for(;;){if((await this._iterator.next()).done)return n;n+=1}}async forEach(n){let e=0;for(;;){const t=await this._iterator.next();if(t.done)return;await n(t.value,e),e+=1}}next(...n){return this._iterator.next(...n)}async return(n){const e=await n;return this._iterator.return?await this._iterator.return(e):{done:!0,value:e}}throw(n){if(this._iterator.throw)return this._iterator.throw(n);throw n}groupBy(n){return new E(this.map(async(e,t)=>[await n(e,t),e]))}toArray(){return Array.fromAsync(this)}[(be=Symbol.toStringTag,Symbol.asyncIterator)](){return this}}var xe;xe=Symbol.toStringTag;const p=class p{constructor(n){a(this,"_elements");a(this,xe,"AggregatedIterator");this._elements=new u(n)}every(n){const e=new Map;for(const[t,s]of this._elements){const[r,o]=e.get(t)??[0,!0];o&&e.set(t,[r+1,n(t,s,r)])}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}some(n){const e=new Map;for(const[t,s]of this._elements){const[r,o]=e.get(t)??[0,!1];o||e.set(t,[r+1,n(t,s,r)])}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}filter(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0;n(s,r,o)&&(yield[s,r]),t.set(s,o+1)}})}map(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0;yield[s,n(s,r,o)],t.set(s,o+1)}})}reduce(n,e){const t=new Map;for(const[s,r]of this._elements){let o,l;if(t.has(s))[o,l]=t.get(s);else if(e!==void 0)o=0,e instanceof Function?l=e(s):l=e;else{t.set(s,[0,r]);continue}t.set(s,[o+1,n(s,l,r,o)])}return new h(function*(){for(const[s,[r,o]]of t)yield[s,o]})}flatMap(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0,l=n(s,r,o);if(l instanceof Array)for(const k of l)yield[s,k];else yield[s,l];t.set(s,o+1)}})}drop(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0;if(o<n){t.set(s,o+1);continue}yield[s,r]}})}take(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0;o>=n||(yield[s,r],t.set(s,o+1))}})}find(n){const e=new Map;for(const[t,s]of this._elements){let[r,o]=e.get(t)??[0,void 0];o===void 0&&(n(t,s,r)&&(o=s),e.set(t,[r+1,o]))}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}enumerate(){return this.map((n,e,t)=>[t,e])}unique(){const n=this._elements;return new p(function*(){const e=new Map;for(const[t,s]of n){const r=e.get(t)??new Set;r.has(s)||(r.add(s),e.set(t,r),yield[t,s])}})}count(){const n=new Map;for(const[e]of this._elements){const t=n.get(e)??0;n.set(e,t+1)}return new h(function*(){for(const[e,t]of n)yield[e,t]})}forEach(n){const e=new Map;for(const[t,s]of this._elements){const r=e.get(t)??0;n(t,s,r),e.set(t,r+1)}}reorganizeBy(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0;yield[n(s,r,o),r],t.set(s,o+1)}})}keys(){const n=this._elements;return new u(function*(){const e=new Set;for(const[t]of n)e.has(t)||(e.add(t),yield t)})}entries(){return this._elements}values(){const n=this._elements;return new u(function*(){for(const[e,t]of n)yield t})}toArray(){const n=this.toMap();return Array.from(n.values())}toMap(){const n=new Map;for(const[e,t]of this._elements){const s=n.get(e)??[];s.push(t),n.set(e,s)}return n}toObject(){const n={};for(const[e,t]of this._elements){const s=n[e]??[];s.push(t),n[e]=s}return n}};let g=p;const ot=Function;var ge,ve;class Ge extends(ve=ot,ge=Symbol.toStringTag,ve){constructor(){super("return this._invoke(...arguments);");a(this,ge,"CallableObject");const e=this.bind(this);return Object.setPrototypeOf(this,e),e}}var Se;Se=Symbol.toStringTag;class v{constructor(){a(this,"_subscribers");a(this,Se,"Publisher");this._subscribers=new Map}clear(){this._subscribers.clear()}publish(n,...e){const t=this._subscribers.get(n);return t?t.slice().map(s=>s(...e)):[]}subscribe(n,e){this._subscribers.has(n)||this._subscribers.set(n,[]);const t=this._subscribers.get(n);return t.push(e),()=>{const s=t.indexOf(e);if(s<0)throw new R("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");t.splice(s,1)}}unsubscribe(n,e){const t=this._subscribers.get(n);if(!t)return;const s=t.indexOf(e);if(s<0)throw new R("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");t.splice(s,1)}}const at=()=>{};var ke,Ee;class lt extends(Ee=Ge,ke=Symbol.toStringTag,Ee){constructor(e,t="default"){super();a(this,"_callback");a(this,"_callbacks");a(this,"_isEnabled");a(this,"_key");a(this,"_invoke");a(this,ke,"SwitchableCallback");this._callbacks=new Map,this._isEnabled=!0,e?this._callbacks.set(t,e):(t="",e=()=>{throw new Je("The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?")}),this._key=t,this._callback=e,this._invoke=(...s)=>this._callback(...s)}get isEnabled(){return this._isEnabled}get key(){return this._key}enable(e){if(e===void 0){if(!this._key)throw new y("The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?");e=this._key}else if(e){if(!this._callbacks.has(e))throw new y(`The key '${e}' doesn't yet have any associated callback.`)}else throw new y("The key must be a non-empty string.");if(this._isEnabled)throw new m("The `SwitchableCallback` is already enabled.");this._callback=this._callbacks.get(e),this._isEnabled=!0}disable(){if(!this._isEnabled)throw new m("The `SwitchableCallback` is already disabled.");this._callback=at,this._isEnabled=!1}register(e,t){if(this._callbacks.size===0)this._key=e,this._callback=t;else if(this._callbacks.has(e))throw new y(`The key '${e}' has already been used for another callback.`);this._callbacks.set(e,t)}unregister(e){if(this._key===e)throw new y("Unable to unregister the currently selected callback.");if(!this._callbacks.has(e))throw new y(`The key '${e}' doesn't yet have any associated callback.`);this._callbacks.delete(e)}switch(e){if(!this._callbacks.has(e))throw new y(`The key '${e}' doesn't yet have any associated callback.`);this._key!==e&&(this._key=e,this._isEnabled&&(this._callback=this._callbacks.get(e)))}}var Te,Me;class ut extends(Me=Map,Te=Symbol.toStringTag,Me){constructor(e){super();a(this,"_publisher");a(this,Te,"MapView");if(this._publisher=new v,e)for(const[t,s]of e)this.set(t,s)}set(e,t){return super.set(e,t),this._publisher.publish("entry:add",e,t),this}delete(e){const t=super.delete(e);return t&&this._publisher.publish("entry:remove",e),t}clear(){const e=this.size;super.clear(),e>0&&this._publisher.publish("collection:clear")}subscribe(e,t){return this._publisher.subscribe(e,t)}unsubscribe(e,t){this._publisher.unsubscribe(e,t)}}var Re,Fe;class ct extends(Fe=Set,Re=Symbol.toStringTag,Fe){constructor(e){super();a(this,"_publisher");a(this,Re,"SetView");if(this._publisher=new v,e)for(const t of e)this.add(t)}add(e){return super.add(e),this._publisher.publish("entry:add",e),this}delete(e){const t=super.delete(e);return t&&this._publisher.publish("entry:remove",e),t}clear(){const e=this.size;super.clear(),e>0&&this._publisher.publish("collection:clear")}subscribe(e,t){return this._publisher.subscribe(e,t)}unsubscribe(e,t){this._publisher.unsubscribe(e,t)}}var Pe;Pe=Symbol.toStringTag;class ht{constructor(n=!0){a(this,"_preferPersistence");a(this,"_volatile");a(this,"_persistent");a(this,Pe,"JSONStorage");if(!P)throw new Le("The `JSONStorage` class can only be instantiated within a browser environment.");this._preferPersistence=n,this._volatile=window.sessionStorage,this._persistent=window.localStorage}_get(n,e,t){const s=n.getItem(e);if(s)try{return JSON.parse(s)}catch{console.warn(`The "${s}" value for "${e}" property cannot be parsed. Clearing the storage...`),n.removeItem(e)}return t}_set(n,e,t){const s=JSON.stringify(t);s?n.setItem(e,s):n.removeItem(e)}get(n,e,t=this._preferPersistence){const s=t?this._persistent:this._volatile;return this._get(s,n,e)}recall(n,e){return this._get(this._volatile,n,e)}retrieve(n,e){return this.recall(n)??this.read(n,e)}read(n,e){return this._get(this._persistent,n,e)}has(n,e){return(e?this._persistent:this._volatile).getItem(n)!==null}knows(n){return this._volatile.getItem(n)!==null}find(n){return this.knows(n)??this.exists(n)}exists(n){return this._persistent.getItem(n)!==null}set(n,e,t=this._preferPersistence){const s=t?this._persistent:this._volatile;this._set(s,n,e)}remember(n,e){this._set(this._volatile,n,e)}write(n,e){this._set(this._persistent,n,e)}delete(n,e){(e?this._persistent:this._volatile).removeItem(n)}forget(n){this._volatile.removeItem(n)}erase(n){this._persistent.removeItem(n)}clear(n){this._volatile.removeItem(n),this._persistent.removeItem(n)}}var Ce;Ce=Symbol.toStringTag;const j=class j{constructor(n){a(this,"_isPending");a(this,"_isFulfilled");a(this,"_isRejected");a(this,"_promise");a(this,Ce,"SmartPromise");this._isPending=!0,this._isFulfilled=!1,this._isRejected=!1;const e=s=>(this._isPending=!1,this._isFulfilled=!0,s),t=s=>{throw this._isPending=!1,this._isRejected=!0,s};this._promise=new Promise(n).then(e,t)}static FromPromise(n){return new j((e,t)=>n.then(e,t))}get isPending(){return this._isPending}get isFulfilled(){return this._isFulfilled}get isRejected(){return this._isRejected}then(n,e){return this._promise.then(n,e)}catch(n){return this._promise.catch(n)}finally(n){return this._promise.finally(n)}};let S=j;var Ie,je;class Ke extends(je=S,Ie=Symbol.toStringTag,je){constructor(e,t){let s,r;super((o,l)=>{s=o,r=l});a(this,"_resolve");a(this,"_reject");a(this,Ie,"DeferredPromise");this._promise=this._promise.then(e,t),this._resolve=s,this._reject=r}get resolve(){return this._resolve}get reject(){return this._reject}watch(e){return e.then(this.resolve,this.reject),this}}var Ae,Ne;class ft extends(Ne=S,Ae=Symbol.toStringTag,Ne){constructor(e,t){super((s,r)=>{const o=M=>{clearTimeout(N),s(M)},l=M=>{clearTimeout(N),r(M)},N=setTimeout(()=>l(new Ye("The operation has timed out.")),t);e(o,l)});a(this,Ae,"TimedPromise")}}var T=(i=>(i[i.Millisecond=1]="Millisecond",i[i.Second=1e3]="Second",i[i.Minute=6e4]="Minute",i[i.Hour=36e5]="Hour",i[i.Day=864e5]="Day",i[i.Week=6048e5]="Week",i[i.Month=2592e6]="Month",i[i.Year=31536e6]="Year",i))(T||{}),He=(i=>(i[i.Sunday=0]="Sunday",i[i.Monday=1]="Monday",i[i.Tuesday=2]="Tuesday",i[i.Wednesday=3]="Wednesday",i[i.Thursday=4]="Thursday",i[i.Friday=5]="Friday",i[i.Saturday=6]="Saturday",i))(He||{});function dt(i,n,e=864e5){let t;return i=new Date(i),n=new Date(n),i<n?t=Math.floor:t=Math.ceil,t((n.getTime()-i.getTime())/e)}function mt(i,n,e=864e5){if(i=new Date(i),n=new Date(n),i>=n)throw new b("The end date must be greater than the start date.");return new u(function*(){const t=n.getTime();let s=i.getTime();for(;s<t;)yield new Date(s),s+=e})}function Qe(i,n=864e5){if(n<=1)throw new b("Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead.");if(n>864e5)throw new b("Rounding by more than a day leads to unexpected results. Consider using other methods to round dates by weeks, months or years.");return i=new Date(i),new Date(Math.floor(i.getTime()/n)*n)}function wt(i,n=0){i=new Date(i);const e=7-n,t=(i.getUTCDay()+e)%7,s=i.getTime()-864e5*t;return Qe(new Date(s))}var Oe;Oe=Symbol.toStringTag;class I{constructor(n,e=40){a(this,"_handle");a(this,"_startTime");a(this,"_isRunning");a(this,"_publisher");a(this,"_start");a(this,"_stop");a(this,Oe,"GameLoop");this._startTime=0,this._isRunning=!1,P?(this._start=()=>{n(this.elapsedTime),this._handle=window.requestAnimationFrame(this._start)},this._stop=()=>window.cancelAnimationFrame(this._handle)):(console.warn(`Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`),this._start=()=>{this._handle=setInterval(()=>n(this.elapsedTime),e)},this._stop=()=>clearInterval(this._handle)),this._publisher=new v}get startTime(){return this._startTime}get isRunning(){return this._isRunning}get elapsedTime(){return performance.now()-this._startTime}start(n=0){if(this._isRunning)throw new m("The game loop has already been started.");this._startTime=performance.now()-n,this._start(),this._isRunning=!0,this._publisher.publish("start")}stop(){if(!this._isRunning)throw new m("The game loop had already stopped or hadn't yet started.");if(!this._handle)throw new x;this._stop(),this._handle=void 0,this._isRunning=!1,this._publisher.publish("stop")}onStart(n){return this._publisher.subscribe("start",n)}onStop(n){return this._publisher.subscribe("stop",n)}}var ze,$e;class pt extends($e=I,ze=Symbol.toStringTag,$e){constructor(e=T.Second){super(t=>this._publisher.publish("tick",t),e);a(this,"_publisher");a(this,ze,"Clock");this._publisher=new v}start(e=0){if(this._isRunning)throw new m("The clock has already been started.");this._startTime=performance.now()-e,this._start(),this._isRunning=!0,this._publisher.publish("start")}stop(){if(!this._isRunning)throw new m("The clock had already stopped or hadn't yet started.");if(!this._handle)throw new x;this._stop(),this._handle=void 0,this._isRunning=!1,this._publisher.publish("stop")}onTick(e,t=0){if(t<0)throw new b("The tick step must be a non-negative number.");if(t===0)return this._publisher.subscribe("tick",e);let s=0;return this._publisher.subscribe("tick",r=>{r-s<t||(e(r),s=r)})}}var qe,De;class yt extends(De=I,qe=Symbol.toStringTag,De){constructor(e,t=T.Second){super(()=>{const r=this.remainingTime;r<=0?(this._deferrerStop(),this._publisher.publish("tick",0),this._publisher.publish("expire")):this._publisher.publish("tick",r)},t);a(this,"_publisher");a(this,"_duration");a(this,"_deferrer");a(this,qe,"Countdown");this._publisher=new v,this._duration=e}get duration(){return this._duration}get remainingTime(){return this._duration-this.elapsedTime}_deferrerStop(e){if(!this._isRunning)throw new m("The countdown hadn't yet started.");if(!this._deferrer)throw new x;this._stop(),this._handle=void 0,this._isRunning=!1,e!==void 0?this._deferrer.reject(e):this._deferrer.resolve(),this._deferrer=void 0}start(e=this.duration){if(this._isRunning)throw new m("The countdown had already stopped or hadn't yet started.");if(this._deferrer)throw new x;return this._deferrer=new Ke,super.start(this.duration-e),this._publisher.publish("start"),this._deferrer}stop(e){this._deferrerStop(e),this._publisher.publish("stop",e)}onExpire(e){return this._publisher.subscribe("expire",e)}onTick(e,t=0){if(t<0)throw new b("The tick step must be a non-negative number.");if(t===0)return this._publisher.subscribe("tick",e);let s=this.remainingTime;return this._publisher.subscribe("tick",r=>{s-r<t||(e(r),s=r)})}}var Ve;Ve=Symbol.toStringTag;class _t{constructor(){a(this,Ve,"Curve")}static Linear(n){const e=n-1;return new u(function*(){for(let t=0;t<n;t+=1)yield t/e})}static Exponential(n,e=2){if(e<0)throw new d("The base of the exponential curve cannot be negative.");const t=n-1;return new u(function*(){for(let s=0;s<n;s+=1)yield Math.pow(s/t,e)})}}var Be;Be=Symbol.toStringTag;const A=class A{constructor(){a(this,Be,"Random")}static Boolean(n=.5){return Math.random()<n}static Integer(n,e){return Math.floor(e===void 0?Math.random()*n:Math.random()*(e-n)+n)}static Decimal(n,e){return n===void 0?Math.random():e===void 0?Math.random()*n:Math.random()*(e-n)+n}static Index(n){if(n.length===0)throw new d("You must provide at least one element.");return this.Integer(n.length)}static Choice(n){return n[A.Index(n)]}};let F=A;function bt(i){return new Promise(n=>setTimeout(n,i))}function xt(){return new Promise(i=>requestAnimationFrame(()=>i()))}function gt(){return new Promise(i=>setTimeout(i))}function vt(i,n="text/javascript"){return new Promise((e,t)=>{const s=document.createElement("script");s.async=!0,s.defer=!0,s.src=i,s.type=n,s.onload=r=>e(),s.onerror=r=>t(r),document.body.appendChild(s)})}function St(...i){return new u(function*(){for(const n of i)for(const e of n)yield e})}function kt(i){if(i instanceof Array)return i.length;let n=0;for(const e of i)n+=1;return n}function Et(i){return new u(function*(){let n=0;for(const e of i)yield[n,e],n+=1})}function Tt(i,n,e=1){if(e<=0)throw new b("Step must be always a positive number, even when generating numbers in reverse order.");return n===void 0&&(n=i,i=0),i>n?new u(function*(){for(let t=i;t>n;t-=e)yield t}):new u(function*(){for(let t=i;t<n;t+=e)yield t})}function Mt(i){const n=Array.from(i);for(let e=n.length-1;e>0;e-=1){const t=Math.floor(Math.random()*(e+1));[n[e],n[t]]=[n[t],n[e]]}return n}function Rt(i){return new u(function*(){const n=new Set;for(const e of i)n.has(e)||(n.add(e),yield e)})}function Xe(i,n){const e=i[Symbol.iterator](),t=n[Symbol.iterator]();return new u(function*(){for(;;){const s=e.next(),r=t.next();if(s.done||r.done)break;yield[s.value,r.value]}})}function Ft(i,n){if(n===void 0){let r=0,o=0;for(const l of i)r+=l,o+=1;if(o===0)throw new d("You must provide at least one value.");return r/o}let e=0,t=0,s=0;for(const[r,o]of Xe(i,n)){if(o<=0)throw new d(`The weight for the value #${s} must be greater than zero.`);e+=r*o,t+=o,s+=1}if(s===0)throw new d("You must provide at least one value and weight.");if(t<=0)throw new d("The sum of weights must be greater than zero.");return e/t}function Pt(i){let n=0;for(let e=0;e<i.length;e+=1){const t=i.charCodeAt(e);n=(n<<5)-n+t,n|=0}return n}function Ct(i){let n=0;for(const e of i)n+=e;return n}function It(i){return`${i.charAt(0).toUpperCase()}${i.slice(1)}`}const jt="2.1.1";exports.AggregatedAsyncIterator=E;exports.AggregatedIterator=g;exports.CallableObject=Ge;exports.Clock=pt;exports.Countdown=yt;exports.Curve=_t;exports.DeferredPromise=Ke;exports.EnvironmentException=Le;exports.Exception=c;exports.FatalErrorException=x;exports.FileException=C;exports.FileExistsException=tt;exports.FileNotFoundException=nt;exports.GameLoop=I;exports.JSONStorage=ht;exports.KeyException=y;exports.MapView=ut;exports.NetworkException=st;exports.NotImplementedException=Je;exports.PermissionException=rt;exports.Publisher=v;exports.Random=F;exports.RangeException=b;exports.ReducedIterator=h;exports.ReferenceException=R;exports.RuntimeException=m;exports.SetView=ct;exports.SmartAsyncIterator=f;exports.SmartIterator=u;exports.SmartPromise=S;exports.SwitchableCallback=lt;exports.TimeUnit=T;exports.TimedPromise=ft;exports.TimeoutException=Ye;exports.TypeException=it;exports.VERSION=jt;exports.ValueException=d;exports.WeekDay=He;exports.average=Ft;exports.capitalize=It;exports.chain=St;exports.count=kt;exports.dateDifference=dt;exports.dateRange=mt;exports.dateRound=Qe;exports.delay=bt;exports.enumerate=Et;exports.getWeek=wt;exports.hash=Pt;exports.isBrowser=P;exports.isNode=Ue;exports.isWorker=et;exports.loadScript=vt;exports.nextAnimationFrame=xt;exports.range=Tt;exports.shuffle=Mt;exports.sum=Ct;exports.unique=Rt;exports.yieldToEventLoop=gt;exports.zip=Xe;
|
|
5
|
+
Caused by ${t}`)}static FromUnknown(e){if(e instanceof c)return e;if(e instanceof Error){const t=new c(e.message);return t.stack=e.stack,t.name=e.name,t}return new c(`${e}`)}}var D,V;class x extends(V=c,D=Symbol.toStringTag,V){constructor(e,t,s="FatalErrorException"){e===void 0&&(e="The program has encountered an unrecoverable error and cannot continue as expected. Please, try again later. If the problem persists, contact the support team.");super(e,t,s);a(this,D,"FatalErrorException")}}var B,J;class Je extends(J=x,B=Symbol.toStringTag,J){constructor(e,t,s="NotImplementedException"){e===void 0&&(e="This feature isn't implemented yet. Please, try again later.");super(e,t,s);a(this,B,"NotImplementedException")}}var L,Y;class C extends(Y=c,L=Symbol.toStringTag,Y){constructor(e,t,s="FileException"){super(e,t,s);a(this,L,"FileException")}}var G,K;class tt extends(K=C,G=Symbol.toStringTag,K){constructor(e,t,s="FileExistsException"){super(e,t,s);a(this,G,"FileExistsException")}}var H,Q;class nt extends(Q=C,H=Symbol.toStringTag,Q){constructor(e,t,s="FileNotFoundException"){super(e,t,s);a(this,H,"FileNotFoundException")}}var X,Z;class y extends(Z=c,X=Symbol.toStringTag,Z){constructor(e,t,s="KeyException"){super(e,t,s);a(this,X,"KeyException")}}var W,U;class st extends(U=c,W=Symbol.toStringTag,U){constructor(e,t,s="NetworkException"){super(e,t,s);a(this,W,"NetworkException")}}var ee,te;class rt extends(te=c,ee=Symbol.toStringTag,te){constructor(e,t,s="PermissionException"){super(e,t,s);a(this,ee,"PermissionException")}}var ne,se;class E extends(se=c,ne=Symbol.toStringTag,se){constructor(e,t,s="ReferenceException"){super(e,t,s);a(this,ne,"ReferenceException")}}var re,ie;class m extends(ie=c,re=Symbol.toStringTag,ie){constructor(e,t,s="RuntimeException"){super(e,t,s);a(this,re,"RuntimeException")}}var oe,ae;class Le extends(ae=m,oe=Symbol.toStringTag,ae){constructor(e,t,s="EnvironmentException"){super(e,t,s);a(this,oe,"EnvironmentException")}}var le,ue;class Ye extends(ue=c,le=Symbol.toStringTag,ue){constructor(e,t,s="TimeoutException"){super(e,t,s);a(this,le,"TimeoutException")}}var ce,he;class it extends(he=c,ce=Symbol.toStringTag,he){constructor(e,t,s="TypeException"){super(e,t,s);a(this,ce,"TypeException")}}var fe,de;class d extends(de=c,fe=Symbol.toStringTag,de){constructor(e,t,s="ValueException"){super(e,t,s);a(this,fe,"ValueException")}}var me,we;class b extends(we=d,me=Symbol.toStringTag,we){constructor(e,t,s="RangeException"){super(e,t,s);a(this,me,"RangeException")}}var pe;class u{constructor(n){a(this,"_iterator");a(this,pe,"SmartIterator");n instanceof Function?this._iterator=n():Symbol.iterator in n?this._iterator=n[Symbol.iterator]():this._iterator=n}every(n){let e=0;for(;;){const t=this._iterator.next();if(t.done)return!0;if(!n(t.value,e))return!1;e+=1}}some(n){let e=0;for(;;){const t=this._iterator.next();if(t.done)return!1;if(n(t.value,e))return!0;e+=1}}filter(n){const e=this._iterator;return new u(function*(){let t=0;for(;;){const s=e.next();if(s.done)return s.value;n(s.value,t)&&(yield s.value),t+=1}})}map(n){const e=this._iterator;return new u(function*(){let t=0;for(;;){const s=e.next();if(s.done)return s.value;yield n(s.value,t),t+=1}})}reduce(n,e){let t=0,s=e;if(s===void 0){const r=this._iterator.next();if(r.done)throw new d("Cannot reduce an empty iterator without an initial value.");s=r.value,t+=1}for(;;){const r=this._iterator.next();if(r.done)return s;s=n(s,r.value,t),t+=1}}flatMap(n){const e=this._iterator;return new u(function*(){let t=0;for(;;){const s=e.next();if(s.done)return s.value;const r=n(s.value,t);if(r instanceof Array)for(const o of r)yield o;else yield r;t+=1}})}drop(n){const e=this._iterator;return new u(function*(){let t=0;for(;t<n;){if(e.next().done)return;t+=1}for(;;){const s=e.next();if(s.done)return s.value;yield s.value}})}take(n){const e=this._iterator;return new u(function*(){let t=0;for(;t<n;){const s=e.next();if(s.done)return s.value;yield s.value,t+=1}})}find(n){let e=0;for(;;){const t=this._iterator.next();if(t.done)return;if(n(t.value,e))return t.value;e+=1}}enumerate(){return this.map((n,e)=>[e,n])}unique(){const n=this._iterator;return new u(function*(){const e=new Set;for(;;){const t=n.next();if(t.done)return t.value;e.has(t.value)||(e.add(t.value),yield t.value)}})}count(){let n=0;for(;;){if(this._iterator.next().done)return n;n+=1}}forEach(n){let e=0;for(;;){const t=this._iterator.next();if(t.done)return;n(t.value,e),e+=1}}next(...n){return this._iterator.next(...n)}return(n){return this._iterator.return?this._iterator.return(n):{done:!0,value:n}}throw(n){if(this._iterator.throw)return this._iterator.throw(n);throw n}groupBy(n){return new g(this.map((e,t)=>[n(e,t),e]))}toArray(){return Array.from(this)}[(pe=Symbol.toStringTag,Symbol.iterator)](){return this}}var ye;ye=Symbol.toStringTag;const _=class _{constructor(n){a(this,"_elements");a(this,ye,"ReducedIterator");this._elements=new u(n)}every(n){for(const[e,[t,s]]of this._elements.enumerate())if(!n(t,s,e))return!1;return!0}some(n){for(const[e,[t,s]]of this._elements.enumerate())if(n(t,s,e))return!0;return!1}filter(n){const e=this._elements.enumerate();return new _(function*(){for(const[t,[s,r]]of e)n(s,r,t)&&(yield[s,r])})}map(n){const e=this._elements.enumerate();return new _(function*(){for(const[t,[s,r]]of e)yield[s,n(s,r,t)]})}reduce(n,e){let t=0,s=e;if(s===void 0){const r=this._elements.next();if(r.done)throw new d("Cannot reduce an empty iterator without an initial value.");s=r.value[1],t+=1}for(const[r,o]of this._elements)s=n(r,s,o,t),t+=1;return s}flatMap(n){const e=this._elements.enumerate();return new g(function*(){for(const[t,[s,r]]of e){const o=n(s,r,t);if(o instanceof Array)for(const l of o)yield[s,l];else yield[s,o]}})}drop(n){const e=this._elements.enumerate();return new _(function*(){for(const[t,[s,r]]of e)t>=n&&(yield[s,r])})}take(n){const e=this._elements.enumerate();return new _(function*(){for(const[t,[s,r]]of e){if(t>=n)break;yield[s,r]}})}find(n){for(const[e,[t,s]]of this._elements.enumerate())if(n(t,s,e))return s}enumerate(){return this.map((n,e,t)=>[t,e])}unique(){const n=this._elements;return new _(function*(){const e=new Set;for(const[t,s]of n)e.has(s)||(e.add(s),yield[t,s])})}count(){let n=0;for(const e of this._elements)n+=1;return n}forEach(n){for(const[e,[t,s]]of this._elements.enumerate())n(t,s,e)}reorganizeBy(n){const e=this._elements.enumerate();return new g(function*(){for(const[t,[s,r]]of e)yield[n(s,r,t),r]})}keys(){const n=this._elements;return new u(function*(){for(const[e]of n)yield e})}entries(){return this._elements}values(){const n=this._elements;return new u(function*(){for(const[e,t]of n)yield t})}toArray(){return Array.from(this.values())}toMap(){return new Map(this.entries())}toObject(){return Object.fromEntries(this.entries())}};let h=_;var _e;_e=Symbol.toStringTag;const w=class w{constructor(n){a(this,"_elements");a(this,_e,"AggregatedAsyncIterator");this._elements=new f(n)}async every(n){const e=new Map;for await(const[t,s]of this._elements){const[r,o]=e.get(t)??[0,!0];o&&e.set(t,[r+1,await n(t,s,r)])}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}async some(n){const e=new Map;for await(const[t,s]of this._elements){const[r,o]=e.get(t)??[0,!1];o||e.set(t,[r+1,await n(t,s,r)])}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}filter(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0;await n(s,r,o)&&(yield[s,r]),t.set(s,o+1)}})}map(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0;yield[s,await n(s,r,o)],t.set(s,o+1)}})}async reduce(n,e){const t=new Map;for await(const[s,r]of this._elements){let o,l;if(t.has(s))[o,l]=t.get(s);else if(e!==void 0)o=0,e instanceof Function?l=await e(s):l=await e;else{t.set(s,[0,r]);continue}t.set(s,[o+1,await n(s,l,r,o)])}return new h(function*(){for(const[s,[r,o]]of t)yield[s,o]})}flatMap(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0,l=await n(s,r,o);if(l instanceof Array)for(const k of l)yield[s,k];else yield[s,l];t.set(s,o+1)}})}drop(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0;if(o<n){t.set(s,o+1);continue}yield[s,r]}})}take(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0;o>=n||(yield[s,r],t.set(s,o+1))}})}async find(n){const e=new Map;for await(const[t,s]of this._elements){let[r,o]=e.get(t)??[0,void 0];o===void 0&&(await n(t,s,r)&&(o=s),e.set(t,[r+1,o]))}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}enumerate(){return this.map((n,e,t)=>[t,e])}unique(){const n=this._elements;return new w(async function*(){const e=new Map;for await(const[t,s]of n){const r=e.get(t)??new Set;r.has(s)||(r.add(s),e.set(t,r),yield[t,s])}})}async count(){const n=new Map;for await(const[e]of this._elements){const t=n.get(e)??0;n.set(e,t+1)}return new h(function*(){for(const[e,t]of n)yield[e,t]})}async forEach(n){const e=new Map;for await(const[t,s]of this._elements){const r=e.get(t)??0;await n(t,s,r),e.set(t,r+1)}}reorganizeBy(n){const e=this._elements;return new w(async function*(){const t=new Map;for await(const[s,r]of e){const o=t.get(s)??0;yield[await n(s,r,o),r],t.set(s,o+1)}})}keys(){const n=this._elements;return new f(async function*(){const e=new Set;for await(const[t]of n)e.has(t)||(e.add(t),yield t)})}entries(){return this._elements}values(){const n=this._elements;return new f(async function*(){for await(const[e,t]of n)yield t})}async toArray(){const n=await this.toMap();return Array.from(n.values())}async toMap(){const n=new Map;for await(const[e,t]of this._elements){const s=n.get(e)??[];s.push(t),n.set(e,s)}return n}async toObject(){const n={};for await(const[e,t]of this._elements){const s=n[e]??[];s.push(t),n[e]=s}return n}};let T=w;var be;class f{constructor(n){a(this,"_iterator");a(this,be,"SmartAsyncIterator");if(n instanceof Function){const e=n();Symbol.asyncIterator in e?this._iterator=e:this._iterator=async function*(){let t=[];for(;;){const s=e.next(...t);if(s.done)return s.value;t=[yield s.value]}}()}else if(Symbol.asyncIterator in n)this._iterator=n[Symbol.asyncIterator]();else if(Symbol.iterator in n){const e=n[Symbol.iterator]();this._iterator=async function*(){for(;;){const t=e.next();if(t.done)return t.value;yield t.value}}()}else this._iterator=async function*(){let e=[];for(;;){const t=await n.next(...e);if(t.done)return t.value;e=[yield t.value]}}()}async every(n){let e=0;for(;;){const t=await this._iterator.next();if(t.done)return!0;if(!await n(t.value,e))return!1;e+=1}}async some(n){let e=0;for(;;){const t=await this._iterator.next();if(t.done)return!1;if(await n(t.value,e))return!0;e+=1}}filter(n){const e=this._iterator;return new f(async function*(){let t=0;for(;;){const s=await e.next();if(s.done)return s.value;await n(s.value,t)&&(yield s.value),t+=1}})}map(n){const e=this._iterator;return new f(async function*(){let t=0;for(;;){const s=await e.next();if(s.done)return s.value;yield await n(s.value,t),t+=1}})}async reduce(n,e){let t=0,s=e;if(s===void 0){const r=await this._iterator.next();if(r.done)throw new d("Cannot reduce an empty iterator without an initial value.");s=r.value,t+=1}for(;;){const r=await this._iterator.next();if(r.done)return s;s=await n(s,r.value,t),t+=1}}flatMap(n){const e=this._iterator;return new f(async function*(){let t=0;for(;;){const s=await e.next();if(s.done)return s.value;const r=await n(s.value,t);if(r instanceof Array)for(const o of r)yield o;else yield r;t+=1}})}drop(n){const e=this._iterator;return new f(async function*(){let t=0;for(;t<n;){if((await e.next()).done)return;t+=1}for(;;){const s=await e.next();if(s.done)return s.value;yield s.value}})}take(n){const e=this._iterator;return new f(async function*(){let t=0;for(;t<n;){const s=await e.next();if(s.done)return s.value;yield s.value,t+=1}})}async find(n){let e=0;for(;;){const t=await this._iterator.next();if(t.done)return;if(await n(t.value,e))return t.value;e+=1}}enumerate(){return this.map((n,e)=>[e,n])}unique(){const n=this._iterator;return new f(async function*(){const e=new Set;for(;;){const t=await n.next();if(t.done)return t.value;e.has(t.value)||(e.add(t.value),yield t.value)}})}async count(){let n=0;for(;;){if((await this._iterator.next()).done)return n;n+=1}}async forEach(n){let e=0;for(;;){const t=await this._iterator.next();if(t.done)return;await n(t.value,e),e+=1}}next(...n){return this._iterator.next(...n)}async return(n){const e=await n;return this._iterator.return?await this._iterator.return(e):{done:!0,value:e}}throw(n){if(this._iterator.throw)return this._iterator.throw(n);throw n}groupBy(n){return new T(this.map(async(e,t)=>[await n(e,t),e]))}toArray(){return Array.fromAsync(this)}[(be=Symbol.toStringTag,Symbol.asyncIterator)](){return this}}var xe;xe=Symbol.toStringTag;const p=class p{constructor(n){a(this,"_elements");a(this,xe,"AggregatedIterator");this._elements=new u(n)}every(n){const e=new Map;for(const[t,s]of this._elements){const[r,o]=e.get(t)??[0,!0];o&&e.set(t,[r+1,n(t,s,r)])}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}some(n){const e=new Map;for(const[t,s]of this._elements){const[r,o]=e.get(t)??[0,!1];o||e.set(t,[r+1,n(t,s,r)])}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}filter(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0;n(s,r,o)&&(yield[s,r]),t.set(s,o+1)}})}map(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0;yield[s,n(s,r,o)],t.set(s,o+1)}})}reduce(n,e){const t=new Map;for(const[s,r]of this._elements){let o,l;if(t.has(s))[o,l]=t.get(s);else if(e!==void 0)o=0,e instanceof Function?l=e(s):l=e;else{t.set(s,[0,r]);continue}t.set(s,[o+1,n(s,l,r,o)])}return new h(function*(){for(const[s,[r,o]]of t)yield[s,o]})}flatMap(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0,l=n(s,r,o);if(l instanceof Array)for(const k of l)yield[s,k];else yield[s,l];t.set(s,o+1)}})}drop(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0;if(o<n){t.set(s,o+1);continue}yield[s,r]}})}take(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0;o>=n||(yield[s,r],t.set(s,o+1))}})}find(n){const e=new Map;for(const[t,s]of this._elements){let[r,o]=e.get(t)??[0,void 0];o===void 0&&(n(t,s,r)&&(o=s),e.set(t,[r+1,o]))}return new h(function*(){for(const[t,[s,r]]of e)yield[t,r]})}enumerate(){return this.map((n,e,t)=>[t,e])}unique(){const n=this._elements;return new p(function*(){const e=new Map;for(const[t,s]of n){const r=e.get(t)??new Set;r.has(s)||(r.add(s),e.set(t,r),yield[t,s])}})}count(){const n=new Map;for(const[e]of this._elements){const t=n.get(e)??0;n.set(e,t+1)}return new h(function*(){for(const[e,t]of n)yield[e,t]})}forEach(n){const e=new Map;for(const[t,s]of this._elements){const r=e.get(t)??0;n(t,s,r),e.set(t,r+1)}}reorganizeBy(n){const e=this._elements;return new p(function*(){const t=new Map;for(const[s,r]of e){const o=t.get(s)??0;yield[n(s,r,o),r],t.set(s,o+1)}})}keys(){const n=this._elements;return new u(function*(){const e=new Set;for(const[t]of n)e.has(t)||(e.add(t),yield t)})}entries(){return this._elements}values(){const n=this._elements;return new u(function*(){for(const[e,t]of n)yield t})}toArray(){const n=this.toMap();return Array.from(n.values())}toMap(){const n=new Map;for(const[e,t]of this._elements){const s=n.get(e)??[];s.push(t),n.set(e,s)}return n}toObject(){const n={};for(const[e,t]of this._elements){const s=n[e]??[];s.push(t),n[e]=s}return n}};let g=p;const ot=Function;var ge,ve;class Ge extends(ve=ot,ge=Symbol.toStringTag,ve){constructor(){super("return this._invoke(...arguments);");a(this,ge,"CallableObject");const e=this.bind(this);return Object.setPrototypeOf(this,e),e}}var Se;Se=Symbol.toStringTag;class v{constructor(){a(this,"_subscribers");a(this,Se,"Publisher");this._subscribers=new Map}clear(){this._subscribers.clear()}publish(n,...e){const t=this._subscribers.get(n);return t?t.slice().map(s=>s(...e)):[]}subscribe(n,e){const t=this._subscribers.get(n)??[];return t.push(e),this._subscribers.set(n,t),()=>{const s=t.indexOf(e);if(s<0)throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed.");t.splice(s,1)}}unsubscribe(n,e){const t=this._subscribers.get(n);if(!t)throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");const s=t.indexOf(e);if(s<0)throw new E("Unable to unsubscribe the required subscriber. The subscription was already unsubscribed or was never subscribed.");t.splice(s,1),t.length===0&&this._subscribers.delete(n)}}const at=()=>{};var ke,Ee;class lt extends(Ee=Ge,ke=Symbol.toStringTag,Ee){constructor(e,t="default"){super();a(this,"_callback");a(this,"_callbacks");a(this,"_isEnabled");a(this,"_key");a(this,"_invoke");a(this,ke,"SwitchableCallback");this._callbacks=new Map,this._isEnabled=!0,e?this._callbacks.set(t,e):(t="",e=()=>{throw new Je("The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?")}),this._key=t,this._callback=e,this._invoke=(...s)=>this._callback(...s)}get isEnabled(){return this._isEnabled}get key(){return this._key}enable(e){if(e===void 0){if(!this._key)throw new y("The `SwitchableCallback` has no callback defined yet. Did you forget to call the `register` method?");e=this._key}else if(e){if(!this._callbacks.has(e))throw new y(`The key '${e}' doesn't yet have any associated callback.`)}else throw new y("The key must be a non-empty string.");if(this._isEnabled)throw new m("The `SwitchableCallback` is already enabled.");this._callback=this._callbacks.get(e),this._isEnabled=!0}disable(){if(!this._isEnabled)throw new m("The `SwitchableCallback` is already disabled.");this._callback=at,this._isEnabled=!1}register(e,t){if(this._callbacks.size===0)this._key=e,this._callback=t;else if(this._callbacks.has(e))throw new y(`The key '${e}' has already been used for another callback.`);this._callbacks.set(e,t)}unregister(e){if(this._key===e)throw new y("Unable to unregister the currently selected callback.");if(!this._callbacks.has(e))throw new y(`The key '${e}' doesn't yet have any associated callback.`);this._callbacks.delete(e)}switch(e){if(!this._callbacks.has(e))throw new y(`The key '${e}' doesn't yet have any associated callback.`);this._key!==e&&(this._key=e,this._isEnabled&&(this._callback=this._callbacks.get(e)))}}var Te,Me;class ut extends(Me=Map,Te=Symbol.toStringTag,Me){constructor(e){super();a(this,"_publisher");a(this,Te,"MapView");if(this._publisher=new v,e)for(const[t,s]of e)this.set(t,s)}set(e,t){return super.set(e,t),this._publisher.publish("entry:add",e,t),this}delete(e){const t=this.get(e);return t===void 0?!1:(super.delete(e),this._publisher.publish("entry:remove",e,t),!0)}clear(){const e=this.size;super.clear(),e>0&&this._publisher.publish("collection:clear")}subscribe(e,t){return this._publisher.subscribe(e,t)}unsubscribe(e,t){this._publisher.unsubscribe(e,t)}}var Re,Fe;class ct extends(Fe=Set,Re=Symbol.toStringTag,Fe){constructor(e){super();a(this,"_publisher");a(this,Re,"SetView");if(this._publisher=new v,e)for(const t of e)this.add(t)}add(e){return super.add(e),this._publisher.publish("entry:add",e),this}delete(e){const t=super.delete(e);return t&&this._publisher.publish("entry:remove",e),t}clear(){const e=this.size;super.clear(),e>0&&this._publisher.publish("collection:clear")}subscribe(e,t){return this._publisher.subscribe(e,t)}unsubscribe(e,t){this._publisher.unsubscribe(e,t)}}var Pe;Pe=Symbol.toStringTag;class ht{constructor(n=!0){a(this,"_preferPersistence");a(this,"_volatile");a(this,"_persistent");a(this,Pe,"JSONStorage");if(!P)throw new Le("The `JSONStorage` class can only be instantiated within a browser environment.");this._preferPersistence=n,this._volatile=window.sessionStorage,this._persistent=window.localStorage}_get(n,e,t){const s=n.getItem(e);if(s)try{return JSON.parse(s)}catch{console.warn(`The "${s}" value for "${e}" property cannot be parsed. Clearing the storage...`),n.removeItem(e)}return t}_set(n,e,t){const s=JSON.stringify(t);s?n.setItem(e,s):n.removeItem(e)}get(n,e,t=this._preferPersistence){const s=t?this._persistent:this._volatile;return this._get(s,n,e)}recall(n,e){return this._get(this._volatile,n,e)}retrieve(n,e){return this.recall(n)??this.read(n,e)}read(n,e){return this._get(this._persistent,n,e)}has(n,e){return(e?this._persistent:this._volatile).getItem(n)!==null}knows(n){return this._volatile.getItem(n)!==null}find(n){return this.knows(n)??this.exists(n)}exists(n){return this._persistent.getItem(n)!==null}set(n,e,t=this._preferPersistence){const s=t?this._persistent:this._volatile;this._set(s,n,e)}remember(n,e){this._set(this._volatile,n,e)}write(n,e){this._set(this._persistent,n,e)}delete(n,e){(e?this._persistent:this._volatile).removeItem(n)}forget(n){this._volatile.removeItem(n)}erase(n){this._persistent.removeItem(n)}clear(n){this._volatile.removeItem(n),this._persistent.removeItem(n)}}var Ce;Ce=Symbol.toStringTag;const j=class j{constructor(n){a(this,"_isPending");a(this,"_isFulfilled");a(this,"_isRejected");a(this,"_promise");a(this,Ce,"SmartPromise");this._isPending=!0,this._isFulfilled=!1,this._isRejected=!1;const e=s=>(this._isPending=!1,this._isFulfilled=!0,s),t=s=>{throw this._isPending=!1,this._isRejected=!0,s};this._promise=new Promise(n).then(e,t)}static FromPromise(n){return new j((e,t)=>n.then(e,t))}get isPending(){return this._isPending}get isFulfilled(){return this._isFulfilled}get isRejected(){return this._isRejected}then(n,e){return this._promise.then(n,e)}catch(n){return this._promise.catch(n)}finally(n){return this._promise.finally(n)}};let S=j;var Ie,je;class Ke extends(je=S,Ie=Symbol.toStringTag,je){constructor(e,t){let s,r;super((o,l)=>{s=o,r=l});a(this,"_resolve");a(this,"_reject");a(this,Ie,"DeferredPromise");this._promise=this._promise.then(e,t),this._resolve=s,this._reject=r}get resolve(){return this._resolve}get reject(){return this._reject}watch(e){return e.then(this.resolve,this.reject),this}}var Ae,Ne;class ft extends(Ne=S,Ae=Symbol.toStringTag,Ne){constructor(e,t){super((s,r)=>{const o=R=>{clearTimeout(N),s(R)},l=R=>{clearTimeout(N),r(R)},N=setTimeout(()=>l(new Ye("The operation has timed out.")),t);e(o,l)});a(this,Ae,"TimedPromise")}}var M=(i=>(i[i.Millisecond=1]="Millisecond",i[i.Second=1e3]="Second",i[i.Minute=6e4]="Minute",i[i.Hour=36e5]="Hour",i[i.Day=864e5]="Day",i[i.Week=6048e5]="Week",i[i.Month=2592e6]="Month",i[i.Year=31536e6]="Year",i))(M||{}),He=(i=>(i[i.Sunday=0]="Sunday",i[i.Monday=1]="Monday",i[i.Tuesday=2]="Tuesday",i[i.Wednesday=3]="Wednesday",i[i.Thursday=4]="Thursday",i[i.Friday=5]="Friday",i[i.Saturday=6]="Saturday",i))(He||{});function dt(i,n,e=864e5){let t;return i=new Date(i),n=new Date(n),i<n?t=Math.floor:t=Math.ceil,t((n.getTime()-i.getTime())/e)}function mt(i,n,e=864e5){if(i=new Date(i),n=new Date(n),i>=n)throw new b("The end date must be greater than the start date.");return new u(function*(){const t=n.getTime();let s=i.getTime();for(;s<t;)yield new Date(s),s+=e})}function Qe(i,n=864e5){if(n<=1)throw new b("Rounding a timestamp by milliseconds or less makes no sense.Use the timestamp value directly instead.");if(n>864e5)throw new b("Rounding by more than a day leads to unexpected results. Consider using other methods to round dates by weeks, months or years.");return i=new Date(i),new Date(Math.floor(i.getTime()/n)*n)}function wt(i,n=0){i=new Date(i);const e=7-n,t=(i.getUTCDay()+e)%7,s=i.getTime()-864e5*t;return Qe(new Date(s))}var Oe;Oe=Symbol.toStringTag;class I{constructor(n,e=40){a(this,"_handle");a(this,"_startTime");a(this,"_isRunning");a(this,"_publisher");a(this,"_start");a(this,"_stop");a(this,Oe,"GameLoop");this._startTime=0,this._isRunning=!1,P?(this._start=()=>{n(this.elapsedTime),this._handle=window.requestAnimationFrame(this._start)},this._stop=()=>window.cancelAnimationFrame(this._handle)):(console.warn(`Not a browser environment detected. Using setInterval@${e}ms instead of requestAnimationFrame...`),this._start=()=>{this._handle=setInterval(()=>n(this.elapsedTime),e)},this._stop=()=>clearInterval(this._handle)),this._publisher=new v}get startTime(){return this._startTime}get isRunning(){return this._isRunning}get elapsedTime(){return performance.now()-this._startTime}start(n=0){if(this._isRunning)throw new m("The game loop has already been started.");this._startTime=performance.now()-n,this._start(),this._isRunning=!0,this._publisher.publish("start")}stop(){if(!this._isRunning)throw new m("The game loop had already stopped or hadn't yet started.");if(!this._handle)throw new x;this._stop(),this._handle=void 0,this._isRunning=!1,this._publisher.publish("stop")}onStart(n){return this._publisher.subscribe("start",n)}onStop(n){return this._publisher.subscribe("stop",n)}}var ze,qe;class pt extends(qe=I,ze=Symbol.toStringTag,qe){constructor(e=M.Second){super(t=>this._publisher.publish("tick",t),e);a(this,"_publisher");a(this,ze,"Clock");this._publisher=new v}start(e=0){if(this._isRunning)throw new m("The clock has already been started.");this._startTime=performance.now()-e,this._start(),this._isRunning=!0,this._publisher.publish("start")}stop(){if(!this._isRunning)throw new m("The clock had already stopped or hadn't yet started.");if(!this._handle)throw new x;this._stop(),this._handle=void 0,this._isRunning=!1,this._publisher.publish("stop")}onTick(e,t=0){if(t<0)throw new b("The tick step must be a non-negative number.");if(t===0)return this._publisher.subscribe("tick",e);let s=0;return this._publisher.subscribe("tick",r=>{r-s<t||(e(r),s=r)})}}var $e,De;class yt extends(De=I,$e=Symbol.toStringTag,De){constructor(e,t=M.Second){super(()=>{const r=this.remainingTime;r<=0?(this._deferrerStop(),this._publisher.publish("tick",0),this._publisher.publish("expire")):this._publisher.publish("tick",r)},t);a(this,"_publisher");a(this,"_duration");a(this,"_deferrer");a(this,$e,"Countdown");this._publisher=new v,this._duration=e}get duration(){return this._duration}get remainingTime(){return this._duration-this.elapsedTime}_deferrerStop(e){if(!this._isRunning)throw new m("The countdown hadn't yet started.");if(!this._deferrer)throw new x;this._stop(),this._handle=void 0,this._isRunning=!1,e!==void 0?this._deferrer.reject(e):this._deferrer.resolve(),this._deferrer=void 0}start(e=this.duration){if(this._isRunning)throw new m("The countdown had already stopped or hadn't yet started.");if(this._deferrer)throw new x;return this._deferrer=new Ke,super.start(this.duration-e),this._publisher.publish("start"),this._deferrer}stop(e){this._deferrerStop(e),this._publisher.publish("stop",e)}onExpire(e){return this._publisher.subscribe("expire",e)}onTick(e,t=0){if(t<0)throw new b("The tick step must be a non-negative number.");if(t===0)return this._publisher.subscribe("tick",e);let s=this.remainingTime;return this._publisher.subscribe("tick",r=>{s-r<t||(e(r),s=r)})}}var Ve;Ve=Symbol.toStringTag;class _t{constructor(){a(this,Ve,"Curve")}static Linear(n){const e=n-1;return new u(function*(){for(let t=0;t<n;t+=1)yield t/e})}static Exponential(n,e=2){if(e<0)throw new d("The base of the exponential curve cannot be negative.");const t=n-1;return new u(function*(){for(let s=0;s<n;s+=1)yield Math.pow(s/t,e)})}}var Be;Be=Symbol.toStringTag;const A=class A{constructor(){a(this,Be,"Random")}static Boolean(n=.5){return Math.random()<n}static Integer(n,e){return Math.floor(e===void 0?Math.random()*n:Math.random()*(e-n)+n)}static Decimal(n,e){return n===void 0?Math.random():e===void 0?Math.random()*n:Math.random()*(e-n)+n}static Index(n){if(n.length===0)throw new d("You must provide at least one element.");return this.Integer(n.length)}static Choice(n){return n[A.Index(n)]}};let F=A;function bt(i){return new Promise(n=>setTimeout(n,i))}function xt(){return new Promise(i=>requestAnimationFrame(()=>i()))}function gt(){return new Promise(i=>setTimeout(i))}function vt(i,n="text/javascript"){return new Promise((e,t)=>{const s=document.createElement("script");s.async=!0,s.defer=!0,s.src=i,s.type=n,s.onload=r=>e(),s.onerror=r=>t(r),document.body.appendChild(s)})}function St(...i){return new u(function*(){for(const n of i)for(const e of n)yield e})}function kt(i){if(i instanceof Array)return i.length;let n=0;for(const e of i)n+=1;return n}function Et(i){return new u(function*(){let n=0;for(const e of i)yield[n,e],n+=1})}function Tt(i,n,e=1){if(e<=0)throw new b("Step must be always a positive number, even when generating numbers in reverse order.");return n===void 0&&(n=i,i=0),i>n?new u(function*(){for(let t=i;t>n;t-=e)yield t}):new u(function*(){for(let t=i;t<n;t+=e)yield t})}function Mt(i){const n=Array.from(i);for(let e=n.length-1;e>0;e-=1){const t=Math.floor(Math.random()*(e+1));[n[e],n[t]]=[n[t],n[e]]}return n}function Rt(i){return new u(function*(){const n=new Set;for(const e of i)n.has(e)||(n.add(e),yield e)})}function Xe(i,n){const e=i[Symbol.iterator](),t=n[Symbol.iterator]();return new u(function*(){for(;;){const s=e.next(),r=t.next();if(s.done||r.done)break;yield[s.value,r.value]}})}function Ft(i,n){if(n===void 0){let r=0,o=0;for(const l of i)r+=l,o+=1;if(o===0)throw new d("You must provide at least one value.");return r/o}let e=0,t=0,s=0;for(const[r,o]of Xe(i,n)){if(o<=0)throw new d(`The weight for the value #${s} must be greater than zero.`);e+=r*o,t+=o,s+=1}if(s===0)throw new d("You must provide at least one value and weight.");if(t<=0)throw new d("The sum of weights must be greater than zero.");return e/t}function Pt(i){let n=0;for(let e=0;e<i.length;e+=1){const t=i.charCodeAt(e);n=(n<<5)-n+t,n|=0}return n}function Ct(i){let n=0;for(const e of i)n+=e;return n}function It(i){return`${i.charAt(0).toUpperCase()}${i.slice(1)}`}const jt="2.1.3";exports.AggregatedAsyncIterator=T;exports.AggregatedIterator=g;exports.CallableObject=Ge;exports.Clock=pt;exports.Countdown=yt;exports.Curve=_t;exports.DeferredPromise=Ke;exports.EnvironmentException=Le;exports.Exception=c;exports.FatalErrorException=x;exports.FileException=C;exports.FileExistsException=tt;exports.FileNotFoundException=nt;exports.GameLoop=I;exports.JSONStorage=ht;exports.KeyException=y;exports.MapView=ut;exports.NetworkException=st;exports.NotImplementedException=Je;exports.PermissionException=rt;exports.Publisher=v;exports.Random=F;exports.RangeException=b;exports.ReducedIterator=h;exports.ReferenceException=E;exports.RuntimeException=m;exports.SetView=ct;exports.SmartAsyncIterator=f;exports.SmartIterator=u;exports.SmartPromise=S;exports.SwitchableCallback=lt;exports.TimeUnit=M;exports.TimedPromise=ft;exports.TimeoutException=Ye;exports.TypeException=it;exports.VERSION=jt;exports.ValueException=d;exports.WeekDay=He;exports.average=Ft;exports.capitalize=It;exports.chain=St;exports.count=kt;exports.dateDifference=dt;exports.dateRange=mt;exports.dateRound=Qe;exports.delay=bt;exports.enumerate=Et;exports.getWeek=wt;exports.hash=Pt;exports.isBrowser=P;exports.isNode=Ue;exports.isWorker=et;exports.loadScript=vt;exports.nextAnimationFrame=xt;exports.range=Tt;exports.shuffle=Mt;exports.sum=Ct;exports.unique=Rt;exports.yieldToEventLoop=gt;exports.zip=Xe;
|
|
6
6
|
//# sourceMappingURL=core.cjs.map
|