@mudlet/mudlet-web 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +338 -0
- package/README.md +150 -0
- package/dist-lib/App.d.ts +1 -0
- package/dist-lib/MudletWebApp.d.ts +11 -0
- package/dist-lib/ProfileSession.d.ts +15 -0
- package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +9 -0
- package/dist-lib/branding.d.ts +213 -0
- package/dist-lib/core/EventBus.d.ts +29 -0
- package/dist-lib/db/sqliteClient.d.ts +25 -0
- package/dist-lib/hooks/useEngines.d.ts +12 -0
- package/dist-lib/hooks/useMudSession.d.ts +10 -0
- package/dist-lib/hooks/useOutput.d.ts +17 -0
- package/dist-lib/hooks/useViewportMode.d.ts +14 -0
- package/dist-lib/import/applyMudletProfile.d.ts +57 -0
- package/dist-lib/import/collectProfileExport.d.ts +16 -0
- package/dist-lib/import/defaultPackages.d.ts +81 -0
- package/dist-lib/import/defaults/mudlet-mapper.xml +13023 -0
- package/dist-lib/import/defaults/run-lua-code.mpackage +0 -0
- package/dist-lib/import/mudletHost.d.ts +67 -0
- package/dist-lib/import/mudletLink.d.ts +34 -0
- package/dist-lib/import/mudletProfileExport.d.ts +49 -0
- package/dist-lib/import/mudletProfileImport.d.ts +71 -0
- package/dist-lib/import/mudletVariables.d.ts +49 -0
- package/dist-lib/import/mudletWriteback.d.ts +12 -0
- package/dist-lib/import/mudletXmlExport.d.ts +16 -0
- package/dist-lib/import/mudletXmlImport.d.ts +21 -0
- package/dist-lib/import/packageInstaller.d.ts +72 -0
- package/dist-lib/import/packageRepository.d.ts +54 -0
- package/dist-lib/import/remotePackageInstall.d.ts +52 -0
- package/dist-lib/index.d.ts +30 -0
- package/dist-lib/index.js +42307 -0
- package/dist-lib/logging/SessionLogger.d.ts +41 -0
- package/dist-lib/main.d.ts +2 -0
- package/dist-lib/map/MapSelectionOverlay.d.ts +15 -0
- package/dist-lib/map/MapStore.d.ts +1067 -0
- package/dist-lib/map/MudixMapReader.d.ts +90 -0
- package/dist-lib/map/MudletHighlightOverlay.d.ts +18 -0
- package/dist-lib/map/mapImageExport.d.ts +26 -0
- package/dist-lib/map/mapParser.worker.d.ts +1 -0
- package/dist-lib/map/mapParserClient.d.ts +35 -0
- package/dist-lib/map/pathfinding.d.ts +52 -0
- package/dist-lib/map/xmlMapImport.d.ts +28 -0
- package/dist-lib/mud/MudSession.d.ts +236 -0
- package/dist-lib/mud/PatternEngine.d.ts +28 -0
- package/dist-lib/mud/aliases/AliasEngine.d.ts +15 -0
- package/dist-lib/mud/connection/LineAssembler.d.ts +84 -0
- package/dist-lib/mud/connection/MudClient.d.ts +268 -0
- package/dist-lib/mud/connection/PingTracker.d.ts +28 -0
- package/dist-lib/mud/connection/TelnetNegotiator.d.ts +188 -0
- package/dist-lib/mud/connection/telnetDebug.d.ts +54 -0
- package/dist-lib/mud/events.d.ts +160 -0
- package/dist-lib/mud/keybindings/KeyEngine.d.ts +36 -0
- package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +45 -0
- package/dist-lib/mud/keybindings/qtKeys.d.ts +33 -0
- package/dist-lib/mud/protocol/charset.d.ts +105 -0
- package/dist-lib/mud/protocol/constants.d.ts +116 -0
- package/dist-lib/mud/protocol/echo.d.ts +63 -0
- package/dist-lib/mud/protocol/gmcp.d.ts +28 -0
- package/dist-lib/mud/protocol/index.d.ts +11 -0
- package/dist-lib/mud/protocol/mccp.d.ts +18 -0
- package/dist-lib/mud/protocol/mnes.d.ts +83 -0
- package/dist-lib/mud/protocol/msdp.d.ts +19 -0
- package/dist-lib/mud/protocol/msp.d.ts +47 -0
- package/dist-lib/mud/protocol/mssp.d.ts +25 -0
- package/dist-lib/mud/protocol/mxp.d.ts +188 -0
- package/dist-lib/mud/protocol/naws.d.ts +7 -0
- package/dist-lib/mud/replay/ReplayPlayer.d.ts +31 -0
- package/dist-lib/mud/replay/ReplayRecorder.d.ts +18 -0
- package/dist-lib/mud/replay/replayFormat.d.ts +49 -0
- package/dist-lib/mud/text/Console.d.ts +183 -0
- package/dist-lib/mud/text/FormatState.d.ts +256 -0
- package/dist-lib/mud/text/ansiEscapes.d.ts +88 -0
- package/dist-lib/mud/text/cellRender.d.ts +21 -0
- package/dist-lib/mud/text/colorParsers.d.ts +54 -0
- package/dist-lib/mud/text/colors.d.ts +31 -0
- package/dist-lib/mud/text/controlCharacterMode.d.ts +13 -0
- package/dist-lib/mud/text/controlChars.d.ts +31 -0
- package/dist-lib/mud/text/hyperlinkConfig.d.ts +164 -0
- package/dist-lib/mud/text/hyperlinkVisibility.d.ts +37 -0
- package/dist-lib/mud/text/oscLinkManager.d.ts +35 -0
- package/dist-lib/mud/text/wcwidth.d.ts +44 -0
- package/dist-lib/mud/text/xterm256.d.ts +2 -0
- package/dist-lib/mud/timers/TimerEngine.d.ts +61 -0
- package/dist-lib/mud/triggers/ChunkProcessor.d.ts +11 -0
- package/dist-lib/mud/triggers/TriggerEngine.d.ts +188 -0
- package/dist-lib/mud/triggers/pcre/Pcre2.d.ts +26 -0
- package/dist-lib/scripting/EngineHost.d.ts +152 -0
- package/dist-lib/scripting/GlobalEventChannel.d.ts +36 -0
- package/dist-lib/scripting/IScriptingRuntime.d.ts +95 -0
- package/dist-lib/scripting/MapOpenNotifier.d.ts +19 -0
- package/dist-lib/scripting/ScriptingAPI.d.ts +1691 -0
- package/dist-lib/scripting/ScriptingEngine.d.ts +806 -0
- package/dist-lib/scripting/StopwatchManager.d.ts +94 -0
- package/dist-lib/scripting/heldModifiers.d.ts +3 -0
- package/dist-lib/scripting/http/HttpService.d.ts +23 -0
- package/dist-lib/scripting/lua/LuaRuntime.d.ts +190 -0
- package/dist-lib/scripting/lua/bindings/automation.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/commandLine.d.ts +11 -0
- package/dist-lib/scripting/lua/bindings/context.d.ts +87 -0
- package/dist-lib/scripting/lua/bindings/cursor.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/diagnostics.d.ts +9 -0
- package/dist-lib/scripting/lua/bindings/map.d.ts +14 -0
- package/dist-lib/scripting/lua/bindings/media.d.ts +24 -0
- package/dist-lib/scripting/lua/bindings/output.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/packages.d.ts +10 -0
- package/dist-lib/scripting/lua/bindings/session.d.ts +16 -0
- package/dist-lib/scripting/lua/bindings/textEdit.d.ts +9 -0
- package/dist-lib/scripting/lua/bindings/userWindows.d.ts +11 -0
- package/dist-lib/scripting/lua/bindings/window.d.ts +10 -0
- package/dist-lib/scripting/lua/imageSize.d.ts +4 -0
- package/dist-lib/scripting/lua/luaCompletions.d.ts +9 -0
- package/dist-lib/scripting/lua/mudlet-lua/generic-mapper/generic_mapper.mpackage +0 -0
- package/dist-lib/scripting/lua/rex.d.ts +3 -0
- package/dist-lib/scripting/lua/sqlRowEncoder.d.ts +1 -0
- package/dist-lib/scripting/lua/yajl.d.ts +11 -0
- package/dist-lib/scripting/profilesPresence.d.ts +50 -0
- package/dist-lib/scripting/vfs/ProfileVFS.d.ts +62 -0
- package/dist-lib/scripting/vfs/cssRewrite.d.ts +21 -0
- package/dist-lib/scripting/vfs/folderHandleStore.d.ts +16 -0
- package/dist-lib/scripting/vfs/folderSync.d.ts +59 -0
- package/dist-lib/scripting/vfs/htmlRewrite.d.ts +26 -0
- package/dist-lib/scripting/vfs/vfsBridge.d.ts +16 -0
- package/dist-lib/services/cloudflare.d.ts +54 -0
- package/dist-lib/storage/appStore.d.ts +132 -0
- package/dist-lib/storage/crossTabSync.d.ts +3 -0
- package/dist-lib/storage/debouncedStorage.d.ts +18 -0
- package/dist-lib/storage/hooks.d.ts +17 -0
- package/dist-lib/storage/index.d.ts +4 -0
- package/dist-lib/storage/logExport.d.ts +32 -0
- package/dist-lib/storage/logStorage.d.ts +45 -0
- package/dist-lib/storage/mapStorage.d.ts +2 -0
- package/dist-lib/storage/profileVfsData.d.ts +47 -0
- package/dist-lib/storage/schema.d.ts +638 -0
- package/dist-lib/styles.css +2 -0
- package/dist-lib/ui/AboutModal.d.ts +8 -0
- package/dist-lib/ui/BrandLoginFields.d.ts +25 -0
- package/dist-lib/ui/BrandLoginScreen.d.ts +11 -0
- package/dist-lib/ui/CharLoginModal.d.ts +32 -0
- package/dist-lib/ui/CmdLineMenuRegistry.d.ts +27 -0
- package/dist-lib/ui/CodeEditorPreview.d.ts +19 -0
- package/dist-lib/ui/CommandBar.d.ts +17 -0
- package/dist-lib/ui/ConnectionFormModal.d.ts +13 -0
- package/dist-lib/ui/ConnectionGrid.d.ts +18 -0
- package/dist-lib/ui/ConnectionScreen.d.ts +14 -0
- package/dist-lib/ui/FileBrowserModal.d.ts +20 -0
- package/dist-lib/ui/FilePickerModal.d.ts +21 -0
- package/dist-lib/ui/FolderPermissionScreen.d.ts +16 -0
- package/dist-lib/ui/JsonPreview.d.ts +15 -0
- package/dist-lib/ui/LogBrowserModal.d.ts +7 -0
- package/dist-lib/ui/MapEditorModal.d.ts +9 -0
- package/dist-lib/ui/MarkdownPreview.d.ts +15 -0
- package/dist-lib/ui/MergeConflictModal.d.ts +17 -0
- package/dist-lib/ui/ModuleResolveModal.d.ts +22 -0
- package/dist-lib/ui/MouseEventRegistry.d.ts +31 -0
- package/dist-lib/ui/ProfileBusyScreen.d.ts +12 -0
- package/dist-lib/ui/ProfileExportModal.d.ts +7 -0
- package/dist-lib/ui/ProxyInfoModal.d.ts +6 -0
- package/dist-lib/ui/ProxyWhyModal.d.ts +6 -0
- package/dist-lib/ui/ProxyWizardModal.d.ts +6 -0
- package/dist-lib/ui/QuickOpenPalette.d.ts +8 -0
- package/dist-lib/ui/ResizableModal.d.ts +17 -0
- package/dist-lib/ui/ScriptingDocsModal.d.ts +12 -0
- package/dist-lib/ui/SettingsModal.d.ts +9 -0
- package/dist-lib/ui/Toolbar.d.ts +29 -0
- package/dist-lib/ui/bufferWords.d.ts +38 -0
- package/dist-lib/ui/buttons/ButtonsBar.d.ts +21 -0
- package/dist-lib/ui/cmdline/CommandLineManager.d.ts +97 -0
- package/dist-lib/ui/cmdline/CommandLineOverlay.d.ts +8 -0
- package/dist-lib/ui/codemirror/theme.d.ts +5 -0
- package/dist-lib/ui/commandHistory.d.ts +31 -0
- package/dist-lib/ui/components/Button.d.ts +9 -0
- package/dist-lib/ui/components/ConfirmDialog.d.ts +29 -0
- package/dist-lib/ui/components/ContextMenu.d.ts +9 -0
- package/dist-lib/ui/components/FontPicker.d.ts +9 -0
- package/dist-lib/ui/components/FormField.d.ts +16 -0
- package/dist-lib/ui/components/HelpTip.d.ts +7 -0
- package/dist-lib/ui/components/Input.d.ts +6 -0
- package/dist-lib/ui/components/Toggle.d.ts +10 -0
- package/dist-lib/ui/components/index.d.ts +9 -0
- package/dist-lib/ui/components/useModalFocus.d.ts +18 -0
- package/dist-lib/ui/labels/LabelManager.d.ts +220 -0
- package/dist-lib/ui/labels/LabelOverlay.d.ts +9 -0
- package/dist-lib/ui/labels/backgroundImageSize.d.ts +10 -0
- package/dist-lib/ui/labels/cursorShapes.d.ts +6 -0
- package/dist-lib/ui/labels/gifMovie.d.ts +100 -0
- package/dist-lib/ui/labels/qtCss.d.ts +57 -0
- package/dist-lib/ui/layout/ContentLayout.d.ts +19 -0
- package/dist-lib/ui/layout/DockArea.d.ts +14 -0
- package/dist-lib/ui/layout/DockedPanel.d.ts +13 -0
- package/dist-lib/ui/layout/FloatingWindowLayer.d.ts +10 -0
- package/dist-lib/ui/layout/MobileLayout.d.ts +22 -0
- package/dist-lib/ui/layout/PopoutWindow.d.ts +35 -0
- package/dist-lib/ui/layout/ScriptWindow.d.ts +29 -0
- package/dist-lib/ui/layout/SplitGroupPanel.d.ts +17 -0
- package/dist-lib/ui/layout/TabGroupPanel.d.ts +12 -0
- package/dist-lib/ui/layout/WindowContextMenu.d.ts +11 -0
- package/dist-lib/ui/layout/dockDetect.d.ts +26 -0
- package/dist-lib/ui/layout/overlayLayerOrder.d.ts +71 -0
- package/dist-lib/ui/markdown.d.ts +1 -0
- package/dist-lib/ui/output/CaretReviewPanel.d.ts +22 -0
- package/dist-lib/ui/output/OutputArea.d.ts +9 -0
- package/dist-lib/ui/output/OutputContextMenu.d.ts +23 -0
- package/dist-lib/ui/output/OutputRenderer.d.ts +64 -0
- package/dist-lib/ui/output/ScreenReaderLog.d.ts +23 -0
- package/dist-lib/ui/output/StickyOutputPanel.d.ts +28 -0
- package/dist-lib/ui/output/backgroundImageStyle.d.ts +17 -0
- package/dist-lib/ui/output/caretMode.d.ts +40 -0
- package/dist-lib/ui/output/linkNavigation.d.ts +29 -0
- package/dist-lib/ui/output/osc8Menu.d.ts +16 -0
- package/dist-lib/ui/output/outputCopy.d.ts +15 -0
- package/dist-lib/ui/preventPinchZoom.d.ts +1 -0
- package/dist-lib/ui/scrollbox/ScrollBoxManager.d.ts +62 -0
- package/dist-lib/ui/scrollbox/ScrollBoxOverlay.d.ts +25 -0
- package/dist-lib/ui/sound/SoundManager.d.ts +149 -0
- package/dist-lib/ui/sound/closedCaption.d.ts +37 -0
- package/dist-lib/ui/textedit/TextEditManager.d.ts +56 -0
- package/dist-lib/ui/tts/TtsManager.d.ts +68 -0
- package/dist-lib/ui/useBrandLogin.d.ts +19 -0
- package/dist-lib/ui/useCommandHistory.d.ts +7 -0
- package/dist-lib/ui/video/VideoManager.d.ts +56 -0
- package/dist-lib/ui/windows/ScriptEditorModal.d.ts +13 -0
- package/dist-lib/ui/windows/WindowManager.d.ts +694 -0
- package/dist-lib/ui/windows/panels/HtmlPanel.d.ts +27 -0
- package/dist-lib/ui/windows/panels/LuaEditor.d.ts +14 -0
- package/dist-lib/ui/windows/panels/MapPanel.d.ts +8 -0
- package/dist-lib/ui/windows/panels/PackageRepositoryModal.d.ts +18 -0
- package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +24 -0
- package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +12 -0
- package/dist-lib/ui/windows/panels/TextPanel.d.ts +35 -0
- package/dist-lib/ui/windows/panels/VariablesView.d.ts +21 -0
- package/dist-lib/ui/windows/panels/VfsModulePickerModal.d.ts +8 -0
- package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +23 -0
- package/dist-lib/ui/windows/types.d.ts +145 -0
- package/dist-lib/utils/documentTitle.d.ts +33 -0
- package/dist-lib/utils/fontLoader.d.ts +52 -0
- package/dist-lib/utils/profileLock.d.ts +26 -0
- package/dist-lib/utils/sessionCredentials.d.ts +16 -0
- package/dist-lib/version.d.ts +39 -0
- package/dist-lib/vfs-sw.js +131 -0
- package/dist-lib/vite.d.ts +2 -0
- package/dist-lib/vite.js +154 -0
- package/package.json +93 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n={},r={};r.byteLength=d,r.toByteArray=p,r.fromByteArray=ee;for(var i=[],a=[],o=typeof Uint8Array<`u`?Uint8Array:Array,s=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,c=0,l=s.length;c<l;++c)i[c]=s[c],a[s.charCodeAt(c)]=c;a[45]=62,a[95]=63;function u(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function d(e){var t=u(e),n=t[0],r=t[1];return(n+r)*3/4-r}function f(e,t,n){return(t+n)*3/4-n}function p(e){var t,n=u(e),r=n[0],i=n[1],s=new o(f(e,r,i)),c=0,l=i>0?r-4:r,d;for(d=0;d<l;d+=4)t=a[e.charCodeAt(d)]<<18|a[e.charCodeAt(d+1)]<<12|a[e.charCodeAt(d+2)]<<6|a[e.charCodeAt(d+3)],s[c++]=t>>16&255,s[c++]=t>>8&255,s[c++]=t&255;return i===2&&(t=a[e.charCodeAt(d)]<<2|a[e.charCodeAt(d+1)]>>4,s[c++]=t&255),i===1&&(t=a[e.charCodeAt(d)]<<10|a[e.charCodeAt(d+1)]<<4|a[e.charCodeAt(d+2)]>>2,s[c++]=t>>8&255,s[c++]=t&255),s}function m(e){return i[e>>18&63]+i[e>>12&63]+i[e>>6&63]+i[e&63]}function h(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(m(r));return i.join(``)}function ee(e){for(var t,n=e.length,r=n%3,a=[],o=16383,s=0,c=n-r;s<c;s+=o)a.push(h(e,s,s+o>c?c:s+o));return r===1?(t=e[n-1],a.push(i[t>>2]+i[t<<4&63]+`==`)):r===2&&(t=(e[n-2]<<8)+e[n-1],a.push(i[t>>10]+i[t>>4&63]+i[t<<2&63]+`=`)),a.join(``)}var te={}
|
|
2
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
3
|
+
/*!
|
|
4
|
+
* The buffer module from node.js, for the browser.
|
|
5
|
+
*
|
|
6
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
7
|
+
* @license MIT
|
|
8
|
+
*/
|
|
9
|
+
;te.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},te.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=+(t<0||t===0&&1/t<0);for(t=Math.abs(t),isNaN(t)||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128},(function(e){let t=r,n=te,i=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=d,e.SlowBuffer=ie,e.INSPECT_MAX_BYTES=50;let a=2147483647;e.kMaxLength=a;let{Uint8Array:o,ArrayBuffer:s,SharedArrayBuffer:c}=globalThis;d.TYPED_ARRAY_SUPPORT=l(),!d.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function l(){try{let e=new o(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,o.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function u(e){if(e>a)throw RangeError(`The value "`+e+`" is invalid for option "size"`);let t=new o(e);return Object.setPrototypeOf(t,d.prototype),t}function d(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return h(e)}return f(e,t,n)}d.poolSize=8192;function f(e,t,n){if(typeof e==`string`)return ee(e,t);if(s.isView(e))return _(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(B(e,s)||e&&B(e.buffer,s)||c!==void 0&&(B(e,c)||e&&B(e.buffer,c)))return ne(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);let r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return d.from(r,t,n);let i=re(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return d.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}d.from=function(e,t,n){return f(e,t,n)},Object.setPrototypeOf(d.prototype,o.prototype),Object.setPrototypeOf(d,o);function p(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function m(e,t,n){return p(e),e<=0||t===void 0?u(e):typeof n==`string`?u(e).fill(t,n):u(e).fill(t)}d.alloc=function(e,t,n){return m(e,t,n)};function h(e){return p(e),u(e<0?0:v(e)|0)}d.allocUnsafe=function(e){return h(e)},d.allocUnsafeSlow=function(e){return h(e)};function ee(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!d.isEncoding(t))throw TypeError(`Unknown encoding: `+t);let n=ae(e,t)|0,r=u(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function g(e){let t=e.length<0?0:v(e.length)|0,n=u(t);for(let r=0;r<t;r+=1)n[r]=e[r]&255;return n}function _(e){if(B(e,o)){let t=new o(e);return ne(t.buffer,t.byteOffset,t.byteLength)}return g(e)}function ne(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);let r;return r=t===void 0&&n===void 0?new o(e):n===void 0?new o(e,t):new o(e,t,n),Object.setPrototypeOf(r,d.prototype),r}function re(e){if(d.isBuffer(e)){let t=v(e.length)|0,n=u(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||V(e.length)?u(0):g(e);if(e.type===`Buffer`&&Array.isArray(e.data))return g(e.data)}function v(e){if(e>=a)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+a.toString(16)+` bytes`);return e|0}function ie(e){return+e!=e&&(e=0),d.alloc(+e)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype},d.compare=function(e,t){if(B(e,o)&&(e=d.from(e,e.offset,e.byteLength)),B(t,o)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},d.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},d.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return d.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let r=d.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(B(t,o))i+t.length>r.length?(d.isBuffer(t)||(t=d.from(t)),t.copy(r,i)):o.prototype.set.call(r,t,i);else if(d.isBuffer(t))t.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=t.length}return r};function ae(e,t){if(d.isBuffer(e))return e.length;if(s.isView(e)||B(e,s))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);let n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;let i=!1;for(;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return F(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return R(e).length;default:if(i)return r?-1:F(e).length;t=(``+t).toLowerCase(),i=!0}}d.byteLength=ae;function oe(e,t,n){let r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return ge(this,t,n);case`utf8`:case`utf-8`:return fe(this,t,n);case`ascii`:return he(this,t,n);case`latin1`:case`binary`:return C(this,t,n);case`base64`:return de(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return w(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}d.prototype._isBuffer=!0;function y(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}d.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(let t=0;t<e;t+=2)y(this,t,t+1);return this},d.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},d.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},d.prototype.toString=function(){let e=this.length;return e===0?``:arguments.length===0?fe(this,0,e):oe.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(e){if(!d.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:d.compare(this,e)===0},d.prototype.inspect=function(){let t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},i&&(d.prototype[i]=d.prototype.inspect),d.prototype.compare=function(e,t,n,r,i){if(B(e,o)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,s=n-t,c=Math.min(a,s),l=this.slice(r,i),u=e.slice(t,n);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],s=u[e];break}return a<s?-1:+(s<a)};function b(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,V(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=d.from(t,r)),d.isBuffer(t))return t.length===0?-1:x(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof o.prototype.indexOf==`function`?i?o.prototype.indexOf.call(e,t,n):o.prototype.lastIndexOf.call(e,t,n):x(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function x(e,t,n,r,i){let a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}let l;if(i){let r=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,r===-1?0:l-r)){if(r===-1&&(r=l),l-r+1===s)return r*a}else r!==-1&&(l-=l-r),r=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){let n=!0;for(let r=0;r<s;r++)if(c(e,l+r)!==c(t,r)){n=!1;break}if(n)return l}return-1}d.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},d.prototype.indexOf=function(e,t,n){return b(this,e,t,n,!0)},d.prototype.lastIndexOf=function(e,t,n){return b(this,e,t,n,!1)};function se(e,t,n,r){n=Number(n)||0;let i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;let a=t.length;r>a/2&&(r=a/2);let o;for(o=0;o<r;++o){let r=parseInt(t.substr(o*2,2),16);if(V(r))return o;e[n+o]=r}return o}function S(e,t,n,r){return z(F(t,e.length-n),e,n,r)}function ce(e,t,n,r){return z(I(t),e,n,r)}function le(e,t,n,r){return z(R(t),e,n,r)}function ue(e,t,n,r){return z(L(t,e.length-n),e,n,r)}d.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);let i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;let a=!1;for(;;)switch(r){case`hex`:return se(this,e,t,n);case`utf8`:case`utf-8`:return S(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return ce(this,e,t,n);case`base64`:return le(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return ue(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},d.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function de(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function fe(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],(n&192)==128&&(c=(t&31)<<6|n&63,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],(n&192)==128&&(r&192)==128&&(c=(t&15)<<12|(n&63)<<6|r&63,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(n&192)==128&&(r&192)==128&&(s&192)==128&&(c=(t&15)<<18|(n&63)<<12|(r&63)<<6|s&63,c>65535&&c<1114112&&(a=c))}}a===null?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a),i+=o}return me(r)}let pe=4096;function me(e){let t=e.length;if(t<=pe)return String.fromCharCode.apply(String,e);let n=``,r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=pe));return n}function he(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function C(e,t,n){let r=``;n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function ge(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i=``;for(let r=t;r<n;++r)i+=Ce[e[r]];return i}function w(e,t,n){let r=e.slice(t,n),i=``;for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+r[e+1]*256);return i}d.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,d.prototype),r};function T(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},d.prototype.readUintBE=d.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||T(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=H(function(e){e>>>=0,N(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,i=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),d.prototype.readBigUInt64BE=H(function(e){e>>>=0,N(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],i=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),d.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},d.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||T(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},d.prototype.readInt8=function(e,t){return e>>>=0,t||T(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||T(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},d.prototype.readInt16BE=function(e,t){e>>>=0,t||T(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=H(function(e){e>>>=0,N(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),d.prototype.readBigInt64BE=H(function(e){e>>>=0,N(e,`offset`);let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&P(e,this.length-8);let r=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)}),d.prototype.readFloatLE=function(e,t){return e>>>=0,t||T(e,4,this.length),n.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||T(e,4,this.length),n.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||T(e,8,this.length),n.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||T(e,8,this.length),n.read(this,e,!1,52,8)};function E(e,t,n,r,i,a){if(!d.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;E(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=e&255;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){let r=2**(8*n)-1;E(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=e&255;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,1,255,0),this[t]=e&255,t+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function D(e,t,n,r,i){M(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function _e(e,t,n,r,i){M(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}d.prototype.writeBigUInt64LE=H(function(e,t=0){return D(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeBigUInt64BE=H(function(e,t=0){return _e(this,e,t,BigInt(0),BigInt(`0xffffffffffffffff`))}),d.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);E(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=e&255;++i<n&&(a*=256);)e<0&&o===0&&this[t+i-1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},d.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){let r=2**(8*n-1);E(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=e&255;--i>=0&&(a*=256);)e<0&&o===0&&this[t+i+1]!==0&&(o=1),this[t+i]=(e/a>>0)-o&255;return t+n},d.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},d.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},d.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||E(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},d.prototype.writeBigInt64LE=H(function(e,t=0){return D(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))}),d.prototype.writeBigInt64BE=H(function(e,t=0){return _e(this,e,t,-BigInt(`0x8000000000000000`),BigInt(`0x7fffffffffffffff`))});function O(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function k(e,t,r,i,a){return t=+t,r>>>=0,a||O(e,t,r,4),n.write(e,t,r,i,23,4),r+4}d.prototype.writeFloatLE=function(e,t,n){return k(this,e,t,!0,n)},d.prototype.writeFloatBE=function(e,t,n){return k(this,e,t,!1,n)};function ve(e,t,r,i,a){return t=+t,r>>>=0,a||O(e,t,r,8),n.write(e,t,r,i,52,8),r+8}d.prototype.writeDoubleLE=function(e,t,n){return ve(this,e,t,!0,n)},d.prototype.writeDoubleBE=function(e,t,n){return ve(this,e,t,!1,n)},d.prototype.copy=function(e,t,n,r){if(!d.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&typeof o.prototype.copyWithin==`function`?this.copyWithin(t,n,r):o.prototype.set.call(e,this.subarray(n,r),t),i},d.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!d.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){let t=e.charCodeAt(0);(r===`utf8`&&t<128||r===`latin1`)&&(e=t)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;let i;if(typeof e==`number`)for(i=t;i<n;++i)this[i]=e;else{let a=d.isBuffer(e)?e:d.from(e,r),o=a.length;if(o===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let A={};function j(e,t,n){A[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}j(`ERR_BUFFER_OUT_OF_BOUNDS`,function(e){return e?`${e} is outside of buffer bounds`:`Attempt to access memory outside buffer bounds`},RangeError),j(`ERR_INVALID_ARG_TYPE`,function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),j(`ERR_OUT_OF_RANGE`,function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=ye(String(n)):typeof n==`bigint`&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=ye(i)),i+=`n`),r+=` It must be ${t}. Received ${i}`,r},RangeError);function ye(e){let t=``,n=e.length,r=+(e[0]===`-`);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function be(e,t,n){N(t,`offset`),(e[t]===void 0||e[t+n]===void 0)&&P(t,e.length-(n+1))}function M(e,t,n,r,i,a){if(e>n||e<t){let r=typeof t==`bigint`?`n`:``,i;throw i=a>3?t===0||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${(a+1)*8}${r}`:`>= -(2${r} ** ${(a+1)*8-1}${r}) and < 2 ** ${(a+1)*8-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new A.ERR_OUT_OF_RANGE(`value`,i,e)}be(r,i,a)}function N(e,t){if(typeof e!=`number`)throw new A.ERR_INVALID_ARG_TYPE(t,`number`,e)}function P(e,t,n){throw Math.floor(e)===e?t<0?new A.ERR_BUFFER_OUT_OF_BOUNDS:new A.ERR_OUT_OF_RANGE(n||`offset`,`>= ${+!!n} and <= ${t}`,e):(N(e,n),new A.ERR_OUT_OF_RANGE(n||`offset`,`an integer`,e))}let xe=/[^+/0-9A-Za-z-_]/g;function Se(e){if(e=e.split(`=`)[0],e=e.trim().replace(xe,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function F(e,t){t||=1/0;let n,r=e.length,i=null,a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function I(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function L(e,t){let n,r,i,a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function R(e){return t.toByteArray(Se(e))}function z(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function B(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function V(e){return e!==e}let Ce=(function(){let e=`0123456789abcdef`,t=Array(256);for(let n=0;n<16;++n){let r=n*16;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t})();function H(e){return typeof BigInt>`u`?we:e}function we(){throw Error(`BigInt not supported`)}})(n),n.Buffer,n.Blob,n.BlobOptions;const g=n.Buffer;n.File,n.FileOptions,n.INSPECT_MAX_BYTES,n.SlowBuffer,n.TranscodeEncoding,n.atob,n.btoa,n.constants,n.isAscii,n.isUtf8,n.kMaxLength,n.kStringMaxLength,n.resolveObjectURL,n.transcode;function _(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function ne(e){if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(Array.isArray(e))return Uint8Array.from(e);throw TypeError(`Expected Uint8Array, ArrayBuffer, TypedArray, or number[]`)}const re=new TextEncoder,v=new TextDecoder(`utf-8`);function ie(e){return re.encode(e)}function ae(e){return v.decode(e)}function oe(e){let t=new Uint8Array(e.length*2),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setUint16(t*2,e.charCodeAt(t),!1);return t}function y(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=[];for(let r=0;r+1<e.byteLength;r+=2)n.push(t.getUint16(r,!1));let r=``,i=8192;for(let e=0;e<n.length;e+=i)r+=String.fromCharCode(...n.slice(e,e+i));return r}function b(e){let t=new Uint8Array(1);return new DataView(t.buffer).setInt8(0,e),t}function x(e){let t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e&65535,!1),t}function se(e){let t=new Uint8Array(4);return new DataView(t.buffer).setInt32(0,e,!1),t}function S(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e>>>0,!1),t}function ce(e){let t=new Uint8Array(8);return new DataView(t.buffer).setBigInt64(0,BigInt.asIntN(64,BigInt(e)),!1),t}function le(e){let t=new Uint8Array(8);return new DataView(t.buffer).setBigUint64(0,BigInt.asUintN(64,BigInt(e)),!1),t}function ue(e){let t=new Uint8Array(8);return new DataView(t.buffer).setFloat64(0,e,!1),t}var de=t({ReadBuffer:()=>fe}),fe=class{buffer;view;read_offset;constructor(e){this.buffer=ne(e),this.view=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),this.read_offset=0}remaining(){return this.read_offset>=this.buffer.byteLength?null:this.buffer.subarray(this.read_offset)}readInt8(){let e=this.view.getInt8(this.read_offset);return this.read_offset+=1,e}readInt16BE(){let e=this.view.getInt16(this.read_offset,!1);return this.read_offset+=2,e}readUInt16BE(){let e=this.view.getUint16(this.read_offset,!1);return this.read_offset+=2,e}readInt32BE(){let e=this.view.getInt32(this.read_offset,!1);return this.read_offset+=4,e}readUInt32BE(){let e=this.view.getUint32(this.read_offset,!1);return this.read_offset+=4,e}readInt64BE(){let e=this.view.getBigInt64(this.read_offset,!1);return this.read_offset+=8,e}readUInt64BE(){let e=this.view.getBigUint64(this.read_offset,!1);return this.read_offset+=8,e}readDoubleBE(){let e=this.view.getFloat64(this.read_offset,!1);return this.read_offset+=8,e}slice(e){let t=this.buffer.subarray(this.read_offset,this.read_offset+e);return this.read_offset+=e,t}};function pe(e){return(typeof e==`string`?e:ae(e)).replace(`\0`,``)}function me(e){let t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate(),i=Math.floor((14-n)/12),a=Math.floor(t+4800-i),o=n+12*i-3;return r+Math.floor((153*o+2)/5)+365*a+Math.floor(a/4)-Math.floor(a/100)+Math.floor(a/400)-32045}function he(e){let t=1461,n=4*(e+1401+Math.floor(Math.floor((4*e+274277)/146097)*3/4)+-38)+3,r=5*Math.floor(n%t/4)+2,i=Math.floor(r%153/5)+1,a=(Math.floor(r/153)+2)%12+1,o=Math.floor(n/t)-4716+Math.floor((14-a)/12);return new Date(o,a-1,i)}const C={INVALID:0,BOOL:1,INT:2,UINT:3,INT64:4,UINT64:5,DOUBLE:6,CHAR:7,MAP:8,LIST:9,STRING:10,STRINGLIST:11,BYTEARRAY:12,TIME:15,DATETIME:16,USERTYPE:127,SHORT:133};function ge(e){return e!=null&&typeof e.export==`function`?e.export():e}var w=class{__obj;static qtype;static types=new Map;constructor(e){this.__obj=e}static from(e,t=!1){let n=this;return e instanceof n&&!t||(e=ge(e),e instanceof n)?e:new n(e)}static read(e,t){throw Error(`${this.name}.read() is not implemented`)}};function T(e){return function(t){e!==void 0&&w.types.set(e,t),t.qtype=e}}var E=class extends w{static read(e){}toBuffer(){return new Uint8Array}};T(C.INVALID)(E);var D=class extends w{static read(e){return!!e.readInt8()}toBuffer(){return b(+!!this.__obj)}};T(C.BOOL)(D);var _e=class extends w{static read(e){return e.readInt16BE()}toBuffer(){return x(this.__obj)}};T(C.SHORT)(_e);var O=class extends w{static read(e){return e.readInt32BE()}toBuffer(){return se(this.__obj)}};T(C.INT)(O);var k=class extends w{static read(e){return e.readUInt32BE()}toBuffer(){return S(this.__obj)}};T(C.UINT)(k);var ve=class extends w{static read(e){return e.readInt64BE()}toBuffer(){return ce(this.__obj)}};T(C.INT64)(ve);var A=class extends w{static read(e){return e.readUInt64BE()}toBuffer(){return le(this.__obj)}};T(C.UINT64)(A);var j=class extends w{static read(e){return e.readDoubleBE()}toBuffer(){return ue(this.__obj)}};T(C.DOUBLE)(j);var ye=class extends w{constructor(e){if(super(e),typeof this.__obj!=`string`)throw Error(`${this.__obj} is not a string`);if(this.__obj.length!==1)throw Error(`${this.__obj} length must equal 1`)}static read(e){return y(e.slice(2))}toBuffer(){return oe(this.__obj)}};T(C.CHAR)(ye);var be=class extends k{};T(C.TIME)(be);var M=class extends w{static read(e){let t=k.read(e);return t===0||t===4294967295?null:e.slice(t)}toBuffer(){if(this.__obj===null)return S(4294967295);let e=typeof this.__obj==`string`?ie(this.__obj):ne(this.__obj);return _([S(e.length),e])}};T(C.BYTEARRAY)(M);var N=class extends w{static read(e){let t=k.read(e);return t===0||t===4294967295?``:y(e.slice(t))}toBuffer(){if(this.__obj===null)return S(4294967295);let e=oe(typeof this.__obj==`number`?String(this.__obj):this.__obj);return _([S(e.length),e])}};T(C.STRING)(N);var P=class extends w{static read(e){let t=k.read(e),n=Array(t);for(let r=0;r<t;r++)n[r]=L.read(e);return n}static of(e){let t=typeof e==`string`?I.get(e):e,n=this;return class extends n{static from(e){return Array.isArray(e)&&(e=e.map(e=>ge(t.from(e)))),n.from(e)}}}toBuffer(){let e=[S(this.__obj.length)];for(let t of this.__obj)e.push(L.from(t).toBuffer());return _(e)}};T(C.LIST)(P);var xe=class extends w{static read(e){let t=k.read(e),n=Array(t);for(let r=0;r<t;r++)n[r]=N.read(e);return n}toBuffer(){let e=[S(this.__obj.length)];for(let t of this.__obj)e.push(N.from(t).toBuffer());return _(e)}};T(C.STRINGLIST)(xe);var Se=class extends w{static read(e){let t=k.read(e),n=k.read(e);D.read(e);let r=he(t);return r.setMilliseconds(n),r}toBuffer(){let e=this.__obj,t=(e.getTime()-e.getTimezoneOffset()*6e4)%864e5;return _([S(me(e)),S(t),D.from(e.getTimezoneOffset()===0).toBuffer()])}};T(C.DATETIME)(Se);var F=class extends w{static read(e){let t=k.read(e),n={};for(let r=0;r<t;r++){let t=N.read(e);n[t]=L.read(e)}return n}toBuffer(){let e=[];if(this.__obj instanceof Map){e.push(S(this.__obj.size));for(let[t,n]of this.__obj)e.push(N.from(t).toBuffer()),e.push(L.from(n).toBuffer())}else{let t=this.__obj?Object.keys(this.__obj):[];e.push(S(t.length));for(let n of t)e.push(N.from(n).toBuffer()),e.push(L.from(this.__obj[n]).toBuffer())}return _(e)}};T(C.MAP)(F);var I=class e extends w{name;static usertypes=new Map;constructor(e,t){super(t),this.name=e}static from(t){return t instanceof e?t:new this(t)}static createComplexUserType(t,n){let r=[];for(let t of n){let[n]=Object.keys(t),i={key:n,quserclass:void 0};if(typeof t[n]==`string`?(i.quserclassname=t[n],i.quserclass=e.usertypes.get(t[n])):i.quserclass=w.types.get(t[n]),!i.quserclass)throw Error(`Type ${t[n]} does not exists`);r.push(i)}return class extends e{constructor(e){super(t,e)}static read(e){let t={};for(let n of r)t[n.key]=n.quserclass.read(e,n.quserclassname);return t}toBuffer(e=!1){let t=[this._getNameBuffer(e)];for(let e of r)t.push(e.quserclass.from(this.__obj[e.key]).toBuffer(!0));return _(t)}}}static createUserType(t,n){if(Array.isArray(n))return e.createComplexUserType(t,n);let r=w.types.get(n);return class extends e{constructor(e){super(t,e)}static read(e){return r.read(e)}toBuffer(e=!1){return _([this._getNameBuffer(e),r.from(this.__obj).toBuffer(!0)])}}}static register(t,n){e.usertypes.set(t,e.createUserType(t,n))}static get(t){return e.usertypes.get(t)}static read(t,n){n||=pe(M.read(t)??new Uint8Array);let r=e.usertypes.get(n);if(!r)throw Error(`Unregistered usertype ${n}`);return r.read(t)}_getNameBuffer(e){if(!this.name)throw Error(`Abstract QUserType cannot be converted to a buffer`);return e?new Uint8Array:M.from(this.name).toBuffer()}toBuffer(t=!1){return _([this._getNameBuffer(t),e.usertypes.get(this.name).from(this.__obj).toBuffer(!0)])}};T(C.USERTYPE)(I);var L=class e extends w{static coerceNumbersClass=k;static coerceNumbersTo(t){let n=w.types.get(t);if(n===void 0)throw Error(`undefined type ${t}`);e.coerceNumbersClass=n}static read(e){let t=k.read(e);return D.read(e),w.types.get(t).read(e)}toBuffer(){let t=this.__obj===void 0||this.__obj===null,n=typeof this.__obj,r;if(this.__obj===void 0)r=E;else if(this.__obj instanceof I)r=I;else if(this.__obj instanceof e)throw Error(`Can't nest QVariant`);else r=this.__obj instanceof w?this.__obj.constructor:n===`string`?N:n===`bigint`?ve:n===`number`?e.coerceNumbersClass:n===`boolean`?D:this.__obj instanceof Date?Se:Array.isArray(this.__obj)?P:F;let i=[S(r.qtype),D.from(t).toBuffer()];return t||i.push(r.from(this.__obj).toBuffer()),_(i)}},R=class extends w{static read(e){return e.readInt8()}toBuffer(){return b(this.__obj)}},z=class extends w{static read(e){return e.readUInt16BE()}toBuffer(){return x(this.__obj)}},B=class extends w{static read(e){return{spec:R.read(e),alpha:z.read(e)>>8,r:z.read(e)>>8,g:z.read(e)>>8,b:z.read(e)>>8,pad:z.read(e)>>8}}toBuffer(){let e=this.__obj,t=[];return t.push(R.from(e.spec).toBuffer(!1)),t.push(z.from(e.alpha*257).toBuffer(!1)),t.push(z.from(e.r*257).toBuffer(!1)),t.push(z.from(e.g*257).toBuffer(!1)),t.push(z.from(e.b*257).toBuffer(!1)),t.push(z.from((e.pad??0)*257).toBuffer(!1)),_(t)}},V=class extends N{toBuffer(){return this.__obj===``?k.from(4294967295).toBuffer():super.toBuffer()}},Ce=class extends w{static read(e){let t=V.read(e),n=V.read(e),r=j.read(e),i=O.read(e),a=R.read(e),o=z.read(e);e.readInt8();let s=e.readInt8()>>>0,c=e.readInt8()>>>0,l=e.readUInt16BE(),u=e.readInt8()>>>0;return{family:t,style:n,pointSize:r,pixelSize:i,styleHint:a,styleStrategy:o,weight:s,fontBits:c,stretch:l,extendedFontBits:u,letterSpacing:O.read(e),wordSpacing:O.read(e),hintingPreference:e.readInt8()>>>0,capital:e.readInt8()>>>0,styleSetting:(c&1)!=0,underline:(c&2)!=0,overline:(c&64)!=0,strikeOut:(c&4)!=0,fixedPitch:(c&8)!=0,kerning:(c&16)!=0,styleOblique:(c&128)!=0,ignorePitch:(u&1)!=0,letterSpacingIsAbsolute:(u&2)!=0}}toBuffer(){let e=this.__obj;return _([V.from(e.family).toBuffer(),V.from(e.style).toBuffer(),j.from(e.pointSize).toBuffer(),O.from(e.pixelSize).toBuffer(),R.from(e.styleHint).toBuffer(),z.from(e.styleStrategy).toBuffer(),new Uint8Array(1),b(e.weight),b(e.fontBits),x(e.stretch),b(e.extendedFontBits),O.from(e.letterSpacing).toBuffer(),O.from(e.wordSpacing).toBuffer(),b(e.hintingPreference),b(e.capital)])}},H=class extends w{static read(e){return[j.read(e),j.read(e)]}toBuffer(){let[e,t]=this.__obj;return _([j.from(e).toBuffer(),j.from(t).toBuffer()])}},we=class extends w{static read(e){return[j.read(e),j.read(e),j.read(e)]}toBuffer(){let[e,t,n]=this.__obj;return _([j.from(e).toBuffer(),j.from(t).toBuffer(),j.from(n).toBuffer()])}},Te=class extends w{static read(e){k.read(e);let t=e.read_offset;if(e.readUInt32BE()!==2303741511)return e.read_offset-=4,``;for(;e.readUInt32BE()!==1229278788;)e.read_offset-=3;let n=e.read_offset;e.read_offset=t;let r=n-t;return e.slice(r+4)}toBuffer(){let e=this.__obj;return _([k.from(1).toBuffer(),e===``?new Uint8Array:e])}};const U={...C,POINT:25,FONT:64,PIXMAP:65,COLOR:67,VECTOR:84};let Ee=!1;function De(){Ee||(Ee=!0,T(U.POINT)(H),T(U.FONT)(Ce),T(U.PIXMAP)(Te),T(U.COLOR)(B),T(U.VECTOR)(we))}function Oe(e){return class extends w{static read(t){let n=O.read(t),r={};for(let i=0;i<n;i++){let n=O.read(t),i=O.read(t);r[i]=[];for(let a=0;a<n;a++)r[i].push(I.get(e).read(t))}return r}toBuffer(){let t=this.__obj,n=[];n.push(O.from(Object.keys(t).length).toBuffer());for(let r of Object.keys(t)){let i=parseInt(r);n.push(O.from(t[i].length).toBuffer()),n.push(O.from(i).toBuffer());for(let r of t[i])n.push(I.get(e).from(r).toBuffer(!0))}return _(n)}}}function ke(e){return class extends w{static read(t){let n={},r=O.read(t);for(let i=0;i<r;i++){let r=O.read(t);n[r]=I.get(e).read(t)}return n}toBuffer(){let t=this.__obj,n=[];n.push(O.from(Object.keys(t).length).toBuffer());for(let[r,i]of Object.entries(t).sort((e,t)=>parseInt(e[0])-parseInt(t[0])))n.push(O.from(parseInt(r)).toBuffer()),n.push(I.get(e).from(i).toBuffer(!0));return _(n)}}}function Ae(e){return class extends w{static read(t){let n={};for(;t.buffer.length>t.read_offset;){let r=O.read(t);n[r]=I.get(e).read(t)}return n}toBuffer(){let t=this.__obj,n=[];for(let[r,i]of Object.entries(t).reverse())n.push(O.from(parseInt(r)).toBuffer()),n.push(I.get(e).from(i).toBuffer(!0));return _(n)}}}let W=1e3;const G={},K={},je={},Me={};function q(e){return typeof e==`number`||!e.qtype?w.types.get(e):e}function Ne(e,t){return parseInt(e[0])===-1?-1:parseInt(t[0])===-1?1:parseInt(e[0])-parseInt(t[0])}function Pe(e,t){return class extends w{static read(n){let r={},i=k.read(n);for(let a=0;a<i;a++){let i=e.read(n),a=t.read(n);r[i]===void 0&&(r[i]=[]),r[i].push(a)}return r}toBuffer(){let n=[],r=this.__obj;if(r instanceof Map){n.push(k.from(r.size).toBuffer());for(let[i,a]of r)n.push(e.from(i).toBuffer()),n.push(t.from(a).toBuffer())}else{let i=0;for(let[a,o]of Object.entries(r).reverse())for(let r of o)i++,n.push(e.from(a).toBuffer()),n.push(t.from(r).toBuffer());n.unshift(k.from(i).toBuffer())}return _(n)}}}function Fe(e,t){return class extends w{static read(n){let r={},i=k.read(n);for(let a=0;a<i;a++){let i=e.read(n);r[i]=t.read(n)}return r}toBuffer(){let n=[],r=this.__obj;if(r instanceof Map){n.push(k.from(r.size).toBuffer());for(let[i,a]of r)n.push(e.from(i).toBuffer()),n.push(t.from(a).toBuffer())}else{let i=Object.entries(r);n.push(k.from(i.length).toBuffer());for(let[r,a]of i.sort(Ne))n.push(e.from(r).toBuffer()),n.push(t.from(a).toBuffer())}return _(n)}}}function Ie(e){return class extends w{static read(t){let n=[],r=k.read(t);for(let i=0;i<r;i++)n.push(e.read(t));return n}toBuffer(){let t=[],n=this.__obj;t.push(k.from(n.length).toBuffer());for(let r of n)t.push(e.from(r).toBuffer());return _(t)}}}function Le(e,t){return class extends w{static read(n){return[e.read(n),t.read(n)]}toBuffer(){let n=this.__obj;return _([e.from(n[0]).toBuffer(),t.from(n[1]).toBuffer()])}}}function Re(e,t){let n=q(e),r=q(t),i=String(n),a=String(r);if(K[i]||(K[i]={}),!K[i][a]){let e=Pe(n,r),t=W++;T(t)(e),K[i][a]=t}return K[i][a]}function J(e,t,n){let r=q(e),i=q(t),a=String(r),o=String(i);if(G[a]||(G[a]={}),!G[a][o]){let e=Fe(r,i),t=W++;T(t)(e),G[a][o]=t}return G[a][o]}function Y(e){let t=String(e);if(!je[t]){let n=Ie(e),r=W++;T(r)(n),je[t]=r}return je[t]}function ze(e,t){let n=`${e.name}#${t.name}`;if(!Me[n]){let r=Le(e,t),i=W++;T(i)(r),Me[n]=i}return Me[n]}const Be=new Map;function Ve(e){Be.set(e.version,e)}function He(e){return Be.get(e)}function Ue(){return[...Be.keys()].sort((e,t)=>e-t)}De();const We={"dot line":3,"dash line":2,"dash dot line":4,"dash dot dot line":5},Ge={N:`n`,E:`e`,S:`s`,W:`w`,UP:`up`,DOWN:`down`,NE:`ne`,SE:`se`,SW:`sw`,NW:`nw`,IN:`in`,OUT:`out`},Ke=`system.fallback_symbol`;function qe(e){let t={};for(let n of Object.keys(e))t[Ge[n]??n]=e[n];return t}const Je={family:`Bitstream Vera Sans Mono`,style:``,pointSize:10,pixelSize:-1,styleHint:0,styleStrategy:0,weight:50,fontBits:0,stretch:0,extendedFontBits:0,letterSpacing:0,wordSpacing:0,hintingPreference:0,capital:0,styleSetting:!1,underline:!1,overline:!1,strikeOut:!1,fixedPitch:!0,kerning:!1,styleOblique:!1,ignorePitch:!1,letterSpacingIsAbsolute:!1};var Ye=class extends w{static read(e){let t=e.readInt8();return t>32?String.fromCodePoint(t):``}toBuffer(){throw Error(`writing legacy Mudlet map versions is not supported`)}},Xe=class extends w{static read(e){let t=k.read(e),n=[];for(let r=0;r<t;r++)n.push(O.read(e));return n.length>=3?{spec:1,alpha:255,r:n[0],g:n[1],b:n[2],pad:0}:{spec:1,alpha:255,r:255,g:0,b:0,pad:0}}toBuffer(){throw Error(`writing legacy Mudlet map versions is not supported`)}},Ze=class extends w{static read(e){return We[V.read(e)]??1}toBuffer(){throw Error(`writing legacy Mudlet map versions is not supported`)}},Qe=class extends w{static read(e){return O.read(e),{}}toBuffer(){throw Error(`writing legacy Mudlet map versions is not supported`)}};const X={SYMBOL_BYTE:300,COLOR_INTLIST:301,STYLE_STRING:302,ROOM_ID:303};let $e=!1;function et(){$e||($e=!0,T(X.SYMBOL_BYTE)(Ye),T(X.COLOR_INTLIST)(Xe),T(X.STYLE_STRING)(Ze),T(X.ROOM_ID)(Qe))}const tt={16:{hasMapUserData:!1,hasMapFont:!1,modernRoomIdHash:!1,modernArea:!1,stringSymbol:!1},17:{hasMapUserData:!0,hasMapFont:!1,modernRoomIdHash:!1,modernArea:!0,stringSymbol:!1},18:{hasMapUserData:!0,hasMapFont:!1,modernRoomIdHash:!0,modernArea:!0,stringSymbol:!1},19:{hasMapUserData:!0,hasMapFont:!0,modernRoomIdHash:!0,modernArea:!0,stringSymbol:!0}};function nt(e,t){if(t.hasMapUserData||(e.mUserData={}),t.hasMapFont||(e.mapSymbolFont={...Je},e.mapFontFudgeFactor=1,e.useOnlyMapFont=!1),!t.modernArea)for(let t of Object.values(e.areas)){let e=t;delete e.legacyForZUnused1,delete e.legacyForZUnused2,e.userData={}}}function rt(e,t){if(!t.stringSymbol&&e.userData){let t=e.userData[Ke];typeof t==`string`&&t.length>0&&(e.symbol=t),delete e.userData[Ke]}e.customLines=qe(e.customLines),e.customLinesArrow=qe(e.customLinesArrow),e.customLinesColor=qe(e.customLinesColor),e.customLinesStyle=qe(e.customLinesStyle)}function it(e){let t=tt[e];if(!t)throw Error(`No legacy config for Mudlet map version ${e}`);et();let n={MAP:`MudletMap@${e}`,HEADER:`MudletMapHeader@${e}`,AREA:`MudletArea@${e}`,ROOM:`MudletRoom@${e}`,LABEL:`MudletLabel@${e}`},r={LABELS:e*10,ROOMS:e*10+1,AREAS:e*10+2};T(r.LABELS)(Oe(n.LABEL)),T(r.ROOMS)(Ae(n.ROOM)),T(r.AREAS)(ke(n.AREA));let i=[{rooms:Y(k)},{zLevels:Y(O)},{mAreaExits:Re(O,ze(O,O))},{gridMode:U.BOOL},{max_x:U.INT},{max_y:U.INT},{max_z:U.INT},{min_x:U.INT},{min_y:U.INT},{min_z:U.INT},{span:U.VECTOR}];t.modernArea?i.push({xmaxForZ:J(O,O)},{ymaxForZ:J(O,O)},{xminForZ:J(O,O)},{yminForZ:J(O,O)}):i.push({xmaxForZ:J(O,O)},{ymaxForZ:J(O,O)},{legacyForZUnused1:J(O,O)},{xminForZ:J(O,O)},{yminForZ:J(O,O)},{legacyForZUnused2:J(O,O)}),i.push({pos:U.VECTOR},{isZone:U.BOOL},{zoneAreaRef:U.INT}),t.modernArea&&i.push({userData:J(V,V)}),I.register(n.AREA,i),I.register(n.ROOM,[{area:U.INT},{x:U.INT},{y:U.INT},{z:U.INT},{north:U.INT},{northeast:U.INT},{east:U.INT},{southeast:U.INT},{south:U.INT},{southwest:U.INT},{west:U.INT},{northwest:U.INT},{up:U.INT},{down:U.INT},{in:U.INT},{out:U.INT},{environment:U.INT},{weight:U.INT},{name:U.STRING},{isLocked:U.BOOL},{rawSpecialExits:Re(k,V)},{symbol:t.stringSymbol?U.STRING:X.SYMBOL_BYTE},{userData:J(V,V)},{customLines:J(V,Y(H))},{customLinesArrow:J(V,D)},{customLinesColor:J(V,Xe)},{customLinesStyle:J(V,Ze)},{exitLocks:Y(O)},{stubs:Y(O)},{exitWeights:J(V,O)},{doors:J(V,O)}]),I.register(n.LABEL,[{id:U.INT},{pos:U.VECTOR},{dummy1:U.DOUBLE},{dummy2:U.DOUBLE},{size:ze(j,j)},{text:U.STRING},{fgColor:U.COLOR},{bgColor:U.COLOR},{pixMap:U.PIXMAP},{noScaling:U.BOOL},{showOnTop:U.BOOL}]);let a=[{version:U.INT},{envColors:J(O,O)},{areaNames:J(O,V,!0)},{mCustomEnvColors:J(O,B)},{mpRoomDbHashToRoomId:J(V,k)}];t.hasMapUserData&&a.push({mUserData:J(V,V)}),t.hasMapFont&&a.push({mapSymbolFont:U.FONT},{mapFontFudgeFactor:U.DOUBLE},{useOnlyMapFont:U.BOOL}),a.push({areas:r.AREAS}),a.push(t.modernRoomIdHash?{mRoomIdHash:J(V,O)}:{mRoomIdHash:X.ROOM_ID}),a.push({labels:r.LABELS}),I.register(n.HEADER,a),I.register(n.MAP,[...a,{rooms:r.ROOMS}]),Ve({version:e,read:e=>{let r=I.read(e,n.MAP);nt(r,t);for(let e of Object.values(r.rooms))rt(e,t);return r},write:()=>{throw Error(`Writing Mudlet map version ${e} is not supported (read-only). Mudlet only saves the latest format.`)},readHeader:e=>{let r=I.read(e,n.HEADER);return nt(r,t),r},readRoom:e=>{let r=O.read(e),i=I.get(n.ROOM).read(e);return rt(i,t),{id:r,room:i}}})}it(16),it(17),it(18),it(19),De();const Z={MAP:`MudletMap@20`,HEADER:`MudletMapHeader@20`,AREA:`MudletArea@20`,ROOM:`MudletRoom@20`,LABEL:`MudletLabel@20`},Q={LABELS:200,ROOMS:201,AREAS:202};T(Q.LABELS)(Oe(Z.LABEL)),T(Q.ROOMS)(Ae(Z.ROOM)),T(Q.AREAS)(ke(Z.AREA)),I.register(Z.AREA,[{rooms:Y(k)},{zLevels:Y(O)},{mAreaExits:Re(O,ze(O,O))},{gridMode:U.BOOL},{max_x:U.INT},{max_y:U.INT},{max_z:U.INT},{min_x:U.INT},{min_y:U.INT},{min_z:U.INT},{span:U.VECTOR},{xmaxForZ:J(O,O)},{ymaxForZ:J(O,O)},{xminForZ:J(O,O)},{yminForZ:J(O,O)},{pos:U.VECTOR},{isZone:U.BOOL},{zoneAreaRef:U.INT},{userData:J(V,V)}]),I.register(Z.ROOM,[{area:U.INT},{x:U.INT},{y:U.INT},{z:U.INT},{north:U.INT},{northeast:U.INT},{east:U.INT},{southeast:U.INT},{south:U.INT},{southwest:U.INT},{west:U.INT},{northwest:U.INT},{up:U.INT},{down:U.INT},{in:U.INT},{out:U.INT},{environment:U.INT},{weight:U.INT},{name:U.STRING},{isLocked:U.BOOL},{rawSpecialExits:Re(k,V)},{symbol:U.STRING},{userData:J(V,V)},{customLines:J(V,Y(H))},{customLinesArrow:J(V,D)},{customLinesColor:J(V,B)},{customLinesStyle:J(V,k)},{exitLocks:Y(O)},{stubs:Y(O)},{exitWeights:J(V,O)},{doors:J(V,O)}]),I.register(Z.LABEL,[{id:U.INT},{pos:U.VECTOR},{dummy1:U.DOUBLE},{dummy2:U.DOUBLE},{size:ze(j,j)},{text:U.STRING},{fgColor:U.COLOR},{bgColor:U.COLOR},{pixMap:U.PIXMAP},{noScaling:U.BOOL},{showOnTop:U.BOOL}]);const at=[{version:U.INT},{envColors:J(O,O)},{areaNames:J(O,V,!0)},{mCustomEnvColors:J(O,B)},{mpRoomDbHashToRoomId:J(V,k)},{mUserData:J(V,V)},{mapSymbolFont:U.FONT},{mapFontFudgeFactor:U.DOUBLE},{useOnlyMapFont:U.BOOL},{areas:Q.AREAS},{mRoomIdHash:J(V,O)},{labels:Q.LABELS}];I.register(Z.HEADER,at),I.register(Z.MAP,[...at,{rooms:Q.ROOMS}]),Ve({version:20,read:e=>I.read(e,Z.MAP),write:e=>I.get(Z.MAP).from(e).toBuffer(!0),readHeader:e=>I.read(e,Z.HEADER),readRoom:e=>({id:O.read(e),room:I.get(Z.ROOM).read(e)})});const{ReadBuffer:ot}=de,st=[`north`,`northeast`,`east`,`southeast`,`south`,`southwest`,`west`,`northwest`,`up`,`down`,`in`,`out`],ct={north:1,northeast:2,northwest:3,east:4,west:5,south:6,southeast:7,southwest:8,up:9,down:10,in:11,out:12};function lt(e){for(let t in e.areas)Object.hasOwn(e.areas,t)&&(e.areas[t].mAreaExits={});for(let t in e.rooms){if(!Object.hasOwn(e.rooms,t))continue;let n=Number(t),r=e.rooms[n],i=e.areas[r.area];if(!i)continue;let a=[];for(let t of st){let n=r[t];if(!n||n<1)continue;let i=e.rooms[n];!i||i.area===r.area||a.push([n,ct[t]])}let o=r.mSpecialExits??{},s=Object.keys(o).sort();for(let t of s){let n=o[t];if(!n||n<1)continue;let i=e.rooms[n];!i||i.area===r.area||a.push([n,13])}a.length>0&&(i.mAreaExits[n]=a)}}function ut(e){for(let t in e.areas){if(!Object.hasOwn(e.areas,t))continue;let n=e.areas[t];n.xminForZ={},n.xmaxForZ={},n.yminForZ={},n.ymaxForZ={},n.zLevels=[];let r=!0;for(let t of n.rooms){let i=e.rooms[t];if(!i)continue;let a=i.x,o=-i.y,s=i.z;if(r){n.min_x=a,n.max_x=a,n.min_y=o,n.max_y=o,n.min_z=s,n.max_z=s,n.zLevels.push(s),n.xminForZ[s]=a,n.xmaxForZ[s]=a,n.yminForZ[s]=o,n.ymaxForZ[s]=o,r=!1;continue}n.zLevels.includes(s)||n.zLevels.push(s),(n.xminForZ[s]===void 0||a<n.xminForZ[s])&&(n.xminForZ[s]=a),a<n.min_x&&(n.min_x=a),(n.xmaxForZ[s]===void 0||a>n.xmaxForZ[s])&&(n.xmaxForZ[s]=a),a>n.max_x&&(n.max_x=a),(n.yminForZ[s]===void 0||o<n.yminForZ[s])&&(n.yminForZ[s]=o),o<n.min_y&&(n.min_y=o),o>n.max_y&&(n.max_y=o),(n.ymaxForZ[s]===void 0||o>n.ymaxForZ[s])&&(n.ymaxForZ[s]=o),s<n.min_z&&(n.min_z=s),s>n.max_z&&(n.max_z=s)}n.zLevels.length>1&&n.zLevels.sort((e,t)=>e-t)}}function dt(e){for(let t in e.mpRoomDbHashToRoomId){if(!Object.hasOwn(e.mpRoomDbHashToRoomId,t))continue;let n=e.mpRoomDbHashToRoomId[t],r=e.rooms[n];r&&(r.hash=t)}}function ft(e){e.mpRoomDbHashToRoomId={};for(let t in e.rooms){if(!Object.hasOwn(e.rooms,t))continue;let n=e.rooms[t].hash;if(typeof n!=`string`||n.length===0)continue;let r=Number(t);if(Object.hasOwn(e.mpRoomDbHashToRoomId,n)){let t=e.mpRoomDbHashToRoomId[n];console.warn(`[mudlet-map-binary-reader] duplicate room hash "${n}" on rooms ${t} and ${r}; last wins`)}e.mpRoomDbHashToRoomId[n]=r}}function pt(e){e.mSpecialExits={},e.mSpecialExitLocks=[];for(let t in e.rawSpecialExits)if(Object.hasOwn(e.rawSpecialExits,t))for(let n of e.rawSpecialExits[t])n.startsWith(`0`)?e.mSpecialExits[n.substring(1)]=parseInt(t):n.startsWith(`1`)?(e.mSpecialExits[n.substring(1)]=parseInt(t),e.mSpecialExitLocks.push(parseInt(t))):e.mSpecialExits[n]=parseInt(t)}function mt(e){for(let t in e.rooms)Object.hasOwn(e.rooms,t)&&pt(e.rooms[t])}function ht(e){for(let t in e.rooms){let n=e.rooms[t],r={};for(let e in n.mSpecialExits){if(!Object.hasOwn(n.mSpecialExits,e))continue;let t=n.mSpecialExits[e];r[t]===void 0&&(r[t]=[]);let i=n.mSpecialExitLocks.indexOf(t)>-1;r[t].push((i?`1`:`0`)+e)}n.rawSpecialExits=r}}function gt(e){return O.read(new ot(e))}function _t(e){let t=gt(e),n=He(t);if(!n)throw Error(`Unsupported Mudlet map version ${t}. Supported version(s): ${Ue().join(`, `)}.`);let r=n.read(new ot(e));return mt(r),dt(r),r}function vt(e,t,n){let r=gt(e),i=He(r);if(!i)throw Error(`Unsupported Mudlet map version ${r}. Supported version(s): ${Ue().join(`, `)}.`);let a=new ot(e),o=i.readHeader(a);for(n?.(o);a.read_offset<a.buffer.length;){let{id:e,room:n}=i.readRoom(a);pt(n),t(e,n)}return o}function yt(e){let t=He(e.version);if(!t)throw Error(`Cannot write Mudlet map: unsupported version ${e.version}. Supported version(s): ${Ue().join(`, `)}.`);return ht(e),lt(e),ut(e),ft(e),t.write(e)}const bt=_t,xt=yt,St=vt;function Ct(e){for(let t of Object.values(e??{}))for(let e of t){let t=e.pixMap;if(t&&typeof t!=`string`)try{e.pixMap=g.from(t).toString(`base64`)}catch{e.pixMap=``}}}const $=self;self.addEventListener(`message`,e=>{let t=e.data;try{if(t.kind===`serialize`){for(let e of Object.values(t.map.labels??{}))for(let t of e){let e=t.pixMap;typeof e==`string`&&(t.pixMap=g.from(e,`base64`))}let e=xt(t.map),n=new ArrayBuffer(e.byteLength);new Uint8Array(n).set(e);let r={id:t.id,ok:!0,kind:`serialize`,bytes:n};$.postMessage(r,[n]);return}if(t.kind===`parseStream`){let e=[];St(g.from(t.buf),(n,r)=>{e.push([n,r]),e.length>=2e3&&($.postMessage({id:t.id,ok:!0,kind:`rooms`,rooms:e}),e=[])},e=>{Ct(e.labels);let n=0;for(let t of Object.values(e.areas??{}))n+=t.rooms?.length??0;$.postMessage({id:t.id,ok:!0,kind:`header`,header:e,totalRooms:n})}),e.length>0&&$.postMessage({id:t.id,ok:!0,kind:`rooms`,rooms:e}),$.postMessage({id:t.id,ok:!0,kind:`done`});return}let e=bt(g.from(t.buf));Ct(e.labels);let n={id:t.id,ok:!0,kind:`parse`,map:e};$.postMessage(n)}catch(e){let n={id:t.id,ok:!1,error:e instanceof Error?e.message:String(e)};$.postMessage(n)}});
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { ConnectionMode, MudConnection } from './storage/schema';
|
|
3
|
+
/**
|
|
4
|
+
* White-label branding for Mudlet Web builds. A branded client (a client
|
|
5
|
+
* shipped for one specific MUD) passes a `BrandConfig` to
|
|
6
|
+
* `<MudletWebApp brand={...}/>`; the config is held in a module-level singleton so
|
|
7
|
+
* non-React code (proxy resolution, document title, default packages) can read
|
|
8
|
+
* it without prop drilling. The default brand is stock Mudlet Web — rendering
|
|
9
|
+
* `<MudletWebApp/>` with no brand reproduces it exactly.
|
|
10
|
+
*/
|
|
11
|
+
/** The one MUD a branded build targets. Setting this switches the client into
|
|
12
|
+
* branded mode: exactly one profile (seeded from these fields on first
|
|
13
|
+
* launch), no profile creation/selection UI — the landing is a login form
|
|
14
|
+
* (the built-in `BrandLoginScreen`, or the brand's own `Landing`) — and
|
|
15
|
+
* login credentials are kept in memory only, never persisted. */
|
|
16
|
+
export interface BrandMudTarget {
|
|
17
|
+
mode: ConnectionMode;
|
|
18
|
+
/** `mud` mode (via telnet proxy). */
|
|
19
|
+
host?: string;
|
|
20
|
+
port?: number;
|
|
21
|
+
/** `websocket` mode (native WS endpoint). */
|
|
22
|
+
url?: string;
|
|
23
|
+
/** Display name for seeded profiles; defaults to the brand's `appName`. */
|
|
24
|
+
name?: string;
|
|
25
|
+
/** Seeded profiles dial automatically when opened. */
|
|
26
|
+
autoConnect?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** A package bundled with the brand, installed on first profile open through
|
|
29
|
+
* the same pipeline as the stock defaults (see `ensureDefaultPackages`). */
|
|
30
|
+
export interface BrandPackage {
|
|
31
|
+
/** Must match the manifest name produced by installPackageFromBytes. */
|
|
32
|
+
name: string;
|
|
33
|
+
/** Filename passed to the installer (drives manifest.name + on-disk dir). */
|
|
34
|
+
filename: string;
|
|
35
|
+
/** Resolved URL to the asset (e.g. an `?url` import in the brand's repo). */
|
|
36
|
+
url: string;
|
|
37
|
+
/** Package version. When set, a profile whose installed copy has a
|
|
38
|
+
* different manifest version reinstalls fresh on the next open — bump it
|
|
39
|
+
* (together with the package's config.lua) to ship updates to players.
|
|
40
|
+
* Unset = install once, never touch again. */
|
|
41
|
+
version?: string;
|
|
42
|
+
/** Whether the user may uninstall this package (default true). When false
|
|
43
|
+
* the uninstall control is hidden, Lua `uninstallPackage()` refuses it,
|
|
44
|
+
* and it reinstalls on the next profile open even if removed by other
|
|
45
|
+
* means. A removable package the user uninstalls stays uninstalled. */
|
|
46
|
+
removable?: boolean;
|
|
47
|
+
}
|
|
48
|
+
/** A brand-defined color theme. Rendered as a `:root[data-theme=<id>]` CSS
|
|
49
|
+
* rule injected at startup, after the bundled stylesheets — so unset
|
|
50
|
+
* variables inherit the dark base (`:root` in App.css), and a theme reusing
|
|
51
|
+
* a stock id (`dark`, `light`, …) overrides that stock theme's values. */
|
|
52
|
+
export interface BrandTheme {
|
|
53
|
+
/** Theme id stored in settings and stamped on `data-theme`. */
|
|
54
|
+
id: string;
|
|
55
|
+
/** Name shown in the theme picker. */
|
|
56
|
+
label: string;
|
|
57
|
+
/** CSS custom properties, e.g. `{ '--accent': '#c09648' }`. See the
|
|
58
|
+
* `:root` block in App.css for the full token list; anything unset
|
|
59
|
+
* falls through to the dark base. */
|
|
60
|
+
variables: Record<string, string>;
|
|
61
|
+
/** `'light'` also switches the browser's `color-scheme` (native form
|
|
62
|
+
* controls, scrollbars) and the script editor's syntax colors. */
|
|
63
|
+
colorScheme?: 'dark' | 'light';
|
|
64
|
+
}
|
|
65
|
+
/** Stock built-in themes, as shown in the settings picker. */
|
|
66
|
+
export declare const STOCK_THEMES: {
|
|
67
|
+
value: string;
|
|
68
|
+
label: string;
|
|
69
|
+
}[];
|
|
70
|
+
/** Ids of the stock toolbar buttons, for `BrandToolbarConfig.hide`.
|
|
71
|
+
* `connection` is the Reconnect/Disconnect pair; `close` closes the profile;
|
|
72
|
+
* `record` toggles Mudlet-format replay recording. */
|
|
73
|
+
export type StockToolbarButton = 'scripts' | 'files' | 'map' | 'logs' | 'docs' | 'reportBug' | 'settings' | 'record' | 'connection' | 'close';
|
|
74
|
+
/** What a brand toolbar button can do when clicked. */
|
|
75
|
+
export interface BrandToolbarContext {
|
|
76
|
+
connectionId: string;
|
|
77
|
+
/** Send a command as if the user typed it (echoed, alias-processed). */
|
|
78
|
+
send(text: string): void;
|
|
79
|
+
/** Raise a Mudlet event in the profile's Lua runtime — script handlers
|
|
80
|
+
* registered via registerAnonymousEventHandler etc. receive it. */
|
|
81
|
+
raiseEvent(event: string, ...args: unknown[]): void;
|
|
82
|
+
}
|
|
83
|
+
export interface BrandToolbarButton {
|
|
84
|
+
/** Stable id (also the React key). */
|
|
85
|
+
id: string;
|
|
86
|
+
label: string;
|
|
87
|
+
/** Optional icon node rendered before the label. */
|
|
88
|
+
icon?: ReactNode;
|
|
89
|
+
/** Tooltip. */
|
|
90
|
+
title?: string;
|
|
91
|
+
onClick(ctx: BrandToolbarContext): void;
|
|
92
|
+
}
|
|
93
|
+
export interface BrandToolbarConfig {
|
|
94
|
+
/** Stock buttons to remove. */
|
|
95
|
+
hide?: StockToolbarButton[];
|
|
96
|
+
/** Brand buttons, appended after the stock app buttons. */
|
|
97
|
+
buttons?: BrandToolbarButton[];
|
|
98
|
+
/** Extra class on the toolbar root (`.mudix-toolbar`) so brand CSS can
|
|
99
|
+
* restyle it. */
|
|
100
|
+
className?: string;
|
|
101
|
+
}
|
|
102
|
+
/** Contract for a brand-supplied landing screen, rendered instead of the stock
|
|
103
|
+
* connection picker whenever no profile is open. */
|
|
104
|
+
export interface LandingProps {
|
|
105
|
+
connections: MudConnection[];
|
|
106
|
+
/** Open a profile; `connect` dials immediately instead of opening offline. */
|
|
107
|
+
openProfile: (connectionId: string, connect: boolean) => void;
|
|
108
|
+
/** Find-or-create the brand's managed profile and return its connection
|
|
109
|
+
* id to pass to `openProfile`. In `profileMode: 'perLogin'`, `account`
|
|
110
|
+
* selects (or names) the per-account profile, matched case-insensitively;
|
|
111
|
+
* otherwise the single shared profile is used. Never pass credentials
|
|
112
|
+
* into storage — use `setSessionCredentials` from
|
|
113
|
+
* `utils/sessionCredentials` for the password. */
|
|
114
|
+
ensureBrandProfile: (account?: string) => string;
|
|
115
|
+
openSettings: () => void;
|
|
116
|
+
}
|
|
117
|
+
export interface BrandConfig {
|
|
118
|
+
/** App name: wordmark, document title, About dialog. */
|
|
119
|
+
appName: string;
|
|
120
|
+
/** Logo shown beside the wordmark in the toolbar. Resolved URL — in a brand
|
|
121
|
+
* repo, an `?url` import of your own asset.
|
|
122
|
+
*
|
|
123
|
+
* **Not inherited.** The stock value is Mudlet's own logo, so passing any
|
|
124
|
+
* `brand` at all clears it unless that brand sets `logoUrl` itself; a
|
|
125
|
+
* white-label client never ships the Mudlet mark by accident. Set it to
|
|
126
|
+
* your own asset to show one, or leave it unset for a wordmark alone. */
|
|
127
|
+
logoUrl?: string;
|
|
128
|
+
/** Short tagline under the About wordmark. Empty string hides it. */
|
|
129
|
+
tagline?: string;
|
|
130
|
+
/** Descriptive paragraph in the About dialog. Empty string hides it. */
|
|
131
|
+
aboutText?: string;
|
|
132
|
+
/** "View source" link in the About dialog. `undefined` hides the link. */
|
|
133
|
+
repoUrl?: string;
|
|
134
|
+
/** Brand-hardcoded telnet proxy. Sits below explicit user overrides in the
|
|
135
|
+
* precedence chain (connection > user settings > brand > built-in), but
|
|
136
|
+
* branded builds never expose the per-connection proxy field, so this
|
|
137
|
+
* effectively wins. */
|
|
138
|
+
proxyUrl?: string;
|
|
139
|
+
/** The single MUD this build targets. Setting it enables branded mode —
|
|
140
|
+
* see the type's doc. Leave unset for a stock (open) client. */
|
|
141
|
+
mud?: BrandMudTarget;
|
|
142
|
+
/** How branded builds map logins to profiles (default `'single'`):
|
|
143
|
+
* - `'single'` — one shared profile regardless of the account entered.
|
|
144
|
+
* - `'perLogin'` — find-or-create a profile per account name entered at
|
|
145
|
+
* the login form (compared case-insensitively, stored as the profile
|
|
146
|
+
* name) — each login keeps its own scripts, layout and files. There is
|
|
147
|
+
* still no picker: selection happens by logging in. */
|
|
148
|
+
profileMode?: 'single' | 'perLogin';
|
|
149
|
+
/**
|
|
150
|
+
* The exact set of packages preinstalled into every profile on first open,
|
|
151
|
+
* replacing the stock defaults rather than adding to them:
|
|
152
|
+
*
|
|
153
|
+
* - unset — no opinion; the stock defaults install (`run-lua-code` plus one
|
|
154
|
+
* mapper, chosen per game — see `stockDefaults`).
|
|
155
|
+
* - `[]` — nothing is preinstalled.
|
|
156
|
+
* - a list — exactly these, and none of the stock ones.
|
|
157
|
+
*
|
|
158
|
+
* So a brand shipping its own mapper just lists it here and ours never
|
|
159
|
+
* appears; nothing arbitrates between them at install time, which is why the
|
|
160
|
+
* list is exact rather than additive (two mappers would both drive
|
|
161
|
+
* `centerview` off the same movement).
|
|
162
|
+
*/
|
|
163
|
+
packages?: BrandPackage[];
|
|
164
|
+
/** Brand-defined themes, offered in the picker alongside (or instead of)
|
|
165
|
+
* the stock ones. A theme reusing a stock id overrides it. */
|
|
166
|
+
themes?: BrandTheme[];
|
|
167
|
+
/** Theme ids offered in the settings picker, in this order. Unset = all
|
|
168
|
+
* stock themes plus every brand theme. Use to trim the choice down
|
|
169
|
+
* (e.g. `['puszcza', 'dark']`) — ids may be stock or brand-defined. */
|
|
170
|
+
availableThemes?: string[];
|
|
171
|
+
/** Theme active on first launch (before the user ever picks one). Also
|
|
172
|
+
* the fallback when the current theme isn't in `availableThemes`. */
|
|
173
|
+
defaultTheme?: string;
|
|
174
|
+
/** Toolbar customization: hide stock buttons, add brand buttons (which
|
|
175
|
+
* can send commands or raise script events), restyle via className. */
|
|
176
|
+
toolbar?: BrandToolbarConfig;
|
|
177
|
+
/** Custom landing screen replacing the stock connection picker. */
|
|
178
|
+
Landing?: ComponentType<LandingProps>;
|
|
179
|
+
}
|
|
180
|
+
export declare const DEFAULT_BRAND: BrandConfig;
|
|
181
|
+
/** Install the active brand. Called once by `MudletWebApp` before first render;
|
|
182
|
+
* unspecified fields fall back to the stock Mudlet Web brand. Idempotent. */
|
|
183
|
+
export declare function setBrand(brand?: Partial<BrandConfig>): void;
|
|
184
|
+
export declare function getBrand(): BrandConfig;
|
|
185
|
+
/** Whether the active brand pins a MUD — i.e. the client runs in branded mode
|
|
186
|
+
* (single profile, login-form landing, no persisted credentials). */
|
|
187
|
+
export declare function isBrandedMode(): boolean;
|
|
188
|
+
/** Whether the user may uninstall the named package. Only brand-bundled
|
|
189
|
+
* packages marked `removable: false` are locked; everything else — stock
|
|
190
|
+
* defaults included — is removable. */
|
|
191
|
+
export declare function isPackageRemovable(name: string): boolean;
|
|
192
|
+
/** Theme options for the settings picker: brand themes first (one overriding
|
|
193
|
+
* a stock id replaces it in place), narrowed and ordered by
|
|
194
|
+
* `availableThemes` when set. */
|
|
195
|
+
export declare function getThemeChoices(): {
|
|
196
|
+
value: string;
|
|
197
|
+
label: string;
|
|
198
|
+
}[];
|
|
199
|
+
/** Whether a theme id renders on a light base — drives `color-scheme` and the
|
|
200
|
+
* script editor's syntax palette. Brand themes declare it via `colorScheme`. */
|
|
201
|
+
export declare function isLightTheme(id: string): boolean;
|
|
202
|
+
/** Stylesheet text for the brand's themes — one `:root[data-theme=<id>]` rule
|
|
203
|
+
* each. Injected after the bundled CSS so it wins ties (see MudletWebApp). */
|
|
204
|
+
export declare function brandThemesCss(): string;
|
|
205
|
+
/** Connection-record seed for the brand's MUD, or null when the brand doesn't
|
|
206
|
+
* pin one. Used to create the managed profile(s) in branded mode; `account`
|
|
207
|
+
* names a per-login profile (see `profileMode: 'perLogin'`). */
|
|
208
|
+
export declare function brandConnectionData(brand: BrandConfig, account?: string): Omit<MudConnection, 'id'> | null;
|
|
209
|
+
/** The existing managed profile a login maps to, if any. In `'perLogin'` mode
|
|
210
|
+
* a non-empty `account` matches the profile named after it (trimmed,
|
|
211
|
+
* case-insensitive); otherwise — `'single'` mode, or no account entered —
|
|
212
|
+
* the one shared profile (the first connection) is used. */
|
|
213
|
+
export declare function matchBrandProfile(connections: MudConnection[], brand: BrandConfig, account?: string): MudConnection | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type Params<T> = [T] extends [void] ? [] : [T] extends [any[]] ? T : [T];
|
|
2
|
+
type Handler<T> = (...args: Params<T>) => void;
|
|
3
|
+
type EventOptions = {
|
|
4
|
+
once?: boolean;
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
};
|
|
7
|
+
export declare class EventBus<Events extends Record<PropertyKey, any>> {
|
|
8
|
+
private listeners;
|
|
9
|
+
/** Number of emit() calls currently on the stack. Dead entries are only
|
|
10
|
+
* spliced out of a bucket while nothing is iterating it (depth 0); during
|
|
11
|
+
* a dispatch they stay in place, flagged `handler === false`, so indices
|
|
12
|
+
* never shift under an in-flight loop. */
|
|
13
|
+
private dispatchDepth;
|
|
14
|
+
on<K extends keyof Events>(event: K, listener: Handler<Events[K]>, options?: EventOptions | boolean): () => void;
|
|
15
|
+
off<K extends keyof Events>(event: K, listener: Handler<Events[K]>): void;
|
|
16
|
+
/** Remove tombstoned entries from a bucket, dropping the bucket entirely
|
|
17
|
+
* once it is empty. Always re-reads the live array from the map — a
|
|
18
|
+
* caller's captured reference can be stale (see emit). */
|
|
19
|
+
private compact;
|
|
20
|
+
emit<K extends keyof Events>(event: K, ...args: Params<Events[K]>): number;
|
|
21
|
+
/** Drop listeners for one event, or all of them. Entries are tombstoned as
|
|
22
|
+
* well as unmapped so that a clear() performed *from inside* a handler
|
|
23
|
+
* (e.g. an error handler that tears the session down) stops the in-flight
|
|
24
|
+
* dispatch instead of letting the remaining listeners run against
|
|
25
|
+
* already-destroyed state. */
|
|
26
|
+
clear(event?: keyof Events): void;
|
|
27
|
+
listenerCount(event: keyof Events): number;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type SqlValue } from '@sqlite.org/sqlite-wasm';
|
|
2
|
+
type ExecResult = {
|
|
3
|
+
kind: 'rows';
|
|
4
|
+
rows: SqlValue[][];
|
|
5
|
+
columns: string[];
|
|
6
|
+
} | {
|
|
7
|
+
kind: 'changes';
|
|
8
|
+
changes: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const sqliteReady: Promise<void>;
|
|
11
|
+
export declare class SqliteClient {
|
|
12
|
+
private readonly dbs;
|
|
13
|
+
private readonly idByPath;
|
|
14
|
+
private readonly pathById;
|
|
15
|
+
private nextId;
|
|
16
|
+
liveId(path: string): number | undefined;
|
|
17
|
+
private get s();
|
|
18
|
+
open(path: string, preload?: Uint8Array): number;
|
|
19
|
+
exec(dbId: number, sql: string): ExecResult;
|
|
20
|
+
exportFile(dbId: number): Uint8Array;
|
|
21
|
+
close(dbId: number): void;
|
|
22
|
+
escape(s: string): string;
|
|
23
|
+
}
|
|
24
|
+
export declare function getSqliteClient(): SqliteClient;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MudSession } from '../mud/MudSession';
|
|
2
|
+
import { type MudConnection } from '../storage';
|
|
3
|
+
import { ScriptingEngine } from '../scripting/ScriptingEngine';
|
|
4
|
+
import type { ProfileVFS } from '../scripting/vfs/ProfileVFS';
|
|
5
|
+
/**
|
|
6
|
+
* Creates and tears down all scripting engines tied to a session lifetime.
|
|
7
|
+
* Only ScriptingEngine is exposed — it owns the alias/trigger/timer/key
|
|
8
|
+
* engines internally and subscribes to the appStore to keep them in sync.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useEngines(session: MudSession, active: boolean, connection: MudConnection | null, vfs: ProfileVFS | null): {
|
|
11
|
+
engineRef: import("react").RefObject<ScriptingEngine | null>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MudSession, type SessionStatus, type MudSessionOptions } from '../mud/MudSession';
|
|
2
|
+
export declare function useMudSession(options?: MudSessionOptions): {
|
|
3
|
+
session: MudSession;
|
|
4
|
+
status: SessionStatus;
|
|
5
|
+
ping: number | null;
|
|
6
|
+
passwordMode: boolean;
|
|
7
|
+
connect: (url: string) => void;
|
|
8
|
+
disconnect: () => void;
|
|
9
|
+
send: (text: string, echo?: boolean) => void;
|
|
10
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type OutputRendererControls, type MessageSource } from '../ui/output/OutputRenderer';
|
|
2
|
+
export declare const DEFAULT_STICKY_LINES = 50;
|
|
3
|
+
export interface UseStickyOutputOptions {
|
|
4
|
+
stickyLines?: number;
|
|
5
|
+
maxElements?: number;
|
|
6
|
+
splitViewThreshold?: number;
|
|
7
|
+
showTimestamps?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface UseStickyOutputResult {
|
|
10
|
+
outputRef: React.RefObject<HTMLDivElement | null>;
|
|
11
|
+
sentinelRef: React.RefObject<HTMLDivElement | null>;
|
|
12
|
+
stickyAreaRef: React.RefObject<HTMLDivElement | null>;
|
|
13
|
+
isSplitView: boolean;
|
|
14
|
+
scrollToBottom: () => void;
|
|
15
|
+
controls: OutputRendererControls | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function useStickyOutput(source: MessageSource | null, { stickyLines, maxElements, splitViewThreshold, showTimestamps, }?: UseStickyOutputOptions): UseStickyOutputResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Responsive breakpoints (px). Kept in sync with the `--bp-*` tokens and the
|
|
3
|
+
* `@media` blocks in App.css — change them in both places.
|
|
4
|
+
* mobile : width ≤ 600 (phones — single-column layout branch)
|
|
5
|
+
* tablet : 601 ≤ width ≤ 900 (fluid modals, desktop-ish layout)
|
|
6
|
+
* desktop : width > 900 (full dock/float UX)
|
|
7
|
+
*/
|
|
8
|
+
export declare const MOBILE_MAX_WIDTH = 600;
|
|
9
|
+
export declare const TABLET_MAX_WIDTH = 900;
|
|
10
|
+
export type ViewportMode = 'mobile' | 'tablet' | 'desktop';
|
|
11
|
+
/** Current responsive mode, re-rendering the caller when it changes. */
|
|
12
|
+
export declare function useViewportMode(): ViewportMode;
|
|
13
|
+
/** Convenience: true on phone-sized viewports (the single-column layout branch). */
|
|
14
|
+
export declare function useIsMobile(): boolean;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type MudletProfileBundle } from './mudletProfileImport';
|
|
2
|
+
import type { MudConnection } from '../storage/schema';
|
|
3
|
+
/** The per-connection store slices a bundle maps to. Pure — no side effects, so
|
|
4
|
+
* it's unit-testable; `importMudletProfile` applies it. Automation is imported
|
|
5
|
+
* profile-owned (as authored in Mudlet), not package-tagged. */
|
|
6
|
+
export declare function bundleToConnectionData(bundle: MudletProfileBundle, installedAt: string): {
|
|
7
|
+
scripts: import("../storage/schema").ScriptNode[];
|
|
8
|
+
aliases: import("../storage/schema").AliasNode[];
|
|
9
|
+
triggers: import("..").TriggerNode[];
|
|
10
|
+
timers: import("../storage/schema").TimerNode[];
|
|
11
|
+
keybindings: import("../storage/schema").KeyNode[];
|
|
12
|
+
buttons: import("../storage/schema").ButtonNode[];
|
|
13
|
+
packages: import("../storage/schema").PackageManifest[];
|
|
14
|
+
profile: Partial<import("../storage").ProfileSettings>;
|
|
15
|
+
variables: {
|
|
16
|
+
saveList: string[];
|
|
17
|
+
values: import("./mudletVariables").MudletVariable[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The connection record for an imported bundle.
|
|
22
|
+
*
|
|
23
|
+
* A Mudlet `<Host>` only models a telnet host/port, so that's the default. A
|
|
24
|
+
* profile exported *from mudix* also carries `.mudix/connection.json`, which
|
|
25
|
+
* restores what Mudlet can't express — websocket mode and its ws(s):// URL, the
|
|
26
|
+
* per-profile proxy override, auto-reconnect. Unknown/aliased sidecar values are
|
|
27
|
+
* ignored field by field, so a hand-edited file can't produce a broken profile.
|
|
28
|
+
*/
|
|
29
|
+
export declare function bundleToConnectionRecord(bundle: MudletProfileBundle): Omit<MudConnection, 'id'>;
|
|
30
|
+
/**
|
|
31
|
+
* Create a new mudix profile from a Mudlet profile bundle. Returns the new
|
|
32
|
+
* connection id. The profile opens offline like any other; its data is durable
|
|
33
|
+
* in the new VFS (`.mudix/profile.json`) and map store before this resolves.
|
|
34
|
+
*/
|
|
35
|
+
export declare function importMudletProfile(bundle: MudletProfileBundle): Promise<string>;
|
|
36
|
+
/** Recursively read a picked directory into {path -> bytes} + {path -> mtime}
|
|
37
|
+
* maps for buildMudletProfileBundle. The directory's own name isn't included in
|
|
38
|
+
* the keys, so a picked profile folder yields `current/…`, `map/…` at the root.
|
|
39
|
+
* The mtimes let the bundle pick the most-recently-saved XML the way Mudlet does. */
|
|
40
|
+
export declare function readDirectoryHandle(root: FileSystemDirectoryHandle): Promise<{
|
|
41
|
+
files: Record<string, Uint8Array>;
|
|
42
|
+
mtimes: Record<string, number>;
|
|
43
|
+
}>;
|
|
44
|
+
/** Build a bundle from a picked directory handle (mtime-aware newest-save pick). */
|
|
45
|
+
export declare function bundleFromDirectory(dir: FileSystemDirectoryHandle): Promise<MudletProfileBundle>;
|
|
46
|
+
/** Import a Mudlet profile from a picked directory handle (no unresolved-module
|
|
47
|
+
* handling — callers that need the upload/remove flow should use bundleFromDirectory
|
|
48
|
+
* + resolveModulesFromTree first). */
|
|
49
|
+
export declare function importMudletProfileFromDirectory(dir: FileSystemDirectoryHandle): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Link a Mudlet profile *directory* as a new mudix profile (Link mode): the
|
|
52
|
+
* folder stays the source of truth — its `current/*.xml` is re-read on every
|
|
53
|
+
* open — rather than being copied in. Reads the connection identity from the
|
|
54
|
+
* newest save, registers the connection, persists the folder handle so the VFS
|
|
55
|
+
* mounts it, and copies the current map. Returns the new connection id.
|
|
56
|
+
*/
|
|
57
|
+
export declare function linkMudletFolder(dir: FileSystemDirectoryHandle): Promise<string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MudConnection } from '../storage/schema';
|
|
2
|
+
import type { ProfileExportSource } from './mudletProfileExport';
|
|
3
|
+
export interface CollectOptions {
|
|
4
|
+
/** Session logs aren't part of the Mudlet format; they ride along under
|
|
5
|
+
* `logs/` so a migrating user doesn't leave history behind. */
|
|
6
|
+
includeLogs?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Read one profile out of storage, ready for export.
|
|
10
|
+
*
|
|
11
|
+
* The profile's `.mudix/profile.json` is the source of truth — not the Zustand
|
|
12
|
+
* store, which only holds slices for the *open* profile. A profile open in
|
|
13
|
+
* another tab may therefore be up to one save-debounce stale; exporting from the
|
|
14
|
+
* connection screen (where nothing is open) always sees the committed state.
|
|
15
|
+
*/
|
|
16
|
+
export declare function collectProfileExport(connection: MudConnection, opts?: CollectOptions): Promise<ProfileExportSource>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ProfileVFS } from '../scripting/vfs/ProfileVFS';
|
|
2
|
+
interface DefaultPackage {
|
|
3
|
+
/** Must match the manifest name produced by installPackageFromBytes. */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Filename passed to the installer (drives manifest.name + on-disk dir). */
|
|
6
|
+
filename: string;
|
|
7
|
+
/** Vite-resolved URL to the bundled asset. */
|
|
8
|
+
url: string;
|
|
9
|
+
/** When set, an installed copy with a different manifest version is
|
|
10
|
+
* reinstalled fresh — how brands ship package updates to players. */
|
|
11
|
+
version?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Games that get the IRE mapper instead of the generic one — verbatim from the
|
|
15
|
+
* `mudlet-mapper.xml` row of `defaultScripts` in mudlet.cpp.
|
|
16
|
+
*/
|
|
17
|
+
export declare const IRE_MAPPER_GAMES: string[];
|
|
18
|
+
/** Every bundled default, whatever the host — for tests and tooling. */
|
|
19
|
+
export declare const ALL_DEFAULTS: DefaultPackage[];
|
|
20
|
+
/**
|
|
21
|
+
* The stock defaults for a profile on `host`.
|
|
22
|
+
*
|
|
23
|
+
* Mudlet ships these as Qt resources in `src/mudlet.qrc` and installs them on
|
|
24
|
+
* profile open. We mirror that (and `setupPreInstallPackages`'s per-game
|
|
25
|
+
* choices): each file is bundled as a static asset and installed once per
|
|
26
|
+
* profile via the normal package pipeline, so it appears in the package list and
|
|
27
|
+
* the user can uninstall it if they want.
|
|
28
|
+
*
|
|
29
|
+
* Exactly one mapper, always. `centerview()` is the only thing that moves the
|
|
30
|
+
* map view and only a mapper calls it, so a profile with no mapper never follows
|
|
31
|
+
* the player — and two mappers would both fire on the same movement.
|
|
32
|
+
*/
|
|
33
|
+
export declare function stockDefaults(host?: string): DefaultPackage[];
|
|
34
|
+
/** A default or brand package as the install loop sees it. */
|
|
35
|
+
export type InstallablePackage = DefaultPackage & {
|
|
36
|
+
removable?: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* The packages to preinstall into a profile.
|
|
40
|
+
*
|
|
41
|
+
* A brand's list is exact and replaces the stock defaults rather than adding to
|
|
42
|
+
* them — `[]` preinstalls nothing, and a brand shipping its own mapper simply
|
|
43
|
+
* doesn't list ours. Unset means no opinion: the stock defaults for this game.
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveDefaultPackages(brandPackages: InstallablePackage[] | undefined, host?: string): InstallablePackage[];
|
|
46
|
+
/** Hostname `stockDefaults` matches its game lists against, lowercased. */
|
|
47
|
+
export declare function connectionHost(conn: {
|
|
48
|
+
mode?: string;
|
|
49
|
+
host?: string;
|
|
50
|
+
url?: string;
|
|
51
|
+
} | undefined): string | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Install any default packages the profile doesn't already have. Idempotent:
|
|
54
|
+
* a package is skipped if its manifest name is already in `connectionPackages`
|
|
55
|
+
* — so existing profiles also pick up newly-added defaults on next open.
|
|
56
|
+
*
|
|
57
|
+
* Which packages those are: `brand.packages` when a brand declares one (an
|
|
58
|
+
* exact list — `[]` installs nothing), otherwise `stockDefaults(host)`.
|
|
59
|
+
*
|
|
60
|
+
* Profiles imported or linked from Mudlet are exempt entirely — their own
|
|
61
|
+
* package set is authoritative, so nothing is added (returns `[]`).
|
|
62
|
+
*
|
|
63
|
+
* A default the user explicitly uninstalled stays uninstalled: the store's
|
|
64
|
+
* `uninstallPackage` tombstones the name in the profile's
|
|
65
|
+
* `uninstalledPackages` (Mudlet's `deletedDefaultMuds` equivalent), and this
|
|
66
|
+
* skips tombstoned names — except brand packages marked `removable: false`,
|
|
67
|
+
* which always come back.
|
|
68
|
+
*
|
|
69
|
+
* Failures are logged and swallowed: a broken default must never block the
|
|
70
|
+
* profile from opening.
|
|
71
|
+
*
|
|
72
|
+
* Returns the manifest names that were actually (re)installed this call — a
|
|
73
|
+
* fresh install into a profile that never had the package, or a version-bump
|
|
74
|
+
* reinstall. The caller raises sysInstallPackage for each of these once the
|
|
75
|
+
* runtime has loaded far enough for the package's own handlers to be
|
|
76
|
+
* registered; a package whose scripts gate one-time setup on that event
|
|
77
|
+
* (rather than the every-open sysLoadEvent) needs it fired here, since these
|
|
78
|
+
* installs never go through the normal installPackageFromVfsPath path.
|
|
79
|
+
*/
|
|
80
|
+
export declare function ensureDefaultPackages(connectionId: string, vfs: ProfileVFS): Promise<string[]>;
|
|
81
|
+
export {};
|