synabun 2.0.0 → 2.0.5
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/CHANGELOG.md +57 -0
- package/NOTICE +5 -0
- package/README.md +1 -1
- package/THIRD-PARTY-LICENSES.md +46 -0
- package/benchmarks/fixtures/browser/README.md +1 -1
- package/benchmarks/fixtures/desktop/README.md +1 -1
- package/docs/whatsapp.md +2 -2
- package/hooks/claude-code/pre-compact.mjs +11 -0
- package/hooks/claude-code/prompt-submit.mjs +60 -184
- package/hooks/claude-code/session-start.mjs +73 -16
- package/hooks/claude-code/shared.mjs +20 -0
- package/hooks/claude-code/stop.mjs +5 -5
- package/lib/start-launcher.js +88 -1
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -3
- package/neural-interface/i18n/en.json +1500 -153
- package/neural-interface/i18n/pt-BR.json +1498 -152
- package/neural-interface/lib/assistant-api.js +62 -6
- package/neural-interface/lib/assistant-brains/claude.js +4 -0
- package/neural-interface/lib/assistant-catalog.js +179 -27
- package/neural-interface/lib/assistant-config.js +31 -2
- package/neural-interface/lib/assistant-dispatch.js +62 -13
- package/neural-interface/lib/assistant-hidden-models.js +393 -66
- package/neural-interface/lib/assistant-memory.js +24 -10
- package/neural-interface/lib/assistant-persona.js +6 -2
- package/neural-interface/lib/assistant-pricing.js +21 -6
- package/neural-interface/lib/assistant-runtime.js +181 -12
- package/neural-interface/lib/assistant-task-prompt.js +13 -3
- package/neural-interface/lib/assistant-test-density.js +142 -0
- package/neural-interface/lib/assistant-user-context-budgets.js +123 -0
- package/neural-interface/lib/assistant-user-context.js +908 -0
- package/neural-interface/lib/assistant-user-knowledge.js +328 -0
- package/neural-interface/lib/assistant-user-learn.js +404 -0
- package/neural-interface/lib/assistant-user-threads.js +226 -0
- package/neural-interface/lib/assistant-user-writer.js +181 -0
- package/neural-interface/lib/browser-background-tab.js +134 -0
- package/neural-interface/lib/browser-screenshot.js +678 -61
- package/neural-interface/lib/claude-agent-bridge.js +33 -6
- package/neural-interface/lib/claude-model-catalog.js +30 -2
- package/neural-interface/lib/claude-temporary.js +46 -7
- package/neural-interface/lib/cloudflared/install.js +533 -0
- package/neural-interface/lib/cloudflared/manager.js +545 -0
- package/neural-interface/lib/cloudflared/pins.js +115 -0
- package/neural-interface/lib/cloudflared/pins.json +63 -0
- package/neural-interface/lib/cloudflared/tunnel.js +265 -0
- package/neural-interface/lib/editor-completion-endpoint.js +264 -0
- package/neural-interface/lib/editor-completion-opencode.js +436 -0
- package/neural-interface/lib/editor-completion.js +714 -0
- package/neural-interface/lib/editor-config.js +149 -0
- package/neural-interface/lib/editor-files-api.js +268 -0
- package/neural-interface/lib/editor-git-api.js +134 -0
- package/neural-interface/lib/file-explorer-api.js +1039 -0
- package/neural-interface/lib/file-explorer-system.js +355 -0
- package/neural-interface/lib/file-explorer-trash.ps1 +85 -0
- package/neural-interface/lib/file-explorer-watch.js +239 -0
- package/neural-interface/lib/git-diff-api.js +103 -0
- package/neural-interface/lib/git-read.js +202 -0
- package/neural-interface/lib/greeting/api.js +89 -0
- package/neural-interface/lib/greeting/budgets.js +90 -0
- package/neural-interface/lib/greeting/engine.js +461 -0
- package/neural-interface/lib/greeting/facts.js +320 -0
- package/neural-interface/lib/greeting/sources.js +252 -0
- package/neural-interface/lib/greeting/writer.js +139 -0
- package/neural-interface/lib/http-guards.js +189 -13
- package/neural-interface/lib/machine-names.js +88 -0
- package/neural-interface/lib/memory-api.js +31 -7
- package/neural-interface/lib/native-loop-providers.js +10 -5
- package/neural-interface/lib/plugin-installer.js +4 -2
- package/neural-interface/lib/project-storage.js +5 -7
- package/neural-interface/lib/request-gate.js +589 -0
- package/neural-interface/lib/ui-blob-api.js +108 -0
- package/neural-interface/lib/ui-blob-store.js +68 -0
- package/neural-interface/package-lock.json +701 -2
- package/neural-interface/package.json +13 -2
- package/neural-interface/public/install-app.html +9 -6
- package/neural-interface/public/offline.html +3 -2
- package/neural-interface/public/onboarding.html +12 -1
- package/neural-interface/public/shared/agent-runtime-options.js +22 -6
- package/neural-interface/public/shared/assistant/asst-automation.js +286 -0
- package/neural-interface/public/shared/assistant/asst-brain-picker.js +312 -62
- package/neural-interface/public/shared/assistant/asst-composer.js +11 -1
- package/neural-interface/public/shared/assistant/asst-mascot.js +18 -58
- package/neural-interface/public/shared/assistant/asst-menu.js +12 -8
- package/neural-interface/public/shared/assistant/asst-panel.js +150 -28
- package/neural-interface/public/shared/assistant/asst-render.js +162 -19
- package/neural-interface/public/shared/assistant/asst-route-models.js +108 -0
- package/neural-interface/public/shared/assistant/asst-route.js +23 -329
- package/neural-interface/public/shared/assistant/asst-routes-editor.js +495 -0
- package/neural-interface/public/shared/assistant/asst-sanitize.js +8 -1
- package/neural-interface/public/shared/assistant/asst-sidepanel.js +31 -9
- package/neural-interface/public/shared/assistant/asst-state.js +185 -1
- package/neural-interface/public/shared/assistant/asst-styles.js +158 -4
- package/neural-interface/public/shared/blob-store.js +111 -22
- package/neural-interface/public/shared/cdx/cdx-panel.js +32 -11
- package/neural-interface/public/shared/cdx/cdx-render.js +25 -89
- package/neural-interface/public/shared/cdx/cdx-styles.js +36 -0
- package/neural-interface/public/shared/cdx/cdx-tabs.js +87 -4
- package/neural-interface/public/shared/constants.js +6 -1
- package/neural-interface/public/shared/cp/cp-rehydrate.js +2 -1
- package/neural-interface/public/shared/cp/cp-styles.js +15 -0
- package/neural-interface/public/shared/editor/editor-ai-logic.js +409 -0
- package/neural-interface/public/shared/editor/editor-ai.js +619 -0
- package/neural-interface/public/shared/editor/editor-commands.js +212 -0
- package/neural-interface/public/shared/editor/editor-compare.js +103 -0
- package/neural-interface/public/shared/editor/editor-completion-list.js +172 -0
- package/neural-interface/public/shared/editor/editor-doc.js +257 -0
- package/neural-interface/public/shared/editor/editor-git-logic.js +131 -0
- package/neural-interface/public/shared/editor/editor-git.js +95 -0
- package/neural-interface/public/shared/editor/editor-languages.js +156 -0
- package/neural-interface/public/shared/editor/editor-lint.js +229 -0
- package/neural-interface/public/shared/editor/editor-loader.js +51 -0
- package/neural-interface/public/shared/editor/editor-markdown.js +90 -0
- package/neural-interface/public/shared/editor/editor-menu.js +233 -0
- package/neural-interface/public/shared/editor/editor-minimap.js +371 -0
- package/neural-interface/public/shared/editor/editor-palette-logic.js +192 -0
- package/neural-interface/public/shared/editor/editor-palette.js +125 -0
- package/neural-interface/public/shared/editor/editor-panel-logic.js +288 -0
- package/neural-interface/public/shared/editor/editor-panel.js +2099 -0
- package/neural-interface/public/shared/editor/editor-prefs.js +224 -0
- package/neural-interface/public/shared/editor/editor-safety.js +500 -0
- package/neural-interface/public/shared/editor/editor-search.js +352 -0
- package/neural-interface/public/shared/editor/editor-statusbar.js +144 -0
- package/neural-interface/public/shared/editor/editor-tabs-logic.js +331 -0
- package/neural-interface/public/shared/editor/editor-tabs.js +233 -0
- package/neural-interface/public/shared/editor/editor-theme.js +244 -0
- package/neural-interface/public/shared/editor/editor-view.js +332 -0
- package/neural-interface/public/shared/explorer/fx-api.js +216 -0
- package/neural-interface/public/shared/explorer/fx-links.js +204 -0
- package/neural-interface/public/shared/explorer/fx-logic.js +537 -0
- package/neural-interface/public/shared/explorer/fx-main.js +865 -0
- package/neural-interface/public/shared/explorer/fx-names.js +87 -0
- package/neural-interface/public/shared/explorer/fx-ops.js +370 -0
- package/neural-interface/public/shared/explorer/fx-popups.js +490 -0
- package/neural-interface/public/shared/explorer/fx-tree.js +790 -0
- package/neural-interface/public/shared/file-links.js +339 -0
- package/neural-interface/public/shared/greeting/greeting-card.js +178 -0
- package/neural-interface/public/shared/greeting/greeting-view.js +148 -0
- package/neural-interface/public/shared/html-shell.js +160 -165
- package/neural-interface/public/shared/ocp-v2/ocp-v2-childpanel.js +4 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-greeting.js +47 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-panel.js +99 -17
- package/neural-interface/public/shared/ocp-v2/ocp-v2-render.js +7 -1
- package/neural-interface/public/shared/ocp-v2/ocp-v2-send.js +5 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-styles.js +40 -0
- package/neural-interface/public/shared/ocp-v2/ocp-v2-ws.js +3 -2
- package/neural-interface/public/shared/pwa-install-page.js +29 -1
- package/neural-interface/public/shared/pwa-install.css +3 -3
- package/neural-interface/public/shared/pwa-install.js +100 -1
- package/neural-interface/public/shared/settings/settings-code-editor-pane.js +412 -0
- package/neural-interface/public/shared/settings/settings-code-editor.js +328 -0
- package/neural-interface/public/shared/settings/settings-greeting.js +133 -0
- package/neural-interface/public/shared/settings/settings-ia.js +18 -4
- package/neural-interface/public/shared/settings/settings-user-context.js +154 -0
- package/neural-interface/public/shared/start-bridge.js +238 -19
- package/neural-interface/public/shared/styles.css +1414 -721
- package/neural-interface/public/shared/synabun-mascot.js +20 -56
- package/neural-interface/public/shared/tunnel-view.js +167 -0
- package/neural-interface/public/shared/ui-claude-panel.js +157 -16
- package/neural-interface/public/shared/ui-detail.js +15 -0
- package/neural-interface/public/shared/ui-explorer.js +22 -0
- package/neural-interface/public/shared/ui-file-explorer.js +481 -2496
- package/neural-interface/public/shared/ui-file-links.js +103 -0
- package/neural-interface/public/shared/ui-help.js +26 -0
- package/neural-interface/public/shared/ui-invite.js +126 -116
- package/neural-interface/public/shared/ui-keybinds.js +4 -0
- package/neural-interface/public/shared/ui-loading.js +159 -15
- package/neural-interface/public/shared/ui-menubar.js +12 -30
- package/neural-interface/public/shared/ui-native-loop-router-state.js +11 -0
- package/neural-interface/public/shared/ui-native-loop-router.js +15 -2
- package/neural-interface/public/shared/ui-navbar.js +45 -21
- package/neural-interface/public/shared/ui-settings.js +455 -488
- package/neural-interface/public/shared/ui-sidepanel-runtime.js +2 -1
- package/neural-interface/public/shared/ui-sync.js +16 -0
- package/neural-interface/public/shared/ui-terminal.js +23 -5
- package/neural-interface/public/shared/ui-tunnel.js +130 -0
- package/neural-interface/public/shared/ui-tutorial-steps.js +6 -2
- package/neural-interface/public/shared/ui-whiteboard.js +12 -0
- package/neural-interface/public/shared/ui-worker-end.js +245 -0
- package/neural-interface/public/shared/ui-workspaces.js +41 -27
- package/neural-interface/public/shared/worker-end.js +251 -0
- package/neural-interface/public/sw.js +2 -2
- package/neural-interface/public/vendor/codemirror/chunks/apl-CSDKT72Z.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/asciiarmor-JYYPU5BM.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/asn1-NRWCZDA6.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/asterisk-5OU6D4ZQ.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/brainfuck-ID4N4SYC.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/chunk-4RZWGCS2.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/chunk-ACTJM3JR.js +11 -0
- package/neural-interface/public/vendor/codemirror/chunks/chunk-S6BMAXLK.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/chunk-TO2RDOHQ.js +3 -0
- package/neural-interface/public/vendor/codemirror/chunks/chunk-US2GMZZQ.js +13 -0
- package/neural-interface/public/vendor/codemirror/chunks/chunk-WYYO5ZAJ.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/chunk-XALZTDJC.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/chunk-YRNUTRDV.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/chunk-Z3QOKH62.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/clike-OWQBSOGL.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/clojure-KV75UQWC.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/cmake-GTEP5Y3C.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/cobol-WCZ7QEGJ.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/coffeescript-TGLBOT6B.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/commonlisp-WVVI432V.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/crystal-S6R6HLKQ.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/css-PDA2RINP.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/cypher-HL5QPL4C.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/d-HHJH2HAJ.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/diff-MN3A35BY.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-25SQLBVS.js +3 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-27ZGGJJS.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-4E52OJIF.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-6FT73XDC.js +2 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-BE6YGRMW.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-CJSGKW2O.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-CRPH2WLI.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-CTG7JEQN.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-I3FEVELX.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-IM5BBSWZ.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-KERUKTIF.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-LXTMWZAM.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-MABASSET.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-MJVBUZLL.js +3 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-MNB3WZVU.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-QYWXOE3U.js +7 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-TEBOFWLZ.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-UNXFROM3.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-XL2SLQO6.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-XO42Y3AP.js +6 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-Y2WWDWJK.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-YFEZKWMU.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dist-ZY7SWQO6.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dockerfile-3Y4R4NCH.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dtd-5343GJ4P.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/dylan-FI2CXSW2.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/ebnf-GNQ77YWA.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/ecl-MRPUAE2L.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/eiffel-DZROES27.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/elm-4KICRFKQ.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/erlang-3IHYC263.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/factor-C6D3E5UK.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/fcl-VYTWUJMI.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/forth-ZBO2EH5M.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/fortran-5NDCRWIK.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/gas-SKRMOXFP.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/gherkin-L45YXZLW.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/groovy-GLPTLN44.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/haskell-E7NF7P4Y.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/haxe-K2NVDOB6.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/http-Q6DRQIJB.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/idl-MZYNJVLN.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/javascript-6YRYK2HR.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/julia-HXEL2T5G.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/livescript-MV7CI2JZ.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/lua-E36NHOOD.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/mathematica-3XOZZCMC.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/mbox-ODYGFKS7.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/mirc-WB43AWF5.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/mllike-ZT6ET7ZH.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/modelica-LLMZPFGA.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/mscgen-2OPNNYFH.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/mumps-6P3HWJH6.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/nginx-TCGKQTRW.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/nsis-ATIGIXTJ.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/ntriples-5PLBI5OV.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/octave-QF2S3NL6.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/oz-JFIVFFH2.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/pascal-JG6SW76V.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/perl-4B3IWVVO.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/pig-ABEBH4MI.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/powershell-H32XE7TL.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/properties-NN644MMA.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/protobuf-YKWQK2J3.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/pug-RIYXEKFW.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/puppet-JZQ5WPEV.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/python-EBCGGHAC.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/q-5UMH2YQY.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/r-7XMGG453.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/rpm-IEV7TSLR.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/ruby-T4SPFPNM.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/sas-GEDX67ET.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/scheme-FTLOWKPC.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/shell-HUFRKFSJ.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/sieve-P5QUDVYO.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/smalltalk-2SORJNQI.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/solr-M22TGAR5.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/sparql-4M3KL752.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/spreadsheet-3K23LA4N.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/sql-VHRFMUBI.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/stex-QZDAQUY2.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/stylus-7ZDKAKBD.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/swift-WCLCLGMR.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/tcl-JLMU6WOK.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/textile-4CHDKZ4T.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/tiddlywiki-DKMCZZQ4.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/tiki-F4JIG36Q.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/toml-BHMHTIM2.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/troff-YQ2KV5NT.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/ttcn-ZHRCVFJY.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/ttcn-cfg-KJOVTY4X.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/turtle-535P5N6I.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/vb-76UMQHOT.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/vbscript-CGNDTK6Z.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/velocity-VSJDO5T5.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/verilog-4T6ETXIP.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/vhdl-T7FNAXUN.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/webidl-P6MJSJ6J.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/xquery-UOVILRGN.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/yacas-CV2APROL.js +1 -0
- package/neural-interface/public/vendor/codemirror/chunks/z80-3KFNVM4M.js +1 -0
- package/neural-interface/public/vendor/codemirror/codemirror-6.43.14-75f05e67.min.js +2 -0
- package/neural-interface/public/vendor/codemirror/manifest.json +60 -0
- package/neural-interface/scripts/build-vendor.mjs +78 -2
- package/neural-interface/scripts/vendor-codemirror-entry.js +121 -0
- package/neural-interface/server.js +873 -1028
- package/neural-interface/templates/rulesets/README.md +1 -1
- package/package.json +2 -8
- package/setup.js +44 -7
- package/benchmarks/browser-live-results.json +0 -79
- package/benchmarks/browser-v2-results.json +0 -258
- package/neural-interface/lib/codex-capabilities.d.ts +0 -41
- package/neural-interface/public/category-logos/claude.svg +0 -1
- package/neural-interface/public/category-logos/gemini-color.svg +0 -1
- package/neural-interface/public/category-logos/openai.svg +0 -1
- package/neural-interface/public/category-logos/synabun.png +0 -0
- package/neural-interface/public/claude.svg +0 -1
- package/neural-interface/public/gallery.svg +0 -6
- package/neural-interface/public/leonardoai.svg +0 -1
- package/neural-interface/public/mcp.svg +0 -4
- package/neural-interface/public/opencode-logo-dark-square.svg +0 -1
- package/neural-interface/public/pin-svgrepo-com.svg +0 -25
- package/neural-interface/public/sessionicon.svg +0 -8
- package/neural-interface/public/toolbar-album.svg +0 -8
- package/neural-interface/public/toolbar-question.svg +0 -6
- package/neural-interface/public/toolbar-sessions.svg +0 -6
- package/neural-interface/scripts/codex-protocol-fixture.mjs +0 -83
- package/skills/synabun/synabunicon.png +0 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// ═══════════════════════════════════════════
|
|
2
|
+
// SynaBun Neural Interface — how a dispatched worker's tab ends
|
|
3
|
+
// ═══════════════════════════════════════════
|
|
4
|
+
//
|
|
5
|
+
// A worker the Assistant dispatched (agent_dispatch) runs as an automation tab
|
|
6
|
+
// in the Claude Code, Codex or OpenCode sidepanel. When its work is over, the
|
|
7
|
+
// tab ends on one card that says how it ended: the task is complete, it is
|
|
8
|
+
// blocked or waits for input, it failed (with the reason) or it was stopped
|
|
9
|
+
// (with who or what stopped it), and a button back to the Assistant session
|
|
10
|
+
// that dispatched it. This module decides what that card says, from two
|
|
11
|
+
// readings of the run:
|
|
12
|
+
// - `run`: the runtime descriptor the sidepanel router attaches with
|
|
13
|
+
// (lib/native-loop-runtime.js cleanDescriptor: status, turnState,
|
|
14
|
+
// stoppedReason, error, runMode, assistantSessionId), and
|
|
15
|
+
// - `dispatch`: the dispatcher's view of the same run (GET
|
|
16
|
+
// /api/assistant/runs/:runId, or an `assistant:dispatch` event: state,
|
|
17
|
+
// outcome, lastResult, completionReason, error, costUsd, turns).
|
|
18
|
+
// The runtime status alone cannot tell a finished task from a stopped one: a
|
|
19
|
+
// warm worker that reported done is released by an idle timeout, by the
|
|
20
|
+
// Assistant's agent_stop or by its tab closing, and each of those ends the
|
|
21
|
+
// runtime run as "stopped". The worker's own `## Result` (the dispatcher's
|
|
22
|
+
// `outcome`) says whether the task was done.
|
|
23
|
+
//
|
|
24
|
+
// No imports and no DOM: `node --test` loads this file as it is
|
|
25
|
+
// (tests/worker-end.test.mjs). WORKER_END_COPY is the English of every
|
|
26
|
+
// sentence; `workerEnd.*` in i18n/en.json must equal it and i18n/pt-BR.json
|
|
27
|
+
// must have the same keys (the test checks both). The page side is
|
|
28
|
+
// ui-worker-end.js.
|
|
29
|
+
|
|
30
|
+
export const WORKER_END_COPY = Object.freeze({
|
|
31
|
+
complete: 'Task complete',
|
|
32
|
+
blocked: 'Blocked',
|
|
33
|
+
needsInput: 'Needs input',
|
|
34
|
+
failed: 'Task failed',
|
|
35
|
+
stopped: 'Stopped',
|
|
36
|
+
interrupted: 'Interrupted',
|
|
37
|
+
back: 'Back to Assistant',
|
|
38
|
+
backHint: 'Close this tab and open the Assistant session that dispatched it',
|
|
39
|
+
warmNote: 'The worker is still open for follow-ups. Going back closes it.',
|
|
40
|
+
failedNoReason: 'The run ended with an error.',
|
|
41
|
+
reasonUser: 'Stopped by you.',
|
|
42
|
+
reasonAssistant: 'Stopped by the Assistant.',
|
|
43
|
+
reasonAssistantSaid: 'Stopped by the Assistant: {reason}',
|
|
44
|
+
reasonTimeCap: 'The run reached its time limit.',
|
|
45
|
+
reasonBudget: 'The run reached its budget limit.',
|
|
46
|
+
reasonMaxTurns: 'The run reached its turn limit.',
|
|
47
|
+
reasonIdle: 'The worker waited for a follow-up that did not come, and closed.',
|
|
48
|
+
reasonRestart: 'The server restarted while the run was open.',
|
|
49
|
+
reasonKillAll: 'Stopped together with every other run.',
|
|
50
|
+
reasonCleared: 'The run\'s state was removed.',
|
|
51
|
+
reasonOther: 'Stopped ({reason}).',
|
|
52
|
+
durationSeconds: '{s}s',
|
|
53
|
+
durationMinutes: '{m}m {s}s',
|
|
54
|
+
durationHours: '{h}h {m}m',
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/** Marks the card in a transcript: snapshot writers and restorers leave it out (it is drawn again from the run). */
|
|
58
|
+
export const WORKER_END_CLASS = 'worker-end-card';
|
|
59
|
+
|
|
60
|
+
/** The run states (runtime and dispatcher alike) after which nothing more happens. */
|
|
61
|
+
export const TERMINAL_STATES = new Set(['completed', 'failed', 'stopped', 'interrupted']);
|
|
62
|
+
const TERMINAL = TERMINAL_STATES;
|
|
63
|
+
// Dispatcher states in which a turn is in progress (or about to be): the card waits.
|
|
64
|
+
const WORKING = new Set(['queued', 'awaiting_route', 'starting', 'running', 'awaiting_permission']);
|
|
65
|
+
const SUMMARY_CHARS = 320;
|
|
66
|
+
|
|
67
|
+
/** A WORKER_END_COPY sentence with its `{params}` filled in: the translator when the page gives none. */
|
|
68
|
+
export function fillWorkerEndCopy(key, params = {}) {
|
|
69
|
+
return String(WORKER_END_COPY[key] ?? key).replace(/\{(\w+)\}/g, (whole, name) => (params[name] != null ? params[name] : whole));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** A run the Assistant dispatched (task mode), as opposed to a loop or a schedule the user started. */
|
|
73
|
+
export function isDispatchedRun(run, dispatch = null) {
|
|
74
|
+
return !!(dispatch?.runId || run?.assistantSessionId || run?.runMode === 'task');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* A turn of the run is in progress (or the run has not started one yet). The
|
|
79
|
+
* dispatcher's state wins over the runtime's: it is the one that knows a warm
|
|
80
|
+
* worker between turns is idle.
|
|
81
|
+
*/
|
|
82
|
+
export function isRunWorking(run, dispatch = null) {
|
|
83
|
+
const state = String(dispatch?.state || '');
|
|
84
|
+
if (TERMINAL.has(state) || TERMINAL.has(String(run?.status || ''))) return false;
|
|
85
|
+
if (state) return WORKING.has(state);
|
|
86
|
+
const status = String(run?.status || '');
|
|
87
|
+
if (status !== 'starting' && status !== 'running') return false;
|
|
88
|
+
return run?.turnState !== 'idle' && run?.turnState !== 'terminal';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** The runtime descriptor says the run may have something to show: it ended, or it waits between turns. */
|
|
92
|
+
export function mayHaveEnded(run) {
|
|
93
|
+
return TERMINAL.has(String(run?.status || '')) || run?.turnState === 'idle';
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The Claude Agent SDK's own words for a query SynaBun aborted: what its
|
|
98
|
+
* stream throws when the runtime disposes a worker, which happens to every run
|
|
99
|
+
* that ends, however it ended. Never a failure the user has to read.
|
|
100
|
+
*/
|
|
101
|
+
export function isEndOfRunAbort(message) {
|
|
102
|
+
const text = String(message || '').trim();
|
|
103
|
+
return /^(Claude Code process aborted by user|Connection aborted by user|Operation aborted|disposed)\.?$/i.test(text);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** "4m 12s": how long a run took. */
|
|
107
|
+
export function formatDuration(ms, t = fillWorkerEndCopy) {
|
|
108
|
+
const total = Math.max(0, Math.round((Number(ms) || 0) / 1000));
|
|
109
|
+
const h = Math.floor(total / 3600);
|
|
110
|
+
const m = Math.floor((total % 3600) / 60);
|
|
111
|
+
const s = total % 60;
|
|
112
|
+
if (h) return t('durationHours', { h, m });
|
|
113
|
+
if (m) return t('durationMinutes', { m, s });
|
|
114
|
+
return t('durationSeconds', { s });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** "$0.42"; under a cent is "<$0.01"; nothing for a run that cost nothing or was not priced. */
|
|
118
|
+
export function formatCost(usd) {
|
|
119
|
+
const value = Number(usd);
|
|
120
|
+
if (!Number.isFinite(value) || value <= 0) return '';
|
|
121
|
+
if (value < 0.01) return '<$0.01';
|
|
122
|
+
return `$${value.toFixed(2)}`;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** A worker's summary as one plain paragraph: no Markdown emphasis or heading marks, clipped. */
|
|
126
|
+
function plain(text, max = SUMMARY_CHARS) {
|
|
127
|
+
const flat = String(text || '')
|
|
128
|
+
.replace(/^#{1,6}\s+/gm, '')
|
|
129
|
+
.replace(/\*\*|__|`/g, '')
|
|
130
|
+
.replace(/\s+/g, ' ')
|
|
131
|
+
.trim();
|
|
132
|
+
return flat.length > max ? `${flat.slice(0, max - 1).trimEnd()}…` : flat;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function time(value) {
|
|
136
|
+
const at = Date.parse(value || '');
|
|
137
|
+
return Number.isFinite(at) ? at : null;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** How long the work took: to the end of its last turn when the task got that far, else to the end of the run. */
|
|
141
|
+
function elapsedOf(run, dispatch, untilLastTurn) {
|
|
142
|
+
const startedAt = time(dispatch?.startedAt) ?? time(dispatch?.createdAt) ?? time(run?.startedAt);
|
|
143
|
+
const turns = Array.isArray(dispatch?.turns) ? dispatch.turns : [];
|
|
144
|
+
const lastTurnEnd = untilLastTurn ? time(turns.at(-1)?.endedAt) : null;
|
|
145
|
+
const end = lastTurnEnd ?? time(dispatch?.completedAt) ?? time(dispatch?.finishedAt) ?? time(run?.completedAt);
|
|
146
|
+
if (startedAt != null && end != null && end >= startedAt) return end - startedAt;
|
|
147
|
+
const ms = Number(dispatch?.elapsedMs);
|
|
148
|
+
return Number.isFinite(ms) && ms > 0 ? ms : null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function stopReason(reason, t) {
|
|
152
|
+
const code = String(reason || '').trim();
|
|
153
|
+
switch (code) {
|
|
154
|
+
case 'user': return t('reasonUser');
|
|
155
|
+
case 'assistant': case 'complete': return t('reasonAssistant');
|
|
156
|
+
case 'time_cap': return t('reasonTimeCap');
|
|
157
|
+
case 'budget_cap': case 'session_budget_cap': case 'budget_unpriced': return t('reasonBudget');
|
|
158
|
+
case 'max_turns': return t('reasonMaxTurns');
|
|
159
|
+
case 'idle_timeout': return t('reasonIdle');
|
|
160
|
+
case 'server_restart': case 'server_shutdown': return t('reasonRestart');
|
|
161
|
+
case 'kill_all': return t('reasonKillAll');
|
|
162
|
+
case 'state_removed': case 'state_inactive': return t('reasonCleared');
|
|
163
|
+
case '': return '';
|
|
164
|
+
default:
|
|
165
|
+
// The Assistant's agent_stop reason is its own sentence; anything else is a code.
|
|
166
|
+
return /\s/.test(code) || code.length > 40
|
|
167
|
+
? t('reasonAssistantSaid', { reason: plain(code, 200) })
|
|
168
|
+
: t('reasonOther', { reason: code });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* What the end card of a dispatched worker's tab shows, or null when there is
|
|
174
|
+
* no card (not a dispatched run, a turn still in progress, background work
|
|
175
|
+
* still running, or a warm worker that has not reported its task done).
|
|
176
|
+
*
|
|
177
|
+
* @param {object | null} run the runtime descriptor (sidepanel router)
|
|
178
|
+
* @param {object | null} dispatch the dispatcher's view of the run, when known
|
|
179
|
+
* @param {object} [o]
|
|
180
|
+
* @param {(key: string, params?: object) => string} [o.t] a key of WORKER_END_COPY → the sentence in the page's language
|
|
181
|
+
* @param {boolean} [o.busy] background work of the run is still going (a warm worker only: an ended run has none)
|
|
182
|
+
* @param {boolean} [o.stoppedMidTurn] the run was seen working right before it was stopped: a done
|
|
183
|
+
* report from an earlier turn does not make it complete
|
|
184
|
+
* @returns {null | {
|
|
185
|
+
* kind: 'complete' | 'blocked' | 'needs_input' | 'failed' | 'stopped' | 'interrupted',
|
|
186
|
+
* tone: 'ok' | 'warn' | 'err' | 'off',
|
|
187
|
+
* title: string, detail: string, meta: string, note: string,
|
|
188
|
+
* warm: boolean,
|
|
189
|
+
* assistantSessionId: string | null, backLabel: string, backHint: string,
|
|
190
|
+
* sig: string,
|
|
191
|
+
* }}
|
|
192
|
+
*/
|
|
193
|
+
export function workerEndView(run, dispatch = null, { t = fillWorkerEndCopy, busy = false, stoppedMidTurn = false } = {}) {
|
|
194
|
+
if (!run && !dispatch) return null;
|
|
195
|
+
if (!isDispatchedRun(run, dispatch)) return null;
|
|
196
|
+
if (isRunWorking(run, dispatch)) return null;
|
|
197
|
+
|
|
198
|
+
const state = String(dispatch?.state || '');
|
|
199
|
+
const status = String(run?.status || '');
|
|
200
|
+
const endState = TERMINAL.has(state) ? state : (TERMINAL.has(status) ? status : '');
|
|
201
|
+
const result = dispatch?.lastResult && typeof dispatch.lastResult === 'object' ? dispatch.lastResult : null;
|
|
202
|
+
const outcome = String(dispatch?.outcome || result?.status || '');
|
|
203
|
+
const assistantSessionId = dispatch?.assistantSessionId || run?.assistantSessionId || null;
|
|
204
|
+
|
|
205
|
+
let kind = null;
|
|
206
|
+
let detail = '';
|
|
207
|
+
let warm = false;
|
|
208
|
+
if (!endState) {
|
|
209
|
+
// A warm worker between turns: only a task it reported done ends on a card.
|
|
210
|
+
// Background work it started may still be running (and report again).
|
|
211
|
+
if (outcome !== 'done' || busy) return null;
|
|
212
|
+
kind = 'complete';
|
|
213
|
+
warm = true;
|
|
214
|
+
} else if (endState === 'failed') {
|
|
215
|
+
kind = 'failed';
|
|
216
|
+
detail = plain(dispatch?.error || run?.error || '', 400) || t('failedNoReason');
|
|
217
|
+
} else if (outcome === 'done' && !(stoppedMidTurn && endState !== 'completed')) {
|
|
218
|
+
kind = 'complete';
|
|
219
|
+
} else if ((outcome === 'blocked' || outcome === 'needs_input') && !stoppedMidTurn) {
|
|
220
|
+
kind = outcome;
|
|
221
|
+
} else if (endState === 'completed') {
|
|
222
|
+
// Completed without a done report: the Assistant completed it (agent_complete).
|
|
223
|
+
kind = 'complete';
|
|
224
|
+
} else {
|
|
225
|
+
kind = endState === 'interrupted' ? 'interrupted' : 'stopped';
|
|
226
|
+
detail = stopReason(dispatch?.completionReason || run?.stoppedReason || '', t);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if (kind === 'complete' || kind === 'blocked') detail = plain(result?.summary || '');
|
|
230
|
+
if (kind === 'needs_input') detail = plain(result?.question || result?.summary || '');
|
|
231
|
+
|
|
232
|
+
const titles = { complete: 'complete', blocked: 'blocked', needs_input: 'needsInput', failed: 'failed', stopped: 'stopped', interrupted: 'interrupted' };
|
|
233
|
+
const tones = { complete: 'ok', blocked: 'warn', needs_input: 'warn', failed: 'err', stopped: 'off', interrupted: 'off' };
|
|
234
|
+
const elapsed = elapsedOf(run, dispatch, kind === 'complete' || kind === 'blocked' || kind === 'needs_input');
|
|
235
|
+
const meta = [elapsed != null ? formatDuration(elapsed, t) : '', formatCost(dispatch?.costUsd)].filter(Boolean).join(' · ');
|
|
236
|
+
const view = {
|
|
237
|
+
kind,
|
|
238
|
+
tone: tones[kind],
|
|
239
|
+
title: t(titles[kind]),
|
|
240
|
+
detail,
|
|
241
|
+
meta,
|
|
242
|
+
note: warm && assistantSessionId ? t('warmNote') : '',
|
|
243
|
+
warm,
|
|
244
|
+
assistantSessionId,
|
|
245
|
+
backLabel: assistantSessionId ? t('back') : '',
|
|
246
|
+
backHint: assistantSessionId ? t('backHint') : '',
|
|
247
|
+
sig: '',
|
|
248
|
+
};
|
|
249
|
+
view.sig = JSON.stringify([view.kind, view.title, view.detail, view.meta, view.note, view.assistantSessionId, view.backLabel]);
|
|
250
|
+
return view;
|
|
251
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Bump when offline.html changes shape: the new worker drops the old cache and
|
|
2
|
-
// stores the page again (
|
|
3
|
-
const CACHE_NAME = 'synabun-offline-
|
|
2
|
+
// stores the page again (v13: a restart read from the supervisor's report).
|
|
3
|
+
const CACHE_NAME = 'synabun-offline-v13';
|
|
4
4
|
const OFFLINE_URL = '/offline.html';
|
|
5
5
|
|
|
6
6
|
self.addEventListener('install', (event) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var l={"+":["conjugate","add"],"\u2212":["negate","subtract"],"\xD7":["signOf","multiply"],"\xF7":["reciprocal","divide"],"\u2308":["ceiling","greaterOf"],"\u230A":["floor","lesserOf"],"\u2223":["absolute","residue"],"\u2373":["indexGenerate","indexOf"],"?":["roll","deal"],"\u22C6":["exponentiate","toThePowerOf"],"\u235F":["naturalLog","logToTheBase"],"\u25CB":["piTimes","circularFuncs"],"!":["factorial","binomial"],"\u2339":["matrixInverse","matrixDivide"],"<":[null,"lessThan"],"\u2264":[null,"lessThanOrEqual"],"=":[null,"equals"],">":[null,"greaterThan"],"\u2265":[null,"greaterThanOrEqual"],"\u2260":[null,"notEqual"],"\u2261":["depth","match"],"\u2262":[null,"notMatch"],"\u2208":["enlist","membership"],"\u2377":[null,"find"],"\u222A":["unique","union"],"\u2229":[null,"intersection"],"\u223C":["not","without"],"\u2228":[null,"or"],"\u2227":[null,"and"],"\u2371":[null,"nor"],"\u2372":[null,"nand"],"\u2374":["shapeOf","reshape"],",":["ravel","catenate"],"\u236A":[null,"firstAxisCatenate"],"\u233D":["reverse","rotate"],"\u2296":["axis1Reverse","axis1Rotate"],"\u2349":["transpose",null],"\u2191":["first","take"],"\u2193":[null,"drop"],"\u2282":["enclose","partitionWithAxis"],"\u2283":["diclose","pick"],"\u2337":[null,"index"],"\u234B":["gradeUp",null],"\u2352":["gradeDown",null],"\u22A4":["encode",null],"\u22A5":["decode",null],"\u2355":["format","formatByExample"],"\u234E":["execute",null],"\u22A3":["stop","left"],"\u22A2":["pass","right"]},t=/[\.\/⌿⍀¨⍣]/,a=/⍬/,i=/[\+−×÷⌈⌊∣⍳\?⋆⍟○!⌹<≤=>≥≠≡≢∈⍷∪∩∼∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢]/,u=/←/,o=/[⍝#].*$/,s=function(r){var n;return n=!1,function(e){return n=e,e===r?n==="\\":!0}},f={name:"apl",startState:function(){return{prev:!1,func:!1,op:!1,string:!1,escape:!1}},token:function(r,n){var e;return r.eatSpace()?null:(e=r.next(),e==='"'||e==="'"?(r.eatWhile(s(e)),r.next(),n.prev=!0,"string"):/[\[{\(]/.test(e)?(n.prev=!1,null):/[\]}\)]/.test(e)?(n.prev=!0,null):a.test(e)?(n.prev=!1,"atom"):/[¯\d]/.test(e)?(n.func?(n.func=!1,n.prev=!1):n.prev=!0,r.eatWhile(/[\w\.]/),"number"):t.test(e)||u.test(e)?"operator":i.test(e)?(n.func=!0,n.prev=!1,l[e]?"variableName.function.standard":"variableName.function"):o.test(e)?(r.skipToEnd(),"comment"):e==="\u2218"&&r.peek()==="."?(r.next(),"variableName.function"):(r.eatWhile(/[\w\$_]/),n.prev=!0,"keyword"))}};export{f as apl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(e){var r=e.match(/^\s*\S/);return e.skipToEnd(),r?"error":null}var i={name:"asciiarmor",token:function(e,r){var n;if(r.state=="top")return e.sol()&&(n=e.match(/^-----BEGIN (.*)?-----\s*$/))?(r.state="headers",r.type=n[1],"tag"):t(e);if(r.state=="headers"){if(e.sol()&&e.match(/^\w+:/))return r.state="header","atom";var o=t(e);return o&&(r.state="body"),o}else{if(r.state=="header")return e.skipToEnd(),r.state="headers","string";if(r.state=="body")return e.sol()&&(n=e.match(/^-----END (.*)?-----\s*$/))?n[1]!=r.type?"error":(r.state="end","tag"):e.eatWhile(/[A-Za-z0-9+\/=]/)?null:(e.next(),"error");if(r.state=="end")return t(e)}},blankLine:function(e){e.state=="headers"&&(e.state="body")},startState:function(){return{state:"top",type:null}}};export{i as asciiArmor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function u(i){for(var s={},c=i.split(" "),T=0;T<c.length;++T)s[c[T]]=!0;return s}var o={keywords:u("DEFINITIONS OBJECTS IF DERIVED INFORMATION ACTION REPLY ANY NAMED CHARACTERIZED BEHAVIOUR REGISTERED WITH AS IDENTIFIED CONSTRAINED BY PRESENT BEGIN IMPORTS FROM UNITS SYNTAX MIN-ACCESS MAX-ACCESS MINACCESS MAXACCESS REVISION STATUS DESCRIPTION SEQUENCE SET COMPONENTS OF CHOICE DistinguishedName ENUMERATED SIZE MODULE END INDEX AUGMENTS EXTENSIBILITY IMPLIED EXPORTS"),cmipVerbs:u("ACTIONS ADD GET NOTIFICATIONS REPLACE REMOVE"),compareTypes:u("OPTIONAL DEFAULT MANAGED MODULE-TYPE MODULE_IDENTITY MODULE-COMPLIANCE OBJECT-TYPE OBJECT-IDENTITY OBJECT-COMPLIANCE MODE CONFIRMED CONDITIONAL SUBORDINATE SUPERIOR CLASS TRUE FALSE NULL TEXTUAL-CONVENTION"),status:u("current deprecated mandatory obsolete"),tags:u("APPLICATION AUTOMATIC EXPLICIT IMPLICIT PRIVATE TAGS UNIVERSAL"),storage:u("BOOLEAN INTEGER OBJECT IDENTIFIER BIT OCTET STRING UTCTime InterfaceIndex IANAifType CMIP-Attribute REAL PACKAGE PACKAGES IpAddress PhysAddress NetworkAddress BITS BMPString TimeStamp TimeTicks TruthValue RowStatus DisplayString GeneralString GraphicString IA5String NumericString PrintableString SnmpAdminString TeletexString UTF8String VideotexString VisibleString StringStore ISO646String T61String UniversalString Unsigned32 Integer32 Gauge Gauge32 Counter Counter32 Counter64"),modifier:u("ATTRIBUTE ATTRIBUTES MANDATORY-GROUP MANDATORY-GROUPS GROUP GROUPS ELEMENTS EQUALITY ORDERING SUBSTRINGS DEFINED"),accessTypes:u("not-accessible accessible-for-notify read-only read-create read-write"),multiLineStrings:!0};function L(i){var s=i.keywords||o.keywords,c=i.cmipVerbs||o.cmipVerbs,T=i.compareTypes||o.compareTypes,N=i.status||o.status,d=i.tags||o.tags,f=i.storage||o.storage,m=i.modifier||o.modifier,C=i.accessTypes||o.accessTypes,R=i.multiLineStrings||o.multiLineStrings,y=i.indentStatements!==!1,A=/[\|\^]/,E;function D(e,n){var t=e.next();if(t=='"'||t=="'")return n.tokenize=g(t),n.tokenize(e,n);if(/[\[\]\(\){}:=,;]/.test(t))return E=t,"punctuation";if(t=="-"&&e.eat("-"))return e.skipToEnd(),"comment";if(/\d/.test(t))return e.eatWhile(/[\w\.]/),"number";if(A.test(t))return e.eatWhile(A),"operator";e.eatWhile(/[\w\-]/);var r=e.current();return s.propertyIsEnumerable(r)?"keyword":c.propertyIsEnumerable(r)?"variableName":T.propertyIsEnumerable(r)?"atom":N.propertyIsEnumerable(r)?"comment":d.propertyIsEnumerable(r)?"typeName":f.propertyIsEnumerable(r)||m.propertyIsEnumerable(r)||C.propertyIsEnumerable(r)?"modifier":"variableName"}function g(e){return function(n,t){for(var r=!1,l,O=!1;(l=n.next())!=null;){if(l==e&&!r){var I=n.peek();I&&(I=I.toLowerCase(),(I=="b"||I=="h"||I=="o")&&n.next()),O=!0;break}r=!r&&l=="\\"}return(O||!(r||R))&&(t.tokenize=null),"string"}}function p(e,n,t,r,l){this.indented=e,this.column=n,this.type=t,this.align=r,this.prev=l}function a(e,n,t){var r=e.indented;return e.context&&e.context.type=="statement"&&(r=e.context.indented),e.context=new p(r,n,t,null,e.context)}function S(e){var n=e.context.type;return(n==")"||n=="]"||n=="}")&&(e.indented=e.context.indented),e.context=e.context.prev}return{name:"asn1",startState:function(){return{tokenize:null,context:new p(-2,0,"top",!1),indented:0,startOfLine:!0}},token:function(e,n){var t=n.context;if(e.sol()&&(t.align==null&&(t.align=!1),n.indented=e.indentation(),n.startOfLine=!0),e.eatSpace())return null;E=null;var r=(n.tokenize||D)(e,n);if(r=="comment")return r;if(t.align==null&&(t.align=!0),(E==";"||E==":"||E==",")&&t.type=="statement")S(n);else if(E=="{")a(n,e.column(),"}");else if(E=="[")a(n,e.column(),"]");else if(E=="(")a(n,e.column(),")");else if(E=="}"){for(;t.type=="statement";)t=S(n);for(t.type=="}"&&(t=S(n));t.type=="statement";)t=S(n)}else E==t.type?S(n):y&&((t.type=="}"||t.type=="top")&&E!=";"||t.type=="statement"&&E=="newstatement")&&a(n,e.column(),"statement");return n.startOfLine=!1,r},languageData:{indentOnInput:/^\s*[{}]$/,commentTokens:{line:"--"}}}}export{L as asn1};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=["exten","same","include","ignorepat","switch"],o=["#include","#exec"],c=["addqueuemember","adsiprog","aelsub","agentlogin","agentmonitoroutgoing","agi","alarmreceiver","amd","answer","authenticate","background","backgrounddetect","bridge","busy","callcompletioncancel","callcompletionrequest","celgenuserevent","changemonitor","chanisavail","channelredirect","chanspy","clearhash","confbridge","congestion","continuewhile","controlplayback","dahdiacceptr2call","dahdibarge","dahdiras","dahdiscan","dahdisendcallreroutingfacility","dahdisendkeypadfacility","datetime","dbdel","dbdeltree","deadagi","dial","dictate","directory","disa","dumpchan","eagi","echo","endwhile","exec","execif","execiftime","exitwhile","extenspy","externalivr","festival","flash","followme","forkcdr","getcpeid","gosub","gosubif","goto","gotoif","gotoiftime","hangup","iax2provision","ices","importvar","incomplete","ivrdemo","jabberjoin","jabberleave","jabbersend","jabbersendgroup","jabberstatus","jack","log","macro","macroexclusive","macroexit","macroif","mailboxexists","meetme","meetmeadmin","meetmechanneladmin","meetmecount","milliwatt","minivmaccmess","minivmdelete","minivmgreet","minivmmwi","minivmnotify","minivmrecord","mixmonitor","monitor","morsecode","mp3player","mset","musiconhold","nbscat","nocdr","noop","odbc","odbc","odbcfinish","originate","ospauth","ospfinish","osplookup","ospnext","page","park","parkandannounce","parkedcall","pausemonitor","pausequeuemember","pickup","pickupchan","playback","playtones","privacymanager","proceeding","progress","queue","queuelog","raiseexception","read","readexten","readfile","receivefax","receivefax","receivefax","record","removequeuemember","resetcdr","retrydial","return","ringing","sayalpha","saycountedadj","saycountednoun","saycountpl","saydigits","saynumber","sayphonetic","sayunixtime","senddtmf","sendfax","sendfax","sendfax","sendimage","sendtext","sendurl","set","setamaflags","setcallerpres","setmusiconhold","sipaddheader","sipdtmfmode","sipremoveheader","skel","slastation","slatrunk","sms","softhangup","speechactivategrammar","speechbackground","speechcreate","speechdeactivategrammar","speechdestroy","speechloadgrammar","speechprocessingsound","speechstart","speechunloadgrammar","stackpop","startmusiconhold","stopmixmonitor","stopmonitor","stopmusiconhold","stopplaytones","system","testclient","testserver","transfer","tryexec","trysystem","unpausemonitor","unpausequeuemember","userevent","verbose","vmauthenticate","vmsayname","voicemail","voicemailmain","wait","waitexten","waitfornoise","waitforring","waitforsilence","waitmusiconhold","waituntil","while","zapateller"];function l(e,n){var i="",a=e.next();if(n.blockComment)return a=="-"&&e.match("-;",!0)?n.blockComment=!1:e.skipTo("--;")?(e.next(),e.next(),e.next(),n.blockComment=!1):e.skipToEnd(),"comment";if(a==";")return e.match("--",!0)&&!e.match("-",!1)?(n.blockComment=!0,"comment"):(e.skipToEnd(),"comment");if(a=="[")return e.skipTo("]"),e.eat("]"),"header";if(a=='"')return e.skipTo('"'),"string";if(a=="'")return e.skipTo("'"),"string.special";if(a=="#"&&(e.eatWhile(/\w/),i=e.current(),o.indexOf(i)!==-1))return e.skipToEnd(),"strong";if(a=="$"){var r=e.peek();if(r=="{")return e.skipTo("}"),e.eat("}"),"variableName.special"}if(e.eatWhile(/\w/),i=e.current(),t.indexOf(i)!==-1){switch(n.extenStart=!0,i){case"same":n.extenSame=!0;break;case"include":case"switch":case"ignorepat":n.extenInclude=!0;break;default:break}return"atom"}}var s={name:"asterisk",startState:function(){return{blockComment:!1,extenStart:!1,extenSame:!1,extenInclude:!1,extenExten:!1,extenPriority:!1,extenApplication:!1}},token:function(e,n){var i="";if(e.eatSpace())return null;if(n.extenStart)return e.eatWhile(/[^\s]/),i=e.current(),/^=>?$/.test(i)?(n.extenExten=!0,n.extenStart=!1,"strong"):(n.extenStart=!1,e.skipToEnd(),"error");if(n.extenExten)return n.extenExten=!1,n.extenPriority=!0,e.eatWhile(/[^,]/),n.extenInclude&&(e.skipToEnd(),n.extenPriority=!1,n.extenInclude=!1),n.extenSame&&(n.extenPriority=!1,n.extenSame=!1,n.extenApplication=!0),"tag";if(n.extenPriority)return n.extenPriority=!1,n.extenApplication=!0,e.next(),n.extenSame?null:(e.eatWhile(/[^,]/),"number");if(n.extenApplication){if(e.eatWhile(/,/),i=e.current(),i===",")return null;if(e.eatWhile(/\w/),i=e.current().toLowerCase(),n.extenApplication=!1,c.indexOf(i)!==-1)return"def"}else return l(e,n);return null},languageData:{commentTokens:{line:";",block:{open:";--",close:"--;"}}}};export{s as asterisk};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var f="><+-.,[]".split(""),r={name:"brainfuck",startState:function(){return{commentLine:!1,left:0,right:0,commentLoop:!1}},token:function(i,n){if(i.eatSpace())return null;i.sol()&&(n.commentLine=!1);var e=i.next().toString();if(f.indexOf(e)!==-1){if(n.commentLine===!0)return i.eol()&&(n.commentLine=!1),"comment";if(e==="]"||e==="[")return e==="["?n.left++:n.right++,"bracket";if(e==="+"||e==="-")return"keyword";if(e==="<"||e===">")return"atom";if(e==="."||e===",")return"def"}else return n.commentLine=!0,i.eol()&&(n.commentLine=!1),"comment";i.eol()&&(n.commentLine=!1)}};export{r as brainfuck};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{s as M,x as Re}from"./chunk-TO2RDOHQ.js";import{A as k,B as Ae,C as q,D as Ee,E as A,F as ee,N as De,Q as te,a as ve,c as w,d as Z,e as S,f as U,i as v,j as _,k as j,l as H,n as we,o as I,p as Ce,q as V,s as Se,t as Ie,u as Te,z as Oe}from"./chunk-ACTJM3JR.js";var z=class{constructor(e,t,n,o){this.state=e,this.pos=t,this.explicit=n,this.view=o,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=M(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),o=t.text.slice(n-t.from,this.pos-t.from),s=o.search(He(e,!1));return s<0?null:{from:n+s,to:this.pos,text:o.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Pe(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Je(i){let e=Object.create(null),t=Object.create(null);for(let{label:o}of i){e[o[0]]=!0;for(let s=1;s<o.length;s++)t[o[s]]=!0}let n=Pe(e)+Pe(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function Ze(i){let e=i.map(o=>typeof o=="string"?{label:o}:o),[t,n]=e.every(o=>/^\w+$/.test(o.label))?[/\w*$/,/\w+$/]:Je(e);return o=>{let s=o.matchBefore(n);return s||o.explicit?{from:s?s.from:o.pos,options:e,validFor:t}:null}}function Kt(i,e){return t=>{for(let n=M(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}var Y=class{constructor(e,t,n,o){this.completion=e,this.source=t,this.match=n,this.score=o}};function D(i){return i.selection.main.from}function He(i,e){var t;let{source:n}=i,o=e&&n[0]!="^",s=n[n.length-1]!="$";return!o&&!s?i:new RegExp(`${o?"^":""}(?:${n})${s?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}var de=we.define();function _e(i,e,t,n){let{main:o}=i.selection,s=t-o.from,l=n-o.from;return{...i.changeByRange(a=>{if(a!=o&&t!=n&&i.sliceDoc(a.from+s,a.from+l)!=i.sliceDoc(t,n))return{range:a};let r=i.toText(e);return{changes:{from:a.from+s,to:n==o.from?a.to:a.from+l,insert:r},range:v.cursor(a.from+s+r.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var Le=new WeakMap;function et(i){if(!Array.isArray(i))return i;let e=Le.get(i);return e||Le.set(i,e=Ze(i)),e}var Q=I.define(),B=I.define(),se=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=w(e,t),o=S(n);this.chars.push(n);let s=e.slice(t,t+o),l=s.toUpperCase();this.folded.push(w(l==s?s.toLowerCase():l,0)),t+=o}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:o,precise:s,byWord:l}=this;if(t.length==1){let d=w(e,0),R=S(d),C=R==e.length?0:-100;if(d!=t[0])if(d==n[0])C+=-200;else return null;return this.ret(C,[0,R])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let r=t.length,h=0;if(a<0){for(let d=0,R=Math.min(e.length,200);d<R&&h<r;){let C=w(e,d);(C==t[h]||C==n[h])&&(o[h++]=d),d+=S(C)}if(h<r)return null}let c=0,f=0,u=!1,p=0,m=-1,y=-1,L=/[a-z]/.test(e),O=!0;for(let d=0,R=Math.min(e.length,200),C=0;d<R&&f<r;){let x=w(e,d);a<0&&(c<r&&x==t[c]&&(s[c++]=d),p<r&&(x==t[p]||x==n[p]?(p==0&&(m=d),y=d+1,p++):p=0));let N,J=x<255?x>=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(N=Z(x))!=N.toLowerCase()?1:N!=N.toUpperCase()?2:0;(!d||J==1&&L||C==0&&J!=0)&&(t[f]==x||n[f]==x&&(u=!0)?l[f++]=d:l.length&&(O=!1)),C=J,d+=S(x)}return f==r&&l[0]==0&&O?this.result(-100+(u?-200:0),l,e):p==r&&m==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==r?this.ret(-900-e.length,[m,y]):f==r?this.result(-100+(u?-200:0)+-700+(O?0:-1100),l,e):t.length==2?null:this.result((o[0]?-700:0)+-200+-1100,o,e)}result(e,t,n){let o=[],s=0;for(let l of t){let a=l+(this.astral?S(w(n,l)):1);s&&o[s-1]==l?o[s-1]=a:(o[s++]=l,o[s++]=a)}return this.ret(e-n.length,o)}},le=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},g=_.define({combine(i){return Se(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:tt,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>ke(e(n),t(n)),optionClass:(e,t)=>n=>ke(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function ke(i,e){return i?e?i+" "+e:i:e}function tt(i,e,t,n,o,s){let l=i.textDirection==Ae.RTL,a=l,r=!1,h="top",c,f,u=e.left-o.left,p=o.right-e.right,m=n.right-n.left,y=n.bottom-n.top;if(a&&u<Math.min(m,p)?a=!1:!a&&p<Math.min(m,u)&&(a=!0),m<=(a?u:p))c=Math.max(o.top,Math.min(t.top,o.bottom-y))-e.top,f=Math.min(400,a?u:p);else{r=!0,f=Math.min(400,(l?e.right:o.right-e.left)-30);let d=o.bottom-e.bottom;d>=y||d>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let L=(e.bottom-e.top)/s.offsetHeight,O=(e.right-e.left)/s.offsetWidth;return{style:`${h}: ${c/L}px; max-width: ${f/O}px`,class:"cm-completionInfo-"+(r?l?"left-narrow":"right-narrow":a?"left":"right")}}var me=I.define();function it(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(o=>"cm-completionIcon-"+o)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,o,s){let l=document.createElement("span");l.className="cm-completionLabel";let a=t.displayLabel||t.label,r=0;for(let h=0;h<s.length;){let c=s[h++],f=s[h++];c>r&&l.appendChild(document.createTextNode(a.slice(r,c)));let u=l.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(a.slice(c,f))),u.className="cm-completionMatchedText",r=f}return r<a.length&&l.appendChild(document.createTextNode(a.slice(r))),l},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function ie(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let o=Math.floor(e/t);return{from:o*t,to:(o+1)*t}}let n=Math.ceil((i-e)/t);return{from:i-n*t,to:i-(n-1)*t}}var re=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:r=>this.placeInfo(r),key:this},this.space=null,this.currentClass="";let o=e.state.field(t),{options:s,selected:l}=o.open,a=e.state.facet(g);this.optionContent=it(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=ie(s.length,l,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",r=>{let{options:h}=e.state.field(t).open;for(let c=r.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]<h.length){this.applyCompletion(e,h[+f[1]]),r.preventDefault();return}if(r.target==this.list){let c=this.list.classList.contains("cm-completionListIncompleteTop")&&r.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&r.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:me.of(c)}),r.preventDefault())}}),this.dom.addEventListener("focusout",r=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(g).closeOnBlur&&r.relatedTarget!=e.contentDOM&&e.dispatch({effects:B.of(null)})}),this.showOptions(s,o.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),o=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=o){let{options:s,selected:l,disabled:a}=n.open;(!o.open||o.open.options!=s)&&(this.range=ie(s.length,l,e.state.facet(g).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),a!=((t=o.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=ie(t.options.length,t.selected,this.view.state.facet(g).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:o}=t.options[t.selected],{info:s}=o;if(!s)return;let l=typeof s=="string"?document.createTextNode(s):s(o);if(!l)return;"then"in l?l.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,o)}).catch(a=>q(this.view.state,a,"completion info")):(this.addInfoPane(l,o),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:o,destroy:s}=e;n.appendChild(o),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,o=this.range.from;n;n=n.nextSibling,o++)n.nodeName!="LI"||!n.id?o--:o==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return t&&ot(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),o=e.getBoundingClientRect(),s=this.space;if(!s){let l=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:l.clientWidth,bottom:l.clientHeight}}return o.top>Math.min(s.bottom,t.bottom)-10||o.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(g).positionInfo(this.view,t,o,n,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){let o=document.createElement("ul");o.id=t,o.setAttribute("role","listbox"),o.setAttribute("aria-expanded","true"),o.setAttribute("aria-label",this.view.state.phrase("Completions")),o.addEventListener("mousedown",l=>{l.target==o&&l.preventDefault()});let s=null;for(let l=n.from;l<n.to;l++){let{completion:a,match:r}=e[l],{section:h}=a;if(h){let u=typeof h=="string"?h:h.name;if(u!=s&&(l>n.from||n.from==0))if(s=u,typeof h!="string"&&h.header)o.appendChild(h.header(h));else{let p=o.appendChild(document.createElement("completion-section"));p.textContent=u}}let c=o.appendChild(document.createElement("li"));c.id=t+"-"+l,c.setAttribute("role","option");let f=this.optionClass(a);f&&(c.className=f);for(let u of this.optionContent){let p=u(a,this.view.state,this.view,r);p&&c.appendChild(p)}}return n.from&&o.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&o.classList.add("cm-completionListIncompleteBottom"),o}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}};function nt(i,e){return t=>new re(t,i,e)}function ot(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),o=t.height/i.offsetHeight;n.top<t.top?i.scrollTop-=(t.top-n.top)/o:n.bottom>t.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/o)}function Me(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function st(i,e){let t=[],n=null,o=null,s=c=>{t.push(c);let{section:f}=c.completion;if(f){n||(n=[]);let u=typeof f=="string"?f:f.name;n.some(p=>p.name==u)||n.push(typeof f=="string"?{name:u}:f)}},l=e.facet(g);for(let c of i)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)s(new Y(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),p,m=l.filterStrict?new le(u):new se(u);for(let y of c.result.options)if(p=m.match(y.label)){let L=y.displayLabel?f?f(y,p.matched):[]:p.matched,O=p.score+(y.boost||0);if(s(new Y(y,c.source,L,O)),typeof y.section=="object"&&y.section.rank==="dynamic"){let{name:d}=y.section;o||(o=Object.create(null)),o[d]=Math.max(O,o[d]||-1e9)}}}}if(n){let c=Object.create(null),f=0,u=(p,m)=>(p.rank==="dynamic"&&m.rank==="dynamic"?o[m.name]-o[p.name]:0)||(typeof p.rank=="number"?p.rank:1e9)-(typeof m.rank=="number"?m.rank:1e9)||(p.name<m.name?-1:1);for(let p of n.sort(u))f-=1e5,c[p.name]=f;for(let p of t){let{section:m}=p.completion;m&&(p.score+=c[typeof m=="string"?m:m.name])}}let a=[],r=null,h=l.compareCompletions;for(let c of t.sort((f,u)=>u.score-f.score||h(f.completion,u.completion))){let f=c.completion;!r||r.label!=f.label||r.detail!=f.detail||r.type!=null&&f.type!=null&&r.type!=f.type||r.apply!=f.apply||r.boost!=f.boost?a.push(c):Me(c.completion)>Me(r)&&(a[a.length-1]=c),r=c.completion}return a}var ae=class i{constructor(e,t,n,o,s,l){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=o,this.selected=s,this.disabled=l}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new i(this.options,Be(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,o,s,l){if(o&&!l&&e.some(h=>h.isPending))return o.setDisabled();let a=st(e,t);if(!a.length)return o&&e.some(h=>h.isPending)?o.setDisabled():null;let r=t.facet(g).selectOnOpen?0:-1;if(o&&o.selected!=r&&o.selected!=-1){let h=o.options[o.selected].completion;for(let c=0;c<a.length;c++)if(a[c].completion==h){r=c;break}}return new i(a,Be(n,r),{pos:e.reduce((h,c)=>c.hasResult()?Math.min(h,c.from):h,1e8),create:ht,above:s.aboveCursor},o?o.timestamp:Date.now(),r,!1)}map(e){return new i(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new i(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},ce=class i{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new i(ct,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(g),s=(n.override||t.languageDataAt("autocomplete",D(t)).map(et)).map(r=>(this.active.find(c=>c.source==r)||new T(r,this.active.some(c=>c.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((r,h)=>r==this.active[h])&&(s=this.active);let l=this.open,a=e.effects.some(r=>r.is(ge));l&&e.docChanged&&(l=l.map(e.changes)),e.selection||s.some(r=>r.hasResult()&&e.changes.touchesRange(r.from,r.to))||!lt(s,this.active)||a?l=ae.build(s,t,this.id,l,n,a):l&&l.disabled&&!s.some(r=>r.isPending)&&(l=null),!l&&s.every(r=>!r.isPending)&&s.some(r=>r.hasResult())&&(s=s.map(r=>r.hasResult()?new T(r.source,0):r));for(let r of e.effects)r.is(me)&&(l=l&&l.setSelected(r.value,this.id));return s==this.active&&l==this.open?this:new i(s,this.id,l)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?rt:at}};function lt(i,e){if(i==e)return!0;for(let t=0,n=0;;){for(;t<i.length&&!i[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let o=t==i.length,s=n==e.length;if(o||s)return o==s;if(i[t++].result!=e[n++].result)return!1}}var rt={"aria-autocomplete":"list"},at={};function Be(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}var ct=[];function Ve(i,e){if(i.isUserEvent("input.complete")){let n=i.annotation(de);if(n&&e.activateOnCompletion(n))return 12}let t=i.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:i.isUserEvent("delete.backward")?2:i.selection?8:i.docChanged?16:0}var T=class i{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=Ve(e,t),o=this;(n&8||n&16&&this.touches(e))&&(o=new i(o.source,0)),n&4&&o.state==0&&(o=new i(this.source,1)),o=o.updateFor(e,n);for(let s of e.effects)if(s.is(Q))o=new i(o.source,1,s.value);else if(s.is(B))o=new i(o.source,0);else if(s.is(ge))for(let l of s.value)l.source==o.source&&(o=l);return o}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(D(e.state))}},X=class i extends T{constructor(e,t,n,o,s,l){super(e,3,t),this.limit=n,this.result=o,this.from=s,this.to=l}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let o=this.result;o.map&&!e.changes.empty&&(o=o.map(o,e.changes));let s=e.changes.mapPos(this.from),l=e.changes.mapPos(this.to,1),a=D(e.state);if(a>l||!o||t&2&&(D(e.startState)==this.from||a<this.limit))return new T(this.source,t&4?1:0);let r=e.changes.mapPos(this.limit);return ft(o.validFor,e.state,s,l)?new i(this.source,this.explicit,r,o,s,l):o.update&&(o=o.update(o,s,l,new z(e.state,a,!1)))?new i(this.source,this.explicit,r,o,o.from,(n=o.to)!==null&&n!==void 0?n:D(e.state)):new T(this.source,1,this.explicit)}map(e){if(e.empty)return this;let t=this.result.map?this.result.map(this.result,e):this.result;return t?new i(this.source,this.explicit,e.mapPos(this.limit),t,e.mapPos(this.from),e.mapPos(this.to,1)):new T(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function ft(i,e,t,n){if(!i)return!1;let o=e.sliceDoc(t,n);return typeof i=="function"?i(o,t,n,e):He(i,!0).test(o)}var ge=I.define({map(i,e){return i.map(t=>t.map(e))}}),b=j.define({create(){return ce.start()},update(i,e){return i.update(e)},provide:i=>[De.from(i,e=>e.tooltip),A.contentAttributes.from(i,e=>e.attrs)]});function ye(i,e){let t=e.completion.apply||e.completion.label,n=i.state.field(b).active.find(o=>o.source==e.source);return n instanceof X?(typeof t=="string"?i.dispatch({..._e(i.state,t,n.from,n.to),annotations:de.of(e.completion)}):t(i,e.completion,n.from,n.to),!0):!1}var ht=nt(b,ye);function K(i,e="option"){return t=>{let n=t.state.field(b,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(g).interactionDelay)return!1;let o=1,s;e=="page"&&(s=te(t,n.open.tooltip))&&(o=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:l}=n.open.options,a=n.open.selected>-1?n.open.selected+o*(i?1:-1):i?0:l-1;return a<0?a=e=="page"?0:l-1:a>=l&&(a=e=="page"?l-1:0),t.dispatch({effects:me.of(a)}),!0}}var ut=i=>{let e=i.state.field(b,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(g).interactionDelay?!1:ye(i,e.open.options[e.open.selected])},ne=i=>i.state.field(b,!1)?(i.dispatch({effects:Q.of(!0)}),!0):!1,pt=i=>{let e=i.state.field(b,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:B.of(null)}),!0)},fe=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},dt=50,mt=1e3,gt=Ee.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(b).active)e.isPending&&this.startQuery(e)}update(i){let e=i.state.field(b),t=i.state.facet(g);if(!i.selectionSet&&!i.docChanged&&i.startState.field(b)==e)return;let n=i.transactions.some(s=>{let l=Ve(s,t);return l&8||(s.selection||s.docChanged)&&!(l&3)});for(let s=0;s<this.running.length;s++){let l=this.running[s];if(n||l.context.abortOnDocChange&&i.docChanged||l.updates.length+i.transactions.length>dt&&Date.now()-l.time>mt){for(let a of l.context.abortListeners)try{a()}catch(r){q(this.view.state,r)}l.context.abortListeners=null,this.running.splice(s--,1)}else l.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(s=>s.effects.some(l=>l.is(Q)))&&(this.pendingStart=!0);let o=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(l=>l.active.source==s.source))?setTimeout(()=>this.startUpdate(),o):-1,this.composing!=0)for(let s of i.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(b);for(let t of e.active)t.isPending&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(g).updateSyncTime))}startQuery(i){let{state:e}=this.view,t=D(e),n=new z(e,t,i.explicit,this.view),o=new fe(i,n);this.running.push(o),Promise.resolve(i.source(n)).then(s=>{o.context.aborted||(o.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:B.of(null)}),q(this.view.state,s)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(g).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(g),n=this.view.state.field(b);for(let o=0;o<this.running.length;o++){let s=this.running[o];if(s.done===void 0)continue;if(this.running.splice(o--,1),s.done){let a=D(s.updates.length?s.updates[0].startState:this.view.state),r=Math.min(a,s.done.from+(s.active.explicit?0:1)),h=new X(s.active.source,s.active.explicit,r,s.done,s.done.from,(i=s.done.to)!==null&&i!==void 0?i:a);for(let c of s.updates)h=h.update(c,t);if(h.hasResult()){e.push(h);continue}}let l=n.active.find(a=>a.source==s.active.source);if(l&&l.isPending)if(s.done==null){let a=new T(s.active.source,0);for(let r of s.updates)a=a.update(r,t);a.isPending||e.push(a)}else this.startQuery(l)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:ge.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(b,!1);if(e&&e.tooltip&&this.view.state.facet(g).closeOnBlur){let t=e.open&&te(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:B.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Q.of(!1)}),20),this.composing=0}}}),yt=typeof navigator=="object"&&/Win/.test(navigator.platform),bt=H.highest(A.domEventHandlers({keydown(i,e){let t=e.state.field(b,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(yt&&i.altKey)||i.metaKey)return!1;let n=t.open.options[t.open.selected],o=t.active.find(l=>l.source==n.source),s=n.completion.commitCharacters||o.result.commitCharacters;return s&&s.indexOf(i.key)>-1&&ye(e,n),!1}})),qe=A.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),he=class{constructor(e,t,n,o){this.field=e,this.line=t,this.from=n,this.to=o}},ue=class i{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,U.TrackDel),n=e.mapPos(this.to,1,U.TrackDel);return t==null||n==null?null:new i(this.field,t,n)}},pe=class i{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],o=[t],s=e.doc.lineAt(t),l=/^\s*/.exec(s.text)[0];for(let r of this.lines){if(n.length){let h=l,c=/^\t*/.exec(r)[0].length;for(let f=0;f<c;f++)h+=e.facet(Re);o.push(t+h.length-c),r=h+r.slice(c)}n.push(r),t+=r.length+1}let a=this.fieldPositions.map(r=>new ue(r.field,o[r.line]+r.from,o[r.line]+r.to));return{text:n,ranges:a}}static parse(e){let t=[],n=[],o=[],s;for(let l of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(l);){let a=s[1]?+s[1]:null,r=s[2]||s[3]||"",h=-1;a===0&&(a=1e9);let c=r.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f<t.length;f++)(a!=null?t[f].seq==a:c&&t[f].name==c)&&(h=f);if(h<0){let f=0;for(;f<t.length&&(a==null||t[f].seq!=null&&t[f].seq<a);)f++;t.splice(f,0,{seq:a,name:c}),h=f;for(let u of o)u.field>=h&&u.field++}for(let f of o)if(f.line==n.length&&f.from>s.index){let u=s[2]?3+(s[1]||"").length:2;f.from-=u,f.to-=u}o.push(new he(h,n.length,s.index,s.index+c.length)),l=l.slice(0,s.index)+r+l.slice(s.index+s[0].length)}l=l.replace(/\\([{}])/g,(a,r,h)=>{for(let c of o)c.line==n.length&&c.from>h&&(c.from--,c.to--);return r}),n.push(l)}return new i(n,o)}},xt=k.widget({widget:new class extends Oe{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),vt=k.mark({class:"cm-snippetField"}),P=class i{constructor(e,t){this.ranges=e,this.active=t,this.deco=k.set(e.map(n=>(n.from==n.to?xt:vt).range(n.from,n.to)),!0)}map(e){let t=[];for(let n of this.ranges){let o=n.map(e);if(!o)return null;t.push(o)}return new i(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}},W=I.define({map(i,e){return i&&i.map(e)}}),wt=I.define(),$=j.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(W))return t.value;if(t.is(wt)&&i)return new P(i.ranges,t.value)}return i&&e.docChanged&&(i=i.map(e.changes)),i&&e.selection&&!i.selectionInsideField(e.selection)&&(i=null),i},provide:i=>A.decorations.from(i,e=>e?e.deco:k.none)});function be(i,e){return v.create(i.filter(t=>t.field==e).map(t=>v.range(t.from,t.to)))}function Ct(i){let e=pe.parse(i);return(t,n,o,s)=>{let{text:l,ranges:a}=e.instantiate(t.state,o),{main:r}=t.state.selection,h={changes:{from:o,to:s==r.from?r.to:s,insert:ve.of(l)},scrollIntoView:!0,annotations:n?[de.of(n),Ce.userEvent.of("input.complete")]:void 0};if(a.length&&(h.selection=be(a,0)),a.some(c=>c.field>0)){let c=new P(a,0),f=h.effects=[W.of(c)];t.state.field($,!1)===void 0&&f.push(I.appendConfig.of([$,At,Et,qe]))}t.dispatch(t.state.update(h))}}function Ke(i){return({state:e,dispatch:t})=>{let n=e.field($,!1);if(!n||i<0&&n.active==0)return!1;let o=n.active+i,s=i>0&&!n.ranges.some(l=>l.field==o+i);return t(e.update({selection:be(n.ranges,o),effects:W.of(s?null:new P(n.ranges,o)),scrollIntoView:!0})),!0}}var St=({state:i,dispatch:e})=>i.field($,!1)?(e(i.update({effects:W.of(null)})),!0):!1,It=Ke(1),Tt=Ke(-1);var Ot=[{key:"Tab",run:It,shift:Tt},{key:"Escape",run:St}],$e=_.define({combine(i){return i.length?i[0]:Ot}}),At=H.highest(ee.compute([$e],i=>i.facet($e)));function zt(i,e){return{...e,apply:Ct(i)}}var Et=A.domEventHandlers({mousedown(i,e){let t=e.state.field($,!1),n;if(!t||(n=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let o=t.ranges.find(s=>s.from<=n&&s.to>=n);return!o||o.field==t.active?!1:(e.dispatch({selection:be(t.ranges,o.field),effects:W.of(t.ranges.some(s=>s.field>o.field)?new P(t.ranges,o.field):null),scrollIntoView:!0}),!0)}});function Dt(i){let e=i.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${e}]+`,"ug")}catch{return new RegExp(`[w${e}]`,"g")}}function Fe(i,e){return new RegExp(e(i.source),i.unicode?"u":"")}var We=Object.create(null);function Rt(i){return We[i]||(We[i]=new WeakMap)}function Ne(i,e,t,n,o){for(let s=i.iterLines(),l=0;!s.next().done;){let{value:a}=s,r;for(e.lastIndex=0;r=e.exec(a);)if(!n[r[0]]&&l+r.index!=o&&(t.push({type:"text",label:r[0]}),n[r[0]]=!0,t.length>=2e3))return;l+=a.length+1}}function ze(i,e,t,n,o){let s=i.length>=1e3,l=s&&e.get(i);if(l)return l;let a=[],r=Object.create(null);if(i.children){let h=0;for(let c of i.children){if(c.length>=1e3)for(let f of ze(c,e,t,n-h,o-h))r[f.label]||(r[f.label]=!0,a.push(f));else Ne(c,t,a,r,o-h);h+=c.length+1}}else Ne(i,t,a,r,o);return s&&a.length<2e3&&e.set(i,a),a}var Yt=i=>{var e;let t=(e=i.state.languageDataAt("wordChars",i.pos)[0])!==null&&e!==void 0?e:"",n=Dt(t),o=i.matchBefore(Fe(n,a=>a+"$"));if(!o&&!i.explicit)return null;let s=o?o.from:i.pos,l=ze(i.state.doc,Rt(t),n,5e4,s);return{from:s,options:l,validFor:Fe(n,a=>"^"+a)}},F={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},E=I.define({map(i,e){let t=e.mapPos(i,-1,U.TrackAfter);return t??void 0}}),xe=new class extends Ie{};xe.startSide=1;xe.endSide=-1;var Ye=j.define({create(){return Te.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:n=>n>=t.from&&n<=t.to})}for(let t of e.effects)t.is(E)&&(i=i.update({add:[xe.range(t.value,t.value+1)]}));return i}});function Qt(){return[Lt,Ye]}var oe="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";function Qe(i){for(let e=0;e<oe.length;e+=2)if(oe.charCodeAt(e)==i)return oe.charAt(e+1);return Z(i<128?i:i+1)}function Xe(i,e){return i.languageDataAt("closeBrackets",e)[0]||F}var Pt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Lt=A.inputHandler.of((i,e,t,n)=>{if((Pt?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let o=i.state.selection.main;if(n.length>2||n.length==2&&S(w(n,0))==1||e!=o.from||t!=o.to)return!1;let s=Mt(i.state,n);return s?(i.dispatch(s),!0):!1}),kt=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let n=Xe(i,i.selection.main.head).brackets||F.brackets,o=null,s=i.changeByRange(l=>{if(l.empty){let a=Bt(i.doc,l.head);for(let r of n)if(r==a&&G(i.doc,l.head)==Qe(w(r,0)))return{changes:{from:l.head-r.length,to:l.head+r.length},range:v.cursor(l.head-r.length)}}return{range:o=l}});return o||e(i.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!o},Xt=[{key:"Backspace",run:kt}];function Mt(i,e){let t=Xe(i,i.selection.main.head),n=t.brackets||F.brackets;for(let o of n){let s=Qe(w(o,0));if(e==o)return s==o?Wt(i,o,n.indexOf(o+o+o)>-1,t):$t(i,o,s,t.before||F.before);if(e==s&&Ge(i,i.selection.main.from))return Ft(i,o,s)}return null}function Ge(i,e){let t=!1;return i.field(Ye).between(0,i.doc.length,n=>{n==e&&(t=!0)}),t}function G(i,e){let t=i.sliceString(e,e+2);return t.slice(0,S(w(t,0)))}function Bt(i,e){let t=i.sliceString(e-2,e);return S(w(t,0))==t.length?t:t.slice(1)}function $t(i,e,t,n){let o=null,s=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:t,from:l.to}],effects:E.of(l.to+e.length),range:v.range(l.anchor+e.length,l.head+e.length)};let a=G(i.doc,l.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+t,from:l.head},effects:E.of(l.head+e.length),range:v.cursor(l.head+e.length)}:{range:o=l}});return o?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Ft(i,e,t){let n=null,o=i.changeByRange(s=>s.empty&&G(i.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:v.cursor(s.head+t.length)}:n={range:s});return n?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Wt(i,e,t,n){let o=n.stringPrefixes||F.stringPrefixes,s=null,l=i.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:E.of(a.to+e.length),range:v.range(a.anchor+e.length,a.head+e.length)};let r=a.head,h=G(i.doc,r),c;if(h==e){if(Ue(i,r))return{changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:v.cursor(r+e.length)};if(Ge(i,r)){let u=t&&i.sliceDoc(r,r+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:r,to:r+u.length,insert:u},range:v.cursor(r+u.length)}}}else{if(t&&i.sliceDoc(r-2*e.length,r)==e+e&&(c=je(i,r-2*e.length,o))>-1&&Ue(i,c))return{changes:{insert:e+e+e+e,from:r},effects:E.of(r+e.length),range:v.cursor(r+e.length)};if(i.charCategorizer(r)(h)!=V.Word&&je(i,r,o)>-1&&!Nt(i,r,e,o))return{changes:{insert:e+e,from:r},effects:E.of(r+e.length),range:v.cursor(r+e.length)}}return{range:s=a}});return s?null:i.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function Ue(i,e){let t=M(i).resolveInner(e+1);return t.parent&&t.from==e}function Nt(i,e,t,n){let o=M(i).resolveInner(e,-1),s=n.reduce((l,a)=>Math.max(l,a.length),0);for(let l=0;l<5;l++){let a=i.sliceDoc(o.from,Math.min(o.to,o.from+t.length+s)),r=a.indexOf(t);if(!r||r>-1&&n.indexOf(a.slice(0,r))>-1){let c=o.firstChild;for(;c&&c.from==o.from&&c.to-c.from>t.length+r;){if(i.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=o.to==e&&o.parent;if(!h)break;o=h}return!1}function je(i,e,t){let n=i.charCategorizer(e);if(n(i.sliceDoc(e-1,e))!=V.Word)return e;for(let o of t){let s=e-o.length;if(i.sliceDoc(s,e)==o&&n(i.sliceDoc(s-1,s))!=V.Word)return s}return-1}function Gt(i={}){return[bt,b,g.of(i),gt,jt,qe]}var Ut=[{key:"Ctrl-Space",run:ne},{mac:"Alt-`",run:ne},{mac:"Alt-i",run:ne},{key:"Escape",run:pt},{key:"ArrowDown",run:K(!0)},{key:"ArrowUp",run:K(!1)},{key:"PageDown",run:K(!0,"page")},{key:"PageUp",run:K(!1,"page")},{key:"Enter",run:ut}],jt=H.highest(ee.computeN([g],i=>i.facet(g).defaultKeymap?[Ut]:[]));function Jt(i){let e=i.field(b,!1);return e&&e.active.some(t=>t.isPending)?"pending":e&&e.active.some(t=>t.state!=0)?"active":null}export{z as a,Ze as b,Kt as c,ut as d,ne as e,pt as f,zt as g,Yt as h,Qt as i,Xt as j,Gt as k,Ut as l,Jt as m};
|