collabmd 0.1.44 → 0.1.45
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/dist/client/assets/{chunk-AXR3VHVW-0GTk_evH.js → chunk-ERSWUTIN-ME9RVNel.js} +3 -3
- package/dist/client/assets/{chunk-CZQZEIFA-DT3N9fo7.js → chunk-YGJVY4SA-CjSe7Bx7.js} +2 -2
- package/dist/client/assets/{comment-threads-D-iKphIp.js → comment-threads-DDegmaFO.js} +1 -1
- package/dist/client/assets/drawio-editor-ClE8jpoG.js +9 -0
- package/dist/client/assets/drawioEditor-CXaTM9Ds.js +2 -0
- package/dist/client/assets/editor-session-GTwZS6Df.js +16 -0
- package/dist/client/assets/embedded-editor-base-CiNEc8vy.css +1 -0
- package/dist/client/assets/{en-GADW4C6J-DQ6zyCEM.js → en-7NFCYGKX-BrgYZAEe.js} +1 -1
- package/dist/client/assets/{excalidraw-editor-BHu6k8d4.js → excalidraw-editor-BZVM81BO.js} +2 -2
- package/dist/client/assets/excalidraw-editor-CyGwOhLz.css +1 -0
- package/dist/client/assets/excalidraw-scene-C8n9CHsK.js +176 -0
- package/dist/client/assets/excalidrawEditor-DxJanCze.js +2 -0
- package/dist/client/assets/export-page-CUfws2T-.js +39 -0
- package/dist/client/assets/exportDocument-BCuxqXDY.js +2 -0
- package/dist/client/assets/exportDocument-DV-OX74E.css +1 -0
- package/dist/client/assets/image-QXRYHUNP-lfTHE3bb.js +1 -0
- package/dist/client/assets/index-C3YnUgMD.css +1 -0
- package/dist/client/assets/index-D2wXraJ1.js +2 -0
- package/dist/client/assets/main-DtiGz7uI.js +795 -0
- package/dist/client/assets/modulepreload-polyfill-P2Xu9kJm.js +1 -0
- package/dist/client/assets/preview-diagram-utils-txBCoW8d.js +1 -0
- package/dist/client/assets/quick-switcher-controller-shW_6vPY.js +12 -0
- package/dist/client/assets/room-CQLoqtMo.js +1 -0
- package/dist/client/assets/runtime-config-DSGmGE9V.js +1 -0
- package/dist/client/assets/vault-api-client-C6bcGwy-.js +5 -0
- package/dist/client/assets/{yjs-provider-reset-guard-Cox4nxwu.js → yjs-provider-reset-guard-DE0vINDP.js} +1 -1
- package/dist/client/drawio-editor.html +3 -2
- package/dist/client/excalidraw-editor.html +3 -2
- package/dist/client/export-document.html +4 -3
- package/dist/client/index.html +97 -27
- package/package.json +10 -12
- package/src/client/app/drawio-editor-entry.js +0 -3
- package/src/client/app/drawio-editor.html +1 -0
- package/src/client/app/excalidraw-editor-entry.js +0 -3
- package/src/client/app/excalidraw-editor.html +1 -0
- package/src/client/app/export-document-entry.js +0 -3
- package/src/client/app/export-document.html +1 -0
- package/src/client/app/index.html +94 -24
- package/src/client/app/main-entry.js +0 -5
- package/src/client/application/app-shell/chat-feature.js +180 -124
- package/src/client/application/app-shell/comments-feature.js +1 -1
- package/src/client/application/app-shell/git-feature.js +4 -9
- package/src/client/application/app-shell/presence-feature.js +16 -10
- package/src/client/application/app-shell/ui-feature-shell.js +33 -15
- package/src/client/application/app-shell/ui-feature-sidebar.js +74 -1
- package/src/client/application/app-shell/ui-feature-tab-activity.js +2 -2
- package/src/client/application/app-shell/workspace-feature.js +22 -83
- package/src/client/application/app-shell-elements.js +7 -1
- package/src/client/application/diagram-chrome.js +161 -166
- package/src/client/application/diagram-preview-export.js +7 -34
- package/src/client/application/diagram-preview-hydrator.js +1 -19
- package/src/client/application/markdown-frontmatter.js +0 -2
- package/src/client/application/mermaid-preview-hydrator.js +1 -14
- package/src/client/application/plantuml-preview-hydrator.js +0 -10
- package/src/client/application/preview-diagram-utils.js +31 -2
- package/src/client/application/preview-render-compiler.js +2 -1
- package/src/client/application/preview-renderer.js +2 -2
- package/src/client/application/quick-switcher-loader.js +3 -1
- package/src/client/application/workspace-preview-controller.js +0 -3
- package/src/client/bootstrap/collabmd-app-shell.js +125 -39
- package/src/client/domain/excalidraw-collaboration.js +0 -2
- package/src/client/domain/room.js +38 -0
- package/src/client/export/export-pipeline.js +6 -34
- package/src/client/infrastructure/auth-client.js +4 -10
- package/src/client/infrastructure/browser-notification-port.js +33 -20
- package/src/client/infrastructure/browser-preferences-port.js +36 -9
- package/src/client/infrastructure/editor-view-adapter.js +87 -3
- package/src/client/infrastructure/lobby-presence.js +1 -0
- package/src/client/infrastructure/vault-api-client.js +25 -0
- package/src/client/infrastructure/workspace-sync-client.js +13 -1
- package/src/client/presentation/comment-overview-controller.js +18 -53
- package/src/client/presentation/comment-ui/comment-ui-card.js +1 -12
- package/src/client/presentation/comment-ui/comment-ui-layout.js +242 -219
- package/src/client/presentation/comment-ui/comment-ui-render.js +32 -45
- package/src/client/presentation/comment-ui/comment-ui-shared.js +65 -14
- package/src/client/presentation/comment-ui-controller.js +5 -1
- package/src/client/presentation/file-action-controller.js +32 -0
- package/src/client/presentation/file-explorer-controller.js +33 -3
- package/src/client/presentation/file-explorer-view.js +49 -5
- package/src/client/presentation/file-tree-state.js +10 -4
- package/src/client/presentation/quick-switcher-controller.js +243 -72
- package/src/client/presentation/quick-switcher-text-search.js +2 -2
- package/src/client/presentation/toast-controller.js +3 -0
- package/src/client/styles/components/feedback.css +6 -0
- package/src/client/styles/features/collaboration-chat.css +49 -53
- package/src/client/styles/features/collaboration-presence.css +9 -7
- package/src/client/styles/features/comment-card.css +25 -11
- package/src/client/styles/features/comment-overlays.css +0 -4
- package/src/client/styles/features/comment-overview.css +44 -21
- package/src/client/styles/features/comments-drawer.css +2 -100
- package/src/client/styles/features/diagram-preview.css +5 -18
- package/src/client/styles/features/embedded-preview.css +8 -33
- package/src/client/styles/features/quick-switcher.css +8 -0
- package/src/client/styles/foundation/tokens.css +1 -0
- package/src/client/styles/layout/editor-page.css +40 -0
- package/src/client/styles/layout/responsive.css +31 -1
- package/src/client/styles/layout/shell.css +25 -6
- package/src/client/styles/layout/sidebar.css +47 -15
- package/src/client/styles/overrides/codemirror.css +217 -15
- package/src/server/application/workspace-reconciliation.js +1 -1
- package/src/server/create-app-server.js +2 -3
- package/src/server/domain/bases/base-query-service.js +1 -77
- package/src/server/domain/comment-overview.js +10 -3
- package/src/server/domain/docx-exporter.js +24 -33
- package/src/server/domain/ripgrep-search-service.js +3 -1
- package/src/server/domain/workspace-state.js +32 -11
- package/src/server/infrastructure/git/diff-service.js +24 -13
- package/src/server/infrastructure/git/git-service.js +40 -10
- package/src/server/infrastructure/git/history-service.js +42 -29
- package/src/server/infrastructure/git/path-utils.js +1 -1
- package/src/server/infrastructure/git/responses.js +0 -95
- package/src/server/infrastructure/github/github-app-client.js +22 -15
- package/src/server/infrastructure/http/create-request-handler.js +2 -8
- package/src/server/infrastructure/http/create-vault-api-command-handler.js +5 -5
- package/src/server/infrastructure/http/http-errors.js +7 -1
- package/dist/client/assets/bases-preview-controller-2pLHk0uk.js +0 -143
- package/dist/client/assets/button-BCEiw4Rw.js +0 -1
- package/dist/client/assets/diagram-action-icons-aa_KOv9h.js +0 -36
- package/dist/client/assets/drawio-editor-DDvFoarP.js +0 -9
- package/dist/client/assets/drawio-embed-controller-BD1GTRwn.js +0 -1
- package/dist/client/assets/drawioEditor-Bu5grlH5.js +0 -2
- package/dist/client/assets/editor-session-DGlpiAsK.js +0 -16
- package/dist/client/assets/embedded-editor-base-C9roKYpW.css +0 -1
- package/dist/client/assets/excalidraw-editor-Cr_184EF.css +0 -1
- package/dist/client/assets/excalidraw-embed-controller-y2fenN_g.js +0 -1
- package/dist/client/assets/excalidraw-embed-reconciler-DGiagExg.js +0 -1
- package/dist/client/assets/excalidraw-scene-BvsQ6mLP.js +0 -176
- package/dist/client/assets/excalidrawEditor-4vFE--Uw.js +0 -2
- package/dist/client/assets/export-page-Cby8JzPO.js +0 -39
- package/dist/client/assets/exportDocument-C9v-bc7I.css +0 -1
- package/dist/client/assets/exportDocument-CRHCfsdo.js +0 -2
- package/dist/client/assets/file-history-view-controller-BDjEV9xJ.js +0 -112
- package/dist/client/assets/git-diff-view-controller-DgdM1aqb.js +0 -150
- package/dist/client/assets/git-panel-controller-BDTR2HVp.js +0 -207
- package/dist/client/assets/image-XGD7JQR6-XDUWHRpO.js +0 -1
- package/dist/client/assets/index-7xOyXDhP.css +0 -1
- package/dist/client/assets/index-Bz1KuQ6y.js +0 -2
- package/dist/client/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/dist/client/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/dist/client/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/dist/client/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/dist/client/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/dist/client/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/dist/client/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-cyrillic-400-normal-BEIGL1Tu.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/dist/client/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/dist/client/assets/jetbrains-mono-greek-400-normal-C190GLew.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/client/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/dist/client/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/dist/client/assets/main-Ci07m9oP.js +0 -152
- package/dist/client/assets/preview-diagram-utils-n_bbJA9V.js +0 -1
- package/dist/client/assets/quick-switcher-controller-CoiYvllm.js +0 -12
- package/dist/client/assets/room-CDrmIdDt.js +0 -1
- package/dist/client/assets/runtime-config-CDgeuPWN.js +0 -1
- package/dist/client/assets/runtime-config-loader-BHGniHP5.js +0 -1
- package/dist/client/assets/runtime-paths-DvpihCEq.js +0 -1
- package/dist/client/assets/segmented-control-DJrHSz8M.js +0 -1
- package/dist/client/assets/vault-api-client-sLB2bo56.js +0 -1
- package/dist/client/assets/vault-paths-CVkuh0j-.js +0 -5
- package/src/client/bootstrap/lazy-controller-feature.js +0 -433
- package/src/client/infrastructure/backlinks-api-client.js +0 -16
- package/src/client/infrastructure/plantuml-api-client.js +0 -19
- package/src/client/infrastructure/runtime-config-loader.js +0 -56
- package/src/server/infrastructure/git/command-runner.js +0 -49
- package/src/server/infrastructure/git/errors.js +0 -8
- package/src/server/infrastructure/http/create-esm-proxy-handler.js +0 -130
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import{c as e}from"./file-kind-BKPOIRPE.js";import{n as t}from"./vault-utils-wdQ0RNR9.js";import{n}from"./runtime-paths-DvpihCEq.js";import{i as r,n as i}from"./browser-utils-CKtI_rZl.js";import{r as a,t as o}from"./button-BCEiw4Rw.js";import{n as s,t as c}from"./segmented-control-DJrHSz8M.js";function l(){return`base-${Math.random().toString(36).slice(2,10)}`}function u(e=``){return/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/iu.test(String(e??``).trim())}function d(e=``){return/^https?:\/\/.+\.(?:png|jpe?g|webp|gif|svg)(?:[?#].*)?$/iu.test(String(e??``).trim())}function f(e){return Object.prototype.toString.call(e)===`[object Object]`}function p(e=`and`){return{children:[],conjunction:e,type:`group`}}function m(e,t,n){let r=e.image||t.find(e=>[`cover`,`image`].includes(String(e.id??``).toLowerCase()))?.id||null;return r?n.cells[r]??null:null}function h(e){return String(e?.text??``)}function g(e=``){return n(`/attachment?path=${encodeURIComponent(e)}`)}function ee(t={}){if(t?.type===`image`&&t.path)return g(t.path);if(t?.type===`link`){if(t.external&&d(t.url))return t.url;if(t.path&&e(t.path))return g(t.path)}let n=h(t);return d(n)?n:e(n)?g(n):``}function _(e={}){let n=e?.type||`string`;if(n===`empty`)return`<span class="bases-value bases-value-empty">—</span>`;if(n===`boolean`)return`<span class="bases-value bases-value-boolean">${e.value?`True`:`False`}</span>`;if(n===`image`&&e.path)return`<img class="bases-inline-image" src="${t(g(e.path))}" alt="${t(h(e))}">`;if(n===`list`)return`<span class="bases-value-list">${(e.items??[]).map(e=>`<span class="bases-value-pill">${_(e)}</span>`).join(``)}</span>`;if(n===`link`){if(e.external&&e.url)return`<a class="bases-link" href="${t(e.url)}" target="_blank" rel="noopener noreferrer">${t(h(e))}</a>`;if(e.path)return`<button type="button" class="${t(o({variant:`secondary`,size:`compact`,pill:!0,extra:[`bases-link`,`bases-link-button`]}))}" data-base-open-file="${t(e.path)}">${t(h(e))}</button>`}if(n===`file`&&e.path)return`<button type="button" class="${t(o({variant:`secondary`,size:`compact`,pill:!0,extra:[`bases-link`,`bases-link-button`]}))}" data-base-open-file="${t(e.path)}">${t(h(e))}</button>`;let r=h(e);return`<span class="bases-value">${t(r)}</span>`}function v(e,n){let r=n?.cells?.[e.id]??null;return n?.path&&r&&r.type!==`empty`&&(e.id===`file.name`||e.id===`file.basename`)?`<button type="button" class="${t(o({variant:`secondary`,size:`compact`,pill:!0,extra:[`bases-link`,`bases-link-button`]}))}" data-base-open-file="${t(n.path)}">${t(h(r))}</button>`:_(r)}function y(e=[]){return!Array.isArray(e)||e.length===0?``:`<div class="bases-summaries">${e.map(e=>`<div class="bases-summary"><span class="bases-summary-label">${t(e.label)}</span><span class="bases-summary-value">${t(h(e.value))}</span></div>`).join(``)}</div>`}function te(e,n){return n.map(n=>`<section class="bases-group"><header class="bases-group-header"><h3>${t(n.label)}</h3>${y(n.summaries)}</header><div class="bases-table-shell"><table class="bases-table"><thead><tr>${e.map(e=>`<th>${t(e.label)}</th>`).join(``)}</tr></thead><tbody>${(n.rows??[]).map(t=>`<tr>${e.map(e=>`<td>${v(e,t)}</td>`).join(``)}</tr>`).join(``)}</tbody></table></div></section>`).join(``)}function ne(e,n){return n.map(n=>`<section class="bases-group"><header class="bases-group-header"><h3>${t(n.label)}</h3>${y(n.summaries)}</header><ul class="bases-list">${(n.rows??[]).map(n=>`<li class="bases-list-item">${e.map(e=>{let r=n.cells[e.id];return!r||r.type===`empty`?``:`<span class="bases-list-field"><strong>${t(e.label)}:</strong> ${v(e,n)}</span>`}).join(``)}</li>`).join(``)}</ul></section>`).join(``)}function re(e,n,r){return n.map(n=>`<section class="bases-group"><header class="bases-group-header"><h3>${t(n.label)}</h3>${y(n.summaries)}</header><div class="bases-cards">${(n.rows??[]).map(n=>{let i=m(r,e,n),a=h(i),o=``;if(u(a))o=`<div class="bases-card-media bases-card-media-color" style="--bases-card-swatch:${t(a)}"></div>`;else{let e=ee(i);e&&(o=`<img class="bases-card-media" src="${t(e)}" alt="${t(a)}">`)}return`<article class="bases-card">${o}<div class="bases-card-body">${e.map(e=>{let r=n.cells[e.id];return!r||r.type===`empty`?``:`<div class="bases-card-field"><div class="bases-card-label">${t(e.label)}</div><div class="bases-card-value">${v(e,n)}</div></div>`}).join(``)}</div></article>`}).join(``)}</div></section>`).join(``)}function b(e){if(!e.view.supported)return`<div class="bases-unsupported">CollabMD parsed this view but does not render the <code>${t(e.view.type)}</code> layout yet.</div>`;switch(e.view.type){case`cards`:return re(e.columns,e.groups,e.view);case`list`:return ne(e.columns,e.groups);default:return te(e.columns,e.groups)}}function x(e){return(e.views??[]).map(n=>`<button type="button" class="${t(c({active:n.id===e.view.id,extra:`bases-view-tab`}))}" data-base-view="${t(n.id)}">${t(n.name)}</button>`).join(``)}function S(e){return e?.meta??{}}function C(e){return S(e).availableProperties??[]}function w(e){let t=S(e).activeViewConfig?.order;return Array.isArray(t)&&t.length>0?[...t]:Array.isArray(e?.columns)?e.columns.map(e=>e.id).filter(Boolean):[]}function T(e,t=``){return C(e).find(e=>e.id===t)??null}function E(e,t=``){return T(e,t)?.filterOperators??[`is`,`is not`,`contains`,`does not contain`,`is empty`,`is not empty`]}function D(e){let t=S(e).activeViewConfig??{};return{filters:t.filters??null,groupBy:t.groupBy??null,order:Array.isArray(t.order)?[...t.order]:[],sort:Array.isArray(t.sort)?t.sort.map(e=>({...e})):[]}}function ie(e){return!!(e?.payload?.path&&e?.payload?.sourcePath&&e.payload.path===e.payload.sourcePath)}function O(e,n,r,i){let a=r.ui?.openPanel===n,s=!!S(i).editable;return`<button type="button" class="${t(o({variant:a?`primary`:`secondary`,pill:!0,extra:[`bases-toolbar-btn`,a?`is-active`:``]}))}" data-base-panel="${t(n)}"${s?``:` disabled`}>${t(e)}</button>`}function k(e,t=``){if(!e||e.type!==`group`||!t)return e;let n=(e.children??[]).flatMap(e=>{if(e?.type===`group`){let n=k(e,t);return n?[n]:[]}return e?.propertyId===t?[]:[e]});return{...e,children:n}}function A(e,t=``,n=e?.result){let r=S(n).activeViewConfig?.filters??null,i=R(r),a=t&&i?I(k(i,t),n):r;return JSON.stringify({filters:a,path:e?.payload?.path??``,source:e?.payload?.source??null,sourcePath:e?.payload?.sourcePath??``,view:n?.view?.id??e?.payload?.view??``})}function ae(e,t=``,n=e?.result){let r=e?.propertyValueOptions?.get(t)??null;return r&&r.cacheKey===A(e,t,n)?r.values??[]:[]}function j(e,t){return[O(`Sort`,`sort`,t,e),O(`Filter`,`filter`,t,e),O(`Properties`,`properties`,t,e)].join(``)}function M(e,{allowBlank:n=!1,selected:r=``}={}){let i=[];return n&&i.push(`<option value=""${r?``:` selected`}>Property</option>`),C(e).forEach(e=>{i.push(`<option value="${t(e.id)}"${e.id===r?` selected`:``}>${t(e.label)}</option>`)}),i.join(``)}function oe(e){let n=D(e),r=T(e,n.groupBy?.property)?.sortDirections??[{id:`asc`,label:`A → Z`},{id:`desc`,label:`Z → A`}],i=n.sort??[];return`
|
|
2
|
-
<section class="bases-panel-card">
|
|
3
|
-
<div class="bases-panel-section">
|
|
4
|
-
<div class="bases-panel-title">Group by</div>
|
|
5
|
-
<div class="bases-sort-row">
|
|
6
|
-
<select class="${t(a({extra:`bases-select bases-sort-property`}))}" data-base-group-by-property>
|
|
7
|
-
${M(e,{allowBlank:!0,selected:n.groupBy?.property??``})}
|
|
8
|
-
</select>
|
|
9
|
-
<select class="${t(a({extra:`bases-select bases-sort-direction`}))}" data-base-group-by-direction${n.groupBy?.property?``:` disabled`}>
|
|
10
|
-
${r.map(e=>`<option value="${t(e.id)}"${e.id===(n.groupBy?.direction??`asc`)?` selected`:``}>${t(e.label)}</option>`).join(``)}
|
|
11
|
-
</select>
|
|
12
|
-
<button type="button" class="${t(o({variant:`secondary`,size:`compact`}))}" data-base-clear-group-by${n.groupBy?.property?``:` disabled`}>Clear</button>
|
|
13
|
-
</div>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="bases-panel-section">
|
|
16
|
-
<div class="bases-panel-title">Sort by</div>
|
|
17
|
-
<div class="bases-sort-list">
|
|
18
|
-
${i.map((n,r)=>{let s=T(e,n.property)?.sortDirections??[{id:`asc`,label:`A → Z`},{id:`desc`,label:`Z → A`}];return`
|
|
19
|
-
<div class="bases-sort-row">
|
|
20
|
-
<select class="${t(a({extra:`bases-select bases-sort-property`}))}" data-base-sort-property="${r}">
|
|
21
|
-
${M(e,{selected:n.property})}
|
|
22
|
-
</select>
|
|
23
|
-
<select class="${t(a({extra:`bases-select bases-sort-direction`}))}" data-base-sort-direction="${r}">
|
|
24
|
-
${s.map(e=>`<option value="${t(e.id)}"${e.id===n.direction?` selected`:``}>${t(e.label)}</option>`).join(``)}
|
|
25
|
-
</select>
|
|
26
|
-
<button type="button" class="${t(o({variant:`secondary`,size:`compact`}))}" data-base-sort-move="${r}:up"${r===0?` disabled`:``}>↑</button>
|
|
27
|
-
<button type="button" class="${t(o({variant:`secondary`,size:`compact`}))}" data-base-sort-move="${r}:down"${r===i.length-1?` disabled`:``}>↓</button>
|
|
28
|
-
<button type="button" class="${t(o({variant:`secondary`,size:`compact`}))}" data-base-sort-delete="${r}">Delete</button>
|
|
29
|
-
</div>
|
|
30
|
-
`}).join(``)}
|
|
31
|
-
</div>
|
|
32
|
-
<button type="button" class="${t(o({variant:`secondary`,size:`compact`}))}" data-base-sort-add>Add sort</button>
|
|
33
|
-
</div>
|
|
34
|
-
</section>
|
|
35
|
-
`}function N(e=[]){return e.join(`.`)}function P(e=``){return String(e??``).split(`.`).filter(e=>e!==``).map(e=>Number.parseInt(e,10)).filter(Number.isFinite)}function se(e=``){return JSON.stringify(String(e??``))}function F(e=``,t=`text`,n=`is`){let r=String(e??``).trim();return!r&&n!==`is`&&n!==`is not`?`""`:t===`boolean`?r===`false`?`false`:`true`:t===`number`&&Number.isFinite(Number(r))?String(Number(r)):se(r)}function ce(e,t=null){if(!e?.propertyId||!e?.operator)return``;let n=e.propertyId,r=t?.valueType??`text`;switch(e.operator){case`contains`:return`${n}.contains(${F(e.value,r,e.operator)})`;case`does not contain`:return`!${n}.contains(${F(e.value,r,e.operator)})`;case`starts with`:return`${n}.startsWith(${F(e.value,r,e.operator)})`;case`ends with`:return`${n}.endsWith(${F(e.value,r,e.operator)})`;case`is`:return`${n} == ${F(e.value,r,e.operator)}`;case`is not`:return`${n} != ${F(e.value,r,e.operator)}`;case`>`:case`>=`:case`<`:case`<=`:return`${n} ${e.operator} ${F(e.value,r,e.operator)}`;case`is empty`:return`${n}.isEmpty()`;case`is not empty`:return`!${n}.isEmpty()`;default:return``}}function I(e,t){if(!e||e.type!==`group`)return null;let n=(e.children??[]).map(e=>e?.type===`group`?I(e,t):ce(e,T(t,e?.propertyId))).filter(Boolean);return n.length===0?null:e.conjunction===`not`?{not:n}:{[e.conjunction]:n}}function L(e=``){let t=String(e??``).trim();return t?t===`true`||t===`false`?t:t===`null`?``:/^-?\d+(?:\.\d+)?$/u.test(t)?t:t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1).replace(/\\(["'])/gu,`$1`):t:``}function le(e=``){let t=String(e??``).trim(),n=[[/^!([A-Za-z0-9_.]+)\.isEmpty\(\)$/u,(e,t)=>({operator:`is not empty`,propertyId:t,type:`rule`,value:``})],[/^([A-Za-z0-9_.]+)\.isEmpty\(\)$/u,(e,t)=>({operator:`is empty`,propertyId:t,type:`rule`,value:``})],[/^!([A-Za-z0-9_.]+)\.contains\((.+)\)$/u,(e,t,n)=>({operator:`does not contain`,propertyId:t,type:`rule`,value:L(n)})],[/^([A-Za-z0-9_.]+)\.contains\((.+)\)$/u,(e,t,n)=>({operator:`contains`,propertyId:t,type:`rule`,value:L(n)})],[/^([A-Za-z0-9_.]+)\.startsWith\((.+)\)$/u,(e,t,n)=>({operator:`starts with`,propertyId:t,type:`rule`,value:L(n)})],[/^([A-Za-z0-9_.]+)\.endsWith\((.+)\)$/u,(e,t,n)=>({operator:`ends with`,propertyId:t,type:`rule`,value:L(n)})],[/^([A-Za-z0-9_.]+)\s*(==|!=|>=|<=|>|<)\s*(.+)$/u,(e,t,n,r)=>({operator:{"!=":`is not`,"==":`is`,"<":`<`,"<=":`<=`,">":`>`,">=":`>=`}[n]??n,propertyId:t,type:`rule`,value:L(r)})]];for(let[e,r]of n){let n=t.match(e);if(n)return r(...n)}return null}function R(e){if(!e)return p(`and`);if(typeof e==`string`){let t=le(e);return t?{children:[t],conjunction:`and`,type:`group`}:null}if(!f(e))return null;if(Array.isArray(e.and)){let t=e.and.map(e=>R(e)).flatMap(e=>e?.type===`group`&&e.conjunction===`and`&&e.children?.length===1&&e.children[0]?.type===`rule`?e.children:[e]);return t.every(Boolean)?{children:t,conjunction:`and`,type:`group`}:null}if(Array.isArray(e.or)){let t=e.or.map(e=>R(e)).flatMap(e=>e?.type===`group`&&e.conjunction===`and`&&e.children?.length===1&&e.children[0]?.type===`rule`?e.children:[e]);return t.every(Boolean)?{children:t,conjunction:`or`,type:`group`}:null}if(e.not!=null){let t=(Array.isArray(e.not)?e.not:(()=>{let t=R(e.not);return t?t.type===`group`&&t.conjunction===`or`?t.children??[]:[t]:[]})()).flatMap(e=>{let t=e?.type?e:R(e);return t?t.type===`group`&&t.conjunction===`and`&&t.children?.length===1&&t.children[0]?.type===`rule`?t.children:[t]:[null]});return t.every(Boolean)?{children:t,conjunction:`not`,type:`group`}:null}return null}function z(e){return e?typeof e==`string`?e:JSON.stringify(e,null,2):``}function ue(e=``){let t=String(e??``).trim();return t?t.startsWith(`{`)||t.startsWith(`[`)?JSON.parse(t):t:null}function B(e,t=[]){let n=e;for(let e of t)n=n?.children?.[e];return n??null}function V(e,t=[],n){if(t.length===0)return n(e);let[r,...i]=t;return{...e,children:(e.children??[]).map((e,t)=>t===r?V(e,i,n):e)}}function de(e,t=[]){if(t.length===0)return e;let n=t.slice(0,-1),r=t[t.length-1];return V(e,n,e=>({...e,children:(e.children??[]).filter((e,t)=>t!==r)}))}function H(e,t=[],n){return V(e,t,e=>({...e,children:[...e.children??[],n]}))}function U(e,t=``){return M(e,{allowBlank:!0,selected:t})}function fe(e={}){return String(e?.text??e?.value??``).trim()}function W(e,t){return e.ui.builderFilter??R(D(t).filters)??p(`and`)}function G(e,n,r,i){let o=N(r),s=E(e,n.propertyId),c=String(n.value??``).trim().toLowerCase(),l=ae(i,n.propertyId,e).map(e=>({count:e?.count,text:fe(e)})).filter((e,t,n)=>e.text&&n.findIndex(t=>t.text===e.text)===t),u=l.some(e=>e.text.toLowerCase()===c),d=l.filter(e=>!c||e.text.toLowerCase().includes(c)),f=!c||u?l:d.length>0?d:l,p=f.length>0&&![`is empty`,`is not empty`].includes(n.operator);return{encodedPath:o,operators:s,suggestionListId:`bases-filter-suggestions-${t(i.key)}-${t(o.replace(/\./g,`-`))}`,suggestionsEnabled:p,valueInputClasses:a({extra:p?`bases-filter-value bases-filter-value--suggestions`:`bases-filter-value`}),valueSuggestions:f,valueDisabled:[`is empty`,`is not empty`].includes(n.operator)}}function K(e,n=``){return e.suggestionsEnabled?`
|
|
36
|
-
<div class="bases-filter-suggestion-list" id="${e.suggestionListId}" role="listbox">
|
|
37
|
-
${e.valueSuggestions.slice(0,8).map(r=>`
|
|
38
|
-
<button
|
|
39
|
-
type="button"
|
|
40
|
-
class="bases-filter-suggestion"
|
|
41
|
-
data-base-filter-suggestion="${t(e.encodedPath)}"
|
|
42
|
-
data-base-filter-suggestion-value="${t(r.text)}"
|
|
43
|
-
role="option"
|
|
44
|
-
aria-selected="${r.text===String(n??``)?`true`:`false`}"
|
|
45
|
-
>
|
|
46
|
-
<span class="bases-filter-suggestion-label">${t(r.text)}</span>
|
|
47
|
-
${r.count==null?``:`<span class="bases-filter-suggestion-meta">${t(String(r.count))}</span>`}
|
|
48
|
-
</button>
|
|
49
|
-
`).join(``)}
|
|
50
|
-
</div>
|
|
51
|
-
`:``}function pe(e,n,r,i){let a=G(e,n,r,i);return`
|
|
52
|
-
<div class="bases-filter-value-combobox${a.suggestionsEnabled?` has-suggestions`:``}">
|
|
53
|
-
<input class="${t(a.valueInputClasses)}" type="text" value="${t(n.value??``)}" data-base-filter-value="${t(a.encodedPath)}"${a.suggestionsEnabled?` aria-controls="${a.suggestionListId}" aria-haspopup="listbox" aria-autocomplete="list" autocomplete="off"`:``}${a.valueDisabled?` disabled`:``}>
|
|
54
|
-
${K(a,n.value??``)}
|
|
55
|
-
</div>
|
|
56
|
-
`}function me(e,n,r,i){let s=G(e,n,r,i);return`
|
|
57
|
-
<div class="bases-filter-row">
|
|
58
|
-
<select class="${t(a({extra:`bases-select bases-filter-property`}))}" data-base-filter-property="${t(s.encodedPath)}">
|
|
59
|
-
${U(e,n.propertyId)}
|
|
60
|
-
</select>
|
|
61
|
-
<select class="${t(a({extra:`bases-select bases-filter-operator`}))}" data-base-filter-operator="${t(s.encodedPath)}">
|
|
62
|
-
${s.operators.map(e=>`<option value="${t(e)}"${e===n.operator?` selected`:``}>${t(e)}</option>`).join(``)}
|
|
63
|
-
</select>
|
|
64
|
-
${pe(e,n,r,i)}
|
|
65
|
-
<button type="button" class="${t(o({variant:`secondary`,size:`compact`}))}" data-base-filter-remove="${t(s.encodedPath)}">Delete</button>
|
|
66
|
-
</div>
|
|
67
|
-
`}function q(e,t,n,{fallbackToFullRender:r=!0}={}){let i=Z(e)?.querySelector?.(`[data-base-panel-slot]`)??null,a=N(n),o=i?.querySelector?.(`[data-base-filter-value="${a}"]`)??null,s=o?.parentElement?.classList?.contains(`bases-filter-value-combobox`)?o.parentElement:null,c=B(W(e,t),n);if(!o||!s||!c||c.type!==`rule`||typeof o.insertAdjacentHTML!=`function`)return r&&$(e,t),!1;let l=G(t,c,n,e);return s.classList.toggle(`has-suggestions`,l.suggestionsEnabled),o.className=l.valueInputClasses,o.disabled=l.valueDisabled,o.value!==String(c.value??``)&&(o.value=String(c.value??``)),l.suggestionsEnabled?(o.setAttribute(`aria-controls`,l.suggestionListId),o.setAttribute(`aria-haspopup`,`listbox`),o.setAttribute(`aria-autocomplete`,`list`),o.setAttribute(`autocomplete`,`off`)):(o.removeAttribute(`aria-controls`),o.removeAttribute(`aria-haspopup`),o.removeAttribute(`aria-autocomplete`),o.removeAttribute(`autocomplete`)),s.querySelector(`.bases-filter-suggestion-list`)?.remove?.(),l.suggestionsEnabled&&o.insertAdjacentHTML(`afterend`,K(l,c.value??``)),!0}function J(e,t,n=[]){if(e){if(e.type===`rule`){t(e,n);return}(e.children??[]).forEach((e,r)=>{J(e,t,[...n,r])})}}function Y(e,n,r,i,{isRoot:s=!1}={}){let c=N(r);return`
|
|
68
|
-
<div class="bases-filter-group"${s?` data-base-filter-root`:``}>
|
|
69
|
-
<div class="bases-filter-group-header">
|
|
70
|
-
<select class="${t(a({extra:`bases-select bases-filter-conjunction`}))}" data-base-filter-conjunction="${t(c)}">
|
|
71
|
-
${[`and`,`or`,`not`].map(e=>`<option value="${e}"${n.conjunction===e?` selected`:``}>${t({and:`All the following are true`,not:`None of the following are true`,or:`Any of the following are true`}[e])}</option>`).join(``)}
|
|
72
|
-
</select>
|
|
73
|
-
${s?``:`<button type="button" class="${t(o({variant:`secondary`,size:`compact`}))}" data-base-filter-remove="${t(c)}">Delete group</button>`}
|
|
74
|
-
</div>
|
|
75
|
-
<div class="bases-filter-children">
|
|
76
|
-
${(n.children??[]).map((t,n)=>t?.type===`group`?Y(e,t,[...r,n],i):me(e,t,[...r,n],i)).join(``)}
|
|
77
|
-
</div>
|
|
78
|
-
<div class="bases-filter-actions-row">
|
|
79
|
-
<button type="button" class="${t(o({variant:`secondary`,size:`compact`}))}" data-base-filter-add-rule="${t(c)}">Add filter</button>
|
|
80
|
-
<button type="button" class="${t(o({variant:`secondary`,size:`compact`}))}" data-base-filter-add-group="${t(c)}">Add filter group</button>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
`}function he(e,n){let r=D(e).filters,i=n.ui.builderFilter??R(r);n.ui.builderFilter??(n.ui.builderFilter=i);let s=i?n.ui.filterMode??`builder`:`advanced`,c=n.ui.rawFilterText??z(r);return`
|
|
84
|
-
<section class="bases-panel-card">
|
|
85
|
-
<div class="bases-panel-title-row">
|
|
86
|
-
<div class="bases-panel-title">This view</div>
|
|
87
|
-
${i?`
|
|
88
|
-
<div class="bases-toggle-row">
|
|
89
|
-
<button type="button" class="${t(o({variant:s===`builder`?`primary`:`secondary`,size:`compact`}))}" data-base-filter-mode="builder">Builder</button>
|
|
90
|
-
<button type="button" class="${t(o({variant:s===`advanced`?`primary`:`secondary`,size:`compact`}))}" data-base-filter-mode="advanced">Advanced</button>
|
|
91
|
-
</div>
|
|
92
|
-
`:``}
|
|
93
|
-
</div>
|
|
94
|
-
${s===`advanced`?`
|
|
95
|
-
<label class="bases-filter-advanced-label">
|
|
96
|
-
<textarea class="${t(a({extra:`bases-filter-advanced`}))}" data-base-filter-advanced>${t(c)}</textarea>
|
|
97
|
-
</label>
|
|
98
|
-
<div class="bases-filter-actions-row">
|
|
99
|
-
<button type="button" class="${t(o({variant:`primary`,size:`compact`}))}" data-base-filter-save-advanced>Save filter</button>
|
|
100
|
-
</div>
|
|
101
|
-
`:Y(e,i??p(`and`),[],n,{isRoot:!0})}
|
|
102
|
-
</section>
|
|
103
|
-
`}function ge(e,n){let r=String(n.ui.propertySearch??``).trim().toLowerCase(),i=new Set(w(e)),o=C(e).filter(e=>!r||e.label.toLowerCase().includes(r)||e.id.toLowerCase().includes(r));return`
|
|
104
|
-
<section class="bases-panel-card">
|
|
105
|
-
<label class="bases-properties-search">
|
|
106
|
-
<input class="${t(a({extra:`bases-properties-search-input`}))}" type="search" value="${t(n.ui.propertySearch??``)}" placeholder="Find property" data-base-properties-search>
|
|
107
|
-
</label>
|
|
108
|
-
<div class="bases-properties-list" data-base-properties-list>
|
|
109
|
-
${o.map(e=>`
|
|
110
|
-
<label class="bases-property-option">
|
|
111
|
-
<input type="checkbox" data-base-property-toggle="${t(e.id)}"${i.has(e.id)?` checked`:``}>
|
|
112
|
-
<span class="bases-property-option-label">${t(e.label)}</span>
|
|
113
|
-
<span class="bases-property-option-meta">${t(e.kind)}</span>
|
|
114
|
-
</label>
|
|
115
|
-
`).join(``)}
|
|
116
|
-
</div>
|
|
117
|
-
</section>
|
|
118
|
-
`}function _e(e){let t=e?.querySelector?.(`[data-base-properties-list]`)??null,n=e?.querySelector?.(`[data-base-properties-search]`)??null,r=typeof document<`u`?document.activeElement:null,i=null;if(n&&r===n){let e=typeof n.selectionStart==`number`?n.selectionStart:null;i={selectionEnd:typeof n.selectionEnd==`number`?n.selectionEnd:e,selectionStart:e,type:`properties-search`}}else if(r?.dataset?.baseFilterValue!=null){let t=String(r.dataset.baseFilterValue),n=e?.querySelector?.(`[data-base-filter-value="${t}"]`)??null;if(n&&r===n){let e=typeof n.selectionStart==`number`?n.selectionStart:null;i={path:t,selectionEnd:typeof n.selectionEnd==`number`?n.selectionEnd:e,selectionStart:e,type:`filter-value`}}}return{focusedControl:i,propertiesListScrollTop:t?t.scrollTop:null}}function ve(e,t){if(t){if(t.propertiesListScrollTop!=null){let n=e?.querySelector?.(`[data-base-properties-list]`)??null;n&&(n.scrollTop=t.propertiesListScrollTop)}if(t.focusedControl?.type===`properties-search`){let n=e?.querySelector?.(`[data-base-properties-search]`)??null;n&&(n.focus?.(),typeof n.setSelectionRange==`function`&&t.focusedControl.selectionStart!=null&&n.setSelectionRange(t.focusedControl.selectionStart,t.focusedControl.selectionEnd??t.focusedControl.selectionStart));return}if(t.focusedControl?.type===`filter-value`&&t.focusedControl.path!=null){let n=e?.querySelector?.(`[data-base-filter-value="${t.focusedControl.path}"]`)??null;n&&(n.focus?.(),typeof n.setSelectionRange==`function`&&t.focusedControl.selectionStart!=null&&n.setSelectionRange(t.focusedControl.selectionStart,t.focusedControl.selectionEnd??t.focusedControl.selectionStart))}}}function X(e,t){if(!t.ui?.openPanel)return``;if(!S(e).editable)return`<section class="bases-panel-card"><div class="bases-readonly-note">Inline base previews are read-only. Open the .base file to edit its sort, filter, and properties.</div></section>`;switch(t.ui.openPanel){case`filter`:return he(e,t);case`properties`:return ge(e,t);default:return oe(e)}}function ye(e,n){return`
|
|
119
|
-
<section class="bases-shell" data-base-shell-key="${t(n.key)}">
|
|
120
|
-
<header class="bases-toolbar">
|
|
121
|
-
<div class="bases-toolbar-main">
|
|
122
|
-
<div class="${t(s({pill:!0,extra:`bases-tabs`}))}" data-base-tabs>
|
|
123
|
-
${x(e)}
|
|
124
|
-
</div>
|
|
125
|
-
<div class="bases-meta" data-base-meta>${t(String(e.totalRows??0))} results</div>
|
|
126
|
-
</div>
|
|
127
|
-
<div class="bases-toolbar-actions">
|
|
128
|
-
<div class="bases-toolbar-edit-actions" data-base-action-slot>${j(e,n)}</div>
|
|
129
|
-
<label class="bases-search-shell" aria-label="Search this base">
|
|
130
|
-
<svg class="bases-search-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
131
|
-
<circle cx="11" cy="11" r="7"></circle>
|
|
132
|
-
<path d="m20 20-3.5-3.5"></path>
|
|
133
|
-
</svg>
|
|
134
|
-
<input class="${t(a({extra:`bases-search-input`}))}" type="search" value="${t(n.search)}" placeholder="Search this base" aria-label="Search this base">
|
|
135
|
-
</label>
|
|
136
|
-
<button type="button" class="${t(o({variant:`secondary`,pill:!0,extra:`bases-export-btn`}))}">Export CSV</button>
|
|
137
|
-
</div>
|
|
138
|
-
</header>
|
|
139
|
-
<div class="bases-panels" data-base-panel-slot>${X(e,n)}</div>
|
|
140
|
-
<div data-base-summary-slot>${y(e.summaries)}</div>
|
|
141
|
-
<div class="bases-content" data-base-content>${b(e)}</div>
|
|
142
|
-
</section>
|
|
143
|
-
`}function Z(e){return e?.placeholder?.querySelector?e.placeholder.querySelector(`[data-base-shell-key="${e.key}"]`)??e.placeholder.querySelector(`.bases-shell`):null}function be(e){e?.classList&&(e.classList.add(`is-hydrated`),e.classList.remove(`diagram-preview-shell`))}function Q(e,t,{actions:n=!0,body:r=!0,meta:i=!0,panel:a=!0,summary:o=!0,tabs:s=!0}={}){let c=Z(e);if(!c?.querySelector){e.placeholder.innerHTML=ye(t,e),be(e.placeholder);return}let l=c.querySelector(`[data-base-tabs]`);s&&l&&(l.innerHTML=x(t));let u=c.querySelector(`[data-base-meta]`);i&&u&&(u.textContent=`${String(t.totalRows??0)} results`);let d=c.querySelector(`[data-base-action-slot]`);n&&d&&(d.innerHTML=j(t,e));let f=c.querySelector(`[data-base-panel-slot]`);if(a&&f){let n=_e(f);f.innerHTML=X(t,e),ve(f,n)}let p=c.querySelector(`[data-base-summary-slot]`);o&&p&&(p.innerHTML=y(t.summaries));let m=c.querySelector(`[data-base-content]`);r&&m&&(m.innerHTML=b(t));let h=c.querySelector(`.bases-search-input`);h&&h.value!==e.search&&(h.value=e.search)}function $(e,t){Q(e,t,{actions:!1,body:!1,meta:!1,summary:!1,tabs:!1})}var xe=class{constructor({getActiveFilePath:e=()=>``,getSession:t=()=>null,onOpenFile:n,previewElement:r,replaceBaseSource:i=null,toastController:a,vaultApiClient:o}){this.getActiveFilePath=e,this.getSession=t,this.onOpenFile=n,this.previewElement=r,this.replaceBaseSource=i,this.toastController=a,this.vaultApiClient=o,this.entries=new Map,this.searchTimers=new Map,this.applyFilterSuggestion=(e,t,n)=>{this.updateBuilderFilter(e,e=>V(e,t,e=>({...e,value:n})))},this.persistBuilderFilter=e=>{let t=W(e,e.result);e.ui.builderFilter=t,this.updateViewConfig(e,n=>(n.filters=I(t,e.result),n))},this.handlePointerDown=e=>{let t=e.target.closest(`[data-base-filter-suggestion]`);if(!t)return;let n=e.target.closest(`[data-base-shell-key]`),r=n?this.entries.get(n.dataset.baseShellKey||``):null;if(!r)return;e.preventDefault();let i=P(t.dataset.baseFilterSuggestion||``),a=t.dataset.baseFilterSuggestionValue||``;this.applyFilterSuggestion(r,i,a)},this.handleClick=e=>{let t=e.target.closest(`[data-base-open-file]`);if(t){e.preventDefault(),this.onOpenFile?.(t.dataset.baseOpenFile||``);return}let n=e.target.closest(`[data-base-shell-key]`),r=n?this.entries.get(n.dataset.baseShellKey||``):null;if(!r)return;let i=e.target.closest(`.bases-view-tab`);if(i){r.payload.view=i.dataset.baseView||``,r.ui.openPanel=``,this.renderEntry(r);return}let a=e.target.closest(`[data-base-panel]`);if(a){let e=a.dataset.basePanel||``;r.ui.openPanel=r.ui.openPanel===e?``:e,r.ui.rawFilterText=z(D(r.result).filters),$(r,r.result);return}if(e.target.closest(`.bases-export-btn`)){this.exportEntry(r);return}if(e.target.closest(`[data-base-sort-add]`)){this.updateViewConfig(r,e=>{let t=new Set((e.sort??[]).map(e=>e.property)),n=C(r.result).find(e=>!t.has(e.id))?.id??`file.name`;return e.sort=[...e.sort??[],{direction:`asc`,property:n}],e});return}let o=e.target.closest(`[data-base-sort-delete]`);if(o){let e=Number.parseInt(o.dataset.baseSortDelete||``,10);this.updateViewConfig(r,t=>(t.sort=(t.sort??[]).filter((t,n)=>n!==e),t));return}let s=e.target.closest(`[data-base-sort-move]`);if(s){let[e,t]=String(s.dataset.baseSortMove||``).split(`:`),n=Number.parseInt(e,10);this.updateViewConfig(r,e=>{let r=[...e.sort??[]],i=t===`up`?n-1:n+1;return i<0||i>=r.length?e:([r[n],r[i]]=[r[i],r[n]],e.sort=r,e)});return}if(e.target.closest(`[data-base-clear-group-by]`)){this.updateViewConfig(r,e=>(e.groupBy=null,e));return}let c=e.target.closest(`[data-base-filter-mode]`);if(c){r.ui.filterMode=c.dataset.baseFilterMode||`builder`,r.ui.filterMode===`advanced`&&(r.ui.rawFilterText=z(D(r.result).filters),r.ui.builderFilter=null),$(r,r.result);return}if(e.target.closest(`[data-base-filter-save-advanced]`)){this.saveAdvancedFilter(r);return}let l=e.target.closest(`[data-base-filter-add-rule]`);if(l){let e=P(l.dataset.baseFilterAddRule||``);this.updateBuilderFilter(r,t=>H(t,e,{operator:`is`,propertyId:C(r.result)[0]?.id??`file.name`,type:`rule`,value:``}));return}let u=e.target.closest(`[data-base-filter-add-group]`);if(u){let e=P(u.dataset.baseFilterAddGroup||``);this.updateBuilderFilter(r,t=>H(t,e,p(`and`)));return}let d=e.target.closest(`[data-base-filter-remove]`);if(d){let e=P(d.dataset.baseFilterRemove||``);this.updateBuilderFilter(r,t=>de(t,e));return}let f=e.target.closest(`[data-base-filter-suggestion]`);if(f){if(e.preventDefault?.(),e.detail!=null&&e.detail!==0)return;let t=P(f.dataset.baseFilterSuggestion||``),n=f.dataset.baseFilterSuggestionValue||``;this.applyFilterSuggestion(r,t,n)}},this.handleInput=e=>{let t=e.target.closest(`.bases-search-input`);if(t){let e=t.closest(`[data-base-shell-key]`),n=e?this.entries.get(e.dataset.baseShellKey||``):null;if(!n)return;n.search=t.value||``,clearTimeout(this.searchTimers.get(n.key)),this.searchTimers.set(n.key,setTimeout(()=>{n.payload.search=n.search,this.renderEntry(n)},180));return}let n=e.target.closest(`[data-base-properties-search]`);if(n){let e=n.closest(`[data-base-shell-key]`),t=e?this.entries.get(e.dataset.baseShellKey||``):null;if(!t)return;t.ui.propertySearch=n.value||``,$(t,t.result);return}let r=e.target.closest(`[data-base-filter-advanced]`);if(r){let e=r.closest(`[data-base-shell-key]`),t=e?this.entries.get(e.dataset.baseShellKey||``):null;if(!t)return;t.ui.rawFilterText=r.value||``;return}let i=e.target.closest(`[data-base-filter-value]`);if(i){let e=i.closest(`[data-base-shell-key]`),t=e?this.entries.get(e.dataset.baseShellKey||``):null;if(!t)return;let n=P(i.dataset.baseFilterValue||``),r=t.ui.builderFilter??R(D(t.result).filters)??p(`and`);t.ui.builderFilter=V(r,n,e=>({...e,value:i.value||``})),q(t,t.result,n)}},this.handleChange=e=>{let t=e.target.closest(`[data-base-shell-key]`),n=t?this.entries.get(t.dataset.baseShellKey||``):null;if(!n)return;let r=e.target.closest(`[data-base-group-by-property]`);if(r){this.updateViewConfig(n,e=>(e.groupBy=r.value?{direction:e.groupBy?.direction??`asc`,property:r.value}:null,e));return}let i=e.target.closest(`[data-base-group-by-direction]`);if(i){this.updateViewConfig(n,e=>(e.groupBy=e.groupBy?.property?{direction:i.value||`asc`,property:e.groupBy.property}:null,e));return}let a=e.target.closest(`[data-base-sort-property]`);if(a){let e=Number.parseInt(a.dataset.baseSortProperty||``,10);this.updateViewConfig(n,t=>(t.sort=(t.sort??[]).map((t,n)=>n===e?{...t,property:a.value}:t),t));return}let o=e.target.closest(`[data-base-sort-direction]`);if(o){let e=Number.parseInt(o.dataset.baseSortDirection||``,10);this.updateViewConfig(n,t=>(t.sort=(t.sort??[]).map((t,n)=>n===e?{...t,direction:o.value||`asc`}:t),t));return}let s=e.target.closest(`[data-base-property-toggle]`);if(s){let e=s.dataset.basePropertyToggle||``;this.updateViewConfig(n,t=>{let r=t.order?.length>0?[...t.order]:w(n.result),i=r.indexOf(e);return s.checked&&i===-1&&r.push(e),!s.checked&&i>=0&&r.splice(i,1),t.order=r,t});return}let c=e.target.closest(`[data-base-filter-conjunction]`);if(c){let e=P(c.dataset.baseFilterConjunction||``);this.updateBuilderFilter(n,t=>V(t,e,e=>({...e,conjunction:c.value||`and`})));return}let l=e.target.closest(`[data-base-filter-property]`);if(l){let e=P(l.dataset.baseFilterProperty||``);(async()=>{await this.updateBuilderFilter(n,t=>V(t,e,e=>{let t=E(n.result,l.value)[0]??`is`;return{...e,operator:t,propertyId:l.value,value:``}})),await this.ensurePropertyValues(n,l.value)})();return}let u=e.target.closest(`[data-base-filter-operator]`);if(u){let e=P(u.dataset.baseFilterOperator||``);this.updateBuilderFilter(n,t=>V(t,e,e=>({...e,operator:u.value||`is`})));return}e.target.closest(`[data-base-filter-value]`)&&this.persistBuilderFilter(n)},this.handleFocusIn=e=>{let t=e.target.closest(`[data-base-filter-value]`);if(!t)return;let n=t.closest(`[data-base-shell-key]`),r=n?this.entries.get(n.dataset.baseShellKey||``):null;if(!r)return;let i=P(t.dataset.baseFilterValue||``),a=R(D(r.result).filters),o=a?B(a,i):null;o?.propertyId&&this.ensurePropertyValues(r,o.propertyId)},this.previewElement?.addEventListener(`pointerdown`,this.handlePointerDown),this.previewElement?.addEventListener(`click`,this.handleClick),this.previewElement?.addEventListener(`input`,this.handleInput),this.previewElement?.addEventListener(`change`,this.handleChange),this.previewElement?.addEventListener(`focusin`,this.handleFocusIn)}ensureEntryState(e){e.ui||={builderFilter:null,filterMode:`builder`,openPanel:``,propertySearch:``,rawFilterText:``},Object.prototype.hasOwnProperty.call(e.ui,`builderFilter`)||(e.ui.builderFilter=null),e.propertyValueOptions||=new Map}destroy(){this.previewElement?.removeEventListener(`pointerdown`,this.handlePointerDown),this.previewElement?.removeEventListener(`click`,this.handleClick),this.previewElement?.removeEventListener(`input`,this.handleInput),this.previewElement?.removeEventListener(`change`,this.handleChange),this.previewElement?.removeEventListener(`focusin`,this.handleFocusIn),this.searchTimers.forEach(e=>clearTimeout(e)),this.searchTimers.clear(),this.entries.clear()}reconcileEmbeds(e=this.previewElement){e&&Array.from(e.querySelectorAll(`.bases-embed-placeholder[data-base-key]`)).forEach(e=>{let t=e.dataset.baseKey||l(),n=this.entries.get(t),r={path:e.dataset.basePath||``,search:``,source:e.dataset.baseSource||null,sourcePath:e.dataset.baseSourcePath||``,view:e.dataset.baseView||``},i=n??{key:t,payload:r,placeholder:e,propertyValueOptions:new Map,requestVersion:0,result:null,search:``,ui:{builderFilter:null,filterMode:`builder`,openPanel:``,propertySearch:``,rawFilterText:``}};i.payload=r,i.placeholder=e,this.entries.set(t,i),this.renderEntry(i)})}async renderStandalone({filePath:e,renderHost:t,source:n=null}){let r=`standalone:${e}`,i=this.entries.get(r)??{key:r,payload:{path:e,search:``,source:n,sourcePath:e,view:``},placeholder:t,propertyValueOptions:new Map,requestVersion:0,result:null,search:``,ui:{builderFilter:null,filterMode:`builder`,openPanel:``,propertySearch:``,rawFilterText:``}};i.placeholder=t,i.payload.path=e,i.payload.source=typeof n==`string`?n:null,i.payload.sourcePath=e,this.entries.set(r,i),await this.renderEntry(i)}async renderEntry(e){if(this.ensureEntryState(e),!e?.placeholder?.isConnected)return;let n=(e.requestVersion??0)+1;e.requestVersion=n;let r=!!Z(e);r||(e.placeholder.innerHTML=`<div class="preview-shell">Loading base…</div>`);try{let t=await this.vaultApiClient.queryBase({activeFilePath:this.getActiveFilePath?.()??``,...e.payload});if(n!==e.requestVersion||!e?.placeholder?.isConnected)return;e.result=t.result,e.ui.builderFilter=R(D(e.result).filters),e.ui.rawFilterText||(e.ui.rawFilterText=z(D(e.result).filters)),Q(e,e.result)}catch(i){if(n!==e.requestVersion||!e?.placeholder?.isConnected)return;if(r){let n=Z(e)?.querySelector?.(`[data-base-content]`)??null;if(n){n.innerHTML=`<div class="preview-shell">Failed to load base: ${t(i.message||`Unknown error`)}</div>`;return}}e.placeholder.innerHTML=`<div class="preview-shell">Failed to load base: ${t(i.message||`Unknown error`)}</div>`}}async exportEntry(e){this.ensureEntryState(e);try{let t=await this.vaultApiClient.exportBaseCsv({activeFilePath:this.getActiveFilePath?.()??``,...e.payload});i(t.blob,r(t.contentDisposition,`base.csv`),{removeDelayMs:0,revokeDelayMs:0})}catch(e){this.toastController?.show?.(e.message||`Failed to export base CSV`)}}async ensurePropertyValues(e,t=``){if(this.ensureEntryState(e),!t)return;let n=A(e,t);if((e.propertyValueOptions.get(t)??null)?.cacheKey!==n)try{let r=await this.vaultApiClient.queryBasePropertyValues({activeFilePath:this.getActiveFilePath?.()??``,...e.payload,propertyId:t});if(e.propertyValueOptions.set(t,{cacheKey:n,values:r.result?.values??[]}),e.result&&e.ui.openPanel===`filter`){let n=!1;J(W(e,e.result),(r,i)=>{r.propertyId===t&&(n=q(e,e.result,i,{fallbackToFullRender:!1})||n)}),n||$(e,e.result)}}catch{e.propertyValueOptions.set(t,{cacheKey:n,values:[]})}}async applyTransformedSource(e,t){if(this.ensureEntryState(e),ie(e)){e.payload.source=t.source,this.replaceBaseSource?.({path:e.payload.path,source:t.source});return}await this.vaultApiClient.writeFile({content:t.source,path:e.payload.path}),e.payload.source=null}async updateViewConfig(e,t){if(this.ensureEntryState(e),!e?.result||!S(e.result).editable)return;let n=t(D(e.result));try{let t=(await this.vaultApiClient.transformBase({activeFilePath:this.getActiveFilePath?.()??``,mutation:{config:n,type:`set-view-config`,view:e.result.view.id},...e.payload})).result;await this.applyTransformedSource(e,t),e.result=t.result,e.ui.rawFilterText=z(D(e.result).filters),Q(e,e.result)}catch(e){this.toastController?.show?.(e.message||`Failed to update base`)}}async updateBuilderFilter(e,t){this.ensureEntryState(e);let n=t(e.ui.builderFilter??R(D(e.result).filters)??p(`and`));e.ui.builderFilter=n,await this.updateViewConfig(e,t=>(t.filters=I(n,e.result),t))}async saveAdvancedFilter(e){this.ensureEntryState(e);try{let t=ue(e.ui.rawFilterText??``);e.ui.builderFilter=R(t),await this.updateViewConfig(e,e=>(e.filters=t,e))}catch(e){this.toastController?.show?.(e.message||`Invalid advanced filter`)}}};export{xe as BasesPreviewController};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(...e){return e.flat().flatMap(e=>e&&typeof e==`object`?Object.keys(e).filter(t=>e[t]):e||[]).join(` `)}function t(t={}){return e(`ui-input`,t.extra??[])}function n(t={}){let{variant:n=`secondary`,size:r=`md`,toggle:i=!1,toolbar:a=!1,action:o=!1,wide:s=!1,surface:c=!1,pill:l=!1,hidden:u=!1,active:d=!1,extra:f=[]}=t;return e(`ui-button`,n&&`ui-button--${n}`,r!==`md`&&`ui-button--${r}`,{"ui-button--toggle":i,"ui-button--toolbar":a,"ui-button--action":o,"ui-button--wide":s,"ui-button--surface":c,"ui-button--pill":l,active:d,hidden:u},f)}export{e as n,t as r,n as t};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var e={copy:`
|
|
2
|
-
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
3
|
-
<path d="M5.5 5.5h6.8v8h-6.8z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
4
|
-
<path d="M3.7 10.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v.7" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
5
|
-
</svg>
|
|
6
|
-
`,download:`
|
|
7
|
-
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
8
|
-
<path d="M8 2.2v7.2" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
9
|
-
<path d="M5.3 7.2 8 10l2.7-2.8" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
10
|
-
<path d="M3 12.8h10" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
11
|
-
</svg>
|
|
12
|
-
`,edit:`
|
|
13
|
-
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
14
|
-
<path d="M11.8 1.8a1.5 1.5 0 0 1 2.1 2.1l-7.2 7.2-3.2.9.9-3.2z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
15
|
-
<path d="M10.7 2.9l2.4 2.4" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
16
|
-
</svg>
|
|
17
|
-
`,fit:`
|
|
18
|
-
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
19
|
-
<path d="M5.5 6.2V3H2.3M10.5 6.2V3h3.2M10.5 9.8V13h3.2M5.5 9.8V13H2.3" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
20
|
-
<path d="M5.5 6.2h5M5.5 9.8h5" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
21
|
-
</svg>
|
|
22
|
-
`,maximize:`
|
|
23
|
-
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
24
|
-
<path d="M6 2H2v4M10 2h4v4M14 10v4h-4M2 10v4h4" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
25
|
-
</svg>
|
|
26
|
-
`,refresh:`
|
|
27
|
-
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
28
|
-
<path d="M13 4.5V1.8M13 1.8h-2.7M13 11.5v2.7M13 14.2h-2.7" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
29
|
-
<path d="M12.3 4.2A5.3 5.3 0 1 0 13 11.8" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
30
|
-
</svg>
|
|
31
|
-
`,restore:`
|
|
32
|
-
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
33
|
-
<path d="M6 5V2H2M10 5V2h4M10 11v3h4M6 11v3H2" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
34
|
-
<path d="M4.5 4.5h7v7h-7z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.4"/>
|
|
35
|
-
</svg>
|
|
36
|
-
`};function t(t,n){if(!(t instanceof HTMLElement))return;let r=e[n];if(!r){t.classList.remove(`is-icon-only`),t.classList.remove(`ui-preview-action--icon-only`);return}t.classList.add(`is-icon-only`),t.classList.add(`ui-preview-action--icon-only`),t.dataset.icon=n,t.innerHTML=r.trim()}export{t};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* empty css */import{a as e,i as t,t as n}from"./vault-api-client-sLB2bo56.js";import{a as r}from"./runtime-paths-DvpihCEq.js";import{n as i}from"./runtime-config-CDgeuPWN.js";import{n as ee,r as te,t as a}from"./yjs-provider-reset-guard-Cox4nxwu.js";import{n as o,t as ne}from"./drawio-room-yBUzk-vg.js";function s({currentTheme:e=`dark`,currentXml:t=``,isEditor:n=!1,isExportImageMode:r=!1}={}){return{autosave:n&&!r?1:0,dark:+(e===`dark`),modified:`unsavedChanges`,noExitBtn:1,noSaveBtn:r?1:+!n,saveAndExit:0,theme:e===`light`?`simple`:`dark`,xml:String(t||``)}}function c(e={}){return JSON.stringify({autosave:e.autosave??0,dark:e.dark??0,noSaveBtn:e.noSaveBtn??1,theme:e.theme??`dark`,xml:String(e.xml??``)})}var l=4e3;function u(e,t=0){let n=Number(e);return Number.isFinite(n)?n:t}var d=class{constructor({clearIntervalFn:e=e=>window.clearInterval(e),filePath:t=``,heartbeatIntervalMs:n=ne,now:i=()=>Date.now(),onStateChange:a=()=>{},resolveWsBaseUrlFn:s=r,roomName:c=``,setIntervalFn:u=(e,t)=>window.setInterval(e,t),setTimeoutFn:d=(e,t)=>window.setTimeout(e,t),staleLeaseMs:f=o,syncTimeoutMs:p=l,websocketProviderFactory:m=(e,t,n,r)=>new ee(e,t,n,r),ydocFactory:h=()=>new te}){this.clearIntervalFn=e,this.filePath=t,this.heartbeatIntervalMs=n,this.now=i,this.onStateChange=a,this.resolveWsBaseUrlFn=s,this.roomName=c,this.setIntervalFn=u,this.setTimeoutFn=d,this.staleLeaseMs=f,this.syncTimeoutMs=p,this.websocketProviderFactory=m,this.ydocFactory=h,this.ydoc=null,this.provider=null,this.awareness=null,this.leaseMap=null,this.statusMap=null,this.localUser=null,this.localMode=`viewer`,this.heartbeatTimer=null,this.currentState=this.createState(),this.handleLeaseChange=()=>this.emitState(),this.handleStatusChange=()=>this.emitState(),this.handleAwarenessChange=()=>this.emitState()}createState(e={}){return{acquiredAt:0,canClaim:!1,hasHealthyHolder:!1,heartbeatAt:0,holderClientId:``,holderName:``,holderPeerId:``,isEditor:!1,isStale:!0,mode:`viewer`,savedAt:0,savedVersion:0,...e}}async connect({initialUser:e=null,requestedMode:t=`edit`}={}){return this.localUser=e??null,this.localMode=`viewer`,this.roomName?(this.ydoc=this.ydocFactory(),this.provider=this.websocketProviderFactory(this.resolveWsBaseUrlFn(),this.roomName,this.ydoc,{disableBc:!0,maxBackoffTime:5e3}),a(this.provider),this.awareness=this.provider.awareness,this.leaseMap=this.ydoc.getMap(`lease`),this.statusMap=this.ydoc.getMap(`status`),this.setLocalAwareness({mode:`viewer`}),this.leaseMap.observe(this.handleLeaseChange),this.statusMap.observe(this.handleStatusChange),this.awareness.on(`change`,this.handleAwarenessChange),await this.waitForSync(),t===`edit`?this.tryAcquireLease():this.emitState(),this.currentState):(this.currentState=this.createState(),this.onStateChange(this.currentState),this.currentState)}waitForSync(){return this.provider?new Promise(e=>{let t=!1,n=this.setTimeoutFn(()=>{t||(t=!0,this.provider.off?.(`sync`,r),e(!1))},this.syncTimeoutMs),r=i=>{!i||t||(t=!0,clearTimeout(n),this.provider.off?.(`sync`,r),e(!0))};this.provider.on?.(`sync`,r)}):Promise.resolve(!1)}setLocalUser(e=null){return this.localUser=e??null,this.setLocalAwareness({mode:this.currentState.isEditor?`editor`:`viewer`}),this.localUser}setLocalAwareness({mode:e=`viewer`}={}){this.localMode=e,this.awareness&&this.awareness.setLocalStateField(`drawio`,{filePath:this.filePath,mode:e,name:this.localUser?.name||``,peerId:this.localUser?.peerId||``})}getLocalClientId(){return this.ydoc?String(this.ydoc.clientID):``}getLeaseSnapshot(){return{acquiredAt:u(this.leaseMap?.get(`acquiredAt`)),heartbeatAt:u(this.leaseMap?.get(`heartbeatAt`)),holderClientId:String(this.leaseMap?.get(`holderClientId`)||``),holderName:String(this.leaseMap?.get(`holderName`)||``),holderPeerId:String(this.leaseMap?.get(`holderPeerId`)||``)}}findHolderAwarenessState(e){if(!e||!this.awareness)return null;for(let[t,n]of this.awareness.getStates())if(String(t)===String(e)&&n?.drawio?.filePath===this.filePath)return n.drawio;return null}isLeaseStale(e=this.getLeaseSnapshot()){return!e.holderClientId||!this.findHolderAwarenessState(e.holderClientId)||this.now()-e.heartbeatAt>this.staleLeaseMs}isLeaseHeldByLocal(e=this.getLeaseSnapshot()){return!!e.holderClientId&&e.holderClientId===this.getLocalClientId()}tryAcquireLease(){if(!this.leaseMap)return!1;let e=this.getLeaseSnapshot();if(e.holderClientId&&!this.isLeaseStale(e)&&!this.isLeaseHeldByLocal(e))return this.emitState(),!1;let t=this.now();return this.ydoc.transact(()=>{this.leaseMap.set(`holderClientId`,this.getLocalClientId()),this.leaseMap.set(`holderName`,this.localUser?.name||``),this.leaseMap.set(`holderPeerId`,this.localUser?.peerId||``),this.leaseMap.set(`acquiredAt`,t),this.leaseMap.set(`heartbeatAt`,t)},`drawio-lease-acquire`),this.emitState(),this.currentState.isEditor}renewLeaseHeartbeat(){return!this.leaseMap||!this.isLeaseHeldByLocal()?!1:(this.leaseMap.set(`heartbeatAt`,this.now()),!0)}startHeartbeat(){this.heartbeatTimer||=this.setIntervalFn(()=>{this.renewLeaseHeartbeat()},this.heartbeatIntervalMs)}stopHeartbeat(){this.heartbeatTimer&&=(this.clearIntervalFn(this.heartbeatTimer),null)}releaseLease(){return!this.leaseMap||!this.isLeaseHeldByLocal()?!1:(this.stopHeartbeat(),this.ydoc.transact(()=>{this.leaseMap.delete(`holderClientId`),this.leaseMap.delete(`holderName`),this.leaseMap.delete(`holderPeerId`),this.leaseMap.delete(`acquiredAt`),this.leaseMap.delete(`heartbeatAt`)},`drawio-lease-release`),this.setLocalAwareness({mode:`viewer`}),this.emitState(),!0)}publishSave(){if(!this.statusMap)return 0;let e=u(this.statusMap.get(`savedVersion`))+1,t=this.now();return this.ydoc.transact(()=>{this.statusMap.set(`savedVersion`,e),this.statusMap.set(`savedAt`,t)},`drawio-save-status`),this.emitState(),e}emitState(){let e=this.getLeaseSnapshot(),t=this.isLeaseStale(e),n=this.isLeaseHeldByLocal(e),r=this.createState({acquiredAt:e.acquiredAt,canClaim:!n&&t,hasHealthyHolder:!!e.holderClientId&&!t,heartbeatAt:e.heartbeatAt,holderClientId:e.holderClientId,holderName:e.holderName,holderPeerId:e.holderPeerId,isEditor:n,isStale:t,mode:n?`editor`:`viewer`,savedAt:u(this.statusMap?.get(`savedAt`)),savedVersion:u(this.statusMap?.get(`savedVersion`))});return n?(this.startHeartbeat(),this.setLocalAwareness({mode:`editor`})):(this.stopHeartbeat(),this.setLocalAwareness({mode:`viewer`})),this.currentState=r,this.onStateChange(r),r}destroy(){this.releaseLease(),this.stopHeartbeat(),this.leaseMap?.unobserve?.(this.handleLeaseChange),this.statusMap?.unobserve?.(this.handleStatusChange),this.awareness?.off?.(`change`,this.handleAwarenessChange),this.provider?.destroy?.(),this.ydoc?.destroy?.(),this.provider=null,this.ydoc=null,this.awareness=null,this.leaseMap=null,this.statusMap=null}},f=1e3,p=15e3,m=window.location.origin,h=new URLSearchParams(window.location.search),g=h.get(`file`)||``,_=h.get(`leaseRoom`)||``,re=h.get(`mode`)===`view`?`view`:`edit`,v=h.get(`hostMode`)||``,ie=h.get(`instanceId`)||``,ae=h.get(`theme`)===`light`?`light`:`dark`,y=v===`export-image`,b=Number.parseInt(h.get(`previewWidth`)||``,10),x=i(),S=``,C=ae,w=null,T=null,E=!1,D=null,O=null,k=null,A=null,j=``,M=0,N=!1,P=!1,F=document.getElementById(`loadingState`),I=document.getElementById(`root`),L={bannerText:``,canClaim:!1,isEditor:!1},R=document.createElement(`div`);R.className=`drawio-shell`;var z=document.createElement(`div`);z.className=`drawio-banner`,z.innerHTML=`
|
|
2
|
-
<div class="drawio-banner-status">
|
|
3
|
-
<span class="drawio-banner-pill" id="drawioModePill">Loading</span>
|
|
4
|
-
<span class="drawio-banner-copy" id="drawioBannerText">Connecting…</span>
|
|
5
|
-
</div>
|
|
6
|
-
<div class="drawio-banner-actions">
|
|
7
|
-
<button type="button" class="drawio-toolbar-btn" id="claimEditBtn" hidden>Claim edit</button>
|
|
8
|
-
</div>
|
|
9
|
-
`;var B=document.createElement(`div`);B.className=`drawio-frame-shell`;var V=_?new d({filePath:g,onStateChange:e=>fe(e),roomName:_}):null;function H(e,t={}){window.parent!==window&&window.parent.postMessage({source:`drawio-editor`,instanceId:ie,type:e,...t},m)}function oe(e){t(e)&&(e.preventDefault(),e.stopPropagation(),H(`request-toggle-quick-switcher`))}function se(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return null}return e&&typeof e==`object`?e:null}function U(e){document.body.dataset.theme=e===`light`?`light`:`dark`}function W(e,{isError:t=!1}={}){F&&(F.className=t?`drawio-error`:`drawio-loading`,F.textContent=e)}function G(){let e=document.getElementById(`drawioModePill`),t=document.getElementById(`drawioBannerText`),n=document.getElementById(`claimEditBtn`);!e||!t||!n||(e.textContent=L.isEditor?`Editing`:`Read-only`,t.textContent=L.bannerText||(L.isEditor?`Editing`:`Read-only mode`),n.hidden=!L.canClaim,n.disabled=!L.canClaim)}function K(){D&&=(window.clearTimeout(D),null)}function q(){K(),O&&=(window.removeEventListener(`message`,O),null),T?.remove(),T=null,E=!1,j=``,N=!1,P=!1}function ce(){let e=x.drawioBaseUrl||`https://embed.diagrams.net`,t=new URL(e);return t.searchParams.set(`embed`,`1`),t.searchParams.set(`proto`,`json`),t.searchParams.set(`spin`,`1`),t.searchParams.set(`ui`,C===`light`?`simple`:`dark`),t.searchParams.set(`libraries`,`1`),t.toString()}function J(e,t={}){return T?.contentWindow?(T.contentWindow.postMessage(JSON.stringify({action:e,...t}),`*`),!0):!1}function Y(){let e=s({currentTheme:C,currentXml:S,isEditor:L.isEditor,isExportImageMode:y}),t=c(e);if(t===j)return!1;let n=J(`load`,e);return n&&(j=t),n}function le(){T&&(T.classList.toggle(`is-read-only`,!L.isEditor),E&&Y())}function X(e,{fallbackToText:t=!1}={}){console.error(`[drawio] Failed to initialize:`,e),q(),I.replaceChildren(R),B.replaceChildren(),B.appendChild(Object.assign(document.createElement(`div`),{className:`drawio-error`,textContent:e})),L.bannerText=e,L.isEditor=!1,L.canClaim=!1,G(),H(t?`fallback-text`:`error`,{filePath:g,message:e})}function ue(){P||!E||(P=!0,J(`export`,{border:0,currentPage:!0,format:`png`,grid:!1,keepTheme:!0,scale:2,shadow:!1,size:`diagram`,transparent:!1,...Number.isFinite(b)&&b>0?{width:b}:{}}))}async function Z(){if(!A||!g||!L.isEditor)return null;let e=A;return A=null,n.writeFile({content:e,path:g}).then(()=>(S=e,M=V?.publishSave?.()??M,!0)).catch(t=>{throw console.error(`[drawio] Failed to save diagram:`,t),A=e,t})}function Q(e,{immediate:t=!1}={}){if(!(!L.isEditor||!e)){if(A=e,k&&=(window.clearTimeout(k),null),t){Z();return}k=window.setTimeout(()=>{k=null,Z()},f)}}async function de(){if(!g)return;let e=await n.readFile(g),t=String(e?.content??``);t!==S&&(S=t,E&&Y())}function $(){q();let e=document.createElement(`iframe`);e.className=`drawio-frame`,e.title=`draw.io`,e.allow=`clipboard-read; clipboard-write`,e.src=ce(),B.replaceChildren(e),T=e,le(),O=e=>{if(e.source!==T?.contentWindow)return;let t=se(e.data);if(t?.event){if(t.event===`ready`||t.event===`init`){E=!0,K(),Y(),N||(N=!0,H(`ready`,{filePath:g,instanceMode:L.isEditor?`edit`:`view`}));return}if(t.event===`load`){y&&ue();return}if(t.event===`autosave`){Q(String(t.xml||``));return}if(t.event===`save`){Q(String(t.xml||``),{immediate:!0});return}if(t.event===`export`){if(y&&typeof t.data==`string`&&t.data){H(`export-image`,{data:t.data,filePath:g,format:t.format||`svg`});return}y&&X(`Failed to export draw.io preview`);return}t.event===`exit`&&v===`file-preview`&&!L.isEditor&&H(`request-open-file`,{filePath:g})}},window.addEventListener(`message`,O),D=window.setTimeout(()=>{X(`Failed to initialize draw.io editor`,{fallbackToText:v===`file-preview`})},p)}function fe(e){let t=w;w=e,L.isEditor=!!e?.isEditor,L.canClaim=!!e?.canClaim,L.bannerText=L.isEditor?`Editing`:e?.hasHealthyHolder?`${e.holderName||`Another user`} is editing this diagram. Read-only mode. Updates appear after they save.`:e?.isStale?`Editor disconnected. Claim edit to continue editing.`:`Read-only mode. Updates appear after save.`,G();let n=t&&t.isEditor!==e.isEditor;if(!t||n){$();return}let r=e.savedVersion!==M;M=e.savedVersion,!L.isEditor&&r&&de()}function pe(e){let t=e.data;!t||t.source!==`collabmd-host`||t.type===`set-theme`&&(C=t.theme===`light`?`light`:`dark`,U(C),$())}async function me(){V&&V.tryAcquireLease()}window.addEventListener(`keydown`,oe,{capture:!0});async function he(){U(C);try{if(await e(),x=i(),!g)throw Error(`Missing draw.io file path`);let t=await n.readFile(g);if(S=String(t?.content??``),F?.remove(),I.replaceChildren(R),R.replaceChildren(z,B),document.getElementById(`claimEditBtn`)?.addEventListener(`click`,()=>{me()}),window.addEventListener(`message`,pe),window.addEventListener(`beforeunload`,()=>{k&&window.clearTimeout(k),V?.releaseLease?.()}),window.addEventListener(`pagehide`,()=>{k&&window.clearTimeout(k),V?.releaseLease?.()}),re===`view`||!V){L.isEditor=!1,L.canClaim=!1,L.bannerText=y?`Rendering preview…`:`Read-only mode`,y||G(),$();return}await V.connect({initialUser:{name:h.get(`userName`)||localStorage.getItem(`collabmd-user-name`)||``,peerId:h.get(`peerId`)||``},requestedMode:`edit`})}catch(e){let t=e instanceof Error?e.message:String(e);X(t,{fallbackToText:v===`file-preview`}),W(`Failed to load draw.io: ${t}`,{isError:!0})}}he();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./runtime-paths-DvpihCEq.js";import{r as t}from"./drawio-room-yBUzk-vg.js";import{a as n,r,t as i}from"./browser-utils-CKtI_rZl.js";import{t as a}from"./diagram-action-icons-aa_KOv9h.js";var o=360,s=`https://viewer.diagrams.net/js/viewer-static.min.js`,c=null;function l(){return window.GraphViewer?.processElements?Promise.resolve(window.GraphViewer):c||(c=new Promise((e,t)=>{let n=document.querySelector(`script[data-collabmd-drawio-viewer]`),r=n instanceof HTMLScriptElement?n:document.createElement(`script`),i=()=>{r.removeEventListener(`error`,a),r.removeEventListener(`load`,o)},a=()=>{i(),c=null,t(Error(`Failed to load draw.io viewer`))},o=()=>{if(i(),!window.GraphViewer?.processElements){c=null,t(Error(`draw.io viewer did not initialize`));return}e(window.GraphViewer)};r.addEventListener(`error`,a,{once:!0}),r.addEventListener(`load`,o,{once:!0}),n?window.GraphViewer?.processElements&&o():(r.src=s,r.async=!0,r.dataset.collabmdDrawioViewer=`true`,document.head.append(r))}),c)}var u=class{constructor({getLocalUser:e,getTheme:t,onOpenFile:n=null,onOpenTextFile:r=null,onToggleQuickSwitcher:i=null,previewContainer:a,previewElement:o,toastController:s,vaultApiClient:c}){this.getLocalUser=e,this.getTheme=t,this.onOpenFile=n,this.onOpenTextFile=r,this.onToggleQuickSwitcher=i,this.previewContainer=a,this.previewElement=o,this.toastController=s,this.vaultApiClient=c,this.embedEntries=new Map,this.hydrationQueue=[],this.hydrationIdleId=null,this.hydrationPaused=!1,this.instanceCounter=0,this.maximizedEntry=null,this.overlayRoot=null,this._onMessage=this._onMessage.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onPreviewClick=this._onPreviewClick.bind(this),window.addEventListener(`message`,this._onMessage),window.addEventListener(`keydown`,this._onKeyDown),this.previewElement?.addEventListener(`click`,this._onPreviewClick)}destroy(){window.removeEventListener(`message`,this._onMessage),window.removeEventListener(`keydown`,this._onKeyDown),this.previewElement?.removeEventListener(`click`,this._onPreviewClick),i(this.hydrationIdleId),this.hydrationIdleId=null,this.hydrationQueue=[],this._exitMaximizedEntry(),document.body.classList.remove(`drawio-maximized-open`),this.embedEntries.forEach(e=>e.wrapper?.remove()),this.embedEntries.clear(),this.overlayRoot?.remove(),this.overlayRoot=null}detachForCommit(){i(this.hydrationIdleId),this.hydrationIdleId=null,this.hydrationQueue=[],this._exitMaximizedEntry(),this.overlayRoot&&(this.overlayRoot.hidden=!0),this.embedEntries.forEach(e=>{e.queued=!1,e.placeholder=null})}setHydrationPaused(e){this.hydrationPaused=!!e,this.hydrationPaused||this.hydrateVisibleEmbeds()}reconcileEmbeds(e){this._exitMaximizedEntry();let t=Array.from(e.querySelectorAll(`.drawio-embed-placeholder[data-drawio-key]`)).map(e=>({filePath:e.dataset.drawioTarget||``,key:e.dataset.drawioKey||``,label:e.dataset.drawioLabel||e.dataset.drawioTarget||``,mode:e.dataset.drawioMode===`edit`?`edit`:`view`,placeholder:e})),n=new Map;t.forEach(e=>{let t=this.embedEntries.get(e.key)||null,r=t&&this.entryMatchesDescriptor(t,e)?t:this.createEntry(e);t&&t!==r&&this.destroyEntry(t),r.filePath=e.filePath,r.key=e.key,r.label=e.label,r.mode=e.mode,r.placeholder=e.placeholder,n.set(e.key,r)}),this.embedEntries.forEach((e,t)=>{n.has(t)||this.destroyEntry(e)}),this.embedEntries=n,this.embedEntries.forEach(e=>{e.wrapper?this.attachWrapper(e):e.queued=!1}),this.hydrationPaused||this.hydrateVisibleEmbeds(),this.syncLayout()}createEntry(e){return{...e,iframe:null,imageElement:null,inlineHeightPx:null,instanceId:``,queued:!1,viewerElement:null,wrapper:null}}entryMatchesDescriptor(e,t){return!!(e&&e.filePath===t.filePath&&e.mode===t.mode)}hydrateVisibleEmbeds(){this.embedEntries.forEach(e=>{e.wrapper||!e.placeholder?.isConnected||(e.mode===`edit`||r(e.placeholder,this.previewContainer,o))&&this.enqueueHydration(e)})}enqueueHydration(e){e.queued||(e.queued=!0,this.hydrationQueue.push(e),this.hydrationIdleId===null&&(this.hydrationIdleId=n(()=>{this.hydrationIdleId=null,this.hydrationQueue.splice(0).forEach(e=>{e.queued=!1,this.hydrateEntry(e)})},200)))}hydrateEntry(e){if(!(!e.placeholder?.isConnected||e.wrapper)){if(e.mode===`view`){this.hydrateViewerEntry(e);return}this.hydrateIframeEntry(e)}}hydrateIframeEntry(e){if(!e.placeholder?.isConnected||e.wrapper)return;let t=document.createElement(`div`);t.className=`drawio-embed diagram-preview-shell${e.mode===`edit`?` is-direct-file`:``}`,t.dataset.file=e.filePath,t.dataset.drawioKey=e.key;let n=document.createElement(`div`);n.className=`drawio-embed-header diagram-preview-toolbar`;let r=document.createElement(`span`);r.className=`drawio-embed-icon`,r.innerHTML=`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="7" height="6" rx="1"/><rect x="14" y="4" width="7" height="6" rx="1"/><rect x="8.5" y="14" width="7" height="6" rx="1"/><path d="M10 7h4"/><path d="M17.5 10v2.5"/><path d="M6.5 10v2.5"/><path d="M6.5 12.5h11"/></svg>`;let i=document.createElement(`span`);i.className=`drawio-embed-label`,i.textContent=e.label.replace(/\.drawio$/i,``),n.append(r,i),e.mode!==`edit`&&n.appendChild(this.createOpenButton(e)),n.appendChild(this.createMaximizeButton(e,t));let a=document.createElement(`iframe`);a.className=`drawio-embed-iframe`,a.loading=`lazy`,a.referrerPolicy=`strict-origin-when-cross-origin`,e.instanceId=`drawio-${++this.instanceCounter}`,a.dataset.instanceId=e.instanceId,a.src=this.buildIframeUrl(e),t.append(n,a),e.iframe=a,e.wrapper=t,this.attachWrapper(e)}async hydrateViewerEntry(e){if(!e.placeholder?.isConnected||e.wrapper)return;let t=document.createElement(`div`);t.className=`drawio-embed diagram-preview-shell is-static-preview`,t.dataset.file=e.filePath,t.dataset.drawioKey=e.key;let n=document.createElement(`div`);n.className=`drawio-embed-header diagram-preview-toolbar`;let r=document.createElement(`span`);r.className=`drawio-embed-icon`,r.innerHTML=`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="7" height="6" rx="1"/><rect x="14" y="4" width="7" height="6" rx="1"/><rect x="8.5" y="14" width="7" height="6" rx="1"/><path d="M10 7h4"/><path d="M17.5 10v2.5"/><path d="M6.5 10v2.5"/><path d="M6.5 12.5h11"/></svg>`;let i=document.createElement(`span`);i.className=`drawio-embed-label`,i.textContent=e.label.replace(/\.drawio$/i,``),n.append(r,i),n.append(this.createOpenButton(e),this.createMaximizeButton(e,t));let a=document.createElement(`div`);a.className=`drawio-viewer-shell`,a.dataset.filePath=e.filePath;let o=document.createElement(`div`);o.className=`preview-shell`,o.textContent=`Rendering draw.io preview…`,a.appendChild(o),t.append(n,a),e.iframe=null,e.wrapper=t,e.viewerElement=a,this.attachWrapper(e);try{await this.renderViewerEntry(e),this.syncEntryLayout(e)}catch(t){this.renderViewerFallback(e,t instanceof Error?t.message:`Failed to render draw.io preview`),this.syncEntryLayout(e)}}async renderViewerEntry(e){let[{content:t},n]=await Promise.all([this.vaultApiClient.readFile(e.filePath),l()]);if(!e.wrapper?.isConnected||!e.viewerElement?.isConnected)return;let r=this.getTheme?.()===`light`?`light`:`dark`,i=document.createElement(`div`);if(i.className=`mxgraph drawio-viewer-frame`,i.dataset.action=`open-file`,i.dataset.filePath=e.filePath,i.setAttribute(`role`,`button`),i.setAttribute(`tabindex`,`0`),i.setAttribute(`aria-label`,`Open ${e.label.replace(/\.drawio$/i,``)}`),i.addEventListener(`click`,t=>{t.preventDefault(),this.onOpenFile?.(e.filePath)}),i.addEventListener(`keydown`,t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),this.onOpenFile?.(e.filePath))}),i.dataset.mxgraph=JSON.stringify({"check-visible-state":!1,center:!0,border:0,"dark-mode":r,editable:!1,fit:1,lightbox:!1,nav:!1,resize:!1,tooltips:!1,xml:String(t??``)}),(e.wrapper.querySelector(`.drawio-viewer-shell`)??e.viewerElement).replaceChildren(i),e.viewerElement=i,typeof n.createViewerForElement==`function`){n.createViewerForElement(i);return}n.processElements()}buildIframeUrl(n){let r=new URL(e(`/drawio-editor.html`)),i=this.getLocalUser?.()??{};return r.searchParams.set(`file`,n.filePath),r.searchParams.set(`hostMode`,n.mode===`edit`?`file-preview`:`embed`),r.searchParams.set(`instanceId`,n.instanceId),r.searchParams.set(`mode`,n.mode===`edit`?`edit`:`view`),r.searchParams.set(`theme`,this.getTheme?.()===`light`?`light`:`dark`),i.name&&r.searchParams.set(`userName`,i.name),i.peerId&&r.searchParams.set(`peerId`,i.peerId),n.mode===`edit`&&r.searchParams.set(`leaseRoom`,t(n.filePath)),r.toString()}updateTheme(e){this.embedEntries.forEach(t=>{t.iframe?.contentWindow&&t.iframe.contentWindow.postMessage({source:`collabmd-host`,theme:e,type:`set-theme`},window.location.origin),t.mode===`view`&&t.wrapper?.isConnected&&t.viewerElement?.isConnected&&this.renderViewerEntry(t).catch(e=>{this.renderViewerFallback(t,e instanceof Error?e.message:`Failed to render draw.io preview`)})})}updateLocalUser(){}syncLayout(){this.embedEntries.forEach(e=>{e.wrapper&&!this.shouldInlineEntry(e)&&this.syncEntryLayout(e)})}attachWrapper(e){let t=e.placeholder?.isConnected?e.placeholder:this.findPlaceholder(e);if(!t)return;if(e.placeholder=t,this.syncMountedEntryMetadata(e),this.shouldInlineEntry(e)){e.wrapper.style.position=``,e.wrapper.style.top=``,e.wrapper.style.left=``,e.wrapper.style.width=``,e.wrapper.style.margin=``,e.wrapper.style.pointerEvents=`auto`,t.replaceWith(e.wrapper),e.placeholder=null;return}let n=this.ensureOverlayRoot();n.hidden=!1,e.wrapper?.parentElement!==n&&n.appendChild(e.wrapper),this.syncEntryLayout(e)}destroyEntry(e){this.maximizedEntry?.key===e?.key&&this._exitMaximizedEntry(),this.resetPlaceholderLayout(e),e?.wrapper?.remove(),e&&(e.placeholder=null,e.wrapper=null,e.iframe=null,e.viewerElement=null)}findPlaceholder(e){return this.previewElement?.querySelector?.(`.drawio-embed-placeholder[data-drawio-key="${e.key}"]`)??null}ensureOverlayRoot(){if(this.overlayRoot?.isConnected&&this.overlayRoot.parentElement===this.previewElement)return this.overlayRoot;let e=this.previewElement?.querySelector?.(`[data-drawio-overlay-root="true"]`);return e||(e=document.createElement(`div`),e.dataset.drawioOverlayRoot=`true`,e.className=`drawio-embed-overlay-root`,this.previewElement?.appendChild(e)),this.overlayRoot=e,e}shouldInlineEntry(e){return e?.key===`${e?.filePath}#file-preview`}syncMountedEntryMetadata(e){e.wrapper&&(e.wrapper.dataset.drawioKey=e.key,e.wrapper.dataset.file=e.filePath,e.wrapper.classList.toggle(`is-direct-file`,this.shouldInlineEntry(e))),e.iframe&&(e.iframe.title=`draw.io: ${e.filePath}`)}resetPlaceholderLayout(e){!e?.placeholder?.isConnected||this.shouldInlineEntry(e)||(e.placeholder.classList.remove(`is-hydrated`),e.placeholder.removeAttribute(`data-drawio-hydrated`),e.placeholder.style.height=``,e.placeholder.style.pointerEvents=``)}syncEntryLayout(e){if(!e?.wrapper||this.shouldInlineEntry(e))return;let t=e.placeholder?.isConnected?e.placeholder:this.findPlaceholder(e);if(!t)return;e.placeholder=t,t.classList.add(`is-hydrated`),t.dataset.drawioHydrated=`true`,t.style.pointerEvents=`none`;let n=e.wrapper.classList.contains(`is-maximized`),r=e.wrapper.offsetHeight||Math.ceil(e.wrapper.getBoundingClientRect?.().height||0)||e.inlineHeightPx||420;if(n||(e.inlineHeightPx=r),t.style.height=`${Math.ceil(e.inlineHeightPx||r)}px`,e.wrapper.style.pointerEvents=`auto`,n){e.wrapper.style.position=``,e.wrapper.style.top=``,e.wrapper.style.left=``,e.wrapper.style.width=`auto`,e.wrapper.style.height=`auto`,e.wrapper.style.minHeight=`0`,e.wrapper.style.margin=``;return}e.wrapper.style.position=`absolute`,e.wrapper.style.top=`${t.offsetTop}px`,e.wrapper.style.left=`${t.offsetLeft}px`,e.wrapper.style.width=`${t.offsetWidth}px`,e.wrapper.style.margin=`0`}createOpenButton(e){let t=document.createElement(`button`);return t.type=`button`,t.className=`drawio-embed-btn ui-preview-action ui-preview-action--icon-only`,t.dataset.action=`open-file`,t.dataset.filePath=e.filePath,t.title=`Edit in draw.io`,t.setAttribute(`aria-label`,`Edit in draw.io`),a(t,`edit`),t.addEventListener(`click`,t=>{t.preventDefault(),this.onOpenFile?.(e.filePath)}),t}createMaximizeButton(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`drawio-embed-btn ui-preview-action ui-preview-action--icon-only`,n.dataset.action=`toggle-maximize`,n.dataset.filePath=e.filePath,n.dataset.drawioKey=e.key,n.addEventListener(`click`,n=>{n.preventDefault(),this.maximizedEntry?.key===e.key?this._exitMaximizedEntry():this._enterMaximizedEntry(e,t),this._syncMaximizeButtons()}),(()=>{let t=this.maximizedEntry?.key===e.key;a(n,t?`restore`:`maximize`),n.title=t?`Restore diagram size`:`Maximize diagram`,n.setAttribute(`aria-label`,t?`Restore diagram size`:`Maximize diagram`)})(),n}_enterMaximizedEntry(e,t=e?.wrapper){if(!(!e?.wrapper||e.wrapper!==t)&&this.maximizedEntry?.key!==e.key){if(this._exitMaximizedEntry(),e.wrapper.parentElement){let t=document.createElement(`div`);t.className=`drawio-maximize-spacer`,t.style.height=`${Math.ceil(e.wrapper.getBoundingClientRect().height)}px`,e.maximizeSpacer=t,e.wrapper.parentElement.insertBefore(t,e.wrapper)}e.wrapper.classList.add(`is-maximized`),e.wrapper.dataset.drawioMaximized=`true`,e.wrapper.style.width=`auto`,e.wrapper.style.height=`auto`,e.wrapper.style.minHeight=`0`,document.body.classList.add(`drawio-maximized-open`),this.maximizedEntry=e,this.overlayRoot?.classList.add(`has-maximized-entry`),this.syncEntryLayout(e)}}_exitMaximizedEntry(){let e=this.maximizedEntry;if(!e?.wrapper){this.maximizedEntry=null,document.body.classList.remove(`drawio-maximized-open`);return}let{maximizeSpacer:t}=e;e.wrapper.classList.remove(`is-maximized`),delete e.wrapper.dataset.drawioMaximized,e.wrapper.style.width=``,e.wrapper.style.height=``,e.wrapper.style.minHeight=``,t?.parentElement&&t.remove(),e.maximizeSpacer=null,e.restoreParent=null,e.restoreNextSibling=null,this.maximizedEntry=null,document.body.classList.remove(`drawio-maximized-open`),this.overlayRoot?.classList.remove(`has-maximized-entry`),this.syncEntryLayout(e)}_syncMaximizeButtons(){this.embedEntries.forEach(e=>{let t=e.wrapper?.querySelector(`.drawio-embed-btn[data-action="toggle-maximize"]`);if(!(t instanceof HTMLElement))return;let n=this.maximizedEntry?.key===e.key;a(t,n?`restore`:`maximize`),t.title=n?`Restore diagram size`:`Maximize diagram`,t.setAttribute(`aria-label`,n?`Restore diagram size`:`Maximize diagram`)})}_findEntryByInstanceId(e){for(let t of this.embedEntries.values())if(t.instanceId===e)return t;return null}_isMessageFromEntry(e,t){return!!(t?.iframe?.contentWindow&&e.source===t.iframe.contentWindow)}_onMessage(e){if(e.origin!==window.location.origin)return;let t=e.data;if(!t||t.source!==`drawio-editor`)return;let n=this._findEntryByInstanceId(t.instanceId);if(n&&this._isMessageFromEntry(e,n)){if(t.type===`fallback-text`){if(n.mode===`view`){this.renderViewerFallback(n,`Failed to render draw.io preview`);return}this.onOpenTextFile?.(n.filePath);return}if(t.type===`error`){if(n.mode===`view`){this.renderViewerFallback(n,t.message||`Failed to load draw.io preview`);return}this.toastController?.show?.(t.message||`Failed to load draw.io`);return}if(t.type===`request-open-file`){this.onOpenFile?.(n.filePath);return}t.type===`request-toggle-quick-switcher`&&this.onToggleQuickSwitcher?.()}}_onPreviewClick(e){let t=e.target.closest(`.drawio-embed-placeholder-btn`);if(t){let n=t.closest(`.drawio-embed-placeholder`)?.dataset.drawioKey||``,r=this.embedEntries.get(n);r&&(e.preventDefault(),this.hydrateEntry(r));return}}_onKeyDown(e){e.key===`Escape`&&(this._exitMaximizedEntry(),this._syncMaximizeButtons())}renderViewerFallback(e,t){if(!e.wrapper)return;let n=e.wrapper.querySelector(`.drawio-viewer-shell, .drawio-viewer-frame`);if(!n)return;let r=document.createElement(`div`);r.className=`preview-shell`,r.textContent=t,n.replaceChildren(r),e.viewerElement=r}};export{u as DrawioEmbedController};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./drawio-editor-DDvFoarP.js","./vault-api-client-sLB2bo56.js","./runtime-paths-DvpihCEq.js","./runtime-config-CDgeuPWN.js","./vault-paths-CVkuh0j-.js","./file-kind-BKPOIRPE.js","./browser-utils-CKtI_rZl.js","./vault-api-client-C3mlS_4N.css","./yjs-provider-reset-guard-Cox4nxwu.js","./drawio-room-yBUzk-vg.js","./drawio-editor-UQQ8XHou.css","./embedded-editor-base-C9roKYpW.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./runtime-config-loader-BHGniHP5.js";import{t}from"./preload-helper-HclGiUj8.js";await e(),await t(()=>import(`./drawio-editor-DDvFoarP.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]),import.meta.url);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-DhLvC8DS.js","./dist-C11hHqv_.js","./dist-MvcV4190.js","./dist-BqCsFpx4.js","./dist-DK5Gs2wa.js","./dist-D7G-n87v.js","./dist-CnL7Y2sM.js","./dist-BH87JoHx.js","./dist-DRqOrNgN.js","./dist-JYEDRrPT.js","./dist-CYZmbokb.js","./dist-D2AQ-76g.js","./dist-CZjTtmTu.js","./dist-DGb27Dl6.js","./dist-Cig4Ov_X.js","./dist-DetkMS_4.js","./dist-DCzuX1AF.js","./dist-CqQEC8gR.js","./dist-BIkPRZO7.js","./dist-Dp6FVkQ1.js","./dist-D5sn-mwk.js","./dist-RTa81Km7.js","./dist-D4Rzqod1.js","./dist-C2JHCt8U.js","./dist-HmEpWUow.js","./dist-DyrYcvpo2.js","./dist-DtbjNB28.js","./dockerfile-DJkHQgkl.js","./simple-mode-DXiLM1-G.js","./factor-LKH5gN8L.js","./javascript-BWjar7HY.js","./javascript-D-FtdkNC.js","./nsis-CfSuhXs5.js","./pug-Wky5Dnfy.js","./dist-Drp8uu5J.js","./dist-3bgCp7iY.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-HclGiUj8.js";import{$ as t,A as n,B as r,F as i,G as a,H as o,J as s,K as c,L as l,P as u,Q as d,R as f,St as p,Tt as m,V as h,W as g,Z as _,_t as ee,a as v,bt as te,c as ne,ct as y,et as re,f as ie,ft as ae,g as oe,gt as b,l as se,lt as x,mt as ce,nt as S,o as le,ot as C,pt as ue,q as de,rt as fe,st as pe,t as me,ut as w,v as he,w as ge,wt as _e,xt as ve,z as ye}from"./dist-C11hHqv_.js";import{i as be,n as xe,r as Se}from"./dist-BqCsFpx4.js";import{a as Ce,s as we}from"./dist-BIkPRZO7.js";import{t as Te}from"./dist-DtbjNB28.js";import{a as Ee,c as De,i as Oe,n as ke,o as Ae,r as je,s as Me,t as Ne}from"./dist-GrygD2zE.js";import{d as Pe,i as Fe,u as Ie}from"./file-kind-BKPOIRPE.js";import{a as Le}from"./runtime-paths-DvpihCEq.js";import"./runtime-config-CDgeuPWN.js";import{a as Re,c as T,d as E,f as ze,g as Be,h as Ve,i as He,l as D,m as O,n as Ue,o as k,p as A,r as We,s as Ge,t as Ke,u as j}from"./yjs-provider-reset-guard-Cox4nxwu.js";import{r as qe,t as Je}from"./room-CDrmIdDt.js";import{a as Ye,c as Xe,i as Ze,l as Qe,n as $e,o as et,r as tt}from"./comment-threads-D-iKphIp.js";function nt({body:e,user:t}){return{body:e,createdAt:Date.now(),id:$e(`comment`),peerId:t?.peerId??``,reactions:[],userColor:t?.color??``,userName:t?.name??`Anonymous`}}function rt(e,t){return e instanceof k?e.get(t):e?.[t]}function it(e=[]){return Array.isArray(e)?e.map(e=>({emoji:typeof e?.emoji==`string`?e.emoji:``,users:Array.isArray(e?.users)?e.users.map(e=>({reactedAt:Number.isFinite(e?.reactedAt)?e.reactedAt:Date.now(),userColor:typeof e?.userColor==`string`?e.userColor:``,userId:typeof e?.userId==`string`?e.userId:``,userName:typeof e?.userName==`string`&&e.userName?e.userName:`Anonymous`})).filter(e=>e.userId):[]})).filter(e=>e.emoji&&e.users.length>0):[]}function at(e,t){let n=t?.doc;if(!n)return null;let r=e?.anchor??e,i=r?.anchorKind===`text`?`text`:`line`,a=n.lines,o=Math.min(Math.max(Math.round(r?.startLine??1),1),a),s=Math.min(Math.max(Math.round(r?.endLine??o),o),a),c=n.line(o).from,l=n.line(s).to,u=Math.min(Math.max(Math.round(r?.startIndex??c),0),n.length),d=Math.min(Math.max(Math.round(r?.endIndex??l),u),n.length);return{anchorEndLine:s,anchorKind:i,anchorQuote:et(r?.anchorQuote||n.sliceString(u,d)),anchorStartLine:o,endIndex:d,startIndex:u}}var ot=class{constructor({getDoc:e,getEditorState:t,getLocalUser:n,onCommentsChange:r=null}){this.getDoc=e,this.getEditorState=t,this.getLocalUser=n,this.onCommentsChange=r,this.commentThreads=null,this.ydoc=null,this.ytext=null,this.handleCommentThreadsChange=null,this.handleTextChange=null}bind({commentThreads:e,ydoc:t,ytext:n}){this.unbind(),this.commentThreads=e,this.ydoc=t,this.ytext=n,this.handleCommentThreadsChange=()=>{this.emitCommentsChange()},this.handleTextChange=()=>{this.emitCommentsChange()},this.commentThreads.observeDeep(this.handleCommentThreadsChange),this.ytext?.observe?.(this.handleTextChange),this.emitCommentsChange()}unbind(){this.commentThreads&&this.handleCommentThreadsChange&&this.commentThreads.unobserveDeep(this.handleCommentThreadsChange),this.ytext&&this.handleTextChange&&this.ytext.unobserve(this.handleTextChange),this.commentThreads=null,this.ydoc=null,this.ytext=null,this.handleCommentThreadsChange=null,this.handleTextChange=null}emitCommentsChange(){this.onCommentsChange?.(this.getCommentThreads())}refreshComments(){this.emitCommentsChange()}getCommentThreads(){return this.commentThreads?Xe(this.commentThreads).map(e=>this.resolveCommentThread(e)).filter(Boolean):[]}createCommentThread({anchor:e,body:t}){let n=this.getEditorState();if(!n||!this.commentThreads||!this.ytext||!this.ydoc)return null;let r=Ye(t),i=at(e,n);if(!r||!i)return null;let a=tt({anchorEnd:E(j(this.ytext,i.endIndex)),anchorEndLine:i.anchorEndLine,anchorKind:i.anchorKind,anchorQuote:i.anchorQuote,anchorStart:E(j(this.ytext,i.startIndex)),anchorStartLine:i.anchorStartLine,createdAt:Date.now(),createdByColor:this.getLocalUser()?.color??``,createdByName:this.getLocalUser()?.name??`Anonymous`,createdByPeerId:this.getLocalUser()?.peerId??``,id:$e(`thread`),messages:[nt({body:r,user:this.getLocalUser()})]});return a?(this.ydoc.transact(()=>{this.commentThreads.push([a])},`comment-thread-create`),a.get(`id`)):null}replyToCommentThread(e,t){let n=Ye(t);if(!n||!this.ydoc)return null;let r=this.findSharedCommentThread(e)?.get(`messages`);if(!(r instanceof Re))return null;let i=nt({body:n,user:this.getLocalUser()});return this.ydoc.transact(()=>{r.push([i])},`comment-thread-reply`),i.id}toggleCommentReaction(e,t,n){if(!this.ydoc||!e||!t||typeof n!=`string`||!n.trim())return!1;let r=this.getLocalUser?.(),i=typeof r?.userId==`string`?r.userId:``;if(!i)return!1;let a=this.findSharedCommentThread(e)?.get(`messages`);if(!(a instanceof Re))return!1;let o=a.toArray(),s=o.findIndex(e=>rt(e,`id`)===t);if(s<0)return!1;let c=o[s]instanceof k?o[s].toJSON():{...o[s]},l=it(c.reactions),u=l.findIndex(e=>e.emoji===n);if(u>=0){let e=l[u].users.filter(e=>e.userId!==i);e.length===l[u].users.length&&e.push({reactedAt:Date.now(),userColor:r?.color??``,userId:i,userName:r?.name??`Anonymous`}),e.length===0?l.splice(u,1):l[u]={...l[u],users:e}}else l.push({emoji:n,users:[{reactedAt:Date.now(),userColor:r?.color??``,userId:i,userName:r?.name??`Anonymous`}]});let d={...c,reactions:l};return this.ydoc.transact(()=>{a.delete(s,1),a.insert(s,[d])},`comment-reaction-toggle`),!0}deleteCommentThread(e){if(!this.commentThreads||!this.ydoc)return!1;let t=this.findSharedCommentThreadIndex(e);return t<0?!1:(this.ydoc.transact(()=>{this.commentThreads.delete(t,1)},`comment-thread-resolve`),!0)}findSharedCommentThread(e){return this.commentThreads?this.commentThreads.toArray().find(t=>t instanceof k&&t.get(`id`)===e)??null:null}findSharedCommentThreadIndex(e){return this.commentThreads?this.commentThreads.toArray().findIndex(t=>t instanceof k&&t.get(`id`)===e):-1}resolveCommentThread(e){let t=this.getEditorState();if(!e||!t||!this.ydoc)return null;let n=Ze(e);if(!n)return null;let r=this.resolveCommentPosition(n.anchorStart),i=this.resolveCommentPosition(n.anchorEnd),a=r?.index??t.doc.line(n.anchorStartLine).from,o=Math.min(Math.max(n.anchorEndLine??n.anchorStartLine,n.anchorStartLine),t.doc.lines),s=i?.index??t.doc.line(o).to,c=t.doc.lineAt(a).number,l=Math.min(Math.max(s,a),t.doc.length),u=t.doc.lineAt(l).number,d=t.doc.sliceString(a,n.anchorKind===`text`?Math.max(s,a):t.doc.line(u).to),f=Qe(d)||n.anchorQuote;return{...e,anchor:{endIndex:s,endLine:u,excerpt:f,quote:n.anchorQuote,startIndex:a,startLine:c,kind:n.anchorKind},anchorEnd:n.anchorEnd,anchorEndLine:n.anchorEndLine,anchorKind:n.anchorKind,anchorQuote:n.anchorQuote,anchorStart:n.anchorStart,anchorStartLine:n.anchorStartLine}}resolveCommentPosition(e){if(!e||!this.ydoc||!this.ytext)return null;try{let t=D(e),n=T(t,this.ydoc);return!n||n.type!==this.ytext?null:n}catch{return null}}},st=class{constructor({localUser:e=null,onAwarenessChange:t=null,onConnectionChange:n=null,onInitialSync:r=null,preferredUserName:i,resolveAwarenessCursor:a=null}){this.onAwarenessChange=t,this.onConnectionChange=n,this.onInitialSync=r,this.preferredUserName=i,this.providedLocalUser=e,this.resolveAwarenessCursor=a??(()=>null),this.provider=null,this.awareness=null,this.localUser=null,this.ydoc=null,this.ytext=null,this.commentThreads=null,this.wsBaseUrl=``,this.initialSyncComplete=!1,this.initialSyncPromise=Promise.resolve(),this.resolveInitialSync=null}normalizeViewport(e){if(!e||typeof e!=`object`)return null;let t=Number(e.topLine),n=Number(e.viewportRatio);return!Number.isFinite(t)||t<1?null:{topLine:Math.max(1,Math.round(t)),viewportRatio:Number.isFinite(n)?Math.min(Math.max(n,0),1):.35}}async initialize(e){this.wsBaseUrl=Le(),this.ydoc=new We,this.ytext=this.ydoc.getText(`codemirror`),this.commentThreads=this.ydoc.getArray(`comments`);let t=new He(this.ytext),n=new Ue(this.wsBaseUrl,e,this.ydoc,{disableBc:!0,maxBackoffTime:5e3});Ke(n);let r=n.awareness,i=this.providedLocalUser??Je(this.preferredUserName);this.provider=n,this.awareness=r,this.localUser=i,this.initialSyncComplete=!1,this.initialSyncPromise=new Promise(e=>{this.resolveInitialSync=e}),r.setLocalStateField(`user`,i),r.on(`change`,()=>{this.onAwarenessChange?.(this.collectUsers(this.resolveAwarenessCursor))}),this.trackConnectionStatus();let a=!1;return n.on(`sync`,e=>{!e||a||(a=!0,this.initialSyncComplete=!0,this.resolveInitialSync?.(),this.resolveInitialSync=null,this.onInitialSync?.())}),{awareness:r,commentThreads:this.commentThreads,localUser:this.localUser,undoManager:t,ydoc:this.ydoc,ytext:this.ytext}}destroy(){this.resolveInitialSync?.(),this.resolveInitialSync=null,this.initialSyncComplete=!1,this.initialSyncPromise=Promise.resolve(),this.provider?.disconnect(),this.provider?.destroy(),this.provider=null,this.awareness=null,this.localUser=null,this.ydoc?.destroy(),this.ydoc=null,this.ytext=null,this.commentThreads=null}waitForInitialSync(e=1500){return this.initialSyncComplete?Promise.resolve():e==null||e===!1?this.initialSyncPromise:Promise.race([this.initialSyncPromise,new Promise(t=>{window.setTimeout(t,e)})])}getText(){return this.ytext?.toString()??``}getLocalUser(){return this.localUser}setUserName(e){let t=qe(e);return!t||!this.awareness||!this.localUser?null:(this.localUser={...this.localUser,name:t},this.awareness.setLocalStateField(`user`,this.localUser),t)}getUserCursor(e,t){return this.awareness?t(this.awareness.getStates().get(e)?.cursor):null}getUserViewport(e){if(!this.awareness)return null;let t=this.awareness.getStates().get(e);return this.normalizeViewport(t?.viewport)}setLocalViewport(e){if(!this.awareness)return null;let t=this.normalizeViewport(e);return this.awareness.setLocalStateField(`viewport`,t),t}collectUsers(e=()=>null){if(!this.awareness)return[];let t=[];return this.awareness.getStates().forEach((n,r)=>{if(!n.user)return;let i=e(n.cursor);t.push({...i??{},...n.user,clientId:r,hasCursor:!!i,isLocal:r===this.awareness.clientID,viewport:this.normalizeViewport(n.viewport)})}),t}trackConnectionStatus(){if(!this.provider)return;let e=0,t=!1;this.provider.on(`status`,({status:n})=>{n===`connecting`&&(e+=1);let r=n===`connected`&&!t;n===`connected`&&(e=0,t=!0),this.onConnectionChange?.({attempts:e,firstConnection:r,hasEverConnected:t,status:n,unreachable:!t&&e>=3,wsBaseUrl:this.wsBaseUrl})})}};function M(e){return new le(ne.define(e))}function N(t){return e(()=>import(`./dist-DhLvC8DS.js`).then(e=>e.sql({dialect:e[t]})),__vite__mapDeps([0,1,2,3]),import.meta.url)}var ct=[v.of({name:`C`,extensions:[`c`,`h`,`ino`],load(){return e(()=>import(`./dist-DK5Gs2wa.js`).then(e=>e.cpp()),__vite__mapDeps([4,1,2]),import.meta.url)}}),v.of({name:`C++`,alias:[`cpp`],extensions:[`cpp`,`c++`,`cc`,`cxx`,`hpp`,`h++`,`hh`,`hxx`],load(){return e(()=>import(`./dist-DK5Gs2wa.js`).then(e=>e.cpp()),__vite__mapDeps([4,1,2]),import.meta.url)}}),v.of({name:`CQL`,alias:[`cassandra`],extensions:[`cql`],load(){return N(`Cassandra`)}}),v.of({name:`CSS`,extensions:[`css`],load(){return e(()=>import(`./dist-D7G-n87v.js`).then(e=>e.css()),__vite__mapDeps([5,6,1,2]),import.meta.url)}}),v.of({name:`Go`,extensions:[`go`],load(){return e(()=>import(`./dist-BH87JoHx.js`).then(e=>e.go()),__vite__mapDeps([7,1,2,3]),import.meta.url)}}),v.of({name:`HTML`,alias:[`xhtml`],extensions:[`html`,`htm`,`handlebars`,`hbs`],load(){return e(()=>import(`./dist-DRqOrNgN.js`).then(e=>e.html()),__vite__mapDeps([8,9,1,2,6,10,3]),import.meta.url)}}),v.of({name:`Java`,extensions:[`java`],load(){return e(()=>import(`./dist-D2AQ-76g.js`).then(e=>e.java()),__vite__mapDeps([11,1,2]),import.meta.url)}}),v.of({name:`JavaScript`,alias:[`ecmascript`,`js`,`node`],extensions:[`js`,`mjs`,`cjs`],load(){return e(()=>import(`./dist-CZjTtmTu.js`).then(e=>e.javascript()),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`Jinja`,extensions:[`j2`,`jinja`,`jinja2`],load(){return e(()=>import(`./dist-DGb27Dl6.js`).then(e=>e.jinja()),__vite__mapDeps([13,1,2,9,6,10,3]),import.meta.url)}}),v.of({name:`JSON`,alias:[`json5`],extensions:[`json`,`map`],load(){return e(()=>import(`./dist-Cig4Ov_X.js`).then(e=>e.json()),__vite__mapDeps([14,1,2]),import.meta.url)}}),v.of({name:`JSX`,extensions:[`jsx`],load(){return e(()=>import(`./dist-CZjTtmTu.js`).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`LESS`,extensions:[`less`],load(){return e(()=>import(`./dist-DetkMS_4.js`).then(e=>e.less()),__vite__mapDeps([15,1,2,6]),import.meta.url)}}),v.of({name:`Liquid`,extensions:[`liquid`],load(){return e(()=>import(`./dist-DCzuX1AF.js`).then(e=>e.liquid()),__vite__mapDeps([16,1,2,9,6,10,3]),import.meta.url)}}),v.of({name:`MariaDB SQL`,load(){return N(`MariaSQL`)}}),v.of({name:`Markdown`,extensions:[`md`,`markdown`,`mkd`],load(){return e(()=>import(`./dist-CqQEC8gR.js`).then(e=>e.markdown()),__vite__mapDeps([17,18,1,9,2,6,10,3]),import.meta.url)}}),v.of({name:`MS SQL`,load(){return N(`MSSQL`)}}),v.of({name:`MySQL`,load(){return N(`MySQL`)}}),v.of({name:`PHP`,extensions:[`php`,`php3`,`php4`,`php5`,`php7`,`phtml`],load(){return e(()=>import(`./dist-Dp6FVkQ1.js`).then(e=>e.php()),__vite__mapDeps([19,1,2,9,6,10,3]),import.meta.url)}}),v.of({name:`PLSQL`,extensions:[`pls`],load(){return N(`PLSQL`)}}),v.of({name:`PostgreSQL`,load(){return N(`PostgreSQL`)}}),v.of({name:`Python`,extensions:[`BUILD`,`bzl`,`py`,`pyw`],filename:/^(BUCK|BUILD)$/,load(){return e(()=>import(`./dist-D5sn-mwk.js`).then(e=>e.python()),__vite__mapDeps([20,1,2,3]),import.meta.url)}}),v.of({name:`Rust`,extensions:[`rs`],load(){return e(()=>import(`./dist-RTa81Km7.js`).then(e=>e.rust()),__vite__mapDeps([21,1,2]),import.meta.url)}}),v.of({name:`Sass`,extensions:[`sass`],load(){return e(()=>import(`./dist-D4Rzqod1.js`).then(e=>e.sass({indented:!0})),__vite__mapDeps([22,1,2,6]),import.meta.url)}}),v.of({name:`SCSS`,extensions:[`scss`],load(){return e(()=>import(`./dist-D4Rzqod1.js`).then(e=>e.sass()),__vite__mapDeps([22,1,2,6]),import.meta.url)}}),v.of({name:`SQL`,extensions:[`sql`],load(){return N(`StandardSQL`)}}),v.of({name:`SQLite`,load(){return N(`SQLite`)}}),v.of({name:`TSX`,extensions:[`tsx`],load(){return e(()=>import(`./dist-CZjTtmTu.js`).then(e=>e.javascript({jsx:!0,typescript:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`TypeScript`,alias:[`ts`],extensions:[`ts`,`mts`,`cts`],load(){return e(()=>import(`./dist-CZjTtmTu.js`).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([12,10,1,2,3]),import.meta.url)}}),v.of({name:`WebAssembly`,extensions:[`wat`,`wast`],load(){return e(()=>import(`./dist-C2JHCt8U.js`).then(e=>e.wast()),__vite__mapDeps([23,1,2]),import.meta.url)}}),v.of({name:`XML`,alias:[`rss`,`wsdl`,`xsd`],extensions:[`xml`,`xsl`,`xsd`,`svg`],load(){return e(()=>import(`./dist-HmEpWUow.js`).then(e=>e.xml()),__vite__mapDeps([24,1,2]),import.meta.url)}}),v.of({name:`YAML`,alias:[`yml`],extensions:[`yaml`,`yml`],load(){return e(()=>import(`./dist-DyrYcvpo2.js`).then(e=>e.yaml()),__vite__mapDeps([25,26,1,2]),import.meta.url)}}),v.of({name:`APL`,extensions:[`dyalog`,`apl`],load(){return e(()=>import(`./apl-gfMMiTNf.js`).then(e=>M(e.apl)),[],import.meta.url)}}),v.of({name:`PGP`,alias:[`asciiarmor`],extensions:[`asc`,`pgp`,`sig`],load(){return e(()=>import(`./asciiarmor-C_eisQCp.js`).then(e=>M(e.asciiArmor)),[],import.meta.url)}}),v.of({name:`ASN.1`,extensions:[`asn`,`asn1`],load(){return e(()=>import(`./asn1-DCl_8MCW.js`).then(e=>M(e.asn1({}))),[],import.meta.url)}}),v.of({name:`Asterisk`,filename:/^extensions\.conf$/i,load(){return e(()=>import(`./asterisk-BEn0Cwpx.js`).then(e=>M(e.asterisk)),[],import.meta.url)}}),v.of({name:`Brainfuck`,extensions:[`b`,`bf`],load(){return e(()=>import(`./brainfuck-D5EjA2JK.js`).then(e=>M(e.brainfuck)),[],import.meta.url)}}),v.of({name:`Cobol`,extensions:[`cob`,`cpy`],load(){return e(()=>import(`./cobol-DHLQUbN7.js`).then(e=>M(e.cobol)),[],import.meta.url)}}),v.of({name:`C#`,alias:[`csharp`,`cs`],extensions:[`cs`],load(){return e(()=>import(`./clike-D_6L3tnO.js`).then(e=>M(e.csharp)),[],import.meta.url)}}),v.of({name:`Clojure`,extensions:[`clj`,`cljc`,`cljx`],load(){return e(()=>import(`./clojure-BflJGmDX.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`ClojureScript`,extensions:[`cljs`],load(){return e(()=>import(`./clojure-BflJGmDX.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`Closure Stylesheets (GSS)`,extensions:[`gss`],load(){return e(()=>import(`./css-CnaYoQib.js`).then(e=>M(e.gss)),[],import.meta.url)}}),v.of({name:`CMake`,extensions:[`cmake`,`cmake.in`],filename:/^CMakeLists\.txt$/,load(){return e(()=>import(`./cmake-84nbDH0I.js`).then(e=>M(e.cmake)),[],import.meta.url)}}),v.of({name:`CoffeeScript`,alias:[`coffee`,`coffee-script`],extensions:[`coffee`],load(){return e(()=>import(`./coffeescript-De_zI4J0.js`).then(e=>M(e.coffeeScript)),[],import.meta.url)}}),v.of({name:`Common Lisp`,alias:[`lisp`],extensions:[`cl`,`lisp`,`el`],load(){return e(()=>import(`./commonlisp-DgAKBe0r.js`).then(e=>M(e.commonLisp)),[],import.meta.url)}}),v.of({name:`Cypher`,extensions:[`cyp`,`cypher`],load(){return e(()=>import(`./cypher-p9eYesGn.js`).then(e=>M(e.cypher)),[],import.meta.url)}}),v.of({name:`Cython`,extensions:[`pyx`,`pxd`,`pxi`],load(){return e(()=>import(`./python-B_1Jd8HM.js`).then(e=>M(e.cython)),[],import.meta.url)}}),v.of({name:`Crystal`,extensions:[`cr`],load(){return e(()=>import(`./crystal-Bsdphhtm.js`).then(e=>M(e.crystal)),[],import.meta.url)}}),v.of({name:`D`,extensions:[`d`],load(){return e(()=>import(`./d-DWkQyNnU.js`).then(e=>M(e.d)),[],import.meta.url)}}),v.of({name:`Dart`,extensions:[`dart`],load(){return e(()=>import(`./clike-D_6L3tnO.js`).then(e=>M(e.dart)),[],import.meta.url)}}),v.of({name:`diff`,extensions:[`diff`,`patch`],load(){return e(()=>import(`./diff-ChtP43wD.js`).then(e=>M(e.diff)),[],import.meta.url)}}),v.of({name:`Dockerfile`,filename:/^Dockerfile$/,load(){return e(()=>import(`./dockerfile-DJkHQgkl.js`).then(e=>M(e.dockerFile)),__vite__mapDeps([27,28]),import.meta.url)}}),v.of({name:`DTD`,extensions:[`dtd`],load(){return e(()=>import(`./dtd-DTF72YNO.js`).then(e=>M(e.dtd)),[],import.meta.url)}}),v.of({name:`Dylan`,extensions:[`dylan`,`dyl`,`intr`],load(){return e(()=>import(`./dylan-BCDoL_-p.js`).then(e=>M(e.dylan)),[],import.meta.url)}}),v.of({name:`EBNF`,load(){return e(()=>import(`./ebnf-D4c0_ac3.js`).then(e=>M(e.ebnf)),[],import.meta.url)}}),v.of({name:`ECL`,extensions:[`ecl`],load(){return e(()=>import(`./ecl-BVIeWmwY.js`).then(e=>M(e.ecl)),[],import.meta.url)}}),v.of({name:`edn`,extensions:[`edn`],load(){return e(()=>import(`./clojure-BflJGmDX.js`).then(e=>M(e.clojure)),[],import.meta.url)}}),v.of({name:`Eiffel`,extensions:[`e`],load(){return e(()=>import(`./eiffel-BEjRio4Q.js`).then(e=>M(e.eiffel)),[],import.meta.url)}}),v.of({name:`Elm`,extensions:[`elm`],load(){return e(()=>import(`./elm-Cshzl8qu.js`).then(e=>M(e.elm)),[],import.meta.url)}}),v.of({name:`Erlang`,extensions:[`erl`],load(){return e(()=>import(`./erlang-BV0c4Hdn.js`).then(e=>M(e.erlang)),[],import.meta.url)}}),v.of({name:`Esper`,load(){return e(()=>import(`./sql-DuQMFDvy.js`).then(e=>M(e.esper)),[],import.meta.url)}}),v.of({name:`Factor`,extensions:[`factor`],load(){return e(()=>import(`./factor-LKH5gN8L.js`).then(e=>M(e.factor)),__vite__mapDeps([29,28]),import.meta.url)}}),v.of({name:`FCL`,load(){return e(()=>import(`./fcl-ClOhbFR7.js`).then(e=>M(e.fcl)),[],import.meta.url)}}),v.of({name:`Forth`,extensions:[`forth`,`fth`,`4th`],load(){return e(()=>import(`./forth-Cezjo90N.js`).then(e=>M(e.forth)),[],import.meta.url)}}),v.of({name:`Fortran`,extensions:[`f`,`for`,`f77`,`f90`,`f95`],load(){return e(()=>import(`./fortran-Bt6PBEDR.js`).then(e=>M(e.fortran)),[],import.meta.url)}}),v.of({name:`F#`,alias:[`fsharp`],extensions:[`fs`],load(){return e(()=>import(`./mllike-B45xgp2S.js`).then(e=>M(e.fSharp)),[],import.meta.url)}}),v.of({name:`Gas`,extensions:[`s`],load(){return e(()=>import(`./gas-BHEdbvp9.js`).then(e=>M(e.gas)),[],import.meta.url)}}),v.of({name:`Gherkin`,extensions:[`feature`],load(){return e(()=>import(`./gherkin-oBAE_ms0.js`).then(e=>M(e.gherkin)),[],import.meta.url)}}),v.of({name:`Groovy`,extensions:[`groovy`,`gradle`],filename:/^Jenkinsfile$/,load(){return e(()=>import(`./groovy-CUpZ7dEl.js`).then(e=>M(e.groovy)),[],import.meta.url)}}),v.of({name:`Haskell`,extensions:[`hs`],load(){return e(()=>import(`./haskell-BRsoo5mP.js`).then(e=>M(e.haskell)),[],import.meta.url)}}),v.of({name:`Haxe`,extensions:[`hx`],load(){return e(()=>import(`./haxe-DjVOVvNP.js`).then(e=>M(e.haxe)),[],import.meta.url)}}),v.of({name:`HXML`,extensions:[`hxml`],load(){return e(()=>import(`./haxe-DjVOVvNP.js`).then(e=>M(e.hxml)),[],import.meta.url)}}),v.of({name:`HTTP`,load(){return e(()=>import(`./http-CLVgA2GD.js`).then(e=>M(e.http)),[],import.meta.url)}}),v.of({name:`IDL`,extensions:[`pro`],load(){return e(()=>import(`./idl-BUZw3wgd.js`).then(e=>M(e.idl)),[],import.meta.url)}}),v.of({name:`JSON-LD`,alias:[`jsonld`],extensions:[`jsonld`],load(){return e(()=>import(`./javascript-BWjar7HY.js`).then(e=>M(e.jsonld)),__vite__mapDeps([30,31]),import.meta.url)}}),v.of({name:`Julia`,extensions:[`jl`],load(){return e(()=>import(`./julia-CQfgDRfP.js`).then(e=>M(e.julia)),[],import.meta.url)}}),v.of({name:`Kotlin`,extensions:[`kt`,`kts`],load(){return e(()=>import(`./clike-D_6L3tnO.js`).then(e=>M(e.kotlin)),[],import.meta.url)}}),v.of({name:`LiveScript`,alias:[`ls`],extensions:[`ls`],load(){return e(()=>import(`./livescript-BXxG0Yva.js`).then(e=>M(e.liveScript)),[],import.meta.url)}}),v.of({name:`Lua`,extensions:[`lua`],load(){return e(()=>import(`./lua-CL1SqxuB.js`).then(e=>M(e.lua)),[],import.meta.url)}}),v.of({name:`mIRC`,extensions:[`mrc`],load(){return e(()=>import(`./mirc-C9zpzAZU.js`).then(e=>M(e.mirc)),[],import.meta.url)}}),v.of({name:`Mathematica`,extensions:[`m`,`nb`,`wl`,`wls`],load(){return e(()=>import(`./mathematica-u8YMmbU0.js`).then(e=>M(e.mathematica)),[],import.meta.url)}}),v.of({name:`Modelica`,extensions:[`mo`],load(){return e(()=>import(`./modelica-CqHI_q-D.js`).then(e=>M(e.modelica)),[],import.meta.url)}}),v.of({name:`MUMPS`,extensions:[`mps`],load(){return e(()=>import(`./mumps-BSzj6Xyz.js`).then(e=>M(e.mumps)),[],import.meta.url)}}),v.of({name:`Mbox`,extensions:[`mbox`],load(){return e(()=>import(`./mbox-BEMVcqjs.js`).then(e=>M(e.mbox)),[],import.meta.url)}}),v.of({name:`Nginx`,filename:/nginx.*\.conf$/i,load(){return e(()=>import(`./nginx-BMaDbqW3.js`).then(e=>M(e.nginx)),[],import.meta.url)}}),v.of({name:`NSIS`,extensions:[`nsh`,`nsi`],load(){return e(()=>import(`./nsis-CfSuhXs5.js`).then(e=>M(e.nsis)),__vite__mapDeps([32,28]),import.meta.url)}}),v.of({name:`NTriples`,extensions:[`nt`,`nq`],load(){return e(()=>import(`./ntriples-B9h1VB_g.js`).then(e=>M(e.ntriples)),[],import.meta.url)}}),v.of({name:`Objective-C`,alias:[`objective-c`,`objc`],extensions:[`m`],load(){return e(()=>import(`./clike-D_6L3tnO.js`).then(e=>M(e.objectiveC)),[],import.meta.url)}}),v.of({name:`Objective-C++`,alias:[`objective-c++`,`objc++`],extensions:[`mm`],load(){return e(()=>import(`./clike-D_6L3tnO.js`).then(e=>M(e.objectiveCpp)),[],import.meta.url)}}),v.of({name:`OCaml`,extensions:[`ml`,`mli`,`mll`,`mly`],load(){return e(()=>import(`./mllike-B45xgp2S.js`).then(e=>M(e.oCaml)),[],import.meta.url)}}),v.of({name:`Octave`,extensions:[`m`],load(){return e(()=>import(`./octave-D2Q8cUp1.js`).then(e=>M(e.octave)),[],import.meta.url)}}),v.of({name:`Oz`,extensions:[`oz`],load(){return e(()=>import(`./oz-BwTct_5T.js`).then(e=>M(e.oz)),[],import.meta.url)}}),v.of({name:`Pascal`,extensions:[`p`,`pas`],load(){return e(()=>import(`./pascal-Dp_KdFgX.js`).then(e=>M(e.pascal)),[],import.meta.url)}}),v.of({name:`Perl`,extensions:[`pl`,`pm`],load(){return e(()=>import(`./perl-BkSkiI9m.js`).then(e=>M(e.perl)),[],import.meta.url)}}),v.of({name:`Pig`,extensions:[`pig`],load(){return e(()=>import(`./pig-AF4Hwhju.js`).then(e=>M(e.pig)),[],import.meta.url)}}),v.of({name:`PowerShell`,extensions:[`ps1`,`psd1`,`psm1`],load(){return e(()=>import(`./powershell-BcIto6Sf.js`).then(e=>M(e.powerShell)),[],import.meta.url)}}),v.of({name:`Properties files`,alias:[`ini`,`properties`],extensions:[`properties`,`ini`,`in`],load(){return e(()=>import(`./properties-C357ku5U.js`).then(e=>M(e.properties)),[],import.meta.url)}}),v.of({name:`ProtoBuf`,extensions:[`proto`],load(){return e(()=>import(`./protobuf-D1ij_kNL.js`).then(e=>M(e.protobuf)),[],import.meta.url)}}),v.of({name:`Pug`,alias:[`jade`],extensions:[`pug`,`jade`],load(){return e(()=>import(`./pug-Wky5Dnfy.js`).then(e=>M(e.pug)),__vite__mapDeps([33,31]),import.meta.url)}}),v.of({name:`Puppet`,extensions:[`pp`],load(){return e(()=>import(`./puppet-BZyAS7I4.js`).then(e=>M(e.puppet)),[],import.meta.url)}}),v.of({name:`Q`,extensions:[`q`],load(){return e(()=>import(`./q-B9NhS7L_.js`).then(e=>M(e.q)),[],import.meta.url)}}),v.of({name:`R`,alias:[`rscript`],extensions:[`r`,`R`],load(){return e(()=>import(`./r-CxDmU1I4.js`).then(e=>M(e.r)),[],import.meta.url)}}),v.of({name:`RPM Changes`,load(){return e(()=>import(`./rpm-gpDK5sbt.js`).then(e=>M(e.rpmChanges)),[],import.meta.url)}}),v.of({name:`RPM Spec`,extensions:[`spec`],load(){return e(()=>import(`./rpm-gpDK5sbt.js`).then(e=>M(e.rpmSpec)),[],import.meta.url)}}),v.of({name:`Ruby`,alias:[`jruby`,`macruby`,`rake`,`rb`,`rbx`],extensions:[`rb`],filename:/^(Gemfile|Rakefile)$/,load(){return e(()=>import(`./ruby-BjXV7-Qa.js`).then(e=>M(e.ruby)),[],import.meta.url)}}),v.of({name:`SAS`,extensions:[`sas`],load(){return e(()=>import(`./sas-C2OyD2Y6.js`).then(e=>M(e.sas)),[],import.meta.url)}}),v.of({name:`Scala`,extensions:[`scala`],load(){return e(()=>import(`./clike-D_6L3tnO.js`).then(e=>M(e.scala)),[],import.meta.url)}}),v.of({name:`Scheme`,extensions:[`scm`,`ss`],load(){return e(()=>import(`./scheme-D9qYN0V5.js`).then(e=>M(e.scheme)),[],import.meta.url)}}),v.of({name:`Shell`,alias:[`bash`,`sh`,`zsh`],extensions:[`sh`,`ksh`,`bash`],filename:/^PKGBUILD$/,load(){return e(()=>import(`./shell-DwuoZtxw.js`).then(e=>M(e.shell)),[],import.meta.url)}}),v.of({name:`Sieve`,extensions:[`siv`,`sieve`],load(){return e(()=>import(`./sieve-BAxa3IjF.js`).then(e=>M(e.sieve)),[],import.meta.url)}}),v.of({name:`Smalltalk`,extensions:[`st`],load(){return e(()=>import(`./smalltalk-BLp5-jwC.js`).then(e=>M(e.smalltalk)),[],import.meta.url)}}),v.of({name:`Solr`,load(){return e(()=>import(`./solr-BBopId9w.js`).then(e=>M(e.solr)),[],import.meta.url)}}),v.of({name:`SML`,extensions:[`sml`,`sig`,`fun`,`smackspec`],load(){return e(()=>import(`./mllike-B45xgp2S.js`).then(e=>M(e.sml)),[],import.meta.url)}}),v.of({name:`SPARQL`,alias:[`sparul`],extensions:[`rq`,`sparql`],load(){return e(()=>import(`./sparql-Dz-mlCAC.js`).then(e=>M(e.sparql)),[],import.meta.url)}}),v.of({name:`Spreadsheet`,alias:[`excel`,`formula`],load(){return e(()=>import(`./spreadsheet-CTIncYxj.js`).then(e=>M(e.spreadsheet)),[],import.meta.url)}}),v.of({name:`Squirrel`,extensions:[`nut`],load(){return e(()=>import(`./clike-D_6L3tnO.js`).then(e=>M(e.squirrel)),[],import.meta.url)}}),v.of({name:`Stylus`,extensions:[`styl`],load(){return e(()=>import(`./stylus-BOVgKnng.js`).then(e=>M(e.stylus)),[],import.meta.url)}}),v.of({name:`Swift`,extensions:[`swift`],load(){return e(()=>import(`./swift-DKB6_1j6.js`).then(e=>M(e.swift)),[],import.meta.url)}}),v.of({name:`sTeX`,load(){return e(()=>import(`./stex-DNzd62Q_.js`).then(e=>M(e.stex)),[],import.meta.url)}}),v.of({name:`LaTeX`,alias:[`tex`],extensions:[`text`,`ltx`,`tex`],load(){return e(()=>import(`./stex-DNzd62Q_.js`).then(e=>M(e.stex)),[],import.meta.url)}}),v.of({name:`SystemVerilog`,extensions:[`v`,`sv`,`svh`],load(){return e(()=>import(`./verilog-7LoJAqYT.js`).then(e=>M(e.verilog)),[],import.meta.url)}}),v.of({name:`Tcl`,extensions:[`tcl`],load(){return e(()=>import(`./tcl-BGfruO1u.js`).then(e=>M(e.tcl)),[],import.meta.url)}}),v.of({name:`Textile`,extensions:[`textile`],load(){return e(()=>import(`./textile-C4jVoHG1.js`).then(e=>M(e.textile)),[],import.meta.url)}}),v.of({name:`TiddlyWiki`,load(){return e(()=>import(`./tiddlywiki-VlUiK86J.js`).then(e=>M(e.tiddlyWiki)),[],import.meta.url)}}),v.of({name:`Tiki wiki`,load(){return e(()=>import(`./tiki-AK6FwT8q.js`).then(e=>M(e.tiki)),[],import.meta.url)}}),v.of({name:`TOML`,extensions:[`toml`],load(){return e(()=>import(`./toml-BPTmHmyx.js`).then(e=>M(e.toml)),[],import.meta.url)}}),v.of({name:`Troff`,extensions:[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],load(){return e(()=>import(`./troff-C2dAgh7P.js`).then(e=>M(e.troff)),[],import.meta.url)}}),v.of({name:`TTCN`,extensions:[`ttcn`,`ttcn3`,`ttcnpp`],load(){return e(()=>import(`./ttcn-PPSTk1ow.js`).then(e=>M(e.ttcn)),[],import.meta.url)}}),v.of({name:`TTCN_CFG`,extensions:[`cfg`],load(){return e(()=>import(`./ttcn-cfg-2b4Gb5sE.js`).then(e=>M(e.ttcnCfg)),[],import.meta.url)}}),v.of({name:`Turtle`,extensions:[`ttl`],load(){return e(()=>import(`./turtle-Cx3rYX2g.js`).then(e=>M(e.turtle)),[],import.meta.url)}}),v.of({name:`Web IDL`,extensions:[`webidl`],load(){return e(()=>import(`./webidl-D5jiJvOU.js`).then(e=>M(e.webIDL)),[],import.meta.url)}}),v.of({name:`VB.NET`,extensions:[`vb`],load(){return e(()=>import(`./vb-BthdM_4N.js`).then(e=>M(e.vb)),[],import.meta.url)}}),v.of({name:`VBScript`,extensions:[`vbs`],load(){return e(()=>import(`./vbscript-D9f6rSsU.js`).then(e=>M(e.vbScript)),[],import.meta.url)}}),v.of({name:`Velocity`,extensions:[`vtl`],load(){return e(()=>import(`./velocity-CqftRsjg.js`).then(e=>M(e.velocity)),[],import.meta.url)}}),v.of({name:`Verilog`,extensions:[`v`],load(){return e(()=>import(`./verilog-7LoJAqYT.js`).then(e=>M(e.verilog)),[],import.meta.url)}}),v.of({name:`VHDL`,extensions:[`vhd`,`vhdl`],load(){return e(()=>import(`./vhdl-kS471soi.js`).then(e=>M(e.vhdl)),[],import.meta.url)}}),v.of({name:`XQuery`,extensions:[`xy`,`xquery`,`xq`,`xqm`,`xqy`],load(){return e(()=>import(`./xquery-BKJx4mf9.js`).then(e=>M(e.xQuery)),[],import.meta.url)}}),v.of({name:`Yacas`,extensions:[`ys`],load(){return e(()=>import(`./yacas-CXXgtw0p.js`).then(e=>M(e.yacas)),[],import.meta.url)}}),v.of({name:`Z80`,extensions:[`z80`],load(){return e(()=>import(`./z80-Co3PbHdE.js`).then(e=>M(e.z80)),[],import.meta.url)}}),v.of({name:`MscGen`,extensions:[`mscgen`,`mscin`,`msc`],load(){return e(()=>import(`./mscgen-qgSLujhx.js`).then(e=>M(e.mscgen)),[],import.meta.url)}}),v.of({name:`Xù`,extensions:[`xu`],load(){return e(()=>import(`./mscgen-qgSLujhx.js`).then(e=>M(e.xu)),[],import.meta.url)}}),v.of({name:`MsGenny`,extensions:[`msgenny`],load(){return e(()=>import(`./mscgen-qgSLujhx.js`).then(e=>M(e.msgenny)),[],import.meta.url)}}),v.of({name:`Vue`,extensions:[`vue`],load(){return e(()=>import(`./dist-Drp8uu5J.js`).then(e=>e.vue()),__vite__mapDeps([34,1,2,9,6,10,3]),import.meta.url)}}),v.of({name:`Angular Template`,load(){return e(()=>import(`./dist-3bgCp7iY.js`).then(e=>e.angular()),__vite__mapDeps([35,1,2,9,6,10,3]),import.meta.url)}})],lt=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,P=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(lt(e)):lt,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return te(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=m(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=ve(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(P.prototype[Symbol.iterator]=function(){return this});var ut={from:-1,to:-1,match:/.*/.exec(``),precise:!0},dt=`gm`+(/x/.unicode==null?``:`u`),ft=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=ut,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new ht(e,t,n,r,i);this.re=new RegExp(t,dt+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=F(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=F(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},pt=new WeakMap,mt=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=pt.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return pt.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),pt.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},ht=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=ut,this.matchPos=F(e,r),this.re=new RegExp(t,dt+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=mt.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=F(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=mt.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(ft.prototype[Symbol.iterator]=ht.prototype[Symbol.iterator]=function(){return this});function gt(e){try{return new RegExp(e,dt),!0}catch{return!1}}function F(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var _t=e=>{let{state:n}=e,r=String(n.doc.lineAt(e.state.selection.main.head).number),{close:i,result:a}=t(e,{label:n.phrase(`Go to line`),input:{type:`text`,name:`line`,value:r},focus:!0,submitLabel:n.phrase(`go`)});return a.then(t=>{let r=t&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.elements.line.value);if(!r){e.dispatch({effects:i});return}let a=n.doc.lineAt(n.selection.main.head),[,o,s,c,u]=r,d=c?+c.slice(1):0,f=s?+s:a.number;if(s&&u){let e=f/100;o&&(e=e*(o==`-`?-1:1)+a.number/n.doc.lines),f=Math.round(n.doc.lines*e)}else s&&o&&(f=f*(o==`-`?-1:1)+a.number);let p=n.doc.line(Math.max(1,Math.min(n.doc.lines,f))),m=y.cursor(p.from+Math.max(0,Math.min(d,p.length)));e.dispatch({effects:[i,l.scrollIntoView(m.from,{y:`center`})],selection:m})}),!0},vt={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},yt=w.define({combine(e){return p(e,vt,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function bt(e){let t=[Et,Tt];return e&&t.push(yt.of(e)),t}var xt=i.mark({class:`cm-selectionMatch`}),St=i.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function Ct(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=C.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=C.Word)}function wt(e,t,n,r){return e(t.sliceDoc(n,n+1))==C.Word&&e(t.sliceDoc(r-1,r))==C.Word}var Tt=f.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(yt),{state:n}=e,r=n.selection;if(r.ranges.length>1)return i.none;let a=r.main,o,s=null;if(a.empty){if(!t.highlightWordAroundCursor)return i.none;let e=n.wordAt(a.head);if(!e)return i.none;s=n.charCategorizer(a.head),o=n.sliceDoc(e.from,e.to)}else{let e=a.to-a.from;if(e<t.minSelectionLength||e>200)return i.none;if(t.wholeWords){if(o=n.sliceDoc(a.from,a.to),s=n.charCategorizer(a.head),!(Ct(s,n,a.from,a.to)&&wt(s,n,a.from,a.to)))return i.none}else if(o=n.sliceDoc(a.from,a.to),!o)return i.none}let c=[];for(let r of e.visibleRanges){let e=new P(n.doc,o,r.from,r.to);for(;!e.next().done;){let{from:r,to:o}=e.value;if((!s||Ct(s,n,r,o))&&(a.empty&&r<=a.from&&o>=a.to?c.push(St.range(r,o)):(r>=a.to||o<=a.from)&&c.push(xt.range(r,o)),c.length>t.maxMatches))return i.none}}return i.set(c)}},{decorations:e=>e.decorations}),Et=l.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),Dt=({state:e,dispatch:t})=>{let{selection:n}=e,r=y.create(n.ranges.map(t=>e.wordAt(t.head)||y.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function Ot(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new P(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new P(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var kt=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return Dt({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=Ot(e,r);return i?(t(e.update({selection:e.selection.addRange(y.range(i.from,i.to),!1),effects:l.scrollIntoView(i.to)})),!0):!1},I=w.define({combine(e){return p(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new tn(e),scrollToMatch:e=>l.scrollIntoView(e)})}}),At=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||gt(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
3
|
-
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Lt(this):new Pt(this)}getCursor(e,t=0,n){let r=e.doc?e:x.create({doc:e});return n??=r.doc.length,this.regexp?R(this,r,t,n):L(this,r,t,n)}},jt=class{constructor(e){this.spec=e}};function Mt(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function L(e,t,n,r){let i;return e.wholeWord&&(i=Nt(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=Mt(e.test,t,i)),new P(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function Nt(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(z(i,n-a))!=C.Word||t(B(i,n-a))!=C.Word)&&(t(B(i,r-a))!=C.Word||t(z(i,r-a))!=C.Word))}var Pt=class extends jt{constructor(e){super(e)}nextMatch(e,t,n){let r=L(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=L(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=L(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=L(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=L(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function Ft(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function R(e,t,n,r){let i;return e.wholeWord&&(i=It(t.charCategorizer(t.selection.main.head))),e.test&&(i=Ft(e.test,t,i)),new ft(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function z(e,t){return e.slice(_e(e,t,!1),t)}function B(e,t){return e.slice(t,_e(e,t))}function It(e){return(t,n,r)=>!r[0].length||(e(z(r.input,r.index))!=C.Word||e(B(r.input,r.index))!=C.Word)&&(e(B(r.input,r.index+r[0].length))!=C.Word||e(z(r.input,r.index+r[0].length))!=C.Word)}var Lt=class extends jt{nextMatch(e,t,n){let r=R(this.spec,e,n,e.doc.length).next();return r.done&&(r=R(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=R(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=R(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=R(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},V=b.define(),Rt=b.define(),H=ee.define({create(e){return new zt(Yt(e).create(),null)},update(e,t){for(let n of t.effects)n.is(V)?e=new zt(n.value.create(),e.panel):n.is(Rt)&&(e=new zt(e.query,n.value?Jt:null));return e},provide:e=>re.from(e,e=>e.panel)}),zt=class{constructor(e,t){this.query=e,this.panel=t}},Bt=i.mark({class:`cm-searchMatch`}),Vt=i.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Ht=f.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(H))}update(e){let t=e.state.field(H);(t!=e.startState.field(H)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return i.none;let{view:n}=this,r=new ce;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Vt:Bt)})}return r.finish()}},{decorations:e=>e.decorations});function U(e){return t=>{let n=t.state.field(H,!1);return n&&n.query.spec.valid?e(t,n):Qt(t)}}var W=U((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=y.single(r.from,r.to),a=e.state.facet(I);return e.dispatch({selection:i,effects:[nn(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Zt(e),!0}),Ut=U((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=y.single(i.from,i.to),o=e.state.facet(I);return e.dispatch({selection:a,effects:[nn(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Zt(e),!0}),Wt=U((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:y.create(n.map(e=>y.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Gt=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new P(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(y.range(t.value.from,t.value.to))}return t(e.update({selection:y.create(a,o),userEvent:`select.search.matches`})),!0},Kt=U((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,u,d=[];o.precise?o.from==r&&o.to==i&&(u=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:u}),o=t.nextMatch(n,o.from,o.to),d.push(l.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let f=e.state.changes(s);return o&&(c=y.single(o.from,o.to).map(f),d.push(nn(e,o)),d.push(n.facet(I).scrollToMatch(c.main,e))),e.dispatch({changes:f,selection:c,effects:d,userEvent:`input.replace`}),!0}),qt=U((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:l.announce.of(r),userEvent:`input.replace.all`}),!0});function Jt(e){return e.state.facet(I).createPanel(e)}function Yt(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(I);return new At({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Xt(e){let t=o(e,Jt);return t&&t.dom.querySelector(`[main-field]`)}function Zt(e){let t=Xt(e);t&&t==e.root.activeElement&&t.select()}var Qt=e=>{let t=e.state.field(H,!1);if(t&&t.panel){let n=Xt(e);if(n&&n!=e.root.activeElement){let r=Yt(e.state,t.query.spec);r.valid&&e.dispatch({effects:V.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Rt.of(!0),t?V.of(Yt(e.state,t.query.spec)):b.appendConfig.of(an)]});return!0},$t=e=>{let t=e.state.field(H,!1);if(!t||!t.panel)return!1;let n=o(e,Jt);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Rt.of(!1)}),!0},en=[{key:`Mod-f`,run:Qt,scope:`editor search-panel`},{key:`F3`,run:W,shift:Ut,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:W,shift:Ut,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:$t,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Gt},{key:`Mod-Alt-g`,run:_t},{key:`Mod-d`,run:kt,preventDefault:!0}],tn=class{constructor(e){this.view=e;let t=this.query=e.state.field(H).query.spec;this.commit=this.commit.bind(this),this.searchField=S(`input`,{value:t.search,placeholder:G(e,`Find`),"aria-label":G(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=S(`input`,{value:t.replace,placeholder:G(e,`Replace`),"aria-label":G(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=S(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=S(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=S(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return S(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=S(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>W(e),[G(e,`next`)]),n(`prev`,()=>Ut(e),[G(e,`previous`)]),n(`select`,()=>Wt(e),[G(e,`all`)]),S(`label`,null,[this.caseField,G(e,`match case`)]),S(`label`,null,[this.reField,G(e,`regexp`)]),S(`label`,null,[this.wordField,G(e,`by word`)]),...e.state.readOnly?[]:[S(`br`),this.replaceField,n(`replace`,()=>Kt(e),[G(e,`replace`)]),n(`replaceAll`,()=>qt(e),[G(e,`replace all`)])],S(`button`,{name:`close`,onclick:()=>$t(e),"aria-label":G(e,`close`),type:`button`},[`×`])])}commit(){let e=new At({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:V.of(e)}))}keydown(e){d(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ut:W)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Kt(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(V)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(I).top}};function G(e,t){return e.state.phrase(t)}var K=30,q=/[\s\.,:;?!]/;function nn(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-K),o=Math.min(i,n+K),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<K;e++)if(!q.test(s[e+1])&&q.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-K;e--)if(!q.test(s[e-1])&&q.test(s[e])){s=s.slice(0,e);break}}return l.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var rn=l.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),an=[H,ae.low(Ht),rn],on=`#e5c07b`,sn=`#e06c75`,cn=`#56b6c2`,ln=`#ffffff`,J=`#abb2bf`,un=`#7d8799`,dn=`#61afef`,fn=`#98c379`,pn=`#d19a66`,mn=`#c678dd`,hn=`#21252b`,gn=`#2c313a`,_n=`#282c34`,vn=`#353a42`,yn=`#3E4451`,bn=`#528bff`,xn=l.theme({"&":{color:J,backgroundColor:_n},".cm-content":{caretColor:bn},".cm-cursor, .cm-dropCursor":{borderLeftColor:bn},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:yn},".cm-panels":{backgroundColor:hn,color:J},".cm-panels.cm-panels-top":{borderBottom:`2px solid black`},".cm-panels.cm-panels-bottom":{borderTop:`2px solid black`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid #457dff`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#6199ff2f`},".cm-activeLine":{backgroundColor:`#6699ff0b`},".cm-selectionMatch":{backgroundColor:`#aafe661a`},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bad0f847`},".cm-gutters":{backgroundColor:_n,color:un,border:`none`},".cm-activeLineGutter":{backgroundColor:gn},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:`#ddd`},".cm-tooltip":{border:`none`,backgroundColor:vn},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:vn,borderBottomColor:vn},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:gn,color:J}}},{dark:!0}),Sn=me.define([{tag:u.keyword,color:mn},{tag:[u.name,u.deleted,u.character,u.propertyName,u.macroName],color:sn},{tag:[u.function(u.variableName),u.labelName],color:dn},{tag:[u.color,u.constant(u.name),u.standard(u.name)],color:pn},{tag:[u.definition(u.name),u.separator],color:J},{tag:[u.typeName,u.className,u.number,u.changed,u.annotation,u.modifier,u.self,u.namespace],color:on},{tag:[u.operator,u.operatorKeyword,u.url,u.escape,u.regexp,u.link,u.special(u.string)],color:cn},{tag:[u.meta,u.comment],color:un},{tag:u.strong,fontWeight:`bold`},{tag:u.emphasis,fontStyle:`italic`},{tag:u.strikethrough,textDecoration:`line-through`},{tag:u.link,color:un,textDecoration:`underline`},{tag:u.heading,fontWeight:`bold`,color:sn},{tag:[u.atom,u.bool,u.special(u.variableName)],color:pn},{tag:[u.processingInstruction,u.string,u.inserted],color:fn},{tag:u.invalid,color:ln}]),Cn=[xn,n(Sn)],wn=class e{constructor(e,t){this.yanchor=e,this.yhead=t}toJSON(){return{yanchor:E(this.yanchor),yhead:E(this.yhead)}}static fromJSON(t){return new e(D(t.yanchor),D(t.yhead))}},Tn=class{constructor(e,t){this.ytext=e,this.awareness=t,this.undoManager=new He(e)}toYPos(e,t=0){return j(this.ytext,e,t)}fromYPos(e){let t=T(D(e),this.ytext.doc);if(t==null||t.type!==this.ytext)throw Error(`[y-codemirror] The position you want to retrieve was created by a different document`);return{pos:t.index,assoc:t.assoc}}toYRange(e){let t=e.assoc;return new wn(this.toYPos(e.anchor,t),this.toYPos(e.head,t))}fromYRange(e){let t=this.fromYPos(e.yanchor),n=this.fromYPos(e.yhead);return t.pos===n.pos?y.cursor(n.pos,n.assoc):y.range(t.pos,n.pos)}},Y=w.define({combine(e){return e[e.length-1]}}),En=fe.define(),Dn=class{constructor(e){this.view=e,this.conf=e.state.facet(Y),this._observer=(t,n)=>{if(n.origin!==this.conf){let n=t.delta,r=[],i=0;for(let e=0;e<n.length;e++){let t=n[e];t.insert==null?t.delete==null?i+=t.retain:(r.push({from:i,to:i+t.delete,insert:``}),i+=t.delete):r.push({from:i,to:i,insert:t.insert})}e.dispatch({changes:r,annotations:[En.of(this.conf)]})}},this._ytext=this.conf.ytext,this._ytext.observe(this._observer)}update(e){if(!e.docChanged||e.transactions.length>0&&e.transactions[0].annotation(En)===this.conf)return;let t=this.conf.ytext;t.doc.transact(()=>{let n=0;e.changes.iterChanges((e,r,i,a,o)=>{let s=o.sliceString(0,o.length,`
|
|
4
|
-
`);e!==r&&t.delete(e+n,r-e),s.length>0&&t.insert(e+n,s),n+=s.length-(r-e)})},this.conf)}destroy(){this._ytext.unobserve(this._observer)}},On=f.fromClass(Dn),kn=l.baseTheme({".cm-ySelection":{},".cm-yLineSelection":{padding:0,margin:`0px 2px 0px 4px`},".cm-ySelectionCaret":{position:`relative`,borderLeft:`1px solid black`,borderRight:`1px solid black`,marginLeft:`-1px`,marginRight:`-1px`,boxSizing:`border-box`,display:`inline`},".cm-ySelectionCaretDot":{borderRadius:`50%`,position:`absolute`,width:`.4em`,height:`.4em`,top:`-.2em`,left:`-.2em`,backgroundColor:`inherit`,transition:`transform .3s ease-in-out`,boxSizing:`border-box`},".cm-ySelectionCaret:hover > .cm-ySelectionCaretDot":{transformOrigin:`bottom center`,transform:`scale(0)`},".cm-ySelectionInfo":{position:`absolute`,top:`-1.05em`,left:`-1px`,fontSize:`.75em`,fontFamily:`serif`,fontStyle:`normal`,fontWeight:`normal`,lineHeight:`normal`,userSelect:`none`,color:`white`,paddingLeft:`2px`,paddingRight:`2px`,zIndex:101,transition:`opacity .3s ease-in-out`,backgroundColor:`inherit`,opacity:0,transitionDelay:`0s`,whiteSpace:`nowrap`},".cm-ySelectionCaret:hover > .cm-ySelectionInfo":{opacity:1,transitionDelay:`0s`}}),An=fe.define(),jn=class extends ye{constructor(e,t){super(),this.color=e,this.name=t}toDOM(){return ze(`span`,[O(`class`,`cm-ySelectionCaret`),O(`style`,`background-color: ${this.color}; border-color: ${this.color}`)],[A(``),ze(`div`,[O(`class`,`cm-ySelectionCaretDot`)]),A(``),ze(`div`,[O(`class`,`cm-ySelectionInfo`)],[A(this.name)]),A(``)])}eq(e){return e.color===this.color}compare(e){return e.color===this.color}updateDOM(){return!1}get estimatedHeight(){return-1}ignoreEvent(){return!0}},Mn=class{constructor(e){this.conf=e.state.facet(Y),this._listener=({added:t,updated:n,removed:r},i,a)=>{t.concat(n).concat(r).findIndex(e=>e!==this.conf.awareness.doc.clientID)>=0&&e.dispatch({annotations:[An.of([])]})},this._awareness=this.conf.awareness,this._awareness.on(`change`,this._listener),this.decorations=ue.of([])}destroy(){this._awareness.off(`change`,this._listener)}update(e){let t=this.conf.ytext,n=t.doc,r=this.conf.awareness,a=[],o=this.conf.awareness.getLocalState();if(o!=null){let n=e.view.hasFocus&&e.view.dom.ownerDocument.hasFocus(),i=n?e.state.selection.main:null,a=o.cursor==null?null:D(o.cursor.anchor),s=o.cursor==null?null:D(o.cursor.head);if(i!=null){let e=j(t,i.anchor),n=j(t,i.head);(o.cursor==null||!Ge(a,e)||!Ge(s,n))&&r.setLocalStateField(`cursor`,{anchor:e,head:n})}else o.cursor!=null&&n&&r.setLocalStateField(`cursor`,null)}r.getStates().forEach((o,s)=>{if(s===r.doc.clientID)return;let c=o.cursor;if(c==null||c.anchor==null||c.head==null)return;let l=T(c.anchor,n),u=T(c.head,n);if(l==null||u==null||l.type!==t||u.type!==t)return;let{color:d=`#30bced`,name:f=`Anonymous`}=o.user||{},p=o.user&&o.user.colorLight||d+`33`,m=Be(l.index,u.index),h=Ve(l.index,u.index),g=e.view.state.doc.lineAt(m),_=e.view.state.doc.lineAt(h);if(g.number===_.number)a.push({from:m,to:h,value:i.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})});else{a.push({from:m,to:g.from+g.length,value:i.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})}),a.push({from:_.from,to:h,value:i.mark({attributes:{style:`background-color: ${p}`},class:`cm-ySelection`})});for(let t=g.number+1;t<_.number;t++){let n=e.view.state.doc.line(t).from;a.push({from:n,to:n,value:i.line({attributes:{style:`background-color: ${p}`,class:`cm-yLineSelection`}})})}}a.push({from:u.index,to:u.index,value:i.widget({side:u.index-l.index>0?-1:1,block:!1,widget:new jn(d,f)})})}),this.decorations=i.set(a,!0)}},Nn=f.fromClass(Mn,{decorations:e=>e.decorations}),Pn=()=>{let e=!0;return(t,n)=>{if(e){e=!1;try{t()}finally{e=!0}}else n!==void 0&&n()}},Fn=class{constructor(e){this.undoManager=e}addTrackedOrigin(e){this.undoManager.addTrackedOrigin(e)}removeTrackedOrigin(e){this.undoManager.removeTrackedOrigin(e)}undo(){return this.undoManager.undo()!=null}redo(){return this.undoManager.redo()!=null}},X=w.define({combine(e){return e[e.length-1]}});fe.define();var In=class{constructor(e){this.view=e,this.conf=e.state.facet(X),this._undoManager=this.conf.undoManager,this.syncConf=e.state.facet(Y),this._beforeChangeSelection=null,this._mux=Pn(),this._onStackItemAdded=({stackItem:e,changedParentTypes:t})=>{t.has(this.syncConf.ytext)&&this._beforeChangeSelection&&!e.meta.has(this)&&e.meta.set(this,this._beforeChangeSelection)},this._onStackItemPopped=({stackItem:t})=>{let n=t.meta.get(this);if(n){let t=this.syncConf.fromYRange(n);e.dispatch(e.state.update({selection:t,effects:[l.scrollIntoView(t)]})),this._storeSelection()}},this._storeSelection=()=>{this._beforeChangeSelection=this.syncConf.toYRange(this.view.state.selection.main)},this._undoManager.on(`stack-item-added`,this._onStackItemAdded),this._undoManager.on(`stack-item-popped`,this._onStackItemPopped),this._undoManager.addTrackedOrigin(this.syncConf)}update(e){e.selectionSet&&(e.transactions.length===0||e.transactions[0].annotation(En)!==this.syncConf)&&this._storeSelection()}destroy(){this._undoManager.off(`stack-item-added`,this._onStackItemAdded),this._undoManager.off(`stack-item-popped`,this._onStackItemPopped),this._undoManager.removeTrackedOrigin(this.syncConf)}},Ln=f.fromClass(In),Rn=({state:e,dispatch:t})=>e.facet(X).undo()||!0,zn=({state:e,dispatch:t})=>e.facet(X).redo()||!0,Bn=(e,t,{undoManager:n=new He(e)}={})=>{let r=new Tn(e,t),i=[Y.of(r),On];return t&&i.push(kn,Nn),n!==!1&&i.push(X.of(new Fn(n)),Ln,l.domEventHandlers({beforeinput(e,t){return e.inputType===`historyUndo`?Rn(t):e.inputType===`historyRedo`&&zn(t)}})),i},Vn=Object.freeze({bold:`bold text`,code:`code`,italic:`emphasis`,strikethrough:`struck text`}),Hn=`link text`,Un=`https://`,Wn=`alt text`,Gn=`https://`,Kn=`Video`,qn=`https://`,Jn=`code`,Yn=Object.freeze([`Column 1`,`Column 2`]),Xn=`Value`,Z=Object.freeze({heading:/^#{1,6}\s+/,quote:/^>\s+/,bulletList:/^[-*+]\s+/,numberedList:/^\d+\.\s+/,taskList:/^-\s\[(?: |x|X)\]\s+/});function Zn(e,t){return{from:Math.max(0,Math.min(e.from,e.to,t)),to:Math.max(0,Math.min(Math.max(e.from,e.to),t))}}function Qn(e,t){return t===0||e[t-1]===`
|
|
5
|
-
`}function $n(e,t){if(t<=0)return 0;let n=e.lastIndexOf(`
|
|
6
|
-
`,t-1);return n<0?0:n+1}function er(e,t){let n=e.indexOf(`
|
|
7
|
-
`,t);return n<0?e.length:n}function tr(e,t){let{from:n}=t,{to:r}=t;return r>n&&Qn(e,r)&&--r,{from:$n(e,n),to:er(e,Math.max(n,r))}}function nr(e,t,n,r){let i=e.slice(t.from,t.to);if(i.length>n.length*2&&i.startsWith(n)&&i.endsWith(n)){let e=i.slice(n.length,i.length-n.length);return{anchor:t.from,from:t.from,head:t.from+e.length,insert:e,to:t.to}}return i.length>0?{anchor:t.from+n.length,from:t.from,head:t.from+n.length+i.length,insert:`${n}${i}${n}`,to:t.to}:{anchor:t.from+n.length,from:t.from,head:t.from+n.length+r.length,insert:`${n}${r}${n}`,to:t.to}}function rr(e){return/^https?:\/\//i.test(e.trim())}function ir(e,t){let n=e.slice(t.from,t.to);if(n.length>0&&rr(n))return{anchor:t.from+1,from:t.from,head:t.from+1+9,insert:`[${Hn}](${n})`,to:t.to};if(n.length>0){let e=`[${n}](`;return{anchor:t.from+e.length,from:t.from,head:t.from+e.length+8,insert:`${e}${Un})`,to:t.to}}return{anchor:t.from+1,from:t.from,head:t.from+1+9,insert:`[${Hn}](${Un})`,to:t.to}}function ar(e,t){let n=e.slice(t.from,t.to);if(n.length>0&&rr(n))return{anchor:t.from+2,from:t.from,head:t.from+2+8,insert:``,to:t.to};if(n.length>0){let e=``,to:t.to}}return{anchor:t.from+2,from:t.from,head:t.from+2+8,insert:``,to:t.to}}function or(e,t){let n=e.slice(t.from,t.to);if(n.length>0&&rr(n))return{anchor:t.from+2,from:t.from,head:t.from+2+5,insert:``,to:t.to};if(n.length>0){let e=``,to:t.to}}return{anchor:t.from+2,from:t.from,head:t.from+2+5,insert:``,to:t.to}}function sr(e){return Z.taskList.test(e)?e.replace(Z.taskList,``):Z.numberedList.test(e)?e.replace(Z.numberedList,``):Z.bulletList.test(e)?e.replace(Z.bulletList,``):Z.quote.test(e)?e.replace(Z.quote,``):Z.heading.test(e)?e.replace(Z.heading,``):e}function cr(e,t){switch(t){case`paragraph`:return!(Z.taskList.test(e)||Z.numberedList.test(e)||Z.bulletList.test(e)||Z.quote.test(e)||Z.heading.test(e));case`heading-1`:return/^#\s+/.test(e);case`heading-2`:return/^##\s+/.test(e);case`heading-3`:return/^###\s+/.test(e);case`heading-4`:return/^####\s+/.test(e);case`heading-5`:return/^#####\s+/.test(e);case`heading-6`:return/^######\s+/.test(e);case`quote`:return Z.quote.test(e);case`bullet-list`:return Z.bulletList.test(e)&&!Z.taskList.test(e);case`numbered-list`:return Z.numberedList.test(e);case`task-list`:return Z.taskList.test(e);default:return!1}}function lr(e,t){switch(e){case`heading-1`:return`# `;case`heading-2`:return`## `;case`heading-3`:return`### `;case`heading-4`:return`#### `;case`heading-5`:return`##### `;case`heading-6`:return`###### `;case`quote`:return`> `;case`bullet-list`:return`- `;case`numbered-list`:return`${t+1}. `;case`task-list`:return`- [ ] `;default:return``}}function Q(e,t,n){let r=tr(e,t),i=e.slice(r.from,r.to).split(`
|
|
8
|
-
`),a=i.filter(e=>e.trim().length>0),o=n!==`paragraph`&&a.length>0&&a.every(e=>cr(e,n))?`paragraph`:n,s=0,c=i.map(e=>{if(e.trim().length===0)return e;let t=sr(e);if(o===`paragraph`)return t;let n=lr(o,s);return s+=1,`${n}${t}`});return{anchor:r.from,from:r.from,head:r.from+c.join(`
|
|
9
|
-
`).length,insert:c.join(`
|
|
10
|
-
`),to:r.to}}function $(e,t,n){return Q(e,t,`heading-${n}`)}function ur(e,t){return Q(e,t,`bullet-list`)}function dr(e,t){return Q(e,t,`quote`)}function fr(e,t){return Q(e,t,`task-list`)}function pr(e,t){return Q(e,t,`numbered-list`)}function mr(e,t){let n=tr(e,t),r=hr(e.slice(n.from,n.to));return r===null?Q(e,t,`paragraph`):{anchor:n.from,from:n.from,head:n.from+r.length,insert:r,to:n.to}}function hr(e){let t=e.replace(/\r\n/g,`
|
|
11
|
-
`).match(/^```[^\n]*\n([\s\S]*?)\n```$/);return t?t[1]:null}function gr(e,t){let n=e.slice(t.from,t.to);if(n.length>0){let e=hr(n);return e===null?{anchor:t.from+4,from:t.from,head:t.from+4+n.length,insert:`\`\`\`\n${n}\n\`\`\``,to:t.to}:{anchor:t.from,from:t.from,head:t.from+e.length,insert:e,to:t.to}}return{anchor:t.from+4,from:t.from,head:t.from+4+4,insert:`\`\`\`\n${Jn}\n\`\`\``,to:t.to}}function _r(e,t,n,r,i=0){let a=t.from>0&&e[t.from-1]!==`
|
|
12
|
-
`,o=t.to<e.length&&e[t.to]!==`
|
|
13
|
-
`,s=a?`
|
|
14
|
-
`:``,c=`${s}${n}${o?`
|
|
15
|
-
`:``}`,l=t.from+s.length+r;return{anchor:l,from:t.from,head:l+i,insert:c,to:t.to}}function vr(e=``){let t=e.trim()||Xn;return[`| ${Yn.join(` | `)} |`,`| --- | --- |`,`| ${t} | ${Xn} |`].join(`
|
|
16
|
-
`)}function yr(e,t){return _r(e,t,vr(e.slice(t.from,t.to)),2,Yn[0].length)}function br(e,t){return _r(e,t,`---`,4,0)}function xr(e,t,n){let r=String(e??``),i=Zn(t,r.length),a;switch(n){case`bold`:a=nr(r,i,`**`,Vn.bold);break;case`italic`:a=nr(r,i,`_`,Vn.italic);break;case`strikethrough`:a=nr(r,i,`~~`,Vn.strikethrough);break;case`code`:a=nr(r,i,"`",Vn.code);break;case`link`:a=ir(r,i);break;case`image`:a=ar(r,i);break;case`video`:a=or(r,i);break;case`paragraph`:a=mr(r,i);break;case`heading`:a=$(r,i,2);break;case`heading-1`:a=$(r,i,1);break;case`heading-2`:a=$(r,i,2);break;case`heading-3`:a=$(r,i,3);break;case`heading-4`:a=$(r,i,4);break;case`heading-5`:a=$(r,i,5);break;case`heading-6`:a=$(r,i,6);break;case`quote`:a=dr(r,i);break;case`bullet-list`:a=ur(r,i);break;case`numbered-list`:a=pr(r,i);break;case`task-list`:a=fr(r,i);break;case`code-block`:a=gr(r,i);break;case`table`:a=yr(r,i);break;case`horizontal-rule`:a=br(r,i);break;default:return null}return a?r.slice(a.from,a.to)===a.insert?null:a:null}var Sr=new Set([`block-beta`,`classdiagram`,`erdiagram`,`flowchart`,`gantt`,`gitgraph`,`graph`,`journey`,`mindmap`,`pie`,`quadrantchart`,`sankey-beta`,`sequencediagram`,`statediagram`,`statediagram-v2`,`timeline`,`xychart-beta`]),Cr=new Set(`accdescr.acctitle.actor.alt.and.autonumber.break.callback.class.classdef.click.critical.dateformat.direction.else.end.exclude.include.interpolate.link.linkstyle.loop.note.opt.par.participant.rect.section.state.style.subgraph.theme.title`.split(`.`)),wr=new Set([`false`,`no`,`off`,`on`,`true`,`yes`]),Tr=new Set([`bt`,`lr`,`rl`,`tb`,`td`]);function Er(e){let t=e.match(/[A-Za-z_][\w.]*(?:-[A-Za-z0-9_][\w.]*)*/u,!1);return t?(e.match(/[A-Za-z_][\w.]*(?:-[A-Za-z0-9_][\w.]*)*/u),t[0]):``}function Dr(e){return e.match(`%%{`)?(e.skipTo(`}%%`)?e.match(`}%%`):e.skipToEnd(),!0):!1}var Or=ne.define({languageData:{commentTokens:{line:`%%`}},token(e){if(e.eatSpace())return null;if(Dr(e))return`meta`;if(e.match(`%%`))return e.skipToEnd(),`comment`;if(e.match(/"(?:[^"\\]|\\.)*"?/u)||e.match(/'(?:[^'\\]|\\.)*'?/u))return`string`;if(e.match(/#[0-9a-f]{3,8}\b/iu)||e.match(/#[A-Za-z][\w-]*/u))return`atom`;if(e.match(/\b\d+(?:\.\d+)?%?\b/u))return`number`;if(e.match(/[ox*+<#]?[-=.\\/]+(?:left|right|up|down)?[-=.\\/]*[ox*+>#]?/iu))return`operator`;if(e.match(/[{}[\]():,;|]/u))return`punctuation`;let t=Er(e);if(t){let e=t.toLowerCase();return Sr.has(e)?`meta`:Cr.has(e)?`keyword`:wr.has(e)?`bool`:Tr.has(e)?`atom`:/^[A-Z][A-Z0-9_]*$/u.test(t)?`typeName`:`variableName`}return e.next(),null}}),kr=new le(Or),Ar=v.of({alias:[`mermaid`,`mmd`],extensions:[`mermaid`,`mmd`],name:`Mermaid`,support:kr});function jr(e){return t=>{let n=t.state.doc.lineAt(t.pos),r=n.text.slice(0,t.pos-n.from),i=r.lastIndexOf(`[[`);if(i===-1)return null;let a=r.slice(i+2);if(a.includes(`]]`))return null;let o=a.toLowerCase(),s=n.from+i+2,c=e().map(e=>{let t=e.replace(/\.md$/i,``);return{filePath:e,label:t,fileName:t.split(`/`).pop()}}).filter(({label:e,fileName:t})=>e.toLowerCase().includes(o)||t.toLowerCase().includes(o)).map(({label:e,fileName:t})=>({label:e,detail:e.includes(`/`)?` ${t}`:void 0,apply:(e,t,n,r)=>{let i=e.state.doc.toString(),a=r;i.slice(r,r+2)===`]]`&&(a=r+2),e.dispatch({changes:{from:n,to:a,insert:`${t.label}]]`},selection:{anchor:n+t.label.length+2}})},type:`text`,boost:+!!e.toLowerCase().startsWith(o)}));return c.length===0?null:{from:s,options:c,filter:!1}}}var Mr=new Set([`@startuml`,`@enduml`,`@startmindmap`,`@endmindmap`,`@startwbs`,`@endwbs`,`@startgantt`,`@endgantt`,`@startjson`,`@endjson`,`@startyaml`,`@endyaml`,`@startsalt`,`@endsalt`]),Nr=new Set(`activate.actor.agent.allowmixing.alt.annotation.artifact.as.autonumber.boundary.box.break.caption.card.case.circle.class.cloud.collections.component.control.create.critical.database.deactivate.destroy.detach.else.elseif.end.endlegend.endif.endwhile.entity.enum.exception.file.folder.footer.fork.frame.group.header.hide.hnote.if.interface.json.kill.label.legend.loop.map.namespace.newpage.node.note.object.of.opt.order.over.package.page.par.participant.partition.person.port.protocol.queue.rectangle.ref.repeat.return.rnote.show.skinparam.split.stack.start.state.stop.storage.struct.switch.then.title.usecase.while`.split(`.`)),Pr=new Set([`false`,`no`,`off`,`on`,`true`,`yes`]);function Fr(e){let t=e.match(/[@!A-Za-z_][\w.-]*/u,!1);return t?(e.match(/[@!A-Za-z_][\w.-]*/u),t[0]):``}var Ir=ne.define({languageData:{commentTokens:{block:{close:`'/`,open:`/'`},line:`'`}},startState(){return{inBlockComment:!1}},token(e,t){if(t.inBlockComment)return e.skipTo(`'/`)?(e.match(`'/`),t.inBlockComment=!1):e.skipToEnd(),`comment`;if(e.eatSpace())return null;if(e.match(`/'`))return t.inBlockComment=!0,`comment`;let n=e.pos===0?` `:e.string.charAt(e.pos-1);if(e.peek()===`'`&&(e.sol()||/\s/u.test(n)))return e.skipToEnd(),`comment`;if(e.match(/"(?:[^"\\]|\\.)*"?/u))return`string`;if(e.match(/#[0-9a-f]{3,8}\b/iu)||e.match(/#[A-Za-z][\w-]*/u))return`atom`;if(e.match(/\b\d+(?:\.\d+)?\b/u))return`number`;if(e.match(/[<>{}[\]():,]/u))return`punctuation`;if(e.match(/[ox*+<#]?[-=.\\/]+(?:left|right|up|down)?[-=.\\/]*[ox*+>#]?/iu))return`operator`;let r=Fr(e);if(r){let e=r.toLowerCase();return e.startsWith(`!`)||Mr.has(e)?`meta`:Nr.has(e)?`keyword`:Pr.has(e)?`bool`:/^[A-Z][A-Z0-9_]*$/u.test(r)?`typeName`:`variableName`}return e.next(),null}}),Lr=new le(Ir),Rr=v.of({alias:[`plantuml`,`puml`],extensions:[`plantuml`,`puml`],name:`PlantUML`,support:Lr});function zr(e){let t=Array.from(e?.clipboardData?.files??[]);for(let e of t)if(e?.type?.startsWith?.(`image/`))return e;let n=Array.from(e?.clipboardData?.items??[]);for(let e of n){if(e.kind!==`file`||!e.type?.startsWith?.(`image/`))continue;let t=e.getAsFile?.();if(t)return t}return null}function Br(e,t){let n=zr(e);return n?typeof t==`function`?(console.debug(`[editor] Detected pasted image.`,{name:n.name??``,size:n.size??null,type:n.type??``}),e.preventDefault?.(),Promise.resolve(t(n)).catch(e=>{console.error(`[editor] Failed to process pasted image:`,e)}),!0):(console.warn(`[editor] Ignoring pasted image because no image paste handler is registered.`),!1):!1}var Vr=[...ct,Ar,Rr],Hr=i.mark({class:`cm-matchingBracket cm-matchingBracket-paired`}),Ur=i.mark({class:`cm-nonmatchingBracket`}),Wr=i.mark({class:`cm-remoteUpdateFlash`}),Gr=1350,Kr=160,qr=900,Jr=/^(\s*(?:>\s*)*(?:[-+*]|\d+[.)])\s+\[)( |x|X)(\])(\s.*)?$/,Yr=Object.freeze({indentLess:Oe,indentMore:Ee,openSearch:Qt,redo:Me,undo:De}),Xr=class extends ye{toDOM(){let e=document.createElement(`span`);return e.className=`cm-remoteUpdateCaretWidget`,e.setAttribute(`aria-hidden`,`true`),e}ignoreEvent(){return!0}},Zr=b.define(),Qr=b.define(),$r=ee.define({create:()=>i.none,update(e,t){let n=e.map(t.changes);return t.effects.forEach(e=>{if(e.is(Qr)){n=i.none;return}if(e.is(Zr)){let{from:t,showCaret:r,to:a}=e.value,o=[];a>t&&o.push(Wr.range(t,a)),r&&o.push(i.widget({side:-1,widget:new Xr}).range(t)),n=o.length>0?i.set(o,!0):i.none}}),n},provide:e=>l.decorations.from(e)});function ei(e,t){return t.selection.ranges.some(t=>t.empty&&e.to===t.head)}function ti(e,t){let n=[];if(!e.matched)return n.push(Ur.range(e.start.from,e.start.to)),e.end&&n.push(Ur.range(e.end.from,e.end.to)),n;let r=ei(e.start,t),i=e.end?ei(e.end,t):!1;return r||n.push(Hr.range(e.start.from,e.start.to)),e.end&&!i&&n.push(Hr.range(e.end.from,e.end.to)),n}function ni(e){let t=e===`dark`?`oklch(from var(--color-surface-offset) l c h / 0.55)`:`oklch(from var(--color-surface-offset) l c h / 0.75)`,n=e===`dark`?`oklch(from var(--color-primary) l c h / 0.28)`:`oklch(from var(--color-primary) l c h / 0.18)`,r=e===`dark`?`oklch(from var(--color-primary) l c h / 0.4)`:`oklch(from var(--color-primary) l c h / 0.26)`,i=e===`dark`?`oklch(from var(--color-primary) l c h / 0.65)`:`oklch(from var(--color-primary) l c h / 0.5)`,a=e===`dark`?`color-mix(in oklab, var(--color-primary) 78%, white)`:`color-mix(in oklab, var(--color-primary) 84%, black)`,o=e===`dark`?`oklch(from var(--color-primary) l c h / 0.2)`:`oklch(from var(--color-primary) l c h / 0.12)`,s=e===`dark`?`oklch(from var(--color-primary) calc(l + 0.08) c h / 0.85)`:`oklch(from var(--color-primary) calc(l - 0.04) c h / 0.7)`,c=e===`dark`?`oklch(from var(--color-error) l c h / 0.12)`:`oklch(from var(--color-error) l c h / 0.1)`,u=e===`dark`?`oklch(from var(--color-error) calc(l + 0.08) c h / 0.8)`:`oklch(from var(--color-error) calc(l - 0.04) c h / 0.7)`;return l.theme({"&":{backgroundColor:`var(--color-bg)`,color:`var(--color-text)`},".cm-content":{caretColor:a,fontFamily:`var(--font-mono)`,padding:`16px 0`},".cm-cursor, .cm-dropCursor":{borderLeftColor:a,borderLeftWidth:`3px`,marginLeft:`-1px`},".cm-foldPlaceholder":{backgroundColor:`var(--color-surface-dynamic)`,border:`none`,color:`var(--color-text-muted)`},".cm-gutters":{backgroundColor:`var(--color-surface)`,borderRight:`1px solid var(--color-divider)`,color:`var(--color-text-muted)`,minWidth:`44px`},".cm-line":{padding:`0 16px`},".cm-activeLine":{backgroundColor:t,boxShadow:`inset 3px 0 0 ${n}`},".cm-activeLineGutter":{backgroundColor:t,boxShadow:`inset 3px 0 0 ${n}`,color:`var(--color-text-muted)`},".cm-matchingBracket":{borderRadius:`2px`,color:`inherit`},".cm-matchingBracket.cm-matchingBracket-paired":{backgroundColor:o,outline:`1px solid ${s}`},".cm-nonmatchingBracket":{backgroundColor:c,outline:`1px solid ${u}`,borderRadius:`2px`},".cm-selectionMatch":{backgroundColor:`var(--color-primary-highlight)`},".cm-remoteUpdateFlash":{animation:`collabmd-remote-update-flash 1.35s ease-out`,backgroundColor:e===`dark`?`oklch(from var(--color-primary) l c h / 0.22)`:`oklch(from var(--color-primary) l c h / 0.16)`,borderRadius:`3px`,boxShadow:`0 0 0 1px ${e===`dark`?`oklch(from var(--color-primary) calc(l + 0.05) c h / 0.26)`:`oklch(from var(--color-primary) calc(l - 0.04) c h / 0.2)`}`},".cm-remoteUpdateCaretWidget":{animation:`collabmd-remote-update-caret 1s ease-out`,backgroundColor:`transparent`,borderLeft:`2px solid ${e===`dark`?`color-mix(in oklab, var(--color-primary) 78%, white)`:`color-mix(in oklab, var(--color-primary) 84%, black)`}`,borderRadius:`999px`,boxShadow:`0 0 0 1px ${e===`dark`?`oklch(from var(--color-primary) calc(l + 0.06) c h / 0.22)`:`oklch(from var(--color-primary) calc(l - 0.04) c h / 0.16)`}`,display:`inline-block`,height:`1.2em`,marginLeft:`-1px`,marginRight:`-1px`,pointerEvents:`none`,transformOrigin:`center bottom`,verticalAlign:`text-bottom`,width:`0`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:r},"&.cm-focused .cm-selectionLayer .cm-selectionBackground":{border:`1px solid ${i}`,borderRadius:`2px`},"@keyframes collabmd-remote-update-flash":{"0%":{backgroundColor:e===`dark`?`oklch(from var(--color-primary) l c h / 0.34)`:`oklch(from var(--color-primary) l c h / 0.26)`},"100%":{backgroundColor:`oklch(from var(--color-primary) l c h / 0)`}},"@keyframes collabmd-remote-update-caret":{"0%":{boxShadow:`0 0 0 1px ${e===`dark`?`oklch(from var(--color-primary) calc(l + 0.08) c h / 0.34)`:`oklch(from var(--color-primary) calc(l - 0.04) c h / 0.24)`}`,opacity:`0`,transform:`translateY(0.2em) scaleY(0.7)`},"18%":{opacity:`1`,transform:`translateY(0) scaleY(1)`},"72%":{opacity:`1`,transform:`translateY(0) scaleY(1)`},"100%":{boxShadow:`0 0 0 1px ${e===`dark`?`oklch(from var(--color-primary) calc(l + 0.08) c h / 0)`:`oklch(from var(--color-primary) calc(l - 0.04) c h / 0)`}`,opacity:`0`,transform:`translateY(-0.05em) scaleY(0.9)`}}},{dark:e===`dark`})}function ri(e){return Ie(e)?kr:Pe(e)?Lr:Fe(e)?Te():Ce({base:we,codeLanguages:Vr})}function ii(e){return{from:Math.min(...e.ranges.map(e=>Math.min(e.from,e.to))),to:Math.max(...e.ranges.map(e=>Math.max(e.from,e.to)))}}var ai=class{constructor({editorContainer:e,getFileList:t,initialTheme:n,lineInfoElement:r,lineWrappingEnabled:i=!0,onDocChanged:a=null,onImagePaste:o=null,onSelectionChanged:s=null,onViewportChanged:c=null}){this.editorContainer=e,this.getFileList=t??(()=>[]),this.initialTheme=n,this.lineInfoElement=r,this.lineWrappingEnabled=i,this.onDocChanged=a,this.onImagePaste=o,this.onSelectionChanged=s,this.onViewportChanged=c,this.editorView=null,this.themeCompartment=new pe,this.syntaxThemeCompartment=new pe,this.lineWrappingCompartment=new pe,this.viewportFrame=0,this.remoteUpdateFlashTimer=0,this.lastLocalInputAt=0,this.handleScroll=()=>{this.viewportFrame||=requestAnimationFrame(()=>{this.viewportFrame=0,this.emitViewportChange()})},this.handleLocalInputActivity=()=>{this.lastLocalInputAt=Date.now()}}createUpdateListener(){return l.updateListener.of(e=>{e.docChanged&&this.onDocChanged?.(),(e.selectionSet||e.docChanged)&&(this.updateCursorInfo(e.state),this.onSelectionChanged?.(e.state))})}getBaseExtensions(e,{readOnly:t=!1}={}){let i=[s(),a(),c(),ke(),oe(),h(),x.allowMultipleSelections.of(!0),ge(),n(ie,{fallback:!0}),se({renderMatch:ti}),Se(),xe({override:[jr(this.getFileList)]}),_(),r(),g(),bt(),de.of([...be,...Ne,...je,...en,...he,Ae]),l.contentAttributes.of({"aria-label":`Markdown editor`}),ri(e),this.themeCompartment.of(ni(this.initialTheme)),this.syntaxThemeCompartment.of(this.initialTheme===`dark`?Cn:[]),this.lineWrappingCompartment.of(this.lineWrappingEnabled?l.lineWrapping:[]),$r,this.createUpdateListener()];return t?(i.push(x.readOnly.of(!0)),i.push(l.editable.of(!1)),i):(i.splice(13,0,ae.highest(l.domEventHandlers({paste:e=>Br(e,this.onImagePaste)}))),i)}clearEditorDom({preserveLoadingIndicator:e=!0}={}){if(!this.editorContainer)return;let t=e?this.editorContainer.querySelector(`#editorLoading`):null;Array.from(this.editorContainer.children).forEach(e=>{e!==t&&e.remove()})}teardownEditorView({clearContainer:e=!1}={}){this.editorView?.contentDOM?.removeEventListener(`beforeinput`,this.handleLocalInputActivity),this.editorView?.contentDOM?.removeEventListener(`keydown`,this.handleLocalInputActivity),this.editorView?.contentDOM?.removeEventListener(`paste`,this.handleLocalInputActivity),this.editorView?.contentDOM?.removeEventListener(`compositionstart`,this.handleLocalInputActivity),this.editorView?.scrollDOM?.removeEventListener(`scroll`,this.handleScroll),this.editorView?.destroy(),this.editorView=null,e&&this.editorContainer&&(this.editorContainer.innerHTML=``,delete this.editorContainer.dataset.editorMode)}mountEditor(e,{editorMode:t=`collaborative`,preserveScrollTop:n=0}={}){this.clearEditorDom({preserveLoadingIndicator:!0}),this.teardownEditorView(),this.editorView=new l({parent:this.editorContainer,state:e}),this.editorContainer.dataset.editorMode=t,this.editorView.scrollDOM.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.editorView.contentDOM.addEventListener(`beforeinput`,this.handleLocalInputActivity),this.editorView.contentDOM.addEventListener(`keydown`,this.handleLocalInputActivity),this.editorView.contentDOM.addEventListener(`paste`,this.handleLocalInputActivity),this.editorView.contentDOM.addEventListener(`compositionstart`,this.handleLocalInputActivity),this.updateCursorInfo(this.editorView.state),this.onSelectionChanged?.(this.editorView.state),this.emitViewportChange(),n>0&&requestAnimationFrame(()=>{this.editorView?.scrollDOM&&(this.editorView.scrollDOM.scrollTop=n)})}initialize({awareness:e,filePath:t,undoManager:n,ytext:r}){let i=this.editorView?.scrollDOM?.scrollTop??0,a=x.create({doc:r.toString(),extensions:[...this.getBaseExtensions(t),Bn(r,e,{undoManager:n})]});this.mountEditor(a,{editorMode:`collaborative`,preserveScrollTop:i})}initializeProvisional({content:e=``,filePath:t}){let n=this.editorView?.scrollDOM?.scrollTop??0,r=x.create({doc:String(e??``),extensions:this.getBaseExtensions(t,{readOnly:!0})});this.mountEditor(r,{editorMode:`provisional`,preserveScrollTop:n})}destroy(){this.viewportFrame&&=(cancelAnimationFrame(this.viewportFrame),0),this.remoteUpdateFlashTimer&&=(clearTimeout(this.remoteUpdateFlashTimer),0),this.teardownEditorView({clearContainer:!0})}getText(){return this.editorView?.state.doc.toString()??``}getDoc(){return this.editorView?.state.doc??null}getState(){return this.editorView?.state??null}getScrollContainer(){return this.editorView?.scrollDOM??null}applyTheme(e){this.editorView&&this.editorView.dispatch({effects:[this.themeCompartment.reconfigure(ni(e)),this.syntaxThemeCompartment.reconfigure(e===`dark`?Cn:[])]})}isLineWrappingEnabled(){return this.lineWrappingEnabled}setLineWrapping(e){return this.lineWrappingEnabled=!!e,this.editorView&&this.editorView.dispatch({effects:this.lineWrappingCompartment.reconfigure(this.lineWrappingEnabled?l.lineWrapping:[])}),this.lineWrappingEnabled}requestMeasure(){this.editorView?.requestMeasure()}runEditorCommand(e){if(!this.editorView)return!1;let t=Yr[String(e??``)];if(typeof t!=`function`)return!1;let n=t(this.editorView);return n&&e!==`openSearch`&&this.editorView.focus(),n}flashRemoteRange({from:e=0,to:t=0}={},n=Gr){let r=this.editorView?.state;if(!r||r.doc.length===0)return!1;let i=Math.min(Math.max(Math.round(e),0),r.doc.length),a=Math.min(Math.max(Math.round(t),0),r.doc.length);if(a<=i){if(i<r.doc.length)a=i+1;else if(i>0)--i,a=i+1;else return!1}let o=Math.max(a-i,0)<=Kr&&Date.now()-this.lastLocalInputAt>qr;return this.editorView.dispatch({effects:Zr.of({from:i,showCaret:o,to:a})}),this.remoteUpdateFlashTimer&&clearTimeout(this.remoteUpdateFlashTimer),this.remoteUpdateFlashTimer=window.setTimeout(()=>{this.remoteUpdateFlashTimer=0,this.editorView?.dispatch({effects:Qr.of(null)})},n),!0}getViewportState(e=.35){return{topLine:this.getTopVisibleLineNumber(e),viewportRatio:e}}getTopVisibleLineNumber(e=0){if(!this.editorView)return 1;let t=this.editorView.scrollDOM.getBoundingClientRect(),n=Math.max(t.height*e,8),r=this.editorView.lineBlockAtHeight(t.top+n-this.editorView.documentTop);return r?this.editorView.state.doc.lineAt(r.from).number:1}getCurrentSelectionLineRange(){let e=this.editorView?.state;if(!e)return null;let{doc:t,selection:n}=e,{from:r,to:i}=ii(n),a=t.lineAt(r).number,o=Math.min(Math.max(i,r),t.length);return o>r&&t.lineAt(o).from===o&&--o,{endLine:t.lineAt(o).number,startLine:a}}getCurrentSelectionCommentAnchor(){let e=this.editorView?.state;if(!e)return null;let{doc:t,selection:n}=e,{from:r,to:i}=ii(n);if(r===i){let e=t.lineAt(r);return{anchorKind:`line`,anchorQuote:et(e.text),endIndex:e.to,endLine:e.number,startIndex:e.from,startLine:e.number}}let a=Math.min(Math.max(i,r),t.length);return a>r&&t.lineAt(a).from===a&&--a,{anchorKind:`text`,anchorQuote:et(t.sliceString(r,i)),endIndex:i,endLine:t.lineAt(a).number,startIndex:r,startLine:t.lineAt(r).number}}normalizeLineRange({endLine:e,startLine:t}){let n=this.editorView?.state;if(!n)return{endLine:1,startLine:1};let r=n.doc.lines,i=Math.min(Math.max(Math.round(t??1),1),r);return{endLine:Math.min(Math.max(Math.round(e??i),i),r),startLine:i}}getLineInfoAt(e){let t=this.editorView?.state;if(!t)return null;let n=Math.min(Math.max(e,0),t.doc.length),r=t.doc.lineAt(n);return{line:r,lineNumber:r.number}}getAnchorClientRect(e){let t=this.editorView?.state,n=this.editorView;if(!t||!n||!e)return null;let r=e.anchorKind||e.kind||`line`,i=Math.min(Math.max(Math.round(e.startIndex??0),0),t.doc.length),a=Math.min(Math.max(Math.round(e.endIndex??i),i),t.doc.length);if(r===`text`&&a>i){let e=n.coordsAtPos(i),t=n.coordsAtPos(Math.max(a-1,i));if(e&&t)return{bottom:Math.max(e.bottom,t.bottom),height:Math.max(e.bottom,t.bottom)-Math.min(e.top,t.top),left:Math.min(e.left,t.left),right:Math.max(e.right,t.right),top:Math.min(e.top,t.top),width:Math.max(e.right,t.right)-Math.min(e.left,t.left)}}let o=t.doc.line(Math.min(Math.max(Math.round(e.startLine??1),1),t.doc.lines)),s=n.lineBlockAt(o.from),c=n.scrollDOM.getBoundingClientRect(),l=n.scrollDOM.scrollTop,u=n.contentDOM.getBoundingClientRect(),d=u.left,f=Math.max(u.right,c.right-8),p=c.top+s.top-l;return{bottom:p+s.height,height:s.height,left:d,right:f,top:p,width:Math.max(f-d,0)}}getSelectionChipClientRect(e){let t=this.editorView?.state,n=this.editorView;if(!t||!n||!e)return null;let r=Math.min(Math.max(Math.round(e.startIndex??0),0),t.doc.length),i=t.doc.lineAt(r),a=n.lineBlockAt(i.from),o=n.scrollDOM.getBoundingClientRect(),s=n.scrollDOM.scrollTop,c=n.contentDOM.getBoundingClientRect(),l=Math.max(c.right,o.right-8),u=o.top+a.top-s;return{bottom:u+a.height,height:a.height,left:c.left,right:l,top:u,width:Math.max(l-c.left,0)}}scrollToLine(e,t=0){let n=this.editorView?.state,r=this.editorView?.scrollDOM;if(!n||!r||!this.editorView)return!1;let i=Math.min(Math.max(Math.round(e),1),n.doc.lines),a=n.doc.line(i),o=this.editorView.lineBlockAt(a.from),s=Math.max(r.scrollHeight-r.clientHeight,0),c=t>0?r.clientHeight*t:8,l=Math.min(Math.max(o.top-c,0),s);return r.scrollTo({top:l}),!0}revealSearchMatch({column:e=1,length:t=0,line:n=1}={}){let r=this.editorView?.state;if(!r||!this.editorView)return!1;let i=Math.min(Math.max(Math.round(Number(n)||1),1),r.doc.lines),a=r.doc.line(i),o=Math.min(Math.max(Math.round(Number(e)||1)-1,0),a.length),s=a.from+o,c=Math.min(s+Math.max(Math.round(Number(t)||0),0),a.to);return this.editorView.dispatch({scrollIntoView:!0,selection:y.range(s,Math.max(c,s))}),this.editorView.focus(),this.scrollToLine(i,.2),!0}scrollToPosition(e,t=`center`){let n=this.editorView?.state,r=this.editorView?.scrollDOM;if(!n||!r||!this.editorView)return!1;let i=Math.min(Math.max(Math.round(e),0),n.doc.length),a=this.editorView.lineBlockAt(i),o=Math.max(r.scrollHeight-r.clientHeight,0),s=a.top;return t===`center`&&(s=a.top-(r.clientHeight-a.height)/2),r.scrollTo({top:Math.min(Math.max(s,0),o)}),!0}applyMarkdownToolbarAction(e){if(!this.editorView)return!1;let{state:t}=this.editorView,n=t.doc.toString(),r=!1,i=t.changeByRange(t=>{let i=xr(n,t,e);return i?(r=!0,{changes:{from:i.from,insert:i.insert,to:i.to},range:y.range(i.anchor,i.head)}):{range:t}});return r?(this.editorView.dispatch(t.update(i,{scrollIntoView:!0,userEvent:`input`})),this.editorView.focus(),!0):!1}insertText(e){if(!this.editorView)return!1;let t=String(e??``),{state:n}=this.editorView,r=n.selection.main,i=r.from+t.length;return this.editorView.dispatch({changes:{from:r.from,insert:t,to:r.to},scrollIntoView:!0,selection:{anchor:i,head:i},userEvent:`input`}),this.editorView.focus(),!0}replaceText(e){if(!this.editorView)return!1;let t=String(e??``),{state:n}=this.editorView;return this.editorView.dispatch({changes:{from:0,insert:t,to:n.doc.length},selection:{anchor:0,head:0},userEvent:`input`}),this.editorView.focus(),!0}toggleTaskListItem(e){let t=this.editorView?.state;if(!this.editorView||!t)return!1;let n=Number.parseInt(String(e??``),10);if(!Number.isFinite(n))return!1;let r=Math.min(Math.max(n,1),t.doc.lines),i=t.doc.line(r),a=Jr.exec(i.text);if(!a)return!1;let[,o,s]=a,c=i.from+o.length,l=s===` `?`x`:` `;return this.editorView.dispatch({changes:{from:c,insert:l,to:c+1},userEvent:`input`}),!0}updateCursorInfo(e){if(!this.lineInfoElement)return;let t=e.selection.main.head,n=e.doc.lineAt(t),r=t-n.from+1;this.lineInfoElement.textContent=`Ln ${n.number}, Col ${r}`}emitViewportChange(){this.onViewportChanged?.(this.getViewportState())}},oi=class{constructor({editorContainer:e,lineWrappingEnabled:t=!0,initialTheme:n,lineInfoElement:r,onAwarenessChange:i,onConnectionChange:a,onCommentsChange:o,onContentChange:s,onImagePaste:c,onSelectionChange:l,preferredUserName:u,localUser:d,getFileList:f}){this.onAwarenessChange=i,this.onCommentsChange=o,this.onContentChange=s,this.onSelectionChange=l,this.activeFilePath=``,this.bootstrapContent=null,this.pendingCollaborativeBindings=null,this.hasDeliveredContent=!1,this.lastDeliveredContent=null,this.collaborationClient=new st({localUser:d,onAwarenessChange:e=>this.onAwarenessChange?.(e),onConnectionChange:a,onInitialSync:()=>this.emitContentChange(),preferredUserName:u,resolveAwarenessCursor:e=>this.resolveAwarenessCursor(e)}),this.viewAdapter=new ai({editorContainer:e,getFileList:f||(()=>[]),initialTheme:n,lineInfoElement:r,lineWrappingEnabled:t,onDocChanged:()=>{this.emitContentChange()},onImagePaste:c,onViewportChanged:e=>{this.collaborationClient.setLocalViewport(e)},onSelectionChanged:()=>{this.onSelectionChange?.(this.getCurrentSelectionCommentAnchor())}}),this.commentThreadStore=new ot({getDoc:()=>this.collaborationClient.ydoc,getEditorState:()=>this.viewAdapter.getState(),getLocalUser:()=>this.collaborationClient.getLocalUser(),onCommentsChange:e=>this.onCommentsChange?.(e)})}async initialize(e){this.activeFilePath=e,this.hasDeliveredContent=!1,this.lastDeliveredContent=null;let t=await this.collaborationClient.initialize(e);this.commentThreadStore.bind({commentThreads:t.commentThreads,ydoc:t.ydoc,ytext:t.ytext}),this.pendingCollaborativeBindings=t,this.collaborationClient.initialSyncComplete&&this.activateCollaborativeView(),this.onAwarenessChange?.(this.collaborationClient.collectUsers(e=>this.resolveAwarenessCursor(e)))}activateCollaborativeView(){return this.pendingCollaborativeBindings?(this.viewAdapter.initialize({awareness:this.pendingCollaborativeBindings.awareness,filePath:this.activeFilePath,undoManager:this.pendingCollaborativeBindings.undoManager,ytext:this.pendingCollaborativeBindings.ytext}),this.commentThreadStore.refreshComments(),this.pendingCollaborativeBindings=null,this.bootstrapContent=null,!0):!1}showBootstrapContent({content:e=``,filePath:t=this.activeFilePath}={}){return!this.collaborationClient.initialSyncComplete&&(this.activeFilePath=t,this.bootstrapContent=String(e??``),this.viewAdapter.initializeProvisional({content:this.bootstrapContent,filePath:this.activeFilePath}),this.commentThreadStore.refreshComments(),this.emitContentChange())}hasBootstrapContent(){return this.bootstrapContent!==null}emitContentChange({force:e=!1}={}){let t=this.getText();return!e&&this.hasDeliveredContent&&t===this.lastDeliveredContent?!1:(this.hasDeliveredContent=!0,this.lastDeliveredContent=t,this.onContentChange?.(),!0)}ensureInitialContent(){return this.emitContentChange()}applyTheme(e){this.viewAdapter.applyTheme(e)}getText(){return this.collaborationClient.getText()||this.viewAdapter.getText()}getScrollContainer(){return this.viewAdapter.getScrollContainer()}getTopVisibleLineNumber(e=0){return this.viewAdapter.getTopVisibleLineNumber(e)}getLocalUser(){return this.collaborationClient.getLocalUser()}get awareness(){return this.collaborationClient.awareness}get provider(){return this.collaborationClient.provider}get ydoc(){return this.collaborationClient.ydoc}get ytext(){return this.collaborationClient.ytext}getCurrentSelectionLineRange(){return this.viewAdapter.getCurrentSelectionLineRange()}getCurrentSelectionCommentAnchor(){return this.viewAdapter.getCurrentSelectionCommentAnchor()}getCommentAnchorClientRect(e){return this.viewAdapter.getAnchorClientRect(e)}getSelectionChipClientRect(e){return this.viewAdapter.getSelectionChipClientRect(e)}getCommentThreads(){return this.commentThreadStore.getCommentThreads()}createCommentThread(e){return this.commentThreadStore.createCommentThread(e)}replyToCommentThread(e,t){return this.commentThreadStore.replyToCommentThread(e,t)}toggleCommentReaction(e,t,n){return this.commentThreadStore.toggleCommentReaction(e,t,n)}deleteCommentThread(e){return this.commentThreadStore.deleteCommentThread(e)}isLineWrappingEnabled(){return this.viewAdapter.isLineWrappingEnabled()}setLineWrapping(e){return this.viewAdapter.setLineWrapping(e)}scrollToLine(e,t=0){return this.viewAdapter.scrollToLine(e,t)}revealSearchMatch(e){return this.viewAdapter.revealSearchMatch(e)}getUserCursor(e){return this.collaborationClient.getUserCursor(e,e=>this.resolveAwarenessCursor(e))}getUserViewport(e){return this.collaborationClient.getUserViewport(e)}scrollToPosition(e,t=`center`){return this.viewAdapter.scrollToPosition(e,t)}scrollToUserViewport(e){let t=this.getUserViewport(e);return t?this.scrollToLine(t.topLine,t.viewportRatio):!1}scrollToUserCursor(e,t=`center`){let n=this.getUserCursor(e);return n?this.scrollToPosition(n.cursorHead,t)||this.scrollToLine(n.cursorLine):!1}setUserName(e){return this.collaborationClient.setUserName(e)}requestMeasure(){this.viewAdapter.requestMeasure()}runEditorCommand(e){return this.viewAdapter.runEditorCommand(e)}applyMarkdownToolbarAction(e){return this.viewAdapter.applyMarkdownToolbarAction(e)}insertText(e){return this.viewAdapter.insertText(e)}replaceText(e){return this.viewAdapter.replaceText(e)}toggleTaskListItem(e){return this.collaborationClient.initialSyncComplete?this.viewAdapter.toggleTaskListItem(e):!1}flashExternalUpdate(e){return this.viewAdapter.flashRemoteRange(e)}waitForInitialSync(e=1500){return this.collaborationClient.waitForInitialSync(e)}destroy(){this.commentThreadStore.unbind(),this.activeFilePath=``,this.bootstrapContent=null,this.pendingCollaborativeBindings=null,this.hasDeliveredContent=!1,this.lastDeliveredContent=null,this.collaborationClient.destroy(),this.viewAdapter.destroy()}resolveAwarenessCursor(e){let t=this.collaborationClient.ydoc,n=this.collaborationClient.ytext,r=this.viewAdapter.getState();if(!e?.anchor||!e?.head||!t||!r||!n)return null;let i=T(e.anchor,t),a=T(e.head,t);if(!i||!a||i.type!==n||a.type!==n)return null;let o=r.doc.lineAt(a.index);return{cursorAnchor:i.index,cursorHead:a.index,cursorLine:o.number}}};export{oi as EditorSession};
|