board-game-engine 2.0.1 → 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/README.md +2 -2
- package/dist/board-game-engine.cjs +1 -1
- package/dist/board-game-engine.js +1 -1
- package/dist/board-game-engine.min.js +1 -1
- package/dist/board-game-engine.mjs +1 -1
- package/dist/client/client.d.ts +2 -2
- package/dist/client/client.d.ts.map +1 -1
- 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 +1 -1
- package/playwright-report/index.html +1 -1
- package/src/client/client.ts +2 -3
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ A client that runs a B.A.G.E.L.-defined game
|
|
|
52
52
|
|
|
53
53
|
| Option | Type | Description |
|
|
54
54
|
|--------|------|-------------|
|
|
55
|
-
| `gameRules` |
|
|
55
|
+
| `gameRules` | `GameFactoryInput` | B.A.G.E.L. game definition object (same shape as for `gameFactory`) |
|
|
56
56
|
| `numPlayers` | number | Number of players in client-side game. |
|
|
57
57
|
| `onClientUpdate` | function | Callback after state updates (e.g. to re-render UI). |
|
|
58
58
|
| `debug` | object | boardgame.io debug panel config; e.g. `false`. |
|
|
@@ -92,7 +92,7 @@ In non-B.A.G.E.L. games, `doStep(target)` is not used. instead, the boardgame.io
|
|
|
92
92
|
import { Client } from 'board-game-engine'
|
|
93
93
|
|
|
94
94
|
const client = new Client({
|
|
95
|
-
gameRules:
|
|
95
|
+
gameRules: myGameRules,
|
|
96
96
|
numPlayers: 2,
|
|
97
97
|
onClientUpdate: () => render(client.getState())
|
|
98
98
|
})
|
|
@@ -27155,7 +27155,7 @@ function createPayload(bgioState, moveRule, targets, _context) {
|
|
|
27155
27155
|
var Client2 = class {
|
|
27156
27156
|
constructor(options) {
|
|
27157
27157
|
this.options = options;
|
|
27158
|
-
this.game = options.boardgameIOGame || gameFactory(
|
|
27158
|
+
this.game = options.boardgameIOGame || gameFactory(options.gameRules, options.gameName ?? "");
|
|
27159
27159
|
if (!options.boardgameIOGame) {
|
|
27160
27160
|
this.moveBuilder = { targets: [], stepIndex: 0, eliminatedMoves: [] };
|
|
27161
27161
|
this.optimisticWinner = null;
|
|
@@ -27155,7 +27155,7 @@ ${message}`);
|
|
|
27155
27155
|
var Client2 = class {
|
|
27156
27156
|
constructor(options) {
|
|
27157
27157
|
this.options = options;
|
|
27158
|
-
this.game = options.boardgameIOGame || gameFactory(
|
|
27158
|
+
this.game = options.boardgameIOGame || gameFactory(options.gameRules, options.gameName ?? "");
|
|
27159
27159
|
if (!options.boardgameIOGame) {
|
|
27160
27160
|
this.moveBuilder = { targets: [], stepIndex: 0, eliminatedMoves: [] };
|
|
27161
27161
|
this.optimisticWinner = null;
|
|
@@ -29,7 +29,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
29
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
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(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: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);})();
|
|
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:
|
|
@@ -27145,7 +27145,7 @@ function createPayload(bgioState, moveRule, targets, _context) {
|
|
|
27145
27145
|
var Client2 = class {
|
|
27146
27146
|
constructor(options) {
|
|
27147
27147
|
this.options = options;
|
|
27148
|
-
this.game = options.boardgameIOGame || gameFactory(
|
|
27148
|
+
this.game = options.boardgameIOGame || gameFactory(options.gameRules, options.gameName ?? "");
|
|
27149
27149
|
if (!options.boardgameIOGame) {
|
|
27150
27150
|
this.moveBuilder = { targets: [], stepIndex: 0, eliminatedMoves: [] };
|
|
27151
27151
|
this.optimisticWinner = null;
|
package/dist/client/client.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ import { Client as BoardgameIOClient } from "@mnbroatch/boardgame.io/client";
|
|
|
2
2
|
import { Debug } from "@mnbroatch/boardgame.io/debug";
|
|
3
3
|
import { SocketIO } from "@mnbroatch/boardgame.io/multiplayer";
|
|
4
4
|
import type { BoardGameEngineGame } from "../game-factory/game-factory.js";
|
|
5
|
+
import type { GameFactoryInput } from "../types/bagel-types.js";
|
|
5
6
|
export interface ClientOptions {
|
|
6
7
|
boardgameIOGame?: BoardGameEngineGame;
|
|
7
|
-
|
|
8
|
-
gameRules?: string;
|
|
8
|
+
gameRules?: GameFactoryInput;
|
|
9
9
|
gameName?: string;
|
|
10
10
|
server?: string;
|
|
11
11
|
numPlayers?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAG/D,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AAG/D,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,iCAAiC,CAAC;AAC1F,OAAO,KAAK,EAAa,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAY3E,MAAM,WAAW,aAAa;IAC5B,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE;QACN,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,IAAI,CAAC,EAAE,OAAO,KAAK,CAAC;KACrB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,UAAU,WAAW;IACnB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,qBAAa,MAAM;IACjB,OAAO,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;gBAErB,OAAO,EAAE,aAAa;IAWnC,OAAO;IAsCP,MAAM;IAIN,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA8HoD,GAAG,CAAC,OAAO,CAAC;;;;;IAtFxE,MAAM,CAAE,OAAO,EAAE,OAAO;IAuDxB,KAAK;IAOL,QAAQ;CAWT"}
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
let gameRules;
|
|
19
19
|
try {
|
|
20
20
|
const res = await fetch('/examples/checkers.json');
|
|
21
|
-
|
|
22
|
-
gameRules = JSON.stringify(rules);
|
|
21
|
+
gameRules = await res.json();
|
|
23
22
|
} catch (e) {
|
|
24
23
|
out.textContent = 'Fetch failed: ' + (e && e.message);
|
|
25
24
|
return;
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
let gameRules;
|
|
19
19
|
try {
|
|
20
20
|
const res = await fetch('/e2e/fixtures/minimal-game.json');
|
|
21
|
-
|
|
22
|
-
gameRules = JSON.stringify(rules);
|
|
21
|
+
gameRules = await res.json();
|
|
23
22
|
} catch (e) {
|
|
24
23
|
out.textContent = 'Fetch failed: ' + (e && e.message);
|
|
25
24
|
return;
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
let gameRules;
|
|
19
19
|
try {
|
|
20
20
|
const res = await fetch('/examples/tic-tac-toe.json');
|
|
21
|
-
|
|
22
|
-
gameRules = JSON.stringify(rules);
|
|
21
|
+
gameRules = await res.json();
|
|
23
22
|
} catch (e) {
|
|
24
23
|
out.textContent = 'Fetch failed: ' + (e && e.message);
|
|
25
24
|
return;
|
package/examples/index.html
CHANGED
package/package.json
CHANGED
|
@@ -82,4 +82,4 @@ Error generating stack: `+a.message+`
|
|
|
82
82
|
<div id='root'></div>
|
|
83
83
|
</body>
|
|
84
84
|
</html>
|
|
85
|
-
<script id="playwrightReportBase64" type="application/zip">data:application/zip;base64,UEsDBBQAAAgIAGJieFx1KcgIyg0AAIiQAAAZAAAANDI4MGE0YzhkM2NiMzBmNjgzNWEuanNvbu2df2/buBnH3wqnf2wDjipSEkUa6BXXrtc7YDsM194w7Nq7o2Xa0UWRAolum7UB9h72DvdKBkpMI9OyLVGS4zXJX4kjPyS/D39++JD6ZC2jmP+wsGaWh4jDvJAs3HDuOktMXJ9Z0+L/P7JLbs2s+Yrb+RUP7T9ya2oJnovcmv3yqfhtp4kzgn3sBYx5nEKEPYcuAyS/HolYGhVZ9D5iMVixSw7ilC1ywJIFWHHxWjDBxxOQcbHOkhzk8m9ral1l6R88FCpTyyjjy/SjNbXiNGQiShNr9qnI9VaO4yjh1gySqRWm8foysWbBzdRarDP1NUghmlosSVJRfCJL925qCbZSv6VrEaZFqvzjFQ8FX8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qAYY4i3eLYHatc3BR3ArjuP+0j/AVBLAQI/AxQAAAgIAGJieFx1KcgIyg0AAIiQAAAZAAAAAAAAAAAAAAC0gQAAAAA0MjgwYTRjOGQzY2IzMGY2ODM1YS5qc29uUEsBAj8DFAAACAgAYmJ4XLXRt9DMBQAAEScAABkAAAAAAAAAAAAAALSBAQ4AAGZmYzA5MWNmOGIxZTU3NjhmYzExLmpzb25QSwECPwMUAAAICABiYnhcRML2SocFAAD6JQAAGQAAAAAAAAAAAAAAtIEEFAAAYzA4YWU1MjEzODU3NTAzNGE1YmIuanNvblBLAQI/AxQAAAgIAGJieFxAw6TW1wMAAFkRAAALAAAAAAAAAAAAAAC0gcIZAAByZXBvcnQuanNvblBLBQYAAAAABAAEAA4BAADCHQAAAAA=</script>
|
|
85
|
+
<script id="playwrightReportBase64" type="application/zip">data:application/zip;base64,UEsDBBQAAAgIAFZneFwibh59yA0AAICQAAAZAAAANDI4MGE0YzhkM2NiMzBmNjgzNWEuanNvbu2df2/buBnH3wqnf2wDjipSJEUZ6AXXrtc7YDsM194w7Nq7o2Xa0cWRAolum6UB9h72DvdKBkpKI9OyLepXvTb5K3Hkh+T34c8PH1K31jJcix8W1szCiDkcB2zhBnPXWVLmEm5Ns///yK+ENbPmK2Gn1yKw/0itqSVFKlNr9stt9tteE2eMEoo9zrHwIaLY8ZceUl8P5VoZlUn4LuRrsOJXAqxjvkgBjxZgJeQryaUYT0Ai5CaJUpCqv62pdZ3Ef4hAFplaholYxh+sqbWOAy7DOLJmt1mud3K8DiNhzSCbWkG83lxF1sy7m1qLTVJ8DbquN7V4FMUy+0SV7u3UknxV/BZvZBBnqYoP1yKQYqGyw+WFNfvFehbzZPGSX4kX0Uol9HZqJSLdrAuR9GRSyRP5OsysIQfRM8c9Q/g19GeEzVzPxr77T0uZkMmNNXPUF8R1oXch3TOxjBMBvo/jS1W84xapsljOCPGq7H4XfpCbRIA31jyJ36cieWPVME8czTxBtMr6X/gmCi5AYbqWYV837D4Yfju1uJ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FZneFzY7CB6hwUAAPklAAAZAAAAAAAAAAAAAAC0gQEUAABjMDhhZTUyMTM4NTc1MDM0YTViYi5qc29uUEsBAj8DFAAACAgAVmd4XEGepYzWAwAAVxEAAAsAAAAAAAAAAAAAALSBvxkAAHJlcG9ydC5qc29uUEsFBgAAAAAEAAQADgEAAL4dAAAAAA==</script>
|
package/src/client/client.ts
CHANGED
|
@@ -18,8 +18,7 @@ import createPayload from "../utils/create-payload.js";
|
|
|
18
18
|
|
|
19
19
|
export interface ClientOptions {
|
|
20
20
|
boardgameIOGame?: BoardGameEngineGame;
|
|
21
|
-
|
|
22
|
-
gameRules?: string;
|
|
21
|
+
gameRules?: GameFactoryInput;
|
|
23
22
|
gameName?: string;
|
|
24
23
|
server?: string;
|
|
25
24
|
numPlayers?: number;
|
|
@@ -50,7 +49,7 @@ export class Client {
|
|
|
50
49
|
constructor (options: ClientOptions) {
|
|
51
50
|
this.options = options;
|
|
52
51
|
this.game = options.boardgameIOGame
|
|
53
|
-
|| gameFactory(
|
|
52
|
+
|| gameFactory(options.gameRules!, options.gameName ?? "");
|
|
54
53
|
|
|
55
54
|
if (!options.boardgameIOGame) {
|
|
56
55
|
this.moveBuilder = { targets: [], stepIndex: 0, eliminatedMoves: [] };
|