board-game-engine 2.0.0 → 2.1.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/.github/workflows/ci.yml +33 -0
- package/README.md +2 -2
- package/dist/board-game-engine.cjs +463 -349
- package/dist/board-game-engine.js +463 -349
- package/dist/board-game-engine.min.js +22 -22
- package/dist/board-game-engine.mjs +461 -348
- package/dist/client/client.d.ts +76 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/game-factory/bank/bank-slot.d.ts +30 -0
- package/dist/game-factory/bank/bank-slot.d.ts.map +1 -0
- package/dist/game-factory/bank/bank.d.ts +34 -0
- package/dist/game-factory/bank/bank.d.ts.map +1 -0
- package/dist/game-factory/board.d.ts +4 -0
- package/dist/game-factory/board.d.ts.map +1 -0
- package/dist/game-factory/condition/condition-factory.d.ts +4 -0
- package/dist/game-factory/condition/condition-factory.d.ts.map +1 -0
- package/dist/game-factory/condition/condition.d.ts +13 -0
- package/dist/game-factory/condition/condition.d.ts.map +1 -0
- package/dist/game-factory/condition/contains-condition.d.ts +8 -0
- package/dist/game-factory/condition/contains-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/contains-same-condition.d.ts +7 -0
- package/dist/game-factory/condition/contains-same-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/evaluate-condition.d.ts +8 -0
- package/dist/game-factory/condition/evaluate-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/every-condition.d.ts +12 -0
- package/dist/game-factory/condition/every-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/has-line-condition.d.ts +8 -0
- package/dist/game-factory/condition/has-line-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/in-line-condition.d.ts +8 -0
- package/dist/game-factory/condition/in-line-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/is-condition.d.ts +8 -0
- package/dist/game-factory/condition/is-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/is-full-condition.d.ts +7 -0
- package/dist/game-factory/condition/is-full-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/no-possible-moves-condition.d.ts +7 -0
- package/dist/game-factory/condition/no-possible-moves-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/not-condition.d.ts +7 -0
- package/dist/game-factory/condition/not-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/or-condition.d.ts +7 -0
- package/dist/game-factory/condition/or-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/position-condition.d.ts +7 -0
- package/dist/game-factory/condition/position-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/some-condition.d.ts +8 -0
- package/dist/game-factory/condition/some-condition.d.ts.map +1 -0
- package/dist/game-factory/condition/would-condition.d.ts +8 -0
- package/dist/game-factory/condition/would-condition.d.ts.map +1 -0
- package/dist/game-factory/entity.d.ts +13 -0
- package/dist/game-factory/entity.d.ts.map +1 -0
- package/dist/game-factory/expand-game-rules.d.ts +3 -0
- package/dist/game-factory/expand-game-rules.d.ts.map +1 -0
- package/dist/game-factory/game-factory.d.ts +10 -0
- package/dist/game-factory/game-factory.d.ts.map +1 -0
- package/{src/game-factory/move/end-turn.js → dist/game-factory/move/end-turn.d.ts} +2 -4
- package/dist/game-factory/move/end-turn.d.ts.map +1 -0
- package/dist/game-factory/move/for-each.d.ts +5 -0
- package/dist/game-factory/move/for-each.d.ts.map +1 -0
- package/dist/game-factory/move/index.d.ts +6 -0
- package/dist/game-factory/move/index.d.ts.map +1 -0
- package/dist/game-factory/move/move-entity.d.ts +7 -0
- package/dist/game-factory/move/move-entity.d.ts.map +1 -0
- package/dist/game-factory/move/move-factory.d.ts +18 -0
- package/dist/game-factory/move/move-factory.d.ts.map +1 -0
- package/dist/game-factory/move/move.d.ts +54 -0
- package/dist/game-factory/move/move.d.ts.map +1 -0
- package/dist/game-factory/move/pass-turn.d.ts +5 -0
- package/dist/game-factory/move/pass-turn.d.ts.map +1 -0
- package/{src/game-factory/move/pass.js → dist/game-factory/move/pass.d.ts} +2 -4
- package/dist/game-factory/move/pass.d.ts.map +1 -0
- package/dist/game-factory/move/place-new.d.ts +5 -0
- package/dist/game-factory/move/place-new.d.ts.map +1 -0
- package/dist/game-factory/move/remove-entity.d.ts +5 -0
- package/dist/game-factory/move/remove-entity.d.ts.map +1 -0
- package/dist/game-factory/move/set-active-players.d.ts +5 -0
- package/dist/game-factory/move/set-active-players.d.ts.map +1 -0
- package/dist/game-factory/move/set-state.d.ts +5 -0
- package/dist/game-factory/move/set-state.d.ts.map +1 -0
- package/dist/game-factory/move/shuffle.d.ts +5 -0
- package/dist/game-factory/move/shuffle.d.ts.map +1 -0
- package/dist/game-factory/move/take-from.d.ts +11 -0
- package/dist/game-factory/move/take-from.d.ts.map +1 -0
- package/dist/game-factory/space/space.d.ts +10 -0
- package/dist/game-factory/space/space.d.ts.map +1 -0
- package/dist/game-factory/space-group/grid.d.ts +15 -0
- package/dist/game-factory/space-group/grid.d.ts.map +1 -0
- package/dist/game-factory/space-group/space-group.d.ts +20 -0
- package/dist/game-factory/space-group/space-group.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/registry.d.ts +17 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/types/bagel-types.d.ts +339 -0
- package/dist/types/bagel-types.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/rule-with-conditions.d.ts +9 -0
- package/dist/types/rule-with-conditions.d.ts.map +1 -0
- package/dist/utils/any-valid-moves.d.ts +2 -0
- package/dist/utils/any-valid-moves.d.ts.map +1 -0
- package/dist/utils/bgio-resolve-types.d.ts +25 -0
- package/dist/utils/bgio-resolve-types.d.ts.map +1 -0
- package/dist/utils/check-conditions.d.ts +7 -0
- package/dist/utils/check-conditions.d.ts.map +1 -0
- package/dist/utils/create-payload.d.ts +5 -0
- package/dist/utils/create-payload.d.ts.map +1 -0
- package/dist/utils/deserialize-bgio-arguments.d.ts +3 -0
- package/dist/utils/deserialize-bgio-arguments.d.ts.map +1 -0
- package/dist/utils/do-moves.d.ts +8 -0
- package/dist/utils/do-moves.d.ts.map +1 -0
- package/dist/utils/entity-matches.d.ts +6 -0
- package/dist/utils/entity-matches.d.ts.map +1 -0
- package/dist/utils/find-met-condition.d.ts +6 -0
- package/dist/utils/find-met-condition.d.ts.map +1 -0
- package/dist/utils/get-current-moves.d.ts +24 -0
- package/dist/utils/get-current-moves.d.ts.map +1 -0
- package/dist/utils/get-scenario-results.d.ts +3 -0
- package/dist/utils/get-scenario-results.d.ts.map +1 -0
- package/dist/utils/get-steps.d.ts +13 -0
- package/dist/utils/get-steps.d.ts.map +1 -0
- package/dist/utils/get.d.ts +7 -0
- package/dist/utils/get.d.ts.map +1 -0
- package/dist/utils/grid-contains-sequence.d.ts +27 -0
- package/dist/utils/grid-contains-sequence.d.ts.map +1 -0
- package/dist/utils/json-transformer.d.ts +8 -0
- package/dist/utils/json-transformer.d.ts.map +1 -0
- package/dist/utils/prepare-payload.d.ts +2 -0
- package/dist/utils/prepare-payload.d.ts.map +1 -0
- package/dist/utils/resolve-entity.d.ts +3 -0
- package/dist/utils/resolve-entity.d.ts.map +1 -0
- package/dist/utils/resolve-expression.d.ts +6 -0
- package/dist/utils/resolve-expression.d.ts.map +1 -0
- package/dist/utils/resolve-properties.d.ts +4 -0
- package/dist/utils/resolve-properties.d.ts.map +1 -0
- package/dist/utils/simulate-move.d.ts +16 -0
- package/dist/utils/simulate-move.d.ts.map +1 -0
- package/e2e/fixtures/bge-checkers.html +1 -2
- package/e2e/fixtures/bge-minimal.html +1 -2
- package/e2e/fixtures/bge-ttt.html +1 -2
- package/examples/index.html +1 -1
- package/package.json +9 -3
- package/playwright-report/index.html +1 -1
- package/scripts/build.mjs +2 -2
- package/src/client/client.ts +305 -0
- package/src/game-factory/bank/bank-slot.ts +81 -0
- package/src/game-factory/bank/bank.ts +125 -0
- package/src/game-factory/{board.js → board.ts} +1 -1
- package/src/game-factory/condition/condition-factory.ts +59 -0
- package/src/game-factory/condition/condition.ts +50 -0
- package/src/game-factory/condition/{contains-condition.js → contains-condition.ts} +5 -4
- package/src/game-factory/condition/{contains-same-condition.js → contains-same-condition.ts} +8 -5
- package/src/game-factory/condition/{evaluate-condition.js → evaluate-condition.ts} +4 -3
- package/src/game-factory/condition/every-condition.ts +27 -0
- package/src/game-factory/condition/has-line-condition.ts +15 -0
- package/src/game-factory/condition/in-line-condition.ts +25 -0
- package/src/game-factory/condition/is-condition.ts +24 -0
- package/src/game-factory/condition/is-full-condition.ts +10 -0
- package/src/game-factory/condition/{no-possible-moves-condition.js → no-possible-moves-condition.ts} +3 -2
- package/src/game-factory/condition/{not-condition.js → not-condition.ts} +3 -2
- package/src/game-factory/condition/{or-condition.js → or-condition.ts} +3 -2
- package/src/game-factory/condition/position-condition.ts +13 -0
- package/src/game-factory/condition/{some-condition.js → some-condition.ts} +5 -3
- package/src/game-factory/condition/would-condition.ts +104 -0
- package/src/game-factory/entity.ts +37 -0
- package/src/game-factory/expand-game-rules.ts +263 -0
- package/src/game-factory/game-factory.ts +263 -0
- package/src/game-factory/move/end-turn.ts +7 -0
- package/src/game-factory/move/for-each.ts +20 -0
- package/src/game-factory/move/move-entity.ts +18 -0
- package/src/game-factory/move/move-factory.ts +107 -0
- package/src/game-factory/move/move.ts +147 -0
- package/src/game-factory/move/pass-turn.ts +15 -0
- package/src/game-factory/move/pass.ts +7 -0
- package/src/game-factory/move/place-new.ts +42 -0
- package/src/game-factory/move/remove-entity.ts +11 -0
- package/src/game-factory/move/set-active-players.ts +26 -0
- package/src/game-factory/move/set-state.ts +14 -0
- package/src/game-factory/move/shuffle.ts +9 -0
- package/src/game-factory/move/take-from.ts +12 -0
- package/src/game-factory/space/space.ts +36 -0
- package/src/game-factory/space-group/grid.ts +48 -0
- package/src/game-factory/space-group/space-group.ts +44 -0
- package/src/index.ts +5 -0
- package/src/types/bagel-types.ts +449 -0
- package/src/types/boardgame-io-core.d.ts +7 -0
- package/src/types/index.ts +70 -0
- package/src/types/rule-with-conditions.ts +9 -0
- package/src/utils/{any-valid-moves.js → any-valid-moves.ts} +54 -49
- package/src/utils/bgio-resolve-types.ts +27 -0
- package/src/utils/check-conditions.ts +28 -0
- package/src/utils/create-payload.ts +19 -0
- package/src/utils/deserialize-bgio-arguments.ts +10 -0
- package/src/utils/do-moves.ts +22 -0
- package/src/utils/entity-matches.ts +30 -0
- package/src/utils/expr-eval.d.ts +6 -0
- package/src/utils/find-met-condition.ts +23 -0
- package/src/utils/get-current-moves.ts +39 -0
- package/src/utils/get-scenario-results.ts +30 -0
- package/src/utils/get-steps.ts +38 -0
- package/src/utils/get.ts +28 -0
- package/src/utils/{grid-contains-sequence.js → grid-contains-sequence.ts} +71 -33
- package/src/utils/json-transformer.ts +17 -0
- package/src/utils/prepare-payload.ts +20 -0
- package/src/utils/resolve-entity.ts +15 -0
- package/src/utils/resolve-expression.ts +16 -0
- package/src/utils/resolve-properties.ts +172 -0
- package/src/utils/simulate-move.ts +32 -0
- package/src/wackson.d.ts +4 -0
- package/tsconfig.build.json +14 -0
- package/tsconfig.json +21 -0
- package/src/client/client.js +0 -224
- package/src/game-factory/bank/bank-slot.js +0 -69
- package/src/game-factory/bank/bank.js +0 -114
- package/src/game-factory/condition/condition-factory.js +0 -52
- package/src/game-factory/condition/condition.js +0 -39
- package/src/game-factory/condition/every-condition.js +0 -25
- package/src/game-factory/condition/has-line-condition.js +0 -14
- package/src/game-factory/condition/in-line-condition.js +0 -19
- package/src/game-factory/condition/is-condition.js +0 -23
- package/src/game-factory/condition/is-full-condition.js +0 -9
- package/src/game-factory/condition/position-condition.js +0 -12
- package/src/game-factory/condition/would-condition.js +0 -94
- package/src/game-factory/entity.js +0 -29
- package/src/game-factory/expand-game-rules.js +0 -271
- package/src/game-factory/game-factory.js +0 -239
- package/src/game-factory/move/for-each.js +0 -18
- package/src/game-factory/move/move-entity.js +0 -16
- package/src/game-factory/move/move-factory.js +0 -89
- package/src/game-factory/move/move.js +0 -131
- package/src/game-factory/move/pass-turn.js +0 -10
- package/src/game-factory/move/place-new.js +0 -33
- package/src/game-factory/move/remove-entity.js +0 -7
- package/src/game-factory/move/set-active-players.js +0 -23
- package/src/game-factory/move/set-state.js +0 -11
- package/src/game-factory/move/shuffle.js +0 -7
- package/src/game-factory/move/take-from.js +0 -7
- package/src/game-factory/space/space.js +0 -30
- package/src/game-factory/space-group/grid.js +0 -43
- package/src/game-factory/space-group/space-group.js +0 -29
- package/src/index.js +0 -2
- package/src/utils/check-conditions.js +0 -28
- package/src/utils/create-payload.js +0 -16
- package/src/utils/deserialize-bgio-arguments.js +0 -8
- package/src/utils/do-moves.js +0 -18
- package/src/utils/entity-matches.js +0 -20
- package/src/utils/find-met-condition.js +0 -22
- package/src/utils/get-current-moves.js +0 -12
- package/src/utils/get-scenario-results.js +0 -23
- package/src/utils/get-steps.js +0 -29
- package/src/utils/get.js +0 -25
- package/src/utils/json-transformer.js +0 -12
- package/src/utils/prepare-payload.js +0 -16
- package/src/utils/resolve-entity.js +0 -9
- package/src/utils/resolve-expression.js +0 -10
- package/src/utils/resolve-properties.js +0 -149
- package/src/utils/simulate-move.js +0 -25
- /package/src/game-factory/move/{index.js → index.ts} +0 -0
- /package/src/{registry.js → registry.ts} +0 -0
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
var BoardGameEngine=(()=>{var g_=Object.create;var ss=Object.defineProperty;var y_=Object.getOwnPropertyDescriptor;var v_=Object.getOwnPropertyNames;var b_=Object.getPrototypeOf,__=Object.prototype.hasOwnProperty;var v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ll=(e,t)=>{for(var n in t)ss(e,n,{get:t[n],enumerable:!0})},fl=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of v_(t))!__.call(e,i)&&i!==n&&ss(e,i,{get:()=>t[i],enumerable:!(r=y_(t,i))||r.enumerable});return e};var he=(e,t,n)=>(n=e!=null?g_(b_(e)):{},fl(t||!e||!e.__esModule?ss(n,"default",{value:e,enumerable:!0}):n,e)),w_=e=>fl(ss({},"__esModule",{value:!0}),e);var xl=v(Ee=>{function je(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map(function(i){return"'"+i+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function ft(e){return!!e&&!!e[$]}function nt(e){var t;return!!e&&(function(n){if(!n||typeof n!="object")return!1;var r=Object.getPrototypeOf(n);if(r===null)return!0;var i=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return i===Object||typeof i=="function"&&Function.toString.call(i)===A_}(e)||Array.isArray(e)||!!e[An]||!!(!((t=e.constructor)===null||t===void 0)&&t[An])||fs(e)||ps(e))}function Ot(e,t,n){n===void 0&&(n=!1),Vt(e)===0?(n?Object.keys:xn)(e).forEach(function(r){n&&typeof r=="symbol"||t(r,e[r],e)}):e.forEach(function(r,i){return t(i,r,e)})}function Vt(e){var t=e[$];return t?t.t>3?t.t-4:t.t:Array.isArray(e)?1:fs(e)?2:ps(e)?3:0}function Ut(e,t){return Vt(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function as(e,t){return Vt(e)===2?e.get(t):e[t]}function Ol(e,t,n){var r=Vt(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Pl(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function fs(e){return E_&&e instanceof Map}function ps(e){return k_&&e instanceof Set}function qe(e){return e.i||e.u}function zo(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=kl(e);delete t[$];for(var n=xn(t),r=0;r<n.length;r++){var i=n[r],s=t[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(t[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function hs(e,t){return t===void 0&&(t=!1),Ko(e)||ft(e)||!nt(e)||(Vt(e)>1&&(e.set=e.add=e.clear=e.delete=O_),Object.freeze(e),t&&Ot(e,function(n,r){return hs(r,!0)},!0)),e}function O_(){je(2)}function Ko(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function lt(e){var t=Vo[e];return t||je(18,e),t}function Ho(e,t){Vo[e]||(Vo[e]=t)}function mr(){return yr}function Bo(e,t){t&&(lt("Patches"),e.o=[],e.v=[],e.s=t)}function us(e){Uo(e),e.p.forEach(P_),e.p=null}function Uo(e){e===yr&&(yr=e.l)}function pl(e){return yr={p:[],l:yr,h:e,_:!0,m:0}}function P_(e){var t=e[$];t.t===0||t.t===1?t.j():t.O=!0}function Lo(e,t){t.m=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.S||lt("ES5").P(t,e,r),r?(n[$].g&&(us(t),je(4)),nt(e)&&(e=cs(t,e),t.l||ls(t,e)),t.o&<("Patches").M(n[$].u,e,t.o,t.v)):e=cs(t,n,[]),us(t),t.o&&t.s(t.o,t.v),e!==ds?e:void 0}function cs(e,t,n){if(Ko(t))return t;var r=t[$];if(!r)return Ot(t,function(a,u){return hl(e,r,t,a,u,n)},!0),t;if(r.A!==e)return t;if(!r.g)return ls(e,r.u,!0),r.u;if(!r.R){r.R=!0,r.A.m--;var i=r.t===4||r.t===5?r.i=zo(r.k):r.i,s=i,o=!1;r.t===3&&(s=new Set(i),i.clear(),o=!0),Ot(s,function(a,u){return hl(e,r,i,a,u,n,o)}),ls(e,i,!1),n&&e.o&<("Patches").F(r,n,e.o,e.v)}return r.i}function hl(e,t,n,r,i,s,o){if(ft(i)){var a=cs(e,i,s&&t&&t.t!==3&&!Ut(t.N,r)?s.concat(r):void 0);if(Ol(n,r,a),!ft(a))return;e._=!1}else o&&n.add(i);if(nt(i)&&!Ko(i)){if(!e.h.D&&e.m<1)return;cs(e,i),t&&t.A.l||ls(e,i)}}function ls(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e._&&hs(t,n)}function Go(e,t){var n=e[$];return(n?qe(n):e)[t]}function dl(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function Ve(e){e.g||(e.g=!0,e.l&&Ve(e.l))}function Fo(e){e.i||(e.i=zo(e.u))}function gr(e,t,n){var r=fs(t)?lt("MapSet").K(t,n):ps(t)?lt("MapSet").$(t,n):e.S?function(i,s){var o=Array.isArray(i),a={t:o?1:0,A:s?s.A:mr(),g:!1,R:!1,N:{},l:s,u:i,k:null,i:null,j:null,C:!1},u=a,c=vr;o&&(u=[a],c=dr);var l=Proxy.revocable(u,c),f=l.revoke,p=l.proxy;return a.k=p,a.j=f,p}(t,n):lt("ES5").I(t,n);return(n?n.A:mr()).p.push(r),r}function El(e){return ft(e)||je(22,e),function t(n){if(!nt(n))return n;var r,i=n[$],s=Vt(n);if(i){if(!i.g&&(i.t<4||!lt("ES5").J(i)))return i.u;i.R=!0,r=ml(n,s),i.R=!1}else r=ml(n,s);return Ot(r,function(o,a){i&&as(i.u,o)===a||Ol(r,o,t(a))}),s===3?new Set(r):r}(e)}function ml(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return zo(e)}function gl(){function e(s,o){var a=i[s];return a?a.enumerable=o:i[s]=a={configurable:!0,enumerable:o,get:function(){return vr.get(this[$],s)},set:function(u){vr.set(this[$],s,u)}},a}function t(s){for(var o=s.length-1;o>=0;o--){var a=s[o][$];if(!a.g)switch(a.t){case 5:r(a)&&Ve(a);break;case 4:n(a)&&Ve(a)}}}function n(s){for(var o=s.u,a=s.k,u=xn(a),c=u.length-1;c>=0;c--){var l=u[c];if(l!==$){var f=o[l];if(f===void 0&&!Ut(o,l))return!0;var p=a[l],h=p&&p[$];if(h?h.u!==f:!Pl(p,f))return!0}}var d=!!o[$];return u.length!==xn(o).length+(d?0:1)}function r(s){var o=s.k;if(o.length!==s.u.length)return!0;var a=Object.getOwnPropertyDescriptor(o,o.length-1);if(a&&!a.get)return!0;for(var u=0;u<o.length;u++)if(!o.hasOwnProperty(u))return!0;return!1}var i={};Ho("ES5",{I:function(s,o){var a=Array.isArray(s),u=function(l,f){if(l){for(var p=Array(f.length),h=0;h<f.length;h++)Object.defineProperty(p,""+h,e(h,!0));return p}var d=kl(f);delete d[$];for(var y=xn(d),m=0;m<y.length;m++){var b=y[m];d[b]=e(b,l||!!d[b].enumerable)}return Object.create(Object.getPrototypeOf(f),d)}(a,s),c={t:a?5:4,A:o?o.A:mr(),g:!1,R:!1,N:{},l:o,u:s,k:u,i:null,O:!1,C:!1};return Object.defineProperty(u,$,{value:c,writable:!0}),u},P:function(s,o,a){a?ft(o)&&o[$].A===s&&t(s.p):(s.o&&function u(c){if(c&&typeof c=="object"){var l=c[$];if(l){var f=l.u,p=l.k,h=l.N,d=l.t;if(d===4)Ot(p,function(O){O!==$&&(f[O]!==void 0||Ut(f,O)?h[O]||u(p[O]):(h[O]=!0,Ve(l)))}),Ot(f,function(O){p[O]!==void 0||Ut(p,O)||(h[O]=!1,Ve(l))});else if(d===5){if(r(l)&&(Ve(l),h.length=!0),p.length<f.length)for(var y=p.length;y<f.length;y++)h[y]=!1;else for(var m=f.length;m<p.length;m++)h[m]=!0;for(var b=Math.min(p.length,f.length),g=0;g<b;g++)p.hasOwnProperty(g)||(h[g]=!0),h[g]===void 0&&u(p[g])}}}}(s.p[0]),t(s.p))},J:function(s){return s.t===4?n(s):r(s)}})}function yl(){function e(r){if(!nt(r))return r;if(Array.isArray(r))return r.map(e);if(fs(r))return new Map(Array.from(r.entries()).map(function(o){return[o[0],e(o[1])]}));if(ps(r))return new Set(Array.from(r).map(e));var i=Object.create(Object.getPrototypeOf(r));for(var s in r)i[s]=e(r[s]);return Ut(r,An)&&(i[An]=r[An]),i}function t(r){return ft(r)?e(r):r}var n="add";Ho("Patches",{W:function(r,i){return i.forEach(function(s){for(var o=s.path,a=s.op,u=r,c=0;c<o.length-1;c++){var l=Vt(u),f=o[c];typeof f!="string"&&typeof f!="number"&&(f=""+f),l!==0&&l!==1||f!=="__proto__"&&f!=="constructor"||je(24),typeof u=="function"&&f==="prototype"&&je(24),typeof(u=as(u,f))!="object"&&je(15,o.join("/"))}var p=Vt(u),h=e(s.value),d=o[o.length-1];switch(a){case"replace":switch(p){case 2:return u.set(d,h);case 3:je(16);default:return u[d]=h}case n:switch(p){case 1:return d==="-"?u.push(h):u.splice(d,0,h);case 2:return u.set(d,h);case 3:return u.add(h);default:return u[d]=h}case"remove":switch(p){case 1:return u.splice(d,1);case 2:return u.delete(d);case 3:return u.delete(s.value);default:return delete u[d]}default:je(17,a)}}),r},F:function(r,i,s,o){switch(r.t){case 0:case 4:case 2:return function(a,u,c,l){var f=a.u,p=a.i;Ot(a.N,function(h,d){var y=as(f,h),m=as(p,h),b=d?Ut(f,h)?"replace":n:"remove";if(y!==m||b!=="replace"){var g=u.concat(h);c.push(b==="remove"?{op:b,path:g}:{op:b,path:g,value:m}),l.push(b===n?{op:"remove",path:g}:b==="remove"?{op:n,path:g,value:t(y)}:{op:"replace",path:g,value:t(y)})}})}(r,i,s,o);case 5:case 1:return function(a,u,c,l){var f=a.u,p=a.N,h=a.i;if(h.length<f.length){var d=[h,f];f=d[0],h=d[1];var y=[l,c];c=y[0],l=y[1]}for(var m=0;m<f.length;m++)if(p[m]&&h[m]!==f[m]){var b=u.concat([m]);c.push({op:"replace",path:b,value:t(h[m])}),l.push({op:"replace",path:b,value:t(f[m])})}for(var g=f.length;g<h.length;g++){var O=u.concat([g]);c.push({op:n,path:O,value:t(h[g])})}f.length<h.length&&l.push({op:"replace",path:u.concat(["length"]),value:f.length})}(r,i,s,o);case 3:return function(a,u,c,l){var f=a.u,p=a.i,h=0;f.forEach(function(d){if(!p.has(d)){var y=u.concat([h]);c.push({op:"remove",path:y,value:d}),l.unshift({op:n,path:y,value:d})}h++}),h=0,p.forEach(function(d){if(!f.has(d)){var y=u.concat([h]);c.push({op:n,path:y,value:d}),l.unshift({op:"remove",path:y,value:d})}h++})}(r,i,s,o)}},M:function(r,i,s,o){s.push({op:"replace",path:[],value:i===ds?void 0:i}),o.push({op:"replace",path:[],value:r})}})}function vl(){function e(a,u){function c(){this.constructor=a}i(a,u),a.prototype=(c.prototype=u.prototype,new c)}function t(a){a.i||(a.N=new Map,a.i=new Map(a.u))}function n(a){a.i||(a.i=new Set,a.u.forEach(function(u){if(nt(u)){var c=gr(a.A.h,u,a);a.p.set(u,c),a.i.add(c)}else a.i.add(u)}))}function r(a){a.O&&je(3,JSON.stringify(qe(a)))}var i=function(a,u){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,l){c.__proto__=l}||function(c,l){for(var f in l)l.hasOwnProperty(f)&&(c[f]=l[f])})(a,u)},s=function(){function a(c,l){return this[$]={t:2,l,A:l?l.A:mr(),g:!1,R:!1,i:void 0,N:void 0,u:c,k:this,C:!1,O:!1},this}e(a,Map);var u=a.prototype;return Object.defineProperty(u,"size",{get:function(){return qe(this[$]).size}}),u.has=function(c){return qe(this[$]).has(c)},u.set=function(c,l){var f=this[$];return r(f),qe(f).has(c)&&qe(f).get(c)===l||(t(f),Ve(f),f.N.set(c,!0),f.i.set(c,l),f.N.set(c,!0)),this},u.delete=function(c){if(!this.has(c))return!1;var l=this[$];return r(l),t(l),Ve(l),l.u.has(c)?l.N.set(c,!1):l.N.delete(c),l.i.delete(c),!0},u.clear=function(){var c=this[$];r(c),qe(c).size&&(t(c),Ve(c),c.N=new Map,Ot(c.u,function(l){c.N.set(l,!1)}),c.i.clear())},u.forEach=function(c,l){var f=this;qe(this[$]).forEach(function(p,h){c.call(l,f.get(h),h,f)})},u.get=function(c){var l=this[$];r(l);var f=qe(l).get(c);if(l.R||!nt(f)||f!==l.u.get(c))return f;var p=gr(l.A.h,f,l);return t(l),l.i.set(c,p),p},u.keys=function(){return qe(this[$]).keys()},u.values=function(){var c,l=this,f=this.keys();return(c={})[os]=function(){return l.values()},c.next=function(){var p=f.next();return p.done?p:{done:!1,value:l.get(p.value)}},c},u.entries=function(){var c,l=this,f=this.keys();return(c={})[os]=function(){return l.entries()},c.next=function(){var p=f.next();if(p.done)return p;var h=l.get(p.value);return{done:!1,value:[p.value,h]}},c},u[os]=function(){return this.entries()},a}(),o=function(){function a(c,l){return this[$]={t:3,l,A:l?l.A:mr(),g:!1,R:!1,i:void 0,u:c,k:this,p:new Map,O:!1,C:!1},this}e(a,Set);var u=a.prototype;return Object.defineProperty(u,"size",{get:function(){return qe(this[$]).size}}),u.has=function(c){var l=this[$];return r(l),l.i?!!l.i.has(c)||!(!l.p.has(c)||!l.i.has(l.p.get(c))):l.u.has(c)},u.add=function(c){var l=this[$];return r(l),this.has(c)||(n(l),Ve(l),l.i.add(c)),this},u.delete=function(c){if(!this.has(c))return!1;var l=this[$];return r(l),n(l),Ve(l),l.i.delete(c)||!!l.p.has(c)&&l.i.delete(l.p.get(c))},u.clear=function(){var c=this[$];r(c),qe(c).size&&(n(c),Ve(c),c.i.clear())},u.values=function(){var c=this[$];return r(c),n(c),c.i.values()},u.entries=function(){var c=this[$];return r(c),n(c),c.i.entries()},u.keys=function(){return this.values()},u[os]=function(){return this.values()},u.forEach=function(c,l){for(var f=this.values(),p=f.next();!p.done;)c.call(l,p.value,p.value,this),p=f.next()},a}();Ho("MapSet",{K:function(a,u){return new s(a,u)},$:function(a,u){return new o(a,u)}})}var bl;Object.defineProperty(Ee,"__esModule",{value:!0});var yr,Wo=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",E_=typeof Map<"u",k_=typeof Set<"u",_l=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",ds=Wo?Symbol.for("immer-nothing"):((bl={})["immer-nothing"]=!0,bl),An=Wo?Symbol.for("immer-draftable"):"__$immer_draftable",$=Wo?Symbol.for("immer-state"):"__$immer_state",os=typeof Symbol<"u"&&Symbol.iterator||"@@iterator",A_=""+Object.prototype.constructor,xn=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,kl=Object.getOwnPropertyDescriptors||function(e){var t={};return xn(e).forEach(function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)}),t},Vo={},vr={get:function(e,t){if(t===$)return e;var n=qe(e);if(!Ut(n,t))return function(i,s,o){var a,u=dl(s,o);return u?"value"in u?u.value:(a=u.get)===null||a===void 0?void 0:a.call(i.k):void 0}(e,n,t);var r=n[t];return e.R||!nt(r)?r:r===Go(e.u,t)?(Fo(e),e.i[t]=gr(e.A.h,r,e)):r},has:function(e,t){return t in qe(e)},ownKeys:function(e){return Reflect.ownKeys(qe(e))},set:function(e,t,n){var r=dl(qe(e),t);if(r?.set)return r.set.call(e.k,n),!0;if(!e.g){var i=Go(qe(e),t),s=i?.[$];if(s&&s.u===n)return e.i[t]=n,e.N[t]=!1,!0;if(Pl(n,i)&&(n!==void 0||Ut(e.u,t)))return!0;Fo(e),Ve(e)}return e.i[t]===n&&(n!==void 0||t in e.i)||Number.isNaN(n)&&Number.isNaN(e.i[t])||(e.i[t]=n,e.N[t]=!0),!0},deleteProperty:function(e,t){return Go(e.u,t)!==void 0||t in e.u?(e.N[t]=!1,Fo(e),Ve(e)):delete e.N[t],e.i&&delete e.i[t],!0},getOwnPropertyDescriptor:function(e,t){var n=qe(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.t!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty:function(){je(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.u)},setPrototypeOf:function(){je(12)}},dr={};Ot(vr,function(e,t){dr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),dr.deleteProperty=function(e,t){return dr.set.call(this,e,t,void 0)},dr.set=function(e,t,n){return vr.set.call(this,e[0],t,n,e[0])};var Al=function(){function e(n){var r=this;this.S=_l,this.D=!0,this.produce=function(i,s,o){if(typeof i=="function"&&typeof s!="function"){var a=s;s=i;var u=r;return function(y){var m=this;y===void 0&&(y=a);for(var b=arguments.length,g=Array(b>1?b-1:0),O=1;O<b;O++)g[O-1]=arguments[O];return u.produce(y,function(I){var j;return(j=s).call.apply(j,[m,I].concat(g))})}}var c;if(typeof s!="function"&&je(6),o!==void 0&&typeof o!="function"&&je(7),nt(i)){var l=pl(r),f=gr(r,i,void 0),p=!0;try{c=s(f),p=!1}finally{p?us(l):Uo(l)}return typeof Promise<"u"&&c instanceof Promise?c.then(function(y){return Bo(l,o),Lo(y,l)},function(y){throw us(l),y}):(Bo(l,o),Lo(c,l))}if(!i||typeof i!="object"){if((c=s(i))===void 0&&(c=i),c===ds&&(c=void 0),r.D&&hs(c,!0),o){var h=[],d=[];lt("Patches").M(i,c,h,d),o(h,d)}return c}je(21,i)},this.produceWithPatches=function(i,s){if(typeof i=="function")return function(c){for(var l=arguments.length,f=Array(l>1?l-1:0),p=1;p<l;p++)f[p-1]=arguments[p];return r.produceWithPatches(c,function(h){return i.apply(void 0,[h].concat(f))})};var o,a,u=r.produce(i,s,function(c,l){o=c,a=l});return typeof Promise<"u"&&u instanceof Promise?u.then(function(c){return[c,o,a]}):[u,o,a]},typeof n?.useProxies=="boolean"&&this.setUseProxies(n.useProxies),typeof n?.autoFreeze=="boolean"&&this.setAutoFreeze(n.autoFreeze)}var t=e.prototype;return t.createDraft=function(n){nt(n)||je(8),ft(n)&&(n=El(n));var r=pl(this),i=gr(this,n,void 0);return i[$].C=!0,Uo(r),i},t.finishDraft=function(n,r){var i=(n&&n[$]).A;return Bo(i,r),Lo(void 0,i)},t.setAutoFreeze=function(n){this.D=n},t.setUseProxies=function(n){n&&!_l&&je(20),this.S=n},t.applyPatches=function(n,r){var i;for(i=r.length-1;i>=0;i--){var s=r[i];if(s.path.length===0&&s.op==="replace"){n=s.value;break}}i>-1&&(r=r.slice(i+1));var o=lt("Patches").W;return ft(n)?o(n,r):this.produce(n,function(a){return o(a,r)})},e}(),We=new Al,wl=We.produce,x_=We.produceWithPatches.bind(We),S_=We.setAutoFreeze.bind(We),T_=We.setUseProxies.bind(We),M_=We.applyPatches.bind(We),I_=We.createDraft.bind(We),N_=We.finishDraft.bind(We);Ee.Immer=Al,Ee.applyPatches=M_,Ee.castDraft=function(e){return e},Ee.castImmutable=function(e){return e},Ee.createDraft=I_,Ee.current=El,Ee.default=wl,Ee.enableAllPlugins=function(){gl(),vl(),yl()},Ee.enableES5=gl,Ee.enableMapSet=vl,Ee.enablePatches=yl,Ee.finishDraft=N_,Ee.freeze=hs,Ee.immerable=An,Ee.isDraft=ft,Ee.isDraftable=nt,Ee.nothing=ds,Ee.original=function(e){return ft(e)||je(23,e),e[$].u},Ee.produce=wl,Ee.produceWithPatches=x_,Ee.setAutoFreeze=S_,Ee.setUseProxies=T_});var Jo=v((Qj,Sl)=>{"use strict";Sl.exports=xl()});var Xo=v($o=>{"use strict";var Yo=class{constructor(t){let n=C_();this.c=1,this.s0=n(" "),this.s1=n(" "),this.s2=n(" "),this.s0-=n(t),this.s0<0&&(this.s0+=1),this.s1-=n(t),this.s1<0&&(this.s1+=1),this.s2-=n(t),this.s2<0&&(this.s2+=1)}next(){let t=2091639*this.s0+this.c*23283064365386963e-26;return this.s0=this.s1,this.s1=this.s2,this.s2=t-(this.c=Math.trunc(t))}};function C_(){let e=4022871197;return function(n){let r=n.toString();for(let i=0;i<r.length;i++){e+=r.charCodeAt(i);let s=.02519603282416938*e;e=s>>>0,s-=e,s*=e,e=s>>>0,s-=e,e+=s*4294967296}return(e>>>0)*23283064365386963e-26}}function Tl(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function Ml(e,t){let n=new Yo(e),r=n.next.bind(n);return t&&Tl(t,n),r.state=()=>Tl(n,{}),r}var ms=class{constructor(t){this.state=t||{seed:"0"},this.used=!1}static seed(){return Date.now().toString(36).slice(-10)}isUsed(){return this.used}getState(){return this.state}_random(){this.used=!0;let t=this.state,n=t.prngstate?"":t.seed,r=Ml(n,t.prngstate),i=r();return this.state={...t,prngstate:r.state()},i}api(){let t=this._random.bind(this),n={D4:4,D6:6,D8:8,D10:10,D12:12,D20:20},r={};for(let s in n){let o=n[s];r[s]=a=>a===void 0?Math.floor(t()*o)+1:Array.from({length:a}).map(()=>Math.floor(t()*o)+1)}function i(s=6,o){return o===void 0?Math.floor(t()*s)+1:Array.from({length:o}).map(()=>Math.floor(t()*s)+1)}return{...r,Die:i,Number:()=>t(),Shuffle:s=>{let o=[...s],a=s.length,u=0,c=Array.from({length:a});for(;a;){let l=Math.trunc(a*t());c[u++]=o[l],o[l]=o[--a]}return c},_private:this}}},q_={name:"random",noClient:({api:e})=>e._private.isUsed(),flush:({api:e})=>e._private.getState(),api:({data:e})=>new ms(e).api(),setup:({game:e})=>{let{seed:t}=e;return t===void 0&&(t=ms.seed()),{seed:t}},playerView:()=>{}};$o.RandomPlugin=q_;$o.alea=Ml});var tn=v((eD,Cl)=>{var j_="[object Object]";function D_(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function R_(e,t){return function(n){return e(t(n))}}var B_=Function.prototype,Il=Object.prototype,Nl=B_.toString,L_=Il.hasOwnProperty,G_=Nl.call(Object),F_=Il.toString,U_=R_(Object.getPrototypeOf,Object);function V_(e){return!!e&&typeof e=="object"}function z_(e){if(!V_(e)||F_.call(e)!=j_||D_(e))return!1;var t=U_(e);if(t===null)return!0;var n=L_.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Nl.call(n)==G_}Cl.exports=z_});var Zl=v(K=>{"use strict";var K_=Jo(),H_=Xo(),tD=tn();function W_(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var J_=W_(K_),ql="MAKE_MOVE",ta="GAME_EVENT",jl="REDO",Dl="RESET",Rl="SYNC",Bl="UNDO",Ll="UPDATE",Gl="PATCH",Fl="PLUGIN",Ul="STRIP_TRANSIENTS",Vl=(e,t,n,r)=>({type:ql,payload:{type:e,args:t,playerID:n,credentials:r}}),zl=(e,t,n,r)=>({type:ta,payload:{type:e,args:t,playerID:n,credentials:r}}),Kl=(e,t,n,r)=>({type:ta,payload:{type:e,args:t,playerID:n,credentials:r},automatic:!0}),Hl=e=>({type:Rl,state:e.state,log:e.log,initialState:e.initialState,clientOnly:!0}),Wl=(e,t,n,r)=>({type:Gl,prevStateID:e,stateID:t,patch:n,deltalog:r,clientOnly:!0}),Jl=(e,t)=>({type:Ll,state:e,deltalog:t,clientOnly:!0}),Yl=e=>({type:Dl,state:e,clientOnly:!0}),$l=(e,t)=>({type:Bl,payload:{type:null,args:null,playerID:e,credentials:t}}),Xl=(e,t)=>({type:jl,payload:{type:null,args:null,playerID:e,credentials:t}}),Y_=(e,t,n,r)=>({type:Fl,payload:{type:e,args:t,playerID:n,credentials:r}}),Ql=()=>({type:Ul}),$_=Object.freeze({__proto__:null,makeMove:Vl,gameEvent:zl,automaticGameEvent:Kl,sync:Hl,patch:Wl,update:Jl,reset:Yl,undo:$l,redo:Xl,plugin:Y_,stripTransients:Ql}),Qo="INVALID_MOVE",X_={name:"plugin-immer",fnWrap:e=>(t,...n)=>{let r=!1,i=J_.default(t.G,s=>{let o=e({...t,G:s},...n);if(o===Qo){r=!0;return}return o});return r?Qo:i}};K.GameMethod=void 0;(function(e){e.MOVE="MOVE",e.GAME_ON_END="GAME_ON_END",e.PHASE_ON_BEGIN="PHASE_ON_BEGIN",e.PHASE_ON_END="PHASE_ON_END",e.TURN_ON_BEGIN="TURN_ON_BEGIN",e.TURN_ON_MOVE="TURN_ON_MOVE",e.TURN_ON_END="TURN_ON_END"})(K.GameMethod||(K.GameMethod={}));var Pt;(function(e){e.CalledOutsideHook="Events must be called from moves or the `onBegin`, `onEnd`, and `onMove` hooks.\nThis error probably means you called an event from other game code, like an `endIf` trigger or one of the `turn.order` methods.",e.EndTurnInOnEnd="`endTurn` is disallowed in `onEnd` hooks \u2014 the turn is already ending.",e.MaxTurnEndings=`Maximum number of turn endings exceeded for this update.
|
|
2
|
-
This likely means game code is triggering an infinite loop.`,e.PhaseEventInOnEnd="`setPhase` & `endPhase` are disallowed in a phase\u2019s `onEnd` hook \u2014 the phase is already ending.\nIf you\u2019re trying to dynamically choose the next phase when a phase ends, use the phase\u2019s `next` trigger.",e.StageEventInOnEnd="`setStage`, `endStage` & `setActivePlayers` are disallowed in `onEnd` hooks.",e.StageEventInPhaseBegin="`setStage`, `endStage` & `setActivePlayers` are disallowed in a phase\u2019s `onBegin` hook.\nUse `setActivePlayers` in a `turn.onBegin` hook or declare stages with `turn.activePlayers` instead.",e.StageEventInTurnBegin="`setStage` & `endStage` are disallowed in `turn.onBegin`.\nUse `setActivePlayers` or declare stages with `turn.activePlayers` instead."})(
|
|
3
|
-
`+i}}}});e:for(let i=0;i<this.dispatch.length;i++){let s=this.dispatch[i],o=s.turn!==t.ctx.turn;if(this.currentTurn-this.initialTurn>=this.maxEndedTurnsPerAction)return r(s.error,
|
|
4
|
-
${s}`),[e,r]},p0=({G:e,ctx:t,plugins:n={}},{game:r,playerID:i})=>([...br,...r.plugins].forEach(({name:s,playerView:o})=>{if(!o)return;let{data:a}=n[s]||{data:{}},u=o({G:e,ctx:t,game:r,data:a,playerID:i});n={...n,[s]:{data:u}}}),n);function sa(e,t=!1){e.moveLimit&&(t&&(e.minMoves=e.moveLimit),e.maxMoves=e.moveLimit,delete e.moveLimit)}function oa(e,t){let n={},r=[],i=null,s={},o={};if(Array.isArray(t)){let u={};t.forEach(c=>u[c]=nn.NULL),n=u}else{if(sa(t),t.next&&(i=t.next),t.revert&&(r=[...e._prevActivePlayers,{activePlayers:e.activePlayers,_activePlayersMinMoves:e._activePlayersMinMoves,_activePlayersMaxMoves:e._activePlayersMaxMoves,_activePlayersNumMoves:e._activePlayersNumMoves}]),t.currentPlayer!==void 0&&gs(n,s,o,e.currentPlayer,t.currentPlayer),t.others!==void 0)for(let u=0;u<e.playOrder.length;u++){let c=e.playOrder[u];c!==e.currentPlayer&&gs(n,s,o,c,t.others)}if(t.all!==void 0)for(let u=0;u<e.playOrder.length;u++){let c=e.playOrder[u];gs(n,s,o,c,t.all)}if(t.value)for(let u in t.value)gs(n,s,o,u,t.value[u]);if(t.minMoves)for(let u in n)s[u]===void 0&&(s[u]=t.minMoves);if(t.maxMoves)for(let u in n)o[u]===void 0&&(o[u]=t.maxMoves)}Object.keys(n).length===0&&(n=null),Object.keys(s).length===0&&(s=null),Object.keys(o).length===0&&(o=null);let a={};for(let u in n)a[u]=0;return{...e,activePlayers:n,_activePlayersMinMoves:s,_activePlayersMaxMoves:o,_activePlayersNumMoves:a,_prevActivePlayers:r,_nextActivePlayers:i}}function h0(e){let{activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s,_nextActivePlayers:o}=e;if(t&&Object.keys(t).length===0)if(o)e=oa(e,o),{activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s}=e;else if(s.length>0){let a=s.length-1;({activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i}=s[a]),s=s.slice(0,a)}else t=null,n=null,r=null;return{...e,activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s}}function gs(e,t,n,r,i){(typeof i!="object"||i===nn.NULL)&&(i={stage:i}),i.stage!==void 0&&(sa(i),e[r]=i.stage,i.minMoves&&(t[r]=i.minMoves),i.maxMoves&&(n[r]=i.maxMoves))}function ea(e,t){return e[t]+""}function d0(e,t){let{G:n,ctx:r}=e,{numPlayers:i}=r,o={...ia(e),G:n,ctx:r},a=t.order,u=[...Array.from({length:i})].map((p,h)=>h+"");a.playOrder!==void 0&&(u=a.playOrder(o));let c=a.first(o),l=typeof c;l!=="number"&&Sn(`invalid value returned by turn.order.first \u2014 expected number got ${l} \u201C${c}\u201D.`);let f=ea(u,c);return r={...r,currentPlayer:f,playOrderPos:c,playOrder:u},r=oa(r,t.activePlayers||{}),r}function m0(e,t,n,r){let i=n.order,{G:s,ctx:o}=e,a=o.playOrderPos,u=!1;if(r&&r!==!0)typeof r!="object"&&Sn(`invalid argument to endTurn: ${r}`),Object.keys(r).forEach(c=>{switch(c){case"remove":t=ea(o.playOrder,a);break;case"next":a=o.playOrder.indexOf(r.next),t=r.next;break;default:Sn(`invalid argument to endTurn: ${c}`)}});else{let l={...ia(e),G:s,ctx:o},f=i.next(l),p=typeof f;f!==void 0&&p!=="number"&&Sn(`invalid value returned by turn.order.next \u2014 expected number or undefined got ${p} \u201C${f}\u201D.`),f===void 0?u=!0:(a=f,t=ea(o.playOrder,a))}return o={...o,playOrderPos:a,currentPlayer:t},{endPhase:u,ctx:o}}var g0={DEFAULT:{first:({ctx:e})=>e.turn===0?e.playOrderPos:(e.playOrderPos+1)%e.playOrder.length,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},RESET:{first:()=>0,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},CONTINUE:{first:({ctx:e})=>e.playOrderPos,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},ONCE:{first:()=>0,next:({ctx:e})=>{if(e.playOrderPos<e.playOrder.length-1)return e.playOrderPos+1}},CUSTOM:e=>({playOrder:()=>e,first:()=>0,next:({ctx:t})=>(t.playOrderPos+1)%t.playOrder.length}),CUSTOM_FROM:e=>({playOrder:({G:t})=>t[e],first:()=>0,next:({ctx:t})=>(t.playOrderPos+1)%t.playOrder.length})},nn={NULL:null},y0={ALL:{all:nn.NULL},ALL_ONCE:{all:nn.NULL,minMoves:1,maxMoves:1},OTHERS:{others:nn.NULL},OTHERS_ONCE:{others:nn.NULL,minMoves:1,maxMoves:1}};K.ActionCreators=$_;K.ActivePlayers=y0;K.Enhance=a0;K.FlushAndValidate=f0;K.FnWrap=s0;K.GAME_EVENT=ta;K.GetAPIs=ia;K.INVALID_MOVE=Qo;K.InitTurnOrderState=d0;K.MAKE_MOVE=ql;K.NoClient=c0;K.PATCH=Gl;K.PLUGIN=Fl;K.PlayerView=p0;K.ProcessAction=i0;K.REDO=jl;K.RESET=Dl;K.STRIP_TRANSIENTS=Ul;K.SYNC=Rl;K.SetActivePlayers=oa;K.Setup=o0;K.Stage=nn;K.TurnOrder=g0;K.UNDO=Bl;K.UPDATE=Ll;K.UpdateActivePlayersOnceEmpty=h0;K.UpdateTurnOrderState=m0;K.error=Sn;K.gameEvent=zl;K.info=r0;K.makeMove=Vl;K.patch=Wl;K.redo=Xl;K.reset=Yl;K.stripTransients=Ql;K.supportDeprecatedMoveLimit=sa;K.sync=Hl;K.undo=$l;K.update=Jl});var aa=v(zt=>{"use strict";Object.defineProperty(zt,"__esModule",{value:!0});var _r=Zl();Jo();Xo();tn();var v0={STRIP_SECRETS:({G:e,playerID:t})=>{let n={...e};return n.secret!==void 0&&delete n.secret,n.players&&(n.players=t?{[t]:n.players[t]}:{}),n}};zt.ActivePlayers=_r.ActivePlayers;Object.defineProperty(zt,"GameMethod",{enumerable:!0,get:function(){return _r.GameMethod}});zt.INVALID_MOVE=_r.INVALID_MOVE;zt.Stage=_r.Stage;zt.TurnOrder=_r.TurnOrder;zt.PlayerView=v0});var tf=v((fD,ef)=>{function b0(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s}ef.exports=b0});var Or=v((pD,nf)=>{function _0(e,t){return e===t||e!==e&&t!==t}nf.exports=_0});var ua=v((hD,rf)=>{var w0=typeof global=="object"&&global&&global.Object===Object&&global;rf.exports=w0});var rt=v((dD,sf)=>{var O0=ua(),P0=typeof self=="object"&&self&&self.Object===Object&&self,E0=O0||P0||Function("return this")();sf.exports=E0});var on=v((mD,of)=>{var k0=rt(),A0=k0.Symbol;of.exports=A0});var lf=v((gD,cf)=>{var af=on(),uf=Object.prototype,x0=uf.hasOwnProperty,S0=uf.toString,Pr=af?af.toStringTag:void 0;function T0(e){var t=x0.call(e,Pr),n=e[Pr];try{e[Pr]=void 0;var r=!0}catch{}var i=S0.call(e);return r&&(t?e[Pr]=n:delete e[Pr]),i}cf.exports=T0});var pf=v((yD,ff)=>{var M0=Object.prototype,I0=M0.toString;function N0(e){return I0.call(e)}ff.exports=N0});var an=v((vD,mf)=>{var hf=on(),C0=lf(),q0=pf(),j0="[object Null]",D0="[object Undefined]",df=hf?hf.toStringTag:void 0;function R0(e){return e==null?e===void 0?D0:j0:df&&df in Object(e)?C0(e):q0(e)}mf.exports=R0});var pt=v((bD,gf)=>{function B0(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}gf.exports=B0});var ca=v((_D,yf)=>{var L0=an(),G0=pt(),F0="[object AsyncFunction]",U0="[object Function]",V0="[object GeneratorFunction]",z0="[object Proxy]";function K0(e){if(!G0(e))return!1;var t=L0(e);return t==U0||t==V0||t==F0||t==z0}yf.exports=K0});var ys=v((wD,vf)=>{var H0=9007199254740991;function W0(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=H0}vf.exports=W0});var Tn=v((OD,bf)=>{var J0=ca(),Y0=ys();function $0(e){return e!=null&&Y0(e.length)&&!J0(e)}bf.exports=$0});var Er=v((PD,_f)=>{var X0=9007199254740991,Q0=/^(?:0|[1-9]\d*)$/;function Z0(e,t){var n=typeof e;return t=t??X0,!!t&&(n=="number"||n!="symbol"&&Q0.test(e))&&e>-1&&e%1==0&&e<t}_f.exports=Z0});var Of=v((ED,wf)=>{var ew=Or(),tw=Tn(),nw=Er(),rw=pt();function iw(e,t,n){if(!rw(n))return!1;var r=typeof t;return(r=="number"?tw(n)&&nw(t,n.length):r=="string"&&t in n)?ew(n[t],e):!1}wf.exports=iw});var Ef=v((kD,Pf)=>{var sw=/\s/;function ow(e){for(var t=e.length;t--&&sw.test(e.charAt(t)););return t}Pf.exports=ow});var Af=v((AD,kf)=>{var aw=Ef(),uw=/^\s+/;function cw(e){return e&&e.slice(0,aw(e)+1).replace(uw,"")}kf.exports=cw});var kt=v((xD,xf)=>{function lw(e){return e!=null&&typeof e=="object"}xf.exports=lw});var kr=v((SD,Sf)=>{var fw=an(),pw=kt(),hw="[object Symbol]";function dw(e){return typeof e=="symbol"||pw(e)&&fw(e)==hw}Sf.exports=dw});var Nf=v((TD,If)=>{var mw=Af(),Tf=pt(),gw=kr(),Mf=NaN,yw=/^[-+]0x[0-9a-f]+$/i,vw=/^0b[01]+$/i,bw=/^0o[0-7]+$/i,_w=parseInt;function ww(e){if(typeof e=="number")return e;if(gw(e))return Mf;if(Tf(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Tf(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=mw(e);var n=vw.test(e);return n||bw.test(e)?_w(e.slice(2),n?2:8):yw.test(e)?Mf:+e}If.exports=ww});var jf=v((MD,qf)=>{var Ow=Nf(),Cf=1/0,Pw=17976931348623157e292;function Ew(e){if(!e)return e===0?e:0;if(e=Ow(e),e===Cf||e===-Cf){var t=e<0?-1:1;return t*Pw}return e===e?e:0}qf.exports=Ew});var la=v((ID,Df)=>{var kw=jf();function Aw(e){var t=kw(e),n=t%1;return t===t?n?t-n:t:0}Df.exports=Aw});var Bf=v((ND,Rf)=>{var xw=tf(),Sw=Of(),Tw=la(),Mw=Math.ceil,Iw=Math.max;function Nw(e,t,n){(n?Sw(e,t,n):t===void 0)?t=1:t=Iw(Tw(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var i=0,s=0,o=Array(Mw(r/t));i<r;)o[s++]=xw(e,i,i+=t);return o}Rf.exports=Nw});var Ff=v((jD,Gf)=>{function Cw(){this.__data__=[],this.size=0}Gf.exports=Cw});var xr=v((DD,Uf)=>{var qw=Or();function jw(e,t){for(var n=e.length;n--;)if(qw(e[n][0],t))return n;return-1}Uf.exports=jw});var zf=v((RD,Vf)=>{var Dw=xr(),Rw=Array.prototype,Bw=Rw.splice;function Lw(e){var t=this.__data__,n=Dw(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Bw.call(t,n,1),--this.size,!0}Vf.exports=Lw});var Hf=v((BD,Kf)=>{var Gw=xr();function Fw(e){var t=this.__data__,n=Gw(t,e);return n<0?void 0:t[n][1]}Kf.exports=Fw});var Jf=v((LD,Wf)=>{var Uw=xr();function Vw(e){return Uw(this.__data__,e)>-1}Wf.exports=Vw});var $f=v((GD,Yf)=>{var zw=xr();function Kw(e,t){var n=this.__data__,r=zw(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}Yf.exports=Kw});var Sr=v((FD,Xf)=>{var Hw=Ff(),Ww=zf(),Jw=Hf(),Yw=Jf(),$w=$f();function Mn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Mn.prototype.clear=Hw;Mn.prototype.delete=Ww;Mn.prototype.get=Jw;Mn.prototype.has=Yw;Mn.prototype.set=$w;Xf.exports=Mn});var Zf=v((UD,Qf)=>{var Xw=Sr();function Qw(){this.__data__=new Xw,this.size=0}Qf.exports=Qw});var tp=v((VD,ep)=>{function Zw(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}ep.exports=Zw});var rp=v((zD,np)=>{function eO(e){return this.__data__.get(e)}np.exports=eO});var sp=v((KD,ip)=>{function tO(e){return this.__data__.has(e)}ip.exports=tO});var ap=v((HD,op)=>{var nO=rt(),rO=nO["__core-js_shared__"];op.exports=rO});var lp=v((WD,cp)=>{var fa=ap(),up=function(){var e=/[^.]+$/.exec(fa&&fa.keys&&fa.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function iO(e){return!!up&&up in e}cp.exports=iO});var pa=v((JD,fp)=>{var sO=Function.prototype,oO=sO.toString;function aO(e){if(e!=null){try{return oO.call(e)}catch{}try{return e+""}catch{}}return""}fp.exports=aO});var hp=v((YD,pp)=>{var uO=ca(),cO=lp(),lO=pt(),fO=pa(),pO=/[\\^$.*+?()[\]{}|]/g,hO=/^\[object .+?Constructor\]$/,dO=Function.prototype,mO=Object.prototype,gO=dO.toString,yO=mO.hasOwnProperty,vO=RegExp("^"+gO.call(yO).replace(pO,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function bO(e){if(!lO(e)||cO(e))return!1;var t=uO(e)?vO:hO;return t.test(fO(e))}pp.exports=bO});var mp=v(($D,dp)=>{function _O(e,t){return e?.[t]}dp.exports=_O});var Kt=v((XD,gp)=>{var wO=hp(),OO=mp();function PO(e,t){var n=OO(e,t);return wO(n)?n:void 0}gp.exports=PO});var vs=v((QD,yp)=>{var EO=Kt(),kO=rt(),AO=EO(kO,"Map");yp.exports=AO});var Tr=v((ZD,vp)=>{var xO=Kt(),SO=xO(Object,"create");vp.exports=SO});var wp=v((eR,_p)=>{var bp=Tr();function TO(){this.__data__=bp?bp(null):{},this.size=0}_p.exports=TO});var Pp=v((tR,Op)=>{function MO(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}Op.exports=MO});var kp=v((nR,Ep)=>{var IO=Tr(),NO="__lodash_hash_undefined__",CO=Object.prototype,qO=CO.hasOwnProperty;function jO(e){var t=this.__data__;if(IO){var n=t[e];return n===NO?void 0:n}return qO.call(t,e)?t[e]:void 0}Ep.exports=jO});var xp=v((rR,Ap)=>{var DO=Tr(),RO=Object.prototype,BO=RO.hasOwnProperty;function LO(e){var t=this.__data__;return DO?t[e]!==void 0:BO.call(t,e)}Ap.exports=LO});var Tp=v((iR,Sp)=>{var GO=Tr(),FO="__lodash_hash_undefined__";function UO(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=GO&&t===void 0?FO:t,this}Sp.exports=UO});var Ip=v((sR,Mp)=>{var VO=wp(),zO=Pp(),KO=kp(),HO=xp(),WO=Tp();function In(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}In.prototype.clear=VO;In.prototype.delete=zO;In.prototype.get=KO;In.prototype.has=HO;In.prototype.set=WO;Mp.exports=In});var qp=v((oR,Cp)=>{var Np=Ip(),JO=Sr(),YO=vs();function $O(){this.size=0,this.__data__={hash:new Np,map:new(YO||JO),string:new Np}}Cp.exports=$O});var Dp=v((aR,jp)=>{function XO(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}jp.exports=XO});var Mr=v((uR,Rp)=>{var QO=Dp();function ZO(e,t){var n=e.__data__;return QO(t)?n[typeof t=="string"?"string":"hash"]:n.map}Rp.exports=ZO});var Lp=v((cR,Bp)=>{var eP=Mr();function tP(e){var t=eP(this,e).delete(e);return this.size-=t?1:0,t}Bp.exports=tP});var Fp=v((lR,Gp)=>{var nP=Mr();function rP(e){return nP(this,e).get(e)}Gp.exports=rP});var Vp=v((fR,Up)=>{var iP=Mr();function sP(e){return iP(this,e).has(e)}Up.exports=sP});var Kp=v((pR,zp)=>{var oP=Mr();function aP(e,t){var n=oP(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}zp.exports=aP});var bs=v((hR,Hp)=>{var uP=qp(),cP=Lp(),lP=Fp(),fP=Vp(),pP=Kp();function Nn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Nn.prototype.clear=uP;Nn.prototype.delete=cP;Nn.prototype.get=lP;Nn.prototype.has=fP;Nn.prototype.set=pP;Hp.exports=Nn});var Jp=v((dR,Wp)=>{var hP=Sr(),dP=vs(),mP=bs(),gP=200;function yP(e,t){var n=this.__data__;if(n instanceof hP){var r=n.__data__;if(!dP||r.length<gP-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new mP(r)}return n.set(e,t),this.size=n.size,this}Wp.exports=yP});var _s=v((mR,Yp)=>{var vP=Sr(),bP=Zf(),_P=tp(),wP=rp(),OP=sp(),PP=Jp();function Cn(e){var t=this.__data__=new vP(e);this.size=t.size}Cn.prototype.clear=bP;Cn.prototype.delete=_P;Cn.prototype.get=wP;Cn.prototype.has=OP;Cn.prototype.set=PP;Yp.exports=Cn});var Xp=v((gR,$p)=>{var EP="__lodash_hash_undefined__";function kP(e){return this.__data__.set(e,EP),this}$p.exports=kP});var Zp=v((yR,Qp)=>{function AP(e){return this.__data__.has(e)}Qp.exports=AP});var th=v((vR,eh)=>{var xP=bs(),SP=Xp(),TP=Zp();function ws(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new xP;++t<n;)this.add(e[t])}ws.prototype.add=ws.prototype.push=SP;ws.prototype.has=TP;eh.exports=ws});var rh=v((bR,nh)=>{function MP(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}nh.exports=MP});var sh=v((_R,ih)=>{function IP(e,t){return e.has(t)}ih.exports=IP});var ha=v((wR,oh)=>{var NP=th(),CP=rh(),qP=sh(),jP=1,DP=2;function RP(e,t,n,r,i,s){var o=n&jP,a=e.length,u=t.length;if(a!=u&&!(o&&u>a))return!1;var c=s.get(e),l=s.get(t);if(c&&l)return c==t&&l==e;var f=-1,p=!0,h=n&DP?new NP:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var d=e[f],y=t[f];if(r)var m=o?r(y,d,f,t,e,s):r(d,y,f,e,t,s);if(m!==void 0){if(m)continue;p=!1;break}if(h){if(!CP(t,function(b,g){if(!qP(h,g)&&(d===b||i(d,b,n,r,s)))return h.push(g)})){p=!1;break}}else if(!(d===y||i(d,y,n,r,s))){p=!1;break}}return s.delete(e),s.delete(t),p}oh.exports=RP});var da=v((OR,ah)=>{var BP=rt(),LP=BP.Uint8Array;ah.exports=LP});var ch=v((PR,uh)=>{function GP(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}uh.exports=GP});var fh=v((ER,lh)=>{function FP(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}lh.exports=FP});var gh=v((kR,mh)=>{var ph=on(),hh=da(),UP=Or(),VP=ha(),zP=ch(),KP=fh(),HP=1,WP=2,JP="[object Boolean]",YP="[object Date]",$P="[object Error]",XP="[object Map]",QP="[object Number]",ZP="[object RegExp]",eE="[object Set]",tE="[object String]",nE="[object Symbol]",rE="[object ArrayBuffer]",iE="[object DataView]",dh=ph?ph.prototype:void 0,ma=dh?dh.valueOf:void 0;function sE(e,t,n,r,i,s,o){switch(n){case iE:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case rE:return!(e.byteLength!=t.byteLength||!s(new hh(e),new hh(t)));case JP:case YP:case QP:return UP(+e,+t);case $P:return e.name==t.name&&e.message==t.message;case ZP:case tE:return e==t+"";case XP:var a=zP;case eE:var u=r&HP;if(a||(a=KP),e.size!=t.size&&!u)return!1;var c=o.get(e);if(c)return c==t;r|=WP,o.set(e,t);var l=VP(a(e),a(t),r,i,s,o);return o.delete(e),l;case nE:if(ma)return ma.call(e)==ma.call(t)}return!1}mh.exports=sE});var Os=v((AR,yh)=>{function oE(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}yh.exports=oE});var et=v((xR,vh)=>{var aE=Array.isArray;vh.exports=aE});var ga=v((SR,bh)=>{var uE=Os(),cE=et();function lE(e,t,n){var r=t(e);return cE(e)?r:uE(r,n(e))}bh.exports=lE});var ya=v((TR,_h)=>{function fE(e,t){for(var n=-1,r=e==null?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s}_h.exports=fE});var va=v((MR,wh)=>{function pE(){return[]}wh.exports=pE});var Ps=v((IR,Ph)=>{var hE=ya(),dE=va(),mE=Object.prototype,gE=mE.propertyIsEnumerable,Oh=Object.getOwnPropertySymbols,yE=Oh?function(e){return e==null?[]:(e=Object(e),hE(Oh(e),function(t){return gE.call(e,t)}))}:dE;Ph.exports=yE});var kh=v((NR,Eh)=>{function vE(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}Eh.exports=vE});var xh=v((CR,Ah)=>{var bE=an(),_E=kt(),wE="[object Arguments]";function OE(e){return _E(e)&&bE(e)==wE}Ah.exports=OE});var Es=v((qR,Mh)=>{var Sh=xh(),PE=kt(),Th=Object.prototype,EE=Th.hasOwnProperty,kE=Th.propertyIsEnumerable,AE=Sh(function(){return arguments}())?Sh:function(e){return PE(e)&&EE.call(e,"callee")&&!kE.call(e,"callee")};Mh.exports=AE});var Nh=v((jR,Ih)=>{function xE(){return!1}Ih.exports=xE});var ks=v((Ir,qn)=>{var SE=rt(),TE=Nh(),jh=typeof Ir=="object"&&Ir&&!Ir.nodeType&&Ir,Ch=jh&&typeof qn=="object"&&qn&&!qn.nodeType&&qn,ME=Ch&&Ch.exports===jh,qh=ME?SE.Buffer:void 0,IE=qh?qh.isBuffer:void 0,NE=IE||TE;qn.exports=NE});var Rh=v((DR,Dh)=>{var CE=an(),qE=ys(),jE=kt(),DE="[object Arguments]",RE="[object Array]",BE="[object Boolean]",LE="[object Date]",GE="[object Error]",FE="[object Function]",UE="[object Map]",VE="[object Number]",zE="[object Object]",KE="[object RegExp]",HE="[object Set]",WE="[object String]",JE="[object WeakMap]",YE="[object ArrayBuffer]",$E="[object DataView]",XE="[object Float32Array]",QE="[object Float64Array]",ZE="[object Int8Array]",ek="[object Int16Array]",tk="[object Int32Array]",nk="[object Uint8Array]",rk="[object Uint8ClampedArray]",ik="[object Uint16Array]",sk="[object Uint32Array]",be={};be[XE]=be[QE]=be[ZE]=be[ek]=be[tk]=be[nk]=be[rk]=be[ik]=be[sk]=!0;be[DE]=be[RE]=be[YE]=be[BE]=be[$E]=be[LE]=be[GE]=be[FE]=be[UE]=be[VE]=be[zE]=be[KE]=be[HE]=be[WE]=be[JE]=!1;function ok(e){return jE(e)&&qE(e.length)&&!!be[CE(e)]}Dh.exports=ok});var As=v((RR,Bh)=>{function ak(e){return function(t){return e(t)}}Bh.exports=ak});var xs=v((Nr,jn)=>{var uk=ua(),Lh=typeof Nr=="object"&&Nr&&!Nr.nodeType&&Nr,Cr=Lh&&typeof jn=="object"&&jn&&!jn.nodeType&&jn,ck=Cr&&Cr.exports===Lh,ba=ck&&uk.process,lk=function(){try{var e=Cr&&Cr.require&&Cr.require("util").types;return e||ba&&ba.binding&&ba.binding("util")}catch{}}();jn.exports=lk});var _a=v((BR,Uh)=>{var fk=Rh(),pk=As(),Gh=xs(),Fh=Gh&&Gh.isTypedArray,hk=Fh?pk(Fh):fk;Uh.exports=hk});var wa=v((LR,Vh)=>{var dk=kh(),mk=Es(),gk=et(),yk=ks(),vk=Er(),bk=_a(),_k=Object.prototype,wk=_k.hasOwnProperty;function Ok(e,t){var n=gk(e),r=!n&&mk(e),i=!n&&!r&&yk(e),s=!n&&!r&&!i&&bk(e),o=n||r||i||s,a=o?dk(e.length,String):[],u=a.length;for(var c in e)(t||wk.call(e,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||vk(c,u)))&&a.push(c);return a}Vh.exports=Ok});var Ss=v((GR,zh)=>{var Pk=Object.prototype;function Ek(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Pk;return e===n}zh.exports=Ek});var Oa=v((FR,Kh)=>{function kk(e,t){return function(n){return e(t(n))}}Kh.exports=kk});var Wh=v((UR,Hh)=>{var Ak=Oa(),xk=Ak(Object.keys,Object);Hh.exports=xk});var Yh=v((VR,Jh)=>{var Sk=Ss(),Tk=Wh(),Mk=Object.prototype,Ik=Mk.hasOwnProperty;function Nk(e){if(!Sk(e))return Tk(e);var t=[];for(var n in Object(e))Ik.call(e,n)&&n!="constructor"&&t.push(n);return t}Jh.exports=Nk});var un=v((zR,$h)=>{var Ck=wa(),qk=Yh(),jk=Tn();function Dk(e){return jk(e)?Ck(e):qk(e)}$h.exports=Dk});var Pa=v((KR,Xh)=>{var Rk=ga(),Bk=Ps(),Lk=un();function Gk(e){return Rk(e,Lk,Bk)}Xh.exports=Gk});var ed=v((HR,Zh)=>{var Qh=Pa(),Fk=1,Uk=Object.prototype,Vk=Uk.hasOwnProperty;function zk(e,t,n,r,i,s){var o=n&Fk,a=Qh(e),u=a.length,c=Qh(t),l=c.length;if(u!=l&&!o)return!1;for(var f=u;f--;){var p=a[f];if(!(o?p in t:Vk.call(t,p)))return!1}var h=s.get(e),d=s.get(t);if(h&&d)return h==t&&d==e;var y=!0;s.set(e,t),s.set(t,e);for(var m=o;++f<u;){p=a[f];var b=e[p],g=t[p];if(r)var O=o?r(g,b,p,t,e,s):r(b,g,p,e,t,s);if(!(O===void 0?b===g||i(b,g,n,r,s):O)){y=!1;break}m||(m=p=="constructor")}if(y&&!m){var I=e.constructor,j=t.constructor;I!=j&&"constructor"in e&&"constructor"in t&&!(typeof I=="function"&&I instanceof I&&typeof j=="function"&&j instanceof j)&&(y=!1)}return s.delete(e),s.delete(t),y}Zh.exports=zk});var nd=v((WR,td)=>{var Kk=Kt(),Hk=rt(),Wk=Kk(Hk,"DataView");td.exports=Wk});var id=v((JR,rd)=>{var Jk=Kt(),Yk=rt(),$k=Jk(Yk,"Promise");rd.exports=$k});var od=v((YR,sd)=>{var Xk=Kt(),Qk=rt(),Zk=Xk(Qk,"Set");sd.exports=Zk});var ud=v(($R,ad)=>{var eA=Kt(),tA=rt(),nA=eA(tA,"WeakMap");ad.exports=nA});var qr=v((XR,md)=>{var Ea=nd(),ka=vs(),Aa=id(),xa=od(),Sa=ud(),dd=an(),Dn=pa(),cd="[object Map]",rA="[object Object]",ld="[object Promise]",fd="[object Set]",pd="[object WeakMap]",hd="[object DataView]",iA=Dn(Ea),sA=Dn(ka),oA=Dn(Aa),aA=Dn(xa),uA=Dn(Sa),cn=dd;(Ea&&cn(new Ea(new ArrayBuffer(1)))!=hd||ka&&cn(new ka)!=cd||Aa&&cn(Aa.resolve())!=ld||xa&&cn(new xa)!=fd||Sa&&cn(new Sa)!=pd)&&(cn=function(e){var t=dd(e),n=t==rA?e.constructor:void 0,r=n?Dn(n):"";if(r)switch(r){case iA:return hd;case sA:return cd;case oA:return ld;case aA:return fd;case uA:return pd}return t});md.exports=cn});var Pd=v((QR,Od)=>{var Ta=_s(),cA=ha(),lA=gh(),fA=ed(),gd=qr(),yd=et(),vd=ks(),pA=_a(),hA=1,bd="[object Arguments]",_d="[object Array]",Ts="[object Object]",dA=Object.prototype,wd=dA.hasOwnProperty;function mA(e,t,n,r,i,s){var o=yd(e),a=yd(t),u=o?_d:gd(e),c=a?_d:gd(t);u=u==bd?Ts:u,c=c==bd?Ts:c;var l=u==Ts,f=c==Ts,p=u==c;if(p&&vd(e)){if(!vd(t))return!1;o=!0,l=!1}if(p&&!l)return s||(s=new Ta),o||pA(e)?cA(e,t,n,r,i,s):lA(e,t,u,n,r,i,s);if(!(n&hA)){var h=l&&wd.call(e,"__wrapped__"),d=f&&wd.call(t,"__wrapped__");if(h||d){var y=h?e.value():e,m=d?t.value():t;return s||(s=new Ta),i(y,m,n,r,s)}}return p?(s||(s=new Ta),fA(e,t,n,r,i,s)):!1}Od.exports=mA});var Ma=v((ZR,Ad)=>{var gA=Pd(),Ed=kt();function kd(e,t,n,r,i){return e===t?!0:e==null||t==null||!Ed(e)&&!Ed(t)?e!==e&&t!==t:gA(e,t,n,r,kd,i)}Ad.exports=kd});var Sd=v((e4,xd)=>{var yA=_s(),vA=Ma(),bA=1,_A=2;function wA(e,t,n,r){var i=n.length,s=i,o=!r;if(e==null)return!s;for(e=Object(e);i--;){var a=n[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){a=n[i];var u=a[0],c=e[u],l=a[1];if(o&&a[2]){if(c===void 0&&!(u in e))return!1}else{var f=new yA;if(r)var p=r(c,l,u,e,t,f);if(!(p===void 0?vA(l,c,bA|_A,r,f):p))return!1}}return!0}xd.exports=wA});var Ia=v((t4,Td)=>{var OA=pt();function PA(e){return e===e&&!OA(e)}Td.exports=PA});var Id=v((n4,Md)=>{var EA=Ia(),kA=un();function AA(e){for(var t=kA(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,EA(i)]}return t}Md.exports=AA});var Na=v((r4,Nd)=>{function xA(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}Nd.exports=xA});var Ca=v((i4,Cd)=>{var SA=Sd(),TA=Id(),MA=Na();function IA(e){var t=TA(e);return t.length==1&&t[0][2]?MA(t[0][0],t[0][1]):function(n){return n===e||SA(n,e,t)}}Cd.exports=IA});var Ms=v((s4,qd)=>{var NA=et(),CA=kr(),qA=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,jA=/^\w*$/;function DA(e,t){if(NA(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||CA(e)?!0:jA.test(e)||!qA.test(e)||t!=null&&e in Object(t)}qd.exports=DA});var Rd=v((o4,Dd)=>{var jd=bs(),RA="Expected a function";function qa(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(RA);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=e.apply(this,r);return n.cache=s.set(i,o)||s,o};return n.cache=new(qa.Cache||jd),n}qa.Cache=jd;Dd.exports=qa});var Ld=v((a4,Bd)=>{var BA=Rd(),LA=500;function GA(e){var t=BA(e,function(r){return n.size===LA&&n.clear(),r}),n=t.cache;return t}Bd.exports=GA});var Fd=v((u4,Gd)=>{var FA=Ld(),UA=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,VA=/\\(\\)?/g,zA=FA(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(UA,function(n,r,i,s){t.push(i?s.replace(VA,"$1"):r||n)}),t});Gd.exports=zA});var Vd=v((c4,Ud)=>{function KA(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}Ud.exports=KA});var Yd=v((l4,Jd)=>{var zd=on(),HA=Vd(),WA=et(),JA=kr(),YA=1/0,Kd=zd?zd.prototype:void 0,Hd=Kd?Kd.toString:void 0;function Wd(e){if(typeof e=="string")return e;if(WA(e))return HA(e,Wd)+"";if(JA(e))return Hd?Hd.call(e):"";var t=e+"";return t=="0"&&1/e==-YA?"-0":t}Jd.exports=Wd});var Xd=v((f4,$d)=>{var $A=Yd();function XA(e){return e==null?"":$A(e)}$d.exports=XA});var jr=v((p4,Qd)=>{var QA=et(),ZA=Ms(),ex=Fd(),tx=Xd();function nx(e,t){return QA(e)?e:ZA(e,t)?[e]:ex(tx(e))}Qd.exports=nx});var Rn=v((h4,Zd)=>{var rx=kr(),ix=1/0;function sx(e){if(typeof e=="string"||rx(e))return e;var t=e+"";return t=="0"&&1/e==-ix?"-0":t}Zd.exports=sx});var Is=v((d4,em)=>{var ox=jr(),ax=Rn();function ux(e,t){t=ox(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[ax(t[n++])];return n&&n==r?e:void 0}em.exports=ux});var nm=v((m4,tm)=>{var cx=Is();function lx(e,t,n){var r=e==null?void 0:cx(e,t);return r===void 0?n:r}tm.exports=lx});var im=v((g4,rm)=>{function fx(e,t){return e!=null&&t in Object(e)}rm.exports=fx});var om=v((y4,sm)=>{var px=jr(),hx=Es(),dx=et(),mx=Er(),gx=ys(),yx=Rn();function vx(e,t,n){t=px(t,e);for(var r=-1,i=t.length,s=!1;++r<i;){var o=yx(t[r]);if(!(s=e!=null&&n(e,o)))break;e=e[o]}return s||++r!=i?s:(i=e==null?0:e.length,!!i&&gx(i)&&mx(o,i)&&(dx(e)||hx(e)))}sm.exports=vx});var ja=v((v4,am)=>{var bx=im(),_x=om();function wx(e,t){return e!=null&&_x(e,t,bx)}am.exports=wx});var cm=v((b4,um)=>{var Ox=Ma(),Px=nm(),Ex=ja(),kx=Ms(),Ax=Ia(),xx=Na(),Sx=Rn(),Tx=1,Mx=2;function Ix(e,t){return kx(e)&&Ax(t)?xx(Sx(e),t):function(n){var r=Px(n,e);return r===void 0&&r===t?Ex(n,e):Ox(t,r,Tx|Mx)}}um.exports=Ix});var Da=v((_4,lm)=>{function Nx(e){return e}lm.exports=Nx});var pm=v((w4,fm)=>{function Cx(e){return function(t){return t?.[e]}}fm.exports=Cx});var dm=v((O4,hm)=>{var qx=Is();function jx(e){return function(t){return qx(t,e)}}hm.exports=jx});var gm=v((P4,mm)=>{var Dx=pm(),Rx=dm(),Bx=Ms(),Lx=Rn();function Gx(e){return Bx(e)?Dx(Lx(e)):Rx(e)}mm.exports=Gx});var Ns=v((E4,ym)=>{var Fx=Ca(),Ux=cm(),Vx=Da(),zx=et(),Kx=gm();function Hx(e){return typeof e=="function"?e:e==null?Vx:typeof e=="object"?zx(e)?Ux(e[0],e[1]):Fx(e):Kx(e)}ym.exports=Hx});var bm=v((k4,vm)=>{var Wx=Ns(),Jx=Tn(),Yx=un();function $x(e){return function(t,n,r){var i=Object(t);if(!Jx(t)){var s=Wx(n,3);t=Yx(t),n=function(a){return s(i[a],a,i)}}var o=e(t,n,r);return o>-1?i[s?t[o]:o]:void 0}}vm.exports=$x});var wm=v((A4,_m)=>{function Xx(e,t,n,r){for(var i=e.length,s=n+(r?1:-1);r?s--:++s<i;)if(t(e[s],s,e))return s;return-1}_m.exports=Xx});var Pm=v((x4,Om)=>{var Qx=wm(),Zx=Ns(),eS=la(),tS=Math.max;function nS(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:eS(n);return i<0&&(i=tS(r+i,0)),Qx(e,Zx(t,3),i)}Om.exports=nS});var Ra=v((S4,Em)=>{var rS=bm(),iS=Pm(),sS=rS(iS);Em.exports=sS});var Am=v((T4,km)=>{function oS(e){return function(t,n,r){for(var i=-1,s=Object(t),o=r(t),a=o.length;a--;){var u=o[e?a:++i];if(n(s[u],u,s)===!1)break}return t}}km.exports=oS});var Sm=v((M4,xm)=>{var aS=Am(),uS=aS();xm.exports=uS});var Mm=v((I4,Tm)=>{var cS=Sm(),lS=un();function fS(e,t){return e&&cS(e,t,lS)}Tm.exports=fS});var Nm=v((N4,Im)=>{var pS=Tn();function hS(e,t){return function(n,r){if(n==null)return n;if(!pS(n))return e(n,r);for(var i=n.length,s=t?i:-1,o=Object(n);(t?s--:++s<i)&&r(o[s],s,o)!==!1;);return n}}Im.exports=hS});var qm=v((C4,Cm)=>{var dS=Mm(),mS=Nm(),gS=mS(dS);Cm.exports=gS});var Dm=v((q4,jm)=>{var yS=qm();function vS(e,t){var n=[];return yS(e,function(r,i,s){t(r,i,s)&&n.push(r)}),n}jm.exports=vS});var Bm=v((j4,Rm)=>{var bS=ya(),_S=Dm(),wS=Ns(),OS=et();function PS(e,t){var n=OS(e)?bS:_S;return n(e,wS(t,3))}Rm.exports=PS});var Cs=v((D4,Lm)=>{var ES=Oa(),kS=ES(Object.getPrototypeOf,Object);Lm.exports=kS});var qs=v((R4,Fm)=>{var AS=an(),xS=Cs(),SS=kt(),TS="[object Object]",MS=Function.prototype,IS=Object.prototype,Gm=MS.toString,NS=IS.hasOwnProperty,CS=Gm.call(Object);function qS(e){if(!SS(e)||AS(e)!=TS)return!1;var t=xS(e);if(t===null)return!0;var n=NS.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Gm.call(n)==CS}Fm.exports=qS});var Ba=v((B4,Um)=>{var jS=Kt(),DS=function(){try{var e=jS(Object,"defineProperty");return e({},"",{}),e}catch{}}();Um.exports=DS});var La=v((L4,zm)=>{var Vm=Ba();function RS(e,t,n){t=="__proto__"&&Vm?Vm(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}zm.exports=RS});var js=v((G4,Km)=>{var BS=La(),LS=Or(),GS=Object.prototype,FS=GS.hasOwnProperty;function US(e,t,n){var r=e[t];(!(FS.call(e,t)&&LS(r,n))||n===void 0&&!(t in e))&&BS(e,t,n)}Km.exports=US});var Jm=v((F4,Wm)=>{var VS=js(),zS=jr(),KS=Er(),Hm=pt(),HS=Rn();function WS(e,t,n,r){if(!Hm(e))return e;t=zS(t,e);for(var i=-1,s=t.length,o=s-1,a=e;a!=null&&++i<s;){var u=HS(t[i]),c=n;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=o){var l=a[u];c=r?r(l,u,a):void 0,c===void 0&&(c=Hm(l)?l:KS(t[i+1])?[]:{})}VS(a,u,c),a=a[u]}return e}Wm.exports=WS});var $m=v((U4,Ym)=>{var JS=Is(),YS=Jm(),$S=jr();function XS(e,t,n){for(var r=-1,i=t.length,s={};++r<i;){var o=t[r],a=JS(e,o);n(a,o)&&YS(s,$S(o,e),a)}return s}Ym.exports=XS});var Qm=v((V4,Xm)=>{var QS=$m(),ZS=ja();function eT(e,t){return QS(e,t,function(n,r){return ZS(e,r)})}Xm.exports=eT});var ng=v((z4,tg)=>{var Zm=on(),tT=Es(),nT=et(),eg=Zm?Zm.isConcatSpreadable:void 0;function rT(e){return nT(e)||tT(e)||!!(eg&&e&&e[eg])}tg.exports=rT});var sg=v((K4,ig)=>{var iT=Os(),sT=ng();function rg(e,t,n,r,i){var s=-1,o=e.length;for(n||(n=sT),i||(i=[]);++s<o;){var a=e[s];t>0&&n(a)?t>1?rg(a,t-1,n,r,i):iT(i,a):r||(i[i.length]=a)}return i}ig.exports=rg});var ag=v((H4,og)=>{var oT=sg();function aT(e){var t=e==null?0:e.length;return t?oT(e,1):[]}og.exports=aT});var cg=v((W4,ug)=>{function uT(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}ug.exports=uT});var pg=v((J4,fg)=>{var cT=cg(),lg=Math.max;function lT(e,t,n){return t=lg(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=lg(r.length-t,0),o=Array(s);++i<s;)o[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(o),cT(e,this,a)}}fg.exports=lT});var dg=v((Y4,hg)=>{function fT(e){return function(){return e}}hg.exports=fT});var yg=v(($4,gg)=>{var pT=dg(),mg=Ba(),hT=Da(),dT=mg?function(e,t){return mg(e,"toString",{configurable:!0,enumerable:!1,value:pT(t),writable:!0})}:hT;gg.exports=dT});var bg=v((X4,vg)=>{var mT=800,gT=16,yT=Date.now;function vT(e){var t=0,n=0;return function(){var r=yT(),i=gT-(r-n);if(n=r,i>0){if(++t>=mT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}vg.exports=vT});var wg=v((Q4,_g)=>{var bT=yg(),_T=bg(),wT=_T(bT);_g.exports=wT});var Pg=v((Z4,Og)=>{var OT=ag(),PT=pg(),ET=wg();function kT(e){return ET(PT(e,void 0,OT),e+"")}Og.exports=kT});var Ga=v((e5,Eg)=>{var AT=Qm(),xT=Pg(),ST=xT(function(e,t){return e==null?{}:AT(e,t)});Eg.exports=ST});var Vg=v((h5,Ug)=>{function xM(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}Ug.exports=xM});var Lr=v((d5,zg)=>{var SM=js(),TM=La();function MM(e,t,n,r){var i=!n;n||(n={});for(var s=-1,o=t.length;++s<o;){var a=t[s],u=r?r(n[a],e[a],a,n,e):void 0;u===void 0&&(u=e[a]),i?TM(n,a,u):SM(n,a,u)}return n}zg.exports=MM});var Hg=v((m5,Kg)=>{var IM=Lr(),NM=un();function CM(e,t){return e&&IM(t,NM(t),e)}Kg.exports=CM});var Jg=v((g5,Wg)=>{function qM(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}Wg.exports=qM});var $g=v((y5,Yg)=>{var jM=pt(),DM=Ss(),RM=Jg(),BM=Object.prototype,LM=BM.hasOwnProperty;function GM(e){if(!jM(e))return RM(e);var t=DM(e),n=[];for(var r in e)r=="constructor"&&(t||!LM.call(e,r))||n.push(r);return n}Yg.exports=GM});var Fs=v((v5,Xg)=>{var FM=wa(),UM=$g(),VM=Tn();function zM(e){return VM(e)?FM(e,!0):UM(e)}Xg.exports=zM});var Zg=v((b5,Qg)=>{var KM=Lr(),HM=Fs();function WM(e,t){return e&&KM(t,HM(t),e)}Qg.exports=WM});var iy=v((Gr,Kn)=>{var JM=rt(),ry=typeof Gr=="object"&&Gr&&!Gr.nodeType&&Gr,ey=ry&&typeof Kn=="object"&&Kn&&!Kn.nodeType&&Kn,YM=ey&&ey.exports===ry,ty=YM?JM.Buffer:void 0,ny=ty?ty.allocUnsafe:void 0;function $M(e,t){if(t)return e.slice();var n=e.length,r=ny?ny(n):new e.constructor(n);return e.copy(r),r}Kn.exports=$M});var oy=v((_5,sy)=>{function XM(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}sy.exports=XM});var uy=v((w5,ay)=>{var QM=Lr(),ZM=Ps();function eI(e,t){return QM(e,ZM(e),t)}ay.exports=eI});var $a=v((O5,cy)=>{var tI=Os(),nI=Cs(),rI=Ps(),iI=va(),sI=Object.getOwnPropertySymbols,oI=sI?function(e){for(var t=[];e;)tI(t,rI(e)),e=nI(e);return t}:iI;cy.exports=oI});var fy=v((P5,ly)=>{var aI=Lr(),uI=$a();function cI(e,t){return aI(e,uI(e),t)}ly.exports=cI});var hy=v((E5,py)=>{var lI=ga(),fI=$a(),pI=Fs();function hI(e){return lI(e,pI,fI)}py.exports=hI});var my=v((k5,dy)=>{var dI=Object.prototype,mI=dI.hasOwnProperty;function gI(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&mI.call(e,"index")&&(n.index=e.index,n.input=e.input),n}dy.exports=gI});var Us=v((A5,yy)=>{var gy=da();function yI(e){var t=new e.constructor(e.byteLength);return new gy(t).set(new gy(e)),t}yy.exports=yI});var by=v((x5,vy)=>{var vI=Us();function bI(e,t){var n=t?vI(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}vy.exports=bI});var wy=v((S5,_y)=>{var _I=/\w*$/;function wI(e){var t=new e.constructor(e.source,_I.exec(e));return t.lastIndex=e.lastIndex,t}_y.exports=wI});var Ay=v((T5,ky)=>{var Oy=on(),Py=Oy?Oy.prototype:void 0,Ey=Py?Py.valueOf:void 0;function OI(e){return Ey?Object(Ey.call(e)):{}}ky.exports=OI});var Sy=v((M5,xy)=>{var PI=Us();function EI(e,t){var n=t?PI(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}xy.exports=EI});var My=v((I5,Ty)=>{var kI=Us(),AI=by(),xI=wy(),SI=Ay(),TI=Sy(),MI="[object Boolean]",II="[object Date]",NI="[object Map]",CI="[object Number]",qI="[object RegExp]",jI="[object Set]",DI="[object String]",RI="[object Symbol]",BI="[object ArrayBuffer]",LI="[object DataView]",GI="[object Float32Array]",FI="[object Float64Array]",UI="[object Int8Array]",VI="[object Int16Array]",zI="[object Int32Array]",KI="[object Uint8Array]",HI="[object Uint8ClampedArray]",WI="[object Uint16Array]",JI="[object Uint32Array]";function YI(e,t,n){var r=e.constructor;switch(t){case BI:return kI(e);case MI:case II:return new r(+e);case LI:return AI(e,n);case GI:case FI:case UI:case VI:case zI:case KI:case HI:case WI:case JI:return TI(e,n);case NI:return new r;case CI:case DI:return new r(e);case qI:return xI(e);case jI:return new r;case RI:return SI(e)}}Ty.exports=YI});var Cy=v((N5,Ny)=>{var $I=pt(),Iy=Object.create,XI=function(){function e(){}return function(t){if(!$I(t))return{};if(Iy)return Iy(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();Ny.exports=XI});var jy=v((C5,qy)=>{var QI=Cy(),ZI=Cs(),eN=Ss();function tN(e){return typeof e.constructor=="function"&&!eN(e)?QI(ZI(e)):{}}qy.exports=tN});var Ry=v((q5,Dy)=>{var nN=qr(),rN=kt(),iN="[object Map]";function sN(e){return rN(e)&&nN(e)==iN}Dy.exports=sN});var Fy=v((j5,Gy)=>{var oN=Ry(),aN=As(),By=xs(),Ly=By&&By.isMap,uN=Ly?aN(Ly):oN;Gy.exports=uN});var Vy=v((D5,Uy)=>{var cN=qr(),lN=kt(),fN="[object Set]";function pN(e){return lN(e)&&cN(e)==fN}Uy.exports=pN});var Wy=v((R5,Hy)=>{var hN=Vy(),dN=As(),zy=xs(),Ky=zy&&zy.isSet,mN=Ky?dN(Ky):hN;Hy.exports=mN});var Xa=v((B5,Xy)=>{var gN=_s(),yN=Vg(),vN=js(),bN=Hg(),_N=Zg(),wN=iy(),ON=oy(),PN=uy(),EN=fy(),kN=Pa(),AN=hy(),xN=qr(),SN=my(),TN=My(),MN=jy(),IN=et(),NN=ks(),CN=Fy(),qN=pt(),jN=Wy(),DN=un(),RN=Fs(),BN=1,LN=2,GN=4,Jy="[object Arguments]",FN="[object Array]",UN="[object Boolean]",VN="[object Date]",zN="[object Error]",Yy="[object Function]",KN="[object GeneratorFunction]",HN="[object Map]",WN="[object Number]",$y="[object Object]",JN="[object RegExp]",YN="[object Set]",$N="[object String]",XN="[object Symbol]",QN="[object WeakMap]",ZN="[object ArrayBuffer]",e2="[object DataView]",t2="[object Float32Array]",n2="[object Float64Array]",r2="[object Int8Array]",i2="[object Int16Array]",s2="[object Int32Array]",o2="[object Uint8Array]",a2="[object Uint8ClampedArray]",u2="[object Uint16Array]",c2="[object Uint32Array]",ge={};ge[Jy]=ge[FN]=ge[ZN]=ge[e2]=ge[UN]=ge[VN]=ge[t2]=ge[n2]=ge[r2]=ge[i2]=ge[s2]=ge[HN]=ge[WN]=ge[$y]=ge[JN]=ge[YN]=ge[$N]=ge[XN]=ge[o2]=ge[a2]=ge[u2]=ge[c2]=!0;ge[zN]=ge[Yy]=ge[QN]=!1;function Vs(e,t,n,r,i,s){var o,a=t&BN,u=t&LN,c=t&GN;if(n&&(o=i?n(e,r,i,s):n(e)),o!==void 0)return o;if(!qN(e))return e;var l=IN(e);if(l){if(o=SN(e),!a)return ON(e,o)}else{var f=xN(e),p=f==Yy||f==KN;if(NN(e))return wN(e,a);if(f==$y||f==Jy||p&&!i){if(o=u||p?{}:MN(e),!a)return u?EN(e,_N(o,e)):PN(e,bN(o,e))}else{if(!ge[f])return i?e:{};o=TN(e,f,a)}}s||(s=new gN);var h=s.get(e);if(h)return h;s.set(e,o),jN(e)?e.forEach(function(m){o.add(Vs(m,t,n,m,e,s))}):CN(e)&&e.forEach(function(m,b){o.set(b,Vs(m,t,n,b,e,s))});var d=c?u?AN:kN:u?RN:DN,y=l?void 0:d(e);return yN(y||e,function(m,b){y&&(b=m,m=e[b]),vN(o,b,Vs(m,t,n,b,e,s))}),o}Xy.exports=Vs});var Fr=v((L5,Qy)=>{var l2=Xa(),f2=Ca(),p2=1;function h2(e){return f2(l2(e,p2))}Qy.exports=h2});var fv=v((y6,lv)=>{var A2=Xa(),x2=1,S2=4;function T2(e){return A2(e,x2|S2)}lv.exports=T2});var Uu=v(Jt=>{"use strict";Object.defineProperty(Jt,"__esModule",{value:!0});Jt.Pointer=Jt.escapeToken=Jt.unescapeToken=void 0;function zv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Jt.unescapeToken=zv;function Kv(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}Jt.escapeToken=Kv;var fC=function(){function e(t){t===void 0&&(t=[""]),this.tokens=t}return e.fromJSON=function(t){var n=t.split("/").map(zv);if(n[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(t));return new e(n)},e.prototype.toString=function(){return this.tokens.map(Kv).join("/")},e.prototype.evaluate=function(t){for(var n=null,r="",i=t,s=1,o=this.tokens.length;s<o;s++)n=i,r=this.tokens[s],!(r=="__proto__"||r=="constructor"||r=="prototype")&&(i=(n||{})[r]);return{parent:n,key:r,value:i}},e.prototype.get=function(t){return this.evaluate(t).value},e.prototype.set=function(t,n){var r=this.evaluate(t);r.parent&&(r.parent[r.key]=n)},e.prototype.push=function(t){this.tokens.push(t)},e.prototype.add=function(t){var n=this.tokens.concat(String(t));return new e(n)},e}();Jt.Pointer=fC});var zu=v(Ct=>{"use strict";Object.defineProperty(Ct,"__esModule",{value:!0});Ct.clone=Ct.objectType=Ct.hasOwnProperty=void 0;Ct.hasOwnProperty=Object.prototype.hasOwnProperty;function pC(e){return e===void 0?"undefined":e===null?"null":Array.isArray(e)?"array":typeof e}Ct.objectType=pC;function hC(e){return e!=null&&typeof e=="object"}function Vu(e){if(!hC(e))return e;if(e.constructor==Array){for(var t=e.length,n=new Array(t),r=0;r<t;r++)n[r]=Vu(e[r]);return n}if(e.constructor==Date){var i=new Date(+e);return i}var s={};for(var o in e)Ct.hasOwnProperty.call(e,o)&&(s[o]=Vu(e[o]));return s}Ct.clone=Vu});var Wu=v(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.diffAny=Ke.diffObjects=Ke.diffArrays=Ke.intersection=Ke.subtract=Ke.isDestructive=void 0;var Ci=zu();function dC(e){var t=e.op;return t==="remove"||t==="replace"||t==="copy"||t==="move"}Ke.isDestructive=dC;function Hu(e,t){var n={};for(var r in e)Ci.hasOwnProperty.call(e,r)&&e[r]!==void 0&&(n[r]=1);for(var i in t)Ci.hasOwnProperty.call(t,i)&&t[i]!==void 0&&delete n[i];return Object.keys(n)}Ke.subtract=Hu;function Hv(e){for(var t=e.length,n={},r=0;r<t;r++){var i=e[r];for(var s in i)Ci.hasOwnProperty.call(i,s)&&i[s]!==void 0&&(n[s]=(n[s]||0)+1)}for(var s in n)n[s]<t&&delete n[s];return Object.keys(n)}Ke.intersection=Hv;function mC(e){return e.op==="add"}function gC(e){return e.op==="remove"}function Ku(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function Wv(e,t,n,r){r===void 0&&(r=no);var i={"0,0":{operations:[],cost:0}};function s(l,f){var p="".concat(l,",").concat(f),h=i[p];if(h===void 0){if(l>0&&f>0&&!r(e[l-1],t[f-1],n.add(String(l-1))).length)h=s(l-1,f-1);else{var d=[];if(l>0){var y=s(l-1,f),m={op:"remove",index:l-1};d.push(Ku(y,m))}if(f>0){var b=s(l,f-1),g={op:"add",index:l-1,value:t[f-1]};d.push(Ku(b,g))}if(l>0&&f>0){var O=s(l-1,f-1),I={op:"replace",index:l-1,original:e[l-1],value:t[f-1]};d.push(Ku(O,I))}var j=d.sort(function(N,D){return N.cost-D.cost})[0];h=j}i[p]=h}return h}var o=isNaN(e.length)||e.length<=0?0:e.length,a=isNaN(t.length)||t.length<=0?0:t.length,u=s(o,a).operations,c=u.reduce(function(l,f){var p=l[0],h=l[1];if(mC(f)){var d=f.index+1+h,y=d<o+h?String(d):"-",m={op:f.op,path:n.add(y).toString(),value:f.value};return[p.concat(m),h+1]}else if(gC(f)){var m={op:f.op,path:n.add(String(f.index+h)).toString()};return[p.concat(m),h-1]}else{var b=n.add(String(f.index+h)),g=r(f.original,f.value,b);return[p.concat.apply(p,g),h]}},[[],0])[0];return c}Ke.diffArrays=Wv;function Jv(e,t,n,r){r===void 0&&(r=no);var i=[];return Hu(e,t).forEach(function(s){i.push({op:"remove",path:n.add(s).toString()})}),Hu(t,e).forEach(function(s){i.push({op:"add",path:n.add(s).toString(),value:t[s]})}),Hv([e,t]).forEach(function(s){i.push.apply(i,r(e[s],t[s],n.add(s)))}),i}Ke.diffObjects=Jv;function no(e,t,n,r){if(r===void 0&&(r=no),e===t)return[];var i=(0,Ci.objectType)(e),s=(0,Ci.objectType)(t);return i=="array"&&s=="array"?Wv(e,t,n,r):i=="object"&&s=="object"?Jv(e,t,n,r):[{op:"replace",path:n.toString(),value:t}]}Ke.diffAny=no});var ib=v(Ae=>{"use strict";var Ju=Ae&&Ae.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Ae,"__esModule",{value:!0});Ae.apply=Ae.InvalidOperationError=Ae.test=Ae.copy=Ae.move=Ae.replace=Ae.remove=Ae.add=Ae.TestError=Ae.MissingError=void 0;var qt=Uu(),Yu=zu(),yC=Wu(),mt=function(e){Ju(t,e);function t(n){var r=e.call(this,"Value required at path: ".concat(n))||this;return r.path=n,r.name="MissingError",r}return t}(Error);Ae.MissingError=mt;var Yv=function(e){Ju(t,e);function t(n,r){var i=e.call(this,"Test failed: ".concat(n," != ").concat(r))||this;return i.actual=n,i.expected=r,i.name="TestError",i}return t}(Error);Ae.TestError=Yv;function $u(e,t,n){if(Array.isArray(e))if(t=="-")e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function $v(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function Xv(e,t){var n=qt.Pointer.fromJSON(t.path).evaluate(e);return n.parent===void 0?new mt(t.path):($u(n.parent,n.key,(0,Yu.clone)(t.value)),null)}Ae.add=Xv;function Qv(e,t){var n=qt.Pointer.fromJSON(t.path).evaluate(e);return n.value===void 0?new mt(t.path):($v(n.parent,n.key),null)}Ae.remove=Qv;function Zv(e,t){var n=qt.Pointer.fromJSON(t.path).evaluate(e);if(n.parent===null)return new mt(t.path);if(Array.isArray(n.parent)){if(parseInt(n.key,10)>=n.parent.length)return new mt(t.path)}else if(n.value===void 0)return new mt(t.path);return n.parent[n.key]=(0,Yu.clone)(t.value),null}Ae.replace=Zv;function eb(e,t){var n=qt.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new mt(t.from);var r=qt.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new mt(t.path):($v(n.parent,n.key),$u(r.parent,r.key,n.value),null)}Ae.move=eb;function tb(e,t){var n=qt.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new mt(t.from);var r=qt.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new mt(t.path):($u(r.parent,r.key,(0,Yu.clone)(n.value)),null)}Ae.copy=tb;function nb(e,t){var n=qt.Pointer.fromJSON(t.path).evaluate(e);return(0,yC.diffAny)(n.value,t.value,new qt.Pointer).length?new Yv(n.value,t.value):null}Ae.test=nb;var rb=function(e){Ju(t,e);function t(n){var r=e.call(this,"Invalid operation: ".concat(n.op))||this;return r.operation=n,r.name="InvalidOperationError",r}return t}(Error);Ae.InvalidOperationError=rb;function vC(e,t){switch(t.op){case"add":return Xv(e,t);case"remove":return Qv(e,t);case"replace":return Zv(e,t);case"move":return eb(e,t);case"copy":return tb(e,t);case"test":return nb(e,t)}return new rb(t)}Ae.apply=vC});var qi=v(gt=>{"use strict";Object.defineProperty(gt,"__esModule",{value:!0});gt.createTests=gt.createPatch=gt.applyPatch=gt.Pointer=void 0;var Xu=Uu();Object.defineProperty(gt,"Pointer",{enumerable:!0,get:function(){return Xu.Pointer}});var bC=ib(),Qu=Wu();function _C(e,t){return t.map(function(n){return(0,bC.apply)(e,n)})}gt.applyPatch=_C;function wC(e){function t(n,r,i){var s=e(n,r,i);return Array.isArray(s)?s:(0,Qu.diffAny)(n,r,i,t)}return t}function OC(e,t,n){var r=new Xu.Pointer;return(n?wC(n):Qu.diffAny)(e,t,r)}gt.createPatch=OC;function sb(e,t){var n=Xu.Pointer.fromJSON(t).evaluate(e);if(n!==void 0)return{op:"test",path:t,value:n.value}}function PC(e,t){var n=new Array;return t.filter(Qu.isDestructive).forEach(function(r){var i=sb(e,r.path);if(i&&n.push(i),"from"in r){var s=sb(e,r.from);s&&n.push(s)}}),n}gt.createTests=PC});var io=v(lb=>{(function(e,t){"use strict";if(e.setImmediate)return;var n=1,r={},i=!1,s=e.document,o;function a(g){typeof g!="function"&&(g=new Function(""+g));for(var O=new Array(arguments.length-1),I=0;I<O.length;I++)O[I]=arguments[I+1];var j={callback:g,args:O};return r[n]=j,o(n),n++}function u(g){delete r[g]}function c(g){var O=g.callback,I=g.args;switch(I.length){case 0:O();break;case 1:O(I[0]);break;case 2:O(I[0],I[1]);break;case 3:O(I[0],I[1],I[2]);break;default:O.apply(t,I);break}}function l(g){if(i)setTimeout(l,0,g);else{var O=r[g];if(O){i=!0;try{c(O)}finally{u(g),i=!1}}}}function f(){o=function(g){process.nextTick(function(){l(g)})}}function p(){if(e.postMessage&&!e.importScripts){var g=!0,O=e.onmessage;return e.onmessage=function(){g=!1},e.postMessage("","*"),e.onmessage=O,g}}function h(){var g="setImmediate$"+Math.random()+"$",O=function(I){I.source===e&&typeof I.data=="string"&&I.data.indexOf(g)===0&&l(+I.data.slice(g.length))};e.addEventListener?e.addEventListener("message",O,!1):e.attachEvent("onmessage",O),o=function(I){e.postMessage(g+I,"*")}}function d(){var g=new MessageChannel;g.port1.onmessage=function(O){var I=O.data;l(I)},o=function(O){g.port2.postMessage(O)}}function y(){var g=s.documentElement;o=function(O){var I=s.createElement("script");I.onreadystatechange=function(){l(O),I.onreadystatechange=null,g.removeChild(I),I=null},g.appendChild(I)}}function m(){o=function(g){setTimeout(l,0,g)}}var b=Object.getPrototypeOf&&Object.getPrototypeOf(e);b=b&&b.setTimeout?b:e,{}.toString.call(e.process)==="[object process]"?f():p()?h():e.MessageChannel?d():s&&"onreadystatechange"in s.createElement("script")?y():m(),b.setImmediate=a,b.clearImmediate=u})(typeof self>"u"?typeof global>"u"?lb:global:self)});var Jj={};ll(Jj,{Client:()=>qo,gameFactory:()=>gi});function He(e,t){let{duplicates:n,circular:r}=hr(e),i=[...n],s=new Map(i.map(a=>[a,null])),o=t?.deduplicateInstances!==!1;return JSON.stringify(e,(a,u)=>{if(typeof u=="object"&&u!==null&&!Array.isArray(u)){let c=s.get(u),l=r.has(u);if(typeof c=="number"&&l)return{_instanceReference:c};if(o&&typeof c=="number")return{_instanceReference:c};let f={...u};if(c===null){let p=i.indexOf(u);s.set(u,p),f._instanceReferenceId=p}else!o&&typeof c=="number"&&(f._instanceReference=c);return u.constructor&&u.constructor!==Object&&u.constructor!==Array&&(f._constructorName=u.constructor.name),f}else{if(Number.isNaN(u))return"Wacksonan";if(Object.is(u,-0))return"Wacksonegativezero";switch(u){case 1/0:return"Wacksonfinity";case-1/0:return"Wacksonegativinfinity";case void 0:return"Wacksondefined";default:return u}}},t?.space)}function Ft(e,t){let n=JSON.parse(e,(i,s)=>{switch(s){case"Wacksonfinity":return 1/0;case"Wacksonegativinfinity":return-1/0;case"Wacksondefined":return;case"Wacksonan":return NaN;case"Wacksonegativezero":return-0;default:return s}}),r=new Map;return hr(n,i=>{if(i._instanceReferenceId!=null){let s=i._instanceReferenceId;delete i._instanceReferenceId,r.set(s,i)}if(t&&i._constructorName){let s=t[i._constructorName];if(!s)throw new Error(`Constructor ${i._constructorName} is not in registry`);Object.setPrototypeOf(i,s.prototype),delete i._constructorName}}),hr(n,(i,s,o)=>{if(i?._instanceReference!=null){let a=r.get(i._instanceReference);if(!a)throw new Error(`Unknown _instanceReference: ${i._instanceReference}`);s[o]=a}}),n}function hr(e,t,n=new WeakSet,r=null,i=null,s=new Set,o=new Set,a=new WeakSet){if(typeof e!="object"||e===null)return{duplicates:s,circular:o};if(n.has(e)){s.add(e),a.has(e)&&o.add(e);return}if(n.add(e),a.add(e),t?.(e,r,i),Array.isArray(e))for(let u=0;u<e.length;u++)hr(e[u],t,n,e,u,s,o,a);else for(let u of Object.keys(e))hr(e[u],t,n,e,u,s,o,a);return a.delete(e),{duplicates:s,circular:o}}var cv=he(aa());var Et=class{constructor(t,n,r){if(!t?.fromBank)throw new Error(`Do not create entities directly. Go through the Bank. rule: ${JSON.stringify(n)}`);this.rule=n,this.entityId=r,this.state={},this.rule.stateGroups&&Object.entries(this.rule.stateGroups).forEach(([i,s])=>{let o=t?.initialStateGroups?.[i]??Object.keys(s)[0];Object.assign(this.state,s[o])}),this.rule.state&&Object.assign(this.state,this.rule.state)}get attributes(){return{...this.rule,...this,...this.state}}};var rn=class extends Et{constructor(...t){super(...t),this.entities=[]}placeEntity(t,n="Last"){n==="Last"?this.entities.push(t):n==="First"&&this.entities.unshift(t)}remove(t){this.entities.splice(this.entities.indexOf(t),1)}takeOne(t="First"){if(t==="First")return this.entities.splice(0,1)[0]}isEmpty(){return this.entities.length===0}};var wr=class extends rn{};var sn=class extends Et{constructor(t,...n){super(t,...n),this.spaces=this.makeSpaces(t.bank)}makeSpaces(t){return Array(this.getSpacesCount()).fill().map((n,r)=>t.createEntity({entityType:"Space",index:r}))}getEmptySpaces(){return this.spaces.filter(t=>t.isEmpty())}getSpace(t){return this.spaces[t]}getEntities(t){return this.getSpace(t).entities}placeEntity(t,n){this.getSpace(t).placeEntity(n)}};var Lf=he(Bf());var Ar=class extends sn{getSpacesCount(){return this.rule.width*this.rule.height}getRows(){return(0,Lf.default)(this.spaces,this.rule.width)}getCoordinates(t){let{width:n}=this.rule;return[t%n,Math.floor(t/n)]}getIndex([t,n]){let{width:r}=this.rule;return n*r+t}getSpace(t){return this.spaces[this.getIndex(t)]}getRelativeCoordinates([t,n],[r,i]){let s=[t+r,n+i];return this.areCoordinatesValid(s)?s:null}areCoordinatesValid([t,n]){return t>=0&&n>=0&&t<this.rule.width&&n<this.rule.height}};var ov=he(Ra()),av=he(Bm());var Gg=he(qs()),Fg=he(Ga());function ln(e,t){let n=e;for(let r of t){if(n===void 0)return n;if(r?.flatten){if(!Array.isArray(n))return;n=n.flat(),r.map&&(n=n.map(i=>ln(i,r.map)))}else n=n[r]}return n}var tt="INUMBER",Un="IOP1",Vn="IOP2",zn="IOP3",xt="IVAR",pn="IVARNAME",Ln="IFUNCALL",Ds="IFUNDEF",ze="IEXPR",Va="IEXPREVAL",hn="IMEMBER",Rs="IENDSTATEMENT",Gn="IARRAY";function re(e,t){this.type=e,this.value=t??0}re.prototype.toString=function(){switch(this.type){case tt:case Un:case Vn:case zn:case xt:case pn:case Rs:return this.value;case Ln:return"CALL "+this.value;case Ds:return"DEF "+this.value;case Gn:return"ARRAY "+this.value;case hn:return"."+this.value;default:return"Invalid Instruction"}};function Bs(e){return new re(Un,e)}function Tt(e){return new re(Vn,e)}function Ng(e){return new re(zn,e)}function Ua(e,t,n,r,i){for(var s=[],o=[],a,u,c,l,f=0;f<e.length;f++){var p=e[f],h=p.type;if(h===tt||h===pn)Array.isArray(p.value)?s.push.apply(s,Ua(p.value.map(function(d){return new re(tt,d)}).concat(new re(Gn,p.value.length)),t,n,r,i)):s.push(p);else if(h===xt&&i.hasOwnProperty(p.value))p=new re(tt,i[p.value]),s.push(p);else if(h===Vn&&s.length>1)u=s.pop(),a=s.pop(),l=n[p.value],p=new re(tt,l(a.value,u.value)),s.push(p);else if(h===zn&&s.length>2)c=s.pop(),u=s.pop(),a=s.pop(),p.value==="?"?s.push(a.value?u.value:c.value):(l=r[p.value],p=new re(tt,l(a.value,u.value,c.value)),s.push(p));else if(h===Un&&s.length>0)a=s.pop(),l=t[p.value],p=new re(tt,l(a.value)),s.push(p);else if(h===ze){for(;s.length>0;)o.push(s.shift());o.push(new re(ze,Ua(p.value,t,n,r,i)))}else if(h===hn&&s.length>0)a=s.pop(),s.push(new re(tt,a.value[p.value]));else{for(;s.length>0;)o.push(s.shift());o.push(p)}}for(;s.length>0;)o.push(s.shift());return o}function Cg(e,t,n){for(var r=[],i=0;i<e.length;i++){var s=e[i],o=s.type;if(o===xt&&s.value===t)for(var a=0;a<n.tokens.length;a++){var u=n.tokens[a],c;u.type===Un?c=Bs(u.value):u.type===Vn?c=Tt(u.value):u.type===zn?c=Ng(u.value):c=new re(u.type,u.value),r.push(c)}else o===ze?r.push(new re(ze,Cg(s.value,t,n))):r.push(s)}return r}function fn(e,t,n){var r=[],i,s,o,a,u,c;if(za(e))return At(e,n);for(var l=e.length,f=0;f<l;f++){var p=e[f],h=p.type;if(h===tt||h===pn)r.push(p.value);else if(h===Vn)s=r.pop(),i=r.pop(),p.value==="and"?r.push(i?!!fn(s,t,n):!1):p.value==="or"?r.push(i?!0:!!fn(s,t,n)):p.value==="="?(a=t.binaryOps[p.value],r.push(a(i,fn(s,t,n),n))):(a=t.binaryOps[p.value],r.push(a(At(i,n),At(s,n))));else if(h===zn)o=r.pop(),s=r.pop(),i=r.pop(),p.value==="?"?r.push(fn(i?s:o,t,n)):(a=t.ternaryOps[p.value],r.push(a(At(i,n),At(s,n),At(o,n))));else if(h===xt)if(p.value in t.functions)r.push(t.functions[p.value]);else if(p.value in t.unaryOps&&t.parser.isOperatorEnabled(p.value))r.push(t.unaryOps[p.value]);else{var d=n[p.value];if(d!==void 0)r.push(d);else throw new Error("undefined variable: "+p.value)}else if(h===Un)i=r.pop(),a=t.unaryOps[p.value],r.push(a(At(i,n)));else if(h===Ln){for(c=p.value,u=[];c-- >0;)u.unshift(At(r.pop(),n));if(a=r.pop(),a.apply&&a.call)r.push(a.apply(void 0,u));else throw new Error(a+" is not a function")}else if(h===Ds)r.push(function(){for(var y=r.pop(),m=[],b=p.value;b-- >0;)m.unshift(r.pop());var g=r.pop(),O=function(){for(var I=Object.assign({},n),j=0,N=m.length;j<N;j++)I[m[j]]=arguments[j];return fn(y,t,I)};return Object.defineProperty(O,"name",{value:g,writable:!1}),n[g]=O,O}());else if(h===ze)r.push(TT(p,t));else if(h===Va)r.push(p);else if(h===hn)i=r.pop(),r.push(i[p.value]);else if(h===Rs)r.pop();else if(h===Gn){for(c=p.value,u=[];c-- >0;)u.unshift(r.pop());r.push(u)}else throw new Error("invalid Expression")}if(r.length>1)throw new Error("invalid Expression (parity)");return r[0]===0?0:At(r[0],n)}function TT(e,t,n){return za(e)?e:{type:Va,value:function(r){return fn(e.value,t,r)}}}function za(e){return e&&e.type===Va}function At(e,t){return za(e)?e.value(t):e}function Ka(e,t){for(var n=[],r,i,s,o,a,u,c=0;c<e.length;c++){var l=e[c],f=l.type;if(f===tt)typeof l.value=="number"&&l.value<0?n.push("("+l.value+")"):Array.isArray(l.value)?n.push("["+l.value.map(kg).join(", ")+"]"):n.push(kg(l.value));else if(f===Vn)i=n.pop(),r=n.pop(),o=l.value,t?o==="^"?n.push("Math.pow("+r+", "+i+")"):o==="and"?n.push("(!!"+r+" && !!"+i+")"):o==="or"?n.push("(!!"+r+" || !!"+i+")"):o==="||"?n.push("(function(a,b){ return Array.isArray(a) && Array.isArray(b) ? a.concat(b) : String(a) + String(b); }(("+r+"),("+i+")))"):o==="=="?n.push("("+r+" === "+i+")"):o==="!="?n.push("("+r+" !== "+i+")"):o==="["?n.push(r+"[("+i+") | 0]"):n.push("("+r+" "+o+" "+i+")"):o==="["?n.push(r+"["+i+"]"):n.push("("+r+" "+o+" "+i+")");else if(f===zn)if(s=n.pop(),i=n.pop(),r=n.pop(),o=l.value,o==="?")n.push("("+r+" ? "+i+" : "+s+")");else throw new Error("invalid Expression");else if(f===xt||f===pn)n.push(l.value);else if(f===Un)r=n.pop(),o=l.value,o==="-"||o==="+"?n.push("("+o+r+")"):t?o==="not"?n.push("(!"+r+")"):o==="!"?n.push("fac("+r+")"):n.push(o+"("+r+")"):o==="!"?n.push("("+r+"!)"):n.push("("+o+" "+r+")");else if(f===Ln){for(u=l.value,a=[];u-- >0;)a.unshift(n.pop());o=n.pop(),n.push(o+"("+a.join(", ")+")")}else if(f===Ds){for(i=n.pop(),u=l.value,a=[];u-- >0;)a.unshift(n.pop());r=n.pop(),t?n.push("("+r+" = function("+a.join(", ")+") { return "+i+" })"):n.push("("+r+"("+a.join(", ")+") = "+i+")")}else if(f===hn)r=n.pop(),n.push(r+"."+l.value);else if(f===Gn){for(u=l.value,a=[];u-- >0;)a.unshift(n.pop());n.push("["+a.join(", ")+"]")}else if(f===ze)n.push("("+Ka(l.value,t)+")");else if(f!==Rs)throw new Error("invalid Expression")}return n.length>1&&(t?n=[n.join(",")]:n=[n.join(";")]),String(n[0])}function kg(e){return typeof e=="string"?JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"):e}function Bn(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return!0;return!1}function Ha(e,t,n){n=n||{};for(var r=!!n.withMembers,i=null,s=0;s<e.length;s++){var o=e[s];o.type===xt||o.type===pn?!r&&!Bn(t,o.value)?t.push(o.value):(i!==null&&(Bn(t,i)||t.push(i)),i=o.value):o.type===hn&&r&&i!==null?i+="."+o.value:o.type===ze?Ha(o.value,t,n):i!==null&&(Bn(t,i)||t.push(i),i=null)}i!==null&&!Bn(t,i)&&t.push(i)}function it(e,t){this.tokens=e,this.parser=t,this.unaryOps=t.unaryOps,this.binaryOps=t.binaryOps,this.ternaryOps=t.ternaryOps,this.functions=t.functions}it.prototype.simplify=function(e){return e=e||{},new it(Ua(this.tokens,this.unaryOps,this.binaryOps,this.ternaryOps,e),this.parser)};it.prototype.substitute=function(e,t){return t instanceof it||(t=this.parser.parse(String(t))),new it(Cg(this.tokens,e,t),this.parser)};it.prototype.evaluate=function(e){return e=e||{},fn(this.tokens,this,e)};it.prototype.toString=function(){return Ka(this.tokens,!1)};it.prototype.symbols=function(e){e=e||{};var t=[];return Ha(this.tokens,t,e),t};it.prototype.variables=function(e){e=e||{};var t=[];Ha(this.tokens,t,e);var n=this.functions;return t.filter(function(r){return!(r in n)})};it.prototype.toJSFunction=function(e,t){var n=this,r=new Function(e,"with(this.functions) with (this.ternaryOps) with (this.binaryOps) with (this.unaryOps) { return "+Ka(this.simplify(t).tokens,!0)+"; }");return function(){return r.apply(n,arguments)}};var Dr="TEOF",me="TOP",Ls="TNUMBER",qg="TSTRING",St="TPAREN",Fn="TBRACKET",Gs="TCOMMA",Wa="TNAME",Ja="TSEMICOLON";function jg(e,t,n){this.type=e,this.value=t,this.index=n}jg.prototype.toString=function(){return this.type+": "+this.value};function Te(e,t){this.pos=0,this.current=null,this.unaryOps=e.unaryOps,this.binaryOps=e.binaryOps,this.ternaryOps=e.ternaryOps,this.consts=e.consts,this.expression=t,this.savedPosition=0,this.savedCurrent=null,this.options=e.options,this.parser=e}Te.prototype.newToken=function(e,t,n){return new jg(e,t,n??this.pos)};Te.prototype.save=function(){this.savedPosition=this.pos,this.savedCurrent=this.current};Te.prototype.restore=function(){this.pos=this.savedPosition,this.current=this.savedCurrent};Te.prototype.next=function(){if(this.pos>=this.expression.length)return this.newToken(Dr,"EOF");if(this.isWhitespace()||this.isComment())return this.next();if(this.isRadixInteger()||this.isNumber()||this.isOperator()||this.isString()||this.isParen()||this.isBracket()||this.isComma()||this.isSemicolon()||this.isNamedOp()||this.isConst()||this.isName())return this.current;this.parseError('Unknown character "'+this.expression.charAt(this.pos)+'"')};Te.prototype.isString=function(){var e=!1,t=this.pos,n=this.expression.charAt(t);if(n==="'"||n==='"')for(var r=this.expression.indexOf(n,t+1);r>=0&&this.pos<this.expression.length;){if(this.pos=r+1,this.expression.charAt(r-1)!=="\\"){var i=this.expression.substring(t+1,r);this.current=this.newToken(qg,this.unescape(i),t),e=!0;break}r=this.expression.indexOf(n,r+1)}return e};Te.prototype.isParen=function(){var e=this.expression.charAt(this.pos);return e==="("||e===")"?(this.current=this.newToken(St,e),this.pos++,!0):!1};Te.prototype.isBracket=function(){var e=this.expression.charAt(this.pos);return(e==="["||e==="]")&&this.isOperatorEnabled("[")?(this.current=this.newToken(Fn,e),this.pos++,!0):!1};Te.prototype.isComma=function(){var e=this.expression.charAt(this.pos);return e===","?(this.current=this.newToken(Gs,","),this.pos++,!0):!1};Te.prototype.isSemicolon=function(){var e=this.expression.charAt(this.pos);return e===";"?(this.current=this.newToken(Ja,";"),this.pos++,!0):!1};Te.prototype.isConst=function(){for(var e=this.pos,t=e;t<this.expression.length;t++){var n=this.expression.charAt(t);if(n.toUpperCase()===n.toLowerCase()&&(t===this.pos||n!=="_"&&n!=="."&&(n<"0"||n>"9")))break}if(t>e){var r=this.expression.substring(e,t);if(r in this.consts)return this.current=this.newToken(Ls,this.consts[r]),this.pos+=r.length,!0}return!1};Te.prototype.isNamedOp=function(){for(var e=this.pos,t=e;t<this.expression.length;t++){var n=this.expression.charAt(t);if(n.toUpperCase()===n.toLowerCase()&&(t===this.pos||n!=="_"&&(n<"0"||n>"9")))break}if(t>e){var r=this.expression.substring(e,t);if(this.isOperatorEnabled(r)&&(r in this.binaryOps||r in this.unaryOps||r in this.ternaryOps))return this.current=this.newToken(me,r),this.pos+=r.length,!0}return!1};Te.prototype.isName=function(){for(var e=this.pos,t=e,n=!1;t<this.expression.length;t++){var r=this.expression.charAt(t);if(r.toUpperCase()===r.toLowerCase()){if(t===this.pos&&(r==="$"||r==="_")){r==="_"&&(n=!0);continue}else if(t===this.pos||!n||r!=="_"&&(r<"0"||r>"9"))break}else n=!0}if(n){var i=this.expression.substring(e,t);return this.current=this.newToken(Wa,i),this.pos+=i.length,!0}return!1};Te.prototype.isWhitespace=function(){for(var e=!1,t=this.expression.charAt(this.pos);(t===" "||t===" "||t===`
|
|
5
|
-
`||t==="\r")&&(e=!0,this.pos++,!(this.pos>=this.expression.length));)t=this.expression.charAt(this.pos);return e};var
|
|
6
|
-
`;break;case"r":n+="\r";break;case"t":n+=" ";break;case"u":var i=e.substring(t+1,t+5);
|
|
7
|
-
`,n+1);while(n>=0&&n<this.pos);return{line:e,column:t}};Te.prototype.parseError=function(e){var t=this.getCoordinates();throw new Error("parse error ["+t.line+":"+t.column+"]: "+e)};function _e(e,t,n){this.parser=e,this.tokens=t,this.current=null,this.nextToken=null,this.next(),this.savedCurrent=null,this.savedNextToken=null,this.allowMemberAccess=n.allowMemberAccess!==!1}_e.prototype.next=function(){return this.current=this.nextToken,this.nextToken=this.tokens.next()};_e.prototype.tokenMatches=function(e,t){return typeof t>"u"?!0:Array.isArray(t)?Bn(t,e.value):typeof t=="function"?t(e):e.value===t};_e.prototype.save=function(){this.savedCurrent=this.current,this.savedNextToken=this.nextToken,this.tokens.save()};_e.prototype.restore=function(){this.tokens.restore(),this.current=this.savedCurrent,this.nextToken=this.savedNextToken};_e.prototype.accept=function(e,t){return this.nextToken.type===e&&this.tokenMatches(this.nextToken,t)?(this.next(),!0):!1};_e.prototype.expect=function(e,t){if(!this.accept(e,t)){var n=this.tokens.getCoordinates();throw new Error("parse error ["+n.line+":"+n.column+"]: Expected "+(t||e))}};_e.prototype.parseAtom=function(e){var t=this.tokens.unaryOps;function n(i){return i.value in t}if(this.accept(Wa)||this.accept(me,n))e.push(new re(xt,this.current.value));else if(this.accept(Ls))e.push(new re(tt,this.current.value));else if(this.accept(qg))e.push(new re(tt,this.current.value));else if(this.accept(St,"("))this.parseExpression(e),this.expect(St,")");else if(this.accept(Fn,"["))if(this.accept(Fn,"]"))e.push(new re(Gn,0));else{var r=this.parseArrayList(e);e.push(new re(Gn,r))}else throw new Error("unexpected "+this.nextToken)};_e.prototype.parseExpression=function(e){var t=[];this.parseUntilEndStatement(e,t)||(this.parseVariableAssignmentExpression(t),!this.parseUntilEndStatement(e,t)&&this.pushExpression(e,t))};_e.prototype.pushExpression=function(e,t){for(var n=0,r=t.length;n<r;n++)e.push(t[n])};_e.prototype.parseUntilEndStatement=function(e,t){return this.accept(Ja)?(this.nextToken&&this.nextToken.type!==Dr&&!(this.nextToken.type===St&&this.nextToken.value===")")&&t.push(new re(Rs)),this.nextToken.type!==Dr&&this.parseExpression(t),e.push(new re(ze,t)),!0):!1};_e.prototype.parseArrayList=function(e){for(var t=0;!this.accept(Fn,"]");)for(this.parseExpression(e),++t;this.accept(Gs);)this.parseExpression(e),++t;return t};_e.prototype.parseVariableAssignmentExpression=function(e){for(this.parseConditionalExpression(e);this.accept(me,"=");){var t=e.pop(),n=[],r=e.length-1;if(t.type===Ln){if(!this.tokens.isOperatorEnabled("()="))throw new Error("function definition is not permitted");for(var i=0,s=t.value+1;i<s;i++){var o=r-i;e[o].type===xt&&(e[o]=new re(pn,e[o].value))}this.parseVariableAssignmentExpression(n),e.push(new re(ze,n)),e.push(new re(Ds,t.value));continue}if(t.type!==xt&&t.type!==hn)throw new Error("expected variable for assignment");this.parseVariableAssignmentExpression(n),e.push(new re(pn,t.value)),e.push(new re(ze,n)),e.push(Tt("="))}};_e.prototype.parseConditionalExpression=function(e){for(this.parseOrExpression(e);this.accept(me,"?");){var t=[],n=[];this.parseConditionalExpression(t),this.expect(me,":"),this.parseConditionalExpression(n),e.push(new re(ze,t)),e.push(new re(ze,n)),e.push(Ng("?"))}};_e.prototype.parseOrExpression=function(e){for(this.parseAndExpression(e);this.accept(me,"or");){var t=[];this.parseAndExpression(t),e.push(new re(ze,t)),e.push(Tt("or"))}};_e.prototype.parseAndExpression=function(e){for(this.parseComparison(e);this.accept(me,"and");){var t=[];this.parseComparison(t),e.push(new re(ze,t)),e.push(Tt("and"))}};var IT=["==","!=","<","<=",">=",">","in"];_e.prototype.parseComparison=function(e){for(this.parseAddSub(e);this.accept(me,IT);){var t=this.current;this.parseAddSub(e),e.push(Tt(t.value))}};var NT=["+","-","||"];_e.prototype.parseAddSub=function(e){for(this.parseTerm(e);this.accept(me,NT);){var t=this.current;this.parseTerm(e),e.push(Tt(t.value))}};var CT=["*","/","%"];_e.prototype.parseTerm=function(e){for(this.parseFactor(e);this.accept(me,CT);){var t=this.current;this.parseFactor(e),e.push(Tt(t.value))}};_e.prototype.parseFactor=function(e){var t=this.tokens.unaryOps;function n(i){return i.value in t}if(this.save(),this.accept(me,n)){if(this.current.value!=="-"&&this.current.value!=="+"){if(this.nextToken.type===St&&this.nextToken.value==="("){this.restore(),this.parseExponential(e);return}else if(this.nextToken.type===Ja||this.nextToken.type===Gs||this.nextToken.type===Dr||this.nextToken.type===St&&this.nextToken.value===")"){this.restore(),this.parseAtom(e);return}}var r=this.current;this.parseFactor(e),e.push(Bs(r.value))}else this.parseExponential(e)};_e.prototype.parseExponential=function(e){for(this.parsePostfixExpression(e);this.accept(me,"^");)this.parseFactor(e),e.push(Tt("^"))};_e.prototype.parsePostfixExpression=function(e){for(this.parseFunctionCall(e);this.accept(me,"!");)e.push(Bs("!"))};_e.prototype.parseFunctionCall=function(e){var t=this.tokens.unaryOps;function n(s){return s.value in t}if(this.accept(me,n)){var r=this.current;this.parseAtom(e),e.push(Bs(r.value))}else for(this.parseMemberExpression(e);this.accept(St,"(");)if(this.accept(St,")"))e.push(new re(Ln,0));else{var i=this.parseArgumentList(e);e.push(new re(Ln,i))}};_e.prototype.parseArgumentList=function(e){for(var t=0;!this.accept(St,")");)for(this.parseExpression(e),++t;this.accept(Gs);)this.parseExpression(e),++t;return t};_e.prototype.parseMemberExpression=function(e){for(this.parseAtom(e);this.accept(me,".")||this.accept(Fn,"[");){var t=this.current;if(t.value==="."){if(!this.allowMemberAccess)throw new Error('unexpected ".", member access is not permitted');this.expect(Wa),e.push(new re(hn,this.current.value))}else if(t.value==="["){if(!this.tokens.isOperatorEnabled("["))throw new Error('unexpected "[]", arrays are disabled');this.parseExpression(e),this.expect(Fn,"]"),e.push(Tt("["))}else throw new Error("unexpected symbol: "+t.value)}};function qT(e,t){return Number(e)+Number(t)}function jT(e,t){return e-t}function DT(e,t){return e*t}function RT(e,t){return e/t}function BT(e,t){return e%t}function LT(e,t){return Array.isArray(e)&&Array.isArray(t)?e.concat(t):""+e+t}function GT(e,t){return e===t}function FT(e,t){return e!==t}function UT(e,t){return e>t}function VT(e,t){return e<t}function zT(e,t){return e>=t}function KT(e,t){return e<=t}function HT(e,t){return!!(e&&t)}function WT(e,t){return!!(e||t)}function JT(e,t){return Bn(t,e)}function YT(e){return(Math.exp(e)-Math.exp(-e))/2}function $T(e){return(Math.exp(e)+Math.exp(-e))/2}function XT(e){return e===1/0?1:e===-1/0?-1:(Math.exp(e)-Math.exp(-e))/(Math.exp(e)+Math.exp(-e))}function QT(e){return e===-1/0?e:Math.log(e+Math.sqrt(e*e+1))}function ZT(e){return Math.log(e+Math.sqrt(e*e-1))}function eM(e){return Math.log((1+e)/(1-e))/2}function Ag(e){return Math.log(e)*Math.LOG10E}function tM(e){return-e}function nM(e){return!e}function rM(e){return e<0?Math.ceil(e):Math.floor(e)}function iM(e){return Math.random()*(e||1)}function xg(e){return Ya(e+1)}function sM(e){return isFinite(e)&&e===Math.round(e)}var oM=4.7421875,Fa=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function Ya(e){var t,n;if(sM(e)){if(e<=0)return isFinite(e)?1/0:NaN;if(e>171)return 1/0;for(var r=e-2,i=e-1;r>1;)i*=r,r--;return i===0&&(i=1),i}if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*Ya(1-e));if(e>=171.35)return 1/0;if(e>85){var s=e*e,o=s*e,a=o*e,u=a*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*s)-139/(51840*o)-571/(2488320*a)+163879/(209018880*u)+5246819/(75246796800*u*e))}--e,n=Fa[0];for(var c=1;c<Fa.length;++c)n+=Fa[c]/(e+c);return t=e+oM+.5,Math.sqrt(2*Math.PI)*Math.pow(t,e+.5)*Math.exp(-t)*n}function aM(e){return Array.isArray(e)?e.length:String(e).length}function Sg(){for(var e=0,t=0,n=0;n<arguments.length;n++){var r=Math.abs(arguments[n]),i;t<r?(i=t/r,e=e*i*i+1,t=r):r>0?(i=r/t,e+=i*i):e+=r}return t===1/0?1/0:t*Math.sqrt(e)}function Tg(e,t,n){return e?t:n}function uM(e,t){return typeof t>"u"||+t==0?Math.round(e):(e=+e,t=-+t,isNaN(e)||!(typeof t=="number"&&t%1===0)?NaN:(e=e.toString().split("e"),e=Math.round(+(e[0]+"e"+(e[1]?+e[1]-t:-t))),e=e.toString().split("e"),+(e[0]+"e"+(e[1]?+e[1]+t:t))))}function cM(e,t,n){return n&&(n[e]=t),t}function lM(e,t){return e[t|0]}function fM(e){return arguments.length===1&&Array.isArray(e)?Math.max.apply(Math,e):Math.max.apply(Math,arguments)}function pM(e){return arguments.length===1&&Array.isArray(e)?Math.min.apply(Math,e):Math.min.apply(Math,arguments)}function hM(e,t){if(typeof e!="function")throw new Error("First argument to map is not a function");if(!Array.isArray(t))throw new Error("Second argument to map is not an array");return t.map(function(n,r){return e(n,r)})}function dM(e,t,n){if(typeof e!="function")throw new Error("First argument to fold is not a function");if(!Array.isArray(n))throw new Error("Second argument to fold is not an array");return n.reduce(function(r,i,s){return e(r,i,s)},t)}function mM(e,t){if(typeof e!="function")throw new Error("First argument to filter is not a function");if(!Array.isArray(t))throw new Error("Second argument to filter is not an array");return t.filter(function(n,r){return e(n,r)})}function gM(e,t){if(!(Array.isArray(t)||typeof t=="string"))throw new Error("Second argument to indexOf is not a string or array");return t.indexOf(e)}function yM(e,t){if(!Array.isArray(t))throw new Error("Second argument to join is not an array");return t.join(e)}function vM(e){return(e>0)-(e<0)||+e}var Mg=1/3;function bM(e){return e<0?-Math.pow(-e,Mg):Math.pow(e,Mg)}function _M(e){return Math.exp(e)-1}function wM(e){return Math.log(1+e)}function OM(e){return Math.log(e)/Math.LN2}function Ht(e){this.options=e||{},this.unaryOps={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,sinh:Math.sinh||YT,cosh:Math.cosh||$T,tanh:Math.tanh||XT,asinh:Math.asinh||QT,acosh:Math.acosh||ZT,atanh:Math.atanh||eM,sqrt:Math.sqrt,cbrt:Math.cbrt||bM,log:Math.log,log2:Math.log2||OM,ln:Math.log,lg:Math.log10||Ag,log10:Math.log10||Ag,expm1:Math.expm1||_M,log1p:Math.log1p||wM,abs:Math.abs,ceil:Math.ceil,floor:Math.floor,round:Math.round,trunc:Math.trunc||rM,"-":tM,"+":Number,exp:Math.exp,not:nM,length:aM,"!":xg,sign:Math.sign||vM},this.binaryOps={"+":qT,"-":jT,"*":DT,"/":RT,"%":BT,"^":Math.pow,"||":LT,"==":GT,"!=":FT,">":UT,"<":VT,">=":zT,"<=":KT,and:HT,or:WT,in:JT,"=":cM,"[":lM},this.ternaryOps={"?":Tg},this.functions={random:iM,fac:xg,min:pM,max:fM,hypot:Math.hypot||Sg,pyt:Math.hypot||Sg,pow:Math.pow,atan2:Math.atan2,if:Tg,gamma:Ya,roundTo:uM,map:hM,fold:dM,filter:mM,indexOf:gM,join:yM},this.consts={E:Math.E,PI:Math.PI,true:!0,false:!1}}Ht.prototype.parse=function(e){var t=[],n=new _e(this,new Te(this,e),{allowMemberAccess:this.options.allowMemberAccess});return n.parseExpression(t),n.expect(Dr,"EOF"),new it(t,this)};Ht.prototype.evaluate=function(e,t){return this.parse(e).evaluate(t)};var Dg=new Ht;Ht.parse=function(e){return Dg.parse(e)};Ht.evaluate=function(e,t){return Dg.parse(e).evaluate(t)};var Ig={"+":"add","-":"subtract","*":"multiply","/":"divide","%":"remainder","^":"power","!":"factorial","<":"comparison",">":"comparison","<=":"comparison",">=":"comparison","==":"comparison","!=":"comparison","||":"concatenate",and:"logical",or:"logical",not:"logical","?":"conditional",":":"conditional","=":"assignment","[":"array","()=":"fndef"};function PM(e){return Ig.hasOwnProperty(e)?Ig[e]:e}Ht.prototype.isOperatorEnabled=function(e){var t=PM(e),n=this.options.operators||{};return!(t in n)||!!n[t]};var Rg=new Ht;Rg.functions.sum=e=>e.reduce((t,n)=>t+n,0);function Rr(e,t,n){let r=pe(e,t.arguments,n);return Rg.evaluate(t.expression,r)}var Bg=he(qs()),EM=["state"];function Br(e,t,n,r){return!EM.includes(r)&&(0,Bg.default)(t)?e.G.bank.find(e,t,n):t}var kM=["conditions","move","then","mapping"];function pe(e,t,n,r){if(!(0,Gg.default)(t)&&!Array.isArray(t))return t;let i=Array.isArray(t)?[...t]:{...t};Object.entries(t).forEach(([a,u])=>{kM.includes(a)||(i[a]=pe(e,u,n,a))});let s=AM(e,i,n);return s?.resolveAsEntity||r==="target"||r==="targets"?Br(e,s,n,r):s}function AM(e,t,n){if(t?.type==="expression")return Rr(e,{...t,arguments:pe(e,t.arguments,n,"arguments")},n);if(t?.type==="count")return e.G.bank.findAll(e,t,n).length;if(t?.type==="contextPath")return ln(n,t.path);if(t?.type==="ctxPath")return ln(e.ctx,t.path);if(t?.type==="gamePath")return ln(e.G,t.path);if(t?.type==="relativePath"||t?.type==="RelativePath"){let r=pe(e,t.target,n,"target");return ln(r.attributes,t.path)??null}else if(t?.type==="parent"||t?.type==="Parent"){let r=t.target?pe(e,t.target,n,"target"):n.originalTarget;return e.G.bank.findParent(r)??null}else{if(t?.type==="map")return Lg(e,t.targets,t.mapping,n).map(r=>r.value);if(t?.type==="mapMax"){let r=Lg(e,t.targets,t.mapping,n),i,s=[];for(let o=0,a=r.length;o<a;o++){let{target:u,value:c}=r[o];i===void 0||c>i?(i=c,s.length=0,s.push(u)):c===i&&s.push(u)}return s}else if(t?.type==="pick"||t?.type==="Pick"){let r=pe(e,t.target,n,"target");return(0,Fg.default)(pe(e,r.attributes,n,"attributes"),t.properties)}else if(t?.type==="coordinates"||t?.type==="Coordinates"){let r=t.target?pe(e,t.target,n,"target"):n.originalTarget;return e.G.bank.findParent(r).getCoordinates(r.rule.index)}else if(t?.type==="relativeCoordinates"){let r=t.target?pe(e,t.target,n,"target"):n.originalTarget,i=e.G.bank.findParent(r),s=i.getCoordinates(r.rule.index),o=i.getRelativeCoordinates(s,pe(e,t.location,n,"location"));return(o&&i.spaces[i.getIndex(o)])??null}else return t}}function Lg(e,t,n,r){return t.resolveAsEntity=!0,pe(e,t,r)?.map(i=>({target:i,value:pe(e,n,{...r,loopTarget:i})}))??[]}var oe=class{constructor(t){this.rule=t}check(t,n,r){let i={...n},s={...r};i.target&&(s.originalTarget=i.target);let o=pe(t,this.rule,s);return o.target!==void 0&&(i.target=o.target),this.rule.target!==void 0&&!i.target?{conditionIsMet:!1}:this.checkCondition(t,o,i,s)}isMet(...t){return this.check(...t).conditionIsMet}};var Zy=he(Fr());function d2(e,t,n){let r={...t};return delete r.state,delete r.stateGroups,pe(e,r,n)}function m2(e){return{...e.rule,...e.state}}function Qa(e,t,n,r){return(0,Zy.default)(d2(e,t,r))(m2(n))}var Ur=class extends oe{checkCondition(t,n,{target:r},i){return this.rule.entity&&r!==n.entity?{target:r,conditionIsMet:!1}:{target:r,conditionIsMet:Qa(t,n.matcher,r,i)}}};var Vr=class extends oe{checkCondition(t,n,r,i){return{conditionIsMet:!ke(t,n,r,i).conditionsAreMet}}};function Za(e,{conditions:t=[]},n,r){let i;for(let s of t){let o=dn(s).check(e,n,r);if(o.conditionIsMet){i={...o,conditionRule:s};break}}return i}var zr=class extends oe{checkCondition(t,n,r,i){return{conditionIsMet:!!Za(t,n,r,i)}}};var Kr=class extends oe{checkCondition(t,n,{target:r},i){let s=r.find(o=>{let a={...i,loopTarget:o};return ke(t,n,void 0,a).conditionsAreMet});return{conditionIsMet:!!s,result:s}}};var Hr=class extends oe{checkCondition(t,n,{target:r},i){let s=r.map(o=>{let a={...i,loopTarget:o};return ke(t,n,void 0,a)});return{conditionIsMet:s.every(o=>o.conditionsAreMet),results:s}}};var s8=he(Fr());var Wr=class extends oe{checkCondition(t,n,r,i){let{target:s}=r;if(s){let a=(s.entities??s.spaces)?.filter(u=>ke(t,n,{target:u},i).conditionsAreMet)??[];return{matches:a,conditionIsMet:!!a.length}}else return{matches:[],conditionIsMet:!1}}};var ev=he(Ga());var Jr=class extends oe{checkCondition(t,n,{targets:r}){if(r.length===1&&r[0].entities?.length)return{conditionIsMet:!0};let[i,...s]=r;return{conditionIsMet:i.entities.some(a=>{let u=dn({conditionType:"Contains",conditions:[{conditionType:"Is",matcher:(0,ev.default)(a.rule,n.properties)}]});return s.every(c=>u.isMet(t,{target:c}))})}}};var h8=he(Fr());var g2=[[1,0],[0,1],[1,1],[-1,1]],tv=new WeakMap;function y2(e,t){let n={moveInstance:t.moveInstance?.id,moveArguments:t.moveArguments};return JSON.stringify({pattern:e,context:n})}function v2(e){return(e.entities||[]).map(n=>{let r=n.entities||[];return r.length===0?"empty":r.map(i=>{let s=Object.keys(i).sort(),o={};return s.forEach(a=>{o[a]=i[a]}),JSON.stringify(o)}).sort().join("|")}).join(",")}function nv(e,t,n,r,i,s=!1){let o=[],a=t.length,u=0;for(;u<=a-r;){let c=w2(e,t,u,n,i,s);c&&o.push(c),u++}return o}function b2(e,t,n){let{width:r,height:i}=e.attributes,s=[];if(t===1&&n===0)for(let o=0;o<i;o++)s.push([0,o]);else if(t===0&&n===1)for(let o=0;o<r;o++)s.push([o,0]);else if(t===1&&n===1){for(let o=0;o<r;o++)s.push([o,0]);for(let o=1;o<i;o++)s.push([0,o])}else if(t===-1&&n===1){for(let o=0;o<r;o++)s.push([o,0]);for(let o=1;o<i;o++)s.push([r-1,o])}return s}function _2(e,t,n,r,i){let s=[],[o,a]=[t,n];for(;e.areCoordinatesValid([o,a]);)s.push(e.getSpace([o,a])),o+=r,a+=i;return s}function w2(e,t,n,r,i,s=!1){let o=n,a=[],u=t.length;for(let c of r){let{count:l,minCount:f,maxCount:p,conditions:h}=c,d,y;l!==void 0?d=y=l:f!==void 0||p!==void 0?(d=f||0,y=p||1/0):d=y=1;let m=0,b=[];for(;m<y&&o<u;){let g=s?t[u-1-o]:t[o];if(O2(e,g,h,b,i))b.push(g),m++,o++;else break}if(m<d)return null;a.push(...b)}return a.length>0?a:null}function O2(e,t,n,r=[],i){return!n||n.length===0?!0:ke(e,{conditions:n},{target:t,targets:[t,...r]},i).conditionsAreMet}function Yr(e,t,n,r){let i=y2(n,r),s=tv.get(t);s||(s=new Map,tv.set(t,s));let o=v2(t),a=s.get(i);if(a&&a.stateKey===o)return a.result;let u=[],c=n.reduce((f,p)=>f+(p.minCount||p.count||1),0);for(let[f,p]of g2){let h=b2(t,f,p);for(let[d,y]of h){let m=_2(t,d,y,f,p);if(m.length<c)continue;let b=nv(e,m,n,c,r);if(u.push(...b),b.length===0||n.length>1){let g=nv(e,m,n,c,r,!0);u.push(...g)}}}let l={matches:u,conditionIsMet:!!u.length};return s.set(i,{stateKey:o,result:l}),l}var $r=class extends oe{checkCondition(t,n,r,i){let{G:s}=t,{target:o}=r,a=s.bank.findParent(r.target),{matches:u}=Yr(t,a,n.sequence,i),c=u.filter(l=>l.some(f=>f===o));return{matches:c,conditionIsMet:!!c.length}}};var Xr=class extends oe{checkCondition(t,n,r,i){let{matches:s}=Yr(t,r.target,n.sequence,i);return{matches:s,conditionIsMet:!!s.length}}};var Qr=class extends oe{checkCondition(t,n,r,i){return{conditionIsMet:r.target.spaces.every(s=>s?.entities.length)}}};function Zr(e,t,n){let r=Ft(He(e.G),ht),i={...e,G:r},s={...t,arguments:{}};return Object.entries(t.arguments).forEach(([o,a])=>{s.arguments[o]=a.abstract?a:r.bank.locate(typeof a=="number"?a:a.entityId)}),n.moveInstance.doMove(i,s,n,{skipCheck:!0}),r}var P2={PlaceNew:["destination"],RemoveEntity:["entity"],MoveEntity:["entity","destination"],TakeFrom:["source","destination"],SetState:["entity","state"]},ei=class extends oe{checkCondition(t,n,{target:r,targets:i=[r]},s){let o={arguments:i.reduce((p,h,d)=>({...p,[P2[s.moveInstance.rule.moveType][d]]:h}),{})},a=Zr(t,o,s),u={};r?u={target:a.bank.locate(r.entityId)}:i&&(u={targets:i.map(p=>a.bank.locate(p.entityId))});let c=ke({...t,G:a},n,u,s),l=c.conditionsAreMet;return{results:l?eu(c.results,p=>t.G.bank.locate(p)):c.results,conditionIsMet:l}}};function eu(e,t,n=new WeakSet){if(typeof e!="object"||e===null||n.has(e))return e;if(n.add(e),e.entityId!==void 0)return t(e.entityId);if(Array.isArray(e))return e.map(r=>eu(r,t,n));{let r={};for(let i in e)e.hasOwnProperty(i)&&(r[i]=eu(e[i],t,n));return r}}var rv=he(qs());function iv(e,t=new Set){if(!e||typeof e!="object")return t;e.type==="contextPath"&&Array.isArray(e.path)&&e.path[0]==="moveArguments"&&e.path[1]&&t.add(e.path[1]);for(let n of Object.values(e))iv(n,t);return t}function E2(e){let t=Object.keys(e),n={},r={};t.forEach(o=>{n[o]=[],r[o]=0}),t.forEach(o=>{let a=e[o];iv(a).forEach(c=>{t.includes(c)&&c!==o&&(n[c].push(o),r[o]++)})});let i=t.filter(o=>r[o]===0),s=[];for(;i.length>0;){let o=i.shift();s.push(o),n[o].forEach(a=>{r[a]--,r[a]===0&&i.push(a)})}return s.length===t.length?s:t}function sv(e,t,n,r,i,s=0,o={}){if(s===r.length){let p={arguments:o};return t.isValid(e,p,i)}let a=r[s],u=n[a],c={...i,moveArguments:o},l=(0,rv.default)(u)?Br(e,{...u,matchMultiple:!0},c,a):u,f=Array.isArray(l)?l:l!==void 0?[l]:[];return f.length===0?!1:f.some(p=>sv(e,t,n,r,i,s+1,{...o,[a]:p}))}function tu(e,t){return Object.values(t).some(n=>{let{moveInstance:r}=n,i={moveInstance:r},o=pe(e,r.rule,i).arguments??{};if(Object.keys(o).length===0)return r.isValid(e,{arguments:{}},i);let a=E2(o);return sv(e,r,o,a,i)})}function ti(e,{game:t,playerID:n,stageName:r}){let i=e.ctx.phase,s=r??e.ctx.activePlayers?.[n??e.ctx.currentPlayer],o=t.phases?.[i]??t;return(o.turn?.stages?.[s]??o).moves??{}}var ni=class extends oe{checkCondition(t,n,r,i){return{conditionIsMet:!tu(t,ti(t,i))}}};var G8=he(Fr());var ri=class extends oe{checkCondition(t,n,r,i){let s={...i};r?.target&&(s.target=r.target);let o=Rr(t,n,s);return{result:o,conditionIsMet:!!o}}};var ii=class extends oe{checkCondition(t,n,{target:r}){let i=t.G.bank.findParent(r),s;return n.position==="First"&&(s=i.entities.indexOf(r)===0),{conditionIsMet:s}}};function dn(e){if(e.conditionType==="Is")return new Ur(e);if(e.conditionType==="Not")return new Vr(e);if(e.conditionType==="Or")return new zr(e);if(e.conditionType==="Some")return new Kr(e);if(e.conditionType==="Contains")return new Wr(e);if(e.conditionType==="ContainsSame")return new Jr(e);if(e.conditionType==="Every")return new Hr(e);if(e.conditionType==="InLine")return new $r(e);if(e.conditionType==="HasLine")return new Xr(e);if(e.conditionType==="IsFull")return new Qr(e);if(e.conditionType==="Would")return new ei(e);if(e.conditionType==="NoPossibleMoves")return new ni(e);if(e.conditionType==="Evaluate")return new ri(e);if(e.conditionType==="Position")return new ii(e)}function ke(e,t,n,r){let{conditions:i=[]}=t,s=[],o;for(let a of i){let u=dn(a).check(e,n,r);if(u.conditionIsMet)s.push(u);else{o=a;break}}return{results:s,failedAt:o,conditionsAreMet:s.length===i.length}}var nu=class{constructor(t,n){this.bank=n,this.rule=t,this.pool=[],this.remaining=+t.count||1}getOne(t,n,r){return this.getMultiple(t,1,n,r)[0]}getMultiple(t,n=1/0,r={},i){let s=[];if(this.remaining===1/0&&n===1/0)throw new Error(`Cannot get infinite pieces from slot with infinite remaining: ${this.rule.name}`);if(n!==1/0&&n>this.remaining)throw new Error(`Requested ${n} pieces but only ${this.remaining} available in slot: ${this.rule.name}`);let o=n===1/0?this.remaining:n;this.remaining!==1/0&&(this.remaining-=o);let a=Math.min(o,this.pool.length);s.push(...this.pool.splice(0,a));let u=o-a;if(u>0&&s.push(...Array.from(new Array(u)).map(()=>this.bank.createEntity(this.rule))),r.state){let c=pe(t,r.state,i);s.forEach(l=>{l.state={...l.state,...c}})}return s}returnToBank(t){t.rule.state?t.state=t.rule.state:delete t.state,this.remaining!==void 0&&(this.remaining+=1),this.pool.push(t)}},zs=nu;var ru=class{constructor(t){this.currentEntityId=0,this.tracker={},this.slots=t.map(n=>new zs(n,this))}createEntity(t={},n){let r=new ht[t.entityType||"Entity"]({bank:this,fromBank:!0,...n},t,this.currentEntityId++);return this.track(r),r}track(t){this.tracker[t.entityId]=t}locate(t){return this.tracker[t]}findAll(t,n,r){if(!n.conditions)throw new Error(`Cannot find entity with no conditions. Rule: ${JSON.stringify(n)}`);return(0,av.default)(Object.values(this.tracker),i=>ke(t,n,{target:i},r).conditionsAreMet)}findOne(t,n,r){return this.findAll(t,n,r)[0]}find(t,n,r){return n.matchMultiple?this.findAll(t,n,r):this.findOne(t,n,r)}findParent(t){return(0,ov.default)(this.tracker,n=>n.entities?.includes(t)||n.spaces?.includes(t))}getOne(t,n,r){let i=this.getSlot(t,n,r);return i||console.error(`No matching slot for ${JSON.stringify(n)}`),i.getOne(t,{state:n.state},r)}getMultiple(t,n,r,i){let s=this.getSlots(t,n,i);return s.length||console.error(`No matching slots for ${JSON.stringify(n)}`),s.reduce((o,a)=>[...o,...a.getMultiple(t,r,{state:n.state})],[])}getSlot(t,n,r){return this.slots.find(i=>ke(t,n,{target:i},r).conditionsAreMet)}getSlots(t,n,r){return this.slots.filter(i=>ke(t,n,{target:i},r).conditionsAreMet)}returnToBank(t,n){this.findParent(n).remove(n),this.getSlot(t,n.rule).returnToBank(n),delete this.tracker[n.entityId]}},Ks=ru;var ht={Board:wr,SpaceGroup:sn,Space:rn,Grid:Ar,Bank:Ks,BankSlot:zs,Entity:Et};function Mt(e){return{...e,G:Ft(JSON.stringify(e.G),ht)}}var uv=he(aa());var we=class{constructor(t){this.rule=this.transformRule(t)}checkValidity(t,n,r){let i=Object.entries(this.rule.arguments??{});if(!i.every(([a])=>{let u=n.arguments[a];return u!==void 0&&(!Array.isArray(u)||u.length)}))return!1;let s={};for(let a=0,u=i.length;a<u;a++){let[c,l]=i[a],f=n.arguments[c],p=Array.isArray(f)?f:[f],h=[];for(let y=0,m=p.length;y<m;y++){let b=p[y],g=ke(t,l,{target:b},{...r,moveArguments:n.arguments});if(h.push(g),!g.conditionsAreMet)break}let d=h.at(-1).conditionsAreMet;if(s[c]={results:h,conditionsAreMet:d},!d)break}let o=ke(t,{conditions:this.rule.conditions},void 0,{...r,moveArguments:n.arguments});return{argumentResults:s,moveResults:o,conditionsAreMet:o.conditionsAreMet&&Object.values(s).every(a=>a.conditionsAreMet)}}isValid(t,n,r){return this.checkValidity(t,n,r).conditionsAreMet}doMove(t,n,r,{skipCheck:i=!1}={}){let s=pe(t,this.rule,r),o={...n,arguments:Object.entries(s.arguments??{}).reduce((u,[c,l])=>({...u,[c]:n?.arguments?.[c]??l}),{})};s.name&&(t.G._meta.previousPayloads[s.name]=o);let a;return i||(a=this.checkValidity(t,o,r)),!i&&!a.conditionsAreMet?uv.INVALID_MOVE:(this.do(t,s,o,r),r&&(r.previousArguments=o.arguments),{conditionResults:a})}transformRule(t){let n=t.arguments;for(let r in n){let i=n[r];i.playerChoice||(i.resolveAsEntity=!0)}return t}};var si=class extends we{do(t,n,{arguments:{entity:r,destination:i}}){Array.isArray(r)?r.forEach(s=>{t.G.bank.findParent(s)?.remove(s),i.placeEntity(s,n.position)}):(t.G.bank.findParent(r)?.remove(r),i.placeEntity(r,n.position))}};var oi=class extends we{do(t,n,{arguments:{entity:r}}){t.G.bank.returnToBank(t,r)}};var ai=class extends we{do(t,n,{arguments:{destination:r}},i){(n.matchMultiple?t.G.bank.getMultiple(t,{...n.entity,conditions:[...n.entity?.conditions||[],...n.conditions||[]]},n.count,i):[t.G.bank.getOne(t,{...n.entity,conditions:[...n.entity?.conditions||[],...n.conditions||[]]},i)]).forEach(o=>{r.placeEntity(o,n.position)})}};var ui=class extends we{do(t,n,{arguments:{source:r,destination:i}}){i.placeEntity(r.takeOne(n.arguments.source.position))}};var ci=class extends we{do(t,n,{arguments:{entity:r,state:i}}){r.state={...r.state,[i.property]:i.value}}};function mn(e,t=[],n){return t?.length&&t.forEach(r=>{Hn(r,n.game).moveInstance.doMove(e,void 0,n)}),e.G}var li=class extends we{do(t,n,r,i){t.events.setActivePlayers(n.options);let s=t.ctx.phase,o=n.options.currentPlayer?.stage,u=(i.game.phases?.[s]??i.game)?.turn?.stages?.[o];mn(t,u?.initialMoves,{...i,stageName:o})}};var fi=class extends we{do(t){t.events.endTurn()}};var pi=class extends we{do(t){t.G._meta.passedPlayers.length<t.ctx.numPlayers&&(t.G._meta.passedPlayers.push(t.ctx.currentPlayer),t.events.pass())}};var hi=class extends we{do(t,n,{arguments:{targets:r}},i){r.forEach(s=>{let o={...i,loopTarget:s};Hs(n.move).doMove(t,void 0,o)})}};var di=class extends we{do(t){t.events.endTurn()}};var mi=class extends we{do(t,n,{arguments:{target:r}}){r.entities=t.random.Shuffle(r.entities)}};function Hn(e,t){let n=Hs(e),r=function(i,s){let o=Mt(i),{G:a}=o,u=k2(s,a),c={moveInstance:n,game:t},l=n.doMove(o,u,c);if(c.moveConditionResults=[l],l!==cv.INVALID_MOVE&&e.then)for(let f of e.then){let p=Hs(f).doMove(o,{},{...c});c.moveConditionResults.push(p)}return JSON.parse(He(a))};return r.moveInstance=n,r}function k2(e,t){if(e){let n=Ft(JSON.stringify(e),ht);return n.arguments=Object.entries(n.arguments).reduce((r,[i,s])=>({...r,[i]:typeof s=="number"?t.bank.locate(s):s}),{}),n}else return e}function Hs(e){switch(e.moveType){case"MoveEntity":return new si(e);case"PlaceNew":return new ai(e);case"RemoveEntity":return new oi(e);case"TakeFrom":return new ui(e);case"SetState":return new ci(e);case"ForEach":return new hi(e);case"Pass":return new di(e);case"Shuffle":return new mi(e);case"SetActivePlayers":return new li(e);case"EndTurn":return new fi(e);case"PassTurn":return new pi(e)}}var b6=he(fv()),hv=he(Ra());function iu(e,t){return JSON.parse(JSON.stringify(e),(n,r)=>{let i=r;for(let s of t)s.test(i)&&(i=s.replace(i));return i})}var M2=[{entityType:"Space",count:"Infinity"},{entityType:"Board",name:"sharedBoard"},{name:"playerMarker",perPlayer:!0,count:"Infinity"}];function I2(e){e.entities=[...M2,...e.entities||[]]}function pv(e,t){if(e.sharedBoard){let n=e.sharedBoard.map(r=>({entity:r,destination:{name:"sharedBoard"}}));e.initialPlacements||(e.initialPlacements=[]),e.initialPlacements.unshift(...n)}if(e.personalBoard){t.push({entityType:"Board",name:"personalBoard",perPlayer:!0});let n=e.personalBoard.map(r=>({entity:r,destination:{name:"personalBoard"}}));e.initialPlacements||(e.initialPlacements=[]),e.initialPlacements.unshift(...n)}if(e.initialPlacements){let n=e.initialPlacements.map(r=>{let{state:i,...s}=r.entity,o=(0,hv.default)(t,s);return r.destination.name==="personalBoard"?{moveType:"ForEach",arguments:{targets:{type:"ctxPath",path:["playOrder"]}},move:{moveType:"PlaceNew",entity:{state:i,conditions:[{conditionType:"Is",matcher:{...s,...o.perPlayer?{player:{type:"contextPath",path:["loopTarget"]}}:{}}}]},arguments:{destination:{conditions:[{conditionType:"Is",matcher:{...r.destination,player:{type:"contextPath",path:["loopTarget"]}}}]}}}}:{moveType:"PlaceNew",entity:{state:i,conditions:[{conditionType:"Is",matcher:s}]},arguments:{destination:{conditions:[{conditionType:"Is",matcher:r.destination}]}}}});e.initialMoves||(e.initialMoves=[]),e.initialMoves.unshift(...n),delete e.initialPlacements}}var N2=[],su=[["isCurrentPlayer",{conditionType:"Is",matcher:{player:{type:"ctxPath",path:["currentPlayer"]}}}],["isEmpty",{conditionType:"Not",conditions:[{conditionType:"Contains"}]}],["ownerOfFirstResultEntity",{type:"contextPath",path:["results",0,"matches",0,0,"entities",0,"attributes","player"]}]],C2=[{test:e=>e&&typeof e=="object",replace:e=>(N2.forEach(([t,n])=>{e.hasOwnProperty(t)&&(e[n]=e[t],delete e[t])}),e)},{test:e=>typeof e=="string",replace:e=>{for(let t=0,n=su.length;t<n;t++)if(e===su[t][0])return su[t][1];return e}},{test:e=>e?.conditions,replace:e=>(Array.isArray(e.conditions)||(e.conditions=[e.conditions]),e)},{test:e=>e?.conditions,replace:e=>{for(let t=0,n=e.conditions.length;t<n;t++)e.conditions[t].conditionType||(e.conditions[t]={conditionType:"Is",matcher:e.conditions[t]});return e}},{test:e=>typeof e?.target=="string",replace:e=>({...e,target:{conditions:[{conditionType:"Is",matcher:{name:e.target}}]}})}];function ou(e){let t=iu(e,C2);return t.sharedBoard||(t.sharedBoard=t.entities),t.turn||(t.turn={minMoves:1,maxMoves:1}),I2(t),pv(t,t.entities),t.phases&&Object.entries(t.phases).forEach(n=>{pv(n,t.entities)}),e.numPlayers&&(e.minPlayers=e.maxPlayers=e.numPlayers),t}function Ws(e,t,n){let r;for(let i of t){let s=ke(e,i);if(s.conditionsAreMet){r={scenario:i,conditionResults:s};break}}return r?.scenario?.result?pe(e,r.scenario.result,{results:r.conditionResults.results}):r}function gi(e,t){let n={name:t},r=ou(e);return n.setup=i=>{let{ctx:s}=i,o={_meta:{passedPlayers:[],previousPayloads:{}}},a=q2(r.entities,s);return o.bank=new Ks(a),o.sharedBoard=o.bank.getOne(i,{conditions:[{conditionType:"Is",matcher:{name:"sharedBoard"}}]}),r.personalBoard&&(o.personalBoards=i.ctx.playOrder.map(u=>o.bank.getOne(i,{conditions:[{conditionType:"Is",matcher:{name:"personalBoard",player:u}}]}))),r.initialMoves?.forEach(u=>{Hn(u,n).moveInstance.doMove({...i,G:o})}),JSON.parse(He(o))},r.moves&&(n.moves=au(r.moves,n)),r.turn&&(n.turn=dv(r.turn,n)),r.phases&&(n.phases=Object.entries(r.phases).reduce((i,[s,o])=>({...i,[s]:j2(o,n)}),{})),r.endIf&&(n.endIf=i=>{let s=Mt(i);return Ws(s,r.endIf)}),e.DEBUG_DISABLE_SECRET_STATE||(n.playerView=i=>{let{G:s,playerID:o}=Mt(i);return Object.values(s.bank.tracker).forEach(a=>{(a.rule.contentsHiddenFrom==="All"||a.rule.contentsHiddenFrom==="Others"&&(o!==a.rule.player||o==null))&&(a.spaces&&(a.spaces=a.rule.hideLength?[]:a.spaces.map(()=>s.bank.createEntity())),a.entities&&(a.entities=a.rule.hideLength?[]:a.entities.map(()=>s.bank.createEntity())))}),JSON.parse(He(s))}),n}function q2(e,t){return e.reduce((n,r)=>{let i={...r};if(i.perPlayer&&(delete i.perPlayer,i.variants?i.variants=new Array(t.numPlayers).fill().reduce((s,o,a)=>[...s,...i.variants.map(u=>({...u,player:`${a}`}))],[]):i.variants=new Array(t.numPlayers).fill().map((s,o)=>({player:`${o}`}))),i.variants){let s=i.variants;return delete i.variants,[...n,...s.map(o=>({...i,...o}))]}else return[...n,i]},[])}function dv(e,t){let n={...e};return n.onBegin=r=>{let i=Mt(r),s=e.stages?.[i.ctx.activePlayers?.[i.ctx.currentPlayer]];return i.G._meta.passedPlayers=i.G._meta.passedPlayers.filter(o=>o!==i.ctx.currentPlayer),mn(i,e.initialMoves,{game:t}),mn(i,s?.initialMoves,{game:t}),JSON.parse(He(i.G))},e.stages&&Object.entries(e.stages).forEach(([r,i])=>{i.moves&&(n.stages[r].moves=au(i.moves,t))}),e.order?.playOrder==="RotateFirst"&&(e.order.first=()=>0,e.order.next=({ctx:r})=>(r.playOrderPos+1)%r.numPlayers,n.order.playOrder=({ctx:r,G:i})=>i._meta.isAfterFirstPhase?[...r.playOrder.slice(1),r.playOrder[0]]:r.playOrder),n}function j2(e,t){let n={...e};return e.turn&&(n.turn=dv(e.turn,t)),e.moves&&(n.moves=au(e.moves,t)),n.onBegin=r=>{let i=Mt(r);return mn(i,e.initialMoves,{game:t}),i.G._meta.currentPhaseHasBeenSetUp=!0,i.G._meta.nextPhase=e.next,JSON.parse(He(i.G))},e.endIf&&(n.endIf=r=>{let i=Mt(r);if(i.G._meta.currentPhaseHasBeenSetUp){let s=Ws(i,e.endIf);if(s)return s}}),n.onEnd=({G:r})=>{r._meta.currentPhaseHasBeenSetUp=!1,r._meta.isAfterFirstPhase=!0},n}function au(e,t){return Object.entries(e).reduce((n,[r,i])=>({...n,[r]:Hn({...i,name:r},t)}),{})}var D2="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var mv=(e=21)=>{let t="",n=e|0;for(;n--;)t+=D2[Math.random()*64|0];return t};function st(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(0)var i,s;throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map(function(o){return"'"+o+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Wn(e){return!!e&&!!e[Je]}function yn(e){var t;return!!e&&(function(n){if(!n||typeof n!="object")return!1;var r=Object.getPrototypeOf(n);if(r===null)return!0;var i=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return i===Object||typeof i=="function"&&Function.toString.call(i)===z2}(e)||Array.isArray(e)||!!e[Pv]||!!(!((t=e.constructor)===null||t===void 0)&&t[Pv])||yu(e)||vu(e))}function vi(e,t,n){n===void 0&&(n=!1),Jn(e)===0?(n?Object.keys:Pu)(e).forEach(function(r){n&&typeof r=="symbol"||t(r,e[r],e)}):e.forEach(function(r,i){return t(i,r,e)})}function Jn(e){var t=e[Je];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:yu(e)?2:vu(e)?3:0}function pu(e,t){return Jn(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function R2(e,t){return Jn(e)===2?e.get(t):e[t]}function Ev(e,t,n){var r=Jn(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function B2(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function yu(e){return U2&&e instanceof Map}function vu(e){return V2&&e instanceof Set}function gn(e){return e.o||e.t}function bu(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=K2(e);delete t[Je];for(var n=Pu(t),r=0;r<n.length;r++){var i=n[r],s=t[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(t[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function _u(e,t){return t===void 0&&(t=!1),wu(e)||Wn(e)||!yn(e)||(Jn(e)>1&&(e.set=e.add=e.clear=e.delete=L2),Object.freeze(e),t&&vi(e,function(n,r){return _u(r,!0)},!0)),e}function L2(){st(2)}function wu(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function dt(e){var t=H2[e];return t||st(18,e),t}function gv(){return bi}function uu(e,t){t&&(dt("Patches"),e.u=[],e.s=[],e.v=t)}function Js(e){hu(e),e.p.forEach(G2),e.p=null}function hu(e){e===bi&&(bi=e.l)}function yv(e){return bi={p:[],l:bi,h:e,m:!0,_:0}}function G2(e){var t=e[Je];t.i===0||t.i===1?t.j():t.g=!0}function cu(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||dt("ES5").S(t,e,r),r?(n[Je].P&&(Js(t),st(4)),yn(e)&&(e=Ys(t,e),t.l||$s(t,e)),t.u&&dt("Patches").M(n[Je].t,e,t.u,t.s)):e=Ys(t,n,[]),Js(t),t.u&&t.v(t.u,t.s),e!==kv?e:void 0}function Ys(e,t,n){if(wu(t))return t;var r=t[Je];if(!r)return vi(t,function(a,u){return vv(e,r,t,a,u,n)},!0),t;if(r.A!==e)return t;if(!r.P)return $s(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=bu(r.k):r.o,s=i,o=!1;r.i===3&&(s=new Set(i),i.clear(),o=!0),vi(s,function(a,u){return vv(e,r,i,a,u,n,o)}),$s(e,i,!1),n&&e.u&&dt("Patches").N(r,n,e.u,e.s)}return r.o}function vv(e,t,n,r,i,s,o){if(Wn(i)){var a=Ys(e,i,s&&t&&t.i!==3&&!pu(t.R,r)?s.concat(r):void 0);if(Ev(n,r,a),!Wn(a))return;e.m=!1}else o&&n.add(i);if(yn(i)&&!wu(i)){if(!e.h.D&&e._<1)return;Ys(e,i),t&&t.A.l||$s(e,i)}}function $s(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&_u(t,n)}function lu(e,t){var n=e[Je];return(n?gn(n):e)[t]}function bv(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function du(e){e.P||(e.P=!0,e.l&&du(e.l))}function fu(e){e.o||(e.o=bu(e.t))}function mu(e,t,n){var r=yu(t)?dt("MapSet").F(t,n):vu(t)?dt("MapSet").T(t,n):e.O?function(i,s){var o=Array.isArray(i),a={i:o?1:0,A:s?s.A:gv(),P:!1,I:!1,R:{},l:s,t:i,k:null,o:null,j:null,C:!1},u=a,c=gu;o&&(u=[a],c=yi);var l=Proxy.revocable(u,c),f=l.revoke,p=l.proxy;return a.k=p,a.j=f,p}(t,n):dt("ES5").J(t,n);return(n?n.A:gv()).p.push(r),r}function F2(e){return Wn(e)||st(22,e),function t(n){if(!yn(n))return n;var r,i=n[Je],s=Jn(n);if(i){if(!i.P&&(i.i<4||!dt("ES5").K(i)))return i.t;i.I=!0,r=_v(n,s),i.I=!1}else r=_v(n,s);return vi(r,function(o,a){i&&R2(i.t,o)===a||Ev(r,o,t(a))}),s===3?new Set(r):r}(e)}function _v(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return bu(e)}var wv,bi,Ou=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",U2=typeof Map<"u",V2=typeof Set<"u",Ov=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",kv=Ou?Symbol.for("immer-nothing"):((wv={})["immer-nothing"]=!0,wv),Pv=Ou?Symbol.for("immer-draftable"):"__$immer_draftable",Je=Ou?Symbol.for("immer-state"):"__$immer_state";var z2=""+Object.prototype.constructor,Pu=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,K2=Object.getOwnPropertyDescriptors||function(e){var t={};return Pu(e).forEach(function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)}),t},H2={},gu={get:function(e,t){if(t===Je)return e;var n=gn(e);if(!pu(n,t))return function(i,s,o){var a,u=bv(s,o);return u?"value"in u?u.value:(a=u.get)===null||a===void 0?void 0:a.call(i.k):void 0}(e,n,t);var r=n[t];return e.I||!yn(r)?r:r===lu(e.t,t)?(fu(e),e.o[t]=mu(e.A.h,r,e)):r},has:function(e,t){return t in gn(e)},ownKeys:function(e){return Reflect.ownKeys(gn(e))},set:function(e,t,n){var r=bv(gn(e),t);if(r?.set)return r.set.call(e.k,n),!0;if(!e.P){var i=lu(gn(e),t),s=i?.[Je];if(s&&s.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(B2(n,i)&&(n!==void 0||pu(e.t,t)))return!0;fu(e),du(e)}return e.o[t]===n&&(n!==void 0||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return lu(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,fu(e),du(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=gn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty:function(){st(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){st(12)}},yi={};vi(gu,function(e,t){yi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),yi.deleteProperty=function(e,t){return yi.set.call(this,e,t,void 0)},yi.set=function(e,t,n){return gu.set.call(this,e[0],t,n,e[0])};var W2=function(){function e(n){var r=this;this.O=Ov,this.D=!0,this.produce=function(i,s,o){if(typeof i=="function"&&typeof s!="function"){var a=s;s=i;var u=r;return function(y){var m=this;y===void 0&&(y=a);for(var b=arguments.length,g=Array(b>1?b-1:0),O=1;O<b;O++)g[O-1]=arguments[O];return u.produce(y,function(I){var j;return(j=s).call.apply(j,[m,I].concat(g))})}}var c;if(typeof s!="function"&&st(6),o!==void 0&&typeof o!="function"&&st(7),yn(i)){var l=yv(r),f=mu(r,i,void 0),p=!0;try{c=s(f),p=!1}finally{p?Js(l):hu(l)}return typeof Promise<"u"&&c instanceof Promise?c.then(function(y){return uu(l,o),cu(y,l)},function(y){throw Js(l),y}):(uu(l,o),cu(c,l))}if(!i||typeof i!="object"){if((c=s(i))===void 0&&(c=i),c===kv&&(c=void 0),r.D&&_u(c,!0),o){var h=[],d=[];dt("Patches").M(i,c,h,d),o(h,d)}return c}st(21,i)},this.produceWithPatches=function(i,s){if(typeof i=="function")return function(c){for(var l=arguments.length,f=Array(l>1?l-1:0),p=1;p<l;p++)f[p-1]=arguments[p];return r.produceWithPatches(c,function(h){return i.apply(void 0,[h].concat(f))})};var o,a,u=r.produce(i,s,function(c,l){o=c,a=l});return typeof Promise<"u"&&u instanceof Promise?u.then(function(c){return[c,o,a]}):[u,o,a]},typeof n?.useProxies=="boolean"&&this.setUseProxies(n.useProxies),typeof n?.autoFreeze=="boolean"&&this.setAutoFreeze(n.autoFreeze)}var t=e.prototype;return t.createDraft=function(n){yn(n)||st(8),Wn(n)&&(n=F2(n));var r=yv(this),i=mu(this,n,void 0);return i[Je].C=!0,hu(r),i},t.finishDraft=function(n,r){var i=n&&n[Je],s=i.A;return uu(s,r),cu(void 0,s)},t.setAutoFreeze=function(n){this.D=n},t.setUseProxies=function(n){n&&!Ov&&st(20),this.O=n},t.applyPatches=function(n,r){var i;for(i=r.length-1;i>=0;i--){var s=r[i];if(s.path.length===0&&s.op==="replace"){n=s.value;break}}i>-1&&(r=r.slice(i+1));var o=dt("Patches").$;return Wn(n)?o(n,r):this.produce(n,function(a){return o(a,r)})},e}(),Ye=new W2,J2=Ye.produce,j6=Ye.produceWithPatches.bind(Ye),D6=Ye.setAutoFreeze.bind(Ye),R6=Ye.setUseProxies.bind(Ye),B6=Ye.applyPatches.bind(Ye),L6=Ye.createDraft.bind(Ye),G6=Ye.finishDraft.bind(Ye),Av=J2;var Eu=class{constructor(t){let n=Y2();this.c=1,this.s0=n(" "),this.s1=n(" "),this.s2=n(" "),this.s0-=n(t),this.s0<0&&(this.s0+=1),this.s1-=n(t),this.s1<0&&(this.s1+=1),this.s2-=n(t),this.s2<0&&(this.s2+=1)}next(){let t=2091639*this.s0+this.c*23283064365386963e-26;return this.s0=this.s1,this.s1=this.s2,this.s2=t-(this.c=Math.trunc(t))}};function Y2(){let e=4022871197;return function(n){let r=n.toString();for(let i=0;i<r.length;i++){e+=r.charCodeAt(i);let s=.02519603282416938*e;e=s>>>0,s-=e,s*=e,e=s>>>0,s-=e,e+=s*4294967296}return(e>>>0)*23283064365386963e-26}}function xv(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function ku(e,t){let n=new Eu(e),r=n.next.bind(n);return t&&xv(t,n),r.state=()=>xv(n,{}),r}var Xs=class{constructor(t){this.state=t||{seed:"0"},this.used=!1}static seed(){return Date.now().toString(36).slice(-10)}isUsed(){return this.used}getState(){return this.state}_random(){this.used=!0;let t=this.state,n=t.prngstate?"":t.seed,r=ku(n,t.prngstate),i=r();return this.state={...t,prngstate:r.state()},i}api(){let t=this._random.bind(this),n={D4:4,D6:6,D8:8,D10:10,D12:12,D20:20},r={};for(let s in n){let o=n[s];r[s]=a=>a===void 0?Math.floor(t()*o)+1:Array.from({length:a}).map(()=>Math.floor(t()*o)+1)}function i(s=6,o){return o===void 0?Math.floor(t()*s)+1:Array.from({length:o}).map(()=>Math.floor(t()*s)+1)}return{...r,Die:i,Number:()=>t(),Shuffle:s=>{let o=[...s],a=s.length,u=0,c=Array.from({length:a});for(;a;){let l=Math.trunc(a*t());c[u++]=o[l],o[l]=o[--a]}return c},_private:this}}},Sv={name:"random",noClient:({api:e})=>e._private.isUsed(),flush:({api:e})=>e._private.getState(),api:({data:e})=>new Xs(e).api(),setup:({game:e})=>{let{seed:t}=e;return t===void 0&&(t=Xs.seed()),{seed:t}},playerView:()=>{}};var $2=he(tn()),_i="MAKE_MOVE",Yn="GAME_EVENT",wi="REDO",Oi="RESET",Pi="SYNC",Ei="UNDO",ki="UPDATE",Ai="PATCH",Su="PLUGIN",$n="STRIP_TRANSIENTS",Tu=(e,t,n,r)=>({type:_i,payload:{type:e,args:t,playerID:n,credentials:r}}),vn=(e,t,n,r)=>({type:Yn,payload:{type:e,args:t,playerID:n,credentials:r}}),Tv=(e,t,n,r)=>({type:Yn,payload:{type:e,args:t,playerID:n,credentials:r},automatic:!0}),xi=e=>({type:Pi,state:e.state,log:e.log,initialState:e.initialState,clientOnly:!0}),Mu=(e,t,n,r)=>({type:Ai,prevStateID:e,stateID:t,patch:n,deltalog:r,clientOnly:!0}),Iu=(e,t)=>({type:ki,state:e,deltalog:t,clientOnly:!0}),Nu=e=>({type:Oi,state:e,clientOnly:!0}),Cu=(e,t)=>({type:Ei,payload:{type:null,args:null,playerID:e,credentials:t}}),qu=(e,t)=>({type:wi,payload:{type:null,args:null,playerID:e,credentials:t}}),X2=(e,t,n,r)=>({type:Su,payload:{type:e,args:t,playerID:n,credentials:r}}),ju=()=>({type:$n}),Mv=Object.freeze({__proto__:null,makeMove:Tu,gameEvent:vn,automaticGameEvent:Tv,sync:xi,patch:Mu,update:Iu,reset:Nu,undo:Cu,redo:qu,plugin:X2,stripTransients:ju}),Zs="INVALID_MOVE",Q2={name:"plugin-immer",fnWrap:e=>(t,...n)=>{let r=!1,i=Av(t.G,s=>{let o=e({...t,G:s},...n);if(o===Zs){r=!0;return}return o});return r?Zs:i}},Re;(function(e){e.MOVE="MOVE",e.GAME_ON_END="GAME_ON_END",e.PHASE_ON_BEGIN="PHASE_ON_BEGIN",e.PHASE_ON_END="PHASE_ON_END",e.TURN_ON_BEGIN="TURN_ON_BEGIN",e.TURN_ON_MOVE="TURN_ON_MOVE",e.TURN_ON_END="TURN_ON_END"})(Re||(Re={}));var It;(function(e){e.CalledOutsideHook="Events must be called from moves or the `onBegin`, `onEnd`, and `onMove` hooks.\nThis error probably means you called an event from other game code, like an `endIf` trigger or one of the `turn.order` methods.",e.EndTurnInOnEnd="`endTurn` is disallowed in `onEnd` hooks \u2014 the turn is already ending.",e.MaxTurnEndings=`Maximum number of turn endings exceeded for this update.
|
|
8
|
-
This likely means game code is triggering an infinite loop.`,e.PhaseEventInOnEnd="`setPhase` & `endPhase` are disallowed in a phase\u2019s `onEnd` hook \u2014 the phase is already ending.\nIf you\u2019re trying to dynamically choose the next phase when a phase ends, use the phase\u2019s `next` trigger.",e.StageEventInOnEnd="`setStage`, `endStage` & `setActivePlayers` are disallowed in `onEnd` hooks.",e.StageEventInPhaseBegin="`setStage`, `endStage` & `setActivePlayers` are disallowed in a phase\u2019s `onBegin` hook.\nUse `setActivePlayers` in a `turn.onBegin` hook or declare stages with `turn.activePlayers` instead.",e.StageEventInTurnBegin="`setStage` & `endStage` are disallowed in `turn.onBegin`.\nUse `setActivePlayers` or declare stages with `turn.activePlayers` instead."})(
|
|
9
|
-
`+i}}}});e:for(let i=0;i<this.dispatch.length;i++){let s=this.dispatch[i],o=s.turn!==t.ctx.turn;if(this.currentTurn-this.initialTurn>=this.maxEndedTurnsPerAction)return r(s.error,
|
|
10
|
-
${s}`),[e,r]},qv=({G:e,ctx:t,plugins:n={}},{game:r,playerID:i})=>([...Si,...r.plugins].forEach(({name:s,playerView:o})=>{if(!o)return;let{data:a}=n[s]||{data:{}},u=o({G:e,ctx:t,game:r,data:a,playerID:i});n={...n,[s]:{data:u}}}),n);function Mi(e,t=!1){e.moveLimit&&(t&&(e.minMoves=e.moveLimit),e.maxMoves=e.moveLimit,delete e.moveLimit)}function Ii(e,t){let n={},r=[],i=null,s={},o={};if(Array.isArray(t)){let u={};t.forEach(c=>u[c]=Nt.NULL),n=u}else{if(Mi(t),t.next&&(i=t.next),t.revert&&(r=[...e._prevActivePlayers,{activePlayers:e.activePlayers,_activePlayersMinMoves:e._activePlayersMinMoves,_activePlayersMaxMoves:e._activePlayersMaxMoves,_activePlayersNumMoves:e._activePlayersNumMoves}]),t.currentPlayer!==void 0&&Qs(n,s,o,e.currentPlayer,t.currentPlayer),t.others!==void 0)for(let u=0;u<e.playOrder.length;u++){let c=e.playOrder[u];c!==e.currentPlayer&&Qs(n,s,o,c,t.others)}if(t.all!==void 0)for(let u=0;u<e.playOrder.length;u++){let c=e.playOrder[u];Qs(n,s,o,c,t.all)}if(t.value)for(let u in t.value)Qs(n,s,o,u,t.value[u]);if(t.minMoves)for(let u in n)s[u]===void 0&&(s[u]=t.minMoves);if(t.maxMoves)for(let u in n)o[u]===void 0&&(o[u]=t.maxMoves)}Object.keys(n).length===0&&(n=null),Object.keys(s).length===0&&(s=null),Object.keys(o).length===0&&(o=null);let a={};for(let u in n)a[u]=0;return{...e,activePlayers:n,_activePlayersMinMoves:s,_activePlayersMaxMoves:o,_activePlayersNumMoves:a,_prevActivePlayers:r,_nextActivePlayers:i}}function jv(e){let{activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s,_nextActivePlayers:o}=e;if(t&&Object.keys(t).length===0)if(o)e=Ii(e,o),{activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s}=e;else if(s.length>0){let a=s.length-1;({activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i}=s[a]),s=s.slice(0,a)}else t=null,n=null,r=null;return{...e,activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s}}function Qs(e,t,n,r,i){(typeof i!="object"||i===Nt.NULL)&&(i={stage:i}),i.stage!==void 0&&(Mi(i),e[r]=i.stage,i.minMoves&&(t[r]=i.minMoves),i.maxMoves&&(n[r]=i.maxMoves))}function xu(e,t){return e[t]+""}function Dv(e,t){let{G:n,ctx:r}=e,{numPlayers:i}=r,o={...Wt(e),G:n,ctx:r},a=t.order,u=[...Array.from({length:i})].map((p,h)=>h+"");a.playOrder!==void 0&&(u=a.playOrder(o));let c=a.first(o),l=typeof c;l!=="number"&&Oe(`invalid value returned by turn.order.first \u2014 expected number got ${l} \u201C${c}\u201D.`);let f=xu(u,c);return r={...r,currentPlayer:f,playOrderPos:c,playOrder:u},r=Ii(r,t.activePlayers||{}),r}function Rv(e,t,n,r){let i=n.order,{G:s,ctx:o}=e,a=o.playOrderPos,u=!1;if(r&&r!==!0)typeof r!="object"&&Oe(`invalid argument to endTurn: ${r}`),Object.keys(r).forEach(c=>{switch(c){case"remove":t=xu(o.playOrder,a);break;case"next":a=o.playOrder.indexOf(r.next),t=r.next;break;default:Oe(`invalid argument to endTurn: ${c}`)}});else{let l={...Wt(e),G:s,ctx:o},f=i.next(l),p=typeof f;f!==void 0&&p!=="number"&&Oe(`invalid value returned by turn.order.next \u2014 expected number or undefined got ${p} \u201C${f}\u201D.`),f===void 0?u=!0:(a=f,t=xu(o.playOrder,a))}return o={...o,playOrderPos:a,currentPlayer:t},{endPhase:u,ctx:o}}var Bv={DEFAULT:{first:({ctx:e})=>e.turn===0?e.playOrderPos:(e.playOrderPos+1)%e.playOrder.length,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},RESET:{first:()=>0,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},CONTINUE:{first:({ctx:e})=>e.playOrderPos,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},ONCE:{first:()=>0,next:({ctx:e})=>{if(e.playOrderPos<e.playOrder.length-1)return e.playOrderPos+1}},CUSTOM:e=>({playOrder:()=>e,first:()=>0,next:({ctx:t})=>(t.playOrderPos+1)%t.playOrder.length}),CUSTOM_FROM:e=>({playOrder:({G:t})=>t[e],first:()=>0,next:({ctx:t})=>(t.playOrderPos+1)%t.playOrder.length})},Nt={NULL:null},K6={ALL:{all:Nt.NULL},ALL_ONCE:{all:Nt.NULL,minMoves:1,maxMoves:1},OTHERS:{others:Nt.NULL},OTHERS_ONCE:{others:Nt.NULL,minMoves:1,maxMoves:1}};var{parse:oC,stringify:aC}=JSON,{keys:uC}=Object,Ni=String,Fv="string",Lv={},to="object",Uv=(e,t)=>t,cC=e=>e instanceof Ni?Ni(e):e,lC=(e,t)=>typeof t===Fv?new Ni(t):t,Vv=(e,t,n,r)=>{let i=[];for(let s=uC(n),{length:o}=s,a=0;a<o;a++){let u=s[a],c=n[u];if(c instanceof Ni){let l=e[c];typeof l===to&&!t.has(l)?(t.add(l),n[u]=Lv,i.push({k:u,a:[e,t,l,r]})):n[u]=r.call(n,u,l)}else n[u]!==Lv&&(n[u]=r.call(n,u,c))}for(let{length:s}=i,o=0;o<s;o++){let{k:a,a:u}=i[o];n[a]=r.call(n,a,Vv.apply(null,u))}return n},Gv=(e,t,n)=>{let r=Ni(t.push(n)-1);return e.set(n,r),r},Gu=(e,t)=>{let n=oC(e,lC).map(cC),r=n[0],i=t||Uv,s=typeof r===to&&r?Vv(n,new Set,r,i):r;return i.call({"":s},"",s)},Fu=(e,t,n)=>{let r=t&&typeof t===to?(l,f)=>l===""||-1<t.indexOf(l)?f:void 0:t||Uv,i=new Map,s=[],o=[],a=+Gv(i,s,r.call({"":e},"",e)),u=!a;for(;a<s.length;)u=!0,o[a]=aC(s[a++],c,n);return"["+o.join(",")+"]";function c(l,f){if(u)return u=!u,f;let p=r.call(this,l,f);switch(typeof p){case to:if(p===null)return p;case Fv:return i.get(p)||Gv(i,s,p)}return p}};var ab=he(qi());function EC({moves:e,phases:t,endIf:n,onEnd:r,turn:i,events:s,plugins:o}){e===void 0&&(e={}),s===void 0&&(s={}),o===void 0&&(o=[]),t===void 0&&(t={}),n||(n=()=>{}),r||(r=({G:_})=>_),i||(i={});let a={...t};""in a&&Oe("cannot specify phase with empty name"),a[""]={};let u={},c=new Set,l=null;Object.keys(e).forEach(_=>c.add(_));let f=(_,E)=>{let T=Lu(_,E,o);return F=>{let z=Wt(F);return T({...z,G:F.G,ctx:F.ctx,playerID:F.playerID})}},p=_=>E=>{let T=Wt(E);return _({...T,G:E.G,ctx:E.ctx})},h={onEnd:f(r,Re.GAME_ON_END),endIf:p(n)};for(let _ in a){let E=a[_];if(E.start===!0&&(l=_),E.moves!==void 0)for(let T of Object.keys(E.moves))u[_+"."+T]=E.moves[T],c.add(T);E.endIf===void 0&&(E.endIf=()=>{}),E.onBegin===void 0&&(E.onBegin=({G:T})=>T),E.onEnd===void 0&&(E.onEnd=({G:T})=>T),E.turn===void 0&&(E.turn=i),E.turn.order===void 0&&(E.turn.order=Bv.DEFAULT),E.turn.onBegin===void 0&&(E.turn.onBegin=({G:T})=>T),E.turn.onEnd===void 0&&(E.turn.onEnd=({G:T})=>T),E.turn.endIf===void 0&&(E.turn.endIf=()=>!1),E.turn.onMove===void 0&&(E.turn.onMove=({G:T})=>T),E.turn.stages===void 0&&(E.turn.stages={}),Mi(E.turn,!0);for(let T in E.turn.stages){let z=E.turn.stages[T].moves||{};for(let H of Object.keys(z)){let Se=_+"."+T+"."+H;u[Se]=z[H],c.add(H)}}if(E.wrapped={onBegin:f(E.onBegin,Re.PHASE_ON_BEGIN),onEnd:f(E.onEnd,Re.PHASE_ON_END),endIf:p(E.endIf)},E.turn.wrapped={onMove:f(E.turn.onMove,Re.TURN_ON_MOVE),onBegin:f(E.turn.onBegin,Re.TURN_ON_BEGIN),onEnd:f(E.turn.onEnd,Re.TURN_ON_END),endIf:p(E.turn.endIf)},typeof E.next!="function"){let{next:T}=E;E.next=()=>T||null}E.wrapped.next=p(E.next)}function d(_){return _.phase?a[_.phase]:a[""]}function y(_){return _}function m(_,E){let T=new Set,F=new Set;for(let z=0;z<E.length;z++){let{fn:H,arg:Se,...ve}=E[z];if(H===ne){F.clear();let Ge=_.ctx.phase;if(T.has(Ge)){let ct={..._.ctx,phase:null};return{..._,ctx:ct}}T.add(Ge)}let Ze=[];if(_=H(_,{...ve,arg:Se,next:Ze}),H===se)break;let Ce=J(_);if(Ce){E.push({fn:se,arg:Ce,turn:_.ctx.turn,phase:_.ctx.phase,automatic:!0});continue}let De=fe(_);if(De){E.push({fn:ne,arg:De,turn:_.ctx.turn,phase:_.ctx.phase,automatic:!0});continue}if([y,N,D].includes(H)){let Ge=V(_);if(Ge){E.push({fn:G,arg:Ge,turn:_.ctx.turn,phase:_.ctx.phase,automatic:!0});continue}}E.push(...Ze)}return _}function b(_,{next:E}){return E.push({fn:g}),_}function g(_,{next:E}){let{G:T,ctx:F}=_;return T=d(F).wrapped.onBegin(_),E.push({fn:O}),{..._,G:T,ctx:F}}function O(_,{currentPlayer:E}){let{ctx:T}=_,F=d(T);E?(T={...T,currentPlayer:E},F.turn.activePlayers&&(T=Ii(T,F.turn.activePlayers))):T=Dv(_,F.turn);let z=T.turn+1;T={...T,turn:z,numMoves:0,_prevActivePlayers:[]};let H=F.turn.wrapped.onBegin({..._,ctx:T});return{..._,G:H,ctx:T,_undo:[],_redo:[]}}function I(_,{arg:E,next:T,phase:F}){let z=d({phase:F}),{ctx:H}=_;if(E&&E.next)if(E.next in a)H={...H,phase:E.next};else return Oe("invalid phase: "+E.next),_;else H={...H,phase:z.wrapped.next(_)||null};return _={..._,ctx:H},T.push({fn:g}),_}function j(_,{arg:E,currentPlayer:T,next:F}){let{G:z,ctx:H}=_,Se=d(H),{endPhase:ve,ctx:Ze}=Rv(_,T,Se.turn,E);return H=Ze,_={..._,G:z,ctx:H},ve?F.push({fn:ne,turn:H.turn,phase:H.phase}):F.push({fn:O,currentPlayer:H.currentPlayer}),_}function N(_,{arg:E,playerID:T}){if((typeof E=="string"||E===Nt.NULL)&&(E={stage:E}),typeof E!="object")return _;Mi(E);let{ctx:F}=_,{activePlayers:z,_activePlayersMinMoves:H,_activePlayersMaxMoves:Se,_activePlayersNumMoves:ve}=F;return E.stage!==void 0&&(z===null&&(z={}),z[T]=E.stage,ve[T]=0,E.minMoves&&(H===null&&(H={}),H[T]=E.minMoves),E.maxMoves&&(Se===null&&(Se={}),Se[T]=E.maxMoves)),F={...F,activePlayers:z,_activePlayersMinMoves:H,_activePlayersMaxMoves:Se,_activePlayersNumMoves:ve},{..._,ctx:F}}function D(_,{arg:E}){return{..._,ctx:Ii(_.ctx,E)}}function J(_){return h.endIf(_)}function fe(_){return d(_.ctx).wrapped.endIf(_)}function V(_){let E=d(_.ctx),T=_.ctx.numMoves||0;return E.turn.maxMoves&&T>=E.turn.maxMoves?!0:E.turn.wrapped.endIf(_)}function se(_,{arg:E,phase:T}){_=ne(_,{phase:T}),E===void 0&&(E=!0),_={..._,ctx:{..._.ctx,gameover:E}};let F=h.onEnd(_);return{..._,G:F}}function ne(_,{arg:E,next:T,turn:F,automatic:z}){_=G(_,{turn:F,force:!0,automatic:!0});let{phase:H,turn:Se}=_.ctx;if(T&&T.push({fn:I,arg:E,phase:H}),H===null)return _;let Ze=d(_.ctx).wrapped.onEnd(_),Ce={..._.ctx,phase:null},De=vn("endPhase",E),{_stateID:Ge}=_,ct={action:De,_stateID:Ge,turn:Se,phase:H};z&&(ct.automatic=!0);let Zt=[..._.deltalog||[],ct];return{..._,G:Ze,ctx:Ce,deltalog:Zt}}function G(_,{arg:E,next:T,turn:F,force:z,automatic:H,playerID:Se}){if(F!==_.ctx.turn)return _;let{currentPlayer:ve,numMoves:Ze,phase:Ce,turn:De}=_.ctx,Ge=d(_.ctx),ct=Ze||0;if(!z&&Ge.turn.minMoves&&ct<Ge.turn.minMoves)return Ru(`cannot end turn before making ${Ge.turn.minMoves} moves`),_;let Zt=Ge.turn.wrapped.onEnd(_);T&&T.push({fn:j,arg:E,currentPlayer:ve});let Gt={..._.ctx,activePlayers:null};if(E&&E.remove){Se=Se||ve;let en=Gt.playOrder.filter(m_=>m_!=Se),d_=Gt.playOrderPos>en.length-1?0:Gt.playOrderPos;if(Gt={...Gt,playOrder:en,playOrderPos:d_},en.length===0)return T.push({fn:ne,turn:De,phase:Ce}),_}let Do=vn("endTurn",E),{_stateID:cl}=_,pr={action:Do,_stateID:cl,turn:De,phase:Ce};H&&(pr.automatic=!0);let Ro=[..._.deltalog||[],pr];return{..._,G:Zt,ctx:Gt,deltalog:Ro,_undo:[],_redo:[]}}function Pe(_,{arg:E,next:T,automatic:F,playerID:z}){z=z||_.ctx.currentPlayer;let{ctx:H,_stateID:Se}=_,{activePlayers:ve,_activePlayersNumMoves:Ze,_activePlayersMinMoves:Ce,_activePlayersMaxMoves:De,phase:Ge,turn:ct}=H,Zt=ve!==null&&z in ve,Gt=d(H);if(!E&&Zt){let en=Gt.turn.stages[ve[z]];en&&en.next&&(E=en.next)}if(T&&T.push({fn:N,arg:E,playerID:z}),!Zt)return _;let Do=Ze[z]||0;if(Ce&&Ce[z]&&Do<Ce[z])return Ru(`cannot end stage before making ${Ce[z]} moves`),_;ve={...ve},delete ve[z],Ce&&(Ce={...Ce},delete Ce[z]),De&&(De={...De},delete De[z]),H=jv({...H,activePlayers:ve,_activePlayersMinMoves:Ce,_activePlayersMaxMoves:De});let pr={action:vn("endStage",E),_stateID:Se,turn:ct,phase:Ge};F&&(pr.automatic=!0);let Ro=[..._.deltalog||[],pr];return{..._,ctx:H,deltalog:Ro}}function ue(_,E,T){let F=d(_),z=F.turn.stages,{activePlayers:H}=_;if(H&&H[T]!==void 0&&H[T]!==Nt.NULL&&z[H[T]]!==void 0&&z[H[T]].moves!==void 0){let ve=z[H[T]].moves;if(E in ve)return ve[E]}else if(F.moves){if(E in F.moves)return F.moves[E]}else if(E in e)return e[E];return null}function Lt(_,E){let{playerID:T,type:F}=E,{currentPlayer:z,activePlayers:H,_activePlayersMaxMoves:Se}=_.ctx,ve=ue(_.ctx,F,T),Ze=!ve||typeof ve=="function"||ve.noLimit!==!0,{numMoves:Ce,_activePlayersNumMoves:De}=_.ctx;Ze&&(T===z&&Ce++,H&&De[T]++),_={..._,ctx:{..._.ctx,numMoves:Ce,_activePlayersNumMoves:De}},Se&&De[T]>=Se[T]&&(_=Pe(_,{playerID:T,automatic:!0}));let ct=d(_.ctx).turn.wrapped.onMove({..._,playerID:T});return _={..._,G:ct},m(_,[{fn:y}])}function bt(_,E,T){return m(_,[{fn:Pe,arg:T,playerID:E}])}function kn(_,E){return m(_,[{fn:Pe,playerID:E}])}function _t(_,E,T){return m(_,[{fn:D,arg:T}])}function xe(_,E,T){return m(_,[{fn:ne,phase:_.ctx.phase,turn:_.ctx.turn,arg:{next:T}}])}function jo(_){return m(_,[{fn:ne,phase:_.ctx.phase,turn:_.ctx.turn}])}function Me(_,E,T){return m(_,[{fn:G,turn:_.ctx.turn,phase:_.ctx.phase,arg:T}])}function Ie(_,E,T){return m(_,[{fn:G,turn:_.ctx.turn,phase:_.ctx.phase,force:!0,arg:T}])}function Ne(_,E,T){return m(_,[{fn:se,turn:_.ctx.turn,phase:_.ctx.phase,arg:T}])}let C={endStage:kn,setStage:bt,endTurn:Me,pass:Ie,endPhase:jo,setPhase:xe,endGame:Ne,setActivePlayers:_t},W=[];s.endTurn!==!1&&W.push("endTurn"),s.pass!==!1&&W.push("pass"),s.endPhase!==!1&&W.push("endPhase"),s.setPhase!==!1&&W.push("setPhase"),s.endGame!==!1&&W.push("endGame"),s.setActivePlayers!==!1&&W.push("setActivePlayers"),s.endStage!==!1&&W.push("endStage"),s.setStage!==!1&&W.push("setStage");function wt(_,E){let{type:T,playerID:F,args:z}=E.payload;return typeof C[T]!="function"?_:C[T](_,F,...Array.isArray(z)?z:[z])}function fr(_,E,T){return E.activePlayers?T in E.activePlayers:E.currentPlayer===T}return{ctx:_=>({numPlayers:_,turn:0,currentPlayer:"0",playOrder:[...Array.from({length:_})].map((E,T)=>T+""),playOrderPos:0,phase:l,activePlayers:null}),init:_=>m(_,[{fn:b}]),isPlayerActive:fr,eventHandlers:C,eventNames:Object.keys(C),enabledEventNames:W,moveMap:u,moveNames:[...c.values()],processMove:Lt,processEvent:wt,getMove:ue}}function kC(e){return e.processMove!==void 0}function ji(e){if(kC(e))return e;if(e.name===void 0&&(e.name="default"),e.deltaState===void 0&&(e.deltaState=!1),e.disableUndo===void 0&&(e.disableUndo=!1),e.setup===void 0&&(e.setup=()=>({})),e.moves===void 0&&(e.moves={}),e.playerView===void 0&&(e.playerView=({G:n})=>n),e.plugins===void 0&&(e.plugins=[]),e.plugins.forEach(n=>{if(n.name===void 0)throw new Error("Plugin missing name attribute");if(n.name.includes(" "))throw new Error(n.name+": Plugin name must not include spaces")}),e.name.includes(" "))throw new Error(e.name+": Game name must not include spaces");let t=EC(e);return{...e,flow:t,moveNames:t.moveNames,pluginNames:e.plugins.map(n=>n.name),processMove:(n,r)=>{let i=t.getMove(n.ctx,r.type,r.playerID);if(AC(i)&&(i=i.move),i instanceof Function){let s=Lu(i,Re.MOVE,e.plugins),o=[];r.args!==void 0&&(o=Array.isArray(r.args)?r.args:[r.args]);let a={...Wt(n),G:n.G,ctx:n.ctx,playerID:r.playerID};return s(a,...o)}return Oe(`invalid move object: ${r.type}`),n.G}}}function AC(e){return e instanceof Object&&e.move!==void 0}var tc;(function(e){e.UnauthorizedAction="update/unauthorized_action",e.MatchNotFound="update/match_not_found",e.PatchFailed="update/patch_failed"})(tc||(tc={}));var Be;(function(e){e.StaleStateId="action/stale_state_id",e.UnavailableMove="action/unavailable_move",e.InvalidMove="action/invalid_move",e.InactivePlayer="action/inactive_player",e.GameOver="action/gameover",e.ActionDisabled="action/action_disabled",e.ActionInvalid="action/action_invalid",e.PluginActionInvalid="action/plugin_invalid"})(Be||(Be={}));var ro=e=>e.payload.playerID!==null&&e.payload.playerID!==void 0,xC=(e,t,n)=>{function r(s){return s.undoable!==void 0}function i(s){return s instanceof Function}return r(n)?i(n.undoable)?n.undoable({G:e,ctx:t}):n.undoable:!0};function ob(e,t){if(t.game.disableUndo)return e;let n={G:e.G,ctx:e.ctx,plugins:e.plugins,playerID:t.action.payload.playerID||e.ctx.currentPlayer};return t.action.type==="MAKE_MOVE"&&(n.moveType=t.action.payload.type),{...e,_undo:[...e._undo,n],_redo:[]}}function Zu(e,t,n){let r={action:t,_stateID:e._stateID,turn:e.ctx.turn,phase:e.ctx.phase},i=e.plugins.log.data.metadata;return i!==void 0&&(r.metadata=i),typeof n=="object"&&n.redact===!0?r.redact=!0:typeof n=="object"&&n.redact instanceof Function&&(r.redact=n.redact({G:e.G,ctx:e.ctx})),{...e,deltalog:[r]}}function ec(e,t,n){let[r,i]=eo(e,n);return i?[r,Fe(t,Be.PluginActionInvalid,i)]:[r]}function ub(e){if(!e)return[null,void 0];let{transients:t,...n}=e;return[n,t]}function Fe(e,t,n){return{...e,transients:{error:{type:t,payload:n}}}}var cb=e=>t=>n=>{let r=t(n);switch(n.type){case $n:return r;default:{let[,i]=ub(e.getState());return typeof i<"u"?(e.dispatch(ju()),{...r,transients:i}):r}}};function Xn({game:e,isClient:t}){return e=ji(e),(n=null,r)=>{let[i]=ub(n);switch(r.type){case $n:return i;case Yn:{if(i={...i,deltalog:[]},t)return i;if(i.ctx.gameover!==void 0)return Oe("cannot call event after game end"),Fe(i,Be.GameOver);if(ro(r)&&!e.flow.isPlayerActive(i.G,i.ctx,r.payload.playerID))return Oe(`disallowed event: ${r.payload.type}`),Fe(i,Be.InactivePlayer);i=Ti(i,{game:e,isClient:!1,playerID:r.payload.playerID});let s=e.flow.processEvent(i,r),o;return[s,o]=ec(s,i,{game:e,isClient:!1}),o||(s=ob(s,{game:e,action:r}),{...s,_stateID:i._stateID+1})}case _i:{let s=i={...i,deltalog:[]},o=e.flow.getMove(i.ctx,r.payload.type,r.payload.playerID||i.ctx.currentPlayer);if(o===null)return Oe(`disallowed move: ${r.payload.type}`),Fe(i,Be.UnavailableMove);if(t&&o.client===!1)return i;if(i.ctx.gameover!==void 0)return Oe("cannot make move after game end"),Fe(i,Be.GameOver);if(ro(r)&&!e.flow.isPlayerActive(i.G,i.ctx,r.payload.playerID))return Oe(`disallowed move: ${r.payload.type}`),Fe(i,Be.InactivePlayer);i=Ti(i,{game:e,isClient:t,playerID:r.payload.playerID});let a=e.processMove(i,r.payload);if(a===Zs)return Oe(`invalid move: ${r.payload.type} args: ${r.payload.args}`),Fe(i,Be.InvalidMove);let u={...i,G:a};if(t&&Cv(u,{game:e}))return i;if(i=u,t){let l;return[i,l]=ec(i,s,{game:e,isClient:!0}),l||{...i,_stateID:i._stateID+1}}i=Zu(i,r,o),i=e.flow.processMove(i,r.payload);let c;return[i,c]=ec(i,s,{game:e}),c||(i=ob(i,{game:e,action:r}),{...i,_stateID:i._stateID+1})}case Oi:case ki:case Pi:return r.state;case Ei:{if(i={...i,deltalog:[]},e.disableUndo)return Oe("Undo is not enabled"),Fe(i,Be.ActionDisabled);let{G:s,ctx:o,_undo:a,_redo:u,_stateID:c}=i;if(a.length<2)return Oe("No moves to undo"),Fe(i,Be.ActionInvalid);let l=a[a.length-1],f=a[a.length-2];if(ro(r)&&r.payload.playerID!==l.playerID)return Oe("Cannot undo other players' moves"),Fe(i,Be.ActionInvalid);if(l.moveType){let p=e.flow.getMove(f.ctx,l.moveType,l.playerID);if(!xC(s,o,p))return Oe("Move cannot be undone"),Fe(i,Be.ActionInvalid)}return i=Zu(i,r),{...i,G:f.G,ctx:f.ctx,plugins:f.plugins,_stateID:c+1,_undo:a.slice(0,-1),_redo:[l,...u]}}case wi:{if(i={...i,deltalog:[]},e.disableUndo)return Oe("Redo is not enabled"),Fe(i,Be.ActionDisabled);let{_undo:s,_redo:o,_stateID:a}=i;if(o.length===0)return Oe("No moves to redo"),Fe(i,Be.ActionInvalid);let u=o[0];return ro(r)&&r.payload.playerID!==u.playerID?(Oe("Cannot redo other players' moves"),Fe(i,Be.ActionInvalid)):(i=Zu(i,r),{...i,G:u.G,ctx:u.ctx,plugins:u.plugins,_stateID:a+1,_undo:[...s,u],_redo:o.slice(1)})}case Su:return Iv(i,r,{game:e});case Ai:{let s=i,o=JSON.parse(JSON.stringify(s)),a=(0,ab.applyPatch)(o,r.patch);return a.some(c=>c!==null)?(Oe(`Patch ${JSON.stringify(r.patch)} apply failed`),Fe(s,tc.PatchFailed,a)):o}default:return i}}}var nL=he(io());var so=class{constructor({enumerate:t,seed:n}){this.enumerateFn=t,this.seed=n,this.iterationCounter=0,this._opts={}}addOpt({key:t,range:n,initial:r}){this._opts[t]={range:n,value:r}}getOpt(t){return this._opts[t].value}setOpt(t,n){t in this._opts&&(this._opts[t].value=n)}opts(){return this._opts}enumerate(t,n,r){return this.enumerateFn(t,n,r).map(s=>{if("payload"in s)return s;if("move"in s)return Tu(s.move,s.args,r);if("event"in s)return vn(s.event,s.args,r)})}random(t){let n;if(this.seed!==void 0){let r=this.prngstate?"":this.seed,i=ku(r,this.prngstate);n=i(),this.prngstate=i.state()}else n=Math.random();if(t)if(Array.isArray(t)){let r=Math.floor(n*t.length);return t[r]}else return Math.floor(n*t);return n}},SC=25,Di=class extends so{constructor({enumerate:t,seed:n,objectives:r,game:i,iterations:s,playoutDepth:o,iterationCallback:a}){super({enumerate:t,seed:n}),r===void 0&&(r=()=>({})),this.objectives=r,this.iterationCallback=a||(()=>{}),this.reducer=Xn({game:i}),this.iterations=s,this.playoutDepth=o,this.addOpt({key:"async",initial:!1}),this.addOpt({key:"iterations",initial:typeof s=="number"?s:1e3,range:{min:1,max:2e3}}),this.addOpt({key:"playoutDepth",initial:typeof o=="number"?o:50,range:{min:1,max:100}})}createNode({state:t,parentAction:n,parent:r,playerID:i}){let{G:s,ctx:o}=t,a=[],u=[];if(i!==void 0)a=this.enumerate(s,o,i),u=this.objectives(s,o,i);else if(o.activePlayers)for(let c in o.activePlayers)a.push(...this.enumerate(s,o,c)),u.push(this.objectives(s,o,c));else a=this.enumerate(s,o,o.currentPlayer),u=this.objectives(s,o,o.currentPlayer);return{state:t,parent:r,parentAction:n,actions:a,objectives:u,children:[],visits:0,value:0}}select(t){if(t.actions.length>0||t.children.length===0)return t;let n=null,r=0;for(let i of t.children){let s=i.visits+Number.EPSILON,o=i.value/s+Math.sqrt(2*Math.log(t.visits)/s);(n==null||o>r)&&(r=o,n=i)}return this.select(n)}expand(t){let n=t.actions;if(n.length===0||t.state.ctx.gameover!==void 0)return t;let r=this.random(n.length),i=n[r];t.actions.splice(r,1);let s=this.reducer(t.state,i),o=this.createNode({state:s,parentAction:i,parent:t});return t.children.push(o),o}playout({state:t}){let n=this.getOpt("playoutDepth");typeof this.playoutDepth=="function"&&(n=this.playoutDepth(t.G,t.ctx));for(let r=0;r<n&&t.ctx.gameover===void 0;r++){let{G:i,ctx:s}=t,o=s.currentPlayer;s.activePlayers&&(o=Object.keys(s.activePlayers)[0]);let a=this.enumerate(i,s,o),u=this.objectives(i,s,o),c=Object.keys(u).reduce((p,h)=>{let d=u[h];return d.checker(i,s)?p+d.weight:p},0);if(c>0)return{score:c};if(!a||a.length===0)return;let l=this.random(a.length);t=this.reducer(t,a[l])}return t.ctx.gameover}backpropagate(t,n={}){t.visits++,n.score!==void 0&&(t.value+=n.score),n.draw===!0&&(t.value+=.5),t.parentAction&&n.winner===t.parentAction.payload.playerID&&t.value++,t.parent&&this.backpropagate(t.parent,n)}play(t,n){let r=this.createNode({state:t,playerID:n}),i=this.getOpt("iterations");typeof this.iterations=="function"&&(i=this.iterations(t.G,t.ctx));let s=()=>{let o=null;for(let c of r.children)(o==null||c.visits>o.visits)&&(o=c);return{action:o&&o.parentAction,metadata:r}};return new Promise(o=>{let a=()=>{for(let u=0;u<SC&&this.iterationCounter<i;u++){let c=this.select(r),l=this.expand(c),f=this.playout(l);this.backpropagate(l,f),this.iterationCounter++}this.iterationCallback({iterationCounter:this.iterationCounter,numIterations:i,metadata:r})};if(this.iterationCounter=0,this.getOpt("async")){let u=()=>{this.iterationCounter<i?(a(),setImmediate(u)):o(s())};u()}else{for(;this.iterationCounter<i;)a();o(s())}})}},oo=class extends so{play({G:t,ctx:n},r){let i=this.enumerate(t,n,r);return Promise.resolve({action:this.random(i)})}};async function nc(e,t){let n=e.store.getState(),r=n.ctx.currentPlayer;n.ctx.activePlayers&&(r=Object.keys(n.ctx.activePlayers)[0]);let{action:i,metadata:s}=await t.play(n,r);if(i){let o={...i,payload:{...i.payload,metadata:s}};return e.store.dispatch(o),o}}function U(){}var Sc=e=>e;function jt(e,t){for(let n in t)e[n]=t[n];return e}function m1(e){return e()}function fb(){return Object.create(null)}function Le(e){e.forEach(m1)}function Yt(e){return typeof e=="function"}function ee(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function TC(e){return Object.keys(e).length===0}function Hi(e,...t){if(e==null)return U;let n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function g1(e,t,n){e.$$.on_destroy.push(Hi(t,n))}function MC(e,t,n,r){if(e){let i=y1(e,t,n,r);return e[0](i)}}function y1(e,t,n,r){return e[1]&&r?jt(n.ctx.slice(),e[1](r(t))):n.ctx}function IC(e,t,n,r){if(e[2]&&r){let i=e[2](r(n));if(t.dirty===void 0)return i;if(typeof i=="object"){let s=[],o=Math.max(t.dirty.length,i.length);for(let a=0;a<o;a+=1)s[a]=t.dirty[a]|i[a];return s}return t.dirty|i}return t.dirty}function NC(e,t,n,r,i,s){if(i){let o=y1(t,n,r,s);e.p(o,i)}}function CC(e){if(e.ctx.length>32){let t=[],n=e.ctx.length/32;for(let r=0;r<n;r++)t[r]=-1;return t}return-1}function lo(e){let t={};for(let n in e)n[0]!=="$"&&(t[n]=e[n]);return t}function pb(e){return e??""}var v1=typeof window<"u",Tc=v1?()=>window.performance.now():()=>Date.now(),Mc=v1?e=>requestAnimationFrame(e):U,Zn=new Set;function b1(e){Zn.forEach(t=>{t.c(e)||(Zn.delete(t),t.f())}),Zn.size!==0&&Mc(b1)}function Ic(e){let t;return Zn.size===0&&Mc(b1),{promise:new Promise(n=>{Zn.add(t={c:e,f:n})}),abort(){Zn.delete(t)}}}function w(e,t){e.appendChild(t)}function de(e,t,n){let r=Nc(e);if(!r.getElementById(t)){let i=A("style");i.id=t,i.textContent=n,_1(r,i)}}function Nc(e){if(!e)return document;let t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function qC(e){let t=A("style");return _1(Nc(e),t),t.sheet}function _1(e,t){w(e.head||e,t)}function M(e,t,n){e.insertBefore(t,n||null)}function S(e){e.parentNode.removeChild(e)}function $e(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function A(e){return document.createElement(e)}function Po(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Y(e){return document.createTextNode(e)}function q(){return Y(" ")}function at(){return Y("")}function Q(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function jC(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function k(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function DC(e){return e===""?null:+e}function RC(e){return Array.from(e.childNodes)}function ae(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function hb(e,t){e.value=t??""}function fo(e,t){for(let n=0;n<e.options.length;n+=1){let r=e.options[n];if(r.__value===t){r.selected=!0;return}}e.selectedIndex=-1}function w1(e){let t=e.querySelector(":checked")||e.options[0];return t&&t.__value}function ie(e,t,n){e.classList[n?"add":"remove"](t)}function O1(e,t,{bubbles:n=!1,cancelable:r=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(e,n,r,t),i}var po=new Map,ho=0;function BC(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}function LC(e,t){let n={stylesheet:qC(t),rules:{}};return po.set(e,n),n}function mo(e,t,n,r,i,s,o,a=0){let u=16.666/r,c=`{
|
|
1
|
+
"use strict";var BoardGameEngine=(()=>{var m1=Object.create;var os=Object.defineProperty;var g1=Object.getOwnPropertyDescriptor;var y1=Object.getOwnPropertyNames;var v1=Object.getPrototypeOf,b1=Object.prototype.hasOwnProperty;var v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ll=(e,t)=>{for(var n in t)os(e,n,{get:t[n],enumerable:!0})},fl=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of y1(t))!b1.call(e,i)&&i!==n&&os(e,i,{get:()=>t[i],enumerable:!(r=g1(t,i))||r.enumerable});return e};var he=(e,t,n)=>(n=e!=null?m1(v1(e)):{},fl(t||!e||!e.__esModule?os(n,"default",{value:e,enumerable:!0}):n,e)),w1=e=>fl(os({},"__esModule",{value:!0}),e);var Al=v(Ee=>{function je(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map(function(i){return"'"+i+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function pt(e){return!!e&&!!e[$]}function rt(e){var t;return!!e&&(function(n){if(!n||typeof n!="object")return!1;var r=Object.getPrototypeOf(n);if(r===null)return!0;var i=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return i===Object||typeof i=="function"&&Function.toString.call(i)===O1}(e)||Array.isArray(e)||!!e[An]||!!(!((t=e.constructor)===null||t===void 0)&&t[An])||ps(e)||ds(e))}function Pt(e,t,n){n===void 0&&(n=!1),zt(e)===0?(n?Object.keys:xn)(e).forEach(function(r){n&&typeof r=="symbol"||t(r,e[r],e)}):e.forEach(function(r,i){return t(i,r,e)})}function zt(e){var t=e[$];return t?t.t>3?t.t-4:t.t:Array.isArray(e)?1:ps(e)?2:ds(e)?3:0}function Vt(e,t){return zt(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function us(e,t){return zt(e)===2?e.get(t):e[t]}function kl(e,t,n){var r=zt(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Pl(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function ps(e){return P1&&e instanceof Map}function ds(e){return E1&&e instanceof Set}function Ne(e){return e.i||e.u}function Ko(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Ol(e);delete t[$];for(var n=xn(t),r=0;r<n.length;r++){var i=n[r],s=t[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(t[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function hs(e,t){return t===void 0&&(t=!1),Ho(e)||pt(e)||!rt(e)||(zt(e)>1&&(e.set=e.add=e.clear=e.delete=_1),Object.freeze(e),t&&Pt(e,function(n,r){return hs(r,!0)},!0)),e}function _1(){je(2)}function Ho(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function ft(e){var t=zo[e];return t||je(18,e),t}function Wo(e,t){zo[e]||(zo[e]=t)}function gr(){return vr}function Go(e,t){t&&(ft("Patches"),e.o=[],e.v=[],e.s=t)}function cs(e){Vo(e),e.p.forEach(k1),e.p=null}function Vo(e){e===vr&&(vr=e.l)}function pl(e){return vr={p:[],l:vr,h:e,_:!0,m:0}}function k1(e){var t=e[$];t.t===0||t.t===1?t.j():t.O=!0}function Lo(e,t){t.m=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.S||ft("ES5").P(t,e,r),r?(n[$].g&&(cs(t),je(4)),rt(e)&&(e=ls(t,e),t.l||fs(t,e)),t.o&&ft("Patches").M(n[$].u,e,t.o,t.v)):e=ls(t,n,[]),cs(t),t.o&&t.s(t.o,t.v),e!==ms?e:void 0}function ls(e,t,n){if(Ho(t))return t;var r=t[$];if(!r)return Pt(t,function(a,u){return dl(e,r,t,a,u,n)},!0),t;if(r.A!==e)return t;if(!r.g)return fs(e,r.u,!0),r.u;if(!r.R){r.R=!0,r.A.m--;var i=r.t===4||r.t===5?r.i=Ko(r.k):r.i,s=i,o=!1;r.t===3&&(s=new Set(i),i.clear(),o=!0),Pt(s,function(a,u){return dl(e,r,i,a,u,n,o)}),fs(e,i,!1),n&&e.o&&ft("Patches").F(r,n,e.o,e.v)}return r.i}function dl(e,t,n,r,i,s,o){if(pt(i)){var a=ls(e,i,s&&t&&t.t!==3&&!Vt(t.N,r)?s.concat(r):void 0);if(kl(n,r,a),!pt(a))return;e._=!1}else o&&n.add(i);if(rt(i)&&!Ho(i)){if(!e.h.D&&e.m<1)return;ls(e,i),t&&t.A.l||fs(e,i)}}function fs(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e._&&hs(t,n)}function Fo(e,t){var n=e[$];return(n?Ne(n):e)[t]}function hl(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function Ve(e){e.g||(e.g=!0,e.l&&Ve(e.l))}function Uo(e){e.i||(e.i=Ko(e.u))}function yr(e,t,n){var r=ps(t)?ft("MapSet").K(t,n):ds(t)?ft("MapSet").$(t,n):e.S?function(i,s){var o=Array.isArray(i),a={t:o?1:0,A:s?s.A:gr(),g:!1,R:!1,N:{},l:s,u:i,k:null,i:null,j:null,C:!1},u=a,c=br;o&&(u=[a],c=mr);var l=Proxy.revocable(u,c),f=l.revoke,p=l.proxy;return a.k=p,a.j=f,p}(t,n):ft("ES5").I(t,n);return(n?n.A:gr()).p.push(r),r}function El(e){return pt(e)||je(22,e),function t(n){if(!rt(n))return n;var r,i=n[$],s=zt(n);if(i){if(!i.g&&(i.t<4||!ft("ES5").J(i)))return i.u;i.R=!0,r=ml(n,s),i.R=!1}else r=ml(n,s);return Pt(r,function(o,a){i&&us(i.u,o)===a||kl(r,o,t(a))}),s===3?new Set(r):r}(e)}function ml(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return Ko(e)}function gl(){function e(s,o){var a=i[s];return a?a.enumerable=o:i[s]=a={configurable:!0,enumerable:o,get:function(){return br.get(this[$],s)},set:function(u){br.set(this[$],s,u)}},a}function t(s){for(var o=s.length-1;o>=0;o--){var a=s[o][$];if(!a.g)switch(a.t){case 5:r(a)&&Ve(a);break;case 4:n(a)&&Ve(a)}}}function n(s){for(var o=s.u,a=s.k,u=xn(a),c=u.length-1;c>=0;c--){var l=u[c];if(l!==$){var f=o[l];if(f===void 0&&!Vt(o,l))return!0;var p=a[l],d=p&&p[$];if(d?d.u!==f:!Pl(p,f))return!0}}var h=!!o[$];return u.length!==xn(o).length+(h?0:1)}function r(s){var o=s.k;if(o.length!==s.u.length)return!0;var a=Object.getOwnPropertyDescriptor(o,o.length-1);if(a&&!a.get)return!0;for(var u=0;u<o.length;u++)if(!o.hasOwnProperty(u))return!0;return!1}var i={};Wo("ES5",{I:function(s,o){var a=Array.isArray(s),u=function(l,f){if(l){for(var p=Array(f.length),d=0;d<f.length;d++)Object.defineProperty(p,""+d,e(d,!0));return p}var h=Ol(f);delete h[$];for(var y=xn(h),m=0;m<y.length;m++){var b=y[m];h[b]=e(b,l||!!h[b].enumerable)}return Object.create(Object.getPrototypeOf(f),h)}(a,s),c={t:a?5:4,A:o?o.A:gr(),g:!1,R:!1,N:{},l:o,u:s,k:u,i:null,O:!1,C:!1};return Object.defineProperty(u,$,{value:c,writable:!0}),u},P:function(s,o,a){a?pt(o)&&o[$].A===s&&t(s.p):(s.o&&function u(c){if(c&&typeof c=="object"){var l=c[$];if(l){var f=l.u,p=l.k,d=l.N,h=l.t;if(h===4)Pt(p,function(k){k!==$&&(f[k]!==void 0||Vt(f,k)?d[k]||u(p[k]):(d[k]=!0,Ve(l)))}),Pt(f,function(k){p[k]!==void 0||Vt(p,k)||(d[k]=!1,Ve(l))});else if(h===5){if(r(l)&&(Ve(l),d.length=!0),p.length<f.length)for(var y=p.length;y<f.length;y++)d[y]=!1;else for(var m=f.length;m<p.length;m++)d[m]=!0;for(var b=Math.min(p.length,f.length),g=0;g<b;g++)p.hasOwnProperty(g)||(d[g]=!0),d[g]===void 0&&u(p[g])}}}}(s.p[0]),t(s.p))},J:function(s){return s.t===4?n(s):r(s)}})}function yl(){function e(r){if(!rt(r))return r;if(Array.isArray(r))return r.map(e);if(ps(r))return new Map(Array.from(r.entries()).map(function(o){return[o[0],e(o[1])]}));if(ds(r))return new Set(Array.from(r).map(e));var i=Object.create(Object.getPrototypeOf(r));for(var s in r)i[s]=e(r[s]);return Vt(r,An)&&(i[An]=r[An]),i}function t(r){return pt(r)?e(r):r}var n="add";Wo("Patches",{W:function(r,i){return i.forEach(function(s){for(var o=s.path,a=s.op,u=r,c=0;c<o.length-1;c++){var l=zt(u),f=o[c];typeof f!="string"&&typeof f!="number"&&(f=""+f),l!==0&&l!==1||f!=="__proto__"&&f!=="constructor"||je(24),typeof u=="function"&&f==="prototype"&&je(24),typeof(u=us(u,f))!="object"&&je(15,o.join("/"))}var p=zt(u),d=e(s.value),h=o[o.length-1];switch(a){case"replace":switch(p){case 2:return u.set(h,d);case 3:je(16);default:return u[h]=d}case n:switch(p){case 1:return h==="-"?u.push(d):u.splice(h,0,d);case 2:return u.set(h,d);case 3:return u.add(d);default:return u[h]=d}case"remove":switch(p){case 1:return u.splice(h,1);case 2:return u.delete(h);case 3:return u.delete(s.value);default:return delete u[h]}default:je(17,a)}}),r},F:function(r,i,s,o){switch(r.t){case 0:case 4:case 2:return function(a,u,c,l){var f=a.u,p=a.i;Pt(a.N,function(d,h){var y=us(f,d),m=us(p,d),b=h?Vt(f,d)?"replace":n:"remove";if(y!==m||b!=="replace"){var g=u.concat(d);c.push(b==="remove"?{op:b,path:g}:{op:b,path:g,value:m}),l.push(b===n?{op:"remove",path:g}:b==="remove"?{op:n,path:g,value:t(y)}:{op:"replace",path:g,value:t(y)})}})}(r,i,s,o);case 5:case 1:return function(a,u,c,l){var f=a.u,p=a.N,d=a.i;if(d.length<f.length){var h=[d,f];f=h[0],d=h[1];var y=[l,c];c=y[0],l=y[1]}for(var m=0;m<f.length;m++)if(p[m]&&d[m]!==f[m]){var b=u.concat([m]);c.push({op:"replace",path:b,value:t(d[m])}),l.push({op:"replace",path:b,value:t(f[m])})}for(var g=f.length;g<d.length;g++){var k=u.concat([g]);c.push({op:n,path:k,value:t(d[g])})}f.length<d.length&&l.push({op:"replace",path:u.concat(["length"]),value:f.length})}(r,i,s,o);case 3:return function(a,u,c,l){var f=a.u,p=a.i,d=0;f.forEach(function(h){if(!p.has(h)){var y=u.concat([d]);c.push({op:"remove",path:y,value:h}),l.unshift({op:n,path:y,value:h})}d++}),d=0,p.forEach(function(h){if(!f.has(h)){var y=u.concat([d]);c.push({op:n,path:y,value:h}),l.unshift({op:"remove",path:y,value:h})}d++})}(r,i,s,o)}},M:function(r,i,s,o){s.push({op:"replace",path:[],value:i===ms?void 0:i}),o.push({op:"replace",path:[],value:r})}})}function vl(){function e(a,u){function c(){this.constructor=a}i(a,u),a.prototype=(c.prototype=u.prototype,new c)}function t(a){a.i||(a.N=new Map,a.i=new Map(a.u))}function n(a){a.i||(a.i=new Set,a.u.forEach(function(u){if(rt(u)){var c=yr(a.A.h,u,a);a.p.set(u,c),a.i.add(c)}else a.i.add(u)}))}function r(a){a.O&&je(3,JSON.stringify(Ne(a)))}var i=function(a,u){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,l){c.__proto__=l}||function(c,l){for(var f in l)l.hasOwnProperty(f)&&(c[f]=l[f])})(a,u)},s=function(){function a(c,l){return this[$]={t:2,l,A:l?l.A:gr(),g:!1,R:!1,i:void 0,N:void 0,u:c,k:this,C:!1,O:!1},this}e(a,Map);var u=a.prototype;return Object.defineProperty(u,"size",{get:function(){return Ne(this[$]).size}}),u.has=function(c){return Ne(this[$]).has(c)},u.set=function(c,l){var f=this[$];return r(f),Ne(f).has(c)&&Ne(f).get(c)===l||(t(f),Ve(f),f.N.set(c,!0),f.i.set(c,l),f.N.set(c,!0)),this},u.delete=function(c){if(!this.has(c))return!1;var l=this[$];return r(l),t(l),Ve(l),l.u.has(c)?l.N.set(c,!1):l.N.delete(c),l.i.delete(c),!0},u.clear=function(){var c=this[$];r(c),Ne(c).size&&(t(c),Ve(c),c.N=new Map,Pt(c.u,function(l){c.N.set(l,!1)}),c.i.clear())},u.forEach=function(c,l){var f=this;Ne(this[$]).forEach(function(p,d){c.call(l,f.get(d),d,f)})},u.get=function(c){var l=this[$];r(l);var f=Ne(l).get(c);if(l.R||!rt(f)||f!==l.u.get(c))return f;var p=yr(l.A.h,f,l);return t(l),l.i.set(c,p),p},u.keys=function(){return Ne(this[$]).keys()},u.values=function(){var c,l=this,f=this.keys();return(c={})[as]=function(){return l.values()},c.next=function(){var p=f.next();return p.done?p:{done:!1,value:l.get(p.value)}},c},u.entries=function(){var c,l=this,f=this.keys();return(c={})[as]=function(){return l.entries()},c.next=function(){var p=f.next();if(p.done)return p;var d=l.get(p.value);return{done:!1,value:[p.value,d]}},c},u[as]=function(){return this.entries()},a}(),o=function(){function a(c,l){return this[$]={t:3,l,A:l?l.A:gr(),g:!1,R:!1,i:void 0,u:c,k:this,p:new Map,O:!1,C:!1},this}e(a,Set);var u=a.prototype;return Object.defineProperty(u,"size",{get:function(){return Ne(this[$]).size}}),u.has=function(c){var l=this[$];return r(l),l.i?!!l.i.has(c)||!(!l.p.has(c)||!l.i.has(l.p.get(c))):l.u.has(c)},u.add=function(c){var l=this[$];return r(l),this.has(c)||(n(l),Ve(l),l.i.add(c)),this},u.delete=function(c){if(!this.has(c))return!1;var l=this[$];return r(l),n(l),Ve(l),l.i.delete(c)||!!l.p.has(c)&&l.i.delete(l.p.get(c))},u.clear=function(){var c=this[$];r(c),Ne(c).size&&(n(c),Ve(c),c.i.clear())},u.values=function(){var c=this[$];return r(c),n(c),c.i.values()},u.entries=function(){var c=this[$];return r(c),n(c),c.i.entries()},u.keys=function(){return this.values()},u[as]=function(){return this.values()},u.forEach=function(c,l){for(var f=this.values(),p=f.next();!p.done;)c.call(l,p.value,p.value,this),p=f.next()},a}();Wo("MapSet",{K:function(a,u){return new s(a,u)},$:function(a,u){return new o(a,u)}})}var bl;Object.defineProperty(Ee,"__esModule",{value:!0});var vr,Jo=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",P1=typeof Map<"u",E1=typeof Set<"u",wl=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",ms=Jo?Symbol.for("immer-nothing"):((bl={})["immer-nothing"]=!0,bl),An=Jo?Symbol.for("immer-draftable"):"__$immer_draftable",$=Jo?Symbol.for("immer-state"):"__$immer_state",as=typeof Symbol<"u"&&Symbol.iterator||"@@iterator",O1=""+Object.prototype.constructor,xn=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Ol=Object.getOwnPropertyDescriptors||function(e){var t={};return xn(e).forEach(function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)}),t},zo={},br={get:function(e,t){if(t===$)return e;var n=Ne(e);if(!Vt(n,t))return function(i,s,o){var a,u=hl(s,o);return u?"value"in u?u.value:(a=u.get)===null||a===void 0?void 0:a.call(i.k):void 0}(e,n,t);var r=n[t];return e.R||!rt(r)?r:r===Fo(e.u,t)?(Uo(e),e.i[t]=yr(e.A.h,r,e)):r},has:function(e,t){return t in Ne(e)},ownKeys:function(e){return Reflect.ownKeys(Ne(e))},set:function(e,t,n){var r=hl(Ne(e),t);if(r?.set)return r.set.call(e.k,n),!0;if(!e.g){var i=Fo(Ne(e),t),s=i?.[$];if(s&&s.u===n)return e.i[t]=n,e.N[t]=!1,!0;if(Pl(n,i)&&(n!==void 0||Vt(e.u,t)))return!0;Uo(e),Ve(e)}return e.i[t]===n&&(n!==void 0||t in e.i)||Number.isNaN(n)&&Number.isNaN(e.i[t])||(e.i[t]=n,e.N[t]=!0),!0},deleteProperty:function(e,t){return Fo(e.u,t)!==void 0||t in e.u?(e.N[t]=!1,Uo(e),Ve(e)):delete e.N[t],e.i&&delete e.i[t],!0},getOwnPropertyDescriptor:function(e,t){var n=Ne(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.t!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty:function(){je(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.u)},setPrototypeOf:function(){je(12)}},mr={};Pt(br,function(e,t){mr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),mr.deleteProperty=function(e,t){return mr.set.call(this,e,t,void 0)},mr.set=function(e,t,n){return br.set.call(this,e[0],t,n,e[0])};var Sl=function(){function e(n){var r=this;this.S=wl,this.D=!0,this.produce=function(i,s,o){if(typeof i=="function"&&typeof s!="function"){var a=s;s=i;var u=r;return function(y){var m=this;y===void 0&&(y=a);for(var b=arguments.length,g=Array(b>1?b-1:0),k=1;k<b;k++)g[k-1]=arguments[k];return u.produce(y,function(I){var j;return(j=s).call.apply(j,[m,I].concat(g))})}}var c;if(typeof s!="function"&&je(6),o!==void 0&&typeof o!="function"&&je(7),rt(i)){var l=pl(r),f=yr(r,i,void 0),p=!0;try{c=s(f),p=!1}finally{p?cs(l):Vo(l)}return typeof Promise<"u"&&c instanceof Promise?c.then(function(y){return Go(l,o),Lo(y,l)},function(y){throw cs(l),y}):(Go(l,o),Lo(c,l))}if(!i||typeof i!="object"){if((c=s(i))===void 0&&(c=i),c===ms&&(c=void 0),r.D&&hs(c,!0),o){var d=[],h=[];ft("Patches").M(i,c,d,h),o(d,h)}return c}je(21,i)},this.produceWithPatches=function(i,s){if(typeof i=="function")return function(c){for(var l=arguments.length,f=Array(l>1?l-1:0),p=1;p<l;p++)f[p-1]=arguments[p];return r.produceWithPatches(c,function(d){return i.apply(void 0,[d].concat(f))})};var o,a,u=r.produce(i,s,function(c,l){o=c,a=l});return typeof Promise<"u"&&u instanceof Promise?u.then(function(c){return[c,o,a]}):[u,o,a]},typeof n?.useProxies=="boolean"&&this.setUseProxies(n.useProxies),typeof n?.autoFreeze=="boolean"&&this.setAutoFreeze(n.autoFreeze)}var t=e.prototype;return t.createDraft=function(n){rt(n)||je(8),pt(n)&&(n=El(n));var r=pl(this),i=yr(this,n,void 0);return i[$].C=!0,Vo(r),i},t.finishDraft=function(n,r){var i=(n&&n[$]).A;return Go(i,r),Lo(void 0,i)},t.setAutoFreeze=function(n){this.D=n},t.setUseProxies=function(n){n&&!wl&&je(20),this.S=n},t.applyPatches=function(n,r){var i;for(i=r.length-1;i>=0;i--){var s=r[i];if(s.path.length===0&&s.op==="replace"){n=s.value;break}}i>-1&&(r=r.slice(i+1));var o=ft("Patches").W;return pt(n)?o(n,r):this.produce(n,function(a){return o(a,r)})},e}(),We=new Sl,_l=We.produce,S1=We.produceWithPatches.bind(We),A1=We.setAutoFreeze.bind(We),x1=We.setUseProxies.bind(We),T1=We.applyPatches.bind(We),M1=We.createDraft.bind(We),I1=We.finishDraft.bind(We);Ee.Immer=Sl,Ee.applyPatches=T1,Ee.castDraft=function(e){return e},Ee.castImmutable=function(e){return e},Ee.createDraft=M1,Ee.current=El,Ee.default=_l,Ee.enableAllPlugins=function(){gl(),vl(),yl()},Ee.enableES5=gl,Ee.enableMapSet=vl,Ee.enablePatches=yl,Ee.finishDraft=I1,Ee.freeze=hs,Ee.immerable=An,Ee.isDraft=pt,Ee.isDraftable=rt,Ee.nothing=ms,Ee.original=function(e){return pt(e)||je(23,e),e[$].u},Ee.produce=_l,Ee.produceWithPatches=S1,Ee.setAutoFreeze=A1,Ee.setUseProxies=x1});var Yo=v((Wq,xl)=>{"use strict";xl.exports=Al()});var Qo=v(Xo=>{"use strict";var $o=class{constructor(t){let n=C1();this.c=1,this.s0=n(" "),this.s1=n(" "),this.s2=n(" "),this.s0-=n(t),this.s0<0&&(this.s0+=1),this.s1-=n(t),this.s1<0&&(this.s1+=1),this.s2-=n(t),this.s2<0&&(this.s2+=1)}next(){let t=2091639*this.s0+this.c*23283064365386963e-26;return this.s0=this.s1,this.s1=this.s2,this.s2=t-(this.c=Math.trunc(t))}};function C1(){let e=4022871197;return function(n){let r=n.toString();for(let i=0;i<r.length;i++){e+=r.charCodeAt(i);let s=.02519603282416938*e;e=s>>>0,s-=e,s*=e,e=s>>>0,s-=e,e+=s*4294967296}return(e>>>0)*23283064365386963e-26}}function Tl(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function Ml(e,t){let n=new $o(e),r=n.next.bind(n);return t&&Tl(t,n),r.state=()=>Tl(n,{}),r}var gs=class{constructor(t){this.state=t||{seed:"0"},this.used=!1}static seed(){return Date.now().toString(36).slice(-10)}isUsed(){return this.used}getState(){return this.state}_random(){this.used=!0;let t=this.state,n=t.prngstate?"":t.seed,r=Ml(n,t.prngstate),i=r();return this.state={...t,prngstate:r.state()},i}api(){let t=this._random.bind(this),n={D4:4,D6:6,D8:8,D10:10,D12:12,D20:20},r={};for(let s in n){let o=n[s];r[s]=a=>a===void 0?Math.floor(t()*o)+1:Array.from({length:a}).map(()=>Math.floor(t()*o)+1)}function i(s=6,o){return o===void 0?Math.floor(t()*s)+1:Array.from({length:o}).map(()=>Math.floor(t()*s)+1)}return{...r,Die:i,Number:()=>t(),Shuffle:s=>{let o=[...s],a=s.length,u=0,c=Array.from({length:a});for(;a;){let l=Math.trunc(a*t());c[u++]=o[l],o[l]=o[--a]}return c},_private:this}}},R1={name:"random",noClient:({api:e})=>e._private.isUsed(),flush:({api:e})=>e._private.getState(),api:({data:e})=>new gs(e).api(),setup:({game:e})=>{let{seed:t}=e;return t===void 0&&(t=gs.seed()),{seed:t}},playerView:()=>{}};Xo.RandomPlugin=R1;Xo.alea=Ml});var nn=v((Yq,Rl)=>{var N1="[object Object]";function j1(e){var t=!1;if(e!=null&&typeof e.toString!="function")try{t=!!(e+"")}catch{}return t}function q1(e,t){return function(n){return e(t(n))}}var D1=Function.prototype,Il=Object.prototype,Cl=D1.toString,B1=Il.hasOwnProperty,G1=Cl.call(Object),L1=Il.toString,F1=q1(Object.getPrototypeOf,Object);function U1(e){return!!e&&typeof e=="object"}function V1(e){if(!U1(e)||L1.call(e)!=N1||j1(e))return!1;var t=F1(e);if(t===null)return!0;var n=B1.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Cl.call(n)==G1}Rl.exports=V1});var Zl=v(K=>{"use strict";var z1=Yo(),K1=Qo(),$q=nn();function H1(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var W1=H1(z1),Nl="MAKE_MOVE",na="GAME_EVENT",jl="REDO",ql="RESET",Dl="SYNC",Bl="UNDO",Gl="UPDATE",Ll="PATCH",Fl="PLUGIN",Ul="STRIP_TRANSIENTS",Vl=(e,t,n,r)=>({type:Nl,payload:{type:e,args:t,playerID:n,credentials:r}}),zl=(e,t,n,r)=>({type:na,payload:{type:e,args:t,playerID:n,credentials:r}}),Kl=(e,t,n,r)=>({type:na,payload:{type:e,args:t,playerID:n,credentials:r},automatic:!0}),Hl=e=>({type:Dl,state:e.state,log:e.log,initialState:e.initialState,clientOnly:!0}),Wl=(e,t,n,r)=>({type:Ll,prevStateID:e,stateID:t,patch:n,deltalog:r,clientOnly:!0}),Jl=(e,t)=>({type:Gl,state:e,deltalog:t,clientOnly:!0}),Yl=e=>({type:ql,state:e,clientOnly:!0}),$l=(e,t)=>({type:Bl,payload:{type:null,args:null,playerID:e,credentials:t}}),Xl=(e,t)=>({type:jl,payload:{type:null,args:null,playerID:e,credentials:t}}),J1=(e,t,n,r)=>({type:Fl,payload:{type:e,args:t,playerID:n,credentials:r}}),Ql=()=>({type:Ul}),Y1=Object.freeze({__proto__:null,makeMove:Vl,gameEvent:zl,automaticGameEvent:Kl,sync:Hl,patch:Wl,update:Jl,reset:Yl,undo:$l,redo:Xl,plugin:J1,stripTransients:Ql}),Zo="INVALID_MOVE",$1={name:"plugin-immer",fnWrap:e=>(t,...n)=>{let r=!1,i=W1.default(t.G,s=>{let o=e({...t,G:s},...n);if(o===Zo){r=!0;return}return o});return r?Zo:i}};K.GameMethod=void 0;(function(e){e.MOVE="MOVE",e.GAME_ON_END="GAME_ON_END",e.PHASE_ON_BEGIN="PHASE_ON_BEGIN",e.PHASE_ON_END="PHASE_ON_END",e.TURN_ON_BEGIN="TURN_ON_BEGIN",e.TURN_ON_MOVE="TURN_ON_MOVE",e.TURN_ON_END="TURN_ON_END"})(K.GameMethod||(K.GameMethod={}));var Et;(function(e){e.CalledOutsideHook="Events must be called from moves or the `onBegin`, `onEnd`, and `onMove` hooks.\nThis error probably means you called an event from other game code, like an `endIf` trigger or one of the `turn.order` methods.",e.EndTurnInOnEnd="`endTurn` is disallowed in `onEnd` hooks \u2014 the turn is already ending.",e.MaxTurnEndings=`Maximum number of turn endings exceeded for this update.
|
|
2
|
+
This likely means game code is triggering an infinite loop.`,e.PhaseEventInOnEnd="`setPhase` & `endPhase` are disallowed in a phase\u2019s `onEnd` hook \u2014 the phase is already ending.\nIf you\u2019re trying to dynamically choose the next phase when a phase ends, use the phase\u2019s `next` trigger.",e.StageEventInOnEnd="`setStage`, `endStage` & `setActivePlayers` are disallowed in `onEnd` hooks.",e.StageEventInPhaseBegin="`setStage`, `endStage` & `setActivePlayers` are disallowed in a phase\u2019s `onBegin` hook.\nUse `setActivePlayers` in a `turn.onBegin` hook or declare stages with `turn.activePlayers` instead.",e.StageEventInTurnBegin="`setStage` & `endStage` are disallowed in `turn.onBegin`.\nUse `setActivePlayers` or declare stages with `turn.activePlayers` instead."})(Et||(Et={}));var ea=class{constructor(t,n,r){this.flow=t,this.playerID=r,this.dispatch=[],this.initialTurn=n.turn,this.updateTurnContext(n,void 0),this.maxEndedTurnsPerAction=n.numPlayers*100}api(){let t={_private:this};for(let n of this.flow.eventNames)t[n]=(...r)=>{this.dispatch.push({type:n,args:r,phase:this.currentPhase,turn:this.currentTurn,calledFrom:this.currentMethod,error:new Error("Events Plugin Error")})};return t}isUsed(){return this.dispatch.length>0}updateTurnContext(t,n){this.currentPhase=t.phase,this.currentTurn=t.turn,this.currentMethod=n}unsetCurrentMethod(){this.currentMethod=void 0}update(t){let n=t,r=({stack:i},s)=>({...n,plugins:{...n.plugins,events:{...n.plugins.events,data:{error:s+`
|
|
3
|
+
`+i}}}});e:for(let i=0;i<this.dispatch.length;i++){let s=this.dispatch[i],o=s.turn!==t.ctx.turn;if(this.currentTurn-this.initialTurn>=this.maxEndedTurnsPerAction)return r(s.error,Et.MaxTurnEndings);if(s.calledFrom===void 0)return r(s.error,Et.CalledOutsideHook);if(t.ctx.gameover)break e;switch(s.type){case"endStage":case"setStage":case"setActivePlayers":{switch(s.calledFrom){case K.GameMethod.TURN_ON_END:case K.GameMethod.PHASE_ON_END:return r(s.error,Et.StageEventInOnEnd);case K.GameMethod.PHASE_ON_BEGIN:return r(s.error,Et.StageEventInPhaseBegin);case K.GameMethod.TURN_ON_BEGIN:if(s.type==="setActivePlayers")break;return r(s.error,Et.StageEventInTurnBegin)}if(o)continue e;break}case"endTurn":{if(s.calledFrom===K.GameMethod.TURN_ON_END||s.calledFrom===K.GameMethod.PHASE_ON_END)return r(s.error,Et.EndTurnInOnEnd);if(o)continue e;break}case"endPhase":case"setPhase":{if(s.calledFrom===K.GameMethod.PHASE_ON_END)return r(s.error,Et.PhaseEventInOnEnd);if(s.phase!==t.ctx.phase)continue e;break}}let u=Kl(s.type,s.args,this.playerID);t=this.flow.processEvent(t,u)}return t}},ra={name:"events",noClient:({api:e})=>e._private.isUsed(),isInvalid:({data:e})=>e.error||!1,fnWrap:(e,t)=>(n,...r)=>{let i=n.events;i&&i._private.updateTurnContext(n.ctx,t);let s=e(n,...r);return i&&i._private.unsetCurrentMethod(),s},dangerouslyFlushRawState:({state:e,api:t})=>t._private.update(e),api:({game:e,ctx:t,playerID:n})=>new ea(e.flow,t,n).api()},X1={name:"log",flush:()=>({}),api:({data:e})=>({setMetadata:t=>{e.metadata=t}}),setup:()=>({})},Q1={name:"plugin-serializable",fnWrap:e=>(t,...n)=>e(t,...n)},Z1=!0,e_=Z1?()=>{}:(...e)=>console.log(...e),t_=(...e)=>console.error(...e);function n_(e){e_(`INFO: ${e}`)}function Tn(e){t_("ERROR:",e)}var ia=[$1,K1.RandomPlugin,X1,Q1],wr=[...ia,ra],r_=(e,t,n)=>(n.game.plugins.filter(r=>r.action!==void 0).filter(r=>r.name===t.payload.type).forEach(r=>{let i=r.name,s=e.plugins[i]||{data:{}},o=r.action(s.data,t.payload);e={...e,plugins:{...e.plugins,[i]:{...s,data:o}}}}),e),sa=({plugins:e})=>Object.entries(e||{}).reduce((t,[n,{api:r}])=>(t[n]=r,t),{}),i_=(e,t,n)=>[...ia,...n,ra].filter(r=>r.fnWrap!==void 0).reduce((r,{fnWrap:i})=>i(r,t),e),s_=(e,t)=>([...wr,...t.game.plugins].filter(n=>n.setup!==void 0).forEach(n=>{let r=n.name,i=n.setup({G:e.G,ctx:e.ctx,game:t.game});e={...e,plugins:{...e.plugins,[r]:{data:i}}}}),e),o_=(e,t)=>([...wr,...t.game.plugins].filter(n=>n.api!==void 0).forEach(n=>{let r=n.name,i=e.plugins[r]||{data:{}},s=n.api({G:e.G,ctx:e.ctx,data:i.data,game:t.game,playerID:t.playerID});e={...e,plugins:{...e.plugins,[r]:{...i,api:s}}}}),e),a_=(e,t)=>([...ia,...t.game.plugins,ra].reverse().forEach(n=>{let r=n.name,i=e.plugins[r]||{data:{}};if(n.flush){let s=n.flush({G:e.G,ctx:e.ctx,game:t.game,api:i.api,data:i.data});e={...e,plugins:{...e.plugins,[n.name]:{data:s}}}}else if(n.dangerouslyFlushRawState){e=n.dangerouslyFlushRawState({state:e,game:t.game,api:i.api,data:i.data});let s=e.plugins[r].data;e={...e,plugins:{...e.plugins,[n.name]:{data:s}}}}}),e),u_=(e,t)=>[...wr,...t.game.plugins].filter(n=>n.noClient!==void 0).map(n=>{let r=n.name,i=e.plugins[r];return i?n.noClient({G:e.G,ctx:e.ctx,game:t.game,api:i.api,data:i.data}):!1}).includes(!0),c_=(e,t)=>[...wr,...t.game.plugins].filter(r=>r.isInvalid!==void 0).map(r=>{let{name:i}=r,s=e.plugins[i],o=r.isInvalid({G:e.G,ctx:e.ctx,game:t.game,data:s&&s.data});return o?{plugin:i,message:o}:!1}).find(r=>r)||!1,l_=(e,t)=>{let n=a_(e,t),r=c_(n,t);if(!r)return[n];let{plugin:i,message:s}=r;return Tn(`${i} plugin declared action invalid:
|
|
4
|
+
${s}`),[e,r]},f_=({G:e,ctx:t,plugins:n={}},{game:r,playerID:i})=>([...wr,...r.plugins].forEach(({name:s,playerView:o})=>{if(!o)return;let{data:a}=n[s]||{data:{}},u=o({G:e,ctx:t,game:r,data:a,playerID:i});n={...n,[s]:{data:u}}}),n);function oa(e,t=!1){e.moveLimit&&(t&&(e.minMoves=e.moveLimit),e.maxMoves=e.moveLimit,delete e.moveLimit)}function aa(e,t){let n={},r=[],i=null,s={},o={};if(Array.isArray(t)){let u={};t.forEach(c=>u[c]=rn.NULL),n=u}else{if(oa(t),t.next&&(i=t.next),t.revert&&(r=[...e._prevActivePlayers,{activePlayers:e.activePlayers,_activePlayersMinMoves:e._activePlayersMinMoves,_activePlayersMaxMoves:e._activePlayersMaxMoves,_activePlayersNumMoves:e._activePlayersNumMoves}]),t.currentPlayer!==void 0&&ys(n,s,o,e.currentPlayer,t.currentPlayer),t.others!==void 0)for(let u=0;u<e.playOrder.length;u++){let c=e.playOrder[u];c!==e.currentPlayer&&ys(n,s,o,c,t.others)}if(t.all!==void 0)for(let u=0;u<e.playOrder.length;u++){let c=e.playOrder[u];ys(n,s,o,c,t.all)}if(t.value)for(let u in t.value)ys(n,s,o,u,t.value[u]);if(t.minMoves)for(let u in n)s[u]===void 0&&(s[u]=t.minMoves);if(t.maxMoves)for(let u in n)o[u]===void 0&&(o[u]=t.maxMoves)}Object.keys(n).length===0&&(n=null),Object.keys(s).length===0&&(s=null),Object.keys(o).length===0&&(o=null);let a={};for(let u in n)a[u]=0;return{...e,activePlayers:n,_activePlayersMinMoves:s,_activePlayersMaxMoves:o,_activePlayersNumMoves:a,_prevActivePlayers:r,_nextActivePlayers:i}}function p_(e){let{activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s,_nextActivePlayers:o}=e;if(t&&Object.keys(t).length===0)if(o)e=aa(e,o),{activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s}=e;else if(s.length>0){let a=s.length-1;({activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i}=s[a]),s=s.slice(0,a)}else t=null,n=null,r=null;return{...e,activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s}}function ys(e,t,n,r,i){(typeof i!="object"||i===rn.NULL)&&(i={stage:i}),i.stage!==void 0&&(oa(i),e[r]=i.stage,i.minMoves&&(t[r]=i.minMoves),i.maxMoves&&(n[r]=i.maxMoves))}function ta(e,t){return e[t]+""}function d_(e,t){let{G:n,ctx:r}=e,{numPlayers:i}=r,o={...sa(e),G:n,ctx:r},a=t.order,u=[...Array.from({length:i})].map((p,d)=>d+"");a.playOrder!==void 0&&(u=a.playOrder(o));let c=a.first(o),l=typeof c;l!=="number"&&Tn(`invalid value returned by turn.order.first \u2014 expected number got ${l} \u201C${c}\u201D.`);let f=ta(u,c);return r={...r,currentPlayer:f,playOrderPos:c,playOrder:u},r=aa(r,t.activePlayers||{}),r}function h_(e,t,n,r){let i=n.order,{G:s,ctx:o}=e,a=o.playOrderPos,u=!1;if(r&&r!==!0)typeof r!="object"&&Tn(`invalid argument to endTurn: ${r}`),Object.keys(r).forEach(c=>{switch(c){case"remove":t=ta(o.playOrder,a);break;case"next":a=o.playOrder.indexOf(r.next),t=r.next;break;default:Tn(`invalid argument to endTurn: ${c}`)}});else{let l={...sa(e),G:s,ctx:o},f=i.next(l),p=typeof f;f!==void 0&&p!=="number"&&Tn(`invalid value returned by turn.order.next \u2014 expected number or undefined got ${p} \u201C${f}\u201D.`),f===void 0?u=!0:(a=f,t=ta(o.playOrder,a))}return o={...o,playOrderPos:a,currentPlayer:t},{endPhase:u,ctx:o}}var m_={DEFAULT:{first:({ctx:e})=>e.turn===0?e.playOrderPos:(e.playOrderPos+1)%e.playOrder.length,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},RESET:{first:()=>0,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},CONTINUE:{first:({ctx:e})=>e.playOrderPos,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},ONCE:{first:()=>0,next:({ctx:e})=>{if(e.playOrderPos<e.playOrder.length-1)return e.playOrderPos+1}},CUSTOM:e=>({playOrder:()=>e,first:()=>0,next:({ctx:t})=>(t.playOrderPos+1)%t.playOrder.length}),CUSTOM_FROM:e=>({playOrder:({G:t})=>t[e],first:()=>0,next:({ctx:t})=>(t.playOrderPos+1)%t.playOrder.length})},rn={NULL:null},g_={ALL:{all:rn.NULL},ALL_ONCE:{all:rn.NULL,minMoves:1,maxMoves:1},OTHERS:{others:rn.NULL},OTHERS_ONCE:{others:rn.NULL,minMoves:1,maxMoves:1}};K.ActionCreators=Y1;K.ActivePlayers=g_;K.Enhance=o_;K.FlushAndValidate=l_;K.FnWrap=i_;K.GAME_EVENT=na;K.GetAPIs=sa;K.INVALID_MOVE=Zo;K.InitTurnOrderState=d_;K.MAKE_MOVE=Nl;K.NoClient=u_;K.PATCH=Ll;K.PLUGIN=Fl;K.PlayerView=f_;K.ProcessAction=r_;K.REDO=jl;K.RESET=ql;K.STRIP_TRANSIENTS=Ul;K.SYNC=Dl;K.SetActivePlayers=aa;K.Setup=s_;K.Stage=rn;K.TurnOrder=m_;K.UNDO=Bl;K.UPDATE=Gl;K.UpdateActivePlayersOnceEmpty=p_;K.UpdateTurnOrderState=h_;K.error=Tn;K.gameEvent=zl;K.info=n_;K.makeMove=Vl;K.patch=Wl;K.redo=Xl;K.reset=Yl;K.stripTransients=Ql;K.supportDeprecatedMoveLimit=oa;K.sync=Hl;K.undo=$l;K.update=Jl});var ua=v(Kt=>{"use strict";Object.defineProperty(Kt,"__esModule",{value:!0});var _r=Zl();Yo();Qo();nn();var y_={STRIP_SECRETS:({G:e,playerID:t})=>{let n={...e};return n.secret!==void 0&&delete n.secret,n.players&&(n.players=t?{[t]:n.players[t]}:{}),n}};Kt.ActivePlayers=_r.ActivePlayers;Object.defineProperty(Kt,"GameMethod",{enumerable:!0,get:function(){return _r.GameMethod}});Kt.INVALID_MOVE=_r.INVALID_MOVE;Kt.Stage=_r.Stage;Kt.TurnOrder=_r.TurnOrder;Kt.PlayerView=y_});var tf=v((oD,ef)=>{function v_(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(i);++r<i;)s[r]=e[r+t];return s}ef.exports=v_});var Pr=v((aD,nf)=>{function b_(e,t){return e===t||e!==e&&t!==t}nf.exports=b_});var ca=v((uD,rf)=>{var w_=typeof global=="object"&&global&&global.Object===Object&&global;rf.exports=w_});var it=v((cD,sf)=>{var __=ca(),k_=typeof self=="object"&&self&&self.Object===Object&&self,P_=__||k_||Function("return this")();sf.exports=P_});var an=v((lD,of)=>{var E_=it(),O_=E_.Symbol;of.exports=O_});var lf=v((fD,cf)=>{var af=an(),uf=Object.prototype,S_=uf.hasOwnProperty,A_=uf.toString,Er=af?af.toStringTag:void 0;function x_(e){var t=S_.call(e,Er),n=e[Er];try{e[Er]=void 0;var r=!0}catch{}var i=A_.call(e);return r&&(t?e[Er]=n:delete e[Er]),i}cf.exports=x_});var pf=v((pD,ff)=>{var T_=Object.prototype,M_=T_.toString;function I_(e){return M_.call(e)}ff.exports=I_});var un=v((dD,mf)=>{var df=an(),C_=lf(),R_=pf(),N_="[object Null]",j_="[object Undefined]",hf=df?df.toStringTag:void 0;function q_(e){return e==null?e===void 0?j_:N_:hf&&hf in Object(e)?C_(e):R_(e)}mf.exports=q_});var dt=v((hD,gf)=>{function D_(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}gf.exports=D_});var la=v((mD,yf)=>{var B_=un(),G_=dt(),L_="[object AsyncFunction]",F_="[object Function]",U_="[object GeneratorFunction]",V_="[object Proxy]";function z_(e){if(!G_(e))return!1;var t=B_(e);return t==F_||t==U_||t==L_||t==V_}yf.exports=z_});var vs=v((gD,vf)=>{var K_=9007199254740991;function H_(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=K_}vf.exports=H_});var Mn=v((yD,bf)=>{var W_=la(),J_=vs();function Y_(e){return e!=null&&J_(e.length)&&!W_(e)}bf.exports=Y_});var Or=v((vD,wf)=>{var $_=9007199254740991,X_=/^(?:0|[1-9]\d*)$/;function Q_(e,t){var n=typeof e;return t=t??$_,!!t&&(n=="number"||n!="symbol"&&X_.test(e))&&e>-1&&e%1==0&&e<t}wf.exports=Q_});var kf=v((bD,_f)=>{var Z_=Pr(),ek=Mn(),tk=Or(),nk=dt();function rk(e,t,n){if(!nk(n))return!1;var r=typeof t;return(r=="number"?ek(n)&&tk(t,n.length):r=="string"&&t in n)?Z_(n[t],e):!1}_f.exports=rk});var Ef=v((wD,Pf)=>{var ik=/\s/;function sk(e){for(var t=e.length;t--&&ik.test(e.charAt(t)););return t}Pf.exports=sk});var Sf=v((_D,Of)=>{var ok=Ef(),ak=/^\s+/;function uk(e){return e&&e.slice(0,ok(e)+1).replace(ak,"")}Of.exports=uk});var St=v((kD,Af)=>{function ck(e){return e!=null&&typeof e=="object"}Af.exports=ck});var Sr=v((PD,xf)=>{var lk=un(),fk=St(),pk="[object Symbol]";function dk(e){return typeof e=="symbol"||fk(e)&&lk(e)==pk}xf.exports=dk});var Cf=v((ED,If)=>{var hk=Sf(),Tf=dt(),mk=Sr(),Mf=NaN,gk=/^[-+]0x[0-9a-f]+$/i,yk=/^0b[01]+$/i,vk=/^0o[0-7]+$/i,bk=parseInt;function wk(e){if(typeof e=="number")return e;if(mk(e))return Mf;if(Tf(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Tf(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=hk(e);var n=yk.test(e);return n||vk.test(e)?bk(e.slice(2),n?2:8):gk.test(e)?Mf:+e}If.exports=wk});var jf=v((OD,Nf)=>{var _k=Cf(),Rf=1/0,kk=17976931348623157e292;function Pk(e){if(!e)return e===0?e:0;if(e=_k(e),e===Rf||e===-Rf){var t=e<0?-1:1;return t*kk}return e===e?e:0}Nf.exports=Pk});var fa=v((SD,qf)=>{var Ek=jf();function Ok(e){var t=Ek(e),n=t%1;return t===t?n?t-n:t:0}qf.exports=Ok});var Bf=v((AD,Df)=>{var Sk=tf(),Ak=kf(),xk=fa(),Tk=Math.ceil,Mk=Math.max;function Ik(e,t,n){(n?Ak(e,t,n):t===void 0)?t=1:t=Mk(xk(t),0);var r=e==null?0:e.length;if(!r||t<1)return[];for(var i=0,s=0,o=Array(Tk(r/t));i<r;)o[s++]=Sk(e,i,i+=t);return o}Df.exports=Ik});var Ff=v((MD,Lf)=>{function Ck(){this.__data__=[],this.size=0}Lf.exports=Ck});var xr=v((ID,Uf)=>{var Rk=Pr();function Nk(e,t){for(var n=e.length;n--;)if(Rk(e[n][0],t))return n;return-1}Uf.exports=Nk});var zf=v((CD,Vf)=>{var jk=xr(),qk=Array.prototype,Dk=qk.splice;function Bk(e){var t=this.__data__,n=jk(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Dk.call(t,n,1),--this.size,!0}Vf.exports=Bk});var Hf=v((RD,Kf)=>{var Gk=xr();function Lk(e){var t=this.__data__,n=Gk(t,e);return n<0?void 0:t[n][1]}Kf.exports=Lk});var Jf=v((ND,Wf)=>{var Fk=xr();function Uk(e){return Fk(this.__data__,e)>-1}Wf.exports=Uk});var $f=v((jD,Yf)=>{var Vk=xr();function zk(e,t){var n=this.__data__,r=Vk(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}Yf.exports=zk});var Tr=v((qD,Xf)=>{var Kk=Ff(),Hk=zf(),Wk=Hf(),Jk=Jf(),Yk=$f();function In(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}In.prototype.clear=Kk;In.prototype.delete=Hk;In.prototype.get=Wk;In.prototype.has=Jk;In.prototype.set=Yk;Xf.exports=In});var Zf=v((DD,Qf)=>{var $k=Tr();function Xk(){this.__data__=new $k,this.size=0}Qf.exports=Xk});var tp=v((BD,ep)=>{function Qk(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}ep.exports=Qk});var rp=v((GD,np)=>{function Zk(e){return this.__data__.get(e)}np.exports=Zk});var sp=v((LD,ip)=>{function e0(e){return this.__data__.has(e)}ip.exports=e0});var ap=v((FD,op)=>{var t0=it(),n0=t0["__core-js_shared__"];op.exports=n0});var lp=v((UD,cp)=>{var pa=ap(),up=function(){var e=/[^.]+$/.exec(pa&&pa.keys&&pa.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function r0(e){return!!up&&up in e}cp.exports=r0});var da=v((VD,fp)=>{var i0=Function.prototype,s0=i0.toString;function o0(e){if(e!=null){try{return s0.call(e)}catch{}try{return e+""}catch{}}return""}fp.exports=o0});var dp=v((zD,pp)=>{var a0=la(),u0=lp(),c0=dt(),l0=da(),f0=/[\\^$.*+?()[\]{}|]/g,p0=/^\[object .+?Constructor\]$/,d0=Function.prototype,h0=Object.prototype,m0=d0.toString,g0=h0.hasOwnProperty,y0=RegExp("^"+m0.call(g0).replace(f0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function v0(e){if(!c0(e)||u0(e))return!1;var t=a0(e)?y0:p0;return t.test(l0(e))}pp.exports=v0});var mp=v((KD,hp)=>{function b0(e,t){return e?.[t]}hp.exports=b0});var Ht=v((HD,gp)=>{var w0=dp(),_0=mp();function k0(e,t){var n=_0(e,t);return w0(n)?n:void 0}gp.exports=k0});var bs=v((WD,yp)=>{var P0=Ht(),E0=it(),O0=P0(E0,"Map");yp.exports=O0});var Mr=v((JD,vp)=>{var S0=Ht(),A0=S0(Object,"create");vp.exports=A0});var _p=v((YD,wp)=>{var bp=Mr();function x0(){this.__data__=bp?bp(null):{},this.size=0}wp.exports=x0});var Pp=v(($D,kp)=>{function T0(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}kp.exports=T0});var Op=v((XD,Ep)=>{var M0=Mr(),I0="__lodash_hash_undefined__",C0=Object.prototype,R0=C0.hasOwnProperty;function N0(e){var t=this.__data__;if(M0){var n=t[e];return n===I0?void 0:n}return R0.call(t,e)?t[e]:void 0}Ep.exports=N0});var Ap=v((QD,Sp)=>{var j0=Mr(),q0=Object.prototype,D0=q0.hasOwnProperty;function B0(e){var t=this.__data__;return j0?t[e]!==void 0:D0.call(t,e)}Sp.exports=B0});var Tp=v((ZD,xp)=>{var G0=Mr(),L0="__lodash_hash_undefined__";function F0(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=G0&&t===void 0?L0:t,this}xp.exports=F0});var Ip=v((e3,Mp)=>{var U0=_p(),V0=Pp(),z0=Op(),K0=Ap(),H0=Tp();function Cn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Cn.prototype.clear=U0;Cn.prototype.delete=V0;Cn.prototype.get=z0;Cn.prototype.has=K0;Cn.prototype.set=H0;Mp.exports=Cn});var Np=v((t3,Rp)=>{var Cp=Ip(),W0=Tr(),J0=bs();function Y0(){this.size=0,this.__data__={hash:new Cp,map:new(J0||W0),string:new Cp}}Rp.exports=Y0});var qp=v((n3,jp)=>{function $0(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}jp.exports=$0});var Ir=v((r3,Dp)=>{var X0=qp();function Q0(e,t){var n=e.__data__;return X0(t)?n[typeof t=="string"?"string":"hash"]:n.map}Dp.exports=Q0});var Gp=v((i3,Bp)=>{var Z0=Ir();function eP(e){var t=Z0(this,e).delete(e);return this.size-=t?1:0,t}Bp.exports=eP});var Fp=v((s3,Lp)=>{var tP=Ir();function nP(e){return tP(this,e).get(e)}Lp.exports=nP});var Vp=v((o3,Up)=>{var rP=Ir();function iP(e){return rP(this,e).has(e)}Up.exports=iP});var Kp=v((a3,zp)=>{var sP=Ir();function oP(e,t){var n=sP(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}zp.exports=oP});var ws=v((u3,Hp)=>{var aP=Np(),uP=Gp(),cP=Fp(),lP=Vp(),fP=Kp();function Rn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Rn.prototype.clear=aP;Rn.prototype.delete=uP;Rn.prototype.get=cP;Rn.prototype.has=lP;Rn.prototype.set=fP;Hp.exports=Rn});var Jp=v((c3,Wp)=>{var pP=Tr(),dP=bs(),hP=ws(),mP=200;function gP(e,t){var n=this.__data__;if(n instanceof pP){var r=n.__data__;if(!dP||r.length<mP-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new hP(r)}return n.set(e,t),this.size=n.size,this}Wp.exports=gP});var _s=v((l3,Yp)=>{var yP=Tr(),vP=Zf(),bP=tp(),wP=rp(),_P=sp(),kP=Jp();function Nn(e){var t=this.__data__=new yP(e);this.size=t.size}Nn.prototype.clear=vP;Nn.prototype.delete=bP;Nn.prototype.get=wP;Nn.prototype.has=_P;Nn.prototype.set=kP;Yp.exports=Nn});var Xp=v((f3,$p)=>{var PP="__lodash_hash_undefined__";function EP(e){return this.__data__.set(e,PP),this}$p.exports=EP});var Zp=v((p3,Qp)=>{function OP(e){return this.__data__.has(e)}Qp.exports=OP});var td=v((d3,ed)=>{var SP=ws(),AP=Xp(),xP=Zp();function ks(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new SP;++t<n;)this.add(e[t])}ks.prototype.add=ks.prototype.push=AP;ks.prototype.has=xP;ed.exports=ks});var rd=v((h3,nd)=>{function TP(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}nd.exports=TP});var sd=v((m3,id)=>{function MP(e,t){return e.has(t)}id.exports=MP});var ha=v((g3,od)=>{var IP=td(),CP=rd(),RP=sd(),NP=1,jP=2;function qP(e,t,n,r,i,s){var o=n&NP,a=e.length,u=t.length;if(a!=u&&!(o&&u>a))return!1;var c=s.get(e),l=s.get(t);if(c&&l)return c==t&&l==e;var f=-1,p=!0,d=n&jP?new IP:void 0;for(s.set(e,t),s.set(t,e);++f<a;){var h=e[f],y=t[f];if(r)var m=o?r(y,h,f,t,e,s):r(h,y,f,e,t,s);if(m!==void 0){if(m)continue;p=!1;break}if(d){if(!CP(t,function(b,g){if(!RP(d,g)&&(h===b||i(h,b,n,r,s)))return d.push(g)})){p=!1;break}}else if(!(h===y||i(h,y,n,r,s))){p=!1;break}}return s.delete(e),s.delete(t),p}od.exports=qP});var ma=v((y3,ad)=>{var DP=it(),BP=DP.Uint8Array;ad.exports=BP});var cd=v((v3,ud)=>{function GP(e){var t=-1,n=Array(e.size);return e.forEach(function(r,i){n[++t]=[i,r]}),n}ud.exports=GP});var fd=v((b3,ld)=>{function LP(e){var t=-1,n=Array(e.size);return e.forEach(function(r){n[++t]=r}),n}ld.exports=LP});var gd=v((w3,md)=>{var pd=an(),dd=ma(),FP=Pr(),UP=ha(),VP=cd(),zP=fd(),KP=1,HP=2,WP="[object Boolean]",JP="[object Date]",YP="[object Error]",$P="[object Map]",XP="[object Number]",QP="[object RegExp]",ZP="[object Set]",eE="[object String]",tE="[object Symbol]",nE="[object ArrayBuffer]",rE="[object DataView]",hd=pd?pd.prototype:void 0,ga=hd?hd.valueOf:void 0;function iE(e,t,n,r,i,s,o){switch(n){case rE:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case nE:return!(e.byteLength!=t.byteLength||!s(new dd(e),new dd(t)));case WP:case JP:case XP:return FP(+e,+t);case YP:return e.name==t.name&&e.message==t.message;case QP:case eE:return e==t+"";case $P:var a=VP;case ZP:var u=r&KP;if(a||(a=zP),e.size!=t.size&&!u)return!1;var c=o.get(e);if(c)return c==t;r|=HP,o.set(e,t);var l=UP(a(e),a(t),r,i,s,o);return o.delete(e),l;case tE:if(ga)return ga.call(e)==ga.call(t)}return!1}md.exports=iE});var Ps=v((_3,yd)=>{function sE(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}yd.exports=sE});var tt=v((k3,vd)=>{var oE=Array.isArray;vd.exports=oE});var ya=v((P3,bd)=>{var aE=Ps(),uE=tt();function cE(e,t,n){var r=t(e);return uE(e)?r:aE(r,n(e))}bd.exports=cE});var va=v((E3,wd)=>{function lE(e,t){for(var n=-1,r=e==null?0:e.length,i=0,s=[];++n<r;){var o=e[n];t(o,n,e)&&(s[i++]=o)}return s}wd.exports=lE});var ba=v((O3,_d)=>{function fE(){return[]}_d.exports=fE});var Es=v((S3,Pd)=>{var pE=va(),dE=ba(),hE=Object.prototype,mE=hE.propertyIsEnumerable,kd=Object.getOwnPropertySymbols,gE=kd?function(e){return e==null?[]:(e=Object(e),pE(kd(e),function(t){return mE.call(e,t)}))}:dE;Pd.exports=gE});var Od=v((A3,Ed)=>{function yE(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}Ed.exports=yE});var Ad=v((x3,Sd)=>{var vE=un(),bE=St(),wE="[object Arguments]";function _E(e){return bE(e)&&vE(e)==wE}Sd.exports=_E});var Os=v((T3,Md)=>{var xd=Ad(),kE=St(),Td=Object.prototype,PE=Td.hasOwnProperty,EE=Td.propertyIsEnumerable,OE=xd(function(){return arguments}())?xd:function(e){return kE(e)&&PE.call(e,"callee")&&!EE.call(e,"callee")};Md.exports=OE});var Cd=v((M3,Id)=>{function SE(){return!1}Id.exports=SE});var Ss=v((Cr,jn)=>{var AE=it(),xE=Cd(),jd=typeof Cr=="object"&&Cr&&!Cr.nodeType&&Cr,Rd=jd&&typeof jn=="object"&&jn&&!jn.nodeType&&jn,TE=Rd&&Rd.exports===jd,Nd=TE?AE.Buffer:void 0,ME=Nd?Nd.isBuffer:void 0,IE=ME||xE;jn.exports=IE});var Dd=v((I3,qd)=>{var CE=un(),RE=vs(),NE=St(),jE="[object Arguments]",qE="[object Array]",DE="[object Boolean]",BE="[object Date]",GE="[object Error]",LE="[object Function]",FE="[object Map]",UE="[object Number]",VE="[object Object]",zE="[object RegExp]",KE="[object Set]",HE="[object String]",WE="[object WeakMap]",JE="[object ArrayBuffer]",YE="[object DataView]",$E="[object Float32Array]",XE="[object Float64Array]",QE="[object Int8Array]",ZE="[object Int16Array]",eO="[object Int32Array]",tO="[object Uint8Array]",nO="[object Uint8ClampedArray]",rO="[object Uint16Array]",iO="[object Uint32Array]",be={};be[$E]=be[XE]=be[QE]=be[ZE]=be[eO]=be[tO]=be[nO]=be[rO]=be[iO]=!0;be[jE]=be[qE]=be[JE]=be[DE]=be[YE]=be[BE]=be[GE]=be[LE]=be[FE]=be[UE]=be[VE]=be[zE]=be[KE]=be[HE]=be[WE]=!1;function sO(e){return NE(e)&&RE(e.length)&&!!be[CE(e)]}qd.exports=sO});var As=v((C3,Bd)=>{function oO(e){return function(t){return e(t)}}Bd.exports=oO});var xs=v((Rr,qn)=>{var aO=ca(),Gd=typeof Rr=="object"&&Rr&&!Rr.nodeType&&Rr,Nr=Gd&&typeof qn=="object"&&qn&&!qn.nodeType&&qn,uO=Nr&&Nr.exports===Gd,wa=uO&&aO.process,cO=function(){try{var e=Nr&&Nr.require&&Nr.require("util").types;return e||wa&&wa.binding&&wa.binding("util")}catch{}}();qn.exports=cO});var _a=v((R3,Ud)=>{var lO=Dd(),fO=As(),Ld=xs(),Fd=Ld&&Ld.isTypedArray,pO=Fd?fO(Fd):lO;Ud.exports=pO});var ka=v((N3,Vd)=>{var dO=Od(),hO=Os(),mO=tt(),gO=Ss(),yO=Or(),vO=_a(),bO=Object.prototype,wO=bO.hasOwnProperty;function _O(e,t){var n=mO(e),r=!n&&hO(e),i=!n&&!r&&gO(e),s=!n&&!r&&!i&&vO(e),o=n||r||i||s,a=o?dO(e.length,String):[],u=a.length;for(var c in e)(t||wO.call(e,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||yO(c,u)))&&a.push(c);return a}Vd.exports=_O});var Ts=v((j3,zd)=>{var kO=Object.prototype;function PO(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||kO;return e===n}zd.exports=PO});var Pa=v((q3,Kd)=>{function EO(e,t){return function(n){return e(t(n))}}Kd.exports=EO});var Wd=v((D3,Hd)=>{var OO=Pa(),SO=OO(Object.keys,Object);Hd.exports=SO});var Yd=v((B3,Jd)=>{var AO=Ts(),xO=Wd(),TO=Object.prototype,MO=TO.hasOwnProperty;function IO(e){if(!AO(e))return xO(e);var t=[];for(var n in Object(e))MO.call(e,n)&&n!="constructor"&&t.push(n);return t}Jd.exports=IO});var cn=v((G3,$d)=>{var CO=ka(),RO=Yd(),NO=Mn();function jO(e){return NO(e)?CO(e):RO(e)}$d.exports=jO});var Ea=v((L3,Xd)=>{var qO=ya(),DO=Es(),BO=cn();function GO(e){return qO(e,BO,DO)}Xd.exports=GO});var eh=v((F3,Zd)=>{var Qd=Ea(),LO=1,FO=Object.prototype,UO=FO.hasOwnProperty;function VO(e,t,n,r,i,s){var o=n&LO,a=Qd(e),u=a.length,c=Qd(t),l=c.length;if(u!=l&&!o)return!1;for(var f=u;f--;){var p=a[f];if(!(o?p in t:UO.call(t,p)))return!1}var d=s.get(e),h=s.get(t);if(d&&h)return d==t&&h==e;var y=!0;s.set(e,t),s.set(t,e);for(var m=o;++f<u;){p=a[f];var b=e[p],g=t[p];if(r)var k=o?r(g,b,p,t,e,s):r(b,g,p,e,t,s);if(!(k===void 0?b===g||i(b,g,n,r,s):k)){y=!1;break}m||(m=p=="constructor")}if(y&&!m){var I=e.constructor,j=t.constructor;I!=j&&"constructor"in e&&"constructor"in t&&!(typeof I=="function"&&I instanceof I&&typeof j=="function"&&j instanceof j)&&(y=!1)}return s.delete(e),s.delete(t),y}Zd.exports=VO});var nh=v((U3,th)=>{var zO=Ht(),KO=it(),HO=zO(KO,"DataView");th.exports=HO});var ih=v((V3,rh)=>{var WO=Ht(),JO=it(),YO=WO(JO,"Promise");rh.exports=YO});var oh=v((z3,sh)=>{var $O=Ht(),XO=it(),QO=$O(XO,"Set");sh.exports=QO});var uh=v((K3,ah)=>{var ZO=Ht(),eS=it(),tS=ZO(eS,"WeakMap");ah.exports=tS});var jr=v((H3,mh)=>{var Oa=nh(),Sa=bs(),Aa=ih(),xa=oh(),Ta=uh(),hh=un(),Dn=da(),ch="[object Map]",nS="[object Object]",lh="[object Promise]",fh="[object Set]",ph="[object WeakMap]",dh="[object DataView]",rS=Dn(Oa),iS=Dn(Sa),sS=Dn(Aa),oS=Dn(xa),aS=Dn(Ta),ln=hh;(Oa&&ln(new Oa(new ArrayBuffer(1)))!=dh||Sa&&ln(new Sa)!=ch||Aa&&ln(Aa.resolve())!=lh||xa&&ln(new xa)!=fh||Ta&&ln(new Ta)!=ph)&&(ln=function(e){var t=hh(e),n=t==nS?e.constructor:void 0,r=n?Dn(n):"";if(r)switch(r){case rS:return dh;case iS:return ch;case sS:return lh;case oS:return fh;case aS:return ph}return t});mh.exports=ln});var Ph=v((W3,kh)=>{var Ma=_s(),uS=ha(),cS=gd(),lS=eh(),gh=jr(),yh=tt(),vh=Ss(),fS=_a(),pS=1,bh="[object Arguments]",wh="[object Array]",Ms="[object Object]",dS=Object.prototype,_h=dS.hasOwnProperty;function hS(e,t,n,r,i,s){var o=yh(e),a=yh(t),u=o?wh:gh(e),c=a?wh:gh(t);u=u==bh?Ms:u,c=c==bh?Ms:c;var l=u==Ms,f=c==Ms,p=u==c;if(p&&vh(e)){if(!vh(t))return!1;o=!0,l=!1}if(p&&!l)return s||(s=new Ma),o||fS(e)?uS(e,t,n,r,i,s):cS(e,t,u,n,r,i,s);if(!(n&pS)){var d=l&&_h.call(e,"__wrapped__"),h=f&&_h.call(t,"__wrapped__");if(d||h){var y=d?e.value():e,m=h?t.value():t;return s||(s=new Ma),i(y,m,n,r,s)}}return p?(s||(s=new Ma),lS(e,t,n,r,i,s)):!1}kh.exports=hS});var Ia=v((J3,Sh)=>{var mS=Ph(),Eh=St();function Oh(e,t,n,r,i){return e===t?!0:e==null||t==null||!Eh(e)&&!Eh(t)?e!==e&&t!==t:mS(e,t,n,r,Oh,i)}Sh.exports=Oh});var xh=v((Y3,Ah)=>{var gS=_s(),yS=Ia(),vS=1,bS=2;function wS(e,t,n,r){var i=n.length,s=i,o=!r;if(e==null)return!s;for(e=Object(e);i--;){var a=n[i];if(o&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}for(;++i<s;){a=n[i];var u=a[0],c=e[u],l=a[1];if(o&&a[2]){if(c===void 0&&!(u in e))return!1}else{var f=new gS;if(r)var p=r(c,l,u,e,t,f);if(!(p===void 0?yS(l,c,vS|bS,r,f):p))return!1}}return!0}Ah.exports=wS});var Ca=v(($3,Th)=>{var _S=dt();function kS(e){return e===e&&!_S(e)}Th.exports=kS});var Ih=v((X3,Mh)=>{var PS=Ca(),ES=cn();function OS(e){for(var t=ES(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,PS(i)]}return t}Mh.exports=OS});var Ra=v((Q3,Ch)=>{function SS(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}Ch.exports=SS});var Na=v((Z3,Rh)=>{var AS=xh(),xS=Ih(),TS=Ra();function MS(e){var t=xS(e);return t.length==1&&t[0][2]?TS(t[0][0],t[0][1]):function(n){return n===e||AS(n,e,t)}}Rh.exports=MS});var Is=v((eB,Nh)=>{var IS=tt(),CS=Sr(),RS=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,NS=/^\w*$/;function jS(e,t){if(IS(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||CS(e)?!0:NS.test(e)||!RS.test(e)||t!=null&&e in Object(t)}Nh.exports=jS});var Dh=v((tB,qh)=>{var jh=ws(),qS="Expected a function";function ja(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(qS);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=e.apply(this,r);return n.cache=s.set(i,o)||s,o};return n.cache=new(ja.Cache||jh),n}ja.Cache=jh;qh.exports=ja});var Gh=v((nB,Bh)=>{var DS=Dh(),BS=500;function GS(e){var t=DS(e,function(r){return n.size===BS&&n.clear(),r}),n=t.cache;return t}Bh.exports=GS});var Fh=v((rB,Lh)=>{var LS=Gh(),FS=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,US=/\\(\\)?/g,VS=LS(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(FS,function(n,r,i,s){t.push(i?s.replace(US,"$1"):r||n)}),t});Lh.exports=VS});var Vh=v((iB,Uh)=>{function zS(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}Uh.exports=zS});var Yh=v((sB,Jh)=>{var zh=an(),KS=Vh(),HS=tt(),WS=Sr(),JS=1/0,Kh=zh?zh.prototype:void 0,Hh=Kh?Kh.toString:void 0;function Wh(e){if(typeof e=="string")return e;if(HS(e))return KS(e,Wh)+"";if(WS(e))return Hh?Hh.call(e):"";var t=e+"";return t=="0"&&1/e==-JS?"-0":t}Jh.exports=Wh});var Xh=v((oB,$h)=>{var YS=Yh();function $S(e){return e==null?"":YS(e)}$h.exports=$S});var qr=v((aB,Qh)=>{var XS=tt(),QS=Is(),ZS=Fh(),eA=Xh();function tA(e,t){return XS(e)?e:QS(e,t)?[e]:ZS(eA(e))}Qh.exports=tA});var Bn=v((uB,Zh)=>{var nA=Sr(),rA=1/0;function iA(e){if(typeof e=="string"||nA(e))return e;var t=e+"";return t=="0"&&1/e==-rA?"-0":t}Zh.exports=iA});var Cs=v((cB,em)=>{var sA=qr(),oA=Bn();function aA(e,t){t=sA(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[oA(t[n++])];return n&&n==r?e:void 0}em.exports=aA});var nm=v((lB,tm)=>{var uA=Cs();function cA(e,t,n){var r=e==null?void 0:uA(e,t);return r===void 0?n:r}tm.exports=cA});var im=v((fB,rm)=>{function lA(e,t){return e!=null&&t in Object(e)}rm.exports=lA});var om=v((pB,sm)=>{var fA=qr(),pA=Os(),dA=tt(),hA=Or(),mA=vs(),gA=Bn();function yA(e,t,n){t=fA(t,e);for(var r=-1,i=t.length,s=!1;++r<i;){var o=gA(t[r]);if(!(s=e!=null&&n(e,o)))break;e=e[o]}return s||++r!=i?s:(i=e==null?0:e.length,!!i&&mA(i)&&hA(o,i)&&(dA(e)||pA(e)))}sm.exports=yA});var qa=v((dB,am)=>{var vA=im(),bA=om();function wA(e,t){return e!=null&&bA(e,t,vA)}am.exports=wA});var cm=v((hB,um)=>{var _A=Ia(),kA=nm(),PA=qa(),EA=Is(),OA=Ca(),SA=Ra(),AA=Bn(),xA=1,TA=2;function MA(e,t){return EA(e)&&OA(t)?SA(AA(e),t):function(n){var r=kA(n,e);return r===void 0&&r===t?PA(n,e):_A(t,r,xA|TA)}}um.exports=MA});var Da=v((mB,lm)=>{function IA(e){return e}lm.exports=IA});var pm=v((gB,fm)=>{function CA(e){return function(t){return t?.[e]}}fm.exports=CA});var hm=v((yB,dm)=>{var RA=Cs();function NA(e){return function(t){return RA(t,e)}}dm.exports=NA});var gm=v((vB,mm)=>{var jA=pm(),qA=hm(),DA=Is(),BA=Bn();function GA(e){return DA(e)?jA(BA(e)):qA(e)}mm.exports=GA});var Rs=v((bB,ym)=>{var LA=Na(),FA=cm(),UA=Da(),VA=tt(),zA=gm();function KA(e){return typeof e=="function"?e:e==null?UA:typeof e=="object"?VA(e)?FA(e[0],e[1]):LA(e):zA(e)}ym.exports=KA});var bm=v((wB,vm)=>{var HA=Rs(),WA=Mn(),JA=cn();function YA(e){return function(t,n,r){var i=Object(t);if(!WA(t)){var s=HA(n,3);t=JA(t),n=function(a){return s(i[a],a,i)}}var o=e(t,n,r);return o>-1?i[s?t[o]:o]:void 0}}vm.exports=YA});var _m=v((_B,wm)=>{function $A(e,t,n,r){for(var i=e.length,s=n+(r?1:-1);r?s--:++s<i;)if(t(e[s],s,e))return s;return-1}wm.exports=$A});var Pm=v((kB,km)=>{var XA=_m(),QA=Rs(),ZA=fa(),ex=Math.max;function tx(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:ZA(n);return i<0&&(i=ex(r+i,0)),XA(e,QA(t,3),i)}km.exports=tx});var Ba=v((PB,Em)=>{var nx=bm(),rx=Pm(),ix=nx(rx);Em.exports=ix});var Sm=v((EB,Om)=>{function sx(e){return function(t,n,r){for(var i=-1,s=Object(t),o=r(t),a=o.length;a--;){var u=o[e?a:++i];if(n(s[u],u,s)===!1)break}return t}}Om.exports=sx});var xm=v((OB,Am)=>{var ox=Sm(),ax=ox();Am.exports=ax});var Mm=v((SB,Tm)=>{var ux=xm(),cx=cn();function lx(e,t){return e&&ux(e,t,cx)}Tm.exports=lx});var Cm=v((AB,Im)=>{var fx=Mn();function px(e,t){return function(n,r){if(n==null)return n;if(!fx(n))return e(n,r);for(var i=n.length,s=t?i:-1,o=Object(n);(t?s--:++s<i)&&r(o[s],s,o)!==!1;);return n}}Im.exports=px});var Nm=v((xB,Rm)=>{var dx=Mm(),hx=Cm(),mx=hx(dx);Rm.exports=mx});var qm=v((TB,jm)=>{var gx=Nm();function yx(e,t){var n=[];return gx(e,function(r,i,s){t(r,i,s)&&n.push(r)}),n}jm.exports=yx});var Bm=v((MB,Dm)=>{var vx=va(),bx=qm(),wx=Rs(),_x=tt();function kx(e,t){var n=_x(e)?vx:bx;return n(e,wx(t,3))}Dm.exports=kx});var Ns=v((IB,Gm)=>{var Px=Pa(),Ex=Px(Object.getPrototypeOf,Object);Gm.exports=Ex});var js=v((CB,Fm)=>{var Ox=un(),Sx=Ns(),Ax=St(),xx="[object Object]",Tx=Function.prototype,Mx=Object.prototype,Lm=Tx.toString,Ix=Mx.hasOwnProperty,Cx=Lm.call(Object);function Rx(e){if(!Ax(e)||Ox(e)!=xx)return!1;var t=Sx(e);if(t===null)return!0;var n=Ix.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&Lm.call(n)==Cx}Fm.exports=Rx});var Ga=v((RB,Um)=>{var Nx=Ht(),jx=function(){try{var e=Nx(Object,"defineProperty");return e({},"",{}),e}catch{}}();Um.exports=jx});var La=v((NB,zm)=>{var Vm=Ga();function qx(e,t,n){t=="__proto__"&&Vm?Vm(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}zm.exports=qx});var qs=v((jB,Km)=>{var Dx=La(),Bx=Pr(),Gx=Object.prototype,Lx=Gx.hasOwnProperty;function Fx(e,t,n){var r=e[t];(!(Lx.call(e,t)&&Bx(r,n))||n===void 0&&!(t in e))&&Dx(e,t,n)}Km.exports=Fx});var Jm=v((qB,Wm)=>{var Ux=qs(),Vx=qr(),zx=Or(),Hm=dt(),Kx=Bn();function Hx(e,t,n,r){if(!Hm(e))return e;t=Vx(t,e);for(var i=-1,s=t.length,o=s-1,a=e;a!=null&&++i<s;){var u=Kx(t[i]),c=n;if(u==="__proto__"||u==="constructor"||u==="prototype")return e;if(i!=o){var l=a[u];c=r?r(l,u,a):void 0,c===void 0&&(c=Hm(l)?l:zx(t[i+1])?[]:{})}Ux(a,u,c),a=a[u]}return e}Wm.exports=Hx});var $m=v((DB,Ym)=>{var Wx=Cs(),Jx=Jm(),Yx=qr();function $x(e,t,n){for(var r=-1,i=t.length,s={};++r<i;){var o=t[r],a=Wx(e,o);n(a,o)&&Jx(s,Yx(o,e),a)}return s}Ym.exports=$x});var Qm=v((BB,Xm)=>{var Xx=$m(),Qx=qa();function Zx(e,t){return Xx(e,t,function(n,r){return Qx(e,r)})}Xm.exports=Zx});var ng=v((GB,tg)=>{var Zm=an(),eT=Os(),tT=tt(),eg=Zm?Zm.isConcatSpreadable:void 0;function nT(e){return tT(e)||eT(e)||!!(eg&&e&&e[eg])}tg.exports=nT});var sg=v((LB,ig)=>{var rT=Ps(),iT=ng();function rg(e,t,n,r,i){var s=-1,o=e.length;for(n||(n=iT),i||(i=[]);++s<o;){var a=e[s];t>0&&n(a)?t>1?rg(a,t-1,n,r,i):rT(i,a):r||(i[i.length]=a)}return i}ig.exports=rg});var ag=v((FB,og)=>{var sT=sg();function oT(e){var t=e==null?0:e.length;return t?sT(e,1):[]}og.exports=oT});var cg=v((UB,ug)=>{function aT(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}ug.exports=aT});var pg=v((VB,fg)=>{var uT=cg(),lg=Math.max;function cT(e,t,n){return t=lg(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,s=lg(r.length-t,0),o=Array(s);++i<s;)o[i]=r[t+i];i=-1;for(var a=Array(t+1);++i<t;)a[i]=r[i];return a[t]=n(o),uT(e,this,a)}}fg.exports=cT});var hg=v((zB,dg)=>{function lT(e){return function(){return e}}dg.exports=lT});var yg=v((KB,gg)=>{var fT=hg(),mg=Ga(),pT=Da(),dT=mg?function(e,t){return mg(e,"toString",{configurable:!0,enumerable:!1,value:fT(t),writable:!0})}:pT;gg.exports=dT});var bg=v((HB,vg)=>{var hT=800,mT=16,gT=Date.now;function yT(e){var t=0,n=0;return function(){var r=gT(),i=mT-(r-n);if(n=r,i>0){if(++t>=hT)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}vg.exports=yT});var _g=v((WB,wg)=>{var vT=yg(),bT=bg(),wT=bT(vT);wg.exports=wT});var Pg=v((JB,kg)=>{var _T=ag(),kT=pg(),PT=_g();function ET(e){return PT(kT(e,void 0,_T),e+"")}kg.exports=ET});var Fa=v((YB,Eg)=>{var OT=Qm(),ST=Pg(),AT=ST(function(e,t){return e==null?{}:OT(e,t)});Eg.exports=AT});var Vg=v((f4,Ug)=>{function SM(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}Ug.exports=SM});var Lr=v((p4,zg)=>{var AM=qs(),xM=La();function TM(e,t,n,r){var i=!n;n||(n={});for(var s=-1,o=t.length;++s<o;){var a=t[s],u=r?r(n[a],e[a],a,n,e):void 0;u===void 0&&(u=e[a]),i?xM(n,a,u):AM(n,a,u)}return n}zg.exports=TM});var Hg=v((d4,Kg)=>{var MM=Lr(),IM=cn();function CM(e,t){return e&&MM(t,IM(t),e)}Kg.exports=CM});var Jg=v((h4,Wg)=>{function RM(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}Wg.exports=RM});var $g=v((m4,Yg)=>{var NM=dt(),jM=Ts(),qM=Jg(),DM=Object.prototype,BM=DM.hasOwnProperty;function GM(e){if(!NM(e))return qM(e);var t=jM(e),n=[];for(var r in e)r=="constructor"&&(t||!BM.call(e,r))||n.push(r);return n}Yg.exports=GM});var Us=v((g4,Xg)=>{var LM=ka(),FM=$g(),UM=Mn();function VM(e){return UM(e)?LM(e,!0):FM(e)}Xg.exports=VM});var Zg=v((y4,Qg)=>{var zM=Lr(),KM=Us();function HM(e,t){return e&&zM(t,KM(t),e)}Qg.exports=HM});var iy=v((Fr,Hn)=>{var WM=it(),ry=typeof Fr=="object"&&Fr&&!Fr.nodeType&&Fr,ey=ry&&typeof Hn=="object"&&Hn&&!Hn.nodeType&&Hn,JM=ey&&ey.exports===ry,ty=JM?WM.Buffer:void 0,ny=ty?ty.allocUnsafe:void 0;function YM(e,t){if(t)return e.slice();var n=e.length,r=ny?ny(n):new e.constructor(n);return e.copy(r),r}Hn.exports=YM});var oy=v((v4,sy)=>{function $M(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}sy.exports=$M});var uy=v((b4,ay)=>{var XM=Lr(),QM=Es();function ZM(e,t){return XM(e,QM(e),t)}ay.exports=ZM});var Xa=v((w4,cy)=>{var eI=Ps(),tI=Ns(),nI=Es(),rI=ba(),iI=Object.getOwnPropertySymbols,sI=iI?function(e){for(var t=[];e;)eI(t,nI(e)),e=tI(e);return t}:rI;cy.exports=sI});var fy=v((_4,ly)=>{var oI=Lr(),aI=Xa();function uI(e,t){return oI(e,aI(e),t)}ly.exports=uI});var dy=v((k4,py)=>{var cI=ya(),lI=Xa(),fI=Us();function pI(e){return cI(e,fI,lI)}py.exports=pI});var my=v((P4,hy)=>{var dI=Object.prototype,hI=dI.hasOwnProperty;function mI(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&hI.call(e,"index")&&(n.index=e.index,n.input=e.input),n}hy.exports=mI});var Vs=v((E4,yy)=>{var gy=ma();function gI(e){var t=new e.constructor(e.byteLength);return new gy(t).set(new gy(e)),t}yy.exports=gI});var by=v((O4,vy)=>{var yI=Vs();function vI(e,t){var n=t?yI(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}vy.exports=vI});var _y=v((S4,wy)=>{var bI=/\w*$/;function wI(e){var t=new e.constructor(e.source,bI.exec(e));return t.lastIndex=e.lastIndex,t}wy.exports=wI});var Sy=v((A4,Oy)=>{var ky=an(),Py=ky?ky.prototype:void 0,Ey=Py?Py.valueOf:void 0;function _I(e){return Ey?Object(Ey.call(e)):{}}Oy.exports=_I});var xy=v((x4,Ay)=>{var kI=Vs();function PI(e,t){var n=t?kI(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}Ay.exports=PI});var My=v((T4,Ty)=>{var EI=Vs(),OI=by(),SI=_y(),AI=Sy(),xI=xy(),TI="[object Boolean]",MI="[object Date]",II="[object Map]",CI="[object Number]",RI="[object RegExp]",NI="[object Set]",jI="[object String]",qI="[object Symbol]",DI="[object ArrayBuffer]",BI="[object DataView]",GI="[object Float32Array]",LI="[object Float64Array]",FI="[object Int8Array]",UI="[object Int16Array]",VI="[object Int32Array]",zI="[object Uint8Array]",KI="[object Uint8ClampedArray]",HI="[object Uint16Array]",WI="[object Uint32Array]";function JI(e,t,n){var r=e.constructor;switch(t){case DI:return EI(e);case TI:case MI:return new r(+e);case BI:return OI(e,n);case GI:case LI:case FI:case UI:case VI:case zI:case KI:case HI:case WI:return xI(e,n);case II:return new r;case CI:case jI:return new r(e);case RI:return SI(e);case NI:return new r;case qI:return AI(e)}}Ty.exports=JI});var Ry=v((M4,Cy)=>{var YI=dt(),Iy=Object.create,$I=function(){function e(){}return function(t){if(!YI(t))return{};if(Iy)return Iy(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();Cy.exports=$I});var jy=v((I4,Ny)=>{var XI=Ry(),QI=Ns(),ZI=Ts();function eC(e){return typeof e.constructor=="function"&&!ZI(e)?XI(QI(e)):{}}Ny.exports=eC});var Dy=v((C4,qy)=>{var tC=jr(),nC=St(),rC="[object Map]";function iC(e){return nC(e)&&tC(e)==rC}qy.exports=iC});var Fy=v((R4,Ly)=>{var sC=Dy(),oC=As(),By=xs(),Gy=By&&By.isMap,aC=Gy?oC(Gy):sC;Ly.exports=aC});var Vy=v((N4,Uy)=>{var uC=jr(),cC=St(),lC="[object Set]";function fC(e){return cC(e)&&uC(e)==lC}Uy.exports=fC});var Wy=v((j4,Hy)=>{var pC=Vy(),dC=As(),zy=xs(),Ky=zy&&zy.isSet,hC=Ky?dC(Ky):pC;Hy.exports=hC});var Qy=v((q4,Xy)=>{var mC=_s(),gC=Vg(),yC=qs(),vC=Hg(),bC=Zg(),wC=iy(),_C=oy(),kC=uy(),PC=fy(),EC=Ea(),OC=dy(),SC=jr(),AC=my(),xC=My(),TC=jy(),MC=tt(),IC=Ss(),CC=Fy(),RC=dt(),NC=Wy(),jC=cn(),qC=Us(),DC=1,BC=2,GC=4,Jy="[object Arguments]",LC="[object Array]",FC="[object Boolean]",UC="[object Date]",VC="[object Error]",Yy="[object Function]",zC="[object GeneratorFunction]",KC="[object Map]",HC="[object Number]",$y="[object Object]",WC="[object RegExp]",JC="[object Set]",YC="[object String]",$C="[object Symbol]",XC="[object WeakMap]",QC="[object ArrayBuffer]",ZC="[object DataView]",eR="[object Float32Array]",tR="[object Float64Array]",nR="[object Int8Array]",rR="[object Int16Array]",iR="[object Int32Array]",sR="[object Uint8Array]",oR="[object Uint8ClampedArray]",aR="[object Uint16Array]",uR="[object Uint32Array]",ge={};ge[Jy]=ge[LC]=ge[QC]=ge[ZC]=ge[FC]=ge[UC]=ge[eR]=ge[tR]=ge[nR]=ge[rR]=ge[iR]=ge[KC]=ge[HC]=ge[$y]=ge[WC]=ge[JC]=ge[YC]=ge[$C]=ge[sR]=ge[oR]=ge[aR]=ge[uR]=!0;ge[VC]=ge[Yy]=ge[XC]=!1;function zs(e,t,n,r,i,s){var o,a=t&DC,u=t&BC,c=t&GC;if(n&&(o=i?n(e,r,i,s):n(e)),o!==void 0)return o;if(!RC(e))return e;var l=MC(e);if(l){if(o=AC(e),!a)return _C(e,o)}else{var f=SC(e),p=f==Yy||f==zC;if(IC(e))return wC(e,a);if(f==$y||f==Jy||p&&!i){if(o=u||p?{}:TC(e),!a)return u?PC(e,bC(o,e)):kC(e,vC(o,e))}else{if(!ge[f])return i?e:{};o=xC(e,f,a)}}s||(s=new mC);var d=s.get(e);if(d)return d;s.set(e,o),NC(e)?e.forEach(function(m){o.add(zs(m,t,n,m,e,s))}):CC(e)&&e.forEach(function(m,b){o.set(b,zs(m,t,n,b,e,s))});var h=c?u?OC:EC:u?qC:jC,y=l?void 0:h(e);return gC(y||e,function(m,b){y&&(b=m,m=e[b]),yC(o,b,zs(m,t,n,b,e,s))}),o}Xy.exports=zs});var Ur=v((D4,Zy)=>{var cR=Qy(),lR=Na(),fR=1;function pR(e){return lR(cR(e,fR))}Zy.exports=pR});var Uu=v(Yt=>{"use strict";Object.defineProperty(Yt,"__esModule",{value:!0});Yt.Pointer=Yt.escapeToken=Yt.unescapeToken=void 0;function Vv(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}Yt.unescapeToken=Vv;function zv(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}Yt.escapeToken=zv;var oN=function(){function e(t){t===void 0&&(t=[""]),this.tokens=t}return e.fromJSON=function(t){var n=t.split("/").map(Vv);if(n[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(t));return new e(n)},e.prototype.toString=function(){return this.tokens.map(zv).join("/")},e.prototype.evaluate=function(t){for(var n=null,r="",i=t,s=1,o=this.tokens.length;s<o;s++)n=i,r=this.tokens[s],!(r=="__proto__"||r=="constructor"||r=="prototype")&&(i=(n||{})[r]);return{parent:n,key:r,value:i}},e.prototype.get=function(t){return this.evaluate(t).value},e.prototype.set=function(t,n){var r=this.evaluate(t);r.parent&&(r.parent[r.key]=n)},e.prototype.push=function(t){this.tokens.push(t)},e.prototype.add=function(t){var n=this.tokens.concat(String(t));return new e(n)},e}();Yt.Pointer=oN});var zu=v(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.clone=Nt.objectType=Nt.hasOwnProperty=void 0;Nt.hasOwnProperty=Object.prototype.hasOwnProperty;function aN(e){return e===void 0?"undefined":e===null?"null":Array.isArray(e)?"array":typeof e}Nt.objectType=aN;function uN(e){return e!=null&&typeof e=="object"}function Vu(e){if(!uN(e))return e;if(e.constructor==Array){for(var t=e.length,n=new Array(t),r=0;r<t;r++)n[r]=Vu(e[r]);return n}if(e.constructor==Date){var i=new Date(+e);return i}var s={};for(var o in e)Nt.hasOwnProperty.call(e,o)&&(s[o]=Vu(e[o]));return s}Nt.clone=Vu});var Wu=v(Ke=>{"use strict";Object.defineProperty(Ke,"__esModule",{value:!0});Ke.diffAny=Ke.diffObjects=Ke.diffArrays=Ke.intersection=Ke.subtract=Ke.isDestructive=void 0;var Ni=zu();function cN(e){var t=e.op;return t==="remove"||t==="replace"||t==="copy"||t==="move"}Ke.isDestructive=cN;function Hu(e,t){var n={};for(var r in e)Ni.hasOwnProperty.call(e,r)&&e[r]!==void 0&&(n[r]=1);for(var i in t)Ni.hasOwnProperty.call(t,i)&&t[i]!==void 0&&delete n[i];return Object.keys(n)}Ke.subtract=Hu;function Kv(e){for(var t=e.length,n={},r=0;r<t;r++){var i=e[r];for(var s in i)Ni.hasOwnProperty.call(i,s)&&i[s]!==void 0&&(n[s]=(n[s]||0)+1)}for(var s in n)n[s]<t&&delete n[s];return Object.keys(n)}Ke.intersection=Kv;function lN(e){return e.op==="add"}function fN(e){return e.op==="remove"}function Ku(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function Hv(e,t,n,r){r===void 0&&(r=ro);var i={"0,0":{operations:[],cost:0}};function s(l,f){var p="".concat(l,",").concat(f),d=i[p];if(d===void 0){if(l>0&&f>0&&!r(e[l-1],t[f-1],n.add(String(l-1))).length)d=s(l-1,f-1);else{var h=[];if(l>0){var y=s(l-1,f),m={op:"remove",index:l-1};h.push(Ku(y,m))}if(f>0){var b=s(l,f-1),g={op:"add",index:l-1,value:t[f-1]};h.push(Ku(b,g))}if(l>0&&f>0){var k=s(l-1,f-1),I={op:"replace",index:l-1,original:e[l-1],value:t[f-1]};h.push(Ku(k,I))}var j=h.sort(function(C,q){return C.cost-q.cost})[0];d=j}i[p]=d}return d}var o=isNaN(e.length)||e.length<=0?0:e.length,a=isNaN(t.length)||t.length<=0?0:t.length,u=s(o,a).operations,c=u.reduce(function(l,f){var p=l[0],d=l[1];if(lN(f)){var h=f.index+1+d,y=h<o+d?String(h):"-",m={op:f.op,path:n.add(y).toString(),value:f.value};return[p.concat(m),d+1]}else if(fN(f)){var m={op:f.op,path:n.add(String(f.index+d)).toString()};return[p.concat(m),d-1]}else{var b=n.add(String(f.index+d)),g=r(f.original,f.value,b);return[p.concat.apply(p,g),d]}},[[],0])[0];return c}Ke.diffArrays=Hv;function Wv(e,t,n,r){r===void 0&&(r=ro);var i=[];return Hu(e,t).forEach(function(s){i.push({op:"remove",path:n.add(s).toString()})}),Hu(t,e).forEach(function(s){i.push({op:"add",path:n.add(s).toString(),value:t[s]})}),Kv([e,t]).forEach(function(s){i.push.apply(i,r(e[s],t[s],n.add(s)))}),i}Ke.diffObjects=Wv;function ro(e,t,n,r){if(r===void 0&&(r=ro),e===t)return[];var i=(0,Ni.objectType)(e),s=(0,Ni.objectType)(t);return i=="array"&&s=="array"?Hv(e,t,n,r):i=="object"&&s=="object"?Wv(e,t,n,r):[{op:"replace",path:n.toString(),value:t}]}Ke.diffAny=ro});var rb=v(Se=>{"use strict";var Ju=Se&&Se.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Se,"__esModule",{value:!0});Se.apply=Se.InvalidOperationError=Se.test=Se.copy=Se.move=Se.replace=Se.remove=Se.add=Se.TestError=Se.MissingError=void 0;var jt=Uu(),Yu=zu(),pN=Wu(),gt=function(e){Ju(t,e);function t(n){var r=e.call(this,"Value required at path: ".concat(n))||this;return r.path=n,r.name="MissingError",r}return t}(Error);Se.MissingError=gt;var Jv=function(e){Ju(t,e);function t(n,r){var i=e.call(this,"Test failed: ".concat(n," != ").concat(r))||this;return i.actual=n,i.expected=r,i.name="TestError",i}return t}(Error);Se.TestError=Jv;function $u(e,t,n){if(Array.isArray(e))if(t=="-")e.push(n);else{var r=parseInt(t,10);e.splice(r,0,n)}else e[t]=n}function Yv(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function $v(e,t){var n=jt.Pointer.fromJSON(t.path).evaluate(e);return n.parent===void 0?new gt(t.path):($u(n.parent,n.key,(0,Yu.clone)(t.value)),null)}Se.add=$v;function Xv(e,t){var n=jt.Pointer.fromJSON(t.path).evaluate(e);return n.value===void 0?new gt(t.path):(Yv(n.parent,n.key),null)}Se.remove=Xv;function Qv(e,t){var n=jt.Pointer.fromJSON(t.path).evaluate(e);if(n.parent===null)return new gt(t.path);if(Array.isArray(n.parent)){if(parseInt(n.key,10)>=n.parent.length)return new gt(t.path)}else if(n.value===void 0)return new gt(t.path);return n.parent[n.key]=(0,Yu.clone)(t.value),null}Se.replace=Qv;function Zv(e,t){var n=jt.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new gt(t.from);var r=jt.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new gt(t.path):(Yv(n.parent,n.key),$u(r.parent,r.key,n.value),null)}Se.move=Zv;function eb(e,t){var n=jt.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new gt(t.from);var r=jt.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new gt(t.path):($u(r.parent,r.key,(0,Yu.clone)(n.value)),null)}Se.copy=eb;function tb(e,t){var n=jt.Pointer.fromJSON(t.path).evaluate(e);return(0,pN.diffAny)(n.value,t.value,new jt.Pointer).length?new Jv(n.value,t.value):null}Se.test=tb;var nb=function(e){Ju(t,e);function t(n){var r=e.call(this,"Invalid operation: ".concat(n.op))||this;return r.operation=n,r.name="InvalidOperationError",r}return t}(Error);Se.InvalidOperationError=nb;function dN(e,t){switch(t.op){case"add":return $v(e,t);case"remove":return Xv(e,t);case"replace":return Qv(e,t);case"move":return Zv(e,t);case"copy":return eb(e,t);case"test":return tb(e,t)}return new nb(t)}Se.apply=dN});var ji=v(yt=>{"use strict";Object.defineProperty(yt,"__esModule",{value:!0});yt.createTests=yt.createPatch=yt.applyPatch=yt.Pointer=void 0;var Xu=Uu();Object.defineProperty(yt,"Pointer",{enumerable:!0,get:function(){return Xu.Pointer}});var hN=rb(),Qu=Wu();function mN(e,t){return t.map(function(n){return(0,hN.apply)(e,n)})}yt.applyPatch=mN;function gN(e){function t(n,r,i){var s=e(n,r,i);return Array.isArray(s)?s:(0,Qu.diffAny)(n,r,i,t)}return t}function yN(e,t,n){var r=new Xu.Pointer;return(n?gN(n):Qu.diffAny)(e,t,r)}yt.createPatch=yN;function ib(e,t){var n=Xu.Pointer.fromJSON(t).evaluate(e);if(n!==void 0)return{op:"test",path:t,value:n.value}}function vN(e,t){var n=new Array;return t.filter(Qu.isDestructive).forEach(function(r){var i=ib(e,r.path);if(i&&n.push(i),"from"in r){var s=ib(e,r.from);s&&n.push(s)}}),n}yt.createTests=vN});var so=v(cb=>{(function(e,t){"use strict";if(e.setImmediate)return;var n=1,r={},i=!1,s=e.document,o;function a(g){typeof g!="function"&&(g=new Function(""+g));for(var k=new Array(arguments.length-1),I=0;I<k.length;I++)k[I]=arguments[I+1];var j={callback:g,args:k};return r[n]=j,o(n),n++}function u(g){delete r[g]}function c(g){var k=g.callback,I=g.args;switch(I.length){case 0:k();break;case 1:k(I[0]);break;case 2:k(I[0],I[1]);break;case 3:k(I[0],I[1],I[2]);break;default:k.apply(t,I);break}}function l(g){if(i)setTimeout(l,0,g);else{var k=r[g];if(k){i=!0;try{c(k)}finally{u(g),i=!1}}}}function f(){o=function(g){process.nextTick(function(){l(g)})}}function p(){if(e.postMessage&&!e.importScripts){var g=!0,k=e.onmessage;return e.onmessage=function(){g=!1},e.postMessage("","*"),e.onmessage=k,g}}function d(){var g="setImmediate$"+Math.random()+"$",k=function(I){I.source===e&&typeof I.data=="string"&&I.data.indexOf(g)===0&&l(+I.data.slice(g.length))};e.addEventListener?e.addEventListener("message",k,!1):e.attachEvent("onmessage",k),o=function(I){e.postMessage(g+I,"*")}}function h(){var g=new MessageChannel;g.port1.onmessage=function(k){var I=k.data;l(I)},o=function(k){g.port2.postMessage(k)}}function y(){var g=s.documentElement;o=function(k){var I=s.createElement("script");I.onreadystatechange=function(){l(k),I.onreadystatechange=null,g.removeChild(I),I=null},g.appendChild(I)}}function m(){o=function(g){setTimeout(l,0,g)}}var b=Object.getPrototypeOf&&Object.getPrototypeOf(e);b=b&&b.setTimeout?b:e,{}.toString.call(e.process)==="[object process]"?f():p()?d():e.MessageChannel?h():s&&"onreadystatechange"in s.createElement("script")?y():m(),b.setImmediate=a,b.clearImmediate=u})(typeof self>"u"?typeof global>"u"?cb:global:self)});var Vq={};ll(Vq,{Client:()=>jo,gameFactory:()=>yi});function He(e,t){let{duplicates:n,circular:r}=hr(e),i=[...n],s=new Map(i.map(a=>[a,null])),o=t?.deduplicateInstances!==!1;return JSON.stringify(e,(a,u)=>{if(typeof u=="object"&&u!==null&&!Array.isArray(u)){let c=s.get(u),l=r.has(u);if(typeof c=="number"&&l)return{_instanceReference:c};if(o&&typeof c=="number")return{_instanceReference:c};let f={...u};if(c===null){let p=i.indexOf(u);s.set(u,p),f._instanceReferenceId=p}else!o&&typeof c=="number"&&(f._instanceReference=c);return u.constructor&&u.constructor!==Object&&u.constructor!==Array&&(f._constructorName=u.constructor.name),f}else{if(Number.isNaN(u))return"Wacksonan";if(Object.is(u,-0))return"Wacksonegativezero";switch(u){case 1/0:return"Wacksonfinity";case-1/0:return"Wacksonegativinfinity";case void 0:return"Wacksondefined";default:return u}}},t?.space)}function Ut(e,t){let n=JSON.parse(e,(i,s)=>{switch(s){case"Wacksonfinity":return 1/0;case"Wacksonegativinfinity":return-1/0;case"Wacksondefined":return;case"Wacksonan":return NaN;case"Wacksonegativezero":return-0;default:return s}}),r=new Map;return hr(n,i=>{if(i._instanceReferenceId!=null){let s=i._instanceReferenceId;delete i._instanceReferenceId,r.set(s,i)}if(t&&i._constructorName){let s=t[i._constructorName];if(!s)throw new Error(`Constructor ${i._constructorName} is not in registry`);Object.setPrototypeOf(i,s.prototype),delete i._constructorName}}),hr(n,(i,s,o)=>{if(i?._instanceReference!=null){let a=r.get(i._instanceReference);if(!a)throw new Error(`Unknown _instanceReference: ${i._instanceReference}`);s[o]=a}}),n}function hr(e,t,n=new WeakSet,r=null,i=null,s=new Set,o=new Set,a=new WeakSet){if(typeof e!="object"||e===null)return{duplicates:s,circular:o};if(n.has(e)){s.add(e),a.has(e)&&o.add(e);return}if(n.add(e),a.add(e),t?.(e,r,i),Array.isArray(e))for(let u=0;u<e.length;u++)hr(e[u],t,n,e,u,s,o,a);else for(let u of Object.keys(e))hr(e[u],t,n,e,u,s,o,a);return a.delete(e),{duplicates:s,circular:o}}var lv=he(ua());var Ot=class{constructor(t,n,r){if(!t?.fromBank)throw new Error(`Do not create entities directly. Go through the Bank. rule: ${JSON.stringify(n)}`);this.rule=n,this.entityId=r,this.state={},this.rule.stateGroups&&Object.entries(this.rule.stateGroups).forEach(([i,s])=>{let o=t?.initialStateGroups?.[i]??Object.keys(s)[0];Object.assign(this.state,s[o])}),this.rule.state&&Object.assign(this.state,this.rule.state)}get attributes(){return{...this.rule,...this,...this.state}}};var sn=class extends Ot{constructor(t,n,r){super(t,n,r),this.entities=[]}placeEntity(t,n="Last"){n==="Last"?this.entities.push(t):n==="First"&&this.entities.unshift(t)}remove(t){this.entities.splice(this.entities.indexOf(t),1)}takeOne(t="First"){if(t==="First")return this.entities.splice(0,1)[0]}isEmpty(){return this.entities.length===0}};var kr=class extends sn{};var on=class extends Ot{constructor(t,n,r){super(t,n,r),this.spaces=this.makeSpaces(t.bank)}makeSpaces(t){return Array(this.getSpacesCount()).fill(void 0).map((n,r)=>t.createEntity({entityType:"Space",index:r}))}getEmptySpaces(){return this.spaces.filter(t=>t.isEmpty())}getSpace(t){if(Array.isArray(t))throw new Error("Numeric index only for SpaceGroup#getSpace");return this.spaces[t]}getEntities(t){return this.getSpace(t).entities}placeEntity(t,n){this.getSpace(t).placeEntity(n)}getSpacesCount(){throw new Error("SpaceGroup#getSpacesCount must be implemented by subclass")}};var Gf=he(Bf());var Ar=class extends on{getSpacesCount(){return this.rule.width*this.rule.height}getRows(){return(0,Gf.default)(this.spaces,this.rule.width)}getCoordinates(t){let{width:n}=this.rule;return[t%n,Math.floor(t/n)]}getIndex([t,n]){let{width:r}=this.rule;return n*r+t}getSpace(t){return Array.isArray(t)?this.spaces[this.getIndex(t)]:this.spaces[t]}getRelativeCoordinates([t,n],[r,i]){let s=[t+r,n+i];return this.areCoordinatesValid(s)?s:null}areCoordinatesValid([t,n]){return t>=0&&n>=0&&t<this.rule.width&&n<this.rule.height}};var av=he(Ba()),uv=he(Bm());var Lg=he(js()),Fg=he(Fa());function fn(e,t){let n=e;for(let r of t){if(n===void 0)return n;if(r&&typeof r=="object"&&"flatten"in r&&r.flatten){if(!Array.isArray(n))return;let i=n.flat();r.map&&(i=i.map(s=>fn(s,r.map))),n=i}else n=n[r]}return n}var nt="INUMBER",Vn="IOP1",zn="IOP2",Kn="IOP3",xt="IVAR",dn="IVARNAME",Ln="IFUNCALL",Ds="IFUNDEF",ze="IEXPR",za="IEXPREVAL",hn="IMEMBER",Bs="IENDSTATEMENT",Fn="IARRAY";function re(e,t){this.type=e,this.value=t??0}re.prototype.toString=function(){switch(this.type){case nt:case Vn:case zn:case Kn:case xt:case dn:case Bs:return this.value;case Ln:return"CALL "+this.value;case Ds:return"DEF "+this.value;case Fn:return"ARRAY "+this.value;case hn:return"."+this.value;default:return"Invalid Instruction"}};function Gs(e){return new re(Vn,e)}function Mt(e){return new re(zn,e)}function Cg(e){return new re(Kn,e)}function Va(e,t,n,r,i){for(var s=[],o=[],a,u,c,l,f=0;f<e.length;f++){var p=e[f],d=p.type;if(d===nt||d===dn)Array.isArray(p.value)?s.push.apply(s,Va(p.value.map(function(h){return new re(nt,h)}).concat(new re(Fn,p.value.length)),t,n,r,i)):s.push(p);else if(d===xt&&i.hasOwnProperty(p.value))p=new re(nt,i[p.value]),s.push(p);else if(d===zn&&s.length>1)u=s.pop(),a=s.pop(),l=n[p.value],p=new re(nt,l(a.value,u.value)),s.push(p);else if(d===Kn&&s.length>2)c=s.pop(),u=s.pop(),a=s.pop(),p.value==="?"?s.push(a.value?u.value:c.value):(l=r[p.value],p=new re(nt,l(a.value,u.value,c.value)),s.push(p));else if(d===Vn&&s.length>0)a=s.pop(),l=t[p.value],p=new re(nt,l(a.value)),s.push(p);else if(d===ze){for(;s.length>0;)o.push(s.shift());o.push(new re(ze,Va(p.value,t,n,r,i)))}else if(d===hn&&s.length>0)a=s.pop(),s.push(new re(nt,a.value[p.value]));else{for(;s.length>0;)o.push(s.shift());o.push(p)}}for(;s.length>0;)o.push(s.shift());return o}function Rg(e,t,n){for(var r=[],i=0;i<e.length;i++){var s=e[i],o=s.type;if(o===xt&&s.value===t)for(var a=0;a<n.tokens.length;a++){var u=n.tokens[a],c;u.type===Vn?c=Gs(u.value):u.type===zn?c=Mt(u.value):u.type===Kn?c=Cg(u.value):c=new re(u.type,u.value),r.push(c)}else o===ze?r.push(new re(ze,Rg(s.value,t,n))):r.push(s)}return r}function pn(e,t,n){var r=[],i,s,o,a,u,c;if(Ka(e))return At(e,n);for(var l=e.length,f=0;f<l;f++){var p=e[f],d=p.type;if(d===nt||d===dn)r.push(p.value);else if(d===zn)s=r.pop(),i=r.pop(),p.value==="and"?r.push(i?!!pn(s,t,n):!1):p.value==="or"?r.push(i?!0:!!pn(s,t,n)):p.value==="="?(a=t.binaryOps[p.value],r.push(a(i,pn(s,t,n),n))):(a=t.binaryOps[p.value],r.push(a(At(i,n),At(s,n))));else if(d===Kn)o=r.pop(),s=r.pop(),i=r.pop(),p.value==="?"?r.push(pn(i?s:o,t,n)):(a=t.ternaryOps[p.value],r.push(a(At(i,n),At(s,n),At(o,n))));else if(d===xt)if(p.value in t.functions)r.push(t.functions[p.value]);else if(p.value in t.unaryOps&&t.parser.isOperatorEnabled(p.value))r.push(t.unaryOps[p.value]);else{var h=n[p.value];if(h!==void 0)r.push(h);else throw new Error("undefined variable: "+p.value)}else if(d===Vn)i=r.pop(),a=t.unaryOps[p.value],r.push(a(At(i,n)));else if(d===Ln){for(c=p.value,u=[];c-- >0;)u.unshift(At(r.pop(),n));if(a=r.pop(),a.apply&&a.call)r.push(a.apply(void 0,u));else throw new Error(a+" is not a function")}else if(d===Ds)r.push(function(){for(var y=r.pop(),m=[],b=p.value;b-- >0;)m.unshift(r.pop());var g=r.pop(),k=function(){for(var I=Object.assign({},n),j=0,C=m.length;j<C;j++)I[m[j]]=arguments[j];return pn(y,t,I)};return Object.defineProperty(k,"name",{value:g,writable:!1}),n[g]=k,k}());else if(d===ze)r.push(xT(p,t));else if(d===za)r.push(p);else if(d===hn)i=r.pop(),r.push(i[p.value]);else if(d===Bs)r.pop();else if(d===Fn){for(c=p.value,u=[];c-- >0;)u.unshift(r.pop());r.push(u)}else throw new Error("invalid Expression")}if(r.length>1)throw new Error("invalid Expression (parity)");return r[0]===0?0:At(r[0],n)}function xT(e,t,n){return Ka(e)?e:{type:za,value:function(r){return pn(e.value,t,r)}}}function Ka(e){return e&&e.type===za}function At(e,t){return Ka(e)?e.value(t):e}function Ha(e,t){for(var n=[],r,i,s,o,a,u,c=0;c<e.length;c++){var l=e[c],f=l.type;if(f===nt)typeof l.value=="number"&&l.value<0?n.push("("+l.value+")"):Array.isArray(l.value)?n.push("["+l.value.map(Og).join(", ")+"]"):n.push(Og(l.value));else if(f===zn)i=n.pop(),r=n.pop(),o=l.value,t?o==="^"?n.push("Math.pow("+r+", "+i+")"):o==="and"?n.push("(!!"+r+" && !!"+i+")"):o==="or"?n.push("(!!"+r+" || !!"+i+")"):o==="||"?n.push("(function(a,b){ return Array.isArray(a) && Array.isArray(b) ? a.concat(b) : String(a) + String(b); }(("+r+"),("+i+")))"):o==="=="?n.push("("+r+" === "+i+")"):o==="!="?n.push("("+r+" !== "+i+")"):o==="["?n.push(r+"[("+i+") | 0]"):n.push("("+r+" "+o+" "+i+")"):o==="["?n.push(r+"["+i+"]"):n.push("("+r+" "+o+" "+i+")");else if(f===Kn)if(s=n.pop(),i=n.pop(),r=n.pop(),o=l.value,o==="?")n.push("("+r+" ? "+i+" : "+s+")");else throw new Error("invalid Expression");else if(f===xt||f===dn)n.push(l.value);else if(f===Vn)r=n.pop(),o=l.value,o==="-"||o==="+"?n.push("("+o+r+")"):t?o==="not"?n.push("(!"+r+")"):o==="!"?n.push("fac("+r+")"):n.push(o+"("+r+")"):o==="!"?n.push("("+r+"!)"):n.push("("+o+" "+r+")");else if(f===Ln){for(u=l.value,a=[];u-- >0;)a.unshift(n.pop());o=n.pop(),n.push(o+"("+a.join(", ")+")")}else if(f===Ds){for(i=n.pop(),u=l.value,a=[];u-- >0;)a.unshift(n.pop());r=n.pop(),t?n.push("("+r+" = function("+a.join(", ")+") { return "+i+" })"):n.push("("+r+"("+a.join(", ")+") = "+i+")")}else if(f===hn)r=n.pop(),n.push(r+"."+l.value);else if(f===Fn){for(u=l.value,a=[];u-- >0;)a.unshift(n.pop());n.push("["+a.join(", ")+"]")}else if(f===ze)n.push("("+Ha(l.value,t)+")");else if(f!==Bs)throw new Error("invalid Expression")}return n.length>1&&(t?n=[n.join(",")]:n=[n.join(";")]),String(n[0])}function Og(e){return typeof e=="string"?JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029"):e}function Gn(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return!0;return!1}function Wa(e,t,n){n=n||{};for(var r=!!n.withMembers,i=null,s=0;s<e.length;s++){var o=e[s];o.type===xt||o.type===dn?!r&&!Gn(t,o.value)?t.push(o.value):(i!==null&&(Gn(t,i)||t.push(i)),i=o.value):o.type===hn&&r&&i!==null?i+="."+o.value:o.type===ze?Wa(o.value,t,n):i!==null&&(Gn(t,i)||t.push(i),i=null)}i!==null&&!Gn(t,i)&&t.push(i)}function st(e,t){this.tokens=e,this.parser=t,this.unaryOps=t.unaryOps,this.binaryOps=t.binaryOps,this.ternaryOps=t.ternaryOps,this.functions=t.functions}st.prototype.simplify=function(e){return e=e||{},new st(Va(this.tokens,this.unaryOps,this.binaryOps,this.ternaryOps,e),this.parser)};st.prototype.substitute=function(e,t){return t instanceof st||(t=this.parser.parse(String(t))),new st(Rg(this.tokens,e,t),this.parser)};st.prototype.evaluate=function(e){return e=e||{},pn(this.tokens,this,e)};st.prototype.toString=function(){return Ha(this.tokens,!1)};st.prototype.symbols=function(e){e=e||{};var t=[];return Wa(this.tokens,t,e),t};st.prototype.variables=function(e){e=e||{};var t=[];Wa(this.tokens,t,e);var n=this.functions;return t.filter(function(r){return!(r in n)})};st.prototype.toJSFunction=function(e,t){var n=this,r=new Function(e,"with(this.functions) with (this.ternaryOps) with (this.binaryOps) with (this.unaryOps) { return "+Ha(this.simplify(t).tokens,!0)+"; }");return function(){return r.apply(n,arguments)}};var Dr="TEOF",me="TOP",Ls="TNUMBER",Ng="TSTRING",Tt="TPAREN",Un="TBRACKET",Fs="TCOMMA",Ja="TNAME",Ya="TSEMICOLON";function jg(e,t,n){this.type=e,this.value=t,this.index=n}jg.prototype.toString=function(){return this.type+": "+this.value};function Te(e,t){this.pos=0,this.current=null,this.unaryOps=e.unaryOps,this.binaryOps=e.binaryOps,this.ternaryOps=e.ternaryOps,this.consts=e.consts,this.expression=t,this.savedPosition=0,this.savedCurrent=null,this.options=e.options,this.parser=e}Te.prototype.newToken=function(e,t,n){return new jg(e,t,n??this.pos)};Te.prototype.save=function(){this.savedPosition=this.pos,this.savedCurrent=this.current};Te.prototype.restore=function(){this.pos=this.savedPosition,this.current=this.savedCurrent};Te.prototype.next=function(){if(this.pos>=this.expression.length)return this.newToken(Dr,"EOF");if(this.isWhitespace()||this.isComment())return this.next();if(this.isRadixInteger()||this.isNumber()||this.isOperator()||this.isString()||this.isParen()||this.isBracket()||this.isComma()||this.isSemicolon()||this.isNamedOp()||this.isConst()||this.isName())return this.current;this.parseError('Unknown character "'+this.expression.charAt(this.pos)+'"')};Te.prototype.isString=function(){var e=!1,t=this.pos,n=this.expression.charAt(t);if(n==="'"||n==='"')for(var r=this.expression.indexOf(n,t+1);r>=0&&this.pos<this.expression.length;){if(this.pos=r+1,this.expression.charAt(r-1)!=="\\"){var i=this.expression.substring(t+1,r);this.current=this.newToken(Ng,this.unescape(i),t),e=!0;break}r=this.expression.indexOf(n,r+1)}return e};Te.prototype.isParen=function(){var e=this.expression.charAt(this.pos);return e==="("||e===")"?(this.current=this.newToken(Tt,e),this.pos++,!0):!1};Te.prototype.isBracket=function(){var e=this.expression.charAt(this.pos);return(e==="["||e==="]")&&this.isOperatorEnabled("[")?(this.current=this.newToken(Un,e),this.pos++,!0):!1};Te.prototype.isComma=function(){var e=this.expression.charAt(this.pos);return e===","?(this.current=this.newToken(Fs,","),this.pos++,!0):!1};Te.prototype.isSemicolon=function(){var e=this.expression.charAt(this.pos);return e===";"?(this.current=this.newToken(Ya,";"),this.pos++,!0):!1};Te.prototype.isConst=function(){for(var e=this.pos,t=e;t<this.expression.length;t++){var n=this.expression.charAt(t);if(n.toUpperCase()===n.toLowerCase()&&(t===this.pos||n!=="_"&&n!=="."&&(n<"0"||n>"9")))break}if(t>e){var r=this.expression.substring(e,t);if(r in this.consts)return this.current=this.newToken(Ls,this.consts[r]),this.pos+=r.length,!0}return!1};Te.prototype.isNamedOp=function(){for(var e=this.pos,t=e;t<this.expression.length;t++){var n=this.expression.charAt(t);if(n.toUpperCase()===n.toLowerCase()&&(t===this.pos||n!=="_"&&(n<"0"||n>"9")))break}if(t>e){var r=this.expression.substring(e,t);if(this.isOperatorEnabled(r)&&(r in this.binaryOps||r in this.unaryOps||r in this.ternaryOps))return this.current=this.newToken(me,r),this.pos+=r.length,!0}return!1};Te.prototype.isName=function(){for(var e=this.pos,t=e,n=!1;t<this.expression.length;t++){var r=this.expression.charAt(t);if(r.toUpperCase()===r.toLowerCase()){if(t===this.pos&&(r==="$"||r==="_")){r==="_"&&(n=!0);continue}else if(t===this.pos||!n||r!=="_"&&(r<"0"||r>"9"))break}else n=!0}if(n){var i=this.expression.substring(e,t);return this.current=this.newToken(Ja,i),this.pos+=i.length,!0}return!1};Te.prototype.isWhitespace=function(){for(var e=!1,t=this.expression.charAt(this.pos);(t===" "||t===" "||t===`
|
|
5
|
+
`||t==="\r")&&(e=!0,this.pos++,!(this.pos>=this.expression.length));)t=this.expression.charAt(this.pos);return e};var TT=/^[0-9a-f]{4}$/i;Te.prototype.unescape=function(e){var t=e.indexOf("\\");if(t<0)return e;for(var n=e.substring(0,t);t>=0;){var r=e.charAt(++t);switch(r){case"'":n+="'";break;case'"':n+='"';break;case"\\":n+="\\";break;case"/":n+="/";break;case"b":n+="\b";break;case"f":n+="\f";break;case"n":n+=`
|
|
6
|
+
`;break;case"r":n+="\r";break;case"t":n+=" ";break;case"u":var i=e.substring(t+1,t+5);TT.test(i)||this.parseError("Illegal escape sequence: \\u"+i),n+=String.fromCharCode(parseInt(i,16)),t+=4;break;default:throw this.parseError('Illegal escape sequence: "\\'+r+'"')}++t;var s=e.indexOf("\\",t);n+=e.substring(t,s<0?e.length:s),t=s}return n};Te.prototype.isComment=function(){var e=this.expression.charAt(this.pos);return e==="/"&&this.expression.charAt(this.pos+1)==="*"?(this.pos=this.expression.indexOf("*/",this.pos)+2,this.pos===1&&(this.pos=this.expression.length),!0):!1};Te.prototype.isRadixInteger=function(){var e=this.pos;if(e>=this.expression.length-2||this.expression.charAt(e)!=="0")return!1;++e;var t,n;if(this.expression.charAt(e)==="x")t=16,n=/^[0-9a-f]$/i,++e;else if(this.expression.charAt(e)==="b")t=2,n=/^[01]$/i,++e;else return!1;for(var r=!1,i=e;e<this.expression.length;){var s=this.expression.charAt(e);if(n.test(s))e++,r=!0;else break}return r&&(this.current=this.newToken(Ls,parseInt(this.expression.substring(i,e),t)),this.pos=e),r};Te.prototype.isNumber=function(){for(var e=!1,t=this.pos,n=t,r=t,i=!1,s=!1,o;t<this.expression.length&&(o=this.expression.charAt(t),o>="0"&&o<="9"||!i&&o===".");)o==="."?i=!0:s=!0,t++,e=s;if(e&&(r=t),o==="e"||o==="E"){t++;for(var a=!0,u=!1;t<this.expression.length;){if(o=this.expression.charAt(t),a&&(o==="+"||o==="-"))a=!1;else if(o>="0"&&o<="9")u=!0,a=!1;else break;t++}u||(t=r)}return e?(this.current=this.newToken(Ls,parseFloat(this.expression.substring(n,t))),this.pos=t):this.pos=r,e};Te.prototype.isOperator=function(){var e=this.pos,t=this.expression.charAt(this.pos);if(t==="+"||t==="-"||t==="*"||t==="/"||t==="%"||t==="^"||t==="?"||t===":"||t===".")this.current=this.newToken(me,t);else if(t==="\u2219"||t==="\u2022")this.current=this.newToken(me,"*");else if(t===">")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(me,">="),this.pos++):this.current=this.newToken(me,">");else if(t==="<")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(me,"<="),this.pos++):this.current=this.newToken(me,"<");else if(t==="|")if(this.expression.charAt(this.pos+1)==="|")this.current=this.newToken(me,"||"),this.pos++;else return!1;else if(t==="=")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(me,"=="),this.pos++):this.current=this.newToken(me,t);else if(t==="!")this.expression.charAt(this.pos+1)==="="?(this.current=this.newToken(me,"!="),this.pos++):this.current=this.newToken(me,t);else return!1;return this.pos++,this.isOperatorEnabled(this.current.value)?!0:(this.pos=e,!1)};Te.prototype.isOperatorEnabled=function(e){return this.parser.isOperatorEnabled(e)};Te.prototype.getCoordinates=function(){var e=0,t,n=-1;do e++,t=this.pos-n,n=this.expression.indexOf(`
|
|
7
|
+
`,n+1);while(n>=0&&n<this.pos);return{line:e,column:t}};Te.prototype.parseError=function(e){var t=this.getCoordinates();throw new Error("parse error ["+t.line+":"+t.column+"]: "+e)};function we(e,t,n){this.parser=e,this.tokens=t,this.current=null,this.nextToken=null,this.next(),this.savedCurrent=null,this.savedNextToken=null,this.allowMemberAccess=n.allowMemberAccess!==!1}we.prototype.next=function(){return this.current=this.nextToken,this.nextToken=this.tokens.next()};we.prototype.tokenMatches=function(e,t){return typeof t>"u"?!0:Array.isArray(t)?Gn(t,e.value):typeof t=="function"?t(e):e.value===t};we.prototype.save=function(){this.savedCurrent=this.current,this.savedNextToken=this.nextToken,this.tokens.save()};we.prototype.restore=function(){this.tokens.restore(),this.current=this.savedCurrent,this.nextToken=this.savedNextToken};we.prototype.accept=function(e,t){return this.nextToken.type===e&&this.tokenMatches(this.nextToken,t)?(this.next(),!0):!1};we.prototype.expect=function(e,t){if(!this.accept(e,t)){var n=this.tokens.getCoordinates();throw new Error("parse error ["+n.line+":"+n.column+"]: Expected "+(t||e))}};we.prototype.parseAtom=function(e){var t=this.tokens.unaryOps;function n(i){return i.value in t}if(this.accept(Ja)||this.accept(me,n))e.push(new re(xt,this.current.value));else if(this.accept(Ls))e.push(new re(nt,this.current.value));else if(this.accept(Ng))e.push(new re(nt,this.current.value));else if(this.accept(Tt,"("))this.parseExpression(e),this.expect(Tt,")");else if(this.accept(Un,"["))if(this.accept(Un,"]"))e.push(new re(Fn,0));else{var r=this.parseArrayList(e);e.push(new re(Fn,r))}else throw new Error("unexpected "+this.nextToken)};we.prototype.parseExpression=function(e){var t=[];this.parseUntilEndStatement(e,t)||(this.parseVariableAssignmentExpression(t),!this.parseUntilEndStatement(e,t)&&this.pushExpression(e,t))};we.prototype.pushExpression=function(e,t){for(var n=0,r=t.length;n<r;n++)e.push(t[n])};we.prototype.parseUntilEndStatement=function(e,t){return this.accept(Ya)?(this.nextToken&&this.nextToken.type!==Dr&&!(this.nextToken.type===Tt&&this.nextToken.value===")")&&t.push(new re(Bs)),this.nextToken.type!==Dr&&this.parseExpression(t),e.push(new re(ze,t)),!0):!1};we.prototype.parseArrayList=function(e){for(var t=0;!this.accept(Un,"]");)for(this.parseExpression(e),++t;this.accept(Fs);)this.parseExpression(e),++t;return t};we.prototype.parseVariableAssignmentExpression=function(e){for(this.parseConditionalExpression(e);this.accept(me,"=");){var t=e.pop(),n=[],r=e.length-1;if(t.type===Ln){if(!this.tokens.isOperatorEnabled("()="))throw new Error("function definition is not permitted");for(var i=0,s=t.value+1;i<s;i++){var o=r-i;e[o].type===xt&&(e[o]=new re(dn,e[o].value))}this.parseVariableAssignmentExpression(n),e.push(new re(ze,n)),e.push(new re(Ds,t.value));continue}if(t.type!==xt&&t.type!==hn)throw new Error("expected variable for assignment");this.parseVariableAssignmentExpression(n),e.push(new re(dn,t.value)),e.push(new re(ze,n)),e.push(Mt("="))}};we.prototype.parseConditionalExpression=function(e){for(this.parseOrExpression(e);this.accept(me,"?");){var t=[],n=[];this.parseConditionalExpression(t),this.expect(me,":"),this.parseConditionalExpression(n),e.push(new re(ze,t)),e.push(new re(ze,n)),e.push(Cg("?"))}};we.prototype.parseOrExpression=function(e){for(this.parseAndExpression(e);this.accept(me,"or");){var t=[];this.parseAndExpression(t),e.push(new re(ze,t)),e.push(Mt("or"))}};we.prototype.parseAndExpression=function(e){for(this.parseComparison(e);this.accept(me,"and");){var t=[];this.parseComparison(t),e.push(new re(ze,t)),e.push(Mt("and"))}};var MT=["==","!=","<","<=",">=",">","in"];we.prototype.parseComparison=function(e){for(this.parseAddSub(e);this.accept(me,MT);){var t=this.current;this.parseAddSub(e),e.push(Mt(t.value))}};var IT=["+","-","||"];we.prototype.parseAddSub=function(e){for(this.parseTerm(e);this.accept(me,IT);){var t=this.current;this.parseTerm(e),e.push(Mt(t.value))}};var CT=["*","/","%"];we.prototype.parseTerm=function(e){for(this.parseFactor(e);this.accept(me,CT);){var t=this.current;this.parseFactor(e),e.push(Mt(t.value))}};we.prototype.parseFactor=function(e){var t=this.tokens.unaryOps;function n(i){return i.value in t}if(this.save(),this.accept(me,n)){if(this.current.value!=="-"&&this.current.value!=="+"){if(this.nextToken.type===Tt&&this.nextToken.value==="("){this.restore(),this.parseExponential(e);return}else if(this.nextToken.type===Ya||this.nextToken.type===Fs||this.nextToken.type===Dr||this.nextToken.type===Tt&&this.nextToken.value===")"){this.restore(),this.parseAtom(e);return}}var r=this.current;this.parseFactor(e),e.push(Gs(r.value))}else this.parseExponential(e)};we.prototype.parseExponential=function(e){for(this.parsePostfixExpression(e);this.accept(me,"^");)this.parseFactor(e),e.push(Mt("^"))};we.prototype.parsePostfixExpression=function(e){for(this.parseFunctionCall(e);this.accept(me,"!");)e.push(Gs("!"))};we.prototype.parseFunctionCall=function(e){var t=this.tokens.unaryOps;function n(s){return s.value in t}if(this.accept(me,n)){var r=this.current;this.parseAtom(e),e.push(Gs(r.value))}else for(this.parseMemberExpression(e);this.accept(Tt,"(");)if(this.accept(Tt,")"))e.push(new re(Ln,0));else{var i=this.parseArgumentList(e);e.push(new re(Ln,i))}};we.prototype.parseArgumentList=function(e){for(var t=0;!this.accept(Tt,")");)for(this.parseExpression(e),++t;this.accept(Fs);)this.parseExpression(e),++t;return t};we.prototype.parseMemberExpression=function(e){for(this.parseAtom(e);this.accept(me,".")||this.accept(Un,"[");){var t=this.current;if(t.value==="."){if(!this.allowMemberAccess)throw new Error('unexpected ".", member access is not permitted');this.expect(Ja),e.push(new re(hn,this.current.value))}else if(t.value==="["){if(!this.tokens.isOperatorEnabled("["))throw new Error('unexpected "[]", arrays are disabled');this.parseExpression(e),this.expect(Un,"]"),e.push(Mt("["))}else throw new Error("unexpected symbol: "+t.value)}};function RT(e,t){return Number(e)+Number(t)}function NT(e,t){return e-t}function jT(e,t){return e*t}function qT(e,t){return e/t}function DT(e,t){return e%t}function BT(e,t){return Array.isArray(e)&&Array.isArray(t)?e.concat(t):""+e+t}function GT(e,t){return e===t}function LT(e,t){return e!==t}function FT(e,t){return e>t}function UT(e,t){return e<t}function VT(e,t){return e>=t}function zT(e,t){return e<=t}function KT(e,t){return!!(e&&t)}function HT(e,t){return!!(e||t)}function WT(e,t){return Gn(t,e)}function JT(e){return(Math.exp(e)-Math.exp(-e))/2}function YT(e){return(Math.exp(e)+Math.exp(-e))/2}function $T(e){return e===1/0?1:e===-1/0?-1:(Math.exp(e)-Math.exp(-e))/(Math.exp(e)+Math.exp(-e))}function XT(e){return e===-1/0?e:Math.log(e+Math.sqrt(e*e+1))}function QT(e){return Math.log(e+Math.sqrt(e*e-1))}function ZT(e){return Math.log((1+e)/(1-e))/2}function Sg(e){return Math.log(e)*Math.LOG10E}function eM(e){return-e}function tM(e){return!e}function nM(e){return e<0?Math.ceil(e):Math.floor(e)}function rM(e){return Math.random()*(e||1)}function Ag(e){return $a(e+1)}function iM(e){return isFinite(e)&&e===Math.round(e)}var sM=4.7421875,Ua=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];function $a(e){var t,n;if(iM(e)){if(e<=0)return isFinite(e)?1/0:NaN;if(e>171)return 1/0;for(var r=e-2,i=e-1;r>1;)i*=r,r--;return i===0&&(i=1),i}if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*$a(1-e));if(e>=171.35)return 1/0;if(e>85){var s=e*e,o=s*e,a=o*e,u=a*e;return Math.sqrt(2*Math.PI/e)*Math.pow(e/Math.E,e)*(1+1/(12*e)+1/(288*s)-139/(51840*o)-571/(2488320*a)+163879/(209018880*u)+5246819/(75246796800*u*e))}--e,n=Ua[0];for(var c=1;c<Ua.length;++c)n+=Ua[c]/(e+c);return t=e+sM+.5,Math.sqrt(2*Math.PI)*Math.pow(t,e+.5)*Math.exp(-t)*n}function oM(e){return Array.isArray(e)?e.length:String(e).length}function xg(){for(var e=0,t=0,n=0;n<arguments.length;n++){var r=Math.abs(arguments[n]),i;t<r?(i=t/r,e=e*i*i+1,t=r):r>0?(i=r/t,e+=i*i):e+=r}return t===1/0?1/0:t*Math.sqrt(e)}function Tg(e,t,n){return e?t:n}function aM(e,t){return typeof t>"u"||+t==0?Math.round(e):(e=+e,t=-+t,isNaN(e)||!(typeof t=="number"&&t%1===0)?NaN:(e=e.toString().split("e"),e=Math.round(+(e[0]+"e"+(e[1]?+e[1]-t:-t))),e=e.toString().split("e"),+(e[0]+"e"+(e[1]?+e[1]+t:t))))}function uM(e,t,n){return n&&(n[e]=t),t}function cM(e,t){return e[t|0]}function lM(e){return arguments.length===1&&Array.isArray(e)?Math.max.apply(Math,e):Math.max.apply(Math,arguments)}function fM(e){return arguments.length===1&&Array.isArray(e)?Math.min.apply(Math,e):Math.min.apply(Math,arguments)}function pM(e,t){if(typeof e!="function")throw new Error("First argument to map is not a function");if(!Array.isArray(t))throw new Error("Second argument to map is not an array");return t.map(function(n,r){return e(n,r)})}function dM(e,t,n){if(typeof e!="function")throw new Error("First argument to fold is not a function");if(!Array.isArray(n))throw new Error("Second argument to fold is not an array");return n.reduce(function(r,i,s){return e(r,i,s)},t)}function hM(e,t){if(typeof e!="function")throw new Error("First argument to filter is not a function");if(!Array.isArray(t))throw new Error("Second argument to filter is not an array");return t.filter(function(n,r){return e(n,r)})}function mM(e,t){if(!(Array.isArray(t)||typeof t=="string"))throw new Error("Second argument to indexOf is not a string or array");return t.indexOf(e)}function gM(e,t){if(!Array.isArray(t))throw new Error("Second argument to join is not an array");return t.join(e)}function yM(e){return(e>0)-(e<0)||+e}var Mg=1/3;function vM(e){return e<0?-Math.pow(-e,Mg):Math.pow(e,Mg)}function bM(e){return Math.exp(e)-1}function wM(e){return Math.log(1+e)}function _M(e){return Math.log(e)/Math.LN2}function Wt(e){this.options=e||{},this.unaryOps={sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:Math.asin,acos:Math.acos,atan:Math.atan,sinh:Math.sinh||JT,cosh:Math.cosh||YT,tanh:Math.tanh||$T,asinh:Math.asinh||XT,acosh:Math.acosh||QT,atanh:Math.atanh||ZT,sqrt:Math.sqrt,cbrt:Math.cbrt||vM,log:Math.log,log2:Math.log2||_M,ln:Math.log,lg:Math.log10||Sg,log10:Math.log10||Sg,expm1:Math.expm1||bM,log1p:Math.log1p||wM,abs:Math.abs,ceil:Math.ceil,floor:Math.floor,round:Math.round,trunc:Math.trunc||nM,"-":eM,"+":Number,exp:Math.exp,not:tM,length:oM,"!":Ag,sign:Math.sign||yM},this.binaryOps={"+":RT,"-":NT,"*":jT,"/":qT,"%":DT,"^":Math.pow,"||":BT,"==":GT,"!=":LT,">":FT,"<":UT,">=":VT,"<=":zT,and:KT,or:HT,in:WT,"=":uM,"[":cM},this.ternaryOps={"?":Tg},this.functions={random:rM,fac:Ag,min:fM,max:lM,hypot:Math.hypot||xg,pyt:Math.hypot||xg,pow:Math.pow,atan2:Math.atan2,if:Tg,gamma:$a,roundTo:aM,map:pM,fold:dM,filter:hM,indexOf:mM,join:gM},this.consts={E:Math.E,PI:Math.PI,true:!0,false:!1}}Wt.prototype.parse=function(e){var t=[],n=new we(this,new Te(this,e),{allowMemberAccess:this.options.allowMemberAccess});return n.parseExpression(t),n.expect(Dr,"EOF"),new st(t,this)};Wt.prototype.evaluate=function(e,t){return this.parse(e).evaluate(t)};var qg=new Wt;Wt.parse=function(e){return qg.parse(e)};Wt.evaluate=function(e,t){return qg.parse(e).evaluate(t)};var Ig={"+":"add","-":"subtract","*":"multiply","/":"divide","%":"remainder","^":"power","!":"factorial","<":"comparison",">":"comparison","<=":"comparison",">=":"comparison","==":"comparison","!=":"comparison","||":"concatenate",and:"logical",or:"logical",not:"logical","?":"conditional",":":"conditional","=":"assignment","[":"array","()=":"fndef"};function kM(e){return Ig.hasOwnProperty(e)?Ig[e]:e}Wt.prototype.isOperatorEnabled=function(e){var t=kM(e),n=this.options.operators||{};return!(t in n)||!!n[t]};var Dg=new Wt;Dg.functions.sum=(...e)=>e[0].reduce((t,n)=>t+n,0);function Br(e,t,n){let r=pe(e,t.arguments,n);return Dg.evaluate(t.expression,r)}var Bg=he(js());function Je(e){return e.G.bank}var PM=["state"];function Gr(e,t,n,r){return!PM.includes(r??"")&&(0,Bg.default)(t)?Je(e).find(e,t,n):t}var EM=["conditions","move","then","mapping"];function pe(e,t,n={},r){if(!(0,Lg.default)(t)&&!Array.isArray(t))return t;let i=Array.isArray(t)?[...t]:{...t};Object.entries(t).forEach(([a,u])=>{EM.includes(a)||(i[a]=pe(e,u,n,a))});let s=OM(e,i,n);return s?.resolveAsEntity||r==="target"||r==="targets"?Gr(e,s,n,r):s}function OM(e,t,n){let r=t;if(r?.type==="expression"){let i=r;return Br(e,{...i,arguments:pe(e,i.arguments,n,"arguments")},n)}else{if(r?.type==="count")return Je(e).findAll(e,t,n).length;if(r?.type==="contextPath")return fn(n,r.path);if(r?.type==="ctxPath")return fn(e.ctx,r.path);if(r?.type==="gamePath")return fn(e.G,r.path);if(r?.type==="relativePath"||r?.type==="RelativePath"){let i=pe(e,r.target,n,"target");return fn(i?.attributes,r.path)??null}else if(r?.type==="parent"||r?.type==="Parent"){let i=r.target?pe(e,r.target,n,"target"):n.originalTarget;return Je(e).findParent(i)??null}else{if(r?.type==="map")return Gg(e,r.targets,r.mapping,n).map(i=>i.value);if(r?.type==="mapMax"){let i=Gg(e,r.targets,r.mapping,n),s,o=[];for(let a=0,u=i.length;a<u;a++){let{target:c,value:l}=i[a];s===void 0||l>s?(s=l,o.length=0,o.push(c)):l===s&&o.push(c)}return o}else if(r?.type==="pick"||r?.type==="Pick"){let i=pe(e,r.target,n,"target");return(0,Fg.default)(pe(e,i?.attributes,n,"attributes"),r.properties)}else if(r?.type==="coordinates"||r?.type==="Coordinates"){let i=r.target?pe(e,r.target,n,"target"):n.originalTarget;return Je(e).findParent(i).getCoordinates(i.rule.index)}else if(r?.type==="relativeCoordinates"){let i=r.target?pe(e,r.target,n,"target"):n.originalTarget,s=Je(e).findParent(i),o=s.getCoordinates(i.rule.index),a=s.getRelativeCoordinates(o,pe(e,r.location,n,"location"));return(a&&s.spaces[s.getIndex(a)])??null}else return t}}}function Gg(e,t,n,r){return t.resolveAsEntity=!0,pe(e,t,r)?.map(s=>({target:s,value:pe(e,n,{...r,loopTarget:s})}))??[]}var oe=class{constructor(t){this.rule=t}check(t,n,r){let i={...n},s={...r};i.target&&(s.originalTarget=i.target);let o=pe(t,this.rule,s);return o.target!==void 0&&(i.target=o.target),this.rule.target!==void 0&&!i.target?{conditionIsMet:!1}:this.checkCondition(t,o,i,s)}isMet(...t){return this.check(t[0],t[1]??{},t[2]??{}).conditionIsMet}};var ev=he(Ur());function dR(e,t,n){let r={...t};return delete r.state,delete r.stateGroups,pe(e,r,n)}function hR(e){return{...e.rule,...e.state}}function Qa(e,t,n,r){return(0,ev.default)(dR(e,t,r))(hR(n))}var Vr=class extends oe{checkCondition(t,n,{target:r},i){return this.rule.entity&&r!==n.entity?{target:r,conditionIsMet:!1}:{target:r,conditionIsMet:Qa(t,n.matcher,r,i)}}};var zr=class extends oe{checkCondition(t,n,r,i){return{conditionIsMet:!Oe(t,n.conditions,r,i).conditionsAreMet}}};function Za(e,t=[],n,r){let i;for(let s of t){let o=mn(s).check(e,n,r);if(o.conditionIsMet){i={...o,conditionRule:s};break}}return i}var Kr=class extends oe{checkCondition(t,n,r,i){return{conditionIsMet:!!Za(t,n.conditions,r,i)}}};var Hr=class extends oe{checkCondition(t,n,r,i){let o=r.target.find(a=>{let u={...i,loopTarget:a};return Oe(t,n.conditions,void 0,u).conditionsAreMet});return{conditionIsMet:!!o,result:o}}};var Wr=class extends oe{checkCondition(t,n,r,i){let o=r.target.map(a=>{let u={...i,loopTarget:a};return Oe(t,n.conditions,void 0,u)});return{conditionIsMet:o.every(a=>a.conditionsAreMet),results:o}}};var rG=he(Ur());var Jr=class extends oe{checkCondition(t,n,r,i){let s=r.target;if(s){let a=(s.entities??s.spaces)?.filter(u=>Oe(t,n.conditions,{target:u},i).conditionsAreMet)??[];return{matches:a,conditionIsMet:!!a.length}}else return{matches:[],conditionIsMet:!1}}};var tv=he(Fa());var Yr=class extends oe{checkCondition(t,n,r,i){let{targets:s}=r;if(s.length===1&&s[0].entities?.length)return{conditionIsMet:!0};let[o,...a]=s;return{conditionIsMet:(o.entities??[]).some(c=>{let f=mn({conditionType:"Contains",conditions:[{conditionType:"Is",matcher:(0,tv.default)(c.rule,n.properties)}]});return f?a.every(p=>f.isMet(t,{target:p})):!1})}}};var fG=he(Ur());var mR=[[1,0],[0,1],[1,1],[-1,1]],nv=new WeakMap;function gR(e,t){let n={moveInstance:t.moveInstance?.id,moveArguments:t.moveArguments};return JSON.stringify({pattern:e,context:n})}function yR(e){return(e.entities||[]).map(n=>{let r=n.entities||[];return r.length===0?"empty":r.map(i=>{let s=Object.keys(i).sort(),o={};return s.forEach(a=>{o[a]=i[a]}),JSON.stringify(o)}).sort().join("|")}).join(",")}function rv(e,t,n,r,i,s=!1){let o=[],a=t.length,u=0;for(;u<=a-r;){let c=wR(e,t,u,n,i,s);c&&o.push(c),u++}return o}function vR(e,t,n){let{width:r,height:i}=e.attributes,s=[];if(t===1&&n===0)for(let o=0;o<i;o++)s.push([0,o]);else if(t===0&&n===1)for(let o=0;o<r;o++)s.push([o,0]);else if(t===1&&n===1){for(let o=0;o<r;o++)s.push([o,0]);for(let o=1;o<i;o++)s.push([0,o])}else if(t===-1&&n===1){for(let o=0;o<r;o++)s.push([o,0]);for(let o=1;o<i;o++)s.push([r-1,o])}return s}function bR(e,t,n,r,i){let s=[],[o,a]=[t,n];for(;e.areCoordinatesValid([o,a]);)s.push(e.getSpace([o,a])),o+=r,a+=i;return s}function wR(e,t,n,r,i,s=!1){let o=n,a=[],u=t.length;for(let c of r){let{count:l,minCount:f,maxCount:p,conditions:d}=c,h,y;l!==void 0?h=y=l:f!==void 0||p!==void 0?(h=f||0,y=p||1/0):h=y=1;let m=0,b=[];for(;m<y&&o<u;){let g=s?t[u-1-o]:t[o];if(_R(e,g,d,b,i))b.push(g),m++,o++;else break}if(m<h)return null;a.push(...b)}return a.length>0?a:null}function _R(e,t,n,r=[],i){return Oe(e,n,{target:t,targets:[t,...r]},i).conditionsAreMet}function $r(e,t,n,r){let i=gR(n,r),s=nv.get(t);s||(s=new Map,nv.set(t,s));let o=yR(t),a=s.get(i);if(a&&a.stateKey===o)return a.result;let u=[],c=n.reduce((f,p)=>f+(p.minCount||p.count||1),0);for(let[f,p]of mR){let d=vR(t,f,p);for(let[h,y]of d){let m=bR(t,h,y,f,p);if(m.length<c)continue;let b=rv(e,m,n,c,r);if(u.push(...b),b.length===0||n.length>1){let g=rv(e,m,n,c,r,!0);u.push(...g)}}}let l={matches:u,conditionIsMet:!!u.length};return s.set(i,{stateKey:o,result:l}),l}var Xr=class extends oe{checkCondition(t,n,r,i){let{G:s}=t,{target:o}=r,a=s.bank.findParent(r.target),{matches:u}=$r(t,a,n.sequence,i),c=u.filter(l=>l.some(f=>f===o));return{matches:c,conditionIsMet:!!c.length}}};var Qr=class extends oe{checkCondition(t,n,r,i){let{matches:s}=$r(t,r.target,n.sequence,i);return{matches:s,conditionIsMet:!!s.length}}};var Zr=class extends oe{checkCondition(t,n,r,i){return{conditionIsMet:r.target.spaces.every(o=>o?.entities?.length)}}};function ei(e,t,n){let r=Ut(He(e.G),ht),i={...e,G:r},s={...t,arguments:{}};return Object.entries(t.arguments).forEach(([o,a])=>{s.arguments[o]=a.abstract?a:r.bank.locate(typeof a=="number"?a:a.entityId)}),n.moveInstance.doMove(i,s,n,{skipCheck:!0}),r}var kR={PlaceNew:["destination"],RemoveEntity:["entity"],MoveEntity:["entity","destination"],TakeFrom:["source","destination"],SetState:["entity","state"]},ti=class extends oe{checkCondition(t,n,r,i){let s=r.target,o=r.targets??[s],a=i.moveInstance?.rule?.moveType,u=a?kR[a]:void 0,c={arguments:o.reduce((y,m,b)=>{let g=u?.[b]??`arg${b}`;return{...y,[g]:m}},{})},l=ei(t,c,i),f={};s?f={target:l.bank.locate(s.entityId)}:o&&(f={targets:o.map(y=>l.bank.locate(y.entityId))});let p=Oe({...t,G:l},n.conditions,f,i),d=p.conditionsAreMet;return{results:d?eu(p.results,y=>t.G.bank.locate(y)):p.results,conditionIsMet:d}}};function eu(e,t,n=new WeakSet){if(typeof e!="object"||e===null||n.has(e))return e;if(n.add(e),e.entityId!==void 0)return t(e.entityId);if(Array.isArray(e))return e.map(i=>eu(i,t,n));let r={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=eu(e[i],t,n));return r}var iv=he(js());function sv(e,t=new Set){if(!e||typeof e!="object")return t;let n=e;n.type==="contextPath"&&Array.isArray(n.path)&&n.path[0]==="moveArguments"&&n.path[1]&&t.add(String(n.path[1]));for(let r of Object.values(e))sv(r,t);return t}function PR(e){let t=Object.keys(e),n={},r={};t.forEach(o=>{n[o]=[],r[o]=0}),t.forEach(o=>{let a=e[o];sv(a).forEach(c=>{t.includes(c)&&c!==o&&(n[c].push(o),r[o]++)})});let i=t.filter(o=>r[o]===0),s=[];for(;i.length>0;){let o=i.shift();s.push(o),n[o].forEach(a=>{r[a]--,r[a]===0&&i.push(a)})}return s.length===t.length?s:t}function ov(e,t,n,r,i,s=0,o={}){if(s===r.length){let p={arguments:o};return t.isValid(e,p,i)}let a=r[s],u=n[a],c={...i,moveArguments:o},l=(0,iv.default)(u)?Gr(e,{...u,matchMultiple:!0},c,a):u,f=Array.isArray(l)?l:l!==void 0?[l]:[];return f.length===0?!1:f.some(p=>ov(e,t,n,r,i,s+1,{...o,[a]:p}))}function tu(e,t){let n=e;return Object.values(t).some(r=>{let i=r?.moveInstance;if(!i)return!1;let s={moveInstance:i},a=pe(n,i.rule,s).arguments??{};if(Object.keys(a).length===0)return i.isValid(n,{arguments:{}},s);let u=PR(a);return ov(n,i,a,u,s)})}function ni(e,t){let{game:n,playerID:r,stageName:i}=t,s=e.ctx.phase,o=i??e.ctx.activePlayers?.[r??e.ctx.currentPlayer??""],a=n.phases?.[s]??n;return(a.turn?.stages?.[o]??a).moves??{}}var ri=class extends oe{checkCondition(t,n,r,i){return{conditionIsMet:!tu(t,ni(t,i))}}};var BG=he(Ur());var ii=class extends oe{checkCondition(t,n,r,i){let s={...i};r?.target&&(s.target=r.target);let o=Br(t,n,s);return{result:o,conditionIsMet:!!o}}};var si=class extends oe{checkCondition(t,n,r,i){let s=r.target,o=t.G.bank.findParent(s),a=!1;return n.position==="First"&&(a=o.entities.indexOf(s)===0),{conditionIsMet:a}}};function mn(e){if(typeof e!="object"||e===null||!("conditionType"in e))return;let t=e;if(t.conditionType==="Is")return new Vr(t);if(t.conditionType==="Not")return new zr(t);if(t.conditionType==="Or")return new Kr(t);if(t.conditionType==="Some")return new Hr(t);if(t.conditionType==="Contains")return new Jr(t);if(t.conditionType==="ContainsSame")return new Yr(t);if(t.conditionType==="Every")return new Wr(t);if(t.conditionType==="InLine")return new Xr(t);if(t.conditionType==="HasLine")return new Qr(t);if(t.conditionType==="IsFull")return new Zr(t);if(t.conditionType==="Would")return new ti(t);if(t.conditionType==="NoPossibleMoves")return new ri(t);if(t.conditionType==="Evaluate")return new ii(t);if(t.conditionType==="Position")return new si(t)}function Oe(e,t=[],n={},r={}){let i=[],s;for(let o of t){let a=mn(o).check(e,n,r);if(a.conditionIsMet)i.push(a);else{s=o;break}}return{results:i,failedAt:s,conditionsAreMet:i.length===t.length}}var nu=class{constructor(t,n){this.bank=n,this.rule=t,this.pool=[],this.remaining=+(t.count||1)}getOne(t,n,r){return this.getMultiple(t,1,n,r)[0]}getMultiple(t,n=1/0,r={},i={}){let s=[];if(this.remaining===1/0&&n===1/0)throw new Error(`Cannot get infinite pieces from slot with infinite remaining: ${this.rule.name}`);if(n!==1/0&&n>this.remaining)throw new Error(`Requested ${n} pieces but only ${this.remaining} available in slot: ${this.rule.name}`);let o=n===1/0?this.remaining:n;this.remaining!==1/0&&(this.remaining-=o);let a=Math.min(o,this.pool.length);s.push(...this.pool.splice(0,a));let u=o-a;if(u>0&&s.push(...Array.from(new Array(u)).map(()=>this.bank.createEntity(this.rule))),r.state){let c=pe(t,r.state,i);s.forEach(l=>{l.state={...l.state,...c}})}return s}returnToBank(t){t.rule.state?t.state=t.rule.state:delete t.state,this.remaining!==void 0&&(this.remaining+=1),this.pool.push(t)}},Ks=nu;var ru=class{constructor(t){this.currentEntityId=0,this.tracker={},this.slots=t.map(n=>new Ks(n,this))}createEntity(t={},n){let r=ht[t.entityType||"Entity"],i=new r({bank:this,fromBank:!0,...n},t,this.currentEntityId++);return this.track(i),i}track(t){this.tracker[t.entityId]=t}locate(t){return this.tracker[t]}findAll(t,n,r){if(!n.conditions)throw new Error(`Cannot find entity with no conditions. Rule: ${JSON.stringify(n)}`);return(0,uv.default)(Object.values(this.tracker),i=>Oe(t,n.conditions,{target:i},r).conditionsAreMet)}findOne(t,n,r){return this.findAll(t,n,r)[0]}find(t,n,r){return n.matchMultiple?this.findAll(t,n,r):this.findOne(t,n,r)}findParent(t){return(0,av.default)(this.tracker,n=>n.entities?.includes(t)||n.spaces?.includes(t))}getOne(t,n,r){let i=this.getSlot(t,n,r);return i||console.error(`No matching slot for ${JSON.stringify(n)}`),i.getOne(t,{state:n.state},r)}getMultiple(t,n,r,i){let s=this.getSlots(t,n,i);return s.length||console.error(`No matching slots for ${JSON.stringify(n)}`),s.reduce((o,a)=>[...o,...a.getMultiple(t,r,{state:n.state})],[])}getSlot(t,n,r){return this.slots.find(i=>Oe(t,n.conditions,{target:i},r).conditionsAreMet)}getSlots(t,n,r){return this.slots.filter(i=>Oe(t,n.conditions,{target:i},r).conditionsAreMet)}returnToBank(t,n){this.findParent(n).remove(n),this.getSlot(t,n.rule,{}).returnToBank(n),delete this.tracker[n.entityId]}},Hs=ru;var ht={Board:kr,SpaceGroup:on,Space:sn,Grid:Ar,Bank:Hs,BankSlot:Ks,Entity:Ot};function It(e){return{...e,G:Ut(JSON.stringify(e.G),ht)}}var cv=he(ua());var _e=class{constructor(t){this.rule=this.transformRule(t)}checkValidity(t,n,r){let i="arguments"in this.rule&&this.rule.arguments?this.rule.arguments:{},s=Object.entries(i);if(!s.every(([u])=>{let c=n.arguments[u];return c!==void 0&&(!Array.isArray(c)||c.length)}))return!1;let o={};for(let u=0,c=s.length;u<c;u++){let[l,f]=s[u],p=n.arguments[l],d=Array.isArray(p)?p:[p],h=[];for(let b=0,g=d.length;b<g;b++){let k=d[b],I=Oe(t,f.conditions,{target:k},{...r,moveArguments:n.arguments});if(h.push(I),!I.conditionsAreMet)break}let m=h[h.length-1]?.conditionsAreMet??!1;if(o[l]={results:h,conditionsAreMet:m},!m)break}let a=Oe(t,this.rule.conditions,{},{...r,moveArguments:n.arguments});return{argumentResults:o,moveResults:a,conditionsAreMet:a.conditionsAreMet&&Object.values(o).every(u=>u.conditionsAreMet)}}isValid(t,n,r){let i=this.checkValidity(t,n,r);return i===!1?!1:i.conditionsAreMet}doMove(t,n,r,{skipCheck:i=!1}={}){let s=pe(t,this.rule,r),o={...n,arguments:Object.entries(s.arguments??{}).reduce((u,[c,l])=>({...u,[c]:n?.arguments?.[c]??l}),{})};s.name&&(t.G._meta.previousPayloads[s.name]=o);let a;return i||(a=this.checkValidity(t,o,r)),!i&&a!==!1&&!a.conditionsAreMet?cv.INVALID_MOVE:(this.do(t,s,o,r),r&&(r.previousArguments=o.arguments),{conditionResults:a})}do(t,n,r,i){throw new Error("Move#do must be implemented by subclass")}transformRule(t){let n=t.arguments;if(n)for(let r in n){let i=n[r];i&&!i.playerChoice&&(i.resolveAsEntity=!0)}return t}};var oi=class extends _e{do(t,n,r){let{entity:i,destination:s}=r.arguments,o=t;Array.isArray(i)?i.forEach(a=>{o.G.bank.findParent(a)?.remove(a),s.placeEntity(a,n.position)}):(o.G.bank.findParent(i)?.remove(i),s.placeEntity(i,n.position))}};var ai=class extends _e{do(t,n,r){let{entity:i}=r.arguments,s=t;Je(s).returnToBank(s,i)}};var ui=class extends _e{do(t,n,r,i){let{destination:s}=r.arguments,o=t,a=n,u=Je(o);(a.matchMultiple?u.getMultiple(o,{...a.entity,conditions:[...a.entity?.conditions||[],...a.conditions||[]]},a.count??1,i):[u.getOne(o,{...a.entity,conditions:[...a.entity?.conditions||[],...a.conditions||[]]},i)]).forEach(l=>{s.placeEntity(l,a.position)})}};var ci=class extends _e{do(t,n,r){let{source:i,destination:s}=r.arguments;s.placeEntity(i.takeOne(n.arguments.source.position))}};var li=class extends _e{do(t,n,r){let{entity:i,state:s}=r.arguments;i.state={...i.state,[s.property]:s.value}}};function gn(e,t=[],n){return t?.length&&t.forEach(r=>{Wn(r,n.game).moveInstance.doMove(e,void 0,n)}),e.G}var fi=class extends _e{do(t,n,r,i){let s=t;s.events.setActivePlayers(n.options);let o=s.ctx.phase,a=n.options.currentPlayer?.stage,c=(i.game.phases?.[o]??i.game)?.turn?.stages?.[a];gn(t,c?.initialMoves,{...i,stageName:a})}};var pi=class extends _e{do(t){t.events.endTurn()}};var di=class extends _e{do(t){let n=t;n.G._meta.passedPlayers.length<n.ctx.numPlayers&&(n.G._meta.passedPlayers.push(n.ctx.currentPlayer),n.events.pass())}};var hi=class extends _e{do(t,n,r,i){let{targets:s}=r.arguments;s.forEach(o=>{let a={...i,loopTarget:o};Ws(n.move).doMove(t,void 0,a)})}};var mi=class extends _e{do(t){t.events.endTurn()}};var gi=class extends _e{do(t,n,r){let{target:i}=r.arguments,s=t;i.entities=s.random.Shuffle(i.entities)}};function Wn(e,t){let n=Ws(e);if(!n)throw new Error("moveFactory: unknown moveType");let r=function(i,s){let o=It(i),{G:a}=o,u=ER(s,a),c={moveInstance:n,game:t},l=n.doMove(o,u,c);if(c.moveConditionResults=[l],l!==lv.INVALID_MOVE&&e.then)for(let f of e.then){let p=Ws(f);if(!p)continue;let d=p.doMove(o,{},{...c});c.moveConditionResults.push(d)}return JSON.parse(He(a))};return r.moveInstance=n,r}function ER(e,t){if(!e)return;let n=Ut(JSON.stringify(e),ht);return n.arguments=Object.entries(n.arguments).reduce((r,[i,s])=>({...r,[i]:typeof s=="number"?t.bank.locate(s):s}),{}),n}function Ws(e){switch(e.moveType){case"MoveEntity":return new oi(e);case"PlaceNew":return new ui(e);case"RemoveEntity":return new ai(e);case"TakeFrom":return new ci(e);case"SetState":return new li(e);case"ForEach":return new hi(e);case"Pass":return new mi(e);case"Shuffle":return new gi(e);case"SetActivePlayers":return new fi(e);case"EndTurn":return new pi(e);case"PassTurn":return new di(e)}}var pv=he(Ba());function iu(e,t){return JSON.parse(JSON.stringify(e),(n,r)=>{let i=r;for(let s of t)s.test(i)&&(i=s.replace(i));return i})}var OR=[{entityType:"Space",count:"Infinity"},{entityType:"Board",name:"sharedBoard"},{name:"playerMarker",perPlayer:!0,count:"Infinity"}];function SR(e){e.entities=[...OR,...e.entities||[]]}function fv(e,t){if(e.sharedBoard){let r=e.sharedBoard.map(i=>({entity:i,destination:{name:"sharedBoard"}}));e.initialPlacements||(e.initialPlacements=[]),e.initialPlacements.unshift(...r)}if(e.personalBoard){t.push({entityType:"Board",name:"personalBoard",perPlayer:!0});let r=e.personalBoard.map(i=>({entity:i,destination:{name:"personalBoard"}}));e.initialPlacements||(e.initialPlacements=[]),e.initialPlacements.unshift(...r)}if(e.initialPlacements){let n=e.initialPlacements.map(r=>{let{state:i,...s}=r.entity,o=(0,pv.default)(t,s);return r.destination.name==="personalBoard"?{moveType:"ForEach",arguments:{targets:{type:"ctxPath",path:["playOrder"]}},move:{moveType:"PlaceNew",entity:{state:i,conditions:[{conditionType:"Is",matcher:{...s,...o?.perPlayer?{player:{type:"contextPath",path:["loopTarget"]}}:{}}}]},arguments:{destination:{conditions:[{conditionType:"Is",matcher:{...r.destination,player:{type:"contextPath",path:["loopTarget"]}}}]}}}}:{moveType:"PlaceNew",entity:{state:i,conditions:[{conditionType:"Is",matcher:s}]},arguments:{destination:{conditions:[{conditionType:"Is",matcher:r.destination}]}}}});e.initialMoves||(e.initialMoves=[]),e.initialMoves.unshift(...n),delete e.initialPlacements}}var AR=[],su=[["isCurrentPlayer",{conditionType:"Is",matcher:{player:{type:"ctxPath",path:["currentPlayer"]}}}],["isEmpty",{conditionType:"Not",conditions:[{conditionType:"Contains"}]}],["ownerOfFirstResultEntity",{type:"contextPath",path:["results",0,"matches",0,0,"entities",0,"attributes","player"]}]],xR=[{test:e=>!!(e&&typeof e=="object"),replace:e=>{let t=e;return AR.forEach(([n,r])=>{Object.prototype.hasOwnProperty.call(t,n)&&(t[r]=t[n],delete t[n])}),e}},{test:e=>typeof e=="string",replace:e=>{for(let t=0,n=su.length;t<n;t++)if(e===su[t][0])return su[t][1];return e}},{test:e=>!!(e&&typeof e=="object"&&e.conditions),replace:e=>{let t=e;return Array.isArray(t.conditions)||(t.conditions=[t.conditions]),e}},{test:e=>!!(e&&typeof e=="object"&&e.conditions),replace:e=>{let t=e;for(let n=0,r=t.conditions.length;n<r;n++)t.conditions[n].conditionType||(t.conditions[n]={conditionType:"Is",matcher:t.conditions[n]});return e}},{test:e=>!!(e&&typeof e=="object"&&typeof e.target=="string"),replace:e=>{let t=e;return{...t,target:{conditions:[{conditionType:"Is",matcher:{name:t.target}}]}}}}];function ou(e){let t=iu(e,xR);return t.sharedBoard||(t.sharedBoard=t.entities),t.turn||(t.turn={minMoves:1,maxMoves:1}),SR(t),fv(t,t.entities),t.phases&&Object.entries(t.phases).forEach(n=>{fv(n,t.entities)}),e.numPlayers&&(e.minPlayers=e.maxPlayers=e.numPlayers),t}function Js(e,t){let n;for(let r of t){let i=Oe(e,r.conditions);if(i.conditionsAreMet){n={scenario:r,conditionResults:i};break}}return n?.scenario?.result?pe(e,n.scenario.result,{results:n.conditionResults.results}):n}function yi(e,t){let n={name:t},r=ou(e);if(n.setup=i=>{let{ctx:s}=i,o={_meta:{passedPlayers:[],previousPayloads:{}}},a=TR(r.entities,s),u=new Hs(a);return o.bank=u,o.sharedBoard=u.getOne(i,{conditions:[{conditionType:"Is",matcher:{name:"sharedBoard"}}]},{}),r.personalBoard&&(o.personalBoards=i.ctx.playOrder.map(c=>u.getOne(i,{conditions:[{conditionType:"Is",matcher:{name:"personalBoard",player:c}}]},{}))),r.initialMoves?.forEach(c=>{Wn(c,n).moveInstance.doMove({...i,G:o},void 0,{})}),JSON.parse(He(o))},r.moves&&(n.moves=au(r.moves,n)),r.turn&&(n.turn=dv(r.turn,n)),r.phases&&(n.phases=Object.entries(r.phases).reduce((i,[s,o])=>({...i,[s]:MR(o,n)}),{})),r.endIf){let i=r.endIf;n.endIf=s=>{let o=It(s);return Js(o,i)}}return e.DEBUG_DISABLE_SECRET_STATE||(n.playerView=i=>{let{G:s,playerID:o}=It(i),a=s.bank.tracker;return Object.values(a).forEach(u=>{(u.rule.contentsHiddenFrom==="All"||u.rule.contentsHiddenFrom==="Others"&&(o!==u.rule.player||o===void 0))&&(u.spaces&&(u.spaces=u.rule.hideLength?[]:u.spaces.map(()=>s.bank.createEntity())),u.entities&&(u.entities=u.rule.hideLength?[]:u.entities.map(()=>s.bank.createEntity())))}),JSON.parse(He(s))}),n}function TR(e,t){return e.reduce((n,r)=>{let i={...r};if(i.perPlayer&&(delete i.perPlayer,i.variants?i.variants=new Array(t.numPlayers).fill(void 0).reduce((s,o,a)=>[...s,...i.variants.map(u=>({...u,player:`${a}`}))],[]):i.variants=new Array(t.numPlayers).fill(void 0).map((s,o)=>({player:`${o}`}))),i.variants){let s=i.variants;return delete i.variants,[...n,...s.map(o=>({...i,...o}))]}else return[...n,i]},[])}function dv(e,t){let n={...e};n.onBegin=i=>{let s=It(i),o=e.stages?.[s.ctx.activePlayers?.[s.ctx.currentPlayer]];return s.G._meta.passedPlayers=s.G._meta.passedPlayers.filter(a=>a!==s.ctx.currentPlayer),gn(s,e.initialMoves,{game:t}),gn(s,o?.initialMoves,{game:t}),JSON.parse(He(s.G))},e.stages&&Object.entries(e.stages).forEach(([i,s])=>{s.moves&&(n.stages[i].moves=au(s.moves,t))});let r=e.order;return r?.playOrder==="RotateFirst"&&(r.first=()=>0,r.next=({ctx:i})=>(i.playOrderPos+1)%i.numPlayers,n.order.playOrder=({ctx:i,G:s})=>s._meta.isAfterFirstPhase?[...i.playOrder.slice(1),i.playOrder[0]]:i.playOrder),n}function MR(e,t){let n={...e};if(e.turn&&(n.turn=dv(e.turn,t)),e.moves&&(n.moves=au(e.moves,t)),n.onBegin=r=>{let i=It(r);return gn(i,e.initialMoves,{game:t}),i.G._meta.currentPhaseHasBeenSetUp=!0,i.G._meta.nextPhase=e.next,JSON.parse(He(i.G))},e.endIf){let r=e.endIf;n.endIf=i=>{let s=It(i);if(s.G._meta.currentPhaseHasBeenSetUp){let o=Js(s,r);if(o)return o}}}return n.onEnd=({G:r})=>{r._meta.currentPhaseHasBeenSetUp=!1,r._meta.isAfterFirstPhase=!0},n}function au(e,t){return Object.entries(e).reduce((n,[r,i])=>({...n,[r]:Wn({...i,name:r},t)}),{})}var IR="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var hv=(e=21)=>{let t="",n=e|0;for(;n--;)t+=IR[Math.random()*64|0];return t};function ot(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];if(0)var i,s;throw Error("[Immer] minified error nr: "+e+(n.length?" "+n.map(function(o){return"'"+o+"'"}).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function Jn(e){return!!e&&!!e[Ye]}function vn(e){var t;return!!e&&(function(n){if(!n||typeof n!="object")return!1;var r=Object.getPrototypeOf(n);if(r===null)return!0;var i=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return i===Object||typeof i=="function"&&Function.toString.call(i)===GR}(e)||Array.isArray(e)||!!e[kv]||!!(!((t=e.constructor)===null||t===void 0)&&t[kv])||yu(e)||vu(e))}function bi(e,t,n){n===void 0&&(n=!1),Yn(e)===0?(n?Object.keys:Pu)(e).forEach(function(r){n&&typeof r=="symbol"||t(r,e[r],e)}):e.forEach(function(r,i){return t(i,r,e)})}function Yn(e){var t=e[Ye];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:yu(e)?2:vu(e)?3:0}function pu(e,t){return Yn(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function CR(e,t){return Yn(e)===2?e.get(t):e[t]}function Pv(e,t,n){var r=Yn(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function RR(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function yu(e){return DR&&e instanceof Map}function vu(e){return BR&&e instanceof Set}function yn(e){return e.o||e.t}function bu(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=LR(e);delete t[Ye];for(var n=Pu(t),r=0;r<n.length;r++){var i=n[r],s=t[i];s.writable===!1&&(s.writable=!0,s.configurable=!0),(s.get||s.set)&&(t[i]={configurable:!0,writable:!0,enumerable:s.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function wu(e,t){return t===void 0&&(t=!1),_u(e)||Jn(e)||!vn(e)||(Yn(e)>1&&(e.set=e.add=e.clear=e.delete=NR),Object.freeze(e),t&&bi(e,function(n,r){return wu(r,!0)},!0)),e}function NR(){ot(2)}function _u(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function mt(e){var t=FR[e];return t||ot(18,e),t}function mv(){return wi}function uu(e,t){t&&(mt("Patches"),e.u=[],e.s=[],e.v=t)}function Ys(e){du(e),e.p.forEach(jR),e.p=null}function du(e){e===wi&&(wi=e.l)}function gv(e){return wi={p:[],l:wi,h:e,m:!0,_:0}}function jR(e){var t=e[Ye];t.i===0||t.i===1?t.j():t.g=!0}function cu(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||mt("ES5").S(t,e,r),r?(n[Ye].P&&(Ys(t),ot(4)),vn(e)&&(e=$s(t,e),t.l||Xs(t,e)),t.u&&mt("Patches").M(n[Ye].t,e,t.u,t.s)):e=$s(t,n,[]),Ys(t),t.u&&t.v(t.u,t.s),e!==Ev?e:void 0}function $s(e,t,n){if(_u(t))return t;var r=t[Ye];if(!r)return bi(t,function(a,u){return yv(e,r,t,a,u,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Xs(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=bu(r.k):r.o,s=i,o=!1;r.i===3&&(s=new Set(i),i.clear(),o=!0),bi(s,function(a,u){return yv(e,r,i,a,u,n,o)}),Xs(e,i,!1),n&&e.u&&mt("Patches").N(r,n,e.u,e.s)}return r.o}function yv(e,t,n,r,i,s,o){if(Jn(i)){var a=$s(e,i,s&&t&&t.i!==3&&!pu(t.R,r)?s.concat(r):void 0);if(Pv(n,r,a),!Jn(a))return;e.m=!1}else o&&n.add(i);if(vn(i)&&!_u(i)){if(!e.h.D&&e._<1)return;$s(e,i),t&&t.A.l||Xs(e,i)}}function Xs(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&wu(t,n)}function lu(e,t){var n=e[Ye];return(n?yn(n):e)[t]}function vv(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function hu(e){e.P||(e.P=!0,e.l&&hu(e.l))}function fu(e){e.o||(e.o=bu(e.t))}function mu(e,t,n){var r=yu(t)?mt("MapSet").F(t,n):vu(t)?mt("MapSet").T(t,n):e.O?function(i,s){var o=Array.isArray(i),a={i:o?1:0,A:s?s.A:mv(),P:!1,I:!1,R:{},l:s,t:i,k:null,o:null,j:null,C:!1},u=a,c=gu;o&&(u=[a],c=vi);var l=Proxy.revocable(u,c),f=l.revoke,p=l.proxy;return a.k=p,a.j=f,p}(t,n):mt("ES5").J(t,n);return(n?n.A:mv()).p.push(r),r}function qR(e){return Jn(e)||ot(22,e),function t(n){if(!vn(n))return n;var r,i=n[Ye],s=Yn(n);if(i){if(!i.P&&(i.i<4||!mt("ES5").K(i)))return i.t;i.I=!0,r=bv(n,s),i.I=!1}else r=bv(n,s);return bi(r,function(o,a){i&&CR(i.t,o)===a||Pv(r,o,t(a))}),s===3?new Set(r):r}(e)}function bv(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return bu(e)}var wv,wi,ku=typeof Symbol<"u"&&typeof Symbol("x")=="symbol",DR=typeof Map<"u",BR=typeof Set<"u",_v=typeof Proxy<"u"&&Proxy.revocable!==void 0&&typeof Reflect<"u",Ev=ku?Symbol.for("immer-nothing"):((wv={})["immer-nothing"]=!0,wv),kv=ku?Symbol.for("immer-draftable"):"__$immer_draftable",Ye=ku?Symbol.for("immer-state"):"__$immer_state";var GR=""+Object.prototype.constructor,Pu=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Object.getOwnPropertySymbols!==void 0?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,LR=Object.getOwnPropertyDescriptors||function(e){var t={};return Pu(e).forEach(function(n){t[n]=Object.getOwnPropertyDescriptor(e,n)}),t},FR={},gu={get:function(e,t){if(t===Ye)return e;var n=yn(e);if(!pu(n,t))return function(i,s,o){var a,u=vv(s,o);return u?"value"in u?u.value:(a=u.get)===null||a===void 0?void 0:a.call(i.k):void 0}(e,n,t);var r=n[t];return e.I||!vn(r)?r:r===lu(e.t,t)?(fu(e),e.o[t]=mu(e.A.h,r,e)):r},has:function(e,t){return t in yn(e)},ownKeys:function(e){return Reflect.ownKeys(yn(e))},set:function(e,t,n){var r=vv(yn(e),t);if(r?.set)return r.set.call(e.k,n),!0;if(!e.P){var i=lu(yn(e),t),s=i?.[Ye];if(s&&s.t===n)return e.o[t]=n,e.R[t]=!1,!0;if(RR(n,i)&&(n!==void 0||pu(e.t,t)))return!0;fu(e),hu(e)}return e.o[t]===n&&(n!==void 0||t in e.o)||Number.isNaN(n)&&Number.isNaN(e.o[t])||(e.o[t]=n,e.R[t]=!0),!0},deleteProperty:function(e,t){return lu(e.t,t)!==void 0||t in e.t?(e.R[t]=!1,fu(e),hu(e)):delete e.R[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var n=yn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.i!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty:function(){ot(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){ot(12)}},vi={};bi(gu,function(e,t){vi[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),vi.deleteProperty=function(e,t){return vi.set.call(this,e,t,void 0)},vi.set=function(e,t,n){return gu.set.call(this,e[0],t,n,e[0])};var UR=function(){function e(n){var r=this;this.O=_v,this.D=!0,this.produce=function(i,s,o){if(typeof i=="function"&&typeof s!="function"){var a=s;s=i;var u=r;return function(y){var m=this;y===void 0&&(y=a);for(var b=arguments.length,g=Array(b>1?b-1:0),k=1;k<b;k++)g[k-1]=arguments[k];return u.produce(y,function(I){var j;return(j=s).call.apply(j,[m,I].concat(g))})}}var c;if(typeof s!="function"&&ot(6),o!==void 0&&typeof o!="function"&&ot(7),vn(i)){var l=gv(r),f=mu(r,i,void 0),p=!0;try{c=s(f),p=!1}finally{p?Ys(l):du(l)}return typeof Promise<"u"&&c instanceof Promise?c.then(function(y){return uu(l,o),cu(y,l)},function(y){throw Ys(l),y}):(uu(l,o),cu(c,l))}if(!i||typeof i!="object"){if((c=s(i))===void 0&&(c=i),c===Ev&&(c=void 0),r.D&&wu(c,!0),o){var d=[],h=[];mt("Patches").M(i,c,d,h),o(d,h)}return c}ot(21,i)},this.produceWithPatches=function(i,s){if(typeof i=="function")return function(c){for(var l=arguments.length,f=Array(l>1?l-1:0),p=1;p<l;p++)f[p-1]=arguments[p];return r.produceWithPatches(c,function(d){return i.apply(void 0,[d].concat(f))})};var o,a,u=r.produce(i,s,function(c,l){o=c,a=l});return typeof Promise<"u"&&u instanceof Promise?u.then(function(c){return[c,o,a]}):[u,o,a]},typeof n?.useProxies=="boolean"&&this.setUseProxies(n.useProxies),typeof n?.autoFreeze=="boolean"&&this.setAutoFreeze(n.autoFreeze)}var t=e.prototype;return t.createDraft=function(n){vn(n)||ot(8),Jn(n)&&(n=qR(n));var r=gv(this),i=mu(this,n,void 0);return i[Ye].C=!0,du(r),i},t.finishDraft=function(n,r){var i=n&&n[Ye],s=i.A;return uu(s,r),cu(void 0,s)},t.setAutoFreeze=function(n){this.D=n},t.setUseProxies=function(n){n&&!_v&&ot(20),this.O=n},t.applyPatches=function(n,r){var i;for(i=r.length-1;i>=0;i--){var s=r[i];if(s.path.length===0&&s.op==="replace"){n=s.value;break}}i>-1&&(r=r.slice(i+1));var o=mt("Patches").$;return Jn(n)?o(n,r):this.produce(n,function(a){return o(a,r)})},e}(),$e=new UR,VR=$e.produce,CL=$e.produceWithPatches.bind($e),RL=$e.setAutoFreeze.bind($e),NL=$e.setUseProxies.bind($e),jL=$e.applyPatches.bind($e),qL=$e.createDraft.bind($e),DL=$e.finishDraft.bind($e),Ov=VR;var Eu=class{constructor(t){let n=zR();this.c=1,this.s0=n(" "),this.s1=n(" "),this.s2=n(" "),this.s0-=n(t),this.s0<0&&(this.s0+=1),this.s1-=n(t),this.s1<0&&(this.s1+=1),this.s2-=n(t),this.s2<0&&(this.s2+=1)}next(){let t=2091639*this.s0+this.c*23283064365386963e-26;return this.s0=this.s1,this.s1=this.s2,this.s2=t-(this.c=Math.trunc(t))}};function zR(){let e=4022871197;return function(n){let r=n.toString();for(let i=0;i<r.length;i++){e+=r.charCodeAt(i);let s=.02519603282416938*e;e=s>>>0,s-=e,s*=e,e=s>>>0,s-=e,e+=s*4294967296}return(e>>>0)*23283064365386963e-26}}function Sv(e,t){return t.c=e.c,t.s0=e.s0,t.s1=e.s1,t.s2=e.s2,t}function Ou(e,t){let n=new Eu(e),r=n.next.bind(n);return t&&Sv(t,n),r.state=()=>Sv(n,{}),r}var Qs=class{constructor(t){this.state=t||{seed:"0"},this.used=!1}static seed(){return Date.now().toString(36).slice(-10)}isUsed(){return this.used}getState(){return this.state}_random(){this.used=!0;let t=this.state,n=t.prngstate?"":t.seed,r=Ou(n,t.prngstate),i=r();return this.state={...t,prngstate:r.state()},i}api(){let t=this._random.bind(this),n={D4:4,D6:6,D8:8,D10:10,D12:12,D20:20},r={};for(let s in n){let o=n[s];r[s]=a=>a===void 0?Math.floor(t()*o)+1:Array.from({length:a}).map(()=>Math.floor(t()*o)+1)}function i(s=6,o){return o===void 0?Math.floor(t()*s)+1:Array.from({length:o}).map(()=>Math.floor(t()*s)+1)}return{...r,Die:i,Number:()=>t(),Shuffle:s=>{let o=[...s],a=s.length,u=0,c=Array.from({length:a});for(;a;){let l=Math.trunc(a*t());c[u++]=o[l],o[l]=o[--a]}return c},_private:this}}},Av={name:"random",noClient:({api:e})=>e._private.isUsed(),flush:({api:e})=>e._private.getState(),api:({data:e})=>new Qs(e).api(),setup:({game:e})=>{let{seed:t}=e;return t===void 0&&(t=Qs.seed()),{seed:t}},playerView:()=>{}};var KR=he(nn()),_i="MAKE_MOVE",$n="GAME_EVENT",ki="REDO",Pi="RESET",Ei="SYNC",Oi="UNDO",Si="UPDATE",Ai="PATCH",xu="PLUGIN",Xn="STRIP_TRANSIENTS",Tu=(e,t,n,r)=>({type:_i,payload:{type:e,args:t,playerID:n,credentials:r}}),bn=(e,t,n,r)=>({type:$n,payload:{type:e,args:t,playerID:n,credentials:r}}),xv=(e,t,n,r)=>({type:$n,payload:{type:e,args:t,playerID:n,credentials:r},automatic:!0}),xi=e=>({type:Ei,state:e.state,log:e.log,initialState:e.initialState,clientOnly:!0}),Mu=(e,t,n,r)=>({type:Ai,prevStateID:e,stateID:t,patch:n,deltalog:r,clientOnly:!0}),Iu=(e,t)=>({type:Si,state:e,deltalog:t,clientOnly:!0}),Cu=e=>({type:Pi,state:e,clientOnly:!0}),Ru=(e,t)=>({type:Oi,payload:{type:null,args:null,playerID:e,credentials:t}}),Nu=(e,t)=>({type:ki,payload:{type:null,args:null,playerID:e,credentials:t}}),HR=(e,t,n,r)=>({type:xu,payload:{type:e,args:t,playerID:n,credentials:r}}),ju=()=>({type:Xn}),Tv=Object.freeze({__proto__:null,makeMove:Tu,gameEvent:bn,automaticGameEvent:xv,sync:xi,patch:Mu,update:Iu,reset:Cu,undo:Ru,redo:Nu,plugin:HR,stripTransients:ju}),eo="INVALID_MOVE",WR={name:"plugin-immer",fnWrap:e=>(t,...n)=>{let r=!1,i=Ov(t.G,s=>{let o=e({...t,G:s},...n);if(o===eo){r=!0;return}return o});return r?eo:i}},De;(function(e){e.MOVE="MOVE",e.GAME_ON_END="GAME_ON_END",e.PHASE_ON_BEGIN="PHASE_ON_BEGIN",e.PHASE_ON_END="PHASE_ON_END",e.TURN_ON_BEGIN="TURN_ON_BEGIN",e.TURN_ON_MOVE="TURN_ON_MOVE",e.TURN_ON_END="TURN_ON_END"})(De||(De={}));var Ct;(function(e){e.CalledOutsideHook="Events must be called from moves or the `onBegin`, `onEnd`, and `onMove` hooks.\nThis error probably means you called an event from other game code, like an `endIf` trigger or one of the `turn.order` methods.",e.EndTurnInOnEnd="`endTurn` is disallowed in `onEnd` hooks \u2014 the turn is already ending.",e.MaxTurnEndings=`Maximum number of turn endings exceeded for this update.
|
|
8
|
+
This likely means game code is triggering an infinite loop.`,e.PhaseEventInOnEnd="`setPhase` & `endPhase` are disallowed in a phase\u2019s `onEnd` hook \u2014 the phase is already ending.\nIf you\u2019re trying to dynamically choose the next phase when a phase ends, use the phase\u2019s `next` trigger.",e.StageEventInOnEnd="`setStage`, `endStage` & `setActivePlayers` are disallowed in `onEnd` hooks.",e.StageEventInPhaseBegin="`setStage`, `endStage` & `setActivePlayers` are disallowed in a phase\u2019s `onBegin` hook.\nUse `setActivePlayers` in a `turn.onBegin` hook or declare stages with `turn.activePlayers` instead.",e.StageEventInTurnBegin="`setStage` & `endStage` are disallowed in `turn.onBegin`.\nUse `setActivePlayers` or declare stages with `turn.activePlayers` instead."})(Ct||(Ct={}));var Su=class{constructor(t,n,r){this.flow=t,this.playerID=r,this.dispatch=[],this.initialTurn=n.turn,this.updateTurnContext(n,void 0),this.maxEndedTurnsPerAction=n.numPlayers*100}api(){let t={_private:this};for(let n of this.flow.eventNames)t[n]=(...r)=>{this.dispatch.push({type:n,args:r,phase:this.currentPhase,turn:this.currentTurn,calledFrom:this.currentMethod,error:new Error("Events Plugin Error")})};return t}isUsed(){return this.dispatch.length>0}updateTurnContext(t,n){this.currentPhase=t.phase,this.currentTurn=t.turn,this.currentMethod=n}unsetCurrentMethod(){this.currentMethod=void 0}update(t){let n=t,r=({stack:i},s)=>({...n,plugins:{...n.plugins,events:{...n.plugins.events,data:{error:s+`
|
|
9
|
+
`+i}}}});e:for(let i=0;i<this.dispatch.length;i++){let s=this.dispatch[i],o=s.turn!==t.ctx.turn;if(this.currentTurn-this.initialTurn>=this.maxEndedTurnsPerAction)return r(s.error,Ct.MaxTurnEndings);if(s.calledFrom===void 0)return r(s.error,Ct.CalledOutsideHook);if(t.ctx.gameover)break e;switch(s.type){case"endStage":case"setStage":case"setActivePlayers":{switch(s.calledFrom){case De.TURN_ON_END:case De.PHASE_ON_END:return r(s.error,Ct.StageEventInOnEnd);case De.PHASE_ON_BEGIN:return r(s.error,Ct.StageEventInPhaseBegin);case De.TURN_ON_BEGIN:if(s.type==="setActivePlayers")break;return r(s.error,Ct.StageEventInTurnBegin)}if(o)continue e;break}case"endTurn":{if(s.calledFrom===De.TURN_ON_END||s.calledFrom===De.PHASE_ON_END)return r(s.error,Ct.EndTurnInOnEnd);if(o)continue e;break}case"endPhase":case"setPhase":{if(s.calledFrom===De.PHASE_ON_END)return r(s.error,Ct.PhaseEventInOnEnd);if(s.phase!==t.ctx.phase)continue e;break}}let u=xv(s.type,s.args,this.playerID);t=this.flow.processEvent(t,u)}return t}},qu={name:"events",noClient:({api:e})=>e._private.isUsed(),isInvalid:({data:e})=>e.error||!1,fnWrap:(e,t)=>(n,...r)=>{let i=n.events;i&&i._private.updateTurnContext(n.ctx,t);let s=e(n,...r);return i&&i._private.unsetCurrentMethod(),s},dangerouslyFlushRawState:({state:e,api:t})=>t._private.update(e),api:({game:e,ctx:t,playerID:n})=>new Su(e.flow,t,n).api()},JR={name:"log",flush:()=>({}),api:({data:e})=>({setMetadata:t=>{e.metadata=t}}),setup:()=>({})};var YR={name:"plugin-serializable",fnWrap:e=>(t,...n)=>e(t,...n)},$R=!0,XR=$R?()=>{}:(...e)=>console.log(...e),QR=(...e)=>console.error(...e);function Du(e){XR(`INFO: ${e}`)}function ke(e){QR("ERROR:",e)}var Bu=[WR,Av,JR,YR],Ti=[...Bu,qu],Mv=(e,t,n)=>(n.game.plugins.filter(r=>r.action!==void 0).filter(r=>r.name===t.payload.type).forEach(r=>{let i=r.name,s=e.plugins[i]||{data:{}},o=r.action(s.data,t.payload);e={...e,plugins:{...e.plugins,[i]:{...s,data:o}}}}),e),Jt=({plugins:e})=>Object.entries(e||{}).reduce((t,[n,{api:r}])=>(t[n]=r,t),{}),Gu=(e,t,n)=>[...Bu,...n,qu].filter(r=>r.fnWrap!==void 0).reduce((r,{fnWrap:i})=>i(r,t),e),Iv=(e,t)=>([...Ti,...t.game.plugins].filter(n=>n.setup!==void 0).forEach(n=>{let r=n.name,i=n.setup({G:e.G,ctx:e.ctx,game:t.game});e={...e,plugins:{...e.plugins,[r]:{data:i}}}}),e),Mi=(e,t)=>([...Ti,...t.game.plugins].filter(n=>n.api!==void 0).forEach(n=>{let r=n.name,i=e.plugins[r]||{data:{}},s=n.api({G:e.G,ctx:e.ctx,data:i.data,game:t.game,playerID:t.playerID});e={...e,plugins:{...e.plugins,[r]:{...i,api:s}}}}),e),ZR=(e,t)=>([...Bu,...t.game.plugins,qu].reverse().forEach(n=>{let r=n.name,i=e.plugins[r]||{data:{}};if(n.flush){let s=n.flush({G:e.G,ctx:e.ctx,game:t.game,api:i.api,data:i.data});e={...e,plugins:{...e.plugins,[n.name]:{data:s}}}}else if(n.dangerouslyFlushRawState){e=n.dangerouslyFlushRawState({state:e,game:t.game,api:i.api,data:i.data});let s=e.plugins[r].data;e={...e,plugins:{...e.plugins,[n.name]:{data:s}}}}}),e),Cv=(e,t)=>[...Ti,...t.game.plugins].filter(n=>n.noClient!==void 0).map(n=>{let r=n.name,i=e.plugins[r];return i?n.noClient({G:e.G,ctx:e.ctx,game:t.game,api:i.api,data:i.data}):!1}).includes(!0),eN=(e,t)=>[...Ti,...t.game.plugins].filter(r=>r.isInvalid!==void 0).map(r=>{let{name:i}=r,s=e.plugins[i],o=r.isInvalid({G:e.G,ctx:e.ctx,game:t.game,data:s&&s.data});return o?{plugin:i,message:o}:!1}).find(r=>r)||!1,to=(e,t)=>{let n=ZR(e,t),r=eN(n,t);if(!r)return[n];let{plugin:i,message:s}=r;return ke(`${i} plugin declared action invalid:
|
|
10
|
+
${s}`),[e,r]},Rv=({G:e,ctx:t,plugins:n={}},{game:r,playerID:i})=>([...Ti,...r.plugins].forEach(({name:s,playerView:o})=>{if(!o)return;let{data:a}=n[s]||{data:{}},u=o({G:e,ctx:t,game:r,data:a,playerID:i});n={...n,[s]:{data:u}}}),n);function Ii(e,t=!1){e.moveLimit&&(t&&(e.minMoves=e.moveLimit),e.maxMoves=e.moveLimit,delete e.moveLimit)}function Ci(e,t){let n={},r=[],i=null,s={},o={};if(Array.isArray(t)){let u={};t.forEach(c=>u[c]=Rt.NULL),n=u}else{if(Ii(t),t.next&&(i=t.next),t.revert&&(r=[...e._prevActivePlayers,{activePlayers:e.activePlayers,_activePlayersMinMoves:e._activePlayersMinMoves,_activePlayersMaxMoves:e._activePlayersMaxMoves,_activePlayersNumMoves:e._activePlayersNumMoves}]),t.currentPlayer!==void 0&&Zs(n,s,o,e.currentPlayer,t.currentPlayer),t.others!==void 0)for(let u=0;u<e.playOrder.length;u++){let c=e.playOrder[u];c!==e.currentPlayer&&Zs(n,s,o,c,t.others)}if(t.all!==void 0)for(let u=0;u<e.playOrder.length;u++){let c=e.playOrder[u];Zs(n,s,o,c,t.all)}if(t.value)for(let u in t.value)Zs(n,s,o,u,t.value[u]);if(t.minMoves)for(let u in n)s[u]===void 0&&(s[u]=t.minMoves);if(t.maxMoves)for(let u in n)o[u]===void 0&&(o[u]=t.maxMoves)}Object.keys(n).length===0&&(n=null),Object.keys(s).length===0&&(s=null),Object.keys(o).length===0&&(o=null);let a={};for(let u in n)a[u]=0;return{...e,activePlayers:n,_activePlayersMinMoves:s,_activePlayersMaxMoves:o,_activePlayersNumMoves:a,_prevActivePlayers:r,_nextActivePlayers:i}}function Nv(e){let{activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s,_nextActivePlayers:o}=e;if(t&&Object.keys(t).length===0)if(o)e=Ci(e,o),{activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s}=e;else if(s.length>0){let a=s.length-1;({activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i}=s[a]),s=s.slice(0,a)}else t=null,n=null,r=null;return{...e,activePlayers:t,_activePlayersMinMoves:n,_activePlayersMaxMoves:r,_activePlayersNumMoves:i,_prevActivePlayers:s}}function Zs(e,t,n,r,i){(typeof i!="object"||i===Rt.NULL)&&(i={stage:i}),i.stage!==void 0&&(Ii(i),e[r]=i.stage,i.minMoves&&(t[r]=i.minMoves),i.maxMoves&&(n[r]=i.maxMoves))}function Au(e,t){return e[t]+""}function jv(e,t){let{G:n,ctx:r}=e,{numPlayers:i}=r,o={...Jt(e),G:n,ctx:r},a=t.order,u=[...Array.from({length:i})].map((p,d)=>d+"");a.playOrder!==void 0&&(u=a.playOrder(o));let c=a.first(o),l=typeof c;l!=="number"&&ke(`invalid value returned by turn.order.first \u2014 expected number got ${l} \u201C${c}\u201D.`);let f=Au(u,c);return r={...r,currentPlayer:f,playOrderPos:c,playOrder:u},r=Ci(r,t.activePlayers||{}),r}function qv(e,t,n,r){let i=n.order,{G:s,ctx:o}=e,a=o.playOrderPos,u=!1;if(r&&r!==!0)typeof r!="object"&&ke(`invalid argument to endTurn: ${r}`),Object.keys(r).forEach(c=>{switch(c){case"remove":t=Au(o.playOrder,a);break;case"next":a=o.playOrder.indexOf(r.next),t=r.next;break;default:ke(`invalid argument to endTurn: ${c}`)}});else{let l={...Jt(e),G:s,ctx:o},f=i.next(l),p=typeof f;f!==void 0&&p!=="number"&&ke(`invalid value returned by turn.order.next \u2014 expected number or undefined got ${p} \u201C${f}\u201D.`),f===void 0?u=!0:(a=f,t=Au(o.playOrder,a))}return o={...o,playOrderPos:a,currentPlayer:t},{endPhase:u,ctx:o}}var Dv={DEFAULT:{first:({ctx:e})=>e.turn===0?e.playOrderPos:(e.playOrderPos+1)%e.playOrder.length,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},RESET:{first:()=>0,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},CONTINUE:{first:({ctx:e})=>e.playOrderPos,next:({ctx:e})=>(e.playOrderPos+1)%e.playOrder.length},ONCE:{first:()=>0,next:({ctx:e})=>{if(e.playOrderPos<e.playOrder.length-1)return e.playOrderPos+1}},CUSTOM:e=>({playOrder:()=>e,first:()=>0,next:({ctx:t})=>(t.playOrderPos+1)%t.playOrder.length}),CUSTOM_FROM:e=>({playOrder:({G:t})=>t[e],first:()=>0,next:({ctx:t})=>(t.playOrderPos+1)%t.playOrder.length})},Rt={NULL:null},UL={ALL:{all:Rt.NULL},ALL_ONCE:{all:Rt.NULL,minMoves:1,maxMoves:1},OTHERS:{others:Rt.NULL},OTHERS_ONCE:{others:Rt.NULL,minMoves:1,maxMoves:1}};var{parse:tN,stringify:nN}=JSON,{keys:rN}=Object,Ri=String,Lv="string",Bv={},no="object",Fv=(e,t)=>t,iN=e=>e instanceof Ri?Ri(e):e,sN=(e,t)=>typeof t===Lv?new Ri(t):t,Uv=(e,t,n,r)=>{let i=[];for(let s=rN(n),{length:o}=s,a=0;a<o;a++){let u=s[a],c=n[u];if(c instanceof Ri){let l=e[c];typeof l===no&&!t.has(l)?(t.add(l),n[u]=Bv,i.push({k:u,a:[e,t,l,r]})):n[u]=r.call(n,u,l)}else n[u]!==Bv&&(n[u]=r.call(n,u,c))}for(let{length:s}=i,o=0;o<s;o++){let{k:a,a:u}=i[o];n[a]=r.call(n,a,Uv.apply(null,u))}return n},Gv=(e,t,n)=>{let r=Ri(t.push(n)-1);return e.set(n,r),r},Lu=(e,t)=>{let n=tN(e,sN).map(iN),r=n[0],i=t||Fv,s=typeof r===no&&r?Uv(n,new Set,r,i):r;return i.call({"":s},"",s)},Fu=(e,t,n)=>{let r=t&&typeof t===no?(l,f)=>l===""||-1<t.indexOf(l)?f:void 0:t||Fv,i=new Map,s=[],o=[],a=+Gv(i,s,r.call({"":e},"",e)),u=!a;for(;a<s.length;)u=!0,o[a]=nN(s[a++],c,n);return"["+o.join(",")+"]";function c(l,f){if(u)return u=!u,f;let p=r.call(this,l,f);switch(typeof p){case no:if(p===null)return p;case Lv:return i.get(p)||Gv(i,s,p)}return p}};var ob=he(ji());function bN({moves:e,phases:t,endIf:n,onEnd:r,turn:i,events:s,plugins:o}){e===void 0&&(e={}),s===void 0&&(s={}),o===void 0&&(o=[]),t===void 0&&(t={}),n||(n=()=>{}),r||(r=({G:w})=>w),i||(i={});let a={...t};""in a&&ke("cannot specify phase with empty name"),a[""]={};let u={},c=new Set,l=null;Object.keys(e).forEach(w=>c.add(w));let f=(w,E)=>{let T=Gu(w,E,o);return F=>{let z=Jt(F);return T({...z,G:F.G,ctx:F.ctx,playerID:F.playerID})}},p=w=>E=>{let T=Jt(E);return w({...T,G:E.G,ctx:E.ctx})},d={onEnd:f(r,De.GAME_ON_END),endIf:p(n)};for(let w in a){let E=a[w];if(E.start===!0&&(l=w),E.moves!==void 0)for(let T of Object.keys(E.moves))u[w+"."+T]=E.moves[T],c.add(T);E.endIf===void 0&&(E.endIf=()=>{}),E.onBegin===void 0&&(E.onBegin=({G:T})=>T),E.onEnd===void 0&&(E.onEnd=({G:T})=>T),E.turn===void 0&&(E.turn=i),E.turn.order===void 0&&(E.turn.order=Dv.DEFAULT),E.turn.onBegin===void 0&&(E.turn.onBegin=({G:T})=>T),E.turn.onEnd===void 0&&(E.turn.onEnd=({G:T})=>T),E.turn.endIf===void 0&&(E.turn.endIf=()=>!1),E.turn.onMove===void 0&&(E.turn.onMove=({G:T})=>T),E.turn.stages===void 0&&(E.turn.stages={}),Ii(E.turn,!0);for(let T in E.turn.stages){let z=E.turn.stages[T].moves||{};for(let H of Object.keys(z)){let xe=w+"."+T+"."+H;u[xe]=z[H],c.add(H)}}if(E.wrapped={onBegin:f(E.onBegin,De.PHASE_ON_BEGIN),onEnd:f(E.onEnd,De.PHASE_ON_END),endIf:p(E.endIf)},E.turn.wrapped={onMove:f(E.turn.onMove,De.TURN_ON_MOVE),onBegin:f(E.turn.onBegin,De.TURN_ON_BEGIN),onEnd:f(E.turn.onEnd,De.TURN_ON_END),endIf:p(E.turn.endIf)},typeof E.next!="function"){let{next:T}=E;E.next=()=>T||null}E.wrapped.next=p(E.next)}function h(w){return w.phase?a[w.phase]:a[""]}function y(w){return w}function m(w,E){let T=new Set,F=new Set;for(let z=0;z<E.length;z++){let{fn:H,arg:xe,...ve}=E[z];if(H===ne){F.clear();let Le=w.ctx.phase;if(T.has(Le)){let lt={...w.ctx,phase:null};return{...w,ctx:lt}}T.add(Le)}let et=[];if(w=H(w,{...ve,arg:xe,next:et}),H===se)break;let Re=J(w);if(Re){E.push({fn:se,arg:Re,turn:w.ctx.turn,phase:w.ctx.phase,automatic:!0});continue}let qe=fe(w);if(qe){E.push({fn:ne,arg:qe,turn:w.ctx.turn,phase:w.ctx.phase,automatic:!0});continue}if([y,C,q].includes(H)){let Le=V(w);if(Le){E.push({fn:L,arg:Le,turn:w.ctx.turn,phase:w.ctx.phase,automatic:!0});continue}}E.push(...et)}return w}function b(w,{next:E}){return E.push({fn:g}),w}function g(w,{next:E}){let{G:T,ctx:F}=w;return T=h(F).wrapped.onBegin(w),E.push({fn:k}),{...w,G:T,ctx:F}}function k(w,{currentPlayer:E}){let{ctx:T}=w,F=h(T);E?(T={...T,currentPlayer:E},F.turn.activePlayers&&(T=Ci(T,F.turn.activePlayers))):T=jv(w,F.turn);let z=T.turn+1;T={...T,turn:z,numMoves:0,_prevActivePlayers:[]};let H=F.turn.wrapped.onBegin({...w,ctx:T});return{...w,G:H,ctx:T,_undo:[],_redo:[]}}function I(w,{arg:E,next:T,phase:F}){let z=h({phase:F}),{ctx:H}=w;if(E&&E.next)if(E.next in a)H={...H,phase:E.next};else return ke("invalid phase: "+E.next),w;else H={...H,phase:z.wrapped.next(w)||null};return w={...w,ctx:H},T.push({fn:g}),w}function j(w,{arg:E,currentPlayer:T,next:F}){let{G:z,ctx:H}=w,xe=h(H),{endPhase:ve,ctx:et}=qv(w,T,xe.turn,E);return H=et,w={...w,G:z,ctx:H},ve?F.push({fn:ne,turn:H.turn,phase:H.phase}):F.push({fn:k,currentPlayer:H.currentPlayer}),w}function C(w,{arg:E,playerID:T}){if((typeof E=="string"||E===Rt.NULL)&&(E={stage:E}),typeof E!="object")return w;Ii(E);let{ctx:F}=w,{activePlayers:z,_activePlayersMinMoves:H,_activePlayersMaxMoves:xe,_activePlayersNumMoves:ve}=F;return E.stage!==void 0&&(z===null&&(z={}),z[T]=E.stage,ve[T]=0,E.minMoves&&(H===null&&(H={}),H[T]=E.minMoves),E.maxMoves&&(xe===null&&(xe={}),xe[T]=E.maxMoves)),F={...F,activePlayers:z,_activePlayersMinMoves:H,_activePlayersMaxMoves:xe,_activePlayersNumMoves:ve},{...w,ctx:F}}function q(w,{arg:E}){return{...w,ctx:Ci(w.ctx,E)}}function J(w){return d.endIf(w)}function fe(w){return h(w.ctx).wrapped.endIf(w)}function V(w){let E=h(w.ctx),T=w.ctx.numMoves||0;return E.turn.maxMoves&&T>=E.turn.maxMoves?!0:E.turn.wrapped.endIf(w)}function se(w,{arg:E,phase:T}){w=ne(w,{phase:T}),E===void 0&&(E=!0),w={...w,ctx:{...w.ctx,gameover:E}};let F=d.onEnd(w);return{...w,G:F}}function ne(w,{arg:E,next:T,turn:F,automatic:z}){w=L(w,{turn:F,force:!0,automatic:!0});let{phase:H,turn:xe}=w.ctx;if(T&&T.push({fn:I,arg:E,phase:H}),H===null)return w;let et=h(w.ctx).wrapped.onEnd(w),Re={...w.ctx,phase:null},qe=bn("endPhase",E),{_stateID:Le}=w,lt={action:qe,_stateID:Le,turn:xe,phase:H};z&&(lt.automatic=!0);let en=[...w.deltalog||[],lt];return{...w,G:et,ctx:Re,deltalog:en}}function L(w,{arg:E,next:T,turn:F,force:z,automatic:H,playerID:xe}){if(F!==w.ctx.turn)return w;let{currentPlayer:ve,numMoves:et,phase:Re,turn:qe}=w.ctx,Le=h(w.ctx),lt=et||0;if(!z&&Le.turn.minMoves&<<Le.turn.minMoves)return Du(`cannot end turn before making ${Le.turn.minMoves} moves`),w;let en=Le.turn.wrapped.onEnd(w);T&&T.push({fn:j,arg:E,currentPlayer:ve});let Ft={...w.ctx,activePlayers:null};if(E&&E.remove){xe=xe||ve;let tn=Ft.playOrder.filter(h1=>h1!=xe),d1=Ft.playOrderPos>tn.length-1?0:Ft.playOrderPos;if(Ft={...Ft,playOrder:tn,playOrderPos:d1},tn.length===0)return T.push({fn:ne,turn:qe,phase:Re}),w}let Do=bn("endTurn",E),{_stateID:cl}=w,dr={action:Do,_stateID:cl,turn:qe,phase:Re};H&&(dr.automatic=!0);let Bo=[...w.deltalog||[],dr];return{...w,G:en,ctx:Ft,deltalog:Bo,_undo:[],_redo:[]}}function Pe(w,{arg:E,next:T,automatic:F,playerID:z}){z=z||w.ctx.currentPlayer;let{ctx:H,_stateID:xe}=w,{activePlayers:ve,_activePlayersNumMoves:et,_activePlayersMinMoves:Re,_activePlayersMaxMoves:qe,phase:Le,turn:lt}=H,en=ve!==null&&z in ve,Ft=h(H);if(!E&&en){let tn=Ft.turn.stages[ve[z]];tn&&tn.next&&(E=tn.next)}if(T&&T.push({fn:C,arg:E,playerID:z}),!en)return w;let Do=et[z]||0;if(Re&&Re[z]&&Do<Re[z])return Du(`cannot end stage before making ${Re[z]} moves`),w;ve={...ve},delete ve[z],Re&&(Re={...Re},delete Re[z]),qe&&(qe={...qe},delete qe[z]),H=Nv({...H,activePlayers:ve,_activePlayersMinMoves:Re,_activePlayersMaxMoves:qe});let dr={action:bn("endStage",E),_stateID:xe,turn:lt,phase:Le};F&&(dr.automatic=!0);let Bo=[...w.deltalog||[],dr];return{...w,ctx:H,deltalog:Bo}}function ue(w,E,T){let F=h(w),z=F.turn.stages,{activePlayers:H}=w;if(H&&H[T]!==void 0&&H[T]!==Rt.NULL&&z[H[T]]!==void 0&&z[H[T]].moves!==void 0){let ve=z[H[T]].moves;if(E in ve)return ve[E]}else if(F.moves){if(E in F.moves)return F.moves[E]}else if(E in e)return e[E];return null}function Lt(w,E){let{playerID:T,type:F}=E,{currentPlayer:z,activePlayers:H,_activePlayersMaxMoves:xe}=w.ctx,ve=ue(w.ctx,F,T),et=!ve||typeof ve=="function"||ve.noLimit!==!0,{numMoves:Re,_activePlayersNumMoves:qe}=w.ctx;et&&(T===z&&Re++,H&&qe[T]++),w={...w,ctx:{...w.ctx,numMoves:Re,_activePlayersNumMoves:qe}},xe&&qe[T]>=xe[T]&&(w=Pe(w,{playerID:T,automatic:!0}));let lt=h(w.ctx).turn.wrapped.onMove({...w,playerID:T});return w={...w,G:lt},m(w,[{fn:y}])}function wt(w,E,T){return m(w,[{fn:Pe,arg:T,playerID:E}])}function Sn(w,E){return m(w,[{fn:Pe,playerID:E}])}function _t(w,E,T){return m(w,[{fn:q,arg:T}])}function Ae(w,E,T){return m(w,[{fn:ne,phase:w.ctx.phase,turn:w.ctx.turn,arg:{next:T}}])}function qo(w){return m(w,[{fn:ne,phase:w.ctx.phase,turn:w.ctx.turn}])}function Me(w,E,T){return m(w,[{fn:L,turn:w.ctx.turn,phase:w.ctx.phase,arg:T}])}function Ie(w,E,T){return m(w,[{fn:L,turn:w.ctx.turn,phase:w.ctx.phase,force:!0,arg:T}])}function Ce(w,E,T){return m(w,[{fn:se,turn:w.ctx.turn,phase:w.ctx.phase,arg:T}])}let R={endStage:Sn,setStage:wt,endTurn:Me,pass:Ie,endPhase:qo,setPhase:Ae,endGame:Ce,setActivePlayers:_t},W=[];s.endTurn!==!1&&W.push("endTurn"),s.pass!==!1&&W.push("pass"),s.endPhase!==!1&&W.push("endPhase"),s.setPhase!==!1&&W.push("setPhase"),s.endGame!==!1&&W.push("endGame"),s.setActivePlayers!==!1&&W.push("setActivePlayers"),s.endStage!==!1&&W.push("endStage"),s.setStage!==!1&&W.push("setStage");function kt(w,E){let{type:T,playerID:F,args:z}=E.payload;return typeof R[T]!="function"?w:R[T](w,F,...Array.isArray(z)?z:[z])}function pr(w,E,T){return E.activePlayers?T in E.activePlayers:E.currentPlayer===T}return{ctx:w=>({numPlayers:w,turn:0,currentPlayer:"0",playOrder:[...Array.from({length:w})].map((E,T)=>T+""),playOrderPos:0,phase:l,activePlayers:null}),init:w=>m(w,[{fn:b}]),isPlayerActive:pr,eventHandlers:R,eventNames:Object.keys(R),enabledEventNames:W,moveMap:u,moveNames:[...c.values()],processMove:Lt,processEvent:kt,getMove:ue}}function wN(e){return e.processMove!==void 0}function qi(e){if(wN(e))return e;if(e.name===void 0&&(e.name="default"),e.deltaState===void 0&&(e.deltaState=!1),e.disableUndo===void 0&&(e.disableUndo=!1),e.setup===void 0&&(e.setup=()=>({})),e.moves===void 0&&(e.moves={}),e.playerView===void 0&&(e.playerView=({G:n})=>n),e.plugins===void 0&&(e.plugins=[]),e.plugins.forEach(n=>{if(n.name===void 0)throw new Error("Plugin missing name attribute");if(n.name.includes(" "))throw new Error(n.name+": Plugin name must not include spaces")}),e.name.includes(" "))throw new Error(e.name+": Game name must not include spaces");let t=bN(e);return{...e,flow:t,moveNames:t.moveNames,pluginNames:e.plugins.map(n=>n.name),processMove:(n,r)=>{let i=t.getMove(n.ctx,r.type,r.playerID);if(_N(i)&&(i=i.move),i instanceof Function){let s=Gu(i,De.MOVE,e.plugins),o=[];r.args!==void 0&&(o=Array.isArray(r.args)?r.args:[r.args]);let a={...Jt(n),G:n.G,ctx:n.ctx,playerID:r.playerID};return s(a,...o)}return ke(`invalid move object: ${r.type}`),n.G}}}function _N(e){return e instanceof Object&&e.move!==void 0}var tc;(function(e){e.UnauthorizedAction="update/unauthorized_action",e.MatchNotFound="update/match_not_found",e.PatchFailed="update/patch_failed"})(tc||(tc={}));var Be;(function(e){e.StaleStateId="action/stale_state_id",e.UnavailableMove="action/unavailable_move",e.InvalidMove="action/invalid_move",e.InactivePlayer="action/inactive_player",e.GameOver="action/gameover",e.ActionDisabled="action/action_disabled",e.ActionInvalid="action/action_invalid",e.PluginActionInvalid="action/plugin_invalid"})(Be||(Be={}));var io=e=>e.payload.playerID!==null&&e.payload.playerID!==void 0,kN=(e,t,n)=>{function r(s){return s.undoable!==void 0}function i(s){return s instanceof Function}return r(n)?i(n.undoable)?n.undoable({G:e,ctx:t}):n.undoable:!0};function sb(e,t){if(t.game.disableUndo)return e;let n={G:e.G,ctx:e.ctx,plugins:e.plugins,playerID:t.action.payload.playerID||e.ctx.currentPlayer};return t.action.type==="MAKE_MOVE"&&(n.moveType=t.action.payload.type),{...e,_undo:[...e._undo,n],_redo:[]}}function Zu(e,t,n){let r={action:t,_stateID:e._stateID,turn:e.ctx.turn,phase:e.ctx.phase},i=e.plugins.log.data.metadata;return i!==void 0&&(r.metadata=i),typeof n=="object"&&n.redact===!0?r.redact=!0:typeof n=="object"&&n.redact instanceof Function&&(r.redact=n.redact({G:e.G,ctx:e.ctx})),{...e,deltalog:[r]}}function ec(e,t,n){let[r,i]=to(e,n);return i?[r,Fe(t,Be.PluginActionInvalid,i)]:[r]}function ab(e){if(!e)return[null,void 0];let{transients:t,...n}=e;return[n,t]}function Fe(e,t,n){return{...e,transients:{error:{type:t,payload:n}}}}var ub=e=>t=>n=>{let r=t(n);switch(n.type){case Xn:return r;default:{let[,i]=ab(e.getState());return typeof i<"u"?(e.dispatch(ju()),{...r,transients:i}):r}}};function Qn({game:e,isClient:t}){return e=qi(e),(n=null,r)=>{let[i]=ab(n);switch(r.type){case Xn:return i;case $n:{if(i={...i,deltalog:[]},t)return i;if(i.ctx.gameover!==void 0)return ke("cannot call event after game end"),Fe(i,Be.GameOver);if(io(r)&&!e.flow.isPlayerActive(i.G,i.ctx,r.payload.playerID))return ke(`disallowed event: ${r.payload.type}`),Fe(i,Be.InactivePlayer);i=Mi(i,{game:e,isClient:!1,playerID:r.payload.playerID});let s=e.flow.processEvent(i,r),o;return[s,o]=ec(s,i,{game:e,isClient:!1}),o||(s=sb(s,{game:e,action:r}),{...s,_stateID:i._stateID+1})}case _i:{let s=i={...i,deltalog:[]},o=e.flow.getMove(i.ctx,r.payload.type,r.payload.playerID||i.ctx.currentPlayer);if(o===null)return ke(`disallowed move: ${r.payload.type}`),Fe(i,Be.UnavailableMove);if(t&&o.client===!1)return i;if(i.ctx.gameover!==void 0)return ke("cannot make move after game end"),Fe(i,Be.GameOver);if(io(r)&&!e.flow.isPlayerActive(i.G,i.ctx,r.payload.playerID))return ke(`disallowed move: ${r.payload.type}`),Fe(i,Be.InactivePlayer);i=Mi(i,{game:e,isClient:t,playerID:r.payload.playerID});let a=e.processMove(i,r.payload);if(a===eo)return ke(`invalid move: ${r.payload.type} args: ${r.payload.args}`),Fe(i,Be.InvalidMove);let u={...i,G:a};if(t&&Cv(u,{game:e}))return i;if(i=u,t){let l;return[i,l]=ec(i,s,{game:e,isClient:!0}),l||{...i,_stateID:i._stateID+1}}i=Zu(i,r,o),i=e.flow.processMove(i,r.payload);let c;return[i,c]=ec(i,s,{game:e}),c||(i=sb(i,{game:e,action:r}),{...i,_stateID:i._stateID+1})}case Pi:case Si:case Ei:return r.state;case Oi:{if(i={...i,deltalog:[]},e.disableUndo)return ke("Undo is not enabled"),Fe(i,Be.ActionDisabled);let{G:s,ctx:o,_undo:a,_redo:u,_stateID:c}=i;if(a.length<2)return ke("No moves to undo"),Fe(i,Be.ActionInvalid);let l=a[a.length-1],f=a[a.length-2];if(io(r)&&r.payload.playerID!==l.playerID)return ke("Cannot undo other players' moves"),Fe(i,Be.ActionInvalid);if(l.moveType){let p=e.flow.getMove(f.ctx,l.moveType,l.playerID);if(!kN(s,o,p))return ke("Move cannot be undone"),Fe(i,Be.ActionInvalid)}return i=Zu(i,r),{...i,G:f.G,ctx:f.ctx,plugins:f.plugins,_stateID:c+1,_undo:a.slice(0,-1),_redo:[l,...u]}}case ki:{if(i={...i,deltalog:[]},e.disableUndo)return ke("Redo is not enabled"),Fe(i,Be.ActionDisabled);let{_undo:s,_redo:o,_stateID:a}=i;if(o.length===0)return ke("No moves to redo"),Fe(i,Be.ActionInvalid);let u=o[0];return io(r)&&r.payload.playerID!==u.playerID?(ke("Cannot redo other players' moves"),Fe(i,Be.ActionInvalid)):(i=Zu(i,r),{...i,G:u.G,ctx:u.ctx,plugins:u.plugins,_stateID:a+1,_undo:[...s,u],_redo:o.slice(1)})}case xu:return Mv(i,r,{game:e});case Ai:{let s=i,o=JSON.parse(JSON.stringify(s)),a=(0,ob.applyPatch)(o,r.patch);return a.some(c=>c!==null)?(ke(`Patch ${JSON.stringify(r.patch)} apply failed`),Fe(s,tc.PatchFailed,a)):o}default:return i}}}var ZL=he(so());var oo=class{constructor({enumerate:t,seed:n}){this.enumerateFn=t,this.seed=n,this.iterationCounter=0,this._opts={}}addOpt({key:t,range:n,initial:r}){this._opts[t]={range:n,value:r}}getOpt(t){return this._opts[t].value}setOpt(t,n){t in this._opts&&(this._opts[t].value=n)}opts(){return this._opts}enumerate(t,n,r){return this.enumerateFn(t,n,r).map(s=>{if("payload"in s)return s;if("move"in s)return Tu(s.move,s.args,r);if("event"in s)return bn(s.event,s.args,r)})}random(t){let n;if(this.seed!==void 0){let r=this.prngstate?"":this.seed,i=Ou(r,this.prngstate);n=i(),this.prngstate=i.state()}else n=Math.random();if(t)if(Array.isArray(t)){let r=Math.floor(n*t.length);return t[r]}else return Math.floor(n*t);return n}},PN=25,Di=class extends oo{constructor({enumerate:t,seed:n,objectives:r,game:i,iterations:s,playoutDepth:o,iterationCallback:a}){super({enumerate:t,seed:n}),r===void 0&&(r=()=>({})),this.objectives=r,this.iterationCallback=a||(()=>{}),this.reducer=Qn({game:i}),this.iterations=s,this.playoutDepth=o,this.addOpt({key:"async",initial:!1}),this.addOpt({key:"iterations",initial:typeof s=="number"?s:1e3,range:{min:1,max:2e3}}),this.addOpt({key:"playoutDepth",initial:typeof o=="number"?o:50,range:{min:1,max:100}})}createNode({state:t,parentAction:n,parent:r,playerID:i}){let{G:s,ctx:o}=t,a=[],u=[];if(i!==void 0)a=this.enumerate(s,o,i),u=this.objectives(s,o,i);else if(o.activePlayers)for(let c in o.activePlayers)a.push(...this.enumerate(s,o,c)),u.push(this.objectives(s,o,c));else a=this.enumerate(s,o,o.currentPlayer),u=this.objectives(s,o,o.currentPlayer);return{state:t,parent:r,parentAction:n,actions:a,objectives:u,children:[],visits:0,value:0}}select(t){if(t.actions.length>0||t.children.length===0)return t;let n=null,r=0;for(let i of t.children){let s=i.visits+Number.EPSILON,o=i.value/s+Math.sqrt(2*Math.log(t.visits)/s);(n==null||o>r)&&(r=o,n=i)}return this.select(n)}expand(t){let n=t.actions;if(n.length===0||t.state.ctx.gameover!==void 0)return t;let r=this.random(n.length),i=n[r];t.actions.splice(r,1);let s=this.reducer(t.state,i),o=this.createNode({state:s,parentAction:i,parent:t});return t.children.push(o),o}playout({state:t}){let n=this.getOpt("playoutDepth");typeof this.playoutDepth=="function"&&(n=this.playoutDepth(t.G,t.ctx));for(let r=0;r<n&&t.ctx.gameover===void 0;r++){let{G:i,ctx:s}=t,o=s.currentPlayer;s.activePlayers&&(o=Object.keys(s.activePlayers)[0]);let a=this.enumerate(i,s,o),u=this.objectives(i,s,o),c=Object.keys(u).reduce((p,d)=>{let h=u[d];return h.checker(i,s)?p+h.weight:p},0);if(c>0)return{score:c};if(!a||a.length===0)return;let l=this.random(a.length);t=this.reducer(t,a[l])}return t.ctx.gameover}backpropagate(t,n={}){t.visits++,n.score!==void 0&&(t.value+=n.score),n.draw===!0&&(t.value+=.5),t.parentAction&&n.winner===t.parentAction.payload.playerID&&t.value++,t.parent&&this.backpropagate(t.parent,n)}play(t,n){let r=this.createNode({state:t,playerID:n}),i=this.getOpt("iterations");typeof this.iterations=="function"&&(i=this.iterations(t.G,t.ctx));let s=()=>{let o=null;for(let c of r.children)(o==null||c.visits>o.visits)&&(o=c);return{action:o&&o.parentAction,metadata:r}};return new Promise(o=>{let a=()=>{for(let u=0;u<PN&&this.iterationCounter<i;u++){let c=this.select(r),l=this.expand(c),f=this.playout(l);this.backpropagate(l,f),this.iterationCounter++}this.iterationCallback({iterationCounter:this.iterationCounter,numIterations:i,metadata:r})};if(this.iterationCounter=0,this.getOpt("async")){let u=()=>{this.iterationCounter<i?(a(),setImmediate(u)):o(s())};u()}else{for(;this.iterationCounter<i;)a();o(s())}})}},ao=class extends oo{play({G:t,ctx:n},r){let i=this.enumerate(t,n,r);return Promise.resolve({action:this.random(i)})}};async function nc(e,t){let n=e.store.getState(),r=n.ctx.currentPlayer;n.ctx.activePlayers&&(r=Object.keys(n.ctx.activePlayers)[0]);let{action:i,metadata:s}=await t.play(n,r);if(i){let o={...i,payload:{...i.payload,metadata:s}};return e.store.dispatch(o),o}}function U(){}var xc=e=>e;function qt(e,t){for(let n in t)e[n]=t[n];return e}function hw(e){return e()}function lb(){return Object.create(null)}function Ge(e){e.forEach(hw)}function $t(e){return typeof e=="function"}function ee(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function EN(e){return Object.keys(e).length===0}function Wi(e,...t){if(e==null)return U;let n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function mw(e,t,n){e.$$.on_destroy.push(Wi(t,n))}function ON(e,t,n,r){if(e){let i=gw(e,t,n,r);return e[0](i)}}function gw(e,t,n,r){return e[1]&&r?qt(n.ctx.slice(),e[1](r(t))):n.ctx}function SN(e,t,n,r){if(e[2]&&r){let i=e[2](r(n));if(t.dirty===void 0)return i;if(typeof i=="object"){let s=[],o=Math.max(t.dirty.length,i.length);for(let a=0;a<o;a+=1)s[a]=t.dirty[a]|i[a];return s}return t.dirty|i}return t.dirty}function AN(e,t,n,r,i,s){if(i){let o=gw(t,n,r,s);e.p(o,i)}}function xN(e){if(e.ctx.length>32){let t=[],n=e.ctx.length/32;for(let r=0;r<n;r++)t[r]=-1;return t}return-1}function fo(e){let t={};for(let n in e)n[0]!=="$"&&(t[n]=e[n]);return t}function fb(e){return e??""}var yw=typeof window<"u",Tc=yw?()=>window.performance.now():()=>Date.now(),Mc=yw?e=>requestAnimationFrame(e):U,er=new Set;function vw(e){er.forEach(t=>{t.c(e)||(er.delete(t),t.f())}),er.size!==0&&Mc(vw)}function Ic(e){let t;return er.size===0&&Mc(vw),{promise:new Promise(n=>{er.add(t={c:e,f:n})}),abort(){er.delete(t)}}}function _(e,t){e.appendChild(t)}function de(e,t,n){let r=Cc(e);if(!r.getElementById(t)){let i=S("style");i.id=t,i.textContent=n,bw(r,i)}}function Cc(e){if(!e)return document;let t=e.getRootNode?e.getRootNode():e.ownerDocument;return t&&t.host?t:e.ownerDocument}function TN(e){let t=S("style");return bw(Cc(e),t),t.sheet}function bw(e,t){_(e.head||e,t)}function M(e,t,n){e.insertBefore(t,n||null)}function x(e){e.parentNode.removeChild(e)}function Xe(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function S(e){return document.createElement(e)}function Eo(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function Y(e){return document.createTextNode(e)}function N(){return Y(" ")}function ut(){return Y("")}function Q(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function MN(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function O(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function IN(e){return e===""?null:+e}function CN(e){return Array.from(e.childNodes)}function ae(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function pb(e,t){e.value=t??""}function po(e,t){for(let n=0;n<e.options.length;n+=1){let r=e.options[n];if(r.__value===t){r.selected=!0;return}}e.selectedIndex=-1}function ww(e){let t=e.querySelector(":checked")||e.options[0];return t&&t.__value}function ie(e,t,n){e.classList[n?"add":"remove"](t)}function _w(e,t,{bubbles:n=!1,cancelable:r=!1}={}){let i=document.createEvent("CustomEvent");return i.initCustomEvent(e,n,r,t),i}var ho=new Map,mo=0;function RN(e){let t=5381,n=e.length;for(;n--;)t=(t<<5)-t^e.charCodeAt(n);return t>>>0}function NN(e,t){let n={stylesheet:TN(t),rules:{}};return ho.set(e,n),n}function go(e,t,n,r,i,s,o,a=0){let u=16.666/r,c=`{
|
|
11
11
|
`;for(let m=0;m<=1;m+=u){let b=t+(n-t)*s(m);c+=m*100+`%{${o(b,1-b)}}
|
|
12
12
|
`}let l=c+`100% {${o(n,1-n)}}
|
|
13
|
-
}`,f=`__svelte_${
|
|
13
|
+
}`,f=`__svelte_${RN(l)}_${a}`,p=Cc(e),{stylesheet:d,rules:h}=ho.get(p)||NN(p,e);h[f]||(h[f]=!0,d.insertRule(`@keyframes ${f} ${l}`,d.cssRules.length));let y=e.style.animation||"";return e.style.animation=`${y?`${y}, `:""}${f} ${r}ms linear ${i}ms 1 both`,mo+=1,f}function yo(e,t){let n=(e.style.animation||"").split(", "),r=n.filter(t?s=>s.indexOf(t)<0:s=>s.indexOf("__svelte")===-1),i=n.length-r.length;i&&(e.style.animation=r.join(", "),mo-=i,mo||jN())}function jN(){Mc(()=>{mo||(ho.forEach(e=>{let{stylesheet:t}=e,n=t.cssRules.length;for(;n--;)t.deleteRule(n);e.rules={}}),ho.clear())})}var Fi;function Li(e){Fi=e}function Ji(){if(!Fi)throw new Error("Function called outside component initialization");return Fi}function qN(e){Ji().$$.after_update.push(e)}function Rc(e){Ji().$$.on_destroy.push(e)}function Yi(){let e=Ji();return(t,n,{cancelable:r=!1}={})=>{let i=e.$$.callbacks[t];if(i){let s=_w(t,n,{cancelable:r});return i.slice().forEach(o=>{o.call(e,s)}),!s.defaultPrevented}return!0}}function Ui(e,t){return Ji().$$.context.set(e,t),t}function kn(e){return Ji().$$.context.get(e)}function kw(e,t){let n=e.$$.callbacks[t.type];n&&n.slice().forEach(r=>r.call(this,t))}var Gi=[],vo=[],co=[],db=[],DN=Promise.resolve(),ic=!1;function BN(){ic||(ic=!0,DN.then(Pw))}function at(e){co.push(e)}var rc=new Set,uo=0;function Pw(){let e=Fi;do{for(;uo<Gi.length;){let t=Gi[uo];uo++,Li(t),GN(t.$$)}for(Li(null),Gi.length=0,uo=0;vo.length;)vo.pop()();for(let t=0;t<co.length;t+=1){let n=co[t];rc.has(n)||(rc.add(n),n())}co.length=0}while(Gi.length);for(;db.length;)db.pop()();ic=!1,rc.clear(),Li(e)}function GN(e){if(e.fragment!==null){e.update(),Ge(e.before_update);let t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(at)}}var Bi;function Nc(){return Bi||(Bi=Promise.resolve(),Bi.then(()=>{Bi=null})),Bi}function wn(e,t,n){e.dispatchEvent(_w(`${t?"intro":"outro"}${n}`))}var lo=new Set,vt;function ce(){vt={r:0,c:[],p:vt}}function le(){vt.r||Ge(vt.c),vt=vt.p}function P(e,t){e&&e.i&&(lo.delete(e),e.i(t))}function A(e,t,n,r){if(e&&e.o){if(lo.has(e))return;lo.add(e),vt.c.push(()=>{lo.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}var jc={duration:0};function Ew(e,t,n){let r=t(e,n),i=!1,s,o,a=0;function u(){s&&yo(e,s)}function c(){let{delay:f=0,duration:p=300,easing:d=xc,tick:h=U,css:y}=r||jc;y&&(s=go(e,0,1,p,f,d,y,a++)),h(0,1);let m=Tc()+f,b=m+p;o&&o.abort(),i=!0,at(()=>wn(e,!0,"start")),o=Ic(g=>{if(i){if(g>=b)return h(1,0),wn(e,!0,"end"),u(),i=!1;if(g>=m){let k=d((g-m)/p);h(k,1-k)}}return i})}let l=!1;return{start(){l||(l=!0,yo(e),$t(r)?(r=r(),Nc().then(c)):c())},invalidate(){l=!1},end(){i&&(u(),i=!1)}}}function Ow(e,t,n){let r=t(e,n),i=!0,s,o=vt;o.r+=1;function a(){let{delay:u=0,duration:c=300,easing:l=xc,tick:f=U,css:p}=r||jc;p&&(s=go(e,1,0,c,u,l,p));let d=Tc()+u,h=d+c;at(()=>wn(e,!1,"start")),Ic(y=>{if(i){if(y>=h)return f(0,1),wn(e,!1,"end"),--o.r||Ge(o.c),!1;if(y>=d){let m=l((y-d)/c);f(1-m,m)}}return i})}return $t(r)?Nc().then(()=>{r=r(),a()}):a(),{end(u){u&&r.tick&&r.tick(1,0),i&&(s&&yo(e,s),i=!1)}}}function hb(e,t,n,r){let i=t(e,n),s=r?0:1,o=null,a=null,u=null;function c(){u&&yo(e,u)}function l(p,d){let h=p.b-s;return d*=Math.abs(h),{a:s,b:p.b,d:h,duration:d,start:p.start,end:p.start+d,group:p.group}}function f(p){let{delay:d=0,duration:h=300,easing:y=xc,tick:m=U,css:b}=i||jc,g={start:Tc()+d,b:p};p||(g.group=vt,vt.r+=1),o||a?a=g:(b&&(c(),u=go(e,s,p,h,d,y,b)),p&&m(0,1),o=l(g,h),at(()=>wn(e,p,"start")),Ic(k=>{if(a&&k>a.start&&(o=l(a,h),a=null,wn(e,o.b,"start"),b&&(c(),u=go(e,s,o.b,o.duration,0,y,i.css))),o){if(k>=o.end)m(s=o.b,1-s),wn(e,o.b,"end"),a||(o.b?c():--o.group.r||Ge(o.group.c)),o=null;else if(k>=o.start){let I=k-o.start;s=o.a+o.d*y(I/o.duration),m(s,1-s)}}return!!(o||a)}))}return{run(p){$t(i)?Nc().then(()=>{i=i(),f(p)}):f(p)},end(){c(),o=a=null}}}function Sw(e,t){let n={},r={},i={$$scope:1},s=e.length;for(;s--;){let o=e[s],a=t[s];if(a){for(let u in o)u in a||(r[u]=1);for(let u in a)i[u]||(n[u]=a[u],i[u]=1);e[s]=a}else for(let u in o)i[u]=1}for(let o in r)o in n||(n[o]=void 0);return n}function Aw(e){return typeof e=="object"&&e!==null?e:{}}function G(e){e&&e.c()}function D(e,t,n,r){let{fragment:i,on_mount:s,on_destroy:o,after_update:a}=e.$$;i&&i.m(t,n),r||at(()=>{let u=s.map(hw).filter($t);o?o.push(...u):Ge(u),e.$$.on_mount=[]}),a.forEach(at)}function B(e,t){let n=e.$$;n.fragment!==null&&(Ge(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function LN(e,t){e.$$.dirty[0]===-1&&(Gi.push(e),BN(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function te(e,t,n,r,i,s,o,a=[-1]){let u=Fi;Li(e);let c=e.$$={fragment:null,ctx:null,props:s,update:U,not_equal:i,bound:lb(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(u?u.$$.context:[])),callbacks:lb(),dirty:a,skip_bound:!1,root:t.target||u.$$.root};o&&o(c.root);let l=!1;if(c.ctx=n?n(e,t.props||{},(f,p,...d)=>{let h=d.length?d[0]:p;return c.ctx&&i(c.ctx[f],c.ctx[f]=h)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](h),l&&LN(e,f)),p}):[],c.update(),l=!0,Ge(c.before_update),c.fragment=r?r(c.ctx):!1,t.target){if(t.hydrate){let f=CN(t.target);c.fragment&&c.fragment.l(f),f.forEach(x)}else c.fragment&&c.fragment.c();t.intro&&P(e.$$.fragment),D(e,t.target,t.anchor,t.customElement),Pw()}Li(u)}var Z=class{$destroy(){B(this,1),this.$destroy=U}$on(t,n){let r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{let i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!EN(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}},Zn=[];function mb(e,t=U){let n,r=new Set;function i(a){if(ee(e,a)&&(e=a,n)){let u=!Zn.length;for(let c of r)c[1](),Zn.push(c,e);if(u){for(let c=0;c<Zn.length;c+=2)Zn[c][0](Zn[c+1]);Zn.length=0}}}function s(a){i(a(e))}function o(a,u=U){let c=[a,u];return r.add(c),r.size===1&&(n=t(i)||U),a(e),()=>{r.delete(c),r.size===0&&(n(),n=null)}}return{set:i,update:s,subscribe:o}}function qc(e){let t=e-1;return t*t*t+1}function FN(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function gb(e,{delay:t=0,duration:n=400,easing:r=qc,x:i=0,y:s=0,opacity:o=0}={}){let a=getComputedStyle(e),u=+a.opacity,c=a.transform==="none"?"":a.transform,l=u*(1-o);return{delay:t,duration:n,easing:r,css:(f,p)=>`
|
|
14
14
|
transform: ${c} translate(${(1-f)*i}px, ${(1-f)*s}px);
|
|
15
|
-
opacity: ${u-l*p}`}}function
|
|
16
|
-
opacity: ${
|
|
15
|
+
opacity: ${u-l*p}`}}function UN(e){var{fallback:t}=e,n=FN(e,["fallback"]);let r=new Map,i=new Map;function s(a,u,c){let{delay:l=0,duration:f=C=>Math.sqrt(C)*30,easing:p=qc}=qt(qt({},n),c),d=u.getBoundingClientRect(),h=a.left-d.left,y=a.top-d.top,m=a.width/d.width,b=a.height/d.height,g=Math.sqrt(h*h+y*y),k=getComputedStyle(u),I=k.transform==="none"?"":k.transform,j=+k.opacity;return{delay:l,duration:$t(f)?f(g):f,easing:p,css:(C,q)=>`
|
|
16
|
+
opacity: ${C*j};
|
|
17
17
|
transform-origin: top left;
|
|
18
|
-
transform: ${I} translate(${
|
|
19
|
-
`}}function o(a,u,c){return(l,f)=>(a.set(f.key,{rect:l.getBoundingClientRect()}),()=>{if(u.has(f.key)){let{rect:p}=u.get(f.key);return u.delete(f.key),s(p,l,f)}return a.delete(f.key),t&&t(l,f,c)})}return[o(i,r,!1),o(r,i,!0)]}function JC(e){de(e,"svelte-c8tyih","svg.svelte-c8tyih{stroke:currentColor;fill:currentColor;stroke-width:0;width:100%;height:auto;max-height:100%}")}function vb(e){let t,n;return{c(){t=Po("title"),n=Y(e[0])},m(r,i){M(r,t,i),w(t,n)},p(r,i){i&1&&ae(n,r[0])},d(r){r&&S(t)}}}function YC(e){let t,n,r,i=e[0]&&vb(e),s=e[3].default,o=MC(s,e,e[2],null);return{c(){t=Po("svg"),i&&i.c(),n=at(),o&&o.c(),k(t,"xmlns","http://www.w3.org/2000/svg"),k(t,"viewBox",e[1]),k(t,"class","svelte-c8tyih")},m(a,u){M(a,t,u),i&&i.m(t,null),w(t,n),o&&o.m(t,null),r=!0},p(a,[u]){a[0]?i?i.p(a,u):(i=vb(a),i.c(),i.m(t,n)):i&&(i.d(1),i=null),o&&o.p&&(!r||u&4)&&NC(o,s,a,a[2],r?IC(s,a[2],u,null):CC(a[2]),null),(!r||u&2)&&k(t,"viewBox",a[1])},i(a){r||(P(o,a),r=!0)},o(a){x(o,a),r=!1},d(a){a&&S(t),i&&i.d(),o&&o.d(a)}}}function $C(e,t,n){let{$$slots:r={},$$scope:i}=t,{title:s=null}=t,{viewBox:o}=t;return e.$$set=a=>{"title"in a&&n(0,s=a.title),"viewBox"in a&&n(1,o=a.viewBox),"$$scope"in a&&n(2,i=a.$$scope)},[s,o,i,r]}var vo=class extends Z{constructor(t){super(),te(this,t,$C,YC,ee,{title:0,viewBox:1},JC)}};function XC(e){let t;return{c(){t=Po("path"),k(t,"d","M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z")},m(n,r){M(n,t,r)},p:U,d(n){n&&S(t)}}}function QC(e){let t,n,r=[{viewBox:"0 0 320 512"},e[0]],i={$$slots:{default:[XC]},$$scope:{ctx:e}};for(let s=0;s<r.length;s+=1)i=jt(i,r[s]);return t=new vo({props:i}),{c(){L(t.$$.fragment)},m(s,o){R(t,s,o),n=!0},p(s,[o]){let a=o&1?x1(r,[r[0],S1(s[0])]):{};o&2&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(P(t.$$.fragment,s),n=!0)},o(s){x(t.$$.fragment,s),n=!1},d(s){B(t,s)}}}function ZC(e,t,n){return e.$$set=r=>{n(0,t=jt(jt({},t),lo(r)))},t=lo(t),[t]}var bo=class extends Z{constructor(t){super(),te(this,t,ZC,QC,ee,{})}};function eq(e){de(e,"svelte-1xg9v5h",".menu.svelte-1xg9v5h{display:flex;margin-top:43px;flex-direction:row-reverse;border:1px solid #ccc;border-radius:5px 5px 0 0;height:25px;line-height:25px;margin-right:-500px;transform-origin:bottom right;transform:rotate(-90deg) translate(0, -500px)}.menu-item.svelte-1xg9v5h{line-height:25px;cursor:pointer;border:0;background:#fefefe;color:#555;padding-left:15px;padding-right:15px;text-align:center}.menu-item.svelte-1xg9v5h:first-child{border-radius:0 5px 0 0}.menu-item.svelte-1xg9v5h:last-child{border-radius:5px 0 0 0}.menu-item.active.svelte-1xg9v5h{cursor:default;font-weight:bold;background:#ddd;color:#555}.menu-item.svelte-1xg9v5h:hover,.menu-item.svelte-1xg9v5h:focus{background:#eee;color:#555}")}function bb(e,t,n){let r=e.slice();return r[4]=t[n][0],r[5]=t[n][1].label,r}function _b(e){let t,n=e[5]+"",r,i,s,o;function a(){return e[3](e[4])}return{c(){t=A("button"),r=Y(n),i=q(),k(t,"class","menu-item svelte-1xg9v5h"),ie(t,"active",e[0]==e[4])},m(u,c){M(u,t,c),w(t,r),w(t,i),s||(o=Q(t,"click",a),s=!0)},p(u,c){e=u,c&2&&n!==(n=e[5]+"")&&ae(r,n),c&3&&ie(t,"active",e[0]==e[4])},d(u){u&&S(t),s=!1,o()}}}function tq(e){let t,n=Object.entries(e[1]),r=[];for(let i=0;i<n.length;i+=1)r[i]=_b(bb(e,n,i));return{c(){t=A("nav");for(let i=0;i<r.length;i+=1)r[i].c();k(t,"class","menu svelte-1xg9v5h")},m(i,s){M(i,t,s);for(let o=0;o<r.length;o+=1)r[o].m(t,null)},p(i,[s]){if(s&7){n=Object.entries(i[1]);let o;for(o=0;o<n.length;o+=1){let a=bb(i,n,o);r[o]?r[o].p(a,s):(r[o]=_b(a),r[o].c(),r[o].m(t,null))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},i:U,o:U,d(i){i&&S(t),$e(r,i)}}}function nq(e,t,n){let{pane:r}=t,{panes:i}=t,s=Ji(),o=a=>s("change",a);return e.$$set=a=>{"pane"in a&&n(0,r=a.pane),"panes"in a&&n(1,i=a.panes)},[r,i,s,o]}var sc=class extends Z{constructor(t){super(),te(this,t,nq,tq,ee,{pane:0,panes:1},eq)}},tr={};function rq(e){de(e,"svelte-1vyml86",".container.svelte-1vyml86{display:inline-block;cursor:pointer;transform:translate(calc(0px - var(--li-identation)), -50%);position:absolute;top:50%;padding-right:100%}.arrow.svelte-1vyml86{transform-origin:25% 50%;position:relative;line-height:1.1em;font-size:0.75em;margin-left:0;transition:150ms;color:var(--arrow-sign);user-select:none;font-family:'Courier New', Courier, monospace}.expanded.svelte-1vyml86{transform:rotateZ(90deg) translateX(-3px)}")}function iq(e){let t,n,r,i;return{c(){t=A("div"),n=A("div"),n.textContent="\u25B6",k(n,"class","arrow svelte-1vyml86"),ie(n,"expanded",e[0]),k(t,"class","container svelte-1vyml86")},m(s,o){M(s,t,o),w(t,n),r||(i=Q(t,"click",e[1]),r=!0)},p(s,[o]){o&1&&ie(n,"expanded",s[0])},i:U,o:U,d(s){s&&S(t),r=!1,i()}}}function sq(e,t,n){let{expanded:r}=t;function i(s){P1.call(this,e,s)}return e.$$set=s=>{"expanded"in s&&n(0,r=s.expanded)},[r,i]}var _o=class extends Z{constructor(t){super(),te(this,t,sq,iq,ee,{expanded:0},rq)}};function oq(e){de(e,"svelte-1vlbacg","label.svelte-1vlbacg{display:inline-block;color:var(--label-color);padding:0}.spaced.svelte-1vlbacg{padding-right:var(--li-colon-space)}")}function wb(e){let t,n,r,i,s,o;return{c(){t=A("label"),n=A("span"),r=Y(e[0]),i=Y(e[2]),k(t,"class","svelte-1vlbacg"),ie(t,"spaced",e[1])},m(a,u){M(a,t,u),w(t,n),w(n,r),w(n,i),s||(o=Q(t,"click",e[5]),s=!0)},p(a,u){u&1&&ae(r,a[0]),u&4&&ae(i,a[2]),u&2&&ie(t,"spaced",a[1])},d(a){a&&S(t),s=!1,o()}}}function aq(e){let t,n=e[3]&&e[0]&&wb(e);return{c(){n&&n.c(),t=at()},m(r,i){n&&n.m(r,i),M(r,t,i)},p(r,[i]){r[3]&&r[0]?n?n.p(r,i):(n=wb(r),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:U,o:U,d(r){n&&n.d(r),r&&S(t)}}}function uq(e,t,n){let r,{key:i,isParentExpanded:s,isParentArray:o=!1,colon:a=":"}=t;function u(c){P1.call(this,e,c)}return e.$$set=c=>{"key"in c&&n(0,i=c.key),"isParentExpanded"in c&&n(1,s=c.isParentExpanded),"isParentArray"in c&&n(4,o=c.isParentArray),"colon"in c&&n(2,a=c.colon)},e.$$.update=()=>{e.$$.dirty&19&&n(3,r=s||!o||i!=+i)},[i,s,a,r,o,u]}var nr=class extends Z{constructor(t){super(),te(this,t,uq,aq,ee,{key:0,isParentExpanded:1,isParentArray:4,colon:2},oq)}};function cq(e){de(e,"svelte-rwxv37","label.svelte-rwxv37{display:inline-block}.indent.svelte-rwxv37{padding-left:var(--li-identation)}.collapse.svelte-rwxv37{--li-display:inline;display:inline;font-style:italic}.comma.svelte-rwxv37{margin-left:-0.5em;margin-right:0.5em}label.svelte-rwxv37{position:relative}")}function Ob(e,t,n){let r=e.slice();return r[12]=t[n],r[20]=n,r}function Pb(e){let t,n;return t=new _o({props:{expanded:e[0]}}),t.$on("click",e[15]),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,i){let s={};i&1&&(s.expanded=r[0]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function lq(e){let t;return{c(){t=A("span"),t.textContent="\u2026"},m(n,r){M(n,t,r)},p:U,i:U,o:U,d(n){n&&S(t)}}}function fq(e){let t,n,r,i,s,o=e[13],a=[];for(let l=0;l<o.length;l+=1)a[l]=kb(Ob(e,o,l));let u=l=>x(a[l],1,1,()=>{a[l]=null}),c=e[13].length<e[7].length&&Ab();return{c(){t=A("ul");for(let l=0;l<a.length;l+=1)a[l].c();n=q(),c&&c.c(),k(t,"class","svelte-rwxv37"),ie(t,"collapse",!e[0])},m(l,f){M(l,t,f);for(let p=0;p<a.length;p+=1)a[p].m(t,null);w(t,n),c&&c.m(t,null),r=!0,i||(s=Q(t,"click",e[16]),i=!0)},p(l,f){if(f&10129){o=l[13];let p;for(p=0;p<o.length;p+=1){let h=Ob(l,o,p);a[p]?(a[p].p(h,f),P(a[p],1)):(a[p]=kb(h),a[p].c(),P(a[p],1),a[p].m(t,n))}for(ce(),p=o.length;p<a.length;p+=1)u(p);le()}l[13].length<l[7].length?c||(c=Ab(),c.c(),c.m(t,null)):c&&(c.d(1),c=null),f&1&&ie(t,"collapse",!l[0])},i(l){if(!r){for(let f=0;f<o.length;f+=1)P(a[f]);r=!0}},o(l){a=a.filter(Boolean);for(let f=0;f<a.length;f+=1)x(a[f]);r=!1},d(l){l&&S(t),$e(a,l),c&&c.d(),i=!1,s()}}}function Eb(e){let t;return{c(){t=A("span"),t.textContent=",",k(t,"class","comma svelte-rwxv37")},m(n,r){M(n,t,r)},d(n){n&&S(t)}}}function kb(e){let t,n,r,i;t=new Ui({props:{key:e[8](e[12]),isParentExpanded:e[0],isParentArray:e[4],value:e[0]?e[9](e[12]):e[10](e[12])}});let s=!e[0]&&e[20]<e[7].length-1&&Eb();return{c(){L(t.$$.fragment),n=q(),s&&s.c(),r=at()},m(o,a){R(t,o,a),M(o,n,a),s&&s.m(o,a),M(o,r,a),i=!0},p(o,a){let u={};a&8448&&(u.key=o[8](o[12])),a&1&&(u.isParentExpanded=o[0]),a&16&&(u.isParentArray=o[4]),a&9729&&(u.value=o[0]?o[9](o[12]):o[10](o[12])),t.$set(u),!o[0]&&o[20]<o[7].length-1?s||(s=Eb(),s.c(),s.m(r.parentNode,r)):s&&(s.d(1),s=null)},i(o){i||(P(t.$$.fragment,o),i=!0)},o(o){x(t.$$.fragment,o),i=!1},d(o){B(t,o),o&&S(n),s&&s.d(o),o&&S(r)}}}function Ab(e){let t;return{c(){t=A("span"),t.textContent="\u2026"},m(n,r){M(n,t,r)},d(n){n&&S(t)}}}function pq(e){let t,n,r,i,s,o,a,u,c,l,f,p,h,d,y,m,b,g,O=e[11]&&e[2]&&Pb(e);i=new nr({props:{key:e[12],colon:e[14].colon,isParentExpanded:e[2],isParentArray:e[3]}}),i.$on("click",e[15]);let I=[fq,lq],j=[];function N(D,J){return D[2]?0:1}return f=N(e),p=j[f]=I[f](e),{c(){t=A("li"),n=A("label"),O&&O.c(),r=q(),L(i.$$.fragment),s=q(),o=A("span"),a=A("span"),u=Y(e[1]),c=Y(e[5]),l=q(),p.c(),h=q(),d=A("span"),y=Y(e[6]),k(n,"class","svelte-rwxv37"),k(t,"class","svelte-rwxv37"),ie(t,"indent",e[2])},m(D,J){M(D,t,J),w(t,n),O&&O.m(n,null),w(n,r),R(i,n,null),w(n,s),w(n,o),w(o,a),w(a,u),w(o,c),w(t,l),j[f].m(t,null),w(t,h),w(t,d),w(d,y),m=!0,b||(g=Q(o,"click",e[15]),b=!0)},p(D,[J]){D[11]&&D[2]?O?(O.p(D,J),J&2052&&P(O,1)):(O=Pb(D),O.c(),P(O,1),O.m(n,r)):O&&(ce(),x(O,1,1,()=>{O=null}),le());let fe={};J&4096&&(fe.key=D[12]),J&4&&(fe.isParentExpanded=D[2]),J&8&&(fe.isParentArray=D[3]),i.$set(fe),(!m||J&2)&&ae(u,D[1]),(!m||J&32)&&ae(c,D[5]);let V=f;f=N(D),f===V?j[f].p(D,J):(ce(),x(j[V],1,1,()=>{j[V]=null}),le(),p=j[f],p?p.p(D,J):(p=j[f]=I[f](D),p.c()),P(p,1),p.m(t,h)),(!m||J&64)&&ae(y,D[6]),J&4&&ie(t,"indent",D[2])},i(D){m||(P(O),P(i.$$.fragment,D),P(p),m=!0)},o(D){x(O),x(i.$$.fragment,D),x(p),m=!1},d(D){D&&S(t),O&&O.d(),B(i),j[f].d(),b=!1,g()}}}function hq(e,t,n){let r,{key:i,keys:s,colon:o=":",label:a="",isParentExpanded:u,isParentArray:c,isArray:l=!1,bracketOpen:f,bracketClose:p}=t,{previewKeys:h=s}=t,{getKey:d=N=>N}=t,{getValue:y=N=>N}=t,{getPreviewValue:m=y}=t,{expanded:b=!1,expandable:g=!0}=t,O=wn(tr);Fi(tr,{...O,colon:o});function I(){n(0,b=!b)}function j(){n(0,b=!0)}return e.$$set=N=>{"key"in N&&n(12,i=N.key),"keys"in N&&n(17,s=N.keys),"colon"in N&&n(18,o=N.colon),"label"in N&&n(1,a=N.label),"isParentExpanded"in N&&n(2,u=N.isParentExpanded),"isParentArray"in N&&n(3,c=N.isParentArray),"isArray"in N&&n(4,l=N.isArray),"bracketOpen"in N&&n(5,f=N.bracketOpen),"bracketClose"in N&&n(6,p=N.bracketClose),"previewKeys"in N&&n(7,h=N.previewKeys),"getKey"in N&&n(8,d=N.getKey),"getValue"in N&&n(9,y=N.getValue),"getPreviewValue"in N&&n(10,m=N.getPreviewValue),"expanded"in N&&n(0,b=N.expanded),"expandable"in N&&n(11,g=N.expandable)},e.$$.update=()=>{e.$$.dirty&4&&(u||n(0,b=!1)),e.$$.dirty&131201&&n(13,r=b?s:h.slice(0,5))},[b,a,u,c,l,f,p,h,d,y,m,g,i,r,O,I,j,s,o]}var _n=class extends Z{constructor(t){super(),te(this,t,hq,pq,ee,{key:12,keys:17,colon:18,label:1,isParentExpanded:2,isParentArray:3,isArray:4,bracketOpen:5,bracketClose:6,previewKeys:7,getKey:8,getValue:9,getPreviewValue:10,expanded:0,expandable:11},cq)}};function dq(e){let t,n;return t=new _n({props:{key:e[0],expanded:e[4],isParentExpanded:e[1],isParentArray:e[2],keys:e[5],previewKeys:e[5],getValue:e[6],label:e[3]+" ",bracketOpen:"{",bracketClose:"}"}}),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,[i]){let s={};i&1&&(s.key=r[0]),i&16&&(s.expanded=r[4]),i&2&&(s.isParentExpanded=r[1]),i&4&&(s.isParentArray=r[2]),i&32&&(s.keys=r[5]),i&32&&(s.previewKeys=r[5]),i&8&&(s.label=r[3]+" "),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function mq(e,t,n){let r,{key:i,value:s,isParentExpanded:o,isParentArray:a,nodeType:u}=t,{expanded:c=!0}=t;function l(f){return s[f]}return e.$$set=f=>{"key"in f&&n(0,i=f.key),"value"in f&&n(7,s=f.value),"isParentExpanded"in f&&n(1,o=f.isParentExpanded),"isParentArray"in f&&n(2,a=f.isParentArray),"nodeType"in f&&n(3,u=f.nodeType),"expanded"in f&&n(4,c=f.expanded)},e.$$.update=()=>{e.$$.dirty&128&&n(5,r=Object.getOwnPropertyNames(s))},[i,o,a,u,c,r,l,s]}var oc=class extends Z{constructor(t){super(),te(this,t,mq,dq,ee,{key:0,value:7,isParentExpanded:1,isParentArray:2,nodeType:3,expanded:4})}};function gq(e){let t,n;return t=new _n({props:{key:e[0],expanded:e[4],isParentExpanded:e[2],isParentArray:e[3],isArray:!0,keys:e[5],previewKeys:e[6],getValue:e[7],label:"Array("+e[1].length+")",bracketOpen:"[",bracketClose:"]"}}),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,[i]){let s={};i&1&&(s.key=r[0]),i&16&&(s.expanded=r[4]),i&4&&(s.isParentExpanded=r[2]),i&8&&(s.isParentArray=r[3]),i&32&&(s.keys=r[5]),i&64&&(s.previewKeys=r[6]),i&2&&(s.label="Array("+r[1].length+")"),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function yq(e,t,n){let r,i,{key:s,value:o,isParentExpanded:a,isParentArray:u}=t,{expanded:c=JSON.stringify(o).length<1024}=t,l=new Set(["length"]);function f(p){return o[p]}return e.$$set=p=>{"key"in p&&n(0,s=p.key),"value"in p&&n(1,o=p.value),"isParentExpanded"in p&&n(2,a=p.isParentExpanded),"isParentArray"in p&&n(3,u=p.isParentArray),"expanded"in p&&n(4,c=p.expanded)},e.$$.update=()=>{e.$$.dirty&2&&n(5,r=Object.getOwnPropertyNames(o)),e.$$.dirty&32&&n(6,i=r.filter(p=>!l.has(p)))},[s,o,a,u,c,r,i,f]}var ac=class extends Z{constructor(t){super(),te(this,t,yq,gq,ee,{key:0,value:1,isParentExpanded:2,isParentArray:3,expanded:4})}};function vq(e){let t,n;return t=new _n({props:{key:e[0],isParentExpanded:e[1],isParentArray:e[2],keys:e[4],getKey:bq,getValue:_q,isArray:!0,label:e[3]+"("+e[4].length+")",bracketOpen:"{",bracketClose:"}"}}),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,[i]){let s={};i&1&&(s.key=r[0]),i&2&&(s.isParentExpanded=r[1]),i&4&&(s.isParentArray=r[2]),i&16&&(s.keys=r[4]),i&24&&(s.label=r[3]+"("+r[4].length+")"),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function bq(e){return String(e[0])}function _q(e){return e[1]}function wq(e,t,n){let{key:r,value:i,isParentExpanded:s,isParentArray:o,nodeType:a}=t,u=[];return e.$$set=c=>{"key"in c&&n(0,r=c.key),"value"in c&&n(5,i=c.value),"isParentExpanded"in c&&n(1,s=c.isParentExpanded),"isParentArray"in c&&n(2,o=c.isParentArray),"nodeType"in c&&n(3,a=c.nodeType)},e.$$.update=()=>{if(e.$$.dirty&32){let c=[],l=0;for(let f of i)c.push([l++,f]);n(4,u=c)}},[r,s,o,a,u,i]}var uc=class extends Z{constructor(t){super(),te(this,t,wq,vq,ee,{key:0,value:5,isParentExpanded:1,isParentArray:2,nodeType:3})}},cc=class{constructor(t,n){this.key=t,this.value=n}};function Oq(e){let t,n;return t=new _n({props:{key:e[0],isParentExpanded:e[1],isParentArray:e[2],keys:e[4],getKey:Pq,getValue:Eq,label:e[3]+"("+e[4].length+")",colon:"",bracketOpen:"{",bracketClose:"}"}}),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,[i]){let s={};i&1&&(s.key=r[0]),i&2&&(s.isParentExpanded=r[1]),i&4&&(s.isParentArray=r[2]),i&16&&(s.keys=r[4]),i&24&&(s.label=r[3]+"("+r[4].length+")"),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function Pq(e){return e[0]}function Eq(e){return e[1]}function kq(e,t,n){let{key:r,value:i,isParentExpanded:s,isParentArray:o,nodeType:a}=t,u=[];return e.$$set=c=>{"key"in c&&n(0,r=c.key),"value"in c&&n(5,i=c.value),"isParentExpanded"in c&&n(1,s=c.isParentExpanded),"isParentArray"in c&&n(2,o=c.isParentArray),"nodeType"in c&&n(3,a=c.nodeType)},e.$$.update=()=>{if(e.$$.dirty&32){let c=[],l=0;for(let f of i)c.push([l++,new cc(f[0],f[1])]);n(4,u=c)}},[r,s,o,a,u,i]}var lc=class extends Z{constructor(t){super(),te(this,t,kq,Oq,ee,{key:0,value:5,isParentExpanded:1,isParentArray:2,nodeType:3})}};function Aq(e){let t,n;return t=new _n({props:{expanded:e[4],isParentExpanded:e[2],isParentArray:e[3],key:e[2]?String(e[0]):e[1].key,keys:e[5],getValue:e[6],label:e[2]?"Entry ":"=> ",bracketOpen:"{",bracketClose:"}"}}),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,[i]){let s={};i&16&&(s.expanded=r[4]),i&4&&(s.isParentExpanded=r[2]),i&8&&(s.isParentArray=r[3]),i&7&&(s.key=r[2]?String(r[0]):r[1].key),i&4&&(s.label=r[2]?"Entry ":"=> "),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function xq(e,t,n){let{key:r,value:i,isParentExpanded:s,isParentArray:o}=t,{expanded:a=!1}=t,u=["key","value"];function c(l){return i[l]}return e.$$set=l=>{"key"in l&&n(0,r=l.key),"value"in l&&n(1,i=l.value),"isParentExpanded"in l&&n(2,s=l.isParentExpanded),"isParentArray"in l&&n(3,o=l.isParentArray),"expanded"in l&&n(4,a=l.expanded)},[r,i,s,o,a,u,c]}var fc=class extends Z{constructor(t){super(),te(this,t,xq,Aq,ee,{key:0,value:1,isParentExpanded:2,isParentArray:3,expanded:4})}};function Sq(e){de(e,"svelte-3bjyvl","li.svelte-3bjyvl{user-select:text;word-wrap:break-word;word-break:break-all}.indent.svelte-3bjyvl{padding-left:var(--li-identation)}.String.svelte-3bjyvl{color:var(--string-color)}.Date.svelte-3bjyvl{color:var(--date-color)}.Number.svelte-3bjyvl{color:var(--number-color)}.Boolean.svelte-3bjyvl{color:var(--boolean-color)}.Null.svelte-3bjyvl{color:var(--null-color)}.Undefined.svelte-3bjyvl{color:var(--undefined-color)}.Function.svelte-3bjyvl{color:var(--function-color);font-style:italic}.Symbol.svelte-3bjyvl{color:var(--symbol-color)}")}function Tq(e){let t,n,r,i,s=(e[2]?e[2](e[1]):e[1])+"",o,a,u;return n=new nr({props:{key:e[0],colon:e[6],isParentExpanded:e[3],isParentArray:e[4]}}),{c(){t=A("li"),L(n.$$.fragment),r=q(),i=A("span"),o=Y(s),k(i,"class",a=pb(e[5])+" svelte-3bjyvl"),k(t,"class","svelte-3bjyvl"),ie(t,"indent",e[3])},m(c,l){M(c,t,l),R(n,t,null),w(t,r),w(t,i),w(i,o),u=!0},p(c,[l]){let f={};l&1&&(f.key=c[0]),l&8&&(f.isParentExpanded=c[3]),l&16&&(f.isParentArray=c[4]),n.$set(f),(!u||l&6)&&s!==(s=(c[2]?c[2](c[1]):c[1])+"")&&ae(o,s),(!u||l&32&&a!==(a=pb(c[5])+" svelte-3bjyvl"))&&k(i,"class",a),l&8&&ie(t,"indent",c[3])},i(c){u||(P(n.$$.fragment,c),u=!0)},o(c){x(n.$$.fragment,c),u=!1},d(c){c&&S(t),B(n)}}}function Mq(e,t,n){let{key:r,value:i,valueGetter:s=null,isParentExpanded:o,isParentArray:a,nodeType:u}=t,{colon:c}=wn(tr);return e.$$set=l=>{"key"in l&&n(0,r=l.key),"value"in l&&n(1,i=l.value),"valueGetter"in l&&n(2,s=l.valueGetter),"isParentExpanded"in l&&n(3,o=l.isParentExpanded),"isParentArray"in l&&n(4,a=l.isParentArray),"nodeType"in l&&n(5,u=l.nodeType)},[r,i,s,o,a,u,c]}var pc=class extends Z{constructor(t){super(),te(this,t,Mq,Tq,ee,{key:0,value:1,valueGetter:2,isParentExpanded:3,isParentArray:4,nodeType:5},Sq)}};function Iq(e){de(e,"svelte-1ca3gb2","li.svelte-1ca3gb2{user-select:text;word-wrap:break-word;word-break:break-all}.indent.svelte-1ca3gb2{padding-left:var(--li-identation)}.collapse.svelte-1ca3gb2{--li-display:inline;display:inline;font-style:italic}")}function xb(e,t,n){let r=e.slice();return r[8]=t[n],r[10]=n,r}function Sb(e){let t,n;return t=new _o({props:{expanded:e[0]}}),t.$on("click",e[7]),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,i){let s={};i&1&&(s.expanded=r[0]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function Tb(e){let t,n,r=e[0]&&Mb(e);return{c(){t=A("ul"),r&&r.c(),k(t,"class","svelte-1ca3gb2"),ie(t,"collapse",!e[0])},m(i,s){M(i,t,s),r&&r.m(t,null),n=!0},p(i,s){i[0]?r?(r.p(i,s),s&1&&P(r,1)):(r=Mb(i),r.c(),P(r,1),r.m(t,null)):r&&(ce(),x(r,1,1,()=>{r=null}),le()),s&1&&ie(t,"collapse",!i[0])},i(i){n||(P(r),n=!0)},o(i){x(r),n=!1},d(i){i&&S(t),r&&r.d()}}}function Mb(e){let t,n,r,i,s,o,a;t=new Ui({props:{key:"message",value:e[2].message}}),i=new nr({props:{key:"stack",colon:":",isParentExpanded:e[3]}});let u=e[5],c=[];for(let l=0;l<u.length;l+=1)c[l]=Ib(xb(e,u,l));return{c(){L(t.$$.fragment),n=q(),r=A("li"),L(i.$$.fragment),s=q(),o=A("span");for(let l=0;l<c.length;l+=1)c[l].c();k(r,"class","svelte-1ca3gb2")},m(l,f){R(t,l,f),M(l,n,f),M(l,r,f),R(i,r,null),w(r,s),w(r,o);for(let p=0;p<c.length;p+=1)c[p].m(o,null);a=!0},p(l,f){let p={};f&4&&(p.value=l[2].message),t.$set(p);let h={};if(f&8&&(h.isParentExpanded=l[3]),i.$set(h),f&32){u=l[5];let d;for(d=0;d<u.length;d+=1){let y=xb(l,u,d);c[d]?c[d].p(y,f):(c[d]=Ib(y),c[d].c(),c[d].m(o,null))}for(;d<c.length;d+=1)c[d].d(1);c.length=u.length}},i(l){a||(P(t.$$.fragment,l),P(i.$$.fragment,l),a=!0)},o(l){x(t.$$.fragment,l),x(i.$$.fragment,l),a=!1},d(l){B(t,l),l&&S(n),l&&S(r),B(i),$e(c,l)}}}function Ib(e){let t,n=e[8]+"",r,i;return{c(){t=A("span"),r=Y(n),i=A("br"),k(t,"class","svelte-1ca3gb2"),ie(t,"indent",e[10]>0)},m(s,o){M(s,t,o),w(t,r),M(s,i,o)},p(s,o){o&32&&n!==(n=s[8]+"")&&ae(r,n)},d(s){s&&S(t),s&&S(i)}}}function Nq(e){let t,n,r,i,s,o,a=(e[0]?"":e[2].message)+"",u,c,l,f,p,h=e[3]&&Sb(e);r=new nr({props:{key:e[1],colon:e[6].colon,isParentExpanded:e[3],isParentArray:e[4]}});let d=e[3]&&Tb(e);return{c(){t=A("li"),h&&h.c(),n=q(),L(r.$$.fragment),i=q(),s=A("span"),o=Y("Error: "),u=Y(a),c=q(),d&&d.c(),k(t,"class","svelte-1ca3gb2"),ie(t,"indent",e[3])},m(y,m){M(y,t,m),h&&h.m(t,null),w(t,n),R(r,t,null),w(t,i),w(t,s),w(s,o),w(s,u),w(t,c),d&&d.m(t,null),l=!0,f||(p=Q(s,"click",e[7]),f=!0)},p(y,[m]){y[3]?h?(h.p(y,m),m&8&&P(h,1)):(h=Sb(y),h.c(),P(h,1),h.m(t,n)):h&&(ce(),x(h,1,1,()=>{h=null}),le());let b={};m&2&&(b.key=y[1]),m&8&&(b.isParentExpanded=y[3]),m&16&&(b.isParentArray=y[4]),r.$set(b),(!l||m&5)&&a!==(a=(y[0]?"":y[2].message)+"")&&ae(u,a),y[3]?d?(d.p(y,m),m&8&&P(d,1)):(d=Tb(y),d.c(),P(d,1),d.m(t,null)):d&&(ce(),x(d,1,1,()=>{d=null}),le()),m&8&&ie(t,"indent",y[3])},i(y){l||(P(h),P(r.$$.fragment,y),P(d),l=!0)},o(y){x(h),x(r.$$.fragment,y),x(d),l=!1},d(y){y&&S(t),h&&h.d(),B(r),d&&d.d(),f=!1,p()}}}function Cq(e,t,n){let r,{key:i,value:s,isParentExpanded:o,isParentArray:a}=t,{expanded:u=!1}=t,c=wn(tr);Fi(tr,{...c,colon:":"});function l(){n(0,u=!u)}return e.$$set=f=>{"key"in f&&n(1,i=f.key),"value"in f&&n(2,s=f.value),"isParentExpanded"in f&&n(3,o=f.isParentExpanded),"isParentArray"in f&&n(4,a=f.isParentArray),"expanded"in f&&n(0,u=f.expanded)},e.$$.update=()=>{e.$$.dirty&4&&n(5,r=s.stack.split(`
|
|
20
|
-
`)),e.$$.dirty&8&&(o||n(0,u=!1))},[u,i,s,o,a,r,c,l]}var
|
|
18
|
+
transform: ${I} translate(${q*h}px,${q*y}px) scale(${C+(1-C)*m}, ${C+(1-C)*b});
|
|
19
|
+
`}}function o(a,u,c){return(l,f)=>(a.set(f.key,{rect:l.getBoundingClientRect()}),()=>{if(u.has(f.key)){let{rect:p}=u.get(f.key);return u.delete(f.key),s(p,l,f)}return a.delete(f.key),t&&t(l,f,c)})}return[o(i,r,!1),o(r,i,!0)]}function VN(e){de(e,"svelte-c8tyih","svg.svelte-c8tyih{stroke:currentColor;fill:currentColor;stroke-width:0;width:100%;height:auto;max-height:100%}")}function yb(e){let t,n;return{c(){t=Eo("title"),n=Y(e[0])},m(r,i){M(r,t,i),_(t,n)},p(r,i){i&1&&ae(n,r[0])},d(r){r&&x(t)}}}function zN(e){let t,n,r,i=e[0]&&yb(e),s=e[3].default,o=ON(s,e,e[2],null);return{c(){t=Eo("svg"),i&&i.c(),n=ut(),o&&o.c(),O(t,"xmlns","http://www.w3.org/2000/svg"),O(t,"viewBox",e[1]),O(t,"class","svelte-c8tyih")},m(a,u){M(a,t,u),i&&i.m(t,null),_(t,n),o&&o.m(t,null),r=!0},p(a,[u]){a[0]?i?i.p(a,u):(i=yb(a),i.c(),i.m(t,n)):i&&(i.d(1),i=null),o&&o.p&&(!r||u&4)&&AN(o,s,a,a[2],r?SN(s,a[2],u,null):xN(a[2]),null),(!r||u&2)&&O(t,"viewBox",a[1])},i(a){r||(P(o,a),r=!0)},o(a){A(o,a),r=!1},d(a){a&&x(t),i&&i.d(),o&&o.d(a)}}}function KN(e,t,n){let{$$slots:r={},$$scope:i}=t,{title:s=null}=t,{viewBox:o}=t;return e.$$set=a=>{"title"in a&&n(0,s=a.title),"viewBox"in a&&n(1,o=a.viewBox),"$$scope"in a&&n(2,i=a.$$scope)},[s,o,i,r]}var bo=class extends Z{constructor(t){super(),te(this,t,KN,zN,ee,{title:0,viewBox:1},VN)}};function HN(e){let t;return{c(){t=Eo("path"),O(t,"d","M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z")},m(n,r){M(n,t,r)},p:U,d(n){n&&x(t)}}}function WN(e){let t,n,r=[{viewBox:"0 0 320 512"},e[0]],i={$$slots:{default:[HN]},$$scope:{ctx:e}};for(let s=0;s<r.length;s+=1)i=qt(i,r[s]);return t=new bo({props:i}),{c(){G(t.$$.fragment)},m(s,o){D(t,s,o),n=!0},p(s,[o]){let a=o&1?Sw(r,[r[0],Aw(s[0])]):{};o&2&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(P(t.$$.fragment,s),n=!0)},o(s){A(t.$$.fragment,s),n=!1},d(s){B(t,s)}}}function JN(e,t,n){return e.$$set=r=>{n(0,t=qt(qt({},t),fo(r)))},t=fo(t),[t]}var wo=class extends Z{constructor(t){super(),te(this,t,JN,WN,ee,{})}};function YN(e){de(e,"svelte-1xg9v5h",".menu.svelte-1xg9v5h{display:flex;margin-top:43px;flex-direction:row-reverse;border:1px solid #ccc;border-radius:5px 5px 0 0;height:25px;line-height:25px;margin-right:-500px;transform-origin:bottom right;transform:rotate(-90deg) translate(0, -500px)}.menu-item.svelte-1xg9v5h{line-height:25px;cursor:pointer;border:0;background:#fefefe;color:#555;padding-left:15px;padding-right:15px;text-align:center}.menu-item.svelte-1xg9v5h:first-child{border-radius:0 5px 0 0}.menu-item.svelte-1xg9v5h:last-child{border-radius:5px 0 0 0}.menu-item.active.svelte-1xg9v5h{cursor:default;font-weight:bold;background:#ddd;color:#555}.menu-item.svelte-1xg9v5h:hover,.menu-item.svelte-1xg9v5h:focus{background:#eee;color:#555}")}function vb(e,t,n){let r=e.slice();return r[4]=t[n][0],r[5]=t[n][1].label,r}function bb(e){let t,n=e[5]+"",r,i,s,o;function a(){return e[3](e[4])}return{c(){t=S("button"),r=Y(n),i=N(),O(t,"class","menu-item svelte-1xg9v5h"),ie(t,"active",e[0]==e[4])},m(u,c){M(u,t,c),_(t,r),_(t,i),s||(o=Q(t,"click",a),s=!0)},p(u,c){e=u,c&2&&n!==(n=e[5]+"")&&ae(r,n),c&3&&ie(t,"active",e[0]==e[4])},d(u){u&&x(t),s=!1,o()}}}function $N(e){let t,n=Object.entries(e[1]),r=[];for(let i=0;i<n.length;i+=1)r[i]=bb(vb(e,n,i));return{c(){t=S("nav");for(let i=0;i<r.length;i+=1)r[i].c();O(t,"class","menu svelte-1xg9v5h")},m(i,s){M(i,t,s);for(let o=0;o<r.length;o+=1)r[o].m(t,null)},p(i,[s]){if(s&7){n=Object.entries(i[1]);let o;for(o=0;o<n.length;o+=1){let a=vb(i,n,o);r[o]?r[o].p(a,s):(r[o]=bb(a),r[o].c(),r[o].m(t,null))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},i:U,o:U,d(i){i&&x(t),Xe(r,i)}}}function XN(e,t,n){let{pane:r}=t,{panes:i}=t,s=Yi(),o=a=>s("change",a);return e.$$set=a=>{"pane"in a&&n(0,r=a.pane),"panes"in a&&n(1,i=a.panes)},[r,i,s,o]}var sc=class extends Z{constructor(t){super(),te(this,t,XN,$N,ee,{pane:0,panes:1},YN)}},nr={};function QN(e){de(e,"svelte-1vyml86",".container.svelte-1vyml86{display:inline-block;cursor:pointer;transform:translate(calc(0px - var(--li-identation)), -50%);position:absolute;top:50%;padding-right:100%}.arrow.svelte-1vyml86{transform-origin:25% 50%;position:relative;line-height:1.1em;font-size:0.75em;margin-left:0;transition:150ms;color:var(--arrow-sign);user-select:none;font-family:'Courier New', Courier, monospace}.expanded.svelte-1vyml86{transform:rotateZ(90deg) translateX(-3px)}")}function ZN(e){let t,n,r,i;return{c(){t=S("div"),n=S("div"),n.textContent="\u25B6",O(n,"class","arrow svelte-1vyml86"),ie(n,"expanded",e[0]),O(t,"class","container svelte-1vyml86")},m(s,o){M(s,t,o),_(t,n),r||(i=Q(t,"click",e[1]),r=!0)},p(s,[o]){o&1&&ie(n,"expanded",s[0])},i:U,o:U,d(s){s&&x(t),r=!1,i()}}}function e2(e,t,n){let{expanded:r}=t;function i(s){kw.call(this,e,s)}return e.$$set=s=>{"expanded"in s&&n(0,r=s.expanded)},[r,i]}var _o=class extends Z{constructor(t){super(),te(this,t,e2,ZN,ee,{expanded:0},QN)}};function t2(e){de(e,"svelte-1vlbacg","label.svelte-1vlbacg{display:inline-block;color:var(--label-color);padding:0}.spaced.svelte-1vlbacg{padding-right:var(--li-colon-space)}")}function wb(e){let t,n,r,i,s,o;return{c(){t=S("label"),n=S("span"),r=Y(e[0]),i=Y(e[2]),O(t,"class","svelte-1vlbacg"),ie(t,"spaced",e[1])},m(a,u){M(a,t,u),_(t,n),_(n,r),_(n,i),s||(o=Q(t,"click",e[5]),s=!0)},p(a,u){u&1&&ae(r,a[0]),u&4&&ae(i,a[2]),u&2&&ie(t,"spaced",a[1])},d(a){a&&x(t),s=!1,o()}}}function n2(e){let t,n=e[3]&&e[0]&&wb(e);return{c(){n&&n.c(),t=ut()},m(r,i){n&&n.m(r,i),M(r,t,i)},p(r,[i]){r[3]&&r[0]?n?n.p(r,i):(n=wb(r),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:U,o:U,d(r){n&&n.d(r),r&&x(t)}}}function r2(e,t,n){let r,{key:i,isParentExpanded:s,isParentArray:o=!1,colon:a=":"}=t;function u(c){kw.call(this,e,c)}return e.$$set=c=>{"key"in c&&n(0,i=c.key),"isParentExpanded"in c&&n(1,s=c.isParentExpanded),"isParentArray"in c&&n(4,o=c.isParentArray),"colon"in c&&n(2,a=c.colon)},e.$$.update=()=>{e.$$.dirty&19&&n(3,r=s||!o||i!=+i)},[i,s,a,r,o,u]}var rr=class extends Z{constructor(t){super(),te(this,t,r2,n2,ee,{key:0,isParentExpanded:1,isParentArray:4,colon:2},t2)}};function i2(e){de(e,"svelte-rwxv37","label.svelte-rwxv37{display:inline-block}.indent.svelte-rwxv37{padding-left:var(--li-identation)}.collapse.svelte-rwxv37{--li-display:inline;display:inline;font-style:italic}.comma.svelte-rwxv37{margin-left:-0.5em;margin-right:0.5em}label.svelte-rwxv37{position:relative}")}function _b(e,t,n){let r=e.slice();return r[12]=t[n],r[20]=n,r}function kb(e){let t,n;return t=new _o({props:{expanded:e[0]}}),t.$on("click",e[15]),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,i){let s={};i&1&&(s.expanded=r[0]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function s2(e){let t;return{c(){t=S("span"),t.textContent="\u2026"},m(n,r){M(n,t,r)},p:U,i:U,o:U,d(n){n&&x(t)}}}function o2(e){let t,n,r,i,s,o=e[13],a=[];for(let l=0;l<o.length;l+=1)a[l]=Eb(_b(e,o,l));let u=l=>A(a[l],1,1,()=>{a[l]=null}),c=e[13].length<e[7].length&&Ob();return{c(){t=S("ul");for(let l=0;l<a.length;l+=1)a[l].c();n=N(),c&&c.c(),O(t,"class","svelte-rwxv37"),ie(t,"collapse",!e[0])},m(l,f){M(l,t,f);for(let p=0;p<a.length;p+=1)a[p].m(t,null);_(t,n),c&&c.m(t,null),r=!0,i||(s=Q(t,"click",e[16]),i=!0)},p(l,f){if(f&10129){o=l[13];let p;for(p=0;p<o.length;p+=1){let d=_b(l,o,p);a[p]?(a[p].p(d,f),P(a[p],1)):(a[p]=Eb(d),a[p].c(),P(a[p],1),a[p].m(t,n))}for(ce(),p=o.length;p<a.length;p+=1)u(p);le()}l[13].length<l[7].length?c||(c=Ob(),c.c(),c.m(t,null)):c&&(c.d(1),c=null),f&1&&ie(t,"collapse",!l[0])},i(l){if(!r){for(let f=0;f<o.length;f+=1)P(a[f]);r=!0}},o(l){a=a.filter(Boolean);for(let f=0;f<a.length;f+=1)A(a[f]);r=!1},d(l){l&&x(t),Xe(a,l),c&&c.d(),i=!1,s()}}}function Pb(e){let t;return{c(){t=S("span"),t.textContent=",",O(t,"class","comma svelte-rwxv37")},m(n,r){M(n,t,r)},d(n){n&&x(t)}}}function Eb(e){let t,n,r,i;t=new Vi({props:{key:e[8](e[12]),isParentExpanded:e[0],isParentArray:e[4],value:e[0]?e[9](e[12]):e[10](e[12])}});let s=!e[0]&&e[20]<e[7].length-1&&Pb();return{c(){G(t.$$.fragment),n=N(),s&&s.c(),r=ut()},m(o,a){D(t,o,a),M(o,n,a),s&&s.m(o,a),M(o,r,a),i=!0},p(o,a){let u={};a&8448&&(u.key=o[8](o[12])),a&1&&(u.isParentExpanded=o[0]),a&16&&(u.isParentArray=o[4]),a&9729&&(u.value=o[0]?o[9](o[12]):o[10](o[12])),t.$set(u),!o[0]&&o[20]<o[7].length-1?s||(s=Pb(),s.c(),s.m(r.parentNode,r)):s&&(s.d(1),s=null)},i(o){i||(P(t.$$.fragment,o),i=!0)},o(o){A(t.$$.fragment,o),i=!1},d(o){B(t,o),o&&x(n),s&&s.d(o),o&&x(r)}}}function Ob(e){let t;return{c(){t=S("span"),t.textContent="\u2026"},m(n,r){M(n,t,r)},d(n){n&&x(t)}}}function a2(e){let t,n,r,i,s,o,a,u,c,l,f,p,d,h,y,m,b,g,k=e[11]&&e[2]&&kb(e);i=new rr({props:{key:e[12],colon:e[14].colon,isParentExpanded:e[2],isParentArray:e[3]}}),i.$on("click",e[15]);let I=[o2,s2],j=[];function C(q,J){return q[2]?0:1}return f=C(e),p=j[f]=I[f](e),{c(){t=S("li"),n=S("label"),k&&k.c(),r=N(),G(i.$$.fragment),s=N(),o=S("span"),a=S("span"),u=Y(e[1]),c=Y(e[5]),l=N(),p.c(),d=N(),h=S("span"),y=Y(e[6]),O(n,"class","svelte-rwxv37"),O(t,"class","svelte-rwxv37"),ie(t,"indent",e[2])},m(q,J){M(q,t,J),_(t,n),k&&k.m(n,null),_(n,r),D(i,n,null),_(n,s),_(n,o),_(o,a),_(a,u),_(o,c),_(t,l),j[f].m(t,null),_(t,d),_(t,h),_(h,y),m=!0,b||(g=Q(o,"click",e[15]),b=!0)},p(q,[J]){q[11]&&q[2]?k?(k.p(q,J),J&2052&&P(k,1)):(k=kb(q),k.c(),P(k,1),k.m(n,r)):k&&(ce(),A(k,1,1,()=>{k=null}),le());let fe={};J&4096&&(fe.key=q[12]),J&4&&(fe.isParentExpanded=q[2]),J&8&&(fe.isParentArray=q[3]),i.$set(fe),(!m||J&2)&&ae(u,q[1]),(!m||J&32)&&ae(c,q[5]);let V=f;f=C(q),f===V?j[f].p(q,J):(ce(),A(j[V],1,1,()=>{j[V]=null}),le(),p=j[f],p?p.p(q,J):(p=j[f]=I[f](q),p.c()),P(p,1),p.m(t,d)),(!m||J&64)&&ae(y,q[6]),J&4&&ie(t,"indent",q[2])},i(q){m||(P(k),P(i.$$.fragment,q),P(p),m=!0)},o(q){A(k),A(i.$$.fragment,q),A(p),m=!1},d(q){q&&x(t),k&&k.d(),B(i),j[f].d(),b=!1,g()}}}function u2(e,t,n){let r,{key:i,keys:s,colon:o=":",label:a="",isParentExpanded:u,isParentArray:c,isArray:l=!1,bracketOpen:f,bracketClose:p}=t,{previewKeys:d=s}=t,{getKey:h=C=>C}=t,{getValue:y=C=>C}=t,{getPreviewValue:m=y}=t,{expanded:b=!1,expandable:g=!0}=t,k=kn(nr);Ui(nr,{...k,colon:o});function I(){n(0,b=!b)}function j(){n(0,b=!0)}return e.$$set=C=>{"key"in C&&n(12,i=C.key),"keys"in C&&n(17,s=C.keys),"colon"in C&&n(18,o=C.colon),"label"in C&&n(1,a=C.label),"isParentExpanded"in C&&n(2,u=C.isParentExpanded),"isParentArray"in C&&n(3,c=C.isParentArray),"isArray"in C&&n(4,l=C.isArray),"bracketOpen"in C&&n(5,f=C.bracketOpen),"bracketClose"in C&&n(6,p=C.bracketClose),"previewKeys"in C&&n(7,d=C.previewKeys),"getKey"in C&&n(8,h=C.getKey),"getValue"in C&&n(9,y=C.getValue),"getPreviewValue"in C&&n(10,m=C.getPreviewValue),"expanded"in C&&n(0,b=C.expanded),"expandable"in C&&n(11,g=C.expandable)},e.$$.update=()=>{e.$$.dirty&4&&(u||n(0,b=!1)),e.$$.dirty&131201&&n(13,r=b?s:d.slice(0,5))},[b,a,u,c,l,f,p,d,h,y,m,g,i,r,k,I,j,s,o]}var _n=class extends Z{constructor(t){super(),te(this,t,u2,a2,ee,{key:12,keys:17,colon:18,label:1,isParentExpanded:2,isParentArray:3,isArray:4,bracketOpen:5,bracketClose:6,previewKeys:7,getKey:8,getValue:9,getPreviewValue:10,expanded:0,expandable:11},i2)}};function c2(e){let t,n;return t=new _n({props:{key:e[0],expanded:e[4],isParentExpanded:e[1],isParentArray:e[2],keys:e[5],previewKeys:e[5],getValue:e[6],label:e[3]+" ",bracketOpen:"{",bracketClose:"}"}}),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,[i]){let s={};i&1&&(s.key=r[0]),i&16&&(s.expanded=r[4]),i&2&&(s.isParentExpanded=r[1]),i&4&&(s.isParentArray=r[2]),i&32&&(s.keys=r[5]),i&32&&(s.previewKeys=r[5]),i&8&&(s.label=r[3]+" "),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function l2(e,t,n){let r,{key:i,value:s,isParentExpanded:o,isParentArray:a,nodeType:u}=t,{expanded:c=!0}=t;function l(f){return s[f]}return e.$$set=f=>{"key"in f&&n(0,i=f.key),"value"in f&&n(7,s=f.value),"isParentExpanded"in f&&n(1,o=f.isParentExpanded),"isParentArray"in f&&n(2,a=f.isParentArray),"nodeType"in f&&n(3,u=f.nodeType),"expanded"in f&&n(4,c=f.expanded)},e.$$.update=()=>{e.$$.dirty&128&&n(5,r=Object.getOwnPropertyNames(s))},[i,o,a,u,c,r,l,s]}var oc=class extends Z{constructor(t){super(),te(this,t,l2,c2,ee,{key:0,value:7,isParentExpanded:1,isParentArray:2,nodeType:3,expanded:4})}};function f2(e){let t,n;return t=new _n({props:{key:e[0],expanded:e[4],isParentExpanded:e[2],isParentArray:e[3],isArray:!0,keys:e[5],previewKeys:e[6],getValue:e[7],label:"Array("+e[1].length+")",bracketOpen:"[",bracketClose:"]"}}),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,[i]){let s={};i&1&&(s.key=r[0]),i&16&&(s.expanded=r[4]),i&4&&(s.isParentExpanded=r[2]),i&8&&(s.isParentArray=r[3]),i&32&&(s.keys=r[5]),i&64&&(s.previewKeys=r[6]),i&2&&(s.label="Array("+r[1].length+")"),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function p2(e,t,n){let r,i,{key:s,value:o,isParentExpanded:a,isParentArray:u}=t,{expanded:c=JSON.stringify(o).length<1024}=t,l=new Set(["length"]);function f(p){return o[p]}return e.$$set=p=>{"key"in p&&n(0,s=p.key),"value"in p&&n(1,o=p.value),"isParentExpanded"in p&&n(2,a=p.isParentExpanded),"isParentArray"in p&&n(3,u=p.isParentArray),"expanded"in p&&n(4,c=p.expanded)},e.$$.update=()=>{e.$$.dirty&2&&n(5,r=Object.getOwnPropertyNames(o)),e.$$.dirty&32&&n(6,i=r.filter(p=>!l.has(p)))},[s,o,a,u,c,r,i,f]}var ac=class extends Z{constructor(t){super(),te(this,t,p2,f2,ee,{key:0,value:1,isParentExpanded:2,isParentArray:3,expanded:4})}};function d2(e){let t,n;return t=new _n({props:{key:e[0],isParentExpanded:e[1],isParentArray:e[2],keys:e[4],getKey:h2,getValue:m2,isArray:!0,label:e[3]+"("+e[4].length+")",bracketOpen:"{",bracketClose:"}"}}),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,[i]){let s={};i&1&&(s.key=r[0]),i&2&&(s.isParentExpanded=r[1]),i&4&&(s.isParentArray=r[2]),i&16&&(s.keys=r[4]),i&24&&(s.label=r[3]+"("+r[4].length+")"),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function h2(e){return String(e[0])}function m2(e){return e[1]}function g2(e,t,n){let{key:r,value:i,isParentExpanded:s,isParentArray:o,nodeType:a}=t,u=[];return e.$$set=c=>{"key"in c&&n(0,r=c.key),"value"in c&&n(5,i=c.value),"isParentExpanded"in c&&n(1,s=c.isParentExpanded),"isParentArray"in c&&n(2,o=c.isParentArray),"nodeType"in c&&n(3,a=c.nodeType)},e.$$.update=()=>{if(e.$$.dirty&32){let c=[],l=0;for(let f of i)c.push([l++,f]);n(4,u=c)}},[r,s,o,a,u,i]}var uc=class extends Z{constructor(t){super(),te(this,t,g2,d2,ee,{key:0,value:5,isParentExpanded:1,isParentArray:2,nodeType:3})}},cc=class{constructor(t,n){this.key=t,this.value=n}};function y2(e){let t,n;return t=new _n({props:{key:e[0],isParentExpanded:e[1],isParentArray:e[2],keys:e[4],getKey:v2,getValue:b2,label:e[3]+"("+e[4].length+")",colon:"",bracketOpen:"{",bracketClose:"}"}}),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,[i]){let s={};i&1&&(s.key=r[0]),i&2&&(s.isParentExpanded=r[1]),i&4&&(s.isParentArray=r[2]),i&16&&(s.keys=r[4]),i&24&&(s.label=r[3]+"("+r[4].length+")"),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function v2(e){return e[0]}function b2(e){return e[1]}function w2(e,t,n){let{key:r,value:i,isParentExpanded:s,isParentArray:o,nodeType:a}=t,u=[];return e.$$set=c=>{"key"in c&&n(0,r=c.key),"value"in c&&n(5,i=c.value),"isParentExpanded"in c&&n(1,s=c.isParentExpanded),"isParentArray"in c&&n(2,o=c.isParentArray),"nodeType"in c&&n(3,a=c.nodeType)},e.$$.update=()=>{if(e.$$.dirty&32){let c=[],l=0;for(let f of i)c.push([l++,new cc(f[0],f[1])]);n(4,u=c)}},[r,s,o,a,u,i]}var lc=class extends Z{constructor(t){super(),te(this,t,w2,y2,ee,{key:0,value:5,isParentExpanded:1,isParentArray:2,nodeType:3})}};function _2(e){let t,n;return t=new _n({props:{expanded:e[4],isParentExpanded:e[2],isParentArray:e[3],key:e[2]?String(e[0]):e[1].key,keys:e[5],getValue:e[6],label:e[2]?"Entry ":"=> ",bracketOpen:"{",bracketClose:"}"}}),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,[i]){let s={};i&16&&(s.expanded=r[4]),i&4&&(s.isParentExpanded=r[2]),i&8&&(s.isParentArray=r[3]),i&7&&(s.key=r[2]?String(r[0]):r[1].key),i&4&&(s.label=r[2]?"Entry ":"=> "),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function k2(e,t,n){let{key:r,value:i,isParentExpanded:s,isParentArray:o}=t,{expanded:a=!1}=t,u=["key","value"];function c(l){return i[l]}return e.$$set=l=>{"key"in l&&n(0,r=l.key),"value"in l&&n(1,i=l.value),"isParentExpanded"in l&&n(2,s=l.isParentExpanded),"isParentArray"in l&&n(3,o=l.isParentArray),"expanded"in l&&n(4,a=l.expanded)},[r,i,s,o,a,u,c]}var fc=class extends Z{constructor(t){super(),te(this,t,k2,_2,ee,{key:0,value:1,isParentExpanded:2,isParentArray:3,expanded:4})}};function P2(e){de(e,"svelte-3bjyvl","li.svelte-3bjyvl{user-select:text;word-wrap:break-word;word-break:break-all}.indent.svelte-3bjyvl{padding-left:var(--li-identation)}.String.svelte-3bjyvl{color:var(--string-color)}.Date.svelte-3bjyvl{color:var(--date-color)}.Number.svelte-3bjyvl{color:var(--number-color)}.Boolean.svelte-3bjyvl{color:var(--boolean-color)}.Null.svelte-3bjyvl{color:var(--null-color)}.Undefined.svelte-3bjyvl{color:var(--undefined-color)}.Function.svelte-3bjyvl{color:var(--function-color);font-style:italic}.Symbol.svelte-3bjyvl{color:var(--symbol-color)}")}function E2(e){let t,n,r,i,s=(e[2]?e[2](e[1]):e[1])+"",o,a,u;return n=new rr({props:{key:e[0],colon:e[6],isParentExpanded:e[3],isParentArray:e[4]}}),{c(){t=S("li"),G(n.$$.fragment),r=N(),i=S("span"),o=Y(s),O(i,"class",a=fb(e[5])+" svelte-3bjyvl"),O(t,"class","svelte-3bjyvl"),ie(t,"indent",e[3])},m(c,l){M(c,t,l),D(n,t,null),_(t,r),_(t,i),_(i,o),u=!0},p(c,[l]){let f={};l&1&&(f.key=c[0]),l&8&&(f.isParentExpanded=c[3]),l&16&&(f.isParentArray=c[4]),n.$set(f),(!u||l&6)&&s!==(s=(c[2]?c[2](c[1]):c[1])+"")&&ae(o,s),(!u||l&32&&a!==(a=fb(c[5])+" svelte-3bjyvl"))&&O(i,"class",a),l&8&&ie(t,"indent",c[3])},i(c){u||(P(n.$$.fragment,c),u=!0)},o(c){A(n.$$.fragment,c),u=!1},d(c){c&&x(t),B(n)}}}function O2(e,t,n){let{key:r,value:i,valueGetter:s=null,isParentExpanded:o,isParentArray:a,nodeType:u}=t,{colon:c}=kn(nr);return e.$$set=l=>{"key"in l&&n(0,r=l.key),"value"in l&&n(1,i=l.value),"valueGetter"in l&&n(2,s=l.valueGetter),"isParentExpanded"in l&&n(3,o=l.isParentExpanded),"isParentArray"in l&&n(4,a=l.isParentArray),"nodeType"in l&&n(5,u=l.nodeType)},[r,i,s,o,a,u,c]}var pc=class extends Z{constructor(t){super(),te(this,t,O2,E2,ee,{key:0,value:1,valueGetter:2,isParentExpanded:3,isParentArray:4,nodeType:5},P2)}};function S2(e){de(e,"svelte-1ca3gb2","li.svelte-1ca3gb2{user-select:text;word-wrap:break-word;word-break:break-all}.indent.svelte-1ca3gb2{padding-left:var(--li-identation)}.collapse.svelte-1ca3gb2{--li-display:inline;display:inline;font-style:italic}")}function Sb(e,t,n){let r=e.slice();return r[8]=t[n],r[10]=n,r}function Ab(e){let t,n;return t=new _o({props:{expanded:e[0]}}),t.$on("click",e[7]),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,i){let s={};i&1&&(s.expanded=r[0]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function xb(e){let t,n,r=e[0]&&Tb(e);return{c(){t=S("ul"),r&&r.c(),O(t,"class","svelte-1ca3gb2"),ie(t,"collapse",!e[0])},m(i,s){M(i,t,s),r&&r.m(t,null),n=!0},p(i,s){i[0]?r?(r.p(i,s),s&1&&P(r,1)):(r=Tb(i),r.c(),P(r,1),r.m(t,null)):r&&(ce(),A(r,1,1,()=>{r=null}),le()),s&1&&ie(t,"collapse",!i[0])},i(i){n||(P(r),n=!0)},o(i){A(r),n=!1},d(i){i&&x(t),r&&r.d()}}}function Tb(e){let t,n,r,i,s,o,a;t=new Vi({props:{key:"message",value:e[2].message}}),i=new rr({props:{key:"stack",colon:":",isParentExpanded:e[3]}});let u=e[5],c=[];for(let l=0;l<u.length;l+=1)c[l]=Mb(Sb(e,u,l));return{c(){G(t.$$.fragment),n=N(),r=S("li"),G(i.$$.fragment),s=N(),o=S("span");for(let l=0;l<c.length;l+=1)c[l].c();O(r,"class","svelte-1ca3gb2")},m(l,f){D(t,l,f),M(l,n,f),M(l,r,f),D(i,r,null),_(r,s),_(r,o);for(let p=0;p<c.length;p+=1)c[p].m(o,null);a=!0},p(l,f){let p={};f&4&&(p.value=l[2].message),t.$set(p);let d={};if(f&8&&(d.isParentExpanded=l[3]),i.$set(d),f&32){u=l[5];let h;for(h=0;h<u.length;h+=1){let y=Sb(l,u,h);c[h]?c[h].p(y,f):(c[h]=Mb(y),c[h].c(),c[h].m(o,null))}for(;h<c.length;h+=1)c[h].d(1);c.length=u.length}},i(l){a||(P(t.$$.fragment,l),P(i.$$.fragment,l),a=!0)},o(l){A(t.$$.fragment,l),A(i.$$.fragment,l),a=!1},d(l){B(t,l),l&&x(n),l&&x(r),B(i),Xe(c,l)}}}function Mb(e){let t,n=e[8]+"",r,i;return{c(){t=S("span"),r=Y(n),i=S("br"),O(t,"class","svelte-1ca3gb2"),ie(t,"indent",e[10]>0)},m(s,o){M(s,t,o),_(t,r),M(s,i,o)},p(s,o){o&32&&n!==(n=s[8]+"")&&ae(r,n)},d(s){s&&x(t),s&&x(i)}}}function A2(e){let t,n,r,i,s,o,a=(e[0]?"":e[2].message)+"",u,c,l,f,p,d=e[3]&&Ab(e);r=new rr({props:{key:e[1],colon:e[6].colon,isParentExpanded:e[3],isParentArray:e[4]}});let h=e[3]&&xb(e);return{c(){t=S("li"),d&&d.c(),n=N(),G(r.$$.fragment),i=N(),s=S("span"),o=Y("Error: "),u=Y(a),c=N(),h&&h.c(),O(t,"class","svelte-1ca3gb2"),ie(t,"indent",e[3])},m(y,m){M(y,t,m),d&&d.m(t,null),_(t,n),D(r,t,null),_(t,i),_(t,s),_(s,o),_(s,u),_(t,c),h&&h.m(t,null),l=!0,f||(p=Q(s,"click",e[7]),f=!0)},p(y,[m]){y[3]?d?(d.p(y,m),m&8&&P(d,1)):(d=Ab(y),d.c(),P(d,1),d.m(t,n)):d&&(ce(),A(d,1,1,()=>{d=null}),le());let b={};m&2&&(b.key=y[1]),m&8&&(b.isParentExpanded=y[3]),m&16&&(b.isParentArray=y[4]),r.$set(b),(!l||m&5)&&a!==(a=(y[0]?"":y[2].message)+"")&&ae(u,a),y[3]?h?(h.p(y,m),m&8&&P(h,1)):(h=xb(y),h.c(),P(h,1),h.m(t,null)):h&&(ce(),A(h,1,1,()=>{h=null}),le()),m&8&&ie(t,"indent",y[3])},i(y){l||(P(d),P(r.$$.fragment,y),P(h),l=!0)},o(y){A(d),A(r.$$.fragment,y),A(h),l=!1},d(y){y&&x(t),d&&d.d(),B(r),h&&h.d(),f=!1,p()}}}function x2(e,t,n){let r,{key:i,value:s,isParentExpanded:o,isParentArray:a}=t,{expanded:u=!1}=t,c=kn(nr);Ui(nr,{...c,colon:":"});function l(){n(0,u=!u)}return e.$$set=f=>{"key"in f&&n(1,i=f.key),"value"in f&&n(2,s=f.value),"isParentExpanded"in f&&n(3,o=f.isParentExpanded),"isParentArray"in f&&n(4,a=f.isParentArray),"expanded"in f&&n(0,u=f.expanded)},e.$$.update=()=>{e.$$.dirty&4&&n(5,r=s.stack.split(`
|
|
20
|
+
`)),e.$$.dirty&8&&(o||n(0,u=!1))},[u,i,s,o,a,r,c,l]}var dc=class extends Z{constructor(t){super(),te(this,t,x2,A2,ee,{key:1,value:2,isParentExpanded:3,isParentArray:4,expanded:0},S2)}};function T2(e){let t=Object.prototype.toString.call(e).slice(8,-1);return t==="Object"?typeof e[Symbol.iterator]=="function"?"Iterable":e.constructor.name:t}function M2(e){let t,n,r;var i=e[6];function s(o){return{props:{key:o[0],value:o[1],isParentExpanded:o[2],isParentArray:o[3],nodeType:o[4],valueGetter:o[5]}}}return i&&(t=new i(s(e))),{c(){t&&G(t.$$.fragment),n=ut()},m(o,a){t&&D(t,o,a),M(o,n,a),r=!0},p(o,[a]){let u={};if(a&1&&(u.key=o[0]),a&2&&(u.value=o[1]),a&4&&(u.isParentExpanded=o[2]),a&8&&(u.isParentArray=o[3]),a&16&&(u.nodeType=o[4]),a&32&&(u.valueGetter=o[5]),i!==(i=o[6])){if(t){ce();let c=t;A(c.$$.fragment,1,0,()=>{B(c,1)}),le()}i?(t=new i(s(o)),G(t.$$.fragment),P(t.$$.fragment,1),D(t,n.parentNode,n)):t=null}else i&&t.$set(u)},i(o){r||(t&&P(t.$$.fragment,o),r=!0)},o(o){t&&A(t.$$.fragment,o),r=!1},d(o){o&&x(n),t&&B(t,o)}}}function I2(e,t,n){let r,i,s,{key:o,value:a,isParentExpanded:u,isParentArray:c}=t;function l(p){switch(p){case"Object":return oc;case"Error":return dc;case"Array":return ac;case"Iterable":case"Map":case"Set":return typeof a.set=="function"?lc:uc;case"MapEntry":return fc;default:return pc}}function f(p){switch(p){case"Object":case"Error":case"Array":case"Iterable":case"Map":case"Set":case"MapEntry":case"Number":return;case"String":return d=>`"${d}"`;case"Boolean":return d=>d?"true":"false";case"Date":return d=>d.toISOString();case"Null":return()=>"null";case"Undefined":return()=>"undefined";case"Function":case"Symbol":return d=>d.toString();default:return()=>`<${p}>`}}return e.$$set=p=>{"key"in p&&n(0,o=p.key),"value"in p&&n(1,a=p.value),"isParentExpanded"in p&&n(2,u=p.isParentExpanded),"isParentArray"in p&&n(3,c=p.isParentArray)},e.$$.update=()=>{e.$$.dirty&2&&n(4,r=T2(a)),e.$$.dirty&16&&n(6,i=l(r)),e.$$.dirty&16&&n(5,s=f(r))},[o,a,u,c,r,s,i]}var Vi=class extends Z{constructor(t){super(),te(this,t,I2,M2,ee,{key:0,value:1,isParentExpanded:2,isParentArray:3})}};function C2(e){de(e,"svelte-773n60","ul.svelte-773n60{--string-color:var(--json-tree-string-color, #cb3f41);--symbol-color:var(--json-tree-symbol-color, #cb3f41);--boolean-color:var(--json-tree-boolean-color, #112aa7);--function-color:var(--json-tree-function-color, #112aa7);--number-color:var(--json-tree-number-color, #3029cf);--label-color:var(--json-tree-label-color, #871d8f);--arrow-color:var(--json-tree-arrow-color, #727272);--null-color:var(--json-tree-null-color, #8d8d8d);--undefined-color:var(--json-tree-undefined-color, #8d8d8d);--date-color:var(--json-tree-date-color, #8d8d8d);--li-identation:var(--json-tree-li-indentation, 1em);--li-line-height:var(--json-tree-li-line-height, 1.3);--li-colon-space:0.3em;font-size:var(--json-tree-font-size, 12px);font-family:var(--json-tree-font-family, 'Courier New', Courier, monospace)}ul.svelte-773n60 li{line-height:var(--li-line-height);display:var(--li-display, list-item);list-style:none}ul.svelte-773n60,ul.svelte-773n60 ul{padding:0;margin:0}")}function R2(e){let t,n,r;return n=new Vi({props:{key:e[0],value:e[1],isParentExpanded:!0,isParentArray:!1}}),{c(){t=S("ul"),G(n.$$.fragment),O(t,"class","svelte-773n60")},m(i,s){M(i,t,s),D(n,t,null),r=!0},p(i,[s]){let o={};s&1&&(o.key=i[0]),s&2&&(o.value=i[1]),n.$set(o)},i(i){r||(P(n.$$.fragment,i),r=!0)},o(i){A(n.$$.fragment,i),r=!1},d(i){i&&x(t),B(n)}}}function N2(e,t,n){Ui(nr,{});let{key:r="",value:i}=t;return e.$$set=s=>{"key"in s&&n(0,r=s.key),"value"in s&&n(1,i=s.value)},[r,i]}var ko=class extends Z{constructor(t){super(),te(this,t,N2,R2,ee,{key:0,value:1},C2)}};function j2(e){de(e,"svelte-jvfq3i",".svelte-jvfq3i{box-sizing:border-box}section.switcher.svelte-jvfq3i{position:sticky;bottom:0;transform:translateY(20px);margin:40px -20px 0;border-top:1px solid #999;padding:20px;background:#fff}label.svelte-jvfq3i{display:flex;align-items:baseline;gap:5px;font-weight:bold}select.svelte-jvfq3i{min-width:140px}")}function Ib(e,t,n){let r=e.slice();return r[7]=t[n],r[9]=n,r}function Cb(e){let t,n,r,i,s,o,a=e[1],u=[];for(let c=0;c<a.length;c+=1)u[c]=Rb(Ib(e,a,c));return{c(){t=S("section"),n=S("label"),r=Y(`Client
|
|
21
21
|
|
|
22
|
-
`),i=
|
|
22
|
+
`),i=S("select");for(let c=0;c<u.length;c+=1)u[c].c();O(i,"id",xw),O(i,"class","svelte-jvfq3i"),e[2]===void 0&&at(()=>e[6].call(i)),O(n,"class","svelte-jvfq3i"),O(t,"class","switcher svelte-jvfq3i")},m(c,l){M(c,t,l),_(t,n),_(n,r),_(n,i);for(let f=0;f<u.length;f+=1)u[f].m(i,null);po(i,e[2]),s||(o=[Q(i,"change",e[3]),Q(i,"change",e[6])],s=!0)},p(c,l){if(l&2){a=c[1];let f;for(f=0;f<a.length;f+=1){let p=Ib(c,a,f);u[f]?u[f].p(p,l):(u[f]=Rb(p),u[f].c(),u[f].m(i,null))}for(;f<u.length;f+=1)u[f].d(1);u.length=a.length}l&4&&po(i,c[2])},d(c){c&&x(t),Xe(u,c),s=!1,Ge(o)}}}function Rb(e){let t,n,r,i=JSON.stringify(e[7].playerID)+"",s,o,a=JSON.stringify(e[7].matchID)+"",u,c,l=e[7].game.name+"",f,p;return{c(){t=S("option"),n=Y(e[9]),r=Y(` \u2014
|
|
23
23
|
playerID: `),s=Y(i),o=Y(`,
|
|
24
24
|
matchID: `),u=Y(a),c=Y(`
|
|
25
25
|
(`),f=Y(l),p=Y(`)
|
|
26
|
-
`),t.__value=e[9],t.value=t.__value,k(t,"class","svelte-jvfq3i")},m(h,d){M(h,t,d),w(t,n),w(t,r),w(t,s),w(t,o),w(t,u),w(t,c),w(t,f),w(t,p)},p(h,d){d&2&&i!==(i=JSON.stringify(h[7].playerID)+"")&&ae(s,i),d&2&&a!==(a=JSON.stringify(h[7].matchID)+"")&&ae(u,a),d&2&&l!==(l=h[7].game.name+"")&&ae(f,l)},d(h){h&&S(t)}}}function Fq(e){let t,n=e[1].length>1&&Cb(e);return{c(){n&&n.c(),t=at()},m(r,i){n&&n.m(r,i),M(r,t,i)},p(r,[i]){r[1].length>1?n?n.p(r,i):(n=Cb(r),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:U,o:U,d(r){n&&n.d(r),r&&S(t)}}}var T1="bgio-debug-select-client";function Uq(e,t,n){let r,i,s,o,a=U,u=()=>(a(),a=Hi(c,p=>n(5,o=p)),c);e.$$.on_destroy.push(()=>a());let{clientManager:c}=t;u();let l=p=>{let h=i[p.target.value];c.switchToClient(h);let d=document.getElementById(T1);d&&d.focus()};function f(){s=w1(this),n(2,s),n(1,i),n(4,r),n(5,o)}return e.$$set=p=>{"clientManager"in p&&u(n(0,c=p.clientManager))},e.$$.update=()=>{e.$$.dirty&32&&n(4,{client:r,debuggableClients:i}=o,r,(n(1,i),n(5,o))),e.$$.dirty&18&&n(2,s=i.indexOf(r))},[c,i,s,l,r,o,f]}var dc=class extends Z{constructor(t){super(),te(this,t,Uq,Fq,ee,{clientManager:0},Gq)}};function Vq(e){de(e,"svelte-1vfj1mn",".key.svelte-1vfj1mn.svelte-1vfj1mn{display:flex;flex-direction:row;align-items:center}button.svelte-1vfj1mn.svelte-1vfj1mn{cursor:pointer;min-width:10px;padding-left:5px;padding-right:5px;height:20px;line-height:20px;text-align:center;border:1px solid #ccc;box-shadow:1px 1px 1px #888;background:#eee;color:#444}button.svelte-1vfj1mn.svelte-1vfj1mn:hover{background:#ddd}.key.active.svelte-1vfj1mn button.svelte-1vfj1mn{background:#ddd;border:1px solid #999;box-shadow:none}label.svelte-1vfj1mn.svelte-1vfj1mn{margin-left:10px}")}function jb(e){let t,n,r,i,s=`(shortcut: ${e[0]})`,o;return{c(){t=A("label"),n=Y(e[1]),r=q(),i=A("span"),o=Y(s),k(i,"class","screen-reader-only"),k(t,"for",e[5]),k(t,"class","svelte-1vfj1mn")},m(a,u){M(a,t,u),w(t,n),w(t,r),w(t,i),w(i,o)},p(a,u){u&2&&ae(n,a[1]),u&1&&s!==(s=`(shortcut: ${a[0]})`)&&ae(o,s)},d(a){a&&S(t)}}}function zq(e){let t,n,r,i,s,o,a=e[1]&&jb(e);return{c(){t=A("div"),n=A("button"),r=Y(e[0]),i=q(),a&&a.c(),k(n,"id",e[5]),n.disabled=e[2],k(n,"class","svelte-1vfj1mn"),k(t,"class","key svelte-1vfj1mn"),ie(t,"active",e[3])},m(u,c){M(u,t,c),w(t,n),w(n,r),w(t,i),a&&a.m(t,null),s||(o=[Q(window,"keydown",e[7]),Q(n,"click",e[6])],s=!0)},p(u,[c]){c&1&&ae(r,u[0]),c&4&&(n.disabled=u[2]),u[1]?a?a.p(u,c):(a=jb(u),a.c(),a.m(t,null)):a&&(a.d(1),a=null),c&8&&ie(t,"active",u[3])},i:U,o:U,d(u){u&&S(t),a&&a.d(),s=!1,Le(o)}}}function Kq(e,t,n){let r,{value:i}=t,{onPress:s=null}=t,{label:o=null}=t,{disable:a=!1}=t,{disableHotkeys:u}=wn("hotkeys");g1(e,u,d=>n(9,r=d));let c=!1,l=`key-${i}`;function f(){n(3,c=!1)}function p(){n(3,c=!0),setTimeout(f,200),s&&setTimeout(s,1)}function h(d){!r&&!a&&!d.ctrlKey&&!d.metaKey&&d.key==i&&(d.preventDefault(),p())}return e.$$set=d=>{"value"in d&&n(0,i=d.value),"onPress"in d&&n(8,s=d.onPress),"label"in d&&n(1,o=d.label),"disable"in d&&n(2,a=d.disable)},[i,o,a,c,u,l,p,h,s]}var vt=class extends Z{constructor(t){super(),te(this,t,Kq,zq,ee,{value:0,onPress:8,label:1,disable:2},Vq)}};function Hq(e){de(e,"svelte-1mppqmp",".move.svelte-1mppqmp{display:flex;flex-direction:row;cursor:pointer;margin-left:10px;color:#666}.move.svelte-1mppqmp:hover{color:#333}.move.active.svelte-1mppqmp{color:#111;font-weight:bold}.arg-field.svelte-1mppqmp{outline:none;font-family:monospace}")}function Wq(e){let t,n,r,i,s,o,a,u,c,l,f;return{c(){t=A("div"),n=A("span"),r=Y(e[2]),i=q(),s=A("span"),s.textContent="(",o=q(),a=A("span"),u=q(),c=A("span"),c.textContent=")",k(a,"class","arg-field svelte-1mppqmp"),k(a,"contenteditable",""),k(t,"class","move svelte-1mppqmp"),ie(t,"active",e[3])},m(p,h){M(p,t,h),w(t,n),w(n,r),w(t,i),w(t,s),w(t,o),w(t,a),e[6](a),w(t,u),w(t,c),l||(f=[Q(a,"focus",function(){Yt(e[0])&&e[0].apply(this,arguments)}),Q(a,"blur",function(){Yt(e[1])&&e[1].apply(this,arguments)}),Q(a,"keypress",jC(Jq)),Q(a,"keydown",e[5]),Q(t,"click",function(){Yt(e[0])&&e[0].apply(this,arguments)})],l=!0)},p(p,[h]){e=p,h&4&&ae(r,e[2]),h&8&&ie(t,"active",e[3])},i:U,o:U,d(p){p&&S(t),e[6](null),l=!1,Le(f)}}}var Jq=()=>{};function Yq(e,t,n){let{Activate:r}=t,{Deactivate:i}=t,{name:s}=t,{active:o}=t,a,u=Ji();function c(){try{let p=a.innerText,h=new Function(`return [${p}]`)();u("submit",h)}catch(p){u("error",p)}n(4,a.innerText="",a)}function l(p){p.key=="Enter"&&(p.preventDefault(),c()),p.key=="Escape"&&(p.preventDefault(),i())}FC(()=>{o?a.focus():a.blur()});function f(p){yo[p?"unshift":"push"](()=>{a=p,n(4,a)})}return e.$$set=p=>{"Activate"in p&&n(0,r=p.Activate),"Deactivate"in p&&n(1,i=p.Deactivate),"name"in p&&n(2,s=p.name),"active"in p&&n(3,o=p.active)},[r,i,s,o,a,l,f]}var mc=class extends Z{constructor(t){super(),te(this,t,Yq,Wq,ee,{Activate:0,Deactivate:1,name:2,active:3},Hq)}};function $q(e){de(e,"svelte-smqssc",".move-error.svelte-smqssc{color:#a00;font-weight:bold}.wrapper.svelte-smqssc{display:flex;flex-direction:row;align-items:center}")}function Db(e){let t,n;return{c(){t=A("span"),n=Y(e[2]),k(t,"class","move-error svelte-smqssc")},m(r,i){M(r,t,i),w(t,n)},p(r,i){i&4&&ae(n,r[2])},d(r){r&&S(t)}}}function Xq(e){let t,n,r,i,s,o,a;r=new vt({props:{value:e[0],onPress:e[4]}}),s=new mc({props:{Activate:e[4],Deactivate:e[5],name:e[1],active:e[3]}}),s.$on("submit",e[6]),s.$on("error",e[7]);let u=e[2]&&Db(e);return{c(){t=A("div"),n=A("div"),L(r.$$.fragment),i=q(),L(s.$$.fragment),o=q(),u&&u.c(),k(n,"class","wrapper svelte-smqssc")},m(c,l){M(c,t,l),w(t,n),R(r,n,null),w(n,i),R(s,n,null),w(t,o),u&&u.m(t,null),a=!0},p(c,[l]){let f={};l&1&&(f.value=c[0]),r.$set(f);let p={};l&2&&(p.name=c[1]),l&8&&(p.active=c[3]),s.$set(p),c[2]?u?u.p(c,l):(u=Db(c),u.c(),u.m(t,null)):u&&(u.d(1),u=null)},i(c){a||(P(r.$$.fragment,c),P(s.$$.fragment,c),a=!0)},o(c){x(r.$$.fragment,c),x(s.$$.fragment,c),a=!1},d(c){c&&S(t),B(r),B(s),u&&u.d()}}}function Qq(e,t,n){let{shortcut:r}=t,{name:i}=t,{fn:s}=t,{disableHotkeys:o}=wn("hotkeys"),a="",u=!1;function c(){o.set(!0),n(3,u=!0)}function l(){o.set(!1),n(2,a=""),n(3,u=!1)}function f(h){n(2,a=""),l(),s.apply(this,h.detail)}function p(h){n(2,a=h.detail),Oe(h.detail)}return e.$$set=h=>{"shortcut"in h&&n(0,r=h.shortcut),"name"in h&&n(1,i=h.name),"fn"in h&&n(8,s=h.fn)},[r,i,a,u,c,l,f,p,s]}var rr=class extends Z{constructor(t){super(),te(this,t,Qq,Xq,ee,{shortcut:0,name:1,fn:8},$q)}};function Zq(e){de(e,"svelte-9hauj9","ul.svelte-9hauj9{padding-left:0}li.svelte-9hauj9{list-style:none;margin:0;margin-bottom:5px}")}function e3(e){let t,n,r,i,s,o,a,u,c,l,f,p,h;return r=new vt({props:{value:"1",onPress:e[0].reset,label:"reset"}}),o=new vt({props:{value:"2",onPress:e[2],label:"save"}}),c=new vt({props:{value:"3",onPress:e[3],label:"restore"}}),p=new vt({props:{value:".",onPress:e[1],label:"hide"}}),{c(){t=A("ul"),n=A("li"),L(r.$$.fragment),i=q(),s=A("li"),L(o.$$.fragment),a=q(),u=A("li"),L(c.$$.fragment),l=q(),f=A("li"),L(p.$$.fragment),k(n,"class","svelte-9hauj9"),k(s,"class","svelte-9hauj9"),k(u,"class","svelte-9hauj9"),k(f,"class","svelte-9hauj9"),k(t,"id","debug-controls"),k(t,"class","controls svelte-9hauj9")},m(d,y){M(d,t,y),w(t,n),R(r,n,null),w(t,i),w(t,s),R(o,s,null),w(t,a),w(t,u),R(c,u,null),w(t,l),w(t,f),R(p,f,null),h=!0},p(d,[y]){let m={};y&1&&(m.onPress=d[0].reset),r.$set(m);let b={};y&2&&(b.onPress=d[1]),p.$set(b)},i(d){h||(P(r.$$.fragment,d),P(o.$$.fragment,d),P(c.$$.fragment,d),P(p.$$.fragment,d),h=!0)},o(d){x(r.$$.fragment,d),x(o.$$.fragment,d),x(c.$$.fragment,d),x(p.$$.fragment,d),h=!1},d(d){d&&S(t),B(r),B(o),B(c),B(p)}}}function t3(e,t,n){let{client:r}=t,{ToggleVisibility:i}=t;function s(){let a=r.getState(),u=Fu({...a,_undo:[],_redo:[],deltalog:[]});window.localStorage.setItem("gamestate",u),window.localStorage.setItem("initialState",Fu(r.initialState))}function o(){let a=window.localStorage.getItem("gamestate"),u=window.localStorage.getItem("initialState");if(a!==null&&u!==null){let c=Gu(a),l=Gu(u);r.store.dispatch(xi({state:c,initialState:l}))}}return e.$$set=a=>{"client"in a&&n(0,r=a.client),"ToggleVisibility"in a&&n(1,i=a.ToggleVisibility)},[r,i,s,o]}var gc=class extends Z{constructor(t){super(),te(this,t,t3,e3,ee,{client:0,ToggleVisibility:1},Zq)}};function n3(e){de(e,"svelte-19aan9p",".player-box.svelte-19aan9p{display:flex;flex-direction:row}.player.svelte-19aan9p{cursor:pointer;text-align:center;width:30px;height:30px;line-height:30px;background:#eee;border:3px solid #fefefe;box-sizing:content-box;padding:0}.player.current.svelte-19aan9p{background:#555;color:#eee;font-weight:bold}.player.active.svelte-19aan9p{border:3px solid #ff7f50}")}function Rb(e,t,n){let r=e.slice();return r[7]=t[n],r}function Bb(e){let t,n=e[7]+"",r,i,s,o,a;function u(){return e[5](e[7])}return{c(){t=A("button"),r=Y(n),i=q(),k(t,"class","player svelte-19aan9p"),k(t,"aria-label",s=e[4](e[7])),ie(t,"current",e[7]==e[0].currentPlayer),ie(t,"active",e[7]==e[1])},m(c,l){M(c,t,l),w(t,r),w(t,i),o||(a=Q(t,"click",u),o=!0)},p(c,l){e=c,l&4&&n!==(n=e[7]+"")&&ae(r,n),l&4&&s!==(s=e[4](e[7]))&&k(t,"aria-label",s),l&5&&ie(t,"current",e[7]==e[0].currentPlayer),l&6&&ie(t,"active",e[7]==e[1])},d(c){c&&S(t),o=!1,a()}}}function r3(e){let t,n=e[2],r=[];for(let i=0;i<n.length;i+=1)r[i]=Bb(Rb(e,n,i));return{c(){t=A("div");for(let i=0;i<r.length;i+=1)r[i].c();k(t,"class","player-box svelte-19aan9p")},m(i,s){M(i,t,s);for(let o=0;o<r.length;o+=1)r[o].m(t,null)},p(i,[s]){if(s&31){n=i[2];let o;for(o=0;o<n.length;o+=1){let a=Rb(i,n,o);r[o]?r[o].p(a,s):(r[o]=Bb(a),r[o].c(),r[o].m(t,null))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},i:U,o:U,d(i){i&&S(t),$e(r,i)}}}function i3(e,t,n){let{ctx:r}=t,{playerID:i}=t,s=Ji();function o(l){l==i?s("change",{playerID:null}):s("change",{playerID:l})}function a(l){let f=[];l==r.currentPlayer&&f.push("current"),l==i&&f.push("active");let p=`Player ${l}`;return f.length&&(p+=` (${f.join(", ")})`),p}let u,c=l=>o(l);return e.$$set=l=>{"ctx"in l&&n(0,r=l.ctx),"playerID"in l&&n(1,i=l.playerID)},e.$$.update=()=>{e.$$.dirty&1&&n(2,u=r?[...Array(r.numPlayers).keys()].map(l=>l.toString()):[])},[r,i,u,o,a,c]}var yc=class extends Z{constructor(t){super(),te(this,t,i3,r3,ee,{ctx:0,playerID:1},n3)}};function s3(e,t){if(e){if(typeof e=="string")return Lb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lb(e,t)}}function Lb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o3(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=s3(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
27
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{!s&&n.return!=null&&n.return()}finally{if(o)throw a}}}}function a3(e,t){var n={},r={},i=o3(t),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;r[o]=!0}}catch(d){i.e(d)}finally{i.f()}var a=r,u=!0;for(var c in e){var l=c[0];if(a[l]){u=!1;break}a[l]=!0,n[c]=l}if(u)return n;a=r;var f=97;n={};for(var p in e){for(var h=String.fromCharCode(f);a[h];)f++,h=String.fromCharCode(f);a[h]=!0,n[p]=h}return n}function u3(e){de(e,"svelte-146sq5f",".tree.svelte-146sq5f{--json-tree-font-family:monospace;--json-tree-font-size:14px;--json-tree-null-color:#757575}.label.svelte-146sq5f{margin-bottom:0;text-transform:none}h3.svelte-146sq5f{text-transform:uppercase}ul.svelte-146sq5f{padding-left:0}li.svelte-146sq5f{list-style:none;margin:0;margin-bottom:5px}")}function Gb(e,t,n){let r=e.slice();return r[11]=t[n][0],r[12]=t[n][1],r}function Fb(e){let t,n,r,i;return n=new rr({props:{shortcut:e[8][e[11]],fn:e[12],name:e[11]}}),{c(){t=A("li"),L(n.$$.fragment),r=q(),k(t,"class","svelte-146sq5f")},m(s,o){M(s,t,o),R(n,t,null),w(t,r),i=!0},p(s,o){let a={};o&16&&(a.shortcut=s[8][s[11]]),o&16&&(a.fn=s[12]),o&16&&(a.name=s[11]),n.$set(a)},i(s){i||(P(n.$$.fragment,s),i=!0)},o(s){x(n.$$.fragment,s),i=!1},d(s){s&&S(t),B(n)}}}function Ub(e){let t,n,r;return n=new rr({props:{name:"endStage",shortcut:7,fn:e[5].endStage}}),{c(){t=A("li"),L(n.$$.fragment),k(t,"class","svelte-146sq5f")},m(i,s){M(i,t,s),R(n,t,null),r=!0},p(i,s){let o={};s&32&&(o.fn=i[5].endStage),n.$set(o)},i(i){r||(P(n.$$.fragment,i),r=!0)},o(i){x(n.$$.fragment,i),r=!1},d(i){i&&S(t),B(n)}}}function Vb(e){let t,n,r;return n=new rr({props:{name:"endTurn",shortcut:8,fn:e[5].endTurn}}),{c(){t=A("li"),L(n.$$.fragment),k(t,"class","svelte-146sq5f")},m(i,s){M(i,t,s),R(n,t,null),r=!0},p(i,s){let o={};s&32&&(o.fn=i[5].endTurn),n.$set(o)},i(i){r||(P(n.$$.fragment,i),r=!0)},o(i){x(n.$$.fragment,i),r=!1},d(i){i&&S(t),B(n)}}}function zb(e){let t,n,r;return n=new rr({props:{name:"endPhase",shortcut:9,fn:e[5].endPhase}}),{c(){t=A("li"),L(n.$$.fragment),k(t,"class","svelte-146sq5f")},m(i,s){M(i,t,s),R(n,t,null),r=!0},p(i,s){let o={};s&32&&(o.fn=i[5].endPhase),n.$set(o)},i(i){r||(P(n.$$.fragment,i),r=!0)},o(i){x(n.$$.fragment,i),r=!1},d(i){i&&S(t),B(n)}}}function c3(e){let t,n,r,i,s,o,a,u,c,l,f,p,h,d,y,m,b,g,O,I,j,N,D,J,fe,V,se,ne,G,Pe,ue,Lt,bt,kn;i=new gc({props:{client:e[0],ToggleVisibility:e[2]}}),c=new yc({props:{ctx:e[6],playerID:e[3]}}),c.$on("change",e[9]);let _t=Object.entries(e[4]),xe=[];for(let C=0;C<_t.length;C+=1)xe[C]=Fb(Gb(e,_t,C));let jo=C=>x(xe[C],1,1,()=>{xe[C]=null}),Me=e[6].activePlayers&&e[5].endStage&&Ub(e),Ie=e[5].endTurn&&Vb(e),Ne=e[6].phase&&e[5].endPhase&&zb(e);return V=new wo({props:{value:e[7]}}),ue=new wo({props:{value:Kb(e[6])}}),bt=new dc({props:{clientManager:e[1]}}),{c(){t=A("section"),n=A("h3"),n.textContent="Controls",r=q(),L(i.$$.fragment),s=q(),o=A("section"),a=A("h3"),a.textContent="Players",u=q(),L(c.$$.fragment),l=q(),f=A("section"),p=A("h3"),p.textContent="Moves",h=q(),d=A("ul");for(let C=0;C<xe.length;C+=1)xe[C].c();y=q(),m=A("section"),b=A("h3"),b.textContent="Events",g=q(),O=A("ul"),Me&&Me.c(),I=q(),Ie&&Ie.c(),j=q(),Ne&&Ne.c(),N=q(),D=A("section"),J=A("h3"),J.textContent="G",fe=q(),L(V.$$.fragment),se=q(),ne=A("section"),G=A("h3"),G.textContent="ctx",Pe=q(),L(ue.$$.fragment),Lt=q(),L(bt.$$.fragment),k(n,"class","svelte-146sq5f"),k(a,"class","svelte-146sq5f"),k(p,"class","svelte-146sq5f"),k(d,"class","svelte-146sq5f"),k(b,"class","svelte-146sq5f"),k(O,"class","svelte-146sq5f"),k(J,"class","label svelte-146sq5f"),k(D,"class","tree svelte-146sq5f"),k(G,"class","label svelte-146sq5f"),k(ne,"class","tree svelte-146sq5f")},m(C,W){M(C,t,W),w(t,n),w(t,r),R(i,t,null),M(C,s,W),M(C,o,W),w(o,a),w(o,u),R(c,o,null),M(C,l,W),M(C,f,W),w(f,p),w(f,h),w(f,d);for(let wt=0;wt<xe.length;wt+=1)xe[wt].m(d,null);M(C,y,W),M(C,m,W),w(m,b),w(m,g),w(m,O),Me&&Me.m(O,null),w(O,I),Ie&&Ie.m(O,null),w(O,j),Ne&&Ne.m(O,null),M(C,N,W),M(C,D,W),w(D,J),w(D,fe),R(V,D,null),M(C,se,W),M(C,ne,W),w(ne,G),w(ne,Pe),R(ue,ne,null),M(C,Lt,W),R(bt,C,W),kn=!0},p(C,[W]){let wt={};W&1&&(wt.client=C[0]),W&4&&(wt.ToggleVisibility=C[2]),i.$set(wt);let fr={};if(W&64&&(fr.ctx=C[6]),W&8&&(fr.playerID=C[3]),c.$set(fr),W&272){_t=Object.entries(C[4]);let F;for(F=0;F<_t.length;F+=1){let z=Gb(C,_t,F);xe[F]?(xe[F].p(z,W),P(xe[F],1)):(xe[F]=Fb(z),xe[F].c(),P(xe[F],1),xe[F].m(d,null))}for(ce(),F=_t.length;F<xe.length;F+=1)jo(F);le()}C[6].activePlayers&&C[5].endStage?Me?(Me.p(C,W),W&96&&P(Me,1)):(Me=Ub(C),Me.c(),P(Me,1),Me.m(O,I)):Me&&(ce(),x(Me,1,1,()=>{Me=null}),le()),C[5].endTurn?Ie?(Ie.p(C,W),W&32&&P(Ie,1)):(Ie=Vb(C),Ie.c(),P(Ie,1),Ie.m(O,j)):Ie&&(ce(),x(Ie,1,1,()=>{Ie=null}),le()),C[6].phase&&C[5].endPhase?Ne?(Ne.p(C,W),W&96&&P(Ne,1)):(Ne=zb(C),Ne.c(),P(Ne,1),Ne.m(O,null)):Ne&&(ce(),x(Ne,1,1,()=>{Ne=null}),le());let _={};W&128&&(_.value=C[7]),V.$set(_);let E={};W&64&&(E.value=Kb(C[6])),ue.$set(E);let T={};W&2&&(T.clientManager=C[1]),bt.$set(T)},i(C){if(!kn){P(i.$$.fragment,C),P(c.$$.fragment,C);for(let W=0;W<_t.length;W+=1)P(xe[W]);P(Me),P(Ie),P(Ne),P(V.$$.fragment,C),P(ue.$$.fragment,C),P(bt.$$.fragment,C),kn=!0}},o(C){x(i.$$.fragment,C),x(c.$$.fragment,C),xe=xe.filter(Boolean);for(let W=0;W<xe.length;W+=1)x(xe[W]);x(Me),x(Ie),x(Ne),x(V.$$.fragment,C),x(ue.$$.fragment,C),x(bt.$$.fragment,C),kn=!1},d(C){C&&S(t),B(i),C&&S(s),C&&S(o),B(c),C&&S(l),C&&S(f),$e(xe,C),C&&S(y),C&&S(m),Me&&Me.d(),Ie&&Ie.d(),Ne&&Ne.d(),C&&S(N),C&&S(D),B(V),C&&S(se),C&&S(ne),B(ue),C&&S(Lt),B(bt,C)}}}function Kb(e){let t={};for(let n in e)n.startsWith("_")||(t[n]=e[n]);return t}function l3(e,t,n){let{client:r}=t,{clientManager:i}=t,{ToggleVisibility:s}=t,o=a3(r.moves,"mlia"),{playerID:a,moves:u,events:c}=r,l={},f={},p=r.subscribe(d=>{d&&n(7,{G:f,ctx:l}=d,f,n(6,l)),n(3,{playerID:a,moves:u,events:c}=r,a,n(4,u),n(5,c))});Cc(p);let h=d=>i.switchPlayerID(d.detail.playerID);return e.$$set=d=>{"client"in d&&n(0,r=d.client),"clientManager"in d&&n(1,i=d.clientManager),"ToggleVisibility"in d&&n(2,s=d.ToggleVisibility)},[r,i,s,a,u,c,l,f,o,h]}var vc=class extends Z{constructor(t){super(),te(this,t,l3,c3,ee,{client:0,clientManager:1,ToggleVisibility:2},u3)}};function f3(e){de(e,"svelte-13qih23",".item.svelte-13qih23.svelte-13qih23{padding:10px}.item.svelte-13qih23.svelte-13qih23:not(:first-child){border-top:1px dashed #aaa}.item.svelte-13qih23 div.svelte-13qih23{float:right;text-align:right}")}function p3(e){let t,n,r,i,s,o=JSON.stringify(e[1])+"",a;return{c(){t=A("div"),n=A("strong"),r=Y(e[0]),i=q(),s=A("div"),a=Y(o),k(s,"class","svelte-13qih23"),k(t,"class","item svelte-13qih23")},m(u,c){M(u,t,c),w(t,n),w(n,r),w(t,i),w(t,s),w(s,a)},p(u,[c]){c&1&&ae(r,u[0]),c&2&&o!==(o=JSON.stringify(u[1])+"")&&ae(a,o)},i:U,o:U,d(u){u&&S(t)}}}function h3(e,t,n){let{name:r}=t,{value:i}=t;return e.$$set=s=>{"name"in s&&n(0,r=s.name),"value"in s&&n(1,i=s.value)},[r,i]}var er=class extends Z{constructor(t){super(),te(this,t,h3,p3,ee,{name:0,value:1},f3)}};function d3(e){de(e,"svelte-1yzq5o8",".gameinfo.svelte-1yzq5o8{padding:10px}")}function Hb(e){let t,n;return t=new er({props:{name:"isConnected",value:e[1].isConnected}}),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,i){let s={};i&2&&(s.value=r[1].isConnected),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function m3(e){let t,n,r,i,s,o,a,u;n=new er({props:{name:"matchID",value:e[0].matchID}}),i=new er({props:{name:"playerID",value:e[0].playerID}}),o=new er({props:{name:"isActive",value:e[1].isActive}});let c=e[0].multiplayer&&Hb(e);return{c(){t=A("section"),L(n.$$.fragment),r=q(),L(i.$$.fragment),s=q(),L(o.$$.fragment),a=q(),c&&c.c(),k(t,"class","gameinfo svelte-1yzq5o8")},m(l,f){M(l,t,f),R(n,t,null),w(t,r),R(i,t,null),w(t,s),R(o,t,null),w(t,a),c&&c.m(t,null),u=!0},p(l,[f]){let p={};f&1&&(p.value=l[0].matchID),n.$set(p);let h={};f&1&&(h.value=l[0].playerID),i.$set(h);let d={};f&2&&(d.value=l[1].isActive),o.$set(d),l[0].multiplayer?c?(c.p(l,f),f&1&&P(c,1)):(c=Hb(l),c.c(),P(c,1),c.m(t,null)):c&&(ce(),x(c,1,1,()=>{c=null}),le())},i(l){u||(P(n.$$.fragment,l),P(i.$$.fragment,l),P(o.$$.fragment,l),P(c),u=!0)},o(l){x(n.$$.fragment,l),x(i.$$.fragment,l),x(o.$$.fragment,l),x(c),u=!1},d(l){l&&S(t),B(n),B(i),B(o),c&&c.d()}}}function g3(e,t,n){let r,i=U,s=()=>(i(),i=Hi(o,c=>n(1,r=c)),o);e.$$.on_destroy.push(()=>i());let{client:o}=t;s();let{clientManager:a}=t,{ToggleVisibility:u}=t;return e.$$set=c=>{"client"in c&&s(n(0,o=c.client)),"clientManager"in c&&n(2,a=c.clientManager),"ToggleVisibility"in c&&n(3,u=c.ToggleVisibility)},[o,r,a,u]}var bc=class extends Z{constructor(t){super(),te(this,t,g3,m3,ee,{client:0,clientManager:2,ToggleVisibility:3},d3)}};function y3(e){de(e,"svelte-6eza86",".turn-marker.svelte-6eza86{display:flex;justify-content:center;align-items:center;grid-column:1;background:#555;color:#eee;text-align:center;font-weight:bold;border:1px solid #888}")}function v3(e){let t,n;return{c(){t=A("div"),n=Y(e[0]),k(t,"class","turn-marker svelte-6eza86"),k(t,"style",e[1])},m(r,i){M(r,t,i),w(t,n)},p(r,[i]){i&1&&ae(n,r[0])},i:U,o:U,d(r){r&&S(t)}}}function b3(e,t,n){let{turn:r}=t,{numEvents:i}=t,s=`grid-row: span ${i}`;return e.$$set=o=>{"turn"in o&&n(0,r=o.turn),"numEvents"in o&&n(2,i=o.numEvents)},[r,s,i]}var _c=class extends Z{constructor(t){super(),te(this,t,b3,v3,ee,{turn:0,numEvents:2},y3)}};function _3(e){de(e,"svelte-1t4xap",".phase-marker.svelte-1t4xap{grid-column:3;background:#555;border:1px solid #888;color:#eee;text-align:center;font-weight:bold;padding-top:10px;padding-bottom:10px;text-orientation:sideways;writing-mode:vertical-rl;line-height:30px;width:100%}")}function w3(e){let t,n=(e[0]||"")+"",r;return{c(){t=A("div"),r=Y(n),k(t,"class","phase-marker svelte-1t4xap"),k(t,"style",e[1])},m(i,s){M(i,t,s),w(t,r)},p(i,[s]){s&1&&n!==(n=(i[0]||"")+"")&&ae(r,n)},i:U,o:U,d(i){i&&S(t)}}}function O3(e,t,n){let{phase:r}=t,{numEvents:i}=t,s=`grid-row: span ${i}`;return e.$$set=o=>{"phase"in o&&n(0,r=o.phase),"numEvents"in o&&n(2,i=o.numEvents)},[r,s,i]}var wc=class extends Z{constructor(t){super(),te(this,t,O3,w3,ee,{phase:0,numEvents:2},_3)}};function P3(e){let t;return{c(){t=A("div"),t.textContent=`${e[0]}`},m(n,r){M(n,t,r)},p:U,i:U,o:U,d(n){n&&S(t)}}}function E3(e,t,n){let{metadata:r}=t,i=r!==void 0?JSON.stringify(r,null,4):"";return e.$$set=s=>{"metadata"in s&&n(1,r=s.metadata)},[i,r]}var Oc=class extends Z{constructor(t){super(),te(this,t,E3,P3,ee,{metadata:1})}};function k3(e){de(e,"svelte-vajd9z",".log-event.svelte-vajd9z{grid-column:2;cursor:pointer;overflow:hidden;display:flex;flex-direction:column;justify-content:center;background:#fff;border:1px dotted #ccc;border-left:5px solid #ccc;padding:5px;text-align:center;color:#666;font-size:14px;min-height:25px;line-height:25px}.log-event.svelte-vajd9z:hover,.log-event.svelte-vajd9z:focus{border-style:solid;background:#eee}.log-event.pinned.svelte-vajd9z{border-style:solid;background:#eee;opacity:1}.args.svelte-vajd9z{text-align:left;white-space:pre-wrap}.player0.svelte-vajd9z{border-left-color:#ff851b}.player1.svelte-vajd9z{border-left-color:#7fdbff}.player2.svelte-vajd9z{border-left-color:#0074d9}.player3.svelte-vajd9z{border-left-color:#39cccc}.player4.svelte-vajd9z{border-left-color:#3d9970}.player5.svelte-vajd9z{border-left-color:#2ecc40}.player6.svelte-vajd9z{border-left-color:#01ff70}.player7.svelte-vajd9z{border-left-color:#ffdc00}.player8.svelte-vajd9z{border-left-color:#001f3f}.player9.svelte-vajd9z{border-left-color:#ff4136}.player10.svelte-vajd9z{border-left-color:#85144b}.player11.svelte-vajd9z{border-left-color:#f012be}.player12.svelte-vajd9z{border-left-color:#b10dc9}.player13.svelte-vajd9z{border-left-color:#111111}.player14.svelte-vajd9z{border-left-color:#aaaaaa}.player15.svelte-vajd9z{border-left-color:#dddddd}")}function A3(e){let t,n;return t=new Oc({props:{metadata:e[2]}}),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,i){let s={};i&4&&(s.metadata=r[2]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function x3(e){let t,n,r;var i=e[3];function s(o){return{props:{metadata:o[2]}}}return i&&(t=new i(s(e))),{c(){t&&L(t.$$.fragment),n=at()},m(o,a){t&&R(t,o,a),M(o,n,a),r=!0},p(o,a){let u={};if(a&4&&(u.metadata=o[2]),i!==(i=o[3])){if(t){ce();let c=t;x(c.$$.fragment,1,0,()=>{B(c,1)}),le()}i?(t=new i(s(o)),L(t.$$.fragment),P(t.$$.fragment,1),R(t,n.parentNode,n)):t=null}else i&&t.$set(u)},i(o){r||(t&&P(t.$$.fragment,o),r=!0)},o(o){t&&x(t.$$.fragment,o),r=!1},d(o){o&&S(n),t&&B(t,o)}}}function S3(e){let t,n,r,i,s,o,a,u,c,l,f,p,h=[x3,A3],d=[];function y(m,b){return m[3]?0:1}return u=y(e),c=d[u]=h[u](e),{c(){t=A("button"),n=A("div"),r=Y(e[4]),i=Y("("),s=Y(e[6]),o=Y(")"),a=q(),c.c(),k(n,"class","args svelte-vajd9z"),k(t,"class","log-event player"+e[7]+" svelte-vajd9z"),ie(t,"pinned",e[1])},m(m,b){M(m,t,b),w(t,n),w(n,r),w(n,i),w(n,s),w(n,o),w(t,a),d[u].m(t,null),l=!0,f||(p=[Q(t,"click",e[9]),Q(t,"mouseenter",e[10]),Q(t,"focus",e[11]),Q(t,"mouseleave",e[12]),Q(t,"blur",e[13])],f=!0)},p(m,[b]){(!l||b&16)&&ae(r,m[4]);let g=u;u=y(m),u===g?d[u].p(m,b):(ce(),x(d[g],1,1,()=>{d[g]=null}),le(),c=d[u],c?c.p(m,b):(c=d[u]=h[u](m),c.c()),P(c,1),c.m(t,null)),b&2&&ie(t,"pinned",m[1])},i(m){l||(P(c),l=!0)},o(m){x(c),l=!1},d(m){m&&S(t),d[u].d(),f=!1,Le(p)}}}function T3(e,t,n){let{logIndex:r}=t,{action:i}=t,{pinned:s}=t,{metadata:o}=t,{metadataComponent:a}=t,u=Ji(),c=i.payload.args,l=Array.isArray(c)?c.map(g=>JSON.stringify(g,null,2)).join(","):JSON.stringify(c,null,2)||"",f=i.payload.playerID,p;switch(i.type){case"UNDO":p="undo";break;case"REDO":p="redo";case"GAME_EVENT":case"MAKE_MOVE":default:p=i.payload.type;break}let h=()=>u("click",{logIndex:r}),d=()=>u("mouseenter",{logIndex:r}),y=()=>u("mouseenter",{logIndex:r}),m=()=>u("mouseleave"),b=()=>u("mouseleave");return e.$$set=g=>{"logIndex"in g&&n(0,r=g.logIndex),"action"in g&&n(8,i=g.action),"pinned"in g&&n(1,s=g.pinned),"metadata"in g&&n(2,o=g.metadata),"metadataComponent"in g&&n(3,a=g.metadataComponent)},[r,s,o,a,p,u,l,f,i,h,d,y,m,b]}var Pc=class extends Z{constructor(t){super(),te(this,t,T3,S3,ee,{logIndex:0,action:8,pinned:1,metadata:2,metadataComponent:3},k3)}};function M3(e){let t;return{c(){t=Po("path"),k(t,"d","M504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zM212 140v116h-70.9c-10.7 0-16.1 13-8.5 20.5l114.9 114.3c4.7 4.7 12.2 4.7 16.9 0l114.9-114.3c7.6-7.6 2.2-20.5-8.5-20.5H300V140c0-6.6-5.4-12-12-12h-64c-6.6 0-12 5.4-12 12z")},m(n,r){M(n,t,r)},p:U,d(n){n&&S(t)}}}function I3(e){let t,n,r=[{viewBox:"0 0 512 512"},e[0]],i={$$slots:{default:[M3]},$$scope:{ctx:e}};for(let s=0;s<r.length;s+=1)i=jt(i,r[s]);return t=new vo({props:i}),{c(){L(t.$$.fragment)},m(s,o){R(t,s,o),n=!0},p(s,[o]){let a=o&1?x1(r,[r[0],S1(s[0])]):{};o&2&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(P(t.$$.fragment,s),n=!0)},o(s){x(t.$$.fragment,s),n=!1},d(s){B(t,s)}}}function N3(e,t,n){return e.$$set=r=>{n(0,t=jt(jt({},t),lo(r)))},t=lo(t),[t]}var Oo=class extends Z{constructor(t){super(),te(this,t,N3,I3,ee,{})}};function C3(e){de(e,"svelte-1a7time","div.svelte-1a7time{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:500px}")}function q3(e){let t,n;return{c(){t=A("div"),n=Y(e[0]),k(t,"alt",e[0]),k(t,"class","svelte-1a7time")},m(r,i){M(r,t,i),w(t,n)},p(r,[i]){i&1&&ae(n,r[0]),i&1&&k(t,"alt",r[0])},i:U,o:U,d(r){r&&S(t)}}}function j3(e,t,n){let{action:r}=t,i;return e.$$set=s=>{"action"in s&&n(1,r=s.action)},e.$$.update=()=>{if(e.$$.dirty&2){let{type:s,args:o}=r.payload,a=(o||[]).join(",");n(0,i=`${s}(${a})`)}},[i,r]}var Ec=class extends Z{constructor(t){super(),te(this,t,j3,q3,ee,{action:1},C3)}};function D3(e){de(e,"svelte-ztcwsu","table.svelte-ztcwsu.svelte-ztcwsu{font-size:12px;border-collapse:collapse;border:1px solid #ddd;padding:0}tr.svelte-ztcwsu.svelte-ztcwsu{cursor:pointer}tr.svelte-ztcwsu:hover td.svelte-ztcwsu{background:#eee}tr.selected.svelte-ztcwsu td.svelte-ztcwsu{background:#eee}td.svelte-ztcwsu.svelte-ztcwsu{padding:10px;height:10px;line-height:10px;font-size:12px;border:none}th.svelte-ztcwsu.svelte-ztcwsu{background:#888;color:#fff;padding:10px;text-align:center}")}function Wb(e,t,n){let r=e.slice();return r[10]=t[n],r[12]=n,r}function Jb(e){let t,n,r=e[10].value+"",i,s,o,a=e[10].visits+"",u,c,l,f,p,h,d,y;f=new Ec({props:{action:e[10].parentAction}});function m(){return e[6](e[10],e[12])}function b(){return e[7](e[12])}function g(){return e[8](e[10],e[12])}return{c(){t=A("tr"),n=A("td"),i=Y(r),s=q(),o=A("td"),u=Y(a),c=q(),l=A("td"),L(f.$$.fragment),p=q(),k(n,"class","svelte-ztcwsu"),k(o,"class","svelte-ztcwsu"),k(l,"class","svelte-ztcwsu"),k(t,"class","svelte-ztcwsu"),ie(t,"clickable",e[1].length>0),ie(t,"selected",e[12]===e[0])},m(O,I){M(O,t,I),w(t,n),w(n,i),w(t,s),w(t,o),w(o,u),w(t,c),w(t,l),R(f,l,null),w(t,p),h=!0,d||(y=[Q(t,"click",m),Q(t,"mouseout",b),Q(t,"mouseover",g)],d=!0)},p(O,I){e=O,(!h||I&2)&&r!==(r=e[10].value+"")&&ae(i,r),(!h||I&2)&&a!==(a=e[10].visits+"")&&ae(u,a);let j={};I&2&&(j.action=e[10].parentAction),f.$set(j),I&2&&ie(t,"clickable",e[1].length>0),I&1&&ie(t,"selected",e[12]===e[0])},i(O){h||(P(f.$$.fragment,O),h=!0)},o(O){x(f.$$.fragment,O),h=!1},d(O){O&&S(t),B(f),d=!1,Le(y)}}}function R3(e){let t,n,r,i,s,o=e[1],a=[];for(let c=0;c<o.length;c+=1)a[c]=Jb(Wb(e,o,c));let u=c=>x(a[c],1,1,()=>{a[c]=null});return{c(){t=A("table"),n=A("thead"),n.innerHTML=`<th class="svelte-ztcwsu">Value</th>
|
|
26
|
+
`),t.__value=e[9],t.value=t.__value,O(t,"class","svelte-jvfq3i")},m(d,h){M(d,t,h),_(t,n),_(t,r),_(t,s),_(t,o),_(t,u),_(t,c),_(t,f),_(t,p)},p(d,h){h&2&&i!==(i=JSON.stringify(d[7].playerID)+"")&&ae(s,i),h&2&&a!==(a=JSON.stringify(d[7].matchID)+"")&&ae(u,a),h&2&&l!==(l=d[7].game.name+"")&&ae(f,l)},d(d){d&&x(t)}}}function q2(e){let t,n=e[1].length>1&&Cb(e);return{c(){n&&n.c(),t=ut()},m(r,i){n&&n.m(r,i),M(r,t,i)},p(r,[i]){r[1].length>1?n?n.p(r,i):(n=Cb(r),n.c(),n.m(t.parentNode,t)):n&&(n.d(1),n=null)},i:U,o:U,d(r){n&&n.d(r),r&&x(t)}}}var xw="bgio-debug-select-client";function D2(e,t,n){let r,i,s,o,a=U,u=()=>(a(),a=Wi(c,p=>n(5,o=p)),c);e.$$.on_destroy.push(()=>a());let{clientManager:c}=t;u();let l=p=>{let d=i[p.target.value];c.switchToClient(d);let h=document.getElementById(xw);h&&h.focus()};function f(){s=ww(this),n(2,s),n(1,i),n(4,r),n(5,o)}return e.$$set=p=>{"clientManager"in p&&u(n(0,c=p.clientManager))},e.$$.update=()=>{e.$$.dirty&32&&n(4,{client:r,debuggableClients:i}=o,r,(n(1,i),n(5,o))),e.$$.dirty&18&&n(2,s=i.indexOf(r))},[c,i,s,l,r,o,f]}var hc=class extends Z{constructor(t){super(),te(this,t,D2,q2,ee,{clientManager:0},j2)}};function B2(e){de(e,"svelte-1vfj1mn",".key.svelte-1vfj1mn.svelte-1vfj1mn{display:flex;flex-direction:row;align-items:center}button.svelte-1vfj1mn.svelte-1vfj1mn{cursor:pointer;min-width:10px;padding-left:5px;padding-right:5px;height:20px;line-height:20px;text-align:center;border:1px solid #ccc;box-shadow:1px 1px 1px #888;background:#eee;color:#444}button.svelte-1vfj1mn.svelte-1vfj1mn:hover{background:#ddd}.key.active.svelte-1vfj1mn button.svelte-1vfj1mn{background:#ddd;border:1px solid #999;box-shadow:none}label.svelte-1vfj1mn.svelte-1vfj1mn{margin-left:10px}")}function Nb(e){let t,n,r,i,s=`(shortcut: ${e[0]})`,o;return{c(){t=S("label"),n=Y(e[1]),r=N(),i=S("span"),o=Y(s),O(i,"class","screen-reader-only"),O(t,"for",e[5]),O(t,"class","svelte-1vfj1mn")},m(a,u){M(a,t,u),_(t,n),_(t,r),_(t,i),_(i,o)},p(a,u){u&2&&ae(n,a[1]),u&1&&s!==(s=`(shortcut: ${a[0]})`)&&ae(o,s)},d(a){a&&x(t)}}}function G2(e){let t,n,r,i,s,o,a=e[1]&&Nb(e);return{c(){t=S("div"),n=S("button"),r=Y(e[0]),i=N(),a&&a.c(),O(n,"id",e[5]),n.disabled=e[2],O(n,"class","svelte-1vfj1mn"),O(t,"class","key svelte-1vfj1mn"),ie(t,"active",e[3])},m(u,c){M(u,t,c),_(t,n),_(n,r),_(t,i),a&&a.m(t,null),s||(o=[Q(window,"keydown",e[7]),Q(n,"click",e[6])],s=!0)},p(u,[c]){c&1&&ae(r,u[0]),c&4&&(n.disabled=u[2]),u[1]?a?a.p(u,c):(a=Nb(u),a.c(),a.m(t,null)):a&&(a.d(1),a=null),c&8&&ie(t,"active",u[3])},i:U,o:U,d(u){u&&x(t),a&&a.d(),s=!1,Ge(o)}}}function L2(e,t,n){let r,{value:i}=t,{onPress:s=null}=t,{label:o=null}=t,{disable:a=!1}=t,{disableHotkeys:u}=kn("hotkeys");mw(e,u,h=>n(9,r=h));let c=!1,l=`key-${i}`;function f(){n(3,c=!1)}function p(){n(3,c=!0),setTimeout(f,200),s&&setTimeout(s,1)}function d(h){!r&&!a&&!h.ctrlKey&&!h.metaKey&&h.key==i&&(h.preventDefault(),p())}return e.$$set=h=>{"value"in h&&n(0,i=h.value),"onPress"in h&&n(8,s=h.onPress),"label"in h&&n(1,o=h.label),"disable"in h&&n(2,a=h.disable)},[i,o,a,c,u,l,p,d,s]}var bt=class extends Z{constructor(t){super(),te(this,t,L2,G2,ee,{value:0,onPress:8,label:1,disable:2},B2)}};function F2(e){de(e,"svelte-1mppqmp",".move.svelte-1mppqmp{display:flex;flex-direction:row;cursor:pointer;margin-left:10px;color:#666}.move.svelte-1mppqmp:hover{color:#333}.move.active.svelte-1mppqmp{color:#111;font-weight:bold}.arg-field.svelte-1mppqmp{outline:none;font-family:monospace}")}function U2(e){let t,n,r,i,s,o,a,u,c,l,f;return{c(){t=S("div"),n=S("span"),r=Y(e[2]),i=N(),s=S("span"),s.textContent="(",o=N(),a=S("span"),u=N(),c=S("span"),c.textContent=")",O(a,"class","arg-field svelte-1mppqmp"),O(a,"contenteditable",""),O(t,"class","move svelte-1mppqmp"),ie(t,"active",e[3])},m(p,d){M(p,t,d),_(t,n),_(n,r),_(t,i),_(t,s),_(t,o),_(t,a),e[6](a),_(t,u),_(t,c),l||(f=[Q(a,"focus",function(){$t(e[0])&&e[0].apply(this,arguments)}),Q(a,"blur",function(){$t(e[1])&&e[1].apply(this,arguments)}),Q(a,"keypress",MN(V2)),Q(a,"keydown",e[5]),Q(t,"click",function(){$t(e[0])&&e[0].apply(this,arguments)})],l=!0)},p(p,[d]){e=p,d&4&&ae(r,e[2]),d&8&&ie(t,"active",e[3])},i:U,o:U,d(p){p&&x(t),e[6](null),l=!1,Ge(f)}}}var V2=()=>{};function z2(e,t,n){let{Activate:r}=t,{Deactivate:i}=t,{name:s}=t,{active:o}=t,a,u=Yi();function c(){try{let p=a.innerText,d=new Function(`return [${p}]`)();u("submit",d)}catch(p){u("error",p)}n(4,a.innerText="",a)}function l(p){p.key=="Enter"&&(p.preventDefault(),c()),p.key=="Escape"&&(p.preventDefault(),i())}qN(()=>{o?a.focus():a.blur()});function f(p){vo[p?"unshift":"push"](()=>{a=p,n(4,a)})}return e.$$set=p=>{"Activate"in p&&n(0,r=p.Activate),"Deactivate"in p&&n(1,i=p.Deactivate),"name"in p&&n(2,s=p.name),"active"in p&&n(3,o=p.active)},[r,i,s,o,a,l,f]}var mc=class extends Z{constructor(t){super(),te(this,t,z2,U2,ee,{Activate:0,Deactivate:1,name:2,active:3},F2)}};function K2(e){de(e,"svelte-smqssc",".move-error.svelte-smqssc{color:#a00;font-weight:bold}.wrapper.svelte-smqssc{display:flex;flex-direction:row;align-items:center}")}function jb(e){let t,n;return{c(){t=S("span"),n=Y(e[2]),O(t,"class","move-error svelte-smqssc")},m(r,i){M(r,t,i),_(t,n)},p(r,i){i&4&&ae(n,r[2])},d(r){r&&x(t)}}}function H2(e){let t,n,r,i,s,o,a;r=new bt({props:{value:e[0],onPress:e[4]}}),s=new mc({props:{Activate:e[4],Deactivate:e[5],name:e[1],active:e[3]}}),s.$on("submit",e[6]),s.$on("error",e[7]);let u=e[2]&&jb(e);return{c(){t=S("div"),n=S("div"),G(r.$$.fragment),i=N(),G(s.$$.fragment),o=N(),u&&u.c(),O(n,"class","wrapper svelte-smqssc")},m(c,l){M(c,t,l),_(t,n),D(r,n,null),_(n,i),D(s,n,null),_(t,o),u&&u.m(t,null),a=!0},p(c,[l]){let f={};l&1&&(f.value=c[0]),r.$set(f);let p={};l&2&&(p.name=c[1]),l&8&&(p.active=c[3]),s.$set(p),c[2]?u?u.p(c,l):(u=jb(c),u.c(),u.m(t,null)):u&&(u.d(1),u=null)},i(c){a||(P(r.$$.fragment,c),P(s.$$.fragment,c),a=!0)},o(c){A(r.$$.fragment,c),A(s.$$.fragment,c),a=!1},d(c){c&&x(t),B(r),B(s),u&&u.d()}}}function W2(e,t,n){let{shortcut:r}=t,{name:i}=t,{fn:s}=t,{disableHotkeys:o}=kn("hotkeys"),a="",u=!1;function c(){o.set(!0),n(3,u=!0)}function l(){o.set(!1),n(2,a=""),n(3,u=!1)}function f(d){n(2,a=""),l(),s.apply(this,d.detail)}function p(d){n(2,a=d.detail),ke(d.detail)}return e.$$set=d=>{"shortcut"in d&&n(0,r=d.shortcut),"name"in d&&n(1,i=d.name),"fn"in d&&n(8,s=d.fn)},[r,i,a,u,c,l,f,p,s]}var ir=class extends Z{constructor(t){super(),te(this,t,W2,H2,ee,{shortcut:0,name:1,fn:8},K2)}};function J2(e){de(e,"svelte-9hauj9","ul.svelte-9hauj9{padding-left:0}li.svelte-9hauj9{list-style:none;margin:0;margin-bottom:5px}")}function Y2(e){let t,n,r,i,s,o,a,u,c,l,f,p,d;return r=new bt({props:{value:"1",onPress:e[0].reset,label:"reset"}}),o=new bt({props:{value:"2",onPress:e[2],label:"save"}}),c=new bt({props:{value:"3",onPress:e[3],label:"restore"}}),p=new bt({props:{value:".",onPress:e[1],label:"hide"}}),{c(){t=S("ul"),n=S("li"),G(r.$$.fragment),i=N(),s=S("li"),G(o.$$.fragment),a=N(),u=S("li"),G(c.$$.fragment),l=N(),f=S("li"),G(p.$$.fragment),O(n,"class","svelte-9hauj9"),O(s,"class","svelte-9hauj9"),O(u,"class","svelte-9hauj9"),O(f,"class","svelte-9hauj9"),O(t,"id","debug-controls"),O(t,"class","controls svelte-9hauj9")},m(h,y){M(h,t,y),_(t,n),D(r,n,null),_(t,i),_(t,s),D(o,s,null),_(t,a),_(t,u),D(c,u,null),_(t,l),_(t,f),D(p,f,null),d=!0},p(h,[y]){let m={};y&1&&(m.onPress=h[0].reset),r.$set(m);let b={};y&2&&(b.onPress=h[1]),p.$set(b)},i(h){d||(P(r.$$.fragment,h),P(o.$$.fragment,h),P(c.$$.fragment,h),P(p.$$.fragment,h),d=!0)},o(h){A(r.$$.fragment,h),A(o.$$.fragment,h),A(c.$$.fragment,h),A(p.$$.fragment,h),d=!1},d(h){h&&x(t),B(r),B(o),B(c),B(p)}}}function $2(e,t,n){let{client:r}=t,{ToggleVisibility:i}=t;function s(){let a=r.getState(),u=Fu({...a,_undo:[],_redo:[],deltalog:[]});window.localStorage.setItem("gamestate",u),window.localStorage.setItem("initialState",Fu(r.initialState))}function o(){let a=window.localStorage.getItem("gamestate"),u=window.localStorage.getItem("initialState");if(a!==null&&u!==null){let c=Lu(a),l=Lu(u);r.store.dispatch(xi({state:c,initialState:l}))}}return e.$$set=a=>{"client"in a&&n(0,r=a.client),"ToggleVisibility"in a&&n(1,i=a.ToggleVisibility)},[r,i,s,o]}var gc=class extends Z{constructor(t){super(),te(this,t,$2,Y2,ee,{client:0,ToggleVisibility:1},J2)}};function X2(e){de(e,"svelte-19aan9p",".player-box.svelte-19aan9p{display:flex;flex-direction:row}.player.svelte-19aan9p{cursor:pointer;text-align:center;width:30px;height:30px;line-height:30px;background:#eee;border:3px solid #fefefe;box-sizing:content-box;padding:0}.player.current.svelte-19aan9p{background:#555;color:#eee;font-weight:bold}.player.active.svelte-19aan9p{border:3px solid #ff7f50}")}function qb(e,t,n){let r=e.slice();return r[7]=t[n],r}function Db(e){let t,n=e[7]+"",r,i,s,o,a;function u(){return e[5](e[7])}return{c(){t=S("button"),r=Y(n),i=N(),O(t,"class","player svelte-19aan9p"),O(t,"aria-label",s=e[4](e[7])),ie(t,"current",e[7]==e[0].currentPlayer),ie(t,"active",e[7]==e[1])},m(c,l){M(c,t,l),_(t,r),_(t,i),o||(a=Q(t,"click",u),o=!0)},p(c,l){e=c,l&4&&n!==(n=e[7]+"")&&ae(r,n),l&4&&s!==(s=e[4](e[7]))&&O(t,"aria-label",s),l&5&&ie(t,"current",e[7]==e[0].currentPlayer),l&6&&ie(t,"active",e[7]==e[1])},d(c){c&&x(t),o=!1,a()}}}function Q2(e){let t,n=e[2],r=[];for(let i=0;i<n.length;i+=1)r[i]=Db(qb(e,n,i));return{c(){t=S("div");for(let i=0;i<r.length;i+=1)r[i].c();O(t,"class","player-box svelte-19aan9p")},m(i,s){M(i,t,s);for(let o=0;o<r.length;o+=1)r[o].m(t,null)},p(i,[s]){if(s&31){n=i[2];let o;for(o=0;o<n.length;o+=1){let a=qb(i,n,o);r[o]?r[o].p(a,s):(r[o]=Db(a),r[o].c(),r[o].m(t,null))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},i:U,o:U,d(i){i&&x(t),Xe(r,i)}}}function Z2(e,t,n){let{ctx:r}=t,{playerID:i}=t,s=Yi();function o(l){l==i?s("change",{playerID:null}):s("change",{playerID:l})}function a(l){let f=[];l==r.currentPlayer&&f.push("current"),l==i&&f.push("active");let p=`Player ${l}`;return f.length&&(p+=` (${f.join(", ")})`),p}let u,c=l=>o(l);return e.$$set=l=>{"ctx"in l&&n(0,r=l.ctx),"playerID"in l&&n(1,i=l.playerID)},e.$$.update=()=>{e.$$.dirty&1&&n(2,u=r?[...Array(r.numPlayers).keys()].map(l=>l.toString()):[])},[r,i,u,o,a,c]}var yc=class extends Z{constructor(t){super(),te(this,t,Z2,Q2,ee,{ctx:0,playerID:1},X2)}};function ej(e,t){if(e){if(typeof e=="string")return Bb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bb(e,t)}}function Bb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function tj(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=ej(e))||t&&e&&typeof e.length=="number"){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
27
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{!s&&n.return!=null&&n.return()}finally{if(o)throw a}}}}function nj(e,t){var n={},r={},i=tj(t),s;try{for(i.s();!(s=i.n()).done;){var o=s.value;r[o]=!0}}catch(h){i.e(h)}finally{i.f()}var a=r,u=!0;for(var c in e){var l=c[0];if(a[l]){u=!1;break}a[l]=!0,n[c]=l}if(u)return n;a=r;var f=97;n={};for(var p in e){for(var d=String.fromCharCode(f);a[d];)f++,d=String.fromCharCode(f);a[d]=!0,n[p]=d}return n}function rj(e){de(e,"svelte-146sq5f",".tree.svelte-146sq5f{--json-tree-font-family:monospace;--json-tree-font-size:14px;--json-tree-null-color:#757575}.label.svelte-146sq5f{margin-bottom:0;text-transform:none}h3.svelte-146sq5f{text-transform:uppercase}ul.svelte-146sq5f{padding-left:0}li.svelte-146sq5f{list-style:none;margin:0;margin-bottom:5px}")}function Gb(e,t,n){let r=e.slice();return r[11]=t[n][0],r[12]=t[n][1],r}function Lb(e){let t,n,r,i;return n=new ir({props:{shortcut:e[8][e[11]],fn:e[12],name:e[11]}}),{c(){t=S("li"),G(n.$$.fragment),r=N(),O(t,"class","svelte-146sq5f")},m(s,o){M(s,t,o),D(n,t,null),_(t,r),i=!0},p(s,o){let a={};o&16&&(a.shortcut=s[8][s[11]]),o&16&&(a.fn=s[12]),o&16&&(a.name=s[11]),n.$set(a)},i(s){i||(P(n.$$.fragment,s),i=!0)},o(s){A(n.$$.fragment,s),i=!1},d(s){s&&x(t),B(n)}}}function Fb(e){let t,n,r;return n=new ir({props:{name:"endStage",shortcut:7,fn:e[5].endStage}}),{c(){t=S("li"),G(n.$$.fragment),O(t,"class","svelte-146sq5f")},m(i,s){M(i,t,s),D(n,t,null),r=!0},p(i,s){let o={};s&32&&(o.fn=i[5].endStage),n.$set(o)},i(i){r||(P(n.$$.fragment,i),r=!0)},o(i){A(n.$$.fragment,i),r=!1},d(i){i&&x(t),B(n)}}}function Ub(e){let t,n,r;return n=new ir({props:{name:"endTurn",shortcut:8,fn:e[5].endTurn}}),{c(){t=S("li"),G(n.$$.fragment),O(t,"class","svelte-146sq5f")},m(i,s){M(i,t,s),D(n,t,null),r=!0},p(i,s){let o={};s&32&&(o.fn=i[5].endTurn),n.$set(o)},i(i){r||(P(n.$$.fragment,i),r=!0)},o(i){A(n.$$.fragment,i),r=!1},d(i){i&&x(t),B(n)}}}function Vb(e){let t,n,r;return n=new ir({props:{name:"endPhase",shortcut:9,fn:e[5].endPhase}}),{c(){t=S("li"),G(n.$$.fragment),O(t,"class","svelte-146sq5f")},m(i,s){M(i,t,s),D(n,t,null),r=!0},p(i,s){let o={};s&32&&(o.fn=i[5].endPhase),n.$set(o)},i(i){r||(P(n.$$.fragment,i),r=!0)},o(i){A(n.$$.fragment,i),r=!1},d(i){i&&x(t),B(n)}}}function ij(e){let t,n,r,i,s,o,a,u,c,l,f,p,d,h,y,m,b,g,k,I,j,C,q,J,fe,V,se,ne,L,Pe,ue,Lt,wt,Sn;i=new gc({props:{client:e[0],ToggleVisibility:e[2]}}),c=new yc({props:{ctx:e[6],playerID:e[3]}}),c.$on("change",e[9]);let _t=Object.entries(e[4]),Ae=[];for(let R=0;R<_t.length;R+=1)Ae[R]=Lb(Gb(e,_t,R));let qo=R=>A(Ae[R],1,1,()=>{Ae[R]=null}),Me=e[6].activePlayers&&e[5].endStage&&Fb(e),Ie=e[5].endTurn&&Ub(e),Ce=e[6].phase&&e[5].endPhase&&Vb(e);return V=new ko({props:{value:e[7]}}),ue=new ko({props:{value:zb(e[6])}}),wt=new hc({props:{clientManager:e[1]}}),{c(){t=S("section"),n=S("h3"),n.textContent="Controls",r=N(),G(i.$$.fragment),s=N(),o=S("section"),a=S("h3"),a.textContent="Players",u=N(),G(c.$$.fragment),l=N(),f=S("section"),p=S("h3"),p.textContent="Moves",d=N(),h=S("ul");for(let R=0;R<Ae.length;R+=1)Ae[R].c();y=N(),m=S("section"),b=S("h3"),b.textContent="Events",g=N(),k=S("ul"),Me&&Me.c(),I=N(),Ie&&Ie.c(),j=N(),Ce&&Ce.c(),C=N(),q=S("section"),J=S("h3"),J.textContent="G",fe=N(),G(V.$$.fragment),se=N(),ne=S("section"),L=S("h3"),L.textContent="ctx",Pe=N(),G(ue.$$.fragment),Lt=N(),G(wt.$$.fragment),O(n,"class","svelte-146sq5f"),O(a,"class","svelte-146sq5f"),O(p,"class","svelte-146sq5f"),O(h,"class","svelte-146sq5f"),O(b,"class","svelte-146sq5f"),O(k,"class","svelte-146sq5f"),O(J,"class","label svelte-146sq5f"),O(q,"class","tree svelte-146sq5f"),O(L,"class","label svelte-146sq5f"),O(ne,"class","tree svelte-146sq5f")},m(R,W){M(R,t,W),_(t,n),_(t,r),D(i,t,null),M(R,s,W),M(R,o,W),_(o,a),_(o,u),D(c,o,null),M(R,l,W),M(R,f,W),_(f,p),_(f,d),_(f,h);for(let kt=0;kt<Ae.length;kt+=1)Ae[kt].m(h,null);M(R,y,W),M(R,m,W),_(m,b),_(m,g),_(m,k),Me&&Me.m(k,null),_(k,I),Ie&&Ie.m(k,null),_(k,j),Ce&&Ce.m(k,null),M(R,C,W),M(R,q,W),_(q,J),_(q,fe),D(V,q,null),M(R,se,W),M(R,ne,W),_(ne,L),_(ne,Pe),D(ue,ne,null),M(R,Lt,W),D(wt,R,W),Sn=!0},p(R,[W]){let kt={};W&1&&(kt.client=R[0]),W&4&&(kt.ToggleVisibility=R[2]),i.$set(kt);let pr={};if(W&64&&(pr.ctx=R[6]),W&8&&(pr.playerID=R[3]),c.$set(pr),W&272){_t=Object.entries(R[4]);let F;for(F=0;F<_t.length;F+=1){let z=Gb(R,_t,F);Ae[F]?(Ae[F].p(z,W),P(Ae[F],1)):(Ae[F]=Lb(z),Ae[F].c(),P(Ae[F],1),Ae[F].m(h,null))}for(ce(),F=_t.length;F<Ae.length;F+=1)qo(F);le()}R[6].activePlayers&&R[5].endStage?Me?(Me.p(R,W),W&96&&P(Me,1)):(Me=Fb(R),Me.c(),P(Me,1),Me.m(k,I)):Me&&(ce(),A(Me,1,1,()=>{Me=null}),le()),R[5].endTurn?Ie?(Ie.p(R,W),W&32&&P(Ie,1)):(Ie=Ub(R),Ie.c(),P(Ie,1),Ie.m(k,j)):Ie&&(ce(),A(Ie,1,1,()=>{Ie=null}),le()),R[6].phase&&R[5].endPhase?Ce?(Ce.p(R,W),W&96&&P(Ce,1)):(Ce=Vb(R),Ce.c(),P(Ce,1),Ce.m(k,null)):Ce&&(ce(),A(Ce,1,1,()=>{Ce=null}),le());let w={};W&128&&(w.value=R[7]),V.$set(w);let E={};W&64&&(E.value=zb(R[6])),ue.$set(E);let T={};W&2&&(T.clientManager=R[1]),wt.$set(T)},i(R){if(!Sn){P(i.$$.fragment,R),P(c.$$.fragment,R);for(let W=0;W<_t.length;W+=1)P(Ae[W]);P(Me),P(Ie),P(Ce),P(V.$$.fragment,R),P(ue.$$.fragment,R),P(wt.$$.fragment,R),Sn=!0}},o(R){A(i.$$.fragment,R),A(c.$$.fragment,R),Ae=Ae.filter(Boolean);for(let W=0;W<Ae.length;W+=1)A(Ae[W]);A(Me),A(Ie),A(Ce),A(V.$$.fragment,R),A(ue.$$.fragment,R),A(wt.$$.fragment,R),Sn=!1},d(R){R&&x(t),B(i),R&&x(s),R&&x(o),B(c),R&&x(l),R&&x(f),Xe(Ae,R),R&&x(y),R&&x(m),Me&&Me.d(),Ie&&Ie.d(),Ce&&Ce.d(),R&&x(C),R&&x(q),B(V),R&&x(se),R&&x(ne),B(ue),R&&x(Lt),B(wt,R)}}}function zb(e){let t={};for(let n in e)n.startsWith("_")||(t[n]=e[n]);return t}function sj(e,t,n){let{client:r}=t,{clientManager:i}=t,{ToggleVisibility:s}=t,o=nj(r.moves,"mlia"),{playerID:a,moves:u,events:c}=r,l={},f={},p=r.subscribe(h=>{h&&n(7,{G:f,ctx:l}=h,f,n(6,l)),n(3,{playerID:a,moves:u,events:c}=r,a,n(4,u),n(5,c))});Rc(p);let d=h=>i.switchPlayerID(h.detail.playerID);return e.$$set=h=>{"client"in h&&n(0,r=h.client),"clientManager"in h&&n(1,i=h.clientManager),"ToggleVisibility"in h&&n(2,s=h.ToggleVisibility)},[r,i,s,a,u,c,l,f,o,d]}var vc=class extends Z{constructor(t){super(),te(this,t,sj,ij,ee,{client:0,clientManager:1,ToggleVisibility:2},rj)}};function oj(e){de(e,"svelte-13qih23",".item.svelte-13qih23.svelte-13qih23{padding:10px}.item.svelte-13qih23.svelte-13qih23:not(:first-child){border-top:1px dashed #aaa}.item.svelte-13qih23 div.svelte-13qih23{float:right;text-align:right}")}function aj(e){let t,n,r,i,s,o=JSON.stringify(e[1])+"",a;return{c(){t=S("div"),n=S("strong"),r=Y(e[0]),i=N(),s=S("div"),a=Y(o),O(s,"class","svelte-13qih23"),O(t,"class","item svelte-13qih23")},m(u,c){M(u,t,c),_(t,n),_(n,r),_(t,i),_(t,s),_(s,a)},p(u,[c]){c&1&&ae(r,u[0]),c&2&&o!==(o=JSON.stringify(u[1])+"")&&ae(a,o)},i:U,o:U,d(u){u&&x(t)}}}function uj(e,t,n){let{name:r}=t,{value:i}=t;return e.$$set=s=>{"name"in s&&n(0,r=s.name),"value"in s&&n(1,i=s.value)},[r,i]}var tr=class extends Z{constructor(t){super(),te(this,t,uj,aj,ee,{name:0,value:1},oj)}};function cj(e){de(e,"svelte-1yzq5o8",".gameinfo.svelte-1yzq5o8{padding:10px}")}function Kb(e){let t,n;return t=new tr({props:{name:"isConnected",value:e[1].isConnected}}),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,i){let s={};i&2&&(s.value=r[1].isConnected),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function lj(e){let t,n,r,i,s,o,a,u;n=new tr({props:{name:"matchID",value:e[0].matchID}}),i=new tr({props:{name:"playerID",value:e[0].playerID}}),o=new tr({props:{name:"isActive",value:e[1].isActive}});let c=e[0].multiplayer&&Kb(e);return{c(){t=S("section"),G(n.$$.fragment),r=N(),G(i.$$.fragment),s=N(),G(o.$$.fragment),a=N(),c&&c.c(),O(t,"class","gameinfo svelte-1yzq5o8")},m(l,f){M(l,t,f),D(n,t,null),_(t,r),D(i,t,null),_(t,s),D(o,t,null),_(t,a),c&&c.m(t,null),u=!0},p(l,[f]){let p={};f&1&&(p.value=l[0].matchID),n.$set(p);let d={};f&1&&(d.value=l[0].playerID),i.$set(d);let h={};f&2&&(h.value=l[1].isActive),o.$set(h),l[0].multiplayer?c?(c.p(l,f),f&1&&P(c,1)):(c=Kb(l),c.c(),P(c,1),c.m(t,null)):c&&(ce(),A(c,1,1,()=>{c=null}),le())},i(l){u||(P(n.$$.fragment,l),P(i.$$.fragment,l),P(o.$$.fragment,l),P(c),u=!0)},o(l){A(n.$$.fragment,l),A(i.$$.fragment,l),A(o.$$.fragment,l),A(c),u=!1},d(l){l&&x(t),B(n),B(i),B(o),c&&c.d()}}}function fj(e,t,n){let r,i=U,s=()=>(i(),i=Wi(o,c=>n(1,r=c)),o);e.$$.on_destroy.push(()=>i());let{client:o}=t;s();let{clientManager:a}=t,{ToggleVisibility:u}=t;return e.$$set=c=>{"client"in c&&s(n(0,o=c.client)),"clientManager"in c&&n(2,a=c.clientManager),"ToggleVisibility"in c&&n(3,u=c.ToggleVisibility)},[o,r,a,u]}var bc=class extends Z{constructor(t){super(),te(this,t,fj,lj,ee,{client:0,clientManager:2,ToggleVisibility:3},cj)}};function pj(e){de(e,"svelte-6eza86",".turn-marker.svelte-6eza86{display:flex;justify-content:center;align-items:center;grid-column:1;background:#555;color:#eee;text-align:center;font-weight:bold;border:1px solid #888}")}function dj(e){let t,n;return{c(){t=S("div"),n=Y(e[0]),O(t,"class","turn-marker svelte-6eza86"),O(t,"style",e[1])},m(r,i){M(r,t,i),_(t,n)},p(r,[i]){i&1&&ae(n,r[0])},i:U,o:U,d(r){r&&x(t)}}}function hj(e,t,n){let{turn:r}=t,{numEvents:i}=t,s=`grid-row: span ${i}`;return e.$$set=o=>{"turn"in o&&n(0,r=o.turn),"numEvents"in o&&n(2,i=o.numEvents)},[r,s,i]}var wc=class extends Z{constructor(t){super(),te(this,t,hj,dj,ee,{turn:0,numEvents:2},pj)}};function mj(e){de(e,"svelte-1t4xap",".phase-marker.svelte-1t4xap{grid-column:3;background:#555;border:1px solid #888;color:#eee;text-align:center;font-weight:bold;padding-top:10px;padding-bottom:10px;text-orientation:sideways;writing-mode:vertical-rl;line-height:30px;width:100%}")}function gj(e){let t,n=(e[0]||"")+"",r;return{c(){t=S("div"),r=Y(n),O(t,"class","phase-marker svelte-1t4xap"),O(t,"style",e[1])},m(i,s){M(i,t,s),_(t,r)},p(i,[s]){s&1&&n!==(n=(i[0]||"")+"")&&ae(r,n)},i:U,o:U,d(i){i&&x(t)}}}function yj(e,t,n){let{phase:r}=t,{numEvents:i}=t,s=`grid-row: span ${i}`;return e.$$set=o=>{"phase"in o&&n(0,r=o.phase),"numEvents"in o&&n(2,i=o.numEvents)},[r,s,i]}var _c=class extends Z{constructor(t){super(),te(this,t,yj,gj,ee,{phase:0,numEvents:2},mj)}};function vj(e){let t;return{c(){t=S("div"),t.textContent=`${e[0]}`},m(n,r){M(n,t,r)},p:U,i:U,o:U,d(n){n&&x(t)}}}function bj(e,t,n){let{metadata:r}=t,i=r!==void 0?JSON.stringify(r,null,4):"";return e.$$set=s=>{"metadata"in s&&n(1,r=s.metadata)},[i,r]}var kc=class extends Z{constructor(t){super(),te(this,t,bj,vj,ee,{metadata:1})}};function wj(e){de(e,"svelte-vajd9z",".log-event.svelte-vajd9z{grid-column:2;cursor:pointer;overflow:hidden;display:flex;flex-direction:column;justify-content:center;background:#fff;border:1px dotted #ccc;border-left:5px solid #ccc;padding:5px;text-align:center;color:#666;font-size:14px;min-height:25px;line-height:25px}.log-event.svelte-vajd9z:hover,.log-event.svelte-vajd9z:focus{border-style:solid;background:#eee}.log-event.pinned.svelte-vajd9z{border-style:solid;background:#eee;opacity:1}.args.svelte-vajd9z{text-align:left;white-space:pre-wrap}.player0.svelte-vajd9z{border-left-color:#ff851b}.player1.svelte-vajd9z{border-left-color:#7fdbff}.player2.svelte-vajd9z{border-left-color:#0074d9}.player3.svelte-vajd9z{border-left-color:#39cccc}.player4.svelte-vajd9z{border-left-color:#3d9970}.player5.svelte-vajd9z{border-left-color:#2ecc40}.player6.svelte-vajd9z{border-left-color:#01ff70}.player7.svelte-vajd9z{border-left-color:#ffdc00}.player8.svelte-vajd9z{border-left-color:#001f3f}.player9.svelte-vajd9z{border-left-color:#ff4136}.player10.svelte-vajd9z{border-left-color:#85144b}.player11.svelte-vajd9z{border-left-color:#f012be}.player12.svelte-vajd9z{border-left-color:#b10dc9}.player13.svelte-vajd9z{border-left-color:#111111}.player14.svelte-vajd9z{border-left-color:#aaaaaa}.player15.svelte-vajd9z{border-left-color:#dddddd}")}function _j(e){let t,n;return t=new kc({props:{metadata:e[2]}}),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,i){let s={};i&4&&(s.metadata=r[2]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function kj(e){let t,n,r;var i=e[3];function s(o){return{props:{metadata:o[2]}}}return i&&(t=new i(s(e))),{c(){t&&G(t.$$.fragment),n=ut()},m(o,a){t&&D(t,o,a),M(o,n,a),r=!0},p(o,a){let u={};if(a&4&&(u.metadata=o[2]),i!==(i=o[3])){if(t){ce();let c=t;A(c.$$.fragment,1,0,()=>{B(c,1)}),le()}i?(t=new i(s(o)),G(t.$$.fragment),P(t.$$.fragment,1),D(t,n.parentNode,n)):t=null}else i&&t.$set(u)},i(o){r||(t&&P(t.$$.fragment,o),r=!0)},o(o){t&&A(t.$$.fragment,o),r=!1},d(o){o&&x(n),t&&B(t,o)}}}function Pj(e){let t,n,r,i,s,o,a,u,c,l,f,p,d=[kj,_j],h=[];function y(m,b){return m[3]?0:1}return u=y(e),c=h[u]=d[u](e),{c(){t=S("button"),n=S("div"),r=Y(e[4]),i=Y("("),s=Y(e[6]),o=Y(")"),a=N(),c.c(),O(n,"class","args svelte-vajd9z"),O(t,"class","log-event player"+e[7]+" svelte-vajd9z"),ie(t,"pinned",e[1])},m(m,b){M(m,t,b),_(t,n),_(n,r),_(n,i),_(n,s),_(n,o),_(t,a),h[u].m(t,null),l=!0,f||(p=[Q(t,"click",e[9]),Q(t,"mouseenter",e[10]),Q(t,"focus",e[11]),Q(t,"mouseleave",e[12]),Q(t,"blur",e[13])],f=!0)},p(m,[b]){(!l||b&16)&&ae(r,m[4]);let g=u;u=y(m),u===g?h[u].p(m,b):(ce(),A(h[g],1,1,()=>{h[g]=null}),le(),c=h[u],c?c.p(m,b):(c=h[u]=d[u](m),c.c()),P(c,1),c.m(t,null)),b&2&&ie(t,"pinned",m[1])},i(m){l||(P(c),l=!0)},o(m){A(c),l=!1},d(m){m&&x(t),h[u].d(),f=!1,Ge(p)}}}function Ej(e,t,n){let{logIndex:r}=t,{action:i}=t,{pinned:s}=t,{metadata:o}=t,{metadataComponent:a}=t,u=Yi(),c=i.payload.args,l=Array.isArray(c)?c.map(g=>JSON.stringify(g,null,2)).join(","):JSON.stringify(c,null,2)||"",f=i.payload.playerID,p;switch(i.type){case"UNDO":p="undo";break;case"REDO":p="redo";case"GAME_EVENT":case"MAKE_MOVE":default:p=i.payload.type;break}let d=()=>u("click",{logIndex:r}),h=()=>u("mouseenter",{logIndex:r}),y=()=>u("mouseenter",{logIndex:r}),m=()=>u("mouseleave"),b=()=>u("mouseleave");return e.$$set=g=>{"logIndex"in g&&n(0,r=g.logIndex),"action"in g&&n(8,i=g.action),"pinned"in g&&n(1,s=g.pinned),"metadata"in g&&n(2,o=g.metadata),"metadataComponent"in g&&n(3,a=g.metadataComponent)},[r,s,o,a,p,u,l,f,i,d,h,y,m,b]}var Pc=class extends Z{constructor(t){super(),te(this,t,Ej,Pj,ee,{logIndex:0,action:8,pinned:1,metadata:2,metadataComponent:3},wj)}};function Oj(e){let t;return{c(){t=Eo("path"),O(t,"d","M504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zM212 140v116h-70.9c-10.7 0-16.1 13-8.5 20.5l114.9 114.3c4.7 4.7 12.2 4.7 16.9 0l114.9-114.3c7.6-7.6 2.2-20.5-8.5-20.5H300V140c0-6.6-5.4-12-12-12h-64c-6.6 0-12 5.4-12 12z")},m(n,r){M(n,t,r)},p:U,d(n){n&&x(t)}}}function Sj(e){let t,n,r=[{viewBox:"0 0 512 512"},e[0]],i={$$slots:{default:[Oj]},$$scope:{ctx:e}};for(let s=0;s<r.length;s+=1)i=qt(i,r[s]);return t=new bo({props:i}),{c(){G(t.$$.fragment)},m(s,o){D(t,s,o),n=!0},p(s,[o]){let a=o&1?Sw(r,[r[0],Aw(s[0])]):{};o&2&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(P(t.$$.fragment,s),n=!0)},o(s){A(t.$$.fragment,s),n=!1},d(s){B(t,s)}}}function Aj(e,t,n){return e.$$set=r=>{n(0,t=qt(qt({},t),fo(r)))},t=fo(t),[t]}var Po=class extends Z{constructor(t){super(),te(this,t,Aj,Sj,ee,{})}};function xj(e){de(e,"svelte-1a7time","div.svelte-1a7time{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;max-width:500px}")}function Tj(e){let t,n;return{c(){t=S("div"),n=Y(e[0]),O(t,"alt",e[0]),O(t,"class","svelte-1a7time")},m(r,i){M(r,t,i),_(t,n)},p(r,[i]){i&1&&ae(n,r[0]),i&1&&O(t,"alt",r[0])},i:U,o:U,d(r){r&&x(t)}}}function Mj(e,t,n){let{action:r}=t,i;return e.$$set=s=>{"action"in s&&n(1,r=s.action)},e.$$.update=()=>{if(e.$$.dirty&2){let{type:s,args:o}=r.payload,a=(o||[]).join(",");n(0,i=`${s}(${a})`)}},[i,r]}var Ec=class extends Z{constructor(t){super(),te(this,t,Mj,Tj,ee,{action:1},xj)}};function Ij(e){de(e,"svelte-ztcwsu","table.svelte-ztcwsu.svelte-ztcwsu{font-size:12px;border-collapse:collapse;border:1px solid #ddd;padding:0}tr.svelte-ztcwsu.svelte-ztcwsu{cursor:pointer}tr.svelte-ztcwsu:hover td.svelte-ztcwsu{background:#eee}tr.selected.svelte-ztcwsu td.svelte-ztcwsu{background:#eee}td.svelte-ztcwsu.svelte-ztcwsu{padding:10px;height:10px;line-height:10px;font-size:12px;border:none}th.svelte-ztcwsu.svelte-ztcwsu{background:#888;color:#fff;padding:10px;text-align:center}")}function Hb(e,t,n){let r=e.slice();return r[10]=t[n],r[12]=n,r}function Wb(e){let t,n,r=e[10].value+"",i,s,o,a=e[10].visits+"",u,c,l,f,p,d,h,y;f=new Ec({props:{action:e[10].parentAction}});function m(){return e[6](e[10],e[12])}function b(){return e[7](e[12])}function g(){return e[8](e[10],e[12])}return{c(){t=S("tr"),n=S("td"),i=Y(r),s=N(),o=S("td"),u=Y(a),c=N(),l=S("td"),G(f.$$.fragment),p=N(),O(n,"class","svelte-ztcwsu"),O(o,"class","svelte-ztcwsu"),O(l,"class","svelte-ztcwsu"),O(t,"class","svelte-ztcwsu"),ie(t,"clickable",e[1].length>0),ie(t,"selected",e[12]===e[0])},m(k,I){M(k,t,I),_(t,n),_(n,i),_(t,s),_(t,o),_(o,u),_(t,c),_(t,l),D(f,l,null),_(t,p),d=!0,h||(y=[Q(t,"click",m),Q(t,"mouseout",b),Q(t,"mouseover",g)],h=!0)},p(k,I){e=k,(!d||I&2)&&r!==(r=e[10].value+"")&&ae(i,r),(!d||I&2)&&a!==(a=e[10].visits+"")&&ae(u,a);let j={};I&2&&(j.action=e[10].parentAction),f.$set(j),I&2&&ie(t,"clickable",e[1].length>0),I&1&&ie(t,"selected",e[12]===e[0])},i(k){d||(P(f.$$.fragment,k),d=!0)},o(k){A(f.$$.fragment,k),d=!1},d(k){k&&x(t),B(f),h=!1,Ge(y)}}}function Cj(e){let t,n,r,i,s,o=e[1],a=[];for(let c=0;c<o.length;c+=1)a[c]=Wb(Hb(e,o,c));let u=c=>A(a[c],1,1,()=>{a[c]=null});return{c(){t=S("table"),n=S("thead"),n.innerHTML=`<th class="svelte-ztcwsu">Value</th>
|
|
28
28
|
<th class="svelte-ztcwsu">Visits</th>
|
|
29
|
-
<th class="svelte-ztcwsu">Action</th>`,r=q(),i=A("tbody");for(let c=0;c<a.length;c+=1)a[c].c();k(t,"class","svelte-ztcwsu")},m(c,l){M(c,t,l),w(t,n),w(t,r),w(t,i);for(let f=0;f<a.length;f+=1)a[f].m(i,null);s=!0},p(c,[l]){if(l&15){o=c[1];let f;for(f=0;f<o.length;f+=1){let p=Wb(c,o,f);a[f]?(a[f].p(p,l),P(a[f],1)):(a[f]=Jb(p),a[f].c(),P(a[f],1),a[f].m(i,null))}for(ce(),f=o.length;f<a.length;f+=1)u(f);le()}},i(c){if(!s){for(let l=0;l<o.length;l+=1)P(a[l]);s=!0}},o(c){a=a.filter(Boolean);for(let l=0;l<a.length;l+=1)x(a[l]);s=!1},d(c){c&&S(t),$e(a,c)}}}function B3(e,t,n){let{root:r}=t,{selectedIndex:i=null}=t,s=Ji(),o=[],a=[];function u(h,d){s("select",{node:h,selectedIndex:d})}function c(h,d){i===null&&s("preview",{node:h})}let l=(h,d)=>u(h,d),f=h=>c(null),p=(h,d)=>c(h);return e.$$set=h=>{"root"in h&&n(4,r=h.root),"selectedIndex"in h&&n(0,i=h.selectedIndex)},e.$$.update=()=>{if(e.$$.dirty&48){let h=r;for(n(5,o=[]);h.parent;){let d=h.parent,{type:y,args:m}=h.parentAction.payload,b=(m||[]).join(","),g=`${y}(${b})`;o.push({parent:d,arrowText:g}),h=d}o.reverse(),n(1,a=[...r.children].sort((d,y)=>d.visits<y.visits?1:-1).slice(0,50))}},[i,a,u,c,r,o,l,f,p]}var Vi=class extends Z{constructor(t){super(),te(this,t,B3,R3,ee,{root:4,selectedIndex:0},D3)}};function L3(e){de(e,"svelte-1f0amz4",".visualizer.svelte-1f0amz4{display:flex;flex-direction:column;align-items:center;padding:50px}.preview.svelte-1f0amz4{opacity:0.5}.icon.svelte-1f0amz4{color:#777;width:32px;height:32px;margin-bottom:20px}")}function Yb(e,t,n){let r=e.slice();return r[9]=t[n].node,r[10]=t[n].selectedIndex,r[12]=n,r}function G3(e){let t,n,r;return n=new Oo({}),{c(){t=A("div"),L(n.$$.fragment),k(t,"class","icon svelte-1f0amz4")},m(i,s){M(i,t,s),R(n,t,null),r=!0},i(i){r||(P(n.$$.fragment,i),r=!0)},o(i){x(n.$$.fragment,i),r=!1},d(i){i&&S(t),B(n)}}}function F3(e){let t,n;function r(...i){return e[7](e[12],...i)}return t=new Vi({props:{root:e[9],selectedIndex:e[10]}}),t.$on("select",r),{c(){L(t.$$.fragment)},m(i,s){R(t,i,s),n=!0},p(i,s){e=i;let o={};s&1&&(o.root=e[9]),s&1&&(o.selectedIndex=e[10]),t.$set(o)},i(i){n||(P(t.$$.fragment,i),n=!0)},o(i){x(t.$$.fragment,i),n=!1},d(i){B(t,i)}}}function U3(e){let t,n;function r(...s){return e[5](e[12],...s)}function i(...s){return e[6](e[12],...s)}return t=new Vi({props:{root:e[9]}}),t.$on("select",r),t.$on("preview",i),{c(){L(t.$$.fragment)},m(s,o){R(t,s,o),n=!0},p(s,o){e=s;let a={};o&1&&(a.root=e[9]),t.$set(a)},i(s){n||(P(t.$$.fragment,s),n=!0)},o(s){x(t.$$.fragment,s),n=!1},d(s){B(t,s)}}}function $b(e){let t,n,r,i,s,o=e[12]!==0&&G3(),a=[U3,F3],u=[];function c(l,f){return l[12]===l[0].length-1?0:1}return r=c(e),i=u[r]=a[r](e),{c(){o&&o.c(),t=q(),n=A("section"),i.c()},m(l,f){o&&o.m(l,f),M(l,t,f),M(l,n,f),u[r].m(n,null),s=!0},p(l,f){let p=r;r=c(l),r===p?u[r].p(l,f):(ce(),x(u[p],1,1,()=>{u[p]=null}),le(),i=u[r],i?i.p(l,f):(i=u[r]=a[r](l),i.c()),P(i,1),i.m(n,null))},i(l){s||(P(o),P(i),s=!0)},o(l){x(o),x(i),s=!1},d(l){o&&o.d(l),l&&S(t),l&&S(n),u[r].d()}}}function Xb(e){let t,n,r,i,s,o;return n=new Oo({}),s=new Vi({props:{root:e[1]}}),{c(){t=A("div"),L(n.$$.fragment),r=q(),i=A("section"),L(s.$$.fragment),k(t,"class","icon svelte-1f0amz4"),k(i,"class","preview svelte-1f0amz4")},m(a,u){M(a,t,u),R(n,t,null),M(a,r,u),M(a,i,u),R(s,i,null),o=!0},p(a,u){let c={};u&2&&(c.root=a[1]),s.$set(c)},i(a){o||(P(n.$$.fragment,a),P(s.$$.fragment,a),o=!0)},o(a){x(n.$$.fragment,a),x(s.$$.fragment,a),o=!1},d(a){a&&S(t),B(n),a&&S(r),a&&S(i),B(s)}}}function V3(e){let t,n,r,i=e[0],s=[];for(let u=0;u<i.length;u+=1)s[u]=$b(Yb(e,i,u));let o=u=>x(s[u],1,1,()=>{s[u]=null}),a=e[1]&&Xb(e);return{c(){t=A("div");for(let u=0;u<s.length;u+=1)s[u].c();n=q(),a&&a.c(),k(t,"class","visualizer svelte-1f0amz4")},m(u,c){M(u,t,c);for(let l=0;l<s.length;l+=1)s[l].m(t,null);w(t,n),a&&a.m(t,null),r=!0},p(u,[c]){if(c&13){i=u[0];let l;for(l=0;l<i.length;l+=1){let f=Yb(u,i,l);s[l]?(s[l].p(f,c),P(s[l],1)):(s[l]=$b(f),s[l].c(),P(s[l],1),s[l].m(t,n))}for(ce(),l=i.length;l<s.length;l+=1)o(l);le()}u[1]?a?(a.p(u,c),c&2&&P(a,1)):(a=Xb(u),a.c(),P(a,1),a.m(t,null)):a&&(ce(),x(a,1,1,()=>{a=null}),le())},i(u){if(!r){for(let c=0;c<i.length;c+=1)P(s[c]);P(a),r=!0}},o(u){s=s.filter(Boolean);for(let c=0;c<s.length;c+=1)x(s[c]);x(a),r=!1},d(u){u&&S(t),$e(s,u),a&&a.d()}}}function z3(e,t,n){let{metadata:r}=t,i=[],s=null;function o({node:f,selectedIndex:p},h){n(1,s=null),n(0,i[h].selectedIndex=p,i),n(0,i=[...i.slice(0,h+1),{node:f}])}function a({node:f},p){n(1,s=f)}let u=(f,p)=>o(p.detail,f),c=(f,p)=>a(p.detail),l=(f,p)=>o(p.detail,f);return e.$$set=f=>{"metadata"in f&&n(4,r=f.metadata)},e.$$.update=()=>{e.$$.dirty&16&&n(0,i=[{node:r}])},[i,s,o,a,r,u,c,l]}var zi=class extends Z{constructor(t){super(),te(this,t,z3,V3,ee,{metadata:4},L3)}};function K3(e){de(e,"svelte-1pq5e4b",".gamelog.svelte-1pq5e4b{display:grid;grid-template-columns:30px 1fr 30px;grid-auto-rows:auto;grid-auto-flow:column}")}function Qb(e,t,n){let r=e.slice();return r[16]=t[n].phase,r[18]=n,r}function Zb(e,t,n){let r=e.slice();return r[19]=t[n].action,r[20]=t[n].metadata,r[18]=n,r}function e1(e,t,n){let r=e.slice();return r[22]=t[n].turn,r[18]=n,r}function t1(e){let t,n;return t=new _c({props:{turn:e[22],numEvents:e[3][e[18]]}}),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,i){let s={};i&2&&(s.turn=r[22]),i&8&&(s.numEvents=r[3][r[18]]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function n1(e){let t,n,r=e[18]in e[3]&&t1(e);return{c(){r&&r.c(),t=at()},m(i,s){r&&r.m(i,s),M(i,t,s),n=!0},p(i,s){i[18]in i[3]?r?(r.p(i,s),s&8&&P(r,1)):(r=t1(i),r.c(),P(r,1),r.m(t.parentNode,t)):r&&(ce(),x(r,1,1,()=>{r=null}),le())},i(i){n||(P(r),n=!0)},o(i){x(r),n=!1},d(i){r&&r.d(i),i&&S(t)}}}function r1(e){let t,n;return t=new Pc({props:{pinned:e[18]===e[2],logIndex:e[18],action:e[19],metadata:e[20]}}),t.$on("click",e[5]),t.$on("mouseenter",e[6]),t.$on("mouseleave",e[7]),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,i){let s={};i&4&&(s.pinned=r[18]===r[2]),i&2&&(s.action=r[19]),i&2&&(s.metadata=r[20]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function i1(e){let t,n;return t=new wc({props:{phase:e[16],numEvents:e[4][e[18]]}}),{c(){L(t.$$.fragment)},m(r,i){R(t,r,i),n=!0},p(r,i){let s={};i&2&&(s.phase=r[16]),i&16&&(s.numEvents=r[4][r[18]]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){x(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function s1(e){let t,n,r=e[18]in e[4]&&i1(e);return{c(){r&&r.c(),t=at()},m(i,s){r&&r.m(i,s),M(i,t,s),n=!0},p(i,s){i[18]in i[4]?r?(r.p(i,s),s&16&&P(r,1)):(r=i1(i),r.c(),P(r,1),r.m(t.parentNode,t)):r&&(ce(),x(r,1,1,()=>{r=null}),le())},i(i){n||(P(r),n=!0)},o(i){x(r),n=!1},d(i){r&&r.d(i),i&&S(t)}}}function H3(e){let t,n,r,i,s,o,a=e[1],u=[];for(let m=0;m<a.length;m+=1)u[m]=n1(e1(e,a,m));let c=m=>x(u[m],1,1,()=>{u[m]=null}),l=e[1],f=[];for(let m=0;m<l.length;m+=1)f[m]=r1(Zb(e,l,m));let p=m=>x(f[m],1,1,()=>{f[m]=null}),h=e[1],d=[];for(let m=0;m<h.length;m+=1)d[m]=s1(Qb(e,h,m));let y=m=>x(d[m],1,1,()=>{d[m]=null});return{c(){t=A("div");for(let m=0;m<u.length;m+=1)u[m].c();n=q();for(let m=0;m<f.length;m+=1)f[m].c();r=q();for(let m=0;m<d.length;m+=1)d[m].c();k(t,"class","gamelog svelte-1pq5e4b"),ie(t,"pinned",e[2])},m(m,b){M(m,t,b);for(let g=0;g<u.length;g+=1)u[g].m(t,null);w(t,n);for(let g=0;g<f.length;g+=1)f[g].m(t,null);w(t,r);for(let g=0;g<d.length;g+=1)d[g].m(t,null);i=!0,s||(o=Q(window,"keydown",e[8]),s=!0)},p(m,[b]){if(b&10){a=m[1];let g;for(g=0;g<a.length;g+=1){let O=e1(m,a,g);u[g]?(u[g].p(O,b),P(u[g],1)):(u[g]=n1(O),u[g].c(),P(u[g],1),u[g].m(t,n))}for(ce(),g=a.length;g<u.length;g+=1)c(g);le()}if(b&230){l=m[1];let g;for(g=0;g<l.length;g+=1){let O=Zb(m,l,g);f[g]?(f[g].p(O,b),P(f[g],1)):(f[g]=r1(O),f[g].c(),P(f[g],1),f[g].m(t,r))}for(ce(),g=l.length;g<f.length;g+=1)p(g);le()}if(b&18){h=m[1];let g;for(g=0;g<h.length;g+=1){let O=Qb(m,h,g);d[g]?(d[g].p(O,b),P(d[g],1)):(d[g]=s1(O),d[g].c(),P(d[g],1),d[g].m(t,null))}for(ce(),g=h.length;g<d.length;g+=1)y(g);le()}b&4&&ie(t,"pinned",m[2])},i(m){if(!i){for(let b=0;b<a.length;b+=1)P(u[b]);for(let b=0;b<l.length;b+=1)P(f[b]);for(let b=0;b<h.length;b+=1)P(d[b]);i=!0}},o(m){u=u.filter(Boolean);for(let b=0;b<u.length;b+=1)x(u[b]);f=f.filter(Boolean);for(let b=0;b<f.length;b+=1)x(f[b]);d=d.filter(Boolean);for(let b=0;b<d.length;b+=1)x(d[b]);i=!1},d(m){m&&S(t),$e(u,m),$e(f,m),$e(d,m),s=!1,o()}}}function W3(e,t,n){let r,i=U,s=()=>(i(),i=Hi(o,j=>n(10,r=j)),o);e.$$.on_destroy.push(()=>i());let{client:o}=t;s();let{secondaryPane:a}=wn("secondaryPane"),u=Xn({game:o.game}),c=o.getInitialState(),{log:l}=r,f=null;function p(j){let N=c;for(let D=0;D<l.length;D++){let{action:J,automatic:fe}=l[D];if(!fe){if(N=u(N,J),j==0)break;j--}}return{G:N.G,ctx:N.ctx,plugins:N.plugins}}function h(j){let{logIndex:N}=j.detail,D=p(N),J=l.filter(fe=>!fe.automatic);if(o.overrideGameState(D),f==N)n(2,f=null),a.set(null);else{n(2,f=N);let{metadata:fe}=J[N].action.payload;fe&&a.set({component:zi,metadata:fe})}}function d(j){let{logIndex:N}=j.detail;if(f===null){let D=p(N);o.overrideGameState(D)}}function y(){f===null&&o.overrideGameState(null)}function m(){n(2,f=null),o.overrideGameState(null),a.set(null)}Cc(m);function b(j){j.keyCode==27&&m()}let g,O={},I={};return e.$$set=j=>{"client"in j&&s(n(0,o=j.client))},e.$$.update=()=>{if(e.$$.dirty&1538){n(9,l=r.log),n(1,g=l.filter(D=>!D.automatic));let j=0,N=0;n(3,O={}),n(4,I={});for(let D=0;D<g.length;D++){let{action:J,payload:fe,turn:V,phase:se}=g[D];N++,j++,(D==g.length-1||g[D+1].turn!=V)&&(n(3,O[D]=N,O),N=0),(D==g.length-1||g[D+1].phase!=se)&&(n(4,I[D]=j,I),j=0)}}},[o,g,f,O,I,h,d,y,b,l,r]}var kc=class extends Z{constructor(t){super(),te(this,t,W3,H3,ee,{client:0},K3)}};function J3(e){de(e,"svelte-1fu900w","label.svelte-1fu900w{color:#666}.option.svelte-1fu900w{margin-bottom:20px}.value.svelte-1fu900w{font-weight:bold;color:#000}input[type='checkbox'].svelte-1fu900w{vertical-align:middle}")}function o1(e,t,n){let r=e.slice();return r[6]=t[n][0],r[7]=t[n][1],r[8]=t,r[9]=n,r}function Y3(e){let t,n,r,i;function s(){e[5].call(t,e[6])}return{c(){t=A("input"),k(t,"id",n=e[3](e[6])),k(t,"type","checkbox"),k(t,"class","svelte-1fu900w")},m(o,a){M(o,t,a),t.checked=e[1][e[6]],r||(i=[Q(t,"change",s),Q(t,"change",e[2])],r=!0)},p(o,a){e=o,a&1&&n!==(n=e[3](e[6]))&&k(t,"id",n),a&3&&(t.checked=e[1][e[6]])},d(o){o&&S(t),r=!1,Le(i)}}}function $3(e){let t,n=e[1][e[6]]+"",r,i,s,o,a,u,c,l;function f(){e[4].call(s,e[6])}return{c(){t=A("span"),r=Y(n),i=q(),s=A("input"),k(t,"class","value svelte-1fu900w"),k(s,"id",o=e[3](e[6])),k(s,"type","range"),k(s,"min",a=e[7].range.min),k(s,"max",u=e[7].range.max)},m(p,h){M(p,t,h),w(t,r),M(p,i,h),M(p,s,h),hb(s,e[1][e[6]]),c||(l=[Q(s,"change",f),Q(s,"input",f),Q(s,"change",e[2])],c=!0)},p(p,h){e=p,h&3&&n!==(n=e[1][e[6]]+"")&&ae(r,n),h&1&&o!==(o=e[3](e[6]))&&k(s,"id",o),h&1&&a!==(a=e[7].range.min)&&k(s,"min",a),h&1&&u!==(u=e[7].range.max)&&k(s,"max",u),h&3&&hb(s,e[1][e[6]])},d(p){p&&S(t),p&&S(i),p&&S(s),c=!1,Le(l)}}}function a1(e){let t,n,r=e[6]+"",i,s,o,a;function u(f,p){if(f[7].range)return $3;if(typeof f[7].value=="boolean")return Y3}let c=u(e),l=c&&c(e);return{c(){t=A("div"),n=A("label"),i=Y(r),o=q(),l&&l.c(),a=q(),k(n,"for",s=e[3](e[6])),k(n,"class","svelte-1fu900w"),k(t,"class","option svelte-1fu900w")},m(f,p){M(f,t,p),w(t,n),w(n,i),w(t,o),l&&l.m(t,null),w(t,a)},p(f,p){p&1&&r!==(r=f[6]+"")&&ae(i,r),p&1&&s!==(s=f[3](f[6]))&&k(n,"for",s),c===(c=u(f))&&l?l.p(f,p):(l&&l.d(1),l=c&&c(f),l&&(l.c(),l.m(t,a)))},d(f){f&&S(t),l&&l.d()}}}function X3(e){let t,n=Object.entries(e[0].opts()),r=[];for(let i=0;i<n.length;i+=1)r[i]=a1(o1(e,n,i));return{c(){for(let i=0;i<r.length;i+=1)r[i].c();t=at()},m(i,s){for(let o=0;o<r.length;o+=1)r[o].m(i,s);M(i,t,s)},p(i,[s]){if(s&15){n=Object.entries(i[0].opts());let o;for(o=0;o<n.length;o+=1){let a=o1(i,n,o);r[o]?r[o].p(a,s):(r[o]=a1(a),r[o].c(),r[o].m(t.parentNode,t))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},i:U,o:U,d(i){$e(r,i),i&&S(t)}}}function Q3(e,t,n){let{bot:r}=t,i={};for(let[c,l]of Object.entries(r.opts()))i[c]=l.value;function s(){for(let[c,l]of Object.entries(i))r.setOpt(c,l)}let o=c=>"ai-option-"+c;function a(c){i[c]=DC(this.value),n(1,i)}function u(c){i[c]=this.checked,n(1,i)}return e.$$set=c=>{"bot"in c&&n(0,r=c.bot)},[r,i,s,o,a,u]}var Ac=class extends Z{constructor(t){super(),te(this,t,Q3,X3,ee,{bot:0},J3)}};function Z3(e){de(e,"svelte-fn09gm","ul.svelte-fn09gm{padding-left:0}li.svelte-fn09gm{list-style:none;margin:0;margin-bottom:5px}h3.svelte-fn09gm{text-transform:uppercase}label.svelte-fn09gm{color:#666}input[type='checkbox'].svelte-fn09gm{vertical-align:middle}")}function u1(e,t,n){let r=e.slice();return r[7]=t[n],r}function ej(e){let t,n,r;return{c(){t=A("p"),t.textContent="No bots available.",n=q(),r=A("p"),r.innerHTML=`Follow the instructions
|
|
29
|
+
<th class="svelte-ztcwsu">Action</th>`,r=N(),i=S("tbody");for(let c=0;c<a.length;c+=1)a[c].c();O(t,"class","svelte-ztcwsu")},m(c,l){M(c,t,l),_(t,n),_(t,r),_(t,i);for(let f=0;f<a.length;f+=1)a[f].m(i,null);s=!0},p(c,[l]){if(l&15){o=c[1];let f;for(f=0;f<o.length;f+=1){let p=Hb(c,o,f);a[f]?(a[f].p(p,l),P(a[f],1)):(a[f]=Wb(p),a[f].c(),P(a[f],1),a[f].m(i,null))}for(ce(),f=o.length;f<a.length;f+=1)u(f);le()}},i(c){if(!s){for(let l=0;l<o.length;l+=1)P(a[l]);s=!0}},o(c){a=a.filter(Boolean);for(let l=0;l<a.length;l+=1)A(a[l]);s=!1},d(c){c&&x(t),Xe(a,c)}}}function Rj(e,t,n){let{root:r}=t,{selectedIndex:i=null}=t,s=Yi(),o=[],a=[];function u(d,h){s("select",{node:d,selectedIndex:h})}function c(d,h){i===null&&s("preview",{node:d})}let l=(d,h)=>u(d,h),f=d=>c(null),p=(d,h)=>c(d);return e.$$set=d=>{"root"in d&&n(4,r=d.root),"selectedIndex"in d&&n(0,i=d.selectedIndex)},e.$$.update=()=>{if(e.$$.dirty&48){let d=r;for(n(5,o=[]);d.parent;){let h=d.parent,{type:y,args:m}=d.parentAction.payload,b=(m||[]).join(","),g=`${y}(${b})`;o.push({parent:h,arrowText:g}),d=h}o.reverse(),n(1,a=[...r.children].sort((h,y)=>h.visits<y.visits?1:-1).slice(0,50))}},[i,a,u,c,r,o,l,f,p]}var zi=class extends Z{constructor(t){super(),te(this,t,Rj,Cj,ee,{root:4,selectedIndex:0},Ij)}};function Nj(e){de(e,"svelte-1f0amz4",".visualizer.svelte-1f0amz4{display:flex;flex-direction:column;align-items:center;padding:50px}.preview.svelte-1f0amz4{opacity:0.5}.icon.svelte-1f0amz4{color:#777;width:32px;height:32px;margin-bottom:20px}")}function Jb(e,t,n){let r=e.slice();return r[9]=t[n].node,r[10]=t[n].selectedIndex,r[12]=n,r}function jj(e){let t,n,r;return n=new Po({}),{c(){t=S("div"),G(n.$$.fragment),O(t,"class","icon svelte-1f0amz4")},m(i,s){M(i,t,s),D(n,t,null),r=!0},i(i){r||(P(n.$$.fragment,i),r=!0)},o(i){A(n.$$.fragment,i),r=!1},d(i){i&&x(t),B(n)}}}function qj(e){let t,n;function r(...i){return e[7](e[12],...i)}return t=new zi({props:{root:e[9],selectedIndex:e[10]}}),t.$on("select",r),{c(){G(t.$$.fragment)},m(i,s){D(t,i,s),n=!0},p(i,s){e=i;let o={};s&1&&(o.root=e[9]),s&1&&(o.selectedIndex=e[10]),t.$set(o)},i(i){n||(P(t.$$.fragment,i),n=!0)},o(i){A(t.$$.fragment,i),n=!1},d(i){B(t,i)}}}function Dj(e){let t,n;function r(...s){return e[5](e[12],...s)}function i(...s){return e[6](e[12],...s)}return t=new zi({props:{root:e[9]}}),t.$on("select",r),t.$on("preview",i),{c(){G(t.$$.fragment)},m(s,o){D(t,s,o),n=!0},p(s,o){e=s;let a={};o&1&&(a.root=e[9]),t.$set(a)},i(s){n||(P(t.$$.fragment,s),n=!0)},o(s){A(t.$$.fragment,s),n=!1},d(s){B(t,s)}}}function Yb(e){let t,n,r,i,s,o=e[12]!==0&&jj(),a=[Dj,qj],u=[];function c(l,f){return l[12]===l[0].length-1?0:1}return r=c(e),i=u[r]=a[r](e),{c(){o&&o.c(),t=N(),n=S("section"),i.c()},m(l,f){o&&o.m(l,f),M(l,t,f),M(l,n,f),u[r].m(n,null),s=!0},p(l,f){let p=r;r=c(l),r===p?u[r].p(l,f):(ce(),A(u[p],1,1,()=>{u[p]=null}),le(),i=u[r],i?i.p(l,f):(i=u[r]=a[r](l),i.c()),P(i,1),i.m(n,null))},i(l){s||(P(o),P(i),s=!0)},o(l){A(o),A(i),s=!1},d(l){o&&o.d(l),l&&x(t),l&&x(n),u[r].d()}}}function $b(e){let t,n,r,i,s,o;return n=new Po({}),s=new zi({props:{root:e[1]}}),{c(){t=S("div"),G(n.$$.fragment),r=N(),i=S("section"),G(s.$$.fragment),O(t,"class","icon svelte-1f0amz4"),O(i,"class","preview svelte-1f0amz4")},m(a,u){M(a,t,u),D(n,t,null),M(a,r,u),M(a,i,u),D(s,i,null),o=!0},p(a,u){let c={};u&2&&(c.root=a[1]),s.$set(c)},i(a){o||(P(n.$$.fragment,a),P(s.$$.fragment,a),o=!0)},o(a){A(n.$$.fragment,a),A(s.$$.fragment,a),o=!1},d(a){a&&x(t),B(n),a&&x(r),a&&x(i),B(s)}}}function Bj(e){let t,n,r,i=e[0],s=[];for(let u=0;u<i.length;u+=1)s[u]=Yb(Jb(e,i,u));let o=u=>A(s[u],1,1,()=>{s[u]=null}),a=e[1]&&$b(e);return{c(){t=S("div");for(let u=0;u<s.length;u+=1)s[u].c();n=N(),a&&a.c(),O(t,"class","visualizer svelte-1f0amz4")},m(u,c){M(u,t,c);for(let l=0;l<s.length;l+=1)s[l].m(t,null);_(t,n),a&&a.m(t,null),r=!0},p(u,[c]){if(c&13){i=u[0];let l;for(l=0;l<i.length;l+=1){let f=Jb(u,i,l);s[l]?(s[l].p(f,c),P(s[l],1)):(s[l]=Yb(f),s[l].c(),P(s[l],1),s[l].m(t,n))}for(ce(),l=i.length;l<s.length;l+=1)o(l);le()}u[1]?a?(a.p(u,c),c&2&&P(a,1)):(a=$b(u),a.c(),P(a,1),a.m(t,null)):a&&(ce(),A(a,1,1,()=>{a=null}),le())},i(u){if(!r){for(let c=0;c<i.length;c+=1)P(s[c]);P(a),r=!0}},o(u){s=s.filter(Boolean);for(let c=0;c<s.length;c+=1)A(s[c]);A(a),r=!1},d(u){u&&x(t),Xe(s,u),a&&a.d()}}}function Gj(e,t,n){let{metadata:r}=t,i=[],s=null;function o({node:f,selectedIndex:p},d){n(1,s=null),n(0,i[d].selectedIndex=p,i),n(0,i=[...i.slice(0,d+1),{node:f}])}function a({node:f},p){n(1,s=f)}let u=(f,p)=>o(p.detail,f),c=(f,p)=>a(p.detail),l=(f,p)=>o(p.detail,f);return e.$$set=f=>{"metadata"in f&&n(4,r=f.metadata)},e.$$.update=()=>{e.$$.dirty&16&&n(0,i=[{node:r}])},[i,s,o,a,r,u,c,l]}var Ki=class extends Z{constructor(t){super(),te(this,t,Gj,Bj,ee,{metadata:4},Nj)}};function Lj(e){de(e,"svelte-1pq5e4b",".gamelog.svelte-1pq5e4b{display:grid;grid-template-columns:30px 1fr 30px;grid-auto-rows:auto;grid-auto-flow:column}")}function Xb(e,t,n){let r=e.slice();return r[16]=t[n].phase,r[18]=n,r}function Qb(e,t,n){let r=e.slice();return r[19]=t[n].action,r[20]=t[n].metadata,r[18]=n,r}function Zb(e,t,n){let r=e.slice();return r[22]=t[n].turn,r[18]=n,r}function ew(e){let t,n;return t=new wc({props:{turn:e[22],numEvents:e[3][e[18]]}}),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,i){let s={};i&2&&(s.turn=r[22]),i&8&&(s.numEvents=r[3][r[18]]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function tw(e){let t,n,r=e[18]in e[3]&&ew(e);return{c(){r&&r.c(),t=ut()},m(i,s){r&&r.m(i,s),M(i,t,s),n=!0},p(i,s){i[18]in i[3]?r?(r.p(i,s),s&8&&P(r,1)):(r=ew(i),r.c(),P(r,1),r.m(t.parentNode,t)):r&&(ce(),A(r,1,1,()=>{r=null}),le())},i(i){n||(P(r),n=!0)},o(i){A(r),n=!1},d(i){r&&r.d(i),i&&x(t)}}}function nw(e){let t,n;return t=new Pc({props:{pinned:e[18]===e[2],logIndex:e[18],action:e[19],metadata:e[20]}}),t.$on("click",e[5]),t.$on("mouseenter",e[6]),t.$on("mouseleave",e[7]),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,i){let s={};i&4&&(s.pinned=r[18]===r[2]),i&2&&(s.action=r[19]),i&2&&(s.metadata=r[20]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function rw(e){let t,n;return t=new _c({props:{phase:e[16],numEvents:e[4][e[18]]}}),{c(){G(t.$$.fragment)},m(r,i){D(t,r,i),n=!0},p(r,i){let s={};i&2&&(s.phase=r[16]),i&16&&(s.numEvents=r[4][r[18]]),t.$set(s)},i(r){n||(P(t.$$.fragment,r),n=!0)},o(r){A(t.$$.fragment,r),n=!1},d(r){B(t,r)}}}function iw(e){let t,n,r=e[18]in e[4]&&rw(e);return{c(){r&&r.c(),t=ut()},m(i,s){r&&r.m(i,s),M(i,t,s),n=!0},p(i,s){i[18]in i[4]?r?(r.p(i,s),s&16&&P(r,1)):(r=rw(i),r.c(),P(r,1),r.m(t.parentNode,t)):r&&(ce(),A(r,1,1,()=>{r=null}),le())},i(i){n||(P(r),n=!0)},o(i){A(r),n=!1},d(i){r&&r.d(i),i&&x(t)}}}function Fj(e){let t,n,r,i,s,o,a=e[1],u=[];for(let m=0;m<a.length;m+=1)u[m]=tw(Zb(e,a,m));let c=m=>A(u[m],1,1,()=>{u[m]=null}),l=e[1],f=[];for(let m=0;m<l.length;m+=1)f[m]=nw(Qb(e,l,m));let p=m=>A(f[m],1,1,()=>{f[m]=null}),d=e[1],h=[];for(let m=0;m<d.length;m+=1)h[m]=iw(Xb(e,d,m));let y=m=>A(h[m],1,1,()=>{h[m]=null});return{c(){t=S("div");for(let m=0;m<u.length;m+=1)u[m].c();n=N();for(let m=0;m<f.length;m+=1)f[m].c();r=N();for(let m=0;m<h.length;m+=1)h[m].c();O(t,"class","gamelog svelte-1pq5e4b"),ie(t,"pinned",e[2])},m(m,b){M(m,t,b);for(let g=0;g<u.length;g+=1)u[g].m(t,null);_(t,n);for(let g=0;g<f.length;g+=1)f[g].m(t,null);_(t,r);for(let g=0;g<h.length;g+=1)h[g].m(t,null);i=!0,s||(o=Q(window,"keydown",e[8]),s=!0)},p(m,[b]){if(b&10){a=m[1];let g;for(g=0;g<a.length;g+=1){let k=Zb(m,a,g);u[g]?(u[g].p(k,b),P(u[g],1)):(u[g]=tw(k),u[g].c(),P(u[g],1),u[g].m(t,n))}for(ce(),g=a.length;g<u.length;g+=1)c(g);le()}if(b&230){l=m[1];let g;for(g=0;g<l.length;g+=1){let k=Qb(m,l,g);f[g]?(f[g].p(k,b),P(f[g],1)):(f[g]=nw(k),f[g].c(),P(f[g],1),f[g].m(t,r))}for(ce(),g=l.length;g<f.length;g+=1)p(g);le()}if(b&18){d=m[1];let g;for(g=0;g<d.length;g+=1){let k=Xb(m,d,g);h[g]?(h[g].p(k,b),P(h[g],1)):(h[g]=iw(k),h[g].c(),P(h[g],1),h[g].m(t,null))}for(ce(),g=d.length;g<h.length;g+=1)y(g);le()}b&4&&ie(t,"pinned",m[2])},i(m){if(!i){for(let b=0;b<a.length;b+=1)P(u[b]);for(let b=0;b<l.length;b+=1)P(f[b]);for(let b=0;b<d.length;b+=1)P(h[b]);i=!0}},o(m){u=u.filter(Boolean);for(let b=0;b<u.length;b+=1)A(u[b]);f=f.filter(Boolean);for(let b=0;b<f.length;b+=1)A(f[b]);h=h.filter(Boolean);for(let b=0;b<h.length;b+=1)A(h[b]);i=!1},d(m){m&&x(t),Xe(u,m),Xe(f,m),Xe(h,m),s=!1,o()}}}function Uj(e,t,n){let r,i=U,s=()=>(i(),i=Wi(o,j=>n(10,r=j)),o);e.$$.on_destroy.push(()=>i());let{client:o}=t;s();let{secondaryPane:a}=kn("secondaryPane"),u=Qn({game:o.game}),c=o.getInitialState(),{log:l}=r,f=null;function p(j){let C=c;for(let q=0;q<l.length;q++){let{action:J,automatic:fe}=l[q];if(!fe){if(C=u(C,J),j==0)break;j--}}return{G:C.G,ctx:C.ctx,plugins:C.plugins}}function d(j){let{logIndex:C}=j.detail,q=p(C),J=l.filter(fe=>!fe.automatic);if(o.overrideGameState(q),f==C)n(2,f=null),a.set(null);else{n(2,f=C);let{metadata:fe}=J[C].action.payload;fe&&a.set({component:Ki,metadata:fe})}}function h(j){let{logIndex:C}=j.detail;if(f===null){let q=p(C);o.overrideGameState(q)}}function y(){f===null&&o.overrideGameState(null)}function m(){n(2,f=null),o.overrideGameState(null),a.set(null)}Rc(m);function b(j){j.keyCode==27&&m()}let g,k={},I={};return e.$$set=j=>{"client"in j&&s(n(0,o=j.client))},e.$$.update=()=>{if(e.$$.dirty&1538){n(9,l=r.log),n(1,g=l.filter(q=>!q.automatic));let j=0,C=0;n(3,k={}),n(4,I={});for(let q=0;q<g.length;q++){let{action:J,payload:fe,turn:V,phase:se}=g[q];C++,j++,(q==g.length-1||g[q+1].turn!=V)&&(n(3,k[q]=C,k),C=0),(q==g.length-1||g[q+1].phase!=se)&&(n(4,I[q]=j,I),j=0)}}},[o,g,f,k,I,d,h,y,b,l,r]}var Oc=class extends Z{constructor(t){super(),te(this,t,Uj,Fj,ee,{client:0},Lj)}};function Vj(e){de(e,"svelte-1fu900w","label.svelte-1fu900w{color:#666}.option.svelte-1fu900w{margin-bottom:20px}.value.svelte-1fu900w{font-weight:bold;color:#000}input[type='checkbox'].svelte-1fu900w{vertical-align:middle}")}function sw(e,t,n){let r=e.slice();return r[6]=t[n][0],r[7]=t[n][1],r[8]=t,r[9]=n,r}function zj(e){let t,n,r,i;function s(){e[5].call(t,e[6])}return{c(){t=S("input"),O(t,"id",n=e[3](e[6])),O(t,"type","checkbox"),O(t,"class","svelte-1fu900w")},m(o,a){M(o,t,a),t.checked=e[1][e[6]],r||(i=[Q(t,"change",s),Q(t,"change",e[2])],r=!0)},p(o,a){e=o,a&1&&n!==(n=e[3](e[6]))&&O(t,"id",n),a&3&&(t.checked=e[1][e[6]])},d(o){o&&x(t),r=!1,Ge(i)}}}function Kj(e){let t,n=e[1][e[6]]+"",r,i,s,o,a,u,c,l;function f(){e[4].call(s,e[6])}return{c(){t=S("span"),r=Y(n),i=N(),s=S("input"),O(t,"class","value svelte-1fu900w"),O(s,"id",o=e[3](e[6])),O(s,"type","range"),O(s,"min",a=e[7].range.min),O(s,"max",u=e[7].range.max)},m(p,d){M(p,t,d),_(t,r),M(p,i,d),M(p,s,d),pb(s,e[1][e[6]]),c||(l=[Q(s,"change",f),Q(s,"input",f),Q(s,"change",e[2])],c=!0)},p(p,d){e=p,d&3&&n!==(n=e[1][e[6]]+"")&&ae(r,n),d&1&&o!==(o=e[3](e[6]))&&O(s,"id",o),d&1&&a!==(a=e[7].range.min)&&O(s,"min",a),d&1&&u!==(u=e[7].range.max)&&O(s,"max",u),d&3&&pb(s,e[1][e[6]])},d(p){p&&x(t),p&&x(i),p&&x(s),c=!1,Ge(l)}}}function ow(e){let t,n,r=e[6]+"",i,s,o,a;function u(f,p){if(f[7].range)return Kj;if(typeof f[7].value=="boolean")return zj}let c=u(e),l=c&&c(e);return{c(){t=S("div"),n=S("label"),i=Y(r),o=N(),l&&l.c(),a=N(),O(n,"for",s=e[3](e[6])),O(n,"class","svelte-1fu900w"),O(t,"class","option svelte-1fu900w")},m(f,p){M(f,t,p),_(t,n),_(n,i),_(t,o),l&&l.m(t,null),_(t,a)},p(f,p){p&1&&r!==(r=f[6]+"")&&ae(i,r),p&1&&s!==(s=f[3](f[6]))&&O(n,"for",s),c===(c=u(f))&&l?l.p(f,p):(l&&l.d(1),l=c&&c(f),l&&(l.c(),l.m(t,a)))},d(f){f&&x(t),l&&l.d()}}}function Hj(e){let t,n=Object.entries(e[0].opts()),r=[];for(let i=0;i<n.length;i+=1)r[i]=ow(sw(e,n,i));return{c(){for(let i=0;i<r.length;i+=1)r[i].c();t=ut()},m(i,s){for(let o=0;o<r.length;o+=1)r[o].m(i,s);M(i,t,s)},p(i,[s]){if(s&15){n=Object.entries(i[0].opts());let o;for(o=0;o<n.length;o+=1){let a=sw(i,n,o);r[o]?r[o].p(a,s):(r[o]=ow(a),r[o].c(),r[o].m(t.parentNode,t))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},i:U,o:U,d(i){Xe(r,i),i&&x(t)}}}function Wj(e,t,n){let{bot:r}=t,i={};for(let[c,l]of Object.entries(r.opts()))i[c]=l.value;function s(){for(let[c,l]of Object.entries(i))r.setOpt(c,l)}let o=c=>"ai-option-"+c;function a(c){i[c]=IN(this.value),n(1,i)}function u(c){i[c]=this.checked,n(1,i)}return e.$$set=c=>{"bot"in c&&n(0,r=c.bot)},[r,i,s,o,a,u]}var Sc=class extends Z{constructor(t){super(),te(this,t,Wj,Hj,ee,{bot:0},Vj)}};function Jj(e){de(e,"svelte-fn09gm","ul.svelte-fn09gm{padding-left:0}li.svelte-fn09gm{list-style:none;margin:0;margin-bottom:5px}h3.svelte-fn09gm{text-transform:uppercase}label.svelte-fn09gm{color:#666}input[type='checkbox'].svelte-fn09gm{vertical-align:middle}")}function aw(e,t,n){let r=e.slice();return r[7]=t[n],r}function Yj(e){let t,n,r;return{c(){t=S("p"),t.textContent="No bots available.",n=N(),r=S("p"),r.innerHTML=`Follow the instructions
|
|
30
30
|
<a href="https://boardgame.io/documentation/#/tutorial?id=bots" target="_blank">here</a>
|
|
31
|
-
to set up bots.`},m(i,s){M(i,t,s),M(i,n,s),M(i,r,s)},p:U,i:U,o:U,d(i){i&&
|
|
32
|
-
normal forwards}.closer.svelte-8ymctk .icon.svelte-8ymctk{animation-direction:reverse}.pane.svelte-8ymctk.svelte-8ymctk{flex-grow:2;overflow-x:hidden;overflow-y:scroll;background:#fefefe;padding:20px;border-left:1px solid #ccc;box-shadow:-1px 0 5px rgba(0, 0, 0, 0.2);box-sizing:border-box;width:280px}.secondary-pane.svelte-8ymctk.svelte-8ymctk{background:#fefefe;overflow-y:scroll}.debug-panel.svelte-8ymctk button,.debug-panel.svelte-8ymctk select{cursor:pointer;font-size:14px;font-family:monospace}.debug-panel.svelte-8ymctk select{background:#eee;border:1px solid #bbb;color:#555;padding:3px;border-radius:3px}.debug-panel.svelte-8ymctk section{margin-bottom:20px}.debug-panel.svelte-8ymctk .screen-reader-only{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}`)}function oj(e){let t,n,r,i,s,o,a,u,c,l=e[10]&&uj(e);r=new sc({props:{panes:e[6],pane:e[2]}}),r.$on("change",e[8]);var f=e[6][e[2]].component;function p(d){return{props:{client:d[4],clientManager:d[0],ToggleVisibility:d[9]}}}f&&(o=new f(p(e)));let h=e[5]&&d1(e);return{c(){t=A("div"),l&&l.c(),n=q(),L(r.$$.fragment),i=q(),s=A("div"),o&&L(o.$$.fragment),a=q(),h&&h.c(),k(s,"class","pane svelte-8ymctk"),k(s,"role","region"),k(s,"aria-label",e[2]),k(s,"tabindex","-1"),k(t,"class","panel svelte-8ymctk")},m(d,y){M(d,t,y),l&&l.m(t,null),w(t,n),R(r,t,null),w(t,i),w(t,s),o&&R(o,s,null),e[16](s),w(t,a),h&&h.m(t,null),c=!0},p(d,y){e=d,e[10]&&l.p(e,y);let m={};y&4&&(m.pane=e[2]),r.$set(m);let b={};if(y&16&&(b.client=e[4]),y&1&&(b.clientManager=e[0]),f!==(f=e[6][e[2]].component)){if(o){ce();let g=o;x(g.$$.fragment,1,0,()=>{B(g,1)}),le()}f?(o=new f(p(e)),L(o.$$.fragment),P(o.$$.fragment,1),R(o,s,null)):o=null}else f&&o.$set(b);(!c||y&4)&&k(s,"aria-label",e[2]),e[5]?h?(h.p(e,y),y&32&&P(h,1)):(h=d1(e),h.c(),P(h,1),h.m(t,null)):h&&(ce(),x(h,1,1,()=>{h=null}),le())},i(d){c||(P(l),P(r.$$.fragment,d),o&&P(o.$$.fragment,d),P(h),ot(()=>{u||(u=mb(t,yb,{x:400,...e[12]},!0)),u.run(1)}),c=!0)},o(d){x(l),x(r.$$.fragment,d),o&&x(o.$$.fragment,d),x(h),u||(u=mb(t,yb,{x:400,...e[12]},!1)),u.run(0),c=!1},d(d){d&&S(t),l&&l.d(),B(r),o&&B(o),e[16](null),h&&h.d(),d&&u&&u.end()}}}function aj(e){let t,n,r=e[10]&&cj(e);return{c(){r&&r.c(),t=at()},m(i,s){r&&r.m(i,s),M(i,t,s),n=!0},p(i,s){i[10]&&r.p(i,s)},i(i){n||(P(r),n=!0)},o(i){x(r),n=!1},d(i){r&&r.d(i),i&&S(t)}}}function uj(e){let t,n,r,i,s,o,a,u;return r=new bo({}),{c(){t=A("button"),n=A("span"),L(r.$$.fragment),k(n,"class","icon svelte-8ymctk"),k(n,"aria-hidden","true"),k(t,"class","visibility-toggle closer svelte-8ymctk"),k(t,"title","Hide Debug Panel")},m(c,l){M(c,t,l),w(t,n),R(r,n,null),o=!0,a||(u=Q(t,"click",e[9]),a=!0)},p:U,i(c){o||(P(r.$$.fragment,c),ot(()=>{s&&s.end(1),i=k1(t,e[14],{key:"toggle"}),i.start()}),o=!0)},o(c){x(r.$$.fragment,c),i&&i.invalidate(),s=A1(t,e[13],{key:"toggle"}),o=!1},d(c){c&&S(t),B(r),c&&s&&s.end(),a=!1,u()}}}function d1(e){let t,n,r;var i=e[5].component;function s(o){return{props:{metadata:o[5].metadata}}}return i&&(n=new i(s(e))),{c(){t=A("div"),n&&L(n.$$.fragment),k(t,"class","secondary-pane svelte-8ymctk")},m(o,a){M(o,t,a),n&&R(n,t,null),r=!0},p(o,a){let u={};if(a&32&&(u.metadata=o[5].metadata),i!==(i=o[5].component)){if(n){ce();let c=n;x(c.$$.fragment,1,0,()=>{B(c,1)}),le()}i?(n=new i(s(o)),L(n.$$.fragment),P(n.$$.fragment,1),R(n,t,null)):n=null}else i&&n.$set(u)},i(o){r||(n&&P(n.$$.fragment,o),r=!0)},o(o){n&&x(n.$$.fragment,o),r=!1},d(o){o&&S(t),n&&B(n)}}}function cj(e){let t,n,r,i,s,o,a,u;return r=new bo({}),{c(){t=A("button"),n=A("span"),L(r.$$.fragment),k(n,"class","icon svelte-8ymctk"),k(n,"aria-hidden","true"),k(t,"class","visibility-toggle opener svelte-8ymctk"),k(t,"title","Show Debug Panel")},m(c,l){M(c,t,l),w(t,n),R(r,n,null),o=!0,a||(u=Q(t,"click",e[9]),a=!0)},p:U,i(c){o||(P(r.$$.fragment,c),ot(()=>{s&&s.end(1),i=k1(t,e[14],{key:"toggle"}),i.start()}),o=!0)},o(c){x(r.$$.fragment,c),i&&i.invalidate(),s=A1(t,e[13],{key:"toggle"}),o=!1},d(c){c&&S(t),B(r),c&&s&&s.end(),a=!1,u()}}}function lj(e){let t,n,r,i,s,o,a=[aj,oj],u=[];function c(l,f){return l[3]?1:0}return n=c(e),r=u[n]=a[n](e),{c(){t=A("section"),r.c(),k(t,"aria-label","boardgame.io Debug Panel"),k(t,"class","debug-panel svelte-8ymctk")},m(l,f){M(l,t,f),u[n].m(t,null),i=!0,s||(o=Q(window,"keypress",e[11]),s=!0)},p(l,[f]){let p=n;n=c(l),n===p?u[n].p(l,f):(ce(),x(u[p],1,1,()=>{u[p]=null}),le(),r=u[n],r?r.p(l,f):(r=u[n]=a[n](l),r.c()),P(r,1),r.m(t,null))},i(l){i||(P(r),i=!0)},o(l){x(r),i=!1},d(l){l&&S(t),u[n].d(),s=!1,o()}}}function fj(e,t,n){let r,i,s=U,o=()=>(s(),s=Hi(u,J=>n(15,i=J)),u),a;e.$$.on_destroy.push(()=>s());let{clientManager:u}=t;o();let c={main:{label:"Main",shortcut:"m",component:vc},log:{label:"Log",shortcut:"l",component:kc},info:{label:"Info",shortcut:"i",component:bc},ai:{label:"AI",shortcut:"a",component:xc}},l=gb(!1),f=gb(null);g1(e,f,J=>n(5,a=J)),Fi("hotkeys",{disableHotkeys:l}),Fi("secondaryPane",{secondaryPane:f});let p,h="main";function d(J){n(2,h=J.detail),p.focus()}function y(){n(3,b=!b)}let m=i.client.debugOpt,b=!m||!m.collapseOnLoad,g=!m||!m.hideToggleButton;function O(J){if(J.key=="."){y();return}b&&Object.entries(c).forEach(([fe,{shortcut:V}])=>{J.key==V&&n(2,h=fe)})}let I={duration:150,easing:Dc},[j,N]=WC(I);function D(J){yo[J?"unshift":"push"](()=>{p=J,n(1,p)})}return e.$$set=J=>{"clientManager"in J&&o(n(0,u=J.clientManager))},e.$$.update=()=>{e.$$.dirty&32768&&n(4,r=i.client)},[u,p,h,b,r,a,c,f,d,y,g,O,I,j,N,i,D]}var Ki=class extends Z{constructor(t){super(),te(this,t,fj,lj,ee,{clientManager:0},sj)}};function On(e){"@babel/helpers - typeof";return On=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},On(e)}function M1(e,t){if(On(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(On(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function I1(e){var t=M1(e,"string");return On(t)=="symbol"?t:t+""}function N1(e,t,n){return(t=I1(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function C1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Rc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?C1(Object(n),!0).forEach(function(r){N1(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C1(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Xe(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var q1=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Bc=function(){return Math.random().toString(36).substring(7).split("").join(".")},j1={INIT:"@@redux/INIT"+Bc(),REPLACE:"@@redux/REPLACE"+Bc(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Bc()}};function pj(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Lc(e,t,n){var r;if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Xe(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Xe(1));return n(Lc)(e,t)}if(typeof e!="function")throw new Error(Xe(2));var i=e,s=t,o=[],a=o,u=!1;function c(){a===o&&(a=o.slice())}function l(){if(u)throw new Error(Xe(3));return s}function f(y){if(typeof y!="function")throw new Error(Xe(4));if(u)throw new Error(Xe(5));var m=!0;return c(),a.push(y),function(){if(m){if(u)throw new Error(Xe(6));m=!1,c();var g=a.indexOf(y);a.splice(g,1),o=null}}}function p(y){if(!pj(y))throw new Error(Xe(7));if(typeof y.type>"u")throw new Error(Xe(8));if(u)throw new Error(Xe(9));try{u=!0,s=i(s,y)}finally{u=!1}for(var m=o=a,b=0;b<m.length;b++){var g=m[b];g()}return y}function h(y){if(typeof y!="function")throw new Error(Xe(10));i=y,p({type:j1.REPLACE})}function d(){var y,m=f;return y={subscribe:function(g){if(typeof g!="object"||g===null)throw new Error(Xe(11));function O(){g.next&&g.next(l())}O();var I=m(O);return{unsubscribe:I}}},y[q1]=function(){return this},y}return p({type:j1.INIT}),r={dispatch:p,subscribe:f,getState:l,replaceReducer:h},r[q1]=d,r}function Gc(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.length===0?function(r){return r}:t.length===1?t[0]:t.reduce(function(r,i){return function(){return r(i.apply(void 0,arguments))}})}function D1(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return function(){var i=r.apply(void 0,arguments),s=function(){throw new Error(Xe(15))},o={getState:i.getState,dispatch:function(){return s.apply(void 0,arguments)}},a=t.map(function(u){return u(o)});return s=Gc.apply(void 0,a)(i.dispatch),Rc(Rc({},i),{},{dispatch:s})}}}function R1({game:e,numPlayers:t,setupData:n}){e=ji(e),t||(t=2);let r=e.flow.ctx(t),i={G:{},ctx:r,plugins:{}};i=Nv(i,{game:e}),i=Ti(i,{game:e,playerID:void 0});let s=Wt(i);i.G=e.setup({...s,ctx:i.ctx},n);let o={...i,_undo:[],_redo:[],_stateID:0};return o=e.flow.init(o),[o]=eo(o,{game:e}),e.disableUndo||(o._undo=[{G:o.G,ctx:o.ctx,plugins:o.plugins}]),o}var ir=class{constructor({transportDataCallback:t,gameName:n,playerID:r,matchID:i,credentials:s,numPlayers:o}){this.connectionStatusCallback=()=>{},this.isConnected=!1,this.transportDataCallback=t,this.gameName=n||"default",this.playerID=r||null,this.matchID=i||"default",this.credentials=s,this.numPlayers=o||2}subscribeToConnectionStatus(t){this.connectionStatusCallback=t}setConnectionStatus(t){this.isConnected=t,this.connectionStatusCallback()}notifyClient(t){this.transportDataCallback(t)}};var Fc=class extends ir{connect(){}disconnect(){}sendAction(){}sendChatMessage(){}requestSync(){}updateCredentials(){}updateMatchID(){}updatePlayerID(){}},hj=e=>new Fc(e),Uc=class{constructor(){this.debugPanel=null,this.currentClient=null,this.clients=new Map,this.subscribers=new Map}register(t){this.clients.set(t,t),this.mountDebug(t),this.notifySubscribers()}unregister(t){if(this.clients.delete(t),this.currentClient===t){this.unmountDebug();for(let[n]of this.clients){if(this.debugPanel)break;this.mountDebug(n)}}this.notifySubscribers()}subscribe(t){let n=Symbol();return this.subscribers.set(n,t),t(this.getState()),()=>{this.subscribers.delete(n)}}switchPlayerID(t){if(this.currentClient.multiplayer){for(let[n]of this.clients)if(n.playerID===t&&n.debugOpt!==!1&&n.multiplayer===this.currentClient.multiplayer){this.switchToClient(n);return}}this.currentClient.updatePlayerID(t),this.notifySubscribers()}switchToClient(t){t!==this.currentClient&&(this.unmountDebug(),this.mountDebug(t),this.notifySubscribers())}notifySubscribers(){let t=this.getState();this.subscribers.forEach(n=>{n(t)})}getState(){return{client:this.currentClient,debuggableClients:this.getDebuggableClients()}}getDebuggableClients(){return[...this.clients.values()].filter(t=>t.debugOpt!==!1)}mountDebug(t){if(t.debugOpt===!1||this.debugPanel!==null||typeof document>"u")return;let n,r=document.body;t.debugOpt&&t.debugOpt!==!0&&(n=t.debugOpt.impl||n,r=t.debugOpt.target||r),n&&(this.currentClient=t,this.debugPanel=new n({target:r,props:{clientManager:this}}))}unmountDebug(){this.debugPanel.$destroy(),this.debugPanel=null,this.currentClient=null}},dj=new Uc;function Vc(e,t,n){return!n&&e==null&&(e=t.getState().ctx.currentPlayer),e}function Kc(e,t,n,r,i,s){let o={};for(let a of t)o[a]=(...u)=>{let c=Mv[e](a,u,Vc(r,n,s),i);n.dispatch(c)};return o}var mj=Kc.bind(null,"makeMove"),gj=Kc.bind(null,"gameEvent"),yj=Kc.bind(null,"plugin"),zc=class{constructor({game:t,debug:n,numPlayers:r,multiplayer:i,matchID:s,playerID:o,credentials:a,enhancer:u}){this.game=ji(t),this.playerID=o,this.matchID=s||"default",this.credentials=a,this.multiplayer=i,this.debugOpt=n,this.manager=dj,this.gameStateOverride=null,this.subscribers={},this._running=!1,this.reducer=Xn({game:this.game,isClient:i!==void 0}),this.initialState=null,i||(this.initialState=R1({game:this.game,numPlayers:r})),this.reset=()=>{this.store.dispatch(Nu(this.initialState))},this.undo=()=>{let h=Cu(Vc(this.playerID,this.store,this.multiplayer),this.credentials);this.store.dispatch(h)},this.redo=()=>{let h=qu(Vc(this.playerID,this.store,this.multiplayer),this.credentials);this.store.dispatch(h)},this.log=[];let p=D1(cb,()=>h=>d=>{let y=h(d);return this.notifySubscribers(),y},h=>d=>y=>{let m=h.getState(),b=d(y);return!("clientOnly"in y)&&y.type!==$n&&this.transport.sendAction(m,y),b},h=>d=>y=>{let m=d(y),b=h.getState();switch(y.type){case _i:case Yn:case Ei:case wi:{let g=b.deltalog;this.log=[...this.log,...g];break}case Oi:{this.log=[];break}case Ai:case ki:{let g=-1;this.log.length>0&&(g=this.log[this.log.length-1]._stateID);let O=y.deltalog||[];O=O.filter(I=>I._stateID>g),this.log=[...this.log,...O];break}case Pi:{this.initialState=y.initialState,this.log=y.log||[];break}}return m});u=u!==void 0?Gc(p,u):p,this.store=Lc(this.reducer,this.initialState,u),i||(i=hj),this.transport=i({transportDataCallback:h=>this.receiveTransportData(h),gameKey:t,game:this.game,matchID:s,playerID:o,credentials:a,gameName:this.game.name,numPlayers:r}),this.createDispatchers(),this.chatMessages=[],this.sendChatMessage=h=>{this.transport.sendChatMessage(this.matchID,{id:mv(7),sender:this.playerID,payload:h})}}receiveMatchData(t){this.matchData=t,this.notifySubscribers()}receiveChatMessage(t){this.chatMessages=[...this.chatMessages,t],this.notifySubscribers()}receiveTransportData(t){let[n]=t.args;if(n===this.matchID)switch(t.type){case"sync":{let[,r]=t.args,i=xi(r);this.receiveMatchData(r.filteredMetadata),this.store.dispatch(i);break}case"update":{let[,r,i]=t.args,s=this.store.getState();if(r._stateID>=s._stateID){let o=Iu(r,i);this.store.dispatch(o)}break}case"patch":{let[,r,i,s,o]=t.args,a=this.store.getState()._stateID;if(r!==a)break;let u=Mu(r,i,s,o);this.store.dispatch(u),this.store.getState()._stateID===a&&this.transport.requestSync();break}case"matchData":{let[,r]=t.args;this.receiveMatchData(r);break}case"chat":{let[,r]=t.args;this.receiveChatMessage(r);break}}}notifySubscribers(){Object.values(this.subscribers).forEach(t=>t(this.getState()))}overrideGameState(t){this.gameStateOverride=t,this.notifySubscribers()}start(){this.transport.connect(),this._running=!0,this.manager.register(this)}stop(){this.transport.disconnect(),this._running=!1,this.manager.unregister(this)}subscribe(t){let n=Object.keys(this.subscribers).length;return this.subscribers[n]=t,this.transport.subscribeToConnectionStatus(()=>this.notifySubscribers()),(this._running||!this.multiplayer)&&t(this.getState()),()=>{delete this.subscribers[n]}}getInitialState(){return this.initialState}getState(){let t=this.store.getState();if(this.gameStateOverride!==null&&(t=this.gameStateOverride),t===null)return t;let n=!0,r=this.game.flow.isPlayerActive(t.G,t.ctx,this.playerID);return this.multiplayer&&!r&&(n=!1),!this.multiplayer&&this.playerID!==null&&this.playerID!==void 0&&!r&&(n=!1),t.ctx.gameover!==void 0&&(n=!1),this.multiplayer||(t={...t,G:this.game.playerView({G:t.G,ctx:t.ctx,playerID:this.playerID}),plugins:qv(t,this)}),{...t,log:this.log,isActive:n,isConnected:this.transport.isConnected}}createDispatchers(){this.moves=mj(this.game.moveNames,this.store,this.playerID,this.credentials,this.multiplayer),this.events=gj(this.game.flow.enabledEventNames,this.store,this.playerID,this.credentials,this.multiplayer),this.plugins=yj(this.game.pluginNames,this.store,this.playerID,this.credentials,this.multiplayer)}updatePlayerID(t){this.playerID=t,this.createDispatchers(),this.transport.updatePlayerID(t),this.notifySubscribers()}updateMatchID(t){this.matchID=t,this.createDispatchers(),this.transport.updateMatchID(t),this.notifySubscribers()}updateCredentials(t){this.credentials=t,this.createDispatchers(),this.transport.updateCredentials(t),this.notifySubscribers()}};function Hc(e){return new zc(e)}var DL=he(tn());var BL=he(qi());var LL=he(io());var UL=he(tn());var zL=he(qi());var KL=he(io());var ut=Object.create(null);ut.open="0";ut.close="1";ut.ping="2";ut.pong="3";ut.message="4";ut.upgrade="5";ut.noop="6";var Yi=Object.create(null);Object.keys(ut).forEach(e=>{Yi[ut[e]]=e});var $i={type:"error",data:"parser error"};var G1=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",F1=typeof ArrayBuffer=="function",U1=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Xi=({type:e,data:t},n,r)=>G1&&t instanceof Blob?n?r(t):B1(t,r):F1&&(t instanceof ArrayBuffer||U1(t))?n?r(t):B1(new Blob([t]),r):r(ut[e]+(t||"")),B1=(e,t)=>{let n=new FileReader;return n.onload=function(){let r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function L1(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Wc;function V1(e,t){if(G1&&e.data instanceof Blob)return e.data.arrayBuffer().then(L1).then(t);if(F1&&(e.data instanceof ArrayBuffer||U1(e.data)))return t(L1(e.data));Xi(e,!1,n=>{Wc||(Wc=new TextEncoder),t(Wc.encode(n))})}var z1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qi=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<z1.length;e++)Qi[z1.charCodeAt(e)]=e;var K1=e=>{let t=e.length*.75,n=e.length,r,i=0,s,o,a,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);let c=new ArrayBuffer(t),l=new Uint8Array(c);for(r=0;r<n;r+=4)s=Qi[e.charCodeAt(r)],o=Qi[e.charCodeAt(r+1)],a=Qi[e.charCodeAt(r+2)],u=Qi[e.charCodeAt(r+3)],l[i++]=s<<2|o>>4,l[i++]=(o&15)<<4|a>>2,l[i++]=(a&3)<<6|u&63;return c};var vj=typeof ArrayBuffer=="function",Zi=(e,t)=>{if(typeof e!="string")return{type:"message",data:H1(e,t)};let n=e.charAt(0);return n==="b"?{type:"message",data:bj(e.substring(1),t)}:Yi[n]?e.length>1?{type:Yi[n],data:e.substring(1)}:{type:Yi[n]}:$i},bj=(e,t)=>{if(vj){let n=K1(e);return H1(n,t)}else return{base64:!0,data:e}},H1=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}};var W1="",J1=(e,t)=>{let n=e.length,r=new Array(n),i=0;e.forEach((s,o)=>{Xi(s,!1,a=>{r[o]=a,++i===n&&t(r.join(W1))})})},Y1=(e,t)=>{let n=e.split(W1),r=[];for(let i=0;i<n.length;i++){let s=Zi(n[i],t);if(r.push(s),s.type==="error")break}return r};function $1(){return new TransformStream({transform(e,t){V1(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let s=new DataView(i.buffer);s.setUint8(0,126),s.setUint16(1,r)}else{i=new Uint8Array(9);let s=new DataView(i.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var Jc;function Eo(e){return e.reduce((t,n)=>t+n.length,0)}function ko(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function X1(e,t){Jc||(Jc=new TextDecoder);let n=[],r=0,i=-1,s=!1;return new TransformStream({transform(o,a){for(n.push(o);;){if(r===0){if(Eo(n)<1)break;let u=ko(n,1);s=(u[0]&128)===128,i=u[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(Eo(n)<2)break;let u=ko(n,2);i=new DataView(u.buffer,u.byteOffset,u.length).getUint16(0),r=3}else if(r===2){if(Eo(n)<8)break;let u=ko(n,8),c=new DataView(u.buffer,u.byteOffset,u.length),l=c.getUint32(0);if(l>Math.pow(2,21)-1){a.enqueue($i);break}i=l*Math.pow(2,32)+c.getUint32(4),r=3}else{if(Eo(n)<i)break;let u=ko(n,i);a.enqueue(Zi(s?u:Jc.decode(u),t)),r=0}if(i===0||i>e){a.enqueue($i);break}}}})}var Yc=4;function ye(e){if(e)return _j(e)}function _j(e){for(var t in ye.prototype)e[t]=ye.prototype[t];return e}ye.prototype.on=ye.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};ye.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};ye.prototype.off=ye.prototype.removeListener=ye.prototype.removeAllListeners=ye.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+e],this};ye.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this};ye.prototype.emitReserved=ye.prototype.emit;ye.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};ye.prototype.hasListeners=function(e){return!!this.listeners(e).length};var Dt=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ue=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Q1="arraybuffer";function Ao(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}var wj=Ue.setTimeout,Oj=Ue.clearTimeout;function Rt(e,t){t.useNativeTimers?(e.setTimeoutFn=wj.bind(Ue),e.clearTimeoutFn=Oj.bind(Ue)):(e.setTimeoutFn=Ue.setTimeout.bind(Ue),e.clearTimeoutFn=Ue.clearTimeout.bind(Ue))}var Pj=1.33;function Z1(e){return typeof e=="string"?Ej(e):Math.ceil((e.byteLength||e.size)*Pj)}function Ej(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function xo(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function e_(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function t_(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let s=n[r].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}var So=class extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}},Bt=class extends ye{constructor(t){super(),this.writable=!1,Rt(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new So(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let n=Zi(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){let t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){let n=e_(t);return n.length?"?"+n:""}};var es=class extends Bt{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Y1(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,J1(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=xo()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}};var n_=!1;try{n_=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var r_=n_;function kj(){}var $c=class extends es{constructor(t){if(super(t),typeof location<"u"){let n=location.protocol==="https:",r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){let r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,s)=>{this.onError("xhr post error",i,s)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}},$t=class e extends ye{constructor(t,n,r){super(),this.createRequest=t,Rt(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;let n=Ao(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=kj,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};$t.requestsCount=0;$t.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",i_);else if(typeof addEventListener=="function"){let e="onpagehide"in Ue?"pagehide":"unload";addEventListener(e,i_,!1)}}function i_(){for(let e in $t.requests)$t.requests.hasOwnProperty(e)&&$t.requests[e].abort()}var Aj=function(){let e=s_({xdomain:!1});return e&&e.responseType!==null}(),Xt=class extends $c{constructor(t){super(t);let n=t&&t.forceBase64;this.supportsBinary=Aj&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new $t(s_,this.uri(),t)}};function s_(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||r_))return new XMLHttpRequest}catch{}if(!t)try{return new Ue[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var o_=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Qc=class extends Bt{get name(){return"websocket"}doOpen(){let t=this.uri(),n=this.opts.protocols,r=o_?{}:Ao(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){let r=t[n],i=n===t.length-1;Xi(r,this.supportsBinary,s=>{try{this.doWrite(r,s)}catch{}i&&Dt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=xo()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}},Xc=Ue.WebSocket||Ue.MozWebSocket,Qt=class extends Qc{createSocket(t,n,r){return o_?new Xc(t,n,r):n?new Xc(t,n):new Xc(t)}doWrite(t,n){this.ws.send(n)}};var sr=class extends Bt{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{let n=X1(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=$1();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();let s=()=>{r.read().then(({done:a,value:u})=>{a||(this.onPacket(u),s())}).catch(a=>{})};s();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){let r=t[n],i=n===t.length-1;this._writer.write(r).then(()=>{i&&Dt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var Zc={websocket:Qt,webtransport:sr,polling:Xt};var xj=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Sj=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function or(e){if(e.length>8e3)throw"URI too long";let t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=xj.exec(e||""),s={},o=14;for(;o--;)s[Sj[o]]=i[o]||"";return n!=-1&&r!=-1&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=Tj(s,s.path),s.queryKey=Mj(s,s.query),s}function Tj(e,t){let n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Mj(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,s){i&&(n[i]=s)}),n}var el=typeof addEventListener=="function"&&typeof removeEventListener=="function",To=[];el&&addEventListener("offline",()=>{To.forEach(e=>e())},!1);var Pn=class e extends ye{constructor(t,n){if(super(),this.binaryType=Q1,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){let r=or(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=or(n.host).host);Rt(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{let i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=t_(this.opts.query)),el&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},To.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let n=Object.assign({},this.opts.query);n.EIO=Yc,n.transport=t,this.id&&(n.sid=this.id);let r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",e.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){let i=this.writeBuffer[r].data;if(i&&(n+=Z1(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Dt(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let s={type:t,data:n,options:r};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),i&&this.once("flush",i),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),el&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let r=To.indexOf(this._offlineEventListener);r!==-1&&To.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}};Pn.protocol=Yc;var Mo=class extends Pn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;Pn.priorWebsocketSuccess=!1;let i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Pn.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(l(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{let p=new Error("probe error");p.transport=n.name,this.emitReserved("upgradeError",p)}}))};function s(){r||(r=!0,l(),n.close(),n=null)}let o=f=>{let p=new Error("probe error: "+f);p.transport=n.name,s(),this.emitReserved("upgradeError",p)};function a(){o("transport closed")}function u(){o("socket closed")}function c(f){n&&f.name!==n.name&&s()}let l=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",a),this.off("close",u),this.off("upgrading",c)};n.once("open",i),n.once("error",o),n.once("close",a),this.once("close",u),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}},ar=class extends Mo{constructor(t,n={}){let r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>Zc[i]).filter(i=>!!i)),super(t,r)}};var QG=ar.protocol;function a_(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=or(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let s=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+t,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r}var ol={};ll(ol,{Decoder:()=>il,Encoder:()=>rl,PacketType:()=>X,isPacketValid:()=>Gj,protocol:()=>p_});var Nj=typeof ArrayBuffer=="function",Cj=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,u_=Object.prototype.toString,qj=typeof Blob=="function"||typeof Blob<"u"&&u_.call(Blob)==="[object BlobConstructor]",jj=typeof File=="function"||typeof File<"u"&&u_.call(File)==="[object FileConstructor]";function ns(e){return Nj&&(e instanceof ArrayBuffer||Cj(e))||qj&&e instanceof Blob||jj&&e instanceof File}function ts(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(ts(e[n]))return!0;return!1}if(ns(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return ts(e.toJSON(),!0);for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ts(e[n]))return!0;return!1}function c_(e){let t=[],n=e.data,r=e;return r.data=tl(n,t),r.attachments=t.length,{packet:r,buffers:t}}function tl(e,t){if(!e)return e;if(ns(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=tl(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=tl(e[r],t));return n}return e}function l_(e,t){return e.data=nl(e.data,t),delete e.attachments,e}function nl(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=nl(e[n],t);else if(typeof e=="object")for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=nl(e[n],t));return e}var f_=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],p_=5,X;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(X||(X={}));var rl=class{constructor(t){this.replacer=t}encode(t){return(t.type===X.EVENT||t.type===X.ACK)&&ts(t)?this.encodeAsBinary({type:t.type===X.EVENT?X.BINARY_EVENT:X.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===X.BINARY_EVENT||t.type===X.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){let n=c_(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}},il=class e extends ye{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);let r=n.type===X.BINARY_EVENT;r||n.type===X.BINARY_ACK?(n.type=r?X.EVENT:X.ACK,this.reconstructor=new sl(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(ns(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(X[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===X.BINARY_EVENT||r.type===X.BINARY_ACK){let s=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);let o=t.substring(s,n);if(o!=Number(o)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(t.charAt(n+1)==="/"){let s=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(s,n)}else r.nsp="/";let i=t.charAt(n+1);if(i!==""&&Number(i)==i){let s=n+1;for(;++n;){let o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}r.id=Number(t.substring(s,n+1))}if(t.charAt(++n)){let s=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,s))r.data=s;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case X.CONNECT:return Io(n);case X.DISCONNECT:return n===void 0;case X.CONNECT_ERROR:return typeof n=="string"||Io(n);case X.EVENT:case X.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&f_.indexOf(n[0])===-1);case X.ACK:case X.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},sl=class{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){let n=l_(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Dj(e){return typeof e=="string"}var Rj=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function Bj(e){return e===void 0||Rj(e)}function Io(e){return Object.prototype.toString.call(e)==="[object Object]"}function Lj(e,t){switch(e){case X.CONNECT:return t===void 0||Io(t);case X.DISCONNECT:return t===void 0;case X.EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&f_.indexOf(t[0])===-1);case X.ACK:return Array.isArray(t);case X.CONNECT_ERROR:return typeof t=="string"||Io(t);default:return!1}}function Gj(e){return Dj(e.nsp)&&Bj(e.id)&&Lj(e.type,e.data)}function Qe(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var Fj=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),ur=class extends ye{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[Qe(t,"open",this.onopen.bind(this)),Qe(t,"packet",this.onpacket.bind(this)),Qe(t,"error",this.onerror.bind(this)),Qe(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,i,s;if(Fj.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;let o={type:X.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){let l=this.ids++,f=n.pop();this._registerAckCallback(l,f),o.id=l}let a=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,u=this.connected&&!(!((s=this.io.engine)===null||s===void 0)&&s._hasPingExpired());return this.flags.volatile&&!a||(u?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var r;let i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}let s=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);n.call(this,new Error("operation has timed out"))},i),o=(...a)=>{this.io.clearTimeoutFn(s),n.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((r,i)=>{let s=(o,a)=>o?i(o):r(a);s.withError=!0,n.push(s),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...s)=>(this._queue[0],i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...s)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;let n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:X.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){let r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case X.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case X.EVENT:case X.BINARY_EVENT:this.onevent(t);break;case X.ACK:case X.BINARY_ACK:this.onack(t);break;case X.DISCONNECT:this.ondisconnect();break;case X.CONNECT_ERROR:this.destroy();let r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){let n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let n=this._anyListeners.slice();for(let r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){let n=this,r=!1;return function(...i){r||(r=!0,n.packet({type:X.ACK,id:t,data:i}))}}onack(t){let n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:X.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let n=this._anyOutgoingListeners.slice();for(let r of n)r.apply(this,t.data)}}};function En(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}En.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};En.prototype.reset=function(){this.attempts=0};En.prototype.setMin=function(e){this.ms=e};En.prototype.setMax=function(e){this.max=e};En.prototype.setJitter=function(e){this.jitter=e};var cr=class extends ye{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Rt(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new En({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;let i=n.parser||ol;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new ar(this.uri,this.opts);let n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let i=Qe(n,"open",function(){r.onopen(),t&&t()}),s=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=Qe(n,"error",s);if(this._timeout!==!1){let a=this._timeout,u=this.setTimeoutFn(()=>{i(),s(new Error("timeout")),n.close()},a);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(Qe(t,"ping",this.onping.bind(this)),Qe(t,"data",this.ondata.bind(this)),Qe(t,"error",this.onerror.bind(this)),Qe(t,"close",this.onclose.bind(this)),Qe(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Dt(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new ur(this,t,n),this.nsps[t]=r),r}_destroy(t){let n=Object.keys(this.nsps);for(let r of n)if(this.nsps[r].active)return;this._close()}_packet(t){let n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let n=this.backoff.duration();this._reconnecting=!0;let r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var rs={};function is(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};let n=a_(e,t.path||"/socket.io"),r=n.source,i=n.id,s=n.path,o=rs[i]&&s in rs[i].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o,u;return a?u=new cr(r,t):(rs[i]||(rs[i]=new cr(r,t)),u=rs[i]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(is,{Manager:cr,Socket:ur,io:is,connect:is});var h_=is,al=class extends ir{constructor({socket:t,socketOpts:n,server:r,...i}){super(i),this.server=r,this.socket=t,this.socketOpts=n}sendAction(t,n){let r=[n,t._stateID,this.matchID,this.playerID];this.socket.emit("update",...r)}sendChatMessage(t,n){let r=[t,n,this.credentials];this.socket.emit("chat",...r)}connect(){if(!this.socket)if(this.server){let t=this.server;t.search(/^https?:\/\//)==-1&&(t="http://"+this.server),t.slice(-1)!="/"&&(t=t+"/"),this.socket=h_(t+this.gameName,this.socketOpts)}else this.socket=h_("/"+this.gameName,this.socketOpts);this.socket.on("patch",(t,n,r,i,s)=>{this.notifyClient({type:"patch",args:[t,n,r,i,s]})}),this.socket.on("update",(t,n,r)=>{this.notifyClient({type:"update",args:[t,n,r]})}),this.socket.on("sync",(t,n)=>{this.notifyClient({type:"sync",args:[t,n]})}),this.socket.on("matchData",(t,n)=>{this.notifyClient({type:"matchData",args:[t,n]})}),this.socket.on("chat",(t,n)=>{this.notifyClient({type:"chat",args:[t,n]})}),this.socket.on("connect",()=>{this.requestSync(),this.setConnectionStatus(!0)}),this.socket.on("disconnect",()=>{this.setConnectionStatus(!1)})}disconnect(){this.socket.close(),this.socket=null,this.setConnectionStatus(!1)}requestSync(){if(this.socket){let t=[this.matchID,this.playerID,this.credentials,this.numPlayers];this.socket.emit("sync",...t)}}updateMatchID(t){this.matchID=t,this.requestSync()}updatePlayerID(t){this.playerID=t,this.requestSync()}updateCredentials(t){this.credentials=t,this.requestSync()}};function ul({server:e,socketOpts:t}={}){return n=>new al({server:e,socketOpts:t,...n})}var G9=he(tn()),F9=he(qi());function No(e){if(e?.arguments){let t={...e};return t.arguments=Object.entries(t.arguments).reduce((n,[r,i])=>({...n,[r]:i.abstract?i:i.entityId}),{}),JSON.parse(He(t,{deduplicateInstances:!1}))}else return e}var Vj={PlaceNew:["destination"],RemoveEntity:["entity"],MoveEntity:["entity","destination"],TakeFrom:["source","destination"],SetState:["entity","state"]};function lr(e,t){return Vj[t.moveType].filter(n=>t.arguments[n].playerChoice).map(n=>({argName:n,getClickable:n==="state"?()=>t.arguments[n].possibleValues.map(r=>({abstract:!0,...t.arguments[n],value:r})):r=>e.G.bank.findAll(e,t.arguments[n],r)}))}function Co(e,t,n,r){let i=lr(e,t,r).map(s=>s.argName);return{arguments:n.reduce((s,o,a)=>({...s,[i[a]]:o}),{})}}var qo=class{constructor(t){this.options=t,this.game=t.boardgameIOGame||gi(JSON.parse(t.gameRules),t.gameName),t.boardgameIOGame||(this.moveBuilder={targets:[],stepIndex:0,eliminatedMoves:[]},this.optimisticWinner=null)}connect(){let{server:t,numPlayers:n,debug:r={collapseOnLoad:!0,impl:Ki},matchID:i,playerID:s,credentials:o,multiplayer:a=ul({server:t,socketOpts:{transports:["websocket","polling"]}})}=this.options;try{let u=o?{game:this.game,multiplayer:a,matchID:i,playerID:s,credentials:o,numPlayers:n,debug:r}:{game:this.game,numPlayers:n,debug:r};return this.client=Hc(u),this.client.subscribe(()=>this.update()),this.client.start(),this}catch(u){console.error("Failed to join game:",u?.message??u),u?.stack&&console.error(u.stack)}}update(){this.options.onClientUpdate?.()}getState(){let t=this.client?.getState();if(!t)return{};let n=this.options.boardgameIOGame?t:{...t,G:Ft(JSON.stringify(t.G),ht)},r=this.optimisticWinner??n?.ctx?.gameover,i=r?[]:ti(n,this.client);if(this.options.boardgameIOGame)return{state:n,gameover:r,moves:this.client.moves,currentMoves:i};let s=Object.entries(i).reduce((u,[c,l])=>{let f=p=>{this.client.moves[c](No(p))};return f.moveInstance=l.moveInstance,{...u,[c]:f}},{}),{allClickable:o,_possibleMoveMeta:a}=Kj(n,s,this.moveBuilder);return{state:n,gameover:r,allClickable:o,_wrappedMoves:s,_possibleMoveMeta:a}}doStep(t){if(this.options.boardgameIOGame)return;let{state:n,_wrappedMoves:r,_possibleMoveMeta:i}=this.getState(),s=t.abstract?t:n.G.bank.locate(t.entityId),o=Object.entries(i).filter(([u,c])=>!zj(c.clickableForMove,s)).map(([u])=>u).concat(this.moveBuilder.eliminatedMoves);if(o.length===Object.keys(r).length){console.error("invalid move with target:",s?.rule);return}let a=Object.entries(i).filter(([u])=>!o.includes(u));if(Hj(n,r,a,this.moveBuilder.stepIndex)){let[u]=a[0],c=r[u],l=Co(n,c.moveInstance.rule,[...this.moveBuilder.targets,s],{moveInstance:c.moveInstance});this.optimisticWinner=Wj(n,this.game,c.moveInstance,l),c(l),this.moveBuilder={targets:[],stepIndex:0,eliminatedMoves:[]}}else this.moveBuilder={eliminatedMoves:o,stepIndex:this.moveBuilder.stepIndex+1,targets:[...this.moveBuilder.targets,s]};this.update()}reset(){this.options.boardgameIOGame||(this.moveBuilder={targets:[],stepIndex:0,eliminatedMoves:[]},this.optimisticWinner=null,this.update())}undoStep(){this.options.boardgameIOGame||(this.moveBuilder.targets.length&&(this.moveBuilder={targets:this.moveBuilder.targets.slice(0,-1),stepIndex:Math.max(0,this.moveBuilder.stepIndex-1),eliminatedMoves:[]}),this.update())}};function zj(e,t){return t.abstract?[...e].some(n=>n.abstract&&n.value===t.value):e.has(t)}function Kj(e,t,n){let{eliminatedMoves:r,stepIndex:i}=n,s={},o=new Set;return Object.entries(t).filter(([a])=>!r.includes(a)).forEach(([a,u])=>{let c=pe(e,{...u.moveInstance.rule,moveName:a}),l={moveInstance:u.moveInstance,moveArguments:c.arguments},f=n.targets.map(m=>m.abstract?m:e.G.bank.locate(m.entityId)),p=Co(e,c,f,l);l.moveArguments={...l.moveArguments,...p.arguments};let h=ke(e,c,{},l).conditionsAreMet,d=lr(e,c),y=new Set(h&&d?.[i]?.getClickable(l)||[]);s[a]={clickableForMove:y},y.forEach(m=>o.add(m))}),{_possibleMoveMeta:s,allClickable:o}}function Hj(e,t,n,r){return n.length===1&&lr(e,t[n[0][0]].moveInstance.rule).length===r+1}function Wj(e,t,n,r){let i=Zr(e,No(r),{moveInstance:n});return t.endIf?.({...e,G:JSON.parse(He(i))})}return w_(Jj);})();
|
|
31
|
+
to set up bots.`},m(i,s){M(i,t,s),M(i,n,s),M(i,r,s)},p:U,i:U,o:U,d(i){i&&x(t),i&&x(n),i&&x(r)}}}function $j(e){let t;return{c(){t=S("p"),t.textContent="The bot debugger is only available in singleplayer mode."},m(n,r){M(n,t,r)},p:U,i:U,o:U,d(n){n&&x(t)}}}function Xj(e){let t,n,r,i,s,o,a,u,c,l,f,p,d,h,y,m,b,g,k=Object.keys(e[7].opts()).length,I,j,C,q,J;o=new bt({props:{value:"1",onPress:e[13],label:"reset"}}),c=new bt({props:{value:"2",onPress:e[11],label:"play"}}),p=new bt({props:{value:"3",onPress:e[12],label:"simulate"}});let fe=Object.keys(e[8]),V=[];for(let L=0;L<fe.length;L+=1)V[L]=uw(aw(e,fe,L));let se=k&&cw(e),ne=(e[5]||e[3])&&lw(e);return{c(){t=S("section"),n=S("h3"),n.textContent="Controls",r=N(),i=S("ul"),s=S("li"),G(o.$$.fragment),a=N(),u=S("li"),G(c.$$.fragment),l=N(),f=S("li"),G(p.$$.fragment),d=N(),h=S("section"),y=S("h3"),y.textContent="Bot",m=N(),b=S("select");for(let L=0;L<V.length;L+=1)V[L].c();g=N(),se&&se.c(),I=N(),ne&&ne.c(),j=ut(),O(n,"class","svelte-fn09gm"),O(s,"class","svelte-fn09gm"),O(u,"class","svelte-fn09gm"),O(f,"class","svelte-fn09gm"),O(i,"class","svelte-fn09gm"),O(y,"class","svelte-fn09gm"),e[4]===void 0&&at(()=>e[17].call(b))},m(L,Pe){M(L,t,Pe),_(t,n),_(t,r),_(t,i),_(i,s),D(o,s,null),_(i,a),_(i,u),D(c,u,null),_(i,l),_(i,f),D(p,f,null),M(L,d,Pe),M(L,h,Pe),_(h,y),_(h,m),_(h,b);for(let ue=0;ue<V.length;ue+=1)V[ue].m(b,null);po(b,e[4]),M(L,g,Pe),se&&se.m(L,Pe),M(L,I,Pe),ne&&ne.m(L,Pe),M(L,j,Pe),C=!0,q||(J=[Q(b,"change",e[17]),Q(b,"change",e[10])],q=!0)},p(L,Pe){if(Pe&256){fe=Object.keys(L[8]);let ue;for(ue=0;ue<fe.length;ue+=1){let Lt=aw(L,fe,ue);V[ue]?V[ue].p(Lt,Pe):(V[ue]=uw(Lt),V[ue].c(),V[ue].m(b,null))}for(;ue<V.length;ue+=1)V[ue].d(1);V.length=fe.length}Pe&272&&po(b,L[4]),Pe&128&&(k=Object.keys(L[7].opts()).length),k?se?(se.p(L,Pe),Pe&128&&P(se,1)):(se=cw(L),se.c(),P(se,1),se.m(I.parentNode,I)):se&&(ce(),A(se,1,1,()=>{se=null}),le()),L[5]||L[3]?ne?ne.p(L,Pe):(ne=lw(L),ne.c(),ne.m(j.parentNode,j)):ne&&(ne.d(1),ne=null)},i(L){C||(P(o.$$.fragment,L),P(c.$$.fragment,L),P(p.$$.fragment,L),P(se),C=!0)},o(L){A(o.$$.fragment,L),A(c.$$.fragment,L),A(p.$$.fragment,L),A(se),C=!1},d(L){L&&x(t),B(o),B(c),B(p),L&&x(d),L&&x(h),Xe(V,L),L&&x(g),se&&se.d(L),L&&x(I),ne&&ne.d(L),L&&x(j),q=!1,Ge(J)}}}function uw(e){let t,n=e[7]+"",r;return{c(){t=S("option"),r=Y(n),t.__value=e[7],t.value=t.__value},m(i,s){M(i,t,s),_(t,r)},p:U,d(i){i&&x(t)}}}function cw(e){let t,n,r,i,s,o,a,u,c,l,f;return u=new Sc({props:{bot:e[7]}}),{c(){t=S("section"),n=S("h3"),n.textContent="Options",r=N(),i=S("label"),i.textContent="debug",s=N(),o=S("input"),a=N(),G(u.$$.fragment),O(n,"class","svelte-fn09gm"),O(i,"for","ai-option-debug"),O(i,"class","svelte-fn09gm"),O(o,"id","ai-option-debug"),O(o,"type","checkbox"),O(o,"class","svelte-fn09gm")},m(p,d){M(p,t,d),_(t,n),_(t,r),_(t,i),_(t,s),_(t,o),o.checked=e[1],_(t,a),D(u,t,null),c=!0,l||(f=[Q(o,"change",e[18]),Q(o,"change",e[9])],l=!0)},p(p,d){d&2&&(o.checked=p[1]);let h={};d&128&&(h.bot=p[7]),u.$set(h)},i(p){c||(P(u.$$.fragment,p),c=!0)},o(p){A(u.$$.fragment,p),c=!1},d(p){p&&x(t),B(u),l=!1,Ge(f)}}}function lw(e){let t,n,r,i,s=e[2]&&e[2]<1&&fw(e),o=e[5]&&pw(e);return{c(){t=S("section"),n=S("h3"),n.textContent="Result",r=N(),s&&s.c(),i=N(),o&&o.c(),O(n,"class","svelte-fn09gm")},m(a,u){M(a,t,u),_(t,n),_(t,r),s&&s.m(t,null),_(t,i),o&&o.m(t,null)},p(a,u){a[2]&&a[2]<1?s?s.p(a,u):(s=fw(a),s.c(),s.m(t,i)):s&&(s.d(1),s=null),a[5]?o?o.p(a,u):(o=pw(a),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(a){a&&x(t),s&&s.d(),o&&o.d()}}}function fw(e){let t;return{c(){t=S("progress"),t.value=e[2]},m(n,r){M(n,t,r)},p(n,r){r&4&&(t.value=n[2])},d(n){n&&x(t)}}}function pw(e){let t,n,r,i,s,o,a,u=JSON.stringify(e[6])+"",c;return{c(){t=S("ul"),n=S("li"),r=Y("Action: "),i=Y(e[5]),s=N(),o=S("li"),a=Y("Args: "),c=Y(u),O(n,"class","svelte-fn09gm"),O(o,"class","svelte-fn09gm"),O(t,"class","svelte-fn09gm")},m(l,f){M(l,t,f),_(t,n),_(n,r),_(n,i),_(t,s),_(t,o),_(o,a),_(o,c)},p(l,f){f&32&&ae(i,l[5]),f&64&&u!==(u=JSON.stringify(l[6])+"")&&ae(c,u)},d(l){l&&x(t)}}}function Qj(e){let t,n,r,i,s,o,a=[Xj,$j,Yj],u=[];function c(l,f){return l[0].game.ai&&!l[0].multiplayer?0:l[0].multiplayer?1:2}return n=c(e),r=u[n]=a[n](e),{c(){t=S("section"),r.c()},m(l,f){M(l,t,f),u[n].m(t,null),i=!0,s||(o=Q(window,"keydown",e[14]),s=!0)},p(l,[f]){let p=n;n=c(l),n===p?u[n].p(l,f):(ce(),A(u[p],1,1,()=>{u[p]=null}),le(),r=u[n],r?r.p(l,f):(r=u[n]=a[n](l),r.c()),P(r,1),r.m(t,null))},i(l){i||(P(r),i=!0)},o(l){A(r),i=!1},d(l){l&&x(t),u[n].d(),s=!1,o()}}}function Zj(e,t,n){let{client:r}=t,{clientManager:i}=t,{ToggleVisibility:s}=t,{secondaryPane:o}=kn("secondaryPane"),a={MCTS:Di,Random:ao},u=!1,c=null,l=0,f=null,p=({iterationCounter:V,numIterations:se,metadata:ne})=>{n(3,l=V),n(2,c=V/se),f=ne,u&&f&&o.set({component:Ki,metadata:f})};function d(){u&&f?o.set({component:Ki,metadata:f}):o.set(null)}let h;r.game.ai&&(h=new Di({game:r.game,enumerate:r.game.ai.enumerate,iterationCallback:p}),h.setOpt("async",!0));let y,m,b;function g(){let V=a[y];n(7,h=new V({game:r.game,enumerate:r.game.ai.enumerate,iterationCallback:p})),h.setOpt("async",!0),n(5,m=null),f=null,o.set(null),n(3,l=0)}async function k(){n(5,m=null),f=null,n(3,l=0);let V=await nc(r,h);V&&(n(5,m=V.payload.type),n(6,b=V.payload.args))}function I(V=1e4,se=100){return n(5,m=null),f=null,n(3,l=0),(async()=>{for(let L=0;L<V&&await nc(r,h);L++)await new Promise(ue=>setTimeout(ue,se))})()}function j(){r.overrideGameState(null),o.set(null),n(1,u=!1)}function C(){r.reset(),n(5,m=null),f=null,n(3,l=0),j()}function q(V){V.keyCode==27&&j()}Rc(j);function J(){y=ww(this),n(4,y),n(8,a)}function fe(){u=this.checked,n(1,u)}return e.$$set=V=>{"client"in V&&n(0,r=V.client),"clientManager"in V&&n(15,i=V.clientManager),"ToggleVisibility"in V&&n(16,s=V.ToggleVisibility)},[r,u,c,l,y,m,b,h,a,d,g,k,I,C,q,i,s,J,fe]}var Ac=class extends Z{constructor(t){super(),te(this,t,Zj,Qj,ee,{client:0,clientManager:15,ToggleVisibility:16},Jj)}};function eq(e){de(e,"svelte-8ymctk",`.debug-panel.svelte-8ymctk.svelte-8ymctk{position:fixed;color:#555;font-family:monospace;right:0;top:0;height:100%;font-size:14px;opacity:0.9;z-index:99999}.panel.svelte-8ymctk.svelte-8ymctk{display:flex;position:relative;flex-direction:row;height:100%}.visibility-toggle.svelte-8ymctk.svelte-8ymctk{position:absolute;box-sizing:border-box;top:7px;border:1px solid #ccc;border-radius:5px;width:48px;height:48px;padding:8px;background:white;color:#555;box-shadow:0 0 5px rgba(0, 0, 0, 0.2)}.visibility-toggle.svelte-8ymctk.svelte-8ymctk:hover,.visibility-toggle.svelte-8ymctk.svelte-8ymctk:focus{background:#eee}.opener.svelte-8ymctk.svelte-8ymctk{right:10px}.closer.svelte-8ymctk.svelte-8ymctk{left:-326px}@keyframes svelte-8ymctk-rotateFromZero{from{transform:rotateZ(0deg)}to{transform:rotateZ(180deg)}}.icon.svelte-8ymctk.svelte-8ymctk{display:flex;height:100%;animation:svelte-8ymctk-rotateFromZero 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55) 0s 1
|
|
32
|
+
normal forwards}.closer.svelte-8ymctk .icon.svelte-8ymctk{animation-direction:reverse}.pane.svelte-8ymctk.svelte-8ymctk{flex-grow:2;overflow-x:hidden;overflow-y:scroll;background:#fefefe;padding:20px;border-left:1px solid #ccc;box-shadow:-1px 0 5px rgba(0, 0, 0, 0.2);box-sizing:border-box;width:280px}.secondary-pane.svelte-8ymctk.svelte-8ymctk{background:#fefefe;overflow-y:scroll}.debug-panel.svelte-8ymctk button,.debug-panel.svelte-8ymctk select{cursor:pointer;font-size:14px;font-family:monospace}.debug-panel.svelte-8ymctk select{background:#eee;border:1px solid #bbb;color:#555;padding:3px;border-radius:3px}.debug-panel.svelte-8ymctk section{margin-bottom:20px}.debug-panel.svelte-8ymctk .screen-reader-only{clip:rect(0 0 0 0);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}`)}function tq(e){let t,n,r,i,s,o,a,u,c,l=e[10]&&rq(e);r=new sc({props:{panes:e[6],pane:e[2]}}),r.$on("change",e[8]);var f=e[6][e[2]].component;function p(h){return{props:{client:h[4],clientManager:h[0],ToggleVisibility:h[9]}}}f&&(o=new f(p(e)));let d=e[5]&&dw(e);return{c(){t=S("div"),l&&l.c(),n=N(),G(r.$$.fragment),i=N(),s=S("div"),o&&G(o.$$.fragment),a=N(),d&&d.c(),O(s,"class","pane svelte-8ymctk"),O(s,"role","region"),O(s,"aria-label",e[2]),O(s,"tabindex","-1"),O(t,"class","panel svelte-8ymctk")},m(h,y){M(h,t,y),l&&l.m(t,null),_(t,n),D(r,t,null),_(t,i),_(t,s),o&&D(o,s,null),e[16](s),_(t,a),d&&d.m(t,null),c=!0},p(h,y){e=h,e[10]&&l.p(e,y);let m={};y&4&&(m.pane=e[2]),r.$set(m);let b={};if(y&16&&(b.client=e[4]),y&1&&(b.clientManager=e[0]),f!==(f=e[6][e[2]].component)){if(o){ce();let g=o;A(g.$$.fragment,1,0,()=>{B(g,1)}),le()}f?(o=new f(p(e)),G(o.$$.fragment),P(o.$$.fragment,1),D(o,s,null)):o=null}else f&&o.$set(b);(!c||y&4)&&O(s,"aria-label",e[2]),e[5]?d?(d.p(e,y),y&32&&P(d,1)):(d=dw(e),d.c(),P(d,1),d.m(t,null)):d&&(ce(),A(d,1,1,()=>{d=null}),le())},i(h){c||(P(l),P(r.$$.fragment,h),o&&P(o.$$.fragment,h),P(d),at(()=>{u||(u=hb(t,gb,{x:400,...e[12]},!0)),u.run(1)}),c=!0)},o(h){A(l),A(r.$$.fragment,h),o&&A(o.$$.fragment,h),A(d),u||(u=hb(t,gb,{x:400,...e[12]},!1)),u.run(0),c=!1},d(h){h&&x(t),l&&l.d(),B(r),o&&B(o),e[16](null),d&&d.d(),h&&u&&u.end()}}}function nq(e){let t,n,r=e[10]&&iq(e);return{c(){r&&r.c(),t=ut()},m(i,s){r&&r.m(i,s),M(i,t,s),n=!0},p(i,s){i[10]&&r.p(i,s)},i(i){n||(P(r),n=!0)},o(i){A(r),n=!1},d(i){r&&r.d(i),i&&x(t)}}}function rq(e){let t,n,r,i,s,o,a,u;return r=new wo({}),{c(){t=S("button"),n=S("span"),G(r.$$.fragment),O(n,"class","icon svelte-8ymctk"),O(n,"aria-hidden","true"),O(t,"class","visibility-toggle closer svelte-8ymctk"),O(t,"title","Hide Debug Panel")},m(c,l){M(c,t,l),_(t,n),D(r,n,null),o=!0,a||(u=Q(t,"click",e[9]),a=!0)},p:U,i(c){o||(P(r.$$.fragment,c),at(()=>{s&&s.end(1),i=Ew(t,e[14],{key:"toggle"}),i.start()}),o=!0)},o(c){A(r.$$.fragment,c),i&&i.invalidate(),s=Ow(t,e[13],{key:"toggle"}),o=!1},d(c){c&&x(t),B(r),c&&s&&s.end(),a=!1,u()}}}function dw(e){let t,n,r;var i=e[5].component;function s(o){return{props:{metadata:o[5].metadata}}}return i&&(n=new i(s(e))),{c(){t=S("div"),n&&G(n.$$.fragment),O(t,"class","secondary-pane svelte-8ymctk")},m(o,a){M(o,t,a),n&&D(n,t,null),r=!0},p(o,a){let u={};if(a&32&&(u.metadata=o[5].metadata),i!==(i=o[5].component)){if(n){ce();let c=n;A(c.$$.fragment,1,0,()=>{B(c,1)}),le()}i?(n=new i(s(o)),G(n.$$.fragment),P(n.$$.fragment,1),D(n,t,null)):n=null}else i&&n.$set(u)},i(o){r||(n&&P(n.$$.fragment,o),r=!0)},o(o){n&&A(n.$$.fragment,o),r=!1},d(o){o&&x(t),n&&B(n)}}}function iq(e){let t,n,r,i,s,o,a,u;return r=new wo({}),{c(){t=S("button"),n=S("span"),G(r.$$.fragment),O(n,"class","icon svelte-8ymctk"),O(n,"aria-hidden","true"),O(t,"class","visibility-toggle opener svelte-8ymctk"),O(t,"title","Show Debug Panel")},m(c,l){M(c,t,l),_(t,n),D(r,n,null),o=!0,a||(u=Q(t,"click",e[9]),a=!0)},p:U,i(c){o||(P(r.$$.fragment,c),at(()=>{s&&s.end(1),i=Ew(t,e[14],{key:"toggle"}),i.start()}),o=!0)},o(c){A(r.$$.fragment,c),i&&i.invalidate(),s=Ow(t,e[13],{key:"toggle"}),o=!1},d(c){c&&x(t),B(r),c&&s&&s.end(),a=!1,u()}}}function sq(e){let t,n,r,i,s,o,a=[nq,tq],u=[];function c(l,f){return l[3]?1:0}return n=c(e),r=u[n]=a[n](e),{c(){t=S("section"),r.c(),O(t,"aria-label","boardgame.io Debug Panel"),O(t,"class","debug-panel svelte-8ymctk")},m(l,f){M(l,t,f),u[n].m(t,null),i=!0,s||(o=Q(window,"keypress",e[11]),s=!0)},p(l,[f]){let p=n;n=c(l),n===p?u[n].p(l,f):(ce(),A(u[p],1,1,()=>{u[p]=null}),le(),r=u[n],r?r.p(l,f):(r=u[n]=a[n](l),r.c()),P(r,1),r.m(t,null))},i(l){i||(P(r),i=!0)},o(l){A(r),i=!1},d(l){l&&x(t),u[n].d(),s=!1,o()}}}function oq(e,t,n){let r,i,s=U,o=()=>(s(),s=Wi(u,J=>n(15,i=J)),u),a;e.$$.on_destroy.push(()=>s());let{clientManager:u}=t;o();let c={main:{label:"Main",shortcut:"m",component:vc},log:{label:"Log",shortcut:"l",component:Oc},info:{label:"Info",shortcut:"i",component:bc},ai:{label:"AI",shortcut:"a",component:Ac}},l=mb(!1),f=mb(null);mw(e,f,J=>n(5,a=J)),Ui("hotkeys",{disableHotkeys:l}),Ui("secondaryPane",{secondaryPane:f});let p,d="main";function h(J){n(2,d=J.detail),p.focus()}function y(){n(3,b=!b)}let m=i.client.debugOpt,b=!m||!m.collapseOnLoad,g=!m||!m.hideToggleButton;function k(J){if(J.key=="."){y();return}b&&Object.entries(c).forEach(([fe,{shortcut:V}])=>{J.key==V&&n(2,d=fe)})}let I={duration:150,easing:qc},[j,C]=UN(I);function q(J){vo[J?"unshift":"push"](()=>{p=J,n(1,p)})}return e.$$set=J=>{"clientManager"in J&&o(n(0,u=J.clientManager))},e.$$.update=()=>{e.$$.dirty&32768&&n(4,r=i.client)},[u,p,d,b,r,a,c,f,h,y,g,k,I,j,C,i,q]}var Hi=class extends Z{constructor(t){super(),te(this,t,oq,sq,ee,{clientManager:0},eq)}};function Pn(e){"@babel/helpers - typeof";return Pn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pn(e)}function Tw(e,t){if(Pn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Pn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Mw(e){var t=Tw(e,"string");return Pn(t)=="symbol"?t:t+""}function Iw(e,t,n){return(t=Mw(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cw(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Dc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Cw(Object(n),!0).forEach(function(r){Iw(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cw(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Qe(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var Rw=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Bc=function(){return Math.random().toString(36).substring(7).split("").join(".")},Nw={INIT:"@@redux/INIT"+Bc(),REPLACE:"@@redux/REPLACE"+Bc(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Bc()}};function aq(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Gc(e,t,n){var r;if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Qe(0));if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Qe(1));return n(Gc)(e,t)}if(typeof e!="function")throw new Error(Qe(2));var i=e,s=t,o=[],a=o,u=!1;function c(){a===o&&(a=o.slice())}function l(){if(u)throw new Error(Qe(3));return s}function f(y){if(typeof y!="function")throw new Error(Qe(4));if(u)throw new Error(Qe(5));var m=!0;return c(),a.push(y),function(){if(m){if(u)throw new Error(Qe(6));m=!1,c();var g=a.indexOf(y);a.splice(g,1),o=null}}}function p(y){if(!aq(y))throw new Error(Qe(7));if(typeof y.type>"u")throw new Error(Qe(8));if(u)throw new Error(Qe(9));try{u=!0,s=i(s,y)}finally{u=!1}for(var m=o=a,b=0;b<m.length;b++){var g=m[b];g()}return y}function d(y){if(typeof y!="function")throw new Error(Qe(10));i=y,p({type:Nw.REPLACE})}function h(){var y,m=f;return y={subscribe:function(g){if(typeof g!="object"||g===null)throw new Error(Qe(11));function k(){g.next&&g.next(l())}k();var I=m(k);return{unsubscribe:I}}},y[Rw]=function(){return this},y}return p({type:Nw.INIT}),r={dispatch:p,subscribe:f,getState:l,replaceReducer:d},r[Rw]=h,r}function Lc(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.length===0?function(r){return r}:t.length===1?t[0]:t.reduce(function(r,i){return function(){return r(i.apply(void 0,arguments))}})}function jw(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return function(){var i=r.apply(void 0,arguments),s=function(){throw new Error(Qe(15))},o={getState:i.getState,dispatch:function(){return s.apply(void 0,arguments)}},a=t.map(function(u){return u(o)});return s=Lc.apply(void 0,a)(i.dispatch),Dc(Dc({},i),{},{dispatch:s})}}}function qw({game:e,numPlayers:t,setupData:n}){e=qi(e),t||(t=2);let r=e.flow.ctx(t),i={G:{},ctx:r,plugins:{}};i=Iv(i,{game:e}),i=Mi(i,{game:e,playerID:void 0});let s=Jt(i);i.G=e.setup({...s,ctx:i.ctx},n);let o={...i,_undo:[],_redo:[],_stateID:0};return o=e.flow.init(o),[o]=to(o,{game:e}),e.disableUndo||(o._undo=[{G:o.G,ctx:o.ctx,plugins:o.plugins}]),o}var sr=class{constructor({transportDataCallback:t,gameName:n,playerID:r,matchID:i,credentials:s,numPlayers:o}){this.connectionStatusCallback=()=>{},this.isConnected=!1,this.transportDataCallback=t,this.gameName=n||"default",this.playerID=r||null,this.matchID=i||"default",this.credentials=s,this.numPlayers=o||2}subscribeToConnectionStatus(t){this.connectionStatusCallback=t}setConnectionStatus(t){this.isConnected=t,this.connectionStatusCallback()}notifyClient(t){this.transportDataCallback(t)}};var Fc=class extends sr{connect(){}disconnect(){}sendAction(){}sendChatMessage(){}requestSync(){}updateCredentials(){}updateMatchID(){}updatePlayerID(){}},uq=e=>new Fc(e),Uc=class{constructor(){this.debugPanel=null,this.currentClient=null,this.clients=new Map,this.subscribers=new Map}register(t){this.clients.set(t,t),this.mountDebug(t),this.notifySubscribers()}unregister(t){if(this.clients.delete(t),this.currentClient===t){this.unmountDebug();for(let[n]of this.clients){if(this.debugPanel)break;this.mountDebug(n)}}this.notifySubscribers()}subscribe(t){let n=Symbol();return this.subscribers.set(n,t),t(this.getState()),()=>{this.subscribers.delete(n)}}switchPlayerID(t){if(this.currentClient.multiplayer){for(let[n]of this.clients)if(n.playerID===t&&n.debugOpt!==!1&&n.multiplayer===this.currentClient.multiplayer){this.switchToClient(n);return}}this.currentClient.updatePlayerID(t),this.notifySubscribers()}switchToClient(t){t!==this.currentClient&&(this.unmountDebug(),this.mountDebug(t),this.notifySubscribers())}notifySubscribers(){let t=this.getState();this.subscribers.forEach(n=>{n(t)})}getState(){return{client:this.currentClient,debuggableClients:this.getDebuggableClients()}}getDebuggableClients(){return[...this.clients.values()].filter(t=>t.debugOpt!==!1)}mountDebug(t){if(t.debugOpt===!1||this.debugPanel!==null||typeof document>"u")return;let n,r=document.body;t.debugOpt&&t.debugOpt!==!0&&(n=t.debugOpt.impl||n,r=t.debugOpt.target||r),n&&(this.currentClient=t,this.debugPanel=new n({target:r,props:{clientManager:this}}))}unmountDebug(){this.debugPanel.$destroy(),this.debugPanel=null,this.currentClient=null}},cq=new Uc;function Vc(e,t,n){return!n&&e==null&&(e=t.getState().ctx.currentPlayer),e}function Kc(e,t,n,r,i,s){let o={};for(let a of t)o[a]=(...u)=>{let c=Tv[e](a,u,Vc(r,n,s),i);n.dispatch(c)};return o}var lq=Kc.bind(null,"makeMove"),fq=Kc.bind(null,"gameEvent"),pq=Kc.bind(null,"plugin"),zc=class{constructor({game:t,debug:n,numPlayers:r,multiplayer:i,matchID:s,playerID:o,credentials:a,enhancer:u}){this.game=qi(t),this.playerID=o,this.matchID=s||"default",this.credentials=a,this.multiplayer=i,this.debugOpt=n,this.manager=cq,this.gameStateOverride=null,this.subscribers={},this._running=!1,this.reducer=Qn({game:this.game,isClient:i!==void 0}),this.initialState=null,i||(this.initialState=qw({game:this.game,numPlayers:r})),this.reset=()=>{this.store.dispatch(Cu(this.initialState))},this.undo=()=>{let d=Ru(Vc(this.playerID,this.store,this.multiplayer),this.credentials);this.store.dispatch(d)},this.redo=()=>{let d=Nu(Vc(this.playerID,this.store,this.multiplayer),this.credentials);this.store.dispatch(d)},this.log=[];let p=jw(ub,()=>d=>h=>{let y=d(h);return this.notifySubscribers(),y},d=>h=>y=>{let m=d.getState(),b=h(y);return!("clientOnly"in y)&&y.type!==Xn&&this.transport.sendAction(m,y),b},d=>h=>y=>{let m=h(y),b=d.getState();switch(y.type){case _i:case $n:case Oi:case ki:{let g=b.deltalog;this.log=[...this.log,...g];break}case Pi:{this.log=[];break}case Ai:case Si:{let g=-1;this.log.length>0&&(g=this.log[this.log.length-1]._stateID);let k=y.deltalog||[];k=k.filter(I=>I._stateID>g),this.log=[...this.log,...k];break}case Ei:{this.initialState=y.initialState,this.log=y.log||[];break}}return m});u=u!==void 0?Lc(p,u):p,this.store=Gc(this.reducer,this.initialState,u),i||(i=uq),this.transport=i({transportDataCallback:d=>this.receiveTransportData(d),gameKey:t,game:this.game,matchID:s,playerID:o,credentials:a,gameName:this.game.name,numPlayers:r}),this.createDispatchers(),this.chatMessages=[],this.sendChatMessage=d=>{this.transport.sendChatMessage(this.matchID,{id:hv(7),sender:this.playerID,payload:d})}}receiveMatchData(t){this.matchData=t,this.notifySubscribers()}receiveChatMessage(t){this.chatMessages=[...this.chatMessages,t],this.notifySubscribers()}receiveTransportData(t){let[n]=t.args;if(n===this.matchID)switch(t.type){case"sync":{let[,r]=t.args,i=xi(r);this.receiveMatchData(r.filteredMetadata),this.store.dispatch(i);break}case"update":{let[,r,i]=t.args,s=this.store.getState();if(r._stateID>=s._stateID){let o=Iu(r,i);this.store.dispatch(o)}break}case"patch":{let[,r,i,s,o]=t.args,a=this.store.getState()._stateID;if(r!==a)break;let u=Mu(r,i,s,o);this.store.dispatch(u),this.store.getState()._stateID===a&&this.transport.requestSync();break}case"matchData":{let[,r]=t.args;this.receiveMatchData(r);break}case"chat":{let[,r]=t.args;this.receiveChatMessage(r);break}}}notifySubscribers(){Object.values(this.subscribers).forEach(t=>t(this.getState()))}overrideGameState(t){this.gameStateOverride=t,this.notifySubscribers()}start(){this.transport.connect(),this._running=!0,this.manager.register(this)}stop(){this.transport.disconnect(),this._running=!1,this.manager.unregister(this)}subscribe(t){let n=Object.keys(this.subscribers).length;return this.subscribers[n]=t,this.transport.subscribeToConnectionStatus(()=>this.notifySubscribers()),(this._running||!this.multiplayer)&&t(this.getState()),()=>{delete this.subscribers[n]}}getInitialState(){return this.initialState}getState(){let t=this.store.getState();if(this.gameStateOverride!==null&&(t=this.gameStateOverride),t===null)return t;let n=!0,r=this.game.flow.isPlayerActive(t.G,t.ctx,this.playerID);return this.multiplayer&&!r&&(n=!1),!this.multiplayer&&this.playerID!==null&&this.playerID!==void 0&&!r&&(n=!1),t.ctx.gameover!==void 0&&(n=!1),this.multiplayer||(t={...t,G:this.game.playerView({G:t.G,ctx:t.ctx,playerID:this.playerID}),plugins:Rv(t,this)}),{...t,log:this.log,isActive:n,isConnected:this.transport.isConnected}}createDispatchers(){this.moves=lq(this.game.moveNames,this.store,this.playerID,this.credentials,this.multiplayer),this.events=fq(this.game.flow.enabledEventNames,this.store,this.playerID,this.credentials,this.multiplayer),this.plugins=pq(this.game.pluginNames,this.store,this.playerID,this.credentials,this.multiplayer)}updatePlayerID(t){this.playerID=t,this.createDispatchers(),this.transport.updatePlayerID(t),this.notifySubscribers()}updateMatchID(t){this.matchID=t,this.createDispatchers(),this.transport.updateMatchID(t),this.notifySubscribers()}updateCredentials(t){this.credentials=t,this.createDispatchers(),this.transport.updateCredentials(t),this.notifySubscribers()}};function Hc(e){return new zc(e)}var R8=he(nn());var j8=he(ji());var q8=he(so());var G8=he(nn());var F8=he(ji());var U8=he(so());var ct=Object.create(null);ct.open="0";ct.close="1";ct.ping="2";ct.pong="3";ct.message="4";ct.upgrade="5";ct.noop="6";var $i=Object.create(null);Object.keys(ct).forEach(e=>{$i[ct[e]]=e});var Xi={type:"error",data:"parser error"};var Gw=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Lw=typeof ArrayBuffer=="function",Fw=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Qi=({type:e,data:t},n,r)=>Gw&&t instanceof Blob?n?r(t):Dw(t,r):Lw&&(t instanceof ArrayBuffer||Fw(t))?n?r(t):Dw(new Blob([t]),r):r(ct[e]+(t||"")),Dw=(e,t)=>{let n=new FileReader;return n.onload=function(){let r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function Bw(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var Wc;function Uw(e,t){if(Gw&&e.data instanceof Blob)return e.data.arrayBuffer().then(Bw).then(t);if(Lw&&(e.data instanceof ArrayBuffer||Fw(e.data)))return t(Bw(e.data));Qi(e,!1,n=>{Wc||(Wc=new TextEncoder),t(Wc.encode(n))})}var Vw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Zi=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<Vw.length;e++)Zi[Vw.charCodeAt(e)]=e;var zw=e=>{let t=e.length*.75,n=e.length,r,i=0,s,o,a,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);let c=new ArrayBuffer(t),l=new Uint8Array(c);for(r=0;r<n;r+=4)s=Zi[e.charCodeAt(r)],o=Zi[e.charCodeAt(r+1)],a=Zi[e.charCodeAt(r+2)],u=Zi[e.charCodeAt(r+3)],l[i++]=s<<2|o>>4,l[i++]=(o&15)<<4|a>>2,l[i++]=(a&3)<<6|u&63;return c};var dq=typeof ArrayBuffer=="function",es=(e,t)=>{if(typeof e!="string")return{type:"message",data:Kw(e,t)};let n=e.charAt(0);return n==="b"?{type:"message",data:hq(e.substring(1),t)}:$i[n]?e.length>1?{type:$i[n],data:e.substring(1)}:{type:$i[n]}:Xi},hq=(e,t)=>{if(dq){let n=zw(e);return Kw(n,t)}else return{base64:!0,data:e}},Kw=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}};var Hw="",Ww=(e,t)=>{let n=e.length,r=new Array(n),i=0;e.forEach((s,o)=>{Qi(s,!1,a=>{r[o]=a,++i===n&&t(r.join(Hw))})})},Jw=(e,t)=>{let n=e.split(Hw),r=[];for(let i=0;i<n.length;i++){let s=es(n[i],t);if(r.push(s),s.type==="error")break}return r};function Yw(){return new TransformStream({transform(e,t){Uw(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let s=new DataView(i.buffer);s.setUint8(0,126),s.setUint16(1,r)}else{i=new Uint8Array(9);let s=new DataView(i.buffer);s.setUint8(0,127),s.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var Jc;function Oo(e){return e.reduce((t,n)=>t+n.length,0)}function So(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function $w(e,t){Jc||(Jc=new TextDecoder);let n=[],r=0,i=-1,s=!1;return new TransformStream({transform(o,a){for(n.push(o);;){if(r===0){if(Oo(n)<1)break;let u=So(n,1);s=(u[0]&128)===128,i=u[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(Oo(n)<2)break;let u=So(n,2);i=new DataView(u.buffer,u.byteOffset,u.length).getUint16(0),r=3}else if(r===2){if(Oo(n)<8)break;let u=So(n,8),c=new DataView(u.buffer,u.byteOffset,u.length),l=c.getUint32(0);if(l>Math.pow(2,21)-1){a.enqueue(Xi);break}i=l*Math.pow(2,32)+c.getUint32(4),r=3}else{if(Oo(n)<i)break;let u=So(n,i);a.enqueue(es(s?u:Jc.decode(u),t)),r=0}if(i===0||i>e){a.enqueue(Xi);break}}}})}var Yc=4;function ye(e){if(e)return mq(e)}function mq(e){for(var t in ye.prototype)e[t]=ye.prototype[t];return e}ye.prototype.on=ye.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};ye.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};ye.prototype.off=ye.prototype.removeListener=ye.prototype.removeAllListeners=ye.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+e],this};ye.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this};ye.prototype.emitReserved=ye.prototype.emit;ye.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};ye.prototype.hasListeners=function(e){return!!this.listeners(e).length};var Dt=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ue=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Xw="arraybuffer";function Ao(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}var gq=Ue.setTimeout,yq=Ue.clearTimeout;function Bt(e,t){t.useNativeTimers?(e.setTimeoutFn=gq.bind(Ue),e.clearTimeoutFn=yq.bind(Ue)):(e.setTimeoutFn=Ue.setTimeout.bind(Ue),e.clearTimeoutFn=Ue.clearTimeout.bind(Ue))}var vq=1.33;function Qw(e){return typeof e=="string"?bq(e):Math.ceil((e.byteLength||e.size)*vq)}function bq(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function xo(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Zw(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function e1(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let s=n[r].split("=");t[decodeURIComponent(s[0])]=decodeURIComponent(s[1])}return t}var To=class extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}},Gt=class extends ye{constructor(t){super(),this.writable=!1,Bt(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new To(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let n=es(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){let t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){let n=Zw(t);return n.length?"?"+n:""}};var ts=class extends Gt{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Jw(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Ww(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=xo()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}};var t1=!1;try{t1=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var n1=t1;function wq(){}var $c=class extends ts{constructor(t){if(super(t),typeof location<"u"){let n=location.protocol==="https:",r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){let r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,s)=>{this.onError("xhr post error",i,s)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}},Xt=class e extends ye{constructor(t,n,r){super(),this.createRequest=t,Bt(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;let n=Ao(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=wq,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Xt.requestsCount=0;Xt.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",r1);else if(typeof addEventListener=="function"){let e="onpagehide"in Ue?"pagehide":"unload";addEventListener(e,r1,!1)}}function r1(){for(let e in Xt.requests)Xt.requests.hasOwnProperty(e)&&Xt.requests[e].abort()}var _q=function(){let e=i1({xdomain:!1});return e&&e.responseType!==null}(),Qt=class extends $c{constructor(t){super(t);let n=t&&t.forceBase64;this.supportsBinary=_q&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Xt(i1,this.uri(),t)}};function i1(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||n1))return new XMLHttpRequest}catch{}if(!t)try{return new Ue[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var s1=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",Qc=class extends Gt{get name(){return"websocket"}doOpen(){let t=this.uri(),n=this.opts.protocols,r=s1?{}:Ao(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){let r=t[n],i=n===t.length-1;Qi(r,this.supportsBinary,s=>{try{this.doWrite(r,s)}catch{}i&&Dt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=xo()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}},Xc=Ue.WebSocket||Ue.MozWebSocket,Zt=class extends Qc{createSocket(t,n,r){return s1?new Xc(t,n,r):n?new Xc(t,n):new Xc(t)}doWrite(t,n){this.ws.send(n)}};var or=class extends Gt{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{let n=$w(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=Yw();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();let s=()=>{r.read().then(({done:a,value:u})=>{a||(this.onPacket(u),s())}).catch(a=>{})};s();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){let r=t[n],i=n===t.length-1;this._writer.write(r).then(()=>{i&&Dt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var Zc={websocket:Zt,webtransport:or,polling:Qt};var kq=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Pq=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ar(e){if(e.length>8e3)throw"URI too long";let t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=kq.exec(e||""),s={},o=14;for(;o--;)s[Pq[o]]=i[o]||"";return n!=-1&&r!=-1&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=Eq(s,s.path),s.queryKey=Oq(s,s.query),s}function Eq(e,t){let n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function Oq(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,s){i&&(n[i]=s)}),n}var el=typeof addEventListener=="function"&&typeof removeEventListener=="function",Mo=[];el&&addEventListener("offline",()=>{Mo.forEach(e=>e())},!1);var En=class e extends ye{constructor(t,n){if(super(),this.binaryType=Xw,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){let r=ar(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=ar(n.host).host);Bt(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{let i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=e1(this.opts.query)),el&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Mo.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){let n=Object.assign({},this.opts.query);n.EIO=Yc,n.transport=t,this.id&&(n.sid=this.id);let r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",e.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){let i=this.writeBuffer[r].data;if(i&&(n+=Qw(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Dt(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;let s={type:t,data:n,options:r};this.emitReserved("packetCreate",s),this.writeBuffer.push(s),i&&this.once("flush",i),this.flush()}close(){let t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),el&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let r=Mo.indexOf(this._offlineEventListener);r!==-1&&Mo.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}};En.protocol=Yc;var Io=class extends En{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;En.priorWebsocketSuccess=!1;let i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;En.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(l(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{let p=new Error("probe error");p.transport=n.name,this.emitReserved("upgradeError",p)}}))};function s(){r||(r=!0,l(),n.close(),n=null)}let o=f=>{let p=new Error("probe error: "+f);p.transport=n.name,s(),this.emitReserved("upgradeError",p)};function a(){o("transport closed")}function u(){o("socket closed")}function c(f){n&&f.name!==n.name&&s()}let l=()=>{n.removeListener("open",i),n.removeListener("error",o),n.removeListener("close",a),this.off("close",u),this.off("upgrading",c)};n.once("open",i),n.once("error",o),n.once("close",a),this.once("close",u),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}},ur=class extends Io{constructor(t,n={}){let r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>Zc[i]).filter(i=>!!i)),super(t,r)}};var Y6=ur.protocol;function o1(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=ar(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";let s=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+s+":"+r.port+t,r.href=r.protocol+"://"+s+(n&&n.port===r.port?"":":"+r.port),r}var ol={};ll(ol,{Decoder:()=>il,Encoder:()=>rl,PacketType:()=>X,isPacketValid:()=>jq,protocol:()=>f1});var Aq=typeof ArrayBuffer=="function",xq=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,a1=Object.prototype.toString,Tq=typeof Blob=="function"||typeof Blob<"u"&&a1.call(Blob)==="[object BlobConstructor]",Mq=typeof File=="function"||typeof File<"u"&&a1.call(File)==="[object FileConstructor]";function rs(e){return Aq&&(e instanceof ArrayBuffer||xq(e))||Tq&&e instanceof Blob||Mq&&e instanceof File}function ns(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(ns(e[n]))return!0;return!1}if(rs(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return ns(e.toJSON(),!0);for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&ns(e[n]))return!0;return!1}function u1(e){let t=[],n=e.data,r=e;return r.data=tl(n,t),r.attachments=t.length,{packet:r,buffers:t}}function tl(e,t){if(!e)return e;if(rs(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=tl(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=tl(e[r],t));return n}return e}function c1(e,t){return e.data=nl(e.data,t),delete e.attachments,e}function nl(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=nl(e[n],t);else if(typeof e=="object")for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=nl(e[n],t));return e}var l1=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],f1=5,X;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(X||(X={}));var rl=class{constructor(t){this.replacer=t}encode(t){return(t.type===X.EVENT||t.type===X.ACK)&&ns(t)?this.encodeAsBinary({type:t.type===X.EVENT?X.BINARY_EVENT:X.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===X.BINARY_EVENT||t.type===X.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){let n=u1(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}},il=class e extends ye{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);let r=n.type===X.BINARY_EVENT;r||n.type===X.BINARY_ACK?(n.type=r?X.EVENT:X.ACK,this.reconstructor=new sl(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(rs(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(X[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===X.BINARY_EVENT||r.type===X.BINARY_ACK){let s=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);let o=t.substring(s,n);if(o!=Number(o)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(o)}if(t.charAt(n+1)==="/"){let s=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(s,n)}else r.nsp="/";let i=t.charAt(n+1);if(i!==""&&Number(i)==i){let s=n+1;for(;++n;){let o=t.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===t.length)break}r.id=Number(t.substring(s,n+1))}if(t.charAt(++n)){let s=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,s))r.data=s;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case X.CONNECT:return Co(n);case X.DISCONNECT:return n===void 0;case X.CONNECT_ERROR:return typeof n=="string"||Co(n);case X.EVENT:case X.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&l1.indexOf(n[0])===-1);case X.ACK:case X.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},sl=class{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){let n=c1(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Iq(e){return typeof e=="string"}var Cq=Number.isInteger||function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e};function Rq(e){return e===void 0||Cq(e)}function Co(e){return Object.prototype.toString.call(e)==="[object Object]"}function Nq(e,t){switch(e){case X.CONNECT:return t===void 0||Co(t);case X.DISCONNECT:return t===void 0;case X.EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&l1.indexOf(t[0])===-1);case X.ACK:return Array.isArray(t);case X.CONNECT_ERROR:return typeof t=="string"||Co(t);default:return!1}}function jq(e){return Iq(e.nsp)&&Rq(e.id)&&Nq(e.type,e.data)}function Ze(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var qq=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),cr=class extends ye{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[Ze(t,"open",this.onopen.bind(this)),Ze(t,"packet",this.onpacket.bind(this)),Ze(t,"error",this.onerror.bind(this)),Ze(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,i,s;if(qq.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;let o={type:X.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){let l=this.ids++,f=n.pop();this._registerAckCallback(l,f),o.id=l}let a=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,u=this.connected&&!(!((s=this.io.engine)===null||s===void 0)&&s._hasPingExpired());return this.flags.volatile&&!a||(u?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,n){var r;let i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}let s=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);n.call(this,new Error("operation has timed out"))},i),o=(...a)=>{this.io.clearTimeoutFn(s),n.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...n){return new Promise((r,i)=>{let s=(o,a)=>o?i(o):r(a);s.withError=!0,n.push(s),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());let r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...s)=>(this._queue[0],i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...s)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;let n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:X.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){let r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case X.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case X.EVENT:case X.BINARY_EVENT:this.onevent(t);break;case X.ACK:case X.BINARY_ACK:this.onack(t);break;case X.DISCONNECT:this.ondisconnect();break;case X.CONNECT_ERROR:this.destroy();let r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){let n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let n=this._anyListeners.slice();for(let r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){let n=this,r=!1;return function(...i){r||(r=!0,n.packet({type:X.ACK,id:t,data:i}))}}onack(t){let n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:X.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let n=this._anyOutgoingListeners.slice();for(let r of n)r.apply(this,t.data)}}};function On(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}On.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};On.prototype.reset=function(){this.attempts=0};On.prototype.setMin=function(e){this.ms=e};On.prototype.setMax=function(e){this.max=e};On.prototype.setJitter=function(e){this.jitter=e};var lr=class extends ye{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Bt(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new On({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;let i=n.parser||ol;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new ur(this.uri,this.opts);let n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;let i=Ze(n,"open",function(){r.onopen(),t&&t()}),s=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=Ze(n,"error",s);if(this._timeout!==!1){let a=this._timeout,u=this.setTimeoutFn(()=>{i(),s(new Error("timeout")),n.close()},a);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(i),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(Ze(t,"ping",this.onping.bind(this)),Ze(t,"data",this.ondata.bind(this)),Ze(t,"error",this.onerror.bind(this)),Ze(t,"close",this.onclose.bind(this)),Ze(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Dt(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new cr(this,t,n),this.nsps[t]=r),r}_destroy(t){let n=Object.keys(this.nsps);for(let r of n)if(this.nsps[r].active)return;this._close()}_packet(t){let n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let n=this.backoff.duration();this._reconnecting=!0;let r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var is={};function ss(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};let n=o1(e,t.path||"/socket.io"),r=n.source,i=n.id,s=n.path,o=is[i]&&s in is[i].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o,u;return a?u=new lr(r,t):(is[i]||(is[i]=new lr(r,t)),u=is[i]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(ss,{Manager:lr,Socket:cr,io:ss,connect:ss});var p1=ss,al=class extends sr{constructor({socket:t,socketOpts:n,server:r,...i}){super(i),this.server=r,this.socket=t,this.socketOpts=n}sendAction(t,n){let r=[n,t._stateID,this.matchID,this.playerID];this.socket.emit("update",...r)}sendChatMessage(t,n){let r=[t,n,this.credentials];this.socket.emit("chat",...r)}connect(){if(!this.socket)if(this.server){let t=this.server;t.search(/^https?:\/\//)==-1&&(t="http://"+this.server),t.slice(-1)!="/"&&(t=t+"/"),this.socket=p1(t+this.gameName,this.socketOpts)}else this.socket=p1("/"+this.gameName,this.socketOpts);this.socket.on("patch",(t,n,r,i,s)=>{this.notifyClient({type:"patch",args:[t,n,r,i,s]})}),this.socket.on("update",(t,n,r)=>{this.notifyClient({type:"update",args:[t,n,r]})}),this.socket.on("sync",(t,n)=>{this.notifyClient({type:"sync",args:[t,n]})}),this.socket.on("matchData",(t,n)=>{this.notifyClient({type:"matchData",args:[t,n]})}),this.socket.on("chat",(t,n)=>{this.notifyClient({type:"chat",args:[t,n]})}),this.socket.on("connect",()=>{this.requestSync(),this.setConnectionStatus(!0)}),this.socket.on("disconnect",()=>{this.setConnectionStatus(!1)})}disconnect(){this.socket.close(),this.socket=null,this.setConnectionStatus(!1)}requestSync(){if(this.socket){let t=[this.matchID,this.playerID,this.credentials,this.numPlayers];this.socket.emit("sync",...t)}}updateMatchID(t){this.matchID=t,this.requestSync()}updatePlayerID(t){this.playerID=t,this.requestSync()}updateCredentials(t){this.credentials=t,this.requestSync()}};function ul({server:e,socketOpts:t}={}){return n=>new al({server:e,socketOpts:t,...n})}var D9=he(nn()),B9=he(ji());function Ro(e){let t=e;if(t?.arguments){let n={...t,arguments:Object.entries(t.arguments).reduce((r,[i,s])=>({...r,[i]:s.abstract?s:s.entityId}),{})};return JSON.parse(He(n,{deduplicateInstances:!1}))}else return e}var Bq={PlaceNew:["destination"],RemoveEntity:["entity"],MoveEntity:["entity","destination"],TakeFrom:["source","destination"],SetState:["entity","state"]};function fr(e,t){let n=Bq[t.moveType];return n?n.filter(r=>t.arguments[r]?.playerChoice).map(r=>({argName:r,getClickable:r==="state"?()=>t.arguments[r].possibleValues.map(i=>({abstract:!0,...t.arguments[r],value:i})):i=>Je(e).findAll(e,t.arguments[r],i)})):[]}function No(e,t,n,r){let i=fr(e,t).map(s=>s.argName);return{arguments:n.reduce((s,o,a)=>({...s,[i[a]]:o}),{})}}var jo=class{constructor(t){this.options=t,this.game=t.boardgameIOGame||yi(t.gameRules,t.gameName??""),t.boardgameIOGame||(this.moveBuilder={targets:[],stepIndex:0,eliminatedMoves:[]},this.optimisticWinner=null)}connect(){let{server:t,numPlayers:n,debug:r={collapseOnLoad:!0,impl:Hi},matchID:i,playerID:s,credentials:o,multiplayer:a=ul({server:t,socketOpts:{transports:["websocket","polling"]}})}=this.options;try{let u=o?{game:this.game,multiplayer:a,matchID:i,playerID:s??void 0,credentials:o,numPlayers:n,debug:r}:{game:this.game,numPlayers:n,debug:r};return this.client=Hc(u),this.client.subscribe(()=>this.update()),this.client.start(),this}catch(u){let c=u;console.error("Failed to join game:",c?.message??u),c?.stack&&console.error(c.stack)}}update(){this.options.onClientUpdate?.()}getState(){let t=this.client?.getState();if(!t)return{};let n=this.options.boardgameIOGame?t:{...t,G:Ut(JSON.stringify(t.G),ht)},r=this.optimisticWinner??n?.ctx?.gameover,i=r?[]:ni(n,this.client);if(this.options.boardgameIOGame)return{state:n,gameover:r,moves:this.client.moves,currentMoves:i};let s=Object.entries(i).reduce((u,[c,l])=>{let f=p=>{this.client.moves[c](Ro(p))};return f.moveInstance=l.moveInstance,{...u,[c]:f}},{}),{allClickable:o,_possibleMoveMeta:a}=Lq(n,s,this.moveBuilder);return{state:n,gameover:r,allClickable:o,_wrappedMoves:s,_possibleMoveMeta:a}}doStep(t){if(this.options.boardgameIOGame)return;let{state:n,_wrappedMoves:r,_possibleMoveMeta:i}=this.getState(),s=t.abstract?t:n.G.bank.locate(t.entityId),o=Object.entries(i).filter(([u,c])=>!Gq(c.clickableForMove,s)).map(([u])=>u).concat(this.moveBuilder.eliminatedMoves);if(o.length===Object.keys(r).length){console.error("invalid move with target:",s?.rule);return}let a=Object.entries(i).filter(([u])=>!o.includes(u));if(Fq(n,r,a,this.moveBuilder.stepIndex)){let[u]=a[0],c=r[u],l=No(n,c.moveInstance.rule,[...this.moveBuilder.targets,s],{moveInstance:c.moveInstance});this.optimisticWinner=Uq(n,this.game,c.moveInstance,l),c(l),this.moveBuilder={targets:[],stepIndex:0,eliminatedMoves:[]}}else this.moveBuilder={eliminatedMoves:o,stepIndex:this.moveBuilder.stepIndex+1,targets:[...this.moveBuilder.targets,s]};this.update()}reset(){this.options.boardgameIOGame||(this.moveBuilder={targets:[],stepIndex:0,eliminatedMoves:[]},this.optimisticWinner=null,this.update())}undoStep(){this.options.boardgameIOGame||(this.moveBuilder.targets.length&&(this.moveBuilder={targets:this.moveBuilder.targets.slice(0,-1),stepIndex:Math.max(0,this.moveBuilder.stepIndex-1),eliminatedMoves:[]}),this.update())}};function Gq(e,t){return t.abstract?[...e].some(n=>n.abstract&&n.value===t.value):e.has(t)}function Lq(e,t,n){let{eliminatedMoves:r,stepIndex:i}=n,s={},o=new Set;return Object.entries(t).filter(([a])=>!r.includes(a)).forEach(([a,u])=>{let c=pe(e,{...u.moveInstance.rule,moveName:a}),l={moveInstance:u.moveInstance,moveArguments:c.arguments},f=n.targets.map(m=>m.abstract?m:e.G.bank.locate(m.entityId)),p=No(e,c,f,l);l.moveArguments={...l.moveArguments,...p.arguments};let d=Oe(e,c.conditions,{},l).conditionsAreMet,h=fr(e,c),y=new Set(d&&h?.[i]?.getClickable(l)||[]);s[a]={clickableForMove:y},y.forEach(m=>o.add(m))}),{_possibleMoveMeta:s,allClickable:o}}function Fq(e,t,n,r){return n.length===1&&fr(e,t[n[0][0]].moveInstance.rule).length===r+1}function Uq(e,t,n,r){let i=ei(e,Ro(r),{moveInstance:n}),s=t.endIf;return s?.({...e,G:JSON.parse(He(i))})}return w1(Vq);})();
|
|
33
33
|
/*! Bundled license information:
|
|
34
34
|
|
|
35
35
|
expr-eval/dist/index.mjs:
|