omegga 1.2.0 → 1.2.2

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.
Files changed (42) hide show
  1. package/dist/cli/terminal.js +7 -3
  2. package/dist/cli/terminal.js.map +1 -1
  3. package/dist/omegga/matchers/join.js +3 -2
  4. package/dist/omegga/matchers/join.js.map +1 -1
  5. package/dist/omegga/player.js +1 -1
  6. package/dist/omegga/player.js.map +1 -1
  7. package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.d.ts +1 -0
  8. package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js.map +1 -1
  9. package/dist/omegga/server.d.ts +1 -0
  10. package/dist/omegga/server.js +4 -2
  11. package/dist/omegga/server.js.map +1 -1
  12. package/dist/plugin.d.ts +1 -0
  13. package/dist/plugin.js.map +1 -1
  14. package/dist/webserver/backend/api.d.ts +1 -0
  15. package/dist/webserver/backend/api.js.map +1 -1
  16. package/dist/webserver/backend/database.d.ts +2 -0
  17. package/dist/webserver/backend/database.js +21 -3
  18. package/dist/webserver/backend/database.js.map +1 -1
  19. package/dist/webserver/backend/metrics.js +6 -4
  20. package/dist/webserver/backend/metrics.js.map +1 -1
  21. package/package.json +1 -1
  22. package/public/app.html +12 -4
  23. package/public/assets/app-CtCP4WJN.js +6 -0
  24. package/public/assets/{app-CRu25Om6.js.map → app-CtCP4WJN.js.map} +1 -1
  25. package/public/assets/auth-CvxEWAMc.js +2 -0
  26. package/public/assets/auth-CvxEWAMc.js.map +1 -0
  27. package/public/assets/{index-CtY8r8rg.js → index-BC_vZ56r.js} +6 -5
  28. package/public/assets/index-BC_vZ56r.js.map +1 -0
  29. package/public/assets/index-DYcAgWjJ.js +2 -0
  30. package/public/assets/index-DYcAgWjJ.js.map +1 -0
  31. package/public/assets/shared/@components-B442wlEb.js +2 -0
  32. package/public/assets/shared/@components-B442wlEb.js.map +1 -0
  33. package/public/auth.html +7 -3
  34. package/templates/safe-ts/omegga.d.ts +1 -0
  35. package/public/assets/app-CRu25Om6.js +0 -6
  36. package/public/assets/auth-DdQ5DJ5h.js +0 -2
  37. package/public/assets/auth-DdQ5DJ5h.js.map +0 -1
  38. package/public/assets/index-CtY8r8rg.js.map +0 -1
  39. package/public/assets/index-DaWNRjkx.js +0 -2
  40. package/public/assets/index-DaWNRjkx.js.map +0 -1
  41. package/public/assets/shared/@components-BiaBe0jO.js +0 -2
  42. package/public/assets/shared/@components-BiaBe0jO.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import{c as C}from"./client-C5T7_OK9.js";import{j as e}from"./jsx-runtime-DoEZbXM1.js";import{r as t}from"./index-i4mjW0og.js";import{B as b,M as S,H as I,P as L,I as l,F as B,a as u,L as A}from"./index-DYcAgWjJ.js";import x from"./IconArrowRight-CA5_cccJ.js";import E from"./IconLockOpen-D95XLORK.js";import"./index-c0qeY2gs.js";import"./index-DqHVrEeL.js";import"./jsx-runtime-Bw5QeaCk.js";import"./_commonjsHelpers-CE1G-McA.js";import"./shared/@nanostores_react-HTG3s0lp.js";import"./index-CJ4e7_2M.js";import"./index-CSV4ZXsq.js";import"./IconX-SYtbnYKI.js";import"./IconCheck-Dyq5qyY1.js";const O="/assets/turkey-BW4gu-4u.webp",P=()=>{const[p,i]=t.useState(!0),[r,j]=t.useState(!0),[o,f]=t.useState(""),[s,g]=t.useState(""),[c,y]=t.useState("");t.useEffect(()=>{fetch("/api/v1/first").then(a=>a.json()).then(a=>{j(a),i(!1)})},[]);const d=t.useCallback(async(a,w)=>{i(!0);try{const n=await fetch("/api/v1/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:a,password:w})}),v=await n.json();n.status===200?location.reload():console.error(v.message)}catch(n){console.error("Authentication failed:",n)}i(!1)},[]),m=o.length===0&&s.length===0,h=o.match(/^\w{0,32}$/)&&!m,k=t.useMemo(()=>({top:`${Math.random()*50+25}%`}),[]);return e.jsxs("div",{children:[e.jsx(b,{children:e.jsx("div",{className:"turkey",style:k,children:e.jsx("img",{src:O})})}),e.jsxs(S,{visible:!p,children:[e.jsx(I,{attached:!0,children:"Brickadia Server Login"}),e.jsxs(L,{children:[e.jsx("p",{children:"Welcome to the Omegga Web UI."}),r&&e.jsx("p",{children:"Enter credentials for an Admin user. You can also skip this step if you don't want to use a password."})]}),e.jsxs("div",{className:"popout-inputs",children:[e.jsx(l,{placeholder:"Username",type:"text",value:o,onChange:f}),e.jsx(l,{placeholder:"Password",type:"password",value:s,onChange:g}),r&&e.jsx(l,{placeholder:"Confirm Password",type:"password",value:c,onChange:y})]}),e.jsxs(B,{attached:!0,children:[r&&e.jsxs(u,{main:!0,disabled:!h||c!==s,onClick:()=>d(o,s),children:[e.jsx(x,{})," Create"]}),!r&&e.jsxs(u,{main:!0,disabled:!h,onClick:()=>d(o,s),children:[e.jsx(x,{})," Login"]}),e.jsx("div",{style:{flex:1}}),r&&e.jsxs(u,{warn:!0,disabled:!m||c!==s,onClick:()=>d("",""),children:[e.jsx(E,{})," Skip"]})]}),e.jsx(A,{active:p,blur:!0,size:"huge",children:e.jsx("b",{children:"AUTHORIZING"})})]})]})};C.createRoot(document.getElementById("root")).render(e.jsx(P,{}));
2
+ //# sourceMappingURL=auth-CvxEWAMc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-CvxEWAMc.js","sources":["../../frontend/assets/img/turkey.webp","../../frontend/src/auth/index.tsx"],"sourcesContent":["export default \"__VITE_ASSET__CArnIZrw__\"","import { IconArrowRight, IconLockOpen } from '@tabler/icons-react';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport turkeyImage from '../../assets/img/turkey.webp';\nimport { Background } from '../components/background';\nimport { Button } from '../components/button';\nimport { Footer } from '../components/footer';\nimport { Header } from '../components/header';\nimport { Input } from '../components/input';\nimport { Loader } from '../components/loader';\nimport { Modal } from '../components/modal';\nimport { PopoutContent } from '../components/popout';\n\nconst Auth = () => {\n const [loading, setLoading] = useState(true);\n const [firstLoad, setFirstLoad] = useState(true);\n\n const [username, setUsername] = useState('');\n const [password, setPassword] = useState('');\n const [confirm, setConfirm] = useState('');\n\n useEffect(() => {\n fetch('/api/v1/first')\n .then(response => response.json())\n .then(data => {\n setFirstLoad(data);\n setLoading(false);\n });\n }, []);\n\n const tryAuth = useCallback(async (username: string, password: string) => {\n setLoading(true);\n try {\n const res = await fetch('/api/v1/auth', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({ username, password }),\n });\n const data = await res.json();\n if (res.status === 200) {\n location.reload();\n } else {\n console.error(data.message);\n }\n } catch (error) {\n console.error('Authentication failed:', error);\n }\n setLoading(false);\n }, []);\n\n const authBlank = username.length === 0 && password.length === 0;\n const authOk = username.match(/^\\w{0,32}$/) && !authBlank;\n\n const turkeyStyle = useMemo(\n () => ({ top: `${Math.random() * 50 + 25}%` }),\n [],\n );\n\n return (\n <div>\n <Background>\n <div className=\"turkey\" style={turkeyStyle}>\n <img src={turkeyImage} />\n </div>\n </Background>\n <Modal visible={!loading}>\n <Header attached>Brickadia Server Login</Header>\n <PopoutContent>\n <p>Welcome to the Omegga Web UI.</p>\n {firstLoad && (\n <p>\n Enter credentials for an Admin user. You can also skip this step\n if you don't want to use a password.\n </p>\n )}\n </PopoutContent>\n <div className=\"popout-inputs\">\n <Input\n placeholder=\"Username\"\n type=\"text\"\n value={username}\n onChange={setUsername}\n />\n <Input\n placeholder=\"Password\"\n type=\"password\"\n value={password}\n onChange={setPassword}\n />\n {firstLoad && (\n <Input\n placeholder=\"Confirm Password\"\n type=\"password\"\n value={confirm}\n onChange={setConfirm}\n />\n )}\n </div>\n <Footer attached>\n {firstLoad && (\n <Button\n main\n disabled={!authOk || confirm !== password}\n onClick={() => tryAuth(username, password)}\n >\n <IconArrowRight /> Create\n </Button>\n )}\n {!firstLoad && (\n <Button\n main\n disabled={!authOk}\n onClick={() => tryAuth(username, password)}\n >\n <IconArrowRight /> Login\n </Button>\n )}\n <div style={{ flex: 1 }} />\n {firstLoad && (\n <Button\n warn\n disabled={!authBlank || confirm !== password}\n onClick={() => tryAuth('', '')}\n >\n <IconLockOpen /> Skip\n </Button>\n )}\n </Footer>\n <Loader active={loading} blur size=\"huge\">\n <b>AUTHORIZING</b>\n </Loader>\n </Modal>\n </div>\n );\n};\n\ncreateRoot(document.getElementById('root')!).render(<Auth />);\n"],"names":["turkeyImage","Auth","loading","setLoading","useState","firstLoad","setFirstLoad","username","setUsername","password","setPassword","confirm","setConfirm","useEffect","response","data","tryAuth","useCallback","res","error","authBlank","authOk","turkeyStyle","useMemo","jsx","Background","jsxs","Modal","Header","PopoutContent","Input","Footer","Button","IconArrowRight","IconLockOpen","Loader","createRoot"],"mappings":"klBAAA,MAAAA,EAAe,+BCaTC,EAAO,IAAM,CACjB,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAI,EACrC,CAACC,EAAWC,CAAY,EAAIF,EAAAA,SAAS,EAAI,EAEzC,CAACG,EAAUC,CAAW,EAAIJ,EAAAA,SAAS,EAAE,EACrC,CAACK,EAAUC,CAAW,EAAIN,EAAAA,SAAS,EAAE,EACrC,CAACO,EAASC,CAAU,EAAIR,EAAAA,SAAS,EAAE,EAEzCS,EAAAA,UAAU,IAAM,CACd,MAAM,eAAe,EAClB,KAAKC,GAAYA,EAAS,MAAM,EAChC,KAAKC,GAAQ,CACZT,EAAaS,CAAI,EACjBZ,EAAW,EAAK,CAClB,CAAC,CACL,EAAG,CAAA,CAAE,EAEL,MAAMa,EAAUC,EAAAA,YAAY,MAAOV,EAAkBE,IAAqB,CACxEN,EAAW,EAAI,EACf,GAAI,CACF,MAAMe,EAAM,MAAM,MAAM,eAAgB,CACtC,OAAQ,OACR,QAAS,CACP,eAAgB,kBAAA,EAElB,KAAM,KAAK,UAAU,CAAE,SAAAX,EAAU,SAAAE,EAAU,CAAA,CAC5C,EACKM,EAAO,MAAMG,EAAI,KAAA,EACnBA,EAAI,SAAW,IACjB,SAAS,OAAA,EAET,QAAQ,MAAMH,EAAK,OAAO,CAE9B,OAASI,EAAO,CACd,QAAQ,MAAM,yBAA0BA,CAAK,CAC/C,CACAhB,EAAW,EAAK,CAClB,EAAG,CAAA,CAAE,EAECiB,EAAYb,EAAS,SAAW,GAAKE,EAAS,SAAW,EACzDY,EAASd,EAAS,MAAM,YAAY,GAAK,CAACa,EAE1CE,EAAcC,EAAAA,QAClB,KAAO,CAAE,IAAK,GAAG,KAAK,OAAA,EAAW,GAAK,EAAE,MACxC,CAAA,CAAC,EAGH,cACG,MAAA,CACC,SAAA,CAAAC,EAAAA,IAACC,EAAA,CACC,SAAAD,EAAAA,IAAC,MAAA,CAAI,UAAU,SAAS,MAAOF,EAC7B,SAAAE,EAAAA,IAAC,MAAA,CAAI,IAAKxB,CAAA,CAAa,CAAA,CACzB,EACF,EACA0B,EAAAA,KAACC,EAAA,CAAM,QAAS,CAACzB,EACf,SAAA,CAAAsB,EAAAA,IAACI,EAAA,CAAO,SAAQ,GAAC,SAAA,yBAAsB,SACtCC,EAAA,CACC,SAAA,CAAAL,EAAAA,IAAC,KAAE,SAAA,+BAAA,CAA6B,EAC/BnB,GACCmB,EAAAA,IAAC,IAAA,CAAE,SAAA,uGAAA,CAGH,CAAA,EAEJ,EACAE,EAAAA,KAAC,MAAA,CAAI,UAAU,gBACb,SAAA,CAAAF,EAAAA,IAACM,EAAA,CACC,YAAY,WACZ,KAAK,OACL,MAAOvB,EACP,SAAUC,CAAA,CAAA,EAEZgB,EAAAA,IAACM,EAAA,CACC,YAAY,WACZ,KAAK,WACL,MAAOrB,EACP,SAAUC,CAAA,CAAA,EAEXL,GACCmB,EAAAA,IAACM,EAAA,CACC,YAAY,mBACZ,KAAK,WACL,MAAOnB,EACP,SAAUC,CAAA,CAAA,CACZ,EAEJ,EACAc,EAAAA,KAACK,EAAA,CAAO,SAAQ,GACb,SAAA,CAAA1B,GACCqB,EAAAA,KAACM,EAAA,CACC,KAAI,GACJ,SAAU,CAACX,GAAUV,IAAYF,EACjC,QAAS,IAAMO,EAAQT,EAAUE,CAAQ,EAEzC,SAAA,CAAAe,EAAAA,IAACS,EAAA,EAAe,EAAE,SAAA,CAAA,CAAA,EAGrB,CAAC5B,GACAqB,EAAAA,KAACM,EAAA,CACC,KAAI,GACJ,SAAU,CAACX,EACX,QAAS,IAAML,EAAQT,EAAUE,CAAQ,EAEzC,SAAA,CAAAe,EAAAA,IAACS,EAAA,EAAe,EAAE,QAAA,CAAA,CAAA,QAGrB,MAAA,CAAI,MAAO,CAAE,KAAM,GAAK,EACxB5B,GACCqB,EAAAA,KAACM,EAAA,CACC,KAAI,GACJ,SAAU,CAACZ,GAAaT,IAAYF,EACpC,QAAS,IAAMO,EAAQ,GAAI,EAAE,EAE7B,SAAA,CAAAQ,EAAAA,IAACU,EAAA,EAAa,EAAE,OAAA,CAAA,CAAA,CAClB,EAEJ,EACAV,EAAAA,IAACW,EAAA,CAAO,OAAQjC,EAAS,KAAI,GAAC,KAAK,OACjC,SAAAsB,EAAAA,IAAC,IAAA,CAAE,SAAA,aAAA,CAAW,CAAA,CAChB,CAAA,CAAA,CACF,CAAA,EACF,CAEJ,EAEAY,EAAAA,WAAW,SAAS,eAAe,MAAM,CAAE,EAAE,OAAOZ,EAAAA,IAACvB,IAAK,CAAE"}
@@ -1,9 +1,10 @@
1
- import{$ as ns,L as bn,I as _n,a as Pe,B as ss}from"./index-DaWNRjkx.js";import{j as d}from"./jsx-runtime-DoEZbXM1.js";import{r as w}from"./index-i4mjW0og.js";import{u as rs,L as oe}from"./index-CRRRLlCc.js";import{g as is,c as wn,a as Sn,b as os,h as as,f as cs,e as ls,i as us,d as hs,I as ds,j as fs,m as ps,k as ms,l as gs}from"./IconWorld-DtARpBKX.js";import{a as te}from"./index-CSV4ZXsq.js";import{useStore as Nt}from"./shared/@nanostores_react-HTG3s0lp.js";import{logout as ys,debounce as vs}from"./shared/@utils-BQyGUOvP.js";const Es="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Rs="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",ee=(n,e)=>{for(const t in e)n[t]=e[t];return n},Ot="numeric",At="ascii",kt="alpha",me="asciinumeric",fe="alphanumeric",Tt="domain",Cn="emoji",bs="scheme",_s="slashscheme",gt="whitespace";function ws(n,e){return n in e||(e[n]=[]),e[n]}function Z(n,e,t){e[Ot]&&(e[me]=!0,e[fe]=!0),e[At]&&(e[me]=!0,e[kt]=!0),e[me]&&(e[fe]=!0),e[kt]&&(e[fe]=!0),e[fe]&&(e[Tt]=!0),e[Cn]&&(e[Tt]=!0);for(const s in e){const r=ws(s,t);r.indexOf(n)<0&&r.push(n)}}function Ss(n,e){const t={};for(const s in e)e[s].indexOf(n)>=0&&(t[s]=!0);return t}function T(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}T.groups={};T.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let s=0;s<e.jr.length;s++){const r=e.jr[s][0],i=e.jr[s][1];if(i&&r.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,s){for(let r=0;r<n.length;r++)this.tt(n[r],e,t,s)},tr(n,e,t,s){s=s||T.groups;let r;return e&&e.j?r=e:(r=new T(e),t&&s&&Z(e,t,s)),this.jr.push([n,r]),r},ts(n,e,t,s){let r=this;const i=n.length;if(!i)return r;for(let o=0;o<i-1;o++)r=r.tt(n[o]);return r.tt(n[i-1],e,t,s)},tt(n,e,t,s){s=s||T.groups;const r=this;if(e&&e.j)return r.j[n]=e,e;const i=e;let o,a=r.go(n);if(a?(o=new T,ee(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new T,i){if(s)if(o.t&&typeof o.t=="string"){const l=ee(Ss(o.t,s),t);Z(i,l,s)}else t&&Z(i,t,s);o.t=i}return r.j[n]=o,o}};const R=(n,e,t,s,r)=>n.ta(e,t,s,r),C=(n,e,t,s,r)=>n.tr(e,t,s,r),nn=(n,e,t,s,r)=>n.ts(e,t,s,r),h=(n,e,t,s,r)=>n.tt(e,t,s,r),$="WORD",Lt="UWORD",Nn="ASCIINUMERICAL",On="ALPHANUMERICAL",be="LOCALHOST",xt="TLD",Pt="UTLD",Ae="SCHEME",ie="SLASH_SCHEME",Ut="NUM",It="WS",Ft="NL",ge="OPENBRACE",ye="CLOSEBRACE",Ie="OPENBRACKET",je="CLOSEBRACKET",De="OPENPAREN",Be="CLOSEPAREN",Me="OPENANGLEBRACKET",He="CLOSEANGLEBRACKET",qe="FULLWIDTHLEFTPAREN",Ue="FULLWIDTHRIGHTPAREN",Fe="LEFTCORNERBRACKET",Je="RIGHTCORNERBRACKET",We="LEFTWHITECORNERBRACKET",$e="RIGHTWHITECORNERBRACKET",Ke="FULLWIDTHLESSTHAN",ze="FULLWIDTHGREATERTHAN",Ve="AMPERSAND",Ye="APOSTROPHE",Qe="ASTERISK",z="AT",Ge="BACKSLASH",Xe="BACKTICK",Ze="CARET",V="COLON",Jt="COMMA",et="DOLLAR",D="DOT",tt="EQUALS",Wt="EXCLAMATION",P="HYPHEN",ve="PERCENT",nt="PIPE",st="PLUS",rt="POUND",Ee="QUERY",$t="QUOTE",An="FULLWIDTHMIDDLEDOT",Kt="SEMI",B="SLASH",Re="TILDE",it="UNDERSCORE",kn="EMOJI",ot="SYM";var Tn=Object.freeze({__proto__:null,ALPHANUMERICAL:On,AMPERSAND:Ve,APOSTROPHE:Ye,ASCIINUMERICAL:Nn,ASTERISK:Qe,AT:z,BACKSLASH:Ge,BACKTICK:Xe,CARET:Ze,CLOSEANGLEBRACKET:He,CLOSEBRACE:ye,CLOSEBRACKET:je,CLOSEPAREN:Be,COLON:V,COMMA:Jt,DOLLAR:et,DOT:D,EMOJI:kn,EQUALS:tt,EXCLAMATION:Wt,FULLWIDTHGREATERTHAN:ze,FULLWIDTHLEFTPAREN:qe,FULLWIDTHLESSTHAN:Ke,FULLWIDTHMIDDLEDOT:An,FULLWIDTHRIGHTPAREN:Ue,HYPHEN:P,LEFTCORNERBRACKET:Fe,LEFTWHITECORNERBRACKET:We,LOCALHOST:be,NL:Ft,NUM:Ut,OPENANGLEBRACKET:Me,OPENBRACE:ge,OPENBRACKET:Ie,OPENPAREN:De,PERCENT:ve,PIPE:nt,PLUS:st,POUND:rt,QUERY:Ee,QUOTE:$t,RIGHTCORNERBRACKET:Je,RIGHTWHITECORNERBRACKET:$e,SCHEME:Ae,SEMI:Kt,SLASH:B,SLASH_SCHEME:ie,SYM:ot,TILDE:Re,TLD:xt,UNDERSCORE:it,UTLD:Pt,UWORD:Lt,WORD:$,WS:It});const U=/[a-z]/,ue=new RegExp("\\p{L}","u"),yt=new RegExp("\\p{Emoji}","u"),F=/\d/,vt=/\s/,sn="\r",Et=`
2
- `,Cs="️",Ns="‍",Rt="";let we=null,Se=null;function Os(n=[]){const e={};T.groups=e;const t=new T;we==null&&(we=rn(Es)),Se==null&&(Se=rn(Rs)),h(t,"'",Ye),h(t,"{",ge),h(t,"}",ye),h(t,"[",Ie),h(t,"]",je),h(t,"(",De),h(t,")",Be),h(t,"<",Me),h(t,">",He),h(t,"(",qe),h(t,")",Ue),h(t,"「",Fe),h(t,"」",Je),h(t,"『",We),h(t,"』",$e),h(t,"<",Ke),h(t,">",ze),h(t,"&",Ve),h(t,"*",Qe),h(t,"@",z),h(t,"`",Xe),h(t,"^",Ze),h(t,":",V),h(t,",",Jt),h(t,"$",et),h(t,".",D),h(t,"=",tt),h(t,"!",Wt),h(t,"-",P),h(t,"%",ve),h(t,"|",nt),h(t,"+",st),h(t,"#",rt),h(t,"?",Ee),h(t,'"',$t),h(t,"/",B),h(t,";",Kt),h(t,"~",Re),h(t,"_",it),h(t,"\\",Ge),h(t,"・",An);const s=C(t,F,Ut,{[Ot]:!0});C(s,F,s);const r=C(s,U,Nn,{[me]:!0}),i=C(s,ue,On,{[fe]:!0}),o=C(t,U,$,{[At]:!0});C(o,F,r),C(o,U,o),C(r,F,r),C(r,U,r);const a=C(t,ue,Lt,{[kt]:!0});C(a,U),C(a,F,i),C(a,ue,a),C(i,F,i),C(i,U),C(i,ue,i);const l=h(t,Et,Ft,{[gt]:!0}),c=h(t,sn,It,{[gt]:!0}),f=C(t,vt,It,{[gt]:!0});h(t,Rt,f),h(c,Et,l),h(c,Rt,f),C(c,vt,f),h(f,sn),h(f,Et),C(f,vt,f),h(f,Rt,f);const m=C(t,yt,kn,{[Cn]:!0});h(m,"#"),C(m,yt,m),h(m,Cs,m);const g=h(m,Ns);h(g,"#"),C(g,yt,m);const u=[[U,o],[F,r]],p=[[U,null],[ue,a],[F,i]];for(let y=0;y<we.length;y++)K(t,we[y],xt,$,u);for(let y=0;y<Se.length;y++)K(t,Se[y],Pt,Lt,p);Z(xt,{tld:!0,ascii:!0},e),Z(Pt,{utld:!0,alpha:!0},e),K(t,"file",Ae,$,u),K(t,"mailto",Ae,$,u),K(t,"http",ie,$,u),K(t,"https",ie,$,u),K(t,"ftp",ie,$,u),K(t,"ftps",ie,$,u),Z(Ae,{scheme:!0,ascii:!0},e),Z(ie,{slashscheme:!0,ascii:!0},e),n=n.sort((y,E)=>y[0]>E[0]?1:-1);for(let y=0;y<n.length;y++){const E=n[y][0],v=n[y][1]?{[bs]:!0}:{[_s]:!0};E.indexOf("-")>=0?v[Tt]=!0:U.test(E)?F.test(E)?v[me]=!0:v[At]=!0:v[Ot]=!0,nn(t,E,E,v)}return nn(t,"localhost",be,{ascii:!0}),t.jd=new T(ot),{start:t,tokens:ee({groups:e},Tn)}}function Ln(n,e){const t=As(e.replace(/[A-Z]/g,a=>a.toLowerCase())),s=t.length,r=[];let i=0,o=0;for(;o<s;){let a=n,l=null,c=0,f=null,m=-1,g=-1;for(;o<s&&(l=a.go(t[o]));)a=l,a.accepts()?(m=0,g=0,f=a):m>=0&&(m+=t[o].length,g++),c+=t[o].length,i+=t[o].length,o++;i-=m,o-=g,c-=m,r.push({t:f.t,v:e.slice(i-c,i),s:i-c,e:i})}return r}function As(n){const e=[],t=n.length;let s=0;for(;s<t;){let r=n.charCodeAt(s),i,o=r<55296||r>56319||s+1===t||(i=n.charCodeAt(s+1))<56320||i>57343?n[s]:n.slice(s,s+2);e.push(o),s+=o.length}return e}function K(n,e,t,s,r){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?i=n.j[l]:(i=new T(s),i.jr=r.slice(),n.j[l]=i),n=i}return i=new T(t),i.jr=r.slice(),n.j[e[o-1]]=i,i}function rn(n){const e=[],t=[];let s=0,r="0123456789";for(;s<n.length;){let i=0;for(;r.indexOf(n[s+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let o=parseInt(n.substring(s,s+i),10);o>0;o--)t.pop();s+=i}else t.push(n[s]),s++}return e}const ae={defaultProtocol:"http",events:null,format:on,formatHref:on,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function at(n,e=null){let t=ee({},ae);n&&(t=ee(t,n instanceof at?n.o:n));const s=t.ignoreTags,r=[];for(let i=0;i<s.length;i++)r.push(s[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=r}at.prototype={o:ae,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const s=e!=null;let r=this.o[n];return r&&(typeof r=="object"?(r=t.t in r?r[t.t]:ae[n],typeof r=="function"&&s&&(r=r(e,t))):typeof r=="function"&&s&&(r=r(e,t.t,t)),r)},getObj(n,e,t){let s=this.o[n];return typeof s=="function"&&e!=null&&(s=s(e,t.t,t)),s},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function on(n){return n}var xn=Object.freeze({__proto__:null,Options:at,assign:ee,defaults:ae});function Pn(n,e){this.t="token",this.v=n,this.tk=e}Pn.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),s=n.get("format",e,this);return t&&s.length>t?s.substring(0,t)+"…":s},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=ae.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),s=n.get("formatHref",t,this),r=n.get("tagName",t,e),i=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),f=n.getObj("attributes",t,e),m=n.getObj("events",t,e);return o.href=s,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),f&&ee(o,f),{tagName:r,attributes:o,content:i,eventListeners:m}}};function ct(n,e){class t extends Pn{constructor(r,i){super(r,i),this.t=n}}for(const s in e)t.prototype[s]=e[s];return t.t=n,t}const an=ct("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),cn=ct("text"),ks=ct("nl"),Ce=ct("url",{isLink:!0,toHref(n=ae.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==be&&n[1].t===V}}),x=n=>new T(n);function Ts({groups:n}){const e=n.domain.concat([Ve,Qe,z,Ge,Xe,Ze,et,tt,P,Ut,ve,nt,st,rt,B,ot,Re,it]),t=[Ye,V,Jt,D,Wt,ve,Ee,$t,Kt,Me,He,ge,ye,je,Ie,De,Be,qe,Ue,Fe,Je,We,$e,Ke,ze],s=[Ve,Ye,Qe,Ge,Xe,Ze,et,tt,P,ge,ye,ve,nt,st,rt,Ee,B,ot,Re,it],r=x(),i=h(r,Re);R(i,s,i),R(i,n.domain,i);const o=x(),a=x(),l=x();R(r,n.domain,o),R(r,n.scheme,a),R(r,n.slashscheme,l),R(o,s,i),R(o,n.domain,o);const c=h(o,z);h(i,z,c),h(a,z,c),h(l,z,c);const f=h(i,D);R(f,s,i),R(f,n.domain,i);const m=x();R(c,n.domain,m),R(m,n.domain,m);const g=h(m,D);R(g,n.domain,m);const u=x(an);R(g,n.tld,u),R(g,n.utld,u),h(c,be,u);const p=h(m,P);h(p,P,p),R(p,n.domain,m),R(u,n.domain,m),h(u,D,g),h(u,P,p);const y=h(u,V);R(y,n.numeric,an);const E=h(o,P),_=h(o,D);h(E,P,E),R(E,n.domain,o),R(_,s,i),R(_,n.domain,o);const v=x(Ce);R(_,n.tld,v),R(_,n.utld,v),R(v,n.domain,o),R(v,s,i),h(v,D,_),h(v,P,E),h(v,z,c);const S=h(v,V),k=x(Ce);R(S,n.numeric,k);const O=x(Ce),q=x();R(O,e,O),R(O,t,q),R(q,e,O),R(q,t,q),h(v,B,O),h(k,B,O);const dt=h(a,V),es=h(l,V),ts=h(es,B),ft=h(ts,B);R(a,n.domain,o),h(a,D,_),h(a,P,E),R(l,n.domain,o),h(l,D,_),h(l,P,E),R(dt,n.domain,O),h(dt,B,O),h(dt,Ee,O),R(ft,n.domain,O),R(ft,e,O),h(ft,B,O);const en=[[ge,ye],[Ie,je],[De,Be],[Me,He],[qe,Ue],[Fe,Je],[We,$e],[Ke,ze]];for(let pt=0;pt<en.length;pt++){const[tn,mt]=en[pt],_e=h(O,tn);h(q,tn,_e),h(_e,mt,O);const re=x(Ce);R(_e,e,re);const le=x();R(_e,t),R(re,e,re),R(re,t,le),R(le,e,re),R(le,t,le),h(re,mt,O),h(le,mt,O)}return h(r,be,v),h(r,Ft,ks),{start:r,tokens:Tn}}function Ls(n,e,t){let s=t.length,r=0,i=[],o=[];for(;r<s;){let a=n,l=null,c=null,f=0,m=null,g=-1;for(;r<s&&!(l=a.go(t[r].t));)o.push(t[r++]);for(;r<s&&(c=l||a.go(t[r].t));)l=null,a=c,a.accepts()?(g=0,m=a):g>=0&&g++,r++,f++;if(g<0)r-=f,r<s&&(o.push(t[r]),r++);else{o.length>0&&(i.push(bt(cn,e,o)),o=[]),r-=g,f-=g;const u=m.t,p=t.slice(r-f,r);i.push(bt(u,e,p))}}return o.length>0&&i.push(bt(cn,e,o)),i}function bt(n,e,t){const s=t[0].s,r=t[t.length-1].e,i=e.slice(s,r);return new n(i,t)}const A={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function xs(){A.scanner=Os(A.customSchemes);for(let n=0;n<A.tokenQueue.length;n++)A.tokenQueue[n][1]({scanner:A.scanner});A.parser=Ts(A.scanner.tokens);for(let n=0;n<A.pluginQueue.length;n++)A.pluginQueue[n][1]({scanner:A.scanner,parser:A.parser});return A.initialized=!0,A}function In(n){return A.initialized||xs(),Ls(A.parser.start,n,Ln(A.scanner.start,n))}In.scan=Ln;function Ps(n,e,t){const s=In(n),r=[];for(let i=0;i<s.length;i++){const o=s[i];if(o.t==="nl"&&e.get("nl2br")){const a=`__linkify-el-${t.elementId++}`;r.push(w.createElement("br",{key:a}))}else if(!o.isLink||!e.check(o))r.push(o.toString());else{let a=e.render(o);if(!("key"in a.props)){const l=`__linkify-el-${t.elementId++}`,c=xn.assign({key:l},a.props);a=w.cloneElement(a,c)}r.push(a)}}return r}function jn(n,e,t){if(w.Children.count(n.props.children)===0)return n;const s=[];w.Children.forEach(n.props.children,o=>{typeof o=="string"?s.push.apply(s,Ps(o,e,t)):w.isValidElement(o)?typeof o.type=="string"&&e.ignoreTags.indexOf(o.type.toUpperCase())>=0?s.push(o):s.push(jn(o,e,t)):s.push(o)});const r=`__linkify-el-${t.elementId++}`,i=xn.assign({key:r},n.props);return w.cloneElement(n,i,s)}const Is=n=>{let e=0;const t=({tagName:l,attributes:c,content:f})=>(c.key=`__linkify-lnk-${e++}`,c.class&&(c.className=c.class,delete c.class),w.createElement(l,c,f)),s={key:"__linkify-wrapper"};for(const l in n)l!=="options"&&l!=="as"&&l!=="tagName"&&l!=="children"&&(s[l]=n[l]);const r=new at(n.options,t),i=n.as||n.tagName||w.Fragment||"span",o=n.children,a=w.createElement(i,s,o);return jn(a,r,{elementId:0})},js=({time:n})=>{const e=new Date(n);let t=e.getHours();const s=t>=12?"PM":"AM";t>12?t-=12:t===0&&(t=12);const r=String(e.getMinutes()).padStart(2,"0");return d.jsxs("div",{className:"chat-timestamp",children:[t,":",r," ",s]})},Yr=({log:n})=>{const[e,t]=rs("/history/:time?"),s=t?.time===n.created+"";return d.jsx("div",{className:`log-entry ${s?"focused":""}`,children:d.jsxs("div",{className:"log-row",children:[d.jsxs(oe,{href:`/history/${s?"":n.created}`,className:"time-link",children:[d.jsx(is,{}),d.jsx(js,{time:n.created})]}),n.action==="msg"&&d.jsxs("div",{className:"chat-message message",children:[n.user.web?"[":"",n.user.web?d.jsx("span",{className:"user",style:{color:`#${n.user.color}`},children:n.user.name}):d.jsx(oe,{href:`/players/${n.user.id}`,className:"user",style:{color:`#${n.user.color}`},children:n.user.name}),n.user.web?"]":"",":"," ",d.jsx(Is,{as:"span",children:n.message})]}),n.action==="leave"&&d.jsxs("div",{className:"message join-message",children:[d.jsx(oe,{href:`/players/${n.user.id}`,className:"user",children:n.user.name})," ","left the game."]}),n.action==="join"&&d.jsxs("div",{className:"message join-message",children:[d.jsx(oe,{href:`/players/${n.user.id}`,className:"user",children:n.user.name})," ","joined the game",n.user.isFirst?" for the first time":"","."]}),n.action==="server"&&d.jsx("div",{className:"message server-message",children:n.message})]})})},Ds=({disabled:n=!1,options:e=[],value:t,onChange:s})=>{const[r,i]=w.useState(!1),o=w.useRef(null);return w.useEffect(()=>{if(!r)return;function a(l){l.target&&!o.current?.contains(l.target)&&(console.log("[debug] close"),i(!1))}return document.addEventListener("click",a),()=>document.removeEventListener("click",a)},[r]),d.jsxs("div",{className:`dropdown ${n?"disabled":""}`,ref:o,children:[r&&d.jsx("div",{className:"options",children:e.map(a=>d.jsx("div",{className:`option ${t===a?"green":""}`,onClick:()=>{i(!1),s(a)},children:a},a))}),d.jsxs("div",{className:"selected",onClick:()=>{!n&&i(a=>!a)},children:[d.jsx("div",{className:"value",children:t}),d.jsx(wn,{})]})]})},Qr=({loading:n,offset:e=0,onTopScrollsToBottom:t=!0,onBottom:s,onTop:r,children:i,className:o,...a})=>{const[l,c]=w.useState(0),[f,m]=w.useState(""),g=w.useRef(null),u=y=>{n||(m(y),y==="bottom"?s():r())},p=y=>{const E=y.currentTarget,_=E.scrollTop;_>l&&_+E.offsetHeight>=E.scrollHeight-e?u("bottom"):_<l&&_<=e&&u("top"),c(_)};return w.useEffect(()=>{t&&!n&&f==="top"&&g.current&&g.current.scrollTo({top:g.current.scrollHeight-g.current.offsetHeight-e-2,behavior:"instant"})},[n,f,t,e]),d.jsx("div",{ref:g,onScroll:p,className:o,...a,children:i})};var Q={},he={},_t={},ln;function lt(){return ln||(ln=1,function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.createJSONRPCErrorResponse=n.JSONRPCErrorCode=n.isJSONRPCResponse=n.isJSONRPCRequest=n.isJSONRPCID=n.JSONRPC=void 0,n.JSONRPC="2.0",n.isJSONRPCID=function(e){return typeof e=="string"||typeof e=="number"||e===null},n.isJSONRPCRequest=function(e){return e.jsonrpc===n.JSONRPC&&e.method!==void 0&&e.result===void 0&&e.error===void 0},n.isJSONRPCResponse=function(e){return e.jsonrpc===n.JSONRPC&&e.id!==void 0&&(e.result!==void 0||e.error!==void 0)},function(e){e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(n.JSONRPCErrorCode||(n.JSONRPCErrorCode={})),n.createJSONRPCErrorResponse=function(e,t,s,r){var i={code:t,message:s};return r&&(i.data=r),{jsonrpc:n.JSONRPC,id:e,error:i}}}(_t)),_t}var G={},un;function Dn(){return un||(un=1,Object.defineProperty(G,"__esModule",{value:!0}),G.DefaultErrorCode=G.createLogDeprecationWarning=void 0,G.createLogDeprecationWarning=function(n){return function(){}},G.DefaultErrorCode=0),G}var hn;function Bs(){if(hn)return he;hn=1,Object.defineProperty(he,"__esModule",{value:!0}),he.JSONRPCClient=void 0;var n=lt(),e=Dn(),t=e.createLogDeprecationWarning(`Using a higher order function on JSONRPCClient send method is deprecated.
1
+ import{$ as ss,L as _n,I as wn,a as Pe,B as rs}from"./index-DYcAgWjJ.js";import{j as d}from"./jsx-runtime-DoEZbXM1.js";import{r as w}from"./index-i4mjW0og.js";import{u as is,L as at}from"./index-CRRRLlCc.js";import{g as os,c as Sn,a as Cn,b as as,h as cs,f as ls,e as us,i as hs,d as ds,I as fs,j as ps,m as ms,k as gs,l as ys}from"./IconWorld-DtARpBKX.js";import{a as te}from"./index-CSV4ZXsq.js";import{useStore as Ot}from"./shared/@nanostores_react-HTG3s0lp.js";import{logout as vs,debounce as Es}from"./shared/@utils-BQyGUOvP.js";const Rs="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",bs="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",ee=(n,e)=>{for(const t in e)n[t]=e[t];return n},kt="numeric",At="ascii",Tt="alpha",pe="asciinumeric",de="alphanumeric",Lt="domain",Nn="emoji",_s="scheme",ws="slashscheme",yt="whitespace";function Ss(n,e){return n in e||(e[n]=[]),e[n]}function Z(n,e,t){e[kt]&&(e[pe]=!0,e[de]=!0),e[At]&&(e[pe]=!0,e[Tt]=!0),e[pe]&&(e[de]=!0),e[Tt]&&(e[de]=!0),e[de]&&(e[Lt]=!0),e[Nn]&&(e[Lt]=!0);for(const s in e){const r=Ss(s,t);r.indexOf(n)<0&&r.push(n)}}function Cs(n,e){const t={};for(const s in e)e[s].indexOf(n)>=0&&(t[s]=!0);return t}function T(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}T.groups={};T.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let s=0;s<e.jr.length;s++){const r=e.jr[s][0],i=e.jr[s][1];if(i&&r.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,s){for(let r=0;r<n.length;r++)this.tt(n[r],e,t,s)},tr(n,e,t,s){s=s||T.groups;let r;return e&&e.j?r=e:(r=new T(e),t&&s&&Z(e,t,s)),this.jr.push([n,r]),r},ts(n,e,t,s){let r=this;const i=n.length;if(!i)return r;for(let o=0;o<i-1;o++)r=r.tt(n[o]);return r.tt(n[i-1],e,t,s)},tt(n,e,t,s){s=s||T.groups;const r=this;if(e&&e.j)return r.j[n]=e,e;const i=e;let o,a=r.go(n);if(a?(o=new T,ee(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new T,i){if(s)if(o.t&&typeof o.t=="string"){const l=ee(Cs(o.t,s),t);Z(i,l,s)}else t&&Z(i,t,s);o.t=i}return r.j[n]=o,o}};const R=(n,e,t,s,r)=>n.ta(e,t,s,r),C=(n,e,t,s,r)=>n.tr(e,t,s,r),sn=(n,e,t,s,r)=>n.ts(e,t,s,r),h=(n,e,t,s,r)=>n.tt(e,t,s,r),$="WORD",xt="UWORD",On="ASCIINUMERICAL",kn="ALPHANUMERICAL",Re="LOCALHOST",Pt="TLD",It="UTLD",ke="SCHEME",ie="SLASH_SCHEME",Ft="NUM",jt="WS",Jt="NL",me="OPENBRACE",ge="CLOSEBRACE",Ie="OPENBRACKET",je="CLOSEBRACKET",De="OPENPAREN",Be="CLOSEPAREN",Me="OPENANGLEBRACKET",He="CLOSEANGLEBRACKET",Ue="FULLWIDTHLEFTPAREN",qe="FULLWIDTHRIGHTPAREN",Fe="LEFTCORNERBRACKET",Je="RIGHTCORNERBRACKET",We="LEFTWHITECORNERBRACKET",$e="RIGHTWHITECORNERBRACKET",Ke="FULLWIDTHLESSTHAN",ze="FULLWIDTHGREATERTHAN",Ve="AMPERSAND",Ye="APOSTROPHE",Qe="ASTERISK",z="AT",Ge="BACKSLASH",Xe="BACKTICK",Ze="CARET",V="COLON",Wt="COMMA",et="DOLLAR",D="DOT",tt="EQUALS",$t="EXCLAMATION",P="HYPHEN",ye="PERCENT",nt="PIPE",st="PLUS",rt="POUND",ve="QUERY",Kt="QUOTE",An="FULLWIDTHMIDDLEDOT",zt="SEMI",B="SLASH",Ee="TILDE",it="UNDERSCORE",Tn="EMOJI",ot="SYM";var Ln=Object.freeze({__proto__:null,ALPHANUMERICAL:kn,AMPERSAND:Ve,APOSTROPHE:Ye,ASCIINUMERICAL:On,ASTERISK:Qe,AT:z,BACKSLASH:Ge,BACKTICK:Xe,CARET:Ze,CLOSEANGLEBRACKET:He,CLOSEBRACE:ge,CLOSEBRACKET:je,CLOSEPAREN:Be,COLON:V,COMMA:Wt,DOLLAR:et,DOT:D,EMOJI:Tn,EQUALS:tt,EXCLAMATION:$t,FULLWIDTHGREATERTHAN:ze,FULLWIDTHLEFTPAREN:Ue,FULLWIDTHLESSTHAN:Ke,FULLWIDTHMIDDLEDOT:An,FULLWIDTHRIGHTPAREN:qe,HYPHEN:P,LEFTCORNERBRACKET:Fe,LEFTWHITECORNERBRACKET:We,LOCALHOST:Re,NL:Jt,NUM:Ft,OPENANGLEBRACKET:Me,OPENBRACE:me,OPENBRACKET:Ie,OPENPAREN:De,PERCENT:ye,PIPE:nt,PLUS:st,POUND:rt,QUERY:ve,QUOTE:Kt,RIGHTCORNERBRACKET:Je,RIGHTWHITECORNERBRACKET:$e,SCHEME:ke,SEMI:zt,SLASH:B,SLASH_SCHEME:ie,SYM:ot,TILDE:Ee,TLD:Pt,UNDERSCORE:it,UTLD:It,UWORD:xt,WORD:$,WS:jt});const q=/[a-z]/,le=new RegExp("\\p{L}","u"),vt=new RegExp("\\p{Emoji}","u"),F=/\d/,Et=/\s/,rn="\r",Rt=`
2
+ `,Ns="️",Os="‍",bt="";let _e=null,we=null;function ks(n=[]){const e={};T.groups=e;const t=new T;_e==null&&(_e=on(Rs)),we==null&&(we=on(bs)),h(t,"'",Ye),h(t,"{",me),h(t,"}",ge),h(t,"[",Ie),h(t,"]",je),h(t,"(",De),h(t,")",Be),h(t,"<",Me),h(t,">",He),h(t,"(",Ue),h(t,")",qe),h(t,"「",Fe),h(t,"」",Je),h(t,"『",We),h(t,"』",$e),h(t,"<",Ke),h(t,">",ze),h(t,"&",Ve),h(t,"*",Qe),h(t,"@",z),h(t,"`",Xe),h(t,"^",Ze),h(t,":",V),h(t,",",Wt),h(t,"$",et),h(t,".",D),h(t,"=",tt),h(t,"!",$t),h(t,"-",P),h(t,"%",ye),h(t,"|",nt),h(t,"+",st),h(t,"#",rt),h(t,"?",ve),h(t,'"',Kt),h(t,"/",B),h(t,";",zt),h(t,"~",Ee),h(t,"_",it),h(t,"\\",Ge),h(t,"・",An);const s=C(t,F,Ft,{[kt]:!0});C(s,F,s);const r=C(s,q,On,{[pe]:!0}),i=C(s,le,kn,{[de]:!0}),o=C(t,q,$,{[At]:!0});C(o,F,r),C(o,q,o),C(r,F,r),C(r,q,r);const a=C(t,le,xt,{[Tt]:!0});C(a,q),C(a,F,i),C(a,le,a),C(i,F,i),C(i,q),C(i,le,i);const l=h(t,Rt,Jt,{[yt]:!0}),c=h(t,rn,jt,{[yt]:!0}),f=C(t,Et,jt,{[yt]:!0});h(t,bt,f),h(c,Rt,l),h(c,bt,f),C(c,Et,f),h(f,rn),h(f,Rt),C(f,Et,f),h(f,bt,f);const m=C(t,vt,Tn,{[Nn]:!0});h(m,"#"),C(m,vt,m),h(m,Ns,m);const g=h(m,Os);h(g,"#"),C(g,vt,m);const u=[[q,o],[F,r]],p=[[q,null],[le,a],[F,i]];for(let y=0;y<_e.length;y++)K(t,_e[y],Pt,$,u);for(let y=0;y<we.length;y++)K(t,we[y],It,xt,p);Z(Pt,{tld:!0,ascii:!0},e),Z(It,{utld:!0,alpha:!0},e),K(t,"file",ke,$,u),K(t,"mailto",ke,$,u),K(t,"http",ie,$,u),K(t,"https",ie,$,u),K(t,"ftp",ie,$,u),K(t,"ftps",ie,$,u),Z(ke,{scheme:!0,ascii:!0},e),Z(ie,{slashscheme:!0,ascii:!0},e),n=n.sort((y,E)=>y[0]>E[0]?1:-1);for(let y=0;y<n.length;y++){const E=n[y][0],v=n[y][1]?{[_s]:!0}:{[ws]:!0};E.indexOf("-")>=0?v[Lt]=!0:q.test(E)?F.test(E)?v[pe]=!0:v[At]=!0:v[kt]=!0,sn(t,E,E,v)}return sn(t,"localhost",Re,{ascii:!0}),t.jd=new T(ot),{start:t,tokens:ee({groups:e},Ln)}}function xn(n,e){const t=As(e.replace(/[A-Z]/g,a=>a.toLowerCase())),s=t.length,r=[];let i=0,o=0;for(;o<s;){let a=n,l=null,c=0,f=null,m=-1,g=-1;for(;o<s&&(l=a.go(t[o]));)a=l,a.accepts()?(m=0,g=0,f=a):m>=0&&(m+=t[o].length,g++),c+=t[o].length,i+=t[o].length,o++;i-=m,o-=g,c-=m,r.push({t:f.t,v:e.slice(i-c,i),s:i-c,e:i})}return r}function As(n){const e=[],t=n.length;let s=0;for(;s<t;){let r=n.charCodeAt(s),i,o=r<55296||r>56319||s+1===t||(i=n.charCodeAt(s+1))<56320||i>57343?n[s]:n.slice(s,s+2);e.push(o),s+=o.length}return e}function K(n,e,t,s,r){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?i=n.j[l]:(i=new T(s),i.jr=r.slice(),n.j[l]=i),n=i}return i=new T(t),i.jr=r.slice(),n.j[e[o-1]]=i,i}function on(n){const e=[],t=[];let s=0,r="0123456789";for(;s<n.length;){let i=0;for(;r.indexOf(n[s+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let o=parseInt(n.substring(s,s+i),10);o>0;o--)t.pop();s+=i}else t.push(n[s]),s++}return e}const oe={defaultProtocol:"http",events:null,format:an,formatHref:an,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ct(n,e=null){let t=ee({},oe);n&&(t=ee(t,n instanceof ct?n.o:n));const s=t.ignoreTags,r=[];for(let i=0;i<s.length;i++)r.push(s[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=r}ct.prototype={o:oe,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const s=e!=null;let r=this.o[n];return r&&(typeof r=="object"?(r=t.t in r?r[t.t]:oe[n],typeof r=="function"&&s&&(r=r(e,t))):typeof r=="function"&&s&&(r=r(e,t.t,t)),r)},getObj(n,e,t){let s=this.o[n];return typeof s=="function"&&e!=null&&(s=s(e,t.t,t)),s},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function an(n){return n}var Pn=Object.freeze({__proto__:null,Options:ct,assign:ee,defaults:oe});function In(n,e){this.t="token",this.v=n,this.tk=e}In.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),s=n.get("format",e,this);return t&&s.length>t?s.substring(0,t)+"…":s},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=oe.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),s=n.get("formatHref",t,this),r=n.get("tagName",t,e),i=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),f=n.getObj("attributes",t,e),m=n.getObj("events",t,e);return o.href=s,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),f&&ee(o,f),{tagName:r,attributes:o,content:i,eventListeners:m}}};function lt(n,e){class t extends In{constructor(r,i){super(r,i),this.t=n}}for(const s in e)t.prototype[s]=e[s];return t.t=n,t}const cn=lt("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ln=lt("text"),Ts=lt("nl"),Se=lt("url",{isLink:!0,toHref(n=oe.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Re&&n[1].t===V}}),x=n=>new T(n);function Ls({groups:n}){const e=n.domain.concat([Ve,Qe,z,Ge,Xe,Ze,et,tt,P,Ft,ye,nt,st,rt,B,ot,Ee,it]),t=[Ye,V,Wt,D,$t,ye,ve,Kt,zt,Me,He,me,ge,je,Ie,De,Be,Ue,qe,Fe,Je,We,$e,Ke,ze],s=[Ve,Ye,Qe,Ge,Xe,Ze,et,tt,P,me,ge,ye,nt,st,rt,ve,B,ot,Ee,it],r=x(),i=h(r,Ee);R(i,s,i),R(i,n.domain,i);const o=x(),a=x(),l=x();R(r,n.domain,o),R(r,n.scheme,a),R(r,n.slashscheme,l),R(o,s,i),R(o,n.domain,o);const c=h(o,z);h(i,z,c),h(a,z,c),h(l,z,c);const f=h(i,D);R(f,s,i),R(f,n.domain,i);const m=x();R(c,n.domain,m),R(m,n.domain,m);const g=h(m,D);R(g,n.domain,m);const u=x(cn);R(g,n.tld,u),R(g,n.utld,u),h(c,Re,u);const p=h(m,P);h(p,P,p),R(p,n.domain,m),R(u,n.domain,m),h(u,D,g),h(u,P,p);const y=h(u,V);R(y,n.numeric,cn);const E=h(o,P),_=h(o,D);h(E,P,E),R(E,n.domain,o),R(_,s,i),R(_,n.domain,o);const v=x(Se);R(_,n.tld,v),R(_,n.utld,v),R(v,n.domain,o),R(v,s,i),h(v,D,_),h(v,P,E),h(v,z,c);const S=h(v,V),A=x(Se);R(S,n.numeric,A);const O=x(Se),U=x();R(O,e,O),R(O,t,U),R(U,e,O),R(U,t,U),h(v,B,O),h(A,B,O);const ft=h(a,V),ts=h(l,V),ns=h(ts,B),pt=h(ns,B);R(a,n.domain,o),h(a,D,_),h(a,P,E),R(l,n.domain,o),h(l,D,_),h(l,P,E),R(ft,n.domain,O),h(ft,B,O),h(ft,ve,O),R(pt,n.domain,O),R(pt,e,O),h(pt,B,O);const tn=[[me,ge],[Ie,je],[De,Be],[Me,He],[Ue,qe],[Fe,Je],[We,$e],[Ke,ze]];for(let mt=0;mt<tn.length;mt++){const[nn,gt]=tn[mt],be=h(O,nn);h(U,nn,be),h(be,gt,O);const re=x(Se);R(be,e,re);const ce=x();R(be,t),R(re,e,re),R(re,t,ce),R(ce,e,re),R(ce,t,ce),h(re,gt,O),h(ce,gt,O)}return h(r,Re,v),h(r,Jt,Ts),{start:r,tokens:Ln}}function xs(n,e,t){let s=t.length,r=0,i=[],o=[];for(;r<s;){let a=n,l=null,c=null,f=0,m=null,g=-1;for(;r<s&&!(l=a.go(t[r].t));)o.push(t[r++]);for(;r<s&&(c=l||a.go(t[r].t));)l=null,a=c,a.accepts()?(g=0,m=a):g>=0&&g++,r++,f++;if(g<0)r-=f,r<s&&(o.push(t[r]),r++);else{o.length>0&&(i.push(_t(ln,e,o)),o=[]),r-=g,f-=g;const u=m.t,p=t.slice(r-f,r);i.push(_t(u,e,p))}}return o.length>0&&i.push(_t(ln,e,o)),i}function _t(n,e,t){const s=t[0].s,r=t[t.length-1].e,i=e.slice(s,r);return new n(i,t)}const k={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Ps(){k.scanner=ks(k.customSchemes);for(let n=0;n<k.tokenQueue.length;n++)k.tokenQueue[n][1]({scanner:k.scanner});k.parser=Ls(k.scanner.tokens);for(let n=0;n<k.pluginQueue.length;n++)k.pluginQueue[n][1]({scanner:k.scanner,parser:k.parser});return k.initialized=!0,k}function jn(n){return k.initialized||Ps(),xs(k.parser.start,n,xn(k.scanner.start,n))}jn.scan=xn;function Is(n,e,t){const s=jn(n),r=[];for(let i=0;i<s.length;i++){const o=s[i];if(o.t==="nl"&&e.get("nl2br")){const a=`__linkify-el-${t.elementId++}`;r.push(w.createElement("br",{key:a}))}else if(!o.isLink||!e.check(o))r.push(o.toString());else{let a=e.render(o);if(!("key"in a.props)){const l=`__linkify-el-${t.elementId++}`,c=Pn.assign({key:l},a.props);a=w.cloneElement(a,c)}r.push(a)}}return r}function Dn(n,e,t){if(w.Children.count(n.props.children)===0)return n;const s=[];w.Children.forEach(n.props.children,o=>{typeof o=="string"?s.push.apply(s,Is(o,e,t)):w.isValidElement(o)?typeof o.type=="string"&&e.ignoreTags.indexOf(o.type.toUpperCase())>=0?s.push(o):s.push(Dn(o,e,t)):s.push(o)});const r=`__linkify-el-${t.elementId++}`,i=Pn.assign({key:r},n.props);return w.cloneElement(n,i,s)}const js=n=>{let e=0;const t=({tagName:l,attributes:c,content:f})=>(c.key=`__linkify-lnk-${e++}`,c.class&&(c.className=c.class,delete c.class),w.createElement(l,c,f)),s={key:"__linkify-wrapper"};for(const l in n)l!=="options"&&l!=="as"&&l!=="tagName"&&l!=="children"&&(s[l]=n[l]);const r=new ct(n.options,t),i=n.as||n.tagName||w.Fragment||"span",o=n.children,a=w.createElement(i,s,o);return Dn(a,r,{elementId:0})},Ds=({time:n})=>{const e=new Date(n);let t=e.getHours();const s=t>=12?"PM":"AM";t>12?t-=12:t===0&&(t=12);const r=String(e.getMinutes()).padStart(2,"0");return d.jsxs("div",{className:"chat-timestamp",children:[t,":",r," ",s]})},Ce=({color:n,user:e,link:t,className:s})=>{const r={className:s,style:n?{color:`#${e?.color}`}:void 0,"data-tooltip":[e?.name&&`Username: ${e?.name}`,e?.displayName&&`Display Name: ${e?.displayName}`].filter(Boolean).join(`
3
+ `)};return t&&e?.id?d.jsx(at,{href:`/players/${e.id}`,...r,children:e?.displayName??e?.name}):d.jsx("span",{...r,children:e?.displayName??e?.name})},Qr=({log:n})=>{const[e,t]=is("/history/:time?"),s=t?.time===n.created+"";return d.jsx("div",{className:`log-entry ${s?"focused":""}`,children:d.jsxs("div",{className:"log-row",children:[d.jsxs(at,{href:`/history/${s?"":n.created}`,className:"time-link",children:[d.jsx(os,{}),d.jsx(Ds,{time:n.created})]}),n.action==="msg"&&d.jsxs("div",{className:"chat-message message",children:[n.user.web?"[":"",n.user.web?d.jsx(Ce,{color:!0,user:n.user}):d.jsx(Ce,{link:!0,color:!0,className:"user",user:n.user}),n.user.web?"]":"",":"," ",d.jsx(js,{as:"span",children:n.message})]}),n.action==="leave"&&d.jsxs("div",{className:"message join-message",children:[d.jsx(Ce,{link:!0,className:"user",user:n.user})," left the game."]}),n.action==="join"&&d.jsxs("div",{className:"message join-message",children:[d.jsx(Ce,{link:!0,className:"user",user:n.user})," joined the game",n.user.isFirst?" for the first time":"","."]}),n.action==="server"&&d.jsx("div",{className:"message server-message",children:n.message})]})})},Bs=({disabled:n=!1,options:e=[],value:t,onChange:s})=>{const[r,i]=w.useState(!1),o=w.useRef(null);return w.useEffect(()=>{if(!r)return;function a(l){l.target&&!o.current?.contains(l.target)&&(console.log("[debug] close"),i(!1))}return document.addEventListener("click",a),()=>document.removeEventListener("click",a)},[r]),d.jsxs("div",{className:`dropdown ${n?"disabled":""}`,ref:o,children:[r&&d.jsx("div",{className:"options",children:e.map(a=>d.jsx("div",{className:`option ${t===a?"green":""}`,onClick:()=>{i(!1),s(a)},children:a},a))}),d.jsxs("div",{className:"selected",onClick:()=>{!n&&i(a=>!a)},children:[d.jsx("div",{className:"value",children:t}),d.jsx(Sn,{})]})]})},Gr=({loading:n,offset:e=0,onTopScrollsToBottom:t=!0,onBottom:s,onTop:r,children:i,className:o,...a})=>{const[l,c]=w.useState(0),[f,m]=w.useState(""),g=w.useRef(null),u=y=>{n||(m(y),y==="bottom"?s():r())},p=y=>{const E=y.currentTarget,_=E.scrollTop;_>l&&_+E.offsetHeight>=E.scrollHeight-e?u("bottom"):_<l&&_<=e&&u("top"),c(_)};return w.useEffect(()=>{t&&!n&&f==="top"&&g.current&&g.current.scrollTo({top:g.current.scrollHeight-g.current.offsetHeight-e-2,behavior:"instant"})},[n,f,t,e]),d.jsx("div",{ref:g,onScroll:p,className:o,...a,children:i})};var Q={},ue={},wt={},un;function ut(){return un||(un=1,function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.createJSONRPCErrorResponse=n.JSONRPCErrorCode=n.isJSONRPCResponse=n.isJSONRPCRequest=n.isJSONRPCID=n.JSONRPC=void 0,n.JSONRPC="2.0",n.isJSONRPCID=function(e){return typeof e=="string"||typeof e=="number"||e===null},n.isJSONRPCRequest=function(e){return e.jsonrpc===n.JSONRPC&&e.method!==void 0&&e.result===void 0&&e.error===void 0},n.isJSONRPCResponse=function(e){return e.jsonrpc===n.JSONRPC&&e.id!==void 0&&(e.result!==void 0||e.error!==void 0)},function(e){e[e.ParseError=-32700]="ParseError",e[e.InvalidRequest=-32600]="InvalidRequest",e[e.MethodNotFound=-32601]="MethodNotFound",e[e.InvalidParams=-32602]="InvalidParams",e[e.InternalError=-32603]="InternalError"}(n.JSONRPCErrorCode||(n.JSONRPCErrorCode={})),n.createJSONRPCErrorResponse=function(e,t,s,r){var i={code:t,message:s};return r&&(i.data=r),{jsonrpc:n.JSONRPC,id:e,error:i}}}(wt)),wt}var G={},hn;function Bn(){return hn||(hn=1,Object.defineProperty(G,"__esModule",{value:!0}),G.DefaultErrorCode=G.createLogDeprecationWarning=void 0,G.createLogDeprecationWarning=function(n){return function(){}},G.DefaultErrorCode=0),G}var dn;function Ms(){if(dn)return ue;dn=1,Object.defineProperty(ue,"__esModule",{value:!0}),ue.JSONRPCClient=void 0;var n=ut(),e=Bn(),t=e.createLogDeprecationWarning(`Using a higher order function on JSONRPCClient send method is deprecated.
3
4
  Instead of this: new JSONRPCClient((jsonRPCClient) => (clientParams) => /* no change here */)
4
5
  Do this: new JSONRPCClient((jsonRPCClient, clientParams) => /* no change here */)
5
- The old way still works, but we will drop the support in the future.`),s=function(){function r(i,o){this._send=i,this.createID=o,this.idToResolveMap=new Map,this.id=0}return r.prototype._createID=function(){return this.createID?this.createID():++this.id},r.prototype.timeout=function(i,o){var a=this;o===void 0&&(o=function(c){return n.createJSONRPCErrorResponse(c,e.DefaultErrorCode,"Request timeout")});var l=function(c,f){var m=setTimeout(function(){var g=a.idToResolveMap.get(c);g&&(a.idToResolveMap.delete(c),g(o(c)))},i);return f().then(function(g){return clearTimeout(m),g},function(g){return clearTimeout(m),Promise.reject(g)})};return{request:function(c,f,m){var g=a._createID();return l(g,function(){return a.requestWithID(c,f,m,g)})},requestAdvanced:function(c,f){return l(c.id,function(){return a.requestAdvanced(c,f)})}}},r.prototype.request=function(i,o,a){return this.requestWithID(i,o,a,this._createID())},r.prototype.requestWithID=function(i,o,a,l){var c={jsonrpc:n.JSONRPC,method:i,params:o,id:l};return this.requestAdvanced(c,a).then(function(f){return f.result!==void 0&&!f.error?f.result:f.result===void 0&&f.error?Promise.reject(new Error(f.error.message)):Promise.reject(new Error("An unexpected error occurred"))})},r.prototype.requestAdvanced=function(i,o){var a=this,l=new Promise(function(c){return a.idToResolveMap.set(i.id,c)});return this.send(i,o).then(function(){return l},function(c){return a.receive(n.createJSONRPCErrorResponse(i.id,e.DefaultErrorCode,c&&c.message||"Failed to send a request")),l})},r.prototype.notify=function(i,o,a){this.send({jsonrpc:n.JSONRPC,method:i,params:o},a).then(void 0,function(){})},r.prototype.send=function(i,o){var a=this._send(i,o);return typeof a=="function"&&(t(),a=a(o)),a},r.prototype.rejectAllPendingRequests=function(i){this.idToResolveMap.forEach(function(o,a){return o(n.createJSONRPCErrorResponse(a,e.DefaultErrorCode,i))}),this.idToResolveMap.clear()},r.prototype.receive=function(i){var o=this.idToResolveMap.get(i.id);o&&(this.idToResolveMap.delete(i.id),o(i))},r}();return he.JSONRPCClient=s,he}var J={},dn;function Ms(){if(dn)return J;dn=1;var n=J&&J.__assign||function(){return n=Object.assign||function(u){for(var p,y=1,E=arguments.length;y<E;y++){p=arguments[y];for(var _ in p)Object.prototype.hasOwnProperty.call(p,_)&&(u[_]=p[_])}return u},n.apply(this,arguments)},e=J&&J.__spreadArrays||function(){for(var u=0,p=0,y=arguments.length;p<y;p++)u+=arguments[p].length;for(var E=Array(u),_=0,p=0;p<y;p++)for(var v=arguments[p],S=0,k=v.length;S<k;S++,_++)E[_]=v[S];return E};Object.defineProperty(J,"__esModule",{value:!0}),J.JSONRPCServer=void 0;var t=lt(),s=Dn(),r=function(){return t.createJSONRPCErrorResponse(null,t.JSONRPCErrorCode.ParseError,"Parse error")},i=function(u){return t.createJSONRPCErrorResponse(t.isJSONRPCID(u.id)?u.id:null,t.JSONRPCErrorCode.InvalidRequest,"Invalid Request")},o=function(u){return t.createJSONRPCErrorResponse(u,t.JSONRPCErrorCode.MethodNotFound,"Method not found")},a=s.createLogDeprecationWarning(`Using a higher order function on JSONRPCServer.addMethod/addMethodAdvanced is deprecated.
6
+ The old way still works, but we will drop the support in the future.`),s=function(){function r(i,o){this._send=i,this.createID=o,this.idToResolveMap=new Map,this.id=0}return r.prototype._createID=function(){return this.createID?this.createID():++this.id},r.prototype.timeout=function(i,o){var a=this;o===void 0&&(o=function(c){return n.createJSONRPCErrorResponse(c,e.DefaultErrorCode,"Request timeout")});var l=function(c,f){var m=setTimeout(function(){var g=a.idToResolveMap.get(c);g&&(a.idToResolveMap.delete(c),g(o(c)))},i);return f().then(function(g){return clearTimeout(m),g},function(g){return clearTimeout(m),Promise.reject(g)})};return{request:function(c,f,m){var g=a._createID();return l(g,function(){return a.requestWithID(c,f,m,g)})},requestAdvanced:function(c,f){return l(c.id,function(){return a.requestAdvanced(c,f)})}}},r.prototype.request=function(i,o,a){return this.requestWithID(i,o,a,this._createID())},r.prototype.requestWithID=function(i,o,a,l){var c={jsonrpc:n.JSONRPC,method:i,params:o,id:l};return this.requestAdvanced(c,a).then(function(f){return f.result!==void 0&&!f.error?f.result:f.result===void 0&&f.error?Promise.reject(new Error(f.error.message)):Promise.reject(new Error("An unexpected error occurred"))})},r.prototype.requestAdvanced=function(i,o){var a=this,l=new Promise(function(c){return a.idToResolveMap.set(i.id,c)});return this.send(i,o).then(function(){return l},function(c){return a.receive(n.createJSONRPCErrorResponse(i.id,e.DefaultErrorCode,c&&c.message||"Failed to send a request")),l})},r.prototype.notify=function(i,o,a){this.send({jsonrpc:n.JSONRPC,method:i,params:o},a).then(void 0,function(){})},r.prototype.send=function(i,o){var a=this._send(i,o);return typeof a=="function"&&(t(),a=a(o)),a},r.prototype.rejectAllPendingRequests=function(i){this.idToResolveMap.forEach(function(o,a){return o(n.createJSONRPCErrorResponse(a,e.DefaultErrorCode,i))}),this.idToResolveMap.clear()},r.prototype.receive=function(i){var o=this.idToResolveMap.get(i.id);o&&(this.idToResolveMap.delete(i.id),o(i))},r}();return ue.JSONRPCClient=s,ue}var J={},fn;function Hs(){if(fn)return J;fn=1;var n=J&&J.__assign||function(){return n=Object.assign||function(u){for(var p,y=1,E=arguments.length;y<E;y++){p=arguments[y];for(var _ in p)Object.prototype.hasOwnProperty.call(p,_)&&(u[_]=p[_])}return u},n.apply(this,arguments)},e=J&&J.__spreadArrays||function(){for(var u=0,p=0,y=arguments.length;p<y;p++)u+=arguments[p].length;for(var E=Array(u),_=0,p=0;p<y;p++)for(var v=arguments[p],S=0,A=v.length;S<A;S++,_++)E[_]=v[S];return E};Object.defineProperty(J,"__esModule",{value:!0}),J.JSONRPCServer=void 0;var t=ut(),s=Bn(),r=function(){return t.createJSONRPCErrorResponse(null,t.JSONRPCErrorCode.ParseError,"Parse error")},i=function(u){return t.createJSONRPCErrorResponse(t.isJSONRPCID(u.id)?u.id:null,t.JSONRPCErrorCode.InvalidRequest,"Invalid Request")},o=function(u){return t.createJSONRPCErrorResponse(u,t.JSONRPCErrorCode.MethodNotFound,"Method not found")},a=s.createLogDeprecationWarning(`Using a higher order function on JSONRPCServer.addMethod/addMethodAdvanced is deprecated.
6
7
  Instead of this: jsonRPCServer.addMethod(methodName, (params) => (serverParams) => /* no change here */)
7
8
  Do this: jsonRPCServer.addMethod(methodName, (params, serverParams) => /* no change here */)
8
- The old way still works, but we will drop the support in the future.`),l=function(){function u(){this.mapErrorToJSONRPCErrorResponse=m,this.nameToMethodDictionary={},this.middleware=null}return u.prototype.addMethod=function(p,y){this.addMethodAdvanced(p,this.toJSONRPCMethod(y))},u.prototype.toJSONRPCMethod=function(p){var y=this;return function(E,_){var v=p(E.params,_);return typeof v=="function"&&(a(),v=v(_)),Promise.resolve(v).then(function(S){return f(E.id,S)},function(S){return console.warn("JSON-RPC method "+E.method+" responded an error",S),y.mapErrorToJSONRPCErrorResponseIfNecessary(E.id,S)})}},u.prototype.addMethodAdvanced=function(p,y){var E;this.nameToMethodDictionary=n(n({},this.nameToMethodDictionary),(E={},E[p]=y,E))},u.prototype.receiveJSON=function(p,y){var E=this.tryParseRequestJSON(p);return E?this.receive(E,y):Promise.resolve(r())},u.prototype.tryParseRequestJSON=function(p){try{return JSON.parse(p)}catch{return null}},u.prototype.receive=function(p,y){var E=this.nameToMethodDictionary[p.method];if(t.isJSONRPCRequest(p))if(E){var _=this.callMethod(E,p,y);return _.then(function(v){return g(p,v)})}else return p.id!==void 0?Promise.resolve(o(p.id)):Promise.resolve(null);else return Promise.resolve(i(p))},u.prototype.applyMiddleware=function(){for(var p=[],y=0;y<arguments.length;y++)p[y]=arguments[y];this.middleware?this.middleware=this.combineMiddlewares(e([this.middleware],p)):this.middleware=this.combineMiddlewares(p)},u.prototype.combineMiddlewares=function(p){return p.length?p.reduce(this.middlewareReducer):null},u.prototype.middlewareReducer=function(p,y){return function(E,_,v){return p(function(S,k){return y(E,S,k)},_,v)}},u.prototype.callMethod=function(p,y,E){var _=this,v=function(k,O){var q=p(k,O);return typeof q=="function"?(a(),q(O)):q},S=function(k){return console.warn('An unexpected error occurred while executing "'+y.method+'" JSON-RPC method:',k),Promise.resolve(_.mapErrorToJSONRPCErrorResponseIfNecessary(y.id,k))};try{return(this.middleware||c)(v,y,E).then(void 0,S)}catch(k){return S(k)}},u.prototype.mapErrorToJSONRPCErrorResponseIfNecessary=function(p,y){return p!==void 0?this.mapErrorToJSONRPCErrorResponse(p,y):null},u}();J.JSONRPCServer=l;var c=function(u,p,y){return u(p,y)},f=function(u,p){return u!==void 0?{jsonrpc:t.JSONRPC,id:u,result:p===void 0?null:p}:null},m=function(u,p){return t.createJSONRPCErrorResponse(u,s.DefaultErrorCode,p&&p.message||"An unexpected error occurred")},g=function(u,p){return p||(u.id!==void 0?t.createJSONRPCErrorResponse(u.id,t.JSONRPCErrorCode.InternalError,"Internal error"):null)};return J}var W={},fn;function Hs(){if(fn)return W;fn=1;var n=W&&W.__awaiter||function(r,i,o,a){function l(c){return c instanceof o?c:new o(function(f){f(c)})}return new(o||(o=Promise))(function(c,f){function m(p){try{u(a.next(p))}catch(y){f(y)}}function g(p){try{u(a.throw(p))}catch(y){f(y)}}function u(p){p.done?c(p.value):l(p.value).then(m,g)}u((a=a.apply(r,i||[])).next())})},e=W&&W.__generator||function(r,i){var o={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},a,l,c,f;return f={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(u){return function(p){return g([u,p])}}function g(u){if(a)throw new TypeError("Generator is already executing.");for(;o;)try{if(a=1,l&&(c=u[0]&2?l.return:u[0]?l.throw||((c=l.return)&&c.call(l),0):l.next)&&!(c=c.call(l,u[1])).done)return c;switch(l=0,c&&(u=[u[0]&2,c.value]),u[0]){case 0:case 1:c=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,l=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(c=o.trys,!(c=c.length>0&&c[c.length-1])&&(u[0]===6||u[0]===2)){o=0;continue}if(u[0]===3&&(!c||u[1]>c[0]&&u[1]<c[3])){o.label=u[1];break}if(u[0]===6&&o.label<c[1]){o.label=c[1],c=u;break}if(c&&o.label<c[2]){o.label=c[2],o.ops.push(u);break}c[2]&&o.ops.pop(),o.trys.pop();continue}u=i.call(r,o)}catch(p){u=[6,p],l=0}finally{a=c=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(W,"__esModule",{value:!0}),W.JSONRPCServerAndClient=void 0;var t=lt(),s=function(){function r(i,o){this.server=i,this.client=o}return r.prototype.applyServerMiddleware=function(){for(var i,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];(i=this.server).applyMiddleware.apply(i,o)},r.prototype.addMethod=function(i,o){this.server.addMethod(i,o)},r.prototype.addMethodAdvanced=function(i,o){this.server.addMethodAdvanced(i,o)},r.prototype.timeout=function(i){return this.client.timeout(i)},r.prototype.request=function(i,o,a){return this.client.request(i,o,a)},r.prototype.requestAdvanced=function(i,o){return this.client.requestAdvanced(i,o)},r.prototype.notify=function(i,o,a){this.client.notify(i,o,a)},r.prototype.rejectAllPendingRequests=function(i){this.client.rejectAllPendingRequests(i)},r.prototype.receiveAndSend=function(i,o,a){return n(this,void 0,void 0,function(){var l,c;return e(this,function(f){switch(f.label){case 0:return t.isJSONRPCResponse(i)?(this.client.receive(i),[3,4]):[3,1];case 1:return t.isJSONRPCRequest(i)?[4,this.server.receive(i,o)]:[3,3];case 2:return l=f.sent(),l?[2,this.client.send(l,a)]:[3,4];case 3:return c="Received an invalid JSON-RPC message",console.warn(c,i),[2,Promise.reject(new Error(c))];case 4:return[2]}})})},r}();return W.JSONRPCServerAndClient=s,W}var pn;function qs(){return pn||(pn=1,function(n){var e=Q&&Q.__createBinding||(Object.create?function(s,r,i,o){o===void 0&&(o=i),Object.defineProperty(s,o,{enumerable:!0,get:function(){return r[i]}})}:function(s,r,i,o){o===void 0&&(o=i),s[o]=r[i]}),t=Q&&Q.__exportStar||function(s,r){for(var i in s)i!=="default"&&!r.hasOwnProperty(i)&&e(r,s,i)};Object.defineProperty(n,"__esModule",{value:!0}),t(Bs(),n),t(lt(),n),t(Ms(),n),t(Hs(),n)}(Q)),Q}var zt=qs();const H=Object.create(null);H.open="0";H.close="1";H.ping="2";H.pong="3";H.message="4";H.upgrade="5";H.noop="6";const ke=Object.create(null);Object.keys(H).forEach(n=>{ke[H[n]]=n});const jt={type:"error",data:"parser error"},Bn=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Mn=typeof ArrayBuffer=="function",Hn=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,Vt=({type:n,data:e},t,s)=>Bn&&e instanceof Blob?t?s(e):mn(e,s):Mn&&(e instanceof ArrayBuffer||Hn(e))?t?s(e):mn(new Blob([e]),s):s(H[n]+(e||"")),mn=(n,e)=>{const t=new FileReader;return t.onload=function(){const s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(n)};function gn(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let wt;function Us(n,e){if(Bn&&n.data instanceof Blob)return n.data.arrayBuffer().then(gn).then(e);if(Mn&&(n.data instanceof ArrayBuffer||Hn(n.data)))return e(gn(n.data));Vt(n,!1,t=>{wt||(wt=new TextEncoder),e(wt.encode(t))})}const yn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<yn.length;n++)pe[yn.charCodeAt(n)]=n;const Fs=n=>{let e=n.length*.75,t=n.length,s,r=0,i,o,a,l;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const c=new ArrayBuffer(e),f=new Uint8Array(c);for(s=0;s<t;s+=4)i=pe[n.charCodeAt(s)],o=pe[n.charCodeAt(s+1)],a=pe[n.charCodeAt(s+2)],l=pe[n.charCodeAt(s+3)],f[r++]=i<<2|o>>4,f[r++]=(o&15)<<4|a>>2,f[r++]=(a&3)<<6|l&63;return c},Js=typeof ArrayBuffer=="function",Yt=(n,e)=>{if(typeof n!="string")return{type:"message",data:qn(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:Ws(n.substring(1),e)}:ke[t]?n.length>1?{type:ke[t],data:n.substring(1)}:{type:ke[t]}:jt},Ws=(n,e)=>{if(Js){const t=Fs(n);return qn(t,e)}else return{base64:!0,data:n}},qn=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},Un="",$s=(n,e)=>{const t=n.length,s=new Array(t);let r=0;n.forEach((i,o)=>{Vt(i,!1,a=>{s[o]=a,++r===t&&e(s.join(Un))})})},Ks=(n,e)=>{const t=n.split(Un),s=[];for(let r=0;r<t.length;r++){const i=Yt(t[r],e);if(s.push(i),i.type==="error")break}return s};function zs(){return new TransformStream({transform(n,e){Us(n,t=>{const s=t.length;let r;if(s<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,s);else if(s<65536){r=new Uint8Array(3);const i=new DataView(r.buffer);i.setUint8(0,126),i.setUint16(1,s)}else{r=new Uint8Array(9);const i=new DataView(r.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let St;function Ne(n){return n.reduce((e,t)=>e+t.length,0)}function Oe(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let s=0;for(let r=0;r<e;r++)t[r]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),t}function Vs(n,e){St||(St=new TextDecoder);const t=[];let s=0,r=-1,i=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(s===0){if(Ne(t)<1)break;const l=Oe(t,1);i=(l[0]&128)===128,r=l[0]&127,r<126?s=3:r===126?s=1:s=2}else if(s===1){if(Ne(t)<2)break;const l=Oe(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),s=3}else if(s===2){if(Ne(t)<8)break;const l=Oe(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),f=c.getUint32(0);if(f>Math.pow(2,21)-1){a.enqueue(jt);break}r=f*Math.pow(2,32)+c.getUint32(4),s=3}else{if(Ne(t)<r)break;const l=Oe(t,r);a.enqueue(Yt(i?l:St.decode(l),e)),s=0}if(r===0||r>n){a.enqueue(jt);break}}}})}const Fn=4;function N(n){if(n)return Ys(n)}function Ys(n){for(var e in N.prototype)n[e]=N.prototype[e];return n}N.prototype.on=N.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};N.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};N.prototype.off=N.prototype.removeListener=N.prototype.removeAllListeners=N.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,r=0;r<t.length;r++)if(s=t[r],s===e||s.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+n],this};N.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,r=t.length;s<r;++s)t[s].apply(this,e)}return this};N.prototype.emitReserved=N.prototype.emit;N.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};N.prototype.hasListeners=function(n){return!!this.listeners(n).length};const ut=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),I=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Qs="arraybuffer";function Jn(n,...e){return e.reduce((t,s)=>(n.hasOwnProperty(s)&&(t[s]=n[s]),t),{})}const Gs=I.setTimeout,Xs=I.clearTimeout;function ht(n,e){e.useNativeTimers?(n.setTimeoutFn=Gs.bind(I),n.clearTimeoutFn=Xs.bind(I)):(n.setTimeoutFn=I.setTimeout.bind(I),n.clearTimeoutFn=I.clearTimeout.bind(I))}const Zs=1.33;function er(n){return typeof n=="string"?tr(n):Math.ceil((n.byteLength||n.size)*Zs)}function tr(n){let e=0,t=0;for(let s=0,r=n.length;s<r;s++)e=n.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function Wn(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function nr(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function sr(n){let e={},t=n.split("&");for(let s=0,r=t.length;s<r;s++){let i=t[s].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}class rr extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class Qt extends N{constructor(e){super(),this.writable=!1,ht(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new rr(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Yt(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=nr(e);return t.length?"?"+t:""}}class ir extends Qt{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Ks(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,$s(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Wn()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let $n=!1;try{$n=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const or=$n;function ar(){}class cr extends ir{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(r,i)=>{this.onError("xhr post error",r,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}}class M extends N{constructor(e,t,s){super(),this.createRequest=e,ht(this,s),this._opts=s,this._method=s.method||"GET",this._uri=t,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const t=Jn(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(t);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&s.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var r;s.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=M.requestsCount++,M.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=ar,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete M.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}M.requestsCount=0;M.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",vn);else if(typeof addEventListener=="function"){const n="onpagehide"in I?"pagehide":"unload";addEventListener(n,vn,!1)}}function vn(){for(let n in M.requests)M.requests.hasOwnProperty(n)&&M.requests[n].abort()}const lr=function(){const n=Kn({xdomain:!1});return n&&n.responseType!==null}();class ur extends cr{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=lr&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new M(Kn,this.uri(),e)}}function Kn(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||or))return new XMLHttpRequest}catch{}if(!e)try{return new I[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const zn=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class hr extends Qt{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,s=zn?{}:Jn(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],r=t===e.length-1;Vt(s,this.supportsBinary,i=>{try{this.doWrite(s,i)}catch{}r&&ut(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Wn()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Ct=I.WebSocket||I.MozWebSocket;class dr extends hr{createSocket(e,t,s){return zn?new Ct(e,t,s):t?new Ct(e,t):new Ct(e)}doWrite(e,t){this.ws.send(t)}}class fr extends Qt{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Vs(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),r=zs();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{s.read().then(({done:a,value:l})=>{a||(this.onPacket(l),i())}).catch(a=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],r=t===e.length-1;this._writer.write(s).then(()=>{r&&ut(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const pr={websocket:dr,webtransport:fr,polling:ur},mr=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,gr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Dt(n){if(n.length>8e3)throw"URI too long";const e=n,t=n.indexOf("["),s=n.indexOf("]");t!=-1&&s!=-1&&(n=n.substring(0,t)+n.substring(t,s).replace(/:/g,";")+n.substring(s,n.length));let r=mr.exec(n||""),i={},o=14;for(;o--;)i[gr[o]]=r[o]||"";return t!=-1&&s!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=yr(i,i.path),i.queryKey=vr(i,i.query),i}function yr(n,e){const t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function vr(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,r,i){r&&(t[r]=i)}),t}const Bt=typeof addEventListener=="function"&&typeof removeEventListener=="function",Te=[];Bt&&addEventListener("offline",()=>{Te.forEach(n=>n())},!1);class Y extends N{constructor(e,t){if(super(),this.binaryType=Qs,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const s=Dt(e);t.hostname=s.host,t.secure=s.protocol==="https"||s.protocol==="wss",t.port=s.port,s.query&&(t.query=s.query)}else t.host&&(t.hostname=Dt(t.host).host);ht(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(s=>{const r=s.prototype.name;this.transports.push(r),this._transportsByName[r]=s}),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},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=sr(this.opts.query)),Bt&&(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"})},Te.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Fn,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Y.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",Y.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const r=this.writeBuffer[s].data;if(r&&(t+=er(r)),s>0&&t>this._maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,ut(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,s){return this._sendPacket("message",e,t,s),this}send(e,t,s){return this._sendPacket("message",e,t,s),this}_sendPacket(e,t,s,r){if(typeof t=="function"&&(r=t,t=void 0),typeof s=="function"&&(r=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const i={type:e,data:t,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(Y.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){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(),Bt&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Te.indexOf(this._offlineEventListener);s!==-1&&Te.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Y.protocol=Fn;class Er extends Y{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;Y.priorWebsocketSuccess=!1;const r=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!s)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Y.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(f(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=t.name,this.emitReserved("upgradeError",g)}}))};function i(){s||(s=!0,f(),t.close(),t=null)}const o=m=>{const g=new Error("probe error: "+m);g.transport=t.name,i(),this.emitReserved("upgradeError",g)};function a(){o("transport closed")}function l(){o("socket closed")}function c(m){t&&m.name!==t.name&&i()}const f=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",a),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",o),t.once("close",a),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}let Rr=class extends Er{constructor(e,t={}){const s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(r=>pr[r]).filter(r=>!!r)),super(e,s)}};function br(n,e="",t){let s=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),s=Dt(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const i=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+e,s.href=s.protocol+"://"+i+(t&&t.port===s.port?"":":"+s.port),s}const _r=typeof ArrayBuffer=="function",wr=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Vn=Object.prototype.toString,Sr=typeof Blob=="function"||typeof Blob<"u"&&Vn.call(Blob)==="[object BlobConstructor]",Cr=typeof File=="function"||typeof File<"u"&&Vn.call(File)==="[object FileConstructor]";function Gt(n){return _r&&(n instanceof ArrayBuffer||wr(n))||Sr&&n instanceof Blob||Cr&&n instanceof File}function Le(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,s=n.length;t<s;t++)if(Le(n[t]))return!0;return!1}if(Gt(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Le(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&Le(n[t]))return!0;return!1}function Nr(n){const e=[],t=n.data,s=n;return s.data=Mt(t,e),s.attachments=e.length,{packet:s,buffers:e}}function Mt(n,e){if(!n)return n;if(Gt(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let s=0;s<n.length;s++)t[s]=Mt(n[s],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=Mt(n[s],e));return t}return n}function Or(n,e){return n.data=Ht(n.data,e),delete n.attachments,n}function Ht(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=Ht(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=Ht(n[t],e));return n}const Ar=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],kr=5;var b;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(b||(b={}));class Tr{constructor(e){this.replacer=e}encode(e){return(e.type===b.EVENT||e.type===b.ACK)&&Le(e)?this.encodeAsBinary({type:e.type===b.EVENT?b.BINARY_EVENT:b.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===b.BINARY_EVENT||e.type===b.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Nr(e),s=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(s),r}}function En(n){return Object.prototype.toString.call(n)==="[object Object]"}class Xt extends N{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===b.BINARY_EVENT;s||t.type===b.BINARY_ACK?(t.type=s?b.EVENT:b.ACK,this.reconstructor=new Lr(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Gt(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(b[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===b.BINARY_EVENT||s.type===b.BINARY_ACK){const i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){const i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(i,t)}else s.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const i=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(Xt.isPayloadValid(s.type,i))s.data=i;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case b.CONNECT:return En(t);case b.DISCONNECT:return t===void 0;case b.CONNECT_ERROR:return typeof t=="string"||En(t);case b.EVENT:case b.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Ar.indexOf(t[0])===-1);case b.ACK:case b.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Lr{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Or(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const xr=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Xt,Encoder:Tr,get PacketType(){return b},protocol:kr},Symbol.toStringTag,{value:"Module"}));function j(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const Pr=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Yn extends N{constructor(e,t,s){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=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[j(e,"open",this.onopen.bind(this)),j(e,"packet",this.onpacket.bind(this)),j(e,"error",this.onerror.bind(this)),j(e,"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(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,r,i;if(Pr.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:b.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const f=this.ids++,m=t.pop();this._registerAckCallback(f,m),o.id=f}const a=(r=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||r===void 0?void 0:r.writable,l=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!a||(l?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;const r=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===e&&this.sendBuffer.splice(a,1);t.call(this,new Error("operation has timed out"))},r),o=(...a)=>{this.io.clearTimeoutFn(i),t.apply(this,a)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,r)=>{const i=(o,a)=>o?r(o):s(a);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...i)=>s!==this._queue[0]?void 0:(r!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...i)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:b.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case b.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 b.EVENT:case b.BINARY_EVENT:this.onevent(e);break;case b.ACK:case b.BINARY_ACK:this.onack(e);break;case b.DISCONNECT:this.ondisconnect();break;case b.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...r){s||(s=!0,t.packet({type:b.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:b.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function ce(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}ce.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0};ce.prototype.reset=function(){this.attempts=0};ce.prototype.setMin=function(n){this.ms=n};ce.prototype.setMax=function(n){this.max=n};ce.prototype.setJitter=function(n){this.jitter=n};class qt extends N{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,ht(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new ce({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||xr;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Rr(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const r=j(t,"open",function(){s.onopen(),e&&e()}),i=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=j(t,"error",i);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),t.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(j(e,"ping",this.onping.bind(this)),j(e,"data",this.ondata.bind(this)),j(e,"error",this.onerror.bind(this)),j(e,"close",this.onclose.bind(this)),j(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){ut(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new Yn(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const s of t)if(this.nsps[s].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const de={};function xe(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=br(n,e.path||"/socket.io"),s=t.source,r=t.id,i=t.path,o=de[r]&&i in de[r].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let l;return a?l=new qt(s,e):(de[r]||(de[r]=new qt(s,e)),l=de[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(xe,{Manager:qt,Socket:Yn,io:xe,connect:xe});const Qn=te(!1),Gn=te(!1),L=te({starting:!1,started:!1,stopping:!1,loading:!0}),Xr=()=>(w.useEffect(()=>(Rn("subscribe","server"),Ir(),()=>{Rn("unsubscribe","server")}),[]),Nt(L));async function Ir(){L.set({...L.get(),loading:!0});const{started:n,starting:e,stopping:t}=await se("server.started");L.set({started:n,stopping:t,starting:e,loading:!1})}const Zr=()=>{L.set({...L.get(),loading:!0}),se("server.start")},ei=()=>{L.set({...L.get(),loading:!0}),se("server.stop")},ti=()=>{L.set({...L.get(),loading:!0}),se("server.restart")},ni=()=>{L.set({...L.get(),loading:!0}),se("server.update")},Xn=te(!1),Zn=te(null),jr=te([]),Dr=te(null),ne=xe();ne.on("connect",()=>{console.info("[socket] Connected"),Qn.set(!0),Gn.set(!1)});ne.on("disconnect",()=>{console.info("[socket] Disconnected"),Qn.set(!1),Gn.set(!0)});ne.on("data",n=>{Dr.set(n),ns.set(n.version),Zn.set(n.user),jr.set(n.roles),Xn.set(n.canLogOut)});ne.on("rpc",n=>{Zt.receiveAndSend(n)});ne.on("status",({started:n,starting:e,stopping:t})=>{L.set({started:n,starting:e,stopping:t,loading:!1})});const Br=new zt.JSONRPCServer,Mr=new zt.JSONRPCClient(async n=>{ne.emit("rpc",n)}),Zt=new zt.JSONRPCServerAndClient(Br,Mr),se=(n,...e)=>Zt.request(n,e),si=(n,...e)=>Zt.notify(n,e),Rn=(n,...e)=>ne.emit(n,...e),Hr=({disabled:n=!1,value:e,onChange:t,...s})=>{const[r,i]=w.useState(!1),[o,a]=w.useState(!1),[l,c]=w.useState([]),f=w.useRef(null);async function m(){a(!0),c([]);const g=await se("roles.list");c(g.map(u=>u.name)),a(!1)}return w.useEffect(()=>{if(!r)return;function g(u){u.target&&!f.current?.contains(u.target)&&i(!1)}return document.addEventListener("click",g),()=>document.removeEventListener("click",g)},[r]),d.jsxs("div",{className:`role-dropdown ${n?"disabled":""}`,ref:f,...s,children:[r&&d.jsxs("div",{className:"options",children:[o&&d.jsx("div",{className:"option search",style:{position:"relative"},children:d.jsx(bn,{active:!0,size:"small"})}),l.map(g=>d.jsx("div",{onClick:()=>{t(g),i(!1)},className:`option ${e===g?"green":""}`,children:g},g))]}),d.jsxs("div",{className:"selected",onClick:()=>{i(g=>!g),r||m()},children:[d.jsx("div",{className:"value",children:e}),d.jsx(wn,{})]})]})},ri=({placeholder:n="",disabled:e=!1,type:t,value:s=[],options:r=[],onChange:i})=>{const o=(c,f)=>{const m=s.slice();m[c]=f,i(m)},a=()=>{const c=s.slice();c.push({string:"",number:0,password:"",role:"",enum:r&&r[0]}[t]),i(c)},l=c=>{const f=s.slice();f.splice(c,1),i(f)};return d.jsxs("div",{className:`br-list-input ${e?"disabled":""}`,children:[(s||[]).map((c,f)=>d.jsxs("div",{className:"br-list-item",children:[(t==="string"||t==="password"||t==="number")&&d.jsx(_n,{value:c,onChange:m=>o(f,m),placeholder:n,type:t==="string"?"text":t,disabled:e}),t==="enum"&&d.jsx(Ds,{value:c,options:r,onChange:m=>o(f,m),disabled:e}),t==="role"&&d.jsx(Hr,{value:c,onChange:m=>o(f,m),disabled:e}),d.jsx(Pe,{icon:!0,warn:!0,"data-tooltip":"Remove this item from the list",onClick:()=>l(f),disabled:e,children:d.jsx(Sn,{})})]},f)),d.jsx(Pe,{icon:!0,main:!0,"data-tooltip":"Add an item to the list",onClick:a,disabled:e,children:d.jsx(os,{})})]})},qr=({children:n,attached:e,className:t})=>d.jsx("div",{className:`navbar ${e?"attached":""} ${t??""}`,children:n}),ii=({title:n,className:e,children:t})=>{const s=Nt(Zn),r=Nt(Xn);return d.jsxs("div",{className:`main-nav ${e??""}`,children:[d.jsx("header",{className:"nav-header",children:n}),d.jsxs(qr,{children:[d.jsxs("span",{style:{flex:1,marginLeft:8},children:["Welcome, ",s?.username??"..."]}),t,r&&d.jsx(Pe,{icon:!0,error:!0,"data-tooltip":"Logout of Web UI",onClick:()=>ys(),children:d.jsx(as,{})})]})]})},oi=({children:n})=>d.jsx("div",{className:"main-content",children:n}),ai=({children:n,loading:e})=>d.jsxs("div",{children:[d.jsx(ss,{}),d.jsx("div",{className:"content-parent",children:!e&&d.jsx("div",{className:"content",children:n})})]}),ci=({disabled:n=!1,value:e,placeholder:t,onChange:s,...r})=>{const[i,o]=w.useState(!1),[a,l]=w.useState(!1),[c,f]=w.useState([]),[m,g]=w.useState(""),u=w.useRef(null);w.useEffect(()=>{if(!i)return;function v(S){S.target&&!u.current?.contains(S.target)&&o(!1)}return document.addEventListener("click",v),()=>document.removeEventListener("click",v)},[i]);function p(v){const S=e.slice();S.splice(v,1),s(S)}function y({id:v,name:S}){s([...e,{id:v,name:S}]),o(!1),g("")}const E=w.useRef(m);E.current=m;const _=w.useMemo(()=>vs(async()=>{if(E.current.length===0){o(!1),l(!1),f([]);return}l(!0),o(!0);const{players:v}=await se("players.list",{page:0,search:E.current,sort:"lastSeen",direction:-1,filter:""});f(v),l(!1)},500),[]);return d.jsxs("div",{className:`br-player-list ${n?"disabled":""}`,...r,children:[e.map((v,S)=>d.jsxs("div",{className:"br-player-item",children:[d.jsx(oe,{href:`/players/${v.id}`,className:"selected","data-tooltip":"Click to navigate to player page",children:v.name}),d.jsx(Pe,{icon:!0,warn:!0,"data-tooltip":"Remove this player from the list",onClick:()=>p(S),children:d.jsx(Sn,{})})]},v.id)),d.jsxs("div",{className:"player-search",ref:u,children:[d.jsx(_n,{type:"text",placeholder:"Search Players...",value:m,onChange:v=>{g(v),_()}}),i&&d.jsxs("div",{className:"options",children:[a&&d.jsx("div",{className:"option search",style:{position:"relative"},children:d.jsx(bn,{active:!0,size:"small"})}),c.map(v=>d.jsx("div",{onClick:()=>y(v),className:"option",children:v.name},v.id))]})]})]})},li=({children:n,className:e,...t})=>d.jsx("div",{className:`scroll-container ${e??""}`,...t,children:d.jsx("div",{className:"scroll-scroller",children:n})}),X=({children:n,disabled:e,to:t,...s})=>d.jsx(oe,{href:t,className:r=>`menu-button ${e?"disabled":""} ${r?"active":""}`,...s,children:d.jsx("div",{className:"menu-button-content",children:n})}),ui=w.memo(()=>d.jsxs("div",{className:"main-menu-buttons",children:[d.jsxs(X,{to:"/","data-tooltip":"Chat with players, view server status. Main Dashboard",children:[d.jsx(cs,{style:{background:"#de4f43"}}),"Dashboard"]}),d.jsxs(X,{to:"/worlds","data-tooltip":"Manage worlds",children:[d.jsx(ls,{style:{background:"#f0a500"}}),"Worlds"]}),d.jsxs(X,{to:"/history","data-tooltip":"Browse chat history",children:[d.jsx(us,{style:{background:"#008bd6"}}),"History"]}),d.jsxs(X,{to:"/plugins","data-tooltip":"Manage, reload, and configure plugins",children:[d.jsx(hs,{style:{background:"#00b35f"}}),"Plugins"]}),d.jsxs(X,{to:"/players","data-tooltip":"Browse player info and play time",children:[d.jsx(ds,{style:{background:"#b3006b"}}),"Players"]}),d.jsxs(X,{to:"/server","data-tooltip":"Server management",children:[d.jsx(fs,{style:{background:"#453d9c"}}),"Server"]}),d.jsxs(X,{to:"/users","data-tooltip":"Server users",children:[d.jsx(ps,{style:{background:"#7f0b8a"}}),"Users"]})]})),hi=({name:n,sort:e,direction:t})=>n===e&&d.jsxs(d.Fragment,{children:[t===1&&d.jsx(ms,{}),t===-1&&d.jsx(gs,{})]}),di=({disabled:n=!1,value:e,onChange:t,tooltip:s})=>d.jsx("div",{"data-tooltip":s,className:`toggle ${n?"disabled":""}`,onClick:()=>t(!e),children:d.jsx("div",{className:`toggle-slider ${e?"on":""}`,children:d.jsx("div",{className:"symbol"})})});export{Dr as $,Yr as C,Ds as D,Qr as I,Is as L,ii as N,oi as P,Hr as R,ui as S,di as T,li as a,si as b,qr as c,hi as d,ri as e,ci as f,Zr as g,ei as h,Rn as i,ti as j,ni as k,Zn as l,L as m,ai as n,js as o,se as r,ne as s,Xr as u};
9
- //# sourceMappingURL=index-CtY8r8rg.js.map
9
+ The old way still works, but we will drop the support in the future.`),l=function(){function u(){this.mapErrorToJSONRPCErrorResponse=m,this.nameToMethodDictionary={},this.middleware=null}return u.prototype.addMethod=function(p,y){this.addMethodAdvanced(p,this.toJSONRPCMethod(y))},u.prototype.toJSONRPCMethod=function(p){var y=this;return function(E,_){var v=p(E.params,_);return typeof v=="function"&&(a(),v=v(_)),Promise.resolve(v).then(function(S){return f(E.id,S)},function(S){return console.warn("JSON-RPC method "+E.method+" responded an error",S),y.mapErrorToJSONRPCErrorResponseIfNecessary(E.id,S)})}},u.prototype.addMethodAdvanced=function(p,y){var E;this.nameToMethodDictionary=n(n({},this.nameToMethodDictionary),(E={},E[p]=y,E))},u.prototype.receiveJSON=function(p,y){var E=this.tryParseRequestJSON(p);return E?this.receive(E,y):Promise.resolve(r())},u.prototype.tryParseRequestJSON=function(p){try{return JSON.parse(p)}catch{return null}},u.prototype.receive=function(p,y){var E=this.nameToMethodDictionary[p.method];if(t.isJSONRPCRequest(p))if(E){var _=this.callMethod(E,p,y);return _.then(function(v){return g(p,v)})}else return p.id!==void 0?Promise.resolve(o(p.id)):Promise.resolve(null);else return Promise.resolve(i(p))},u.prototype.applyMiddleware=function(){for(var p=[],y=0;y<arguments.length;y++)p[y]=arguments[y];this.middleware?this.middleware=this.combineMiddlewares(e([this.middleware],p)):this.middleware=this.combineMiddlewares(p)},u.prototype.combineMiddlewares=function(p){return p.length?p.reduce(this.middlewareReducer):null},u.prototype.middlewareReducer=function(p,y){return function(E,_,v){return p(function(S,A){return y(E,S,A)},_,v)}},u.prototype.callMethod=function(p,y,E){var _=this,v=function(A,O){var U=p(A,O);return typeof U=="function"?(a(),U(O)):U},S=function(A){return console.warn('An unexpected error occurred while executing "'+y.method+'" JSON-RPC method:',A),Promise.resolve(_.mapErrorToJSONRPCErrorResponseIfNecessary(y.id,A))};try{return(this.middleware||c)(v,y,E).then(void 0,S)}catch(A){return S(A)}},u.prototype.mapErrorToJSONRPCErrorResponseIfNecessary=function(p,y){return p!==void 0?this.mapErrorToJSONRPCErrorResponse(p,y):null},u}();J.JSONRPCServer=l;var c=function(u,p,y){return u(p,y)},f=function(u,p){return u!==void 0?{jsonrpc:t.JSONRPC,id:u,result:p===void 0?null:p}:null},m=function(u,p){return t.createJSONRPCErrorResponse(u,s.DefaultErrorCode,p&&p.message||"An unexpected error occurred")},g=function(u,p){return p||(u.id!==void 0?t.createJSONRPCErrorResponse(u.id,t.JSONRPCErrorCode.InternalError,"Internal error"):null)};return J}var W={},pn;function Us(){if(pn)return W;pn=1;var n=W&&W.__awaiter||function(r,i,o,a){function l(c){return c instanceof o?c:new o(function(f){f(c)})}return new(o||(o=Promise))(function(c,f){function m(p){try{u(a.next(p))}catch(y){f(y)}}function g(p){try{u(a.throw(p))}catch(y){f(y)}}function u(p){p.done?c(p.value):l(p.value).then(m,g)}u((a=a.apply(r,i||[])).next())})},e=W&&W.__generator||function(r,i){var o={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},a,l,c,f;return f={next:m(0),throw:m(1),return:m(2)},typeof Symbol=="function"&&(f[Symbol.iterator]=function(){return this}),f;function m(u){return function(p){return g([u,p])}}function g(u){if(a)throw new TypeError("Generator is already executing.");for(;o;)try{if(a=1,l&&(c=u[0]&2?l.return:u[0]?l.throw||((c=l.return)&&c.call(l),0):l.next)&&!(c=c.call(l,u[1])).done)return c;switch(l=0,c&&(u=[u[0]&2,c.value]),u[0]){case 0:case 1:c=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,l=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(c=o.trys,!(c=c.length>0&&c[c.length-1])&&(u[0]===6||u[0]===2)){o=0;continue}if(u[0]===3&&(!c||u[1]>c[0]&&u[1]<c[3])){o.label=u[1];break}if(u[0]===6&&o.label<c[1]){o.label=c[1],c=u;break}if(c&&o.label<c[2]){o.label=c[2],o.ops.push(u);break}c[2]&&o.ops.pop(),o.trys.pop();continue}u=i.call(r,o)}catch(p){u=[6,p],l=0}finally{a=c=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}};Object.defineProperty(W,"__esModule",{value:!0}),W.JSONRPCServerAndClient=void 0;var t=ut(),s=function(){function r(i,o){this.server=i,this.client=o}return r.prototype.applyServerMiddleware=function(){for(var i,o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];(i=this.server).applyMiddleware.apply(i,o)},r.prototype.addMethod=function(i,o){this.server.addMethod(i,o)},r.prototype.addMethodAdvanced=function(i,o){this.server.addMethodAdvanced(i,o)},r.prototype.timeout=function(i){return this.client.timeout(i)},r.prototype.request=function(i,o,a){return this.client.request(i,o,a)},r.prototype.requestAdvanced=function(i,o){return this.client.requestAdvanced(i,o)},r.prototype.notify=function(i,o,a){this.client.notify(i,o,a)},r.prototype.rejectAllPendingRequests=function(i){this.client.rejectAllPendingRequests(i)},r.prototype.receiveAndSend=function(i,o,a){return n(this,void 0,void 0,function(){var l,c;return e(this,function(f){switch(f.label){case 0:return t.isJSONRPCResponse(i)?(this.client.receive(i),[3,4]):[3,1];case 1:return t.isJSONRPCRequest(i)?[4,this.server.receive(i,o)]:[3,3];case 2:return l=f.sent(),l?[2,this.client.send(l,a)]:[3,4];case 3:return c="Received an invalid JSON-RPC message",console.warn(c,i),[2,Promise.reject(new Error(c))];case 4:return[2]}})})},r}();return W.JSONRPCServerAndClient=s,W}var mn;function qs(){return mn||(mn=1,function(n){var e=Q&&Q.__createBinding||(Object.create?function(s,r,i,o){o===void 0&&(o=i),Object.defineProperty(s,o,{enumerable:!0,get:function(){return r[i]}})}:function(s,r,i,o){o===void 0&&(o=i),s[o]=r[i]}),t=Q&&Q.__exportStar||function(s,r){for(var i in s)i!=="default"&&!r.hasOwnProperty(i)&&e(r,s,i)};Object.defineProperty(n,"__esModule",{value:!0}),t(Ms(),n),t(ut(),n),t(Hs(),n),t(Us(),n)}(Q)),Q}var Vt=qs();const H=Object.create(null);H.open="0";H.close="1";H.ping="2";H.pong="3";H.message="4";H.upgrade="5";H.noop="6";const Ae=Object.create(null);Object.keys(H).forEach(n=>{Ae[H[n]]=n});const Dt={type:"error",data:"parser error"},Mn=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Hn=typeof ArrayBuffer=="function",Un=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,Yt=({type:n,data:e},t,s)=>Mn&&e instanceof Blob?t?s(e):gn(e,s):Hn&&(e instanceof ArrayBuffer||Un(e))?t?s(e):gn(new Blob([e]),s):s(H[n]+(e||"")),gn=(n,e)=>{const t=new FileReader;return t.onload=function(){const s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(n)};function yn(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let St;function Fs(n,e){if(Mn&&n.data instanceof Blob)return n.data.arrayBuffer().then(yn).then(e);if(Hn&&(n.data instanceof ArrayBuffer||Un(n.data)))return e(yn(n.data));Yt(n,!1,t=>{St||(St=new TextEncoder),e(St.encode(t))})}const vn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fe=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<vn.length;n++)fe[vn.charCodeAt(n)]=n;const Js=n=>{let e=n.length*.75,t=n.length,s,r=0,i,o,a,l;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const c=new ArrayBuffer(e),f=new Uint8Array(c);for(s=0;s<t;s+=4)i=fe[n.charCodeAt(s)],o=fe[n.charCodeAt(s+1)],a=fe[n.charCodeAt(s+2)],l=fe[n.charCodeAt(s+3)],f[r++]=i<<2|o>>4,f[r++]=(o&15)<<4|a>>2,f[r++]=(a&3)<<6|l&63;return c},Ws=typeof ArrayBuffer=="function",Qt=(n,e)=>{if(typeof n!="string")return{type:"message",data:qn(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:$s(n.substring(1),e)}:Ae[t]?n.length>1?{type:Ae[t],data:n.substring(1)}:{type:Ae[t]}:Dt},$s=(n,e)=>{if(Ws){const t=Js(n);return qn(t,e)}else return{base64:!0,data:n}},qn=(n,e)=>{switch(e){case"blob":return n instanceof Blob?n:new Blob([n]);case"arraybuffer":default:return n instanceof ArrayBuffer?n:n.buffer}},Fn="",Ks=(n,e)=>{const t=n.length,s=new Array(t);let r=0;n.forEach((i,o)=>{Yt(i,!1,a=>{s[o]=a,++r===t&&e(s.join(Fn))})})},zs=(n,e)=>{const t=n.split(Fn),s=[];for(let r=0;r<t.length;r++){const i=Qt(t[r],e);if(s.push(i),i.type==="error")break}return s};function Vs(){return new TransformStream({transform(n,e){Fs(n,t=>{const s=t.length;let r;if(s<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,s);else if(s<65536){r=new Uint8Array(3);const i=new DataView(r.buffer);i.setUint8(0,126),i.setUint16(1,s)}else{r=new Uint8Array(9);const i=new DataView(r.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let Ct;function Ne(n){return n.reduce((e,t)=>e+t.length,0)}function Oe(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let s=0;for(let r=0;r<e;r++)t[r]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),t}function Ys(n,e){Ct||(Ct=new TextDecoder);const t=[];let s=0,r=-1,i=!1;return new TransformStream({transform(o,a){for(t.push(o);;){if(s===0){if(Ne(t)<1)break;const l=Oe(t,1);i=(l[0]&128)===128,r=l[0]&127,r<126?s=3:r===126?s=1:s=2}else if(s===1){if(Ne(t)<2)break;const l=Oe(t,2);r=new DataView(l.buffer,l.byteOffset,l.length).getUint16(0),s=3}else if(s===2){if(Ne(t)<8)break;const l=Oe(t,8),c=new DataView(l.buffer,l.byteOffset,l.length),f=c.getUint32(0);if(f>Math.pow(2,21)-1){a.enqueue(Dt);break}r=f*Math.pow(2,32)+c.getUint32(4),s=3}else{if(Ne(t)<r)break;const l=Oe(t,r);a.enqueue(Qt(i?l:Ct.decode(l),e)),s=0}if(r===0||r>n){a.enqueue(Dt);break}}}})}const Jn=4;function N(n){if(n)return Qs(n)}function Qs(n){for(var e in N.prototype)n[e]=N.prototype[e];return n}N.prototype.on=N.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};N.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};N.prototype.off=N.prototype.removeListener=N.prototype.removeAllListeners=N.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,r=0;r<t.length;r++)if(s=t[r],s===e||s.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+n],this};N.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,r=t.length;s<r;++s)t[s].apply(this,e)}return this};N.prototype.emitReserved=N.prototype.emit;N.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};N.prototype.hasListeners=function(n){return!!this.listeners(n).length};const ht=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),I=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Gs="arraybuffer";function Wn(n,...e){return e.reduce((t,s)=>(n.hasOwnProperty(s)&&(t[s]=n[s]),t),{})}const Xs=I.setTimeout,Zs=I.clearTimeout;function dt(n,e){e.useNativeTimers?(n.setTimeoutFn=Xs.bind(I),n.clearTimeoutFn=Zs.bind(I)):(n.setTimeoutFn=I.setTimeout.bind(I),n.clearTimeoutFn=I.clearTimeout.bind(I))}const er=1.33;function tr(n){return typeof n=="string"?nr(n):Math.ceil((n.byteLength||n.size)*er)}function nr(n){let e=0,t=0;for(let s=0,r=n.length;s<r;s++)e=n.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function $n(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function sr(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function rr(n){let e={},t=n.split("&");for(let s=0,r=t.length;s<r;s++){let i=t[s].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}class ir extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class Gt extends N{constructor(e){super(),this.writable=!1,dt(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new ir(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Qt(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=sr(e);return t.length?"?"+t:""}}class or extends Gt{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};zs(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Ks(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=$n()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let Kn=!1;try{Kn=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const ar=Kn;function cr(){}class lr extends or{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(r,i)=>{this.onError("xhr post error",r,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}}class M extends N{constructor(e,t,s){super(),this.createRequest=e,dt(this,s),this._opts=s,this._method=s.method||"GET",this._uri=t,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const t=Wn(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(t);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let r in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(r)&&s.setRequestHeader(r,this._opts.extraHeaders[r])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var r;s.readyState===3&&((r=this._opts.cookieJar)===null||r===void 0||r.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(r){this.setTimeoutFn(()=>{this._onError(r)},0);return}typeof document<"u"&&(this._index=M.requestsCount++,M.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=cr,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete M.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}M.requestsCount=0;M.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",En);else if(typeof addEventListener=="function"){const n="onpagehide"in I?"pagehide":"unload";addEventListener(n,En,!1)}}function En(){for(let n in M.requests)M.requests.hasOwnProperty(n)&&M.requests[n].abort()}const ur=function(){const n=zn({xdomain:!1});return n&&n.responseType!==null}();class hr extends lr{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=ur&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new M(zn,this.uri(),e)}}function zn(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||ar))return new XMLHttpRequest}catch{}if(!e)try{return new I[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Vn=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class dr extends Gt{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,s=Vn?{}:Wn(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],r=t===e.length-1;Yt(s,this.supportsBinary,i=>{try{this.doWrite(s,i)}catch{}r&&ht(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=$n()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const Nt=I.WebSocket||I.MozWebSocket;class fr extends dr{createSocket(e,t,s){return Vn?new Nt(e,t,s):t?new Nt(e,t):new Nt(e)}doWrite(e,t){this.ws.send(t)}}class pr extends Gt{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=Ys(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),r=Vs();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();const i=()=>{s.read().then(({done:a,value:l})=>{a||(this.onPacket(l),i())}).catch(a=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],r=t===e.length-1;this._writer.write(s).then(()=>{r&&ht(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const mr={websocket:fr,webtransport:pr,polling:hr},gr=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,yr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Bt(n){if(n.length>8e3)throw"URI too long";const e=n,t=n.indexOf("["),s=n.indexOf("]");t!=-1&&s!=-1&&(n=n.substring(0,t)+n.substring(t,s).replace(/:/g,";")+n.substring(s,n.length));let r=gr.exec(n||""),i={},o=14;for(;o--;)i[yr[o]]=r[o]||"";return t!=-1&&s!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=vr(i,i.path),i.queryKey=Er(i,i.query),i}function vr(n,e){const t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function Er(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,r,i){r&&(t[r]=i)}),t}const Mt=typeof addEventListener=="function"&&typeof removeEventListener=="function",Te=[];Mt&&addEventListener("offline",()=>{Te.forEach(n=>n())},!1);class Y extends N{constructor(e,t){if(super(),this.binaryType=Gs,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const s=Bt(e);t.hostname=s.host,t.secure=s.protocol==="https"||s.protocol==="wss",t.port=s.port,s.query&&(t.query=s.query)}else t.host&&(t.hostname=Bt(t.host).host);dt(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(s=>{const r=s.prototype.name;this.transports.push(r),this._transportsByName[r]=s}),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},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=rr(this.opts.query)),Mt&&(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"})},Te.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=Jn,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Y.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",Y.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),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){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const r=this.writeBuffer[s].data;if(r&&(t+=tr(r)),s>0&&t>this._maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,ht(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,s){return this._sendPacket("message",e,t,s),this}send(e,t,s){return this._sendPacket("message",e,t,s),this}_sendPacket(e,t,s,r){if(typeof t=="function"&&(r=t,t=void 0),typeof s=="function"&&(r=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const i={type:e,data:t,options:s};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(Y.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){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(),Mt&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Te.indexOf(this._offlineEventListener);s!==-1&&Te.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Y.protocol=Jn;class Rr extends Y{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;Y.priorWebsocketSuccess=!1;const r=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!s)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Y.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(f(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const g=new Error("probe error");g.transport=t.name,this.emitReserved("upgradeError",g)}}))};function i(){s||(s=!0,f(),t.close(),t=null)}const o=m=>{const g=new Error("probe error: "+m);g.transport=t.name,i(),this.emitReserved("upgradeError",g)};function a(){o("transport closed")}function l(){o("socket closed")}function c(m){t&&m.name!==t.name&&i()}const f=()=>{t.removeListener("open",r),t.removeListener("error",o),t.removeListener("close",a),this.off("close",l),this.off("upgrading",c)};t.once("open",r),t.once("error",o),t.once("close",a),this.once("close",l),this.once("upgrading",c),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}let br=class extends Rr{constructor(e,t={}){const s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(r=>mr[r]).filter(r=>!!r)),super(e,s)}};function _r(n,e="",t){let s=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),s=Bt(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const i=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+i+":"+s.port+e,s.href=s.protocol+"://"+i+(t&&t.port===s.port?"":":"+s.port),s}const wr=typeof ArrayBuffer=="function",Sr=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,Yn=Object.prototype.toString,Cr=typeof Blob=="function"||typeof Blob<"u"&&Yn.call(Blob)==="[object BlobConstructor]",Nr=typeof File=="function"||typeof File<"u"&&Yn.call(File)==="[object FileConstructor]";function Xt(n){return wr&&(n instanceof ArrayBuffer||Sr(n))||Cr&&n instanceof Blob||Nr&&n instanceof File}function Le(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,s=n.length;t<s;t++)if(Le(n[t]))return!0;return!1}if(Xt(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return Le(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&Le(n[t]))return!0;return!1}function Or(n){const e=[],t=n.data,s=n;return s.data=Ht(t,e),s.attachments=e.length,{packet:s,buffers:e}}function Ht(n,e){if(!n)return n;if(Xt(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let s=0;s<n.length;s++)t[s]=Ht(n[s],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=Ht(n[s],e));return t}return n}function kr(n,e){return n.data=Ut(n.data,e),delete n.attachments,n}function Ut(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=Ut(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=Ut(n[t],e));return n}const Ar=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Tr=5;var b;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(b||(b={}));class Lr{constructor(e){this.replacer=e}encode(e){return(e.type===b.EVENT||e.type===b.ACK)&&Le(e)?this.encodeAsBinary({type:e.type===b.EVENT?b.BINARY_EVENT:b.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===b.BINARY_EVENT||e.type===b.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Or(e),s=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(s),r}}function Rn(n){return Object.prototype.toString.call(n)==="[object Object]"}class Zt extends N{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===b.BINARY_EVENT;s||t.type===b.BINARY_ACK?(t.type=s?b.EVENT:b.ACK,this.reconstructor=new xr(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(Xt(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(b[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===b.BINARY_EVENT||s.type===b.BINARY_ACK){const i=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){const i=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(i,t)}else s.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const i=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(Zt.isPayloadValid(s.type,i))s.data=i;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case b.CONNECT:return Rn(t);case b.DISCONNECT:return t===void 0;case b.CONNECT_ERROR:return typeof t=="string"||Rn(t);case b.EVENT:case b.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&Ar.indexOf(t[0])===-1);case b.ACK:case b.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class xr{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=kr(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Pr=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Zt,Encoder:Lr,get PacketType(){return b},protocol:Tr},Symbol.toStringTag,{value:"Module"}));function j(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const Ir=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Qn extends N{constructor(e,t,s){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=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[j(e,"open",this.onopen.bind(this)),j(e,"packet",this.onpacket.bind(this)),j(e,"error",this.onerror.bind(this)),j(e,"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(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,r,i;if(Ir.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:b.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const f=this.ids++,m=t.pop();this._registerAckCallback(f,m),o.id=f}const a=(r=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||r===void 0?void 0:r.writable,l=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!a||(l?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;const r=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===e&&this.sendBuffer.splice(a,1);t.call(this,new Error("operation has timed out"))},r),o=(...a)=>{this.io.clearTimeoutFn(i),t.apply(this,a)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,r)=>{const i=(o,a)=>o?r(o):s(a);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...i)=>s!==this._queue[0]?void 0:(r!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...i)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:b.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case b.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 b.EVENT:case b.BINARY_EVENT:this.onevent(e);break;case b.ACK:case b.BINARY_ACK:this.onack(e);break;case b.DISCONNECT:this.ondisconnect();break;case b.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...r){s||(s=!0,t.packet({type:b.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:b.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function ae(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}ae.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0};ae.prototype.reset=function(){this.attempts=0};ae.prototype.setMin=function(n){this.ms=n};ae.prototype.setMax=function(n){this.max=n};ae.prototype.setJitter=function(n){this.jitter=n};class qt extends N{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,dt(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new ae({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Pr;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new br(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const r=j(t,"open",function(){s.onopen(),e&&e()}),i=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),e?e(a):this.maybeReconnectOnOpen()},o=j(t,"error",i);if(this._timeout!==!1){const a=this._timeout,l=this.setTimeoutFn(()=>{r(),i(new Error("timeout")),t.close()},a);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(r),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(j(e,"ping",this.onping.bind(this)),j(e,"data",this.ondata.bind(this)),j(e,"error",this.onerror.bind(this)),j(e,"close",this.onclose.bind(this)),j(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){ht(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new Qn(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const s of t)if(this.nsps[s].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const he={};function xe(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=_r(n,e.path||"/socket.io"),s=t.source,r=t.id,i=t.path,o=he[r]&&i in he[r].nsps,a=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let l;return a?l=new qt(s,e):(he[r]||(he[r]=new qt(s,e)),l=he[r]),t.query&&!e.query&&(e.query=t.queryKey),l.socket(t.path,e)}Object.assign(xe,{Manager:qt,Socket:Qn,io:xe,connect:xe});const Gn=te(!1),Xn=te(!1),L=te({starting:!1,started:!1,stopping:!1,loading:!0}),Zr=()=>(w.useEffect(()=>(bn("subscribe","server"),jr(),()=>{bn("unsubscribe","server")}),[]),Ot(L));async function jr(){L.set({...L.get(),loading:!0});const{started:n,starting:e,stopping:t}=await se("server.started");L.set({started:n,stopping:t,starting:e,loading:!1})}const ei=()=>{L.set({...L.get(),loading:!0}),se("server.start")},ti=()=>{L.set({...L.get(),loading:!0}),se("server.stop")},ni=()=>{L.set({...L.get(),loading:!0}),se("server.restart")},si=()=>{L.set({...L.get(),loading:!0}),se("server.update")},Zn=te(!1),es=te(null),Dr=te([]),Br=te(null),ne=xe();ne.on("connect",()=>{console.info("[socket] Connected"),Gn.set(!0),Xn.set(!1)});ne.on("disconnect",()=>{console.info("[socket] Disconnected"),Gn.set(!1),Xn.set(!0)});ne.on("data",n=>{Br.set(n),ss.set(n.version),es.set(n.user),Dr.set(n.roles),Zn.set(n.canLogOut)});ne.on("rpc",n=>{en.receiveAndSend(n)});ne.on("status",({started:n,starting:e,stopping:t})=>{L.set({started:n,starting:e,stopping:t,loading:!1})});const Mr=new Vt.JSONRPCServer,Hr=new Vt.JSONRPCClient(async n=>{ne.emit("rpc",n)}),en=new Vt.JSONRPCServerAndClient(Mr,Hr),se=(n,...e)=>en.request(n,e),ri=(n,...e)=>en.notify(n,e),bn=(n,...e)=>ne.emit(n,...e),Ur=({disabled:n=!1,value:e,onChange:t,...s})=>{const[r,i]=w.useState(!1),[o,a]=w.useState(!1),[l,c]=w.useState([]),f=w.useRef(null);async function m(){a(!0),c([]);const g=await se("roles.list");c(g.map(u=>u.name)),a(!1)}return w.useEffect(()=>{if(!r)return;function g(u){u.target&&!f.current?.contains(u.target)&&i(!1)}return document.addEventListener("click",g),()=>document.removeEventListener("click",g)},[r]),d.jsxs("div",{className:`role-dropdown ${n?"disabled":""}`,ref:f,...s,children:[r&&d.jsxs("div",{className:"options",children:[o&&d.jsx("div",{className:"option search",style:{position:"relative"},children:d.jsx(_n,{active:!0,size:"small"})}),l.map(g=>d.jsx("div",{onClick:()=>{t(g),i(!1)},className:`option ${e===g?"green":""}`,children:g},g))]}),d.jsxs("div",{className:"selected",onClick:()=>{i(g=>!g),r||m()},children:[d.jsx("div",{className:"value",children:e}),d.jsx(Sn,{})]})]})},ii=({placeholder:n="",disabled:e=!1,type:t,value:s=[],options:r=[],onChange:i})=>{const o=(c,f)=>{const m=s.slice();m[c]=f,i(m)},a=()=>{const c=s.slice();c.push({string:"",number:0,password:"",role:"",enum:r&&r[0]}[t]),i(c)},l=c=>{const f=s.slice();f.splice(c,1),i(f)};return d.jsxs("div",{className:`br-list-input ${e?"disabled":""}`,children:[(s||[]).map((c,f)=>d.jsxs("div",{className:"br-list-item",children:[(t==="string"||t==="password"||t==="number")&&d.jsx(wn,{value:c,onChange:m=>o(f,m),placeholder:n,type:t==="string"?"text":t,disabled:e}),t==="enum"&&d.jsx(Bs,{value:c,options:r,onChange:m=>o(f,m),disabled:e}),t==="role"&&d.jsx(Ur,{value:c,onChange:m=>o(f,m),disabled:e}),d.jsx(Pe,{icon:!0,warn:!0,"data-tooltip":"Remove this item from the list",onClick:()=>l(f),disabled:e,children:d.jsx(Cn,{})})]},f)),d.jsx(Pe,{icon:!0,main:!0,"data-tooltip":"Add an item to the list",onClick:a,disabled:e,children:d.jsx(as,{})})]})},qr=({children:n,attached:e,className:t})=>d.jsx("div",{className:`navbar ${e?"attached":""} ${t??""}`,children:n}),oi=({title:n,className:e,children:t})=>{const s=Ot(es),r=Ot(Zn);return d.jsxs("div",{className:`main-nav ${e??""}`,children:[d.jsx("header",{className:"nav-header",children:n}),d.jsxs(qr,{children:[d.jsxs("span",{style:{flex:1,marginLeft:8},children:["Welcome, ",s?.username??"..."]}),t,r&&d.jsx(Pe,{icon:!0,error:!0,"data-tooltip":"Logout of Web UI",onClick:()=>vs(),children:d.jsx(cs,{})})]})]})},ai=({children:n})=>d.jsx("div",{className:"main-content",children:n}),ci=({children:n,loading:e})=>d.jsxs("div",{children:[d.jsx(rs,{}),d.jsx("div",{className:"content-parent",children:!e&&d.jsx("div",{className:"content",children:n})})]}),li=({disabled:n=!1,value:e,placeholder:t,onChange:s,...r})=>{const[i,o]=w.useState(!1),[a,l]=w.useState(!1),[c,f]=w.useState([]),[m,g]=w.useState(""),u=w.useRef(null);w.useEffect(()=>{if(!i)return;function v(S){S.target&&!u.current?.contains(S.target)&&o(!1)}return document.addEventListener("click",v),()=>document.removeEventListener("click",v)},[i]);function p(v){const S=e.slice();S.splice(v,1),s(S)}function y({id:v,name:S}){s([...e,{id:v,name:S}]),o(!1),g("")}const E=w.useRef(m);E.current=m;const _=w.useMemo(()=>Es(async()=>{if(E.current.length===0){o(!1),l(!1),f([]);return}l(!0),o(!0);const{players:v}=await se("players.list",{page:0,search:E.current,sort:"lastSeen",direction:-1,filter:""});f(v),l(!1)},500),[]);return d.jsxs("div",{className:`br-player-list ${n?"disabled":""}`,...r,children:[e.map((v,S)=>d.jsxs("div",{className:"br-player-item",children:[d.jsx(at,{href:`/players/${v.id}`,className:"selected","data-tooltip":"Click to navigate to player page",children:v.name}),d.jsx(Pe,{icon:!0,warn:!0,"data-tooltip":"Remove this player from the list",onClick:()=>p(S),children:d.jsx(Cn,{})})]},v.id)),d.jsxs("div",{className:"player-search",ref:u,children:[d.jsx(wn,{type:"text",placeholder:"Search Players...",value:m,onChange:v=>{g(v),_()}}),i&&d.jsxs("div",{className:"options",children:[a&&d.jsx("div",{className:"option search",style:{position:"relative"},children:d.jsx(_n,{active:!0,size:"small"})}),c.map(v=>d.jsx("div",{onClick:()=>y(v),className:"option",children:v.name},v.id))]})]})]})},ui=({children:n,className:e,ref:t,...s})=>d.jsx("div",{className:`scroll-container ${e??""}`,...s,children:d.jsx("div",{className:"scroll-scroller",ref:t,children:n})}),X=({children:n,disabled:e,to:t,...s})=>d.jsx(at,{href:t,className:r=>`menu-button ${e?"disabled":""} ${r?"active":""}`,...s,children:d.jsx("div",{className:"menu-button-content",children:n})}),hi=w.memo(()=>d.jsxs("div",{className:"main-menu-buttons",children:[d.jsxs(X,{to:"/","data-tooltip":"Chat with players, view server status. Main Dashboard",children:[d.jsx(ls,{style:{background:"#de4f43"}}),"Dashboard"]}),d.jsxs(X,{to:"/worlds","data-tooltip":"Manage worlds",children:[d.jsx(us,{style:{background:"#f0a500"}}),"Worlds"]}),d.jsxs(X,{to:"/history","data-tooltip":"Browse chat history",children:[d.jsx(hs,{style:{background:"#008bd6"}}),"History"]}),d.jsxs(X,{to:"/plugins","data-tooltip":"Manage, reload, and configure plugins",children:[d.jsx(ds,{style:{background:"#00b35f"}}),"Plugins"]}),d.jsxs(X,{to:"/players","data-tooltip":"Browse player info and play time",children:[d.jsx(fs,{style:{background:"#b3006b"}}),"Players"]}),d.jsxs(X,{to:"/server","data-tooltip":"Server management",children:[d.jsx(ps,{style:{background:"#453d9c"}}),"Server"]}),d.jsxs(X,{to:"/users","data-tooltip":"Server users",children:[d.jsx(ms,{style:{background:"#7f0b8a"}}),"Users"]})]})),di=({name:n,sort:e,direction:t})=>n===e&&d.jsxs(d.Fragment,{children:[t===1&&d.jsx(gs,{}),t===-1&&d.jsx(ys,{})]}),fi=({disabled:n=!1,value:e,onChange:t,tooltip:s})=>d.jsx("div",{"data-tooltip":s,className:`toggle ${n?"disabled":""}`,onClick:()=>t(!e),children:d.jsx("div",{className:`toggle-slider ${e?"on":""}`,children:d.jsx("div",{className:"symbol"})})});export{Br as $,Qr as C,Bs as D,Gr as I,js as L,oi as N,ai as P,Ur as R,hi as S,fi as T,Ce as U,ui as a,ri as b,qr as c,di as d,ii as e,li as f,ei as g,ti as h,bn as i,ni as j,si as k,es as l,L as m,ci as n,Ds as o,se as r,ne as s,Zr as u};
10
+ //# sourceMappingURL=index-BC_vZ56r.js.map