pixi-reels 1.1.0 → 1.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # pixi-reels
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#176](https://github.com/schmooky/pixi-reels/pull/176) [`01639b0`](https://github.com/schmooky/pixi-reels/commit/01639b0f45bc3ac2748329608b700fc90f46f555) Thanks [@igaming-bulochka](https://github.com/igaming-bulochka)! - Add: `HorizontalReel` + `HorizontalReelBuilder` — a single one-row, sideways reel
8
+ for the "these symbols pay this round" banner above the reels. It reuses the
9
+ engine's own contract, so there is nothing incompatible to learn: `spin()`
10
+ returns a promise, `setResult(symbols)` takes the same `ColumnTarget[]` as
11
+ `ReelSet` (one entry — this reel is a single column), and the promise resolves
12
+ with the engine's `SpinResult`. `skipSpin()`, `isSpinning`, and the `spin:start`
13
+ / `spin:complete` events all mirror `ReelSet`. `cascade(winners, newIds?)` runs
14
+ a real tumble one row wide: the winning symbols are removed, the survivors
15
+ collapse to close the gaps, and new symbols slide in from the feed side to
16
+ refill. Built on the shared symbol pool / `TickerRef` / `EventEmitter`
17
+ primitives, cleaned up via `destroy()`.
18
+
3
19
  ## 1.1.0
4
20
 
5
21
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- const e=require(`./ReelSymbol-BxoiwQ-r.cjs`);let t=require(`pixi.js`);var n=class{_listeners=new Map;on(e,t,n){return this._add(e,t,n,!1)}once(e,t,n){return this._add(e,t,n,!0)}off(e,t,n){let r=this._listeners.get(e);if(!r)return this;if(!t)return this._listeners.delete(e),this;let i=r.filter(e=>e.fn!==t||n!==void 0&&e.context!==n);return i.length===0?this._listeners.delete(e):this._listeners.set(e,i),this}emit(e,...t){let n=this._listeners.get(e);if(!n||n.length===0)return!1;let r=n.slice();for(let n of r)n.once&&this._removeEntry(e,n),n.fn.apply(n.context,t);return!0}_removeEntry(e,t){let n=this._listeners.get(e);if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===0&&this._listeners.delete(e))}removeAllListeners(e){return e===void 0?this._listeners.clear():this._listeners.delete(e),this}listenerCount(e){return this._listeners.get(e)?.length??0}_add(e,t,n,r){let i=this._listeners.get(e);return i||(i=[],this._listeners.set(e,i)),i.push({fn:t,context:n,once:r}),this}},r=class{_symbolHeight;_symbolGapY;_slotHeight;_minY;_maxY;constructor(e,t,n,r,i,a,o){this._symbols=e,this._bufferAbove=r,this._onSymbolWrapped=o,this._symbolHeight=t,this._symbolGapY=n,this._slotHeight=t+n,this._maxY=(i+a)*this._slotHeight,this._minY=-(this._bufferAbove+1)*this._slotHeight}displace(e){if(e!==0){for(let t of this._symbols)t.view.y+=e;e>0?this._wrapBottomToTop():this._wrapTopToBottom()}}snapToGrid(){for(let e=0;e<this._symbols.length;e++){let t=(e-this._bufferAbove)*this._slotHeight;this._symbols[e].view.y=t}}setToTopPosition(){for(let e=0;e<this._symbols.length;e++)this._symbols[e].view.y=this._minY-(this._symbols.length-e)*this._slotHeight}getRowY(e){return(e-this._bufferAbove)*this._slotHeight}get slotHeight(){return this._slotHeight}reshape(e,t,n,r,i){this._symbolHeight=e,this._symbolGapY=t,this._slotHeight=e+t,this._bufferAbove=n,this._maxY=(r+i)*this._slotHeight,this._minY=-(this._bufferAbove+1)*this._slotHeight}_wrapBottomToTop(){let e=this._symbols.length-1,t=this._symbols[e];if(t.view.y<this._maxY)return;let n=this._symbols[0];t.view.y=n.view.y-this._slotHeight,this._symbols.pop(),this._symbols.unshift(t),this._onSymbolWrapped(t,0,`up`)}_wrapTopToBottom(){let e=this._symbols[0];if(e.view.y>this._minY)return;let t=this._symbols[this._symbols.length-1];e.view.y=t.view.y+this._slotHeight,this._symbols.shift(),this._symbols.push(e),this._onSymbolWrapped(e,this._symbols.length-1,`down`)}},i=class{_frame=[];_remaining=0;setFrame(e){this._frame=[...e],this._remaining=this._frame.length}next(){return this._remaining>0?(this._remaining--,this._frame[this._remaining]):this._frame[0]??``}get hasRemaining(){return this._remaining>0}get remaining(){return this._remaining}reset(){this._frame=[],this._remaining=0}},a=class{name=`standard`;computeDeltaY(e,t,n){let r=e*t*n/1e3,i=e/2;return Math.max(Math.min(r,i),-i)}},o=100,s=class extends e.t{onActivate(){this.view.alpha=0,this.view.visible=!1}onDeactivate(){}async playWin(){}stopAnimation(){}resize(){}},c=`__pixi_reels_occupied__`,l=class{container;events;reelIndex;symbols;speed=0;spinningMode=new a;motion;stopSequencer;_symbolFactory;_randomProvider;_viewport;_symbolsData;_visibleRows;_bufferAbove;_symbolWidth;_symbolHeight;_offsetY;_reelHeight;_spinSymbolHeight;_symbolGapY;_symbolGapX;_isDestroyed=!1;_isStopping=!1;_isNudging=!1;_nudgeQueue=null;_nudgeTween=null;_nudgeReject=null;_occupiedStubs=[];_occupancy=[];_crossReelResolver=null;constructor(e,a,o,s){this.reelIndex=e.reelIndex,this._symbolFactory=a,this._randomProvider=o,this._viewport=s,this._symbolsData=e.symbolsData,this._visibleRows=e.visibleRows,this._bufferAbove=e.bufferAbove,this._symbolWidth=e.symbolWidth,this._symbolHeight=e.symbolHeight,this._offsetY=e.offsetY??0,this._reelHeight=e.reelHeight??e.visibleRows*e.symbolHeight,this._spinSymbolHeight=e.spinSymbolHeight??e.symbolHeight,this._symbolGapY=e.symbolGapY,this._symbolGapX=e.symbolGapX,this._occupancy=Array(e.visibleRows).fill(null),this.events=new n,this.stopSequencer=new i,this.container=new t.Container,this.container.sortableChildren=!0,this.container.x=e.reelIndex*(e.symbolWidth+e.symbolGapX),this.container.y=this._offsetY,this.container.zIndex=e.reelIndex,this.symbols=e.initialSymbols.map((t,n)=>{let r=a.acquire(t);return r.resize(e.symbolWidth,this._spinSymbolHeight),r}),this.motion=new r(this.symbols,this._spinSymbolHeight,e.symbolGapY,e.bufferAbove,e.visibleRows,e.bufferBelow,(e,t,n)=>this._onSymbolWrapped(e,t,n)),this._setupSymbolPositions(e)}get isDestroyed(){return this._isDestroyed}get isStopping(){return this._isStopping}set isStopping(e){this._isStopping=e}get isNudging(){return this._isNudging}get bufferAbove(){return this._bufferAbove}get bufferBelow(){return this.symbols.length-this._bufferAbove-this._visibleRows}get visibleRows(){return this._visibleRows}get symbolWidth(){return this._symbolWidth}get symbolHeight(){return this._symbolHeight}get reelHeight(){return this._reelHeight}get offsetY(){return this._offsetY}get spinSymbolHeight(){return this._spinSymbolHeight}update(e){if(this.speed===0)return;let t=Math.min(e,o),n=this.spinningMode.computeDeltaY(this.motion.slotHeight,this.speed,t);n!==0&&this.motion.displace(n)}setStopFrame(e){this.stopSequencer.setFrame(e)}getVisibleSymbols(){let e=[];for(let t=0;t<this._visibleRows;t++){let n=this._occupancy[t];if(n){let t=this.symbols[this._bufferAbove+n.anchorRow];e.push(t.symbolId)}else{let n=this.symbols[this._bufferAbove+t].symbolId;n===`__pixi_reels_occupied__`&&this._crossReelResolver?e.push(this._crossReelResolver(this.reelIndex,t)):e.push(n)}}return e}setCrossReelResolver(e){this._crossReelResolver=e}getSymbolAt(e){let t=this._occupancy[e],n=t?t.anchorRow:e;return this.symbols[this._bufferAbove+n]}getAnchorRow(e){let t=this._occupancy[e];return t?t.anchorRow:e}_setOccupancy(e,t){t===null?this._occupancy[e]=null:this._occupancy[e]={anchorRow:t}}notifySpinStart(){for(let e=this._bufferAbove;e<this._bufferAbove+this._visibleRows;e++)this.symbols[e].onReelSpinStart()}notifySpinEnd(){for(let e=this._bufferAbove;e<this._bufferAbove+this._visibleRows;e++)this.symbols[e].onReelSpinEnd()}notifyLanded(){for(let e=this._bufferAbove;e<this._bufferAbove+this._visibleRows;e++)this.symbols[e].onReelLanded()}snapToGrid(){this.motion.snapToGrid(),this._finalizeFrame(),this.refreshZIndex()}setSymbolAt(e,t){if(this.speed!==0||this._isStopping||this._isNudging)throw Error(`setSymbolAt: cannot swap mid-motion (speed=${this.speed}, isStopping=${this._isStopping}, isNudging=${this._isNudging}). Wait for the spin or nudge to land before calling, or use the result grid via setResult().`);if(!Number.isInteger(e)||e<0||e>=this._visibleRows)throw Error(`setSymbolAt: visibleRow ${e} is out of range [0, ${this._visibleRows}).`);if(!Object.prototype.hasOwnProperty.call(this._symbolsData,t))throw Error(`setSymbolAt: symbolId '${t}' is not registered. Register it via builder.symbols(...).`);let n=this._occupancy[e];if(n)throw Error(`setSymbolAt: visible row ${e} is a non-anchor cell of a big symbol (anchor at row ${n.anchorRow}). Use placeSymbols to rebuild the frame.`);let r=this._bufferAbove+e,i=this.symbols[r],a=this._symbolsData[i.symbolId];if(a?.size&&(a.size.w>1||a.size.h>1))throw Error(`setSymbolAt: row ${e} currently holds the anchor of big symbol '${i.symbolId}' (${a.size.w}x${a.size.h}). Big blocks span multiple cells (and possibly reels); use placeSymbols + the OCCUPIED coordinator instead.`);let o=this._symbolsData[t];if(o?.size&&(o.size.w>1||o.size.h>1))throw Error(`setSymbolAt: '${t}' is a big symbol (${o.size.w}x${o.size.h}). Use placeSymbols + the OCCUPIED coordinator instead.`);this._replaceSymbol(r,t)}async nudge(t,n){if(this._isDestroyed)throw Error(`nudge: reel has been destroyed.`);if(this.speed!==0||this._isStopping||this._isNudging)throw Error(`nudge: cannot nudge a reel in motion (speed=${this.speed}, isStopping=${this._isStopping}, isNudging=${this._isNudging}). Wait for the spin or previous nudge to land first.`);let{distance:r,direction:i,incoming:a,signal:o}=t;if(!Number.isInteger(r)||r<1)throw Error(`nudge: distance must be a positive integer, got ${r}.`);let c=this.symbols.length;if(r>=c)throw Error(`nudge: distance ${r} must be strictly less than total strip capacity (bufferAbove + visibleRows + bufferBelow = ${c}). At distance = total the strip rotates fully and pre-placed buffer entries would be silently dropped.`);if(i!==`up`&&i!==`down`)throw Error(`nudge: direction must be 'up' or 'down', got ${String(i)}.`);if(!Array.isArray(a)||a.length!==r)throw Error(`nudge: incoming must be an array of exactly ${r} symbol id(s), got length ${a?.length}.`);for(let e of a){if(!Object.prototype.hasOwnProperty.call(this._symbolsData,e))throw Error(`nudge: incoming symbol '${e}' is not registered. Register it via builder.symbols(...).`);let t=this._symbolsData[e];if(t?.size&&(t.size.w>1||t.size.h>1))throw Error(`nudge: incoming symbol '${e}' is a big symbol (${t.size.w}x${t.size.h}). Big symbols are not supported as incoming items (they need an anchor + OCCUPIED coordinator). Pre-existing big symbols on the strip CAN be nudged through.`)}for(let e=0;e<c;e++){let t=this.symbols[e];if(t instanceof s)continue;let n=this._symbolsData[t.symbolId];if(!n?.size)continue;let{w:a,h:o}=n.size;if(!(a===1&&o===1)){if(a>1)throw Error(`nudge: reel ${this.reelIndex} carries cross-reel big symbol '${t.symbolId}' (${a}x${o}) at strip[${e}]. Cross-reel blocks can't be nudged from a single reel. the other-reel cells would stay put and split the block.`);if(o>1&&!(i===`down`?e+o-1+r<c:e-r>=0)){let n=i===`down`?`anchor + h + distance < total (${e} + ${o} + ${r} = ${e+o+r} vs ${c})`:`anchor - distance >= 0 (${e} - ${r} = ${e-r})`;throw Error(`nudge: block '${t.symbolId}' (${a}x${o}) at strip[${e}] wouldn't survive a distance=${r} ${i} nudge. the wrap boundary would split the anchor from its stubs. Block survival: ${n}.`)}}}for(let e=0;e<this._visibleRows;e++)if(this.symbols[this._bufferAbove+e].symbolId===`__pixi_reels_occupied__`&&!this._occupancy[e])throw Error(`nudge: visible row ${e} is a non-anchor cell of a cross-reel big symbol. Cross-reel blocks can't be nudged from a single reel.`);if(o?.aborted){let e=Error(`nudge: aborted before start.`);throw e.name=`AbortError`,e}let l=t.startDelay??0;if(l>0&&(await new Promise((e,t)=>{let n=setTimeout(e,l);o&&o.addEventListener(`abort`,()=>{clearTimeout(n);let e=Error(`nudge: aborted during startDelay.`);e.name=`AbortError`,t(e)},{once:!0})}),this._isDestroyed)){let e=Error(`nudge: reel destroyed during startDelay.`);throw e.name=`AbortError`,e}let u=t.duration??200*r,d=t.ease??`power2.out`,f=this.motion.slotHeight,p=this._bufferAbove,m=this.bufferBelow,h=e=>{let t=this.symbols[e];if(t instanceof s)return!0;let n=this._symbolsData[t.symbolId];return!!(n?.size&&(n.size.w>1||n.size.h>1))};if(i===`down`){let e=Math.min(r,p);for(let t=0;t<e;t++){let n=p-e+t,i=r-e+t;h(n)||this._replaceSymbol(n,a[i])}let t=[],n=r-p;for(let e=1;e<=r;e++)e<=n?t.push(a[n-e]):t.push(this._randomProvider.next(!0));this._nudgeQueue=t}else{let e=Math.min(r,m);for(let t=0;t<e;t++){let e=p+this._visibleRows+t;h(e)||this._replaceSymbol(e,a[t])}let t=[],n=r-m;for(let e=1;e<=r;e++)e<=n?t.push(a[m+e-1]):t.push(this._randomProvider.next(!0));this._nudgeQueue=t}this.motion.snapToGrid(),this.refreshZIndex(),this._isNudging=!0,this.events.emit(`phase:enter`,`nudge`),n?.();let g=i===`down`?r*f:-r*f,_=f*.45,v=()=>{let e=this._nudgeQueue?.length??0;if(e>0){let t=e,n=i===`down`?_:-_;for(let e=0;e<t*3&&(this._nudgeQueue?.length??0)>0;e++)this.motion.displace(n)}this.snapToGrid(),this._isNudging=!1,this._nudgeQueue=null,this._nudgeTween=null,this._nudgeReject=null,this.events.emit(`phase:exit`,`nudge`)};try{await new Promise((t,n)=>{this._nudgeReject=n;let r=()=>{this._nudgeTween&&=(this._nudgeTween.kill(),null),v();let e=Error(`nudge: aborted.`);e.name=`AbortError`,n(e)};o&&o.addEventListener(`abort`,r,{once:!0});let a={p:0},s=0;this._nudgeTween=e.n().to(a,{p:1,duration:u/1e3,ease:d,onUpdate:()=>{let e=a.p*g,t=i===`down`?Math.min(e,g):Math.max(e,g),n=t-s;for(;Math.abs(n)>_;){let e=n>0?_:-_;this.motion.displace(e),n-=e}n!==0&&this.motion.displace(n),s=t},onComplete:()=>{o&&o.removeEventListener(`abort`,r),v(),t()}})})}catch(e){throw e}return{symbols:this.getVisibleSymbols()}}skipNudge(){if(!this._isNudging||!this._nudgeTween)return;let e=this._nudgeTween;this._nudgeTween=null,e.progress(1)}placeSymbols(e){let t=this.symbols.length,n=this._bufferAbove;for(let r=0;r<t;r++){let t;t=e[r-n],t===void 0&&(t=this._randomProvider.next(!0)),this._replaceSymbol(r,t)}this.motion.snapToGrid(),this._finalizeFrame(),this.refreshZIndex()}reshape(e,t,n,r){let i=n+e+r;for(;this.symbols.length<i;){let e=this._randomProvider.next(!0),n=this._symbolFactory.acquire(e);n.resize(this._symbolWidth,t),this._placeSymbolView(n.view,n.view.y,this._isUnmasked(e)),this._parentForSymbolId(e).addChild(n.view),this.symbols.push(n)}for(;this.symbols.length>i;){let e=this.symbols.pop();e instanceof s?e.view.parent?.removeChild(e.view):this._symbolFactory.release(e)}this._visibleRows=e,this._symbolHeight=t,this._bufferAbove=n,this._occupancy=Array(e).fill(null),this._reelHeight=e*t+(e-1)*this._symbolGapY;for(let e of this.symbols)e instanceof s||e.resize(this._symbolWidth,t);this.motion.reshape(t,this._symbolGapY,n,e,r),this.motion.snapToGrid(),this.refreshZIndex()}_computeSymbolZIndex(e,t){return(this._symbolsData[e]?.zIndex??0)*100+t}refreshZIndex(){for(let e=0;e<this.symbols.length;e++){let t=this.symbols[e];if(t instanceof s){t.view.zIndex=e;continue}t.view.zIndex=this._computeSymbolZIndex(t.symbolId,e)}}destroy(){if(!this._isDestroyed){if(this._nudgeTween&&=(this._nudgeTween.kill(),null),this._nudgeReject){let e=Error(`nudge: reel was destroyed.`);e.name=`AbortError`,this._nudgeReject(e),this._nudgeReject=null}this._nudgeQueue=null,this._isNudging=!1;for(let e of this.symbols)e.destroy();for(let e of this._occupiedStubs)e.isDestroyed||e.destroy();this._occupiedStubs=[],this.symbols=[],this.container.destroy({children:!0}),this._isDestroyed=!0,this.events.emit(`destroyed`),this.events.removeAllListeners()}}_isUnmasked(e){return!!this._symbolsData[e]?.unmask}_parentForSymbolId(e){return this._isUnmasked(e)?this._viewport.unmaskedContainer:this.container}_placeSymbolView(e,t,n){n?(e.x=this.container.x,e.y=this.container.y+t):(e.x=0,e.y=t)}_toReelLocalY(e){return e.parent===this._viewport.unmaskedContainer?e.y-this.container.y:e.y}_setupSymbolPositions(e){let t=this._spinSymbolHeight+e.symbolGapY;this._viewport.maskedContainer.addChild(this.container);for(let n=0;n<this.symbols.length;n++){let r=this.symbols[n],i=(n-e.bufferAbove)*t,a=this._isUnmasked(r.symbolId);this._placeSymbolView(r.view,i,a),this._parentForSymbolId(r.symbolId).addChild(r.view)}}_onSymbolWrapped(e,t,n){let r;r=this._nudgeQueue&&this._nudgeQueue.length>0?this._nudgeQueue.shift():this._isStopping&&this.stopSequencer.hasRemaining?this.stopSequencer.next():this._randomProvider.next(),this._replaceSymbol(this.symbols.indexOf(e),r),this._isNudging||this.refreshZIndex()}_replaceSymbol(e,t){let n=this.symbols[e],r=n instanceof s,i=r?n.view.y:this._toReelLocalY(n.view);if(t===`__pixi_reels_occupied__`){if(r){n.view.alpha=0;return}this._symbolFactory.release(n);let t=this._acquireOccupiedStub();t.view.y=i,t.view.x=0,t.view.alpha=0,t.view.visible=!0,t.view.scale.set(1,1),t.view.zIndex=e,t.view.parent!==this.container&&this.container.addChild(t.view),this.symbols[e]=t;return}if(r){this._releaseOccupiedStub(n);let r=this._symbolFactory.acquire(t),a=this._isUnmasked(t);r.resize(this._symbolWidth,this._symbolHeight),this._placeSymbolView(r.view,i,a),r.view.alpha=1,r.view.scale.set(1,1),r.view.zIndex=this._computeSymbolZIndex(t,e),this._parentForSymbolId(t).addChild(r.view),this.symbols[e]=r,this.events.emit(`symbol:created`,t,e);return}if(n.symbolId===t){n.view.alpha=1,n.view.scale.set(1,1),n.view.rotation=0,n.view.filters=null,n.view.zIndex=this._computeSymbolZIndex(t,e);let r=this._parentForSymbolId(t);n.view.parent!==r&&r.addChild(n.view),this._placeSymbolView(n.view,i,this._isUnmasked(t));return}this._symbolFactory.release(n);let a=this._symbolFactory.acquire(t),o=this._isUnmasked(t);a.resize(this._symbolWidth,this._symbolHeight),this._placeSymbolView(a.view,i,o),a.view.alpha=1,a.view.scale.set(1,1),a.view.zIndex=this._computeSymbolZIndex(t,e),this._parentForSymbolId(t).addChild(a.view),this.symbols[e]=a,this.events.emit(`symbol:created`,t,e)}_acquireOccupiedStub(){for(let e of this._occupiedStubs)if(!e.view.parent)return e;let e=new s;return e.activate(c),this._occupiedStubs.push(e),e}_releaseOccupiedStub(e){e.view.parent?.removeChild(e.view)}_finalizeFrame(){this._occupancy=Array(this._visibleRows).fill(null);for(let e=0;e<this._visibleRows;e++){let t=this.symbols[this._bufferAbove+e];if(t instanceof s)continue;let n=this._symbolsData[t.symbolId];if(!n?.size)continue;let r=n.size.w,i=n.size.h;if(r===1&&i===1)continue;let a=r*this._symbolWidth+(r-1)*this._symbolGapX,o=i*this._symbolHeight+(i-1)*this._symbolGapY;t.resize(a,o);for(let t=1;t<i;t++){let n=e+t;n<this._visibleRows&&(this._occupancy[n]={anchorRow:e})}}for(let e=0;e<this._bufferAbove;e++){let t=this.symbols[e];if(t instanceof s)continue;let n=this._symbolsData[t.symbolId];if(!n?.size)continue;let r=n.size.w,i=n.size.h;if(r===1&&i===1||e+i-1<this._bufferAbove)continue;let a=r*this._symbolWidth+(r-1)*this._symbolGapX,o=i*this._symbolHeight+(i-1)*this._symbolGapY;t.resize(a,o);let c=e-this._bufferAbove;for(let e=1;e<i;e++){let t=c+e;t>=0&&t<this._visibleRows&&(this._occupancy[t]={anchorRow:c})}}}},u=class{build(e,n,r){let i=new t.Graphics;return this._draw(i,e,n,r),i}update(e,t,n,r){e.clear(),this._draw(e,t,n,r)}_draw(e,t,n,r){if(t.length===0){e.rect(0,0,n,r).fill({color:16777215});return}for(let n of t)e.rect(n.x,n.y,n.width,n.height).fill({color:16777215})}},d=class{build(e,n,r){let i=new t.Graphics;return this._draw(i,e,n,r),i}update(e,t,n,r){e.clear(),this._draw(e,t,n,r)}_draw(e,t,n,r){e.rect(0,0,n,r).fill({color:16777215})}},f=class extends t.Container{maskedContainer;unmaskedContainer;spotlightContainer;dimOverlay;_mask;_maskStrategy;_maskWidth;_maskHeight;_maskRects=[];_isDestroyed=!1;_dimCount=0;constructor(e,n,r={x:0,y:0},i=new u){super(),this.x=r.x,this.y=r.y,this._maskStrategy=i,this._maskWidth=e,this._maskHeight=n,this._mask=this._maskStrategy.build(this._maskRects,e,n),this.maskedContainer=new t.Container,this.maskedContainer.sortableChildren=!0,this.maskedContainer.addChild(this._mask),this.maskedContainer.mask=this._mask,this.addChild(this.maskedContainer),this.unmaskedContainer=new t.Container,this.unmaskedContainer.sortableChildren=!0,this.addChild(this.unmaskedContainer),this.dimOverlay=new t.Graphics,this.dimOverlay.rect(0,0,e,n).fill({color:0,alpha:.5}),this.dimOverlay.visible=!1,this.addChild(this.dimOverlay),this.spotlightContainer=new t.Container,this.spotlightContainer.sortableChildren=!0,this.addChild(this.spotlightContainer)}get maskWidth(){return this._maskWidth}get maskHeight(){return this._maskHeight}get maskRects(){return this._maskRects}get maskGraphics(){return this._mask}get isDestroyed(){return this._isDestroyed}showDim(e=.5){this._dimCount++,this.dimOverlay.alpha=e,this.dimOverlay.visible=!0}hideDim(){this._dimCount>0&&this._dimCount--,this._dimCount===0&&(this.dimOverlay.visible=!1)}updateMaskSize(e,t,n=[]){this._maskWidth=e,this._maskHeight=t,this._maskRects=n,this._maskStrategy.update(this._mask,this._maskRects,e,t)}destroy(){this._isDestroyed||(this._isDestroyed=!0,super.destroy({children:!0}))}},p=class{_reel;_speed;_resolve=null;_isActive=!1;constructor(e,t){this._reel=e,this._speed=t}get reel(){return this._reel}get isActive(){return this._isActive}async run(e){return this._isActive=!0,this._reel.events.emit(`phase:enter`,this.name),new Promise(t=>{this._resolve=()=>{this._isActive=!1,this._reel.events.emit(`phase:exit`,this.name),t()},this.onEnter(e)})}skip(){!this.skippable||!this._isActive||(this.onSkip(),this._complete())}forceComplete(){this._isActive&&(this.onSkip(),this._complete())}_complete(){if(this._resolve){let e=this._resolve;this._resolve=null,e()}}},m=class extends p{name=`start`;skippable=!0;_tween=null;_delayedCall=null;onEnter(t){let n=this._reel;this._speed;let r=t.delay??0;n.spinningMode=t.spinningMode,n.speed=0,r>0?this._delayedCall=e.n().delayedCall(r/1e3,()=>this._launch()):this._launch()}_launch(){this._delayedCall=null;let t=this._reel,n=this._speed,r=(n.accelerationDuration??300)/1e3,i=n.accelerationEase??`power2.in`;this._tween=e.n().timeline(),n.bounceDistance>0&&this._tween.to(t,{speed:-2,duration:.05,ease:`power1.out`}),this._tween.to(t,{speed:n.spinSpeed,duration:r,ease:i,onComplete:()=>{t.notifySpinStart(),this._complete()}})}update(e){}onSkip(){this._kill(),this._reel.speed=this._speed.spinSpeed}_kill(){this._delayedCall&&=(this._delayedCall.kill(),null),this._tween&&=(this._tween.kill(),null)}},h=class extends p{name=`spin`;skippable=!1;_elapsed=0;_minTime=0;_readyToStop=!1;onEnter(e){this._elapsed=0,this._minTime=e.minimumSpinTime??this._speed.minimumSpinTime??500,this._readyToStop=!1}update(e){this._elapsed+=e,this._readyToStop&&this._elapsed>=this._minTime&&this._complete()}resolve(){this._readyToStop=!0,this._elapsed>=this._minTime&&this._complete()}onSkip(){}},g=class extends p{name=`stop`;skippable=!0;_config=null;_delayTween=null;_bounceTween=null;_stage=`delay`;_baseY=0;onEnter(t){this._config=t,this._stage=`delay`,this._baseY=this._reel.container.y;let n=(t.delay??0)/1e3;n>0?this._delayTween=e.n().delayedCall(n,()=>this._beginSpinOut()):this._beginSpinOut()}_beginSpinOut(){if(!this._config)return;let e=this._reel,t=this._speed;e.setStopFrame(this._config.targetFrame),e.isStopping=!0,e.speed=t.spinSpeed,this._stage=`spinning`}update(e){this._stage===`spinning`&&(this._reel.stopSequencer.hasRemaining||this._landAndBounce())}_landAndBounce(){let t=this._reel,n=this._speed;t.speed=0,t.isStopping=!1,t.snapToGrid(),t.notifySpinEnd(),t.notifyLanded();let r=n.bounceDistance;if(r<=0){this._stage=`done`,this._complete();return}let i=(n.bounceDuration??600)/2e3;this._stage=`bouncing`,this._bounceTween=e.n().timeline(),this._bounceTween.to(t.container,{y:this._baseY+r,duration:i,ease:`power1.out`}),this._bounceTween.to(t.container,{y:this._baseY,duration:i,ease:`power1.out`,onComplete:()=>{this._stage=`done`,this._complete()}})}onSkip(){this._killTweens();let e=this._reel;if(e.speed=0,e.isStopping=!1,this._stage!==`done`&&this._config){let t=e.bufferAbove,n=this._config.targetFrame,r=n.slice(t);for(let e=0;e<t;e++)r[e-t]=n[e];e.placeSymbols(r)}e.snapToGrid(),e.container.y=this._baseY,this._stage=`done`}_killTweens(){this._delayTween&&=(this._delayTween.kill(),null),this._bounceTween&&=(this._bounceTween.kill(),null)}},_=class extends p{name=`anticipation`;skippable=!0;_tween=null;onEnter(t){let n=this._reel,r=this._speed,i=(t.duration??r.anticipationDelay)/1e3,a=r.spinSpeed*(t.speedMultiplier??.3);if(i<=0){this._complete();return}this._tween=e.n().timeline(),this._tween.to(n,{speed:a,duration:i*.35,ease:`power2.out`}),this._tween.to({},{duration:i*.65,onComplete:()=>this._complete()})}update(e){}onSkip(){this._kill(),this._reel.speed=this._speed.spinSpeed}_kill(){this._tween&&=(this._tween.kill(),null)}},v=class{_registry=new Map;constructor(){this._registry.set(`start`,(e,t)=>new m(e,t)),this._registry.set(`spin`,(e,t)=>new h(e,t)),this._registry.set(`stop`,(e,t)=>new g(e,t)),this._registry.set(`anticipation`,(e,t)=>new _(e,t))}register(e,t){this._registry.set(e,(e,n)=>new t(e,n))}registerFactory(e,t){this._registry.set(e,t)}create(e,t,n){let r=this._registry.get(e);if(!r)throw Error(`Phase '${e}' not registered. Available: ${[...this._registry.keys()].join(`, `)}`);return r(t,n)}has(e){return this._registry.has(e)}},y=class{_callbacks=[];_isDestroyed=!1;constructor(e){this._ticker=e}get isDestroyed(){return this._isDestroyed}add(e){this._isDestroyed||(this._callbacks.push(e),this._ticker.add(e))}remove(e){let t=this._callbacks.indexOf(e);t!==-1&&(this._callbacks.splice(t,1),this._ticker.remove(e))}destroy(){if(!this._isDestroyed){for(let e of this._callbacks)this._ticker.remove(e);this._callbacks.length=0,this._isDestroyed=!0}}};function b(e){let t=[...e.visible];if(e.bufferBelow)for(let n=0;n<e.bufferBelow.length;n++){let r=e.bufferBelow[n];r!==void 0&&(t[e.visible.length+n]=r)}if(e.bufferAbove)for(let n=0;n<e.bufferAbove.length;n++){let r=e.bufferAbove[n];r!==void 0&&(t[-1-n]=r)}return t}function x(e,t,n,r){for(let i=0;i<e.length;i++){let a=t[i]??0,o=n[i]??0,s=e[i],c=S(s.bufferAbove),l=S(s.bufferBelow);if(c>=a)throw RangeError(`${r} column ${i}: bufferAbove has a symbol at index ${c}, beyond engine bufferSymbols=${a}; it would be silently dropped. Increase bufferSymbols(...) on the builder or remove the extra entry.`);if(l>=o)throw RangeError(`${r} column ${i}: bufferBelow has a symbol at index ${l}, beyond engine bufferSymbols=${o}; it would be silently dropped. Increase bufferSymbols(...) on the builder or remove the extra entry.`)}}function S(e){if(!e)return-1;for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return t;return-1}var C=class{_reels;_speedManager;_frameBuilder;_phaseFactory;_events;_tickerRef;_spinningMode;_defaultSpinMode;_currentSpinMode=`standard`;_hooks;_isSpinning=!1;_spinStartTime=0;_resultSymbols=null;_anticipationReels=[];_stopDelayOverride=null;_activePhases=new Map;_landedReels=new Set;_heldReels=new Set;_wasSkipped=!1;_skipPending=!1;_isDestroyed=!1;_currentSpinResolve=null;_currentSpinReject=null;_pendingAbortError=null;_spinWatchdogCleanup=null;_spinGeneration=0;_skipStage=0;_skipPreviousSpeedName=null;_skipBoostedToName=null;_manualSpeedSinceBoost=!1;_autoSlamRefills=!1;constructor(e,t,n,r,i,o,s,c=`standard`,l){this._reels=e,this._speedManager=t,this._frameBuilder=n,this._phaseFactory=r,this._events=i,this._tickerRef=new y(o),this._spinningMode=s??new a,this._defaultSpinMode=c,this._hooks=l??{isMultiWaysSlot:!1,symbolsData:{},peekTargetShape:()=>null,clearTargetShape:()=>{},multiwaysReelPixelHeight:0,symbolGapY:0,getPinsOnReel:()=>[],migratePinsForReel:()=>[],refreshPinOverlaysForReel:()=>{},buildPinOverlayTweens:()=>[]},this._tickerRef.add(e=>this._onTick(e))}get isSpinning(){return this._isSpinning}get isDestroyed(){return this._isDestroyed}get skipStage(){return this._skipStage}async spin(e){if(this._isSpinning)throw Error(`Cannot start a new spin while one is in progress.`);if(e?.signal?.aborted)return Promise.reject(this._abortError(e.signal));let t=e?.mode??this._defaultSpinMode;if(t===`cascade`&&!this._phaseFactory.has(`cascade:fall`))throw Error(`spin({ mode: 'cascade' }) requires .tumble(...) on the builder.`);if(this._currentSpinMode=t,this._skipPreviousSpeedName!==null){let e=this._skipPreviousSpeedName;this._skipPreviousSpeedName=null,this._skipBoostedToName=null,!this._manualSpeedSinceBoost&&this._speedManager.activeName!==e&&this._speedManager.set(e)}this._manualSpeedSinceBoost=!1,this._skipStage=0,this._autoSlamRefills=!1,this._isSpinning=!0,this._wasSkipped=!1,this._skipPending=!1,this._pendingAbortError=null,this._spinStartTime=performance.now(),this._resultSymbols=null,this._anticipationReels=[],this._landedReels.clear(),this._activePhases.clear(),this._heldReels=this._normalizeHoldReels(e?.holdReels),this._spinGeneration++;let n=this._spinGeneration,r=this._speedManager.active;this._events.emit(`spin:start`);let i=new Promise((e,t)=>{this._currentSpinResolve=e,this._currentSpinReject=t});if(this._armSpinWatchdog(e,n),this._heldReels.size===this._reels.length)return Promise.resolve().then(()=>{n===this._spinGeneration&&this._finishSpin()}),i;for(let e=0;e<this._reels.length;e++)this._heldReels.has(e)||this._runReelTask(this._startReel(e,r,n),`spin`,e,n);return i}_runReelTask(e,t,n,r){e.catch(e=>{r===this._spinGeneration&&(console.error(`[pixi-reels] reel ${n} (${t}) phase chain threw. slamming to recover:`,e),this._slam())})}_normalizeHoldReels(e){let t=new Set;if(!e)return t;for(let n of e)Number.isInteger(n)&&n>=0&&n<this._reels.length&&t.add(n);return t}setResult(e){this._isSpinning&&(this._coordinateBigSymbols(e,e=>{let t=this._hooks.peekTargetShape();return t?t[e]:this._reels[e].visibleRows}),this._resultSymbols=e,this._tryBeginStopSequence(),this._skipPending&&(this._skipPending=!1,this._slam(),this._skipStage=2))}async refill(e){if(this._isSpinning)throw Error(`Cannot refill while a spin or refill is in progress.`);if(!this._phaseFactory.has(`cascade:place`))throw Error(`refill() requires .tumble(...) on the builder.`);let t=e.grid.map(b);if(t.length!==this._reels.length)throw RangeError(`refill: grid has ${t.length} column(s) but the reel set has ${this._reels.length}.`);for(let e=0;e<t.length;e++){let n=this._reels[e].visibleRows;if(t[e].length!==n)throw RangeError(`refill: grid column ${e} has ${t[e].length} row(s) but reel ${e} has ${n} visible row(s).`)}for(let t of e.winners){if(!Number.isInteger(t.reel)||t.reel<0||t.reel>=this._reels.length)throw RangeError(`refill: winner.reel ${t.reel} out of range [0, ${this._reels.length}).`);let e=this._reels[t.reel].visibleRows;if(!Number.isInteger(t.row)||t.row<0||t.row>=e)throw RangeError(`refill: winner.row ${t.row} out of range [0, ${e}) for reel ${t.reel}.`)}this._isSpinning=!0,this._wasSkipped=!1,this._skipPending=!1,this._pendingAbortError=null,this._spinStartTime=performance.now(),this._resultSymbols=null,this._anticipationReels=[],this._landedReels.clear(),this._activePhases.clear(),this._heldReels=new Set,this._spinGeneration++,this._currentSpinMode=`cascade`;let n=this._spinGeneration,r=this._speedManager.active;this._resultSymbols=t;let i=this._coordinateBigSymbols(t,e=>this._reels[e].visibleRows),a=[];for(let e=0;e<this._reels.length;e++){let t=this._reels[e];a.push(this._frameBuilder.build(e,t.visibleRows,t.bufferAbove,t.bufferBelow,i[e]))}this._cachedFrames=a;let o=new Map;for(let t of e.winners){let e=o.get(t.reel);e||(e=[],o.set(t.reel,e)),e.push(t.row)}for(let e of o.values())e.sort((e,t)=>e-t);this._events.emit(`spin:start`);let s=new Promise(e=>{this._currentSpinResolve=e,this._currentSpinReject=null});if(this._autoSlamRefills)return this._slam(),this._skipStage=2,s;if((e.mode??`combined`)===`gravity-then-drop`){let t=e.gravityHoldMs??250;this._refillTwoStage(r,n,o,t,e.gravityHold,e.onGravityComplete).catch(e=>{n===this._spinGeneration&&(this._events.emit(`cascade:gravity:error`,{error:e}),console.error(`[pixi-reels] two-stage refill threw (likely from a user-supplied gravityHold/onGravityComplete). slamming to recover:`,e),this._slam())})}else for(let e=0;e<this._reels.length;e++){let t=o.get(e)??[];this._runReelTask(this._refillReel(e,r,n,t),`refill`,e,n)}return s}async _refillReel(e,t,n,r){if(n!==this._spinGeneration)return;let i=this._reels[e],a=this._frameFor(e),o=this._stopDelayFor(e,t),s=this._phaseFactory.create(`cascade:place`,i,t);if(this._activePhases.set(e,s),await s.run({targetFrame:a,winnerRows:r,initial:!1,delay:o,events:this._events}),n!==this._spinGeneration)return;let c=this._phaseFactory.create(`cascade:dropIn`,i,t);this._activePhases.set(e,c),await c.run({winnerRows:r,initial:!1,events:this._events}),n===this._spinGeneration&&this._markLanded(e)}async _refillTwoStage(e,t,n,r,i,a){let o=this._reels.map(async(r,i)=>{if(t!==this._spinGeneration)return;let a=this._reels[i],o=this._frameFor(i),s=n.get(i)??[],c=this._phaseFactory.create(`cascade:place`,a,e);if(this._activePhases.set(i,c),await c.run({targetFrame:o,winnerRows:s,initial:!1,delay:0,events:this._events}),t!==this._spinGeneration)return;let l=this._phaseFactory.create(`cascade:dropIn`,a,e);this._activePhases.set(i,l),await l.run({winnerRows:s,initial:!1,role:`gravity`,events:this._events})});if(await Promise.all(o),t!==this._spinGeneration)return;let s=[];if(r>0&&s.push(new Promise(e=>setTimeout(e,r))),i&&s.push(typeof i==`function`?i():i),!(s.length>0&&(await Promise.all(s),t!==this._spinGeneration))&&!(a&&(await a(),t!==this._spinGeneration)))for(let r=0;r<this._reels.length;r++)this._runReelTask(this._refillReelDropInOnly(r,e,t,n.get(r)??[]),`refill`,r,t)}async _refillReelDropInOnly(e,t,n,r){if(n!==this._spinGeneration)return;let i=this._reels[e],a=this._stopDelayFor(e,t);if(a>0&&(await new Promise(e=>setTimeout(e,a)),n!==this._spinGeneration))return;let o=this._phaseFactory.create(`cascade:dropIn`,i,t);this._activePhases.set(e,o),await o.run({winnerRows:r,initial:!1,role:`new`,events:this._events}),n===this._spinGeneration&&this._markLanded(e)}setAnticipation(e){this._anticipationReels=e.filter(e=>!this._heldReels.has(e))}setStopDelays(e){this._stopDelayOverride=[...e]}requestSkip(){if(this._isSpinning){if(this._resultSymbols){this._slam(),this._skipStage=2;return}this._skipPending=!0}}skip(){if(this._isSpinning){if(!this._resultSymbols)throw Error(`skip() called before setResult(). there is nothing to land on yet (standard mode would land on random buffer fill; cascade mode would land invisible). Use reelSet.requestSkip() to queue the slam until setResult() arrives, or wait for setResult() before calling skip().`);if(this._skipStage===0)if(this._currentSpinMode===`cascade`)this._autoSlamRefills=!0;else{let e=this._findFastestSpeedName();if(e!==null&&e!==this._speedManager.activeName){let{previous:t,current:n}=this._speedManager.set(e);this._skipPreviousSpeedName=t.name,this._skipBoostedToName=n.name,this._events.emit(`skip:boosted`,{previous:t,current:n})}}this._slam(),this._skipStage=2}}slamStop(){this._isSpinning&&(this._slam(),this._skipStage=2)}_slam(){if(this._isSpinning){this._wasSkipped=!0,this._events.emit(`skip:requested`);for(let[,e]of this._activePhases)e.forceComplete();if(this._activePhases.clear(),this._spinGeneration++,this._resultSymbols){let e=this._hooks.peekTargetShape(),t=this._coordinateBigSymbols(this._resultSymbols,t=>e?e[t]:this._reels[t].visibleRows);for(let n=0;n<this._reels.length;n++){if(this._landedReels.has(n)||this._heldReels.has(n))continue;let r=this._reels[n];r.speed=0,r.isStopping=!1,this._hooks.isMultiWaysSlot&&e&&this._applyReshape(n,e[n]),r.placeSymbols(t[n]),r.notifySpinEnd(),r.notifyLanded(),this._markLanded(n)}}else for(let e=0;e<this._reels.length;e++){if(this._landedReels.has(e)||this._heldReels.has(e))continue;let t=this._reels[e];t.speed=0,t.isStopping=!1,t.snapToGrid(),t.notifySpinEnd(),t.notifyLanded(),this._markLanded(e)}this._events.emit(`skip:completed`)}}notifyManualSpeedChange(){this._manualSpeedSinceBoost=!0}_findFastestSpeedName(){let e=this._speedManager.profileNames;if(e.length<2)return null;let t=null,n=-1/0;for(let r of e){let e=this._speedManager.getProfile(r);e&&e.spinSpeed>n&&(n=e.spinSpeed,t=r)}return t}destroy(){this._isDestroyed||=(this._clearSpinWatchdog(),this._tickerRef.destroy(),this._activePhases.clear(),!0)}_targetCellHeightFor(e,t){return this._hooks.multiwaysReelPixelHeight<=0?e.symbolHeight:(this._hooks.multiwaysReelPixelHeight-(t-1)*this._hooks.symbolGapY)/t}_applyReshape(e,t){let n=this._reels[e],r=this._targetCellHeightFor(n,t),i=n.visibleRows;return t===i&&r===n.symbolHeight?!1:(this._events.emit(`adjust:start`,{reelIndex:e,fromRows:i,toRows:t}),n.reshape(t,r,n.bufferAbove,n.bufferBelow),this._hooks.refreshPinOverlaysForReel(e),this._events.emit(`adjust:complete`,{reelIndex:e}),!0)}async _startReel(e,t,n){if(n!==this._spinGeneration)return;let r=this._reels[e],i=this._currentSpinMode===`cascade`;if(i){let n=this._phaseFactory.create(`cascade:fall`,r,t);this._activePhases.set(e,n),await n.run({spinningMode:this._spinningMode,delay:e*t.spinDelay,events:this._events})}else{let n=this._phaseFactory.create(`start`,r,t);this._activePhases.set(e,n),await n.run({spinningMode:this._spinningMode,delay:e*t.spinDelay})}if(n!==this._spinGeneration)return;let a=this._phaseFactory.create(`spin`,r,t);this._activePhases.set(e,a);let o=a.run({}),s=!0;for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e))continue;let t=this._activePhases.get(e);if(!t||t.name!==`spin`){s=!1;break}}if(s&&(this._events.emit(`spin:allStarted`),this._tryBeginStopSequence()),await o,n!==this._spinGeneration||this._hooks.isMultiWaysSlot&&this._phaseFactory.has(`adjust`)&&(await this._runAdjustForReel(r,e,t,n),n!==this._spinGeneration))return;let c=this._stopDelayFor(e,t),l=this._frameFor(e);if(this._anticipationReels.includes(e)&&t.anticipationDelay>0){this._events.emit(`spin:stopping`,e);let i=this._phaseFactory.create(`anticipation`,r,t);if(this._activePhases.set(e,i),await i.run({}),n!==this._spinGeneration)return}else this._events.emit(`spin:stopping`,e);if(i){let i=this._phaseFactory.create(`cascade:place`,r,t);if(this._activePhases.set(e,i),await i.run({targetFrame:l,winnerRows:[],initial:!0,delay:c,events:this._events}),n!==this._spinGeneration)return;let a=this._phaseFactory.create(`cascade:dropIn`,r,t);if(this._activePhases.set(e,a),await a.run({winnerRows:[],initial:!0,events:this._events}),n!==this._spinGeneration)return}else{let i=this._phaseFactory.create(`stop`,r,t);if(this._activePhases.set(e,i),await i.run({targetFrame:l,delay:c}),n!==this._spinGeneration)return}this._markLanded(e)}async _runAdjustForReel(e,t,n,r){let i=this._hooks.peekTargetShape(),a=i?i[t]:e.visibleRows,o=this._targetCellHeightFor(e,a),s=this._hooks.buildPinOverlayTweens(t,o,this._hooks.symbolGapY);if(!this._applyReshape(t,a)&&s.length===0||s.length===0)return;let c=this._phaseFactory.create(`adjust`,e,n);this._activePhases.set(t,c),await c.run({pinOverlays:s})}_stopDelayFor(e,t){return this._stopDelayOverride?this._stopDelayOverride[e]??0:e*t.stopDelay}_cachedFrames=null;_frameFor(e){return this._cachedFrames?this._cachedFrames[e]:[]}_tryBeginStopSequence(){if(!this._resultSymbols)return;for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e))continue;let t=this._activePhases.get(e);if(!t||t.name!==`spin`)return}let e=this._hooks.peekTargetShape(),t=t=>e?e[t]:this._reels[t].visibleRows,n=this._coordinateBigSymbols(this._resultSymbols,t),r=[];for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e)){r.push([]);continue}let i=this._reels[e],a=t(e);r.push(this._frameBuilder.build(e,a,i.bufferAbove,i.bufferBelow,n[e]))}this._cachedFrames=r;for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e))continue;let t=this._activePhases.get(e);t?.resolve&&t.resolve()}}_coordinateBigSymbols(e,t){let n=this._reels[0]?.bufferAbove??0,r=this._reels[0]?.bufferBelow??0,i=e.map(e=>{let t=[...e];for(let r=1;r<=n;r++){let n=e[-r];n!==void 0&&(t[-r]=n)}return t}),a=this._hooks.symbolsData,o=(e,t)=>i[e][t],s=(e,t,n)=>{let r=i[e];r[t]=n};for(let e=0;e<i.length;e++){let l=t(e);for(let u=-n;u<l+r;u++){let n=o(e,u);if(n===void 0)continue;let d=a[n];if(!d?.size)continue;let f=d.size.w,p=d.size.h;if(!(f===1&&p===1)){if(u+p>l+r)throw Error(`big symbol '${n}' (${f}x${p}) at (col=${e}, row=${u}) extends past the bottom of the strip on reel ${e} (anchor row + h = ${u+p} > visibleRows + bufferBelow = ${l+r}).`);if(e+f>i.length)throw Error(`big symbol '${n}' (${f}x${p}) at (col=${e}, row=${u}) exceeds reel count ${i.length}.`);for(let i=0;i<f;i++){let a=e+i,o=t(a);if(u+p>o+r)throw Error(`big symbol '${n}' (${f}x${p}) at (col=${e}, row=${u}) extends past the bottom of the strip on reel ${a} (anchor row + h = ${u+p} > visibleRows + bufferBelow = ${o+r}).`)}for(let t=0;t<p;t++)for(let n=0;n<f;n++)n===0&&t===0||s(e+n,u+t,c)}}}return i}_markLanded(e){if(this._landedReels.has(e))return;this._landedReels.add(e);let t=this._reels[e],n=t.getVisibleSymbols();t.events.emit(`landed`,n),this._events.emit(`spin:reelLanded`,e,n),this._landedReels.size===this._reels.length-this._heldReels.size&&this._finishSpin()}_armSpinWatchdog(e,t){this._clearSpinWatchdog();let n=e?.signal,r=e?.timeoutMs;if(!n&&(r===void 0||r<=0))return;let i=[];if(n){let e=()=>{t===this._spinGeneration&&this._abortSpin(this._abortError(n))};n.addEventListener(`abort`,e),i.push(()=>n.removeEventListener(`abort`,e))}if(r!==void 0&&r>0){let e=setTimeout(()=>{t===this._spinGeneration&&this._abortSpin(Error(`spin() exceeded its ${r}ms watchdog without landing. setResult() / requestSkip() / slamStop() was never called (most often a failed or timed-out server request). The reels have been force-stopped.`))},r);i.push(()=>clearTimeout(e))}this._spinWatchdogCleanup=()=>{for(let e of i)e()}}_clearSpinWatchdog(){this._spinWatchdogCleanup&&=(this._spinWatchdogCleanup(),null)}_abortError(e){let t=e.reason;return t instanceof Error?t:typeof t==`string`&&t.length>0?Error(t):Error(`spin() was aborted via SpinOptions.signal before the reels landed.`)}_abortSpin(e){this._isSpinning&&(this._clearSpinWatchdog(),this._pendingAbortError=e,this._slam())}_finishSpin(){this._clearSpinWatchdog();let e=this._pendingAbortError;if(e){this._pendingAbortError=null,this._isSpinning=!1,this._activePhases.clear(),this._cachedFrames=null,this._hooks.clearTargetShape();let t=this._currentSpinReject;this._currentSpinResolve=null,this._currentSpinReject=null,t&&t(e);return}let t={symbols:this._reels.map(e=>e.getVisibleSymbols()),wasSkipped:this._wasSkipped,duration:performance.now()-this._spinStartTime};this._isSpinning=!1,this._activePhases.clear(),this._cachedFrames=null,this._hooks.clearTargetShape(),this._events.emit(`spin:allLanded`,t),this._events.emit(`spin:complete`,t),this._currentSpinResolve&&=(this._currentSpinResolve(t),null),this._currentSpinReject=null}_onTick(e){if(!this._isSpinning)return;let t=e.deltaMS;for(let e of this._reels)e.update(t);for(let e of this._activePhases.values())e.isActive&&e.update(t)}},w=class{_profiles=new Map;_activeName;_active;constructor(e,t){for(let[t,n]of e)this._profiles.set(t,n);let n=this._profiles.get(t);if(!n)throw Error(`Speed profile '${t}' not found. Available: ${[...this._profiles.keys()].join(`, `)}`);this._activeName=t,this._active=n}get active(){return this._active}get activeName(){return this._activeName}set(e){let t=this._profiles.get(e);if(!t)throw Error(`Speed profile '${e}' not found. Available: ${[...this._profiles.keys()].join(`, `)}`);let n=this._active;return this._activeName=e,this._active=t,{previous:n,current:t}}addProfile(e,t){this._profiles.set(e,t)}getProfile(e){return this._profiles.get(e)}get profileNames(){return[...this._profiles.keys()]}},T=class{_reels;_viewport;_promoted=[];_isActive=!1;_isDestroyed=!1;_cycleAbort=null;constructor(e,t){this._reels=e,this._viewport=t}get isActive(){return this._isActive}get isDestroyed(){return this._isDestroyed}async show(e,t={}){this.hide(),await this._showInternal(e,t)}async _showInternal(e,t={}){let{dimAmount:n=.5,playWinAnimation:r=!0,promoteAboveMask:i=!0}=t;this._isActive=!0,this._viewport.showDim(n);let a=[],o=new Set;for(let t of e){let e=this._reels[t.reelIndex];if(!e)continue;let n=e.getSymbolAt(t.rowIndex);if(!n)continue;let s=`${t.reelIndex}:${e.getAnchorRow(t.rowIndex)}`;if(!o.has(s)){if(o.add(s),i){let e=n.view.parent;this._promoted.push({symbol:n,originalParent:e,position:t});let r=n.view.getGlobalPosition();this._viewport.spotlightContainer.addChild(n.view);let i=this._viewport.spotlightContainer.toLocal(r);n.view.x=i.x,n.view.y=i.y}r&&a.push(n.playWin())}}a.length>0&&await Promise.all(a)}hide(){this._cycleAbort&&=(this._cycleAbort.abort(),null),this._teardownVisual()}_teardownVisual(){for(let{symbol:e,originalParent:t}of this._promoted)if(e.view.parent===this._viewport.spotlightContainer){if(t){let n=e.view.getGlobalPosition();t.addChild(e.view);let r=t.toLocal(n);e.view.x=r.x,e.view.y=r.y}e.stopAnimation()}this._promoted=[],this._viewport.hideDim(),this._isActive=!1}async cycle(e,t={}){let{displayDuration:n=2e3,gapDuration:r=300,cycles:i=1}=t;if(e.length===0)return;this.hide();let a=new AbortController;this._cycleAbort=a;let o=a.signal,s=0;for(;i===-1||s<i;){for(let i of e){if(o.aborted||(await this._showInternal(i.positions,t),await this._wait(n,o),o.aborted))return;this._teardownVisual(),await this._wait(r,o)}s++}this._cycleAbort===a&&(this._cycleAbort=null)}destroy(){this._isDestroyed||=(this.hide(),!0)}_wait(e,t){return new Promise(n=>{if(t.aborted){n();return}let r=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(r),n()},{once:!0})})}};function E(e,t){return`${e}:${t}`}var D=class r extends t.Container{static PIN_OVERLAY_Z_INDEX=1e4;_events=new n;_reels;_viewport;_spinController;_speedManager;_spotlight;_symbolFactory;_frameBuilder;_frameAPI;_isDestroyed=!1;_pins=new Map;_pinOverlays=new Map;_targetShape=null;_resultSetForCurrentSpin=!1;_isMultiWaysSlot;_nudgesInFlight=0;_multiwaysMinRows=0;_multiwaysMaxRows=0;_multiwaysReelPixelHeight=0;_symbolsData;_configGapX;constructor(e){super(),this._reels=e.reels,this._viewport=e.viewport,this._symbolFactory=e.symbolFactory,this._frameBuilder=e.frameBuilder,this._symbolsData=e.config.symbols,this._configGapX=e.config.grid.symbolGap.x,this._isMultiWaysSlot=!!e.config.grid.multiways,e.config.grid.multiways&&(this._multiwaysMinRows=e.config.grid.multiways.minRows,this._multiwaysMaxRows=e.config.grid.multiways.maxRows,this._multiwaysReelPixelHeight=e.config.grid.multiways.reelPixelHeight);for(let e of this._reels)e.setCrossReelResolver((e,t)=>{let n=this.getSymbolFootprint(e,t),r=this._reels[n.anchor.col];return r.symbols[r.bufferAbove+n.anchor.row].symbolId});let t=this._frameBuilder;this._frameAPI={use(e){t.use(e)},remove(e){t.remove(e)},get middleware(){return t.middleware}},this._speedManager=new w(e.config.speeds,e.config.initialSpeed),this._spinController=new C(e.reels,this._speedManager,e.frameBuilder,e.phaseFactory,this._events,e.config.ticker,e.spinningMode,e.defaultSpinMode,{isMultiWaysSlot:this._isMultiWaysSlot,symbolsData:this._symbolsData,peekTargetShape:()=>this.peekTargetShape(),clearTargetShape:()=>this.clearTargetShape(),multiwaysReelPixelHeight:this._multiwaysReelPixelHeight,symbolGapY:e.config.grid.symbolGap.y,getPinsOnReel:e=>this._pinsOnReel(e),migratePinsForReel:(e,t)=>this._migratePinsForReel(e,t),refreshPinOverlaysForReel:e=>this.refreshPinOverlaysForReel(e),buildPinOverlayTweens:(e,t,n)=>this._buildPinOverlayTweens(e,t,n)}),this._spotlight=new T(e.reels,e.viewport),this.addChild(this._viewport),this._events.on(`spin:allLanded`,()=>this._onSpinLanded()),this._events.on(`spin:start`,()=>this._onSpinStart())}get events(){return this._events}async spin(e){return this._assertNoNudgeInFlight(`spin`),this._spinController.spin(e)}setResult(e){this._assertNoNudgeInFlight(`setResult`),x(e,this._reels.map(e=>e.bufferAbove),this._reels.map(e=>e.bufferBelow),`setResult`);let t=this._applyPinsToGrid(this._cloneTargets(e));this._resultSetForCurrentSpin=!0,this._spinController.setResult(t.map(b))}async refill(e){let t=performance.now(),n=!1,r=()=>{n=!0};this._events.on(`skip:requested`,r);let i=()=>{n=!0,this._spinController.isSpinning&&this._spinController.slamStop()};e.signal&&(e.signal.aborted?i():e.signal.addEventListener(`abort`,i,{once:!0}));try{let r=await this._spinController.refill(e);return{winnersRefilled:e.winners.length,finalGrid:r.symbols,wasSkipped:n||r.wasSkipped,duration:performance.now()-t}}finally{this._events.off(`skip:requested`,r),e.signal&&e.signal.removeEventListener(`abort`,i)}}async destroySymbols(e,t){if(e.length===0)return;let n=(e,n)=>{let r=t?.delay;return typeof r==`function`?r(e,n):r??0};for(let t of e){if(t.reel<0||t.reel>=this._reels.length)throw RangeError(`destroySymbols: cell.reel ${t.reel} out of range [0, ${this._reels.length})`);let e=this._reels[t.reel];if(t.row<0||t.row>=e.visibleRows)throw RangeError(`destroySymbols: cell.row ${t.row} out of range [0, ${e.visibleRows}) for reel ${t.reel}`)}let r=t?.dim;r&&this._viewport.showDim(typeof r==`number`?r:.35);let i=t?.zIndex===void 0?1e3:t.zIndex,a=t?.signal;this._events.emit(`cascade:destroy:start`,{cells:e});try{let t=await Promise.allSettled(e.map((e,t)=>{let r=this._reels[e.reel].getSymbolAt(e.row);return i!==null&&(r.view.zIndex=i),r.playDestroy({delay:n(e,t),signal:a})})),r=[];for(let n=0;n<t.length;n++)t[n].status===`rejected`&&(r.push(e[n]),console.warn(`[pixi-reels] destroySymbols: cell (${e[n].reel}, ${e[n].row}) playDestroy rejected:`,t[n].reason));this._events.emit(`cascade:destroy:end`,r.length>0?{cells:e,failed:r}:{cells:e})}finally{r&&this._viewport.hideDim()}}async runCascade(e){let t=e.pauseAfterDestroyMs??250,n=e.maxChain??32,r=!1,i=()=>{r=!0};this._events.on(`skip:requested`,i);let a=()=>{r=!0,this._spinController.isSpinning&&this._spinController.slamStop()};e.signal&&(e.signal.aborted?a():e.signal.addEventListener(`abort`,a,{once:!0}));let o=0,s=0,c=this.getVisibleGrid();try{for(;o<n&&!r;){let n=await e.detectWinners(c,o);if(n.length===0)break;s+=n.length;let i=o+1;this._events.emit(`cascade:chain:start`,{chain:i,winners:n,currentGrid:c});let a=e.destroyOptions?.signal?e.destroyOptions:{...e.destroyOptions,signal:e.signal};if(await this.destroySymbols(n,a),r||e.onCascade&&(await e.onCascade({chain:i,winners:n,currentGrid:c}),r)||t>0&&(await new Promise(n=>{let r=setTimeout(n,t);if(!e.signal)return;let i=()=>{clearTimeout(r),n()};e.signal.aborted?i():e.signal.addEventListener(`abort`,i,{once:!0})}),r))break;let l=await e.nextGrid(c,n,o);if(r)break;let u=e.refillMode??`combined`,d=l.length===0?[]:Array.isArray(l[0])?l.map(e=>({visible:e})):l;await this.refill({winners:[...n],grid:d,mode:u,gravityHoldMs:e.gravityHoldMs,gravityHold:e.gravityHold?()=>e.gravityHold({chain:i,winners:n}):void 0,onGravityComplete:e.onGravityComplete?()=>e.onGravityComplete({chain:i,winners:n}):void 0}),o+=1,c=this.getVisibleGrid(),this._events.emit(`cascade:chain:end`,{chain:i,winners:n,nextGrid:c})}}finally{this._events.off(`skip:requested`,i),e.signal&&e.signal.removeEventListener(`abort`,a)}return{chainLength:o,totalWinners:s,finalGrid:c,wasSkipped:r}}setAnticipation(e){this._spinController.setAnticipation(e)}setStopDelays(e){this._spinController.setStopDelays(e)}skipSpin(){this._spinController.skip()}requestSkip(){this._spinController.requestSkip()}slamStop(){this._spinController.slamStop()}get skipStage(){return this._spinController.skipStage}setSymbolAt(e,t,n){if(e<0||e>=this._reels.length)throw RangeError(`setSymbolAt: col ${e} out of range [0, ${this._reels.length})`);if(this._pins.has(E(e,t)))throw Error(`setSymbolAt: cell (${e}, ${t}) has an active pin. Call unpin(col, row) first if you intend to overwrite it.`);this._reels[e].setSymbolAt(t,n)}async nudge(e,t){if(this._spinController.isSpinning)throw Error(`nudge: cannot nudge while a spin or refill is in progress.`);if(!Number.isInteger(e)||e<0||e>=this._reels.length)throw RangeError(`nudge: col ${e} out of range [0, ${this._reels.length}).`);for(let t of this._pins.values())if(t.col===e)throw Error(`nudge: reel ${e} has an active pin at row ${t.row}. Call unpin(${e}, ${t.row}) first if you intend to nudge through it.`);this._nudgesInFlight++;try{let n=await this._reels[e].nudge(t,()=>{this._events.emit(`nudge:start`,{reelIndex:e,distance:t.distance,direction:t.direction})});return this._events.emit(`nudge:complete`,{reelIndex:e,distance:t.distance,direction:t.direction,symbols:n.symbols}),n}catch(n){throw n instanceof Error&&n.name===`AbortError`&&!this._isDestroyed&&this._events.emit(`nudge:cancelled`,{reelIndex:e,distance:t.distance,direction:t.direction,reason:n.message}),n}finally{this._nudgesInFlight--}}_assertNoNudgeInFlight(e){if(this._nudgesInFlight>0)throw Error(`ReelSet.${e}: cannot be called while nudge() is in flight. Await the nudge() promise before calling ${e}.`)}skipNudge(e){if(e===void 0){for(let e of this._reels)e.isNudging&&e.skipNudge();return}if(!Number.isInteger(e)||e<0||e>=this._reels.length)throw RangeError(`skipNudge: col ${e} out of range [0, ${this._reels.length}).`);this._reels[e].skipNudge()}setDropOrder(e,t){if(Array.isArray(e)){this._spinController.setStopDelays(e);return}let n=this._reels.length,r=t??Math.max(this._speedManager.active.stopDelay,150),i;i=e===`all`?Array(n).fill(0):e===`ltr`?Array.from({length:n},(e,t)=>t*r):Array.from({length:n},(e,t)=>(n-1-t)*r),this._spinController.setStopDelays(i)}get isSpinning(){return this._spinController.isSpinning}get isMultiWaysSlot(){return this._isMultiWaysSlot}setShape(e){if(this._assertNoNudgeInFlight(`setShape`),!this._isMultiWaysSlot)throw Error(`setShape(): slot was not built with .multiways(...). call ReelSetBuilder.multiways() first.`);if(this._resultSetForCurrentSpin)throw Error(`setShape(): must be called BEFORE setResult() in the current spin. Calling setShape after setResult corrupts the cached frames (pins were overlaid at their pre-migration rows). Reorder: spin() → setShape() → setResult().`);if(e.length!==this._reels.length)throw Error(`setShape(): rowsPerReel length ${e.length} must equal reelCount ${this._reels.length}.`);for(let t=0;t<e.length;t++){let n=e[t];if(n<this._multiwaysMinRows||n>this._multiwaysMaxRows)throw Error(`setShape(): rowsPerReel[${t}] = ${n} out of range [${this._multiwaysMinRows}, ${this._multiwaysMaxRows}].`)}let t=!0;for(let n=0;n<this._reels.length;n++)if(this._reels[n].visibleRows!==e[n]){t=!1;break}if(!t){this._targetShape=[...e],this._events.emit(`shape:changed`,[...e]);for(let t=0;t<this._reels.length;t++)this._migratePinsForReel(t,e[t])}}peekTargetShape(){return this._targetShape}clearTargetShape(){this._targetShape=null}getVisibleGrid(){return this._reels.map(e=>e.getVisibleSymbols())}getSymbolFootprint(e,t){if(e<0||e>=this._reels.length)throw RangeError(`getSymbolFootprint: col ${e} out of range [0, ${this._reels.length})`);let n=this._reels[e];if(t<0||t>=n.visibleRows)throw RangeError(`getSymbolFootprint: row ${t} out of range [0, ${n.visibleRows})`);let r=n.getAnchorRow(t),i=n.getSymbolAt(t),a=this._symbolsData[i.symbolId],o=a?.size&&(a.size.w>1||a.size.h>1)?a.size:{w:1,h:1},s=e;for(let t=e-1;t>=0;t--){let n=this._reels[t];if(r>=n.visibleRows)break;let i=n.getAnchorRow(r),a=n.getSymbolAt(r),o=this._symbolsData[a.symbolId];if(o?.size&&o.size.w>e-t)return s=t,{anchor:{col:s,row:i},size:o.size}}return{anchor:{col:s,row:r},size:o}}getBlockBounds(e,t){let n=this.getSymbolFootprint(e,t),r=this._reels[n.anchor.col],i=this._configGapX,a=r.motion.slotHeight,o=r.symbolWidth,s=r.symbolHeight,c=a-s,l=n.anchor.row;return{x:this._viewport.x+r.container.x,y:this._viewport.y+r.offsetY+l*a,width:n.size.w*o+(n.size.w-1)*i,height:n.size.h*s+(n.size.h-1)*c}}get speed(){return this._speedManager}setSpeed(e){let{previous:t,current:n}=this._speedManager.set(e);this._events.emit(`speed:changed`,n,t),this._spinController.notifyManualSpeedChange()}get spotlight(){return this._spotlight}get reels(){return this._reels}getReel(e){return this._reels[e]}getCellBounds(e,t){if(e<0||e>=this._reels.length)throw RangeError(`getCellBounds: col ${e} out of range [0, ${this._reels.length})`);let n=this._reels[e];if(t<0||t>=n.visibleRows)throw RangeError(`getCellBounds: row ${t} out of range [0, ${n.visibleRows})`);return{x:this._viewport.x+n.container.x,y:this._viewport.y+n.offsetY+t*n.motion.slotHeight,width:n.symbolWidth,height:n.symbolHeight}}get viewport(){return this._viewport}pin(e,t,n,r){if(this._assertNoNudgeInFlight(`pin`),e<0||e>=this._reels.length)throw Error(`pin(): col ${e} out of range [0, ${this._reels.length})`);let i=this._reels[e];if(t<0||t>=i.visibleRows)throw Error(`pin(): row ${t} out of range [0, ${i.visibleRows})`);let a={col:e,row:t,originRow:r?.originRow??t,migration:r?.migration??`origin`,symbolId:n,turns:r?.turns??`permanent`,payload:r?.payload},o=E(e,t);return this._pins.has(o)&&this._destroyPinOverlay(o),this._pins.set(o,a),this._spinController.isSpinning?this._ensurePinOverlay(a):this._applyPinVisually(e,t,n),this._events.emit(`pin:placed`,a),a}unpin(e,t){let n=E(e,t),r=this._pins.get(n);r&&(this._pins.delete(n),this._destroyPinOverlay(n),this._events.emit(`pin:expired`,r,`explicit`))}get pins(){return this._pins}getPin(e,t){return this._pins.get(E(e,t))}async movePin(t,n,r){if(this._spinController.isSpinning)throw Error(`movePin(): cannot move pin while spinning`);let i=E(t.col,t.row),a=this._pins.get(i);if(!a)throw Error(`movePin(): no pin at (${t.col}, ${t.row})`);if(n.col<0||n.col>=this._reels.length)throw Error(`movePin(): to col ${n.col} out of range [0, ${this._reels.length})`);let o=this._reels[n.col];if(n.row<0||n.row>=o.visibleRows)throw Error(`movePin(): to row ${n.row} out of range [0, ${o.visibleRows})`);if(t.col===n.col&&t.row===n.row){this._events.emit(`pin:moved`,a,{col:t.col,row:t.row});return}let s=E(n.col,n.row);if(this._pins.has(s))throw Error(`movePin(): a pin already exists at (${n.col}, ${n.row})`);this._pins.delete(i);let c={...a,col:n.col,row:n.row,originRow:n.row};this._pins.set(s,c),this._destroyPinOverlay(i);let l=this._reels[t.col],u=l.getSymbolAt(t.row).view.y,d=o.getSymbolAt(n.row).view.y,f=l.container.x,p=o.container.x,m=r?.backfill??this._frameBuilder.randomProvider.next(!1),h=l.getVisibleSymbols();h[t.row]=m,l.placeSymbols(h);let g=this._symbolFactory.acquire(a.symbolId);g.resize(l.symbolWidth,l.symbolHeight),g.view.x=f,g.view.y=u,this._viewport.unmaskedContainer.addChild(g.view);try{r?.onFlightCreated?.(g)}catch(e){console.error(`[pixi-reels] movePin onFlightCreated hook threw. continuing the flight to avoid leaking the flight symbol:`,e)}let _=(r?.duration??400)/1e3,v=r?.easing??`power2.inOut`;await new Promise(t=>{e.n().to(g.view,{x:p,y:d,duration:_,ease:v,onComplete:()=>t()})});try{r?.onFlightCompleted?.(g)}catch(e){console.error(`[pixi-reels] movePin onFlightCompleted hook threw. continuing cleanup:`,e)}let y=o.getVisibleSymbols();y[n.row]=a.symbolId,o.placeSymbols(y),this._viewport.unmaskedContainer.removeChild(g.view),this._symbolFactory.release(g),this._events.emit(`pin:moved`,c,{col:t.col,row:t.row})}get frame(){return this._frameAPI}get isDestroyed(){return this._isDestroyed}destroy(){if(!this._isDestroyed){this._isDestroyed=!0,this._spotlight.destroy(),this._spinController.destroy();for(let e of this._reels)e.destroy();this._destroyAllPinOverlays(),this._symbolFactory.destroy(),this._viewport.destroy(),this._pins.clear(),this._events.emit(`destroyed`),this._events.removeAllListeners(),super.destroy({children:!0})}}_applyPinsToGrid(e){for(let t of this._pins.values()){let n=e[t.col];n&&t.row<n.visible.length&&(n.visible[t.row]=t.symbolId)}return e}_cloneTargets(e){return e.map(e=>({visible:[...e.visible],bufferAbove:e.bufferAbove?[...e.bufferAbove]:void 0,bufferBelow:e.bufferBelow?[...e.bufferBelow]:void 0}))}_pinsOnReel(e){let t=[];for(let n of this._pins.values())n.col===e&&t.push(n);return t}_migratePinsForReel(e,t){let n=[],r=this._pinsOnReel(e).sort((e,t)=>e.row-t.row),i=new Set,a=[];for(let e of r){let n=e.row,r,o,s=e.originRow;if(e.migration===`frozen`?n<t?(r=n,o=!1):(r=t-1,o=!0,s=r):(r=Math.min(e.originRow,t-1),o=r!==e.originRow),r===n&&s===e.originRow){i.add(n);continue}a.push({pin:e,fromRow:n,target:r,clamped:o,nextOriginRow:s})}for(let{pin:t,fromRow:r,target:o,clamped:s,nextOriginRow:c}of a){let a=E(t.col,r);if(i.has(o)){this._pins.delete(a),this._destroyPinOverlay(a),this._events.emit(`pin:expired`,t,`collision`);continue}i.add(o);let l=E(t.col,o);this._pins.delete(a);let u={...t,row:o,originRow:c};this._pins.set(l,u);let d=this._pinOverlays.get(a);d&&(this._pinOverlays.delete(a),this._pinOverlays.set(l,{pin:u,overlay:d.overlay})),n.push({pin:u,fromRow:r,toRow:o,clamped:s}),this._events.emit(`pin:migrated`,u,{fromRow:r,toRow:o,clamped:s,reelIndex:e})}return n}_pinOverlayCellY(e,t,n){return e.container.y+t*n}_applyPinVisually(e,t,n){let r=this._reels[e],i=r.getVisibleSymbols();i[t]!==n&&(i[t]=n,r.placeSymbols(i))}_onSpinLanded(){if(this._destroyAllPinOverlays(),this._pins.size===0)return;let e=[];for(let t of this._pins.values())typeof t.turns==`number`&&(--t.turns,t.turns<=0&&e.push(t));for(let t of e)this._pins.delete(E(t.col,t.row)),this._events.emit(`pin:expired`,t,`turns`)}_onSpinStart(){if(this._resultSetForCurrentSpin=!1,this._pins.size>0){let e=[];for(let t of this._pins.values())t.turns===`eval`&&e.push(t);for(let t of e)this._pins.delete(E(t.col,t.row)),this._events.emit(`pin:expired`,t,`eval`)}for(let e of this._pins.values())this._ensurePinOverlay(e)}_ensurePinOverlay(e){let t=E(e.col,e.row);if(this._pinOverlays.has(t))return;let n=this._reels[e.col],i=this._symbolFactory.acquire(e.symbolId);i.resize(n.symbolWidth,n.symbolHeight),i.view.x=n.container.x,i.view.y=this._pinOverlayCellY(n,e.row,n.motion.slotHeight),i.view.zIndex=r.PIN_OVERLAY_Z_INDEX,this._viewport.unmaskedContainer.addChild(i.view),this._pinOverlays.set(t,{pin:e,overlay:i}),this._events.emit(`pin:overlayCreated`,e,i)}refreshPinOverlaysForReel(e){let t=this._reels[e];for(let[,n]of this._pinOverlays){if(n.pin.col!==e)continue;let{pin:r,overlay:i}=n;i.resize(t.symbolWidth,t.symbolHeight),i.view.x=t.container.x,i.view.y=this._pinOverlayCellY(t,r.row,t.motion.slotHeight)}}_buildPinOverlayTweens(e,t,n){let r=this._reels[e],i=[],a=t+n;for(let[,n]of this._pinOverlays){if(n.pin.col!==e)continue;let{pin:o,overlay:s}=n;i.push({symbol:s,cellWidth:r.symbolWidth,oldCellHeight:r.symbolHeight,newCellHeight:t,fromY:s.view.y,toY:this._pinOverlayCellY(r,o.row,a),x:r.container.x})}return i}_destroyPinOverlay(e){let t=this._pinOverlays.get(e);if(!t)return;let{pin:n,overlay:r}=t;this._events.emit(`pin:overlayDestroyed`,n,r),this._viewport.unmaskedContainer.removeChild(r.view),this._symbolFactory.release(r),this._pinOverlays.delete(e)}_destroyAllPinOverlays(){let e=[...this._pinOverlays.keys()];for(let t of e)this._destroyPinOverlay(t)}},O={bufferSymbols:1,symbolGap:{x:0,y:0},initialSpeed:`normal`,maxPoolPerKey:20,zIndexStep:100},k={NORMAL:{name:`normal`,spinDelay:100,spinSpeed:30,stopDelay:140,anticipationDelay:450,bounceDistance:56,bounceDuration:600,accelerationEase:`power2.in`,decelerationEase:`power2.out`,accelerationDuration:300,minimumSpinTime:500},TURBO:{name:`turbo`,spinDelay:30,spinSpeed:50,stopDelay:0,anticipationDelay:250,bounceDistance:42,bounceDuration:200,accelerationEase:`power2.in`,decelerationEase:`power2.out`,accelerationDuration:200,minimumSpinTime:300},SUPER_TURBO:{name:`superTurbo`,spinDelay:0,spinSpeed:80,stopDelay:0,anticipationDelay:0,bounceDistance:14,bounceDuration:120,accelerationEase:`power1.in`,decelerationEase:`power1.out`,accelerationDuration:50,minimumSpinTime:100}},A=class{_entries=new Map;register(e,t,n){if(this._entries.has(e))throw Error(`Symbol '${e}' is already registered.`);this._entries.set(e,{SymbolClass:t,options:n})}create(e){let t=this._entries.get(e);if(!t)throw Error(`Symbol '${e}' is not registered. Available: ${[...this._entries.keys()].join(`, `)}`);let n=new t.SymbolClass(t.options);return n.activate(e),n}has(e){return this._entries.has(e)}get symbolIds(){return[...this._entries.keys()]}get size(){return this._entries.size}},j=class{_pools=new Map;_pooled=new Set;_isDestroyed=!1;constructor(e,t,n,r=20){this._factory=e,this._reset=t,this._dispose=n,this._maxPerKey=r}get isDestroyed(){return this._isDestroyed}acquire(e){if(this._isDestroyed)throw Error(`ObjectPool.acquire('${e}') called after destroy(). A ticker or promise callback is still running past teardown; cancel it before destroying the pool.`);let t=this._pools.get(e);if(t&&t.length>0){let e=t.pop();return this._pooled.delete(e),this._reset?.(e),e}return this._factory(e)}release(e,t){if(this._isDestroyed||this._pooled.has(t))return;let n=this._pools.get(e);if(n||(n=[],this._pools.set(e,n)),n.length>=this._maxPerKey){this._dispose?.(t);return}n.push(t),this._pooled.add(t)}size(e){return this._pools.get(e)?.length??0}get totalSize(){let e=0;for(let t of this._pools.values())e+=t.length;return e}clear(){if(this._dispose)for(let e of this._pools.values())for(let t of e)this._dispose(t);this._pools.clear(),this._pooled.clear()}destroy(){this._isDestroyed||=(this.clear(),!0)}},ee=class{_pool;_capacityPerKey;constructor(e,t=20){this._registry=e,this._capacityPerKey=t,this._pool=new j(e=>this._registry.create(e),e=>e.reset(),e=>e.destroy(),t)}get capacityPerKey(){return this._capacityPerKey}acquire(e){let t=this._pool.acquire(e);return t.symbolId!==e&&t.activate(e),t}release(e){let t=e.symbolId;e.deactivate(),this._pool.release(t,e)}destroy(){this._pool.destroy()}},M=class{_symbols;_weights;_cumulativeWeights=[];_totalWeight=0;_excludeSpinning=new Set;_excludeBuffer=new Set;_rng;constructor(e,t=Math.random){this._rng=t,this._symbols=Object.keys(e),this._weights=this._symbols.map(t=>e[t].weight),this._rebuildWeights(),this._assertUsable()}next(e=!1){let t=e?new Set([...this._excludeSpinning,...this._excludeBuffer]):this._excludeSpinning;if(t.size===0)return this._pickWeighted();let n=0,r=[];for(let e=0;e<this._symbols.length;e++)t.has(this._symbols[e])||(n+=this._weights[e],r.push({id:this._symbols[e],cumWeight:n}));if(n===0||r.length===0){for(let e of this._symbols)if(!t.has(e))return e;return this._symbols[0]}let i=this._rng()*n,a=0,o=r.length-1;for(;a<o;){let e=a+o>>1;r[e].cumWeight<=i?a=e+1:o=e}return r[a].id}setExcludeSpinning(e){this._excludeSpinning=new Set(e)}setExcludeBuffer(e){this._excludeBuffer=new Set(e)}updateWeights(e){this._symbols=Object.keys(e),this._weights=this._symbols.map(t=>e[t].weight),this._rebuildWeights(),this._assertUsable();let t=new Set(this._symbols);this._excludeSpinning=new Set([...this._excludeSpinning].filter(e=>t.has(e))),this._excludeBuffer=new Set([...this._excludeBuffer].filter(e=>t.has(e)))}_assertUsable(){if(this._symbols.length===0)throw Error(`RandomSymbolProvider requires at least one symbol.`);if(this._totalWeight<=0)throw Error(`RandomSymbolProvider requires at least one symbol with weight > 0; all registered symbols have weight 0, so the spinning strip cannot be filled.`)}_rebuildWeights(){this._cumulativeWeights=[],this._totalWeight=0;for(let e of this._weights)this._totalWeight+=e,this._cumulativeWeights.push(this._totalWeight)}_pickWeighted(){let e=this._rng()*this._totalWeight,t=0,n=this._cumulativeWeights.length-1;for(;t<n;){let r=t+n>>1;this._cumulativeWeights[r]<=e?t=r+1:n=r}return this._symbols[t]}},N=class{_middlewares=[];_sorted=!1;constructor(e){this._randomProvider=e,this.use(new P(e)),this.use(new F)}use(e){return this._middlewares.push(e),this._sorted=!1,this}remove(e){return this._middlewares=this._middlewares.filter(t=>t.name!==e),this}build(e,t,n,r,i,a=!1){this._sorted||=(this._middlewares.sort((e,t)=>e.priority-t.priority),!0);let o=n+t+r,s={reelIndex:e,visibleRows:t,bufferAbove:n,bufferBelow:r,symbols:Array(o).fill(``),targetSymbols:i,isSpinning:a,metadata:{}},c=0,l=()=>{c<this._middlewares.length&&this._middlewares[c++].process(s,l)};return l(),s.symbols}buildAll(e,t,n,r,i,a=!1){return Array.from({length:e},(e,o)=>this.build(o,t,n,r,i?.[o],a))}get randomProvider(){return this._randomProvider}get middleware(){return this._middlewares}},P=class{name=`random-fill`;priority=0;constructor(e){this._provider=e}process(e,t){for(let t=0;t<e.symbols.length;t++)if(!e.symbols[t]){let n=t<e.bufferAbove||t>=e.bufferAbove+e.visibleRows;e.symbols[t]=this._provider.next(n)}t()}},F=class{name=`target-placement`;priority=10;process(e,t){if(e.targetSymbols)for(let t=-e.bufferAbove;t<e.targetSymbols.length;t++){let n=e.bufferAbove+t;e.targetSymbols[t]&&n<e.symbols.length&&(e.symbols[n]=e.targetSymbols[t])}t()}},I=class{_offsets=[];constructor(e,t,n,r){this._reelCount=e,this._totalRows=t,this._symbolWidth=n,this._config=r,this._compute()}getOffset(e,t){return this._offsets[e]?.[t]??0}get offsets(){return this._offsets}_compute(){if(this._config.mode===`none`){this._offsets=Array.from({length:this._reelCount},()=>Array(this._totalRows).fill(0));return}let e=this._config,t=(this._reelCount-1)/2;this._offsets=[];for(let n=0;n<this._reelCount;n++){let r=this._reelCount>1?(n-t)/(this._reelCount/2):0,i=[];for(let t=0;t<this._totalRows;t++){let n=this._totalRows>1?t/(this._totalRows-1):.5,a=r*e.widthDifference*e.topWidthFactor,o=a+(r*e.widthDifference*e.bottomWidthFactor-a)*n;i.push(o)}this._offsets.push(i)}}};function L(e){return{fall:{duration:e?.fall?.duration??300,ease:e?.fall?.ease??`sine.in`,rowStagger:e?.fall?.rowStagger??0,rowOrder:e?.fall?.rowOrder??`bottomToTop`},dropIn:{duration:e?.dropIn?.duration??600,ease:e?.dropIn?.ease??`power2.out`,rowStagger:e?.dropIn?.rowStagger??60,rowOrder:e?.dropIn?.rowOrder??`bottomToTop`,distance:e?.dropIn?.distance??`perHole`}}}function R(e,t){return t?{duration:t.duration??e.duration,ease:t.ease??e.ease,rowStagger:t.rowStagger??e.rowStagger,rowOrder:t.rowOrder??e.rowOrder}:e}function z(e,t){return t?{duration:t.duration??e.duration,ease:t.ease??e.ease,rowStagger:t.rowStagger??e.rowStagger,rowOrder:t.rowOrder??e.rowOrder,distance:t.distance??e.distance}:e}var B=class extends p{name=`cascade:fall`;skippable=!0;_baseFall;_fall;_timeline=null;_delayedCall=null;_fallingViews=[];_events=null;_startEmitted=!1;_skipAbort=null;constructor(e,t,n){super(e,t),this._baseFall=n,this._fall=n}onEnter(t){let n=this._reel;n.spinningMode=t.spinningMode,n.speed=0,n.notifySpinStart(),this._fall=R(this._baseFall,this._speed.tumble?.fall),this._events=t.events,this._startEmitted=!1,this._skipAbort=new AbortController;let r=(t.delay??0)/1e3;r>0?this._delayedCall=e.n().delayedCall(r,()=>this._beginFall(t.events)):this._beginFall(t.events)}_beginFall(t){this._delayedCall=null;let n=this._reel,r=n.motion.slotHeight,i=n.visibleRows,a=n.reelIndex,o=(i+n.bufferBelow+1)*r,s=this._fall.duration/1e3,c=this._fall.rowStagger/1e3,l=[],u=[],d=[];for(let e=0;e<i;e++){let t=n.getSymbolAt(e);l.push(t),u.push(t.view),d.push(t.view.y)}if(this._fallingViews=u,t.emit(`cascade:fall:start`,{reelIndex:a}),this._startEmitted=!0,s<=0){for(let e of u)e.alpha=0;t.emit(`cascade:fall:end`,{reelIndex:a}),this._fallingViews=[],this._startEmitted=!1,this._events=null,this._skipAbort=null,this._complete();return}let f=e.n().timeline({onComplete:()=>{this._timeline=null;for(let e of u)e.alpha=0;this._fallingViews=[],t.emit(`cascade:fall:end`,{reelIndex:a}),this._startEmitted=!1,this._events=null,this._skipAbort=null,this._complete()}});this._timeline=f;let p=this._fall.rowOrder===`bottomToTop`;for(let e=0;e<i;e++){let n=u[e],r=l[e],m=d[e],h=(p?i-1-e:e)*c;f.call(()=>{let i=this._skipAbort?.signal;i&&t.emit(`cascade:fall:symbol`,{symbol:r,view:n,reelIndex:a,rowIndex:e,duration:this._fall.duration,ease:this._fall.ease,distance:o,signal:i})},void 0,h),f.to(n,{y:m+o,duration:s,ease:this._fall.ease},h)}}update(e){}onSkip(){this._kill();for(let e of this._fallingViews)e.alpha=0;this._fallingViews=[],this._skipAbort&&!this._skipAbort.signal.aborted&&this._skipAbort.abort(),this._skipAbort=null,this._startEmitted&&this._events&&this._events.emit(`cascade:fall:end`,{reelIndex:this._reel.reelIndex}),this._startEmitted=!1,this._events=null}_kill(){this._delayedCall&&=(this._delayedCall.kill(),null),this._timeline&&=(this._timeline.kill(),null)}};function V(e,t,n={}){let r=n.initial??!1,i=r?e:t.length,a=r?new Set:new Set(t),o=[];for(let t=0;t<e;t++)a.has(t)||o.push(t);let s=[];for(let t=0;t<e;t++){let e;e=t<i?t-i:o[t-i],s.push({row:t,originalRow:e,offsetRows:t-e})}return s}var H=class extends p{name=`cascade:place`;skippable=!0;_config=null;_delayedCall=null;onEnter(t){this._config=t;let n=(t.delay??0)/1e3;n>0?this._delayedCall=e.n().delayedCall(n,()=>this._doPlace()):this._doPlace()}_placement(e){let t=this._reel.bufferAbove,n=e.slice(t,t+this._reel.visibleRows);for(let r=1;r<=t;r++)n[-r]=e[t-r];return n}_doPlace(){if(this._delayedCall=null,!this._config)return;let e=this._reel,{targetFrame:t,events:n}=this._config;e.placeSymbols(this._placement(t)),e.snapToGrid(),e.notifySpinEnd();let r=V(e.visibleRows,this._config.winnerRows,{initial:this._config.initial}),i=[],a=new Set;for(let t of r){let n=e.getAnchorRow(t.row);if(n!==t.row&&a.has(n))continue;a.add(n);let r=e.getSymbolAt(t.row);r.view.visible=!0,r.view.alpha=+(t.offsetRows===0),i.push(r)}n.emit(`cascade:place:end`,{reelIndex:e.reelIndex,placedSymbols:i,isInitial:this._config.initial,winnerRows:this._config.winnerRows}),this._complete()}update(e){}onSkip(){if(this._delayedCall&&=(this._delayedCall.kill(),null),this._config){let e=this._reel;e.placeSymbols(this._placement(this._config.targetFrame));for(let t=0;t<e.visibleRows;t++){let n=e.getSymbolAt(t).view;n.alpha=1,n.visible=!0}}}},U=class extends p{name=`cascade:dropIn`;skippable=!0;_baseDrop;_drop;_timeline=null;_jobs=[];_events=null;_endEvent=`cascade:dropIn:end`;_skipAbort=null;constructor(e,t,n){super(e,t),this._baseDrop=n,this._drop=n}onEnter(t){let n=this._reel,r=n.visibleRows,i=n.motion.slotHeight,a=t.events,o=n.reelIndex,s=t.role??`all`;this._drop=z(this._baseDrop,this._speed.tumble?.dropIn),this._skipAbort=new AbortController;let c=s===`gravity`?`cascade:gravity:start`:`cascade:dropIn:start`,l=s===`gravity`?`cascade:gravity:symbol`:`cascade:dropIn:symbol`,u=s===`gravity`?`cascade:gravity:end`:`cascade:dropIn:end`;this._events=a,this._endEvent=u,a.emit(c,{reelIndex:o});let d=V(r,t.winnerRows,{initial:t.initial}),f=[],p=new Set;for(let e of d){let a=n.getAnchorRow(e.row);if(a!==e.row&&p.has(a))continue;p.add(a);let o=n.getSymbolAt(e.row);if(e.offsetRows===0){o.view.visible=!0,o.view.alpha=1;continue}let c=o.view.y,l;switch(this._drop.distance){case`auto`:l=!t.initial&&e.originalRow>=0?e.originalRow*i:c-r*i;break;case`perHole`:l=e.originalRow*i;break;default:l=c-this._drop.distance}let u=e.originalRow<0;if(s===`gravity`&&u||s===`new`&&!u){s===`gravity`&&u?(o.view.alpha=0,o.view.visible=!0):s===`new`&&!u&&(o.view.y=c,o.view.alpha=1,o.view.visible=!0);continue}o.view.y=l,o.view.alpha=1,o.view.visible=!0,f.push({row:e.row,symbol:o,view:o.view,startY:l,finalY:c,offsetRows:e.offsetRows})}this._jobs=f;let m=()=>{this._timeline=null,this._jobs=[],a.emit(u,{reelIndex:o}),this._events=null,this._skipAbort=null,s!==`gravity`&&n.notifyLanded(),this._complete()},h=this._drop.duration/1e3,g=this._drop.rowStagger/1e3;if(f.length===0||h<=0){for(let e of f)e.view.y=e.finalY;m();return}let _=e.n().timeline({onComplete:m});this._timeline=_;let v=this._drop.rowOrder===`bottomToTop`;for(let e=0;e<f.length;e++){let t=f[e],n=(v?f.length-1-e:e)*g;_.call(()=>{let e=this._skipAbort?.signal;e&&a.emit(l,{symbol:t.symbol,view:t.view,reelIndex:o,rowIndex:t.row,duration:this._drop.duration,ease:this._drop.ease,offsetRows:t.offsetRows,signal:e})},void 0,n),_.to(t.view,{y:t.finalY,duration:h,ease:this._drop.ease},n)}}update(e){}onSkip(){this._timeline&&=(this._timeline.kill(),null);for(let e of this._jobs)e.view.y=e.finalY,e.view.alpha=1,e.view.visible=!0;this._jobs=[];let e=this._reel;for(let t=0;t<e.visibleRows;t++){let n=e.getSymbolAt(t);n.view.alpha=1,n.view.visible=!0}this._skipAbort&&!this._skipAbort.signal.aborted&&this._skipAbort.abort(),this._skipAbort=null,this._events&&=(this._events.emit(this._endEvent,{reelIndex:this._reel.reelIndex}),null)}},W=class extends p{name=`adjust`;skippable=!0;_durationMs;_ease;_tween=null;_settle=null;constructor(e,t,n){super(e,t),this._durationMs=n.durationMs,this._ease=n.ease??`power2.out`}onEnter(t){let n=t.pinOverlays;if(n.length===0){this._complete();return}if(this._durationMs<=0){this._snapPinOverlays(n),this._complete();return}for(let e of n)e.symbol.resize(e.cellWidth,e.newCellHeight),e.symbol.view.x=e.x,e.symbol.view.y=e.fromY,e.symbol.view.scale.y=e.newCellHeight>0?e.oldCellHeight/e.newCellHeight:1,e.symbol.view.scale.x=1;this._settle=()=>{for(let e of n)e.symbol.view.scale.set(1,1),e.symbol.view.y=e.toY,e.symbol.view.x=e.x};let r=this._durationMs/1e3,i=this._ease;this._tween=e.n().timeline({onComplete:()=>{this._settle?.(),this._settle=null,this._tween=null,this._complete()}});for(let e of n)this._tween.to(e.symbol.view,{y:e.toY,duration:r,ease:i},0),this._tween.to(e.symbol.view.scale,{y:1,duration:r,ease:i},0)}update(e){}onSkip(){this._tween&&=(this._tween.progress(1),this._tween.kill(),null),this._settle&&=(this._settle(),null)}_snapPinOverlays(e){for(let t of e)t.symbol.resize(t.cellWidth,t.newCellHeight),t.symbol.view.x=t.x,t.symbol.view.y=t.toY,t.symbol.view.scale.set(1,1)}},te=class t{_reelCount;_visibleRows;_symbolWidth;_symbolHeight;_symbolGap={...O.symbolGap};_bufferSymbols=O.bufferSymbols;_symbolRegistry=new A;_weights={};_speeds=new Map;_initialSpeed=O.initialSpeed;_offset={mode:`none`};_ticker;_spinningMode=new a;_phaseFactory=new v;_middlewares=[];_initialFrame;_symbolDataOverrides={};_tumbleConfig;_defaultSpinMode=`standard`;_visibleRowsPerReel;_reelPixelHeights;_reelAnchor=`center`;_multiways;_pinMigrationDuration=200;_pinMigrationEase=`power2.out`;_maskStrategy=new u;_maskStrategyExplicit=!1;_rng=Math.random;_poolCapacity;reels(e){return this._reelCount=e,this}visibleRows(e){return this._visibleRows=e,this}visibleRowsPerReel(e){return this._visibleRowsPerReel=[...e],this}reelPixelHeights(e){return this._reelPixelHeights=[...e],this}reelAnchor(e){return this._reelAnchor=e,this}maskStrategy(e){if(e==null||typeof e.build!=`function`||typeof e.update!=`function`)throw Error(`maskStrategy(): expected a MaskStrategy with build(...) and update(...) methods (e.g. new RectMaskStrategy() or new SharedRectMaskStrategy()).`);return this._maskStrategy=e,this._maskStrategyExplicit=!0,this}multiways(e){return this._multiways={...e},this}pinMigrationDuration(e){return this._pinMigrationDuration=e,this}pinMigrationEase(e){return this._pinMigrationEase=e,this}symbolSize(e,t){return this._symbolWidth=e,this._symbolHeight=t,this}symbolGap(e,t){return this._symbolGap={x:e,y:t},this}bufferSymbols(e){return!Number.isFinite(e)||e<1?(t._bufferWarnedThisProcess||(t._bufferWarnedThisProcess=!0,console.warn(`[pixi-reels] bufferSymbols(${e}) is below the minimum of 1; clamping to 1. The motion layer needs at least one buffer row above and below the visible window for wrap detection.`)),this._bufferSymbols=1,this):(this._bufferSymbols=e,this)}static _bufferWarnedThisProcess=!1;symbols(e){return e(this._symbolRegistry),this}weights(e){return this._weights=e,this}symbolData(e){return this._symbolDataOverrides={...this._symbolDataOverrides,...e},this}speed(e,t){return this._speeds.set(e,t),this}initialSpeed(e){return this._initialSpeed=e,this}offsetConfig(e){return this._offset=e,this}ticker(e){return this._ticker=e,this}rng(e){return this._rng=e,this}poolCapacity(e){return this._poolCapacity=e,this}gsap(t){return e.r(t),this}spinningMode(e){return this._spinningMode=e,this}frameMiddleware(e){return this._middlewares.push(e),this}phases(e){return e(this._phaseFactory),this}tumble(e){return this._tumbleConfig=L(e),this._defaultSpinMode=`cascade`,this}initialFrame(e){return this._initialFrame=e,this}build(){this._validate();let e=this._reelCount,t=this._symbolWidth,n=this._symbolHeight,r=this._bufferSymbols,i=this._bufferSymbols,a=this._ticker,o=!!this._multiways,s;if(o)s=Array(e).fill(this._multiways.maxRows);else if(this._visibleRowsPerReel)s=this._visibleRowsPerReel;else{let t=this._visibleRows;s=Array(e).fill(t)}let c;c=o?Array(e).fill(this._multiways.reelPixelHeight):this._reelPixelHeights?this._reelPixelHeights:s.map(e=>e*n+(e-1)*this._symbolGap.y);let u=Math.max(...c),p=c.map(e=>{switch(this._reelAnchor){case`top`:return 0;case`bottom`:return u-e;default:return(u-e)/2}}),m=c.map((e,t)=>{let n=s[t];return(e-(n-1)*this._symbolGap.y)/n}),h=n,g=o?Array(e).fill(h):m;this._speeds.size===0&&this._speeds.set(`normal`,k.NORMAL);let _={},v=this._symbolRegistry.symbolIds;for(let e of v){let t=this._symbolDataOverrides[e]??{};_[e]={weight:t.weight??this._weights[e]??10,zIndex:t.zIndex??1,unmask:t.unmask,size:t.size}}let y={grid:{reelCount:e,visibleRows:this._visibleRows??s[0],symbolWidth:t,symbolHeight:n,symbolGap:{...this._symbolGap},bufferSymbols:this._bufferSymbols,visibleRowsPerReel:s,reelPixelHeights:c,reelAnchor:this._reelAnchor,multiways:this._multiways},symbols:_,speeds:this._speeds,initialSpeed:this._initialSpeed,offset:this._offset,ticker:a},S=s.reduce((e,t)=>e+t+r+i,0),C=this._poolCapacity??Math.max(20,S),w=new ee(this._symbolRegistry,C),T=new M(_,this._rng),E=new N(T);for(let e of this._middlewares)E.use(e);if(this._tumbleConfig){let e=this._tumbleConfig.fall,t=this._tumbleConfig.dropIn;this._phaseFactory.registerFactory(`cascade:fall`,(t,n)=>new B(t,n,e)),this._phaseFactory.register(`cascade:place`,H),this._phaseFactory.registerFactory(`cascade:dropIn`,(e,n)=>new U(e,n,t))}if(o){let e=this._pinMigrationDuration,t=this._pinMigrationEase;this._phaseFactory.registerFactory(`adjust`,(n,r)=>new W(n,r,{durationMs:typeof e==`function`?e(n.reelIndex):e,ease:t}))}let O=e*(t+this._symbolGap.x)-this._symbolGap.x,A=u,j=Object.values(_).some(e=>e.size&&(e.size.w>1||e.size.h>1)),P=Object.values(_).some(e=>e.unmask);if(P&&p.some(e=>e!==0)){let e=p.findIndex(e=>e!==0);throw Error(`[pixi-reels] unmask + pyramid layout is not supported (reel ${e} has offsetY=${p[e]}). The motion layer writes reel-local Y to unmasked views, which mispositions them by reel.container.y on every snap. Use cell pins (reelSet.pin(...)) for above-mask overlays on pyramid slots, or remove the per-reel offset.`)}!this._maskStrategyExplicit&&(j||P)&&this._symbolGap.x>0&&(this._maskStrategy=new d,console.info(`[pixi-reels] auto-selected SharedRectMaskStrategy because ${j?`big symbols are registered`:"one or more symbols use `unmask: true`"} and symbolGap.x > 0. Pass .maskStrategy(...) explicitly to override.`));let F=new f(O,A,void 0,this._maskStrategy);new I(e,r+Math.max(...s)+i,t,this._offset);let L;if(this._initialFrame){let t=Array(e).fill(r),n=Array(e).fill(i);x(this._initialFrame,t,n,`initialFrame`),L=this._initialFrame.map(b)}let R=[],z=[];for(let n=0;n<e;n++){let e=s[n],a=g[n],o=L?E.build(n,e,r,i,L[n]):E.build(n,e,r,i),u=new l({reelIndex:n,visibleRows:e,bufferAbove:r,bufferBelow:i,symbolWidth:t,symbolHeight:a,symbolGapX:this._symbolGap.x,symbolGapY:this._symbolGap.y,symbolsData:_,initialSymbols:o,offsetY:p[n],reelHeight:c[n],spinSymbolHeight:h},w,T,F);R.push(u),z.push({x:n*(t+this._symbolGap.x),y:p[n],width:t,height:c[n]})}return F.updateMaskSize(O,A,z),new D({config:y,reels:R,viewport:F,symbolFactory:w,frameBuilder:E,phaseFactory:this._phaseFactory,spinningMode:this._spinningMode,defaultSpinMode:this._defaultSpinMode})}_validate(){let e=[];(this._reelCount===void 0||this._reelCount<=0)&&e.push(`reels() must be called with a positive number.`);let t=!!this._visibleRowsPerReel,n=this._visibleRows!==void 0,r=!!this._multiways;if(!r&&!n&&!t&&e.push(`one of visibleRows(n) or visibleRowsPerReel([...]) or multiways({...}) must be called.`),n&&t&&e.push(`cannot call both visibleRows() and visibleRowsPerReel(). pick one.`),r&&t&&e.push(`cannot combine multiways() with visibleRowsPerReel(). MultiWays shapes are server-driven.`),this._reelCount&&t&&this._visibleRowsPerReel.length!==this._reelCount&&e.push(`visibleRowsPerReel length ${this._visibleRowsPerReel.length} must equal reels(${this._reelCount}).`),t){for(let t=0;t<this._visibleRowsPerReel.length;t++)if(this._visibleRowsPerReel[t]<=0){e.push(`visibleRowsPerReel[${t}] = ${this._visibleRowsPerReel[t]} must be positive.`);break}}if(this._reelCount&&this._reelPixelHeights&&this._reelPixelHeights.length!==this._reelCount&&e.push(`reelPixelHeights length ${this._reelPixelHeights.length} must equal reels(${this._reelCount}).`),r){let t=this._multiways;t.minRows<=0||t.maxRows<=0?e.push(`multiways({minRows, maxRows}) must both be positive.`):t.minRows>t.maxRows&&e.push(`multiways: minRows ${t.minRows} cannot exceed maxRows ${t.maxRows}.`),t.reelPixelHeight<=0&&e.push(`multiways({reelPixelHeight}) must be positive.`),this._reelPixelHeights&&e.push(`cannot combine multiways({reelPixelHeight}) with reelPixelHeights([...]). multiways slots use a uniform reel pixel height. Drop reelPixelHeights() or remove the multiways() configuration.`);for(let t of this._symbolRegistry.symbolIds){let n=this._symbolDataOverrides[t]??{};if(n.size&&(n.size.w>1||n.size.h>1)){e.push(`big symbol '${t}' (size ${n.size.w}x${n.size.h}) cannot be registered on a MultiWays slot. Drop multiways() or remove the size metadata.`);break}}}for(let t of this._symbolRegistry.symbolIds){let n=this._symbolDataOverrides[t]??{},r=n.size;if(!r||r.w===1&&r.h===1)continue;let i=n.weight??this._weights[t];i!==void 0&&i>0&&e.push(`big symbol '${t}' (size ${r.w}x${r.h}) must have weight 0. big symbols are placed by the server at anchor cells only and never enter random fill in v1. Set weight to 0 (or omit it) and place the symbol via setResult().`)}if(this._visibleRows!==void 0&&this._visibleRows<=0&&e.push(`visibleRows() must be called with a positive number.`),(this._symbolWidth===void 0||this._symbolHeight===void 0)&&e.push(`symbolSize() must be called with width and height.`),this._symbolRegistry.size===0&&e.push(`symbols() must register at least one symbol.`),this._ticker||e.push(`ticker() must be called with a PixiJS Ticker.`),this._speeds.size>0&&!this._speeds.has(this._initialSpeed)&&e.push(`initialSpeed '${this._initialSpeed}' does not match any registered speed profile. Available: ${[...this._speeds.keys()].join(`, `)}`),e.length>0)throw Error(`ReelSetBuilder validation failed:\n - ${e.join(`
1
+ const e=require(`./ReelSymbol-BxoiwQ-r.cjs`);let t=require(`pixi.js`);var n=class{_listeners=new Map;on(e,t,n){return this._add(e,t,n,!1)}once(e,t,n){return this._add(e,t,n,!0)}off(e,t,n){let r=this._listeners.get(e);if(!r)return this;if(!t)return this._listeners.delete(e),this;let i=r.filter(e=>e.fn!==t||n!==void 0&&e.context!==n);return i.length===0?this._listeners.delete(e):this._listeners.set(e,i),this}emit(e,...t){let n=this._listeners.get(e);if(!n||n.length===0)return!1;let r=n.slice();for(let n of r)n.once&&this._removeEntry(e,n),n.fn.apply(n.context,t);return!0}_removeEntry(e,t){let n=this._listeners.get(e);if(!n)return;let r=n.indexOf(t);r!==-1&&(n.splice(r,1),n.length===0&&this._listeners.delete(e))}removeAllListeners(e){return e===void 0?this._listeners.clear():this._listeners.delete(e),this}listenerCount(e){return this._listeners.get(e)?.length??0}_add(e,t,n,r){let i=this._listeners.get(e);return i||(i=[],this._listeners.set(e,i)),i.push({fn:t,context:n,once:r}),this}},r=class{_symbolHeight;_symbolGapY;_slotHeight;_minY;_maxY;constructor(e,t,n,r,i,a,o){this._symbols=e,this._bufferAbove=r,this._onSymbolWrapped=o,this._symbolHeight=t,this._symbolGapY=n,this._slotHeight=t+n,this._maxY=(i+a)*this._slotHeight,this._minY=-(this._bufferAbove+1)*this._slotHeight}displace(e){if(e!==0){for(let t of this._symbols)t.view.y+=e;e>0?this._wrapBottomToTop():this._wrapTopToBottom()}}snapToGrid(){for(let e=0;e<this._symbols.length;e++){let t=(e-this._bufferAbove)*this._slotHeight;this._symbols[e].view.y=t}}setToTopPosition(){for(let e=0;e<this._symbols.length;e++)this._symbols[e].view.y=this._minY-(this._symbols.length-e)*this._slotHeight}getRowY(e){return(e-this._bufferAbove)*this._slotHeight}get slotHeight(){return this._slotHeight}reshape(e,t,n,r,i){this._symbolHeight=e,this._symbolGapY=t,this._slotHeight=e+t,this._bufferAbove=n,this._maxY=(r+i)*this._slotHeight,this._minY=-(this._bufferAbove+1)*this._slotHeight}_wrapBottomToTop(){let e=this._symbols.length-1,t=this._symbols[e];if(t.view.y<this._maxY)return;let n=this._symbols[0];t.view.y=n.view.y-this._slotHeight,this._symbols.pop(),this._symbols.unshift(t),this._onSymbolWrapped(t,0,`up`)}_wrapTopToBottom(){let e=this._symbols[0];if(e.view.y>this._minY)return;let t=this._symbols[this._symbols.length-1];e.view.y=t.view.y+this._slotHeight,this._symbols.shift(),this._symbols.push(e),this._onSymbolWrapped(e,this._symbols.length-1,`down`)}},i=class{_frame=[];_remaining=0;setFrame(e){this._frame=[...e],this._remaining=this._frame.length}next(){return this._remaining>0?(this._remaining--,this._frame[this._remaining]):this._frame[0]??``}get hasRemaining(){return this._remaining>0}get remaining(){return this._remaining}reset(){this._frame=[],this._remaining=0}},a=class{name=`standard`;computeDeltaY(e,t,n){let r=e*t*n/1e3,i=e/2;return Math.max(Math.min(r,i),-i)}},o=100,s=class extends e.t{onActivate(){this.view.alpha=0,this.view.visible=!1}onDeactivate(){}async playWin(){}stopAnimation(){}resize(){}},c=`__pixi_reels_occupied__`,l=class{container;events;reelIndex;symbols;speed=0;spinningMode=new a;motion;stopSequencer;_symbolFactory;_randomProvider;_viewport;_symbolsData;_visibleRows;_bufferAbove;_symbolWidth;_symbolHeight;_offsetY;_reelHeight;_spinSymbolHeight;_symbolGapY;_symbolGapX;_isDestroyed=!1;_isStopping=!1;_isNudging=!1;_nudgeQueue=null;_nudgeTween=null;_nudgeReject=null;_occupiedStubs=[];_occupancy=[];_crossReelResolver=null;constructor(e,a,o,s){this.reelIndex=e.reelIndex,this._symbolFactory=a,this._randomProvider=o,this._viewport=s,this._symbolsData=e.symbolsData,this._visibleRows=e.visibleRows,this._bufferAbove=e.bufferAbove,this._symbolWidth=e.symbolWidth,this._symbolHeight=e.symbolHeight,this._offsetY=e.offsetY??0,this._reelHeight=e.reelHeight??e.visibleRows*e.symbolHeight,this._spinSymbolHeight=e.spinSymbolHeight??e.symbolHeight,this._symbolGapY=e.symbolGapY,this._symbolGapX=e.symbolGapX,this._occupancy=Array(e.visibleRows).fill(null),this.events=new n,this.stopSequencer=new i,this.container=new t.Container,this.container.sortableChildren=!0,this.container.x=e.reelIndex*(e.symbolWidth+e.symbolGapX),this.container.y=this._offsetY,this.container.zIndex=e.reelIndex,this.symbols=e.initialSymbols.map((t,n)=>{let r=a.acquire(t);return r.resize(e.symbolWidth,this._spinSymbolHeight),r}),this.motion=new r(this.symbols,this._spinSymbolHeight,e.symbolGapY,e.bufferAbove,e.visibleRows,e.bufferBelow,(e,t,n)=>this._onSymbolWrapped(e,t,n)),this._setupSymbolPositions(e)}get isDestroyed(){return this._isDestroyed}get isStopping(){return this._isStopping}set isStopping(e){this._isStopping=e}get isNudging(){return this._isNudging}get bufferAbove(){return this._bufferAbove}get bufferBelow(){return this.symbols.length-this._bufferAbove-this._visibleRows}get visibleRows(){return this._visibleRows}get symbolWidth(){return this._symbolWidth}get symbolHeight(){return this._symbolHeight}get reelHeight(){return this._reelHeight}get offsetY(){return this._offsetY}get spinSymbolHeight(){return this._spinSymbolHeight}update(e){if(this.speed===0)return;let t=Math.min(e,o),n=this.spinningMode.computeDeltaY(this.motion.slotHeight,this.speed,t);n!==0&&this.motion.displace(n)}setStopFrame(e){this.stopSequencer.setFrame(e)}getVisibleSymbols(){let e=[];for(let t=0;t<this._visibleRows;t++){let n=this._occupancy[t];if(n){let t=this.symbols[this._bufferAbove+n.anchorRow];e.push(t.symbolId)}else{let n=this.symbols[this._bufferAbove+t].symbolId;n===`__pixi_reels_occupied__`&&this._crossReelResolver?e.push(this._crossReelResolver(this.reelIndex,t)):e.push(n)}}return e}setCrossReelResolver(e){this._crossReelResolver=e}getSymbolAt(e){let t=this._occupancy[e],n=t?t.anchorRow:e;return this.symbols[this._bufferAbove+n]}getAnchorRow(e){let t=this._occupancy[e];return t?t.anchorRow:e}_setOccupancy(e,t){t===null?this._occupancy[e]=null:this._occupancy[e]={anchorRow:t}}notifySpinStart(){for(let e=this._bufferAbove;e<this._bufferAbove+this._visibleRows;e++)this.symbols[e].onReelSpinStart()}notifySpinEnd(){for(let e=this._bufferAbove;e<this._bufferAbove+this._visibleRows;e++)this.symbols[e].onReelSpinEnd()}notifyLanded(){for(let e=this._bufferAbove;e<this._bufferAbove+this._visibleRows;e++)this.symbols[e].onReelLanded()}snapToGrid(){this.motion.snapToGrid(),this._finalizeFrame(),this.refreshZIndex()}setSymbolAt(e,t){if(this.speed!==0||this._isStopping||this._isNudging)throw Error(`setSymbolAt: cannot swap mid-motion (speed=${this.speed}, isStopping=${this._isStopping}, isNudging=${this._isNudging}). Wait for the spin or nudge to land before calling, or use the result grid via setResult().`);if(!Number.isInteger(e)||e<0||e>=this._visibleRows)throw Error(`setSymbolAt: visibleRow ${e} is out of range [0, ${this._visibleRows}).`);if(!Object.prototype.hasOwnProperty.call(this._symbolsData,t))throw Error(`setSymbolAt: symbolId '${t}' is not registered. Register it via builder.symbols(...).`);let n=this._occupancy[e];if(n)throw Error(`setSymbolAt: visible row ${e} is a non-anchor cell of a big symbol (anchor at row ${n.anchorRow}). Use placeSymbols to rebuild the frame.`);let r=this._bufferAbove+e,i=this.symbols[r],a=this._symbolsData[i.symbolId];if(a?.size&&(a.size.w>1||a.size.h>1))throw Error(`setSymbolAt: row ${e} currently holds the anchor of big symbol '${i.symbolId}' (${a.size.w}x${a.size.h}). Big blocks span multiple cells (and possibly reels); use placeSymbols + the OCCUPIED coordinator instead.`);let o=this._symbolsData[t];if(o?.size&&(o.size.w>1||o.size.h>1))throw Error(`setSymbolAt: '${t}' is a big symbol (${o.size.w}x${o.size.h}). Use placeSymbols + the OCCUPIED coordinator instead.`);this._replaceSymbol(r,t)}async nudge(t,n){if(this._isDestroyed)throw Error(`nudge: reel has been destroyed.`);if(this.speed!==0||this._isStopping||this._isNudging)throw Error(`nudge: cannot nudge a reel in motion (speed=${this.speed}, isStopping=${this._isStopping}, isNudging=${this._isNudging}). Wait for the spin or previous nudge to land first.`);let{distance:r,direction:i,incoming:a,signal:o}=t;if(!Number.isInteger(r)||r<1)throw Error(`nudge: distance must be a positive integer, got ${r}.`);let c=this.symbols.length;if(r>=c)throw Error(`nudge: distance ${r} must be strictly less than total strip capacity (bufferAbove + visibleRows + bufferBelow = ${c}). At distance = total the strip rotates fully and pre-placed buffer entries would be silently dropped.`);if(i!==`up`&&i!==`down`)throw Error(`nudge: direction must be 'up' or 'down', got ${String(i)}.`);if(!Array.isArray(a)||a.length!==r)throw Error(`nudge: incoming must be an array of exactly ${r} symbol id(s), got length ${a?.length}.`);for(let e of a){if(!Object.prototype.hasOwnProperty.call(this._symbolsData,e))throw Error(`nudge: incoming symbol '${e}' is not registered. Register it via builder.symbols(...).`);let t=this._symbolsData[e];if(t?.size&&(t.size.w>1||t.size.h>1))throw Error(`nudge: incoming symbol '${e}' is a big symbol (${t.size.w}x${t.size.h}). Big symbols are not supported as incoming items (they need an anchor + OCCUPIED coordinator). Pre-existing big symbols on the strip CAN be nudged through.`)}for(let e=0;e<c;e++){let t=this.symbols[e];if(t instanceof s)continue;let n=this._symbolsData[t.symbolId];if(!n?.size)continue;let{w:a,h:o}=n.size;if(!(a===1&&o===1)){if(a>1)throw Error(`nudge: reel ${this.reelIndex} carries cross-reel big symbol '${t.symbolId}' (${a}x${o}) at strip[${e}]. Cross-reel blocks can't be nudged from a single reel. the other-reel cells would stay put and split the block.`);if(o>1&&!(i===`down`?e+o-1+r<c:e-r>=0)){let n=i===`down`?`anchor + h + distance < total (${e} + ${o} + ${r} = ${e+o+r} vs ${c})`:`anchor - distance >= 0 (${e} - ${r} = ${e-r})`;throw Error(`nudge: block '${t.symbolId}' (${a}x${o}) at strip[${e}] wouldn't survive a distance=${r} ${i} nudge. the wrap boundary would split the anchor from its stubs. Block survival: ${n}.`)}}}for(let e=0;e<this._visibleRows;e++)if(this.symbols[this._bufferAbove+e].symbolId===`__pixi_reels_occupied__`&&!this._occupancy[e])throw Error(`nudge: visible row ${e} is a non-anchor cell of a cross-reel big symbol. Cross-reel blocks can't be nudged from a single reel.`);if(o?.aborted){let e=Error(`nudge: aborted before start.`);throw e.name=`AbortError`,e}let l=t.startDelay??0;if(l>0&&(await new Promise((e,t)=>{let n=setTimeout(e,l);o&&o.addEventListener(`abort`,()=>{clearTimeout(n);let e=Error(`nudge: aborted during startDelay.`);e.name=`AbortError`,t(e)},{once:!0})}),this._isDestroyed)){let e=Error(`nudge: reel destroyed during startDelay.`);throw e.name=`AbortError`,e}let u=t.duration??200*r,d=t.ease??`power2.out`,f=this.motion.slotHeight,p=this._bufferAbove,m=this.bufferBelow,h=e=>{let t=this.symbols[e];if(t instanceof s)return!0;let n=this._symbolsData[t.symbolId];return!!(n?.size&&(n.size.w>1||n.size.h>1))};if(i===`down`){let e=Math.min(r,p);for(let t=0;t<e;t++){let n=p-e+t,i=r-e+t;h(n)||this._replaceSymbol(n,a[i])}let t=[],n=r-p;for(let e=1;e<=r;e++)e<=n?t.push(a[n-e]):t.push(this._randomProvider.next(!0));this._nudgeQueue=t}else{let e=Math.min(r,m);for(let t=0;t<e;t++){let e=p+this._visibleRows+t;h(e)||this._replaceSymbol(e,a[t])}let t=[],n=r-m;for(let e=1;e<=r;e++)e<=n?t.push(a[m+e-1]):t.push(this._randomProvider.next(!0));this._nudgeQueue=t}this.motion.snapToGrid(),this.refreshZIndex(),this._isNudging=!0,this.events.emit(`phase:enter`,`nudge`),n?.();let g=i===`down`?r*f:-r*f,_=f*.45,v=()=>{let e=this._nudgeQueue?.length??0;if(e>0){let t=e,n=i===`down`?_:-_;for(let e=0;e<t*3&&(this._nudgeQueue?.length??0)>0;e++)this.motion.displace(n)}this.snapToGrid(),this._isNudging=!1,this._nudgeQueue=null,this._nudgeTween=null,this._nudgeReject=null,this.events.emit(`phase:exit`,`nudge`)};try{await new Promise((t,n)=>{this._nudgeReject=n;let r=()=>{this._nudgeTween&&=(this._nudgeTween.kill(),null),v();let e=Error(`nudge: aborted.`);e.name=`AbortError`,n(e)};o&&o.addEventListener(`abort`,r,{once:!0});let a={p:0},s=0;this._nudgeTween=e.n().to(a,{p:1,duration:u/1e3,ease:d,onUpdate:()=>{let e=a.p*g,t=i===`down`?Math.min(e,g):Math.max(e,g),n=t-s;for(;Math.abs(n)>_;){let e=n>0?_:-_;this.motion.displace(e),n-=e}n!==0&&this.motion.displace(n),s=t},onComplete:()=>{o&&o.removeEventListener(`abort`,r),v(),t()}})})}catch(e){throw e}return{symbols:this.getVisibleSymbols()}}skipNudge(){if(!this._isNudging||!this._nudgeTween)return;let e=this._nudgeTween;this._nudgeTween=null,e.progress(1)}placeSymbols(e){let t=this.symbols.length,n=this._bufferAbove;for(let r=0;r<t;r++){let t;t=e[r-n],t===void 0&&(t=this._randomProvider.next(!0)),this._replaceSymbol(r,t)}this.motion.snapToGrid(),this._finalizeFrame(),this.refreshZIndex()}reshape(e,t,n,r){let i=n+e+r;for(;this.symbols.length<i;){let e=this._randomProvider.next(!0),n=this._symbolFactory.acquire(e);n.resize(this._symbolWidth,t),this._placeSymbolView(n.view,n.view.y,this._isUnmasked(e)),this._parentForSymbolId(e).addChild(n.view),this.symbols.push(n)}for(;this.symbols.length>i;){let e=this.symbols.pop();e instanceof s?e.view.parent?.removeChild(e.view):this._symbolFactory.release(e)}this._visibleRows=e,this._symbolHeight=t,this._bufferAbove=n,this._occupancy=Array(e).fill(null),this._reelHeight=e*t+(e-1)*this._symbolGapY;for(let e of this.symbols)e instanceof s||e.resize(this._symbolWidth,t);this.motion.reshape(t,this._symbolGapY,n,e,r),this.motion.snapToGrid(),this.refreshZIndex()}_computeSymbolZIndex(e,t){return(this._symbolsData[e]?.zIndex??0)*100+t}refreshZIndex(){for(let e=0;e<this.symbols.length;e++){let t=this.symbols[e];if(t instanceof s){t.view.zIndex=e;continue}t.view.zIndex=this._computeSymbolZIndex(t.symbolId,e)}}destroy(){if(!this._isDestroyed){if(this._nudgeTween&&=(this._nudgeTween.kill(),null),this._nudgeReject){let e=Error(`nudge: reel was destroyed.`);e.name=`AbortError`,this._nudgeReject(e),this._nudgeReject=null}this._nudgeQueue=null,this._isNudging=!1;for(let e of this.symbols)e.destroy();for(let e of this._occupiedStubs)e.isDestroyed||e.destroy();this._occupiedStubs=[],this.symbols=[],this.container.destroy({children:!0}),this._isDestroyed=!0,this.events.emit(`destroyed`),this.events.removeAllListeners()}}_isUnmasked(e){return!!this._symbolsData[e]?.unmask}_parentForSymbolId(e){return this._isUnmasked(e)?this._viewport.unmaskedContainer:this.container}_placeSymbolView(e,t,n){n?(e.x=this.container.x,e.y=this.container.y+t):(e.x=0,e.y=t)}_toReelLocalY(e){return e.parent===this._viewport.unmaskedContainer?e.y-this.container.y:e.y}_setupSymbolPositions(e){let t=this._spinSymbolHeight+e.symbolGapY;this._viewport.maskedContainer.addChild(this.container);for(let n=0;n<this.symbols.length;n++){let r=this.symbols[n],i=(n-e.bufferAbove)*t,a=this._isUnmasked(r.symbolId);this._placeSymbolView(r.view,i,a),this._parentForSymbolId(r.symbolId).addChild(r.view)}}_onSymbolWrapped(e,t,n){let r;r=this._nudgeQueue&&this._nudgeQueue.length>0?this._nudgeQueue.shift():this._isStopping&&this.stopSequencer.hasRemaining?this.stopSequencer.next():this._randomProvider.next(),this._replaceSymbol(this.symbols.indexOf(e),r),this._isNudging||this.refreshZIndex()}_replaceSymbol(e,t){let n=this.symbols[e],r=n instanceof s,i=r?n.view.y:this._toReelLocalY(n.view);if(t===`__pixi_reels_occupied__`){if(r){n.view.alpha=0;return}this._symbolFactory.release(n);let t=this._acquireOccupiedStub();t.view.y=i,t.view.x=0,t.view.alpha=0,t.view.visible=!0,t.view.scale.set(1,1),t.view.zIndex=e,t.view.parent!==this.container&&this.container.addChild(t.view),this.symbols[e]=t;return}if(r){this._releaseOccupiedStub(n);let r=this._symbolFactory.acquire(t),a=this._isUnmasked(t);r.resize(this._symbolWidth,this._symbolHeight),this._placeSymbolView(r.view,i,a),r.view.alpha=1,r.view.scale.set(1,1),r.view.zIndex=this._computeSymbolZIndex(t,e),this._parentForSymbolId(t).addChild(r.view),this.symbols[e]=r,this.events.emit(`symbol:created`,t,e);return}if(n.symbolId===t){n.view.alpha=1,n.view.scale.set(1,1),n.view.rotation=0,n.view.filters=null,n.view.zIndex=this._computeSymbolZIndex(t,e);let r=this._parentForSymbolId(t);n.view.parent!==r&&r.addChild(n.view),this._placeSymbolView(n.view,i,this._isUnmasked(t));return}this._symbolFactory.release(n);let a=this._symbolFactory.acquire(t),o=this._isUnmasked(t);a.resize(this._symbolWidth,this._symbolHeight),this._placeSymbolView(a.view,i,o),a.view.alpha=1,a.view.scale.set(1,1),a.view.zIndex=this._computeSymbolZIndex(t,e),this._parentForSymbolId(t).addChild(a.view),this.symbols[e]=a,this.events.emit(`symbol:created`,t,e)}_acquireOccupiedStub(){for(let e of this._occupiedStubs)if(!e.view.parent)return e;let e=new s;return e.activate(c),this._occupiedStubs.push(e),e}_releaseOccupiedStub(e){e.view.parent?.removeChild(e.view)}_finalizeFrame(){this._occupancy=Array(this._visibleRows).fill(null);for(let e=0;e<this._visibleRows;e++){let t=this.symbols[this._bufferAbove+e];if(t instanceof s)continue;let n=this._symbolsData[t.symbolId];if(!n?.size)continue;let r=n.size.w,i=n.size.h;if(r===1&&i===1)continue;let a=r*this._symbolWidth+(r-1)*this._symbolGapX,o=i*this._symbolHeight+(i-1)*this._symbolGapY;t.resize(a,o);for(let t=1;t<i;t++){let n=e+t;n<this._visibleRows&&(this._occupancy[n]={anchorRow:e})}}for(let e=0;e<this._bufferAbove;e++){let t=this.symbols[e];if(t instanceof s)continue;let n=this._symbolsData[t.symbolId];if(!n?.size)continue;let r=n.size.w,i=n.size.h;if(r===1&&i===1||e+i-1<this._bufferAbove)continue;let a=r*this._symbolWidth+(r-1)*this._symbolGapX,o=i*this._symbolHeight+(i-1)*this._symbolGapY;t.resize(a,o);let c=e-this._bufferAbove;for(let e=1;e<i;e++){let t=c+e;t>=0&&t<this._visibleRows&&(this._occupancy[t]={anchorRow:c})}}}},u=class{build(e,n,r){let i=new t.Graphics;return this._draw(i,e,n,r),i}update(e,t,n,r){e.clear(),this._draw(e,t,n,r)}_draw(e,t,n,r){if(t.length===0){e.rect(0,0,n,r).fill({color:16777215});return}for(let n of t)e.rect(n.x,n.y,n.width,n.height).fill({color:16777215})}},d=class{build(e,n,r){let i=new t.Graphics;return this._draw(i,e,n,r),i}update(e,t,n,r){e.clear(),this._draw(e,t,n,r)}_draw(e,t,n,r){e.rect(0,0,n,r).fill({color:16777215})}},f=class extends t.Container{maskedContainer;unmaskedContainer;spotlightContainer;dimOverlay;_mask;_maskStrategy;_maskWidth;_maskHeight;_maskRects=[];_isDestroyed=!1;_dimCount=0;constructor(e,n,r={x:0,y:0},i=new u){super(),this.x=r.x,this.y=r.y,this._maskStrategy=i,this._maskWidth=e,this._maskHeight=n,this._mask=this._maskStrategy.build(this._maskRects,e,n),this.maskedContainer=new t.Container,this.maskedContainer.sortableChildren=!0,this.maskedContainer.addChild(this._mask),this.maskedContainer.mask=this._mask,this.addChild(this.maskedContainer),this.unmaskedContainer=new t.Container,this.unmaskedContainer.sortableChildren=!0,this.addChild(this.unmaskedContainer),this.dimOverlay=new t.Graphics,this.dimOverlay.rect(0,0,e,n).fill({color:0,alpha:.5}),this.dimOverlay.visible=!1,this.addChild(this.dimOverlay),this.spotlightContainer=new t.Container,this.spotlightContainer.sortableChildren=!0,this.addChild(this.spotlightContainer)}get maskWidth(){return this._maskWidth}get maskHeight(){return this._maskHeight}get maskRects(){return this._maskRects}get maskGraphics(){return this._mask}get isDestroyed(){return this._isDestroyed}showDim(e=.5){this._dimCount++,this.dimOverlay.alpha=e,this.dimOverlay.visible=!0}hideDim(){this._dimCount>0&&this._dimCount--,this._dimCount===0&&(this.dimOverlay.visible=!1)}updateMaskSize(e,t,n=[]){this._maskWidth=e,this._maskHeight=t,this._maskRects=n,this._maskStrategy.update(this._mask,this._maskRects,e,t)}destroy(){this._isDestroyed||(this._isDestroyed=!0,super.destroy({children:!0}))}},p=class{_reel;_speed;_resolve=null;_isActive=!1;constructor(e,t){this._reel=e,this._speed=t}get reel(){return this._reel}get isActive(){return this._isActive}async run(e){return this._isActive=!0,this._reel.events.emit(`phase:enter`,this.name),new Promise(t=>{this._resolve=()=>{this._isActive=!1,this._reel.events.emit(`phase:exit`,this.name),t()},this.onEnter(e)})}skip(){!this.skippable||!this._isActive||(this.onSkip(),this._complete())}forceComplete(){this._isActive&&(this.onSkip(),this._complete())}_complete(){if(this._resolve){let e=this._resolve;this._resolve=null,e()}}},m=class extends p{name=`start`;skippable=!0;_tween=null;_delayedCall=null;onEnter(t){let n=this._reel;this._speed;let r=t.delay??0;n.spinningMode=t.spinningMode,n.speed=0,r>0?this._delayedCall=e.n().delayedCall(r/1e3,()=>this._launch()):this._launch()}_launch(){this._delayedCall=null;let t=this._reel,n=this._speed,r=(n.accelerationDuration??300)/1e3,i=n.accelerationEase??`power2.in`;this._tween=e.n().timeline(),n.bounceDistance>0&&this._tween.to(t,{speed:-2,duration:.05,ease:`power1.out`}),this._tween.to(t,{speed:n.spinSpeed,duration:r,ease:i,onComplete:()=>{t.notifySpinStart(),this._complete()}})}update(e){}onSkip(){this._kill(),this._reel.speed=this._speed.spinSpeed}_kill(){this._delayedCall&&=(this._delayedCall.kill(),null),this._tween&&=(this._tween.kill(),null)}},h=class extends p{name=`spin`;skippable=!1;_elapsed=0;_minTime=0;_readyToStop=!1;onEnter(e){this._elapsed=0,this._minTime=e.minimumSpinTime??this._speed.minimumSpinTime??500,this._readyToStop=!1}update(e){this._elapsed+=e,this._readyToStop&&this._elapsed>=this._minTime&&this._complete()}resolve(){this._readyToStop=!0,this._elapsed>=this._minTime&&this._complete()}onSkip(){}},g=class extends p{name=`stop`;skippable=!0;_config=null;_delayTween=null;_bounceTween=null;_stage=`delay`;_baseY=0;onEnter(t){this._config=t,this._stage=`delay`,this._baseY=this._reel.container.y;let n=(t.delay??0)/1e3;n>0?this._delayTween=e.n().delayedCall(n,()=>this._beginSpinOut()):this._beginSpinOut()}_beginSpinOut(){if(!this._config)return;let e=this._reel,t=this._speed;e.setStopFrame(this._config.targetFrame),e.isStopping=!0,e.speed=t.spinSpeed,this._stage=`spinning`}update(e){this._stage===`spinning`&&(this._reel.stopSequencer.hasRemaining||this._landAndBounce())}_landAndBounce(){let t=this._reel,n=this._speed;t.speed=0,t.isStopping=!1,t.snapToGrid(),t.notifySpinEnd(),t.notifyLanded();let r=n.bounceDistance;if(r<=0){this._stage=`done`,this._complete();return}let i=(n.bounceDuration??600)/2e3;this._stage=`bouncing`,this._bounceTween=e.n().timeline(),this._bounceTween.to(t.container,{y:this._baseY+r,duration:i,ease:`power1.out`}),this._bounceTween.to(t.container,{y:this._baseY,duration:i,ease:`power1.out`,onComplete:()=>{this._stage=`done`,this._complete()}})}onSkip(){this._killTweens();let e=this._reel;if(e.speed=0,e.isStopping=!1,this._stage!==`done`&&this._config){let t=e.bufferAbove,n=this._config.targetFrame,r=n.slice(t);for(let e=0;e<t;e++)r[e-t]=n[e];e.placeSymbols(r)}e.snapToGrid(),e.container.y=this._baseY,this._stage=`done`}_killTweens(){this._delayTween&&=(this._delayTween.kill(),null),this._bounceTween&&=(this._bounceTween.kill(),null)}},_=class extends p{name=`anticipation`;skippable=!0;_tween=null;onEnter(t){let n=this._reel,r=this._speed,i=(t.duration??r.anticipationDelay)/1e3,a=r.spinSpeed*(t.speedMultiplier??.3);if(i<=0){this._complete();return}this._tween=e.n().timeline(),this._tween.to(n,{speed:a,duration:i*.35,ease:`power2.out`}),this._tween.to({},{duration:i*.65,onComplete:()=>this._complete()})}update(e){}onSkip(){this._kill(),this._reel.speed=this._speed.spinSpeed}_kill(){this._tween&&=(this._tween.kill(),null)}},v=class{_registry=new Map;constructor(){this._registry.set(`start`,(e,t)=>new m(e,t)),this._registry.set(`spin`,(e,t)=>new h(e,t)),this._registry.set(`stop`,(e,t)=>new g(e,t)),this._registry.set(`anticipation`,(e,t)=>new _(e,t))}register(e,t){this._registry.set(e,(e,n)=>new t(e,n))}registerFactory(e,t){this._registry.set(e,t)}create(e,t,n){let r=this._registry.get(e);if(!r)throw Error(`Phase '${e}' not registered. Available: ${[...this._registry.keys()].join(`, `)}`);return r(t,n)}has(e){return this._registry.has(e)}},y=class{_callbacks=[];_isDestroyed=!1;constructor(e){this._ticker=e}get isDestroyed(){return this._isDestroyed}add(e){this._isDestroyed||(this._callbacks.push(e),this._ticker.add(e))}remove(e){let t=this._callbacks.indexOf(e);t!==-1&&(this._callbacks.splice(t,1),this._ticker.remove(e))}destroy(){if(!this._isDestroyed){for(let e of this._callbacks)this._ticker.remove(e);this._callbacks.length=0,this._isDestroyed=!0}}};function b(e){let t=[...e.visible];if(e.bufferBelow)for(let n=0;n<e.bufferBelow.length;n++){let r=e.bufferBelow[n];r!==void 0&&(t[e.visible.length+n]=r)}if(e.bufferAbove)for(let n=0;n<e.bufferAbove.length;n++){let r=e.bufferAbove[n];r!==void 0&&(t[-1-n]=r)}return t}function x(e,t,n,r){for(let i=0;i<e.length;i++){let a=t[i]??0,o=n[i]??0,s=e[i],c=S(s.bufferAbove),l=S(s.bufferBelow);if(c>=a)throw RangeError(`${r} column ${i}: bufferAbove has a symbol at index ${c}, beyond engine bufferSymbols=${a}; it would be silently dropped. Increase bufferSymbols(...) on the builder or remove the extra entry.`);if(l>=o)throw RangeError(`${r} column ${i}: bufferBelow has a symbol at index ${l}, beyond engine bufferSymbols=${o}; it would be silently dropped. Increase bufferSymbols(...) on the builder or remove the extra entry.`)}}function S(e){if(!e)return-1;for(let t=e.length-1;t>=0;t--)if(e[t]!==void 0)return t;return-1}var C=class{_reels;_speedManager;_frameBuilder;_phaseFactory;_events;_tickerRef;_spinningMode;_defaultSpinMode;_currentSpinMode=`standard`;_hooks;_isSpinning=!1;_spinStartTime=0;_resultSymbols=null;_anticipationReels=[];_stopDelayOverride=null;_activePhases=new Map;_landedReels=new Set;_heldReels=new Set;_wasSkipped=!1;_skipPending=!1;_isDestroyed=!1;_currentSpinResolve=null;_currentSpinReject=null;_pendingAbortError=null;_spinWatchdogCleanup=null;_spinGeneration=0;_skipStage=0;_skipPreviousSpeedName=null;_skipBoostedToName=null;_manualSpeedSinceBoost=!1;_autoSlamRefills=!1;constructor(e,t,n,r,i,o,s,c=`standard`,l){this._reels=e,this._speedManager=t,this._frameBuilder=n,this._phaseFactory=r,this._events=i,this._tickerRef=new y(o),this._spinningMode=s??new a,this._defaultSpinMode=c,this._hooks=l??{isMultiWaysSlot:!1,symbolsData:{},peekTargetShape:()=>null,clearTargetShape:()=>{},multiwaysReelPixelHeight:0,symbolGapY:0,getPinsOnReel:()=>[],migratePinsForReel:()=>[],refreshPinOverlaysForReel:()=>{},buildPinOverlayTweens:()=>[]},this._tickerRef.add(e=>this._onTick(e))}get isSpinning(){return this._isSpinning}get isDestroyed(){return this._isDestroyed}get skipStage(){return this._skipStage}async spin(e){if(this._isSpinning)throw Error(`Cannot start a new spin while one is in progress.`);if(e?.signal?.aborted)return Promise.reject(this._abortError(e.signal));let t=e?.mode??this._defaultSpinMode;if(t===`cascade`&&!this._phaseFactory.has(`cascade:fall`))throw Error(`spin({ mode: 'cascade' }) requires .tumble(...) on the builder.`);if(this._currentSpinMode=t,this._skipPreviousSpeedName!==null){let e=this._skipPreviousSpeedName;this._skipPreviousSpeedName=null,this._skipBoostedToName=null,!this._manualSpeedSinceBoost&&this._speedManager.activeName!==e&&this._speedManager.set(e)}this._manualSpeedSinceBoost=!1,this._skipStage=0,this._autoSlamRefills=!1,this._isSpinning=!0,this._wasSkipped=!1,this._skipPending=!1,this._pendingAbortError=null,this._spinStartTime=performance.now(),this._resultSymbols=null,this._anticipationReels=[],this._landedReels.clear(),this._activePhases.clear(),this._heldReels=this._normalizeHoldReels(e?.holdReels),this._spinGeneration++;let n=this._spinGeneration,r=this._speedManager.active;this._events.emit(`spin:start`);let i=new Promise((e,t)=>{this._currentSpinResolve=e,this._currentSpinReject=t});if(this._armSpinWatchdog(e,n),this._heldReels.size===this._reels.length)return Promise.resolve().then(()=>{n===this._spinGeneration&&this._finishSpin()}),i;for(let e=0;e<this._reels.length;e++)this._heldReels.has(e)||this._runReelTask(this._startReel(e,r,n),`spin`,e,n);return i}_runReelTask(e,t,n,r){e.catch(e=>{r===this._spinGeneration&&(console.error(`[pixi-reels] reel ${n} (${t}) phase chain threw. slamming to recover:`,e),this._slam())})}_normalizeHoldReels(e){let t=new Set;if(!e)return t;for(let n of e)Number.isInteger(n)&&n>=0&&n<this._reels.length&&t.add(n);return t}setResult(e){this._isSpinning&&(this._coordinateBigSymbols(e,e=>{let t=this._hooks.peekTargetShape();return t?t[e]:this._reels[e].visibleRows}),this._resultSymbols=e,this._tryBeginStopSequence(),this._skipPending&&(this._skipPending=!1,this._slam(),this._skipStage=2))}async refill(e){if(this._isSpinning)throw Error(`Cannot refill while a spin or refill is in progress.`);if(!this._phaseFactory.has(`cascade:place`))throw Error(`refill() requires .tumble(...) on the builder.`);let t=e.grid.map(b);if(t.length!==this._reels.length)throw RangeError(`refill: grid has ${t.length} column(s) but the reel set has ${this._reels.length}.`);for(let e=0;e<t.length;e++){let n=this._reels[e].visibleRows;if(t[e].length!==n)throw RangeError(`refill: grid column ${e} has ${t[e].length} row(s) but reel ${e} has ${n} visible row(s).`)}for(let t of e.winners){if(!Number.isInteger(t.reel)||t.reel<0||t.reel>=this._reels.length)throw RangeError(`refill: winner.reel ${t.reel} out of range [0, ${this._reels.length}).`);let e=this._reels[t.reel].visibleRows;if(!Number.isInteger(t.row)||t.row<0||t.row>=e)throw RangeError(`refill: winner.row ${t.row} out of range [0, ${e}) for reel ${t.reel}.`)}this._isSpinning=!0,this._wasSkipped=!1,this._skipPending=!1,this._pendingAbortError=null,this._spinStartTime=performance.now(),this._resultSymbols=null,this._anticipationReels=[],this._landedReels.clear(),this._activePhases.clear(),this._heldReels=new Set,this._spinGeneration++,this._currentSpinMode=`cascade`;let n=this._spinGeneration,r=this._speedManager.active;this._resultSymbols=t;let i=this._coordinateBigSymbols(t,e=>this._reels[e].visibleRows),a=[];for(let e=0;e<this._reels.length;e++){let t=this._reels[e];a.push(this._frameBuilder.build(e,t.visibleRows,t.bufferAbove,t.bufferBelow,i[e]))}this._cachedFrames=a;let o=new Map;for(let t of e.winners){let e=o.get(t.reel);e||(e=[],o.set(t.reel,e)),e.push(t.row)}for(let e of o.values())e.sort((e,t)=>e-t);this._events.emit(`spin:start`);let s=new Promise(e=>{this._currentSpinResolve=e,this._currentSpinReject=null});if(this._autoSlamRefills)return this._slam(),this._skipStage=2,s;if((e.mode??`combined`)===`gravity-then-drop`){let t=e.gravityHoldMs??250;this._refillTwoStage(r,n,o,t,e.gravityHold,e.onGravityComplete).catch(e=>{n===this._spinGeneration&&(this._events.emit(`cascade:gravity:error`,{error:e}),console.error(`[pixi-reels] two-stage refill threw (likely from a user-supplied gravityHold/onGravityComplete). slamming to recover:`,e),this._slam())})}else for(let e=0;e<this._reels.length;e++){let t=o.get(e)??[];this._runReelTask(this._refillReel(e,r,n,t),`refill`,e,n)}return s}async _refillReel(e,t,n,r){if(n!==this._spinGeneration)return;let i=this._reels[e],a=this._frameFor(e),o=this._stopDelayFor(e,t),s=this._phaseFactory.create(`cascade:place`,i,t);if(this._activePhases.set(e,s),await s.run({targetFrame:a,winnerRows:r,initial:!1,delay:o,events:this._events}),n!==this._spinGeneration)return;let c=this._phaseFactory.create(`cascade:dropIn`,i,t);this._activePhases.set(e,c),await c.run({winnerRows:r,initial:!1,events:this._events}),n===this._spinGeneration&&this._markLanded(e)}async _refillTwoStage(e,t,n,r,i,a){let o=this._reels.map(async(r,i)=>{if(t!==this._spinGeneration)return;let a=this._reels[i],o=this._frameFor(i),s=n.get(i)??[],c=this._phaseFactory.create(`cascade:place`,a,e);if(this._activePhases.set(i,c),await c.run({targetFrame:o,winnerRows:s,initial:!1,delay:0,events:this._events}),t!==this._spinGeneration)return;let l=this._phaseFactory.create(`cascade:dropIn`,a,e);this._activePhases.set(i,l),await l.run({winnerRows:s,initial:!1,role:`gravity`,events:this._events})});if(await Promise.all(o),t!==this._spinGeneration)return;let s=[];if(r>0&&s.push(new Promise(e=>setTimeout(e,r))),i&&s.push(typeof i==`function`?i():i),!(s.length>0&&(await Promise.all(s),t!==this._spinGeneration))&&!(a&&(await a(),t!==this._spinGeneration)))for(let r=0;r<this._reels.length;r++)this._runReelTask(this._refillReelDropInOnly(r,e,t,n.get(r)??[]),`refill`,r,t)}async _refillReelDropInOnly(e,t,n,r){if(n!==this._spinGeneration)return;let i=this._reels[e],a=this._stopDelayFor(e,t);if(a>0&&(await new Promise(e=>setTimeout(e,a)),n!==this._spinGeneration))return;let o=this._phaseFactory.create(`cascade:dropIn`,i,t);this._activePhases.set(e,o),await o.run({winnerRows:r,initial:!1,role:`new`,events:this._events}),n===this._spinGeneration&&this._markLanded(e)}setAnticipation(e){this._anticipationReels=e.filter(e=>!this._heldReels.has(e))}setStopDelays(e){this._stopDelayOverride=[...e]}requestSkip(){if(this._isSpinning){if(this._resultSymbols){this._slam(),this._skipStage=2;return}this._skipPending=!0}}skip(){if(this._isSpinning){if(!this._resultSymbols)throw Error(`skip() called before setResult(). there is nothing to land on yet (standard mode would land on random buffer fill; cascade mode would land invisible). Use reelSet.requestSkip() to queue the slam until setResult() arrives, or wait for setResult() before calling skip().`);if(this._skipStage===0)if(this._currentSpinMode===`cascade`)this._autoSlamRefills=!0;else{let e=this._findFastestSpeedName();if(e!==null&&e!==this._speedManager.activeName){let{previous:t,current:n}=this._speedManager.set(e);this._skipPreviousSpeedName=t.name,this._skipBoostedToName=n.name,this._events.emit(`skip:boosted`,{previous:t,current:n})}}this._slam(),this._skipStage=2}}slamStop(){this._isSpinning&&(this._slam(),this._skipStage=2)}_slam(){if(this._isSpinning){this._wasSkipped=!0,this._events.emit(`skip:requested`);for(let[,e]of this._activePhases)e.forceComplete();if(this._activePhases.clear(),this._spinGeneration++,this._resultSymbols){let e=this._hooks.peekTargetShape(),t=this._coordinateBigSymbols(this._resultSymbols,t=>e?e[t]:this._reels[t].visibleRows);for(let n=0;n<this._reels.length;n++){if(this._landedReels.has(n)||this._heldReels.has(n))continue;let r=this._reels[n];r.speed=0,r.isStopping=!1,this._hooks.isMultiWaysSlot&&e&&this._applyReshape(n,e[n]),r.placeSymbols(t[n]),r.notifySpinEnd(),r.notifyLanded(),this._markLanded(n)}}else for(let e=0;e<this._reels.length;e++){if(this._landedReels.has(e)||this._heldReels.has(e))continue;let t=this._reels[e];t.speed=0,t.isStopping=!1,t.snapToGrid(),t.notifySpinEnd(),t.notifyLanded(),this._markLanded(e)}this._events.emit(`skip:completed`)}}notifyManualSpeedChange(){this._manualSpeedSinceBoost=!0}_findFastestSpeedName(){let e=this._speedManager.profileNames;if(e.length<2)return null;let t=null,n=-1/0;for(let r of e){let e=this._speedManager.getProfile(r);e&&e.spinSpeed>n&&(n=e.spinSpeed,t=r)}return t}destroy(){this._isDestroyed||=(this._clearSpinWatchdog(),this._tickerRef.destroy(),this._activePhases.clear(),!0)}_targetCellHeightFor(e,t){return this._hooks.multiwaysReelPixelHeight<=0?e.symbolHeight:(this._hooks.multiwaysReelPixelHeight-(t-1)*this._hooks.symbolGapY)/t}_applyReshape(e,t){let n=this._reels[e],r=this._targetCellHeightFor(n,t),i=n.visibleRows;return t===i&&r===n.symbolHeight?!1:(this._events.emit(`adjust:start`,{reelIndex:e,fromRows:i,toRows:t}),n.reshape(t,r,n.bufferAbove,n.bufferBelow),this._hooks.refreshPinOverlaysForReel(e),this._events.emit(`adjust:complete`,{reelIndex:e}),!0)}async _startReel(e,t,n){if(n!==this._spinGeneration)return;let r=this._reels[e],i=this._currentSpinMode===`cascade`;if(i){let n=this._phaseFactory.create(`cascade:fall`,r,t);this._activePhases.set(e,n),await n.run({spinningMode:this._spinningMode,delay:e*t.spinDelay,events:this._events})}else{let n=this._phaseFactory.create(`start`,r,t);this._activePhases.set(e,n),await n.run({spinningMode:this._spinningMode,delay:e*t.spinDelay})}if(n!==this._spinGeneration)return;let a=this._phaseFactory.create(`spin`,r,t);this._activePhases.set(e,a);let o=a.run({}),s=!0;for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e))continue;let t=this._activePhases.get(e);if(!t||t.name!==`spin`){s=!1;break}}if(s&&(this._events.emit(`spin:allStarted`),this._tryBeginStopSequence()),await o,n!==this._spinGeneration||this._hooks.isMultiWaysSlot&&this._phaseFactory.has(`adjust`)&&(await this._runAdjustForReel(r,e,t,n),n!==this._spinGeneration))return;let c=this._stopDelayFor(e,t),l=this._frameFor(e);if(this._anticipationReels.includes(e)&&t.anticipationDelay>0){this._events.emit(`spin:stopping`,e);let i=this._phaseFactory.create(`anticipation`,r,t);if(this._activePhases.set(e,i),await i.run({}),n!==this._spinGeneration)return}else this._events.emit(`spin:stopping`,e);if(i){let i=this._phaseFactory.create(`cascade:place`,r,t);if(this._activePhases.set(e,i),await i.run({targetFrame:l,winnerRows:[],initial:!0,delay:c,events:this._events}),n!==this._spinGeneration)return;let a=this._phaseFactory.create(`cascade:dropIn`,r,t);if(this._activePhases.set(e,a),await a.run({winnerRows:[],initial:!0,events:this._events}),n!==this._spinGeneration)return}else{let i=this._phaseFactory.create(`stop`,r,t);if(this._activePhases.set(e,i),await i.run({targetFrame:l,delay:c}),n!==this._spinGeneration)return}this._markLanded(e)}async _runAdjustForReel(e,t,n,r){let i=this._hooks.peekTargetShape(),a=i?i[t]:e.visibleRows,o=this._targetCellHeightFor(e,a),s=this._hooks.buildPinOverlayTweens(t,o,this._hooks.symbolGapY);if(!this._applyReshape(t,a)&&s.length===0||s.length===0)return;let c=this._phaseFactory.create(`adjust`,e,n);this._activePhases.set(t,c),await c.run({pinOverlays:s})}_stopDelayFor(e,t){return this._stopDelayOverride?this._stopDelayOverride[e]??0:e*t.stopDelay}_cachedFrames=null;_frameFor(e){return this._cachedFrames?this._cachedFrames[e]:[]}_tryBeginStopSequence(){if(!this._resultSymbols)return;for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e))continue;let t=this._activePhases.get(e);if(!t||t.name!==`spin`)return}let e=this._hooks.peekTargetShape(),t=t=>e?e[t]:this._reels[t].visibleRows,n=this._coordinateBigSymbols(this._resultSymbols,t),r=[];for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e)){r.push([]);continue}let i=this._reels[e],a=t(e);r.push(this._frameBuilder.build(e,a,i.bufferAbove,i.bufferBelow,n[e]))}this._cachedFrames=r;for(let e=0;e<this._reels.length;e++){if(this._heldReels.has(e))continue;let t=this._activePhases.get(e);t?.resolve&&t.resolve()}}_coordinateBigSymbols(e,t){let n=this._reels[0]?.bufferAbove??0,r=this._reels[0]?.bufferBelow??0,i=e.map(e=>{let t=[...e];for(let r=1;r<=n;r++){let n=e[-r];n!==void 0&&(t[-r]=n)}return t}),a=this._hooks.symbolsData,o=(e,t)=>i[e][t],s=(e,t,n)=>{let r=i[e];r[t]=n};for(let e=0;e<i.length;e++){let l=t(e);for(let u=-n;u<l+r;u++){let n=o(e,u);if(n===void 0)continue;let d=a[n];if(!d?.size)continue;let f=d.size.w,p=d.size.h;if(!(f===1&&p===1)){if(u+p>l+r)throw Error(`big symbol '${n}' (${f}x${p}) at (col=${e}, row=${u}) extends past the bottom of the strip on reel ${e} (anchor row + h = ${u+p} > visibleRows + bufferBelow = ${l+r}).`);if(e+f>i.length)throw Error(`big symbol '${n}' (${f}x${p}) at (col=${e}, row=${u}) exceeds reel count ${i.length}.`);for(let i=0;i<f;i++){let a=e+i,o=t(a);if(u+p>o+r)throw Error(`big symbol '${n}' (${f}x${p}) at (col=${e}, row=${u}) extends past the bottom of the strip on reel ${a} (anchor row + h = ${u+p} > visibleRows + bufferBelow = ${o+r}).`)}for(let t=0;t<p;t++)for(let n=0;n<f;n++)n===0&&t===0||s(e+n,u+t,c)}}}return i}_markLanded(e){if(this._landedReels.has(e))return;this._landedReels.add(e);let t=this._reels[e],n=t.getVisibleSymbols();t.events.emit(`landed`,n),this._events.emit(`spin:reelLanded`,e,n),this._landedReels.size===this._reels.length-this._heldReels.size&&this._finishSpin()}_armSpinWatchdog(e,t){this._clearSpinWatchdog();let n=e?.signal,r=e?.timeoutMs;if(!n&&(r===void 0||r<=0))return;let i=[];if(n){let e=()=>{t===this._spinGeneration&&this._abortSpin(this._abortError(n))};n.addEventListener(`abort`,e),i.push(()=>n.removeEventListener(`abort`,e))}if(r!==void 0&&r>0){let e=setTimeout(()=>{t===this._spinGeneration&&this._abortSpin(Error(`spin() exceeded its ${r}ms watchdog without landing. setResult() / requestSkip() / slamStop() was never called (most often a failed or timed-out server request). The reels have been force-stopped.`))},r);i.push(()=>clearTimeout(e))}this._spinWatchdogCleanup=()=>{for(let e of i)e()}}_clearSpinWatchdog(){this._spinWatchdogCleanup&&=(this._spinWatchdogCleanup(),null)}_abortError(e){let t=e.reason;return t instanceof Error?t:typeof t==`string`&&t.length>0?Error(t):Error(`spin() was aborted via SpinOptions.signal before the reels landed.`)}_abortSpin(e){this._isSpinning&&(this._clearSpinWatchdog(),this._pendingAbortError=e,this._slam())}_finishSpin(){this._clearSpinWatchdog();let e=this._pendingAbortError;if(e){this._pendingAbortError=null,this._isSpinning=!1,this._activePhases.clear(),this._cachedFrames=null,this._hooks.clearTargetShape();let t=this._currentSpinReject;this._currentSpinResolve=null,this._currentSpinReject=null,t&&t(e);return}let t={symbols:this._reels.map(e=>e.getVisibleSymbols()),wasSkipped:this._wasSkipped,duration:performance.now()-this._spinStartTime};this._isSpinning=!1,this._activePhases.clear(),this._cachedFrames=null,this._hooks.clearTargetShape(),this._events.emit(`spin:allLanded`,t),this._events.emit(`spin:complete`,t),this._currentSpinResolve&&=(this._currentSpinResolve(t),null),this._currentSpinReject=null}_onTick(e){if(!this._isSpinning)return;let t=e.deltaMS;for(let e of this._reels)e.update(t);for(let e of this._activePhases.values())e.isActive&&e.update(t)}},w=class{_profiles=new Map;_activeName;_active;constructor(e,t){for(let[t,n]of e)this._profiles.set(t,n);let n=this._profiles.get(t);if(!n)throw Error(`Speed profile '${t}' not found. Available: ${[...this._profiles.keys()].join(`, `)}`);this._activeName=t,this._active=n}get active(){return this._active}get activeName(){return this._activeName}set(e){let t=this._profiles.get(e);if(!t)throw Error(`Speed profile '${e}' not found. Available: ${[...this._profiles.keys()].join(`, `)}`);let n=this._active;return this._activeName=e,this._active=t,{previous:n,current:t}}addProfile(e,t){this._profiles.set(e,t)}getProfile(e){return this._profiles.get(e)}get profileNames(){return[...this._profiles.keys()]}},T=class{_reels;_viewport;_promoted=[];_isActive=!1;_isDestroyed=!1;_cycleAbort=null;constructor(e,t){this._reels=e,this._viewport=t}get isActive(){return this._isActive}get isDestroyed(){return this._isDestroyed}async show(e,t={}){this.hide(),await this._showInternal(e,t)}async _showInternal(e,t={}){let{dimAmount:n=.5,playWinAnimation:r=!0,promoteAboveMask:i=!0}=t;this._isActive=!0,this._viewport.showDim(n);let a=[],o=new Set;for(let t of e){let e=this._reels[t.reelIndex];if(!e)continue;let n=e.getSymbolAt(t.rowIndex);if(!n)continue;let s=`${t.reelIndex}:${e.getAnchorRow(t.rowIndex)}`;if(!o.has(s)){if(o.add(s),i){let e=n.view.parent;this._promoted.push({symbol:n,originalParent:e,position:t});let r=n.view.getGlobalPosition();this._viewport.spotlightContainer.addChild(n.view);let i=this._viewport.spotlightContainer.toLocal(r);n.view.x=i.x,n.view.y=i.y}r&&a.push(n.playWin())}}a.length>0&&await Promise.all(a)}hide(){this._cycleAbort&&=(this._cycleAbort.abort(),null),this._teardownVisual()}_teardownVisual(){for(let{symbol:e,originalParent:t}of this._promoted)if(e.view.parent===this._viewport.spotlightContainer){if(t){let n=e.view.getGlobalPosition();t.addChild(e.view);let r=t.toLocal(n);e.view.x=r.x,e.view.y=r.y}e.stopAnimation()}this._promoted=[],this._viewport.hideDim(),this._isActive=!1}async cycle(e,t={}){let{displayDuration:n=2e3,gapDuration:r=300,cycles:i=1}=t;if(e.length===0)return;this.hide();let a=new AbortController;this._cycleAbort=a;let o=a.signal,s=0;for(;i===-1||s<i;){for(let i of e){if(o.aborted||(await this._showInternal(i.positions,t),await this._wait(n,o),o.aborted))return;this._teardownVisual(),await this._wait(r,o)}s++}this._cycleAbort===a&&(this._cycleAbort=null)}destroy(){this._isDestroyed||=(this.hide(),!0)}_wait(e,t){return new Promise(n=>{if(t.aborted){n();return}let r=setTimeout(n,e);t.addEventListener(`abort`,()=>{clearTimeout(r),n()},{once:!0})})}};function E(e,t){return`${e}:${t}`}var D=class r extends t.Container{static PIN_OVERLAY_Z_INDEX=1e4;_events=new n;_reels;_viewport;_spinController;_speedManager;_spotlight;_symbolFactory;_frameBuilder;_frameAPI;_isDestroyed=!1;_pins=new Map;_pinOverlays=new Map;_targetShape=null;_resultSetForCurrentSpin=!1;_isMultiWaysSlot;_nudgesInFlight=0;_multiwaysMinRows=0;_multiwaysMaxRows=0;_multiwaysReelPixelHeight=0;_symbolsData;_configGapX;constructor(e){super(),this._reels=e.reels,this._viewport=e.viewport,this._symbolFactory=e.symbolFactory,this._frameBuilder=e.frameBuilder,this._symbolsData=e.config.symbols,this._configGapX=e.config.grid.symbolGap.x,this._isMultiWaysSlot=!!e.config.grid.multiways,e.config.grid.multiways&&(this._multiwaysMinRows=e.config.grid.multiways.minRows,this._multiwaysMaxRows=e.config.grid.multiways.maxRows,this._multiwaysReelPixelHeight=e.config.grid.multiways.reelPixelHeight);for(let e of this._reels)e.setCrossReelResolver((e,t)=>{let n=this.getSymbolFootprint(e,t),r=this._reels[n.anchor.col];return r.symbols[r.bufferAbove+n.anchor.row].symbolId});let t=this._frameBuilder;this._frameAPI={use(e){t.use(e)},remove(e){t.remove(e)},get middleware(){return t.middleware}},this._speedManager=new w(e.config.speeds,e.config.initialSpeed),this._spinController=new C(e.reels,this._speedManager,e.frameBuilder,e.phaseFactory,this._events,e.config.ticker,e.spinningMode,e.defaultSpinMode,{isMultiWaysSlot:this._isMultiWaysSlot,symbolsData:this._symbolsData,peekTargetShape:()=>this.peekTargetShape(),clearTargetShape:()=>this.clearTargetShape(),multiwaysReelPixelHeight:this._multiwaysReelPixelHeight,symbolGapY:e.config.grid.symbolGap.y,getPinsOnReel:e=>this._pinsOnReel(e),migratePinsForReel:(e,t)=>this._migratePinsForReel(e,t),refreshPinOverlaysForReel:e=>this.refreshPinOverlaysForReel(e),buildPinOverlayTweens:(e,t,n)=>this._buildPinOverlayTweens(e,t,n)}),this._spotlight=new T(e.reels,e.viewport),this.addChild(this._viewport),this._events.on(`spin:allLanded`,()=>this._onSpinLanded()),this._events.on(`spin:start`,()=>this._onSpinStart())}get events(){return this._events}async spin(e){return this._assertNoNudgeInFlight(`spin`),this._spinController.spin(e)}setResult(e){this._assertNoNudgeInFlight(`setResult`),x(e,this._reels.map(e=>e.bufferAbove),this._reels.map(e=>e.bufferBelow),`setResult`);let t=this._applyPinsToGrid(this._cloneTargets(e));this._resultSetForCurrentSpin=!0,this._spinController.setResult(t.map(b))}async refill(e){let t=performance.now(),n=!1,r=()=>{n=!0};this._events.on(`skip:requested`,r);let i=()=>{n=!0,this._spinController.isSpinning&&this._spinController.slamStop()};e.signal&&(e.signal.aborted?i():e.signal.addEventListener(`abort`,i,{once:!0}));try{let r=await this._spinController.refill(e);return{winnersRefilled:e.winners.length,finalGrid:r.symbols,wasSkipped:n||r.wasSkipped,duration:performance.now()-t}}finally{this._events.off(`skip:requested`,r),e.signal&&e.signal.removeEventListener(`abort`,i)}}async destroySymbols(e,t){if(e.length===0)return;let n=(e,n)=>{let r=t?.delay;return typeof r==`function`?r(e,n):r??0};for(let t of e){if(t.reel<0||t.reel>=this._reels.length)throw RangeError(`destroySymbols: cell.reel ${t.reel} out of range [0, ${this._reels.length})`);let e=this._reels[t.reel];if(t.row<0||t.row>=e.visibleRows)throw RangeError(`destroySymbols: cell.row ${t.row} out of range [0, ${e.visibleRows}) for reel ${t.reel}`)}let r=t?.dim;r&&this._viewport.showDim(typeof r==`number`?r:.35);let i=t?.zIndex===void 0?1e3:t.zIndex,a=t?.signal;this._events.emit(`cascade:destroy:start`,{cells:e});try{let t=await Promise.allSettled(e.map((e,t)=>{let r=this._reels[e.reel].getSymbolAt(e.row);return i!==null&&(r.view.zIndex=i),r.playDestroy({delay:n(e,t),signal:a})})),r=[];for(let n=0;n<t.length;n++)t[n].status===`rejected`&&(r.push(e[n]),console.warn(`[pixi-reels] destroySymbols: cell (${e[n].reel}, ${e[n].row}) playDestroy rejected:`,t[n].reason));this._events.emit(`cascade:destroy:end`,r.length>0?{cells:e,failed:r}:{cells:e})}finally{r&&this._viewport.hideDim()}}async runCascade(e){let t=e.pauseAfterDestroyMs??250,n=e.maxChain??32,r=!1,i=()=>{r=!0};this._events.on(`skip:requested`,i);let a=()=>{r=!0,this._spinController.isSpinning&&this._spinController.slamStop()};e.signal&&(e.signal.aborted?a():e.signal.addEventListener(`abort`,a,{once:!0}));let o=0,s=0,c=this.getVisibleGrid();try{for(;o<n&&!r;){let n=await e.detectWinners(c,o);if(n.length===0)break;s+=n.length;let i=o+1;this._events.emit(`cascade:chain:start`,{chain:i,winners:n,currentGrid:c});let a=e.destroyOptions?.signal?e.destroyOptions:{...e.destroyOptions,signal:e.signal};if(await this.destroySymbols(n,a),r||e.onCascade&&(await e.onCascade({chain:i,winners:n,currentGrid:c}),r)||t>0&&(await new Promise(n=>{let r=setTimeout(n,t);if(!e.signal)return;let i=()=>{clearTimeout(r),n()};e.signal.aborted?i():e.signal.addEventListener(`abort`,i,{once:!0})}),r))break;let l=await e.nextGrid(c,n,o);if(r)break;let u=e.refillMode??`combined`,d=l.length===0?[]:Array.isArray(l[0])?l.map(e=>({visible:e})):l;await this.refill({winners:[...n],grid:d,mode:u,gravityHoldMs:e.gravityHoldMs,gravityHold:e.gravityHold?()=>e.gravityHold({chain:i,winners:n}):void 0,onGravityComplete:e.onGravityComplete?()=>e.onGravityComplete({chain:i,winners:n}):void 0}),o+=1,c=this.getVisibleGrid(),this._events.emit(`cascade:chain:end`,{chain:i,winners:n,nextGrid:c})}}finally{this._events.off(`skip:requested`,i),e.signal&&e.signal.removeEventListener(`abort`,a)}return{chainLength:o,totalWinners:s,finalGrid:c,wasSkipped:r}}setAnticipation(e){this._spinController.setAnticipation(e)}setStopDelays(e){this._spinController.setStopDelays(e)}skipSpin(){this._spinController.skip()}requestSkip(){this._spinController.requestSkip()}slamStop(){this._spinController.slamStop()}get skipStage(){return this._spinController.skipStage}setSymbolAt(e,t,n){if(e<0||e>=this._reels.length)throw RangeError(`setSymbolAt: col ${e} out of range [0, ${this._reels.length})`);if(this._pins.has(E(e,t)))throw Error(`setSymbolAt: cell (${e}, ${t}) has an active pin. Call unpin(col, row) first if you intend to overwrite it.`);this._reels[e].setSymbolAt(t,n)}async nudge(e,t){if(this._spinController.isSpinning)throw Error(`nudge: cannot nudge while a spin or refill is in progress.`);if(!Number.isInteger(e)||e<0||e>=this._reels.length)throw RangeError(`nudge: col ${e} out of range [0, ${this._reels.length}).`);for(let t of this._pins.values())if(t.col===e)throw Error(`nudge: reel ${e} has an active pin at row ${t.row}. Call unpin(${e}, ${t.row}) first if you intend to nudge through it.`);this._nudgesInFlight++;try{let n=await this._reels[e].nudge(t,()=>{this._events.emit(`nudge:start`,{reelIndex:e,distance:t.distance,direction:t.direction})});return this._events.emit(`nudge:complete`,{reelIndex:e,distance:t.distance,direction:t.direction,symbols:n.symbols}),n}catch(n){throw n instanceof Error&&n.name===`AbortError`&&!this._isDestroyed&&this._events.emit(`nudge:cancelled`,{reelIndex:e,distance:t.distance,direction:t.direction,reason:n.message}),n}finally{this._nudgesInFlight--}}_assertNoNudgeInFlight(e){if(this._nudgesInFlight>0)throw Error(`ReelSet.${e}: cannot be called while nudge() is in flight. Await the nudge() promise before calling ${e}.`)}skipNudge(e){if(e===void 0){for(let e of this._reels)e.isNudging&&e.skipNudge();return}if(!Number.isInteger(e)||e<0||e>=this._reels.length)throw RangeError(`skipNudge: col ${e} out of range [0, ${this._reels.length}).`);this._reels[e].skipNudge()}setDropOrder(e,t){if(Array.isArray(e)){this._spinController.setStopDelays(e);return}let n=this._reels.length,r=t??Math.max(this._speedManager.active.stopDelay,150),i;i=e===`all`?Array(n).fill(0):e===`ltr`?Array.from({length:n},(e,t)=>t*r):Array.from({length:n},(e,t)=>(n-1-t)*r),this._spinController.setStopDelays(i)}get isSpinning(){return this._spinController.isSpinning}get isMultiWaysSlot(){return this._isMultiWaysSlot}setShape(e){if(this._assertNoNudgeInFlight(`setShape`),!this._isMultiWaysSlot)throw Error(`setShape(): slot was not built with .multiways(...). call ReelSetBuilder.multiways() first.`);if(this._resultSetForCurrentSpin)throw Error(`setShape(): must be called BEFORE setResult() in the current spin. Calling setShape after setResult corrupts the cached frames (pins were overlaid at their pre-migration rows). Reorder: spin() → setShape() → setResult().`);if(e.length!==this._reels.length)throw Error(`setShape(): rowsPerReel length ${e.length} must equal reelCount ${this._reels.length}.`);for(let t=0;t<e.length;t++){let n=e[t];if(n<this._multiwaysMinRows||n>this._multiwaysMaxRows)throw Error(`setShape(): rowsPerReel[${t}] = ${n} out of range [${this._multiwaysMinRows}, ${this._multiwaysMaxRows}].`)}let t=!0;for(let n=0;n<this._reels.length;n++)if(this._reels[n].visibleRows!==e[n]){t=!1;break}if(!t){this._targetShape=[...e],this._events.emit(`shape:changed`,[...e]);for(let t=0;t<this._reels.length;t++)this._migratePinsForReel(t,e[t])}}peekTargetShape(){return this._targetShape}clearTargetShape(){this._targetShape=null}getVisibleGrid(){return this._reels.map(e=>e.getVisibleSymbols())}getSymbolFootprint(e,t){if(e<0||e>=this._reels.length)throw RangeError(`getSymbolFootprint: col ${e} out of range [0, ${this._reels.length})`);let n=this._reels[e];if(t<0||t>=n.visibleRows)throw RangeError(`getSymbolFootprint: row ${t} out of range [0, ${n.visibleRows})`);let r=n.getAnchorRow(t),i=n.getSymbolAt(t),a=this._symbolsData[i.symbolId],o=a?.size&&(a.size.w>1||a.size.h>1)?a.size:{w:1,h:1},s=e;for(let t=e-1;t>=0;t--){let n=this._reels[t];if(r>=n.visibleRows)break;let i=n.getAnchorRow(r),a=n.getSymbolAt(r),o=this._symbolsData[a.symbolId];if(o?.size&&o.size.w>e-t)return s=t,{anchor:{col:s,row:i},size:o.size}}return{anchor:{col:s,row:r},size:o}}getBlockBounds(e,t){let n=this.getSymbolFootprint(e,t),r=this._reels[n.anchor.col],i=this._configGapX,a=r.motion.slotHeight,o=r.symbolWidth,s=r.symbolHeight,c=a-s,l=n.anchor.row;return{x:this._viewport.x+r.container.x,y:this._viewport.y+r.offsetY+l*a,width:n.size.w*o+(n.size.w-1)*i,height:n.size.h*s+(n.size.h-1)*c}}get speed(){return this._speedManager}setSpeed(e){let{previous:t,current:n}=this._speedManager.set(e);this._events.emit(`speed:changed`,n,t),this._spinController.notifyManualSpeedChange()}get spotlight(){return this._spotlight}get reels(){return this._reels}getReel(e){return this._reels[e]}getCellBounds(e,t){if(e<0||e>=this._reels.length)throw RangeError(`getCellBounds: col ${e} out of range [0, ${this._reels.length})`);let n=this._reels[e];if(t<0||t>=n.visibleRows)throw RangeError(`getCellBounds: row ${t} out of range [0, ${n.visibleRows})`);return{x:this._viewport.x+n.container.x,y:this._viewport.y+n.offsetY+t*n.motion.slotHeight,width:n.symbolWidth,height:n.symbolHeight}}get viewport(){return this._viewport}pin(e,t,n,r){if(this._assertNoNudgeInFlight(`pin`),e<0||e>=this._reels.length)throw Error(`pin(): col ${e} out of range [0, ${this._reels.length})`);let i=this._reels[e];if(t<0||t>=i.visibleRows)throw Error(`pin(): row ${t} out of range [0, ${i.visibleRows})`);let a={col:e,row:t,originRow:r?.originRow??t,migration:r?.migration??`origin`,symbolId:n,turns:r?.turns??`permanent`,payload:r?.payload},o=E(e,t);return this._pins.has(o)&&this._destroyPinOverlay(o),this._pins.set(o,a),this._spinController.isSpinning?this._ensurePinOverlay(a):this._applyPinVisually(e,t,n),this._events.emit(`pin:placed`,a),a}unpin(e,t){let n=E(e,t),r=this._pins.get(n);r&&(this._pins.delete(n),this._destroyPinOverlay(n),this._events.emit(`pin:expired`,r,`explicit`))}get pins(){return this._pins}getPin(e,t){return this._pins.get(E(e,t))}async movePin(t,n,r){if(this._spinController.isSpinning)throw Error(`movePin(): cannot move pin while spinning`);let i=E(t.col,t.row),a=this._pins.get(i);if(!a)throw Error(`movePin(): no pin at (${t.col}, ${t.row})`);if(n.col<0||n.col>=this._reels.length)throw Error(`movePin(): to col ${n.col} out of range [0, ${this._reels.length})`);let o=this._reels[n.col];if(n.row<0||n.row>=o.visibleRows)throw Error(`movePin(): to row ${n.row} out of range [0, ${o.visibleRows})`);if(t.col===n.col&&t.row===n.row){this._events.emit(`pin:moved`,a,{col:t.col,row:t.row});return}let s=E(n.col,n.row);if(this._pins.has(s))throw Error(`movePin(): a pin already exists at (${n.col}, ${n.row})`);this._pins.delete(i);let c={...a,col:n.col,row:n.row,originRow:n.row};this._pins.set(s,c),this._destroyPinOverlay(i);let l=this._reels[t.col],u=l.getSymbolAt(t.row).view.y,d=o.getSymbolAt(n.row).view.y,f=l.container.x,p=o.container.x,m=r?.backfill??this._frameBuilder.randomProvider.next(!1),h=l.getVisibleSymbols();h[t.row]=m,l.placeSymbols(h);let g=this._symbolFactory.acquire(a.symbolId);g.resize(l.symbolWidth,l.symbolHeight),g.view.x=f,g.view.y=u,this._viewport.unmaskedContainer.addChild(g.view);try{r?.onFlightCreated?.(g)}catch(e){console.error(`[pixi-reels] movePin onFlightCreated hook threw. continuing the flight to avoid leaking the flight symbol:`,e)}let _=(r?.duration??400)/1e3,v=r?.easing??`power2.inOut`;await new Promise(t=>{e.n().to(g.view,{x:p,y:d,duration:_,ease:v,onComplete:()=>t()})});try{r?.onFlightCompleted?.(g)}catch(e){console.error(`[pixi-reels] movePin onFlightCompleted hook threw. continuing cleanup:`,e)}let y=o.getVisibleSymbols();y[n.row]=a.symbolId,o.placeSymbols(y),this._viewport.unmaskedContainer.removeChild(g.view),this._symbolFactory.release(g),this._events.emit(`pin:moved`,c,{col:t.col,row:t.row})}get frame(){return this._frameAPI}get isDestroyed(){return this._isDestroyed}destroy(){if(!this._isDestroyed){this._isDestroyed=!0,this._spotlight.destroy(),this._spinController.destroy();for(let e of this._reels)e.destroy();this._destroyAllPinOverlays(),this._symbolFactory.destroy(),this._viewport.destroy(),this._pins.clear(),this._events.emit(`destroyed`),this._events.removeAllListeners(),super.destroy({children:!0})}}_applyPinsToGrid(e){for(let t of this._pins.values()){let n=e[t.col];n&&t.row<n.visible.length&&(n.visible[t.row]=t.symbolId)}return e}_cloneTargets(e){return e.map(e=>({visible:[...e.visible],bufferAbove:e.bufferAbove?[...e.bufferAbove]:void 0,bufferBelow:e.bufferBelow?[...e.bufferBelow]:void 0}))}_pinsOnReel(e){let t=[];for(let n of this._pins.values())n.col===e&&t.push(n);return t}_migratePinsForReel(e,t){let n=[],r=this._pinsOnReel(e).sort((e,t)=>e.row-t.row),i=new Set,a=[];for(let e of r){let n=e.row,r,o,s=e.originRow;if(e.migration===`frozen`?n<t?(r=n,o=!1):(r=t-1,o=!0,s=r):(r=Math.min(e.originRow,t-1),o=r!==e.originRow),r===n&&s===e.originRow){i.add(n);continue}a.push({pin:e,fromRow:n,target:r,clamped:o,nextOriginRow:s})}for(let{pin:t,fromRow:r,target:o,clamped:s,nextOriginRow:c}of a){let a=E(t.col,r);if(i.has(o)){this._pins.delete(a),this._destroyPinOverlay(a),this._events.emit(`pin:expired`,t,`collision`);continue}i.add(o);let l=E(t.col,o);this._pins.delete(a);let u={...t,row:o,originRow:c};this._pins.set(l,u);let d=this._pinOverlays.get(a);d&&(this._pinOverlays.delete(a),this._pinOverlays.set(l,{pin:u,overlay:d.overlay})),n.push({pin:u,fromRow:r,toRow:o,clamped:s}),this._events.emit(`pin:migrated`,u,{fromRow:r,toRow:o,clamped:s,reelIndex:e})}return n}_pinOverlayCellY(e,t,n){return e.container.y+t*n}_applyPinVisually(e,t,n){let r=this._reels[e],i=r.getVisibleSymbols();i[t]!==n&&(i[t]=n,r.placeSymbols(i))}_onSpinLanded(){if(this._destroyAllPinOverlays(),this._pins.size===0)return;let e=[];for(let t of this._pins.values())typeof t.turns==`number`&&(--t.turns,t.turns<=0&&e.push(t));for(let t of e)this._pins.delete(E(t.col,t.row)),this._events.emit(`pin:expired`,t,`turns`)}_onSpinStart(){if(this._resultSetForCurrentSpin=!1,this._pins.size>0){let e=[];for(let t of this._pins.values())t.turns===`eval`&&e.push(t);for(let t of e)this._pins.delete(E(t.col,t.row)),this._events.emit(`pin:expired`,t,`eval`)}for(let e of this._pins.values())this._ensurePinOverlay(e)}_ensurePinOverlay(e){let t=E(e.col,e.row);if(this._pinOverlays.has(t))return;let n=this._reels[e.col],i=this._symbolFactory.acquire(e.symbolId);i.resize(n.symbolWidth,n.symbolHeight),i.view.x=n.container.x,i.view.y=this._pinOverlayCellY(n,e.row,n.motion.slotHeight),i.view.zIndex=r.PIN_OVERLAY_Z_INDEX,this._viewport.unmaskedContainer.addChild(i.view),this._pinOverlays.set(t,{pin:e,overlay:i}),this._events.emit(`pin:overlayCreated`,e,i)}refreshPinOverlaysForReel(e){let t=this._reels[e];for(let[,n]of this._pinOverlays){if(n.pin.col!==e)continue;let{pin:r,overlay:i}=n;i.resize(t.symbolWidth,t.symbolHeight),i.view.x=t.container.x,i.view.y=this._pinOverlayCellY(t,r.row,t.motion.slotHeight)}}_buildPinOverlayTweens(e,t,n){let r=this._reels[e],i=[],a=t+n;for(let[,n]of this._pinOverlays){if(n.pin.col!==e)continue;let{pin:o,overlay:s}=n;i.push({symbol:s,cellWidth:r.symbolWidth,oldCellHeight:r.symbolHeight,newCellHeight:t,fromY:s.view.y,toY:this._pinOverlayCellY(r,o.row,a),x:r.container.x})}return i}_destroyPinOverlay(e){let t=this._pinOverlays.get(e);if(!t)return;let{pin:n,overlay:r}=t;this._events.emit(`pin:overlayDestroyed`,n,r),this._viewport.unmaskedContainer.removeChild(r.view),this._symbolFactory.release(r),this._pinOverlays.delete(e)}_destroyAllPinOverlays(){let e=[...this._pinOverlays.keys()];for(let t of e)this._destroyPinOverlay(t)}},O={bufferSymbols:1,symbolGap:{x:0,y:0},initialSpeed:`normal`,maxPoolPerKey:20,zIndexStep:100},k={NORMAL:{name:`normal`,spinDelay:100,spinSpeed:30,stopDelay:140,anticipationDelay:450,bounceDistance:56,bounceDuration:600,accelerationEase:`power2.in`,decelerationEase:`power2.out`,accelerationDuration:300,minimumSpinTime:500},TURBO:{name:`turbo`,spinDelay:30,spinSpeed:50,stopDelay:0,anticipationDelay:250,bounceDistance:42,bounceDuration:200,accelerationEase:`power2.in`,decelerationEase:`power2.out`,accelerationDuration:200,minimumSpinTime:300},SUPER_TURBO:{name:`superTurbo`,spinDelay:0,spinSpeed:80,stopDelay:0,anticipationDelay:0,bounceDistance:14,bounceDuration:120,accelerationEase:`power1.in`,decelerationEase:`power1.out`,accelerationDuration:50,minimumSpinTime:100}},A=class{_entries=new Map;register(e,t,n){if(this._entries.has(e))throw Error(`Symbol '${e}' is already registered.`);this._entries.set(e,{SymbolClass:t,options:n})}create(e){let t=this._entries.get(e);if(!t)throw Error(`Symbol '${e}' is not registered. Available: ${[...this._entries.keys()].join(`, `)}`);let n=new t.SymbolClass(t.options);return n.activate(e),n}has(e){return this._entries.has(e)}get symbolIds(){return[...this._entries.keys()]}get size(){return this._entries.size}},j=class{_pools=new Map;_pooled=new Set;_isDestroyed=!1;constructor(e,t,n,r=20){this._factory=e,this._reset=t,this._dispose=n,this._maxPerKey=r}get isDestroyed(){return this._isDestroyed}acquire(e){if(this._isDestroyed)throw Error(`ObjectPool.acquire('${e}') called after destroy(). A ticker or promise callback is still running past teardown; cancel it before destroying the pool.`);let t=this._pools.get(e);if(t&&t.length>0){let e=t.pop();return this._pooled.delete(e),this._reset?.(e),e}return this._factory(e)}release(e,t){if(this._isDestroyed||this._pooled.has(t))return;let n=this._pools.get(e);if(n||(n=[],this._pools.set(e,n)),n.length>=this._maxPerKey){this._dispose?.(t);return}n.push(t),this._pooled.add(t)}size(e){return this._pools.get(e)?.length??0}get totalSize(){let e=0;for(let t of this._pools.values())e+=t.length;return e}clear(){if(this._dispose)for(let e of this._pools.values())for(let t of e)this._dispose(t);this._pools.clear(),this._pooled.clear()}destroy(){this._isDestroyed||=(this.clear(),!0)}},M=class{_pool;_capacityPerKey;constructor(e,t=20){this._registry=e,this._capacityPerKey=t,this._pool=new j(e=>this._registry.create(e),e=>e.reset(),e=>e.destroy(),t)}get capacityPerKey(){return this._capacityPerKey}acquire(e){let t=this._pool.acquire(e);return t.symbolId!==e&&t.activate(e),t}release(e){let t=e.symbolId;e.deactivate(),this._pool.release(t,e)}destroy(){this._pool.destroy()}},N=class{_symbols;_weights;_cumulativeWeights=[];_totalWeight=0;_excludeSpinning=new Set;_excludeBuffer=new Set;_rng;constructor(e,t=Math.random){this._rng=t,this._symbols=Object.keys(e),this._weights=this._symbols.map(t=>e[t].weight),this._rebuildWeights(),this._assertUsable()}next(e=!1){let t=e?new Set([...this._excludeSpinning,...this._excludeBuffer]):this._excludeSpinning;if(t.size===0)return this._pickWeighted();let n=0,r=[];for(let e=0;e<this._symbols.length;e++)t.has(this._symbols[e])||(n+=this._weights[e],r.push({id:this._symbols[e],cumWeight:n}));if(n===0||r.length===0){for(let e of this._symbols)if(!t.has(e))return e;return this._symbols[0]}let i=this._rng()*n,a=0,o=r.length-1;for(;a<o;){let e=a+o>>1;r[e].cumWeight<=i?a=e+1:o=e}return r[a].id}setExcludeSpinning(e){this._excludeSpinning=new Set(e)}setExcludeBuffer(e){this._excludeBuffer=new Set(e)}updateWeights(e){this._symbols=Object.keys(e),this._weights=this._symbols.map(t=>e[t].weight),this._rebuildWeights(),this._assertUsable();let t=new Set(this._symbols);this._excludeSpinning=new Set([...this._excludeSpinning].filter(e=>t.has(e))),this._excludeBuffer=new Set([...this._excludeBuffer].filter(e=>t.has(e)))}_assertUsable(){if(this._symbols.length===0)throw Error(`RandomSymbolProvider requires at least one symbol.`);if(this._totalWeight<=0)throw Error(`RandomSymbolProvider requires at least one symbol with weight > 0; all registered symbols have weight 0, so the spinning strip cannot be filled.`)}_rebuildWeights(){this._cumulativeWeights=[],this._totalWeight=0;for(let e of this._weights)this._totalWeight+=e,this._cumulativeWeights.push(this._totalWeight)}_pickWeighted(){let e=this._rng()*this._totalWeight,t=0,n=this._cumulativeWeights.length-1;for(;t<n;){let r=t+n>>1;this._cumulativeWeights[r]<=e?t=r+1:n=r}return this._symbols[t]}},P=class{_middlewares=[];_sorted=!1;constructor(e){this._randomProvider=e,this.use(new F(e)),this.use(new I)}use(e){return this._middlewares.push(e),this._sorted=!1,this}remove(e){return this._middlewares=this._middlewares.filter(t=>t.name!==e),this}build(e,t,n,r,i,a=!1){this._sorted||=(this._middlewares.sort((e,t)=>e.priority-t.priority),!0);let o=n+t+r,s={reelIndex:e,visibleRows:t,bufferAbove:n,bufferBelow:r,symbols:Array(o).fill(``),targetSymbols:i,isSpinning:a,metadata:{}},c=0,l=()=>{c<this._middlewares.length&&this._middlewares[c++].process(s,l)};return l(),s.symbols}buildAll(e,t,n,r,i,a=!1){return Array.from({length:e},(e,o)=>this.build(o,t,n,r,i?.[o],a))}get randomProvider(){return this._randomProvider}get middleware(){return this._middlewares}},F=class{name=`random-fill`;priority=0;constructor(e){this._provider=e}process(e,t){for(let t=0;t<e.symbols.length;t++)if(!e.symbols[t]){let n=t<e.bufferAbove||t>=e.bufferAbove+e.visibleRows;e.symbols[t]=this._provider.next(n)}t()}},I=class{name=`target-placement`;priority=10;process(e,t){if(e.targetSymbols)for(let t=-e.bufferAbove;t<e.targetSymbols.length;t++){let n=e.bufferAbove+t;e.targetSymbols[t]&&n<e.symbols.length&&(e.symbols[n]=e.targetSymbols[t])}t()}},L=class{_offsets=[];constructor(e,t,n,r){this._reelCount=e,this._totalRows=t,this._symbolWidth=n,this._config=r,this._compute()}getOffset(e,t){return this._offsets[e]?.[t]??0}get offsets(){return this._offsets}_compute(){if(this._config.mode===`none`){this._offsets=Array.from({length:this._reelCount},()=>Array(this._totalRows).fill(0));return}let e=this._config,t=(this._reelCount-1)/2;this._offsets=[];for(let n=0;n<this._reelCount;n++){let r=this._reelCount>1?(n-t)/(this._reelCount/2):0,i=[];for(let t=0;t<this._totalRows;t++){let n=this._totalRows>1?t/(this._totalRows-1):.5,a=r*e.widthDifference*e.topWidthFactor,o=a+(r*e.widthDifference*e.bottomWidthFactor-a)*n;i.push(o)}this._offsets.push(i)}}};function R(e){return{fall:{duration:e?.fall?.duration??300,ease:e?.fall?.ease??`sine.in`,rowStagger:e?.fall?.rowStagger??0,rowOrder:e?.fall?.rowOrder??`bottomToTop`},dropIn:{duration:e?.dropIn?.duration??600,ease:e?.dropIn?.ease??`power2.out`,rowStagger:e?.dropIn?.rowStagger??60,rowOrder:e?.dropIn?.rowOrder??`bottomToTop`,distance:e?.dropIn?.distance??`perHole`}}}function z(e,t){return t?{duration:t.duration??e.duration,ease:t.ease??e.ease,rowStagger:t.rowStagger??e.rowStagger,rowOrder:t.rowOrder??e.rowOrder}:e}function B(e,t){return t?{duration:t.duration??e.duration,ease:t.ease??e.ease,rowStagger:t.rowStagger??e.rowStagger,rowOrder:t.rowOrder??e.rowOrder,distance:t.distance??e.distance}:e}var V=class extends p{name=`cascade:fall`;skippable=!0;_baseFall;_fall;_timeline=null;_delayedCall=null;_fallingViews=[];_events=null;_startEmitted=!1;_skipAbort=null;constructor(e,t,n){super(e,t),this._baseFall=n,this._fall=n}onEnter(t){let n=this._reel;n.spinningMode=t.spinningMode,n.speed=0,n.notifySpinStart(),this._fall=z(this._baseFall,this._speed.tumble?.fall),this._events=t.events,this._startEmitted=!1,this._skipAbort=new AbortController;let r=(t.delay??0)/1e3;r>0?this._delayedCall=e.n().delayedCall(r,()=>this._beginFall(t.events)):this._beginFall(t.events)}_beginFall(t){this._delayedCall=null;let n=this._reel,r=n.motion.slotHeight,i=n.visibleRows,a=n.reelIndex,o=(i+n.bufferBelow+1)*r,s=this._fall.duration/1e3,c=this._fall.rowStagger/1e3,l=[],u=[],d=[];for(let e=0;e<i;e++){let t=n.getSymbolAt(e);l.push(t),u.push(t.view),d.push(t.view.y)}if(this._fallingViews=u,t.emit(`cascade:fall:start`,{reelIndex:a}),this._startEmitted=!0,s<=0){for(let e of u)e.alpha=0;t.emit(`cascade:fall:end`,{reelIndex:a}),this._fallingViews=[],this._startEmitted=!1,this._events=null,this._skipAbort=null,this._complete();return}let f=e.n().timeline({onComplete:()=>{this._timeline=null;for(let e of u)e.alpha=0;this._fallingViews=[],t.emit(`cascade:fall:end`,{reelIndex:a}),this._startEmitted=!1,this._events=null,this._skipAbort=null,this._complete()}});this._timeline=f;let p=this._fall.rowOrder===`bottomToTop`;for(let e=0;e<i;e++){let n=u[e],r=l[e],m=d[e],h=(p?i-1-e:e)*c;f.call(()=>{let i=this._skipAbort?.signal;i&&t.emit(`cascade:fall:symbol`,{symbol:r,view:n,reelIndex:a,rowIndex:e,duration:this._fall.duration,ease:this._fall.ease,distance:o,signal:i})},void 0,h),f.to(n,{y:m+o,duration:s,ease:this._fall.ease},h)}}update(e){}onSkip(){this._kill();for(let e of this._fallingViews)e.alpha=0;this._fallingViews=[],this._skipAbort&&!this._skipAbort.signal.aborted&&this._skipAbort.abort(),this._skipAbort=null,this._startEmitted&&this._events&&this._events.emit(`cascade:fall:end`,{reelIndex:this._reel.reelIndex}),this._startEmitted=!1,this._events=null}_kill(){this._delayedCall&&=(this._delayedCall.kill(),null),this._timeline&&=(this._timeline.kill(),null)}};function H(e,t,n={}){let r=n.initial??!1,i=r?e:t.length,a=r?new Set:new Set(t),o=[];for(let t=0;t<e;t++)a.has(t)||o.push(t);let s=[];for(let t=0;t<e;t++){let e;e=t<i?t-i:o[t-i],s.push({row:t,originalRow:e,offsetRows:t-e})}return s}var U=class extends p{name=`cascade:place`;skippable=!0;_config=null;_delayedCall=null;onEnter(t){this._config=t;let n=(t.delay??0)/1e3;n>0?this._delayedCall=e.n().delayedCall(n,()=>this._doPlace()):this._doPlace()}_placement(e){let t=this._reel.bufferAbove,n=e.slice(t,t+this._reel.visibleRows);for(let r=1;r<=t;r++)n[-r]=e[t-r];return n}_doPlace(){if(this._delayedCall=null,!this._config)return;let e=this._reel,{targetFrame:t,events:n}=this._config;e.placeSymbols(this._placement(t)),e.snapToGrid(),e.notifySpinEnd();let r=H(e.visibleRows,this._config.winnerRows,{initial:this._config.initial}),i=[],a=new Set;for(let t of r){let n=e.getAnchorRow(t.row);if(n!==t.row&&a.has(n))continue;a.add(n);let r=e.getSymbolAt(t.row);r.view.visible=!0,r.view.alpha=+(t.offsetRows===0),i.push(r)}n.emit(`cascade:place:end`,{reelIndex:e.reelIndex,placedSymbols:i,isInitial:this._config.initial,winnerRows:this._config.winnerRows}),this._complete()}update(e){}onSkip(){if(this._delayedCall&&=(this._delayedCall.kill(),null),this._config){let e=this._reel;e.placeSymbols(this._placement(this._config.targetFrame));for(let t=0;t<e.visibleRows;t++){let n=e.getSymbolAt(t).view;n.alpha=1,n.visible=!0}}}},W=class extends p{name=`cascade:dropIn`;skippable=!0;_baseDrop;_drop;_timeline=null;_jobs=[];_events=null;_endEvent=`cascade:dropIn:end`;_skipAbort=null;constructor(e,t,n){super(e,t),this._baseDrop=n,this._drop=n}onEnter(t){let n=this._reel,r=n.visibleRows,i=n.motion.slotHeight,a=t.events,o=n.reelIndex,s=t.role??`all`;this._drop=B(this._baseDrop,this._speed.tumble?.dropIn),this._skipAbort=new AbortController;let c=s===`gravity`?`cascade:gravity:start`:`cascade:dropIn:start`,l=s===`gravity`?`cascade:gravity:symbol`:`cascade:dropIn:symbol`,u=s===`gravity`?`cascade:gravity:end`:`cascade:dropIn:end`;this._events=a,this._endEvent=u,a.emit(c,{reelIndex:o});let d=H(r,t.winnerRows,{initial:t.initial}),f=[],p=new Set;for(let e of d){let a=n.getAnchorRow(e.row);if(a!==e.row&&p.has(a))continue;p.add(a);let o=n.getSymbolAt(e.row);if(e.offsetRows===0){o.view.visible=!0,o.view.alpha=1;continue}let c=o.view.y,l;switch(this._drop.distance){case`auto`:l=!t.initial&&e.originalRow>=0?e.originalRow*i:c-r*i;break;case`perHole`:l=e.originalRow*i;break;default:l=c-this._drop.distance}let u=e.originalRow<0;if(s===`gravity`&&u||s===`new`&&!u){s===`gravity`&&u?(o.view.alpha=0,o.view.visible=!0):s===`new`&&!u&&(o.view.y=c,o.view.alpha=1,o.view.visible=!0);continue}o.view.y=l,o.view.alpha=1,o.view.visible=!0,f.push({row:e.row,symbol:o,view:o.view,startY:l,finalY:c,offsetRows:e.offsetRows})}this._jobs=f;let m=()=>{this._timeline=null,this._jobs=[],a.emit(u,{reelIndex:o}),this._events=null,this._skipAbort=null,s!==`gravity`&&n.notifyLanded(),this._complete()},h=this._drop.duration/1e3,g=this._drop.rowStagger/1e3;if(f.length===0||h<=0){for(let e of f)e.view.y=e.finalY;m();return}let _=e.n().timeline({onComplete:m});this._timeline=_;let v=this._drop.rowOrder===`bottomToTop`;for(let e=0;e<f.length;e++){let t=f[e],n=(v?f.length-1-e:e)*g;_.call(()=>{let e=this._skipAbort?.signal;e&&a.emit(l,{symbol:t.symbol,view:t.view,reelIndex:o,rowIndex:t.row,duration:this._drop.duration,ease:this._drop.ease,offsetRows:t.offsetRows,signal:e})},void 0,n),_.to(t.view,{y:t.finalY,duration:h,ease:this._drop.ease},n)}}update(e){}onSkip(){this._timeline&&=(this._timeline.kill(),null);for(let e of this._jobs)e.view.y=e.finalY,e.view.alpha=1,e.view.visible=!0;this._jobs=[];let e=this._reel;for(let t=0;t<e.visibleRows;t++){let n=e.getSymbolAt(t);n.view.alpha=1,n.view.visible=!0}this._skipAbort&&!this._skipAbort.signal.aborted&&this._skipAbort.abort(),this._skipAbort=null,this._events&&=(this._events.emit(this._endEvent,{reelIndex:this._reel.reelIndex}),null)}},ee=class extends p{name=`adjust`;skippable=!0;_durationMs;_ease;_tween=null;_settle=null;constructor(e,t,n){super(e,t),this._durationMs=n.durationMs,this._ease=n.ease??`power2.out`}onEnter(t){let n=t.pinOverlays;if(n.length===0){this._complete();return}if(this._durationMs<=0){this._snapPinOverlays(n),this._complete();return}for(let e of n)e.symbol.resize(e.cellWidth,e.newCellHeight),e.symbol.view.x=e.x,e.symbol.view.y=e.fromY,e.symbol.view.scale.y=e.newCellHeight>0?e.oldCellHeight/e.newCellHeight:1,e.symbol.view.scale.x=1;this._settle=()=>{for(let e of n)e.symbol.view.scale.set(1,1),e.symbol.view.y=e.toY,e.symbol.view.x=e.x};let r=this._durationMs/1e3,i=this._ease;this._tween=e.n().timeline({onComplete:()=>{this._settle?.(),this._settle=null,this._tween=null,this._complete()}});for(let e of n)this._tween.to(e.symbol.view,{y:e.toY,duration:r,ease:i},0),this._tween.to(e.symbol.view.scale,{y:1,duration:r,ease:i},0)}update(e){}onSkip(){this._tween&&=(this._tween.progress(1),this._tween.kill(),null),this._settle&&=(this._settle(),null)}_snapPinOverlays(e){for(let t of e)t.symbol.resize(t.cellWidth,t.newCellHeight),t.symbol.view.x=t.x,t.symbol.view.y=t.toY,t.symbol.view.scale.set(1,1)}},te=class t{_reelCount;_visibleRows;_symbolWidth;_symbolHeight;_symbolGap={...O.symbolGap};_bufferSymbols=O.bufferSymbols;_symbolRegistry=new A;_weights={};_speeds=new Map;_initialSpeed=O.initialSpeed;_offset={mode:`none`};_ticker;_spinningMode=new a;_phaseFactory=new v;_middlewares=[];_initialFrame;_symbolDataOverrides={};_tumbleConfig;_defaultSpinMode=`standard`;_visibleRowsPerReel;_reelPixelHeights;_reelAnchor=`center`;_multiways;_pinMigrationDuration=200;_pinMigrationEase=`power2.out`;_maskStrategy=new u;_maskStrategyExplicit=!1;_rng=Math.random;_poolCapacity;reels(e){return this._reelCount=e,this}visibleRows(e){return this._visibleRows=e,this}visibleRowsPerReel(e){return this._visibleRowsPerReel=[...e],this}reelPixelHeights(e){return this._reelPixelHeights=[...e],this}reelAnchor(e){return this._reelAnchor=e,this}maskStrategy(e){if(e==null||typeof e.build!=`function`||typeof e.update!=`function`)throw Error(`maskStrategy(): expected a MaskStrategy with build(...) and update(...) methods (e.g. new RectMaskStrategy() or new SharedRectMaskStrategy()).`);return this._maskStrategy=e,this._maskStrategyExplicit=!0,this}multiways(e){return this._multiways={...e},this}pinMigrationDuration(e){return this._pinMigrationDuration=e,this}pinMigrationEase(e){return this._pinMigrationEase=e,this}symbolSize(e,t){return this._symbolWidth=e,this._symbolHeight=t,this}symbolGap(e,t){return this._symbolGap={x:e,y:t},this}bufferSymbols(e){return!Number.isFinite(e)||e<1?(t._bufferWarnedThisProcess||(t._bufferWarnedThisProcess=!0,console.warn(`[pixi-reels] bufferSymbols(${e}) is below the minimum of 1; clamping to 1. The motion layer needs at least one buffer row above and below the visible window for wrap detection.`)),this._bufferSymbols=1,this):(this._bufferSymbols=e,this)}static _bufferWarnedThisProcess=!1;symbols(e){return e(this._symbolRegistry),this}weights(e){return this._weights=e,this}symbolData(e){return this._symbolDataOverrides={...this._symbolDataOverrides,...e},this}speed(e,t){return this._speeds.set(e,t),this}initialSpeed(e){return this._initialSpeed=e,this}offsetConfig(e){return this._offset=e,this}ticker(e){return this._ticker=e,this}rng(e){return this._rng=e,this}poolCapacity(e){return this._poolCapacity=e,this}gsap(t){return e.r(t),this}spinningMode(e){return this._spinningMode=e,this}frameMiddleware(e){return this._middlewares.push(e),this}phases(e){return e(this._phaseFactory),this}tumble(e){return this._tumbleConfig=R(e),this._defaultSpinMode=`cascade`,this}initialFrame(e){return this._initialFrame=e,this}build(){this._validate();let e=this._reelCount,t=this._symbolWidth,n=this._symbolHeight,r=this._bufferSymbols,i=this._bufferSymbols,a=this._ticker,o=!!this._multiways,s;if(o)s=Array(e).fill(this._multiways.maxRows);else if(this._visibleRowsPerReel)s=this._visibleRowsPerReel;else{let t=this._visibleRows;s=Array(e).fill(t)}let c;c=o?Array(e).fill(this._multiways.reelPixelHeight):this._reelPixelHeights?this._reelPixelHeights:s.map(e=>e*n+(e-1)*this._symbolGap.y);let u=Math.max(...c),p=c.map(e=>{switch(this._reelAnchor){case`top`:return 0;case`bottom`:return u-e;default:return(u-e)/2}}),m=c.map((e,t)=>{let n=s[t];return(e-(n-1)*this._symbolGap.y)/n}),h=n,g=o?Array(e).fill(h):m;this._speeds.size===0&&this._speeds.set(`normal`,k.NORMAL);let _={},v=this._symbolRegistry.symbolIds;for(let e of v){let t=this._symbolDataOverrides[e]??{};_[e]={weight:t.weight??this._weights[e]??10,zIndex:t.zIndex??1,unmask:t.unmask,size:t.size}}let y={grid:{reelCount:e,visibleRows:this._visibleRows??s[0],symbolWidth:t,symbolHeight:n,symbolGap:{...this._symbolGap},bufferSymbols:this._bufferSymbols,visibleRowsPerReel:s,reelPixelHeights:c,reelAnchor:this._reelAnchor,multiways:this._multiways},symbols:_,speeds:this._speeds,initialSpeed:this._initialSpeed,offset:this._offset,ticker:a},S=s.reduce((e,t)=>e+t+r+i,0),C=this._poolCapacity??Math.max(20,S),w=new M(this._symbolRegistry,C),T=new N(_,this._rng),E=new P(T);for(let e of this._middlewares)E.use(e);if(this._tumbleConfig){let e=this._tumbleConfig.fall,t=this._tumbleConfig.dropIn;this._phaseFactory.registerFactory(`cascade:fall`,(t,n)=>new V(t,n,e)),this._phaseFactory.register(`cascade:place`,U),this._phaseFactory.registerFactory(`cascade:dropIn`,(e,n)=>new W(e,n,t))}if(o){let e=this._pinMigrationDuration,t=this._pinMigrationEase;this._phaseFactory.registerFactory(`adjust`,(n,r)=>new ee(n,r,{durationMs:typeof e==`function`?e(n.reelIndex):e,ease:t}))}let O=e*(t+this._symbolGap.x)-this._symbolGap.x,A=u,j=Object.values(_).some(e=>e.size&&(e.size.w>1||e.size.h>1)),F=Object.values(_).some(e=>e.unmask);if(F&&p.some(e=>e!==0)){let e=p.findIndex(e=>e!==0);throw Error(`[pixi-reels] unmask + pyramid layout is not supported (reel ${e} has offsetY=${p[e]}). The motion layer writes reel-local Y to unmasked views, which mispositions them by reel.container.y on every snap. Use cell pins (reelSet.pin(...)) for above-mask overlays on pyramid slots, or remove the per-reel offset.`)}!this._maskStrategyExplicit&&(j||F)&&this._symbolGap.x>0&&(this._maskStrategy=new d,console.info(`[pixi-reels] auto-selected SharedRectMaskStrategy because ${j?`big symbols are registered`:"one or more symbols use `unmask: true`"} and symbolGap.x > 0. Pass .maskStrategy(...) explicitly to override.`));let I=new f(O,A,void 0,this._maskStrategy);new L(e,r+Math.max(...s)+i,t,this._offset);let R;if(this._initialFrame){let t=Array(e).fill(r),n=Array(e).fill(i);x(this._initialFrame,t,n,`initialFrame`),R=this._initialFrame.map(b)}let z=[],B=[];for(let n=0;n<e;n++){let e=s[n],a=g[n],o=R?E.build(n,e,r,i,R[n]):E.build(n,e,r,i),u=new l({reelIndex:n,visibleRows:e,bufferAbove:r,bufferBelow:i,symbolWidth:t,symbolHeight:a,symbolGapX:this._symbolGap.x,symbolGapY:this._symbolGap.y,symbolsData:_,initialSymbols:o,offsetY:p[n],reelHeight:c[n],spinSymbolHeight:h},w,T,I);z.push(u),B.push({x:n*(t+this._symbolGap.x),y:p[n],width:t,height:c[n]})}return I.updateMaskSize(O,A,B),new D({config:y,reels:z,viewport:I,symbolFactory:w,frameBuilder:E,phaseFactory:this._phaseFactory,spinningMode:this._spinningMode,defaultSpinMode:this._defaultSpinMode})}_validate(){let e=[];(this._reelCount===void 0||this._reelCount<=0)&&e.push(`reels() must be called with a positive number.`);let t=!!this._visibleRowsPerReel,n=this._visibleRows!==void 0,r=!!this._multiways;if(!r&&!n&&!t&&e.push(`one of visibleRows(n) or visibleRowsPerReel([...]) or multiways({...}) must be called.`),n&&t&&e.push(`cannot call both visibleRows() and visibleRowsPerReel(). pick one.`),r&&t&&e.push(`cannot combine multiways() with visibleRowsPerReel(). MultiWays shapes are server-driven.`),this._reelCount&&t&&this._visibleRowsPerReel.length!==this._reelCount&&e.push(`visibleRowsPerReel length ${this._visibleRowsPerReel.length} must equal reels(${this._reelCount}).`),t){for(let t=0;t<this._visibleRowsPerReel.length;t++)if(this._visibleRowsPerReel[t]<=0){e.push(`visibleRowsPerReel[${t}] = ${this._visibleRowsPerReel[t]} must be positive.`);break}}if(this._reelCount&&this._reelPixelHeights&&this._reelPixelHeights.length!==this._reelCount&&e.push(`reelPixelHeights length ${this._reelPixelHeights.length} must equal reels(${this._reelCount}).`),r){let t=this._multiways;t.minRows<=0||t.maxRows<=0?e.push(`multiways({minRows, maxRows}) must both be positive.`):t.minRows>t.maxRows&&e.push(`multiways: minRows ${t.minRows} cannot exceed maxRows ${t.maxRows}.`),t.reelPixelHeight<=0&&e.push(`multiways({reelPixelHeight}) must be positive.`),this._reelPixelHeights&&e.push(`cannot combine multiways({reelPixelHeight}) with reelPixelHeights([...]). multiways slots use a uniform reel pixel height. Drop reelPixelHeights() or remove the multiways() configuration.`);for(let t of this._symbolRegistry.symbolIds){let n=this._symbolDataOverrides[t]??{};if(n.size&&(n.size.w>1||n.size.h>1)){e.push(`big symbol '${t}' (size ${n.size.w}x${n.size.h}) cannot be registered on a MultiWays slot. Drop multiways() or remove the size metadata.`);break}}}for(let t of this._symbolRegistry.symbolIds){let n=this._symbolDataOverrides[t]??{},r=n.size;if(!r||r.w===1&&r.h===1)continue;let i=n.weight??this._weights[t];i!==void 0&&i>0&&e.push(`big symbol '${t}' (size ${r.w}x${r.h}) must have weight 0. big symbols are placed by the server at anchor cells only and never enter random fill in v1. Set weight to 0 (or omit it) and place the symbol via setResult().`)}if(this._visibleRows!==void 0&&this._visibleRows<=0&&e.push(`visibleRows() must be called with a positive number.`),(this._symbolWidth===void 0||this._symbolHeight===void 0)&&e.push(`symbolSize() must be called with width and height.`),this._symbolRegistry.size===0&&e.push(`symbols() must register at least one symbol.`),this._ticker||e.push(`ticker() must be called with a PixiJS Ticker.`),this._speeds.size>0&&!this._speeds.has(this._initialSpeed)&&e.push(`initialSpeed '${this._initialSpeed}' does not match any registered speed profile. Available: ${[...this._speeds.keys()].join(`, `)}`),e.length>0)throw Error(`ReelSetBuilder validation failed:\n - ${e.join(`
2
2
  - `)}`)}};function G(e){let t=e.reels,n=t.map((e,t)=>({index:t,speed:e.speed,isStopping:e.isStopping,allSymbols:e.symbols.map((e,t)=>({row:t,symbolId:e.symbolId,y:Math.round(e.view.y)})),visibleSymbols:e.getVisibleSymbols()})),r=e.getVisibleGrid();return{timestamp:Date.now(),isSpinning:e.isSpinning,currentSpeed:e.speed.activeName,availableSpeeds:e.speed.profileNames,spotlightActive:e.spotlight.isActive,reelCount:t.length,visibleRows:t.map(e=>e.visibleRows),reels:n,grid:r}}function K(e){let{grid:t,visibleRows:n}=G(e);if(t.length===0)return`(empty grid)`;let r=Math.max(...n),i=e=>e.slice(0,8).padEnd(8),a=` `.repeat(8),o=(e,n,r)=>e+t.map(()=>`─`.repeat(8)).join(n)+r,s=[];s.push(o(`┌`,`┬`,`┐`));for(let e=0;e<r;e++){let r=t.map((t,r)=>e<n[r]?i(t[e]??`?`):a);s.push(`│`+r.join(`│`)+`│`)}return s.push(o(`└`,`┴`,`┘`)),s.join(`
3
- `)}var ne=1e3,q=[],J=ne,Y=new WeakMap;function X(e,t=`default`,n={}){Z(e),n.maxFrames!==void 0&&n.maxFrames>0&&(J=n.maxFrames);let r=n=>{q.push({tag:t,trigger:n,snapshot:G(e)}),q.length>J&&q.splice(0,q.length-J)},i=()=>r(`spin:start`),a=()=>r(`spin:reelLanded`),o=()=>r(`spin:allLanded`),s=()=>r(`spin:complete`),c=()=>Z(e);e.events.on(`spin:start`,i),e.events.on(`spin:reelLanded`,a),e.events.on(`spin:allLanded`,o),e.events.on(`spin:complete`,s),e.events.on(`destroyed`,c),Y.set(e,()=>{e.events.off(`spin:start`,i),e.events.off(`spin:reelLanded`,a),e.events.off(`spin:allLanded`,o),e.events.off(`spin:complete`,s),e.events.off(`destroyed`,c)})}function Z(e){let t=Y.get(e);t&&(t(),Y.delete(e))}function Q(e){return e===void 0?q.slice():q.filter(t=>t.tag===e)}function $(){q.length=0}function re(e,n){if(typeof window>`u`)return;let r=null,i={reelSet:e,snapshot:()=>G(e),grid:()=>K(e),log:()=>{let t=G(e);return console.log(`[pixi-reels debug] spinning=${t.isSpinning} speed=${t.currentSpeed}`),console.log(K(e)),t},trace:()=>{for(let t of[`spin:start`,`spin:allStarted`,`spin:stopping`,`spin:reelLanded`,`spin:allLanded`,`spin:complete`,`skip:requested`,`skip:completed`,`speed:changed`,`spotlight:start`,`spotlight:end`,`shape:changed`,`adjust:start`,`adjust:complete`,`pin:placed`,`pin:moved`,`pin:expired`,`pin:migrated`,`destroyed`])e.events.on(t,(...e)=>{console.log(`[pixi-reels] ${t}`,...e)});console.log(`[pixi-reels debug] tracing enabled for all events`)},startRecording:(t=`default`,n)=>X(e,t,n),stopRecording:()=>Z(e),getFrames:e=>Q(e),clearFrames:()=>$(),showMask:n=>{if(n){if(r)return;let n=new t.Graphics;n.rect(0,0,e.viewport.maskWidth,e.viewport.maskHeight).fill({color:16711680,alpha:.15});for(let t of e.viewport.maskRects)n.rect(t.x,t.y,t.width,t.height).stroke({color:65280,width:2});e.viewport.unmaskedContainer.addChild(n),r=n}else r&&=(e.viewport.unmaskedContainer.removeChild(r),r.destroy(),null)}},a=window,o=a.__PIXI_REELS_DEBUG_INSTANCES??={},s=n??`reelset_${Object.keys(o).length}`;o[s]=i,a.__PIXI_REELS_DEBUG=i,console.log(`[pixi-reels] Debug mode enabled (key "${s}"). Use __PIXI_REELS_DEBUG.log() or __PIXI_REELS_DEBUG_INSTANCES["${s}"].`)}Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return y}});
4
- //# sourceMappingURL=debug-CZslk2KN.cjs.map
3
+ `)}var ne=1e3,q=[],J=ne,Y=new WeakMap;function X(e,t=`default`,n={}){Z(e),n.maxFrames!==void 0&&n.maxFrames>0&&(J=n.maxFrames);let r=n=>{q.push({tag:t,trigger:n,snapshot:G(e)}),q.length>J&&q.splice(0,q.length-J)},i=()=>r(`spin:start`),a=()=>r(`spin:reelLanded`),o=()=>r(`spin:allLanded`),s=()=>r(`spin:complete`),c=()=>Z(e);e.events.on(`spin:start`,i),e.events.on(`spin:reelLanded`,a),e.events.on(`spin:allLanded`,o),e.events.on(`spin:complete`,s),e.events.on(`destroyed`,c),Y.set(e,()=>{e.events.off(`spin:start`,i),e.events.off(`spin:reelLanded`,a),e.events.off(`spin:allLanded`,o),e.events.off(`spin:complete`,s),e.events.off(`destroyed`,c)})}function Z(e){let t=Y.get(e);t&&(t(),Y.delete(e))}function Q(e){return e===void 0?q.slice():q.filter(t=>t.tag===e)}function $(){q.length=0}function re(e,n){if(typeof window>`u`)return;let r=null,i={reelSet:e,snapshot:()=>G(e),grid:()=>K(e),log:()=>{let t=G(e);return console.log(`[pixi-reels debug] spinning=${t.isSpinning} speed=${t.currentSpeed}`),console.log(K(e)),t},trace:()=>{for(let t of[`spin:start`,`spin:allStarted`,`spin:stopping`,`spin:reelLanded`,`spin:allLanded`,`spin:complete`,`skip:requested`,`skip:completed`,`speed:changed`,`spotlight:start`,`spotlight:end`,`shape:changed`,`adjust:start`,`adjust:complete`,`pin:placed`,`pin:moved`,`pin:expired`,`pin:migrated`,`destroyed`])e.events.on(t,(...e)=>{console.log(`[pixi-reels] ${t}`,...e)});console.log(`[pixi-reels debug] tracing enabled for all events`)},startRecording:(t=`default`,n)=>X(e,t,n),stopRecording:()=>Z(e),getFrames:e=>Q(e),clearFrames:()=>$(),showMask:n=>{if(n){if(r)return;let n=new t.Graphics;n.rect(0,0,e.viewport.maskWidth,e.viewport.maskHeight).fill({color:16711680,alpha:.15});for(let t of e.viewport.maskRects)n.rect(t.x,t.y,t.width,t.height).stroke({color:65280,width:2});e.viewport.unmaskedContainer.addChild(n),r=n}else r&&=(e.viewport.unmaskedContainer.removeChild(r),r.destroy(),null)}},a=window,o=a.__PIXI_REELS_DEBUG_INSTANCES??={},s=n??`reelset_${Object.keys(o).length}`;o[s]=i,a.__PIXI_REELS_DEBUG=i,console.log(`[pixi-reels] Debug mode enabled (key "${s}"). Use __PIXI_REELS_DEBUG.log() or __PIXI_REELS_DEBUG_INSTANCES["${s}"].`)}Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`D`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`E`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`O`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return te}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return re}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return X}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return w}});
4
+ //# sourceMappingURL=debug-Bj1W7zDw.cjs.map