@alivault/pico 0.14.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.output/public/_shell.html +19 -0
- package/.output/public/assets/PatchDiff-SN-mXa3p.js +343 -0
- package/.output/public/assets/{angular-html-BZNntD0J.js → angular-html-B9LEBPKs.js} +1 -1
- package/.output/public/assets/{angular-ts-SQQMYL2C.js → angular-ts-CD6u-Ij9.js} +1 -1
- package/.output/public/assets/{apl-D5V6uPDr.js → apl-VeDHIFIx.js} +1 -1
- package/.output/public/assets/app-shell-common-0xa28gDm.js +1 -0
- package/.output/public/assets/{astro-DeXKSaFP.js → astro-Dd8L1z6M.js} +1 -1
- package/.output/public/assets/{blade-Bu5re0Vg.js → blade-BNxrbiva.js} +1 -1
- package/.output/public/assets/{bsl-B1qbqNES.js → bsl-B0twaj2j.js} +1 -1
- package/.output/public/assets/{cairo-BDj8wWhy.js → cairo-DASKFAWI.js} +1 -1
- package/.output/public/assets/{cobol-nvZDS9LT.js → cobol-D_qN8j4K.js} +1 -1
- package/.output/public/assets/{coffee-BKLOTq4e.js → coffee-60nIQewd.js} +1 -1
- package/.output/public/assets/{cpp-D6g1DVNt.js → cpp-e1j1tDCV.js} +1 -1
- package/.output/public/assets/{crystal-DfoZI57w.js → crystal-brDfRjQ_.js} +1 -1
- package/.output/public/assets/{edge-DwocGnOF.js → edge-DadfRK3Q.js} +1 -1
- package/.output/public/assets/{elixir-Dtbfds1r.js → elixir-CsoHPmz3.js} +1 -1
- package/.output/public/assets/{elm-CpPtm471.js → elm-BLTa0sZG.js} +1 -1
- package/.output/public/assets/{erb--z3IM9Cb.js → erb-DIR2QRkp.js} +1 -1
- package/.output/public/assets/{erlang-Bc4hQuqa.js → erlang-DnbJbitJ.js} +1 -1
- package/.output/public/assets/{fortran-fixed-form-B02FOYI-.js → fortran-fixed-form-Bse4XUyD.js} +1 -1
- package/.output/public/assets/{fsharp-DhdR18vN.js → fsharp-Dy8OnZ0O.js} +1 -1
- package/.output/public/assets/{gdresource-DgnrMPIx.js → gdresource-BD_7yRHA.js} +1 -1
- package/.output/public/assets/{git-commit-DGJi7qBD.js → git-commit-CIMjlyHf.js} +1 -1
- package/.output/public/assets/{git-rebase-Ce47xoa6.js → git-rebase-DV2DyQK7.js} +1 -1
- package/.output/public/assets/{glimmer-js-C0BuzxQC.js → glimmer-js-DVG5pFvd.js} +1 -1
- package/.output/public/assets/{glimmer-ts-irOZ-cAQ.js → glimmer-ts-BeWaLARz.js} +1 -1
- package/.output/public/assets/{glsl-JAhLUe0P.js → glsl-BrOWUUEh.js} +1 -1
- package/.output/public/assets/{graphql-D2ba3BkR.js → graphql-B_3o81z5.js} +1 -1
- package/.output/public/assets/{hack-CgzUpY8l.js → hack-BW-0PxQy.js} +1 -1
- package/.output/public/assets/{haml-C-oIZcDo.js → haml-DnNXiHAO.js} +1 -1
- package/.output/public/assets/{handlebars-CbP-Mhzf.js → handlebars-CftcPtku.js} +1 -1
- package/.output/public/assets/{html-ddqpqPg0.js → html-D5IqfVuz.js} +1 -1
- package/.output/public/assets/{html-derivative-DWGxf_At.js → html-derivative-QNqmMkaY.js} +1 -1
- package/.output/public/assets/{http-Bg1nG1nG.js → http-Dd7eRKUa.js} +1 -1
- package/.output/public/assets/{hurl-zm47Pi1n.js → hurl-kBs5Ibg1.js} +1 -1
- package/.output/public/assets/{hxml-adC65L_J.js → hxml-CGx66ebi.js} +1 -1
- package/.output/public/assets/index-C-mxWGZ5.css +2 -0
- package/.output/public/assets/index-FOqZaR4L.js +48 -0
- package/.output/public/assets/{jinja-Bnj4awH5.js → jinja-BPoCSjyd.js} +1 -1
- package/.output/public/assets/{jison-CuCNs9Q3.js → jison-WHPVy3Jl.js} +1 -1
- package/.output/public/assets/{julia-DNYHzXlE.js → julia-BaKiQMPf.js} +1 -1
- package/.output/public/assets/{just-BlWkkmf2.js → just-BKMc7tVT.js} +1 -1
- package/.output/public/assets/{latex-DqPzjMIt.js → latex-Cczzu1HI.js} +1 -1
- package/.output/public/assets/{liquid-BURJK16h.js → liquid-DrJZrMEf.js} +1 -1
- package/.output/public/assets/{lua-31hdJClp.js → lua-CFIwCMnP.js} +1 -1
- package/.output/public/assets/{marko-C2ZcdSLh.js → marko-BreagErn.js} +1 -1
- package/.output/public/assets/{mdc-N1ii9pk5.js → mdc-CBcMHZUq.js} +1 -1
- package/.output/public/assets/{nextflow-JEyYUlIq.js → nextflow-CZbrTmS2.js} +1 -1
- package/.output/public/assets/{nginx-BuomO0W8.js → nginx-CMOi8dTH.js} +1 -1
- package/.output/public/assets/{nim-hKoEPsYL.js → nim-DbDZ9Wa-.js} +1 -1
- package/.output/public/assets/{perl-CAGVW6Ra.js → perl-DyRCGnKu.js} +1 -1
- package/.output/public/assets/{php-BycclmzS.js → php-Ciarv7b4.js} +1 -1
- package/.output/public/assets/plus-B1rJPgNv.js +1 -0
- package/.output/public/assets/preload-helper-Csz9R64u.js +5 -0
- package/.output/public/assets/{pug-4maJHz9G.js → pug-CVCqbfEm.js} +1 -1
- package/.output/public/assets/{qml-JLIQfzyb.js → qml-DechmdFA.js} +1 -1
- package/.output/public/assets/query-keys-C9jMaRnO.js +1 -0
- package/.output/public/assets/{razor-P8rbooCh.js → razor-bgzHke67.js} +1 -1
- package/.output/public/assets/right-sidebar-CWvXcZzC.js +1831 -0
- package/.output/public/assets/routes-CXlaorp4.js +23 -0
- package/.output/public/assets/{rst-C6GHyL-N.js → rst-Ce6_XwFd.js} +1 -1
- package/.output/public/assets/{ruby-Cl8PVkbY.js → ruby-BtLKlt8E.js} +1 -1
- package/.output/public/assets/{sas-CXoVwlZN.js → sas-Bco5tnse.js} +1 -1
- package/.output/public/assets/{scss-DNczJ95n.js → scss-KPCA05M8.js} +1 -1
- package/.output/public/assets/{shaderlab-DZ3Lsiak.js → shaderlab-uUHiM5Mm.js} +1 -1
- package/.output/public/assets/{shellsession-COm1V40U.js → shellsession-BnUZVYXU.js} +1 -1
- package/.output/public/assets/{soy-DwewhJ_3.js → soy-Dsrg4bVI.js} +1 -1
- package/.output/public/assets/{sparql-B9c85a_o.js → sparql-D5zsvcbT.js} +1 -1
- package/.output/public/assets/{stata-Bl--TAbZ.js → stata-BdK5CFUf.js} +1 -1
- package/.output/public/assets/{surrealql-BW79EE-U.js → surrealql-Blm5wp47.js} +1 -1
- package/.output/public/assets/{svelte-ziMErdPi.js → svelte-DZrj_gMz.js} +1 -1
- package/.output/public/assets/{templ-C_9I6ncv.js → templ-CJ7sDrtu.js} +1 -1
- package/.output/public/assets/terminal-panel-YGR6v-ZH.js +1 -0
- package/.output/public/assets/{tex-D8LVuLf5.js → tex-CvSRdXZA.js} +1 -1
- package/.output/public/assets/{ts-tags-DKuFCGsc.js → ts-tags-DgGFCSef.js} +1 -1
- package/.output/public/assets/{twig-Bs1kcsO6.js → twig-D8_PS89g.js} +1 -1
- package/.output/public/assets/{vue-Dnf0y5RU.js → vue-KvGEuYod.js} +1 -1
- package/.output/public/assets/{vue-html-CRtKS76J.js → vue-html-qAt9D-IF.js} +1 -1
- package/.output/public/assets/{vue-vine-BxjPqU7T.js → vue-vine-j1nOqxMu.js} +1 -1
- package/.output/public/assets/{xml-eU7M3iZJ.js → xml-BrFkMwfd.js} +1 -1
- package/.output/public/assets/{xsl-DSqe4nTO.js → xsl-OmCo2PyZ.js} +1 -1
- package/.output/public/index.html +19 -0
- package/README.md +171 -46
- package/bin/native-runtime.mjs +265 -0
- package/bin/pico.mjs +289 -222
- package/package.json +34 -31
- package/.output/nitro.json +0 -17
- package/.output/public/assets/index-DBVxXDtw.js +0 -54
- package/.output/public/assets/routes-yUxD2q-l.js +0 -2194
- package/.output/public/assets/styles-CUVz7jV9.css +0 -2
- package/.output/server/__23tanstack-start-plugin-adapters-y_fshQDY.mjs +0 -5
- package/.output/server/_chunks/ssr-renderer.mjs +0 -15
- package/.output/server/_libs/@base-ui/react+[...].mjs +0 -14512
- package/.output/server/_libs/@dnd-kit/core+[...].mjs +0 -2748
- package/.output/server/_libs/@pierre/diffs+[...].mjs +0 -19314
- package/.output/server/_libs/@pierre/trees+[...].mjs +0 -9236
- package/.output/server/_libs/@radix-ui/react-dialog+[...].mjs +0 -1789
- package/.output/server/_libs/@radix-ui/react-primitive+[...].mjs +0 -136
- package/.output/server/_libs/@tanstack/devtools-event-client+[...].mjs +0 -196
- package/.output/server/_libs/@tanstack/hotkeys+[...].mjs +0 -1607
- package/.output/server/_libs/@tanstack/react-router+[...].mjs +0 -13950
- package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +0 -90
- package/.output/server/_libs/bail.mjs +0 -13
- package/.output/server/_libs/character-entities.mjs +0 -2135
- package/.output/server/_libs/class-variance-authority+clsx.mjs +0 -69
- package/.output/server/_libs/cmdk.mjs +0 -473
- package/.output/server/_libs/crossws.mjs +0 -2929
- package/.output/server/_libs/decode-named-character-reference+[...].mjs +0 -19
- package/.output/server/_libs/devlop.mjs +0 -5
- package/.output/server/_libs/diff.mjs +0 -732
- package/.output/server/_libs/dnd-kit__accessibility.mjs +0 -46
- package/.output/server/_libs/dnd-kit__sortable.mjs +0 -400
- package/.output/server/_libs/entities.mjs +0 -372
- package/.output/server/_libs/escape-string-regexp.mjs +0 -7
- package/.output/server/_libs/estree-util-is-identifier-name.mjs +0 -20
- package/.output/server/_libs/extend.mjs +0 -75
- package/.output/server/_libs/h3+rou3+srvx.mjs +0 -1216
- package/.output/server/_libs/hast-util-from-parse5+[...].mjs +0 -741
- package/.output/server/_libs/hast-util-raw+[...].mjs +0 -7897
- package/.output/server/_libs/hast-util-sanitize.mjs +0 -780
- package/.output/server/_libs/hast-util-to-jsx-runtime+[...].mjs +0 -1165
- package/.output/server/_libs/hookable.mjs +0 -41
- package/.output/server/_libs/html-url-attributes.mjs +0 -44
- package/.output/server/_libs/is-plain-obj.mjs +0 -8
- package/.output/server/_libs/longest-streak.mjs +0 -29
- package/.output/server/_libs/lucide-react.mjs +0 -788
- package/.output/server/_libs/markdown-table.mjs +0 -289
- package/.output/server/_libs/mdast-util-find-and-replace.mjs +0 -198
- package/.output/server/_libs/mdast-util-from-markdown+[...].mjs +0 -8409
- package/.output/server/_libs/mdast-util-gfm+[...].mjs +0 -2062
- package/.output/server/_libs/mdast-util-to-hast+[...].mjs +0 -1771
- package/.output/server/_libs/micromark-extension-gfm+[...].mjs +0 -2234
- package/.output/server/_libs/next-themes.mjs +0 -124
- package/.output/server/_libs/pierre__theme.mjs +0 -10
- package/.output/server/_libs/radix-ui__primitive.mjs +0 -9
- package/.output/server/_libs/radix-ui__react-compose-refs.mjs +0 -30
- package/.output/server/_libs/radix-ui__react-context.mjs +0 -88
- package/.output/server/_libs/react-markdown+[...].mjs +0 -2316
- package/.output/server/_libs/rehype-raw.mjs +0 -37
- package/.output/server/_libs/rehype-sanitize.mjs +0 -27
- package/.output/server/_libs/remark-gfm.mjs +0 -34
- package/.output/server/_libs/shiki.mjs +0 -16
- package/.output/server/_libs/shikijs__langs.mjs +0 -1355
- package/.output/server/_libs/shikijs__themes.mjs +0 -262
- package/.output/server/_libs/sonner.mjs +0 -908
- package/.output/server/_libs/tailwind-merge.mjs +0 -1962
- package/.output/server/_libs/tanstack__history.mjs +0 -342
- package/.output/server/_libs/tanstack__pacer.mjs +0 -1111
- package/.output/server/_libs/tanstack__query-core.mjs +0 -2202
- package/.output/server/_libs/tanstack__react-hotkeys.mjs +0 -152
- package/.output/server/_libs/tanstack__react-query.mjs +0 -180
- package/.output/server/_libs/tanstack__react-store.mjs +0 -39
- package/.output/server/_libs/tanstack__router-core.mjs +0 -6
- package/.output/server/_libs/tanstack__store.mjs +0 -28
- package/.output/server/_libs/ufo.mjs +0 -64
- package/.output/server/_libs/unctx.mjs +0 -82
- package/.output/server/_libs/ungap__structured-clone.mjs +0 -197
- package/.output/server/_libs/vaul.mjs +0 -1250
- package/.output/server/_libs/xterm__addon-fit.mjs +0 -44
- package/.output/server/_libs/xterm__xterm.mjs +0 -10234
- package/.output/server/_libs/zod.mjs +0 -3341
- package/.output/server/_routes/api/terminal/[id]/ws.mjs +0 -8874
- package/.output/server/_runtime.mjs +0 -35
- package/.output/server/_ssr/router-CN4JMm2A.mjs +0 -9733
- package/.output/server/_ssr/routes-BsQ26pbY.mjs +0 -29306
- package/.output/server/_ssr/routes-DbjuMLFI.mjs +0 -3400
- package/.output/server/_ssr/ssr.mjs +0 -5176
- package/.output/server/_ssr/start-jIczsXlR.mjs +0 -4
- package/.output/server/_tanstack-start-manifest_v-Bs4g_j1_.mjs +0 -77
- package/.output/server/index.mjs +0 -2670
- package/.output/server/node_modules/node-pty/LICENSE +0 -69
- package/.output/server/node_modules/node-pty/README.md +0 -165
- package/.output/server/node_modules/node-pty/binding.gyp +0 -111
- package/.output/server/node_modules/node-pty/build/Makefile +0 -369
- package/.output/server/node_modules/node-pty/build/Release/pty.node +0 -0
- package/.output/server/node_modules/node-pty/build/binding.Makefile +0 -6
- package/.output/server/node_modules/node-pty/build/pty.target.mk +0 -168
- package/.output/server/node_modules/node-pty/deps/.editorconfig +0 -2
- package/.output/server/node_modules/node-pty/deps/winpty/.drone.yml +0 -17
- package/.output/server/node_modules/node-pty/deps/winpty/.gitattributes +0 -19
- package/.output/server/node_modules/node-pty/deps/winpty/LICENSE +0 -21
- package/.output/server/node_modules/node-pty/deps/winpty/Makefile +0 -166
- package/.output/server/node_modules/node-pty/deps/winpty/README.md +0 -151
- package/.output/server/node_modules/node-pty/deps/winpty/RELEASES.md +0 -280
- package/.output/server/node_modules/node-pty/deps/winpty/VERSION.txt +0 -1
- package/.output/server/node_modules/node-pty/deps/winpty/configure +0 -167
- package/.output/server/node_modules/node-pty/deps/winpty/misc/BufferResizeTests.cc +0 -90
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ChangeScreenBuffer.cc +0 -53
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ClearConsole.cc +0 -72
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ConinMode.cc +0 -117
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ConinMode.ps1 +0 -116
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ConoutMode.cc +0 -113
- package/.output/server/node_modules/node-pty/deps/winpty/misc/DebugClient.py +0 -42
- package/.output/server/node_modules/node-pty/deps/winpty/misc/DebugServer.py +0 -63
- package/.output/server/node_modules/node-pty/deps/winpty/misc/DumpLines.py +0 -5
- package/.output/server/node_modules/node-pty/deps/winpty/misc/EnableExtendedFlags.txt +0 -46
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Consolas.txt +0 -528
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP437-Lucida.txt +0 -633
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP932.txt +0 -630
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP936.txt +0 -630
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP949.txt +0 -630
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/CP950.txt +0 -630
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/MinimumWindowWidths.txt +0 -16
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Results.txt +0 -4
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Font-Report-June2016/Windows10SetFontBugginess.txt +0 -144
- package/.output/server/node_modules/node-pty/deps/winpty/misc/FontSurvey.cc +0 -100
- package/.output/server/node_modules/node-pty/deps/winpty/misc/FormatChar.h +0 -21
- package/.output/server/node_modules/node-pty/deps/winpty/misc/FreezePerfTest.cc +0 -62
- package/.output/server/node_modules/node-pty/deps/winpty/misc/GetCh.cc +0 -20
- package/.output/server/node_modules/node-pty/deps/winpty/misc/GetConsolePos.cc +0 -41
- package/.output/server/node_modules/node-pty/deps/winpty/misc/GetFont.cc +0 -261
- package/.output/server/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 +0 -51
- package/.output/server/node_modules/node-pty/deps/winpty/misc/IsNewConsole.cc +0 -87
- package/.output/server/node_modules/node-pty/deps/winpty/misc/MouseInputNotes.txt +0 -90
- package/.output/server/node_modules/node-pty/deps/winpty/misc/MoveConsoleWindow.cc +0 -34
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Notes.txt +0 -219
- package/.output/server/node_modules/node-pty/deps/winpty/misc/OSVersion.cc +0 -27
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ScreenBufferFreezeInactive.cc +0 -101
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest.cc +0 -671
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ScreenBufferTest2.cc +0 -151
- package/.output/server/node_modules/node-pty/deps/winpty/misc/SelectAllTest.cc +0 -45
- package/.output/server/node_modules/node-pty/deps/winpty/misc/SetBufferSize.cc +0 -32
- package/.output/server/node_modules/node-pty/deps/winpty/misc/SetCursorPos.cc +0 -10
- package/.output/server/node_modules/node-pty/deps/winpty/misc/SetFont.cc +0 -145
- package/.output/server/node_modules/node-pty/deps/winpty/misc/SetWindowRect.cc +0 -36
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ShowArgv.cc +0 -12
- package/.output/server/node_modules/node-pty/deps/winpty/misc/ShowConsoleInput.cc +0 -40
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Spew.py +0 -5
- package/.output/server/node_modules/node-pty/deps/winpty/misc/TestUtil.cc +0 -172
- package/.output/server/node_modules/node-pty/deps/winpty/misc/UnicodeDoubleWidthTest.cc +0 -102
- package/.output/server/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest1.cc +0 -246
- package/.output/server/node_modules/node-pty/deps/winpty/misc/UnicodeWideTest2.cc +0 -130
- package/.output/server/node_modules/node-pty/deps/winpty/misc/UnixEcho.cc +0 -89
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Utf16Echo.cc +0 -46
- package/.output/server/node_modules/node-pty/deps/winpty/misc/VeryLargeRead.cc +0 -122
- package/.output/server/node_modules/node-pty/deps/winpty/misc/VkEscapeTest.cc +0 -56
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win10ResizeWhileFrozen.cc +0 -52
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win10WrapTest1.cc +0 -57
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win10WrapTest2.cc +0 -30
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Echo1.cc +0 -26
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Echo2.cc +0 -19
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Test1.cc +0 -46
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Test2.cc +0 -70
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Test3.cc +0 -78
- package/.output/server/node_modules/node-pty/deps/winpty/misc/Win32Write1.cc +0 -44
- package/.output/server/node_modules/node-pty/deps/winpty/misc/WindowsBugCrashReader.cc +0 -27
- package/.output/server/node_modules/node-pty/deps/winpty/misc/WriteConsole.cc +0 -106
- package/.output/server/node_modules/node-pty/deps/winpty/misc/build32.sh +0 -9
- package/.output/server/node_modules/node-pty/deps/winpty/misc/build64.sh +0 -9
- package/.output/server/node_modules/node-pty/deps/winpty/misc/color-test.sh +0 -212
- package/.output/server/node_modules/node-pty/deps/winpty/misc/font-notes.txt +0 -300
- package/.output/server/node_modules/node-pty/deps/winpty/misc/winbug-15048.cc +0 -201
- package/.output/server/node_modules/node-pty/deps/winpty/ship/build-pty4j-libpty.bat +0 -36
- package/.output/server/node_modules/node-pty/deps/winpty/ship/common_ship.py +0 -53
- package/.output/server/node_modules/node-pty/deps/winpty/ship/make_msvc_package.py +0 -165
- package/.output/server/node_modules/node-pty/deps/winpty/ship/ship.py +0 -108
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Agent.cc +0 -613
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Agent.h +0 -103
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.cc +0 -84
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/AgentCreateDesktop.h +0 -28
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.cc +0 -632
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleFont.h +0 -28
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.cc +0 -852
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleInput.h +0 -109
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.cc +0 -121
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleInputReencoding.h +0 -36
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.cc +0 -152
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/ConsoleLine.h +0 -41
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Coord.h +0 -87
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.cc +0 -239
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/DebugShowInput.h +0 -32
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.cc +0 -422
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/DefaultInputMap.h +0 -28
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/DsrSender.h +0 -30
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/EventLoop.cc +0 -99
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/EventLoop.h +0 -47
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/InputMap.cc +0 -246
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/InputMap.h +0 -114
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.cc +0 -71
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/LargeConsoleRead.h +0 -68
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.cc +0 -378
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/NamedPipe.h +0 -125
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Scraper.cc +0 -699
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Scraper.h +0 -103
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/SimplePool.h +0 -75
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/SmallRect.h +0 -143
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Terminal.cc +0 -535
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Terminal.h +0 -69
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncoding.h +0 -157
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/UnicodeEncodingTest.cc +0 -189
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Win32Console.cc +0 -107
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Win32Console.h +0 -67
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.cc +0 -193
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/Win32ConsoleBuffer.h +0 -99
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/main.cc +0 -114
- package/.output/server/node_modules/node-pty/deps/winpty/src/agent/subdir.mk +0 -61
- package/.output/server/node_modules/node-pty/deps/winpty/src/configurations.gypi +0 -60
- package/.output/server/node_modules/node-pty/deps/winpty/src/debugserver/DebugServer.cc +0 -117
- package/.output/server/node_modules/node-pty/deps/winpty/src/debugserver/subdir.mk +0 -41
- package/.output/server/node_modules/node-pty/deps/winpty/src/include/winpty.h +0 -242
- package/.output/server/node_modules/node-pty/deps/winpty/src/include/winpty_constants.h +0 -131
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.cc +0 -75
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/AgentLocation.h +0 -28
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/LibWinptyException.h +0 -54
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/WinptyInternal.h +0 -72
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/subdir.mk +0 -46
- package/.output/server/node_modules/node-pty/deps/winpty/src/libwinpty/winpty.cc +0 -970
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/AgentMsg.h +0 -38
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.cc +0 -122
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/BackgroundDesktop.h +0 -73
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/Buffer.cc +0 -103
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/Buffer.h +0 -102
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/DebugClient.cc +0 -187
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/DebugClient.h +0 -38
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/GenRandom.cc +0 -138
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/GenRandom.h +0 -55
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/GetCommitHash.bat +0 -13
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/Mutex.h +0 -54
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/OsModule.h +0 -63
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.cc +0 -36
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/OwnedHandle.h +0 -45
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/PrecompiledHeader.h +0 -43
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/StringBuilder.h +0 -227
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/StringBuilderTest.cc +0 -114
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/StringUtil.cc +0 -55
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/StringUtil.h +0 -80
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/TimeMeasurement.h +0 -63
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/UnixCtrlChars.h +0 -45
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/UpdateGenVersion.bat +0 -20
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.cc +0 -460
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WindowsSecurity.h +0 -104
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.cc +0 -252
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WindowsVersion.h +0 -29
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.cc +0 -55
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyAssert.h +0 -64
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyException.cc +0 -57
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyException.h +0 -43
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.cc +0 -42
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/WinptyVersion.h +0 -27
- package/.output/server/node_modules/node-pty/deps/winpty/src/shared/winpty_snprintf.h +0 -99
- package/.output/server/node_modules/node-pty/deps/winpty/src/subdir.mk +0 -5
- package/.output/server/node_modules/node-pty/deps/winpty/src/tests/subdir.mk +0 -28
- package/.output/server/node_modules/node-pty/deps/winpty/src/tests/trivial_test.cc +0 -158
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.cc +0 -114
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/InputHandler.h +0 -56
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.cc +0 -80
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/OutputHandler.h +0 -53
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.cc +0 -86
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/Util.h +0 -31
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.cc +0 -70
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/WakeupFd.h +0 -42
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/main.cc +0 -729
- package/.output/server/node_modules/node-pty/deps/winpty/src/unix-adapter/subdir.mk +0 -41
- package/.output/server/node_modules/node-pty/deps/winpty/src/winpty.gyp +0 -234
- package/.output/server/node_modules/node-pty/deps/winpty/vcbuild.bat +0 -83
- package/.output/server/node_modules/node-pty/lib/conpty_console_list_agent.js +0 -16
- package/.output/server/node_modules/node-pty/lib/conpty_console_list_agent.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/eventEmitter2.js +0 -47
- package/.output/server/node_modules/node-pty/lib/eventEmitter2.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/eventEmitter2.test.js +0 -30
- package/.output/server/node_modules/node-pty/lib/eventEmitter2.test.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/index.js +0 -52
- package/.output/server/node_modules/node-pty/lib/index.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/interfaces.js +0 -7
- package/.output/server/node_modules/node-pty/lib/interfaces.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/shared/conout.js +0 -11
- package/.output/server/node_modules/node-pty/lib/shared/conout.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/terminal.js +0 -190
- package/.output/server/node_modules/node-pty/lib/terminal.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/terminal.test.js +0 -139
- package/.output/server/node_modules/node-pty/lib/terminal.test.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/testUtils.test.js +0 -28
- package/.output/server/node_modules/node-pty/lib/testUtils.test.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/types.js +0 -7
- package/.output/server/node_modules/node-pty/lib/types.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/unixTerminal.js +0 -346
- package/.output/server/node_modules/node-pty/lib/unixTerminal.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/unixTerminal.test.js +0 -351
- package/.output/server/node_modules/node-pty/lib/unixTerminal.test.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/utils.js +0 -39
- package/.output/server/node_modules/node-pty/lib/utils.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/windowsConoutConnection.js +0 -125
- package/.output/server/node_modules/node-pty/lib/windowsConoutConnection.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/windowsPtyAgent.js +0 -320
- package/.output/server/node_modules/node-pty/lib/windowsPtyAgent.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/windowsPtyAgent.test.js +0 -90
- package/.output/server/node_modules/node-pty/lib/windowsPtyAgent.test.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/windowsTerminal.js +0 -199
- package/.output/server/node_modules/node-pty/lib/windowsTerminal.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/windowsTerminal.test.js +0 -219
- package/.output/server/node_modules/node-pty/lib/windowsTerminal.test.js.map +0 -1
- package/.output/server/node_modules/node-pty/lib/worker/conoutSocketWorker.js +0 -22
- package/.output/server/node_modules/node-pty/lib/worker/conoutSocketWorker.js.map +0 -1
- package/.output/server/node_modules/node-pty/package.json +0 -64
- package/.output/server/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty/OpenConsole.exe +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty/conpty.dll +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/conpty_console_list.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/pty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/pty.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/winpty-agent.exe +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/winpty-agent.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/winpty.dll +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-arm64/winpty.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/pty.node +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/pty.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.pdb +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
- package/.output/server/node_modules/node-pty/prebuilds/win32-x64/winpty.pdb +0 -0
- package/.output/server/node_modules/node-pty/scripts/gen-compile-commands.js +0 -8
- package/.output/server/node_modules/node-pty/scripts/increment-version.js +0 -54
- package/.output/server/node_modules/node-pty/scripts/post-install.js +0 -80
- package/.output/server/node_modules/node-pty/scripts/prebuild.js +0 -34
- package/.output/server/node_modules/node-pty/src/conpty_console_list_agent.ts +0 -15
- package/.output/server/node_modules/node-pty/src/eventEmitter2.test.ts +0 -30
- package/.output/server/node_modules/node-pty/src/eventEmitter2.ts +0 -48
- package/.output/server/node_modules/node-pty/src/index.ts +0 -52
- package/.output/server/node_modules/node-pty/src/interfaces.ts +0 -130
- package/.output/server/node_modules/node-pty/src/native.d.ts +0 -54
- package/.output/server/node_modules/node-pty/src/shared/conout.ts +0 -15
- package/.output/server/node_modules/node-pty/src/terminal.test.ts +0 -119
- package/.output/server/node_modules/node-pty/src/terminal.ts +0 -211
- package/.output/server/node_modules/node-pty/src/testUtils.test.ts +0 -23
- package/.output/server/node_modules/node-pty/src/tsconfig.json +0 -22
- package/.output/server/node_modules/node-pty/src/types.ts +0 -15
- package/.output/server/node_modules/node-pty/src/unix/pty.cc +0 -799
- package/.output/server/node_modules/node-pty/src/unix/spawn-helper.cc +0 -23
- package/.output/server/node_modules/node-pty/src/unixTerminal.test.ts +0 -367
- package/.output/server/node_modules/node-pty/src/unixTerminal.ts +0 -388
- package/.output/server/node_modules/node-pty/src/utils.ts +0 -29
- package/.output/server/node_modules/node-pty/src/win/conpty.cc +0 -583
- package/.output/server/node_modules/node-pty/src/win/conpty.h +0 -41
- package/.output/server/node_modules/node-pty/src/win/conpty_console_list.cc +0 -44
- package/.output/server/node_modules/node-pty/src/win/path_util.cc +0 -95
- package/.output/server/node_modules/node-pty/src/win/path_util.h +0 -26
- package/.output/server/node_modules/node-pty/src/win/winpty.cc +0 -333
- package/.output/server/node_modules/node-pty/src/windowsConoutConnection.ts +0 -82
- package/.output/server/node_modules/node-pty/src/windowsPtyAgent.test.ts +0 -94
- package/.output/server/node_modules/node-pty/src/windowsPtyAgent.ts +0 -321
- package/.output/server/node_modules/node-pty/src/windowsTerminal.test.ts +0 -229
- package/.output/server/node_modules/node-pty/src/windowsTerminal.ts +0 -203
- package/.output/server/node_modules/node-pty/src/worker/conoutSocketWorker.ts +0 -22
- package/.output/server/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/OpenConsole.exe +0 -0
- package/.output/server/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/conpty.dll +0 -0
- package/.output/server/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/OpenConsole.exe +0 -0
- package/.output/server/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/conpty.dll +0 -0
- package/.output/server/node_modules/node-pty/typings/node-pty.d.ts +0 -211
- package/.output/server/node_modules/tslib/modules/index.js +0 -70
- package/.output/server/node_modules/tslib/modules/package.json +0 -3
- package/.output/server/node_modules/tslib/package.json +0 -47
- package/.output/server/node_modules/tslib/tslib.js +0 -484
- package/.output/server/package.json +0 -10
- package/scripts/release.mjs +0 -173
- package/vendor/node-domexception/index.js +0 -3
- package/vendor/node-domexception/package.json +0 -10
- /package/.output/public/assets/{abap-smLpETzL.js → abap-CglpPUUh.js} +0 -0
- /package/.output/public/assets/{actionscript-3-o-aRvjY5.js → actionscript-3-CGv72Q9E.js} +0 -0
- /package/.output/public/assets/{ada-D5RRX1i4.js → ada-CfxXaXwr.js} +0 -0
- /package/.output/public/assets/{addon-fit-CMMXLNsg.js → addon-fit-C9RD8ot3.js} +0 -0
- /package/.output/public/assets/{andromeeda-N4z3YzmR.js → andromeeda-DXsn6mTE.js} +0 -0
- /package/.output/public/assets/{apache-DttKlSqg.js → apache-D5xAQKSB.js} +0 -0
- /package/.output/public/assets/{apex-DL7j-a2n.js → apex-qgfedJV2.js} +0 -0
- /package/.output/public/assets/{applescript-DCbL_2FX.js → applescript-DqumQxTt.js} +0 -0
- /package/.output/public/assets/{ara-DqheWJCe.js → ara-Ditv3ow6.js} +0 -0
- /package/.output/public/assets/{asciidoc-BH2sf2K4.js → asciidoc-DL8QwiT7.js} +0 -0
- /package/.output/public/assets/{asm-rfjOMz3U.js → asm-K6TMxl3o.js} +0 -0
- /package/.output/public/assets/{aurora-x-CND-FqEb.js → aurora-x-DGv-xZaa.js} +0 -0
- /package/.output/public/assets/{awk-CMV5n9Z7.js → awk-CYSfQSDT.js} +0 -0
- /package/.output/public/assets/{ayu-dark-on7xzq_B.js → ayu-dark-DGBaJbpH.js} +0 -0
- /package/.output/public/assets/{ayu-light-DnGeGGc2.js → ayu-light-BQrGPVs2.js} +0 -0
- /package/.output/public/assets/{ayu-mirage-DG3LlYC_.js → ayu-mirage-Do-5o2VL.js} +0 -0
- /package/.output/public/assets/{ballerina-BjMqJjlr.js → ballerina-BE-8n54s.js} +0 -0
- /package/.output/public/assets/{bat-BaVbo_qw.js → bat-B1zTc1QZ.js} +0 -0
- /package/.output/public/assets/{beancount-DBt5Mbc_.js → beancount-DhObrvif.js} +0 -0
- /package/.output/public/assets/{berry-Cyjuxiss.js → berry-Cnbvthv1.js} +0 -0
- /package/.output/public/assets/{bibtex-BV_0nsPq.js → bibtex-pp5SrwZy.js} +0 -0
- /package/.output/public/assets/{bicep-C2gEwu4J.js → bicep-BL6eYxbs.js} +0 -0
- /package/.output/public/assets/{bird2-BRyaEJd0.js → bird2-BQaXYY9n.js} +0 -0
- /package/.output/public/assets/{c-Nc9zJT78.js → c-BHFJ4Jk3.js} +0 -0
- /package/.output/public/assets/{c3-DTTbp5N2.js → c3-BHTco5Hb.js} +0 -0
- /package/.output/public/assets/{cadence-CPz83cmI.js → cadence-CoPxW0qb.js} +0 -0
- /package/.output/public/assets/{catppuccin-frappe-Dr22sraq.js → catppuccin-frappe-9fYwMJCf.js} +0 -0
- /package/.output/public/assets/{catppuccin-latte-C57EeX8c.js → catppuccin-latte-BUiKH1yZ.js} +0 -0
- /package/.output/public/assets/{catppuccin-macchiato-CpheI4uD.js → catppuccin-macchiato-ZmO2e0M_.js} +0 -0
- /package/.output/public/assets/{catppuccin-mocha-D8Lmdks_.js → catppuccin-mocha-CFwbXQfO.js} +0 -0
- /package/.output/public/assets/{clarity-CFJ2Yc3q.js → clarity-DVUGm1xP.js} +0 -0
- /package/.output/public/assets/{clojure-6R01QgJC.js → clojure-BgXJG6FG.js} +0 -0
- /package/.output/public/assets/{cmake-D5rSbMir.js → cmake-CZndsvm6.js} +0 -0
- /package/.output/public/assets/{codeowners-_3A-ClkN.js → codeowners-Dd7a447M.js} +0 -0
- /package/.output/public/assets/{codeql-DlIhJTR7.js → codeql-XJR6llG-.js} +0 -0
- /package/.output/public/assets/{common-lisp-BvQzz173.js → common-lisp-BOMbLvgT.js} +0 -0
- /package/.output/public/assets/{coq-DTNXReIC.js → coq-DnhmQYDa.js} +0 -0
- /package/.output/public/assets/{csharp-BDKQY1K9.js → csharp-BdEyRqBm.js} +0 -0
- /package/.output/public/assets/{css-DRmnABqB.js → css-CsTDDTLq.js} +0 -0
- /package/.output/public/assets/{csv-DNUpVBxl.js → csv-CXchYFbz.js} +0 -0
- /package/.output/public/assets/{cue-DDdBc2s3.js → cue-D7YpBZvd.js} +0 -0
- /package/.output/public/assets/{cypher-CguaznO2.js → cypher-XIm1N8YJ.js} +0 -0
- /package/.output/public/assets/{d-CHcoyjv3.js → d-DvB0pbZH.js} +0 -0
- /package/.output/public/assets/{dark-plus-CqeW_0kH.js → dark-plus-BUdpMFIA.js} +0 -0
- /package/.output/public/assets/{dart-RM3aRphk.js → dart-CwpSKTMB.js} +0 -0
- /package/.output/public/assets/{dax-nbnY1d79.js → dax-CEynWJsU.js} +0 -0
- /package/.output/public/assets/{desktop-BD76cvxT.js → desktop-Dk-YiYS_.js} +0 -0
- /package/.output/public/assets/{diff-CdkWtnkL.js → diff-abLZ-xM1.js} +0 -0
- /package/.output/public/assets/{docker-ZyPHc6zB.js → docker-BT48KsRJ.js} +0 -0
- /package/.output/public/assets/{dotenv-BdJZEwA6.js → dotenv-NOMQQbM0.js} +0 -0
- /package/.output/public/assets/{dracula-CtqCPLGa.js → dracula-BUW0ZyNO.js} +0 -0
- /package/.output/public/assets/{dracula-soft-DmBpwRAy.js → dracula-soft-BMjAt1_u.js} +0 -0
- /package/.output/public/assets/{dream-maker-BJL4qlg3.js → dream-maker-D26TP1Q3.js} +0 -0
- /package/.output/public/assets/{emacs-lisp-_LyYa2Ky.js → emacs-lisp-C2EvfotR.js} +0 -0
- /package/.output/public/assets/{everforest-dark-CrbyKk4n.js → everforest-dark-hC6a272f.js} +0 -0
- /package/.output/public/assets/{everforest-light-DRbSh8Tm.js → everforest-light-BTpbYY5G.js} +0 -0
- /package/.output/public/assets/{fennel-CC2BkRsS.js → fennel-DWOL-Ewx.js} +0 -0
- /package/.output/public/assets/{fish-D2ZCzqcE.js → fish-CQPQq0pQ.js} +0 -0
- /package/.output/public/assets/{fluent-DKAm3m7q.js → fluent-BYdsr2M8.js} +0 -0
- /package/.output/public/assets/{fortran-free-form-BPTf0lbT.js → fortran-free-form-C_EtY4F9.js} +0 -0
- /package/.output/public/assets/{gdscript-CsadCSaZ.js → gdscript-CH_tD-VB.js} +0 -0
- /package/.output/public/assets/{gdshader-PfnN_8tR.js → gdshader-BemFblFP.js} +0 -0
- /package/.output/public/assets/{genie-Bj-orPAV.js → genie-hCPg_eq7.js} +0 -0
- /package/.output/public/assets/{gherkin-COVWpJ-Q.js → gherkin-CO0ypD1P.js} +0 -0
- /package/.output/public/assets/{github-dark-ipGuFGYC.js → github-dark-cA72fqmI.js} +0 -0
- /package/.output/public/assets/{github-dark-default-DX3IG_X0.js → github-dark-default-DiYTFvY5.js} +0 -0
- /package/.output/public/assets/{github-dark-dimmed-CH6p_7ez.js → github-dark-dimmed-D-uBHzyG.js} +0 -0
- /package/.output/public/assets/{github-dark-high-contrast-Bg2sSao5.js → github-dark-high-contrast-BrUSkckI.js} +0 -0
- /package/.output/public/assets/{github-light-default-DwpDd1IQ.js → github-light-default-BT-6Vf7C.js} +0 -0
- /package/.output/public/assets/{github-light-high-contrast-C0QeixPf.js → github-light-high-contrast-DqmEyTTc.js} +0 -0
- /package/.output/public/assets/{github-light-BxjqOQl0.js → github-light-piFPqU8R.js} +0 -0
- /package/.output/public/assets/{gleam-BF2NigGj.js → gleam-CWJA_H5i.js} +0 -0
- /package/.output/public/assets/{gn-CMIt9roj.js → gn-nlTwLSjP.js} +0 -0
- /package/.output/public/assets/{gnuplot-DgWlRTEj.js → gnuplot-wYV0MbPl.js} +0 -0
- /package/.output/public/assets/{go-DLnOLj8q.js → go-BUPBDRDo.js} +0 -0
- /package/.output/public/assets/{groovy-B9qLWIkE.js → groovy-BusafOA8.js} +0 -0
- /package/.output/public/assets/{gruvbox-dark-hard-BIMX9ePb.js → gruvbox-dark-hard-BrrZYoPF.js} +0 -0
- /package/.output/public/assets/{gruvbox-dark-medium-DxuwyVzM.js → gruvbox-dark-medium-DsxcLuUs.js} +0 -0
- /package/.output/public/assets/{gruvbox-dark-soft-ba2fjht0.js → gruvbox-dark-soft-DQXOs_GH.js} +0 -0
- /package/.output/public/assets/{gruvbox-light-hard-DAJK2PqC.js → gruvbox-light-hard-CtHwj_cB.js} +0 -0
- /package/.output/public/assets/{gruvbox-light-medium-WRifDAJD.js → gruvbox-light-medium-CPJMdgXQ.js} +0 -0
- /package/.output/public/assets/{gruvbox-light-soft-B0dBOoVB.js → gruvbox-light-soft-C4Xh9Hc-.js} +0 -0
- /package/.output/public/assets/{haskell-BaGpmm_c.js → haskell-CaDqJkn4.js} +0 -0
- /package/.output/public/assets/{haxe-DfXTCEOz.js → haxe-Dxg-8_J7.js} +0 -0
- /package/.output/public/assets/{hcl-CbCtpSbi.js → hcl-Bjg-rMJ0.js} +0 -0
- /package/.output/public/assets/{hjson-_4-w-pHU.js → hjson-BMbeOOMg.js} +0 -0
- /package/.output/public/assets/{hlsl-DpuYn7pp.js → hlsl-D-cuwCFV.js} +0 -0
- /package/.output/public/assets/{horizon-C5RtD1fY.js → horizon-BofYY9of.js} +0 -0
- /package/.output/public/assets/{horizon-bright-pEOice34.js → horizon-bright-CFOVQsf2.js} +0 -0
- /package/.output/public/assets/{houston-A0zg9vNP.js → houston-BIBYxFpQ.js} +0 -0
- /package/.output/public/assets/{hy-t9zDXBje.js → hy-Cye3Jt7O.js} +0 -0
- /package/.output/public/assets/{imba-Bxu-TDfw.js → imba-CjkQtgD2.js} +0 -0
- /package/.output/public/assets/{ini-D-v34c8N.js → ini-BvMtfDNl.js} +0 -0
- /package/.output/public/assets/{java-DVLnIrqC.js → java-BYO3uQJZ.js} +0 -0
- /package/.output/public/assets/{javascript-Cop1kpy_.js → javascript-BsdGTPv_.js} +0 -0
- /package/.output/public/assets/{json-CTw4n7kn.js → json-Kp2u6f_f.js} +0 -0
- /package/.output/public/assets/{json5-D0XL1D5m.js → json5-BCxDPjxU.js} +0 -0
- /package/.output/public/assets/{jsonc-BBgf3TX3.js → jsonc-BV8VFjqO.js} +0 -0
- /package/.output/public/assets/{jsonl-KrKLbtB7.js → jsonl-DHrr7c-M.js} +0 -0
- /package/.output/public/assets/{jsonnet-B2ZwWMOt.js → jsonnet-xURar8mu.js} +0 -0
- /package/.output/public/assets/{jssm-ByRpI9-B.js → jssm-DtoLUQAt.js} +0 -0
- /package/.output/public/assets/{jsx-0oMUGqZj.js → jsx-CyrO086S.js} +0 -0
- /package/.output/public/assets/{kanagawa-dragon-CtPmcCMp.js → kanagawa-dragon-COwlYgQB.js} +0 -0
- /package/.output/public/assets/{kanagawa-lotus-DpOXEGCa.js → kanagawa-lotus-GZWqyq_E.js} +0 -0
- /package/.output/public/assets/{kanagawa-wave-CLVCyc-n.js → kanagawa-wave-CP4uw3DX.js} +0 -0
- /package/.output/public/assets/{kdl-6FPPEH4H.js → kdl-DGo2N7N5.js} +0 -0
- /package/.output/public/assets/{kotlin-D4L3Nd2D.js → kotlin-Cm4W8Bbs.js} +0 -0
- /package/.output/public/assets/{kusto-D-mmc07O.js → kusto-DQ22_tcT.js} +0 -0
- /package/.output/public/assets/{laserwave-7fEj4XGb.js → laserwave-DfABGYsD.js} +0 -0
- /package/.output/public/assets/{lean-BMVMuP2E.js → lean-D-8a6Wwv.js} +0 -0
- /package/.output/public/assets/{less-C95PyOu0.js → less-B-qZzFKw.js} +0 -0
- /package/.output/public/assets/{light-plus-DHI2dh3p.js → light-plus-DS_rmE1N.js} +0 -0
- /package/.output/public/assets/{llvm-Dy3qORTl.js → llvm-Ch-k6TUk.js} +0 -0
- /package/.output/public/assets/{log-BQop7fzg.js → log-BGwbCG2S.js} +0 -0
- /package/.output/public/assets/{logo-DKtnYmrp.js → logo-DHGHbFWy.js} +0 -0
- /package/.output/public/assets/{luau-Dha4KG0q.js → luau-qsvm_nYh.js} +0 -0
- /package/.output/public/assets/{make-DfmS6buu.js → make-Dlfjp_Q8.js} +0 -0
- /package/.output/public/assets/{markdown-BaI9LyM4.js → markdown-COh4ruD_.js} +0 -0
- /package/.output/public/assets/{material-theme-Dm6ETY8i.js → material-theme-Ccrl1jie.js} +0 -0
- /package/.output/public/assets/{material-theme-darker-BeyjmM5Z.js → material-theme-darker-CcOH0iHe.js} +0 -0
- /package/.output/public/assets/{material-theme-lighter-CCOYYzKL.js → material-theme-lighter-DoKpC7NM.js} +0 -0
- /package/.output/public/assets/{material-theme-ocean-CUtPiiX3.js → material-theme-ocean-BcvBZHgH.js} +0 -0
- /package/.output/public/assets/{material-theme-palenight-2L4zMwIM.js → material-theme-palenight-DIL4EAzl.js} +0 -0
- /package/.output/public/assets/{matlab-BT79Cq_j.js → matlab-CBqMuw7w.js} +0 -0
- /package/.output/public/assets/{mdx-CxGBwLNt.js → mdx-BjoJxHxW.js} +0 -0
- /package/.output/public/assets/{mermaid-DLf3axBN.js → mermaid-DjAh2yR5.js} +0 -0
- /package/.output/public/assets/{min-dark-B8TUPGHg.js → min-dark-CbwghdE5.js} +0 -0
- /package/.output/public/assets/{min-light-BDOoBxcA.js → min-light-_F39d_94.js} +0 -0
- /package/.output/public/assets/{mipsasm-DXuU_0cI.js → mipsasm-DA1H0O78.js} +0 -0
- /package/.output/public/assets/{mojo-1Omp2pIo.js → mojo-BVgjRjTn.js} +0 -0
- /package/.output/public/assets/{monokai-E_VBmXGZ.js → monokai-CxgvaWkX.js} +0 -0
- /package/.output/public/assets/{moonbit-DZzq699o.js → moonbit-tKY94ZOM.js} +0 -0
- /package/.output/public/assets/{move-DxDAOJVd.js → move-B5WspEjG.js} +0 -0
- /package/.output/public/assets/{narrat-CxDcPPb9.js → narrat-CDPRStf_.js} +0 -0
- /package/.output/public/assets/{nextflow-groovy-wvmJO4hi.js → nextflow-groovy-1GYTZoD5.js} +0 -0
- /package/.output/public/assets/{night-owl-DefhalNX.js → night-owl-CCydx7ZR.js} +0 -0
- /package/.output/public/assets/{night-owl-light-byb3AbEn.js → night-owl-light-CLM7UUPY.js} +0 -0
- /package/.output/public/assets/{nix-DsFTDHWT.js → nix-DXFN4IwW.js} +0 -0
- /package/.output/public/assets/{nord-D5rQzHT-.js → nord-CiCWZ1de.js} +0 -0
- /package/.output/public/assets/{nushell-BQ_rO0AM.js → nushell-Ck9o2qOx.js} +0 -0
- /package/.output/public/assets/{objective-c-BMq6JT_m.js → objective-c-4koxci9E.js} +0 -0
- /package/.output/public/assets/{objective-cpp-DRwojuGv.js → objective-cpp-BPFAgSN9.js} +0 -0
- /package/.output/public/assets/{ocaml-e4_gKO6E.js → ocaml-BdlBLhZV.js} +0 -0
- /package/.output/public/assets/{odin-mdTPwYOg.js → odin-BcGOLCqZ.js} +0 -0
- /package/.output/public/assets/{one-dark-pro-DxXww9jg.js → one-dark-pro-DEMdTgiO.js} +0 -0
- /package/.output/public/assets/{one-light-D9c03w7t.js → one-light-Cmpe9X1u.js} +0 -0
- /package/.output/public/assets/{openscad-D2aTdNfr.js → openscad-DBveSHYE.js} +0 -0
- /package/.output/public/assets/{pascal-D4n_G8vj.js → pascal-DxOVE99u.js} +0 -0
- /package/.output/public/assets/{pierre-dark-CizZ1Z5z.js → pierre-dark-DIUCKU6U.js} +0 -0
- /package/.output/public/assets/{pierre-light-CHMWfAMe.js → pierre-light-DVO2KPlh.js} +0 -0
- /package/.output/public/assets/{pkl-DcjhAp0L.js → pkl-pIvtf7Vu.js} +0 -0
- /package/.output/public/assets/{plastic-uOsw7z1x.js → plastic-Dvdf8qVN.js} +0 -0
- /package/.output/public/assets/{plsql-BSy3Ag0J.js → plsql-d50MFTFK.js} +0 -0
- /package/.output/public/assets/{po-Be96RYkA.js → po-CboxWwYg.js} +0 -0
- /package/.output/public/assets/{poimandres-CyO4HORD.js → poimandres-DHgQGH4M.js} +0 -0
- /package/.output/public/assets/{polar-BmhMKWum.js → polar-DNp7Oek8.js} +0 -0
- /package/.output/public/assets/{postcss-BTQso3H9.js → postcss-LpmI6XQv.js} +0 -0
- /package/.output/public/assets/{powerquery-DVyQv3M2.js → powerquery-BNCl8Uwz.js} +0 -0
- /package/.output/public/assets/{powershell-BmtCGJVD.js → powershell-CZ9J0XuS.js} +0 -0
- /package/.output/public/assets/{prisma-CCFA9rEj.js → prisma-AELUiJCl.js} +0 -0
- /package/.output/public/assets/{prolog-DWGEEo78.js → prolog-BlqwejRD.js} +0 -0
- /package/.output/public/assets/{proto-C3eop1kM.js → proto-DRQC3swD.js} +0 -0
- /package/.output/public/assets/{puppet-C0_7Nv5A.js → puppet-DBKR8MlH.js} +0 -0
- /package/.output/public/assets/{purescript-Bv-B8yRw.js → purescript-DItLzxZS.js} +0 -0
- /package/.output/public/assets/{python-CKg5r0C3.js → python-D9t_ETu8.js} +0 -0
- /package/.output/public/assets/{qmldir-Cqfb4Lox.js → qmldir-DP_KD1nk.js} +0 -0
- /package/.output/public/assets/{qss-Csho9BH8.js → qss-CL02opOd.js} +0 -0
- /package/.output/public/assets/{r-UcxRcvcA.js → r-DmmrCFmB.js} +0 -0
- /package/.output/public/assets/{racket-D8-uWeQH.js → racket-K0frLTWj.js} +0 -0
- /package/.output/public/assets/{raku-Cj4JSa8p.js → raku-DwgLlPg9.js} +0 -0
- /package/.output/public/assets/{red-z4H4llUY.js → red-DzDu-aXc.js} +0 -0
- /package/.output/public/assets/{reg-DXGFiJSl.js → reg-B_y3c7di.js} +0 -0
- /package/.output/public/assets/{regexp-3-A0406L.js → regexp--eMB47Xx.js} +0 -0
- /package/.output/public/assets/{rel-CunnVTBK.js → rel-CT65ywJp.js} +0 -0
- /package/.output/public/assets/{riscv-C8BcOCkS.js → riscv-Qv5W2vIg.js} +0 -0
- /package/.output/public/assets/{ron-DiDyR9oa.js → ron-cRHu9zPp.js} +0 -0
- /package/.output/public/assets/{rose-pine-BADquuIH.js → rose-pine-DFmTJHIJ.js} +0 -0
- /package/.output/public/assets/{rose-pine-dawn-BLcEeBoh.js → rose-pine-dawn-YIuK9wUm.js} +0 -0
- /package/.output/public/assets/{rose-pine-moon-BK_tLY1Y.js → rose-pine-moon-BYEHfkUB.js} +0 -0
- /package/.output/public/assets/{rosmsg-CHmL1Uyj.js → rosmsg-_L1z4wrx.js} +0 -0
- /package/.output/public/assets/{rust-DjJFInu3.js → rust-BA5wQ_EY.js} +0 -0
- /package/.output/public/assets/{sass-D3xZ5o-v.js → sass-sd__ov8V.js} +0 -0
- /package/.output/public/assets/{scala-B0IRml5w.js → scala--cVG4U7H.js} +0 -0
- /package/.output/public/assets/{scheme-BhwcV3Av.js → scheme-D6Q1O-kY.js} +0 -0
- /package/.output/public/assets/{sdbl-BmWYR-pI.js → sdbl-jB0DUrL_.js} +0 -0
- /package/.output/public/assets/{shellscript-DaVPunOM.js → shellscript-DyWRuzkj.js} +0 -0
- /package/.output/public/assets/{slack-dark-DOnVms5P.js → slack-dark-DHhAlQBa.js} +0 -0
- /package/.output/public/assets/{slack-ochin-DcRTft4q.js → slack-ochin-PZXbcZaN.js} +0 -0
- /package/.output/public/assets/{smalltalk-DVQuUMII.js → smalltalk-C7VkdTlv.js} +0 -0
- /package/.output/public/assets/{snazzy-light-x9CLJ1W9.js → snazzy-light-CPc_Qts9.js} +0 -0
- /package/.output/public/assets/{solarized-dark-BB1sh-pe.js → solarized-dark-DCCfKtTh.js} +0 -0
- /package/.output/public/assets/{solarized-light-9-RPS998.js → solarized-light-B84T-R9X.js} +0 -0
- /package/.output/public/assets/{solidity-gQ4WXILB.js → solidity-DVsDPpDS.js} +0 -0
- /package/.output/public/assets/{splunk-OB48_RcD.js → splunk-A-BwP6Va.js} +0 -0
- /package/.output/public/assets/{sql-CrTmZCMa.js → sql-CRzu7iKx.js} +0 -0
- /package/.output/public/assets/{ssh-config-DA9YMRGV.js → ssh-config-CFPv6mTy.js} +0 -0
- /package/.output/public/assets/{stylus-sKwvsUaC.js → stylus-CUf3IESt.js} +0 -0
- /package/.output/public/assets/{swift-C72NbAtg.js → swift-CSiiYB_Q.js} +0 -0
- /package/.output/public/assets/{synthwave-84-eJ9uRN_S.js → synthwave-84-uJp1j2Jd.js} +0 -0
- /package/.output/public/assets/{system-verilog-CnWMF7Nq.js → system-verilog-rMjKy-O9.js} +0 -0
- /package/.output/public/assets/{systemd-DMzItW5N.js → systemd-R-KDM4-t.js} +0 -0
- /package/.output/public/assets/{talonscript-DopQCWDL.js → talonscript-D666vCtm.js} +0 -0
- /package/.output/public/assets/{tasl-C28SYKbq.js → tasl-68cbBocU.js} +0 -0
- /package/.output/public/assets/{tcl-DHq7zmoF.js → tcl-Y39dJ_pX.js} +0 -0
- /package/.output/public/assets/{terraform-CogS1YKX.js → terraform-BF7wAo-b.js} +0 -0
- /package/.output/public/assets/{tokyo-night-B9N7LyrF.js → tokyo-night-EeABtN82.js} +0 -0
- /package/.output/public/assets/{toml-BH_iPsgK.js → toml-BrMFN1JF.js} +0 -0
- /package/.output/public/assets/{tsv-BIkdBZX1.js → tsv-Dp2l5v7f.js} +0 -0
- /package/.output/public/assets/{tsx-BjkCKOtw.js → tsx-CQqypS0k.js} +0 -0
- /package/.output/public/assets/{turtle-CqNXyJWZ.js → turtle-_N1aDtpV.js} +0 -0
- /package/.output/public/assets/{typescript-BoHeP9q1.js → typescript-CPmDkqmE.js} +0 -0
- /package/.output/public/assets/{typespec-CQ9LYD_e.js → typespec-ghgF2GAI.js} +0 -0
- /package/.output/public/assets/{typst-T-Fsk-Sv.js → typst-DP_izaNK.js} +0 -0
- /package/.output/public/assets/{v-BhMEOw9x.js → v-CdNC_Wok.js} +0 -0
- /package/.output/public/assets/{vala-DzajMnwt.js → vala-Bu4pYkLC.js} +0 -0
- /package/.output/public/assets/{vb-7Xr8dEYW.js → vb-u84IyWSS.js} +0 -0
- /package/.output/public/assets/{verilog-AvXtwZir.js → verilog-BC33pi7Z.js} +0 -0
- /package/.output/public/assets/{vesper-CtgQQ2sf.js → vesper-7-XtS0Kg.js} +0 -0
- /package/.output/public/assets/{vhdl-BHu0zg1P.js → vhdl-BBxTOQe0.js} +0 -0
- /package/.output/public/assets/{viml-Di0QpLfC.js → viml-X_r-ivXA.js} +0 -0
- /package/.output/public/assets/{vitesse-black-jXdfyqgD.js → vitesse-black-DRdlY-cW.js} +0 -0
- /package/.output/public/assets/{vitesse-dark-B88PxG1r.js → vitesse-dark-Bz0hOFHJ.js} +0 -0
- /package/.output/public/assets/{vitesse-light-BXxZh2iV.js → vitesse-light-7kCLd0yn.js} +0 -0
- /package/.output/public/assets/{vyper-C3R5yXgx.js → vyper-E7qIwMXy.js} +0 -0
- /package/.output/public/assets/{wasm-D_MQmneJ.js → wasm-BqG9CUph.js} +0 -0
- /package/.output/public/assets/{wasm-Chsuwt1A.js → wasm-C18OEcCL.js} +0 -0
- /package/.output/public/assets/{wenyan-BonVcr2i.js → wenyan-siXAC4el.js} +0 -0
- /package/.output/public/assets/{wgsl-D59WYmNq.js → wgsl-BJQt8Uld.js} +0 -0
- /package/.output/public/assets/{wikitext-ariTI2Wk.js → wikitext-Ci0ePJmf.js} +0 -0
- /package/.output/public/assets/{wit-EA4fa3Dt.js → wit-BdDJ7geN.js} +0 -0
- /package/.output/public/assets/{wolfram-DDp7LhyU.js → wolfram-Bi-O1IUM.js} +0 -0
- /package/.output/public/assets/{xterm-CCMwI7sy.js → xterm-TTe2Bv9Z.js} +0 -0
- /package/.output/public/assets/{yaml-BTD1XHJG.js → yaml-DgkO7CC2.js} +0 -0
- /package/.output/public/assets/{zenscript-4WaROUyc.js → zenscript-CnkrxCBw.js} +0 -0
- /package/.output/public/assets/{zig-CJoLJGwV.js → zig-CgMsxF9-.js} +0 -0
|
@@ -1,2929 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
//#region node_modules/.pnpm/crossws@0.4.5_srvx@0.11.15/node_modules/crossws/dist/_chunks/adapter.mjs
|
|
3
|
-
var AdapterHookable = class {
|
|
4
|
-
options;
|
|
5
|
-
constructor(options) {
|
|
6
|
-
this.options = options || {};
|
|
7
|
-
}
|
|
8
|
-
callHook(name, arg1, arg2) {
|
|
9
|
-
const globalHook = this.options.hooks?.[name];
|
|
10
|
-
const globalPromise = globalHook?.(arg1, arg2);
|
|
11
|
-
const request = arg1.request || arg1;
|
|
12
|
-
const resolveHooksPromise = this.options.resolve?.(request);
|
|
13
|
-
if (!resolveHooksPromise) return globalPromise;
|
|
14
|
-
const resolvePromise = resolveHooksPromise instanceof Promise ? resolveHooksPromise.then((hooks) => hooks?.[name]) : resolveHooksPromise?.[name];
|
|
15
|
-
return Promise.all([globalPromise, resolvePromise]).then(([globalRes, hook]) => {
|
|
16
|
-
const hookResPromise = hook?.(arg1, arg2);
|
|
17
|
-
return hookResPromise instanceof Promise ? hookResPromise.then((hookRes) => hookRes || globalRes) : hookResPromise || globalRes;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async upgrade(request) {
|
|
21
|
-
let namespace = this.options.getNamespace?.(request) ?? new URL(request.url).pathname;
|
|
22
|
-
const context = request.context || {};
|
|
23
|
-
try {
|
|
24
|
-
const res = await this.callHook("upgrade", request);
|
|
25
|
-
if (!res) return {
|
|
26
|
-
context,
|
|
27
|
-
namespace
|
|
28
|
-
};
|
|
29
|
-
if (res.namespace) namespace = res.namespace;
|
|
30
|
-
if (res.context) Object.assign(context, res.context);
|
|
31
|
-
if (res instanceof Response) return {
|
|
32
|
-
context,
|
|
33
|
-
namespace,
|
|
34
|
-
endResponse: res
|
|
35
|
-
};
|
|
36
|
-
if (res.handled) return {
|
|
37
|
-
context,
|
|
38
|
-
namespace,
|
|
39
|
-
handled: true
|
|
40
|
-
};
|
|
41
|
-
if (res.headers) return {
|
|
42
|
-
context,
|
|
43
|
-
namespace,
|
|
44
|
-
upgradeHeaders: res.headers
|
|
45
|
-
};
|
|
46
|
-
} catch (error) {
|
|
47
|
-
const errResponse = error.response || error;
|
|
48
|
-
if (errResponse instanceof Response) return {
|
|
49
|
-
context,
|
|
50
|
-
namespace,
|
|
51
|
-
endResponse: errResponse
|
|
52
|
-
};
|
|
53
|
-
throw error;
|
|
54
|
-
}
|
|
55
|
-
return {
|
|
56
|
-
context,
|
|
57
|
-
namespace
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
function adapterUtils(globalPeers) {
|
|
62
|
-
return {
|
|
63
|
-
peers: globalPeers,
|
|
64
|
-
publish(topic, message, options) {
|
|
65
|
-
for (const peers of options?.namespace ? [globalPeers.get(options.namespace) || []] : globalPeers.values()) {
|
|
66
|
-
let firstPeerWithTopic;
|
|
67
|
-
for (const peer of peers) if (peer.topics.has(topic)) {
|
|
68
|
-
firstPeerWithTopic = peer;
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
if (firstPeerWithTopic) {
|
|
72
|
-
firstPeerWithTopic.send(message, options);
|
|
73
|
-
firstPeerWithTopic.publish(topic, message, options);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
function getPeers(globalPeers, namespace) {
|
|
80
|
-
if (!namespace) throw new Error("Websocket publish namespace missing.");
|
|
81
|
-
let peers = globalPeers.get(namespace);
|
|
82
|
-
if (!peers) {
|
|
83
|
-
peers = /* @__PURE__ */ new Set();
|
|
84
|
-
globalPeers.set(namespace, peers);
|
|
85
|
-
}
|
|
86
|
-
return peers;
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region node_modules/.pnpm/crossws@0.4.5_srvx@0.11.15/node_modules/crossws/dist/_chunks/rolldown-runtime.mjs
|
|
90
|
-
var __create = Object.create;
|
|
91
|
-
var __defProp = Object.defineProperty;
|
|
92
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
93
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
94
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
95
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
96
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
97
|
-
var __copyProps = (to, from, except, desc) => {
|
|
98
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
99
|
-
key = keys[i];
|
|
100
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
101
|
-
get: ((k) => from[k]).bind(null, key),
|
|
102
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return to;
|
|
106
|
-
};
|
|
107
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
108
|
-
value: mod,
|
|
109
|
-
enumerable: true
|
|
110
|
-
}) : target, mod));
|
|
111
|
-
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region node_modules/.pnpm/crossws@0.4.5_srvx@0.11.15/node_modules/crossws/dist/_chunks/libs/ws.mjs
|
|
114
|
-
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
115
|
-
const BINARY_TYPES = [
|
|
116
|
-
"nodebuffer",
|
|
117
|
-
"arraybuffer",
|
|
118
|
-
"fragments"
|
|
119
|
-
];
|
|
120
|
-
const hasBlob = typeof Blob !== "undefined";
|
|
121
|
-
if (hasBlob) BINARY_TYPES.push("blob");
|
|
122
|
-
module.exports = {
|
|
123
|
-
BINARY_TYPES,
|
|
124
|
-
CLOSE_TIMEOUT: 3e4,
|
|
125
|
-
EMPTY_BUFFER: Buffer.alloc(0),
|
|
126
|
-
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
127
|
-
hasBlob,
|
|
128
|
-
kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
|
|
129
|
-
kListener: Symbol("kListener"),
|
|
130
|
-
kStatusCode: Symbol("status-code"),
|
|
131
|
-
kWebSocket: Symbol("websocket"),
|
|
132
|
-
NOOP: () => {}
|
|
133
|
-
};
|
|
134
|
-
}));
|
|
135
|
-
var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
136
|
-
const { EMPTY_BUFFER } = require_constants();
|
|
137
|
-
const FastBuffer = Buffer[Symbol.species];
|
|
138
|
-
function concat(list, totalLength) {
|
|
139
|
-
if (list.length === 0) return EMPTY_BUFFER;
|
|
140
|
-
if (list.length === 1) return list[0];
|
|
141
|
-
const target = Buffer.allocUnsafe(totalLength);
|
|
142
|
-
let offset = 0;
|
|
143
|
-
for (let i = 0; i < list.length; i++) {
|
|
144
|
-
const buf = list[i];
|
|
145
|
-
target.set(buf, offset);
|
|
146
|
-
offset += buf.length;
|
|
147
|
-
}
|
|
148
|
-
if (offset < totalLength) return new FastBuffer(target.buffer, target.byteOffset, offset);
|
|
149
|
-
return target;
|
|
150
|
-
}
|
|
151
|
-
function _mask(source, mask, output, offset, length) {
|
|
152
|
-
for (let i = 0; i < length; i++) output[offset + i] = source[i] ^ mask[i & 3];
|
|
153
|
-
}
|
|
154
|
-
function _unmask(buffer, mask) {
|
|
155
|
-
for (let i = 0; i < buffer.length; i++) buffer[i] ^= mask[i & 3];
|
|
156
|
-
}
|
|
157
|
-
function toArrayBuffer(buf) {
|
|
158
|
-
if (buf.length === buf.buffer.byteLength) return buf.buffer;
|
|
159
|
-
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
|
|
160
|
-
}
|
|
161
|
-
function toBuffer(data) {
|
|
162
|
-
toBuffer.readOnly = true;
|
|
163
|
-
if (Buffer.isBuffer(data)) return data;
|
|
164
|
-
let buf;
|
|
165
|
-
if (data instanceof ArrayBuffer) buf = new FastBuffer(data);
|
|
166
|
-
else if (ArrayBuffer.isView(data)) buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);
|
|
167
|
-
else {
|
|
168
|
-
buf = Buffer.from(data);
|
|
169
|
-
toBuffer.readOnly = false;
|
|
170
|
-
}
|
|
171
|
-
return buf;
|
|
172
|
-
}
|
|
173
|
-
module.exports = {
|
|
174
|
-
concat,
|
|
175
|
-
mask: _mask,
|
|
176
|
-
toArrayBuffer,
|
|
177
|
-
toBuffer,
|
|
178
|
-
unmask: _unmask
|
|
179
|
-
};
|
|
180
|
-
if (!process.env.WS_NO_BUFFER_UTIL) try {
|
|
181
|
-
const bufferUtil = __require("bufferutil");
|
|
182
|
-
module.exports.mask = function(source, mask, output, offset, length) {
|
|
183
|
-
if (length < 48) _mask(source, mask, output, offset, length);
|
|
184
|
-
else bufferUtil.mask(source, mask, output, offset, length);
|
|
185
|
-
};
|
|
186
|
-
module.exports.unmask = function(buffer, mask) {
|
|
187
|
-
if (buffer.length < 32) _unmask(buffer, mask);
|
|
188
|
-
else bufferUtil.unmask(buffer, mask);
|
|
189
|
-
};
|
|
190
|
-
} catch (e) {}
|
|
191
|
-
}));
|
|
192
|
-
var require_limiter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
193
|
-
const kDone = Symbol("kDone");
|
|
194
|
-
const kRun = Symbol("kRun");
|
|
195
|
-
var Limiter = class {
|
|
196
|
-
constructor(concurrency) {
|
|
197
|
-
this[kDone] = () => {
|
|
198
|
-
this.pending--;
|
|
199
|
-
this[kRun]();
|
|
200
|
-
};
|
|
201
|
-
this.concurrency = concurrency || Infinity;
|
|
202
|
-
this.jobs = [];
|
|
203
|
-
this.pending = 0;
|
|
204
|
-
}
|
|
205
|
-
add(job) {
|
|
206
|
-
this.jobs.push(job);
|
|
207
|
-
this[kRun]();
|
|
208
|
-
}
|
|
209
|
-
[kRun]() {
|
|
210
|
-
if (this.pending === this.concurrency) return;
|
|
211
|
-
if (this.jobs.length) {
|
|
212
|
-
const job = this.jobs.shift();
|
|
213
|
-
this.pending++;
|
|
214
|
-
job(this[kDone]);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
module.exports = Limiter;
|
|
219
|
-
}));
|
|
220
|
-
var require_permessage_deflate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
221
|
-
const zlib = __require("zlib");
|
|
222
|
-
const bufferUtil = require_buffer_util();
|
|
223
|
-
const Limiter = require_limiter();
|
|
224
|
-
const { kStatusCode } = require_constants();
|
|
225
|
-
const FastBuffer = Buffer[Symbol.species];
|
|
226
|
-
const TRAILER = Buffer.from([
|
|
227
|
-
0,
|
|
228
|
-
0,
|
|
229
|
-
255,
|
|
230
|
-
255
|
|
231
|
-
]);
|
|
232
|
-
const kPerMessageDeflate = Symbol("permessage-deflate");
|
|
233
|
-
const kTotalLength = Symbol("total-length");
|
|
234
|
-
const kCallback = Symbol("callback");
|
|
235
|
-
const kBuffers = Symbol("buffers");
|
|
236
|
-
const kError = Symbol("error");
|
|
237
|
-
let zlibLimiter;
|
|
238
|
-
var PerMessageDeflate = class {
|
|
239
|
-
constructor(options) {
|
|
240
|
-
this._options = options || {};
|
|
241
|
-
this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024;
|
|
242
|
-
this._maxPayload = this._options.maxPayload | 0;
|
|
243
|
-
this._isServer = !!this._options.isServer;
|
|
244
|
-
this._deflate = null;
|
|
245
|
-
this._inflate = null;
|
|
246
|
-
this.params = null;
|
|
247
|
-
if (!zlibLimiter) zlibLimiter = new Limiter(this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10);
|
|
248
|
-
}
|
|
249
|
-
static get extensionName() {
|
|
250
|
-
return "permessage-deflate";
|
|
251
|
-
}
|
|
252
|
-
offer() {
|
|
253
|
-
const params = {};
|
|
254
|
-
if (this._options.serverNoContextTakeover) params.server_no_context_takeover = true;
|
|
255
|
-
if (this._options.clientNoContextTakeover) params.client_no_context_takeover = true;
|
|
256
|
-
if (this._options.serverMaxWindowBits) params.server_max_window_bits = this._options.serverMaxWindowBits;
|
|
257
|
-
if (this._options.clientMaxWindowBits) params.client_max_window_bits = this._options.clientMaxWindowBits;
|
|
258
|
-
else if (this._options.clientMaxWindowBits == null) params.client_max_window_bits = true;
|
|
259
|
-
return params;
|
|
260
|
-
}
|
|
261
|
-
accept(configurations) {
|
|
262
|
-
configurations = this.normalizeParams(configurations);
|
|
263
|
-
this.params = this._isServer ? this.acceptAsServer(configurations) : this.acceptAsClient(configurations);
|
|
264
|
-
return this.params;
|
|
265
|
-
}
|
|
266
|
-
cleanup() {
|
|
267
|
-
if (this._inflate) {
|
|
268
|
-
this._inflate.close();
|
|
269
|
-
this._inflate = null;
|
|
270
|
-
}
|
|
271
|
-
if (this._deflate) {
|
|
272
|
-
const callback = this._deflate[kCallback];
|
|
273
|
-
this._deflate.close();
|
|
274
|
-
this._deflate = null;
|
|
275
|
-
if (callback) callback(/* @__PURE__ */ new Error("The deflate stream was closed while data was being processed"));
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
acceptAsServer(offers) {
|
|
279
|
-
const opts = this._options;
|
|
280
|
-
const accepted = offers.find((params) => {
|
|
281
|
-
if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) return false;
|
|
282
|
-
return true;
|
|
283
|
-
});
|
|
284
|
-
if (!accepted) throw new Error("None of the extension offers can be accepted");
|
|
285
|
-
if (opts.serverNoContextTakeover) accepted.server_no_context_takeover = true;
|
|
286
|
-
if (opts.clientNoContextTakeover) accepted.client_no_context_takeover = true;
|
|
287
|
-
if (typeof opts.serverMaxWindowBits === "number") accepted.server_max_window_bits = opts.serverMaxWindowBits;
|
|
288
|
-
if (typeof opts.clientMaxWindowBits === "number") accepted.client_max_window_bits = opts.clientMaxWindowBits;
|
|
289
|
-
else if (accepted.client_max_window_bits === true || opts.clientMaxWindowBits === false) delete accepted.client_max_window_bits;
|
|
290
|
-
return accepted;
|
|
291
|
-
}
|
|
292
|
-
acceptAsClient(response) {
|
|
293
|
-
const params = response[0];
|
|
294
|
-
if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) throw new Error("Unexpected parameter \"client_no_context_takeover\"");
|
|
295
|
-
if (!params.client_max_window_bits) {
|
|
296
|
-
if (typeof this._options.clientMaxWindowBits === "number") params.client_max_window_bits = this._options.clientMaxWindowBits;
|
|
297
|
-
} else if (this._options.clientMaxWindowBits === false || typeof this._options.clientMaxWindowBits === "number" && params.client_max_window_bits > this._options.clientMaxWindowBits) throw new Error("Unexpected or invalid parameter \"client_max_window_bits\"");
|
|
298
|
-
return params;
|
|
299
|
-
}
|
|
300
|
-
normalizeParams(configurations) {
|
|
301
|
-
configurations.forEach((params) => {
|
|
302
|
-
Object.keys(params).forEach((key) => {
|
|
303
|
-
let value = params[key];
|
|
304
|
-
if (value.length > 1) throw new Error(`Parameter "${key}" must have only a single value`);
|
|
305
|
-
value = value[0];
|
|
306
|
-
if (key === "client_max_window_bits") {
|
|
307
|
-
if (value !== true) {
|
|
308
|
-
const num = +value;
|
|
309
|
-
if (!Number.isInteger(num) || num < 8 || num > 15) throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
310
|
-
value = num;
|
|
311
|
-
} else if (!this._isServer) throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
312
|
-
} else if (key === "server_max_window_bits") {
|
|
313
|
-
const num = +value;
|
|
314
|
-
if (!Number.isInteger(num) || num < 8 || num > 15) throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
315
|
-
value = num;
|
|
316
|
-
} else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
|
|
317
|
-
if (value !== true) throw new TypeError(`Invalid value for parameter "${key}": ${value}`);
|
|
318
|
-
} else throw new Error(`Unknown parameter "${key}"`);
|
|
319
|
-
params[key] = value;
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
return configurations;
|
|
323
|
-
}
|
|
324
|
-
decompress(data, fin, callback) {
|
|
325
|
-
zlibLimiter.add((done) => {
|
|
326
|
-
this._decompress(data, fin, (err, result) => {
|
|
327
|
-
done();
|
|
328
|
-
callback(err, result);
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
compress(data, fin, callback) {
|
|
333
|
-
zlibLimiter.add((done) => {
|
|
334
|
-
this._compress(data, fin, (err, result) => {
|
|
335
|
-
done();
|
|
336
|
-
callback(err, result);
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
_decompress(data, fin, callback) {
|
|
341
|
-
const endpoint = this._isServer ? "client" : "server";
|
|
342
|
-
if (!this._inflate) {
|
|
343
|
-
const key = `${endpoint}_max_window_bits`;
|
|
344
|
-
const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
|
|
345
|
-
this._inflate = zlib.createInflateRaw({
|
|
346
|
-
...this._options.zlibInflateOptions,
|
|
347
|
-
windowBits
|
|
348
|
-
});
|
|
349
|
-
this._inflate[kPerMessageDeflate] = this;
|
|
350
|
-
this._inflate[kTotalLength] = 0;
|
|
351
|
-
this._inflate[kBuffers] = [];
|
|
352
|
-
this._inflate.on("error", inflateOnError);
|
|
353
|
-
this._inflate.on("data", inflateOnData);
|
|
354
|
-
}
|
|
355
|
-
this._inflate[kCallback] = callback;
|
|
356
|
-
this._inflate.write(data);
|
|
357
|
-
if (fin) this._inflate.write(TRAILER);
|
|
358
|
-
this._inflate.flush(() => {
|
|
359
|
-
const err = this._inflate[kError];
|
|
360
|
-
if (err) {
|
|
361
|
-
this._inflate.close();
|
|
362
|
-
this._inflate = null;
|
|
363
|
-
callback(err);
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
const data = bufferUtil.concat(this._inflate[kBuffers], this._inflate[kTotalLength]);
|
|
367
|
-
if (this._inflate._readableState.endEmitted) {
|
|
368
|
-
this._inflate.close();
|
|
369
|
-
this._inflate = null;
|
|
370
|
-
} else {
|
|
371
|
-
this._inflate[kTotalLength] = 0;
|
|
372
|
-
this._inflate[kBuffers] = [];
|
|
373
|
-
if (fin && this.params[`${endpoint}_no_context_takeover`]) this._inflate.reset();
|
|
374
|
-
}
|
|
375
|
-
callback(null, data);
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
_compress(data, fin, callback) {
|
|
379
|
-
const endpoint = this._isServer ? "server" : "client";
|
|
380
|
-
if (!this._deflate) {
|
|
381
|
-
const key = `${endpoint}_max_window_bits`;
|
|
382
|
-
const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
|
|
383
|
-
this._deflate = zlib.createDeflateRaw({
|
|
384
|
-
...this._options.zlibDeflateOptions,
|
|
385
|
-
windowBits
|
|
386
|
-
});
|
|
387
|
-
this._deflate[kTotalLength] = 0;
|
|
388
|
-
this._deflate[kBuffers] = [];
|
|
389
|
-
this._deflate.on("data", deflateOnData);
|
|
390
|
-
}
|
|
391
|
-
this._deflate[kCallback] = callback;
|
|
392
|
-
this._deflate.write(data);
|
|
393
|
-
this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {
|
|
394
|
-
if (!this._deflate) return;
|
|
395
|
-
let data = bufferUtil.concat(this._deflate[kBuffers], this._deflate[kTotalLength]);
|
|
396
|
-
if (fin) data = new FastBuffer(data.buffer, data.byteOffset, data.length - 4);
|
|
397
|
-
this._deflate[kCallback] = null;
|
|
398
|
-
this._deflate[kTotalLength] = 0;
|
|
399
|
-
this._deflate[kBuffers] = [];
|
|
400
|
-
if (fin && this.params[`${endpoint}_no_context_takeover`]) this._deflate.reset();
|
|
401
|
-
callback(null, data);
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
};
|
|
405
|
-
module.exports = PerMessageDeflate;
|
|
406
|
-
function deflateOnData(chunk) {
|
|
407
|
-
this[kBuffers].push(chunk);
|
|
408
|
-
this[kTotalLength] += chunk.length;
|
|
409
|
-
}
|
|
410
|
-
function inflateOnData(chunk) {
|
|
411
|
-
this[kTotalLength] += chunk.length;
|
|
412
|
-
if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) {
|
|
413
|
-
this[kBuffers].push(chunk);
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
this[kError] = /* @__PURE__ */ new RangeError("Max payload size exceeded");
|
|
417
|
-
this[kError].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";
|
|
418
|
-
this[kError][kStatusCode] = 1009;
|
|
419
|
-
this.removeListener("data", inflateOnData);
|
|
420
|
-
this.reset();
|
|
421
|
-
}
|
|
422
|
-
function inflateOnError(err) {
|
|
423
|
-
this[kPerMessageDeflate]._inflate = null;
|
|
424
|
-
if (this[kError]) {
|
|
425
|
-
this[kCallback](this[kError]);
|
|
426
|
-
return;
|
|
427
|
-
}
|
|
428
|
-
err[kStatusCode] = 1007;
|
|
429
|
-
this[kCallback](err);
|
|
430
|
-
}
|
|
431
|
-
}));
|
|
432
|
-
var require_validation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
433
|
-
const { isUtf8 } = __require("buffer");
|
|
434
|
-
const { hasBlob } = require_constants();
|
|
435
|
-
const tokenChars = [
|
|
436
|
-
0,
|
|
437
|
-
0,
|
|
438
|
-
0,
|
|
439
|
-
0,
|
|
440
|
-
0,
|
|
441
|
-
0,
|
|
442
|
-
0,
|
|
443
|
-
0,
|
|
444
|
-
0,
|
|
445
|
-
0,
|
|
446
|
-
0,
|
|
447
|
-
0,
|
|
448
|
-
0,
|
|
449
|
-
0,
|
|
450
|
-
0,
|
|
451
|
-
0,
|
|
452
|
-
0,
|
|
453
|
-
0,
|
|
454
|
-
0,
|
|
455
|
-
0,
|
|
456
|
-
0,
|
|
457
|
-
0,
|
|
458
|
-
0,
|
|
459
|
-
0,
|
|
460
|
-
0,
|
|
461
|
-
0,
|
|
462
|
-
0,
|
|
463
|
-
0,
|
|
464
|
-
0,
|
|
465
|
-
0,
|
|
466
|
-
0,
|
|
467
|
-
0,
|
|
468
|
-
0,
|
|
469
|
-
1,
|
|
470
|
-
0,
|
|
471
|
-
1,
|
|
472
|
-
1,
|
|
473
|
-
1,
|
|
474
|
-
1,
|
|
475
|
-
1,
|
|
476
|
-
0,
|
|
477
|
-
0,
|
|
478
|
-
1,
|
|
479
|
-
1,
|
|
480
|
-
0,
|
|
481
|
-
1,
|
|
482
|
-
1,
|
|
483
|
-
0,
|
|
484
|
-
1,
|
|
485
|
-
1,
|
|
486
|
-
1,
|
|
487
|
-
1,
|
|
488
|
-
1,
|
|
489
|
-
1,
|
|
490
|
-
1,
|
|
491
|
-
1,
|
|
492
|
-
1,
|
|
493
|
-
1,
|
|
494
|
-
0,
|
|
495
|
-
0,
|
|
496
|
-
0,
|
|
497
|
-
0,
|
|
498
|
-
0,
|
|
499
|
-
0,
|
|
500
|
-
0,
|
|
501
|
-
1,
|
|
502
|
-
1,
|
|
503
|
-
1,
|
|
504
|
-
1,
|
|
505
|
-
1,
|
|
506
|
-
1,
|
|
507
|
-
1,
|
|
508
|
-
1,
|
|
509
|
-
1,
|
|
510
|
-
1,
|
|
511
|
-
1,
|
|
512
|
-
1,
|
|
513
|
-
1,
|
|
514
|
-
1,
|
|
515
|
-
1,
|
|
516
|
-
1,
|
|
517
|
-
1,
|
|
518
|
-
1,
|
|
519
|
-
1,
|
|
520
|
-
1,
|
|
521
|
-
1,
|
|
522
|
-
1,
|
|
523
|
-
1,
|
|
524
|
-
1,
|
|
525
|
-
1,
|
|
526
|
-
1,
|
|
527
|
-
0,
|
|
528
|
-
0,
|
|
529
|
-
0,
|
|
530
|
-
1,
|
|
531
|
-
1,
|
|
532
|
-
1,
|
|
533
|
-
1,
|
|
534
|
-
1,
|
|
535
|
-
1,
|
|
536
|
-
1,
|
|
537
|
-
1,
|
|
538
|
-
1,
|
|
539
|
-
1,
|
|
540
|
-
1,
|
|
541
|
-
1,
|
|
542
|
-
1,
|
|
543
|
-
1,
|
|
544
|
-
1,
|
|
545
|
-
1,
|
|
546
|
-
1,
|
|
547
|
-
1,
|
|
548
|
-
1,
|
|
549
|
-
1,
|
|
550
|
-
1,
|
|
551
|
-
1,
|
|
552
|
-
1,
|
|
553
|
-
1,
|
|
554
|
-
1,
|
|
555
|
-
1,
|
|
556
|
-
1,
|
|
557
|
-
1,
|
|
558
|
-
1,
|
|
559
|
-
0,
|
|
560
|
-
1,
|
|
561
|
-
0,
|
|
562
|
-
1,
|
|
563
|
-
0
|
|
564
|
-
];
|
|
565
|
-
function isValidStatusCode(code) {
|
|
566
|
-
return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999;
|
|
567
|
-
}
|
|
568
|
-
function _isValidUTF8(buf) {
|
|
569
|
-
const len = buf.length;
|
|
570
|
-
let i = 0;
|
|
571
|
-
while (i < len) if ((buf[i] & 128) === 0) i++;
|
|
572
|
-
else if ((buf[i] & 224) === 192) {
|
|
573
|
-
if (i + 1 === len || (buf[i + 1] & 192) !== 128 || (buf[i] & 254) === 192) return false;
|
|
574
|
-
i += 2;
|
|
575
|
-
} else if ((buf[i] & 240) === 224) {
|
|
576
|
-
if (i + 2 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || buf[i] === 224 && (buf[i + 1] & 224) === 128 || buf[i] === 237 && (buf[i + 1] & 224) === 160) return false;
|
|
577
|
-
i += 3;
|
|
578
|
-
} else if ((buf[i] & 248) === 240) {
|
|
579
|
-
if (i + 3 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || (buf[i + 3] & 192) !== 128 || buf[i] === 240 && (buf[i + 1] & 240) === 128 || buf[i] === 244 && buf[i + 1] > 143 || buf[i] > 244) return false;
|
|
580
|
-
i += 4;
|
|
581
|
-
} else return false;
|
|
582
|
-
return true;
|
|
583
|
-
}
|
|
584
|
-
function isBlob(value) {
|
|
585
|
-
return hasBlob && typeof value === "object" && typeof value.arrayBuffer === "function" && typeof value.type === "string" && typeof value.stream === "function" && (value[Symbol.toStringTag] === "Blob" || value[Symbol.toStringTag] === "File");
|
|
586
|
-
}
|
|
587
|
-
module.exports = {
|
|
588
|
-
isBlob,
|
|
589
|
-
isValidStatusCode,
|
|
590
|
-
isValidUTF8: _isValidUTF8,
|
|
591
|
-
tokenChars
|
|
592
|
-
};
|
|
593
|
-
if (isUtf8) module.exports.isValidUTF8 = function(buf) {
|
|
594
|
-
return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
|
|
595
|
-
};
|
|
596
|
-
else if (!process.env.WS_NO_UTF_8_VALIDATE) try {
|
|
597
|
-
const isValidUTF8 = __require("utf-8-validate");
|
|
598
|
-
module.exports.isValidUTF8 = function(buf) {
|
|
599
|
-
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
|
600
|
-
};
|
|
601
|
-
} catch (e) {}
|
|
602
|
-
}));
|
|
603
|
-
var require_receiver = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
604
|
-
const { Writable } = __require("stream");
|
|
605
|
-
const PerMessageDeflate = require_permessage_deflate();
|
|
606
|
-
const { BINARY_TYPES, EMPTY_BUFFER, kStatusCode, kWebSocket } = require_constants();
|
|
607
|
-
const { concat, toArrayBuffer, unmask } = require_buffer_util();
|
|
608
|
-
const { isValidStatusCode, isValidUTF8 } = require_validation();
|
|
609
|
-
const FastBuffer = Buffer[Symbol.species];
|
|
610
|
-
const GET_INFO = 0;
|
|
611
|
-
const GET_PAYLOAD_LENGTH_16 = 1;
|
|
612
|
-
const GET_PAYLOAD_LENGTH_64 = 2;
|
|
613
|
-
const GET_MASK = 3;
|
|
614
|
-
const GET_DATA = 4;
|
|
615
|
-
const INFLATING = 5;
|
|
616
|
-
const DEFER_EVENT = 6;
|
|
617
|
-
var Receiver = class extends Writable {
|
|
618
|
-
constructor(options = {}) {
|
|
619
|
-
super();
|
|
620
|
-
this._allowSynchronousEvents = options.allowSynchronousEvents !== void 0 ? options.allowSynchronousEvents : true;
|
|
621
|
-
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
622
|
-
this._extensions = options.extensions || {};
|
|
623
|
-
this._isServer = !!options.isServer;
|
|
624
|
-
this._maxPayload = options.maxPayload | 0;
|
|
625
|
-
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
626
|
-
this[kWebSocket] = void 0;
|
|
627
|
-
this._bufferedBytes = 0;
|
|
628
|
-
this._buffers = [];
|
|
629
|
-
this._compressed = false;
|
|
630
|
-
this._payloadLength = 0;
|
|
631
|
-
this._mask = void 0;
|
|
632
|
-
this._fragmented = 0;
|
|
633
|
-
this._masked = false;
|
|
634
|
-
this._fin = false;
|
|
635
|
-
this._opcode = 0;
|
|
636
|
-
this._totalPayloadLength = 0;
|
|
637
|
-
this._messageLength = 0;
|
|
638
|
-
this._fragments = [];
|
|
639
|
-
this._errored = false;
|
|
640
|
-
this._loop = false;
|
|
641
|
-
this._state = GET_INFO;
|
|
642
|
-
}
|
|
643
|
-
_write(chunk, encoding, cb) {
|
|
644
|
-
if (this._opcode === 8 && this._state == GET_INFO) return cb();
|
|
645
|
-
this._bufferedBytes += chunk.length;
|
|
646
|
-
this._buffers.push(chunk);
|
|
647
|
-
this.startLoop(cb);
|
|
648
|
-
}
|
|
649
|
-
consume(n) {
|
|
650
|
-
this._bufferedBytes -= n;
|
|
651
|
-
if (n === this._buffers[0].length) return this._buffers.shift();
|
|
652
|
-
if (n < this._buffers[0].length) {
|
|
653
|
-
const buf = this._buffers[0];
|
|
654
|
-
this._buffers[0] = new FastBuffer(buf.buffer, buf.byteOffset + n, buf.length - n);
|
|
655
|
-
return new FastBuffer(buf.buffer, buf.byteOffset, n);
|
|
656
|
-
}
|
|
657
|
-
const dst = Buffer.allocUnsafe(n);
|
|
658
|
-
do {
|
|
659
|
-
const buf = this._buffers[0];
|
|
660
|
-
const offset = dst.length - n;
|
|
661
|
-
if (n >= buf.length) dst.set(this._buffers.shift(), offset);
|
|
662
|
-
else {
|
|
663
|
-
dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);
|
|
664
|
-
this._buffers[0] = new FastBuffer(buf.buffer, buf.byteOffset + n, buf.length - n);
|
|
665
|
-
}
|
|
666
|
-
n -= buf.length;
|
|
667
|
-
} while (n > 0);
|
|
668
|
-
return dst;
|
|
669
|
-
}
|
|
670
|
-
startLoop(cb) {
|
|
671
|
-
this._loop = true;
|
|
672
|
-
do
|
|
673
|
-
switch (this._state) {
|
|
674
|
-
case GET_INFO:
|
|
675
|
-
this.getInfo(cb);
|
|
676
|
-
break;
|
|
677
|
-
case GET_PAYLOAD_LENGTH_16:
|
|
678
|
-
this.getPayloadLength16(cb);
|
|
679
|
-
break;
|
|
680
|
-
case GET_PAYLOAD_LENGTH_64:
|
|
681
|
-
this.getPayloadLength64(cb);
|
|
682
|
-
break;
|
|
683
|
-
case GET_MASK:
|
|
684
|
-
this.getMask();
|
|
685
|
-
break;
|
|
686
|
-
case GET_DATA:
|
|
687
|
-
this.getData(cb);
|
|
688
|
-
break;
|
|
689
|
-
case INFLATING:
|
|
690
|
-
case DEFER_EVENT:
|
|
691
|
-
this._loop = false;
|
|
692
|
-
return;
|
|
693
|
-
}
|
|
694
|
-
while (this._loop);
|
|
695
|
-
if (!this._errored) cb();
|
|
696
|
-
}
|
|
697
|
-
getInfo(cb) {
|
|
698
|
-
if (this._bufferedBytes < 2) {
|
|
699
|
-
this._loop = false;
|
|
700
|
-
return;
|
|
701
|
-
}
|
|
702
|
-
const buf = this.consume(2);
|
|
703
|
-
if ((buf[0] & 48) !== 0) {
|
|
704
|
-
cb(this.createError(RangeError, "RSV2 and RSV3 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_2_3"));
|
|
705
|
-
return;
|
|
706
|
-
}
|
|
707
|
-
const compressed = (buf[0] & 64) === 64;
|
|
708
|
-
if (compressed && !this._extensions[PerMessageDeflate.extensionName]) {
|
|
709
|
-
cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
|
|
710
|
-
return;
|
|
711
|
-
}
|
|
712
|
-
this._fin = (buf[0] & 128) === 128;
|
|
713
|
-
this._opcode = buf[0] & 15;
|
|
714
|
-
this._payloadLength = buf[1] & 127;
|
|
715
|
-
if (this._opcode === 0) {
|
|
716
|
-
if (compressed) {
|
|
717
|
-
cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
if (!this._fragmented) {
|
|
721
|
-
cb(this.createError(RangeError, "invalid opcode 0", true, 1002, "WS_ERR_INVALID_OPCODE"));
|
|
722
|
-
return;
|
|
723
|
-
}
|
|
724
|
-
this._opcode = this._fragmented;
|
|
725
|
-
} else if (this._opcode === 1 || this._opcode === 2) {
|
|
726
|
-
if (this._fragmented) {
|
|
727
|
-
cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
|
|
728
|
-
return;
|
|
729
|
-
}
|
|
730
|
-
this._compressed = compressed;
|
|
731
|
-
} else if (this._opcode > 7 && this._opcode < 11) {
|
|
732
|
-
if (!this._fin) {
|
|
733
|
-
cb(this.createError(RangeError, "FIN must be set", true, 1002, "WS_ERR_EXPECTED_FIN"));
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
if (compressed) {
|
|
737
|
-
cb(this.createError(RangeError, "RSV1 must be clear", true, 1002, "WS_ERR_UNEXPECTED_RSV_1"));
|
|
738
|
-
return;
|
|
739
|
-
}
|
|
740
|
-
if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
|
|
741
|
-
cb(this.createError(RangeError, `invalid payload length ${this._payloadLength}`, true, 1002, "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"));
|
|
742
|
-
return;
|
|
743
|
-
}
|
|
744
|
-
} else {
|
|
745
|
-
cb(this.createError(RangeError, `invalid opcode ${this._opcode}`, true, 1002, "WS_ERR_INVALID_OPCODE"));
|
|
746
|
-
return;
|
|
747
|
-
}
|
|
748
|
-
if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
|
|
749
|
-
this._masked = (buf[1] & 128) === 128;
|
|
750
|
-
if (this._isServer) {
|
|
751
|
-
if (!this._masked) {
|
|
752
|
-
cb(this.createError(RangeError, "MASK must be set", true, 1002, "WS_ERR_EXPECTED_MASK"));
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
} else if (this._masked) {
|
|
756
|
-
cb(this.createError(RangeError, "MASK must be clear", true, 1002, "WS_ERR_UNEXPECTED_MASK"));
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
|
|
760
|
-
else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64;
|
|
761
|
-
else this.haveLength(cb);
|
|
762
|
-
}
|
|
763
|
-
getPayloadLength16(cb) {
|
|
764
|
-
if (this._bufferedBytes < 2) {
|
|
765
|
-
this._loop = false;
|
|
766
|
-
return;
|
|
767
|
-
}
|
|
768
|
-
this._payloadLength = this.consume(2).readUInt16BE(0);
|
|
769
|
-
this.haveLength(cb);
|
|
770
|
-
}
|
|
771
|
-
getPayloadLength64(cb) {
|
|
772
|
-
if (this._bufferedBytes < 8) {
|
|
773
|
-
this._loop = false;
|
|
774
|
-
return;
|
|
775
|
-
}
|
|
776
|
-
const buf = this.consume(8);
|
|
777
|
-
const num = buf.readUInt32BE(0);
|
|
778
|
-
if (num > Math.pow(2, 21) - 1) {
|
|
779
|
-
cb(this.createError(RangeError, "Unsupported WebSocket frame: payload length > 2^53 - 1", false, 1009, "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"));
|
|
780
|
-
return;
|
|
781
|
-
}
|
|
782
|
-
this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
|
|
783
|
-
this.haveLength(cb);
|
|
784
|
-
}
|
|
785
|
-
haveLength(cb) {
|
|
786
|
-
if (this._payloadLength && this._opcode < 8) {
|
|
787
|
-
this._totalPayloadLength += this._payloadLength;
|
|
788
|
-
if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
|
|
789
|
-
cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
}
|
|
793
|
-
if (this._masked) this._state = GET_MASK;
|
|
794
|
-
else this._state = GET_DATA;
|
|
795
|
-
}
|
|
796
|
-
getMask() {
|
|
797
|
-
if (this._bufferedBytes < 4) {
|
|
798
|
-
this._loop = false;
|
|
799
|
-
return;
|
|
800
|
-
}
|
|
801
|
-
this._mask = this.consume(4);
|
|
802
|
-
this._state = GET_DATA;
|
|
803
|
-
}
|
|
804
|
-
getData(cb) {
|
|
805
|
-
let data = EMPTY_BUFFER;
|
|
806
|
-
if (this._payloadLength) {
|
|
807
|
-
if (this._bufferedBytes < this._payloadLength) {
|
|
808
|
-
this._loop = false;
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
data = this.consume(this._payloadLength);
|
|
812
|
-
if (this._masked && (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0) unmask(data, this._mask);
|
|
813
|
-
}
|
|
814
|
-
if (this._opcode > 7) {
|
|
815
|
-
this.controlMessage(data, cb);
|
|
816
|
-
return;
|
|
817
|
-
}
|
|
818
|
-
if (this._compressed) {
|
|
819
|
-
this._state = INFLATING;
|
|
820
|
-
this.decompress(data, cb);
|
|
821
|
-
return;
|
|
822
|
-
}
|
|
823
|
-
if (data.length) {
|
|
824
|
-
this._messageLength = this._totalPayloadLength;
|
|
825
|
-
this._fragments.push(data);
|
|
826
|
-
}
|
|
827
|
-
this.dataMessage(cb);
|
|
828
|
-
}
|
|
829
|
-
decompress(data, cb) {
|
|
830
|
-
this._extensions[PerMessageDeflate.extensionName].decompress(data, this._fin, (err, buf) => {
|
|
831
|
-
if (err) return cb(err);
|
|
832
|
-
if (buf.length) {
|
|
833
|
-
this._messageLength += buf.length;
|
|
834
|
-
if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
|
|
835
|
-
cb(this.createError(RangeError, "Max payload size exceeded", false, 1009, "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));
|
|
836
|
-
return;
|
|
837
|
-
}
|
|
838
|
-
this._fragments.push(buf);
|
|
839
|
-
}
|
|
840
|
-
this.dataMessage(cb);
|
|
841
|
-
if (this._state === GET_INFO) this.startLoop(cb);
|
|
842
|
-
});
|
|
843
|
-
}
|
|
844
|
-
dataMessage(cb) {
|
|
845
|
-
if (!this._fin) {
|
|
846
|
-
this._state = GET_INFO;
|
|
847
|
-
return;
|
|
848
|
-
}
|
|
849
|
-
const messageLength = this._messageLength;
|
|
850
|
-
const fragments = this._fragments;
|
|
851
|
-
this._totalPayloadLength = 0;
|
|
852
|
-
this._messageLength = 0;
|
|
853
|
-
this._fragmented = 0;
|
|
854
|
-
this._fragments = [];
|
|
855
|
-
if (this._opcode === 2) {
|
|
856
|
-
let data;
|
|
857
|
-
if (this._binaryType === "nodebuffer") data = concat(fragments, messageLength);
|
|
858
|
-
else if (this._binaryType === "arraybuffer") data = toArrayBuffer(concat(fragments, messageLength));
|
|
859
|
-
else if (this._binaryType === "blob") data = new Blob(fragments);
|
|
860
|
-
else data = fragments;
|
|
861
|
-
if (this._allowSynchronousEvents) {
|
|
862
|
-
this.emit("message", data, true);
|
|
863
|
-
this._state = GET_INFO;
|
|
864
|
-
} else {
|
|
865
|
-
this._state = DEFER_EVENT;
|
|
866
|
-
setImmediate(() => {
|
|
867
|
-
this.emit("message", data, true);
|
|
868
|
-
this._state = GET_INFO;
|
|
869
|
-
this.startLoop(cb);
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
|
-
} else {
|
|
873
|
-
const buf = concat(fragments, messageLength);
|
|
874
|
-
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
875
|
-
cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
|
|
876
|
-
return;
|
|
877
|
-
}
|
|
878
|
-
if (this._state === INFLATING || this._allowSynchronousEvents) {
|
|
879
|
-
this.emit("message", buf, false);
|
|
880
|
-
this._state = GET_INFO;
|
|
881
|
-
} else {
|
|
882
|
-
this._state = DEFER_EVENT;
|
|
883
|
-
setImmediate(() => {
|
|
884
|
-
this.emit("message", buf, false);
|
|
885
|
-
this._state = GET_INFO;
|
|
886
|
-
this.startLoop(cb);
|
|
887
|
-
});
|
|
888
|
-
}
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
controlMessage(data, cb) {
|
|
892
|
-
if (this._opcode === 8) {
|
|
893
|
-
if (data.length === 0) {
|
|
894
|
-
this._loop = false;
|
|
895
|
-
this.emit("conclude", 1005, EMPTY_BUFFER);
|
|
896
|
-
this.end();
|
|
897
|
-
} else {
|
|
898
|
-
const code = data.readUInt16BE(0);
|
|
899
|
-
if (!isValidStatusCode(code)) {
|
|
900
|
-
cb(this.createError(RangeError, `invalid status code ${code}`, true, 1002, "WS_ERR_INVALID_CLOSE_CODE"));
|
|
901
|
-
return;
|
|
902
|
-
}
|
|
903
|
-
const buf = new FastBuffer(data.buffer, data.byteOffset + 2, data.length - 2);
|
|
904
|
-
if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
|
|
905
|
-
cb(this.createError(Error, "invalid UTF-8 sequence", true, 1007, "WS_ERR_INVALID_UTF8"));
|
|
906
|
-
return;
|
|
907
|
-
}
|
|
908
|
-
this._loop = false;
|
|
909
|
-
this.emit("conclude", code, buf);
|
|
910
|
-
this.end();
|
|
911
|
-
}
|
|
912
|
-
this._state = GET_INFO;
|
|
913
|
-
return;
|
|
914
|
-
}
|
|
915
|
-
if (this._allowSynchronousEvents) {
|
|
916
|
-
this.emit(this._opcode === 9 ? "ping" : "pong", data);
|
|
917
|
-
this._state = GET_INFO;
|
|
918
|
-
} else {
|
|
919
|
-
this._state = DEFER_EVENT;
|
|
920
|
-
setImmediate(() => {
|
|
921
|
-
this.emit(this._opcode === 9 ? "ping" : "pong", data);
|
|
922
|
-
this._state = GET_INFO;
|
|
923
|
-
this.startLoop(cb);
|
|
924
|
-
});
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
createError(ErrorCtor, message, prefix, statusCode, errorCode) {
|
|
928
|
-
this._loop = false;
|
|
929
|
-
this._errored = true;
|
|
930
|
-
const err = new ErrorCtor(prefix ? `Invalid WebSocket frame: ${message}` : message);
|
|
931
|
-
Error.captureStackTrace(err, this.createError);
|
|
932
|
-
err.code = errorCode;
|
|
933
|
-
err[kStatusCode] = statusCode;
|
|
934
|
-
return err;
|
|
935
|
-
}
|
|
936
|
-
};
|
|
937
|
-
module.exports = Receiver;
|
|
938
|
-
}));
|
|
939
|
-
var require_sender = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
940
|
-
const { Duplex: Duplex$3 } = __require("stream");
|
|
941
|
-
const { randomFillSync } = __require("crypto");
|
|
942
|
-
const PerMessageDeflate = require_permessage_deflate();
|
|
943
|
-
const { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
|
|
944
|
-
const { isBlob, isValidStatusCode } = require_validation();
|
|
945
|
-
const { mask: applyMask, toBuffer } = require_buffer_util();
|
|
946
|
-
const kByteLength = Symbol("kByteLength");
|
|
947
|
-
const maskBuffer = Buffer.alloc(4);
|
|
948
|
-
const RANDOM_POOL_SIZE = 8 * 1024;
|
|
949
|
-
let randomPool;
|
|
950
|
-
let randomPoolPointer = RANDOM_POOL_SIZE;
|
|
951
|
-
const DEFAULT = 0;
|
|
952
|
-
const DEFLATING = 1;
|
|
953
|
-
const GET_BLOB_DATA = 2;
|
|
954
|
-
module.exports = class Sender {
|
|
955
|
-
constructor(socket, extensions, generateMask) {
|
|
956
|
-
this._extensions = extensions || {};
|
|
957
|
-
if (generateMask) {
|
|
958
|
-
this._generateMask = generateMask;
|
|
959
|
-
this._maskBuffer = Buffer.alloc(4);
|
|
960
|
-
}
|
|
961
|
-
this._socket = socket;
|
|
962
|
-
this._firstFragment = true;
|
|
963
|
-
this._compress = false;
|
|
964
|
-
this._bufferedBytes = 0;
|
|
965
|
-
this._queue = [];
|
|
966
|
-
this._state = DEFAULT;
|
|
967
|
-
this.onerror = NOOP;
|
|
968
|
-
this[kWebSocket] = void 0;
|
|
969
|
-
}
|
|
970
|
-
static frame(data, options) {
|
|
971
|
-
let mask;
|
|
972
|
-
let merge = false;
|
|
973
|
-
let offset = 2;
|
|
974
|
-
let skipMasking = false;
|
|
975
|
-
if (options.mask) {
|
|
976
|
-
mask = options.maskBuffer || maskBuffer;
|
|
977
|
-
if (options.generateMask) options.generateMask(mask);
|
|
978
|
-
else {
|
|
979
|
-
if (randomPoolPointer === RANDOM_POOL_SIZE) {
|
|
980
|
-
if (randomPool === void 0) randomPool = Buffer.alloc(RANDOM_POOL_SIZE);
|
|
981
|
-
randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
|
|
982
|
-
randomPoolPointer = 0;
|
|
983
|
-
}
|
|
984
|
-
mask[0] = randomPool[randomPoolPointer++];
|
|
985
|
-
mask[1] = randomPool[randomPoolPointer++];
|
|
986
|
-
mask[2] = randomPool[randomPoolPointer++];
|
|
987
|
-
mask[3] = randomPool[randomPoolPointer++];
|
|
988
|
-
}
|
|
989
|
-
skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
|
|
990
|
-
offset = 6;
|
|
991
|
-
}
|
|
992
|
-
let dataLength;
|
|
993
|
-
if (typeof data === "string") if ((!options.mask || skipMasking) && options[kByteLength] !== void 0) dataLength = options[kByteLength];
|
|
994
|
-
else {
|
|
995
|
-
data = Buffer.from(data);
|
|
996
|
-
dataLength = data.length;
|
|
997
|
-
}
|
|
998
|
-
else {
|
|
999
|
-
dataLength = data.length;
|
|
1000
|
-
merge = options.mask && options.readOnly && !skipMasking;
|
|
1001
|
-
}
|
|
1002
|
-
let payloadLength = dataLength;
|
|
1003
|
-
if (dataLength >= 65536) {
|
|
1004
|
-
offset += 8;
|
|
1005
|
-
payloadLength = 127;
|
|
1006
|
-
} else if (dataLength > 125) {
|
|
1007
|
-
offset += 2;
|
|
1008
|
-
payloadLength = 126;
|
|
1009
|
-
}
|
|
1010
|
-
const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset);
|
|
1011
|
-
target[0] = options.fin ? options.opcode | 128 : options.opcode;
|
|
1012
|
-
if (options.rsv1) target[0] |= 64;
|
|
1013
|
-
target[1] = payloadLength;
|
|
1014
|
-
if (payloadLength === 126) target.writeUInt16BE(dataLength, 2);
|
|
1015
|
-
else if (payloadLength === 127) {
|
|
1016
|
-
target[2] = target[3] = 0;
|
|
1017
|
-
target.writeUIntBE(dataLength, 4, 6);
|
|
1018
|
-
}
|
|
1019
|
-
if (!options.mask) return [target, data];
|
|
1020
|
-
target[1] |= 128;
|
|
1021
|
-
target[offset - 4] = mask[0];
|
|
1022
|
-
target[offset - 3] = mask[1];
|
|
1023
|
-
target[offset - 2] = mask[2];
|
|
1024
|
-
target[offset - 1] = mask[3];
|
|
1025
|
-
if (skipMasking) return [target, data];
|
|
1026
|
-
if (merge) {
|
|
1027
|
-
applyMask(data, mask, target, offset, dataLength);
|
|
1028
|
-
return [target];
|
|
1029
|
-
}
|
|
1030
|
-
applyMask(data, mask, data, 0, dataLength);
|
|
1031
|
-
return [target, data];
|
|
1032
|
-
}
|
|
1033
|
-
close(code, data, mask, cb) {
|
|
1034
|
-
let buf;
|
|
1035
|
-
if (code === void 0) buf = EMPTY_BUFFER;
|
|
1036
|
-
else if (typeof code !== "number" || !isValidStatusCode(code)) throw new TypeError("First argument must be a valid error code number");
|
|
1037
|
-
else if (data === void 0 || !data.length) {
|
|
1038
|
-
buf = Buffer.allocUnsafe(2);
|
|
1039
|
-
buf.writeUInt16BE(code, 0);
|
|
1040
|
-
} else {
|
|
1041
|
-
const length = Buffer.byteLength(data);
|
|
1042
|
-
if (length > 123) throw new RangeError("The message must not be greater than 123 bytes");
|
|
1043
|
-
buf = Buffer.allocUnsafe(2 + length);
|
|
1044
|
-
buf.writeUInt16BE(code, 0);
|
|
1045
|
-
if (typeof data === "string") buf.write(data, 2);
|
|
1046
|
-
else buf.set(data, 2);
|
|
1047
|
-
}
|
|
1048
|
-
const options = {
|
|
1049
|
-
[kByteLength]: buf.length,
|
|
1050
|
-
fin: true,
|
|
1051
|
-
generateMask: this._generateMask,
|
|
1052
|
-
mask,
|
|
1053
|
-
maskBuffer: this._maskBuffer,
|
|
1054
|
-
opcode: 8,
|
|
1055
|
-
readOnly: false,
|
|
1056
|
-
rsv1: false
|
|
1057
|
-
};
|
|
1058
|
-
if (this._state !== DEFAULT) this.enqueue([
|
|
1059
|
-
this.dispatch,
|
|
1060
|
-
buf,
|
|
1061
|
-
false,
|
|
1062
|
-
options,
|
|
1063
|
-
cb
|
|
1064
|
-
]);
|
|
1065
|
-
else this.sendFrame(Sender.frame(buf, options), cb);
|
|
1066
|
-
}
|
|
1067
|
-
ping(data, mask, cb) {
|
|
1068
|
-
let byteLength;
|
|
1069
|
-
let readOnly;
|
|
1070
|
-
if (typeof data === "string") {
|
|
1071
|
-
byteLength = Buffer.byteLength(data);
|
|
1072
|
-
readOnly = false;
|
|
1073
|
-
} else if (isBlob(data)) {
|
|
1074
|
-
byteLength = data.size;
|
|
1075
|
-
readOnly = false;
|
|
1076
|
-
} else {
|
|
1077
|
-
data = toBuffer(data);
|
|
1078
|
-
byteLength = data.length;
|
|
1079
|
-
readOnly = toBuffer.readOnly;
|
|
1080
|
-
}
|
|
1081
|
-
if (byteLength > 125) throw new RangeError("The data size must not be greater than 125 bytes");
|
|
1082
|
-
const options = {
|
|
1083
|
-
[kByteLength]: byteLength,
|
|
1084
|
-
fin: true,
|
|
1085
|
-
generateMask: this._generateMask,
|
|
1086
|
-
mask,
|
|
1087
|
-
maskBuffer: this._maskBuffer,
|
|
1088
|
-
opcode: 9,
|
|
1089
|
-
readOnly,
|
|
1090
|
-
rsv1: false
|
|
1091
|
-
};
|
|
1092
|
-
if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
|
|
1093
|
-
this.getBlobData,
|
|
1094
|
-
data,
|
|
1095
|
-
false,
|
|
1096
|
-
options,
|
|
1097
|
-
cb
|
|
1098
|
-
]);
|
|
1099
|
-
else this.getBlobData(data, false, options, cb);
|
|
1100
|
-
else if (this._state !== DEFAULT) this.enqueue([
|
|
1101
|
-
this.dispatch,
|
|
1102
|
-
data,
|
|
1103
|
-
false,
|
|
1104
|
-
options,
|
|
1105
|
-
cb
|
|
1106
|
-
]);
|
|
1107
|
-
else this.sendFrame(Sender.frame(data, options), cb);
|
|
1108
|
-
}
|
|
1109
|
-
pong(data, mask, cb) {
|
|
1110
|
-
let byteLength;
|
|
1111
|
-
let readOnly;
|
|
1112
|
-
if (typeof data === "string") {
|
|
1113
|
-
byteLength = Buffer.byteLength(data);
|
|
1114
|
-
readOnly = false;
|
|
1115
|
-
} else if (isBlob(data)) {
|
|
1116
|
-
byteLength = data.size;
|
|
1117
|
-
readOnly = false;
|
|
1118
|
-
} else {
|
|
1119
|
-
data = toBuffer(data);
|
|
1120
|
-
byteLength = data.length;
|
|
1121
|
-
readOnly = toBuffer.readOnly;
|
|
1122
|
-
}
|
|
1123
|
-
if (byteLength > 125) throw new RangeError("The data size must not be greater than 125 bytes");
|
|
1124
|
-
const options = {
|
|
1125
|
-
[kByteLength]: byteLength,
|
|
1126
|
-
fin: true,
|
|
1127
|
-
generateMask: this._generateMask,
|
|
1128
|
-
mask,
|
|
1129
|
-
maskBuffer: this._maskBuffer,
|
|
1130
|
-
opcode: 10,
|
|
1131
|
-
readOnly,
|
|
1132
|
-
rsv1: false
|
|
1133
|
-
};
|
|
1134
|
-
if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
|
|
1135
|
-
this.getBlobData,
|
|
1136
|
-
data,
|
|
1137
|
-
false,
|
|
1138
|
-
options,
|
|
1139
|
-
cb
|
|
1140
|
-
]);
|
|
1141
|
-
else this.getBlobData(data, false, options, cb);
|
|
1142
|
-
else if (this._state !== DEFAULT) this.enqueue([
|
|
1143
|
-
this.dispatch,
|
|
1144
|
-
data,
|
|
1145
|
-
false,
|
|
1146
|
-
options,
|
|
1147
|
-
cb
|
|
1148
|
-
]);
|
|
1149
|
-
else this.sendFrame(Sender.frame(data, options), cb);
|
|
1150
|
-
}
|
|
1151
|
-
send(data, options, cb) {
|
|
1152
|
-
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
1153
|
-
let opcode = options.binary ? 2 : 1;
|
|
1154
|
-
let rsv1 = options.compress;
|
|
1155
|
-
let byteLength;
|
|
1156
|
-
let readOnly;
|
|
1157
|
-
if (typeof data === "string") {
|
|
1158
|
-
byteLength = Buffer.byteLength(data);
|
|
1159
|
-
readOnly = false;
|
|
1160
|
-
} else if (isBlob(data)) {
|
|
1161
|
-
byteLength = data.size;
|
|
1162
|
-
readOnly = false;
|
|
1163
|
-
} else {
|
|
1164
|
-
data = toBuffer(data);
|
|
1165
|
-
byteLength = data.length;
|
|
1166
|
-
readOnly = toBuffer.readOnly;
|
|
1167
|
-
}
|
|
1168
|
-
if (this._firstFragment) {
|
|
1169
|
-
this._firstFragment = false;
|
|
1170
|
-
if (rsv1 && perMessageDeflate && perMessageDeflate.params[perMessageDeflate._isServer ? "server_no_context_takeover" : "client_no_context_takeover"]) rsv1 = byteLength >= perMessageDeflate._threshold;
|
|
1171
|
-
this._compress = rsv1;
|
|
1172
|
-
} else {
|
|
1173
|
-
rsv1 = false;
|
|
1174
|
-
opcode = 0;
|
|
1175
|
-
}
|
|
1176
|
-
if (options.fin) this._firstFragment = true;
|
|
1177
|
-
const opts = {
|
|
1178
|
-
[kByteLength]: byteLength,
|
|
1179
|
-
fin: options.fin,
|
|
1180
|
-
generateMask: this._generateMask,
|
|
1181
|
-
mask: options.mask,
|
|
1182
|
-
maskBuffer: this._maskBuffer,
|
|
1183
|
-
opcode,
|
|
1184
|
-
readOnly,
|
|
1185
|
-
rsv1
|
|
1186
|
-
};
|
|
1187
|
-
if (isBlob(data)) if (this._state !== DEFAULT) this.enqueue([
|
|
1188
|
-
this.getBlobData,
|
|
1189
|
-
data,
|
|
1190
|
-
this._compress,
|
|
1191
|
-
opts,
|
|
1192
|
-
cb
|
|
1193
|
-
]);
|
|
1194
|
-
else this.getBlobData(data, this._compress, opts, cb);
|
|
1195
|
-
else if (this._state !== DEFAULT) this.enqueue([
|
|
1196
|
-
this.dispatch,
|
|
1197
|
-
data,
|
|
1198
|
-
this._compress,
|
|
1199
|
-
opts,
|
|
1200
|
-
cb
|
|
1201
|
-
]);
|
|
1202
|
-
else this.dispatch(data, this._compress, opts, cb);
|
|
1203
|
-
}
|
|
1204
|
-
getBlobData(blob, compress, options, cb) {
|
|
1205
|
-
this._bufferedBytes += options[kByteLength];
|
|
1206
|
-
this._state = GET_BLOB_DATA;
|
|
1207
|
-
blob.arrayBuffer().then((arrayBuffer) => {
|
|
1208
|
-
if (this._socket.destroyed) {
|
|
1209
|
-
const err = /* @__PURE__ */ new Error("The socket was closed while the blob was being read");
|
|
1210
|
-
process.nextTick(callCallbacks, this, err, cb);
|
|
1211
|
-
return;
|
|
1212
|
-
}
|
|
1213
|
-
this._bufferedBytes -= options[kByteLength];
|
|
1214
|
-
const data = toBuffer(arrayBuffer);
|
|
1215
|
-
if (!compress) {
|
|
1216
|
-
this._state = DEFAULT;
|
|
1217
|
-
this.sendFrame(Sender.frame(data, options), cb);
|
|
1218
|
-
this.dequeue();
|
|
1219
|
-
} else this.dispatch(data, compress, options, cb);
|
|
1220
|
-
}).catch((err) => {
|
|
1221
|
-
process.nextTick(onError, this, err, cb);
|
|
1222
|
-
});
|
|
1223
|
-
}
|
|
1224
|
-
dispatch(data, compress, options, cb) {
|
|
1225
|
-
if (!compress) {
|
|
1226
|
-
this.sendFrame(Sender.frame(data, options), cb);
|
|
1227
|
-
return;
|
|
1228
|
-
}
|
|
1229
|
-
const perMessageDeflate = this._extensions[PerMessageDeflate.extensionName];
|
|
1230
|
-
this._bufferedBytes += options[kByteLength];
|
|
1231
|
-
this._state = DEFLATING;
|
|
1232
|
-
perMessageDeflate.compress(data, options.fin, (_, buf) => {
|
|
1233
|
-
if (this._socket.destroyed) {
|
|
1234
|
-
callCallbacks(this, /* @__PURE__ */ new Error("The socket was closed while data was being compressed"), cb);
|
|
1235
|
-
return;
|
|
1236
|
-
}
|
|
1237
|
-
this._bufferedBytes -= options[kByteLength];
|
|
1238
|
-
this._state = DEFAULT;
|
|
1239
|
-
options.readOnly = false;
|
|
1240
|
-
this.sendFrame(Sender.frame(buf, options), cb);
|
|
1241
|
-
this.dequeue();
|
|
1242
|
-
});
|
|
1243
|
-
}
|
|
1244
|
-
dequeue() {
|
|
1245
|
-
while (this._state === DEFAULT && this._queue.length) {
|
|
1246
|
-
const params = this._queue.shift();
|
|
1247
|
-
this._bufferedBytes -= params[3][kByteLength];
|
|
1248
|
-
Reflect.apply(params[0], this, params.slice(1));
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
enqueue(params) {
|
|
1252
|
-
this._bufferedBytes += params[3][kByteLength];
|
|
1253
|
-
this._queue.push(params);
|
|
1254
|
-
}
|
|
1255
|
-
sendFrame(list, cb) {
|
|
1256
|
-
if (list.length === 2) {
|
|
1257
|
-
this._socket.cork();
|
|
1258
|
-
this._socket.write(list[0]);
|
|
1259
|
-
this._socket.write(list[1], cb);
|
|
1260
|
-
this._socket.uncork();
|
|
1261
|
-
} else this._socket.write(list[0], cb);
|
|
1262
|
-
}
|
|
1263
|
-
};
|
|
1264
|
-
function callCallbacks(sender, err, cb) {
|
|
1265
|
-
if (typeof cb === "function") cb(err);
|
|
1266
|
-
for (let i = 0; i < sender._queue.length; i++) {
|
|
1267
|
-
const params = sender._queue[i];
|
|
1268
|
-
const callback = params[params.length - 1];
|
|
1269
|
-
if (typeof callback === "function") callback(err);
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
function onError(sender, err, cb) {
|
|
1273
|
-
callCallbacks(sender, err, cb);
|
|
1274
|
-
sender.onerror(err);
|
|
1275
|
-
}
|
|
1276
|
-
}));
|
|
1277
|
-
var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1278
|
-
const { kForOnEventAttribute, kListener } = require_constants();
|
|
1279
|
-
const kCode = Symbol("kCode");
|
|
1280
|
-
const kData = Symbol("kData");
|
|
1281
|
-
const kError = Symbol("kError");
|
|
1282
|
-
const kMessage = Symbol("kMessage");
|
|
1283
|
-
const kReason = Symbol("kReason");
|
|
1284
|
-
const kTarget = Symbol("kTarget");
|
|
1285
|
-
const kType = Symbol("kType");
|
|
1286
|
-
const kWasClean = Symbol("kWasClean");
|
|
1287
|
-
var Event = class {
|
|
1288
|
-
constructor(type) {
|
|
1289
|
-
this[kTarget] = null;
|
|
1290
|
-
this[kType] = type;
|
|
1291
|
-
}
|
|
1292
|
-
get target() {
|
|
1293
|
-
return this[kTarget];
|
|
1294
|
-
}
|
|
1295
|
-
get type() {
|
|
1296
|
-
return this[kType];
|
|
1297
|
-
}
|
|
1298
|
-
};
|
|
1299
|
-
Object.defineProperty(Event.prototype, "target", { enumerable: true });
|
|
1300
|
-
Object.defineProperty(Event.prototype, "type", { enumerable: true });
|
|
1301
|
-
var CloseEvent = class extends Event {
|
|
1302
|
-
constructor(type, options = {}) {
|
|
1303
|
-
super(type);
|
|
1304
|
-
this[kCode] = options.code === void 0 ? 0 : options.code;
|
|
1305
|
-
this[kReason] = options.reason === void 0 ? "" : options.reason;
|
|
1306
|
-
this[kWasClean] = options.wasClean === void 0 ? false : options.wasClean;
|
|
1307
|
-
}
|
|
1308
|
-
get code() {
|
|
1309
|
-
return this[kCode];
|
|
1310
|
-
}
|
|
1311
|
-
get reason() {
|
|
1312
|
-
return this[kReason];
|
|
1313
|
-
}
|
|
1314
|
-
get wasClean() {
|
|
1315
|
-
return this[kWasClean];
|
|
1316
|
-
}
|
|
1317
|
-
};
|
|
1318
|
-
Object.defineProperty(CloseEvent.prototype, "code", { enumerable: true });
|
|
1319
|
-
Object.defineProperty(CloseEvent.prototype, "reason", { enumerable: true });
|
|
1320
|
-
Object.defineProperty(CloseEvent.prototype, "wasClean", { enumerable: true });
|
|
1321
|
-
var ErrorEvent = class extends Event {
|
|
1322
|
-
constructor(type, options = {}) {
|
|
1323
|
-
super(type);
|
|
1324
|
-
this[kError] = options.error === void 0 ? null : options.error;
|
|
1325
|
-
this[kMessage] = options.message === void 0 ? "" : options.message;
|
|
1326
|
-
}
|
|
1327
|
-
get error() {
|
|
1328
|
-
return this[kError];
|
|
1329
|
-
}
|
|
1330
|
-
get message() {
|
|
1331
|
-
return this[kMessage];
|
|
1332
|
-
}
|
|
1333
|
-
};
|
|
1334
|
-
Object.defineProperty(ErrorEvent.prototype, "error", { enumerable: true });
|
|
1335
|
-
Object.defineProperty(ErrorEvent.prototype, "message", { enumerable: true });
|
|
1336
|
-
var MessageEvent = class extends Event {
|
|
1337
|
-
constructor(type, options = {}) {
|
|
1338
|
-
super(type);
|
|
1339
|
-
this[kData] = options.data === void 0 ? null : options.data;
|
|
1340
|
-
}
|
|
1341
|
-
get data() {
|
|
1342
|
-
return this[kData];
|
|
1343
|
-
}
|
|
1344
|
-
};
|
|
1345
|
-
Object.defineProperty(MessageEvent.prototype, "data", { enumerable: true });
|
|
1346
|
-
module.exports = {
|
|
1347
|
-
CloseEvent,
|
|
1348
|
-
ErrorEvent,
|
|
1349
|
-
Event,
|
|
1350
|
-
EventTarget: {
|
|
1351
|
-
addEventListener(type, handler, options = {}) {
|
|
1352
|
-
for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute] && listener[kListener] === handler && !listener[kForOnEventAttribute]) return;
|
|
1353
|
-
let wrapper;
|
|
1354
|
-
if (type === "message") wrapper = function onMessage(data, isBinary) {
|
|
1355
|
-
const event = new MessageEvent("message", { data: isBinary ? data : data.toString() });
|
|
1356
|
-
event[kTarget] = this;
|
|
1357
|
-
callListener(handler, this, event);
|
|
1358
|
-
};
|
|
1359
|
-
else if (type === "close") wrapper = function onClose(code, message) {
|
|
1360
|
-
const event = new CloseEvent("close", {
|
|
1361
|
-
code,
|
|
1362
|
-
reason: message.toString(),
|
|
1363
|
-
wasClean: this._closeFrameReceived && this._closeFrameSent
|
|
1364
|
-
});
|
|
1365
|
-
event[kTarget] = this;
|
|
1366
|
-
callListener(handler, this, event);
|
|
1367
|
-
};
|
|
1368
|
-
else if (type === "error") wrapper = function onError(error) {
|
|
1369
|
-
const event = new ErrorEvent("error", {
|
|
1370
|
-
error,
|
|
1371
|
-
message: error.message
|
|
1372
|
-
});
|
|
1373
|
-
event[kTarget] = this;
|
|
1374
|
-
callListener(handler, this, event);
|
|
1375
|
-
};
|
|
1376
|
-
else if (type === "open") wrapper = function onOpen() {
|
|
1377
|
-
const event = new Event("open");
|
|
1378
|
-
event[kTarget] = this;
|
|
1379
|
-
callListener(handler, this, event);
|
|
1380
|
-
};
|
|
1381
|
-
else return;
|
|
1382
|
-
wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
|
|
1383
|
-
wrapper[kListener] = handler;
|
|
1384
|
-
if (options.once) this.once(type, wrapper);
|
|
1385
|
-
else this.on(type, wrapper);
|
|
1386
|
-
},
|
|
1387
|
-
removeEventListener(type, handler) {
|
|
1388
|
-
for (const listener of this.listeners(type)) if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
|
|
1389
|
-
this.removeListener(type, listener);
|
|
1390
|
-
break;
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
},
|
|
1394
|
-
MessageEvent
|
|
1395
|
-
};
|
|
1396
|
-
function callListener(listener, thisArg, event) {
|
|
1397
|
-
if (typeof listener === "object" && listener.handleEvent) listener.handleEvent.call(listener, event);
|
|
1398
|
-
else listener.call(thisArg, event);
|
|
1399
|
-
}
|
|
1400
|
-
}));
|
|
1401
|
-
var require_extension = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1402
|
-
const { tokenChars } = require_validation();
|
|
1403
|
-
function push(dest, name, elem) {
|
|
1404
|
-
if (dest[name] === void 0) dest[name] = [elem];
|
|
1405
|
-
else dest[name].push(elem);
|
|
1406
|
-
}
|
|
1407
|
-
function parse(header) {
|
|
1408
|
-
const offers = Object.create(null);
|
|
1409
|
-
let params = Object.create(null);
|
|
1410
|
-
let mustUnescape = false;
|
|
1411
|
-
let isEscaping = false;
|
|
1412
|
-
let inQuotes = false;
|
|
1413
|
-
let extensionName;
|
|
1414
|
-
let paramName;
|
|
1415
|
-
let start = -1;
|
|
1416
|
-
let code = -1;
|
|
1417
|
-
let end = -1;
|
|
1418
|
-
let i = 0;
|
|
1419
|
-
for (; i < header.length; i++) {
|
|
1420
|
-
code = header.charCodeAt(i);
|
|
1421
|
-
if (extensionName === void 0) if (end === -1 && tokenChars[code] === 1) {
|
|
1422
|
-
if (start === -1) start = i;
|
|
1423
|
-
} else if (i !== 0 && (code === 32 || code === 9)) {
|
|
1424
|
-
if (end === -1 && start !== -1) end = i;
|
|
1425
|
-
} else if (code === 59 || code === 44) {
|
|
1426
|
-
if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1427
|
-
if (end === -1) end = i;
|
|
1428
|
-
const name = header.slice(start, end);
|
|
1429
|
-
if (code === 44) {
|
|
1430
|
-
push(offers, name, params);
|
|
1431
|
-
params = Object.create(null);
|
|
1432
|
-
} else extensionName = name;
|
|
1433
|
-
start = end = -1;
|
|
1434
|
-
} else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1435
|
-
else if (paramName === void 0) if (end === -1 && tokenChars[code] === 1) {
|
|
1436
|
-
if (start === -1) start = i;
|
|
1437
|
-
} else if (code === 32 || code === 9) {
|
|
1438
|
-
if (end === -1 && start !== -1) end = i;
|
|
1439
|
-
} else if (code === 59 || code === 44) {
|
|
1440
|
-
if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1441
|
-
if (end === -1) end = i;
|
|
1442
|
-
push(params, header.slice(start, end), true);
|
|
1443
|
-
if (code === 44) {
|
|
1444
|
-
push(offers, extensionName, params);
|
|
1445
|
-
params = Object.create(null);
|
|
1446
|
-
extensionName = void 0;
|
|
1447
|
-
}
|
|
1448
|
-
start = end = -1;
|
|
1449
|
-
} else if (code === 61 && start !== -1 && end === -1) {
|
|
1450
|
-
paramName = header.slice(start, i);
|
|
1451
|
-
start = end = -1;
|
|
1452
|
-
} else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1453
|
-
else if (isEscaping) {
|
|
1454
|
-
if (tokenChars[code] !== 1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1455
|
-
if (start === -1) start = i;
|
|
1456
|
-
else if (!mustUnescape) mustUnescape = true;
|
|
1457
|
-
isEscaping = false;
|
|
1458
|
-
} else if (inQuotes) if (tokenChars[code] === 1) {
|
|
1459
|
-
if (start === -1) start = i;
|
|
1460
|
-
} else if (code === 34 && start !== -1) {
|
|
1461
|
-
inQuotes = false;
|
|
1462
|
-
end = i;
|
|
1463
|
-
} else if (code === 92) isEscaping = true;
|
|
1464
|
-
else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1465
|
-
else if (code === 34 && header.charCodeAt(i - 1) === 61) inQuotes = true;
|
|
1466
|
-
else if (end === -1 && tokenChars[code] === 1) {
|
|
1467
|
-
if (start === -1) start = i;
|
|
1468
|
-
} else if (start !== -1 && (code === 32 || code === 9)) {
|
|
1469
|
-
if (end === -1) end = i;
|
|
1470
|
-
} else if (code === 59 || code === 44) {
|
|
1471
|
-
if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1472
|
-
if (end === -1) end = i;
|
|
1473
|
-
let value = header.slice(start, end);
|
|
1474
|
-
if (mustUnescape) {
|
|
1475
|
-
value = value.replace(/\\/g, "");
|
|
1476
|
-
mustUnescape = false;
|
|
1477
|
-
}
|
|
1478
|
-
push(params, paramName, value);
|
|
1479
|
-
if (code === 44) {
|
|
1480
|
-
push(offers, extensionName, params);
|
|
1481
|
-
params = Object.create(null);
|
|
1482
|
-
extensionName = void 0;
|
|
1483
|
-
}
|
|
1484
|
-
paramName = void 0;
|
|
1485
|
-
start = end = -1;
|
|
1486
|
-
} else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
1487
|
-
}
|
|
1488
|
-
if (start === -1 || inQuotes || code === 32 || code === 9) throw new SyntaxError("Unexpected end of input");
|
|
1489
|
-
if (end === -1) end = i;
|
|
1490
|
-
const token = header.slice(start, end);
|
|
1491
|
-
if (extensionName === void 0) push(offers, token, params);
|
|
1492
|
-
else {
|
|
1493
|
-
if (paramName === void 0) push(params, token, true);
|
|
1494
|
-
else if (mustUnescape) push(params, paramName, token.replace(/\\/g, ""));
|
|
1495
|
-
else push(params, paramName, token);
|
|
1496
|
-
push(offers, extensionName, params);
|
|
1497
|
-
}
|
|
1498
|
-
return offers;
|
|
1499
|
-
}
|
|
1500
|
-
function format(extensions) {
|
|
1501
|
-
return Object.keys(extensions).map((extension) => {
|
|
1502
|
-
let configurations = extensions[extension];
|
|
1503
|
-
if (!Array.isArray(configurations)) configurations = [configurations];
|
|
1504
|
-
return configurations.map((params) => {
|
|
1505
|
-
return [extension].concat(Object.keys(params).map((k) => {
|
|
1506
|
-
let values = params[k];
|
|
1507
|
-
if (!Array.isArray(values)) values = [values];
|
|
1508
|
-
return values.map((v) => v === true ? k : `${k}=${v}`).join("; ");
|
|
1509
|
-
})).join("; ");
|
|
1510
|
-
}).join(", ");
|
|
1511
|
-
}).join(", ");
|
|
1512
|
-
}
|
|
1513
|
-
module.exports = {
|
|
1514
|
-
format,
|
|
1515
|
-
parse
|
|
1516
|
-
};
|
|
1517
|
-
}));
|
|
1518
|
-
var require_websocket = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1519
|
-
const EventEmitter$1 = __require("events");
|
|
1520
|
-
const https = __require("https");
|
|
1521
|
-
const http$1 = __require("http");
|
|
1522
|
-
const net = __require("net");
|
|
1523
|
-
const tls = __require("tls");
|
|
1524
|
-
const { randomBytes, createHash: createHash$1 } = __require("crypto");
|
|
1525
|
-
const { Duplex: Duplex$2, Readable } = __require("stream");
|
|
1526
|
-
const { URL } = __require("url");
|
|
1527
|
-
const PerMessageDeflate = require_permessage_deflate();
|
|
1528
|
-
const Receiver = require_receiver();
|
|
1529
|
-
const Sender = require_sender();
|
|
1530
|
-
const { isBlob } = require_validation();
|
|
1531
|
-
const { BINARY_TYPES, CLOSE_TIMEOUT, EMPTY_BUFFER, GUID, kForOnEventAttribute, kListener, kStatusCode, kWebSocket, NOOP } = require_constants();
|
|
1532
|
-
const { EventTarget: { addEventListener, removeEventListener } } = require_event_target();
|
|
1533
|
-
const { format, parse } = require_extension();
|
|
1534
|
-
const { toBuffer } = require_buffer_util();
|
|
1535
|
-
const kAborted = Symbol("kAborted");
|
|
1536
|
-
const protocolVersions = [8, 13];
|
|
1537
|
-
const readyStates = [
|
|
1538
|
-
"CONNECTING",
|
|
1539
|
-
"OPEN",
|
|
1540
|
-
"CLOSING",
|
|
1541
|
-
"CLOSED"
|
|
1542
|
-
];
|
|
1543
|
-
const subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
|
|
1544
|
-
var WebSocket = class WebSocket extends EventEmitter$1 {
|
|
1545
|
-
constructor(address, protocols, options) {
|
|
1546
|
-
super();
|
|
1547
|
-
this._binaryType = BINARY_TYPES[0];
|
|
1548
|
-
this._closeCode = 1006;
|
|
1549
|
-
this._closeFrameReceived = false;
|
|
1550
|
-
this._closeFrameSent = false;
|
|
1551
|
-
this._closeMessage = EMPTY_BUFFER;
|
|
1552
|
-
this._closeTimer = null;
|
|
1553
|
-
this._errorEmitted = false;
|
|
1554
|
-
this._extensions = {};
|
|
1555
|
-
this._paused = false;
|
|
1556
|
-
this._protocol = "";
|
|
1557
|
-
this._readyState = WebSocket.CONNECTING;
|
|
1558
|
-
this._receiver = null;
|
|
1559
|
-
this._sender = null;
|
|
1560
|
-
this._socket = null;
|
|
1561
|
-
if (address !== null) {
|
|
1562
|
-
this._bufferedAmount = 0;
|
|
1563
|
-
this._isServer = false;
|
|
1564
|
-
this._redirects = 0;
|
|
1565
|
-
if (protocols === void 0) protocols = [];
|
|
1566
|
-
else if (!Array.isArray(protocols)) if (typeof protocols === "object" && protocols !== null) {
|
|
1567
|
-
options = protocols;
|
|
1568
|
-
protocols = [];
|
|
1569
|
-
} else protocols = [protocols];
|
|
1570
|
-
initAsClient(this, address, protocols, options);
|
|
1571
|
-
} else {
|
|
1572
|
-
this._autoPong = options.autoPong;
|
|
1573
|
-
this._closeTimeout = options.closeTimeout;
|
|
1574
|
-
this._isServer = true;
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
get binaryType() {
|
|
1578
|
-
return this._binaryType;
|
|
1579
|
-
}
|
|
1580
|
-
set binaryType(type) {
|
|
1581
|
-
if (!BINARY_TYPES.includes(type)) return;
|
|
1582
|
-
this._binaryType = type;
|
|
1583
|
-
if (this._receiver) this._receiver._binaryType = type;
|
|
1584
|
-
}
|
|
1585
|
-
get bufferedAmount() {
|
|
1586
|
-
if (!this._socket) return this._bufferedAmount;
|
|
1587
|
-
return this._socket._writableState.length + this._sender._bufferedBytes;
|
|
1588
|
-
}
|
|
1589
|
-
get extensions() {
|
|
1590
|
-
return Object.keys(this._extensions).join();
|
|
1591
|
-
}
|
|
1592
|
-
get isPaused() {
|
|
1593
|
-
return this._paused;
|
|
1594
|
-
}
|
|
1595
|
-
get onclose() {
|
|
1596
|
-
return null;
|
|
1597
|
-
}
|
|
1598
|
-
get onerror() {
|
|
1599
|
-
return null;
|
|
1600
|
-
}
|
|
1601
|
-
get onopen() {
|
|
1602
|
-
return null;
|
|
1603
|
-
}
|
|
1604
|
-
get onmessage() {
|
|
1605
|
-
return null;
|
|
1606
|
-
}
|
|
1607
|
-
get protocol() {
|
|
1608
|
-
return this._protocol;
|
|
1609
|
-
}
|
|
1610
|
-
get readyState() {
|
|
1611
|
-
return this._readyState;
|
|
1612
|
-
}
|
|
1613
|
-
get url() {
|
|
1614
|
-
return this._url;
|
|
1615
|
-
}
|
|
1616
|
-
setSocket(socket, head, options) {
|
|
1617
|
-
const receiver = new Receiver({
|
|
1618
|
-
allowSynchronousEvents: options.allowSynchronousEvents,
|
|
1619
|
-
binaryType: this.binaryType,
|
|
1620
|
-
extensions: this._extensions,
|
|
1621
|
-
isServer: this._isServer,
|
|
1622
|
-
maxPayload: options.maxPayload,
|
|
1623
|
-
skipUTF8Validation: options.skipUTF8Validation
|
|
1624
|
-
});
|
|
1625
|
-
const sender = new Sender(socket, this._extensions, options.generateMask);
|
|
1626
|
-
this._receiver = receiver;
|
|
1627
|
-
this._sender = sender;
|
|
1628
|
-
this._socket = socket;
|
|
1629
|
-
receiver[kWebSocket] = this;
|
|
1630
|
-
sender[kWebSocket] = this;
|
|
1631
|
-
socket[kWebSocket] = this;
|
|
1632
|
-
receiver.on("conclude", receiverOnConclude);
|
|
1633
|
-
receiver.on("drain", receiverOnDrain);
|
|
1634
|
-
receiver.on("error", receiverOnError);
|
|
1635
|
-
receiver.on("message", receiverOnMessage);
|
|
1636
|
-
receiver.on("ping", receiverOnPing);
|
|
1637
|
-
receiver.on("pong", receiverOnPong);
|
|
1638
|
-
sender.onerror = senderOnError;
|
|
1639
|
-
if (socket.setTimeout) socket.setTimeout(0);
|
|
1640
|
-
if (socket.setNoDelay) socket.setNoDelay();
|
|
1641
|
-
if (head.length > 0) socket.unshift(head);
|
|
1642
|
-
socket.on("close", socketOnClose);
|
|
1643
|
-
socket.on("data", socketOnData);
|
|
1644
|
-
socket.on("end", socketOnEnd);
|
|
1645
|
-
socket.on("error", socketOnError);
|
|
1646
|
-
this._readyState = WebSocket.OPEN;
|
|
1647
|
-
this.emit("open");
|
|
1648
|
-
}
|
|
1649
|
-
emitClose() {
|
|
1650
|
-
if (!this._socket) {
|
|
1651
|
-
this._readyState = WebSocket.CLOSED;
|
|
1652
|
-
this.emit("close", this._closeCode, this._closeMessage);
|
|
1653
|
-
return;
|
|
1654
|
-
}
|
|
1655
|
-
if (this._extensions[PerMessageDeflate.extensionName]) this._extensions[PerMessageDeflate.extensionName].cleanup();
|
|
1656
|
-
this._receiver.removeAllListeners();
|
|
1657
|
-
this._readyState = WebSocket.CLOSED;
|
|
1658
|
-
this.emit("close", this._closeCode, this._closeMessage);
|
|
1659
|
-
}
|
|
1660
|
-
close(code, data) {
|
|
1661
|
-
if (this.readyState === WebSocket.CLOSED) return;
|
|
1662
|
-
if (this.readyState === WebSocket.CONNECTING) {
|
|
1663
|
-
abortHandshake(this, this._req, "WebSocket was closed before the connection was established");
|
|
1664
|
-
return;
|
|
1665
|
-
}
|
|
1666
|
-
if (this.readyState === WebSocket.CLOSING) {
|
|
1667
|
-
if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
|
|
1668
|
-
return;
|
|
1669
|
-
}
|
|
1670
|
-
this._readyState = WebSocket.CLOSING;
|
|
1671
|
-
this._sender.close(code, data, !this._isServer, (err) => {
|
|
1672
|
-
if (err) return;
|
|
1673
|
-
this._closeFrameSent = true;
|
|
1674
|
-
if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) this._socket.end();
|
|
1675
|
-
});
|
|
1676
|
-
setCloseTimer(this);
|
|
1677
|
-
}
|
|
1678
|
-
pause() {
|
|
1679
|
-
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) return;
|
|
1680
|
-
this._paused = true;
|
|
1681
|
-
this._socket.pause();
|
|
1682
|
-
}
|
|
1683
|
-
ping(data, mask, cb) {
|
|
1684
|
-
if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
1685
|
-
if (typeof data === "function") {
|
|
1686
|
-
cb = data;
|
|
1687
|
-
data = mask = void 0;
|
|
1688
|
-
} else if (typeof mask === "function") {
|
|
1689
|
-
cb = mask;
|
|
1690
|
-
mask = void 0;
|
|
1691
|
-
}
|
|
1692
|
-
if (typeof data === "number") data = data.toString();
|
|
1693
|
-
if (this.readyState !== WebSocket.OPEN) {
|
|
1694
|
-
sendAfterClose(this, data, cb);
|
|
1695
|
-
return;
|
|
1696
|
-
}
|
|
1697
|
-
if (mask === void 0) mask = !this._isServer;
|
|
1698
|
-
this._sender.ping(data || EMPTY_BUFFER, mask, cb);
|
|
1699
|
-
}
|
|
1700
|
-
pong(data, mask, cb) {
|
|
1701
|
-
if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
1702
|
-
if (typeof data === "function") {
|
|
1703
|
-
cb = data;
|
|
1704
|
-
data = mask = void 0;
|
|
1705
|
-
} else if (typeof mask === "function") {
|
|
1706
|
-
cb = mask;
|
|
1707
|
-
mask = void 0;
|
|
1708
|
-
}
|
|
1709
|
-
if (typeof data === "number") data = data.toString();
|
|
1710
|
-
if (this.readyState !== WebSocket.OPEN) {
|
|
1711
|
-
sendAfterClose(this, data, cb);
|
|
1712
|
-
return;
|
|
1713
|
-
}
|
|
1714
|
-
if (mask === void 0) mask = !this._isServer;
|
|
1715
|
-
this._sender.pong(data || EMPTY_BUFFER, mask, cb);
|
|
1716
|
-
}
|
|
1717
|
-
resume() {
|
|
1718
|
-
if (this.readyState === WebSocket.CONNECTING || this.readyState === WebSocket.CLOSED) return;
|
|
1719
|
-
this._paused = false;
|
|
1720
|
-
if (!this._receiver._writableState.needDrain) this._socket.resume();
|
|
1721
|
-
}
|
|
1722
|
-
send(data, options, cb) {
|
|
1723
|
-
if (this.readyState === WebSocket.CONNECTING) throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
|
|
1724
|
-
if (typeof options === "function") {
|
|
1725
|
-
cb = options;
|
|
1726
|
-
options = {};
|
|
1727
|
-
}
|
|
1728
|
-
if (typeof data === "number") data = data.toString();
|
|
1729
|
-
if (this.readyState !== WebSocket.OPEN) {
|
|
1730
|
-
sendAfterClose(this, data, cb);
|
|
1731
|
-
return;
|
|
1732
|
-
}
|
|
1733
|
-
const opts = {
|
|
1734
|
-
binary: typeof data !== "string",
|
|
1735
|
-
mask: !this._isServer,
|
|
1736
|
-
compress: true,
|
|
1737
|
-
fin: true,
|
|
1738
|
-
...options
|
|
1739
|
-
};
|
|
1740
|
-
if (!this._extensions[PerMessageDeflate.extensionName]) opts.compress = false;
|
|
1741
|
-
this._sender.send(data || EMPTY_BUFFER, opts, cb);
|
|
1742
|
-
}
|
|
1743
|
-
terminate() {
|
|
1744
|
-
if (this.readyState === WebSocket.CLOSED) return;
|
|
1745
|
-
if (this.readyState === WebSocket.CONNECTING) {
|
|
1746
|
-
abortHandshake(this, this._req, "WebSocket was closed before the connection was established");
|
|
1747
|
-
return;
|
|
1748
|
-
}
|
|
1749
|
-
if (this._socket) {
|
|
1750
|
-
this._readyState = WebSocket.CLOSING;
|
|
1751
|
-
this._socket.destroy();
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
};
|
|
1755
|
-
Object.defineProperty(WebSocket, "CONNECTING", {
|
|
1756
|
-
enumerable: true,
|
|
1757
|
-
value: readyStates.indexOf("CONNECTING")
|
|
1758
|
-
});
|
|
1759
|
-
Object.defineProperty(WebSocket.prototype, "CONNECTING", {
|
|
1760
|
-
enumerable: true,
|
|
1761
|
-
value: readyStates.indexOf("CONNECTING")
|
|
1762
|
-
});
|
|
1763
|
-
Object.defineProperty(WebSocket, "OPEN", {
|
|
1764
|
-
enumerable: true,
|
|
1765
|
-
value: readyStates.indexOf("OPEN")
|
|
1766
|
-
});
|
|
1767
|
-
Object.defineProperty(WebSocket.prototype, "OPEN", {
|
|
1768
|
-
enumerable: true,
|
|
1769
|
-
value: readyStates.indexOf("OPEN")
|
|
1770
|
-
});
|
|
1771
|
-
Object.defineProperty(WebSocket, "CLOSING", {
|
|
1772
|
-
enumerable: true,
|
|
1773
|
-
value: readyStates.indexOf("CLOSING")
|
|
1774
|
-
});
|
|
1775
|
-
Object.defineProperty(WebSocket.prototype, "CLOSING", {
|
|
1776
|
-
enumerable: true,
|
|
1777
|
-
value: readyStates.indexOf("CLOSING")
|
|
1778
|
-
});
|
|
1779
|
-
Object.defineProperty(WebSocket, "CLOSED", {
|
|
1780
|
-
enumerable: true,
|
|
1781
|
-
value: readyStates.indexOf("CLOSED")
|
|
1782
|
-
});
|
|
1783
|
-
Object.defineProperty(WebSocket.prototype, "CLOSED", {
|
|
1784
|
-
enumerable: true,
|
|
1785
|
-
value: readyStates.indexOf("CLOSED")
|
|
1786
|
-
});
|
|
1787
|
-
[
|
|
1788
|
-
"binaryType",
|
|
1789
|
-
"bufferedAmount",
|
|
1790
|
-
"extensions",
|
|
1791
|
-
"isPaused",
|
|
1792
|
-
"protocol",
|
|
1793
|
-
"readyState",
|
|
1794
|
-
"url"
|
|
1795
|
-
].forEach((property) => {
|
|
1796
|
-
Object.defineProperty(WebSocket.prototype, property, { enumerable: true });
|
|
1797
|
-
});
|
|
1798
|
-
[
|
|
1799
|
-
"open",
|
|
1800
|
-
"error",
|
|
1801
|
-
"close",
|
|
1802
|
-
"message"
|
|
1803
|
-
].forEach((method) => {
|
|
1804
|
-
Object.defineProperty(WebSocket.prototype, `on${method}`, {
|
|
1805
|
-
enumerable: true,
|
|
1806
|
-
get() {
|
|
1807
|
-
for (const listener of this.listeners(method)) if (listener[kForOnEventAttribute]) return listener[kListener];
|
|
1808
|
-
return null;
|
|
1809
|
-
},
|
|
1810
|
-
set(handler) {
|
|
1811
|
-
for (const listener of this.listeners(method)) if (listener[kForOnEventAttribute]) {
|
|
1812
|
-
this.removeListener(method, listener);
|
|
1813
|
-
break;
|
|
1814
|
-
}
|
|
1815
|
-
if (typeof handler !== "function") return;
|
|
1816
|
-
this.addEventListener(method, handler, { [kForOnEventAttribute]: true });
|
|
1817
|
-
}
|
|
1818
|
-
});
|
|
1819
|
-
});
|
|
1820
|
-
WebSocket.prototype.addEventListener = addEventListener;
|
|
1821
|
-
WebSocket.prototype.removeEventListener = removeEventListener;
|
|
1822
|
-
module.exports = WebSocket;
|
|
1823
|
-
function initAsClient(websocket, address, protocols, options) {
|
|
1824
|
-
const opts = {
|
|
1825
|
-
allowSynchronousEvents: true,
|
|
1826
|
-
autoPong: true,
|
|
1827
|
-
closeTimeout: CLOSE_TIMEOUT,
|
|
1828
|
-
protocolVersion: protocolVersions[1],
|
|
1829
|
-
maxPayload: 100 * 1024 * 1024,
|
|
1830
|
-
skipUTF8Validation: false,
|
|
1831
|
-
perMessageDeflate: true,
|
|
1832
|
-
followRedirects: false,
|
|
1833
|
-
maxRedirects: 10,
|
|
1834
|
-
...options,
|
|
1835
|
-
socketPath: void 0,
|
|
1836
|
-
hostname: void 0,
|
|
1837
|
-
protocol: void 0,
|
|
1838
|
-
timeout: void 0,
|
|
1839
|
-
method: "GET",
|
|
1840
|
-
host: void 0,
|
|
1841
|
-
path: void 0,
|
|
1842
|
-
port: void 0
|
|
1843
|
-
};
|
|
1844
|
-
websocket._autoPong = opts.autoPong;
|
|
1845
|
-
websocket._closeTimeout = opts.closeTimeout;
|
|
1846
|
-
if (!protocolVersions.includes(opts.protocolVersion)) throw new RangeError(`Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`);
|
|
1847
|
-
let parsedUrl;
|
|
1848
|
-
if (address instanceof URL) parsedUrl = address;
|
|
1849
|
-
else try {
|
|
1850
|
-
parsedUrl = new URL(address);
|
|
1851
|
-
} catch {
|
|
1852
|
-
throw new SyntaxError(`Invalid URL: ${address}`);
|
|
1853
|
-
}
|
|
1854
|
-
if (parsedUrl.protocol === "http:") parsedUrl.protocol = "ws:";
|
|
1855
|
-
else if (parsedUrl.protocol === "https:") parsedUrl.protocol = "wss:";
|
|
1856
|
-
websocket._url = parsedUrl.href;
|
|
1857
|
-
const isSecure = parsedUrl.protocol === "wss:";
|
|
1858
|
-
const isIpcUrl = parsedUrl.protocol === "ws+unix:";
|
|
1859
|
-
let invalidUrlMessage;
|
|
1860
|
-
if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) invalidUrlMessage = "The URL's protocol must be one of \"ws:\", \"wss:\", \"http:\", \"https:\", or \"ws+unix:\"";
|
|
1861
|
-
else if (isIpcUrl && !parsedUrl.pathname) invalidUrlMessage = "The URL's pathname is empty";
|
|
1862
|
-
else if (parsedUrl.hash) invalidUrlMessage = "The URL contains a fragment identifier";
|
|
1863
|
-
if (invalidUrlMessage) {
|
|
1864
|
-
const err = new SyntaxError(invalidUrlMessage);
|
|
1865
|
-
if (websocket._redirects === 0) throw err;
|
|
1866
|
-
else {
|
|
1867
|
-
emitErrorAndClose(websocket, err);
|
|
1868
|
-
return;
|
|
1869
|
-
}
|
|
1870
|
-
}
|
|
1871
|
-
const defaultPort = isSecure ? 443 : 80;
|
|
1872
|
-
const key = randomBytes(16).toString("base64");
|
|
1873
|
-
const request = isSecure ? https.request : http$1.request;
|
|
1874
|
-
const protocolSet = /* @__PURE__ */ new Set();
|
|
1875
|
-
let perMessageDeflate;
|
|
1876
|
-
opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
|
|
1877
|
-
opts.defaultPort = opts.defaultPort || defaultPort;
|
|
1878
|
-
opts.port = parsedUrl.port || defaultPort;
|
|
1879
|
-
opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname;
|
|
1880
|
-
opts.headers = {
|
|
1881
|
-
...opts.headers,
|
|
1882
|
-
"Sec-WebSocket-Version": opts.protocolVersion,
|
|
1883
|
-
"Sec-WebSocket-Key": key,
|
|
1884
|
-
Connection: "Upgrade",
|
|
1885
|
-
Upgrade: "websocket"
|
|
1886
|
-
};
|
|
1887
|
-
opts.path = parsedUrl.pathname + parsedUrl.search;
|
|
1888
|
-
opts.timeout = opts.handshakeTimeout;
|
|
1889
|
-
if (opts.perMessageDeflate) {
|
|
1890
|
-
perMessageDeflate = new PerMessageDeflate({
|
|
1891
|
-
...opts.perMessageDeflate,
|
|
1892
|
-
isServer: false,
|
|
1893
|
-
maxPayload: opts.maxPayload
|
|
1894
|
-
});
|
|
1895
|
-
opts.headers["Sec-WebSocket-Extensions"] = format({ [PerMessageDeflate.extensionName]: perMessageDeflate.offer() });
|
|
1896
|
-
}
|
|
1897
|
-
if (protocols.length) {
|
|
1898
|
-
for (const protocol of protocols) {
|
|
1899
|
-
if (typeof protocol !== "string" || !subprotocolRegex.test(protocol) || protocolSet.has(protocol)) throw new SyntaxError("An invalid or duplicated subprotocol was specified");
|
|
1900
|
-
protocolSet.add(protocol);
|
|
1901
|
-
}
|
|
1902
|
-
opts.headers["Sec-WebSocket-Protocol"] = protocols.join(",");
|
|
1903
|
-
}
|
|
1904
|
-
if (opts.origin) if (opts.protocolVersion < 13) opts.headers["Sec-WebSocket-Origin"] = opts.origin;
|
|
1905
|
-
else opts.headers.Origin = opts.origin;
|
|
1906
|
-
if (parsedUrl.username || parsedUrl.password) opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
|
|
1907
|
-
if (isIpcUrl) {
|
|
1908
|
-
const parts = opts.path.split(":");
|
|
1909
|
-
opts.socketPath = parts[0];
|
|
1910
|
-
opts.path = parts[1];
|
|
1911
|
-
}
|
|
1912
|
-
let req;
|
|
1913
|
-
if (opts.followRedirects) {
|
|
1914
|
-
if (websocket._redirects === 0) {
|
|
1915
|
-
websocket._originalIpc = isIpcUrl;
|
|
1916
|
-
websocket._originalSecure = isSecure;
|
|
1917
|
-
websocket._originalHostOrSocketPath = isIpcUrl ? opts.socketPath : parsedUrl.host;
|
|
1918
|
-
const headers = options && options.headers;
|
|
1919
|
-
options = {
|
|
1920
|
-
...options,
|
|
1921
|
-
headers: {}
|
|
1922
|
-
};
|
|
1923
|
-
if (headers) for (const [key, value] of Object.entries(headers)) options.headers[key.toLowerCase()] = value;
|
|
1924
|
-
} else if (websocket.listenerCount("redirect") === 0) {
|
|
1925
|
-
const isSameHost = isIpcUrl ? websocket._originalIpc ? opts.socketPath === websocket._originalHostOrSocketPath : false : websocket._originalIpc ? false : parsedUrl.host === websocket._originalHostOrSocketPath;
|
|
1926
|
-
if (!isSameHost || websocket._originalSecure && !isSecure) {
|
|
1927
|
-
delete opts.headers.authorization;
|
|
1928
|
-
delete opts.headers.cookie;
|
|
1929
|
-
if (!isSameHost) delete opts.headers.host;
|
|
1930
|
-
opts.auth = void 0;
|
|
1931
|
-
}
|
|
1932
|
-
}
|
|
1933
|
-
if (opts.auth && !options.headers.authorization) options.headers.authorization = "Basic " + Buffer.from(opts.auth).toString("base64");
|
|
1934
|
-
req = websocket._req = request(opts);
|
|
1935
|
-
if (websocket._redirects) websocket.emit("redirect", websocket.url, req);
|
|
1936
|
-
} else req = websocket._req = request(opts);
|
|
1937
|
-
if (opts.timeout) req.on("timeout", () => {
|
|
1938
|
-
abortHandshake(websocket, req, "Opening handshake has timed out");
|
|
1939
|
-
});
|
|
1940
|
-
req.on("error", (err) => {
|
|
1941
|
-
if (req === null || req[kAborted]) return;
|
|
1942
|
-
req = websocket._req = null;
|
|
1943
|
-
emitErrorAndClose(websocket, err);
|
|
1944
|
-
});
|
|
1945
|
-
req.on("response", (res) => {
|
|
1946
|
-
const location = res.headers.location;
|
|
1947
|
-
const statusCode = res.statusCode;
|
|
1948
|
-
if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) {
|
|
1949
|
-
if (++websocket._redirects > opts.maxRedirects) {
|
|
1950
|
-
abortHandshake(websocket, req, "Maximum redirects exceeded");
|
|
1951
|
-
return;
|
|
1952
|
-
}
|
|
1953
|
-
req.abort();
|
|
1954
|
-
let addr;
|
|
1955
|
-
try {
|
|
1956
|
-
addr = new URL(location, address);
|
|
1957
|
-
} catch (e) {
|
|
1958
|
-
emitErrorAndClose(websocket, /* @__PURE__ */ new SyntaxError(`Invalid URL: ${location}`));
|
|
1959
|
-
return;
|
|
1960
|
-
}
|
|
1961
|
-
initAsClient(websocket, addr, protocols, options);
|
|
1962
|
-
} else if (!websocket.emit("unexpected-response", req, res)) abortHandshake(websocket, req, `Unexpected server response: ${res.statusCode}`);
|
|
1963
|
-
});
|
|
1964
|
-
req.on("upgrade", (res, socket, head) => {
|
|
1965
|
-
websocket.emit("upgrade", res);
|
|
1966
|
-
if (websocket.readyState !== WebSocket.CONNECTING) return;
|
|
1967
|
-
req = websocket._req = null;
|
|
1968
|
-
const upgrade = res.headers.upgrade;
|
|
1969
|
-
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
1970
|
-
abortHandshake(websocket, socket, "Invalid Upgrade header");
|
|
1971
|
-
return;
|
|
1972
|
-
}
|
|
1973
|
-
const digest = createHash$1("sha1").update(key + GUID).digest("base64");
|
|
1974
|
-
if (res.headers["sec-websocket-accept"] !== digest) {
|
|
1975
|
-
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
|
|
1976
|
-
return;
|
|
1977
|
-
}
|
|
1978
|
-
const serverProt = res.headers["sec-websocket-protocol"];
|
|
1979
|
-
let protError;
|
|
1980
|
-
if (serverProt !== void 0) {
|
|
1981
|
-
if (!protocolSet.size) protError = "Server sent a subprotocol but none was requested";
|
|
1982
|
-
else if (!protocolSet.has(serverProt)) protError = "Server sent an invalid subprotocol";
|
|
1983
|
-
} else if (protocolSet.size) protError = "Server sent no subprotocol";
|
|
1984
|
-
if (protError) {
|
|
1985
|
-
abortHandshake(websocket, socket, protError);
|
|
1986
|
-
return;
|
|
1987
|
-
}
|
|
1988
|
-
if (serverProt) websocket._protocol = serverProt;
|
|
1989
|
-
const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
|
|
1990
|
-
if (secWebSocketExtensions !== void 0) {
|
|
1991
|
-
if (!perMessageDeflate) {
|
|
1992
|
-
abortHandshake(websocket, socket, "Server sent a Sec-WebSocket-Extensions header but no extension was requested");
|
|
1993
|
-
return;
|
|
1994
|
-
}
|
|
1995
|
-
let extensions;
|
|
1996
|
-
try {
|
|
1997
|
-
extensions = parse(secWebSocketExtensions);
|
|
1998
|
-
} catch (err) {
|
|
1999
|
-
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
|
|
2000
|
-
return;
|
|
2001
|
-
}
|
|
2002
|
-
const extensionNames = Object.keys(extensions);
|
|
2003
|
-
if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate.extensionName) {
|
|
2004
|
-
abortHandshake(websocket, socket, "Server indicated an extension that was not requested");
|
|
2005
|
-
return;
|
|
2006
|
-
}
|
|
2007
|
-
try {
|
|
2008
|
-
perMessageDeflate.accept(extensions[PerMessageDeflate.extensionName]);
|
|
2009
|
-
} catch (err) {
|
|
2010
|
-
abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Extensions header");
|
|
2011
|
-
return;
|
|
2012
|
-
}
|
|
2013
|
-
websocket._extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
2014
|
-
}
|
|
2015
|
-
websocket.setSocket(socket, head, {
|
|
2016
|
-
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
2017
|
-
generateMask: opts.generateMask,
|
|
2018
|
-
maxPayload: opts.maxPayload,
|
|
2019
|
-
skipUTF8Validation: opts.skipUTF8Validation
|
|
2020
|
-
});
|
|
2021
|
-
});
|
|
2022
|
-
if (opts.finishRequest) opts.finishRequest(req, websocket);
|
|
2023
|
-
else req.end();
|
|
2024
|
-
}
|
|
2025
|
-
function emitErrorAndClose(websocket, err) {
|
|
2026
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
2027
|
-
websocket._errorEmitted = true;
|
|
2028
|
-
websocket.emit("error", err);
|
|
2029
|
-
websocket.emitClose();
|
|
2030
|
-
}
|
|
2031
|
-
function netConnect(options) {
|
|
2032
|
-
options.path = options.socketPath;
|
|
2033
|
-
return net.connect(options);
|
|
2034
|
-
}
|
|
2035
|
-
function tlsConnect(options) {
|
|
2036
|
-
options.path = void 0;
|
|
2037
|
-
if (!options.servername && options.servername !== "") options.servername = net.isIP(options.host) ? "" : options.host;
|
|
2038
|
-
return tls.connect(options);
|
|
2039
|
-
}
|
|
2040
|
-
function abortHandshake(websocket, stream, message) {
|
|
2041
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
2042
|
-
const err = new Error(message);
|
|
2043
|
-
Error.captureStackTrace(err, abortHandshake);
|
|
2044
|
-
if (stream.setHeader) {
|
|
2045
|
-
stream[kAborted] = true;
|
|
2046
|
-
stream.abort();
|
|
2047
|
-
if (stream.socket && !stream.socket.destroyed) stream.socket.destroy();
|
|
2048
|
-
process.nextTick(emitErrorAndClose, websocket, err);
|
|
2049
|
-
} else {
|
|
2050
|
-
stream.destroy(err);
|
|
2051
|
-
stream.once("error", websocket.emit.bind(websocket, "error"));
|
|
2052
|
-
stream.once("close", websocket.emitClose.bind(websocket));
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
function sendAfterClose(websocket, data, cb) {
|
|
2056
|
-
if (data) {
|
|
2057
|
-
const length = isBlob(data) ? data.size : toBuffer(data).length;
|
|
2058
|
-
if (websocket._socket) websocket._sender._bufferedBytes += length;
|
|
2059
|
-
else websocket._bufferedAmount += length;
|
|
2060
|
-
}
|
|
2061
|
-
if (cb) {
|
|
2062
|
-
const err = /* @__PURE__ */ new Error(`WebSocket is not open: readyState ${websocket.readyState} (${readyStates[websocket.readyState]})`);
|
|
2063
|
-
process.nextTick(cb, err);
|
|
2064
|
-
}
|
|
2065
|
-
}
|
|
2066
|
-
function receiverOnConclude(code, reason) {
|
|
2067
|
-
const websocket = this[kWebSocket];
|
|
2068
|
-
websocket._closeFrameReceived = true;
|
|
2069
|
-
websocket._closeMessage = reason;
|
|
2070
|
-
websocket._closeCode = code;
|
|
2071
|
-
if (websocket._socket[kWebSocket] === void 0) return;
|
|
2072
|
-
websocket._socket.removeListener("data", socketOnData);
|
|
2073
|
-
process.nextTick(resume, websocket._socket);
|
|
2074
|
-
if (code === 1005) websocket.close();
|
|
2075
|
-
else websocket.close(code, reason);
|
|
2076
|
-
}
|
|
2077
|
-
function receiverOnDrain() {
|
|
2078
|
-
const websocket = this[kWebSocket];
|
|
2079
|
-
if (!websocket.isPaused) websocket._socket.resume();
|
|
2080
|
-
}
|
|
2081
|
-
function receiverOnError(err) {
|
|
2082
|
-
const websocket = this[kWebSocket];
|
|
2083
|
-
if (websocket._socket[kWebSocket] !== void 0) {
|
|
2084
|
-
websocket._socket.removeListener("data", socketOnData);
|
|
2085
|
-
process.nextTick(resume, websocket._socket);
|
|
2086
|
-
websocket.close(err[kStatusCode]);
|
|
2087
|
-
}
|
|
2088
|
-
if (!websocket._errorEmitted) {
|
|
2089
|
-
websocket._errorEmitted = true;
|
|
2090
|
-
websocket.emit("error", err);
|
|
2091
|
-
}
|
|
2092
|
-
}
|
|
2093
|
-
function receiverOnFinish() {
|
|
2094
|
-
this[kWebSocket].emitClose();
|
|
2095
|
-
}
|
|
2096
|
-
function receiverOnMessage(data, isBinary) {
|
|
2097
|
-
this[kWebSocket].emit("message", data, isBinary);
|
|
2098
|
-
}
|
|
2099
|
-
function receiverOnPing(data) {
|
|
2100
|
-
const websocket = this[kWebSocket];
|
|
2101
|
-
if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
|
|
2102
|
-
websocket.emit("ping", data);
|
|
2103
|
-
}
|
|
2104
|
-
function receiverOnPong(data) {
|
|
2105
|
-
this[kWebSocket].emit("pong", data);
|
|
2106
|
-
}
|
|
2107
|
-
function resume(stream) {
|
|
2108
|
-
stream.resume();
|
|
2109
|
-
}
|
|
2110
|
-
function senderOnError(err) {
|
|
2111
|
-
const websocket = this[kWebSocket];
|
|
2112
|
-
if (websocket.readyState === WebSocket.CLOSED) return;
|
|
2113
|
-
if (websocket.readyState === WebSocket.OPEN) {
|
|
2114
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
2115
|
-
setCloseTimer(websocket);
|
|
2116
|
-
}
|
|
2117
|
-
this._socket.end();
|
|
2118
|
-
if (!websocket._errorEmitted) {
|
|
2119
|
-
websocket._errorEmitted = true;
|
|
2120
|
-
websocket.emit("error", err);
|
|
2121
|
-
}
|
|
2122
|
-
}
|
|
2123
|
-
function setCloseTimer(websocket) {
|
|
2124
|
-
websocket._closeTimer = setTimeout(websocket._socket.destroy.bind(websocket._socket), websocket._closeTimeout);
|
|
2125
|
-
}
|
|
2126
|
-
function socketOnClose() {
|
|
2127
|
-
const websocket = this[kWebSocket];
|
|
2128
|
-
this.removeListener("close", socketOnClose);
|
|
2129
|
-
this.removeListener("data", socketOnData);
|
|
2130
|
-
this.removeListener("end", socketOnEnd);
|
|
2131
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
2132
|
-
if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
|
|
2133
|
-
const chunk = this.read(this._readableState.length);
|
|
2134
|
-
websocket._receiver.write(chunk);
|
|
2135
|
-
}
|
|
2136
|
-
websocket._receiver.end();
|
|
2137
|
-
this[kWebSocket] = void 0;
|
|
2138
|
-
clearTimeout(websocket._closeTimer);
|
|
2139
|
-
if (websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted) websocket.emitClose();
|
|
2140
|
-
else {
|
|
2141
|
-
websocket._receiver.on("error", receiverOnFinish);
|
|
2142
|
-
websocket._receiver.on("finish", receiverOnFinish);
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
2145
|
-
function socketOnData(chunk) {
|
|
2146
|
-
if (!this[kWebSocket]._receiver.write(chunk)) this.pause();
|
|
2147
|
-
}
|
|
2148
|
-
function socketOnEnd() {
|
|
2149
|
-
const websocket = this[kWebSocket];
|
|
2150
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
2151
|
-
websocket._receiver.end();
|
|
2152
|
-
this.end();
|
|
2153
|
-
}
|
|
2154
|
-
function socketOnError() {
|
|
2155
|
-
const websocket = this[kWebSocket];
|
|
2156
|
-
this.removeListener("error", socketOnError);
|
|
2157
|
-
this.on("error", NOOP);
|
|
2158
|
-
if (websocket) {
|
|
2159
|
-
websocket._readyState = WebSocket.CLOSING;
|
|
2160
|
-
this.destroy();
|
|
2161
|
-
}
|
|
2162
|
-
}
|
|
2163
|
-
}));
|
|
2164
|
-
var require_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2165
|
-
require_websocket();
|
|
2166
|
-
const { Duplex: Duplex$1 } = __require("stream");
|
|
2167
|
-
function emitClose(stream) {
|
|
2168
|
-
stream.emit("close");
|
|
2169
|
-
}
|
|
2170
|
-
function duplexOnEnd() {
|
|
2171
|
-
if (!this.destroyed && this._writableState.finished) this.destroy();
|
|
2172
|
-
}
|
|
2173
|
-
function duplexOnError(err) {
|
|
2174
|
-
this.removeListener("error", duplexOnError);
|
|
2175
|
-
this.destroy();
|
|
2176
|
-
if (this.listenerCount("error") === 0) this.emit("error", err);
|
|
2177
|
-
}
|
|
2178
|
-
function createWebSocketStream(ws, options) {
|
|
2179
|
-
let terminateOnDestroy = true;
|
|
2180
|
-
const duplex = new Duplex$1({
|
|
2181
|
-
...options,
|
|
2182
|
-
autoDestroy: false,
|
|
2183
|
-
emitClose: false,
|
|
2184
|
-
objectMode: false,
|
|
2185
|
-
writableObjectMode: false
|
|
2186
|
-
});
|
|
2187
|
-
ws.on("message", function message(msg, isBinary) {
|
|
2188
|
-
const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
|
|
2189
|
-
if (!duplex.push(data)) ws.pause();
|
|
2190
|
-
});
|
|
2191
|
-
ws.once("error", function error(err) {
|
|
2192
|
-
if (duplex.destroyed) return;
|
|
2193
|
-
terminateOnDestroy = false;
|
|
2194
|
-
duplex.destroy(err);
|
|
2195
|
-
});
|
|
2196
|
-
ws.once("close", function close() {
|
|
2197
|
-
if (duplex.destroyed) return;
|
|
2198
|
-
duplex.push(null);
|
|
2199
|
-
});
|
|
2200
|
-
duplex._destroy = function(err, callback) {
|
|
2201
|
-
if (ws.readyState === ws.CLOSED) {
|
|
2202
|
-
callback(err);
|
|
2203
|
-
process.nextTick(emitClose, duplex);
|
|
2204
|
-
return;
|
|
2205
|
-
}
|
|
2206
|
-
let called = false;
|
|
2207
|
-
ws.once("error", function error(err) {
|
|
2208
|
-
called = true;
|
|
2209
|
-
callback(err);
|
|
2210
|
-
});
|
|
2211
|
-
ws.once("close", function close() {
|
|
2212
|
-
if (!called) callback(err);
|
|
2213
|
-
process.nextTick(emitClose, duplex);
|
|
2214
|
-
});
|
|
2215
|
-
if (terminateOnDestroy) ws.terminate();
|
|
2216
|
-
};
|
|
2217
|
-
duplex._final = function(callback) {
|
|
2218
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
2219
|
-
ws.once("open", function open() {
|
|
2220
|
-
duplex._final(callback);
|
|
2221
|
-
});
|
|
2222
|
-
return;
|
|
2223
|
-
}
|
|
2224
|
-
if (ws._socket === null) return;
|
|
2225
|
-
if (ws._socket._writableState.finished) {
|
|
2226
|
-
callback();
|
|
2227
|
-
if (duplex._readableState.endEmitted) duplex.destroy();
|
|
2228
|
-
} else {
|
|
2229
|
-
ws._socket.once("finish", function finish() {
|
|
2230
|
-
callback();
|
|
2231
|
-
});
|
|
2232
|
-
ws.close();
|
|
2233
|
-
}
|
|
2234
|
-
};
|
|
2235
|
-
duplex._read = function() {
|
|
2236
|
-
if (ws.isPaused) ws.resume();
|
|
2237
|
-
};
|
|
2238
|
-
duplex._write = function(chunk, encoding, callback) {
|
|
2239
|
-
if (ws.readyState === ws.CONNECTING) {
|
|
2240
|
-
ws.once("open", function open() {
|
|
2241
|
-
duplex._write(chunk, encoding, callback);
|
|
2242
|
-
});
|
|
2243
|
-
return;
|
|
2244
|
-
}
|
|
2245
|
-
ws.send(chunk, callback);
|
|
2246
|
-
};
|
|
2247
|
-
duplex.on("end", duplexOnEnd);
|
|
2248
|
-
duplex.on("error", duplexOnError);
|
|
2249
|
-
return duplex;
|
|
2250
|
-
}
|
|
2251
|
-
module.exports = createWebSocketStream;
|
|
2252
|
-
}));
|
|
2253
|
-
var require_subprotocol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2254
|
-
const { tokenChars } = require_validation();
|
|
2255
|
-
function parse(header) {
|
|
2256
|
-
const protocols = /* @__PURE__ */ new Set();
|
|
2257
|
-
let start = -1;
|
|
2258
|
-
let end = -1;
|
|
2259
|
-
let i = 0;
|
|
2260
|
-
for (; i < header.length; i++) {
|
|
2261
|
-
const code = header.charCodeAt(i);
|
|
2262
|
-
if (end === -1 && tokenChars[code] === 1) {
|
|
2263
|
-
if (start === -1) start = i;
|
|
2264
|
-
} else if (i !== 0 && (code === 32 || code === 9)) {
|
|
2265
|
-
if (end === -1 && start !== -1) end = i;
|
|
2266
|
-
} else if (code === 44) {
|
|
2267
|
-
if (start === -1) throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
2268
|
-
if (end === -1) end = i;
|
|
2269
|
-
const protocol = header.slice(start, end);
|
|
2270
|
-
if (protocols.has(protocol)) throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
|
|
2271
|
-
protocols.add(protocol);
|
|
2272
|
-
start = end = -1;
|
|
2273
|
-
} else throw new SyntaxError(`Unexpected character at index ${i}`);
|
|
2274
|
-
}
|
|
2275
|
-
if (start === -1 || end !== -1) throw new SyntaxError("Unexpected end of input");
|
|
2276
|
-
const protocol = header.slice(start, i);
|
|
2277
|
-
if (protocols.has(protocol)) throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
|
|
2278
|
-
protocols.add(protocol);
|
|
2279
|
-
return protocols;
|
|
2280
|
-
}
|
|
2281
|
-
module.exports = { parse };
|
|
2282
|
-
}));
|
|
2283
|
-
var require_websocket_server = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2284
|
-
const EventEmitter = __require("events");
|
|
2285
|
-
const http = __require("http");
|
|
2286
|
-
const { Duplex } = __require("stream");
|
|
2287
|
-
const { createHash } = __require("crypto");
|
|
2288
|
-
const extension = require_extension();
|
|
2289
|
-
const PerMessageDeflate = require_permessage_deflate();
|
|
2290
|
-
const subprotocol = require_subprotocol();
|
|
2291
|
-
const WebSocket = require_websocket();
|
|
2292
|
-
const { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants();
|
|
2293
|
-
const keyRegex = /^[+/0-9A-Za-z]{22}==$/;
|
|
2294
|
-
const RUNNING = 0;
|
|
2295
|
-
const CLOSING = 1;
|
|
2296
|
-
const CLOSED = 2;
|
|
2297
|
-
var WebSocketServer = class extends EventEmitter {
|
|
2298
|
-
constructor(options, callback) {
|
|
2299
|
-
super();
|
|
2300
|
-
options = {
|
|
2301
|
-
allowSynchronousEvents: true,
|
|
2302
|
-
autoPong: true,
|
|
2303
|
-
maxPayload: 100 * 1024 * 1024,
|
|
2304
|
-
skipUTF8Validation: false,
|
|
2305
|
-
perMessageDeflate: false,
|
|
2306
|
-
handleProtocols: null,
|
|
2307
|
-
clientTracking: true,
|
|
2308
|
-
closeTimeout: CLOSE_TIMEOUT,
|
|
2309
|
-
verifyClient: null,
|
|
2310
|
-
noServer: false,
|
|
2311
|
-
backlog: null,
|
|
2312
|
-
server: null,
|
|
2313
|
-
host: null,
|
|
2314
|
-
path: null,
|
|
2315
|
-
port: null,
|
|
2316
|
-
WebSocket,
|
|
2317
|
-
...options
|
|
2318
|
-
};
|
|
2319
|
-
if (options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer) throw new TypeError("One and only one of the \"port\", \"server\", or \"noServer\" options must be specified");
|
|
2320
|
-
if (options.port != null) {
|
|
2321
|
-
this._server = http.createServer((req, res) => {
|
|
2322
|
-
const body = http.STATUS_CODES[426];
|
|
2323
|
-
res.writeHead(426, {
|
|
2324
|
-
"Content-Length": body.length,
|
|
2325
|
-
"Content-Type": "text/plain"
|
|
2326
|
-
});
|
|
2327
|
-
res.end(body);
|
|
2328
|
-
});
|
|
2329
|
-
this._server.listen(options.port, options.host, options.backlog, callback);
|
|
2330
|
-
} else if (options.server) this._server = options.server;
|
|
2331
|
-
if (this._server) {
|
|
2332
|
-
const emitConnection = this.emit.bind(this, "connection");
|
|
2333
|
-
this._removeListeners = addListeners(this._server, {
|
|
2334
|
-
listening: this.emit.bind(this, "listening"),
|
|
2335
|
-
error: this.emit.bind(this, "error"),
|
|
2336
|
-
upgrade: (req, socket, head) => {
|
|
2337
|
-
this.handleUpgrade(req, socket, head, emitConnection);
|
|
2338
|
-
}
|
|
2339
|
-
});
|
|
2340
|
-
}
|
|
2341
|
-
if (options.perMessageDeflate === true) options.perMessageDeflate = {};
|
|
2342
|
-
if (options.clientTracking) {
|
|
2343
|
-
this.clients = /* @__PURE__ */ new Set();
|
|
2344
|
-
this._shouldEmitClose = false;
|
|
2345
|
-
}
|
|
2346
|
-
this.options = options;
|
|
2347
|
-
this._state = RUNNING;
|
|
2348
|
-
}
|
|
2349
|
-
address() {
|
|
2350
|
-
if (this.options.noServer) throw new Error("The server is operating in \"noServer\" mode");
|
|
2351
|
-
if (!this._server) return null;
|
|
2352
|
-
return this._server.address();
|
|
2353
|
-
}
|
|
2354
|
-
close(cb) {
|
|
2355
|
-
if (this._state === CLOSED) {
|
|
2356
|
-
if (cb) this.once("close", () => {
|
|
2357
|
-
cb(/* @__PURE__ */ new Error("The server is not running"));
|
|
2358
|
-
});
|
|
2359
|
-
process.nextTick(emitClose, this);
|
|
2360
|
-
return;
|
|
2361
|
-
}
|
|
2362
|
-
if (cb) this.once("close", cb);
|
|
2363
|
-
if (this._state === CLOSING) return;
|
|
2364
|
-
this._state = CLOSING;
|
|
2365
|
-
if (this.options.noServer || this.options.server) {
|
|
2366
|
-
if (this._server) {
|
|
2367
|
-
this._removeListeners();
|
|
2368
|
-
this._removeListeners = this._server = null;
|
|
2369
|
-
}
|
|
2370
|
-
if (this.clients) if (!this.clients.size) process.nextTick(emitClose, this);
|
|
2371
|
-
else this._shouldEmitClose = true;
|
|
2372
|
-
else process.nextTick(emitClose, this);
|
|
2373
|
-
} else {
|
|
2374
|
-
const server = this._server;
|
|
2375
|
-
this._removeListeners();
|
|
2376
|
-
this._removeListeners = this._server = null;
|
|
2377
|
-
server.close(() => {
|
|
2378
|
-
emitClose(this);
|
|
2379
|
-
});
|
|
2380
|
-
}
|
|
2381
|
-
}
|
|
2382
|
-
shouldHandle(req) {
|
|
2383
|
-
if (this.options.path) {
|
|
2384
|
-
const index = req.url.indexOf("?");
|
|
2385
|
-
if ((index !== -1 ? req.url.slice(0, index) : req.url) !== this.options.path) return false;
|
|
2386
|
-
}
|
|
2387
|
-
return true;
|
|
2388
|
-
}
|
|
2389
|
-
handleUpgrade(req, socket, head, cb) {
|
|
2390
|
-
socket.on("error", socketOnError);
|
|
2391
|
-
const key = req.headers["sec-websocket-key"];
|
|
2392
|
-
const upgrade = req.headers.upgrade;
|
|
2393
|
-
const version = +req.headers["sec-websocket-version"];
|
|
2394
|
-
if (req.method !== "GET") {
|
|
2395
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 405, "Invalid HTTP method");
|
|
2396
|
-
return;
|
|
2397
|
-
}
|
|
2398
|
-
if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
|
|
2399
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid Upgrade header");
|
|
2400
|
-
return;
|
|
2401
|
-
}
|
|
2402
|
-
if (key === void 0 || !keyRegex.test(key)) {
|
|
2403
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Key header");
|
|
2404
|
-
return;
|
|
2405
|
-
}
|
|
2406
|
-
if (version !== 13 && version !== 8) {
|
|
2407
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Missing or invalid Sec-WebSocket-Version header", { "Sec-WebSocket-Version": "13, 8" });
|
|
2408
|
-
return;
|
|
2409
|
-
}
|
|
2410
|
-
if (!this.shouldHandle(req)) {
|
|
2411
|
-
abortHandshake(socket, 400);
|
|
2412
|
-
return;
|
|
2413
|
-
}
|
|
2414
|
-
const secWebSocketProtocol = req.headers["sec-websocket-protocol"];
|
|
2415
|
-
let protocols = /* @__PURE__ */ new Set();
|
|
2416
|
-
if (secWebSocketProtocol !== void 0) try {
|
|
2417
|
-
protocols = subprotocol.parse(secWebSocketProtocol);
|
|
2418
|
-
} catch (err) {
|
|
2419
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid Sec-WebSocket-Protocol header");
|
|
2420
|
-
return;
|
|
2421
|
-
}
|
|
2422
|
-
const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
|
|
2423
|
-
const extensions = {};
|
|
2424
|
-
if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
|
|
2425
|
-
const perMessageDeflate = new PerMessageDeflate({
|
|
2426
|
-
...this.options.perMessageDeflate,
|
|
2427
|
-
isServer: true,
|
|
2428
|
-
maxPayload: this.options.maxPayload
|
|
2429
|
-
});
|
|
2430
|
-
try {
|
|
2431
|
-
const offers = extension.parse(secWebSocketExtensions);
|
|
2432
|
-
if (offers[PerMessageDeflate.extensionName]) {
|
|
2433
|
-
perMessageDeflate.accept(offers[PerMessageDeflate.extensionName]);
|
|
2434
|
-
extensions[PerMessageDeflate.extensionName] = perMessageDeflate;
|
|
2435
|
-
}
|
|
2436
|
-
} catch (err) {
|
|
2437
|
-
abortHandshakeOrEmitwsClientError(this, req, socket, 400, "Invalid or unacceptable Sec-WebSocket-Extensions header");
|
|
2438
|
-
return;
|
|
2439
|
-
}
|
|
2440
|
-
}
|
|
2441
|
-
if (this.options.verifyClient) {
|
|
2442
|
-
const info = {
|
|
2443
|
-
origin: req.headers[`${version === 8 ? "sec-websocket-origin" : "origin"}`],
|
|
2444
|
-
secure: !!(req.socket.authorized || req.socket.encrypted),
|
|
2445
|
-
req
|
|
2446
|
-
};
|
|
2447
|
-
if (this.options.verifyClient.length === 2) {
|
|
2448
|
-
this.options.verifyClient(info, (verified, code, message, headers) => {
|
|
2449
|
-
if (!verified) return abortHandshake(socket, code || 401, message, headers);
|
|
2450
|
-
this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
|
|
2451
|
-
});
|
|
2452
|
-
return;
|
|
2453
|
-
}
|
|
2454
|
-
if (!this.options.verifyClient(info)) return abortHandshake(socket, 401);
|
|
2455
|
-
}
|
|
2456
|
-
this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
|
|
2457
|
-
}
|
|
2458
|
-
completeUpgrade(extensions, key, protocols, req, socket, head, cb) {
|
|
2459
|
-
if (!socket.readable || !socket.writable) return socket.destroy();
|
|
2460
|
-
if (socket[kWebSocket]) throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");
|
|
2461
|
-
if (this._state > RUNNING) return abortHandshake(socket, 503);
|
|
2462
|
-
const headers = [
|
|
2463
|
-
"HTTP/1.1 101 Switching Protocols",
|
|
2464
|
-
"Upgrade: websocket",
|
|
2465
|
-
"Connection: Upgrade",
|
|
2466
|
-
`Sec-WebSocket-Accept: ${createHash("sha1").update(key + GUID).digest("base64")}`
|
|
2467
|
-
];
|
|
2468
|
-
const ws = new this.options.WebSocket(null, void 0, this.options);
|
|
2469
|
-
if (protocols.size) {
|
|
2470
|
-
const protocol = this.options.handleProtocols ? this.options.handleProtocols(protocols, req) : protocols.values().next().value;
|
|
2471
|
-
if (protocol) {
|
|
2472
|
-
headers.push(`Sec-WebSocket-Protocol: ${protocol}`);
|
|
2473
|
-
ws._protocol = protocol;
|
|
2474
|
-
}
|
|
2475
|
-
}
|
|
2476
|
-
if (extensions[PerMessageDeflate.extensionName]) {
|
|
2477
|
-
const params = extensions[PerMessageDeflate.extensionName].params;
|
|
2478
|
-
const value = extension.format({ [PerMessageDeflate.extensionName]: [params] });
|
|
2479
|
-
headers.push(`Sec-WebSocket-Extensions: ${value}`);
|
|
2480
|
-
ws._extensions = extensions;
|
|
2481
|
-
}
|
|
2482
|
-
this.emit("headers", headers, req);
|
|
2483
|
-
socket.write(headers.concat("\r\n").join("\r\n"));
|
|
2484
|
-
socket.removeListener("error", socketOnError);
|
|
2485
|
-
ws.setSocket(socket, head, {
|
|
2486
|
-
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
2487
|
-
maxPayload: this.options.maxPayload,
|
|
2488
|
-
skipUTF8Validation: this.options.skipUTF8Validation
|
|
2489
|
-
});
|
|
2490
|
-
if (this.clients) {
|
|
2491
|
-
this.clients.add(ws);
|
|
2492
|
-
ws.on("close", () => {
|
|
2493
|
-
this.clients.delete(ws);
|
|
2494
|
-
if (this._shouldEmitClose && !this.clients.size) process.nextTick(emitClose, this);
|
|
2495
|
-
});
|
|
2496
|
-
}
|
|
2497
|
-
cb(ws, req);
|
|
2498
|
-
}
|
|
2499
|
-
};
|
|
2500
|
-
module.exports = WebSocketServer;
|
|
2501
|
-
function addListeners(server, map) {
|
|
2502
|
-
for (const event of Object.keys(map)) server.on(event, map[event]);
|
|
2503
|
-
return function removeListeners() {
|
|
2504
|
-
for (const event of Object.keys(map)) server.removeListener(event, map[event]);
|
|
2505
|
-
};
|
|
2506
|
-
}
|
|
2507
|
-
function emitClose(server) {
|
|
2508
|
-
server._state = CLOSED;
|
|
2509
|
-
server.emit("close");
|
|
2510
|
-
}
|
|
2511
|
-
function socketOnError() {
|
|
2512
|
-
this.destroy();
|
|
2513
|
-
}
|
|
2514
|
-
function abortHandshake(socket, code, message, headers) {
|
|
2515
|
-
message = message || http.STATUS_CODES[code];
|
|
2516
|
-
headers = {
|
|
2517
|
-
Connection: "close",
|
|
2518
|
-
"Content-Type": "text/html",
|
|
2519
|
-
"Content-Length": Buffer.byteLength(message),
|
|
2520
|
-
...headers
|
|
2521
|
-
};
|
|
2522
|
-
socket.once("finish", socket.destroy);
|
|
2523
|
-
socket.end(`HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r\n` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message);
|
|
2524
|
-
}
|
|
2525
|
-
function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
|
|
2526
|
-
if (server.listenerCount("wsClientError")) {
|
|
2527
|
-
const err = new Error(message);
|
|
2528
|
-
Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
|
|
2529
|
-
server.emit("wsClientError", err, socket, req);
|
|
2530
|
-
} else abortHandshake(socket, code, message, headers);
|
|
2531
|
-
}
|
|
2532
|
-
}));
|
|
2533
|
-
require_stream();
|
|
2534
|
-
require_extension();
|
|
2535
|
-
require_permessage_deflate();
|
|
2536
|
-
require_receiver();
|
|
2537
|
-
require_sender();
|
|
2538
|
-
require_subprotocol();
|
|
2539
|
-
require_websocket();
|
|
2540
|
-
var import_websocket_server = /* @__PURE__ */ __toESM(require_websocket_server(), 1);
|
|
2541
|
-
//#endregion
|
|
2542
|
-
//#region node_modules/.pnpm/crossws@0.4.5_srvx@0.11.15/node_modules/crossws/dist/_chunks/peer.mjs
|
|
2543
|
-
var kNodeInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom");
|
|
2544
|
-
function toBufferLike(val) {
|
|
2545
|
-
if (val === void 0 || val === null) return "";
|
|
2546
|
-
const type = typeof val;
|
|
2547
|
-
if (type === "string") return val;
|
|
2548
|
-
if (type === "number" || type === "boolean" || type === "bigint") return val.toString();
|
|
2549
|
-
if (type === "function" || type === "symbol") return "{}";
|
|
2550
|
-
if (val instanceof Uint8Array || val instanceof ArrayBuffer) return val;
|
|
2551
|
-
if (isPlainObject(val)) return JSON.stringify(val);
|
|
2552
|
-
return val;
|
|
2553
|
-
}
|
|
2554
|
-
function isPlainObject(value) {
|
|
2555
|
-
if (value === null || typeof value !== "object") return false;
|
|
2556
|
-
const prototype = Object.getPrototypeOf(value);
|
|
2557
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
2558
|
-
if (Symbol.iterator in value) return false;
|
|
2559
|
-
if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
|
|
2560
|
-
return true;
|
|
2561
|
-
}
|
|
2562
|
-
var Message = class {
|
|
2563
|
-
event;
|
|
2564
|
-
peer;
|
|
2565
|
-
rawData;
|
|
2566
|
-
#id;
|
|
2567
|
-
#uint8Array;
|
|
2568
|
-
#arrayBuffer;
|
|
2569
|
-
#blob;
|
|
2570
|
-
#text;
|
|
2571
|
-
#json;
|
|
2572
|
-
constructor(rawData, peer, event) {
|
|
2573
|
-
this.rawData = rawData || "";
|
|
2574
|
-
this.peer = peer;
|
|
2575
|
-
this.event = event;
|
|
2576
|
-
}
|
|
2577
|
-
get id() {
|
|
2578
|
-
if (!this.#id) this.#id = crypto.randomUUID();
|
|
2579
|
-
return this.#id;
|
|
2580
|
-
}
|
|
2581
|
-
uint8Array() {
|
|
2582
|
-
const _uint8Array = this.#uint8Array;
|
|
2583
|
-
if (_uint8Array) return _uint8Array;
|
|
2584
|
-
const rawData = this.rawData;
|
|
2585
|
-
if (rawData instanceof Uint8Array) return this.#uint8Array = rawData;
|
|
2586
|
-
if (rawData instanceof ArrayBuffer || rawData instanceof SharedArrayBuffer) {
|
|
2587
|
-
this.#arrayBuffer = rawData;
|
|
2588
|
-
return this.#uint8Array = new Uint8Array(rawData);
|
|
2589
|
-
}
|
|
2590
|
-
if (typeof rawData === "string") {
|
|
2591
|
-
this.#text = rawData;
|
|
2592
|
-
return this.#uint8Array = new TextEncoder().encode(this.#text);
|
|
2593
|
-
}
|
|
2594
|
-
if (Symbol.iterator in rawData) return this.#uint8Array = new Uint8Array(rawData);
|
|
2595
|
-
if (typeof rawData?.length === "number") return this.#uint8Array = new Uint8Array(rawData);
|
|
2596
|
-
if (rawData instanceof DataView) return this.#uint8Array = new Uint8Array(rawData.buffer, rawData.byteOffset, rawData.byteLength);
|
|
2597
|
-
throw new TypeError(`Unsupported message type: ${Object.prototype.toString.call(rawData)}`);
|
|
2598
|
-
}
|
|
2599
|
-
arrayBuffer() {
|
|
2600
|
-
const _arrayBuffer = this.#arrayBuffer;
|
|
2601
|
-
if (_arrayBuffer) return _arrayBuffer;
|
|
2602
|
-
const rawData = this.rawData;
|
|
2603
|
-
if (rawData instanceof ArrayBuffer || rawData instanceof SharedArrayBuffer) return this.#arrayBuffer = rawData;
|
|
2604
|
-
return this.#arrayBuffer = this.uint8Array().buffer;
|
|
2605
|
-
}
|
|
2606
|
-
blob() {
|
|
2607
|
-
const _blob = this.#blob;
|
|
2608
|
-
if (_blob) return _blob;
|
|
2609
|
-
const rawData = this.rawData;
|
|
2610
|
-
if (rawData instanceof Blob) return this.#blob = rawData;
|
|
2611
|
-
return this.#blob = new Blob([this.uint8Array()]);
|
|
2612
|
-
}
|
|
2613
|
-
text() {
|
|
2614
|
-
const _text = this.#text;
|
|
2615
|
-
if (_text) return _text;
|
|
2616
|
-
const rawData = this.rawData;
|
|
2617
|
-
if (typeof rawData === "string") return this.#text = rawData;
|
|
2618
|
-
return this.#text = new TextDecoder().decode(this.uint8Array());
|
|
2619
|
-
}
|
|
2620
|
-
json() {
|
|
2621
|
-
const _json = this.#json;
|
|
2622
|
-
if (_json) return _json;
|
|
2623
|
-
return this.#json = JSON.parse(this.text());
|
|
2624
|
-
}
|
|
2625
|
-
get data() {
|
|
2626
|
-
switch (this.peer?.websocket?.binaryType) {
|
|
2627
|
-
case "arraybuffer": return this.arrayBuffer();
|
|
2628
|
-
case "blob": return this.blob();
|
|
2629
|
-
case "nodebuffer": return globalThis.Buffer ? Buffer.from(this.uint8Array()) : this.uint8Array();
|
|
2630
|
-
case "uint8array": return this.uint8Array();
|
|
2631
|
-
case "text": return this.text();
|
|
2632
|
-
default: return this.rawData;
|
|
2633
|
-
}
|
|
2634
|
-
}
|
|
2635
|
-
toString() {
|
|
2636
|
-
return this.text();
|
|
2637
|
-
}
|
|
2638
|
-
[Symbol.toPrimitive]() {
|
|
2639
|
-
return this.text();
|
|
2640
|
-
}
|
|
2641
|
-
[kNodeInspect]() {
|
|
2642
|
-
return { message: {
|
|
2643
|
-
id: this.id,
|
|
2644
|
-
peer: this.peer,
|
|
2645
|
-
text: this.text()
|
|
2646
|
-
} };
|
|
2647
|
-
}
|
|
2648
|
-
};
|
|
2649
|
-
var Peer = class {
|
|
2650
|
-
_internal;
|
|
2651
|
-
_topics;
|
|
2652
|
-
_id;
|
|
2653
|
-
#ws;
|
|
2654
|
-
constructor(internal) {
|
|
2655
|
-
this._topics = /* @__PURE__ */ new Set();
|
|
2656
|
-
this._internal = internal;
|
|
2657
|
-
}
|
|
2658
|
-
get context() {
|
|
2659
|
-
return this._internal.context ??= {};
|
|
2660
|
-
}
|
|
2661
|
-
get namespace() {
|
|
2662
|
-
return this._internal.namespace;
|
|
2663
|
-
}
|
|
2664
|
-
get id() {
|
|
2665
|
-
if (!this._id) this._id = crypto.randomUUID();
|
|
2666
|
-
return this._id;
|
|
2667
|
-
}
|
|
2668
|
-
get remoteAddress() {}
|
|
2669
|
-
get request() {
|
|
2670
|
-
return this._internal.request;
|
|
2671
|
-
}
|
|
2672
|
-
get websocket() {
|
|
2673
|
-
if (!this.#ws) {
|
|
2674
|
-
const _ws = this._internal.ws;
|
|
2675
|
-
const _request = this._internal.request;
|
|
2676
|
-
this.#ws = _request ? createWsProxy(_ws, _request) : _ws;
|
|
2677
|
-
}
|
|
2678
|
-
return this.#ws;
|
|
2679
|
-
}
|
|
2680
|
-
get peers() {
|
|
2681
|
-
return this._internal.peers || /* @__PURE__ */ new Set();
|
|
2682
|
-
}
|
|
2683
|
-
get topics() {
|
|
2684
|
-
return this._topics;
|
|
2685
|
-
}
|
|
2686
|
-
terminate() {
|
|
2687
|
-
this.close();
|
|
2688
|
-
}
|
|
2689
|
-
subscribe(topic) {
|
|
2690
|
-
this._topics.add(topic);
|
|
2691
|
-
}
|
|
2692
|
-
unsubscribe(topic) {
|
|
2693
|
-
this._topics.delete(topic);
|
|
2694
|
-
}
|
|
2695
|
-
toString() {
|
|
2696
|
-
return this.id;
|
|
2697
|
-
}
|
|
2698
|
-
[Symbol.toPrimitive]() {
|
|
2699
|
-
return this.id;
|
|
2700
|
-
}
|
|
2701
|
-
[Symbol.toStringTag]() {
|
|
2702
|
-
return "WebSocket";
|
|
2703
|
-
}
|
|
2704
|
-
[kNodeInspect]() {
|
|
2705
|
-
return { peer: {
|
|
2706
|
-
id: this.id,
|
|
2707
|
-
ip: this.remoteAddress
|
|
2708
|
-
} };
|
|
2709
|
-
}
|
|
2710
|
-
};
|
|
2711
|
-
function createWsProxy(ws, request) {
|
|
2712
|
-
return new Proxy(ws, { get: (target, prop) => {
|
|
2713
|
-
const value = Reflect.get(target, prop);
|
|
2714
|
-
if (!value) switch (prop) {
|
|
2715
|
-
case "protocol": return request?.headers?.get("sec-websocket-protocol") || "";
|
|
2716
|
-
case "extensions": return request?.headers?.get("sec-websocket-extensions") || "";
|
|
2717
|
-
case "url": return request?.url?.replace(/^http/, "ws") || void 0;
|
|
2718
|
-
}
|
|
2719
|
-
return value;
|
|
2720
|
-
} });
|
|
2721
|
-
}
|
|
2722
|
-
//#endregion
|
|
2723
|
-
//#region node_modules/.pnpm/crossws@0.4.5_srvx@0.11.15/node_modules/crossws/dist/_chunks/error.mjs
|
|
2724
|
-
var WSError = class extends Error {
|
|
2725
|
-
constructor(...args) {
|
|
2726
|
-
super(...args);
|
|
2727
|
-
this.name = "WSError";
|
|
2728
|
-
}
|
|
2729
|
-
};
|
|
2730
|
-
//#endregion
|
|
2731
|
-
//#region node_modules/.pnpm/crossws@0.4.5_srvx@0.11.15/node_modules/crossws/dist/_chunks/_request.mjs
|
|
2732
|
-
var StubRequest = /* @__PURE__ */ (() => {
|
|
2733
|
-
class StubRequest {
|
|
2734
|
-
url;
|
|
2735
|
-
_abortController;
|
|
2736
|
-
_headers;
|
|
2737
|
-
_init;
|
|
2738
|
-
constructor(url, init = {}) {
|
|
2739
|
-
this.url = url;
|
|
2740
|
-
this._init = init;
|
|
2741
|
-
}
|
|
2742
|
-
get headers() {
|
|
2743
|
-
if (!this._headers) this._headers = new Headers(this._init?.headers);
|
|
2744
|
-
return this._headers;
|
|
2745
|
-
}
|
|
2746
|
-
clone() {
|
|
2747
|
-
return new StubRequest(this.url, this._init);
|
|
2748
|
-
}
|
|
2749
|
-
get method() {
|
|
2750
|
-
return "GET";
|
|
2751
|
-
}
|
|
2752
|
-
get signal() {
|
|
2753
|
-
if (!this._abortController) this._abortController = new AbortController();
|
|
2754
|
-
return this._abortController.signal;
|
|
2755
|
-
}
|
|
2756
|
-
get cache() {
|
|
2757
|
-
return "default";
|
|
2758
|
-
}
|
|
2759
|
-
get credentials() {
|
|
2760
|
-
return "same-origin";
|
|
2761
|
-
}
|
|
2762
|
-
get destination() {
|
|
2763
|
-
return "";
|
|
2764
|
-
}
|
|
2765
|
-
get integrity() {
|
|
2766
|
-
return "";
|
|
2767
|
-
}
|
|
2768
|
-
get keepalive() {
|
|
2769
|
-
return false;
|
|
2770
|
-
}
|
|
2771
|
-
get redirect() {
|
|
2772
|
-
return "follow";
|
|
2773
|
-
}
|
|
2774
|
-
get mode() {
|
|
2775
|
-
return "cors";
|
|
2776
|
-
}
|
|
2777
|
-
get referrer() {
|
|
2778
|
-
return "about:client";
|
|
2779
|
-
}
|
|
2780
|
-
get referrerPolicy() {
|
|
2781
|
-
return "";
|
|
2782
|
-
}
|
|
2783
|
-
get body() {
|
|
2784
|
-
return null;
|
|
2785
|
-
}
|
|
2786
|
-
get bodyUsed() {
|
|
2787
|
-
return false;
|
|
2788
|
-
}
|
|
2789
|
-
arrayBuffer() {
|
|
2790
|
-
return Promise.resolve(/* @__PURE__ */ new ArrayBuffer(0));
|
|
2791
|
-
}
|
|
2792
|
-
blob() {
|
|
2793
|
-
return Promise.resolve(new Blob());
|
|
2794
|
-
}
|
|
2795
|
-
bytes() {
|
|
2796
|
-
return Promise.resolve(new Uint8Array());
|
|
2797
|
-
}
|
|
2798
|
-
formData() {
|
|
2799
|
-
return Promise.resolve(new FormData());
|
|
2800
|
-
}
|
|
2801
|
-
json() {
|
|
2802
|
-
return Promise.resolve(JSON.parse(""));
|
|
2803
|
-
}
|
|
2804
|
-
text() {
|
|
2805
|
-
return Promise.resolve("");
|
|
2806
|
-
}
|
|
2807
|
-
}
|
|
2808
|
-
Object.setPrototypeOf(StubRequest.prototype, globalThis.Request.prototype);
|
|
2809
|
-
return StubRequest;
|
|
2810
|
-
})();
|
|
2811
|
-
//#endregion
|
|
2812
|
-
//#region node_modules/.pnpm/crossws@0.4.5_srvx@0.11.15/node_modules/crossws/dist/_chunks/node.mjs
|
|
2813
|
-
var nodeAdapter = (options = {}) => {
|
|
2814
|
-
if ("Deno" in globalThis || "Bun" in globalThis) throw new Error("[crossws] Using Node.js adapter in an incompatible environment.");
|
|
2815
|
-
const hooks = new AdapterHookable(options);
|
|
2816
|
-
const globalPeers = /* @__PURE__ */ new Map();
|
|
2817
|
-
const wss = options.wss || new import_websocket_server.default({
|
|
2818
|
-
noServer: true,
|
|
2819
|
-
handleProtocols: () => false,
|
|
2820
|
-
...options.serverOptions
|
|
2821
|
-
});
|
|
2822
|
-
wss.on("connection", (ws, nodeReq) => {
|
|
2823
|
-
const request = new NodeReqProxy(nodeReq);
|
|
2824
|
-
const peers = getPeers(globalPeers, nodeReq._namespace);
|
|
2825
|
-
const peer = new NodePeer({
|
|
2826
|
-
ws,
|
|
2827
|
-
request,
|
|
2828
|
-
peers,
|
|
2829
|
-
nodeReq,
|
|
2830
|
-
namespace: nodeReq._namespace
|
|
2831
|
-
});
|
|
2832
|
-
peers.add(peer);
|
|
2833
|
-
hooks.callHook("open", peer);
|
|
2834
|
-
ws.on("message", (data, isBinary) => {
|
|
2835
|
-
if (Array.isArray(data)) data = Buffer.concat(data);
|
|
2836
|
-
if (!isBinary && Buffer.isBuffer(data)) data = data.toString("utf8");
|
|
2837
|
-
hooks.callHook("message", peer, new Message(data, peer));
|
|
2838
|
-
});
|
|
2839
|
-
ws.on("error", (error) => {
|
|
2840
|
-
peers.delete(peer);
|
|
2841
|
-
hooks.callHook("error", peer, new WSError(error));
|
|
2842
|
-
});
|
|
2843
|
-
ws.on("close", (code, reason) => {
|
|
2844
|
-
peers.delete(peer);
|
|
2845
|
-
hooks.callHook("close", peer, {
|
|
2846
|
-
code,
|
|
2847
|
-
reason: reason?.toString()
|
|
2848
|
-
});
|
|
2849
|
-
});
|
|
2850
|
-
});
|
|
2851
|
-
wss.on("headers", (outgoingHeaders, req) => {
|
|
2852
|
-
const upgradeHeaders = req._upgradeHeaders;
|
|
2853
|
-
if (upgradeHeaders) for (const [key, value] of new Headers(upgradeHeaders)) outgoingHeaders.push(`${key}: ${value}`);
|
|
2854
|
-
});
|
|
2855
|
-
return {
|
|
2856
|
-
...adapterUtils(globalPeers),
|
|
2857
|
-
handleUpgrade: async (nodeReq, socket, head, webRequest) => {
|
|
2858
|
-
const request = webRequest || new NodeReqProxy(nodeReq);
|
|
2859
|
-
const { upgradeHeaders, endResponse, handled, context, namespace } = await hooks.upgrade(request);
|
|
2860
|
-
if (endResponse) return sendResponse(socket, endResponse);
|
|
2861
|
-
if (handled) return;
|
|
2862
|
-
nodeReq._request = request;
|
|
2863
|
-
nodeReq._upgradeHeaders = upgradeHeaders;
|
|
2864
|
-
nodeReq._context = context;
|
|
2865
|
-
nodeReq._namespace = namespace;
|
|
2866
|
-
wss.handleUpgrade(nodeReq, socket, head, (ws) => {
|
|
2867
|
-
wss.emit("connection", ws, nodeReq);
|
|
2868
|
-
});
|
|
2869
|
-
},
|
|
2870
|
-
closeAll: (code, data, force) => {
|
|
2871
|
-
for (const client of wss.clients) if (force) client.terminate();
|
|
2872
|
-
else client.close(code, data);
|
|
2873
|
-
}
|
|
2874
|
-
};
|
|
2875
|
-
};
|
|
2876
|
-
var NodePeer = class extends Peer {
|
|
2877
|
-
get remoteAddress() {
|
|
2878
|
-
return this._internal.nodeReq.socket?.remoteAddress;
|
|
2879
|
-
}
|
|
2880
|
-
get context() {
|
|
2881
|
-
return this._internal.nodeReq._context;
|
|
2882
|
-
}
|
|
2883
|
-
send(data, options) {
|
|
2884
|
-
const dataBuff = toBufferLike(data);
|
|
2885
|
-
const isBinary = typeof dataBuff !== "string";
|
|
2886
|
-
this._internal.ws.send(dataBuff, {
|
|
2887
|
-
compress: options?.compress,
|
|
2888
|
-
binary: isBinary,
|
|
2889
|
-
...options
|
|
2890
|
-
});
|
|
2891
|
-
return 0;
|
|
2892
|
-
}
|
|
2893
|
-
publish(topic, data, options) {
|
|
2894
|
-
const dataBuff = toBufferLike(data);
|
|
2895
|
-
const isBinary = typeof data !== "string";
|
|
2896
|
-
const sendOptions = {
|
|
2897
|
-
compress: options?.compress,
|
|
2898
|
-
binary: isBinary,
|
|
2899
|
-
...options
|
|
2900
|
-
};
|
|
2901
|
-
for (const peer of this._internal.peers) if (peer !== this && peer._topics.has(topic)) peer._internal.ws.send(dataBuff, sendOptions);
|
|
2902
|
-
}
|
|
2903
|
-
close(code, data) {
|
|
2904
|
-
this._internal.ws.close(code, data);
|
|
2905
|
-
}
|
|
2906
|
-
terminate() {
|
|
2907
|
-
this._internal.ws.terminate();
|
|
2908
|
-
}
|
|
2909
|
-
};
|
|
2910
|
-
var NodeReqProxy = class extends StubRequest {
|
|
2911
|
-
constructor(req) {
|
|
2912
|
-
const host = req.headers["host"] || "localhost";
|
|
2913
|
-
const url = `${req.socket?.encrypted ?? req.headers["x-forwarded-proto"] === "https" ? "https" : "http"}://${host}${req.url}`;
|
|
2914
|
-
super(url, { headers: req.headers });
|
|
2915
|
-
}
|
|
2916
|
-
};
|
|
2917
|
-
async function sendResponse(socket, res) {
|
|
2918
|
-
const head = [`HTTP/1.1 ${res.status || 200} ${res.statusText || ""}`, ...[...res.headers.entries()].map(([key, value]) => `${key}: ${value}`)];
|
|
2919
|
-
socket.write(head.join("\r\n") + "\r\n\r\n");
|
|
2920
|
-
if (res.body) for await (const chunk of res.body) socket.write(chunk);
|
|
2921
|
-
return new Promise((resolve) => {
|
|
2922
|
-
socket.end(() => {
|
|
2923
|
-
socket.destroy();
|
|
2924
|
-
resolve();
|
|
2925
|
-
});
|
|
2926
|
-
});
|
|
2927
|
-
}
|
|
2928
|
-
//#endregion
|
|
2929
|
-
export { nodeAdapter as t };
|