@aiquants/markdown-explorer 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/README.md +13 -8
- package/dist/EditSurface-BesNcSQj.cjs +6 -0
- package/dist/EditSurface-DNjI8pV3.js +975 -0
- package/dist/{ExplorerSplit-CdqEKz-I.cjs → ExplorerSplit-B4oNvydP.cjs} +1 -1
- package/dist/{ExplorerSplit-3WMRDA7G.js → ExplorerSplit-GUdzpDPg.js} +1 -1
- package/dist/{MultiLayout-Gf1xT-Le.js → MultiLayout-BJ-s6AaD.js} +2 -2
- package/dist/{MultiLayout-BEg1X8Jx.cjs → MultiLayout-DtKChQ_s.cjs} +1 -1
- package/dist/{NativeScrollBar-0cpp2OIu.js → NativeScrollBar-D10fsk-7.js} +1 -1
- package/dist/{NativeScrollBar-idIQsvCv.cjs → NativeScrollBar-DJKlPWvD.cjs} +1 -1
- package/dist/{TreeLayout-DJY_WqzP.cjs → TreeLayout-C1mTmoPp.cjs} +1 -1
- package/dist/{TreeLayout-DzZCgMTt.js → TreeLayout-DQT5p2vI.js} +2 -2
- package/dist/core/labels.d.cts +9 -27
- package/dist/core/labels.d.ts +9 -27
- package/dist/{index-CJgHGeZs.js → index-0pnuyLUO.js} +1445 -1515
- package/dist/index-T98wklgM.cjs +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{merge-BVk6pvO_.cjs → merge-CTkzzHtn.cjs} +1 -1
- package/dist/{merge-BOcofJN5.js → merge-DauzoA2W.js} +1 -1
- package/docs/behavior/dom-hooks.md +1 -1
- package/docs/behavior/layout.md +2 -1
- package/docs/behavior/localization.md +6 -5
- package/package.json +5 -5
- package/dist/EditSurface-Bwl4S1vQ.cjs +0 -7
- package/dist/EditSurface-rKoy_ndP.js +0 -880
- package/dist/index-bMaSoQTe.cjs +0 -13
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";const l=require("react/jsx-runtime"),a=require("react"),Y=require("react-router"),F=require("./location-BVEN_Ihk.cjs"),le=require("@aiquants/markdown/code-blocks"),D=require("./dataRoute-BONacTPi.cjs"),he=require("@aiquants/markdown"),Be=require("@aiquants/markdown/source-lines"),zn=require("@aiquants/markdown/viewer-settings"),X=require("./storage-DM0EvkVf.cjs"),Zn=require("@aiquants/route-revalidation");function Gn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const y=Gn(a),He=Object.freeze(["en","ja"]),Pt="en",We=e=>`viewerSpreadsheet${e.charAt(0).toUpperCase()}${e.slice(1)}`,_t=Object.freeze(Object.keys(le.SPREADSHEET_BLOCK_LABEL_CATALOGS.en)),$t=e=>Object.fromEntries(_t.map(t=>[We(t),le.SPREADSHEET_BLOCK_LABEL_CATALOGS[e][t].text])),Ft=Object.freeze({panelMoved:Object.freeze(["title","column","position"]),panelMoveUnavailable:Object.freeze(["title","move"]),panelDragStarted:Object.freeze(["title"]),panelDragCancelled:Object.freeze(["title"]),multiColumnRegion:Object.freeze(["column"]),...Object.fromEntries(_t.filter(e=>le.SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS[e].length>0).map(e=>[We(e),le.SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS[e]]))}),Kn=/\{(\w+)\}/gu,qt={...$t("en"),explorerRegion:"Explorer",sourceLabel:"Source",refreshTreeLabel:"Refresh tree",refreshTree:"Reload the tree and the open documents from the source",treeRefreshed:"Reloaded the tree from the source",treeRefreshFailed:e=>`Could not reload the tree: ${e}`,refreshDocumentLabel:"Refresh document",refreshDocument:"Reload the document from the source",refreshDocumentNamed:e=>`Refresh ${e}`,documentRefreshed:e=>`Reloaded ${e}`,documentRefreshFailed:e=>`Could not reload the document: ${e}`,showMarkupLabel:"Source",showMarkup:"Show the document's Markdown as written",showMarkupNamed:e=>`Source of ${e}`,editDocumentLabel:"Edit",editDocument:"Edit the document's Markdown (or double-click the document)",editDocumentNamed:e=>`Edit ${e}`,editDraftDocument:"Edit the document's Markdown without saving, to try it in the preview (or double-click the document)",editDraftDocumentNamed:e=>`Edit ${e} without saving`,editExternallyLabel:"Open in its editor",editExternally:"Open the document in its own editor, in a new tab",editExternallyNamed:e=>`Open ${e} in its editor`,editorRegion:e=>`Editing ${e}`,editorLabel:e=>`Markdown of ${e}`,editLoading:"Loading the source for editing…",editToolbar:"Editor",saveDraft:"Save",saveDraftTooltip:"Save the draft (Ctrl+S, or ⌘S on a Mac)",closeEditor:"Close editor",editView:"View",editViewNamed:e=>`View of ${e}`,editViewEditor:"Editor",editViewEditorTooltip:"Show the editor (Ctrl+E, or ⌘E on a Mac, switches with the preview)",editViewSplit:"Side by side",editViewSplitTooltip:"Show the editor and the preview side by side",editViewSplitResize:"Resize the editor and the preview",editViewPreview:"Preview",editViewPreviewTooltip:"Show the preview (Ctrl+E, or ⌘E on a Mac, switches with the editor)",historyOpen:"History",draftUnsaved:"Unsaved changes",draftStatus:"Draft, not saved",draftNotSaved:"This draft is not saved: the document cannot be saved here.",draftSaving:"Saving…",draftSaved:"Saved",draftSavedMerged:"Saved, merged with changes saved elsewhere",draftConflicts:e=>e===1?"1 conflict with changes saved elsewhere: choose what to keep, then save":`${e} conflicts with changes saved elsewhere: choose what to keep, then save`,draftSaveFailed:e=>`Could not save: ${e}`,documentSaved:e=>`Saved ${e}`,documentSavedMerged:e=>`Saved ${e}, merged with changes saved elsewhere`,conflictOurs:"your draft",conflictTheirs:"saved elsewhere",conflictUseOurs:"Use my lines",conflictUseTheirs:"Use the saved lines",conflictKeepBoth:"Keep both",conflictNext:"Next conflict",editGrantTitle:"Editing needs your permission",editGrantBody:"Allow this site to change documents on your behalf. You are asked once; signing out asks again.",editGrantAction:"Grant permission",editGrantRetry:"Try again",unsavedTitle:"Discard unsaved changes?",unsavedBody:e=>`${e} has changes that are not saved.`,unsavedDiscard:"Discard changes",draftDiscardTitle:"Discard the draft?",draftDiscardBody:e=>`The changes to ${e} are not saved anywhere and will be lost.`,unsavedStay:"Keep editing",historyTitle:e=>`Revisions of ${e}`,historyLoading:"Loading the revisions…",historyEmpty:"No revisions are kept for this document.",historyCurrent:"Current",historyKept:"Kept",historyEntry:(e,t)=>t===""?e:`${e} by ${t}`,historyRestore:"Put into the draft",historyClose:"Close",historyRestored:e=>`Put the revision into the draft of ${e}; save to keep it`,previewRegion:"Preview",previewUpdating:"Updating the preview…",previewFailed:e=>`Could not preview: ${e}`,previewTablePending:"This table can be edited once the preview shows the draft.",expandAll:"Expand all folders",collapseAll:"Collapse all folders",treeSettings:"Tree settings",switchToMulti:"Open in the multi-panel view",switchToTree:"Open in the tree view",resizeExplorer:"Resize the explorer",showExplorer:"Show the explorer",hideExplorer:"Close the explorer",treeRegion:"Documents",treeLoading:"Loading the tree…",treeEmptyTitle:"Nothing to show",treeEmptyBody:"This source has no documents you can open.",folderLoadFailed:"This folder could not be loaded.",loopFolderName:e=>`${e} (already open above)`,foldersLoadFailedNamed:e=>`${new Intl.ListFormat("en",{type:"conjunction"}).format(e)} could not be loaded`,foldersLoading:e=>e===1?"Loading 1 folder…":`Loading ${String(e)} folders…`,expandAllStarted:"Opening all folders…",expandAllProgress:(e,t)=>`Opening all folders (${String(e)} opened, ${String(t)} loading)…`,expandAllDone:(e,t,n)=>{const r=`Opened ${String(e)} ${e===1?"folder":"folders"}`;return t>0?`${r}; ${String(t)} could not be loaded`:n?e===0?"All folders are already open":`${r}; every folder is open`:r},expandAllFolderLimit:(e,t,n)=>`Opened ${String(e)} ${e===1?"folder":"folders"} and stopped at the limit of ${String(t)} ${t===1?"folder":"folders"} to load. Choose "${n}" again to continue`,expandAllDepthLimit:(e,t)=>`Opened ${String(e)} ${e===1?"folder":"folders"}; folders more than ${String(t)} ${t===1?"level":"levels"} deep stay closed`,treeEntryKindDirectory:"directory",treeEntryKindFile:"file",treeScrollUp:"Scroll up",treeScrollDown:"Scroll down",treeScrollToTop:"Top",treeScrollToBottom:"Bottom",selectionTitle:e=>`Selected (${String(e)})`,clearSelection:"Clear the selection",openSelectionInMulti:e=>`Open ${String(e)} in panels`,removeFromSelection:e=>`Remove ${e} from the selection`,settingSortMode:"Sort order",sortNative:"Source order",sortAscending:"Name A→Z",sortDescending:"Name Z→A",sortOldest:"Modified old→new",sortNewest:"Modified new→old",settingFolderPlacement:"Folders",folderPlacementMixed:"Mixed",folderPlacementFirst:"First",folderPlacementLast:"Last",settingReadmePlacement:"README",readmePlacementMixed:"Mixed",readmePlacementFirst:"First",readmePlacementLast:"Last",settingSelectionMode:"Selection",selectionSingle:"Single",selectionMultiple:"Multiple",selectionNone:"Off",settingDoubleClick:"Double-click",doubleClickRecursive:"Expand all levels",doubleClickToggle:"Toggle",settingExpandIconSize:"Expander size",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"Always expanded",settingRevealDocument:"Reveal the open document",settingRemoveRootIndent:"No root indent",settingTreeLines:"Tree lines",settingExpandIcons:"Expanders",settingDirectoryIcons:"Folder icons",settingFileIcons:"File icons",settingOn:"On",settingOff:"Off",settingAnnouncement:(e,t)=>`${e}: ${t}`,documentRegion:"Document",documentEmpty:"Select a document in the explorer.",folderReadmeMissing:e=>`${e} has no README.`,documentLoading:"Loading the document…",markupLoading:"Loading the source…",documentShown:e=>`Showing ${e}`,documentFailed:(e,t)=>`${e}: ${t}`,announcementSequence:e=>e.map(t=>/[.!?]$/u.test(t)?t:`${t}.`).join(" "),textTruncated:"Only the beginning of this file is shown.",inertLink:"This link points outside the source and cannot be opened.",failureUnauthorizedTitle:"Your session has expired",failureUnauthorizedBody:"Reload the page to sign in again.",failureForbiddenTitle:"Access denied",failureForbiddenBody:"You do not have permission to open this.",failureNotFoundTitle:"Not found",failureNotFoundBody:"It may have been moved or deleted.",failureNotConfiguredTitle:"This source is not set up",failureNotConfiguredBody:"Ask your administrator to configure it.",failureInvalidTitle:"Invalid address",failureInvalidBody:"The document path in this address cannot be used.",failureTooLargeTitle:"Too large to display",failureTooLargeBody:"This file exceeds the size that can be displayed.",failureUnsupportedTitle:"Cannot be displayed",failureUnsupportedBody:"This type of file cannot be shown here.",failureFailedTitle:"Something went wrong",failureFailedBody:"Try again in a moment.",retry:"Try again",reloadPage:"Reload the page",imageZoomIn:"Zoom in",imageZoomOut:"Zoom out",imageFit:"Fit to the view",imageFitLevel:"Fit",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"Open in a new tab",download:"Download",copyText:"Copy the text",copiedText:"Copied the text",copyTextFailed:"Could not copy the text",mediaUnsupported:"Your browser cannot play this file.",fileNotShown:"This file cannot be shown here. Download it to open it.",pdfNotShown:"This browser does not show PDF files inside the page. Open it in a new tab or download it.",viewerLoading:"Loading data...",viewerErrorPrefix:"Error: ",viewerStyleTitle:"Display Style",viewerSelectStyle:"Select display style",viewerPinStyle:"Pin style selector",viewerUnpinStyle:"Unpin style selector",viewerErrorTitle:"An error occurred",viewerMissingImage:"Image not found",viewerOpenToc:"Open table of contents",viewerTocTitle:"Table of contents",viewerPinToc:"Pin table of contents",viewerUnpinToc:"Unpin table of contents",viewerSelectAlign:"Select alignment",viewerAlignTitle:"Alignment",viewerPinAlign:"Pin alignment selector",viewerUnpinAlign:"Unpin alignment selector",viewerAlignLeft:"Align left",viewerAlignCenter:"Align center",viewerAlignRight:"Align right",viewerMermaidInteractionMode:"Mouse interaction mode",viewerMermaidInteractionModeTouch:"Touch interaction mode",viewerMermaidModeNone:"No interaction",viewerMermaidModeZoom:"Zoom only",viewerMermaidModePan:"Pan only (drag)",viewerMermaidModePanShift:"Pan only (Shift+drag)",viewerMermaidModeBoth:"Zoom and pan (drag)",viewerMermaidModeBothShift:"Zoom and pan (Shift+drag)",viewerMermaidModeNoneTouch:"No interaction (a finger scrolls the page)",viewerMermaidModeZoomTouch:"Zoom only (two fingers)",viewerMermaidModePanTouch:"Pan only (one-finger drag while the diagram overflows)",viewerMermaidModeBothTouch:"Zoom and pan (two fingers, one finger while the diagram overflows)",viewerMermaidZoomIn:"Zoom In",viewerMermaidZoomOut:"Zoom Out",viewerMermaidResetView:"Reset View",viewerMermaidPanUp:"Pan Up",viewerMermaidPanDown:"Pan Down",viewerMermaidPanLeft:"Pan Left",viewerMermaidPanRight:"Pan Right",viewerMermaidDiagram:"Diagram (arrow keys pan, + and - zoom, 0 resets)",viewerMermaidRetry:"Try again",viewerEmbeddedVideo:"embedded video",viewerEmbeddedPost:"embedded post",viewerEmbeddedFrame:"Embedded content",multiRegion:"Panels",multiEmpty:"Select documents in the explorer to open them side by side.",panelLimit:e=>`You can open up to ${String(e)} panels at once.`,panelOpened:e=>`Opened ${e}`,panelClosed:e=>`Closed ${e}`,panelAlreadyOpen:e=>`${e} is already open`,panelHidden:e=>`Hid ${e}`,panelShown:e=>`Showed ${e}`,panelMaximized:e=>`Maximized ${e}`,panelRestored:e=>`Restored ${e} to its size`,panelHide:"Hide the panel",panelMaximize:"Maximize the panel",panelRestore:"Restore the panel to its size",panelClose:"Close the panel",panelSwitchToCustomDrag:"Switch to the custom drag mode",panelSwitchToNormalDrag:"Back to the normal drag mode",panelCustomDragBadge:"Custom",panelMove:"Move the panel",panelMovePreviousColumn:"Move to the previous column",panelMoveNextColumn:"Move to the next column",panelMoveUp:"Move up",panelMoveDown:"Move down",panelMoved:"Moved {title} to column {column}, position {position}",panelMoveUnavailable:"{move} is not available for {title}",panelDragStarted:"Picked up {title}",panelDragCancelled:"Kept {title} where it was",hiddenPanelsTitle:"Hidden panels:",hiddenPanelBadge:"Hidden",hiddenPanelNotice:"This panel is hidden",multiColumnEmpty:"This column is empty",multiColumnRegion:"Column {column}",panelDropHere:"Drop the panel here"},Wn={...$t("ja"),explorerRegion:"エクスプローラー",sourceLabel:"ソース",refreshTreeLabel:"ツリーを更新",refreshTree:"ソースからツリーと開いている文書を読み込み直す",treeRefreshed:"ツリーをソースから読み込み直しました",treeRefreshFailed:e=>`ツリーを読み込み直せませんでした: ${e}`,refreshDocumentLabel:"文書を更新",refreshDocument:"ソースから文書を読み込み直す",refreshDocumentNamed:e=>`${e} を更新`,documentRefreshed:e=>`${e} を読み込み直しました`,documentRefreshFailed:e=>`文書を読み込み直せませんでした: ${e}`,showMarkupLabel:"ソース",showMarkup:"文書の Markdown を書いたまま表示",showMarkupNamed:e=>`${e} のソース`,editDocumentLabel:"編集",editDocument:"文書の Markdown を編集 (文書のダブルクリックでも)",editDocumentNamed:e=>`${e} を編集`,editDraftDocument:"文書の Markdown を保存せずに編集し、プレビューで確かめる (文書のダブルクリックでも)",editDraftDocumentNamed:e=>`${e} を保存せずに編集`,editExternallyLabel:"元のエディタで開く",editExternally:"文書を元のエディタで、新しいタブに開く",editExternallyNamed:e=>`${e} を元のエディタで開く`,editorRegion:e=>`${e} を編集中`,editorLabel:e=>`${e} の Markdown`,editLoading:"編集のためにソースを読み込み中…",editToolbar:"エディタ",saveDraft:"保存",saveDraftTooltip:"下書きを保存 (Ctrl+S、Mac は ⌘S)",closeEditor:"編集を閉じる",editView:"表示",editViewNamed:e=>`${e} の表示`,editViewEditor:"エディタ",editViewEditorTooltip:"エディタを表示 (Ctrl+E、Mac は ⌘E でプレビューと切り替え)",editViewSplit:"並べて表示",editViewSplitTooltip:"エディタとプレビューを並べて表示",editViewSplitResize:"エディタとプレビューの割合を変更",editViewPreview:"プレビュー",editViewPreviewTooltip:"プレビューを表示 (Ctrl+E、Mac は ⌘E でエディタと切り替え)",historyOpen:"履歴",draftUnsaved:"保存していない変更があります",draftStatus:"保存しない下書き",draftNotSaved:"この下書きは保存しません。ここでは文書を保存できません。",draftSaving:"保存中…",draftSaved:"保存しました",draftSavedMerged:"ほかで保存された変更と統合して保存しました",draftConflicts:e=>`ほかで保存された変更と ${e} か所が重なりました。残す方を選んでから保存してください`,draftSaveFailed:e=>`保存できませんでした: ${e}`,documentSaved:e=>`${e} を保存しました`,documentSavedMerged:e=>`${e} を、ほかで保存された変更と統合して保存しました`,conflictOurs:"あなたの下書き",conflictTheirs:"ほかで保存された版",conflictUseOurs:"自分の行を使う",conflictUseTheirs:"保存された行を使う",conflictKeepBoth:"両方を残す",conflictNext:"次の衝突へ",editGrantTitle:"編集には許可が必要です",editGrantBody:"このサイトがあなたに代わって文書を変えることを許可してください。尋ねるのは 1 回だけで、サインアウトすると次にまた尋ねます。",editGrantAction:"許可する",editGrantRetry:"もう一度試す",unsavedTitle:"保存していない変更を破棄しますか?",unsavedBody:e=>`${e} に保存していない変更があります。`,unsavedDiscard:"変更を破棄",draftDiscardTitle:"下書きを破棄しますか?",draftDiscardBody:e=>`${e} への変更はどこにも保存されず、失われます。`,unsavedStay:"編集を続ける",historyTitle:e=>`${e} の版`,historyLoading:"版の一覧を読み込み中…",historyEmpty:"この文書の版は残っていません。",historyCurrent:"現在の版",historyKept:"保持",historyEntry:(e,t)=>t===""?e:`${e} (${t})`,historyRestore:"下書きに戻す",historyClose:"閉じる",historyRestored:e=>`${e} の下書きに版を戻しました。残すには保存してください`,previewRegion:"プレビュー",previewUpdating:"プレビューを更新中…",previewFailed:e=>`プレビューできませんでした: ${e}`,previewTablePending:"プレビューが下書きを描くと、この表を編集できます。",expandAll:"すべてのフォルダーを展開",collapseAll:"すべてのフォルダーを折りたたむ",treeSettings:"ツリーの設定",switchToMulti:"マルチビューで開く",switchToTree:"ツリービューで開く",resizeExplorer:"エクスプローラーの幅を変更",showExplorer:"エクスプローラーを開く",hideExplorer:"エクスプローラーを閉じる",treeRegion:"文書の一覧",treeLoading:"ツリーを読み込み中…",treeEmptyTitle:"表示できるファイルがありません",treeEmptyBody:"このソースには開ける文書がありません。",folderLoadFailed:"このフォルダーを読み込めませんでした。",loopFolderName:e=>`${e} (上の階層で開いています)`,foldersLoadFailedNamed:e=>`${new Intl.ListFormat("ja",{type:"conjunction"}).format(e)} を読み込めませんでした`,foldersLoading:e=>`フォルダーを ${String(e)} 件読み込み中…`,expandAllStarted:"すべてのフォルダーを展開しています…",expandAllProgress:(e,t)=>`すべてのフォルダーを展開中 (展開 ${String(e)} 件、読み込み中 ${String(t)} 件)…`,expandAllDone:(e,t,n)=>{const r=`${String(e)} 件のフォルダーを展開しました`;return t>0?`${r}。うち ${String(t)} 件は読み込めませんでした`:n?e===0?"すべてのフォルダーが既に開いています":`${r}。すべてのフォルダーが開いています`:r},expandAllFolderLimit:(e,t,n)=>`${String(e)} 件のフォルダーを展開し、読み込みの上限 (${String(t)} 件) で止めました。続けるには「${n}」をもう一度押してください`,expandAllDepthLimit:(e,t)=>`${String(e)} 件のフォルダーを展開しました。深さ ${String(t)} 階層より下のフォルダーは閉じたままです`,treeEntryKindDirectory:"ディレクトリ",treeEntryKindFile:"ファイル",treeScrollUp:"上へスクロール",treeScrollDown:"下へスクロール",treeScrollToTop:"先頭へ",treeScrollToBottom:"末尾へ",selectionTitle:e=>`選択中 (${String(e)})`,clearSelection:"選択を解除",openSelectionInMulti:e=>`${String(e)} 件をパネルで開く`,removeFromSelection:e=>`${e} を選択から外す`,settingSortMode:"並び順",sortNative:"取得順",sortAscending:"名前の昇順",sortDescending:"名前の降順",sortOldest:"更新日時の昇順 (古い順)",sortNewest:"更新日時の降順 (新しい順)",settingFolderPlacement:"フォルダーの位置",folderPlacementMixed:"混ぜる",folderPlacementFirst:"先に",folderPlacementLast:"後に",settingReadmePlacement:"README の位置",readmePlacementMixed:"混ぜる",readmePlacementFirst:"先に",readmePlacementLast:"後に",settingSelectionMode:"選択",selectionSingle:"1 件",selectionMultiple:"複数",selectionNone:"オフ",settingDoubleClick:"ダブルクリック",doubleClickRecursive:"下の階層まで展開",doubleClickToggle:"開閉",settingExpandIconSize:"展開アイコンの大きさ",expandIconSizeValue:e=>`${String(e)} px`,settingAlwaysExpanded:"常に展開",settingRevealDocument:"開いた文書をツリーで表示",settingRemoveRootIndent:"最上位の字下げなし",settingTreeLines:"ツリーの線",settingExpandIcons:"展開アイコン",settingDirectoryIcons:"フォルダーのアイコン",settingFileIcons:"ファイルのアイコン",settingOn:"オン",settingOff:"オフ",settingAnnouncement:(e,t)=>`${e}: ${t}`,documentRegion:"文書",documentEmpty:"エクスプローラーで文書を選んでください。",folderReadmeMissing:e=>`${e} には README がありません。`,documentLoading:"文書を読み込み中…",markupLoading:"ソースを読み込み中…",documentShown:e=>`${e} を表示しています`,documentFailed:(e,t)=>`${e}: ${t}`,announcementSequence:e=>e.map(t=>/[。!?]$/u.test(t)?t:`${t}。`).join(""),textTruncated:"このファイルは先頭だけを表示しています。",inertLink:"リンク先がソースの外にあるため開けません。",failureUnauthorizedTitle:"セッションの有効期限が切れました",failureUnauthorizedBody:"ページを再読み込みして、もう一度サインインしてください。",failureForbiddenTitle:"アクセスが許可されていません",failureForbiddenBody:"これを開く権限がありません。",failureNotFoundTitle:"見つかりません",failureNotFoundBody:"移動または削除された可能性があります。",failureNotConfiguredTitle:"このソースは設定されていません",failureNotConfiguredBody:"管理者に設定を依頼してください。",failureInvalidTitle:"アドレスが正しくありません",failureInvalidBody:"このアドレスに含まれる文書の経路は使えません。",failureTooLargeTitle:"大きすぎて表示できません",failureTooLargeBody:"このファイルは表示できる大きさを超えています。",failureUnsupportedTitle:"表示できない形式です",failureUnsupportedBody:"この種類のファイルはここでは表示できません。",failureFailedTitle:"読み込みに失敗しました",failureFailedBody:"しばらくしてからもう一度お試しください。",retry:"再試行",reloadPage:"ページを再読み込み",imageZoomIn:"拡大",imageZoomOut:"縮小",imageFit:"画面に合わせる",imageFitLevel:"全体",imageZoomLevel:e=>`${String(e)}%`,openInNewTab:"新しいタブで開く",download:"ダウンロード",copyText:"テキストをコピー",copiedText:"テキストをコピーしました",copyTextFailed:"テキストをコピーできませんでした",mediaUnsupported:"このブラウザではこのファイルを再生できません。",fileNotShown:"このファイルはここでは表示できません。ダウンロードして開いてください。",pdfNotShown:"このブラウザはページの中に PDF を表示しません。新しいタブで開くか、ダウンロードしてください。",viewerLoading:"データを読み込み中...",viewerErrorPrefix:"エラー: ",viewerStyleTitle:"表示スタイル",viewerSelectStyle:"表示スタイルを選択",viewerPinStyle:"スタイル選択をピン留め",viewerUnpinStyle:"スタイル選択のピン留めを解除",viewerErrorTitle:"エラーが発生しました",viewerMissingImage:"画像が見つかりません",viewerOpenToc:"目次を開く",viewerTocTitle:"目次",viewerPinToc:"目次をピン留め",viewerUnpinToc:"目次のピン留めを解除",viewerSelectAlign:"揃えを選択",viewerAlignTitle:"揃え",viewerPinAlign:"揃え選択をピン留め",viewerUnpinAlign:"揃え選択のピン留めを解除",viewerAlignLeft:"左揃え",viewerAlignCenter:"中央揃え",viewerAlignRight:"右揃え",viewerMermaidInteractionMode:"マウス操作モード",viewerMermaidInteractionModeTouch:"タッチ操作モード",viewerMermaidModeNone:"操作なし",viewerMermaidModeZoom:"拡大縮小のみ",viewerMermaidModePan:"移動のみ (左ドラッグ)",viewerMermaidModePanShift:"移動のみ (Shift+ドラッグ)",viewerMermaidModeBoth:"拡大縮小+移動 (左ドラッグ)",viewerMermaidModeBothShift:"拡大縮小+移動 (Shift+ドラッグ)",viewerMermaidModeNoneTouch:"操作なし (指はページをスクロール)",viewerMermaidModeZoomTouch:"拡大縮小のみ (2 本指)",viewerMermaidModePanTouch:"移動のみ (はみ出す図を 1 本指でドラッグ)",viewerMermaidModeBothTouch:"拡大縮小+移動 (2 本指・はみ出す図は 1 本指)",viewerMermaidZoomIn:"拡大",viewerMermaidZoomOut:"縮小",viewerMermaidResetView:"表示を元に戻す",viewerMermaidPanUp:"上へ移動",viewerMermaidPanDown:"下へ移動",viewerMermaidPanLeft:"左へ移動",viewerMermaidPanRight:"右へ移動",viewerMermaidDiagram:"図 (矢印キーで移動、+ と - で拡大縮小、0 で元に戻す)",viewerMermaidRetry:"再試行",viewerEmbeddedVideo:"埋め込みの動画",viewerEmbeddedPost:"埋め込みの投稿",viewerEmbeddedFrame:"埋め込みのコンテンツ",multiRegion:"パネル",multiEmpty:"エクスプローラーで文書を選ぶと、ここに並べて開きます。",panelLimit:e=>`同時に開けるのは ${String(e)} パネルまでです。`,panelOpened:e=>`${e} を開きました`,panelClosed:e=>`${e} を閉じました`,panelAlreadyOpen:e=>`${e} は既に開いています`,panelHidden:e=>`${e} を隠しました`,panelShown:e=>`${e} を表示しました`,panelMaximized:e=>`${e} を最大化しました`,panelRestored:e=>`${e} を元のサイズに戻しました`,panelHide:"パネルを隠す",panelMaximize:"パネルを最大化",panelRestore:"パネルを元のサイズに戻す",panelClose:"パネルを閉じる",panelSwitchToCustomDrag:"カスタムのドラッグの方式に切り替え",panelSwitchToNormalDrag:"通常のドラッグの方式に戻す",panelCustomDragBadge:"カスタム",panelMove:"パネルを移動",panelMovePreviousColumn:"前の列へ移動",panelMoveNextColumn:"次の列へ移動",panelMoveUp:"上へ移動",panelMoveDown:"下へ移動",panelMoved:"{title} を {column} 列目の {position} 番目へ移動しました",panelMoveUnavailable:"{title} は「{move}」できません",panelDragStarted:"{title} を持ち上げました",panelDragCancelled:"{title} の移動を取り消しました",hiddenPanelsTitle:"隠したパネル:",hiddenPanelBadge:"非表示",hiddenPanelNotice:"このパネルは隠しています",multiColumnEmpty:"この列は空です",multiColumnRegion:"{column} 列目",panelDropHere:"ここへパネルをドロップ"},It=Object.freeze({en:Object.freeze(qt),ja:Object.freeze(Wn)}),Xe=Object.freeze(Object.keys(qt)),Xn=new Set(Xe),Yn=e=>Xn.has(e),xe=e=>e===null?"null":typeof e=="string"?JSON.stringify(e.length>40?`${e.slice(0,40)}…`:e):typeof e=="function"?"a function":Array.isArray(e)?"an array":typeof e,Bt=e=>{if(e===void 0)return Pt;if(He.includes(e))return e;throw new RangeError(`[markdown-explorer] locale is the UI language (${He.map(t=>JSON.stringify(t)).join(" or ")}), not a BCP 47 tag; got ${xe(e)}`)},Ue=(e,t)=>{const n=It[Bt(e)];if(t===void 0)return n;if(t===null||typeof t!="object")throw new RangeError(`[markdown-explorer] labels must be an object; got ${xe(t)}`);if(!F.isPlainObject(t))throw new RangeError(`[markdown-explorer] labels must be a plain object; got ${xe(t)}`);const r=t,o={...n};for(const s of Object.keys(r)){if(!Yn(s))throw new RangeError(`[markdown-explorer] labels.${s} is not a known label key; expected one of ${Xe.join(", ")}`);const i=r[s];if(i===void 0)continue;const f=typeof n[s];if(typeof i!==f)throw new TypeError(`[markdown-explorer] labels.${s} must be a ${f}; got ${xe(i)}`);if(typeof i=="string"&&i.trim()==="")throw new RangeError(`[markdown-explorer] labels.${s} must be a non-blank string`);const h=Ft[s];if(typeof i=="string"&&h!==void 0){for(const[,m]of i.matchAll(Kn))if(!h.includes(m??""))throw new RangeError(`[markdown-explorer] labels.${s} uses the unknown placeholder {${String(m)}}; it accepts ${h.map(u=>`{${u}}`).join(", ")}`)}o[s]=i}return Object.freeze(o)},Qn=(e,t)=>{if(Object.is(e,t))return!0;if(e===null||t===null||typeof e!="object"||typeof t!="object")return!1;const n=e,r=t,o=Object.keys(n),s=Object.keys(r);return o.length===s.length&&s.every(i=>Object.hasOwn(n,i)&&Object.is(n[i],r[i]))},Ve=Object.freeze(["light","dark"]),Jn=e=>{if(e===void 0)return"light";if(Ve.includes(e))return e;throw new RangeError(`[markdown-explorer] theme must be ${Ve.map(t=>JSON.stringify(t)).join(" or ")}; got ${typeof e=="string"?JSON.stringify(e):typeof e}`)},Ht=a.createContext(null),P=()=>{const e=a.use(Ht);if(e===null)throw new Error("[markdown-explorer] explorer components must be rendered inside <MarkdownExplorer>");return e},pe=e=>{const{viewSettings:t}=P(),n=()=>e(t.getSnapshot());return a.useSyncExternalStore(t.subscribe,n,n)},Te=()=>{const{config:e}=P(),t=Y.useParams()["*"],[n]=Y.useSearchParams(),r=n.toString();return a.useMemo(()=>F.resolveExplorerLocation(e,t,new URLSearchParams(r)),[e,t,r])},Ut={unauthorized:["failureUnauthorizedTitle","failureUnauthorizedBody"],forbidden:["failureForbiddenTitle","failureForbiddenBody"],"not-found":["failureNotFoundTitle","failureNotFoundBody"],"not-configured":["failureNotConfiguredTitle","failureNotConfiguredBody"],invalid:["failureInvalidTitle","failureInvalidBody"],"too-large":["failureTooLargeTitle","failureTooLargeBody"],unsupported:["failureUnsupportedTitle","failureUnsupportedBody"],failed:["failureFailedTitle","failureFailedBody"]},ee=(e,t)=>e[Ut[t][0]],se=({failure:e,alert:t,onRetry:n,testId:r})=>{const{labels:o}=P(),s=ee(o,e.reason),i=o[Ut[e.reason][1]],f=e.reason==="unauthorized"||e.reason==="forbidden"||e.reason==="failed"?"danger":"warning";return l.jsxs("div",{className:"aqmx-callout",role:t?"alert":void 0,"data-aqmx-tone":f,"data-testid":r===null?void 0:r,"data-aqmx-failure":r===null?void 0:e.reason,children:[l.jsx("p",{className:"aqmx-callout-title",children:s}),l.jsx("p",{className:"aqmx-callout-body",children:i}),e.reason==="unauthorized"?l.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:()=>window.location.reload(),children:o.reloadPage}):n!==void 0&&e.reason==="failed"?l.jsx("button",{type:"button",className:"aqmx-callout-action",onClick:n,children:o.retry}):null]})},er=(e,t)=>{const{phase:n,save:r,dirty:o}=t;switch(n.kind){case"opening":return e.editLoading;case"grant":return e.editGrantTitle;case"failed":return ee(e,n.failure.reason)}switch(r.kind){case"draft":return e.draftStatus;case"saving":return e.draftSaving;case"conflicts":return e.draftConflicts(r.count);case"grant":return e.editGrantTitle;case"failed":return e.draftSaveFailed(ee(e,r.failure.reason));case"saved":if(!o)return r.merged?e.draftSavedMerged:e.draftSaved;break}return o?e.draftUnsaved:""},tr=(e,t,n)=>{switch(t.kind){case"draft":return e.draftNotSaved;case"saved":return t.merged?e.documentSavedMerged(n):e.documentSaved(n);case"conflicts":return e.draftConflicts(t.count);case"grant":return e.editGrantTitle;case"failed":return e.draftSaveFailed(ee(e,t.failure.reason));case"idle":case"saving":return null}},ce=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),emit:()=>{for(const t of[...e])t()}}},Vt="<<<<<<<",zt="=======",Zt=">>>>>>>",ct=(e,t)=>e===t||e.startsWith(`${t} `),dt=e=>Gt(e.split(`
|
|
2
|
+
`)),Gt=e=>{const t=[];let n=null,r=null,o=0;for(const s of e){o+=1;const i=s.charCodeAt(0);i!==60&&i!==61&&i!==62||(ct(s,Vt)?(n=o,r=null):s===zt?n!==null&&r===null?r=o:n=null:ct(s,Zt)&&(n!==null&&r!==null&&t.push({start:n,separator:r,end:o}),n=null,r=null))}return t},ut=e=>e.includes(`\r
|
|
3
|
+
`)?`\r
|
|
4
|
+
`:`
|
|
5
|
+
`,De=e=>e.replace(/\r\n?/gu,`
|
|
6
|
+
`),nr=(e,t)=>t===`
|
|
7
|
+
`?e:e.replaceAll(`
|
|
8
|
+
`,`\r
|
|
9
|
+
`),rr=3,or=/^\d+(?:\.\d+)?$/u,sr=e=>{if(e===null||!or.test(e))return null;const t=Number(e);return t>=F.EDIT_SPLIT_MIN_PERCENT&&t<=F.EDIT_SPLIT_MAX_PERCENT?t:null},Pe=Object.freeze({kind:"idle"}),ft=Object.freeze({kind:"draft"}),ir=({data:e,conflictLabels:t,onSaveSettled:n,sideBySideSetting:r,editorShareSetting:o})=>{const s=new Map,i=new Map,f=new Map,h=new Map,m=new Map,u=ce();let p=null,w=null,b=null;const R=(c,d)=>{c.value={...c.value,...d},u.emit()},O=(c,d)=>s.get(c)===d,T=async(c,d)=>{d.controller.abort(),d.controller=new AbortController;const{signal:g}=d.controller;R(d,{phase:{kind:"opening"}});const L=await e.edit(c,g);if(!O(c,d)||g.aborted||!("kind"in L))return;if(L.kind==="grant"){R(d,{phase:{kind:"grant",href:L.href}});return}if(L.kind==="failure"){R(d,{phase:{kind:"failed",failure:L.failure}});return}const A=De(L.text),N=L.kind==="draft";d.base={text:A,version:N?null:L.version},d.draft=A,d.ending=ut(L.text),R(d,{phase:{kind:"editing"},history:N?!1:L.history,dirty:!1,save:N?ft:Pe,generation:d.value.generation+1})},M=c=>{const d=s.get(c);d!==void 0&&(d.controller.abort(),s.delete(c),f.delete(c))},j=(c,d,g)=>(c.set(d,g),()=>{c.get(d)===g&&c.delete(d)}),x=(c,d,g,L={})=>{R(d,{...L,save:g}),n(c,g)},E=async c=>{h.get(c)?.flush();const d=s.get(c);if(d===void 0||d.value.phase.kind!=="editing"||d.base===null||d.value.save.kind==="saving")return;const{version:g}=d.base;if(g===null){n(c,ft);return}const L=dt(d.draft).length;if(L>0){x(c,d,{kind:"conflicts",count:L});return}d.controller.abort(),d.controller=new AbortController;const{signal:A}=d.controller;let N={text:d.base.text,version:g},$=d.draft,z=!1;R(d,{save:{kind:"saving"}});for(let V=0;V<rr;V+=1){const q=await e.save(c,N.version,nr($,d.ending),A);if(!O(c,d)||A.aborted||!("kind"in q))return;if(q.kind==="saved"){h.get(c)?.flush(),d.base={text:$,version:q.version},x(c,d,{kind:"saved",merged:z},{dirty:d.draft!==$});return}if(q.kind==="grant"){x(c,d,{kind:"grant",href:q.href});return}if(q.kind==="failure"){x(c,d,{kind:"failed",failure:q.failure});return}const{mergeDraft:K}=await Promise.resolve().then(()=>require("./merge-CTkzzHtn.cjs"));if(!O(c,d)||A.aborted)return;const B=h.get(c);B?.flush();const Q=De(q.text),v=K(N.text,d.draft,Q,t());if(N={text:Q,version:q.version},d.base=N,d.ending=ut(q.text),d.draft=v.text,B?.adopt(v.text),v.kind==="conflicts"){x(c,d,{kind:"conflicts",count:v.conflicts},{dirty:!0,generation:d.value.generation+1});return}if(z=!0,$=v.text,$===N.text){x(c,d,{kind:"saved",merged:z},{dirty:!1,generation:d.value.generation+1});return}R(d,{dirty:!0,generation:d.value.generation+1})}x(c,d,{kind:"failed",failure:{reason:"failed"}})};return{session:c=>s.get(c)?.value,subscribe:u.subscribe,start:(c,d)=>{const g=s.get(c);if(g!==void 0){R(g,{request:{anchor:d},view:"editor"}),(g.value.phase.kind==="failed"||g.value.phase.kind==="grant")&&T(c,g);return}i.delete(c);const L={value:{path:c,phase:{kind:"opening"},view:"editor",previewPrepared:!1,history:!1,dirty:!1,save:Pe,generation:0,request:{anchor:d}},base:null,draft:"",ending:`
|
|
10
|
+
`,controller:new AbortController};s.set(c,L),T(c,L)},retry:c=>{const d=s.get(c);d===void 0||d.value.phase.kind==="editing"||T(c,d)},draft:c=>{const d=s.get(c);return d===void 0||d.base===null?null:d.draft},setDraft:(c,d)=>{const g=s.get(c);if(g===void 0||g.base===null)return;g.draft=d;const L={},A=d!==g.base.text;A!==g.value.dirty&&(L.dirty=A);const{save:N}=g.value;if(N.kind==="conflicts"){const $=dt(d).length;$===0?L.save=Pe:$!==N.count&&(L.save={kind:"conflicts",count:$})}(L.dirty!==void 0||L.save!==void 0)&&R(g,L)},consumeRequest:c=>{const d=s.get(c);d!==void 0&&d.value.request!==null&&R(d,{request:null})},save:E,replaceDraft:(c,d)=>{const g=h.get(c);g?.flush();const L=s.get(c);if(L===void 0||L.base===null)return;const A=De(d);L.draft=A,g?.adopt(A),R(L,{dirty:A!==L.base.text,generation:L.value.generation+1})},close:c=>{if(!s.has(c))return;const d=h.get(c),g=d===void 0?null:d.returnPoint();M(c),g===null?i.delete(c):i.set(c,g),u.emit()},takeReturn:c=>{const d=i.get(c)??null;return i.delete(c),d},dirtyPaths:()=>[...s.values()].filter(c=>c.value.dirty).map(c=>c.value.path),discard:c=>{for(const d of c)M(d);c.length>0&&u.emit()},editorState:{get:c=>f.get(c),set:(c,d)=>{s.has(c)&&f.set(c,d)}},bindEditor:(c,d)=>j(h,c,d),bindView:(c,d)=>j(m,c,d),viewAnchor:c=>{const d=m.get(c);return d===void 0?null:d.anchor()},flush:c=>h.get(c)?.flush(),flushDrafts:()=>{for(const c of h.values())c.flush()},nextConflict:c=>h.get(c)?.nextConflict()===!0,hasSessions:()=>s.size>0,unsavedAmong:c=>{for(const d of h.values())d.flush();return c.filter(d=>s.get(d)?.value.dirty===!0)},askToDiscard:c=>new Promise(d=>{b?.settle(!1);const g={paths:c,settle:L=>{if(b===g){if(b=null,L)for(const A of c)M(A);u.emit(),d(L)}}};b=g,u.emit()}),discardRequest:()=>b,sideBySide:()=>(p??=r.read(),p),setSideBySide:c=>{p!==c&&(p=c,r.write(c),u.emit())},editorShare:()=>(w??=o.read()??F.EDIT_SPLIT_DEFAULT_PERCENT,w),setEditorShare:c=>{if(!Number.isFinite(c))throw new RangeError(`[markdown-explorer] an editor share must be a finite number; got ${String(c)}`);const d=Math.min(F.EDIT_SPLIT_MAX_PERCENT,Math.max(F.EDIT_SPLIT_MIN_PERCENT,c));w!==d&&(w=d,o.write(d))},setView:(c,d)=>{const g=s.get(c);g===void 0||g.value.view===d||(h.get(c)?.beforeView(d),R(g,{view:d,previewPrepared:g.value.previewPrepared||d==="preview"}))},preparePreview:c=>{const d=s.get(c);d!==void 0&&!d.value.previewPrepared&&R(d,{previewPrepared:!0})}}},Ye=e=>{e.preventDefault(),e.stopPropagation()},Kt=e=>e.endsWith("px")?Number.parseFloat(e):Number.NaN,Wt="data-aqmx-content-pane",Se=Object.freeze({[Wt]:""}),lr="--aqmx-dialog-left",ar="--aqmx-dialog-top",cr='[data-testid="markdown-explorer"]',dr=e=>{const t=e.closest(cr)?.querySelectorAll(`[${Wt}]`),n=t?.item(t.length-1);if(!(n instanceof HTMLElement))throw new Error("[markdown-explorer] a dialog opened where the explorer marks no content pane");return n},ur=e=>{const t=Kt(getComputedStyle(e).marginTop);if(Number.isNaN(t))return null;const n=dr(e),r=e.getBoundingClientRect(),o=e.ownerDocument.documentElement,{left:s,top:i}=F.centeredDialogPosition(n.getBoundingClientRect(),{width:r.width+2*t,height:r.height+2*t},{width:o.clientWidth,height:o.clientHeight});return e.style.setProperty(lr,`${String(s)}px`),e.style.setProperty(ar,`${String(i)}px`),n},fr=e=>e.preventDefault(),Xt=({open:e,onOpen:t,onDismiss:n})=>{const r=a.useRef(null),o=a.useRef(null),s=a.useRef(!1),i=a.useRef(t);a.useLayoutEffect(()=>{i.current=t},[t]),a.useLayoutEffect(()=>{s.current=e;const u=r.current;if(u!==null)if(e&&!u.open){const p=u.ownerDocument.activeElement;o.current=p instanceof HTMLElement?p:null,u.showModal(),i.current?.()}else!e&&u.open&&(u.close(),o.current?.isConnected===!0&&o.current.focus(),o.current=null)},[e]),a.useLayoutEffect(()=>{const u=r.current;if(!e||u===null)return;const p=new ResizeObserver(()=>b());let w=null;const b=()=>{const O=ur(u);O===null||O===w||(w!==null&&p.unobserve(w),p.observe(O),w=O)};b(),p.observe(u);const R=u.ownerDocument.defaultView;return R?.addEventListener("resize",b),u.ownerDocument.addEventListener("scroll",b,{capture:!0,passive:!0}),()=>{p.disconnect(),R?.removeEventListener("resize",b),u.ownerDocument.removeEventListener("scroll",b,{capture:!0})}},[e]);const f=a.useCallback(u=>{u.key!=="Escape"||u.defaultPrevented||(Ye(u),n())},[n]),h=a.useCallback(u=>{u.target===u.currentTarget&&n()},[n]),m=a.useCallback(()=>{s.current&&n()},[n]);return{ref:r,onKeyDown:f,onClick:h,onCancel:fr,onClose:m}},Yt=({open:e,title:t,body:n,confirmLabel:r,cancelLabel:o,onConfirm:s,onCancel:i,testId:f})=>{const h=a.useRef(null),m=a.useId(),u=a.useId(),p=a.useCallback(()=>h.current?.focus(),[]),w=Xt({open:e,onOpen:p,onDismiss:i});return l.jsx("dialog",{...w,className:"aqmx-confirm","aria-labelledby":m,"aria-describedby":u,"data-testid":f,children:l.jsxs("div",{className:"aqmx-confirm-panel",children:[l.jsx("p",{id:m,className:"aqmx-confirm-title",children:t}),l.jsx("p",{id:u,className:"aqmx-confirm-body",children:n}),l.jsxs("div",{className:"aqmx-confirm-actions",children:[l.jsx("button",{ref:h,type:"button",className:"aqmx-callout-action","data-testid":`${f}-cancel`,onClick:i,children:o}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-aqmx-tone":"danger","data-testid":`${f}-confirm`,onClick:s,children:r})]})]})})},ve=e=>{const t=e;return t.status===void 0&&(t.status="pending",e.then(n=>{t.status="fulfilled",t.value=n},n=>{t.status="rejected",t.reason=n})),t},Qt=e=>Object.assign(Promise.resolve(e),{status:"fulfilled",value:e}),fe=e=>e.status==="fulfilled"?e.value:void 0,Jt=Object.freeze({readme:Object.freeze({status:"loading"}),claim:!1}),mr=Object.freeze({readme:Object.freeze({status:"loading"}),claim:!0}),hr=(e,t,n)=>{const r=new Set,o=[...e].reverse();for(let s=o.pop();s!==void 0;s=o.pop()){if(s.type!=="directory"||r.has(s.path))continue;r.add(s.path);const i=s.lazy===!0?n(s.path):void 0,f=s.lazy===!0?i?.status==="loaded"?i.entries:null:s.children===void 0?[]:s.children;if(s.path===t)return f;if(f!==null)for(const h of[...f].reverse())o.push(h)}return null},en=(e,t,n)=>{const r=fe(e.read(t));if(r===void 0||r.status==="deferred")return Jt;if(r.status==="error")return{readme:{status:"failed",failure:r.failure,retry:()=>e.retry(t)},claim:!1};const o=hr(r.entries,n,i=>e.children(t,i));if(o!==null)return{readme:{status:"ok",readme:F.folderReadmeOf(o)},claim:!1};const s=e.children(t,n);return s===void 0||s.status==="loading"?mr:s.status==="failed"?{readme:{status:"failed",failure:s.failure,retry:()=>e.retryChildren(t,n)},claim:!0}:{readme:{status:"ok",readme:F.folderReadmeOf(s.entries)},claim:!0}},pr=(e,t,n)=>{const{readme:r}=en(e,t,n);return r.status==="ok"?r.readme:null},vr=(e,t,n)=>{const r=Y.matchPath({path:`${e.basePath}/*`,end:!0},t.pathname);if(r===null)return new Set;const{location:o}=F.resolveExplorerLocation(e,r.params["*"],new URLSearchParams(t.search));switch(o.view){case"tree":{const s=o.folder===null?o.doc:n(o.source,o.folder);return new Set(s===null?[]:[s])}case"single":return new Set([o.doc]);case"multi":return new Set(o.docs)}},tn=e=>{const{edits:t}=P(),n=a.useCallback(()=>t.session(e),[t,e]);return a.useSyncExternalStore(t.subscribe,n,wr)},nn=()=>!1,wr=()=>{},gr=()=>{const{edits:e}=P();return a.useSyncExternalStore(e.subscribe,e.hasSessions,nn)},rn=()=>{const{edits:e}=P();return a.useSyncExternalStore(e.subscribe,e.sideBySide,nn)},Er=()=>null,xr=()=>{const{edits:e,labels:t,config:n,trees:r}=P(),o=a.useRef([]),s=a.useCallback(({nextLocation:b})=>{const R=vr(n,b,(O,T)=>pr(r,O,T));return e.flushDrafts(),o.current=e.dirtyPaths().filter(O=>!R.has(O)),o.current.length>0},[e,n,r]),i=Y.useBlocker(s),f=gr();a.useEffect(()=>{if(!f)return;const b=R=>{e.flushDrafts(),e.dirtyPaths().length!==0&&(R.preventDefault(),R.returnValue=!0)};return window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[f,e]);const h=a.useSyncExternalStore(e.subscribe,e.discardRequest,Er),m=i.state==="blocked",u=m?o.current:h===null?[]:h.paths,p=u.map(b=>D.lastPathSegment(b)).join(", "),w=u.length>0&&u.every(b=>e.session(b)?.save.kind==="draft");return l.jsx(Yt,{open:m||h!==null,title:w?t.draftDiscardTitle:t.unsavedTitle,body:w?t.draftDiscardBody(p):t.unsavedBody(p),confirmLabel:t.unsavedDiscard,cancelLabel:t.unsavedStay,testId:"markdown-explorer-unsaved-guard",onConfirm:()=>{if(i.state==="blocked"){e.discard(o.current),i.proceed();return}h?.settle(!0)},onCancel:()=>{if(i.state==="blocked"){i.reset();return}h?.settle(!1)}})};function br({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm2.25 8.5a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Zm0 3a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",clipRule:"evenodd"}))}const Sr=y.forwardRef(br);let _e=null;const on=()=>(_e??=Promise.resolve().then(()=>require("./EditSurface-BesNcSQj.cjs")).catch(e=>{throw _e=null,e}),_e),yr=()=>{on().catch(()=>{})},kr=e=>{const{default:t}=a.use(on());return l.jsx(t,{...e})};class Rr extends a.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}retry=()=>this.setState({failed:!1});render(){return this.state.failed?this.props.fallback(this.retry):this.props.children}}const Qe=`[${Be.SOURCE_LINES_ATTRIBUTE}]`,Tr="[data-aqmd-content]",Or='a[href], button, input, select, textarea, summary, label, [contenteditable], [role="menu"], iframe, video, audio, object, embed, svg, [data-aqmd-spreadsheet-editable], [data-aqmd-spreadsheet-fullscreen]',Lr=200,we=e=>Be.parseSourceLines(e.getAttribute(Be.SOURCE_LINES_ATTRIBUTE)),Cr=(e,t)=>{for(let r=e;r!==null&&t.contains(r);r=r.parentElement){const o=we(r);if(o!==null)return{block:r,lines:o,own:!0}}let n=null;for(const r of t.querySelectorAll(Qe)){if(!(r.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING))break;const o=we(r);o!==null&&(n={block:r,lines:o})}return n===null?null:{...n,own:!1}},Ar=(e,t)=>{let n=0;for(let r=e.indexOf(t);r>=0;r=e.indexOf(t,r+t.length))n+=1;return n},sn=e=>e.closest(Tr)!==null&&e.closest(Or)===null,ln=(e,t,n)=>{const r=Cr(e,t);if(r===null)return null;const{block:o,own:s}=r;if(!s){const f=r.lines.last+1;return{lines:{first:f,last:f},word:null,occurrence:0,clientTop:ye(e)}}const i=Mr(o,n);return i===null?{lines:r.lines,word:null,occurrence:0,clientTop:ye(o)}:{lines:r.lines,word:i.text,occurrence:i.occurrence,clientTop:i.clientTop}},an=(e,t)=>{let n=null,r=null,o=null;for(const i of e.querySelectorAll(Qe)){const f=we(i);if(f===null)continue;n??=dn(t,i);const{top:h,bottom:m}=i.getBoundingClientRect();h<=n&&n<m?r={lines:f,block:i}:o===null&&h>=n&&(o={lines:f,block:i})}const s=r===null?o:r;return s===null?null:{lines:s.lines,word:null,occurrence:0,clientTop:ye(s.block)}},cn=e=>e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,dn=(e,t)=>{const n=Number.parseFloat(getComputedStyle(t).scrollMarginTop);return cn(e)+(Number.isFinite(n)?n:0)},Mr=(e,t)=>{if(t===null||t.rangeCount===0)return null;const n=t.getRangeAt(0);if(!(e.contains(n.startContainer)&&e.contains(n.endContainer)))return null;const r=n.toString().trim();if(r===""||r.length>Lr||/[\r\n]/u.test(r))return null;const o=e.ownerDocument.createRange();return o.setStart(e,0),o.setEnd(n.startContainer,n.startOffset),{text:r,occurrence:Ar(o.toString(),r),clientTop:n.getBoundingClientRect().top}},jr=(e,t)=>{const n=e.split(`
|
|
11
|
+
`),r=Math.min(t.lines.first,n.length),o=Math.min(t.lines.last,n.length),s={line:r,column:0};if(t.word===null)return s;let i=0;for(let f=r;f<=o;f+=1){const h=n[f-1]??"";for(let m=h.indexOf(t.word);m>=0;m=h.indexOf(t.word,m+t.word.length)){if(i===t.occurrence)return{line:f,column:m};i+=1}}return i>0?Nr(n,r,o,t.word)??s:s},Nr=(e,t,n,r)=>{for(let o=n;o>=t;o-=1){const s=(e[o-1]??"").lastIndexOf(r);if(s>=0)return{line:o,column:s}}return null},un=(e,t)=>{let n=null,r=null;for(const o of e.querySelectorAll(Qe)){const s=we(o);s===null||s.first>t||(s.last>=t?n=o:(r===null||s.last>=r.last)&&(r={element:o,last:s.last}))}return n!==null?n:r===null?null:r.element},fn=(e,t)=>{const{bottom:n}=e.getBoundingClientRect(),r=ye(e),o=we(e);if(o===null)return r;const s=Math.min(Math.max(t-o.first,0)/(o.last-o.first+1),1);return r+(n-r)*s},ye=e=>{const t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let n=t.nextNode();n!==null;n=t.nextNode()){const o=(n.textContent??"").search(/\S/u);if(o<0)continue;const s=e.ownerDocument.createRange();s.setStart(n,o),s.setEnd(n,o+1);const{top:i,height:f}=s.getBoundingClientRect();if(f>0)return i}return e.getBoundingClientRect().top},Je=Object.freeze({browse:Object.freeze({replace:!0,preventScrollReset:!0,defaultShouldRevalidate:!1}),"switch-source":Object.freeze({replace:!1,preventScrollReset:!0,defaultShouldRevalidate:!1}),"switch-view":Object.freeze({replace:!1,preventScrollReset:!1,defaultShouldRevalidate:!1}),"follow-link":Object.freeze({replace:!1,preventScrollReset:!1,defaultShouldRevalidate:!1})}),Dr=e=>Je[e],ge=()=>{const e=Y.useNavigate();return a.useCallback((t,n)=>{e(t,Je[n])},[e])},mn=({navigation:e,...t})=>l.jsx(Y.Link,{...t,...Je[e]}),et=e=>{const t=e.ownerDocument;if(e.focus({preventScroll:!0}),t.activeElement===e)return!0;if(e.hasAttribute("tabindex"))return!1;if(e.setAttribute("tabindex","-1"),e.focus({preventScroll:!0}),t.activeElement!==e)return e.removeAttribute("tabindex"),!1;const n=()=>{t.activeElement!==e&&(e.removeAttribute("tabindex"),e.removeEventListener("blur",n))};return e.addEventListener("blur",n),!0},hn=(e,t)=>{const n=a.useRef(null),r=a.useRef(null),o=a.useRef(null),s=a.useCallback(()=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,r.current=null},[]);a.useEffect(()=>s,[s]);const i=a.useCallback(m=>{if(r.current!==m)return;const u=o.current;if(u!==null){u.then(()=>i(m));return}e.prefetch(m);const p=e.peek(m);if(p?.status!=="pending")return;const w=Promise.allSettled([p.promise]);o.current=w,w.then(()=>{o.current===w&&(o.current=null)})},[e]),f=a.useCallback(m=>{const u=t(m);u!==r.current&&(s(),u!==null&&(r.current=u,n.current=window.setTimeout(()=>{n.current=null,i(u)},F.PREFETCH_DWELL_MS)))},[s,t,i]),h=a.useCallback(m=>{t(m)!==r.current&&s()},[s,t]);return a.useMemo(()=>({onPointerOver:m=>f(m.target),onPointerOut:m=>h(m.relatedTarget),onFocus:m=>f(m.target),onBlur:m=>h(m.relatedTarget)}),[f,h])},Pr=a.lazy(()=>Promise.resolve().then(()=>require("./NativeScrollBar-DJKlPWvD.cjs")).then(e=>({default:e.NativeScrollBar})));class _r extends a.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t){console.error("[markdown-explorer] a scroll bar failed to load or render; its scroller keeps its native scrolling without it.",t)}render(){return this.state.failed?null:this.props.children}}const pn=({scroller:e,withCircle:t})=>l.jsx(_r,{children:l.jsx(a.Suspense,{fallback:null,children:l.jsx(Pr,{scroller:e,withCircle:t})})}),vn=e=>l.jsx(pn,{scroller:e,withCircle:!0}),wn=()=>{const e=new Map,t=new Set;let n=!1;const r=o=>{t.add(o),!n&&(n=!0,queueMicrotask(()=>{n=!1,t.clear()}))};return{hold:o=>{e.set(o,(e.get(o)??0)+1);let s=!1;return()=>{if(s)return;s=!0;const i=e.get(o);if(i!==void 0&&i>1){e.set(o,i-1);return}e.delete(o),r(o)}},isHeld:o=>e.has(o),resumes:o=>t.delete(o),heldKeys:()=>[...e.keys()]}},ke=(e,t)=>{if(Object.is(e,t))return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;if(Array.isArray(e)||Array.isArray(t))return!(Array.isArray(e)&&Array.isArray(t))||e.length!==t.length?!1:e.every((s,i)=>ke(s,t[i]));const n=e,r=t,o=Object.keys(n);return o.length!==Object.keys(r).length?!1:o.every(s=>Object.hasOwn(r,s)&&ke(n[s],r[s]))},$r=55e3,mt=Object.freeze({status:"deferred"}),ht=Object.freeze({status:"refreshed"}),$e=Object.freeze({status:"superseded"}),re=e=>e===void 0||e.status==="deferred"?null:e.status==="loaded"?e:e.previous,gn=e=>e!==void 0&&e.status==="loaded"&&e.document.kind!=="failure",Fr=({client:e,capacity:t})=>{if(!Number.isInteger(t)||t<1)throw new RangeError(`[markdown-explorer] the document cache capacity must be a positive integer; got ${String(t)}`);const n=new Map,r=wn(),o=ce(),s=new WeakSet;let i=0;const f=o.emit,h=()=>(i+=1,i),m=()=>{if(!(n.size<=t))for(const x of[...n.keys()]){if(n.size<=t)return;r.isHeld(x)||n.delete(x)}},u=(x,E)=>{n.delete(x),n.set(x,E)},p=x=>performance.now()-x.validatedAt>=$r,w=(x,E,c)=>{const d=n.get(x),g=re(d?.snapshot),L=c||d?.refreshPending===!0,A=ve(e.document(x,{refresh:L}).then($=>({status:"loaded",document:$}))),N={snapshot:{status:"pending",promise:A,previous:g},validatedAt:performance.now(),opened:E,background:null,refreshPending:!1,seeded:void 0,stamp:h()};return u(x,N),m(),A.then($=>{n.get(x)===N&&(N.snapshot=$,N.stamp=h(),f())}),N},b=(x,E,c,d,g,L)=>{E.background===c&&(E.background=null,!(n.get(x)!==E||E.snapshot!==d)&&(g.kind==="failure"&&d.document.kind!=="failure"||(E.validatedAt=L,E.stamp=h(),ke(d.document,g)||(E.snapshot={status:"loaded",document:g}),f())))},R=async(x,E)=>{const c=E.snapshot;if(c.status!=="loaded")return null;const d={};E.background=d;const g=performance.now(),L=e.document(x,{refresh:E.refreshPending});E.refreshPending=!1;const A=await L,N=E.background===d&&n.get(x)===E&&E.snapshot===c;return b(x,E,d,c,A,g),N?A:null},O=(x,E)=>{const{snapshot:c}=E;return c.status==="pending"?!1:c.status==="loaded"&&c.document.kind!=="failure"?(R(x,E),!1):(c.status==="loaded"&&s.add(c),w(x,!0,!1),!0)},T=x=>{const E=r.hold(x);let c=!1;return()=>{if(c)return;c=!0,E();const d=n.get(x);d!==void 0&&u(x,d),m()}};return{peek:x=>n.get(x)?.snapshot,peekSeeded:x=>n.get(x)?.seeded,answerStampOf:x=>n.get(x)?.stamp,prefetch:x=>{const E=n.get(x);E!==void 0&&E.snapshot.status!=="deferred"||(w(x,!1,!1),f())},open:x=>{const E=r.resumes(x),c=T(x),d=n.get(x);if(d===void 0||d.snapshot.status==="deferred")return w(x,!0,!1),f(),c;if(u(x,d),E)return c;const{snapshot:g}=d;return g.status==="pending"?(d.opened=!0,c):g.document.kind==="failure"?(d.opened||p(d)?(s.add(g),w(x,!0,!1),f()):d.opened=!0,c):(d.opened=!0,d.background===null&&p(d)&&R(x,d),c)},retain:T,retry:x=>{const E=n.get(x);E===void 0||E.snapshot.status!=="loaded"||E.snapshot.document.kind!=="failure"||(w(x,!0,!1),f())},seed:(x,E)=>{const c=performance.now(),d=ve(E.then($=>$===null?mt:{status:"loaded",document:$},()=>mt)),g=n.get(x);if(g!==void 0&&g.snapshot.status==="loaded"){const $=g.snapshot,z={};g.background=z,d.then(V=>{if(V.status==="loaded"){b(x,g,z,$,V.document,c);return}g.background===z&&(g.background=null)});return}const L=g!==void 0&&g.snapshot.status==="pending"?g.snapshot.previous:null,A={status:"pending",promise:d,previous:L},N={snapshot:A,validatedAt:c,opened:g?.opened===!0,background:null,refreshPending:g?.refreshPending===!0,seeded:A,stamp:h()};u(x,N),m(),d.then($=>{n.get(x)===N&&($.status==="deferred"&&r.isHeld(x)?w(x,N.opened,!1):(N.snapshot=$,N.stamp=h()),f())})},invalidate:()=>{let x=!1;for(const[E,c]of[...n]){if(c.validatedAt=Number.NEGATIVE_INFINITY,c.opened=!0,c.refreshPending=!0,!r.isHeld(E))continue;const{snapshot:d}=c;if(d.status!=="pending"){O(E,c)&&(x=!0);continue}d.promise.then(()=>{n.get(E)===c&&c.refreshPending&&r.isHeld(E)&&O(E,c)&&f()})}x&&f()},refresh:async x=>{const E=n.get(x);if(E!==void 0&&gn(E.snapshot)){E.refreshPending=!0;const d=await R(x,E);return d===null?$e:d.kind==="failure"?{status:"failed",failure:d.failure}:ht}const c=w(x,!0,!0);return f(),c.snapshot.status!=="pending"?$e:(await c.snapshot.promise,n.get(x)===c?ht:$e)},clear:()=>{n.clear();for(const x of r.heldKeys())w(x,!0,!1);f()},subscribe:o.subscribe,noteFailureShown:x=>s.has(x)?!1:(s.add(x),!0)}};function qr({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M18 5.25a2.25 2.25 0 0 0-2.012-2.238A2.25 2.25 0 0 0 13.75 1h-1.5a2.25 2.25 0 0 0-2.238 2.012c-.875.092-1.6.686-1.884 1.488H11A2.5 2.5 0 0 1 13.5 7v7h2.25A2.25 2.25 0 0 0 18 11.75v-6.5ZM12.25 2.5a.75.75 0 0 0-.75.75v.25h3v-.25a.75.75 0 0 0-.75-.75h-1.5Z",clipRule:"evenodd"}),y.createElement("path",{fillRule:"evenodd",d:"M3 6a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H3Zm6.874 4.166a.75.75 0 1 0-1.248-.832l-2.493 3.739-.853-.853a.75.75 0 0 0-1.06 1.06l1.5 1.5a.75.75 0 0 0 1.154-.114l3-4.5Z",clipRule:"evenodd"}))}const Ir=y.forwardRef(qr);function Br({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M15.988 3.012A2.25 2.25 0 0 1 18 5.25v6.5A2.25 2.25 0 0 1 15.75 14H13.5v-3.379a3 3 0 0 0-.879-2.121l-3.12-3.121a3 3 0 0 0-1.402-.791 2.252 2.252 0 0 1 1.913-1.576A2.25 2.25 0 0 1 12.25 1h1.5a2.25 2.25 0 0 1 2.238 2.012ZM11.5 3.25a.75.75 0 0 1 .75-.75h1.5a.75.75 0 0 1 .75.75v.25h-3v-.25Z",clipRule:"evenodd"}),y.createElement("path",{d:"M3.5 6A1.5 1.5 0 0 0 2 7.5v9A1.5 1.5 0 0 0 3.5 18h7a1.5 1.5 0 0 0 1.5-1.5v-5.879a1.5 1.5 0 0 0-.44-1.06L8.44 6.439A1.5 1.5 0 0 0 7.378 6H3.5Z"}))}const Hr=y.forwardRef(Br);function Ur({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",clipRule:"evenodd"}))}const Vr=y.forwardRef(Ur),zr=2e3,pt=Object.freeze({outcome:"idle"}),Zr=e=>{const t=navigator.clipboard;return t===void 0?Promise.reject(new Error("[markdown-explorer] this browser has no asynchronous clipboard")):t.writeText(e)},Gr=({text:e})=>{const{announcer:t,labels:n}=P(),[r,o]=a.useState(pt);a.useEffect(()=>{if(r.outcome==="idle")return;const h=setTimeout(()=>o(pt),zr);return()=>clearTimeout(h)},[r]);const s=h=>{o({outcome:h}),t.announce(h==="copied"?n.copiedText:n.copyTextFailed)},i=()=>{Zr(e).then(()=>s("copied"),()=>s("failed"))},f=r.outcome==="copied"?n.copiedText:r.outcome==="failed"?n.copyTextFailed:n.copyText;return l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":n.copyText,title:f,onClick:i,"data-aqmx-copy-outcome":r.outcome,"data-testid":"markdown-explorer-file-copy",children:r.outcome==="copied"?l.jsx(Ir,{}):r.outcome==="failed"?l.jsx(Vr,{}):l.jsx(Hr,{})})},ae=a.createContext("fill"),Kr=Object.freeze({blockSize:"100%"}),de=({scrollerProps:e,children:t})=>a.use(ae)==="content"?l.jsx(he.HostedScrollArea,{scrollerProps:e,children:t}):l.jsx(he.HostedScrollArea,{scrollerProps:{...e,style:Kr},rowClassName:"aqmx-document-scroll-row",renderScrollBar:vn,children:t});function Wr({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M10.75 2.75a.75.75 0 0 0-1.5 0v8.614L6.295 8.235a.75.75 0 1 0-1.09 1.03l4.25 4.5a.75.75 0 0 0 1.09 0l4.25-4.5a.75.75 0 0 0-1.09-1.03l-2.955 3.129V2.75Z"}),y.createElement("path",{d:"M3.5 12.75a.75.75 0 0 0-1.5 0v2.5A2.75 2.75 0 0 0 4.75 18h10.5A2.75 2.75 0 0 0 18 15.25v-2.5a.75.75 0 0 0-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5Z"}))}const Xr=y.forwardRef(Wr);function Yr({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M4.25 5.5a.75.75 0 0 0-.75.75v8.5c0 .414.336.75.75.75h8.5a.75.75 0 0 0 .75-.75v-4a.75.75 0 0 1 1.5 0v4A2.25 2.25 0 0 1 12.75 17h-8.5A2.25 2.25 0 0 1 2 14.75v-8.5A2.25 2.25 0 0 1 4.25 4h5a.75.75 0 0 1 0 1.5h-5Z",clipRule:"evenodd"}),y.createElement("path",{fillRule:"evenodd",d:"M6.194 12.753a.75.75 0 0 0 1.06.053L16.5 4.44v2.81a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.553l-9.056 8.194a.75.75 0 0 0-.053 1.06Z",clipRule:"evenodd"}))}const Qr=y.forwardRef(Yr),Oe=({name:e,openUrl:t,downloadUrl:n,icon:r,children:o})=>{const{labels:s}=P();return l.jsxs("div",{className:"aqmx-document-toolbar",children:[l.jsx("span",{className:"aqmx-document-file-icon","aria-hidden":"true",children:r}),l.jsx("span",{className:"aqmx-document-title",title:e,"data-testid":"markdown-explorer-file-name",children:e}),o,l.jsx("a",{className:"aqmx-icon-button",href:t,target:"_blank",rel:"noopener noreferrer","aria-label":s.openInNewTab,title:s.openInNewTab,"data-testid":"markdown-explorer-file-open",children:l.jsx(Qr,{})}),l.jsx("a",{className:"aqmx-icon-button",href:n,download:e,"aria-label":s.download,title:s.download,"data-testid":"markdown-explorer-file-download",children:l.jsx(Xr,{})})]})};function Jr({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M4.5 2A1.5 1.5 0 0 0 3 3.5v13A1.5 1.5 0 0 0 4.5 18h11a1.5 1.5 0 0 0 1.5-1.5V7.621a1.5 1.5 0 0 0-.44-1.06l-4.12-4.122A1.5 1.5 0 0 0 11.378 2H4.5Zm4.75 6.75a.75.75 0 0 1 1.5 0v2.546l.943-1.048a.75.75 0 0 1 1.114 1.004l-2.25 2.5a.75.75 0 0 1-1.114 0l-2.25-2.5a.75.75 0 1 1 1.114-1.004l.943 1.048V8.75Z",clipRule:"evenodd"}))}const eo=y.forwardRef(Jr),to=Object.freeze({className:"aqmx-document-stage"}),no=({document:e})=>{const{labels:t}=P();return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-file-view",children:[l.jsx(Oe,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:l.jsx(eo,{})}),l.jsx(de,{scrollerProps:to,children:l.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":"markdown-explorer-file-not-shown",children:[l.jsx("p",{className:"aqmx-callout-body",children:t.fileNotShown}),l.jsx("a",{className:"aqmx-callout-action",href:e.url,download:e.name,"data-testid":"markdown-explorer-file-not-shown-download",children:t.download})]})})]})},Le="[data-aqmd-scroll-container], [data-aqmx-document-scroller]",ro=e=>{const t=e.indexOf("#");return t===-1?"":e.slice(t)},oo=/(%[0-9A-Fa-f]{2})/u,tt=e=>{if(!e.startsWith("#")||e.length===1)return null;const t=new TextEncoder,n=e.slice(1).split(oo).flatMap((r,o)=>o%2===1?[Number.parseInt(r.slice(1),16)]:[...t.encode(r)]);return new TextDecoder("utf-8",{ignoreBOM:!0}).decode(Uint8Array.from(n))},En=e=>`#${encodeURIComponent(e)}`,so=e=>{if(e==="#")return!0;const t=tt(e);return t!==null&&t.replace(/[A-Z]/gu,n=>n.toLowerCase())==="top"},xn=(e,t)=>{if(t==="")return null;for(const n of e.querySelectorAll("[id]"))if(n.id===t)return n;return null},io="http://www.w3.org/1999/xhtml",vt=(e,t)=>{if(t==="")return null;const n=xn(e,t);if(n!==null)return n;for(const r of e.querySelectorAll("a[name]"))if(r.localName==="a"&&r.namespaceURI===io&&r.getAttribute("name")===t)return r;return null},bn=(e,t)=>{if(e===null||!t.startsWith("#"))return null;const n=vt(e,t.slice(1));if(n!==null)return n;const r=tt(t);return r===null?null:vt(e,r)},wt=e=>{const{body:t,documentElement:n}=e.ownerDocument;if(e===t){const o=getComputedStyle(n);if(o.overflowX==="visible"&&o.overflowY==="visible")return!1}const{overflowY:r}=getComputedStyle(e);return r==="auto"||r==="scroll"},lo=e=>{const{body:t,documentElement:n}=e,r=getComputedStyle(n),o=r.overflowX==="visible"&&r.overflowY==="visible"&&t!==null?getComputedStyle(t).overflowY:r.overflowY;return o!=="hidden"&&o!=="clip"},ao=(e,t)=>{const n=t.closest(Le),r=n!==null&&e.contains(n)?n:e;if(r.scrollHeight>r.clientHeight&&wt(r))return r;const o=e.getBoundingClientRect().height,{documentElement:s,scrollingElement:i}=e.ownerDocument;for(let f=e.parentElement;f!==null&&f!==s;f=f.parentElement)if(wt(f)&&f.scrollHeight>f.clientHeight&&f.clientHeight<o)return f;return i instanceof Element&&lo(e.ownerDocument)&&i.scrollHeight>i.clientHeight&&i.clientHeight<o?i:r},co=Object.freeze({scrollerOf:ao,reveal:e=>{e.scrollIntoView(ze)}}),ze=Object.freeze({block:"nearest",inline:"nearest",behavior:"instant"}),uo=(e,t)=>{for(let n=t;n!==null&&n!==e;n=n.parentElement){const r=n.parentElement;if(r instanceof HTMLDetailsElement&&n!==r.querySelector(":scope > summary")&&(r.open=!0),n.getAttribute("hidden")?.toLowerCase()==="until-found"){if(n.dispatchEvent(new Event("beforematch",{bubbles:!0})),!n.isConnected)return;n.removeAttribute("hidden")}}},fo=(e,t)=>{if(t.getClientRects().length===0)return;const n=e===e.ownerDocument.scrollingElement?0:e.getBoundingClientRect().top+e.clientTop,{scrollMarginTop:r,scrollMarginBottom:o}=getComputedStyle(t),s=Number.parseFloat(r),i=t.getBoundingClientRect(),f=i.height+s+Number.parseFloat(o)>e.clientHeight;if(!f&&Math.abs(i.top-s-n)<1){t.scrollIntoView(ze);return}e.scrollBy({top:f?i.top-n-e.clientHeight:i.bottom-n+e.clientHeight,behavior:"instant"}),t.scrollIntoView(ze)},mo=(e,t)=>{const n=t.scrollerOf(e,e.querySelector(Le)??e);n.getClientRects().length!==0&&(n.scrollTo({top:0,left:0,behavior:"instant"}),t.reveal(n))},gt=(e,t,n)=>{if(e===null)return null;const r=bn(e,t);return r===null?(so(t)&&mo(e,n),null):(uo(e,r),fo(n.scrollerOf(e,r),r),n.reveal(r),r)};function ho({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M3.28 2.22a.75.75 0 0 0-1.06 1.06L5.44 6.5H2.75a.75.75 0 0 0 0 1.5h4.5A.75.75 0 0 0 8 7.25v-4.5a.75.75 0 0 0-1.5 0v2.69L3.28 2.22ZM13.5 2.75a.75.75 0 0 0-1.5 0v4.5c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-2.69l3.22-3.22a.75.75 0 0 0-1.06-1.06L13.5 5.44V2.75ZM3.28 17.78l3.22-3.22v2.69a.75.75 0 0 0 1.5 0v-4.5a.75.75 0 0 0-.75-.75h-4.5a.75.75 0 0 0 0 1.5h2.69l-3.22 3.22a.75.75 0 1 0 1.06 1.06ZM13.5 14.56l3.22 3.22a.75.75 0 1 0 1.06-1.06l-3.22-3.22h2.69a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0-.75.75v4.5a.75.75 0 0 0 1.5 0v-2.69Z"}))}const po=y.forwardRef(ho);function vo({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M6.75 8.25a.75.75 0 0 0 0 1.5h4.5a.75.75 0 0 0 0-1.5h-4.5Z"}),y.createElement("path",{fillRule:"evenodd",d:"M9 2a7 7 0 1 0 4.391 12.452l3.329 3.328a.75.75 0 1 0 1.06-1.06l-3.328-3.329A7 7 0 0 0 9 2ZM3.5 9a5.5 5.5 0 1 1 11 0 5.5 5.5 0 0 1-11 0Z",clipRule:"evenodd"}))}const wo=y.forwardRef(vo);function go({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M9 6a.75.75 0 0 1 .75.75v1.5h1.5a.75.75 0 0 1 0 1.5h-1.5v1.5a.75.75 0 0 1-1.5 0v-1.5h-1.5a.75.75 0 0 1 0-1.5h1.5v-1.5A.75.75 0 0 1 9 6Z"}),y.createElement("path",{fillRule:"evenodd",d:"M2 9a7 7 0 1 1 12.452 4.391l3.328 3.329a.75.75 0 1 1-1.06 1.06l-3.329-3.328A7 7 0 0 1 2 9Zm7-5.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11Z",clipRule:"evenodd"}))}const Eo=y.forwardRef(go);function xo({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M1 5.25A2.25 2.25 0 0 1 3.25 3h13.5A2.25 2.25 0 0 1 19 5.25v9.5A2.25 2.25 0 0 1 16.75 17H3.25A2.25 2.25 0 0 1 1 14.75v-9.5Zm1.5 5.81v3.69c0 .414.336.75.75.75h13.5a.75.75 0 0 0 .75-.75v-2.69l-2.22-2.219a.75.75 0 0 0-1.06 0l-1.91 1.909.47.47a.75.75 0 1 1-1.06 1.06L6.53 8.091a.75.75 0 0 0-1.06 0l-2.97 2.97ZM12 7a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z",clipRule:"evenodd"}))}const bo=y.forwardRef(xo),Ze="data-aqmx-key-repeat",Re=Object.freeze({[Ze]:"allow"}),So=`[${Ze}="${Re[Ze]}"]`,yo=()=>{let e=null;return{onKeyDownCapture:t=>{if(t.key==="Enter"){if(!t.repeat){e=t.target instanceof Element?t.target:null;return}e!==null&&t.target===e&&e.closest(So)!==null||(t.preventDefault(),t.stopPropagation())}},onKeyUpCapture:t=>{t.key==="Enter"&&(e=null)},onBlurCapture:t=>{t.target===e&&(e=null)}}},be=Object.freeze([1/F.GOLDEN_RATIO**2,1/F.GOLDEN_RATIO,1,F.GOLDEN_RATIO,F.GOLDEN_RATIO**2]),Et=Object.freeze({mode:"fit"}),ko=1,Sn=Object.freeze({className:"aqmx-document-canvas","data-testid":"markdown-explorer-image-canvas"}),xt=`[data-testid="${Sn["data-testid"]}"]`,yn=a.createContext(null),Ro=(e,t)=>e.width>0&&e.height>0&&t.width-e.width<=ko?{base:e,scale:t.width/e.width}:t.width>0&&t.height>0?{base:t,scale:1}:null,bt=(e,t,n)=>{if(e.mode==="level"){const o=e.index+n;return o>=0&&o<be.length?o:null}if(t===null||!Number.isFinite(t)||t<=0)return null;const r=n===1?be.findIndex(o=>o>t):be.findLastIndex(o=>o<t);return r===-1?null:r},St=(e,t,n)=>{if(e.mode==="level"){const o=bt(e,null,n);return o===null?null:{mode:"level",index:o,base:e.base}}if(t===null)return null;const r=bt(e,t.scale,n);return r===null?null:{mode:"level",index:r,base:t.base}},To=(e,t)=>{if(e<=0||t<=0)return 0;const n=Math.trunc(Math.log(t/e)/Math.log(F.GOLDEN_RATIO));return n===0?0:n},yt=e=>{const t=e[0],n=e[1];return e.length!==2||t===void 0||n===void 0?null:{distance:Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY),middle:{x:(t.clientX+n.clientX)/2,y:(t.clientY+n.clientY)/2}}},Oo=e=>{const t=be[e];if(t===void 0)throw new RangeError(`[markdown-explorer] no image zoom step ${String(e)}`);return t},kt=(e,t,n)=>e!==null&&e.width===t&&e.height===n?e:{width:t,height:n},Lo=({document:e})=>{const{labels:t}=P(),n=a.use(yn),[r]=a.useState(()=>n===null?null:n.read(e.url)),[o,s]=a.useState(r===null?Et:r.zoom),[i,f]=a.useState(r===null?null:r.reported),[h,m]=a.useState(null),u=a.useRef(null),p=a.useCallback(E=>{const{naturalWidth:c,naturalHeight:d}=E;f(g=>kt(g,c,d))},[]),w=a.useCallback(E=>{u.current=E,!(E===null||!E.complete)&&(E.naturalWidth>0||E.naturalHeight>0?p(E):E.decode().then(()=>p(E),()=>{}))},[p]);a.useEffect(()=>{n!==null&&i!==null&&n.save(e.url,{zoom:o,reported:i})},[n,e.url,o,i]),a.useLayoutEffect(()=>{const E=u.current;if(E===null||i===null||o.mode!=="fit")return;const c=()=>m(g=>kt(g,E.clientWidth,E.clientHeight));if(c(),typeof ResizeObserver>"u")return;const d=new ResizeObserver(c);return d.observe(E),()=>d.disconnect()},[i,o.mode]);const b=i===null||h===null?null:Ro(i,h),R=St(o,b,-1),O=St(o,b,1),T=o.mode==="level"?Oo(o.index):null,M=a.useRef({zoomIn:O,zoomOut:R});a.useLayoutEffect(()=>{M.current={zoomIn:O,zoomOut:R}});const j=a.useRef(null);a.useLayoutEffect(()=>{const E=j.current,c=u.current?.closest(xt);j.current=null,!(E===null||c===null||c===void 0)&&(c.scrollLeft=E.across*c.scrollWidth-E.x,c.scrollTop=E.down*c.scrollHeight-E.y)},[o]),a.useEffect(()=>{const E=u.current?.closest(xt);if(E==null)return;let c=null;const d=A=>{const N=yt(A.touches);c=N===null?null:{distance:N.distance,steps:0}},g=A=>{const N=yt(A.touches);if(c===null||N===null)return;A.preventDefault();const $=To(c.distance,N.distance);if($===c.steps)return;const z=$>c.steps?1:-1,V=z===1?M.current.zoomIn:M.current.zoomOut;if(V===null)return;c.steps+=z;const q=E.getBoundingClientRect(),K=N.middle.x-q.left,B=N.middle.y-q.top;j.current=E.scrollWidth>0&&E.scrollHeight>0?{x:K,y:B,across:(E.scrollLeft+K)/E.scrollWidth,down:(E.scrollTop+B)/E.scrollHeight}:null,s(V)},L=A=>{A.touches.length<2&&(c=null)};return E.addEventListener("touchstart",d,{passive:!0}),E.addEventListener("touchmove",g,{passive:!1}),E.addEventListener("touchend",L,{passive:!0}),E.addEventListener("touchcancel",L,{passive:!0}),()=>{E.removeEventListener("touchstart",d),E.removeEventListener("touchmove",g),E.removeEventListener("touchend",L),E.removeEventListener("touchcancel",L)}},[]);const x=o.mode==="level"&&T!==null?{width:`${o.base.width*T}px`,height:`${o.base.height*T}px`}:void 0;return l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-image-view",children:[l.jsxs(Oe,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:l.jsx(bo,{}),children:[l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomOut,title:t.imageZoomOut,"aria-disabled":R===null,onClick:()=>{R!==null&&s(R)},...Re,children:l.jsx(wo,{})}),l.jsx("output",{className:"aqmx-document-level","aria-live":"polite","data-testid":"markdown-explorer-image-level",children:T===null?t.imageFitLevel:t.imageZoomLevel(Math.round(T*100))}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageZoomIn,title:t.imageZoomIn,"aria-disabled":O===null,onClick:()=>{O!==null&&s(O)},...Re,children:l.jsx(Eo,{})}),l.jsx("button",{type:"button",className:"aqmx-icon-button","aria-label":t.imageFit,title:t.imageFit,"aria-pressed":o.mode==="fit",onClick:()=>s(Et),children:l.jsx(po,{})})]}),l.jsx(de,{scrollerProps:Sn,children:l.jsx("img",{ref:w,className:"aqmx-document-image",src:e.url,alt:e.name,"data-aqmx-image-mode":o.mode,style:x,onLoad:E=>p(E.currentTarget),"data-testid":"markdown-explorer-image"})})]})},kn=a.createContext(null),Ce=a.createContext(void 0),Rn=a.createContext(null),Ae=()=>{const e=a.use(kn);if(e===null)throw new Error("[markdown-explorer] document links must be rendered inside a document pane");return e},Co=()=>{const e=a.use(Rn);if(e===null)throw new Error("[markdown-explorer] table-of-contents entries must be rendered inside a document pane's links");return e},Me=(e,t,n,r)=>t.kind==="panel"?F.explorerHref(e,{view:"tree",source:n,doc:r}):t.view==="single"?F.explorerHref(e,{view:"single",source:n,doc:r,overrides:t.overrides,embed:t.embed}):F.explorerHref(e,{view:"tree",source:n,doc:r,overrides:t.overrides}),Ao=({children:e})=>{const{config:t}=P(),n=Ae(),r=Te(),o=r.kind==="location"?r.location.source:void 0,s=Y.useHref(Me(t,n.navigation,o,n.currentPath));return l.jsx(Ce,{value:o,children:l.jsx(Rn,{value:s,children:e})})},Mo='a[data-link-kind="doc"][data-doc-path]:not([data-doc-exists="false"])',jo=e=>{const t=e instanceof Element?e.closest(Mo):null;return t===null?null:t.getAttribute("data-doc-path")},je=e=>!e.defaultPrevented&&e.button===0&&!e.metaKey&&!e.ctrlKey&&!e.shiftKey&&!e.altKey,No=({to:e,docPath:t,fragment:n,exists:r,className:o,attributes:s,onDocumentLink:i,scope:f,children:h})=>{const m=Y.useHref(e),u=p=>{if(je(p)){if(p.preventDefault(),t===f.currentPath&&n!==""){f.scrollWithin(n);return}i(t,n)}};return l.jsx("a",{...s,href:m,className:o,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":r,onClick:u,children:h})},Do=({href:e,docPath:t,docExists:n,className:r,attributes:o,children:s})=>{const{config:i}=P(),f=Ae(),h=a.use(Ce),m=ro(e),{navigation:u}=f,p=`${Me(i,u,h,t)}${m}`,w=n===!1?"false":void 0;return u.kind==="page"?l.jsx(mn,{...o,to:p,navigation:"follow-link",className:r,"data-link-kind":"doc","data-doc-path":t,"data-doc-exists":w,children:s}):l.jsx(No,{to:p,docPath:t,fragment:m,exists:w,className:r,attributes:o,onDocumentLink:u.onDocumentLink,scope:f,children:s})},Po=({className:e,attributes:t,children:n})=>{const{labels:r}=P();return l.jsxs("a",{...t,className:e===void 0?"aqmx-document-inert-link":`${e} aqmx-document-inert-link`,title:r.inertLink,"data-link-kind":"doc","data-doc-exists":"false",children:[n,l.jsxs("span",{className:"aqmx-sr-only",children:[" (",r.inertLink,")"]})]})},_o=({href:e,className:t,attributes:n,scope:r,children:o})=>{const{config:s}=P(),i=a.use(Ce),f=Y.useHref(`${Me(s,r.navigation,i,r.currentPath)}${e}`),h=m=>{je(m)&&(m.preventDefault(),r.scrollWithin(e))};return l.jsx("a",{...n,href:f,className:t,onClick:h,children:o})},$o=({href:e,className:t,attributes:n,children:r})=>{const o=Ae();if(o.navigation.kind==="page"){const s=i=>{if(!je(i))return;const f=i.currentTarget;e==="#"?o.followEmptyFragment(i.nativeEvent):f.href===f.ownerDocument.URL&&o.followSameUrlJump(e,i.nativeEvent)};return l.jsx("a",{...n,href:e,className:t,onClick:s,children:r})}return l.jsx(_o,{href:e,className:t,attributes:n,scope:o,children:r})},Fo=({href:e,kind:t,docPath:n,docExists:r,className:o,attributes:s,children:i})=>t==="doc"?n===void 0||!D.isAcceptableDocumentPath(n)?l.jsx(Po,{className:o,attributes:s,children:i}):l.jsx(Do,{href:e,docPath:n,docExists:r,className:o,attributes:s,children:i}):e.startsWith("#")?l.jsx($o,{href:e,className:o,attributes:s,children:i}):l.jsx("a",{...s,href:e,className:o,children:i}),qo=()=>{const{config:e}=P(),t=Ae(),n=a.use(Ce),r=ge();return a.useCallback((o,s)=>{if(!je(s))return!0;s.preventDefault();const i=En(o.id),{navigation:f}=t;return f.kind==="panel"||tt(s.currentTarget.ownerDocument.location.hash)===o.id?(t.scrollWithin(i),!0):(r(`${Me(e,f,n,t.currentPath)}${i}`,"follow-link"),!0)},[e,t,n,r])},Io=()=>{const e=Co();return a.useCallback(t=>`${e}${En(t.id)}`,[e])};function Bo({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M3 3.5A1.5 1.5 0 0 1 4.5 2h6.879a1.5 1.5 0 0 1 1.06.44l4.122 4.12A1.5 1.5 0 0 1 17 7.622V16.5a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 3 16.5v-13Z"}))}const Ho=y.forwardRef(Bo);function Uo({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M1 4.75C1 3.784 1.784 3 2.75 3h14.5c.966 0 1.75.784 1.75 1.75v10.515a1.75 1.75 0 0 1-1.75 1.75h-1.5c-.078 0-.155-.005-.23-.015H4.48c-.075.01-.152.015-.23.015h-1.5A1.75 1.75 0 0 1 1 15.265V4.75Zm16.5 7.385V11.01a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25Zm0 2.005a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .108.069.2.165.235h1.585a.25.25 0 0 0 .25-.25v-1.11Zm-15 1.11v-1.11a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.164.235H2.75a.25.25 0 0 1-.25-.25Zm2-4.24v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V11.01a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25Zm13-2.005V7.88a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25v1.125c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25ZM4.25 7.63a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V7.88a.25.25 0 0 1 .25-.25h1.5Zm0-3.13a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25V4.75a.25.25 0 0 1 .25-.25h1.5Zm11.5 1.625a.25.25 0 0 1-.25-.25V4.75a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.125a.25.25 0 0 1-.25.25h-1.5Zm-9 3.125a.75.75 0 0 0 0 1.5h6.5a.75.75 0 0 0 0-1.5h-6.5Z",clipRule:"evenodd"}))}const Vo=y.forwardRef(Uo);function zo({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M17.721 1.599a.75.75 0 0 1 .279.583v11.29a2.25 2.25 0 0 1-1.774 2.2l-2.041.44a2.216 2.216 0 0 1-.938-4.332l2.662-.577a.75.75 0 0 0 .591-.733V6.112l-8 1.73v7.684a2.25 2.25 0 0 1-1.774 2.2l-2.042.44a2.216 2.216 0 1 1-.935-4.331l2.659-.573A.75.75 0 0 0 7 12.529V4.236a.75.75 0 0 1 .591-.733l9.5-2.054a.75.75 0 0 1 .63.15Z",clipRule:"evenodd"}))}const Zo=y.forwardRef(zo),Go=Object.freeze({className:"aqmx-document-stage"}),Ko=()=>()=>{},Wo=()=>navigator.pdfViewerEnabled!==!1,Xo=()=>null,Yo=({document:e})=>{const{labels:t}=P(),n=a.useSyncExternalStore(Ko,Wo,Xo);return n===null?null:n?l.jsx("iframe",{className:"aqmx-document-frame",src:e.url,title:e.name,"data-testid":"markdown-explorer-media-player"}):l.jsxs("div",{className:"aqmx-callout",role:"note","data-testid":"markdown-explorer-pdf-not-shown",children:[l.jsx("p",{className:"aqmx-callout-body",children:t.pdfNotShown}),l.jsxs("div",{className:"aqmx-callout-actions",children:[l.jsx("a",{className:"aqmx-callout-action",href:e.url,target:"_blank",rel:"noopener noreferrer","data-testid":"markdown-explorer-pdf-not-shown-open",children:t.openInNewTab}),l.jsx("a",{className:"aqmx-callout-action",href:e.url,download:e.name,"data-testid":"markdown-explorer-pdf-not-shown-download",children:t.download})]})]})},Qo=e=>{switch(e){case"video":return l.jsx(Vo,{});case"audio":return l.jsx(Zo,{});case"pdf":return l.jsx(Ho,{});default:{const t=e;throw new RangeError(`[markdown-explorer] unknown media type ${String(t)}`)}}},Jo=({document:e})=>{const{labels:t}=P();switch(e.mediaType){case"video":return l.jsx("video",{className:"aqmx-document-video",src:e.url,controls:!0,preload:"metadata","aria-label":e.name,"data-testid":"markdown-explorer-media-player",children:t.mediaUnsupported});case"audio":return l.jsx("audio",{className:"aqmx-document-audio",src:e.url,controls:!0,preload:"metadata","aria-label":e.name,"data-testid":"markdown-explorer-media-player",children:t.mediaUnsupported});case"pdf":return l.jsx(Yo,{document:e});default:{const n=e.mediaType;throw new RangeError(`[markdown-explorer] unknown media type ${String(n)}`)}}},es=({document:e})=>l.jsxs("div",{className:"aqmx-document-file","data-testid":"markdown-explorer-media-view","data-aqmx-media-type":e.mediaType,children:[l.jsx(Oe,{name:e.name,openUrl:e.url,downloadUrl:e.url,icon:Qo(e.mediaType)}),l.jsx(de,{scrollerProps:Go,children:l.jsx(Jo,{document:e})})]}),ts=(e,t)=>{const n={};for(const r of Object.keys(le.SPREADSHEET_BLOCK_LABEL_CATALOGS[t])){const o=e[We(r)];o!==le.SPREADSHEET_BLOCK_LABEL_CATALOGS[t][r].text&&(n[`spreadsheet${r.charAt(0).toUpperCase()}${r.slice(1)}`]=o)}return n},ns=(e,t)=>({...ts(e,t),loading:e.viewerLoading,errorPrefix:e.viewerErrorPrefix,styleTitle:e.viewerStyleTitle,selectStyleAria:e.viewerSelectStyle,pinStyleAria:e.viewerPinStyle,unpinStyleAria:e.viewerUnpinStyle,defaultErrorTitle:e.viewerErrorTitle,missingImage:e.viewerMissingImage,openTocAria:e.viewerOpenToc,tocTitle:e.viewerTocTitle,pinTocAria:e.viewerPinToc,unpinTocAria:e.viewerUnpinToc,selectAlignAria:e.viewerSelectAlign,alignTitle:e.viewerAlignTitle,pinAlignAria:e.viewerPinAlign,unpinAlignAria:e.viewerUnpinAlign,alignLeft:e.viewerAlignLeft,alignCenter:e.viewerAlignCenter,alignRight:e.viewerAlignRight,mermaidInteractionMode:e.viewerMermaidInteractionMode,mermaidInteractionModeTouch:e.viewerMermaidInteractionModeTouch,mermaidModeNone:e.viewerMermaidModeNone,mermaidModeZoom:e.viewerMermaidModeZoom,mermaidModePan:e.viewerMermaidModePan,mermaidModePanShift:e.viewerMermaidModePanShift,mermaidModeBoth:e.viewerMermaidModeBoth,mermaidModeBothShift:e.viewerMermaidModeBothShift,mermaidModeNoneTouch:e.viewerMermaidModeNoneTouch,mermaidModeZoomTouch:e.viewerMermaidModeZoomTouch,mermaidModePanTouch:e.viewerMermaidModePanTouch,mermaidModeBothTouch:e.viewerMermaidModeBothTouch,mermaidZoomIn:e.viewerMermaidZoomIn,mermaidZoomOut:e.viewerMermaidZoomOut,mermaidResetView:e.viewerMermaidResetView,mermaidPanUp:e.viewerMermaidPanUp,mermaidPanDown:e.viewerMermaidPanDown,mermaidPanLeft:e.viewerMermaidPanLeft,mermaidPanRight:e.viewerMermaidPanRight,mermaidDiagram:e.viewerMermaidDiagram,mermaidRetry:e.viewerMermaidRetry,embeddedVideo:e.viewerEmbeddedVideo,embeddedPost:e.viewerEmbeddedPost,embeddedFrame:e.viewerEmbeddedFrame}),Tn=(e,t,n)=>{if(t!==void 0)return t;if(n!==void 0)return n;const[r]=e.documentStyles;if(r===void 0)throw new Error("[markdown-explorer] the configuration has no document style");return r.name},On=(e,t)=>e!==void 0?e:t!==void 0?t:zn.DEFAULT_CONTENT_ALIGN,Ln=Object.freeze({kind:"empty"}),nt=Object.freeze(["l1","l2","l3","l4","l5","l6","l7","l8"]),rs=(e,t,n)=>{if(t.view==="multi"||t.overrides[n]===void 0)return null;const r=n==="style"?{align:t.overrides.align}:{style:t.overrides.style};return F.explorerHref(e,{...t,overrides:r})},me=({kind:e,view:t,label:n,stale:r,busy:o,frameRef:s,intent:i,children:f})=>{const h=a.use(ae);return l.jsxs("section",{ref:s,role:"region","aria-label":n,"aria-busy":o,"data-testid":"markdown-explorer-document","data-aqmx-document-kind":e,"data-aqmx-document-view":t,"data-aqmx-document-flow":h,className:"aqmx-document",...i,children:[r?l.jsx("div",{className:"aqmx-progress","aria-hidden":"true","data-testid":"markdown-explorer-document-progress"}):null,f]})},os=({absence:e,announces:t,announceFailure:n})=>{const{labels:r,announcer:o}=P(),s=e.kind==="no-readme"?e.folder:null,i=e.kind==="failure"?e.folder:null,f=e.kind==="failure"?e.failure:null;switch(a.useEffect(()=>{t&&s!==null&&o.announce(r.folderReadmeMissing(D.lastPathSegment(s)))},[t,s,o,r]),a.useEffect(()=>{i!==null&&f!==null&&n(r.documentFailed(D.lastPathSegment(i),ee(r,f.reason)))},[i,f,n,r]),e.kind){case"empty":return l.jsx(me,{kind:"empty",label:r.documentRegion,stale:!1,busy:!1,children:l.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-document-empty",children:l.jsx("p",{className:"aqmx-empty-title",children:r.documentEmpty})})});case"loading":return l.jsx(rt,{label:r.documentRegion});case"no-readme":return l.jsx(me,{kind:"empty",label:r.documentRegion,stale:!1,busy:!1,children:l.jsx("div",{className:"aqmx-empty","data-testid":"markdown-explorer-folder-empty",children:l.jsx("p",{className:"aqmx-empty-title",children:r.folderReadmeMissing(D.lastPathSegment(e.folder))})})});case"failure":return l.jsx(me,{kind:"failure",label:r.documentRegion,stale:!1,busy:!1,children:l.jsx(de,{scrollerProps:ot,children:l.jsx(se,{failure:e.failure,alert:!1,onRetry:e.onRetry,testId:"markdown-explorer-folder-failure"})})})}},rt=({label:e})=>{const{labels:t}=P();return l.jsxs(me,{kind:"loading",label:e,stale:!1,busy:!0,children:[l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-document-skeleton",children:nt.map(n=>l.jsx("span",{},n))}),l.jsx("p",{className:"aqmx-sr-only",children:t.documentLoading})]})},Rt=Object.freeze(["wheel","touchstart","pointerdown","keydown"]),ss=({path:e,document:t,viewer:n,editing:r})=>{const{reportMathDiagnostics:o,edits:s}=P(),i=a.useMemo(()=>({htmlContent:t.htmlContent,headings:[...t.headings]}),[t]),f=qo(),h=Io(),m=a.useMemo(()=>o===void 0?void 0:c=>o(e,c),[o,e]),u=a.useRef(null),{editable:p,doubleClick:w,region:b,paneScroll:R,stale:O}=r;a.useLayoutEffect(()=>{if(p)return s.bindView(e,{anchor:()=>{const c=u.current,d=b(),g=c===null?null:c.querySelector(Le);return c===null||d===null||g===null?null:an(c,R.scrollerOf(d,g))}})},[s,e,p,b,R]);const T=c=>{const d=u.current,{target:g}=c;!w||d===null||!(g instanceof Element)||!sn(g)||(c.stopPropagation(),s.start(e,ln(g,d,d.ownerDocument.getSelection())))},M=a.useRef(null),j=a.useRef(O);a.useLayoutEffect(()=>{j.current=O});const x=a.useEffectEvent(c=>{const d=u.current,g=b(),L=d===null?null:un(d,c.line);if(g===null||L===null)return!1;const A=R.scrollerOf(g,L);return A.scrollTop+=fn(L,c.line)-c.clientTop,!0}),E=a.useEffectEvent(c=>{const d=b();if(d===null)return;const g=()=>{for(const A of Rt)d.removeEventListener(A,L,!0);M.current?.release===g&&(M.current=null)},L=()=>g();for(const A of Rt)d.addEventListener(A,L,{capture:!0,passive:!0});M.current={point:c,release:g}});return a.useLayoutEffect(()=>{const c=s.takeReturn(e);if(c!==null)return queueMicrotask(()=>{x(c)&&j.current&&E(c)}),()=>M.current?.release()},[s,e]),a.useLayoutEffect(()=>{const c=M.current;c===null||O||(c.release(),x(c.point))},[t,O]),l.jsx("div",{ref:u,className:"aqmx-document-viewer",onDoubleClick:T,children:l.jsx(he.MarkdownViewer,{...n,onHeadingSelect:f,headingHref:h,onMathDiagnostics:m,parseResult:i,content:null})})},Cn=({document:e,viewer:t})=>{const{labels:n}=P();return l.jsxs(l.Fragment,{children:[l.jsx(Oe,{name:e.name,openUrl:D.explorerPlainTextHref(e.url),downloadUrl:e.url,icon:l.jsx(Sr,{}),children:e.truncated?null:l.jsx(Gr,{text:e.text})}),e.truncated?l.jsx("p",{className:"aqmx-callout aqmx-document-notice",role:"note","data-testid":"markdown-explorer-text-truncated",children:n.textTruncated}):null,l.jsx("div",{className:"aqmx-document-viewer",children:l.jsx(he.MarkdownViewer,{...t,parseResult:null,content:e.text})})]})},is=({path:e,name:t,viewer:n})=>{const{data:r,documents:o,announcer:s,labels:i}=P(),f=a.useCallback(()=>o.answerStampOf(e),[o,e]),h=a.useSyncExternalStore(o.subscribe,f,f),[m,u]=a.useState(0),p=a.useMemo(()=>({path:e,stamp:h,attempt:m}),[e,h,m]),[w,b]=a.useState(null),R=a.useEffectEvent(T=>{b(T),T.kind==="failure"&&s.announce(i.documentFailed(t,ee(i,T.failure.reason)))});a.useEffect(()=>{const T=new AbortController;return r.text(p.path,T.signal).then(M=>{"kind"in M&&R(M)}),()=>T.abort()},[r,p]);const O=a.useCallback(()=>u(T=>T+1),[]);return w===null?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-markup-skeleton",children:nt.map(T=>l.jsx("span",{},T))}),l.jsx("p",{className:"aqmx-sr-only",children:i.markupLoading})]}):w.kind==="failure"?l.jsx(de,{scrollerProps:ot,children:l.jsx(se,{failure:w.failure,alert:!1,onRetry:O,testId:"markdown-explorer-markup-failure"})}):l.jsx(Cn,{document:w,viewer:n})},ot=Object.freeze({className:"aqmx-document-failure","data-aqmx-document-scroller":""}),ls=Object.freeze({reason:"failed"}),as=e=>l.jsx(Rr,{fallback:t=>l.jsx("div",{className:"aqmx-edit-message",children:l.jsx(se,{failure:ls,alert:!1,onRetry:t,testId:"markdown-explorer-edit-load-failure"})}),children:l.jsx(a.Suspense,{fallback:l.jsx("div",{className:"aqmx-skeleton","aria-hidden":"true","data-testid":"markdown-explorer-edit-skeleton",children:nt.map(t=>l.jsx("span",{},t))}),children:l.jsx(kr,{...e})})}),cs=({path:e,document:t,view:n,viewer:r,onRetry:o,editing:s})=>{switch(t.kind){case"markdown":{const{session:i,layout:f,region:h,paneScroll:m,stale:u}=s;if(n==="edit"&&i!==void 0)return l.jsx(as,{path:e,name:t.name,session:i,layout:f,viewer:r,region:h,paneScroll:m});if(n==="markup")return l.jsx(is,{path:e,name:t.name,viewer:r});const p=t.edit!==null&&(t.edit.kind==="inline"||t.edit.kind==="draft");return l.jsx(ss,{path:e,document:t,viewer:r,editing:{editable:p,doubleClick:p&&f==="fill",region:h,paneScroll:m,stale:u}})}case"text":return l.jsx(Cn,{document:t,viewer:r});case"image":return l.jsx(Lo,{document:t});case"media":return l.jsx(es,{document:t});case"file":return l.jsx(no,{document:t});case"failure":return l.jsx(de,{scrollerProps:ot,children:l.jsx(se,{failure:t.failure,alert:!1,onRetry:o,testId:"markdown-explorer-document-failure"})});default:{const i=t;throw new RangeError(`[markdown-explorer] unknown document kind in ${JSON.stringify(i)}`)}}},ds='a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), iframe, audio[controls], video[controls], [tabindex]:not([tabindex="-1"])',us=(e,t,n)=>{const[r]=t.kind==="markdown"?t.headings:[],o=[n===null?null:bn(e,n),r===void 0?null:xn(e,r.id),e.querySelector(Le),e.querySelector(ds)];for(const s of o)if(s instanceof HTMLElement&&et(s))return s;return null},Tt=(e,t,n)=>{const{activeElement:r,body:o}=e.ownerDocument,s=r===null||r===o;t instanceof HTMLElement&&n&&(s||e.contains(r))&&et(t)},fs=e=>{const t=a.useRef(!1);return a.useLayoutEffect(()=>{const n=e.current;if(n===null)throw new Error("[markdown-explorer] the document region is not mounted");const r=n.ownerDocument,o=r.defaultView;if(o===null)throw new Error("[markdown-explorer] the document region's document has no window");let s=!1,i;const f=w=>{s=!(w.target instanceof Node&&n.contains(w.target)),s&&!n.contains(r.activeElement)&&(t.current=!1),clearTimeout(i),i=setTimeout(()=>{s=!1},0)},h=w=>{t.current=w.target instanceof Node&&n.contains(w.target)},m=w=>{w.relatedTarget===null&&s&&(t.current=!1)},u=()=>{const{activeElement:w,body:b}=r;w!==null&&w!==b&&(t.current=n.contains(w))},p=()=>{s&&!n.contains(r.activeElement)&&(t.current=!1)};return o.addEventListener("pointerdown",f,!0),o.addEventListener("mousedown",f,!0),o.addEventListener("focusin",h,!0),o.addEventListener("blur",u),o.addEventListener("focus",p),n.addEventListener("focusout",m),()=>{clearTimeout(i),o.removeEventListener("pointerdown",f,!0),o.removeEventListener("mousedown",f,!0),o.removeEventListener("focusin",h,!0),o.removeEventListener("blur",u),o.removeEventListener("focus",p),n.removeEventListener("focusout",m)}},[e]),t},ms=({path:e,snapshot:t,markup:n,stale:r,viewer:o,editLayout:s,regionLabel:i,navigation:f,fragment:h,paneScroll:m,announces:u,announceFailure:p,onDocumentShown:w})=>{const{labels:b,announcer:R,documents:O}=P(),{document:T}=t,M=a.useRef(null),j=a.useRef(null),x=a.useRef(null),E=a.useRef(0),c=fs(M),d=a.useRef({path:e,document:T}),g=a.useRef(null),L=a.useCallback(U=>{const G=M.current,W=gt(G,U,m);G!==null&&W!==null&&Tt(G,W,c.current)},[m,c]),A=a.useCallback((U,G)=>{const W=E.current;setTimeout(()=>{!G.defaultPrevented&&E.current===W&&L(U)},0)},[L]),N=a.useCallback(U=>{setTimeout(()=>{U.defaultPrevented||L("#")},0)},[L]),$=a.useMemo(()=>({navigation:f,currentPath:e,scrollWithin:L,followSameUrlJump:A,followEmptyFragment:N}),[f,e,L,A,N]),z=a.useCallback(()=>O.retry(e),[O,e]),V=hn(O,jo),q=tn(e),K=q!==void 0?"edit":n?"markup":"rendered",B=T.kind==="markdown"?K:void 0,Q=a.useCallback(()=>M.current,[]),v=a.useMemo(()=>({session:q,layout:s,region:Q,paneScroll:m,stale:r}),[q,s,Q,m,r]),S=B==="edit"?!1:r,k=a.use(ae),C=B==="edit"&&s==="fill"?"fill":k,_=a.useEffectEvent((U,G)=>{const W=j.current;if(W!==null&&W.path===U&&W.snapshot===G)return;j.current={path:U,snapshot:G};const J=G.document;if(J.kind==="failure"){O.noteFailureShown(G)&&p(b.documentFailed(D.lastPathSegment(U),ee(b,J.failure.reason)));return}w?.(U,J),u&&(W===null||W.path!==U||W.snapshot.document.kind==="failure")&&R.announce(b.documentShown(J.name))});a.useEffect(()=>{_(e,t)},[e,t]);const I=a.useEffectEvent(()=>{h.kind==="panel"&&h.consume()}),Z=a.useEffectEvent(U=>{const G=M.current;if(G===null||!c.current)return null;const{activeElement:W,body:J}=G.ownerDocument;return W!==null&&W!==J?null:us(G,T,U)}),H=a.useEffectEvent(U=>{const G=M.current;G!==null&&Tt(G,U,c.current)}),te=a.useEffectEvent(U=>m.reveal(U)),it=a.useEffectEvent(U=>gt(M.current,U,m));return a.useEffect(()=>{if(r)return;const U=d.current.path!==e,G=U||d.current.document!==T;d.current={path:e,document:T};const W=g.current!==e;g.current=e;let J=null;h.kind==="page"?x.current!==h.navigation&&(x.current=h.navigation,E.current+=1,J=h.fragment):h.fragment!==null&&(J=h.fragment,I());const lt=()=>{const Ne=J===null?null:it(J);if(!G){Ne!==null&&H(Ne);return}const at=Z(h.fragment);U&&Ne===null&&at!==null&&te(at)};W?queueMicrotask(lt):lt()},[h,e,T,r]),l.jsx(ae,{value:C,children:l.jsx(me,{kind:T.kind,view:B,label:i(e,T),stale:S,busy:S,frameRef:M,intent:V,children:l.jsx(kn,{value:$,children:l.jsx(Ao,{children:l.jsx(cs,{path:e,document:T,view:K,viewer:o,onRetry:z,editing:v},e)})})})})},st=Object.freeze({kind:"skeleton"}),hs=(e,t,n,r,o)=>{if(t?.status==="loaded")return{kind:"document",path:e,snapshot:t,stale:!1};const s=re(t);if(s!==null)return{kind:"document",path:e,snapshot:s,stale:!0};if(o&&t?.status==="pending")return{kind:"streaming",path:e,promise:t.promise};const i=n===null||n===e?null:re(r);return n===null||i===null?st:{kind:"document",path:n,snapshot:i,stale:!0}},ps=(e,t)=>t.status==="deferred"?st:{kind:"document",path:e,snapshot:t,stale:!1},vs=({requestedPath:e,content:t,markup:n,...r})=>{const o=t.kind==="streaming"?ps(t.path,a.use(t.promise)):t;return o.kind!=="document"?l.jsx(rt,{label:r.regionLabel(e,null)}):l.jsx(ms,{path:o.path,snapshot:o.snapshot,markup:n,stale:o.stale,...r})},An=({path:e,absence:t,markup:n,display:r,navigation:o,fragment:s,paneScroll:i,announces:f,announceFailure:h,onDocumentShown:m})=>{const{config:u,labels:p,locale:w,theme:b,documents:R}=P(),O=he.useMarkdownToolbarState(),T=a.useRef(!1);a.useLayoutEffect(()=>{T.current=!0},[]);const[M,j]=a.useState(null),[x,E]=a.useState(n),c=a.useCallback(()=>e===null?void 0:R.peek(e),[R,e]),d=a.useSyncExternalStore(R.subscribe,c,c),g=a.useCallback(()=>M===null?void 0:R.peek(M),[R,M]),L=a.useSyncExternalStore(R.subscribe,g,g);a.useLayoutEffect(()=>e===null?void 0:R.open(e),[R,e]),a.useLayoutEffect(()=>M===null?void 0:R.retain(M),[R,M]);const A=e===null?st:hs(e,d,M,L,!T.current),N=e===null?null:A.kind==="document"&&!A.stale?A.path:M;N!==M&&j(N);const $=A.kind!=="document"||A.path===e;$&&n!==x&&E(n);const z=a.useMemo(()=>ns(p,w),[p,w]),V=a.useMemo(()=>[...u.iframeHosts],[u]),q=o.kind==="panel",K=a.useMemo(()=>({labels:z,spreadsheetLocale:w,emptyMessage:p.documentEmpty,theme:b,availableStyles:u.documentStyles,iFrameAllowedDomains:V,embeds:u.embeds,linkComponent:Fo,toolbar:O,style:r.style,onStyleChange:r.onStyleChange,align:r.align,onAlignChange:r.onAlignChange,showToc:r.showToc,showStyle:r.showStyle,showAlign:r.showAlign,padding:r.padding,width:r.width===void 0?void 0:`min(${r.width}, 100%)`,maxWidth:r.maxWidth===void 0?void 0:`min(${r.maxWidth}, 100%)`,renderScrollBar:q?void 0:vn}),[z,w,p.documentEmpty,b,u.documentStyles,V,u.embeds,O,r,q]),B=a.useCallback((v,S)=>q?S===null||S.kind==="failure"?D.lastPathSegment(v):S.name:p.documentRegion,[q,p.documentRegion]),Q=q?"content":"fill";return e===null?l.jsx(ae,{value:Q,children:l.jsx(os,{absence:t,announces:f,announceFailure:h})}):l.jsx(ae,{value:Q,children:l.jsx(a.Suspense,{fallback:l.jsx(rt,{label:B(e,null)}),children:l.jsx(vs,{requestedPath:e,content:A,markup:$?n:x,viewer:K,editLayout:r.editLayout,regionLabel:B,navigation:o,fragment:s,paneScroll:i,announces:f,announceFailure:h,onDocumentShown:m})})})},ws=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>{const{config:s,viewSettings:i,announcer:f}=P(),h=pe(A=>A.style),m=pe(A=>A.align),u=ge(),p=Y.useLocation(),w=Te(),{view:b,overrides:R,embed:O}=r,T=a.useCallback(A=>{if(w.kind!=="location")return;const N=rs(s,w.location,A);N!==null&&u(N,"browse")},[s,u,w]),M=a.useCallback(A=>{i.update({style:A}),T("style")},[i,T]),j=a.useCallback(A=>{i.update({align:A}),T("align")},[i,T]),x=Tn(s,R.style,h),E=On(R.align,m),c=a.useMemo(()=>({style:x,onStyleChange:M,align:E,onAlignChange:j,showToc:O.showToc!==!1,showStyle:O.showStyle!==!1,showAlign:O.showAlign!==!1,padding:O.padding,width:O.width,maxWidth:O.maxWidth,editLayout:"fill"}),[x,M,E,j,O]),d=a.useMemo(()=>({kind:"page",view:b,overrides:R,embed:O}),[b,R,O]),g=a.useMemo(()=>({kind:"page",fragment:p.hash,navigation:p}),[p]),L=a.useCallback(A=>f.announce(A),[f]);return l.jsx(An,{path:e,absence:t,markup:n,display:c,navigation:d,fragment:g,paneScroll:co,announces:!0,announceFailure:L,onDocumentShown:o})},gs=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>{const{config:s,viewSettings:i}=P(),f=pe(d=>d.style),h=pe(d=>d.align),[m,u]=a.useState(()=>Tn(s,void 0,f)),p=On(void 0,h),w=a.useCallback(d=>i.update({align:d}),[i]),{maximized:b,onDocumentLink:R,pendingHash:O,onHashConsumed:T,announceFailure:M,paneScroll:j}=r,x=a.useMemo(()=>({style:m,onStyleChange:u,align:p,onAlignChange:w,showToc:b,showStyle:b,showAlign:b,padding:void 0,width:void 0,maxWidth:void 0,editLayout:b?"fill":"content"}),[m,p,w,b]),E=a.useMemo(()=>({kind:"panel",onDocumentLink:R}),[R]),c=a.useMemo(()=>({kind:"panel",fragment:O,consume:T}),[O,T]);return l.jsx(An,{path:e,absence:t,markup:n,display:x,navigation:E,fragment:c,paneScroll:j,announces:!1,announceFailure:M,onDocumentShown:o})},Mn=({path:e,absence:t,markup:n,variant:r,onDocumentShown:o})=>r.kind==="page"?l.jsx(ws,{path:e,absence:t,markup:n,variant:r,onDocumentShown:o}):l.jsx(gs,{path:e,absence:t,markup:n,variant:r,onDocumentShown:o});function Es({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z",clipRule:"evenodd"}))}const jn=y.forwardRef(Es);function xs({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M14.447 3.026a.75.75 0 0 1 .527.921l-4.5 16.5a.75.75 0 0 1-1.448-.394l4.5-16.5a.75.75 0 0 1 .921-.527ZM16.72 6.22a.75.75 0 0 1 1.06 0l5.25 5.25a.75.75 0 0 1 0 1.06l-5.25 5.25a.75.75 0 1 1-1.06-1.06L21.44 12l-4.72-4.72a.75.75 0 0 1 0-1.06Zm-9.44 0a.75.75 0 0 1 0 1.06L2.56 12l4.72 4.72a.75.75 0 0 1-1.06 1.06L.97 12.53a.75.75 0 0 1 0-1.06l5.25-5.25a.75.75 0 0 1 1.06 0Z",clipRule:"evenodd"}))}const Nn=y.forwardRef(xs);function bs({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M15.75 2.25H21a.75.75 0 0 1 .75.75v5.25a.75.75 0 0 1-1.5 0V4.81L8.03 17.03a.75.75 0 0 1-1.06-1.06L19.19 3.75h-3.44a.75.75 0 0 1 0-1.5Zm-10.5 4.5a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h10.5a1.5 1.5 0 0 0 1.5-1.5V10.5a.75.75 0 0 1 1.5 0v8.25a3 3 0 0 1-3 3H5.25a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h8.25a.75.75 0 0 1 0 1.5H5.25Z",clipRule:"evenodd"}))}const Ss=y.forwardRef(bs);function ys({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M11.47 13.28a.75.75 0 0 0 1.06 0l7.5-7.5a.75.75 0 0 0-1.06-1.06L12 11.69 5.03 4.72a.75.75 0 0 0-1.06 1.06l7.5 7.5Z",clipRule:"evenodd"}),y.createElement("path",{fillRule:"evenodd",d:"M11.47 19.28a.75.75 0 0 0 1.06 0l7.5-7.5a.75.75 0 1 0-1.06-1.06L12 17.69l-6.97-6.97a.75.75 0 0 0-1.06 1.06l7.5 7.5Z",clipRule:"evenodd"}))}const ks=y.forwardRef(ys);function Rs({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25ZM12.75 6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-3.75V6Z",clipRule:"evenodd"}))}const Ts=y.forwardRef(Rs);function Os({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{fillRule:"evenodd",d:"M9 1.5H5.625c-1.036 0-1.875.84-1.875 1.875v17.25c0 1.035.84 1.875 1.875 1.875h12.75c1.035 0 1.875-.84 1.875-1.875V12.75A3.75 3.75 0 0 0 16.5 9h-1.875a1.875 1.875 0 0 1-1.875-1.875V5.25A3.75 3.75 0 0 0 9 1.5Zm6.61 10.936a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 14.47a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"}),y.createElement("path",{d:"M12.971 1.816A5.23 5.23 0 0 1 14.25 5.25v1.875c0 .207.168.375.375.375H16.5a5.23 5.23 0 0 1 3.434 1.279 9.768 9.768 0 0 0-6.963-6.963Z"}))}const Ls=y.forwardRef(Os);function Cs({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"}),y.createElement("path",{fillRule:"evenodd",d:"M1.323 11.447C2.811 6.976 7.028 3.75 12.001 3.75c4.97 0 9.185 3.223 10.675 7.69.12.362.12.752 0 1.113-1.487 4.471-5.705 7.697-10.677 7.697-4.97 0-9.186-3.223-10.675-7.69a1.762 1.762 0 0 1 0-1.113ZM17.25 12a5.25 5.25 0 1 1-10.5 0 5.25 5.25 0 0 1 10.5 0Z",clipRule:"evenodd"}))}const Dn=y.forwardRef(Cs);function As({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M21.731 2.269a2.625 2.625 0 0 0-3.712 0l-1.157 1.157 3.712 3.712 1.157-1.157a2.625 2.625 0 0 0 0-3.712ZM19.513 8.199l-3.712-3.712-8.4 8.4a5.25 5.25 0 0 0-1.32 2.214l-.8 2.685a.75.75 0 0 0 .933.933l2.685-.8a5.25 5.25 0 0 0 2.214-1.32l8.4-8.4Z"}),y.createElement("path",{d:"M5.25 5.25a3 3 0 0 0-3 3v10.5a3 3 0 0 0 3 3h10.5a3 3 0 0 0 3-3V13.5a.75.75 0 0 0-1.5 0v5.25a1.5 1.5 0 0 1-1.5 1.5H5.25a1.5 1.5 0 0 1-1.5-1.5V8.25a1.5 1.5 0 0 1 1.5-1.5h5.25a.75.75 0 0 0 0-1.5H5.25Z"}))}const Ms=y.forwardRef(As);function js({title:e,titleId:t,...n},r){return y.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?y.createElement("title",{id:t},e):null,y.createElement("path",{d:"M15 3.75H9v16.5h6V3.75ZM16.5 20.25h3.375c1.035 0 1.875-.84 1.875-1.875V5.625c0-1.036-.84-1.875-1.875-1.875H16.5v16.5ZM4.125 3.75H7.5v16.5H4.125a1.875 1.875 0 0 1-1.875-1.875V5.625c0-1.036.84-1.875 1.875-1.875Z"}))}const Ns=y.forwardRef(js),Pn=({href:e,onRetry:t,testId:n})=>{const{labels:r,onEditGrant:o}=P(),[s,i]=a.useState(!1),f=()=>{o===void 0||s||(i(!0),o(e).then(h=>{h&&t()}).finally(()=>i(!1)))};return l.jsxs("div",{className:"aqmx-callout aqmx-edit-grant","data-testid":n,children:[l.jsx("p",{className:"aqmx-callout-title",children:r.editGrantTitle}),l.jsx("p",{className:"aqmx-callout-body",children:r.editGrantBody}),l.jsxs("div",{className:"aqmx-edit-grant-actions",children:[o===void 0?l.jsx("a",{className:"aqmx-callout-action",href:e,target:"_blank",rel:"noopener","data-testid":`${n}-open`,children:r.editGrantAction}):l.jsx("button",{type:"button",className:"aqmx-callout-action","aria-disabled":s,"data-testid":`${n}-open`,onClick:f,children:r.editGrantAction}),l.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":`${n}-retry`,onClick:t,children:r.editGrantRetry})]})]})},Ds="Control+E Meta+E",_n=(e,t,n)=>n&&t?"split":e.view,Ge=(e,t,n,r)=>{if(n==="split"){e.setSideBySide(!0);return}e.setView(t,n),r&&e.sideBySide()&&e.setSideBySide(!1)},Ps=e=>e==="split"?null:e,$n=e=>e==="preview"?"editor":"preview",Fn=e=>/Mac|iPhone|iPad|iPod/u.test(e),qn=(e,t)=>{if(e.isComposing||e.altKey||e.shiftKey||(t?!e.metaKey||e.ctrlKey:!e.ctrlKey||e.metaKey))return!1;const n=e.key.toLowerCase();return n==="e"||e.code==="KeyE"&&/^\p{L}$/u.test(n)&&!/^[a-z]$/u.test(n)},Ot=(e,t,n)=>{const r=e.modifiedAt===null?Number.NaN:Date.parse(e.modifiedAt);return n(Number.isNaN(r)?e.id:t.format(r),e.author===null?"":e.author)},_s=({path:e,documentName:t,open:n,onClose:r})=>{const{data:o,edits:s,labels:i,locale:f,announcer:h}=P(),m=a.useId(),[u,p]=a.useState(null),[w,b]=a.useState(0),[R,O]=a.useState(null),[T,M]=a.useState(null),j=a.useMemo(()=>new Intl.DateTimeFormat(f,{dateStyle:"medium",timeStyle:"short"}),[f]),x=a.useCallback(()=>{O(null),M(null)},[]),E=Xt({open:n,onOpen:x,onDismiss:r});a.useEffect(()=>{if(!n)return;const g=new AbortController;return p(null),o.revisions(e,g.signal).then(L=>{"kind"in L&&p(L)}),()=>g.abort()},[n,o,e,w]),a.useEffect(()=>{if(!n||R===null)return;const g=new AbortController;return M(null),o.revision(e,R,g.signal).then(L=>{"kind"in L&&M(L)}),()=>g.abort()},[n,o,e,R]);const c=()=>{T===null||T.kind!=="revision"||(s.replaceDraft(e,T.text),h.announce(i.historyRestored(t)),r())},d=u!==null&&u.kind==="revisions"?u.revisions.find(g=>g.id===R):void 0;return l.jsx("dialog",{...E,className:"aqmx-confirm aqmx-history","aria-labelledby":m,"data-testid":"markdown-explorer-history",children:l.jsxs("div",{className:"aqmx-confirm-panel aqmx-history-panel",children:[l.jsx("p",{id:m,className:"aqmx-confirm-title",children:i.historyTitle(t)}),u===null?l.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-loading",children:i.historyLoading}):u.kind==="failure"?l.jsx(se,{failure:u.failure,alert:!1,onRetry:()=>b(g=>g+1),testId:"markdown-explorer-history-failure"}):u.revisions.length===0?l.jsx("p",{className:"aqmx-history-note","data-testid":"markdown-explorer-history-empty",children:i.historyEmpty}):l.jsx("ul",{className:"aqmx-history-list","data-testid":"markdown-explorer-history-list",children:u.revisions.map(g=>l.jsx("li",{children:l.jsxs("button",{type:"button",className:"aqmx-history-entry","aria-pressed":g.id===R,"data-testid":"markdown-explorer-history-entry",onClick:()=>O(g.id),children:[l.jsx("span",{children:Ot(g,j,i.historyEntry)}),g.current?l.jsx("span",{className:"aqmx-history-mark",children:i.historyCurrent}):null,g.kept?l.jsx("span",{className:"aqmx-history-mark",children:i.historyKept}):null]})},g.id))}),R===null?null:T===null?l.jsx("p",{className:"aqmx-history-note",children:i.historyLoading}):T.kind==="failure"?l.jsx(se,{failure:T.failure,alert:!1,testId:"markdown-explorer-history-revision-failure"}):l.jsx("section",{className:"aqmx-history-text",tabIndex:0,"aria-label":d===void 0?i.historyTitle(t):Ot(d,j,i.historyEntry),"data-testid":"markdown-explorer-history-text",children:l.jsx("pre",{children:T.text})}),l.jsxs("div",{className:"aqmx-confirm-actions",children:[l.jsx("button",{type:"button",className:"aqmx-callout-action","data-testid":"markdown-explorer-history-close",onClick:r,children:i.historyClose}),l.jsx("button",{type:"button",className:"aqmx-callout-action","aria-disabled":T===null||T.kind!=="revision","data-testid":"markdown-explorer-history-restore",onClick:c,children:i.historyRestore})]})]})})},$s=e=>{const{documents:t}=P(),n=a.useCallback(()=>t.peek(e),[t,e]),r=a.useCallback(()=>t.peekSeeded(e),[t,e]),o=a.useSyncExternalStore(t.subscribe,n,r),s=re(o)?.document;return s===void 0||s.kind==="failure"?{edit:null,name:D.lastPathSegment(e)}:{edit:s.kind==="markdown"?s.edit:null,name:s.name}},ne=e=>{e.stopPropagation()},Fs=({path:e,documentName:t,iconOnly:n,previewAvailable:r,draft:o})=>{const{draftConverter:s,edits:i,labels:f}=P(),h=a.useSyncExternalStore(i.subscribe,()=>i.session(e)!==void 0,()=>!1),[m,u]=a.useState(null),p=()=>{if(!h){i.start(e,i.viewAnchor(e));return}i.flush(e);const O=i.session(e);O?.dirty===!0?u(O.save.kind==="draft"?"draft":"unsaved"):i.close(e)},w=()=>{h||(yr(),r&&i.sideBySide()&&s?.prepare?.())},b=n?o?f.editDraftDocumentNamed(t):f.editDocumentNamed(t):null,R=o?f.editDraftDocument:f.editDocument;return l.jsxs(l.Fragment,{children:[l.jsxs("button",{type:"button",className:b===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:h?f.closeEditor:b===null?R:b,"aria-label":b===null?void 0:b,"aria-pressed":h,"data-testid":"markdown-explorer-document-edit",onClick:p,onDoubleClick:ne,onPointerEnter:w,onFocus:w,children:[l.jsx(Ms,{"aria-hidden":"true"}),b===null?l.jsx("span",{children:f.editDocumentLabel}):null]}),l.jsx(Yt,{open:m!==null,title:m==="draft"?f.draftDiscardTitle:f.unsavedTitle,body:m==="draft"?f.draftDiscardBody(t):f.unsavedBody(t),confirmLabel:f.unsavedDiscard,cancelLabel:f.unsavedStay,testId:"markdown-explorer-edit-close-confirm",onConfirm:()=>{u(null),i.close(e)},onCancel:()=>u(null)})]})},qs=({href:e,documentName:t,iconOnly:n})=>{const{labels:r}=P(),o=n?r.editExternallyNamed(t):null;return l.jsxs("a",{className:o===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",href:e,target:"_blank",rel:"noopener noreferrer",title:o===null?r.editExternally:o,"aria-label":o===null?void 0:o,"data-testid":"markdown-explorer-document-edit-external",onDoubleClick:ne,children:[l.jsx(Ss,{"aria-hidden":"true"}),o===null?l.jsx("span",{children:r.editExternallyLabel}):null]})},Is=({session:e})=>{const{labels:t}=P(),n=er(t,e);return l.jsx("p",{className:"aqmx-edit-status",title:n===""?void 0:n,"data-testid":"markdown-explorer-edit-status","data-aqmx-save":e.save.kind,children:n})},Bs=Object.freeze(["editor","split","preview"]),Hs=Object.freeze(["editor","preview"]),Us=Object.freeze({editor:Nn,split:Ns,preview:Dn}),Vs=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{draftConverter:s,edits:i,labels:f}=P(),h=rn(),m=_n(r,h,o),u=o?Bs:Hs,p=a.useId(),w=a.useRef(new Map),b={editor:{label:f.editViewEditor,tooltip:f.editViewEditorTooltip},split:{label:f.editViewSplit,tooltip:f.editViewSplitTooltip},preview:{label:f.editViewPreview,tooltip:f.editViewPreviewTooltip}},R=()=>{i.preparePreview(e),s?.prepare?.()},O=T=>{if(!qn(T.nativeEvent,Fn(navigator.platform)))return;Ye(T);const M=$n(m);Ge(i,e,M,o),w.current.get(M)?.focus()};return l.jsx("div",{role:"radiogroup","aria-label":n?f.editViewNamed(t):f.editView,className:"aqmx-edit-view","data-testid":"markdown-explorer-edit-view",onKeyDown:O,children:u.map(T=>{const M=Us[T],{label:j,tooltip:x}=b[T],E=T==="preview"?R:void 0;return l.jsxs("label",{className:n?"aqmx-icon-button":"aqmx-icon-button aqmx-labelled-button",children:[l.jsx("input",{ref:c=>{c===null?w.current.delete(T):w.current.set(T,c)},type:"radio",name:p,value:T,checked:T===m,"aria-label":j,"aria-keyshortcuts":T==="split"?void 0:Ds,title:x,"data-testid":`markdown-explorer-edit-view-${T}`,onChange:()=>Ge(i,e,T,o),onDoubleClick:ne,onPointerEnter:E,onFocus:E}),l.jsx(M,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:j})]},T)})})},zs=({path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o})=>{const{edits:s,labels:i}=P(),[f,h]=a.useState(!1);if(r.phase.kind!=="editing")return null;const m=r.save.kind==="saving",u=m||!r.dirty,p=()=>{s.flush(e);const b=s.session(e);b===void 0||!b.dirty||b.save.kind==="saving"||s.save(e)},w=b=>n?{className:"aqmx-icon-button","aria-label":b}:{className:"aqmx-icon-button aqmx-labelled-button"};return l.jsxs(l.Fragment,{children:[r.save.kind==="conflicts"?l.jsxs("button",{type:"button",...w(i.conflictNext),title:i.conflictNext,"data-testid":"markdown-explorer-edit-next-conflict",onClick:()=>s.nextConflict(e),onDoubleClick:ne,children:[l.jsx(ks,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:i.conflictNext})]}):null,l.jsx(Vs,{path:e,documentName:t,iconOnly:n,session:r,previewAvailable:o}),r.history?l.jsxs("button",{type:"button",...w(i.historyOpen),title:i.historyOpen,"aria-haspopup":"dialog","data-testid":"markdown-explorer-edit-history",onClick:()=>h(!0),onDoubleClick:ne,children:[l.jsx(Ts,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:i.historyOpen})]}):null,r.save.kind==="draft"?null:l.jsxs("button",{type:"button",...w(i.saveDraft),title:i.saveDraftTooltip,"aria-disabled":u,"aria-busy":m,"aria-keyshortcuts":"Control+S Meta+S","data-testid":"markdown-explorer-edit-save",onClick:p,onDoubleClick:ne,children:[l.jsx(Ls,{"aria-hidden":"true"}),n?null:l.jsx("span",{children:i.saveDraft})]}),r.history?l.jsx(_s,{path:e,documentName:t,open:f,onClose:()=>h(!1)}):null]})},Zs=({path:e,session:t})=>{const{edits:n}=P();return t.save.kind!=="grant"?null:l.jsx(Pn,{href:t.save.href,onRetry:()=>{n.save(e)},testId:"markdown-explorer-save-grant"})},Gs=e=>{const{documents:t}=P(),n=a.useCallback(()=>t.peek(e),[t,e]),r=a.useCallback(()=>t.peekSeeded(e),[t,e]),o=a.useSyncExternalStore(t.subscribe,n,r);return re(o)?.document.kind==="markdown"},In=e=>{const{config:t}=P(),n=ge(),r=a.useCallback(()=>n(F.explorerHref(t,{...e,markup:!e.markup}),"browse"),[t,n,e]);return a.useMemo(()=>({shown:e.markup,toggle:r}),[e.markup,r])},Ks=new Set,Ws=(e,t)=>{const{documents:n,announcer:r,labels:o}=P(),s=a.useCallback(()=>n.peek(e),[n,e]),i=a.useCallback(()=>n.peekSeeded(e),[n,e]),f=a.useSyncExternalStore(n.subscribe,s,i),h=a.useCallback(()=>n.answerStampOf(e),[n,e]),m=a.useSyncExternalStore(n.subscribe,h,h),[u]=a.useState(()=>new Set),[p,w]=a.useState(Ks),[b,R]=a.useState(null);b!==null&&b.path!==e&&R(null);const O=a.useRef(null);a.useLayoutEffect(()=>(O.current=e,()=>{O.current=null}),[e]);const T=a.useCallback(()=>{const x=e,E=n.peek(x);if(u.has(x)||E?.status==="pending")return;const c=t&&!gn(E);u.add(x),w(new Set(u)),R(null),(async()=>{try{const d=await n.refresh(x);if(O.current!==x||d.status==="superseded")return;if(d.status==="failed"){R({path:x,failure:d.failure,stamp:n.answerStampOf(x)}),r.announce(o.documentRefreshFailed(ee(o,d.failure.reason)));return}const g=re(n.peek(x));if(c||g===null||g.document.kind==="failure")return;r.announce(o.documentRefreshed(g.document.name))}finally{u.delete(x),w(new Set(u))}})()},[e,t,u,n,r,o]),M=p.has(e),j=b!==null&&b.path===e&&b.stamp===m?b.failure:null;return{refreshing:M,unavailable:M||f?.status==="pending",failure:j,refresh:T}},Bn=Object.freeze({kind:"page"}),Hn=({path:e,placement:t,markup:n})=>{const{labels:r}=P(),{refreshing:o,unavailable:s,failure:i,refresh:f}=Ws(e,t.kind==="page"),h=Gs(e),m=$s(e),u=tn(e),p=t.kind==="panel"?r.refreshDocumentNamed(t.documentName):null,w=t.kind==="panel"?r.showMarkupNamed(t.documentName):null,b=t.kind==="panel",R=t.kind==="panel"?t.documentName:m.name,O=t.kind==="page"||t.maximized;return l.jsxs("div",{className:"aqmx-document-refresh-bar","data-testid":"markdown-explorer-document-refresh-bar","data-aqmx-editing":u===void 0?void 0:"true",children:[l.jsxs("div",{className:"aqmx-document-refresh-row",children:[u===void 0?null:l.jsx(Is,{session:u}),u===void 0?null:l.jsx(zs,{path:e,documentName:R,iconOnly:b,session:u,previewAvailable:O}),u===void 0&&h?l.jsxs("button",{type:"button",className:w===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:w===null?r.showMarkup:w,"aria-label":w===null?void 0:w,"aria-pressed":n.shown,"data-testid":"markdown-explorer-document-markup",onClick:n.toggle,onDoubleClick:ne,children:[l.jsx(Nn,{"aria-hidden":"true"}),w===null?l.jsx("span",{children:r.showMarkupLabel}):null]}):null,u!==void 0||m.edit?.kind==="inline"||m.edit?.kind==="draft"?l.jsx(Fs,{path:e,documentName:R,iconOnly:b,previewAvailable:O,draft:m.edit?.kind==="draft"}):m.edit?.kind==="external"?l.jsx(qs,{href:m.edit.href,documentName:R,iconOnly:b}):null,u===void 0?l.jsxs("button",{type:"button",className:p===null?"aqmx-icon-button aqmx-labelled-button":"aqmx-icon-button",title:p===null?r.refreshDocument:p,"aria-label":p===null?void 0:p,"aria-disabled":s,"aria-busy":o,"data-aqmx-busy":o?"true":void 0,"data-testid":"markdown-explorer-document-refresh",onClick:f,onDoubleClick:ne,children:[l.jsx(jn,{"aria-hidden":"true"}),p===null?l.jsx("span",{children:r.refreshDocumentLabel}):null]}):null]}),u!==void 0||i===null?null:l.jsx("p",{className:"aqmx-document-refresh-failure","data-testid":"markdown-explorer-document-refresh-failure","data-aqmx-failure":i.reason,children:r.documentRefreshFailed(ee(r,i.reason))}),u===void 0?null:l.jsx(Zs,{path:e,session:u})]})},Xs=({location:e})=>{const t=e.doc,n=a.useMemo(()=>({kind:"page",view:"single",overrides:e.overrides,embed:e.embed}),[e.overrides,e.embed]),r=In(e);return l.jsxs("div",{className:"aqmx-single aqmx-document-column","data-testid":"markdown-explorer-single",...Se,children:[l.jsx(Hn,{path:t,placement:Bn,markup:r}),l.jsx(Mn,{path:t,absence:Ln,markup:e.markup,variant:n})]})},Un=({holds:e,testId:t})=>{const{labels:n,announcer:r}=P(),o=a.useId();a.useLayoutEffect(()=>e?r.claim(o):void 0,[e,r,o]);const s=a.useCallback(()=>r.shownIn(o),[r,o]),i=a.useSyncExternalStore(r.subscribe,s,s);return l.jsx("div",{className:"aqmx-sr-only",role:"status","aria-live":"polite","aria-atomic":"true","data-testid":t,children:i.length>1?n.announcementSequence(i):i[0]})},ie=Object.freeze([]),Ys=e=>{const t=new Set;let n=ie,r=[],o=!1;const s=[],i=u=>{n=u;for(const p of[...t])p()},f=()=>s.at(-1)?.region,h=u=>{const p=f();u(),f()!==p&&n!==ie&&i(ie)},m=()=>{o=!1;const u=r.map(p=>"sentence"in p?p.sentence:p.list(p.items));r=[],i(Object.freeze(u))};return{announce:u=>{if(typeof u=="string")r.push({sentence:u});else{const p=r.find(w=>"list"in w&&w.list===u.list);p!==void 0&&"items"in p?p.items.push(u.item):r.push({list:u.list,items:[u.item]})}o||(o=!0,n!==ie&&i(ie),e.request(m))},subscribe:u=>(t.add(u),()=>{t.delete(u)}),claim:u=>{const p={region:u};return h(()=>s.push(p)),()=>h(()=>{const w=s.indexOf(p);w!==-1&&s.splice(w,1)})},shownIn:u=>f()===u?n:ie}},ue=Object.freeze({status:"cancelled"}),Qs=e=>{if(e===null||typeof e!="object")return null;const{failure:t}=e;if(D.failureViolation(t)!==null)return null;const{reason:n,code:r}=t;return D.failureOf(n,r)},Js=({dataPath:e,onScope:t,fetch:n})=>{const r=n??((m,u)=>globalThis.fetch(m,u)),o=(m,u)=>`${e}/${m}?${new URLSearchParams(u).toString()}`,s=async(m,u,p,w)=>{let b;try{b=await r(m,{credentials:"same-origin",...u,headers:{Accept:"application/json",...u.headers}})}catch{return w({reason:"failed"})}b.status===401&&t(null);const R=b.headers.get(D.EXPLORER_SCOPE_HEADER);R!==null&&t(R);let O;try{O=await b.json()}catch{return w({reason:D.failureReasonOfStatus(b.status)})}let T;try{T=p(O)}catch{T=!1}if(T)return O;const M=Qs(O);return w(M!==null?M:{reason:b.status===200?"failed":D.failureReasonOfStatus(b.status)})},i={[D.EXPLORER_PROOF_HEADER]:D.EXPLORER_REFRESH_PROOF},f={[D.EXPLORER_PROOF_HEADER]:D.EXPLORER_EDIT_PROOF,"Content-Type":`${D.EXPLORER_DRAFT_MEDIA_TYPE}; charset=utf-8`},h=async(m,u,p)=>{const w=await s(m,u,p,b=>D.failureDocument(b.reason,b.code));return u.signal.aborted?ue:w};return{tree:m=>s(o("tree",{[D.EXPLORER_DATA_QUERY.source]:m}),{method:"GET"},D.isExplorerTreeResult,u=>({status:"error",failure:u})),children:async(m,u,p)=>{const w=await s(o("children",{[D.EXPLORER_DATA_QUERY.source]:m,[D.EXPLORER_DATA_QUERY.path]:u}),{method:"GET",signal:p},D.isExplorerChildrenResult,b=>({status:"error",failure:b}));return p.aborted?ue:w},ancestors:async(m,u,p)=>{const w=await s(o("ancestors",{[D.EXPLORER_DATA_QUERY.source]:m,[D.EXPLORER_DATA_QUERY.path]:u}),{method:"GET",signal:p},D.isExplorerAncestorsResult,b=>({status:"error",failure:b}));return p.aborted?ue:w},reveal:async(m,u,p)=>{const w=await s(o("reveal",{[D.EXPLORER_DATA_QUERY.source]:m,[D.EXPLORER_DATA_QUERY.path]:u}),{method:"GET",signal:p},D.isExplorerRevealResult,b=>({status:"error",failure:b}));return p.aborted?ue:w},document:(m,{refresh:u})=>s(o("document",{[D.EXPLORER_DATA_QUERY.path]:m}),u?{method:"GET",headers:i}:{method:"GET"},D.isExplorerDocument,p=>D.failureDocument(p.reason,p.code)),text:async(m,u)=>{const p=await s(o("text",{[D.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:u},D.isExplorerTextAnswer,w=>D.failureDocument(w.reason,w.code));return u.aborted?ue:p},edit:(m,u)=>h(o("edit",{[D.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:u},D.isExplorerEditAnswer),save:(m,u,p,w)=>h(o("save",{[D.EXPLORER_DATA_QUERY.path]:m,[D.EXPLORER_DATA_QUERY.base]:u}),{method:"POST",headers:f,body:p,signal:w},D.isExplorerSaveAnswer),preview:(m,u,p)=>h(o("preview",{[D.EXPLORER_DATA_QUERY.path]:m}),{method:"POST",headers:f,body:u,signal:p},D.isExplorerPreviewAnswer),revisions:(m,u)=>h(o("revisions",{[D.EXPLORER_DATA_QUERY.path]:m}),{method:"GET",signal:u},D.isExplorerRevisionsAnswer),revision:(m,u,p)=>h(o("revision",{[D.EXPLORER_DATA_QUERY.path]:m,[D.EXPLORER_DATA_QUERY.revision]:u}),{method:"GET",signal:p},D.isExplorerRevisionAnswer),refresh:m=>s(o("refresh",{[D.EXPLORER_DATA_QUERY.source]:m}),{method:"POST",headers:i},D.isExplorerTreeResult,u=>({status:"error",failure:u}))}},ei=()=>{let e=null,t=null;return{settle:n=>{e=n},mayMove:n=>e!==n,move:(n,r,o)=>{e=r,t={sourceId:n,path:r,ancestors:o}},take:(n,r)=>{const o=t!==null&&t.sourceId===n&&t.path===r?t.ancestors:null;return t=null,o}}},ti=e=>{const t=X.readStorage(e);if(t===null)return F.NO_TREE_SETTING_CHANGES;try{return F.readTreeSettingChanges(JSON.parse(t))}catch(n){return console.warn(`[markdown-explorer] localStorage key ${JSON.stringify(e)} does not hold JSON; using the default tree settings.`,n),F.NO_TREE_SETTING_CHANGES}},Lt=(e,t)=>{let n=null;const r=()=>{if(n===null){const s=ti(e);n={changes:s,settings:F.applyTreeSettingChanges(t,s)}}return n},o=ce();return{storageKey:e,defaults:t,getSnapshot:()=>r().settings,getServerSnapshot:()=>t,subscribe:o.subscribe,advance:s=>{const{changes:i,settings:f}=r(),h=F.recordTreeSettingChange(i,s,F.advanceTreeSetting(f,s)[s],t);return n={changes:h,settings:F.applyTreeSettingChanges(t,h)},o.emit(),X.writeStorage(e,F.serializeTreeSettingChanges(h)),n.settings}}},ni=Object.freeze({status:"refreshed"}),ri=Object.freeze({status:"superseded"}),Ke=Object.freeze({status:"deferred"}),oi=Qt(Ke),Vn=4,si=Vn-1,Ct=Object.freeze({status:"loading"}),ii=Object.freeze({status:"error",failure:Object.freeze({reason:"failed"})}),li=e=>{const t=new Map,n=wn(),r=new Map,o=new Map,s=new Map,i=new Map,f=ce(),h=new Set;let m=0,u=0;const p={direct:null,bulk:null},w=new Set;let b=!1,R=0;const O=()=>{R+=1,f.emit()},T=v=>o.get(v)??0,M=v=>{let S=i.get(v);return S===void 0&&(S={claims:new Map,unclaimed:new Set,direct:new Set,bulk:new Set,inFlight:new Map},i.set(v,S)),S},j=(v,S,k)=>{v.inFlight.delete(S),m-=1,k.lane==="bulk"&&(u-=1)},x=v=>{const S=i.get(v);if(S!==void 0){for(const[k,C]of[...S.inFlight])j(S,k,C),C.controller.abort();S.direct.clear(),S.bulk.clear(),S.unclaimed.clear()}},E=v=>{const S=T(v)+1;return o.set(v,S),x(v),S},c=(v,S)=>{const k=fe(v),C={promise:v,opened:S,stale:!1,loadedAt:k?.status==="ok"?k.loadedAt:null};return v.status==="pending"&&v.then(_=>{_.status==="ok"&&(C.loadedAt=_.loadedAt)}),C},d=v=>{let S=r.get(v);return S===void 0&&(S=new Map,r.set(v,S)),S},g=v=>{const S=[...i.keys()],k=p[v],C=k===null?0:S.indexOf(k)+1;for(let _=0;_<S.length;_+=1){const I=S[(C+_)%S.length],Z=I===void 0?void 0:i.get(I);if(!(I===void 0||Z===void 0)){for(const H of Z[v])if((Z.claims.get(H)??0)!==0)return Z[v].delete(H),p[v]=I,{sourceId:I,path:H}}}return null},L=(v,S,k,C)=>{const _=i.get(v);if(_===void 0||_.inFlight.get(S)!==k)return;j(_,S,k);const I=(_.claims.get(S)??0)>0,Z=d(v);if(C.status==="ok"?Z.set(S,{status:"loaded",entries:C.entries}):C.status==="error"&&I?Z.set(S,{status:"failed",failure:C.failure}):Z.delete(S),O(),C.status==="error"&&I){const H={sourceId:v,path:S,failure:C.failure};for(const te of[...h])te(H)}N()},A=(v,S,k)=>{const C={controller:new AbortController,lane:k};M(v).inFlight.set(S,C),m+=1,k==="bulk"&&(u+=1),e.children(v,S,C.controller.signal).then(_=>L(v,S,C,_),()=>L(v,S,C,ii))},N=()=>{for(;m<Vn;){const v=g("direct");if(v!==null){A(v.sourceId,v.path,"direct");continue}const S=u<si?g("bulk"):null;if(S===null)return;A(S.sourceId,S.path,"bulk")}},$=(v,S,k)=>{if(!(S.direct.delete(k)||S.bulk.delete(k))){const _=S.inFlight.get(k);if(_===void 0)return!1;j(S,k,_),_.controller.abort()}return r.get(v)?.delete(k),!0},z=()=>{b=!1;let v=!1;for(const S of w){const k=M(S);for(const C of k.unclaimed)(k.claims.get(C)??0)===0&&$(S,k,C)&&(v=!0);k.unclaimed.clear()}w.clear(),v&&(O(),N())},V=(v,S)=>{t.set(v,c(ve(e.tree(v)),S))},q=(v,S,k)=>{E(v);const C=c(Qt(S),k);return t.set(v,C),r.delete(v),O(),N(),C},K=(v,S,k,C)=>{if(k!==T(v)||t.get(v)!==S)return;const _=fe(S.promise);if(!(C.status!=="ok"||_?.status!=="ok"||S.loadedAt===null||C.loadedAt<=S.loadedAt)){if(ke(_.entries,C.entries)){S.loadedAt=C.loadedAt;return}q(v,C,S.opened)}},B=(v,S)=>{const k=t.get(v);return k!==void 0&&fe(k.promise)?.status===S},Q=(v,S)=>{S.stale=!1;const k=T(v);e.tree(v).then(C=>K(v,S,k,C))};return{read:v=>t.get(v)?.promise??oi,open:v=>{const S=n.resumes(v),k=n.hold(v),C=t.get(v);return C===void 0||B(v,"deferred")?(V(v,!0),O()):S||(C.opened&&B(v,"error")?(V(v,!0),O()):(C.opened=!0,C.stale&&B(v,"ok")&&Q(v,C))),k},retry:v=>{B(v,"error")&&(V(v,!0),O())},seed:(v,S)=>{const k=S.then(I=>I===null?Ke:I,()=>Ke),C=t.get(v);if(C!==void 0&&B(v,"ok")){const I=T(v);k.then(Z=>K(v,C,I,Z));return}E(v);const _=c(ve(k),C?.opened===!0);t.set(v,_),r.delete(v),N(),k.then(I=>{t.get(v)===_&&(I.status==="deferred"&&n.isHeld(v)&&V(v,_.opened),O())})},refresh:async v=>{const S=(s.get(v)??0)+1;s.set(v,S);const k=await e.refresh(v);if(s.get(v)!==S)return ri;if(k.status==="error")return{status:"failed",failure:k.failure};const C=t.get(v);if(!(C!==void 0&&C.loadedAt!==null&&B(v,"ok")&&C.loadedAt>k.loadedAt)){const I=q(v,k,!0);if(C!==void 0&&C.promise.status==="pending"){const Z=T(v);C.promise.then(H=>K(v,I,Z,H))}}for(const[I,Z]of t)I!==v&&fe(Z.promise)?.status==="ok"&&(Z.stale=!0);return ni},children:(v,S)=>r.get(v)?.get(S),claimChildren:(v,S)=>{const k=M(v),C=d(v);let _=!1,I=!1;for(const[H,te]of S)k.claims.set(H,(k.claims.get(H)??0)+1),C.get(H)===void 0?(C.set(H,Ct),k[te].add(H),_=!0,I=!0):te==="direct"&&k.bulk.delete(H)&&(k.direct.add(H),I=!0);_&&O(),I&&N();let Z=!1;return()=>{if(!Z){Z=!0;for(const H of S.keys()){const te=(k.claims.get(H)??0)-1;te>0?k.claims.set(H,te):(k.claims.delete(H),k.unclaimed.add(H))}w.add(v),!b&&(b=!0,queueMicrotask(z))}}},retryChildren:(v,S)=>{const k=r.get(v);if(k===void 0||k.get(S)?.status!=="failed")return;const C=M(v);if((C.claims.get(S)??0)>0){k.set(S,Ct),C.direct.add(S),O(),N();return}k.delete(S),O()},pendingChildren:v=>{const S=i.get(v);return S===void 0?0:S.direct.size+S.bulk.size+S.inFlight.size},clear:()=>{for(const v of new Set([...t.keys(),...r.keys(),...o.keys(),...i.keys()]))E(v);for(const[v,S]of s)s.set(v,S+1);t.clear(),r.clear(),O()},subscribeChildrenFailures:v=>(h.add(v),()=>{h.delete(v)}),subscribe:f.subscribe,version:()=>R}},ai=(e,t)=>{let n=e;const r=ce();return{getSnapshot:()=>n,subscribe:r.subscribe,update:o=>{n={...n,...o},t(n),r.emit()}}},ci=1;let Ee=0,oe=null;const di=()=>{const{documentElement:e,body:t}=document;Ee===0&&(oe={htmlOverflow:e.style.overflow,bodyOverflow:t.style.overflow,htmlGutter:e.style.scrollbarGutter,bodyGutter:t.style.scrollbarGutter},e.style.overflow="hidden",t.style.overflow="hidden",e.style.scrollbarGutter="auto",t.style.scrollbarGutter="auto"),Ee+=1;let n=!1;return()=>{n||(n=!0,Ee-=1,!(Ee>0||oe===null)&&(e.style.overflow=oe.htmlOverflow,t.style.overflow=oe.bodyOverflow,e.style.scrollbarGutter=oe.htmlGutter,t.style.scrollbarGutter=oe.bodyGutter,oe=null))}},ui=[{selector:'[data-aqmx-document-flow="fill"]',name:"document region"},{selector:"[data-aqmx-explorer-body]",name:"tree area"}],At=1,fi=1e3,Mt=e=>e.getClientRects().length>0,Fe="Give the explorer's container a definite block size (for example height: 100dvh, or a flex column of definite height whose item has flex: 1 and min-height: 0; in a fresh React Router app also html and body at height: 100%) instead of an auto or only a minimum height.",mi=e=>{if(!Mt(e))return null;const t=e.getBoundingClientRect(),n=window.innerHeight;if(t.bottom>n+ci)return`[markdown-explorer] the explorer ends ${String(Math.round(t.bottom))}px down a ${String(n)}px viewport while lockDocumentScroll stops the page from scrolling, so the rest cannot be reached. ${Fe}`;if(t.height<At)return`[markdown-explorer] the explorer collapsed to ${String(Math.round(t.height))}px while lockDocumentScroll stops the page from scrolling, so nothing can be read. ${Fe}`;for(const{selector:r,name:o}of ui)for(const s of e.querySelectorAll(r)){if(!Mt(s))continue;const i=s.getBoundingClientRect().height;if(i<At)return`[markdown-explorer] the explorer's ${o} collapsed to ${String(Math.round(i))}px while lockDocumentScroll stops the page from scrolling, so it cannot be read. ${Fe}`}return null},hi=e=>{let t=!1,n;const r=()=>{n=void 0;const i=mi(e);i!==null&&(t=!0,console.error(i))},o=()=>{t||(clearTimeout(n),n=setTimeout(r,fi))},s=typeof ResizeObserver>"u"?null:new ResizeObserver(o);return s?.observe(e),window.addEventListener("resize",o),o(),()=>{clearTimeout(n),s?.disconnect(),window.removeEventListener("resize",o)}},pi=(e,t)=>{a.useEffect(()=>e?di():void 0,[e]),a.useEffect(()=>{const n=t.current;if(!(!e||n===null))return hi(n)},[e,t])},jt='[data-testid="markdown-explorer-view-switch"]',vi=[{control:jt,successors:[jt,'[data-testid="markdown-explorer-sheet-toggle"]']},{control:'[data-testid="markdown-explorer-selection-open"]',successors:['[data-testid="markdown-explorer-panel-frame"]']}],wi=e=>{for(const t of vi){const n=e.closest(t.control);if(n!==null)return{element:n,control:t}}return null},gi=(e,t)=>{const n=a.useRef(null);a.useEffect(()=>{const o=f=>{const h=e.current;n.current=h!==null&&f instanceof Element&&h.contains(f)?wi(f):null},s=f=>o(f.target);o(document.activeElement);const i=f=>{const h=f.target;f.relatedTarget!==null||!(h instanceof Element)||queueMicrotask(()=>{n.current?.element===h&&h.isConnected&&document.activeElement!==h&&(n.current=null)})};return document.addEventListener("focusin",s),document.addEventListener("focusout",i),()=>{document.removeEventListener("focusin",s),document.removeEventListener("focusout",i)}},[e]);const r=a.useRef(t);a.useLayoutEffect(()=>{if(r.current===t)return;r.current=t;const o=n.current;if(o===null)return;const s=()=>{const h=document.activeElement;if(h!==null&&h!==document.body&&h!==o.element)return!0;const m=e.current;if(m===null)return!0;for(const u of o.control.successors)for(const p of m.querySelectorAll(u))if(p!==o.element&&(p.focus({preventScroll:!0}),document.activeElement===p))return!0;return!1};if(s())return;const i=e.current;if(i===null)return;const f=new MutationObserver(()=>{s()&&f.disconnect()});return f.observe(i,{childList:!0,subtree:!0}),()=>f.disconnect()},[t,e])},Ei=a.lazy(()=>Promise.resolve().then(()=>require("./TreeLayout-C1mTmoPp.cjs")).then(e=>({default:e.TreeLayout}))),xi=a.lazy(()=>Promise.resolve().then(()=>require("./MultiLayout-DtKChQ_s.cjs")).then(e=>({default:e.MultiLayout}))),bi=64,Si={request:e=>{requestAnimationFrame(e)}},Nt=e=>{e.documents.clear(),e.trees.clear()},qe=(e,t)=>{t.tree!==null&&e.trees.seed(t.tree.sourceId,t.tree.result);for(const{path:n,document:r}of t.documents)e.documents.seed(n,r)},yi=(e,t)=>{const[n,r]=a.useState(()=>({overrides:t,locale:e,labels:Ue(e,t)}));if(n.locale===e&&Qn(n.overrides,t))return n.labels;const o={overrides:t,locale:e,labels:Ue(e,t)};return r(o),o.labels},ki=(e,t,n)=>{const[r,o]=a.useState(()=>({scope:t,store:Lt(e,n)}));if(r.scope===t&&r.store.storageKey===e&&r.store.defaults===n)return r.store;const s={scope:t,store:Lt(e,n)};return o(s),s.store},Ie=(e,t)=>{const[n,r]=a.useState(()=>({scope:e,value:t()}));if(n.scope===e)return n.value;const o={scope:e,value:t()};return r(o),o.value},Ri=()=>Ys(Si),Dt="on",Ti="off",Oi=Object.freeze({kind:"unavailable"}),Li=e=>{if(e!==void 0&&(e===null||typeof e!="object"||typeof e.convert!="function"))throw new TypeError("[markdown-explorer] draftConverter must be an object with a convert function")},Ci=(e,t)=>{const n=re(e.peek(t));return n===null||n.document.kind==="failure"?D.lastPathSegment(t):n.document.name},Ai=({data:e,config:t,storageNamespace:n,locale:r,labels:o,theme:s,renderFrame:i,renderTreeFailure:f,lockDocumentScroll:h=!1,onMathDiagnostics:m,onEditGrant:u,draftConverter:p})=>{X.assertStorageNamespace(n),Li(p);const w=Bt(r),b=Jn(s),R=yi(w,o),{revalidate:O}=Y.useRevalidator(),T=a.useRef(()=>{}),M=Y.useHref(t.dataPath),[j]=a.useState(()=>{const k=Js({dataPath:M,onScope:_=>T.current(_)}),C={documents:Fr({client:k,capacity:Math.max(bi,t.multiView.maxPanels*2)}),trees:li(k)};return qe(C,e),X.syncStorageScope(n,e.scope),{data:k,...C,aligned:{pageData:e,storageNamespace:n,pendingReader:null}}});if(j.aligned.pageData!==e||j.aligned.storageNamespace!==n){const k=j.aligned.pageData;j.aligned.pageData=e,j.aligned.storageNamespace=n,k!==e&&(k.scope!==e.scope?j.aligned.pendingReader=e:qe(j,e)),X.syncStorageScope(n,e.scope)}const x=ki(X.storageKeys(n).treeSettings,e.scope,t.defaultTreeSettings);a.useLayoutEffect(()=>{const k=j.aligned.pendingReader;k!==null&&(j.aligned.pendingReader=null,Nt(j),qe(j,k))},[e,j]),a.useLayoutEffect(()=>{let k=!1;return T.current=C=>{C===e.scope||k||(k=!0,C!==null&&(Nt(j),X.clearExplorerStorage(n)),O())},()=>{T.current=()=>{}}},[e,O,j,n]);const E=a.useRef(t.settingsCookie);a.useLayoutEffect(()=>{E.current=t.settingsCookie},[t.settingsCookie]);const[c]=a.useState(()=>ai(e.settings,k=>{document.cookie=F.viewSettingsCookieString(E.current,k,window.location.protocol==="https:")})),d=Ie(e.scope,Ri),g=Ie(e.scope,ei),L=a.useRef(R);a.useLayoutEffect(()=>{L.current=R},[R]);const A=Ie(e.scope,()=>ir({data:j.data,conflictLabels:()=>({ours:L.current.conflictOurs,theirs:L.current.conflictTheirs}),onSaveSettled:(k,C)=>{C.kind==="saved"&&j.documents.refresh(k);const _=tr(L.current,C,Ci(j.documents,k));_!==null&&d.announce(_)},sideBySideSetting:{read:()=>X.readStorage(X.storageKeys(n).editPreview)===Dt,write:k=>X.writeStorage(X.storageKeys(n).editPreview,k?Dt:Ti)},editorShareSetting:{read:()=>sr(X.readStorage(X.storageKeys(n).editSplit)),write:k=>X.writeStorage(X.storageKeys(n).editSplit,String(k))}})),N=a.useMemo(()=>ve(e.notices.catch(()=>[])),[e.notices]),$=e.sources.map(k=>k.id).join(`
|
|
12
|
+
`),z=a.useMemo(()=>F.withExplorerSources(t,$.split(`
|
|
13
|
+
`)),[t,$]),V=a.useRef(m);a.useLayoutEffect(()=>{V.current=m},[m]);const[q]=a.useState(()=>(k,C)=>{V.current?.(k,C)}),K=m===void 0?void 0:q,B=a.useRef(p);a.useLayoutEffect(()=>{B.current=p},[p]);const[Q]=a.useState(()=>{let k=!1;return{convert:(C,_)=>{const I=B.current;return I===void 0?Promise.resolve(Oi):I.convert(C,_)},prepare:()=>{try{B.current?.prepare?.()}catch(C){if(k)return;k=!0,console.error("[markdown-explorer] the draft converter's prepare threw",C)}}}}),v=p===void 0?void 0:Q,S=a.useMemo(()=>({config:z,labels:R,locale:w,theme:b,storageNamespace:n,scope:e.scope,sources:e.sources,notices:N,documents:j.documents,trees:j.trees,data:j.data,viewSettings:c,treeSettings:x,announcer:d,reveals:g,edits:A,onEditGrant:u,draftConverter:v,renderTreeFailure:f,reportMathDiagnostics:K}),[z,R,w,b,n,e.scope,e.sources,N,j,c,x,d,g,A,u,v,f,K]);return l.jsx(Ht,{value:S,children:l.jsx(ji,{renderFrame:i,lockDocumentScroll:h},e.scope)})},Mi=({ref:e,theme:t,view:n,children:r})=>{const[o]=a.useState(yo);return l.jsx("div",{ref:e,className:"aqmx-root","data-aqmx-theme":t,"data-aqmx-view":n,"data-testid":"markdown-explorer",onKeyDownCapture:o.onKeyDownCapture,onKeyUpCapture:o.onKeyUpCapture,onBlurCapture:o.onBlurCapture,children:r})},ji=({renderFrame:e,lockDocumentScroll:t})=>{const{theme:n,labels:r}=P(),o=Te(),{hash:s}=Y.useLocation(),i=ge(),f=a.useRef(null);pi(t,f),a.useLayoutEffect(()=>{o.kind==="redirect"&&i(`${o.href}${s}`,"browse")},[o,s,i]);const{location:h}=o,m=h.view;gi(f,m);const u=h.view==="tree"?l.jsx(a.Suspense,{fallback:l.jsx("section",{className:"aqmx-split-fallback","aria-label":r.explorerRegion,"aria-busy":"true","data-testid":"markdown-explorer-split-loading",...Se}),children:l.jsx(Ei,{location:h})}):h.view==="multi"?l.jsx(a.Suspense,{fallback:l.jsx("section",{className:"aqmx-stage-fallback","aria-label":r.multiRegion,"aria-busy":"true","data-testid":"markdown-explorer-stage-loading",...Se}),children:l.jsx(xi,{location:h})}):l.jsx(Xs,{location:h}),p=l.jsxs(Mi,{ref:f,theme:n,view:m,children:[u,l.jsx(xr,{}),l.jsx(Un,{holds:!0,testId:"markdown-explorer-announcer"})]});return e===void 0?p:e({view:m,children:p})},Ni=Zn.createShouldRevalidate({submissions:"skip",otherPath:"skip",query:"skip",hashChange:"skip"});exports.ALLOW_KEY_REPEAT=Re;exports.CONFLICT_OURS_MARKER=Vt;exports.CONFLICT_SEPARATOR=zt;exports.CONFLICT_THEIRS_MARKER=Zt;exports.CONTENT_PANE=Se;exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=Pt;exports.DocumentPane=Mn;exports.DocumentRefreshBar=Hn;exports.EXPLORER_THEMES=Ve;exports.EditGrantNotice=Pn;exports.ExplorerLink=mn;exports.FOLDER_README_LOADING=Jt;exports.FailureView=se;exports.ForwardRef=jn;exports.ForwardRef$1=Dn;exports.ImageViewMemoryContext=yn;exports.LazyNativeScrollBar=pn;exports.LiveRegion=Un;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=It;exports.MARKDOWN_EXPLORER_LABEL_KEYS=Xe;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=Ft;exports.MARKDOWN_EXPLORER_LOCALES=He;exports.MarkdownExplorer=Ai;exports.NO_DOCUMENT=Ln;exports.PAGE_DOCUMENT_REFRESH=Bn;exports.anchorOfDoubleClick=ln;exports.anchorOfView=an;exports.blockAtLine=un;exports.chooseEditView=Ge;exports.consumeKey=Ye;exports.createEmitter=ce;exports.cssPixels=Kt;exports.editViewOf=_n;exports.explorerNavigationOptions=Dr;exports.failureTitleOf=ee;exports.findConflictsInLines=Gt;exports.focusWithoutScroll=et;exports.frameTopOf=cn;exports.isApplePlatform=Fn;exports.isEditViewShortcut=qn;exports.isEditingDoubleClick=sn;exports.lineTopIn=fn;exports.loadedOf=re;exports.paneShownAlone=Ps;exports.positionInSource=jr;exports.readFolderReadme=en;exports.resolveMarkdownExplorerLabels=Ue;exports.shouldRevalidateExplorer=Ni;exports.toggledEditView=$n;exports.useExplorer=P;exports.useExplorerLocation=Te;exports.useExplorerNavigate=ge;exports.useIntentPrefetch=hn;exports.usePageMarkupToggle=In;exports.useSideBySide=rn;exports.useViewSetting=pe;exports.visibleTopOf=dn;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("./index-T98wklgM.cjs"),e=require("./storage-DM0EvkVf.cjs"),E=require("./location-BVEN_Ihk.cjs"),_=require("./dataRoute-BONacTPi.cjs");exports.DEFAULT_MARKDOWN_EXPLORER_LOCALE=L.DEFAULT_MARKDOWN_EXPLORER_LOCALE;exports.EXPLORER_THEMES=L.EXPLORER_THEMES;exports.MARKDOWN_EXPLORER_LABEL_CATALOGS=L.MARKDOWN_EXPLORER_LABEL_CATALOGS;exports.MARKDOWN_EXPLORER_LABEL_KEYS=L.MARKDOWN_EXPLORER_LABEL_KEYS;exports.MARKDOWN_EXPLORER_LABEL_TEMPLATES=L.MARKDOWN_EXPLORER_LABEL_TEMPLATES;exports.MARKDOWN_EXPLORER_LOCALES=L.MARKDOWN_EXPLORER_LOCALES;exports.MarkdownExplorer=L.MarkdownExplorer;exports.resolveMarkdownExplorerLabels=L.resolveMarkdownExplorerLabels;exports.shouldRevalidateExplorer=L.shouldRevalidateExplorer;exports.clearExplorerStorage=e.clearExplorerStorage;exports.COLUMN_MIN_MEASURE=E.COLUMN_MIN_MEASURE;exports.DEFAULT_TREE_SETTINGS=E.DEFAULT_TREE_SETTINGS;exports.DEFAULT_VIEW_SLUGS=E.DEFAULT_VIEW_SLUGS;exports.EXPAND_ALL_DEPTH_LIMITS=E.EXPAND_ALL_DEPTH_LIMITS;exports.EXPAND_ALL_FOLDER_LIMITS=E.EXPAND_ALL_FOLDER_LIMITS;exports.EXPLORER_DEFAULT_PERCENT=E.EXPLORER_DEFAULT_PERCENT;exports.EXPLORER_MAX_PERCENT=E.EXPLORER_MAX_PERCENT;exports.EXPLORER_MIN_REM=E.EXPLORER_MIN_REM;exports.EXPLORER_MULTI_DEFAULT_PERCENT=E.EXPLORER_MULTI_DEFAULT_PERCENT;exports.GOLDEN_RATIO=E.GOLDEN_RATIO;exports.MULTI_VIEW_COLUMN_LIMITS=E.MULTI_VIEW_COLUMN_LIMITS;exports.MULTI_VIEW_PANEL_LIMITS=E.MULTI_VIEW_PANEL_LIMITS;exports.REVEAL_DOCUMENT_DEPTH_LIMITS=E.REVEAL_DOCUMENT_DEPTH_LIMITS;exports.defineExplorerConfig=E.defineExplorerConfig;exports.explorerHref=E.explorerHref;exports.isExplorerSourceId=E.isExplorerSourceId;exports.resolveExplorerLocation=E.resolveExplorerLocation;exports.withExplorerSources=E.withExplorerSources;exports.DEFAULT_DENIED_PATH_SEGMENTS=_.DEFAULT_DENIED_PATH_SEGMENTS;exports.EXPLORER_EDIT_TOKEN_MAX_LENGTH=_.EXPLORER_EDIT_TOKEN_MAX_LENGTH;exports.EXPLORER_FAILURE_REASONS=_.EXPLORER_FAILURE_REASONS;exports.EXPLORER_MAX_HEADINGS=_.EXPLORER_MAX_HEADINGS;exports.MAX_DOCUMENT_PATH_LENGTH=_.MAX_DOCUMENT_PATH_LENGTH;exports.failureDocument=_.failureDocument;exports.failureOf=_.failureOf;exports.isAcceptableDocumentPath=_.isAcceptableDocumentPath;exports.isDeniedPath=_.isDeniedPath;exports.isExplorerChildrenResult=_.isExplorerChildrenResult;exports.isExplorerFailureCode=_.isExplorerFailureCode;exports.isExplorerFailureReason=_.isExplorerFailureReason;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { W as a, X as L, Y as s, Z as e, _ as r, $ as R, a0 as A, a1 as T, a2 as o } from "./index-
|
|
1
|
+
import { W as a, X as L, Y as s, Z as e, _ as r, $ as R, a0 as A, a1 as T, a2 as o } from "./index-0pnuyLUO.js";
|
|
2
2
|
import { c as O } from "./storage-CmGHg7OA.js";
|
|
3
3
|
import { R as N, T as P, U as l, V as I, W as S, x as X, u as i, X as p, y as x, H as U, Y as t, Z as C, _ as f, $ as u, e as W, i as c, g as n, w as F } from "./location-B-m9scLf.js";
|
|
4
4
|
import { D as d, V as G, W as K, E as m, M as V, z as h, f as w, i as b, C as g, L as v, c as B, b as Y } from "./dataRoute-CObbjNxG.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node-diff3"),r=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("node-diff3"),r=require("./index-T98wklgM.cjs"),R=(n,t,i,l)=>{if(t===n||t===i)return{kind:"clean",text:i};if(i===n)return{kind:"clean",text:t};const d=g.diff3Merge(t.split(`
|
|
2
2
|
`),n.split(`
|
|
3
3
|
`),i.split(`
|
|
4
4
|
`),{excludeFalseConflicts:!0}),o=[];let c=0;const u=s(l.ours),a=s(l.theirs);for(const e of d)e.ok!==void 0?o.push(...e.ok):e.conflict!==void 0&&(c+=1,o.push(`${r.CONFLICT_OURS_MARKER} ${u}`,...e.conflict.a,r.CONFLICT_SEPARATOR,...e.conflict.b,`${r.CONFLICT_THEIRS_MARKER} ${a}`));const f=o.join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { diff3Merge as d } from "node-diff3";
|
|
2
|
-
import { C, a as R, b as u } from "./index-
|
|
2
|
+
import { C, a as R, b as u } from "./index-0pnuyLUO.js";
|
|
3
3
|
const g = (n, o, e, l) => {
|
|
4
4
|
if (o === n || o === e) return { kind: "clean", text: e };
|
|
5
5
|
if (e === n) return { kind: "clean", text: o };
|
|
@@ -85,7 +85,7 @@ The tree's stand-in Tab stop, present while the tab-stop row is outside the tree
|
|
|
85
85
|
| `data-testid="markdown-explorer-edit-skeleton"` | Placeholder while the source for editing (or the editor's chunk) loads | Hidden from assistive technology; the screen-reader text `editLoading` sits beside it |
|
|
86
86
|
| `data-testid="markdown-explorer-edit-grant"` / `-open` / `-retry` | The notice when opening the editor needs a grant, its action (a button with `onEditGrant`, else a link) and Try again | |
|
|
87
87
|
| `data-testid="markdown-explorer-edit-failure"` / `markdown-explorer-edit-load-failure` | Failure to open the source for editing, or to load the editor's chunk | Carry `data-aqmx-failure`; no role (the announcer speaks an opening failure) |
|
|
88
|
-
| `data-testid="markdown-explorer-edit-preview"` | The draft's preview (`role="region"`, named `previewRegion`) | Carries `data-aqmx-preview-tier`: `instant` (the host's draft converter renders drafts in the browser) or `server` (the server renders them: no converter, or a draft the converter cannot render). `aria-busy` until the first rendering lands and while the server renders a newer draft, never for a rendering in the browser; before the first rendering it shows the document's own rendering, or holds `-preview-skeleton` when that is not loaded; holds `-preview-failure` (a notice) after a failed rendering. While the editor shows alone, a preview already mounted keeps rendering and is `inert`: invisible in the editor's place where the surface fills the pane, `hidden` in a panel; the editor is the same while the preview shows alone. Shown alone, a double-click on a word opens the editor at that word |
|
|
88
|
+
| `data-testid="markdown-explorer-edit-preview"` | The draft's preview (`role="region"`, named `previewRegion`) | Carries `data-aqmx-preview-tier`: `instant` (the host's draft converter renders drafts in the browser) or `server` (the server renders them: no converter, or a draft the converter cannot render). `aria-busy` until the first rendering lands and while the server renders a newer draft, never for a rendering in the browser; before the first rendering it shows the document's own rendering (its ```spreadsheets tables editable while the reader has neither changed nor saved the draft, read-only otherwise), or holds `-preview-skeleton` when that is not loaded; holds `-preview-failure` (a notice) after a failed rendering. While the editor shows alone, a preview already mounted keeps rendering and is `inert`: invisible in the editor's place where the surface fills the pane, `hidden` in a panel; the editor is the same while the preview shows alone. Shown alone, a double-click on a word opens the editor at that word |
|
|
89
89
|
| `data-testid="markdown-explorer-image-view"` | Image viewer | |
|
|
90
90
|
| `data-testid="markdown-explorer-image-canvas"` | The image's scroll area | The element that scrolls. In the tree and single views it sits in `@aiquants/markdown`'s HostedScrollArea row (`data-aqmd-scroll-row`, inside its clipping cell `data-aqmd-scroll-clip`), whose bar slot (`data-aqmd-scroll-bar`) holds the explorer's pointer scroll bar; so do a medium's and a file view's stage and the failure view (`data-aqmx-document-scroller`). In a multi-view panel they have no row |
|
|
91
91
|
| `data-testid="markdown-explorer-image"` | The image (`img`) | Carries `data-aqmx-image-mode` (`fit` / `level`) |
|
package/docs/behavior/layout.md
CHANGED
|
@@ -196,7 +196,8 @@ Documents in the multi-panel view sit in `multiView.columns` logical columns (4
|
|
|
196
196
|
Alone, both sit in the grid's one cell: the hidden pane is invisible and inert but keeps its layout and its scroll position, kept in step by the scroll sync below, so switching only changes which pane shows and the block at the top of the view stays the same, by the next frame. The preview is mounted once it was shown or the reader leaned toward it (pointing at or focusing the Preview choice), and keeps rendering while hidden.
|
|
197
197
|
A panel that is not maximized offers the editor and the preview, one at a time: the hidden pane leaves the layout, and switching puts the next pane at the same place on screen, as opening and closing the editor do (the preview's block at the editor's top line, the editor's text at the preview's top block).
|
|
198
198
|
Ctrl+E (⌘E on Apple's platforms, where Ctrl+E stays the editor's move to the line's end) switches between the editor and the preview from the editor, the preview or the view switch — from side by side, to the preview alone — and moves the focus to the pane it shows (the preview's scroller, which then scrolls with the keys; the editor at its cursor), or to the switch's checked choice when pressed there. The preview's scroller is a Tab stop and takes the focus on a click, so after a click in the preview the keys scroll it and Ctrl+E reaches it.
|
|
199
|
-
A
|
|
199
|
+
A ```spreadsheets table shown full screen keeps its keys: Ctrl+E does nothing behind it, and Escape leaves full screen (the editing goes on).
|
|
200
|
+
A double-click on a word of the preview shown alone opens the editor with the cursor on that word, at the same place on screen, except inside an editable table (every table with source lines in the preview) or a table shown full screen, where a double-click edits a cell; a read-only table of the rendered document opens the editor like any other block. Where the bar is narrower than the width from which the side-by-side surface has two columns (a phone; see [The editor's split](#the-editors-split)), the view switch drops its words and keeps its 44 px targets.
|
|
200
201
|
A draft session (a document edited without saving) has the same surface and view switch; its bar shows the draft's status without Save or History.
|
|
201
202
|
Places on screen are kept through the converter's source lines, text matched to text (the top of a word's or a block's first glyphs, since the rendered prose and the editor have different line heights): Edit puts the block at the top of the reader's view, and a double-click the word, exactly where it was; closing puts the editor's top line — the first non-empty one in view — back at the same place in the rendered document, and again on the fresh copy a save made the pane read, unless the reader scrolled, pressed a key or a pointer meanwhile;
|
|
202
203
|
the editor and the preview scroll together, both ways, through a map of the blocks that carry source lines: the top of a block's first line goes with the top of its box and the bottom of its last line with the bottom of its box, positions in between are linear, both tops go together and both bottoms together, and a block whose place differs between the source and the rendering (a footnote, rendered at the end) is left out, so either pane moves continuously and on whenever the other does, crossing a block taller on its side faster.
|
|
@@ -10,10 +10,11 @@ This page is part of the host-facing contract of `@aiquants/markdown-explorer`;
|
|
|
10
10
|
its status texts (`viewerLoading`, `viewerErrorPrefix`, `viewerErrorTitle`, `viewerMissingImage`), its toolbar's buttons (`viewerSelectAlign`, `viewerSelectStyle`, `viewerOpenToc`), the alignment and style menus (`viewerAlignTitle`, `viewerAlignLeft`, `viewerAlignCenter`, `viewerAlignRight`, `viewerPinAlign`, `viewerUnpinAlign`, `viewerStyleTitle`, `viewerPinStyle`, `viewerUnpinStyle`), the table of contents (`viewerTocTitle`, which also names its navigation, `viewerPinToc`, `viewerUnpinToc`)
|
|
11
11
|
and every Mermaid diagram's controls (`viewerMermaidInteractionMode` for the mouse-interaction menu and its button, `viewerMermaidModeNone`, `viewerMermaidModeZoom`, `viewerMermaidModePan`, `viewerMermaidModePanShift`, `viewerMermaidModeBoth`, `viewerMermaidModeBothShift` for its modes, `viewerMermaidInteractionModeTouch` for the same menu and button under a coarse pointer, `viewerMermaidModeNoneTouch`, `viewerMermaidModeZoomTouch`, `viewerMermaidModePanTouch`, `viewerMermaidModeBothTouch` for its touch items, `viewerMermaidZoomIn`, `viewerMermaidZoomOut`, `viewerMermaidResetView`,
|
|
12
12
|
`viewerMermaidPanUp`, `viewerMermaidPanDown`, `viewerMermaidPanLeft`, `viewerMermaidPanRight` for the buttons that move the view while the drawing overflows its frame, `viewerMermaidRetry`, and `viewerMermaidDiagram`, the name of the diagram's focusable frame),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
and the titles of embedded frames (`viewerEmbeddedVideo` and `viewerEmbeddedPost` after a provider's name, as in "YouTube: embedded video", and `viewerEmbeddedFrame` before the host of an iframe written in a document without a title).
|
|
14
|
+
A label the viewer receives carries no `lang` of its own, so it is read in the page's language.
|
|
15
|
+
- Every ```spreadsheets table's labels are `@aiquants/markdown`'s own, derived rather than copied: each label of its table block (`SPREADSHEET_BLOCK_LABEL_CATALOGS` of `@aiquants/markdown/code-blocks`, see its README) is a key prefixed with `viewerSpreadsheet` (`zoomIn` → `viewerSpreadsheetZoomIn`, `cellAnnouncement` → `viewerSpreadsheetCellAnnouncement`), its built-in text is the block's catalog of the UI language, and its placeholders are the block's (`SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS`).
|
|
16
|
+
The explorer passes the viewer only the table labels a host replaced, so every other one keeps the block's text marked with the block's language, and the grid takes `locale` as its own locale, which picks the language of its own catalog, its data-validation messages and its scroll bar.
|
|
17
|
+
A label added to the block becomes a key of the explorer with it. Where the viewer's own built-in label is in a catalog's language, the catalog repeats it word for word (the English catalog the viewer's English labels, such as `Display Style` and `Zoom In`; the Japanese catalog its Japanese ones, such as `目次を開く`), writing a full-width form in half-width (`拡大縮小+移動 (左ドラッグ)` for the viewer's `拡大縮小+移動 (左ドラッグ)`).
|
|
17
18
|
- The explorer passes `treeEntryKindDirectory` and `treeEntryKindFile` (the kind words in the rows' accessible names) and `treeScrollUp`, `treeScrollDown`, `treeScrollToTop` and `treeScrollToBottom` (the tree's scroll bar) to `@aiquants/directory-tree`.
|
|
18
19
|
- The explorer passes every string the multi view's drag-and-drop layout shows to `@aiquants/drag-drop-panels`: the panel headers' buttons (`panelMove`, `panelSwitchToCustomDrag`, `panelSwitchToNormalDrag`, `panelHide`, `panelMaximize`, `panelRestore`, `panelClose`), the items of their move menus (`panelMovePreviousColumn`, `panelMoveNextColumn`, `panelMoveUp`, `panelMoveDown`) and the custom drag mode's badge (`panelCustomDragBadge`),
|
|
19
20
|
the move announcements (`panelMoved`, `panelMoveUnavailable`), a touch or pen drag's lift and cancel announcements (`panelDragStarted`, `panelDragCancelled`), the bar of hidden panels (`hiddenPanelsTitle`)
|
|
@@ -47,7 +48,7 @@ const HANDBOOK_LABELS = {
|
|
|
47
48
|
the path's last segment and the failure's title — the text of the matching `failure…Title` label, not the reason's code), `imageZoomLevel(percent)`, `treeRefreshFailed(reason)`, `documentRefreshed(name)`, `documentRefreshFailed(reason)`, `refreshDocumentNamed(name)` (a multi-view panel's icon-only Refresh document: its accessible name and tooltip, `name` being the panel title),
|
|
48
49
|
`showMarkupNamed(name)` (a multi-view panel's icon-only Source toggle: its accessible name and tooltip, `name` being the panel title), `panelLimit(max)`, `panelOpened(name)`, `panelClosed(name)`, `panelAlreadyOpen(name)`, `panelHidden(name)`, `panelShown(name)`, `panelMaximized(name)`, `panelRestored(name)` — so each language can place the value where its grammar needs it.
|
|
49
50
|
- The labels `@aiquants/drag-drop-panels` fills itself are templates instead, strings whose `{name}` placeholders mark where each value goes: `panelMoved` (`{title}` the panel's name, `{column}` its visible column, `{position}` its place among that column's shown panels), `panelMoveUnavailable` (`{title}`, and `{move}` the name of the move, one of the `panelMove…` labels), `panelDragStarted` and `panelDragCancelled` (`{title}`) and `multiColumnRegion` (`{column}`); columns and positions count from 1.
|
|
50
|
-
So are the table labels `@aiquants/markdown` fills
|
|
51
|
+
So are the table labels `@aiquants/markdown` fills, with the block's placeholders (`viewerSpreadsheetSize` with `{rows}` and `{cols}`, `viewerSpreadsheetCellAnnouncement` with `{cell}` and `{value}`, and so on; `SPREADSHEET_BLOCK_LABEL_PLACEHOLDERS` lists them).
|
|
51
52
|
`MARKDOWN_EXPLORER_LABEL_TEMPLATES` lists each template's placeholders, and braces in every other label are literal text.
|
|
52
53
|
- `labels` must be a plain object. An unknown key throws a `RangeError` that lists the valid keys, a value of the wrong type (a string where a function is expected, or the reverse) throws a `TypeError`, and a blank string throws a `RangeError`, because a blank name is neither shown nor announced. A template that uses a placeholder its key does not offer (`{name}` for `{title}`, say) throws a `RangeError` naming the placeholders it accepts, because a placeholder that is never filled would be read out as it is. A key set to `undefined` keeps the catalog's string.
|
|
53
54
|
- The overrides are compared by value, key by key: writing `labels={{ … }}` inline does not re-render the explorer on every render of the host, but a function created inline is a new value each time — hoist it, or memoize the object.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiquants/markdown-explorer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Markdown document explorer for React Router 8 (framework mode): a source tree with a single-document view and a multi-panel reading view, storage-agnostic server ports, golden-ratio layout and an en / ja UI.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css"
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"@aiquants/directory-tree": "^5.0.1",
|
|
72
72
|
"@aiquants/drag-drop-panels": "^0.12.0",
|
|
73
|
-
"@aiquants/markdown": "^
|
|
73
|
+
"@aiquants/markdown": "^11.0.1",
|
|
74
74
|
"@aiquants/resize-panels": "^2.2.0",
|
|
75
|
-
"@aiquants/spreadsheet": "^0.
|
|
75
|
+
"@aiquants/spreadsheet": "^0.16.0",
|
|
76
76
|
"@aiquants/virtualscroll": "^3.22.1",
|
|
77
77
|
"react": "^19.2.7",
|
|
78
78
|
"react-dom": "^19.2.7",
|
|
@@ -81,9 +81,9 @@
|
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@aiquants/directory-tree": "5.0.1",
|
|
83
83
|
"@aiquants/drag-drop-panels": "0.12.0",
|
|
84
|
-
"@aiquants/markdown": "
|
|
84
|
+
"@aiquants/markdown": "11.0.1",
|
|
85
85
|
"@aiquants/resize-panels": "2.2.0",
|
|
86
|
-
"@aiquants/spreadsheet": "0.
|
|
86
|
+
"@aiquants/spreadsheet": "0.16.0",
|
|
87
87
|
"@aiquants/virtualscroll": "3.22.1",
|
|
88
88
|
"@heroicons/react": "^2.2.0",
|
|
89
89
|
"@playwright/test": "^1.59.1",
|