tiny-essentials
Version:
Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.
1 lines • 21.6 kB
JavaScript
(()=>{"use strict";var e={d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)},t={};e.d(t,{TinyAdvancedRaffle:()=>i});const r=class{#e=new Map;#t=10;#r=!1;#s(e,t){if("string"==typeof e)return[e];if(Array.isArray(e)&&e.every(e=>"string"==typeof e))return e;throw new TypeError(`${t}(event): event must be a string or string[]`)}setThrowOnMaxListeners(e){if("boolean"!=typeof e)throw new TypeError("setThrowOnMaxListeners(value): value must be a boolean");this.#r=e}getThrowOnMaxListeners(){return this.#r}#i(e,t,{once:r=!1}={}){let s=this.#e.get(e);Array.isArray(s)||(s=[],this.#e.set(e,s)),s.unshift({handler:t,config:{once:r}});const i=this.#t;if(i>0&&s.length>i){const t=`Possible memory leak detected. ${s.length} "${e}" listeners added. Use setMaxListeners() to increase limit.`;if(this.#r)throw new Error(t);console.warn(t)}}prependListener(e,t){const r=this.#s(e,"prependListener");if("function"!=typeof t)throw new TypeError("prependListener(event, handler): handler must be a function");for(const e of r)this.#i(e,t)}prependListenerOnce(e,t){const r=this.#s(e,"prependListenerOnce");if("function"!=typeof t)throw new TypeError("prependListenerOnce(event, handler): handler must be a function");const s=[];for(const e of r){const r=(...s)=>{this.off(e,r),t(...s)};this.#i(e,r,{once:!0}),s.push(r)}return s}#n(e,t,{once:r=!1}={}){const s=this.#s(e,"on");for(const e of s){let s=this.#e.get(e);Array.isArray(s)||(s=[],this.#e.set(e,s)),s.push({handler:t,config:{once:r}});const i=this.#t;if(i>0&&s.length>i){const t=`Possible memory leak detected. ${s.length} "${e}" listeners added. Use setMaxListeners() to increase limit.`;if(this.#r)throw new Error(t);console.warn(t)}}}on(e,t){if("function"!=typeof t)throw new TypeError("on(event, handler): handler must be a function");return this.#n(e,t)}once(e,t){const r=this.#s(e,"once");if("function"!=typeof t)throw new TypeError("once(event, handler): handler must be a function");const s=[];for(const e of r){const r=(...s)=>{this.off(e,r),t(...s)};this.#n(e,r,{once:!0}),s.push(r)}return s}appendListener(e,t){return this.on(e,t)}appendListenerOnce(e,t){return this.once(e,t)}off(e,t){const r=this.#s(e,"off");if("function"!=typeof t)throw new TypeError("off(event, handler): handler must be a function");for(const e of r){const r=this.#e.get(e);if(!Array.isArray(r))continue;const s=r.findIndex(e=>e.handler===t);-1!==s&&r.splice(s,1),0===r.length&&this.#e.delete(e)}}offAll(e){const t=this.#s(e,"offAll");for(const e of t)this.#e.delete(e)}offAllTypes(){this.#e.clear()}listenerCount(e){if("string"!=typeof e)throw new TypeError("listenerCount(event): event name must be a string");const t=this.#e.get(e);return Array.isArray(t)?t.length:0}listeners(e){if("string"!=typeof e)throw new TypeError("listeners(event): event name must be a string");const t=this.#e.get(e);return Array.isArray(t)?[...t].filter(e=>!e.config.once).map(e=>e.handler):[]}onceListeners(e){if("string"!=typeof e)throw new TypeError("onceListeners(event): event name must be a string");const t=this.#e.get(e);return Array.isArray(t)?[...t].filter(e=>e.config.once).map(e=>e.handler):[]}allListeners(e){if("string"!=typeof e)throw new TypeError("allListeners(event): event name must be a string");const t=this.#e.get(e);return Array.isArray(t)?[...t].map(e=>e.handler):[]}eventNames(){return[...this.#e.keys()]}emit(e,...t){const r=this.#s(e,"emit"),s=[];for(const e of r){const r=this.#e.get(e);Array.isArray(r)&&0!==r.length?(r.forEach(e=>e.handler(...t)),s.push(!0)):s.push(!1)}return s}setMaxListeners(e){if(!Number.isInteger(e)||e<0)throw new TypeError("setMaxListeners(n): n must be a non-negative integer");this.#t=e}getMaxListeners(){return this.#t}};class s{#o=new r;#a(e,...t){return this.#o.emit(e,...t)}setThrowOnMaxListeners(e){return this.#o.setThrowOnMaxListeners(e)}getThrowOnMaxListeners(){return this.#o.getThrowOnMaxListeners()}prependListener(e,t){return this.#o.prependListener(e,t)}prependListenerOnce(e,t){return this.#o.prependListenerOnce(e,t)}appendListener(e,t){return this.#o.appendListener(e,t)}appendListenerOnce(e,t){return this.#o.appendListenerOnce(e,t)}on(e,t){return this.#o.on(e,t)}once(e,t){return this.#o.once(e,t)}off(e,t){return this.#o.off(e,t)}offAll(e){return this.#o.offAll(e)}offAllTypes(){return this.#o.offAllTypes()}listenerCount(e){return this.#o.listenerCount(e)}listeners(e){return this.#o.listeners(e)}onceListeners(e){return this.#o.onceListeners(e)}allListeners(e){return this.#o.allListeners(e)}eventNames(){return this.#o.eventNames()}setMaxListeners(e){return this.#o.setMaxListeners(e)}getMaxListeners(){return this.#o.getMaxListeners()}#h=!1;#u;#f;#p=[];#c=[];#m=[];#l=new Map;#y=new Set;#d=new Map;#w;#g=new Map;#b=new Map;get isDestroyed(){return this.#h}get freq(){return Object.fromEntries(this.#b)}get size(){return this.#g.size}get normalization(){return this.#u}set normalization(e){if(this._checkDestroyed(),"string"!=typeof e||!e.trim())throw new TypeError("normalization must be a non-empty string (e.g., 'relative', 'softmax').");this.#u=e}get seed(){return this.#f}set seed(e){if(this._checkDestroyed(),null!==e&&("number"!=typeof e||!Number.isFinite(e)))throw new TypeError("seed must be a finite number or null.");this.#f=e,null!==e&&(this.#w=this._makeSeededRng(e))}get globalModifiers(){return[...this.#p]}set globalModifiers(e){if(this._checkDestroyed(),!Array.isArray(e)||!e.every(e=>"function"==typeof e))throw new TypeError("globalModifiers must be an array of functions (WeightsCallback).");this.#p=e}get temporaryModifiers(){return[...this.#c]}set temporaryModifiers(e){if(this._checkDestroyed(),!Array.isArray(e)||!e.every(e=>e&&"function"==typeof e.fn&&Number.isInteger(e.uses)&&e.uses>0))throw new TypeError("temporaryModifiers must be an array of objects { fn: function, uses: positive integer }.");this.#c=e}get conditionalRules(){return[...this.#m]}set conditionalRules(e){if(this._checkDestroyed(),!Array.isArray(e)||!e.every(e=>"function"==typeof e))throw new TypeError("conditionalRules must be an array of functions (WeightsCallback).");this.#m=e}get pitySystems(){return Object.fromEntries(this.#l)}set pitySystems(e){if(this._checkDestroyed(),!(e instanceof Map&&[...e.values()].every(e=>e&&"number"==typeof e.threshold&&"number"==typeof e.increment&&"number"==typeof e.cap&&"number"==typeof e.counter&&"number"==typeof e.currentAdd)))throw new TypeError("pitySystems must be a Map<string, Pity> with all numeric fields.");this.#l=e}get exclusions(){return Array.from(this.#y)}set exclusions(e){if(this._checkDestroyed(),!(e instanceof Set&&[...e].every(e=>"string"==typeof e)))throw new TypeError("exclusions must be a Set<string>.");this.#y=e}get groups(){const e={};return this.#d.forEach((t,r)=>e[r]=Array.from(t)),e}set groups(e){if(this._checkDestroyed(),!(e instanceof Map&&[...e.values()].every(e=>e instanceof Set&&[...e].every(e=>"string"==typeof e))))throw new TypeError("groups must be a Map<string, Set<string>>.");this.#d=e}get rng(){return this.#w}set rng(e){if(this._checkDestroyed(),"function"!=typeof e||"number"!=typeof e())throw new TypeError("rng must be a function returning a number (RngGenerator).");this.#w=e}get items(){const e={};return this.#g.forEach((t,r)=>{e[r]={...t,groups:Array.from(t.groups)}}),e}set items(e){if(this._checkDestroyed(),!(e instanceof Map&&[...e.values()].every(e=>e&&"string"==typeof e.id&&"string"==typeof e.label&&"number"==typeof e.baseWeight&&e.groups instanceof Set&&"boolean"==typeof e.locked&&"object"==typeof e.meta)))throw new TypeError("items must be a Map<string, ItemData> with valid item structures.");this.clearList(),this.#g=e}constructor(e={}){const{rng:t=null,seed:r=null,normalization:s="relative"}=e;this.#u=s,this.#f=r,"function"==typeof t?this.#w=t:null!==this.#f?this.#w=this._makeSeededRng(this.#f):this.#w=Math.random,this.#f=r??null}_checkDestroyed(){if(this.#h)throw new Error("This instance has been destroyed and can no longer be used.")}hasItem(e){if("string"!=typeof e)throw new TypeError("itemId must be a string");return this.#g.has(e)}addItem(e,t={}){if(this._checkDestroyed(),"string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");if("object"!=typeof t||null===t)throw new TypeError("opts must be an object");let{weight:r=1,label:s=e,meta:i={},groups:n=[]}=t;if("number"!=typeof r||!Number.isFinite(r)||r<0)throw new TypeError("weight must be a non-negative number");if("string"!=typeof s)throw new TypeError("label must be a string");if("object"!=typeof i||null===i)throw new TypeError("meta must be an object");if(!(Array.isArray(n)||n instanceof Set))throw new TypeError("groups must be an array or a Set of strings");n=Array.isArray(n)?n:[...n];for(const e of n)if("string"!=typeof e)throw new TypeError("groups must contain only strings");const o={id:e,label:s,baseWeight:Math.max(0,Number(r)||0),meta:{...i},groups:new Set(n),locked:!1};this.#g.set(e,o);for(const t of n)this._ensureGroup(t).add(e);return this.#a("itemAdded",o),o}removeItem(e){if(this._checkDestroyed(),"string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");const t=this.#g.get(e);if(!t)return!1;for(const r of t.groups){const t=this.#d.get(r);t&&t.delete(e)}return this.#g.delete(e),this.#a("itemRemoved",e),this.resetFreq(e),this.resetPity(e),!0}setBaseWeight(e,t){if(this._checkDestroyed(),"string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");if("number"!=typeof t||!Number.isFinite(t)||t<0)throw new TypeError("weight must be a non-negative number");const r=this.#g.get(e);if(!r)throw new Error("Item not found");r.baseWeight=Math.max(0,Number(t)||0),this.#a("weightChanged",{id:e,weight:r.baseWeight})}getItem(e){if("string"!=typeof e||!e.trim())throw new TypeError("id must be a non-empty string");return this.#g.get(e)??null}listItems(){return Array.from(this.#g.values()).map(e=>({...e}))}clearList(){this._checkDestroyed(),this.#g.clear(),this.clearFreqs(),this.clearPities()}hasGlobalModifier(e){if("function"!=typeof e)throw new TypeError("fn must be a function");return this.#p.includes(e)}addGlobalModifier(e){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("fn must be a function");this.#p.push(e)}removeGlobalModifier(e){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("fn must be a function");this.#p=this.#p.filter(t=>t!==e)}hasTemporaryModifier(e){if("function"!=typeof e)throw new TypeError("fn must be a function");return this.#c.some(t=>t.fn===e)}addTemporaryModifier(e,t=1){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("fn must be a function");if("number"!=typeof t||Number.isNaN(t))throw new TypeError("uses must be a number");this.#c.push({fn:e,uses:Math.max(1,Math.floor(t))})}removeTemporaryModifier(e){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("fn must be a function");const t=this.#c.length;return this.#c=this.#c.filter(t=>t.fn!==e),this.#c.length!==t}hasConditionalRule(e){if("function"!=typeof e)throw new TypeError("ruleFn must be a function");return this.#m.includes(e)}addConditionalRule(e){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("ruleFn must be a function");this.#m.push(e)}removeConditionalRule(e){if(this._checkDestroyed(),"function"!=typeof e)throw new TypeError("ruleFn must be a function");const t=this.#m.length;return this.#m=this.#m.filter(t=>t!==e),this.#m.length!==t}hasPity(e){if("string"!=typeof e)throw new TypeError("itemId must be a string");return this.#l.has(e)}configurePity(e,t){if(this._checkDestroyed(),!this.#g.has(e))throw new Error("Item not found");if("object"!=typeof t||null===t)throw new TypeError("cfg must be an object");const{threshold:r,increment:s,cap:i=1/0}=t;if("number"!=typeof r||r<=0)throw new TypeError("threshold must be a positive number");if("number"!=typeof s)throw new TypeError("increment must be a number");if("number"!=typeof i)throw new TypeError("cap must be a number");this.#l.set(e,{threshold:Math.max(1,r),increment:Number(s)||0,cap:Number(i)||1/0,counter:0,currentAdd:0})}resetPity(e){if(this._checkDestroyed(),"string"!=typeof e||!e.trim())throw new TypeError("itemId must be a non-empty string");const t=this.#l.get(e);t&&(t.counter=0,t.currentAdd=0)}clearPities(){this._checkDestroyed(),this.#l.clear()}hasExclusion(e){if("string"!=typeof e)throw new TypeError("itemId must be a string");return this.#y.has(e)}excludeItem(e){if(this._checkDestroyed(),"string"!=typeof e)throw new TypeError("itemId must be a string");this.#y.add(e)}includeItem(e){if(this._checkDestroyed(),"string"!=typeof e)throw new TypeError("itemId must be a string");this.#y.delete(e)}_ensureGroup(e){if(this._checkDestroyed(),"string"!=typeof e)throw new TypeError("name must be a string");let t=this.#d.get(e);return t||(t=new Set,this.#d.set(e,t)),t}hasInGroup(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("itemId and groupName must be strings");const r=this.#d.get(t);return!!r&&r.has(e)}addToGroup(e,t){if(this._checkDestroyed(),"string"!=typeof e||"string"!=typeof t)throw new TypeError("itemId and groupName must be strings");const r=this.#g.get(e);if(!r)throw new Error("Item missing");r.groups.add(t),this._ensureGroup(t).add(e)}removeFromGroup(e,t){if(this._checkDestroyed(),"string"!=typeof e||"string"!=typeof t)throw new TypeError("itemId and groupName must be strings");const r=this.#d.get(t);r&&r.delete(e);const s=this.#g.get(e);s&&s.groups.delete(t)}clearFreqs(){this._checkDestroyed(),this.#b.clear()}resetFreq(e){if(this._checkDestroyed(),"string"!=typeof e)throw new TypeError("itemId must be a string");this.#b.delete(e)}computeEffectiveWeights(e={}){if(this._checkDestroyed(),"object"!=typeof e||null===e)throw new TypeError("computeEffectiveWeights: parameter 'context' must be a non-null object, got "+typeof e);if("previousDraws"in e&&!Array.isArray(e.previousDraws))throw new TypeError("computeEffectiveWeights: context.previousDraws must be an array if provided, got "+typeof e.previousDraws);if("metadata"in e&&void 0!==e.metadata&&("object"!=typeof e.metadata||null===e.metadata))throw new TypeError("computeEffectiveWeights: context.metadata must be a non-null object if provided, got "+typeof e.metadata);const t=new Map;for(const[e,r]of this.#g)t.set(e,r.baseWeight);for(const r of this.#p){const s=r(t,e);if(s instanceof Map)for(const[e,r]of s)t.set(e,Math.max(0,(t.get(e)||0)+r))}for(const r of this.#c){const s=r.fn(t,e);if(s instanceof Map)for(const[e,r]of s)t.set(e,Math.max(0,(t.get(e)||0)+r))}for(const r of this.#m){const s=r(t,e);if(s instanceof Map)for(const[e,r]of s)t.set(e,Math.max(0,(t.get(e)||0)+r))}for(const[e,r]of this.#l)if(t.has(e)&&r.counter>r.threshold){r.currentAdd=Math.min(r.cap,r.currentAdd+r.increment);const s=t.get(e);s&&t.set(e,s+r.currentAdd)}for(const e of this.#y)t.delete(e);for(const[e,r]of Array.from(t.entries()))r>0||t.delete(e);return t}_weightsToDistribution(e){if(this._checkDestroyed(),!(e instanceof Map))throw new TypeError("_weightsToDistribution: parameter 'weights' must be a Map, got "+typeof e);for(const[t,r]of e){if("string"!=typeof t)throw new TypeError("_weightsToDistribution: weights Map key must be string, got "+typeof t);if("number"!=typeof r||!Number.isFinite(r)||r<0)throw new TypeError(`_weightsToDistribution: weights Map value must be finite non-negative number, got ${r} for key ${t}`)}const t=Array.from(e.entries()).map(([e,t])=>({id:e,weight:t}));if(0===t.length)return[];if("softmax"===this.#u){const e=Math.max(...t.map(e=>e.weight)),r=t.map(t=>Math.exp(t.weight-e)),s=r.reduce((e,t)=>e+t,0);let i=0;return t.map((e,t)=>{const n=r[t]/s;return i+=n,{id:e.id,weight:e.weight,p:n,cumulative:i}})}{const e=t.reduce((e,t)=>e+t.weight,0);let r=0;return t.map(t=>{const s=t.weight/e;return r+=s,{id:t.id,weight:t.weight,p:s,cumulative:r}})}}drawOne(e={}){if(this._checkDestroyed(),"object"!=typeof e||null===e)throw new TypeError("drawOne: parameter 'opts' must be a non-null object, got "+typeof e);if("previousDraws"in e&&!Array.isArray(e.previousDraws))throw new TypeError("drawOne: opts.previousDraws must be an array if provided, got "+typeof e.previousDraws);if("metadata"in e&&void 0!==e.metadata&&("object"!=typeof e.metadata||null===e.metadata))throw new TypeError("drawOne: opts.metadata must be a non-null object if provided, got "+typeof e.metadata);const t={previousDraws:e.previousDraws??[],metadata:e.metadata??{},activeModifiers:[...this.#c]},r=this.computeEffectiveWeights(t),s=this._weightsToDistribution(r);if(!s.length)return null;const i=this.#w(),n=s.find(e=>i<=e.cumulative)??s[s.length-1];for(const[e,t]of this.#l)e===n.id?(t.counter=0,t.currentAdd=0):t.counter++;this._consumeTemporaryModifiers();const o=this.#g.get(n.id);if(!o)return null;const a={id:o.id,label:o.label,meta:{...o.meta},prob:n.p};return this.#a("draw",a),a&&this.#b.set(a.id,(this.#b.get(a.id)||0)+1),a}_consumeTemporaryModifiers(){this._checkDestroyed();for(let e=this.#c.length-1;e>=0;--e){const t=this.#c[e];t.uses-=1,t.uses<=0&&this.#c.splice(e,1)}}drawMany(e=1,t={}){if(this._checkDestroyed(),!Number.isInteger(e)||e<=0)throw new TypeError(`drawMany: parameter 'count' must be a positive integer, got ${e}`);if("object"!=typeof t||null===t)throw new TypeError("drawMany: parameter 'opts' must be a non-null object, got "+typeof t);if("withReplacement"in t&&"boolean"!=typeof t.withReplacement)throw new TypeError("drawMany: opts.withReplacement must be boolean if provided, got "+typeof t.withReplacement);if("ensureUnique"in t&&"boolean"!=typeof t.ensureUnique)throw new TypeError("drawMany: opts.ensureUnique must be boolean if provided, got "+typeof t.ensureUnique);if("metadata"in t&&void 0!==t.metadata&&("object"!=typeof t.metadata||null===t.metadata))throw new TypeError("drawMany: opts.metadata must be a non-null object if provided, got "+typeof t.metadata);if("previousDraws"in t&&!Array.isArray(t.previousDraws))throw new TypeError("drawMany: opts.previousDraws must be an array if provided, got "+typeof t.previousDraws);const r=t.withReplacement??!0,s=t.ensureUnique??!1,i=[],n=t.previousDraws??[];if(!r&&s){const r=new Set;for(let s=0;s<e;++s){const e=new Set(this.#y);for(const e of r)this.#y.add(e);const s=this.drawOne({previousDraws:n,metadata:t.metadata});if(this.#y=e,!s)break;i.push(s),r.add(s.id),n.push(s)}return i}for(let s=0;s<e;++s){const e=this.drawOne({previousDraws:n,metadata:t.metadata});if(!e)break;i.push(e),n.push(e),r||this.excludeItem(e.id)}if(!r)for(const e of i)this.includeItem(e.id);return i}exportToJson(){return this._checkDestroyed(),{items:Array.from(this.#g.values()).map(e=>({id:e.id,label:e.label,baseWeight:e.baseWeight,meta:e.meta,groups:Array.from(e.groups),locked:!1})),pity:Array.from(this.#l.entries()),exclusions:Array.from(this.#y),normalization:this.#u,seed:this.#f}}loadFromJson(e){if(this._checkDestroyed(),"object"!=typeof e||null===e)throw new TypeError("data must be a non-null object");if(!Array.isArray(e.items)||!Array.isArray(e.pity)||!Array.isArray(e.exclusions))throw new TypeError("data must have items, pity, and exclusions arrays");if("string"!=typeof e.normalization)throw new TypeError("data.normalization must be a string");if(void 0!==e.seed&&null!==e.seed&&"number"!=typeof e.seed)throw new TypeError("data.seed must be a number, null, or undefined");this.clearList();for(const t of e.items){if("object"!=typeof t||null===t)throw new TypeError("Each item must be a non-null object");if("string"!=typeof t.id||!t.id.trim())throw new TypeError("Each item.id must be a non-empty string");if("string"!=typeof t.label)throw new TypeError(`Item with id "${t.id}" has invalid label; must be string`);if("number"!=typeof t.baseWeight||!Number.isFinite(t.baseWeight)||t.baseWeight<0)throw new TypeError(`Item with id "${t.id}" has invalid baseWeight; must be a finite non-negative number`);if(void 0!==t.groups&&!Array.isArray(t.groups))throw new TypeError(`Item with id "${t.id}" has invalid groups; must be an array of strings`);if(t.groups&&!t.groups.every(e=>"string"==typeof e))throw new TypeError(`Item with id "${t.id}" has groups containing non-string values`);if(void 0!==t.meta&&("object"!=typeof t.meta||null===t.meta))throw new TypeError(`Item with id "${t.id}" has invalid meta; must be an object`);this.#g.set(t.id,{id:t.id,label:t.label,baseWeight:t.baseWeight,meta:t.meta||{},groups:new Set(t.groups||[]),locked:!1});for(const e of t.groups||[])this._ensureGroup(e).add(t.id)}this.pitySystems=new Map(e.pity||[]),this.exclusions=new Set(e.exclusions||[]),this.normalization=e.normalization,void 0!==e.seed&&(this.seed=e.seed)}clone(){this._checkDestroyed();const e=new s;return e.#u=this.#u,e.#f=this.#f,e.#p=[...this.#p],e.#c=this.#c.map(e=>({fn:e.fn,uses:e.uses})),e.#m=[...this.#m],e.#l=new Map([...this.#l.entries()].map(([e,t])=>[e,{...t}])),e.#y=new Set(this.#y),e.#d=new Map([...this.#d.entries()].map(([e,t])=>[e,new Set(t)])),e.#w=this.#w,e.#g=new Map([...this.#g.entries()].map(([e,t])=>[e,{...t,groups:new Set(t.groups),meta:{...t.meta}}])),e.#b=new Map(this.#b),e}_makeSeededRng(e){if(this._checkDestroyed(),"number"!=typeof e||!Number.isFinite(e))throw new TypeError("seed must be a finite number");let t=e>>>0;return function(){t+=1831565813;let e=Math.imul(t^t>>>15,1|t);return e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}destroy(){this.#h||(this.#h=!0,this.#l.clear(),this.#y.clear(),this.#d.clear(),this.#g.clear(),this.#b.clear(),this.#p=[],this.#c=[],this.#m=[],this.#f=null)}}const i=s;window.TinyAdvancedRaffle=t.TinyAdvancedRaffle})();